-- cgit From 5a17f9970c571c609f9a67c41e360bd468452886 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Thu, 19 Feb 2009 13:44:30 +0000 Subject: #i98792# add post yield handler --- vcl/inc/vcl/svapp.hxx | 3 + vcl/inc/vcl/svdata.hxx | 60 ++++++++-------- vcl/inc/vcl/vclevent.hxx | 33 ++++++++- vcl/source/app/svapp.cxx | 165 ++++++++++++++++++++++++++------------------ vcl/source/app/vclevent.cxx | 53 ++++++++++++++ 5 files changed, 214 insertions(+), 100 deletions(-) diff --git a/vcl/inc/vcl/svapp.hxx b/vcl/inc/vcl/svapp.hxx index f853fae6c268..a930fdf4f946 100644 --- a/vcl/inc/vcl/svapp.hxx +++ b/vcl/inc/vcl/svapp.hxx @@ -287,6 +287,9 @@ public: static vos::OThread::TThreadIdentifier GetMainThreadIdentifier(); static ULONG ReleaseSolarMutex(); static void AcquireSolarMutex( ULONG nCount ); + static void EnableNoYieldMode( bool i_bNoYield ); + static void AddPostYieldListener( const Link& i_rListener ); + static void RemovePostYieldListener( const Link& i_rListener ); static BOOL IsInMain(); static BOOL IsInExecute(); diff --git a/vcl/inc/vcl/svdata.hxx b/vcl/inc/vcl/svdata.hxx index a7f34ee5dd56..024549df0416 100644 --- a/vcl/inc/vcl/svdata.hxx +++ b/vcl/inc/vcl/svdata.hxx @@ -110,6 +110,7 @@ class ImplWheelWindow; class SalTimer; class SalI18NImeStatus; class DockingManager; +class VclEventListeners2; namespace vos { class OMutex; } namespace vos { class OCondition; } @@ -130,34 +131,37 @@ struct ImplSVAppData ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF; String* mpMSFTempFileName; - AllSettings* mpSettings; // Application settings - VclEventListeners* mpEventListeners; // listeners for vcl events (eg, extended toolkit) - VclEventListeners* mpKeyListeners; // listeners for key events only (eg, extended toolkit) - ImplAccelManager* mpAccelMgr; // Accelerator Manager - XubString* mpAppName; // Application name - XubString* mpAppFileName; // Abs. Application FileName - XubString* mpDisplayName; // Application Display Name - String* mpFontPath; // Additional Fontpath - Help* mpHelp; // Application help - PopupMenu* mpActivePopupMenu; // Actives Popup-Menu (in Execute) - UniqueIdContainer* mpUniqueIdCont; // Fuer Eindeutige Id's - ImplIdleMgr* mpIdleMgr; // Idle-Manager - ImplWheelWindow* mpWheelWindow; // WheelWindow - ImplHotKey* mpFirstHotKey; // HotKey-Verwaltung - ImplEventHook* mpFirstEventHook; // Event-Hooks - ULONG mnLastInputTime; // GetLastInputTime() - USHORT mnDispatchLevel; // DispatchLevel - USHORT mnModalMode; // ModalMode Count - USHORT mnModalDialog; // ModalDialog Count - USHORT mnAccessCount; // AccessHdl Count - USHORT mnSysWinMode; // Modus, wann SystemWindows erzeugt werden sollen - USHORT mnLayout; // --- RTL-Flags --- currently not used, only for testing - short mnDialogScaleX; // Scale X-Positions and sizes in Dialogs - BOOL mbInAppMain; // is Application::Main() on stack - BOOL mbInAppExecute; // is Application::Execute() on stack - BOOL mbAppQuit; // is Application::Quit() called - BOOL mbSettingsInit; // TRUE: Settings are init - BOOL mbDialogCancel; // TRUE: Alle Dialog::Execute()-Aufrufe werden mit return FALSE sofort beendet + AllSettings* mpSettings; // Application settings + VclEventListeners* mpEventListeners; // listeners for vcl events (eg, extended toolkit) + VclEventListeners* mpKeyListeners; // listeners for key events only (eg, extended toolkit) + ImplAccelManager* mpAccelMgr; // Accelerator Manager + XubString* mpAppName; // Application name + XubString* mpAppFileName; // Abs. Application FileName + XubString* mpDisplayName; // Application Display Name + String* mpFontPath; // Additional Fontpath + Help* mpHelp; // Application help + PopupMenu* mpActivePopupMenu; // Actives Popup-Menu (in Execute) + UniqueIdContainer* mpUniqueIdCont; // Fuer Eindeutige Id's + ImplIdleMgr* mpIdleMgr; // Idle-Manager + ImplWheelWindow* mpWheelWindow; // WheelWindow + ImplHotKey* mpFirstHotKey; // HotKey-Verwaltung + ImplEventHook* mpFirstEventHook; // Event-Hooks + VclEventListeners2* mpPostYieldListeners; // post yield listeners + ULONG mnLastInputTime; // GetLastInputTime() + USHORT mnDispatchLevel; // DispatchLevel + USHORT mnModalMode; // ModalMode Count + USHORT mnModalDialog; // ModalDialog Count + USHORT mnAccessCount; // AccessHdl Count + USHORT mnSysWinMode; // Modus, wann SystemWindows erzeugt werden sollen + USHORT mnLayout; // --- RTL-Flags --- currently not used, only for testing + short mnDialogScaleX; // Scale X-Positions and sizes in Dialogs + BOOL mbInAppMain; // is Application::Main() on stack + BOOL mbInAppExecute; // is Application::Execute() on stack + BOOL mbAppQuit; // is Application::Quit() called + BOOL mbSettingsInit; // TRUE: Settings are initialized + BOOL mbDialogCancel; // TRUE: Alle Dialog::Execute()-Aufrufe werden mit return FALSE sofort beendet + BOOL mbNoYield; // Application::Yield will not wait for events if the queue is empty + // essentially that makes it the same as Application::Reschedule /** Controls whether showing any IME status window is toggled on or off. diff --git a/vcl/inc/vcl/vclevent.hxx b/vcl/inc/vcl/vclevent.hxx index 88ad880e26ab..6f0873b91b92 100644 --- a/vcl/inc/vcl/vclevent.hxx +++ b/vcl/inc/vcl/vclevent.hxx @@ -31,11 +31,13 @@ #ifndef _VCL_VCLEVENT_HXX #define _VCL_VCLEVENT_HXX -#include -#include -#include +#include "tools/link.hxx" +#include "tools/rtti.hxx" +#include "vcl/dllapi.h" +#include "vcl/impdel.hxx" #include +#include class Window; class Menu; @@ -246,4 +248,29 @@ public: BOOL Process( VclSimpleEvent* pEvent ) const; }; +class VCL_DLLPUBLIC VclEventListeners2 : public vcl::DeletionNotifier +{ + std::list< Link > m_aListeners; + + struct ListenerIt + { + std::list< Link >::iterator m_aIt; + bool m_bWasInvalidated; + + ListenerIt() : m_bWasInvalidated( false ) {} + }; + + std::vector< ListenerIt > m_aIterators; + + +public: + VclEventListeners2(); + ~VclEventListeners2(); + + void addListener( const Link& ); + void removeListener( const Link& ); + + void callListeners( VclSimpleEvent* ); +}; + #endif // _VCL_VCLEVENT_HXX diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 262910d18c82..2610858d7f8b 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -31,63 +31,52 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#ifndef _SV_SVSYS_HXX -#include -#endif -#include -#include -#include -#ifndef _VOS_PROCESS_HXX -#include -#endif -#ifndef _VOS_MUTEX_HXX -#include -#endif -#include -#include -#include -#include -#include -#include -#ifndef _ACCMGR_HXX -#include -#endif -#ifndef _SV_KEYCOD_HXX -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef _SV_SVIDS_HRC -#include -#endif -#include - -#include - -#include -#include -#include -#include -#include - -#include -#include +#include "svsys.h" +#include "vcl/salinst.hxx" +#include "vcl/salframe.hxx" +#include "vcl/salsys.hxx" +#include "vos/process.hxx" +#include "vos/mutex.hxx" +#include "tools/tools.h" +#include "tools/debug.hxx" +#include "tools/time.hxx" +#include "i18npool/mslangid.hxx" +#include "vcl/svdata.hxx" +#include "vcl/settings.hxx" +#include "vcl/accmgr.hxx" +#include "vcl/keycod.hxx" +#include "vcl/event.hxx" +#include "vcl/vclevent.hxx" +#include "vcl/virdev.hxx" +#include "vcl/windata.hxx" +#include "vcl/window.h" +#include "vcl/wrkwin.hxx" +#include "vcl/idlemgr.hxx" +#include "vcl/svapp.hxx" +#include "vcl/cvtgrf.hxx" +#include "vcl/unowrap.hxx" +#include "vcl/xconnection.hxx" +#include "vcl/svids.hrc" +#include "vcl/timer.hxx" + +#include "vcl/unohelp.hxx" + +#include "com/sun/star/uno/Reference.h" +#include "com/sun/star/awt/XToolkit.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "comphelper/processfactory.hxx" + +#include "osl/module.h" +#include "osl/file.hxx" #include "osl/thread.h" #include "rtl/tencinfo.h" -#include -#include +#include "rtl/instance.hxx" +#include "vcl/salimestatus.hxx" #include -#include +#include "vcl/lazydelete.hxx" using namespace ::com::sun::star::uno; @@ -467,7 +456,7 @@ void Application::Execute() // ----------------------------------------------------------------------- -void Application::Reschedule( bool bAllEvents ) +inline void ImplYield( bool i_bWait, bool i_bAllEvents ) { ImplSVData* pSVData = ImplGetSVData(); @@ -477,34 +466,45 @@ void Application::Reschedule( bool bAllEvents ) Timer::ImplTimerCallbackProc(); pSVData->maAppData.mnDispatchLevel++; - pSVData->mpDefInst->Yield( false, bAllEvents ); + // do not wait for events if application was already quit; in that + // case only dispatch events already available + // do not wait for events either if the app decided that it is too busy for timers + // (feature added for the slideshow) + pSVData->mpDefInst->Yield( i_bWait && !pSVData->maAppData.mbAppQuit && !pSVData->maAppData.mbNoYield, i_bAllEvents ); pSVData->maAppData.mnDispatchLevel--; // flush lazy deleted objects if( pSVData->maAppData.mnDispatchLevel == 0 ) vcl::LazyDelete::flush(); + + // the system timer events will not necesseraly come in in non waiting mode + // e.g. on aqua; need to trigger timer checks manually + if( pSVData->maAppData.mbNoYield && !pSVData->mbNoCallTimer ) + { + do + { + Timer::ImplTimerCallbackProc(); + } + while( pSVData->mbNotAllTimerCalled ); + } + + // call post yield listeners + if( pSVData->maAppData.mpPostYieldListeners ) + pSVData->maAppData.mpPostYieldListeners->callListeners( NULL ); } // ----------------------------------------------------------------------- -void Application::Yield( bool bAllEvents ) +void Application::Reschedule( bool i_bAllEvents ) { - ImplSVData* pSVData = ImplGetSVData(); - - // run timers that have timed out - if ( !pSVData->mbNoCallTimer ) - while ( pSVData->mbNotAllTimerCalled ) - Timer::ImplTimerCallbackProc(); + ImplYield( false, i_bAllEvents ); +} - // do not wait for events if application was already quit; in that - // case only dispatch events already available - pSVData->maAppData.mnDispatchLevel++; - pSVData->mpDefInst->Yield( !pSVData->maAppData.mbAppQuit, bAllEvents ); - pSVData->maAppData.mnDispatchLevel--; +// ----------------------------------------------------------------------- - // flush lazy deleted objects - if( pSVData->maAppData.mnDispatchLevel == 0 ) - vcl::LazyDelete::flush(); +void Application::Yield( bool i_bAllEvents ) +{ + ImplYield( true, i_bAllEvents ); } // ----------------------------------------------------------------------- @@ -1193,6 +1193,33 @@ void Application::RemoveIdleHdl( const Link& rLink ) // ----------------------------------------------------------------------- +void Application::EnableNoYieldMode( bool i_bNoYield ) +{ + ImplSVData* pSVData = ImplGetSVData(); + pSVData->maAppData.mbNoYield = i_bNoYield; +} + +// ----------------------------------------------------------------------- + +void Application::AddPostYieldListener( const Link& i_rListener ) +{ + ImplSVData* pSVData = ImplGetSVData(); + if( ! pSVData->maAppData.mpPostYieldListeners ) + pSVData->maAppData.mpPostYieldListeners = new VclEventListeners2(); + pSVData->maAppData.mpPostYieldListeners->addListener( i_rListener ); +} + +// ----------------------------------------------------------------------- + +void Application::RemovePostYieldListener( const Link& i_rListener ) +{ + ImplSVData* pSVData = ImplGetSVData(); + if( pSVData->maAppData.mpPostYieldListeners ) + pSVData->maAppData.mpPostYieldListeners->removeListener( i_rListener ); +} + +// ----------------------------------------------------------------------- + WorkWindow* Application::GetAppWindow() { return ImplGetSVData()->maWinData.mpAppWin; diff --git a/vcl/source/app/vclevent.cxx b/vcl/source/app/vclevent.cxx index 8ebc65c8a3f6..704d68c5bc7f 100644 --- a/vcl/source/app/vclevent.cxx +++ b/vcl/source/app/vclevent.cxx @@ -80,3 +80,56 @@ BOOL VclEventListeners::Process( VclSimpleEvent* pEvent ) const } return bProcessed; } + +VclEventListeners2::VclEventListeners2() +{ +} + +VclEventListeners2::~VclEventListeners2() +{ +} + +void VclEventListeners2::addListener( const Link& i_rLink ) +{ + // ensure uniqueness + for( std::list< Link >::const_iterator it = m_aListeners.begin(); it != m_aListeners.end(); ++it ) + { + if( *it == i_rLink ) + return; + } + m_aListeners.push_back( i_rLink ); +} + +void VclEventListeners2::removeListener( const Link& i_rLink ) +{ + size_t n = m_aIterators.size(); + for( size_t i = 0; i < n; i++ ) + { + if( m_aIterators[i].m_aIt != m_aListeners.end() && *m_aIterators[i].m_aIt == i_rLink ) + { + m_aIterators[i].m_bWasInvalidated = true; + ++m_aIterators[i].m_aIt; + } + } + m_aListeners.remove( i_rLink ); +} + +void VclEventListeners2::callListeners( VclSimpleEvent* i_pEvent ) +{ + vcl::DeletionListener aDel( this ); + + m_aIterators.push_back( ListenerIt() ); + size_t nIndex = m_aIterators.size() - 1; + m_aIterators[ nIndex ].m_aIt = m_aListeners.begin(); + while( ! aDel.isDeleted() && m_aIterators[ nIndex ].m_aIt != m_aListeners.end() ) + { + m_aIterators[ nIndex ].m_aIt->Call( i_pEvent ); + if( m_aIterators[ nIndex ].m_bWasInvalidated ) + // check if the current element was removed and the iterator increased in the meantime + m_aIterators[ nIndex ].m_bWasInvalidated = false; + else + ++m_aIterators[ nIndex ].m_aIt; + } + m_aIterators.pop_back(); +} + -- cgit -- cgit -- cgit From 888fa3fad970fd3ba460c97bd8ffe23d1c636767 Mon Sep 17 00:00:00 2001 From: Andre Fischer Date: Fri, 27 Mar 2009 09:05:44 +0000 Subject: Added missing file. --- vcl/prj/d.lst | 1 + 1 file changed, 1 insertion(+) diff --git a/vcl/prj/d.lst b/vcl/prj/d.lst index 0ddc61170547..2b4b1c080838 100644 --- a/vcl/prj/d.lst +++ b/vcl/prj/d.lst @@ -60,6 +60,7 @@ mkdir: %_DEST%\inc%_EXT%\vcl\plug\vcl ..\inc\vcl\imagerepository.hxx %_DEST%\inc%_EXT%\vcl\imagerepository.hxx ..\inc\vcl\imgcons.hxx %_DEST%\inc%_EXT%\vcl\imgcons.hxx ..\inc\vcl\imgctrl.hxx %_DEST%\inc%_EXT%\vcl\imgctrl.hxx +..\inc\vcl\impdel.hxx %_DEST%\inc%_EXT%\vcl\impdel.hxx ..\inc\vcl\inputctx.hxx %_DEST%\inc%_EXT%\vcl\inputctx.hxx ..\inc\vcl\javachild.hxx %_DEST%\inc%_EXT%\vcl\javachild.hxx ..\inc\vcl\jobset.hxx %_DEST%\inc%_EXT%\vcl\jobset.hxx -- cgit From 91cafb0fb3b5c29d7d575691c7bbc6ce737ac9dc Mon Sep 17 00:00:00 2001 From: Andre Fischer Date: Thu, 16 Apr 2009 10:55:00 +0000 Subject: #i95319# Fixed copying of points in copy constructor. --- vcl/source/gdi/regband.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/source/gdi/regband.cxx b/vcl/source/gdi/regband.cxx index 938a30351f9a..09c97ef7cd2b 100644 --- a/vcl/source/gdi/regband.cxx +++ b/vcl/source/gdi/regband.cxx @@ -110,7 +110,7 @@ ImplRegionBand::ImplRegionBand( if ( ! bIgnorePoints) { // Copy points. - ImplRegionBandPoint* pPoint = mpFirstBandPoint; + ImplRegionBandPoint* pPoint = rRegionBand.mpFirstBandPoint; ImplRegionBandPoint* pPrevPointCopy = NULL; while (pPoint != NULL) { -- cgit From d1ec4858282a3799ee081c7b138beea81d6d13fe Mon Sep 17 00:00:00 2001 From: Andre Fischer Date: Thu, 16 Apr 2009 15:28:40 +0000 Subject: #i100905# Handle bottom most band that is only 1 pixel high. --- vcl/source/gdi/region.cxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx index b98712419cf1..43bb224aaa94 100644 --- a/vcl/source/gdi/region.cxx +++ b/vcl/source/gdi/region.cxx @@ -153,7 +153,8 @@ void ImplAddMissingBands ( // We still have to cover two cases: // 1. The region does not yet contain any bands. // 2. The intervall nTop->nBottom extends past the bottom most band. - if (nCurrentTop < nBottom && (pBand==NULL || nBottom>pBand->mnYBottom)) + if (nCurrentTop <= nBottom + && (pBand==NULL || nBottom>pBand->mnYBottom)) { // When there is no previous band then the new one will be the // first. Otherwise the new band is inserted behind the last band. @@ -232,8 +233,9 @@ ImplRegion* ImplRectilinearPolygonToBands (const PolyPolygon& rPolyPoly) ImplRegionBand* pTopBand = pBand; // If necessary split the band at nTop so that nTop is contained // in the lower band. - if ( // Prevent the current band from becoming 0 pixel high - pBand->mnYTopmnYTopmnYBottom>=nTop // do not split a band that is just one pixel high @@ -248,8 +250,9 @@ ImplRegion* ImplRectilinearPolygonToBands (const PolyPolygon& rPolyPoly) pBand = pBand->mpNextBand; // The lowest band may have to be split at nBottom so that // nBottom itself remains in the upper band. - if ( // allow the current band becoming 1 pixel high - pBand->mnYTop<=nBottom + if (pBand!=NULL + // allow the current band becoming 1 pixel high + && pBand->mnYTop<=nBottom // prevent splitting off a band that is 0 pixel high && pBand->mnYBottom>nBottom // do not split a band that is just one pixel high -- cgit -- cgit -- cgit From 8be7ea6f79a756936ab4a38d6086740dd00338c9 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 13 Jul 2009 11:01:23 +0000 Subject: #i64400# hyphen should be part of word by default --- i18npool/inc/breakiterator_ctl.hxx | 1 + i18npool/inc/breakiterator_unicode.hxx | 6 +- i18npool/inc/xdictionary.hxx | 4 +- .../source/breakiterator/breakiterator_cjk.cxx | 4 +- .../source/breakiterator/breakiterator_ctl.cxx | 7 +- .../source/breakiterator/breakiterator_unicode.cxx | 29 ++-- i18npool/source/breakiterator/data/dict_word.txt | 3 +- .../source/breakiterator/data/dict_word_dash.txt | 148 ------------------- .../source/breakiterator/data/dict_word_nodash.txt | 147 +++++++++++++++++++ .../breakiterator/data/dict_word_prepostdash.txt | 157 +++++++++++++++++++++ i18npool/source/breakiterator/makefile.mk | 2 +- i18npool/source/breakiterator/xdictionary.cxx | 30 +++- i18npool/source/localedata/data/de_DE.xml | 9 +- i18npool/source/localedata/data/nl_NL.xml | 35 +++-- i18npool/source/localedata/data/pl_PL.xml | 7 - i18npool/source/localedata/data/sv_SE.xml | 7 + 16 files changed, 405 insertions(+), 191 deletions(-) create mode 100644 i18npool/source/breakiterator/data/dict_word_nodash.txt create mode 100644 i18npool/source/breakiterator/data/dict_word_prepostdash.txt diff --git a/i18npool/inc/breakiterator_ctl.hxx b/i18npool/inc/breakiterator_ctl.hxx index 9e753e8ae16f..3e687b5e8e68 100644 --- a/i18npool/inc/breakiterator_ctl.hxx +++ b/i18npool/inc/breakiterator_ctl.hxx @@ -58,6 +58,7 @@ protected: sal_Int32* nextCellIndex; sal_Int32* previousCellIndex; sal_Int32 cellIndexSize; + virtual void SAL_CALL makeIndex(const rtl::OUString& text, sal_Int32 pos) throw(com::sun::star::uno::RuntimeException); }; diff --git a/i18npool/inc/breakiterator_unicode.hxx b/i18npool/inc/breakiterator_unicode.hxx index 3a0720f27545..654df424b237 100644 --- a/i18npool/inc/breakiterator_unicode.hxx +++ b/i18npool/inc/breakiterator_unicode.hxx @@ -86,12 +86,16 @@ protected: const sal_Char *cBreakIterator, *wordRule, *lineRule; Boundary result; // for word break iterator - struct { + struct BI_Data { UnicodeString aICUText; icu::BreakIterator *aBreakIterator; + + BI_Data() : aICUText(), aBreakIterator(NULL) {} } character, word, sentence, line, *icuBI; + com::sun::star::lang::Locale aLocale; sal_Int16 aBreakType, aWordType; + void SAL_CALL loadICUBreakIterator(const com::sun::star::lang::Locale& rLocale, sal_Int16 rBreakType, sal_Int16 rWordType, const sal_Char* name, const rtl::OUString& rText) throw(com::sun::star::uno::RuntimeException); }; diff --git a/i18npool/inc/xdictionary.hxx b/i18npool/inc/xdictionary.hxx index 32ffdbbfe377..04c5836aaaea 100644 --- a/i18npool/inc/xdictionary.hxx +++ b/i18npool/inc/xdictionary.hxx @@ -45,11 +45,13 @@ namespace com { namespace sun { namespace star { namespace i18n { // cache structure. struct WordBreakCache { - sal_Bool equals(const sal_Unicode *str, Boundary& boundary); // checking cached string sal_Int32 length; // contents length saved here. sal_Unicode *contents; // seperated segment contents. sal_Int32* wordboundary; // word boundaries in segments. sal_Int32 size; // size of wordboundary + + WordBreakCache(); + sal_Bool equals(const sal_Unicode *str, Boundary& boundary); // checking cached string }; class xdictionary diff --git a/i18npool/source/breakiterator/breakiterator_cjk.cxx b/i18npool/source/breakiterator/breakiterator_cjk.cxx index 3d684b8788df..3a44c02edc23 100644 --- a/i18npool/source/breakiterator/breakiterator_cjk.cxx +++ b/i18npool/source/breakiterator/breakiterator_cjk.cxx @@ -46,7 +46,9 @@ namespace com { namespace sun { namespace star { namespace i18n { // class BreakIterator_CJK // ----------------------------------------------------; -BreakIterator_CJK::BreakIterator_CJK() : dict(NULL) +BreakIterator_CJK::BreakIterator_CJK() : + dict( NULL ), + hangingCharacters() { cBreakIterator = "com.sun.star.i18n.BreakIterator_CJK"; } diff --git a/i18npool/source/breakiterator/breakiterator_ctl.cxx b/i18npool/source/breakiterator/breakiterator_ctl.cxx index a42014615f1a..0e1bee869cac 100644 --- a/i18npool/source/breakiterator/breakiterator_ctl.cxx +++ b/i18npool/source/breakiterator/breakiterator_ctl.cxx @@ -45,11 +45,14 @@ namespace com { namespace sun { namespace star { namespace i18n { /** * Constructor. */ -BreakIterator_CTL::BreakIterator_CTL() +BreakIterator_CTL::BreakIterator_CTL() : + cachedText(), + nextCellIndex( NULL ), + previousCellIndex( NULL ), + cellIndexSize( 512 ) { cBreakIterator = "com.sun.star.i18n.BreakIterator_CTL"; // to improve performance, alloc big enough memory in construct. - cellIndexSize = 512; nextCellIndex = (sal_Int32*) calloc(cellIndexSize, sizeof(sal_Int32)); previousCellIndex = (sal_Int32*) calloc(cellIndexSize, sizeof(sal_Int32)); memset(nextCellIndex, 0, cellIndexSize * sizeof(sal_Int32)); diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx index b832bb02e7e9..f0710c996858 100644 --- a/i18npool/source/breakiterator/breakiterator_unicode.cxx +++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx @@ -51,20 +51,23 @@ namespace com { namespace sun { namespace star { namespace i18n { #define ERROR ::com::sun::star::uno::RuntimeException() -#define ImplementName "com.sun.star.i18n.BreakIterator_Unicode"; - - -BreakIterator_Unicode::BreakIterator_Unicode() +//#define ImplementName "com.sun.star.i18n.BreakIterator_Unicode"; + + +BreakIterator_Unicode::BreakIterator_Unicode() : + cBreakIterator( "com.sun.star.i18n.BreakIterator_Unicode" ), // implementation name + wordRule( "word" ), + lineRule( "line" ), + result(), + character(), + word(), + sentence(), + line(), + icuBI( NULL ), + aLocale(), + aBreakType(), + aWordType() { - wordRule="word"; - lineRule="line"; - character.aBreakIterator=word.aBreakIterator=sentence.aBreakIterator=line.aBreakIterator=NULL; - character.aICUText=UnicodeString(); - word.aICUText=UnicodeString(); - sentence.aICUText=UnicodeString(); - line.aICUText=UnicodeString(); - cBreakIterator = ImplementName; - icuBI=NULL; } diff --git a/i18npool/source/breakiterator/data/dict_word.txt b/i18npool/source/breakiterator/data/dict_word.txt index 4c5c80823041..367a82db9e6f 100644 --- a/i18npool/source/breakiterator/data/dict_word.txt +++ b/i18npool/source/breakiterator/data/dict_word.txt @@ -34,7 +34,8 @@ $ALetter = [\u0002 [:Alphabetic:] [:name= COMMERCIAL AT:] [:name= HEBREW PUNCT $MidLetter = [[:name = APOSTROPHE:] [:name = GRAVE ACCENT:] \u0084 [:name = SOFT HYPHEN:] [:name = MIDDLE DOT:] [:name = GREEK TONOS:] [:name= FULL STOP:] [:name = HEBREW PUNCTUATION GERSHAYIM:] [:name = DOUBLE VERTICAL LINE:] [:name = LEFT SINGLE QUOTATION MARK:] - [:name = RIGHT SINGLE QUOTATION MARK:] [:name = HYPHENATION POINT:] [:name = PRIME:] ]; + [:name = RIGHT SINGLE QUOTATION MARK:] [:name = HYPHENATION POINT:] [:name = PRIME:] + [:name = HYPHEN-MINUS:] [:name = EN DASH:] [:name = EM DASH:] ]; $SufixLetter = [:name= FULL STOP:]; diff --git a/i18npool/source/breakiterator/data/dict_word_dash.txt b/i18npool/source/breakiterator/data/dict_word_dash.txt index 7f861c7911ca..e69de29bb2d1 100644 --- a/i18npool/source/breakiterator/data/dict_word_dash.txt +++ b/i18npool/source/breakiterator/data/dict_word_dash.txt @@ -1,148 +0,0 @@ -# -# Copyright (C) 2002-2003, International Business Machines Corporation and others. -# All Rights Reserved. -# -# file: dict_word.txt -# -# ICU Word Break Rules -# See Unicode Standard Annex #29. -# These rules are based on Version 4.0.0, dated 2003-04-17 -# - - - -#################################################################################### -# -# Character class definitions from TR 29 -# -#################################################################################### -$Katakana = [[:Script = KATAKANA:] [:name = KATAKANA-HIRAGANA PROLONGED SOUND MARK:] - [:name = HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK:] - [:name = HALFWIDTH KATAKANA VOICED SOUND MARK:] - [:name = HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK:]]; - -$Ideographic = [:Ideographic:]; -$Hangul = [:Script = HANGUL:]; - -$ALetter = [\u0002 [:Alphabetic:] [:name= COMMERCIAL AT:] [:name= HEBREW PUNCTUATION GERESH:] - - $Ideographic - - $Katakana - - $Hangul - - [:Script = Thai:] - - [:Script = Lao:] - - [:Script = Hiragana:]]; - -$MidLetter = [[:name = APOSTROPHE:] [:name = GRAVE ACCENT:] \u0084 [:name = SOFT HYPHEN:] [:name = MIDDLE DOT:] [:name = GREEK TONOS:] [:name= FULL STOP:] - [:name = HEBREW PUNCTUATION GERSHAYIM:] [:name = DOUBLE VERTICAL LINE:] [:name = LEFT SINGLE QUOTATION MARK:] - [:name = RIGHT SINGLE QUOTATION MARK:] [:name = HYPHENATION POINT:] [:name = PRIME:] - [:name = HYPHEN-MINUS:] [:name = EN DASH:] ]; - -$SufixLetter = [:name= FULL STOP:]; - - -$MidNum = [[:LineBreak = Infix_Numeric:] [:name= COMMERCIAL AT:] \u0084 [:name = GREEK TONOS:] [:name = ARABIC DECIMAL SEPARATOR:] - [:name = LEFT SINGLE QUOTATION MARK:] [:name = RIGHT SINGLE QUOTATION MARK:] [:name = SINGLE HIGH-REVERSED-9 QUOTATION MARK:] - [:name = PRIME:]]; -$Numeric = [:LineBreak = Numeric:]; - - -$TheZWSP = \u200b; - -# -# Character Class Definitions. -# The names are those from TR29. -# -$CR = \u000d; -$LF = \u000a; -$Control = [[[:Zl:] [:Zp:] [:Cc:] [:Cf:]] - $TheZWSP]; -$Extend = [[:Grapheme_Extend = TRUE:]]; - - - - -#################################################################################### -# -# Word Break Rules. Definitions and Rules specific to word break begin Here. -# -#################################################################################### - -$Format = [[:Cf:] - $TheZWSP]; - - - -# Rule 3: Treat a grapheme cluster as if it were a single character. -# Hangul Syllables are easier to deal with here than they are in Grapheme Clusters -# because we don't need to find the boundaries between adjacent syllables - -# they won't be word boundaries. -# - - -# -# "Extended" definitions. Grapheme Cluster + Format Chars, treated like the base char. -# -$ALetterEx = $ALetter $Extend*; -$NumericEx = $Numeric $Extend*; -$MidNumEx = $MidNum $Extend*; -$MidLetterEx = $MidLetter $Extend*; -$SufixLetterEx= $SufixLetter $Extend*; -$KatakanaEx = $Katakana $Extend*; -$IdeographicEx= $Ideographic $Extend*; -$HangulEx = $Hangul $Extend*; -$FormatEx = $Format $Extend*; - - -# -# Numbers. Rules 8, 11, 12 form the TR. -# -$NumberSequence = $NumericEx ($FormatEx* $MidNumEx? $FormatEx* $NumericEx)*; -$NumberSequence {100}; - -# -# Words. Alpha-numerics. Rule 5, 6, 7, 9, 10 -# - must include at least one letter. -# - may include both letters and numbers. -# - may include MideLetter, MidNumber punctuation. -# -$LetterSequence = $ALetterEx ($FormatEx* $MidLetterEx? $FormatEx* $ALetterEx)*; # rules #6, #7 -($NumberSequence $FormatEx*)? $LetterSequence ($FormatEx* ($NumberSequence | $LetterSequence))* $SufixLetterEx? {200}; - -[[:P:][:S:]]*; - -# -# Do not break between Katakana. Rule #13. -# -$KatakanaEx ($FormatEx* $KatakanaEx)* {300}; -[:Hiragana:] $Extend* {300}; - -# -# Ideographic Characters. Stand by themselves as words. -# Separated from the "Everything Else" rule, below, only so that they -# can be tagged with a return value. TODO: is this what we want? -# -$IdeographicEx ($FormatEx* $IdeographicEx)* {400}; -$HangulEx ($FormatEx* $HangulEx)* {400}; - -# -# Everything Else, with no tag. -# Non-Control chars combine with $Extend (combining) chars. -# Controls are do not. -# -[^$Control [:Ideographic:]] $Extend*; -$CR $LF; - -# -# Reverse Rules. Back up over any of the chars that can group together. -# (Reverse rules do not need to be exact; they can back up too far, -# but must back up at least enough, and must stop on a boundary.) -# - -# NonStarters are the set of all characters that can appear at the 2nd - nth position of -# a word. (They may also be the first.) The reverse rule skips over these, until it -# reaches something that can only be the start (and probably only) char in a "word". -# A space or punctuation meets the test. -# -$NonStarters = [$Numeric $ALetter $Katakana $Ideographic $Hangul [:P:] [:S:] $MidLetter $MidNum $SufixLetter $Extend $Format]; - -#!.*; -! ($NonStarters* | \n \r) .; - diff --git a/i18npool/source/breakiterator/data/dict_word_nodash.txt b/i18npool/source/breakiterator/data/dict_word_nodash.txt new file mode 100644 index 000000000000..4c5c80823041 --- /dev/null +++ b/i18npool/source/breakiterator/data/dict_word_nodash.txt @@ -0,0 +1,147 @@ +# +# Copyright (C) 2002-2003, International Business Machines Corporation and others. +# All Rights Reserved. +# +# file: dict_word.txt +# +# ICU Word Break Rules +# See Unicode Standard Annex #29. +# These rules are based on Version 4.0.0, dated 2003-04-17 +# + + + +#################################################################################### +# +# Character class definitions from TR 29 +# +#################################################################################### +$Katakana = [[:Script = KATAKANA:] [:name = KATAKANA-HIRAGANA PROLONGED SOUND MARK:] + [:name = HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK:] + [:name = HALFWIDTH KATAKANA VOICED SOUND MARK:] + [:name = HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK:]]; + +$Ideographic = [:Ideographic:]; +$Hangul = [:Script = HANGUL:]; + +$ALetter = [\u0002 [:Alphabetic:] [:name= COMMERCIAL AT:] [:name= HEBREW PUNCTUATION GERESH:] + - $Ideographic + - $Katakana + - $Hangul + - [:Script = Thai:] + - [:Script = Lao:] + - [:Script = Hiragana:]]; + +$MidLetter = [[:name = APOSTROPHE:] [:name = GRAVE ACCENT:] \u0084 [:name = SOFT HYPHEN:] [:name = MIDDLE DOT:] [:name = GREEK TONOS:] [:name= FULL STOP:] + [:name = HEBREW PUNCTUATION GERSHAYIM:] [:name = DOUBLE VERTICAL LINE:] [:name = LEFT SINGLE QUOTATION MARK:] + [:name = RIGHT SINGLE QUOTATION MARK:] [:name = HYPHENATION POINT:] [:name = PRIME:] ]; + +$SufixLetter = [:name= FULL STOP:]; + + +$MidNum = [[:LineBreak = Infix_Numeric:] [:name= COMMERCIAL AT:] \u0084 [:name = GREEK TONOS:] [:name = ARABIC DECIMAL SEPARATOR:] + [:name = LEFT SINGLE QUOTATION MARK:] [:name = RIGHT SINGLE QUOTATION MARK:] [:name = SINGLE HIGH-REVERSED-9 QUOTATION MARK:] + [:name = PRIME:]]; +$Numeric = [:LineBreak = Numeric:]; + + +$TheZWSP = \u200b; + +# +# Character Class Definitions. +# The names are those from TR29. +# +$CR = \u000d; +$LF = \u000a; +$Control = [[[:Zl:] [:Zp:] [:Cc:] [:Cf:]] - $TheZWSP]; +$Extend = [[:Grapheme_Extend = TRUE:]]; + + + + +#################################################################################### +# +# Word Break Rules. Definitions and Rules specific to word break begin Here. +# +#################################################################################### + +$Format = [[:Cf:] - $TheZWSP]; + + + +# Rule 3: Treat a grapheme cluster as if it were a single character. +# Hangul Syllables are easier to deal with here than they are in Grapheme Clusters +# because we don't need to find the boundaries between adjacent syllables - +# they won't be word boundaries. +# + + +# +# "Extended" definitions. Grapheme Cluster + Format Chars, treated like the base char. +# +$ALetterEx = $ALetter $Extend*; +$NumericEx = $Numeric $Extend*; +$MidNumEx = $MidNum $Extend*; +$MidLetterEx = $MidLetter $Extend*; +$SufixLetterEx= $SufixLetter $Extend*; +$KatakanaEx = $Katakana $Extend*; +$IdeographicEx= $Ideographic $Extend*; +$HangulEx = $Hangul $Extend*; +$FormatEx = $Format $Extend*; + + +# +# Numbers. Rules 8, 11, 12 form the TR. +# +$NumberSequence = $NumericEx ($FormatEx* $MidNumEx? $FormatEx* $NumericEx)*; +$NumberSequence {100}; + +# +# Words. Alpha-numerics. Rule 5, 6, 7, 9, 10 +# - must include at least one letter. +# - may include both letters and numbers. +# - may include MideLetter, MidNumber punctuation. +# +$LetterSequence = $ALetterEx ($FormatEx* $MidLetterEx? $FormatEx* $ALetterEx)*; # rules #6, #7 +($NumberSequence $FormatEx*)? $LetterSequence ($FormatEx* ($NumberSequence | $LetterSequence))* $SufixLetterEx? {200}; + +[[:P:][:S:]]*; + +# +# Do not break between Katakana. Rule #13. +# +$KatakanaEx ($FormatEx* $KatakanaEx)* {300}; +[:Hiragana:] $Extend* {300}; + +# +# Ideographic Characters. Stand by themselves as words. +# Separated from the "Everything Else" rule, below, only so that they +# can be tagged with a return value. TODO: is this what we want? +# +$IdeographicEx ($FormatEx* $IdeographicEx)* {400}; +$HangulEx ($FormatEx* $HangulEx)* {400}; + +# +# Everything Else, with no tag. +# Non-Control chars combine with $Extend (combining) chars. +# Controls are do not. +# +[^$Control [:Ideographic:]] $Extend*; +$CR $LF; + +# +# Reverse Rules. Back up over any of the chars that can group together. +# (Reverse rules do not need to be exact; they can back up too far, +# but must back up at least enough, and must stop on a boundary.) +# + +# NonStarters are the set of all characters that can appear at the 2nd - nth position of +# a word. (They may also be the first.) The reverse rule skips over these, until it +# reaches something that can only be the start (and probably only) char in a "word". +# A space or punctuation meets the test. +# +$NonStarters = [$Numeric $ALetter $Katakana $Ideographic $Hangul [:P:] [:S:] $MidLetter $MidNum $SufixLetter $Extend $Format]; + +#!.*; +! ($NonStarters* | \n \r) .; + diff --git a/i18npool/source/breakiterator/data/dict_word_prepostdash.txt b/i18npool/source/breakiterator/data/dict_word_prepostdash.txt new file mode 100644 index 000000000000..1bf94451fae2 --- /dev/null +++ b/i18npool/source/breakiterator/data/dict_word_prepostdash.txt @@ -0,0 +1,157 @@ +# +# Copyright (C) 2002-2003, International Business Machines Corporation and others. +# All Rights Reserved. +# +# file: dict_word.txt +# +# ICU Word Break Rules +# See Unicode Standard Annex #29. +# These rules are based on Version 4.0.0, dated 2003-04-17 +# + + + +#################################################################################### +# +# Character class definitions from TR 29 +# +#################################################################################### +$Katakana = [[:Script = KATAKANA:] [:name = KATAKANA-HIRAGANA PROLONGED SOUND MARK:] + [:name = HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK:] + [:name = HALFWIDTH KATAKANA VOICED SOUND MARK:] + [:name = HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK:]]; + +$Ideographic = [:Ideographic:]; +$Hangul = [:Script = HANGUL:]; + +# list of dashes or hyphens that should be accepted as part of the word if a single one of these +# pre- or postfixes a word. E.g. in German: "Arbeits-" or "-nehmer" where that hyphen needs to +# be part of the word in order to have it properly spell checked etc. +$PrePostDashHyphen = [ [:name = HYPHEN-MINUS:] [:name = EN DASH:] [:name = EM DASH:] ]; + + +$ALetter = [\u0002 [:Alphabetic:] [:name= COMMERCIAL AT:] [:name= HEBREW PUNCTUATION GERESH:] + - $Ideographic + - $Katakana + - $Hangul + - [:Script = Thai:] + - [:Script = Lao:] + - [:Script = Hiragana:]]; + +$MidLetter = [[:name = APOSTROPHE:] [:name = GRAVE ACCENT:] \u0084 [:name = SOFT HYPHEN:] [:name = MIDDLE DOT:] [:name = GREEK TONOS:] [:name= FULL STOP:] + [:name = HEBREW PUNCTUATION GERSHAYIM:] [:name = DOUBLE VERTICAL LINE:] [:name = LEFT SINGLE QUOTATION MARK:] + [:name = RIGHT SINGLE QUOTATION MARK:] [:name = HYPHENATION POINT:] [:name = PRIME:] + [:name = HYPHEN-MINUS:] [:name = EN DASH:] [:name = EM DASH:] ]; + +$SufixLetter = [:name= FULL STOP:]; + + +$MidNum = [[:LineBreak = Infix_Numeric:] [:name= COMMERCIAL AT:] \u0084 [:name = GREEK TONOS:] [:name = ARABIC DECIMAL SEPARATOR:] + [:name = LEFT SINGLE QUOTATION MARK:] [:name = RIGHT SINGLE QUOTATION MARK:] [:name = SINGLE HIGH-REVERSED-9 QUOTATION MARK:] + [:name = PRIME:]]; +$Numeric = [:LineBreak = Numeric:]; + + +$TheZWSP = \u200b; + +# +# Character Class Definitions. +# The names are those from TR29. +# +$CR = \u000d; +$LF = \u000a; +$Control = [[[:Zl:] [:Zp:] [:Cc:] [:Cf:]] - $TheZWSP]; +$Extend = [[:Grapheme_Extend = TRUE:]]; + + + + +#################################################################################### +# +# Word Break Rules. Definitions and Rules specific to word break begin Here. +# +#################################################################################### + +$Format = [[:Cf:] - $TheZWSP]; + + + +# Rule 3: Treat a grapheme cluster as if it were a single character. +# Hangul Syllables are easier to deal with here than they are in Grapheme Clusters +# because we don't need to find the boundaries between adjacent syllables - +# they won't be word boundaries. +# + + +# +# "Extended" definitions. Grapheme Cluster + Format Chars, treated like the base char. +# +$ALetterEx = $ALetter $Extend*; +$NumericEx = $Numeric $Extend*; +$MidNumEx = $MidNum $Extend*; +$MidLetterEx = $MidLetter $Extend*; +$SufixLetterEx= $SufixLetter $Extend*; +$KatakanaEx = $Katakana $Extend*; +$IdeographicEx= $Ideographic $Extend*; +$HangulEx = $Hangul $Extend*; +$FormatEx = $Format $Extend*; + + +# +# Numbers. Rules 8, 11, 12 form the TR. +# +$NumberSequence = $NumericEx ($FormatEx* $MidNumEx? $FormatEx* $NumericEx)*; +$NumberSequence {100}; + +# +# Words. Alpha-numerics. Rule 5, 6, 7, 9, 10 +# - must include at least one letter. +# - may include both letters and numbers. +# - may include MideLetter, MidNumber punctuation. +# +# At most one leading or trailing dash/hyphen should be accepted as well. +# E.g. in German: "Arbeits-" or "-nehmer" where that hyphen needs to +# be part of the word in order to have it properly spell checked etc. +$LetterSequence = $PrePostDashHyphen? $ALetterEx ($FormatEx* $MidLetterEx? $FormatEx* $ALetterEx)* $PrePostDashHyphen?; # rules #6, #7 +($NumberSequence $FormatEx*)? $LetterSequence ($FormatEx* ($NumberSequence | $LetterSequence))* $SufixLetterEx? {200}; + +[[:P:][:S:]]*; + +# +# Do not break between Katakana. Rule #13. +# +$KatakanaEx ($FormatEx* $KatakanaEx)* {300}; +[:Hiragana:] $Extend* {300}; + +# +# Ideographic Characters. Stand by themselves as words. +# Separated from the "Everything Else" rule, below, only so that they +# can be tagged with a return value. TODO: is this what we want? +# +$IdeographicEx ($FormatEx* $IdeographicEx)* {400}; +$HangulEx ($FormatEx* $HangulEx)* {400}; + +# +# Everything Else, with no tag. +# Non-Control chars combine with $Extend (combining) chars. +# Controls are do not. +# +[^$Control [:Ideographic:]] $Extend*; +$CR $LF; + +# +# Reverse Rules. Back up over any of the chars that can group together. +# (Reverse rules do not need to be exact; they can back up too far, +# but must back up at least enough, and must stop on a boundary.) +# + +# NonStarters are the set of all characters that can appear at the 2nd - nth position of +# a word. (They may also be the first.) The reverse rule skips over these, until it +# reaches something that can only be the start (and probably only) char in a "word". +# A space or punctuation meets the test. +# +$NonStarters = [$Numeric $ALetter $Katakana $Ideographic $Hangul [:P:] [:S:] $MidLetter $MidNum $SufixLetter $Extend $Format]; + +#!.*; +! ($NonStarters* | \n \r) .; + diff --git a/i18npool/source/breakiterator/makefile.mk b/i18npool/source/breakiterator/makefile.mk index 7ba9cd3e753d..50e437e98b91 100644 --- a/i18npool/source/breakiterator/makefile.mk +++ b/i18npool/source/breakiterator/makefile.mk @@ -93,7 +93,7 @@ $(MISC)$/%_brk.c : $(MISC)$/%.brk # The output of gencmn generates warnings under Windows. We want to minimize the patches to external tools, # so the output (OpenOffice_icu_dat.c) is changed here to include a pragma to disable the warnings. # Output of gencmn is redirected to OpenOffice_icu_tmp.c with the -t switch. -$(MISC)$/OpenOffice_%.c : +$(MISC)$/OpenOffice_%.c : $(MY_BRK_BRKFILES:s/.brk/_brk.c/) $(WRAPCMD) $(GENCMN) -n OpenOffice -t tmp -S -d $(MISC) O $(mktmp $(subst,$(MISC)$/, $(MY_BRK_BRKFILES:t"\n"))) echo $(USQ)#ifdef _MSC_VER$(USQ) > $@ echo $(USQ)#pragma warning( disable : 4229 4668 )$(USQ) >> $@ diff --git a/i18npool/source/breakiterator/xdictionary.cxx b/i18npool/source/breakiterator/xdictionary.cxx index fb832f0b6468..f286dd2449ac 100644 --- a/i18npool/source/breakiterator/xdictionary.cxx +++ b/i18npool/source/breakiterator/xdictionary.cxx @@ -54,7 +54,21 @@ namespace com { namespace sun { namespace star { namespace i18n { extern "C" { static void SAL_CALL thisModule() {} } -xdictionary::xdictionary(const sal_Char *lang) +xdictionary::xdictionary(const sal_Char *lang) : + existMark( NULL ), + index1( NULL ), + index2( NULL ), + lenArray( NULL ), + dataArea( NULL ), + hModule( NULL ), + boundary(), + japaneseWordBreak( sal_False ) +#if USE_CELL_BOUNDARY_CODE + // For CTL breakiterator, where the word boundary should not be inside cell. + , + useCellBoundary( sal_False ), + cellBoundary( NULL ) +#endif { index1 = 0; #ifdef SAL_DLLPREFIX @@ -92,6 +106,7 @@ xdictionary::xdictionary(const sal_Char *lang) #if USE_CELL_BOUNDARY_CODE useCellBoundary = sal_False; + cellBoundary = NULL; #endif japaneseWordBreak = sal_False; } @@ -149,6 +164,19 @@ sal_Int32 xdictionary::getLongestMatch(const sal_Unicode* str, sal_Int32 sLen) { return 0; } + +/* + * c-tor + */ + +WordBreakCache::WordBreakCache() : + length( 0 ), + contents( NULL ), + wordboundary( NULL ), + size( 0 ) +{ +} + /* * Compare two unicode string, */ diff --git a/i18npool/source/localedata/data/de_DE.xml b/i18npool/source/localedata/data/de_DE.xml index 295b826a5e9f..a83b3dbb791d 100644 --- a/i18npool/source/localedata/data/de_DE.xml +++ b/i18npool/source/localedata/data/de_DE.xml @@ -328,7 +328,14 @@ - + + + dict_word_prepostdash + + + + + wahr falsch 1. Quartal diff --git a/i18npool/source/localedata/data/nl_NL.xml b/i18npool/source/localedata/data/nl_NL.xml index eedfdc146b5e..5a91c9c3e42e 100644 --- a/i18npool/source/localedata/data/nl_NL.xml +++ b/i18npool/source/localedata/data/nl_NL.xml @@ -360,20 +360,27 @@ - -waar -onwaar -1ste kwartaal -2de kwartaal -3de kwartaal -4de kwartaal -boven -onder -K1 -K2 -K3 -K4 - + + + dict_word_prepostdash + + + + + + waar + onwaar + 1ste kwartaal + 2de kwartaal + 3de kwartaal + 4de kwartaal + boven + onder + K1 + K2 + K3 + K4 + diff --git a/i18npool/source/localedata/data/pl_PL.xml b/i18npool/source/localedata/data/pl_PL.xml index 4119060ea7df..195689666247 100644 --- a/i18npool/source/localedata/data/pl_PL.xml +++ b/i18npool/source/localedata/data/pl_PL.xml @@ -326,13 +326,6 @@ - - - dict_word_dash - - - - prawda fałsz diff --git a/i18npool/source/localedata/data/sv_SE.xml b/i18npool/source/localedata/data/sv_SE.xml index 333690a0ef09..211f95c3e894 100644 --- a/i18npool/source/localedata/data/sv_SE.xml +++ b/i18npool/source/localedata/data/sv_SE.xml @@ -315,6 +315,13 @@ + + + dict_word_prepostdash + + + + sant falskt -- cgit From f74002df591f62452ef9181068cda76e355f75e7 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 13 Jul 2009 11:08:01 +0000 Subject: #i1601# sentence case transliteration --- i18npool/inc/transliteration_sentencecase.hxx | 69 ++++++++ i18npool/source/localedata/data/en_US.xml | 1 + .../source/registerservices/registerservices.cxx | 5 + i18npool/source/transliteration/makefile.mk | 3 +- .../transliteration_sentencecase.cxx | 190 +++++++++++++++++++++ unotools/source/i18n/transliterationwrapper.cxx | 23 ++- 6 files changed, 282 insertions(+), 9 deletions(-) create mode 100644 i18npool/inc/transliteration_sentencecase.hxx create mode 100644 i18npool/source/transliteration/transliteration_sentencecase.cxx diff --git a/i18npool/inc/transliteration_sentencecase.hxx b/i18npool/inc/transliteration_sentencecase.hxx new file mode 100644 index 000000000000..11318f5cc963 --- /dev/null +++ b/i18npool/inc/transliteration_sentencecase.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: transliteration_Numeric.hxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _I18NPPOL_TRANSLITERATION_SENTENCECASE_HXX_ +#define _I18NPPOL_TRANSLITERATION_SENTENCECASE_HXX_ + +#include + +namespace com { namespace sun { namespace star { namespace i18n { + +class Transliteration_sentencecase : public transliteration_commonclass { +public: + Transliteration_sentencecase( ); + + ::rtl::OUString SAL_CALL + transliterate( const ::rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, ::com::sun::star::uno::Sequence< sal_Int32 >& offset ) + throw(::com::sun::star::uno::RuntimeException); + + sal_Unicode SAL_CALL + transliterateChar2Char( sal_Unicode inChar) + throw(com::sun::star::i18n::MultipleCharsOutputException, + com::sun::star::uno::RuntimeException); + + // Methods which are shared. + sal_Int16 SAL_CALL getType( ) throw(::com::sun::star::uno::RuntimeException); + + ::rtl::OUString SAL_CALL + folding( const ::rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, ::com::sun::star::uno::Sequence< sal_Int32 >& offset ) + throw(::com::sun::star::uno::RuntimeException); + + sal_Bool SAL_CALL + equals( const ::rtl::OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1, const ::rtl::OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 ) + throw(::com::sun::star::uno::RuntimeException); + + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + transliterateRange( const ::rtl::OUString& str1, const ::rtl::OUString& str2 ) + throw(::com::sun::star::uno::RuntimeException); +}; + +} } } } + +#endif // _I18NPPOL_TRANSLITERATION_SENTENCECASE_HXX_ + diff --git a/i18npool/source/localedata/data/en_US.xml b/i18npool/source/localedata/data/en_US.xml index 2a99dcd0fb14..57cc189e6c91 100644 --- a/i18npool/source/localedata/data/en_US.xml +++ b/i18npool/source/localedata/data/en_US.xml @@ -477,6 +477,7 @@ + diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx index 870c49939648..280d6d0aaecf 100644 --- a/i18npool/source/registerservices/registerservices.cxx +++ b/i18npool/source/registerservices/registerservices.cxx @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -173,6 +174,7 @@ IMPL_CREATEINSTANCE_MSF( TextConversion_zh ) IMPL_CREATEINSTANCE( Transliteration_u2l ) IMPL_CREATEINSTANCE( Transliteration_l2u ) +IMPL_CREATEINSTANCE( Transliteration_sentencecase ) IMPL_CREATEINSTANCE( Transliteration_caseignore ) IMPL_CREATEINSTANCE( hiraganaToKatakana ) IMPL_CREATEINSTANCE( katakanaToHiragana ) @@ -422,6 +424,9 @@ static const struct InstancesArray { { TRLT_SERVICELNAME_L10N, TRLT_IMPLNAME_PREFIX "LOWERCASE_UPPERCASE", &Transliteration_l2u_CreateInstance }, + { TRLT_SERVICELNAME_L10N, + TRLT_IMPLNAME_PREFIX "SENTENCE_CASE", + &Transliteration_sentencecase_CreateInstance }, { TRLT_SERVICELNAME_L10N, TRLT_IMPLNAME_PREFIX "IGNORE_CASE", &Transliteration_caseignore_CreateInstance }, diff --git a/i18npool/source/transliteration/makefile.mk b/i18npool/source/transliteration/makefile.mk index daf3068d4d20..83317183beff 100644 --- a/i18npool/source/transliteration/makefile.mk +++ b/i18npool/source/transliteration/makefile.mk @@ -78,7 +78,8 @@ SLOFILES= \ $(SLO)$/numtochar.obj \ $(SLO)$/numtotext_cjk.obj \ $(SLO)$/chartonum.obj \ - $(SLO)$/texttonum.obj + $(SLO)$/texttonum.obj \ + $(SLO)$/transliteration_sentencecase.obj # --- Targets ------------------------------------------------------ diff --git a/i18npool/source/transliteration/transliteration_sentencecase.cxx b/i18npool/source/transliteration/transliteration_sentencecase.cxx new file mode 100644 index 000000000000..35f9a69abb4d --- /dev/null +++ b/i18npool/source/transliteration/transliteration_sentencecase.cxx @@ -0,0 +1,190 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: halfwidthToFullwidth.cxx,v $ + * $Revision: 1.12 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_i18npool.hxx" + +// prevent internal compiler error with MSVC6SP3 +#include + +#include +#include +#define TRANSLITERATION_sentencecase +#include +#include +#include +#include +#include +#include + +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace rtl; + +namespace com { namespace sun { namespace star { namespace i18n { + + +Transliteration_sentencecase::Transliteration_sentencecase() +{ + transliterationName = "sentenceCase"; + implementationName = "com.sun.star.i18n.Transliteration.SENTENCE_CASE"; +} + +OUString SAL_CALL +Transliteration_sentencecase::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset ) + throw(RuntimeException) +{ + // inspired from Transliteration_body::transliterate + sal_Int32 nOffCount = 0, i; + bool bPoint = true; + if (useOffset) + { + for( i = 0; i < nCount; ++i ) { + sal_Unicode c = inStr.getStr()[ i + startPos ]; + if( sal_Unicode('.') == c || sal_Unicode('!') == c || sal_Unicode('?') == c ) { + bPoint = true; + nOffCount++; + } + else if( unicode::isAlpha( c ) || unicode::isDigit( c ) ) + { + const Mapping* map = 0; + if( bPoint && unicode::isLower( c )) + { + map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeLowerToUpper); + } + bPoint = false; + + if(map == 0) + { + nOffCount++; + } + else + { + nOffCount += map->nmap; + } + } + else + { + nOffCount++; + } + } + } + + bPoint = true; + rtl::OUStringBuffer result; + + if (useOffset) + { + result.ensureCapacity(nOffCount); + if ( nOffCount != offset.getLength() ) + offset.realloc( nOffCount ); + } + + + sal_Int32 j = 0; + sal_Int32 * pArr = offset.getArray(); + for( i = 0; i < nCount; ++i ) { + sal_Unicode c = inStr.getStr()[ i + startPos ]; + if( sal_Unicode('.') == c || sal_Unicode('!') == c || sal_Unicode('?') == c ) { + bPoint = true; + result.append(c); + pArr[j++] = i + startPos; + } + else if( unicode::isAlpha( c ) || unicode::isDigit( c ) ) + { + const Mapping* map = 0; + if( bPoint && unicode::isLower( c )) + { + map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeLowerToUpper); + } + bPoint = false; + + if(map == 0) + { + result.append( c ); + pArr[j++] = i + startPos; + } + else + { + for (sal_Int32 k = 0; k < map->nmap; k++) + { + result.append( map->map[k] ); + pArr[j++] = i + startPos; + } + } + } + else + { + result.append( c ); + pArr[j++] = i + startPos; + } + } + return result.makeStringAndClear(); +} + +sal_Unicode SAL_CALL +Transliteration_sentencecase::transliterateChar2Char( sal_Unicode inChar) + throw(RuntimeException, MultipleCharsOutputException) +{ + return inChar; +} + +sal_Int16 SAL_CALL Transliteration_sentencecase::getType() throw(RuntimeException) +{ + return TransliterationType::IGNORE; +} + +OUString SAL_CALL +Transliteration_sentencecase::folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, + Sequence< sal_Int32 >& offset) throw(RuntimeException) +{ + return this->transliterate(inStr, startPos, nCount, offset); +} + +sal_Bool SAL_CALL Transliteration_sentencecase::equals( + const OUString& /*str1*/, sal_Int32 /*pos1*/, sal_Int32 /*nCount1*/, sal_Int32& /*nMatch1*/, + const OUString& /*str2*/, sal_Int32 /*pos2*/, sal_Int32 /*nCount2*/, sal_Int32& /*nMatch2*/) + throw(RuntimeException) +{ + throw RuntimeException(); +} + +Sequence< OUString > SAL_CALL +Transliteration_sentencecase::transliterateRange( const OUString& str1, const OUString& str2 ) + throw( RuntimeException) +{ + Sequence< OUString > ostr(2); + ostr[0] = str1; + ostr[1] = str2; + return ostr; +} + +} } } } + diff --git a/unotools/source/i18n/transliterationwrapper.cxx b/unotools/source/i18n/transliterationwrapper.cxx index bd33e447471f..70d37ad54f6a 100644 --- a/unotools/source/i18n/transliterationwrapper.cxx +++ b/unotools/source/i18n/transliterationwrapper.cxx @@ -34,11 +34,10 @@ #include #include #include -#ifndef _COMPHELPER_COMPONENTFACTORY_HXX_ #include -#endif #include #include +#include #define TRANSLIT_LIBRARYNAME "i18n" #define TRANSLIT_SERVICENAME "com.sun.star.i18n.Transliteration" @@ -168,14 +167,22 @@ void TransliterationWrapper::loadModuleIfNeeded( sal_uInt16 nLang ) sal_Bool bLoad = bFirstCall; bFirstCall = sal_False; - if( nLanguage != nLang ) + if( static_cast< sal_Int32 >(nType) == TransliterationModulesExtra::SENTENCE_CASE ) { - setLanguageLocaleImpl( nLang ); - if( !bLoad ) - bLoad = needLanguageForTheMode(); + if( bLoad ) + loadModuleByImplName(String::CreateFromAscii("SENTENCE_CASE"), nLang); + } + else + { + if( nLanguage != nLang ) + { + setLanguageLocaleImpl( nLang ); + if( !bLoad ) + bLoad = needLanguageForTheMode(); + } + if( bLoad ) + loadModuleImpl(); } - if( bLoad ) - loadModuleImpl(); } -- cgit From 1d9708f5e1f732eb84813e0eda6da8dd48623b82 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 13 Jul 2009 12:26:46 +0000 Subject: undoing r273932 which was accidently commited on the master m51 --- i18npool/inc/breakiterator_ctl.hxx | 1 - i18npool/inc/breakiterator_unicode.hxx | 6 +- i18npool/inc/xdictionary.hxx | 4 +- .../source/breakiterator/breakiterator_cjk.cxx | 4 +- .../source/breakiterator/breakiterator_ctl.cxx | 7 +- .../source/breakiterator/breakiterator_unicode.cxx | 29 ++-- i18npool/source/breakiterator/data/dict_word.txt | 3 +- .../source/breakiterator/data/dict_word_dash.txt | 148 +++++++++++++++++++ .../source/breakiterator/data/dict_word_nodash.txt | 147 ------------------- .../breakiterator/data/dict_word_prepostdash.txt | 157 --------------------- i18npool/source/breakiterator/makefile.mk | 2 +- i18npool/source/breakiterator/xdictionary.cxx | 30 +--- i18npool/source/localedata/data/de_DE.xml | 9 +- i18npool/source/localedata/data/nl_NL.xml | 35 ++--- i18npool/source/localedata/data/pl_PL.xml | 7 + i18npool/source/localedata/data/sv_SE.xml | 7 - 16 files changed, 191 insertions(+), 405 deletions(-) delete mode 100644 i18npool/source/breakiterator/data/dict_word_nodash.txt delete mode 100644 i18npool/source/breakiterator/data/dict_word_prepostdash.txt diff --git a/i18npool/inc/breakiterator_ctl.hxx b/i18npool/inc/breakiterator_ctl.hxx index 3e687b5e8e68..9e753e8ae16f 100644 --- a/i18npool/inc/breakiterator_ctl.hxx +++ b/i18npool/inc/breakiterator_ctl.hxx @@ -58,7 +58,6 @@ protected: sal_Int32* nextCellIndex; sal_Int32* previousCellIndex; sal_Int32 cellIndexSize; - virtual void SAL_CALL makeIndex(const rtl::OUString& text, sal_Int32 pos) throw(com::sun::star::uno::RuntimeException); }; diff --git a/i18npool/inc/breakiterator_unicode.hxx b/i18npool/inc/breakiterator_unicode.hxx index 654df424b237..3a0720f27545 100644 --- a/i18npool/inc/breakiterator_unicode.hxx +++ b/i18npool/inc/breakiterator_unicode.hxx @@ -86,16 +86,12 @@ protected: const sal_Char *cBreakIterator, *wordRule, *lineRule; Boundary result; // for word break iterator - struct BI_Data { + struct { UnicodeString aICUText; icu::BreakIterator *aBreakIterator; - - BI_Data() : aICUText(), aBreakIterator(NULL) {} } character, word, sentence, line, *icuBI; - com::sun::star::lang::Locale aLocale; sal_Int16 aBreakType, aWordType; - void SAL_CALL loadICUBreakIterator(const com::sun::star::lang::Locale& rLocale, sal_Int16 rBreakType, sal_Int16 rWordType, const sal_Char* name, const rtl::OUString& rText) throw(com::sun::star::uno::RuntimeException); }; diff --git a/i18npool/inc/xdictionary.hxx b/i18npool/inc/xdictionary.hxx index 04c5836aaaea..32ffdbbfe377 100644 --- a/i18npool/inc/xdictionary.hxx +++ b/i18npool/inc/xdictionary.hxx @@ -45,13 +45,11 @@ namespace com { namespace sun { namespace star { namespace i18n { // cache structure. struct WordBreakCache { + sal_Bool equals(const sal_Unicode *str, Boundary& boundary); // checking cached string sal_Int32 length; // contents length saved here. sal_Unicode *contents; // seperated segment contents. sal_Int32* wordboundary; // word boundaries in segments. sal_Int32 size; // size of wordboundary - - WordBreakCache(); - sal_Bool equals(const sal_Unicode *str, Boundary& boundary); // checking cached string }; class xdictionary diff --git a/i18npool/source/breakiterator/breakiterator_cjk.cxx b/i18npool/source/breakiterator/breakiterator_cjk.cxx index 3a44c02edc23..3d684b8788df 100644 --- a/i18npool/source/breakiterator/breakiterator_cjk.cxx +++ b/i18npool/source/breakiterator/breakiterator_cjk.cxx @@ -46,9 +46,7 @@ namespace com { namespace sun { namespace star { namespace i18n { // class BreakIterator_CJK // ----------------------------------------------------; -BreakIterator_CJK::BreakIterator_CJK() : - dict( NULL ), - hangingCharacters() +BreakIterator_CJK::BreakIterator_CJK() : dict(NULL) { cBreakIterator = "com.sun.star.i18n.BreakIterator_CJK"; } diff --git a/i18npool/source/breakiterator/breakiterator_ctl.cxx b/i18npool/source/breakiterator/breakiterator_ctl.cxx index 0e1bee869cac..a42014615f1a 100644 --- a/i18npool/source/breakiterator/breakiterator_ctl.cxx +++ b/i18npool/source/breakiterator/breakiterator_ctl.cxx @@ -45,14 +45,11 @@ namespace com { namespace sun { namespace star { namespace i18n { /** * Constructor. */ -BreakIterator_CTL::BreakIterator_CTL() : - cachedText(), - nextCellIndex( NULL ), - previousCellIndex( NULL ), - cellIndexSize( 512 ) +BreakIterator_CTL::BreakIterator_CTL() { cBreakIterator = "com.sun.star.i18n.BreakIterator_CTL"; // to improve performance, alloc big enough memory in construct. + cellIndexSize = 512; nextCellIndex = (sal_Int32*) calloc(cellIndexSize, sizeof(sal_Int32)); previousCellIndex = (sal_Int32*) calloc(cellIndexSize, sizeof(sal_Int32)); memset(nextCellIndex, 0, cellIndexSize * sizeof(sal_Int32)); diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx index f0710c996858..b832bb02e7e9 100644 --- a/i18npool/source/breakiterator/breakiterator_unicode.cxx +++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx @@ -51,23 +51,20 @@ namespace com { namespace sun { namespace star { namespace i18n { #define ERROR ::com::sun::star::uno::RuntimeException() -//#define ImplementName "com.sun.star.i18n.BreakIterator_Unicode"; - - -BreakIterator_Unicode::BreakIterator_Unicode() : - cBreakIterator( "com.sun.star.i18n.BreakIterator_Unicode" ), // implementation name - wordRule( "word" ), - lineRule( "line" ), - result(), - character(), - word(), - sentence(), - line(), - icuBI( NULL ), - aLocale(), - aBreakType(), - aWordType() +#define ImplementName "com.sun.star.i18n.BreakIterator_Unicode"; + + +BreakIterator_Unicode::BreakIterator_Unicode() { + wordRule="word"; + lineRule="line"; + character.aBreakIterator=word.aBreakIterator=sentence.aBreakIterator=line.aBreakIterator=NULL; + character.aICUText=UnicodeString(); + word.aICUText=UnicodeString(); + sentence.aICUText=UnicodeString(); + line.aICUText=UnicodeString(); + cBreakIterator = ImplementName; + icuBI=NULL; } diff --git a/i18npool/source/breakiterator/data/dict_word.txt b/i18npool/source/breakiterator/data/dict_word.txt index 367a82db9e6f..4c5c80823041 100644 --- a/i18npool/source/breakiterator/data/dict_word.txt +++ b/i18npool/source/breakiterator/data/dict_word.txt @@ -34,8 +34,7 @@ $ALetter = [\u0002 [:Alphabetic:] [:name= COMMERCIAL AT:] [:name= HEBREW PUNCT $MidLetter = [[:name = APOSTROPHE:] [:name = GRAVE ACCENT:] \u0084 [:name = SOFT HYPHEN:] [:name = MIDDLE DOT:] [:name = GREEK TONOS:] [:name= FULL STOP:] [:name = HEBREW PUNCTUATION GERSHAYIM:] [:name = DOUBLE VERTICAL LINE:] [:name = LEFT SINGLE QUOTATION MARK:] - [:name = RIGHT SINGLE QUOTATION MARK:] [:name = HYPHENATION POINT:] [:name = PRIME:] - [:name = HYPHEN-MINUS:] [:name = EN DASH:] [:name = EM DASH:] ]; + [:name = RIGHT SINGLE QUOTATION MARK:] [:name = HYPHENATION POINT:] [:name = PRIME:] ]; $SufixLetter = [:name= FULL STOP:]; diff --git a/i18npool/source/breakiterator/data/dict_word_dash.txt b/i18npool/source/breakiterator/data/dict_word_dash.txt index e69de29bb2d1..7f861c7911ca 100644 --- a/i18npool/source/breakiterator/data/dict_word_dash.txt +++ b/i18npool/source/breakiterator/data/dict_word_dash.txt @@ -0,0 +1,148 @@ +# +# Copyright (C) 2002-2003, International Business Machines Corporation and others. +# All Rights Reserved. +# +# file: dict_word.txt +# +# ICU Word Break Rules +# See Unicode Standard Annex #29. +# These rules are based on Version 4.0.0, dated 2003-04-17 +# + + + +#################################################################################### +# +# Character class definitions from TR 29 +# +#################################################################################### +$Katakana = [[:Script = KATAKANA:] [:name = KATAKANA-HIRAGANA PROLONGED SOUND MARK:] + [:name = HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK:] + [:name = HALFWIDTH KATAKANA VOICED SOUND MARK:] + [:name = HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK:]]; + +$Ideographic = [:Ideographic:]; +$Hangul = [:Script = HANGUL:]; + +$ALetter = [\u0002 [:Alphabetic:] [:name= COMMERCIAL AT:] [:name= HEBREW PUNCTUATION GERESH:] + - $Ideographic + - $Katakana + - $Hangul + - [:Script = Thai:] + - [:Script = Lao:] + - [:Script = Hiragana:]]; + +$MidLetter = [[:name = APOSTROPHE:] [:name = GRAVE ACCENT:] \u0084 [:name = SOFT HYPHEN:] [:name = MIDDLE DOT:] [:name = GREEK TONOS:] [:name= FULL STOP:] + [:name = HEBREW PUNCTUATION GERSHAYIM:] [:name = DOUBLE VERTICAL LINE:] [:name = LEFT SINGLE QUOTATION MARK:] + [:name = RIGHT SINGLE QUOTATION MARK:] [:name = HYPHENATION POINT:] [:name = PRIME:] + [:name = HYPHEN-MINUS:] [:name = EN DASH:] ]; + +$SufixLetter = [:name= FULL STOP:]; + + +$MidNum = [[:LineBreak = Infix_Numeric:] [:name= COMMERCIAL AT:] \u0084 [:name = GREEK TONOS:] [:name = ARABIC DECIMAL SEPARATOR:] + [:name = LEFT SINGLE QUOTATION MARK:] [:name = RIGHT SINGLE QUOTATION MARK:] [:name = SINGLE HIGH-REVERSED-9 QUOTATION MARK:] + [:name = PRIME:]]; +$Numeric = [:LineBreak = Numeric:]; + + +$TheZWSP = \u200b; + +# +# Character Class Definitions. +# The names are those from TR29. +# +$CR = \u000d; +$LF = \u000a; +$Control = [[[:Zl:] [:Zp:] [:Cc:] [:Cf:]] - $TheZWSP]; +$Extend = [[:Grapheme_Extend = TRUE:]]; + + + + +#################################################################################### +# +# Word Break Rules. Definitions and Rules specific to word break begin Here. +# +#################################################################################### + +$Format = [[:Cf:] - $TheZWSP]; + + + +# Rule 3: Treat a grapheme cluster as if it were a single character. +# Hangul Syllables are easier to deal with here than they are in Grapheme Clusters +# because we don't need to find the boundaries between adjacent syllables - +# they won't be word boundaries. +# + + +# +# "Extended" definitions. Grapheme Cluster + Format Chars, treated like the base char. +# +$ALetterEx = $ALetter $Extend*; +$NumericEx = $Numeric $Extend*; +$MidNumEx = $MidNum $Extend*; +$MidLetterEx = $MidLetter $Extend*; +$SufixLetterEx= $SufixLetter $Extend*; +$KatakanaEx = $Katakana $Extend*; +$IdeographicEx= $Ideographic $Extend*; +$HangulEx = $Hangul $Extend*; +$FormatEx = $Format $Extend*; + + +# +# Numbers. Rules 8, 11, 12 form the TR. +# +$NumberSequence = $NumericEx ($FormatEx* $MidNumEx? $FormatEx* $NumericEx)*; +$NumberSequence {100}; + +# +# Words. Alpha-numerics. Rule 5, 6, 7, 9, 10 +# - must include at least one letter. +# - may include both letters and numbers. +# - may include MideLetter, MidNumber punctuation. +# +$LetterSequence = $ALetterEx ($FormatEx* $MidLetterEx? $FormatEx* $ALetterEx)*; # rules #6, #7 +($NumberSequence $FormatEx*)? $LetterSequence ($FormatEx* ($NumberSequence | $LetterSequence))* $SufixLetterEx? {200}; + +[[:P:][:S:]]*; + +# +# Do not break between Katakana. Rule #13. +# +$KatakanaEx ($FormatEx* $KatakanaEx)* {300}; +[:Hiragana:] $Extend* {300}; + +# +# Ideographic Characters. Stand by themselves as words. +# Separated from the "Everything Else" rule, below, only so that they +# can be tagged with a return value. TODO: is this what we want? +# +$IdeographicEx ($FormatEx* $IdeographicEx)* {400}; +$HangulEx ($FormatEx* $HangulEx)* {400}; + +# +# Everything Else, with no tag. +# Non-Control chars combine with $Extend (combining) chars. +# Controls are do not. +# +[^$Control [:Ideographic:]] $Extend*; +$CR $LF; + +# +# Reverse Rules. Back up over any of the chars that can group together. +# (Reverse rules do not need to be exact; they can back up too far, +# but must back up at least enough, and must stop on a boundary.) +# + +# NonStarters are the set of all characters that can appear at the 2nd - nth position of +# a word. (They may also be the first.) The reverse rule skips over these, until it +# reaches something that can only be the start (and probably only) char in a "word". +# A space or punctuation meets the test. +# +$NonStarters = [$Numeric $ALetter $Katakana $Ideographic $Hangul [:P:] [:S:] $MidLetter $MidNum $SufixLetter $Extend $Format]; + +#!.*; +! ($NonStarters* | \n \r) .; + diff --git a/i18npool/source/breakiterator/data/dict_word_nodash.txt b/i18npool/source/breakiterator/data/dict_word_nodash.txt deleted file mode 100644 index 4c5c80823041..000000000000 --- a/i18npool/source/breakiterator/data/dict_word_nodash.txt +++ /dev/null @@ -1,147 +0,0 @@ -# -# Copyright (C) 2002-2003, International Business Machines Corporation and others. -# All Rights Reserved. -# -# file: dict_word.txt -# -# ICU Word Break Rules -# See Unicode Standard Annex #29. -# These rules are based on Version 4.0.0, dated 2003-04-17 -# - - - -#################################################################################### -# -# Character class definitions from TR 29 -# -#################################################################################### -$Katakana = [[:Script = KATAKANA:] [:name = KATAKANA-HIRAGANA PROLONGED SOUND MARK:] - [:name = HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK:] - [:name = HALFWIDTH KATAKANA VOICED SOUND MARK:] - [:name = HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK:]]; - -$Ideographic = [:Ideographic:]; -$Hangul = [:Script = HANGUL:]; - -$ALetter = [\u0002 [:Alphabetic:] [:name= COMMERCIAL AT:] [:name= HEBREW PUNCTUATION GERESH:] - - $Ideographic - - $Katakana - - $Hangul - - [:Script = Thai:] - - [:Script = Lao:] - - [:Script = Hiragana:]]; - -$MidLetter = [[:name = APOSTROPHE:] [:name = GRAVE ACCENT:] \u0084 [:name = SOFT HYPHEN:] [:name = MIDDLE DOT:] [:name = GREEK TONOS:] [:name= FULL STOP:] - [:name = HEBREW PUNCTUATION GERSHAYIM:] [:name = DOUBLE VERTICAL LINE:] [:name = LEFT SINGLE QUOTATION MARK:] - [:name = RIGHT SINGLE QUOTATION MARK:] [:name = HYPHENATION POINT:] [:name = PRIME:] ]; - -$SufixLetter = [:name= FULL STOP:]; - - -$MidNum = [[:LineBreak = Infix_Numeric:] [:name= COMMERCIAL AT:] \u0084 [:name = GREEK TONOS:] [:name = ARABIC DECIMAL SEPARATOR:] - [:name = LEFT SINGLE QUOTATION MARK:] [:name = RIGHT SINGLE QUOTATION MARK:] [:name = SINGLE HIGH-REVERSED-9 QUOTATION MARK:] - [:name = PRIME:]]; -$Numeric = [:LineBreak = Numeric:]; - - -$TheZWSP = \u200b; - -# -# Character Class Definitions. -# The names are those from TR29. -# -$CR = \u000d; -$LF = \u000a; -$Control = [[[:Zl:] [:Zp:] [:Cc:] [:Cf:]] - $TheZWSP]; -$Extend = [[:Grapheme_Extend = TRUE:]]; - - - - -#################################################################################### -# -# Word Break Rules. Definitions and Rules specific to word break begin Here. -# -#################################################################################### - -$Format = [[:Cf:] - $TheZWSP]; - - - -# Rule 3: Treat a grapheme cluster as if it were a single character. -# Hangul Syllables are easier to deal with here than they are in Grapheme Clusters -# because we don't need to find the boundaries between adjacent syllables - -# they won't be word boundaries. -# - - -# -# "Extended" definitions. Grapheme Cluster + Format Chars, treated like the base char. -# -$ALetterEx = $ALetter $Extend*; -$NumericEx = $Numeric $Extend*; -$MidNumEx = $MidNum $Extend*; -$MidLetterEx = $MidLetter $Extend*; -$SufixLetterEx= $SufixLetter $Extend*; -$KatakanaEx = $Katakana $Extend*; -$IdeographicEx= $Ideographic $Extend*; -$HangulEx = $Hangul $Extend*; -$FormatEx = $Format $Extend*; - - -# -# Numbers. Rules 8, 11, 12 form the TR. -# -$NumberSequence = $NumericEx ($FormatEx* $MidNumEx? $FormatEx* $NumericEx)*; -$NumberSequence {100}; - -# -# Words. Alpha-numerics. Rule 5, 6, 7, 9, 10 -# - must include at least one letter. -# - may include both letters and numbers. -# - may include MideLetter, MidNumber punctuation. -# -$LetterSequence = $ALetterEx ($FormatEx* $MidLetterEx? $FormatEx* $ALetterEx)*; # rules #6, #7 -($NumberSequence $FormatEx*)? $LetterSequence ($FormatEx* ($NumberSequence | $LetterSequence))* $SufixLetterEx? {200}; - -[[:P:][:S:]]*; - -# -# Do not break between Katakana. Rule #13. -# -$KatakanaEx ($FormatEx* $KatakanaEx)* {300}; -[:Hiragana:] $Extend* {300}; - -# -# Ideographic Characters. Stand by themselves as words. -# Separated from the "Everything Else" rule, below, only so that they -# can be tagged with a return value. TODO: is this what we want? -# -$IdeographicEx ($FormatEx* $IdeographicEx)* {400}; -$HangulEx ($FormatEx* $HangulEx)* {400}; - -# -# Everything Else, with no tag. -# Non-Control chars combine with $Extend (combining) chars. -# Controls are do not. -# -[^$Control [:Ideographic:]] $Extend*; -$CR $LF; - -# -# Reverse Rules. Back up over any of the chars that can group together. -# (Reverse rules do not need to be exact; they can back up too far, -# but must back up at least enough, and must stop on a boundary.) -# - -# NonStarters are the set of all characters that can appear at the 2nd - nth position of -# a word. (They may also be the first.) The reverse rule skips over these, until it -# reaches something that can only be the start (and probably only) char in a "word". -# A space or punctuation meets the test. -# -$NonStarters = [$Numeric $ALetter $Katakana $Ideographic $Hangul [:P:] [:S:] $MidLetter $MidNum $SufixLetter $Extend $Format]; - -#!.*; -! ($NonStarters* | \n \r) .; - diff --git a/i18npool/source/breakiterator/data/dict_word_prepostdash.txt b/i18npool/source/breakiterator/data/dict_word_prepostdash.txt deleted file mode 100644 index 1bf94451fae2..000000000000 --- a/i18npool/source/breakiterator/data/dict_word_prepostdash.txt +++ /dev/null @@ -1,157 +0,0 @@ -# -# Copyright (C) 2002-2003, International Business Machines Corporation and others. -# All Rights Reserved. -# -# file: dict_word.txt -# -# ICU Word Break Rules -# See Unicode Standard Annex #29. -# These rules are based on Version 4.0.0, dated 2003-04-17 -# - - - -#################################################################################### -# -# Character class definitions from TR 29 -# -#################################################################################### -$Katakana = [[:Script = KATAKANA:] [:name = KATAKANA-HIRAGANA PROLONGED SOUND MARK:] - [:name = HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK:] - [:name = HALFWIDTH KATAKANA VOICED SOUND MARK:] - [:name = HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK:]]; - -$Ideographic = [:Ideographic:]; -$Hangul = [:Script = HANGUL:]; - -# list of dashes or hyphens that should be accepted as part of the word if a single one of these -# pre- or postfixes a word. E.g. in German: "Arbeits-" or "-nehmer" where that hyphen needs to -# be part of the word in order to have it properly spell checked etc. -$PrePostDashHyphen = [ [:name = HYPHEN-MINUS:] [:name = EN DASH:] [:name = EM DASH:] ]; - - -$ALetter = [\u0002 [:Alphabetic:] [:name= COMMERCIAL AT:] [:name= HEBREW PUNCTUATION GERESH:] - - $Ideographic - - $Katakana - - $Hangul - - [:Script = Thai:] - - [:Script = Lao:] - - [:Script = Hiragana:]]; - -$MidLetter = [[:name = APOSTROPHE:] [:name = GRAVE ACCENT:] \u0084 [:name = SOFT HYPHEN:] [:name = MIDDLE DOT:] [:name = GREEK TONOS:] [:name= FULL STOP:] - [:name = HEBREW PUNCTUATION GERSHAYIM:] [:name = DOUBLE VERTICAL LINE:] [:name = LEFT SINGLE QUOTATION MARK:] - [:name = RIGHT SINGLE QUOTATION MARK:] [:name = HYPHENATION POINT:] [:name = PRIME:] - [:name = HYPHEN-MINUS:] [:name = EN DASH:] [:name = EM DASH:] ]; - -$SufixLetter = [:name= FULL STOP:]; - - -$MidNum = [[:LineBreak = Infix_Numeric:] [:name= COMMERCIAL AT:] \u0084 [:name = GREEK TONOS:] [:name = ARABIC DECIMAL SEPARATOR:] - [:name = LEFT SINGLE QUOTATION MARK:] [:name = RIGHT SINGLE QUOTATION MARK:] [:name = SINGLE HIGH-REVERSED-9 QUOTATION MARK:] - [:name = PRIME:]]; -$Numeric = [:LineBreak = Numeric:]; - - -$TheZWSP = \u200b; - -# -# Character Class Definitions. -# The names are those from TR29. -# -$CR = \u000d; -$LF = \u000a; -$Control = [[[:Zl:] [:Zp:] [:Cc:] [:Cf:]] - $TheZWSP]; -$Extend = [[:Grapheme_Extend = TRUE:]]; - - - - -#################################################################################### -# -# Word Break Rules. Definitions and Rules specific to word break begin Here. -# -#################################################################################### - -$Format = [[:Cf:] - $TheZWSP]; - - - -# Rule 3: Treat a grapheme cluster as if it were a single character. -# Hangul Syllables are easier to deal with here than they are in Grapheme Clusters -# because we don't need to find the boundaries between adjacent syllables - -# they won't be word boundaries. -# - - -# -# "Extended" definitions. Grapheme Cluster + Format Chars, treated like the base char. -# -$ALetterEx = $ALetter $Extend*; -$NumericEx = $Numeric $Extend*; -$MidNumEx = $MidNum $Extend*; -$MidLetterEx = $MidLetter $Extend*; -$SufixLetterEx= $SufixLetter $Extend*; -$KatakanaEx = $Katakana $Extend*; -$IdeographicEx= $Ideographic $Extend*; -$HangulEx = $Hangul $Extend*; -$FormatEx = $Format $Extend*; - - -# -# Numbers. Rules 8, 11, 12 form the TR. -# -$NumberSequence = $NumericEx ($FormatEx* $MidNumEx? $FormatEx* $NumericEx)*; -$NumberSequence {100}; - -# -# Words. Alpha-numerics. Rule 5, 6, 7, 9, 10 -# - must include at least one letter. -# - may include both letters and numbers. -# - may include MideLetter, MidNumber punctuation. -# -# At most one leading or trailing dash/hyphen should be accepted as well. -# E.g. in German: "Arbeits-" or "-nehmer" where that hyphen needs to -# be part of the word in order to have it properly spell checked etc. -$LetterSequence = $PrePostDashHyphen? $ALetterEx ($FormatEx* $MidLetterEx? $FormatEx* $ALetterEx)* $PrePostDashHyphen?; # rules #6, #7 -($NumberSequence $FormatEx*)? $LetterSequence ($FormatEx* ($NumberSequence | $LetterSequence))* $SufixLetterEx? {200}; - -[[:P:][:S:]]*; - -# -# Do not break between Katakana. Rule #13. -# -$KatakanaEx ($FormatEx* $KatakanaEx)* {300}; -[:Hiragana:] $Extend* {300}; - -# -# Ideographic Characters. Stand by themselves as words. -# Separated from the "Everything Else" rule, below, only so that they -# can be tagged with a return value. TODO: is this what we want? -# -$IdeographicEx ($FormatEx* $IdeographicEx)* {400}; -$HangulEx ($FormatEx* $HangulEx)* {400}; - -# -# Everything Else, with no tag. -# Non-Control chars combine with $Extend (combining) chars. -# Controls are do not. -# -[^$Control [:Ideographic:]] $Extend*; -$CR $LF; - -# -# Reverse Rules. Back up over any of the chars that can group together. -# (Reverse rules do not need to be exact; they can back up too far, -# but must back up at least enough, and must stop on a boundary.) -# - -# NonStarters are the set of all characters that can appear at the 2nd - nth position of -# a word. (They may also be the first.) The reverse rule skips over these, until it -# reaches something that can only be the start (and probably only) char in a "word". -# A space or punctuation meets the test. -# -$NonStarters = [$Numeric $ALetter $Katakana $Ideographic $Hangul [:P:] [:S:] $MidLetter $MidNum $SufixLetter $Extend $Format]; - -#!.*; -! ($NonStarters* | \n \r) .; - diff --git a/i18npool/source/breakiterator/makefile.mk b/i18npool/source/breakiterator/makefile.mk index 50e437e98b91..7ba9cd3e753d 100644 --- a/i18npool/source/breakiterator/makefile.mk +++ b/i18npool/source/breakiterator/makefile.mk @@ -93,7 +93,7 @@ $(MISC)$/%_brk.c : $(MISC)$/%.brk # The output of gencmn generates warnings under Windows. We want to minimize the patches to external tools, # so the output (OpenOffice_icu_dat.c) is changed here to include a pragma to disable the warnings. # Output of gencmn is redirected to OpenOffice_icu_tmp.c with the -t switch. -$(MISC)$/OpenOffice_%.c : $(MY_BRK_BRKFILES:s/.brk/_brk.c/) +$(MISC)$/OpenOffice_%.c : $(WRAPCMD) $(GENCMN) -n OpenOffice -t tmp -S -d $(MISC) O $(mktmp $(subst,$(MISC)$/, $(MY_BRK_BRKFILES:t"\n"))) echo $(USQ)#ifdef _MSC_VER$(USQ) > $@ echo $(USQ)#pragma warning( disable : 4229 4668 )$(USQ) >> $@ diff --git a/i18npool/source/breakiterator/xdictionary.cxx b/i18npool/source/breakiterator/xdictionary.cxx index f286dd2449ac..fb832f0b6468 100644 --- a/i18npool/source/breakiterator/xdictionary.cxx +++ b/i18npool/source/breakiterator/xdictionary.cxx @@ -54,21 +54,7 @@ namespace com { namespace sun { namespace star { namespace i18n { extern "C" { static void SAL_CALL thisModule() {} } -xdictionary::xdictionary(const sal_Char *lang) : - existMark( NULL ), - index1( NULL ), - index2( NULL ), - lenArray( NULL ), - dataArea( NULL ), - hModule( NULL ), - boundary(), - japaneseWordBreak( sal_False ) -#if USE_CELL_BOUNDARY_CODE - // For CTL breakiterator, where the word boundary should not be inside cell. - , - useCellBoundary( sal_False ), - cellBoundary( NULL ) -#endif +xdictionary::xdictionary(const sal_Char *lang) { index1 = 0; #ifdef SAL_DLLPREFIX @@ -106,7 +92,6 @@ xdictionary::xdictionary(const sal_Char *lang) : #if USE_CELL_BOUNDARY_CODE useCellBoundary = sal_False; - cellBoundary = NULL; #endif japaneseWordBreak = sal_False; } @@ -164,19 +149,6 @@ sal_Int32 xdictionary::getLongestMatch(const sal_Unicode* str, sal_Int32 sLen) { return 0; } - -/* - * c-tor - */ - -WordBreakCache::WordBreakCache() : - length( 0 ), - contents( NULL ), - wordboundary( NULL ), - size( 0 ) -{ -} - /* * Compare two unicode string, */ diff --git a/i18npool/source/localedata/data/de_DE.xml b/i18npool/source/localedata/data/de_DE.xml index a83b3dbb791d..295b826a5e9f 100644 --- a/i18npool/source/localedata/data/de_DE.xml +++ b/i18npool/source/localedata/data/de_DE.xml @@ -328,14 +328,7 @@ - - - dict_word_prepostdash - - - - - + wahr falsch 1. Quartal diff --git a/i18npool/source/localedata/data/nl_NL.xml b/i18npool/source/localedata/data/nl_NL.xml index 5a91c9c3e42e..eedfdc146b5e 100644 --- a/i18npool/source/localedata/data/nl_NL.xml +++ b/i18npool/source/localedata/data/nl_NL.xml @@ -360,27 +360,20 @@ - - - dict_word_prepostdash - - - - - - waar - onwaar - 1ste kwartaal - 2de kwartaal - 3de kwartaal - 4de kwartaal - boven - onder - K1 - K2 - K3 - K4 - + +waar +onwaar +1ste kwartaal +2de kwartaal +3de kwartaal +4de kwartaal +boven +onder +K1 +K2 +K3 +K4 + diff --git a/i18npool/source/localedata/data/pl_PL.xml b/i18npool/source/localedata/data/pl_PL.xml index 195689666247..4119060ea7df 100644 --- a/i18npool/source/localedata/data/pl_PL.xml +++ b/i18npool/source/localedata/data/pl_PL.xml @@ -326,6 +326,13 @@ + + + dict_word_dash + + + + prawda fałsz diff --git a/i18npool/source/localedata/data/sv_SE.xml b/i18npool/source/localedata/data/sv_SE.xml index 211f95c3e894..333690a0ef09 100644 --- a/i18npool/source/localedata/data/sv_SE.xml +++ b/i18npool/source/localedata/data/sv_SE.xml @@ -315,13 +315,6 @@ - - - dict_word_prepostdash - - - - sant falskt -- cgit From 104e585e3db2e7a77e1de237ea68abaf38a44600 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 13 Jul 2009 12:48:12 +0000 Subject: undoing r273933 which was accidently commited on master m51 --- i18npool/inc/transliteration_sentencecase.hxx | 69 -------- i18npool/source/localedata/data/en_US.xml | 1 - .../source/registerservices/registerservices.cxx | 5 - i18npool/source/transliteration/makefile.mk | 3 +- .../transliteration_sentencecase.cxx | 190 --------------------- unotools/source/i18n/transliterationwrapper.cxx | 23 +-- 6 files changed, 9 insertions(+), 282 deletions(-) delete mode 100644 i18npool/inc/transliteration_sentencecase.hxx delete mode 100644 i18npool/source/transliteration/transliteration_sentencecase.cxx diff --git a/i18npool/inc/transliteration_sentencecase.hxx b/i18npool/inc/transliteration_sentencecase.hxx deleted file mode 100644 index 11318f5cc963..000000000000 --- a/i18npool/inc/transliteration_sentencecase.hxx +++ /dev/null @@ -1,69 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: transliteration_Numeric.hxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _I18NPPOL_TRANSLITERATION_SENTENCECASE_HXX_ -#define _I18NPPOL_TRANSLITERATION_SENTENCECASE_HXX_ - -#include - -namespace com { namespace sun { namespace star { namespace i18n { - -class Transliteration_sentencecase : public transliteration_commonclass { -public: - Transliteration_sentencecase( ); - - ::rtl::OUString SAL_CALL - transliterate( const ::rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, ::com::sun::star::uno::Sequence< sal_Int32 >& offset ) - throw(::com::sun::star::uno::RuntimeException); - - sal_Unicode SAL_CALL - transliterateChar2Char( sal_Unicode inChar) - throw(com::sun::star::i18n::MultipleCharsOutputException, - com::sun::star::uno::RuntimeException); - - // Methods which are shared. - sal_Int16 SAL_CALL getType( ) throw(::com::sun::star::uno::RuntimeException); - - ::rtl::OUString SAL_CALL - folding( const ::rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, ::com::sun::star::uno::Sequence< sal_Int32 >& offset ) - throw(::com::sun::star::uno::RuntimeException); - - sal_Bool SAL_CALL - equals( const ::rtl::OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1, const ::rtl::OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 ) - throw(::com::sun::star::uno::RuntimeException); - - ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL - transliterateRange( const ::rtl::OUString& str1, const ::rtl::OUString& str2 ) - throw(::com::sun::star::uno::RuntimeException); -}; - -} } } } - -#endif // _I18NPPOL_TRANSLITERATION_SENTENCECASE_HXX_ - diff --git a/i18npool/source/localedata/data/en_US.xml b/i18npool/source/localedata/data/en_US.xml index 57cc189e6c91..2a99dcd0fb14 100644 --- a/i18npool/source/localedata/data/en_US.xml +++ b/i18npool/source/localedata/data/en_US.xml @@ -477,7 +477,6 @@ - diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx index 280d6d0aaecf..870c49939648 100644 --- a/i18npool/source/registerservices/registerservices.cxx +++ b/i18npool/source/registerservices/registerservices.cxx @@ -50,7 +50,6 @@ #include #include #include -#include #include #include #include @@ -174,7 +173,6 @@ IMPL_CREATEINSTANCE_MSF( TextConversion_zh ) IMPL_CREATEINSTANCE( Transliteration_u2l ) IMPL_CREATEINSTANCE( Transliteration_l2u ) -IMPL_CREATEINSTANCE( Transliteration_sentencecase ) IMPL_CREATEINSTANCE( Transliteration_caseignore ) IMPL_CREATEINSTANCE( hiraganaToKatakana ) IMPL_CREATEINSTANCE( katakanaToHiragana ) @@ -424,9 +422,6 @@ static const struct InstancesArray { { TRLT_SERVICELNAME_L10N, TRLT_IMPLNAME_PREFIX "LOWERCASE_UPPERCASE", &Transliteration_l2u_CreateInstance }, - { TRLT_SERVICELNAME_L10N, - TRLT_IMPLNAME_PREFIX "SENTENCE_CASE", - &Transliteration_sentencecase_CreateInstance }, { TRLT_SERVICELNAME_L10N, TRLT_IMPLNAME_PREFIX "IGNORE_CASE", &Transliteration_caseignore_CreateInstance }, diff --git a/i18npool/source/transliteration/makefile.mk b/i18npool/source/transliteration/makefile.mk index 83317183beff..daf3068d4d20 100644 --- a/i18npool/source/transliteration/makefile.mk +++ b/i18npool/source/transliteration/makefile.mk @@ -78,8 +78,7 @@ SLOFILES= \ $(SLO)$/numtochar.obj \ $(SLO)$/numtotext_cjk.obj \ $(SLO)$/chartonum.obj \ - $(SLO)$/texttonum.obj \ - $(SLO)$/transliteration_sentencecase.obj + $(SLO)$/texttonum.obj # --- Targets ------------------------------------------------------ diff --git a/i18npool/source/transliteration/transliteration_sentencecase.cxx b/i18npool/source/transliteration/transliteration_sentencecase.cxx deleted file mode 100644 index 35f9a69abb4d..000000000000 --- a/i18npool/source/transliteration/transliteration_sentencecase.cxx +++ /dev/null @@ -1,190 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: halfwidthToFullwidth.cxx,v $ - * $Revision: 1.12 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_i18npool.hxx" - -// prevent internal compiler error with MSVC6SP3 -#include - -#include -#include -#define TRANSLITERATION_sentencecase -#include -#include -#include -#include -#include -#include - -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace rtl; - -namespace com { namespace sun { namespace star { namespace i18n { - - -Transliteration_sentencecase::Transliteration_sentencecase() -{ - transliterationName = "sentenceCase"; - implementationName = "com.sun.star.i18n.Transliteration.SENTENCE_CASE"; -} - -OUString SAL_CALL -Transliteration_sentencecase::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset ) - throw(RuntimeException) -{ - // inspired from Transliteration_body::transliterate - sal_Int32 nOffCount = 0, i; - bool bPoint = true; - if (useOffset) - { - for( i = 0; i < nCount; ++i ) { - sal_Unicode c = inStr.getStr()[ i + startPos ]; - if( sal_Unicode('.') == c || sal_Unicode('!') == c || sal_Unicode('?') == c ) { - bPoint = true; - nOffCount++; - } - else if( unicode::isAlpha( c ) || unicode::isDigit( c ) ) - { - const Mapping* map = 0; - if( bPoint && unicode::isLower( c )) - { - map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeLowerToUpper); - } - bPoint = false; - - if(map == 0) - { - nOffCount++; - } - else - { - nOffCount += map->nmap; - } - } - else - { - nOffCount++; - } - } - } - - bPoint = true; - rtl::OUStringBuffer result; - - if (useOffset) - { - result.ensureCapacity(nOffCount); - if ( nOffCount != offset.getLength() ) - offset.realloc( nOffCount ); - } - - - sal_Int32 j = 0; - sal_Int32 * pArr = offset.getArray(); - for( i = 0; i < nCount; ++i ) { - sal_Unicode c = inStr.getStr()[ i + startPos ]; - if( sal_Unicode('.') == c || sal_Unicode('!') == c || sal_Unicode('?') == c ) { - bPoint = true; - result.append(c); - pArr[j++] = i + startPos; - } - else if( unicode::isAlpha( c ) || unicode::isDigit( c ) ) - { - const Mapping* map = 0; - if( bPoint && unicode::isLower( c )) - { - map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeLowerToUpper); - } - bPoint = false; - - if(map == 0) - { - result.append( c ); - pArr[j++] = i + startPos; - } - else - { - for (sal_Int32 k = 0; k < map->nmap; k++) - { - result.append( map->map[k] ); - pArr[j++] = i + startPos; - } - } - } - else - { - result.append( c ); - pArr[j++] = i + startPos; - } - } - return result.makeStringAndClear(); -} - -sal_Unicode SAL_CALL -Transliteration_sentencecase::transliterateChar2Char( sal_Unicode inChar) - throw(RuntimeException, MultipleCharsOutputException) -{ - return inChar; -} - -sal_Int16 SAL_CALL Transliteration_sentencecase::getType() throw(RuntimeException) -{ - return TransliterationType::IGNORE; -} - -OUString SAL_CALL -Transliteration_sentencecase::folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, - Sequence< sal_Int32 >& offset) throw(RuntimeException) -{ - return this->transliterate(inStr, startPos, nCount, offset); -} - -sal_Bool SAL_CALL Transliteration_sentencecase::equals( - const OUString& /*str1*/, sal_Int32 /*pos1*/, sal_Int32 /*nCount1*/, sal_Int32& /*nMatch1*/, - const OUString& /*str2*/, sal_Int32 /*pos2*/, sal_Int32 /*nCount2*/, sal_Int32& /*nMatch2*/) - throw(RuntimeException) -{ - throw RuntimeException(); -} - -Sequence< OUString > SAL_CALL -Transliteration_sentencecase::transliterateRange( const OUString& str1, const OUString& str2 ) - throw( RuntimeException) -{ - Sequence< OUString > ostr(2); - ostr[0] = str1; - ostr[1] = str2; - return ostr; -} - -} } } } - diff --git a/unotools/source/i18n/transliterationwrapper.cxx b/unotools/source/i18n/transliterationwrapper.cxx index 70d37ad54f6a..bd33e447471f 100644 --- a/unotools/source/i18n/transliterationwrapper.cxx +++ b/unotools/source/i18n/transliterationwrapper.cxx @@ -34,10 +34,11 @@ #include #include #include +#ifndef _COMPHELPER_COMPONENTFACTORY_HXX_ #include +#endif #include #include -#include #define TRANSLIT_LIBRARYNAME "i18n" #define TRANSLIT_SERVICENAME "com.sun.star.i18n.Transliteration" @@ -167,22 +168,14 @@ void TransliterationWrapper::loadModuleIfNeeded( sal_uInt16 nLang ) sal_Bool bLoad = bFirstCall; bFirstCall = sal_False; - if( static_cast< sal_Int32 >(nType) == TransliterationModulesExtra::SENTENCE_CASE ) - { - if( bLoad ) - loadModuleByImplName(String::CreateFromAscii("SENTENCE_CASE"), nLang); - } - else + if( nLanguage != nLang ) { - if( nLanguage != nLang ) - { - setLanguageLocaleImpl( nLang ); - if( !bLoad ) - bLoad = needLanguageForTheMode(); - } - if( bLoad ) - loadModuleImpl(); + setLanguageLocaleImpl( nLang ); + if( !bLoad ) + bLoad = needLanguageForTheMode(); } + if( bLoad ) + loadModuleImpl(); } -- cgit From aa611d78df11fcc1e35ead5fa093143bf17e4cf6 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Fri, 10 Jul 2009 14:03:42 +0200 Subject: #i103452#: replace PRODUCT by !DBG_UTIL; replace assert by OSL_ASSERT where possible --- .../source/property/ChainablePropertySetInfo.cxx | 2 +- .../source/property/MasterPropertySetInfo.cxx | 4 +- comphelper/source/property/propertysetinfo.cxx | 2 +- .../cclass_unicode_parser.cxx | 2 +- .../defaultnumberingprovider.cxx | 15 +++---- i18npool/source/localedata/localedata.cxx | 11 +---- sax/source/expatwrap/attrlistimpl.cxx | 7 --- sax/test/sax/testsax.cxx | 13 ++---- svtools/inc/svtools/svarray.hxx | 4 +- svtools/inc/svtools/syntaxhighlight.hxx | 2 +- svtools/inc/svtools/zforlist.hxx | 2 +- svtools/source/config/xmlaccelcfg.cxx | 8 +--- svtools/source/contnr/treelist.cxx | 2 +- svtools/source/edit/svmedit.cxx | 2 +- svtools/source/edit/syntaxhighlight.cxx | 2 +- svtools/source/items1/itempool.cxx | 8 ++-- svtools/source/numbers/zforfind.cxx | 2 +- svtools/source/numbers/zforlist.cxx | 2 +- svtools/source/svrtf/svparser.cxx | 8 ++-- toolkit/workben/layout/editor.cxx | 11 +++-- tools/inc/tools/fsys.hxx | 2 +- unotools/source/i18n/calendarwrapper.cxx | 52 +++++++++++----------- unotools/source/i18n/charclass.cxx | 4 +- unotools/source/i18n/localedatawrapper.cxx | 2 +- unotools/source/i18n/transliterationwrapper.cxx | 10 ++--- unotools/source/property/propertysetinfo.cxx | 2 +- 26 files changed, 75 insertions(+), 106 deletions(-) diff --git a/comphelper/source/property/ChainablePropertySetInfo.cxx b/comphelper/source/property/ChainablePropertySetInfo.cxx index b27cef88319c..c5d134eb9982 100644 --- a/comphelper/source/property/ChainablePropertySetInfo.cxx +++ b/comphelper/source/property/ChainablePropertySetInfo.cxx @@ -76,7 +76,7 @@ void ChainablePropertySetInfo::add( PropertyInfo* pMap, sal_Int32 nCount ) { OUString aName( pMap->mpName, pMap->mnNameLen, RTL_TEXTENCODING_ASCII_US ); -#ifndef PRODUCT +#ifdef DBG_UTIL PropertyInfoHash::iterator aIter = maMap.find( aName ); if( aIter != maMap.end() ) OSL_ENSURE( sal_False, "Warning: PropertyInfo added twice, possible error!"); diff --git a/comphelper/source/property/MasterPropertySetInfo.cxx b/comphelper/source/property/MasterPropertySetInfo.cxx index e74d21b2d755..91a9a17856d4 100644 --- a/comphelper/source/property/MasterPropertySetInfo.cxx +++ b/comphelper/source/property/MasterPropertySetInfo.cxx @@ -84,7 +84,7 @@ void MasterPropertySetInfo::add( PropertyInfo* pMap, sal_Int32 nCount, sal_uInt8 { OUString aName( pMap->mpName, pMap->mnNameLen, RTL_TEXTENCODING_ASCII_US ); -#ifndef PRODUCT +#ifdef DBG_UTIL PropertyDataHash::iterator aIter = maMap.find( aName ); if( aIter != maMap.end() ) OSL_ENSURE( sal_False, "Warning: PropertyInfo added twice, possible error!"); @@ -102,7 +102,7 @@ void MasterPropertySetInfo::add( PropertyInfoHash &rHash, sal_uInt8 nMapId ) while ( aIter != aEnd ) { -#ifndef PRODUCT +#ifdef DBG_UTIL PropertyDataHash::iterator aDebugIter = maMap.find( (*aIter).first ); if( aDebugIter != maMap.end() ) OSL_ENSURE( sal_False, "Warning: PropertyInfo added twice, possible error!"); diff --git a/comphelper/source/property/propertysetinfo.cxx b/comphelper/source/property/propertysetinfo.cxx index e155d695e2c9..83b769553331 100644 --- a/comphelper/source/property/propertysetinfo.cxx +++ b/comphelper/source/property/propertysetinfo.cxx @@ -82,7 +82,7 @@ void PropertyMapImpl::add( PropertyMapEntry* pMap, sal_Int32 nCount ) throw() { OUString aName( pMap->mpName, pMap->mnNameLen, RTL_TEXTENCODING_ASCII_US ); -#ifndef PRODUCT +#ifdef DBG_UTIL PropertyMap::iterator aIter = maPropertyMap.find( aName ); if( aIter != maPropertyMap.end() ) { diff --git a/i18npool/source/characterclassification/cclass_unicode_parser.cxx b/i18npool/source/characterclassification/cclass_unicode_parser.cxx index 27d6443a27fc..39e925cb7eb9 100644 --- a/i18npool/source/characterclassification/cclass_unicode_parser.cxx +++ b/i18npool/source/characterclassification/cclass_unicode_parser.cxx @@ -1038,7 +1038,7 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32 if ( !xNatNumSup.is() ) { throw RuntimeException( OUString( -#ifndef PRODUCT +#ifdef DBG_UTIL RTL_CONSTASCII_USTRINGPARAM( "cclass_Unicode::parseText: can't instanciate " NATIVENUMBERSUPPLIER_SERVICENAME ) diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx index 8979a5ffc203..d7b42601b01f 100644 --- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx +++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx @@ -39,11 +39,6 @@ #include #include -#if OSL_DEBUG_LEVEL == 0 && !defined(NDEBUG) -#define NDEBUG -#endif -#include - // Cyrillic upper case #define C_CYR_A "\xD0\x90" #define C_CYR_B "\xD0\x91" @@ -271,7 +266,7 @@ const char* expected_name( int i, int last ) else if( i==1 ) return "NumberingType"; else if( i==2 ) return "Suffix"; else if( i==last ) return "Value"; - else { assert(0); return ""; } + else { OSL_ASSERT(0); return ""; } } static const char* expected_type( int i, int last ) @@ -281,7 +276,7 @@ const char* expected_type( int i, int last ) else if( i==1 ) return "sal_Int16"; else if( i==2 ) return "OUString"; else if( i==last ) return "sal_Int32"; - else { assert(0); return ""; } + else { OSL_ASSERT(0); return ""; } } static void failedToConvert( int i, int last ) @@ -455,7 +450,7 @@ DefaultNumberingProvider::makeNumberingString( const SequenceA, 2=>B, ..., 26=>Z, 27=>AA, 28=>BB, ... @@ -473,7 +468,7 @@ DefaultNumberingProvider::makeNumberingString( const Sequence #include "rtl/instance.hxx" -#if OSL_DEBUG_LEVEL == 0 -# ifndef NDEBUG -# define NDEBUG -# endif -#endif -#include - using namespace com::sun::star::i18n; using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -1131,7 +1124,7 @@ LocaleData::getContinuousNumberingLevels( const lang::Locale& rLocale ) throw(Ru rVal.Value <<= (sal_Int16) sVal.toInt32(); break; default: - assert(0); + OSL_ASSERT(0); } } } @@ -1255,7 +1248,7 @@ LocaleData::getOutlineNumberingLevels( const lang::Locale& rLocale ) throw(Runti case 10: level[j].sTransliteration = tmp; break; case 11: level[j].nNatNum = tmp.toInt32(); break; default: - assert(0); + OSL_ASSERT(0); } } } diff --git a/sax/source/expatwrap/attrlistimpl.cxx b/sax/source/expatwrap/attrlistimpl.cxx index 1ec1128516fd..4eb07be50311 100644 --- a/sax/source/expatwrap/attrlistimpl.cxx +++ b/sax/source/expatwrap/attrlistimpl.cxx @@ -32,13 +32,6 @@ #include -#if OSL_DEBUG_LEVEL == 0 -# ifndef NDEBUG -# define NDEBUG -# endif -#endif -#include - #include using namespace ::std; diff --git a/sax/test/sax/testsax.cxx b/sax/test/sax/testsax.cxx index 07491bae33ec..8fe989676993 100644 --- a/sax/test/sax/testsax.cxx +++ b/sax/test/sax/testsax.cxx @@ -31,11 +31,6 @@ #include #include -#if OSL_DEBUG_LEVEL == 0 -#define NDEBUG -#endif -#include - #include #include @@ -245,12 +240,12 @@ Reference < XInputStream > createStreamFromSequence( { Reference < XInterface > xOutStreamService = xSMgr->createInstance( OUString::createFromAscii("com.sun.star.io.Pipe") ); - assert( xOutStreamService.is() ); + OSL_ASSERT( xOutStreamService.is() ); Reference< XOutputStream > rOutStream( xOutStreamService , UNO_QUERY ); - assert( rOutStream.is() ); + OSL_ASSERT( rOutStream.is() ); Reference< XInputStream > rInStream( xOutStreamService , UNO_QUERY ); - assert( rInStream.is() ); + OSL_ASSERT( rInStream.is() ); rOutStream->writeBytes( seqBytes ); rOutStream->flush(); @@ -379,7 +374,7 @@ public: // ExtendedDocumentHandler virtual void SAL_CALL endElement(const OUString& aName) throw (SAXException,RuntimeException) { - assert( m_iLevel ); + OSL_ASSERT( m_iLevel ); m_iLevel --; if( m_bPrint ) { int i; diff --git a/svtools/inc/svtools/svarray.hxx b/svtools/inc/svtools/svarray.hxx index 3ab3676fa5e0..e2348ce428b1 100644 --- a/svtools/inc/svtools/svarray.hxx +++ b/svtools/inc/svtools/svarray.hxx @@ -128,7 +128,7 @@ inline void* operator new( size_t, DummyType* pPtr ) } inline void operator delete( void*, DummyType* ) {} -#if defined(PRODUCT) +#if !defined(DBG_UTIL) #define _SVVARARR_DEF_GET_OP_INLINE( nm, ArrElem ) \ ArrElem& operator[](USHORT nP) const { return *(pData+nP); }\ @@ -335,7 +335,7 @@ SV_IMPL_VARARR_GEN( nm, AE, AE & ) #define SV_IMPL_VARARR_PLAIN( nm, AE ) \ SV_IMPL_VARARR_GEN( nm, AE, AE ) -#if defined(PRODUCT) +#if !defined(DBG_UTIL) #define _SVOBJARR_DEF_GET_OP_INLINE( nm,ArrElem )\ ArrElem& operator[](USHORT nP) const { return *(pData+nP); }\ diff --git a/svtools/inc/svtools/syntaxhighlight.hxx b/svtools/inc/svtools/syntaxhighlight.hxx index e2b575c7e085..27dd28b5b783 100644 --- a/svtools/inc/svtools/syntaxhighlight.hxx +++ b/svtools/inc/svtools/syntaxhighlight.hxx @@ -137,7 +137,7 @@ class SimpleTokenizer_Impl String getTokStr( /*out*/const sal_Unicode* pStartPos, /*out*/const sal_Unicode* pEndPos ); -#ifndef PRODUCT +#ifdef DBG_UTIL // TEST: Token ausgeben String getFullTokenStr( /*out*/TokenTypes eType, /*out*/const sal_Unicode* pStartPos, /*out*/const sal_Unicode* pEndPos ); diff --git a/svtools/inc/svtools/zforlist.hxx b/svtools/inc/svtools/zforlist.hxx index 814ca385d61a..22a258d32f88 100644 --- a/svtools/inc/svtools/zforlist.hxx +++ b/svtools/inc/svtools/zforlist.hxx @@ -901,7 +901,7 @@ private: ); // used as a loop body inside of GetNewCurrencySymbolString() and GetCurrencyEntry() -#ifdef PRODUCT +#ifndef DBG_UTIL inline #endif static BOOL ImpLookupCurrencyEntryLoopBody( diff --git a/svtools/source/config/xmlaccelcfg.cxx b/svtools/source/config/xmlaccelcfg.cxx index 36886a533413..a2fb5bac5df8 100644 --- a/svtools/source/config/xmlaccelcfg.cxx +++ b/svtools/source/config/xmlaccelcfg.cxx @@ -34,12 +34,6 @@ #include "xmlaccelcfg.hxx" #include -#if OSL_DEBUG_LEVEL == 0 -# ifndef NDEBUG -# define NDEBUG -# endif -#endif -#include #include #include @@ -200,7 +194,7 @@ void AttributeListImpl::clear() ::std::vector dummy; m_pImpl->vecAttribute.swap( dummy ); - assert( ! getLength() ); + OSL_ASSERT( ! getLength() ); } // ------------------------------------------------------------------ diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx index eb4e533b628c..c1491571dd1c 100644 --- a/svtools/source/contnr/treelist.cxx +++ b/svtools/source/contnr/treelist.cxx @@ -38,7 +38,7 @@ #include -#ifndef PRODUCT +#ifdef DBG_UTIL // Prueft Integritaet der Liste nach jeder Operation //#define CHECK_INTEGRITY #endif diff --git a/svtools/source/edit/svmedit.cxx b/svtools/source/edit/svmedit.cxx index 135761195e48..aeb1964b3893 100644 --- a/svtools/source/edit/svmedit.cxx +++ b/svtools/source/edit/svmedit.cxx @@ -1478,7 +1478,7 @@ long MultiLineEdit::PreNotify( NotifyEvent& rNEvt ) { long nDone = 0; -#if (OSL_DEBUG_LEVEL > 1) && !defined( PRODUCT ) +#if (OSL_DEBUG_LEVEL > 1) && defined(DBG_UTIL) if( rNEvt.GetType() == EVENT_KEYINPUT ) { const KeyEvent& rKEvent = *rNEvt.GetKeyEvent(); diff --git a/svtools/source/edit/syntaxhighlight.cxx b/svtools/source/edit/syntaxhighlight.cxx index e2e71e86b662..7e2f98d0d37f 100644 --- a/svtools/source/edit/syntaxhighlight.cxx +++ b/svtools/source/edit/syntaxhighlight.cxx @@ -682,7 +682,7 @@ String SimpleTokenizer_Impl::getTokStr return String( pStartPos, (USHORT)( pEndPos - pStartPos ) ); } -#ifndef PRODUCT +#ifdef DBG_UTIL // TEST: Token ausgeben String SimpleTokenizer_Impl::getFullTokenStr( /*out*/TokenTypes eType, /*out*/const sal_Unicode* pStartPos, /*out*/const sal_Unicode* pEndPos ) diff --git a/svtools/source/items1/itempool.cxx b/svtools/source/items1/itempool.cxx index e54bca8d3c19..823658132fe0 100644 --- a/svtools/source/items1/itempool.cxx +++ b/svtools/source/items1/itempool.cxx @@ -589,7 +589,7 @@ void SfxItemPool::Delete() for ( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr ) if (*ppHtArr) { -#ifndef PRODUCT +#ifdef DBG_UTIL ReleaseRef( **ppHtArr, (*ppHtArr)->GetRefCount() ); #endif delete *ppHtArr; @@ -598,7 +598,7 @@ void SfxItemPool::Delete() } if ( *ppDefaultItem ) { -#ifndef PRODUCT +#ifdef DBG_UTIL SetRefCount( **ppDefaultItem, 0 ); #endif DELETEZ( *ppDefaultItem ); @@ -621,7 +621,7 @@ void SfxItemPool::Delete() for ( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr ) if (*ppHtArr) { -#ifndef PRODUCT +#ifdef DBG_UTIL ReleaseRef( **ppHtArr, (*ppHtArr)->GetRefCount() ); #endif delete *ppHtArr; @@ -630,7 +630,7 @@ void SfxItemPool::Delete() } if ( *ppDefaultItem ) { -#ifndef PRODUCT +#ifdef DBG_UTIL SetRefCount( **ppDefaultItem, 0 ); #endif delete *ppDefaultItem; diff --git a/svtools/source/numbers/zforfind.cxx b/svtools/source/numbers/zforfind.cxx index 7aac440e8b58..aa7d75a098b7 100644 --- a/svtools/source/numbers/zforfind.cxx +++ b/svtools/source/numbers/zforfind.cxx @@ -53,7 +53,7 @@ #undef _ZFORFIND_CXX -#ifdef PRODUCT +#ifndef DBG_UTIL #define NF_TEST_CALENDAR 0 #else #define NF_TEST_CALENDAR 0 diff --git a/svtools/source/numbers/zforlist.cxx b/svtools/source/numbers/zforlist.cxx index b76bf3226b50..fcae93964e72 100644 --- a/svtools/source/numbers/zforlist.cxx +++ b/svtools/source/numbers/zforlist.cxx @@ -3227,7 +3227,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat() // static // try to make it inline if possible since this a loop body // TRUE: continue; FALSE: break loop, if pFoundEntry==NULL dupe found -#ifdef PRODUCT +#ifndef DBG_UTIL inline #endif BOOL SvNumberFormatter::ImpLookupCurrencyEntryLoopBody( diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx index c7444dd5cbcb..6d6f4f059545 100644 --- a/svtools/source/svrtf/svparser.cxx +++ b/svtools/source/svrtf/svparser.cxx @@ -66,7 +66,7 @@ struct SvParser_Impl rtl_TextToUnicodeConverter hConv; rtl_TextToUnicodeContext hContext; -#ifndef PRODUCT +#ifdef DBG_UTIL SvFileStream aOut; #endif @@ -100,7 +100,7 @@ SvParser::SvParser( SvStream& rIn, BYTE nStackSize ) pTokenStack = new TokenStackType[ nTokenStackSize ]; pTokenStackPos = pTokenStack; -#ifndef PRODUCT +#ifdef DBG_UTIL // wenn die Datei schon existiert, dann Anhaengen: if( !pImplData ) @@ -119,7 +119,7 @@ SvParser::SvParser( SvStream& rIn, BYTE nStackSize ) SvParser::~SvParser() { -#ifndef PRODUCT +#ifdef DBG_UTIL if( pImplData->aOut.IsOpen() ) pImplData->aOut << "\n\n >>>>>>>>>>>>>>> Dump Ende <<<<<<<<<<<<<<<\n"; pImplData->aOut.Close(); @@ -417,7 +417,7 @@ sal_Unicode SvParser::GetNextChar() return sal_Unicode(EOF); } -#ifndef PRODUCT +#ifdef DBG_UTIL if( pImplData->aOut.IsOpen() ) pImplData->aOut << ByteString::ConvertFromUnicode( c, RTL_TEXTENCODING_MS_1251 ); diff --git a/toolkit/workben/layout/editor.cxx b/toolkit/workben/layout/editor.cxx index dd218de40da7..3b5bd768566b 100644 --- a/toolkit/workben/layout/editor.cxx +++ b/toolkit/workben/layout/editor.cxx @@ -34,7 +34,6 @@ #undef NDEBUG /* -#include #include #include */ @@ -189,12 +188,12 @@ public: while ( xParent.is() && !uno::Reference< awt::XWindow >( xParent, uno::UNO_QUERY ).is() ) { uno::Reference< awt::XLayoutContainer > xContainer( xParent, uno::UNO_QUERY ); - assert( xContainer.is() ); + OSL_ASSERT( xContainer.is() ); xParent = uno::Reference< awt::XLayoutContainer >( xContainer->getParent(), uno::UNO_QUERY ); } mxWidget = WidgetFactory::createWidget( xToolkit, xParent, unoName, nAttrbs ); - assert( mxWidget.is() ); + OSL_ASSERT( mxWidget.is() ); mxContainer = uno::Reference< awt::XLayoutContainer >( mxWidget, uno::UNO_QUERY ); mrLabel = mrUnoName = unoName; @@ -340,7 +339,7 @@ public: else maChildren.push_back( pChild ); - assert( pChild->mpParent == NULL ); + OSL_ASSERT( pChild->mpParent == NULL ); pChild->mpParent = this; // store container props @@ -1733,7 +1732,7 @@ EditorImpl::EditorImpl( layout::Dialog *dialog, mxFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ) ), uno::UNO_QUERY ); - assert( mxToolkit.is() ); + OSL_ASSERT( mxToolkit.is() ); // custom widgets #if DEBUG_PRINT @@ -1890,7 +1889,7 @@ IMPL_LINK( EditorImpl, CreateWidgetHdl, layout::Button *, pBtn ) if ( pBtn == *it ) break; } - assert( i < WIDGETS_SPECS_LEN ); + OSL_ASSERT( i < WIDGETS_SPECS_LEN ); createWidget( WIDGETS_SPECS[i].pName ); return 0; } diff --git a/tools/inc/tools/fsys.hxx b/tools/inc/tools/fsys.hxx index 8223d77106e3..f1da7579aee6 100644 --- a/tools/inc/tools/fsys.hxx +++ b/tools/inc/tools/fsys.hxx @@ -570,7 +570,7 @@ void FSysEnableSysErrorBox( BOOL bEnable ); //======================================================================== -#if defined(DBG_UTIL) && !defined(PRODUCT) +#if defined(DBG_UTIL) void FSysTest(); #endif diff --git a/unotools/source/i18n/calendarwrapper.cxx b/unotools/source/i18n/calendarwrapper.cxx index 1d83761b5cea..b56175af7e41 100644 --- a/unotools/source/i18n/calendarwrapper.cxx +++ b/unotools/source/i18n/calendarwrapper.cxx @@ -71,7 +71,7 @@ CalendarWrapper::CalendarWrapper( } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "CalendarWrapper ctor: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -96,7 +96,7 @@ CalendarWrapper::CalendarWrapper( } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getComponentInstance: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -122,7 +122,7 @@ void CalendarWrapper::loadDefaultCalendar( const ::com::sun::star::lang::Locale& } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "loadDefaultCalendar: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -142,7 +142,7 @@ void CalendarWrapper::loadCalendar( const ::rtl::OUString& rUniqueID, const ::co } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "loadCalendar: Exception caught\nrequested: " ); aMsg += ByteString( String( rUniqueID ), RTL_TEXTENCODING_UTF8 ); aMsg += " Locale: "; @@ -167,7 +167,7 @@ void CalendarWrapper::loadCalendar( const ::rtl::OUString& rUniqueID, const ::co } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getLoadedCalendar: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -188,7 +188,7 @@ void CalendarWrapper::loadCalendar( const ::rtl::OUString& rUniqueID, const ::co } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getAllCalendars: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -209,7 +209,7 @@ void CalendarWrapper::loadCalendar( const ::rtl::OUString& rUniqueID, const ::co } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getUniqueID: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -230,7 +230,7 @@ void CalendarWrapper::setDateTime( double nTimeInDays ) } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "setDateTime: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -250,7 +250,7 @@ double CalendarWrapper::getDateTime() const } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getDateTime: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -280,7 +280,7 @@ sal_Int32 CalendarWrapper::getCombinedOffsetInMillis( } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "setLocalDateTime: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -352,7 +352,7 @@ void CalendarWrapper::setLocalDateTime( double nTimeInDays ) } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "setLocalDateTime: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -378,7 +378,7 @@ double CalendarWrapper::getLocalDateTime() const } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getLocalDateTime: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -399,7 +399,7 @@ void CalendarWrapper::setValue( sal_Int16 nFieldIndex, sal_Int16 nValue ) } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "setValue: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -419,7 +419,7 @@ sal_Bool CalendarWrapper::isValid() const } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "isValid: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -440,7 +440,7 @@ sal_Int16 CalendarWrapper::getValue( sal_Int16 nFieldIndex ) const } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getValue: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -461,7 +461,7 @@ void CalendarWrapper::addValue( sal_Int16 nFieldIndex, sal_Int32 nAmount ) } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "addValue: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -481,7 +481,7 @@ sal_Int16 CalendarWrapper::getFirstDayOfWeek() const } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getFirstDayOfWeek: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -502,7 +502,7 @@ void CalendarWrapper::setFirstDayOfWeek( sal_Int16 nDay ) } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "setFirstDayOfWeek: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -522,7 +522,7 @@ void CalendarWrapper::setMinimumNumberOfDaysForFirstWeek( sal_Int16 nDays ) } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "setMinimumNumberOfDaysForFirstWeek: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -542,7 +542,7 @@ sal_Int16 CalendarWrapper::getMinimumNumberOfDaysForFirstWeek() const } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getMinimumNumberOfDaysForFirstWeek: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -563,7 +563,7 @@ sal_Int16 CalendarWrapper::getNumberOfMonthsInYear() const } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getNumberOfMonthsInYear: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -584,7 +584,7 @@ sal_Int16 CalendarWrapper::getNumberOfDaysInWeek() const } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getNumberOfDaysInWeek: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -605,7 +605,7 @@ sal_Int16 CalendarWrapper::getNumberOfDaysInWeek() const } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getMonths: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -626,7 +626,7 @@ sal_Int16 CalendarWrapper::getNumberOfDaysInWeek() const } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getDays: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -647,7 +647,7 @@ String CalendarWrapper::getDisplayName( sal_Int16 nCalendarDisplayIndex, sal_Int } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getDisplayName: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -670,7 +670,7 @@ String CalendarWrapper::getDisplayString( sal_Int32 nCalendarDisplayCode, sal_In } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getDisplayString: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); diff --git a/unotools/source/i18n/charclass.cxx b/unotools/source/i18n/charclass.cxx index c1b6b4bc155c..5b411d1bb519 100644 --- a/unotools/source/i18n/charclass.cxx +++ b/unotools/source/i18n/charclass.cxx @@ -538,7 +538,7 @@ sal_Int32 CharClass::getStringType( const String& rStr, xub_StrLen nPos, xub_Str } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "parseAnyToken: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -570,7 +570,7 @@ sal_Int32 CharClass::getStringType( const String& rStr, xub_StrLen nPos, xub_Str } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "parsePredefinedToken: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx index 074ff7af716a..fa70cc3dda81 100644 --- a/unotools/source/i18n/localedatawrapper.cxx +++ b/unotools/source/i18n/localedatawrapper.cxx @@ -1991,7 +1991,7 @@ void LocaleDataWrapper::evaluateLocaleDataChecking() nCheck = nLocaleDataChecking; if (!nCheck) { -#ifndef PRODUCT +#ifdef DBG_UTIL nCheck = 1; #else const char* pEnv = getenv( "OOO_ENABLE_LOCALE_DATA_CHECKS"); diff --git a/unotools/source/i18n/transliterationwrapper.cxx b/unotools/source/i18n/transliterationwrapper.cxx index bd33e447471f..7647a6abc345 100644 --- a/unotools/source/i18n/transliterationwrapper.cxx +++ b/unotools/source/i18n/transliterationwrapper.cxx @@ -191,7 +191,7 @@ void TransliterationWrapper::loadModuleImpl() const } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "loadModuleImpl: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -218,7 +218,7 @@ void TransliterationWrapper::loadModuleByImplName( } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "loadModuleByImplName: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -244,7 +244,7 @@ sal_Bool TransliterationWrapper::equals( } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "equals: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -269,7 +269,7 @@ sal_Int32 TransliterationWrapper::compareSubstring( } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "compareSubstring: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -292,7 +292,7 @@ sal_Int32 TransliterationWrapper::compareString( const String& rStr1, const Stri } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "compareString: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); diff --git a/unotools/source/property/propertysetinfo.cxx b/unotools/source/property/propertysetinfo.cxx index b8b5f8bb5125..ced5ae10a9d7 100644 --- a/unotools/source/property/propertysetinfo.cxx +++ b/unotools/source/property/propertysetinfo.cxx @@ -79,7 +79,7 @@ void PropertyMapImpl::add( PropertyMapEntry* pMap ) throw() { OUString aName( pMap->mpName, pMap->mnNameLen, RTL_TEXTENCODING_ASCII_US ); -#ifndef PRODUCT +#ifdef DBG_UTIL PropertyMap::iterator aIter = maPropertyMap.find( aName ); if( aIter != maPropertyMap.end() ) { -- cgit -- cgit From 9be3ff7f8deed236d9f70ecebabfbc6a4944f349 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Wed, 9 Sep 2009 17:59:48 +0200 Subject: #i98036# draw contros inactive on lost focus --- vcl/aqua/inc/salgdi.h | 1 + vcl/aqua/source/gdi/salnativewidgets.cxx | 5 +++-- vcl/aqua/source/window/salframeview.mm | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/vcl/aqua/inc/salgdi.h b/vcl/aqua/inc/salgdi.h index 11abd6086ce7..4933dbc48586 100644 --- a/vcl/aqua/inc/salgdi.h +++ b/vcl/aqua/inc/salgdi.h @@ -358,6 +358,7 @@ private: void ApplyXorContext(); void Pattern50Fill(); + UInt32 getState( ControlState nState ); }; class XorEmulation diff --git a/vcl/aqua/source/gdi/salnativewidgets.cxx b/vcl/aqua/source/gdi/salnativewidgets.cxx index 6cd4e78a2d1a..754358823a93 100644 --- a/vcl/aqua/source/gdi/salnativewidgets.cxx +++ b/vcl/aqua/source/gdi/salnativewidgets.cxx @@ -430,9 +430,10 @@ BOOL AquaSalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart #define CTRL_STATE_SELECTED 0x0040 #define CTRL_CACHING_ALLOWED 0x8000 // set when the control is completely visible (i.e. not clipped) */ -static ThemeDrawState getState( ControlState nState ) +UInt32 AquaSalGraphics::getState( ControlState nState ) { - if( (nState & CTRL_STATE_ENABLED) == 0 ) + bool bDrawActive = mpFrame ? ([mpFrame->getWindow() isKeyWindow] ? true : false) : true; + if( (nState & CTRL_STATE_ENABLED) == 0 || ! bDrawActive ) { if( (nState & CTRL_STATE_HIDDEN) == 0 ) return kThemeStateInactive; diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm index c7facd8c6c09..0af2f37236e1 100755 --- a/vcl/aqua/source/window/salframeview.mm +++ b/vcl/aqua/source/window/salframeview.mm @@ -213,6 +213,7 @@ static AquaSalFrame* getMouseContainerFrame() AquaSalMenu::enableMainMenu( false ); #endif mpFrame->CallCallback( SALEVENT_GETFOCUS, 0 ); + mpFrame->SendPaintEvent(); // repaint controls as active } } @@ -221,7 +222,10 @@ static AquaSalFrame* getMouseContainerFrame() YIELD_GUARD; if( mpFrame && AquaSalFrame::isAlive( mpFrame ) ) + { mpFrame->CallCallback(SALEVENT_LOSEFOCUS, 0); + mpFrame->SendPaintEvent(); // repaint controls as inactive + } } -(void)windowDidChangeScreen: (NSNotification*)pNotification -- cgit -- cgit From cdc8876be07e8191f38a47159ec152c3b90a7d82 Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Mon, 14 Sep 2009 12:09:22 +0000 Subject: #cr6875455# - introduce impl-data (ControlData) for a control - move Control::mpLayoutData to an impl structure - introduce Control::GetCanonicalFont/TextColor - introduce Control::ImplInitSettings, which collects the duplicated code in all kind of derived classes, relying on GetCanonical* now - introduce a reference device for a Control, which can be used to render text - introduce Control::DrawControlText, which delegates to DrawText if no reference device is set, or renders the text using the reference device - let static (i.e. non-input) Control classes use DrawControlText instead of DrawText missing items (at least): - text layout data in DrawControlText (needed for A11Y) - respect vertical and horizontal alignments - respect various other TEXT_DRAW_* flags - word breaks --- vcl/inc/vcl/button.hxx | 12 +++ vcl/inc/vcl/ctrl.hxx | 41 +++++++- vcl/inc/vcl/fixed.hxx | 9 ++ vcl/inc/vcl/group.hxx | 4 + vcl/inc/vcl/tabctrl.hxx | 2 + vcl/source/control/button.cxx | 121 +++++++++------------ vcl/source/control/combobox.cxx | 6 +- vcl/source/control/ctrl.cxx | 225 ++++++++++++++++++++++++++++++++++------ vcl/source/control/edit.cxx | 20 ++-- vcl/source/control/fixed.cxx | 106 +++++++------------ vcl/source/control/group.cxx | 44 ++++---- vcl/source/control/ilstbox.cxx | 40 +++---- vcl/source/control/lstbox.cxx | 6 +- vcl/source/control/spinfld.cxx | 4 +- vcl/source/control/tabctrl.cxx | 74 ++++++------- vcl/source/window/window.cxx | 2 + 16 files changed, 439 insertions(+), 277 deletions(-) diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx index 94df24a9cea7..8b5f3d89725b 100644 --- a/vcl/inc/vcl/button.hxx +++ b/vcl/inc/vcl/button.hxx @@ -158,6 +158,10 @@ protected: PushButton( WindowType nType ); virtual void FillLayoutData() const; + virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; public: PushButton( Window* pParent, WinBits nStyle = 0 ); PushButton( Window* pParent, const ResId& rResId ); @@ -330,6 +334,10 @@ public: protected: virtual void FillLayoutData() const; + virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; inline void SetMouseRect( const Rectangle& _rMouseRect ) { maMouseRect = _rMouseRect; } inline const Rectangle& GetMouseRect( ) const { return maMouseRect; } @@ -435,6 +443,10 @@ protected: SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); SAL_DLLPRIVATE virtual void FillLayoutData() const; + SAL_DLLPRIVATE virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + SAL_DLLPRIVATE virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; public: SAL_DLLPRIVATE void ImplCheck(); diff --git a/vcl/inc/vcl/ctrl.hxx b/vcl/inc/vcl/ctrl.hxx index 7bb5620ef93f..2508a58c005e 100644 --- a/vcl/inc/vcl/ctrl.hxx +++ b/vcl/inc/vcl/ctrl.hxx @@ -38,7 +38,7 @@ #include // forward -namespace vcl { struct ControlLayoutData; } +namespace vcl { struct ImplControlData; struct ControlLayoutData; } // ----------- // - Control - @@ -47,11 +47,12 @@ namespace vcl { struct ControlLayoutData; } class VCL_DLLPUBLIC Control : public Window { protected: - mutable vcl::ControlLayoutData* mpLayoutData; + ::vcl::ImplControlData* mpControlData; + private: - BOOL mbHasFocus; - Link maGetFocusHdl; - Link maLoseFocusHdl; + BOOL mbHasFocus; + Link maGetFocusHdl; + Link maLoseFocusHdl; SAL_DLLPRIVATE void ImplInitControlData(); @@ -66,6 +67,14 @@ protected: // helper method for composite controls void AppendLayoutData( const Control& rSubControl ) const; + /// creates the mpData->mpLayoutData structure + void CreateLayoutData() const; + /// determines whether we currently have layout data + bool HasLayoutData() const; + /// returns the current layout data + ::vcl::ControlLayoutData* + GetLayoutData() const; + /** this calls both our event listeners, and a specified handler If the Control instance is destroyed during any of those calls, the @@ -84,6 +93,22 @@ protected: ULONG nEvent, const Link& rHandler, void* pCaller ); + /** draws the given text onto the given device + + If no reference device is set, the draw request will simply be forwarded to OutputDevice::DrawText. Otherwise, + the text will be rendered according to the metrics at the reference device. + */ + void DrawControlText( OutputDevice& _rTargetDevice, const Rectangle& _rRect, + const XubString& _rStr, USHORT _nStyle, + MetricVector* _pVector, String* _pDisplayText ) const; + + virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; + + void ImplInitSettings( const BOOL _bFont, const BOOL _bForeground ); + //#if 0 // _SOLAR__PRIVATE public: SAL_DLLPRIVATE void ImplClearLayoutData() const; @@ -157,6 +182,12 @@ public: void SetLayoutDataParent( const Control* pParent ) const; virtual Size GetOptimalSize(WindowSizeType eType) const; + + /** sets a reference device used for rendering control text + @seealso DrawControlText + */ + void SetReferenceDevice( OutputDevice* _referenceDevice ); + OutputDevice* GetReferenceDevice() const; }; #endif // _SV_CTRL_HXX diff --git a/vcl/inc/vcl/fixed.hxx b/vcl/inc/vcl/fixed.hxx index ba576f280b83..83f8c0fcb190 100644 --- a/vcl/inc/vcl/fixed.hxx +++ b/vcl/inc/vcl/fixed.hxx @@ -58,6 +58,11 @@ public: //#endif protected: virtual void FillLayoutData() const; + virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; + public: FixedText( Window* pParent, WinBits nStyle = 0 ); FixedText( Window* pParent, const ResId& rResId ); @@ -89,6 +94,10 @@ private: protected: virtual void FillLayoutData() const; + virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; public: FixedLine( Window* pParent, WinBits nStyle = WB_HORZ ); diff --git a/vcl/inc/vcl/group.hxx b/vcl/inc/vcl/group.hxx index 0e84344587c7..7c3d5d87954e 100644 --- a/vcl/inc/vcl/group.hxx +++ b/vcl/inc/vcl/group.hxx @@ -50,6 +50,10 @@ private: const Point& rPos, const Size& rSize, bool bLayout = false ); virtual void FillLayoutData() const; + virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; public: GroupBox( Window* pParent, WinBits nStyle = 0 ); diff --git a/vcl/inc/vcl/tabctrl.hxx b/vcl/inc/vcl/tabctrl.hxx index 378459b9eadb..4cd4011b3e10 100644 --- a/vcl/inc/vcl/tabctrl.hxx +++ b/vcl/inc/vcl/tabctrl.hxx @@ -101,6 +101,8 @@ protected: SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); virtual void FillLayoutData() const; + virtual const Font& GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& GetCanonicalTextColor( const StyleSettings& _rStyle ) const; SAL_DLLPRIVATE Rectangle* ImplFindPartRect( const Point& rPt ); public: diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 2e2342fc6fc8..0f9a09cb17e7 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -50,7 +50,7 @@ #include #include #include -#include +#include #ifndef _SV_NATIVEWIDGET_HXX #include #endif @@ -383,8 +383,8 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, WinBits nWinStyle = GetStyle(); Rectangle aOutRect( rPos, rSize ); - MetricVector *pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL; - String *pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL; + MetricVector *pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; + String *pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; ImageAlign eImageAlign = mpButtonData->meImageAlign; Size aImageSize = mpButtonData->maImage.GetSizePixel(); @@ -411,8 +411,7 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, rPos = aOutRect.TopLeft(); ImplSetFocusRect( aOutRect ); - - pDev->DrawText( aOutRect, aText, nTextStyle, pVector, pDisplayText ); + DrawControlText( *pDev, aOutRect, aText, nTextStyle, pVector, pDisplayText ); return; } @@ -854,31 +853,25 @@ WinBits PushButton::ImplInitStyle( const Window* pPrevWindow, WinBits nStyle ) return nStyle; } +// ----------------------------------------------------------------- + +const Font& PushButton::GetCanonicalFont( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetPushButtonFont(); +} + +// ----------------------------------------------------------------- +const Color& PushButton::GetCanonicalTextColor( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetButtonTextColor(); +} + // ----------------------------------------------------------------------- void PushButton::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if ( bFont ) - { - Font aFont = rStyleSettings.GetPushButtonFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); - } - - if ( bForeground || bFont ) - { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetButtonTextColor(); - SetTextColor( aColor ); - SetTextFillColor(); - } + Button::ImplInitSettings( bFont, bForeground ); if ( bBackground ) { @@ -1660,7 +1653,7 @@ void PushButton::KeyUp( const KeyEvent& rKEvt ) void PushButton::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast(this)->ImplDrawPushButton( true ); } @@ -2226,31 +2219,25 @@ WinBits RadioButton::ImplInitStyle( const Window* pPrevWindow, WinBits nStyle ) return nStyle; } +// ----------------------------------------------------------------- + +const Font& RadioButton::GetCanonicalFont( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetRadioCheckFont(); +} + +// ----------------------------------------------------------------- +const Color& RadioButton::GetCanonicalTextColor( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetRadioCheckTextColor(); +} + // ----------------------------------------------------------------------- void RadioButton::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if ( bFont ) - { - Font aFont = rStyleSettings.GetRadioCheckFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); - } - - if ( bForeground || bFont ) - { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetRadioCheckTextColor(); - SetTextColor( aColor ); - SetTextFillColor(); - } + Button::ImplInitSettings( bFont, bForeground ); if ( bBackground ) { @@ -2437,8 +2424,8 @@ void RadioButton::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, WinBits nWinStyle = GetStyle(); XubString aText( GetText() ); Rectangle aRect( rPos, rSize ); - MetricVector* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL; - String* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL; + MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; + String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; pDev->Push( PUSH_CLIPREGION ); pDev->IntersectClipRegion( Rectangle( rPos, rSize ) ); @@ -2859,7 +2846,7 @@ void RadioButton::KeyUp( const KeyEvent& rKEvt ) void RadioButton::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast(this)->ImplDrawRadioButton( true ); } @@ -3400,31 +3387,25 @@ WinBits CheckBox::ImplInitStyle( const Window* pPrevWindow, WinBits nStyle ) return nStyle; } +// ----------------------------------------------------------------- + +const Font& CheckBox::GetCanonicalFont( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetRadioCheckFont(); +} + +// ----------------------------------------------------------------- +const Color& CheckBox::GetCanonicalTextColor( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetRadioCheckTextColor(); +} + // ----------------------------------------------------------------------- void CheckBox::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if ( bFont ) - { - Font aFont = rStyleSettings.GetRadioCheckFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); - } - - if ( bForeground || bFont ) - { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetRadioCheckTextColor(); - SetTextColor( aColor ); - SetTextFillColor(); - } + Button::ImplInitSettings( bFont, bForeground ); if ( bBackground ) { @@ -3802,7 +3783,7 @@ void CheckBox::KeyUp( const KeyEvent& rKEvt ) void CheckBox::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast(this)->ImplDrawCheckBox( true ); } diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 9f5160a2af11..38e43a75b935 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -44,7 +44,7 @@ #include #include #include -#include +#include @@ -687,7 +687,7 @@ void ComboBox::Resize() void ComboBox::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); AppendLayoutData( *mpSubEdit ); mpSubEdit->SetLayoutDataParent( this ); Control* pMainWindow = mpImplLB->GetMainWindow(); @@ -1531,7 +1531,7 @@ void ComboBox::SetBorderStyle( USHORT nBorderStyle ) long ComboBox::GetIndexForPoint( const Point& rPoint, USHORT& rPos ) const { - if( ! mpLayoutData ) + if( !HasLayoutData() ) FillLayoutData(); // check whether rPoint fits at all diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index 55c979fbd69f..163e7cfeb915 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -39,10 +39,13 @@ #include #include #include -#include +#include #include +namespace vcl +{ +} using namespace vcl; @@ -51,7 +54,7 @@ using namespace vcl; void Control::ImplInitControlData() { mbHasFocus = FALSE; - mpLayoutData = NULL; + mpControlData = new ImplControlData; } // ----------------------------------------------------------------------- @@ -90,7 +93,7 @@ Control::Control( Window* pParent, const ResId& rResId ) : Control::~Control() { - delete mpLayoutData, mpLayoutData = NULL; + delete mpControlData, mpControlData = NULL; } // ----------------------------------------------------------------------- @@ -111,7 +114,7 @@ void Control::LoseFocus() void Control::Resize() { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); Window::Resize(); } @@ -123,10 +126,31 @@ void Control::FillLayoutData() const // ----------------------------------------------------------------------- +void Control::CreateLayoutData() const +{ + DBG_ASSERT( !mpControlData->mpLayoutData, "Control::CreateLayoutData: should be called with non-existent layout data only!" ); + mpControlData->mpLayoutData = new ::vcl::ControlLayoutData(); +} + +// ----------------------------------------------------------------------- + +bool Control::HasLayoutData() const +{ + return mpControlData->mpLayoutData != NULL; +} + +// ----------------------------------------------------------------------- + +::vcl::ControlLayoutData* Control::GetLayoutData() const +{ + return mpControlData->mpLayoutData; +} + +// ----------------------------------------------------------------------- + void Control::SetText( const String& rStr ) { - delete mpLayoutData; - mpLayoutData = NULL; + ImplClearLayoutData(); Window::SetText( rStr ); } @@ -142,9 +166,9 @@ Rectangle ControlLayoutData::GetCharacterBounds( long nIndex ) const Rectangle Control::GetCharacterBounds( long nIndex ) const { - if( ! mpLayoutData ) + if( !HasLayoutData() ) FillLayoutData(); - return mpLayoutData ? mpLayoutData->GetCharacterBounds( nIndex ) : Rectangle(); + return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->GetCharacterBounds( nIndex ) : Rectangle(); } // ----------------------------------------------------------------------- @@ -167,9 +191,9 @@ long ControlLayoutData::GetIndexForPoint( const Point& rPoint ) const long Control::GetIndexForPoint( const Point& rPoint ) const { - if( ! mpLayoutData ) + if( ! HasLayoutData() ) FillLayoutData(); - return mpLayoutData ? mpLayoutData->GetIndexForPoint( rPoint ) : -1; + return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->GetIndexForPoint( rPoint ) : -1; } // ----------------------------------------------------------------------- @@ -186,9 +210,9 @@ long ControlLayoutData::GetLineCount() const long Control::GetLineCount() const { - if( ! mpLayoutData ) + if( !HasLayoutData() ) FillLayoutData(); - return mpLayoutData ? mpLayoutData->GetLineCount() : 0; + return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->GetLineCount() : 0; } // ----------------------------------------------------------------------- @@ -220,9 +244,9 @@ Pair ControlLayoutData::GetLineStartEnd( long nLine ) const Pair Control::GetLineStartEnd( long nLine ) const { - if( ! mpLayoutData ) + if( !HasLayoutData() ) FillLayoutData(); - return mpLayoutData ? mpLayoutData->GetLineStartEnd( nLine ) : Pair( -1, -1 ); + return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->GetLineStartEnd( nLine ) : Pair( -1, -1 ); } // ----------------------------------------------------------------------- @@ -263,18 +287,18 @@ long ControlLayoutData::ToRelativeLineIndex( long nIndex ) const long Control::ToRelativeLineIndex( long nIndex ) const { - if( ! mpLayoutData ) + if( !HasLayoutData() ) FillLayoutData(); - return mpLayoutData ? mpLayoutData->ToRelativeLineIndex( nIndex ) : -1; + return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->ToRelativeLineIndex( nIndex ) : -1; } // ----------------------------------------------------------------------- String Control::GetDisplayText() const { - if( ! mpLayoutData ) + if( !HasLayoutData() ) FillLayoutData(); - return mpLayoutData ? mpLayoutData->m_aDisplayText : GetText(); + return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->m_aDisplayText : GetText(); } // ----------------------------------------------------------------------- @@ -321,8 +345,7 @@ void Control::StateChanged( StateChangedType nStateChange ) nStateChange == STATE_CHANGE_CONTROLFONT ) { - delete mpLayoutData; - mpLayoutData = NULL; + ImplClearLayoutData(); } Window::StateChanged( nStateChange ); } @@ -331,25 +354,25 @@ void Control::StateChanged( StateChangedType nStateChange ) void Control::AppendLayoutData( const Control& rSubControl ) const { - if( ! rSubControl.mpLayoutData ) + if( !rSubControl.HasLayoutData() ) rSubControl.FillLayoutData(); - if( ! rSubControl.mpLayoutData || ! rSubControl.mpLayoutData->m_aDisplayText.Len() ) + if( !rSubControl.HasLayoutData() || !rSubControl.mpControlData->mpLayoutData->m_aDisplayText.Len() ) return; - long nCurrentIndex = mpLayoutData->m_aDisplayText.Len(); - mpLayoutData->m_aDisplayText.Append( rSubControl.mpLayoutData->m_aDisplayText ); - int nLines = rSubControl.mpLayoutData->m_aLineIndices.size(); + long nCurrentIndex = mpControlData->mpLayoutData->m_aDisplayText.Len(); + mpControlData->mpLayoutData->m_aDisplayText.Append( rSubControl.mpControlData->mpLayoutData->m_aDisplayText ); + int nLines = rSubControl.mpControlData->mpLayoutData->m_aLineIndices.size(); int n; - mpLayoutData->m_aLineIndices.push_back( nCurrentIndex ); + mpControlData->mpLayoutData->m_aLineIndices.push_back( nCurrentIndex ); for( n = 1; n < nLines; n++ ) - mpLayoutData->m_aLineIndices.push_back( rSubControl.mpLayoutData->m_aLineIndices[n] + nCurrentIndex ); - int nRectangles = rSubControl.mpLayoutData->m_aUnicodeBoundRects.size(); + mpControlData->mpLayoutData->m_aLineIndices.push_back( rSubControl.mpControlData->mpLayoutData->m_aLineIndices[n] + nCurrentIndex ); + int nRectangles = rSubControl.mpControlData->mpLayoutData->m_aUnicodeBoundRects.size(); Rectangle aRel = const_cast(rSubControl).GetWindowExtentsRelative( const_cast(this) ); for( n = 0; n < nRectangles; n++ ) { - Rectangle aRect = rSubControl.mpLayoutData->m_aUnicodeBoundRects[n]; + Rectangle aRect = rSubControl.mpControlData->mpLayoutData->m_aUnicodeBoundRects[n]; aRect.Move( aRel.Left(), aRel.Top() ); - mpLayoutData->m_aUnicodeBoundRects.push_back( aRect ); + mpControlData->mpLayoutData->m_aUnicodeBoundRects.push_back( aRect ); } } @@ -378,15 +401,15 @@ BOOL Control::ImplCallEventListenersAndHandler( ULONG nEvent, const Link& rHand void Control::SetLayoutDataParent( const Control* pParent ) const { - if( mpLayoutData ) - mpLayoutData->m_pParent = pParent; + if( HasLayoutData() ) + mpControlData->mpLayoutData->m_pParent = pParent; } // ----------------------------------------------------------------- void Control::ImplClearLayoutData() const { - delete mpLayoutData, mpLayoutData = NULL; + delete mpControlData->mpLayoutData, mpControlData->mpLayoutData = NULL; } // ----------------------------------------------------------------------- @@ -467,3 +490,139 @@ Size Control::GetOptimalSize(WindowSizeType eType) const return Size( LONG_MAX, LONG_MAX ); } } + +// ----------------------------------------------------------------- + +void Control::SetReferenceDevice( OutputDevice* _referenceDevice ) +{ + if ( mpControlData->mpReferenceDevice == _referenceDevice ) + return; + + mpControlData->mpReferenceDevice = _referenceDevice; + Invalidate(); +} + +// ----------------------------------------------------------------- + +OutputDevice* Control::GetReferenceDevice() const +{ + return mpControlData->mpReferenceDevice; +} + +// ----------------------------------------------------------------- + +const Font& Control::GetCanonicalFont( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetLabelFont(); +} + +// ----------------------------------------------------------------- +const Color& Control::GetCanonicalTextColor( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetLabelTextColor(); +} + +// ----------------------------------------------------------------- +void Control::ImplInitSettings( const BOOL _bFont, const BOOL _bForeground ) +{ + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + + if ( _bFont ) + { + Font aFont( GetCanonicalFont( rStyleSettings ) ); + if ( IsControlFont() ) + aFont.Merge( GetControlFont() ); + SetZoomedPointFont( aFont ); + } + + if ( _bForeground || _bFont ) + { + Color aColor; + if ( IsControlForeground() ) + aColor = GetControlForeground(); + else + aColor = GetCanonicalTextColor( rStyleSettings ); + SetTextColor( aColor ); + SetTextFillColor(); + } +} + +// ----------------------------------------------------------------- + +void Control::DrawControlText( OutputDevice& _rTargetDevice, const Rectangle& _rRect, const XubString& _rStr, + USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText ) const +{ + if ( !mpControlData->mpReferenceDevice ) + { + _rTargetDevice.DrawText( _rRect, _rStr, _nStyle, _pVector, _pDisplayText ); + return; + } + + // TODO: + // - respect the style (word break, vert./horz. align, etc.) + // - respect _pVector and _pDisplayText, i.e. fill metric data if they're given + + sal_Int32* pCharWidths = new sal_Int32[ _rStr.Len() ]; + // retrieve unzoomed point font of the target device + Font aFont( GetCanonicalFont( GetSettings().GetStyleSettings() ) ); + + // transfer font to the reference device + mpControlData->mpReferenceDevice->Push( PUSH_FONT ); + Font aRefFont( aFont ); + aRefFont.SetSize( LogicToLogic( + aRefFont.GetSize(), MAP_POINT, mpControlData->mpReferenceDevice->GetMapMode().GetMapUnit() ) ); + mpControlData->mpReferenceDevice->SetFont( aRefFont ); + + // retrieve the character widths from the reference device + mpControlData->mpReferenceDevice->GetTextArray( _rStr, pCharWidths ); + mpControlData->mpReferenceDevice->Pop(); + + // adjust the widths, which are in ref-device units, to the target device + const MapUnit eRefMapUnit( mpControlData->mpReferenceDevice->GetMapMode().GetMapUnit() ); + OSL_ENSURE( eRefMapUnit != MAP_PIXEL, "a reference device with MAP_PIXEL?" ); + + const MapMode& aTargetMapMode( _rTargetDevice.GetMapMode() ); + const MapUnit eTargetMapUnit( aTargetMapMode.GetMapUnit() ); + const bool bTargetIsPixel = ( eTargetMapUnit == MAP_PIXEL ); + { + for ( size_t i=0; i<_rStr.Len(); ++i ) + { + pCharWidths[i] = + bTargetIsPixel + ? _rTargetDevice.LogicToPixel( Size( pCharWidths[i], 0 ), eRefMapUnit ).Width() + : _rTargetDevice.LogicToLogic( Size( pCharWidths[i], 0 ), eRefMapUnit, eTargetMapUnit ).Width(); + } + } + + Point aDrawTextPosition( _rRect.TopLeft() ); + // translate our zoom into a map mode / font / origin at the target device + if ( IsZoom() ) + { + _rTargetDevice.Push( PUSH_MAPMODE | PUSH_FONT ); + + const Fraction& rZoom( GetZoom() ); + + MapMode aDrawMapMode( aTargetMapMode ); + aDrawMapMode.SetScaleX( rZoom ); + aDrawMapMode.SetScaleY( rZoom ); + _rTargetDevice.SetMapMode( aDrawMapMode ); + + Font aDrawFont( aFont ); + if ( bTargetIsPixel ) + aDrawFont.SetSize( _rTargetDevice.LogicToPixel( aDrawFont.GetSize(), MAP_POINT ) ); + else + aDrawFont.SetSize( _rTargetDevice.LogicToLogic( aDrawFont.GetSize(), MAP_POINT, eTargetMapUnit ) ); + _rTargetDevice.SetFont( aDrawFont ); + + aDrawTextPosition.X() = long(aDrawTextPosition.X() / (double)rZoom); + aDrawTextPosition.Y() = long(aDrawTextPosition.Y() / (double)rZoom); + } + + // draw the text + _rTargetDevice.DrawTextArray( aDrawTextPosition, _rStr, pCharWidths ); + + if ( IsZoom() ) + _rTargetDevice.Pop(); + + delete[] pCharWidths; +} diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 5f41a441c6a1..b654e034470f 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include #include @@ -409,7 +409,7 @@ void Edit::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) if ( IsControlFont() ) aFont.Merge( GetControlFont() ); SetZoomedPointFont( aFont ); - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); } if ( bFont || bForeground ) @@ -526,8 +526,8 @@ void Edit::ImplRepaint( xub_StrLen nStart, xub_StrLen nEnd, bool bLayout ) long nPos = nStart ? pDX[2*nStart] : 0; aPos.X() = nPos + mnXOffset + ImplGetExtraOffset(); - MetricVector* pVector = &mpLayoutData->m_aUnicodeBoundRects; - String* pDisplayText = &mpLayoutData->m_aDisplayText; + MetricVector* pVector = &mpControlData->mpLayoutData->m_aUnicodeBoundRects; + String* pDisplayText = &mpControlData->mpLayoutData->m_aDisplayText; DrawText( aPos, aText, nStart, nEnd - nStart, pVector, pDisplayText ); @@ -722,7 +722,7 @@ void Edit::ImplDelete( const Selection& rSelection, BYTE nDirection, BYTE nMode ((rSelection.Max() == aText.Len()) && (nDirection == EDIT_DEL_RIGHT))) ) return; - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); Selection aSelection( rSelection ); aSelection.Justify(); @@ -864,7 +864,7 @@ void Edit::ImplInsertText( const XubString& rStr, const Selection* pNewSel, sal_ rtl::OUString aNewText( ImplGetValidString( rStr ) ); ImplTruncateToMaxLen( aNewText, aSelection.Len() ); - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); if ( aSelection.Len() ) maText.Erase( (xub_StrLen)aSelection.Min(), (xub_StrLen)aSelection.Len() ); @@ -1006,7 +1006,7 @@ void Edit::ImplSetText( const XubString& rText, const Selection* pNewSelection ) // wird, dann InsertText, damit flackerfrei. if ( ( rText.Len() <= mnMaxTextLen ) && ( (rText != maText) || (pNewSelection && (*pNewSelection != maSelection)) ) ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); maSelection.Min() = 0; maSelection.Max() = maText.Len(); if ( mnXOffset || HasPaintEvent() ) @@ -1637,7 +1637,7 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) { if ( !rKEvt.GetKeyCode().IsMod2() ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); uno::Reference < i18n::XBreakIterator > xBI = ImplGetBreakIterator(); Selection aSel( maSelection ); @@ -1858,7 +1858,7 @@ void Edit::KeyInput( const KeyEvent& rKEvt ) void Edit::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast(this)->ImplRepaint( 0, STRING_LEN, true ); } @@ -2648,7 +2648,7 @@ void Edit::ImplSetSelection( const Selection& rSelection, BOOL bPaint ) if ( aNew != maSelection ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); maSelection = aNew; if ( bPaint && ( aOld.Len() || aNew.Len() || IsPaintTransparent() ) ) diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index 530e928532e1..4b081c57e188 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include @@ -109,40 +109,25 @@ WinBits FixedText::ImplInitStyle( WinBits nStyle ) return nStyle; } +// ----------------------------------------------------------------- + +const Font& FixedText::GetCanonicalFont( const StyleSettings& _rStyle ) const +{ + return ( GetStyle() & WB_INFO ) ? _rStyle.GetInfoFont() : _rStyle.GetLabelFont(); +} + +// ----------------------------------------------------------------- +const Color& FixedText::GetCanonicalTextColor( const StyleSettings& _rStyle ) const +{ + return ( GetStyle() & WB_INFO ) ? _rStyle.GetInfoTextColor() : _rStyle.GetLabelTextColor(); +} + // ----------------------------------------------------------------------- void FixedText::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if ( bFont ) - { - Font aFont; - if ( GetStyle() & WB_INFO ) - aFont = rStyleSettings.GetInfoFont(); - else - aFont = rStyleSettings.GetLabelFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); - } - - if ( bForeground || bFont ) - { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - { - if ( GetStyle() & WB_INFO ) - aColor = rStyleSettings.GetInfoTextColor(); - else - aColor = rStyleSettings.GetLabelTextColor(); - } - SetTextColor( aColor ); - SetTextFillColor(); - } + Control::ImplInitSettings( bFont, bForeground ); if ( bBackground ) { @@ -278,17 +263,12 @@ void FixedText::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, nTextStyle |= TEXT_DRAW_MONO; if( bFillLayout ) - { - mpLayoutData->m_aDisplayText = String(); - pDev->DrawText( Rectangle( aPos, rSize ), - aText, - nTextStyle, - &mpLayoutData->m_aUnicodeBoundRects, - &mpLayoutData->m_aDisplayText - ); - } - else - pDev->DrawText( Rectangle( aPos, rSize ), aText, nTextStyle ); + mpControlData->mpLayoutData->m_aDisplayText = String(); + + DrawControlText( *pDev, Rectangle( aPos, rSize ), aText, nTextStyle, + bFillLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL, + bFillLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL + ); } // ----------------------------------------------------------------------- @@ -446,7 +426,7 @@ Size FixedText::GetOptimalSize(WindowSizeType eType) const void FixedText::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); ImplDraw( const_cast(this), 0, Point(), GetOutputSizePixel(), true ); } @@ -468,31 +448,25 @@ WinBits FixedLine::ImplInitStyle( WinBits nStyle ) return nStyle; } +// ----------------------------------------------------------------- + +const Font& FixedLine::GetCanonicalFont( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetGroupFont(); +} + +// ----------------------------------------------------------------- +const Color& FixedLine::GetCanonicalTextColor( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetGroupTextColor(); +} + // ----------------------------------------------------------------------- void FixedLine::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if ( bFont ) - { - Font aFont = rStyleSettings.GetGroupFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); - } - - if ( bForeground || bFont ) - { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetGroupTextColor(); - SetTextColor( aColor ); - SetTextFillColor(); - } + Control::ImplInitSettings( bFont, bForeground ); if ( bBackground ) { @@ -526,8 +500,8 @@ void FixedLine::ImplDraw( bool bLayout ) String aText = GetText(); const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); WinBits nWinStyle = GetStyle(); - MetricVector* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL; - String* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL; + MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; + String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO ) SetLineColor( Color( COL_BLACK ) ); @@ -575,7 +549,7 @@ void FixedLine::ImplDraw( bool bLayout ) nStyle |= TEXT_DRAW_MONO; aRect = GetTextRect( aRect, aText, nStyle ); - DrawText( aRect, aText, nStyle, pVector, pDisplayText ); + DrawControlText( *this, aRect, aText, nStyle, pVector, pDisplayText ); if( !pVector ) { @@ -617,7 +591,7 @@ FixedLine::FixedLine( Window* pParent, const ResId& rResId ) : void FixedLine::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast(this)->ImplDraw( true ); } diff --git a/vcl/source/control/group.cxx b/vcl/source/control/group.cxx index a844c2f2eb93..4adc91f88d84 100644 --- a/vcl/source/control/group.cxx +++ b/vcl/source/control/group.cxx @@ -32,7 +32,7 @@ #include "precompiled_vcl.hxx" #include #include -#include +#include #ifndef _SV_RC_H #include @@ -66,31 +66,25 @@ WinBits GroupBox::ImplInitStyle( WinBits nStyle ) return nStyle; } +// ----------------------------------------------------------------- + +const Font& GroupBox::GetCanonicalFont( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetGroupFont(); +} + +// ----------------------------------------------------------------- +const Color& GroupBox::GetCanonicalTextColor( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetGroupTextColor(); +} + // ----------------------------------------------------------------------- void GroupBox::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if ( bFont ) - { - Font aFont = rStyleSettings.GetGroupFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); - } - - if ( bForeground || bFont ) - { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetGroupTextColor(); - SetTextColor( aColor ); - SetTextFillColor(); - } + Control::ImplInitSettings( bFont, bForeground ); if ( bBackground ) { @@ -227,16 +221,16 @@ void GroupBox::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, } } - MetricVector* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL; - String* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL; - pDev->DrawText( aRect, aText, nTextStyle, pVector, pDisplayText ); + MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; + String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; + DrawControlText( *pDev, aRect, aText, nTextStyle, pVector, pDisplayText ); } // ----------------------------------------------------------------------- void GroupBox::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast(this)-> ImplDraw( const_cast(this), 0, Point(), GetOutputSizePixel(), true ); } diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index a25ddbb68e8b..597b9bc3a874 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #ifndef _COM_SUN_STAR_UTIL_XCOLLATOR_HPP_ #include @@ -647,7 +647,7 @@ void ImplListBoxWindow::Clear() mnTop = 0; mnLeft = 0; mbImgsDiffSz = FALSE; - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; @@ -656,7 +656,7 @@ void ImplListBoxWindow::Clear() void ImplListBoxWindow::SetUserItemSize( const Size& rSz ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); maUserItemSize = rSz; ImplCalcMetrics(); } @@ -778,7 +778,7 @@ void ImplListBoxWindow::ImplCallSelect() nMRUCount--; } - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); ImplEntryType* pNewEntry = new ImplEntryType( aSelected ); pNewEntry->mbIsSelected = bSelectNewEntry; @@ -798,7 +798,7 @@ void ImplListBoxWindow::ImplCallSelect() USHORT ImplListBoxWindow::InsertEntry( USHORT nPos, ImplEntryType* pNewEntry ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); USHORT nNewPos = mpEntryList->InsertEntry( nPos, pNewEntry, mbSort ); if( (GetStyle() & WB_WORDBREAK) ) @@ -812,7 +812,7 @@ USHORT ImplListBoxWindow::InsertEntry( USHORT nPos, ImplEntryType* pNewEntry ) void ImplListBoxWindow::RemoveEntry( USHORT nPos ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); mpEntryList->RemoveEntry( nPos ); if( mnCurrentPos >= mpEntryList->GetEntryCount() ) mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; @@ -1062,7 +1062,7 @@ void ImplListBoxWindow::SelectEntry( USHORT nPos, BOOL bSelect ) ImplPaint( nPos ); if ( !IsVisible( nPos ) ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); USHORT nVisibleEntries = GetLastVisibleEntry()-mnTop; if ( !nVisibleEntries || !IsReallyVisible() || ( nPos < GetTopEntry() ) ) { @@ -1233,7 +1233,7 @@ BOOL ImplListBoxWindow::SelectEntries( USHORT nSelect, LB_EVENT_TYPE eLET, BOOL if( HasFocus() ) ImplShowFocusRect(); } - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); } return bSelectionChanged; } @@ -1838,8 +1838,8 @@ void ImplListBoxWindow::DrawEntry( USHORT nPos, BOOL bDrawImage, BOOL bDrawText, if( bDrawText ) { - MetricVector* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL; - String* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL; + MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; + String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; XubString aStr( mpEntryList->GetEntryText( nPos ) ); if ( aStr.Len() ) { @@ -1859,7 +1859,7 @@ void ImplListBoxWindow::DrawEntry( USHORT nPos, BOOL bDrawImage, BOOL bDrawText, } if( bLayout ) - mpLayoutData->m_aLineIndices.push_back( mpLayoutData->m_aDisplayText.Len() ); + mpControlData->mpLayoutData->m_aLineIndices.push_back( mpControlData->mpLayoutData->m_aDisplayText.Len() ); // pb: #106948# explicit mirroring for calc if ( mbMirroring ) @@ -1900,7 +1900,7 @@ void ImplListBoxWindow::DrawEntry( USHORT nPos, BOOL bDrawImage, BOOL bDrawText, void ImplListBoxWindow::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast(this)-> ImplDoPaint( Rectangle( Point( 0, 0 ), GetOutputSize() ), true ); } @@ -1978,7 +1978,7 @@ void ImplListBoxWindow::Resize() if ( bShowFocusRect ) ImplShowFocusRect(); - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); } // ----------------------------------------------------------------------- @@ -2034,7 +2034,7 @@ void ImplListBoxWindow::SetTopEntry( USHORT nTop ) if ( nTop != mnTop ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); long nDiff = mpEntryList->GetAddedHeight( mnTop, nTop, 0 ); Update(); ImplHideFocusRect(); @@ -2078,7 +2078,7 @@ void ImplListBoxWindow::ScrollHorz( long n ) if ( nDiff ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); mnLeft = sal::static_int_cast(mnLeft + nDiff); Update(); ImplHideFocusRect(); @@ -2148,7 +2148,7 @@ void ImplListBoxWindow::StateChanged( StateChangedType nType ) ImplInitSettings( FALSE, FALSE, TRUE ); Invalidate(); } - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); } // ----------------------------------------------------------------------- @@ -2162,7 +2162,7 @@ void ImplListBoxWindow::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); ImplInitSettings( TRUE, TRUE, TRUE ); ImplCalcMetrics(); Invalidate(); @@ -2743,7 +2743,7 @@ void ImplWin::MouseButtonDown( const MouseEvent& ) void ImplWin::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast(this)->ImplDraw( true ); } @@ -2951,8 +2951,8 @@ void ImplWin::DrawEntry( BOOL bDrawImage, BOOL bDrawText, BOOL bDrawTextAtImageP aTextRect.Left() += nMaxWidth + IMG_TXT_DISTANCE; } - MetricVector* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL; - String* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL; + MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; + String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; DrawText( aTextRect, maString, nTextStyle, pVector, pDisplayText ); } diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx index a5e9ff1cc7d0..15bd56ae4e98 100644 --- a/vcl/source/control/lstbox.cxx +++ b/vcl/source/control/lstbox.cxx @@ -43,7 +43,7 @@ #include "vcl/ilstbox.hxx" #include "vcl/lstbox.hxx" #include "vcl/combobox.hxx" -#include "vcl/controllayout.hxx" +#include "vcl/controldata.hxx" #include "tools/debug.hxx" @@ -717,7 +717,7 @@ void ListBox::Resize() void ListBox::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const Control* pMainWin = mpImplLB->GetMainWindow(); if( mpFloatWin ) { @@ -741,7 +741,7 @@ void ListBox::FillLayoutData() const long ListBox::GetIndexForPoint( const Point& rPoint, USHORT& rPos ) const { - if( ! mpLayoutData ) + if( !HasLayoutData() ) FillLayoutData(); // check whether rPoint fits at all diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index 0d656da40ba7..1cdaa39298df 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -36,7 +36,7 @@ #include "vcl/decoview.hxx" #include "vcl/spin.h" #include "vcl/spinfld.hxx" -#include "vcl/controllayout.hxx" +#include "vcl/controldata.hxx" #include "vcl/svdata.hxx" // ======================================================================= @@ -637,7 +637,7 @@ void SpinField::FillLayoutData() const { if( mbSpin ) { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); AppendLayoutData( *GetSubEdit() ); GetSubEdit()->SetLayoutDataParent( this ); } diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 561d550b1168..9a34629ddf8e 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include @@ -169,31 +169,25 @@ void TabControl::ImplInit( Window* pParent, WinBits nStyle ) EnableChildTransparentMode( TRUE ); } +// ----------------------------------------------------------------- + +const Font& TabControl::GetCanonicalFont( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetAppFont(); +} + +// ----------------------------------------------------------------- +const Color& TabControl::GetCanonicalTextColor( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetButtonTextColor(); +} + // ----------------------------------------------------------------------- void TabControl::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if ( bFont ) - { - Font aFont = rStyleSettings.GetAppFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); - } - - if ( bForeground || bFont ) - { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetButtonTextColor(); - SetTextColor( aColor ); - SetTextFillColor(); - } + Control::ImplInitSettings( bFont, bForeground ); if ( bBackground ) { @@ -232,9 +226,9 @@ void TabControl::ImplInitSettings( BOOL bFont, void TabControl::ImplFreeLayoutData() { - if( mpLayoutData ) + if( HasLayoutData() ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); mpTabCtrlData->maLayoutPageIdToLine.clear(); mpTabCtrlData->maLayoutLineToPageId.clear(); } @@ -864,9 +858,9 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bo if( bLayout ) { - if( ! mpLayoutData ) + if( !HasLayoutData() ) { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); mpTabCtrlData->maLayoutLineToPageId.clear(); mpTabCtrlData->maLayoutPageIdToLine.clear(); mpTabCtrlData->maTabRectangles.clear(); @@ -1010,8 +1004,8 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bo if( bLayout ) { - int nLine = mpLayoutData->m_aLineIndices.size(); - mpLayoutData->m_aLineIndices.push_back( mpLayoutData->m_aDisplayText.Len() ); + int nLine = mpControlData->mpLayoutData->m_aLineIndices.size(); + mpControlData->mpLayoutData->m_aLineIndices.push_back( mpControlData->mpLayoutData->m_aDisplayText.Len() ); mpTabCtrlData->maLayoutPageIdToLine[ (int)pItem->mnId ] = nLine; mpTabCtrlData->maLayoutLineToPageId[ nLine ] = (int)pItem->mnId; mpTabCtrlData->maTabRectangles.push_back( aRect ); @@ -1044,8 +1038,8 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bo DrawCtrlText( Point( nXPos + aImageSize.Width(), nYPos ), pItem->maFormatText, 0, STRING_LEN, nStyle, - bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL, - bLayout ? &mpLayoutData->m_aDisplayText : NULL + bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL, + bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL ); } @@ -2108,17 +2102,17 @@ Rectangle TabControl::GetCharacterBounds( USHORT nPageId, long nIndex ) const { Rectangle aRet; - if( ! mpLayoutData || ! mpTabCtrlData->maLayoutPageIdToLine.size() ) + if( !HasLayoutData() || ! mpTabCtrlData->maLayoutPageIdToLine.size() ) FillLayoutData(); - if( mpLayoutData ) + if( HasLayoutData() ) { std::hash_map< int, int >::const_iterator it = mpTabCtrlData->maLayoutPageIdToLine.find( (int)nPageId ); if( it != mpTabCtrlData->maLayoutPageIdToLine.end() ) { - Pair aPair = mpLayoutData->GetLineStartEnd( it->second ); + Pair aPair = mpControlData->mpLayoutData->GetLineStartEnd( it->second ); if( (aPair.B() - aPair.A()) >= nIndex ) - aRet = mpLayoutData->GetCharacterBounds( aPair.A() + nIndex ); + aRet = mpControlData->mpLayoutData->GetCharacterBounds( aPair.A() + nIndex ); } } @@ -2131,20 +2125,20 @@ long TabControl::GetIndexForPoint( const Point& rPoint, USHORT& rPageId ) const { long nRet = -1; - if( ! mpLayoutData || ! mpTabCtrlData->maLayoutPageIdToLine.size() ) + if( !HasLayoutData() || ! mpTabCtrlData->maLayoutPageIdToLine.size() ) FillLayoutData(); - if( mpLayoutData ) + if( HasLayoutData() ) { - int nIndex = mpLayoutData->GetIndexForPoint( rPoint ); + int nIndex = mpControlData->mpLayoutData->GetIndexForPoint( rPoint ); if( nIndex != -1 ) { // what line (->pageid) is this index in ? - int nLines = mpLayoutData->GetLineCount(); + int nLines = mpControlData->mpLayoutData->GetLineCount(); int nLine = -1; while( ++nLine < nLines ) { - Pair aPair = mpLayoutData->GetLineStartEnd( nLine ); + Pair aPair = mpControlData->mpLayoutData->GetLineStartEnd( nLine ); if( aPair.A() <= nIndex && aPair.B() >= nIndex ) { nRet = nIndex - aPair.A(); @@ -2173,10 +2167,10 @@ Rectangle TabControl::GetTabPageBounds( USHORT nPage ) const { Rectangle aRet; - if( ! mpLayoutData || ! mpTabCtrlData->maLayoutPageIdToLine.size() ) + if( !HasLayoutData() || ! mpTabCtrlData->maLayoutPageIdToLine.size() ) FillLayoutData(); - if( mpLayoutData ) + if( HasLayoutData() ) { std::hash_map< int, int >::const_iterator it = mpTabCtrlData->maLayoutPageIdToLine.find( (int)nPage ); if( it != mpTabCtrlData->maLayoutPageIdToLine.end() ) diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 5333d20d4306..92cb4b5233cf 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -9742,6 +9742,8 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP EnableOutput(); DBG_ASSERT( GetMapMode().GetMapUnit() == MAP_PIXEL, "MapMode must be PIXEL based" ); + if ( GetMapMode().GetMapUnit() != MAP_PIXEL ) + return; // preserve graphicsstate Push(); -- cgit From f7124d57bc10b6e2960c86c4384a671ad7b4de02 Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Mon, 14 Sep 2009 12:15:57 +0000 Subject: #cr6875455# mpLayoutData not directly accessible anymore --- svtools/source/contnr/ivctrl.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/svtools/source/contnr/ivctrl.cxx b/svtools/source/contnr/ivctrl.cxx index c0f40fd306df..e3342e288ae0 100644 --- a/svtools/source/contnr/ivctrl.cxx +++ b/svtools/source/contnr/ivctrl.cxx @@ -579,8 +579,7 @@ Rectangle SvtIconChoiceCtrl::GetBoundingBox( SvxIconChoiceCtrlEntry* pEntry ) co void SvtIconChoiceCtrl::FillLayoutData() const { - DBG_ASSERT( !mpLayoutData, "SvtIconChoiceCtrl::FillLayoutData: shouldn't this be called with non-existent layout data only?" ); - mpLayoutData = new ::vcl::ControlLayoutData(); + CreateLayoutData(); SvtIconChoiceCtrl* pNonConstMe = const_cast< SvtIconChoiceCtrl* >( this ); @@ -598,7 +597,7 @@ void SvtIconChoiceCtrl::FillLayoutData() const sal_Bool bLargeIconMode = WB_ICON == ( _pImp->GetStyle() & ( VIEWMODE_MASK ) ); sal_uInt16 nTextPaintFlags = bLargeIconMode ? PAINTFLAG_HOR_CENTERED : PAINTFLAG_VER_CENTERED; - _pImp->PaintItem( aTextRect, IcnViewFieldTypeText, pEntry, nTextPaintFlags, pNonConstMe, &sEntryText, mpLayoutData ); + _pImp->PaintItem( aTextRect, IcnViewFieldTypeText, pEntry, nTextPaintFlags, pNonConstMe, &sEntryText, GetLayoutData() ); ++nPos; } -- cgit From a3100ff384a815e3088fc9ab5b43c3e5ff701cc3 Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Mon, 14 Sep 2009 12:27:12 +0000 Subject: #cr6875455# introduce a ReferenceDevice property for various control types --- toolkit/inc/toolkit/helper/property.hxx | 1 + toolkit/source/awt/vclxwindow.cxx | 26 ++++++++++++++++++++++++++ toolkit/source/awt/vclxwindows.cxx | 6 ++++++ toolkit/source/controls/unocontrolmodel.cxx | 7 ++++++- toolkit/source/helper/property.cxx | 15 +++++++++------ 5 files changed, 48 insertions(+), 7 deletions(-) diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx index fbfe90494279..f82df1f5b53f 100644 --- a/toolkit/inc/toolkit/helper/property.hxx +++ b/toolkit/inc/toolkit/helper/property.hxx @@ -197,6 +197,7 @@ namespace rtl { #define BASEPROPERTY_GRID_COLUMNMODEL 143 #define BASEPROPERTY_GRID_SELECTIONMODE 144 #define BASEPROPERTY_ENABLEVISIBLE 145 // sal_Bool +#define BASEPROPERTY_REFERENCE_DEVICE 146 // Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen. diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index 337400c08713..93486d86e739 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -64,6 +64,7 @@ #include #include #include +#include #include #include @@ -76,6 +77,7 @@ using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::lang::EventObject; using ::com::sun::star::awt::XWindowListener2; using ::com::sun::star::awt::XDockableWindowListener; +using ::com::sun::star::awt::XDevice; using ::com::sun::star::style::VerticalAlignment; using ::com::sun::star::style::VerticalAlignment_TOP; using ::com::sun::star::style::VerticalAlignment_MIDDLE; @@ -1639,6 +1641,19 @@ void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com:: sal_uInt16 nPropType = GetPropertyId( PropertyName ); switch ( nPropType ) { + case BASEPROPERTY_REFERENCE_DEVICE: + { + // TODO: at the moment, the refdevice is hackily implemented for Button and derived classes only + Control* pControl = dynamic_cast< Control* >( pWindow ); + OSL_ENSURE( pControl, "VCLXWindow::setProperty( RefDevice ): need a Control for this!" ); + if ( !pControl ) + break; + Reference< XDevice > xDevice( Value, UNO_QUERY ); + OutputDevice* pDevice = VCLUnoHelper::GetOutputDevice( xDevice ); + pControl->SetReferenceDevice( pDevice ); + } + break; + case BASEPROPERTY_CONTEXT_WRITING_MODE: { OSL_VERIFY( Value >>= mpImpl->mnContextWritingMode ); @@ -2157,6 +2172,17 @@ void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com:: sal_uInt16 nPropType = GetPropertyId( PropertyName ); switch ( nPropType ) { + case BASEPROPERTY_REFERENCE_DEVICE: + { + // TODO: at the moment, the refdevice is hackily implemented for Button and derived classes only + Button* pButton = dynamic_cast< Button* >( GetWindow() ); + if ( !pButton ) + break; + + // TODO: hmm ... it seems there is no way to query an OutputDevice for its XDevice ...? + } + break; + case BASEPROPERTY_CONTEXT_WRITING_MODE: aProp <<= mpImpl->mnContextWritingMode; break; diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index b49fa1a621d6..ff5dd437ef52 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -408,6 +408,7 @@ void VCLXButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_VERTICALALIGN, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, + BASEPROPERTY_REFERENCE_DEVICE, 0); VCLXImageConsumer::ImplGetPropertyIds( rIds ); } @@ -817,6 +818,7 @@ void VCLXCheckBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_VERTICALALIGN, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, + BASEPROPERTY_REFERENCE_DEVICE, 0); VCLXImageConsumer::ImplGetPropertyIds( rIds ); } @@ -1116,6 +1118,7 @@ void VCLXRadioButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_VERTICALALIGN, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, + BASEPROPERTY_REFERENCE_DEVICE, 0); VCLXImageConsumer::ImplGetPropertyIds( rIds ); } @@ -1540,6 +1543,7 @@ void VCLXListBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_ALIGN, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, + BASEPROPERTY_REFERENCE_DEVICE, BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, 0); VCLXWindow::ImplGetPropertyIds( rIds ); @@ -2759,6 +2763,7 @@ void VCLXFixedText::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_VERTICALALIGN, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, + BASEPROPERTY_REFERENCE_DEVICE, 0); VCLXWindow::ImplGetPropertyIds( rIds ); } @@ -3762,6 +3767,7 @@ void VCLXComboBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_ALIGN, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, + BASEPROPERTY_REFERENCE_DEVICE, BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, 0); // no, don't call VCLXEdit here - it has properties which we do *not* want to have at at combo box diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index cc5faa27eec8..a4febcd33b33 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -262,7 +263,11 @@ void UnoControlModel::ImplPropertyChanged( sal_uInt16 ) switch ( nPropId ) { case BASEPROPERTY_GRAPHIC: - aDefault <<= makeAny( Reference< graphic::XGraphic >() ); + aDefault <<= Reference< graphic::XGraphic >(); + break; + + case BASEPROPERTY_REFERENCE_DEVICE: + aDefault <<= Reference< awt::XDevice >(); break; case BASEPROPERTY_VERTICALALIGN: diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx index e71c03bae47d..a59af95a2e1f 100644 --- a/toolkit/source/helper/property.cxx +++ b/toolkit/source/helper/property.cxx @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -65,6 +66,7 @@ using ::com::sun::star::uno::Any; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Reference; +using ::com::sun::star::awt::XDevice; using ::com::sun::star::awt::FontDescriptor; using ::com::sun::star::style::VerticalAlignment; @@ -275,12 +277,13 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_PROP_2 ( "URL", URL, ::rtl::OUString, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "WritingMode", WRITING_MODE, sal_Int16, BOUND, MAYBEDEFAULT ), DECL_PROP_3 ( "ContextWritingMode", CONTEXT_WRITING_MODE, sal_Int16, BOUND, MAYBEDEFAULT, TRANSIENT ), - DECL_PROP_2 ( "ShowRowHeader", GRID_SHOWROWHEADER, sal_Bool, BOUND, MAYBEDEFAULT ), - DECL_PROP_2 ( "ShowColumnHeader", GRID_SHOWCOLUMNHEADER, sal_Bool, BOUND, MAYBEDEFAULT ), - DECL_PROP_3 ( "GridDataModel", GRID_DATAMODEL, Reference< ::com::sun::star::awt::grid::XGridDataModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ), - DECL_PROP_3 ( "ColumnModel", GRID_COLUMNMODEL, Reference< ::com::sun::star::awt::grid::XGridColumnModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ), - DECL_PROP_3 ( "SelectionModel", GRID_SELECTIONMODE, ::com::sun::star::view::SelectionType, BOUND, MAYBEDEFAULT, MAYBEVOID ), - DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT ) + DECL_PROP_2 ( "ShowRowHeader", GRID_SHOWROWHEADER, sal_Bool, BOUND, MAYBEDEFAULT ), + DECL_PROP_2 ( "ShowColumnHeader", GRID_SHOWCOLUMNHEADER, sal_Bool, BOUND, MAYBEDEFAULT ), + DECL_PROP_3 ( "GridDataModel", GRID_DATAMODEL, Reference< ::com::sun::star::awt::grid::XGridDataModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ), + DECL_PROP_3 ( "ColumnModel", GRID_COLUMNMODEL, Reference< ::com::sun::star::awt::grid::XGridColumnModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ), + DECL_PROP_3 ( "SelectionModel", GRID_SELECTIONMODE, ::com::sun::star::view::SelectionType, BOUND, MAYBEDEFAULT, MAYBEVOID ), + DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT ), + DECL_PROP_3 ( "ReferenceDevice", REFERENCE_DEVICE, Reference< XDevice >,BOUND, MAYBEDEFAULT, TRANSIENT ) }; pPropertyInfos = aImplPropertyInfos; nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo ); -- cgit From 991fe0b57982f61962d56347f3bf4c9b053818c2 Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Mon, 14 Sep 2009 12:41:56 +0000 Subject: #b6875455# impl-data for Control instances --- vcl/inc/vcl/controldata.hxx | 60 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 vcl/inc/vcl/controldata.hxx diff --git a/vcl/inc/vcl/controldata.hxx b/vcl/inc/vcl/controldata.hxx new file mode 100644 index 000000000000..9ea698e792bd --- /dev/null +++ b/vcl/inc/vcl/controldata.hxx @@ -0,0 +1,60 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* 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 +* +* for a copy of the LGPLv3 License. +************************************************************************/ + +#ifndef VCL_CONTROLDATA_HXX +#define VCL_CONTROLDATA_HXX + +#include + +//........................................................................ +namespace vcl +{ +//........................................................................ + + //==================================================================== + //= ImplControlData + //==================================================================== + struct ImplControlData + { + mutable ControlLayoutData* mpLayoutData; + OutputDevice* mpReferenceDevice; + + ImplControlData() + :mpLayoutData( NULL ) + ,mpReferenceDevice( NULL ) + { + } + + ~ImplControlData() + { + delete mpLayoutData; + } + }; + +//........................................................................ +} // namespace vcl +//........................................................................ + +#endif // VCL_CONTROLDATA_HXX -- cgit From 6152b5efa3490cc8f09f269dc7542ffe3833358c Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Mon, 14 Sep 2009 19:06:55 +0200 Subject: #i103496#: split cppunit in a pure external lib and a lib depending on sal -> testshl2 --- basebmp/test/basictest.cxx | 2 +- basebmp/test/bmpmasktest.cxx | 2 +- basebmp/test/bmptest.cxx | 2 +- basebmp/test/cliptest.cxx | 2 +- basebmp/test/filltest.cxx | 2 +- basebmp/test/linetest.cxx | 2 +- basebmp/test/makefile.mk | 17 +++++++++-------- basebmp/test/masktest.cxx | 2 +- basebmp/test/polytest.cxx | 2 +- basegfx/test/basegfx1d.cxx | 2 +- basegfx/test/basegfx2d.cxx | 2 +- basegfx/test/basegfx3d.cxx | 2 +- basegfx/test/makefile.mk | 11 ++++++----- comphelper/qa/makefile.mk | 6 +++--- comphelper/qa/test_string.cxx | 2 +- comphelper/qa/test_weakbag.cxx | 2 +- o3tl/qa/makefile.mk | 3 ++- o3tl/qa/test-cow_wrapper.cxx | 2 +- o3tl/qa/test-heap_ptr.cxx | 2 +- o3tl/qa/test-range.cxx | 2 +- svtools/qa/makefile.mk | 19 ++++++++++--------- svtools/qa/test_URIHelper.cxx | 2 +- tools/qa/makefile.mk | 4 ++-- tools/qa/test_pathutils.cxx | 2 +- tools/test/makefile.mk | 9 +++++---- tools/test/tests.cxx | 2 +- 26 files changed, 56 insertions(+), 51 deletions(-) diff --git a/basebmp/test/basictest.cxx b/basebmp/test/basictest.cxx index 15d2da39851a..d4d836a4b553 100644 --- a/basebmp/test/basictest.cxx +++ b/basebmp/test/basictest.cxx @@ -30,7 +30,7 @@ // autogenerated file with codegen.pl -#include +#include #include #include diff --git a/basebmp/test/bmpmasktest.cxx b/basebmp/test/bmpmasktest.cxx index afadcad3b3fb..1b9e4ca0c68f 100644 --- a/basebmp/test/bmpmasktest.cxx +++ b/basebmp/test/bmpmasktest.cxx @@ -30,7 +30,7 @@ // autogenerated file with codegen.pl -#include +#include #include #include diff --git a/basebmp/test/bmptest.cxx b/basebmp/test/bmptest.cxx index 33ed58c25402..978c4bbe6243 100644 --- a/basebmp/test/bmptest.cxx +++ b/basebmp/test/bmptest.cxx @@ -30,7 +30,7 @@ // autogenerated file with codegen.pl -#include +#include #include #include diff --git a/basebmp/test/cliptest.cxx b/basebmp/test/cliptest.cxx index 2172b0b667a7..41da8cac617a 100644 --- a/basebmp/test/cliptest.cxx +++ b/basebmp/test/cliptest.cxx @@ -30,7 +30,7 @@ // autogenerated file with codegen.pl -#include +#include #include #include diff --git a/basebmp/test/filltest.cxx b/basebmp/test/filltest.cxx index fcc4e5df5fa3..ba25cfa9044e 100644 --- a/basebmp/test/filltest.cxx +++ b/basebmp/test/filltest.cxx @@ -30,7 +30,7 @@ // autogenerated file with codegen.pl -#include +#include #include #include diff --git a/basebmp/test/linetest.cxx b/basebmp/test/linetest.cxx index 1a424864f893..b78175128eba 100644 --- a/basebmp/test/linetest.cxx +++ b/basebmp/test/linetest.cxx @@ -30,7 +30,7 @@ // autogenerated file with codegen.pl -#include +#include #include #include diff --git a/basebmp/test/makefile.mk b/basebmp/test/makefile.mk index 7d0dc6e3967a..4e3384b935a6 100644 --- a/basebmp/test/makefile.mk +++ b/basebmp/test/makefile.mk @@ -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 @@ -57,7 +57,7 @@ CFLAGS += -fno-inline # SunStudio 12 (-m64 and -m32 modes): three test cases of the unit tests fail # if compiled with default -xalias_level (and optimization level -xO3) -.IF "$(OS)"=="SOLARIS" +.IF "$(OS)"=="SOLARIS" # For Sun Studio 8 this switch does not work: compilation fails on bitmapdevice.cxx .IF "$(CCNUMVER)"!="00050005" CDEFS+=-xalias_level=compatible @@ -67,7 +67,7 @@ CDEFS+=-xalias_level=compatible # --- Common ---------------------------------------------------------- # BEGIN ---------------------------------------------------------------- -# auto generated Target:tests by codegen.pl +# auto generated Target:tests by codegen.pl SHL1OBJS= \ $(SLO)$/basictest.obj \ $(SLO)$/bmpmasktest.obj \ @@ -88,13 +88,14 @@ SHL1OBJS= \ SHL1TARGET= tests SHL1STDLIBS= $(SALLIB) \ + $(TESTSHL2LIB)\ $(CPPUNITLIB) \ - $(BASEGFXLIB) + $(BASEGFXLIB) SHL1IMPLIB= i$(SHL1TARGET) DEF1NAME =$(SHL1TARGET) -SHL1VERSIONMAP = export.map +SHL1VERSIONMAP = export.map # END ------------------------------------------------------------------ @@ -111,7 +112,7 @@ SHL1VERSIONMAP = export.map # $(CPPUHELPERLIB) \ # $(UCBHELPERLIB) \ # $(SALLIB) \ -# $(VCLLIB) +# $(VCLLIB) # #.IF "$(GUI)"!="UNX" #APP2DEF= $(MISC)$/$(TARGET).def @@ -119,12 +120,12 @@ SHL1VERSIONMAP = export.map #------------------------------- All object files ------------------------------- # do this here, so we get right dependencies -SLOFILES=$(SHL1OBJS) +SLOFILES=$(SHL1OBJS) # --- Targets ------------------------------------------------------ .INCLUDE : target.mk -.INCLUDE : _cppunit.mk +.INCLUDE : _cppunit.mk # --- Enable test execution in normal build ------------------------ diff --git a/basebmp/test/masktest.cxx b/basebmp/test/masktest.cxx index 61f329f094f2..94e5bc42a5ea 100644 --- a/basebmp/test/masktest.cxx +++ b/basebmp/test/masktest.cxx @@ -30,7 +30,7 @@ // autogenerated file with codegen.pl -#include +#include #include #include diff --git a/basebmp/test/polytest.cxx b/basebmp/test/polytest.cxx index e35c8c834bd9..da118e4b6d8a 100644 --- a/basebmp/test/polytest.cxx +++ b/basebmp/test/polytest.cxx @@ -30,7 +30,7 @@ // autogenerated file with codegen.pl -#include +#include #include #include diff --git a/basegfx/test/basegfx1d.cxx b/basegfx/test/basegfx1d.cxx index f058b0034fa7..454ed23289b2 100644 --- a/basegfx/test/basegfx1d.cxx +++ b/basegfx/test/basegfx1d.cxx @@ -33,7 +33,7 @@ #include "precompiled_basegfx.hxx" // autogenerated file with codegen.pl -#include +#include namespace basegfx1d { diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx index 8b732e465a51..8f3e340729a2 100644 --- a/basegfx/test/basegfx2d.cxx +++ b/basegfx/test/basegfx2d.cxx @@ -33,7 +33,7 @@ #include "precompiled_basegfx.hxx" // autogenerated file with codegen.pl -#include +#include #include #include diff --git a/basegfx/test/basegfx3d.cxx b/basegfx/test/basegfx3d.cxx index fc59ffbced4e..f0fe463ce23d 100644 --- a/basegfx/test/basegfx3d.cxx +++ b/basegfx/test/basegfx3d.cxx @@ -33,7 +33,7 @@ #include "precompiled_basegfx.hxx" // autogenerated file with codegen.pl -#include +#include namespace basegfx3d { diff --git a/basegfx/test/makefile.mk b/basegfx/test/makefile.mk index 8e47a13defdd..d21093f4e08a 100644 --- a/basegfx/test/makefile.mk +++ b/basegfx/test/makefile.mk @@ -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 @@ -46,7 +46,7 @@ SHL1OBJS= \ $(SLO)$/basegfx1d.obj \ $(SLO)$/basegfx2d.obj \ $(SLO)$/basegfx3d.obj \ - $(SLO)$/testtools.obj + $(SLO)$/testtools.obj # linking statically against basegfx parts SHL1LIBS=\ @@ -65,23 +65,24 @@ SHL1STDLIBS= \ $(SALLIB) \ $(CPPUHELPERLIB) \ $(CPPULIB) \ + $(TESTSHL2LIB) \ $(CPPUNITLIB) SHL1IMPLIB= i$(SHL1TARGET) DEF1NAME =$(SHL1TARGET) -SHL1VERSIONMAP = export.map +SHL1VERSIONMAP = export.map # END ------------------------------------------------------------------ #------------------------------- All object files ------------------------------- # do this here, so we get right dependencies -SLOFILES=$(SHL1OBJS) +SLOFILES=$(SHL1OBJS) # --- Targets ------------------------------------------------------ .INCLUDE : target.mk -.INCLUDE : _cppunit.mk +.INCLUDE : _cppunit.mk # --- Enable testshl2 execution in normal build ------------------------ diff --git a/comphelper/qa/makefile.mk b/comphelper/qa/makefile.mk index cfc597570bc4..52c57a9d77de 100644 --- a/comphelper/qa/makefile.mk +++ b/comphelper/qa/makefile.mk @@ -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 @@ -43,7 +43,7 @@ INCPRE += $(MISC)$/$(TARGET)$/inc SHL1TARGET = $(TARGET)_weakbag SHL1OBJS = $(SLO)$/test_weakbag.obj -SHL1STDLIBS = $(CPPUHELPERLIB) $(CPPULIB) $(CPPUNITLIB) $(SALLIB) +SHL1STDLIBS = $(CPPUHELPERLIB) $(CPPULIB) $(CPPUNITLIB) $(TESTSHL2LIB) $(SALLIB) SHL1VERSIONMAP = version.map SHL1IMPLIB = i$(SHL1TARGET) DEF1NAME = $(SHL1TARGET) @@ -55,4 +55,4 @@ SLOFILES = $(SHL1OBJS) ALLTAR: test test .PHONY: $(SHL1TARGETN) - testshl2 $(SHL1TARGETN) + $(TESTSHL2) $(SHL1TARGETN) diff --git a/comphelper/qa/test_string.cxx b/comphelper/qa/test_string.cxx index 035e56fdb8c4..c237158beccc 100644 --- a/comphelper/qa/test_string.cxx +++ b/comphelper/qa/test_string.cxx @@ -32,7 +32,7 @@ #include "sal/config.h" #include "comphelper/string.hxx" -#include "cppunit/simpleheader.hxx" +#include "testshl/simpleheader.hxx" #include "rtl/string.h" #include "rtl/ustring.h" #include "rtl/ustring.hxx" diff --git a/comphelper/qa/test_weakbag.cxx b/comphelper/qa/test_weakbag.cxx index dd4a8356eb5a..470ac2eef6c0 100644 --- a/comphelper/qa/test_weakbag.cxx +++ b/comphelper/qa/test_weakbag.cxx @@ -35,7 +35,7 @@ #include "com/sun/star/uno/XInterface.hpp" #include "comphelper/weakbag.hxx" #include "cppuhelper/weak.hxx" -#include "cppunit/simpleheader.hxx" +#include "testshl/simpleheader.hxx" namespace { diff --git a/o3tl/qa/makefile.mk b/o3tl/qa/makefile.mk index a6ebfbba4bb9..53806c153d13 100644 --- a/o3tl/qa/makefile.mk +++ b/o3tl/qa/makefile.mk @@ -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 @@ -51,6 +51,7 @@ SHL1OBJS= \ SHL1TARGET= tests SHL1STDLIBS= $(SALLIB) \ + $(TESTSHL2LIB)\ $(CPPUNITLIB) SHL1IMPLIB= i$(SHL1TARGET) diff --git a/o3tl/qa/test-cow_wrapper.cxx b/o3tl/qa/test-cow_wrapper.cxx index 6bb169e951a4..eebbb633f82b 100644 --- a/o3tl/qa/test-cow_wrapper.cxx +++ b/o3tl/qa/test-cow_wrapper.cxx @@ -1,6 +1,6 @@ // autogenerated file with codegen.pl -#include +#include #include "cow_wrapper_clients.hxx" diff --git a/o3tl/qa/test-heap_ptr.cxx b/o3tl/qa/test-heap_ptr.cxx index 5e247a8b9abc..25f2209c94f5 100644 --- a/o3tl/qa/test-heap_ptr.cxx +++ b/o3tl/qa/test-heap_ptr.cxx @@ -28,7 +28,7 @@ * ************************************************************************/ -#include +#include #include diff --git a/o3tl/qa/test-range.cxx b/o3tl/qa/test-range.cxx index 626d9b6e3a90..fa956db96005 100644 --- a/o3tl/qa/test-range.cxx +++ b/o3tl/qa/test-range.cxx @@ -29,7 +29,7 @@ ************************************************************************/ -#include +#include #include #include diff --git a/svtools/qa/makefile.mk b/svtools/qa/makefile.mk index cbb59a0d10ac..c56dc2804a64 100644 --- a/svtools/qa/makefile.mk +++ b/svtools/qa/makefile.mk @@ -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 @@ -40,7 +40,7 @@ ENABLE_EXCEPTIONS = true .INCLUDE : settings.mk # BEGIN ---------------------------------------------------------------- -# auto generated Target:job by codegen.pl +# auto generated Target:job by codegen.pl SHL1OBJS= \ $(SLO)$/test_URIHelper.obj @@ -52,7 +52,8 @@ SHL1STDLIBS=\ $(SVTOOLLIB) \ $(TOOLSLIB) \ $(UNOTOOLSLIB) \ - $(CPPUNITLIB) + $(TESTSHL2LIB) \ + $(CPPUNITLIB) SHL1IMPLIB= i$(SHL1TARGET) DEF1NAME =$(SHL1TARGET) @@ -71,15 +72,15 @@ SHL1VERSIONMAP= export.map # LLA: old stuff # USE_DEFFILE = true -# +# # .INCLUDE: settings.mk -# +# # .IF "$(OS)" == "WNT" # REGEXP = "s/^[\#].*$$//" # .ELSE # OS, WNT # REGEXP = 's/^[\#].*$$//' # .ENDIF # OS, WNT -# +# # SHL1TARGET = URIHelper # SHL1OBJS = \ # $(SLO)$/test_URIHelper.obj @@ -90,12 +91,12 @@ SHL1VERSIONMAP= export.map # $(SVTOOLLIB) \ # $(TOOLSLIB) \ # $(UNOTOOLSLIB) -# +# # DEF1NAME = $(SHL1TARGET) # DEF1EXPORTFILE = $(MISC)$/$(SHL1TARGET).dxp -# +# # .INCLUDE: target.mk -# +# # $(MISC)$/$(SHL1TARGET).dxp: sce$/$(SHL1TARGET).sce # + $(TYPE) $< | sed $(REGEXP) > $@ # + $(TYPE) $@ | sed "s/^/test_/" > $(MISC)$/$(SHL1TARGET).tst diff --git a/svtools/qa/test_URIHelper.cxx b/svtools/qa/test_URIHelper.cxx index d60780132903..a90fbe039b6d 100644 --- a/svtools/qa/test_URIHelper.cxx +++ b/svtools/qa/test_URIHelper.cxx @@ -57,7 +57,7 @@ #include "cppuhelper/bootstrap.hxx" #include "cppuhelper/implbase1.hxx" #include "cppuhelper/implbase2.hxx" -#include "cppunit/simpleheader.hxx" +#include "testshl/simpleheader.hxx" #include "osl/diagnose.h" #include "rtl/strbuf.hxx" #include "rtl/string.h" diff --git a/tools/qa/makefile.mk b/tools/qa/makefile.mk index 15f9c6a9fdaf..c63aa966b7fc 100644 --- a/tools/qa/makefile.mk +++ b/tools/qa/makefile.mk @@ -40,7 +40,7 @@ DLLPRE = # no leading "lib" on .so files SHL1TARGET = test_pathutils SHL1OBJS = $(SLO)$/test_pathutils.obj $(SLO)$/pathutils.obj -SHL1STDLIBS = $(CPPUNITLIB) $(SALLIB) +SHL1STDLIBS = $(CPPUNITLIB) $(SALLIB) $(TESTSHL2LIB) SHL1VERSIONMAP = version.map SHL1IMPLIB = i$(SHL1TARGET) DEF1NAME = $(SHL1TARGET) @@ -52,4 +52,4 @@ SLOFILES = $(SHL1OBJS) ALLTAR: test test .PHONY: $(SHL1TARGETN) - testshl2 $(SHL1TARGETN) -forward $(BIN)$/$(TARGET).rdb + $(TESTSHL2) $(SHL1TARGETN) -forward $(BIN)$/$(TARGET).rdb diff --git a/tools/qa/test_pathutils.cxx b/tools/qa/test_pathutils.cxx index 9cd4e2110937..c028a2f654c4 100644 --- a/tools/qa/test_pathutils.cxx +++ b/tools/qa/test_pathutils.cxx @@ -33,7 +33,7 @@ #include -#include "cppunit/simpleheader.hxx" +#include "testshl/simpleheader.hxx" #include "tools/pathutils.hxx" namespace { diff --git a/tools/test/makefile.mk b/tools/test/makefile.mk index 63108677829c..22796f47d72f 100644 --- a/tools/test/makefile.mk +++ b/tools/test/makefile.mk @@ -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 @@ -48,19 +48,20 @@ SHL1OBJS= \ SHL1TARGET= tests SHL1STDLIBS= $(SALLIB) \ $(TOOLSLIB) \ + $(TESTSHL2LIB) \ $(CPPUNITLIB) SHL1IMPLIB= i$(SHL1TARGET) DEF1NAME =$(SHL1TARGET) -SHL1VERSIONMAP = export.map +SHL1VERSIONMAP = export.map #------------------------------- All object files ---------------------------- # do this here, so we get right dependencies -SLOFILES=$(SHL1OBJS) +SLOFILES=$(SHL1OBJS) # --- Targets ------------------------------------------------------ .INCLUDE : target.mk -.INCLUDE : _cppunit.mk +.INCLUDE : _cppunit.mk diff --git a/tools/test/tests.cxx b/tools/test/tests.cxx index 913bd444f145..a2bfb63d4c5f 100644 --- a/tools/test/tests.cxx +++ b/tools/test/tests.cxx @@ -33,7 +33,7 @@ #include "precompiled_tools.hxx" // autogenerated file with codegen.pl -#include +#include #include #include -- cgit -- cgit From 24dff8f7929425d0ded658d8729b1257e5cf4868 Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Wed, 16 Sep 2009 11:52:38 +0000 Subject: ooops, DrawControlText of course needs to merge the actual ControlFont into the canonical font --- vcl/source/control/ctrl.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index 163e7cfeb915..7ca2ff5ff8e5 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -565,6 +565,8 @@ void Control::DrawControlText( OutputDevice& _rTargetDevice, const Rectangle& _r sal_Int32* pCharWidths = new sal_Int32[ _rStr.Len() ]; // retrieve unzoomed point font of the target device Font aFont( GetCanonicalFont( GetSettings().GetStyleSettings() ) ); + if ( IsControlFont() ) + aFont.Merge( GetControlFont() ); // transfer font to the reference device mpControlData->mpReferenceDevice->Push( PUSH_FONT ); -- cgit From e5def2cead12559525567f2c80b2f642d754e327 Mon Sep 17 00:00:00 2001 From: hdu Date: Thu, 17 Sep 2009 13:42:15 +0200 Subject: #i104121# fix text-justification of all-spaces line --- vcl/aqua/source/gdi/salatslayout.cxx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/vcl/aqua/source/gdi/salatslayout.cxx b/vcl/aqua/source/gdi/salatslayout.cxx index 7ecef01cf0d5..3021e85fed5c 100755 --- a/vcl/aqua/source/gdi/salatslayout.cxx +++ b/vcl/aqua/source/gdi/salatslayout.cxx @@ -302,16 +302,14 @@ void ATSLayout::AdjustLayout( ImplLayoutArgs& rArgs ) nPixelWidth = rArgs.mpDXArray[ mnCharCount - 1 ]; // workaround for ATSUI not using trailing spaces for justification - mnTrailingSpaceWidth = 0; int i = mnCharCount; - while( (--i > 0) && IsSpacingGlyph( rArgs.mpStr[mnMinCharPos+i]|GF_ISCHAR ) ) - mnTrailingSpaceWidth += rArgs.mpDXArray[i] - rArgs.mpDXArray[i-1]; - if( i <= 0 ) + while( (--i >= 0) && IsSpacingGlyph( rArgs.mpStr[mnMinCharPos+i]|GF_ISCHAR ) ) {} + if( i < 0 ) // nothing to do if the text is all spaces return; // #i91685# trailing letters are left aligned (right aligned for RTL) - mnTrailingSpaceWidth += rArgs.mpDXArray[i]; + mnTrailingSpaceWidth = rArgs.mpDXArray[ mnCharCount-1 ]; if( i > 0 ) - mnTrailingSpaceWidth -= rArgs.mpDXArray[i-1]; + mnTrailingSpaceWidth -= rArgs.mpDXArray[ i-1 ]; InitGIA(); // ensure valid mpCharWidths[] mnTrailingSpaceWidth -= Fixed2Vcl( mpCharWidths[i] ); // ignore trailing space for calculating the available width -- cgit From 8e2308c3ff142e3b7232908bacdcdb85ac1f9683 Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Thu, 17 Sep 2009 21:11:28 +0000 Subject: setZoom: care for rounding errors which occur during implicit conversion from float to double --- toolkit/source/awt/vclxwindow.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index 93486d86e739..501ed7f009f1 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -2586,7 +2586,14 @@ void VCLXWindow::setZoom( float fZoomX, float /*fZoomY*/ ) throw(::com::sun::sta ::vos::OGuard aGuard( GetMutex() ); if ( GetWindow() ) - GetWindow()->SetZoom( Fraction( fZoomX ) ); + { + // Fraction::Fraction takes a double, but we have a float only. + // The implicit conversion from float to double can result in a precision loss, i.e. 1.2 is converted to + // 1.200000000047something. To prevent this, we convert explicitly to double, and round it. + double nZoom( fZoomX ); + nZoom = ::rtl::math::round( nZoom, 4 ); + GetWindow()->SetZoom( Fraction( nZoom ) ); + } } // ::com::sun::star::lang::XEventListener -- cgit From f3456e8a2e2f300dab24871c4323461cb90b40e1 Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Thu, 17 Sep 2009 21:26:57 +0000 Subject: #b6875455# refactor the Control's "draw with reference device" functionality In particular, use the existing DrawText/ImplGetTextLines methods, but provide them with an optional ITextLayout interface, which replaces the usage of GetTextWidth and DrawText( Point, ... ) This way, the ref-device-rendering benefits from the existing implementations in DrawText( Rectangle, ... ), in particular, it now respects all kind of TEXT_DRAW_ flags, i.e. alignment, word breaks, multi line text, disabled drawing, etc. --- vcl/inc/vcl/ctrl.hxx | 13 +- vcl/inc/vcl/outdev.hxx | 20 ++- vcl/inc/vcl/textlayout.hxx | 92 +++++++++++++ vcl/source/control/button.cxx | 6 +- vcl/source/control/ctrl.cxx | 78 +---------- vcl/source/control/fixed.cxx | 4 +- vcl/source/gdi/makefile.mk | 3 +- vcl/source/gdi/outdev3.cxx | 74 ++++++++--- vcl/source/gdi/pdfwriter_impl.cxx | 2 +- vcl/source/gdi/textlayout.cxx | 269 ++++++++++++++++++++++++++++++++++++++ 10 files changed, 460 insertions(+), 101 deletions(-) create mode 100755 vcl/inc/vcl/textlayout.hxx create mode 100755 vcl/source/gdi/textlayout.cxx diff --git a/vcl/inc/vcl/ctrl.hxx b/vcl/inc/vcl/ctrl.hxx index 2508a58c005e..535f75549991 100644 --- a/vcl/inc/vcl/ctrl.hxx +++ b/vcl/inc/vcl/ctrl.hxx @@ -97,8 +97,11 @@ protected: If no reference device is set, the draw request will simply be forwarded to OutputDevice::DrawText. Otherwise, the text will be rendered according to the metrics at the reference device. + + Note that the given rectangle might be modified, it will contain the result of a GetTextRect call (either + directly at the target device, or taking the reference device into account) when returning. */ - void DrawControlText( OutputDevice& _rTargetDevice, const Rectangle& _rRect, + void DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRect, const XubString& _rStr, USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText ) const; @@ -188,6 +191,14 @@ public: */ void SetReferenceDevice( OutputDevice* _referenceDevice ); OutputDevice* GetReferenceDevice() const; + + Font GetUnzoomedControlPointFont() const + { + Font aFont( GetCanonicalFont( GetSettings().GetStyleSettings() ) ); + if ( IsControlFont() ) + aFont.Merge( GetControlFont() ); + return aFont; + } }; #endif // _SV_CTRL_HXX diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx index f4e42846dd5e..d056a26c0127 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -103,8 +103,12 @@ namespace awt { typedef std::vector< Rectangle > MetricVector; -namespace vcl { class PDFWriterImpl; } -namespace vcl { class ExtOutDevData; } +namespace vcl +{ + class PDFWriterImpl; + class ExtOutDevData; + class ITextLayout; +} #define OUTDEV_BUFFER_SIZE 128 @@ -433,7 +437,7 @@ public: SAL_DLLPRIVATE long ImplGetTextWidth( const SalLayout& ) const; SAL_DLLPRIVATE void ImplDrawText( const Rectangle& rRect, const String& rOrigStr, USHORT nStyle, - MetricVector* pVector, String* pDisplayText ); + MetricVector* pVector, String* pDisplayText, ::vcl::ITextLayout* _pLayout ); SAL_DLLPRIVATE void ImplDrawTextBackground( const SalLayout& ); SAL_DLLPRIVATE void ImplDrawTextLines( SalLayout&, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, BOOL bWordLine, BOOL bUnderlineAbove ); SAL_DLLPRIVATE bool ImplDrawRotateText( SalLayout& ); @@ -456,7 +460,7 @@ public: SAL_DLLPRIVATE void ImplDrawMnemonicLine( long nX, long nY, long nWidth ); SAL_DLLPRIVATE void ImplGetEmphasisMark( PolyPolygon& rPolyPoly, BOOL& rPolyLine, Rectangle& rRect1, Rectangle& rRect2, long& rYOff, long& rWidth, FontEmphasisMark eEmphasis, long nHeight, short nOrient ); SAL_DLLPRIVATE void ImplDrawEmphasisMark( long nBaseX, long nX, long nY, const PolyPolygon& rPolyPoly, BOOL bPolyLine, const Rectangle& rRect1, const Rectangle& rRect2 ); - SAL_DLLPRIVATE long ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const XubString& rStr, USHORT nStyle ) const; + SAL_DLLPRIVATE long ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const XubString& rStr, USHORT nStyle, const ::vcl::ITextLayout* _pLayout ) const; SAL_DLLPRIVATE void ImplInitFontList() const; SAL_DLLPRIVATE void ImplUpdateFontData( bool bNewFontLists ); SAL_DLLPRIVATE static void ImplUpdateAllFontData( bool bNewFontLists ); @@ -650,9 +654,17 @@ public: void DrawText( const Rectangle& rRect, const XubString& rStr, USHORT nStyle = 0, MetricVector* pVector = NULL, String* pDisplayText = NULL ); + void DrawText( const Rectangle& rRect, + const XubString& rStr, USHORT nStyle, + MetricVector* pVector, String* pDisplayText, + ::vcl::ITextLayout* _pTextLayout ); Rectangle GetTextRect( const Rectangle& rRect, const XubString& rStr, USHORT nStyle = TEXT_DRAW_WORDBREAK, TextRectInfo* pInfo = NULL ) const; + Rectangle GetTextRect( const Rectangle& rRect, + const XubString& rStr, USHORT nStyle, + TextRectInfo* pInfo, + const ::vcl::ITextLayout* _pTextLayout ) const; XubString GetEllipsisString( const XubString& rStr, long nMaxWidth, USHORT nStyle = TEXT_DRAW_ENDELLIPSIS ) const; void DrawCtrlText( const Point& rPos, const XubString& rStr, diff --git a/vcl/inc/vcl/textlayout.hxx b/vcl/inc/vcl/textlayout.hxx new file mode 100755 index 000000000000..dbb7b2d17d77 --- /dev/null +++ b/vcl/inc/vcl/textlayout.hxx @@ -0,0 +1,92 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* 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 +* +* for a copy of the LGPLv3 License. +************************************************************************/ + +#ifndef VCL_TEXTLAYOUT_HXX +#define VCL_TEXTLAYOUT_HXX + +#include "vcl/outdev.hxx" + +#include +#include + +#include + +class Control; + +//........................................................................ +namespace vcl +{ +//........................................................................ + + //==================================================================== + //= ITextLayout + //==================================================================== + class SAL_NO_VTABLE ITextLayout + { + public: + virtual long GetTextWidth( const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const = 0; + virtual void DrawText( + const Point& _rStartPoint, + const XubString& _rText, + xub_StrLen _nStartIndex, + xub_StrLen _nLength, + MetricVector* _pVector, + String* _pDisplayText + ) = 0; + }; + + //==================================================================== + //= ControlTextRenderer + //==================================================================== + class ReferenceDeviceTextLayout; + /** a class which allows rendering text onto a device, but calculating the metrics according to a reference device + + The class provides a number of methods which are equivalent to the same methods of the OutputDevice, except + that OutputDevice does not know about reference devices. + */ + class ControlTextRenderer + { + public: + ControlTextRenderer( const Control& _rControl, OutputDevice& _rTargetDevice, OutputDevice& _rReferenceDevice ); + virtual ~ControlTextRenderer(); + + Rectangle DrawText( const Rectangle& _rRect, + const XubString& _rText, USHORT _nStyle = 0, + MetricVector* _pVector = NULL, String* _pDisplayText = NULL ); + + private: + ControlTextRenderer(); // never implemented + ControlTextRenderer( const ControlTextRenderer& ); // never implemented + ControlTextRenderer& operator=( const ControlTextRenderer& ); // never implemented + + private: + ::std::auto_ptr< ReferenceDeviceTextLayout > m_pImpl; + }; + +//........................................................................ +} // namespace vcl +//........................................................................ + +#endif // VCL_TEXTLAYOUT_HXX diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 0f9a09cb17e7..6d6c7aae923a 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -406,12 +406,12 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, } else if ( bDrawText && !bDrawImage && !bHasSymbol ) { - aOutRect = pDev->GetTextRect( aOutRect, aText, nTextStyle ); + DrawControlText( *pDev, aOutRect, aText, nTextStyle, pVector, pDisplayText ); + + ImplSetFocusRect( aOutRect ); rSize = aOutRect.GetSize(); rPos = aOutRect.TopLeft(); - ImplSetFocusRect( aOutRect ); - DrawControlText( *pDev, aOutRect, aText, nTextStyle, pVector, pDisplayText ); return; } diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index 7ca2ff5ff8e5..cfffbe136204 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -41,6 +41,7 @@ #include #include #include +#include namespace vcl @@ -549,82 +550,17 @@ void Control::ImplInitSettings( const BOOL _bFont, const BOOL _bForeground ) // ----------------------------------------------------------------- -void Control::DrawControlText( OutputDevice& _rTargetDevice, const Rectangle& _rRect, const XubString& _rStr, +void Control::DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRect, const XubString& _rStr, USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText ) const { + if ( !mpControlData->mpReferenceDevice ) { - _rTargetDevice.DrawText( _rRect, _rStr, _nStyle, _pVector, _pDisplayText ); + _io_rRect = _rTargetDevice.GetTextRect( _io_rRect, _rStr, _nStyle ); + _rTargetDevice.DrawText( _io_rRect, _rStr, _nStyle, _pVector, _pDisplayText ); return; } - // TODO: - // - respect the style (word break, vert./horz. align, etc.) - // - respect _pVector and _pDisplayText, i.e. fill metric data if they're given - - sal_Int32* pCharWidths = new sal_Int32[ _rStr.Len() ]; - // retrieve unzoomed point font of the target device - Font aFont( GetCanonicalFont( GetSettings().GetStyleSettings() ) ); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - - // transfer font to the reference device - mpControlData->mpReferenceDevice->Push( PUSH_FONT ); - Font aRefFont( aFont ); - aRefFont.SetSize( LogicToLogic( - aRefFont.GetSize(), MAP_POINT, mpControlData->mpReferenceDevice->GetMapMode().GetMapUnit() ) ); - mpControlData->mpReferenceDevice->SetFont( aRefFont ); - - // retrieve the character widths from the reference device - mpControlData->mpReferenceDevice->GetTextArray( _rStr, pCharWidths ); - mpControlData->mpReferenceDevice->Pop(); - - // adjust the widths, which are in ref-device units, to the target device - const MapUnit eRefMapUnit( mpControlData->mpReferenceDevice->GetMapMode().GetMapUnit() ); - OSL_ENSURE( eRefMapUnit != MAP_PIXEL, "a reference device with MAP_PIXEL?" ); - - const MapMode& aTargetMapMode( _rTargetDevice.GetMapMode() ); - const MapUnit eTargetMapUnit( aTargetMapMode.GetMapUnit() ); - const bool bTargetIsPixel = ( eTargetMapUnit == MAP_PIXEL ); - { - for ( size_t i=0; i<_rStr.Len(); ++i ) - { - pCharWidths[i] = - bTargetIsPixel - ? _rTargetDevice.LogicToPixel( Size( pCharWidths[i], 0 ), eRefMapUnit ).Width() - : _rTargetDevice.LogicToLogic( Size( pCharWidths[i], 0 ), eRefMapUnit, eTargetMapUnit ).Width(); - } - } - - Point aDrawTextPosition( _rRect.TopLeft() ); - // translate our zoom into a map mode / font / origin at the target device - if ( IsZoom() ) - { - _rTargetDevice.Push( PUSH_MAPMODE | PUSH_FONT ); - - const Fraction& rZoom( GetZoom() ); - - MapMode aDrawMapMode( aTargetMapMode ); - aDrawMapMode.SetScaleX( rZoom ); - aDrawMapMode.SetScaleY( rZoom ); - _rTargetDevice.SetMapMode( aDrawMapMode ); - - Font aDrawFont( aFont ); - if ( bTargetIsPixel ) - aDrawFont.SetSize( _rTargetDevice.LogicToPixel( aDrawFont.GetSize(), MAP_POINT ) ); - else - aDrawFont.SetSize( _rTargetDevice.LogicToLogic( aDrawFont.GetSize(), MAP_POINT, eTargetMapUnit ) ); - _rTargetDevice.SetFont( aDrawFont ); - - aDrawTextPosition.X() = long(aDrawTextPosition.X() / (double)rZoom); - aDrawTextPosition.Y() = long(aDrawTextPosition.Y() / (double)rZoom); - } - - // draw the text - _rTargetDevice.DrawTextArray( aDrawTextPosition, _rStr, pCharWidths ); - - if ( IsZoom() ) - _rTargetDevice.Pop(); - - delete[] pCharWidths; + ControlTextRenderer aRenderer( *this, _rTargetDevice, *mpControlData->mpReferenceDevice ); + _io_rRect = aRenderer.DrawText( _io_rRect, _rStr, _nStyle, _pVector, _pDisplayText ); } diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index 4b081c57e188..53029c8e3573 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -265,7 +265,8 @@ void FixedText::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, if( bFillLayout ) mpControlData->mpLayoutData->m_aDisplayText = String(); - DrawControlText( *pDev, Rectangle( aPos, rSize ), aText, nTextStyle, + Rectangle aRect( Rectangle( aPos, rSize ) ); + DrawControlText( *pDev, aRect, aText, nTextStyle, bFillLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL, bFillLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL ); @@ -548,7 +549,6 @@ void FixedLine::ImplDraw( bool bLayout ) if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO ) nStyle |= TEXT_DRAW_MONO; - aRect = GetTextRect( aRect, aText, nStyle ); DrawControlText( *this, aRect, aText, nStyle, pVector, pDisplayText ); if( !pVector ) diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk index a09ae92dcb5e..b708346e45e4 100644 --- a/vcl/source/gdi/makefile.mk +++ b/vcl/source/gdi/makefile.mk @@ -115,7 +115,8 @@ SLOFILES= $(SLO)$/salmisc.obj \ $(SLO)$/bmpconv.obj \ $(SLO)$/pngread.obj \ $(SLO)$/pngwrite.obj \ - $(SLO)$/graphictools.obj + $(SLO)$/graphictools.obj \ + $(SLO)$/textlayout.obj EXCEPTIONSFILES= $(SLO)$/salmisc.obj \ $(SLO)$/outdev.obj \ diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 0a6b778681e1..87a6659de51e 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -61,6 +61,7 @@ #include #include #include +#include #ifndef _OSL_FILE_H #include #endif @@ -5257,7 +5258,7 @@ void OutputDevice::ImplDrawText( SalLayout& rSalLayout ) long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const XubString& rStr, - USHORT nStyle ) const + USHORT nStyle, const ::vcl::ITextLayout* _pLayout ) const { DBG_ASSERTWARNING( nWidth >= 0, "ImplGetTextLines: nWidth <= 0!" ); @@ -5295,7 +5296,8 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, while ( ( nBreakPos < nLen ) && ( rStr.GetChar( nBreakPos ) != _CR ) && ( rStr.GetChar( nBreakPos ) != _LF ) ) nBreakPos++; - long nLineWidth = GetTextWidth( rStr, nPos, nBreakPos-nPos ); + long nLineWidth = ( _pLayout != NULL ) ? _pLayout->GetTextWidth( rStr, nPos, nBreakPos-nPos ) + : GetTextWidth( rStr, nPos, nBreakPos-nPos ); if ( ( nLineWidth > nWidth ) && ( nStyle & TEXT_DRAW_WORDBREAK ) ) { if ( !xBI.is() ) @@ -5408,7 +5410,8 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, } // if ( xHyph.is() ) } // if ( (nStyle & TEXT_DRAW_WORDBREAK_HYPHENATION) == TEXT_DRAW_WORDBREAK_HYPHENATION ) } - nLineWidth = GetTextWidth( rStr, nPos, nBreakPos-nPos ); + nLineWidth = ( _pLayout != NULL ) ? _pLayout->GetTextWidth( rStr, nPos, nBreakPos-nPos ) + : GetTextWidth( rStr, nPos, nBreakPos-nPos ); } else { @@ -5422,14 +5425,16 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, { if( nSpacePos > nPos ) nSpacePos--; - nW = GetTextWidth( rStr, nPos, nSpacePos-nPos ); + nW = ( _pLayout != NULL ) ? _pLayout->GetTextWidth( rStr, nPos, nSpacePos-nPos ) + : GetTextWidth( rStr, nPos, nSpacePos-nPos ); } } while( nW > nWidth ); if( nSpacePos != STRING_NOTFOUND ) { nBreakPos = nSpacePos; - nLineWidth = GetTextWidth( rStr, nPos, nBreakPos-nPos ); + nLineWidth = ( _pLayout != NULL ) ? _pLayout->GetTextWidth( rStr, nPos, nBreakPos-nPos ) + : GetTextWidth( rStr, nPos, nBreakPos-nPos ); if( nBreakPos < rStr.Len()-1 ) nBreakPos++; } @@ -6773,7 +6778,8 @@ xub_StrLen OutputDevice::GetTextBreak( const String& rStr, long nTextWidth, void OutputDevice::ImplDrawText( const Rectangle& rRect, const String& rOrigStr, USHORT nStyle, - MetricVector* pVector, String* pDisplayText ) + MetricVector* pVector, String* pDisplayText, + ::vcl::ITextLayout* _pLayout ) { Color aOldTextColor; Color aOldTextFillColor; @@ -6850,7 +6856,7 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, if ( nTextHeight ) { - nMaxTextWidth = ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle ); + nMaxTextWidth = ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, _pLayout ); nLines = (xub_StrLen)(nHeight/nTextHeight); nFormatLines = aMultiLineInfo.Count(); if ( !nLines ) @@ -6916,7 +6922,10 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, aPos.X() += (nWidth-pLineInfo->GetWidth())/2; xub_StrLen nIndex = pLineInfo->GetIndex(); xub_StrLen nLineLen = pLineInfo->GetLen(); - DrawText( aPos, aStr, nIndex, nLineLen, pVector, pDisplayText ); + if ( _pLayout ) + _pLayout->DrawText( aPos, aStr, nIndex, nLineLen, pVector, pDisplayText ); + else + DrawText( aPos, aStr, nIndex, nLineLen, pVector, pDisplayText ); if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) && !pVector ) { if ( (nMnemonicPos >= nIndex) && (nMnemonicPos < nIndex+nLineLen) ) @@ -6946,7 +6955,10 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, // Gibt es noch eine letzte Zeile, dann diese linksbuendig ausgeben, // da die Zeile gekuerzt wurde if ( aLastLine.Len() ) - DrawText( aPos, aLastLine, 0, STRING_LEN, pVector, pDisplayText ); + if ( _pLayout ) + _pLayout->DrawText( aPos, aLastLine, 0, STRING_LEN, pVector, pDisplayText ); + else + DrawText( aPos, aLastLine, 0, STRING_LEN, pVector, pDisplayText ); // Clipping zuruecksetzen if ( nStyle & TEXT_DRAW_CLIP ) @@ -6955,7 +6967,9 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, } else { - long nTextWidth = GetTextWidth( aStr ); + long nTextWidth = _pLayout + ? _pLayout->GetTextWidth( aStr, 0, STRING_LEN ) + : GetTextWidth( aStr ); // Evt. Text kuerzen if ( nTextWidth > nWidth ) @@ -7011,7 +7025,10 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, { Push( PUSH_CLIPREGION ); IntersectClipRegion( rRect ); - DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText ); + if ( _pLayout ) + _pLayout->DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText ); + else + DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText ); if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) && !pVector ) { if ( nMnemonicPos != STRING_NOTFOUND ) @@ -7021,7 +7038,10 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, } else { - DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText ); + if ( _pLayout ) + _pLayout->DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText ); + else + DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText ); if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) && !pVector ) { if ( nMnemonicPos != STRING_NOTFOUND ) @@ -7067,7 +7087,7 @@ void OutputDevice::AddTextRectActions( const Rectangle& rRect, // #i47157# Factored out to ImplDrawTextRect(), to be shared // between us and DrawText() - ImplDrawText( rRect, rOrigStr, nStyle, NULL, NULL ); + ImplDrawText( rRect, rOrigStr, nStyle, NULL, NULL, NULL ); // and restore again EnableOutput( bOutputEnabled ); @@ -7079,7 +7099,15 @@ void OutputDevice::AddTextRectActions( const Rectangle& rRect, void OutputDevice::DrawText( const Rectangle& rRect, const String& rOrigStr, USHORT nStyle, MetricVector* pVector, String* pDisplayText ) +{ + DrawText( rRect, rOrigStr, nStyle, pVector, pDisplayText, NULL ); +} + +// ----------------------------------------------------------------------- +void OutputDevice::DrawText( const Rectangle& rRect, const String& rOrigStr, USHORT nStyle, + MetricVector* pVector, String* pDisplayText, + ::vcl::ITextLayout* _pTextLayout ) { if( mpOutDevData && mpOutDevData->mpRecordLayout ) { @@ -7109,9 +7137,9 @@ void OutputDevice::DrawText( const Rectangle& rRect, GDIMetaFile* pMtf = mpMetaFile; mpMetaFile = NULL; - // #i47157# Factored out to ImplDrawTextRect(), to be used also + // #i47157# Factored out to ImplDrawText(), to be used also // from AddTextRectActions() - ImplDrawText( rRect, rOrigStr, nStyle, pVector, pDisplayText ); + ImplDrawText( rRect, rOrigStr, nStyle, pVector, pDisplayText, _pTextLayout ); // and enable again mpMetaFile = pMtf; @@ -7125,6 +7153,16 @@ void OutputDevice::DrawText( const Rectangle& rRect, Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, const String& rOrigStr, USHORT nStyle, TextRectInfo* pInfo ) const +{ + return GetTextRect( rRect, rOrigStr, nStyle, pInfo, NULL ); +} + +// ----------------------------------------------------------------------- + +Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, + const XubString& rStr, USHORT nStyle, + TextRectInfo* pInfo, + const ::vcl::ITextLayout* _pTextLayout ) const { DBG_TRACE( "OutputDevice::GetTextRect()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -7135,7 +7173,7 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, long nMaxWidth; long nTextHeight = GetTextHeight(); - String aStr = rOrigStr; + String aStr = rStr; if ( nStyle & TEXT_DRAW_MNEMONIC ) aStr = GetNonMnemonicString( aStr ); @@ -7147,7 +7185,7 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, xub_StrLen i; nMaxWidth = 0; - ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle ); + ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, _pTextLayout ); nFormatLines = aMultiLineInfo.Count(); if ( !nTextHeight ) nTextHeight = 1; @@ -7195,7 +7233,7 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, else { nLines = 1; - nMaxWidth = GetTextWidth( aStr ); + nMaxWidth = _pTextLayout ? _pTextLayout->GetTextWidth( aStr, 0, aStr.Len() ) : GetTextWidth( aStr ); if ( pInfo ) { diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index e7ee18ec7705..3eda6b5c929c 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -7307,7 +7307,7 @@ void PDFWriterImpl::drawText( const Rectangle& rRect, const String& rOrigStr, US if ( nTextHeight ) { - nMaxTextWidth = m_pReferenceDevice->ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle ); + nMaxTextWidth = m_pReferenceDevice->ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, NULL ); nLines = (xub_StrLen)(nHeight/nTextHeight); nFormatLines = aMultiLineInfo.Count(); if ( !nLines ) diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx new file mode 100755 index 000000000000..7ea72e8e12ea --- /dev/null +++ b/vcl/source/gdi/textlayout.cxx @@ -0,0 +1,269 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* 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 +* +* for a copy of the LGPLv3 License. +************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_vcl.hxx" + +#include "vcl/ctrl.hxx" +#include "vcl/outdev.hxx" +#include "vcl/outfont.hxx" +#include "vcl/textlayout.hxx" + +//........................................................................ +namespace vcl +{ +//........................................................................ + + //==================================================================== + //= ReferenceDeviceTextLayout + //==================================================================== + class ReferenceDeviceTextLayout : public ITextLayout + { + public: + ReferenceDeviceTextLayout( const Control& _rControl, OutputDevice& _rTargetDevice, OutputDevice& _rReferenceDevice ); + virtual ~ReferenceDeviceTextLayout(); + + // ITextLayout + virtual long GetTextWidth( const XubString& rStr, xub_StrLen nIndex, xub_StrLen nLen ) const; + virtual void DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength, MetricVector* _pVector, String* _pDisplayText ); + + public: + // equivalents to the respective OutputDevice methods, which take the reference device into account + long GetTextArray( const XubString& _rText, sal_Int32* _pDXAry, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const; + Rectangle DrawText( const Rectangle& _rRect, const XubString& _rText, USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText); + + + bool IsZoom() const; + + protected: + void onBeginDrawText() + { + m_aCompleteTextRect.SetEmpty(); + } + Rectangle onEndDrawText() + { + return m_aCompleteTextRect; + } + + private: + OutputDevice& m_rTargetDevice; + OutputDevice& m_rReferenceDevice; + Font m_aUnzoomedPointFont; + const Fraction m_aZoom; + + Rectangle m_aCompleteTextRect; + }; + + //==================================================================== + //= ControlTextRenderer + //==================================================================== + ReferenceDeviceTextLayout::ReferenceDeviceTextLayout( const Control& _rControl, OutputDevice& _rTargetDevice, OutputDevice& _rReferenceDevice ) + :m_rTargetDevice( _rTargetDevice ) + ,m_rReferenceDevice( _rReferenceDevice ) + ,m_aUnzoomedPointFont( _rControl.GetUnzoomedControlPointFont() ) + ,m_aZoom( _rControl.GetZoom() ) + { + if ( IsZoom() ) + { + m_rTargetDevice.Push( PUSH_MAPMODE | PUSH_FONT ); + + MapMode aDrawMapMode( m_rTargetDevice.GetMapMode() ); + aDrawMapMode.SetScaleX( m_aZoom ); // TODO: shouldn't this be "current_scale * zoom"? + aDrawMapMode.SetScaleY( m_aZoom ); + m_rTargetDevice.SetMapMode( aDrawMapMode ); + + MapUnit eTargetMapUnit = m_rTargetDevice.GetMapMode().GetMapUnit(); + Font aDrawFont( m_aUnzoomedPointFont ); + if ( eTargetMapUnit == MAP_PIXEL ) + aDrawFont.SetSize( m_rTargetDevice.LogicToPixel( aDrawFont.GetSize(), MAP_POINT ) ); + else + aDrawFont.SetSize( m_rTargetDevice.LogicToLogic( aDrawFont.GetSize(), MAP_POINT, eTargetMapUnit ) ); + _rTargetDevice.SetFont( aDrawFont ); + } + } + + //-------------------------------------------------------------------- + namespace + { + //................................................................ + bool lcl_normalizeLength( const XubString& _rText, const xub_StrLen _nStartIndex, xub_StrLen& _io_nLength ) + { + xub_StrLen nTextLength = _rText.Len(); + if ( _nStartIndex > nTextLength ) + return false; + if ( _nStartIndex + _io_nLength > nTextLength ) + _io_nLength = nTextLength - _nStartIndex; + return true; + } + + //................................................................ + class DeviceUnitMapping + { + public: + DeviceUnitMapping( const OutputDevice& _rTargetDevice, const OutputDevice& _rReferenceDevice ) + :m_rTargetDevice( _rTargetDevice ) + ,m_eTargetMapUnit( _rTargetDevice.GetMapMode().GetMapUnit() ) + ,m_bTargetIsPixel( _rTargetDevice.GetMapMode().GetMapUnit() == MAP_PIXEL ) + ,m_eRefMapUnit( _rReferenceDevice.GetMapMode().GetMapUnit() ) + { + OSL_ENSURE( m_eRefMapUnit != MAP_PIXEL, "a reference device with MAP_PIXEL?" ); + } + + long mapToTarget( long _nWidth ) + { + return m_bTargetIsPixel + ? m_rTargetDevice.LogicToPixel( Size( _nWidth, 0 ), m_eRefMapUnit ).Width() + : m_rTargetDevice.LogicToLogic( Size( _nWidth, 0 ), m_eRefMapUnit, m_eTargetMapUnit ).Width(); + } + + private: + const OutputDevice& m_rTargetDevice; + const MapUnit m_eTargetMapUnit; + const bool m_bTargetIsPixel; + const MapUnit m_eRefMapUnit; + }; + } + + //-------------------------------------------------------------------- + ReferenceDeviceTextLayout::~ReferenceDeviceTextLayout() + { + if ( IsZoom() ) + m_rTargetDevice.Pop(); + } + + //-------------------------------------------------------------------- + bool ReferenceDeviceTextLayout::IsZoom() const + { + return m_aZoom.GetNumerator() != m_aZoom.GetDenominator(); + } + + //-------------------------------------------------------------------- + long ReferenceDeviceTextLayout::GetTextArray( const XubString& _rText, sal_Int32* _pDXAry, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const + { + if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) ) + return 0; + + // transfer font to the reference device + m_rReferenceDevice.Push( PUSH_FONT ); + Font aRefFont( m_aUnzoomedPointFont ); + aRefFont.SetSize( OutputDevice::LogicToLogic( + aRefFont.GetSize(), MAP_POINT, m_rReferenceDevice.GetMapMode().GetMapUnit() ) ); + m_rReferenceDevice.SetFont( aRefFont ); + + // retrieve the character widths from the reference device + long nTextWidth = m_rReferenceDevice.GetTextArray( _rText, _pDXAry, _nStartIndex, _nLength ); + m_rReferenceDevice.Pop(); + + // adjust the widths, which are in ref-device units, to the target device + DeviceUnitMapping aMapping( m_rTargetDevice, m_rReferenceDevice ); + if ( _pDXAry ) + { + for ( size_t i=0; i<_nLength; ++i ) + _pDXAry[i] = aMapping.mapToTarget( _pDXAry[i] ); + } + nTextWidth = aMapping.mapToTarget( nTextWidth ); + + return nTextWidth; + } + + //-------------------------------------------------------------------- + long ReferenceDeviceTextLayout::GetTextWidth( const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const + { + return GetTextArray( _rText, NULL, _nStartIndex, _nLength ); + } + + //-------------------------------------------------------------------- + void ReferenceDeviceTextLayout::DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength, MetricVector* _pVector, String* _pDisplayText ) + { + if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) ) + return; + + sal_Int32* pCharWidths = new sal_Int32[ _nLength ]; + long nTextWidth = GetTextArray( _rText, pCharWidths, _nStartIndex, _nLength ); + m_rTargetDevice.DrawTextArray( _rStartPoint, _rText, pCharWidths, _nStartIndex, _nLength ); + delete[] pCharWidths; + + m_aCompleteTextRect.Union( Rectangle( _rStartPoint, Size( nTextWidth, m_rTargetDevice.GetTextHeight() ) ) ); + + // TODO: use/fill those: + (void)_pVector; + (void)_pDisplayText; + } + + //-------------------------------------------------------------------- + Rectangle ReferenceDeviceTextLayout::DrawText( const Rectangle& _rRect, const XubString& _rText, USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText) + { + Rectangle aRect( _rRect ); + if ( IsZoom() ) + { + // if there's a zoom factor involved, then we tampered with the target device's map mode in the ctor. + // Need to adjust the rectangle to this + aRect.Left() = long( aRect.Left() / (double)m_aZoom ); + aRect.Right() = long( aRect.Right() / (double)m_aZoom ); + aRect.Top() = long( aRect.Top() / (double)m_aZoom ); + aRect.Bottom() = long( aRect.Bottom() / (double)m_aZoom ); + } + + onBeginDrawText(); + m_rTargetDevice.DrawText( aRect, _rText, _nStyle, _pVector, _pDisplayText, this ); + Rectangle aTextRect = onEndDrawText(); + + if ( IsZoom() ) + { + // similar to above, transform the to-be-returned rectanle to coordinates which are meaningful + // with the original map mode of the target device + aTextRect.Left() = long( aTextRect.Left() * (double)m_aZoom ); + aTextRect.Right() = long( aTextRect.Right() * (double)m_aZoom ); + aTextRect.Top() = long( aTextRect.Top() * (double)m_aZoom ); + aTextRect.Bottom() = long( aTextRect.Bottom() * (double)m_aZoom ); + } + + return aTextRect; + } + + //==================================================================== + //= ControlTextRenderer + //==================================================================== + //-------------------------------------------------------------------- + ControlTextRenderer::ControlTextRenderer( const Control& _rControl, OutputDevice& _rTargetDevice, OutputDevice& _rReferenceDevice ) + :m_pImpl( new ReferenceDeviceTextLayout( _rControl, _rTargetDevice, _rReferenceDevice ) ) + { + } + + //-------------------------------------------------------------------- + ControlTextRenderer::~ControlTextRenderer() + { + } + + //-------------------------------------------------------------------- + Rectangle ControlTextRenderer::DrawText( const Rectangle& _rRect, const XubString& _rText, USHORT _nStyle, + MetricVector* _pVector, String* _pDisplayText ) + { + return m_pImpl->DrawText( _rRect, _rText, _nStyle, _pVector, _pDisplayText ); + } + +//........................................................................ +} // namespace vcl +//........................................................................ -- cgit From 79cad7d02a0eb7cc6e662ad424204f4599a7981a Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Thu, 17 Sep 2009 21:35:29 +0000 Subject: consolidate DrawText and GetText - we do need versions with and without ITextLayout parameter --- vcl/inc/vcl/outdev.hxx | 14 ++++---------- vcl/source/control/ctrl.cxx | 29 +++++++++++++++++++++++++++-- vcl/source/gdi/outdev3.cxx | 18 ------------------ vcl/source/gdi/textlayout.cxx | 8 +++++++- vcl/workben/outdevgrind.cxx | 12 ++++++------ 5 files changed, 44 insertions(+), 37 deletions(-) diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx index d056a26c0127..0c6e8fc7397c 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -653,18 +653,12 @@ public: GDIMetaFile& rMtf ); void DrawText( const Rectangle& rRect, const XubString& rStr, USHORT nStyle = 0, - MetricVector* pVector = NULL, String* pDisplayText = NULL ); - void DrawText( const Rectangle& rRect, - const XubString& rStr, USHORT nStyle, - MetricVector* pVector, String* pDisplayText, - ::vcl::ITextLayout* _pTextLayout ); + MetricVector* pVector = NULL, String* pDisplayText = NULL, + ::vcl::ITextLayout* _pTextLayout = NULL ); Rectangle GetTextRect( const Rectangle& rRect, const XubString& rStr, USHORT nStyle = TEXT_DRAW_WORDBREAK, - TextRectInfo* pInfo = NULL ) const; - Rectangle GetTextRect( const Rectangle& rRect, - const XubString& rStr, USHORT nStyle, - TextRectInfo* pInfo, - const ::vcl::ITextLayout* _pTextLayout ) const; + TextRectInfo* pInfo = NULL, + const ::vcl::ITextLayout* _pTextLayout = NULL ) const; XubString GetEllipsisString( const XubString& rStr, long nMaxWidth, USHORT nStyle = TEXT_DRAW_ENDELLIPSIS ) const; void DrawCtrlText( const Point& rPos, const XubString& rStr, diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index cfffbe136204..8df7e2decd1a 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -561,6 +561,31 @@ void Control::DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRec return; } - ControlTextRenderer aRenderer( *this, _rTargetDevice, *mpControlData->mpReferenceDevice ); - _io_rRect = aRenderer.DrawText( _io_rRect, _rStr, _nStyle, _pVector, _pDisplayText ); +#ifdef FS_DEBUG + _rTargetDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR | PUSH_TEXTCOLOR ); + + _rTargetDevice.SetTextColor( COL_LIGHTRED ); + _rTargetDevice.DrawText( _io_rRect, _rStr, _nStyle, _pVector, _pDisplayText ); + + _rTargetDevice.SetLineColor( COL_LIGHTRED ); + _rTargetDevice.SetFillColor(); + _rTargetDevice.DrawRect( _io_rRect ); + + _rTargetDevice.Pop(); +#endif + + { + ControlTextRenderer aRenderer( *this, _rTargetDevice, *mpControlData->mpReferenceDevice ); + _io_rRect = aRenderer.DrawText( _io_rRect, _rStr, _nStyle, _pVector, _pDisplayText ); + } + +#ifdef FS_DEBUG + _rTargetDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); + + _rTargetDevice.SetLineColor( COL_LIGHTGREEN ); + _rTargetDevice.SetFillColor(); + _rTargetDevice.DrawRect( _io_rRect ); + + _rTargetDevice.Pop(); +#endif } diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 87a6659de51e..7865ca507418 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -7096,15 +7096,6 @@ void OutputDevice::AddTextRectActions( const Rectangle& rRect, // ----------------------------------------------------------------------- -void OutputDevice::DrawText( const Rectangle& rRect, - const String& rOrigStr, USHORT nStyle, - MetricVector* pVector, String* pDisplayText ) -{ - DrawText( rRect, rOrigStr, nStyle, pVector, pDisplayText, NULL ); -} - -// ----------------------------------------------------------------------- - void OutputDevice::DrawText( const Rectangle& rRect, const String& rOrigStr, USHORT nStyle, MetricVector* pVector, String* pDisplayText, ::vcl::ITextLayout* _pTextLayout ) @@ -7150,15 +7141,6 @@ void OutputDevice::DrawText( const Rectangle& rRect, const String& rOrigStr, USH // ----------------------------------------------------------------------- -Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, - const String& rOrigStr, USHORT nStyle, - TextRectInfo* pInfo ) const -{ - return GetTextRect( rRect, rOrigStr, nStyle, pInfo, NULL ); -} - -// ----------------------------------------------------------------------- - Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, const XubString& rStr, USHORT nStyle, TextRectInfo* pInfo, diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx index 7ea72e8e12ea..ddb8979a1a73 100755 --- a/vcl/source/gdi/textlayout.cxx +++ b/vcl/source/gdi/textlayout.cxx @@ -54,7 +54,6 @@ namespace vcl long GetTextArray( const XubString& _rText, sal_Int32* _pDXAry, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const; Rectangle DrawText( const Rectangle& _rRect, const XubString& _rText, USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText); - bool IsZoom() const; protected: @@ -226,6 +225,13 @@ namespace vcl aRect.Bottom() = long( aRect.Bottom() / (double)m_aZoom ); } +#ifdef FS_DEBUG + m_rTargetDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); + m_rTargetDevice.SetLineColor( COL_LIGHTBLUE ); + m_rTargetDevice.SetFillColor(); + m_rTargetDevice.DrawRect( aRect ); + m_rTargetDevice.Pop(); +#endif onBeginDrawText(); m_rTargetDevice.DrawText( aRect, _rText, _nStyle, _pVector, _pDisplayText, this ); Rectangle aTextRect = onEndDrawText(); diff --git a/vcl/workben/outdevgrind.cxx b/vcl/workben/outdevgrind.cxx index a92da7c05531..1109111b63c5 100755 --- a/vcl/workben/outdevgrind.cxx +++ b/vcl/workben/outdevgrind.cxx @@ -163,12 +163,12 @@ void setupMethodStubs( functor_vector_type& res ) xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, MetricVector* pVector = NULL, String* pDisplayText = NULL ); */ - add(res, - "DrawText", - boost::bind( - &OutputDevice::DrawText, - _1, - aPt1, aString, (USHORT)0, aString.Len(), (MetricVector*)0, (String*)0 )); +// add(res, +// "DrawText", +// boost::bind( +// &OutputDevice::DrawText, +// _1, +// aPt1, aString, (USHORT)0, aString.Len(), (MetricVector*)0, (String*)0, (vcl::ITextLayout*)0 )); /* void DrawTextArray( const Point& rStartPt, const XubString& rStr, const sal_Int32* pDXAry = NULL, -- cgit From f20d782ce054876754188345ff013ede4a216f72 Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Fri, 18 Sep 2009 10:39:28 +0000 Subject: #b6875455# - made ImplDrawText and ImplGetTextLines static This way, we find all places where both methods access the target device (which is now explicit instead of implicit), and can make sure that everything is routed through the ITextLayout interface, if necessary. - also, made both methods take ITextLayout& instead of a ITextLayout* - added a default implementation for ITextLayout, which simply delegates all calls to a target device, without any magic - added GetCaretPositions to the ITextLayout interface, since this clearly is controlled by the text layout. Implement the new method for both DefaultTextLayout and ReferenceDeviceTextLayout - let the ReferenceDeviceTextLayout calculate more precise, when zooming/unzooming geometry data - let the ReferenceDeviceTextLayout do less actions on the reference device - pushing and popping the Font is necessary only once, not for every DrawText(Point) action --- vcl/inc/vcl/outdev.hxx | 6 +- vcl/inc/vcl/textlayout.hxx | 47 +++++++++++-- vcl/source/gdi/outdev3.cxx | 143 +++++++++++++++++--------------------- vcl/source/gdi/pdfwriter_impl.cxx | 5 +- vcl/source/gdi/textlayout.cxx | 117 +++++++++++++++++++++++++------ 5 files changed, 208 insertions(+), 110 deletions(-) diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx index 0c6e8fc7397c..fb9c62a7c26f 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -435,9 +435,9 @@ public: SAL_DLLPRIVATE SalLayout* ImplGlyphFallbackLayout( SalLayout*, ImplLayoutArgs& ) const; SAL_DLLPRIVATE long ImplGetTextWidth( const SalLayout& ) const; - SAL_DLLPRIVATE void ImplDrawText( const Rectangle& rRect, + static SAL_DLLPRIVATE void ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& rRect, const String& rOrigStr, USHORT nStyle, - MetricVector* pVector, String* pDisplayText, ::vcl::ITextLayout* _pLayout ); + MetricVector* pVector, String* pDisplayText, ::vcl::ITextLayout& _rLayout ); SAL_DLLPRIVATE void ImplDrawTextBackground( const SalLayout& ); SAL_DLLPRIVATE void ImplDrawTextLines( SalLayout&, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, BOOL bWordLine, BOOL bUnderlineAbove ); SAL_DLLPRIVATE bool ImplDrawRotateText( SalLayout& ); @@ -460,7 +460,7 @@ public: SAL_DLLPRIVATE void ImplDrawMnemonicLine( long nX, long nY, long nWidth ); SAL_DLLPRIVATE void ImplGetEmphasisMark( PolyPolygon& rPolyPoly, BOOL& rPolyLine, Rectangle& rRect1, Rectangle& rRect2, long& rYOff, long& rWidth, FontEmphasisMark eEmphasis, long nHeight, short nOrient ); SAL_DLLPRIVATE void ImplDrawEmphasisMark( long nBaseX, long nX, long nY, const PolyPolygon& rPolyPoly, BOOL bPolyLine, const Rectangle& rRect1, const Rectangle& rRect2 ); - SAL_DLLPRIVATE long ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const XubString& rStr, USHORT nStyle, const ::vcl::ITextLayout* _pLayout ) const; + static SAL_DLLPRIVATE long ImplGetTextLines( OutputDevice& rTargetDevice, ImplMultiTextLineInfo& rLineInfo, long nWidth, const XubString& rStr, USHORT nStyle, const ::vcl::ITextLayout& _rLayout ); SAL_DLLPRIVATE void ImplInitFontList() const; SAL_DLLPRIVATE void ImplUpdateFontData( bool bNewFontLists ); SAL_DLLPRIVATE static void ImplUpdateAllFontData( bool bNewFontLists ); diff --git a/vcl/inc/vcl/textlayout.hxx b/vcl/inc/vcl/textlayout.hxx index dbb7b2d17d77..2480775a42d0 100755 --- a/vcl/inc/vcl/textlayout.hxx +++ b/vcl/inc/vcl/textlayout.hxx @@ -55,16 +55,55 @@ namespace vcl MetricVector* _pVector, String* _pDisplayText ) = 0; + virtual bool GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, xub_StrLen nIndex, xub_StrLen nLen ) const = 0; + }; + + //==================================================================== + //= DefaultTextLayout + //==================================================================== + /** is an implementation of the ITextLayout interface which simply delegates its calls to the respective + methods of an OutputDevice instance, without any inbetween magic. + */ + class DefaultTextLayout : public ITextLayout + { + public: + DefaultTextLayout( OutputDevice& _rTargetDevice ) + :m_rTargetDevice( _rTargetDevice ) + { + } + virtual ~DefaultTextLayout(); + + // ITextLayout overridables + virtual long GetTextWidth( + const XubString& _rText, + xub_StrLen _nStartIndex, + xub_StrLen _nLength + ) const; + virtual void DrawText( + const Point& _rStartPoint, + const XubString& _rText, + xub_StrLen _nStartIndex, + xub_StrLen _nLength, + MetricVector* _pVector, + String* _pDisplayText + ); + virtual bool GetCaretPositions( + const XubString& _rText, + sal_Int32* _pCaretXArray, + xub_StrLen _nStartIndex, + xub_StrLen _nLength + ) const; + + private: + OutputDevice& m_rTargetDevice; }; //==================================================================== //= ControlTextRenderer //==================================================================== class ReferenceDeviceTextLayout; - /** a class which allows rendering text onto a device, but calculating the metrics according to a reference device - - The class provides a number of methods which are equivalent to the same methods of the OutputDevice, except - that OutputDevice does not know about reference devices. + /** a class which allows rendering text of a Control onto a device, by taking into account the metrics of + a reference device. */ class ControlTextRenderer { diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 7865ca507418..6d5817f0dffd 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -5256,9 +5256,9 @@ void OutputDevice::ImplDrawText( SalLayout& rSalLayout ) // ----------------------------------------------------------------------- -long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, +long OutputDevice::ImplGetTextLines( OutputDevice& rTargetDevice, ImplMultiTextLineInfo& rLineInfo, long nWidth, const XubString& rStr, - USHORT nStyle, const ::vcl::ITextLayout* _pLayout ) const + USHORT nStyle, const ::vcl::ITextLayout& _rLayout ) { DBG_ASSERTWARNING( nWidth >= 0, "ImplGetTextLines: nWidth <= 0!" ); @@ -5296,8 +5296,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, while ( ( nBreakPos < nLen ) && ( rStr.GetChar( nBreakPos ) != _CR ) && ( rStr.GetChar( nBreakPos ) != _LF ) ) nBreakPos++; - long nLineWidth = ( _pLayout != NULL ) ? _pLayout->GetTextWidth( rStr, nPos, nBreakPos-nPos ) - : GetTextWidth( rStr, nPos, nBreakPos-nPos ); + long nLineWidth = _rLayout.GetTextWidth( rStr, nPos, nBreakPos-nPos ); if ( ( nLineWidth > nWidth ) && ( nStyle & TEXT_DRAW_WORDBREAK ) ) { if ( !xBI.is() ) @@ -5306,7 +5305,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, if ( xBI.is() ) { const com::sun::star::lang::Locale& rDefLocale(Application::GetSettings().GetUILocale()); - xub_StrLen nSoftBreak = GetTextBreak( rStr, nWidth, nPos, nBreakPos - nPos ); + xub_StrLen nSoftBreak = rTargetDevice.GetTextBreak( rStr, nWidth, nPos, nBreakPos - nPos ); DBG_ASSERT( nSoftBreak < nBreakPos, "Break?!" ); //aHyphOptions.hyphenIndex = nSoftBreak; i18n::LineBreakResults aLBR = xBI->getLineBreak( aText, nSoftBreak, rDefLocale, nPos, aHyphOptions, aUserOptions ); @@ -5410,8 +5409,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, } // if ( xHyph.is() ) } // if ( (nStyle & TEXT_DRAW_WORDBREAK_HYPHENATION) == TEXT_DRAW_WORDBREAK_HYPHENATION ) } - nLineWidth = ( _pLayout != NULL ) ? _pLayout->GetTextWidth( rStr, nPos, nBreakPos-nPos ) - : GetTextWidth( rStr, nPos, nBreakPos-nPos ); + nLineWidth = _rLayout.GetTextWidth( rStr, nPos, nBreakPos-nPos ); } else { @@ -5425,16 +5423,14 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, { if( nSpacePos > nPos ) nSpacePos--; - nW = ( _pLayout != NULL ) ? _pLayout->GetTextWidth( rStr, nPos, nSpacePos-nPos ) - : GetTextWidth( rStr, nPos, nSpacePos-nPos ); + nW = _rLayout.GetTextWidth( rStr, nPos, nSpacePos-nPos ); } } while( nW > nWidth ); if( nSpacePos != STRING_NOTFOUND ) { nBreakPos = nSpacePos; - nLineWidth = ( _pLayout != NULL ) ? _pLayout->GetTextWidth( rStr, nPos, nBreakPos-nPos ) - : GetTextWidth( rStr, nPos, nBreakPos-nPos ); + nLineWidth = _rLayout.GetTextWidth( rStr, nPos, nBreakPos-nPos ); if( nBreakPos < rStr.Len()-1 ) nBreakPos++; } @@ -6776,10 +6772,10 @@ xub_StrLen OutputDevice::GetTextBreak( const String& rStr, long nTextWidth, // ----------------------------------------------------------------------- -void OutputDevice::ImplDrawText( const Rectangle& rRect, +void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& rRect, const String& rOrigStr, USHORT nStyle, MetricVector* pVector, String* pDisplayText, - ::vcl::ITextLayout* _pLayout ) + ::vcl::ITextLayout& _rLayout ) { Color aOldTextColor; Color aOldTextFillColor; @@ -6789,29 +6785,29 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, BOOL bHighContrastBlack = FALSE; BOOL bHighContrastWhite = FALSE; Color aCol; - if( IsBackground() ) - aCol = GetBackground().GetColor(); + if( rTargetDevice.IsBackground() ) + aCol = rTargetDevice.GetBackground().GetColor(); else // best guess is the face color here // but it may be totally wrong. the background color // was typically already reset - aCol = GetSettings().GetStyleSettings().GetFaceColor(); + aCol = rTargetDevice.GetSettings().GetStyleSettings().GetFaceColor(); bHighContrastBlack = aCol.IsDark(); - bHighContrastWhite = aCol.IsBright() && GetSettings().GetStyleSettings().GetHighContrastMode(); + bHighContrastWhite = aCol.IsBright() && rTargetDevice.GetSettings().GetStyleSettings().GetHighContrastMode(); - aOldTextColor = GetTextColor(); - if ( IsTextFillColor() ) + aOldTextColor = rTargetDevice.GetTextColor(); + if ( rTargetDevice.IsTextFillColor() ) { bRestoreFillColor = TRUE; - aOldTextFillColor = GetTextFillColor(); + aOldTextFillColor = rTargetDevice.GetTextFillColor(); } else bRestoreFillColor = FALSE; if( bHighContrastBlack ) - SetTextColor( COL_GREEN ); + rTargetDevice.SetTextColor( COL_GREEN ); else if( bHighContrastWhite ) - SetTextColor( COL_LIGHTGREEN ); + rTargetDevice.SetTextColor( COL_LIGHTGREEN ); else { // draw disabled text always without shadow @@ -6822,7 +6818,7 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, aRect.Move( 1, 1 ); DrawText( aRect, rOrigStr, nStyle & ~TEXT_DRAW_DISABLE ); */ - SetTextColor( GetSettings().GetStyleSettings().GetShadowColor() ); + rTargetDevice.SetTextColor( rTargetDevice.GetSettings().GetStyleSettings().GetShadowColor() ); } } @@ -6834,14 +6830,16 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, Point aPos = rRect.TopLeft(); - long nTextHeight = GetTextHeight(); - TextAlign eAlign = GetTextAlign(); + long nTextHeight = rTargetDevice.GetTextHeight(); + TextAlign eAlign = rTargetDevice.GetTextAlign(); xub_StrLen nMnemonicPos = STRING_NOTFOUND; String aStr = rOrigStr; if ( nStyle & TEXT_DRAW_MNEMONIC ) aStr = GetNonMnemonicString( aStr, nMnemonicPos ); + const bool bDrawMnemonics = !(rTargetDevice.GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) && !pVector; + // Mehrzeiligen Text behandeln wir anders if ( nStyle & TEXT_DRAW_MULTILINE ) { @@ -6856,7 +6854,7 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, if ( nTextHeight ) { - nMaxTextWidth = ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, _pLayout ); + nMaxTextWidth = ImplGetTextLines( rTargetDevice, aMultiLineInfo, nWidth, aStr, nStyle, _rLayout ); nLines = (xub_StrLen)(nHeight/nTextHeight); nFormatLines = aMultiLineInfo.Count(); if ( !nLines ) @@ -6878,7 +6876,7 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, if ( aLastLine.GetChar( i ) == _LF ) aLastLine.SetChar( i, ' ' ); } - aLastLine = GetEllipsisString( aLastLine, nWidth, nStyle ); + aLastLine = rTargetDevice.GetEllipsisString( aLastLine, nWidth, nStyle ); nStyle &= ~(TEXT_DRAW_VCENTER | TEXT_DRAW_BOTTOM); nStyle |= TEXT_DRAW_TOP; } @@ -6896,8 +6894,8 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, // Clipping setzen if ( nStyle & TEXT_DRAW_CLIP ) { - Push( PUSH_CLIPREGION ); - IntersectClipRegion( rRect ); + rTargetDevice.Push( PUSH_CLIPREGION ); + rTargetDevice.IntersectClipRegion( rRect ); } // Vertikales Alignment @@ -6910,7 +6908,7 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, if ( eAlign == ALIGN_BOTTOM ) aPos.Y() += nTextHeight; else if ( eAlign == ALIGN_BASELINE ) - aPos.Y() += GetFontMetric().GetAscent(); + aPos.Y() += rTargetDevice.GetFontMetric().GetAscent(); // Alle Zeilen ausgeben, bis auf die letzte for ( i = 0; i < nFormatLines; i++ ) @@ -6922,11 +6920,8 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, aPos.X() += (nWidth-pLineInfo->GetWidth())/2; xub_StrLen nIndex = pLineInfo->GetIndex(); xub_StrLen nLineLen = pLineInfo->GetLen(); - if ( _pLayout ) - _pLayout->DrawText( aPos, aStr, nIndex, nLineLen, pVector, pDisplayText ); - else - DrawText( aPos, aStr, nIndex, nLineLen, pVector, pDisplayText ); - if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) && !pVector ) + _rLayout.DrawText( aPos, aStr, nIndex, nLineLen, pVector, pDisplayText ); + if ( bDrawMnemonics ) { if ( (nMnemonicPos >= nIndex) && (nMnemonicPos < nIndex+nLineLen) ) { @@ -6935,16 +6930,16 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, long nMnemonicWidth; sal_Int32* pCaretXArray = (sal_Int32*) alloca( 2 * sizeof(sal_Int32) * nLineLen ); - /*BOOL bRet =*/ GetCaretPositions( aStr, pCaretXArray, - nIndex, nLineLen); + /*BOOL bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray, + nIndex, nLineLen ); long lc_x1 = pCaretXArray[2*(nMnemonicPos - nIndex)]; long lc_x2 = pCaretXArray[2*(nMnemonicPos - nIndex)+1]; - nMnemonicWidth = ::abs((int)(lc_x1 - lc_x2)); + nMnemonicWidth = rTargetDevice.ImplLogicWidthToDevicePixel( ::abs((int)(lc_x1 - lc_x2)) ); - Point aTempPos = LogicToPixel( aPos ); - nMnemonicX = mnOutOffX + aTempPos.X() + ImplLogicWidthToDevicePixel( Min( lc_x1, lc_x2 ) ); - nMnemonicY = mnOutOffY + aTempPos.Y() + ImplLogicWidthToDevicePixel( GetFontMetric().GetAscent() ); - ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth ); + Point aTempPos = rTargetDevice.LogicToPixel( aPos ); + nMnemonicX = rTargetDevice.GetOutOffXPixel() + aTempPos.X() + rTargetDevice.ImplLogicWidthToDevicePixel( Min( lc_x1, lc_x2 ) ); + nMnemonicY = rTargetDevice.GetOutOffYPixel() + aTempPos.Y() + rTargetDevice.ImplLogicWidthToDevicePixel( rTargetDevice.GetFontMetric().GetAscent() ); + rTargetDevice.ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth ); } } aPos.Y() += nTextHeight; @@ -6955,31 +6950,26 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, // Gibt es noch eine letzte Zeile, dann diese linksbuendig ausgeben, // da die Zeile gekuerzt wurde if ( aLastLine.Len() ) - if ( _pLayout ) - _pLayout->DrawText( aPos, aLastLine, 0, STRING_LEN, pVector, pDisplayText ); - else - DrawText( aPos, aLastLine, 0, STRING_LEN, pVector, pDisplayText ); + _rLayout.DrawText( aPos, aLastLine, 0, STRING_LEN, pVector, pDisplayText ); // Clipping zuruecksetzen if ( nStyle & TEXT_DRAW_CLIP ) - Pop(); + rTargetDevice.Pop(); } } else { - long nTextWidth = _pLayout - ? _pLayout->GetTextWidth( aStr, 0, STRING_LEN ) - : GetTextWidth( aStr ); + long nTextWidth = _rLayout.GetTextWidth( aStr, 0, STRING_LEN ); // Evt. Text kuerzen if ( nTextWidth > nWidth ) { if ( nStyle & TEXT_DRAW_ELLIPSIS ) { - aStr = GetEllipsisString( aStr, nWidth, nStyle ); + aStr = rTargetDevice.GetEllipsisString( aStr, nWidth, nStyle ); nStyle &= ~(TEXT_DRAW_CENTER | TEXT_DRAW_RIGHT); nStyle |= TEXT_DRAW_LEFT; - nTextWidth = GetTextWidth( aStr ); + nTextWidth = _rLayout.GetTextWidth( aStr, 0, aStr.Len() ); } } else @@ -6998,7 +6988,7 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, if ( eAlign == ALIGN_BOTTOM ) aPos.Y() += nTextHeight; else if ( eAlign == ALIGN_BASELINE ) - aPos.Y() += GetFontMetric().GetAscent(); + aPos.Y() += rTargetDevice.GetFontMetric().GetAscent(); if ( nStyle & TEXT_DRAW_BOTTOM ) aPos.Y() += nHeight-nTextHeight; @@ -7011,50 +7001,44 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, if ( nMnemonicPos != STRING_NOTFOUND ) { sal_Int32* pCaretXArray = (sal_Int32*) alloca( 2 * sizeof(sal_Int32) * aStr.Len() ); - /*BOOL bRet =*/ GetCaretPositions( aStr, pCaretXArray, 0, aStr.Len() ); + /*BOOL bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray, 0, aStr.Len() ); long lc_x1 = pCaretXArray[2*(nMnemonicPos)]; long lc_x2 = pCaretXArray[2*(nMnemonicPos)+1]; - nMnemonicWidth = ::abs((int)(lc_x1 - lc_x2)); + nMnemonicWidth = rTargetDevice.ImplLogicWidthToDevicePixel( ::abs((int)(lc_x1 - lc_x2)) ); - Point aTempPos = LogicToPixel( aPos ); - nMnemonicX = mnOutOffX + aTempPos.X() + ImplLogicWidthToDevicePixel( Min(lc_x1, lc_x2) ); - nMnemonicY = mnOutOffY + aTempPos.Y() + ImplLogicWidthToDevicePixel( GetFontMetric().GetAscent() ); + Point aTempPos = rTargetDevice.LogicToPixel( aPos ); + nMnemonicX = rTargetDevice.GetOutOffXPixel() + aTempPos.X() + rTargetDevice.ImplLogicWidthToDevicePixel( Min(lc_x1, lc_x2) ); + nMnemonicY = rTargetDevice.GetOutOffYPixel() + aTempPos.Y() + rTargetDevice.ImplLogicWidthToDevicePixel( rTargetDevice.GetFontMetric().GetAscent() ); } if ( nStyle & TEXT_DRAW_CLIP ) { - Push( PUSH_CLIPREGION ); - IntersectClipRegion( rRect ); - if ( _pLayout ) - _pLayout->DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText ); - else - DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText ); - if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) && !pVector ) + rTargetDevice.Push( PUSH_CLIPREGION ); + rTargetDevice.IntersectClipRegion( rRect ); + _rLayout.DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText ); + if ( bDrawMnemonics ) { if ( nMnemonicPos != STRING_NOTFOUND ) - ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth ); + rTargetDevice.ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth ); } - Pop(); + rTargetDevice.Pop(); } else { - if ( _pLayout ) - _pLayout->DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText ); - else - DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText ); - if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) && !pVector ) + _rLayout.DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText ); + if ( bDrawMnemonics ) { if ( nMnemonicPos != STRING_NOTFOUND ) - ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth ); + rTargetDevice.ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth ); } } } if ( nStyle & TEXT_DRAW_DISABLE && !pVector ) { - SetTextColor( aOldTextColor ); + rTargetDevice.SetTextColor( aOldTextColor ); if ( bRestoreFillColor ) - SetTextFillColor( aOldTextFillColor ); + rTargetDevice.SetTextFillColor( aOldTextFillColor ); } } @@ -7087,7 +7071,8 @@ void OutputDevice::AddTextRectActions( const Rectangle& rRect, // #i47157# Factored out to ImplDrawTextRect(), to be shared // between us and DrawText() - ImplDrawText( rRect, rOrigStr, nStyle, NULL, NULL, NULL ); + DefaultTextLayout aLayout( *this ); + ImplDrawText( *this, rRect, rOrigStr, nStyle, NULL, NULL, aLayout ); // and restore again EnableOutput( bOutputEnabled ); @@ -7130,7 +7115,8 @@ void OutputDevice::DrawText( const Rectangle& rRect, const String& rOrigStr, USH // #i47157# Factored out to ImplDrawText(), to be used also // from AddTextRectActions() - ImplDrawText( rRect, rOrigStr, nStyle, pVector, pDisplayText, _pTextLayout ); + DefaultTextLayout aDefaultLayout( *this ); + ImplDrawText( *this, rRect, rOrigStr, nStyle, pVector, pDisplayText, _pTextLayout ? *_pTextLayout : aDefaultLayout ); // and enable again mpMetaFile = pMtf; @@ -7167,7 +7153,8 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, xub_StrLen i; nMaxWidth = 0; - ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, _pTextLayout ); + DefaultTextLayout aDefaultLayout( *const_cast< OutputDevice* >( this ) ); + ImplGetTextLines( *const_cast< OutputDevice* >( this ), aMultiLineInfo, nWidth, aStr, nStyle, _pTextLayout ? *_pTextLayout : aDefaultLayout ); nFormatLines = aMultiLineInfo.Count(); if ( !nTextHeight ) nTextHeight = 1; diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 3eda6b5c929c..0ce6df6bc85f 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -41,7 +41,6 @@ #include #include #include -#include //for relative url #include #include #include @@ -51,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -7307,7 +7307,8 @@ void PDFWriterImpl::drawText( const Rectangle& rRect, const String& rOrigStr, US if ( nTextHeight ) { - nMaxTextWidth = m_pReferenceDevice->ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, NULL ); + ::vcl::DefaultTextLayout aLayout( *m_pReferenceDevice ); + nMaxTextWidth = OutputDevice::ImplGetTextLines( *m_pReferenceDevice, aMultiLineInfo, nWidth, aStr, nStyle, aLayout ); nLines = (xub_StrLen)(nHeight/nTextHeight); nFormatLines = aMultiLineInfo.Count(); if ( !nLines ) diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx index ddb8979a1a73..dd00414837d1 100755 --- a/vcl/source/gdi/textlayout.cxx +++ b/vcl/source/gdi/textlayout.cxx @@ -36,6 +36,34 @@ namespace vcl { //........................................................................ + //==================================================================== + //= DefaultTextLayout + //==================================================================== + //-------------------------------------------------------------------- + DefaultTextLayout::~DefaultTextLayout() + { + } + + //-------------------------------------------------------------------- + long DefaultTextLayout::GetTextWidth( const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const + { + return m_rTargetDevice.GetTextWidth( _rText, _nStartIndex, _nLength ); + } + + //-------------------------------------------------------------------- + void DefaultTextLayout::DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex, + xub_StrLen _nLength, MetricVector* _pVector, String* _pDisplayText ) + { + m_rTargetDevice.DrawText( _rStartPoint, _rText, _nStartIndex, _nLength, _pVector, _pDisplayText ); + } + + //-------------------------------------------------------------------- + bool DefaultTextLayout::GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, + xub_StrLen _nStartIndex, xub_StrLen _nLength ) const + { + return m_rTargetDevice.GetCaretPositions( _rText, _pCaretXArray, _nStartIndex, _nLength ); + } + //==================================================================== //= ReferenceDeviceTextLayout //==================================================================== @@ -48,6 +76,7 @@ namespace vcl // ITextLayout virtual long GetTextWidth( const XubString& rStr, xub_StrLen nIndex, xub_StrLen nLen ) const; virtual void DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength, MetricVector* _pVector, String* _pDisplayText ); + virtual bool GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const; public: // equivalents to the respective OutputDevice methods, which take the reference device into account @@ -84,11 +113,17 @@ namespace vcl ,m_aUnzoomedPointFont( _rControl.GetUnzoomedControlPointFont() ) ,m_aZoom( _rControl.GetZoom() ) { + // normally, controls simulate "zoom" by "zooming" the font. This is responsible for (part of) the discrepancies + // between text in Writer and text in controls in Writer, though both have the same font. + // So, if we have a zoom set at the control, then we do not scale the font, but instead modify the map mode + // to accomodate for the zoom. if ( IsZoom() ) { m_rTargetDevice.Push( PUSH_MAPMODE | PUSH_FONT ); MapMode aDrawMapMode( m_rTargetDevice.GetMapMode() ); + OSL_ENSURE( aDrawMapMode.GetOrigin() == Point(), "ReferenceDeviceTextLayout::ReferenceDeviceTextLayout: uhm, the code below won't work here ..." ); + aDrawMapMode.SetScaleX( m_aZoom ); // TODO: shouldn't this be "current_scale * zoom"? aDrawMapMode.SetScaleY( m_aZoom ); m_rTargetDevice.SetMapMode( aDrawMapMode ); @@ -101,6 +136,22 @@ namespace vcl aDrawFont.SetSize( m_rTargetDevice.LogicToLogic( aDrawFont.GetSize(), MAP_POINT, eTargetMapUnit ) ); _rTargetDevice.SetFont( aDrawFont ); } + + // transfer font to the reference device + m_rReferenceDevice.Push( PUSH_FONT ); + Font aRefFont( m_aUnzoomedPointFont ); + aRefFont.SetSize( OutputDevice::LogicToLogic( + aRefFont.GetSize(), MAP_POINT, m_rReferenceDevice.GetMapMode().GetMapUnit() ) ); + m_rReferenceDevice.SetFont( aRefFont ); + + } + + //-------------------------------------------------------------------- + ReferenceDeviceTextLayout::~ReferenceDeviceTextLayout() + { + if ( IsZoom() ) + m_rTargetDevice.Pop(); + m_rReferenceDevice.Pop(); } //-------------------------------------------------------------------- @@ -145,13 +196,6 @@ namespace vcl }; } - //-------------------------------------------------------------------- - ReferenceDeviceTextLayout::~ReferenceDeviceTextLayout() - { - if ( IsZoom() ) - m_rTargetDevice.Pop(); - } - //-------------------------------------------------------------------- bool ReferenceDeviceTextLayout::IsZoom() const { @@ -164,16 +208,8 @@ namespace vcl if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) ) return 0; - // transfer font to the reference device - m_rReferenceDevice.Push( PUSH_FONT ); - Font aRefFont( m_aUnzoomedPointFont ); - aRefFont.SetSize( OutputDevice::LogicToLogic( - aRefFont.GetSize(), MAP_POINT, m_rReferenceDevice.GetMapMode().GetMapUnit() ) ); - m_rReferenceDevice.SetFont( aRefFont ); - // retrieve the character widths from the reference device long nTextWidth = m_rReferenceDevice.GetTextArray( _rText, _pDXAry, _nStartIndex, _nLength ); - m_rReferenceDevice.Pop(); // adjust the widths, which are in ref-device units, to the target device DeviceUnitMapping aMapping( m_rTargetDevice, m_rReferenceDevice ); @@ -211,6 +247,41 @@ namespace vcl (void)_pDisplayText; } + //-------------------------------------------------------------------- + bool ReferenceDeviceTextLayout::GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, + xub_StrLen _nStartIndex, xub_StrLen _nLength ) const + { + if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) ) + return false; + + // retrieve the caret positions from the reference device + if ( !m_rReferenceDevice.GetCaretPositions( _rText, _pCaretXArray, _nStartIndex, _nLength ) ) + return false; + + // adjust the positions, which are in ref-device units, to the target device + DeviceUnitMapping aMapping( m_rTargetDevice, m_rReferenceDevice ); + for ( size_t i=0; i<2*size_t(_nLength); ++i ) + _pCaretXArray[i] = aMapping.mapToTarget( _pCaretXArray[i] ); + + return true; + } + + //-------------------------------------------------------------------- + namespace + { + long zoomBy( long _value, const Fraction& _zoom ) + { + double n = (double)_value; + n *= (double)_zoom.GetNumerator(); + n /= (double)_zoom.GetDenominator(); + return (long)::rtl::math::round( n ); + } + long unzoomBy( long _value, const Fraction& _zoom ) + { + return zoomBy( _value, Fraction( _zoom.GetDenominator(), _zoom.GetNumerator() ) ); + } + } + //-------------------------------------------------------------------- Rectangle ReferenceDeviceTextLayout::DrawText( const Rectangle& _rRect, const XubString& _rText, USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText) { @@ -219,10 +290,10 @@ namespace vcl { // if there's a zoom factor involved, then we tampered with the target device's map mode in the ctor. // Need to adjust the rectangle to this - aRect.Left() = long( aRect.Left() / (double)m_aZoom ); - aRect.Right() = long( aRect.Right() / (double)m_aZoom ); - aRect.Top() = long( aRect.Top() / (double)m_aZoom ); - aRect.Bottom() = long( aRect.Bottom() / (double)m_aZoom ); + aRect.Left() = unzoomBy( aRect.Left(), m_aZoom ); + aRect.Right() = unzoomBy( aRect.Right(), m_aZoom ); + aRect.Top() = unzoomBy( aRect.Top(), m_aZoom ); + aRect.Bottom() = unzoomBy( aRect.Bottom(), m_aZoom ); } #ifdef FS_DEBUG @@ -240,10 +311,10 @@ namespace vcl { // similar to above, transform the to-be-returned rectanle to coordinates which are meaningful // with the original map mode of the target device - aTextRect.Left() = long( aTextRect.Left() * (double)m_aZoom ); - aTextRect.Right() = long( aTextRect.Right() * (double)m_aZoom ); - aTextRect.Top() = long( aTextRect.Top() * (double)m_aZoom ); - aTextRect.Bottom() = long( aTextRect.Bottom() * (double)m_aZoom ); + aTextRect.Left() = zoomBy( aTextRect.Left(), m_aZoom ); + aTextRect.Right() = zoomBy( aTextRect.Right(), m_aZoom ); + aTextRect.Top() = zoomBy( aTextRect.Top(), m_aZoom ); + aTextRect.Bottom() = zoomBy( aTextRect.Bottom(), m_aZoom ); } return aTextRect; -- cgit From c98633656a5ad087d8242e20e9d14c6f69aa74af Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Fri, 18 Sep 2009 12:59:28 +0000 Subject: #b6875455# - introduced (static) ImplGetEllipsesString, taking an OutputDevice and an ITextLayout - introduced ITextLayout::GetTextBreak => with this change, all text-related operations in OutputDevice::ImplDrawText and OutputDevice::ImplGetTextLines should be routed through the ITextLayout interface --- vcl/inc/vcl/outdev.hxx | 9 ++++-- vcl/inc/vcl/textlayout.hxx | 65 ++++++++++++++++++++++++------------------- vcl/source/control/ctrl.cxx | 17 ++++++----- vcl/source/gdi/outdev3.cxx | 33 ++++++++++++++-------- vcl/source/gdi/textlayout.cxx | 33 +++++++++++++++++++--- 5 files changed, 103 insertions(+), 54 deletions(-) diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx index fb9c62a7c26f..094a646163ca 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -435,7 +435,11 @@ public: SAL_DLLPRIVATE SalLayout* ImplGlyphFallbackLayout( SalLayout*, ImplLayoutArgs& ) const; SAL_DLLPRIVATE long ImplGetTextWidth( const SalLayout& ) const; - static SAL_DLLPRIVATE void ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& rRect, + static + SAL_DLLPRIVATE XubString ImplGetEllipsisString( const OutputDevice& rTargetDevice, const XubString& rStr, + long nMaxWidth, USHORT nStyle, const ::vcl::ITextLayout& _rLayout ); + static + SAL_DLLPRIVATE void ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& rRect, const String& rOrigStr, USHORT nStyle, MetricVector* pVector, String* pDisplayText, ::vcl::ITextLayout& _rLayout ); SAL_DLLPRIVATE void ImplDrawTextBackground( const SalLayout& ); @@ -460,7 +464,8 @@ public: SAL_DLLPRIVATE void ImplDrawMnemonicLine( long nX, long nY, long nWidth ); SAL_DLLPRIVATE void ImplGetEmphasisMark( PolyPolygon& rPolyPoly, BOOL& rPolyLine, Rectangle& rRect1, Rectangle& rRect2, long& rYOff, long& rWidth, FontEmphasisMark eEmphasis, long nHeight, short nOrient ); SAL_DLLPRIVATE void ImplDrawEmphasisMark( long nBaseX, long nX, long nY, const PolyPolygon& rPolyPoly, BOOL bPolyLine, const Rectangle& rRect1, const Rectangle& rRect2 ); - static SAL_DLLPRIVATE long ImplGetTextLines( OutputDevice& rTargetDevice, ImplMultiTextLineInfo& rLineInfo, long nWidth, const XubString& rStr, USHORT nStyle, const ::vcl::ITextLayout& _rLayout ); + static + SAL_DLLPRIVATE long ImplGetTextLines( OutputDevice& rTargetDevice, ImplMultiTextLineInfo& rLineInfo, long nWidth, const XubString& rStr, USHORT nStyle, const ::vcl::ITextLayout& _rLayout ); SAL_DLLPRIVATE void ImplInitFontList() const; SAL_DLLPRIVATE void ImplUpdateFontData( bool bNewFontLists ); SAL_DLLPRIVATE static void ImplUpdateAllFontData( bool bNewFontLists ); diff --git a/vcl/inc/vcl/textlayout.hxx b/vcl/inc/vcl/textlayout.hxx index 2480775a42d0..38e2580ae496 100755 --- a/vcl/inc/vcl/textlayout.hxx +++ b/vcl/inc/vcl/textlayout.hxx @@ -46,16 +46,17 @@ namespace vcl class SAL_NO_VTABLE ITextLayout { public: - virtual long GetTextWidth( const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const = 0; - virtual void DrawText( - const Point& _rStartPoint, - const XubString& _rText, - xub_StrLen _nStartIndex, - xub_StrLen _nLength, - MetricVector* _pVector, - String* _pDisplayText - ) = 0; - virtual bool GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, xub_StrLen nIndex, xub_StrLen nLen ) const = 0; + virtual long GetTextWidth( const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const = 0; + virtual void DrawText( + const Point& _rStartPoint, + const XubString& _rText, + xub_StrLen _nStartIndex, + xub_StrLen _nLength, + MetricVector* _pVector, + String* _pDisplayText + ) = 0; + virtual bool GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const = 0; + virtual xub_StrLen GetTextBreak( const XubString& _rText, long _nMaxTextWidth, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const = 0; }; //==================================================================== @@ -74,25 +75,31 @@ namespace vcl virtual ~DefaultTextLayout(); // ITextLayout overridables - virtual long GetTextWidth( - const XubString& _rText, - xub_StrLen _nStartIndex, - xub_StrLen _nLength - ) const; - virtual void DrawText( - const Point& _rStartPoint, - const XubString& _rText, - xub_StrLen _nStartIndex, - xub_StrLen _nLength, - MetricVector* _pVector, - String* _pDisplayText - ); - virtual bool GetCaretPositions( - const XubString& _rText, - sal_Int32* _pCaretXArray, - xub_StrLen _nStartIndex, - xub_StrLen _nLength - ) const; + virtual long GetTextWidth( + const XubString& _rText, + xub_StrLen _nStartIndex, + xub_StrLen _nLength + ) const; + virtual void DrawText( + const Point& _rStartPoint, + const XubString& _rText, + xub_StrLen _nStartIndex, + xub_StrLen _nLength, + MetricVector* _pVector, + String* _pDisplayText + ); + virtual bool GetCaretPositions( + const XubString& _rText, + sal_Int32* _pCaretXArray, + xub_StrLen _nStartIndex, + xub_StrLen _nLength + ) const; + virtual xub_StrLen GetTextBreak( + const XubString& _rText, + long _nMaxTextWidth, + xub_StrLen _nStartIndex, + xub_StrLen _nLength + ) const; private: OutputDevice& m_rTargetDevice; diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index 8df7e2decd1a..5ae6b41a8d7f 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -562,16 +562,19 @@ void Control::DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRec } #ifdef FS_DEBUG - _rTargetDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR | PUSH_TEXTCOLOR ); + { + _rTargetDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR | PUSH_TEXTCOLOR ); - _rTargetDevice.SetTextColor( COL_LIGHTRED ); - _rTargetDevice.DrawText( _io_rRect, _rStr, _nStyle, _pVector, _pDisplayText ); + _rTargetDevice.SetTextColor( COL_LIGHTRED ); + Rectangle aTextRect = _rTargetDevice.GetTextRect( _io_rRect, _rStr, _nStyle ); + _rTargetDevice.DrawText( aTextRect, _rStr, _nStyle, _pVector, _pDisplayText ); - _rTargetDevice.SetLineColor( COL_LIGHTRED ); - _rTargetDevice.SetFillColor(); - _rTargetDevice.DrawRect( _io_rRect ); + _rTargetDevice.SetLineColor( COL_LIGHTRED ); + _rTargetDevice.SetFillColor(); + _rTargetDevice.DrawRect( _io_rRect ); - _rTargetDevice.Pop(); + _rTargetDevice.Pop(); + } #endif { diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 6d5817f0dffd..268db2ba7c92 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -5305,7 +5305,7 @@ long OutputDevice::ImplGetTextLines( OutputDevice& rTargetDevice, ImplMultiTextL if ( xBI.is() ) { const com::sun::star::lang::Locale& rDefLocale(Application::GetSettings().GetUILocale()); - xub_StrLen nSoftBreak = rTargetDevice.GetTextBreak( rStr, nWidth, nPos, nBreakPos - nPos ); + xub_StrLen nSoftBreak = _rLayout.GetTextBreak( rStr, nWidth, nPos, nBreakPos - nPos ); DBG_ASSERT( nSoftBreak < nBreakPos, "Break?!" ); //aHyphOptions.hyphenIndex = nSoftBreak; i18n::LineBreakResults aLBR = xBI->getLineBreak( aText, nSoftBreak, rDefLocale, nPos, aHyphOptions, aUserOptions ); @@ -6876,7 +6876,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r if ( aLastLine.GetChar( i ) == _LF ) aLastLine.SetChar( i, ' ' ); } - aLastLine = rTargetDevice.GetEllipsisString( aLastLine, nWidth, nStyle ); + aLastLine = ImplGetEllipsisString( rTargetDevice, aLastLine, nWidth, nStyle, _rLayout ); nStyle &= ~(TEXT_DRAW_VCENTER | TEXT_DRAW_BOTTOM); nStyle |= TEXT_DRAW_TOP; } @@ -6966,7 +6966,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r { if ( nStyle & TEXT_DRAW_ELLIPSIS ) { - aStr = rTargetDevice.GetEllipsisString( aStr, nWidth, nStyle ); + aStr = ImplGetEllipsisString( rTargetDevice, aStr, nWidth, nStyle, _rLayout ); nStyle &= ~(TEXT_DRAW_CENTER | TEXT_DRAW_RIGHT); nStyle |= TEXT_DRAW_LEFT; nTextWidth = _rLayout.GetTextWidth( aStr, 0, aStr.Len() ); @@ -7261,11 +7261,20 @@ static BOOL ImplIsCharIn( xub_Unicode c, const sal_Char* pStr ) String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth, USHORT nStyle ) const { - DBG_TRACE( "OutputDevice::GetEllipsisString()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); + DefaultTextLayout aTextLayout( *const_cast< OutputDevice* >( this ) ); + return ImplGetEllipsisString( *this, rOrigStr, nMaxWidth, nStyle, aTextLayout ); +} + +// ----------------------------------------------------------------------- + +String OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, const XubString& rOrigStr, long nMaxWidth, + USHORT nStyle, const ::vcl::ITextLayout& _rLayout ) +{ + DBG_TRACE( "OutputDevice::ImplGetEllipsisString()" ); String aStr = rOrigStr; - xub_StrLen nIndex = GetTextBreak( aStr, nMaxWidth ); + xub_StrLen nIndex = _rLayout.GetTextBreak( aStr, nMaxWidth, 0, aStr.Len() ); if ( nIndex != STRING_LEN ) @@ -7276,7 +7285,7 @@ String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth, if ( nIndex > 1 ) { aStr.AppendAscii( "..." ); - while ( aStr.Len() && (GetTextWidth( aStr ) > nMaxWidth) ) + while ( aStr.Len() && (_rLayout.GetTextWidth( aStr, 0, aStr.Len() ) > nMaxWidth) ) { if ( (nIndex > 1) || (nIndex == aStr.Len()) ) nIndex--; @@ -7312,8 +7321,8 @@ String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth, XubString aLastStr( aStr, nLastContent, aStr.Len() ); XubString aTempLastStr1( RTL_CONSTASCII_USTRINGPARAM( "..." ) ); aTempLastStr1 += aLastStr; - if ( GetTextWidth( aTempLastStr1 ) > nMaxWidth ) - aStr = GetEllipsisString( aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS ); + if ( _rLayout.GetTextWidth( aTempLastStr1, 0, aTempLastStr1.Len() ) > nMaxWidth ) + aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS, _rLayout ); else { USHORT nFirstContent = 0; @@ -7328,7 +7337,7 @@ String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth, nFirstContent++; if ( nFirstContent >= nLastContent ) - aStr = GetEllipsisString( aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS ); + aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS, _rLayout ); else { if ( nFirstContent > 4 ) @@ -7337,8 +7346,8 @@ String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth, aFirstStr.AppendAscii( "..." ); XubString aTempStr = aFirstStr; aTempStr += aLastStr; - if ( GetTextWidth( aTempStr ) > nMaxWidth ) - aStr = GetEllipsisString( aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS ); + if ( _rLayout.GetTextWidth( aTempStr, 0, aTempStr.Len() ) > nMaxWidth ) + aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS, _rLayout ); else { do @@ -7362,7 +7371,7 @@ String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth, XubString aTempLastStr( aStr, nLastContent, aStr.Len() ); aTempStr = aFirstStr; aTempStr += aTempLastStr; - if ( GetTextWidth( aTempStr ) > nMaxWidth ) + if ( _rLayout.GetTextWidth( aTempStr, 0, aTempStr.Len() ) > nMaxWidth ) break; } } diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx index dd00414837d1..a555709e0786 100755 --- a/vcl/source/gdi/textlayout.cxx +++ b/vcl/source/gdi/textlayout.cxx @@ -64,6 +64,12 @@ namespace vcl return m_rTargetDevice.GetCaretPositions( _rText, _pCaretXArray, _nStartIndex, _nLength ); } + //-------------------------------------------------------------------- + xub_StrLen DefaultTextLayout::GetTextBreak( const XubString& _rText, long _nMaxTextWidth, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const + { + return m_rTargetDevice.GetTextBreak( _rText, _nMaxTextWidth, _nStartIndex, _nLength ); + } + //==================================================================== //= ReferenceDeviceTextLayout //==================================================================== @@ -74,9 +80,10 @@ namespace vcl virtual ~ReferenceDeviceTextLayout(); // ITextLayout - virtual long GetTextWidth( const XubString& rStr, xub_StrLen nIndex, xub_StrLen nLen ) const; - virtual void DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength, MetricVector* _pVector, String* _pDisplayText ); - virtual bool GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const; + virtual long GetTextWidth( const XubString& rStr, xub_StrLen nIndex, xub_StrLen nLen ) const; + virtual void DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength, MetricVector* _pVector, String* _pDisplayText ); + virtual bool GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const; + virtual xub_StrLen GetTextBreak( const XubString& _rText, long _nMaxTextWidth, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const; public: // equivalents to the respective OutputDevice methods, which take the reference device into account @@ -174,6 +181,7 @@ namespace vcl public: DeviceUnitMapping( const OutputDevice& _rTargetDevice, const OutputDevice& _rReferenceDevice ) :m_rTargetDevice( _rTargetDevice ) + ,m_rReferenceDevice( _rReferenceDevice ) ,m_eTargetMapUnit( _rTargetDevice.GetMapMode().GetMapUnit() ) ,m_bTargetIsPixel( _rTargetDevice.GetMapMode().GetMapUnit() == MAP_PIXEL ) ,m_eRefMapUnit( _rReferenceDevice.GetMapMode().GetMapUnit() ) @@ -185,11 +193,18 @@ namespace vcl { return m_bTargetIsPixel ? m_rTargetDevice.LogicToPixel( Size( _nWidth, 0 ), m_eRefMapUnit ).Width() - : m_rTargetDevice.LogicToLogic( Size( _nWidth, 0 ), m_eRefMapUnit, m_eTargetMapUnit ).Width(); + : OutputDevice::LogicToLogic( Size( _nWidth, 0 ), m_eRefMapUnit, m_eTargetMapUnit ).Width(); + } + long mapToReference( long _nWidth ) + { + return m_bTargetIsPixel + ? m_rTargetDevice.PixelToLogic( Size( _nWidth, 0 ), m_eRefMapUnit ).Width() + : OutputDevice::LogicToLogic( Size( _nWidth, 0 ), m_eTargetMapUnit, m_eRefMapUnit ).Width(); } private: const OutputDevice& m_rTargetDevice; + const OutputDevice& m_rReferenceDevice; const MapUnit m_eTargetMapUnit; const bool m_bTargetIsPixel; const MapUnit m_eRefMapUnit; @@ -266,6 +281,16 @@ namespace vcl return true; } + //-------------------------------------------------------------------- + xub_StrLen ReferenceDeviceTextLayout::GetTextBreak( const XubString& _rText, long _nMaxTextWidth, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const + { + if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) ) + return 0; + + DeviceUnitMapping aMapping( m_rTargetDevice, m_rReferenceDevice ); + return m_rReferenceDevice.GetTextBreak( _rText, aMapping.mapToReference( _nMaxTextWidth ), _nStartIndex, _nLength ); + } + //-------------------------------------------------------------------- namespace { -- cgit From 8fba7530a9ee5e96b21afa88e3eb177b41cba951 Mon Sep 17 00:00:00 2001 From: Noel Power Date: Fri, 18 Sep 2009 15:24:22 +0000 Subject: initial commit of code reorg, existing files that are modified --- comphelper/inc/comphelper/servicedecl.hxx | 60 +++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 14 deletions(-) diff --git a/comphelper/inc/comphelper/servicedecl.hxx b/comphelper/inc/comphelper/servicedecl.hxx index a11598bdca85..7b77d3ba29e7 100644 --- a/comphelper/inc/comphelper/servicedecl.hxx +++ b/comphelper/inc/comphelper/servicedecl.hxx @@ -169,21 +169,20 @@ template struct with_args; /// @internal namespace detail { - template -class ServiceImpl - : public ::cppu::ImplInheritanceHelper1, +class OwnServiceImpl + : public ImplT, private ::boost::noncopyable { - typedef ::cppu::ImplInheritanceHelper1 BaseT; + typedef ImplT BaseT; public: - ServiceImpl( + OwnServiceImpl( ServiceDecl const& rServiceDecl, css::uno::Sequence const& args, css::uno::Reference const& xContext ) - : BaseT(args, xContext), m_rServiceDecl(rServiceDecl) {} - ServiceImpl( + :BaseT(args, xContext), m_rServiceDecl(rServiceDecl) {} + OwnServiceImpl( ServiceDecl const& rServiceDecl, css::uno::Reference const& xContext ) : BaseT(xContext), m_rServiceDecl(rServiceDecl) {} @@ -206,6 +205,22 @@ private: ServiceDecl const& m_rServiceDecl; }; +template +class ServiceImpl : public OwnServiceImpl< ::cppu::ImplInheritanceHelper1 > +{ +typedef OwnServiceImpl< ::cppu::ImplInheritanceHelper1 > ServiceImpl_BASE; +public: + ServiceImpl( + ServiceDecl const& rServiceDecl, + css::uno::Sequence const& args, + css::uno::Reference const& xContext ) + : ServiceImpl_BASE(rServiceDecl, args, xContext) {} + ServiceImpl( + ServiceDecl const& rServiceDecl, + css::uno::Reference const& xContext ) + : ServiceImpl_BASE(rServiceDecl, xContext) {} +}; + template struct PostProcessDefault { css::uno::Reference @@ -230,7 +245,7 @@ struct CreateFunc > { const& xContext ) const { return m_postProcessFunc( - new ServiceImpl( rServiceDecl, xContext ) ); + new ImplT( rServiceDecl, xContext ) ); } }; @@ -247,7 +262,7 @@ struct CreateFunc > { const& xContext ) const { return m_postProcessFunc( - new ServiceImpl( rServiceDecl, args, xContext ) ); + new ImplT( rServiceDecl, args, xContext ) ); } }; @@ -261,18 +276,17 @@ struct CreateFunc > { or just (uno::Reference) */ template > -struct class_ { +struct serviceimpl_base { typedef ImplT_ ImplT; - typedef detail::ServiceImpl ServiceImplT; detail::CreateFuncF const m_createFunc; - typedef detail::PostProcessDefault PostProcessDefaultT; + typedef detail::PostProcessDefault PostProcessDefaultT; /** Default ctor. Implementation class without args, expecting component context as single argument. */ - class_() : m_createFunc( + serviceimpl_base() : m_createFunc( detail::CreateFunc( PostProcessDefaultT() ) ) {} @@ -284,11 +298,29 @@ struct class_ { uno::Reference */ template - explicit class_( PostProcessFuncT const& postProcessFunc ) + explicit serviceimpl_base( PostProcessFuncT const& postProcessFunc ) : m_createFunc( detail::CreateFunc( postProcessFunc ) ) {} }; +template > +struct class_ : public serviceimpl_base< detail::ServiceImpl, WithArgsT > +{ + typedef serviceimpl_base< detail::ServiceImpl, WithArgsT > baseT; + /** Default ctor. Implementation class without args, expecting + component context as single argument. + */ + class_() : baseT() {} + template + /** Ctor to pass a post processing function/functor. + + @tpl PostProcessDefaultT let your compiler deduce this + @param postProcessFunc function/functor that gets the yet unacquired + ImplT_ pointer returning a + uno::Reference + */ + explicit class_( PostProcessFuncT const& postProcessFunc ) : baseT( postProcessFunc ) {} +}; // // component_... helpers with arbitrary service declarations: -- cgit From 525f53a1123ced103fd8f8e4899b1b5dbdc982d7 Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Mon, 21 Sep 2009 07:24:29 +0000 Subject: #i10000# --- vcl/inc/vcl/outdev.hxx | 2 +- vcl/source/gdi/outdev3.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx index 094a646163ca..130492a2bd0c 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -465,7 +465,7 @@ public: SAL_DLLPRIVATE void ImplGetEmphasisMark( PolyPolygon& rPolyPoly, BOOL& rPolyLine, Rectangle& rRect1, Rectangle& rRect2, long& rYOff, long& rWidth, FontEmphasisMark eEmphasis, long nHeight, short nOrient ); SAL_DLLPRIVATE void ImplDrawEmphasisMark( long nBaseX, long nX, long nY, const PolyPolygon& rPolyPoly, BOOL bPolyLine, const Rectangle& rRect1, const Rectangle& rRect2 ); static - SAL_DLLPRIVATE long ImplGetTextLines( OutputDevice& rTargetDevice, ImplMultiTextLineInfo& rLineInfo, long nWidth, const XubString& rStr, USHORT nStyle, const ::vcl::ITextLayout& _rLayout ); + SAL_DLLPRIVATE long ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const XubString& rStr, USHORT nStyle, const ::vcl::ITextLayout& _rLayout ); SAL_DLLPRIVATE void ImplInitFontList() const; SAL_DLLPRIVATE void ImplUpdateFontData( bool bNewFontLists ); SAL_DLLPRIVATE static void ImplUpdateAllFontData( bool bNewFontLists ); diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 268db2ba7c92..a254cce8ccb1 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -5256,7 +5256,7 @@ void OutputDevice::ImplDrawText( SalLayout& rSalLayout ) // ----------------------------------------------------------------------- -long OutputDevice::ImplGetTextLines( OutputDevice& rTargetDevice, ImplMultiTextLineInfo& rLineInfo, +long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const XubString& rStr, USHORT nStyle, const ::vcl::ITextLayout& _rLayout ) { -- cgit From e71f3326ef8f46a39228b6ab6589b61482044b40 Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Mon, 21 Sep 2009 07:37:41 +0000 Subject: #i10000# --- vcl/source/gdi/outdev3.cxx | 4 ++-- vcl/source/gdi/pdfwriter_impl.cxx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index a254cce8ccb1..1570351f3d57 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -6854,7 +6854,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r if ( nTextHeight ) { - nMaxTextWidth = ImplGetTextLines( rTargetDevice, aMultiLineInfo, nWidth, aStr, nStyle, _rLayout ); + nMaxTextWidth = ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, _rLayout ); nLines = (xub_StrLen)(nHeight/nTextHeight); nFormatLines = aMultiLineInfo.Count(); if ( !nLines ) @@ -7154,7 +7154,7 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, nMaxWidth = 0; DefaultTextLayout aDefaultLayout( *const_cast< OutputDevice* >( this ) ); - ImplGetTextLines( *const_cast< OutputDevice* >( this ), aMultiLineInfo, nWidth, aStr, nStyle, _pTextLayout ? *_pTextLayout : aDefaultLayout ); + ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, _pTextLayout ? *_pTextLayout : aDefaultLayout ); nFormatLines = aMultiLineInfo.Count(); if ( !nTextHeight ) nTextHeight = 1; diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 0ce6df6bc85f..85c15c5354de 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -7308,7 +7308,7 @@ void PDFWriterImpl::drawText( const Rectangle& rRect, const String& rOrigStr, US if ( nTextHeight ) { ::vcl::DefaultTextLayout aLayout( *m_pReferenceDevice ); - nMaxTextWidth = OutputDevice::ImplGetTextLines( *m_pReferenceDevice, aMultiLineInfo, nWidth, aStr, nStyle, aLayout ); + nMaxTextWidth = OutputDevice::ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, aLayout ); nLines = (xub_StrLen)(nHeight/nTextHeight); nFormatLines = aMultiLineInfo.Count(); if ( !nLines ) -- cgit From 105e04d56fe3a67b58b667c278ad66786366304a Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Mon, 21 Sep 2009 10:31:11 +0000 Subject: DrawText( Rect, ...): properly calculate the to-be-returned text rect even in edge cases ... --- vcl/source/gdi/textlayout.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx index a555709e0786..d969df2f439b 100755 --- a/vcl/source/gdi/textlayout.cxx +++ b/vcl/source/gdi/textlayout.cxx @@ -332,6 +332,17 @@ namespace vcl m_rTargetDevice.DrawText( aRect, _rText, _nStyle, _pVector, _pDisplayText, this ); Rectangle aTextRect = onEndDrawText(); + if ( aTextRect.IsEmpty() && !aRect.IsEmpty() ) + { + // this happens for instance if we're in a PaintToDevice call, where only a MetaFile is recorded, + // but no actual painting happens, so our "DrawText( Point, ... )" is never called + // In this case, calculate the rect from what OutputDevice::GetTextRect would give us. This has + // the disadvantage of less accuracy, compared with the approach to calculate the rect from the + // single "DrawText( Point, ... )" calls, since more intermediate arithmetics will translate + // from ref- to target-units. + aTextRect = m_rTargetDevice.GetTextRect( aRect, _rText, _nStyle, NULL, this ); + } + if ( IsZoom() ) { // similar to above, transform the to-be-returned rectanle to coordinates which are meaningful -- cgit From 39d12306a5addf0f49dfcb52aac7f0555a27b99e Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Mon, 21 Sep 2009 10:58:44 +0000 Subject: #b6875455# always use TWIP as target device map unit during drawing text, this saves us some rounding errors --- vcl/source/gdi/textlayout.cxx | 93 +++++++++++++++---------------------------- 1 file changed, 33 insertions(+), 60 deletions(-) diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx index d969df2f439b..d8ca2b870da1 100755 --- a/vcl/source/gdi/textlayout.cxx +++ b/vcl/source/gdi/textlayout.cxx @@ -90,8 +90,6 @@ namespace vcl long GetTextArray( const XubString& _rText, sal_Int32* _pDXAry, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const; Rectangle DrawText( const Rectangle& _rRect, const XubString& _rText, USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText); - bool IsZoom() const; - protected: void onBeginDrawText() { @@ -120,29 +118,32 @@ namespace vcl ,m_aUnzoomedPointFont( _rControl.GetUnzoomedControlPointFont() ) ,m_aZoom( _rControl.GetZoom() ) { + m_rTargetDevice.Push( PUSH_MAPMODE | PUSH_FONT ); + + MapMode aTargetMapMode( m_rTargetDevice.GetMapMode() ); + OSL_ENSURE( aTargetMapMode.GetOrigin() == Point(), "ReferenceDeviceTextLayout::ReferenceDeviceTextLayout: uhm, the code below won't work here ..." ); + // normally, controls simulate "zoom" by "zooming" the font. This is responsible for (part of) the discrepancies // between text in Writer and text in controls in Writer, though both have the same font. // So, if we have a zoom set at the control, then we do not scale the font, but instead modify the map mode // to accomodate for the zoom. - if ( IsZoom() ) - { - m_rTargetDevice.Push( PUSH_MAPMODE | PUSH_FONT ); - - MapMode aDrawMapMode( m_rTargetDevice.GetMapMode() ); - OSL_ENSURE( aDrawMapMode.GetOrigin() == Point(), "ReferenceDeviceTextLayout::ReferenceDeviceTextLayout: uhm, the code below won't work here ..." ); - - aDrawMapMode.SetScaleX( m_aZoom ); // TODO: shouldn't this be "current_scale * zoom"? - aDrawMapMode.SetScaleY( m_aZoom ); - m_rTargetDevice.SetMapMode( aDrawMapMode ); - - MapUnit eTargetMapUnit = m_rTargetDevice.GetMapMode().GetMapUnit(); - Font aDrawFont( m_aUnzoomedPointFont ); - if ( eTargetMapUnit == MAP_PIXEL ) - aDrawFont.SetSize( m_rTargetDevice.LogicToPixel( aDrawFont.GetSize(), MAP_POINT ) ); - else - aDrawFont.SetSize( m_rTargetDevice.LogicToLogic( aDrawFont.GetSize(), MAP_POINT, eTargetMapUnit ) ); - _rTargetDevice.SetFont( aDrawFont ); - } + aTargetMapMode.SetScaleX( m_aZoom ); // TODO: shouldn't this be "current_scale * zoom"? + aTargetMapMode.SetScaleY( m_aZoom ); + + // also, use a higher-resolution map unit than "pixels", which should save us some rounding errors when + // translating coordinates between the reference device and the target device. + const MapUnit eTargetMapUnit = MAP_TWIP; + OSL_ENSURE( aTargetMapMode.GetMapUnit() == MAP_PIXEL, + "ReferenceDeviceTextLayout::ReferenceDeviceTextLayout: this class is not expected to work with such target devices!" ); + // we *could* adjust all the code in this class to handle this case, but at the moment, it's not necessary + aTargetMapMode.SetMapUnit( eTargetMapUnit ); + + m_rTargetDevice.SetMapMode( aTargetMapMode ); + + // now that the Zoom is part of the map mode, reset the target device's font to the "unzoomed" version + Font aDrawFont( m_aUnzoomedPointFont ); + aDrawFont.SetSize( m_rTargetDevice.LogicToLogic( aDrawFont.GetSize(), MAP_POINT, eTargetMapUnit ) ); + _rTargetDevice.SetFont( aDrawFont ); // transfer font to the reference device m_rReferenceDevice.Push( PUSH_FONT ); @@ -156,9 +157,8 @@ namespace vcl //-------------------------------------------------------------------- ReferenceDeviceTextLayout::~ReferenceDeviceTextLayout() { - if ( IsZoom() ) - m_rTargetDevice.Pop(); m_rReferenceDevice.Pop(); + m_rTargetDevice.Pop(); } //-------------------------------------------------------------------- @@ -180,43 +180,28 @@ namespace vcl { public: DeviceUnitMapping( const OutputDevice& _rTargetDevice, const OutputDevice& _rReferenceDevice ) - :m_rTargetDevice( _rTargetDevice ) - ,m_rReferenceDevice( _rReferenceDevice ) - ,m_eTargetMapUnit( _rTargetDevice.GetMapMode().GetMapUnit() ) - ,m_bTargetIsPixel( _rTargetDevice.GetMapMode().GetMapUnit() == MAP_PIXEL ) + :m_eTargetMapUnit( _rTargetDevice.GetMapMode().GetMapUnit() ) ,m_eRefMapUnit( _rReferenceDevice.GetMapMode().GetMapUnit() ) { OSL_ENSURE( m_eRefMapUnit != MAP_PIXEL, "a reference device with MAP_PIXEL?" ); + OSL_ENSURE( m_eTargetMapUnit != MAP_PIXEL, "we should have reset the target's map mode to TWIP!" ); } long mapToTarget( long _nWidth ) { - return m_bTargetIsPixel - ? m_rTargetDevice.LogicToPixel( Size( _nWidth, 0 ), m_eRefMapUnit ).Width() - : OutputDevice::LogicToLogic( Size( _nWidth, 0 ), m_eRefMapUnit, m_eTargetMapUnit ).Width(); + return OutputDevice::LogicToLogic( Size( _nWidth, 0 ), m_eRefMapUnit, m_eTargetMapUnit ).Width(); } long mapToReference( long _nWidth ) { - return m_bTargetIsPixel - ? m_rTargetDevice.PixelToLogic( Size( _nWidth, 0 ), m_eRefMapUnit ).Width() - : OutputDevice::LogicToLogic( Size( _nWidth, 0 ), m_eTargetMapUnit, m_eRefMapUnit ).Width(); + return OutputDevice::LogicToLogic( Size( _nWidth, 0 ), m_eTargetMapUnit, m_eRefMapUnit ).Width(); } private: - const OutputDevice& m_rTargetDevice; - const OutputDevice& m_rReferenceDevice; const MapUnit m_eTargetMapUnit; - const bool m_bTargetIsPixel; const MapUnit m_eRefMapUnit; }; } - //-------------------------------------------------------------------- - bool ReferenceDeviceTextLayout::IsZoom() const - { - return m_aZoom.GetNumerator() != m_aZoom.GetDenominator(); - } - //-------------------------------------------------------------------- long ReferenceDeviceTextLayout::GetTextArray( const XubString& _rText, sal_Int32* _pDXAry, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const { @@ -311,15 +296,10 @@ namespace vcl Rectangle ReferenceDeviceTextLayout::DrawText( const Rectangle& _rRect, const XubString& _rText, USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText) { Rectangle aRect( _rRect ); - if ( IsZoom() ) - { - // if there's a zoom factor involved, then we tampered with the target device's map mode in the ctor. - // Need to adjust the rectangle to this - aRect.Left() = unzoomBy( aRect.Left(), m_aZoom ); - aRect.Right() = unzoomBy( aRect.Right(), m_aZoom ); - aRect.Top() = unzoomBy( aRect.Top(), m_aZoom ); - aRect.Bottom() = unzoomBy( aRect.Bottom(), m_aZoom ); - } + + // in our ctor, we set the map mode of the target device from pixel to twip, but our caller doesn't know this, + // but passed pixel coordinates. So, adjust the rect. + aRect = m_rTargetDevice.PixelToLogic( aRect ); #ifdef FS_DEBUG m_rTargetDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); @@ -343,15 +323,8 @@ namespace vcl aTextRect = m_rTargetDevice.GetTextRect( aRect, _rText, _nStyle, NULL, this ); } - if ( IsZoom() ) - { - // similar to above, transform the to-be-returned rectanle to coordinates which are meaningful - // with the original map mode of the target device - aTextRect.Left() = zoomBy( aTextRect.Left(), m_aZoom ); - aTextRect.Right() = zoomBy( aTextRect.Right(), m_aZoom ); - aTextRect.Top() = zoomBy( aTextRect.Top(), m_aZoom ); - aTextRect.Bottom() = zoomBy( aTextRect.Bottom(), m_aZoom ); - } + // similar to above, the text rect now contains TWIPs, but the caller expects pixel coordinates + aTextRect = m_rTargetDevice.LogicToPixel( aTextRect ); return aTextRect; } -- cgit From 0775a523ff1be393217112badd6c742f2c5dc3a7 Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Mon, 21 Sep 2009 13:43:11 +0000 Subject: #b6875455# allow OutputDevice::DrawText to "decompose" the MetaTextRectAction. That is, if the given ITextLayout says that "decomposition" should be used, then do not add a MetaTextRectAction, but delegate creation/adding of MetaActions to ImplDrawText. Effectively, this means that if a Control is painted to a virtual device with output disabled, the proper meta actions - those for the DrawTextArray - are generated, instead of just one big MetaTextRectAction, which doesn't know anything about the reference device. --- vcl/inc/vcl/textlayout.hxx | 12 ++++-------- vcl/source/gdi/outdev3.cxx | 14 ++++++++++---- vcl/source/gdi/textlayout.cxx | 13 +++++++++++++ 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/vcl/inc/vcl/textlayout.hxx b/vcl/inc/vcl/textlayout.hxx index 38e2580ae496..4c290452e2ad 100755 --- a/vcl/inc/vcl/textlayout.hxx +++ b/vcl/inc/vcl/textlayout.hxx @@ -47,16 +47,11 @@ namespace vcl { public: virtual long GetTextWidth( const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const = 0; - virtual void DrawText( - const Point& _rStartPoint, - const XubString& _rText, - xub_StrLen _nStartIndex, - xub_StrLen _nLength, - MetricVector* _pVector, - String* _pDisplayText - ) = 0; + virtual void DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength, + MetricVector* _pVector, String* _pDisplayText ) = 0; virtual bool GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const = 0; virtual xub_StrLen GetTextBreak( const XubString& _rText, long _nMaxTextWidth, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const = 0; + virtual bool DecomposeTextRectAction() const = 0; }; //==================================================================== @@ -100,6 +95,7 @@ namespace vcl xub_StrLen _nStartIndex, xub_StrLen _nLength ) const; + virtual bool DecomposeTextRectAction() const; private: OutputDevice& m_rTargetDevice; diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 1570351f3d57..6bd612d364a1 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -6160,6 +6160,10 @@ void OutputDevice::DrawTextArray( const Point& rStartPt, const String& rStr, if ( !IsDeviceOutputNecessary() ) return; + if( mbInitClipRegion ) + ImplInitClipRegion(); + if( mbOutputClipped ) + return; SalLayout* pSalLayout = ImplLayout( rStr, nIndex, nLen, rStartPt, 0, pDXAry, true ); if( pSalLayout ) @@ -7094,10 +7098,11 @@ void OutputDevice::DrawText( const Rectangle& rRect, const String& rOrigStr, USH DBG_TRACE( "OutputDevice::DrawText( const Rectangle& )" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); - if ( mpMetaFile ) + bool bDecomposeTextRectAction = ( _pTextLayout != NULL ) && _pTextLayout->DecomposeTextRectAction(); + if ( mpMetaFile && !bDecomposeTextRectAction ) mpMetaFile->AddAction( new MetaTextRectAction( rRect, rOrigStr, nStyle ) ); - if ( ( !IsDeviceOutputNecessary() && ! pVector ) || !rOrigStr.Len() || rRect.IsEmpty() ) + if ( ( !IsDeviceOutputNecessary() && !pVector && !bDecomposeTextRectAction ) || !rOrigStr.Len() || rRect.IsEmpty() ) return; // we need a graphics @@ -7105,13 +7110,14 @@ void OutputDevice::DrawText( const Rectangle& rRect, const String& rOrigStr, USH return; if( mbInitClipRegion ) ImplInitClipRegion(); - if( mbOutputClipped ) + if( mbOutputClipped && !bDecomposeTextRectAction ) return; // temporarily disable mtf action generation (ImplDrawText _does_ // create META_TEXT_ACTIONs otherwise) GDIMetaFile* pMtf = mpMetaFile; - mpMetaFile = NULL; + if ( !bDecomposeTextRectAction ) + mpMetaFile = NULL; // #i47157# Factored out to ImplDrawText(), to be used also // from AddTextRectActions() diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx index d8ca2b870da1..a89c17d063c6 100755 --- a/vcl/source/gdi/textlayout.cxx +++ b/vcl/source/gdi/textlayout.cxx @@ -70,6 +70,12 @@ namespace vcl return m_rTargetDevice.GetTextBreak( _rText, _nMaxTextWidth, _nStartIndex, _nLength ); } + //-------------------------------------------------------------------- + bool DefaultTextLayout::DecomposeTextRectAction() const + { + return false; + } + //==================================================================== //= ReferenceDeviceTextLayout //==================================================================== @@ -84,6 +90,7 @@ namespace vcl virtual void DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength, MetricVector* _pVector, String* _pDisplayText ); virtual bool GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const; virtual xub_StrLen GetTextBreak( const XubString& _rText, long _nMaxTextWidth, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const; + virtual bool DecomposeTextRectAction() const; public: // equivalents to the respective OutputDevice methods, which take the reference device into account @@ -276,6 +283,12 @@ namespace vcl return m_rReferenceDevice.GetTextBreak( _rText, aMapping.mapToReference( _nMaxTextWidth ), _nStartIndex, _nLength ); } + //-------------------------------------------------------------------- + bool ReferenceDeviceTextLayout::DecomposeTextRectAction() const + { + return true; + } + //-------------------------------------------------------------------- namespace { -- cgit From f894d7f3120515731dd17a0e19dbdc3117d44057 Mon Sep 17 00:00:00 2001 From: hdu Date: Mon, 21 Sep 2009 16:25:31 +0200 Subject: #i105240# bitmap fonts are neither subsettable nor embeddable --- vcl/aqua/source/gdi/salatsuifontutils.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/vcl/aqua/source/gdi/salatsuifontutils.cxx b/vcl/aqua/source/gdi/salatsuifontutils.cxx index 8e38981a3c7c..23755ae2f571 100644 --- a/vcl/aqua/source/gdi/salatsuifontutils.cxx +++ b/vcl/aqua/source/gdi/salatsuifontutils.cxx @@ -207,6 +207,13 @@ static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes& rDF rDFA.meItalic = ITALIC_NONE; rDFA.mbSymbolFlag = false; + // ignore bitmap fonts + ATSFontRef rATSFontRef = FMGetATSFontRefFromFont( nFontID ); + ByteCount nHeadLen = 0; + OSStatus rc = ATSFontGetTable( rATSFontRef, 0x68656164/*head*/, 0, 0, NULL, &nHeadLen ); + if( (rc != noErr) || (nHeadLen <= 0) ) + return false; + // all scalable fonts on this platform are subsettable rDFA.mbSubsettable = true; rDFA.mbEmbeddable = false; @@ -216,7 +223,7 @@ static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes& rDF // prepare iterating over all name strings of the font ItemCount nFontNameCount = 0; - OSStatus rc = ATSUCountFontNames( nFontID, &nFontNameCount ); + rc = ATSUCountFontNames( nFontID, &nFontNameCount ); if( rc != noErr ) return false; int nBestNameValue = 0; -- cgit -- cgit From 1b51c3004bec95184cf605a74c06cb4414f8270f Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Fri, 25 Sep 2009 09:49:45 +0000 Subject: getProperty( RefDevice ) implemented now --- toolkit/source/awt/vclxwindow.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index 501ed7f009f1..40413091aaf2 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -1643,7 +1643,6 @@ void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com:: { case BASEPROPERTY_REFERENCE_DEVICE: { - // TODO: at the moment, the refdevice is hackily implemented for Button and derived classes only Control* pControl = dynamic_cast< Control* >( pWindow ); OSL_ENSURE( pControl, "VCLXWindow::setProperty( RefDevice ): need a Control for this!" ); if ( !pControl ) @@ -2174,12 +2173,14 @@ void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com:: { case BASEPROPERTY_REFERENCE_DEVICE: { - // TODO: at the moment, the refdevice is hackily implemented for Button and derived classes only - Button* pButton = dynamic_cast< Button* >( GetWindow() ); - if ( !pButton ) + Control* pControl = dynamic_cast< Control* >( GetWindow() ); + OSL_ENSURE( pControl, "VCLXWindow::setProperty( RefDevice ): need a Control for this!" ); + if ( !pControl ) break; - // TODO: hmm ... it seems there is no way to query an OutputDevice for its XDevice ...? + VCLXDevice* pDevice = new VCLXDevice; + pDevice->SetOutputDevice( pControl->GetReferenceDevice() ); + aProp <<= Reference< XDevice >( pDevice ); } break; -- cgit From 9620ad7d2404e4657fea340bcba8b40886e8a59a Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Fri, 25 Sep 2009 10:43:29 +0000 Subject: don't maintain the exception files twice, base SLOFILES on EXCEPTIONSFILES --- vcl/source/gdi/makefile.mk | 81 ++++++++++++++++------------------------------ 1 file changed, 28 insertions(+), 53 deletions(-) diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk index b708346e45e4..8ca2e1a4817c 100644 --- a/vcl/source/gdi/makefile.mk +++ b/vcl/source/gdi/makefile.mk @@ -51,7 +51,33 @@ CDEFS+=-DENABLE_GRAPHITE # --- Files -------------------------------------------------------- -SLOFILES= $(SLO)$/salmisc.obj \ +EXCEPTIONSFILES= $(SLO)$/salmisc.obj \ + $(SLO)$/outdev.obj \ + $(SLO)$/outdev3.obj \ + $(SLO)$/gfxlink.obj \ + $(SLO)$/print.obj \ + $(SLO)$/print2.obj \ + $(SLO)$/sallayout.obj \ + $(SLO)$/image.obj \ + $(SLO)$/impimage.obj \ + $(SLO)$/impgraph.obj \ + $(SLO)$/metric.obj \ + $(SLO)$/pdfwriter_impl.obj \ + $(SLO)$/pdffontcache.obj\ + $(SLO)$/fontcfg.obj \ + $(SLO)$/bmpconv.obj \ + $(SLO)$/pdfextoutdevdata.obj \ + $(SLO)$/fontcvt.obj \ + $(SLO)$/jobset.obj \ + $(SLO)$/impimagetree.obj \ + $(SLO)$/pngread.obj \ + $(SLO)$/pngwrite.obj \ + $(SLO)$/virdev.obj \ + $(SLO)$/impprn.obj \ + $(SLO)$/gdimtf.obj \ + $(SLO)$/graphictools.obj + +SLOFILES= $(EXCEPTIONSFILES) \ $(SLO)$/animate.obj \ $(SLO)$/impanmvw.obj \ $(SLO)$/bitmap.obj \ @@ -68,83 +94,32 @@ SLOFILES= $(SLO)$/salmisc.obj \ $(SLO)$/cvtsvm.obj \ $(SLO)$/cvtgrf.obj \ $(SLO)$/font.obj \ - $(SLO)$/gdimtf.obj \ - $(SLO)$/gfxlink.obj \ $(SLO)$/gradient.obj \ $(SLO)$/hatch.obj \ $(SLO)$/graph.obj \ - $(SLO)$/image.obj \ - $(SLO)$/impimage.obj \ $(SLO)$/impbmp.obj \ - $(SLO)$/impgraph.obj \ - $(SLO)$/impimagetree.obj \ $(SLO)$/imagerepository.obj \ - $(SLO)$/impprn.obj \ $(SLO)$/impvect.obj \ $(SLO)$/implncvt.obj \ - $(SLO)$/jobset.obj \ $(SLO)$/lineinfo.obj \ $(SLO)$/mapmod.obj \ $(SLO)$/metaact.obj \ - $(SLO)$/metric.obj \ $(SLO)$/octree.obj \ $(SLO)$/outmap.obj \ - $(SLO)$/outdev.obj \ $(SLO)$/outdev2.obj \ - $(SLO)$/outdev3.obj \ $(SLO)$/outdev4.obj \ $(SLO)$/outdev5.obj \ $(SLO)$/outdev6.obj \ - $(SLO)$/virdev.obj \ - $(SLO)$/fontcvt.obj \ - $(SLO)$/print.obj \ - $(SLO)$/print2.obj \ $(SLO)$/regband.obj \ $(SLO)$/region.obj \ $(SLO)$/wall.obj \ - $(SLO)$/fontcfg.obj \ $(SLO)$/base14.obj \ $(SLO)$/pdfwriter.obj \ - $(SLO)$/pdfwriter_impl.obj \ - $(SLO)$/pdffontcache.obj\ - $(SLO)$/sallayout.obj \ $(SLO)$/salgdilayout.obj \ $(SLO)$/extoutdevdata.obj \ - $(SLO)$/pdfextoutdevdata.obj \ - $(SLO)$/salnativewidgets-none.obj \ - $(SLO)$/bmpconv.obj \ - $(SLO)$/pngread.obj \ - $(SLO)$/pngwrite.obj \ - $(SLO)$/graphictools.obj \ + $(SLO)$/salnativewidgets-none.obj \ $(SLO)$/textlayout.obj -EXCEPTIONSFILES= $(SLO)$/salmisc.obj \ - $(SLO)$/outdev.obj \ - $(SLO)$/outdev3.obj \ - $(SLO)$/gfxlink.obj \ - $(SLO)$/print.obj \ - $(SLO)$/print2.obj \ - $(SLO)$/sallayout.obj \ - $(SLO)$/image.obj \ - $(SLO)$/impimage.obj \ - $(SLO)$/impgraph.obj \ - $(SLO)$/metric.obj \ - $(SLO)$/pdfwriter_impl.obj \ - $(SLO)$/pdffontcache.obj\ - $(SLO)$/fontcfg.obj \ - $(SLO)$/bmpconv.obj \ - $(SLO)$/pdfextoutdevdata.obj \ - $(SLO)$/fontcvt.obj \ - $(SLO)$/jobset.obj \ - $(SLO)$/impimagetree.obj \ - $(SLO)$/pngread.obj \ - $(SLO)$/pngwrite.obj \ - $(SLO)$/virdev.obj \ - $(SLO)$/impprn.obj \ - $(SLO)$/gdimtf.obj \ - $(SLO)$/graphictools.obj - - # --- Targets ------------------------------------------------------ .INCLUDE : target.mk -- cgit From 296f87ef1fbc9eff77e85f4ec539e4c710d26682 Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Fri, 25 Sep 2009 10:45:37 +0000 Subject: #b6875455# use the RTL-ness of the control we work for to determine the TextLayoutMode of the reference/target device --- vcl/source/control/ctrl.cxx | 39 +++---------------------- vcl/source/gdi/textlayout.cxx | 66 ++++++++++++++++++++++++++++++++++--------- 2 files changed, 57 insertions(+), 48 deletions(-) diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index 5ae6b41a8d7f..ec7fb3504efc 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -43,10 +43,8 @@ #include #include - -namespace vcl -{ -} +#include +#include using namespace vcl; @@ -553,7 +551,6 @@ void Control::ImplInitSettings( const BOOL _bFont, const BOOL _bForeground ) void Control::DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRect, const XubString& _rStr, USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText ) const { - if ( !mpControlData->mpReferenceDevice ) { _io_rRect = _rTargetDevice.GetTextRect( _io_rRect, _rStr, _nStyle ); @@ -561,34 +558,6 @@ void Control::DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRec return; } -#ifdef FS_DEBUG - { - _rTargetDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR | PUSH_TEXTCOLOR ); - - _rTargetDevice.SetTextColor( COL_LIGHTRED ); - Rectangle aTextRect = _rTargetDevice.GetTextRect( _io_rRect, _rStr, _nStyle ); - _rTargetDevice.DrawText( aTextRect, _rStr, _nStyle, _pVector, _pDisplayText ); - - _rTargetDevice.SetLineColor( COL_LIGHTRED ); - _rTargetDevice.SetFillColor(); - _rTargetDevice.DrawRect( _io_rRect ); - - _rTargetDevice.Pop(); - } -#endif - - { - ControlTextRenderer aRenderer( *this, _rTargetDevice, *mpControlData->mpReferenceDevice ); - _io_rRect = aRenderer.DrawText( _io_rRect, _rStr, _nStyle, _pVector, _pDisplayText ); - } - -#ifdef FS_DEBUG - _rTargetDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); - - _rTargetDevice.SetLineColor( COL_LIGHTGREEN ); - _rTargetDevice.SetFillColor(); - _rTargetDevice.DrawRect( _io_rRect ); - - _rTargetDevice.Pop(); -#endif + ControlTextRenderer aRenderer( *this, _rTargetDevice, *mpControlData->mpReferenceDevice ); + _io_rRect = aRenderer.DrawText( _io_rRect, _rStr, _nStyle, _pVector, _pDisplayText ); } diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx index a89c17d063c6..3e9cdfad8c12 100755 --- a/vcl/source/gdi/textlayout.cxx +++ b/vcl/source/gdi/textlayout.cxx @@ -31,11 +31,23 @@ #include "vcl/outfont.hxx" #include "vcl/textlayout.hxx" +#include + +#include + +#if OSL_DEBUG_LEVEL > 1 +#include +#endif + //........................................................................ namespace vcl { //........................................................................ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::Exception; + namespace ScriptDirection = ::com::sun::star::i18n::ScriptDirection; + //==================================================================== //= DefaultTextLayout //==================================================================== @@ -112,6 +124,7 @@ namespace vcl OutputDevice& m_rReferenceDevice; Font m_aUnzoomedPointFont; const Fraction m_aZoom; + const bool m_bRTLEnabled; Rectangle m_aCompleteTextRect; }; @@ -119,13 +132,15 @@ namespace vcl //==================================================================== //= ControlTextRenderer //==================================================================== - ReferenceDeviceTextLayout::ReferenceDeviceTextLayout( const Control& _rControl, OutputDevice& _rTargetDevice, OutputDevice& _rReferenceDevice ) + ReferenceDeviceTextLayout::ReferenceDeviceTextLayout( const Control& _rControl, OutputDevice& _rTargetDevice, + OutputDevice& _rReferenceDevice ) :m_rTargetDevice( _rTargetDevice ) ,m_rReferenceDevice( _rReferenceDevice ) ,m_aUnzoomedPointFont( _rControl.GetUnzoomedControlPointFont() ) ,m_aZoom( _rControl.GetZoom() ) + ,m_bRTLEnabled( _rControl.IsRTLEnabled() ) { - m_rTargetDevice.Push( PUSH_MAPMODE | PUSH_FONT ); + m_rTargetDevice.Push( PUSH_MAPMODE | PUSH_FONT | PUSH_TEXTLAYOUTMODE ); MapMode aTargetMapMode( m_rTargetDevice.GetMapMode() ); OSL_ENSURE( aTargetMapMode.GetOrigin() == Point(), "ReferenceDeviceTextLayout::ReferenceDeviceTextLayout: uhm, the code below won't work here ..." ); @@ -153,12 +168,11 @@ namespace vcl _rTargetDevice.SetFont( aDrawFont ); // transfer font to the reference device - m_rReferenceDevice.Push( PUSH_FONT ); + m_rReferenceDevice.Push( PUSH_FONT | PUSH_TEXTLAYOUTMODE ); Font aRefFont( m_aUnzoomedPointFont ); aRefFont.SetSize( OutputDevice::LogicToLogic( aRefFont.GetSize(), MAP_POINT, m_rReferenceDevice.GetMapMode().GetMapUnit() ) ); m_rReferenceDevice.SetFont( aRefFont ); - } //-------------------------------------------------------------------- @@ -215,9 +229,33 @@ namespace vcl if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) ) return 0; + m_rReferenceDevice.SetLayoutMode( TEXT_LAYOUT_BIDI_LTR ); + // TODO: make this layout mode dependent on some educated guess about the text + // TODO: even better: break the text into script type portions ... but this way too far goes into the direction + // of re-implementing EditEngine and Writer-Code features here. + // retrieve the character widths from the reference device long nTextWidth = m_rReferenceDevice.GetTextArray( _rText, _pDXAry, _nStartIndex, _nLength ); +#if OSL_DEBUG_LEVEL > 1 + if ( _pDXAry ) + { + ::rtl::OStringBuffer aTrace; + aTrace.append( "ReferenceDeviceTextLayout::GetTextArray( " ); + aTrace.append( ::rtl::OUStringToOString( _rText, RTL_TEXTENCODING_UTF8 ) ); + aTrace.append( " ): " ); + aTrace.append( nTextWidth ); + aTrace.append( " = ( " ); + for ( size_t i=0; i<_nLength; ) + { + aTrace.append( _pDXAry[i] ); + if ( ++i < _nLength ) + aTrace.append( ", " ); + } + aTrace.append( ")" ); + OSL_TRACE( aTrace.makeStringAndClear().getStr() ); + } +#endif // adjust the widths, which are in ref-device units, to the target device DeviceUnitMapping aMapping( m_rTargetDevice, m_rReferenceDevice ); if ( _pDXAry ) @@ -308,19 +346,21 @@ namespace vcl //-------------------------------------------------------------------- Rectangle ReferenceDeviceTextLayout::DrawText( const Rectangle& _rRect, const XubString& _rText, USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText) { - Rectangle aRect( _rRect ); + if ( !_rText.Len() ) + return Rectangle(); + + // determine text layout mode from the RTL-ness of the control whose text we render + ULONG nTextLayoutMode = m_bRTLEnabled ? TEXT_LAYOUT_BIDI_RTL : TEXT_LAYOUT_BIDI_LTR; + m_rReferenceDevice.SetLayoutMode( nTextLayoutMode ); + m_rTargetDevice.SetLayoutMode( nTextLayoutMode | TEXT_LAYOUT_TEXTORIGIN_LEFT ); + // TEXT_LAYOUT_TEXTORIGIN_LEFT is because when we do actually draw the text (in DrawText( Point, ... )), then + // our caller gives us the left border of the draw position, regardless of script type, text layout, + // and the like // in our ctor, we set the map mode of the target device from pixel to twip, but our caller doesn't know this, // but passed pixel coordinates. So, adjust the rect. - aRect = m_rTargetDevice.PixelToLogic( aRect ); + Rectangle aRect( m_rTargetDevice.PixelToLogic( _rRect ) ); -#ifdef FS_DEBUG - m_rTargetDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); - m_rTargetDevice.SetLineColor( COL_LIGHTBLUE ); - m_rTargetDevice.SetFillColor(); - m_rTargetDevice.DrawRect( aRect ); - m_rTargetDevice.Pop(); -#endif onBeginDrawText(); m_rTargetDevice.DrawText( aRect, _rText, _nStyle, _pVector, _pDisplayText, this ); Rectangle aTextRect = onEndDrawText(); -- cgit From eac04e74383c70e2ce67b3676a81b0b2b9847cf3 Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Fri, 25 Sep 2009 10:48:03 +0000 Subject: merging changes from DEV300.m60 herein --- i18npool/source/collator/makefile.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18npool/source/collator/makefile.mk b/i18npool/source/collator/makefile.mk index bca1c00aa419..b38386d53de0 100644 --- a/i18npool/source/collator/makefile.mk +++ b/i18npool/source/collator/makefile.mk @@ -42,7 +42,7 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- -txtlist:=$(shell @cd data && ls *.txt) +txtlist:=$(shell @cd data >& $(NULLDEV) && ls *.txt) LOCAL_RULE_LANGS:=$(uniq $(foreach,i,$(txtlist) $(i:s/-/_/:s/_/ /:1))) rules_dependencies:=$(foreach,i,$(txtlist) data$/$i) $(INCCOM)$/lrl_include.hxx -- cgit From 0a4c38a2a2f8c4c78cfff7d2e097be9155f666cc Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Fri, 25 Sep 2009 12:00:20 +0000 Subject: diagnostics --- vcl/source/control/ctrl.cxx | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index ec7fb3504efc..521d3d6844d7 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -551,13 +551,40 @@ void Control::ImplInitSettings( const BOOL _bFont, const BOOL _bForeground ) void Control::DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRect, const XubString& _rStr, USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText ) const { +#ifdef FS_DEBUG + if ( !_pVector ) + { + static MetricVector aCharRects; + static String sDisplayText; + aCharRects.clear(); + sDisplayText = String(); + _pVector = &aCharRects; + _pDisplayText = &sDisplayText; + } +#endif + if ( !mpControlData->mpReferenceDevice ) { _io_rRect = _rTargetDevice.GetTextRect( _io_rRect, _rStr, _nStyle ); _rTargetDevice.DrawText( _io_rRect, _rStr, _nStyle, _pVector, _pDisplayText ); - return; + } + else + { + ControlTextRenderer aRenderer( *this, _rTargetDevice, *mpControlData->mpReferenceDevice ); + _io_rRect = aRenderer.DrawText( _io_rRect, _rStr, _nStyle, _pVector, _pDisplayText ); } - ControlTextRenderer aRenderer( *this, _rTargetDevice, *mpControlData->mpReferenceDevice ); - _io_rRect = aRenderer.DrawText( _io_rRect, _rStr, _nStyle, _pVector, _pDisplayText ); +#ifdef FS_DEBUG + _rTargetDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); + _rTargetDevice.SetLineColor( COL_LIGHTRED ); + _rTargetDevice.SetFillColor(); + for ( MetricVector::const_iterator cr = _pVector->begin(); + cr != _pVector->end(); + ++cr + ) + { + _rTargetDevice.DrawRect( *cr ); + } + _rTargetDevice.Pop(); +#endif } -- cgit From 5742e4ccc1b89d7db95cb9bdcfce4f5f1d46c1a4 Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Fri, 25 Sep 2009 12:01:08 +0000 Subject: #b6875455# for the target device, always use the ref-device MapUnit during drawing, to have less rounding errors in case the ref device does not use TWIP. Also, implement filling the MetricVector --- vcl/source/gdi/textlayout.cxx | 90 ++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 57 deletions(-) diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx index 3e9cdfad8c12..75d594258d1c 100755 --- a/vcl/source/gdi/textlayout.cxx +++ b/vcl/source/gdi/textlayout.cxx @@ -107,7 +107,7 @@ namespace vcl public: // equivalents to the respective OutputDevice methods, which take the reference device into account long GetTextArray( const XubString& _rText, sal_Int32* _pDXAry, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const; - Rectangle DrawText( const Rectangle& _rRect, const XubString& _rText, USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText); + Rectangle DrawText( const Rectangle& _rRect, const XubString& _rText, USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText ); protected: void onBeginDrawText() @@ -154,11 +154,13 @@ namespace vcl // also, use a higher-resolution map unit than "pixels", which should save us some rounding errors when // translating coordinates between the reference device and the target device. - const MapUnit eTargetMapUnit = MAP_TWIP; OSL_ENSURE( aTargetMapMode.GetMapUnit() == MAP_PIXEL, "ReferenceDeviceTextLayout::ReferenceDeviceTextLayout: this class is not expected to work with such target devices!" ); // we *could* adjust all the code in this class to handle this case, but at the moment, it's not necessary + const MapUnit eTargetMapUnit = m_rReferenceDevice.GetMapMode().GetMapUnit(); aTargetMapMode.SetMapUnit( eTargetMapUnit ); + OSL_ENSURE( aTargetMapMode.GetMapUnit() != MAP_PIXEL, + "ReferenceDeviceTextLayout::ReferenceDeviceTextLayout: a reference device which has map mode PIXEL?!" ); m_rTargetDevice.SetMapMode( aTargetMapMode ); @@ -195,48 +197,17 @@ namespace vcl _io_nLength = nTextLength - _nStartIndex; return true; } - - //................................................................ - class DeviceUnitMapping - { - public: - DeviceUnitMapping( const OutputDevice& _rTargetDevice, const OutputDevice& _rReferenceDevice ) - :m_eTargetMapUnit( _rTargetDevice.GetMapMode().GetMapUnit() ) - ,m_eRefMapUnit( _rReferenceDevice.GetMapMode().GetMapUnit() ) - { - OSL_ENSURE( m_eRefMapUnit != MAP_PIXEL, "a reference device with MAP_PIXEL?" ); - OSL_ENSURE( m_eTargetMapUnit != MAP_PIXEL, "we should have reset the target's map mode to TWIP!" ); - } - - long mapToTarget( long _nWidth ) - { - return OutputDevice::LogicToLogic( Size( _nWidth, 0 ), m_eRefMapUnit, m_eTargetMapUnit ).Width(); - } - long mapToReference( long _nWidth ) - { - return OutputDevice::LogicToLogic( Size( _nWidth, 0 ), m_eTargetMapUnit, m_eRefMapUnit ).Width(); - } - - private: - const MapUnit m_eTargetMapUnit; - const MapUnit m_eRefMapUnit; - }; } //-------------------------------------------------------------------- - long ReferenceDeviceTextLayout::GetTextArray( const XubString& _rText, sal_Int32* _pDXAry, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const + long ReferenceDeviceTextLayout::GetTextArray( const XubString& _rText, sal_Int32* _pDXAry, xub_StrLen _nStartIndex, + xub_StrLen _nLength ) const { if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) ) return 0; - m_rReferenceDevice.SetLayoutMode( TEXT_LAYOUT_BIDI_LTR ); - // TODO: make this layout mode dependent on some educated guess about the text - // TODO: even better: break the text into script type portions ... but this way too far goes into the direction - // of re-implementing EditEngine and Writer-Code features here. - // retrieve the character widths from the reference device long nTextWidth = m_rReferenceDevice.GetTextArray( _rText, _pDXAry, _nStartIndex, _nLength ); - #if OSL_DEBUG_LEVEL > 1 if ( _pDXAry ) { @@ -256,15 +227,6 @@ namespace vcl OSL_TRACE( aTrace.makeStringAndClear().getStr() ); } #endif - // adjust the widths, which are in ref-device units, to the target device - DeviceUnitMapping aMapping( m_rTargetDevice, m_rReferenceDevice ); - if ( _pDXAry ) - { - for ( size_t i=0; i<_nLength; ++i ) - _pDXAry[i] = aMapping.mapToTarget( _pDXAry[i] ); - } - nTextWidth = aMapping.mapToTarget( nTextWidth ); - return nTextWidth; } @@ -280,16 +242,23 @@ namespace vcl if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) ) return; + if ( _pVector && _pDisplayText ) + { + MetricVector aGlyphBounds; + m_rReferenceDevice.GetGlyphBoundRects( _rStartPoint, _rText, _nStartIndex, _nLength, _nStartIndex, aGlyphBounds ); + ::std::copy( + aGlyphBounds.begin(), aGlyphBounds.end(), + ::std::insert_iterator< MetricVector > ( *_pVector, _pVector->end() ) ); + _pDisplayText->Append( _rText.Copy( _nStartIndex, _nLength ) ); + return; + } + sal_Int32* pCharWidths = new sal_Int32[ _nLength ]; long nTextWidth = GetTextArray( _rText, pCharWidths, _nStartIndex, _nLength ); m_rTargetDevice.DrawTextArray( _rStartPoint, _rText, pCharWidths, _nStartIndex, _nLength ); delete[] pCharWidths; m_aCompleteTextRect.Union( Rectangle( _rStartPoint, Size( nTextWidth, m_rTargetDevice.GetTextHeight() ) ) ); - - // TODO: use/fill those: - (void)_pVector; - (void)_pDisplayText; } //-------------------------------------------------------------------- @@ -303,11 +272,6 @@ namespace vcl if ( !m_rReferenceDevice.GetCaretPositions( _rText, _pCaretXArray, _nStartIndex, _nLength ) ) return false; - // adjust the positions, which are in ref-device units, to the target device - DeviceUnitMapping aMapping( m_rTargetDevice, m_rReferenceDevice ); - for ( size_t i=0; i<2*size_t(_nLength); ++i ) - _pCaretXArray[i] = aMapping.mapToTarget( _pCaretXArray[i] ); - return true; } @@ -317,8 +281,7 @@ namespace vcl if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) ) return 0; - DeviceUnitMapping aMapping( m_rTargetDevice, m_rReferenceDevice ); - return m_rReferenceDevice.GetTextBreak( _rText, aMapping.mapToReference( _nMaxTextWidth ), _nStartIndex, _nLength ); + return m_rReferenceDevice.GetTextBreak( _rText, _nMaxTextWidth, _nStartIndex, _nLength ); } //-------------------------------------------------------------------- @@ -344,7 +307,7 @@ namespace vcl } //-------------------------------------------------------------------- - Rectangle ReferenceDeviceTextLayout::DrawText( const Rectangle& _rRect, const XubString& _rText, USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText) + Rectangle ReferenceDeviceTextLayout::DrawText( const Rectangle& _rRect, const XubString& _rText, USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText ) { if ( !_rText.Len() ) return Rectangle(); @@ -376,9 +339,22 @@ namespace vcl aTextRect = m_rTargetDevice.GetTextRect( aRect, _rText, _nStyle, NULL, this ); } - // similar to above, the text rect now contains TWIPs, but the caller expects pixel coordinates + // similar to above, the text rect now contains TWIPs (or whatever unit the ref device has), but the caller + // expects pixel coordinates aTextRect = m_rTargetDevice.LogicToPixel( aTextRect ); + // convert the metric vector + if ( _pVector ) + { + for ( MetricVector::iterator charRect = _pVector->begin(); + charRect != _pVector->end(); + ++charRect + ) + { + *charRect = m_rTargetDevice.LogicToPixel( *charRect ); + } + } + return aTextRect; } -- cgit From 27f85382fe716fb860f68bbfdb622e3525e0252f Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Fri, 25 Sep 2009 12:26:30 +0000 Subject: #b6875455# when drawing/painting a check box or radio button, then take the zoom into account when calculating the distance between the radio/check image, and the actual text. This ensures that in contexts where controls can and will be zoomed (i.e. in documents), the text doesn't 'jump' relative to other text surrounding the control. --- vcl/inc/vcl/button.hxx | 10 ++++----- vcl/inc/vcl/window.hxx | 1 - vcl/source/control/button.cxx | 50 +++++++++++++++++++++++++++---------------- 3 files changed, 37 insertions(+), 24 deletions(-) diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx index 8b5f3d89725b..3905768ca140 100644 --- a/vcl/inc/vcl/button.hxx +++ b/vcl/inc/vcl/button.hxx @@ -311,13 +311,13 @@ private: SAL_DLLPRIVATE void ImplDrawRadioButtonState(); SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, const Point& rPos, const Size& rSize, - const Size& rImageSize, long nImageSep, - Rectangle& rStateRect, Rectangle& rMouseRect, - bool bLayout = false ); + const Size& rImageSize, Rectangle& rStateRect, + Rectangle& rMouseRect, bool bLayout = false ); SAL_DLLPRIVATE void ImplDrawRadioButton( bool bLayout = false ); SAL_DLLPRIVATE void ImplInvalidateOrDrawRadioButtonState(); SAL_DLLPRIVATE void ImplUncheckAllOther(); SAL_DLLPRIVATE Size ImplGetRadioImageSize() const; + SAL_DLLPRIVATE long ImplGetImageToTextDistance() const; // Copy assignment is forbidden and not implemented. SAL_DLLPRIVATE RadioButton(const RadioButton &); @@ -428,10 +428,10 @@ private: SAL_DLLPRIVATE void ImplInvalidateOrDrawCheckBoxState(); SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, const Point& rPos, const Size& rSize, - const Size& rImageSize, long nImageSep, - Rectangle& rStateRect, + const Size& rImageSize, Rectangle& rStateRect, Rectangle& rMouseRect, bool bLayout ); SAL_DLLPRIVATE void ImplDrawCheckBox( bool bLayout = false ); + SAL_DLLPRIVATE long ImplGetImageToTextDistance() const; SAL_DLLPRIVATE Size ImplGetCheckImageSize() const; // Copy assignment is forbidden and not implemented. diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index 3f05383d4f80..5311e3c16264 100644 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -320,7 +320,6 @@ typedef USHORT StateChangedType; #define IMPL_MSGBOX_OFFSET_EXTRA_X 0 #define IMPL_MSGBOX_OFFSET_EXTRA_Y 2 #define IMPL_SEP_MSGBOX_IMAGE 8 -#define IMPL_SEP_BUTTON_IMAGE 4 #define DLGWINDOW_PREV 0 #define DLGWINDOW_NEXT 1 diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 6d6c7aae923a..2c8d6aa0601d 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -2416,10 +2416,8 @@ if ( bNativeOK == FALSE ) void RadioButton::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, const Point& rPos, const Size& rSize, - const Size& rImageSize, long nImageSep, - Rectangle& rStateRect, - Rectangle& rMouseRect, - bool bLayout ) + const Size& rImageSize, Rectangle& rStateRect, + Rectangle& rMouseRect, bool bLayout ) { WinBits nWinStyle = GetStyle(); XubString aText( GetText() ); @@ -2438,9 +2436,9 @@ void RadioButton::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, { USHORT nTextStyle = Button::ImplGetTextStyle( aText, nWinStyle, nDrawFlags ); + const long nImageSep = GetDrawPixel( pDev, ImplGetImageToTextDistance() ); Size aSize( rSize ); Point aPos( rPos ); - aPos.X() += rImageSize.Width() + nImageSep; aSize.Width() -= rImageSize.Width() + nImageSep; @@ -2570,7 +2568,7 @@ void RadioButton::ImplDrawRadioButton( bool bLayout ) // Draw control text ImplDraw( this, 0, Point(), GetOutputSizePixel(), - aImageSize, IMPL_SEP_BUTTON_IMAGE, maStateRect, maMouseRect, bLayout ); + aImageSize, maStateRect, maMouseRect, bLayout ); if( !bLayout || (IsNativeControlSupported(CTRL_RADIOBUTTON, PART_ENTIRE_CONTROL)==TRUE) ) { @@ -2901,8 +2899,7 @@ void RadioButton::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize pDev->SetTextFillColor(); ImplDraw( pDev, nFlags, aPos, aSize, - aImageSize, GetDrawPixel( pDev, IMPL_SEP_BUTTON_IMAGE ), - aStateRect, aMouseRect ); + aImageSize, aStateRect, aMouseRect ); Point aCenterPos = aStateRect.Center(); long nRadX = aImageSize.Width()/2; @@ -3150,6 +3147,15 @@ void RadioButton::Check( BOOL bCheck ) // ----------------------------------------------------------------------- +long RadioButton::ImplGetImageToTextDistance() const +{ + // 4 pixels, but take zoom into account, so the text doesn't "jump" relative to surrounding elements, + // which might have been aligned with the text of the check box + return CalcZoom( 4 ); +} + +// ----------------------------------------------------------------------- + Size RadioButton::ImplGetRadioImageSize() const { Size aSize; @@ -3323,12 +3329,12 @@ Size RadioButton::CalcMinimumSize( long nMaxWidth ) const { // subtract what will be added later nMaxWidth-=2; - nMaxWidth -= IMPL_SEP_BUTTON_IMAGE; + nMaxWidth -= ImplGetImageToTextDistance(); Size aTextSize = GetTextRect( Rectangle( Point(), Size( nMaxWidth > 0 ? nMaxWidth : 0x7fffffff, 0x7fffffff ) ), aText, FixedText::ImplGetTextStyle( GetStyle() ) ).GetSize(); aSize.Width()+=2; // for focus rect - aSize.Width() += IMPL_SEP_BUTTON_IMAGE; + aSize.Width() += ImplGetImageToTextDistance(); aSize.Width() += aTextSize.Width(); if ( aSize.Height() < aTextSize.Height() ) aSize.Height() = aTextSize.Height(); @@ -3513,9 +3519,8 @@ void CheckBox::ImplDrawCheckBoxState() void CheckBox::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, const Point& rPos, const Size& rSize, - const Size& rImageSize, long nImageSep, - Rectangle& rStateRect, Rectangle& rMouseRect, - bool bLayout ) + const Size& rImageSize, Rectangle& rStateRect, + Rectangle& rMouseRect, bool bLayout ) { WinBits nWinStyle = GetStyle(); XubString aText( GetText() ); @@ -3529,6 +3534,7 @@ void CheckBox::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, { USHORT nTextStyle = Button::ImplGetTextStyle( aText, nWinStyle, nDrawFlags ); + const long nImageSep = GetDrawPixel( pDev, ImplGetImageToTextDistance() ); Size aSize( rSize ); Point aPos( rPos ); aPos.X() += rImageSize.Width() + nImageSep; @@ -3626,7 +3632,7 @@ void CheckBox::ImplDrawCheckBox( bool bLayout ) HideFocus(); ImplDraw( this, 0, Point(), GetOutputSizePixel(), aImageSize, - IMPL_SEP_BUTTON_IMAGE, maStateRect, maMouseRect, bLayout ); + maStateRect, maMouseRect, bLayout ); if( !bLayout ) { @@ -3838,8 +3844,7 @@ void CheckBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, pDev->SetTextFillColor(); ImplDraw( pDev, nFlags, aPos, aSize, - aImageSize, GetDrawPixel( pDev, IMPL_SEP_BUTTON_IMAGE ), - aStateRect, aMouseRect, false ); + aImageSize, aStateRect, aMouseRect, false ); pDev->SetLineColor(); pDev->SetFillColor( Color( COL_BLACK ) ); @@ -4085,6 +4090,15 @@ void CheckBox::EnableTriState( BOOL bTriState ) // ----------------------------------------------------------------------- +long CheckBox::ImplGetImageToTextDistance() const +{ + // 4 pixels, but take zoom into account, so the text doesn't "jump" relative to surrounding elements, + // which might have been aligned with the text of the check box + return CalcZoom( 4 ); +} + +// ----------------------------------------------------------------------- + Size CheckBox::ImplGetCheckImageSize() const { Size aSize; @@ -4218,12 +4232,12 @@ Size CheckBox::CalcMinimumSize( long nMaxWidth ) const { // subtract what will be added later nMaxWidth-=2; - nMaxWidth -= IMPL_SEP_BUTTON_IMAGE; + nMaxWidth -= ImplGetImageToTextDistance(); Size aTextSize = GetTextRect( Rectangle( Point(), Size( nMaxWidth > 0 ? nMaxWidth : 0x7fffffff, 0x7fffffff ) ), aText, FixedText::ImplGetTextStyle( GetStyle() ) ).GetSize(); aSize.Width()+=2; // for focus rect - aSize.Width() += IMPL_SEP_BUTTON_IMAGE; + aSize.Width() += ImplGetImageToTextDistance(); aSize.Width() += aTextSize.Width(); if ( aSize.Height() < aTextSize.Height() ) aSize.Height() = aTextSize.Height(); -- cgit From f87ee64d502aec9365d98d53d5b913f6456eae6b Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Tue, 6 Oct 2009 07:38:24 +0200 Subject: #103496#: move VCL free ConfigItems to unotools --- goodies/inc/pch/precompiled_goodies.hxx | 2 +- goodies/source/graphic/grfmgr.cxx | 2 +- svtools/inc/cacheoptions.hxx | 176 -- svtools/inc/eventcfg.hxx | 125 -- svtools/inc/fltrcfg.hxx | 103 -- svtools/inc/javaoptions.hxx | 76 - svtools/inc/linguprops.hxx | 124 -- svtools/inc/regoptions.hxx | 129 -- svtools/inc/searchopt.hxx | 122 -- svtools/inc/svtools/accelcfg.hxx | 88 - svtools/inc/svtools/accessibilityoptions.hxx | 4 +- svtools/inc/svtools/addxmltostorageoptions.hxx | 162 -- svtools/inc/svtools/cjkoptions.hxx | 4 +- svtools/inc/svtools/cmdoptions.hxx | 258 --- svtools/inc/svtools/colorcfg.hxx | 4 +- svtools/inc/svtools/compatibility.hxx | 256 --- svtools/inc/svtools/ctloptions.hxx | 4 +- svtools/inc/svtools/defaultoptions.hxx | 57 - svtools/inc/svtools/dynamicmenuoptions.hxx | 222 --- svtools/inc/svtools/extendedsecurityoptions.hxx | 163 -- svtools/inc/svtools/fontoptions.hxx | 176 -- svtools/inc/svtools/helpopt.hxx | 4 +- svtools/inc/svtools/historyoptions.hxx | 251 --- svtools/inc/svtools/inetoptions.hxx | 146 -- svtools/inc/svtools/internaloptions.hxx | 183 --- svtools/inc/svtools/lingucfg.hxx | 244 --- svtools/inc/svtools/localisationoptions.hxx | 181 --- svtools/inc/svtools/menuoptions.hxx | 4 +- svtools/inc/svtools/miscopt.hxx | 4 +- svtools/inc/svtools/moduleoptions.hxx | 260 --- svtools/inc/svtools/options.hxx | 55 - svtools/inc/svtools/optionsdlg.hxx | 59 - svtools/inc/svtools/pathoptions.hxx | 143 -- svtools/inc/svtools/printoptions.hxx | 4 +- svtools/inc/svtools/printwarningoptions.hxx | 164 -- svtools/inc/svtools/saveopt.hxx | 133 -- svtools/inc/svtools/securityoptions.hxx | 299 ---- svtools/inc/svtools/sourceviewconfig.hxx | 72 - svtools/inc/svtools/startoptions.hxx | 173 -- svtools/inc/svtools/svarray.hxx | 4 +- svtools/inc/svtools/syslocaleoptions.hxx | 4 +- svtools/inc/svtools/undoopt.hxx | 57 - svtools/inc/svtools/useroptions.hxx | 126 -- svtools/inc/svtools/viewoptions.hxx | 356 ---- svtools/inc/svtools/workingsetoptions.hxx | 159 -- svtools/inc/xmlaccelcfg.hxx | 112 -- svtools/prj/d.lst | 208 +-- .../complex/ConfigItems/helper/HistoryOptTest.cxx | 2 +- .../complex/ConfigItems/helper/HistoryOptTest.hxx | 2 +- .../qa/complex/ConfigItems/helper/UserOptTest.hxx | 2 +- svtools/source/config/accelcfg.cxx | 292 ---- svtools/source/config/accessibilityoptions.cxx | 2 +- svtools/source/config/addxmltostorageoptions.cxx | 291 ---- svtools/source/config/cacheoptions.cxx | 510 ------ svtools/source/config/cmdoptions.cxx | 631 -------- svtools/source/config/compatibility.cxx | 807 --------- svtools/source/config/defaultoptions.cxx | 354 ---- svtools/source/config/dynamicmenuoptions.cxx | 923 ----------- svtools/source/config/eventcfg.cxx | 458 ------ svtools/source/config/extendedsecurityoptions.cxx | 541 ------- svtools/source/config/fltrcfg.cxx | 611 ------- svtools/source/config/fontoptions.cxx | 514 ------ svtools/source/config/historyoptions.cxx | 748 --------- svtools/source/config/inetoptions.cxx | 557 ------- svtools/source/config/internaloptions.cxx | 631 -------- svtools/source/config/itemholder1.cxx | 325 ---- svtools/source/config/itemholder1.hxx | 92 -- svtools/source/config/itemholder2.cxx | 16 +- svtools/source/config/itemholder2.hxx | 2 +- svtools/source/config/itemholderbase.hxx | 131 -- svtools/source/config/javaoptions.cxx | 367 ----- svtools/source/config/lingucfg.cxx | 1452 ----------------- svtools/source/config/localisationoptions.cxx | 459 ------ svtools/source/config/loghelper.hxx | 59 - svtools/source/config/makefile.mk | 75 +- svtools/source/config/menuoptions.cxx | 4 +- svtools/source/config/moduleoptions.cxx | 1600 ------------------ svtools/source/config/options.cxx | 42 - svtools/source/config/optionsdlg.cxx | 293 ---- svtools/source/config/pathoptions.cxx | 1094 ------------- svtools/source/config/printoptions.cxx | 2 +- svtools/source/config/printwarningoptions.cxx | 419 ----- svtools/source/config/regoptions.cxx | 554 ------- svtools/source/config/saveopt.cxx | 1047 ------------ svtools/source/config/searchopt.cxx | 634 -------- svtools/source/config/securityoptions.cxx | 1312 --------------- svtools/source/config/sourceviewconfig.cxx | 281 ---- svtools/source/config/startoptions.cxx | 461 ------ svtools/source/config/test/test.cxx | 2 +- svtools/source/config/undoopt.cxx | 220 --- svtools/source/config/useroptions.cxx | 1313 --------------- svtools/source/config/viewoptions.cxx | 1304 --------------- svtools/source/config/workingsetoptions.cxx | 396 ----- svtools/source/config/xmlaccelcfg.cxx | 418 ----- svtools/source/contnr/templwin.cxx | 10 +- svtools/source/control/inettbc.cxx | 4 +- .../inc/configitems/historyoptions_const.hxx | 63 - .../source/inc/configitems/useroptions_const.hxx | 64 - svtools/source/misc/documentlockfile.cxx | 2 +- svtools/source/misc/lockfilecommon.cxx | 2 +- svtools/source/misc/sharecontrolfile.cxx | 2 +- svtools/source/misc/templatefoldercache.cxx | 2 +- .../source/passwordcontainer/passwordcontainer.cxx | 2 +- svtools/source/productregistration/makefile.mk | 3 +- .../productregistration/productregistration.cxx | 18 +- svtools/uno/pathservice.cxx | 2 +- svtools/util/makefile.mk | 7 +- unotools/inc/unotools/accelcfg.hxx | 88 + unotools/inc/unotools/cacheoptions.hxx | 176 ++ unotools/inc/unotools/cmdoptions.hxx | 258 +++ unotools/inc/unotools/compatibility.hxx | 256 +++ unotools/inc/unotools/configitem.hxx | 4 +- unotools/inc/unotools/defaultoptions.hxx | 57 + unotools/inc/unotools/dynamicmenuoptions.hxx | 222 +++ unotools/inc/unotools/eventcfg.hxx | 125 ++ unotools/inc/unotools/extendedsecurityoptions.hxx | 163 ++ unotools/inc/unotools/fltrcfg.hxx | 103 ++ unotools/inc/unotools/fontoptions.hxx | 176 ++ unotools/inc/unotools/historyoptions.hxx | 251 +++ unotools/inc/unotools/historyoptions_const.hxx | 63 + unotools/inc/unotools/inetoptions.hxx | 146 ++ unotools/inc/unotools/internaloptions.hxx | 183 +++ unotools/inc/unotools/itemholderbase.hxx | 131 ++ unotools/inc/unotools/javaoptions.hxx | 76 + unotools/inc/unotools/lingucfg.hxx | 244 +++ unotools/inc/unotools/linguprops.hxx | 124 ++ unotools/inc/unotools/localisationoptions.hxx | 181 +++ unotools/inc/unotools/loghelper.hxx | 59 + unotools/inc/unotools/moduleoptions.hxx | 260 +++ unotools/inc/unotools/options.hxx | 79 + unotools/inc/unotools/optionsdlg.hxx | 59 + unotools/inc/unotools/pathoptions.hxx | 143 ++ unotools/inc/unotools/printwarningoptions.hxx | 164 ++ unotools/inc/unotools/regoptions.hxx | 129 ++ unotools/inc/unotools/saveopt.hxx | 133 ++ unotools/inc/unotools/searchopt.hxx | 122 ++ unotools/inc/unotools/securityoptions.hxx | 299 ++++ unotools/inc/unotools/sourceviewconfig.hxx | 66 + unotools/inc/unotools/startoptions.hxx | 173 ++ unotools/inc/unotools/undoopt.hxx | 52 + unotools/inc/unotools/useroptions.hxx | 121 ++ unotools/inc/unotools/useroptions_const.hxx | 64 + unotools/inc/unotools/viewoptions.hxx | 356 ++++ unotools/inc/unotools/workingsetoptions.hxx | 159 ++ unotools/inc/unotools/xmlaccelcfg.hxx | 112 ++ unotools/source/config/accelcfg.cxx | 292 ++++ unotools/source/config/cacheoptions.cxx | 510 ++++++ unotools/source/config/cmdoptions.cxx | 631 ++++++++ unotools/source/config/compatibility.cxx | 807 +++++++++ unotools/source/config/configitem.cxx | 35 +- unotools/source/config/defaultoptions.cxx | 354 ++++ unotools/source/config/dynamicmenuoptions.cxx | 923 +++++++++++ unotools/source/config/eventcfg.cxx | 458 ++++++ unotools/source/config/extendedsecurityoptions.cxx | 541 +++++++ unotools/source/config/fltrcfg.cxx | 611 +++++++ unotools/source/config/fontoptions.cxx | 514 ++++++ unotools/source/config/historyoptions.cxx | 748 +++++++++ unotools/source/config/inetoptions.cxx | 557 +++++++ unotools/source/config/internaloptions.cxx | 631 ++++++++ unotools/source/config/itemholder1.cxx | 326 ++++ unotools/source/config/itemholder1.hxx | 92 ++ unotools/source/config/javaoptions.cxx | 367 +++++ unotools/source/config/lingucfg.cxx | 1450 +++++++++++++++++ unotools/source/config/localisationoptions.cxx | 459 ++++++ unotools/source/config/makefile.mk | 37 +- unotools/source/config/menuoptions.cxx | 564 +++++++ unotools/source/config/moduleoptions.cxx | 1600 ++++++++++++++++++ unotools/source/config/options.cxx | 88 + unotools/source/config/optionsdlg.cxx | 293 ++++ unotools/source/config/optionsdrawinglayer.cxx | 1708 ++++++++++++++++++++ unotools/source/config/pathoptions.cxx | 1094 +++++++++++++ unotools/source/config/printwarningoptions.cxx | 419 +++++ unotools/source/config/regoptions.cxx | 554 +++++++ unotools/source/config/saveopt.cxx | 1047 ++++++++++++ unotools/source/config/searchopt.cxx | 634 ++++++++ unotools/source/config/securityoptions.cxx | 1312 +++++++++++++++ unotools/source/config/sourceviewconfig.cxx | 271 ++++ unotools/source/config/startoptions.cxx | 461 ++++++ unotools/source/config/undoopt.cxx | 208 +++ unotools/source/config/useroptions.cxx | 1304 +++++++++++++++ unotools/source/config/viewoptions.cxx | 1304 +++++++++++++++ unotools/source/config/workingsetoptions.cxx | 396 +++++ unotools/source/config/xmlaccelcfg.cxx | 418 +++++ 183 files changed, 29665 insertions(+), 28023 deletions(-) delete mode 100644 svtools/inc/cacheoptions.hxx delete mode 100644 svtools/inc/eventcfg.hxx delete mode 100644 svtools/inc/fltrcfg.hxx delete mode 100644 svtools/inc/javaoptions.hxx delete mode 100644 svtools/inc/linguprops.hxx delete mode 100644 svtools/inc/regoptions.hxx delete mode 100644 svtools/inc/searchopt.hxx delete mode 100644 svtools/inc/svtools/accelcfg.hxx delete mode 100644 svtools/inc/svtools/addxmltostorageoptions.hxx delete mode 100644 svtools/inc/svtools/cmdoptions.hxx delete mode 100644 svtools/inc/svtools/compatibility.hxx delete mode 100644 svtools/inc/svtools/defaultoptions.hxx delete mode 100644 svtools/inc/svtools/dynamicmenuoptions.hxx delete mode 100644 svtools/inc/svtools/extendedsecurityoptions.hxx delete mode 100644 svtools/inc/svtools/fontoptions.hxx delete mode 100644 svtools/inc/svtools/historyoptions.hxx delete mode 100644 svtools/inc/svtools/inetoptions.hxx delete mode 100644 svtools/inc/svtools/internaloptions.hxx delete mode 100644 svtools/inc/svtools/lingucfg.hxx delete mode 100644 svtools/inc/svtools/localisationoptions.hxx delete mode 100644 svtools/inc/svtools/moduleoptions.hxx delete mode 100644 svtools/inc/svtools/options.hxx delete mode 100644 svtools/inc/svtools/optionsdlg.hxx delete mode 100644 svtools/inc/svtools/pathoptions.hxx delete mode 100644 svtools/inc/svtools/printwarningoptions.hxx delete mode 100644 svtools/inc/svtools/saveopt.hxx delete mode 100644 svtools/inc/svtools/securityoptions.hxx delete mode 100644 svtools/inc/svtools/sourceviewconfig.hxx delete mode 100644 svtools/inc/svtools/startoptions.hxx delete mode 100644 svtools/inc/svtools/undoopt.hxx delete mode 100644 svtools/inc/svtools/useroptions.hxx delete mode 100644 svtools/inc/svtools/viewoptions.hxx delete mode 100644 svtools/inc/svtools/workingsetoptions.hxx delete mode 100644 svtools/inc/xmlaccelcfg.hxx delete mode 100644 svtools/source/config/accelcfg.cxx delete mode 100644 svtools/source/config/addxmltostorageoptions.cxx delete mode 100644 svtools/source/config/cacheoptions.cxx delete mode 100644 svtools/source/config/cmdoptions.cxx delete mode 100644 svtools/source/config/compatibility.cxx delete mode 100644 svtools/source/config/defaultoptions.cxx delete mode 100644 svtools/source/config/dynamicmenuoptions.cxx delete mode 100644 svtools/source/config/eventcfg.cxx delete mode 100644 svtools/source/config/extendedsecurityoptions.cxx delete mode 100644 svtools/source/config/fltrcfg.cxx delete mode 100644 svtools/source/config/fontoptions.cxx delete mode 100644 svtools/source/config/historyoptions.cxx delete mode 100644 svtools/source/config/inetoptions.cxx delete mode 100644 svtools/source/config/internaloptions.cxx delete mode 100644 svtools/source/config/itemholder1.cxx delete mode 100644 svtools/source/config/itemholder1.hxx delete mode 100644 svtools/source/config/itemholderbase.hxx delete mode 100644 svtools/source/config/javaoptions.cxx delete mode 100644 svtools/source/config/lingucfg.cxx delete mode 100644 svtools/source/config/localisationoptions.cxx delete mode 100644 svtools/source/config/loghelper.hxx delete mode 100644 svtools/source/config/moduleoptions.cxx delete mode 100644 svtools/source/config/options.cxx delete mode 100644 svtools/source/config/optionsdlg.cxx delete mode 100644 svtools/source/config/pathoptions.cxx delete mode 100644 svtools/source/config/printwarningoptions.cxx delete mode 100644 svtools/source/config/regoptions.cxx delete mode 100644 svtools/source/config/saveopt.cxx delete mode 100644 svtools/source/config/searchopt.cxx delete mode 100644 svtools/source/config/securityoptions.cxx delete mode 100644 svtools/source/config/sourceviewconfig.cxx delete mode 100644 svtools/source/config/startoptions.cxx delete mode 100644 svtools/source/config/undoopt.cxx delete mode 100644 svtools/source/config/useroptions.cxx delete mode 100644 svtools/source/config/viewoptions.cxx delete mode 100644 svtools/source/config/workingsetoptions.cxx delete mode 100644 svtools/source/config/xmlaccelcfg.cxx delete mode 100644 svtools/source/inc/configitems/historyoptions_const.hxx delete mode 100644 svtools/source/inc/configitems/useroptions_const.hxx create mode 100644 unotools/inc/unotools/accelcfg.hxx create mode 100644 unotools/inc/unotools/cacheoptions.hxx create mode 100644 unotools/inc/unotools/cmdoptions.hxx create mode 100644 unotools/inc/unotools/compatibility.hxx create mode 100644 unotools/inc/unotools/defaultoptions.hxx create mode 100644 unotools/inc/unotools/dynamicmenuoptions.hxx create mode 100644 unotools/inc/unotools/eventcfg.hxx create mode 100644 unotools/inc/unotools/extendedsecurityoptions.hxx create mode 100644 unotools/inc/unotools/fltrcfg.hxx create mode 100644 unotools/inc/unotools/fontoptions.hxx create mode 100644 unotools/inc/unotools/historyoptions.hxx create mode 100644 unotools/inc/unotools/historyoptions_const.hxx create mode 100644 unotools/inc/unotools/inetoptions.hxx create mode 100644 unotools/inc/unotools/internaloptions.hxx create mode 100644 unotools/inc/unotools/itemholderbase.hxx create mode 100644 unotools/inc/unotools/javaoptions.hxx create mode 100644 unotools/inc/unotools/lingucfg.hxx create mode 100644 unotools/inc/unotools/linguprops.hxx create mode 100644 unotools/inc/unotools/localisationoptions.hxx create mode 100644 unotools/inc/unotools/loghelper.hxx create mode 100644 unotools/inc/unotools/moduleoptions.hxx create mode 100644 unotools/inc/unotools/options.hxx create mode 100644 unotools/inc/unotools/optionsdlg.hxx create mode 100644 unotools/inc/unotools/pathoptions.hxx create mode 100644 unotools/inc/unotools/printwarningoptions.hxx create mode 100644 unotools/inc/unotools/regoptions.hxx create mode 100644 unotools/inc/unotools/saveopt.hxx create mode 100644 unotools/inc/unotools/searchopt.hxx create mode 100644 unotools/inc/unotools/securityoptions.hxx create mode 100644 unotools/inc/unotools/sourceviewconfig.hxx create mode 100644 unotools/inc/unotools/startoptions.hxx create mode 100644 unotools/inc/unotools/undoopt.hxx create mode 100644 unotools/inc/unotools/useroptions.hxx create mode 100644 unotools/inc/unotools/useroptions_const.hxx create mode 100644 unotools/inc/unotools/viewoptions.hxx create mode 100644 unotools/inc/unotools/workingsetoptions.hxx create mode 100644 unotools/inc/unotools/xmlaccelcfg.hxx create mode 100644 unotools/source/config/accelcfg.cxx create mode 100644 unotools/source/config/cacheoptions.cxx create mode 100644 unotools/source/config/cmdoptions.cxx create mode 100644 unotools/source/config/compatibility.cxx create mode 100644 unotools/source/config/defaultoptions.cxx create mode 100644 unotools/source/config/dynamicmenuoptions.cxx create mode 100644 unotools/source/config/eventcfg.cxx create mode 100644 unotools/source/config/extendedsecurityoptions.cxx create mode 100644 unotools/source/config/fltrcfg.cxx create mode 100644 unotools/source/config/fontoptions.cxx create mode 100644 unotools/source/config/historyoptions.cxx create mode 100644 unotools/source/config/inetoptions.cxx create mode 100644 unotools/source/config/internaloptions.cxx create mode 100644 unotools/source/config/itemholder1.cxx create mode 100644 unotools/source/config/itemholder1.hxx create mode 100644 unotools/source/config/javaoptions.cxx create mode 100644 unotools/source/config/lingucfg.cxx create mode 100644 unotools/source/config/localisationoptions.cxx create mode 100644 unotools/source/config/menuoptions.cxx create mode 100644 unotools/source/config/moduleoptions.cxx create mode 100644 unotools/source/config/options.cxx create mode 100644 unotools/source/config/optionsdlg.cxx create mode 100644 unotools/source/config/optionsdrawinglayer.cxx create mode 100644 unotools/source/config/pathoptions.cxx create mode 100644 unotools/source/config/printwarningoptions.cxx create mode 100644 unotools/source/config/regoptions.cxx create mode 100644 unotools/source/config/saveopt.cxx create mode 100644 unotools/source/config/searchopt.cxx create mode 100644 unotools/source/config/securityoptions.cxx create mode 100644 unotools/source/config/sourceviewconfig.cxx create mode 100644 unotools/source/config/startoptions.cxx create mode 100644 unotools/source/config/undoopt.cxx create mode 100644 unotools/source/config/useroptions.cxx create mode 100644 unotools/source/config/viewoptions.cxx create mode 100644 unotools/source/config/workingsetoptions.cxx create mode 100644 unotools/source/config/xmlaccelcfg.cxx diff --git a/goodies/inc/pch/precompiled_goodies.hxx b/goodies/inc/pch/precompiled_goodies.hxx index b0d1ba09410b..85a97433411b 100644 --- a/goodies/inc/pch/precompiled_goodies.hxx +++ b/goodies/inc/pch/precompiled_goodies.hxx @@ -96,7 +96,7 @@ #include "rtl/uuid.h" #include "svtools/FilterConfigItem.hxx" -#include "svtools/cacheoptions.hxx" +#include "unotools/cacheoptions.hxx" #include "svtools/fltcall.hxx" #include "svtools/itemprop.hxx" #include "svtools/lstner.hxx" diff --git a/goodies/source/graphic/grfmgr.cxx b/goodies/source/graphic/grfmgr.cxx index 5cb37a51e81f..39c1e53e7184 100644 --- a/goodies/source/graphic/grfmgr.cxx +++ b/goodies/source/graphic/grfmgr.cxx @@ -44,7 +44,7 @@ #include #include #include -#include +#include #include "grfmgr.hxx" // ----------- diff --git a/svtools/inc/cacheoptions.hxx b/svtools/inc/cacheoptions.hxx deleted file mode 100644 index 0dd1d2eaaf6d..000000000000 --- a/svtools/inc/cacheoptions.hxx +++ /dev/null @@ -1,176 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: cacheoptions.hxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_SVTOOLS_CACHEOPTIONS_HXX -#define INCLUDED_SVTOOLS_CACHEOPTIONS_HXX - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include "svtools/svldllapi.h" -#include -#include -#include - -//_________________________________________________________________________________________________________________ -// forward declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short forward declaration to our private date container implementation - @descr We use these class as internal member to support small memory requirements. - You can create the container if it is neccessary. The class which use these mechanism - is faster and smaller then a complete implementation! -*//*-*************************************************************************************************************/ - -class SvtCacheOptions_Impl; - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short collect informations about startup features - @descr - - - @implements - - @base - - - @devstatus ready to use -*//*-*************************************************************************************************************/ - -class SVL_DLLPUBLIC SvtCacheOptions -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short standard constructor and destructor - @descr This will initialize an instance with default values. - We implement these class with a refcount mechanism! Every instance of this class increase it - at create and decrease it at delete time - but all instances use the same data container! - He is implemented as a static member ... - - @seealso member m_nRefCount - @seealso member m_pDataContainer - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - SvtCacheOptions(); - ~SvtCacheOptions(); - - //--------------------------------------------------------------------------------------------------------- - // interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short interface methods to get and set value of config key "org.openoffice.Office.Common/_3D-Engine/..." - @descr These options describe internal states to enable/disable features of installed office. - - GetWriterOLE_Objects() - SetWriterOLE_Objects() => set the number of Writer OLE objects to be cached - - GetDrawingEngineOLE_Objects() - SetDrawingEngineOLE_Objects() => set the number of DrawingEngine OLE objects to be cached - - GetGraphicManagerTotalCacheSize() - SetGraphicManagerTotalCacheSize() => set the maximum cache size used by GraphicManager to cache graphic objects - - GetGraphicManagerObjectCacheSize() - SetGraphicManagerObjectCacheSize() => set the maximum cache size for one GraphicObject to be cached by GraphicManager - - @seealso configuration package "org.openoffice.Office.Common/_3D-Engine" - *//*-*****************************************************************************************************/ - - sal_Int32 GetWriterOLE_Objects() const; - sal_Int32 GetDrawingEngineOLE_Objects() const; - sal_Int32 GetGraphicManagerTotalCacheSize() const; - sal_Int32 GetGraphicManagerObjectCacheSize() const; - sal_Int32 GetGraphicManagerObjectReleaseTime() const; - - void SetWriterOLE_Objects( sal_Int32 nObjects ); - void SetDrawingEngineOLE_Objects( sal_Int32 nObjects ); - void SetGraphicManagerTotalCacheSize( sal_Int32 nTotalCacheSize ); - void SetGraphicManagerObjectCacheSize( sal_Int32 nObjectCacheSize ); - void SetGraphicManagerObjectReleaseTime( sal_Int32 nReleaseTimeSeconds ); - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return a reference to a static mutex - @descr These class use his own static mutex to be threadsafe. - We create a static mutex only for one ime and use at different times. - - @seealso - - - @param - - @return A reference to a static mutex member. - - @onerror - - *//*-*****************************************************************************************************/ - - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - /*Attention - - Don't initialize these static member in these header! - a) Double dfined symbols will be detected ... - b) and unresolved externals exist at linking time. - Do it in your source only. - */ - - static SvtCacheOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! - static sal_Int32 m_nRefCount ; /// internal ref count mechanism - -}; - -#endif // #ifndef INCLUDED_SVTOOLS_CACHEOPTIONS_HXX diff --git a/svtools/inc/eventcfg.hxx b/svtools/inc/eventcfg.hxx deleted file mode 100644 index 4ee175f5b7e0..000000000000 --- a/svtools/inc/eventcfg.hxx +++ /dev/null @@ -1,125 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: eventcfg.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _EVENTCFG_HXX -#define _EVENTCFG_HXX - -#include "svtools/svldllapi.h" -#include -#include -#include -#include -#include -#include -#include -#include - -#define STR_EVENT_STARTAPP 0 -#define STR_EVENT_CLOSEAPP 1 -#define STR_EVENT_DOCCREATED 2 -#define STR_EVENT_CREATEDOC 3 -#define STR_EVENT_LOADFINISHED 4 -#define STR_EVENT_OPENDOC 5 -#define STR_EVENT_PREPARECLOSEDOC 6 -#define STR_EVENT_CLOSEDOC 7 -#define STR_EVENT_SAVEDOC 8 -#define STR_EVENT_SAVEDOCDONE 9 -#define STR_EVENT_SAVEDOCFAILED 10 -#define STR_EVENT_SAVEASDOC 11 -#define STR_EVENT_SAVEASDOCDONE 12 -#define STR_EVENT_SAVEASDOCFAILED 13 -#define STR_EVENT_SAVETODOC 14 -#define STR_EVENT_SAVETODOCDONE 15 -#define STR_EVENT_SAVETODOCFAILED 16 -#define STR_EVENT_ACTIVATEDOC 17 -#define STR_EVENT_DEACTIVATEDOC 18 -#define STR_EVENT_PRINTDOC 19 -#define STR_EVENT_VIEWCREATED 20 -#define STR_EVENT_PREPARECLOSEVIEW 21 -#define STR_EVENT_CLOSEVIEW 22 -#define STR_EVENT_MODIFYCHANGED 23 -#define STR_EVENT_TITLECHANGED 24 -#define STR_EVENT_VISAREACHANGED 25 -#define STR_EVENT_MODECHANGED 26 -#define STR_EVENT_STORAGECHANGED 27 - -typedef ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > EventBindingHash; -typedef ::std::vector< ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XFrame > > FrameVector; -typedef ::std::vector< ::rtl::OUString > SupportedEventsVector; - -class GlobalEventConfig_Impl : public utl::ConfigItem -{ - EventBindingHash m_eventBindingHash; - FrameVector m_lFrames; - SupportedEventsVector m_supportedEvents; - - void initBindingInfo(); - -public: - GlobalEventConfig_Impl( ); - ~GlobalEventConfig_Impl( ); - - void EstablishFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame); - void Notify( const com::sun::star::uno::Sequence& aPropertyNames); - void Commit(); - - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents( ) throw (::com::sun::star::uno::RuntimeException); - void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException); - ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException); - ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException); - ::rtl::OUString GetEventName( sal_Int32 nID ); -}; - -class SVL_DLLPUBLIC GlobalEventConfig: - public ::cppu::WeakImplHelper2 < ::com::sun::star::document::XEventsSupplier, ::com::sun::star::container::XNameReplace > -{ - public: - GlobalEventConfig( ); - ~GlobalEventConfig( ); - static ::osl::Mutex& GetOwnStaticMutex(); - - void EstablishFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame); - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents( ) throw (::com::sun::star::uno::RuntimeException); - void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException); - ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException); - ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException); - static ::rtl::OUString GetEventName( sal_Int32 nID ); - - private: - static GlobalEventConfig_Impl* m_pImpl; - static sal_Int32 m_nRefCount; -}; - -#endif // _EVENTCFG_HXX diff --git a/svtools/inc/fltrcfg.hxx b/svtools/inc/fltrcfg.hxx deleted file mode 100644 index 480ebc28b29f..000000000000 --- a/svtools/inc/fltrcfg.hxx +++ /dev/null @@ -1,103 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: fltrcfg.hxx,v $ - * $Revision: 1.9 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVT_FLTRCFG_HXX -#define _SVT_FLTRCFG_HXX - -// ----------------------------------------------------------------------- - -#include "svtools/svldllapi.h" -#include - -struct SvtFilterOptions_Impl; -class SVL_DLLPUBLIC SvtFilterOptions : public utl::ConfigItem -{ - SvtFilterOptions_Impl* pImp; - - const com::sun::star::uno::Sequence& GetPropertyNames(); -public: - SvtFilterOptions(); - virtual ~SvtFilterOptions(); - - virtual void Notify( const com::sun::star::uno::Sequence& aPropertyNames); - virtual void Commit(); - void Load(); - - void SetLoadWordBasicCode( sal_Bool bFlag ); - sal_Bool IsLoadWordBasicCode() const; - void SetLoadWordBasicStorage( sal_Bool bFlag ); - sal_Bool IsLoadWordBasicStorage() const; - - void SetLoadExcelBasicCode( sal_Bool bFlag ); - sal_Bool IsLoadExcelBasicCode() const; - void SetLoadExcelBasicExecutable( sal_Bool bFlag ); - sal_Bool IsLoadExcelBasicExecutable() const; - void SetLoadExcelBasicStorage( sal_Bool bFlag ); - sal_Bool IsLoadExcelBasicStorage() const; - - void SetLoadPPointBasicCode( sal_Bool bFlag ); - sal_Bool IsLoadPPointBasicCode() const; - void SetLoadPPointBasicStorage( sal_Bool bFlag ); - sal_Bool IsLoadPPointBasicStorage() const; - - sal_Bool IsMathType2Math() const; - void SetMathType2Math( sal_Bool bFlag ); - sal_Bool IsMath2MathType() const; - void SetMath2MathType( sal_Bool bFlag ); - - sal_Bool IsWinWord2Writer() const; - void SetWinWord2Writer( sal_Bool bFlag ); - sal_Bool IsWriter2WinWord() const; - void SetWriter2WinWord( sal_Bool bFlag ); - - sal_Bool IsUseEnhancedFields() const; - void SetUseEnhancedFields( sal_Bool bFlag ); - - sal_Bool IsExcel2Calc() const; - void SetExcel2Calc( sal_Bool bFlag ); - sal_Bool IsCalc2Excel() const; - void SetCalc2Excel( sal_Bool bFlag ); - - sal_Bool IsPowerPoint2Impress() const; - void SetPowerPoint2Impress( sal_Bool bFlag ); - sal_Bool IsImpress2PowerPoint() const; - void SetImpress2PowerPoint( sal_Bool bFlag ); - - sal_Bool IsEnablePPTPreview() const; - sal_Bool IsEnableCalcPreview() const; - sal_Bool IsEnableWordPreview() const; - - static SvtFilterOptions* Get(); -}; - -#endif - - - - diff --git a/svtools/inc/javaoptions.hxx b/svtools/inc/javaoptions.hxx deleted file mode 100644 index 4e1f23376407..000000000000 --- a/svtools/inc/javaoptions.hxx +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: javaoptions.hxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVTOOLS_JAVAOPTIONS_HXX -#define _SVTOOLS_JAVAOPTIONS_HXX - -#include "svtools/svldllapi.h" -#include -#include - - -// class SvtJavaOptions -------------------------------------------------- - -struct SvtJavaOptions_Impl; - -class SVL_DLLPUBLIC SvtJavaOptions : public utl::ConfigItem -{ - SvtJavaOptions_Impl* pImpl; -public: - enum EOption - { - E_ENABLED, - E_SECURITY, - E_NETACCESS, - E_USERCLASSPATH, - E_EXECUTEAPPLETS - }; - - SvtJavaOptions(); - ~SvtJavaOptions(); - - virtual void Commit(); - - sal_Bool IsEnabled() const; - sal_Bool IsSecurity()const; - sal_Int32 GetNetAccess() const; - rtl::OUString& GetUserClassPath()const; - sal_Bool IsExecuteApplets() const; - - void SetEnabled(sal_Bool bSet) ; - void SetSecurity(sal_Bool bSet); - void SetNetAccess(sal_Int32 nSet) ; - void SetUserClassPath(const rtl::OUString& rSet); - void SetExecuteApplets(sal_Bool bSet); - - sal_Bool IsReadOnly( EOption eOption ) const; -}; - -#endif // - diff --git a/svtools/inc/linguprops.hxx b/svtools/inc/linguprops.hxx deleted file mode 100644 index 883d5069f7a8..000000000000 --- a/svtools/inc/linguprops.hxx +++ /dev/null @@ -1,124 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: linguprops.hxx,v $ - * $Revision: 1.10 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVTOOLS_LINGUPROPS_HXX_ -#define _SVTOOLS_LINGUPROPS_HXX_ - - -// UNO property names for general options -#define UPN_IS_GERMAN_PRE_REFORM "IsGermanPreReform" /*! deprecated #i91949 !*/ -#define UPN_IS_USE_DICTIONARY_LIST "IsUseDictionaryList" -#define UPN_IS_IGNORE_CONTROL_CHARACTERS "IsIgnoreControlCharacters" -#define UPN_ACTIVE_DICTIONARIES "ActiveDictionaries" - -// UNO property names for SpellChecker -#define UPN_IS_SPELL_UPPER_CASE "IsSpellUpperCase" -#define UPN_IS_SPELL_WITH_DIGITS "IsSpellWithDigits" -#define UPN_IS_SPELL_CAPITALIZATION "IsSpellCapitalization" - -// UNO property names for Hyphenator -#define UPN_HYPH_MIN_LEADING "HyphMinLeading" -#define UPN_HYPH_MIN_TRAILING "HyphMinTrailing" -#define UPN_HYPH_MIN_WORD_LENGTH "HyphMinWordLength" - -// UNO property names for Lingu -// (those not covered by the SpellChecker and Hyphenator -// properties and more likely to be used in other modules only) -#define UPN_DEFAULT_LANGUAGE "DefaultLanguage" -#define UPN_DEFAULT_LOCALE "DefaultLocale" -#define UPN_DEFAULT_LOCALE_CJK "DefaultLocale_CJK" -#define UPN_DEFAULT_LOCALE_CTL "DefaultLocale_CTL" -#define UPN_IS_HYPH_AUTO "IsHyphAuto" -#define UPN_IS_HYPH_SPECIAL "IsHyphSpecial" -#define UPN_IS_SPELL_AUTO "IsSpellAuto" -#define UPN_IS_SPELL_HIDE "IsSpellHide" /*! deprecated #i91949 !*/ -#define UPN_IS_SPELL_IN_ALL_LANGUAGES "IsSpellInAllLanguages" /*! deprecated #i91949 !*/ -#define UPN_IS_SPELL_SPECIAL "IsSpellSpecial" -#define UPN_IS_WRAP_REVERSE "IsWrapReverse" -#define UPN_DATA_FILES_CHANGED_CHECK_VALUE "DataFilesChangedCheckValue" - -// UNO property names for text conversion options -#define UPN_ACTIVE_CONVERSION_DICTIONARIES "ActiveConversionDictionaries" -#define UPN_IS_IGNORE_POST_POSITIONAL_WORD "IsIgnorePostPositionalWord" -#define UPN_IS_AUTO_CLOSE_DIALOG "IsAutoCloseDialog" -#define UPN_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST "IsShowEntriesRecentlyUsedFirst" -#define UPN_IS_AUTO_REPLACE_UNIQUE_ENTRIES "IsAutoReplaceUniqueEntries" -#define UPN_IS_DIRECTION_TO_SIMPLIFIED "IsDirectionToSimplified" -#define UPN_IS_USE_CHARACTER_VARIANTS "IsUseCharacterVariants" -#define UPN_IS_TRANSLATE_COMMON_TERMS "IsTranslateCommonTerms" -#define UPN_IS_REVERSE_MAPPING "IsReverseMapping" - -// new UNO propertynames to be used with 'dictionaries as extensions' -#define UPN_DICTIONARIES "Dictionaries" -#define UPN_SPELL_CHECKERS "SpellCheckers" -#define UPN_HYPHENATORS "Hyphenators" -#define UPN_THESAURI "Thesauri" -#define UPN_CURRENT_ACTIVE_DICTIONARIES "CurrentActiveDictionaries" -#define UPN_LAST_ACTIVE_DICTIONARIES "LastActiveDictionaries" - -#define UPN_IS_GRAMMAR_AUTO "IsAutoGrammarCheck" -#define UPN_IS_GRAMMAR_INTERACTIVE "IsInteractiveGrammarCheck" - -// uno property handles -#define UPH_IS_GERMAN_PRE_REFORM 0 -#define UPH_IS_USE_DICTIONARY_LIST 1 -#define UPH_IS_IGNORE_CONTROL_CHARACTERS 2 -#define UPH_IS_SPELL_UPPER_CASE 3 -#define UPH_IS_SPELL_WITH_DIGITS 4 -#define UPH_IS_SPELL_CAPITALIZATION 5 -#define UPH_HYPH_MIN_LEADING 6 -#define UPH_HYPH_MIN_TRAILING 7 -#define UPH_HYPH_MIN_WORD_LENGTH 8 -#define UPH_DEFAULT_LOCALE 9 -#define UPH_IS_SPELL_AUTO 10 -#define UPH_IS_SPELL_HIDE 11 -#define UPH_IS_SPELL_IN_ALL_LANGUAGES 12 -#define UPH_IS_SPELL_SPECIAL 13 -#define UPH_IS_HYPH_AUTO 14 -#define UPH_IS_HYPH_SPECIAL 15 -#define UPH_IS_WRAP_REVERSE 16 -#define UPH_DATA_FILES_CHANGED_CHECK_VALUE 17 -#define UPH_DEFAULT_LANGUAGE 21 -#define UPH_DEFAULT_LOCALE_CJK 22 -#define UPH_DEFAULT_LOCALE_CTL 23 -#define UPH_ACTIVE_DICTIONARIES 24 -#define UPH_ACTIVE_CONVERSION_DICTIONARIES 25 -#define UPH_IS_IGNORE_POST_POSITIONAL_WORD 26 -#define UPH_IS_AUTO_CLOSE_DIALOG 27 -#define UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST 28 -#define UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES 29 -#define UPH_IS_DIRECTION_TO_SIMPLIFIED 30 -#define UPH_IS_USE_CHARACTER_VARIANTS 31 -#define UPH_IS_TRANSLATE_COMMON_TERMS 32 -#define UPH_IS_REVERSE_MAPPING 33 -#define UPH_IS_GRAMMAR_AUTO 34 -#define UPH_IS_GRAMMAR_INTERACTIVE 35 -#endif - diff --git a/svtools/inc/regoptions.hxx b/svtools/inc/regoptions.hxx deleted file mode 100644 index 109cc6dd7754..000000000000 --- a/svtools/inc/regoptions.hxx +++ /dev/null @@ -1,129 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: regoptions.hxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SVTOOLS_REGOPTIONS_HXX -#define SVTOOLS_REGOPTIONS_HXX - -#include "svtools/svldllapi.h" -#include - -//........................................................................ -namespace svt -{ -//........................................................................ - - //==================================================================== - //= RegOptions - //==================================================================== - class RegOptionsImpl; - /** encapsulates access to the configuration settings for registering the product - */ - class SVL_DLLPUBLIC RegOptions - { - private: - RegOptionsImpl* m_pImpl; - - // the impl class is constructed upon need only (as this is expensive) - SVL_DLLPRIVATE void ensureImpl( ); - - public: - RegOptions( ); - ~RegOptions( ); - - // retrieves the URL which should be used for online registration - String getRegistrationURL( ) const; - - // checks if the menu item which can be used to trigger the online registration should be available - sal_Bool allowMenu( ) const; - - enum DialogPermission - { // the registration dialog shall be executed .... - dpDisabled, // ... never - it has been disabled - dpNotThisSession, // ... later - no statement when, but _not now_ - dpRemindLater, // ... later at a reminder date - dpThisSession // ... during this session - }; - - /** checks if the registration dialog is allowed -

A return value of does not mean that during this session, the dialog is allowed to - be executed. It simply means executing it is allowed in general

- */ - DialogPermission getDialogPermission( ) const; - - /** claims that the current session is done with respect to the registration dialog. - -

This is not to be called if getDialogPermission returned dpDisabled previously

-

The behaviour changes as follows: -

    -
  • any subsequent calls to getDialogPermission will return dpNotThisSession, given - that it previously returned dpNotThisSession
  • -
  • any subsequent calls to getDialogPermission will return dpDisabled, given - that it previously returned dpThisSession
  • -
  • an internal (persistent) session counter is updated, so that during the next session, - getDialogPermission may return dpThisSession
  • -

- */ - void markSessionDone( ); - - /** activates the reminder - -

If this method is called, the reminder for the dialog will be activated. - This means that during the next _nDaysFromNow-1 days, - getDialogPermission will return dpRemindLater

, - at the _nDaysFromNowth day from today onwards it will - return dpThisSession.

- -

It is not allowed to call this method if the dialog is currently disabled.

- -

If the current session has not been marked as done already - (i.e., markSessionDone has not been called, yet), this is - done implicitly when you call activateReminder.

- */ - void activateReminder( sal_Int32 _nDaysFromNow ); - - /** removes the reminder - -

If this method is called, the reminder for the dialog will be removed. - */ - void removeReminder(); - - /** checks if the reminder date has come - -

Returns if the current date is greater or equal the reminder date. - */ - bool hasReminderDateCome() const; - }; - -//........................................................................ -} // namespace svt -//........................................................................ - -#endif // SVTOOLS_REGOPTIONS_HXX - diff --git a/svtools/inc/searchopt.hxx b/svtools/inc/searchopt.hxx deleted file mode 100644 index 4475f406805d..000000000000 --- a/svtools/inc/searchopt.hxx +++ /dev/null @@ -1,122 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: searchopt.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVT_SEARCHOPT_HXX_ -#define _SVT_SEARCHOPT_HXX_ - -#include "svtools/svldllapi.h" -#include "tools/solar.h" - -class SvtSearchOptions_Impl; - -class SVL_DLLPUBLIC SvtSearchOptions -{ - SvtSearchOptions_Impl *pImpl; - - // disallow copy-constructor and assignment-operator for now - SvtSearchOptions( const SvtSearchOptions & ); - SvtSearchOptions & operator = ( const SvtSearchOptions & ); - -protected: - -public: - SvtSearchOptions(); - ~SvtSearchOptions(); - - INT32 GetTransliterationFlags() const; - - // - // General Options - // - - BOOL IsWholeWordsOnly() const; - BOOL IsBackwards() const; - BOOL IsUseRegularExpression() const; - BOOL IsSearchForStyles() const; - BOOL IsSimilaritySearch() const; - BOOL IsUseAsianOptions() const; - BOOL IsMatchCase() const; // also Japanese search option - BOOL IsNotes() const; - - void SetWholeWordsOnly( BOOL bVal ); - void SetBackwards( BOOL bVal ); - void SetUseRegularExpression( BOOL bVal ); - void SetSearchForStyles( BOOL bVal ); - void SetSimilaritySearch( BOOL bVal ); - void SetUseAsianOptions( BOOL bVal ); - void SetMatchCase( BOOL bVal ); // also Japanese search option - void SetNotes( BOOL bVal); - - // - // Japanese search options - // - - BOOL IsMatchFullHalfWidthForms() const; - BOOL IsMatchHiraganaKatakana() const; - BOOL IsMatchContractions() const; - BOOL IsMatchMinusDashChoon() const; - BOOL IsMatchRepeatCharMarks() const; - BOOL IsMatchVariantFormKanji() const; - BOOL IsMatchOldKanaForms() const; - BOOL IsMatchDiziDuzu() const; - BOOL IsMatchBavaHafa() const; - BOOL IsMatchTsithichiDhizi() const; - BOOL IsMatchHyuiyuByuvyu() const; - BOOL IsMatchSesheZeje() const; - BOOL IsMatchIaiya() const; - BOOL IsMatchKiku() const; - BOOL IsIgnorePunctuation() const; - BOOL IsIgnoreWhitespace() const; - BOOL IsIgnoreProlongedSoundMark() const; - BOOL IsIgnoreMiddleDot() const; - - void SetMatchFullHalfWidthForms( BOOL bVal ); - void SetMatchHiraganaKatakana( BOOL bVal ); - void SetMatchContractions( BOOL bVal ); - void SetMatchMinusDashChoon( BOOL bVal ); - void SetMatchRepeatCharMarks( BOOL bVal ); - void SetMatchVariantFormKanji( BOOL bVal ); - void SetMatchOldKanaForms( BOOL bVal ); - void SetMatchDiziDuzu( BOOL bVal ); - void SetMatchBavaHafa( BOOL bVal ); - void SetMatchTsithichiDhizi( BOOL bVal ); - void SetMatchHyuiyuByuvyu( BOOL bVal ); - void SetMatchSesheZeje( BOOL bVal ); - void SetMatchIaiya( BOOL bVal ); - void SetMatchKiku( BOOL bVal ); - void SetIgnorePunctuation( BOOL bVal ); - void SetIgnoreWhitespace( BOOL bVal ); - void SetIgnoreProlongedSoundMark( BOOL bVal ); - void SetIgnoreMiddleDot( BOOL bVal ); -}; - - -#endif - diff --git a/svtools/inc/svtools/accelcfg.hxx b/svtools/inc/svtools/accelcfg.hxx deleted file mode 100644 index 24894c46c535..000000000000 --- a/svtools/inc/svtools/accelcfg.hxx +++ /dev/null @@ -1,88 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: accelcfg.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_ACCELCFG_HXX -#define INCLUDED_SVTOOLS_ACCELCFG_HXX - -#include -#include - -#include -#include - -struct SvtAcceleratorConfigItem -{ - sal_uInt16 nCode; - sal_uInt16 nModifier; - ::rtl::OUString aCommand; -}; - -#include -typedef ::std::list < SvtAcceleratorConfigItem > SvtAcceleratorItemList; - -class SvStream; -class KeyEvent; -class String; -class SvtAcceleratorConfig_Impl; - -class SvtAcceleratorConfiguration: public svt::detail::Options -{ - SvtAcceleratorConfig_Impl* pImp; - -private: - -public: - // get the global accelerators - SvtAcceleratorConfiguration(); - - // get special accelerators - static SvtAcceleratorConfiguration* CreateFromStream( SvStream& rStream ); - static String GetStreamName(); - static SvStream* GetDefaultStream( StreamMode ); - - virtual ~SvtAcceleratorConfiguration(); - - // save the configuration to a stream, f.e. into a document - bool Commit( SvStream& rStream ); - - // returns the configured URL for a KeyEvent - ::rtl::OUString GetCommand( const ::com::sun::star::awt::KeyEvent& rKeyEvent ); - - // returns the whole configuration - const SvtAcceleratorItemList& GetItems(); - - // sets a single configuration item - void SetCommand( const SvtAcceleratorConfigItem& rItem ); - - // sets several or all configuration items - // if bClear=FALSE, all items not in the sequence remain unchanged - void SetItems( const SvtAcceleratorItemList& rItems, bool bClear ); -}; - -#endif diff --git a/svtools/inc/svtools/accessibilityoptions.hxx b/svtools/inc/svtools/accessibilityoptions.hxx index 85b914354a3a..00a0efdc1b13 100644 --- a/svtools/inc/svtools/accessibilityoptions.hxx +++ b/svtools/inc/svtools/accessibilityoptions.hxx @@ -35,12 +35,12 @@ #include #include #include -#include +#include class SvtAccessibilityOptions_Impl; class SVT_DLLPUBLIC SvtAccessibilityOptions: - public svt::detail::Options, public SfxBroadcaster, private SfxListener + public utl::detail::Options, public SfxBroadcaster, private SfxListener { private: static SvtAccessibilityOptions_Impl* volatile sm_pSingleImplConfig; diff --git a/svtools/inc/svtools/addxmltostorageoptions.hxx b/svtools/inc/svtools/addxmltostorageoptions.hxx deleted file mode 100644 index 1704de8b1700..000000000000 --- a/svtools/inc/svtools/addxmltostorageoptions.hxx +++ /dev/null @@ -1,162 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: addxmltostorageoptions.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_ADDXMLTOSTORAGEOPTIONS_HXX -#define INCLUDED_SVTOOLS_ADDXMLTOSTORAGEOPTIONS_HXX - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include "svtools/svldllapi.h" -#include -#include -#include -#include - -//_________________________________________________________________________________________________________________ -// forward declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short forward declaration to our private date container implementation - @descr We use these class as internal member to support small memory requirements. - You can create the container if it is neccessary. The class which use these mechanism - is faster and smaller then a complete implementation! -*//*-*************************************************************************************************************/ - -class SvtAddXMLToStorageOptions_Impl; - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short collect informations about security features - @descr - - - @implements - - @base - - - @devstatus ready to use -*//*-*************************************************************************************************************/ - -class SVL_DLLPUBLIC SvtAddXMLToStorageOptions: public svt::detail::Options -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short standard constructor and destructor - @descr This will initialize an instance with default values. - We implement these class with a refcount mechanism! Every instance of this class increase it - at create and decrease it at delete time - but all instances use the same data container! - He is implemented as a static member ... - - @seealso member m_nRefCount - @seealso member m_pDataContainer - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - SvtAddXMLToStorageOptions(); - virtual ~SvtAddXMLToStorageOptions(); - - //--------------------------------------------------------------------------------------------------------- - // interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short interface methods to get value of config key - @descr - - @seealso - - - @param - @return The values which represent current state of internal variable. - - @onerror No error should occurre! - *//*-*****************************************************************************************************/ - - sal_Bool IsWriter_Add_XML_to_Storage() const; - sal_Bool IsCalc_Add_XML_to_Storage() const; - sal_Bool IsImpress_Add_XML_to_Storage() const; - sal_Bool IsDraw_Add_XML_to_Storage() const; - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return a reference to a static mutex - @descr These class use his own static mutex to be threadsafe. - We create a static mutex only for one ime and use at different times. - - @seealso - - - @param - - @return A reference to a static mutex member. - - @onerror - - *//*-*****************************************************************************************************/ - - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - /*Attention - - Don't initialize these static member in these header! - a) Double dfined symbols will be detected ... - b) and unresolved externals exist at linking time. - Do it in your source only. - */ - - static SvtAddXMLToStorageOptions_Impl* m_pDataContainer; /// impl. data container as dynamic pointer for smaller memory requirements! - static sal_Int32 m_nRefCount; /// internal ref count mechanism - -}; // class SvtAddXMLToStorageOptions - -#endif diff --git a/svtools/inc/svtools/cjkoptions.hxx b/svtools/inc/svtools/cjkoptions.hxx index e4298b4d162c..1573a029f29f 100644 --- a/svtools/inc/svtools/cjkoptions.hxx +++ b/svtools/inc/svtools/cjkoptions.hxx @@ -32,13 +32,13 @@ #include "svtools/svtdllapi.h" #include -#include +#include class SvtCJKOptions_Impl; // class SvtCJKOptions -------------------------------------------------- -class SVT_DLLPUBLIC SvtCJKOptions: public svt::detail::Options +class SVT_DLLPUBLIC SvtCJKOptions: public utl::detail::Options { private: SvtCJKOptions_Impl* pImp; diff --git a/svtools/inc/svtools/cmdoptions.hxx b/svtools/inc/svtools/cmdoptions.hxx deleted file mode 100644 index 9feb2508982b..000000000000 --- a/svtools/inc/svtools/cmdoptions.hxx +++ /dev/null @@ -1,258 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: cmdoptions.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_CMDOPTIONS_HXX -#define INCLUDED_SVTOOLS_CMDOPTIONS_HXX - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include "svtools/svldllapi.h" -#include -#include -#include -#include -#include -#include - -//_________________________________________________________________________________________________________________ -// types, enums, ... -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @descr The method GetList() returns a list of property values. - Use follow defines to seperate values by names. -*//*-*************************************************************************************************************/ -#define CMDOPTIONS_PROPERTYNAME_URL ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CommandURL" )) - -//_________________________________________________________________________________________________________________ -// forward declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short forward declaration to our private date container implementation - @descr We use these class as internal member to support small memory requirements. - You can create the container if it is neccessary. The class which use these mechanism - is faster and smaller then a complete implementation! -*//*-*************************************************************************************************************/ - -class SvtCommandOptions_Impl; - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short collect informations about dynamic menus - @descr Make it possible to configure dynamic menu structures of menus like "new" or "wizard". - - @implements - - @base - - - @devstatus ready to use -*//*-*************************************************************************************************************/ - -class SVL_DLLPUBLIC SvtCommandOptions: public svt::detail::Options -{ - friend class SvtCommandOptions_Impl; - - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - enum CmdOption - { - CMDOPTION_DISABLED, - CMDOPTION_NONE - }; - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short standard constructor and destructor - @descr This will initialize an instance with default values. - We implement these class with a refcount mechanism! Every instance of this class increase it - at create and decrease it at delete time - but all instances use the same data container! - He is implemented as a static member ... - - @seealso member m_nRefCount - @seealso member m_pDataContainer - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - SvtCommandOptions(); - virtual ~SvtCommandOptions(); - - //--------------------------------------------------------------------------------------------------------- - // interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short clear complete sepcified list - @descr Call this methods to clear the whole list. - To fill it again use AppendItem(). - - @seealso - - - @param "eMenu" select right menu to clear. - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - void Clear( CmdOption eOption ); - - /*-****************************************************************************************************//** - @short return complete specified list - @descr Call it to get all entries of an dynamic menu. - We return a list of all nodes with his names and properties. - - @seealso - - - @param "eOption" select the list to retrieve. - @return A list of command strings is returned. - - @onerror We return an empty list. - *//*-*****************************************************************************************************/ - - sal_Bool HasEntries( CmdOption eOption ) const; - - /*-****************************************************************************************************//** - @short Lookup if a command URL is inside a given list - @descr Lookup if a command URL is inside a given lst - - @seealso - - - @param "eOption" select right command list - @param "aCommandURL" a command URL that is used for the look up - @return "sal_True" if the command is inside the list otherwise "sal_False" - - @onerror - - *//*-*****************************************************************************************************/ - - sal_Bool Lookup( CmdOption eOption, const ::rtl::OUString& aCommandURL ) const; - - /*-****************************************************************************************************//** - @short return complete specified list - @descr Call it to get all entries of an dynamic menu. - We return a list of all nodes with his names and properties. - - @seealso - - - @param "eOption" select the list to retrieve. - @return A list of command strings is returned. - - @onerror We return an empty list. - *//*-*****************************************************************************************************/ - - ::com::sun::star::uno::Sequence< ::rtl::OUString > GetList( CmdOption eOption ) const; - - /*-****************************************************************************************************//** - @short adds a new command to specified options list - @descr You can add a command to specified options list! - - @seealso method Clear() - - @param "eOption" specifies the command list - @param "sURL" URL for dispatch - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - void AddCommand( CmdOption eOption, const ::rtl::OUString& sURL ); - - /*-****************************************************************************************************//** - @short register an office frame, which must update its dispatches if - the underlying configuration was changed. - - @descr To avoid using of "dead" frame objects or implementing - deregistration mechanism too, we use weak references to - the given frames. - - @param "xFrame" points to the frame, which wish to be - notified, if configuration was changed. - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - void EstablisFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame); - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return a reference to a static mutex - @descr These class is partially threadsafe (for de-/initialization only). - All access methods are'nt safe! - We create a static mutex only for one ime and use at different times. - - @seealso - - - @param - - @return A reference to a static mutex member. - - @onerror - - *//*-*****************************************************************************************************/ - - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - /*Attention - - Don't initialize these static member in these header! - a) Double dfined symbols will be detected ... - b) and unresolved externals exist at linking time. - Do it in your source only. - */ - - static SvtCommandOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! - static sal_Int32 m_nRefCount ; /// internal ref count mechanism - -}; // class SvtCmdOptions - -#endif // #ifndef INCLUDED_SVTOOLS_CMDOPTIONS_HXX diff --git a/svtools/inc/svtools/colorcfg.hxx b/svtools/inc/svtools/colorcfg.hxx index 9a0d570e7cc0..98152e80b7c3 100644 --- a/svtools/inc/svtools/colorcfg.hxx +++ b/svtools/inc/svtools/colorcfg.hxx @@ -36,7 +36,7 @@ #include #include #include -#include +#include //----------------------------------------------------------------------------- namespace svtools{ @@ -108,7 +108,7 @@ struct ColorConfigValue ---------------------------------------------------------------------------*/ class SVT_DLLPUBLIC ColorConfig: - public svt::detail::Options, public SfxBroadcaster, public SfxListener + public utl::detail::Options, public SfxBroadcaster, public SfxListener { friend class ColorConfig_Impl; private: diff --git a/svtools/inc/svtools/compatibility.hxx b/svtools/inc/svtools/compatibility.hxx deleted file mode 100644 index 2337980d3707..000000000000 --- a/svtools/inc/svtools/compatibility.hxx +++ /dev/null @@ -1,256 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: compatibility.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_COMPATIBILITY_HXX -#define INCLUDED_SVTOOLS_COMPATIBILITY_HXX - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include "svtools/svldllapi.h" -#include -#include -#include -#include -#include - -//_________________________________________________________________________________________________________________ -// types, enums, ... -//_________________________________________________________________________________________________________________ - -enum CompatibilityOptions -{ - COPT_USE_PRINTERDEVICE = 0, - COPT_ADD_SPACING, - COPT_ADD_SPACING_AT_PAGES, - COPT_USE_OUR_TABSTOPS, - COPT_NO_EXTLEADING, - COPT_USE_LINESPACING, - COPT_ADD_TABLESPACING, - COPT_USE_OBJECTPOSITIONING, - COPT_USE_OUR_TEXTWRAPPING, - COPT_CONSIDER_WRAPPINGSTYLE, - COPT_EXPAND_WORDSPACE -}; - -/*-************************************************************************************************************//** - @descr The method GetList() returns a list of property values. - Use follow defines to seperate values by names. -*//*-*************************************************************************************************************/ -#define COMPATIBILITY_PROPERTYNAME_NAME OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) -#define COMPATIBILITY_PROPERTYNAME_MODULE OUString( RTL_CONSTASCII_USTRINGPARAM( "Module" ) ) -#define COMPATIBILITY_PROPERTYNAME_USEPRTMETRICS OUString( RTL_CONSTASCII_USTRINGPARAM( "UsePrinterMetrics" ) ) -#define COMPATIBILITY_PROPERTYNAME_ADDSPACING OUString( RTL_CONSTASCII_USTRINGPARAM( "AddSpacing" ) ) -#define COMPATIBILITY_PROPERTYNAME_ADDSPACINGATPAGES OUString( RTL_CONSTASCII_USTRINGPARAM( "AddSpacingAtPages" ) ) -#define COMPATIBILITY_PROPERTYNAME_USEOURTABSTOPS OUString( RTL_CONSTASCII_USTRINGPARAM( "UseOurTabStopFormat" ) ) -#define COMPATIBILITY_PROPERTYNAME_NOEXTLEADING OUString( RTL_CONSTASCII_USTRINGPARAM( "NoExternalLeading" ) ) -#define COMPATIBILITY_PROPERTYNAME_USELINESPACING OUString( RTL_CONSTASCII_USTRINGPARAM( "UseLineSpacing" ) ) -#define COMPATIBILITY_PROPERTYNAME_ADDTABLESPACING OUString( RTL_CONSTASCII_USTRINGPARAM( "AddTableSpacing" ) ) -#define COMPATIBILITY_PROPERTYNAME_USEOBJECTPOSITIONING OUString( RTL_CONSTASCII_USTRINGPARAM( "UseObjectPositioning" ) ) -#define COMPATIBILITY_PROPERTYNAME_USEOURTEXTWRAPPING OUString( RTL_CONSTASCII_USTRINGPARAM( "UseOurTextWrapping" ) ) -#define COMPATIBILITY_PROPERTYNAME_CONSIDERWRAPPINGSTYLE OUString( RTL_CONSTASCII_USTRINGPARAM( "ConsiderWrappingStyle" ) ) -#define COMPATIBILITY_PROPERTYNAME_EXPANDWORDSPACE OUString( RTL_CONSTASCII_USTRINGPARAM( "ExpandWordSpace" ) ) - -#define COMPATIBILITY_DEFAULT_NAME OUString( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ) - -//_________________________________________________________________________________________________________________ -// forward declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short forward declaration to our private date container implementation - @descr We use these class as internal member to support small memory requirements. - You can create the container if it is neccessary. The class which use these mechanism - is faster and smaller then a complete implementation! -*//*-*************************************************************************************************************/ - -class SvtCompatibilityOptions_Impl; - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short collect informations about dynamic menus - @descr Make it possible to configure dynamic menu structures of menus like "new" or "wizard". - - @implements - - @base - - - @devstatus ready to use -*//*-*************************************************************************************************************/ - -class SVL_DLLPUBLIC SvtCompatibilityOptions: public svt::detail::Options -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short standard constructor and destructor - @descr This will initialize an instance with default values. - We implement these class with a refcount mechanism! Every instance of this class increase it - at create and decrease it at delete time - but all instances use the same data container! - He is implemented as a static member ... - - @seealso member m_nRefCount - @seealso member m_pDataContainer - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - SvtCompatibilityOptions(); - virtual ~SvtCompatibilityOptions(); - - //--------------------------------------------------------------------------------------------------------- - // interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short clear complete specified list - @descr Call this methods to clear the whole list. - - @seealso - - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - void Clear(); - - /*-****************************************************************************************************//** - @short return complete specified list - @descr Call it to get all entries of compatibility options. - We return a list of all nodes with its names and properties. - - @seealso - - - @param - - @return A list of compatibility options is returned. - - @onerror We return an empty list. - *//*-*****************************************************************************************************/ - - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > GetList() const; - - /*-****************************************************************************************************//** - @short append a new item - @descr - - @seealso method Clear() - - @param "sName" Name - @param "sModule" Module - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - void AppendItem( const ::rtl::OUString& sName, - const ::rtl::OUString& sModule, - bool bUsePrtMetrics, - bool bAddSpacing, - bool bAddSpacingAtPages, - bool bUseOurTabStops, - bool bNoExtLeading, - bool bUseLineSpacing, - bool bAddTableSpacing, - bool bUseObjectPositioning, - bool bUseOurTextWrapping, - bool bConsiderWrappingStyle, - bool bExpandWordSpace ); - - bool IsUsePrtDevice() const; - bool IsAddSpacing() const; - bool IsAddSpacingAtPages() const; - bool IsUseOurTabStops() const; - bool IsNoExtLeading() const; - bool IsUseLineSpacing() const; - bool IsAddTableSpacing() const; - bool IsUseObjectPositioning() const; - bool IsUseOurTextWrapping() const; - bool IsConsiderWrappingStyle() const; - bool IsExpandWordSpace() const; - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return a reference to a static mutex - @descr These class is partially threadsafe (for de-/initialization only). - All access methods are'nt safe! - We create a static mutex only for one ime and use at different times. - - @seealso - - - @param - - @return A reference to a static mutex member. - - @onerror - - *//*-*****************************************************************************************************/ - - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - /*Attention - - Don't initialize these static member in these header! - a) Double dfined symbols will be detected ... - b) and unresolved externals exist at linking time. - Do it in your source only. - */ - - static SvtCompatibilityOptions_Impl* m_pDataContainer; /// impl. data container as dynamic pointer for smaller memory requirements! - static sal_Int32 m_nRefCount ; /// internal ref count mechanism - -}; // class SvtCompatibilityOptions - -#endif // #ifndef INCLUDED_SVTOOLS_COMPATIBILITY_HXX - diff --git a/svtools/inc/svtools/ctloptions.hxx b/svtools/inc/svtools/ctloptions.hxx index 6c09ad98a45e..4157d129cce1 100644 --- a/svtools/inc/svtools/ctloptions.hxx +++ b/svtools/inc/svtools/ctloptions.hxx @@ -34,14 +34,14 @@ #include #include #include -#include +#include class SvtCTLOptions_Impl; // class SvtCTLOptions -------------------------------------------------------- class SVT_DLLPUBLIC SvtCTLOptions: - public svt::detail::Options, public SfxBroadcaster, public SfxListener + public utl::detail::Options, public SfxBroadcaster, public SfxListener { private: SvtCTLOptions_Impl* m_pImp; diff --git a/svtools/inc/svtools/defaultoptions.hxx b/svtools/inc/svtools/defaultoptions.hxx deleted file mode 100644 index 03408ac1ed35..000000000000 --- a/svtools/inc/svtools/defaultoptions.hxx +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: defaultoptions.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_DEFAULTOPTIONS_HXX -#define INCLUDED_SVTOOLS_DEFAULTOPTIONS_HXX - -#include "svtools/svldllapi.h" -#include "tools/solar.h" -#include - -class String; -class SvtDefaultOptions_Impl; - -// class SvtDefaultOptions ----------------------------------------------- - -class SvtDefaultOptions_Impl; -class SVL_DLLPUBLIC SvtDefaultOptions: public svt::detail::Options -{ -private: - SvtDefaultOptions_Impl* pImp; - -public: - - SvtDefaultOptions(); - virtual ~SvtDefaultOptions(); - - String GetDefaultPath( USHORT nId ) const; -}; - -#endif // #ifndef INCLUDED_SVTOOLS_DEFAULTOPTIONS_HXX - diff --git a/svtools/inc/svtools/dynamicmenuoptions.hxx b/svtools/inc/svtools/dynamicmenuoptions.hxx deleted file mode 100644 index 4a6b7a44d13f..000000000000 --- a/svtools/inc/svtools/dynamicmenuoptions.hxx +++ /dev/null @@ -1,222 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: dynamicmenuoptions.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_DYNAMICMENUOPTIONS_HXX -#define INCLUDED_SVTOOLS_DYNAMICMENUOPTIONS_HXX - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include "svtools/svldllapi.h" -#include -#include -#include -#include -#include - -//_________________________________________________________________________________________________________________ -// types, enums, ... -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @descr The method GetList() returns a list of property values. - Use follow defines to seperate values by names. -*//*-*************************************************************************************************************/ -#define DYNAMICMENU_PROPERTYNAME_URL ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL" )) -#define DYNAMICMENU_PROPERTYNAME_TITLE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Title" )) -#define DYNAMICMENU_PROPERTYNAME_IMAGEIDENTIFIER ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ImageIdentifier" )) -#define DYNAMICMENU_PROPERTYNAME_TARGETNAME ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TargetName" )) - -/*-************************************************************************************************************//** - @descr You can use these enum values to specify right menu if you call our interface methods. -*//*-*************************************************************************************************************/ -enum EDynamicMenuType -{ - E_NEWMENU = 0, - E_WIZARDMENU = 1, - E_HELPBOOKMARKS = 2 -}; -//_________________________________________________________________________________________________________________ -// forward declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short forward declaration to our private date container implementation - @descr We use these class as internal member to support small memory requirements. - You can create the container if it is neccessary. The class which use these mechanism - is faster and smaller then a complete implementation! -*//*-*************************************************************************************************************/ - -class SvtDynamicMenuOptions_Impl; - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short collect informations about dynamic menus - @descr Make it possible to configure dynamic menu structures of menus like "new" or "wizard". - - @implements - - @base - - - @devstatus ready to use -*//*-*************************************************************************************************************/ - -class SVL_DLLPUBLIC SvtDynamicMenuOptions: public svt::detail::Options -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short standard constructor and destructor - @descr This will initialize an instance with default values. - We implement these class with a refcount mechanism! Every instance of this class increase it - at create and decrease it at delete time - but all instances use the same data container! - He is implemented as a static member ... - - @seealso member m_nRefCount - @seealso member m_pDataContainer - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - SvtDynamicMenuOptions(); - virtual ~SvtDynamicMenuOptions(); - - //--------------------------------------------------------------------------------------------------------- - // interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short clear complete sepcified list - @descr Call this methods to clear the whole list. - To fill it again use AppendItem(). - - @seealso - - - @param "eMenu" select right menu to clear. - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - void Clear( EDynamicMenuType eMenu ); - - /*-****************************************************************************************************//** - @short return complete specified list - @descr Call it to get all entries of an dynamic menu. - We return a list of all nodes with his names and properties. - - @seealso - - - @param "eMenu" select right menu. - @return A list of menu items is returned. - - @onerror We return an empty list. - *//*-*****************************************************************************************************/ - - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > GetMenu( EDynamicMenuType eMenu ) const; - - /*-****************************************************************************************************//** - @short append a new item to specified menu - @descr You can append items to a menu only - removing isn't allowed for a special item! - We support a nothing or all mechanism only! Clear all or append something ... - - @seealso method Clear() - - @param "eMenu" select right menu. - @param "sURL" URL for dispatch - @param "sTitle" label of menu entry - @param "sImageIdentifier" icon identifier - @param "sTargetName" target for dispatch - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - void AppendItem( EDynamicMenuType eMenu , - const ::rtl::OUString& sURL , - const ::rtl::OUString& sTitle , - const ::rtl::OUString& sImageIdentifier , - const ::rtl::OUString& sTargetName ); - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return a reference to a static mutex - @descr These class is partially threadsafe (for de-/initialization only). - All access methods are'nt safe! - We create a static mutex only for one ime and use at different times. - - @seealso - - - @param - - @return A reference to a static mutex member. - - @onerror - - *//*-*****************************************************************************************************/ - - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - /*Attention - - Don't initialize these static member in these header! - a) Double dfined symbols will be detected ... - b) and unresolved externals exist at linking time. - Do it in your source only. - */ - - static SvtDynamicMenuOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! - static sal_Int32 m_nRefCount ; /// internal ref count mechanism - -}; // class SvtDynamicMenuOptions - -#endif // #ifndef INCLUDED_SVTOOLS_DYNAMICMENUOPTIONS_HXX diff --git a/svtools/inc/svtools/extendedsecurityoptions.hxx b/svtools/inc/svtools/extendedsecurityoptions.hxx deleted file mode 100644 index 700f707c00fe..000000000000 --- a/svtools/inc/svtools/extendedsecurityoptions.hxx +++ /dev/null @@ -1,163 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: extendedsecurityoptions.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_EXTENDEDSECURITYOPTIONS_HXX -#define INCLUDED_SVTOOLS_EXTENDEDSECURITYOPTIONS_HXX - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include "svtools/svldllapi.h" -#include -#include -#include -#include -#include - -//_________________________________________________________________________________________________________________ -// forward declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short forward declaration to our private date container implementation - @descr We use these class as internal member to support small memory requirements. - You can create the container if it is neccessary. The class which use these mechanism - is faster and smaller then a complete implementation! -*//*-*************************************************************************************************************/ - -class SvtExtendedSecurityOptions_Impl; - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short collect informations about security features - @descr - - - @implements - - @base - - - @ATTENTION This class is partially threadsafe. - - @devstatus ready to use -*//*-*************************************************************************************************************/ - -class SVL_DLLPUBLIC SvtExtendedSecurityOptions: public svt::detail::Options -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - // Must be zero based! - enum OpenHyperlinkMode - { - OPEN_NEVER = 0, - OPEN_WITHSECURITYCHECK, - OPEN_ALWAYS - }; - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short standard constructor and destructor - @descr This will initialize an instance with default values. - We implement these class with a refcount mechanism! Every instance of this class increase it - at create and decrease it at delete time - but all instances use the same data container! - He is implemented as a static member ... - - @seealso member m_nRefCount - @seealso member m_pDataContainer - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - SvtExtendedSecurityOptions(); - virtual ~SvtExtendedSecurityOptions(); - - //--------------------------------------------------------------------------------------------------------- - // interface - //--------------------------------------------------------------------------------------------------------- - - sal_Bool IsSecureHyperlink( const rtl::OUString& aURL ) const; - com::sun::star::uno::Sequence< rtl::OUString > GetSecureExtensionList() const; - - OpenHyperlinkMode GetOpenHyperlinkMode(); - void SetOpenHyperlinkMode( OpenHyperlinkMode aMode ); - sal_Bool IsOpenHyperlinkModeReadOnly() const; - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return a reference to a static mutex - @descr These class is partially threadsafe (for de-/initialization only). - All access methods are'nt safe! - We create a static mutex only for one ime and use at different times. - - @seealso - - - @param - - @return A reference to a static mutex member. - - @onerror - - *//*-*****************************************************************************************************/ - - SVL_DLLPRIVATE static ::osl::Mutex& GetInitMutex(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - /*Attention - - Don't initialize these static member in these header! - a) Double dfined symbols will be detected ... - b) and unresolved externals exist at linking time. - Do it in your source only. - */ - - static SvtExtendedSecurityOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! - static sal_Int32 m_nRefCount ; /// internal ref count mechanism - -}; // class SvtExtendedSecurityOptions - -#endif // #ifndef INCLUDED_SVTOOLS_EXTENDEDSECURITYOPTIONS_HXX diff --git a/svtools/inc/svtools/fontoptions.hxx b/svtools/inc/svtools/fontoptions.hxx deleted file mode 100644 index 4689cb6ad91b..000000000000 --- a/svtools/inc/svtools/fontoptions.hxx +++ /dev/null @@ -1,176 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: fontoptions.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_FONTOPTIONS_HXX -#define INCLUDED_SVTOOLS_FONTOPTIONS_HXX - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include "svtools/svldllapi.h" -#include -#include -#include -#include - -//_________________________________________________________________________________________________________________ -// forward declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short forward declaration to our private date container implementation - @descr We use these class as internal member to support small memory requirements. - You can create the container if it is neccessary. The class which use these mechanism - is faster and smaller then a complete implementation! -*//*-*************************************************************************************************************/ - -class SvtFontOptions_Impl; - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short collect informations about font features - @descr - - - @implements - - @base - - - @devstatus ready to use -*//*-*************************************************************************************************************/ - -class SVL_DLLPUBLIC SvtFontOptions: public svt::detail::Options -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short standard constructor and destructor - @descr This will initialize an instance with default values. - We implement these class with a refcount mechanism! Every instance of this class increase it - at create and decrease it at delete time - but all instances use the same data container! - He is implemented as a static member ... - - @seealso member m_nRefCount - @seealso member m_pDataContainer - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - SvtFontOptions(); - virtual ~SvtFontOptions(); - - //--------------------------------------------------------------------------------------------------------- - // interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short interface methods to get and set value of config key "org.openoffice.Office.Common/Font" - @descr These values defines different states of font handling. - - ..ReplacementTable..() => Determines if the list of font replacements is applied or not. - - ..FontHistory..() => The last 5 fonts will be shown and the last one will be the - first name on the list. These will be displayed in the Font name - combo box on the Object bar. - - ..FontWYSIWYG..() => With this option the names of the selectable fonts - (for example, the fonts in the Font field in the object bar) - will be formatted as the current font. - - @seealso - - - @param - - @return - - - @onerror No error should occurre! - *//*-*****************************************************************************************************/ - - sal_Bool IsReplacementTableEnabled ( ) const ; - void EnableReplacementTable ( sal_Bool bState ) ; - - sal_Bool IsFontHistoryEnabled ( ) const ; - void EnableFontHistory ( sal_Bool bState ) ; - - sal_Bool IsFontWYSIWYGEnabled ( ) const ; - void EnableFontWYSIWYG ( sal_Bool bState ) ; - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return a reference to a static mutex - @descr These class use his own static mutex to be threadsafe. - We create a static mutex only for one ime and use at different times. - - @seealso - - - @param - - @return A reference to a static mutex member. - - @onerror - - *//*-*****************************************************************************************************/ - - SVL_DLLPRIVATE static ::osl::Mutex& impl_GetOwnStaticMutex(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - /*Attention - - Don't initialize these static member in these header! - a) Double dfined symbols will be detected ... - b) and unresolved externals exist at linking time. - Do it in your source only. - */ - - static SvtFontOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! - static sal_Int32 m_nRefCount ; /// internal ref count mechanism - -}; // class SvtFontOptions - -#endif // #ifndef INCLUDED_SVTOOLS_FONTOPTIONS_HXX diff --git a/svtools/inc/svtools/helpopt.hxx b/svtools/inc/svtools/helpopt.hxx index 7c8c322ec916..7a9a06b8bc5f 100644 --- a/svtools/inc/svtools/helpopt.hxx +++ b/svtools/inc/svtools/helpopt.hxx @@ -37,13 +37,13 @@ #define INCLUDED_LIST #endif #include -#include +#include typedef std::list< sal_Int32 > IdList; class SvtHelpOptions_Impl; -class SVT_DLLPUBLIC SvtHelpOptions: public svt::detail::Options +class SVT_DLLPUBLIC SvtHelpOptions: public utl::detail::Options { SvtHelpOptions_Impl* pImp; diff --git a/svtools/inc/svtools/historyoptions.hxx b/svtools/inc/svtools/historyoptions.hxx deleted file mode 100644 index d688da08ae76..000000000000 --- a/svtools/inc/svtools/historyoptions.hxx +++ /dev/null @@ -1,251 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: historyoptions.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_HISTORYOPTIONS_HXX -#define INCLUDED_SVTOOLS_HISTORYOPTIONS_HXX - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include "svtools/svldllapi.h" -#include -#include -#include -#include -#include -#include - -//_________________________________________________________________________________________________________________ -// types, enums, ... -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @descr The method GetList() returns a list of property values. - Use follow defines to seperate values by names. -*//*-*************************************************************************************************************/ - -#define HISTORY_PROPERTYNAME_URL ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL" )) -#define HISTORY_PROPERTYNAME_FILTER ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Filter" )) -#define HISTORY_PROPERTYNAME_TITLE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Title" )) -#define HISTORY_PROPERTYNAME_PASSWORD ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Password" )) - -/*-************************************************************************************************************//** - @descr You can use these enum values to specify right history if you call ouer interface methods. -*//*-*************************************************************************************************************/ - -enum EHistoryType -{ - ePICKLIST = 0, - eHISTORY = 1, - eHELPBOOKMARKS = 2 -}; - -//_________________________________________________________________________________________________________________ -// forward declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short forward declaration to our private date container implementation - @descr We use these class as internal member to support small memory requirements. - You can create the container if it is neccessary. The class which use these mechanism - is faster and smaller then a complete implementation! -*//*-*************************************************************************************************************/ - -class SvtHistoryOptions_Impl; - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short collect informations about history features - @descr - - - @implements - - @base - - - @devstatus ready to use -*//*-*************************************************************************************************************/ - -class SVL_DLLPUBLIC SvtHistoryOptions: public svt::detail::Options -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short standard constructor and destructor - @descr This will initialize an instance with default values. - We implement these class with a refcount mechanism! Every instance of this class increase it - at create and decrease it at delete time - but all instances use the same data container! - He is implemented as a static member ... - - @seealso member m_nRefCount - @seealso member m_pDataContainer - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - SvtHistoryOptions(); - virtual ~SvtHistoryOptions(); - - //--------------------------------------------------------------------------------------------------------- - // interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short interface methods to get and set value of config key "org.openoffice.Office.Common/History/..." - @descr key "PickList" : The last used documents displayed in the file menu. - key "History" : The last opened documents general. - *//*-*****************************************************************************************************/ - - /*-****************************************************************************************************//** - @short set/get max size of specified history - @descr Call this methods to get information about max. size of specified list. - These value lay down the max count of items in these history. If a new one - is add to it the oldest one is deleted automaticly! - - @seealso - - - @param "eHistory" select right history. - @param "nSize" is the new max size of specified list. If new size smaller then the old one - some oldest entries will be destroyed automaticly! - @return Current max size of specified list. - - @onerror - - *//*-*****************************************************************************************************/ - - sal_uInt32 GetSize( EHistoryType eHistory ) const ; - void SetSize( EHistoryType eHistory, sal_uInt32 nSize ) ; - - /*-****************************************************************************************************//** - @short clear complete sepcified list - @descr Call this methods to clear the whole list. After that GetItemCount() will return 0 ... - but GetSize() will return the old value! - - @seealso - - - @param "eHistory" select right history. - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - void Clear( EHistoryType eHistory ); - - /*-****************************************************************************************************//** - @short return complete sepcified list - @descr If you will show the whole list call this method to get it completly. - - @seealso - - - @param "eHistory" select right history. - @return A list of history items is returned. - - @onerror - - *//*-*****************************************************************************************************/ - - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > GetList( EHistoryType eHistory ) const ; - - /*-****************************************************************************************************//** - @short append a new item to specified list - @descr You can append items to a list only - removing isn't allowed for a special item! - The oldest entry is deleted automaticly if max size arrived or you can call Clear() ... - It exist two different overload methods to do this. - One for user which have an complete history item and another one for uncompletly data sets! - - @seealso method SetSize() - @seealso method Clear() - - @param "eHistory" select right history. - @param "sURL" URL to save in history - @param "sFilter" filter name to save in history - @param "sTitle" document title to save in history - @param "sPassword" password to save in history - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - void AppendItem( EHistoryType eHistory , - const ::rtl::OUString& sURL , - const ::rtl::OUString& sFilter , - const ::rtl::OUString& sTitle , - const ::rtl::OUString& sPassword ); - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return a reference to a static mutex - @descr Make these class threadsafe. - - @seealso - - - @param - - @return A reference to a static mutex member. - - @onerror - - *//*-*****************************************************************************************************/ - - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - /*Attention - - Don't initialize these static member in these header! - a) Double dfined symbols will be detected ... - b) and unresolved externals exist at linking time. - Do it in your source only. - */ - - static SvtHistoryOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! - static sal_Int32 m_nRefCount ; /// internal ref count mechanism - -}; // class SvtHistoryOptions - -#endif // #ifndef INCLUDED_SVTOOLS_HISTORYOPTIONS_HXX diff --git a/svtools/inc/svtools/inetoptions.hxx b/svtools/inc/svtools/inetoptions.hxx deleted file mode 100644 index 367ea9bb3f52..000000000000 --- a/svtools/inc/svtools/inetoptions.hxx +++ /dev/null @@ -1,146 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: inetoptions.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVTOOLS_INETOPTIONS_HXX_ -#define _SVTOOLS_INETOPTIONS_HXX_ - -#include "svtools/svldllapi.h" -#include -#include -#include -#include - -namespace com { namespace sun { namespace star { namespace beans { - class XPropertiesChangeListener; -} } } } -namespace rtl { class OUString; } - -//============================================================================ -/** The names of all the properties (options) accessible through - SvtInetOptions. - - @descr These names are used in the methods - SvtInetOptions::addPropertiesChangeListener() and - SvtInetOptions::removePropertiesChangeListener(). - */ -#define SVT_INET_OPTION_PROXY_NO_PROXY "Inet/Proxy/NoProxy" -#define SVT_INET_OPTION_PROXY_TYPE "Inet/Proxy/Type" -#define SVT_INET_OPTION_PROXY_FTP_NAME "Inet/Proxy/FTP/Name" -#define SVT_INET_OPTION_PROXY_FTP_PORT "Inet/Proxy/FTP/Port" -#define SVT_INET_OPTION_PROXY_HTTP_NAME "Inet/Proxy/HTTP/Name" -#define SVT_INET_OPTION_PROXY_HTTP_PORT "Inet/Proxy/HTTP/Port" - -//============================================================================ -/** Interface to access those configuration database entries that are related - to the various Internet services. - - @descr The Set...() methods all have a second parameter bFlush. If false - is passed (the default), the new value is not written back directly, but - only cached within this class. If the value in the configuration database - is also changed, the cached change will get lost. If, on the other hand, - true is passed, the new value is instantly written back to the - configuration database. - */ -class SVL_DLLPUBLIC SvtInetOptions: public svt::detail::Options -{ -public: - SvtInetOptions(); - - virtual ~SvtInetOptions(); - - enum ProxyType { NONE, AUTOMATIC, MANUAL }; - - rtl::OUString GetProxyNoProxy() const; - - sal_Int32 GetProxyType() const; - - rtl::OUString GetProxyFtpName() const; - - sal_Int32 GetProxyFtpPort() const; - - rtl::OUString GetProxyHttpName() const; - - sal_Int32 GetProxyHttpPort() const; - - void SetProxyNoProxy(rtl::OUString const & rValue, bool bFlush = false); - - void SetProxyType(ProxyType eValue, bool bFlush = false); - - void SetProxyFtpName(rtl::OUString const & rValue, bool bFlush = false); - - void SetProxyFtpPort(sal_Int32 nValue, bool bFlush = false); - - void SetProxyHttpName(rtl::OUString const & rValue, bool bFlush = false); - - void SetProxyHttpPort(sal_Int32 nValue, bool bFlush = false); - - void flush(); - - /** Add a listener on changes of certain properties (options). - - @param rPropertyNames The names of the properties (options). If an - empty sequence is used, nothing is done. - - @param rListener A listener. If the listener is already registered - on other properties, it continues to also get notifications about - changes of those properties. The - com::sun::star::beans::PropertyChangeEvents supplied to the listener - will have void OldValue and NewValue slots. - */ - void - addPropertiesChangeListener( - com::sun::star::uno::Sequence< rtl::OUString > const & rPropertyNames, - com::sun::star::uno::Reference< - com::sun::star::beans::XPropertiesChangeListener > const & - rListener); - - /** Remove a listener on changes of certain properties (options). - - @param rPropertyNames The names of the properties (options). If an - empty sequence is used, nothing is done. - - @param rListener A listener. If the listener is still registered on - other properties, it continues to get notifications about changes of - those properties. - */ - void - removePropertiesChangeListener( - com::sun::star::uno::Sequence< rtl::OUString > const & rPropertyNames, - com::sun::star::uno::Reference< - com::sun::star::beans::XPropertiesChangeListener > const & - rListener); - -private: - class Impl; - - static Impl * m_pImpl; -}; - -#endif // _SVTOOLS_INETOPTIONS_HXX_ diff --git a/svtools/inc/svtools/internaloptions.hxx b/svtools/inc/svtools/internaloptions.hxx deleted file mode 100644 index 6a491480c143..000000000000 --- a/svtools/inc/svtools/internaloptions.hxx +++ /dev/null @@ -1,183 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: internaloptions.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_INTERNALOPTIONS_HXX -#define INCLUDED_SVTOOLS_INTERNALOPTIONS_HXX - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include "svtools/svldllapi.h" -#include -#include -#include -#include - -//_________________________________________________________________________________________________________________ -// namespaces! -//_________________________________________________________________________________________________________________ - -#define MUTEX ::osl::Mutex -#define OUSTRING ::rtl::OUString - -//_________________________________________________________________________________________________________________ -// forward declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short forward declaration to our private date container implementation - @descr We use these class as internal member to support small memory requirements. - You can create the container if it is neccessary. The class which use these mechanism - is faster and smaller then a complete implementation! -*//*-*************************************************************************************************************/ - -class SvtInternalOptions_Impl; - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short collect informations about internal features - @descr - - - @implements - - @base - - - @ATTENTION This class is partially threadsafe. - - @devstatus ready to use -*//*-*************************************************************************************************************/ - -class SVL_DLLPUBLIC SvtInternalOptions: public svt::detail::Options -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short standard constructor and destructor - @descr This will initialize an instance with default values. - We implement these class with a refcount mechanism! Every instance of this class increase it - at create and decrease it at delete time - but all instances use the same data container! - He is implemented as a static member ... - - @seealso member m_nRefCount - @seealso member m_pDataContainer - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - SvtInternalOptions(); - virtual ~SvtInternalOptions(); - - //--------------------------------------------------------------------------------------------------------- - // interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short interface methods to get and set value of config key "org.openoffice.Office.Common/Internal/..." - @descr These options describe internal states to enable/disable features of installed office. - The values are fixed at runtime - and implemented as readonly! - - SlotCFGEnabled() => If this option is set (true), StarOffice is searching for the slot.cfg. - If the slot.cfg cannot be found, the start is aborted. - If this option is not set (false), the slot.cfg must not be available, - otherwise the start is also aborted. - - CrashMailEnabled() => Crash-Mail-Feature to document program crashes. After a crash, - an e-mail with information about the system used is generated - automatically when starting StarOffice. - - @seealso configuration package "org.openoffice.Office.Common/Internal" - *//*-*****************************************************************************************************/ - - sal_Bool SlotCFGEnabled () const; - sal_Bool CrashMailEnabled () const; - sal_Bool MailUIEnabled () const; - sal_Bool IsRemoveMenuEntryClose() const; - sal_Bool IsRemoveMenuEntryBackToWebtop() const; - sal_Bool IsRemoveMenuEntryNewWebtop() const; - sal_Bool IsRemoveMenuEntryLogout() const; - - OUSTRING GetCurrentTempURL() const; - void SetCurrentTempURL( const OUSTRING& aNewCurrentTempURL ); - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return a reference to a static mutex - @descr These class is partially threadsafe (for de-/initialization only). - All access methods are'nt safe! - We create a static mutex only for one ime and use at different times. - - @seealso - - - @param - - @return A reference to a static mutex member. - - @onerror - - *//*-*****************************************************************************************************/ - - SVL_DLLPRIVATE static MUTEX& GetOwnStaticMutex(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - /*Attention - - Don't initialize these static member in these header! - a) Double dfined symbols will be detected ... - b) and unresolved externals exist at linking time. - Do it in your source only. - */ - - static SvtInternalOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! - static sal_Int32 m_nRefCount ; /// internal ref count mechanism - -}; // class SvtInternalOptions - -#endif // #ifndef INCLUDED_SVTOOLS_INTERNALOPTIONS_HXX diff --git a/svtools/inc/svtools/lingucfg.hxx b/svtools/inc/svtools/lingucfg.hxx deleted file mode 100644 index dd3dbdef811f..000000000000 --- a/svtools/inc/svtools/lingucfg.hxx +++ /dev/null @@ -1,244 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: lingucfg.hxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVTOOLS_LINGUCFG_HXX_ -#define _SVTOOLS_LINGUCFG_HXX_ - -#include "svtools/svldllapi.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -class SvtLinguConfigItem; - -////////////////////////////////////////////////////////////////////// - -struct SVL_DLLPUBLIC SvtLinguOptions -{ - ::com::sun::star::uno::Sequence< rtl::OUString > aActiveDics; - ::com::sun::star::uno::Sequence< rtl::OUString > aActiveConvDics; - - BOOL bROActiveDics; - BOOL bROActiveConvDics; - - // Hyphenator service specific options - INT16 nHyphMinLeading, - nHyphMinTrailing, - nHyphMinWordLength; - - BOOL bROHyphMinLeading, - bROHyphMinTrailing, - bROHyphMinWordLength; - - // misc options (non-service specific) - INT16 nDefaultLanguage; - INT16 nDefaultLanguage_CJK; - INT16 nDefaultLanguage_CTL; - - BOOL bRODefaultLanguage; - BOOL bRODefaultLanguage_CJK; - BOOL bRODefaultLanguage_CTL; - - // spelling options (non-service specific) - BOOL bIsSpellSpecial; - BOOL bIsSpellAuto; - BOOL bIsSpellReverse; - - BOOL bROIsSpellSpecial; - BOOL bROIsSpellAuto; - BOOL bROIsSpellReverse; - - // hyphenation options (non-service specific) - BOOL bIsHyphSpecial; - BOOL bIsHyphAuto; - - BOOL bROIsHyphSpecial; - BOOL bROIsHyphAuto; - - // common to SpellChecker, Hyphenator and Thesaurus service - BOOL bIsUseDictionaryList; - BOOL bIsIgnoreControlCharacters; - - BOOL bROIsUseDictionaryList; - BOOL bROIsIgnoreControlCharacters; - - // SpellChecker service specific options - BOOL bIsSpellWithDigits, - bIsSpellUpperCase, - bIsSpellCapitalization; - - BOOL bROIsSpellWithDigits, - bROIsSpellUpperCase, - bROIsSpellCapitalization; - - // text conversion specific options - BOOL bIsIgnorePostPositionalWord; - BOOL bIsAutoCloseDialog; - BOOL bIsShowEntriesRecentlyUsedFirst; - BOOL bIsAutoReplaceUniqueEntries; - BOOL bIsDirectionToSimplified; - BOOL bIsUseCharacterVariants; - BOOL bIsTranslateCommonTerms; - BOOL bIsReverseMapping; - - BOOL bROIsIgnorePostPositionalWord; - BOOL bROIsAutoCloseDialog; - BOOL bROIsShowEntriesRecentlyUsedFirst; - BOOL bROIsAutoReplaceUniqueEntries; - BOOL bROIsDirectionToSimplified; - BOOL bROIsUseCharacterVariants; - BOOL bROIsTranslateCommonTerms; - BOOL bROIsReverseMapping; - - // check value need to determine if the configuration needs to updatet - // or not (used for a quick check if data files have been changed/added - // or deleted - INT32 nDataFilesChangedCheckValue; - BOOL bRODataFilesChangedCheckValue; - - BOOL bIsGrammarAuto; - BOOL bIsGrammarInteractive; - - BOOL bROIsGrammarAuto; - BOOL bROIsGrammarInteractive; - - SvtLinguOptions(); -}; - -////////////////////////////////////////////////////////////////////// - -struct SVL_DLLPUBLIC SvtLinguConfigDictionaryEntry -{ - // the URL's pointing to the location of the files the dictionary consists of - com::sun::star::uno::Sequence< rtl::OUString > aLocations; - // the name of the dictionary format implement - rtl::OUString aFormatName; - // the list of languages (ISO names) the dictionary can be used for - com::sun::star::uno::Sequence< rtl::OUString > aLocaleNames; -}; - -////////////////////////////////////////////////////////////////////// - -class SVL_DLLPUBLIC SvtLinguConfig: public svt::detail::Options -{ - // returns static object - SVL_DLLPRIVATE SvtLinguConfigItem & GetConfigItem(); - - SvtLinguConfigItem & GetConfigItem() const { return const_cast< SvtLinguConfig * >( this )->GetConfigItem(); } - - // configuration update access for the 'Linguistic' main node - mutable com::sun::star::uno::Reference< com::sun::star::util::XChangesBatch > m_xMainUpdateAccess; - - com::sun::star::uno::Reference< com::sun::star::util::XChangesBatch > GetMainUpdateAccess() const; - - com::sun::star::uno::Sequence< rtl::OUString > GetCurrentOrLastActiveDicts_Impl( const rtl::OUString &rPropName ) const; - void SetCurrentOrLastActiveDicts_Impl( const rtl::OUString &rPropName, const com::sun::star::uno::Sequence< rtl::OUString > &rDictionaries ) const; - - rtl::OUString GetVendorImageUrl_Impl( const rtl::OUString &rServiceImplName, const rtl::OUString &rImageName ) const; - - // disallow copy-constructor and assignment-operator for now - SvtLinguConfig( const SvtLinguConfig & ); - SvtLinguConfig & operator = ( const SvtLinguConfig & ); - -public: - SvtLinguConfig(); - virtual ~SvtLinguConfig(); - - // - // borrowed from utl::ConfigItem - // - com::sun::star::uno::Sequence< rtl::OUString > - GetNodeNames( const rtl::OUString &rNode ); - // - com::sun::star::uno::Sequence< com::sun::star::uno::Any > - GetProperties( - const com::sun::star::uno::Sequence< rtl::OUString > &rNames ); - // - sal_Bool - ReplaceSetProperties( - const rtl::OUString &rNode, - com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > rValues ); - - com::sun::star::uno::Any - GetProperty( const rtl::OUString &rPropertyName ) const; - com::sun::star::uno::Any - GetProperty( INT32 nPropertyHandle ) const; - - BOOL SetProperty( const rtl::OUString &rPropertyName, - const com::sun::star::uno::Any &rValue ); - BOOL SetProperty( INT32 nPropertyHandle, - const com::sun::star::uno::Any &rValue ); - - BOOL GetOptions( SvtLinguOptions &rOptions ) const; - BOOL SetOptions( const SvtLinguOptions &rOptions ); - - BOOL IsReadOnly( const rtl::OUString &rPropertyName ) const; - BOOL IsReadOnly( INT32 nPropertyHandle ) const; - - //! - //! the following functions work on the 'ServiceManager' sub node of the - //! linguistic configuration only - //! - BOOL GetElementNamesFor( const rtl::OUString &rNodeName, com::sun::star::uno::Sequence< rtl::OUString > &rElementNames ) const; - // - BOOL GetSupportedDictionaryFormatsFor( const rtl::OUString &rSetName, const rtl::OUString &rSetEntry, com::sun::star::uno::Sequence< rtl::OUString > &rFormatList ) const; - void SetOrCreateSupportedDictionaryFormatsFor( const rtl::OUString &rSetName, const rtl::OUString &rSetEntry, const com::sun::star::uno::Sequence< rtl::OUString > &rFormatList ) const; - // - BOOL GetDictionaryEntry( const rtl::OUString &rNodeName, SvtLinguConfigDictionaryEntry &rDicEntry ) const; - void SetOrCreateDictionaryEntry( const rtl::OUString &rNodeName, const SvtLinguConfigDictionaryEntry &rDicEntry ) const; - // - com::sun::star::uno::Sequence< rtl::OUString > GetDisabledDictionaries() const; - void SetDisabledDictionaries( const com::sun::star::uno::Sequence< rtl::OUString > &rDictionaries ) const; - // - std::vector< SvtLinguConfigDictionaryEntry > GetActiveDictionariesByFormat( const rtl::OUString &rFormatName ); - - // functions returning file URLs to the respective images (if found) and empty string otherwise - ::rtl::OUString GetSpellAndGrammarDialogImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; - ::rtl::OUString GetSpellAndGrammarContextSuggestionImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; - ::rtl::OUString GetSpellAndGrammarContextDictionaryImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; - - bool HasAnyVendorImages() const; - bool HasGrammarChecker() const; -}; - -////////////////////////////////////////////////////////////////////// - -#endif - diff --git a/svtools/inc/svtools/localisationoptions.hxx b/svtools/inc/svtools/localisationoptions.hxx deleted file mode 100644 index c19bf0e9fbba..000000000000 --- a/svtools/inc/svtools/localisationoptions.hxx +++ /dev/null @@ -1,181 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: localisationoptions.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_LOCALISATIONOPTIONS_HXX -#define INCLUDED_SVTOOLS_LOCALISATIONOPTIONS_HXX - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include -#include "svtools/svldllapi.h" -#include -#include - -//_________________________________________________________________________________________________________________ -// forward declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short forward declaration to our private date container implementation - @descr We use these class as internal member to support small memory requirements. - You can create the container if it is neccessary. The class which use these mechanism - is faster and smaller then a complete implementation! -*//*-*************************************************************************************************************/ - -class SvtLocalisationOptions_Impl; - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short collect informations about localisation features - @descr - - - @implements - - @base - - - @devstatus ready to use -*//*-*************************************************************************************************************/ - -class SVL_DLLPUBLIC SvtLocalisationOptions: public svt::detail::Options -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short standard constructor and destructor - @descr This will initialize an instance with default values. - We implement these class with a refcount mechanism! Every instance of this class increase it - at create and decrease it at delete time - but all instances use the same data container! - He is implemented as a static member ... - - @seealso member m_nRefCount - @seealso member m_pDataContainer - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - SvtLocalisationOptions(); - virtual ~SvtLocalisationOptions(); - - //--------------------------------------------------------------------------------------------------------- - // interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short interface methods to get and set value of config key "org.openoffice.Office.Common/View/Localisation/AutoMnemonic" - @descr These value specifies if shortcuts should be assigned automatically. - - @seealso - - - @param "bState", new value to set it in configuration. - @return The value which represent current state of internal variable. - - @onerror No error should occurre! - *//*-*****************************************************************************************************/ - - sal_Bool IsAutoMnemonic ( ) const ; - void SetAutoMnemonic ( sal_Bool bState ) ; - - /*-****************************************************************************************************//** - @short interface methods to get and set value of config key "org.openoffice.Office.Common/View/Localisation/DialogScale" - @descr These value specifies the factor for increasing controls. - Value from [0..100] are allowed. - - @ATTENTION These methods don't check for valid or invalid values! - Our configuration server can do it ... but these implementation don't get any notifications - about wrong commits ...! - => If you set an invalid value - nothing will be changed. The information will lost. - - @seealso baseclass ConfigItem - - @param "nScale" new value to set it in configuration. - @return The value which represent current state of internal variable. - - @onerror No error should occurre! - *//*-*****************************************************************************************************/ - - sal_Int32 GetDialogScale( ) const ; - void SetDialogScale( sal_Int32 nScale ) ; - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return a reference to a static mutex - @descr These class is partially threadsafe (for de-/initialization only). - All access methods are'nt safe! - We create a static mutex only for one ime and use at different times. - - @seealso - - - @param - - @return A reference to a static mutex member. - - @onerror - - *//*-*****************************************************************************************************/ - - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - /*Attention - - Don't initialize these static member in these header! - a) Double dfined symbols will be detected ... - b) and unresolved externals exist at linking time. - Do it in your source only. - */ - - static SvtLocalisationOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! - static sal_Int32 m_nRefCount ; /// internal ref count mechanism - -}; // class SvtLocalisationOptions - -#endif // #ifndef INCLUDED_SVTOOLS_LOCALISATIONOPTIONS_HXX diff --git a/svtools/inc/svtools/menuoptions.hxx b/svtools/inc/svtools/menuoptions.hxx index 1d93d9068e1c..19eddb75bf35 100644 --- a/svtools/inc/svtools/menuoptions.hxx +++ b/svtools/inc/svtools/menuoptions.hxx @@ -37,7 +37,7 @@ #include "svtools/svldllapi.h" #include #include -#include +#include //_________________________________________________________________________________________________________________ // forward declarations @@ -67,7 +67,7 @@ class SvtMenuOptions_Impl; @devstatus ready to use *//*-*************************************************************************************************************/ -class SVL_DLLPUBLIC SvtMenuOptions: public svt::detail::Options +class SVL_DLLPUBLIC SvtMenuOptions: public utl::detail::Options { //------------------------------------------------------------------------------------------------------------- // public methods diff --git a/svtools/inc/svtools/miscopt.hxx b/svtools/inc/svtools/miscopt.hxx index 1b81bb8a5fc9..bc98d9e50d44 100644 --- a/svtools/inc/svtools/miscopt.hxx +++ b/svtools/inc/svtools/miscopt.hxx @@ -39,7 +39,7 @@ #include #include #include -#include +#include //_________________________________________________________________________________________________________________ // forward declarations @@ -71,7 +71,7 @@ class Link; @devstatus ready to use *//*-*************************************************************************************************************/ -class SVT_DLLPUBLIC SvtMiscOptions: public svt::detail::Options +class SVT_DLLPUBLIC SvtMiscOptions: public utl::detail::Options { //------------------------------------------------------------------------------------------------------------- // public methods diff --git a/svtools/inc/svtools/moduleoptions.hxx b/svtools/inc/svtools/moduleoptions.hxx deleted file mode 100644 index fc28ce1f399e..000000000000 --- a/svtools/inc/svtools/moduleoptions.hxx +++ /dev/null @@ -1,260 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: moduleoptions.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_SVTOOLS_MODULEOPTIONS_HXX -#define INCLUDED_SVTOOLS_MODULEOPTIONS_HXX - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include "svtools/svldllapi.h" -#include -#include -#include -#include -#include -#include -#include - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -#define FEATUREFLAG_BASICIDE 0x00000020 -#define FEATUREFLAG_MATH 0x00000100 -#define FEATUREFLAG_CHART 0x00000200 -#define FEATUREFLAG_CALC 0x00000800 -#define FEATUREFLAG_DRAW 0x00001000 -#define FEATUREFLAG_WRITER 0x00002000 -#define FEATUREFLAG_IMPRESS 0x00008000 -#define FEATUREFLAG_INSIGHT 0x00010000 - -//_________________________________________________________________________________________________________________ -// forward declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short forward declaration to our private date container implementation - @descr We use these class as internal member to support small memory requirements. - You can create the container if it is neccessary. The class which use these mechanism - is faster and smaller then a complete implementation! -*//*-*************************************************************************************************************/ -class SvtModuleOptions_Impl; - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short collect informations about installation state of modules - @descr Use these class to get installation state of different office modules like writer, calc etc - Further you can ask for additional informations; e.g. name of standard template file, which - should be used by corresponding module; or short/long name of these module factory. - - @implements - - @base - - - @devstatus ready to use - @threadsafe yes -*//*-*************************************************************************************************************/ -class SVL_DLLPUBLIC SvtModuleOptions: public svt::detail::Options -{ - //------------------------------------------------------------------------------------------------------------- - // public const declarations! - //------------------------------------------------------------------------------------------------------------- - public: - - enum EModule - { - E_SWRITER = 0, - E_SCALC = 1, - E_SDRAW = 2, - E_SIMPRESS = 3, - E_SMATH = 4, - E_SCHART = 5, - E_SSTARTMODULE = 6, - E_SBASIC = 7, - E_SDATABASE = 8, - E_SWEB = 9, - E_SGLOBAL = 10 - }; - - /*ATTENTION: - If you change these enum ... don't forget to change reading/writing and order of configuration values too! - See "SvtModuleOptions_Impl::impl_GetSetNames()" and his ctor for further informations. - */ - enum EFactory - { - E_UNKNOWN_FACTORY = -1, - E_WRITER = 0, - E_WRITERWEB = 1, - E_WRITERGLOBAL = 2, - E_CALC = 3, - E_DRAW = 4, - E_IMPRESS = 5, - E_MATH = 6, - E_CHART = 7, - E_STARTMODULE = 8, - E_DATABASE = 9, - E_BASIC = 10 - - }; - - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - SvtModuleOptions(); - virtual ~SvtModuleOptions(); - - //--------------------------------------------------------------------------------------------------------- - // interface - //--------------------------------------------------------------------------------------------------------- - sal_Bool IsModuleInstalled ( EModule eModule ) const; - ::rtl::OUString GetModuleName ( EModule eModule ) const; - ::rtl::OUString GetModuleName ( EFactory eFactory ) const; - ::rtl::OUString GetFactoryName ( EFactory eFactory ) const; - ::rtl::OUString GetFactoryShortName ( EFactory eFactory ) const; - ::rtl::OUString GetFactoryStandardTemplate( EFactory eFactory ) const; - ::rtl::OUString GetFactoryWindowAttributes( EFactory eFactory ) const; - ::rtl::OUString GetFactoryEmptyDocumentURL( EFactory eFactory ) const; - ::rtl::OUString GetFactoryDefaultFilter ( EFactory eFactory ) const; - sal_Bool IsDefaultFilterReadonly ( EFactory eFactory ) const; - sal_Int32 GetFactoryIcon ( EFactory eFactory ) const; - static sal_Bool ClassifyFactoryByName ( const ::rtl::OUString& sName , - EFactory& eFactory ); - void SetFactoryStandardTemplate( EFactory eFactory , - const ::rtl::OUString& sTemplate ); - void SetFactoryWindowAttributes( EFactory eFactory , - const ::rtl::OUString& sAttributes); - void SetFactoryDefaultFilter ( EFactory eFactory , - const ::rtl::OUString& sFilter ); - - //_______________________________________ - - /** @short return the corresponding application ID for the given - document service name. - */ - static EFactory ClassifyFactoryByServiceName(const ::rtl::OUString& sName); - - //_______________________________________ - - /** @short return the corresponding application ID for the given - short name. - */ - static EFactory ClassifyFactoryByShortName(const ::rtl::OUString& sName); - - //_______________________________________ - - /** @short return the corresponding application ID for the given properties. - - @descr Because this search base on filters currently (till we have a better solution) - a result is not guaranteed everytimes. May a filter does not exists for the specified - content (but a FrameLoader which is not bound to any application!) ... or - the given properties describe a stream (and we make no deep detection inside here!). - - @attention The module BASIC cant be detected here. Because it does not - has an own URL schema. - - @param sURL - the complete URL! - - @param lMediaDescriptor - additional informations - - @return A suitable enum value. See EFactory above. - */ - static EFactory ClassifyFactoryByURL(const ::rtl::OUString& sURL , - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lMediaDescriptor); - - //_______________________________________ - - /** @short return the corresponding application ID for the given properties. - - @descr Here we try to use the list of supported service names of the given model - to find out the right application module. - - @attention The module BASIC cant be detected here. Because it does not - support any model/ctrl/view paradigm. - - @param xModel - the document model - - @return A suitable enum value. See EFactory above. - */ - static EFactory ClassifyFactoryByModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel); - - ::rtl::OUString GetDefaultModuleName(); - - //--------------------------------------------------------------------------------------------------------- - // old interface ... - //--------------------------------------------------------------------------------------------------------- - sal_Bool IsMath () const; - sal_Bool IsChart () const; - sal_Bool IsCalc () const; - sal_Bool IsDraw () const; - sal_Bool IsWriter () const; - sal_Bool IsImpress () const; - sal_Bool IsBasicIDE () const; - sal_Bool IsDataBase () const; - sal_uInt32 GetFeatures() const; - - ::com::sun::star::uno::Sequence < ::rtl::OUString > GetAllServiceNames(); - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - private: - SVL_DLLPRIVATE static ::osl::Mutex& impl_GetOwnStaticMutex(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - private: - - /*Attention - - Don't initialize these static member in these header! - a) Double defined symbols will be detected ... - b) and unresolved externals exist at linking time. - Do it in your source only. - */ - - static SvtModuleOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! - static sal_Int32 m_nRefCount ; /// internal ref count mechanism - -}; // class SvtModuleOptions - -#endif // #ifndef INCLUDED_SVTOOLS_MODULEOPTIONS_HXX diff --git a/svtools/inc/svtools/options.hxx b/svtools/inc/svtools/options.hxx deleted file mode 100644 index 33ba515af67d..000000000000 --- a/svtools/inc/svtools/options.hxx +++ /dev/null @@ -1,55 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: options.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_SVTOOLS_OPTIONS_HXX -#define INCLUDED_SVTOOLS_OPTIONS_HXX - -#include "sal/config.h" -#include "svtools/svldllapi.h" - -namespace svt { namespace detail { - -// A base class for the various option classes supported by -// svtools/source/config/itemholderbase.hxx (which must be public, as it is -// shared between svl and svt): -class SVL_DLLPUBLIC Options { -public: - Options(); - - virtual ~Options() = 0; - -private: - SVL_DLLPRIVATE Options(Options &); // not defined - SVL_DLLPRIVATE void operator =(Options &); // not defined -}; - -} } - -#endif diff --git a/svtools/inc/svtools/optionsdlg.hxx b/svtools/inc/svtools/optionsdlg.hxx deleted file mode 100644 index 0ebfd1ab357d..000000000000 --- a/svtools/inc/svtools/optionsdlg.hxx +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: optionsdlg.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_OPTIONSDLG_HXX -#define INCLUDED_SVTOOLS_OPTIONSDLG_HXX - -#ifndef INCLUDED_SVTDLLAPI_H -#include "svtools/svldllapi.h" -#endif -#include -#include - -class SvtOptionsDlgOptions_Impl; - -class SVL_DLLPUBLIC SvtOptionsDialogOptions: public svt::detail::Options -{ -private: - SvtOptionsDlgOptions_Impl* m_pImp; - -public: - SvtOptionsDialogOptions(); - virtual ~SvtOptionsDialogOptions(); - - sal_Bool IsGroupHidden ( const String& _rGroup ) const; - sal_Bool IsPageHidden ( const String& _rPage, - const String& _rGroup ) const; - sal_Bool IsOptionHidden ( const String& _rOption, - const String& _rPage, - const String& _rGroup ) const; -}; - -#endif - diff --git a/svtools/inc/svtools/pathoptions.hxx b/svtools/inc/svtools/pathoptions.hxx deleted file mode 100644 index 20185e79c886..000000000000 --- a/svtools/inc/svtools/pathoptions.hxx +++ /dev/null @@ -1,143 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: pathoptions.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_PATHOPTIONS_HXX -#define INCLUDED_SVTOOLS_PATHOPTIONS_HXX - -#include "svtools/svldllapi.h" -#include -#include -#include - -#define SVT_SEARCHPATH_DELIMITER ';' - -// class SvtPathOptions -------------------------------------------------- - -class SvtPathOptions_Impl; -class SVL_DLLPUBLIC SvtPathOptions: public svt::detail::Options -{ -private: - SvtPathOptions_Impl* pImp; - -public: - enum Pathes - { - PATH_ADDIN, - PATH_AUTOCORRECT, - PATH_AUTOTEXT, - PATH_BACKUP, - PATH_BASIC, - PATH_BITMAP, - PATH_CONFIG, - PATH_DICTIONARY, - PATH_FAVORITES, - PATH_FILTER, - PATH_GALLERY, - PATH_GRAPHIC, - PATH_HELP, - PATH_LINGUISTIC, - PATH_MODULE, - PATH_PALETTE, - PATH_PLUGIN, - PATH_STORAGE, - PATH_TEMP, - PATH_TEMPLATE, - PATH_USERCONFIG, - PATH_WORK, - PATH_UICONFIG, - PATH_FINGERPRINT, - PATH_COUNT // should always be the last element - }; - - SvtPathOptions(); - virtual ~SvtPathOptions(); - - // get the pathes, not const because of using a mutex - const String& GetAddinPath() const; - const String& GetAutoCorrectPath() const; - const String& GetAutoTextPath() const; - const String& GetBackupPath() const; - const String& GetBasicPath() const; - const String& GetBitmapPath() const; - const String& GetConfigPath() const; - const String& GetDictionaryPath() const; - const String& GetFavoritesPath() const; - const String& GetFilterPath() const; - const String& GetGalleryPath() const; - const String& GetGraphicPath() const; - const String& GetHelpPath() const; - const String& GetLinguisticPath() const; - const String& GetModulePath() const; - const String& GetPalettePath() const; - const String& GetPluginPath() const; - const String& GetStoragePath() const; - const String& GetTempPath() const; - const String& GetTemplatePath() const; - const String& GetUserConfigPath() const; - const String& GetWorkPath() const; - const String& GetUIConfigPath() const; - const String& GetFingerprintPath() const; - - BOOL IsPathReadonly(Pathes ePath)const; - const String& GetPath(Pathes ePath) const; - - // set the pathes - void SetAddinPath( const String& rPath ); - void SetAutoCorrectPath( const String& rPath ); - void SetAutoTextPath( const String& rPath ); - void SetBackupPath( const String& rPath ); - void SetBasicPath( const String& rPath ); - void SetBitmapPath( const String& rPath ); - void SetConfigPath( const String& rPath ); - void SetDictionaryPath( const String& rPath ); - void SetFavoritesPath( const String& rPath ); - void SetFilterPath( const String& rPath ); - void SetGalleryPath( const String& rPath ); - void SetGraphicPath( const String& rPath ); - void SetHelpPath( const String& rPath ); - void SetLinguisticPath( const String& rPath ); - void SetModulePath( const String& rPath ); - void SetPalettePath( const String& rPath ); - void SetPluginPath( const String& rPath ); - void SetStoragePath( const String& rPath ); - void SetTempPath( const String& rPath ); - void SetTemplatePath( const String& rPath ); - void SetUserConfigPath( const String& rPath ); - void SetWorkPath( const String& rPath ); - void SetPath( SvtPathOptions::Pathes ePath, const String& rNewPath ); - - String SubstituteVariable( const String& rVar ); - String UseVariable( const String& rVar ); - sal_Bool SearchFile( String& rIniFile, Pathes ePath = PATH_USERCONFIG ); - ::com::sun::star::lang::Locale GetLocale() const; - sal_Bool IsReadonly() const; -}; - -#endif // #ifndef INCLUDED_SVTOOLS_PATHOPTIONS_HXX - diff --git a/svtools/inc/svtools/printoptions.hxx b/svtools/inc/svtools/printoptions.hxx index b00c27f94130..15147b21b62e 100644 --- a/svtools/inc/svtools/printoptions.hxx +++ b/svtools/inc/svtools/printoptions.hxx @@ -35,7 +35,7 @@ #include #include #include -#include +#include class SvtPrintOptions_Impl; @@ -45,7 +45,7 @@ class SvtPrintOptions_Impl; class PrinterOptions; -class SVT_DLLPUBLIC SvtBasePrintOptions: public svt::detail::Options +class SVT_DLLPUBLIC SvtBasePrintOptions: public utl::detail::Options { protected: diff --git a/svtools/inc/svtools/printwarningoptions.hxx b/svtools/inc/svtools/printwarningoptions.hxx deleted file mode 100644 index 863d407f221e..000000000000 --- a/svtools/inc/svtools/printwarningoptions.hxx +++ /dev/null @@ -1,164 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: printwarningoptions.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_SVTOOLS_PRINTWARNINGOPTIONS_HXX -#define INCLUDED_SVTOOLS_PRINTWARNINGOPTIONS_HXX - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include "svtools/svldllapi.h" -#include -#include -#include -#include - -//_________________________________________________________________________________________________________________ -// forward declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short forward declaration to our private date container implementation - @descr We use these class as internal member to support small memory requirements. - You can create the container if it is neccessary. The class which use these mechanism - is faster and smaller then a complete implementation! -*//*-*************************************************************************************************************/ - -class SvtPrintWarningOptions_Impl; - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short collect informations about startup features - @descr - - - @implements - - @base - - - @devstatus ready to use -*//*-*************************************************************************************************************/ - -class SVL_DLLPUBLIC SvtPrintWarningOptions: public svt::detail::Options -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short standard constructor and destructor - @descr This will initialize an instance with default values. - We implement these class with a refcount mechanism! Every instance of this class increase it - at create and decrease it at delete time - but all instances use the same data container! - He is implemented as a static member ... - - @seealso member m_nRefCount - @seealso member m_pDataContainer - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - SvtPrintWarningOptions(); - virtual ~SvtPrintWarningOptions(); - - //--------------------------------------------------------------------------------------------------------- - // interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short interface methods to get and set value of config key "org.openoffice.Office.Common/Print/Warning..." - @descr These options describe internal states to enable/disable features of installed office. - - @seealso configuration package "org.openoffice.Office.Common/_3D-Engine" - *//*-*****************************************************************************************************/ - - sal_Bool IsPaperSize() const; - sal_Bool IsPaperOrientation() const; - sal_Bool IsNotFound() const; - sal_Bool IsTransparency() const; - sal_Bool IsModifyDocumentOnPrintingAllowed() const; - - void SetPaperSize( sal_Bool bState ); - void SetPaperOrientation( sal_Bool bState ); - void SetNotFound( sal_Bool bState ); - void SetTransparency( sal_Bool bState ); - void SetModifyDocumentOnPrintingAllowed( sal_Bool bState ); - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return a reference to a static mutex - @descr These class use his own static mutex to be threadsafe. - We create a static mutex only for one ime and use at different times. - - @seealso - - - @param - - @return A reference to a static mutex member. - - @onerror - - *//*-*****************************************************************************************************/ - - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - private: - - /*Attention - - Don't initialize these static member in these header! - a) Double dfined symbols will be detected ... - b) and unresolved externals exist at linking time. - Do it in your source only. - */ - - static SvtPrintWarningOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! - static sal_Int32 m_nRefCount ; /// internal ref count mechanism - -}; // class SvtPrintWarningOptions - -#endif // #ifndef INCLUDED_SVTOOLS_PRINTWARNINGOPTIONS_HXX diff --git a/svtools/inc/svtools/saveopt.hxx b/svtools/inc/svtools/saveopt.hxx deleted file mode 100644 index 2966e2f24aba..000000000000 --- a/svtools/inc/svtools/saveopt.hxx +++ /dev/null @@ -1,133 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: saveopt.hxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_SAVEOPT_HXX -#define INCLUDED_SVTOOLS_SAVEOPT_HXX - -#include "svtools/svldllapi.h" -#include - -struct SvtLoadSaveOptions_Impl; -class SVL_DLLPUBLIC SvtSaveOptions: public svt::detail::Options -{ - SvtLoadSaveOptions_Impl* pImp; - -public: - - enum EOption - { - E_AUTOSAVETIME, - E_USEUSERDATA, - E_BACKUP, - E_AUTOSAVE, - E_AUTOSAVEPROMPT, - E_DOCINFSAVE, - E_SAVEWORKINGSET, - E_SAVEDOCWINS, - E_SAVEDOCVIEW, - E_SAVERELINET, - E_SAVERELFSYS, - E_SAVEUNPACKED, - E_DOPRETTYPRINTING, - E_WARNALIENFORMAT, - E_LOADDOCPRINTER, - E_ODFDEFAULTVERSION - }; - - // keep enum values sorted that a less or greater compare maps to older and newer versions! - enum ODFDefaultVersion - { - ODFVER_UNKNOWN = 0, // unknown - ODFVER_010 = 1, // ODF 1.0 - ODFVER_011 = 2, // ODF 1.1 - DO_NOT_USE = 3, // Do not use this, only here for compatibility with pre OOo 3.2 configuration - ODFVER_012 = 4, // ODF 1.2 - - ODFVER_LATEST = SAL_MAX_ENUM, // ODF latest version with enhancements - }; - - SvtSaveOptions(); - virtual ~SvtSaveOptions(); - - void SetAutoSaveTime( sal_Int32 n ); - sal_Int32 GetAutoSaveTime() const; - - void SetUseUserData( sal_Bool b ); - sal_Bool IsUseUserData() const; - - void SetBackup( sal_Bool b ); - sal_Bool IsBackup() const; - - void SetAutoSave( sal_Bool b ); - sal_Bool IsAutoSave() const; - - void SetAutoSavePrompt( sal_Bool b ); - sal_Bool IsAutoSavePrompt() const; - - void SetDocInfoSave(sal_Bool b); - sal_Bool IsDocInfoSave() const; - - void SetSaveWorkingSet( sal_Bool b ); - sal_Bool IsSaveWorkingSet() const; - - void SetSaveDocWins( sal_Bool b ); - sal_Bool IsSaveDocWins() const; - - void SetSaveDocView( sal_Bool b ); - sal_Bool IsSaveDocView() const; - - void SetSaveRelINet( sal_Bool b ); - sal_Bool IsSaveRelINet() const; - - void SetSaveRelFSys( sal_Bool b ); - sal_Bool IsSaveRelFSys() const; - - void SetSaveUnpacked( sal_Bool b ); - sal_Bool IsSaveUnpacked() const; - - void SetLoadUserSettings(sal_Bool b); - sal_Bool IsLoadUserSettings() const; - - void SetPrettyPrinting( sal_Bool _bEnable ); - sal_Bool IsPrettyPrinting( ) const; - - void SetWarnAlienFormat( sal_Bool _bEnable ); - sal_Bool IsWarnAlienFormat( ) const; - - void SetLoadDocumentPrinter( sal_Bool _bEnable ); - sal_Bool IsLoadDocumentPrinter( ) const; - - void SetODFDefaultVersion( ODFDefaultVersion eVersion ); - ODFDefaultVersion GetODFDefaultVersion() const; - - sal_Bool IsReadOnly( EOption eOption ) const; -}; - -#endif - diff --git a/svtools/inc/svtools/securityoptions.hxx b/svtools/inc/svtools/securityoptions.hxx deleted file mode 100644 index 36ba2af9668a..000000000000 --- a/svtools/inc/svtools/securityoptions.hxx +++ /dev/null @@ -1,299 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: securityoptions.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_SECURITYOPTIONS_HXX -#define INCLUDED_SVTOOLS_SECURITYOPTIONS_HXX - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include "svtools/svldllapi.h" -#include -#include -#include -#include -#include - -//_________________________________________________________________________________________________________________ -// forward declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short forward declaration to our private date container implementation - @descr We use these class as internal member to support small memory requirements. - You can create the container if it is neccessary. The class which use these mechanism - is faster and smaller then a complete implementation! -*//*-*************************************************************************************************************/ - -class SvtSecurityOptions_Impl; - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @descr These values present modes to handle StarOffice basic scripts. - see GetBasicMode/SetBasicMode() for further informations -*//*-*************************************************************************************************************/ - -enum EBasicSecurityMode -{ - eNEVER_EXECUTE = 0, - eFROM_LIST = 1, - eALWAYS_EXECUTE = 2 -}; - -/*-************************************************************************************************************//** - @short collect informations about security features - @descr - - - @implements - - @base - - - @ATTENTION This class is partially threadsafe. - - @devstatus ready to use -*//*-*************************************************************************************************************/ - -class SVL_DLLPUBLIC SvtSecurityOptions: public svt::detail::Options -{ - //------------------------------------------------------------------------------------------------------------- - // public types - //------------------------------------------------------------------------------------------------------------- - public: - - enum EOption - { - E_SECUREURLS, - E_BASICMODE, // xmlsec05 depricated - E_EXECUTEPLUGINS, // xmlsec05 depricated - E_WARNING, // xmlsec05 depricated - E_CONFIRMATION, // xmlsec05 depricated - E_DOCWARN_SAVEORSEND, - E_DOCWARN_SIGNING, - E_DOCWARN_PRINT, - E_DOCWARN_CREATEPDF, - E_DOCWARN_REMOVEPERSONALINFO, - E_DOCWARN_RECOMMENDPASSWORD, - E_MACRO_SECLEVEL, - E_MACRO_TRUSTEDAUTHORS, - E_MACRO_DISABLE, - E_CTRLCLICK_HYPERLINK - }; - - enum MacroAction - { - MA_DONTRUN = 0, - MA_CONFIRM, - MA_RUN - }; - - typedef ::com::sun::star::uno::Sequence< ::rtl::OUString > Certificate; - - /* - // MT: Doesn't work for sequence... - struct Certificate - { - ::rtl::OUString SubjectName; - ::rtl::OUString SerialNumber; - ::rtl::OUString RawData; - }; - */ - - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short standard constructor and destructor - @descr This will initialize an instance with default values. - We implement these class with a refcount mechanism! Every instance of this class increase it - at create and decrease it at delete time - but all instances use the same data container! - He is implemented as a static member ... - - @seealso member m_nRefCount - @seealso member m_pDataContainer - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - SvtSecurityOptions(); - virtual ~SvtSecurityOptions(); - - //--------------------------------------------------------------------------------------------------------- - // interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short returns readonly state - @descr It can be called to get information about the readonly state of a provided item. - @seealso - - - @param "eOption", specify, which item is queried - @return if item is readonly; otherwhise - - @onerror No error should occurre! - *//*-*****************************************************************************************************/ - - sal_Bool IsReadOnly( EOption eOption ) const ; - - /*-****************************************************************************************************//** - @short interface methods to get and set value of config key "org.openoffice.Office.Common/Security/Scripting/SecureURL" - @descr These value displays the list of all trustworthy URLs. - zB.: file:/ => All scripts from the local file system including a LAN; - private:explorer => Scripts from the Explorer; - private:help => Scripts in the help system; - private:newmenu => Scripts that are executed by the commands File-New and AutoPilot; - private:schedule => Scripts of the scheduler; - private:searchfolder => Scripts of the searchfolder; - private:user => Scripts that are entered in the URL field. - @seealso - - - @param "seqURLList", new values to set it in configuration. - @return The values which represent current state of internal variable. - - @onerror No error should occurre! - *//*-*****************************************************************************************************/ - - ::com::sun::star::uno::Sequence< ::rtl::OUString > GetSecureURLs( ) const ; - void SetSecureURLs( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& seqURLList ) ; - - /*-****************************************************************************************************//** - @short interface methods to get and set value of config key "org.openoffice.Office.Common/Security/Scripting/StarOfficeBasic" - @descr These value determines how StarOffice Basic scripts should be handled. - It exist 3 different modes: - 0 = never execute - 1 = from list - 2 = always execute - - @ATTENTION These methods don't check for valid or invalid values! - Our configuration server can do it ... but these implementation don't get any notifications - about wrong commits ...! - => If you set an invalid value - nothing will be changed. The information will lost. - - @seealso enum EBasicSecurityMode - - @param "eMode" to set new mode ... Value must defined as an enum of type EBasicSecurityMode! - @return An enum value, which present current mode. - - @onerror No error should occurre! - *//*-*****************************************************************************************************/ - - sal_Int32 GetMacroSecurityLevel ( ) const ; - void SetMacroSecurityLevel ( sal_Int32 _nLevel ) ; - - sal_Bool IsMacroDisabled ( ) const ; - - /*-****************************************************************************************************//** - @short special method to check an URL and his referer corresponding to ouer internal security cessation - @descr Give us an URL and his referer and we will say you if these url can be scripted or not! - - @seealso - - - @param "sURL" reference to URL for checking - @param "sReferer" reference to referer which whish to run script by given URL - @return sal_True if URL is secure or security is obsolete(!) or sal_False otherwise. - - @onerror No error should occurre! - *//*-*****************************************************************************************************/ - - sal_Bool IsSecureURL( const ::rtl::OUString& sURL , - const ::rtl::OUString& sReferer ) const ; - - ::com::sun::star::uno::Sequence< Certificate > GetTrustedAuthors ( ) const ; - void SetTrustedAuthors ( const ::com::sun::star::uno::Sequence< Certificate >& rAuthors ) ; - sal_Bool IsTrustedAuthorsEnabled ( ) ; - - // for bool options only! - bool IsOptionSet ( EOption eOption ) const ; - bool SetOption ( EOption eOption, bool bValue ) ; - bool IsOptionEnabled ( EOption eOption ) const ; - - // xmlsec05 depricated methods - sal_Bool IsExecutePlugins() const; - void SetExecutePlugins( sal_Bool bSet ); - EBasicSecurityMode GetBasicMode( ) const ; - void SetBasicMode( EBasicSecurityMode eMode ) ; - sal_Bool IsWarningEnabled() const; - void SetWarningEnabled( sal_Bool bSet ); - sal_Bool IsConfirmationEnabled() const; - void SetConfirmationEnabled( sal_Bool bSet ); - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return a reference to a static mutex - @descr These class is partially threadsafe (for de-/initialization only). - All access methods are'nt safe! - We create a static mutex only for one ime and use at different times. - - @seealso - - - @param - - @return A reference to a static mutex member. - - @onerror - - *//*-*****************************************************************************************************/ - - SVL_DLLPRIVATE static ::osl::Mutex& GetInitMutex(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - /*Attention - - Don't initialize these static member in these header! - a) Double dfined symbols will be detected ... - b) and unresolved externals exist at linking time. - Do it in your source only. - */ - - static SvtSecurityOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! - static sal_Int32 m_nRefCount ; /// internal ref count mechanism - -}; // class SvtSecurityOptions - -#endif // #ifndef INCLUDED_SVTOOLS_SECURITYOPTIONS_HXX diff --git a/svtools/inc/svtools/sourceviewconfig.hxx b/svtools/inc/svtools/sourceviewconfig.hxx deleted file mode 100644 index 0e3f6a34e3c1..000000000000 --- a/svtools/inc/svtools/sourceviewconfig.hxx +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: sourceviewconfig.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVTOOLS_SOURCEVIEWCONFIG_HXX -#define _SVTOOLS_SOURCEVIEWCONFIG_HXX - -// include --------------------------------------------------------------- - -#include "svtools/svldllapi.h" -#include -#include -#include -#include -#include - -/* -----------------------------12.10.00 11:40-------------------------------- - - ---------------------------------------------------------------------------*/ -namespace svt -{ - class SourceViewConfig_Impl; - class SVL_DLLPUBLIC SourceViewConfig: - public svt::detail::Options, public SfxBroadcaster, private SfxListener - { - static SourceViewConfig_Impl* m_pImplConfig; - static sal_Int32 m_nRefCount; - - public: - SourceViewConfig(); - virtual ~SourceViewConfig(); - - const rtl::OUString& GetFontName() const; - void SetFontName(const rtl::OUString& rName); - - sal_Int16 GetFontHeight() const; - void SetFontHeight(sal_Int16 nHeight); - - sal_Bool IsShowProportionalFontsOnly() const; - void SetShowProportionalFontsOnly(sal_Bool bSet); - - //SfxListener: - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - }; -} -#endif - diff --git a/svtools/inc/svtools/startoptions.hxx b/svtools/inc/svtools/startoptions.hxx deleted file mode 100644 index 82a3c761965e..000000000000 --- a/svtools/inc/svtools/startoptions.hxx +++ /dev/null @@ -1,173 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: startoptions.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_STARTOPTIONS_HXX -#define INCLUDED_SVTOOLS_STARTOPTIONS_HXX - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include "svtools/svldllapi.h" -#include -#include -#include -#include - -//_________________________________________________________________________________________________________________ -// forward declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short forward declaration to our private date container implementation - @descr We use these class as internal member to support small memory requirements. - You can create the container if it is neccessary. The class which use these mechanism - is faster and smaller then a complete implementation! -*//*-*************************************************************************************************************/ - -class SvtStartOptions_Impl; - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short collect informations about startup features - @descr - - - @implements - - @base - - - @devstatus ready to use -*//*-*************************************************************************************************************/ - -class SVL_DLLPUBLIC SvtStartOptions: public svt::detail::Options -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short standard constructor and destructor - @descr This will initialize an instance with default values. - We implement these class with a refcount mechanism! Every instance of this class increase it - at create and decrease it at delete time - but all instances use the same data container! - He is implemented as a static member ... - - @seealso member m_nRefCount - @seealso member m_pDataContainer - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - SvtStartOptions(); - virtual ~SvtStartOptions(); - - //--------------------------------------------------------------------------------------------------------- - // interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short interface methods to get and set value of config key "org.openoffice.Office.Common/Start/..." - @descr These options describe internal states to enable/disable features of installed office. - The values are fixed at runtime - and implemented as readonly! - - IsIntroEnabled() : Setting, if the StarOffice Logo is displayed when starting StarOffice. - Default = true - - EnableIntro() : Use it to enable/disable the logo at startup. - - @seealso configuration package "org.openoffice.Office.Common/Start" - *//*-*****************************************************************************************************/ - - sal_Bool IsIntroEnabled ( ) const ; - void EnableIntro ( sal_Bool bState ) ; - - /*-****************************************************************************************************//** - @short returns or set the connection URL of an office - @descr Specifies the URL for an UNO connection. - No default is given, the URL has to be entered manually by the admin/user. - zB.: "socket,host=pc1.test.de,port=6001;iiop;" - - @seealso configuration package "org.openoffice.Office.Common/Start" - *//*-*****************************************************************************************************/ - - ::rtl::OUString GetConnectionURL( ) const ; - void SetConnectionURL( const ::rtl::OUString& sURL ) ; - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return a reference to a static mutex - @descr These class use his own static mutex to be threadsafe. - We create a static mutex only for one ime and use at different times. - - @seealso - - - @param - - @return A reference to a static mutex member. - - @onerror - - *//*-*****************************************************************************************************/ - - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - /*Attention - - Don't initialize these static member in these header! - a) Double dfined symbols will be detected ... - b) and unresolved externals exist at linking time. - Do it in your source only. - */ - - static SvtStartOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! - static sal_Int32 m_nRefCount ; /// internal ref count mechanism - -}; // class SvtStartOptions - -#endif // #ifndef INCLUDED_SVTOOLS_STARTOPTIONS_HXX diff --git a/svtools/inc/svtools/svarray.hxx b/svtools/inc/svtools/svarray.hxx index e2348ce428b1..3ab3676fa5e0 100644 --- a/svtools/inc/svtools/svarray.hxx +++ b/svtools/inc/svtools/svarray.hxx @@ -128,7 +128,7 @@ inline void* operator new( size_t, DummyType* pPtr ) } inline void operator delete( void*, DummyType* ) {} -#if !defined(DBG_UTIL) +#if defined(PRODUCT) #define _SVVARARR_DEF_GET_OP_INLINE( nm, ArrElem ) \ ArrElem& operator[](USHORT nP) const { return *(pData+nP); }\ @@ -335,7 +335,7 @@ SV_IMPL_VARARR_GEN( nm, AE, AE & ) #define SV_IMPL_VARARR_PLAIN( nm, AE ) \ SV_IMPL_VARARR_GEN( nm, AE, AE ) -#if !defined(DBG_UTIL) +#if defined(PRODUCT) #define _SVOBJARR_DEF_GET_OP_INLINE( nm,ArrElem )\ ArrElem& operator[](USHORT nP) const { return *(pData+nP); }\ diff --git a/svtools/inc/svtools/syslocaleoptions.hxx b/svtools/inc/svtools/syslocaleoptions.hxx index 19e130fea45b..8b03785d541e 100644 --- a/svtools/inc/svtools/syslocaleoptions.hxx +++ b/svtools/inc/svtools/syslocaleoptions.hxx @@ -38,7 +38,7 @@ #include #include #include -#include +#include // bits for broadcasting hints of changes in a SfxSimpleHint, may be combined const ULONG SYSLOCALEOPTIONS_HINT_LOCALE = 0x00000001; @@ -48,7 +48,7 @@ class SvtSysLocaleOptions_Impl; class SvtListener; namespace osl { class Mutex; } -class SVT_DLLPUBLIC SvtSysLocaleOptions: public svt::detail::Options +class SVT_DLLPUBLIC SvtSysLocaleOptions: public utl::detail::Options { static SvtSysLocaleOptions_Impl* pOptions; static sal_Int32 nRefCount; diff --git a/svtools/inc/svtools/undoopt.hxx b/svtools/inc/svtools/undoopt.hxx deleted file mode 100644 index 7fa63c104eec..000000000000 --- a/svtools/inc/svtools/undoopt.hxx +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: undoopt.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_UNDOOPT_HXX -#define INCLUDED_SVTOOLS_UNDOOPT_HXX - -#include "svtools/svtdllapi.h" -#include -#include -#include -#include - -class SvtUndoOptions_Impl; - -class SVT_DLLPUBLIC SvtUndoOptions: - public svt::detail::Options, public SfxBroadcaster, public SfxListener -{ - SvtUndoOptions_Impl* pImp; - -public: - SvtUndoOptions(); - virtual ~SvtUndoOptions(); - - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - - void SetUndoCount( sal_Int32 n ); - sal_Int32 GetUndoCount() const; -}; - -#endif - diff --git a/svtools/inc/svtools/useroptions.hxx b/svtools/inc/svtools/useroptions.hxx deleted file mode 100644 index f5a07a2e4e79..000000000000 --- a/svtools/inc/svtools/useroptions.hxx +++ /dev/null @@ -1,126 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: useroptions.hxx,v $ - * $Revision: 1.2.312.2 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_USEROPTIONS_HXX -#define INCLUDED_SVTOOLS_USEROPTIONS_HXX - -#include "svtools/svtdllapi.h" -#include -#include -#include -#include -#include -#include - -// define ---------------------------------------------------------------- - -#define USER_OPT_CITY ((USHORT)0) -#define USER_OPT_COMPANY ((USHORT)1) -#define USER_OPT_COUNTRY ((USHORT)2) -#define USER_OPT_EMAIL ((USHORT)3) -#define USER_OPT_FAX ((USHORT)4) -#define USER_OPT_FIRSTNAME ((USHORT)5) -#define USER_OPT_LASTNAME ((USHORT)6) -#define USER_OPT_POSITION ((USHORT)7) -#define USER_OPT_STATE ((USHORT)8) -#define USER_OPT_STREET ((USHORT)9) -#define USER_OPT_TELEPHONEHOME ((USHORT)10) -#define USER_OPT_TELEPHONEWORK ((USHORT)11) -#define USER_OPT_TITLE ((USHORT)12) -#define USER_OPT_ID ((USHORT)13) -#define USER_OPT_ZIP ((USHORT)14) -#define USER_OPT_FATHERSNAME ((USHORT)15) -#define USER_OPT_APARTMENT ((USHORT)16) - -// class SvtUserOptions -------------------------------------------------- - -class SvtUserOptions_Impl; - -class SVT_DLLPUBLIC SvtUserOptions: - public svt::detail::Options, public SfxBroadcaster, public SfxListener -{ -private: - SvtUserOptions_Impl* pImp; - -public: - SvtUserOptions(); - virtual ~SvtUserOptions(); - - static ::osl::Mutex& GetInitMutex(); - - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - - // get the address token - ::rtl::OUString GetCompany() const; - ::rtl::OUString GetFirstName() const; - ::rtl::OUString GetLastName() const; - ::rtl::OUString GetID() const; - ::rtl::OUString GetStreet() const; - ::rtl::OUString GetCity() const; - ::rtl::OUString GetState() const; - ::rtl::OUString GetZip() const; - ::rtl::OUString GetCountry() const; - ::rtl::OUString GetPosition() const; - ::rtl::OUString GetTitle() const; - ::rtl::OUString GetTelephoneHome() const; - ::rtl::OUString GetTelephoneWork() const; - ::rtl::OUString GetFax() const; - ::rtl::OUString GetEmail() const; - ::rtl::OUString GetCustomerNumber() const; - ::rtl::OUString GetFathersName() const; - ::rtl::OUString GetApartment() const; - - ::rtl::OUString GetFullName() const; - ::rtl::OUString GetLocale() const; - - // set the address token - void SetCompany( const ::rtl::OUString& rNewToken ); - void SetFirstName( const ::rtl::OUString& rNewToken ); - void SetLastName( const ::rtl::OUString& rNewToken ); - void SetID( const ::rtl::OUString& rNewToken ); - void SetStreet( const ::rtl::OUString& rNewToken ); - void SetCity( const ::rtl::OUString& rNewToken ); - void SetState( const ::rtl::OUString& rNewToken ); - void SetZip( const ::rtl::OUString& rNewToken ); - void SetCountry( const ::rtl::OUString& rNewToken ); - void SetPosition( const ::rtl::OUString& rNewToken ); - void SetTitle( const ::rtl::OUString& rNewToken ); - void SetTelephoneHome( const ::rtl::OUString& rNewToken ); - void SetTelephoneWork( const ::rtl::OUString& rNewToken ); - void SetFax( const ::rtl::OUString& rNewToken ); - void SetEmail( const ::rtl::OUString& rNewToken ); - void SetCustomerNumber( const ::rtl::OUString& rNewToken ); - void SetFathersName( const ::rtl::OUString& rNewToken ); - void SetApartment( const ::rtl::OUString& rNewToken ); - - sal_Bool IsTokenReadonly( USHORT nToken ) const; - ::rtl::OUString GetToken(USHORT nToken) const; -}; - -#endif // #ifndef INCLUDED_SVTOOLS_USEROPTIONS_HXX diff --git a/svtools/inc/svtools/viewoptions.hxx b/svtools/inc/svtools/viewoptions.hxx deleted file mode 100644 index e95af38cb322..000000000000 --- a/svtools/inc/svtools/viewoptions.hxx +++ /dev/null @@ -1,356 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: viewoptions.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_VIEWOPTIONS_HXX -#define INCLUDED_SVTOOLS_VIEWOPTIONS_HXX - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include "svtools/svldllapi.h" -#include -#include -#include -#include -#include -#include -#include -#include - -//_________________________________________________________________________________________________________________ -// forward declarations -//_________________________________________________________________________________________________________________ - -class SvtViewOptionsBase_Impl; - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @descr Use these enum values to specify right list in configuration in which your view data are saved. -*//*-*************************************************************************************************************/ - -enum EViewType -{ - E_DIALOG = 0, - E_TABDIALOG = 1, - E_TABPAGE = 2, - E_WINDOW = 3 -}; - -/*-************************************************************************************************************//** - @short collect informations about view features - @descr We support different basetypes of views like dialogs, tab-dialogs, tab-pages and normal windows. - You must specify your basetype by using right enum value and must give us a valid name for your - subkey in registry! We support some fix features for some bastypes and user data as string for all! - see also configuration package "org.openoffice.Office.Views/..." for further informations. - - template of configuration: - DialogType - /WindowState [string] - /UserData [set of any scalar types] - TabDialogType - /WindowState [string] - /UserData [set of any scalar types] - /PageID [int] - TabPageType - /WindowState [string] - /UserData [set of any scalar types] - WindowType - /WindowState [string] - /UserData [set of any scalar types] - /Visible [boolean] - - structure of configuration: - - org.openoffice.Office.Views [package] - /Dialogs [set] - /Dialog_FileOpen [DialogType] - /Dialog_ImportGraphics [DialogType] - ... - /Dialog_ [DialogType] - - /TabDialogs [set] - /TabDialog_001 [TabDialogType] - /TabDialog_Blubber [TabDialogType] - ... - /TabDialog_ [TabDialogType] - - /TabPages [set] - /TabPage_XXX [TabPageType] - /TabPage_Date [TabPageType] - ... - /TabPage_ [TabPageType] - - /Windows [set] - /Window_User [WindowType] - /Window_Options [WindowType] - ... - /Window_ [WindowType] - - @implements - - @base - - - @devstatus ready to use -*//*-*************************************************************************************************************/ - -class SVL_DLLPUBLIC SvtViewOptions: public svt::detail::Options -{ - /* - #ifdef TF_OLDVIEW - public: - void GetPosition ( sal_Int32& nX , - sal_Int32& nY ) const; - void SetPosition ( sal_Int32 nX , - sal_Int32 nY ); - void GetSize ( sal_Int32& nWidth , - sal_Int32& nHeight ) const; - void SetSize ( sal_Int32 nWidth , - sal_Int32 nHeight ); - ::rtl::OUString GetUserData ( ) const; - void SetUserData ( const ::rtl::OUString& sData ); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > SeperateUserData( const ::rtl::OUString& sData , - sal_Unicode cSeperator=';' ); - static ::rtl::OUString GenerateUserData( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& seqData , - sal_Unicode cSeperator=';' ); - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetAnyData ( ) const; - void SetAnyData ( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lData ); - #endif - */ - - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short standard constructor and destructor - @descr This will de-/initialize an instance with default values. - You must give us the basic type of your view and a name which specify right entry - in dynamical configuration list. If entry not exist, we create a new one! - - @seealso enum EViewType - - @param "eType" specify type of your view and is used to use right data container! - @param "sViewName" specify the name of your view and is the key name in data list too. - @return - - - @onerror An assertion is thrown in debug version. Otherwise we do nothing! - *//*-*****************************************************************************************************/ - - SvtViewOptions( EViewType eType , - const ::rtl::OUString& sViewName ); - virtual ~SvtViewOptions(); - - /*-****************************************************************************************************//** - @short support preload of these config item - @descr Sometimes we need preloading of these configuration data without real using of it. - - @seealso - - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - static void AcquireOptions(); - static void ReleaseOptions(); - - //--------------------------------------------------------------------------------------------------------- - // interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short use it to get information about existing entries in configuration - @descr The methods to set/get the position or size will create a new entry automaticly if - it not already exist and work with default values! - If this a problem for you - you MUST call these method before and - you must make up your own mind about that. - - @seealso - - - @onerror No error should occure. - *//*-*****************************************************************************************************/ - - sal_Bool Exists() const; - - /*-****************************************************************************************************//** - @short use it to delete an entry of dynamic view set - @descr You can use this method to delete anexisting node in configuration. - But if you call a Set- or Get- method again on this instance - the item is created again! If you do nothing after this call - your view will die relay in configuration ... - - @seealso method Exist() - - @return True if delete OK, False otherwise. - - @onerror We return sal_False. - *//*-*****************************************************************************************************/ - - sal_Bool Delete(); - - /*-****************************************************************************************************//** - @short use it to set/get the window state of your view - @descr These value describe position/size and some other states of a window. - Use it with right vcl methods directly. Normaly it's not neccessary to - parse given string! - - @seealso vcl methods - - @onerror - - *//*-*****************************************************************************************************/ - - ::rtl::OUString GetWindowState( ) const; - void SetWindowState( const ::rtl::OUString& sState ); - - /*-****************************************************************************************************//** - @short use it to set/get the page number which was the last active one - @descr It's only supported for: - tab-dialogs - If you call it for other ones you will get an assertion in debug version. - In a product version we do nothing! - - @seealso - - - @onerror An assertion is thrown in debug version. Otherwise we do nothing! - *//*-*****************************************************************************************************/ - - sal_Int32 GetPageID( ) const; - void SetPageID( sal_Int32 nID ); - - /*-****************************************************************************************************//** - @short use it to set/get the visual state of a window - @descr It's only supported for: - windows - If you call it for other ones you will get an assertion in debug version. - In a product version we do nothing! - - @seealso - - - @onerror An assertion is thrown in debug version. Otherwise we do nothing! - *//*-*****************************************************************************************************/ - - sal_Bool IsVisible ( ) const; - void SetVisible( sal_Bool bState ); - - /*-****************************************************************************************************//** - @short use it to set/get the extended user data (consisting of a set of named scalar values) - @descr It's supported for ALL types! - Every view can handle its own user defined data set. - - @seealso - - - @onerror In the non-product version, an assertion is made. In a product version, errors are silently ignored. - *//*-*****************************************************************************************************/ -/* -#ifdef TF_OLDVIEW - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetUserData( sal_Bool bMakeItDifferent ) const; -#else -*/ - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetUserData( ) const; -//#endif - void SetUserData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& lData ); - - /*-****************************************************************************************************//** - @short use it to set/get ONE special user data item directly - @descr Normaly you can work on full user data list by using "Set/GetUserData()". - With this function you have an access on special list entries directly without any - - @seealso - - - @onerror In the non-product version, an assertion is made. In a product version, errors are silently ignored. - *//*-*****************************************************************************************************/ - - ::com::sun::star::uno::Any GetUserItem( const ::rtl::OUString& sName ) const; - void SetUserItem( const ::rtl::OUString& sName , - const ::com::sun::star::uno::Any& aValue ); - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return a reference to a static mutex - @descr These class is threadsafe. - We create a static mutex only for one time and use it to protect our refcount and container - member! - - @seealso - - - @param - - @return A reference to a static mutex member. - - @onerror - - *//*-*****************************************************************************************************/ - - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - /// specify which list of views in configuration is used! This can't be a static value!!! - /// ... because we need this value to work with right static data container. - EViewType m_eViewType ; - ::rtl::OUString m_sViewName ; - - /// - impl. data container as dynamic pointer for smaller memory requirements! - /// - internal ref count mechanism - - /*Attention - - Don't initialize these static member in these header! - a) Double defined symbols will be detected ... - b) and unresolved externals exist at linking time. - Do it in your source only. - */ - - static SvtViewOptionsBase_Impl* m_pDataContainer_Dialogs ; /// hold data for all dialogs - static sal_Int32 m_nRefCount_Dialogs ; - static SvtViewOptionsBase_Impl* m_pDataContainer_TabDialogs ; /// hold data for all tab-dialogs - static sal_Int32 m_nRefCount_TabDialogs ; - static SvtViewOptionsBase_Impl* m_pDataContainer_TabPages ; /// hold data for all tab-pages - static sal_Int32 m_nRefCount_TabPages ; - static SvtViewOptionsBase_Impl* m_pDataContainer_Windows ; /// hold data for all windows - static sal_Int32 m_nRefCount_Windows ; - -}; // class SvtViewOptions - -#endif // #ifndef INCLUDED_SVTOOLS_VIEWOPTIONS_HXX diff --git a/svtools/inc/svtools/workingsetoptions.hxx b/svtools/inc/svtools/workingsetoptions.hxx deleted file mode 100644 index b66f71512e7e..000000000000 --- a/svtools/inc/svtools/workingsetoptions.hxx +++ /dev/null @@ -1,159 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: workingsetoptions.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_WORKINGSETOPTIONS_HXX -#define INCLUDED_SVTOOLS_WORKINGSETOPTIONS_HXX - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include -#include -#include -#include -#include - -//_________________________________________________________________________________________________________________ -// forward declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short forward declaration to our private date container implementation - @descr We use these class as internal member to support small memory requirements. - You can create the container if it is neccessary. The class which use these mechanism - is faster and smaller then a complete implementation! -*//*-*************************************************************************************************************/ - -class SvtWorkingSetOptions_Impl; - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short collect informations about security features - @descr - - - @implements - - @base - - - @devstatus ready to use -*//*-*************************************************************************************************************/ - -class SvtWorkingSetOptions: public svt::detail::Options -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short standard constructor and destructor - @descr This will initialize an instance with default values. - We implement these class with a refcount mechanism! Every instance of this class increase it - at create and decrease it at delete time - but all instances use the same data container! - He is implemented as a static member ... - - @seealso member m_nRefCount - @seealso member m_pDataContainer - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - SvtWorkingSetOptions(); - virtual ~SvtWorkingSetOptions(); - - //--------------------------------------------------------------------------------------------------------- - // interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short interface methods to get and set value of config key "org.openoffice.Office.Common/Security/Scripting/SecureURL" - @descr These value defines the editing view for documents and windows, which have to be restored - when restarting StarOffice. The list gets filled, if Save/WorkingSet = true. - - @seealso - - - @param "seqWindowList", new values to set it in configuration. - @return The values which represent current state of internal variable. - - @onerror No error should occurre! - *//*-*****************************************************************************************************/ - - ::com::sun::star::uno::Sequence< ::rtl::OUString > GetWindowList( ) const ; - void SetWindowList( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& seqWindowList ) ; - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short return a reference to a static mutex - @descr These class use his own static mutex to be threadsafe. - We create a static mutex only for one ime and use at different times. - - @seealso - - - @param - - @return A reference to a static mutex member. - - @onerror - - *//*-*****************************************************************************************************/ - - static ::osl::Mutex& GetOwnStaticMutex(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - /*Attention - - Don't initialize these static member in these header! - a) Double dfined symbols will be detected ... - b) and unresolved externals exist at linking time. - Do it in your source only. - */ - - static SvtWorkingSetOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! - static sal_Int32 m_nRefCount ; /// internal ref count mechanism - -}; // class SvtWorkingSetOptions - -#endif // #ifndef INCLUDED_SVTOOLS_WORKINGSETOPTIONS_HXX diff --git a/svtools/inc/xmlaccelcfg.hxx b/svtools/inc/xmlaccelcfg.hxx deleted file mode 100644 index 00967b234111..000000000000 --- a/svtools/inc/xmlaccelcfg.hxx +++ /dev/null @@ -1,112 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: xmlaccelcfg.hxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_SVTOOLS_XMLACCELCFG_HXX -#define INCLUDED_SVTOOLS_XMLACCELCFG_HXX - -#ifndef __COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_ -#include -#endif -#include - -#include - -class OReadAccelatorDocumentHandler : public ::com::sun::star::xml::sax::XDocumentHandler, - public ::cppu::OWeakObject -{ - public: - OReadAccelatorDocumentHandler( SvtAcceleratorItemList& aNewAcceleratorItemList ) : - m_nElementDepth( 0 ), - m_bAcceleratorMode( sal_False ), - m_bItemCloseExpected( sal_False ), - m_xLocator( 0 ), - m_aReadAcceleratorList( aNewAcceleratorItemList ) {} - virtual ~OReadAccelatorDocumentHandler() {} - - // XInterface - virtual void SAL_CALL acquire() throw() - { OWeakObject::acquire(); } - virtual void SAL_CALL release() throw() - { OWeakObject::release(); } - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( - const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException ); - - // XDocumentHandler - virtual void SAL_CALL startDocument(void) - throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL endDocument(void) - throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL startElement( - const ::rtl::OUString& aName, - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs ) - throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL endElement(const ::rtl::OUString& aName) throw - ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL characters(const ::rtl::OUString& aChars) - throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL ignorableWhitespace(const ::rtl::OUString& aWhitespaces) - throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL processingInstruction( const ::rtl::OUString& aTarget, const ::rtl::OUString& aData ) - throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL setDocumentLocator( - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > &xLocator) - throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); - - private: - ::rtl::OUString getErrorLineString(); - - int m_nElementDepth; - sal_Bool m_bAcceleratorMode; - sal_Bool m_bItemCloseExpected; - ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > m_xLocator; - SvtAcceleratorItemList& m_aReadAcceleratorList; -}; - - -class OWriteAccelatorDocumentHandler -{ - public: - OWriteAccelatorDocumentHandler( - const SvtAcceleratorItemList& aWriteAcceleratorList, - ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > ); - virtual ~OWriteAccelatorDocumentHandler(); - - void WriteAcceleratorDocument() throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); - - private: - void WriteAcceleratorItem( const SvtAcceleratorConfigItem& aAcceleratorItem ) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); - - ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xWriteDocumentHandler; - ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > m_xEmptyList; - ::rtl::OUString m_aAttributeType; - const SvtAcceleratorItemList& m_aWriteAcceleratorList; -}; - -#endif // INCLUDED_SVTOOLS_XMLACCELCFG_HXX diff --git a/svtools/prj/d.lst b/svtools/prj/d.lst index 3dc9c0b013bb..a3a7679f8aea 100644 --- a/svtools/prj/d.lst +++ b/svtools/prj/d.lst @@ -25,310 +25,108 @@ mkdir: %_DEST%\inc%_EXT%\svtools ..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\* ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\* -..\inc\svtools\svldllapi.h %_DEST%\inc%_EXT%\svtools\svldllapi.h -..\inc\svtools\svtdllapi.h %_DEST%\inc%_EXT%\svtools\svtdllapi.h +..\inc\svtools\*.hxx %_DEST%\inc%_EXT%\svtools\*.hxx +..\inc\svtools\*.h %_DEST%\inc%_EXT%\svtools\*.h +..\inc\svtools\*.hrc %_DEST%\inc%_EXT%\svtools\*.hrc -..\inc\svtools\globalnameitem.hxx %_DEST%\inc%_EXT%\svtools\globalnameitem.hxx ..\inc\imagemgr.hxx %_DEST%\inc%_EXT%\svtools\imagemgr.hxx ..\inc\imagemgr.hrc %_DEST%\inc%_EXT%\svtools\imagemgr.hrc ..\inc\testtool.hxx %_DEST%\inc%_EXT%\svtools\testtool.hxx ..\inc\flbytes.hxx %_DEST%\inc%_EXT%\svtools\flbytes.hxx ..\inc\adrparse.hxx %_DEST%\inc%_EXT%\svtools\adrparse.hxx -..\inc\svtools\aeitem.hxx %_DEST%\inc%_EXT%\svtools\aeitem.hxx -..\inc\svtools\brdcst.hxx %_DEST%\inc%_EXT%\svtools\brdcst.hxx ..\inc\broadcast.hxx %_DEST%\inc%_EXT%\svtools\broadcast.hxx -..\inc\svtools\brwbox.hxx %_DEST%\inc%_EXT%\svtools\brwbox.hxx ..\inc\calendar.hxx %_DEST%\inc%_EXT%\svtools\calendar.hxx -..\inc\svtools\cancel.hxx %_DEST%\inc%_EXT%\svtools\cancel.hxx ..\inc\cntnrsrt.hxx %_DEST%\inc%_EXT%\svtools\cntnrsrt.hxx -..\inc\svtools\colrdlg.hxx %_DEST%\inc%_EXT%\svtools\colrdlg.hxx -..\inc\svtools\colctrl.hxx %_DEST%\inc%_EXT%\svtools\colctrl.hxx ..\inc\ctrlbox.hxx %_DEST%\inc%_EXT%\svtools\ctrlbox.hxx ..\inc\ctrltool.hxx %_DEST%\inc%_EXT%\svtools\ctrltool.hxx ..\inc\collatorres.hxx %_DEST%\inc%_EXT%\svtools\collatorres.hxx ..\inc\indexentryres.hxx %_DEST%\inc%_EXT%\svtools\indexentryres.hxx ..\inc\cntwids.hrc %_DEST%\inc%_EXT%\svtools\cntwids.hrc -..\inc\svtools\dateitem.hxx %_DEST%\inc%_EXT%\svtools\dateitem.hxx -..\inc\svtools\dtritem.hxx %_DEST%\inc%_EXT%\svtools\dtritem.hxx -..\inc\svtools\frqitem.hxx %_DEST%\inc%_EXT%\svtools\frqitem.hxx -..\inc\svtools\cstitem.hxx %_DEST%\inc%_EXT%\svtools\cstitem.hxx -..\inc\svtools\tfrmitem.hxx %_DEST%\inc%_EXT%\svtools\tfrmitem.hxx -..\inc\svtools\cntwall.hxx %_DEST%\inc%_EXT%\svtools\cntwall.hxx -..\inc\svtools\langtab.hxx %_DEST%\inc%_EXT%\svtools\langtab.hxx ..\inc\itemdel.hxx %_DEST%\inc%_EXT%\svtools\itemdel.hxx ..\inc\wallitem.hxx %_DEST%\inc%_EXT%\svtools\wallitem.hxx -..\inc\svtools\sfontitm.hxx %_DEST%\inc%_EXT%\svtools\sfontitm.hxx -..\inc\svtools\bintitem.hxx %_DEST%\inc%_EXT%\svtools\bintitem.hxx ..\inc\stylepool.hxx %_DEST%\inc%_EXT%\svtools\stylepool.hxx ..\inc\dialogcontrolling.hxx %_DEST%\inc%_EXT%\svtools\dialogcontrolling.hxx -..\inc\svtools\eitem.hxx %_DEST%\inc%_EXT%\svtools\eitem.hxx -..\inc\eventcfg.hxx %_DEST%\inc%_EXT%\svtools\eventcfg.hxx ..\inc\filedlg.hxx %_DEST%\inc%_EXT%\svtools\filedlg.hxx -..\inc\svtools\filerec.hxx %_DEST%\inc%_EXT%\svtools\filerec.hxx -..\inc\svtools\flagitem.hxx %_DEST%\inc%_EXT%\svtools\flagitem.hxx -..\inc\svtools\fltcall.hxx %_DEST%\inc%_EXT%\svtools\fltcall.hxx -..\inc\svtools\wmf.hxx %_DEST%\inc%_EXT%\svtools\wmf.hxx ..\inc\fltdefs.hxx %_DEST%\inc%_EXT%\svtools\fltdefs.hxx -..\inc\svtools\filter.hxx %_DEST%\inc%_EXT%\svtools\filter.hxx -..\inc\svtools\FilterConfigItem.hxx %_DEST%\inc%_EXT%\svtools\FilterConfigItem.hxx -..\inc\svtools\fmtfield.hxx %_DEST%\inc%_EXT%\svtools\fmtfield.hxx -..\inc\svtools\hint.hxx %_DEST%\inc%_EXT%\svtools\hint.hxx -..\inc\svtools\accessibletableprovider.hxx %_DEST%\inc%_EXT%\svtools\accessibletableprovider.hxx -..\inc\svtools\AccessibleBrowseBoxObjType.hxx %_DEST%\inc%_EXT%\svtools\AccessibleBrowseBoxObjType.hxx -..\inc\svtools\accessiblefactory.hxx %_DEST%\inc%_EXT%\svtools\accessiblefactory.hxx -..\inc\svtools\textwindowpeer.hxx %_DEST%\inc%_EXT%\svtools\textwindowpeer.hxx ..\inc\imgdef.hxx %_DEST%\inc%_EXT%\svtools\imgdef.hxx ..\inc\inetdef.hxx %_DEST%\inc%_EXT%\svtools\inetdef.hxx -..\inc\svtools\inethist.hxx %_DEST%\inc%_EXT%\svtools\inethist.hxx ..\inc\inetmsg.hxx %_DEST%\inc%_EXT%\svtools\inetmsg.hxx ..\inc\inetstrm.hxx %_DEST%\inc%_EXT%\svtools\inetstrm.hxx -..\inc\svtools\intitem.hxx %_DEST%\inc%_EXT%\svtools\intitem.hxx -..\inc\svtools\visitem.hxx %_DEST%\inc%_EXT%\svtools\visitem.hxx -..\inc\svtools\imageitm.hxx %_DEST%\inc%_EXT%\svtools\imageitm.hxx -..\inc\svtools\isethint.hxx %_DEST%\inc%_EXT%\svtools\isethint.hxx -..\inc\svtools\itemiter.hxx %_DEST%\inc%_EXT%\svtools\itemiter.hxx -..\inc\svtools\itempool.hxx %_DEST%\inc%_EXT%\svtools\itempool.hxx -..\inc\svtools\itemset.hxx %_DEST%\inc%_EXT%\svtools\itemset.hxx -..\inc\svtools\lckbitem.hxx %_DEST%\inc%_EXT%\svtools\lckbitem.hxx ..\inc\listener.hxx %_DEST%\inc%_EXT%\svtools\listener.hxx ..\inc\listeneriter.hxx %_DEST%\inc%_EXT%\svtools\listeneriter.hxx -..\inc\svtools\lstner.hxx %_DEST%\inc%_EXT%\svtools\lstner.hxx -..\inc\svtools\macitem.hxx %_DEST%\inc%_EXT%\svtools\macitem.hxx ..\inc\memberid.hrc %_DEST%\inc%_EXT%\svtools\memberid.hrc -..\inc\svtools\nranges.hxx %_DEST%\inc%_EXT%\svtools\nranges.hxx -..\inc\svtools\ownlist.hxx %_DEST%\inc%_EXT%\svtools\ownlist.hxx ..\inc\prgsbar.hxx %_DEST%\inc%_EXT%\svtools\prgsbar.hxx -..\inc\svtools\prnsetup.hxx %_DEST%\inc%_EXT%\svtools\prnsetup.hxx ..\inc\poolcach.hxx %_DEST%\inc%_EXT%\svtools\poolcach.hxx -..\inc\svtools\poolitem.hxx %_DEST%\inc%_EXT%\svtools\poolitem.hxx -..\inc\svtools\printdlg.hxx %_DEST%\inc%_EXT%\svtools\printdlg.hxx -..\inc\svtools\ptitem.hxx %_DEST%\inc%_EXT%\svtools\ptitem.hxx -..\inc\svtools\szitem.hxx %_DEST%\inc%_EXT%\svtools\szitem.hxx -..\inc\svtools\rectitem.hxx %_DEST%\inc%_EXT%\svtools\rectitem.hxx -..\inc\svtools\rngitem.hxx %_DEST%\inc%_EXT%\svtools\rngitem.hxx ..\inc\ruler.hxx %_DEST%\inc%_EXT%\svtools\ruler.hxx ..\inc\scrwin.hxx %_DEST%\inc%_EXT%\svtools\scrwin.hxx -..\inc\svtools\sharecontrolfile.hxx %_DEST%\inc%_EXT%\svtools\sharecontrolfile.hxx -..\inc\svtools\documentlockfile.hxx %_DEST%\inc%_EXT%\svtools\documentlockfile.hxx -..\inc\svtools\lockfilecommon.hxx %_DEST%\inc%_EXT%\svtools\lockfilecommon.hxx -..\inc\svtools\slstitm.hxx %_DEST%\inc%_EXT%\svtools\slstitm.hxx -..\inc\svtools\ilstitem.hxx %_DEST%\inc%_EXT%\svtools\ilstitem.hxx -..\inc\svtools\smplhint.hxx %_DEST%\inc%_EXT%\svtools\smplhint.hxx -..\inc\svtools\cnclhint.hxx %_DEST%\inc%_EXT%\svtools\cnclhint.hxx -..\inc\svtools\inettype.hxx %_DEST%\inc%_EXT%\svtools\inettype.hxx -..\inc\svtools\brwhead.hxx %_DEST%\inc%_EXT%\svtools\brwhead.hxx -..\inc\svtools\solar.hrc %_DEST%\inc%_EXT%\svtools\solar.hrc ..\inc\scriptedtext.hxx %_DEST%\inc%_EXT%\svtools\scriptedtext.hxx -..\inc\svtools\stdctrl.hxx %_DEST%\inc%_EXT%\svtools\stdctrl.hxx -..\inc\svtools\stritem.hxx %_DEST%\inc%_EXT%\svtools\stritem.hxx -..\inc\svtools\style.hrc %_DEST%\inc%_EXT%\svtools\style.hrc -..\inc\svtools\style.hxx %_DEST%\inc%_EXT%\svtools\style.hxx -..\inc\svtools\svarray.hxx %_DEST%\inc%_EXT%\svtools\svarray.hxx -..\inc\svtools\svdde.hxx %_DEST%\inc%_EXT%\svtools\svdde.hxx -..\inc\svtools\svtdata.hxx %_DEST%\inc%_EXT%\svtools\svtdata.hxx ..\inc\tabbar.hxx %_DEST%\inc%_EXT%\svtools\tabbar.hxx ..\inc\taskbar.hxx %_DEST%\inc%_EXT%\svtools\taskbar.hxx -..\inc\svtools\undo.hxx %_DEST%\inc%_EXT%\svtools\undo.hxx ..\inc\whiter.hxx %_DEST%\inc%_EXT%\svtools\whiter.hxx -..\inc\svtools\valueset.hxx %_DEST%\inc%_EXT%\svtools\valueset.hxx ..\inc\stdmenu.hxx %_DEST%\inc%_EXT%\svtools\stdmenu.hxx -..\inc\svtools\headbar.hxx %_DEST%\inc%_EXT%\svtools\headbar.hxx -..\inc\svtools\svicnvw.hxx %_DEST%\inc%_EXT%\svtools\svicnvw.hxx -..\inc\svtools\svlbitm.hxx %_DEST%\inc%_EXT%\svtools\svlbitm.hxx -..\inc\svtools\svlbox.hxx %_DEST%\inc%_EXT%\svtools\svlbox.hxx -..\inc\svtools\svtabbx.hxx %_DEST%\inc%_EXT%\svtools\svtabbx.hxx -..\inc\svtools\svtreebx.hxx %_DEST%\inc%_EXT%\svtools\svtreebx.hxx ..\inc\tooltiplbox.hxx %_DEST%\inc%_EXT%\svtools\tooltiplbox.hxx -..\inc\svtools\treelist.hxx %_DEST%\inc%_EXT%\svtools\treelist.hxx -..\inc\svtools\xtextedt.hxx %_DEST%\inc%_EXT%\svtools\xtextedt.hxx -..\inc\svtools\texteng.hxx %_DEST%\inc%_EXT%\svtools\texteng.hxx -..\inc\svtools\textview.hxx %_DEST%\inc%_EXT%\svtools\textview.hxx -..\inc\svtools\textdata.hxx %_DEST%\inc%_EXT%\svtools\textdata.hxx ..\inc\txtattr.hxx %_DEST%\inc%_EXT%\svtools\txtattr.hxx ..\inc\sychconv.hxx %_DEST%\inc%_EXT%\svtools\sychconv.hxx -..\inc\svtools\ttprops.hxx %_DEST%\inc%_EXT%\svtools\ttprops.hxx -..\inc\svtools\transfer.hxx %_DEST%\inc%_EXT%\svtools\transfer.hxx -..\inc\svtools\embedtransfer.hxx %_DEST%\inc%_EXT%\svtools\embedtransfer.hxx -..\inc\svtools\embedhlp.hxx %_DEST%\inc%_EXT%\svtools\embedhlp.hxx ..\inc\cliplistener.hxx %_DEST%\inc%_EXT%\svtools\cliplistener.hxx ..\inc\txtcmp.hxx %_DEST%\inc%_EXT%\svtools\txtcmp.hxx ..\inc\urlbmk.hxx %_DEST%\inc%_EXT%\svtools\urlbmk.hxx ..\inc\inetimg.hxx %_DEST%\inc%_EXT%\svtools\inetimg.hxx -..\inc\svtools\svmedit.hxx %_DEST%\inc%_EXT%\svtools\svmedit.hxx -..\inc\svtools\editsyntaxhighlighter.hxx %_DEST%\inc%_EXT%\svtools\editsyntaxhighlighter.hxx -..\inc\svtools\syntaxhighlight.hxx %_DEST%\inc%_EXT%\svtools\syntaxhighlight.hxx -..\inc\svtools\svmedit2.hxx %_DEST%\inc%_EXT%\svtools\svmedit2.hxx -..\inc\svtools\svstdarr.hxx %_DEST%\inc%_EXT%\svtools\svstdarr.hxx -..\inc\svtools\metitem.hxx %_DEST%\inc%_EXT%\svtools\metitem.hxx -..\inc\svtools\nfversi.hxx %_DEST%\inc%_EXT%\svtools\nfversi.hxx -..\inc\svtools\nfkeytab.hxx %_DEST%\inc%_EXT%\svtools\nfkeytab.hxx ..\inc\nfsymbol.hxx %_DEST%\inc%_EXT%\svtools\nfsymbol.hxx -..\inc\svtools\wizdlg.hxx %_DEST%\inc%_EXT%\svtools\wizdlg.hxx -..\inc\svtools\zforlist.hxx %_DEST%\inc%_EXT%\svtools\zforlist.hxx -..\inc\svtools\zformat.hxx %_DEST%\inc%_EXT%\svtools\zformat.hxx ..\inc\numuno.hxx %_DEST%\inc%_EXT%\svtools\numuno.hxx -..\inc\svtools\ondemand.hxx %_DEST%\inc%_EXT%\svtools\ondemand.hxx -..\inc\svtools\loginerr.hxx %_DEST%\inc%_EXT%\svtools\loginerr.hxx -..\inc\svtools\logindlg.hxx %_DEST%\inc%_EXT%\svtools\logindlg.hxx -..\inc\svtools\httpcook.hxx %_DEST%\inc%_EXT%\svtools\httpcook.hxx ..\inc\imageresourceaccess.hxx %_DEST%\inc%_EXT%\svtools\imageresourceaccess.hxx -..\inc\svtools\itemprop.hxx %_DEST%\inc%_EXT%\svtools\itemprop.hxx ..\inc\addresstemplate.hxx %_DEST%\inc%_EXT%\svtools\addresstemplate.hxx -..\inc\svtools\genericunodialog.hxx %_DEST%\inc%_EXT%\svtools\genericunodialog.hxx -..\inc\svtools\editbrowsebox.hxx %_DEST%\inc%_EXT%\svtools\editbrowsebox.hxx -..\inc\svtools\editimplementation.hxx %_DEST%\inc%_EXT%\svtools\editimplementation.hxx ..\inc\templatefoldercache.hxx %_DEST%\inc%_EXT%\svtools\templatefoldercache.hxx ..\inc\folderrestriction.hxx %_DEST%\inc%_EXT%\svtools\folderrestriction.hxx ..\inc\filenotation.hxx %_DEST%\inc%_EXT%\svtools\filenotation.hxx -..\inc\svtools\urlcontrol.hxx %_DEST%\inc%_EXT%\svtools\urlcontrol.hxx -..\inc\svtools\fileurlbox.hxx %_DEST%\inc%_EXT%\svtools\fileurlbox.hxx -..\inc\svtools\toolboxcontroller.hxx %_DEST%\inc%_EXT%\svtools\toolboxcontroller.hxx ..\inc\framestatuslistener.hxx %_DEST%\inc%_EXT%\svtools\framestatuslistener.hxx ..\inc\statusbarcontroller.hxx %_DEST%\inc%_EXT%\svtools\statusbarcontroller.hxx -..\inc\svtools\generictoolboxcontroller.hxx %_DEST%\inc%_EXT%\svtools\generictoolboxcontroller.hxx -..\inc\svtools\restrictedpaths.hxx %_DEST%\inc%_EXT%\svtools\restrictedpaths.hxx - -..\inc\svtools\imap.hxx %_DEST%\inc%_EXT%\svtools\imap.hxx -..\inc\svtools\imapobj.hxx %_DEST%\inc%_EXT%\svtools\imapobj.hxx -..\inc\svtools\imaprect.hxx %_DEST%\inc%_EXT%\svtools\imaprect.hxx -..\inc\svtools\imapcirc.hxx %_DEST%\inc%_EXT%\svtools\imapcirc.hxx -..\inc\svtools\imappoly.hxx %_DEST%\inc%_EXT%\svtools\imappoly.hxx - -..\inc\svtools\parhtml.hxx %_DEST%\inc%_EXT%\svtools\parhtml.hxx ..\inc\htmltokn.h %_DEST%\inc%_EXT%\svtools\htmltokn.h ..\inc\htmlkywd.hxx %_DEST%\inc%_EXT%\svtools\htmlkywd.hxx -..\inc\svtools\svparser.hxx %_DEST%\inc%_EXT%\svtools\svparser.hxx -..\inc\svtools\htmlout.hxx %_DEST%\inc%_EXT%\svtools\htmlout.hxx ..\source\svrtf\rtfout.hxx %_DEST%\inc%_EXT%\svtools\rtfout.hxx -..\inc\svtools\parrtf.hxx %_DEST%\inc%_EXT%\svtools\parrtf.hxx ..\source\svrtf\rtftoken.h %_DEST%\inc%_EXT%\svtools\rtftoken.h ..\source\svrtf\rtfkeywd.hxx %_DEST%\inc%_EXT%\svtools\rtfkeywd.hxx - -..\inc\svtools\ctypeitm.hxx %_DEST%\inc%_EXT%\svtools\ctypeitm.hxx - ..\inc\strmadpt.hxx %_DEST%\inc%_EXT%\svtools\strmadpt.hxx ..\inc\instrm.hxx %_DEST%\inc%_EXT%\svtools\instrm.hxx ..\inc\outstrm.hxx %_DEST%\inc%_EXT%\svtools\outstrm.hxx - -..\inc\svtools\section.hxx %_DEST%\inc%_EXT%\svtools\section.hxx ..\inc\sectctr.hxx %_DEST%\inc%_EXT%\svtools\sectctr.hxx ..\inc\privsplt.hxx %_DEST%\inc%_EXT%\svtools\privsplt.hxx ..\inc\expander.hxx %_DEST%\inc%_EXT%\svtools\expander.hxx ..\source\svsql\converter.hxx %_DEST%\inc%_EXT%\svtools\converter.hxx - ..\inc\filectrl.hxx %_DEST%\inc%_EXT%\svtools\filectrl.hxx -..\inc\svtools\cenumitm.hxx %_DEST%\inc%_EXT%\svtools\cenumitm.hxx -..\inc\svtools\cintitem.hxx %_DEST%\inc%_EXT%\svtools\cintitem.hxx -..\inc\svtools\custritm.hxx %_DEST%\inc%_EXT%\svtools\custritm.hxx - ..\inc\sfxecode.hxx %_DEST%\inc%_EXT%\svtools\sfxecode.hxx -..\inc\svtools\ehdl.hxx %_DEST%\inc%_EXT%\svtools\ehdl.hxx -..\inc\svtools\svtools.hrc %_DEST%\inc%_EXT%\svtools\svtools.hrc ..\source\dialogs\filedlg2.hrc %_DEST%\inc%_EXT%\svtools\filedlg2.hrc - ..\inc\xmlement.hxx %_DEST%\inc%_EXT%\svtools\xmlement.hxx -..\inc\svtools\tresitem.hxx %_DEST%\inc%_EXT%\svtools\tresitem.hxx ..\inc\urihelper.hxx %_DEST%\inc%_EXT%\svtools\urihelper.hxx ..\inc\reginfo.hxx %_DEST%\inc%_EXT%\svtools\reginfo.hxx -..\inc\cacheoptions.hxx %_DEST%\inc%_EXT%\svtools\cacheoptions.hxx -..\inc\svtools\cjkoptions.hxx %_DEST%\inc%_EXT%\svtools\cjkoptions.hxx -..\inc\javaoptions.hxx %_DEST%\inc%_EXT%\svtools\javaoptions.hxx -..\inc\svtools\accelcfg.hxx %_DEST%\inc%_EXT%\svtools\accelcfg.hxx -..\inc\svtools\pathoptions.hxx %_DEST%\inc%_EXT%\svtools\pathoptions.hxx -..\inc\svtools\useroptions.hxx %_DEST%\inc%_EXT%\svtools\useroptions.hxx ..\inc\fstathelper.hxx %_DEST%\inc%_EXT%\svtools\fstathelper.hxx -..\inc\svtools\saveopt.hxx %_DEST%\inc%_EXT%\svtools\saveopt.hxx -..\inc\svtools\undoopt.hxx %_DEST%\inc%_EXT%\svtools\undoopt.hxx -..\inc\svtools\helpopt.hxx %_DEST%\inc%_EXT%\svtools\helpopt.hxx -..\inc\svtools\optionsdlg.hxx %_DEST%\inc%_EXT%\svtools\optionsdlg.hxx -..\inc\svtools\moduleoptions.hxx %_DEST%\inc%_EXT%\svtools\moduleoptions.hxx -..\inc\svtools\securityoptions.hxx %_DEST%\inc%_EXT%\svtools\securityoptions.hxx -..\inc\svtools\extendedsecurityoptions.hxx %_DEST%\inc%_EXT%\svtools\extendedsecurityoptions.hxx -..\inc\svtools\miscopt.hxx %_DEST%\inc%_EXT%\svtools\miscopt.hxx -..\inc\svtools\localisationoptions.hxx %_DEST%\inc%_EXT%\svtools\localisationoptions.hxx -..\inc\svtools\workingsetoptions.hxx %_DEST%\inc%_EXT%\svtools\workingsetoptions.hxx -..\inc\svtools\viewoptions.hxx %_DEST%\inc%_EXT%\svtools\viewoptions.hxx -..\inc\svtools\internaloptions.hxx %_DEST%\inc%_EXT%\svtools\internaloptions.hxx -..\inc\svtools\startoptions.hxx %_DEST%\inc%_EXT%\svtools\startoptions.hxx -..\inc\svtools\historyoptions.hxx %_DEST%\inc%_EXT%\svtools\historyoptions.hxx -..\inc\svtools\inetoptions.hxx %_DEST%\inc%_EXT%\svtools\inetoptions.hxx -..\inc\svtools\menuoptions.hxx %_DEST%\inc%_EXT%\svtools\menuoptions.hxx -..\inc\svtools\options3d.hxx %_DEST%\inc%_EXT%\svtools\options3d.hxx -..\inc\svtools\optionsdrawinglayer.hxx %_DEST%\inc%_EXT%\svtools\optionsdrawinglayer.hxx -..\inc\svtools\fontoptions.hxx %_DEST%\inc%_EXT%\svtools\fontoptions.hxx -..\inc\svtools\addxmltostorageoptions.hxx %_DEST%\inc%_EXT%\svtools\addxmltostorageoptions.hxx -..\inc\svtools\defaultoptions.hxx %_DEST%\inc%_EXT%\svtools\defaultoptions.hxx -..\inc\svtools\printwarningoptions.hxx %_DEST%\inc%_EXT%\svtools\printwarningoptions.hxx -..\inc\svtools\printoptions.hxx %_DEST%\inc%_EXT%\svtools\printoptions.hxx -..\inc\svtools\dynamicmenuoptions.hxx %_DEST%\inc%_EXT%\svtools\dynamicmenuoptions.hxx -..\inc\svtools\compatibility.hxx %_DEST%\inc%_EXT%\svtools\compatibility.hxx -..\inc\svtools\syslocaleoptions.hxx %_DEST%\inc%_EXT%\svtools\syslocaleoptions.hxx ..\inc\localresaccess.hxx %_DEST%\inc%_EXT%\svtools\localresaccess.hxx -..\inc\svtools\wizardmachine.hxx %_DEST%\inc%_EXT%\svtools\wizardmachine.hxx -..\inc\svtools\roadmapwizard.hxx %_DEST%\inc%_EXT%\svtools\roadmapwizard.hxx ..\inc\roadmap.hxx %_DEST%\inc%_EXT%\svtools\roadmap.hxx -..\inc\svtools\hyperlabel.hxx %_DEST%\inc%_EXT%\svtools\hyperlabel.hxx -..\inc\svtools\fixedhyper.hxx %_DEST%\inc%_EXT%\svtools\fixedhyper.hxx ..\inc\helpagentwindow.hxx %_DEST%\inc%_EXT%\svtools\helpagentwindow.hxx ..\inc\pickerhistory.hxx %_DEST%\inc%_EXT%\svtools\pickerhistory.hxx ..\inc\pickerhistoryaccess.hxx %_DEST%\inc%_EXT%\svtools\pickerhistoryaccess.hxx ..\inc\pickerhelper.hxx %_DEST%\inc%_EXT%\svtools\pickerhelper.hxx -..\inc\regoptions.hxx %_DEST%\inc%_EXT%\svtools\regoptions.hxx -..\inc\svtools\accessibilityoptions.hxx %_DEST%\inc%_EXT%\svtools\accessibilityoptions.hxx -..\inc\svtools\cmdoptions.hxx %_DEST%\inc%_EXT%\svtools\cmdoptions.hxx -..\inc\svtools\ctloptions.hxx %_DEST%\inc%_EXT%\svtools\ctloptions.hxx -..\inc\svtools\languageoptions.hxx %_DEST%\inc%_EXT%\svtools\languageoptions.hxx -..\inc\svtools\sourceviewconfig.hxx %_DEST%\inc%_EXT%\svtools\sourceviewconfig.hxx -..\inc\svtools\colorcfg.hxx %_DEST%\inc%_EXT%\svtools\colorcfg.hxx - ..\inc\lngmisc.hxx %_DEST%\inc%_EXT%\svtools\lngmisc.hxx -..\inc\svtools\lingucfg.hxx %_DEST%\inc%_EXT%\svtools\lingucfg.hxx -..\inc\linguprops.hxx %_DEST%\inc%_EXT%\svtools\linguprops.hxx -..\inc\searchopt.hxx %_DEST%\inc%_EXT%\svtools\searchopt.hxx - ..\inc\PasswordHelper.hxx %_DEST%\inc%_EXT%\svtools\PasswordHelper.hxx - -..\inc\svtools\syslocale.hxx %_DEST%\inc%_EXT%\svtools\syslocale.hxx - ..\inc\unoimap.hxx %_DEST%\inc%_EXT%\svtools\unoimap.hxx ..\inc\unoevent.hxx %_DEST%\inc%_EXT%\svtools\unoevent.hxx - -..\inc\svtools\stringtransfer.hxx %_DEST%\inc%_EXT%\svtools\stringtransfer.hxx - ..\inc\ivctrl.hxx %_DEST%\inc%_EXT%\svtools\ivctrl.hxx ..\inc\fileview.hxx %_DEST%\inc%_EXT%\svtools\fileview.hxx ..\inc\templdlg.hxx %_DEST%\inc%_EXT%\svtools\templdlg.hxx ..\inc\asynclink.hxx %_DEST%\inc%_EXT%\svtools\asynclink.hxx -..\inc\svtools\inettbc.hxx %_DEST%\inc%_EXT%\svtools\inettbc.hxx -..\inc\svtools\urlfilter.hxx %_DEST%\inc%_EXT%\svtools\urlfilter.hxx - ..\inc\controldims.hrc %_DEST%\inc%_EXT%\svtools\controldims.hrc - -..\inc\svtools\helpid.hrc %_DEST%\inc%_EXT%\svtools\helpid.hrc -..\inc\svtools\insdlg.hxx %_DEST%\inc%_EXT%\svtools\insdlg.hxx ..\inc\soerr.hxx %_DEST%\inc%_EXT%\svtools\soerr.hxx ..\inc\sores.hxx %_DEST%\inc%_EXT%\svtools\sores.hxx - ..\inc\textwindowaccessibility.hxx %_DEST%\inc%_EXT%\svtools\textwindowaccessibility.hxx - ..\inc\fontsubstconfig.hxx %_DEST%\inc%_EXT%\svtools\fontsubstconfig.hxx ..\inc\apearcfg.hxx %_DEST%\inc%_EXT%\svtools\apearcfg.hxx -..\inc\fltrcfg.hxx %_DEST%\inc%_EXT%\svtools\fltrcfg.hxx ..\inc\misccfg.hxx %_DEST%\inc%_EXT%\svtools\misccfg.hxx ..\inc\acceleratorexecute.hxx %_DEST%\inc%_EXT%\svtools\acceleratorexecute.hxx - ..\inc\QueryFolderName.hxx %_DEST%\inc%_EXT%\svtools\QueryFolderName.hxx ..\inc\DocumentInfoPreview.hxx %_DEST%\inc%_EXT%\svtools\DocumentInfoPreview.hxx -..\inc\svtools\javacontext.hxx %_DEST%\inc%_EXT%\svtools\javacontext.hxx -..\inc\svtools\javainteractionhandler.hxx %_DEST%\inc%_EXT%\svtools\javainteractionhandler.hxx ..\inc\dialogclosedlistener.hxx %_DEST%\inc%_EXT%\svtools\dialogclosedlistener.hxx -..\inc\svtools\options.hxx %_DEST%\inc%_EXT%\svtools\options.hxx ..\inc\contextmenuhelper.hxx %_DEST%\inc%_EXT%\svtools\contextmenuhelper.hxx ..\inc\extcolorcfg.hxx %_DEST%\inc%_EXT%\svtools\extcolorcfg.hxx -..\inc\svtools\chartprettypainter.hxx %_DEST%\inc%_EXT%\svtools\chartprettypainter.hxx -..\inc\svtools\extensionlistbox.hxx %_DEST%\inc%_EXT%\svtools\extensionlistbox.hxx - dos: sh -c "if test %OS% = MACOSX; then macosx-create-bundle %_DEST%\bin%_EXT%\bmp=%__PRJROOT%\%__SRC%\bin%_EXT%; fi" *.xml %_DEST%\xml%_EXT%\*.xml diff --git a/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.cxx b/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.cxx index 723b3e44f3e5..082328835fca 100644 --- a/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.cxx +++ b/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.cxx @@ -34,7 +34,7 @@ ************************************************************************/ #include "HistoryOptTest.hxx" -#include "configitems/historyoptions_const.hxx" +#include #include #include diff --git a/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.hxx b/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.hxx index fca9802d2781..8415d9f989b9 100644 --- a/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.hxx +++ b/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.hxx @@ -37,7 +37,7 @@ #define SVTOOLS_HISTORYOPTTEST_HXX #include -#include +#include namespace css = ::com::sun::star; diff --git a/svtools/qa/complex/ConfigItems/helper/UserOptTest.hxx b/svtools/qa/complex/ConfigItems/helper/UserOptTest.hxx index 8234b0b7edf4..72ff71cafe2d 100644 --- a/svtools/qa/complex/ConfigItems/helper/UserOptTest.hxx +++ b/svtools/qa/complex/ConfigItems/helper/UserOptTest.hxx @@ -37,7 +37,7 @@ #define SVTOOLS_USEROPTTEST_HXX #include -#include +#include namespace css = ::com::sun::star; diff --git a/svtools/source/config/accelcfg.cxx b/svtools/source/config/accelcfg.cxx deleted file mode 100644 index 6daa1a9491a2..000000000000 --- a/svtools/source/config/accelcfg.cxx +++ /dev/null @@ -1,292 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: accelcfg.cxx,v $ - * $Revision: 1.9 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif -#include "rtl/instance.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include "xmlaccelcfg.hxx" -#include -#include "itemholder1.hxx" - - -using namespace utl; -using namespace rtl; -using namespace com::sun::star::uno; -using namespace com::sun::star::io; -using namespace com::sun::star::xml::sax; - - -static SvtAcceleratorConfig_Impl* pOptions = NULL; -static sal_Int32 nRefCount = 0; - -class SvtAcceleratorConfig_Impl -{ -public: - - SvtAcceleratorItemList aList; - bool bModified; - - SvtAcceleratorConfig_Impl() - : bModified( FALSE ) - {} - - SvtAcceleratorConfig_Impl( Reference< XInputStream >& xInputStream ); - bool Commit( Reference< XOutputStream >& xOutputStream ); -}; - -// ----------------------------------------------------------------------- - -SvtAcceleratorConfig_Impl::SvtAcceleratorConfig_Impl( Reference< XInputStream >& rInputStream ) - : bModified( false ) -{ - Reference< XParser > xParser( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Parser" )), - UNO_QUERY); - - // connect stream to input stream to the parser - InputSource aInputSource; - aInputSource.aInputStream = rInputStream; - - // get filter - Reference< XDocumentHandler > xFilter( new OReadAccelatorDocumentHandler( aList )); - - // connect parser and filter - xParser->setDocumentHandler( xFilter ); - xParser->parseStream( aInputSource ); -} - -bool SvtAcceleratorConfig_Impl::Commit( Reference< XOutputStream >& rOutputStream ) -{ - Reference< XDocumentHandler > xWriter; - - xWriter = Reference< XDocumentHandler >( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Writer" )), UNO_QUERY) ; - - Reference< ::com::sun::star::io::XActiveDataSource> xDataSource( xWriter , UNO_QUERY ); - xDataSource->setOutputStream( rOutputStream ); - try - { - OWriteAccelatorDocumentHandler aWriteHandler( aList, xWriter ); - aWriteHandler.WriteAcceleratorDocument(); - rOutputStream->flush(); - return true; - } - catch ( RuntimeException& ) - { - } - catch ( SAXException& ) - { - } - catch ( ::com::sun::star::io::IOException& ) - { - } - - return false; -} - -namespace -{ - class LocalSingleton : public rtl::Static< osl::Mutex, LocalSingleton > - { - }; -} - -SvtAcceleratorConfiguration::SvtAcceleratorConfiguration() -{ - // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( LocalSingleton::get() ); - if ( !pOptions ) - { - SvStream* pStream = GetDefaultStream( STREAM_STD_READ ); - ::utl::OInputStreamWrapper aHelper( *pStream ); - com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream > xOut( &aHelper ); - - try - { - pOptions = new SvtAcceleratorConfig_Impl( xOut ); - } - catch ( RuntimeException& ) - { - pOptions = new SvtAcceleratorConfig_Impl(); - } - catch( SAXException& ) - { - pOptions = new SvtAcceleratorConfig_Impl(); - } - catch( ::com::sun::star::io::IOException& ) - { - pOptions = new SvtAcceleratorConfig_Impl(); - } - - if (pOptions) - ItemHolder1::holdConfigItem(E_ACCELCFG); - - delete pStream; - } - - ++nRefCount; - pImp = pOptions; -} - -SvtAcceleratorConfiguration* SvtAcceleratorConfiguration::CreateFromStream( SvStream& rStream ) -{ - SvtAcceleratorConfiguration* pRet = new SvtAcceleratorConfiguration; - ::utl::OInputStreamWrapper aHelper( rStream ); - com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream > xOut( &aHelper ); - try - { - pRet->pImp = new SvtAcceleratorConfig_Impl( xOut ); - } - catch ( RuntimeException& ) - { - DELETEZ( pRet ); - } - catch( SAXException& ) - { - DELETEZ( pRet ); - } - catch( ::com::sun::star::io::IOException& ) - { - DELETEZ( pRet ); - } - - return pRet; -} - -// ----------------------------------------------------------------------- - -SvtAcceleratorConfiguration::~SvtAcceleratorConfiguration() -{ - if ( pImp == pOptions ) - { - // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( LocalSingleton::get() ); - if ( !--nRefCount ) - { - if ( pImp->bModified ) - { - String aUserConfig = SvtPathOptions().GetUserConfigPath(); - INetURLObject aObj( aUserConfig ); - aObj.insertName( String::CreateFromAscii("GlobalKeyBindings.xml") ); - SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( aObj.GetMainURL( INetURLObject::NO_DECODE ), STREAM_STD_READWRITE|STREAM_TRUNC ); - ::utl::OOutputStreamWrapper aHelper( *pStream ); - com::sun::star::uno::Reference < ::com::sun::star::io::XOutputStream > xOut( &aHelper ); - pImp->Commit( xOut ); - delete pStream; - } - - DELETEZ( pOptions ); - } - } - else - { - delete pImp; - } -} - -::rtl::OUString SvtAcceleratorConfiguration::GetCommand( const ::com::sun::star::awt::KeyEvent& rKeyEvent ) -{ - sal_Int16 nCode=rKeyEvent.KeyCode, nModifier=rKeyEvent.Modifiers; - if ( !nCode ) - nCode = rKeyEvent.KeyFunc; - - std::list< SvtAcceleratorConfigItem>::const_iterator p; - for ( p = pImp->aList.begin(); p != pImp->aList.end(); p++ ) - if ( p->nCode == nCode && p->nModifier == nModifier ) - return p->aCommand; - - return ::rtl::OUString(); -} - -const SvtAcceleratorItemList& SvtAcceleratorConfiguration::GetItems() -{ - return pImp->aList; -} - -void SvtAcceleratorConfiguration::SetCommand( const SvtAcceleratorConfigItem& rItem ) -{ - std::list< SvtAcceleratorConfigItem>::iterator p; - for ( p = pImp->aList.begin(); p != pImp->aList.end(); p++ ) - if ( p->nCode == rItem.nCode && p->nModifier == rItem.nModifier ) - { - p->aCommand = rItem.aCommand; - return; - } - - pImp->aList.push_back( rItem ); - -} - -void SvtAcceleratorConfiguration::SetItems( const SvtAcceleratorItemList& rItems, bool bClear ) -{ - if ( bClear ) - { - pImp->aList = rItems; - } - else - { - std::list< SvtAcceleratorConfigItem>::const_iterator p; - for ( p = rItems.begin(); p != rItems.end(); p++ ) - SetCommand( *p ); - } -} - -String SvtAcceleratorConfiguration::GetStreamName() -{ - return String::CreateFromAscii("KeyBindings.xml"); -} - -SvStream* SvtAcceleratorConfiguration::GetDefaultStream( StreamMode nMode ) -{ - String aUserConfig = SvtPathOptions().GetUserConfigPath(); - INetURLObject aObj( aUserConfig ); - aObj.insertName( GetStreamName() ); - return ::utl::UcbStreamHelper::CreateStream( aObj.GetMainURL( INetURLObject::NO_DECODE ), nMode ); -} diff --git a/svtools/source/config/accessibilityoptions.cxx b/svtools/source/config/accessibilityoptions.cxx index 6f1e3882d705..bbe9c65ede9e 100644 --- a/svtools/source/config/accessibilityoptions.cxx +++ b/svtools/source/config/accessibilityoptions.cxx @@ -57,7 +57,7 @@ #include #endif #ifndef _SVT_LOGHELPER_HXX_ -#include +#include #endif #include diff --git a/svtools/source/config/addxmltostorageoptions.cxx b/svtools/source/config/addxmltostorageoptions.cxx deleted file mode 100644 index 92e2369a2a70..000000000000 --- a/svtools/source/config/addxmltostorageoptions.cxx +++ /dev/null @@ -1,291 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: addxmltostorageoptions.cxx,v $ - * $Revision: 1.9 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include "itemholder1.hxx" - -//_________________________________________________________________________________________________________________ -// namespaces -//_________________________________________________________________________________________________________________ - -using namespace ::utl; -using namespace ::rtl; -using namespace ::osl; -using namespace ::com::sun::star::uno; - -//***************************************************************************************************************** -// initialize static member -// DON'T DO IT IN YOUR HEADER! -// see definition for further informations -//***************************************************************************************************************** -SvtAddXMLToStorageOptions_Impl* SvtAddXMLToStorageOptions::m_pDataContainer = 0; -sal_Int32 SvtAddXMLToStorageOptions::m_nRefCount = 0; - - -//_________________________________________________________________________________________________________________ -// private declarations! -//_________________________________________________________________________________________________________________ - -class SvtAddXMLToStorageOptions_Impl : public ConfigItem -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - SvtAddXMLToStorageOptions_Impl(); - - //--------------------------------------------------------------------------------------------------------- - // overloaded methods of baseclass - //--------------------------------------------------------------------------------------------------------- - - //--------------------------------------------------------------------------------------------------------- - // public interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short access method to get internal values - @descr These method give us a chance to regulate acces to ouer internal values. - It's not used in the moment - but it's possible for the feature! - - @seealso - - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - sal_Bool IsWriter_Add_XML_to_Storage() const { return bAddXmlToStg_Writer; } - sal_Bool IsCalc_Add_XML_to_Storage() const { return bAddXmlToStg_Calc; } - sal_Bool IsImpress_Add_XML_to_Storage() const { return bAddXmlToStg_Impress; } - sal_Bool IsDraw_Add_XML_to_Storage() const { return bAddXmlToStg_Draw; } - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return list of key names of ouer configuration management which represent oue module tree - @descr These methods return a static const list of key names. We need it to get needed values from our - configuration management. - - @seealso - - - @param - - @return A list of needed configuration keys is returned. - - @onerror - - *//*-*****************************************************************************************************/ - - static Sequence< OUString > GetPropertyNames(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - sal_Bool bAddXmlToStg_Writer, - bAddXmlToStg_Calc, - bAddXmlToStg_Impress, - bAddXmlToStg_Draw; -}; - -//_________________________________________________________________________________________________________________ -// definitions -//_________________________________________________________________________________________________________________ - - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtAddXMLToStorageOptions_Impl::SvtAddXMLToStorageOptions_Impl() - // Init baseclasses first - : ConfigItem( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( - "Office.Common/AddXMLToStorage"))), - // Init member then. - bAddXmlToStg_Writer( FALSE ), - bAddXmlToStg_Calc( FALSE ), - bAddXmlToStg_Impress( FALSE ), - bAddXmlToStg_Draw( FALSE ) -{ - // Use our static list of configuration keys to get his values. - Sequence< OUString > seqNames = GetPropertyNames(); - Sequence< Any > seqValues = GetProperties( seqNames ); - - // Copy values from list in right order to ouer internal member. - sal_Int32 nPropertyCount = seqValues.getLength(); - const Any* pValue = seqValues.getConstArray(); - for( sal_Int32 nProperty=0; nPropertyhasValue() ) - - switch( nProperty ) - { - case 0: - *pValue >>= bAddXmlToStg_Writer; - break; - case 1: - *pValue >>= bAddXmlToStg_Calc; - break; - case 2: - *pValue >>= bAddXmlToStg_Impress; - break; - case 3: - *pValue >>= bAddXmlToStg_Draw; - break; - } -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Sequence< OUString > SvtAddXMLToStorageOptions_Impl::GetPropertyNames() -{ - // Build static list of configuration key names. - static const sal_Char* pProperties[] = - { - "Writer", - "Calc", - "Impress", - "Draw" - }; - - const sal_uInt16 nCnt = sizeof(pProperties) / sizeof( pProperties[0] ); - Sequence aNames( nCnt ); - OUString* pNames = aNames.getArray(); - for( sal_uInt16 n = 0; n < nCnt; ++n ) - pNames[ n ] = OUString::createFromAscii( pProperties[ n ] ); - return aNames; -} - - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtAddXMLToStorageOptions::SvtAddXMLToStorageOptions() -{ - // Global access, must be guarded (multithreading!). - MutexGuard aGuard( GetOwnStaticMutex() ); - // Increase ouer refcount ... - ++m_nRefCount; - // ... and initialize ouer data container only if it not already exist! - if( !m_pDataContainer ) - { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtAddXMLToStorageOptions_Impl::ctor()"); - m_pDataContainer = new SvtAddXMLToStorageOptions_Impl; - - ItemHolder1::holdConfigItem(E_ADDXMLTOSTORAGEOPTIONS); - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtAddXMLToStorageOptions::~SvtAddXMLToStorageOptions() -{ - // Global access, must be guarded (multithreading!) - MutexGuard aGuard( GetOwnStaticMutex() ); - // Decrease ouer refcount. - // If last instance was deleted ... - // we must destroy ouer static data container! - if( !--m_nRefCount ) - delete m_pDataContainer, m_pDataContainer = 0; -} - -sal_Bool SvtAddXMLToStorageOptions::IsWriter_Add_XML_to_Storage() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsWriter_Add_XML_to_Storage(); -} -sal_Bool SvtAddXMLToStorageOptions::IsCalc_Add_XML_to_Storage() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsCalc_Add_XML_to_Storage(); -} -sal_Bool SvtAddXMLToStorageOptions::IsImpress_Add_XML_to_Storage() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsImpress_Add_XML_to_Storage(); -} -sal_Bool SvtAddXMLToStorageOptions::IsDraw_Add_XML_to_Storage() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsDraw_Add_XML_to_Storage(); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Mutex& SvtAddXMLToStorageOptions::GetOwnStaticMutex() -{ - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; -} diff --git a/svtools/source/config/cacheoptions.cxx b/svtools/source/config/cacheoptions.cxx deleted file mode 100644 index 39b2b2c74085..000000000000 --- a/svtools/source/config/cacheoptions.cxx +++ /dev/null @@ -1,510 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: cacheoptions.cxx,v $ - * $Revision: 1.8 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include "cacheoptions.hxx" -#include -#include -#include -#include -#include - -//_________________________________________________________________________________________________________________ -// namespaces -//_________________________________________________________________________________________________________________ - -using namespace ::utl; -using namespace ::rtl; -using namespace ::osl; -using namespace ::com::sun::star::uno; - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -#define ROOTNODE_START OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Cache" )) -#define DEFAULT_WRITEROLE 20 -#define DEFAULT_DRAWINGOLE 20 -#define DEFAULT_GRFMGR_TOTALSIZE 10000000 -#define DEFAULT_GRFMGR_OBJECTSIZE 2400000 -#define DEFAULT_GRFMGR_OBJECTRELEASE 600 - -#define PROPERTYNAME_WRITEROLE OUString(RTL_CONSTASCII_USTRINGPARAM("Writer/OLE_Objects")) -#define PROPERTYNAME_DRAWINGOLE OUString(RTL_CONSTASCII_USTRINGPARAM("DrawingEngine/OLE_Objects")) -#define PROPERTYNAME_GRFMGR_TOTALSIZE OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicManager/TotalCacheSize")) -#define PROPERTYNAME_GRFMGR_OBJECTSIZE OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicManager/ObjectCacheSize")) -#define PROPERTYNAME_GRFMGR_OBJECTRELEASE OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicManager/ObjectReleaseTime")) - -#define PROPERTYHANDLE_WRITEROLE 0 -#define PROPERTYHANDLE_DRAWINGOLE 1 -#define PROPERTYHANDLE_GRFMGR_TOTALSIZE 2 -#define PROPERTYHANDLE_GRFMGR_OBJECTSIZE 3 -#define PROPERTYHANDLE_GRFMGR_OBJECTRELEASE 4 - -#define PROPERTYCOUNT 5 - -class SvtCacheOptions_Impl : public ConfigItem -{ -public: - -//--------------------------------------------------------------------------------------------------------- -// constructor / destructor -//--------------------------------------------------------------------------------------------------------- - - SvtCacheOptions_Impl(); - ~SvtCacheOptions_Impl(); - -//--------------------------------------------------------------------------------------------------------- -// overloaded methods of baseclass -//--------------------------------------------------------------------------------------------------------- - - virtual void Commit(); - -//--------------------------------------------------------------------------------------------------------- -// public interface -//--------------------------------------------------------------------------------------------------------- - - sal_Int32 GetWriterOLE_Objects() const; - sal_Int32 GetDrawingEngineOLE_Objects() const; - sal_Int32 GetGraphicManagerTotalCacheSize() const; - sal_Int32 GetGraphicManagerObjectCacheSize() const; - sal_Int32 GetGraphicManagerObjectReleaseTime() const; - - void SetWriterOLE_Objects( sal_Int32 nObjects ); - void SetDrawingEngineOLE_Objects( sal_Int32 nObjects ); - void SetGraphicManagerTotalCacheSize( sal_Int32 nTotalCacheSize ); - void SetGraphicManagerObjectCacheSize( sal_Int32 nObjectCacheSize ); - void SetGraphicManagerObjectReleaseTime( sal_Int32 nReleaseTimeSeconds ); - -//------------------------------------------------------------------------------------------------------------- -// private methods -//------------------------------------------------------------------------------------------------------------- - -private: - - static Sequence< OUString > impl_GetPropertyNames(); - -//------------------------------------------------------------------------------------------------------------- -// private member -//------------------------------------------------------------------------------------------------------------- - -private: - - sal_Int32 mnWriterOLE; - sal_Int32 mnDrawingOLE; - sal_Int32 mnGrfMgrTotalSize; - sal_Int32 mnGrfMgrObjectSize; - sal_Int32 mnGrfMgrObjectRelease; -}; - -//_________________________________________________________________________________________________________________ -// definitions -//_________________________________________________________________________________________________________________ - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtCacheOptions_Impl::SvtCacheOptions_Impl() : - ConfigItem( ROOTNODE_START ), - mnWriterOLE( DEFAULT_WRITEROLE ), - mnDrawingOLE( DEFAULT_DRAWINGOLE ), - mnGrfMgrTotalSize( DEFAULT_GRFMGR_TOTALSIZE ), - mnGrfMgrObjectSize( DEFAULT_GRFMGR_OBJECTSIZE ), - mnGrfMgrObjectRelease( DEFAULT_GRFMGR_OBJECTRELEASE ) -{ - Sequence< OUString > seqNames( impl_GetPropertyNames() ); - Sequence< Any > seqValues = GetProperties( seqNames ) ; - - DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtCacheOptions_Impl::SvtCacheOptions_Impl()\nI miss some values of configuration keys!\n" ); - - // Copy values from list in right order to ouer internal member. - sal_Int32 nPropertyCount = seqValues.getLength(); - sal_Int32 nProperty = 0; - - for( nProperty=0; nProperty>= mnWriterOLE; - } - break; - - case PROPERTYHANDLE_DRAWINGOLE: - { - if( seqValues[ nProperty ].getValueTypeClass() == TypeClass_LONG ) - seqValues[nProperty] >>= mnDrawingOLE; - } - break; - - case PROPERTYHANDLE_GRFMGR_TOTALSIZE: - { - if( seqValues[ nProperty ].getValueTypeClass() == TypeClass_LONG ) - seqValues[nProperty] >>= mnGrfMgrTotalSize; - } - break; - - case PROPERTYHANDLE_GRFMGR_OBJECTSIZE: - { - if( seqValues[ nProperty ].getValueTypeClass() == TypeClass_LONG ) - seqValues[nProperty] >>= mnGrfMgrObjectSize; - } - break; - - case PROPERTYHANDLE_GRFMGR_OBJECTRELEASE: - { - if( seqValues[ nProperty ].getValueTypeClass() == TypeClass_LONG ) - seqValues[nProperty] >>= mnGrfMgrObjectRelease; - } - break; - } - } - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtCacheOptions_Impl::~SvtCacheOptions_Impl() -{ - if( IsModified() ) - Commit(); -} - -//***************************************************************************************************************** -// Commit -//***************************************************************************************************************** -void SvtCacheOptions_Impl::Commit() -{ - Sequence< OUString > aSeqNames( impl_GetPropertyNames() ); - Sequence< Any > aSeqValues( aSeqNames.getLength() ); - - for( sal_Int32 nProperty = 0, nCount = aSeqNames.getLength(); nProperty < nCount; ++nProperty ) - { - switch( nProperty ) - { - case PROPERTYHANDLE_WRITEROLE: - aSeqValues[nProperty] <<= mnWriterOLE; - break; - - case PROPERTYHANDLE_DRAWINGOLE: - aSeqValues[nProperty] <<= mnDrawingOLE; - break; - - case PROPERTYHANDLE_GRFMGR_TOTALSIZE: - aSeqValues[nProperty] <<= mnGrfMgrTotalSize; - break; - - case PROPERTYHANDLE_GRFMGR_OBJECTSIZE: - aSeqValues[nProperty] <<= mnGrfMgrObjectSize; - break; - - case PROPERTYHANDLE_GRFMGR_OBJECTRELEASE: - aSeqValues[nProperty] <<= mnGrfMgrObjectRelease; - break; - } - } - - PutProperties( aSeqNames, aSeqValues ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Int32 SvtCacheOptions_Impl::GetWriterOLE_Objects() const -{ - return mnWriterOLE; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Int32 SvtCacheOptions_Impl::GetDrawingEngineOLE_Objects() const -{ - return mnDrawingOLE; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Int32 SvtCacheOptions_Impl::GetGraphicManagerTotalCacheSize() const -{ - return mnGrfMgrTotalSize; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Int32 SvtCacheOptions_Impl::GetGraphicManagerObjectCacheSize() const -{ - return mnGrfMgrObjectSize; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Int32 SvtCacheOptions_Impl::GetGraphicManagerObjectReleaseTime() const -{ - return mnGrfMgrObjectRelease; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtCacheOptions_Impl::SetWriterOLE_Objects( sal_Int32 nWriterOLE ) -{ - mnWriterOLE = nWriterOLE; - SetModified(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtCacheOptions_Impl::SetDrawingEngineOLE_Objects( sal_Int32 nDrawingOLE ) -{ - mnDrawingOLE = nDrawingOLE; - SetModified(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtCacheOptions_Impl::SetGraphicManagerTotalCacheSize( sal_Int32 nGrfMgrTotalSize ) -{ - mnGrfMgrTotalSize = nGrfMgrTotalSize; - SetModified(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtCacheOptions_Impl::SetGraphicManagerObjectCacheSize( sal_Int32 nGrfMgrObjectSize ) -{ - mnGrfMgrObjectSize = nGrfMgrObjectSize; - SetModified(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtCacheOptions_Impl::SetGraphicManagerObjectReleaseTime( sal_Int32 nGrfMgrObjectReleaseTime ) -{ - mnGrfMgrObjectRelease = nGrfMgrObjectReleaseTime; - SetModified(); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Sequence< OUString > SvtCacheOptions_Impl::impl_GetPropertyNames() -{ - // Build static list of configuration key names. - static const OUString pProperties[] = - { - PROPERTYNAME_WRITEROLE, - PROPERTYNAME_DRAWINGOLE, - PROPERTYNAME_GRFMGR_TOTALSIZE, - PROPERTYNAME_GRFMGR_OBJECTSIZE, - PROPERTYNAME_GRFMGR_OBJECTRELEASE - }; - // Initialize return sequence with these list ... - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); - // ... and return it. - return seqPropertyNames; -} - -//***************************************************************************************************************** -// initialize static member -// DON'T DO IT IN YOUR HEADER! -// see definition for further informations -//***************************************************************************************************************** -SvtCacheOptions_Impl* SvtCacheOptions::m_pDataContainer = NULL; -sal_Int32 SvtCacheOptions::m_nRefCount = 0; - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtCacheOptions::SvtCacheOptions() -{ - // Global access, must be guarded (multithreading!). - MutexGuard aGuard( GetOwnStaticMutex() ); - // Increase ouer refcount ... - ++m_nRefCount; - // ... and initialize ouer data container only if it not already! - if( m_pDataContainer == NULL ) - { - m_pDataContainer = new SvtCacheOptions_Impl(); - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtCacheOptions::~SvtCacheOptions() -{ - // Global access, must be guarded (multithreading!) - MutexGuard aGuard( GetOwnStaticMutex() ); - // Decrease ouer refcount. - --m_nRefCount; - // If last instance was deleted ... - // we must destroy ouer static data container! - if( m_nRefCount <= 0 ) - { - delete m_pDataContainer; - m_pDataContainer = NULL; - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Int32 SvtCacheOptions::GetWriterOLE_Objects() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetWriterOLE_Objects(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Int32 SvtCacheOptions::GetDrawingEngineOLE_Objects() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetDrawingEngineOLE_Objects(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Int32 SvtCacheOptions::GetGraphicManagerTotalCacheSize() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetGraphicManagerTotalCacheSize(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Int32 SvtCacheOptions::GetGraphicManagerObjectCacheSize() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetGraphicManagerObjectCacheSize(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Int32 SvtCacheOptions::GetGraphicManagerObjectReleaseTime() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetGraphicManagerObjectReleaseTime(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtCacheOptions::SetWriterOLE_Objects( sal_Int32 nWriterOLE ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetWriterOLE_Objects( nWriterOLE ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtCacheOptions::SetDrawingEngineOLE_Objects( sal_Int32 nDrawingOLE ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetDrawingEngineOLE_Objects( nDrawingOLE ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtCacheOptions::SetGraphicManagerTotalCacheSize( sal_Int32 nGrfMgrTotalSize ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetGraphicManagerTotalCacheSize( nGrfMgrTotalSize ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtCacheOptions::SetGraphicManagerObjectCacheSize( sal_Int32 nGrfMgrObjectSize ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetGraphicManagerObjectCacheSize( nGrfMgrObjectSize ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtCacheOptions::SetGraphicManagerObjectReleaseTime( sal_Int32 nGrfMgrObjectReleaseTime ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetGraphicManagerObjectReleaseTime( nGrfMgrObjectReleaseTime ); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Mutex& SvtCacheOptions::GetOwnStaticMutex() -{ - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; -} diff --git a/svtools/source/config/cmdoptions.cxx b/svtools/source/config/cmdoptions.cxx deleted file mode 100644 index 356b6782b892..000000000000 --- a/svtools/source/config/cmdoptions.cxx +++ /dev/null @@ -1,631 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: cmdoptions.cxx,v $ - * $Revision: 1.11 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -//_________________________________________________________________________________________________________________ -// namespaces -//_________________________________________________________________________________________________________________ - -using namespace ::std ; -using namespace ::utl ; -using namespace ::rtl ; -using namespace ::osl ; -using namespace ::com::sun::star::uno ; -using namespace ::com::sun::star::beans ; - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -#define ROOTNODE_CMDOPTIONS OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Commands/Execute" )) -#define PATHDELIMITER OUString(RTL_CONSTASCII_USTRINGPARAM("/" )) - -#define SETNODE_DISABLED OUString(RTL_CONSTASCII_USTRINGPARAM("Disabled" )) - -#define PROPERTYNAME_CMD OUString(RTL_CONSTASCII_USTRINGPARAM("Command" )) - -#define PROPERTYCOUNT 1 - -#define OFFSET_CMD 0 - -//_________________________________________________________________________________________________________________ -// private declarations! -//_________________________________________________________________________________________________________________ - -// Method to retrieve a hash code from a string. May be we have to change it to decrease collisions in the hash map -struct OUStringHashCode -{ - size_t operator()( const ::rtl::OUString& sString ) const - { - return sString.hashCode(); - } -}; - -/*-**************************************************************************************************************** - @descr support simple command option structures and operations on it -****************************************************************************************************************-*/ -class SvtCmdOptions -{ - public: - //--------------------------------------------------------------------------------------------------------- - // the only way to free memory! - void Clear() - { - m_aCommandHashMap.clear(); - } - - sal_Bool HasEntries() const - { - return ( m_aCommandHashMap.size() > 0 ); - } - - void SetContainerSize( sal_Int32 nSize ) - { - m_aCommandHashMap.resize( nSize ); - } - - sal_Bool Lookup( const OUString& aCmd ) const - { - CommandHashMap::const_iterator pEntry = m_aCommandHashMap.find( aCmd ); - return ( pEntry != m_aCommandHashMap.end() ); - } - - void AddCommand( const OUString& aCmd ) - { - m_aCommandHashMap.insert( CommandHashMap::value_type( aCmd, 0 ) ); - } - - //--------------------------------------------------------------------------------------------------------- - // convert internal list to external format - // for using it on right menus realy - // Notice: We build a property list with 4 entries and set it on result list then. - // The while-loop starts with pointer on internal member list lSetupEntries, change to - // lUserEntries then and stop after that with NULL! - // Separator entries will be packed in another way then normal entries! We define - // special strings "sEmpty" and "sSeperator" to perform too ... - Sequence< OUString > GetList() const - { - sal_Int32 nCount = (sal_Int32)m_aCommandHashMap.size(); - sal_Int32 nIndex = 0; - Sequence< OUString > aList( nCount ); - - CommandHashMap::const_iterator pEntry = m_aCommandHashMap.begin(); - while ( pEntry != m_aCommandHashMap.end() ) - aList[nIndex++] = pEntry->first; - - return aList; - } - - private: - class CommandHashMap : public ::std::hash_map< ::rtl::OUString , - sal_Int32 , - OUStringHashCode , - ::std::equal_to< ::rtl::OUString > > - { - public: - inline void free() - { - CommandHashMap().swap( *this ); - } - }; - - CommandHashMap m_aCommandHashMap; -}; - -typedef ::std::vector< ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XFrame > > SvtFrameVector; - -class SvtCommandOptions_Impl : public ConfigItem -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - SvtCommandOptions_Impl(); - ~SvtCommandOptions_Impl(); - - //--------------------------------------------------------------------------------------------------------- - // overloaded methods of baseclass - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short called for notify of configmanager - @descr These method is called from the ConfigManager before application ends or from the - PropertyChangeListener if the sub tree broadcasts changes. You must update your - internal values. - - @seealso baseclass ConfigItem - - @param "lPropertyNames" is the list of properties which should be updated. - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Notify( const Sequence< OUString >& lPropertyNames ); - - /*-****************************************************************************************************//** - @short write changes to configuration - @descr These method writes the changed values into the sub tree - and should always called in our destructor to guarantee consistency of config data. - - @seealso baseclass ConfigItem - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Commit(); - - //--------------------------------------------------------------------------------------------------------- - // public interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short base implementation of public interface for "SvtDynamicMenuOptions"! - @descr These class is used as static member of "SvtDynamicMenuOptions" ... - => The code exist only for one time and isn't duplicated for every instance! - - @seealso - - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - void Clear ( SvtCommandOptions::CmdOption eCmdOption ); - sal_Bool HasEntries ( SvtCommandOptions::CmdOption eOption ) const; - sal_Bool Lookup ( SvtCommandOptions::CmdOption eCmdOption, const OUString& ) const; - Sequence< OUString > GetList ( SvtCommandOptions::CmdOption eCmdOption ) const ; - void AddCommand ( SvtCommandOptions::CmdOption eCmdOption, - const OUString& sURL ); - void EstablisFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame); - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return list of key names of our configuration management which represent oue module tree - @descr These methods return the current list of key names! We need it to get needed values from our - configuration management and support dynamical menu item lists! - - @seealso - - - @param "nDisabledCount" , returns count of menu entries for "new" - @return A list of configuration key names is returned. - - @onerror - - *//*-*****************************************************************************************************/ - - Sequence< OUString > impl_GetPropertyNames(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - SvtCmdOptions m_aDisabledCommands; - SvtFrameVector m_lFrames; -}; - -//_________________________________________________________________________________________________________________ -// definitions -//_________________________________________________________________________________________________________________ - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtCommandOptions_Impl::SvtCommandOptions_Impl() - // Init baseclasses first - : ConfigItem( ROOTNODE_CMDOPTIONS ) - // Init member then... -{ - // Get names and values of all accessable menu entries and fill internal structures. - // See impl_GetPropertyNames() for further informations. - Sequence< OUString > lNames = impl_GetPropertyNames (); - Sequence< Any > lValues = GetProperties ( lNames ); - - // Safe impossible cases. - // We need values from ALL configuration keys. - // Follow assignment use order of values in relation to our list of key names! - DBG_ASSERT( !(lNames.getLength()!=lValues.getLength()), "SvtCommandOptions_Impl::SvtCommandOptions_Impl()\nI miss some values of configuration keys!\n" ); - - // Copy values from list in right order to ouer internal member. - // Attention: List for names and values have an internal construction pattern! - sal_Int32 nItem = 0 ; - OUString sCmd ; - - // Set size of hash_map reach a used size of approx. 60% - m_aDisabledCommands.SetContainerSize( lNames.getLength() * 10 / 6 ); - - // Get names/values for disabled commands. - for( nItem=0; nItem < lNames.getLength(); ++nItem ) - { - // Currently only one value - lValues[nItem] >>= sCmd; - m_aDisabledCommands.AddCommand( sCmd ); - } - -/*TODO: Not used in the moment! see Notify() ... - // Enable notification mechanism of ouer baseclass. - // We need it to get information about changes outside these class on ouer used configuration keys! */ - Sequence< OUString > aNotifySeq( 1 ); - aNotifySeq[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "Disabled" )); - EnableNotification( aNotifySeq, sal_True ); -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtCommandOptions_Impl::~SvtCommandOptions_Impl() -{ - // We must save our current values .. if user forget it! - if( IsModified() == sal_True ) - { - Commit(); - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtCommandOptions_Impl::Notify( const Sequence< OUString >& ) -{ - MutexGuard aGuard( SvtCommandOptions::GetOwnStaticMutex() ); - - Sequence< OUString > lNames = impl_GetPropertyNames (); - Sequence< Any > lValues = GetProperties ( lNames ); - - // Safe impossible cases. - // We need values from ALL configuration keys. - // Follow assignment use order of values in relation to our list of key names! - DBG_ASSERT( !(lNames.getLength()!=lValues.getLength()), "SvtCommandOptions_Impl::SvtCommandOptions_Impl()\nI miss some values of configuration keys!\n" ); - - // Copy values from list in right order to ouer internal member. - // Attention: List for names and values have an internal construction pattern! - sal_Int32 nItem = 0 ; - OUString sCmd ; - - // Set size of hash_map reach a used size of approx. 60% - m_aDisabledCommands.Clear(); - m_aDisabledCommands.SetContainerSize( lNames.getLength() * 10 / 6 ); - - // Get names/values for disabled commands. - for( nItem=0; nItem < lNames.getLength(); ++nItem ) - { - // Currently only one value - lValues[nItem] >>= sCmd; - m_aDisabledCommands.AddCommand( sCmd ); - } - - // dont forget to update all existing frames and her might cached dispatch objects! - // But look for already killed frames. We hold weak references instead of hard ones ... - for (SvtFrameVector::const_iterator pIt = m_lFrames.begin(); - pIt != m_lFrames.end() ; - ++pIt ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame(pIt->get(), ::com::sun::star::uno::UNO_QUERY); - if (xFrame.is()) - xFrame->contextChanged(); - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtCommandOptions_Impl::Commit() -{ - DBG_ERROR( "SvtCommandOptions_Impl::Commit()\nNot implemented yet!\n" ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtCommandOptions_Impl::Clear( SvtCommandOptions::CmdOption eCmdOption ) -{ - switch( eCmdOption ) - { - case SvtCommandOptions::CMDOPTION_DISABLED: - { - m_aDisabledCommands.Clear(); - SetModified(); - } - break; - - default: - DBG_ASSERT( sal_False, "SvtCommandOptions_Impl::Clear()\nUnknown option type given!\n" ); - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtCommandOptions_Impl::HasEntries( SvtCommandOptions::CmdOption eOption ) const -{ - if ( eOption == SvtCommandOptions::CMDOPTION_DISABLED ) - return ( m_aDisabledCommands.HasEntries() > 0 ); - else - return sal_False; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -Sequence< OUString > SvtCommandOptions_Impl::GetList( SvtCommandOptions::CmdOption eCmdOption ) const -{ - Sequence< OUString > lReturn; - - switch( eCmdOption ) - { - case SvtCommandOptions::CMDOPTION_DISABLED: - { - lReturn = m_aDisabledCommands.GetList(); - } - break; - - default: - DBG_ASSERT( sal_False, "SvtCommandOptions_Impl::GetList()\nUnknown option type given!\n" ); - } - - return lReturn; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtCommandOptions_Impl::Lookup( SvtCommandOptions::CmdOption eCmdOption, const OUString& aCommand ) const -{ - switch( eCmdOption ) - { - case SvtCommandOptions::CMDOPTION_DISABLED: - { - return m_aDisabledCommands.Lookup( aCommand ); - } - default: - DBG_ASSERT( sal_False, "SvtCommandOptions_Impl::GetList()\nUnknown option type given!\n" ); - } - - return sal_False; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtCommandOptions_Impl::AddCommand( SvtCommandOptions::CmdOption eCmdOption, const OUString& sCmd ) -{ - switch( eCmdOption ) - { - case SvtCommandOptions::CMDOPTION_DISABLED: - { - m_aDisabledCommands.AddCommand( sCmd ); - SetModified(); - } - break; - - default: - DBG_ASSERT( sal_False, "SvtCommandOptions_Impl::GetList()\nUnknown option type given!\n" ); - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtCommandOptions_Impl::EstablisFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame) -{ - // check if frame already exists inside list - // ignore double registrations - // every frame must be notified one times only! - ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XFrame > xWeak(xFrame); - SvtFrameVector::const_iterator pIt = ::std::find(m_lFrames.begin(), m_lFrames.end(), xWeak); - if (pIt == m_lFrames.end()) - m_lFrames.push_back(xWeak); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Sequence< OUString > SvtCommandOptions_Impl::impl_GetPropertyNames() -{ - // First get ALL names of current existing list items in configuration! - Sequence< OUString > lDisabledItems = GetNodeNames( SETNODE_DISABLED, utl::CONFIG_NAME_LOCAL_PATH ); - - OUString aSetNode( SETNODE_DISABLED ); - aSetNode += PATHDELIMITER; - - OUString aCommandKey( PATHDELIMITER ); - aCommandKey += PROPERTYNAME_CMD; - - // Expand all keys - for (sal_Int32 i=0; iClear( eCmdOption ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtCommandOptions::HasEntries( CmdOption eOption ) const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->HasEntries( eOption ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtCommandOptions::Lookup( CmdOption eCmdOption, const OUString& aCommandURL ) const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->Lookup( eCmdOption, aCommandURL ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -Sequence< OUString > SvtCommandOptions::GetList( CmdOption eCmdOption ) const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetList( eCmdOption ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtCommandOptions::AddCommand( CmdOption eCmdOption, const OUString& sURL ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->AddCommand( eCmdOption, sURL ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtCommandOptions::EstablisFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->EstablisFrameCallback(xFrame); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Mutex& SvtCommandOptions::GetOwnStaticMutex() -{ - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; -} diff --git a/svtools/source/config/compatibility.cxx b/svtools/source/config/compatibility.cxx deleted file mode 100644 index a55aff0c90f8..000000000000 --- a/svtools/source/config/compatibility.cxx +++ /dev/null @@ -1,807 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: compatibility.cxx,v $ - * $Revision: 1.16 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include -#include -#include -#include -#include -#include - -#ifndef __SGI_STL_VECTOR -#include -#endif - -#include - -#include - -//_________________________________________________________________________________________________________________ -// namespaces -//_________________________________________________________________________________________________________________ - -using namespace ::std; -using namespace ::utl; -using namespace ::rtl; -using namespace ::osl; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -#define ROOTNODE_OPTIONS OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.Compatibility/" ) ) -#define PATHDELIMITER OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) ) -#define SETNODE_ALLFILEFORMATS OUString( RTL_CONSTASCII_USTRINGPARAM( "AllFileFormats" ) ) - -#define PROPERTYNAME_NAME COMPATIBILITY_PROPERTYNAME_NAME -#define PROPERTYNAME_MODULE COMPATIBILITY_PROPERTYNAME_MODULE -#define PROPERTYNAME_USEPRTMETRICS COMPATIBILITY_PROPERTYNAME_USEPRTMETRICS -#define PROPERTYNAME_ADDSPACING COMPATIBILITY_PROPERTYNAME_ADDSPACING -#define PROPERTYNAME_ADDSPACINGATPAGES COMPATIBILITY_PROPERTYNAME_ADDSPACINGATPAGES -#define PROPERTYNAME_USEOURTABSTOPS COMPATIBILITY_PROPERTYNAME_USEOURTABSTOPS -#define PROPERTYNAME_NOEXTLEADING COMPATIBILITY_PROPERTYNAME_NOEXTLEADING -#define PROPERTYNAME_USELINESPACING COMPATIBILITY_PROPERTYNAME_USELINESPACING -#define PROPERTYNAME_ADDTABLESPACING COMPATIBILITY_PROPERTYNAME_ADDTABLESPACING -#define PROPERTYNAME_USEOBJPOS COMPATIBILITY_PROPERTYNAME_USEOBJECTPOSITIONING -#define PROPERTYNAME_USEOURTEXTWRAP COMPATIBILITY_PROPERTYNAME_USEOURTEXTWRAPPING -#define PROPERTYNAME_CONSIDERWRAPSTYLE COMPATIBILITY_PROPERTYNAME_CONSIDERWRAPPINGSTYLE -#define PROPERTYNAME_EXPANDWORDSPACE COMPATIBILITY_PROPERTYNAME_EXPANDWORDSPACE - -#define PROPERTYCOUNT 13 - -#define OFFSET_NAME 0 -#define OFFSET_MODULE 1 -#define OFFSET_USEPRTMETRICS 2 -#define OFFSET_ADDSPACING 3 -#define OFFSET_ADDSPACINGATPAGES 4 -#define OFFSET_USEOURTABSTOPS 5 -#define OFFSET_NOEXTLEADING 6 -#define OFFSET_USELINESPACING 7 -#define OFFSET_ADDTABLESPACING 8 -#define OFFSET_USEOBJPOS 9 -#define OFFSET_USEOURTEXTWRAPPING 10 -#define OFFSET_CONSIDERWRAPPINGSTYLE 11 -#define OFFSET_EXPANDWORDSPACE 12 - -//_________________________________________________________________________________________________________________ -// private declarations! -//_________________________________________________________________________________________________________________ - -/*-**************************************************************************************************************** - @descr struct to hold information about one compatibility entry -****************************************************************************************************************-*/ -struct SvtCompatibilityEntry -{ - public: - SvtCompatibilityEntry() : - bUsePrtMetrics( false ), bAddSpacing( false ), - bAddSpacingAtPages( false ), bUseOurTabStops( false ), - bNoExtLeading( false ), bUseLineSpacing( false ), - bAddTableSpacing( false ), bUseObjPos( false ), - bUseOurTextWrapping( false ), bConsiderWrappingStyle( false ), - bExpandWordSpace( true ) {} - SvtCompatibilityEntry( - const OUString& _rName, const OUString& _rNewModule ) : - sName( _rName ), sModule( _rNewModule ), - bUsePrtMetrics( false ), bAddSpacing( false ), - bAddSpacingAtPages( false ), bUseOurTabStops( false ), - bNoExtLeading( false ), bUseLineSpacing( false ), - bAddTableSpacing( false ), bUseObjPos( false ), - bUseOurTextWrapping( false ), bConsiderWrappingStyle( false ), - bExpandWordSpace( true ) {} - - inline void SetUsePrtMetrics( bool _bSet ) { bUsePrtMetrics = _bSet; } - inline void SetAddSpacing( bool _bSet ) { bAddSpacing = _bSet; } - inline void SetAddSpacingAtPages( bool _bSet ) { bAddSpacingAtPages = _bSet; } - inline void SetUseOurTabStops( bool _bSet ) { bUseOurTabStops = _bSet; } - inline void SetNoExtLeading( bool _bSet ) { bNoExtLeading = _bSet; } - inline void SetUseLineSpacing( bool _bSet ) { bUseLineSpacing = _bSet; } - inline void SetAddTableSpacing( bool _bSet ) { bAddTableSpacing = _bSet; } - inline void SetUseObjPos( bool _bSet ) { bUseObjPos = _bSet; } - inline void SetUseOurTextWrapping( bool _bSet ) { bUseOurTextWrapping = _bSet; } - inline void SetConsiderWrappingStyle( bool _bSet ) { bConsiderWrappingStyle = _bSet; } - inline void SetExpandWordSpace( bool _bSet ) { bExpandWordSpace = _bSet; } - - public: - OUString sName; - OUString sModule; - bool bUsePrtMetrics; - bool bAddSpacing; - bool bAddSpacingAtPages; - bool bUseOurTabStops; - bool bNoExtLeading; - bool bUseLineSpacing; - bool bAddTableSpacing; - bool bUseObjPos; - bool bUseOurTextWrapping; - bool bConsiderWrappingStyle; - bool bExpandWordSpace; -}; - -/*-**************************************************************************************************************** - @descr support simple menu structures and operations on it -****************************************************************************************************************-*/ -class SvtCompatibility -{ - public: - //--------------------------------------------------------------------------------------------------------- - // append one entry - void AppendEntry( const SvtCompatibilityEntry& rEntry ) - { - lEntries.push_back( rEntry ); - } - - //--------------------------------------------------------------------------------------------------------- - // the only way to free memory! - void Clear() - { - lEntries.clear(); - } - - //--------------------------------------------------------------------------------------------------------- - // convert internal list to external format - Sequence< Sequence< PropertyValue > > GetList() const - { - sal_Int32 nCount = (sal_Int32)lEntries.size(); - sal_Int32 nStep = 0; - Sequence< PropertyValue > lProperties( PROPERTYCOUNT ); - Sequence< Sequence< PropertyValue > > lResult( nCount ); - const vector< SvtCompatibilityEntry >* pList = &lEntries; - - lProperties[ OFFSET_NAME ].Name = PROPERTYNAME_NAME; - lProperties[ OFFSET_MODULE ].Name = PROPERTYNAME_MODULE; - lProperties[ OFFSET_USEPRTMETRICS ].Name = PROPERTYNAME_USEPRTMETRICS; - lProperties[ OFFSET_ADDSPACING ].Name = PROPERTYNAME_ADDSPACING; - lProperties[ OFFSET_ADDSPACINGATPAGES ].Name = PROPERTYNAME_ADDSPACINGATPAGES; - lProperties[ OFFSET_USEOURTABSTOPS ].Name = PROPERTYNAME_USEOURTABSTOPS; - lProperties[ OFFSET_NOEXTLEADING ].Name = PROPERTYNAME_NOEXTLEADING; - lProperties[ OFFSET_USELINESPACING ].Name = PROPERTYNAME_USELINESPACING; - lProperties[ OFFSET_ADDTABLESPACING ].Name = PROPERTYNAME_ADDTABLESPACING; - lProperties[ OFFSET_USEOBJPOS ].Name = PROPERTYNAME_USEOBJPOS; - lProperties[ OFFSET_USEOURTEXTWRAPPING ].Name = PROPERTYNAME_USEOURTEXTWRAP; - lProperties[ OFFSET_CONSIDERWRAPPINGSTYLE ].Name = PROPERTYNAME_CONSIDERWRAPSTYLE; - lProperties[ OFFSET_EXPANDWORDSPACE ].Name = PROPERTYNAME_EXPANDWORDSPACE; - - for ( vector< SvtCompatibilityEntry >::const_iterator pItem = pList->begin(); - pItem != pList->end(); ++pItem ) - { - lProperties[ OFFSET_NAME ].Value <<= pItem->sName; - lProperties[ OFFSET_MODULE ].Value <<= pItem->sModule; - lProperties[ OFFSET_USEPRTMETRICS ].Value <<= pItem->bUsePrtMetrics; - lProperties[ OFFSET_ADDSPACING ].Value <<= pItem->bAddSpacing; - lProperties[ OFFSET_ADDSPACINGATPAGES ].Value <<= pItem->bAddSpacingAtPages; - lProperties[ OFFSET_USEOURTABSTOPS ].Value <<= pItem->bUseOurTabStops; - lProperties[ OFFSET_NOEXTLEADING ].Value <<= pItem->bNoExtLeading; - lProperties[ OFFSET_USELINESPACING ].Value <<= pItem->bUseLineSpacing; - lProperties[ OFFSET_ADDTABLESPACING ].Value <<= pItem->bAddTableSpacing; - lProperties[ OFFSET_USEOBJPOS ].Value <<= pItem->bUseObjPos; - lProperties[ OFFSET_USEOURTEXTWRAPPING ].Value <<= pItem->bUseOurTextWrapping; - lProperties[ OFFSET_CONSIDERWRAPPINGSTYLE ].Value <<= pItem->bConsiderWrappingStyle; - lProperties[ OFFSET_EXPANDWORDSPACE ].Value <<= pItem->bExpandWordSpace; - lResult[ nStep ] = lProperties; - ++nStep; - } - - return lResult; - } - - int size() const - { - return lEntries.size(); - } - - const SvtCompatibilityEntry& operator[]( int i ) - { - return lEntries[i]; - } - - private: - vector< SvtCompatibilityEntry > lEntries; -}; - -class SvtCompatibilityOptions_Impl : public ConfigItem -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - SvtCompatibilityOptions_Impl(); - ~SvtCompatibilityOptions_Impl(); - - //--------------------------------------------------------------------------------------------------------- - // overloaded methods of baseclass - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short called for notify of configmanager - @descr These method is called from the ConfigManager before application ends or from the - PropertyChangeListener if the sub tree broadcasts changes. You must update your - internal values. - - @seealso baseclass ConfigItem - - @param "lPropertyNames" is the list of properties which should be updated. - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Notify( const Sequence< OUString >& lPropertyNames ); - - /*-****************************************************************************************************//** - @short write changes to configuration - @descr These method writes the changed values into the sub tree - and should always called in our destructor to guarantee consistency of config data. - - @seealso baseclass ConfigItem - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Commit(); - - //--------------------------------------------------------------------------------------------------------- - // public interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short base implementation of public interface for "SvtCompatibilityOptions"! - @descr These class is used as static member of "SvtCompatibilityOptions" ... - => The code exist only for one time and isn't duplicated for every instance! - - @seealso - - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - void Clear(); - Sequence< Sequence< PropertyValue > > GetList() const; - void AppendItem( const ::rtl::OUString& _sName, - const ::rtl::OUString& _sModule, - bool _bUsePrtMetrics, - bool _bAddSpacing, - bool _bAddSpacingAtPages, - bool _bUseOurTabStops, - bool _bNoExtLeading, - bool _bUseLineSpacing, - bool _bAddTableSpacing, - bool _bUseObjPos, - bool _bUseOurTextWrapping, - bool _bConsiderWrappingStyle, - bool _bExpandWordSpace ); - - inline bool IsUsePrtDevice() const { return m_aDefOptions.bUsePrtMetrics; } - inline bool IsAddSpacing() const { return m_aDefOptions.bAddSpacing; } - inline bool IsAddSpacingAtPages() const { return m_aDefOptions.bAddSpacingAtPages; } - inline bool IsUseOurTabStops() const { return m_aDefOptions.bUseOurTabStops; } - inline bool IsNoExtLeading() const { return m_aDefOptions.bNoExtLeading; } - inline bool IsUseLineSpacing() const { return m_aDefOptions.bUseLineSpacing; } - inline bool IsAddTableSpacing() const { return m_aDefOptions.bAddTableSpacing; } - inline bool IsUseObjPos() const { return m_aDefOptions.bUseObjPos; } - inline bool IsUseOurTextWrapping() const { return m_aDefOptions.bUseOurTextWrapping; } - inline bool IsConsiderWrappingStyle() const { return m_aDefOptions.bConsiderWrappingStyle; } - inline bool IsExpandWordSpace() const { return m_aDefOptions.bExpandWordSpace; } - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return list of key names of our configuration management which represent one module tree - @descr These methods return the current list of key names! We need it to get needed values from our - configuration management and support dynamical menu item lists! - - @seealso - - - @param - - @return A list of configuration key names is returned. - - @onerror - - *//*-*****************************************************************************************************/ - - Sequence< OUString > impl_GetPropertyNames( Sequence< OUString >& rItems ); - - /*-****************************************************************************************************//** - @short expand the list for all well known properties to destination - @descr - - @attention - - - @seealso method impl_GetPropertyNames() - - @param "lSource" , original list - @param "lDestination" , destination of operation - @return A list of configuration key names is returned. - - @onerror - - *//*-*****************************************************************************************************/ - - void impl_ExpandPropertyNames( const Sequence< OUString >& lSource, - Sequence< OUString >& lDestination ); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - SvtCompatibility m_aOptions; - SvtCompatibilityEntry m_aDefOptions; -}; - -//_________________________________________________________________________________________________________________ -// definitions -//_________________________________________________________________________________________________________________ - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtCompatibilityOptions_Impl::SvtCompatibilityOptions_Impl() - // Init baseclasses first - : ConfigItem( ROOTNODE_OPTIONS ) - // Init member then... -{ - // Get names and values of all accessable menu entries and fill internal structures. - // See impl_GetPropertyNames() for further informations. - Sequence< OUString > lNodes; - Sequence< OUString > lNames = impl_GetPropertyNames( lNodes ); - sal_uInt32 nCount = lNodes.getLength(); - Sequence< Any > lValues = GetProperties( lNames ); - - // Safe impossible cases. - // We need values from ALL configuration keys. - // Follow assignment use order of values in relation to our list of key names! - DBG_ASSERT( !( lNames.getLength()!=lValues.getLength() ), "SvtCompatibilityOptions_Impl::SvtCompatibilityOptions_Impl()\nI miss some values of configuration keys!\n" ); - - SvtCompatibilityEntry aItem; - sal_uInt32 nItem = 0; - sal_uInt32 nPosition = 0; - - // Get names/values for new menu. - // 4 subkeys for every item! - bool bDefaultFound = false; - for( nItem = 0; nItem < nCount; ++nItem ) - { - aItem.sName = lNodes[ nItem ]; - lValues[ nPosition++ ] >>= aItem.sModule; - lValues[ nPosition++ ] >>= aItem.bUsePrtMetrics; - lValues[ nPosition++ ] >>= aItem.bAddSpacing; - lValues[ nPosition++ ] >>= aItem.bAddSpacingAtPages; - lValues[ nPosition++ ] >>= aItem.bUseOurTabStops; - lValues[ nPosition++ ] >>= aItem.bNoExtLeading; - lValues[ nPosition++ ] >>= aItem.bUseLineSpacing; - lValues[ nPosition++ ] >>= aItem.bAddTableSpacing; - lValues[ nPosition++ ] >>= aItem.bUseObjPos; - lValues[ nPosition++ ] >>= aItem.bUseOurTextWrapping; - lValues[ nPosition++ ] >>= aItem.bConsiderWrappingStyle; - lValues[ nPosition++ ] >>= aItem.bExpandWordSpace; - m_aOptions.AppendEntry( aItem ); - - if ( !bDefaultFound && aItem.sName.equals( COMPATIBILITY_DEFAULT_NAME ) != sal_False ) - { - m_aDefOptions = aItem; - bDefaultFound = true; - } - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtCompatibilityOptions_Impl::~SvtCompatibilityOptions_Impl() -{ - // We must save our current values .. if user forget it! - if( IsModified() == sal_True ) - { - Commit(); - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtCompatibilityOptions_Impl::Notify( const Sequence< OUString >& ) -{ - DBG_ASSERT( sal_False, "SvtCompatibilityOptions_Impl::Notify()\nNot implemented yet! I don't know how I can handle a dynamical list of unknown properties ...\n" ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtCompatibilityOptions_Impl::Commit() -{ - // Write all properties! - // Delete complete set first. - ClearNodeSet( SETNODE_ALLFILEFORMATS ); - - SvtCompatibilityEntry aItem; - OUString sNode; - Sequence< PropertyValue > lPropertyValues( PROPERTYCOUNT - 1 ); - sal_uInt32 nItem = 0; - sal_uInt32 nNewCount = m_aOptions.size(); - for( nItem = 0; nItem < nNewCount; ++nItem ) - { - aItem = m_aOptions[ nItem ]; - sNode = SETNODE_ALLFILEFORMATS + PATHDELIMITER + aItem.sName + PATHDELIMITER; - - lPropertyValues[ OFFSET_MODULE - 1 ].Name = sNode + PROPERTYNAME_MODULE; - lPropertyValues[ OFFSET_USEPRTMETRICS - 1 ].Name = sNode + PROPERTYNAME_USEPRTMETRICS; - lPropertyValues[ OFFSET_ADDSPACING - 1 ].Name = sNode + PROPERTYNAME_ADDSPACING; - lPropertyValues[ OFFSET_ADDSPACINGATPAGES - 1 ].Name = sNode + PROPERTYNAME_ADDSPACINGATPAGES; - lPropertyValues[ OFFSET_USEOURTABSTOPS - 1 ].Name = sNode + PROPERTYNAME_USEOURTABSTOPS; - lPropertyValues[ OFFSET_NOEXTLEADING - 1 ].Name = sNode + PROPERTYNAME_NOEXTLEADING; - lPropertyValues[ OFFSET_USELINESPACING - 1 ].Name = sNode + PROPERTYNAME_USELINESPACING; - lPropertyValues[ OFFSET_ADDTABLESPACING - 1 ].Name = sNode + PROPERTYNAME_ADDTABLESPACING; - lPropertyValues[ OFFSET_USEOBJPOS - 1 ].Name = sNode + PROPERTYNAME_USEOBJPOS; - lPropertyValues[ OFFSET_USEOURTEXTWRAPPING - 1 ].Name = sNode + PROPERTYNAME_USEOURTEXTWRAP; - lPropertyValues[ OFFSET_CONSIDERWRAPPINGSTYLE - 1 ].Name = sNode + PROPERTYNAME_CONSIDERWRAPSTYLE; - lPropertyValues[ OFFSET_EXPANDWORDSPACE - 1 ].Name = sNode + PROPERTYNAME_EXPANDWORDSPACE; - - lPropertyValues[ OFFSET_MODULE - 1 ].Value <<= aItem.sModule; - lPropertyValues[ OFFSET_USEPRTMETRICS - 1 ].Value <<= aItem.bUsePrtMetrics; - lPropertyValues[ OFFSET_ADDSPACING - 1 ].Value <<= aItem.bAddSpacing; - lPropertyValues[ OFFSET_ADDSPACINGATPAGES - 1 ].Value <<= aItem.bAddSpacingAtPages; - lPropertyValues[ OFFSET_USEOURTABSTOPS - 1 ].Value <<= aItem.bUseOurTabStops; - lPropertyValues[ OFFSET_NOEXTLEADING - 1 ].Value <<= aItem.bNoExtLeading; - lPropertyValues[ OFFSET_USELINESPACING - 1 ].Value <<= aItem.bUseLineSpacing; - lPropertyValues[ OFFSET_ADDTABLESPACING - 1 ].Value <<= aItem.bAddTableSpacing; - lPropertyValues[ OFFSET_USEOBJPOS - 1 ].Value <<= aItem.bUseObjPos; - lPropertyValues[ OFFSET_USEOURTEXTWRAPPING - 1 ].Value <<= aItem.bUseOurTextWrapping; - lPropertyValues[ OFFSET_CONSIDERWRAPPINGSTYLE - 1 ].Value <<= aItem.bConsiderWrappingStyle; - lPropertyValues[ OFFSET_EXPANDWORDSPACE - 1 ].Value <<= aItem.bExpandWordSpace; - - SetSetProperties( SETNODE_ALLFILEFORMATS, lPropertyValues ); - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtCompatibilityOptions_Impl::Clear() -{ - m_aOptions.Clear(); - SetModified(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -Sequence< Sequence< PropertyValue > > SvtCompatibilityOptions_Impl::GetList() const -{ - Sequence< Sequence< PropertyValue > > lReturn; - lReturn = m_aOptions.GetList(); - return lReturn; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** - -void SvtCompatibilityOptions_Impl::AppendItem( const ::rtl::OUString& _sName, - const ::rtl::OUString& _sModule, - bool _bUsePrtMetrics, - bool _bAddSpacing, - bool _bAddSpacingAtPages, - bool _bUseOurTabStops, - bool _bNoExtLeading, - bool _bUseLineSpacing, - bool _bAddTableSpacing, - bool _bUseObjPos, - bool _bUseOurTextWrapping, - bool _bConsiderWrappingStyle, - bool _bExpandWordSpace ) -{ - SvtCompatibilityEntry aItem( _sName, _sModule ); - aItem.SetUsePrtMetrics( _bUsePrtMetrics ); - aItem.SetAddSpacing( _bAddSpacing ); - aItem.SetAddSpacingAtPages( _bAddSpacingAtPages ); - aItem.SetUseOurTabStops( _bUseOurTabStops ); - aItem.SetNoExtLeading( _bNoExtLeading ); - aItem.SetUseLineSpacing( _bUseLineSpacing ); - aItem.SetAddTableSpacing( _bAddTableSpacing ); - aItem.SetUseObjPos( _bUseObjPos ); - aItem.SetUseOurTextWrapping( _bUseOurTextWrapping ); - aItem.SetConsiderWrappingStyle( _bConsiderWrappingStyle ); - aItem.SetExpandWordSpace( _bExpandWordSpace ); - m_aOptions.AppendEntry( aItem ); - - // default item reset? - if ( _sName.equals( COMPATIBILITY_DEFAULT_NAME ) != sal_False ) - m_aDefOptions = aItem; - - SetModified(); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Sequence< OUString > SvtCompatibilityOptions_Impl::impl_GetPropertyNames( Sequence< OUString >& rItems ) -{ - // First get ALL names of current existing list items in configuration! - rItems = GetNodeNames( SETNODE_ALLFILEFORMATS ); - // expand list to result list ... - Sequence< OUString > lProperties( rItems.getLength() * ( PROPERTYCOUNT - 1 ) ); - impl_ExpandPropertyNames( rItems, lProperties ); - // Return result. - return lProperties; -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -void SvtCompatibilityOptions_Impl::impl_ExpandPropertyNames( - const Sequence< OUString >& lSource, Sequence< OUString >& lDestination ) -{ - OUString sFixPath; - sal_Int32 nDestStep = 0; - sal_Int32 nSourceCount = lSource.getLength(); - // Copy entries to destination and expand every item with 2 supported sub properties. - for( sal_Int32 nSourceStep = 0; nSourceStep < nSourceCount; ++nSourceStep ) - { - sFixPath = SETNODE_ALLFILEFORMATS; - sFixPath += PATHDELIMITER; - sFixPath += lSource[ nSourceStep ]; - sFixPath += PATHDELIMITER; - - lDestination[nDestStep] = sFixPath; - lDestination[nDestStep] += PROPERTYNAME_MODULE; - ++nDestStep; - lDestination[nDestStep] = sFixPath; - lDestination[nDestStep] += PROPERTYNAME_USEPRTMETRICS; - ++nDestStep; - lDestination[nDestStep] = sFixPath; - lDestination[nDestStep] += PROPERTYNAME_ADDSPACING; - ++nDestStep; - lDestination[nDestStep] = sFixPath; - lDestination[nDestStep] += PROPERTYNAME_ADDSPACINGATPAGES; - ++nDestStep; - lDestination[nDestStep] = sFixPath; - lDestination[nDestStep] += PROPERTYNAME_USEOURTABSTOPS; - ++nDestStep; - lDestination[nDestStep] = sFixPath; - lDestination[nDestStep] += PROPERTYNAME_NOEXTLEADING; - ++nDestStep; - lDestination[nDestStep] = sFixPath; - lDestination[nDestStep] += PROPERTYNAME_USELINESPACING; - ++nDestStep; - lDestination[nDestStep] = sFixPath; - lDestination[nDestStep] += PROPERTYNAME_ADDTABLESPACING; - ++nDestStep; - lDestination[nDestStep] = sFixPath; - lDestination[nDestStep] += PROPERTYNAME_USEOBJPOS; - ++nDestStep; - lDestination[nDestStep] = sFixPath; - lDestination[nDestStep] += PROPERTYNAME_USEOURTEXTWRAP; - ++nDestStep; - lDestination[nDestStep] = sFixPath; - lDestination[nDestStep] += PROPERTYNAME_CONSIDERWRAPSTYLE; - ++nDestStep; - lDestination[nDestStep] = sFixPath; - lDestination[nDestStep] += PROPERTYNAME_EXPANDWORDSPACE; - ++nDestStep; - } -} - -//***************************************************************************************************************** -// initialize static member -// DON'T DO IT IN YOUR HEADER! -// see definition for further informations -//***************************************************************************************************************** -SvtCompatibilityOptions_Impl* SvtCompatibilityOptions::m_pDataContainer = NULL; -sal_Int32 SvtCompatibilityOptions::m_nRefCount = 0; - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtCompatibilityOptions::SvtCompatibilityOptions() -{ - // Global access, must be guarded (multithreading!). - MutexGuard aGuard( GetOwnStaticMutex() ); - // Increase ouer refcount ... - ++m_nRefCount; - // ... and initialize ouer data container only if it not already exist! - if( m_pDataContainer == NULL ) - { - m_pDataContainer = new SvtCompatibilityOptions_Impl; - ItemHolder1::holdConfigItem(E_COMPATIBILITY); - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtCompatibilityOptions::~SvtCompatibilityOptions() -{ - // Global access, must be guarded (multithreading!) - MutexGuard aGuard( GetOwnStaticMutex() ); - // Decrease ouer refcount. - --m_nRefCount; - // If last instance was deleted ... - // we must destroy ouer static data container! - if( m_nRefCount <= 0 ) - { - delete m_pDataContainer; - m_pDataContainer = NULL; - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtCompatibilityOptions::Clear() -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->Clear(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtCompatibilityOptions::AppendItem( const ::rtl::OUString& sName, - const ::rtl::OUString& sModule, - bool bUsePrtMetrics, - bool bAddSpacing, - bool bAddSpacingAtPages, - bool bUseOurTabStops, - bool bNoExtLeading, - bool bUseLineSpacing, - bool bAddTableSpacing, - bool bUseObjPos, - bool bUseOurTextWrapping, - bool bConsiderWrappingStyle, - bool bExpandWordSpace ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->AppendItem( - sName, sModule, bUsePrtMetrics, bAddSpacing, - bAddSpacingAtPages, bUseOurTabStops, bNoExtLeading, - bUseLineSpacing, bAddTableSpacing, bUseObjPos, - bUseOurTextWrapping, bConsiderWrappingStyle, bExpandWordSpace ); -} - -bool SvtCompatibilityOptions::IsUsePrtDevice() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsUsePrtDevice(); -} - -bool SvtCompatibilityOptions::IsAddSpacing() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsAddSpacing(); -} - -bool SvtCompatibilityOptions::IsAddSpacingAtPages() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsAddSpacingAtPages(); -} - -bool SvtCompatibilityOptions::IsUseOurTabStops() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsUseOurTabStops(); -} - -bool SvtCompatibilityOptions::IsNoExtLeading() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsNoExtLeading(); -} - -bool SvtCompatibilityOptions::IsUseLineSpacing() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsUseLineSpacing(); -} - -bool SvtCompatibilityOptions::IsAddTableSpacing() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsAddTableSpacing(); -} - -bool SvtCompatibilityOptions::IsUseObjectPositioning() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsUseObjPos(); -} - -bool SvtCompatibilityOptions::IsUseOurTextWrapping() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsUseOurTextWrapping(); -} - -bool SvtCompatibilityOptions::IsConsiderWrappingStyle() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsConsiderWrappingStyle(); -} - -bool SvtCompatibilityOptions::IsExpandWordSpace() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsExpandWordSpace(); -} - -Sequence< Sequence< PropertyValue > > SvtCompatibilityOptions::GetList() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetList(); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Mutex& SvtCompatibilityOptions::GetOwnStaticMutex() -{ - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; -} - diff --git a/svtools/source/config/defaultoptions.cxx b/svtools/source/config/defaultoptions.cxx deleted file mode 100644 index fbbcf60a11a6..000000000000 --- a/svtools/source/config/defaultoptions.cxx +++ /dev/null @@ -1,354 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: defaultoptions.cxx,v $ - * $Revision: 1.15 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -using namespace osl; -using namespace utl; -using namespace rtl; -using namespace com::sun::star::uno; - -// define ---------------------------------------------------------------- - -#define ASCII_STR(s) OUString( RTL_CONSTASCII_USTRINGPARAM(s) ) - -#define DEFAULTPATH__ADDIN 0 -#define DEFAULTPATH__AUTOCORRECT 1 -#define DEFAULTPATH__AUTOTEXT 2 -#define DEFAULTPATH__BACKUP 3 -#define DEFAULTPATH__BASIC 4 -#define DEFAULTPATH__BITMAP 5 -#define DEFAULTPATH__CONFIG 6 -#define DEFAULTPATH__DICTIONARY 7 -#define DEFAULTPATH__FAVORITES 8 -#define DEFAULTPATH__FILTER 9 -#define DEFAULTPATH__GALLERY 10 -#define DEFAULTPATH__GRAPHIC 11 -#define DEFAULTPATH__HELP 12 -#define DEFAULTPATH__LINGUISTIC 13 -#define DEFAULTPATH__MODULE 14 -#define DEFAULTPATH__PALETTE 15 -#define DEFAULTPATH__PLUGIN 16 -#define DEFAULTPATH__TEMP 17 -#define DEFAULTPATH__TEMPLATE 18 -#define DEFAULTPATH__USERCONFIG 19 -#define DEFAULTPATH__WORK 20 -#define DEFAULTPATH__USERDICTIONARY 21 - -// class SvtDefaultOptions_Impl ------------------------------------------ - -class SvtDefaultOptions_Impl : public utl::ConfigItem -{ -public: - String m_aAddinPath; - String m_aAutoCorrectPath; - String m_aAutoTextPath; - String m_aBackupPath; - String m_aBasicPath; - String m_aBitmapPath; - String m_aConfigPath; - String m_aDictionaryPath; - String m_aFavoritesPath; - String m_aFilterPath; - String m_aGalleryPath; - String m_aGraphicPath; - String m_aHelpPath; - String m_aLinguisticPath; - String m_aModulePath; - String m_aPalettePath; - String m_aPluginPath; - String m_aTempPath; - String m_aTemplatePath; - String m_aUserConfigPath; - String m_aWorkPath; - String m_aUserDictionaryPath; - - SvtDefaultOptions_Impl(); - - String GetDefaultPath( USHORT nId ) const; -}; - -// global ---------------------------------------------------------------- - -static SvtDefaultOptions_Impl* pOptions = NULL; -static sal_Int32 nRefCount = 0; - -typedef String SvtDefaultOptions_Impl:: *PathStrPtr; - -struct PathToDefaultMapping_Impl -{ - SvtPathOptions::Pathes _ePath; - PathStrPtr _pDefaultPath; -}; - -static PathToDefaultMapping_Impl __READONLY_DATA PathMap_Impl[] = -{ - { SvtPathOptions::PATH_ADDIN, &SvtDefaultOptions_Impl::m_aAddinPath }, - { SvtPathOptions::PATH_AUTOCORRECT, &SvtDefaultOptions_Impl::m_aAutoCorrectPath }, - { SvtPathOptions::PATH_AUTOTEXT, &SvtDefaultOptions_Impl::m_aAutoTextPath }, - { SvtPathOptions::PATH_BACKUP, &SvtDefaultOptions_Impl::m_aBackupPath }, - { SvtPathOptions::PATH_BASIC, &SvtDefaultOptions_Impl::m_aBasicPath }, - { SvtPathOptions::PATH_BITMAP, &SvtDefaultOptions_Impl::m_aBitmapPath }, - { SvtPathOptions::PATH_CONFIG, &SvtDefaultOptions_Impl::m_aConfigPath }, - { SvtPathOptions::PATH_DICTIONARY, &SvtDefaultOptions_Impl::m_aDictionaryPath }, - { SvtPathOptions::PATH_FAVORITES, &SvtDefaultOptions_Impl::m_aFavoritesPath }, - { SvtPathOptions::PATH_FILTER, &SvtDefaultOptions_Impl::m_aFilterPath }, - { SvtPathOptions::PATH_GALLERY, &SvtDefaultOptions_Impl::m_aGalleryPath }, - { SvtPathOptions::PATH_GRAPHIC, &SvtDefaultOptions_Impl::m_aGraphicPath }, - { SvtPathOptions::PATH_HELP, &SvtDefaultOptions_Impl::m_aHelpPath }, - { SvtPathOptions::PATH_LINGUISTIC, &SvtDefaultOptions_Impl::m_aLinguisticPath }, - { SvtPathOptions::PATH_MODULE, &SvtDefaultOptions_Impl::m_aModulePath }, - { SvtPathOptions::PATH_PALETTE, &SvtDefaultOptions_Impl::m_aPalettePath }, - { SvtPathOptions::PATH_PLUGIN, &SvtDefaultOptions_Impl::m_aPluginPath }, - { SvtPathOptions::PATH_TEMP, &SvtDefaultOptions_Impl::m_aTempPath }, - { SvtPathOptions::PATH_TEMPLATE, &SvtDefaultOptions_Impl::m_aTemplatePath }, - { SvtPathOptions::PATH_USERCONFIG, &SvtDefaultOptions_Impl::m_aUserConfigPath }, - { SvtPathOptions::PATH_WORK, &SvtDefaultOptions_Impl::m_aWorkPath } -}; - -// functions ------------------------------------------------------------- - -Sequence< OUString > GetDefaultPropertyNames() -{ - static const char* aPropNames[] = - { - "Addin", // PATH_ADDIN - "AutoCorrect", // PATH_AUTOCORRECT - "AutoText", // PATH_AUTOTEXT - "Backup", // PATH_BACKUP - "Basic", // PATH_BASIC - "Bitmap", // PATH_BITMAP - "Config", // PATH_CONFIG - "Dictionary", // PATH_DICTIONARY - "Favorite", // PATH_FAVORITES - "Filter", // PATH_FILTER - "Gallery", // PATH_GALLERY - "Graphic", // PATH_GRAPHIC - "Help", // PATH_HELP - "Linguistic", // PATH_LINGUISTIC - "Module", // PATH_MODULE - "Palette", // PATH_PALETTE - "Plugin", // PATH_PLUGIN - "Temp", // PATH_TEMP - "Template", // PATH_TEMPLATE - "UserConfig", // PATH_USERCONFIG - "Work" // PATH_WORK - }; - - const int nCount = sizeof( aPropNames ) / sizeof( const char* ); - Sequence< OUString > aNames( nCount ); - OUString* pNames = aNames.getArray(); - for ( int i = 0; i < nCount; i++ ) - pNames[i] = OUString::createFromAscii( aPropNames[i] ); - - return aNames; -} - -// class SvtDefaultOptions_Impl ------------------------------------------ - -String SvtDefaultOptions_Impl::GetDefaultPath( USHORT nId ) const -{ - String aRet; - USHORT nIdx = 0; - - while ( PathMap_Impl[nIdx]._ePath <= SvtPathOptions::PATH_WORK ) - { - if ( nId == PathMap_Impl[nIdx]._ePath && PathMap_Impl[nIdx]._pDefaultPath ) - { - aRet = this->*(PathMap_Impl[nIdx]._pDefaultPath); - if ( nId == SvtPathOptions::PATH_ADDIN || - nId == SvtPathOptions::PATH_FILTER || - nId == SvtPathOptions::PATH_HELP || - nId == SvtPathOptions::PATH_MODULE || - nId == SvtPathOptions::PATH_PLUGIN ) - { - String aTmp; - ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aRet, aTmp ); - aRet = aTmp; - } - - break; - } - ++nIdx; - } - - return aRet; -} - -// ----------------------------------------------------------------------- - -SvtDefaultOptions_Impl::SvtDefaultOptions_Impl() : ConfigItem( ASCII_STR("Office.Common/Path/Default") ) -{ - /*ConfigManager* pCfgMgr =*/ ConfigManager::GetConfigManager(); - Sequence< OUString > aNames = GetDefaultPropertyNames(); - Sequence< Any > aValues = GetProperties( aNames ); - EnableNotification( aNames ); - const Any* pValues = aValues.getConstArray(); - DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" ); - if ( aValues.getLength() == aNames.getLength() ) - { - SvtPathOptions aPathOpt; - OUString aTempStr, aFullPath; - - for ( int nProp = 0; nProp < aNames.getLength(); nProp++ ) - { - if ( pValues[nProp].hasValue() ) - { - switch ( pValues[nProp].getValueTypeClass() ) - { - case ::com::sun::star::uno::TypeClass_STRING : - { - // multi pathes - if ( pValues[nProp] >>= aTempStr ) - aFullPath = aPathOpt.SubstituteVariable( aTempStr ); - else - { - DBG_ERRORFILE( "any operator >>= failed" ); - } - break; - } - - case ::com::sun::star::uno::TypeClass_SEQUENCE : - { - // single pathes - aFullPath = OUString(); - Sequence < OUString > aList; - if ( pValues[nProp] >>= aList ) - { - sal_Int32 nCount = aList.getLength(); - for ( sal_Int32 nPosition = 0; nPosition < nCount; ++nPosition ) - { - aTempStr = aPathOpt.SubstituteVariable( aList[ nPosition ] ); - aFullPath += aTempStr; - if ( nPosition < nCount-1 ) - aFullPath += OUString( RTL_CONSTASCII_USTRINGPARAM(";") ); - } - } - else - { - DBG_ERRORFILE( "any operator >>= failed" ); - } - break; - } - - default: - { - DBG_ERRORFILE( "Wrong any type" ); - } - } - - switch ( nProp ) - { - case DEFAULTPATH__ADDIN: m_aAddinPath = String( aFullPath ); break; - case DEFAULTPATH__AUTOCORRECT: m_aAutoCorrectPath = String( aFullPath ); break; - case DEFAULTPATH__AUTOTEXT: m_aAutoTextPath = String( aFullPath ); break; - case DEFAULTPATH__BACKUP: m_aBackupPath = String( aFullPath ); break; - case DEFAULTPATH__BASIC: m_aBasicPath = String( aFullPath ); break; - case DEFAULTPATH__BITMAP: m_aBitmapPath = String( aFullPath ); break; - case DEFAULTPATH__CONFIG: m_aConfigPath = String( aFullPath ); break; - case DEFAULTPATH__DICTIONARY: m_aDictionaryPath = String( aFullPath ); break; - case DEFAULTPATH__FAVORITES: m_aFavoritesPath = String( aFullPath ); break; - case DEFAULTPATH__FILTER: m_aFilterPath = String( aFullPath ); break; - case DEFAULTPATH__GALLERY: m_aGalleryPath = String( aFullPath ); break; - case DEFAULTPATH__GRAPHIC: m_aGraphicPath = String( aFullPath ); break; - case DEFAULTPATH__HELP: m_aHelpPath = String( aFullPath ); break; - case DEFAULTPATH__LINGUISTIC: m_aLinguisticPath = String( aFullPath ); break; - case DEFAULTPATH__MODULE: m_aModulePath = String( aFullPath ); break; - case DEFAULTPATH__PALETTE: m_aPalettePath = String( aFullPath ); break; - case DEFAULTPATH__PLUGIN: m_aPluginPath = String( aFullPath ); break; - case DEFAULTPATH__TEMP: m_aTempPath = String( aFullPath ); break; - case DEFAULTPATH__TEMPLATE: m_aTemplatePath = String( aFullPath ); break; - case DEFAULTPATH__USERCONFIG: m_aUserConfigPath = String( aFullPath ); break; - case DEFAULTPATH__WORK: m_aWorkPath = String( aFullPath ); break; - case DEFAULTPATH__USERDICTIONARY: m_aUserDictionaryPath = String( aFullPath );break; - - default: - DBG_ERRORFILE( "invalid index to load a default path" ); - } - } - } - } -} - -// class SvtDefaultOptions ----------------------------------------------- -namespace { struct lclMutex : public rtl::Static< ::osl::Mutex, lclMutex > {}; } - -SvtDefaultOptions::SvtDefaultOptions() -{ - // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( lclMutex::get() ); - if ( !pOptions ) - { - pOptions = new SvtDefaultOptions_Impl; - ItemHolder1::holdConfigItem(E_DEFAULTOPTIONS); - } - ++nRefCount; - pImp = pOptions; -} - -// ----------------------------------------------------------------------- - -SvtDefaultOptions::~SvtDefaultOptions() -{ - // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( lclMutex::get() ); - if ( !--nRefCount ) - { - if ( pOptions->IsModified() ) - pOptions->Commit(); - DELETEZ( pOptions ); - } -} - -// ----------------------------------------------------------------------- - -String SvtDefaultOptions::GetDefaultPath( USHORT nId ) const -{ - return pImp->GetDefaultPath( nId ); -} - diff --git a/svtools/source/config/dynamicmenuoptions.cxx b/svtools/source/config/dynamicmenuoptions.cxx deleted file mode 100644 index 7b60a1c3716c..000000000000 --- a/svtools/source/config/dynamicmenuoptions.cxx +++ /dev/null @@ -1,923 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: dynamicmenuoptions.cxx,v $ - * $Revision: 1.18 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include -#include -#include -#include -#include -#include -#include - -#ifndef __SGI_STL_VECTOR -#include -#endif - -#include - -#include - -//_________________________________________________________________________________________________________________ -// namespaces -//_________________________________________________________________________________________________________________ - -using namespace ::std ; -using namespace ::utl ; -using namespace ::rtl ; -using namespace ::osl ; -using namespace ::com::sun::star::uno ; -using namespace ::com::sun::star::beans ; - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -#define ROOTNODE_MENUS OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Menus/" )) -#define PATHDELIMITER OUString(RTL_CONSTASCII_USTRINGPARAM("/" )) - -#define SETNODE_NEWMENU OUString(RTL_CONSTASCII_USTRINGPARAM("New" )) -#define SETNODE_WIZARDMENU OUString(RTL_CONSTASCII_USTRINGPARAM("Wizard" )) -#define SETNODE_HELPBOOKMARKS OUString(RTL_CONSTASCII_USTRINGPARAM("HelpBookmarks" )) - -#define PROPERTYNAME_URL DYNAMICMENU_PROPERTYNAME_URL -#define PROPERTYNAME_TITLE DYNAMICMENU_PROPERTYNAME_TITLE -#define PROPERTYNAME_IMAGEIDENTIFIER DYNAMICMENU_PROPERTYNAME_IMAGEIDENTIFIER -#define PROPERTYNAME_TARGETNAME DYNAMICMENU_PROPERTYNAME_TARGETNAME - -#define PROPERTYCOUNT 4 - -#define OFFSET_URL 0 -#define OFFSET_TITLE 1 -#define OFFSET_IMAGEIDENTIFIER 2 -#define OFFSET_TARGETNAME 3 - -#define PATHPREFIX_SETUP OUString(RTL_CONSTASCII_USTRINGPARAM("m" )) -#define PATHPREFIX_USER OUString(RTL_CONSTASCII_USTRINGPARAM("u" )) - -//_________________________________________________________________________________________________________________ -// private declarations! -//_________________________________________________________________________________________________________________ - -/*-**************************************************************************************************************** - @descr struct to hold information about one menu entry. -****************************************************************************************************************-*/ -struct SvtDynMenuEntry -{ - public: - SvtDynMenuEntry() {}; - - SvtDynMenuEntry( const OUString& sNewURL , - const OUString& sNewTitle , - const OUString& sNewImageIdentifier , - const OUString& sNewTargetName ) - { - sURL = sNewURL ; - sTitle = sNewTitle ; - sImageIdentifier = sNewImageIdentifier ; - sTargetName = sNewTargetName ; - } - - public: - OUString sName ; - OUString sURL ; - OUString sTitle ; - OUString sImageIdentifier ; - OUString sTargetName ; -}; - -/*-**************************************************************************************************************** - @descr support simple menu structures and operations on it -****************************************************************************************************************-*/ -class SvtDynMenu -{ - public: - //--------------------------------------------------------------------------------------------------------- - // append setup written menu entry - // Don't touch name of entry. It was defined by setup and must be the same everytime! - // Look for double menu entries here too ... may be some seperator items are supeflous ... - void AppendSetupEntry( const SvtDynMenuEntry& rEntry ) - { - if( - ( lSetupEntries.size() < 1 ) || - ( lSetupEntries.rbegin()->sURL != rEntry.sURL ) - ) - { - lSetupEntries.push_back( rEntry ); - } - } - - //--------------------------------------------------------------------------------------------------------- - // append user specific menu entry - // We must find unique name for it by using special prefix - // and next count of user setted entries! - // Look for double menu entries here too ... may be some seperator items are supeflous ... - void AppendUserEntry( SvtDynMenuEntry& rEntry ) - { - if( - ( lUserEntries.size() < 1 ) || - ( lUserEntries.rbegin()->sURL != rEntry.sURL ) - ) - { - rEntry.sName = PATHPREFIX_USER; - rEntry.sName += OUString::valueOf( (sal_Int32)impl_getNextUserEntryNr() ); - lUserEntries.push_back( rEntry ); - } - } - - //--------------------------------------------------------------------------------------------------------- - // the only way to free memory! - void Clear() - { - lSetupEntries.clear(); - lUserEntries.clear(); - } - - //--------------------------------------------------------------------------------------------------------- - // convert internal list to external format - // for using it on right menus realy - // Notice: We build a property list with 4 entries and set it on result list then. - // The while-loop starts with pointer on internal member list lSetupEntries, change to - // lUserEntries then and stop after that with NULL! - // Separator entries will be packed in another way then normal entries! We define - // special strings "sEmpty" and "sSeperator" to perform too ... - Sequence< Sequence< PropertyValue > > GetList() const - { - sal_Int32 nSetupCount = (sal_Int32)lSetupEntries.size(); - sal_Int32 nUserCount = (sal_Int32)lUserEntries.size(); - sal_Int32 nStep = 0; - Sequence< PropertyValue > lProperties ( PROPERTYCOUNT ); - Sequence< Sequence< PropertyValue > > lResult ( nSetupCount+nUserCount ); - OUString sSeperator ( RTL_CONSTASCII_USTRINGPARAM("private:separator") ); - OUString sEmpty ; - const vector< SvtDynMenuEntry >* pList = &lSetupEntries; - - lProperties[OFFSET_URL ].Name = PROPERTYNAME_URL ; - lProperties[OFFSET_TITLE ].Name = PROPERTYNAME_TITLE ; - lProperties[OFFSET_IMAGEIDENTIFIER].Name = PROPERTYNAME_IMAGEIDENTIFIER ; - lProperties[OFFSET_TARGETNAME ].Name = PROPERTYNAME_TARGETNAME ; - - while( pList != NULL ) - { - for( vector< SvtDynMenuEntry >::const_iterator pItem =pList->begin(); - pItem!=pList->end() ; - ++pItem ) - { - if( pItem->sURL == sSeperator ) - { - lProperties[OFFSET_URL ].Value <<= sSeperator ; - lProperties[OFFSET_TITLE ].Value <<= sEmpty ; - lProperties[OFFSET_IMAGEIDENTIFIER ].Value <<= sEmpty ; - lProperties[OFFSET_TARGETNAME ].Value <<= sEmpty ; - } - else - { - lProperties[OFFSET_URL ].Value <<= pItem->sURL ; - lProperties[OFFSET_TITLE ].Value <<= pItem->sTitle ; - lProperties[OFFSET_IMAGEIDENTIFIER ].Value <<= pItem->sImageIdentifier; - lProperties[OFFSET_TARGETNAME ].Value <<= pItem->sTargetName ; - } - lResult[nStep] = lProperties; - ++nStep; - } - if( pList == &lSetupEntries ) - pList = &lUserEntries; - else - pList = NULL; - } - return lResult; - } - - private: - //--------------------------------------------------------------------------------------------------------- - // search for an entry named "ux" with x=[0..i] inside our menu - // which has set highest number x. So we can add another user entry. - sal_Int32 impl_getNextUserEntryNr() const - { - sal_Int32 nNr = 0; - for( vector< SvtDynMenuEntry >::const_iterator pItem =lUserEntries.begin(); - pItem!=lUserEntries.end() ; - ++pItem ) - { - if( pItem->sName.compareTo( PATHPREFIX_USER, 1 ) == 0 ) - { - OUString sNr = pItem->sName.copy( 1, pItem->sName.getLength()-1 ); - sal_Int32 nCheckNr = sNr.toInt32(); - if( nCheckNr > nNr ) - nNr = nCheckNr; - } - } - // Attention: Code isn't prepared for recyling of unused fragmented numbers! - // If we reach end of sal_Int32 range ... we must stop further working ... - // But I think nobody expand a menu to more then 1000 ... 100000 ... entries ... or? - DBG_ASSERT( !(nNr>0x7fffffff), "Menu::impl_getNextUserEntryNr()\nUser count can be out of range next time ...\n" ); - return nNr; - } - - private: - vector< SvtDynMenuEntry > lSetupEntries; - vector< SvtDynMenuEntry > lUserEntries ; -}; - -class SvtDynamicMenuOptions_Impl : public ConfigItem -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - SvtDynamicMenuOptions_Impl(); - ~SvtDynamicMenuOptions_Impl(); - - //--------------------------------------------------------------------------------------------------------- - // overloaded methods of baseclass - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short called for notify of configmanager - @descr These method is called from the ConfigManager before application ends or from the - PropertyChangeListener if the sub tree broadcasts changes. You must update your - internal values. - - @seealso baseclass ConfigItem - - @param "lPropertyNames" is the list of properties which should be updated. - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Notify( const Sequence< OUString >& lPropertyNames ); - - /*-****************************************************************************************************//** - @short write changes to configuration - @descr These method writes the changed values into the sub tree - and should always called in our destructor to guarantee consistency of config data. - - @seealso baseclass ConfigItem - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Commit(); - - //--------------------------------------------------------------------------------------------------------- - // public interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short base implementation of public interface for "SvtDynamicMenuOptions"! - @descr These class is used as static member of "SvtDynamicMenuOptions" ... - => The code exist only for one time and isn't duplicated for every instance! - - @seealso - - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - void Clear ( EDynamicMenuType eMenu ); - Sequence< Sequence< PropertyValue > > GetMenu ( EDynamicMenuType eMenu ) const ; - void AppendItem ( EDynamicMenuType eMenu , - const OUString& sURL , - const OUString& sTitle , - const OUString& sImageIdentifier, - const OUString& sTargetName ); - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return list of key names of our configuration management which represent oue module tree - @descr These methods return the current list of key names! We need it to get needed values from our - configuration management and support dynamical menu item lists! - - @seealso - - - @param "nNewCount" , returns count of menu entries for "new" - @param "nWizardCount" , returns count of menu entries for "wizard" - @return A list of configuration key names is returned. - - @onerror - - *//*-*****************************************************************************************************/ - - Sequence< OUString > impl_GetPropertyNames( sal_uInt32& nNewCount, sal_uInt32& nWizardCount, sal_uInt32& nHelpBookmarksCount ); - - /*-****************************************************************************************************//** - @short sort given source list and expand it for all well known properties to destination - @descr We must support sets of entries with count inside the name .. but some of them could be missing! - e.g. s1-s2-s3-s0-u1-s6-u5-u7 - Then we must sort it by name and expand it to the follow one: - sSetNode/s0/URL - sSetNode/s0/Title - sSetNode/s0/... - sSetNode/s1/URL - sSetNode/s1/Title - sSetNode/s1/... - ... - sSetNode/s6/URL - sSetNode/s6/Title - sSetNode/s6/... - sSetNode/u1/URL - sSetNode/u1/Title - sSetNode/u1/... - ... - sSetNode/u7/URL - sSetNode/u7/Title - sSetNode/u7/... - Rules: We start with all setup written entries names "sx" and x=[0..n]. - Then we handle all "ux" items. Inside these blocks we sort it ascending by number. - - @attention We add these expanded list to the end of given "lDestination" list! - So we must start on "lDestination.getLength()". - Reallocation of memory of destination list is done by us! - - @seealso method impl_GetPropertyNames() - - @param "lSource" , original list (e.g. [m1-m2-m3-m6-m0] ) - @param "lDestination" , destination of operation - @param "sSetNode" , name of configuration set to build complete path - @return A list of configuration key names is returned. - - @onerror - - *//*-*****************************************************************************************************/ - - void impl_SortAndExpandPropertyNames( const Sequence< OUString >& lSource , - Sequence< OUString >& lDestination , - const OUString& sSetNode ); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - SvtDynMenu m_aNewMenu ; - SvtDynMenu m_aWizardMenu ; - SvtDynMenu m_aHelpBookmarksMenu ; -}; - -//_________________________________________________________________________________________________________________ -// definitions -//_________________________________________________________________________________________________________________ - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtDynamicMenuOptions_Impl::SvtDynamicMenuOptions_Impl() - // Init baseclasses first - : ConfigItem( ROOTNODE_MENUS ) - // Init member then... -{ - // Get names and values of all accessable menu entries and fill internal structures. - // See impl_GetPropertyNames() for further informations. - sal_uInt32 nNewCount = 0; - sal_uInt32 nWizardCount = 0; - sal_uInt32 nHelpBookmarksCount = 0; - Sequence< OUString > lNames = impl_GetPropertyNames ( nNewCount , - nWizardCount , - nHelpBookmarksCount ); - Sequence< Any > lValues = GetProperties ( lNames ); - - // Safe impossible cases. - // We need values from ALL configuration keys. - // Follow assignment use order of values in relation to our list of key names! - DBG_ASSERT( !(lNames.getLength()!=lValues.getLength()), "SvtDynamicMenuOptions_Impl::SvtDynamicMenuOptions_Impl()\nI miss some values of configuration keys!\n" ); - - // Copy values from list in right order to ouer internal member. - // Attention: List for names and values have an internal construction pattern! - // - // first "New" menu ... - // Name Value - // /New/1/URL "private:factory/swriter" - // /New/1/Title "Neues Writer Dokument" - // /New/1/ImageIdentifier "icon_writer" - // /New/1/TargetName "_blank" - // - // /New/2/URL "private:factory/scalc" - // /New/2/Title "Neues Calc Dokument" - // /New/2/ImageIdentifier "icon_calc" - // /New/2/TargetName "_blank" - // - // second "Wizard" menu ... - // /Wizard/1/URL "file://b" - // /Wizard/1/Title "MalWas" - // /Wizard/1/ImageIdentifier "icon_?" - // /Wizard/1/TargetName "_self" - // - // ... and so on ... - - sal_uInt32 nItem = 0 ; - sal_uInt32 nPosition = 0 ; - OUString sName ; - - // We must use these one instance object(!) to get information about installed modules. - // These information are used to filter menu entries wich need not installed modules ... - // Such entries shouldnt be available then! - // see impl_IsEntrySupported() too - SvtModuleOptions aModuleOptions; - - // Get names/values for new menu. - // 4 subkeys for every item! - for( nItem=0; nItem>= aItem.sURL ; - ++nPosition; - lValues[nPosition] >>= aItem.sTitle ; - ++nPosition; - lValues[nPosition] >>= aItem.sImageIdentifier ; - ++nPosition; - lValues[nPosition] >>= aItem.sTargetName ; - ++nPosition; - m_aNewMenu.AppendSetupEntry( aItem ); - } - - // Attention: Don't reset nPosition here! - - // Get names/values for wizard menu. - // 4 subkeys for every item! - for( nItem=0; nItem>= aItem.sURL ; - ++nPosition; - lValues[nPosition] >>= aItem.sTitle ; - ++nPosition; - lValues[nPosition] >>= aItem.sImageIdentifier ; - ++nPosition; - lValues[nPosition] >>= aItem.sTargetName ; - ++nPosition; - m_aWizardMenu.AppendSetupEntry( aItem ); - } - - // Attention: Don't reset nPosition here! - - // Get names/values for wizard menu. - // 4 subkeys for every item! - for( nItem=0; nItem>= aItem.sURL ; - ++nPosition; - lValues[nPosition] >>= aItem.sTitle ; - ++nPosition; - lValues[nPosition] >>= aItem.sImageIdentifier ; - ++nPosition; - lValues[nPosition] >>= aItem.sTargetName ; - ++nPosition; - m_aHelpBookmarksMenu.AppendSetupEntry( aItem ); - } - -/*TODO: Not used in the moment! see Notify() ... - // Enable notification mechanism of ouer baseclass. - // We need it to get information about changes outside these class on ouer used configuration keys! - EnableNotification( lNames ); -*/ -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtDynamicMenuOptions_Impl::~SvtDynamicMenuOptions_Impl() -{ - // We must save our current values .. if user forget it! - if( IsModified() == sal_True ) - { - Commit(); - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtDynamicMenuOptions_Impl::Notify( const Sequence< OUString >& ) -{ - DBG_ASSERT( sal_False, "SvtDynamicMenuOptions_Impl::Notify()\nNot implemented yet! I don't know how I can handle a dynamical list of unknown properties ...\n" ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtDynamicMenuOptions_Impl::Commit() -{ - DBG_ERROR( "SvtDynamicMenuOptions_Impl::Commit()\nNot implemented yet!\n" ); - /* - // Write all properties! - // Delete complete sets first. - ClearNodeSet( SETNODE_NEWMENU ); - ClearNodeSet( SETNODE_WIZARDMENU ); - ClearNodeSet( SETNODE_HELPBOOKMARKS ); - - MenuEntry aItem ; - OUString sNode ; - Sequence< PropertyValue > lPropertyValues( PROPERTYCOUNT ); - sal_uInt32 nItem = 0 ; - - // Copy "new" menu entries to save-list! - sal_uInt32 nNewCount = m_aNewMenu.size(); - for( nItem=0; nItem > SvtDynamicMenuOptions_Impl::GetMenu( EDynamicMenuType eMenu ) const -{ - Sequence< Sequence< PropertyValue > > lReturn; - switch( eMenu ) - { - case E_NEWMENU : { - lReturn = m_aNewMenu.GetList(); - } - break; - - case E_WIZARDMENU : { - lReturn = m_aWizardMenu.GetList(); - } - break; - - case E_HELPBOOKMARKS : { - lReturn = m_aHelpBookmarksMenu.GetList(); - } - break; - } - return lReturn; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtDynamicMenuOptions_Impl::AppendItem( EDynamicMenuType eMenu , - const OUString& sURL , - const OUString& sTitle , - const OUString& sImageIdentifier, - const OUString& sTargetName ) -{ - SvtDynMenuEntry aItem( sURL, sTitle, sImageIdentifier, sTargetName ); - - switch( eMenu ) - { - case E_NEWMENU : { - m_aNewMenu.AppendUserEntry( aItem ); - SetModified(); - } - break; - - case E_WIZARDMENU : { - m_aWizardMenu.AppendUserEntry( aItem ); - SetModified(); - } - break; - - case E_HELPBOOKMARKS : { - m_aHelpBookmarksMenu.AppendUserEntry( aItem ); - SetModified(); - } - break; - } -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Sequence< OUString > SvtDynamicMenuOptions_Impl::impl_GetPropertyNames( sal_uInt32& nNewCount, sal_uInt32& nWizardCount, sal_uInt32& nHelpBookmarksCount ) -{ - // First get ALL names of current existing list items in configuration! - Sequence< OUString > lNewItems = GetNodeNames( SETNODE_NEWMENU ); - Sequence< OUString > lWizardItems = GetNodeNames( SETNODE_WIZARDMENU ); - Sequence< OUString > lHelpBookmarksItems = GetNodeNames( SETNODE_HELPBOOKMARKS ); - - // Get information about list counts ... - nNewCount = lNewItems.getLength (); - nWizardCount = lWizardItems.getLength (); - nHelpBookmarksCount = lHelpBookmarksItems.getLength(); - - // Sort and expand all three list to result list ... - Sequence< OUString > lProperties; - impl_SortAndExpandPropertyNames( lNewItems , lProperties, SETNODE_NEWMENU ); - impl_SortAndExpandPropertyNames( lWizardItems , lProperties, SETNODE_WIZARDMENU ); - impl_SortAndExpandPropertyNames( lHelpBookmarksItems, lProperties, SETNODE_HELPBOOKMARKS ); - - // Return result. - return lProperties; -} - -//***************************************************************************************************************** -// private helper -//***************************************************************************************************************** -class CountWithPrefixSort -{ - public: - int operator() ( const OUString& s1 , - const OUString& s2 ) const - { - // Get order numbers from entry name without prefix. - // e.g. "m10" => 10 - // "m5" => 5 - sal_Int32 n1 = s1.copy( 1, s1.getLength()-1 ).toInt32(); - sal_Int32 n2 = s2.copy( 1, s2.getLength()-1 ).toInt32(); - // MUST be in [0,1] ... because it's a difference between - // insert-positions of given entries in sorted list! - return( n1& lSource , - Sequence< OUString >& lDestination , - const OUString& sSetNode ) -{ - OUString sFixPath ; - vector< OUString > lTemp ; - sal_Int32 nSourceCount = lSource.getLength() ; - sal_Int32 nDestinationStep = lDestination.getLength() ; // start on end of current list ...! - - lDestination.realloc( (nSourceCount*PROPERTYCOUNT)+nDestinationStep ); // get enough memory for copy operations after nDestination ... - - // Copy all items to temp. vector to use fast sort operations :-) - for( sal_Int32 nSourceStep=0; nSourceStep::const_iterator pItem =lTemp.begin() ; - pItem!=lTemp.end() ; - ++pItem ) - { - sFixPath = sSetNode ; - sFixPath += PATHDELIMITER ; - sFixPath += *pItem ; - sFixPath += PATHDELIMITER ; - - lDestination[nDestinationStep] = sFixPath ; - lDestination[nDestinationStep] += PROPERTYNAME_URL ; - ++nDestinationStep; - lDestination[nDestinationStep] = sFixPath ; - lDestination[nDestinationStep] += PROPERTYNAME_TITLE ; - ++nDestinationStep; - lDestination[nDestinationStep] = sFixPath ; - lDestination[nDestinationStep] += PROPERTYNAME_IMAGEIDENTIFIER ; - ++nDestinationStep; - lDestination[nDestinationStep] = sFixPath ; - lDestination[nDestinationStep] += PROPERTYNAME_TARGETNAME ; - ++nDestinationStep; - } -} - -//***************************************************************************************************************** -// initialize static member -// DON'T DO IT IN YOUR HEADER! -// see definition for further informations -//***************************************************************************************************************** -SvtDynamicMenuOptions_Impl* SvtDynamicMenuOptions::m_pDataContainer = NULL ; -sal_Int32 SvtDynamicMenuOptions::m_nRefCount = 0 ; - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtDynamicMenuOptions::SvtDynamicMenuOptions() -{ - // Global access, must be guarded (multithreading!). - MutexGuard aGuard( GetOwnStaticMutex() ); - // Increase ouer refcount ... - ++m_nRefCount; - // ... and initialize ouer data container only if it not already exist! - if( m_pDataContainer == NULL ) - { - m_pDataContainer = new SvtDynamicMenuOptions_Impl; - ItemHolder1::holdConfigItem(E_DYNAMICMENUOPTIONS); - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtDynamicMenuOptions::~SvtDynamicMenuOptions() -{ - // Global access, must be guarded (multithreading!) - MutexGuard aGuard( GetOwnStaticMutex() ); - // Decrease ouer refcount. - --m_nRefCount; - // If last instance was deleted ... - // we must destroy ouer static data container! - if( m_nRefCount <= 0 ) - { - delete m_pDataContainer; - m_pDataContainer = NULL; - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtDynamicMenuOptions::Clear( EDynamicMenuType eMenu ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->Clear( eMenu ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -Sequence< Sequence< PropertyValue > > SvtDynamicMenuOptions::GetMenu( EDynamicMenuType eMenu ) const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetMenu( eMenu ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtDynamicMenuOptions::AppendItem( EDynamicMenuType eMenu , - const OUString& sURL , - const OUString& sTitle , - const OUString& sImageIdentifier, - const OUString& sTargetName ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->AppendItem( eMenu, sURL, sTitle, sImageIdentifier, sTargetName ); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Mutex& SvtDynamicMenuOptions::GetOwnStaticMutex() -{ - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; -} diff --git a/svtools/source/config/eventcfg.cxx b/svtools/source/config/eventcfg.cxx deleted file mode 100644 index 6026c3d4a3a0..000000000000 --- a/svtools/source/config/eventcfg.cxx +++ /dev/null @@ -1,458 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: eventcfg.cxx,v $ - * $Revision: 1.8.24.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include "eventcfg.hxx" -#include -#include -#include -#include -#include -#include -#include - -#ifndef __SGI_STL_HASH_MAP -#include -#endif -#include -#include - -#include - -#include - -using namespace ::std ; -using namespace ::utl ; -using namespace ::rtl ; -using namespace ::osl ; -using namespace ::com::sun::star::uno ; -using namespace ::com::sun::star; - -#define ROOTNODE_EVENTS OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Events/ApplicationEvents" )) -#define PATHDELIMITER OUString(RTL_CONSTASCII_USTRINGPARAM("/")) -#define SETNODE_BINDINGS OUString(RTL_CONSTASCII_USTRINGPARAM("Bindings" )) -#define PROPERTYNAME_BINDINGURL OUString(RTL_CONSTASCII_USTRINGPARAM("BindingURL")) - -const char* pEventAsciiNames[] = -{ -"OnStartApp", -"OnCloseApp", -"OnCreate", -"OnNew", -"OnLoadFinished", -"OnLoad", -"OnPrepareUnload", -"OnUnload", -"OnSave", -"OnSaveDone", -"OnSaveFailed", -"OnSaveAs", -"OnSaveAsDone", -"OnSaveAsFailed", -"OnCopyTo", -"OnCopyToDone", -"OnCopyToFailed", -"OnFocus", -"OnUnfocus", -"OnPrint", -"OnViewCreated", -"OnPrepareViewClosing", -"OnViewClosed", -"OnModifyChanged", -"OnTitleChanged", -"OnVisAreaChanged", -"OnModeChanged", -"OnStorageChanged" -}; - -GlobalEventConfig_Impl::GlobalEventConfig_Impl() - : ConfigItem( ROOTNODE_EVENTS, CONFIG_MODE_IMMEDIATE_UPDATE ) -{ - // the supported event names - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_STARTAPP] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_CLOSEAPP] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_DOCCREATED] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_CREATEDOC] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_LOADFINISHED] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_OPENDOC] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_PREPARECLOSEDOC] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_CLOSEDOC] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEDOC] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEDOCDONE] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEDOCFAILED] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEASDOC] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEASDOCDONE] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEASDOCFAILED] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVETODOC] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVETODOCDONE] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVETODOCFAILED] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_ACTIVATEDOC] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_DEACTIVATEDOC] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_PRINTDOC] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_VIEWCREATED] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_PREPARECLOSEVIEW] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_CLOSEVIEW] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_MODIFYCHANGED] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_TITLECHANGED] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_VISAREACHANGED] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_MODECHANGED] ) ); - m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_STORAGECHANGED] ) ); - - initBindingInfo(); - -/*TODO: Not used in the moment! see Notify() ... - // Enable notification mechanism of our baseclass. - // We need it to get information about changes outside these class on our used configuration keys! */ - Sequence< OUString > aNotifySeq( 1 ); - aNotifySeq[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "Events" )); - EnableNotification( aNotifySeq, sal_True ); -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -GlobalEventConfig_Impl::~GlobalEventConfig_Impl() -{ - // We must save our current values .. if user forget it! - if( IsModified() == sal_True ) - { - Commit(); - } -} - -::rtl::OUString GlobalEventConfig_Impl::GetEventName( sal_Int32 nIndex ) -{ - if ( nIndex < (sal_Int32) m_supportedEvents.size() ) - return m_supportedEvents[nIndex]; - else - return rtl::OUString(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void GlobalEventConfig_Impl::Notify( const Sequence< OUString >& ) -{ - MutexGuard aGuard( GlobalEventConfig::GetOwnStaticMutex() ); - - initBindingInfo(); - - // dont forget to update all existing frames and her might cached dispatch objects! - // But look for already killed frames. We hold weak references instead of hard ones ... - for (FrameVector::const_iterator pIt = m_lFrames.begin(); - pIt != m_lFrames.end() ; - ++pIt ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame(pIt->get(), ::com::sun::star::uno::UNO_QUERY); - if (xFrame.is()) - xFrame->contextChanged(); - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void GlobalEventConfig_Impl::Commit() -{ - //DF need to check it this is correct?? - OSL_TRACE("In GlobalEventConfig_Impl::Commit"); - EventBindingHash::const_iterator it = m_eventBindingHash.begin(); - EventBindingHash::const_iterator it_end = m_eventBindingHash.end(); - // clear the existing nodes - ClearNodeSet( SETNODE_BINDINGS ); - Sequence< beans::PropertyValue > seqValues( 1 ); - OUString sNode; - static const OUString sPrefix(SETNODE_BINDINGS + PATHDELIMITER + OUString::createFromAscii("BindingType['")); - static const OUString sPostfix(OUString::createFromAscii("']") + PATHDELIMITER + PROPERTYNAME_BINDINGURL); - //step through the list of events - for(int i=0;it!=it_end;++it,++i) - { - //no point in writing out empty bindings! - if(it->second.getLength() == 0 ) - continue; - sNode = sPrefix + it->first + sPostfix; - OSL_TRACE("writing binding for: %s",::rtl::OUStringToOString(sNode , RTL_TEXTENCODING_ASCII_US ).pData->buffer); - seqValues[ 0 ].Name = sNode; - seqValues[ 0 ].Value <<= it->second; - //write the data to the registry - SetSetProperties(SETNODE_BINDINGS,seqValues); - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void GlobalEventConfig_Impl::EstablishFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame) -{ - // check if frame already exists inside list - // ignore double registrations - // every frame must be notified one times only! - ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XFrame > xWeak(xFrame); - FrameVector::const_iterator pIt = ::std::find(m_lFrames.begin(), m_lFrames.end(), xWeak); - if (pIt == m_lFrames.end()) - m_lFrames.push_back(xWeak); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -void GlobalEventConfig_Impl::initBindingInfo() -{ - // Get ALL names of current existing list items in configuration! - Sequence< OUString > lEventNames = GetNodeNames( SETNODE_BINDINGS, utl::CONFIG_NAME_LOCAL_PATH ); - - OUString aSetNode( SETNODE_BINDINGS ); - aSetNode += PATHDELIMITER; - - OUString aCommandKey( PATHDELIMITER ); - aCommandKey += PROPERTYNAME_BINDINGURL; - - // Expand all keys - Sequence< OUString > lMacros(1); - for (sal_Int32 i=0; ibuffer); - Sequence< Any > lValues = GetProperties( lMacros ); - OUString sMacroURL; - if( lValues.getLength() > 0 ) - { - lValues[0] >>= sMacroURL; - sal_Int32 startIndex = lEventNames[i].indexOf('\''); - sal_Int32 endIndex = lEventNames[i].lastIndexOf('\''); - if( startIndex >=0 && endIndex > 0 ) - { - startIndex++; - OUString eventName = lEventNames[i].copy(startIndex,endIndex-startIndex); - m_eventBindingHash[ eventName ] = sMacroURL; - } - } - } -} - -Reference< container::XNameReplace > SAL_CALL GlobalEventConfig_Impl::getEvents() throw (::com::sun::star::uno::RuntimeException) -{ - //how to return this object as an XNameReplace? - Reference< container::XNameReplace > ret; - return ret; -} - -void SAL_CALL GlobalEventConfig_Impl::replaceByName( const OUString& aName, const Any& aElement ) throw (lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, RuntimeException) -{ - Sequence< beans::PropertyValue > props; - //DF should we prepopulate the hash with a list of valid event Names? - if( sal_False == ( aElement >>= props ) ) - { - throw lang::IllegalArgumentException( OUString(), - Reference< XInterface > (), 2); - } - OUString macroURL; - sal_Int32 nPropCount = props.getLength(); - for( sal_Int32 index = 0 ; index < nPropCount ; ++index ) - { - if ( props[ index ].Name.compareToAscii( "Script" ) == 0 ) - props[ index ].Value >>= macroURL; - } - m_eventBindingHash[ aName ] = macroURL; - SetModified(); -} - -Any SAL_CALL GlobalEventConfig_Impl::getByName( const OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, RuntimeException) -{ - Any aRet; - Sequence< beans::PropertyValue > props(2); - props[0].Name = OUString::createFromAscii("EventType"); - props[0].Value <<= OUString::createFromAscii("Script"); - props[1].Name = OUString::createFromAscii("Script"); - EventBindingHash::const_iterator it = m_eventBindingHash.find( aName ); - if( it != m_eventBindingHash.end() ) - { - props[1].Value <<= it->second; - } - else - { - // not yet accessed - is it a supported name? - SupportedEventsVector::const_iterator pos = ::std::find( - m_supportedEvents.begin(), m_supportedEvents.end(), aName ); - if ( pos == m_supportedEvents.end() ) - throw container::NoSuchElementException( aName, NULL ); - - props[1].Value <<= OUString(); - } - aRet <<= props; - return aRet; -} - -Sequence< OUString > SAL_CALL GlobalEventConfig_Impl::getElementNames( ) throw (RuntimeException) -{ - const ::rtl::OUString* pRet = m_supportedEvents.empty() ? NULL : &m_supportedEvents[0]; - return uno::Sequence< ::rtl::OUString >(pRet, m_supportedEvents.size()); -} - -sal_Bool SAL_CALL GlobalEventConfig_Impl::hasByName( const OUString& aName ) throw (RuntimeException) -{ - if ( m_eventBindingHash.find( aName ) != m_eventBindingHash.end() ) - return sal_True; - - // never accessed before - is it supported in general? - SupportedEventsVector::const_iterator pos = ::std::find( - m_supportedEvents.begin(), m_supportedEvents.end(), aName ); - if ( pos != m_supportedEvents.end() ) - return sal_True; - - return sal_False; -} - -Type SAL_CALL GlobalEventConfig_Impl::getElementType( ) throw (RuntimeException) -{ - //DF definitly not sure about this?? - return ::getCppuType((const Sequence*)0); -} - -sal_Bool SAL_CALL GlobalEventConfig_Impl::hasElements( ) throw (RuntimeException) -{ - return ( m_eventBindingHash.empty() ); -} - -// and now the wrapper - - -//initialize static member -GlobalEventConfig_Impl* GlobalEventConfig::m_pImpl = NULL ; -sal_Int32 GlobalEventConfig::m_nRefCount = 0 ; - -GlobalEventConfig::GlobalEventConfig() -{ - // Global access, must be guarded (multithreading!). - MutexGuard aGuard( GetOwnStaticMutex() ); - // Increase our refcount ... - ++m_nRefCount; - // ... and initialize our data container only if it not already exist! - if( m_pImpl == NULL ) - { - m_pImpl = new GlobalEventConfig_Impl; - ItemHolder1::holdConfigItem(E_EVENTCFG); - } -} - -GlobalEventConfig::~GlobalEventConfig() -{ - // Global access, must be guarded (multithreading!) - MutexGuard aGuard( GetOwnStaticMutex() ); - // Decrease our refcount. - --m_nRefCount; - // If last instance was deleted ... - // we must destroy our static data container! - if( m_nRefCount <= 0 ) - { - delete m_pImpl; - m_pImpl = NULL; - } -} - -void GlobalEventConfig::EstablishFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pImpl->EstablishFrameCallback( xFrame ); -} - -Reference< container::XNameReplace > SAL_CALL GlobalEventConfig::getEvents() throw (::com::sun::star::uno::RuntimeException) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - Reference< container::XNameReplace > ret(this); - return ret; -} - -void SAL_CALL GlobalEventConfig::replaceByName( const OUString& aName, const Any& aElement ) throw (lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, RuntimeException) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pImpl->replaceByName( aName, aElement ); -} -Any SAL_CALL GlobalEventConfig::getByName( const OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, RuntimeException) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pImpl->getByName( aName ); -} -Sequence< OUString > SAL_CALL GlobalEventConfig::getElementNames( ) throw (RuntimeException) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pImpl->getElementNames( ); -} -sal_Bool SAL_CALL GlobalEventConfig::hasByName( const OUString& aName ) throw (RuntimeException) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pImpl->hasByName( aName ); -} -Type SAL_CALL GlobalEventConfig::getElementType( ) throw (RuntimeException) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pImpl->getElementType( ); -} -sal_Bool SAL_CALL GlobalEventConfig::hasElements( ) throw (RuntimeException) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pImpl->hasElements( ); -} - -Mutex& GlobalEventConfig::GetOwnStaticMutex() -{ - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect following code with - // the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that - // another instance of our class will be faster then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; -} - -::rtl::OUString GlobalEventConfig::GetEventName( sal_Int32 nIndex ) -{ - return GlobalEventConfig().m_pImpl->GetEventName( nIndex ); -} - diff --git a/svtools/source/config/extendedsecurityoptions.cxx b/svtools/source/config/extendedsecurityoptions.cxx deleted file mode 100644 index 2f3c57ea4748..000000000000 --- a/svtools/source/config/extendedsecurityoptions.cxx +++ /dev/null @@ -1,541 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: extendedsecurityoptions.cxx,v $ - * $Revision: 1.10 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include -#include "itemholder1.hxx" - -//_________________________________________________________________________________________________________________ -// namespaces -//_________________________________________________________________________________________________________________ - -using namespace ::utl ; -using namespace ::rtl ; -using namespace ::osl ; -using namespace ::com::sun::star::uno ; - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -#define ROOTNODE_SECURITY OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Security")) - -#define SECURE_EXTENSIONS_SET OUString(RTL_CONSTASCII_USTRINGPARAM("SecureExtensions")) -#define EXTENSION_PROPNAME OUString(RTL_CONSTASCII_USTRINGPARAM("/Extension")) - -#define PROPERTYNAME_HYPERLINKS_OPEN OUString(RTL_CONSTASCII_USTRINGPARAM("Hyperlinks/Open")) - -#define PROPERTYHANDLE_HYPERLINKS_OPEN 0 - -#define PROPERTYCOUNT 1 - -//_________________________________________________________________________________________________________________ -// private declarations! -//_________________________________________________________________________________________________________________ - -struct OUStringHashCode -{ - size_t operator()( const ::rtl::OUString& sString ) const - { - return sString.hashCode(); - } -}; - -class ExtensionHashMap : public ::std::hash_map< ::rtl::OUString, - sal_Int32, - OUStringHashCode, - ::std::equal_to< ::rtl::OUString > > -{ - public: - inline void free() - { - ExtensionHashMap().swap( *this ); - } -}; - -class SvtExtendedSecurityOptions_Impl : public ConfigItem -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - SvtExtendedSecurityOptions_Impl(); - ~SvtExtendedSecurityOptions_Impl(); - - //--------------------------------------------------------------------------------------------------------- - // overloaded methods of baseclass - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short called for notify of configmanager - @descr These method is called from the ConfigManager before application ends or from the - PropertyChangeListener if the sub tree broadcasts changes. You must update your - internal values. - - @seealso baseclass ConfigItem - - @param "seqPropertyNames" is the list of properties which should be updated. - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Notify( const Sequence< OUString >& seqPropertyNames ); - - /*-****************************************************************************************************//** - @short write changes to configuration - @descr These method writes the changed values into the sub tree - and should always called in our destructor to guarantee consistency of config data. - - @seealso baseclass ConfigItem - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Commit(); - - //--------------------------------------------------------------------------------------------------------- - // public interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short Access method to check for security problems - @descr Different methods to check for security related problems. - - @seealso - - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - sal_Bool IsSecureHyperlink( const rtl::OUString& aURL ) const; - Sequence< rtl::OUString > GetSecureExtensionList() const; - - SvtExtendedSecurityOptions::OpenHyperlinkMode GetOpenHyperlinkMode(); - void SetOpenHyperlinkMode( SvtExtendedSecurityOptions::OpenHyperlinkMode aMode ); - sal_Bool IsOpenHyperlinkModeReadOnly() const; - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return list of key names of ouer configuration management which represent oue module tree - @descr These methods return a static const list of key names. We need it to get needed values from our - configuration management. - - @seealso - - - @param - - @return A list of needed configuration keys is returned. - - @onerror - - *//*-*****************************************************************************************************/ - - static Sequence< OUString > GetPropertyNames(); - - /*-****************************************************************************************************//** - @short Fills the hash map with all extensions known to be secure - @descr These methods fills the given hash map object with all extensions known to be secure. - - @seealso - - - @param aHashMap - A hash map to be filled with secure extension strings. - @return - - - @onerror - - *//*-*****************************************************************************************************/ - void FillExtensionHashMap( ExtensionHashMap& aHashMap ); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - OUString m_aSecureExtensionsSetName; - OUString m_aExtensionPropName; - - SvtExtendedSecurityOptions::OpenHyperlinkMode m_eOpenHyperlinkMode; - sal_Bool m_bROOpenHyperlinkMode; - ExtensionHashMap m_aExtensionHashMap; -}; - -//_________________________________________________________________________________________________________________ -// definitions -//_________________________________________________________________________________________________________________ - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtExtendedSecurityOptions_Impl::SvtExtendedSecurityOptions_Impl() - // Init baseclasses first - : ConfigItem ( ROOTNODE_SECURITY ), - m_aSecureExtensionsSetName( SECURE_EXTENSIONS_SET ), - m_aExtensionPropName( EXTENSION_PROPNAME ), - m_bROOpenHyperlinkMode(sal_False) - // Init member then. -{ - // Fill the extension hash map with all secure extension strings - FillExtensionHashMap( m_aExtensionHashMap ); - - Sequence< OUString > seqNames = GetPropertyNames(); - Sequence< Any > seqValues = GetProperties( seqNames ); - Sequence< sal_Bool > seqRO = GetReadOnlyStates ( seqNames ); - - sal_Int32 nPropertyCount = seqValues.getLength(); - for( sal_Int32 nProperty=0; nProperty>= nMode ) - m_eOpenHyperlinkMode = (SvtExtendedSecurityOptions::OpenHyperlinkMode)nMode; - else { - DBG_ERROR("Wrong type for Open mode!"); - } - m_bROOpenHyperlinkMode = seqRO[nProperty]; - } - break; - } - } - - // Enable notification mechanism of our baseclass. - // We need it to get information about changes outside these class on ouer used configuration keys! - Sequence< OUString > seqNotifyNames( 1 ); - seqNotifyNames[0] = m_aSecureExtensionsSetName; - EnableNotification( seqNotifyNames ); -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtExtendedSecurityOptions_Impl::~SvtExtendedSecurityOptions_Impl() -{ - // We must save our current values .. if user forget it! - if( IsModified() == sal_True ) - { - Commit(); - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtExtendedSecurityOptions_Impl::Notify( const Sequence< OUString >& ) -{ - // Not implemented -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtExtendedSecurityOptions_Impl::Commit() -{ - // Get names of supported properties, create a list for values and copy current values to it. - Sequence< OUString > seqNames = GetPropertyNames (); - sal_Int32 nCount = seqNames.getLength(); - Sequence< Any > seqValues ( nCount ); - for( sal_Int32 nProperty=0; nProperty SvtExtendedSecurityOptions_Impl::GetSecureExtensionList() const -{ - Sequence< OUString > aResult( m_aExtensionHashMap.size() ); - - sal_Int32 nIndex = 0; - for ( ExtensionHashMap::const_iterator pIter = m_aExtensionHashMap.begin(); - pIter != m_aExtensionHashMap.end(); pIter++ ) - { - aResult[nIndex++] = pIter->first; - } - - return aResult; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -SvtExtendedSecurityOptions::OpenHyperlinkMode SvtExtendedSecurityOptions_Impl::GetOpenHyperlinkMode() -{ - return m_eOpenHyperlinkMode; -} -/* -----------------09.07.2003 11:26----------------- - - --------------------------------------------------*/ -sal_Bool SvtExtendedSecurityOptions_Impl::IsOpenHyperlinkModeReadOnly() const -{ - return m_bROOpenHyperlinkMode; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtExtendedSecurityOptions_Impl::SetOpenHyperlinkMode( SvtExtendedSecurityOptions::OpenHyperlinkMode eNewMode ) -{ - m_eOpenHyperlinkMode = eNewMode; - SetModified(); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -void SvtExtendedSecurityOptions_Impl::FillExtensionHashMap( ExtensionHashMap& aHashMap ) -{ - // Get sequence with secure extensions from configuration - Sequence< OUString > seqNodes = GetNodeNames( m_aSecureExtensionsSetName ); - - OUString aValue; - Sequence< Any > aValues; - Sequence< OUString > aPropSeq( 1 ); - for ( int i = 0; i < seqNodes.getLength(); i++ ) - { - // Create access name for property - OUStringBuffer aExtEntryProp( m_aSecureExtensionsSetName ); - aExtEntryProp.appendAscii( "/" ); - aExtEntryProp.append( seqNodes[i] ); - aExtEntryProp.append( m_aExtensionPropName ); - - aPropSeq[0] = aExtEntryProp.makeStringAndClear(); - aValues = GetProperties( aPropSeq ); - if ( aValues.getLength() == 1 ) - { - // Don't use value if sequence has not the correct length - if ( aValues[0] >>= aValue ) - // Add extension into secure extensions hash map - aHashMap.insert( ExtensionHashMap::value_type( aValue.toAsciiLowerCase(), 1 ) ); - else - { - DBG_ERRORFILE( "SvtExtendedSecurityOptions_Impl::FillExtensionHashMap(): not string value?" ); - } - } - } -} - -//***************************************************************************************************************** -// private method (currently not used) -//***************************************************************************************************************** -Sequence< OUString > SvtExtendedSecurityOptions_Impl::GetPropertyNames() -{ - // Build static list of configuration key names. - static const OUString pProperties[] = - { - PROPERTYNAME_HYPERLINKS_OPEN - }; - // Initialize return sequence with these list ... - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); - // ... and return it. - return seqPropertyNames; -} - -//***************************************************************************************************************** -// initialize static member -// DON'T DO IT IN YOUR HEADER! -// see definition for further informations -//***************************************************************************************************************** -SvtExtendedSecurityOptions_Impl* SvtExtendedSecurityOptions::m_pDataContainer = NULL ; -sal_Int32 SvtExtendedSecurityOptions::m_nRefCount = 0 ; - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtExtendedSecurityOptions::SvtExtendedSecurityOptions() -{ - // Global access, must be guarded (multithreading!). - MutexGuard aGuard( GetInitMutex() ); - // Increase ouer refcount ... - ++m_nRefCount; - // ... and initialize ouer data container only if it not already exist! - if( m_pDataContainer == NULL ) - { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtExtendedSecurityOptions_Impl::ctor()"); - m_pDataContainer = new SvtExtendedSecurityOptions_Impl; - - ItemHolder1::holdConfigItem(E_EXTENDEDSECURITYOPTIONS); - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtExtendedSecurityOptions::~SvtExtendedSecurityOptions() -{ - // Global access, must be guarded (multithreading!) - MutexGuard aGuard( GetInitMutex() ); - // Decrease ouer refcount. - --m_nRefCount; - // If last instance was deleted ... - // we must destroy ouer static data container! - if( m_nRefCount <= 0 ) - { - delete m_pDataContainer; - m_pDataContainer = NULL; - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtExtendedSecurityOptions::IsSecureHyperlink( const rtl::OUString& aURL ) const -{ - MutexGuard aGuard( GetInitMutex() ); - return m_pDataContainer->IsSecureHyperlink( aURL ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -Sequence< rtl::OUString > SvtExtendedSecurityOptions::GetSecureExtensionList() const -{ - MutexGuard aGuard( GetInitMutex() ); - return m_pDataContainer->GetSecureExtensionList(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -SvtExtendedSecurityOptions::OpenHyperlinkMode SvtExtendedSecurityOptions::GetOpenHyperlinkMode() -{ - MutexGuard aGuard( GetInitMutex() ); - return m_pDataContainer->GetOpenHyperlinkMode(); -} -/* -----------------09.07.2003 11:26----------------- - - --------------------------------------------------*/ -sal_Bool SvtExtendedSecurityOptions::IsOpenHyperlinkModeReadOnly() const -{ - return m_pDataContainer->IsOpenHyperlinkModeReadOnly(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtExtendedSecurityOptions::SetOpenHyperlinkMode( SvtExtendedSecurityOptions::OpenHyperlinkMode eMode ) -{ - MutexGuard aGuard( GetInitMutex() ); - m_pDataContainer->SetOpenHyperlinkMode( eMode ); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Mutex& SvtExtendedSecurityOptions::GetInitMutex() -{ - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; -} diff --git a/svtools/source/config/fltrcfg.cxx b/svtools/source/config/fltrcfg.cxx deleted file mode 100644 index 056826bf62ba..000000000000 --- a/svtools/source/config/fltrcfg.cxx +++ /dev/null @@ -1,611 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: fltrcfg.cxx,v $ - * $Revision: 1.12 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include "fltrcfg.hxx" -#include - -#include -#include -#include - -using namespace utl; -using namespace rtl; -using namespace com::sun::star::uno; - -#define C2U(cChar) OUString::createFromAscii(cChar) - -// ----------------------------------------------------------------------- -#define FILTERCFG_WORD_CODE 0x0001 -#define FILTERCFG_WORD_STORAGE 0x0002 -#define FILTERCFG_EXCEL_CODE 0x0004 -#define FILTERCFG_EXCEL_STORAGE 0x0008 -#define FILTERCFG_PPOINT_CODE 0x0010 -#define FILTERCFG_PPOINT_STORAGE 0x0020 -#define FILTERCFG_MATH_LOAD 0x0100 -#define FILTERCFG_MATH_SAVE 0x0200 -#define FILTERCFG_WRITER_LOAD 0x0400 -#define FILTERCFG_WRITER_SAVE 0x0800 -#define FILTERCFG_CALC_LOAD 0x1000 -#define FILTERCFG_CALC_SAVE 0x2000 -#define FILTERCFG_IMPRESS_LOAD 0x4000 -#define FILTERCFG_IMPRESS_SAVE 0x8000 -#define FILTERCFG_EXCEL_EXECTBL 0x10000 -#define FILTERCFG_ENABLE_PPT_PREVIEW 0x20000 -#define FILTERCFG_ENABLE_EXCEL_PREVIEW 0x40000 -#define FILTERCFG_ENABLE_WORD_PREVIEW 0x80000 -#define FILTERCFG_USE_ENHANCED_FIELDS 0x100000 - -static SvtFilterOptions* pOptions=0; - -/* -----------------------------22.01.01 10:23-------------------------------- - - ---------------------------------------------------------------------------*/ -class SvtAppFilterOptions_Impl : public utl::ConfigItem -{ - sal_Bool bLoadVBA; - sal_Bool bSaveVBA; -public: - SvtAppFilterOptions_Impl(const OUString& rRoot) : - utl::ConfigItem(rRoot), - bLoadVBA(sal_False), - bSaveVBA(sal_False) {} - ~SvtAppFilterOptions_Impl(); - virtual void Commit(); - void Load(); - - sal_Bool IsLoad() const {return bLoadVBA;} - void SetLoad(sal_Bool bSet) - { - if(bSet != bLoadVBA) - SetModified(); - bLoadVBA = bSet; - } - sal_Bool IsSave() const {return bSaveVBA;} - void SetSave(sal_Bool bSet) - { - if(bSet != bSaveVBA) - SetModified(); - bSaveVBA = bSet; - } -}; - -/* -----------------------------22.01.01 11:08-------------------------------- - - ---------------------------------------------------------------------------*/ -SvtAppFilterOptions_Impl::~SvtAppFilterOptions_Impl() -{ - if(IsModified()) - Commit(); -} -/* -----------------------------22.01.01 10:38-------------------------------- - - ---------------------------------------------------------------------------*/ -void SvtAppFilterOptions_Impl::Commit() -{ - Sequence aNames(2); - OUString* pNames = aNames.getArray(); - pNames[0] = C2U("Load"); - pNames[1] = C2U("Save"); - Sequence aValues(aNames.getLength()); - Any* pValues = aValues.getArray(); - - const Type& rType = ::getBooleanCppuType(); - pValues[0].setValue(&bLoadVBA, rType); - pValues[1].setValue(&bSaveVBA, rType); - - PutProperties(aNames, aValues); -} -/* -----------------------------22.01.01 10:38-------------------------------- - - ---------------------------------------------------------------------------*/ -void SvtAppFilterOptions_Impl::Load() -{ - Sequence aNames(2); - OUString* pNames = aNames.getArray(); - pNames[0] = C2U("Load"); - pNames[1] = C2U("Save"); - - Sequence aValues = GetProperties(aNames); - const Any* pValues = aValues.getConstArray(); - - if(pValues[0].hasValue()) - bLoadVBA = *(sal_Bool*)pValues[0].getValue(); - if(pValues[1].hasValue()) - bSaveVBA = *(sal_Bool*)pValues[1].getValue(); -} - -// ----------------------------------------------------------------------- -class SvtCalcFilterOptions_Impl : public SvtAppFilterOptions_Impl -{ - sal_Bool bLoadExecutable; -public: - SvtCalcFilterOptions_Impl(const OUString& rRoot) : - SvtAppFilterOptions_Impl(rRoot), - bLoadExecutable(sal_False) - {} - virtual void Commit(); - void Load(); - - sal_Bool IsLoadExecutable() const {return bLoadExecutable;} - void SetLoadExecutable(sal_Bool bSet) - { - if(bSet != bLoadExecutable) - SetModified(); - bLoadExecutable = bSet; - } -}; - -void SvtCalcFilterOptions_Impl::Commit() -{ - SvtAppFilterOptions_Impl::Commit(); - - Sequence aNames(1); - aNames[0] = C2U("Executable"); - Sequence aValues(1); - aValues[0] <<= bLoadExecutable; - - PutProperties(aNames, aValues); -} - -void SvtCalcFilterOptions_Impl::Load() -{ - SvtAppFilterOptions_Impl::Load(); - - Sequence aNames(1); - aNames[0] = C2U("Executable"); - - Sequence aValues = GetProperties(aNames); - const Any* pValues = aValues.getConstArray(); - if(pValues[0].hasValue()) - bLoadExecutable = *(sal_Bool*)pValues[0].getValue(); -} - -/* -----------------------------22.01.01 10:32-------------------------------- - - ---------------------------------------------------------------------------*/ -struct SvtFilterOptions_Impl -{ - ULONG nFlags; - SvtAppFilterOptions_Impl aWriterCfg; - SvtCalcFilterOptions_Impl aCalcCfg; - SvtAppFilterOptions_Impl aImpressCfg; - - SvtFilterOptions_Impl() : - aWriterCfg(C2U("Office.Writer/Filter/Import/VBA")), - aCalcCfg(C2U("Office.Calc/Filter/Import/VBA")), - aImpressCfg(C2U("Office.Impress/Filter/Import/VBA")) - { - nFlags = FILTERCFG_WORD_CODE | - FILTERCFG_WORD_STORAGE | - FILTERCFG_EXCEL_CODE | - FILTERCFG_EXCEL_STORAGE | - FILTERCFG_PPOINT_CODE | - FILTERCFG_PPOINT_STORAGE | - FILTERCFG_MATH_LOAD | - FILTERCFG_MATH_SAVE | - FILTERCFG_WRITER_LOAD | - FILTERCFG_WRITER_SAVE | - FILTERCFG_CALC_LOAD | - FILTERCFG_CALC_SAVE | - FILTERCFG_IMPRESS_LOAD | - FILTERCFG_IMPRESS_SAVE | - FILTERCFG_USE_ENHANCED_FIELDS; - Load(); - } - - void SetFlag( ULONG nFlag, BOOL bSet ); - BOOL IsFlag( ULONG nFlag ) const; - void Load() - { - aWriterCfg.Load(); - aCalcCfg.Load(); - aImpressCfg.Load(); - } -}; -/* -----------------------------22.01.01 10:34-------------------------------- - - ---------------------------------------------------------------------------*/ -void SvtFilterOptions_Impl::SetFlag( ULONG nFlag, BOOL bSet ) -{ - switch(nFlag) - { - case FILTERCFG_WORD_CODE: aWriterCfg.SetLoad(bSet);break; - case FILTERCFG_WORD_STORAGE: aWriterCfg.SetSave(bSet);break; - case FILTERCFG_EXCEL_CODE: aCalcCfg.SetLoad(bSet);break; - case FILTERCFG_EXCEL_STORAGE: aCalcCfg.SetSave(bSet);break; - case FILTERCFG_EXCEL_EXECTBL: aCalcCfg.SetLoadExecutable(bSet);break; - case FILTERCFG_PPOINT_CODE: aImpressCfg.SetLoad(bSet);break; - case FILTERCFG_PPOINT_STORAGE: aImpressCfg.SetSave(bSet);break; - default: - if( bSet ) - nFlags |= nFlag; - else - nFlags &= ~nFlag; - } -} -/* -----------------------------22.01.01 10:35-------------------------------- - - ---------------------------------------------------------------------------*/ -BOOL SvtFilterOptions_Impl::IsFlag( ULONG nFlag ) const -{ - BOOL bRet; - switch(nFlag) - { - case FILTERCFG_WORD_CODE : bRet = aWriterCfg.IsLoad();break; - case FILTERCFG_WORD_STORAGE : bRet = aWriterCfg.IsSave();break; - case FILTERCFG_EXCEL_CODE : bRet = aCalcCfg.IsLoad();break; - case FILTERCFG_EXCEL_STORAGE : bRet = aCalcCfg.IsSave();break; - case FILTERCFG_EXCEL_EXECTBL : bRet = aCalcCfg.IsLoadExecutable();break; - case FILTERCFG_PPOINT_CODE : bRet = aImpressCfg.IsLoad();break; - case FILTERCFG_PPOINT_STORAGE : bRet = aImpressCfg.IsSave();break; - default: - bRet = 0 != (nFlags & nFlag ); - } - return bRet; -} - -// ----------------------------------------------------------------------- - -SvtFilterOptions::SvtFilterOptions() : - ConfigItem( C2U("Office.Common/Filter/Microsoft") ), - pImp(new SvtFilterOptions_Impl) -{ - RTL_LOGFILE_CONTEXT(aLog, "svtools SvtFilterOptions::SvtFilterOptions()"); - EnableNotification(GetPropertyNames()); - Load(); -} -// ----------------------------------------------------------------------- -SvtFilterOptions::~SvtFilterOptions() -{ - delete pImp; -} -/* -----------------------------22.01.01 08:45-------------------------------- - - ---------------------------------------------------------------------------*/ -const Sequence& SvtFilterOptions::GetPropertyNames() -{ - static Sequence aNames; - if(!aNames.getLength()) - { - int nCount = 12; - aNames.realloc(nCount); - static const char* aPropNames[] = - { - "Import/MathTypeToMath", // 0 - "Import/WinWordToWriter", // 1 - "Import/PowerPointToImpress", // 2 - "Import/ExcelToCalc", // 3 - "Export/MathToMathType", // 4 - "Export/WriterToWinWord", // 5 - "Export/ImpressToPowerPoint", // 6 - "Export/CalcToExcel", // 7 - "Export/EnablePowerPointPreview", // 8 - "Export/EnableExcelPreview", // 9 - "Export/EnableWordPreview", // 10 - "Import/ImportWWFieldsAsEnhancedFields" // 11 - }; - OUString* pNames = aNames.getArray(); - for(int i = 0; i < nCount; i++) - pNames[i] = C2U(aPropNames[i]); - } - return aNames; -} -//----------------------------------------------------------------------- -static ULONG lcl_GetFlag(sal_Int32 nProp) -{ - ULONG nFlag = 0; - switch(nProp) - { - case 0: nFlag = FILTERCFG_MATH_LOAD; break; - case 1: nFlag = FILTERCFG_WRITER_LOAD; break; - case 2: nFlag = FILTERCFG_IMPRESS_LOAD; break; - case 3: nFlag = FILTERCFG_CALC_LOAD; break; - case 4: nFlag = FILTERCFG_MATH_SAVE; break; - case 5: nFlag = FILTERCFG_WRITER_SAVE; break; - case 6: nFlag = FILTERCFG_IMPRESS_SAVE; break; - case 7: nFlag = FILTERCFG_CALC_SAVE; break; - case 8: nFlag = FILTERCFG_ENABLE_PPT_PREVIEW; break; - case 9: nFlag = FILTERCFG_ENABLE_EXCEL_PREVIEW; break; - case 10: nFlag = FILTERCFG_ENABLE_WORD_PREVIEW; break; - case 11: nFlag = FILTERCFG_USE_ENHANCED_FIELDS; break; - - default: DBG_ERROR("illegal value"); - } - return nFlag; -} -/*-- 22.01.01 08:53:03--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SvtFilterOptions::Notify( const Sequence& ) -{ - Load(); -} -/*-- 22.01.01 08:53:04--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SvtFilterOptions::Commit() -{ - const Sequence& aNames = GetPropertyNames(); - Sequence aValues(aNames.getLength()); - Any* pValues = aValues.getArray(); - - const Type& rType = ::getBooleanCppuType(); - for(int nProp = 0; nProp < aNames.getLength(); nProp++) - { - ULONG nFlag = lcl_GetFlag(nProp); - sal_Bool bVal = pImp->IsFlag( nFlag); - pValues[nProp].setValue(&bVal, rType); - - } - PutProperties(aNames, aValues); -} -/*-- 22.01.01 08:53:04--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SvtFilterOptions::Load() -{ - pImp->Load(); - const Sequence& rNames = GetPropertyNames(); - Sequence aValues = GetProperties(rNames); - const Any* pValues = aValues.getConstArray(); - DBG_ASSERT(aValues.getLength() == rNames.getLength(), "GetProperties failed"); - if(aValues.getLength() == rNames.getLength()) - { - for(int nProp = 0; nProp < rNames.getLength(); nProp++) - { - if(pValues[nProp].hasValue()) - { - sal_Bool bVal = *(sal_Bool*)pValues[nProp].getValue(); - ULONG nFlag = lcl_GetFlag(nProp); - pImp->SetFlag( nFlag, bVal); - } - } - } -} -// ----------------------------------------------------------------------- - -void SvtFilterOptions::SetLoadWordBasicCode( BOOL bFlag ) -{ - pImp->SetFlag( FILTERCFG_WORD_CODE, bFlag ); - SetModified(); -} - -BOOL SvtFilterOptions::IsLoadWordBasicCode() const -{ - return pImp->IsFlag( FILTERCFG_WORD_CODE ); -} - -void SvtFilterOptions::SetLoadWordBasicStorage( BOOL bFlag ) -{ - pImp->SetFlag( FILTERCFG_WORD_STORAGE, bFlag ); - SetModified(); -} - -BOOL SvtFilterOptions::IsLoadWordBasicStorage() const -{ - return pImp->IsFlag( FILTERCFG_WORD_STORAGE ); -} - -// ----------------------------------------------------------------------- - -void SvtFilterOptions::SetLoadExcelBasicCode( BOOL bFlag ) -{ - pImp->SetFlag( FILTERCFG_EXCEL_CODE, bFlag ); - SetModified(); -} - -BOOL SvtFilterOptions::IsLoadExcelBasicCode() const -{ - return pImp->IsFlag( FILTERCFG_EXCEL_CODE ); -} - -void SvtFilterOptions::SetLoadExcelBasicExecutable( BOOL bFlag ) -{ - pImp->SetFlag( FILTERCFG_EXCEL_EXECTBL, bFlag ); - SetModified(); -} - -BOOL SvtFilterOptions::IsLoadExcelBasicExecutable() const -{ - return pImp->IsFlag( FILTERCFG_EXCEL_EXECTBL ); -} - -void SvtFilterOptions::SetLoadExcelBasicStorage( BOOL bFlag ) -{ - pImp->SetFlag( FILTERCFG_EXCEL_STORAGE, bFlag ); - SetModified(); -} - -BOOL SvtFilterOptions::IsLoadExcelBasicStorage() const -{ - return pImp->IsFlag( FILTERCFG_EXCEL_STORAGE ); -} - -// ----------------------------------------------------------------------- - -void SvtFilterOptions::SetLoadPPointBasicCode( BOOL bFlag ) -{ - pImp->SetFlag( FILTERCFG_PPOINT_CODE, bFlag ); - SetModified(); -} - -BOOL SvtFilterOptions::IsLoadPPointBasicCode() const -{ - return pImp->IsFlag( FILTERCFG_PPOINT_CODE ); -} - -void SvtFilterOptions::SetLoadPPointBasicStorage( BOOL bFlag ) -{ - pImp->SetFlag( FILTERCFG_PPOINT_STORAGE, bFlag ); - SetModified(); -} - -BOOL SvtFilterOptions::IsLoadPPointBasicStorage() const -{ - return pImp->IsFlag( FILTERCFG_PPOINT_STORAGE ); -} - -// ----------------------------------------------------------------------- - -BOOL SvtFilterOptions::IsMathType2Math() const -{ - return pImp->IsFlag( FILTERCFG_MATH_LOAD ); -} - -void SvtFilterOptions::SetMathType2Math( BOOL bFlag ) -{ - pImp->SetFlag( FILTERCFG_MATH_LOAD, bFlag ); - SetModified(); -} - -BOOL SvtFilterOptions::IsMath2MathType() const -{ - return pImp->IsFlag( FILTERCFG_MATH_SAVE ); -} - -void SvtFilterOptions::SetMath2MathType( BOOL bFlag ) -{ - pImp->SetFlag( FILTERCFG_MATH_SAVE, bFlag ); - SetModified(); -} - - -// ----------------------------------------------------------------------- -BOOL SvtFilterOptions::IsWinWord2Writer() const -{ - return pImp->IsFlag( FILTERCFG_WRITER_LOAD ); -} - -void SvtFilterOptions::SetWinWord2Writer( BOOL bFlag ) -{ - pImp->SetFlag( FILTERCFG_WRITER_LOAD, bFlag ); - SetModified(); -} - -BOOL SvtFilterOptions::IsWriter2WinWord() const -{ - return pImp->IsFlag( FILTERCFG_WRITER_SAVE ); -} - -void SvtFilterOptions::SetWriter2WinWord( BOOL bFlag ) -{ - pImp->SetFlag( FILTERCFG_WRITER_SAVE, bFlag ); - SetModified(); -} - -BOOL SvtFilterOptions::IsUseEnhancedFields() const -{ - return false; // disable for now; -// return pImp->IsFlag( FILTERCFG_USE_ENHANCED_FIELDS ); -} - -void SvtFilterOptions::SetUseEnhancedFields( BOOL bFlag ) -{ - pImp->SetFlag( FILTERCFG_USE_ENHANCED_FIELDS, bFlag ); - SetModified(); -} - -// ----------------------------------------------------------------------- -BOOL SvtFilterOptions::IsExcel2Calc() const -{ - return pImp->IsFlag( FILTERCFG_CALC_LOAD ); -} - -void SvtFilterOptions::SetExcel2Calc( BOOL bFlag ) -{ - pImp->SetFlag( FILTERCFG_CALC_LOAD, bFlag ); - SetModified(); -} - -BOOL SvtFilterOptions::IsCalc2Excel() const -{ - return pImp->IsFlag( FILTERCFG_CALC_SAVE ); -} - -void SvtFilterOptions::SetCalc2Excel( BOOL bFlag ) -{ - pImp->SetFlag( FILTERCFG_CALC_SAVE, bFlag ); - SetModified(); -} - - -// ----------------------------------------------------------------------- -BOOL SvtFilterOptions::IsPowerPoint2Impress() const -{ - return pImp->IsFlag( FILTERCFG_IMPRESS_LOAD ); -} - -void SvtFilterOptions::SetPowerPoint2Impress( BOOL bFlag ) -{ - pImp->SetFlag( FILTERCFG_IMPRESS_LOAD, bFlag ); - SetModified(); -} - -BOOL SvtFilterOptions::IsImpress2PowerPoint() const -{ - return pImp->IsFlag( FILTERCFG_IMPRESS_SAVE ); -} - -void SvtFilterOptions::SetImpress2PowerPoint( BOOL bFlag ) -{ - pImp->SetFlag( FILTERCFG_IMPRESS_SAVE, bFlag ); - SetModified(); -} - -SvtFilterOptions* SvtFilterOptions::Get() -{ - if ( !pOptions ) - pOptions = new SvtFilterOptions; - return pOptions; -} - -// ----------------------------------------------------------------------- - -BOOL SvtFilterOptions::IsEnablePPTPreview() const -{ - return pImp->IsFlag( FILTERCFG_ENABLE_PPT_PREVIEW ); -} - - -BOOL SvtFilterOptions::IsEnableCalcPreview() const -{ - return pImp->IsFlag( FILTERCFG_ENABLE_EXCEL_PREVIEW ); -} - - -BOOL SvtFilterOptions::IsEnableWordPreview() const -{ - return pImp->IsFlag( FILTERCFG_ENABLE_WORD_PREVIEW ); -} - - diff --git a/svtools/source/config/fontoptions.cxx b/svtools/source/config/fontoptions.cxx deleted file mode 100644 index 1044344ff567..000000000000 --- a/svtools/source/config/fontoptions.cxx +++ /dev/null @@ -1,514 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: fontoptions.cxx,v $ - * $Revision: 1.10 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include -#include -#include -#include -#include -#include - -#include -#include "itemholder1.hxx" - -//_________________________________________________________________________________________________________________ -// namespaces -//_________________________________________________________________________________________________________________ - -using namespace ::utl ; -using namespace ::rtl ; -using namespace ::osl ; -using namespace ::com::sun::star::uno ; - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -#define ROOTNODE_FONT OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Font" )) - -#define PROPERTYNAME_REPLACEMENTTABLE OUString(RTL_CONSTASCII_USTRINGPARAM("Substitution/Replacement" )) -#define PROPERTYNAME_FONTHISTORY OUString(RTL_CONSTASCII_USTRINGPARAM("View/History" )) -#define PROPERTYNAME_FONTWYSIWYG OUString(RTL_CONSTASCII_USTRINGPARAM("View/ShowFontBoxWYSIWYG" )) - -#define PROPERTYHANDLE_REPLACEMENTTABLE 0 -#define PROPERTYHANDLE_FONTHISTORY 1 -#define PROPERTYHANDLE_FONTWYSIWYG 2 - -#define PROPERTYCOUNT 3 - -//_________________________________________________________________________________________________________________ -// private declarations! -//_________________________________________________________________________________________________________________ - -class SvtFontOptions_Impl : public ConfigItem -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - SvtFontOptions_Impl(); - ~SvtFontOptions_Impl(); - - //--------------------------------------------------------------------------------------------------------- - // overloaded methods of baseclass - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short called for notify of configmanager - @descr These method is called from the ConfigManager before application ends or from the - PropertyChangeListener if the sub tree broadcasts changes. You must update your - internal values. - - @seealso baseclass ConfigItem - - @param "seqPropertyNames" is the list of properties which should be updated. - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Notify( const Sequence< OUString >& seqPropertyNames ); - - /*-****************************************************************************************************//** - @short write changes to configuration - @descr These method writes the changed values into the sub tree - and should always called in our destructor to guarantee consistency of config data. - - @seealso baseclass ConfigItem - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Commit(); - - //--------------------------------------------------------------------------------------------------------- - // public interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short access method to get internal values - @descr These method give us a chance to regulate acces to ouer internal values. - It's not used in the moment - but it's possible for the feature! - - @seealso - - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - sal_Bool IsReplacementTableEnabled ( ) const ; - void EnableReplacementTable ( sal_Bool bState ) ; - - sal_Bool IsFontHistoryEnabled ( ) const ; - void EnableFontHistory ( sal_Bool bState ) ; - - sal_Bool IsFontWYSIWYGEnabled ( ) const ; - void EnableFontWYSIWYG ( sal_Bool bState ) ; - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return list of key names of ouer configuration management which represent oue module tree - @descr These methods return a static const list of key names. We need it to get needed values from our - configuration management. - - @seealso - - - @param - - @return A list of needed configuration keys is returned. - - @onerror - - *//*-*****************************************************************************************************/ - - static Sequence< OUString > impl_GetPropertyNames(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - sal_Bool m_bReplacementTable ; - sal_Bool m_bFontHistory ; - sal_Bool m_bFontWYSIWYG ; -}; - -//_________________________________________________________________________________________________________________ -// definitions -//_________________________________________________________________________________________________________________ - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtFontOptions_Impl::SvtFontOptions_Impl() - // Init baseclasses first - : ConfigItem ( ROOTNODE_FONT ) - // Init member then. - , m_bReplacementTable ( sal_False ) - , m_bFontHistory ( sal_False ) - , m_bFontWYSIWYG ( sal_False ) -{ - // Use our static list of configuration keys to get his values. - Sequence< OUString > seqNames = impl_GetPropertyNames ( ); - Sequence< Any > seqValues = GetProperties ( seqNames ); - - // Safe impossible cases. - // We need values from ALL configuration keys. - // Follow assignment use order of values in relation to our list of key names! - DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtFontOptions_Impl::SvtFontOptions_Impl()\nI miss some values of configuration keys!\n" ); - - // Copy values from list in right order to ouer internal member. - sal_Int32 nPropertyCount = seqValues.getLength(); - for( sal_Int32 nProperty=0; nProperty>= m_bReplacementTable; - } - break; - case PROPERTYHANDLE_FONTHISTORY : { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtFontOptions_Impl::SvtFontOptions_Impl()\nWho has changed the value type of \"Office.Common\\Font\\View\\History\"?" ); - seqValues[nProperty] >>= m_bFontHistory; - } - break; - case PROPERTYHANDLE_FONTWYSIWYG : { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtFontOptions_Impl::SvtFontOptions_Impl()\nWho has changed the value type of \"Office.Common\\Font\\View\\ShowFontBoxWYSIWYG\"?" ); - seqValues[nProperty] >>= m_bFontWYSIWYG; - } - break; - } - } - - // Enable notification mechanism of ouer baseclass. - // We need it to get information about changes outside these class on ouer used configuration keys! - EnableNotification( seqNames ); -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtFontOptions_Impl::~SvtFontOptions_Impl() -{ - // We must save our current values .. if user forget it! - if( IsModified() == sal_True ) - { - Commit(); - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtFontOptions_Impl::Notify( const Sequence< OUString >& seqPropertyNames ) -{ - // Use given list of updated properties to get his values from configuration directly! - Sequence< Any > seqValues = GetProperties( seqPropertyNames ); - // Safe impossible cases. - // We need values from ALL notified configuration keys. - DBG_ASSERT( !(seqPropertyNames.getLength()!=seqValues.getLength()), "SvtFontOptions_Impl::Notify()\nI miss some values of configuration keys!\n" ); - // Step over list of property names and get right value from coreesponding value list to set it on internal members! - sal_Int32 nCount = seqPropertyNames.getLength(); - for( sal_Int32 nProperty=0; nProperty>= m_bReplacementTable; - } - else - if( seqPropertyNames[nProperty] == PROPERTYNAME_FONTHISTORY ) - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtFontOptions_Impl::Notify()\nWho has changed the value type of \"Office.Common\\Font\\View\\History\"?" ); - seqValues[nProperty] >>= m_bFontHistory; - } - else - if( seqPropertyNames[nProperty] == PROPERTYNAME_FONTWYSIWYG ) - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtFontOptions_Impl::Notify()\nWho has changed the value type of \"Office.Common\\Font\\View\\ShowFontBoxWYSIWYG\"?" ); - seqValues[nProperty] >>= m_bFontWYSIWYG; - } - #if OSL_DEBUG_LEVEL > 1 - else DBG_ASSERT( sal_False, "SvtFontOptions_Impl::Notify()\nUnkown property detected ... I can't handle these!\n" ); - #endif - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtFontOptions_Impl::Commit() -{ - // Get names of supported properties, create a list for values and copy current values to it. - Sequence< OUString > seqNames = impl_GetPropertyNames(); - sal_Int32 nCount = seqNames.getLength(); - Sequence< Any > seqValues ( nCount ); - for( sal_Int32 nProperty=0; nProperty SvtFontOptions_Impl::impl_GetPropertyNames() -{ - // Build static list of configuration key names. - static const OUString pProperties[] = - { - PROPERTYNAME_REPLACEMENTTABLE , - PROPERTYNAME_FONTHISTORY , - PROPERTYNAME_FONTWYSIWYG , - }; - // Initialize return sequence with these list ... - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); - // ... and return it. - return seqPropertyNames; -} - -//***************************************************************************************************************** -// initialize static member -// DON'T DO IT IN YOUR HEADER! -// see definition for further informations -//***************************************************************************************************************** -SvtFontOptions_Impl* SvtFontOptions::m_pDataContainer = NULL ; -sal_Int32 SvtFontOptions::m_nRefCount = 0 ; - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtFontOptions::SvtFontOptions() -{ - // Global access, must be guarded (multithreading!). - MutexGuard aGuard( impl_GetOwnStaticMutex() ); - // Increase ouer refcount ... - ++m_nRefCount; - // ... and initialize ouer data container only if it not already exist! - if( m_pDataContainer == NULL ) - { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtFontOptions_Impl::ctor()"); - m_pDataContainer = new SvtFontOptions_Impl; - - ItemHolder1::holdConfigItem(E_FONTOPTIONS); - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtFontOptions::~SvtFontOptions() -{ - // Global access, must be guarded (multithreading!) - MutexGuard aGuard( impl_GetOwnStaticMutex() ); - // Decrease ouer refcount. - --m_nRefCount; - // If last instance was deleted ... - // we must destroy ouer static data container! - if( m_nRefCount <= 0 ) - { - delete m_pDataContainer; - m_pDataContainer = NULL; - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtFontOptions::IsReplacementTableEnabled() const -{ - MutexGuard aGuard( impl_GetOwnStaticMutex() ); - return m_pDataContainer->IsReplacementTableEnabled(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtFontOptions::EnableReplacementTable( sal_Bool bState ) -{ - MutexGuard aGuard( impl_GetOwnStaticMutex() ); - m_pDataContainer->EnableReplacementTable( bState ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtFontOptions::IsFontHistoryEnabled() const -{ - MutexGuard aGuard( impl_GetOwnStaticMutex() ); - return m_pDataContainer->IsFontHistoryEnabled(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtFontOptions::EnableFontHistory( sal_Bool bState ) -{ - MutexGuard aGuard( impl_GetOwnStaticMutex() ); - m_pDataContainer->EnableFontHistory( bState ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtFontOptions::IsFontWYSIWYGEnabled() const -{ - MutexGuard aGuard( impl_GetOwnStaticMutex() ); - return m_pDataContainer->IsFontWYSIWYGEnabled(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtFontOptions::EnableFontWYSIWYG( sal_Bool bState ) -{ - MutexGuard aGuard( impl_GetOwnStaticMutex() ); - m_pDataContainer->EnableFontWYSIWYG( bState ); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Mutex& SvtFontOptions::impl_GetOwnStaticMutex() -{ - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; -} diff --git a/svtools/source/config/historyoptions.cxx b/svtools/source/config/historyoptions.cxx deleted file mode 100644 index 758753df0e4e..000000000000 --- a/svtools/source/config/historyoptions.cxx +++ /dev/null @@ -1,748 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: historyoptions.cxx,v $ - * $Revision: 1.21.234.2 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include -#include "configitems/historyoptions_const.hxx" -#include -#include -#include -#include -#include - -#ifndef __SGI_STL_DEQUE -#include -#endif - -#ifndef __SGI_STL_ALGORITHM -#include -#endif - -#include -#include "itemholder1.hxx" - -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ -#include -#endif - -#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ -#include -#endif - -#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_ -#include -#endif - -#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_ -#include -#endif - -#ifndef _COMPHELPER_CONFIGURATIONHELPER_HXX_ -#include -#endif - -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_ -#include -#endif - -#ifndef _SVT_LOGHELPER_HXX -#include "loghelper.hxx" -#endif - -//_________________________________________________________________________________________________________________ -// namespaces -//_________________________________________________________________________________________________________________ - -using namespace ::std ; -using namespace ::utl ; -using namespace ::rtl ; -using namespace ::osl ; -using namespace ::com::sun::star::uno ; -using namespace ::com::sun::star::beans ; - -namespace css = ::com::sun::star; - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -namespace { - static const ::sal_Int32 s_nOffsetURL = 0; - static const ::sal_Int32 s_nOffsetFilter = 1; - static const ::sal_Int32 s_nOffsetTitle = 2; - static const ::sal_Int32 s_nOffsetPassword = 3; -} - -//_________________________________________________________________________________________________________________ -// private declarations! -//_________________________________________________________________________________________________________________ - -struct IMPL_THistoryItem -{ - IMPL_THistoryItem() - { - } - - IMPL_THistoryItem( const OUString& sNewURL , - const OUString& sNewFilter , - const OUString& sNewTitle , - const OUString& sNewPassword ) - { - sURL = sNewURL ; - sFilter = sNewFilter ; - sTitle = sNewTitle ; - sPassword = sNewPassword ; - } - - sal_Bool operator==( const OUString& sSearchedURL ) - { - return( sURL == sSearchedURL ); - } - - OUString sURL ; - OUString sFilter ; - OUString sTitle ; - OUString sPassword ; -}; - -//***************************************************************************************************************** -// class SvtHistoryOptions_Impl -// redesigned -//***************************************************************************************************************** -class SvtHistoryOptions_Impl -{ -public: - SvtHistoryOptions_Impl(); - ~SvtHistoryOptions_Impl(); - - sal_uInt32 GetSize( EHistoryType eHistory ); - void SetSize( EHistoryType eHistory, sal_uInt32 nSize ); - void Clear( EHistoryType eHistory ); - Sequence< Sequence< PropertyValue > > GetList( EHistoryType eHistory ); - void AppendItem( EHistoryType eHistory , - const OUString& sURL , - const OUString& sFilter , - const OUString& sTitle , - const OUString& sPassword ); - -private: - void impl_truncateList (EHistoryType eHistory, sal_uInt32 nSize); - -private: - css::uno::Reference< css::container::XNameAccess > m_xCfg; - css::uno::Reference< css::container::XNameAccess > m_xCommonXCU; -}; - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtHistoryOptions_Impl::SvtHistoryOptions_Impl() -{ - try - { - m_xCfg = Reference< css::container::XNameAccess > ( - ::comphelper::ConfigurationHelper::openConfig( - utl::getProcessServiceFactory(), - s_sHistories, - ::comphelper::ConfigurationHelper::E_STANDARD), - css::uno::UNO_QUERY ); - - m_xCommonXCU = Reference< css::container::XNameAccess > ( - ::comphelper::ConfigurationHelper::openConfig( - utl::getProcessServiceFactory(), - s_sCommonHistory, - ::comphelper::ConfigurationHelper::E_STANDARD), - css::uno::UNO_QUERY ); - } - catch(const css::uno::Exception& ex) - { - m_xCfg.clear(); - m_xCommonXCU.clear(); - - LogHelper::logIt(ex); - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtHistoryOptions_Impl::~SvtHistoryOptions_Impl() -{ -} - -//***************************************************************************************************************** -// public method -// Attention: We return the max. size of our internal lists - That is the capacity not the size! -//***************************************************************************************************************** -sal_uInt32 SvtHistoryOptions_Impl::GetSize( EHistoryType eHistory ) -{ - sal_uInt32 nSize = 0 ; - css::uno::Reference< css::beans::XPropertySet > xListAccess(m_xCommonXCU, css::uno::UNO_QUERY); - - try - { - switch( eHistory ) - { - case ePICKLIST: - xListAccess->getPropertyValue(s_sPickListSize) >>= nSize; - break; - - case eHISTORY: - xListAccess->getPropertyValue(s_sURLHistorySize) >>= nSize; - break; - - case eHELPBOOKMARKS: - xListAccess->getPropertyValue(s_sHelpBookmarksSize) >>= nSize; - break; - - default: - break; - } - } - catch(const css::uno::Exception& ex) - { - LogHelper::logIt(ex); - } - - return nSize; -} - -//***************************************************************************************************************** -// public method -// Attention: We return the max. size of our internal lists - That is the capacity not the size! -//***************************************************************************************************************** -void SvtHistoryOptions_Impl::SetSize( EHistoryType eHistory, sal_uInt32 nSize ) -{ - css::uno::Reference< css::beans::XPropertySet > xListAccess(m_xCommonXCU, css::uno::UNO_QUERY); - if (! xListAccess.is ()) - return; - - try - { - switch( eHistory ) - { - case ePICKLIST: - if(nSize!=GetSize(ePICKLIST)) - { - xListAccess->setPropertyValue(s_sPickListSize, css::uno::makeAny(nSize)); - ::comphelper::ConfigurationHelper::flush(m_xCommonXCU); - } - break; - - case eHISTORY: - if(nSize!=GetSize(eHISTORY)) - { - xListAccess->setPropertyValue(s_sURLHistorySize, css::uno::makeAny(nSize)); - ::comphelper::ConfigurationHelper::flush(m_xCommonXCU); - } - break; - - case eHELPBOOKMARKS: - if(nSize!=GetSize(eHELPBOOKMARKS)) - { - xListAccess->setPropertyValue(s_sHelpBookmarksSize, css::uno::makeAny(nSize)); - ::comphelper::ConfigurationHelper::flush(m_xCommonXCU); - } - break; - - default: - break; - } - - impl_truncateList (eHistory, nSize); - } - catch(const css::uno::Exception& ex) - { - LogHelper::logIt(ex); - } -} - -//***************************************************************************************************************** -void SvtHistoryOptions_Impl::impl_truncateList ( EHistoryType eHistory, sal_uInt32 nSize ) -{ - css::uno::Reference< css::container::XNameAccess > xList; - css::uno::Reference< css::container::XNameContainer > xItemList; - css::uno::Reference< css::container::XNameContainer > xOrderList; - css::uno::Reference< css::beans::XPropertySet > xSet; - - try - { - switch( eHistory ) - { - case ePICKLIST: - m_xCfg->getByName(s_sPickList) >>= xList; - break; - - case eHISTORY: - m_xCfg->getByName(s_sURLHistory) >>= xList; - break; - - case eHELPBOOKMARKS: - m_xCfg->getByName(s_sHelpBookmarks) >>= xList; - break; - - default: - break; - } - - // If too much items in current list ... - // truncate the oldest items BEFORE you set the new one. - if ( ! xList.is()) - return; - - xList->getByName(s_sOrderList) >>= xOrderList; - xList->getByName(s_sItemList) >>= xItemList; - - const sal_uInt32 nLength = xOrderList->getElementNames().getLength(); - if (nSize < nLength) - { - for (sal_uInt32 i=nLength-1; i>=nSize; --i) - { - ::rtl::OUString sTmp; - const ::rtl::OUString sRemove = ::rtl::OUString::valueOf((sal_Int32)i); - xOrderList->getByName(sRemove) >>= xSet; - xSet->getPropertyValue(s_sHistoryItemRef) >>= sTmp; - xItemList->removeByName(sTmp); - xOrderList->removeByName(sRemove); - } - - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - } - catch(const css::uno::Exception& ex) - { - LogHelper::logIt(ex); - } -} - -//***************************************************************************************************************** -// public method -// Clear specified history list -//***************************************************************************************************************** -void SvtHistoryOptions_Impl::Clear( EHistoryType eHistory ) -{ - css::uno::Reference< css::container::XNameAccess > xListAccess; - css::uno::Reference< css::container::XNameContainer > xNode; - Sequence< ::rtl::OUString > lOrders; - - try - { - switch( eHistory ) - { - case ePICKLIST: - { - m_xCfg->getByName(s_sPickList) >>= xListAccess; - break; - } - - case eHISTORY: - { - m_xCfg->getByName(s_sURLHistory) >>= xListAccess; - break; - } - - case eHELPBOOKMARKS: - { - m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess; - break; - } - - default: - break; - } - - if (xListAccess.is()) - { - // clear ItemList - xListAccess->getByName(s_sItemList) >>= xNode ; - lOrders = xNode->getElementNames(); - const sal_Int32 nLength = lOrders.getLength(); - for(sal_Int32 i=0; iremoveByName(lOrders[i]); - - // clear OrderList - xListAccess->getByName(s_sOrderList) >>= xNode ; - lOrders = xNode->getElementNames(); - for(sal_Int32 j=0; jremoveByName(lOrders[j]); - - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - } - catch(const css::uno::Exception& ex) - { - LogHelper::logIt(ex); - } -} - -//***************************************************************************************************************** -// public method -// get a sequence list from the items -//***************************************************************************************************************** -Sequence< Sequence< PropertyValue > > SvtHistoryOptions_Impl::GetList( EHistoryType eHistory ) -{ - impl_truncateList (eHistory, GetSize (eHistory)); - - Sequence< Sequence< PropertyValue > > seqReturn; // Set default return value. - Sequence< PropertyValue > seqProperties( 4 ); - Sequence< ::rtl::OUString > lOrders; - - css::uno::Reference< css::container::XNameAccess > xListAccess; - css::uno::Reference< css::container::XNameAccess > xItemList; - css::uno::Reference< css::container::XNameAccess > xOrderList; - css::uno::Reference< css::beans::XPropertySet > xSet; - - seqProperties[s_nOffsetURL ].Name = HISTORY_PROPERTYNAME_URL; - seqProperties[s_nOffsetFilter ].Name = HISTORY_PROPERTYNAME_FILTER; - seqProperties[s_nOffsetTitle ].Name = HISTORY_PROPERTYNAME_TITLE; - seqProperties[s_nOffsetPassword ].Name = HISTORY_PROPERTYNAME_PASSWORD; - - try - { - switch( eHistory ) - { - case ePICKLIST: - { - m_xCfg->getByName(s_sPickList) >>= xListAccess; - break; - } - - case eHISTORY: - { - m_xCfg->getByName(s_sURLHistory) >>= xListAccess; - break; - } - - case eHELPBOOKMARKS: - { - m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess; - break; - } - - default: - break; - } - - if (xListAccess.is()) - { - xListAccess->getByName(s_sItemList) >>= xItemList; - xListAccess->getByName(s_sOrderList) >>= xOrderList; - - const sal_Int32 nLength = xOrderList->getElementNames().getLength(); - Sequence< Sequence< PropertyValue > > aRet(nLength); - - for(sal_Int32 nItem=0; nItemgetByName(::rtl::OUString::valueOf(nItem)) >>= xSet; - xSet->getPropertyValue(s_sHistoryItemRef) >>= sUrl; - - xItemList->getByName(sUrl) >>= xSet; - seqProperties[s_nOffsetURL ].Value <<= sUrl; - xSet->getPropertyValue(s_sFilter) >>= seqProperties[s_nOffsetFilter ].Value; - xSet->getPropertyValue(s_sTitle) >>= seqProperties[s_nOffsetTitle ].Value; - xSet->getPropertyValue(s_sPassword) >>= seqProperties[s_nOffsetPassword ].Value; - aRet[nItem] = seqProperties; - } - seqReturn = aRet; - } - } - catch(const css::uno::Exception& ex) - { - LogHelper::logIt(ex); - } - - return seqReturn; -} - -//***************************************************************************************************************** -// public method -// implements a deque in XML -//***************************************************************************************************************** -void SvtHistoryOptions_Impl::AppendItem( EHistoryType eHistory , - const OUString& sURL , - const OUString& sFilter , - const OUString& sTitle , - const OUString& sPassword ) -{ - impl_truncateList (eHistory, GetSize (eHistory)); - - css::uno::Reference< css::container::XNameAccess > xListAccess; - sal_Int32 nMaxSize = 0; - - switch(eHistory) - { - case ePICKLIST: - { - m_xCfg->getByName(s_sPickList) >>= xListAccess; - nMaxSize = GetSize(ePICKLIST); - } - break; - case eHISTORY: - { - m_xCfg->getByName(s_sURLHistory) >>= xListAccess; - nMaxSize = GetSize(eHISTORY); - } - break; - case eHELPBOOKMARKS: - { - m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess; - nMaxSize = GetSize(eHELPBOOKMARKS); - } - break; - default: - break; - } - - if (nMaxSize==0) - return; - - css::uno::Reference< css::container::XNameContainer > xItemList; - css::uno::Reference< css::container::XNameContainer > xOrderList; - css::uno::Reference< css::beans::XPropertySet > xSet; - - try - { - xListAccess->getByName(s_sItemList) >>= xItemList; - xListAccess->getByName(s_sOrderList) >>= xOrderList; - sal_Int32 nLength = xOrderList->getElementNames().getLength(); - - // The item to be appended is already existing! - if (xItemList->hasByName(sURL)) - { - for (sal_Int32 i=0; igetByName(::rtl::OUString::valueOf(i)) >>= xSet; - xSet->getPropertyValue(s_sHistoryItemRef) >>= sTmp; - - if(sURL == sTmp) - { - ::rtl::OUString sFind; - xOrderList->getByName( ::rtl::OUString::valueOf(i) ) >>= xSet; - xSet->getPropertyValue(s_sHistoryItemRef) >>= sFind; - for (sal_Int32 j=i-1; j>=0; --j) - { - css::uno::Reference< css::beans::XPropertySet > xPrevSet; - css::uno::Reference< css::beans::XPropertySet > xNextSet; - xOrderList->getByName( ::rtl::OUString::valueOf(j+1) ) >>= xPrevSet; - xOrderList->getByName( ::rtl::OUString::valueOf(j) ) >>= xNextSet; - - ::rtl::OUString sTemp; - xNextSet->getPropertyValue(s_sHistoryItemRef) >>= sTemp; - xPrevSet->setPropertyValue(s_sHistoryItemRef, css::uno::makeAny(sTemp)); - } - xOrderList->getByName( ::rtl::OUString::valueOf((sal_Int32)0) ) >>= xSet; - xSet->setPropertyValue(s_sHistoryItemRef, css::uno::makeAny(sFind)); - - ::comphelper::ConfigurationHelper::flush(m_xCfg); - break; - } - } - } - - // The item to be appended is not existing! - else - { - css::uno::Reference< css::lang::XSingleServiceFactory > xFac; - css::uno::Reference< css::uno::XInterface > xInst; - css::uno::Reference< css::beans::XPropertySet > xPrevSet; - css::uno::Reference< css::beans::XPropertySet > xNextSet; - - // Append new item to OrderList. - if ( nLength == nMaxSize ) - { - ::rtl::OUString sRemove; - xOrderList->getByName(::rtl::OUString::valueOf(nLength-1)) >>= xSet; - xSet->getPropertyValue(s_sHistoryItemRef) >>= sRemove; - xItemList->removeByName(sRemove); - } - if ( nLength != nMaxSize ) - { - xFac = css::uno::Reference< css::lang::XSingleServiceFactory >(xOrderList, css::uno::UNO_QUERY); - xInst = xFac->createInstance(); - ::rtl::OUString sPush = ::rtl::OUString::valueOf(nLength++); - xOrderList->insertByName(sPush, css::uno::makeAny(xInst)); - } - for (sal_Int32 j=nLength-1; j>0; --j) - { - xOrderList->getByName( ::rtl::OUString::valueOf(j) ) >>= xPrevSet; - xOrderList->getByName( ::rtl::OUString::valueOf(j-1) ) >>= xNextSet; - ::rtl::OUString sTemp; - xNextSet->getPropertyValue(s_sHistoryItemRef) >>= sTemp; - xPrevSet->setPropertyValue(s_sHistoryItemRef, css::uno::makeAny(sTemp)); - } - xOrderList->getByName( ::rtl::OUString::valueOf((sal_Int32)0) ) >>= xSet; - xSet->setPropertyValue(s_sHistoryItemRef, css::uno::makeAny(sURL)); - - // Append the item to ItemList. - xFac = css::uno::Reference< css::lang::XSingleServiceFactory >(xItemList, css::uno::UNO_QUERY); - xInst = xFac->createInstance(); - xItemList->insertByName(sURL, css::uno::makeAny(xInst)); - xSet = css::uno::Reference< css::beans::XPropertySet >(xInst, css::uno::UNO_QUERY); - xSet->setPropertyValue(s_sFilter, css::uno::makeAny(sFilter)); - xSet->setPropertyValue(s_sTitle, css::uno::makeAny(sTitle)); - xSet->setPropertyValue(s_sPassword, css::uno::makeAny(sPassword)); - - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - } - catch(const css::uno::Exception& ex) - { - LogHelper::logIt(ex); - } -} - -//***************************************************************************************************************** -// initialize static member -// DON'T DO IT IN YOUR HEADER! -// see definition for further informations -//***************************************************************************************************************** -SvtHistoryOptions_Impl* SvtHistoryOptions::m_pDataContainer = NULL ; -sal_Int32 SvtHistoryOptions::m_nRefCount = 0 ; - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtHistoryOptions::SvtHistoryOptions() -{ - // Global access, must be guarded (multithreading!). - MutexGuard aGuard( GetOwnStaticMutex() ); - // Increase ouer refcount ... - ++m_nRefCount; - // ... and initialize ouer data container only if it not already exist! - if( m_pDataContainer == NULL ) - { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtHistoryOptions_Impl::ctor()"); - m_pDataContainer = new SvtHistoryOptions_Impl; - - ItemHolder1::holdConfigItem(E_HISTORYOPTIONS); - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtHistoryOptions::~SvtHistoryOptions() -{ - // Global access, must be guarded (multithreading!) - MutexGuard aGuard( GetOwnStaticMutex() ); - // Decrease ouer refcount. - --m_nRefCount; - // If last instance was deleted ... - // we must destroy ouer static data container! - if( m_nRefCount <= 0 ) - { - delete m_pDataContainer; - m_pDataContainer = NULL; - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_uInt32 SvtHistoryOptions::GetSize( EHistoryType eHistory ) const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetSize( eHistory ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtHistoryOptions::SetSize( EHistoryType eHistory, sal_uInt32 nSize ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetSize( eHistory, nSize ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtHistoryOptions::Clear( EHistoryType eHistory ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->Clear( eHistory ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -Sequence< Sequence< PropertyValue > > SvtHistoryOptions::GetList( EHistoryType eHistory ) const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetList( eHistory ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtHistoryOptions::AppendItem( EHistoryType eHistory , - const OUString& sURL , - const OUString& sFilter , - const OUString& sTitle , - const OUString& sPassword ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->AppendItem( eHistory, sURL, sFilter, sTitle, sPassword ); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Mutex& SvtHistoryOptions::GetOwnStaticMutex() -{ - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; -} diff --git a/svtools/source/config/inetoptions.cxx b/svtools/source/config/inetoptions.cxx deleted file mode 100644 index 109c2d94ada7..000000000000 --- a/svtools/source/config/inetoptions.cxx +++ /dev/null @@ -1,557 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: inetoptions.cxx,v $ - * $Revision: 1.33 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -#include "rtl/instance.hxx" -#include -#ifndef _WILDCARD_HXX -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "itemholder1.hxx" - -using namespace com::sun; - -//============================================================================ -// -// takeAny -// -//============================================================================ - -namespace { - -template< typename T > inline T takeAny(star::uno::Any const & rAny) -{ - T aValue = T(); - rAny >>= aValue; - return aValue; -} - -} - -//============================================================================ -// -// SvtInetOptions::Impl -// -//============================================================================ - -class SvtInetOptions::Impl: public salhelper::ReferenceObject, - public utl::ConfigItem -{ -public: - enum Index - { - INDEX_NO_PROXY, - INDEX_PROXY_TYPE, - INDEX_FTP_PROXY_NAME, - INDEX_FTP_PROXY_PORT, - INDEX_HTTP_PROXY_NAME, - INDEX_HTTP_PROXY_PORT - }; - - Impl(); - - star::uno::Any getProperty(Index nIndex); - - void - setProperty(Index nIndex, star::uno::Any const & rValue, bool bFlush); - - inline void flush() { Commit(); } - - void - addPropertiesChangeListener( - star::uno::Sequence< rtl::OUString > const & rPropertyNames, - star::uno::Reference< star::beans::XPropertiesChangeListener > const & - rListener); - - void - removePropertiesChangeListener( - star::uno::Sequence< rtl::OUString > const & rPropertyNames, - star::uno::Reference< star::beans::XPropertiesChangeListener > const & - rListener); - -private: - enum { ENTRY_COUNT = INDEX_HTTP_PROXY_PORT + 1 }; - - struct Entry - { - enum State { UNKNOWN, KNOWN, MODIFIED }; - - inline Entry(): m_eState(UNKNOWN) {} - - rtl::OUString m_aName; - star::uno::Any m_aValue; - State m_eState; - }; - - // MSVC has problems with the below Map type when - // star::uno::Reference< star::beans::XPropertiesChangeListener > is not - // wrapped in class Listener: - class Listener: - public star::uno::Reference< star::beans::XPropertiesChangeListener > - { - public: - Listener(star::uno::Reference< - star::beans::XPropertiesChangeListener > const & - rListener): - star::uno::Reference< star::beans::XPropertiesChangeListener >( - rListener) - {} - }; - - typedef std::map< Listener, std::set< rtl::OUString > > Map; - - osl::Mutex m_aMutex; - Entry m_aEntries[ENTRY_COUNT]; - Map m_aListeners; - - virtual inline ~Impl() { Commit(); } - - virtual void Notify(star::uno::Sequence< rtl::OUString > const & rKeys); - - virtual void Commit(); - - void notifyListeners(star::uno::Sequence< rtl::OUString > const & rKeys); -}; - -//============================================================================ -// virtual -void -SvtInetOptions::Impl::Notify(star::uno::Sequence< rtl::OUString > const & - rKeys) -{ - { - osl::MutexGuard aGuard(m_aMutex); - for (sal_Int32 i = 0; i < rKeys.getLength(); ++i) - for (sal_Int32 j = 0; j < ENTRY_COUNT; ++j) - if (rKeys[i] == m_aEntries[j].m_aName) - { - m_aEntries[j].m_eState = Entry::UNKNOWN; - break; - } - } - notifyListeners(rKeys); -} - -//============================================================================ -// virtual -void SvtInetOptions::Impl::Commit() -{ - star::uno::Sequence< rtl::OUString > aKeys(ENTRY_COUNT); - star::uno::Sequence< star::uno::Any > aValues(ENTRY_COUNT); - sal_Int32 nCount = 0; - { - osl::MutexGuard aGuard(m_aMutex); - for (sal_Int32 i = 0; i < ENTRY_COUNT; ++i) - if (m_aEntries[i].m_eState == Entry::MODIFIED) - { - aKeys[nCount] = m_aEntries[i].m_aName; - aValues[nCount] = m_aEntries[i].m_aValue; - ++nCount; - m_aEntries[i].m_eState = Entry::KNOWN; - } - } - if (nCount > 0) - { - aKeys.realloc(nCount); - aValues.realloc(nCount); - PutProperties(aKeys, aValues); - } -} - -//============================================================================ -void -SvtInetOptions::Impl::notifyListeners( - star::uno::Sequence< rtl::OUString > const & rKeys) -{ - typedef - std::vector< std::pair< star::uno::Reference< - star::beans::XPropertiesChangeListener >, - star::uno::Sequence< - star::beans::PropertyChangeEvent > > > - List; - List aNotifications; - { - osl::MutexGuard aGuard(m_aMutex); - aNotifications.reserve(m_aListeners.size()); - Map::const_iterator aMapEnd(m_aListeners.end()); - for (Map::const_iterator aIt(m_aListeners.begin()); aIt != aMapEnd; - ++aIt) - { - const Map::mapped_type &rSet = aIt->second; - Map::mapped_type::const_iterator aSetEnd(rSet.end()); - star::uno::Sequence< star::beans::PropertyChangeEvent > - aEvents(rKeys.getLength()); - sal_Int32 nCount = 0; - for (sal_Int32 i = 0; i < rKeys.getLength(); ++i) - { - rtl::OUString - aTheKey(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "Inet/"))); - aTheKey += rKeys[i]; - if (rSet.find(aTheKey) != aSetEnd) - { - aEvents[nCount].PropertyName = aTheKey; - aEvents[nCount].PropertyHandle = -1; - ++nCount; - } - } - if (nCount > 0) - { - aEvents.realloc(nCount); - aNotifications. - push_back(std::make_pair< List::value_type::first_type, - List::value_type::second_type >( - aIt->first, aEvents)); - } - } - } - for (List::size_type i = 0; i < aNotifications.size(); ++i) - if (aNotifications[i].first.is()) - aNotifications[i].first-> - propertiesChange(aNotifications[i].second); -} - -//============================================================================ -SvtInetOptions::Impl::Impl(): - ConfigItem(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Inet/Settings"))) -{ - m_aEntries[INDEX_NO_PROXY].m_aName - = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetNoProxy")); - m_aEntries[INDEX_PROXY_TYPE].m_aName - = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetProxyType")); - m_aEntries[INDEX_FTP_PROXY_NAME].m_aName - = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyName")); - m_aEntries[INDEX_FTP_PROXY_PORT].m_aName - = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyPort")); - m_aEntries[INDEX_HTTP_PROXY_NAME].m_aName - = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyName")); - m_aEntries[INDEX_HTTP_PROXY_PORT].m_aName - = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyPort")); - - star::uno::Sequence< rtl::OUString > aKeys(ENTRY_COUNT); - for (sal_Int32 i = 0; i < ENTRY_COUNT; ++i) - aKeys[i] = m_aEntries[i].m_aName; - if (!EnableNotification(aKeys)) - OSL_ENSURE(false, - "SvtInetOptions::Impl::Impl(): Bad EnableNotifications()"); -} - -//============================================================================ -star::uno::Any SvtInetOptions::Impl::getProperty(Index nPropIndex) -{ - for (int nTryCount = 0; nTryCount < 10; ++nTryCount) - { - { - osl::MutexGuard aGuard(m_aMutex); - if (m_aEntries[nPropIndex].m_eState != Entry::UNKNOWN) - return m_aEntries[nPropIndex].m_aValue; - } - star::uno::Sequence< rtl::OUString > aKeys(ENTRY_COUNT); - int nIndices[ENTRY_COUNT]; - sal_Int32 nCount = 0; - { - osl::MutexGuard aGuard(m_aMutex); - for (int i = 0; i < ENTRY_COUNT; ++i) - if (m_aEntries[i].m_eState == Entry::UNKNOWN) - { - aKeys[nCount] = m_aEntries[i].m_aName; - nIndices[nCount] = i; - ++nCount; - } - } - if (nCount > 0) - { - aKeys.realloc(nCount); - star::uno::Sequence< star::uno::Any > - aValues(GetProperties(aKeys)); - OSL_ENSURE(aValues.getLength() == nCount, - "SvtInetOptions::Impl::getProperty():" - " Bad GetProperties() result"); - nCount = std::min(nCount, aValues.getLength()); - { - osl::MutexGuard aGuard(m_aMutex); - for (sal_Int32 i = 0; i < nCount; ++i) - { - int nIndex = nIndices[i]; - if (m_aEntries[nIndex].m_eState == Entry::UNKNOWN) - { - m_aEntries[nIndices[i]].m_aValue = aValues[i]; - m_aEntries[nIndices[i]].m_eState = Entry::KNOWN; - } - } - } - } - } - OSL_ENSURE(false, - "SvtInetOptions::Impl::getProperty(): Possible life lock"); - { - osl::MutexGuard aGuard(m_aMutex); - return m_aEntries[nPropIndex].m_aValue; - } -} - -//============================================================================ -void SvtInetOptions::Impl::setProperty(Index nIndex, - star::uno::Any const & rValue, - bool bFlush) -{ - SetModified(); - { - osl::MutexGuard aGuard(m_aMutex); - m_aEntries[nIndex].m_aValue = rValue; - m_aEntries[nIndex].m_eState = bFlush ? Entry::KNOWN : Entry::MODIFIED; - } - - star::uno::Sequence< rtl::OUString > aKeys(1); - aKeys[0] = m_aEntries[nIndex].m_aName; - if (bFlush) - { - star::uno::Sequence< star::uno::Any > aValues(1); - aValues[0] = rValue; - PutProperties(aKeys, aValues); - } - else - notifyListeners(aKeys); -} - -//============================================================================ -void -SvtInetOptions::Impl::addPropertiesChangeListener( - star::uno::Sequence< rtl::OUString > const & rPropertyNames, - star::uno::Reference< star::beans::XPropertiesChangeListener > const & - rListener) -{ - osl::MutexGuard aGuard(m_aMutex); - Map::mapped_type & rEntry = m_aListeners[rListener]; - for (sal_Int32 i = 0; i < rPropertyNames.getLength(); ++i) - rEntry.insert(rPropertyNames[i]); -} - -//============================================================================ -void -SvtInetOptions::Impl::removePropertiesChangeListener( - star::uno::Sequence< rtl::OUString > const & rPropertyNames, - star::uno::Reference< star::beans::XPropertiesChangeListener > const & - rListener) -{ - osl::MutexGuard aGuard(m_aMutex); - Map::iterator aIt(m_aListeners.find(rListener)); - if (aIt != m_aListeners.end()) - { - for (sal_Int32 i = 0; i < rPropertyNames.getLength(); ++i) - aIt->second.erase(rPropertyNames[i]); - if (aIt->second.empty()) - m_aListeners.erase(aIt); - } -} - -//============================================================================ -// -// SvtInetOptions -// -//============================================================================ - -namespace -{ - class LocalSingleton : public rtl::Static< osl::Mutex, LocalSingleton > - { - }; -} - -// static -SvtInetOptions::Impl * SvtInetOptions::m_pImpl = 0; - -//============================================================================ -SvtInetOptions::SvtInetOptions() -{ - osl::MutexGuard aGuard(LocalSingleton::get()); - if (!m_pImpl) - { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtInetOptions_Impl::ctor()"); - m_pImpl = new Impl; - - ItemHolder1::holdConfigItem(E_INETOPTIONS); - } - m_pImpl->acquire(); -} - -//============================================================================ -SvtInetOptions::~SvtInetOptions() -{ - osl::MutexGuard aGuard(LocalSingleton::get()); - if (m_pImpl->release() == 0) - m_pImpl = 0; -} - -//============================================================================ -rtl::OUString SvtInetOptions::GetProxyNoProxy() const -{ - return takeAny< rtl::OUString >(m_pImpl-> - getProperty(Impl::INDEX_NO_PROXY)); -} - -//============================================================================ -sal_Int32 SvtInetOptions::GetProxyType() const -{ - return takeAny< sal_Int32 >(m_pImpl-> - getProperty(Impl::INDEX_PROXY_TYPE)); -} - -//============================================================================ -rtl::OUString SvtInetOptions::GetProxyFtpName() const -{ - return takeAny< rtl::OUString >(m_pImpl-> - getProperty( - Impl::INDEX_FTP_PROXY_NAME)); -} - -//============================================================================ -sal_Int32 SvtInetOptions::GetProxyFtpPort() const -{ - return takeAny< sal_Int32 >(m_pImpl-> - getProperty(Impl::INDEX_FTP_PROXY_PORT)); -} - -//============================================================================ -rtl::OUString SvtInetOptions::GetProxyHttpName() const -{ - return takeAny< rtl::OUString >(m_pImpl-> - getProperty( - Impl::INDEX_HTTP_PROXY_NAME)); -} - -//============================================================================ -sal_Int32 SvtInetOptions::GetProxyHttpPort() const -{ - return takeAny< sal_Int32 >(m_pImpl-> - getProperty(Impl::INDEX_HTTP_PROXY_PORT)); -} - -//============================================================================ -void SvtInetOptions::SetProxyNoProxy(rtl::OUString const & rValue, - bool bFlush) -{ - m_pImpl->setProperty(Impl::INDEX_NO_PROXY, - star::uno::makeAny(rValue), - bFlush); -} - -//============================================================================ -void SvtInetOptions::SetProxyType(ProxyType eValue, bool bFlush) -{ - m_pImpl->setProperty(Impl::INDEX_PROXY_TYPE, - star::uno::makeAny(sal_Int32(eValue)), - bFlush); -} - -//============================================================================ -void SvtInetOptions::SetProxyFtpName(rtl::OUString const & rValue, - bool bFlush) -{ - m_pImpl->setProperty(Impl::INDEX_FTP_PROXY_NAME, - star::uno::makeAny(rValue), - bFlush); -} - -//============================================================================ -void SvtInetOptions::SetProxyFtpPort(sal_Int32 nValue, bool bFlush) -{ - m_pImpl->setProperty(Impl::INDEX_FTP_PROXY_PORT, - star::uno::makeAny(nValue), - bFlush); -} - -//============================================================================ -void SvtInetOptions::SetProxyHttpName(rtl::OUString const & rValue, - bool bFlush) -{ - m_pImpl->setProperty(Impl::INDEX_HTTP_PROXY_NAME, - star::uno::makeAny(rValue), - bFlush); -} - -//============================================================================ -void SvtInetOptions::SetProxyHttpPort(sal_Int32 nValue, bool bFlush) -{ - m_pImpl->setProperty(Impl::INDEX_HTTP_PROXY_PORT, - star::uno::makeAny(nValue), - bFlush); -} - -//============================================================================ -void SvtInetOptions::flush() -{ - m_pImpl->flush(); -} - -//============================================================================ -void -SvtInetOptions::addPropertiesChangeListener( - star::uno::Sequence< rtl::OUString > const & rPropertyNames, - star::uno::Reference< star::beans::XPropertiesChangeListener > const & - rListener) -{ - m_pImpl->addPropertiesChangeListener(rPropertyNames, rListener); -} - -//============================================================================ -void -SvtInetOptions::removePropertiesChangeListener( - star::uno::Sequence< rtl::OUString > const & rPropertyNames, - star::uno::Reference< star::beans::XPropertiesChangeListener > const & - rListener) -{ - m_pImpl->removePropertiesChangeListener(rPropertyNames, rListener); -} diff --git a/svtools/source/config/internaloptions.cxx b/svtools/source/config/internaloptions.cxx deleted file mode 100644 index dc8cc7c34772..000000000000 --- a/svtools/source/config/internaloptions.cxx +++ /dev/null @@ -1,631 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: internaloptions.cxx,v $ - * $Revision: 1.21 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include "itemholder1.hxx" - -//_________________________________________________________________________________________________________________ -// namespaces -//_________________________________________________________________________________________________________________ - -using namespace ::utl ; -using namespace ::rtl ; -using namespace ::osl ; -using namespace ::std ; -using namespace ::com::sun::star::uno ; -using namespace ::com::sun::star::beans ; - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -#define ROOTNODE_INTERNAL OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Internal" )) -#define DEFAULT_SLOTCFG sal_False -#define DEFAULT_SENDCRASHMAIL sal_False -#define DEFAULT_USEMAILUI sal_True -#define DEFAULT_CURRENTTEMPURL OUString(RTL_CONSTASCII_USTRINGPARAM("")) - -#define FIXPROPERTYNAME_SLOTCFG OUString(RTL_CONSTASCII_USTRINGPARAM("Slot" )) -#define FIXPROPERTYNAME_SENDCRASHMAIL OUString(RTL_CONSTASCII_USTRINGPARAM("SendCrashMail" )) -#define FIXPROPERTYNAME_USEMAILUI OUString(RTL_CONSTASCII_USTRINGPARAM("UseMailUI" )) -#define FIXPROPERTYNAME_CURRENTTEMPURL OUString(RTL_CONSTASCII_USTRINGPARAM("CurrentTempURL" )) -//#define FIXPROPERTYNAME_REMOVEMENUENTRYCLOSE OUString(RTL_CONSTASCII_USTRINGPARAM("RemoveMenuEntryClose")) -//#define FIXPROPERTYNAME_REMOVEMENUENTRYBACKTOWEBTOP OUString(RTL_CONSTASCII_USTRINGPARAM("RemoveMenuEntryBackToWebtop")) -//#define FIXPROPERTYNAME_REMOVEMENUENTRYNEWWEBTOP OUString(RTL_CONSTASCII_USTRINGPARAM("RemoveMenuEntryNewWebtop")) -//#define FIXPROPERTYNAME_REMOVEMENUENTRYLOGOUT OUString(RTL_CONSTASCII_USTRINGPARAM("RemoveMenuEntryLogout")) - -#define FIXPROPERTYHANDLE_SLOTCFG 0 -#define FIXPROPERTYHANDLE_SENDCRASHMAIL 1 -#define FIXPROPERTYHANDLE_USEMAILUI 2 -#define FIXPROPERTYHANDLE_CURRENTTEMPURL 3 -//#define FIXPROPERTYHANDLE_REMOVEMENUENTRYCLOSE 3 -//#define FIXPROPERTYHANDLE_REMOVEMENUENTRYBACKTOWEBTOP 4 -//#define FIXPROPERTYHANDLE_REMOVEMENUENTRYNEWWEBTOP 5 -//#define FIXPROPERTYHANDLE_REMOVEMENUENTRYLOGOUT 6 - -#define FIXPROPERTYCOUNT 4 -/* -#define PROPERTYNAME_RECOVERYLIST OUString(RTL_CONSTASCII_USTRINGPARAM("RecoveryList" )) -#define PROPERTYNAME_URL OUString(RTL_CONSTASCII_USTRINGPARAM("OrgURL" )) -#define PROPERTYNAME_FILTER OUString(RTL_CONSTASCII_USTRINGPARAM("FilterName" )) -#define PROPERTYNAME_TEMPNAME OUString(RTL_CONSTASCII_USTRINGPARAM("TempURL" )) - -#define OFFSET_URL 0 -#define OFFSET_FILTER 1 -#define OFFSET_TEMPNAME 2 -*/ -#define PATHDELIMITER OUString(RTL_CONSTASCII_USTRINGPARAM("/" )) -#define FIXR OUString(RTL_CONSTASCII_USTRINGPARAM("r" )) - -//_________________________________________________________________________________________________________________ -// private declarations! -//_________________________________________________________________________________________________________________ -/* -struct tIMPL_RecoveryEntry -{ - OUString sURL ; - OUString sFilter ; - OUString sTempName ; - - tIMPL_RecoveryEntry() - { - sURL = OUString(); - sFilter = OUString(); - sTempName = OUString(); - } - - tIMPL_RecoveryEntry( const OUString& sNewURL , - const OUString& sNewFilter , - const OUString& sNewTempName ) - { - sURL = sNewURL ; - sFilter = sNewFilter ; - sTempName = sNewTempName ; - } -}; - -typedef deque< tIMPL_RecoveryEntry > tIMPL_RecoveryStack; -*/ -class SvtInternalOptions_Impl : public ConfigItem -{ - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - sal_Bool m_bRemoveMenuEntryClose; - sal_Bool m_bRemoveMenuEntryBackToWebtop; - sal_Bool m_bRemoveMenuEntryNewWebtop; - sal_Bool m_bRemoveMenuEntryLogout; - sal_Bool m_bSlotCFG ; /// cache "Slot" of Internal section - sal_Bool m_bSendCrashMail ; /// cache "SendCrashMail" of Internal section - sal_Bool m_bUseMailUI; - OUString m_aCurrentTempURL ; - // tIMPL_RecoveryStack m_aRecoveryList ; /// cache "RecoveryList" of Internal section - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - SvtInternalOptions_Impl(); - ~SvtInternalOptions_Impl(); - - //--------------------------------------------------------------------------------------------------------- - // overloaded methods of baseclass - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short called for notify of configmanager - @descr These method is called from the ConfigManager before application ends or from the - PropertyChangeListener if the sub tree broadcasts changes. You must update your - internal values. - - @seealso baseclass ConfigItem - - @param "seqPropertyNames" is the list of properties which should be updated. - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Notify( const Sequence< OUString >& ) - { - DBG_ASSERT( sal_False, "SvtInternalOptions::Notify()\nNot used yet ... but called!?\n" ); - } - - /*-****************************************************************************************************//** - @short write changes to configuration - @descr These method writes the changed values into the sub tree - and should always called in our destructor to guarantee consistency of config data. - - @seealso baseclass ConfigItem - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Commit(); - - //--------------------------------------------------------------------------------------------------------- - // public interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short access method to get internal values - @descr These method give us a chance to regulate acces to ouer internal values. - It's not used in the moment - but it's possible for the feature! - - @seealso - - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - sal_Bool IsRemoveMenuEntryClose() const { return m_bRemoveMenuEntryClose; } - sal_Bool IsRemoveMenuEntryBackToWebtop() const { return m_bRemoveMenuEntryBackToWebtop; } - sal_Bool IsRemoveMenuEntryNewWebtop() const { return m_bRemoveMenuEntryNewWebtop; } - sal_Bool IsRemoveMenuEntryLogout() const { return m_bRemoveMenuEntryLogout; } - sal_Bool SlotCFGEnabled () const { return m_bSlotCFG; } - sal_Bool CrashMailEnabled () const { return m_bSendCrashMail; } - sal_Bool MailUIEnabled () const { return m_bUseMailUI; } - - OUString GetCurrentTempURL() const { return m_aCurrentTempURL; } - void SetCurrentTempURL( const OUString& aNewCurrentTempURL ); -/* - void PushRecoveryItem ( const OUString& sURL , - const OUString& sFilter , - const OUString& sTempName ); - void PopRecoveryItem ( OUString& sURL , - OUString& sFilter , - OUString& sTempName ); - sal_Bool IsRecoveryListEmpty ( ) const; -*/ - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return list of fix key names of ouer configuration management which represent oue module tree - @descr These methods return a static const list of key names. We need it to get needed values from our - configuration management. We return well known key names only - because the "UserData" node - is handled in a special way! - - @seealso - - - @param - - @return A list of needed configuration keys is returned. - - @onerror - - *//*-*****************************************************************************************************/ - - Sequence< OUString > impl_GetPropertyNames(); -}; - -//_________________________________________________________________________________________________________________ -// definitions -//_________________________________________________________________________________________________________________ - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtInternalOptions_Impl::SvtInternalOptions_Impl() - // Init baseclasses first - : ConfigItem ( ROOTNODE_INTERNAL, CONFIG_MODE_IMMEDIATE_UPDATE ) - // Init member then. - , m_bRemoveMenuEntryClose ( sal_False ) - , m_bRemoveMenuEntryBackToWebtop ( sal_False ) - , m_bRemoveMenuEntryNewWebtop ( sal_False ) - , m_bRemoveMenuEntryLogout ( sal_False ) - , m_bSlotCFG ( DEFAULT_SLOTCFG ) - , m_bSendCrashMail ( DEFAULT_SENDCRASHMAIL ) - , m_bUseMailUI ( DEFAULT_USEMAILUI ) - , m_aCurrentTempURL ( DEFAULT_CURRENTTEMPURL ) -{ - // Use our list of configuration keys to get his values. - // structure of internal section: (first 2 entries are fixed - all other are member of a set!) - // "Slot" - // "SendCrashMail" - // "RecoveryList/r1/URL" - // "RecoveryList/r1/Filter" - // "RecoveryList/r1/TempName" - // "RecoveryList/r2/URL" - // "RecoveryList/r2/Filter" - // "RecoveryList/r2/TempName" - // "RecoveryList/.." - Sequence< OUString > seqNames = impl_GetPropertyNames() ; - Sequence< Any > seqValues = GetProperties( seqNames ) ; - - // Safe impossible cases. - // We need values from ALL configuration keys. - // Follow assignment use order of values in relation to our list of key names! - DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtInternalOptions_Impl::SvtInternalOptions_Impl()\nI miss some values of configuration keys!\n" ); - - // Read fixed values first! - DBG_ASSERT(!(seqValues[FIXPROPERTYHANDLE_SLOTCFG].getValueTypeClass()!=TypeClass_BOOLEAN) , "SvtInternalOptions_Impl::SvtInternalOptions_Impl()\nWho has changed the value type of \"Office.Common\\Internal\\Slot\"?" ); - DBG_ASSERT(!(seqValues[FIXPROPERTYHANDLE_SENDCRASHMAIL].getValueTypeClass()!=TypeClass_BOOLEAN) , "SvtInternalOptions_Impl::SvtInternalOptions_Impl()\nWho has changed the value type of \"Office.Common\\Internal\\SendCrashMail\"?" ); - seqValues[FIXPROPERTYHANDLE_SLOTCFG ] >>= m_bSlotCFG ; - seqValues[FIXPROPERTYHANDLE_SENDCRASHMAIL ] >>= m_bSendCrashMail ; - seqValues[FIXPROPERTYHANDLE_USEMAILUI ] >>= m_bUseMailUI ; - seqValues[FIXPROPERTYHANDLE_CURRENTTEMPURL ] >>= m_aCurrentTempURL ; -// seqValues[FIXPROPERTYHANDLE_REMOVEMENUENTRYCLOSE ] >>= m_bRemoveMenuEntryClose ; -// seqValues[FIXPROPERTYHANDLE_REMOVEMENUENTRYBACKTOWEBTOP ] >>= m_bRemoveMenuEntryBackToWebtop ; -// seqValues[FIXPROPERTYHANDLE_REMOVEMENUENTRYNEWWEBTOP ] >>= m_bRemoveMenuEntryNewWebtop ; -// seqValues[FIXPROPERTYHANDLE_REMOVEMENUENTRYLOGOUT ] >>= m_bRemoveMenuEntryLogout ; -/* - // Read dynamical set "RecoveryList" then. - // 3 subkeys for every item! - // Attention: Start at next element after last fixed entry! We must ignore "Slot" and "SendCrashMail" ... - tIMPL_RecoveryEntry aEntry; - sal_uInt32 nCount = seqValues.getLength() ; - sal_uInt32 nPosition = FIXPROPERTYCOUNT ; - - while( nPosition>= aEntry.sURL ; - ++nPosition; - seqValues[nPosition] >>= aEntry.sFilter ; - ++nPosition; - seqValues[nPosition] >>= aEntry.sTempName ; - ++nPosition; - m_aRecoveryList.push_front( aEntry ); - } -*/ - // We don't need any notifications here. - // "Slot" and "SendCrashMail" are readonly(!) and our recovery list should not modified during runtime - it's used - // by our crash guard only ... otherwise we have a big problem. -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtInternalOptions_Impl::~SvtInternalOptions_Impl() -{ - if( IsModified() == sal_True ) - { - Commit(); - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtInternalOptions_Impl::Commit() -{ - // We have to write our current temp URL - Sequence< OUString > aNames( 1 ); - OUString* pNames = aNames.getArray(); - Sequence< Any > aValues( 1 ); - Any* pValues = aValues.getArray(); - - pNames[0] = FIXPROPERTYNAME_CURRENTTEMPURL; - pValues[0] <<= m_aCurrentTempURL; - - PutProperties( aNames, aValues ); - -/* - // Write set of dynamic properties then. - ClearNodeSet( PROPERTYNAME_RECOVERYLIST ); - - tIMPL_RecoveryEntry aItem ; - OUString sNode ; - Sequence< PropertyValue > seqPropertyValues( 3 ) ; // Every node in set has 3 sub-nodes!( url, filter, tempname ) - - // Copy list entries to save-list and write it to configuration. - - sal_uInt32 nCount = m_aRecoveryList.size(); - for( sal_uInt32 nItem=0; nItemsURL ; - seqPropertyValues[OFFSET_FILTER ].Value <<= iRecovery->sFilter ; - seqPropertyValues[OFFSET_TEMPNAME ].Value <<= iRecovery->sTempName ; - SetSetProperties( PROPERTYNAME_RECOVERYLIST, seqPropertyValues ); - } - - */ -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtInternalOptions_Impl::SetCurrentTempURL( const OUString& aNewCurrentTempURL ) -{ - m_aCurrentTempURL = aNewCurrentTempURL; - SetModified(); - Commit(); -} - -#if 0 -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtInternalOptions_Impl::PushRecoveryItem( const OUString& sURL , - const OUString& sFilter , - const OUString& sTempName ) -{ - tIMPL_RecoveryEntry aEntry( sURL, sFilter, sTempName ); - m_aRecoveryList.push_front( aEntry ); - SetModified(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtInternalOptions_Impl::PopRecoveryItem( OUString& sURL , - OUString& sFilter , - OUString& sTempName ) -{ - tIMPL_RecoveryEntry aEntry = m_aRecoveryList.front(); - m_aRecoveryList.pop_front(); - SetModified(); // Don't forget it - we delete an entry here! - sURL = aEntry.sURL ; - sFilter = aEntry.sFilter ; - sTempName = aEntry.sTempName ; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtInternalOptions_Impl::IsRecoveryListEmpty() const -{ - return ( m_aRecoveryList.empty() ); -} -#endif - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Sequence< OUString > SvtInternalOptions_Impl::impl_GetPropertyNames() -{ - /* - // First get ALL names of current existing list items in configuration! - Sequence< OUString > seqRecoveryItems = GetNodeNames( PROPERTYNAME_RECOVERYLIST ); - // Get information about list counts ... - sal_Int32 nRecoveryCount = seqRecoveryItems.getLength(); - // ... and create a property list with right size! (+2...for fix properties!) (*3 ... = sub nodes for every set node!) - Sequence< OUString > seqProperties( FIXPROPERTYCOUNT + (nRecoveryCount*3) ); - */ - Sequence< OUString > seqProperties(4); - - // Add names of fix properties to list. - seqProperties[FIXPROPERTYHANDLE_SLOTCFG ] = FIXPROPERTYNAME_SLOTCFG ; - seqProperties[FIXPROPERTYHANDLE_SENDCRASHMAIL ] = FIXPROPERTYNAME_SENDCRASHMAIL ; - seqProperties[FIXPROPERTYHANDLE_USEMAILUI ] = FIXPROPERTYNAME_USEMAILUI ; - seqProperties[FIXPROPERTYHANDLE_CURRENTTEMPURL ] = FIXPROPERTYNAME_CURRENTTEMPURL ; -// seqProperties[FIXPROPERTYHANDLE_REMOVEMENUENTRYCLOSE ] = FIXPROPERTYNAME_REMOVEMENUENTRYCLOSE; -// seqProperties[FIXPROPERTYHANDLE_REMOVEMENUENTRYBACKTOWEBTOP ] = FIXPROPERTYNAME_REMOVEMENUENTRYBACKTOWEBTOP; -// seqProperties[FIXPROPERTYHANDLE_REMOVEMENUENTRYNEWWEBTOP ] = FIXPROPERTYNAME_REMOVEMENUENTRYNEWWEBTOP; -// seqProperties[FIXPROPERTYHANDLE_REMOVEMENUENTRYLOGOUT ] = FIXPROPERTYNAME_REMOVEMENUENTRYLOGOUT; -/* - sal_uInt32 nPosition = FIXPROPERTYCOUNT; - // Add names for recovery list to list. - // 3 subkeys for every item! - // nPosition is the start point of an list item, nItem an index into right list of node names! - for( sal_Int32 nItem=0; nItemSlotCFGEnabled(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtInternalOptions::CrashMailEnabled() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->CrashMailEnabled(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtInternalOptions::MailUIEnabled() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->MailUIEnabled(); -} - -//***************************************************************************************************************** -// public methods -//***************************************************************************************************************** -sal_Bool SvtInternalOptions::IsRemoveMenuEntryClose() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsRemoveMenuEntryClose(); -} - -sal_Bool SvtInternalOptions::IsRemoveMenuEntryBackToWebtop() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsRemoveMenuEntryBackToWebtop(); -} - -sal_Bool SvtInternalOptions::IsRemoveMenuEntryNewWebtop() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsRemoveMenuEntryNewWebtop(); -} - -sal_Bool SvtInternalOptions::IsRemoveMenuEntryLogout() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsRemoveMenuEntryLogout(); -} - -OUString SvtInternalOptions::GetCurrentTempURL() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetCurrentTempURL(); -} - -void SvtInternalOptions::SetCurrentTempURL( const OUString& aNewCurrentTempURL ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetCurrentTempURL( aNewCurrentTempURL ); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Mutex& SvtInternalOptions::GetOwnStaticMutex() -{ - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; -} diff --git a/svtools/source/config/itemholder1.cxx b/svtools/source/config/itemholder1.cxx deleted file mode 100644 index 37a57259c807..000000000000 --- a/svtools/source/config/itemholder1.cxx +++ /dev/null @@ -1,325 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: itemholder1.cxx,v $ - * $Revision: 1.13 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include "itemholder1.hxx" - -//----------------------------------------------- -// includes -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//----------------------------------------------- -// namespaces - -namespace css = ::com::sun::star; - -//----------------------------------------------- -// declarations - -//----------------------------------------------- -ItemHolder1::ItemHolder1() - : ItemHolderMutexBase() -{ - try - { - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); - css::uno::Reference< css::lang::XComponent > xCfg( - xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")), - css::uno::UNO_QUERY); - if (xCfg.is()) - xCfg->addEventListener(static_cast< css::lang::XEventListener* >(this)); - } -// #i37892 got errorhandling from ConfigManager::GetConfigurationProvider() -#ifdef DBG_UTIL - catch(css::uno::Exception& rEx) - { - static sal_Bool bMessage = sal_True; - if(bMessage) - { - bMessage = sal_False; - ::rtl::OString sMsg("CreateInstance with arguments exception: "); - sMsg += ::rtl::OString(rEx.Message.getStr(), - rEx.Message.getLength(), - RTL_TEXTENCODING_ASCII_US); - OSL_ENSURE(sal_False, sMsg.getStr()); - } - } -#else - catch(css::uno::Exception&){} -#endif -} - -//----------------------------------------------- -ItemHolder1::~ItemHolder1() -{ - impl_releaseAllItems(); -} - -//----------------------------------------------- -void ItemHolder1::holdConfigItem(EItem eItem) -{ - static ItemHolder1* pHolder = new ItemHolder1(); - pHolder->impl_addItem(eItem); -} - -//----------------------------------------------- -void SAL_CALL ItemHolder1::disposing(const css::lang::EventObject&) - throw(css::uno::RuntimeException) -{ - css::uno::Reference< css::uno::XInterface > xSelfHold(static_cast< css::lang::XEventListener* >(this), css::uno::UNO_QUERY); - impl_releaseAllItems(); -} - -//----------------------------------------------- -void ItemHolder1::impl_addItem(EItem eItem) -{ - ::osl::ResettableMutexGuard aLock(m_aLock); - - TItems::const_iterator pIt; - for ( pIt = m_lItems.begin(); - pIt != m_lItems.end() ; - ++pIt ) - { - const TItemInfo& rInfo = *pIt; - if (rInfo.eItem == eItem) - return; - } - - TItemInfo aNewItem; - aNewItem.eItem = eItem; - impl_newItem(aNewItem); - if (aNewItem.pItem) - m_lItems.push_back(aNewItem); -} - -//----------------------------------------------- -void ItemHolder1::impl_releaseAllItems() -{ - ::osl::ResettableMutexGuard aLock(m_aLock); - - TItems::iterator pIt; - for ( pIt = m_lItems.begin(); - pIt != m_lItems.end() ; - ++pIt ) - { - TItemInfo& rInfo = *pIt; - impl_deleteItem(rInfo); - } - m_lItems.clear(); -} - -//----------------------------------------------- -void ItemHolder1::impl_newItem(TItemInfo& rItem) -{ - switch(rItem.eItem) - { - case E_ACCELCFG : - rItem.pItem = new SvtAcceleratorConfiguration(); - break; - - case E_ADDXMLTOSTORAGEOPTIONS : - rItem.pItem = new SvtAddXMLToStorageOptions(); - break; - - case E_CMDOPTIONS : - rItem.pItem = new SvtCommandOptions(); - break; - - case E_COMPATIBILITY : - rItem.pItem = new SvtCompatibilityOptions(); - break; - - case E_DEFAULTOPTIONS : - rItem.pItem = new SvtDefaultOptions(); - break; - - case E_DYNAMICMENUOPTIONS : - rItem.pItem = new SvtDynamicMenuOptions(); - break; - - case E_EVENTCFG : - //rItem.pItem = new GlobalEventConfig(); - break; - - case E_EXTENDEDSECURITYOPTIONS : - rItem.pItem = new SvtExtendedSecurityOptions(); - break; - - case E_FLTRCFG : -// no ref count rItem.pItem = new SvtFilterOptions(); - break; - - case E_FONTOPTIONS : - rItem.pItem = new SvtFontOptions(); - break; - - case E_HISTORYOPTIONS : - rItem.pItem = new SvtHistoryOptions(); - break; - - case E_INETOPTIONS : - rItem.pItem = new SvtInetOptions(); - break; - - case E_INTERNALOPTIONS : - rItem.pItem = new SvtInternalOptions(); - break; - - case E_JAVAOPTIONS : -// no ref count rItem.pItem = new SvtJavaOptions(); - break; - - case E_LINGUCFG : - rItem.pItem = new SvtLinguConfig(); - break; - - case E_LOCALISATIONOPTIONS : - rItem.pItem = new SvtLocalisationOptions(); - break; - - case E_MENUOPTIONS : - rItem.pItem = new SvtMenuOptions(); - break; - - case E_MODULEOPTIONS : - rItem.pItem = new SvtModuleOptions(); - break; - - case E_OPTIONSDLGOPTIONS : - rItem.pItem = new SvtOptionsDialogOptions(); - break; - - case E_PATHOPTIONS : - rItem.pItem = new SvtPathOptions(); - break; - - case E_PRINTWARNINGOPTIONS : - rItem.pItem = new SvtPrintWarningOptions(); - break; - - case E_REGOPTIONS : -// no ref count rItem.pItem = new ::svt::RegOptions(); - break; - - case E_SAVEOPTIONS : - rItem.pItem = new SvtSaveOptions(); - break; - - case E_SEARCHOPT : -// no ref count rItem.pItem = new SvtSearchOptions(); - break; - - case E_SECURITYOPTIONS : - rItem.pItem = new SvtSecurityOptions(); - break; - - case E_SOURCEVIEWCONFIG : - rItem.pItem = new ::svt::SourceViewConfig(); - break; - - case E_STARTOPTIONS : - rItem.pItem = new SvtStartOptions(); - break; - - case E_VIEWOPTIONS_DIALOG : - rItem.pItem = new SvtViewOptions(E_DIALOG, ::rtl::OUString()); - break; - - case E_VIEWOPTIONS_TABDIALOG : - rItem.pItem = new SvtViewOptions(E_TABDIALOG, ::rtl::OUString()); - break; - - case E_VIEWOPTIONS_TABPAGE : - rItem.pItem = new SvtViewOptions(E_TABPAGE, ::rtl::OUString()); - break; - - case E_VIEWOPTIONS_WINDOW : - rItem.pItem = new SvtViewOptions(E_WINDOW, ::rtl::OUString()); - break; - - case E_WORKINGSETOPTIONS : - rItem.pItem = new SvtWorkingSetOptions(); - break; - - case E_XMLACCELCFG : - // ??? TODO - break; - default: - OSL_ASSERT( "unknown item type" ); - break; - } -} - -//----------------------------------------------- -void ItemHolder1::impl_deleteItem(TItemInfo& rItem) -{ - if (rItem.pItem) - { - delete rItem.pItem; - rItem.pItem = 0; - } -} - diff --git a/svtools/source/config/itemholder1.hxx b/svtools/source/config/itemholder1.hxx deleted file mode 100644 index b040292ab5c6..000000000000 --- a/svtools/source/config/itemholder1.hxx +++ /dev/null @@ -1,92 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: itemholder1.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_SVTOOLS_ITEMHOLDER1_HXX_ -#define INCLUDED_SVTOOLS_ITEMHOLDER1_HXX_ - -//----------------------------------------------- -// includes - -#include "itemholderbase.hxx" -#include -#include - -//----------------------------------------------- -// namespaces - -#ifdef css -#error "Cant use css as namespace alias." -#else -#define css ::com::sun::star -#endif - -//----------------------------------------------- -// definitions - -class ItemHolder1 : private ItemHolderMutexBase - , public ::cppu::WeakImplHelper1< css::lang::XEventListener > -{ - //........................................... - // member - private: - - TItems m_lItems; - - //........................................... - // c++ interface - public: - - ItemHolder1(); - virtual ~ItemHolder1(); - static void holdConfigItem(EItem eItem); - - //........................................... - // uno interface - public: - - virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) - throw(css::uno::RuntimeException); - - //........................................... - // helper - private: - - void impl_addItem(EItem eItem); - void impl_releaseAllItems(); - void impl_newItem(TItemInfo& rItem); - void impl_deleteItem(TItemInfo& rItem); -}; - -//----------------------------------------------- -// namespaces - -#undef css - -#endif // INCLUDED_SVTOOLS_ITEMHOLDER1_HXX_ diff --git a/svtools/source/config/itemholder2.cxx b/svtools/source/config/itemholder2.cxx index 590e0f85ade1..d0e5b30007f9 100644 --- a/svtools/source/config/itemholder2.cxx +++ b/svtools/source/config/itemholder2.cxx @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -54,9 +55,7 @@ #include #include #include -#include -#include -#include +#include #include @@ -206,6 +205,10 @@ void ItemHolder2::impl_newItem(TItemInfo& rItem) // no ref count rItem.pItem = new SfxMiscCfg(); break; + case E_MENUOPTIONS : + rItem.pItem = new SvtMenuOptions(); + break; + case E_PRINTOPTIONS : rItem.pItem = new SvtPrinterOptions(); break; @@ -218,13 +221,6 @@ void ItemHolder2::impl_newItem(TItemInfo& rItem) rItem.pItem = new SvtSysLocaleOptions(); break; - case E_UNDOOPTIONS : - rItem.pItem = new SvtUndoOptions(); - break; - - case E_USEROPTIONS : - rItem.pItem = new SvtUserOptions(); - break; case E_MISCOPTIONS : rItem.pItem = new SvtMiscOptions(); break; diff --git a/svtools/source/config/itemholder2.hxx b/svtools/source/config/itemholder2.hxx index d32eee1fc093..192df8f746c9 100644 --- a/svtools/source/config/itemholder2.hxx +++ b/svtools/source/config/itemholder2.hxx @@ -34,7 +34,7 @@ //----------------------------------------------- // includes -#include "itemholderbase.hxx" +#include #include #include diff --git a/svtools/source/config/itemholderbase.hxx b/svtools/source/config/itemholderbase.hxx deleted file mode 100644 index b5c1dd5d57d0..000000000000 --- a/svtools/source/config/itemholderbase.hxx +++ /dev/null @@ -1,131 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: itemholderbase.hxx,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_SVTOOLS_ITEMHOLDERBASE_HXX_ -#define INCLUDED_SVTOOLS_ITEMHOLDERBASE_HXX_ - -//----------------------------------------------- -// includes - -#include -#include - -namespace svt { namespace detail { class Options; } } - -//----------------------------------------------- -// definitions - -struct ItemHolderMutexBase -{ - ::osl::Mutex m_aLock; -}; - -enum EItem -{ - E_ACCELCFG , // - E_ACCESSIBILITYOPTIONS , // 2 - E_ADDXMLTOSTORAGEOPTIONS , // - E_APEARCFG , // 2 - - E_CJKOPTIONS , // 2 - E_CMDOPTIONS , // - E_COLORCFG , // 2 - E_COMPATIBILITY , // - E_CTLOPTIONS , // 2 - - E_DEFAULTOPTIONS , // - E_DYNAMICMENUOPTIONS , // - - E_EVENTCFG , // - E_EXTENDEDSECURITYOPTIONS , // - - E_FLTRCFG , // - E_FONTOPTIONS , // - E_FONTSUBSTCONFIG , // 2 - - E_HELPOPTIONS , // 2 - E_HISTORYOPTIONS , // - - E_INETOPTIONS , // - E_INTERNALOPTIONS , // - - E_JAVAOPTIONS , // - - E_LANGUAGEOPTIONS , // 2 - E_LINGUCFG , // - E_LOCALISATIONOPTIONS , // - - E_MENUOPTIONS , // - E_MISCCFG , // 2 - E_MISCOPTIONS , // - E_MODULEOPTIONS , // - - E_OPTIONSDLGOPTIONS , // - - E_PATHOPTIONS , // - E_PRINTOPTIONS , // 2 - E_PRINTFILEOPTIONS , // 2 - E_PRINTWARNINGOPTIONS , // - - E_REGOPTIONS , // - - E_SAVEOPTIONS , // - E_SEARCHOPT , // - E_SECURITYOPTIONS , // - E_SOURCEVIEWCONFIG , // - E_STARTOPTIONS , // - E_SYSLOCALEOPTIONS , // 2 - - E_UNDOOPTIONS , // 2 - E_USEROPTIONS , // 2 - - E_VIEWOPTIONS_DIALOG , // - E_VIEWOPTIONS_TABDIALOG , // - E_VIEWOPTIONS_TABPAGE , // - E_VIEWOPTIONS_WINDOW , // - - E_WORKINGSETOPTIONS , // - - E_XMLACCELCFG // -}; - -struct TItemInfo -{ - TItemInfo() - : pItem(0) - {} - - svt::detail::Options * pItem; - EItem eItem; -}; - -typedef ::std::vector< TItemInfo > TItems; - -#endif // INCLUDED_SVTOOLS_ITEMHOLDERBASE_HXX_ diff --git a/svtools/source/config/javaoptions.cxx b/svtools/source/config/javaoptions.cxx deleted file mode 100644 index 7915f0042614..000000000000 --- a/svtools/source/config/javaoptions.cxx +++ /dev/null @@ -1,367 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: javaoptions.cxx,v $ - * $Revision: 1.9 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -#ifndef _SVTOOLS_JAVAPTIONS_HXX -#include -#endif -#include -#include -#include - - -using namespace ::com::sun::star::uno; -using namespace ::rtl; - -#define C2U(cChar) OUString::createFromAscii(cChar) -#define CFG_READONLY_DEFAULT sal_False -/* -----------------------------10.04.01 12:39-------------------------------- - - ---------------------------------------------------------------------------*/ -class SvtExecAppletsItem_Impl : public utl::ConfigItem -{ - sal_Bool bExecute; - sal_Bool bRO; -public: - SvtExecAppletsItem_Impl(); - - virtual void Commit(); - - sal_Bool IsExecuteApplets() const {return bExecute;} - void SetExecuteApplets(sal_Bool bSet); - sal_Bool IsReadOnly() const {return bRO;} -}; -/* -----------------------------10.02.2003 07:46------------------------------ - - ---------------------------------------------------------------------------*/ -void SvtExecAppletsItem_Impl::SetExecuteApplets(sal_Bool bSet) -{ - OSL_ENSURE(!bRO, "SvtExecAppletsItem_Impl::SetExecuteApplets()\nYou tried to write on a readonly value!\n"); - if (!bRO) - { - bExecute = bSet; - SetModified(); - } -} -/* -----------------------------18.05.01 14:44-------------------------------- - - ---------------------------------------------------------------------------*/ -SvtExecAppletsItem_Impl::SvtExecAppletsItem_Impl() : - utl::ConfigItem(C2U("Office.Common/Java/Applet")), - bExecute (sal_False ), - bRO (CFG_READONLY_DEFAULT ) -{ - RTL_LOGFILE_CONTEXT(aLog, "svtools SvtExecAppletsItem_Impl::SvtExecAppletsItem_Impl()"); - - Sequence< OUString > aNames(1); - aNames.getArray()[0] = C2U("Enable"); - Sequence< Any > aValues = GetProperties(aNames); - Sequence< sal_Bool > aROStates = GetReadOnlyStates(aNames); - const Any* pValues = aValues.getConstArray(); - const sal_Bool* pROStates = aROStates.getConstArray(); - if(aValues.getLength() && aROStates.getLength() && pValues[0].hasValue()) - { - bExecute = *(sal_Bool*)pValues[0].getValue(); - bRO = pROStates[0]; - } -} -void SvtExecAppletsItem_Impl::Commit() -{ - if (bRO) - return; - - Sequence< OUString > aNames(1); - aNames.getArray()[0] = C2U("Enable"); - Sequence< Any > aValues(1); - aValues.getArray()[0].setValue(&bExecute, ::getBooleanCppuType()); - PutProperties(aNames, aValues); -} - - -struct SvtJavaOptions_Impl -{ - SvtExecAppletsItem_Impl aExecItem; - Sequence aPropertyNames; - sal_Bool bEnabled; - sal_Bool bSecurity; - sal_Int32 nNetAccess; - rtl::OUString sUserClassPath; - - sal_Bool bROEnabled; - sal_Bool bROSecurity; - sal_Bool bRONetAccess; - sal_Bool bROUserClassPath; - - SvtJavaOptions_Impl() : - aPropertyNames(4), - bEnabled (sal_False), - bSecurity (sal_False), - nNetAccess (0), - bROEnabled (CFG_READONLY_DEFAULT), - bROSecurity (CFG_READONLY_DEFAULT), - bRONetAccess (CFG_READONLY_DEFAULT), - bROUserClassPath (CFG_READONLY_DEFAULT) - { - OUString* pNames = aPropertyNames.getArray(); - pNames[0] = C2U("Enable"); - pNames[1] = C2U("Security"); - pNames[2] = C2U("NetAccess"); - pNames[3] = C2U("UserClassPath"); - } -}; -/* -----------------------------18.05.01 13:28-------------------------------- - - ---------------------------------------------------------------------------*/ -SvtJavaOptions::SvtJavaOptions() : - utl::ConfigItem(C2U("Office.Java/VirtualMachine")), - pImpl(new SvtJavaOptions_Impl) -{ - RTL_LOGFILE_CONTEXT(aLog, "svtools SvtJavaOptions::SvtJavaOptions()"); - - Sequence< Any > aValues = GetProperties(pImpl->aPropertyNames); - Sequence< sal_Bool > aROStates = GetReadOnlyStates(pImpl->aPropertyNames); - const Any* pValues = aValues.getConstArray(); - const sal_Bool* pROStates = aROStates.getConstArray(); - if ( aValues.getLength() == pImpl->aPropertyNames.getLength() && aROStates.getLength() == pImpl->aPropertyNames.getLength() ) - { - for ( int nProp = 0; nProp < pImpl->aPropertyNames.getLength(); nProp++ ) - { - if( pValues[nProp].hasValue() ) - { - switch ( nProp ) - { - case 0: pImpl->bEnabled = *(sal_Bool*)pValues[nProp].getValue(); break; - case 1: pImpl->bSecurity = *(sal_Bool*)pValues[nProp].getValue();break; - case 2: pValues[nProp] >>= pImpl->nNetAccess; break; - case 3: pValues[nProp] >>= pImpl->sUserClassPath; break; - } - } - } - pImpl->bROEnabled = pROStates[0]; - pImpl->bROSecurity = pROStates[1]; - pImpl->bRONetAccess = pROStates[2]; - pImpl->bROUserClassPath = pROStates[3]; - } -} -/* -----------------------------18.05.01 13:28-------------------------------- - - ---------------------------------------------------------------------------*/ -SvtJavaOptions::~SvtJavaOptions() -{ - delete pImpl; -} -/*-- 18.05.01 13:28:35--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SvtJavaOptions::Commit() -{ - pImpl->aExecItem.Commit(); - - sal_Int32 nOrgCount = pImpl->aPropertyNames.getLength(); - Sequence< OUString > aNames(nOrgCount); - Sequence< Any > aValues(nOrgCount); - sal_Int32 nRealCount = 0; - - const Type& rType = ::getBooleanCppuType(); - for(int nProp = 0; nProp < nOrgCount; nProp++) - { - switch(nProp) - { - case 0: - { - if (!pImpl->bROEnabled) - { - aValues[nRealCount].setValue(&pImpl->bEnabled, rType); - aNames[nRealCount] = pImpl->aPropertyNames[nProp]; - ++nRealCount; - } - } - break; - case 1: - { - if (!pImpl->bROSecurity) - { - aValues[nRealCount].setValue(&pImpl->bSecurity, rType); - aNames[nRealCount] = pImpl->aPropertyNames[nProp]; - ++nRealCount; - } - } - break; - case 2: - { - if (!pImpl->bRONetAccess) - { - aValues[nRealCount] <<= pImpl->nNetAccess; - aNames[nRealCount] = pImpl->aPropertyNames[nProp]; - ++nRealCount; - } - } - break; - case 3: - { - if (!pImpl->bROUserClassPath) - { - aValues[nRealCount] <<= pImpl->sUserClassPath; - aNames[nRealCount] = pImpl->aPropertyNames[nProp]; - ++nRealCount; - } - } - break; - } - } - aValues.realloc(nRealCount); - aNames.realloc(nRealCount); - PutProperties(aNames,aValues); -} -/*-- 18.05.01 13:28:35--------------------------------------------------- - - -----------------------------------------------------------------------*/ -sal_Bool SvtJavaOptions::IsEnabled() const -{ - return pImpl->bEnabled; -} -/*-- 18.05.01 13:28:35--------------------------------------------------- - - -----------------------------------------------------------------------*/ -sal_Bool SvtJavaOptions::IsSecurity()const -{ - return pImpl->bSecurity; -} -/*-- 18.05.01 13:28:35--------------------------------------------------- - - -----------------------------------------------------------------------*/ -sal_Int32 SvtJavaOptions::GetNetAccess() const -{ - return pImpl->nNetAccess; -} -/*-- 18.05.01 13:28:36--------------------------------------------------- - - -----------------------------------------------------------------------*/ -rtl::OUString& SvtJavaOptions::GetUserClassPath()const -{ - return pImpl->sUserClassPath; -} -/*-- 18.05.01 13:28:37--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SvtJavaOptions::SetEnabled(sal_Bool bSet) -{ - OSL_ENSURE(!pImpl->bROEnabled, "SvtJavaOptions::SetEnabled()\nYou tried to write on a readonly value!\n"); - if(!pImpl->bROEnabled && pImpl->bEnabled != bSet) - { - pImpl->bEnabled = bSet; - SetModified(); - } -} -/*-- 18.05.01 13:28:38--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SvtJavaOptions::SetSecurity(sal_Bool bSet) -{ - OSL_ENSURE(!pImpl->bROSecurity, "SvtJavaOptions::SetSecurity()\nYou tried to write on a readonly value!\n"); - if(!pImpl->bROSecurity && pImpl->bSecurity != bSet) - { - pImpl->bSecurity = bSet; - SetModified(); - } -} -/*-- 18.05.01 13:28:38--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SvtJavaOptions::SetNetAccess(sal_Int32 nSet) -{ - OSL_ENSURE(!pImpl->bRONetAccess, "SvtJavaOptions::SetNetAccess()\nYou tried to write on a readonly value!\n"); - if(!pImpl->bRONetAccess && pImpl->nNetAccess != nSet) - { - pImpl->nNetAccess = nSet; - SetModified(); - } -} -/*-- 18.05.01 13:28:38--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SvtJavaOptions::SetUserClassPath(const rtl::OUString& rSet) -{ - OSL_ENSURE(!pImpl->bROUserClassPath, "SvtJavaOptions::SetUserClassPath()\nYou tried to write on a readonly value!\n"); - if(!pImpl->bROUserClassPath && pImpl->sUserClassPath != rSet) - { - pImpl->sUserClassPath = rSet; - SetModified(); - } -} - -/*-- 18.05.01 14:34:32--------------------------------------------------- - - -----------------------------------------------------------------------*/ -sal_Bool SvtJavaOptions::IsExecuteApplets() const -{ - return pImpl->aExecItem.IsExecuteApplets(); -} -/*-- 18.05.01 14:34:32--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SvtJavaOptions::SetExecuteApplets(sal_Bool bSet) -{ - if(!pImpl->aExecItem.IsReadOnly() && pImpl->aExecItem.IsExecuteApplets() != bSet) - { - pImpl->aExecItem.SetExecuteApplets(bSet); - SetModified(); - } -} -/*--10.02.2003 08:40--------------------------------------------------- - ------------------------------------------------------------------------*/ -sal_Bool SvtJavaOptions::IsReadOnly( EOption eOption ) const -{ - sal_Bool bRO = sal_True; - switch(eOption) - { - case E_ENABLED : - bRO = pImpl->bROEnabled; - break; - case E_SECURITY : - bRO = pImpl->bROSecurity; - break; - case E_NETACCESS : - bRO = pImpl->bRONetAccess; - break; - case E_USERCLASSPATH : - bRO = pImpl->bROUserClassPath; - break; - case E_EXECUTEAPPLETS : - bRO = pImpl->aExecItem.IsReadOnly(); - break; - } - return bRO; -} diff --git a/svtools/source/config/lingucfg.cxx b/svtools/source/config/lingucfg.cxx deleted file mode 100644 index 2b4e4d482c3f..000000000000 --- a/svtools/source/config/lingucfg.cxx +++ /dev/null @@ -1,1452 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: lingucfg.cxx,v $ - * $Revision: 1.14 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - - -#include -#include -#include -#include -#include -#include -#include "com/sun/star/util/XMacroExpander.hpp" -#include "com/sun/star/beans/XPropertySet.hpp" -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -using namespace rtl; -using namespace com::sun::star; - -#define A2OU(x) ::rtl::OUString::createFromAscii( x ) -#define EXPAND_PROTOCOL "vnd.sun.star.expand:" -#define FILE_PROTOCOL "file:///" - -/////////////////////////////////////////////////////////////////////////// - - -static osl::Mutex & GetOwnMutex() -{ - static osl::Mutex aMutex; - return aMutex; -} - - -/////////////////////////////////////////////////////////////////////////// - - -static BOOL lcl_SetLocale( INT16 &rLanguage, const uno::Any &rVal ) -{ - BOOL bSucc = FALSE; - - lang::Locale aNew; - if (rVal >>= aNew) // conversion successful? - { - INT16 nNew = MsLangId::convertLocaleToLanguage( aNew ); - if (nNew != rLanguage) - { - rLanguage = nNew; - bSucc = TRUE; - } - } - return bSucc; -} - - -static inline const OUString lcl_LanguageToCfgLocaleStr( INT16 nLanguage ) -{ - OUString aRes; - if (LANGUAGE_SYSTEM != nLanguage) - aRes = MsLangId::convertLanguageToIsoString( nLanguage ); - return aRes; -} - - -static INT16 lcl_CfgAnyToLanguage( const uno::Any &rVal ) -{ - OUString aTmp; - rVal >>= aTmp; - return (aTmp.getLength() == 0) ? LANGUAGE_SYSTEM : MsLangId::convertIsoStringToLanguage( aTmp ); -} - - -////////////////////////////////////////////////////////////////////// - -SvtLinguOptions::SvtLinguOptions() -{ - nDefaultLanguage = LANGUAGE_NONE; - nDefaultLanguage_CJK = LANGUAGE_NONE; - nDefaultLanguage_CTL = LANGUAGE_NONE; - - // general options - bIsUseDictionaryList = - bIsIgnoreControlCharacters = TRUE; - - // spelling options - bIsSpellCapitalization = - bIsSpellSpecial = TRUE; - bIsSpellAuto = - bIsSpellReverse = - bIsSpellWithDigits = - bIsSpellUpperCase = FALSE; - - // text conversion options - bIsIgnorePostPositionalWord = TRUE; - bIsAutoCloseDialog = - bIsShowEntriesRecentlyUsedFirst = - bIsAutoReplaceUniqueEntries = FALSE; - bIsDirectionToSimplified = TRUE; - bIsUseCharacterVariants = - bIsTranslateCommonTerms = - bIsReverseMapping = FALSE; - - bROIsDirectionToSimplified = - bROIsUseCharacterVariants = - bROIsTranslateCommonTerms = - bROIsReverseMapping = FALSE; - - // hyphenation options - bIsHyphSpecial = TRUE; - bIsHyphAuto = FALSE; - nHyphMinLeading = - nHyphMinTrailing = 2; - nHyphMinWordLength = 0; - - nDataFilesChangedCheckValue = 0; - - //grammar options - bIsGrammarAuto = sal_False, - bIsGrammarInteractive = sal_False; - -} - - -////////////////////////////////////////////////////////////////////// - - -class SvtLinguConfigItem : public utl::ConfigItem -{ - SvtLinguOptions aOpt; - - // disallow copy-constructor and assignment-operator for now - SvtLinguConfigItem( const SvtLinguConfigItem & ); - SvtLinguConfigItem & operator = ( const SvtLinguConfigItem & ); - - static BOOL GetHdlByName( INT32 &rnHdl, const OUString &rPropertyName, sal_Bool bFullPropName = sal_False ); - static const uno::Sequence< OUString > & GetPropertyNames(); - BOOL LoadOptions( const uno::Sequence< OUString > &rProperyNames ); - BOOL SaveOptions( const uno::Sequence< OUString > &rProperyNames ); - -public: - SvtLinguConfigItem(); - virtual ~SvtLinguConfigItem(); - - // utl::ConfigItem - virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString > &rPropertyNames ); - virtual void Commit(); - - // make some protected functions of utl::ConfigItem public - using utl::ConfigItem::GetNodeNames; - using utl::ConfigItem::GetProperties; - //using utl::ConfigItem::PutProperties; - //using utl::ConfigItem::SetSetProperties; - using utl::ConfigItem::ReplaceSetProperties; - //using utl::ConfigItem::GetReadOnlyStates; - - - com::sun::star::uno::Any - GetProperty( const rtl::OUString &rPropertyName ) const; - com::sun::star::uno::Any - GetProperty( INT32 nPropertyHandle ) const; - - BOOL SetProperty( const rtl::OUString &rPropertyName, - const com::sun::star::uno::Any &rValue ); - BOOL SetProperty( INT32 nPropertyHandle, - const com::sun::star::uno::Any &rValue ); - - BOOL GetOptions( SvtLinguOptions &rOptions ) const; - BOOL SetOptions( const SvtLinguOptions &rOptions ); - - BOOL IsReadOnly( const rtl::OUString &rPropertyName ) const; - BOOL IsReadOnly( INT32 nPropertyHandle ) const; -}; - - -SvtLinguConfigItem::SvtLinguConfigItem() : - utl::ConfigItem( String::CreateFromAscii( "Office.Linguistic" ) ) -{ - LoadOptions( GetPropertyNames() ); - ClearModified(); - - // request notify events when properties change - EnableNotification( GetPropertyNames() ); -} - - -SvtLinguConfigItem::~SvtLinguConfigItem() -{ - //! Commit (SaveOptions) will be called by the d-tor of the base called ! -} - - -void SvtLinguConfigItem::Notify( const uno::Sequence< OUString > &rPropertyNames ) -{ - LoadOptions( rPropertyNames ); -} - - -void SvtLinguConfigItem::Commit() -{ - SaveOptions( GetPropertyNames() ); -} - - -static struct NamesToHdl -{ - const char *pFullPropName; // full qualified name as used in configuration - const char *pPropName; // property name only (atom) of above - INT32 nHdl; // numeric handle representing the property -}aNamesToHdl[] = -{ -{/* 0 */ "General/DefaultLocale", UPN_DEFAULT_LOCALE, UPH_DEFAULT_LOCALE}, -{/* 1 */ "General/DictionaryList/ActiveDictionaries", UPN_ACTIVE_DICTIONARIES, UPH_ACTIVE_DICTIONARIES}, -{/* 2 */ "General/DictionaryList/IsUseDictionaryList", UPN_IS_USE_DICTIONARY_LIST, UPH_IS_USE_DICTIONARY_LIST}, -{/* 3 */ "General/IsIgnoreControlCharacters", UPN_IS_IGNORE_CONTROL_CHARACTERS, UPH_IS_IGNORE_CONTROL_CHARACTERS}, -{/* 5 */ "General/DefaultLocale_CJK", UPN_DEFAULT_LOCALE_CJK, UPH_DEFAULT_LOCALE_CJK}, -{/* 6 */ "General/DefaultLocale_CTL", UPN_DEFAULT_LOCALE_CTL, UPH_DEFAULT_LOCALE_CTL}, - -{/* 7 */ "SpellChecking/IsSpellUpperCase", UPN_IS_SPELL_UPPER_CASE, UPH_IS_SPELL_UPPER_CASE}, -{/* 8 */ "SpellChecking/IsSpellWithDigits", UPN_IS_SPELL_WITH_DIGITS, UPH_IS_SPELL_WITH_DIGITS}, -{/* 9 */ "SpellChecking/IsSpellCapitalization", UPN_IS_SPELL_CAPITALIZATION, UPH_IS_SPELL_CAPITALIZATION}, -{/* 10 */ "SpellChecking/IsSpellAuto", UPN_IS_SPELL_AUTO, UPH_IS_SPELL_AUTO}, -{/* 11 */ "SpellChecking/IsSpellSpecial", UPN_IS_SPELL_SPECIAL, UPH_IS_SPELL_SPECIAL}, -{/* 14 */ "SpellChecking/IsReverseDirection", UPN_IS_WRAP_REVERSE, UPH_IS_WRAP_REVERSE}, - -{/* 15 */ "Hyphenation/MinLeading", UPN_HYPH_MIN_LEADING, UPH_HYPH_MIN_LEADING}, -{/* 16 */ "Hyphenation/MinTrailing", UPN_HYPH_MIN_TRAILING, UPH_HYPH_MIN_TRAILING}, -{/* 17 */ "Hyphenation/MinWordLength", UPN_HYPH_MIN_WORD_LENGTH, UPH_HYPH_MIN_WORD_LENGTH}, -{/* 18 */ "Hyphenation/IsHyphSpecial", UPN_IS_HYPH_SPECIAL, UPH_IS_HYPH_SPECIAL}, -{/* 19 */ "Hyphenation/IsHyphAuto", UPN_IS_HYPH_AUTO, UPH_IS_HYPH_AUTO}, - -{/* 20 */ "TextConversion/ActiveConversionDictionaries", UPN_ACTIVE_CONVERSION_DICTIONARIES, UPH_ACTIVE_CONVERSION_DICTIONARIES}, -{/* 21 */ "TextConversion/IsIgnorePostPositionalWord", UPN_IS_IGNORE_POST_POSITIONAL_WORD, UPH_IS_IGNORE_POST_POSITIONAL_WORD}, -{/* 22 */ "TextConversion/IsAutoCloseDialog", UPN_IS_AUTO_CLOSE_DIALOG, UPH_IS_AUTO_CLOSE_DIALOG}, -{/* 23 */ "TextConversion/IsShowEntriesRecentlyUsedFirst", UPN_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST, UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST}, -{/* 24 */ "TextConversion/IsAutoReplaceUniqueEntries", UPN_IS_AUTO_REPLACE_UNIQUE_ENTRIES, UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES}, -{/* 25 */ "TextConversion/IsDirectionToSimplified", UPN_IS_DIRECTION_TO_SIMPLIFIED, UPH_IS_DIRECTION_TO_SIMPLIFIED}, -{/* 26 */ "TextConversion/IsUseCharacterVariants", UPN_IS_USE_CHARACTER_VARIANTS, UPH_IS_USE_CHARACTER_VARIANTS}, -{/* 27 */ "TextConversion/IsTranslateCommonTerms", UPN_IS_TRANSLATE_COMMON_TERMS, UPH_IS_TRANSLATE_COMMON_TERMS}, -{/* 28 */ "TextConversion/IsReverseMapping", UPN_IS_REVERSE_MAPPING, UPH_IS_REVERSE_MAPPING}, - -{/* 29 */ "ServiceManager/DataFilesChangedCheckValue", UPN_DATA_FILES_CHANGED_CHECK_VALUE, UPH_DATA_FILES_CHANGED_CHECK_VALUE}, - -{/* 30 */ "GrammarChecking/IsAutoCheck", UPN_IS_GRAMMAR_AUTO, UPH_IS_GRAMMAR_AUTO}, -{/* 31 */ "GrammarChecking/IsInteractiveCheck", UPN_IS_GRAMMAR_INTERACTIVE, UPH_IS_GRAMMAR_INTERACTIVE}, - - /* similar to entry 0 (thus no own configuration entry) but with different property name and type */ -{ NULL, UPN_DEFAULT_LANGUAGE, UPH_DEFAULT_LANGUAGE}, - -{ NULL, NULL, -1} -}; - - -const uno::Sequence< OUString > & SvtLinguConfigItem::GetPropertyNames() -{ - static uno::Sequence< OUString > aNames; - static sal_Bool bInitialized = sal_False; - - if (!bInitialized) - { - INT32 nMax = sizeof(aNamesToHdl) / sizeof(aNamesToHdl[0]); - - aNames.realloc( nMax ); - OUString *pNames = aNames.getArray(); - INT32 nIdx = 0; - for (INT32 i = 0; i < nMax; ++i) - { - const sal_Char *pFullPropName = aNamesToHdl[i].pFullPropName; - if (pFullPropName) - pNames[ nIdx++ ] = A2OU( pFullPropName ); - } - aNames.realloc( nIdx ); - bInitialized = sal_True; - } - return aNames; -} - - -BOOL SvtLinguConfigItem::GetHdlByName( - INT32 &rnHdl, - const OUString &rPropertyName, - sal_Bool bFullPropName ) -{ - NamesToHdl *pEntry = &aNamesToHdl[0]; - - if (bFullPropName) - { - while (pEntry && pEntry->pFullPropName != NULL) - { - if (0 == rPropertyName.compareToAscii( pEntry->pFullPropName )) - { - rnHdl = pEntry->nHdl; - break; - } - ++pEntry; - } - return pEntry && pEntry->pFullPropName != NULL; - } - else - { - while (pEntry && pEntry->pPropName != NULL) - { - if (0 == rPropertyName.compareToAscii( pEntry->pPropName )) - { - rnHdl = pEntry->nHdl; - break; - } - ++pEntry; - } - return pEntry && pEntry->pPropName != NULL; - } -} - - -uno::Any SvtLinguConfigItem::GetProperty( const OUString &rPropertyName ) const -{ - osl::MutexGuard aGuard( GetOwnMutex() ); - - INT32 nHdl; - return GetHdlByName( nHdl, rPropertyName ) ? GetProperty( nHdl ) : uno::Any(); -} - - -uno::Any SvtLinguConfigItem::GetProperty( INT32 nPropertyHandle ) const -{ - osl::MutexGuard aGuard( GetOwnMutex() ); - - uno::Any aRes; - - const INT16 *pnVal = 0; - const BOOL *pbVal = 0; - const INT32 *pnInt32Val = 0; - - const SvtLinguOptions &rOpt = const_cast< SvtLinguConfigItem * >(this)->aOpt; - switch (nPropertyHandle) - { - case UPH_IS_USE_DICTIONARY_LIST : pbVal = &rOpt.bIsUseDictionaryList; break; - case UPH_IS_IGNORE_CONTROL_CHARACTERS : pbVal = &rOpt.bIsIgnoreControlCharacters; break; - case UPH_IS_HYPH_AUTO : pbVal = &rOpt.bIsHyphAuto; break; - case UPH_IS_HYPH_SPECIAL : pbVal = &rOpt.bIsHyphSpecial; break; - case UPH_IS_SPELL_AUTO : pbVal = &rOpt.bIsSpellAuto; break; - case UPH_IS_SPELL_SPECIAL : pbVal = &rOpt.bIsSpellSpecial; break; - case UPH_IS_WRAP_REVERSE : pbVal = &rOpt.bIsSpellReverse; break; - case UPH_DEFAULT_LANGUAGE : pnVal = &rOpt.nDefaultLanguage; break; - case UPH_IS_SPELL_CAPITALIZATION : pbVal = &rOpt.bIsSpellCapitalization; break; - case UPH_IS_SPELL_WITH_DIGITS : pbVal = &rOpt.bIsSpellWithDigits; break; - case UPH_IS_SPELL_UPPER_CASE : pbVal = &rOpt.bIsSpellUpperCase; break; - case UPH_HYPH_MIN_LEADING : pnVal = &rOpt.nHyphMinLeading; break; - case UPH_HYPH_MIN_TRAILING : pnVal = &rOpt.nHyphMinTrailing; break; - case UPH_HYPH_MIN_WORD_LENGTH : pnVal = &rOpt.nHyphMinWordLength; break; - case UPH_ACTIVE_DICTIONARIES : - { - aRes <<= rOpt.aActiveDics; - break; - } - case UPH_ACTIVE_CONVERSION_DICTIONARIES : - { - aRes <<= rOpt.aActiveConvDics; - break; - } - case UPH_DEFAULT_LOCALE : - { - lang::Locale aLocale( MsLangId::convertLanguageToLocale( rOpt.nDefaultLanguage, false ) ); - aRes.setValue( &aLocale, ::getCppuType((lang::Locale*)0 )); - break; - } - case UPH_DEFAULT_LOCALE_CJK : - { - lang::Locale aLocale( MsLangId::convertLanguageToLocale( rOpt.nDefaultLanguage_CJK, false ) ); - aRes.setValue( &aLocale, ::getCppuType((lang::Locale*)0 )); - break; - } - case UPH_DEFAULT_LOCALE_CTL : - { - lang::Locale aLocale( MsLangId::convertLanguageToLocale( rOpt.nDefaultLanguage_CTL, false ) ); - aRes.setValue( &aLocale, ::getCppuType((lang::Locale*)0 )); - break; - } - case UPH_IS_IGNORE_POST_POSITIONAL_WORD : pbVal = &rOpt.bIsIgnorePostPositionalWord; break; - case UPH_IS_AUTO_CLOSE_DIALOG : pbVal = &rOpt.bIsAutoCloseDialog; break; - case UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST : pbVal = &rOpt.bIsShowEntriesRecentlyUsedFirst; break; - case UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES : pbVal = &rOpt.bIsAutoReplaceUniqueEntries; break; - - case UPH_IS_DIRECTION_TO_SIMPLIFIED: pbVal = &rOpt.bIsDirectionToSimplified; break; - case UPH_IS_USE_CHARACTER_VARIANTS : pbVal = &rOpt.bIsUseCharacterVariants; break; - case UPH_IS_TRANSLATE_COMMON_TERMS : pbVal = &rOpt.bIsTranslateCommonTerms; break; - case UPH_IS_REVERSE_MAPPING : pbVal = &rOpt.bIsReverseMapping; break; - - case UPH_DATA_FILES_CHANGED_CHECK_VALUE : pnInt32Val = &rOpt.nDataFilesChangedCheckValue; break; - case UPH_IS_GRAMMAR_AUTO: pbVal = &rOpt.bIsGrammarAuto; break; - case UPH_IS_GRAMMAR_INTERACTIVE: pbVal = &rOpt.bIsGrammarInteractive; break; - default : - DBG_ASSERT( 0, "unexpected property handle" ); - } - - if (pbVal) - aRes <<= *pbVal; - else if (pnVal) - aRes <<= *pnVal; - else if (pnInt32Val) - aRes <<= *pnInt32Val; - - return aRes; -} - - -BOOL SvtLinguConfigItem::SetProperty( const OUString &rPropertyName, const uno::Any &rValue ) -{ - osl::MutexGuard aGuard( GetOwnMutex() ); - - BOOL bSucc = FALSE; - INT32 nHdl; - if (GetHdlByName( nHdl, rPropertyName )) - bSucc = SetProperty( nHdl, rValue ); - return bSucc; -} - - -BOOL SvtLinguConfigItem::SetProperty( INT32 nPropertyHandle, const uno::Any &rValue ) -{ - osl::MutexGuard aGuard( GetOwnMutex() ); - - BOOL bSucc = FALSE; - if (!rValue.hasValue()) - return bSucc; - - BOOL bMod = FALSE; - - INT16 *pnVal = 0; - BOOL *pbVal = 0; - INT32 *pnInt32Val = 0; - - SvtLinguOptions &rOpt = aOpt; - switch (nPropertyHandle) - { - case UPH_IS_USE_DICTIONARY_LIST : pbVal = &rOpt.bIsUseDictionaryList; break; - case UPH_IS_IGNORE_CONTROL_CHARACTERS : pbVal = &rOpt.bIsIgnoreControlCharacters; break; - case UPH_IS_HYPH_AUTO : pbVal = &rOpt.bIsHyphAuto; break; - case UPH_IS_HYPH_SPECIAL : pbVal = &rOpt.bIsHyphSpecial; break; - case UPH_IS_SPELL_AUTO : pbVal = &rOpt.bIsSpellAuto; break; - case UPH_IS_SPELL_SPECIAL : pbVal = &rOpt.bIsSpellSpecial; break; - case UPH_IS_WRAP_REVERSE : pbVal = &rOpt.bIsSpellReverse; break; - case UPH_DEFAULT_LANGUAGE : pnVal = &rOpt.nDefaultLanguage; break; - case UPH_IS_SPELL_CAPITALIZATION : pbVal = &rOpt.bIsSpellCapitalization; break; - case UPH_IS_SPELL_WITH_DIGITS : pbVal = &rOpt.bIsSpellWithDigits; break; - case UPH_IS_SPELL_UPPER_CASE : pbVal = &rOpt.bIsSpellUpperCase; break; - case UPH_HYPH_MIN_LEADING : pnVal = &rOpt.nHyphMinLeading; break; - case UPH_HYPH_MIN_TRAILING : pnVal = &rOpt.nHyphMinTrailing; break; - case UPH_HYPH_MIN_WORD_LENGTH : pnVal = &rOpt.nHyphMinWordLength; break; - case UPH_ACTIVE_DICTIONARIES : - { - rValue >>= rOpt.aActiveDics; - bMod = TRUE; - break; - } - case UPH_ACTIVE_CONVERSION_DICTIONARIES : - { - rValue >>= rOpt.aActiveConvDics; - bMod = TRUE; - break; - } - case UPH_DEFAULT_LOCALE : - { - bSucc = lcl_SetLocale( rOpt.nDefaultLanguage, rValue ); - bMod = bSucc; - break; - } - case UPH_DEFAULT_LOCALE_CJK : - { - bSucc = lcl_SetLocale( rOpt.nDefaultLanguage_CJK, rValue ); - bMod = bSucc; - break; - } - case UPH_DEFAULT_LOCALE_CTL : - { - bSucc = lcl_SetLocale( rOpt.nDefaultLanguage_CTL, rValue ); - bMod = bSucc; - break; - } - case UPH_IS_IGNORE_POST_POSITIONAL_WORD : pbVal = &rOpt.bIsIgnorePostPositionalWord; break; - case UPH_IS_AUTO_CLOSE_DIALOG : pbVal = &rOpt.bIsAutoCloseDialog; break; - case UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST : pbVal = &rOpt.bIsShowEntriesRecentlyUsedFirst; break; - case UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES : pbVal = &rOpt.bIsAutoReplaceUniqueEntries; break; - - case UPH_IS_DIRECTION_TO_SIMPLIFIED : pbVal = &rOpt.bIsDirectionToSimplified; break; - case UPH_IS_USE_CHARACTER_VARIANTS : pbVal = &rOpt.bIsUseCharacterVariants; break; - case UPH_IS_TRANSLATE_COMMON_TERMS : pbVal = &rOpt.bIsTranslateCommonTerms; break; - case UPH_IS_REVERSE_MAPPING : pbVal = &rOpt.bIsReverseMapping; break; - - case UPH_DATA_FILES_CHANGED_CHECK_VALUE : pnInt32Val = &rOpt.nDataFilesChangedCheckValue; break; - case UPH_IS_GRAMMAR_AUTO: pbVal = &rOpt.bIsGrammarAuto; break; - case UPH_IS_GRAMMAR_INTERACTIVE: pbVal = &rOpt.bIsGrammarInteractive; break; - default : - DBG_ASSERT( 0, "unexpected property handle" ); - } - - if (pbVal) - { - BOOL bNew = BOOL(); - if (rValue >>= bNew) - { - if (bNew != *pbVal) - { - *pbVal = bNew; - bMod = TRUE; - } - bSucc = TRUE; - } - } - else if (pnVal) - { - INT16 nNew = INT16(); - if (rValue >>= nNew) - { - if (nNew != *pnVal) - { - *pnVal = nNew; - bMod = TRUE; - } - bSucc = TRUE; - } - } - else if (pnInt32Val) - { - INT32 nNew = INT32(); - if (rValue >>= nNew) - { - if (nNew != *pnInt32Val) - { - *pnInt32Val = nNew; - bMod = TRUE; - } - bSucc = TRUE; - } - } - - if (bMod) - SetModified(); - - return bSucc; -} - - -BOOL SvtLinguConfigItem::GetOptions( SvtLinguOptions &rOptions ) const -{ - osl::MutexGuard aGuard( GetOwnMutex() ); - - rOptions = aOpt; - return TRUE; -} - - -BOOL SvtLinguConfigItem::SetOptions( const SvtLinguOptions &rOptions ) -{ - osl::MutexGuard aGuard( GetOwnMutex() ); - - aOpt = rOptions; - SetModified(); - return TRUE; -} - - -BOOL SvtLinguConfigItem::LoadOptions( const uno::Sequence< OUString > &rProperyNames ) -{ - osl::MutexGuard aGuard( GetOwnMutex() ); - - BOOL bRes = FALSE; - - const OUString *pProperyNames = rProperyNames.getConstArray(); - INT32 nProps = rProperyNames.getLength(); - - const uno::Sequence< uno::Any > aValues = GetProperties( rProperyNames ); - const uno::Sequence< sal_Bool > aROStates = GetReadOnlyStates( rProperyNames ); - - if (nProps && aValues.getLength() == nProps && aROStates.getLength() == nProps) - { - SvtLinguOptions &rOpt = aOpt; - - const uno::Any *pValue = aValues.getConstArray(); - const sal_Bool *pROStates = aROStates.getConstArray(); - for (INT32 i = 0; i < nProps; ++i) - { - const uno::Any &rVal = pValue[i]; - INT32 nPropertyHandle; - GetHdlByName( nPropertyHandle, pProperyNames[i], sal_True ); - switch ( nPropertyHandle ) - { - case UPH_DEFAULT_LOCALE : - { rOpt.bRODefaultLanguage = pROStates[i]; rOpt.nDefaultLanguage = lcl_CfgAnyToLanguage( rVal ); } break; - case UPH_ACTIVE_DICTIONARIES : - { rOpt.bROActiveDics = pROStates[i]; rVal >>= rOpt.aActiveDics; } break; - case UPH_IS_USE_DICTIONARY_LIST : - { rOpt.bROIsUseDictionaryList = pROStates[i]; rVal >>= rOpt.bIsUseDictionaryList; } break; - case UPH_IS_IGNORE_CONTROL_CHARACTERS : - { rOpt.bROIsIgnoreControlCharacters = pROStates[i]; rVal >>= rOpt.bIsIgnoreControlCharacters; } break; - case UPH_DEFAULT_LOCALE_CJK : - { rOpt.bRODefaultLanguage_CJK = pROStates[i]; rOpt.nDefaultLanguage_CJK = lcl_CfgAnyToLanguage( rVal ); } break; - case UPH_DEFAULT_LOCALE_CTL : - { rOpt.bRODefaultLanguage_CTL = pROStates[i]; rOpt.nDefaultLanguage_CTL = lcl_CfgAnyToLanguage( rVal ); } break; - - case UPH_IS_SPELL_UPPER_CASE : - { rOpt.bROIsSpellUpperCase = pROStates[i]; rVal >>= rOpt.bIsSpellUpperCase; } break; - case UPH_IS_SPELL_WITH_DIGITS : - { rOpt.bROIsSpellWithDigits = pROStates[i]; rVal >>= rOpt.bIsSpellWithDigits; } break; - case UPH_IS_SPELL_CAPITALIZATION : - { rOpt.bROIsSpellCapitalization = pROStates[i]; rVal >>= rOpt.bIsSpellCapitalization; } break; - case UPH_IS_SPELL_AUTO : - { rOpt.bROIsSpellAuto = pROStates[i]; rVal >>= rOpt.bIsSpellAuto; } break; - case UPH_IS_SPELL_SPECIAL : - { rOpt.bROIsSpellSpecial = pROStates[i]; rVal >>= rOpt.bIsSpellSpecial; } break; - case UPH_IS_WRAP_REVERSE : - { rOpt.bROIsSpellReverse = pROStates[i]; rVal >>= rOpt.bIsSpellReverse; } break; - - case UPH_HYPH_MIN_LEADING : - { rOpt.bROHyphMinLeading = pROStates[i]; rVal >>= rOpt.nHyphMinLeading; } break; - case UPH_HYPH_MIN_TRAILING : - { rOpt.bROHyphMinTrailing = pROStates[i]; rVal >>= rOpt.nHyphMinTrailing; } break; - case UPH_HYPH_MIN_WORD_LENGTH : - { rOpt.bROHyphMinWordLength = pROStates[i]; rVal >>= rOpt.nHyphMinWordLength; } break; - case UPH_IS_HYPH_SPECIAL : - { rOpt.bROIsHyphSpecial = pROStates[i]; rVal >>= rOpt.bIsHyphSpecial; } break; - case UPH_IS_HYPH_AUTO : - { rOpt.bROIsHyphAuto = pROStates[i]; rVal >>= rOpt.bIsHyphAuto; } break; - - case UPH_ACTIVE_CONVERSION_DICTIONARIES : { rOpt.bROActiveConvDics = pROStates[i]; rVal >>= rOpt.aActiveConvDics; } break; - - case UPH_IS_IGNORE_POST_POSITIONAL_WORD : - { rOpt.bROIsIgnorePostPositionalWord = pROStates[i]; rVal >>= rOpt.bIsIgnorePostPositionalWord; } break; - case UPH_IS_AUTO_CLOSE_DIALOG : - { rOpt.bROIsAutoCloseDialog = pROStates[i]; rVal >>= rOpt.bIsAutoCloseDialog; } break; - case UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST : - { rOpt.bROIsShowEntriesRecentlyUsedFirst = pROStates[i]; rVal >>= rOpt.bIsShowEntriesRecentlyUsedFirst; } break; - case UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES : - { rOpt.bROIsAutoReplaceUniqueEntries = pROStates[i]; rVal >>= rOpt.bIsAutoReplaceUniqueEntries; } break; - - case UPH_IS_DIRECTION_TO_SIMPLIFIED : - { rOpt.bROIsDirectionToSimplified = pROStates[i]; - if( ! (rVal >>= rOpt.bIsDirectionToSimplified) ) - { - //default is locale dependent: - if( rOpt.nDefaultLanguage_CJK == LANGUAGE_CHINESE_HONGKONG - || rOpt.nDefaultLanguage_CJK == LANGUAGE_CHINESE_MACAU - || rOpt.nDefaultLanguage_CJK == LANGUAGE_CHINESE_TRADITIONAL ) - { - rOpt.bIsDirectionToSimplified = FALSE; - } - else - { - rOpt.bIsDirectionToSimplified = TRUE; - } - } - } break; - case UPH_IS_USE_CHARACTER_VARIANTS : - { rOpt.bROIsUseCharacterVariants = pROStates[i]; rVal >>= rOpt.bIsUseCharacterVariants; } break; - case UPH_IS_TRANSLATE_COMMON_TERMS : - { rOpt.bROIsTranslateCommonTerms = pROStates[i]; rVal >>= rOpt.bIsTranslateCommonTerms; } break; - case UPH_IS_REVERSE_MAPPING : - { rOpt.bROIsReverseMapping = pROStates[i]; rVal >>= rOpt.bIsReverseMapping; } break; - - case UPH_DATA_FILES_CHANGED_CHECK_VALUE : - { rOpt.bRODataFilesChangedCheckValue = pROStates[i]; rVal >>= rOpt.nDataFilesChangedCheckValue; } break; - - case UPH_IS_GRAMMAR_AUTO: - { rOpt.bROIsGrammarAuto = pROStates[i]; rVal >>= rOpt.bIsGrammarAuto; } - break; - case UPH_IS_GRAMMAR_INTERACTIVE: - { rOpt.bROIsGrammarInteractive = pROStates[i]; rVal >>= rOpt.bIsGrammarInteractive; } - break; - - default: - DBG_ASSERT( 0, "unexpected case" ); - } - } - - bRes = TRUE; - } - DBG_ASSERT( bRes, "LoadOptions failed" ); - - return bRes; -} - - -BOOL SvtLinguConfigItem::SaveOptions( const uno::Sequence< OUString > &rProperyNames ) -{ - if (!IsModified()) - return TRUE; - - osl::MutexGuard aGuard( GetOwnMutex() ); - - BOOL bRet = FALSE; - const uno::Type &rBOOL = ::getBooleanCppuType(); - const uno::Type &rINT16 = ::getCppuType( (INT16 *) NULL ); - const uno::Type &rINT32 = ::getCppuType( (INT32 *) NULL ); - - INT32 nProps = rProperyNames.getLength(); - uno::Sequence< uno::Any > aValues( nProps ); - uno::Any *pValue = aValues.getArray(); - - if (nProps && aValues.getLength() == nProps) - { - const SvtLinguOptions &rOpt = aOpt; - - OUString aTmp( lcl_LanguageToCfgLocaleStr( rOpt.nDefaultLanguage ) ); - *pValue++ = uno::makeAny( aTmp ); // 0 - *pValue++ = uno::makeAny( rOpt.aActiveDics ); // 1 - pValue++->setValue( &rOpt.bIsUseDictionaryList, rBOOL ); // 2 - pValue++->setValue( &rOpt.bIsIgnoreControlCharacters, rBOOL ); // 3 - aTmp = lcl_LanguageToCfgLocaleStr( rOpt.nDefaultLanguage_CJK ); - *pValue++ = uno::makeAny( aTmp ); // 5 - aTmp = lcl_LanguageToCfgLocaleStr( rOpt.nDefaultLanguage_CTL ); - *pValue++ = uno::makeAny( aTmp ); // 6 - - pValue++->setValue( &rOpt.bIsSpellUpperCase, rBOOL ); // 7 - pValue++->setValue( &rOpt.bIsSpellWithDigits, rBOOL ); // 8 - pValue++->setValue( &rOpt.bIsSpellCapitalization, rBOOL ); // 9 - pValue++->setValue( &rOpt.bIsSpellAuto, rBOOL ); // 10 - pValue++->setValue( &rOpt.bIsSpellSpecial, rBOOL ); // 11 - pValue++->setValue( &rOpt.bIsSpellReverse, rBOOL ); // 14 - - pValue++->setValue( &rOpt.nHyphMinLeading, rINT16 ); // 15 - pValue++->setValue( &rOpt.nHyphMinTrailing, rINT16 ); // 16 - pValue++->setValue( &rOpt.nHyphMinWordLength, rINT16 ); // 17 - pValue++->setValue( &rOpt.bIsHyphSpecial, rBOOL ); // 18 - pValue++->setValue( &rOpt.bIsHyphAuto, rBOOL ); // 19 - - *pValue++ = uno::makeAny( rOpt.aActiveConvDics ); // 20 - - pValue++->setValue( &rOpt.bIsIgnorePostPositionalWord, rBOOL ); // 21 - pValue++->setValue( &rOpt.bIsAutoCloseDialog, rBOOL ); // 22 - pValue++->setValue( &rOpt.bIsShowEntriesRecentlyUsedFirst, rBOOL ); // 23 - pValue++->setValue( &rOpt.bIsAutoReplaceUniqueEntries, rBOOL ); // 24 - - pValue++->setValue( &rOpt.bIsDirectionToSimplified, rBOOL ); // 25 - pValue++->setValue( &rOpt.bIsUseCharacterVariants, rBOOL ); // 26 - pValue++->setValue( &rOpt.bIsTranslateCommonTerms, rBOOL ); // 27 - pValue++->setValue( &rOpt.bIsReverseMapping, rBOOL ); // 28 - - pValue++->setValue( &rOpt.nDataFilesChangedCheckValue, rINT32 ); // 29 - pValue++->setValue( &rOpt.bIsGrammarAuto, rBOOL ); // 30 - pValue++->setValue( &rOpt.bIsGrammarInteractive, rBOOL ); // 31 - - bRet |= PutProperties( rProperyNames, aValues ); - } - - if (bRet) - ClearModified(); - - return bRet; -} - -BOOL SvtLinguConfigItem::IsReadOnly( const rtl::OUString &rPropertyName ) const -{ - osl::MutexGuard aGuard( GetOwnMutex() ); - - BOOL bReadOnly = FALSE; - INT32 nHdl; - if (GetHdlByName( nHdl, rPropertyName )) - bReadOnly = IsReadOnly( nHdl ); - return bReadOnly; -} - -BOOL SvtLinguConfigItem::IsReadOnly( INT32 nPropertyHandle ) const -{ - osl::MutexGuard aGuard( GetOwnMutex() ); - - BOOL bReadOnly = FALSE; - - const SvtLinguOptions &rOpt = const_cast< SvtLinguConfigItem * >(this)->aOpt; - switch(nPropertyHandle) - { - case UPH_IS_USE_DICTIONARY_LIST : bReadOnly = rOpt.bROIsUseDictionaryList ; break; - case UPH_IS_IGNORE_CONTROL_CHARACTERS : bReadOnly = rOpt.bROIsIgnoreControlCharacters; break; - case UPH_IS_HYPH_AUTO : bReadOnly = rOpt.bROIsHyphAuto ; break; - case UPH_IS_HYPH_SPECIAL : bReadOnly = rOpt.bROIsHyphSpecial ; break; - case UPH_IS_SPELL_AUTO : bReadOnly = rOpt.bROIsSpellAuto ; break; - case UPH_IS_SPELL_SPECIAL : bReadOnly = rOpt.bROIsSpellSpecial ; break; - case UPH_IS_WRAP_REVERSE : bReadOnly = rOpt.bROIsSpellReverse ; break; - case UPH_DEFAULT_LANGUAGE : bReadOnly = rOpt.bRODefaultLanguage ; break; - case UPH_IS_SPELL_CAPITALIZATION : bReadOnly = rOpt.bROIsSpellCapitalization ; break; - case UPH_IS_SPELL_WITH_DIGITS : bReadOnly = rOpt.bROIsSpellWithDigits ; break; - case UPH_IS_SPELL_UPPER_CASE : bReadOnly = rOpt.bROIsSpellUpperCase ; break; - case UPH_HYPH_MIN_LEADING : bReadOnly = rOpt.bROHyphMinLeading ; break; - case UPH_HYPH_MIN_TRAILING : bReadOnly = rOpt.bROHyphMinTrailing ; break; - case UPH_HYPH_MIN_WORD_LENGTH : bReadOnly = rOpt.bROHyphMinWordLength ; break; - case UPH_ACTIVE_DICTIONARIES : bReadOnly = rOpt.bROActiveDics ; break; - case UPH_ACTIVE_CONVERSION_DICTIONARIES : bReadOnly = rOpt.bROActiveConvDics ; break; - case UPH_DEFAULT_LOCALE : bReadOnly = rOpt.bRODefaultLanguage ; break; - case UPH_DEFAULT_LOCALE_CJK : bReadOnly = rOpt.bRODefaultLanguage_CJK ; break; - case UPH_DEFAULT_LOCALE_CTL : bReadOnly = rOpt.bRODefaultLanguage_CTL ; break; - case UPH_IS_IGNORE_POST_POSITIONAL_WORD : bReadOnly = rOpt.bROIsIgnorePostPositionalWord; break; - case UPH_IS_AUTO_CLOSE_DIALOG : bReadOnly = rOpt.bROIsAutoCloseDialog; break; - case UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST : bReadOnly = rOpt.bROIsShowEntriesRecentlyUsedFirst; break; - case UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES : bReadOnly = rOpt.bROIsAutoReplaceUniqueEntries; break; - case UPH_IS_DIRECTION_TO_SIMPLIFIED : bReadOnly = rOpt.bROIsDirectionToSimplified; break; - case UPH_IS_USE_CHARACTER_VARIANTS : bReadOnly = rOpt.bROIsUseCharacterVariants; break; - case UPH_IS_TRANSLATE_COMMON_TERMS : bReadOnly = rOpt.bROIsTranslateCommonTerms; break; - case UPH_IS_REVERSE_MAPPING : bReadOnly = rOpt.bROIsReverseMapping; break; - case UPH_DATA_FILES_CHANGED_CHECK_VALUE : bReadOnly = rOpt.bRODataFilesChangedCheckValue; break; - case UPH_IS_GRAMMAR_AUTO: bReadOnly = rOpt.bROIsGrammarAuto; break; - case UPH_IS_GRAMMAR_INTERACTIVE: bReadOnly = rOpt.bROIsGrammarInteractive; break; - default : - DBG_ASSERT( 0, "unexpected property handle" ); - } - return bReadOnly; -} - -////////////////////////////////////////////////////////////////////// - -static SvtLinguConfigItem *pCfgItem = 0; -static sal_Int32 nCfgItemRefCount = 0; - -static const rtl::OUString aG_SupportedDictionaryFormats( A2OU("SupportedDictionaryFormats") ); -static const rtl::OUString aG_Dictionaries( A2OU("Dictionaries") ); -static const rtl::OUString aG_Locations( A2OU("Locations") ); -static const rtl::OUString aG_Format( A2OU("Format") ); -static const rtl::OUString aG_Locales( A2OU("Locales") ); -static const rtl::OUString aG_DisabledDictionaries( A2OU("DisabledDictionaries") ); -static const rtl::OUString aG_LastActiveDictionaries( A2OU("LastActiveDictionaries") ); - -SvtLinguConfig::SvtLinguConfig() -{ - // Global access, must be guarded (multithreading) - osl::MutexGuard aGuard( GetOwnMutex() ); - ++nCfgItemRefCount; -} - - -SvtLinguConfig::~SvtLinguConfig() -{ - osl::MutexGuard aGuard( GetOwnMutex() ); - - if (pCfgItem && pCfgItem->IsModified()) - pCfgItem->Commit(); - - if (--nCfgItemRefCount <= 0) - { - if (pCfgItem) - delete pCfgItem; - pCfgItem = 0; - } -} - - -SvtLinguConfigItem & SvtLinguConfig::GetConfigItem() -{ - // Global access, must be guarded (multithreading) - osl::MutexGuard aGuard( GetOwnMutex() ); - if (!pCfgItem) - { - pCfgItem = new SvtLinguConfigItem; - ItemHolder1::holdConfigItem(E_LINGUCFG); - } - return *pCfgItem; -} - - -uno::Sequence< OUString > SvtLinguConfig::GetNodeNames( const OUString &rNode ) -{ - return GetConfigItem().GetNodeNames( rNode ); -} - - -uno::Sequence< uno::Any > SvtLinguConfig::GetProperties( const uno::Sequence< OUString > &rNames ) -{ - return GetConfigItem().GetProperties(rNames); -} - - -sal_Bool SvtLinguConfig::ReplaceSetProperties( - const OUString &rNode, uno::Sequence< beans::PropertyValue > rValues ) -{ - return GetConfigItem().ReplaceSetProperties( rNode, rValues ); -} - - -uno::Any SvtLinguConfig::GetProperty( const OUString &rPropertyName ) const -{ - return GetConfigItem().GetProperty( rPropertyName ); -} - - -uno::Any SvtLinguConfig::GetProperty( INT32 nPropertyHandle ) const -{ - return GetConfigItem().GetProperty( nPropertyHandle ); -} - - -BOOL SvtLinguConfig::SetProperty( const OUString &rPropertyName, const uno::Any &rValue ) -{ - return GetConfigItem().SetProperty( rPropertyName, rValue ); -} - - -BOOL SvtLinguConfig::SetProperty( INT32 nPropertyHandle, const uno::Any &rValue ) -{ - return GetConfigItem().SetProperty( nPropertyHandle, rValue ); -} - - -BOOL SvtLinguConfig::GetOptions( SvtLinguOptions &rOptions ) const -{ - return GetConfigItem().GetOptions( rOptions ); -} - - -BOOL SvtLinguConfig::SetOptions( const SvtLinguOptions &rOptions ) -{ - return GetConfigItem().SetOptions( rOptions ); -} - - -BOOL SvtLinguConfig::IsReadOnly( const rtl::OUString &rPropertyName ) const -{ - return GetConfigItem().IsReadOnly( rPropertyName ); -} - -BOOL SvtLinguConfig::IsReadOnly( INT32 nPropertyHandle ) const -{ - return GetConfigItem().IsReadOnly( nPropertyHandle ); -} - -BOOL SvtLinguConfig::GetElementNamesFor( - const rtl::OUString &rNodeName, - uno::Sequence< rtl::OUString > &rElementNames ) const -{ - bool bSuccess = false; - try - { - uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( rNodeName ), uno::UNO_QUERY_THROW ); - rElementNames = xNA->getElementNames(); - bSuccess = true; - } - catch (uno::Exception &) - { - } - return bSuccess; -} - -static uno::Reference< container::XNameAccess > GetOrCreateSetEntry_Impl( - const uno::Reference< container::XNameAccess > &rxSetNameAccess, - const rtl::OUString &rEntryName ) -{ - uno::Reference< container::XNameAccess > xResult; - try - { - if (!rxSetNameAccess->hasByName( rEntryName )) - { - uno::Reference< lang::XSingleServiceFactory > xFactory( rxSetNameAccess, uno::UNO_QUERY_THROW); - uno::Reference< uno::XInterface > xNewEntry( xFactory->createInstance() ); - uno::Reference< container::XNameContainer > xNC( rxSetNameAccess, uno::UNO_QUERY_THROW ); - xNC->insertByName( rEntryName, makeAny( xNewEntry ) ); - } - xResult.set( rxSetNameAccess->getByName( rEntryName ), uno::UNO_QUERY_THROW ); - } - catch (uno::Exception &) - { - } - return xResult; -} - -BOOL SvtLinguConfig::GetSupportedDictionaryFormatsFor( - const rtl::OUString &rSetName, - const rtl::OUString &rSetEntry, - uno::Sequence< rtl::OUString > &rFormatList ) const -{ - if (rSetName.getLength() == 0 || rSetEntry.getLength() == 0) - return sal_False; - bool bSuccess = false; - try - { - uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( rSetName ), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( rSetEntry ), uno::UNO_QUERY_THROW ); - if (xNA->getByName( aG_SupportedDictionaryFormats ) >>= rFormatList) - bSuccess = true; - DBG_ASSERT( rFormatList.getLength(), "supported dictionary format list is empty" ); - } - catch (uno::Exception &) - { - } - return bSuccess; -} - -void SvtLinguConfig::SetOrCreateSupportedDictionaryFormatsFor( - const rtl::OUString &rSetName, - const rtl::OUString &rSetEntry, - const uno::Sequence< rtl::OUString > &rFormatList ) const -{ - if (rSetName.getLength() == 0 || rSetEntry.getLength() == 0) - return; - try - { - DBG_ASSERT( rFormatList.getLength(), "applying empty format list. Really??" ); - - uno::Reference< util::XChangesBatch > xUpdateAccess( GetMainUpdateAccess() ); - uno::Reference< container::XNameAccess > xNA( xUpdateAccess, uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( rSetName ), uno::UNO_QUERY_THROW ); - xNA = GetOrCreateSetEntry_Impl( xNA, rSetEntry ); - - uno::Reference< container::XNameReplace > xNR( xNA, uno::UNO_QUERY_THROW ); - xNR->replaceByName( aG_SupportedDictionaryFormats, uno::makeAny( rFormatList ) ); - - xUpdateAccess->commitChanges(); - } - catch (uno::Exception &) - { - } -} - - -static uno::WeakReference< util::XMacroExpander > aG_xMacroExpander; - -static uno::Reference< util::XMacroExpander > lcl_GetMacroExpander() -{ - uno::Reference< util::XMacroExpander > xMacroExpander( aG_xMacroExpander ); - if ( !xMacroExpander.is() ) - { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); - - if ( !xMacroExpander.is() ) - { - uno::Reference< uno::XComponentContext > xContext; - uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY ); - xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext; - if ( xContext.is() ) - { - aG_xMacroExpander = uno::Reference< com::sun::star::util::XMacroExpander >( xContext->getValueByName( - OUString( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander"))), - uno::UNO_QUERY ); - xMacroExpander = aG_xMacroExpander; - } - } - } - - return xMacroExpander; -} - - -static bool lcl_GetFileUrlFromOrigin( - OUString /*out*/ &rFileUrl, - const OUString &rOrigin, - uno::Reference< util::XMacroExpander > &rxMacroExpander ) -{ - bool bSuccess = false; - if (rOrigin.getLength() > 0 && rxMacroExpander.is()) - { - rtl::OUString aURL( rOrigin ); - if (( aURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( EXPAND_PROTOCOL )) == 0 ) && - rxMacroExpander.is() ) - { - // cut protocol - OUString aMacro( aURL.copy( sizeof ( EXPAND_PROTOCOL ) -1 ) ); - // decode uric class chars - aMacro = Uri::decode( aMacro, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); - // expand macro string - aURL = rxMacroExpander->expandMacros( aMacro ); - - bool bIsFileUrl = aURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( FILE_PROTOCOL )) == 0; - if (bIsFileUrl) - { - rFileUrl = aURL; - bSuccess = true; - } - else - { - DBG_ASSERT( bIsFileUrl, "not a file URL"); - } - } - else - { - DBG_ASSERT( 0, "failed to get file URL" ); - } - } - return bSuccess; -} - - -BOOL SvtLinguConfig::GetDictionaryEntry( - const rtl::OUString &rNodeName, - SvtLinguConfigDictionaryEntry &rDicEntry ) const -{ - if (rNodeName.getLength() == 0) - return sal_False; - bool bSuccess = false; - try - { - uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( aG_Dictionaries ), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( rNodeName ), uno::UNO_QUERY_THROW ); - - // read group data... - uno::Sequence< rtl::OUString > aLocations; - rtl::OUString aFormatName; - uno::Sequence< rtl::OUString > aLocaleNames; - bSuccess = (xNA->getByName( aG_Locations ) >>= aLocations) && - (xNA->getByName( aG_Format ) >>= aFormatName) && - (xNA->getByName( aG_Locales ) >>= aLocaleNames); - DBG_ASSERT( aLocations.getLength(), "Dictionary locations not set" ); - DBG_ASSERT( aFormatName.getLength(), "Dictionary format name not set" ); - DBG_ASSERT( aLocaleNames.getLength(), "No locales set for the dictionary" ); - - // if sucessful continue - if (bSuccess) - { - // get file URL's for the locations - uno::Reference< util::XMacroExpander > xMacroExpander( lcl_GetMacroExpander() ); - for (sal_Int32 i = 0; i < aLocations.getLength(); ++i) - { - rtl::OUString &rLocation = aLocations[i]; - if (!lcl_GetFileUrlFromOrigin( rLocation, rLocation, xMacroExpander )) - bSuccess = false; - } - - // if everything was fine return the result - if (bSuccess) - { - rDicEntry.aLocations = aLocations; - rDicEntry.aFormatName = aFormatName; - rDicEntry.aLocaleNames = aLocaleNames; - } - } - } - catch (uno::Exception &) - { - } - return bSuccess; -} - -void SvtLinguConfig::SetOrCreateDictionaryEntry( - const rtl::OUString &rNodeName, - const SvtLinguConfigDictionaryEntry &rDicEntry ) const -{ - if (rNodeName.getLength() == 0) - return; - try - { - uno::Reference< util::XChangesBatch > xUpdateAccess( GetMainUpdateAccess() ); - uno::Reference< container::XNameAccess > xNA( xUpdateAccess, uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( aG_Dictionaries ), uno::UNO_QUERY_THROW ); - xNA = GetOrCreateSetEntry_Impl( xNA, rNodeName ); - - DBG_ASSERT( rDicEntry.aLocations.getLength(), "Applying empty dictionary locations. Really correct??" ); - DBG_ASSERT( rDicEntry.aFormatName.getLength(), "Applying empty dictionary format name. Really correct??" ); - DBG_ASSERT( rDicEntry.aLocaleNames.getLength(), "Applying empty list of locales for the dictionary. Really correct??" ); - - uno::Reference< container::XNameReplace > xNR( xNA, uno::UNO_QUERY_THROW ); - xNR->replaceByName( aG_Locations, uno::makeAny( rDicEntry.aLocations ) ); - xNR->replaceByName( aG_Format, uno::makeAny( rDicEntry.aFormatName ) ); - xNR->replaceByName( aG_Locales, uno::makeAny( rDicEntry.aLocaleNames ) ); - - xUpdateAccess->commitChanges(); - } - catch (uno::Exception &) - { - } -} - -uno::Sequence< rtl::OUString > SvtLinguConfig::GetDisabledDictionaries() const -{ - uno::Sequence< rtl::OUString > aResult; - try - { - uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW ); - xNA->getByName( aG_DisabledDictionaries ) >>= aResult; - } - catch (uno::Exception &) - { - } - return aResult; -} - -void SvtLinguConfig::SetDisabledDictionaries( - const uno::Sequence< rtl::OUString > &rDictionaries ) const -{ - try - { - uno::Reference< util::XChangesBatch > xUpdateAccess( GetMainUpdateAccess() ); - uno::Reference< container::XNameAccess > xNA( xUpdateAccess, uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW ); - if (xNA->hasByName( aG_DisabledDictionaries )) - { - uno::Reference< container::XNameReplace > xNR( xNA, uno::UNO_QUERY_THROW ); - xNR->replaceByName( aG_DisabledDictionaries, makeAny( rDictionaries ) ); - } - else - { - uno::Reference< container::XNameContainer > xNC( xNA, uno::UNO_QUERY_THROW ); - xNC->insertByName( aG_DisabledDictionaries, makeAny( rDictionaries ) ); - } - - xUpdateAccess->commitChanges(); - } - catch (uno::Exception &) - { - } -} - -std::vector< SvtLinguConfigDictionaryEntry > SvtLinguConfig::GetActiveDictionariesByFormat( - const rtl::OUString &rFormatName ) -{ - std::vector< SvtLinguConfigDictionaryEntry > aRes; - if (rFormatName.getLength() == 0) - return aRes; - - try - { - uno::Sequence< rtl::OUString > aElementNames; - GetElementNamesFor( aG_Dictionaries, aElementNames ); - sal_Int32 nLen = aElementNames.getLength(); - const rtl::OUString *pElementNames = aElementNames.getConstArray(); - - SvtLinguConfigDictionaryEntry aDicEntry; - for (sal_Int32 i = 0; i < nLen; ++i) - { - // does dictionary match the format we are looking for? - if (GetDictionaryEntry( pElementNames[i], aDicEntry ) && - aDicEntry.aFormatName == rFormatName) - { - // check if it is active or not - bool bDicIsActive = true; - const uno::Sequence< rtl::OUString > aDisabledDics( GetDisabledDictionaries() ); - for (sal_Int32 k = 0; bDicIsActive && k < aDisabledDics.getLength(); ++k) - { - if (aDisabledDics[k] == pElementNames[i]) - bDicIsActive = false; - } - - if (bDicIsActive) - { - DBG_ASSERT( aDicEntry.aFormatName.getLength(), - "FormatName not set" ); - DBG_ASSERT( aDicEntry.aLocations.getLength(), - "Locations not set" ); - DBG_ASSERT( aDicEntry.aLocaleNames.getLength(), - "Locales not set" ); - aRes.push_back( aDicEntry ); - } - } - } - } - catch (uno::Exception &) - { - } - - return aRes; -} - - -uno::Reference< util::XChangesBatch > SvtLinguConfig::GetMainUpdateAccess() const -{ - if (!m_xMainUpdateAccess.is()) - { - try - { - // get configuration provider - uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider; - uno::Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); - if (xMgr.is()) - { - xConfigurationProvider = uno::Reference< lang::XMultiServiceFactory > ( - xMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.ConfigurationProvider" ) ) ), - uno::UNO_QUERY_THROW ) ; - } - - // get configuration update access - beans::PropertyValue aValue; - aValue.Name = A2OU( "nodepath" ); - aValue.Value = uno::makeAny( A2OU("org.openoffice.Office.Linguistic") ); - uno::Sequence< uno::Any > aProps(1); - aProps[0] <<= aValue; - m_xMainUpdateAccess = uno::Reference< util::XChangesBatch >( - xConfigurationProvider->createInstanceWithArguments( - A2OU( "com.sun.star.configuration.ConfigurationUpdateAccess" ), aProps ), - uno::UNO_QUERY_THROW ); - } - catch (uno::Exception &) - { - } - } - - return m_xMainUpdateAccess; -} - - -rtl::OUString SvtLinguConfig::GetVendorImageUrl_Impl( - const rtl::OUString &rServiceImplName, - const rtl::OUString &rImageName ) const -{ - rtl::OUString aRes; - try - { - uno::Reference< container::XNameAccess > xImagesNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xImagesNA.set( xImagesNA->getByName( A2OU("Images") ), uno::UNO_QUERY_THROW ); - - uno::Reference< container::XNameAccess > xNA( xImagesNA->getByName( A2OU("ServiceNameEntries") ), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( rServiceImplName ), uno::UNO_QUERY_THROW ); - uno::Any aAny( xNA->getByName( A2OU("VendorImagesNode") ) ); - rtl::OUString aVendorImagesNode; - if (aAny >>= aVendorImagesNode) - { - xNA = xImagesNA; - xNA.set( xNA->getByName( A2OU("VendorImages") ), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( aVendorImagesNode ), uno::UNO_QUERY_THROW ); - aAny = xNA->getByName( rImageName ); - rtl::OUString aTmp; - if (aAny >>= aTmp) - { - uno::Reference< util::XMacroExpander > xMacroExpander( lcl_GetMacroExpander() ); - if (lcl_GetFileUrlFromOrigin( aTmp, aTmp, xMacroExpander )) - aRes = aTmp; - } - } - } - catch (uno::Exception &) - { - DBG_ASSERT( 0, "exception caught. GetVendorImageUrl_Impl failed" ); - } - return aRes; -} - - -rtl::OUString SvtLinguConfig::GetSpellAndGrammarDialogImage( - const rtl::OUString &rServiceImplName, - bool bHighContrast ) const -{ - rtl::OUString aRes; - if (rServiceImplName.getLength() > 0) - { - rtl::OUString aImageName( A2OU( bHighContrast ? "SpellAndGrammarDialogImage_HC" : "SpellAndGrammarDialogImage" )); - rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) ); - aRes = aPath; - } - return aRes; -} - - -rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextSuggestionImage( - const rtl::OUString &rServiceImplName, - bool bHighContrast ) const -{ - rtl::OUString aRes; - if (rServiceImplName.getLength() > 0) - { - rtl::OUString aImageName( A2OU( bHighContrast ? "SpellAndGrammarContextMenuSuggestionImage_HC" : "SpellAndGrammarContextMenuSuggestionImage" )); - rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) ); - aRes = aPath; - } - return aRes; -} - - -rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextDictionaryImage( - const rtl::OUString &rServiceImplName, - bool bHighContrast ) const -{ - rtl::OUString aRes; - if (rServiceImplName.getLength() > 0) - { - rtl::OUString aImageName( A2OU( bHighContrast ? "SpellAndGrammarContextMenuDictionaryImage_HC" : "SpellAndGrammarContextMenuDictionaryImage" )); - rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) ); - aRes = aPath; - } - return aRes; -} - - -bool SvtLinguConfig::HasAnyVendorImages() const -{ - bool bRes = false; - try - { - uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("Images") ), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("VendorImages") ), uno::UNO_QUERY_THROW ); - - uno::Sequence< rtl::OUString > aElementNames( xNA->getElementNames() ); - bRes = aElementNames.getLength() > 0; - } - catch (uno::Exception &) - { - DBG_ASSERT( 0, "exception caught. HasAnyVendorImages failed" ); - } - return bRes; -} - - -bool SvtLinguConfig::HasGrammarChecker() const -{ - bool bRes = false; - - try - { - uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("GrammarCheckerList") ), uno::UNO_QUERY_THROW ); - - uno::Sequence< rtl::OUString > aElementNames( xNA->getElementNames() ); - bRes = aElementNames.getLength() > 0; - } - catch (uno::Exception &) - { - } - - return bRes; -} - -////////////////////////////////////////////////////////////////////// - diff --git a/svtools/source/config/localisationoptions.cxx b/svtools/source/config/localisationoptions.cxx deleted file mode 100644 index aab7ab17b1ea..000000000000 --- a/svtools/source/config/localisationoptions.cxx +++ /dev/null @@ -1,459 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: localisationoptions.cxx,v $ - * $Revision: 1.12 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include -#include -#include -#include -#include -#include - -#include -#include "itemholder1.hxx" - -//_________________________________________________________________________________________________________________ -// namespaces -//_________________________________________________________________________________________________________________ - -using namespace ::utl ; -using namespace ::rtl ; -using namespace ::osl ; -using namespace ::com::sun::star::uno ; - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -#define ROOTNODE_LOCALISATION OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/View/Localisation")) -#define DEFAULT_AUTOMNEMONIC sal_False -#define DEFAULT_DIALOGSCALE 0 - -#define PROPERTYNAME_AUTOMNEMONIC OUString(RTL_CONSTASCII_USTRINGPARAM("AutoMnemonic" )) -#define PROPERTYNAME_DIALOGSCALE OUString(RTL_CONSTASCII_USTRINGPARAM("DialogScale" )) - -#define PROPERTYHANDLE_AUTOMNEMONIC 0 -#define PROPERTYHANDLE_DIALOGSCALE 1 - -#define PROPERTYCOUNT 2 - -//_________________________________________________________________________________________________________________ -// private declarations! -//_________________________________________________________________________________________________________________ - -class SvtLocalisationOptions_Impl : public ConfigItem -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - SvtLocalisationOptions_Impl(); - ~SvtLocalisationOptions_Impl(); - - //--------------------------------------------------------------------------------------------------------- - // overloaded methods of baseclass - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short called for notify of configmanager - @descr These method is called from the ConfigManager before application ends or from the - PropertyChangeListener if the sub tree broadcasts changes. You must update your - internal values. - - @seealso baseclass ConfigItem - - @param "seqPropertyNames" is the list of properties which should be updated. - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Notify( const Sequence< OUString >& seqPropertyNames ); - - /*-****************************************************************************************************//** - @short write changes to configuration - @descr These method writes the changed values into the sub tree - and should always called in our destructor to guarantee consistency of config data. - - @seealso baseclass ConfigItem - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Commit(); - - //--------------------------------------------------------------------------------------------------------- - // public interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short access method to get internal values - @descr These method give us a chance to regulate acces to ouer internal values. - It's not used in the moment - but it's possible for the feature! - - @seealso - - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - sal_Bool IsAutoMnemonic ( ) const ; - void SetAutoMnemonic ( sal_Bool bState ) ; - sal_Int32 GetDialogScale ( ) const ; - void SetDialogScale ( sal_Int32 nScale ) ; - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return list of key names of ouer configuration management which represent oue module tree - @descr These methods return a static const list of key names. We need it to get needed values from our - configuration management. - - @seealso - - - @param - - @return A list of needed configuration keys is returned. - - @onerror - - *//*-*****************************************************************************************************/ - - static Sequence< OUString > GetPropertyNames(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - sal_Bool m_bAutoMnemonic ; - sal_Int32 m_nDialogScale ; -}; - -//_________________________________________________________________________________________________________________ -// definitions -//_________________________________________________________________________________________________________________ - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtLocalisationOptions_Impl::SvtLocalisationOptions_Impl() - // Init baseclasses first - : ConfigItem ( ROOTNODE_LOCALISATION ) - // Init member then. - , m_bAutoMnemonic ( DEFAULT_AUTOMNEMONIC ) - , m_nDialogScale ( DEFAULT_DIALOGSCALE ) -{ - // Use our static list of configuration keys to get his values. - Sequence< OUString > seqNames = GetPropertyNames ( ); - Sequence< Any > seqValues = GetProperties ( seqNames ); - - // Safe impossible cases. - // We need values from ALL configuration keys. - // Follow assignment use order of values in relation to our list of key names! - DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtLocalisationOptions_Impl::SvtLocalisationOptions_Impl()\nI miss some values of configuration keys!\n" ); - - // Copy values from list in right order to ouer internal member. - sal_Int32 nPropertyCount = seqValues.getLength(); - for( sal_Int32 nProperty=0; nProperty>= m_bAutoMnemonic; - } - break; - - case PROPERTYHANDLE_DIALOGSCALE : { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtLocalisationOptions_Impl::SvtLocalisationOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Localisation\\DialogScale\"?" ); - seqValues[nProperty] >>= m_nDialogScale; - } - break; - } - } - - // Enable notification mechanism of ouer baseclass. - // We need it to get information about changes outside these class on ouer used configuration keys! - EnableNotification( seqNames ); -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtLocalisationOptions_Impl::~SvtLocalisationOptions_Impl() -{ - // We must save our current values .. if user forget it! - if( IsModified() == sal_True ) - { - Commit(); - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtLocalisationOptions_Impl::Notify( const Sequence< OUString >& seqPropertyNames ) -{ - // Use given list of updated properties to get his values from configuration directly! - Sequence< Any > seqValues = GetProperties( seqPropertyNames ); - // Safe impossible cases. - // We need values from ALL notified configuration keys. - DBG_ASSERT( !(seqPropertyNames.getLength()!=seqValues.getLength()), "SvtLocalisationOptions_Impl::Notify()\nI miss some values of configuration keys!\n" ); - // Step over list of property names and get right value from coreesponding value list to set it on internal members! - sal_Int32 nCount = seqPropertyNames.getLength(); - for( sal_Int32 nProperty=0; nProperty>= m_bAutoMnemonic; - } - else - if( seqPropertyNames[nProperty] == PROPERTYNAME_DIALOGSCALE ) - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtLocalisationOptions_Impl::SvtLocalisationOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Localisation\\DialogScale\"?" ); - seqValues[nProperty] >>= m_nDialogScale; - } - #if OSL_DEBUG_LEVEL > 1 - else DBG_ASSERT( sal_False, "SvtLocalisationOptions_Impl::Notify()\nUnkown property detected ... I can't handle these!\n" ); - #endif - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtLocalisationOptions_Impl::Commit() -{ - // Get names of supported properties, create a list for values and copy current values to it. - Sequence< OUString > seqNames = GetPropertyNames (); - sal_Int32 nCount = seqNames.getLength(); - Sequence< Any > seqValues ( nCount ); - for( sal_Int32 nProperty=0; nProperty SvtLocalisationOptions_Impl::GetPropertyNames() -{ - // Build static list of configuration key names. - static const OUString pProperties[] = - { - PROPERTYNAME_AUTOMNEMONIC , - PROPERTYNAME_DIALOGSCALE , - }; - // Initialize return sequence with these list ... - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); - // ... and return it. - return seqPropertyNames; -} - -//***************************************************************************************************************** -// initialize static member -// DON'T DO IT IN YOUR HEADER! -// see definition for further informations -//***************************************************************************************************************** -SvtLocalisationOptions_Impl* SvtLocalisationOptions::m_pDataContainer = NULL ; -sal_Int32 SvtLocalisationOptions::m_nRefCount = 0 ; - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtLocalisationOptions::SvtLocalisationOptions() -{ - // Global access, must be guarded (multithreading!). - MutexGuard aGuard( GetOwnStaticMutex() ); - // Increase ouer refcount ... - ++m_nRefCount; - // ... and initialize ouer data container only if it not already exist! - if( m_pDataContainer == NULL ) - { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtLocalisationOptions_Impl::ctor()"); - m_pDataContainer = new SvtLocalisationOptions_Impl; - - ItemHolder1::holdConfigItem(E_LOCALISATIONOPTIONS); - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtLocalisationOptions::~SvtLocalisationOptions() -{ - // Global access, must be guarded (multithreading!) - MutexGuard aGuard( GetOwnStaticMutex() ); - // Decrease ouer refcount. - --m_nRefCount; - // If last instance was deleted ... - // we must destroy ouer static data container! - if( m_nRefCount <= 0 ) - { - delete m_pDataContainer; - m_pDataContainer = NULL; - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtLocalisationOptions::IsAutoMnemonic() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsAutoMnemonic(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtLocalisationOptions::SetAutoMnemonic( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetAutoMnemonic( bState ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Int32 SvtLocalisationOptions::GetDialogScale() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetDialogScale(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtLocalisationOptions::SetDialogScale( sal_Int32 nScale ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetDialogScale( nScale ); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Mutex& SvtLocalisationOptions::GetOwnStaticMutex() -{ - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; -} diff --git a/svtools/source/config/loghelper.hxx b/svtools/source/config/loghelper.hxx deleted file mode 100644 index 22efd5cff46d..000000000000 --- a/svtools/source/config/loghelper.hxx +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: loghelper.hxx,v $ - * - * $Revision: 1.1.4.2 $ - * - * last change: $Author: as $ $Date: 2008/03/19 11:20:29 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#ifndef _SVT_LOGHELPER_HXX -#define _SVT_LOGHELPER_HXX - -namespace css = ::com::sun::star; - -class LogHelper -{ -public: - LogHelper(); - ~LogHelper(); - - static void logIt(const css::uno::Exception&){} -}; - -inline void logIt(const css::uno::Exception& ex) -{ - ::rtl::OUStringBuffer sMsg(256); - sMsg.appendAscii("Unexpected exception catched. Original message was:\n\"" ); - sMsg.append(ex.Message); - sMsg.appendAscii("\""); - OSL_ENSURE(sal_False, ::rtl::OUStringToOString(sMsg.makeStringAndClear(), RTL_TEXTENCODING_UTF8).getStr()); -} - -#endif - diff --git a/svtools/source/config/makefile.mk b/svtools/source/config/makefile.mk index 9c0985329eb3..d3f2615776da 100644 --- a/svtools/source/config/makefile.mk +++ b/svtools/source/config/makefile.mk @@ -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 @@ -32,8 +32,6 @@ PRJ=..$/.. PRJNAME=svtools TARGET=config -TARGET1=heavyconfig -LIBTARGET=NO ENABLE_EXCEPTIONS := TRUE @@ -44,68 +42,23 @@ ENABLE_EXCEPTIONS := TRUE # --- Files -------------------------------------------------------- -SLOFILES = $(LIB1OBJFILES) $(LIB2OBJFILES) - -# --- config.lib Files -------------------------------------------------------- -LIB1TARGET= $(SLB)$/$(TARGET).lib - -LIB1OBJFILES= \ - $(SLO)$/accelcfg.obj \ - $(SLO)$/fltrcfg.obj \ - $(SLO)$/xmlaccelcfg.obj \ - $(SLO)$/moduleoptions.obj \ - $(SLO)$/pathoptions.obj \ - $(SLO)$/saveopt.obj \ - $(SLO)$/lingucfg.obj \ - $(SLO)$/javaoptions.obj \ - $(SLO)$/securityoptions.obj \ - $(SLO)$/localisationoptions.obj \ - $(SLO)$/workingsetoptions.obj \ - $(SLO)$/viewoptions.obj \ - $(SLO)$/internaloptions.obj \ - $(SLO)$/startoptions.obj \ - $(SLO)$/historyoptions.obj \ - $(SLO)$/inetoptions.obj \ - $(SLO)$/menuoptions.obj \ - $(SLO)$/dynamicmenuoptions.obj \ - $(SLO)$/optionsdrawinglayer.obj \ - $(SLO)$/fontoptions.obj \ - $(SLO)$/addxmltostorageoptions.obj \ - $(SLO)$/defaultoptions.obj \ - $(SLO)$/searchopt.obj \ - $(SLO)$/printwarningoptions.obj \ - $(SLO)$/cacheoptions.obj \ - $(SLO)$/regoptions.obj \ - $(SLO)$/cmdoptions.obj \ - $(SLO)$/extendedsecurityoptions.obj \ - $(SLO)$/sourceviewconfig.obj \ - $(SLO)$/compatibility.obj \ - $(SLO)$/eventcfg.obj \ - $(SLO)$/optionsdlg.obj \ - $(SLO)$/itemholder1.obj \ - $(SLO)$/options.obj - -# $(SLO)$/miscopt.obj \ -# --- heavyconfig.lib Files -------------------------------------------------------- -LIB2TARGET= $(SLB)$/$(TARGET1).lib - -LIB2OBJFILES= \ +SLOFILES= \ $(SLO)$/accessibilityoptions.obj \ + $(SLO)$/apearcfg.obj \ + $(SLO)$/cjkoptions.obj \ + $(SLO)$/colorcfg.obj \ + $(SLO)$/ctloptions.obj \ + $(SLO)$/extcolorcfg.obj \ $(SLO)$/fontsubstconfig.obj \ + $(SLO)$/helpopt.obj \ + $(SLO)$/itemholder2.obj \ + $(SLO)$/languageoptions.obj \ + $(SLO)$/menuoptions.obj \ $(SLO)$/misccfg.obj \ - $(SLO)$/apearcfg.obj \ - $(SLO)$/helpopt.obj \ + $(SLO)$/miscopt.obj \ + $(SLO)$/optionsdrawinglayer.obj \ $(SLO)$/printoptions.obj \ - $(SLO)$/languageoptions.obj \ - $(SLO)$/ctloptions.obj \ - $(SLO)$/cjkoptions.obj \ - $(SLO)$/colorcfg.obj \ - $(SLO)$/extcolorcfg.obj \ - $(SLO)$/undoopt.obj \ - $(SLO)$/useroptions.obj \ - $(SLO)$/syslocaleoptions.obj \ - $(SLO)$/itemholder2.obj \ - $(SLO)$/miscopt.obj + $(SLO)$/syslocaleoptions.obj # --- Targets ------------------------------------------------------ diff --git a/svtools/source/config/menuoptions.cxx b/svtools/source/config/menuoptions.cxx index 2d0e8d905ad9..e9b1b71a1cc6 100644 --- a/svtools/source/config/menuoptions.cxx +++ b/svtools/source/config/menuoptions.cxx @@ -46,7 +46,7 @@ #include #include -#include "itemholder1.hxx" +#include "itemholder2.hxx" //_________________________________________________________________________________________________________________ // namespaces @@ -452,7 +452,7 @@ SvtMenuOptions::SvtMenuOptions() RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtMenuOptions_Impl::ctor()"); m_pDataContainer = new SvtMenuOptions_Impl(); - ItemHolder1::holdConfigItem(E_MENUOPTIONS); + ItemHolder2::holdConfigItem(E_MENUOPTIONS); } } diff --git a/svtools/source/config/moduleoptions.cxx b/svtools/source/config/moduleoptions.cxx deleted file mode 100644 index fda0967d65ed..000000000000 --- a/svtools/source/config/moduleoptions.cxx +++ /dev/null @@ -1,1600 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: moduleoptions.cxx,v $ - * $Revision: 1.36 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "itemholder1.hxx" - -//_________________________________________________________________________________________________________________ -// namespaces -//_________________________________________________________________________________________________________________ - -#ifndef css -namespace css = ::com::sun::star; -#endif - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @descr These values are used to define neccessary keys from our configuration management to support - all functionality of these implementation. - It's a fast way to make changes if some keys change his name or location! - - Property handle are neccessary to specify right position in return list of configuration - for asked values. We ask it with a list of properties to get his values. The returned list - has the same order like our given name list! - e.g.: - NAMELIST[ PROPERTYHANDLE_xxx ] => VALUELIST[ PROPERTYHANDLE_xxx ] -*//*-*************************************************************************************************************/ -#define ROOTNODE_FACTORIES ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Setup/Office/Factories" )) -#define PATHSEPERATOR ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/" )) - -// Attention: The property "ooSetupFactoryEmptyDocumentURL" is read from configuration but not used! There is -// special code that uses hard coded strings to return them. -#define PROPERTYNAME_SHORTNAME ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryShortName" )) -#define PROPERTYNAME_TEMPLATEFILE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryTemplateFile" )) -#define PROPERTYNAME_WINDOWATTRIBUTES ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryWindowAttributes")) -#define PROPERTYNAME_EMPTYDOCUMENTURL ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryEmptyDocumentURL")) -#define PROPERTYNAME_DEFAULTFILTER ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryDefaultFilter" )) -#define PROPERTYNAME_ICON ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryIcon" )) - -#define PROPERTYHANDLE_SHORTNAME 0 -#define PROPERTYHANDLE_TEMPLATEFILE 1 -#define PROPERTYHANDLE_WINDOWATTRIBUTES 2 -#define PROPERTYHANDLE_EMPTYDOCUMENTURL 3 -#define PROPERTYHANDLE_DEFAULTFILTER 4 -#define PROPERTYHANDLE_ICON 5 - -#define PROPERTYCOUNT 6 - -#define FACTORYNAME_WRITER ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" )) -#define FACTORYNAME_WRITERWEB ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.WebDocument" )) -#define FACTORYNAME_WRITERGLOBAL ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.GlobalDocument" )) -#define FACTORYNAME_CALC ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument" )) -#define FACTORYNAME_DRAW ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocument" )) -#define FACTORYNAME_IMPRESS ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument")) -#define FACTORYNAME_MATH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.formula.FormulaProperties" )) -#define FACTORYNAME_CHART ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.ChartDocument" )) -#define FACTORYNAME_DATABASE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.OfficeDatabaseDocument" )) -#define FACTORYNAME_STARTMODULE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StartModule" )) - -#define FACTORYCOUNT 10 - -/*-************************************************************************************************************//** - @descr This struct hold information about one factory. We declare a complete array which can hold infos - for all well known factories. Values of enum "EFactory" (see header!) are directly used as index! - So we can support a fast access on these informations. -*//*-*************************************************************************************************************/ -struct FactoryInfo -{ - public: - //--------------------------------------------------------------------------------------------------------- - // initialize empty struct - FactoryInfo() - { - free(); - // @@@ should be supplied from outside! - xSMgr = ::utl::getProcessServiceFactory(); - } - - //--------------------------------------------------------------------------------------------------------- - // easy way to reset struct member! - void free() - { - bInstalled = sal_False ; - sFactory = ::rtl::OUString() ; - sShortName = ::rtl::OUString() ; - sTemplateFile = ::rtl::OUString() ; - sWindowAttributes = ::rtl::OUString() ; - sEmptyDocumentURL = ::rtl::OUString() ; - sDefaultFilter = ::rtl::OUString() ; - nIcon = 0 ; - bChangedTemplateFile = sal_False ; - bChangedWindowAttributes = sal_False ; - bChangedEmptyDocumentURL = sal_False ; - bChangedDefaultFilter = sal_False ; - bChangedIcon = sal_False ; - bDefaultFilterReadonly = sal_False ; - } - - //--------------------------------------------------------------------------------------------------------- - // returns list of properties, which has changed only! - // We use given value of sNodeBase to build full qualified pathes ... - // Last sign of it must be "/". Beacuse we use it directly, without any additional things! - css::uno::Sequence< css::beans::PropertyValue > getChangedProperties( const ::rtl::OUString& sNodeBase ) - { - // a) reserve memory for max. count of changed properties - // b) add names and values of changed ones only and count it - // c) resize return list by using count - css::uno::Sequence< css::beans::PropertyValue > lProperties ( 4 ); - sal_Int8 nRealyChanged = 0 ; - - if( bChangedTemplateFile == sal_True ) - { - lProperties[nRealyChanged].Name = sNodeBase + PROPERTYNAME_TEMPLATEFILE; - - if ( sTemplateFile.getLength() > 0 ) - { - lProperties[nRealyChanged].Value - <<= getStringSubstitution() - ->reSubstituteVariables( sTemplateFile ); - } - else - { - lProperties[nRealyChanged].Value <<= sTemplateFile; - } - - ++nRealyChanged; - } - if( bChangedWindowAttributes == sal_True ) - { - lProperties[nRealyChanged].Name = sNodeBase + PROPERTYNAME_WINDOWATTRIBUTES; - lProperties[nRealyChanged].Value <<= sWindowAttributes; - ++nRealyChanged; - } - if( bChangedEmptyDocumentURL == sal_True ) - { - lProperties[nRealyChanged].Name = sNodeBase + PROPERTYNAME_EMPTYDOCUMENTURL; - lProperties[nRealyChanged].Value <<= sEmptyDocumentURL; - ++nRealyChanged; - } - if( bChangedDefaultFilter == sal_True ) - { - lProperties[nRealyChanged].Name = sNodeBase + PROPERTYNAME_DEFAULTFILTER; - lProperties[nRealyChanged].Value <<= sDefaultFilter; - ++nRealyChanged; - } - if( bChangedIcon == sal_True ) - { - lProperties[nRealyChanged].Name = sNodeBase + PROPERTYNAME_ICON; - lProperties[nRealyChanged].Value <<= nIcon; - ++nRealyChanged; - } - - // Don't forget to reset changed flags! Otherwise we save it again and again and ... - bChangedTemplateFile = sal_False ; - bChangedWindowAttributes = sal_False ; - bChangedEmptyDocumentURL = sal_False ; - bChangedDefaultFilter = sal_False ; - bChangedIcon = sal_False ; - - lProperties.realloc( nRealyChanged ); - return lProperties; - } - - //--------------------------------------------------------------------------------------------------------- - // We must support setting AND marking of changed values. - // That's why we can't make our member public. We must use get/set/init methods - // to control access on it! - sal_Bool getInstalled () const { return bInstalled; }; - ::rtl::OUString getFactory () const { return sFactory; }; - ::rtl::OUString getShortName () const { return sShortName; }; - ::rtl::OUString getTemplateFile () const { return sTemplateFile; }; - ::rtl::OUString getWindowAttributes () const { return sWindowAttributes; }; - ::rtl::OUString getEmptyDocumentURL () const { return sEmptyDocumentURL; }; - ::rtl::OUString getDefaultFilter () const { return sDefaultFilter; }; - sal_Bool isDefaultFilterReadonly() const { return bDefaultFilterReadonly; } - sal_Int32 getIcon () const { return nIcon; }; - - //--------------------------------------------------------------------------------------------------------- - // If you call set-methods - we check for changes of valkues and mark it. - // But if you whish to set it without that ... you must initialize it! - void initInstalled ( sal_Bool bNewInstalled ) { bInstalled = bNewInstalled ; } - void initFactory ( const ::rtl::OUString& sNewFactory ) { sFactory = sNewFactory ; } - void initShortName ( const ::rtl::OUString& sNewShortName ) { sShortName = sNewShortName ; } - void initWindowAttributes ( const ::rtl::OUString& sNewWindowAttributes ) { sWindowAttributes = sNewWindowAttributes ; } - void initEmptyDocumentURL ( const ::rtl::OUString& sNewEmptyDocumentURL ) { sEmptyDocumentURL = sNewEmptyDocumentURL ; } - void initDefaultFilter ( const ::rtl::OUString& sNewDefaultFilter ) { sDefaultFilter = sNewDefaultFilter ; } - void setDefaultFilterReadonly( const sal_Bool bVal){bDefaultFilterReadonly = bVal;} - void initIcon ( sal_Int32 nNewIcon ) { nIcon = nNewIcon ; } - - //--------------------------------------------------------------------------------------------------------- - void initTemplateFile( const ::rtl::OUString& sNewTemplateFile ) - { - if ( sNewTemplateFile.getLength() > 0 ) - { - sTemplateFile - = getStringSubstitution() - ->substituteVariables( sNewTemplateFile, sal_False ); - } - else - { - sTemplateFile = sNewTemplateFile; - } - } - - //--------------------------------------------------------------------------------------------------------- - void setInstalled( sal_Bool bNewInstalled ) - { - bInstalled = bNewInstalled; - }; - - //--------------------------------------------------------------------------------------------------------- - void setFactory( const ::rtl::OUString& sNewFactory ) - { - sFactory = sNewFactory; - }; - - //--------------------------------------------------------------------------------------------------------- - void setShortName( const ::rtl::OUString& sNewShortName ) - { - sShortName = sNewShortName; - }; - - //--------------------------------------------------------------------------------------------------------- - void setTemplateFile( const ::rtl::OUString& sNewTemplateFile ) - { - if( sTemplateFile != sNewTemplateFile ) - { - sTemplateFile = sNewTemplateFile; - bChangedTemplateFile = sal_True ; - } - }; - - //--------------------------------------------------------------------------------------------------------- - void setWindowAttributes( const ::rtl::OUString& sNewWindowAttributes ) - { - if( sWindowAttributes != sNewWindowAttributes ) - { - sWindowAttributes = sNewWindowAttributes; - bChangedWindowAttributes = sal_True ; - } - }; - - //--------------------------------------------------------------------------------------------------------- - void setEmptyDocumentURL( const ::rtl::OUString& sNewEmptyDocumentURL ) - { - if( sEmptyDocumentURL != sNewEmptyDocumentURL ) - { - sEmptyDocumentURL = sNewEmptyDocumentURL; - bChangedEmptyDocumentURL = sal_True ; - } - }; - - //--------------------------------------------------------------------------------------------------------- - void setDefaultFilter( const ::rtl::OUString& sNewDefaultFilter ) - { - if( sDefaultFilter != sNewDefaultFilter ) - { - sDefaultFilter = sNewDefaultFilter; - bChangedDefaultFilter = sal_True ; - } - }; - - //--------------------------------------------------------------------------------------------------------- - void setIcon( sal_Int32 nNewIcon ) - { - if( nNewIcon != nNewIcon ) - { - nNewIcon = nNewIcon; - bChangedIcon = sal_True; - } - }; - - private: - css::uno::Reference< css::util::XStringSubstitution > getStringSubstitution() - { - if ( !xSubstVars.is() ) - { - xSubstVars - = css::uno::Reference< css::util::XStringSubstitution >( - xSMgr->createInstance( - ::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.util.PathSubstitution" ) ) ), - css::uno::UNO_QUERY ); - if ( !xSubstVars.is() ) - throw css::uno::RuntimeException( - ::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "Cannot instanciate service " - "com.sun.star.util.PathSubstitution" ) ), - css::uno::Reference< css::uno::XInterface >() ); - } - return xSubstVars; - } - - sal_Bool bInstalled ; - ::rtl::OUString sFactory ; - ::rtl::OUString sShortName ; - ::rtl::OUString sTemplateFile ; - ::rtl::OUString sWindowAttributes ; - ::rtl::OUString sEmptyDocumentURL ; - ::rtl::OUString sDefaultFilter ; - sal_Int32 nIcon ; - - sal_Bool bChangedTemplateFile :1 ; - sal_Bool bChangedWindowAttributes :1 ; - sal_Bool bChangedEmptyDocumentURL :1 ; - sal_Bool bChangedDefaultFilter :1 ; - sal_Bool bChangedIcon :1 ; - sal_Bool bDefaultFilterReadonly :1 ; - - css::uno::Reference< css::lang::XMultiServiceFactory > xSMgr; - css::uno::Reference< css::util::XStringSubstitution > xSubstVars; -}; - -typedef FactoryInfo FactoryInfoList[FACTORYCOUNT]; - -/*-************************************************************************************************************//** - @short IMPL data container for wrapper class SvtModulOptions! - @descr These class is used as a static data container of class SvtModuleOptions. The hold it by using - a refcount and make it threadsafe by using an osl mutex. So we don't must do anything for that. - We can implement pure functionality to read/write configuration data only. - - @implements - - @base ConfigItem - - @devstatus ready to use - @threadsafe no -*//*-*************************************************************************************************************/ -class SvtModuleOptions_Impl : public ::utl::ConfigItem -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - public: - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - SvtModuleOptions_Impl(SvtModuleOptions* pOutsideClass); - ~SvtModuleOptions_Impl(); - - //--------------------------------------------------------------------------------------------------------- - // overloaded methods of baseclass - //--------------------------------------------------------------------------------------------------------- - virtual void Notify( const css::uno::Sequence< ::rtl::OUString >& lPropertyNames ); - virtual void Commit( ); - - //--------------------------------------------------------------------------------------------------------- - // public interface - //--------------------------------------------------------------------------------------------------------- - sal_Bool IsModuleInstalled ( SvtModuleOptions::EModule eModule ) const; - ::com::sun::star::uno::Sequence < ::rtl::OUString > GetAllServiceNames(); - ::rtl::OUString GetFactoryName ( SvtModuleOptions::EFactory eFactory ) const; - ::rtl::OUString GetFactoryShortName ( SvtModuleOptions::EFactory eFactory ) const; - ::rtl::OUString GetFactoryStandardTemplate( SvtModuleOptions::EFactory eFactory ) const; - ::rtl::OUString GetFactoryWindowAttributes( SvtModuleOptions::EFactory eFactory ) const; - ::rtl::OUString GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory eFactory ) const; - ::rtl::OUString GetFactoryDefaultFilter ( SvtModuleOptions::EFactory eFactory ) const; - sal_Bool IsDefaultFilterReadonly( SvtModuleOptions::EFactory eFactory ) const; - sal_Int32 GetFactoryIcon ( SvtModuleOptions::EFactory eFactory ) const; - static sal_Bool ClassifyFactoryByName ( const ::rtl::OUString& sName , - SvtModuleOptions::EFactory& eFactory ); - void SetFactoryStandardTemplate( SvtModuleOptions::EFactory eFactory , - const ::rtl::OUString& sTemplate ); - void SetFactoryWindowAttributes( SvtModuleOptions::EFactory eFactory , - const ::rtl::OUString& sAttributes); - void SetFactoryDefaultFilter ( SvtModuleOptions::EFactory eFactory , - const ::rtl::OUString& sFilter ); - void MakeReadonlyStatesAvailable(); - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - private: - static css::uno::Sequence< ::rtl::OUString > impl_ExpandSetNames ( const css::uno::Sequence< ::rtl::OUString >& lSetNames ); - void impl_Read ( const css::uno::Sequence< ::rtl::OUString >& lSetNames ); - - //------------------------------------------------------------------------------------------------------------- - // private types - //------------------------------------------------------------------------------------------------------------- - private: - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - private: - FactoryInfoList m_lFactories; - sal_Bool m_bReadOnlyStatesWellKnown; - SvtModuleOptions* m_pOutsideClass; -}; - -//_________________________________________________________________________________________________________________ -// definitions -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short default ctor - @descr We open our configuration here and read all neccessary values from it. - These values are cached till everyone call Commit(). Then we write changed ones back to cfg. - - @seealso baseclass ConfigItem - @seealso method impl_Read() - - @param - - @return - - - @onerror - - @threadsafe no -*//*-*************************************************************************************************************/ -SvtModuleOptions_Impl::SvtModuleOptions_Impl(SvtModuleOptions* pOutsideClass) - : ::utl::ConfigItem( ROOTNODE_FACTORIES ) - , m_bReadOnlyStatesWellKnown( sal_False ) - , m_pOutsideClass( pOutsideClass ) -{ - // First initialize list of factory infos! Otherwise we couldnt gurantee right working of these class. - for( sal_Int32 nFactory=0; nFactory lFactories = GetNodeNames( ::rtl::OUString() ); - impl_Read( lFactories ); - - // Enable notification for changes by using configuration directly. - // So we can update our internal values immediatly. - EnableNotification( lFactories ); -} - -/*-************************************************************************************************************//** - @short default dtor - @descr If any values of our cache was modified we should write it back to configuration. - - @attention Don't forget to call "SetModified()" method of base class ConfigItem if any interface method - of this class modify internal member list m_lFactories! Otherwise Commit() will never be called!!! - - @seealso baseclass ConfigItem - - @param - - @return - - - @onerror - - @threadsafe no -*//*-*************************************************************************************************************/ -SvtModuleOptions_Impl::~SvtModuleOptions_Impl() -{ - if( IsModified() == sal_True ) - { - Commit(); - } -} - -/*-************************************************************************************************************//** - @short called for notify of configmanager - @descr These method is called from the ConfigManager before application ends or from the - PropertyChangeListener if the sub tree broadcasts changes. You must update our - internal values. - - @attention We are registered for pure set node names only. So we can use our internal method "impl_Read()" to - update our info list. Because - these method expand given name list to full qualified property list - and use it to read the values. These values are filled into our internal member list m_lFactories - at right position. - - @seealso method impl_Read() - - @param "lNames" is the list of set node entries which should be updated. - @return - - - @onerror - - @threadsafe no -*//*-*************************************************************************************************************/ -void SvtModuleOptions_Impl::Notify( const css::uno::Sequence< ::rtl::OUString >& ) -{ - OSL_ENSURE( sal_False, "SvtModuleOptions_Impl::Notify()\nNot implemented yet!\n" ); -} - -/*-****************************************************************************************************//** - @short write changes to configuration - @descr These method writes the changed values into the sub tree - and should always called in our destructor to guarantee consistency of config data. - - @attention We clear complete set in configuration first and write it completly new! So we don't must - distinguish between existing, added or removed elements. Our internal cached values - are the only and right ones. - - @seealso baseclass ConfigItem - - @param - - @return - - - @onerror - - @threadsafe no -*//*-*****************************************************************************************************/ -void SvtModuleOptions_Impl::Commit() -{ - // Reserve memory for ALL possible factory properties! - // Step over all factories and get her realy changed values only. - // Build list of these ones and use it for commit. - css::uno::Sequence< css::beans::PropertyValue > lCommitProperties( FACTORYCOUNT*PROPERTYCOUNT ); - FactoryInfo* pInfo = NULL ; - sal_Int32 nRealCount = 0 ; - ::rtl::OUString sBasePath ; - for( sal_Int32 nFactory=0; nFactorygetChangedProperties() for further informations - sBasePath = PATHSEPERATOR + pInfo->getFactory() + PATHSEPERATOR; - - const css::uno::Sequence< css::beans::PropertyValue > lChangedProperties = pInfo->getChangedProperties ( sBasePath ); - const css::beans::PropertyValue* pChangedProperties = lChangedProperties.getConstArray(); - sal_Int32 nPropertyCount = lChangedProperties.getLength(); - for( sal_Int32 nProperty=0; nProperty 0 ) - { - lCommitProperties.realloc( nRealCount ); - SetSetProperties( ::rtl::OUString(), lCommitProperties ); - } -} - -/*-****************************************************************************************************//** - @short access method to get internal values - @descr These methods implement easy access to our internal values. - You give us right enum value to specify which module interest you ... we return right information. - - @attention Some poeple use any value as enum ... but we support in header specified values only! - We use it directly as index in our internal list. If enum value isn't right - we crash with an - "index out of range"!!! Please use me right - otherwise there is no guarantee. - - @seealso - - - @param "eModule" , index in list - specify module - @param "eFactory" , index in list - specify factory - @param "sTemplate", set new standard template for these factory - @return Queried information. - - @onerror We return default values. (mostly "not installed"!) - @threadsafe no -*//*-*****************************************************************************************************/ -sal_Bool SvtModuleOptions_Impl::IsModuleInstalled( SvtModuleOptions::EModule eModule ) const -{ - sal_Bool bInstalled = sal_False; - switch( eModule ) - { - case SvtModuleOptions::E_SWRITER : bInstalled = m_lFactories[SvtModuleOptions::E_WRITER].getInstalled(); - break; - case SvtModuleOptions::E_SWEB : bInstalled = m_lFactories[SvtModuleOptions::E_WRITERWEB].getInstalled(); - break; - case SvtModuleOptions::E_SGLOBAL : bInstalled = m_lFactories[SvtModuleOptions::E_WRITERGLOBAL].getInstalled(); - break; - case SvtModuleOptions::E_SCALC : bInstalled = m_lFactories[SvtModuleOptions::E_CALC].getInstalled(); - break; - case SvtModuleOptions::E_SDRAW : bInstalled = m_lFactories[SvtModuleOptions::E_DRAW].getInstalled(); - break; - case SvtModuleOptions::E_SIMPRESS : bInstalled = m_lFactories[SvtModuleOptions::E_IMPRESS].getInstalled(); - break; - case SvtModuleOptions::E_SMATH : bInstalled = m_lFactories[SvtModuleOptions::E_MATH].getInstalled(); - break; - case SvtModuleOptions::E_SCHART : bInstalled = m_lFactories[SvtModuleOptions::E_CHART].getInstalled(); - break; - case SvtModuleOptions::E_SSTARTMODULE : bInstalled = m_lFactories[SvtModuleOptions::E_STARTMODULE].getInstalled(); - break; - case SvtModuleOptions::E_SBASIC : bInstalled = sal_True; // Couldn't be deselected by setup yet! - break; - case SvtModuleOptions::E_SDATABASE : bInstalled = m_lFactories[SvtModuleOptions::E_DATABASE].getInstalled(); - break; - } - - return bInstalled; -} - -::com::sun::star::uno::Sequence < ::rtl::OUString > SvtModuleOptions_Impl::GetAllServiceNames() -{ - sal_uInt32 nCount=0; - if( m_lFactories[SvtModuleOptions::E_WRITER].getInstalled() ) - nCount++; - if ( m_lFactories[SvtModuleOptions::E_WRITERWEB].getInstalled() ) - nCount++; - if ( m_lFactories[SvtModuleOptions::E_WRITERGLOBAL].getInstalled() ) - nCount++; - if( m_lFactories[SvtModuleOptions::E_SCALC].getInstalled() ) - nCount++; - if( m_lFactories[SvtModuleOptions::E_SDRAW].getInstalled() ) - nCount++; - if( m_lFactories[SvtModuleOptions::E_SIMPRESS].getInstalled() ) - nCount++; - if( m_lFactories[SvtModuleOptions::E_SCHART].getInstalled() ) - nCount++; - if( m_lFactories[SvtModuleOptions::E_SMATH].getInstalled() ) - nCount++; - if( m_lFactories[SvtModuleOptions::E_SBASIC].getInstalled() ) - nCount++; - if( m_lFactories[SvtModuleOptions::E_SDATABASE].getInstalled() ) - nCount++; - - css::uno::Sequence < ::rtl::OUString > aRet( nCount ); - sal_Int32 n=0; - if( m_lFactories[SvtModuleOptions::E_WRITER].getInstalled() ) - aRet[n++] = m_lFactories[SvtModuleOptions::E_WRITER].getFactory(); - if ( m_lFactories[SvtModuleOptions::E_WRITERWEB].getInstalled() ) - aRet[n++] = m_lFactories[SvtModuleOptions::E_WRITERWEB].getFactory(); - if ( m_lFactories[SvtModuleOptions::E_WRITERGLOBAL].getInstalled() ) - aRet[n++] = m_lFactories[SvtModuleOptions::E_WRITERGLOBAL].getFactory(); - if( m_lFactories[SvtModuleOptions::E_SCALC].getInstalled() ) - aRet[n++] = m_lFactories[SvtModuleOptions::E_SCALC].getFactory(); - if( m_lFactories[SvtModuleOptions::E_SDRAW].getInstalled() ) - aRet[n++] = m_lFactories[SvtModuleOptions::E_SDRAW].getFactory(); - if( m_lFactories[SvtModuleOptions::E_SIMPRESS].getInstalled() ) - aRet[n++] = m_lFactories[SvtModuleOptions::E_SIMPRESS].getFactory(); - if( m_lFactories[SvtModuleOptions::E_SCHART].getInstalled() ) - aRet[n++] = m_lFactories[SvtModuleOptions::E_SCHART].getFactory(); - if( m_lFactories[SvtModuleOptions::E_SMATH].getInstalled() ) - aRet[n++] = m_lFactories[SvtModuleOptions::E_SMATH].getFactory(); - if( m_lFactories[SvtModuleOptions::E_SBASIC].getInstalled() ) - aRet[n++] = m_lFactories[SvtModuleOptions::E_SBASIC].getFactory(); - if( m_lFactories[SvtModuleOptions::E_SDATABASE].getInstalled() ) - aRet[n++] = m_lFactories[SvtModuleOptions::E_SDATABASE].getFactory(); - - return aRet; -} - -//***************************************************************************************************************** -::rtl::OUString SvtModuleOptions_Impl::GetFactoryName( SvtModuleOptions::EFactory eFactory ) const -{ - ::rtl::OUString sName; - - if( eFactory>=0 && eFactory=0 && eFactory=0 && eFactory=0 && eFactory=0 && eFactory=0 && eFactory=0 && eFactory=0 && eFactory=0 && eFactory SvtModuleOptions_Impl::impl_ExpandSetNames( const css::uno::Sequence< ::rtl::OUString >& lSetNames ) -{ - sal_Int32 nCount = lSetNames.getLength() ; - css::uno::Sequence< ::rtl::OUString > lPropNames ( nCount*PROPERTYCOUNT ); - ::rtl::OUString* pPropNames = lPropNames.getArray() ; - sal_Int32 nPropStart = 0 ; - - for( sal_Int32 nName=0; nName& lFactories ) -{ - // Expand every set node name in lFactories to full qualified pathes to his properties - // and get right values from configuration. - const css::uno::Sequence< ::rtl::OUString > lProperties = impl_ExpandSetNames( lFactories ); - const css::uno::Sequence< css::uno::Any > lValues = GetProperties( lProperties ); - - // Safe impossible cases. - // We need values from ALL configuration keys. - // Follow assignment use order of values in relation to our list of key names! - OSL_ENSURE( !(lProperties.getLength()!=lValues.getLength()), "SvtModuleOptions_Impl::impl_Read()\nI miss some values of configuration keys!\n" ); - - // Algorithm: We step over all given factory names and classify it. These enum value can be used as direct index - // in our member list m_lFactories! VAriable nPropertyStart marks start position of every factory - // and her properties in expanded property/value list. The defines PROPERTHANDLE_xxx are used as offset values - // added to nPropertyStart. So we can address every property relative in these lists. - // If we found any valid values ... we reset all existing informations for corresponding m_lFactories-entry and - // use a pointer to these struct in memory directly to set new values. - // But we set it only, if bInstalled is true. Otherwise all other values of a factory can be undeclared .. They - // shouldn't be used then. - // Attention: If a propertyset of a factory will be ignored we must step to next start position of next factory infos! - // see "nPropertyStart += PROPERTYCOUNT" ... - - sal_Int32 nPropertyStart = 0 ; - sal_Int32 nNodeCount = lFactories.getLength(); - FactoryInfo* pInfo = NULL ; - SvtModuleOptions::EFactory eFactory ; - - for( sal_Int32 nSetNode=0; nSetNodefree(); - - pInfo->initInstalled( sal_True ); - pInfo->initFactory ( sFactoryName ); - - if (lValues[nPropertyStart+PROPERTYHANDLE_SHORTNAME] >>= sTemp) - pInfo->initShortName( sTemp ); - if (lValues[nPropertyStart+PROPERTYHANDLE_TEMPLATEFILE] >>= sTemp) - pInfo->initTemplateFile( sTemp ); - if (lValues[nPropertyStart+PROPERTYHANDLE_WINDOWATTRIBUTES] >>= sTemp) - pInfo->initWindowAttributes( sTemp ); - if (lValues[nPropertyStart+PROPERTYHANDLE_EMPTYDOCUMENTURL] >>= sTemp) - pInfo->initEmptyDocumentURL( sTemp ); - if (lValues[nPropertyStart+PROPERTYHANDLE_DEFAULTFILTER ] >>= sTemp) - pInfo->initDefaultFilter( sTemp ); - if (lValues[nPropertyStart+PROPERTYHANDLE_ICON] >>= nTemp) - pInfo->initIcon( nTemp ); - } - nPropertyStart += PROPERTYCOUNT; - } -} - -//***************************************************************************************************************** -void SvtModuleOptions_Impl::MakeReadonlyStatesAvailable() -{ - if (m_bReadOnlyStatesWellKnown) - return; - - css::uno::Sequence< ::rtl::OUString > lFactories = GetNodeNames(::rtl::OUString()); - sal_Int32 c = lFactories.getLength(); - sal_Int32 i = 0; - for (i=0; i lReadonlyStates = GetReadOnlyStates(lFactories); - for (i=0; iIsModuleInstalled( eModule ); -} - -//***************************************************************************************************************** -::rtl::OUString SvtModuleOptions::GetFactoryName( EFactory eFactory ) const -{ - ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); - return m_pDataContainer->GetFactoryName( eFactory ); -} - -//***************************************************************************************************************** -::rtl::OUString SvtModuleOptions::GetFactoryShortName( EFactory eFactory ) const -{ - ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); - return m_pDataContainer->GetFactoryShortName( eFactory ); -} - -//***************************************************************************************************************** -::rtl::OUString SvtModuleOptions::GetFactoryStandardTemplate( EFactory eFactory ) const -{ - ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); - return m_pDataContainer->GetFactoryStandardTemplate( eFactory ); -} - -//***************************************************************************************************************** -::rtl::OUString SvtModuleOptions::GetFactoryWindowAttributes( EFactory eFactory ) const -{ - ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); - return m_pDataContainer->GetFactoryWindowAttributes( eFactory ); -} - -//***************************************************************************************************************** -::rtl::OUString SvtModuleOptions::GetFactoryEmptyDocumentURL( EFactory eFactory ) const -{ - ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); - return m_pDataContainer->GetFactoryEmptyDocumentURL( eFactory ); -} - -//***************************************************************************************************************** -::rtl::OUString SvtModuleOptions::GetFactoryDefaultFilter( EFactory eFactory ) const -{ - ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); - return m_pDataContainer->GetFactoryDefaultFilter( eFactory ); -} -//***************************************************************************************************************** -sal_Bool SvtModuleOptions::IsDefaultFilterReadonly( EFactory eFactory ) const -{ - ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); - m_pDataContainer->MakeReadonlyStatesAvailable(); - return m_pDataContainer->IsDefaultFilterReadonly( eFactory ); -} -//***************************************************************************************************************** -sal_Int32 SvtModuleOptions::GetFactoryIcon( EFactory eFactory ) const -{ - ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); - return m_pDataContainer->GetFactoryIcon( eFactory ); -} - -//***************************************************************************************************************** -sal_Bool SvtModuleOptions::ClassifyFactoryByName( const ::rtl::OUString& sName , - EFactory& eFactory ) -{ - // We don't need any mutex here ... because we don't use any member here! - return SvtModuleOptions_Impl::ClassifyFactoryByName( sName, eFactory ); -} - -//***************************************************************************************************************** -void SvtModuleOptions::SetFactoryStandardTemplate( EFactory eFactory , - const ::rtl::OUString& sTemplate ) -{ - ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); - m_pDataContainer->SetFactoryStandardTemplate( eFactory, sTemplate ); -} - -//***************************************************************************************************************** -void SvtModuleOptions::SetFactoryWindowAttributes( EFactory eFactory , - const ::rtl::OUString& sAttributes) -{ - ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); - m_pDataContainer->SetFactoryWindowAttributes( eFactory, sAttributes ); -} - -//***************************************************************************************************************** -void SvtModuleOptions::SetFactoryDefaultFilter( EFactory eFactory, - const ::rtl::OUString& sFilter ) -{ - ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); - m_pDataContainer->SetFactoryDefaultFilter( eFactory, sFilter ); -} - -//***************************************************************************************************************** -sal_Bool SvtModuleOptions::IsMath() const -{ - ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); - return m_pDataContainer->IsModuleInstalled( E_SMATH ); -} - -//***************************************************************************************************************** -sal_Bool SvtModuleOptions::IsChart() const -{ - ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); - return m_pDataContainer->IsModuleInstalled( E_SCHART ); -} - -//***************************************************************************************************************** -sal_Bool SvtModuleOptions::IsCalc() const -{ - ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); - return m_pDataContainer->IsModuleInstalled( E_SCALC ); -} - -//***************************************************************************************************************** -sal_Bool SvtModuleOptions::IsDraw() const -{ - ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); - return m_pDataContainer->IsModuleInstalled( E_SDRAW ); -} - -//***************************************************************************************************************** -sal_Bool SvtModuleOptions::IsWriter() const -{ - ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); - return m_pDataContainer->IsModuleInstalled( E_SWRITER ); -} - -//***************************************************************************************************************** -sal_Bool SvtModuleOptions::IsImpress() const -{ - ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); - return m_pDataContainer->IsModuleInstalled( E_SIMPRESS ); -} - -//***************************************************************************************************************** -sal_Bool SvtModuleOptions::IsBasicIDE() const -{ - return sal_True; -} -//***************************************************************************************************************** -sal_Bool SvtModuleOptions::IsDataBase() const -{ - ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); - return m_pDataContainer->IsModuleInstalled( E_SDATABASE ); -} -//***************************************************************************************************************** -sal_uInt32 SvtModuleOptions::GetFeatures() const -{ - ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); - - sal_uInt32 nFeature = 0; - - if( m_pDataContainer->IsModuleInstalled( E_SWRITER ) == sal_True ) - nFeature |= FEATUREFLAG_WRITER; - if( m_pDataContainer->IsModuleInstalled( E_SCALC ) == sal_True ) - nFeature |= FEATUREFLAG_CALC; - if( m_pDataContainer->IsModuleInstalled( E_SDRAW ) == sal_True ) - nFeature |= FEATUREFLAG_DRAW; - if( m_pDataContainer->IsModuleInstalled( E_SIMPRESS ) == sal_True ) - nFeature |= FEATUREFLAG_IMPRESS; - if( m_pDataContainer->IsModuleInstalled( E_SCHART ) == sal_True ) - nFeature |= FEATUREFLAG_CHART; - if( m_pDataContainer->IsModuleInstalled( E_SMATH ) == sal_True ) - nFeature |= FEATUREFLAG_MATH; - if( m_pDataContainer->IsModuleInstalled( E_SBASIC ) == sal_True ) - nFeature |= FEATUREFLAG_BASICIDE; - if( m_pDataContainer->IsModuleInstalled( E_SDATABASE ) == sal_True ) - nFeature |= FEATUREFLAG_INSIGHT; - - return nFeature; -} - -/*-****************************************************************************************************//** - @short return a reference to a static mutex - @descr These class is threadsafe. - We create a static mutex only for one time and use it to protect our refcount and container - member! - - @seealso - - - @param - - @return A reference to a static mutex member. - - @onerror - - @threadsafe yes -*//*-*****************************************************************************************************/ -::osl::Mutex& SvtModuleOptions::impl_GetOwnStaticMutex() -{ - // Initialize static mutex only for one time! - static ::osl::Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static ::osl::Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; -} - -::rtl::OUString SvtModuleOptions::GetModuleName( EModule eModule ) const -{ - switch( eModule ) - { - case SvtModuleOptions::E_SWRITER : { return ::rtl::OUString::createFromAscii("Writer"); } - case SvtModuleOptions::E_SWEB : { return ::rtl::OUString::createFromAscii("Web"); } - case SvtModuleOptions::E_SGLOBAL : { return ::rtl::OUString::createFromAscii("Global"); } - case SvtModuleOptions::E_SCALC : { return ::rtl::OUString::createFromAscii("Calc"); } - case SvtModuleOptions::E_SDRAW : { return ::rtl::OUString::createFromAscii("Draw"); } - case SvtModuleOptions::E_SIMPRESS : { return ::rtl::OUString::createFromAscii("Impress"); } - case SvtModuleOptions::E_SMATH : { return ::rtl::OUString::createFromAscii("Math"); } - case SvtModuleOptions::E_SCHART : { return ::rtl::OUString::createFromAscii("Chart"); } - case SvtModuleOptions::E_SBASIC : { return ::rtl::OUString::createFromAscii("Basic"); } - case SvtModuleOptions::E_SDATABASE : { return ::rtl::OUString::createFromAscii("Database"); } - default: - OSL_ASSERT( "unknown module" ); - break; - } - - return ::rtl::OUString(); -} - -::rtl::OUString SvtModuleOptions::GetModuleName( EFactory eFactory ) const -{ - switch( eFactory ) - { - case SvtModuleOptions::E_WRITER : { return ::rtl::OUString::createFromAscii("Writer"); } - case SvtModuleOptions::E_WRITERWEB : { return ::rtl::OUString::createFromAscii("Writer"); } - case SvtModuleOptions::E_WRITERGLOBAL : { return ::rtl::OUString::createFromAscii("Writer"); } - case SvtModuleOptions::E_CALC : { return ::rtl::OUString::createFromAscii("Calc"); } - case SvtModuleOptions::E_DRAW : { return ::rtl::OUString::createFromAscii("Draw"); } - case SvtModuleOptions::E_IMPRESS : { return ::rtl::OUString::createFromAscii("Impress"); } - case SvtModuleOptions::E_MATH : { return ::rtl::OUString::createFromAscii("Math"); } - case SvtModuleOptions::E_CHART : { return ::rtl::OUString::createFromAscii("Chart"); } - case SvtModuleOptions::E_BASIC : { return ::rtl::OUString::createFromAscii("Basic"); } - case SvtModuleOptions::E_DATABASE : { return ::rtl::OUString::createFromAscii("Database"); } - default: - OSL_ASSERT( "unknown factory" ); - break; - } - - return ::rtl::OUString(); -} - -/*----------------------------------------------- - 07.03.2004 15:03 ------------------------------------------------*/ -SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByShortName(const ::rtl::OUString& sName) -{ - if (sName.equalsAscii("swriter")) - return E_WRITER; - if (sName.equalsIgnoreAsciiCaseAscii("swriter/Web")) // sometimes they are registerd for swriter/web :-( - return E_WRITERWEB; - if (sName.equalsIgnoreAsciiCaseAscii("swriter/GlobalDocument")) // sometimes they are registerd for swriter/globaldocument :-( - return E_WRITERGLOBAL; - if (sName.equalsAscii("scalc")) - return E_CALC; - if (sName.equalsAscii("sdraw")) - return E_DRAW; - if (sName.equalsAscii("simpress")) - return E_IMPRESS; - if (sName.equalsAscii("schart")) - return E_CHART; - if (sName.equalsAscii("smath")) - return E_MATH; - if (sName.equalsAscii("sbasic")) - return E_BASIC; - if (sName.equalsAscii("sdatabase")) - return E_DATABASE; - - return E_UNKNOWN_FACTORY; -} - -/*----------------------------------------------- - 31.07.2003 10:41 ------------------------------------------------*/ -SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByServiceName(const ::rtl::OUString& sName) -{ - if (sName.equals(FACTORYNAME_WRITERGLOBAL)) - return E_WRITERGLOBAL; - if (sName.equals(FACTORYNAME_WRITERWEB)) - return E_WRITERWEB; - if (sName.equals(FACTORYNAME_WRITER)) - return E_WRITER; - if (sName.equals(FACTORYNAME_CALC)) - return E_CALC; - if (sName.equals(FACTORYNAME_DRAW)) - return E_DRAW; - if (sName.equals(FACTORYNAME_IMPRESS)) - return E_IMPRESS; - if (sName.equals(FACTORYNAME_MATH)) - return E_MATH; - if (sName.equals(FACTORYNAME_CHART)) - return E_CHART; - if (sName.equals(FACTORYNAME_DATABASE)) - return E_DATABASE; - - return E_UNKNOWN_FACTORY; -} - -/*----------------------------------------------- - 31.07.2003 14:39 ------------------------------------------------*/ -SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByURL(const ::rtl::OUString& sURL , - const css::uno::Sequence< css::beans::PropertyValue >& lMediaDescriptor) -{ - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::utl::getProcessServiceFactory(); - if (!xSMGR.is()) - return E_UNKNOWN_FACTORY; - - css::uno::Reference< css::container::XNameAccess > xFilterCfg; - css::uno::Reference< css::container::XNameAccess > xTypeCfg ; - try - { - xFilterCfg = css::uno::Reference< css::container::XNameAccess >( - xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.document.FilterFactory")), css::uno::UNO_QUERY); - xTypeCfg = css::uno::Reference< css::container::XNameAccess >( - xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.document.TypeDetection")), css::uno::UNO_QUERY); - } - catch(const css::uno::RuntimeException&) - { throw; } - catch(const css::uno::Exception&) - { return E_UNKNOWN_FACTORY; } - - ::comphelper::SequenceAsHashMap stlDesc(lMediaDescriptor); - - // is there already a filter inside the descriptor? - ::rtl::OUString sFilterName = stlDesc.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("FilterName"), ::rtl::OUString()); - if (sFilterName.getLength()) - { - try - { - ::comphelper::SequenceAsHashMap stlFilterProps (xFilterCfg->getByName(sFilterName)); - ::rtl::OUString sDocumentService = stlFilterProps.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("DocumentService"), ::rtl::OUString()); - SvtModuleOptions::EFactory eApp = SvtModuleOptions::ClassifyFactoryByServiceName(sDocumentService); - - if (eApp != E_UNKNOWN_FACTORY) - return eApp; - } - catch(const css::uno::RuntimeException&) - { throw; } - catch(const css::uno::Exception&) - { /* do nothing here ... may the following code can help!*/ } - } - - // is there already a type inside the descriptor? - ::rtl::OUString sTypeName = stlDesc.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("TypeName"), ::rtl::OUString()); - if (!sTypeName.getLength()) - { - // no :-( - // start flat detection of URL - css::uno::Reference< css::document::XTypeDetection > xDetect(xTypeCfg, css::uno::UNO_QUERY); - sTypeName = xDetect->queryTypeByURL(sURL); - } - - if (!sTypeName.getLength()) - return E_UNKNOWN_FACTORY; - - // yes - there is a type info - // Try to find the preferred filter. - try - { - ::comphelper::SequenceAsHashMap stlTypeProps (xTypeCfg->getByName(sTypeName)); - ::rtl::OUString sPreferredFilter = stlTypeProps.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("PreferredFilter"), ::rtl::OUString()); - ::comphelper::SequenceAsHashMap stlFilterProps (xFilterCfg->getByName(sPreferredFilter)); - ::rtl::OUString sDocumentService = stlFilterProps.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("DocumentService"), ::rtl::OUString()); - SvtModuleOptions::EFactory eApp = SvtModuleOptions::ClassifyFactoryByServiceName(sDocumentService); - - if (eApp != E_UNKNOWN_FACTORY) - return eApp; - } - catch(const css::uno::RuntimeException&) - { throw; } - catch(const css::uno::Exception&) - { /* do nothing here ... may the following code can help!*/ } - - // no filter/no type/no detection result => no fun :-) - return E_UNKNOWN_FACTORY; -} - -/*----------------------------------------------- - 31.07.2003 10:41 ------------------------------------------------*/ -SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByModel(const css::uno::Reference< css::frame::XModel >& xModel) -{ - css::uno::Reference< css::lang::XServiceInfo > xInfo(xModel, css::uno::UNO_QUERY); - if (!xInfo.is()) - return E_UNKNOWN_FACTORY; - - const css::uno::Sequence< ::rtl::OUString > lServices = xInfo->getSupportedServiceNames(); - const ::rtl::OUString* pServices = lServices.getConstArray(); - - for (sal_Int32 i=0; i SvtModuleOptions::GetAllServiceNames() -{ - ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); - return m_pDataContainer->GetAllServiceNames(); -} - -::rtl::OUString SvtModuleOptions::GetDefaultModuleName() -{ - ::rtl::OUString aModule; - if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SWRITER)) - aModule = m_pDataContainer->GetFactoryShortName(SvtModuleOptions::E_WRITER); - else - if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SCALC)) - aModule = m_pDataContainer->GetFactoryShortName(SvtModuleOptions::E_CALC); - else - if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SIMPRESS)) - aModule = m_pDataContainer->GetFactoryShortName(SvtModuleOptions::E_IMPRESS); - else - if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SDATABASE)) - aModule = m_pDataContainer->GetFactoryShortName(SvtModuleOptions::E_DATABASE); - else - if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SDRAW)) - aModule = m_pDataContainer->GetFactoryShortName(SvtModuleOptions::E_DRAW); - else - if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SWEB)) - aModule = m_pDataContainer->GetFactoryShortName(SvtModuleOptions::E_WRITERWEB); - else - if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SGLOBAL)) - aModule = m_pDataContainer->GetFactoryShortName(SvtModuleOptions::E_WRITERGLOBAL); - else - if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SMATH)) - aModule = m_pDataContainer->GetFactoryShortName(SvtModuleOptions::E_MATH); - return aModule; -} - diff --git a/svtools/source/config/options.cxx b/svtools/source/config/options.cxx deleted file mode 100644 index b418b90530a3..000000000000 --- a/svtools/source/config/options.cxx +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: options.cxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include "sal/config.h" - -#include - -using svt::detail::Options; - -Options::Options() {} - -Options::~Options() {} diff --git a/svtools/source/config/optionsdlg.cxx b/svtools/source/config/optionsdlg.cxx deleted file mode 100644 index 87878b0302bc..000000000000 --- a/svtools/source/config/optionsdlg.cxx +++ /dev/null @@ -1,293 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: optionsdlg.cxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include "itemholder1.hxx" - -using namespace utl; -using namespace rtl; -using namespace com::sun::star::beans ; -using namespace com::sun::star::uno; - -#define CFG_FILENAME OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.OptionsDialog" ) ) -#define ROOT_NODE OUString( RTL_CONSTASCII_USTRINGPARAM( "OptionsDialogGroups" ) ) -#define PAGES_NODE OUString( RTL_CONSTASCII_USTRINGPARAM( "Pages" ) ) -#define OPTIONS_NODE OUString( RTL_CONSTASCII_USTRINGPARAM( "Options" ) ) -#define PROPERTY_HIDE OUString( RTL_CONSTASCII_USTRINGPARAM( "Hide" ) ) - -static SvtOptionsDlgOptions_Impl* pOptions = NULL; -static sal_Int32 nRefCount = 0; - -class SvtOptionsDlgOptions_Impl : public utl::ConfigItem -{ -private: - struct OUStringHashCode - { - size_t operator()( const ::rtl::OUString& sString ) const - { - return sString.hashCode(); - } - }; - - typedef std::hash_map< OUString, sal_Bool, OUStringHashCode, ::std::equal_to< OUString > > OptionNodeList; - - OUString m_sPathDelimiter; - OptionNodeList m_aOptionNodeList; - - enum NodeType{ NT_Group, NT_Page, NT_Option }; - void ReadNode( const OUString& _rNode, NodeType _eType ); - sal_Bool IsHidden( const OUString& _rPath ) const; - -public: - SvtOptionsDlgOptions_Impl(); - - virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); - virtual void Commit(); - - static ::osl::Mutex & getInitMutex(); - - sal_Bool IsGroupHidden ( const OUString& _rGroup ) const; - sal_Bool IsPageHidden ( const OUString& _rPage, - const OUString& _rGroup ) const; - sal_Bool IsOptionHidden ( const OUString& _rOption, - const OUString& _rPage, - const OUString& _rGroup ) const; -}; - -::osl::Mutex & SvtOptionsDlgOptions_Impl::getInitMutex() -{ - static ::osl::Mutex *pMutex = 0; - - if( ! pMutex ) - { - ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() ); - if( ! pMutex ) - { - static ::osl::Mutex mutex; - pMutex = &mutex; - } - } - return *pMutex; -} - -// ----------------------------------------------------------------------- - -SvtOptionsDlgOptions_Impl::SvtOptionsDlgOptions_Impl() - : ConfigItem( OUString( CFG_FILENAME ) ), - - m_sPathDelimiter( RTL_CONSTASCII_USTRINGPARAM( "/" ) ), - m_aOptionNodeList( OptionNodeList() ) - -{ - OUString sRootNode( ROOT_NODE ); - Sequence< OUString > aNodeSeq = GetNodeNames( sRootNode ); - OUString sNode( sRootNode + m_sPathDelimiter ); - sal_uInt32 nCount = aNodeSeq.getLength(); - for ( sal_uInt32 n = 0; n < nCount; n++ ) - { - OUString sSubNode( sNode + aNodeSeq[n] ); - ReadNode( sSubNode, NT_Group ); - } -} - -// ----------------------------------------------------------------------- - -void SvtOptionsDlgOptions_Impl::Commit() -{ - // nothing to commit -} - -// ----------------------------------------------------------------------- - -void SvtOptionsDlgOptions_Impl::Notify( const Sequence< rtl::OUString >& ) -{ - // nothing to notify -} - -void SvtOptionsDlgOptions_Impl::ReadNode( const OUString& _rNode, NodeType _eType ) -{ - OUString sNode( _rNode + m_sPathDelimiter ); - OUString sSet; - sal_Int32 nLen = 0; - switch ( _eType ) - { - case NT_Group : - { - sSet = PAGES_NODE; - nLen = 2; - break; - } - - case NT_Page : - { - sSet = OPTIONS_NODE; - nLen = 2; - break; - } - - case NT_Option : - { - nLen = 1; - break; - } - } - - Sequence< OUString > lResult( nLen ); - lResult[0] = OUString( sNode + PROPERTY_HIDE ); - if ( _eType != NT_Option ) - lResult[1] = OUString( sNode + sSet ); - - Sequence< Any > aValues; - aValues = GetProperties( lResult ); - sal_Bool bHide = sal_False; - if ( aValues[0] >>= bHide ) - m_aOptionNodeList.insert( OptionNodeList::value_type( sNode, bHide ) ); - - if ( _eType != NT_Option ) - { - OUString sNodes( sNode + sSet ); - Sequence< OUString > aNodes = GetNodeNames( sNodes ); - if ( aNodes.getLength() > 0 ) - { - for ( sal_uInt32 n = 0; n < (sal_uInt32)aNodes.getLength(); ++n ) - { - OUString sSubNodeName( sNodes + m_sPathDelimiter + aNodes[n] ); - ReadNode( sSubNodeName, _eType == NT_Group ? NT_Page : NT_Option ); - } - } - } -} - -// ----------------------------------------------------------------------- - -OUString getGroupPath( const OUString& _rGroup ) -{ - return OUString( ROOT_NODE + OUString('/') + _rGroup + OUString('/') ); -} -OUString getPagePath( const OUString& _rPage ) -{ - return OUString( PAGES_NODE + OUString('/') + _rPage + OUString('/') ); -} -OUString getOptionPath( const OUString& _rOption ) -{ - return OUString( OPTIONS_NODE + OUString('/') + _rOption + OUString('/') ); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvtOptionsDlgOptions_Impl::IsHidden( const OUString& _rPath ) const -{ - sal_Bool bRet = sal_False; - OptionNodeList::const_iterator pIter = m_aOptionNodeList.find( _rPath ); - if ( pIter != m_aOptionNodeList.end() ) - bRet = pIter->second; - return bRet; -} - -// ----------------------------------------------------------------------- - -sal_Bool SvtOptionsDlgOptions_Impl::IsGroupHidden( const OUString& _rGroup ) const -{ - return IsHidden( getGroupPath( _rGroup ) ); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvtOptionsDlgOptions_Impl::IsPageHidden( const OUString& _rPage, const OUString& _rGroup ) const -{ - return IsHidden( getGroupPath( _rGroup ) + getPagePath( _rPage ) ); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvtOptionsDlgOptions_Impl::IsOptionHidden( - const OUString& _rOption, const OUString& _rPage, const OUString& _rGroup ) const -{ - return IsHidden( getGroupPath( _rGroup ) + getPagePath( _rPage ) + getOptionPath( _rOption ) ); -} - -// ----------------------------------------------------------------------- - -SvtOptionsDialogOptions::SvtOptionsDialogOptions() -{ - // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( SvtOptionsDlgOptions_Impl::getInitMutex() ); - ++nRefCount; - if ( !pOptions ) - { - pOptions = new SvtOptionsDlgOptions_Impl; - - ItemHolder1::holdConfigItem( E_OPTIONSDLGOPTIONS ); - } - m_pImp = pOptions; -} - -// ----------------------------------------------------------------------- - -SvtOptionsDialogOptions::~SvtOptionsDialogOptions() -{ - // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( SvtOptionsDlgOptions_Impl::getInitMutex() ); - if ( !--nRefCount ) - { - if ( pOptions->IsModified() ) - pOptions->Commit(); - DELETEZ( pOptions ); - } -} - -sal_Bool SvtOptionsDialogOptions::IsGroupHidden( const String& _rGroup ) const -{ - return m_pImp->IsGroupHidden( _rGroup ); -} - -sal_Bool SvtOptionsDialogOptions::IsPageHidden( const String& _rPage, const String& _rGroup ) const -{ - return m_pImp->IsPageHidden( _rPage, _rGroup ); -} - -sal_Bool SvtOptionsDialogOptions::IsOptionHidden( - const String& _rOption, const String& _rPage, const String& _rGroup ) const -{ - return m_pImp->IsOptionHidden( _rOption, _rPage, _rGroup ); -} - diff --git a/svtools/source/config/pathoptions.cxx b/svtools/source/config/pathoptions.cxx deleted file mode 100644 index 8c561b299d46..000000000000 --- a/svtools/source/config/pathoptions.cxx +++ /dev/null @@ -1,1094 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: pathoptions.cxx,v $ - * $Revision: 1.81 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -using namespace osl; -using namespace utl; -using namespace rtl; -using namespace com::sun::star::uno; -using namespace com::sun::star::beans; -using namespace com::sun::star::util; -using namespace com::sun::star::lang; - -// define ---------------------------------------------------------------- - -#define SEARCHPATH_DELIMITER ';' - -#define ASCII_STR(s) OUString( RTL_CONSTASCII_USTRINGPARAM(s) ) - -#define SIGN_STARTVARIABLE ASCII_STR("$(") -#define SIGN_ENDVARIABLE ASCII_STR(")") - -// Supported variables by the old SvtPathOptions implementation -#define SUBSTITUTE_INST "$(inst)" -#define SUBSTITUTE_PROG "$(prog)" -#define SUBSTITUTE_USER "$(user)" -#define SUBSTITUTE_INSTPATH "$(instpath)" -#define SUBSTITUTE_PROGPATH "$(progpath)" -#define SUBSTITUTE_USERPATH "$(userpath)" -#define SUBSTITUTE_INSTURL "$(insturl)" -#define SUBSTITUTE_PROGURL "$(progurl)" -#define SUBSTITUTE_USERURL "$(userurl)" -#define SUBSTITUTE_PATH "$(path)" -//#define SUBSTITUTE_LANG "$(lang)" -#define SUBSTITUTE_LANGID "$(langid)" -#define SUBSTITUTE_VLANG "$(vlang)" -#define SUBSTITUTE_WORKDIRURL "$(workdirurl)" - -#define STRPOS_NOTFOUND -1 - -struct OUStringHashCode -{ - size_t operator()( const ::rtl::OUString& sString ) const - { - return sString.hashCode(); - } -}; - -enum VarNameProperty -{ - VAR_NEEDS_SYSTEM_PATH, - VAR_NEEDS_FILEURL -}; - -class NameToHandleMap : public ::std::hash_map< ::rtl::OUString, sal_Int32, OUStringHashCode, ::std::equal_to< ::rtl::OUString > > -{ - public: - inline void free() { NameToHandleMap().swap( *this ); } -}; - -class EnumToHandleMap : public ::std::hash_map< sal_Int32, sal_Int32, std::hash< sal_Int32 >, std::equal_to< sal_Int32 > > -{ - public: - inline void free() { EnumToHandleMap().swap( *this ); } -}; - -class VarNameToEnumMap : public ::std::hash_map< OUString, VarNameProperty, OUStringHashCode, ::std::equal_to< OUString > > -{ - public: - inline void free() { VarNameToEnumMap().swap( *this ); } -}; - - -// class SvtPathOptions_Impl --------------------------------------------- -class SvtPathOptions_Impl -{ - private: - // Local variables to return const references - std::vector< String > m_aPathArray; - Reference< XFastPropertySet > m_xPathSettings; - Reference< XStringSubstitution > m_xSubstVariables; - mutable EnumToHandleMap m_aMapEnumToPropHandle; - VarNameToEnumMap m_aMapVarNamesToEnum; - - ::com::sun::star::lang::Locale m_aLocale; - String m_aEmptyString; - mutable ::osl::Mutex m_aMutex; - - public: - SvtPathOptions_Impl(); - - // get the pathes, not const because of using a mutex - const String& GetPath( SvtPathOptions::Pathes ); - const String& GetAddinPath() { return GetPath( SvtPathOptions::PATH_ADDIN ); } - const String& GetAutoCorrectPath() { return GetPath( SvtPathOptions::PATH_AUTOCORRECT ); } - const String& GetAutoTextPath() { return GetPath( SvtPathOptions::PATH_AUTOTEXT ); } - const String& GetBackupPath() { return GetPath( SvtPathOptions::PATH_BACKUP ); } - const String& GetBasicPath() { return GetPath( SvtPathOptions::PATH_BASIC ); } - const String& GetBitmapPath() { return GetPath( SvtPathOptions::PATH_BITMAP ); } - const String& GetConfigPath() { return GetPath( SvtPathOptions::PATH_CONFIG ); } - const String& GetDictionaryPath() { return GetPath( SvtPathOptions::PATH_DICTIONARY ); } - const String& GetFavoritesPath() { return GetPath( SvtPathOptions::PATH_FAVORITES ); } - const String& GetFilterPath() { return GetPath( SvtPathOptions::PATH_FILTER ); } - const String& GetGalleryPath() { return GetPath( SvtPathOptions::PATH_GALLERY ); } - const String& GetGraphicPath() { return GetPath( SvtPathOptions::PATH_GRAPHIC ); } - const String& GetHelpPath() { return GetPath( SvtPathOptions::PATH_HELP ); } - const String& GetLinguisticPath() { return GetPath( SvtPathOptions::PATH_LINGUISTIC ); } - const String& GetModulePath() { return GetPath( SvtPathOptions::PATH_MODULE ); } - const String& GetPalettePath() { return GetPath( SvtPathOptions::PATH_PALETTE ); } - const String& GetPluginPath() { return GetPath( SvtPathOptions::PATH_PLUGIN ); } - const String& GetStoragePath() { return GetPath( SvtPathOptions::PATH_STORAGE ); } - const String& GetTempPath() { return GetPath( SvtPathOptions::PATH_TEMP ); } - const String& GetTemplatePath() { return GetPath( SvtPathOptions::PATH_TEMPLATE ); } - const String& GetUserConfigPath() { return GetPath( SvtPathOptions::PATH_USERCONFIG ); } - const String& GetWorkPath() { return GetPath( SvtPathOptions::PATH_WORK ); } - const String& GetUIConfigPath() { return GetPath( SvtPathOptions::PATH_UICONFIG ); } - const String& GetFingerprintPath() { return GetPath( SvtPathOptions::PATH_FINGERPRINT ); } - - // set the pathes - void SetPath( SvtPathOptions::Pathes, const String& rNewPath ); - void SetAddinPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_ADDIN, rPath ); } - void SetAutoCorrectPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_AUTOCORRECT, rPath ); } - void SetAutoTextPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_AUTOTEXT, rPath ); } - void SetBackupPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_BACKUP, rPath ); } - void SetBasicPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_BASIC, rPath ); } - void SetBitmapPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_BITMAP, rPath ); } - void SetConfigPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_CONFIG, rPath ); } - void SetDictionaryPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_DICTIONARY, rPath ); } - void SetFavoritesPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_FAVORITES, rPath ); } - void SetFilterPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_FILTER, rPath ); } - void SetGalleryPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_GALLERY, rPath ); } - void SetGraphicPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_GRAPHIC, rPath ); } - void SetHelpPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_HELP, rPath ); } - void SetLinguisticPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_LINGUISTIC, rPath ); } - void SetModulePath( const String& rPath ) { SetPath( SvtPathOptions::PATH_MODULE, rPath ); } - void SetPalettePath( const String& rPath ) { SetPath( SvtPathOptions::PATH_PALETTE, rPath ); } - void SetPluginPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_PLUGIN, rPath ); } - void SetStoragePath( const String& rPath ) { SetPath( SvtPathOptions::PATH_STORAGE, rPath ); } - void SetTempPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_TEMP, rPath ); } - void SetTemplatePath( const String& rPath ) { SetPath( SvtPathOptions::PATH_TEMPLATE, rPath ); } - void SetUserConfigPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_USERCONFIG, rPath ); } - void SetWorkPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_WORK, rPath ); } - - rtl::OUString SubstVar( const rtl::OUString& rVar ); - rtl::OUString SubstituteAndConvert( const rtl::OUString& rPath ); - rtl::OUString UsePathVariables( const rtl::OUString& rPath ); - - ::com::sun::star::lang::Locale GetLocale() const { return m_aLocale; } - - BOOL IsPathReadonly(SvtPathOptions::Pathes ePath)const; -}; - -// global ---------------------------------------------------------------- - -static SvtPathOptions_Impl* pOptions = NULL; -static sal_Int32 nRefCount = 0; - -// functions ------------------------------------------------------------- -struct PropertyStruct -{ - const char* pPropName; // The ascii name of the Office path - SvtPathOptions::Pathes ePath; // The enum value used by SvtPathOptions -}; - -struct VarNameAttribute -{ - const char* pVarName; // The name of the path variable - VarNameProperty eVarProperty; // Which return value is needed by this path variable -}; - -static PropertyStruct aPropNames[] = -{ - { "Addin", SvtPathOptions::PATH_ADDIN }, - { "AutoCorrect", SvtPathOptions::PATH_AUTOCORRECT }, - { "AutoText", SvtPathOptions::PATH_AUTOTEXT }, - { "Backup", SvtPathOptions::PATH_BACKUP }, - { "Basic", SvtPathOptions::PATH_BASIC }, - { "Bitmap", SvtPathOptions::PATH_BITMAP }, - { "Config", SvtPathOptions::PATH_CONFIG }, - { "Dictionary", SvtPathOptions::PATH_DICTIONARY }, - { "Favorite", SvtPathOptions::PATH_FAVORITES }, - { "Filter", SvtPathOptions::PATH_FILTER }, - { "Gallery", SvtPathOptions::PATH_GALLERY }, - { "Graphic", SvtPathOptions::PATH_GRAPHIC }, - { "Help", SvtPathOptions::PATH_HELP }, - { "Linguistic", SvtPathOptions::PATH_LINGUISTIC }, - { "Module", SvtPathOptions::PATH_MODULE }, - { "Palette", SvtPathOptions::PATH_PALETTE }, - { "Plugin", SvtPathOptions::PATH_PLUGIN }, - { "Storage", SvtPathOptions::PATH_STORAGE }, - { "Temp", SvtPathOptions::PATH_TEMP }, - { "Template", SvtPathOptions::PATH_TEMPLATE }, - { "UserConfig", SvtPathOptions::PATH_USERCONFIG }, - { "Work", SvtPathOptions::PATH_WORK }, - { "UIConfig", SvtPathOptions::PATH_UICONFIG }, - { "Fingerprint", SvtPathOptions::PATH_FINGERPRINT } -}; - -static VarNameAttribute aVarNameAttribute[] = -{ - { SUBSTITUTE_INSTPATH, VAR_NEEDS_SYSTEM_PATH }, // $(instpath) - { SUBSTITUTE_PROGPATH, VAR_NEEDS_SYSTEM_PATH }, // $(progpath) - { SUBSTITUTE_USERPATH, VAR_NEEDS_SYSTEM_PATH }, // $(userpath) - { SUBSTITUTE_PATH, VAR_NEEDS_SYSTEM_PATH }, // $(path) -}; - -#if 0 -// currently unused -static Sequence< OUString > GetPathPropertyNames() -{ - const int nCount = sizeof( aPropNames ) / sizeof( PropertyStruct ); - Sequence< OUString > aNames( nCount ); - OUString* pNames = aNames.getArray(); - for ( int i = 0; i < nCount; i++ ) - pNames[i] = OUString::createFromAscii( aPropNames[i].pPropName ); - - return aNames; -} -#endif - -// class SvtPathOptions_Impl --------------------------------------------- - -const String& SvtPathOptions_Impl::GetPath( SvtPathOptions::Pathes ePath ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( ePath < SvtPathOptions::PATH_COUNT ) - { - OUString aPathValue; - String aResult; - sal_Int32 nHandle = m_aMapEnumToPropHandle[ (sal_Int32)ePath ]; - - // Substitution is done by the service itself using the substition service - Any a = m_xPathSettings->getFastPropertyValue( nHandle ); - a >>= aPathValue; - if( ePath == SvtPathOptions::PATH_ADDIN || - ePath == SvtPathOptions::PATH_FILTER || - ePath == SvtPathOptions::PATH_HELP || - ePath == SvtPathOptions::PATH_MODULE || - ePath == SvtPathOptions::PATH_PLUGIN || - ePath == SvtPathOptions::PATH_STORAGE - ) - { - // These office paths have to be converted to system pathes - utl::LocalFileHelper::ConvertURLToPhysicalName( aPathValue, aResult ); - aPathValue = aResult; - } - - m_aPathArray[ ePath ] = aPathValue; - return m_aPathArray[ ePath ]; - } - - return m_aEmptyString; -} -// ----------------------------------------------------------------------- -BOOL SvtPathOptions_Impl::IsPathReadonly(SvtPathOptions::Pathes ePath)const -{ - ::osl::MutexGuard aGuard( m_aMutex ); - BOOL bReadonly = FALSE; - if ( ePath < SvtPathOptions::PATH_COUNT ) - { - Reference xPrSet(m_xPathSettings, UNO_QUERY); - if(xPrSet.is()) - { - Reference xInfo = xPrSet->getPropertySetInfo(); - const char* pA = aPropNames[ePath].pPropName; - ::rtl::OUString sU = OUString::createFromAscii(pA); - Property aProperty = xInfo->getPropertyByName(sU); - bReadonly = 0 != (aProperty.Attributes & PropertyAttribute::READONLY); - } - } - return bReadonly; -} -// ----------------------------------------------------------------------- - -void SvtPathOptions_Impl::SetPath( SvtPathOptions::Pathes ePath, const String& rNewPath ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( ePath < SvtPathOptions::PATH_COUNT ) - { - String aResult; - OUString aNewValue; - Any a; - - switch ( ePath ) - { - case SvtPathOptions::PATH_ADDIN: - case SvtPathOptions::PATH_FILTER: - case SvtPathOptions::PATH_HELP: - case SvtPathOptions::PATH_MODULE: - case SvtPathOptions::PATH_PLUGIN: - case SvtPathOptions::PATH_STORAGE: - { - // These office paths have to be convert back to UCB-URL's - utl::LocalFileHelper::ConvertPhysicalNameToURL( rNewPath, aResult ); - aNewValue = aResult; - } - break; - - default: - aNewValue = rNewPath; - } - - // Resubstitution is done by the service itself using the substition service - a <<= aNewValue; - try - { - m_xPathSettings->setFastPropertyValue( m_aMapEnumToPropHandle[ (sal_Int32)ePath], a ); - } - catch (const Exception&) - { - } - } -} - -// ----------------------------------------------------------------------- - -OUString SvtPathOptions_Impl::SubstituteAndConvert( const rtl::OUString& rPath ) -{ - return SubstVar( rPath ); -} - -//------------------------------------------------------------------------- - -OUString SvtPathOptions_Impl::UsePathVariables( const OUString& rPath ) -{ - return m_xSubstVariables->reSubstituteVariables( rPath ); -} - -// ----------------------------------------------------------------------- - -OUString SvtPathOptions_Impl::SubstVar( const OUString& rVar ) -{ - // Don't work at parameter-string directly. Copy it. - OUString aWorkText = rVar; - - // Convert the returned path to system path! - BOOL bConvertLocal = FALSE; - - // Search for first occure of "$(...". - sal_Int32 nPosition = aWorkText.indexOf( SIGN_STARTVARIABLE ); // = first position of "$(" in string - sal_Int32 nLength = 0; // = count of letters from "$(" to ")" in string - - // Have we found any variable like "$(...)"? - if ( nPosition != STRPOS_NOTFOUND ) - { - // Yes; Get length of found variable. - // If no ")" was found - nLength is set to 0 by default! see before. - sal_Int32 nEndPosition = aWorkText.indexOf( SIGN_ENDVARIABLE, nPosition ); - if ( nEndPosition != STRPOS_NOTFOUND ) - nLength = nEndPosition - nPosition + 1; - } - - // Is there another path variable? - while ( ( nPosition != STRPOS_NOTFOUND ) && ( nLength > 0 ) ) - { - // YES; Get the next variable for replace. - OUString aReplacement; - OUString aSubString = aWorkText.copy( nPosition, nLength ); - aSubString = aSubString.toAsciiLowerCase(); - - // Look for special variable that needs a system path. - VarNameToEnumMap::const_iterator pIter = m_aMapVarNamesToEnum.find( aSubString ); - if ( pIter != m_aMapVarNamesToEnum.end() ) - bConvertLocal = TRUE; - - nPosition += nLength; - - // We must control index in string before call something at OUString! - // The OUString-implementation don't do it for us :-( but the result is not defined otherwise. - if ( nPosition + 1 > aWorkText.getLength() ) - { - // Position is out of range. Break loop! - nPosition = STRPOS_NOTFOUND; - nLength = 0; - } - else - { - // Else; Position is valid. Search for next variable. - nPosition = aWorkText.indexOf( SIGN_STARTVARIABLE, nPosition ); - // Have we found any variable like "$(...)"? - if ( nPosition != STRPOS_NOTFOUND ) - { - // Yes; Get length of found variable. If no ")" was found - nLength must set to 0! - nLength = 0; - sal_Int32 nEndPosition = aWorkText.indexOf( SIGN_ENDVARIABLE, nPosition ); - if ( nEndPosition != STRPOS_NOTFOUND ) - nLength = nEndPosition - nPosition + 1; - } - } - } - - aWorkText = m_xSubstVariables->substituteVariables( rVar, sal_False ); - - if ( bConvertLocal ) - { - // Convert the URL to a system path for special path variables - String aReturn; - utl::LocalFileHelper::ConvertURLToPhysicalName( aWorkText, aReturn ); - return aReturn; - } - - return aWorkText; -} - -// ----------------------------------------------------------------------- - -SvtPathOptions_Impl::SvtPathOptions_Impl() : - m_aPathArray( (sal_Int32)SvtPathOptions::PATH_COUNT ) -{ - Reference< XMultiServiceFactory > xSMgr = comphelper::getProcessServiceFactory(); - - // Create necessary services - m_xPathSettings = Reference< XFastPropertySet >( xSMgr->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.util.PathSettings" ))), - UNO_QUERY ); - if ( !m_xPathSettings.is() ) - { - // #112719#: check for existance - DBG_ERROR( "SvtPathOptions_Impl::SvtPathOptions_Impl(): #112719# happened again!" ); - throw RuntimeException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Service com.sun.star.util.PathSettings cannot be created" )), - Reference< XInterface >() ); - } - - m_xSubstVariables = Reference< XStringSubstitution >( xSMgr->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.util.PathSubstitution" ))), - UNO_QUERY ); - if ( !m_xSubstVariables.is() ) - { - // #112719#: check for existance - DBG_ERROR( "SvtPathOptions_Impl::SvtPathOptions_Impl(): #112719# happened again!" ); - throw RuntimeException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Service com.sun.star.util.PathSubstitution cannot be created" )), - Reference< XInterface >() ); - } - - // Create temporary hash map to have a mapping between property names and property handles - Reference< XPropertySet > xPropertySet = Reference< XPropertySet >( m_xPathSettings, UNO_QUERY ); - Reference< XPropertySetInfo > xPropSetInfo = xPropertySet->getPropertySetInfo(); - Sequence< Property > aPathPropSeq = xPropSetInfo->getProperties(); - - NameToHandleMap aTempHashMap; - for ( sal_Int32 n = 0; n < aPathPropSeq.getLength(); n++ ) - { - const com::sun::star::beans::Property& aProperty = aPathPropSeq[n]; - aTempHashMap.insert( NameToHandleMap::value_type( aProperty.Name, aProperty.Handle )); - } - - // Create mapping between internal enum (SvtPathOptions::Pathes) and property handle - sal_Int32 nCount = sizeof( aPropNames ) / sizeof( PropertyStruct ); - sal_Int32 i; - for ( i = 0; i < nCount; i++ ) - { - NameToHandleMap::const_iterator pIter = - aTempHashMap.find( rtl::OUString::createFromAscii( aPropNames[i].pPropName )); - - if ( pIter != aTempHashMap.end() ) - { - sal_Int32 nHandle = pIter->second; - sal_Int32 nEnum = aPropNames[i].ePath; - m_aMapEnumToPropHandle.insert( EnumToHandleMap::value_type( nEnum, nHandle )); - } - } - - // Create hash map for path variables that need a system path as a return value! - nCount = sizeof( aVarNameAttribute ) / sizeof( VarNameAttribute ); - for ( i = 0; i < nCount; i++ ) - { - m_aMapVarNamesToEnum.insert( VarNameToEnumMap::value_type( - OUString::createFromAscii( aVarNameAttribute[i].pVarName ), - aVarNameAttribute[i].eVarProperty )); - } - - // Set language type! - Any aLocale = ConfigManager::GetConfigManager()->GetDirectConfigProperty( ConfigManager::LOCALE ); - OUString aLocaleStr; - if ( aLocale >>= aLocaleStr ) - { - sal_Int32 nIndex = 0; - m_aLocale.Language = aLocaleStr.getToken(0, '-', nIndex ); - m_aLocale.Country = aLocaleStr.getToken(0, '-', nIndex ); - m_aLocale.Variant = aLocaleStr.getToken(0, '-', nIndex ); - } - else - { - DBG_ERRORFILE( "wrong any type" ); - m_aLocale.Language = OStringToOUString(OString("en"), RTL_TEXTENCODING_UTF8); - m_aLocale.Country = OStringToOUString(OString("US"), RTL_TEXTENCODING_UTF8); - m_aLocale.Variant = OStringToOUString(OString(""), RTL_TEXTENCODING_UTF8); - } -} - -// ----------------------------------------------------------------------- - -// class SvtPathOptions -------------------------------------------------- - -namespace { struct lclMutex : public rtl::Static< ::osl::Mutex, lclMutex > {}; } - -SvtPathOptions::SvtPathOptions() -{ - // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( lclMutex::get() ); - if ( !pOptions ) - { - pOptions = new SvtPathOptions_Impl; - ItemHolder1::holdConfigItem(E_PATHOPTIONS); - } - ++nRefCount; - pImp = pOptions; -} - -// ----------------------------------------------------------------------- - -SvtPathOptions::~SvtPathOptions() -{ - // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( lclMutex::get() ); - if ( !--nRefCount ) - { - DELETEZ( pOptions ); - } -} - -// ----------------------------------------------------------------------- - -const String& SvtPathOptions::GetAddinPath() const -{ - return pImp->GetAddinPath(); -} - -// ----------------------------------------------------------------------- - -const String& SvtPathOptions::GetAutoCorrectPath() const -{ - return pImp->GetAutoCorrectPath(); -} - -// ----------------------------------------------------------------------- - -const String& SvtPathOptions::GetAutoTextPath() const -{ - return pImp->GetAutoTextPath(); -} - -// ----------------------------------------------------------------------- - -const String& SvtPathOptions::GetBackupPath() const -{ - return pImp->GetBackupPath(); -} - -// ----------------------------------------------------------------------- - -const String& SvtPathOptions::GetBasicPath() const -{ - return pImp->GetBasicPath(); -} - -// ----------------------------------------------------------------------- - -const String& SvtPathOptions::GetBitmapPath() const -{ - return pImp->GetBitmapPath(); -} - -// ----------------------------------------------------------------------- - -const String& SvtPathOptions::GetConfigPath() const -{ - return pImp->GetConfigPath(); -} - -// ----------------------------------------------------------------------- - -const String& SvtPathOptions::GetDictionaryPath() const -{ - return pImp->GetDictionaryPath(); -} - -// ----------------------------------------------------------------------- - -const String& SvtPathOptions::GetFavoritesPath() const -{ - return pImp->GetFavoritesPath(); -} - -// ----------------------------------------------------------------------- - -const String& SvtPathOptions::GetFilterPath() const -{ - return pImp->GetFilterPath(); -} - -// ----------------------------------------------------------------------- - -const String& SvtPathOptions::GetGalleryPath() const -{ - return pImp->GetGalleryPath(); -} - -// ----------------------------------------------------------------------- - -const String& SvtPathOptions::GetGraphicPath() const -{ - return pImp->GetGraphicPath(); -} - -// ----------------------------------------------------------------------- - -const String& SvtPathOptions::GetHelpPath() const -{ - return pImp->GetHelpPath(); -} - -// ----------------------------------------------------------------------- - -const String& SvtPathOptions::GetLinguisticPath() const -{ - return pImp->GetLinguisticPath(); -} - -// ----------------------------------------------------------------------- - -const String& SvtPathOptions::GetFingerprintPath() const -{ - return pImp->GetFingerprintPath(); -} - -// ----------------------------------------------------------------------- - -const String& SvtPathOptions::GetModulePath() const -{ - return pImp->GetModulePath(); -} - -// ----------------------------------------------------------------------- - -const String& SvtPathOptions::GetPalettePath() const -{ - return pImp->GetPalettePath(); -} - -// ----------------------------------------------------------------------- - -const String& SvtPathOptions::GetPluginPath() const -{ - return pImp->GetPluginPath(); -} - -// ----------------------------------------------------------------------- - -const String& SvtPathOptions::GetStoragePath() const -{ - return pImp->GetStoragePath(); -} - -// ----------------------------------------------------------------------- - -const String& SvtPathOptions::GetTempPath() const -{ - return pImp->GetTempPath(); -} - -// ----------------------------------------------------------------------- - -const String& SvtPathOptions::GetTemplatePath() const -{ - return pImp->GetTemplatePath(); -} - -// ----------------------------------------------------------------------- - -const String& SvtPathOptions::GetUserConfigPath() const -{ - return pImp->GetUserConfigPath(); -} - -const String& SvtPathOptions::GetUIConfigPath() const -{ - return pImp->GetUIConfigPath(); -} - -// ----------------------------------------------------------------------- - -const String& SvtPathOptions::GetWorkPath() const -{ - return pImp->GetWorkPath(); -} - -// ----------------------------------------------------------------------- - -void SvtPathOptions::SetAddinPath( const String& rPath ) -{ - pImp->SetAddinPath( rPath ); -} - -// ----------------------------------------------------------------------- - -void SvtPathOptions::SetAutoCorrectPath( const String& rPath ) -{ - pImp->SetAutoCorrectPath( rPath ); -} - -// ----------------------------------------------------------------------- - -void SvtPathOptions::SetAutoTextPath( const String& rPath ) -{ - pImp->SetAutoTextPath( rPath ); -} - -// ----------------------------------------------------------------------- - -void SvtPathOptions::SetBackupPath( const String& rPath ) -{ - pImp->SetBackupPath( rPath ); -} - -// ----------------------------------------------------------------------- - -void SvtPathOptions::SetBasicPath( const String& rPath ) -{ - pImp->SetBasicPath( rPath ); -} - -// ----------------------------------------------------------------------- - -void SvtPathOptions::SetBitmapPath( const String& rPath ) -{ - pImp->SetBitmapPath( rPath ); -} - -// ----------------------------------------------------------------------- - -void SvtPathOptions::SetConfigPath( const String& rPath ) -{ - pImp->SetConfigPath( rPath ); -} - -// ----------------------------------------------------------------------- - -void SvtPathOptions::SetDictionaryPath( const String& rPath ) -{ - pImp->SetDictionaryPath( rPath ); -} - -// ----------------------------------------------------------------------- - -void SvtPathOptions::SetFavoritesPath( const String& rPath ) -{ - pImp->SetFavoritesPath( rPath ); -} - -// ----------------------------------------------------------------------- - -void SvtPathOptions::SetFilterPath( const String& rPath ) -{ - pImp->SetFilterPath( rPath ); -} - -// ----------------------------------------------------------------------- - -void SvtPathOptions::SetGalleryPath( const String& rPath ) -{ - pImp->SetGalleryPath( rPath ); -} - -// ----------------------------------------------------------------------- - -void SvtPathOptions::SetGraphicPath( const String& rPath ) -{ - pImp->SetGraphicPath( rPath ); -} - -// ----------------------------------------------------------------------- - -void SvtPathOptions::SetHelpPath( const String& rPath ) -{ - pImp->SetHelpPath( rPath ); -} - -// ----------------------------------------------------------------------- - -void SvtPathOptions::SetLinguisticPath( const String& rPath ) -{ - pImp->SetLinguisticPath( rPath ); -} - -// ----------------------------------------------------------------------- - -void SvtPathOptions::SetModulePath( const String& rPath ) -{ - pImp->SetModulePath( rPath ); -} - -// ----------------------------------------------------------------------- - -void SvtPathOptions::SetPalettePath( const String& rPath ) -{ - pImp->SetPalettePath( rPath ); -} - -// ----------------------------------------------------------------------- - -void SvtPathOptions::SetPluginPath( const String& rPath ) -{ - pImp->SetPluginPath( rPath ); -} - -// ----------------------------------------------------------------------- - -void SvtPathOptions::SetStoragePath( const String& rPath ) -{ - pImp->SetStoragePath( rPath ); -} - -// ----------------------------------------------------------------------- - -void SvtPathOptions::SetTempPath( const String& rPath ) -{ - pImp->SetTempPath( rPath ); -} - -// ----------------------------------------------------------------------- - -void SvtPathOptions::SetTemplatePath( const String& rPath ) -{ - pImp->SetTemplatePath( rPath ); -} - -// ----------------------------------------------------------------------- - -void SvtPathOptions::SetUserConfigPath( const String& rPath ) -{ - pImp->SetUserConfigPath( rPath ); -} - -// ----------------------------------------------------------------------- - -void SvtPathOptions::SetWorkPath( const String& rPath ) -{ - pImp->SetWorkPath( rPath ); -} - -// ----------------------------------------------------------------------- - -String SvtPathOptions::SubstituteVariable( const String& rVar ) -{ - String aRet = pImp->SubstituteAndConvert( rVar ); - return aRet; -} - -String SvtPathOptions::UseVariable( const String& rPath ) -{ - String aRet = pImp->UsePathVariables( rPath ); - return aRet; -} - -// ----------------------------------------------------------------------- - -sal_Bool SvtPathOptions::SearchFile( String& rIniFile, Pathes ePath ) -{ - // check parameter: empty inifile name? - if ( !rIniFile.Len() ) - { - DBG_ERRORFILE( "SvtPathOptions::SearchFile(): invalid parameter" ); - return sal_False; - } - - String aIniFile = pImp->SubstVar( rIniFile ); - sal_Bool bRet = sal_False; - - switch ( ePath ) - { - case PATH_USERCONFIG: - { - // path is a URL - bRet = sal_True; - INetURLObject aObj( GetUserConfigPath() ); - xub_StrLen i, nCount = aIniFile.GetTokenCount( '/' ); - for ( i = 0; i < nCount; ++i ) - aObj.insertName( aIniFile.GetToken( i, '/' ) ); - - if ( !::utl::UCBContentHelper::Exists( aObj.GetMainURL( INetURLObject::NO_DECODE ) ) ) - { - aObj.SetSmartURL( GetConfigPath() ); - aObj.insertName( aIniFile ); - bRet = ::utl::UCBContentHelper::Exists( aObj.GetMainURL( INetURLObject::NO_DECODE ) ); - } - - if ( bRet ) - rIniFile = aObj.GetMainURL( INetURLObject::NO_DECODE ); - - break; - } - - default: - { - String aPath; - switch ( ePath ) - { - case PATH_ADDIN: aPath = GetAddinPath(); break; - case PATH_AUTOCORRECT: aPath = GetAutoCorrectPath(); break; - case PATH_AUTOTEXT: aPath = GetAutoTextPath(); break; - case PATH_BACKUP: aPath = GetBackupPath(); break; - case PATH_BASIC: aPath = GetBasicPath(); break; - case PATH_BITMAP: aPath = GetBitmapPath(); break; - case PATH_CONFIG: aPath = GetConfigPath(); break; - case PATH_DICTIONARY: aPath = GetDictionaryPath(); break; - case PATH_FAVORITES: aPath = GetFavoritesPath(); break; - case PATH_FILTER: aPath = GetFilterPath(); break; - case PATH_GALLERY: aPath = GetGalleryPath(); break; - case PATH_GRAPHIC: aPath = GetGraphicPath(); break; - case PATH_HELP: aPath = GetHelpPath(); break; - case PATH_LINGUISTIC: aPath = GetLinguisticPath(); break; - case PATH_MODULE: aPath = GetModulePath(); break; - case PATH_PALETTE: aPath = GetPalettePath(); break; - case PATH_PLUGIN: aPath = GetPluginPath(); break; - case PATH_STORAGE: aPath = GetStoragePath(); break; - case PATH_TEMP: aPath = GetTempPath(); break; - case PATH_TEMPLATE: aPath = GetTemplatePath(); break; - case PATH_WORK: aPath = GetWorkPath(); break; - case PATH_UICONFIG: aPath = GetUIConfigPath(); break; - case PATH_FINGERPRINT: aPath = GetFingerprintPath(); break; - case PATH_USERCONFIG:/*-Wall???*/ break; - case PATH_COUNT: /*-Wall???*/ break; - } - - sal_uInt16 j, nIdx = 0, nTokenCount = aPath.GetTokenCount( SEARCHPATH_DELIMITER ); - for ( j = 0; j < nTokenCount; ++j ) - { - BOOL bIsURL = TRUE; - String aPathToken = aPath.GetToken( 0, SEARCHPATH_DELIMITER, nIdx ); - INetURLObject aObj( aPathToken ); - if ( aObj.HasError() ) - { - bIsURL = FALSE; - String aURL; - if ( LocalFileHelper::ConvertPhysicalNameToURL( aPathToken, aURL ) ) - aObj.SetURL( aURL ); - } - - xub_StrLen i, nCount = aIniFile.GetTokenCount( '/' ); - for ( i = 0; i < nCount; ++i ) - aObj.insertName( aIniFile.GetToken( i, '/' ) ); - bRet = ::utl::UCBContentHelper::Exists( aObj.GetMainURL( INetURLObject::NO_DECODE ) ); - - if ( bRet ) - { - if ( !bIsURL ) - ::utl::LocalFileHelper::ConvertURLToPhysicalName( - aObj.GetMainURL( INetURLObject::NO_DECODE ), rIniFile ); - else - rIniFile = aObj.GetMainURL( INetURLObject::NO_DECODE ); - break; - } - } - } - } - - return bRet; -} - -// ----------------------------------------------------------------------- - -::com::sun::star::lang::Locale SvtPathOptions::GetLocale() const -{ - return pImp->GetLocale(); -} -// ----------------------------------------------------------------------- -BOOL SvtPathOptions::IsPathReadonly(Pathes ePath)const -{ - return pImp->IsPathReadonly(ePath); -} -// ----------------------------------------------------------------------- -const String& SvtPathOptions::GetPath(Pathes ePath)const -{ - return pImp->GetPath(ePath); -} -// ----------------------------------------------------------------------- -void SvtPathOptions::SetPath( SvtPathOptions::Pathes ePath, const String& rNewPath ) -{ - pImp->SetPath(ePath, rNewPath); -} - -// class PathService ----------------------------------------------------- -#include -#include -#include - -class PathService : public ::cppu::WeakImplHelper2< ::com::sun::star::frame::XConfigManager, ::com::sun::star::lang::XServiceInfo > -{ - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL - getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL substituteVariables( const ::rtl::OUString& sText ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& sKeyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& sKeyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL flush( ) throw(::com::sun::star::uno::RuntimeException); -}; - -// class PathService ----------------------------------------------------- - -void SAL_CALL PathService::addPropertyChangeListener( const ::rtl::OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& ) throw(::com::sun::star::uno::RuntimeException) {} -void SAL_CALL PathService::removePropertyChangeListener( const ::rtl::OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& ) throw(::com::sun::star::uno::RuntimeException) {} -void SAL_CALL PathService::flush( ) throw(::com::sun::star::uno::RuntimeException) {} - -::rtl::OUString SAL_CALL PathService::substituteVariables( const ::rtl::OUString& sText ) throw(::com::sun::star::uno::RuntimeException) -{ - return SvtPathOptions().SubstituteVariable( sText ); -} - -::rtl::OUString SAL_CALL PathService::getImplementationName( ) throw(::com::sun::star::uno::RuntimeException) -{ - return OUString::createFromAscii("com.sun.star.comp.svtools.PathService"); -} - -sal_Bool SAL_CALL PathService::supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException) -{ - if ( ServiceName.compareToAscii("com.sun.star.config.SpecialConfigManager") == COMPARE_EQUAL ) - return sal_True; - else - return sal_False; -} - -::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL PathService::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) -{ - Sequence< OUString > aRet(1); - *aRet.getArray() = OUString::createFromAscii("com.sun.star.config.SpecialConfigManager"); - return aRet; -} diff --git a/svtools/source/config/printoptions.cxx b/svtools/source/config/printoptions.cxx index 0f54366c47f6..dcaa3b7d1bb3 100644 --- a/svtools/source/config/printoptions.cxx +++ b/svtools/source/config/printoptions.cxx @@ -73,7 +73,7 @@ #endif #ifndef _SVT_LOGHELPER_HXX -#include +#include #endif #include diff --git a/svtools/source/config/printwarningoptions.cxx b/svtools/source/config/printwarningoptions.cxx deleted file mode 100644 index c2dfe94b0a2b..000000000000 --- a/svtools/source/config/printwarningoptions.cxx +++ /dev/null @@ -1,419 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: printwarningoptions.cxx,v $ - * $Revision: 1.8 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include -#include -#include -#include -#include -#include - -#include - -//_________________________________________________________________________________________________________________ -// namespaces -//_________________________________________________________________________________________________________________ - -using namespace ::utl ; -using namespace ::rtl ; -using namespace ::osl ; -using namespace ::com::sun::star::uno ; - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -#define ROOTNODE_START OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Print")) - -#define PROPERTYNAME_PAPERSIZE OUString(RTL_CONSTASCII_USTRINGPARAM("Warning/PaperSize")) -#define PROPERTYNAME_PAPERORIENTATION OUString(RTL_CONSTASCII_USTRINGPARAM("Warning/PaperOrientation")) -#define PROPERTYNAME_NOTFOUND OUString(RTL_CONSTASCII_USTRINGPARAM("Warning/NotFound")) -#define PROPERTYNAME_TRANSPARENCY OUString(RTL_CONSTASCII_USTRINGPARAM("Warning/Transparency")) -#define PROPERTYNAME_PRINTINGMODIFIESDOCUMENT OUString(RTL_CONSTASCII_USTRINGPARAM("PrintingModifiesDocument")) - -#define PROPERTYHANDLE_PAPERSIZE 0 -#define PROPERTYHANDLE_PAPERORIENTATION 1 -#define PROPERTYHANDLE_NOTFOUND 2 -#define PROPERTYHANDLE_TRANSPARENCY 3 -#define PROPERTYHDL_PRINTINGMODIFIESDOCUMENT 4 - -#define PROPERTYCOUNT 5 - -class SvtPrintWarningOptions_Impl : public ConfigItem -{ -public: - -//--------------------------------------------------------------------------------------------------------- -// constructor / destructor -//--------------------------------------------------------------------------------------------------------- - - SvtPrintWarningOptions_Impl(); - ~SvtPrintWarningOptions_Impl(); - -//--------------------------------------------------------------------------------------------------------- -// overloaded methods of baseclass -//--------------------------------------------------------------------------------------------------------- - - virtual void Commit(); - -//--------------------------------------------------------------------------------------------------------- -// public interface -//--------------------------------------------------------------------------------------------------------- - - sal_Bool IsPaperSize() const { return m_bPaperSize; } - sal_Bool IsPaperOrientation() const { return m_bPaperOrientation; } - sal_Bool IsNotFound() const { return m_bNotFound; } - sal_Bool IsTransparency() const { return m_bTransparency; } - sal_Bool IsModifyDocumentOnPrintingAllowed() const { return m_bModifyDocumentOnPrintingAllowed; } - - void SetPaperSize( sal_Bool bState ) { m_bPaperSize = bState; SetModified(); } - void SetPaperOrientation( sal_Bool bState ) { m_bPaperOrientation = bState; SetModified(); } - void SetNotFound( sal_Bool bState ) { m_bNotFound = bState; SetModified(); } - void SetTransparency( sal_Bool bState ) { m_bTransparency = bState; SetModified(); } - void SetModifyDocumentOnPrintingAllowed( sal_Bool bState ) { m_bModifyDocumentOnPrintingAllowed = bState; SetModified(); } - -//------------------------------------------------------------------------------------------------------------- -// private methods -//------------------------------------------------------------------------------------------------------------- - -private: - - static Sequence< OUString > impl_GetPropertyNames(); - -//------------------------------------------------------------------------------------------------------------- -// private member -//------------------------------------------------------------------------------------------------------------- - -private: - - sal_Bool m_bPaperSize; - sal_Bool m_bPaperOrientation; - sal_Bool m_bNotFound; - sal_Bool m_bTransparency; - sal_Bool m_bModifyDocumentOnPrintingAllowed; -}; - -//_________________________________________________________________________________________________________________ -// definitions -//_________________________________________________________________________________________________________________ - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtPrintWarningOptions_Impl::SvtPrintWarningOptions_Impl() : - ConfigItem( ROOTNODE_START ), - m_bPaperSize( sal_False ), - m_bPaperOrientation( sal_False ), - m_bNotFound( sal_False ), - m_bTransparency( sal_True ), - m_bModifyDocumentOnPrintingAllowed( sal_True ) -{ - Sequence< OUString > seqNames( impl_GetPropertyNames() ); - Sequence< Any > seqValues( GetProperties( seqNames ) ); - - DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtPrintWarningOptions_Impl::SvtPrintWarningOptions_Impl()\nI miss some values of configuration keys!\n" ); - - // Copy values from list in right order to our internal member. - sal_Int32 nPropertyCount = seqValues.getLength(); - sal_Int32 nProperty = 0; - - for( nProperty=0; nProperty>= m_bPaperSize; - } - break; - - case PROPERTYHANDLE_PAPERORIENTATION: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" ); - seqValues[nProperty] >>= m_bPaperOrientation; - } - break; - - case PROPERTYHANDLE_NOTFOUND: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" ); - seqValues[nProperty] >>= m_bNotFound; - } - break; - - case PROPERTYHANDLE_TRANSPARENCY: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" ); - seqValues[nProperty] >>= m_bTransparency; - } - break; - case PROPERTYHDL_PRINTINGMODIFIESDOCUMENT: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" ); - seqValues[nProperty] >>= m_bModifyDocumentOnPrintingAllowed; - } - break; - - } - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtPrintWarningOptions_Impl::~SvtPrintWarningOptions_Impl() -{ - if( IsModified() ) - Commit(); -} - -//***************************************************************************************************************** -// Commit -//***************************************************************************************************************** -void SvtPrintWarningOptions_Impl::Commit() -{ - Sequence< OUString > aSeqNames( impl_GetPropertyNames() ); - Sequence< Any > aSeqValues( aSeqNames.getLength() ); - - for( sal_Int32 nProperty = 0, nCount = aSeqNames.getLength(); nProperty < nCount; ++nProperty ) - { - switch( nProperty ) - { - case PROPERTYHANDLE_PAPERSIZE: - aSeqValues[nProperty] <<= m_bPaperSize; - break; - - case PROPERTYHANDLE_PAPERORIENTATION: - aSeqValues[nProperty] <<= m_bPaperOrientation; - break; - - case PROPERTYHANDLE_NOTFOUND: - aSeqValues[nProperty] <<= m_bNotFound; - break; - - case PROPERTYHANDLE_TRANSPARENCY: - aSeqValues[nProperty] <<= m_bTransparency; - break; - case PROPERTYHDL_PRINTINGMODIFIESDOCUMENT: - aSeqValues[nProperty] <<= m_bModifyDocumentOnPrintingAllowed; - break; - } - } - - PutProperties( aSeqNames, aSeqValues ); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Sequence< OUString > SvtPrintWarningOptions_Impl::impl_GetPropertyNames() -{ - // Build static list of configuration key names. - static const OUString pProperties[] = - { - PROPERTYNAME_PAPERSIZE, - PROPERTYNAME_PAPERORIENTATION, - PROPERTYNAME_NOTFOUND, - PROPERTYNAME_TRANSPARENCY, - PROPERTYNAME_PRINTINGMODIFIESDOCUMENT - }; - - // Initialize return sequence with these list ... - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); - - return seqPropertyNames; -} - -//***************************************************************************************************************** -// initialize static member -// DON'T DO IT IN YOUR HEADER! -// see definition for further informations -//***************************************************************************************************************** -SvtPrintWarningOptions_Impl* SvtPrintWarningOptions::m_pDataContainer = NULL; -sal_Int32 SvtPrintWarningOptions::m_nRefCount = 0; - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtPrintWarningOptions::SvtPrintWarningOptions() -{ - // Global access, must be guarded (multithreading!). - MutexGuard aGuard( GetOwnStaticMutex() ); - // Increase ouer refcount ... - ++m_nRefCount; - // ... and initialize ouer data container only if it not already! - if( m_pDataContainer == NULL ) - { - m_pDataContainer = new SvtPrintWarningOptions_Impl(); - ItemHolder1::holdConfigItem(E_PRINTWARNINGOPTIONS); - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtPrintWarningOptions::~SvtPrintWarningOptions() -{ - // Global access, must be guarded (multithreading!) - MutexGuard aGuard( GetOwnStaticMutex() ); - // Decrease ouer refcount. - --m_nRefCount; - // If last instance was deleted ... - // we must destroy ouer static data container! - if( m_nRefCount <= 0 ) - { - delete m_pDataContainer; - m_pDataContainer = NULL; - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtPrintWarningOptions::IsPaperSize() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsPaperSize(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtPrintWarningOptions::IsPaperOrientation() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsPaperOrientation(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtPrintWarningOptions::IsNotFound() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsNotFound(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtPrintWarningOptions::IsTransparency() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsTransparency(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtPrintWarningOptions::SetPaperSize( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetPaperSize( bState ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtPrintWarningOptions::SetPaperOrientation( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetPaperOrientation( bState ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtPrintWarningOptions::SetNotFound( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetNotFound( bState ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtPrintWarningOptions::SetTransparency( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetTransparency( bState ); -} -// ----------------------------------------------------------------------------- - -sal_Bool SvtPrintWarningOptions::IsModifyDocumentOnPrintingAllowed() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsModifyDocumentOnPrintingAllowed(); -} - -// ----------------------------------------------------------------------------- - -void SvtPrintWarningOptions::SetModifyDocumentOnPrintingAllowed( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetModifyDocumentOnPrintingAllowed( bState ) ; -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Mutex& SvtPrintWarningOptions::GetOwnStaticMutex() -{ - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; -} diff --git a/svtools/source/config/regoptions.cxx b/svtools/source/config/regoptions.cxx deleted file mode 100644 index 7c94807f2c25..000000000000 --- a/svtools/source/config/regoptions.cxx +++ /dev/null @@ -1,554 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: regoptions.cxx,v $ - * $Revision: 1.8 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include "regoptions.hxx" -#include -#include -#include -#include -#include -#include - -//........................................................................ -namespace svt -{ -//........................................................................ - - using namespace ::utl; - using namespace ::com::sun::star::uno; - - //==================================================================== - //= local helpers - //==================================================================== - //-------------------------------------------------------------------- - /** converts a string representation of a date into a integer representation -

No semantic check is made, i.e. if the string describes the 40.12, this is not recognized. In opposite, - the string must have a valid structure (DD.MM.YYYY).

- @return - the integer representation of the date which can be used with the Date class, - or 0 if the given string was no valid date representation - */ - static sal_Int32 lcl_convertString2Date( const ::rtl::OUString& _rStringRep ) - { - sal_Int32 nDateIntRep = 0; - if ( _rStringRep.getLength() == 2 + 1 + 2 + 1 + 4 ) // DD.MM.YYYY - { - // validate the string - sal_Bool bValid = sal_True; - - const sal_Unicode* pStringRep = _rStringRep.getStr(); - sal_Int32 nLen = _rStringRep.getLength(); - for ( sal_Int32 nPos = 0; - bValid && ( nPos < nLen ); - ++nPos, ++pStringRep - ) - { - if ( ( 2 == nPos ) || ( 5 == nPos ) ) - bValid = '.' == *pStringRep; // the number separators - else - bValid = ( *pStringRep >= '0' ) && ( *pStringRep <= '9' ); - } - - // passed the test? - if ( bValid ) - { - Date aDate; - aDate.SetDay ( (USHORT)_rStringRep.copy( 0, 2 ).toInt32( ) ); - aDate.SetMonth ( (USHORT)_rStringRep.copy( 3, 2 ).toInt32( ) ); - aDate.SetYear ( (USHORT)_rStringRep.copy( 6, 4 ).toInt32( ) ); - nDateIntRep = aDate.GetDate(); - } - } - - return nDateIntRep; - } - - //-------------------------------------------------------------------- - static const ::rtl::OUString& lcl_fillToken( const sal_Int32 /* [in] */ _nToken, const sal_Int16 /* [in] */ _nDigits, ::rtl::OUString& /* [out] */ _rToken ) - { - // convert into string - ::rtl::OUString sLeanToken = ::rtl::OUString::valueOf( _nToken ); - // check length - if ( sLeanToken.getLength() < _nDigits ) - { // fill - OSL_ENSURE( _nDigits <= 4, "lcl_fillToken: invalid digit number!" ); - _rToken = ::rtl::OUString( "0000", _nDigits - sLeanToken.getLength(), RTL_TEXTENCODING_ASCII_US ); - _rToken += sLeanToken; - } - else - _rToken = sLeanToken; - - return _rToken; - } - - //-------------------------------------------------------------------- - /** converts a integer representation of a date into a string representation - */ - static ::rtl::OUString lcl_ConvertDate2String( const Date& _rDate ) - { - OSL_ENSURE( _rDate.IsValid(), "lcl_ConvertDate2String: invalid integer representation!" ); - - sal_Unicode cSeparator( '.' ); - ::rtl::OUString sSeparator( &cSeparator, 1 ); - - ::rtl::OUString sStringRep; - ::rtl::OUString sToken; - sStringRep += lcl_fillToken( (sal_Int32)_rDate.GetDay(), 2, sToken ); - sStringRep += sSeparator; - sStringRep += lcl_fillToken( (sal_Int32)_rDate.GetMonth(), 2, sToken ); - sStringRep += sSeparator; - sStringRep += lcl_fillToken( (sal_Int32)_rDate.GetYear(), 4, sToken ); - - return sStringRep; - } - - //-------------------------------------------------------------------- - /// checks whether a given trigger date is reached (i.e. is _before_ the current date) - static sal_Bool lcl_reachedTriggerDate( const Date& _rTriggerDate ) - { - return _rTriggerDate <= Date(); - } - - //-------------------------------------------------------------------- - #define DECLARE_STATIC_LAZY_USTRING( name ) \ - static const ::rtl::OUString& lcl_get##name##Name() \ - { \ - static const ::rtl::OUString sName = ::rtl::OUString::createFromAscii( #name ); \ - return sName; \ - } - - DECLARE_STATIC_LAZY_USTRING( ReminderDate ); - DECLARE_STATIC_LAZY_USTRING( RequestDialog ); - DECLARE_STATIC_LAZY_USTRING( ShowMenuItem ); - DECLARE_STATIC_LAZY_USTRING( Patch ); - - //==================================================================== - //= RegOptionsImpl - //==================================================================== - class RegOptionsImpl - { - private: - OConfigurationTreeRoot m_aRegistrationNode; // the configuration node we need to access our persistent data - - String m_sRegistrationURL; // the URL to use when doing an online registration - Date m_aReminderDate; // the reminder date as found in the configuration - sal_Int32 m_nDialogCounter; // the dialog counter - see getDialogPermission - sal_Bool m_bShowMenuItem; // the flag indicating if the registration menu item is allowed - - static RegOptionsImpl* s_pSingleInstance; // the one and only instance of this class - static sal_Int32 s_nInstanceCount; // reference counter for the instances - static sal_Bool s_bThisSessionDone; // the flag indicating if for this session, everything beeing relevant has already been done - - private: - RegOptionsImpl( ); - - static ::osl::Mutex& getStaticMutex(); // get the mutex used to protect the static members of this class - - void commit( ); - sal_Int32 getBuildId() const; - - private: - RegOptions::DialogPermission implGetDialogPermission( ) const; - - public: - static RegOptionsImpl* registerClient( ); - static void revokeClient( ); - - inline sal_Bool hasURL( ) const { return ( 0 != m_sRegistrationURL.Len() ); } - inline sal_Bool allowMenu( ) const { return hasURL() && m_bShowMenuItem; } - inline String getRegistrationURL( ) const { return m_sRegistrationURL; } - - RegOptions::DialogPermission getDialogPermission( ) const; - void markSessionDone( ); - void activateReminder( sal_Int32 _nDaysFromNow ); - void removeReminder(); - bool hasReminderDateCome() const; - }; - - //-------------------------------------------------------------------- - RegOptionsImpl* RegOptionsImpl::s_pSingleInstance = NULL; - sal_Bool RegOptionsImpl::s_bThisSessionDone = sal_False; - sal_Int32 RegOptionsImpl::s_nInstanceCount = 0; - - //-------------------------------------------------------------------- - ::osl::Mutex& RegOptionsImpl::getStaticMutex() - { - static ::osl::Mutex* s_pStaticMutex = NULL; - if ( !s_pStaticMutex ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !s_pStaticMutex ) - { - static ::osl::Mutex s_aStaticMutex; - s_pStaticMutex = &s_aStaticMutex; - } - } - return *s_pStaticMutex; - } - - //-------------------------------------------------------------------- - void RegOptionsImpl::commit( ) - { - m_aRegistrationNode.commit( ); - } - - //-------------------------------------------------------------------- - RegOptionsImpl* RegOptionsImpl::registerClient( ) - { - ::osl::MutexGuard aGuard( getStaticMutex() ); - - if ( !s_pSingleInstance ) - s_pSingleInstance = new RegOptionsImpl; - - ++s_nInstanceCount; - return s_pSingleInstance; - } - - //-------------------------------------------------------------------- - void RegOptionsImpl::revokeClient( ) - { - ::osl::MutexGuard aGuard( getStaticMutex() ); - OSL_ENSURE( s_nInstanceCount, "RegOptionsImpl::revokeClient: there are no clients alive!" ); - OSL_ENSURE( s_pSingleInstance || !s_nInstanceCount, "RegOptionsImpl::revokeClient: invalid instance pointer!" ); - - if ( s_nInstanceCount ) - { - if ( s_pSingleInstance ) - // commit the changes done by this client - s_pSingleInstance->commit(); - - if ( 0 == --s_nInstanceCount ) - { - delete s_pSingleInstance; - s_pSingleInstance = NULL; - } - } - } - - //-------------------------------------------------------------------- - RegOptionsImpl::RegOptionsImpl( ) - :m_nDialogCounter ( 0 ) - ,m_bShowMenuItem ( sal_False ) - { - // create the config node for all our registration information - m_aRegistrationNode = OConfigurationTreeRoot::createWithServiceFactory( - ::comphelper::getProcessServiceFactory(), - ::rtl::OUString::createFromAscii( "/org.openoffice.Office.Common/Help/Registration" ) - ); - - // cache some data - //the URL to use for online registration - ::rtl::OUString sStringValue; - m_aRegistrationNode.getNodeValue( ::rtl::OUString::createFromAscii( "URL" ) ) >>= sStringValue; - m_sRegistrationURL = sStringValue; - - // the state of the dialog - m_aRegistrationNode.getNodeValue( lcl_getRequestDialogName() ) >>= m_nDialogCounter; - - // the flag for showing the menu item - sal_Bool bBoolValue = sal_False; - m_aRegistrationNode.getNodeValue( lcl_getShowMenuItemName() ) >>= bBoolValue; - m_bShowMenuItem = bBoolValue; - - // the reminder date (if any) - sal_Int32 nIntDate = 0; - sStringValue = ::rtl::OUString(); - m_aRegistrationNode.getNodeValue( lcl_getReminderDateName() ) >>= sStringValue; - bool bIsPatchDate = ( sStringValue.equals( lcl_getPatchName() ) != sal_False ); - if ( !bIsPatchDate && sStringValue.getLength() ) - nIntDate = lcl_convertString2Date( sStringValue ); - m_aReminderDate.SetDate( nIntDate ); - } - - //-------------------------------------------------------------------- - RegOptions::DialogPermission RegOptionsImpl::implGetDialogPermission( ) const - { - RegOptions::DialogPermission eResult = RegOptions::dpDisabled; - // no URL or a counter already decreased to zero means the dialog is disabled - if ( hasURL() && ( m_nDialogCounter > 0 ) ) - { - // during every session, the counter will be decreased - // If it reaches zero, the dialog shall be executed - if ( 1 == m_nDialogCounter ) - { - if ( m_aReminderDate.IsValid( ) ) - { // valid reminder date - // assume remind later - eResult = RegOptions::dpRemindLater; - // and check if we reached the reminder date - if ( lcl_reachedTriggerDate( m_aReminderDate ) ) - eResult = RegOptions::dpThisSession; - } - else - eResult = RegOptions::dpThisSession; // execute in this session - } - else - eResult = RegOptions::dpNotThisSession; // first trigger session not reached - - // a last check .... - if ( ( s_bThisSessionDone ) // this session is already marked as "done" - && ( RegOptions::dpThisSession == eResult )// but without this, the state would be "now" - ) - eResult = RegOptions::dpDisabled; // -> change state to "disabled" - } - - return eResult; - } - - //-------------------------------------------------------------------- - RegOptions::DialogPermission RegOptionsImpl::getDialogPermission( ) const - { - OSL_ENSURE( !s_bThisSessionDone, "RegOptionsImpl::getDialogPermission: should never be asked in this session, again!" ); - // Somebody already marked this session as "everything relevant happened". So why sombody (else?) asks - // me again? - - return implGetDialogPermission( ); - } - - //-------------------------------------------------------------------- - void RegOptionsImpl::activateReminder( sal_Int32 _nDaysFromNow ) - { - OSL_ENSURE( s_bThisSessionDone || ( implGetDialogPermission( ) != RegOptions::dpDisabled ), "RegOptionsImpl::activateReminder: invalid call!" ); - OSL_ENSURE( _nDaysFromNow > 0, "RegOptionsImpl::activateReminder: invalid argument!" ); - - // calc the reminder - m_aReminderDate = Date() + _nDaysFromNow; // today (default ctor) + days - - // remember the date - m_aRegistrationNode.setNodeValue( - lcl_getReminderDateName(), - makeAny( lcl_ConvertDate2String( m_aReminderDate ) ) - ); - // to be on the save side, write the counter - m_aRegistrationNode.setNodeValue( - lcl_getRequestDialogName(), - makeAny( (sal_Int32)1 ) - ); - - // mark this session as done - if ( !s_bThisSessionDone ) - markSessionDone( ); - } - - //-------------------------------------------------------------------- - void RegOptionsImpl::removeReminder() - { - ::rtl::OUString aDefault; - ::rtl::OUString aReminderValue( lcl_getPatchName() ); - aReminderValue += ::rtl::OUString::valueOf(getBuildId()); - - m_aRegistrationNode.setNodeValue( - lcl_getReminderDateName(), - Any( aReminderValue ) - ); - } - - //-------------------------------------------------------------------- - sal_Int32 RegOptionsImpl::getBuildId() const - { - sal_Int32 nBuildId( 0 ); - ::rtl::OUString aDefault; - ::rtl::OUString aBuildIdData = utl::Bootstrap::getBuildIdData( aDefault ); - sal_Int32 nIndex1 = aBuildIdData.indexOf(':'); - sal_Int32 nIndex2 = aBuildIdData.indexOf(')'); - if (( nIndex1 > 0 ) && ( nIndex2 > 0 ) && ( nIndex2-1 > nIndex1+1 )) - { - ::rtl::OUString aBuildId = aBuildIdData.copy( nIndex1+1, nIndex2-nIndex1-1 ); - nBuildId = aBuildId.toInt32(); - } - - return nBuildId; - } - - //-------------------------------------------------------------------- - bool RegOptionsImpl::hasReminderDateCome() const - { - bool bRet = false; - sal_Int32 nDate = 0; - ::rtl::OUString sDate; - m_aRegistrationNode.getNodeValue( lcl_getReminderDateName() ) >>= sDate; - if ( sDate.getLength() ) - { - if ( sDate.indexOf( lcl_getPatchName() ) == 0) - { - if (sDate.equals( lcl_getPatchName() )) - bRet = true; - else if (sDate.getLength() > lcl_getPatchName().getLength() ) - { - // Check the build ID to determine if the registration - // dialog needs to be shown. - sal_Int32 nBuildId = getBuildId(); - ::rtl::OUString aStoredBuildId( sDate.copy(lcl_getPatchName().getLength())); - - // remind if the current build ID is not the same as the stored one - if ( nBuildId != aStoredBuildId.toInt32() ) - bRet = true; - } - } - else - { - nDate = lcl_convertString2Date( sDate ); - if ( nDate > 0 ) - { - Date aReminderDate; - aReminderDate.SetDate( nDate ); - bRet = aReminderDate <= Date(); - } - } - } - else - bRet = true; - - return bRet; - } - - //-------------------------------------------------------------------- - void RegOptionsImpl::markSessionDone( ) - { - OSL_ENSURE( !s_bThisSessionDone, "RegOptionsImpl::markSessionDone: already marked!" ); - OSL_ENSURE( implGetDialogPermission( ) != RegOptions::dpDisabled, "RegOptionsImpl::markSessionDone: invalid call!" ); - if ( !s_bThisSessionDone ) - { - RegOptions::DialogPermission eOldPermission = implGetDialogPermission( ); - - s_bThisSessionDone = sal_True; - - if ( RegOptions::dpRemindLater == eOldPermission ) - { // no action required. If we shall remind later, the counter is already at 1, we should not change this, - // as the next smaller number (which is 0 :) means that the dialog would be disabled - OSL_ENSURE( 1 == m_nDialogCounter, "RegOptionsImpl::markSessionDone: invalid session counter (1)!" ); - } - else - { - OSL_ENSURE( m_nDialogCounter > 0, "RegOptionsImpl::markSessionDone: invalid session counter (2)!" ); - --m_nDialogCounter; - - // decrease the session counter - m_aRegistrationNode.setNodeValue( - lcl_getRequestDialogName(), - makeAny( (sal_Int32)m_nDialogCounter ) - ); - - // and clear the reminder date - removeReminder(); - } - } - } - - //==================================================================== - //= RegOptions - //==================================================================== - //-------------------------------------------------------------------- - RegOptions::RegOptions() - :m_pImpl( NULL ) - { - } - - //-------------------------------------------------------------------- - void RegOptions::ensureImpl( ) - { - if ( !m_pImpl ) - m_pImpl = RegOptionsImpl::registerClient(); - } - - //-------------------------------------------------------------------- - RegOptions::~RegOptions() - { - if ( m_pImpl ) - { - RegOptionsImpl::revokeClient(); - m_pImpl = NULL; - } - } - - //-------------------------------------------------------------------- - String RegOptions::getRegistrationURL( ) const - { - const_cast< RegOptions* >( this )->ensureImpl( ); - return m_pImpl->getRegistrationURL(); - } - - //-------------------------------------------------------------------- - RegOptions::DialogPermission RegOptions::getDialogPermission( ) const - { - const_cast< RegOptions* >( this )->ensureImpl( ); - return m_pImpl->getDialogPermission(); - } - - //-------------------------------------------------------------------- - void RegOptions::markSessionDone( ) - { - const_cast< RegOptions* >( this )->ensureImpl( ); - m_pImpl->markSessionDone(); - } - - //-------------------------------------------------------------------- - void RegOptions::activateReminder( sal_Int32 _nDaysFromNow ) - { - const_cast< RegOptions* >( this )->ensureImpl( ); - m_pImpl->activateReminder( _nDaysFromNow ); - } - - //-------------------------------------------------------------------- - sal_Bool RegOptions::allowMenu( ) const - { - /// we cache this setting, 'cause it is needed very often - static sal_Bool bKnowMenuPermission = sal_False; - static sal_Bool bAllowMenu = sal_False; - - if ( !bKnowMenuPermission ) - { - const_cast< RegOptions* >( this )->ensureImpl( ); - bAllowMenu = m_pImpl->allowMenu(); - bKnowMenuPermission = sal_True; - } - return bAllowMenu; - } - - //-------------------------------------------------------------------- - void RegOptions::removeReminder() - { - const_cast< RegOptions* >( this )->ensureImpl( ); - m_pImpl->removeReminder(); - } - - //-------------------------------------------------------------------- - bool RegOptions::hasReminderDateCome() const - { - const_cast< RegOptions* >( this )->ensureImpl( ); - return m_pImpl->hasReminderDateCome(); - } - -//........................................................................ -} // namespace svt -//........................................................................ - diff --git a/svtools/source/config/saveopt.cxx b/svtools/source/config/saveopt.cxx deleted file mode 100644 index 2b18d1bf4767..000000000000 --- a/svtools/source/config/saveopt.cxx +++ /dev/null @@ -1,1047 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: saveopt.cxx,v $ - * $Revision: 1.36 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#ifndef GCC -#endif - -#include -#include "rtl/instance.hxx" -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include "itemholder1.hxx" - -using namespace utl; -using namespace rtl; -using namespace com::sun::star::uno; -namespace css = ::com::sun::star; - -class SvtSaveOptions_Impl; -class SvtLoadOptions_Impl; - -#define CFG_READONLY_DEFAULT sal_False - -struct SvtLoadSaveOptions_Impl -{ - SvtSaveOptions_Impl* pSaveOpt; - SvtLoadOptions_Impl* pLoadOpt; -}; - -static SvtLoadSaveOptions_Impl* pOptions = NULL; -static sal_Int32 nRefCount = 0; - -class SvtSaveOptions_Impl : public utl::ConfigItem -{ - sal_Int32 nAutoSaveTime; - sal_Bool bUseUserData, - bBackup, - bAutoSave, - bAutoSavePrompt, - bDocInfSave, - bSaveWorkingSet, - bSaveDocWins, - bSaveDocView, - bSaveRelINet, - bSaveRelFSys, - bSaveUnpacked, - bDoPrettyPrinting, - bWarnAlienFormat, - bLoadDocPrinter; - - sal_Bool bROAutoSaveTime, - bROUseUserData, - bROBackup, - bROAutoSave, - bROAutoSavePrompt, - bRODocInfSave, - bROSaveWorkingSet, - bROSaveDocWins, - bROSaveDocView, - bROSaveRelINet, - bROSaveRelFSys, - bROSaveUnpacked, - bROWarnAlienFormat, - bRODoPrettyPrinting, - bROLoadDocPrinter, - bROODFDefaultVersion; - - SvtSaveOptions::ODFDefaultVersion eODFDefaultVersion; - -public: - SvtSaveOptions_Impl(); - ~SvtSaveOptions_Impl(); - - virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); - virtual void Commit(); - - sal_Int32 GetAutoSaveTime() const { return nAutoSaveTime; } - BOOL IsUseUserData() const { return bUseUserData; } - BOOL IsBackup() const { return bBackup; } - BOOL IsAutoSave() const { return bAutoSave; } - BOOL IsAutoSavePrompt() const { return bAutoSavePrompt; } - BOOL IsDocInfoSave() const { return bDocInfSave; } - BOOL IsSaveWorkingSet() const { return bSaveWorkingSet; } - BOOL IsSaveDocWins() const { return bSaveDocWins; } - BOOL IsSaveDocView() const { return bSaveDocView; } - BOOL IsSaveRelINet() const { return bSaveRelINet; } - BOOL IsSaveRelFSys() const { return bSaveRelFSys; } - BOOL IsSaveUnpacked() const { return bSaveUnpacked; } - sal_Bool IsPrettyPrintingEnabled( ) const { return bDoPrettyPrinting; } - sal_Bool IsWarnAlienFormat() const { return bWarnAlienFormat; } - sal_Bool IsLoadDocPrinter() const { return bLoadDocPrinter; } - SvtSaveOptions::ODFDefaultVersion - GetODFDefaultVersion() const { return eODFDefaultVersion; } - - void SetAutoSaveTime( sal_Int32 n ); - void SetUseUserData( BOOL b ); - void SetBackup( BOOL b ); - void SetAutoSave( BOOL b ); - void SetAutoSavePrompt( BOOL b ); - void SetDocInfoSave( BOOL b ); - void SetSaveWorkingSet( BOOL b ); - void SetSaveDocWins( BOOL b ); - void SetSaveDocView( BOOL b ); - void SetSaveRelINet( BOOL b ); - void SetSaveRelFSys( BOOL b ); - void SetSaveUnpacked( BOOL b ); - void EnablePrettyPrinting( sal_Bool _bDoPP ); - void SetWarnAlienFormat( sal_Bool _bDoPP ); - void SetLoadDocPrinter( sal_Bool bNew ); - void SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew ); - - sal_Bool IsReadOnly( SvtSaveOptions::EOption eOption ) const; -}; - -void SvtSaveOptions_Impl::SetAutoSaveTime( sal_Int32 n ) -{ - if (!bROAutoSaveTime && nAutoSaveTime!=n) - { - nAutoSaveTime = n; - SetModified(); - Commit(); - } -} - -void SvtSaveOptions_Impl::SetUseUserData( BOOL b ) -{ - if (!bROUseUserData && bUseUserData!=b) - { - bUseUserData = b; - SetModified(); - } -} - -void SvtSaveOptions_Impl::SetBackup( BOOL b ) -{ - if (!bROBackup && bBackup!=b) - { - bBackup = b; - SetModified(); - } -} - -void SvtSaveOptions_Impl::SetAutoSave( BOOL b ) -{ - if (!bROAutoSave && bAutoSave!=b) - { - bAutoSave = b; - SetModified(); - Commit(); - } -} - -void SvtSaveOptions_Impl::SetAutoSavePrompt( BOOL b ) -{ - if (!bROAutoSavePrompt && bAutoSavePrompt!=b) - { - bAutoSavePrompt = b; - SetModified(); - } -} - -void SvtSaveOptions_Impl::SetDocInfoSave(BOOL b) -{ - if (!bRODocInfSave && bDocInfSave!=b) - { - bDocInfSave = b; - SetModified(); - } -} - -void SvtSaveOptions_Impl::SetSaveWorkingSet( BOOL b ) -{ - if (!bROSaveWorkingSet && bSaveWorkingSet!=b) - { - bSaveWorkingSet = b; - SetModified(); - } -} - -void SvtSaveOptions_Impl::SetSaveDocWins( BOOL b ) -{ - if (!bROSaveDocWins && bSaveDocWins!=b) - { - bSaveDocWins = b; - SetModified(); - } -} - -void SvtSaveOptions_Impl::SetSaveDocView( BOOL b ) -{ - if (!bROSaveDocView && bSaveDocView!=b) - { - bSaveDocView = b; - SetModified(); - } -} - -void SvtSaveOptions_Impl::SetSaveRelINet( BOOL b ) -{ - if (!bROSaveRelINet && bSaveRelINet!=b) - { - bSaveRelINet = b; - SetModified(); - } -} - -void SvtSaveOptions_Impl::SetSaveRelFSys( BOOL b ) -{ - if (!bROSaveRelFSys && bSaveRelFSys!=b) - { - bSaveRelFSys = b; - SetModified(); - } -} - -void SvtSaveOptions_Impl::SetSaveUnpacked( BOOL b ) -{ - if (!bROSaveUnpacked && bSaveUnpacked!=b) - { - bSaveUnpacked = b; - SetModified(); - } -} - -void SvtSaveOptions_Impl::EnablePrettyPrinting( sal_Bool _bDoPP ) -{ - if (!bRODoPrettyPrinting && bDoPrettyPrinting!=_bDoPP) - { - bDoPrettyPrinting = _bDoPP; - SetModified(); - } -} - -void SvtSaveOptions_Impl::SetWarnAlienFormat( sal_Bool _bDoPP ) -{ - if (!bROWarnAlienFormat && bWarnAlienFormat!=_bDoPP) - { - bWarnAlienFormat = _bDoPP; - SetModified(); - } -} - -void SvtSaveOptions_Impl::SetLoadDocPrinter( sal_Bool bNew ) -{ - if ( !bROLoadDocPrinter && bLoadDocPrinter != bNew ) - { - bLoadDocPrinter = bNew; - SetModified(); - } -} - -void SvtSaveOptions_Impl::SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew ) -{ - if ( !bROODFDefaultVersion && eODFDefaultVersion != eNew ) - { - eODFDefaultVersion = eNew; - SetModified(); - } -} - -sal_Bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) const -{ - sal_Bool bReadOnly = CFG_READONLY_DEFAULT; - switch(eOption) - { - case SvtSaveOptions::E_AUTOSAVETIME : - bReadOnly = bROAutoSaveTime; - break; - case SvtSaveOptions::E_USEUSERDATA : - bReadOnly = bROUseUserData; - break; - case SvtSaveOptions::E_BACKUP : - bReadOnly = bROBackup; - break; - case SvtSaveOptions::E_AUTOSAVE : - bReadOnly = bROAutoSave; - break; - case SvtSaveOptions::E_AUTOSAVEPROMPT : - bReadOnly = bROAutoSavePrompt; - break; - case SvtSaveOptions::E_DOCINFSAVE : - bReadOnly = bRODocInfSave; - break; - case SvtSaveOptions::E_SAVEWORKINGSET : - bReadOnly = bROSaveWorkingSet; - break; - case SvtSaveOptions::E_SAVEDOCWINS : - bReadOnly = bROSaveDocWins; - break; - case SvtSaveOptions::E_SAVEDOCVIEW : - bReadOnly = bROSaveDocView; - break; - case SvtSaveOptions::E_SAVERELINET : - bReadOnly = bROSaveRelINet; - break; - case SvtSaveOptions::E_SAVERELFSYS : - bReadOnly = bROSaveRelFSys; - break; - case SvtSaveOptions::E_SAVEUNPACKED : - bReadOnly = bROSaveUnpacked; - break; - case SvtSaveOptions::E_DOPRETTYPRINTING : - bReadOnly = bRODoPrettyPrinting; - break; - case SvtSaveOptions::E_WARNALIENFORMAT : - bReadOnly = bROWarnAlienFormat; - break; - case SvtSaveOptions::E_LOADDOCPRINTER : - bReadOnly = bROLoadDocPrinter; - break; - case SvtSaveOptions::E_ODFDEFAULTVERSION : - bReadOnly = bROLoadDocPrinter; - break; - } - return bReadOnly; -} - -#define FORMAT 0 -#define TIMEINTERVALL 1 -#define USEUSERDATA 2 -#define CREATEBACKUP 3 -#define AUTOSAVE 4 -#define PROMPT 5 -#define EDITPROPERTY 6 -#define SAVEDOCWINS 7 -#define SAVEVIEWINFO 8 -#define UNPACKED 9 -#define PRETTYPRINTING 10 -#define WARNALIENFORMAT 11 -#define LOADDOCPRINTER 12 -#define FILESYSTEM 13 -#define INTERNET 14 -#define SAVEWORKINGSET 15 -#define ODFDEFAULTVERSION 16 - -Sequence< OUString > GetPropertyNames() -{ - static const char* aPropNames[] = - { - "Graphic/Format", - "Document/AutoSaveTimeIntervall", - "Document/UseUserData", - "Document/CreateBackup", - "Document/AutoSave", - "Document/AutoSavePrompt", - "Document/EditProperty", - "Document/DocumentWindows", - "Document/ViewInfo", - "Document/Unpacked", - "Document/PrettyPrinting", - "Document/WarnAlienFormat", - "Document/LoadPrinter", - "URL/FileSystem", - "URL/Internet", - "WorkingSet", - "ODF/DefaultVersion" - }; - - const int nCount = sizeof( aPropNames ) / sizeof( const char* ); - Sequence< OUString > aNames( nCount ); - OUString* pNames = aNames.getArray(); - for ( int i = 0; i < nCount; i++ ) - pNames[i] = OUString::createFromAscii( aPropNames[i] ); - - return aNames; -} - -// ----------------------------------------------------------------------- - -SvtSaveOptions_Impl::SvtSaveOptions_Impl() - : ConfigItem( OUString::createFromAscii("Office.Common/Save") ) - , nAutoSaveTime( 0 ) - , bUseUserData( sal_False ) - , bBackup( sal_False ) - , bAutoSave( sal_False ) - , bAutoSavePrompt( sal_False ) - , bDocInfSave( sal_False ) - , bSaveWorkingSet( sal_False ) - , bSaveDocWins( sal_False ) - , bSaveDocView( sal_False ) - , bSaveRelINet( sal_False ) - , bSaveRelFSys( sal_False ) - , bSaveUnpacked( sal_False ) - , bDoPrettyPrinting( sal_False ) - , bWarnAlienFormat( sal_True ) - , bLoadDocPrinter( sal_True ) - , bROAutoSaveTime( CFG_READONLY_DEFAULT ) - , bROUseUserData( CFG_READONLY_DEFAULT ) - , bROBackup( CFG_READONLY_DEFAULT ) - , bROAutoSave( CFG_READONLY_DEFAULT ) - , bROAutoSavePrompt( CFG_READONLY_DEFAULT ) - , bRODocInfSave( CFG_READONLY_DEFAULT ) - , bROSaveWorkingSet( CFG_READONLY_DEFAULT ) - , bROSaveDocWins( CFG_READONLY_DEFAULT ) - , bROSaveDocView( CFG_READONLY_DEFAULT ) - , bROSaveRelINet( CFG_READONLY_DEFAULT ) - , bROSaveRelFSys( CFG_READONLY_DEFAULT ) - , bROSaveUnpacked( CFG_READONLY_DEFAULT ) - , bROWarnAlienFormat( CFG_READONLY_DEFAULT ) - , bRODoPrettyPrinting( CFG_READONLY_DEFAULT ) - , bROLoadDocPrinter( CFG_READONLY_DEFAULT ) - , bROODFDefaultVersion( CFG_READONLY_DEFAULT ) - , eODFDefaultVersion( SvtSaveOptions::ODFVER_LATEST ) -{ - Sequence< OUString > aNames = GetPropertyNames(); - Sequence< Any > aValues = GetProperties( aNames ); - Sequence< sal_Bool > aROStates = GetReadOnlyStates( aNames ); - EnableNotification( aNames ); - const Any* pValues = aValues.getConstArray(); - const sal_Bool* pROStates = aROStates.getConstArray(); - DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" ); - DBG_ASSERT( aROStates.getLength() == aNames.getLength(), "GetReadOnlyStates failed" ); - if ( aValues.getLength() == aNames.getLength() && aROStates.getLength() == aNames.getLength() ) - { - for ( int nProp = 0; nProp < aNames.getLength(); nProp++ ) - { - DBG_ASSERT( pValues[nProp].hasValue(), "property value missing" ); - if ( pValues[nProp].hasValue() ) - { - sal_Int32 nTemp = 0; - switch ( nProp ) - { - case FORMAT: - // not supported anymore - break; - - case TIMEINTERVALL : - if ( pValues[nProp] >>= nTemp ) - nAutoSaveTime = nTemp; - else { - DBG_ERROR( "Wrong Type!" ); - }; - bROAutoSaveTime = pROStates[nProp]; - break; - - case ODFDEFAULTVERSION : - { - sal_Int16 nTmp = 0; - if ( pValues[nProp] >>= nTmp ) - { - if( nTmp == 3 ) - eODFDefaultVersion = SvtSaveOptions::ODFVER_LATEST; - else - eODFDefaultVersion = SvtSaveOptions::ODFDefaultVersion( nTmp ); - } - else { - DBG_ERRORFILE( "SvtSaveOptions_Impl::SvtSaveOptions_Impl(): Wrong Type!" ); - }; - bROODFDefaultVersion = pROStates[nProp]; - break; - } - - default: - { - sal_Bool bTemp = sal_Bool(); - if ( pValues[nProp] >>= bTemp ) - { - switch ( nProp ) - { - case USEUSERDATA : - bUseUserData = bTemp; - bROUseUserData = pROStates[nProp]; - break; - case CREATEBACKUP : - bBackup = bTemp; - bROBackup = pROStates[nProp]; - break; - case AUTOSAVE : - bAutoSave = bTemp; - bROAutoSave = pROStates[nProp]; - break; - case PROMPT : - bAutoSavePrompt = bTemp; - bROAutoSavePrompt = pROStates[nProp]; - break; - case EDITPROPERTY : - bDocInfSave = bTemp; - bRODocInfSave = pROStates[nProp]; - break; - case SAVEWORKINGSET : - bSaveWorkingSet = bTemp; - bROSaveWorkingSet = pROStates[nProp]; - break; - case SAVEDOCWINS : - bSaveDocWins = bTemp; - bROSaveDocWins = pROStates[nProp]; - break; - case SAVEVIEWINFO : - bSaveDocView = bTemp; - bROSaveDocView = pROStates[nProp]; - break; - case FILESYSTEM : - bSaveRelFSys = bTemp; - bROSaveRelFSys = pROStates[nProp]; - break; - case INTERNET : - bSaveRelINet = bTemp; - bROSaveRelINet = pROStates[nProp]; - break; - case UNPACKED : - bSaveUnpacked = bTemp; - bROSaveUnpacked = pROStates[nProp]; - break; - - case PRETTYPRINTING: - bDoPrettyPrinting = bTemp; - bRODoPrettyPrinting = pROStates[nProp]; - break; - - case WARNALIENFORMAT: - bWarnAlienFormat = bTemp; - bROWarnAlienFormat = pROStates[nProp]; - break; - - case LOADDOCPRINTER: - bLoadDocPrinter = bTemp; - bROLoadDocPrinter = pROStates[nProp]; - break; - - default : - DBG_ERRORFILE( "invalid index to load a path" ); - } - } - else - { - DBG_ERROR( "Wrong Type!" ); - } - } - } - } - } - } - - try - { - css::uno::Reference< css::uno::XInterface > xCFG = ::comphelper::ConfigurationHelper::openConfig( - ::utl::getProcessServiceFactory(), - ::rtl::OUString::createFromAscii("org.openoffice.Office.Recovery"), - ::comphelper::ConfigurationHelper::E_READONLY); - - ::comphelper::ConfigurationHelper::readRelativeKey( - xCFG, - ::rtl::OUString::createFromAscii("AutoSave"), - ::rtl::OUString::createFromAscii("Enabled")) >>= bAutoSave; - - ::comphelper::ConfigurationHelper::readRelativeKey( - xCFG, - ::rtl::OUString::createFromAscii("AutoSave"), - ::rtl::OUString::createFromAscii("TimeIntervall")) >>= nAutoSaveTime; - } - catch(const css::uno::Exception&) - { DBG_ERROR("Could not find needed informations for AutoSave feature."); } -} - -SvtSaveOptions_Impl::~SvtSaveOptions_Impl() -{} - -void SvtSaveOptions_Impl::Commit() -{ - Sequence< OUString > aOrgNames = GetPropertyNames(); - OUString* pOrgNames = aOrgNames.getArray(); - sal_Int32 nOrgCount = aOrgNames.getLength(); - - Sequence< OUString > aNames( nOrgCount ); - Sequence< Any > aValues( nOrgCount ); - OUString* pNames = aNames.getArray(); - Any* pValues = aValues.getArray(); - sal_Int32 nRealCount = 0; - - for (sal_Int32 i=0; i xCFG = ::comphelper::ConfigurationHelper::openConfig( - ::utl::getProcessServiceFactory(), - ::rtl::OUString::createFromAscii("org.openoffice.Office.Recovery"), - ::comphelper::ConfigurationHelper::E_STANDARD); - - ::comphelper::ConfigurationHelper::writeRelativeKey( - xCFG, - ::rtl::OUString::createFromAscii("AutoSave"), - ::rtl::OUString::createFromAscii("TimeIntervall"), - css::uno::makeAny(nAutoSaveTime)); - - ::comphelper::ConfigurationHelper::writeRelativeKey( - xCFG, - ::rtl::OUString::createFromAscii("AutoSave"), - ::rtl::OUString::createFromAscii("Enabled"), - css::uno::makeAny(bAutoSave)); - - ::comphelper::ConfigurationHelper::flush(xCFG); -} - -// ----------------------------------------------------------------------- - -void SvtSaveOptions_Impl::Notify( const Sequence& ) -{ -} - - -class SvtLoadOptions_Impl : public utl::ConfigItem -{ - - sal_Bool bLoadUserDefinedSettings; - -public: - SvtLoadOptions_Impl(); - ~SvtLoadOptions_Impl(); - - virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); - virtual void Commit(); - - void SetLoadUserSettings(sal_Bool b){bLoadUserDefinedSettings = b; SetModified();} - sal_Bool IsLoadUserSettings() const {return bLoadUserDefinedSettings;} -}; -// ----------------------------------------------------------------------- -const sal_Char cUserDefinedSettings[] = "UserDefinedSettings"; - -SvtLoadOptions_Impl::SvtLoadOptions_Impl() - : ConfigItem( OUString::createFromAscii("Office.Common/Load") ) - , bLoadUserDefinedSettings( sal_False ) -{ - Sequence< OUString > aNames(1); - aNames[0] = OUString::createFromAscii(cUserDefinedSettings); - Sequence< Any > aValues = GetProperties( aNames ); - EnableNotification( aNames ); - const Any* pValues = aValues.getConstArray(); - DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" ); - if (pValues[0].getValueTypeClass() == ::com::sun::star::uno::TypeClass_BOOLEAN) - bLoadUserDefinedSettings = *(sal_Bool *)pValues[0].getValue(); -} -// ----------------------------------------------------------------------- -SvtLoadOptions_Impl::~SvtLoadOptions_Impl() -{ -} -// ----------------------------------------------------------------------- -void SvtLoadOptions_Impl::Commit() -{ - Sequence< OUString > aNames(1); - aNames[0] = OUString::createFromAscii(cUserDefinedSettings); - Sequence< Any > aValues( 1 ); - aValues[0].setValue(&bLoadUserDefinedSettings, ::getBooleanCppuType()); - PutProperties( aNames, aValues ); -} -// ----------------------------------------------------------------------- -void SvtLoadOptions_Impl::Notify( const Sequence& ) -{ - DBG_ERRORFILE( "properties have been changed" ); -} -// ----------------------------------------------------------------------- - -namespace -{ - class LocalSingleton : public rtl::Static< osl::Mutex, LocalSingleton > - { - }; -} - -// ----------------------------------------------------------------------- -SvtSaveOptions::SvtSaveOptions() -{ - // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( LocalSingleton::get() ); - if ( !pOptions ) - { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtSaveOptions_Impl::ctor()"); - pOptions = new SvtLoadSaveOptions_Impl; - pOptions->pSaveOpt = new SvtSaveOptions_Impl; - pOptions->pLoadOpt = new SvtLoadOptions_Impl; - - ItemHolder1::holdConfigItem(E_SAVEOPTIONS); - } - ++nRefCount; - pImp = pOptions; -} - -// ----------------------------------------------------------------------- - -SvtSaveOptions::~SvtSaveOptions() -{ - // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( LocalSingleton::get() ); - if ( !--nRefCount ) - { - if ( pOptions->pSaveOpt->IsModified() ) - pOptions->pSaveOpt->Commit(); - if ( pOptions->pLoadOpt->IsModified() ) - pOptions->pLoadOpt->Commit(); - - DELETEZ( pOptions->pLoadOpt ); - DELETEZ( pOptions->pSaveOpt ); - DELETEZ( pOptions ); - } -} - -void SvtSaveOptions::SetAutoSaveTime( sal_Int32 n ) -{ - pImp->pSaveOpt->SetAutoSaveTime( n ); -} - -sal_Int32 SvtSaveOptions::GetAutoSaveTime() const -{ - return pImp->pSaveOpt->GetAutoSaveTime(); -} - -void SvtSaveOptions::SetUseUserData( sal_Bool b ) -{ - pImp->pSaveOpt->SetUseUserData( b ); -} - -sal_Bool SvtSaveOptions::IsUseUserData() const -{ - return pImp->pSaveOpt->IsUseUserData(); -} - -void SvtSaveOptions::SetBackup( sal_Bool b ) -{ - pImp->pSaveOpt->SetBackup( b ); -} - -sal_Bool SvtSaveOptions::IsBackup() const -{ - return pImp->pSaveOpt->IsBackup(); -} - -void SvtSaveOptions::SetAutoSave( sal_Bool b ) -{ - pImp->pSaveOpt->SetAutoSave( b ); -} - -sal_Bool SvtSaveOptions::IsAutoSave() const -{ - return pImp->pSaveOpt->IsAutoSave(); -} - -void SvtSaveOptions::SetAutoSavePrompt( sal_Bool b ) -{ - pImp->pSaveOpt->SetAutoSavePrompt( b ); -} - -sal_Bool SvtSaveOptions::IsAutoSavePrompt() const -{ - return pImp->pSaveOpt->IsAutoSavePrompt(); -} - -void SvtSaveOptions::SetDocInfoSave(sal_Bool b) -{ - pImp->pSaveOpt->SetDocInfoSave( b ); -} - -sal_Bool SvtSaveOptions::IsDocInfoSave() const -{ - return pImp->pSaveOpt->IsDocInfoSave(); -} - -void SvtSaveOptions::SetSaveWorkingSet( sal_Bool b ) -{ - pImp->pSaveOpt->SetSaveWorkingSet( b ); -} - -sal_Bool SvtSaveOptions::IsSaveWorkingSet() const -{ - return pImp->pSaveOpt->IsSaveWorkingSet(); -} - -void SvtSaveOptions::SetSaveDocWins( sal_Bool b ) -{ - pImp->pSaveOpt->SetSaveDocWins( b ); -} - -sal_Bool SvtSaveOptions::IsSaveDocWins() const -{ - return pImp->pSaveOpt->IsSaveDocWins(); -} - -void SvtSaveOptions::SetSaveDocView( sal_Bool b ) -{ - pImp->pSaveOpt->SetSaveDocView( b ); -} - -sal_Bool SvtSaveOptions::IsSaveDocView() const -{ - return pImp->pSaveOpt->IsSaveDocView(); -} - -void SvtSaveOptions::SetSaveRelINet( sal_Bool b ) -{ - pImp->pSaveOpt->SetSaveRelINet( b ); -} - -sal_Bool SvtSaveOptions::IsSaveRelINet() const -{ - return pImp->pSaveOpt->IsSaveRelINet(); -} - -void SvtSaveOptions::SetSaveRelFSys( sal_Bool b ) -{ - pImp->pSaveOpt->SetSaveRelFSys( b ); -} - -sal_Bool SvtSaveOptions::IsSaveRelFSys() const -{ - return pImp->pSaveOpt->IsSaveRelFSys(); -} - -void SvtSaveOptions::SetSaveUnpacked( sal_Bool b ) -{ - pImp->pSaveOpt->SetSaveUnpacked( b ); -} - -sal_Bool SvtSaveOptions::IsSaveUnpacked() const -{ - return pImp->pSaveOpt->IsSaveUnpacked(); -} - -void SvtSaveOptions::SetLoadUserSettings(sal_Bool b) -{ - pImp->pLoadOpt->SetLoadUserSettings(b); -} - -sal_Bool SvtSaveOptions::IsLoadUserSettings() const -{ - return pImp->pLoadOpt->IsLoadUserSettings(); -} - -void SvtSaveOptions::SetPrettyPrinting( sal_Bool _bEnable ) -{ - pImp->pSaveOpt->EnablePrettyPrinting( _bEnable ); -} - -sal_Bool SvtSaveOptions::IsPrettyPrinting() const -{ - return pImp->pSaveOpt->IsPrettyPrintingEnabled(); -} - -void SvtSaveOptions::SetWarnAlienFormat( sal_Bool _bEnable ) -{ - pImp->pSaveOpt->SetWarnAlienFormat( _bEnable ); -} - -sal_Bool SvtSaveOptions::IsWarnAlienFormat() const -{ - return pImp->pSaveOpt->IsWarnAlienFormat(); -} - -void SvtSaveOptions::SetLoadDocumentPrinter( sal_Bool _bEnable ) -{ - pImp->pSaveOpt->SetLoadDocPrinter( _bEnable ); -} - -sal_Bool SvtSaveOptions::IsLoadDocumentPrinter() const -{ - return pImp->pSaveOpt->IsLoadDocPrinter(); -} - -void SvtSaveOptions::SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eVersion ) -{ - pImp->pSaveOpt->SetODFDefaultVersion( eVersion ); -} - -SvtSaveOptions::ODFDefaultVersion SvtSaveOptions::GetODFDefaultVersion() const -{ - return pImp->pSaveOpt->GetODFDefaultVersion(); -} - -sal_Bool SvtSaveOptions::IsReadOnly( SvtSaveOptions::EOption eOption ) const -{ - return pImp->pSaveOpt->IsReadOnly(eOption); -} - diff --git a/svtools/source/config/searchopt.cxx b/svtools/source/config/searchopt.cxx deleted file mode 100644 index 261edf4d0f1e..000000000000 --- a/svtools/source/config/searchopt.cxx +++ /dev/null @@ -1,634 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: searchopt.cxx,v $ - * $Revision: 1.13 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include "searchopt.hxx" -#include -#include -#include -#include -#include -#include -#include - - -using namespace rtl; -using namespace utl; -using namespace com::sun::star::uno; -using namespace com::sun::star::i18n; - -#define MAX_FLAGS_OFFSET 25 - -////////////////////////////////////////////////////////////////////// - - -class SvtSearchOptions_Impl : public ConfigItem -{ - INT32 nFlags; - BOOL bModified; - - // disallow copy-constructor and assignment-operator for now - SvtSearchOptions_Impl( const SvtSearchOptions_Impl & ); - SvtSearchOptions_Impl & operator = ( const SvtSearchOptions_Impl & ); - -protected: - BOOL IsModified() const { return bModified; } - using ConfigItem::SetModified; - void SetModified( BOOL bVal ); - BOOL Load(); - BOOL Save(); - - Sequence< OUString > GetPropertyNames() const; - -public: - SvtSearchOptions_Impl(); - virtual ~SvtSearchOptions_Impl(); - - // ConfigItem - virtual void Commit(); - - BOOL GetFlag( USHORT nOffset ) const; - void SetFlag( USHORT nOffset, BOOL bVal ); -}; - - - -SvtSearchOptions_Impl::SvtSearchOptions_Impl() : - ConfigItem( OUString::createFromAscii( "Office.Common/SearchOptions" ) ) -{ - RTL_LOGFILE_CONTEXT(aLog, "svtools SvtSearchOptions_Impl::SvtSearchOptions_Impl()"); - nFlags = 0x0003FFFF; // set all options values to 'true' - Load(); - SetModified( FALSE ); -} - - -SvtSearchOptions_Impl::~SvtSearchOptions_Impl() -{ - Commit(); -} - - -void SvtSearchOptions_Impl::Commit() -{ - if (IsModified()) - Save(); -} - - -BOOL SvtSearchOptions_Impl::GetFlag( USHORT nOffset ) const -{ - DBG_ASSERT( nOffset <= MAX_FLAGS_OFFSET, "offset out of range"); - return ((nFlags >> nOffset) & 0x01) ? TRUE : FALSE; -} - - -void SvtSearchOptions_Impl::SetFlag( USHORT nOffset, BOOL bVal ) -{ - DBG_ASSERT( nOffset <= MAX_FLAGS_OFFSET, "offset out of range"); - INT32 nOldFlags = nFlags; - INT32 nMask = ((INT32) 1) << nOffset; - if (bVal) - nFlags |= nMask; - else - nFlags &= ~nMask; - if (nFlags != nOldFlags) - SetModified( TRUE ); -} - - -void SvtSearchOptions_Impl::SetModified( BOOL bVal ) -{ - bModified = bVal; - if (bModified) - { - ConfigItem::SetModified(); - } -} - - -Sequence< OUString > SvtSearchOptions_Impl::GetPropertyNames() const -{ - static const char* aPropNames[ MAX_FLAGS_OFFSET + 1 ] = - { - "IsWholeWordsOnly", // 0 - "IsBackwards", // 1 - "IsUseRegularExpression", // 2 - //"IsCurrentSelectionOnly", // interactively set or not... - "IsSearchForStyles", // 3 - "IsSimilaritySearch", // 4 - "IsUseAsianOptions", // 5 - "IsMatchCase", // 6 - "Japanese/IsMatchFullHalfWidthForms", // 7 - "Japanese/IsMatchHiraganaKatakana", // 8 - "Japanese/IsMatchContractions", // 9 - "Japanese/IsMatchMinusDashCho-on", // 10 - "Japanese/IsMatchRepeatCharMarks", // 11 - "Japanese/IsMatchVariantFormKanji", // 12 - "Japanese/IsMatchOldKanaForms", // 13 - "Japanese/IsMatch_DiZi_DuZu", // 14 - "Japanese/IsMatch_BaVa_HaFa", // 15 - "Japanese/IsMatch_TsiThiChi_DhiZi", // 16 - "Japanese/IsMatch_HyuIyu_ByuVyu", // 17 - "Japanese/IsMatch_SeShe_ZeJe", // 18 - "Japanese/IsMatch_IaIya", // 19 - "Japanese/IsMatch_KiKu", // 20 - "Japanese/IsIgnorePunctuation", // 21 - "Japanese/IsIgnoreWhitespace", // 22 - "Japanese/IsIgnoreProlongedSoundMark", // 23 - "Japanese/IsIgnoreMiddleDot", // 24 - "IsNotes" // 25 - }; - - const int nCount = sizeof( aPropNames ) / sizeof( aPropNames[0] ); - Sequence< OUString > aNames( nCount ); - OUString* pNames = aNames.getArray(); - for (INT32 i = 0; i < nCount; ++i) - pNames[i] = OUString::createFromAscii( aPropNames[i] ); - - return aNames; -} - - -BOOL SvtSearchOptions_Impl::Load() -{ - BOOL bSucc = FALSE; - - Sequence< OUString > aNames = GetPropertyNames(); - INT32 nProps = aNames.getLength(); - - const Sequence< Any > aValues = GetProperties( aNames ); - DBG_ASSERT( aValues.getLength() == aNames.getLength(), - "GetProperties failed" ); - //EnableNotification( aNames ); - - if (nProps && aValues.getLength() == nProps) - { - bSucc = TRUE; - - const Any* pValues = aValues.getConstArray(); - for (USHORT i = 0; i < nProps; ++i) - { - const Any &rVal = pValues[i]; - DBG_ASSERT( rVal.hasValue(), "property value missing" ); - if (rVal.hasValue()) - { - BOOL bVal = BOOL(); - if (rVal >>= bVal) - { - if (i <= MAX_FLAGS_OFFSET) - { - // use index in sequence as flag index - SetFlag( i, bVal ); - } - else { - DBG_ERROR( "unexpected index" ); - } - } - else - { - DBG_ERROR( "unexpected type" ); - bSucc = FALSE; - } - } - else - { - DBG_ERROR( "value missing" ); - bSucc = FALSE; - } - } - } - DBG_ASSERT( bSucc, "LoadConfig failed" ); - - return bSucc; -} - - -BOOL SvtSearchOptions_Impl::Save() -{ - BOOL bSucc = FALSE; - - const Sequence< OUString > aNames = GetPropertyNames(); - INT32 nProps = aNames.getLength(); - - Sequence< Any > aValues( nProps ); - Any *pValue = aValues.getArray(); - - DBG_ASSERT( nProps == MAX_FLAGS_OFFSET + 1, - "unexpected size of index" ); - if (nProps && nProps == MAX_FLAGS_OFFSET + 1) - { - for (USHORT i = 0; i < nProps; ++i) - pValue[i] <<= (BOOL) GetFlag(i); - bSucc |= PutProperties( aNames, aValues ); - } - - if (bSucc) - SetModified( FALSE ); - - return bSucc; -} - - -////////////////////////////////////////////////////////////////////// - -SvtSearchOptions::SvtSearchOptions() -{ - pImpl = new SvtSearchOptions_Impl; -} - - -SvtSearchOptions::~SvtSearchOptions() -{ - delete pImpl; -} - - -INT32 SvtSearchOptions::GetTransliterationFlags() const -{ - INT32 nRes = 0; - - if (!IsMatchCase()) // 'IsMatchCase' means act case sensitive - nRes |= TransliterationModules_IGNORE_CASE; - if ( IsMatchFullHalfWidthForms()) - nRes |= TransliterationModules_IGNORE_WIDTH; - if ( IsMatchHiraganaKatakana()) - nRes |= TransliterationModules_IGNORE_KANA; - if ( IsMatchContractions()) - nRes |= TransliterationModules_ignoreSize_ja_JP; - if ( IsMatchMinusDashChoon()) - nRes |= TransliterationModules_ignoreMinusSign_ja_JP; - if ( IsMatchRepeatCharMarks()) - nRes |= TransliterationModules_ignoreIterationMark_ja_JP; - if ( IsMatchVariantFormKanji()) - nRes |= TransliterationModules_ignoreTraditionalKanji_ja_JP; - if ( IsMatchOldKanaForms()) - nRes |= TransliterationModules_ignoreTraditionalKana_ja_JP; - if ( IsMatchDiziDuzu()) - nRes |= TransliterationModules_ignoreZiZu_ja_JP; - if ( IsMatchBavaHafa()) - nRes |= TransliterationModules_ignoreBaFa_ja_JP; - if ( IsMatchTsithichiDhizi()) - nRes |= TransliterationModules_ignoreTiJi_ja_JP; - if ( IsMatchHyuiyuByuvyu()) - nRes |= TransliterationModules_ignoreHyuByu_ja_JP; - if ( IsMatchSesheZeje()) - nRes |= TransliterationModules_ignoreSeZe_ja_JP; - if ( IsMatchIaiya()) - nRes |= TransliterationModules_ignoreIandEfollowedByYa_ja_JP; - if ( IsMatchKiku()) - nRes |= TransliterationModules_ignoreKiKuFollowedBySa_ja_JP; - if ( IsIgnorePunctuation()) - nRes |= TransliterationModules_ignoreSeparator_ja_JP; - if ( IsIgnoreWhitespace()) - nRes |= TransliterationModules_ignoreSpace_ja_JP; - if ( IsIgnoreProlongedSoundMark()) - nRes |= TransliterationModules_ignoreProlongedSoundMark_ja_JP; - if ( IsIgnoreMiddleDot()) - nRes |= TransliterationModules_ignoreMiddleDot_ja_JP; - - return nRes; -} - - -BOOL SvtSearchOptions::IsWholeWordsOnly() const -{ - return pImpl->GetFlag( 0 ); -} - - -void SvtSearchOptions::SetWholeWordsOnly( BOOL bVal ) -{ - pImpl->SetFlag( 0, bVal ); -} - - -BOOL SvtSearchOptions::IsBackwards() const -{ - return pImpl->GetFlag( 1 ); -} - - -void SvtSearchOptions::SetBackwards( BOOL bVal ) -{ - pImpl->SetFlag( 1, bVal ); -} - - -BOOL SvtSearchOptions::IsUseRegularExpression() const -{ - return pImpl->GetFlag( 2 ); -} - - -void SvtSearchOptions::SetUseRegularExpression( BOOL bVal ) -{ - pImpl->SetFlag( 2, bVal ); -} - - -BOOL SvtSearchOptions::IsSearchForStyles() const -{ - return pImpl->GetFlag( 3 ); -} - - -void SvtSearchOptions::SetSearchForStyles( BOOL bVal ) -{ - pImpl->SetFlag( 3, bVal ); -} - - -BOOL SvtSearchOptions::IsSimilaritySearch() const -{ - return pImpl->GetFlag( 4 ); -} - - -void SvtSearchOptions::SetSimilaritySearch( BOOL bVal ) -{ - pImpl->SetFlag( 4, bVal ); -} - - -BOOL SvtSearchOptions::IsUseAsianOptions() const -{ - return pImpl->GetFlag( 5 ); -} - - -void SvtSearchOptions::SetUseAsianOptions( BOOL bVal ) -{ - pImpl->SetFlag( 5, bVal ); -} - - -BOOL SvtSearchOptions::IsMatchCase() const -{ - return pImpl->GetFlag( 6 ); -} - - -void SvtSearchOptions::SetMatchCase( BOOL bVal ) -{ - pImpl->SetFlag( 6, bVal ); -} - - -BOOL SvtSearchOptions::IsMatchFullHalfWidthForms() const -{ - return pImpl->GetFlag( 7 ); -} - - -void SvtSearchOptions::SetMatchFullHalfWidthForms( BOOL bVal ) -{ - pImpl->SetFlag( 7, bVal ); -} - - -BOOL SvtSearchOptions::IsMatchHiraganaKatakana() const -{ - return pImpl->GetFlag( 8 ); -} - - -void SvtSearchOptions::SetMatchHiraganaKatakana( BOOL bVal ) -{ - pImpl->SetFlag( 8, bVal ); -} - - -BOOL SvtSearchOptions::IsMatchContractions() const -{ - return pImpl->GetFlag( 9 ); -} - - -void SvtSearchOptions::SetMatchContractions( BOOL bVal ) -{ - pImpl->SetFlag( 9, bVal ); -} - - -BOOL SvtSearchOptions::IsMatchMinusDashChoon() const -{ - return pImpl->GetFlag( 10 ); -} - - -void SvtSearchOptions::SetMatchMinusDashChoon( BOOL bVal ) -{ - pImpl->SetFlag( 10, bVal ); -} - - -BOOL SvtSearchOptions::IsMatchRepeatCharMarks() const -{ - return pImpl->GetFlag( 11 ); -} - - -void SvtSearchOptions::SetMatchRepeatCharMarks( BOOL bVal ) -{ - pImpl->SetFlag( 11, bVal ); -} - - -BOOL SvtSearchOptions::IsMatchVariantFormKanji() const -{ - return pImpl->GetFlag( 12 ); -} - - -void SvtSearchOptions::SetMatchVariantFormKanji( BOOL bVal ) -{ - pImpl->SetFlag( 12, bVal ); -} - - -BOOL SvtSearchOptions::IsMatchOldKanaForms() const -{ - return pImpl->GetFlag( 13 ); -} - - -void SvtSearchOptions::SetMatchOldKanaForms( BOOL bVal ) -{ - pImpl->SetFlag( 13, bVal ); -} - - -BOOL SvtSearchOptions::IsMatchDiziDuzu() const -{ - return pImpl->GetFlag( 14 ); -} - - -void SvtSearchOptions::SetMatchDiziDuzu( BOOL bVal ) -{ - pImpl->SetFlag( 14, bVal ); -} - - -BOOL SvtSearchOptions::IsMatchBavaHafa() const -{ - return pImpl->GetFlag( 15 ); -} - - -void SvtSearchOptions::SetMatchBavaHafa( BOOL bVal ) -{ - pImpl->SetFlag( 15, bVal ); -} - - -BOOL SvtSearchOptions::IsMatchTsithichiDhizi() const -{ - return pImpl->GetFlag( 16 ); -} - - -void SvtSearchOptions::SetMatchTsithichiDhizi( BOOL bVal ) -{ - pImpl->SetFlag( 16, bVal ); -} - - -BOOL SvtSearchOptions::IsMatchHyuiyuByuvyu() const -{ - return pImpl->GetFlag( 17 ); -} - - -void SvtSearchOptions::SetMatchHyuiyuByuvyu( BOOL bVal ) -{ - pImpl->SetFlag( 17, bVal ); -} - - -BOOL SvtSearchOptions::IsMatchSesheZeje() const -{ - return pImpl->GetFlag( 18 ); -} - - -void SvtSearchOptions::SetMatchSesheZeje( BOOL bVal ) -{ - pImpl->SetFlag( 18, bVal ); -} - - -BOOL SvtSearchOptions::IsMatchIaiya() const -{ - return pImpl->GetFlag( 19 ); -} - - -void SvtSearchOptions::SetMatchIaiya( BOOL bVal ) -{ - pImpl->SetFlag( 19, bVal ); -} - - -BOOL SvtSearchOptions::IsMatchKiku() const -{ - return pImpl->GetFlag( 20 ); -} - - -void SvtSearchOptions::SetMatchKiku( BOOL bVal ) -{ - pImpl->SetFlag( 20, bVal ); -} - - -BOOL SvtSearchOptions::IsIgnorePunctuation() const -{ - return pImpl->GetFlag( 21 ); -} - - -void SvtSearchOptions::SetIgnorePunctuation( BOOL bVal ) -{ - pImpl->SetFlag( 21, bVal ); -} - - -BOOL SvtSearchOptions::IsIgnoreWhitespace() const -{ - return pImpl->GetFlag( 22 ); -} - - -void SvtSearchOptions::SetIgnoreWhitespace( BOOL bVal ) -{ - pImpl->SetFlag( 22, bVal ); -} - - -BOOL SvtSearchOptions::IsIgnoreProlongedSoundMark() const -{ - return pImpl->GetFlag( 23 ); -} - - -void SvtSearchOptions::SetIgnoreProlongedSoundMark( BOOL bVal ) -{ - pImpl->SetFlag( 23, bVal ); -} - - -BOOL SvtSearchOptions::IsIgnoreMiddleDot() const -{ - return pImpl->GetFlag( 24 ); -} - - -void SvtSearchOptions::SetIgnoreMiddleDot( BOOL bVal ) -{ - pImpl->SetFlag( 24, bVal ); -} - -BOOL SvtSearchOptions::IsNotes() const -{ - return pImpl->GetFlag( 25 ); -} - - -void SvtSearchOptions::SetNotes( BOOL bVal ) -{ - pImpl->SetFlag( 25, bVal ); -} - -////////////////////////////////////////////////////////////////////// - diff --git a/svtools/source/config/securityoptions.cxx b/svtools/source/config/securityoptions.cxx deleted file mode 100644 index 8fbc9008d51e..000000000000 --- a/svtools/source/config/securityoptions.cxx +++ /dev/null @@ -1,1312 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: securityoptions.cxx,v $ - * $Revision: 1.33 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include "itemholder1.hxx" - -//_________________________________________________________________________________________________________________ -// namespaces -//_________________________________________________________________________________________________________________ - -using namespace ::utl ; -using namespace ::rtl ; -using namespace ::osl ; -using namespace ::com::sun::star::uno ; - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -#define ROOTNODE_SECURITY OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Security/Scripting")) -#define DEFAULT_SECUREURL Sequence< OUString >() -#define DEFAULT_SECLEVEL 3 -#define DEFAULT_TRUSTEDAUTHORS Sequence< SvtSecurityOptions::Certificate >() - -// xmlsec05 depricated -#define DEFAULT_STAROFFICEBASIC eALWAYS_EXECUTE - -#define CSTR_SECUREURL "SecureURL" -#define CSTR_DOCWARN_SAVEORSEND "WarnSaveOrSendDoc" -#define CSTR_DOCWARN_SIGNING "WarnSignDoc" -#define CSTR_DOCWARN_PRINT "WarnPrintDoc" -#define CSTR_DOCWARN_CREATEPDF "WarnCreatePDF" -#define CSTR_DOCWARN_REMOVEPERSONALINFO "RemovePersonalInfoOnSaving" -#define CSTR_DOCWARN_RECOMMENDPASSWORD "RecommendPasswordProtection" -#define CSTR_CTRLCLICK_HYPERLINK "HyperlinksWithCtrlClick" -#define CSTR_MACRO_SECLEVEL "MacroSecurityLevel" -#define CSTR_MACRO_TRUSTEDAUTHORS "TrustedAuthors" -#define CSTR_MACRO_DISABLE "DisableMacrosExecution" -#define CSTR_TRUSTEDAUTHOR_SUBJECTNAME "SubjectName" -#define CSTR_TRUSTEDAUTHOR_SERIALNUMBER "SerialNumber" -#define CSTR_TRUSTEDAUTHOR_RAWDATA "RawData" - -#define PROPERTYNAME_SECUREURL OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_SECUREURL )) -#define PROPERTYNAME_DOCWARN_SAVEORSEND OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_DOCWARN_SAVEORSEND )) -#define PROPERTYNAME_DOCWARN_SIGNING OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_DOCWARN_SIGNING )) -#define PROPERTYNAME_DOCWARN_PRINT OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_DOCWARN_PRINT )) -#define PROPERTYNAME_DOCWARN_CREATEPDF OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_DOCWARN_CREATEPDF )) -#define PROPERTYNAME_DOCWARN_REMOVEPERSONALINFO OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_DOCWARN_REMOVEPERSONALINFO )) -#define PROPERTYNAME_DOCWARN_RECOMMENDPASSWORD OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_DOCWARN_RECOMMENDPASSWORD )) -#define PROPERTYNAME_CTRLCLICK_HYPERLINK OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_CTRLCLICK_HYPERLINK )) -#define PROPERTYNAME_MACRO_SECLEVEL OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_MACRO_SECLEVEL )) -#define PROPERTYNAME_MACRO_TRUSTEDAUTHORS OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_MACRO_TRUSTEDAUTHORS )) -#define PROPERTYNAME_MACRO_DISABLE OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_MACRO_DISABLE )) -#define PROPERTYNAME_TRUSTEDAUTHOR_SUBJECTNAME OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_TRUSTEDAUTHOR_SUBJECTNAME)) -#define PROPERTYNAME_TRUSTEDAUTHOR_SERIALNUMBER OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_TRUSTEDAUTHOR_SERIALNUMBER)) -#define PROPERTYNAME_TRUSTEDAUTHOR_RAWDATA OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_TRUSTEDAUTHOR_RAWDATA)) - -// xmlsec05 depricated -#define PROPERTYNAME_STAROFFICEBASIC OUString(RTL_CONSTASCII_USTRINGPARAM("OfficeBasic" )) -#define PROPERTYNAME_EXECUTEPLUGINS OUString(RTL_CONSTASCII_USTRINGPARAM("ExecutePlugins" )) -#define PROPERTYNAME_WARNINGENABLED OUString(RTL_CONSTASCII_USTRINGPARAM("Warning" )) -#define PROPERTYNAME_CONFIRMATIONENABLED OUString(RTL_CONSTASCII_USTRINGPARAM("Confirmation" )) -// xmlsec05 depricated - - -#define PROPERTYHANDLE_SECUREURL 0 - -// xmlsec05 depricated -#define PROPERTYHANDLE_STAROFFICEBASIC 1 -#define PROPERTYHANDLE_EXECUTEPLUGINS 2 -#define PROPERTYHANDLE_WARNINGENABLED 3 -#define PROPERTYHANDLE_CONFIRMATIONENABLED 4 -// xmlsec05 depricated - -#define PROPERTYHANDLE_DOCWARN_SAVEORSEND 5 -#define PROPERTYHANDLE_DOCWARN_SIGNING 6 -#define PROPERTYHANDLE_DOCWARN_PRINT 7 -#define PROPERTYHANDLE_DOCWARN_CREATEPDF 8 -#define PROPERTYHANDLE_DOCWARN_REMOVEPERSONALINFO 9 -#define PROPERTYHANDLE_DOCWARN_RECOMMENDPASSWORD 10 -#define PROPERTYHANDLE_CTRLCLICK_HYPERLINK 11 -#define PROPERTYHANDLE_MACRO_SECLEVEL 12 -#define PROPERTYHANDLE_MACRO_TRUSTEDAUTHORS 13 -#define PROPERTYHANDLE_MACRO_DISABLE 14 - -#define PROPERTYCOUNT 15 -#define PROPERTYHANDLE_INVALID -1 - -#define CFG_READONLY_DEFAULT sal_False - -//_________________________________________________________________________________________________________________ -// private declarations! -//_________________________________________________________________________________________________________________ - -class SvtSecurityOptions_Impl : public ConfigItem -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - SvtSecurityOptions_Impl(); - ~SvtSecurityOptions_Impl(); - - //--------------------------------------------------------------------------------------------------------- - // overloaded methods of baseclass - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short called for notify of configmanager - @descr These method is called from the ConfigManager before application ends or from the - PropertyChangeListener if the sub tree broadcasts changes. You must update your - internal values. - - @seealso baseclass ConfigItem - - @param "seqPropertyNames" is the list of properties which should be updated. - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Notify( const Sequence< OUString >& seqPropertyNames ); - - /*-****************************************************************************************************//** - @short write changes to configuration - @descr These method writes the changed values into the sub tree - and should always called in our destructor to guarantee consistency of config data. - - @seealso baseclass ConfigItem - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Commit(); - - //--------------------------------------------------------------------------------------------------------- - // public interface - //--------------------------------------------------------------------------------------------------------- - - sal_Bool IsReadOnly ( SvtSecurityOptions::EOption eOption ) const ; - - Sequence< OUString > GetSecureURLs ( ) const ; - void SetSecureURLs ( const Sequence< OUString >& seqURLList ) ; - sal_Bool IsSecureURL ( const OUString& sURL, - const OUString& sReferer ) const ; - inline sal_Int32 GetMacroSecurityLevel ( ) const ; - void SetMacroSecurityLevel ( sal_Int32 _nLevel ) ; - - inline sal_Bool IsMacroDisabled ( ) const ; - - Sequence< SvtSecurityOptions::Certificate > GetTrustedAuthors ( ) const ; - void SetTrustedAuthors ( const Sequence< SvtSecurityOptions::Certificate >& rAuthors ) ; - sal_Bool IsTrustedAuthorsEnabled ( ) ; - - sal_Bool IsOptionSet ( SvtSecurityOptions::EOption eOption ) const ; - sal_Bool SetOption ( SvtSecurityOptions::EOption eOption, sal_Bool bValue ) ; - sal_Bool IsOptionEnabled ( SvtSecurityOptions::EOption eOption ) const ; -private: - - /*-****************************************************************************************************//** - @short return list of key names of ouer configuration management which represent our module tree - @descr These methods return a static const list of key names. We need it to get needed values from our - configuration management. - - @seealso - - - @param - - @return A list of needed configuration keys is returned. - - @onerror - - *//*-*****************************************************************************************************/ - - void SetProperty( sal_Int32 nHandle, const Any& rValue, sal_Bool bReadOnly ); - void LoadAuthors( void ); - static sal_Int32 GetHandle( const OUString& rPropertyName ); - bool GetOption( SvtSecurityOptions::EOption eOption, sal_Bool*& rpValue, sal_Bool*& rpRO ); - - static Sequence< OUString > GetPropertyNames(); - - Sequence< OUString > m_seqSecureURLs; - sal_Bool m_bSaveOrSend; - sal_Bool m_bSigning; - sal_Bool m_bPrint; - sal_Bool m_bCreatePDF; - sal_Bool m_bRemoveInfo; - sal_Bool m_bRecommendPwd; - sal_Bool m_bCtrlClickHyperlink; - sal_Int32 m_nSecLevel; - Sequence< SvtSecurityOptions::Certificate > m_seqTrustedAuthors; - sal_Bool m_bDisableMacros; - - sal_Bool m_bROSecureURLs; - sal_Bool m_bROSaveOrSend; - sal_Bool m_bROSigning; - sal_Bool m_bROPrint; - sal_Bool m_bROCreatePDF; - sal_Bool m_bRORemoveInfo; - sal_Bool m_bRORecommendPwd; - sal_Bool m_bROCtrlClickHyperlink; - sal_Bool m_bROSecLevel; - sal_Bool m_bROTrustedAuthors; - sal_Bool m_bRODisableMacros; - - - // xmlsec05 depricated - EBasicSecurityMode m_eBasicMode; - sal_Bool m_bExecutePlugins; - sal_Bool m_bWarning; - sal_Bool m_bConfirmation; - - sal_Bool m_bROConfirmation; - sal_Bool m_bROWarning; - sal_Bool m_bROExecutePlugins; - sal_Bool m_bROBasicMode; - public: - sal_Bool IsWarningEnabled() const; - void SetWarningEnabled( sal_Bool bSet ); - sal_Bool IsConfirmationEnabled() const; - void SetConfirmationEnabled( sal_Bool bSet ); - sal_Bool IsExecutePlugins() const; - void SetExecutePlugins( sal_Bool bSet ); - EBasicSecurityMode GetBasicMode ( ) const ; - void SetBasicMode ( EBasicSecurityMode eMode ) ; -}; - -//_________________________________________________________________________________________________________________ -// definitions -//_________________________________________________________________________________________________________________ - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtSecurityOptions_Impl::SvtSecurityOptions_Impl() - :ConfigItem ( ROOTNODE_SECURITY ) - ,m_seqSecureURLs ( DEFAULT_SECUREURL ) - ,m_bSaveOrSend ( sal_True ) - ,m_bSigning ( sal_True ) - ,m_bPrint ( sal_True ) - ,m_bCreatePDF ( sal_True ) - ,m_bRemoveInfo ( sal_True ) - ,m_nSecLevel ( sal_True ) - ,m_seqTrustedAuthors ( DEFAULT_TRUSTEDAUTHORS ) - ,m_bDisableMacros ( sal_False ) - ,m_bROSecureURLs ( CFG_READONLY_DEFAULT ) - ,m_bROSaveOrSend ( CFG_READONLY_DEFAULT ) - ,m_bROSigning ( CFG_READONLY_DEFAULT ) - ,m_bROPrint ( CFG_READONLY_DEFAULT ) - ,m_bROCreatePDF ( CFG_READONLY_DEFAULT ) - ,m_bRORemoveInfo ( CFG_READONLY_DEFAULT ) - ,m_bROSecLevel ( CFG_READONLY_DEFAULT ) - ,m_bROTrustedAuthors ( CFG_READONLY_DEFAULT ) - ,m_bRODisableMacros ( sal_True ) // currently is not intended to be changed - - // xmlsec05 depricated - , m_eBasicMode ( DEFAULT_STAROFFICEBASIC ) - , m_bExecutePlugins ( sal_True ) - , m_bWarning ( sal_True ) - , m_bConfirmation ( sal_True ) - , m_bROConfirmation ( CFG_READONLY_DEFAULT ) - , m_bROWarning ( CFG_READONLY_DEFAULT ) - , m_bROExecutePlugins ( CFG_READONLY_DEFAULT ) - , m_bROBasicMode ( CFG_READONLY_DEFAULT ) - // xmlsec05 depricated - -{ - Sequence< OUString > seqNames = GetPropertyNames ( ); - Sequence< Any > seqValues = GetProperties ( seqNames ); - Sequence< sal_Bool > seqRO = GetReadOnlyStates ( seqNames ); - - // Safe impossible cases. - // We need values from ALL configuration keys. - // Follow assignment use order of values in relation to our list of key names! - DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtSecurityOptions_Impl::SvtSecurityOptions_Impl()\nI miss some values of configuration keys!\n" ); - - // Copy values from list in right order to our internal member. - sal_Int32 nPropertyCount = seqValues.getLength(); - for( sal_Int32 nProperty = 0 ; nProperty < nPropertyCount ; ++nProperty ) - SetProperty( nProperty, seqValues[ nProperty ], seqRO[ nProperty ] ); - - LoadAuthors(); - - // Enable notification mechanism of our baseclass. - // We need it to get information about changes outside these class on our used configuration keys!*/ - - EnableNotification( seqNames ); -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtSecurityOptions_Impl::~SvtSecurityOptions_Impl() -{ - if( IsModified() ) - Commit(); -} - -void SvtSecurityOptions_Impl::SetProperty( sal_Int32 nProperty, const Any& rValue, sal_Bool bRO ) -{ - switch( nProperty ) - { - case PROPERTYHANDLE_SECUREURL: - { - m_seqSecureURLs.realloc( 0 ); - rValue >>= m_seqSecureURLs; - SvtPathOptions aOpt; - sal_uInt32 nCount = m_seqSecureURLs.getLength(); - for( sal_uInt32 nItem = 0 ; nItem < nCount ; ++nItem ) - m_seqSecureURLs[ nItem ] = aOpt.SubstituteVariable( m_seqSecureURLs[ nItem ] ); - m_bROSecureURLs = bRO; - } - break; - - case PROPERTYHANDLE_DOCWARN_SAVEORSEND: - { - rValue >>= m_bSaveOrSend; - m_bROSaveOrSend = bRO; - } - break; - - case PROPERTYHANDLE_DOCWARN_SIGNING: - { - rValue >>= m_bSigning; - m_bROSigning = bRO; - } - break; - - case PROPERTYHANDLE_DOCWARN_PRINT: - { - rValue >>= m_bPrint; - m_bROPrint = bRO; - } - break; - - case PROPERTYHANDLE_DOCWARN_CREATEPDF: - { - rValue >>= m_bCreatePDF; - m_bROCreatePDF = bRO; - } - break; - - case PROPERTYHANDLE_DOCWARN_REMOVEPERSONALINFO: - { - rValue >>= m_bRemoveInfo; - m_bRORemoveInfo = bRO; - } - break; - - case PROPERTYHANDLE_DOCWARN_RECOMMENDPASSWORD: - { - rValue >>= m_bRecommendPwd; - m_bRORecommendPwd = bRO; - } - break; - - case PROPERTYHANDLE_CTRLCLICK_HYPERLINK: - { - rValue >>= m_bCtrlClickHyperlink; - m_bROCtrlClickHyperlink = bRO; - } - break; - - case PROPERTYHANDLE_MACRO_SECLEVEL: - { - rValue >>= m_nSecLevel; - m_bROSecLevel = bRO; - } - break; - - case PROPERTYHANDLE_MACRO_TRUSTEDAUTHORS: - { - // don't care about value here... - m_bROTrustedAuthors = bRO; - } - break; - - case PROPERTYHANDLE_MACRO_DISABLE: - { - rValue >>= m_bDisableMacros; - m_bRODisableMacros = bRO; - } - break; - - - // xmlsec05 depricated - case PROPERTYHANDLE_STAROFFICEBASIC: - { - sal_Int32 nMode = 0; - rValue >>= nMode; - m_eBasicMode = (EBasicSecurityMode)nMode; - m_bROBasicMode = bRO; - } - break; - case PROPERTYHANDLE_EXECUTEPLUGINS: - { - rValue >>= m_bExecutePlugins; - m_bROExecutePlugins = bRO; - } - break; - case PROPERTYHANDLE_WARNINGENABLED: - { - rValue >>= m_bWarning; - m_bROWarning = bRO; - } - break; - case PROPERTYHANDLE_CONFIRMATIONENABLED: - { - rValue >>= m_bConfirmation; - m_bROConfirmation = bRO; - } - break; - // xmlsec05 depricated - - - #if OSL_DEBUG_LEVEL > 1 - default: - DBG_ASSERT( false, "SvtSecurityOptions_Impl::SetProperty()\nUnkown property!\n" ); - #endif - } -} - -void SvtSecurityOptions_Impl::LoadAuthors( void ) -{ - m_seqTrustedAuthors.realloc( 0 ); // first clear - Sequence< OUString > lAuthors = GetNodeNames( PROPERTYNAME_MACRO_TRUSTEDAUTHORS ); - sal_Int32 c1 = lAuthors.getLength(); - if( c1 ) - { - sal_Int32 c2 = c1 * 3; // 3 Properties inside Struct TrustedAuthor - Sequence< OUString > lAllAuthors( c2 ); - - sal_Int32 i1; - sal_Int32 i2; - OUString aSep( RTL_CONSTASCII_USTRINGPARAM( "/" ) ); - for( i1 = 0, i2 = 0 ; i1 < c1 ; ++i1 ) - { - lAllAuthors[ i2 ] = PROPERTYNAME_MACRO_TRUSTEDAUTHORS + aSep + lAuthors[ i1 ] + aSep + PROPERTYNAME_TRUSTEDAUTHOR_SUBJECTNAME; - ++i2; - lAllAuthors[ i2 ] = PROPERTYNAME_MACRO_TRUSTEDAUTHORS + aSep + lAuthors[ i1 ] + aSep + PROPERTYNAME_TRUSTEDAUTHOR_SERIALNUMBER; - ++i2; - lAllAuthors[ i2 ] = PROPERTYNAME_MACRO_TRUSTEDAUTHORS + aSep + lAuthors[ i1 ] + aSep + PROPERTYNAME_TRUSTEDAUTHOR_RAWDATA; - ++i2; - } - - Sequence< Any > lValues = GetProperties( lAllAuthors ); - if( lValues.getLength() == c2 ) - { - m_seqTrustedAuthors.realloc( c1 ); - SvtSecurityOptions::Certificate aCert( 3 ); - for( i1 = 0, i2 = 0 ; i1 < c1 ; ++i1 ) - { - lValues[ i2 ] >>= aCert[ 0 ]; - ++i2; - lValues[ i2 ] >>= aCert[ 1 ]; - ++i2; - lValues[ i2 ] >>= aCert[ 2 ]; - ++i2; - m_seqTrustedAuthors[ i1 ] = aCert; - } - } - } -} - -sal_Int32 SvtSecurityOptions_Impl::GetHandle( const OUString& rName ) -{ - sal_Int32 nHandle; - - if( rName.compareToAscii( CSTR_SECUREURL ) == 0 ) - nHandle = PROPERTYHANDLE_SECUREURL; - else if( rName.compareToAscii( CSTR_DOCWARN_SAVEORSEND ) == 0 ) - nHandle = PROPERTYHANDLE_DOCWARN_SAVEORSEND; - else if( rName.compareToAscii( CSTR_DOCWARN_SIGNING ) == 0 ) - nHandle = PROPERTYHANDLE_DOCWARN_SIGNING; - else if( rName.compareToAscii( CSTR_DOCWARN_PRINT ) == 0 ) - nHandle = PROPERTYHANDLE_DOCWARN_PRINT; - else if( rName.compareToAscii( CSTR_DOCWARN_CREATEPDF ) == 0 ) - nHandle = PROPERTYHANDLE_DOCWARN_CREATEPDF; - else if( rName.compareToAscii( CSTR_DOCWARN_REMOVEPERSONALINFO ) == 0 ) - nHandle = PROPERTYHANDLE_DOCWARN_REMOVEPERSONALINFO; - else if( rName.compareToAscii( CSTR_DOCWARN_RECOMMENDPASSWORD ) == 0 ) - nHandle = PROPERTYHANDLE_DOCWARN_RECOMMENDPASSWORD; - else if( rName.compareToAscii( CSTR_CTRLCLICK_HYPERLINK ) == 0 ) - nHandle = PROPERTYHANDLE_CTRLCLICK_HYPERLINK; - else if( rName.compareToAscii( CSTR_MACRO_SECLEVEL ) == 0 ) - nHandle = PROPERTYHANDLE_MACRO_SECLEVEL; - else if( rName.compareToAscii( CSTR_MACRO_TRUSTEDAUTHORS ) == 0 ) - nHandle = PROPERTYHANDLE_MACRO_TRUSTEDAUTHORS; - else if( rName.compareToAscii( CSTR_MACRO_DISABLE ) == 0 ) - nHandle = PROPERTYHANDLE_MACRO_DISABLE; - - // xmlsec05 depricated - else if( rName == PROPERTYNAME_STAROFFICEBASIC ) - nHandle = PROPERTYHANDLE_STAROFFICEBASIC; - else if( rName == PROPERTYNAME_EXECUTEPLUGINS ) - nHandle = PROPERTYHANDLE_EXECUTEPLUGINS; - else if( rName == PROPERTYNAME_WARNINGENABLED ) - nHandle = PROPERTYHANDLE_WARNINGENABLED; - else if( rName == PROPERTYNAME_CONFIRMATIONENABLED ) - nHandle = PROPERTYHANDLE_CONFIRMATIONENABLED; - // xmlsec05 depricated - - else - nHandle = PROPERTYHANDLE_INVALID; - - return nHandle; -} - -bool SvtSecurityOptions_Impl::GetOption( SvtSecurityOptions::EOption eOption, sal_Bool*& rpValue, sal_Bool*& rpRO ) -{ - switch( eOption ) - { - case SvtSecurityOptions::E_DOCWARN_SAVEORSEND: - rpValue = &m_bSaveOrSend; - rpRO = &m_bROSaveOrSend; - break; - case SvtSecurityOptions::E_DOCWARN_SIGNING: - rpValue = &m_bSigning; - rpRO = &m_bROSigning; - break; - case SvtSecurityOptions::E_DOCWARN_PRINT: - rpValue = &m_bPrint; - rpRO = &m_bROPrint; - break; - case SvtSecurityOptions::E_DOCWARN_CREATEPDF: - rpValue = &m_bCreatePDF; - rpRO = &m_bROCreatePDF; - break; - case SvtSecurityOptions::E_DOCWARN_REMOVEPERSONALINFO: - rpValue = &m_bRemoveInfo; - rpRO = &m_bRORemoveInfo; - break; - case SvtSecurityOptions::E_DOCWARN_RECOMMENDPASSWORD: - rpValue = &m_bRecommendPwd; - rpRO = &m_bRORecommendPwd; - break; - case SvtSecurityOptions::E_CTRLCLICK_HYPERLINK: - rpValue = &m_bCtrlClickHyperlink; - rpRO = &m_bROCtrlClickHyperlink; - break; - default: - rpValue = NULL; - rpRO = NULL; - break; - } - - return rpValue != NULL; -} - -void SvtSecurityOptions_Impl::Notify( const Sequence< OUString >& seqPropertyNames ) -{ - // Use given list of updated properties to get his values from configuration directly! - Sequence< Any > seqValues = GetProperties( seqPropertyNames ); - Sequence< sal_Bool > seqRO = GetReadOnlyStates( seqPropertyNames ); - // Safe impossible cases. - // We need values from ALL notified configuration keys. - DBG_ASSERT( !(seqPropertyNames.getLength()!=seqValues.getLength()), "SvtSecurityOptions_Impl::Notify()\nI miss some values of configuration keys!\n" ); - // Step over list of property names and get right value from coreesponding value list to set it on internal members! - sal_Int32 nCount = seqPropertyNames.getLength(); - for( sal_Int32 nProperty = 0 ; nProperty < nCount ; ++nProperty ) - SetProperty( GetHandle( seqPropertyNames[ nProperty ] ), seqValues[ nProperty ], seqRO[ nProperty ] ); - - // read set of trusted authors separately - LoadAuthors(); -} - -void SvtSecurityOptions_Impl::Commit() -{ - // Get names of supported properties, create a list for values and copy current values to it. - Sequence< OUString > lOrgNames = GetPropertyNames(); - sal_Int32 nOrgCount = lOrgNames.getLength(); - - Sequence< OUString > lNames(nOrgCount); - Sequence< Any > lValues(nOrgCount); - sal_Int32 nRealCount = 0; - bool bDone; - - ClearNodeSet( PROPERTYNAME_MACRO_TRUSTEDAUTHORS ); - - for( sal_Int32 nProperty = 0 ; nProperty < nOrgCount ; ++nProperty ) - { - switch( nProperty ) - { - case PROPERTYHANDLE_SECUREURL: - { - bDone = !m_bROSecureURLs; - if( bDone ) - { - Sequence< OUString > lURLs( m_seqSecureURLs ); - SvtPathOptions aOpt; - sal_Int32 nURLsCnt = lURLs.getLength(); - for( sal_Int32 nItem = 0 ; nItem < nURLsCnt ; ++nItem ) - lURLs[ nItem ] = aOpt.UseVariable( lURLs[ nItem ] ); - lValues[ nRealCount ] <<= lURLs; - } - } - break; - - case PROPERTYHANDLE_DOCWARN_SAVEORSEND: - { - bDone = !m_bROSaveOrSend; - if( bDone ) - lValues[ nRealCount ] <<= m_bSaveOrSend; - } - break; - - case PROPERTYHANDLE_DOCWARN_SIGNING: - { - bDone = !m_bROSigning; - if( bDone ) - lValues[ nRealCount ] <<= m_bSigning; - } - break; - - case PROPERTYHANDLE_DOCWARN_PRINT: - { - bDone = !m_bROPrint; - if( bDone ) - lValues[ nRealCount ] <<= m_bPrint; - } - break; - - case PROPERTYHANDLE_DOCWARN_CREATEPDF: - { - bDone = !m_bROCreatePDF; - if( bDone ) - lValues[ nRealCount ] <<= m_bCreatePDF; - } - break; - - case PROPERTYHANDLE_DOCWARN_REMOVEPERSONALINFO: - { - bDone = !m_bRORemoveInfo; - if( bDone ) - lValues[ nRealCount ] <<= m_bRemoveInfo; - } - break; - - case PROPERTYHANDLE_DOCWARN_RECOMMENDPASSWORD: - { - bDone = !m_bRORecommendPwd; - if( bDone ) - lValues[ nRealCount ] <<= m_bRecommendPwd; - } - break; - - case PROPERTYHANDLE_CTRLCLICK_HYPERLINK: - { - bDone = !m_bROCtrlClickHyperlink; - if( bDone ) - lValues[ nRealCount ] <<= m_bCtrlClickHyperlink; - } - break; - - case PROPERTYHANDLE_MACRO_SECLEVEL: - { - bDone = !m_bROSecLevel; - if( bDone ) - lValues[ nRealCount ] <<= m_nSecLevel; - } - break; - - case PROPERTYHANDLE_MACRO_TRUSTEDAUTHORS: - { - bDone = !m_bROTrustedAuthors; - if( bDone ) - { - sal_Int32 nCnt = m_seqTrustedAuthors.getLength(); - if( nCnt ) - { - String s; - s.AppendAscii( CSTR_MACRO_TRUSTEDAUTHORS ); - s.AppendAscii( "/a" ); - - Sequence< Sequence< com::sun::star::beans::PropertyValue > > lPropertyValuesSeq( nCnt ); - for( sal_Int32 i = 0 ; i < nCnt ; ++i ) - { - String aPrefix( s ); - aPrefix += String::CreateFromInt32( i ); - aPrefix.AppendAscii( "/" ); - Sequence< com::sun::star::beans::PropertyValue > lPropertyValues( 3 ); - lPropertyValues[ 0 ].Name = aPrefix + PROPERTYNAME_TRUSTEDAUTHOR_SUBJECTNAME; - lPropertyValues[ 0 ].Value <<= m_seqTrustedAuthors[ i ][0]; - lPropertyValues[ 1 ].Name = aPrefix + PROPERTYNAME_TRUSTEDAUTHOR_SERIALNUMBER; - lPropertyValues[ 1 ].Value <<= m_seqTrustedAuthors[ i ][1]; - lPropertyValues[ 2 ].Name = aPrefix + PROPERTYNAME_TRUSTEDAUTHOR_RAWDATA; - lPropertyValues[ 2 ].Value <<= m_seqTrustedAuthors[ i ][2]; - - - SetSetProperties( PROPERTYNAME_MACRO_TRUSTEDAUTHORS, lPropertyValues ); - } - - bDone = false; // because we save in loop above! - } - else - bDone = false; - } - } - break; - - case PROPERTYHANDLE_MACRO_DISABLE: - { - bDone = !m_bRODisableMacros; - if( bDone ) - lValues[ nRealCount ] <<= (sal_Bool)m_bDisableMacros; - } - break; - - - // xmlsec05 depricated - case PROPERTYHANDLE_STAROFFICEBASIC: - { - bDone = !m_bROBasicMode; - if( bDone ) - lValues[ nRealCount ] <<= (sal_Int32)m_eBasicMode; - } - break; - case PROPERTYHANDLE_EXECUTEPLUGINS: - { - bDone = !m_bROExecutePlugins; - if( bDone ) - lValues[ nRealCount ] <<= m_bExecutePlugins; - } - break; - case PROPERTYHANDLE_WARNINGENABLED: - { - bDone = !m_bROWarning; - if( bDone ) - lValues[ nRealCount ] <<= m_bWarning; - } - break; - case PROPERTYHANDLE_CONFIRMATIONENABLED: - { - bDone = !m_bROConfirmation; - if( bDone ) - lValues[ nRealCount ] <<= m_bConfirmation; - } - break; - // xmlsec05 depricated - - - default: - bDone = false; - } - - if( bDone ) - { - lNames[ nRealCount ] = lOrgNames[ nProperty ]; - ++nRealCount; - } - } - // Set properties in configuration. - lNames.realloc(nRealCount); - lValues.realloc(nRealCount); - PutProperties( lNames, lValues ); -} - -sal_Bool SvtSecurityOptions_Impl::IsReadOnly( SvtSecurityOptions::EOption eOption ) const -{ - sal_Bool bReadonly; - switch(eOption) - { - case SvtSecurityOptions::E_SECUREURLS : - bReadonly = m_bROSecureURLs; - break; - case SvtSecurityOptions::E_DOCWARN_SAVEORSEND: - bReadonly = m_bROSaveOrSend; - break; - case SvtSecurityOptions::E_DOCWARN_SIGNING: - bReadonly = m_bROSigning; - break; - case SvtSecurityOptions::E_DOCWARN_PRINT: - bReadonly = m_bROPrint; - break; - case SvtSecurityOptions::E_DOCWARN_CREATEPDF: - bReadonly = m_bROCreatePDF; - break; - case SvtSecurityOptions::E_DOCWARN_REMOVEPERSONALINFO: - bReadonly = m_bRORemoveInfo; - break; - case SvtSecurityOptions::E_DOCWARN_RECOMMENDPASSWORD: - bReadonly = m_bRORecommendPwd; - break; - case SvtSecurityOptions::E_MACRO_SECLEVEL: - bReadonly = m_bROSecLevel; - break; - case SvtSecurityOptions::E_MACRO_TRUSTEDAUTHORS: - bReadonly = m_bROTrustedAuthors; - break; - case SvtSecurityOptions::E_MACRO_DISABLE: - bReadonly = m_bRODisableMacros; - break; - case SvtSecurityOptions::E_CTRLCLICK_HYPERLINK: - bReadonly = m_bROCtrlClickHyperlink; - break; - - - // xmlsec05 depricated - case SvtSecurityOptions::E_BASICMODE: - bReadonly = m_bROBasicMode; - break; - case SvtSecurityOptions::E_EXECUTEPLUGINS: - bReadonly = m_bROExecutePlugins; - break; - case SvtSecurityOptions::E_WARNING: - bReadonly = m_bROWarning; - break; - case SvtSecurityOptions::E_CONFIRMATION: - bReadonly = m_bROConfirmation; - break; - // xmlsec05 depricated - - - default: - bReadonly = sal_True; - } - - return bReadonly; -} - -Sequence< OUString > SvtSecurityOptions_Impl::GetSecureURLs() const -{ - return m_seqSecureURLs; -} - -void SvtSecurityOptions_Impl::SetSecureURLs( const Sequence< OUString >& seqURLList ) -{ - DBG_ASSERT(!m_bROSecureURLs, "SvtSecurityOptions_Impl::SetSecureURLs()\nYou tried to write on a readonly value!\n"); - if (!m_bROSecureURLs && m_seqSecureURLs!=seqURLList) - { - m_seqSecureURLs = seqURLList; - SetModified(); - } -} - -sal_Bool SvtSecurityOptions_Impl::IsSecureURL( const OUString& sURL , - const OUString& sReferer) const -{ - sal_Bool bState = sal_False; - - // Check for uncritical protocols first - // All protocols different from "macro..." and "slot..." are secure per definition and must not be checked. - // "macro://#..." means AppBasic macros that are considered safe - INetURLObject aURL ( sURL ); - INetProtocol aProtocol = aURL.GetProtocol(); - - // All other URLs must checked in combination with referer and internal information about security - if ( (aProtocol != INET_PROT_MACRO && aProtocol != INET_PROT_SLOT) || - aURL.GetMainURL( INetURLObject::NO_DECODE ).matchIgnoreAsciiCaseAsciiL( "macro:///", 9 ) == 0) - { - // security check only for "macro" ( without app basic ) or "slot" protocols - bState = sal_True; - } - else - { - // check list of allowed URL patterns - // Trusted referer given? - // NO => bState will be false per default - // YES => search for it in our internal url list - if( sReferer.getLength() > 0 ) - { - // Search in internal list - ::rtl::OUString sRef = sReferer.toAsciiLowerCase(); - sal_uInt32 nCount = m_seqSecureURLs.getLength(); - for( sal_uInt32 nItem=0; nItem 3 || _nLevel < 0 ) - _nLevel = 3; - - if( m_nSecLevel != _nLevel ) - { - m_nSecLevel = _nLevel; - SetModified(); - } - } -} - -Sequence< SvtSecurityOptions::Certificate > SvtSecurityOptions_Impl::GetTrustedAuthors() const -{ - return m_seqTrustedAuthors; -} - -void SvtSecurityOptions_Impl::SetTrustedAuthors( const Sequence< SvtSecurityOptions::Certificate >& rAuthors ) -{ - DBG_ASSERT(!m_bROTrustedAuthors, "SvtSecurityOptions_Impl::SetTrustedAuthors()\nYou tried to write on a readonly value!\n"); - if( !m_bROTrustedAuthors && rAuthors != m_seqTrustedAuthors ) - { - m_seqTrustedAuthors = rAuthors; - SetModified(); - } -} - -sal_Bool SvtSecurityOptions_Impl::IsTrustedAuthorsEnabled() -{ - return m_bROTrustedAuthors; -} - -sal_Bool SvtSecurityOptions_Impl::IsOptionSet( SvtSecurityOptions::EOption eOption ) const -{ - sal_Bool* pValue; - sal_Bool* pRO; - sal_Bool bRet = sal_False; - - if( ( const_cast< SvtSecurityOptions_Impl* >( this ) )->GetOption( eOption, pValue, pRO ) ) - bRet = *pValue; - - return bRet; -} - -sal_Bool SvtSecurityOptions_Impl::SetOption( SvtSecurityOptions::EOption eOption, sal_Bool bValue ) -{ - sal_Bool* pValue; - sal_Bool* pRO; - sal_Bool bRet = sal_False; - - if( GetOption( eOption, pValue, pRO ) ) - { - if( !*pRO ) - { - bRet = sal_True; - if( *pValue != bValue ) - { - *pValue = bValue; - SetModified(); - } - } - } - - return bRet; -} - -sal_Bool SvtSecurityOptions_Impl::IsOptionEnabled( SvtSecurityOptions::EOption eOption ) const -{ - sal_Bool* pValue; - sal_Bool* pRO; - sal_Bool bRet = sal_False; - - if( ( const_cast< SvtSecurityOptions_Impl* >( this ) )->GetOption( eOption, pValue, pRO ) ) - bRet = !*pRO; - - return bRet; -} - -Sequence< OUString > SvtSecurityOptions_Impl::GetPropertyNames() -{ - // Build static list of configuration key names. - static const OUString pProperties[] = - { - PROPERTYNAME_SECUREURL, - PROPERTYNAME_STAROFFICEBASIC, - PROPERTYNAME_EXECUTEPLUGINS, - PROPERTYNAME_WARNINGENABLED, - PROPERTYNAME_CONFIRMATIONENABLED, - PROPERTYNAME_DOCWARN_SAVEORSEND, - PROPERTYNAME_DOCWARN_SIGNING, - PROPERTYNAME_DOCWARN_PRINT, - PROPERTYNAME_DOCWARN_CREATEPDF, - PROPERTYNAME_DOCWARN_REMOVEPERSONALINFO, - PROPERTYNAME_DOCWARN_RECOMMENDPASSWORD, - PROPERTYNAME_CTRLCLICK_HYPERLINK, - PROPERTYNAME_MACRO_SECLEVEL, - PROPERTYNAME_MACRO_TRUSTEDAUTHORS, - PROPERTYNAME_MACRO_DISABLE - }; - // Initialize return sequence with these list ... - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); - // ... and return it. - return seqPropertyNames; -} - -//***************************************************************************************************************** -// initialize static member -// DON'T DO IT IN YOUR HEADER! -// see definition for further informations -//***************************************************************************************************************** -SvtSecurityOptions_Impl* SvtSecurityOptions::m_pDataContainer = NULL ; -sal_Int32 SvtSecurityOptions::m_nRefCount = 0 ; - -SvtSecurityOptions::SvtSecurityOptions() -{ - // Global access, must be guarded (multithreading!). - MutexGuard aGuard( GetInitMutex() ); - // Increase ouer refcount ... - ++m_nRefCount; - // ... and initialize ouer data container only if it not already exist! - if( m_pDataContainer == NULL ) - { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtSecurityOptions_Impl::ctor()"); - m_pDataContainer = new SvtSecurityOptions_Impl; - - ItemHolder1::holdConfigItem(E_SECURITYOPTIONS); - } -} - -SvtSecurityOptions::~SvtSecurityOptions() -{ - // Global access, must be guarded (multithreading!) - MutexGuard aGuard( GetInitMutex() ); - // Decrease ouer refcount. - --m_nRefCount; - // If last instance was deleted ... - // we must destroy ouer static data container! - if( m_nRefCount <= 0 ) - { - delete m_pDataContainer; - m_pDataContainer = NULL; - } -} - -sal_Bool SvtSecurityOptions::IsReadOnly( EOption eOption ) const -{ - MutexGuard aGuard( GetInitMutex() ); - return m_pDataContainer->IsReadOnly(eOption); -} - -Sequence< OUString > SvtSecurityOptions::GetSecureURLs() const -{ - MutexGuard aGuard( GetInitMutex() ); - return m_pDataContainer->GetSecureURLs(); -} - -void SvtSecurityOptions::SetSecureURLs( const Sequence< OUString >& seqURLList ) -{ - MutexGuard aGuard( GetInitMutex() ); - m_pDataContainer->SetSecureURLs( seqURLList ); -} - -sal_Bool SvtSecurityOptions::IsSecureURL( const OUString& sURL , - const OUString& sReferer ) const -{ - MutexGuard aGuard( GetInitMutex() ); - return m_pDataContainer->IsSecureURL( sURL, sReferer ); -} - -sal_Int32 SvtSecurityOptions::GetMacroSecurityLevel() const -{ - MutexGuard aGuard( GetInitMutex() ); - return m_pDataContainer->GetMacroSecurityLevel(); -} - -void SvtSecurityOptions::SetMacroSecurityLevel( sal_Int32 _nLevel ) -{ - MutexGuard aGuard( GetInitMutex() ); - m_pDataContainer->SetMacroSecurityLevel( _nLevel ); -} - -sal_Bool SvtSecurityOptions::IsMacroDisabled() const -{ - MutexGuard aGuard( GetInitMutex() ); - return m_pDataContainer->IsMacroDisabled(); -} - -Sequence< SvtSecurityOptions::Certificate > SvtSecurityOptions::GetTrustedAuthors() const -{ - MutexGuard aGuard( GetInitMutex() ); - return m_pDataContainer->GetTrustedAuthors(); -} - -void SvtSecurityOptions::SetTrustedAuthors( const Sequence< Certificate >& rAuthors ) -{ - MutexGuard aGuard( GetInitMutex() ); - m_pDataContainer->SetTrustedAuthors( rAuthors ); -} - -sal_Bool SvtSecurityOptions::IsTrustedAuthorsEnabled() -{ - MutexGuard aGuard( GetInitMutex() ); - return m_pDataContainer->IsTrustedAuthorsEnabled(); -} - -bool SvtSecurityOptions::IsOptionSet( EOption eOption ) const -{ - MutexGuard aGuard( GetInitMutex() ); - return m_pDataContainer->IsOptionSet( eOption ); -} - -bool SvtSecurityOptions::SetOption( EOption eOption, bool bValue ) -{ - MutexGuard aGuard( GetInitMutex() ); - return m_pDataContainer->SetOption( eOption, bValue ); -} - -bool SvtSecurityOptions::IsOptionEnabled( EOption eOption ) const -{ - MutexGuard aGuard( GetInitMutex() ); - return m_pDataContainer->IsOptionEnabled( eOption ); -} - -Mutex& SvtSecurityOptions::GetInitMutex() -{ - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be faster then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; -} - - - - -// xmlsec05 depricated - -EBasicSecurityMode SvtSecurityOptions_Impl::GetBasicMode() const -{ - return m_eBasicMode; -} - -void SvtSecurityOptions_Impl::SetBasicMode( EBasicSecurityMode eMode ) -{ - DBG_ASSERT(!m_bROBasicMode, "SvtSecurityOptions_Impl::SetBasicMode()\nYou tried to write on a readonly value!\n"); - if (!m_bROBasicMode && m_eBasicMode!=eMode) - { - m_eBasicMode = eMode; - SetModified(); - } -} - -sal_Bool SvtSecurityOptions_Impl::IsExecutePlugins() const -{ - return m_bExecutePlugins; -} - -void SvtSecurityOptions_Impl::SetExecutePlugins( sal_Bool bSet ) -{ - DBG_ASSERT(!m_bROExecutePlugins, "SvtSecurityOptions_Impl::SetExecutePlugins()\nYou tried to write on a readonly value!\n"); - if (!m_bROExecutePlugins && m_bExecutePlugins!=bSet) - { - m_bExecutePlugins = bSet; - SetModified(); - } -} - -sal_Bool SvtSecurityOptions_Impl::IsWarningEnabled() const -{ - return m_bWarning; -} - -void SvtSecurityOptions_Impl::SetWarningEnabled( sal_Bool bSet ) -{ - DBG_ASSERT(!m_bROWarning, "SvtSecurityOptions_Impl::SetWarningEnabled()\nYou tried to write on a readonly value!\n"); - if (!m_bROWarning && m_bWarning!=bSet) - { - m_bWarning = bSet; - SetModified(); - } -} - -sal_Bool SvtSecurityOptions_Impl::IsConfirmationEnabled() const -{ - return m_bConfirmation; -} - -void SvtSecurityOptions_Impl::SetConfirmationEnabled( sal_Bool bSet ) -{ - DBG_ASSERT(!m_bROConfirmation, "SvtSecurityOptions_Impl::SetConfirmationEnabled()\nYou tried to write on a readonly value!\n"); - if (!m_bROConfirmation && m_bConfirmation!=bSet) - { - m_bConfirmation = bSet; - SetModified(); - } -} - - -sal_Bool SvtSecurityOptions::IsExecutePlugins() const -{ - MutexGuard aGuard( GetInitMutex() ); - return m_pDataContainer->IsExecutePlugins(); -} - -void SvtSecurityOptions::SetExecutePlugins( sal_Bool bSet ) -{ - MutexGuard aGuard( GetInitMutex() ); - m_pDataContainer->SetExecutePlugins( bSet ); -} - -sal_Bool SvtSecurityOptions::IsWarningEnabled() const -{ - MutexGuard aGuard( GetInitMutex() ); - return m_pDataContainer->IsWarningEnabled(); -} - -void SvtSecurityOptions::SetWarningEnabled( sal_Bool bSet ) -{ - MutexGuard aGuard( GetInitMutex() ); - m_pDataContainer->SetWarningEnabled( bSet ); -} - -sal_Bool SvtSecurityOptions::IsConfirmationEnabled() const -{ - MutexGuard aGuard( GetInitMutex() ); - return m_pDataContainer->IsConfirmationEnabled(); -} - -void SvtSecurityOptions::SetConfirmationEnabled( sal_Bool bSet ) -{ - MutexGuard aGuard( GetInitMutex() ); - m_pDataContainer->SetConfirmationEnabled( bSet ); -} - -void SvtSecurityOptions::SetBasicMode( EBasicSecurityMode eMode ) -{ - MutexGuard aGuard( GetInitMutex() ); - m_pDataContainer->SetBasicMode( eMode ); -} - -EBasicSecurityMode SvtSecurityOptions::GetBasicMode() const -{ - MutexGuard aGuard( GetInitMutex() ); - return m_pDataContainer->GetBasicMode(); -} - diff --git a/svtools/source/config/sourceviewconfig.cxx b/svtools/source/config/sourceviewconfig.cxx deleted file mode 100644 index 40b41d571751..000000000000 --- a/svtools/source/config/sourceviewconfig.cxx +++ /dev/null @@ -1,281 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: sourceviewconfig.cxx,v $ - * $Revision: 1.8 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace utl; -using namespace rtl; -using namespace com::sun::star::uno; -namespace svt -{ -class SourceViewConfig_Impl : public utl::ConfigItem, public SfxBroadcaster -{ -private: - OUString m_sFontName; - sal_Int16 m_nFontHeight; - sal_Bool m_bProportionalFontOnly; - - void Load(); - - static Sequence< OUString > GetPropertyNames(); - -public: - SourceViewConfig_Impl(); - ~SourceViewConfig_Impl(); - - virtual void Notify( const Sequence< rtl::OUString >& aPropertyNames ); - virtual void Commit(); - - const rtl::OUString& GetFontName() const - {return m_sFontName;} - void SetFontName(const rtl::OUString& rName) - { - if(rName != m_sFontName) - { - m_sFontName = rName; - SetModified(); - } - } - - sal_Int16 GetFontHeight() const - {return m_nFontHeight;} - void SetFontHeight(sal_Int16 nHeight) - { - if(m_nFontHeight != nHeight) - { - m_nFontHeight = nHeight; - SetModified(); - } - } - - sal_Bool IsShowProportionalFontsOnly() const - {return m_bProportionalFontOnly;} - void SetShowProportionalFontsOnly(sal_Bool bSet) - { - if(m_bProportionalFontOnly != bSet) - { - m_bProportionalFontOnly = bSet; - SetModified(); - } - } -}; -// initialization of static members -------------------------------------- -SourceViewConfig_Impl* SourceViewConfig::m_pImplConfig = 0; -sal_Int32 SourceViewConfig::m_nRefCount = 0; -namespace { struct lclMutex : public rtl::Static< ::osl::Mutex, lclMutex > {}; } -/* -----------------------------28.08.2002 16:45------------------------------ - - ---------------------------------------------------------------------------*/ -SourceViewConfig_Impl::SourceViewConfig_Impl() : - ConfigItem(OUString::createFromAscii("Office.Common/Font/SourceViewFont")), - m_nFontHeight(12), - m_bProportionalFontOnly(sal_False) -{ - Load(); -} -/* -----------------------------28.08.2002 16:45------------------------------ - - ---------------------------------------------------------------------------*/ -SourceViewConfig_Impl::~SourceViewConfig_Impl() -{ -} -/* -----------------------------28.08.2002 16:25------------------------------ - - ---------------------------------------------------------------------------*/ -Sequence< OUString > SourceViewConfig_Impl::GetPropertyNames() -{ - //this list needs exactly to mach the enum PropertyNameIndex - static const char* aPropNames[] = - { - "FontName" // 0 - ,"FontHeight" // 1 - ,"NonProportionalFontsOnly" // 2 - }; - const int nCount = sizeof( aPropNames ) / sizeof( const char* ); - Sequence< OUString > aNames( nCount ); - OUString* pNames = aNames.getArray(); - for ( int i = 0; i < nCount; i++ ) - pNames[i] = OUString::createFromAscii( aPropNames[i] ); - - return aNames; -} - -/*-- 28.08.2002 16:37:59--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SourceViewConfig_Impl::Load() -{ - Sequence< OUString > aNames = GetPropertyNames(); - Sequence< Any > aValues = GetProperties( aNames ); - EnableNotification( aNames ); - const Any* pValues = aValues.getConstArray(); - DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" ); - if ( aValues.getLength() == aNames.getLength() ) - { - for ( int nProp = 0; nProp < aNames.getLength(); nProp++ ) - { - if ( pValues[nProp].hasValue() ) - { - switch( nProp ) - { - case 0: pValues[nProp] >>= m_sFontName; break; - case 1: pValues[nProp] >>= m_nFontHeight; break; - case 2: pValues[nProp] >>= m_bProportionalFontOnly; break; - } - } - } - } -} -/*-- 28.08.2002 16:38:00--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SourceViewConfig_Impl::Notify( const Sequence< OUString >& ) -{ - Load(); -} -/*-- 28.08.2002 16:38:00--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SourceViewConfig_Impl::Commit() -{ - ClearModified(); - Sequence< OUString > aNames = GetPropertyNames(); - Sequence< Any > aValues( aNames.getLength() ); - Any* pValues = aValues.getArray(); - for ( int nProp = 0; nProp < aNames.getLength(); nProp++ ) - { - switch( nProp ) - { - case 0: pValues[nProp] <<= m_sFontName; break; - case 1: pValues[nProp] <<= m_nFontHeight; break; - case 2: pValues[nProp] <<= m_bProportionalFontOnly; break; - default: - DBG_ERRORFILE( "invalid index to save a user token" ); - } - } - PutProperties( aNames, aValues ); - - //notify SfxListener - { - SfxSimpleHint aHint = SfxSimpleHint( SFX_HINT_DATACHANGED ); - Broadcast(aHint); - } -} -/*-- 28.08.2002 16:32:19--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SourceViewConfig::SourceViewConfig() -{ - { - ::osl::MutexGuard aGuard( lclMutex::get() ); - if(!m_pImplConfig) - { - m_pImplConfig = new SourceViewConfig_Impl; - ItemHolder1::holdConfigItem(E_SOURCEVIEWCONFIG); - } - - ++m_nRefCount; - } - StartListening( *m_pImplConfig, TRUE ); -} -/*-- 28.08.2002 16:32:19--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SourceViewConfig::~SourceViewConfig() -{ - EndListening( *m_pImplConfig, TRUE ); - ::osl::MutexGuard aGuard( lclMutex::get() ); - if( !--m_nRefCount ) - { - if( m_pImplConfig->IsModified() ) - m_pImplConfig->Commit(); - DELETEZ( m_pImplConfig ); - } -} -/*-- 28.08.2002 16:32:19--------------------------------------------------- - - -----------------------------------------------------------------------*/ -const OUString& SourceViewConfig::GetFontName() const -{ - return m_pImplConfig->GetFontName(); -} -/*-- 28.08.2002 16:32:20--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SourceViewConfig::SetFontName(const OUString& rName) -{ - m_pImplConfig->SetFontName(rName); -} -/*-- 28.08.2002 16:32:20--------------------------------------------------- - - -----------------------------------------------------------------------*/ -sal_Int16 SourceViewConfig::GetFontHeight() const -{ - return m_pImplConfig->GetFontHeight(); -} -/*-- 28.08.2002 16:32:20--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SourceViewConfig::SetFontHeight(sal_Int16 nHeight) -{ - m_pImplConfig->SetFontHeight(nHeight); -} -/*-- 28.08.2002 16:32:20--------------------------------------------------- - - -----------------------------------------------------------------------*/ -sal_Bool SourceViewConfig::IsShowProportionalFontsOnly() const -{ - return m_pImplConfig->IsShowProportionalFontsOnly(); -} -/*-- 28.08.2002 16:32:20--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SourceViewConfig::SetShowProportionalFontsOnly(sal_Bool bSet) -{ - m_pImplConfig->SetShowProportionalFontsOnly(bSet); -} -/* -----------------------------30.08.2002 10:40------------------------------ - - ---------------------------------------------------------------------------*/ -void SourceViewConfig::Notify( SfxBroadcaster&, const SfxHint& rHint ) -{ - Broadcast( rHint ); -} -}//namespace svt diff --git a/svtools/source/config/startoptions.cxx b/svtools/source/config/startoptions.cxx deleted file mode 100644 index 08f4a7e0500e..000000000000 --- a/svtools/source/config/startoptions.cxx +++ /dev/null @@ -1,461 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: startoptions.cxx,v $ - * $Revision: 1.16 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include -#include -#include -#include -#include -#include - -#include -#include "itemholder1.hxx" -//_________________________________________________________________________________________________________________ -// namespaces -//_________________________________________________________________________________________________________________ - -using namespace ::utl ; -using namespace ::rtl ; -using namespace ::osl ; -using namespace ::com::sun::star::uno ; - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -#define DEFAULT_SHOWINTRO sal_True -#define DEFAULT_CONNECTIONURL OUString() - -#define ROOTNODE_START OUString(RTL_CONSTASCII_USTRINGPARAM("Setup/Office" )) -#define PROPERTYNAME_SHOWINTRO OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupShowIntro" )) -#define PROPERTYNAME_CONNECTIONURL OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupConnectionURL" )) - -#define PROPERTYHANDLE_SHOWINTRO 0 -#define PROPERTYHANDLE_CONNECTIONURL 1 - -#define PROPERTYCOUNT 2 - -//_________________________________________________________________________________________________________________ -// private declarations! -//_________________________________________________________________________________________________________________ - -class SvtStartOptions_Impl : public ConfigItem -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - SvtStartOptions_Impl(); - ~SvtStartOptions_Impl(); - - //--------------------------------------------------------------------------------------------------------- - // overloaded methods of baseclass - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short called for notify of configmanager - @descr These method is called from the ConfigManager before application ends or from the - PropertyChangeListener if the sub tree broadcasts changes. You must update your - internal values. - - @ATTENTION We don't implement these method - because we support readonly values at runtime only! - - @seealso baseclass ConfigItem - - @param "seqPropertyNames" is the list of properties which should be updated. - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Notify( const Sequence< OUString >& seqPropertyNames ); - - /*-****************************************************************************************************//** - @short write changes to configuration - @descr These method writes the changed values into the sub tree - and should always called in our destructor to guarantee consistency of config data. - - @ATTENTION We don't implement these method - because we support readonly values at runtime only! - - @seealso baseclass ConfigItem - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Commit(); - - //--------------------------------------------------------------------------------------------------------- - // public interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short access method to get internal values - @descr These method give us a chance to regulate acces to ouer internal values. - It's not used in the moment - but it's possible for the feature! - - @seealso - - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - sal_Bool IsIntroEnabled ( ) const ; - void EnableIntro ( sal_Bool bState ) ; - OUString GetConnectionURL( ) const ; - void SetConnectionURL( const OUString& sURL ) ; - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return list of fix key names of ouer configuration management which represent oue module tree - @descr These methods return a static const list of key names. We need it to get needed values from our - configuration management. We return well known key names only - because the "UserData" node - is handled in a special way! - - @seealso - - - @param - - @return A list of needed configuration keys is returned. - - @onerror - - *//*-*****************************************************************************************************/ - - static Sequence< OUString > impl_GetPropertyNames(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - sal_Bool m_bShowIntro ; /// cache "ShowIntro" of Start section - OUString m_sConnectionURL ; /// cache "Connection" of Start section -}; - -//_________________________________________________________________________________________________________________ -// definitions -//_________________________________________________________________________________________________________________ - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtStartOptions_Impl::SvtStartOptions_Impl() - // Init baseclasses first - : ConfigItem ( ROOTNODE_START ) - // Init member then. - , m_bShowIntro ( DEFAULT_SHOWINTRO ) -{ - // Use our static list of configuration keys to get his values. - Sequence< OUString > seqNames = impl_GetPropertyNames(); - Sequence< Any > seqValues = GetProperties( seqNames ) ; - - // Safe impossible cases. - // We need values from ALL configuration keys. - // Follow assignment use order of values in relation to our list of key names! - DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtStartOptions_Impl::SvtStartOptions_Impl()\nI miss some values of configuration keys!\n" ); - - // Copy values from list in right order to ouer internal member. - sal_Int32 nPropertyCount = seqValues.getLength() ; - sal_Int32 nProperty = 0 ; - for( nProperty=0; nProperty>= m_bShowIntro; - } - break; - - case PROPERTYHANDLE_CONNECTIONURL : { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_STRING), "SvtStartOptions_Impl::SvtStartOptions_Impl()\nWho has changed the value type of \"Office.Common\\Start\\Connection\"?" ); - seqValues[nProperty] >>= m_sConnectionURL; - } - break; - } - } - - // Don't enable notification mechanism of ouer baseclass! - // We support readonly variables in the moment. -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtStartOptions_Impl::~SvtStartOptions_Impl() -{ - // We must save our current values .. if user forget it! - if( IsModified() == sal_True ) - { - Commit(); - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtStartOptions_Impl::Notify( const Sequence< OUString >& seqPropertyNames ) -{ - // Use given list of updated properties to get his values from configuration directly! - Sequence< Any > seqValues = GetProperties( seqPropertyNames ); - // Safe impossible cases. - // We need values from ALL notified configuration keys. - DBG_ASSERT( !(seqPropertyNames.getLength()!=seqValues.getLength()), "SvtStartOptions_Impl::Notify()\nI miss some values of configuration keys!\n" ); - // Step over list of property names and get right value from coreesponding value list to set it on internal members! - sal_Int32 nCount = seqPropertyNames.getLength(); - for( sal_Int32 nProperty=0; nProperty>= m_bShowIntro; - } - else - if( seqPropertyNames[nProperty] == PROPERTYNAME_CONNECTIONURL ) - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_STRING), "SvtStartOptions_Impl::Notify()\nWho has changed the value type of \"Office.Common\\Start\\Connection\"?" ); - seqValues[nProperty] >>= m_sConnectionURL; - } - #if OSL_DEBUG_LEVEL > 1 - else DBG_ASSERT( sal_False, "SvtStartOptions_Impl::Notify()\nUnkown property detected ... I can't handle these!\n" ); - #endif - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtStartOptions_Impl::Commit() -{ - // Get names of supported properties, create a list for values and copy current values to it. - Sequence< OUString > seqNames = impl_GetPropertyNames(); - sal_Int32 nCount = seqNames.getLength(); - Sequence< Any > seqValues ( nCount ); - for( sal_Int32 nProperty=0; nProperty SvtStartOptions_Impl::impl_GetPropertyNames() -{ - // Build static list of configuration key names. - static const OUString pProperties[] = - { - PROPERTYNAME_SHOWINTRO , - PROPERTYNAME_CONNECTIONURL , - }; - // Initialize return sequence with these list ... - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); - // ... and return it. - return seqPropertyNames; -} - -//***************************************************************************************************************** -// initialize static member -// DON'T DO IT IN YOUR HEADER! -// see definition for further informations -//***************************************************************************************************************** -SvtStartOptions_Impl* SvtStartOptions::m_pDataContainer = NULL ; -sal_Int32 SvtStartOptions::m_nRefCount = 0 ; - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtStartOptions::SvtStartOptions() -{ - // Global access, must be guarded (multithreading!). - MutexGuard aGuard( GetOwnStaticMutex() ); - // Increase ouer refcount ... - ++m_nRefCount; - // ... and initialize ouer data container only if it not already! - if( m_pDataContainer == NULL ) - { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtStartOptions_Impl::ctor()"); - m_pDataContainer = new SvtStartOptions_Impl(); - - ItemHolder1::holdConfigItem(E_STARTOPTIONS); - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtStartOptions::~SvtStartOptions() -{ - // Global access, must be guarded (multithreading!) - MutexGuard aGuard( GetOwnStaticMutex() ); - // Decrease ouer refcount. - --m_nRefCount; - // If last instance was deleted ... - // we must destroy ouer static data container! - if( m_nRefCount <= 0 ) - { - delete m_pDataContainer; - m_pDataContainer = NULL; - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtStartOptions::IsIntroEnabled() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsIntroEnabled(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtStartOptions::EnableIntro( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->EnableIntro( bState ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -OUString SvtStartOptions::GetConnectionURL() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetConnectionURL(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtStartOptions::SetConnectionURL( const OUString& sURL ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetConnectionURL( sURL ); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Mutex& SvtStartOptions::GetOwnStaticMutex() -{ - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; -} diff --git a/svtools/source/config/test/test.cxx b/svtools/source/config/test/test.cxx index 4090f7cb8bf5..1ac0038b5131 100644 --- a/svtools/source/config/test/test.cxx +++ b/svtools/source/config/test/test.cxx @@ -42,7 +42,7 @@ // my own includes //_________________________________________________________________________________________________________________ -#include +#include //_________________________________________________________________________________________________________________ // interface includes diff --git a/svtools/source/config/undoopt.cxx b/svtools/source/config/undoopt.cxx deleted file mode 100644 index a0c74ef84aac..000000000000 --- a/svtools/source/config/undoopt.cxx +++ /dev/null @@ -1,220 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: undoopt.cxx,v $ - * $Revision: 1.14 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION - -#include -#include "rtl/instance.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "itemholder2.hxx" - -using namespace utl; -using namespace rtl; -using namespace com::sun::star::uno; - -static SvtUndoOptions_Impl* pOptions = NULL; -static sal_Int32 nRefCount = 0; - -#define STEPS 0 - -class SvtUndoOptions_Impl : public utl::ConfigItem, public SfxBroadcaster -{ - sal_Int32 nUndoCount; - Sequence< rtl::OUString > m_aPropertyNames; - -public: - SvtUndoOptions_Impl(); - - virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); - virtual void Commit(); - void Load(); - - void SetUndoCount( sal_Int32 n ) { nUndoCount = n; SetModified(); } - sal_Int32 GetUndoCount() const { return nUndoCount; } -}; - -// ----------------------------------------------------------------------- - -SvtUndoOptions_Impl::SvtUndoOptions_Impl() - : ConfigItem( OUString::createFromAscii("Office.Common/Undo") ) - , nUndoCount( 20 ) -{ - Load(); -} - -void SvtUndoOptions_Impl::Commit() -{ - Sequence< Any > aValues( m_aPropertyNames.getLength() ); - Any* pValues = aValues.getArray(); - for ( int nProp = 0; nProp < m_aPropertyNames.getLength(); nProp++ ) - { - switch ( nProp ) - { - case STEPS : - pValues[nProp] <<= nUndoCount; - break; - default: - DBG_ERRORFILE( "invalid index to save a path" ); - } - } - - PutProperties( m_aPropertyNames, aValues ); - //broadcast changes - Broadcast(SfxSimpleHint(SFX_HINT_UNDO_OPTIONS_CHANGED)); -} - -// ----------------------------------------------------------------------- -void SvtUndoOptions_Impl::Load() -{ - if(!m_aPropertyNames.getLength()) - { - static const char* aPropNames[] = - { - "Steps", - }; - - const int nCount = sizeof( aPropNames ) / sizeof( const char* ); - m_aPropertyNames.realloc(nCount); - OUString* pNames = m_aPropertyNames.getArray(); - for ( int i = 0; i < nCount; i++ ) - pNames[i] = OUString::createFromAscii( aPropNames[i] ); - EnableNotification( m_aPropertyNames ); - } - - Sequence< Any > aValues = GetProperties( m_aPropertyNames ); - const Any* pValues = aValues.getConstArray(); - DBG_ASSERT( aValues.getLength() == m_aPropertyNames.getLength(), "GetProperties failed" ); - if ( aValues.getLength() == m_aPropertyNames.getLength() ) - { - for ( int nProp = 0; nProp < m_aPropertyNames.getLength(); nProp++ ) - { - DBG_ASSERT( pValues[nProp].hasValue(), "property value missing" ); - if ( pValues[nProp].hasValue() ) - { - switch ( nProp ) - { - case STEPS : - { - sal_Int32 nTemp = 0; - if ( pValues[nProp] >>= nTemp ) - nUndoCount = nTemp; - else - { - DBG_ERROR( "Wrong Type!" ); - } - break; - } - - default: - DBG_ERROR( "Wrong Type!" ); - break; - } - } - } - } -} -// ----------------------------------------------------------------------- -void SvtUndoOptions_Impl::Notify( const Sequence& ) -{ - Load(); - //broadcast changes - Broadcast(SfxSimpleHint(SFX_HINT_UNDO_OPTIONS_CHANGED)); -} - -// ----------------------------------------------------------------------- -namespace -{ - class LocalSingleton : public rtl::Static< osl::Mutex, LocalSingleton > - { - }; -} - -// ----------------------------------------------------------------------- -SvtUndoOptions::SvtUndoOptions() -{ - // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( LocalSingleton::get() ); - if ( !pOptions ) - { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtUndoOptions_Impl::ctor()"); - pOptions = new SvtUndoOptions_Impl; - - ItemHolder2::holdConfigItem(E_UNDOOPTIONS); - } - ++nRefCount; - pImp = pOptions; - StartListening(*pImp); -} - -// ----------------------------------------------------------------------- - -SvtUndoOptions::~SvtUndoOptions() -{ - // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( LocalSingleton::get() ); - EndListening(*pImp); - if ( !--nRefCount ) - { - if ( pOptions->IsModified() ) - pOptions->Commit(); - DELETEZ( pOptions ); - } -} - -void SvtUndoOptions::SetUndoCount( sal_Int32 n ) -{ - pImp->SetUndoCount( n ); -} - -sal_Int32 SvtUndoOptions::GetUndoCount() const -{ - return pImp->GetUndoCount(); -} - -void SvtUndoOptions::Notify( SfxBroadcaster&, const SfxHint& rHint ) -{ - vos::OGuard aVclGuard( Application::GetSolarMutex() ); - Broadcast( rHint ); -} - diff --git a/svtools/source/config/useroptions.cxx b/svtools/source/config/useroptions.cxx deleted file mode 100644 index 4eafbefe54a3..000000000000 --- a/svtools/source/config/useroptions.cxx +++ /dev/null @@ -1,1313 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: useroptions.cxx,v $ - * $Revision: 1.24.238.2 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION - -#include -#include "configitems/useroptions_const.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "itemholder2.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace utl; -using namespace rtl; -using namespace com::sun::star; -using namespace com::sun::star::uno; - -namespace css = ::com::sun::star; - -// class SvtUserOptions_Impl --------------------------------------------- -class SvtUserOptions_Impl; -class SvtUserConfigChangeListener_Impl : public cppu::WeakImplHelper1 -< - com::sun::star::util::XChangesListener -> -{ - SvtUserOptions_Impl& m_rParent; - public: - SvtUserConfigChangeListener_Impl(SvtUserOptions_Impl& rParent); - ~SvtUserConfigChangeListener_Impl(); - - //XChangesListener - virtual void SAL_CALL changesOccurred( const util::ChangesEvent& Event ) throw(RuntimeException); - //XEventListener - virtual void SAL_CALL disposing( const lang::EventObject& Source ) throw(RuntimeException); -}; - -class SvtUserOptions_Impl : public SfxBroadcaster -{ -public: - SvtUserOptions_Impl(); - ~SvtUserOptions_Impl(); - - // get the user token - ::rtl::OUString GetCompany() const; - ::rtl::OUString GetFirstName() const; - ::rtl::OUString GetLastName() const; - ::rtl::OUString GetID() const; - ::rtl::OUString GetStreet() const; - ::rtl::OUString GetCity() const; - ::rtl::OUString GetState() const; - ::rtl::OUString GetZip() const; - ::rtl::OUString GetCountry() const; - ::rtl::OUString GetPosition() const; - ::rtl::OUString GetTitle() const; - ::rtl::OUString GetTelephoneHome() const; - ::rtl::OUString GetTelephoneWork() const; - ::rtl::OUString GetFax() const; - ::rtl::OUString GetEmail() const; - ::rtl::OUString GetCustomerNumber() const; - ::rtl::OUString GetFathersName() const; - ::rtl::OUString GetApartment() const; - - ::rtl::OUString GetFullName() const; - ::rtl::OUString GetLocale() const { return m_aLocale; } - - // set the address token - void SetCompany( const ::rtl::OUString& rNewToken ); - void SetFirstName( const ::rtl::OUString& rNewToken ); - void SetLastName( const ::rtl::OUString& rNewToken ); - void SetID( const ::rtl::OUString& rNewToken ); - void SetStreet( const ::rtl::OUString& rNewToken ); - void SetCity( const ::rtl::OUString& rNewToken ); - void SetState( const ::rtl::OUString& rNewToken ); - void SetZip( const ::rtl::OUString& rNewToken ); - void SetCountry( const ::rtl::OUString& rNewToken ); - void SetPosition( const ::rtl::OUString& rNewToken ); - void SetTitle( const ::rtl::OUString& rNewToken ); - void SetTelephoneHome( const ::rtl::OUString& rNewToken ); - void SetTelephoneWork( const ::rtl::OUString& rNewToken ); - void SetFax( const ::rtl::OUString& rNewToken ); - void SetEmail( const ::rtl::OUString& rNewToken ); - void SetCustomerNumber( const ::rtl::OUString& rNewToken ); - void SetFathersName( const ::rtl::OUString& rNewToken ); - void SetApartment( const ::rtl::OUString& rNewToken ); - - sal_Bool IsTokenReadonly( USHORT nToken ) const; - ::rtl::OUString GetToken(USHORT nToken) const; - void Notify(); - -private: - uno::Reference< util::XChangesListener > m_xChangeListener; - css::uno::Reference< css::container::XNameAccess > m_xCfg; - css::uno::Reference< css::beans::XPropertySet > m_xData; - ::rtl::OUString m_aLocale; -}; - -// global ---------------------------------------------------------------- - -static SvtUserOptions_Impl* pOptions = NULL; -static sal_Int32 nRefCount = 0; - -#define READONLY_DEFAULT sal_False - -/*-- 16.06.2009 14:22:56--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SvtUserConfigChangeListener_Impl::SvtUserConfigChangeListener_Impl(SvtUserOptions_Impl& rParent) : - m_rParent( rParent ) -{ -} -/*-- 16.06.2009 14:22:56--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SvtUserConfigChangeListener_Impl::~SvtUserConfigChangeListener_Impl() -{ -} -/*-- 16.06.2009 14:22:56--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SvtUserConfigChangeListener_Impl::changesOccurred( const util::ChangesEvent& rEvent ) throw(RuntimeException) -{ - if(rEvent.Changes.getLength()) - m_rParent.Notify(); -} -/*-- 16.06.2009 14:22:56--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SvtUserConfigChangeListener_Impl::disposing( const lang::EventObject& rSource ) throw(RuntimeException) -{ - try - { - uno::Reference< util::XChangesNotifier > xChgNot( rSource.Source, UNO_QUERY_THROW); - xChgNot->removeChangesListener(this); - } - catch(Exception& ) - { - } -} - -// class SvtUserOptions_Impl --------------------------------------------- - -// ----------------------------------------------------------------------- -SvtUserOptions_Impl::SvtUserOptions_Impl() : - m_xChangeListener( new SvtUserConfigChangeListener_Impl(*this) ) -{ - try - { - m_xCfg = Reference< css::container::XNameAccess > ( - ::comphelper::ConfigurationHelper::openConfig( - utl::getProcessServiceFactory(), - s_sData, - ::comphelper::ConfigurationHelper::E_STANDARD), - css::uno::UNO_QUERY ); - - m_xData = css::uno::Reference< css::beans::XPropertySet >(m_xCfg, css::uno::UNO_QUERY); - uno::Reference< util::XChangesNotifier > xChgNot( m_xCfg, UNO_QUERY); - try - { - xChgNot->addChangesListener( m_xChangeListener ); - } - catch(RuntimeException& ) - { - } - } - catch(const css::uno::Exception& ex) - { - m_xCfg.clear(); - LogHelper::logIt(ex); - } - - Any aAny = ConfigManager::GetConfigManager()->GetDirectConfigProperty( ConfigManager::LOCALE ); - ::rtl::OUString aLocale; - if ( aAny >>= aLocale ) - m_aLocale = aLocale; - else - { - DBG_ERRORFILE( "SvtUserOptions_Impl::SvtUserOptions_Impl(): no locale found" ); - } -} - -// ----------------------------------------------------------------------- - -SvtUserOptions_Impl::~SvtUserOptions_Impl() -{ -} - -::rtl::OUString SvtUserOptions_Impl::GetCompany() const -{ - ::rtl::OUString sCompany; - - try - { - m_xData->getPropertyValue(s_so) >>= sCompany; - } - catch ( const css::uno::Exception& ex ) - { - LogHelper::logIt(ex); - } - - return sCompany; -} - -::rtl::OUString SvtUserOptions_Impl::GetFirstName() const -{ - ::rtl::OUString sFirstName; - - try - { - m_xData->getPropertyValue(s_sgivenname) >>= sFirstName; - } - catch ( const css::uno::Exception& ex ) - { - LogHelper::logIt(ex); - } - - return sFirstName; -} - -::rtl::OUString SvtUserOptions_Impl::GetLastName() const -{ - ::rtl::OUString sLastName; - - try - { - m_xData->getPropertyValue(s_ssn) >>= sLastName; - } - catch ( const css::uno::Exception& ex ) - { - LogHelper::logIt(ex); - } - - return sLastName; -} - -::rtl::OUString SvtUserOptions_Impl::GetID() const -{ - ::rtl::OUString sID; - - try - { - m_xData->getPropertyValue(s_sinitials) >>= sID; - } - catch ( const css::uno::Exception& ex ) - { - LogHelper::logIt(ex); - } - - return sID; -} - -::rtl::OUString SvtUserOptions_Impl::GetStreet() const -{ - ::rtl::OUString sStreet; - - try - { - m_xData->getPropertyValue(s_sstreet) >>= sStreet; - } - catch ( const css::uno::Exception& ex ) - { - LogHelper::logIt(ex); - } - - return sStreet; -} - -::rtl::OUString SvtUserOptions_Impl::GetCity() const -{ - ::rtl::OUString sCity; - - try - { - m_xData->getPropertyValue(s_sl) >>= sCity; - } - catch ( const css::uno::Exception& ex ) - { - LogHelper::logIt(ex); - } - - return sCity; -} - -::rtl::OUString SvtUserOptions_Impl::GetState() const -{ - ::rtl::OUString sState; - - try - { - m_xData->getPropertyValue(s_sst) >>= sState; - } - catch ( const css::uno::Exception& ex ) - { - LogHelper::logIt(ex); - } - - return sState; -} - -::rtl::OUString SvtUserOptions_Impl::GetZip() const -{ - ::rtl::OUString sZip; - - try - { - m_xData->getPropertyValue(s_spostalcode) >>= sZip; - } - catch ( const css::uno::Exception& ex ) - { - LogHelper::logIt(ex); - } - - return sZip; -} - -::rtl::OUString SvtUserOptions_Impl::GetCountry() const -{ - ::rtl::OUString sCountry; - - try - { - m_xData->getPropertyValue(s_sc) >>= sCountry; - } - catch ( const css::uno::Exception& ex ) - { - LogHelper::logIt(ex); - } - - return sCountry; -} - -::rtl::OUString SvtUserOptions_Impl::GetPosition() const -{ - ::rtl::OUString sPosition; - - try - { - m_xData->getPropertyValue(s_sposition) >>= sPosition; - } - catch ( const css::uno::Exception& ex ) - { - LogHelper::logIt(ex); - } - - return sPosition; -} - -::rtl::OUString SvtUserOptions_Impl::GetTitle() const -{ - ::rtl::OUString sTitle; - - try - { - m_xData->getPropertyValue(s_stitle) >>= sTitle; - } - catch ( const css::uno::Exception& ex ) - { - LogHelper::logIt(ex); - } - - return sTitle; -} - -::rtl::OUString SvtUserOptions_Impl::GetTelephoneHome() const -{ - ::rtl::OUString sTelephoneHome; - - try - { - m_xData->getPropertyValue(s_shomephone) >>= sTelephoneHome; - } - catch ( const css::uno::Exception& ex ) - { - LogHelper::logIt(ex); - } - - return sTelephoneHome; -} - -::rtl::OUString SvtUserOptions_Impl::GetTelephoneWork() const -{ - ::rtl::OUString sTelephoneWork; - - try - { - m_xData->getPropertyValue(s_stelephonenumber) >>= sTelephoneWork; - } - catch ( const css::uno::Exception& ex ) - { - LogHelper::logIt(ex); - } - - return sTelephoneWork; -} - -::rtl::OUString SvtUserOptions_Impl::GetFax() const -{ - ::rtl::OUString sFax; - - try - { - m_xData->getPropertyValue(s_sfacsimiletelephonenumber) >>= sFax; - } - catch ( const css::uno::Exception& ex ) - { - LogHelper::logIt(ex); - } - - return sFax; -} - -::rtl::OUString SvtUserOptions_Impl::GetEmail() const -{ - ::rtl::OUString sEmail; - - try - { - m_xData->getPropertyValue(s_smail) >>= sEmail; - } - catch ( const css::uno::Exception& ex ) - { - LogHelper::logIt(ex); - } - - return sEmail; -} - -::rtl::OUString SvtUserOptions_Impl::GetCustomerNumber() const -{ - ::rtl::OUString sCustomerNumber; - - try - { - m_xData->getPropertyValue(s_scustomernumber) >>= sCustomerNumber; - } - catch ( const css::uno::Exception& ex ) - { - LogHelper::logIt(ex); - } - - return sCustomerNumber; -} - -::rtl::OUString SvtUserOptions_Impl::GetFathersName() const -{ - ::rtl::OUString sFathersName; - - try - { - m_xData->getPropertyValue(s_sfathersname) >>= sFathersName; - } - catch ( const css::uno::Exception& ex ) - { - LogHelper::logIt(ex); - } - - return sFathersName; -} - -::rtl::OUString SvtUserOptions_Impl::GetApartment() const -{ - ::rtl::OUString sApartment; - - try - { - m_xData->getPropertyValue(s_sapartment) >>= sApartment; - } - catch ( const css::uno::Exception& ex ) - { - LogHelper::logIt(ex); - } - - return sApartment; -} - -void SvtUserOptions_Impl::SetCompany( const ::rtl::OUString& sCompany ) -{ - try - { - m_xData->setPropertyValue(s_so, css::uno::makeAny(::rtl::OUString(sCompany))); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - catch ( const css::uno::Exception& ex) - { - LogHelper::logIt(ex); - } -} - -void SvtUserOptions_Impl::SetFirstName( const ::rtl::OUString& sFirstName ) -{ - try - { - m_xData->setPropertyValue(s_sgivenname, css::uno::makeAny(::rtl::OUString(sFirstName))); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - catch ( const css::uno::Exception& ex) - { - LogHelper::logIt(ex); - } -} - -void SvtUserOptions_Impl::SetLastName( const ::rtl::OUString& sLastName ) -{ - try - { - m_xData->setPropertyValue(s_ssn, css::uno::makeAny(::rtl::OUString(sLastName))); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - catch ( const css::uno::Exception& ex) - { - LogHelper::logIt(ex); - } -} -void SvtUserOptions_Impl::SetID( const ::rtl::OUString& sID ) -{ - try - { - m_xData->setPropertyValue(s_sinitials, css::uno::makeAny(::rtl::OUString(sID))); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - catch ( const css::uno::Exception& ex) - { - LogHelper::logIt(ex); - } -} - -void SvtUserOptions_Impl::SetStreet( const ::rtl::OUString& sStreet ) -{ - try - { - m_xData->setPropertyValue(s_sstreet, css::uno::makeAny(::rtl::OUString(sStreet))); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - catch ( const css::uno::Exception& ex) - { - LogHelper::logIt(ex); - } -} - -void SvtUserOptions_Impl::SetCity( const ::rtl::OUString& sCity ) -{ - try - { - m_xData->setPropertyValue(s_sl, css::uno::makeAny(::rtl::OUString(sCity))); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - catch ( const css::uno::Exception& ex) - { - LogHelper::logIt(ex); - } -} - -void SvtUserOptions_Impl::SetState( const ::rtl::OUString& sState ) -{ - try - { - m_xData->setPropertyValue(s_sst, css::uno::makeAny(::rtl::OUString(sState))); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - catch ( const css::uno::Exception& ex) - { - LogHelper::logIt(ex); - } -} - -void SvtUserOptions_Impl::SetZip( const ::rtl::OUString& sZip ) -{ - try - { - m_xData->setPropertyValue(s_spostalcode, css::uno::makeAny(::rtl::OUString(sZip))); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - catch ( const css::uno::Exception& ex) - { - LogHelper::logIt(ex); - } -} - -void SvtUserOptions_Impl::SetCountry( const ::rtl::OUString& sCountry ) -{ - try - { - m_xData->setPropertyValue(s_sc, css::uno::makeAny(::rtl::OUString(sCountry))); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - catch ( const css::uno::Exception& ex) - { - LogHelper::logIt(ex); - } -} - -void SvtUserOptions_Impl::SetPosition( const ::rtl::OUString& sPosition ) -{ - try - { - m_xData->setPropertyValue(s_sposition, css::uno::makeAny(::rtl::OUString(sPosition))); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - catch ( const css::uno::Exception& ex) - { - LogHelper::logIt(ex); - } -} - -void SvtUserOptions_Impl::SetTitle( const ::rtl::OUString& sTitle ) -{ - try - { - m_xData->setPropertyValue(s_stitle, css::uno::makeAny(::rtl::OUString(sTitle))); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - catch ( const css::uno::Exception& ex) - { - LogHelper::logIt(ex); - } -} - -void SvtUserOptions_Impl::SetTelephoneHome( const ::rtl::OUString& sTelephoneHome ) -{ - try - { - m_xData->setPropertyValue(s_shomephone, css::uno::makeAny(::rtl::OUString(sTelephoneHome))); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - catch ( const css::uno::Exception& ex) - { - LogHelper::logIt(ex); - } -} - -void SvtUserOptions_Impl::SetTelephoneWork( const ::rtl::OUString& sTelephoneWork ) -{ - try - { - m_xData->setPropertyValue(s_stelephonenumber, css::uno::makeAny(::rtl::OUString(sTelephoneWork))); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - catch ( const css::uno::Exception& ex) - { - LogHelper::logIt(ex); - } -} - -void SvtUserOptions_Impl::SetFax( const ::rtl::OUString& sFax ) -{ - try - { - m_xData->setPropertyValue(s_sfacsimiletelephonenumber, css::uno::makeAny(::rtl::OUString(sFax))); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - catch ( const css::uno::Exception& ex) - { - LogHelper::logIt(ex); - } -} - -void SvtUserOptions_Impl::SetEmail( const ::rtl::OUString& sEmail ) -{ - try - { - m_xData->setPropertyValue(s_smail, css::uno::makeAny(::rtl::OUString(sEmail))); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - catch ( const css::uno::Exception& ex) - { - LogHelper::logIt(ex); - } -} - -void SvtUserOptions_Impl::SetCustomerNumber( const ::rtl::OUString& sCustomerNumber ) -{ - try - { - m_xData->setPropertyValue(s_scustomernumber, css::uno::makeAny(::rtl::OUString(sCustomerNumber))); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - catch ( const css::uno::Exception& ex) - { - LogHelper::logIt(ex); - } -} - -void SvtUserOptions_Impl::SetFathersName( const ::rtl::OUString& sFathersName ) -{ - try - { - m_xData->setPropertyValue(s_sfathersname, css::uno::makeAny(::rtl::OUString(sFathersName))); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - catch ( const css::uno::Exception& ex) - { - LogHelper::logIt(ex); - } -} - -void SvtUserOptions_Impl::SetApartment( const ::rtl::OUString& sApartment ) -{ - try - { - m_xData->setPropertyValue(s_sapartment, css::uno::makeAny(::rtl::OUString(sApartment))); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - catch ( const css::uno::Exception& ex) - { - LogHelper::logIt(ex); - } -} - -// ----------------------------------------------------------------------- - -::rtl::OUString SvtUserOptions_Impl::GetFullName() const -{ - ::rtl::OUString sFullName; - - sFullName = GetFirstName(); - sFullName.trim(); - if ( sFullName.getLength() ) - sFullName += ::rtl::OUString::createFromAscii(" "); - sFullName += GetLastName(); - sFullName.trim(); - - return sFullName; -} - -// ----------------------------------------------------------------------- - -void SvtUserOptions_Impl::Notify() -{ - Broadcast( SfxSimpleHint( SFX_HINT_USER_OPTIONS_CHANGED ) ); -} -// ----------------------------------------------------------------------- - -sal_Bool SvtUserOptions_Impl::IsTokenReadonly( USHORT nToken ) const -{ - css::uno::Reference< css::beans::XPropertySet > xData(m_xCfg, css::uno::UNO_QUERY); - css::uno::Reference< css::beans::XPropertySetInfo > xInfo = xData->getPropertySetInfo(); - css::beans::Property aProp; - sal_Bool bRet = sal_False; - - switch ( nToken ) - { - case USER_OPT_COMPANY: - { - aProp = xInfo->getPropertyByName(s_so); - bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); - break; - } - case USER_OPT_FIRSTNAME: - { - aProp = xInfo->getPropertyByName(s_sgivenname); - bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); - break; - } - case USER_OPT_LASTNAME: - { - aProp = xInfo->getPropertyByName(s_ssn); - bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); - break; - } - case USER_OPT_ID: - { - aProp = xInfo->getPropertyByName(s_sinitials); - bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); - break; - } - case USER_OPT_STREET: - { - aProp = xInfo->getPropertyByName(s_sstreet); - bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); - break; - } - case USER_OPT_CITY: - { - aProp = xInfo->getPropertyByName(s_sl); - bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); - break; - } - case USER_OPT_STATE: - { - aProp = xInfo->getPropertyByName(s_sst); - bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); - break; - } - case USER_OPT_ZIP: - { - aProp = xInfo->getPropertyByName(s_spostalcode); - bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); - break; - } - case USER_OPT_COUNTRY: - { - aProp = xInfo->getPropertyByName(s_sc); - bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); - break; - } - case USER_OPT_POSITION: - { - aProp = xInfo->getPropertyByName(s_sposition); - bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); - break; - } - case USER_OPT_TITLE: - { - aProp = xInfo->getPropertyByName(s_stitle); - bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); - break; - } - case USER_OPT_TELEPHONEHOME: - { - aProp = xInfo->getPropertyByName(s_shomephone); - bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); - break; - } - case USER_OPT_TELEPHONEWORK: - { - aProp = xInfo->getPropertyByName(s_stelephonenumber); - bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); - break; - } - case USER_OPT_FAX: - { - aProp = xInfo->getPropertyByName(s_sfacsimiletelephonenumber); - bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); - break; - } - case USER_OPT_EMAIL: - { - aProp = xInfo->getPropertyByName(s_smail); - bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); - break; - } - case USER_OPT_FATHERSNAME: - { - aProp = xInfo->getPropertyByName(s_sfathersname); - bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); - break; - } - case USER_OPT_APARTMENT: - { - aProp = xInfo->getPropertyByName(s_sapartment); - bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); - break; - } - default: - DBG_ERRORFILE( "SvtUserOptions_Impl::IsTokenReadonly(): invalid token" ); - } - - return bRet; -} - -//------------------------------------------------------------------------ -::rtl::OUString SvtUserOptions_Impl::GetToken(USHORT nToken) const -{ - ::rtl::OUString pRet; - switch(nToken) - { - case USER_OPT_COMPANY: pRet = GetCompany(); break; - case USER_OPT_FIRSTNAME: pRet = GetFirstName(); break; - case USER_OPT_LASTNAME: pRet = GetLastName(); break; - case USER_OPT_ID: pRet = GetID(); break; - case USER_OPT_STREET: pRet = GetStreet(); break; - case USER_OPT_CITY: pRet = GetCity(); break; - case USER_OPT_STATE: pRet = GetState(); break; - case USER_OPT_ZIP: pRet = GetZip(); break; - case USER_OPT_COUNTRY: pRet = GetCountry(); break; - case USER_OPT_POSITION: pRet = GetPosition(); break; - case USER_OPT_TITLE: pRet = GetTitle(); break; - case USER_OPT_TELEPHONEHOME: pRet = GetTelephoneHome(); break; - case USER_OPT_TELEPHONEWORK: pRet = GetTelephoneWork(); break; - case USER_OPT_FAX: pRet = GetFax(); break; - case USER_OPT_EMAIL: pRet = GetEmail(); break; - case USER_OPT_FATHERSNAME: pRet = GetFathersName(); break; - case USER_OPT_APARTMENT: pRet = GetApartment(); break; - default: - DBG_ERRORFILE( "SvtUserOptions_Impl::GetToken(): invalid token" ); - } - return pRet; -} - -// class SvtUserOptions -------------------------------------------------- - -SvtUserOptions::SvtUserOptions() -{ - // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( GetInitMutex() ); - - if ( !pOptions ) - { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtUserOptions_Impl::ctor()"); - pOptions = new SvtUserOptions_Impl; - - ItemHolder2::holdConfigItem(E_USEROPTIONS); - } - ++nRefCount; - pImp = pOptions; - StartListening( *pImp); -} - -// ----------------------------------------------------------------------- - -SvtUserOptions::~SvtUserOptions() -{ - // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( GetInitMutex() ); - - if ( !--nRefCount ) - { - //if ( pOptions->IsModified() ) - // pOptions->Commit(); - DELETEZ( pOptions ); - } -} - -// ----------------------------------------------------------------------- - -::osl::Mutex& SvtUserOptions::GetInitMutex() -{ - // Initialize static mutex only for one time! - static ::osl::Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if ( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - // We must check our pointer again - - // because another instance of our class will be faster then this instance! - if ( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static ::osl::Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; -} - -// ----------------------------------------------------------------------- - -::rtl::OUString SvtUserOptions::GetCompany() const -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - return pImp->GetCompany(); -} - -// ----------------------------------------------------------------------- - -::rtl::OUString SvtUserOptions::GetFirstName() const -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - return pImp->GetFirstName(); -} - -// ----------------------------------------------------------------------- - -::rtl::OUString SvtUserOptions::GetLastName() const -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - return pImp->GetLastName(); -} - -// ----------------------------------------------------------------------- - -::rtl::OUString SvtUserOptions::GetID() const -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - return pImp->GetID(); -} - -// ----------------------------------------------------------------------- - -::rtl::OUString SvtUserOptions::GetStreet() const -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - return pImp->GetStreet(); -} - -// ----------------------------------------------------------------------- - -::rtl::OUString SvtUserOptions::GetCity() const -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - return pImp->GetCity(); -} - -// ----------------------------------------------------------------------- - -::rtl::OUString SvtUserOptions::GetState() const -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - return pImp->GetState(); -} - -// ----------------------------------------------------------------------- - -::rtl::OUString SvtUserOptions::GetZip() const -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - return pImp->GetZip(); -} - -// ----------------------------------------------------------------------- - -::rtl::OUString SvtUserOptions::GetCountry() const -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - return pImp->GetCountry(); -} - -// ----------------------------------------------------------------------- - -::rtl::OUString SvtUserOptions::GetPosition() const -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - return pImp->GetPosition(); -} - -// ----------------------------------------------------------------------- - -::rtl::OUString SvtUserOptions::GetTitle() const -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - return pImp->GetTitle(); -} - -// ----------------------------------------------------------------------- - -::rtl::OUString SvtUserOptions::GetTelephoneHome() const -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - return pImp->GetTelephoneHome(); -} - -// ----------------------------------------------------------------------- - -::rtl::OUString SvtUserOptions::GetTelephoneWork() const -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - return pImp->GetTelephoneWork(); -} - -// ----------------------------------------------------------------------- - -::rtl::OUString SvtUserOptions::GetFax() const -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - return pImp->GetFax(); -} - -// ----------------------------------------------------------------------- - -::rtl::OUString SvtUserOptions::GetEmail() const -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - return pImp->GetEmail(); -} - -// ----------------------------------------------------------------------- - -::rtl::OUString SvtUserOptions::GetCustomerNumber() const -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - return pImp->GetCustomerNumber(); -} -// ----------------------------------------------------------------------- - -::rtl::OUString SvtUserOptions::GetFathersName() const -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - return pImp->GetFathersName() ; -} - -// ----------------------------------------------------------------------- - -::rtl::OUString SvtUserOptions::GetApartment() const -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - return pImp->GetApartment(); -} - -// ----------------------------------------------------------------------- - -::rtl::OUString SvtUserOptions::GetFullName() const -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - return pImp->GetFullName(); -} - -// ----------------------------------------------------------------------- - -::rtl::OUString SvtUserOptions::GetLocale() const -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - return pImp->GetLocale(); -} - -// ----------------------------------------------------------------------- - -void SvtUserOptions::SetCompany( const ::rtl::OUString& rNewToken ) -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - pImp->SetCompany( rNewToken ); -} - -// ----------------------------------------------------------------------- - -void SvtUserOptions::SetFirstName( const ::rtl::OUString& rNewToken ) -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - pImp->SetFirstName( rNewToken ); -} - -// ----------------------------------------------------------------------- - -void SvtUserOptions::SetLastName( const ::rtl::OUString& rNewToken ) -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - pImp->SetLastName( rNewToken ); -} - -// ----------------------------------------------------------------------- - -void SvtUserOptions::SetID( const ::rtl::OUString& rNewToken ) -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - pImp->SetID( rNewToken ); -} - -// ----------------------------------------------------------------------- - -void SvtUserOptions::SetStreet( const ::rtl::OUString& rNewToken ) -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - pImp->SetStreet( rNewToken ); -} - -// ----------------------------------------------------------------------- - -void SvtUserOptions::SetCity( const ::rtl::OUString& rNewToken ) -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - pImp->SetCity( rNewToken ); -} - -// ----------------------------------------------------------------------- - -void SvtUserOptions::SetState( const ::rtl::OUString& rNewToken ) -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - pImp->SetState( rNewToken ); -} - -// ----------------------------------------------------------------------- - -void SvtUserOptions::SetZip( const ::rtl::OUString& rNewToken ) -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - pImp->SetZip( rNewToken ); -} - -// ----------------------------------------------------------------------- - -void SvtUserOptions::SetCountry( const ::rtl::OUString& rNewToken ) -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - pImp->SetCountry( rNewToken ); -} - -// ----------------------------------------------------------------------- - -void SvtUserOptions::SetPosition( const ::rtl::OUString& rNewToken ) -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - pImp->SetPosition( rNewToken ); -} - -// ----------------------------------------------------------------------- - -void SvtUserOptions::SetTitle( const ::rtl::OUString& rNewToken ) -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - pImp->SetTitle( rNewToken ); -} - -// ----------------------------------------------------------------------- - -void SvtUserOptions::SetTelephoneHome( const ::rtl::OUString& rNewToken ) -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - pImp->SetTelephoneHome( rNewToken ); -} - -// ----------------------------------------------------------------------- - -void SvtUserOptions::SetTelephoneWork( const ::rtl::OUString& rNewToken ) -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - pImp->SetTelephoneWork( rNewToken ); -} - -// ----------------------------------------------------------------------- - -void SvtUserOptions::SetFax( const ::rtl::OUString& rNewToken ) -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - pImp->SetFax( rNewToken ); -} - -// ----------------------------------------------------------------------- - -void SvtUserOptions::SetEmail( const ::rtl::OUString& rNewToken ) -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - pImp->SetEmail( rNewToken ); -} - -// ----------------------------------------------------------------------- - -void SvtUserOptions::SetCustomerNumber( const ::rtl::OUString& rNewToken ) -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - pImp->SetCustomerNumber( rNewToken ); -} -// ----------------------------------------------------------------------- - -void SvtUserOptions::SetFathersName( const ::rtl::OUString& rNewToken ) -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - pImp->SetFathersName( rNewToken ); -} - -// ----------------------------------------------------------------------- - -void SvtUserOptions::SetApartment( const ::rtl::OUString& rNewToken ) -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - pImp->SetApartment( rNewToken ); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvtUserOptions::IsTokenReadonly( USHORT nToken ) const -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - return pImp->IsTokenReadonly( nToken ); -} -//------------------------------------------------------------------------ -::rtl::OUString SvtUserOptions::GetToken(USHORT nToken) const -{ - ::osl::MutexGuard aGuard( GetInitMutex() ); - return pImp->GetToken( nToken ); -} -/* -----------------07.07.2003 09:30----------------- - - --------------------------------------------------*/ -void SvtUserOptions::Notify( SfxBroadcaster&, const SfxHint& rHint ) -{ - vos::OGuard aVclGuard( Application::GetSolarMutex() ); - Broadcast( rHint ); -} diff --git a/svtools/source/config/viewoptions.cxx b/svtools/source/config/viewoptions.cxx deleted file mode 100644 index d4c8d65dbe04..000000000000 --- a/svtools/source/config/viewoptions.cxx +++ /dev/null @@ -1,1304 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: viewoptions.cxx,v $ - * $Revision: 1.29.236.2 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -//_________________________________________________________________________________________________________________ -// namespaces -//_________________________________________________________________________________________________________________ - -namespace css = ::com::sun::star; - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -#ifdef CONST_ASCII - #error "Who define CONST_ASCII before! I use it to create const ascii strings ..." -#else - #define CONST_ASCII(SASCIIVALUE) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SASCIIVALUE)) -#endif - -#define PATHSEPERATOR CONST_ASCII("/") - -#define PACKAGE_VIEWS CONST_ASCII("org.openoffice.Office.Views") - -#define LIST_DIALOGS CONST_ASCII("Dialogs" ) -#define LIST_TABDIALOGS CONST_ASCII("TabDialogs") -#define LIST_TABPAGES CONST_ASCII("TabPages" ) -#define LIST_WINDOWS CONST_ASCII("Windows" ) - -#define PROPERTY_WINDOWSTATE CONST_ASCII("WindowState") -#define PROPERTY_PAGEID CONST_ASCII("PageID" ) -#define PROPERTY_VISIBLE CONST_ASCII("Visible" ) -#define PROPERTY_USERDATA CONST_ASCII("UserData" ) - -#define PROPCOUNT_DIALOGS 1 -#define PROPCOUNT_TABDIALOGS 2 -#define PROPCOUNT_TABPAGES 1 -#define PROPCOUNT_WINDOWS 2 - -#define DEFAULT_WINDOWSTATE ::rtl::OUString() -#define DEFAULT_USERDATA css::uno::Sequence< css::beans::NamedValue >() -#define DEFAULT_PAGEID 0 -#define DEFAULT_VISIBLE sal_False - -//#define DEBUG_VIEWOPTIONS - -#ifdef DEBUG_VIEWOPTIONS - #define _LOG_COUNTER_( _SVIEW_, _NREAD_, _NWRITE_ ) \ - { \ - FILE* pFile = fopen( "viewdbg.txt", "a" ); \ - fprintf( pFile, "%s[%d, %d]\n", ::rtl::OUStringToOString(_SVIEW_, RTL_TEXTENCODING_UTF8).getStr(), _NREAD_, _NWRITE_ ); \ - fclose( pFile ); \ - } -#endif // DEBUG_VIEWOPTIONS - -#define SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION_PARAM_EXCEPTION) \ - { \ - ::rtl::OUStringBuffer sMsg(256); \ - sMsg.appendAscii("Unexpected exception catched. Original message was:\n\"" ); \ - sMsg.append (SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION_PARAM_EXCEPTION.Message); \ - sMsg.appendAscii("\"" ); \ - OSL_ENSURE(sal_False, ::rtl::OUStringToOString(sMsg.makeStringAndClear(), RTL_TEXTENCODING_UTF8).getStr()); \ - } - -//_________________________________________________________________________________________________________________ -// initialization! -//_________________________________________________________________________________________________________________ - -SvtViewOptionsBase_Impl* SvtViewOptions::m_pDataContainer_Dialogs = NULL ; -sal_Int32 SvtViewOptions::m_nRefCount_Dialogs = 0 ; -SvtViewOptionsBase_Impl* SvtViewOptions::m_pDataContainer_TabDialogs = NULL ; -sal_Int32 SvtViewOptions::m_nRefCount_TabDialogs = 0 ; -SvtViewOptionsBase_Impl* SvtViewOptions::m_pDataContainer_TabPages = NULL ; -sal_Int32 SvtViewOptions::m_nRefCount_TabPages = 0 ; -SvtViewOptionsBase_Impl* SvtViewOptions::m_pDataContainer_Windows = NULL ; -sal_Int32 SvtViewOptions::m_nRefCount_Windows = 0 ; - -//_________________________________________________________________________________________________________________ -// private declarations! -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @descr declare one configuration item - These struct hold information about one view item. But not all member are used for all entries! - User must decide which information are usefull and which not. We are a container iztem only and doesnt - know anything about the context. - But; we support a feature: - decision between items with default values (should not realy exist in configuration!) - and items with real values - changed by user. So user can suppress saving of realy unused items - to disk - because; defaulted items could be restored on runtime without reading from disk!!! - And if only items with valid information was written to cfg - we mustn't read so much and save time. - So we start with an member m_bDefault=True and reset it to False after first set-call. - Deficiencies of these solution - we cant allow direct read/write access to our member. We must - support it by set/get-methods ... -*//*-*************************************************************************************************************/ -class IMPL_TViewData -{ - public: - //--------------------------------------------------------------------------------------------------------- - // create "default" item - IMPL_TViewData() - { - m_sWindowState = DEFAULT_WINDOWSTATE ; - m_lUserData = DEFAULT_USERDATA ; - m_nPageID = DEFAULT_PAGEID ; - m_bVisible = DEFAULT_VISIBLE ; - - m_bDefault = sal_True ; - } - - //--------------------------------------------------------------------------------------------------------- - // write access - with reseting of default state - void setWindowState( const ::rtl::OUString& sValue ) - { - m_bDefault = ( - ( m_bDefault == sal_True ) && - ( sValue == DEFAULT_WINDOWSTATE ) - ); - m_sWindowState = sValue; - } - - //--------------------------------------------------------------------------------------------------------- - void setUserData( const css::uno::Sequence< css::beans::NamedValue >& lValue ) - { - m_bDefault = ( - ( m_bDefault == sal_True ) && - ( lValue == DEFAULT_USERDATA ) - ); - m_lUserData = lValue; - } - - //--------------------------------------------------------------------------------------------------------- - void setPageID( sal_Int32 nValue ) - { - m_bDefault = ( - ( m_bDefault == sal_True ) && - ( nValue == DEFAULT_PAGEID ) - ); - m_nPageID = nValue; - } - - //--------------------------------------------------------------------------------------------------------- - void setVisible( sal_Bool bValue ) - { - m_bDefault = ( - ( m_bDefault == sal_True ) && - ( bValue == DEFAULT_VISIBLE ) - ); - m_bVisible = bValue; - } - - //--------------------------------------------------------------------------------------------------------- - // read access - ::rtl::OUString getWindowState() { return m_sWindowState; } - css::uno::Sequence< css::beans::NamedValue > getUserData () { return m_lUserData ; } - sal_Int32 getPageID () { return m_nPageID ; } - sal_Bool getVisible () { return m_bVisible ; } - - //--------------------------------------------------------------------------------------------------------- - // special operation for easy access on user data - void setUserItem( const ::rtl::OUString& sName , - const css::uno::Any& aValue ) - { - // we change UserData in every case! - // a) we change already existing item - // or b) we add a new one - m_bDefault = sal_False; - - sal_Bool bExist = sal_False; - sal_Int32 nCount = m_lUserData.getLength(); - - // change it, if it already exist ... - for( sal_Int32 nStep=0; nStep m_lUserData ; - sal_Int32 m_nPageID ; - sal_Bool m_bVisible ; - - sal_Bool m_bDefault ; -}; - -struct IMPL_TStringHashCode -{ - size_t operator()(const ::rtl::OUString& sString) const - { - return sString.hashCode(); - } -}; - -typedef ::std::hash_map< ::rtl::OUString , - IMPL_TViewData , - IMPL_TStringHashCode , - ::std::equal_to< ::rtl::OUString > > IMPL_TViewHash; - -/*-************************************************************************************************************//** - @descr Implement base data container for view options elements. - Every item support ALL possible configuration informations. - But not every superclass should use them! Because some view types don't - have it realy. - - @attention We implement a write-througt-cache! We use it for reading - but write all changes directly to - configuration. (changes are made on internal cache too!). So it's easier to distinguish - between added/changed/removed elements without any complex mask or bool flag informations. - Caches from configuration and our own one are synchronized every time - if we do so. -*//*-*************************************************************************************************************/ -class SvtViewOptionsBase_Impl -{ - //------------------------------------------------------------------------------------------------------------- - public: - SvtViewOptionsBase_Impl ( const ::rtl::OUString& sList ); - virtual ~SvtViewOptionsBase_Impl ( ); - sal_Bool Exists ( const ::rtl::OUString& sName ); - sal_Bool Delete ( const ::rtl::OUString& sName ); - ::rtl::OUString GetWindowState ( const ::rtl::OUString& sName ); - void SetWindowState ( const ::rtl::OUString& sName , - const ::rtl::OUString& sState ); - css::uno::Sequence< css::beans::NamedValue > GetUserData ( const ::rtl::OUString& sName ); - void SetUserData ( const ::rtl::OUString& sName , - const css::uno::Sequence< css::beans::NamedValue >& lData ); - sal_Int32 GetPageID ( const ::rtl::OUString& sName ); - void SetPageID ( const ::rtl::OUString& sName , - sal_Int32 nID ); - sal_Bool GetVisible ( const ::rtl::OUString& sName ); - void SetVisible ( const ::rtl::OUString& sName , - sal_Bool bVisible ); - css::uno::Any GetUserItem ( const ::rtl::OUString& sName , - const ::rtl::OUString& sItem ); - void SetUserItem ( const ::rtl::OUString& sName , - const ::rtl::OUString& sItem , - const css::uno::Any& aValue ); - - //------------------------------------------------------------------------------------------------------------- - private: - css::uno::Reference< css::uno::XInterface > impl_getSetNode( const ::rtl::OUString& sNode , - sal_Bool bCreateIfMissing); - - //------------------------------------------------------------------------------------------------------------- - private: - ::rtl::OUString m_sListName; - css::uno::Reference< css::container::XNameAccess > m_xRoot; - css::uno::Reference< css::container::XNameAccess > m_xSet; - - #ifdef DEBUG_VIEWOPTIONS - sal_Int32 m_nReadCount ; - sal_Int32 m_nWriteCount ; - #endif -}; - -/*-************************************************************************************************************//** - @descr Implement the base data container. -*//*-*************************************************************************************************************/ - -/*-************************************************************************************************************//** - @short ctor - @descr We use it to open right configuration file and let configuration objects fill her caches. - Then we read all existing entries from right list and cached it inside our object too. - Normaly we should enable notifications for changes on these values too ... but these feature - isn't full implemented in the moment. - - @seealso baseclass ::utl::ConfigItem - @seealso method Notify() - - @param - - @return - - - @last change 19.10.2001 07:54 -*//*-*************************************************************************************************************/ -SvtViewOptionsBase_Impl::SvtViewOptionsBase_Impl( const ::rtl::OUString& sList ) - : m_sListName ( sList ) // we must know, which view type we must support - #ifdef DEBUG_VIEWOPTIONS - , m_nReadCount ( 0 ) - , m_nWriteCount( 0 ) - #endif -{ - try - { - m_xRoot = css::uno::Reference< css::container::XNameAccess >( - ::comphelper::ConfigurationHelper::openConfig( - ::utl::getProcessServiceFactory(), - PACKAGE_VIEWS, - ::comphelper::ConfigurationHelper::E_STANDARD), - css::uno::UNO_QUERY); - if (m_xRoot.is()) - m_xRoot->getByName(sList) >>= m_xSet; - } - catch(const css::uno::Exception& ex) - { - m_xRoot.clear(); - m_xSet.clear(); - - SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) - } -} - -/*-************************************************************************************************************//** - @short dtor - @descr clean up something - - @attention We implement a write through cache! So we mustn't do it realy. All changes was written to cfg directly. - Commit isn't neccessary then. - - @seealso baseclass ::utl::ConfigItem - @seealso method IsModified() - @seealso method SetModified() - @seealso method Commit() - - @param - - @return - - - @last change 19.10.2001 08:02 -*//*-*************************************************************************************************************/ -SvtViewOptionsBase_Impl::~SvtViewOptionsBase_Impl() -{ - // dont flush configuration changes here to m_xRoot. - // That must be done inside every SetXXX() method already ! - // Here its to late - DisposedExceptions from used configuration access can occure otherwise. - - m_xRoot.clear(); - m_xSet.clear(); - - #ifdef DEBUG_VIEWOPTIONS - _LOG_COUNTER_( m_sListName, m_nReadCount, m_nWriteCount ) - #endif // DEBUG_VIEWOPTIONS -} - -/*-************************************************************************************************************//** - @short checks for already existing entries - @descr If user don't know, if an entry already exist - he can get this information by calling this method. - - @seealso member m_aList - - @param "sName", name of entry to check exist state - @return true , if item exist - false, otherwise -*//*-*************************************************************************************************************/ -sal_Bool SvtViewOptionsBase_Impl::Exists( const ::rtl::OUString& sName ) -{ - sal_Bool bExists = sal_False; - - try - { - if (m_xSet.is()) - bExists = m_xSet->hasByName(sName); - } - catch(const css::uno::Exception& ex) - { - bExists = sal_False; - SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) - } - - return bExists; -} - -/*-************************************************************************************************************//** - @short delete entry - @descr Use it to delete set entry by given name. - - @seealso member m_aList - - @param "sName", name of entry to delete it - @return true , if item not exist(!) or could be deleted (should be the same!) - false, otherwise -*//*-*************************************************************************************************************/ -sal_Bool SvtViewOptionsBase_Impl::Delete( const ::rtl::OUString& sName ) -{ - #ifdef DEBUG_VIEWOPTIONS - ++m_nWriteCount; - #endif - - sal_Bool bDeleted = sal_False; - try - { - css::uno::Reference< css::container::XNameContainer > xSet(m_xSet, css::uno::UNO_QUERY_THROW); - xSet->removeByName(sName); - bDeleted = sal_True; - ::comphelper::ConfigurationHelper::flush(m_xRoot); - } - catch(const css::container::NoSuchElementException&) - { bDeleted = sal_True; } - catch(const css::uno::Exception& ex) - { - bDeleted = sal_False; - SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) - } - - return bDeleted; -} - -/*-************************************************************************************************************//** - @short read/write access to cache view items and her properties - @descr Follow methods support read/write access to all cache view items. - - @seealso member m_sList - - @param - - @return - -*//*-*************************************************************************************************************/ -::rtl::OUString SvtViewOptionsBase_Impl::GetWindowState( const ::rtl::OUString& sName ) -{ - #ifdef DEBUG_VIEWOPTIONS - ++m_nReadCount; - #endif - - ::rtl::OUString sWindowState; - try - { - css::uno::Reference< css::beans::XPropertySet > xNode( - impl_getSetNode(sName, sal_False), - css::uno::UNO_QUERY); - if (xNode.is()) - xNode->getPropertyValue(PROPERTY_WINDOWSTATE) >>= sWindowState; - } - catch(const css::uno::Exception& ex) - { - sWindowState = ::rtl::OUString(); - SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) - } - - return sWindowState; -} - -//***************************************************************************************************************** -void SvtViewOptionsBase_Impl::SetWindowState( const ::rtl::OUString& sName , - const ::rtl::OUString& sState ) -{ - #ifdef DEBUG_VIEWOPTIONS - ++m_nWriteCount; - #endif - - try - { - css::uno::Reference< css::beans::XPropertySet > xNode( - impl_getSetNode(sName, sal_True), - css::uno::UNO_QUERY_THROW); - xNode->setPropertyValue(PROPERTY_WINDOWSTATE, css::uno::makeAny(sState)); - ::comphelper::ConfigurationHelper::flush(m_xRoot); - } - catch(const css::uno::Exception& ex) - { - SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) - } -} - -//***************************************************************************************************************** -css::uno::Sequence< css::beans::NamedValue > SvtViewOptionsBase_Impl::GetUserData( const ::rtl::OUString& sName ) -{ - #ifdef DEBUG_VIEWOPTIONS - ++m_nReadCount; - #endif - - try - { - css::uno::Reference< css::container::XNameAccess > xNode( - impl_getSetNode(sName, sal_False), - css::uno::UNO_QUERY); // no _THROW ! because we dont create missing items here. So we have to live with zero references .-) - css::uno::Reference< css::container::XNameAccess > xUserData; - if (xNode.is()) - xNode->getByName(PROPERTY_USERDATA) >>= xUserData; - if (xUserData.is()) - { - const css::uno::Sequence< ::rtl::OUString > lNames = xUserData->getElementNames(); - const ::rtl::OUString* pNames = lNames.getConstArray(); - sal_Int32 c = lNames.getLength(); - sal_Int32 i = 0; - css::uno::Sequence< css::beans::NamedValue > lUserData(c); - - for (i=0; igetByName(pNames[i]); - } - - return lUserData; - } - } - catch(const css::uno::Exception& ex) - { - SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) - } - - return css::uno::Sequence< css::beans::NamedValue >(); -} - -//***************************************************************************************************************** -void SvtViewOptionsBase_Impl::SetUserData( const ::rtl::OUString& sName , - const css::uno::Sequence< css::beans::NamedValue >& lData ) -{ - #ifdef DEBUG_VIEWOPTIONS - ++m_nWriteCount; - #endif - - try - { - css::uno::Reference< css::container::XNameAccess > xNode( - impl_getSetNode(sName, sal_True), - css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::container::XNameContainer > xUserData; - xNode->getByName(PROPERTY_USERDATA) >>= xUserData; - if (xUserData.is()) - { - const css::beans::NamedValue* pData = lData.getConstArray(); - sal_Int32 c = lData.getLength(); - sal_Int32 i = 0; - for (i=0; ihasByName(pData[i].Name)) - xUserData->replaceByName(pData[i].Name, pData[i].Value); - else - xUserData->insertByName(pData[i].Name, pData[i].Value); - } - } - ::comphelper::ConfigurationHelper::flush(m_xRoot); - } - catch(const css::uno::Exception& ex) - { - SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) - } -} - -//***************************************************************************************************************** -css::uno::Any SvtViewOptionsBase_Impl::GetUserItem( const ::rtl::OUString& sName , - const ::rtl::OUString& sItem ) -{ - #ifdef DEBUG_VIEWOPTIONS - ++m_nReadCount; - #endif - - css::uno::Any aItem; - try - { - css::uno::Reference< css::container::XNameAccess > xNode( - impl_getSetNode(sName, sal_False), - css::uno::UNO_QUERY); - css::uno::Reference< css::container::XNameAccess > xUserData; - if (xNode.is()) - xNode->getByName(PROPERTY_USERDATA) >>= xUserData; - if (xUserData.is()) - aItem = xUserData->getByName(sItem); - } - catch(const css::container::NoSuchElementException&) - { aItem.clear(); } - catch(const css::uno::Exception& ex) - { - aItem.clear(); - SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) - } - - return aItem; -} - -//***************************************************************************************************************** -void SvtViewOptionsBase_Impl::SetUserItem( const ::rtl::OUString& sName , - const ::rtl::OUString& sItem , - const css::uno::Any& aValue ) -{ - #ifdef DEBUG_VIEWOPTIONS - ++m_nWriteCount; - #endif - - try - { - css::uno::Reference< css::container::XNameAccess > xNode( - impl_getSetNode(sName, sal_True), - css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::container::XNameContainer > xUserData; - xNode->getByName(PROPERTY_USERDATA) >>= xUserData; - if (xUserData.is()) - { - if (xUserData->hasByName(sItem)) - xUserData->replaceByName(sItem, aValue); - else - xUserData->insertByName(sItem, aValue); - } - ::comphelper::ConfigurationHelper::flush(m_xRoot); - } - catch(const css::uno::Exception& ex) - { - SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) - } -} - -//***************************************************************************************************************** -sal_Int32 SvtViewOptionsBase_Impl::GetPageID( const ::rtl::OUString& sName ) -{ - #ifdef DEBUG_VIEWOPTIONS - ++m_nReadCount; - #endif - - sal_Int32 nID = 0; - try - { - css::uno::Reference< css::beans::XPropertySet > xNode( - impl_getSetNode(sName, sal_False), - css::uno::UNO_QUERY); - if (xNode.is()) - xNode->getPropertyValue(PROPERTY_PAGEID) >>= nID; - } - catch(const css::uno::Exception& ex) - { - nID = 0; - SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) - } - - return nID; -} - -//***************************************************************************************************************** -void SvtViewOptionsBase_Impl::SetPageID( const ::rtl::OUString& sName , - sal_Int32 nID ) -{ - #ifdef DEBUG_VIEWOPTIONS - ++m_nWriteCount; - #endif - - try - { - css::uno::Reference< css::beans::XPropertySet > xNode( - impl_getSetNode(sName, sal_True), - css::uno::UNO_QUERY_THROW); - xNode->setPropertyValue(PROPERTY_PAGEID, css::uno::makeAny(nID)); - ::comphelper::ConfigurationHelper::flush(m_xRoot); - } - catch(const css::uno::Exception& ex) - { - SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) - } -} - -//***************************************************************************************************************** -sal_Bool SvtViewOptionsBase_Impl::GetVisible( const ::rtl::OUString& sName ) -{ - #ifdef DEBUG_VIEWOPTIONS - ++m_nReadCount; - #endif - - sal_Bool bVisible = sal_False; - try - { - css::uno::Reference< css::beans::XPropertySet > xNode( - impl_getSetNode(sName, sal_False), - css::uno::UNO_QUERY); - if (xNode.is()) - xNode->getPropertyValue(PROPERTY_VISIBLE) >>= bVisible; - } - catch(const css::uno::Exception& ex) - { - bVisible = sal_False; - SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) - } - - return bVisible; -} - -//***************************************************************************************************************** -void SvtViewOptionsBase_Impl::SetVisible( const ::rtl::OUString& sName , - sal_Bool bVisible ) -{ - #ifdef DEBUG_VIEWOPTIONS - ++m_nWriteCount; - #endif - - try - { - css::uno::Reference< css::beans::XPropertySet > xNode( - impl_getSetNode(sName, sal_True), - css::uno::UNO_QUERY_THROW); - xNode->setPropertyValue(PROPERTY_VISIBLE, css::uno::makeAny(bVisible)); - ::comphelper::ConfigurationHelper::flush(m_xRoot); - } - catch(const css::uno::Exception& ex) - { - SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) - } -} - -/*-************************************************************************************************************//** - @short create new set node with default values on disk - @descr To create a new UserData item - the super node of these property must already exist! - You can call this method to create these new entry with default values and change UserData then. - - @seealso method impl_writeDirectProp() - - @param "sNode", name of new entry - @return - - - @last change 19.10.2001 08:42 -*//*-*************************************************************************************************************/ -css::uno::Reference< css::uno::XInterface > SvtViewOptionsBase_Impl::impl_getSetNode( const ::rtl::OUString& sNode , - sal_Bool bCreateIfMissing) -{ - css::uno::Reference< css::uno::XInterface > xNode; - - try - { - if (bCreateIfMissing) - xNode = ::comphelper::ConfigurationHelper::makeSureSetNodeExists(m_xRoot, m_sListName, sNode); - else - { - if (m_xSet.is()) - m_xSet->getByName(sNode) >>= xNode; - } - } - catch(const css::container::NoSuchElementException&) - { xNode.clear(); } - catch(const css::uno::Exception& ex) - { - xNode.clear(); - SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) - } - - return xNode; -} - -//_________________________________________________________________________________________________________________ -// definitions -//_________________________________________________________________________________________________________________ - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtViewOptions::SvtViewOptions( EViewType eType , - const ::rtl::OUString& sViewName ) - : m_eViewType ( eType ) - , m_sViewName ( sViewName ) -{ - // Global access, must be guarded (multithreading!) - ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); - - // Search for right dat container for this view type and initialize right data container or set right ref count! - switch( eType ) - { - case E_DIALOG : { - // Increase ref count for dialog data container first. - ++m_nRefCount_Dialogs; - // If these instance the first user of the dialog data container - create these impl static container! - if( m_nRefCount_Dialogs == 1 ) - { - //m_pDataContainer_Dialogs = new SvtViewDialogOptions_Impl( LIST_DIALOGS ); - m_pDataContainer_Dialogs = new SvtViewOptionsBase_Impl( LIST_DIALOGS ); - ItemHolder1::holdConfigItem(E_VIEWOPTIONS_DIALOG); - } - } - break; - case E_TABDIALOG : { - // Increase ref count for tab-dialog data container first. - ++m_nRefCount_TabDialogs; - // If these instance the first user of the tab-dialog data container - create these impl static container! - if( m_nRefCount_TabDialogs == 1 ) - { - m_pDataContainer_TabDialogs = new SvtViewOptionsBase_Impl( LIST_TABDIALOGS ); - ItemHolder1::holdConfigItem(E_VIEWOPTIONS_TABDIALOG); - } - } - break; - case E_TABPAGE : { - // Increase ref count for tab-page data container first. - ++m_nRefCount_TabPages; - // If these instance the first user of the tab-page data container - create these impl static container! - if( m_nRefCount_TabPages == 1 ) - { - m_pDataContainer_TabPages = new SvtViewOptionsBase_Impl( LIST_TABPAGES ); - ItemHolder1::holdConfigItem(E_VIEWOPTIONS_TABPAGE); - } - } - break; - case E_WINDOW : { - // Increase ref count for window data container first. - ++m_nRefCount_Windows; - // If these instance the first user of the window data container - create these impl static container! - if( m_nRefCount_Windows == 1 ) - { - m_pDataContainer_Windows = new SvtViewOptionsBase_Impl( LIST_WINDOWS ); - ItemHolder1::holdConfigItem(E_VIEWOPTIONS_WINDOW); - } - } - break; - default : OSL_ENSURE( sal_False, "SvtViewOptions::SvtViewOptions()\nThese view type is unknown! All following calls at these instance will do nothing!\n" ); - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtViewOptions::~SvtViewOptions() -{ - // Global access, must be guarded (multithreading!) - ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); - - // Search for right dat container for this view type and deinitialize right data container or set right ref count! - switch( m_eViewType ) - { - case E_DIALOG : { - // Decrease ref count for dialog data container first. - --m_nRefCount_Dialogs; - // If these instance the last user of the dialog data container - delete these impl static container! - if( m_nRefCount_Dialogs == 0 ) - { - delete m_pDataContainer_Dialogs; - m_pDataContainer_Dialogs = NULL; - } - } - break; - case E_TABDIALOG : { - // Decrease ref count for tab-dialog data container first. - --m_nRefCount_TabDialogs; - // If these instance the last user of the tab-dialog data container - delete these impl static container! - if( m_nRefCount_TabDialogs == 0 ) - { - delete m_pDataContainer_TabDialogs; - m_pDataContainer_TabDialogs = NULL; - } - } - break; - case E_TABPAGE : { - // Decrease ref count for tab-page data container first. - --m_nRefCount_TabPages; - // If these instance the last user of the tab-page data container - delete these impl static container! - if( m_nRefCount_TabPages == 0 ) - { - delete m_pDataContainer_TabPages; - m_pDataContainer_TabPages = NULL; - } - } - break; - case E_WINDOW : { - // Decrease ref count for window data container first. - --m_nRefCount_Windows; - // If these instance the last user of the window data container - delete these impl static container! - if( m_nRefCount_Windows == 0 ) - { - delete m_pDataContainer_Windows; - m_pDataContainer_Windows = NULL; - } - } - break; - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtViewOptions::Exists() const -{ - // Ready for multithreading - ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); - - sal_Bool bExists = sal_False; - switch( m_eViewType ) - { - case E_DIALOG : { - bExists = m_pDataContainer_Dialogs->Exists( m_sViewName ); - } - break; - case E_TABDIALOG : { - bExists = m_pDataContainer_TabDialogs->Exists( m_sViewName ); - } - break; - case E_TABPAGE : { - bExists = m_pDataContainer_TabPages->Exists( m_sViewName ); - } - break; - case E_WINDOW : { - bExists = m_pDataContainer_Windows->Exists( m_sViewName ); - } - break; - } - return bExists; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtViewOptions::Delete() -{ - // Ready for multithreading - ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); - - sal_Bool bState = sal_False; - switch( m_eViewType ) - { - case E_DIALOG : { - bState = m_pDataContainer_Dialogs->Delete( m_sViewName ); - } - break; - case E_TABDIALOG : { - bState = m_pDataContainer_TabDialogs->Delete( m_sViewName ); - } - break; - case E_TABPAGE : { - bState = m_pDataContainer_TabPages->Delete( m_sViewName ); - } - break; - case E_WINDOW : { - bState = m_pDataContainer_Windows->Delete( m_sViewName ); - } - break; - } - return bState; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -::rtl::OUString SvtViewOptions::GetWindowState() const -{ - // Ready for multithreading - ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); - - ::rtl::OUString sState; - switch( m_eViewType ) - { - case E_DIALOG : { - sState = m_pDataContainer_Dialogs->GetWindowState( m_sViewName ); - } - break; - case E_TABDIALOG : { - sState = m_pDataContainer_TabDialogs->GetWindowState( m_sViewName ); - } - break; - case E_TABPAGE : { - sState = m_pDataContainer_TabPages->GetWindowState( m_sViewName ); - } - break; - case E_WINDOW : { - sState = m_pDataContainer_Windows->GetWindowState( m_sViewName ); - } - break; - } - return sState; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtViewOptions::SetWindowState( const ::rtl::OUString& sState ) -{ - // Ready for multithreading - ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); - - switch( m_eViewType ) - { - case E_DIALOG : { - m_pDataContainer_Dialogs->SetWindowState( m_sViewName, sState ); - } - break; - case E_TABDIALOG : { - m_pDataContainer_TabDialogs->SetWindowState( m_sViewName, sState ); - } - break; - case E_TABPAGE : { - m_pDataContainer_TabPages->SetWindowState( m_sViewName, sState ); - } - break; - case E_WINDOW : { - m_pDataContainer_Windows->SetWindowState( m_sViewName, sState ); - } - break; - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Int32 SvtViewOptions::GetPageID() const -{ - // Ready for multithreading - ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); - - // Safe impossible cases. - // These call isn't allowed for dialogs, tab-pages or windows! - OSL_ENSURE( !(m_eViewType==E_DIALOG||m_eViewType==E_TABPAGE||m_eViewType==E_WINDOW), "SvtViewOptions::GetPageID()\nCall not allowed for Dialogs, TabPages or Windows! I do nothing!\n" ); - - sal_Int32 nID = 0; - if( m_eViewType == E_TABDIALOG ) - nID = m_pDataContainer_TabDialogs->GetPageID( m_sViewName ); - return nID; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtViewOptions::SetPageID( sal_Int32 nID ) -{ - // Ready for multithreading - ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); - - // Safe impossible cases. - // These call isn't allowed for dialogs, tab-pages or windows! - OSL_ENSURE( !(m_eViewType==E_DIALOG||m_eViewType==E_TABPAGE||m_eViewType==E_WINDOW), "SvtViewOptions::SetPageID()\nCall not allowed for Dialogs, TabPages or Windows! I do nothing!\n" ); - - if( m_eViewType == E_TABDIALOG ) - m_pDataContainer_TabDialogs->SetPageID( m_sViewName, nID ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtViewOptions::IsVisible() const -{ - // Ready for multithreading - ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); - - // Safe impossible cases. - // These call isn't allowed for dialogs, tab-dialogs or tab-pages! - OSL_ENSURE( !(m_eViewType==E_DIALOG||m_eViewType==E_TABDIALOG||m_eViewType==E_TABPAGE), "SvtViewOptions::IsVisible()\nCall not allowed for Dialogs, TabDialogs or TabPages! I do nothing!\n" ); - - sal_Bool bState = sal_False; - if( m_eViewType == E_WINDOW ) - bState = m_pDataContainer_Windows->GetVisible( m_sViewName ); - - return bState; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtViewOptions::SetVisible( sal_Bool bState ) -{ - // Ready for multithreading - ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); - - // Safe impossible cases. - // These call isn't allowed for dialogs, tab-dialogs or tab-pages! - OSL_ENSURE( !(m_eViewType==E_DIALOG||m_eViewType==E_TABDIALOG||m_eViewType==E_TABPAGE), "SvtViewOptions::SetVisible()\nCall not allowed for Dialogs, TabDialogs or TabPages! I do nothing!\n" ); - - if( m_eViewType == E_WINDOW ) - m_pDataContainer_Windows->SetVisible( m_sViewName, bState ); -} - -//***************************************************************************************************************** -css::uno::Sequence< css::beans::NamedValue > SvtViewOptions::GetUserData() const -{ - // Ready for multithreading - ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); - - css::uno::Sequence< css::beans::NamedValue > lData; - switch( m_eViewType ) - { - case E_DIALOG : { - lData = m_pDataContainer_Dialogs->GetUserData( m_sViewName ); - } - break; - case E_TABDIALOG : { - lData = m_pDataContainer_TabDialogs->GetUserData( m_sViewName ); - } - break; - case E_TABPAGE : { - lData = m_pDataContainer_TabPages->GetUserData( m_sViewName ); - } - break; - case E_WINDOW : { - lData = m_pDataContainer_Windows->GetUserData( m_sViewName ); - } - break; - } - return lData; -} - -//***************************************************************************************************************** -void SvtViewOptions::SetUserData( const css::uno::Sequence< css::beans::NamedValue >& lData ) -{ - // Ready for multithreading - ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); - - switch( m_eViewType ) - { - case E_DIALOG : { - m_pDataContainer_Dialogs->SetUserData( m_sViewName, lData ); - } - break; - case E_TABDIALOG : { - m_pDataContainer_TabDialogs->SetUserData( m_sViewName, lData ); - } - break; - case E_TABPAGE : { - m_pDataContainer_TabPages->SetUserData( m_sViewName, lData ); - } - break; - case E_WINDOW : { - m_pDataContainer_Windows->SetUserData( m_sViewName, lData ); - } - break; - } -} - -//***************************************************************************************************************** -css::uno::Any SvtViewOptions::GetUserItem( const ::rtl::OUString& sName ) const -{ - // Ready for multithreading - ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); - - css::uno::Any aItem; - switch( m_eViewType ) - { - case E_DIALOG : { - aItem = m_pDataContainer_Dialogs->GetUserItem( m_sViewName, sName ); - } - break; - case E_TABDIALOG : { - aItem = m_pDataContainer_TabDialogs->GetUserItem( m_sViewName, sName ); - } - break; - case E_TABPAGE : { - aItem = m_pDataContainer_TabPages->GetUserItem( m_sViewName, sName ); - } - break; - case E_WINDOW : { - aItem = m_pDataContainer_Windows->GetUserItem( m_sViewName, sName ); - } - break; - } - return aItem; -} - -//***************************************************************************************************************** -void SvtViewOptions::SetUserItem( const ::rtl::OUString& sName , - const css::uno::Any& aValue ) -{ - // Ready for multithreading - ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); - - switch( m_eViewType ) - { - case E_DIALOG : { - m_pDataContainer_Dialogs->SetUserItem( m_sViewName, sName, aValue ); - } - break; - case E_TABDIALOG : { - m_pDataContainer_TabDialogs->SetUserItem( m_sViewName, sName, aValue ); - } - break; - case E_TABPAGE : { - m_pDataContainer_TabPages->SetUserItem( m_sViewName, sName, aValue ); - } - break; - case E_WINDOW : { - m_pDataContainer_Windows->SetUserItem( m_sViewName, sName, aValue ); - } - break; - } -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -::osl::Mutex& SvtViewOptions::GetOwnStaticMutex() -{ - // Initialize static mutex only for one time! - static ::osl::Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static ::osl::Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; -} - -void SvtViewOptions::AcquireOptions() -{ - ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); - if( ++m_nRefCount_Dialogs == 1 ) - { - m_pDataContainer_Dialogs = new SvtViewOptionsBase_Impl( LIST_DIALOGS ); - ItemHolder1::holdConfigItem(E_VIEWOPTIONS_DIALOG); - } - if( ++m_nRefCount_TabDialogs == 1 ) - { - m_pDataContainer_TabDialogs = new SvtViewOptionsBase_Impl( LIST_TABDIALOGS ); - ItemHolder1::holdConfigItem(E_VIEWOPTIONS_TABDIALOG); - } - if( ++m_nRefCount_TabPages == 1 ) - { - m_pDataContainer_TabPages = new SvtViewOptionsBase_Impl( LIST_TABPAGES ); - ItemHolder1::holdConfigItem(E_VIEWOPTIONS_TABPAGE); - } - if( ++m_nRefCount_Windows == 1 ) - { - m_pDataContainer_Windows = new SvtViewOptionsBase_Impl( LIST_WINDOWS ); - ItemHolder1::holdConfigItem(E_VIEWOPTIONS_WINDOW); - } -} - -void SvtViewOptions::ReleaseOptions() -{ - ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); - if( --m_nRefCount_Dialogs == 0 ) - { - delete m_pDataContainer_Dialogs; - m_pDataContainer_Dialogs = NULL; - } - if( --m_nRefCount_TabDialogs == 0 ) - { - delete m_pDataContainer_TabDialogs; - m_pDataContainer_TabDialogs = NULL; - } - if( --m_nRefCount_TabPages == 0 ) - { - delete m_pDataContainer_TabPages; - m_pDataContainer_TabPages = NULL; - } - if( --m_nRefCount_Windows == 0 ) - { - delete m_pDataContainer_Windows; - m_pDataContainer_Windows = NULL; - } -} diff --git a/svtools/source/config/workingsetoptions.cxx b/svtools/source/config/workingsetoptions.cxx deleted file mode 100644 index d2c1007a70de..000000000000 --- a/svtools/source/config/workingsetoptions.cxx +++ /dev/null @@ -1,396 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: workingsetoptions.cxx,v $ - * $Revision: 1.10 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include -#include -#include -#include -#include -#include - -#include - -//_________________________________________________________________________________________________________________ -// namespaces -//_________________________________________________________________________________________________________________ - -using namespace ::utl ; -using namespace ::rtl ; -using namespace ::osl ; -using namespace ::com::sun::star::uno ; - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -#define ROOTNODE_WORKINGSET OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/WorkingSet")) -#define DEFAULT_WINDOWLIST Sequence< OUString >() - -#define PROPERTYNAME_WINDOWLIST OUString(RTL_CONSTASCII_USTRINGPARAM("WindowList" )) - -#define PROPERTYHANDLE_WINDOWLIST 0 - -#define PROPERTYCOUNT 1 - -//_________________________________________________________________________________________________________________ -// private declarations! -//_________________________________________________________________________________________________________________ - -class SvtWorkingSetOptions_Impl : public ConfigItem -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - SvtWorkingSetOptions_Impl(); - ~SvtWorkingSetOptions_Impl(); - - //--------------------------------------------------------------------------------------------------------- - // overloaded methods of baseclass - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short called for notify of configmanager - @descr These method is called from the ConfigManager before application ends or from the - PropertyChangeListener if the sub tree broadcasts changes. You must update your - internal values. - - @seealso baseclass ConfigItem - - @param "seqPropertyNames" is the list of properties which should be updated. - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Notify( const Sequence< OUString >& seqPropertyNames ); - - /*-****************************************************************************************************//** - @short write changes to configuration - @descr These method writes the changed values into the sub tree - and should always called in our destructor to guarantee consistency of config data. - - @seealso baseclass ConfigItem - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Commit(); - - //--------------------------------------------------------------------------------------------------------- - // public interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short access method to get internal values - @descr These method give us a chance to regulate acces to ouer internal values. - It's not used in the moment - but it's possible for the feature! - - @seealso - - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - Sequence< OUString > GetWindowList( ) const ; - void SetWindowList( const Sequence< OUString >& seqWindowList ) ; - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return list of key names of ouer configuration management which represent oue module tree - @descr These methods return a static const list of key names. We need it to get needed values from our - configuration management. - - @seealso - - - @param - - @return A list of needed configuration keys is returned. - - @onerror - - *//*-*****************************************************************************************************/ - - static Sequence< OUString > GetPropertyNames(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - Sequence< OUString > m_seqWindowList ; -}; - -//_________________________________________________________________________________________________________________ -// definitions -//_________________________________________________________________________________________________________________ - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtWorkingSetOptions_Impl::SvtWorkingSetOptions_Impl() - // Init baseclasses first - : ConfigItem ( ROOTNODE_WORKINGSET ) - // Init member then. - , m_seqWindowList ( DEFAULT_WINDOWLIST ) -{ - // Use our static list of configuration keys to get his values. - Sequence< OUString > seqNames = GetPropertyNames ( ); - Sequence< Any > seqValues = GetProperties ( seqNames ); - - // Safe impossible cases. - // We need values from ALL configuration keys. - // Follow assignment use order of values in relation to our list of key names! - DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtWorkingSetOptions_Impl::SvtWorkingSetOptions_Impl()\nI miss some values of configuration keys!\n" ); - - // Copy values from list in right order to ouer internal member. - sal_Int32 nPropertyCount = seqValues.getLength(); - for( sal_Int32 nProperty=0; nProperty>= m_seqWindowList; - } - break; - } - } - - // Enable notification mechanism of ouer baseclass. - // We need it to get information about changes outside these class on ouer used configuration keys! - EnableNotification( seqNames ); -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtWorkingSetOptions_Impl::~SvtWorkingSetOptions_Impl() -{ - // We must save our current values .. if user forget it! - if( IsModified() == sal_True ) - { - Commit(); - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtWorkingSetOptions_Impl::Notify( const Sequence< OUString >& seqPropertyNames ) -{ - // Use given list of updated properties to get his values from configuration directly! - Sequence< Any > seqValues = GetProperties( seqPropertyNames ); - // Safe impossible cases. - // We need values from ALL notified configuration keys. - DBG_ASSERT( !(seqPropertyNames.getLength()!=seqValues.getLength()), "SvtWorkingSetOptions_Impl::Notify()\nI miss some values of configuration keys!\n" ); - // Step over list of property names and get right value from coreesponding value list to set it on internal members! - sal_Int32 nCount = seqPropertyNames.getLength(); - for( sal_Int32 nProperty=0; nProperty>= m_seqWindowList; - } - #if OSL_DEBUG_LEVEL > 1 - else DBG_ASSERT( sal_False, "SvtWorkingSetOptions_Impl::Notify()\nUnkown property detected ... I can't handle these!\n" ); - #endif - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtWorkingSetOptions_Impl::Commit() -{ - // Get names of supported properties, create a list for values and copy current values to it. - Sequence< OUString > seqNames = GetPropertyNames (); - sal_Int32 nCount = seqNames.getLength(); - Sequence< Any > seqValues ( nCount ); - for( sal_Int32 nProperty=0; nProperty SvtWorkingSetOptions_Impl::GetWindowList() const -{ - return m_seqWindowList; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtWorkingSetOptions_Impl::SetWindowList( const Sequence< OUString >& seqWindowList ) -{ - m_seqWindowList = seqWindowList; - SetModified(); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Sequence< OUString > SvtWorkingSetOptions_Impl::GetPropertyNames() -{ - // Build static list of configuration key names. - static const OUString pProperties[] = - { - PROPERTYNAME_WINDOWLIST , - }; - // Initialize return sequence with these list ... - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); - // ... and return it. - return seqPropertyNames; -} - -//***************************************************************************************************************** -// initialize static member -// DON'T DO IT IN YOUR HEADER! -// see definition for further informations -//***************************************************************************************************************** -SvtWorkingSetOptions_Impl* SvtWorkingSetOptions::m_pDataContainer = NULL ; -sal_Int32 SvtWorkingSetOptions::m_nRefCount = 0 ; - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtWorkingSetOptions::SvtWorkingSetOptions() -{ - // Global access, must be guarded (multithreading!). - MutexGuard aGuard( GetOwnStaticMutex() ); - // Increase ouer refcount ... - ++m_nRefCount; - // ... and initialize ouer data container only if it not already exist! - if( m_pDataContainer == NULL ) - { - m_pDataContainer = new SvtWorkingSetOptions_Impl; - ItemHolder1::holdConfigItem(E_WORKINGSETOPTIONS); - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtWorkingSetOptions::~SvtWorkingSetOptions() -{ - // Global access, must be guarded (multithreading!) - MutexGuard aGuard( GetOwnStaticMutex() ); - // Decrease ouer refcount. - --m_nRefCount; - // If last instance was deleted ... - // we must destroy ouer static data container! - if( m_nRefCount <= 0 ) - { - delete m_pDataContainer; - m_pDataContainer = NULL; - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -Sequence< OUString > SvtWorkingSetOptions::GetWindowList() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->GetWindowList(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtWorkingSetOptions::SetWindowList( const Sequence< OUString >& seqWindowList ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetWindowList( seqWindowList ); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Mutex& SvtWorkingSetOptions::GetOwnStaticMutex() -{ - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; -} diff --git a/svtools/source/config/xmlaccelcfg.cxx b/svtools/source/config/xmlaccelcfg.cxx deleted file mode 100644 index a2fb5bac5df8..000000000000 --- a/svtools/source/config/xmlaccelcfg.cxx +++ /dev/null @@ -1,418 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: xmlaccelcfg.cxx,v $ - * $Revision: 1.8 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include "xmlaccelcfg.hxx" - -#include -#include -#include - -using namespace rtl; -using namespace com::sun::star::uno; -using namespace com::sun::star::xml::sax; - -#define ELEMENT_ACCELERATORLIST "acceleratorlist" -#define ELEMENT_ACCELERATORITEM "item" - -#define ATTRIBUTE_KEYCODE "code" -#define ATTRIBUTE_MODIFIER "modifier" -#define ATTRIBUTE_URL "url" - -#define ATTRIBUTE_TYPE_CDATA "CDATA" - -// ------------------------------------------------------------------ - -struct AttributeListImpl_impl; -class AttributeListImpl : public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XAttributeList > -{ -protected: - ~AttributeListImpl(); - -public: - AttributeListImpl(); - AttributeListImpl( const AttributeListImpl & ); - -public: - virtual sal_Int16 SAL_CALL getLength(void) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getNameByIndex(sal_Int16 i) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTypeByIndex(sal_Int16 i) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTypeByName(const ::rtl::OUString& aName) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getValueByIndex(sal_Int16 i) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getValueByName(const ::rtl::OUString& aName) throw (::com::sun::star::uno::RuntimeException); - -public: - void addAttribute( const ::rtl::OUString &sName , const ::rtl::OUString &sType , const ::rtl::OUString &sValue ); - void clear(); - -private: - struct AttributeListImpl_impl *m_pImpl; -}; - -struct TagAttribute -{ - TagAttribute(){} - TagAttribute( const OUString &aName, const OUString &aType , const OUString &aValue ) - { - sName = aName; - sType = aType; - sValue = aValue; - } - - OUString sName; - OUString sType; - OUString sValue; -}; - -struct AttributeListImpl_impl -{ - AttributeListImpl_impl() - { - // performance improvement during adding - vecAttribute.reserve(20); - } - ::std::vector vecAttribute; -}; - - - -sal_Int16 SAL_CALL AttributeListImpl::getLength(void) throw (RuntimeException) -{ - return sal::static_int_cast< sal_Int16 >(m_pImpl->vecAttribute.size()); -} - - -AttributeListImpl::AttributeListImpl( const AttributeListImpl &r ) : - cppu::WeakImplHelper1(r) -{ - m_pImpl = new AttributeListImpl_impl; - *m_pImpl = *(r.m_pImpl); -} - -OUString AttributeListImpl::getNameByIndex(sal_Int16 i) throw (RuntimeException) -{ - if( i < sal::static_int_cast(m_pImpl->vecAttribute.size()) ) { - return m_pImpl->vecAttribute[i].sName; - } - return OUString(); -} - - -OUString AttributeListImpl::getTypeByIndex(sal_Int16 i) throw (RuntimeException) -{ - if( i < sal::static_int_cast(m_pImpl->vecAttribute.size()) ) { - return m_pImpl->vecAttribute[i].sType; - } - return OUString(); -} - -OUString AttributeListImpl::getValueByIndex(sal_Int16 i) throw (RuntimeException) -{ - if( i < sal::static_int_cast(m_pImpl->vecAttribute.size()) ) { - return m_pImpl->vecAttribute[i].sValue; - } - return OUString(); - -} - -OUString AttributeListImpl::getTypeByName( const OUString& sName ) throw (RuntimeException) -{ - ::std::vector::iterator ii = m_pImpl->vecAttribute.begin(); - - for( ; ii != m_pImpl->vecAttribute.end() ; ii ++ ) { - if( (*ii).sName == sName ) { - return (*ii).sType; - } - } - return OUString(); -} - -OUString AttributeListImpl::getValueByName(const OUString& sName) throw (RuntimeException) -{ - ::std::vector::iterator ii = m_pImpl->vecAttribute.begin(); - - for( ; ii != m_pImpl->vecAttribute.end() ; ii ++ ) { - if( (*ii).sName == sName ) { - return (*ii).sValue; - } - } - return OUString(); -} - - -AttributeListImpl::AttributeListImpl() -{ - m_pImpl = new AttributeListImpl_impl; -} - - - -AttributeListImpl::~AttributeListImpl() -{ - delete m_pImpl; -} - - -void AttributeListImpl::addAttribute( const OUString &sName , - const OUString &sType , - const OUString &sValue ) -{ - m_pImpl->vecAttribute.push_back( TagAttribute( sName , sType , sValue ) ); -} - -void AttributeListImpl::clear() -{ - ::std::vector dummy; - m_pImpl->vecAttribute.swap( dummy ); - - OSL_ASSERT( ! getLength() ); -} - -// ------------------------------------------------------------------ - -Any SAL_CALL OReadAccelatorDocumentHandler::queryInterface( const Type & rType ) throw( RuntimeException ) -{ - Any a = ::cppu::queryInterface( rType ,SAL_STATIC_CAST( XDocumentHandler*, this )); - if ( a.hasValue() ) - return a; - else - return OWeakObject::queryInterface( rType ); -} - -void SAL_CALL OReadAccelatorDocumentHandler::ignorableWhitespace( - const OUString& ) -throw( SAXException, RuntimeException ) -{ -} - -void SAL_CALL OReadAccelatorDocumentHandler::processingInstruction( - const OUString&, const OUString& ) -throw( SAXException, RuntimeException ) -{ -} - -void SAL_CALL OReadAccelatorDocumentHandler::setDocumentLocator( - const Reference< XLocator > &xLocator) -throw( SAXException, RuntimeException ) -{ - m_xLocator = xLocator; -} - -::rtl::OUString OReadAccelatorDocumentHandler::getErrorLineString() -{ - char buffer[32]; - - if ( m_xLocator.is() ) - { - return OUString::createFromAscii( buffer ); - } - else - return OUString(); -} - -void SAL_CALL OReadAccelatorDocumentHandler::startDocument(void) - throw ( SAXException, RuntimeException ) -{ -} - -void SAL_CALL OReadAccelatorDocumentHandler::endDocument(void) - throw( SAXException, RuntimeException ) -{ - if ( m_nElementDepth > 0 ) - { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "A closing element is missing!" )); - throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); - } -} - - -void SAL_CALL OReadAccelatorDocumentHandler::startElement( - const OUString& aElementName, const Reference< XAttributeList > &xAttrList ) -throw( SAXException, RuntimeException ) -{ - m_nElementDepth++; - - if ( aElementName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ELEMENT_ACCELERATORLIST ))) - { - // acceleratorlist - if ( m_bAcceleratorMode ) - { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "Accelerator list used twice!" )); - throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); - } - else - m_bAcceleratorMode = sal_True; - } - else if ( aElementName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ELEMENT_ACCELERATORITEM ))) - { - // accelerator item - if ( !m_bAcceleratorMode ) - { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "Accelerator list element has to be used before!" )); - throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); - } - else - { - // read accelerator item - m_bItemCloseExpected = sal_True; - - SvtAcceleratorConfigItem aItem; - - // read attributes for accelerator - for ( sal_Int16 i=0; i< xAttrList->getLength(); i++ ) - { - OUString aName = xAttrList->getNameByIndex( i ); - OUString aValue = xAttrList->getValueByIndex( i ); - - if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_URL ))) - aItem.aCommand = aValue; - else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_MODIFIER ))) - aItem.nModifier = (sal_uInt16)aValue.toInt32(); - else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_KEYCODE ))) - aItem.nCode = (sal_uInt16)aValue.toInt32(); - } - - m_aReadAcceleratorList.push_back( aItem ); - } - } - else - { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "Unknown element found!" )); - throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); - } -} - - -void SAL_CALL OReadAccelatorDocumentHandler::characters(const rtl::OUString&) -throw( SAXException, RuntimeException ) -{ -} - - -void SAL_CALL OReadAccelatorDocumentHandler::endElement( const OUString& aName ) - throw( SAXException, RuntimeException ) -{ - m_nElementDepth--; - - if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ELEMENT_ACCELERATORLIST ))) - { - // acceleratorlist - if ( !m_bAcceleratorMode ) - { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "Accelerator list used twice!" )); - throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); - } - } - else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ELEMENT_ACCELERATORITEM ))) - { - if ( !m_bItemCloseExpected ) - { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "Closing accelerator item element expected!" )); - throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); - } - } - else - { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "Unknown closing element found!" )); - throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); - } -} - -// ------------------------------------------------------------------ - -OWriteAccelatorDocumentHandler::OWriteAccelatorDocumentHandler( - const SvtAcceleratorItemList& aWriteAcceleratorList, Reference< XDocumentHandler > xDocumentHandler ) : - m_xWriteDocumentHandler( xDocumentHandler ), - m_aWriteAcceleratorList( aWriteAcceleratorList ) -{ - m_aAttributeType = OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_TYPE_CDATA )); -} - -OWriteAccelatorDocumentHandler::~OWriteAccelatorDocumentHandler() -{ -} - -void OWriteAccelatorDocumentHandler::WriteAcceleratorDocument() - throw ( SAXException, RuntimeException ) -{ - AttributeListImpl* pList = new AttributeListImpl; - Reference< XAttributeList > rList( (XAttributeList *)pList , UNO_QUERY ); - - m_xWriteDocumentHandler->startDocument(); - m_xWriteDocumentHandler->startElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_ACCELERATORLIST )), rList ); - m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - - std::list< SvtAcceleratorConfigItem>::const_iterator p; - for ( p = m_aWriteAcceleratorList.begin(); p != m_aWriteAcceleratorList.end(); p++ ) - WriteAcceleratorItem( *p ); - - m_xWriteDocumentHandler->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_ACCELERATORLIST )) ); - m_xWriteDocumentHandler->endDocument(); -} - -void OWriteAccelatorDocumentHandler::WriteAcceleratorItem( - const SvtAcceleratorConfigItem& aAcceleratorItem ) - throw( SAXException, RuntimeException ) -{ - AttributeListImpl* pAcceleratorAttributes = new AttributeListImpl; - Reference< XAttributeList > xAcceleratorAttrList( (XAttributeList *)pAcceleratorAttributes , UNO_QUERY ); - - // set attributes - pAcceleratorAttributes->addAttribute( - OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_KEYCODE )), - m_aAttributeType, - OUString::valueOf( aAcceleratorItem.nCode )); - - pAcceleratorAttributes->addAttribute( - OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_MODIFIER )), - m_aAttributeType, - OUString::valueOf( aAcceleratorItem.nModifier )); - - pAcceleratorAttributes->addAttribute( - OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_URL )), - m_aAttributeType, - aAcceleratorItem.aCommand ); - - // write start element - m_xWriteDocumentHandler->startElement( - OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_ACCELERATORITEM )), - xAcceleratorAttrList ); - m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - m_xWriteDocumentHandler->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_ACCELERATORITEM )) ); -} diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx index 2b212fdcffeb..7c386b33dc82 100644 --- a/svtools/source/contnr/templwin.cxx +++ b/svtools/source/contnr/templwin.cxx @@ -33,9 +33,9 @@ #include "templwin.hxx" #include "templdlg.hxx" #include -#include -#include -#include +#include +#include +#include #include #include #include "imagemgr.hxx" @@ -52,8 +52,8 @@ #ifndef _SVT_HELPID_HRC #include #endif -#include -#include +#include +#include #include #include "unotools/configmgr.hxx" diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index 4a01a03ad759..d5e7fbaa5cd4 100644 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -66,13 +66,13 @@ #include #endif #include -#include +#include #include #include #include #include #include "urihelper.hxx" -#include +#include #define _SVSTDARR_STRINGSDTOR #include diff --git a/svtools/source/inc/configitems/historyoptions_const.hxx b/svtools/source/inc/configitems/historyoptions_const.hxx deleted file mode 100644 index c9148aeb26f8..000000000000 --- a/svtools/source/inc/configitems/historyoptions_const.hxx +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: historyoptions_const.hxx,v $ - * - * $Revision: 1.1.4.2 $ - * - * last change: $Author: as $ $Date: 2008/03/19 11:17:49 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#ifndef INCLUDE_CONFIGITEMS_HISTORYOPTIONS_CONST_HXX -#define INCLUDE_CONFIGITEMS_HISTORYOPTIONS_CONST_HXX - -#include - -namespace -{ - static const ::rtl::OUString s_sCommonHistory = ::rtl::OUString::createFromAscii("org.openoffice.Office.Common/History"); - static const ::rtl::OUString s_sHistories = ::rtl::OUString::createFromAscii("org.openoffice.Office.Histories/Histories"); - static const ::rtl::OUString s_sPickListSize = ::rtl::OUString::createFromAscii("PickListSize"); - static const ::rtl::OUString s_sURLHistorySize = ::rtl::OUString::createFromAscii("Size"); - static const ::rtl::OUString s_sHelpBookmarksSize = ::rtl::OUString::createFromAscii("HelpBookmarkSize"); - static const ::rtl::OUString s_sPickList = ::rtl::OUString::createFromAscii("PickList"); - static const ::rtl::OUString s_sURLHistory = ::rtl::OUString::createFromAscii("URLHistory"); - static const ::rtl::OUString s_sHelpBookmarks = ::rtl::OUString::createFromAscii("HelpBookmarks"); - static const ::rtl::OUString s_sItemList = ::rtl::OUString::createFromAscii("ItemList"); - static const ::rtl::OUString s_sOrderList = ::rtl::OUString::createFromAscii("OrderList"); - static const ::rtl::OUString s_sHistoryItemRef = ::rtl::OUString::createFromAscii("HistoryItemRef"); - static const ::rtl::OUString s_sURL = ::rtl::OUString::createFromAscii("URL"); - static const ::rtl::OUString s_sFilter = ::rtl::OUString::createFromAscii("Filter"); - static const ::rtl::OUString s_sTitle = ::rtl::OUString::createFromAscii("Title"); - static const ::rtl::OUString s_sPassword = ::rtl::OUString::createFromAscii("Password"); -} - -#endif // INCLUDE_CONFIGITEMS_HISTORYOPTIONS_CONST_HXX diff --git a/svtools/source/inc/configitems/useroptions_const.hxx b/svtools/source/inc/configitems/useroptions_const.hxx deleted file mode 100644 index 4dbd6da8bba3..000000000000 --- a/svtools/source/inc/configitems/useroptions_const.hxx +++ /dev/null @@ -1,64 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: useroptions_const.hxx,v $ - * - * $Revision: 1.1.4.2 $ - * - * last change: $Author: as $ $Date: 2008/03/19 11:17:50 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef INCLUDE_CONFIGITEMS_USEROPTIONS_CONST_HXX -#define INCLUDE_CONFIGITEMS_USEROPTIONS_CONST_HXX - -#include - -namespace -{ - static const ::rtl::OUString s_sData = ::rtl::OUString::createFromAscii("org.openoffice.UserProfile/Data"); - static const ::rtl::OUString s_so = ::rtl::OUString::createFromAscii("o"); // USER_OPT_COMPANY - static const ::rtl::OUString s_sgivenname = ::rtl::OUString::createFromAscii("givenname"); // USER_OPT_FIRSTNAME - static const ::rtl::OUString s_ssn = ::rtl::OUString::createFromAscii("sn"); // USER_OPT_LASTNAME - static const ::rtl::OUString s_sinitials = ::rtl::OUString::createFromAscii("initials"); // USER_OPT_ID - static const ::rtl::OUString s_sstreet = ::rtl::OUString::createFromAscii("street"); // USER_OPT_STREET - static const ::rtl::OUString s_sl = ::rtl::OUString::createFromAscii("l"); // USER_OPT_CITY - static const ::rtl::OUString s_sst = ::rtl::OUString::createFromAscii("st"); // USER_OPT_STATE - static const ::rtl::OUString s_spostalcode = ::rtl::OUString::createFromAscii("postalcode"); // USER_OPT_ZIP - static const ::rtl::OUString s_sc = ::rtl::OUString::createFromAscii("c"); // USER_OPT_COUNTRY - static const ::rtl::OUString s_stitle = ::rtl::OUString::createFromAscii("title"); // USER_OPT_TITLE - static const ::rtl::OUString s_sposition = ::rtl::OUString::createFromAscii("position"); // USER_OPT_POSITION - static const ::rtl::OUString s_shomephone = ::rtl::OUString::createFromAscii("homephone"); // USER_OPT_TELEPHONEHOME - static const ::rtl::OUString s_stelephonenumber = ::rtl::OUString::createFromAscii("telephonenumber"); // USER_OPT_TELEPHONEWORK - static const ::rtl::OUString s_sfacsimiletelephonenumber = ::rtl::OUString::createFromAscii("facsimiletelephonenumber"); // USER_OPT_FAX - static const ::rtl::OUString s_smail = ::rtl::OUString::createFromAscii("mail"); // USER_OPT_EMAIL - static const ::rtl::OUString s_scustomernumber = ::rtl::OUString::createFromAscii("customernumber"); // USER_OPT_CUSTOMERNUMBER - static const ::rtl::OUString s_sfathersname = ::rtl::OUString::createFromAscii("fathersname"); // USER_OPT_FATHERSNAME - static const ::rtl::OUString s_sapartment = ::rtl::OUString::createFromAscii("apartment"); // USER_OPT_APARTMENT -} - -#endif // INCLUDE_CONFIGITEMS_USEROPTIONS_CONST_HXX diff --git a/svtools/source/misc/documentlockfile.cxx b/svtools/source/misc/documentlockfile.cxx index 990f1ba58d73..1f54a6771f95 100644 --- a/svtools/source/misc/documentlockfile.cxx +++ b/svtools/source/misc/documentlockfile.cxx @@ -56,7 +56,7 @@ #include -#include +#include #include diff --git a/svtools/source/misc/lockfilecommon.cxx b/svtools/source/misc/lockfilecommon.cxx index ef2cf89d8572..ba4440c462a8 100644 --- a/svtools/source/misc/lockfilecommon.cxx +++ b/svtools/source/misc/lockfilecommon.cxx @@ -57,7 +57,7 @@ #include -#include +#include #include diff --git a/svtools/source/misc/sharecontrolfile.cxx b/svtools/source/misc/sharecontrolfile.cxx index dbea89f54bcc..32d7b1873f68 100644 --- a/svtools/source/misc/sharecontrolfile.cxx +++ b/svtools/source/misc/sharecontrolfile.cxx @@ -57,7 +57,7 @@ #include #include -#include +#include #include diff --git a/svtools/source/misc/templatefoldercache.cxx b/svtools/source/misc/templatefoldercache.cxx index 93ed9a7f5c90..348a9638399b 100644 --- a/svtools/source/misc/templatefoldercache.cxx +++ b/svtools/source/misc/templatefoldercache.cxx @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include "comphelper/processfactory.hxx" diff --git a/svtools/source/passwordcontainer/passwordcontainer.cxx b/svtools/source/passwordcontainer/passwordcontainer.cxx index cebde0705f12..5f9ce207ff6b 100644 --- a/svtools/source/passwordcontainer/passwordcontainer.cxx +++ b/svtools/source/passwordcontainer/passwordcontainer.cxx @@ -33,7 +33,7 @@ #include "passwordcontainer.hxx" -#include +#include #include "cppuhelper/factory.hxx" #include #include diff --git a/svtools/source/productregistration/makefile.mk b/svtools/source/productregistration/makefile.mk index bc964e142232..1892f1600dd8 100644 --- a/svtools/source/productregistration/makefile.mk +++ b/svtools/source/productregistration/makefile.mk @@ -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 @@ -57,6 +57,7 @@ SHL1STDLIBS=\ $(TKLIB) \ $(VCLLIB) \ $(SVLLIB) \ + $(UNOTOOLSLIB) \ $(TOOLSLIB) \ $(CPPUHELPERLIB) \ $(CPPULIB) \ diff --git a/svtools/source/productregistration/productregistration.cxx b/svtools/source/productregistration/productregistration.cxx index b3d90a73b231..4f9d1bb476ef 100644 --- a/svtools/source/productregistration/productregistration.cxx +++ b/svtools/source/productregistration/productregistration.cxx @@ -32,7 +32,7 @@ #include "precompiled_svtools.hxx" #include "productregistration.hxx" -#include "regoptions.hxx" +#include "unotools/regoptions.hxx" #include "registrationdlg.hxx" #ifndef _SVTOOLS_HRC #include @@ -308,18 +308,18 @@ namespace svt sal_Bool bDeactivateJob = sal_True; // our config options - RegOptions aRegOptions; + utl::RegOptions aRegOptions; // check them for the permissions for the dialog - RegOptions::DialogPermission ePermission( aRegOptions.getDialogPermission() ); + utl::RegOptions::DialogPermission ePermission( aRegOptions.getDialogPermission() ); - if ( RegOptions::dpDisabled != ePermission ) + if ( utl::RegOptions::dpDisabled != ePermission ) { // the dialog is _not_ disabled // for this session, I'm no interested in the dialog registration anymore aRegOptions.markSessionDone( ); - if ( ( RegOptions::dpNotThisSession == ePermission ) // first trigger session not reached - || ( RegOptions::dpRemindLater == ePermission ) // or at a later reminder date + if ( ( utl::RegOptions::dpNotThisSession == ePermission ) // first trigger session not reached + || ( utl::RegOptions::dpRemindLater == ePermission ) // or at a later reminder date ) { // the dialog should be executed during one of the next sessions bDeactivateJob = sal_False; @@ -327,7 +327,7 @@ namespace svt else { // if we're here, the dialog should be executed during this session - OSL_ENSURE( RegOptions::dpThisSession == ePermission, "OProductRegistration::execute: invalid permissions!" ); + OSL_ENSURE( utl::RegOptions::dpThisSession == ePermission, "OProductRegistration::execute: invalid permissions!" ); { // this is some kind of HACK. @@ -412,7 +412,7 @@ namespace svt OSL_ENSURE( xSystemShell.is(), "OProductRegistration::doOnlineRegistration: invalid SystemExecute component!" ); // access the configuration to retrieve the URL we shall use for registration - RegOptions aOptions; + utl::RegOptions aOptions; OUString sRegistrationURL( aOptions.getRegistrationURL( ) ); OSL_ENSURE( sRegistrationURL.getLength(), "OProductRegistration::doOnlineRegistration: invalid URL found!" ); @@ -436,7 +436,7 @@ namespace svt aRegistrationError.Execute(); // try again later - RegOptions aRegOptions; + utl::RegOptions aRegOptions; aRegOptions.activateReminder( 7 ); } } diff --git a/svtools/uno/pathservice.cxx b/svtools/uno/pathservice.cxx index 65d08609483a..152ff5f316ab 100644 --- a/svtools/uno/pathservice.cxx +++ b/svtools/uno/pathservice.cxx @@ -31,7 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#include +#include #include "sal/types.h" #include "rtl/ustring.hxx" #include diff --git a/svtools/util/makefile.mk b/svtools/util/makefile.mk index 80596d23e866..fac8f654bfbe 100644 --- a/svtools/util/makefile.mk +++ b/svtools/util/makefile.mk @@ -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 @@ -83,13 +83,12 @@ LIB7FILES= \ $(SLB)$/svdde.lib \ $(SLB)$/svhtml.lib \ $(SLB)$/svrtf.lib \ - $(SLB)$/heavyconfig.lib \ + $(SLB)$/config.lib \ $(SLB)$/table.lib \ - $(SLB)$/java.lib + $(SLB)$/java.lib LIB8TARGET= $(SLB)$/svl.lib LIB8FILES= \ - $(SLB)$/config.lib \ $(SLB)$/filerec.lib \ $(SLB)$/filepicker.lib \ $(SLB)$/items1.lib \ diff --git a/unotools/inc/unotools/accelcfg.hxx b/unotools/inc/unotools/accelcfg.hxx new file mode 100644 index 000000000000..70a0d26545f5 --- /dev/null +++ b/unotools/inc/unotools/accelcfg.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: accelcfg.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_unotools_ACCELCFG_HXX +#define INCLUDED_unotools_ACCELCFG_HXX + +#include +#include + +#include +#include + +struct SvtAcceleratorConfigItem +{ + sal_uInt16 nCode; + sal_uInt16 nModifier; + ::rtl::OUString aCommand; +}; + +#include +typedef ::std::list < SvtAcceleratorConfigItem > SvtAcceleratorItemList; + +class SvStream; +class KeyEvent; +class String; +class SvtAcceleratorConfig_Impl; + +class SvtAcceleratorConfiguration: public utl::detail::Options +{ + SvtAcceleratorConfig_Impl* pImp; + +private: + +public: + // get the global accelerators + SvtAcceleratorConfiguration(); + + // get special accelerators + static SvtAcceleratorConfiguration* CreateFromStream( SvStream& rStream ); + static String GetStreamName(); + static SvStream* GetDefaultStream( StreamMode ); + + virtual ~SvtAcceleratorConfiguration(); + + // save the configuration to a stream, f.e. into a document + bool Commit( SvStream& rStream ); + + // returns the configured URL for a KeyEvent + ::rtl::OUString GetCommand( const ::com::sun::star::awt::KeyEvent& rKeyEvent ); + + // returns the whole configuration + const SvtAcceleratorItemList& GetItems(); + + // sets a single configuration item + void SetCommand( const SvtAcceleratorConfigItem& rItem ); + + // sets several or all configuration items + // if bClear=FALSE, all items not in the sequence remain unchanged + void SetItems( const SvtAcceleratorItemList& rItems, bool bClear ); +}; + +#endif diff --git a/unotools/inc/unotools/cacheoptions.hxx b/unotools/inc/unotools/cacheoptions.hxx new file mode 100644 index 000000000000..a9adf9a14467 --- /dev/null +++ b/unotools/inc/unotools/cacheoptions.hxx @@ -0,0 +1,176 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: cacheoptions.hxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_unotools_CACHEOPTIONS_HXX +#define INCLUDED_unotools_CACHEOPTIONS_HXX + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include "unotools/unotoolsdllapi.h" +#include +#include +#include + +//_________________________________________________________________________________________________________________ +// forward declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short forward declaration to our private date container implementation + @descr We use these class as internal member to support small memory requirements. + You can create the container if it is neccessary. The class which use these mechanism + is faster and smaller then a complete implementation! +*//*-*************************************************************************************************************/ + +class SvtCacheOptions_Impl; + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short collect informations about startup features + @descr - + + @implements - + @base - + + @devstatus ready to use +*//*-*************************************************************************************************************/ + +class UNOTOOLS_DLLPUBLIC SvtCacheOptions +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor and destructor + @descr This will initialize an instance with default values. + We implement these class with a refcount mechanism! Every instance of this class increase it + at create and decrease it at delete time - but all instances use the same data container! + He is implemented as a static member ... + + @seealso member m_nRefCount + @seealso member m_pDataContainer + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + SvtCacheOptions(); + ~SvtCacheOptions(); + + //--------------------------------------------------------------------------------------------------------- + // interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short interface methods to get and set value of config key "org.openoffice.Office.Common/_3D-Engine/..." + @descr These options describe internal states to enable/disable features of installed office. + + GetWriterOLE_Objects() + SetWriterOLE_Objects() => set the number of Writer OLE objects to be cached + + GetDrawingEngineOLE_Objects() + SetDrawingEngineOLE_Objects() => set the number of DrawingEngine OLE objects to be cached + + GetGraphicManagerTotalCacheSize() + SetGraphicManagerTotalCacheSize() => set the maximum cache size used by GraphicManager to cache graphic objects + + GetGraphicManagerObjectCacheSize() + SetGraphicManagerObjectCacheSize() => set the maximum cache size for one GraphicObject to be cached by GraphicManager + + @seealso configuration package "org.openoffice.Office.Common/_3D-Engine" + *//*-*****************************************************************************************************/ + + sal_Int32 GetWriterOLE_Objects() const; + sal_Int32 GetDrawingEngineOLE_Objects() const; + sal_Int32 GetGraphicManagerTotalCacheSize() const; + sal_Int32 GetGraphicManagerObjectCacheSize() const; + sal_Int32 GetGraphicManagerObjectReleaseTime() const; + + void SetWriterOLE_Objects( sal_Int32 nObjects ); + void SetDrawingEngineOLE_Objects( sal_Int32 nObjects ); + void SetGraphicManagerTotalCacheSize( sal_Int32 nTotalCacheSize ); + void SetGraphicManagerObjectCacheSize( sal_Int32 nObjectCacheSize ); + void SetGraphicManagerObjectReleaseTime( sal_Int32 nReleaseTimeSeconds ); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return a reference to a static mutex + @descr These class use his own static mutex to be threadsafe. + We create a static mutex only for one ime and use at different times. + + @seealso - + + @param - + @return A reference to a static mutex member. + + @onerror - + *//*-*****************************************************************************************************/ + + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + /*Attention + + Don't initialize these static member in these header! + a) Double dfined symbols will be detected ... + b) and unresolved externals exist at linking time. + Do it in your source only. + */ + + static SvtCacheOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! + static sal_Int32 m_nRefCount ; /// internal ref count mechanism + +}; + +#endif // #ifndef INCLUDED_unotools_CACHEOPTIONS_HXX diff --git a/unotools/inc/unotools/cmdoptions.hxx b/unotools/inc/unotools/cmdoptions.hxx new file mode 100644 index 000000000000..85d8a0725f3c --- /dev/null +++ b/unotools/inc/unotools/cmdoptions.hxx @@ -0,0 +1,258 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: cmdoptions.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_unotools_CMDOPTIONS_HXX +#define INCLUDED_unotools_CMDOPTIONS_HXX + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include "unotools/unotoolsdllapi.h" +#include +#include +#include +#include +#include +#include + +//_________________________________________________________________________________________________________________ +// types, enums, ... +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @descr The method GetList() returns a list of property values. + Use follow defines to seperate values by names. +*//*-*************************************************************************************************************/ +#define CMDOPTIONS_PROPERTYNAME_URL ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CommandURL" )) + +//_________________________________________________________________________________________________________________ +// forward declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short forward declaration to our private date container implementation + @descr We use these class as internal member to support small memory requirements. + You can create the container if it is neccessary. The class which use these mechanism + is faster and smaller then a complete implementation! +*//*-*************************************************************************************************************/ + +class SvtCommandOptions_Impl; + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short collect informations about dynamic menus + @descr Make it possible to configure dynamic menu structures of menus like "new" or "wizard". + + @implements - + @base - + + @devstatus ready to use +*//*-*************************************************************************************************************/ + +class UNOTOOLS_DLLPUBLIC SvtCommandOptions: public utl::detail::Options +{ + friend class SvtCommandOptions_Impl; + + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + enum CmdOption + { + CMDOPTION_DISABLED, + CMDOPTION_NONE + }; + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor and destructor + @descr This will initialize an instance with default values. + We implement these class with a refcount mechanism! Every instance of this class increase it + at create and decrease it at delete time - but all instances use the same data container! + He is implemented as a static member ... + + @seealso member m_nRefCount + @seealso member m_pDataContainer + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + SvtCommandOptions(); + virtual ~SvtCommandOptions(); + + //--------------------------------------------------------------------------------------------------------- + // interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short clear complete sepcified list + @descr Call this methods to clear the whole list. + To fill it again use AppendItem(). + + @seealso - + + @param "eMenu" select right menu to clear. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void Clear( CmdOption eOption ); + + /*-****************************************************************************************************//** + @short return complete specified list + @descr Call it to get all entries of an dynamic menu. + We return a list of all nodes with his names and properties. + + @seealso - + + @param "eOption" select the list to retrieve. + @return A list of command strings is returned. + + @onerror We return an empty list. + *//*-*****************************************************************************************************/ + + sal_Bool HasEntries( CmdOption eOption ) const; + + /*-****************************************************************************************************//** + @short Lookup if a command URL is inside a given list + @descr Lookup if a command URL is inside a given lst + + @seealso - + + @param "eOption" select right command list + @param "aCommandURL" a command URL that is used for the look up + @return "sal_True" if the command is inside the list otherwise "sal_False" + + @onerror - + *//*-*****************************************************************************************************/ + + sal_Bool Lookup( CmdOption eOption, const ::rtl::OUString& aCommandURL ) const; + + /*-****************************************************************************************************//** + @short return complete specified list + @descr Call it to get all entries of an dynamic menu. + We return a list of all nodes with his names and properties. + + @seealso - + + @param "eOption" select the list to retrieve. + @return A list of command strings is returned. + + @onerror We return an empty list. + *//*-*****************************************************************************************************/ + + ::com::sun::star::uno::Sequence< ::rtl::OUString > GetList( CmdOption eOption ) const; + + /*-****************************************************************************************************//** + @short adds a new command to specified options list + @descr You can add a command to specified options list! + + @seealso method Clear() + + @param "eOption" specifies the command list + @param "sURL" URL for dispatch + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void AddCommand( CmdOption eOption, const ::rtl::OUString& sURL ); + + /*-****************************************************************************************************//** + @short register an office frame, which must update its dispatches if + the underlying configuration was changed. + + @descr To avoid using of "dead" frame objects or implementing + deregistration mechanism too, we use weak references to + the given frames. + + @param "xFrame" points to the frame, which wish to be + notified, if configuration was changed. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void EstablisFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return a reference to a static mutex + @descr These class is partially threadsafe (for de-/initialization only). + All access methods are'nt safe! + We create a static mutex only for one ime and use at different times. + + @seealso - + + @param - + @return A reference to a static mutex member. + + @onerror - + *//*-*****************************************************************************************************/ + + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + /*Attention + + Don't initialize these static member in these header! + a) Double dfined symbols will be detected ... + b) and unresolved externals exist at linking time. + Do it in your source only. + */ + + static SvtCommandOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! + static sal_Int32 m_nRefCount ; /// internal ref count mechanism + +}; // class SvtCmdOptions + +#endif // #ifndef INCLUDED_unotools_CMDOPTIONS_HXX diff --git a/unotools/inc/unotools/compatibility.hxx b/unotools/inc/unotools/compatibility.hxx new file mode 100644 index 000000000000..0c7c41882c09 --- /dev/null +++ b/unotools/inc/unotools/compatibility.hxx @@ -0,0 +1,256 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: compatibility.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_unotools_COMPATIBILITY_HXX +#define INCLUDED_unotools_COMPATIBILITY_HXX + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include "unotools/unotoolsdllapi.h" +#include +#include +#include +#include +#include + +//_________________________________________________________________________________________________________________ +// types, enums, ... +//_________________________________________________________________________________________________________________ + +enum CompatibilityOptions +{ + COPT_USE_PRINTERDEVICE = 0, + COPT_ADD_SPACING, + COPT_ADD_SPACING_AT_PAGES, + COPT_USE_OUR_TABSTOPS, + COPT_NO_EXTLEADING, + COPT_USE_LINESPACING, + COPT_ADD_TABLESPACING, + COPT_USE_OBJECTPOSITIONING, + COPT_USE_OUR_TEXTWRAPPING, + COPT_CONSIDER_WRAPPINGSTYLE, + COPT_EXPAND_WORDSPACE +}; + +/*-************************************************************************************************************//** + @descr The method GetList() returns a list of property values. + Use follow defines to seperate values by names. +*//*-*************************************************************************************************************/ +#define COMPATIBILITY_PROPERTYNAME_NAME OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) +#define COMPATIBILITY_PROPERTYNAME_MODULE OUString( RTL_CONSTASCII_USTRINGPARAM( "Module" ) ) +#define COMPATIBILITY_PROPERTYNAME_USEPRTMETRICS OUString( RTL_CONSTASCII_USTRINGPARAM( "UsePrinterMetrics" ) ) +#define COMPATIBILITY_PROPERTYNAME_ADDSPACING OUString( RTL_CONSTASCII_USTRINGPARAM( "AddSpacing" ) ) +#define COMPATIBILITY_PROPERTYNAME_ADDSPACINGATPAGES OUString( RTL_CONSTASCII_USTRINGPARAM( "AddSpacingAtPages" ) ) +#define COMPATIBILITY_PROPERTYNAME_USEOURTABSTOPS OUString( RTL_CONSTASCII_USTRINGPARAM( "UseOurTabStopFormat" ) ) +#define COMPATIBILITY_PROPERTYNAME_NOEXTLEADING OUString( RTL_CONSTASCII_USTRINGPARAM( "NoExternalLeading" ) ) +#define COMPATIBILITY_PROPERTYNAME_USELINESPACING OUString( RTL_CONSTASCII_USTRINGPARAM( "UseLineSpacing" ) ) +#define COMPATIBILITY_PROPERTYNAME_ADDTABLESPACING OUString( RTL_CONSTASCII_USTRINGPARAM( "AddTableSpacing" ) ) +#define COMPATIBILITY_PROPERTYNAME_USEOBJECTPOSITIONING OUString( RTL_CONSTASCII_USTRINGPARAM( "UseObjectPositioning" ) ) +#define COMPATIBILITY_PROPERTYNAME_USEOURTEXTWRAPPING OUString( RTL_CONSTASCII_USTRINGPARAM( "UseOurTextWrapping" ) ) +#define COMPATIBILITY_PROPERTYNAME_CONSIDERWRAPPINGSTYLE OUString( RTL_CONSTASCII_USTRINGPARAM( "ConsiderWrappingStyle" ) ) +#define COMPATIBILITY_PROPERTYNAME_EXPANDWORDSPACE OUString( RTL_CONSTASCII_USTRINGPARAM( "ExpandWordSpace" ) ) + +#define COMPATIBILITY_DEFAULT_NAME OUString( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ) + +//_________________________________________________________________________________________________________________ +// forward declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short forward declaration to our private date container implementation + @descr We use these class as internal member to support small memory requirements. + You can create the container if it is neccessary. The class which use these mechanism + is faster and smaller then a complete implementation! +*//*-*************************************************************************************************************/ + +class SvtCompatibilityOptions_Impl; + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short collect informations about dynamic menus + @descr Make it possible to configure dynamic menu structures of menus like "new" or "wizard". + + @implements - + @base - + + @devstatus ready to use +*//*-*************************************************************************************************************/ + +class UNOTOOLS_DLLPUBLIC SvtCompatibilityOptions: public utl::detail::Options +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor and destructor + @descr This will initialize an instance with default values. + We implement these class with a refcount mechanism! Every instance of this class increase it + at create and decrease it at delete time - but all instances use the same data container! + He is implemented as a static member ... + + @seealso member m_nRefCount + @seealso member m_pDataContainer + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + SvtCompatibilityOptions(); + virtual ~SvtCompatibilityOptions(); + + //--------------------------------------------------------------------------------------------------------- + // interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short clear complete specified list + @descr Call this methods to clear the whole list. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void Clear(); + + /*-****************************************************************************************************//** + @short return complete specified list + @descr Call it to get all entries of compatibility options. + We return a list of all nodes with its names and properties. + + @seealso - + + @param - + @return A list of compatibility options is returned. + + @onerror We return an empty list. + *//*-*****************************************************************************************************/ + + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > GetList() const; + + /*-****************************************************************************************************//** + @short append a new item + @descr + + @seealso method Clear() + + @param "sName" Name + @param "sModule" Module + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void AppendItem( const ::rtl::OUString& sName, + const ::rtl::OUString& sModule, + bool bUsePrtMetrics, + bool bAddSpacing, + bool bAddSpacingAtPages, + bool bUseOurTabStops, + bool bNoExtLeading, + bool bUseLineSpacing, + bool bAddTableSpacing, + bool bUseObjectPositioning, + bool bUseOurTextWrapping, + bool bConsiderWrappingStyle, + bool bExpandWordSpace ); + + bool IsUsePrtDevice() const; + bool IsAddSpacing() const; + bool IsAddSpacingAtPages() const; + bool IsUseOurTabStops() const; + bool IsNoExtLeading() const; + bool IsUseLineSpacing() const; + bool IsAddTableSpacing() const; + bool IsUseObjectPositioning() const; + bool IsUseOurTextWrapping() const; + bool IsConsiderWrappingStyle() const; + bool IsExpandWordSpace() const; + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return a reference to a static mutex + @descr These class is partially threadsafe (for de-/initialization only). + All access methods are'nt safe! + We create a static mutex only for one ime and use at different times. + + @seealso - + + @param - + @return A reference to a static mutex member. + + @onerror - + *//*-*****************************************************************************************************/ + + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + /*Attention + + Don't initialize these static member in these header! + a) Double dfined symbols will be detected ... + b) and unresolved externals exist at linking time. + Do it in your source only. + */ + + static SvtCompatibilityOptions_Impl* m_pDataContainer; /// impl. data container as dynamic pointer for smaller memory requirements! + static sal_Int32 m_nRefCount ; /// internal ref count mechanism + +}; // class SvtCompatibilityOptions + +#endif // #ifndef INCLUDED_unotools_COMPATIBILITY_HXX + diff --git a/unotools/inc/unotools/configitem.hxx b/unotools/inc/unotools/configitem.hxx index f3b9db2da452..2af7a089bb54 100644 --- a/unotools/inc/unotools/configitem.hxx +++ b/unotools/inc/unotools/configitem.hxx @@ -36,6 +36,7 @@ #include #include #include "unotools/unotoolsdllapi.h" +#include "unotools/options.hxx" //----------------------------------------------------------------------------- namespace com{ namespace sun{ namespace star{ @@ -76,7 +77,7 @@ namespace utl class ConfigManager; struct ConfigItem_Impl; - class UNOTOOLS_DLLPUBLIC ConfigItem + class UNOTOOLS_DLLPUBLIC ConfigItem : public ConfigurationBroadcaster { friend class ConfigChangeListener_Impl; friend class ConfigManager; @@ -87,6 +88,7 @@ namespace utl com::sun::star::uno::Reference< com::sun::star::util::XChangesListener > xChangeLstnr; ConfigItem_Impl* pImpl; + IMPL_ConfigurationListenerList* mpList; ConfigItem();// void RemoveChangesListener(); diff --git a/unotools/inc/unotools/defaultoptions.hxx b/unotools/inc/unotools/defaultoptions.hxx new file mode 100644 index 000000000000..603d7fd6d22a --- /dev/null +++ b/unotools/inc/unotools/defaultoptions.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: defaultoptions.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_unotools_DEFAULTOPTIONS_HXX +#define INCLUDED_unotools_DEFAULTOPTIONS_HXX + +#include "unotools/unotoolsdllapi.h" +#include "tools/solar.h" +#include + +class String; +class SvtDefaultOptions_Impl; + +// class SvtDefaultOptions ----------------------------------------------- + +class SvtDefaultOptions_Impl; +class UNOTOOLS_DLLPUBLIC SvtDefaultOptions: public utl::detail::Options +{ +private: + SvtDefaultOptions_Impl* pImp; + +public: + + SvtDefaultOptions(); + virtual ~SvtDefaultOptions(); + + String GetDefaultPath( USHORT nId ) const; +}; + +#endif // #ifndef INCLUDED_unotools_DEFAULTOPTIONS_HXX + diff --git a/unotools/inc/unotools/dynamicmenuoptions.hxx b/unotools/inc/unotools/dynamicmenuoptions.hxx new file mode 100644 index 000000000000..2841970c5a84 --- /dev/null +++ b/unotools/inc/unotools/dynamicmenuoptions.hxx @@ -0,0 +1,222 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: dynamicmenuoptions.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_unotools_DYNAMICMENUOPTIONS_HXX +#define INCLUDED_unotools_DYNAMICMENUOPTIONS_HXX + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include "unotools/unotoolsdllapi.h" +#include +#include +#include +#include +#include + +//_________________________________________________________________________________________________________________ +// types, enums, ... +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @descr The method GetList() returns a list of property values. + Use follow defines to seperate values by names. +*//*-*************************************************************************************************************/ +#define DYNAMICMENU_PROPERTYNAME_URL ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL" )) +#define DYNAMICMENU_PROPERTYNAME_TITLE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Title" )) +#define DYNAMICMENU_PROPERTYNAME_IMAGEIDENTIFIER ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ImageIdentifier" )) +#define DYNAMICMENU_PROPERTYNAME_TARGETNAME ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TargetName" )) + +/*-************************************************************************************************************//** + @descr You can use these enum values to specify right menu if you call our interface methods. +*//*-*************************************************************************************************************/ +enum EDynamicMenuType +{ + E_NEWMENU = 0, + E_WIZARDMENU = 1, + E_HELPBOOKMARKS = 2 +}; +//_________________________________________________________________________________________________________________ +// forward declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short forward declaration to our private date container implementation + @descr We use these class as internal member to support small memory requirements. + You can create the container if it is neccessary. The class which use these mechanism + is faster and smaller then a complete implementation! +*//*-*************************************************************************************************************/ + +class SvtDynamicMenuOptions_Impl; + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short collect informations about dynamic menus + @descr Make it possible to configure dynamic menu structures of menus like "new" or "wizard". + + @implements - + @base - + + @devstatus ready to use +*//*-*************************************************************************************************************/ + +class UNOTOOLS_DLLPUBLIC SvtDynamicMenuOptions: public utl::detail::Options +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor and destructor + @descr This will initialize an instance with default values. + We implement these class with a refcount mechanism! Every instance of this class increase it + at create and decrease it at delete time - but all instances use the same data container! + He is implemented as a static member ... + + @seealso member m_nRefCount + @seealso member m_pDataContainer + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + SvtDynamicMenuOptions(); + virtual ~SvtDynamicMenuOptions(); + + //--------------------------------------------------------------------------------------------------------- + // interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short clear complete sepcified list + @descr Call this methods to clear the whole list. + To fill it again use AppendItem(). + + @seealso - + + @param "eMenu" select right menu to clear. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void Clear( EDynamicMenuType eMenu ); + + /*-****************************************************************************************************//** + @short return complete specified list + @descr Call it to get all entries of an dynamic menu. + We return a list of all nodes with his names and properties. + + @seealso - + + @param "eMenu" select right menu. + @return A list of menu items is returned. + + @onerror We return an empty list. + *//*-*****************************************************************************************************/ + + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > GetMenu( EDynamicMenuType eMenu ) const; + + /*-****************************************************************************************************//** + @short append a new item to specified menu + @descr You can append items to a menu only - removing isn't allowed for a special item! + We support a nothing or all mechanism only! Clear all or append something ... + + @seealso method Clear() + + @param "eMenu" select right menu. + @param "sURL" URL for dispatch + @param "sTitle" label of menu entry + @param "sImageIdentifier" icon identifier + @param "sTargetName" target for dispatch + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void AppendItem( EDynamicMenuType eMenu , + const ::rtl::OUString& sURL , + const ::rtl::OUString& sTitle , + const ::rtl::OUString& sImageIdentifier , + const ::rtl::OUString& sTargetName ); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return a reference to a static mutex + @descr These class is partially threadsafe (for de-/initialization only). + All access methods are'nt safe! + We create a static mutex only for one ime and use at different times. + + @seealso - + + @param - + @return A reference to a static mutex member. + + @onerror - + *//*-*****************************************************************************************************/ + + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + /*Attention + + Don't initialize these static member in these header! + a) Double dfined symbols will be detected ... + b) and unresolved externals exist at linking time. + Do it in your source only. + */ + + static SvtDynamicMenuOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! + static sal_Int32 m_nRefCount ; /// internal ref count mechanism + +}; // class SvtDynamicMenuOptions + +#endif // #ifndef INCLUDED_unotools_DYNAMICMENUOPTIONS_HXX diff --git a/unotools/inc/unotools/eventcfg.hxx b/unotools/inc/unotools/eventcfg.hxx new file mode 100644 index 000000000000..0cee43e59dc5 --- /dev/null +++ b/unotools/inc/unotools/eventcfg.hxx @@ -0,0 +1,125 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: eventcfg.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _EVENTCFG_HXX +#define _EVENTCFG_HXX + +#include "unotools/unotoolsdllapi.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#define STR_EVENT_STARTAPP 0 +#define STR_EVENT_CLOSEAPP 1 +#define STR_EVENT_DOCCREATED 2 +#define STR_EVENT_CREATEDOC 3 +#define STR_EVENT_LOADFINISHED 4 +#define STR_EVENT_OPENDOC 5 +#define STR_EVENT_PREPARECLOSEDOC 6 +#define STR_EVENT_CLOSEDOC 7 +#define STR_EVENT_SAVEDOC 8 +#define STR_EVENT_SAVEDOCDONE 9 +#define STR_EVENT_SAVEDOCFAILED 10 +#define STR_EVENT_SAVEASDOC 11 +#define STR_EVENT_SAVEASDOCDONE 12 +#define STR_EVENT_SAVEASDOCFAILED 13 +#define STR_EVENT_SAVETODOC 14 +#define STR_EVENT_SAVETODOCDONE 15 +#define STR_EVENT_SAVETODOCFAILED 16 +#define STR_EVENT_ACTIVATEDOC 17 +#define STR_EVENT_DEACTIVATEDOC 18 +#define STR_EVENT_PRINTDOC 19 +#define STR_EVENT_VIEWCREATED 20 +#define STR_EVENT_PREPARECLOSEVIEW 21 +#define STR_EVENT_CLOSEVIEW 22 +#define STR_EVENT_MODIFYCHANGED 23 +#define STR_EVENT_TITLECHANGED 24 +#define STR_EVENT_VISAREACHANGED 25 +#define STR_EVENT_MODECHANGED 26 +#define STR_EVENT_STORAGECHANGED 27 + +typedef ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > EventBindingHash; +typedef ::std::vector< ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XFrame > > FrameVector; +typedef ::std::vector< ::rtl::OUString > SupportedEventsVector; + +class GlobalEventConfig_Impl : public utl::ConfigItem +{ + EventBindingHash m_eventBindingHash; + FrameVector m_lFrames; + SupportedEventsVector m_supportedEvents; + + void initBindingInfo(); + +public: + GlobalEventConfig_Impl( ); + ~GlobalEventConfig_Impl( ); + + void EstablishFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame); + void Notify( const com::sun::star::uno::Sequence& aPropertyNames); + void Commit(); + + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents( ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException); + ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException); + ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException); + ::rtl::OUString GetEventName( sal_Int32 nID ); +}; + +class UNOTOOLS_DLLPUBLIC GlobalEventConfig: + public ::cppu::WeakImplHelper2 < ::com::sun::star::document::XEventsSupplier, ::com::sun::star::container::XNameReplace > +{ + public: + GlobalEventConfig( ); + ~GlobalEventConfig( ); + static ::osl::Mutex& GetOwnStaticMutex(); + + void EstablishFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame); + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents( ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException); + ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException); + ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException); + static ::rtl::OUString GetEventName( sal_Int32 nID ); + + private: + static GlobalEventConfig_Impl* m_pImpl; + static sal_Int32 m_nRefCount; +}; + +#endif // _EVENTCFG_HXX diff --git a/unotools/inc/unotools/extendedsecurityoptions.hxx b/unotools/inc/unotools/extendedsecurityoptions.hxx new file mode 100644 index 000000000000..114cf81d6ced --- /dev/null +++ b/unotools/inc/unotools/extendedsecurityoptions.hxx @@ -0,0 +1,163 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: extendedsecurityoptions.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_unotools_EXTENDEDSECURITYOPTIONS_HXX +#define INCLUDED_unotools_EXTENDEDSECURITYOPTIONS_HXX + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include "unotools/unotoolsdllapi.h" +#include +#include +#include +#include +#include + +//_________________________________________________________________________________________________________________ +// forward declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short forward declaration to our private date container implementation + @descr We use these class as internal member to support small memory requirements. + You can create the container if it is neccessary. The class which use these mechanism + is faster and smaller then a complete implementation! +*//*-*************************************************************************************************************/ + +class SvtExtendedSecurityOptions_Impl; + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short collect informations about security features + @descr - + + @implements - + @base - + + @ATTENTION This class is partially threadsafe. + + @devstatus ready to use +*//*-*************************************************************************************************************/ + +class UNOTOOLS_DLLPUBLIC SvtExtendedSecurityOptions: public utl::detail::Options +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + // Must be zero based! + enum OpenHyperlinkMode + { + OPEN_NEVER = 0, + OPEN_WITHSECURITYCHECK, + OPEN_ALWAYS + }; + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor and destructor + @descr This will initialize an instance with default values. + We implement these class with a refcount mechanism! Every instance of this class increase it + at create and decrease it at delete time - but all instances use the same data container! + He is implemented as a static member ... + + @seealso member m_nRefCount + @seealso member m_pDataContainer + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + SvtExtendedSecurityOptions(); + virtual ~SvtExtendedSecurityOptions(); + + //--------------------------------------------------------------------------------------------------------- + // interface + //--------------------------------------------------------------------------------------------------------- + + sal_Bool IsSecureHyperlink( const rtl::OUString& aURL ) const; + com::sun::star::uno::Sequence< rtl::OUString > GetSecureExtensionList() const; + + OpenHyperlinkMode GetOpenHyperlinkMode(); + void SetOpenHyperlinkMode( OpenHyperlinkMode aMode ); + sal_Bool IsOpenHyperlinkModeReadOnly() const; + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return a reference to a static mutex + @descr These class is partially threadsafe (for de-/initialization only). + All access methods are'nt safe! + We create a static mutex only for one ime and use at different times. + + @seealso - + + @param - + @return A reference to a static mutex member. + + @onerror - + *//*-*****************************************************************************************************/ + + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetInitMutex(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + /*Attention + + Don't initialize these static member in these header! + a) Double dfined symbols will be detected ... + b) and unresolved externals exist at linking time. + Do it in your source only. + */ + + static SvtExtendedSecurityOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! + static sal_Int32 m_nRefCount ; /// internal ref count mechanism + +}; // class SvtExtendedSecurityOptions + +#endif // #ifndef INCLUDED_unotools_EXTENDEDSECURITYOPTIONS_HXX diff --git a/unotools/inc/unotools/fltrcfg.hxx b/unotools/inc/unotools/fltrcfg.hxx new file mode 100644 index 000000000000..1422ba1a7a8f --- /dev/null +++ b/unotools/inc/unotools/fltrcfg.hxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: fltrcfg.hxx,v $ + * $Revision: 1.9 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVT_FLTRCFG_HXX +#define _SVT_FLTRCFG_HXX + +// ----------------------------------------------------------------------- + +#include "unotools/unotoolsdllapi.h" +#include + +struct SvtFilterOptions_Impl; +class UNOTOOLS_DLLPUBLIC SvtFilterOptions : public utl::ConfigItem +{ + SvtFilterOptions_Impl* pImp; + + const com::sun::star::uno::Sequence& GetPropertyNames(); +public: + SvtFilterOptions(); + virtual ~SvtFilterOptions(); + + virtual void Notify( const com::sun::star::uno::Sequence& aPropertyNames); + virtual void Commit(); + void Load(); + + void SetLoadWordBasicCode( sal_Bool bFlag ); + sal_Bool IsLoadWordBasicCode() const; + void SetLoadWordBasicStorage( sal_Bool bFlag ); + sal_Bool IsLoadWordBasicStorage() const; + + void SetLoadExcelBasicCode( sal_Bool bFlag ); + sal_Bool IsLoadExcelBasicCode() const; + void SetLoadExcelBasicExecutable( sal_Bool bFlag ); + sal_Bool IsLoadExcelBasicExecutable() const; + void SetLoadExcelBasicStorage( sal_Bool bFlag ); + sal_Bool IsLoadExcelBasicStorage() const; + + void SetLoadPPointBasicCode( sal_Bool bFlag ); + sal_Bool IsLoadPPointBasicCode() const; + void SetLoadPPointBasicStorage( sal_Bool bFlag ); + sal_Bool IsLoadPPointBasicStorage() const; + + sal_Bool IsMathType2Math() const; + void SetMathType2Math( sal_Bool bFlag ); + sal_Bool IsMath2MathType() const; + void SetMath2MathType( sal_Bool bFlag ); + + sal_Bool IsWinWord2Writer() const; + void SetWinWord2Writer( sal_Bool bFlag ); + sal_Bool IsWriter2WinWord() const; + void SetWriter2WinWord( sal_Bool bFlag ); + + sal_Bool IsUseEnhancedFields() const; + void SetUseEnhancedFields( sal_Bool bFlag ); + + sal_Bool IsExcel2Calc() const; + void SetExcel2Calc( sal_Bool bFlag ); + sal_Bool IsCalc2Excel() const; + void SetCalc2Excel( sal_Bool bFlag ); + + sal_Bool IsPowerPoint2Impress() const; + void SetPowerPoint2Impress( sal_Bool bFlag ); + sal_Bool IsImpress2PowerPoint() const; + void SetImpress2PowerPoint( sal_Bool bFlag ); + + sal_Bool IsEnablePPTPreview() const; + sal_Bool IsEnableCalcPreview() const; + sal_Bool IsEnableWordPreview() const; + + static SvtFilterOptions* Get(); +}; + +#endif + + + + diff --git a/unotools/inc/unotools/fontoptions.hxx b/unotools/inc/unotools/fontoptions.hxx new file mode 100644 index 000000000000..644670711595 --- /dev/null +++ b/unotools/inc/unotools/fontoptions.hxx @@ -0,0 +1,176 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: fontoptions.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_unotools_FONTOPTIONS_HXX +#define INCLUDED_unotools_FONTOPTIONS_HXX + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include "unotools/unotoolsdllapi.h" +#include +#include +#include +#include + +//_________________________________________________________________________________________________________________ +// forward declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short forward declaration to our private date container implementation + @descr We use these class as internal member to support small memory requirements. + You can create the container if it is neccessary. The class which use these mechanism + is faster and smaller then a complete implementation! +*//*-*************************************************************************************************************/ + +class SvtFontOptions_Impl; + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short collect informations about font features + @descr - + + @implements - + @base - + + @devstatus ready to use +*//*-*************************************************************************************************************/ + +class UNOTOOLS_DLLPUBLIC SvtFontOptions: public utl::detail::Options +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor and destructor + @descr This will initialize an instance with default values. + We implement these class with a refcount mechanism! Every instance of this class increase it + at create and decrease it at delete time - but all instances use the same data container! + He is implemented as a static member ... + + @seealso member m_nRefCount + @seealso member m_pDataContainer + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + SvtFontOptions(); + virtual ~SvtFontOptions(); + + //--------------------------------------------------------------------------------------------------------- + // interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short interface methods to get and set value of config key "org.openoffice.Office.Common/Font" + @descr These values defines different states of font handling. + + ..ReplacementTable..() => Determines if the list of font replacements is applied or not. + + ..FontHistory..() => The last 5 fonts will be shown and the last one will be the + first name on the list. These will be displayed in the Font name + combo box on the Object bar. + + ..FontWYSIWYG..() => With this option the names of the selectable fonts + (for example, the fonts in the Font field in the object bar) + will be formatted as the current font. + + @seealso - + + @param - + @return - + + @onerror No error should occurre! + *//*-*****************************************************************************************************/ + + sal_Bool IsReplacementTableEnabled ( ) const ; + void EnableReplacementTable ( sal_Bool bState ) ; + + sal_Bool IsFontHistoryEnabled ( ) const ; + void EnableFontHistory ( sal_Bool bState ) ; + + sal_Bool IsFontWYSIWYGEnabled ( ) const ; + void EnableFontWYSIWYG ( sal_Bool bState ) ; + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return a reference to a static mutex + @descr These class use his own static mutex to be threadsafe. + We create a static mutex only for one ime and use at different times. + + @seealso - + + @param - + @return A reference to a static mutex member. + + @onerror - + *//*-*****************************************************************************************************/ + + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& impl_GetOwnStaticMutex(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + /*Attention + + Don't initialize these static member in these header! + a) Double dfined symbols will be detected ... + b) and unresolved externals exist at linking time. + Do it in your source only. + */ + + static SvtFontOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! + static sal_Int32 m_nRefCount ; /// internal ref count mechanism + +}; // class SvtFontOptions + +#endif // #ifndef INCLUDED_unotools_FONTOPTIONS_HXX diff --git a/unotools/inc/unotools/historyoptions.hxx b/unotools/inc/unotools/historyoptions.hxx new file mode 100644 index 000000000000..c1bd8f62fca1 --- /dev/null +++ b/unotools/inc/unotools/historyoptions.hxx @@ -0,0 +1,251 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: historyoptions.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_SVTOOLS_HISTORYOPTIONS_HXX +#define INCLUDED_SVTOOLS_HISTORYOPTIONS_HXX + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include "unotools/unotoolsdllapi.h" +#include +#include +#include +#include +#include +#include + +//_________________________________________________________________________________________________________________ +// types, enums, ... +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @descr The method GetList() returns a list of property values. + Use follow defines to seperate values by names. +*//*-*************************************************************************************************************/ + +#define HISTORY_PROPERTYNAME_URL ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL" )) +#define HISTORY_PROPERTYNAME_FILTER ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Filter" )) +#define HISTORY_PROPERTYNAME_TITLE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Title" )) +#define HISTORY_PROPERTYNAME_PASSWORD ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Password" )) + +/*-************************************************************************************************************//** + @descr You can use these enum values to specify right history if you call ouer interface methods. +*//*-*************************************************************************************************************/ + +enum EHistoryType +{ + ePICKLIST = 0, + eHISTORY = 1, + eHELPBOOKMARKS = 2 +}; + +//_________________________________________________________________________________________________________________ +// forward declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short forward declaration to our private date container implementation + @descr We use these class as internal member to support small memory requirements. + You can create the container if it is neccessary. The class which use these mechanism + is faster and smaller then a complete implementation! +*//*-*************************************************************************************************************/ + +class SvtHistoryOptions_Impl; + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short collect informations about history features + @descr - + + @implements - + @base - + + @devstatus ready to use +*//*-*************************************************************************************************************/ + +class UNOTOOLS_DLLPUBLIC SvtHistoryOptions: public utl::detail::Options +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor and destructor + @descr This will initialize an instance with default values. + We implement these class with a refcount mechanism! Every instance of this class increase it + at create and decrease it at delete time - but all instances use the same data container! + He is implemented as a static member ... + + @seealso member m_nRefCount + @seealso member m_pDataContainer + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + SvtHistoryOptions(); + virtual ~SvtHistoryOptions(); + + //--------------------------------------------------------------------------------------------------------- + // interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short interface methods to get and set value of config key "org.openoffice.Office.Common/History/..." + @descr key "PickList" : The last used documents displayed in the file menu. + key "History" : The last opened documents general. + *//*-*****************************************************************************************************/ + + /*-****************************************************************************************************//** + @short set/get max size of specified history + @descr Call this methods to get information about max. size of specified list. + These value lay down the max count of items in these history. If a new one + is add to it the oldest one is deleted automaticly! + + @seealso - + + @param "eHistory" select right history. + @param "nSize" is the new max size of specified list. If new size smaller then the old one + some oldest entries will be destroyed automaticly! + @return Current max size of specified list. + + @onerror - + *//*-*****************************************************************************************************/ + + sal_uInt32 GetSize( EHistoryType eHistory ) const ; + void SetSize( EHistoryType eHistory, sal_uInt32 nSize ) ; + + /*-****************************************************************************************************//** + @short clear complete sepcified list + @descr Call this methods to clear the whole list. After that GetItemCount() will return 0 ... + but GetSize() will return the old value! + + @seealso - + + @param "eHistory" select right history. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void Clear( EHistoryType eHistory ); + + /*-****************************************************************************************************//** + @short return complete sepcified list + @descr If you will show the whole list call this method to get it completly. + + @seealso - + + @param "eHistory" select right history. + @return A list of history items is returned. + + @onerror - + *//*-*****************************************************************************************************/ + + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > GetList( EHistoryType eHistory ) const ; + + /*-****************************************************************************************************//** + @short append a new item to specified list + @descr You can append items to a list only - removing isn't allowed for a special item! + The oldest entry is deleted automaticly if max size arrived or you can call Clear() ... + It exist two different overload methods to do this. + One for user which have an complete history item and another one for uncompletly data sets! + + @seealso method SetSize() + @seealso method Clear() + + @param "eHistory" select right history. + @param "sURL" URL to save in history + @param "sFilter" filter name to save in history + @param "sTitle" document title to save in history + @param "sPassword" password to save in history + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void AppendItem( EHistoryType eHistory , + const ::rtl::OUString& sURL , + const ::rtl::OUString& sFilter , + const ::rtl::OUString& sTitle , + const ::rtl::OUString& sPassword ); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return a reference to a static mutex + @descr Make these class threadsafe. + + @seealso - + + @param - + @return A reference to a static mutex member. + + @onerror - + *//*-*****************************************************************************************************/ + + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + /*Attention + + Don't initialize these static member in these header! + a) Double dfined symbols will be detected ... + b) and unresolved externals exist at linking time. + Do it in your source only. + */ + + static SvtHistoryOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! + static sal_Int32 m_nRefCount ; /// internal ref count mechanism + +}; // class SvtHistoryOptions + +#endif // #ifndef INCLUDED_SVTOOLS_HISTORYOPTIONS_HXX diff --git a/unotools/inc/unotools/historyoptions_const.hxx b/unotools/inc/unotools/historyoptions_const.hxx new file mode 100644 index 000000000000..c9148aeb26f8 --- /dev/null +++ b/unotools/inc/unotools/historyoptions_const.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: historyoptions_const.hxx,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:17:49 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#ifndef INCLUDE_CONFIGITEMS_HISTORYOPTIONS_CONST_HXX +#define INCLUDE_CONFIGITEMS_HISTORYOPTIONS_CONST_HXX + +#include + +namespace +{ + static const ::rtl::OUString s_sCommonHistory = ::rtl::OUString::createFromAscii("org.openoffice.Office.Common/History"); + static const ::rtl::OUString s_sHistories = ::rtl::OUString::createFromAscii("org.openoffice.Office.Histories/Histories"); + static const ::rtl::OUString s_sPickListSize = ::rtl::OUString::createFromAscii("PickListSize"); + static const ::rtl::OUString s_sURLHistorySize = ::rtl::OUString::createFromAscii("Size"); + static const ::rtl::OUString s_sHelpBookmarksSize = ::rtl::OUString::createFromAscii("HelpBookmarkSize"); + static const ::rtl::OUString s_sPickList = ::rtl::OUString::createFromAscii("PickList"); + static const ::rtl::OUString s_sURLHistory = ::rtl::OUString::createFromAscii("URLHistory"); + static const ::rtl::OUString s_sHelpBookmarks = ::rtl::OUString::createFromAscii("HelpBookmarks"); + static const ::rtl::OUString s_sItemList = ::rtl::OUString::createFromAscii("ItemList"); + static const ::rtl::OUString s_sOrderList = ::rtl::OUString::createFromAscii("OrderList"); + static const ::rtl::OUString s_sHistoryItemRef = ::rtl::OUString::createFromAscii("HistoryItemRef"); + static const ::rtl::OUString s_sURL = ::rtl::OUString::createFromAscii("URL"); + static const ::rtl::OUString s_sFilter = ::rtl::OUString::createFromAscii("Filter"); + static const ::rtl::OUString s_sTitle = ::rtl::OUString::createFromAscii("Title"); + static const ::rtl::OUString s_sPassword = ::rtl::OUString::createFromAscii("Password"); +} + +#endif // INCLUDE_CONFIGITEMS_HISTORYOPTIONS_CONST_HXX diff --git a/unotools/inc/unotools/inetoptions.hxx b/unotools/inc/unotools/inetoptions.hxx new file mode 100644 index 000000000000..42f01f40b7c2 --- /dev/null +++ b/unotools/inc/unotools/inetoptions.hxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: inetoptions.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _unotools_INETOPTIONS_HXX_ +#define _unotools_INETOPTIONS_HXX_ + +#include "unotools/unotoolsdllapi.h" +#include +#include +#include +#include + +namespace com { namespace sun { namespace star { namespace beans { + class XPropertiesChangeListener; +} } } } +namespace rtl { class OUString; } + +//============================================================================ +/** The names of all the properties (options) accessible through + SvtInetOptions. + + @descr These names are used in the methods + SvtInetOptions::addPropertiesChangeListener() and + SvtInetOptions::removePropertiesChangeListener(). + */ +#define SVT_INET_OPTION_PROXY_NO_PROXY "Inet/Proxy/NoProxy" +#define SVT_INET_OPTION_PROXY_TYPE "Inet/Proxy/Type" +#define SVT_INET_OPTION_PROXY_FTP_NAME "Inet/Proxy/FTP/Name" +#define SVT_INET_OPTION_PROXY_FTP_PORT "Inet/Proxy/FTP/Port" +#define SVT_INET_OPTION_PROXY_HTTP_NAME "Inet/Proxy/HTTP/Name" +#define SVT_INET_OPTION_PROXY_HTTP_PORT "Inet/Proxy/HTTP/Port" + +//============================================================================ +/** Interface to access those configuration database entries that are related + to the various Internet services. + + @descr The Set...() methods all have a second parameter bFlush. If false + is passed (the default), the new value is not written back directly, but + only cached within this class. If the value in the configuration database + is also changed, the cached change will get lost. If, on the other hand, + true is passed, the new value is instantly written back to the + configuration database. + */ +class UNOTOOLS_DLLPUBLIC SvtInetOptions: public utl::detail::Options +{ +public: + SvtInetOptions(); + + virtual ~SvtInetOptions(); + + enum ProxyType { NONE, AUTOMATIC, MANUAL }; + + rtl::OUString GetProxyNoProxy() const; + + sal_Int32 GetProxyType() const; + + rtl::OUString GetProxyFtpName() const; + + sal_Int32 GetProxyFtpPort() const; + + rtl::OUString GetProxyHttpName() const; + + sal_Int32 GetProxyHttpPort() const; + + void SetProxyNoProxy(rtl::OUString const & rValue, bool bFlush = false); + + void SetProxyType(ProxyType eValue, bool bFlush = false); + + void SetProxyFtpName(rtl::OUString const & rValue, bool bFlush = false); + + void SetProxyFtpPort(sal_Int32 nValue, bool bFlush = false); + + void SetProxyHttpName(rtl::OUString const & rValue, bool bFlush = false); + + void SetProxyHttpPort(sal_Int32 nValue, bool bFlush = false); + + void flush(); + + /** Add a listener on changes of certain properties (options). + + @param rPropertyNames The names of the properties (options). If an + empty sequence is used, nothing is done. + + @param rListener A listener. If the listener is already registered + on other properties, it continues to also get notifications about + changes of those properties. The + com::sun::star::beans::PropertyChangeEvents supplied to the listener + will have void OldValue and NewValue slots. + */ + void + addPropertiesChangeListener( + com::sun::star::uno::Sequence< rtl::OUString > const & rPropertyNames, + com::sun::star::uno::Reference< + com::sun::star::beans::XPropertiesChangeListener > const & + rListener); + + /** Remove a listener on changes of certain properties (options). + + @param rPropertyNames The names of the properties (options). If an + empty sequence is used, nothing is done. + + @param rListener A listener. If the listener is still registered on + other properties, it continues to get notifications about changes of + those properties. + */ + void + removePropertiesChangeListener( + com::sun::star::uno::Sequence< rtl::OUString > const & rPropertyNames, + com::sun::star::uno::Reference< + com::sun::star::beans::XPropertiesChangeListener > const & + rListener); + +private: + class Impl; + + static Impl * m_pImpl; +}; + +#endif // _unotools_INETOPTIONS_HXX_ diff --git a/unotools/inc/unotools/internaloptions.hxx b/unotools/inc/unotools/internaloptions.hxx new file mode 100644 index 000000000000..d5c9adaa7b92 --- /dev/null +++ b/unotools/inc/unotools/internaloptions.hxx @@ -0,0 +1,183 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: internaloptions.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_unotools_INTERNALOPTIONS_HXX +#define INCLUDED_unotools_INTERNALOPTIONS_HXX + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include "unotools/unotoolsdllapi.h" +#include +#include +#include +#include + +//_________________________________________________________________________________________________________________ +// namespaces! +//_________________________________________________________________________________________________________________ + +#define MUTEX ::osl::Mutex +#define OUSTRING ::rtl::OUString + +//_________________________________________________________________________________________________________________ +// forward declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short forward declaration to our private date container implementation + @descr We use these class as internal member to support small memory requirements. + You can create the container if it is neccessary. The class which use these mechanism + is faster and smaller then a complete implementation! +*//*-*************************************************************************************************************/ + +class SvtInternalOptions_Impl; + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short collect informations about internal features + @descr - + + @implements - + @base - + + @ATTENTION This class is partially threadsafe. + + @devstatus ready to use +*//*-*************************************************************************************************************/ + +class UNOTOOLS_DLLPUBLIC SvtInternalOptions: public utl::detail::Options +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor and destructor + @descr This will initialize an instance with default values. + We implement these class with a refcount mechanism! Every instance of this class increase it + at create and decrease it at delete time - but all instances use the same data container! + He is implemented as a static member ... + + @seealso member m_nRefCount + @seealso member m_pDataContainer + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + SvtInternalOptions(); + virtual ~SvtInternalOptions(); + + //--------------------------------------------------------------------------------------------------------- + // interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short interface methods to get and set value of config key "org.openoffice.Office.Common/Internal/..." + @descr These options describe internal states to enable/disable features of installed office. + The values are fixed at runtime - and implemented as readonly! + + SlotCFGEnabled() => If this option is set (true), StarOffice is searching for the slot.cfg. + If the slot.cfg cannot be found, the start is aborted. + If this option is not set (false), the slot.cfg must not be available, + otherwise the start is also aborted. + + CrashMailEnabled() => Crash-Mail-Feature to document program crashes. After a crash, + an e-mail with information about the system used is generated + automatically when starting StarOffice. + + @seealso configuration package "org.openoffice.Office.Common/Internal" + *//*-*****************************************************************************************************/ + + sal_Bool SlotCFGEnabled () const; + sal_Bool CrashMailEnabled () const; + sal_Bool MailUIEnabled () const; + sal_Bool IsRemoveMenuEntryClose() const; + sal_Bool IsRemoveMenuEntryBackToWebtop() const; + sal_Bool IsRemoveMenuEntryNewWebtop() const; + sal_Bool IsRemoveMenuEntryLogout() const; + + OUSTRING GetCurrentTempURL() const; + void SetCurrentTempURL( const OUSTRING& aNewCurrentTempURL ); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return a reference to a static mutex + @descr These class is partially threadsafe (for de-/initialization only). + All access methods are'nt safe! + We create a static mutex only for one ime and use at different times. + + @seealso - + + @param - + @return A reference to a static mutex member. + + @onerror - + *//*-*****************************************************************************************************/ + + UNOTOOLS_DLLPRIVATE static MUTEX& GetOwnStaticMutex(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + /*Attention + + Don't initialize these static member in these header! + a) Double dfined symbols will be detected ... + b) and unresolved externals exist at linking time. + Do it in your source only. + */ + + static SvtInternalOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! + static sal_Int32 m_nRefCount ; /// internal ref count mechanism + +}; // class SvtInternalOptions + +#endif // #ifndef INCLUDED_unotools_INTERNALOPTIONS_HXX diff --git a/unotools/inc/unotools/itemholderbase.hxx b/unotools/inc/unotools/itemholderbase.hxx new file mode 100644 index 000000000000..3b8bbccb3549 --- /dev/null +++ b/unotools/inc/unotools/itemholderbase.hxx @@ -0,0 +1,131 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: itemholderbase.hxx,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_unotools_ITEMHOLDERBASE_HXX_ +#define INCLUDED_unotools_ITEMHOLDERBASE_HXX_ + +//----------------------------------------------- +// includes + +#include +#include + +namespace utl { namespace detail { class Options; } } + +//----------------------------------------------- +// definitions + +struct ItemHolderMutexBase +{ + ::osl::Mutex m_aLock; +}; + +enum EItem +{ + E_ACCELCFG , // + E_ACCESSIBILITYOPTIONS , // 2 + E_ADDXMLTOSTORAGEOPTIONS , // + E_APEARCFG , // 2 + + E_CJKOPTIONS , // 2 + E_CMDOPTIONS , // + E_COLORCFG , // 2 + E_COMPATIBILITY , // + E_CTLOPTIONS , // 2 + + E_DEFAULTOPTIONS , // + E_DYNAMICMENUOPTIONS , // + + E_EVENTCFG , // + E_EXTENDEDSECURITYOPTIONS , // + + E_FLTRCFG , // + E_FONTOPTIONS , // + E_FONTSUBSTCONFIG , // 2 + + E_HELPOPTIONS , // 2 + E_HISTORYOPTIONS , // + + E_INETOPTIONS , // + E_INTERNALOPTIONS , // + + E_JAVAOPTIONS , // + + E_LANGUAGEOPTIONS , // 2 + E_LINGUCFG , // + E_LOCALISATIONOPTIONS , // + + E_MENUOPTIONS , // + E_MISCCFG , // 2 + E_MISCOPTIONS , // + E_MODULEOPTIONS , // + + E_OPTIONSDLGOPTIONS , // + + E_PATHOPTIONS , // + E_PRINTOPTIONS , // 2 + E_PRINTFILEOPTIONS , // 2 + E_PRINTWARNINGOPTIONS , // + + E_REGOPTIONS , // + + E_SAVEOPTIONS , // + E_SEARCHOPT , // + E_SECURITYOPTIONS , // + E_SOURCEVIEWCONFIG , // + E_STARTOPTIONS , // + E_SYSLOCALEOPTIONS , // 2 + + E_UNDOOPTIONS , // 2 + E_USEROPTIONS , // 2 + + E_VIEWOPTIONS_DIALOG , // + E_VIEWOPTIONS_TABDIALOG , // + E_VIEWOPTIONS_TABPAGE , // + E_VIEWOPTIONS_WINDOW , // + + E_WORKINGSETOPTIONS , // + + E_XMLACCELCFG // +}; + +struct TItemInfo +{ + TItemInfo() + : pItem(0) + {} + + utl::detail::Options * pItem; + EItem eItem; +}; + +typedef ::std::vector< TItemInfo > TItems; + +#endif // INCLUDED_unotools_ITEMHOLDERBASE_HXX_ diff --git a/unotools/inc/unotools/javaoptions.hxx b/unotools/inc/unotools/javaoptions.hxx new file mode 100644 index 000000000000..9996a496bf31 --- /dev/null +++ b/unotools/inc/unotools/javaoptions.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: javaoptions.hxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _unotools_JAVAOPTIONS_HXX +#define _unotools_JAVAOPTIONS_HXX + +#include "unotools/unotoolsdllapi.h" +#include +#include + + +// class SvtJavaOptions -------------------------------------------------- + +struct SvtJavaOptions_Impl; + +class UNOTOOLS_DLLPUBLIC SvtJavaOptions : public utl::ConfigItem +{ + SvtJavaOptions_Impl* pImpl; +public: + enum EOption + { + E_ENABLED, + E_SECURITY, + E_NETACCESS, + E_USERCLASSPATH, + E_EXECUTEAPPLETS + }; + + SvtJavaOptions(); + ~SvtJavaOptions(); + + virtual void Commit(); + + sal_Bool IsEnabled() const; + sal_Bool IsSecurity()const; + sal_Int32 GetNetAccess() const; + rtl::OUString& GetUserClassPath()const; + sal_Bool IsExecuteApplets() const; + + void SetEnabled(sal_Bool bSet) ; + void SetSecurity(sal_Bool bSet); + void SetNetAccess(sal_Int32 nSet) ; + void SetUserClassPath(const rtl::OUString& rSet); + void SetExecuteApplets(sal_Bool bSet); + + sal_Bool IsReadOnly( EOption eOption ) const; +}; + +#endif // + diff --git a/unotools/inc/unotools/lingucfg.hxx b/unotools/inc/unotools/lingucfg.hxx new file mode 100644 index 000000000000..49500db964c2 --- /dev/null +++ b/unotools/inc/unotools/lingucfg.hxx @@ -0,0 +1,244 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: lingucfg.hxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _unotools_LINGUCFG_HXX_ +#define _unotools_LINGUCFG_HXX_ + +#include "unotools/unotoolsdllapi.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +class SvtLinguConfigItem; + +////////////////////////////////////////////////////////////////////// + +struct UNOTOOLS_DLLPUBLIC SvtLinguOptions +{ + ::com::sun::star::uno::Sequence< rtl::OUString > aActiveDics; + ::com::sun::star::uno::Sequence< rtl::OUString > aActiveConvDics; + + BOOL bROActiveDics; + BOOL bROActiveConvDics; + + // Hyphenator service specific options + INT16 nHyphMinLeading, + nHyphMinTrailing, + nHyphMinWordLength; + + BOOL bROHyphMinLeading, + bROHyphMinTrailing, + bROHyphMinWordLength; + + // misc options (non-service specific) + INT16 nDefaultLanguage; + INT16 nDefaultLanguage_CJK; + INT16 nDefaultLanguage_CTL; + + BOOL bRODefaultLanguage; + BOOL bRODefaultLanguage_CJK; + BOOL bRODefaultLanguage_CTL; + + // spelling options (non-service specific) + BOOL bIsSpellSpecial; + BOOL bIsSpellAuto; + BOOL bIsSpellReverse; + + BOOL bROIsSpellSpecial; + BOOL bROIsSpellAuto; + BOOL bROIsSpellReverse; + + // hyphenation options (non-service specific) + BOOL bIsHyphSpecial; + BOOL bIsHyphAuto; + + BOOL bROIsHyphSpecial; + BOOL bROIsHyphAuto; + + // common to SpellChecker, Hyphenator and Thesaurus service + BOOL bIsUseDictionaryList; + BOOL bIsIgnoreControlCharacters; + + BOOL bROIsUseDictionaryList; + BOOL bROIsIgnoreControlCharacters; + + // SpellChecker service specific options + BOOL bIsSpellWithDigits, + bIsSpellUpperCase, + bIsSpellCapitalization; + + BOOL bROIsSpellWithDigits, + bROIsSpellUpperCase, + bROIsSpellCapitalization; + + // text conversion specific options + BOOL bIsIgnorePostPositionalWord; + BOOL bIsAutoCloseDialog; + BOOL bIsShowEntriesRecentlyUsedFirst; + BOOL bIsAutoReplaceUniqueEntries; + BOOL bIsDirectionToSimplified; + BOOL bIsUseCharacterVariants; + BOOL bIsTranslateCommonTerms; + BOOL bIsReverseMapping; + + BOOL bROIsIgnorePostPositionalWord; + BOOL bROIsAutoCloseDialog; + BOOL bROIsShowEntriesRecentlyUsedFirst; + BOOL bROIsAutoReplaceUniqueEntries; + BOOL bROIsDirectionToSimplified; + BOOL bROIsUseCharacterVariants; + BOOL bROIsTranslateCommonTerms; + BOOL bROIsReverseMapping; + + // check value need to determine if the configuration needs to updatet + // or not (used for a quick check if data files have been changed/added + // or deleted + INT32 nDataFilesChangedCheckValue; + BOOL bRODataFilesChangedCheckValue; + + BOOL bIsGrammarAuto; + BOOL bIsGrammarInteractive; + + BOOL bROIsGrammarAuto; + BOOL bROIsGrammarInteractive; + + SvtLinguOptions(); +}; + +////////////////////////////////////////////////////////////////////// + +struct UNOTOOLS_DLLPUBLIC SvtLinguConfigDictionaryEntry +{ + // the URL's pointing to the location of the files the dictionary consists of + com::sun::star::uno::Sequence< rtl::OUString > aLocations; + // the name of the dictionary format implement + rtl::OUString aFormatName; + // the list of languages (ISO names) the dictionary can be used for + com::sun::star::uno::Sequence< rtl::OUString > aLocaleNames; +}; + +////////////////////////////////////////////////////////////////////// + +class UNOTOOLS_DLLPUBLIC SvtLinguConfig: public utl::detail::Options +{ + // returns static object + UNOTOOLS_DLLPRIVATE SvtLinguConfigItem & GetConfigItem(); + + SvtLinguConfigItem & GetConfigItem() const { return const_cast< SvtLinguConfig * >( this )->GetConfigItem(); } + + // configuration update access for the 'Linguistic' main node + mutable com::sun::star::uno::Reference< com::sun::star::util::XChangesBatch > m_xMainUpdateAccess; + + com::sun::star::uno::Reference< com::sun::star::util::XChangesBatch > GetMainUpdateAccess() const; + + com::sun::star::uno::Sequence< rtl::OUString > GetCurrentOrLastActiveDicts_Impl( const rtl::OUString &rPropName ) const; + void SetCurrentOrLastActiveDicts_Impl( const rtl::OUString &rPropName, const com::sun::star::uno::Sequence< rtl::OUString > &rDictionaries ) const; + + rtl::OUString GetVendorImageUrl_Impl( const rtl::OUString &rServiceImplName, const rtl::OUString &rImageName ) const; + + // disallow copy-constructor and assignment-operator for now + SvtLinguConfig( const SvtLinguConfig & ); + SvtLinguConfig & operator = ( const SvtLinguConfig & ); + +public: + SvtLinguConfig(); + virtual ~SvtLinguConfig(); + + // + // borrowed from utl::ConfigItem + // + com::sun::star::uno::Sequence< rtl::OUString > + GetNodeNames( const rtl::OUString &rNode ); + // + com::sun::star::uno::Sequence< com::sun::star::uno::Any > + GetProperties( + const com::sun::star::uno::Sequence< rtl::OUString > &rNames ); + // + sal_Bool + ReplaceSetProperties( + const rtl::OUString &rNode, + com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > rValues ); + + com::sun::star::uno::Any + GetProperty( const rtl::OUString &rPropertyName ) const; + com::sun::star::uno::Any + GetProperty( INT32 nPropertyHandle ) const; + + BOOL SetProperty( const rtl::OUString &rPropertyName, + const com::sun::star::uno::Any &rValue ); + BOOL SetProperty( INT32 nPropertyHandle, + const com::sun::star::uno::Any &rValue ); + + BOOL GetOptions( SvtLinguOptions &rOptions ) const; + BOOL SetOptions( const SvtLinguOptions &rOptions ); + + BOOL IsReadOnly( const rtl::OUString &rPropertyName ) const; + BOOL IsReadOnly( INT32 nPropertyHandle ) const; + + //! + //! the following functions work on the 'ServiceManager' sub node of the + //! linguistic configuration only + //! + BOOL GetElementNamesFor( const rtl::OUString &rNodeName, com::sun::star::uno::Sequence< rtl::OUString > &rElementNames ) const; + // + BOOL GetSupportedDictionaryFormatsFor( const rtl::OUString &rSetName, const rtl::OUString &rSetEntry, com::sun::star::uno::Sequence< rtl::OUString > &rFormatList ) const; + void SetOrCreateSupportedDictionaryFormatsFor( const rtl::OUString &rSetName, const rtl::OUString &rSetEntry, const com::sun::star::uno::Sequence< rtl::OUString > &rFormatList ) const; + // + BOOL GetDictionaryEntry( const rtl::OUString &rNodeName, SvtLinguConfigDictionaryEntry &rDicEntry ) const; + void SetOrCreateDictionaryEntry( const rtl::OUString &rNodeName, const SvtLinguConfigDictionaryEntry &rDicEntry ) const; + // + com::sun::star::uno::Sequence< rtl::OUString > GetDisabledDictionaries() const; + void SetDisabledDictionaries( const com::sun::star::uno::Sequence< rtl::OUString > &rDictionaries ) const; + // + std::vector< SvtLinguConfigDictionaryEntry > GetActiveDictionariesByFormat( const rtl::OUString &rFormatName ); + + // functions returning file URLs to the respective images (if found) and empty string otherwise + ::rtl::OUString GetSpellAndGrammarDialogImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; + ::rtl::OUString GetSpellAndGrammarContextSuggestionImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; + ::rtl::OUString GetSpellAndGrammarContextDictionaryImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; + + bool HasAnyVendorImages() const; + bool HasGrammarChecker() const; +}; + +////////////////////////////////////////////////////////////////////// + +#endif + diff --git a/unotools/inc/unotools/linguprops.hxx b/unotools/inc/unotools/linguprops.hxx new file mode 100644 index 000000000000..3edd1004bec0 --- /dev/null +++ b/unotools/inc/unotools/linguprops.hxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: linguprops.hxx,v $ + * $Revision: 1.10 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _unotools_LINGUPROPS_HXX_ +#define _unotools_LINGUPROPS_HXX_ + + +// UNO property names for general options +#define UPN_IS_GERMAN_PRE_REFORM "IsGermanPreReform" /*! deprecated #i91949 !*/ +#define UPN_IS_USE_DICTIONARY_LIST "IsUseDictionaryList" +#define UPN_IS_IGNORE_CONTROL_CHARACTERS "IsIgnoreControlCharacters" +#define UPN_ACTIVE_DICTIONARIES "ActiveDictionaries" + +// UNO property names for SpellChecker +#define UPN_IS_SPELL_UPPER_CASE "IsSpellUpperCase" +#define UPN_IS_SPELL_WITH_DIGITS "IsSpellWithDigits" +#define UPN_IS_SPELL_CAPITALIZATION "IsSpellCapitalization" + +// UNO property names for Hyphenator +#define UPN_HYPH_MIN_LEADING "HyphMinLeading" +#define UPN_HYPH_MIN_TRAILING "HyphMinTrailing" +#define UPN_HYPH_MIN_WORD_LENGTH "HyphMinWordLength" + +// UNO property names for Lingu +// (those not covered by the SpellChecker and Hyphenator +// properties and more likely to be used in other modules only) +#define UPN_DEFAULT_LANGUAGE "DefaultLanguage" +#define UPN_DEFAULT_LOCALE "DefaultLocale" +#define UPN_DEFAULT_LOCALE_CJK "DefaultLocale_CJK" +#define UPN_DEFAULT_LOCALE_CTL "DefaultLocale_CTL" +#define UPN_IS_HYPH_AUTO "IsHyphAuto" +#define UPN_IS_HYPH_SPECIAL "IsHyphSpecial" +#define UPN_IS_SPELL_AUTO "IsSpellAuto" +#define UPN_IS_SPELL_HIDE "IsSpellHide" /*! deprecated #i91949 !*/ +#define UPN_IS_SPELL_IN_ALL_LANGUAGES "IsSpellInAllLanguages" /*! deprecated #i91949 !*/ +#define UPN_IS_SPELL_SPECIAL "IsSpellSpecial" +#define UPN_IS_WRAP_REVERSE "IsWrapReverse" +#define UPN_DATA_FILES_CHANGED_CHECK_VALUE "DataFilesChangedCheckValue" + +// UNO property names for text conversion options +#define UPN_ACTIVE_CONVERSION_DICTIONARIES "ActiveConversionDictionaries" +#define UPN_IS_IGNORE_POST_POSITIONAL_WORD "IsIgnorePostPositionalWord" +#define UPN_IS_AUTO_CLOSE_DIALOG "IsAutoCloseDialog" +#define UPN_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST "IsShowEntriesRecentlyUsedFirst" +#define UPN_IS_AUTO_REPLACE_UNIQUE_ENTRIES "IsAutoReplaceUniqueEntries" +#define UPN_IS_DIRECTION_TO_SIMPLIFIED "IsDirectionToSimplified" +#define UPN_IS_USE_CHARACTER_VARIANTS "IsUseCharacterVariants" +#define UPN_IS_TRANSLATE_COMMON_TERMS "IsTranslateCommonTerms" +#define UPN_IS_REVERSE_MAPPING "IsReverseMapping" + +// new UNO propertynames to be used with 'dictionaries as extensions' +#define UPN_DICTIONARIES "Dictionaries" +#define UPN_SPELL_CHECKERS "SpellCheckers" +#define UPN_HYPHENATORS "Hyphenators" +#define UPN_THESAURI "Thesauri" +#define UPN_CURRENT_ACTIVE_DICTIONARIES "CurrentActiveDictionaries" +#define UPN_LAST_ACTIVE_DICTIONARIES "LastActiveDictionaries" + +#define UPN_IS_GRAMMAR_AUTO "IsAutoGrammarCheck" +#define UPN_IS_GRAMMAR_INTERACTIVE "IsInteractiveGrammarCheck" + +// uno property handles +#define UPH_IS_GERMAN_PRE_REFORM 0 +#define UPH_IS_USE_DICTIONARY_LIST 1 +#define UPH_IS_IGNORE_CONTROL_CHARACTERS 2 +#define UPH_IS_SPELL_UPPER_CASE 3 +#define UPH_IS_SPELL_WITH_DIGITS 4 +#define UPH_IS_SPELL_CAPITALIZATION 5 +#define UPH_HYPH_MIN_LEADING 6 +#define UPH_HYPH_MIN_TRAILING 7 +#define UPH_HYPH_MIN_WORD_LENGTH 8 +#define UPH_DEFAULT_LOCALE 9 +#define UPH_IS_SPELL_AUTO 10 +#define UPH_IS_SPELL_HIDE 11 +#define UPH_IS_SPELL_IN_ALL_LANGUAGES 12 +#define UPH_IS_SPELL_SPECIAL 13 +#define UPH_IS_HYPH_AUTO 14 +#define UPH_IS_HYPH_SPECIAL 15 +#define UPH_IS_WRAP_REVERSE 16 +#define UPH_DATA_FILES_CHANGED_CHECK_VALUE 17 +#define UPH_DEFAULT_LANGUAGE 21 +#define UPH_DEFAULT_LOCALE_CJK 22 +#define UPH_DEFAULT_LOCALE_CTL 23 +#define UPH_ACTIVE_DICTIONARIES 24 +#define UPH_ACTIVE_CONVERSION_DICTIONARIES 25 +#define UPH_IS_IGNORE_POST_POSITIONAL_WORD 26 +#define UPH_IS_AUTO_CLOSE_DIALOG 27 +#define UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST 28 +#define UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES 29 +#define UPH_IS_DIRECTION_TO_SIMPLIFIED 30 +#define UPH_IS_USE_CHARACTER_VARIANTS 31 +#define UPH_IS_TRANSLATE_COMMON_TERMS 32 +#define UPH_IS_REVERSE_MAPPING 33 +#define UPH_IS_GRAMMAR_AUTO 34 +#define UPH_IS_GRAMMAR_INTERACTIVE 35 +#endif + diff --git a/unotools/inc/unotools/localisationoptions.hxx b/unotools/inc/unotools/localisationoptions.hxx new file mode 100644 index 000000000000..d401eccee51a --- /dev/null +++ b/unotools/inc/unotools/localisationoptions.hxx @@ -0,0 +1,181 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: localisationoptions.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_unotools_LOCALISATIONOPTIONS_HXX +#define INCLUDED_unotools_LOCALISATIONOPTIONS_HXX + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include +#include "unotools/unotoolsdllapi.h" +#include +#include + +//_________________________________________________________________________________________________________________ +// forward declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short forward declaration to our private date container implementation + @descr We use these class as internal member to support small memory requirements. + You can create the container if it is neccessary. The class which use these mechanism + is faster and smaller then a complete implementation! +*//*-*************************************************************************************************************/ + +class SvtLocalisationOptions_Impl; + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short collect informations about localisation features + @descr - + + @implements - + @base - + + @devstatus ready to use +*//*-*************************************************************************************************************/ + +class UNOTOOLS_DLLPUBLIC SvtLocalisationOptions: public utl::detail::Options +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor and destructor + @descr This will initialize an instance with default values. + We implement these class with a refcount mechanism! Every instance of this class increase it + at create and decrease it at delete time - but all instances use the same data container! + He is implemented as a static member ... + + @seealso member m_nRefCount + @seealso member m_pDataContainer + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + SvtLocalisationOptions(); + virtual ~SvtLocalisationOptions(); + + //--------------------------------------------------------------------------------------------------------- + // interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short interface methods to get and set value of config key "org.openoffice.Office.Common/View/Localisation/AutoMnemonic" + @descr These value specifies if shortcuts should be assigned automatically. + + @seealso - + + @param "bState", new value to set it in configuration. + @return The value which represent current state of internal variable. + + @onerror No error should occurre! + *//*-*****************************************************************************************************/ + + sal_Bool IsAutoMnemonic ( ) const ; + void SetAutoMnemonic ( sal_Bool bState ) ; + + /*-****************************************************************************************************//** + @short interface methods to get and set value of config key "org.openoffice.Office.Common/View/Localisation/DialogScale" + @descr These value specifies the factor for increasing controls. + Value from [0..100] are allowed. + + @ATTENTION These methods don't check for valid or invalid values! + Our configuration server can do it ... but these implementation don't get any notifications + about wrong commits ...! + => If you set an invalid value - nothing will be changed. The information will lost. + + @seealso baseclass ConfigItem + + @param "nScale" new value to set it in configuration. + @return The value which represent current state of internal variable. + + @onerror No error should occurre! + *//*-*****************************************************************************************************/ + + sal_Int32 GetDialogScale( ) const ; + void SetDialogScale( sal_Int32 nScale ) ; + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return a reference to a static mutex + @descr These class is partially threadsafe (for de-/initialization only). + All access methods are'nt safe! + We create a static mutex only for one ime and use at different times. + + @seealso - + + @param - + @return A reference to a static mutex member. + + @onerror - + *//*-*****************************************************************************************************/ + + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + /*Attention + + Don't initialize these static member in these header! + a) Double dfined symbols will be detected ... + b) and unresolved externals exist at linking time. + Do it in your source only. + */ + + static SvtLocalisationOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! + static sal_Int32 m_nRefCount ; /// internal ref count mechanism + +}; // class SvtLocalisationOptions + +#endif // #ifndef INCLUDED_unotools_LOCALISATIONOPTIONS_HXX diff --git a/unotools/inc/unotools/loghelper.hxx b/unotools/inc/unotools/loghelper.hxx new file mode 100644 index 000000000000..22efd5cff46d --- /dev/null +++ b/unotools/inc/unotools/loghelper.hxx @@ -0,0 +1,59 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: loghelper.hxx,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:20:29 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef _SVT_LOGHELPER_HXX +#define _SVT_LOGHELPER_HXX + +namespace css = ::com::sun::star; + +class LogHelper +{ +public: + LogHelper(); + ~LogHelper(); + + static void logIt(const css::uno::Exception&){} +}; + +inline void logIt(const css::uno::Exception& ex) +{ + ::rtl::OUStringBuffer sMsg(256); + sMsg.appendAscii("Unexpected exception catched. Original message was:\n\"" ); + sMsg.append(ex.Message); + sMsg.appendAscii("\""); + OSL_ENSURE(sal_False, ::rtl::OUStringToOString(sMsg.makeStringAndClear(), RTL_TEXTENCODING_UTF8).getStr()); +} + +#endif + diff --git a/unotools/inc/unotools/moduleoptions.hxx b/unotools/inc/unotools/moduleoptions.hxx new file mode 100644 index 000000000000..8b759a0834cf --- /dev/null +++ b/unotools/inc/unotools/moduleoptions.hxx @@ -0,0 +1,260 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: moduleoptions.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_SVTOOLS_MODULEOPTIONS_HXX +#define INCLUDED_SVTOOLS_MODULEOPTIONS_HXX + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include "unotools/unotoolsdllapi.h" +#include +#include +#include +#include +#include +#include +#include + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +#define FEATUREFLAG_BASICIDE 0x00000020 +#define FEATUREFLAG_MATH 0x00000100 +#define FEATUREFLAG_CHART 0x00000200 +#define FEATUREFLAG_CALC 0x00000800 +#define FEATUREFLAG_DRAW 0x00001000 +#define FEATUREFLAG_WRITER 0x00002000 +#define FEATUREFLAG_IMPRESS 0x00008000 +#define FEATUREFLAG_INSIGHT 0x00010000 + +//_________________________________________________________________________________________________________________ +// forward declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short forward declaration to our private date container implementation + @descr We use these class as internal member to support small memory requirements. + You can create the container if it is neccessary. The class which use these mechanism + is faster and smaller then a complete implementation! +*//*-*************************************************************************************************************/ +class SvtModuleOptions_Impl; + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short collect informations about installation state of modules + @descr Use these class to get installation state of different office modules like writer, calc etc + Further you can ask for additional informations; e.g. name of standard template file, which + should be used by corresponding module; or short/long name of these module factory. + + @implements - + @base - + + @devstatus ready to use + @threadsafe yes +*//*-*************************************************************************************************************/ +class UNOTOOLS_DLLPUBLIC SvtModuleOptions: public utl::detail::Options +{ + //------------------------------------------------------------------------------------------------------------- + // public const declarations! + //------------------------------------------------------------------------------------------------------------- + public: + + enum EModule + { + E_SWRITER = 0, + E_SCALC = 1, + E_SDRAW = 2, + E_SIMPRESS = 3, + E_SMATH = 4, + E_SCHART = 5, + E_SSTARTMODULE = 6, + E_SBASIC = 7, + E_SDATABASE = 8, + E_SWEB = 9, + E_SGLOBAL = 10 + }; + + /*ATTENTION: + If you change these enum ... don't forget to change reading/writing and order of configuration values too! + See "SvtModuleOptions_Impl::impl_GetSetNames()" and his ctor for further informations. + */ + enum EFactory + { + E_UNKNOWN_FACTORY = -1, + E_WRITER = 0, + E_WRITERWEB = 1, + E_WRITERGLOBAL = 2, + E_CALC = 3, + E_DRAW = 4, + E_IMPRESS = 5, + E_MATH = 6, + E_CHART = 7, + E_STARTMODULE = 8, + E_DATABASE = 9, + E_BASIC = 10 + + }; + + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + SvtModuleOptions(); + virtual ~SvtModuleOptions(); + + //--------------------------------------------------------------------------------------------------------- + // interface + //--------------------------------------------------------------------------------------------------------- + sal_Bool IsModuleInstalled ( EModule eModule ) const; + ::rtl::OUString GetModuleName ( EModule eModule ) const; + ::rtl::OUString GetModuleName ( EFactory eFactory ) const; + ::rtl::OUString GetFactoryName ( EFactory eFactory ) const; + ::rtl::OUString GetFactoryShortName ( EFactory eFactory ) const; + ::rtl::OUString GetFactoryStandardTemplate( EFactory eFactory ) const; + ::rtl::OUString GetFactoryWindowAttributes( EFactory eFactory ) const; + ::rtl::OUString GetFactoryEmptyDocumentURL( EFactory eFactory ) const; + ::rtl::OUString GetFactoryDefaultFilter ( EFactory eFactory ) const; + sal_Bool IsDefaultFilterReadonly ( EFactory eFactory ) const; + sal_Int32 GetFactoryIcon ( EFactory eFactory ) const; + static sal_Bool ClassifyFactoryByName ( const ::rtl::OUString& sName , + EFactory& eFactory ); + void SetFactoryStandardTemplate( EFactory eFactory , + const ::rtl::OUString& sTemplate ); + void SetFactoryWindowAttributes( EFactory eFactory , + const ::rtl::OUString& sAttributes); + void SetFactoryDefaultFilter ( EFactory eFactory , + const ::rtl::OUString& sFilter ); + + //_______________________________________ + + /** @short return the corresponding application ID for the given + document service name. + */ + static EFactory ClassifyFactoryByServiceName(const ::rtl::OUString& sName); + + //_______________________________________ + + /** @short return the corresponding application ID for the given + short name. + */ + static EFactory ClassifyFactoryByShortName(const ::rtl::OUString& sName); + + //_______________________________________ + + /** @short return the corresponding application ID for the given properties. + + @descr Because this search base on filters currently (till we have a better solution) + a result is not guaranteed everytimes. May a filter does not exists for the specified + content (but a FrameLoader which is not bound to any application!) ... or + the given properties describe a stream (and we make no deep detection inside here!). + + @attention The module BASIC cant be detected here. Because it does not + has an own URL schema. + + @param sURL + the complete URL! + + @param lMediaDescriptor + additional informations + + @return A suitable enum value. See EFactory above. + */ + static EFactory ClassifyFactoryByURL(const ::rtl::OUString& sURL , + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lMediaDescriptor); + + //_______________________________________ + + /** @short return the corresponding application ID for the given properties. + + @descr Here we try to use the list of supported service names of the given model + to find out the right application module. + + @attention The module BASIC cant be detected here. Because it does not + support any model/ctrl/view paradigm. + + @param xModel + the document model + + @return A suitable enum value. See EFactory above. + */ + static EFactory ClassifyFactoryByModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel); + + ::rtl::OUString GetDefaultModuleName(); + + //--------------------------------------------------------------------------------------------------------- + // old interface ... + //--------------------------------------------------------------------------------------------------------- + sal_Bool IsMath () const; + sal_Bool IsChart () const; + sal_Bool IsCalc () const; + sal_Bool IsDraw () const; + sal_Bool IsWriter () const; + sal_Bool IsImpress () const; + sal_Bool IsBasicIDE () const; + sal_Bool IsDataBase () const; + sal_uInt32 GetFeatures() const; + + ::com::sun::star::uno::Sequence < ::rtl::OUString > GetAllServiceNames(); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + private: + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& impl_GetOwnStaticMutex(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + private: + + /*Attention + + Don't initialize these static member in these header! + a) Double defined symbols will be detected ... + b) and unresolved externals exist at linking time. + Do it in your source only. + */ + + static SvtModuleOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! + static sal_Int32 m_nRefCount ; /// internal ref count mechanism + +}; // class SvtModuleOptions + +#endif // #ifndef INCLUDED_SVTOOLS_MODULEOPTIONS_HXX diff --git a/unotools/inc/unotools/options.hxx b/unotools/inc/unotools/options.hxx new file mode 100644 index 000000000000..6e3b40075a04 --- /dev/null +++ b/unotools/inc/unotools/options.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: options.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_unotools_OPTIONS_HXX +#define INCLUDED_unotools_OPTIONS_HXX + +#include "sal/config.h" +#include "unotools/unotoolsdllapi.h" + +namespace utl { + + class ConfigurationBroadcaster; + class IMPL_ConfigurationListenerList; + + class UNOTOOLS_DLLPUBLIC ConfigurationListener + { + public: + virtual void ConfigurationChanged( ConfigurationBroadcaster* ) = 0; + }; + + class UNOTOOLS_DLLPUBLIC ConfigurationBroadcaster + { + IMPL_ConfigurationListenerList* mpList; + public: + void AddListener( utl::ConfigurationListener* pListener ); + void RemoveListener( utl::ConfigurationListener* pListener ); + void NotifyListeners(); + ConfigurationBroadcaster(); + ~ConfigurationBroadcaster(); + }; + +namespace detail { + +// A base class for the various option classes supported by +// unotools/source/config/itemholderbase.hxx (which must be public, as it is +// shared between svl and svt): +class UNOTOOLS_DLLPUBLIC Options : public utl::ConfigurationBroadcaster, public utl::ConfigurationListener +{ +public: + Options(); + + virtual ~Options() = 0; + +private: + UNOTOOLS_DLLPRIVATE Options(Options &); // not defined + UNOTOOLS_DLLPRIVATE void operator =(Options &); // not defined + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster* ); +}; + +} } + +#endif diff --git a/unotools/inc/unotools/optionsdlg.hxx b/unotools/inc/unotools/optionsdlg.hxx new file mode 100644 index 000000000000..87649a82358c --- /dev/null +++ b/unotools/inc/unotools/optionsdlg.hxx @@ -0,0 +1,59 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: optionsdlg.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_unotools_OPTIONSDLG_HXX +#define INCLUDED_unotools_OPTIONSDLG_HXX + +#ifndef INCLUDED_unotoolsdllapi_H +#include "unotools/unotoolsdllapi.h" +#endif +#include +#include + +class SvtOptionsDlgOptions_Impl; + +class UNOTOOLS_DLLPUBLIC SvtOptionsDialogOptions: public utl::detail::Options +{ +private: + SvtOptionsDlgOptions_Impl* m_pImp; + +public: + SvtOptionsDialogOptions(); + virtual ~SvtOptionsDialogOptions(); + + sal_Bool IsGroupHidden ( const String& _rGroup ) const; + sal_Bool IsPageHidden ( const String& _rPage, + const String& _rGroup ) const; + sal_Bool IsOptionHidden ( const String& _rOption, + const String& _rPage, + const String& _rGroup ) const; +}; + +#endif + diff --git a/unotools/inc/unotools/pathoptions.hxx b/unotools/inc/unotools/pathoptions.hxx new file mode 100644 index 000000000000..e606180c25de --- /dev/null +++ b/unotools/inc/unotools/pathoptions.hxx @@ -0,0 +1,143 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: pathoptions.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_unotools_PATHOPTIONS_HXX +#define INCLUDED_unotools_PATHOPTIONS_HXX + +#include "unotools/unotoolsdllapi.h" +#include +#include +#include + +#define SVT_SEARCHPATH_DELIMITER ';' + +// class SvtPathOptions -------------------------------------------------- + +class SvtPathOptions_Impl; +class UNOTOOLS_DLLPUBLIC SvtPathOptions: public utl::detail::Options +{ +private: + SvtPathOptions_Impl* pImp; + +public: + enum Pathes + { + PATH_ADDIN, + PATH_AUTOCORRECT, + PATH_AUTOTEXT, + PATH_BACKUP, + PATH_BASIC, + PATH_BITMAP, + PATH_CONFIG, + PATH_DICTIONARY, + PATH_FAVORITES, + PATH_FILTER, + PATH_GALLERY, + PATH_GRAPHIC, + PATH_HELP, + PATH_LINGUISTIC, + PATH_MODULE, + PATH_PALETTE, + PATH_PLUGIN, + PATH_STORAGE, + PATH_TEMP, + PATH_TEMPLATE, + PATH_USERCONFIG, + PATH_WORK, + PATH_UICONFIG, + PATH_FINGERPRINT, + PATH_COUNT // should always be the last element + }; + + SvtPathOptions(); + virtual ~SvtPathOptions(); + + // get the pathes, not const because of using a mutex + const String& GetAddinPath() const; + const String& GetAutoCorrectPath() const; + const String& GetAutoTextPath() const; + const String& GetBackupPath() const; + const String& GetBasicPath() const; + const String& GetBitmapPath() const; + const String& GetConfigPath() const; + const String& GetDictionaryPath() const; + const String& GetFavoritesPath() const; + const String& GetFilterPath() const; + const String& GetGalleryPath() const; + const String& GetGraphicPath() const; + const String& GetHelpPath() const; + const String& GetLinguisticPath() const; + const String& GetModulePath() const; + const String& GetPalettePath() const; + const String& GetPluginPath() const; + const String& GetStoragePath() const; + const String& GetTempPath() const; + const String& GetTemplatePath() const; + const String& GetUserConfigPath() const; + const String& GetWorkPath() const; + const String& GetUIConfigPath() const; + const String& GetFingerprintPath() const; + + BOOL IsPathReadonly(Pathes ePath)const; + const String& GetPath(Pathes ePath) const; + + // set the pathes + void SetAddinPath( const String& rPath ); + void SetAutoCorrectPath( const String& rPath ); + void SetAutoTextPath( const String& rPath ); + void SetBackupPath( const String& rPath ); + void SetBasicPath( const String& rPath ); + void SetBitmapPath( const String& rPath ); + void SetConfigPath( const String& rPath ); + void SetDictionaryPath( const String& rPath ); + void SetFavoritesPath( const String& rPath ); + void SetFilterPath( const String& rPath ); + void SetGalleryPath( const String& rPath ); + void SetGraphicPath( const String& rPath ); + void SetHelpPath( const String& rPath ); + void SetLinguisticPath( const String& rPath ); + void SetModulePath( const String& rPath ); + void SetPalettePath( const String& rPath ); + void SetPluginPath( const String& rPath ); + void SetStoragePath( const String& rPath ); + void SetTempPath( const String& rPath ); + void SetTemplatePath( const String& rPath ); + void SetUserConfigPath( const String& rPath ); + void SetWorkPath( const String& rPath ); + void SetPath( SvtPathOptions::Pathes ePath, const String& rNewPath ); + + String SubstituteVariable( const String& rVar ); + String UseVariable( const String& rVar ); + sal_Bool SearchFile( String& rIniFile, Pathes ePath = PATH_USERCONFIG ); + ::com::sun::star::lang::Locale GetLocale() const; + sal_Bool IsReadonly() const; +}; + +#endif // #ifndef INCLUDED_unotools_PATHOPTIONS_HXX + diff --git a/unotools/inc/unotools/printwarningoptions.hxx b/unotools/inc/unotools/printwarningoptions.hxx new file mode 100644 index 000000000000..3663fb8c63d0 --- /dev/null +++ b/unotools/inc/unotools/printwarningoptions.hxx @@ -0,0 +1,164 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: printwarningoptions.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_unotools_PRINTWARNINGOPTIONS_HXX +#define INCLUDED_unotools_PRINTWARNINGOPTIONS_HXX + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include "unotools/unotoolsdllapi.h" +#include +#include +#include +#include + +//_________________________________________________________________________________________________________________ +// forward declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short forward declaration to our private date container implementation + @descr We use these class as internal member to support small memory requirements. + You can create the container if it is neccessary. The class which use these mechanism + is faster and smaller then a complete implementation! +*//*-*************************************************************************************************************/ + +class SvtPrintWarningOptions_Impl; + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short collect informations about startup features + @descr - + + @implements - + @base - + + @devstatus ready to use +*//*-*************************************************************************************************************/ + +class UNOTOOLS_DLLPUBLIC SvtPrintWarningOptions: public utl::detail::Options +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor and destructor + @descr This will initialize an instance with default values. + We implement these class with a refcount mechanism! Every instance of this class increase it + at create and decrease it at delete time - but all instances use the same data container! + He is implemented as a static member ... + + @seealso member m_nRefCount + @seealso member m_pDataContainer + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + SvtPrintWarningOptions(); + virtual ~SvtPrintWarningOptions(); + + //--------------------------------------------------------------------------------------------------------- + // interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short interface methods to get and set value of config key "org.openoffice.Office.Common/Print/Warning..." + @descr These options describe internal states to enable/disable features of installed office. + + @seealso configuration package "org.openoffice.Office.Common/_3D-Engine" + *//*-*****************************************************************************************************/ + + sal_Bool IsPaperSize() const; + sal_Bool IsPaperOrientation() const; + sal_Bool IsNotFound() const; + sal_Bool IsTransparency() const; + sal_Bool IsModifyDocumentOnPrintingAllowed() const; + + void SetPaperSize( sal_Bool bState ); + void SetPaperOrientation( sal_Bool bState ); + void SetNotFound( sal_Bool bState ); + void SetTransparency( sal_Bool bState ); + void SetModifyDocumentOnPrintingAllowed( sal_Bool bState ); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return a reference to a static mutex + @descr These class use his own static mutex to be threadsafe. + We create a static mutex only for one ime and use at different times. + + @seealso - + + @param - + @return A reference to a static mutex member. + + @onerror - + *//*-*****************************************************************************************************/ + + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + private: + + /*Attention + + Don't initialize these static member in these header! + a) Double dfined symbols will be detected ... + b) and unresolved externals exist at linking time. + Do it in your source only. + */ + + static SvtPrintWarningOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! + static sal_Int32 m_nRefCount ; /// internal ref count mechanism + +}; // class SvtPrintWarningOptions + +#endif // #ifndef INCLUDED_unotools_PRINTWARNINGOPTIONS_HXX diff --git a/unotools/inc/unotools/regoptions.hxx b/unotools/inc/unotools/regoptions.hxx new file mode 100644 index 000000000000..3b0f6c760b1f --- /dev/null +++ b/unotools/inc/unotools/regoptions.hxx @@ -0,0 +1,129 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: regoptions.hxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef unotools_REGOPTIONS_HXX +#define unotools_REGOPTIONS_HXX + +#include "unotools/unotoolsdllapi.h" +#include + +//........................................................................ +namespace utl +{ +//........................................................................ + + //==================================================================== + //= RegOptions + //==================================================================== + class RegOptionsImpl; + /** encapsulates access to the configuration settings for registering the product + */ + class UNOTOOLS_DLLPUBLIC RegOptions + { + private: + RegOptionsImpl* m_pImpl; + + // the impl class is constructed upon need only (as this is expensive) + UNOTOOLS_DLLPRIVATE void ensureImpl( ); + + public: + RegOptions( ); + ~RegOptions( ); + + // retrieves the URL which should be used for online registration + String getRegistrationURL( ) const; + + // checks if the menu item which can be used to trigger the online registration should be available + sal_Bool allowMenu( ) const; + + enum DialogPermission + { // the registration dialog shall be executed .... + dpDisabled, // ... never - it has been disabled + dpNotThisSession, // ... later - no statement when, but _not now_ + dpRemindLater, // ... later at a reminder date + dpThisSession // ... during this session + }; + + /** checks if the registration dialog is allowed +

A return value of does not mean that during this session, the dialog is allowed to + be executed. It simply means executing it is allowed in general

+ */ + DialogPermission getDialogPermission( ) const; + + /** claims that the current session is done with respect to the registration dialog. + +

This is not to be called if getDialogPermission returned dpDisabled previously

+

The behaviour changes as follows: +

    +
  • any subsequent calls to getDialogPermission will return dpNotThisSession, given + that it previously returned dpNotThisSession
  • +
  • any subsequent calls to getDialogPermission will return dpDisabled, given + that it previously returned dpThisSession
  • +
  • an internal (persistent) session counter is updated, so that during the next session, + getDialogPermission may return dpThisSession
  • +

+ */ + void markSessionDone( ); + + /** activates the reminder + +

If this method is called, the reminder for the dialog will be activated. + This means that during the next _nDaysFromNow-1 days, + getDialogPermission will return dpRemindLater

, + at the _nDaysFromNowth day from today onwards it will + return dpThisSession.

+ +

It is not allowed to call this method if the dialog is currently disabled.

+ +

If the current session has not been marked as done already + (i.e., markSessionDone has not been called, yet), this is + done implicitly when you call activateReminder.

+ */ + void activateReminder( sal_Int32 _nDaysFromNow ); + + /** removes the reminder + +

If this method is called, the reminder for the dialog will be removed. + */ + void removeReminder(); + + /** checks if the reminder date has come + +

Returns if the current date is greater or equal the reminder date. + */ + bool hasReminderDateCome() const; + }; + +//........................................................................ +} // namespace utl +//........................................................................ + +#endif // unotools_REGOPTIONS_HXX + diff --git a/unotools/inc/unotools/saveopt.hxx b/unotools/inc/unotools/saveopt.hxx new file mode 100644 index 000000000000..bb50cadafb1d --- /dev/null +++ b/unotools/inc/unotools/saveopt.hxx @@ -0,0 +1,133 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: saveopt.hxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_unotools_SAVEOPT_HXX +#define INCLUDED_unotools_SAVEOPT_HXX + +#include "unotools/unotoolsdllapi.h" +#include + +struct SvtLoadSaveOptions_Impl; +class UNOTOOLS_DLLPUBLIC SvtSaveOptions: public utl::detail::Options +{ + SvtLoadSaveOptions_Impl* pImp; + +public: + + enum EOption + { + E_AUTOSAVETIME, + E_USEUSERDATA, + E_BACKUP, + E_AUTOSAVE, + E_AUTOSAVEPROMPT, + E_DOCINFSAVE, + E_SAVEWORKINGSET, + E_SAVEDOCWINS, + E_SAVEDOCVIEW, + E_SAVERELINET, + E_SAVERELFSYS, + E_SAVEUNPACKED, + E_DOPRETTYPRINTING, + E_WARNALIENFORMAT, + E_LOADDOCPRINTER, + E_ODFDEFAULTVERSION + }; + + // keep enum values sorted that a less or greater compare maps to older and newer versions! + enum ODFDefaultVersion + { + ODFVER_UNKNOWN = 0, // unknown + ODFVER_010 = 1, // ODF 1.0 + ODFVER_011 = 2, // ODF 1.1 + DO_NOT_USE = 3, // Do not use this, only here for compatibility with pre OOo 3.2 configuration + ODFVER_012 = 4, // ODF 1.2 + + ODFVER_LATEST = SAL_MAX_ENUM, // ODF latest version with enhancements + }; + + SvtSaveOptions(); + virtual ~SvtSaveOptions(); + + void SetAutoSaveTime( sal_Int32 n ); + sal_Int32 GetAutoSaveTime() const; + + void SetUseUserData( sal_Bool b ); + sal_Bool IsUseUserData() const; + + void SetBackup( sal_Bool b ); + sal_Bool IsBackup() const; + + void SetAutoSave( sal_Bool b ); + sal_Bool IsAutoSave() const; + + void SetAutoSavePrompt( sal_Bool b ); + sal_Bool IsAutoSavePrompt() const; + + void SetDocInfoSave(sal_Bool b); + sal_Bool IsDocInfoSave() const; + + void SetSaveWorkingSet( sal_Bool b ); + sal_Bool IsSaveWorkingSet() const; + + void SetSaveDocWins( sal_Bool b ); + sal_Bool IsSaveDocWins() const; + + void SetSaveDocView( sal_Bool b ); + sal_Bool IsSaveDocView() const; + + void SetSaveRelINet( sal_Bool b ); + sal_Bool IsSaveRelINet() const; + + void SetSaveRelFSys( sal_Bool b ); + sal_Bool IsSaveRelFSys() const; + + void SetSaveUnpacked( sal_Bool b ); + sal_Bool IsSaveUnpacked() const; + + void SetLoadUserSettings(sal_Bool b); + sal_Bool IsLoadUserSettings() const; + + void SetPrettyPrinting( sal_Bool _bEnable ); + sal_Bool IsPrettyPrinting( ) const; + + void SetWarnAlienFormat( sal_Bool _bEnable ); + sal_Bool IsWarnAlienFormat( ) const; + + void SetLoadDocumentPrinter( sal_Bool _bEnable ); + sal_Bool IsLoadDocumentPrinter( ) const; + + void SetODFDefaultVersion( ODFDefaultVersion eVersion ); + ODFDefaultVersion GetODFDefaultVersion() const; + + sal_Bool IsReadOnly( EOption eOption ) const; +}; + +#endif + diff --git a/unotools/inc/unotools/searchopt.hxx b/unotools/inc/unotools/searchopt.hxx new file mode 100644 index 000000000000..4f53a1e050b0 --- /dev/null +++ b/unotools/inc/unotools/searchopt.hxx @@ -0,0 +1,122 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: searchopt.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVT_SEARCHOPT_HXX_ +#define _SVT_SEARCHOPT_HXX_ + +#include "unotools/unotoolsdllapi.h" +#include "tools/solar.h" + +class SvtSearchOptions_Impl; + +class UNOTOOLS_DLLPUBLIC SvtSearchOptions +{ + SvtSearchOptions_Impl *pImpl; + + // disallow copy-constructor and assignment-operator for now + SvtSearchOptions( const SvtSearchOptions & ); + SvtSearchOptions & operator = ( const SvtSearchOptions & ); + +protected: + +public: + SvtSearchOptions(); + ~SvtSearchOptions(); + + INT32 GetTransliterationFlags() const; + + // + // General Options + // + + BOOL IsWholeWordsOnly() const; + BOOL IsBackwards() const; + BOOL IsUseRegularExpression() const; + BOOL IsSearchForStyles() const; + BOOL IsSimilaritySearch() const; + BOOL IsUseAsianOptions() const; + BOOL IsMatchCase() const; // also Japanese search option + BOOL IsNotes() const; + + void SetWholeWordsOnly( BOOL bVal ); + void SetBackwards( BOOL bVal ); + void SetUseRegularExpression( BOOL bVal ); + void SetSearchForStyles( BOOL bVal ); + void SetSimilaritySearch( BOOL bVal ); + void SetUseAsianOptions( BOOL bVal ); + void SetMatchCase( BOOL bVal ); // also Japanese search option + void SetNotes( BOOL bVal); + + // + // Japanese search options + // + + BOOL IsMatchFullHalfWidthForms() const; + BOOL IsMatchHiraganaKatakana() const; + BOOL IsMatchContractions() const; + BOOL IsMatchMinusDashChoon() const; + BOOL IsMatchRepeatCharMarks() const; + BOOL IsMatchVariantFormKanji() const; + BOOL IsMatchOldKanaForms() const; + BOOL IsMatchDiziDuzu() const; + BOOL IsMatchBavaHafa() const; + BOOL IsMatchTsithichiDhizi() const; + BOOL IsMatchHyuiyuByuvyu() const; + BOOL IsMatchSesheZeje() const; + BOOL IsMatchIaiya() const; + BOOL IsMatchKiku() const; + BOOL IsIgnorePunctuation() const; + BOOL IsIgnoreWhitespace() const; + BOOL IsIgnoreProlongedSoundMark() const; + BOOL IsIgnoreMiddleDot() const; + + void SetMatchFullHalfWidthForms( BOOL bVal ); + void SetMatchHiraganaKatakana( BOOL bVal ); + void SetMatchContractions( BOOL bVal ); + void SetMatchMinusDashChoon( BOOL bVal ); + void SetMatchRepeatCharMarks( BOOL bVal ); + void SetMatchVariantFormKanji( BOOL bVal ); + void SetMatchOldKanaForms( BOOL bVal ); + void SetMatchDiziDuzu( BOOL bVal ); + void SetMatchBavaHafa( BOOL bVal ); + void SetMatchTsithichiDhizi( BOOL bVal ); + void SetMatchHyuiyuByuvyu( BOOL bVal ); + void SetMatchSesheZeje( BOOL bVal ); + void SetMatchIaiya( BOOL bVal ); + void SetMatchKiku( BOOL bVal ); + void SetIgnorePunctuation( BOOL bVal ); + void SetIgnoreWhitespace( BOOL bVal ); + void SetIgnoreProlongedSoundMark( BOOL bVal ); + void SetIgnoreMiddleDot( BOOL bVal ); +}; + + +#endif + diff --git a/unotools/inc/unotools/securityoptions.hxx b/unotools/inc/unotools/securityoptions.hxx new file mode 100644 index 000000000000..bbca1770b836 --- /dev/null +++ b/unotools/inc/unotools/securityoptions.hxx @@ -0,0 +1,299 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: securityoptions.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_unotools_SECURITYOPTIONS_HXX +#define INCLUDED_unotools_SECURITYOPTIONS_HXX + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include "unotools/unotoolsdllapi.h" +#include +#include +#include +#include +#include + +//_________________________________________________________________________________________________________________ +// forward declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short forward declaration to our private date container implementation + @descr We use these class as internal member to support small memory requirements. + You can create the container if it is neccessary. The class which use these mechanism + is faster and smaller then a complete implementation! +*//*-*************************************************************************************************************/ + +class SvtSecurityOptions_Impl; + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @descr These values present modes to handle StarOffice basic scripts. + see GetBasicMode/SetBasicMode() for further informations +*//*-*************************************************************************************************************/ + +enum EBasicSecurityMode +{ + eNEVER_EXECUTE = 0, + eFROM_LIST = 1, + eALWAYS_EXECUTE = 2 +}; + +/*-************************************************************************************************************//** + @short collect informations about security features + @descr - + + @implements - + @base - + + @ATTENTION This class is partially threadsafe. + + @devstatus ready to use +*//*-*************************************************************************************************************/ + +class UNOTOOLS_DLLPUBLIC SvtSecurityOptions: public utl::detail::Options +{ + //------------------------------------------------------------------------------------------------------------- + // public types + //------------------------------------------------------------------------------------------------------------- + public: + + enum EOption + { + E_SECUREURLS, + E_BASICMODE, // xmlsec05 depricated + E_EXECUTEPLUGINS, // xmlsec05 depricated + E_WARNING, // xmlsec05 depricated + E_CONFIRMATION, // xmlsec05 depricated + E_DOCWARN_SAVEORSEND, + E_DOCWARN_SIGNING, + E_DOCWARN_PRINT, + E_DOCWARN_CREATEPDF, + E_DOCWARN_REMOVEPERSONALINFO, + E_DOCWARN_RECOMMENDPASSWORD, + E_MACRO_SECLEVEL, + E_MACRO_TRUSTEDAUTHORS, + E_MACRO_DISABLE, + E_CTRLCLICK_HYPERLINK + }; + + enum MacroAction + { + MA_DONTRUN = 0, + MA_CONFIRM, + MA_RUN + }; + + typedef ::com::sun::star::uno::Sequence< ::rtl::OUString > Certificate; + + /* + // MT: Doesn't work for sequence... + struct Certificate + { + ::rtl::OUString SubjectName; + ::rtl::OUString SerialNumber; + ::rtl::OUString RawData; + }; + */ + + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor and destructor + @descr This will initialize an instance with default values. + We implement these class with a refcount mechanism! Every instance of this class increase it + at create and decrease it at delete time - but all instances use the same data container! + He is implemented as a static member ... + + @seealso member m_nRefCount + @seealso member m_pDataContainer + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + SvtSecurityOptions(); + virtual ~SvtSecurityOptions(); + + //--------------------------------------------------------------------------------------------------------- + // interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short returns readonly state + @descr It can be called to get information about the readonly state of a provided item. + @seealso - + + @param "eOption", specify, which item is queried + @return if item is readonly; otherwhise + + @onerror No error should occurre! + *//*-*****************************************************************************************************/ + + sal_Bool IsReadOnly( EOption eOption ) const ; + + /*-****************************************************************************************************//** + @short interface methods to get and set value of config key "org.openoffice.Office.Common/Security/Scripting/SecureURL" + @descr These value displays the list of all trustworthy URLs. + zB.: file:/ => All scripts from the local file system including a LAN; + private:explorer => Scripts from the Explorer; + private:help => Scripts in the help system; + private:newmenu => Scripts that are executed by the commands File-New and AutoPilot; + private:schedule => Scripts of the scheduler; + private:searchfolder => Scripts of the searchfolder; + private:user => Scripts that are entered in the URL field. + @seealso - + + @param "seqURLList", new values to set it in configuration. + @return The values which represent current state of internal variable. + + @onerror No error should occurre! + *//*-*****************************************************************************************************/ + + ::com::sun::star::uno::Sequence< ::rtl::OUString > GetSecureURLs( ) const ; + void SetSecureURLs( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& seqURLList ) ; + + /*-****************************************************************************************************//** + @short interface methods to get and set value of config key "org.openoffice.Office.Common/Security/Scripting/StarOfficeBasic" + @descr These value determines how StarOffice Basic scripts should be handled. + It exist 3 different modes: + 0 = never execute + 1 = from list + 2 = always execute + + @ATTENTION These methods don't check for valid or invalid values! + Our configuration server can do it ... but these implementation don't get any notifications + about wrong commits ...! + => If you set an invalid value - nothing will be changed. The information will lost. + + @seealso enum EBasicSecurityMode + + @param "eMode" to set new mode ... Value must defined as an enum of type EBasicSecurityMode! + @return An enum value, which present current mode. + + @onerror No error should occurre! + *//*-*****************************************************************************************************/ + + sal_Int32 GetMacroSecurityLevel ( ) const ; + void SetMacroSecurityLevel ( sal_Int32 _nLevel ) ; + + sal_Bool IsMacroDisabled ( ) const ; + + /*-****************************************************************************************************//** + @short special method to check an URL and his referer corresponding to ouer internal security cessation + @descr Give us an URL and his referer and we will say you if these url can be scripted or not! + + @seealso - + + @param "sURL" reference to URL for checking + @param "sReferer" reference to referer which whish to run script by given URL + @return sal_True if URL is secure or security is obsolete(!) or sal_False otherwise. + + @onerror No error should occurre! + *//*-*****************************************************************************************************/ + + sal_Bool IsSecureURL( const ::rtl::OUString& sURL , + const ::rtl::OUString& sReferer ) const ; + + ::com::sun::star::uno::Sequence< Certificate > GetTrustedAuthors ( ) const ; + void SetTrustedAuthors ( const ::com::sun::star::uno::Sequence< Certificate >& rAuthors ) ; + sal_Bool IsTrustedAuthorsEnabled ( ) ; + + // for bool options only! + bool IsOptionSet ( EOption eOption ) const ; + bool SetOption ( EOption eOption, bool bValue ) ; + bool IsOptionEnabled ( EOption eOption ) const ; + + // xmlsec05 depricated methods + sal_Bool IsExecutePlugins() const; + void SetExecutePlugins( sal_Bool bSet ); + EBasicSecurityMode GetBasicMode( ) const ; + void SetBasicMode( EBasicSecurityMode eMode ) ; + sal_Bool IsWarningEnabled() const; + void SetWarningEnabled( sal_Bool bSet ); + sal_Bool IsConfirmationEnabled() const; + void SetConfirmationEnabled( sal_Bool bSet ); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return a reference to a static mutex + @descr These class is partially threadsafe (for de-/initialization only). + All access methods are'nt safe! + We create a static mutex only for one ime and use at different times. + + @seealso - + + @param - + @return A reference to a static mutex member. + + @onerror - + *//*-*****************************************************************************************************/ + + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetInitMutex(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + /*Attention + + Don't initialize these static member in these header! + a) Double dfined symbols will be detected ... + b) and unresolved externals exist at linking time. + Do it in your source only. + */ + + static SvtSecurityOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! + static sal_Int32 m_nRefCount ; /// internal ref count mechanism + +}; // class SvtSecurityOptions + +#endif // #ifndef INCLUDED_unotools_SECURITYOPTIONS_HXX diff --git a/unotools/inc/unotools/sourceviewconfig.hxx b/unotools/inc/unotools/sourceviewconfig.hxx new file mode 100644 index 000000000000..cc28bd3dae61 --- /dev/null +++ b/unotools/inc/unotools/sourceviewconfig.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: sourceviewconfig.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _unotools_SOURCEVIEWCONFIG_HXX +#define _unotools_SOURCEVIEWCONFIG_HXX + +// include --------------------------------------------------------------- + +#include "unotools/unotoolsdllapi.h" +#include +#include +#include + +/* -----------------------------12.10.00 11:40-------------------------------- + + ---------------------------------------------------------------------------*/ +namespace utl +{ + class SourceViewConfig_Impl; + class UNOTOOLS_DLLPUBLIC SourceViewConfig: public utl::detail::Options + { + static SourceViewConfig_Impl* m_pImplConfig; + static sal_Int32 m_nRefCount; + + public: + SourceViewConfig(); + virtual ~SourceViewConfig(); + + const rtl::OUString& GetFontName() const; + void SetFontName(const rtl::OUString& rName); + + sal_Int16 GetFontHeight() const; + void SetFontHeight(sal_Int16 nHeight); + + sal_Bool IsShowProportionalFontsOnly() const; + void SetShowProportionalFontsOnly(sal_Bool bSet); + }; +} +#endif + diff --git a/unotools/inc/unotools/startoptions.hxx b/unotools/inc/unotools/startoptions.hxx new file mode 100644 index 000000000000..a23fb08fce6b --- /dev/null +++ b/unotools/inc/unotools/startoptions.hxx @@ -0,0 +1,173 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: startoptions.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_unotools_STARTOPTIONS_HXX +#define INCLUDED_unotools_STARTOPTIONS_HXX + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include "unotools/unotoolsdllapi.h" +#include +#include +#include +#include + +//_________________________________________________________________________________________________________________ +// forward declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short forward declaration to our private date container implementation + @descr We use these class as internal member to support small memory requirements. + You can create the container if it is neccessary. The class which use these mechanism + is faster and smaller then a complete implementation! +*//*-*************************************************************************************************************/ + +class SvtStartOptions_Impl; + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short collect informations about startup features + @descr - + + @implements - + @base - + + @devstatus ready to use +*//*-*************************************************************************************************************/ + +class UNOTOOLS_DLLPUBLIC SvtStartOptions: public utl::detail::Options +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor and destructor + @descr This will initialize an instance with default values. + We implement these class with a refcount mechanism! Every instance of this class increase it + at create and decrease it at delete time - but all instances use the same data container! + He is implemented as a static member ... + + @seealso member m_nRefCount + @seealso member m_pDataContainer + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + SvtStartOptions(); + virtual ~SvtStartOptions(); + + //--------------------------------------------------------------------------------------------------------- + // interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short interface methods to get and set value of config key "org.openoffice.Office.Common/Start/..." + @descr These options describe internal states to enable/disable features of installed office. + The values are fixed at runtime - and implemented as readonly! + + IsIntroEnabled() : Setting, if the StarOffice Logo is displayed when starting StarOffice. + Default = true + + EnableIntro() : Use it to enable/disable the logo at startup. + + @seealso configuration package "org.openoffice.Office.Common/Start" + *//*-*****************************************************************************************************/ + + sal_Bool IsIntroEnabled ( ) const ; + void EnableIntro ( sal_Bool bState ) ; + + /*-****************************************************************************************************//** + @short returns or set the connection URL of an office + @descr Specifies the URL for an UNO connection. + No default is given, the URL has to be entered manually by the admin/user. + zB.: "socket,host=pc1.test.de,port=6001;iiop;" + + @seealso configuration package "org.openoffice.Office.Common/Start" + *//*-*****************************************************************************************************/ + + ::rtl::OUString GetConnectionURL( ) const ; + void SetConnectionURL( const ::rtl::OUString& sURL ) ; + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return a reference to a static mutex + @descr These class use his own static mutex to be threadsafe. + We create a static mutex only for one ime and use at different times. + + @seealso - + + @param - + @return A reference to a static mutex member. + + @onerror - + *//*-*****************************************************************************************************/ + + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + /*Attention + + Don't initialize these static member in these header! + a) Double dfined symbols will be detected ... + b) and unresolved externals exist at linking time. + Do it in your source only. + */ + + static SvtStartOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! + static sal_Int32 m_nRefCount ; /// internal ref count mechanism + +}; // class SvtStartOptions + +#endif // #ifndef INCLUDED_unotools_STARTOPTIONS_HXX diff --git a/unotools/inc/unotools/undoopt.hxx b/unotools/inc/unotools/undoopt.hxx new file mode 100644 index 000000000000..288ec3c6b5de --- /dev/null +++ b/unotools/inc/unotools/undoopt.hxx @@ -0,0 +1,52 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: undoopt.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_unotools_UNDOOPT_HXX +#define INCLUDED_unotools_UNDOOPT_HXX + +#include "unotools/unotoolsdllapi.h" +#include +#include + +class SvtUndoOptions_Impl; + +class UNOTOOLS_DLLPUBLIC SvtUndoOptions: public utl::detail::Options +{ + SvtUndoOptions_Impl* pImp; + +public: + SvtUndoOptions(); + virtual ~SvtUndoOptions(); + + void SetUndoCount( sal_Int32 n ); + sal_Int32 GetUndoCount() const; +}; + +#endif + diff --git a/unotools/inc/unotools/useroptions.hxx b/unotools/inc/unotools/useroptions.hxx new file mode 100644 index 000000000000..67fd3e5bbf35 --- /dev/null +++ b/unotools/inc/unotools/useroptions.hxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: useroptions.hxx,v $ + * $Revision: 1.2.312.2 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_unotools_USEROPTIONS_HXX +#define INCLUDED_unotools_USEROPTIONS_HXX + +#include "unotools/unotoolsdllapi.h" +#include +#include +#include +#include + +// define ---------------------------------------------------------------- + +#define USER_OPT_CITY ((USHORT)0) +#define USER_OPT_COMPANY ((USHORT)1) +#define USER_OPT_COUNTRY ((USHORT)2) +#define USER_OPT_EMAIL ((USHORT)3) +#define USER_OPT_FAX ((USHORT)4) +#define USER_OPT_FIRSTNAME ((USHORT)5) +#define USER_OPT_LASTNAME ((USHORT)6) +#define USER_OPT_POSITION ((USHORT)7) +#define USER_OPT_STATE ((USHORT)8) +#define USER_OPT_STREET ((USHORT)9) +#define USER_OPT_TELEPHONEHOME ((USHORT)10) +#define USER_OPT_TELEPHONEWORK ((USHORT)11) +#define USER_OPT_TITLE ((USHORT)12) +#define USER_OPT_ID ((USHORT)13) +#define USER_OPT_ZIP ((USHORT)14) +#define USER_OPT_FATHERSNAME ((USHORT)15) +#define USER_OPT_APARTMENT ((USHORT)16) + +// class SvtUserOptions -------------------------------------------------- + +class SvtUserOptions_Impl; + +class UNOTOOLS_DLLPUBLIC SvtUserOptions: public utl::detail::Options +{ +private: + SvtUserOptions_Impl* pImp; + +public: + SvtUserOptions(); + virtual ~SvtUserOptions(); + + static ::osl::Mutex& GetInitMutex(); + + // get the address token + ::rtl::OUString GetCompany() const; + ::rtl::OUString GetFirstName() const; + ::rtl::OUString GetLastName() const; + ::rtl::OUString GetID() const; + ::rtl::OUString GetStreet() const; + ::rtl::OUString GetCity() const; + ::rtl::OUString GetState() const; + ::rtl::OUString GetZip() const; + ::rtl::OUString GetCountry() const; + ::rtl::OUString GetPosition() const; + ::rtl::OUString GetTitle() const; + ::rtl::OUString GetTelephoneHome() const; + ::rtl::OUString GetTelephoneWork() const; + ::rtl::OUString GetFax() const; + ::rtl::OUString GetEmail() const; + ::rtl::OUString GetCustomerNumber() const; + ::rtl::OUString GetFathersName() const; + ::rtl::OUString GetApartment() const; + + ::rtl::OUString GetFullName() const; + ::rtl::OUString GetLocale() const; + + // set the address token + void SetCompany( const ::rtl::OUString& rNewToken ); + void SetFirstName( const ::rtl::OUString& rNewToken ); + void SetLastName( const ::rtl::OUString& rNewToken ); + void SetID( const ::rtl::OUString& rNewToken ); + void SetStreet( const ::rtl::OUString& rNewToken ); + void SetCity( const ::rtl::OUString& rNewToken ); + void SetState( const ::rtl::OUString& rNewToken ); + void SetZip( const ::rtl::OUString& rNewToken ); + void SetCountry( const ::rtl::OUString& rNewToken ); + void SetPosition( const ::rtl::OUString& rNewToken ); + void SetTitle( const ::rtl::OUString& rNewToken ); + void SetTelephoneHome( const ::rtl::OUString& rNewToken ); + void SetTelephoneWork( const ::rtl::OUString& rNewToken ); + void SetFax( const ::rtl::OUString& rNewToken ); + void SetEmail( const ::rtl::OUString& rNewToken ); + void SetCustomerNumber( const ::rtl::OUString& rNewToken ); + void SetFathersName( const ::rtl::OUString& rNewToken ); + void SetApartment( const ::rtl::OUString& rNewToken ); + + sal_Bool IsTokenReadonly( USHORT nToken ) const; + ::rtl::OUString GetToken(USHORT nToken) const; +}; + +#endif // #ifndef INCLUDED_unotools_USEROPTIONS_HXX diff --git a/unotools/inc/unotools/useroptions_const.hxx b/unotools/inc/unotools/useroptions_const.hxx new file mode 100644 index 000000000000..4dbd6da8bba3 --- /dev/null +++ b/unotools/inc/unotools/useroptions_const.hxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: useroptions_const.hxx,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:17:50 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDE_CONFIGITEMS_USEROPTIONS_CONST_HXX +#define INCLUDE_CONFIGITEMS_USEROPTIONS_CONST_HXX + +#include + +namespace +{ + static const ::rtl::OUString s_sData = ::rtl::OUString::createFromAscii("org.openoffice.UserProfile/Data"); + static const ::rtl::OUString s_so = ::rtl::OUString::createFromAscii("o"); // USER_OPT_COMPANY + static const ::rtl::OUString s_sgivenname = ::rtl::OUString::createFromAscii("givenname"); // USER_OPT_FIRSTNAME + static const ::rtl::OUString s_ssn = ::rtl::OUString::createFromAscii("sn"); // USER_OPT_LASTNAME + static const ::rtl::OUString s_sinitials = ::rtl::OUString::createFromAscii("initials"); // USER_OPT_ID + static const ::rtl::OUString s_sstreet = ::rtl::OUString::createFromAscii("street"); // USER_OPT_STREET + static const ::rtl::OUString s_sl = ::rtl::OUString::createFromAscii("l"); // USER_OPT_CITY + static const ::rtl::OUString s_sst = ::rtl::OUString::createFromAscii("st"); // USER_OPT_STATE + static const ::rtl::OUString s_spostalcode = ::rtl::OUString::createFromAscii("postalcode"); // USER_OPT_ZIP + static const ::rtl::OUString s_sc = ::rtl::OUString::createFromAscii("c"); // USER_OPT_COUNTRY + static const ::rtl::OUString s_stitle = ::rtl::OUString::createFromAscii("title"); // USER_OPT_TITLE + static const ::rtl::OUString s_sposition = ::rtl::OUString::createFromAscii("position"); // USER_OPT_POSITION + static const ::rtl::OUString s_shomephone = ::rtl::OUString::createFromAscii("homephone"); // USER_OPT_TELEPHONEHOME + static const ::rtl::OUString s_stelephonenumber = ::rtl::OUString::createFromAscii("telephonenumber"); // USER_OPT_TELEPHONEWORK + static const ::rtl::OUString s_sfacsimiletelephonenumber = ::rtl::OUString::createFromAscii("facsimiletelephonenumber"); // USER_OPT_FAX + static const ::rtl::OUString s_smail = ::rtl::OUString::createFromAscii("mail"); // USER_OPT_EMAIL + static const ::rtl::OUString s_scustomernumber = ::rtl::OUString::createFromAscii("customernumber"); // USER_OPT_CUSTOMERNUMBER + static const ::rtl::OUString s_sfathersname = ::rtl::OUString::createFromAscii("fathersname"); // USER_OPT_FATHERSNAME + static const ::rtl::OUString s_sapartment = ::rtl::OUString::createFromAscii("apartment"); // USER_OPT_APARTMENT +} + +#endif // INCLUDE_CONFIGITEMS_USEROPTIONS_CONST_HXX diff --git a/unotools/inc/unotools/viewoptions.hxx b/unotools/inc/unotools/viewoptions.hxx new file mode 100644 index 000000000000..07f4da9e3159 --- /dev/null +++ b/unotools/inc/unotools/viewoptions.hxx @@ -0,0 +1,356 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: viewoptions.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_unotools_VIEWOPTIONS_HXX +#define INCLUDED_unotools_VIEWOPTIONS_HXX + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include "unotools/unotoolsdllapi.h" +#include +#include +#include +#include +#include +#include +#include +#include + +//_________________________________________________________________________________________________________________ +// forward declarations +//_________________________________________________________________________________________________________________ + +class SvtViewOptionsBase_Impl; + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @descr Use these enum values to specify right list in configuration in which your view data are saved. +*//*-*************************************************************************************************************/ + +enum EViewType +{ + E_DIALOG = 0, + E_TABDIALOG = 1, + E_TABPAGE = 2, + E_WINDOW = 3 +}; + +/*-************************************************************************************************************//** + @short collect informations about view features + @descr We support different basetypes of views like dialogs, tab-dialogs, tab-pages and normal windows. + You must specify your basetype by using right enum value and must give us a valid name for your + subkey in registry! We support some fix features for some bastypes and user data as string for all! + see also configuration package "org.openoffice.Office.Views/..." for further informations. + + template of configuration: + DialogType + /WindowState [string] + /UserData [set of any scalar types] + TabDialogType + /WindowState [string] + /UserData [set of any scalar types] + /PageID [int] + TabPageType + /WindowState [string] + /UserData [set of any scalar types] + WindowType + /WindowState [string] + /UserData [set of any scalar types] + /Visible [boolean] + + structure of configuration: + + org.openoffice.Office.Views [package] + /Dialogs [set] + /Dialog_FileOpen [DialogType] + /Dialog_ImportGraphics [DialogType] + ... + /Dialog_ [DialogType] + + /TabDialogs [set] + /TabDialog_001 [TabDialogType] + /TabDialog_Blubber [TabDialogType] + ... + /TabDialog_ [TabDialogType] + + /TabPages [set] + /TabPage_XXX [TabPageType] + /TabPage_Date [TabPageType] + ... + /TabPage_ [TabPageType] + + /Windows [set] + /Window_User [WindowType] + /Window_Options [WindowType] + ... + /Window_ [WindowType] + + @implements - + @base - + + @devstatus ready to use +*//*-*************************************************************************************************************/ + +class UNOTOOLS_DLLPUBLIC SvtViewOptions: public utl::detail::Options +{ + /* + #ifdef TF_OLDVIEW + public: + void GetPosition ( sal_Int32& nX , + sal_Int32& nY ) const; + void SetPosition ( sal_Int32 nX , + sal_Int32 nY ); + void GetSize ( sal_Int32& nWidth , + sal_Int32& nHeight ) const; + void SetSize ( sal_Int32 nWidth , + sal_Int32 nHeight ); + ::rtl::OUString GetUserData ( ) const; + void SetUserData ( const ::rtl::OUString& sData ); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > SeperateUserData( const ::rtl::OUString& sData , + sal_Unicode cSeperator=';' ); + static ::rtl::OUString GenerateUserData( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& seqData , + sal_Unicode cSeperator=';' ); + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetAnyData ( ) const; + void SetAnyData ( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lData ); + #endif + */ + + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor and destructor + @descr This will de-/initialize an instance with default values. + You must give us the basic type of your view and a name which specify right entry + in dynamical configuration list. If entry not exist, we create a new one! + + @seealso enum EViewType + + @param "eType" specify type of your view and is used to use right data container! + @param "sViewName" specify the name of your view and is the key name in data list too. + @return - + + @onerror An assertion is thrown in debug version. Otherwise we do nothing! + *//*-*****************************************************************************************************/ + + SvtViewOptions( EViewType eType , + const ::rtl::OUString& sViewName ); + virtual ~SvtViewOptions(); + + /*-****************************************************************************************************//** + @short support preload of these config item + @descr Sometimes we need preloading of these configuration data without real using of it. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + static void AcquireOptions(); + static void ReleaseOptions(); + + //--------------------------------------------------------------------------------------------------------- + // interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short use it to get information about existing entries in configuration + @descr The methods to set/get the position or size will create a new entry automaticly if + it not already exist and work with default values! + If this a problem for you - you MUST call these method before and + you must make up your own mind about that. + + @seealso - + + @onerror No error should occure. + *//*-*****************************************************************************************************/ + + sal_Bool Exists() const; + + /*-****************************************************************************************************//** + @short use it to delete an entry of dynamic view set + @descr You can use this method to delete anexisting node in configuration. + But if you call a Set- or Get- method again on this instance + the item is created again! If you do nothing after this call + your view will die relay in configuration ... + + @seealso method Exist() + + @return True if delete OK, False otherwise. + + @onerror We return sal_False. + *//*-*****************************************************************************************************/ + + sal_Bool Delete(); + + /*-****************************************************************************************************//** + @short use it to set/get the window state of your view + @descr These value describe position/size and some other states of a window. + Use it with right vcl methods directly. Normaly it's not neccessary to + parse given string! + + @seealso vcl methods + + @onerror - + *//*-*****************************************************************************************************/ + + ::rtl::OUString GetWindowState( ) const; + void SetWindowState( const ::rtl::OUString& sState ); + + /*-****************************************************************************************************//** + @short use it to set/get the page number which was the last active one + @descr It's only supported for: - tab-dialogs + If you call it for other ones you will get an assertion in debug version. + In a product version we do nothing! + + @seealso - + + @onerror An assertion is thrown in debug version. Otherwise we do nothing! + *//*-*****************************************************************************************************/ + + sal_Int32 GetPageID( ) const; + void SetPageID( sal_Int32 nID ); + + /*-****************************************************************************************************//** + @short use it to set/get the visual state of a window + @descr It's only supported for: - windows + If you call it for other ones you will get an assertion in debug version. + In a product version we do nothing! + + @seealso - + + @onerror An assertion is thrown in debug version. Otherwise we do nothing! + *//*-*****************************************************************************************************/ + + sal_Bool IsVisible ( ) const; + void SetVisible( sal_Bool bState ); + + /*-****************************************************************************************************//** + @short use it to set/get the extended user data (consisting of a set of named scalar values) + @descr It's supported for ALL types! + Every view can handle its own user defined data set. + + @seealso - + + @onerror In the non-product version, an assertion is made. In a product version, errors are silently ignored. + *//*-*****************************************************************************************************/ +/* +#ifdef TF_OLDVIEW + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetUserData( sal_Bool bMakeItDifferent ) const; +#else +*/ + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetUserData( ) const; +//#endif + void SetUserData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& lData ); + + /*-****************************************************************************************************//** + @short use it to set/get ONE special user data item directly + @descr Normaly you can work on full user data list by using "Set/GetUserData()". + With this function you have an access on special list entries directly without any + + @seealso - + + @onerror In the non-product version, an assertion is made. In a product version, errors are silently ignored. + *//*-*****************************************************************************************************/ + + ::com::sun::star::uno::Any GetUserItem( const ::rtl::OUString& sName ) const; + void SetUserItem( const ::rtl::OUString& sName , + const ::com::sun::star::uno::Any& aValue ); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return a reference to a static mutex + @descr These class is threadsafe. + We create a static mutex only for one time and use it to protect our refcount and container + member! + + @seealso - + + @param - + @return A reference to a static mutex member. + + @onerror - + *//*-*****************************************************************************************************/ + + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + /// specify which list of views in configuration is used! This can't be a static value!!! + /// ... because we need this value to work with right static data container. + EViewType m_eViewType ; + ::rtl::OUString m_sViewName ; + + /// - impl. data container as dynamic pointer for smaller memory requirements! + /// - internal ref count mechanism + + /*Attention + + Don't initialize these static member in these header! + a) Double defined symbols will be detected ... + b) and unresolved externals exist at linking time. + Do it in your source only. + */ + + static SvtViewOptionsBase_Impl* m_pDataContainer_Dialogs ; /// hold data for all dialogs + static sal_Int32 m_nRefCount_Dialogs ; + static SvtViewOptionsBase_Impl* m_pDataContainer_TabDialogs ; /// hold data for all tab-dialogs + static sal_Int32 m_nRefCount_TabDialogs ; + static SvtViewOptionsBase_Impl* m_pDataContainer_TabPages ; /// hold data for all tab-pages + static sal_Int32 m_nRefCount_TabPages ; + static SvtViewOptionsBase_Impl* m_pDataContainer_Windows ; /// hold data for all windows + static sal_Int32 m_nRefCount_Windows ; + +}; // class SvtViewOptions + +#endif // #ifndef INCLUDED_unotools_VIEWOPTIONS_HXX diff --git a/unotools/inc/unotools/workingsetoptions.hxx b/unotools/inc/unotools/workingsetoptions.hxx new file mode 100644 index 000000000000..9a422e25cc32 --- /dev/null +++ b/unotools/inc/unotools/workingsetoptions.hxx @@ -0,0 +1,159 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: workingsetoptions.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_unotools_WORKINGSETOPTIONS_HXX +#define INCLUDED_unotools_WORKINGSETOPTIONS_HXX + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include +#include +#include +#include +#include + +//_________________________________________________________________________________________________________________ +// forward declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short forward declaration to our private date container implementation + @descr We use these class as internal member to support small memory requirements. + You can create the container if it is neccessary. The class which use these mechanism + is faster and smaller then a complete implementation! +*//*-*************************************************************************************************************/ + +class SvtWorkingSetOptions_Impl; + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short collect informations about security features + @descr - + + @implements - + @base - + + @devstatus ready to use +*//*-*************************************************************************************************************/ + +class SvtWorkingSetOptions: public utl::detail::Options +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor and destructor + @descr This will initialize an instance with default values. + We implement these class with a refcount mechanism! Every instance of this class increase it + at create and decrease it at delete time - but all instances use the same data container! + He is implemented as a static member ... + + @seealso member m_nRefCount + @seealso member m_pDataContainer + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + SvtWorkingSetOptions(); + virtual ~SvtWorkingSetOptions(); + + //--------------------------------------------------------------------------------------------------------- + // interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short interface methods to get and set value of config key "org.openoffice.Office.Common/Security/Scripting/SecureURL" + @descr These value defines the editing view for documents and windows, which have to be restored + when restarting StarOffice. The list gets filled, if Save/WorkingSet = true. + + @seealso - + + @param "seqWindowList", new values to set it in configuration. + @return The values which represent current state of internal variable. + + @onerror No error should occurre! + *//*-*****************************************************************************************************/ + + ::com::sun::star::uno::Sequence< ::rtl::OUString > GetWindowList( ) const ; + void SetWindowList( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& seqWindowList ) ; + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short return a reference to a static mutex + @descr These class use his own static mutex to be threadsafe. + We create a static mutex only for one ime and use at different times. + + @seealso - + + @param - + @return A reference to a static mutex member. + + @onerror - + *//*-*****************************************************************************************************/ + + static ::osl::Mutex& GetOwnStaticMutex(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + /*Attention + + Don't initialize these static member in these header! + a) Double dfined symbols will be detected ... + b) and unresolved externals exist at linking time. + Do it in your source only. + */ + + static SvtWorkingSetOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! + static sal_Int32 m_nRefCount ; /// internal ref count mechanism + +}; // class SvtWorkingSetOptions + +#endif // #ifndef INCLUDED_unotools_WORKINGSETOPTIONS_HXX diff --git a/unotools/inc/unotools/xmlaccelcfg.hxx b/unotools/inc/unotools/xmlaccelcfg.hxx new file mode 100644 index 000000000000..8b975f2a26ff --- /dev/null +++ b/unotools/inc/unotools/xmlaccelcfg.hxx @@ -0,0 +1,112 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: xmlaccelcfg.hxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_unotools_XMLACCELCFG_HXX +#define INCLUDED_unotools_XMLACCELCFG_HXX + +#ifndef __COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_ +#include +#endif +#include + +#include + +class OReadAccelatorDocumentHandler : public ::com::sun::star::xml::sax::XDocumentHandler, + public ::cppu::OWeakObject +{ + public: + OReadAccelatorDocumentHandler( SvtAcceleratorItemList& aNewAcceleratorItemList ) : + m_nElementDepth( 0 ), + m_bAcceleratorMode( sal_False ), + m_bItemCloseExpected( sal_False ), + m_xLocator( 0 ), + m_aReadAcceleratorList( aNewAcceleratorItemList ) {} + virtual ~OReadAccelatorDocumentHandler() {} + + // XInterface + virtual void SAL_CALL acquire() throw() + { OWeakObject::acquire(); } + virtual void SAL_CALL release() throw() + { OWeakObject::release(); } + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException ); + + // XDocumentHandler + virtual void SAL_CALL startDocument(void) + throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL endDocument(void) + throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL startElement( + const ::rtl::OUString& aName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs ) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL endElement(const ::rtl::OUString& aName) throw + ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL characters(const ::rtl::OUString& aChars) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL ignorableWhitespace(const ::rtl::OUString& aWhitespaces) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL processingInstruction( const ::rtl::OUString& aTarget, const ::rtl::OUString& aData ) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setDocumentLocator( + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > &xLocator) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + + private: + ::rtl::OUString getErrorLineString(); + + int m_nElementDepth; + sal_Bool m_bAcceleratorMode; + sal_Bool m_bItemCloseExpected; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > m_xLocator; + SvtAcceleratorItemList& m_aReadAcceleratorList; +}; + + +class OWriteAccelatorDocumentHandler +{ + public: + OWriteAccelatorDocumentHandler( + const SvtAcceleratorItemList& aWriteAcceleratorList, + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > ); + virtual ~OWriteAccelatorDocumentHandler(); + + void WriteAcceleratorDocument() throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + + private: + void WriteAcceleratorItem( const SvtAcceleratorConfigItem& aAcceleratorItem ) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xWriteDocumentHandler; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > m_xEmptyList; + ::rtl::OUString m_aAttributeType; + const SvtAcceleratorItemList& m_aWriteAcceleratorList; +}; + +#endif // INCLUDED_unotools_XMLACCELCFG_HXX diff --git a/unotools/source/config/accelcfg.cxx b/unotools/source/config/accelcfg.cxx new file mode 100644 index 000000000000..f911b36e83fe --- /dev/null +++ b/unotools/source/config/accelcfg.cxx @@ -0,0 +1,292 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: accelcfg.cxx,v $ + * $Revision: 1.9 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +#ifndef GCC +#endif +#include "rtl/instance.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include "itemholder1.hxx" + + +using namespace utl; +using namespace rtl; +using namespace com::sun::star::uno; +using namespace com::sun::star::io; +using namespace com::sun::star::xml::sax; + + +static SvtAcceleratorConfig_Impl* pOptions = NULL; +static sal_Int32 nRefCount = 0; + +class SvtAcceleratorConfig_Impl +{ +public: + + SvtAcceleratorItemList aList; + bool bModified; + + SvtAcceleratorConfig_Impl() + : bModified( FALSE ) + {} + + SvtAcceleratorConfig_Impl( Reference< XInputStream >& xInputStream ); + bool Commit( Reference< XOutputStream >& xOutputStream ); +}; + +// ----------------------------------------------------------------------- + +SvtAcceleratorConfig_Impl::SvtAcceleratorConfig_Impl( Reference< XInputStream >& rInputStream ) + : bModified( false ) +{ + Reference< XParser > xParser( ::comphelper::getProcessServiceFactory()->createInstance( + ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Parser" )), + UNO_QUERY); + + // connect stream to input stream to the parser + InputSource aInputSource; + aInputSource.aInputStream = rInputStream; + + // get filter + Reference< XDocumentHandler > xFilter( new OReadAccelatorDocumentHandler( aList )); + + // connect parser and filter + xParser->setDocumentHandler( xFilter ); + xParser->parseStream( aInputSource ); +} + +bool SvtAcceleratorConfig_Impl::Commit( Reference< XOutputStream >& rOutputStream ) +{ + Reference< XDocumentHandler > xWriter; + + xWriter = Reference< XDocumentHandler >( ::comphelper::getProcessServiceFactory()->createInstance( + ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Writer" )), UNO_QUERY) ; + + Reference< ::com::sun::star::io::XActiveDataSource> xDataSource( xWriter , UNO_QUERY ); + xDataSource->setOutputStream( rOutputStream ); + try + { + OWriteAccelatorDocumentHandler aWriteHandler( aList, xWriter ); + aWriteHandler.WriteAcceleratorDocument(); + rOutputStream->flush(); + return true; + } + catch ( RuntimeException& ) + { + } + catch ( SAXException& ) + { + } + catch ( ::com::sun::star::io::IOException& ) + { + } + + return false; +} + +namespace +{ + class LocalSingleton : public rtl::Static< osl::Mutex, LocalSingleton > + { + }; +} + +SvtAcceleratorConfiguration::SvtAcceleratorConfiguration() +{ + // Global access, must be guarded (multithreading) + ::osl::MutexGuard aGuard( LocalSingleton::get() ); + if ( !pOptions ) + { + SvStream* pStream = GetDefaultStream( STREAM_STD_READ ); + ::utl::OInputStreamWrapper aHelper( *pStream ); + com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream > xOut( &aHelper ); + + try + { + pOptions = new SvtAcceleratorConfig_Impl( xOut ); + } + catch ( RuntimeException& ) + { + pOptions = new SvtAcceleratorConfig_Impl(); + } + catch( SAXException& ) + { + pOptions = new SvtAcceleratorConfig_Impl(); + } + catch( ::com::sun::star::io::IOException& ) + { + pOptions = new SvtAcceleratorConfig_Impl(); + } + + if (pOptions) + ItemHolder1::holdConfigItem(E_ACCELCFG); + + delete pStream; + } + + ++nRefCount; + pImp = pOptions; +} + +SvtAcceleratorConfiguration* SvtAcceleratorConfiguration::CreateFromStream( SvStream& rStream ) +{ + SvtAcceleratorConfiguration* pRet = new SvtAcceleratorConfiguration; + ::utl::OInputStreamWrapper aHelper( rStream ); + com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream > xOut( &aHelper ); + try + { + pRet->pImp = new SvtAcceleratorConfig_Impl( xOut ); + } + catch ( RuntimeException& ) + { + DELETEZ( pRet ); + } + catch( SAXException& ) + { + DELETEZ( pRet ); + } + catch( ::com::sun::star::io::IOException& ) + { + DELETEZ( pRet ); + } + + return pRet; +} + +// ----------------------------------------------------------------------- + +SvtAcceleratorConfiguration::~SvtAcceleratorConfiguration() +{ + if ( pImp == pOptions ) + { + // Global access, must be guarded (multithreading) + ::osl::MutexGuard aGuard( LocalSingleton::get() ); + if ( !--nRefCount ) + { + if ( pImp->bModified ) + { + String aUserConfig = SvtPathOptions().GetUserConfigPath(); + INetURLObject aObj( aUserConfig ); + aObj.insertName( String::CreateFromAscii("GlobalKeyBindings.xml") ); + SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( aObj.GetMainURL( INetURLObject::NO_DECODE ), STREAM_STD_READWRITE|STREAM_TRUNC ); + ::utl::OOutputStreamWrapper aHelper( *pStream ); + com::sun::star::uno::Reference < ::com::sun::star::io::XOutputStream > xOut( &aHelper ); + pImp->Commit( xOut ); + delete pStream; + } + + DELETEZ( pOptions ); + } + } + else + { + delete pImp; + } +} + +::rtl::OUString SvtAcceleratorConfiguration::GetCommand( const ::com::sun::star::awt::KeyEvent& rKeyEvent ) +{ + sal_Int16 nCode=rKeyEvent.KeyCode, nModifier=rKeyEvent.Modifiers; + if ( !nCode ) + nCode = rKeyEvent.KeyFunc; + + std::list< SvtAcceleratorConfigItem>::const_iterator p; + for ( p = pImp->aList.begin(); p != pImp->aList.end(); p++ ) + if ( p->nCode == nCode && p->nModifier == nModifier ) + return p->aCommand; + + return ::rtl::OUString(); +} + +const SvtAcceleratorItemList& SvtAcceleratorConfiguration::GetItems() +{ + return pImp->aList; +} + +void SvtAcceleratorConfiguration::SetCommand( const SvtAcceleratorConfigItem& rItem ) +{ + std::list< SvtAcceleratorConfigItem>::iterator p; + for ( p = pImp->aList.begin(); p != pImp->aList.end(); p++ ) + if ( p->nCode == rItem.nCode && p->nModifier == rItem.nModifier ) + { + p->aCommand = rItem.aCommand; + return; + } + + pImp->aList.push_back( rItem ); + +} + +void SvtAcceleratorConfiguration::SetItems( const SvtAcceleratorItemList& rItems, bool bClear ) +{ + if ( bClear ) + { + pImp->aList = rItems; + } + else + { + std::list< SvtAcceleratorConfigItem>::const_iterator p; + for ( p = rItems.begin(); p != rItems.end(); p++ ) + SetCommand( *p ); + } +} + +String SvtAcceleratorConfiguration::GetStreamName() +{ + return String::CreateFromAscii("KeyBindings.xml"); +} + +SvStream* SvtAcceleratorConfiguration::GetDefaultStream( StreamMode nMode ) +{ + String aUserConfig = SvtPathOptions().GetUserConfigPath(); + INetURLObject aObj( aUserConfig ); + aObj.insertName( GetStreamName() ); + return ::utl::UcbStreamHelper::CreateStream( aObj.GetMainURL( INetURLObject::NO_DECODE ), nMode ); +} diff --git a/unotools/source/config/cacheoptions.cxx b/unotools/source/config/cacheoptions.cxx new file mode 100644 index 000000000000..c226e8b80921 --- /dev/null +++ b/unotools/source/config/cacheoptions.cxx @@ -0,0 +1,510 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: cacheoptions.cxx,v $ + * $Revision: 1.8 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +#ifndef GCC +#endif + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include +#include +#include +#include +#include +#include + +//_________________________________________________________________________________________________________________ +// namespaces +//_________________________________________________________________________________________________________________ + +using namespace ::utl; +using namespace ::rtl; +using namespace ::osl; +using namespace ::com::sun::star::uno; + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +#define ROOTNODE_START OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Cache" )) +#define DEFAULT_WRITEROLE 20 +#define DEFAULT_DRAWINGOLE 20 +#define DEFAULT_GRFMGR_TOTALSIZE 10000000 +#define DEFAULT_GRFMGR_OBJECTSIZE 2400000 +#define DEFAULT_GRFMGR_OBJECTRELEASE 600 + +#define PROPERTYNAME_WRITEROLE OUString(RTL_CONSTASCII_USTRINGPARAM("Writer/OLE_Objects")) +#define PROPERTYNAME_DRAWINGOLE OUString(RTL_CONSTASCII_USTRINGPARAM("DrawingEngine/OLE_Objects")) +#define PROPERTYNAME_GRFMGR_TOTALSIZE OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicManager/TotalCacheSize")) +#define PROPERTYNAME_GRFMGR_OBJECTSIZE OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicManager/ObjectCacheSize")) +#define PROPERTYNAME_GRFMGR_OBJECTRELEASE OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicManager/ObjectReleaseTime")) + +#define PROPERTYHANDLE_WRITEROLE 0 +#define PROPERTYHANDLE_DRAWINGOLE 1 +#define PROPERTYHANDLE_GRFMGR_TOTALSIZE 2 +#define PROPERTYHANDLE_GRFMGR_OBJECTSIZE 3 +#define PROPERTYHANDLE_GRFMGR_OBJECTRELEASE 4 + +#define PROPERTYCOUNT 5 + +class SvtCacheOptions_Impl : public ConfigItem +{ +public: + +//--------------------------------------------------------------------------------------------------------- +// constructor / destructor +//--------------------------------------------------------------------------------------------------------- + + SvtCacheOptions_Impl(); + ~SvtCacheOptions_Impl(); + +//--------------------------------------------------------------------------------------------------------- +// overloaded methods of baseclass +//--------------------------------------------------------------------------------------------------------- + + virtual void Commit(); + +//--------------------------------------------------------------------------------------------------------- +// public interface +//--------------------------------------------------------------------------------------------------------- + + sal_Int32 GetWriterOLE_Objects() const; + sal_Int32 GetDrawingEngineOLE_Objects() const; + sal_Int32 GetGraphicManagerTotalCacheSize() const; + sal_Int32 GetGraphicManagerObjectCacheSize() const; + sal_Int32 GetGraphicManagerObjectReleaseTime() const; + + void SetWriterOLE_Objects( sal_Int32 nObjects ); + void SetDrawingEngineOLE_Objects( sal_Int32 nObjects ); + void SetGraphicManagerTotalCacheSize( sal_Int32 nTotalCacheSize ); + void SetGraphicManagerObjectCacheSize( sal_Int32 nObjectCacheSize ); + void SetGraphicManagerObjectReleaseTime( sal_Int32 nReleaseTimeSeconds ); + +//------------------------------------------------------------------------------------------------------------- +// private methods +//------------------------------------------------------------------------------------------------------------- + +private: + + static Sequence< OUString > impl_GetPropertyNames(); + +//------------------------------------------------------------------------------------------------------------- +// private member +//------------------------------------------------------------------------------------------------------------- + +private: + + sal_Int32 mnWriterOLE; + sal_Int32 mnDrawingOLE; + sal_Int32 mnGrfMgrTotalSize; + sal_Int32 mnGrfMgrObjectSize; + sal_Int32 mnGrfMgrObjectRelease; +}; + +//_________________________________________________________________________________________________________________ +// definitions +//_________________________________________________________________________________________________________________ + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtCacheOptions_Impl::SvtCacheOptions_Impl() : + ConfigItem( ROOTNODE_START ), + mnWriterOLE( DEFAULT_WRITEROLE ), + mnDrawingOLE( DEFAULT_DRAWINGOLE ), + mnGrfMgrTotalSize( DEFAULT_GRFMGR_TOTALSIZE ), + mnGrfMgrObjectSize( DEFAULT_GRFMGR_OBJECTSIZE ), + mnGrfMgrObjectRelease( DEFAULT_GRFMGR_OBJECTRELEASE ) +{ + Sequence< OUString > seqNames( impl_GetPropertyNames() ); + Sequence< Any > seqValues = GetProperties( seqNames ) ; + + DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtCacheOptions_Impl::SvtCacheOptions_Impl()\nI miss some values of configuration keys!\n" ); + + // Copy values from list in right order to ouer internal member. + sal_Int32 nPropertyCount = seqValues.getLength(); + sal_Int32 nProperty = 0; + + for( nProperty=0; nProperty>= mnWriterOLE; + } + break; + + case PROPERTYHANDLE_DRAWINGOLE: + { + if( seqValues[ nProperty ].getValueTypeClass() == TypeClass_LONG ) + seqValues[nProperty] >>= mnDrawingOLE; + } + break; + + case PROPERTYHANDLE_GRFMGR_TOTALSIZE: + { + if( seqValues[ nProperty ].getValueTypeClass() == TypeClass_LONG ) + seqValues[nProperty] >>= mnGrfMgrTotalSize; + } + break; + + case PROPERTYHANDLE_GRFMGR_OBJECTSIZE: + { + if( seqValues[ nProperty ].getValueTypeClass() == TypeClass_LONG ) + seqValues[nProperty] >>= mnGrfMgrObjectSize; + } + break; + + case PROPERTYHANDLE_GRFMGR_OBJECTRELEASE: + { + if( seqValues[ nProperty ].getValueTypeClass() == TypeClass_LONG ) + seqValues[nProperty] >>= mnGrfMgrObjectRelease; + } + break; + } + } + } +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtCacheOptions_Impl::~SvtCacheOptions_Impl() +{ + if( IsModified() ) + Commit(); +} + +//***************************************************************************************************************** +// Commit +//***************************************************************************************************************** +void SvtCacheOptions_Impl::Commit() +{ + Sequence< OUString > aSeqNames( impl_GetPropertyNames() ); + Sequence< Any > aSeqValues( aSeqNames.getLength() ); + + for( sal_Int32 nProperty = 0, nCount = aSeqNames.getLength(); nProperty < nCount; ++nProperty ) + { + switch( nProperty ) + { + case PROPERTYHANDLE_WRITEROLE: + aSeqValues[nProperty] <<= mnWriterOLE; + break; + + case PROPERTYHANDLE_DRAWINGOLE: + aSeqValues[nProperty] <<= mnDrawingOLE; + break; + + case PROPERTYHANDLE_GRFMGR_TOTALSIZE: + aSeqValues[nProperty] <<= mnGrfMgrTotalSize; + break; + + case PROPERTYHANDLE_GRFMGR_OBJECTSIZE: + aSeqValues[nProperty] <<= mnGrfMgrObjectSize; + break; + + case PROPERTYHANDLE_GRFMGR_OBJECTRELEASE: + aSeqValues[nProperty] <<= mnGrfMgrObjectRelease; + break; + } + } + + PutProperties( aSeqNames, aSeqValues ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Int32 SvtCacheOptions_Impl::GetWriterOLE_Objects() const +{ + return mnWriterOLE; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Int32 SvtCacheOptions_Impl::GetDrawingEngineOLE_Objects() const +{ + return mnDrawingOLE; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Int32 SvtCacheOptions_Impl::GetGraphicManagerTotalCacheSize() const +{ + return mnGrfMgrTotalSize; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Int32 SvtCacheOptions_Impl::GetGraphicManagerObjectCacheSize() const +{ + return mnGrfMgrObjectSize; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Int32 SvtCacheOptions_Impl::GetGraphicManagerObjectReleaseTime() const +{ + return mnGrfMgrObjectRelease; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtCacheOptions_Impl::SetWriterOLE_Objects( sal_Int32 nWriterOLE ) +{ + mnWriterOLE = nWriterOLE; + SetModified(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtCacheOptions_Impl::SetDrawingEngineOLE_Objects( sal_Int32 nDrawingOLE ) +{ + mnDrawingOLE = nDrawingOLE; + SetModified(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtCacheOptions_Impl::SetGraphicManagerTotalCacheSize( sal_Int32 nGrfMgrTotalSize ) +{ + mnGrfMgrTotalSize = nGrfMgrTotalSize; + SetModified(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtCacheOptions_Impl::SetGraphicManagerObjectCacheSize( sal_Int32 nGrfMgrObjectSize ) +{ + mnGrfMgrObjectSize = nGrfMgrObjectSize; + SetModified(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtCacheOptions_Impl::SetGraphicManagerObjectReleaseTime( sal_Int32 nGrfMgrObjectReleaseTime ) +{ + mnGrfMgrObjectRelease = nGrfMgrObjectReleaseTime; + SetModified(); +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Sequence< OUString > SvtCacheOptions_Impl::impl_GetPropertyNames() +{ + // Build static list of configuration key names. + static const OUString pProperties[] = + { + PROPERTYNAME_WRITEROLE, + PROPERTYNAME_DRAWINGOLE, + PROPERTYNAME_GRFMGR_TOTALSIZE, + PROPERTYNAME_GRFMGR_OBJECTSIZE, + PROPERTYNAME_GRFMGR_OBJECTRELEASE + }; + // Initialize return sequence with these list ... + static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + // ... and return it. + return seqPropertyNames; +} + +//***************************************************************************************************************** +// initialize static member +// DON'T DO IT IN YOUR HEADER! +// see definition for further informations +//***************************************************************************************************************** +SvtCacheOptions_Impl* SvtCacheOptions::m_pDataContainer = NULL; +sal_Int32 SvtCacheOptions::m_nRefCount = 0; + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtCacheOptions::SvtCacheOptions() +{ + // Global access, must be guarded (multithreading!). + MutexGuard aGuard( GetOwnStaticMutex() ); + // Increase ouer refcount ... + ++m_nRefCount; + // ... and initialize ouer data container only if it not already! + if( m_pDataContainer == NULL ) + { + m_pDataContainer = new SvtCacheOptions_Impl(); + } +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtCacheOptions::~SvtCacheOptions() +{ + // Global access, must be guarded (multithreading!) + MutexGuard aGuard( GetOwnStaticMutex() ); + // Decrease ouer refcount. + --m_nRefCount; + // If last instance was deleted ... + // we must destroy ouer static data container! + if( m_nRefCount <= 0 ) + { + delete m_pDataContainer; + m_pDataContainer = NULL; + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Int32 SvtCacheOptions::GetWriterOLE_Objects() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetWriterOLE_Objects(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Int32 SvtCacheOptions::GetDrawingEngineOLE_Objects() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetDrawingEngineOLE_Objects(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Int32 SvtCacheOptions::GetGraphicManagerTotalCacheSize() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetGraphicManagerTotalCacheSize(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Int32 SvtCacheOptions::GetGraphicManagerObjectCacheSize() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetGraphicManagerObjectCacheSize(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Int32 SvtCacheOptions::GetGraphicManagerObjectReleaseTime() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetGraphicManagerObjectReleaseTime(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtCacheOptions::SetWriterOLE_Objects( sal_Int32 nWriterOLE ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetWriterOLE_Objects( nWriterOLE ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtCacheOptions::SetDrawingEngineOLE_Objects( sal_Int32 nDrawingOLE ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetDrawingEngineOLE_Objects( nDrawingOLE ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtCacheOptions::SetGraphicManagerTotalCacheSize( sal_Int32 nGrfMgrTotalSize ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetGraphicManagerTotalCacheSize( nGrfMgrTotalSize ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtCacheOptions::SetGraphicManagerObjectCacheSize( sal_Int32 nGrfMgrObjectSize ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetGraphicManagerObjectCacheSize( nGrfMgrObjectSize ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtCacheOptions::SetGraphicManagerObjectReleaseTime( sal_Int32 nGrfMgrObjectReleaseTime ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetGraphicManagerObjectReleaseTime( nGrfMgrObjectReleaseTime ); +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Mutex& SvtCacheOptions::GetOwnStaticMutex() +{ + // Initialize static mutex only for one time! + static Mutex* pMutex = NULL; + // If these method first called (Mutex not already exist!) ... + if( pMutex == NULL ) + { + // ... we must create a new one. Protect follow code with the global mutex - + // It must be - we create a static variable! + MutexGuard aGuard( Mutex::getGlobalMutex() ); + // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! + if( pMutex == NULL ) + { + // Create the new mutex and set it for return on static variable. + static Mutex aMutex; + pMutex = &aMutex; + } + } + // Return new created or already existing mutex object. + return *pMutex; +} diff --git a/unotools/source/config/cmdoptions.cxx b/unotools/source/config/cmdoptions.cxx new file mode 100644 index 000000000000..421b201d98c0 --- /dev/null +++ b/unotools/source/config/cmdoptions.cxx @@ -0,0 +1,631 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: cmdoptions.cxx,v $ + * $Revision: 1.11 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +//_________________________________________________________________________________________________________________ +// namespaces +//_________________________________________________________________________________________________________________ + +using namespace ::std ; +using namespace ::utl ; +using namespace ::rtl ; +using namespace ::osl ; +using namespace ::com::sun::star::uno ; +using namespace ::com::sun::star::beans ; + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +#define ROOTNODE_CMDOPTIONS OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Commands/Execute" )) +#define PATHDELIMITER OUString(RTL_CONSTASCII_USTRINGPARAM("/" )) + +#define SETNODE_DISABLED OUString(RTL_CONSTASCII_USTRINGPARAM("Disabled" )) + +#define PROPERTYNAME_CMD OUString(RTL_CONSTASCII_USTRINGPARAM("Command" )) + +#define PROPERTYCOUNT 1 + +#define OFFSET_CMD 0 + +//_________________________________________________________________________________________________________________ +// private declarations! +//_________________________________________________________________________________________________________________ + +// Method to retrieve a hash code from a string. May be we have to change it to decrease collisions in the hash map +struct OUStringHashCode +{ + size_t operator()( const ::rtl::OUString& sString ) const + { + return sString.hashCode(); + } +}; + +/*-**************************************************************************************************************** + @descr support simple command option structures and operations on it +****************************************************************************************************************-*/ +class SvtCmdOptions +{ + public: + //--------------------------------------------------------------------------------------------------------- + // the only way to free memory! + void Clear() + { + m_aCommandHashMap.clear(); + } + + sal_Bool HasEntries() const + { + return ( m_aCommandHashMap.size() > 0 ); + } + + void SetContainerSize( sal_Int32 nSize ) + { + m_aCommandHashMap.resize( nSize ); + } + + sal_Bool Lookup( const OUString& aCmd ) const + { + CommandHashMap::const_iterator pEntry = m_aCommandHashMap.find( aCmd ); + return ( pEntry != m_aCommandHashMap.end() ); + } + + void AddCommand( const OUString& aCmd ) + { + m_aCommandHashMap.insert( CommandHashMap::value_type( aCmd, 0 ) ); + } + + //--------------------------------------------------------------------------------------------------------- + // convert internal list to external format + // for using it on right menus realy + // Notice: We build a property list with 4 entries and set it on result list then. + // The while-loop starts with pointer on internal member list lSetupEntries, change to + // lUserEntries then and stop after that with NULL! + // Separator entries will be packed in another way then normal entries! We define + // special strings "sEmpty" and "sSeperator" to perform too ... + Sequence< OUString > GetList() const + { + sal_Int32 nCount = (sal_Int32)m_aCommandHashMap.size(); + sal_Int32 nIndex = 0; + Sequence< OUString > aList( nCount ); + + CommandHashMap::const_iterator pEntry = m_aCommandHashMap.begin(); + while ( pEntry != m_aCommandHashMap.end() ) + aList[nIndex++] = pEntry->first; + + return aList; + } + + private: + class CommandHashMap : public ::std::hash_map< ::rtl::OUString , + sal_Int32 , + OUStringHashCode , + ::std::equal_to< ::rtl::OUString > > + { + public: + inline void free() + { + CommandHashMap().swap( *this ); + } + }; + + CommandHashMap m_aCommandHashMap; +}; + +typedef ::std::vector< ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XFrame > > SvtFrameVector; + +class SvtCommandOptions_Impl : public ConfigItem +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + SvtCommandOptions_Impl(); + ~SvtCommandOptions_Impl(); + + //--------------------------------------------------------------------------------------------------------- + // overloaded methods of baseclass + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short called for notify of configmanager + @descr These method is called from the ConfigManager before application ends or from the + PropertyChangeListener if the sub tree broadcasts changes. You must update your + internal values. + + @seealso baseclass ConfigItem + + @param "lPropertyNames" is the list of properties which should be updated. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void Notify( const Sequence< OUString >& lPropertyNames ); + + /*-****************************************************************************************************//** + @short write changes to configuration + @descr These method writes the changed values into the sub tree + and should always called in our destructor to guarantee consistency of config data. + + @seealso baseclass ConfigItem + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void Commit(); + + //--------------------------------------------------------------------------------------------------------- + // public interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short base implementation of public interface for "SvtDynamicMenuOptions"! + @descr These class is used as static member of "SvtDynamicMenuOptions" ... + => The code exist only for one time and isn't duplicated for every instance! + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void Clear ( SvtCommandOptions::CmdOption eCmdOption ); + sal_Bool HasEntries ( SvtCommandOptions::CmdOption eOption ) const; + sal_Bool Lookup ( SvtCommandOptions::CmdOption eCmdOption, const OUString& ) const; + Sequence< OUString > GetList ( SvtCommandOptions::CmdOption eCmdOption ) const ; + void AddCommand ( SvtCommandOptions::CmdOption eCmdOption, + const OUString& sURL ); + void EstablisFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return list of key names of our configuration management which represent oue module tree + @descr These methods return the current list of key names! We need it to get needed values from our + configuration management and support dynamical menu item lists! + + @seealso - + + @param "nDisabledCount" , returns count of menu entries for "new" + @return A list of configuration key names is returned. + + @onerror - + *//*-*****************************************************************************************************/ + + Sequence< OUString > impl_GetPropertyNames(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + SvtCmdOptions m_aDisabledCommands; + SvtFrameVector m_lFrames; +}; + +//_________________________________________________________________________________________________________________ +// definitions +//_________________________________________________________________________________________________________________ + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtCommandOptions_Impl::SvtCommandOptions_Impl() + // Init baseclasses first + : ConfigItem( ROOTNODE_CMDOPTIONS ) + // Init member then... +{ + // Get names and values of all accessable menu entries and fill internal structures. + // See impl_GetPropertyNames() for further informations. + Sequence< OUString > lNames = impl_GetPropertyNames (); + Sequence< Any > lValues = GetProperties ( lNames ); + + // Safe impossible cases. + // We need values from ALL configuration keys. + // Follow assignment use order of values in relation to our list of key names! + DBG_ASSERT( !(lNames.getLength()!=lValues.getLength()), "SvtCommandOptions_Impl::SvtCommandOptions_Impl()\nI miss some values of configuration keys!\n" ); + + // Copy values from list in right order to ouer internal member. + // Attention: List for names and values have an internal construction pattern! + sal_Int32 nItem = 0 ; + OUString sCmd ; + + // Set size of hash_map reach a used size of approx. 60% + m_aDisabledCommands.SetContainerSize( lNames.getLength() * 10 / 6 ); + + // Get names/values for disabled commands. + for( nItem=0; nItem < lNames.getLength(); ++nItem ) + { + // Currently only one value + lValues[nItem] >>= sCmd; + m_aDisabledCommands.AddCommand( sCmd ); + } + +/*TODO: Not used in the moment! see Notify() ... + // Enable notification mechanism of ouer baseclass. + // We need it to get information about changes outside these class on ouer used configuration keys! */ + Sequence< OUString > aNotifySeq( 1 ); + aNotifySeq[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "Disabled" )); + EnableNotification( aNotifySeq, sal_True ); +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtCommandOptions_Impl::~SvtCommandOptions_Impl() +{ + // We must save our current values .. if user forget it! + if( IsModified() == sal_True ) + { + Commit(); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtCommandOptions_Impl::Notify( const Sequence< OUString >& ) +{ + MutexGuard aGuard( SvtCommandOptions::GetOwnStaticMutex() ); + + Sequence< OUString > lNames = impl_GetPropertyNames (); + Sequence< Any > lValues = GetProperties ( lNames ); + + // Safe impossible cases. + // We need values from ALL configuration keys. + // Follow assignment use order of values in relation to our list of key names! + DBG_ASSERT( !(lNames.getLength()!=lValues.getLength()), "SvtCommandOptions_Impl::SvtCommandOptions_Impl()\nI miss some values of configuration keys!\n" ); + + // Copy values from list in right order to ouer internal member. + // Attention: List for names and values have an internal construction pattern! + sal_Int32 nItem = 0 ; + OUString sCmd ; + + // Set size of hash_map reach a used size of approx. 60% + m_aDisabledCommands.Clear(); + m_aDisabledCommands.SetContainerSize( lNames.getLength() * 10 / 6 ); + + // Get names/values for disabled commands. + for( nItem=0; nItem < lNames.getLength(); ++nItem ) + { + // Currently only one value + lValues[nItem] >>= sCmd; + m_aDisabledCommands.AddCommand( sCmd ); + } + + // dont forget to update all existing frames and her might cached dispatch objects! + // But look for already killed frames. We hold weak references instead of hard ones ... + for (SvtFrameVector::const_iterator pIt = m_lFrames.begin(); + pIt != m_lFrames.end() ; + ++pIt ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame(pIt->get(), ::com::sun::star::uno::UNO_QUERY); + if (xFrame.is()) + xFrame->contextChanged(); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtCommandOptions_Impl::Commit() +{ + DBG_ERROR( "SvtCommandOptions_Impl::Commit()\nNot implemented yet!\n" ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtCommandOptions_Impl::Clear( SvtCommandOptions::CmdOption eCmdOption ) +{ + switch( eCmdOption ) + { + case SvtCommandOptions::CMDOPTION_DISABLED: + { + m_aDisabledCommands.Clear(); + SetModified(); + } + break; + + default: + DBG_ASSERT( sal_False, "SvtCommandOptions_Impl::Clear()\nUnknown option type given!\n" ); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtCommandOptions_Impl::HasEntries( SvtCommandOptions::CmdOption eOption ) const +{ + if ( eOption == SvtCommandOptions::CMDOPTION_DISABLED ) + return ( m_aDisabledCommands.HasEntries() > 0 ); + else + return sal_False; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +Sequence< OUString > SvtCommandOptions_Impl::GetList( SvtCommandOptions::CmdOption eCmdOption ) const +{ + Sequence< OUString > lReturn; + + switch( eCmdOption ) + { + case SvtCommandOptions::CMDOPTION_DISABLED: + { + lReturn = m_aDisabledCommands.GetList(); + } + break; + + default: + DBG_ASSERT( sal_False, "SvtCommandOptions_Impl::GetList()\nUnknown option type given!\n" ); + } + + return lReturn; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtCommandOptions_Impl::Lookup( SvtCommandOptions::CmdOption eCmdOption, const OUString& aCommand ) const +{ + switch( eCmdOption ) + { + case SvtCommandOptions::CMDOPTION_DISABLED: + { + return m_aDisabledCommands.Lookup( aCommand ); + } + default: + DBG_ASSERT( sal_False, "SvtCommandOptions_Impl::GetList()\nUnknown option type given!\n" ); + } + + return sal_False; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtCommandOptions_Impl::AddCommand( SvtCommandOptions::CmdOption eCmdOption, const OUString& sCmd ) +{ + switch( eCmdOption ) + { + case SvtCommandOptions::CMDOPTION_DISABLED: + { + m_aDisabledCommands.AddCommand( sCmd ); + SetModified(); + } + break; + + default: + DBG_ASSERT( sal_False, "SvtCommandOptions_Impl::GetList()\nUnknown option type given!\n" ); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtCommandOptions_Impl::EstablisFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame) +{ + // check if frame already exists inside list + // ignore double registrations + // every frame must be notified one times only! + ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XFrame > xWeak(xFrame); + SvtFrameVector::const_iterator pIt = ::std::find(m_lFrames.begin(), m_lFrames.end(), xWeak); + if (pIt == m_lFrames.end()) + m_lFrames.push_back(xWeak); +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Sequence< OUString > SvtCommandOptions_Impl::impl_GetPropertyNames() +{ + // First get ALL names of current existing list items in configuration! + Sequence< OUString > lDisabledItems = GetNodeNames( SETNODE_DISABLED, utl::CONFIG_NAME_LOCAL_PATH ); + + OUString aSetNode( SETNODE_DISABLED ); + aSetNode += PATHDELIMITER; + + OUString aCommandKey( PATHDELIMITER ); + aCommandKey += PROPERTYNAME_CMD; + + // Expand all keys + for (sal_Int32 i=0; iClear( eCmdOption ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtCommandOptions::HasEntries( CmdOption eOption ) const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->HasEntries( eOption ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtCommandOptions::Lookup( CmdOption eCmdOption, const OUString& aCommandURL ) const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->Lookup( eCmdOption, aCommandURL ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +Sequence< OUString > SvtCommandOptions::GetList( CmdOption eCmdOption ) const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetList( eCmdOption ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtCommandOptions::AddCommand( CmdOption eCmdOption, const OUString& sURL ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->AddCommand( eCmdOption, sURL ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtCommandOptions::EstablisFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->EstablisFrameCallback(xFrame); +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Mutex& SvtCommandOptions::GetOwnStaticMutex() +{ + // Initialize static mutex only for one time! + static Mutex* pMutex = NULL; + // If these method first called (Mutex not already exist!) ... + if( pMutex == NULL ) + { + // ... we must create a new one. Protect follow code with the global mutex - + // It must be - we create a static variable! + MutexGuard aGuard( Mutex::getGlobalMutex() ); + // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! + if( pMutex == NULL ) + { + // Create the new mutex and set it for return on static variable. + static Mutex aMutex; + pMutex = &aMutex; + } + } + // Return new created or already existing mutex object. + return *pMutex; +} diff --git a/unotools/source/config/compatibility.cxx b/unotools/source/config/compatibility.cxx new file mode 100644 index 000000000000..46967eb7b43d --- /dev/null +++ b/unotools/source/config/compatibility.cxx @@ -0,0 +1,807 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: compatibility.cxx,v $ + * $Revision: 1.16 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include +#include +#include +#include +#include +#include + +#ifndef __SGI_STL_VECTOR +#include +#endif + +#include + +#include + +//_________________________________________________________________________________________________________________ +// namespaces +//_________________________________________________________________________________________________________________ + +using namespace ::std; +using namespace ::utl; +using namespace ::rtl; +using namespace ::osl; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +#define ROOTNODE_OPTIONS OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.Compatibility/" ) ) +#define PATHDELIMITER OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) ) +#define SETNODE_ALLFILEFORMATS OUString( RTL_CONSTASCII_USTRINGPARAM( "AllFileFormats" ) ) + +#define PROPERTYNAME_NAME COMPATIBILITY_PROPERTYNAME_NAME +#define PROPERTYNAME_MODULE COMPATIBILITY_PROPERTYNAME_MODULE +#define PROPERTYNAME_USEPRTMETRICS COMPATIBILITY_PROPERTYNAME_USEPRTMETRICS +#define PROPERTYNAME_ADDSPACING COMPATIBILITY_PROPERTYNAME_ADDSPACING +#define PROPERTYNAME_ADDSPACINGATPAGES COMPATIBILITY_PROPERTYNAME_ADDSPACINGATPAGES +#define PROPERTYNAME_USEOURTABSTOPS COMPATIBILITY_PROPERTYNAME_USEOURTABSTOPS +#define PROPERTYNAME_NOEXTLEADING COMPATIBILITY_PROPERTYNAME_NOEXTLEADING +#define PROPERTYNAME_USELINESPACING COMPATIBILITY_PROPERTYNAME_USELINESPACING +#define PROPERTYNAME_ADDTABLESPACING COMPATIBILITY_PROPERTYNAME_ADDTABLESPACING +#define PROPERTYNAME_USEOBJPOS COMPATIBILITY_PROPERTYNAME_USEOBJECTPOSITIONING +#define PROPERTYNAME_USEOURTEXTWRAP COMPATIBILITY_PROPERTYNAME_USEOURTEXTWRAPPING +#define PROPERTYNAME_CONSIDERWRAPSTYLE COMPATIBILITY_PROPERTYNAME_CONSIDERWRAPPINGSTYLE +#define PROPERTYNAME_EXPANDWORDSPACE COMPATIBILITY_PROPERTYNAME_EXPANDWORDSPACE + +#define PROPERTYCOUNT 13 + +#define OFFSET_NAME 0 +#define OFFSET_MODULE 1 +#define OFFSET_USEPRTMETRICS 2 +#define OFFSET_ADDSPACING 3 +#define OFFSET_ADDSPACINGATPAGES 4 +#define OFFSET_USEOURTABSTOPS 5 +#define OFFSET_NOEXTLEADING 6 +#define OFFSET_USELINESPACING 7 +#define OFFSET_ADDTABLESPACING 8 +#define OFFSET_USEOBJPOS 9 +#define OFFSET_USEOURTEXTWRAPPING 10 +#define OFFSET_CONSIDERWRAPPINGSTYLE 11 +#define OFFSET_EXPANDWORDSPACE 12 + +//_________________________________________________________________________________________________________________ +// private declarations! +//_________________________________________________________________________________________________________________ + +/*-**************************************************************************************************************** + @descr struct to hold information about one compatibility entry +****************************************************************************************************************-*/ +struct SvtCompatibilityEntry +{ + public: + SvtCompatibilityEntry() : + bUsePrtMetrics( false ), bAddSpacing( false ), + bAddSpacingAtPages( false ), bUseOurTabStops( false ), + bNoExtLeading( false ), bUseLineSpacing( false ), + bAddTableSpacing( false ), bUseObjPos( false ), + bUseOurTextWrapping( false ), bConsiderWrappingStyle( false ), + bExpandWordSpace( true ) {} + SvtCompatibilityEntry( + const OUString& _rName, const OUString& _rNewModule ) : + sName( _rName ), sModule( _rNewModule ), + bUsePrtMetrics( false ), bAddSpacing( false ), + bAddSpacingAtPages( false ), bUseOurTabStops( false ), + bNoExtLeading( false ), bUseLineSpacing( false ), + bAddTableSpacing( false ), bUseObjPos( false ), + bUseOurTextWrapping( false ), bConsiderWrappingStyle( false ), + bExpandWordSpace( true ) {} + + inline void SetUsePrtMetrics( bool _bSet ) { bUsePrtMetrics = _bSet; } + inline void SetAddSpacing( bool _bSet ) { bAddSpacing = _bSet; } + inline void SetAddSpacingAtPages( bool _bSet ) { bAddSpacingAtPages = _bSet; } + inline void SetUseOurTabStops( bool _bSet ) { bUseOurTabStops = _bSet; } + inline void SetNoExtLeading( bool _bSet ) { bNoExtLeading = _bSet; } + inline void SetUseLineSpacing( bool _bSet ) { bUseLineSpacing = _bSet; } + inline void SetAddTableSpacing( bool _bSet ) { bAddTableSpacing = _bSet; } + inline void SetUseObjPos( bool _bSet ) { bUseObjPos = _bSet; } + inline void SetUseOurTextWrapping( bool _bSet ) { bUseOurTextWrapping = _bSet; } + inline void SetConsiderWrappingStyle( bool _bSet ) { bConsiderWrappingStyle = _bSet; } + inline void SetExpandWordSpace( bool _bSet ) { bExpandWordSpace = _bSet; } + + public: + OUString sName; + OUString sModule; + bool bUsePrtMetrics; + bool bAddSpacing; + bool bAddSpacingAtPages; + bool bUseOurTabStops; + bool bNoExtLeading; + bool bUseLineSpacing; + bool bAddTableSpacing; + bool bUseObjPos; + bool bUseOurTextWrapping; + bool bConsiderWrappingStyle; + bool bExpandWordSpace; +}; + +/*-**************************************************************************************************************** + @descr support simple menu structures and operations on it +****************************************************************************************************************-*/ +class SvtCompatibility +{ + public: + //--------------------------------------------------------------------------------------------------------- + // append one entry + void AppendEntry( const SvtCompatibilityEntry& rEntry ) + { + lEntries.push_back( rEntry ); + } + + //--------------------------------------------------------------------------------------------------------- + // the only way to free memory! + void Clear() + { + lEntries.clear(); + } + + //--------------------------------------------------------------------------------------------------------- + // convert internal list to external format + Sequence< Sequence< PropertyValue > > GetList() const + { + sal_Int32 nCount = (sal_Int32)lEntries.size(); + sal_Int32 nStep = 0; + Sequence< PropertyValue > lProperties( PROPERTYCOUNT ); + Sequence< Sequence< PropertyValue > > lResult( nCount ); + const vector< SvtCompatibilityEntry >* pList = &lEntries; + + lProperties[ OFFSET_NAME ].Name = PROPERTYNAME_NAME; + lProperties[ OFFSET_MODULE ].Name = PROPERTYNAME_MODULE; + lProperties[ OFFSET_USEPRTMETRICS ].Name = PROPERTYNAME_USEPRTMETRICS; + lProperties[ OFFSET_ADDSPACING ].Name = PROPERTYNAME_ADDSPACING; + lProperties[ OFFSET_ADDSPACINGATPAGES ].Name = PROPERTYNAME_ADDSPACINGATPAGES; + lProperties[ OFFSET_USEOURTABSTOPS ].Name = PROPERTYNAME_USEOURTABSTOPS; + lProperties[ OFFSET_NOEXTLEADING ].Name = PROPERTYNAME_NOEXTLEADING; + lProperties[ OFFSET_USELINESPACING ].Name = PROPERTYNAME_USELINESPACING; + lProperties[ OFFSET_ADDTABLESPACING ].Name = PROPERTYNAME_ADDTABLESPACING; + lProperties[ OFFSET_USEOBJPOS ].Name = PROPERTYNAME_USEOBJPOS; + lProperties[ OFFSET_USEOURTEXTWRAPPING ].Name = PROPERTYNAME_USEOURTEXTWRAP; + lProperties[ OFFSET_CONSIDERWRAPPINGSTYLE ].Name = PROPERTYNAME_CONSIDERWRAPSTYLE; + lProperties[ OFFSET_EXPANDWORDSPACE ].Name = PROPERTYNAME_EXPANDWORDSPACE; + + for ( vector< SvtCompatibilityEntry >::const_iterator pItem = pList->begin(); + pItem != pList->end(); ++pItem ) + { + lProperties[ OFFSET_NAME ].Value <<= pItem->sName; + lProperties[ OFFSET_MODULE ].Value <<= pItem->sModule; + lProperties[ OFFSET_USEPRTMETRICS ].Value <<= pItem->bUsePrtMetrics; + lProperties[ OFFSET_ADDSPACING ].Value <<= pItem->bAddSpacing; + lProperties[ OFFSET_ADDSPACINGATPAGES ].Value <<= pItem->bAddSpacingAtPages; + lProperties[ OFFSET_USEOURTABSTOPS ].Value <<= pItem->bUseOurTabStops; + lProperties[ OFFSET_NOEXTLEADING ].Value <<= pItem->bNoExtLeading; + lProperties[ OFFSET_USELINESPACING ].Value <<= pItem->bUseLineSpacing; + lProperties[ OFFSET_ADDTABLESPACING ].Value <<= pItem->bAddTableSpacing; + lProperties[ OFFSET_USEOBJPOS ].Value <<= pItem->bUseObjPos; + lProperties[ OFFSET_USEOURTEXTWRAPPING ].Value <<= pItem->bUseOurTextWrapping; + lProperties[ OFFSET_CONSIDERWRAPPINGSTYLE ].Value <<= pItem->bConsiderWrappingStyle; + lProperties[ OFFSET_EXPANDWORDSPACE ].Value <<= pItem->bExpandWordSpace; + lResult[ nStep ] = lProperties; + ++nStep; + } + + return lResult; + } + + int size() const + { + return lEntries.size(); + } + + const SvtCompatibilityEntry& operator[]( int i ) + { + return lEntries[i]; + } + + private: + vector< SvtCompatibilityEntry > lEntries; +}; + +class SvtCompatibilityOptions_Impl : public ConfigItem +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + SvtCompatibilityOptions_Impl(); + ~SvtCompatibilityOptions_Impl(); + + //--------------------------------------------------------------------------------------------------------- + // overloaded methods of baseclass + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short called for notify of configmanager + @descr These method is called from the ConfigManager before application ends or from the + PropertyChangeListener if the sub tree broadcasts changes. You must update your + internal values. + + @seealso baseclass ConfigItem + + @param "lPropertyNames" is the list of properties which should be updated. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void Notify( const Sequence< OUString >& lPropertyNames ); + + /*-****************************************************************************************************//** + @short write changes to configuration + @descr These method writes the changed values into the sub tree + and should always called in our destructor to guarantee consistency of config data. + + @seealso baseclass ConfigItem + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void Commit(); + + //--------------------------------------------------------------------------------------------------------- + // public interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short base implementation of public interface for "SvtCompatibilityOptions"! + @descr These class is used as static member of "SvtCompatibilityOptions" ... + => The code exist only for one time and isn't duplicated for every instance! + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void Clear(); + Sequence< Sequence< PropertyValue > > GetList() const; + void AppendItem( const ::rtl::OUString& _sName, + const ::rtl::OUString& _sModule, + bool _bUsePrtMetrics, + bool _bAddSpacing, + bool _bAddSpacingAtPages, + bool _bUseOurTabStops, + bool _bNoExtLeading, + bool _bUseLineSpacing, + bool _bAddTableSpacing, + bool _bUseObjPos, + bool _bUseOurTextWrapping, + bool _bConsiderWrappingStyle, + bool _bExpandWordSpace ); + + inline bool IsUsePrtDevice() const { return m_aDefOptions.bUsePrtMetrics; } + inline bool IsAddSpacing() const { return m_aDefOptions.bAddSpacing; } + inline bool IsAddSpacingAtPages() const { return m_aDefOptions.bAddSpacingAtPages; } + inline bool IsUseOurTabStops() const { return m_aDefOptions.bUseOurTabStops; } + inline bool IsNoExtLeading() const { return m_aDefOptions.bNoExtLeading; } + inline bool IsUseLineSpacing() const { return m_aDefOptions.bUseLineSpacing; } + inline bool IsAddTableSpacing() const { return m_aDefOptions.bAddTableSpacing; } + inline bool IsUseObjPos() const { return m_aDefOptions.bUseObjPos; } + inline bool IsUseOurTextWrapping() const { return m_aDefOptions.bUseOurTextWrapping; } + inline bool IsConsiderWrappingStyle() const { return m_aDefOptions.bConsiderWrappingStyle; } + inline bool IsExpandWordSpace() const { return m_aDefOptions.bExpandWordSpace; } + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return list of key names of our configuration management which represent one module tree + @descr These methods return the current list of key names! We need it to get needed values from our + configuration management and support dynamical menu item lists! + + @seealso - + + @param - + @return A list of configuration key names is returned. + + @onerror - + *//*-*****************************************************************************************************/ + + Sequence< OUString > impl_GetPropertyNames( Sequence< OUString >& rItems ); + + /*-****************************************************************************************************//** + @short expand the list for all well known properties to destination + @descr - + @attention - + + @seealso method impl_GetPropertyNames() + + @param "lSource" , original list + @param "lDestination" , destination of operation + @return A list of configuration key names is returned. + + @onerror - + *//*-*****************************************************************************************************/ + + void impl_ExpandPropertyNames( const Sequence< OUString >& lSource, + Sequence< OUString >& lDestination ); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + SvtCompatibility m_aOptions; + SvtCompatibilityEntry m_aDefOptions; +}; + +//_________________________________________________________________________________________________________________ +// definitions +//_________________________________________________________________________________________________________________ + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtCompatibilityOptions_Impl::SvtCompatibilityOptions_Impl() + // Init baseclasses first + : ConfigItem( ROOTNODE_OPTIONS ) + // Init member then... +{ + // Get names and values of all accessable menu entries and fill internal structures. + // See impl_GetPropertyNames() for further informations. + Sequence< OUString > lNodes; + Sequence< OUString > lNames = impl_GetPropertyNames( lNodes ); + sal_uInt32 nCount = lNodes.getLength(); + Sequence< Any > lValues = GetProperties( lNames ); + + // Safe impossible cases. + // We need values from ALL configuration keys. + // Follow assignment use order of values in relation to our list of key names! + DBG_ASSERT( !( lNames.getLength()!=lValues.getLength() ), "SvtCompatibilityOptions_Impl::SvtCompatibilityOptions_Impl()\nI miss some values of configuration keys!\n" ); + + SvtCompatibilityEntry aItem; + sal_uInt32 nItem = 0; + sal_uInt32 nPosition = 0; + + // Get names/values for new menu. + // 4 subkeys for every item! + bool bDefaultFound = false; + for( nItem = 0; nItem < nCount; ++nItem ) + { + aItem.sName = lNodes[ nItem ]; + lValues[ nPosition++ ] >>= aItem.sModule; + lValues[ nPosition++ ] >>= aItem.bUsePrtMetrics; + lValues[ nPosition++ ] >>= aItem.bAddSpacing; + lValues[ nPosition++ ] >>= aItem.bAddSpacingAtPages; + lValues[ nPosition++ ] >>= aItem.bUseOurTabStops; + lValues[ nPosition++ ] >>= aItem.bNoExtLeading; + lValues[ nPosition++ ] >>= aItem.bUseLineSpacing; + lValues[ nPosition++ ] >>= aItem.bAddTableSpacing; + lValues[ nPosition++ ] >>= aItem.bUseObjPos; + lValues[ nPosition++ ] >>= aItem.bUseOurTextWrapping; + lValues[ nPosition++ ] >>= aItem.bConsiderWrappingStyle; + lValues[ nPosition++ ] >>= aItem.bExpandWordSpace; + m_aOptions.AppendEntry( aItem ); + + if ( !bDefaultFound && aItem.sName.equals( COMPATIBILITY_DEFAULT_NAME ) != sal_False ) + { + m_aDefOptions = aItem; + bDefaultFound = true; + } + } +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtCompatibilityOptions_Impl::~SvtCompatibilityOptions_Impl() +{ + // We must save our current values .. if user forget it! + if( IsModified() == sal_True ) + { + Commit(); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtCompatibilityOptions_Impl::Notify( const Sequence< OUString >& ) +{ + DBG_ASSERT( sal_False, "SvtCompatibilityOptions_Impl::Notify()\nNot implemented yet! I don't know how I can handle a dynamical list of unknown properties ...\n" ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtCompatibilityOptions_Impl::Commit() +{ + // Write all properties! + // Delete complete set first. + ClearNodeSet( SETNODE_ALLFILEFORMATS ); + + SvtCompatibilityEntry aItem; + OUString sNode; + Sequence< PropertyValue > lPropertyValues( PROPERTYCOUNT - 1 ); + sal_uInt32 nItem = 0; + sal_uInt32 nNewCount = m_aOptions.size(); + for( nItem = 0; nItem < nNewCount; ++nItem ) + { + aItem = m_aOptions[ nItem ]; + sNode = SETNODE_ALLFILEFORMATS + PATHDELIMITER + aItem.sName + PATHDELIMITER; + + lPropertyValues[ OFFSET_MODULE - 1 ].Name = sNode + PROPERTYNAME_MODULE; + lPropertyValues[ OFFSET_USEPRTMETRICS - 1 ].Name = sNode + PROPERTYNAME_USEPRTMETRICS; + lPropertyValues[ OFFSET_ADDSPACING - 1 ].Name = sNode + PROPERTYNAME_ADDSPACING; + lPropertyValues[ OFFSET_ADDSPACINGATPAGES - 1 ].Name = sNode + PROPERTYNAME_ADDSPACINGATPAGES; + lPropertyValues[ OFFSET_USEOURTABSTOPS - 1 ].Name = sNode + PROPERTYNAME_USEOURTABSTOPS; + lPropertyValues[ OFFSET_NOEXTLEADING - 1 ].Name = sNode + PROPERTYNAME_NOEXTLEADING; + lPropertyValues[ OFFSET_USELINESPACING - 1 ].Name = sNode + PROPERTYNAME_USELINESPACING; + lPropertyValues[ OFFSET_ADDTABLESPACING - 1 ].Name = sNode + PROPERTYNAME_ADDTABLESPACING; + lPropertyValues[ OFFSET_USEOBJPOS - 1 ].Name = sNode + PROPERTYNAME_USEOBJPOS; + lPropertyValues[ OFFSET_USEOURTEXTWRAPPING - 1 ].Name = sNode + PROPERTYNAME_USEOURTEXTWRAP; + lPropertyValues[ OFFSET_CONSIDERWRAPPINGSTYLE - 1 ].Name = sNode + PROPERTYNAME_CONSIDERWRAPSTYLE; + lPropertyValues[ OFFSET_EXPANDWORDSPACE - 1 ].Name = sNode + PROPERTYNAME_EXPANDWORDSPACE; + + lPropertyValues[ OFFSET_MODULE - 1 ].Value <<= aItem.sModule; + lPropertyValues[ OFFSET_USEPRTMETRICS - 1 ].Value <<= aItem.bUsePrtMetrics; + lPropertyValues[ OFFSET_ADDSPACING - 1 ].Value <<= aItem.bAddSpacing; + lPropertyValues[ OFFSET_ADDSPACINGATPAGES - 1 ].Value <<= aItem.bAddSpacingAtPages; + lPropertyValues[ OFFSET_USEOURTABSTOPS - 1 ].Value <<= aItem.bUseOurTabStops; + lPropertyValues[ OFFSET_NOEXTLEADING - 1 ].Value <<= aItem.bNoExtLeading; + lPropertyValues[ OFFSET_USELINESPACING - 1 ].Value <<= aItem.bUseLineSpacing; + lPropertyValues[ OFFSET_ADDTABLESPACING - 1 ].Value <<= aItem.bAddTableSpacing; + lPropertyValues[ OFFSET_USEOBJPOS - 1 ].Value <<= aItem.bUseObjPos; + lPropertyValues[ OFFSET_USEOURTEXTWRAPPING - 1 ].Value <<= aItem.bUseOurTextWrapping; + lPropertyValues[ OFFSET_CONSIDERWRAPPINGSTYLE - 1 ].Value <<= aItem.bConsiderWrappingStyle; + lPropertyValues[ OFFSET_EXPANDWORDSPACE - 1 ].Value <<= aItem.bExpandWordSpace; + + SetSetProperties( SETNODE_ALLFILEFORMATS, lPropertyValues ); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtCompatibilityOptions_Impl::Clear() +{ + m_aOptions.Clear(); + SetModified(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +Sequence< Sequence< PropertyValue > > SvtCompatibilityOptions_Impl::GetList() const +{ + Sequence< Sequence< PropertyValue > > lReturn; + lReturn = m_aOptions.GetList(); + return lReturn; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** + +void SvtCompatibilityOptions_Impl::AppendItem( const ::rtl::OUString& _sName, + const ::rtl::OUString& _sModule, + bool _bUsePrtMetrics, + bool _bAddSpacing, + bool _bAddSpacingAtPages, + bool _bUseOurTabStops, + bool _bNoExtLeading, + bool _bUseLineSpacing, + bool _bAddTableSpacing, + bool _bUseObjPos, + bool _bUseOurTextWrapping, + bool _bConsiderWrappingStyle, + bool _bExpandWordSpace ) +{ + SvtCompatibilityEntry aItem( _sName, _sModule ); + aItem.SetUsePrtMetrics( _bUsePrtMetrics ); + aItem.SetAddSpacing( _bAddSpacing ); + aItem.SetAddSpacingAtPages( _bAddSpacingAtPages ); + aItem.SetUseOurTabStops( _bUseOurTabStops ); + aItem.SetNoExtLeading( _bNoExtLeading ); + aItem.SetUseLineSpacing( _bUseLineSpacing ); + aItem.SetAddTableSpacing( _bAddTableSpacing ); + aItem.SetUseObjPos( _bUseObjPos ); + aItem.SetUseOurTextWrapping( _bUseOurTextWrapping ); + aItem.SetConsiderWrappingStyle( _bConsiderWrappingStyle ); + aItem.SetExpandWordSpace( _bExpandWordSpace ); + m_aOptions.AppendEntry( aItem ); + + // default item reset? + if ( _sName.equals( COMPATIBILITY_DEFAULT_NAME ) != sal_False ) + m_aDefOptions = aItem; + + SetModified(); +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Sequence< OUString > SvtCompatibilityOptions_Impl::impl_GetPropertyNames( Sequence< OUString >& rItems ) +{ + // First get ALL names of current existing list items in configuration! + rItems = GetNodeNames( SETNODE_ALLFILEFORMATS ); + // expand list to result list ... + Sequence< OUString > lProperties( rItems.getLength() * ( PROPERTYCOUNT - 1 ) ); + impl_ExpandPropertyNames( rItems, lProperties ); + // Return result. + return lProperties; +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +void SvtCompatibilityOptions_Impl::impl_ExpandPropertyNames( + const Sequence< OUString >& lSource, Sequence< OUString >& lDestination ) +{ + OUString sFixPath; + sal_Int32 nDestStep = 0; + sal_Int32 nSourceCount = lSource.getLength(); + // Copy entries to destination and expand every item with 2 supported sub properties. + for( sal_Int32 nSourceStep = 0; nSourceStep < nSourceCount; ++nSourceStep ) + { + sFixPath = SETNODE_ALLFILEFORMATS; + sFixPath += PATHDELIMITER; + sFixPath += lSource[ nSourceStep ]; + sFixPath += PATHDELIMITER; + + lDestination[nDestStep] = sFixPath; + lDestination[nDestStep] += PROPERTYNAME_MODULE; + ++nDestStep; + lDestination[nDestStep] = sFixPath; + lDestination[nDestStep] += PROPERTYNAME_USEPRTMETRICS; + ++nDestStep; + lDestination[nDestStep] = sFixPath; + lDestination[nDestStep] += PROPERTYNAME_ADDSPACING; + ++nDestStep; + lDestination[nDestStep] = sFixPath; + lDestination[nDestStep] += PROPERTYNAME_ADDSPACINGATPAGES; + ++nDestStep; + lDestination[nDestStep] = sFixPath; + lDestination[nDestStep] += PROPERTYNAME_USEOURTABSTOPS; + ++nDestStep; + lDestination[nDestStep] = sFixPath; + lDestination[nDestStep] += PROPERTYNAME_NOEXTLEADING; + ++nDestStep; + lDestination[nDestStep] = sFixPath; + lDestination[nDestStep] += PROPERTYNAME_USELINESPACING; + ++nDestStep; + lDestination[nDestStep] = sFixPath; + lDestination[nDestStep] += PROPERTYNAME_ADDTABLESPACING; + ++nDestStep; + lDestination[nDestStep] = sFixPath; + lDestination[nDestStep] += PROPERTYNAME_USEOBJPOS; + ++nDestStep; + lDestination[nDestStep] = sFixPath; + lDestination[nDestStep] += PROPERTYNAME_USEOURTEXTWRAP; + ++nDestStep; + lDestination[nDestStep] = sFixPath; + lDestination[nDestStep] += PROPERTYNAME_CONSIDERWRAPSTYLE; + ++nDestStep; + lDestination[nDestStep] = sFixPath; + lDestination[nDestStep] += PROPERTYNAME_EXPANDWORDSPACE; + ++nDestStep; + } +} + +//***************************************************************************************************************** +// initialize static member +// DON'T DO IT IN YOUR HEADER! +// see definition for further informations +//***************************************************************************************************************** +SvtCompatibilityOptions_Impl* SvtCompatibilityOptions::m_pDataContainer = NULL; +sal_Int32 SvtCompatibilityOptions::m_nRefCount = 0; + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtCompatibilityOptions::SvtCompatibilityOptions() +{ + // Global access, must be guarded (multithreading!). + MutexGuard aGuard( GetOwnStaticMutex() ); + // Increase ouer refcount ... + ++m_nRefCount; + // ... and initialize ouer data container only if it not already exist! + if( m_pDataContainer == NULL ) + { + m_pDataContainer = new SvtCompatibilityOptions_Impl; + ItemHolder1::holdConfigItem(E_COMPATIBILITY); + } +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtCompatibilityOptions::~SvtCompatibilityOptions() +{ + // Global access, must be guarded (multithreading!) + MutexGuard aGuard( GetOwnStaticMutex() ); + // Decrease ouer refcount. + --m_nRefCount; + // If last instance was deleted ... + // we must destroy ouer static data container! + if( m_nRefCount <= 0 ) + { + delete m_pDataContainer; + m_pDataContainer = NULL; + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtCompatibilityOptions::Clear() +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->Clear(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtCompatibilityOptions::AppendItem( const ::rtl::OUString& sName, + const ::rtl::OUString& sModule, + bool bUsePrtMetrics, + bool bAddSpacing, + bool bAddSpacingAtPages, + bool bUseOurTabStops, + bool bNoExtLeading, + bool bUseLineSpacing, + bool bAddTableSpacing, + bool bUseObjPos, + bool bUseOurTextWrapping, + bool bConsiderWrappingStyle, + bool bExpandWordSpace ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->AppendItem( + sName, sModule, bUsePrtMetrics, bAddSpacing, + bAddSpacingAtPages, bUseOurTabStops, bNoExtLeading, + bUseLineSpacing, bAddTableSpacing, bUseObjPos, + bUseOurTextWrapping, bConsiderWrappingStyle, bExpandWordSpace ); +} + +bool SvtCompatibilityOptions::IsUsePrtDevice() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsUsePrtDevice(); +} + +bool SvtCompatibilityOptions::IsAddSpacing() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsAddSpacing(); +} + +bool SvtCompatibilityOptions::IsAddSpacingAtPages() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsAddSpacingAtPages(); +} + +bool SvtCompatibilityOptions::IsUseOurTabStops() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsUseOurTabStops(); +} + +bool SvtCompatibilityOptions::IsNoExtLeading() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsNoExtLeading(); +} + +bool SvtCompatibilityOptions::IsUseLineSpacing() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsUseLineSpacing(); +} + +bool SvtCompatibilityOptions::IsAddTableSpacing() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsAddTableSpacing(); +} + +bool SvtCompatibilityOptions::IsUseObjectPositioning() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsUseObjPos(); +} + +bool SvtCompatibilityOptions::IsUseOurTextWrapping() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsUseOurTextWrapping(); +} + +bool SvtCompatibilityOptions::IsConsiderWrappingStyle() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsConsiderWrappingStyle(); +} + +bool SvtCompatibilityOptions::IsExpandWordSpace() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsExpandWordSpace(); +} + +Sequence< Sequence< PropertyValue > > SvtCompatibilityOptions::GetList() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetList(); +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Mutex& SvtCompatibilityOptions::GetOwnStaticMutex() +{ + // Initialize static mutex only for one time! + static Mutex* pMutex = NULL; + // If these method first called (Mutex not already exist!) ... + if( pMutex == NULL ) + { + // ... we must create a new one. Protect follow code with the global mutex - + // It must be - we create a static variable! + MutexGuard aGuard( Mutex::getGlobalMutex() ); + // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! + if( pMutex == NULL ) + { + // Create the new mutex and set it for return on static variable. + static Mutex aMutex; + pMutex = &aMutex; + } + } + // Return new created or already existing mutex object. + return *pMutex; +} + diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx index a6b3bbaa1e2f..944ea0535a93 100644 --- a/unotools/source/config/configitem.cxx +++ b/unotools/source/config/configitem.cxx @@ -33,6 +33,7 @@ #include "unotools/configitem.hxx" #include "unotools/configmgr.hxx" #include "unotools/configpathes.hxx" +#include #include #include #include @@ -43,6 +44,8 @@ #include #include #include +#include +#include #include #include #include @@ -62,7 +65,7 @@ using namespace com::sun::star::container; using namespace com::sun::star::configuration; #define C2U(cChar) OUString::createFromAscii(cChar) -#include // helper for implementations +#include // helper for implementations #ifdef DBG_UTIL inline void lcl_CFG_DBG_EXCEPTION(const sal_Char* cText, const Exception& rEx) @@ -82,14 +85,15 @@ catch(Exception& rEx) \ #endif namespace utl{ - class ConfigChangeListener_Impl : public cppu::WeakImplHelper1 + class ConfigChangeListener_Impl : public cppu::WeakImplHelper2 < - com::sun::star::util::XChangesListener + com::sun::star::util::XChangesListener, + com::sun::star::awt::XCallback > { + public: ConfigItem* pParent; const Sequence< OUString > aPropertyNames; - public: ConfigChangeListener_Impl(ConfigItem& rItem, const Sequence< OUString >& rNames); ~ConfigChangeListener_Impl(); @@ -99,6 +103,8 @@ namespace utl{ //XEventListener virtual void SAL_CALL disposing( const EventObject& Source ) throw(RuntimeException); + //XAsyncCallback + virtual void SAL_CALL notify ( const Any& rData ); }; /* -----------------------------12.02.01 11:38-------------------------------- @@ -211,15 +217,25 @@ void ConfigChangeListener_Impl::changesOccurred( const ChangesEvent& rEvent ) th if(nNotify) { aChangedNames.realloc(nNotify); - pParent->CallNotify(aChangedNames); + Reference < com::sun::star::awt::XRequestCallback > aCallback( ::comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.awt.AsyncCallback") ), UNO_QUERY ); + aCallback->addCallback( this, makeAny( aChangedNames ) ); } } + +void ConfigChangeListener_Impl::notify ( const Any& rData ) +{ + Sequence aChangedNames; + if ( (rData >>= aChangedNames) && pParent ) + pParent->CallNotify(aChangedNames); +} + /* -----------------------------29.08.00 16:34-------------------------------- ---------------------------------------------------------------------------*/ void ConfigChangeListener_Impl::disposing( const EventObject& /*rSource*/ ) throw(RuntimeException) { - pParent->RemoveChangesListener(); + if ( pParent ) + pParent->RemoveChangesListener(); } /* -----------------------------29.08.00 12:50-------------------------------- @@ -266,6 +282,9 @@ ConfigItem::~ConfigItem() { if(pImpl->pManager) { + ConfigChangeListener_Impl* pListener = dynamic_cast < ConfigChangeListener_Impl* >( xChangeLstnr.get() ); + if ( pListener ) + pListener->pParent = 0; RemoveChangesListener(); pImpl->pManager->RemoveConfigItem(*this); } @@ -304,7 +323,9 @@ void ConfigItem::CallNotify( const com::sun::star::uno::Sequence& rPro { if(!IsInValueChange() || pImpl->bEnableInternalNotification) Notify(rPropertyNames); + NotifyListeners(); } + /* -----------------------------29.08.00 12:52-------------------------------- ---------------------------------------------------------------------------*/ @@ -1419,5 +1440,3 @@ void ConfigItem::UnlockTree() m_xHierarchyAccess = 0; } - - diff --git a/unotools/source/config/defaultoptions.cxx b/unotools/source/config/defaultoptions.cxx new file mode 100644 index 000000000000..36c79b451f45 --- /dev/null +++ b/unotools/source/config/defaultoptions.cxx @@ -0,0 +1,354 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: defaultoptions.cxx,v $ + * $Revision: 1.15 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +using namespace osl; +using namespace utl; +using namespace rtl; +using namespace com::sun::star::uno; + +// define ---------------------------------------------------------------- + +#define ASCII_STR(s) OUString( RTL_CONSTASCII_USTRINGPARAM(s) ) + +#define DEFAULTPATH__ADDIN 0 +#define DEFAULTPATH__AUTOCORRECT 1 +#define DEFAULTPATH__AUTOTEXT 2 +#define DEFAULTPATH__BACKUP 3 +#define DEFAULTPATH__BASIC 4 +#define DEFAULTPATH__BITMAP 5 +#define DEFAULTPATH__CONFIG 6 +#define DEFAULTPATH__DICTIONARY 7 +#define DEFAULTPATH__FAVORITES 8 +#define DEFAULTPATH__FILTER 9 +#define DEFAULTPATH__GALLERY 10 +#define DEFAULTPATH__GRAPHIC 11 +#define DEFAULTPATH__HELP 12 +#define DEFAULTPATH__LINGUISTIC 13 +#define DEFAULTPATH__MODULE 14 +#define DEFAULTPATH__PALETTE 15 +#define DEFAULTPATH__PLUGIN 16 +#define DEFAULTPATH__TEMP 17 +#define DEFAULTPATH__TEMPLATE 18 +#define DEFAULTPATH__USERCONFIG 19 +#define DEFAULTPATH__WORK 20 +#define DEFAULTPATH__USERDICTIONARY 21 + +// class SvtDefaultOptions_Impl ------------------------------------------ + +class SvtDefaultOptions_Impl : public utl::ConfigItem +{ +public: + String m_aAddinPath; + String m_aAutoCorrectPath; + String m_aAutoTextPath; + String m_aBackupPath; + String m_aBasicPath; + String m_aBitmapPath; + String m_aConfigPath; + String m_aDictionaryPath; + String m_aFavoritesPath; + String m_aFilterPath; + String m_aGalleryPath; + String m_aGraphicPath; + String m_aHelpPath; + String m_aLinguisticPath; + String m_aModulePath; + String m_aPalettePath; + String m_aPluginPath; + String m_aTempPath; + String m_aTemplatePath; + String m_aUserConfigPath; + String m_aWorkPath; + String m_aUserDictionaryPath; + + SvtDefaultOptions_Impl(); + + String GetDefaultPath( USHORT nId ) const; +}; + +// global ---------------------------------------------------------------- + +static SvtDefaultOptions_Impl* pOptions = NULL; +static sal_Int32 nRefCount = 0; + +typedef String SvtDefaultOptions_Impl:: *PathStrPtr; + +struct PathToDefaultMapping_Impl +{ + SvtPathOptions::Pathes _ePath; + PathStrPtr _pDefaultPath; +}; + +static PathToDefaultMapping_Impl __READONLY_DATA PathMap_Impl[] = +{ + { SvtPathOptions::PATH_ADDIN, &SvtDefaultOptions_Impl::m_aAddinPath }, + { SvtPathOptions::PATH_AUTOCORRECT, &SvtDefaultOptions_Impl::m_aAutoCorrectPath }, + { SvtPathOptions::PATH_AUTOTEXT, &SvtDefaultOptions_Impl::m_aAutoTextPath }, + { SvtPathOptions::PATH_BACKUP, &SvtDefaultOptions_Impl::m_aBackupPath }, + { SvtPathOptions::PATH_BASIC, &SvtDefaultOptions_Impl::m_aBasicPath }, + { SvtPathOptions::PATH_BITMAP, &SvtDefaultOptions_Impl::m_aBitmapPath }, + { SvtPathOptions::PATH_CONFIG, &SvtDefaultOptions_Impl::m_aConfigPath }, + { SvtPathOptions::PATH_DICTIONARY, &SvtDefaultOptions_Impl::m_aDictionaryPath }, + { SvtPathOptions::PATH_FAVORITES, &SvtDefaultOptions_Impl::m_aFavoritesPath }, + { SvtPathOptions::PATH_FILTER, &SvtDefaultOptions_Impl::m_aFilterPath }, + { SvtPathOptions::PATH_GALLERY, &SvtDefaultOptions_Impl::m_aGalleryPath }, + { SvtPathOptions::PATH_GRAPHIC, &SvtDefaultOptions_Impl::m_aGraphicPath }, + { SvtPathOptions::PATH_HELP, &SvtDefaultOptions_Impl::m_aHelpPath }, + { SvtPathOptions::PATH_LINGUISTIC, &SvtDefaultOptions_Impl::m_aLinguisticPath }, + { SvtPathOptions::PATH_MODULE, &SvtDefaultOptions_Impl::m_aModulePath }, + { SvtPathOptions::PATH_PALETTE, &SvtDefaultOptions_Impl::m_aPalettePath }, + { SvtPathOptions::PATH_PLUGIN, &SvtDefaultOptions_Impl::m_aPluginPath }, + { SvtPathOptions::PATH_TEMP, &SvtDefaultOptions_Impl::m_aTempPath }, + { SvtPathOptions::PATH_TEMPLATE, &SvtDefaultOptions_Impl::m_aTemplatePath }, + { SvtPathOptions::PATH_USERCONFIG, &SvtDefaultOptions_Impl::m_aUserConfigPath }, + { SvtPathOptions::PATH_WORK, &SvtDefaultOptions_Impl::m_aWorkPath } +}; + +// functions ------------------------------------------------------------- + +Sequence< OUString > GetDefaultPropertyNames() +{ + static const char* aPropNames[] = + { + "Addin", // PATH_ADDIN + "AutoCorrect", // PATH_AUTOCORRECT + "AutoText", // PATH_AUTOTEXT + "Backup", // PATH_BACKUP + "Basic", // PATH_BASIC + "Bitmap", // PATH_BITMAP + "Config", // PATH_CONFIG + "Dictionary", // PATH_DICTIONARY + "Favorite", // PATH_FAVORITES + "Filter", // PATH_FILTER + "Gallery", // PATH_GALLERY + "Graphic", // PATH_GRAPHIC + "Help", // PATH_HELP + "Linguistic", // PATH_LINGUISTIC + "Module", // PATH_MODULE + "Palette", // PATH_PALETTE + "Plugin", // PATH_PLUGIN + "Temp", // PATH_TEMP + "Template", // PATH_TEMPLATE + "UserConfig", // PATH_USERCONFIG + "Work" // PATH_WORK + }; + + const int nCount = sizeof( aPropNames ) / sizeof( const char* ); + Sequence< OUString > aNames( nCount ); + OUString* pNames = aNames.getArray(); + for ( int i = 0; i < nCount; i++ ) + pNames[i] = OUString::createFromAscii( aPropNames[i] ); + + return aNames; +} + +// class SvtDefaultOptions_Impl ------------------------------------------ + +String SvtDefaultOptions_Impl::GetDefaultPath( USHORT nId ) const +{ + String aRet; + USHORT nIdx = 0; + + while ( PathMap_Impl[nIdx]._ePath <= SvtPathOptions::PATH_WORK ) + { + if ( nId == PathMap_Impl[nIdx]._ePath && PathMap_Impl[nIdx]._pDefaultPath ) + { + aRet = this->*(PathMap_Impl[nIdx]._pDefaultPath); + if ( nId == SvtPathOptions::PATH_ADDIN || + nId == SvtPathOptions::PATH_FILTER || + nId == SvtPathOptions::PATH_HELP || + nId == SvtPathOptions::PATH_MODULE || + nId == SvtPathOptions::PATH_PLUGIN ) + { + String aTmp; + ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aRet, aTmp ); + aRet = aTmp; + } + + break; + } + ++nIdx; + } + + return aRet; +} + +// ----------------------------------------------------------------------- + +SvtDefaultOptions_Impl::SvtDefaultOptions_Impl() : ConfigItem( ASCII_STR("Office.Common/Path/Default") ) +{ + /*ConfigManager* pCfgMgr =*/ ConfigManager::GetConfigManager(); + Sequence< OUString > aNames = GetDefaultPropertyNames(); + Sequence< Any > aValues = GetProperties( aNames ); + EnableNotification( aNames ); + const Any* pValues = aValues.getConstArray(); + DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" ); + if ( aValues.getLength() == aNames.getLength() ) + { + SvtPathOptions aPathOpt; + OUString aTempStr, aFullPath; + + for ( int nProp = 0; nProp < aNames.getLength(); nProp++ ) + { + if ( pValues[nProp].hasValue() ) + { + switch ( pValues[nProp].getValueTypeClass() ) + { + case ::com::sun::star::uno::TypeClass_STRING : + { + // multi pathes + if ( pValues[nProp] >>= aTempStr ) + aFullPath = aPathOpt.SubstituteVariable( aTempStr ); + else + { + DBG_ERRORFILE( "any operator >>= failed" ); + } + break; + } + + case ::com::sun::star::uno::TypeClass_SEQUENCE : + { + // single pathes + aFullPath = OUString(); + Sequence < OUString > aList; + if ( pValues[nProp] >>= aList ) + { + sal_Int32 nCount = aList.getLength(); + for ( sal_Int32 nPosition = 0; nPosition < nCount; ++nPosition ) + { + aTempStr = aPathOpt.SubstituteVariable( aList[ nPosition ] ); + aFullPath += aTempStr; + if ( nPosition < nCount-1 ) + aFullPath += OUString( RTL_CONSTASCII_USTRINGPARAM(";") ); + } + } + else + { + DBG_ERRORFILE( "any operator >>= failed" ); + } + break; + } + + default: + { + DBG_ERRORFILE( "Wrong any type" ); + } + } + + switch ( nProp ) + { + case DEFAULTPATH__ADDIN: m_aAddinPath = String( aFullPath ); break; + case DEFAULTPATH__AUTOCORRECT: m_aAutoCorrectPath = String( aFullPath ); break; + case DEFAULTPATH__AUTOTEXT: m_aAutoTextPath = String( aFullPath ); break; + case DEFAULTPATH__BACKUP: m_aBackupPath = String( aFullPath ); break; + case DEFAULTPATH__BASIC: m_aBasicPath = String( aFullPath ); break; + case DEFAULTPATH__BITMAP: m_aBitmapPath = String( aFullPath ); break; + case DEFAULTPATH__CONFIG: m_aConfigPath = String( aFullPath ); break; + case DEFAULTPATH__DICTIONARY: m_aDictionaryPath = String( aFullPath ); break; + case DEFAULTPATH__FAVORITES: m_aFavoritesPath = String( aFullPath ); break; + case DEFAULTPATH__FILTER: m_aFilterPath = String( aFullPath ); break; + case DEFAULTPATH__GALLERY: m_aGalleryPath = String( aFullPath ); break; + case DEFAULTPATH__GRAPHIC: m_aGraphicPath = String( aFullPath ); break; + case DEFAULTPATH__HELP: m_aHelpPath = String( aFullPath ); break; + case DEFAULTPATH__LINGUISTIC: m_aLinguisticPath = String( aFullPath ); break; + case DEFAULTPATH__MODULE: m_aModulePath = String( aFullPath ); break; + case DEFAULTPATH__PALETTE: m_aPalettePath = String( aFullPath ); break; + case DEFAULTPATH__PLUGIN: m_aPluginPath = String( aFullPath ); break; + case DEFAULTPATH__TEMP: m_aTempPath = String( aFullPath ); break; + case DEFAULTPATH__TEMPLATE: m_aTemplatePath = String( aFullPath ); break; + case DEFAULTPATH__USERCONFIG: m_aUserConfigPath = String( aFullPath ); break; + case DEFAULTPATH__WORK: m_aWorkPath = String( aFullPath ); break; + case DEFAULTPATH__USERDICTIONARY: m_aUserDictionaryPath = String( aFullPath );break; + + default: + DBG_ERRORFILE( "invalid index to load a default path" ); + } + } + } + } +} + +// class SvtDefaultOptions ----------------------------------------------- +namespace { struct lclMutex : public rtl::Static< ::osl::Mutex, lclMutex > {}; } + +SvtDefaultOptions::SvtDefaultOptions() +{ + // Global access, must be guarded (multithreading) + ::osl::MutexGuard aGuard( lclMutex::get() ); + if ( !pOptions ) + { + pOptions = new SvtDefaultOptions_Impl; + ItemHolder1::holdConfigItem(E_DEFAULTOPTIONS); + } + ++nRefCount; + pImp = pOptions; +} + +// ----------------------------------------------------------------------- + +SvtDefaultOptions::~SvtDefaultOptions() +{ + // Global access, must be guarded (multithreading) + ::osl::MutexGuard aGuard( lclMutex::get() ); + if ( !--nRefCount ) + { + if ( pOptions->IsModified() ) + pOptions->Commit(); + DELETEZ( pOptions ); + } +} + +// ----------------------------------------------------------------------- + +String SvtDefaultOptions::GetDefaultPath( USHORT nId ) const +{ + return pImp->GetDefaultPath( nId ); +} + diff --git a/unotools/source/config/dynamicmenuoptions.cxx b/unotools/source/config/dynamicmenuoptions.cxx new file mode 100644 index 000000000000..d3fca4350a67 --- /dev/null +++ b/unotools/source/config/dynamicmenuoptions.cxx @@ -0,0 +1,923 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: dynamicmenuoptions.cxx,v $ + * $Revision: 1.18 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +#ifndef GCC +#endif + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include +#include +#include +#include +#include +#include +#include + +#ifndef __SGI_STL_VECTOR +#include +#endif + +#include + +#include + +//_________________________________________________________________________________________________________________ +// namespaces +//_________________________________________________________________________________________________________________ + +using namespace ::std ; +using namespace ::utl ; +using namespace ::rtl ; +using namespace ::osl ; +using namespace ::com::sun::star::uno ; +using namespace ::com::sun::star::beans ; + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +#define ROOTNODE_MENUS OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Menus/" )) +#define PATHDELIMITER OUString(RTL_CONSTASCII_USTRINGPARAM("/" )) + +#define SETNODE_NEWMENU OUString(RTL_CONSTASCII_USTRINGPARAM("New" )) +#define SETNODE_WIZARDMENU OUString(RTL_CONSTASCII_USTRINGPARAM("Wizard" )) +#define SETNODE_HELPBOOKMARKS OUString(RTL_CONSTASCII_USTRINGPARAM("HelpBookmarks" )) + +#define PROPERTYNAME_URL DYNAMICMENU_PROPERTYNAME_URL +#define PROPERTYNAME_TITLE DYNAMICMENU_PROPERTYNAME_TITLE +#define PROPERTYNAME_IMAGEIDENTIFIER DYNAMICMENU_PROPERTYNAME_IMAGEIDENTIFIER +#define PROPERTYNAME_TARGETNAME DYNAMICMENU_PROPERTYNAME_TARGETNAME + +#define PROPERTYCOUNT 4 + +#define OFFSET_URL 0 +#define OFFSET_TITLE 1 +#define OFFSET_IMAGEIDENTIFIER 2 +#define OFFSET_TARGETNAME 3 + +#define PATHPREFIX_SETUP OUString(RTL_CONSTASCII_USTRINGPARAM("m" )) +#define PATHPREFIX_USER OUString(RTL_CONSTASCII_USTRINGPARAM("u" )) + +//_________________________________________________________________________________________________________________ +// private declarations! +//_________________________________________________________________________________________________________________ + +/*-**************************************************************************************************************** + @descr struct to hold information about one menu entry. +****************************************************************************************************************-*/ +struct SvtDynMenuEntry +{ + public: + SvtDynMenuEntry() {}; + + SvtDynMenuEntry( const OUString& sNewURL , + const OUString& sNewTitle , + const OUString& sNewImageIdentifier , + const OUString& sNewTargetName ) + { + sURL = sNewURL ; + sTitle = sNewTitle ; + sImageIdentifier = sNewImageIdentifier ; + sTargetName = sNewTargetName ; + } + + public: + OUString sName ; + OUString sURL ; + OUString sTitle ; + OUString sImageIdentifier ; + OUString sTargetName ; +}; + +/*-**************************************************************************************************************** + @descr support simple menu structures and operations on it +****************************************************************************************************************-*/ +class SvtDynMenu +{ + public: + //--------------------------------------------------------------------------------------------------------- + // append setup written menu entry + // Don't touch name of entry. It was defined by setup and must be the same everytime! + // Look for double menu entries here too ... may be some seperator items are supeflous ... + void AppendSetupEntry( const SvtDynMenuEntry& rEntry ) + { + if( + ( lSetupEntries.size() < 1 ) || + ( lSetupEntries.rbegin()->sURL != rEntry.sURL ) + ) + { + lSetupEntries.push_back( rEntry ); + } + } + + //--------------------------------------------------------------------------------------------------------- + // append user specific menu entry + // We must find unique name for it by using special prefix + // and next count of user setted entries! + // Look for double menu entries here too ... may be some seperator items are supeflous ... + void AppendUserEntry( SvtDynMenuEntry& rEntry ) + { + if( + ( lUserEntries.size() < 1 ) || + ( lUserEntries.rbegin()->sURL != rEntry.sURL ) + ) + { + rEntry.sName = PATHPREFIX_USER; + rEntry.sName += OUString::valueOf( (sal_Int32)impl_getNextUserEntryNr() ); + lUserEntries.push_back( rEntry ); + } + } + + //--------------------------------------------------------------------------------------------------------- + // the only way to free memory! + void Clear() + { + lSetupEntries.clear(); + lUserEntries.clear(); + } + + //--------------------------------------------------------------------------------------------------------- + // convert internal list to external format + // for using it on right menus realy + // Notice: We build a property list with 4 entries and set it on result list then. + // The while-loop starts with pointer on internal member list lSetupEntries, change to + // lUserEntries then and stop after that with NULL! + // Separator entries will be packed in another way then normal entries! We define + // special strings "sEmpty" and "sSeperator" to perform too ... + Sequence< Sequence< PropertyValue > > GetList() const + { + sal_Int32 nSetupCount = (sal_Int32)lSetupEntries.size(); + sal_Int32 nUserCount = (sal_Int32)lUserEntries.size(); + sal_Int32 nStep = 0; + Sequence< PropertyValue > lProperties ( PROPERTYCOUNT ); + Sequence< Sequence< PropertyValue > > lResult ( nSetupCount+nUserCount ); + OUString sSeperator ( RTL_CONSTASCII_USTRINGPARAM("private:separator") ); + OUString sEmpty ; + const vector< SvtDynMenuEntry >* pList = &lSetupEntries; + + lProperties[OFFSET_URL ].Name = PROPERTYNAME_URL ; + lProperties[OFFSET_TITLE ].Name = PROPERTYNAME_TITLE ; + lProperties[OFFSET_IMAGEIDENTIFIER].Name = PROPERTYNAME_IMAGEIDENTIFIER ; + lProperties[OFFSET_TARGETNAME ].Name = PROPERTYNAME_TARGETNAME ; + + while( pList != NULL ) + { + for( vector< SvtDynMenuEntry >::const_iterator pItem =pList->begin(); + pItem!=pList->end() ; + ++pItem ) + { + if( pItem->sURL == sSeperator ) + { + lProperties[OFFSET_URL ].Value <<= sSeperator ; + lProperties[OFFSET_TITLE ].Value <<= sEmpty ; + lProperties[OFFSET_IMAGEIDENTIFIER ].Value <<= sEmpty ; + lProperties[OFFSET_TARGETNAME ].Value <<= sEmpty ; + } + else + { + lProperties[OFFSET_URL ].Value <<= pItem->sURL ; + lProperties[OFFSET_TITLE ].Value <<= pItem->sTitle ; + lProperties[OFFSET_IMAGEIDENTIFIER ].Value <<= pItem->sImageIdentifier; + lProperties[OFFSET_TARGETNAME ].Value <<= pItem->sTargetName ; + } + lResult[nStep] = lProperties; + ++nStep; + } + if( pList == &lSetupEntries ) + pList = &lUserEntries; + else + pList = NULL; + } + return lResult; + } + + private: + //--------------------------------------------------------------------------------------------------------- + // search for an entry named "ux" with x=[0..i] inside our menu + // which has set highest number x. So we can add another user entry. + sal_Int32 impl_getNextUserEntryNr() const + { + sal_Int32 nNr = 0; + for( vector< SvtDynMenuEntry >::const_iterator pItem =lUserEntries.begin(); + pItem!=lUserEntries.end() ; + ++pItem ) + { + if( pItem->sName.compareTo( PATHPREFIX_USER, 1 ) == 0 ) + { + OUString sNr = pItem->sName.copy( 1, pItem->sName.getLength()-1 ); + sal_Int32 nCheckNr = sNr.toInt32(); + if( nCheckNr > nNr ) + nNr = nCheckNr; + } + } + // Attention: Code isn't prepared for recyling of unused fragmented numbers! + // If we reach end of sal_Int32 range ... we must stop further working ... + // But I think nobody expand a menu to more then 1000 ... 100000 ... entries ... or? + DBG_ASSERT( !(nNr>0x7fffffff), "Menu::impl_getNextUserEntryNr()\nUser count can be out of range next time ...\n" ); + return nNr; + } + + private: + vector< SvtDynMenuEntry > lSetupEntries; + vector< SvtDynMenuEntry > lUserEntries ; +}; + +class SvtDynamicMenuOptions_Impl : public ConfigItem +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + SvtDynamicMenuOptions_Impl(); + ~SvtDynamicMenuOptions_Impl(); + + //--------------------------------------------------------------------------------------------------------- + // overloaded methods of baseclass + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short called for notify of configmanager + @descr These method is called from the ConfigManager before application ends or from the + PropertyChangeListener if the sub tree broadcasts changes. You must update your + internal values. + + @seealso baseclass ConfigItem + + @param "lPropertyNames" is the list of properties which should be updated. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void Notify( const Sequence< OUString >& lPropertyNames ); + + /*-****************************************************************************************************//** + @short write changes to configuration + @descr These method writes the changed values into the sub tree + and should always called in our destructor to guarantee consistency of config data. + + @seealso baseclass ConfigItem + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void Commit(); + + //--------------------------------------------------------------------------------------------------------- + // public interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short base implementation of public interface for "SvtDynamicMenuOptions"! + @descr These class is used as static member of "SvtDynamicMenuOptions" ... + => The code exist only for one time and isn't duplicated for every instance! + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void Clear ( EDynamicMenuType eMenu ); + Sequence< Sequence< PropertyValue > > GetMenu ( EDynamicMenuType eMenu ) const ; + void AppendItem ( EDynamicMenuType eMenu , + const OUString& sURL , + const OUString& sTitle , + const OUString& sImageIdentifier, + const OUString& sTargetName ); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return list of key names of our configuration management which represent oue module tree + @descr These methods return the current list of key names! We need it to get needed values from our + configuration management and support dynamical menu item lists! + + @seealso - + + @param "nNewCount" , returns count of menu entries for "new" + @param "nWizardCount" , returns count of menu entries for "wizard" + @return A list of configuration key names is returned. + + @onerror - + *//*-*****************************************************************************************************/ + + Sequence< OUString > impl_GetPropertyNames( sal_uInt32& nNewCount, sal_uInt32& nWizardCount, sal_uInt32& nHelpBookmarksCount ); + + /*-****************************************************************************************************//** + @short sort given source list and expand it for all well known properties to destination + @descr We must support sets of entries with count inside the name .. but some of them could be missing! + e.g. s1-s2-s3-s0-u1-s6-u5-u7 + Then we must sort it by name and expand it to the follow one: + sSetNode/s0/URL + sSetNode/s0/Title + sSetNode/s0/... + sSetNode/s1/URL + sSetNode/s1/Title + sSetNode/s1/... + ... + sSetNode/s6/URL + sSetNode/s6/Title + sSetNode/s6/... + sSetNode/u1/URL + sSetNode/u1/Title + sSetNode/u1/... + ... + sSetNode/u7/URL + sSetNode/u7/Title + sSetNode/u7/... + Rules: We start with all setup written entries names "sx" and x=[0..n]. + Then we handle all "ux" items. Inside these blocks we sort it ascending by number. + + @attention We add these expanded list to the end of given "lDestination" list! + So we must start on "lDestination.getLength()". + Reallocation of memory of destination list is done by us! + + @seealso method impl_GetPropertyNames() + + @param "lSource" , original list (e.g. [m1-m2-m3-m6-m0] ) + @param "lDestination" , destination of operation + @param "sSetNode" , name of configuration set to build complete path + @return A list of configuration key names is returned. + + @onerror - + *//*-*****************************************************************************************************/ + + void impl_SortAndExpandPropertyNames( const Sequence< OUString >& lSource , + Sequence< OUString >& lDestination , + const OUString& sSetNode ); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + SvtDynMenu m_aNewMenu ; + SvtDynMenu m_aWizardMenu ; + SvtDynMenu m_aHelpBookmarksMenu ; +}; + +//_________________________________________________________________________________________________________________ +// definitions +//_________________________________________________________________________________________________________________ + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtDynamicMenuOptions_Impl::SvtDynamicMenuOptions_Impl() + // Init baseclasses first + : ConfigItem( ROOTNODE_MENUS ) + // Init member then... +{ + // Get names and values of all accessable menu entries and fill internal structures. + // See impl_GetPropertyNames() for further informations. + sal_uInt32 nNewCount = 0; + sal_uInt32 nWizardCount = 0; + sal_uInt32 nHelpBookmarksCount = 0; + Sequence< OUString > lNames = impl_GetPropertyNames ( nNewCount , + nWizardCount , + nHelpBookmarksCount ); + Sequence< Any > lValues = GetProperties ( lNames ); + + // Safe impossible cases. + // We need values from ALL configuration keys. + // Follow assignment use order of values in relation to our list of key names! + DBG_ASSERT( !(lNames.getLength()!=lValues.getLength()), "SvtDynamicMenuOptions_Impl::SvtDynamicMenuOptions_Impl()\nI miss some values of configuration keys!\n" ); + + // Copy values from list in right order to ouer internal member. + // Attention: List for names and values have an internal construction pattern! + // + // first "New" menu ... + // Name Value + // /New/1/URL "private:factory/swriter" + // /New/1/Title "Neues Writer Dokument" + // /New/1/ImageIdentifier "icon_writer" + // /New/1/TargetName "_blank" + // + // /New/2/URL "private:factory/scalc" + // /New/2/Title "Neues Calc Dokument" + // /New/2/ImageIdentifier "icon_calc" + // /New/2/TargetName "_blank" + // + // second "Wizard" menu ... + // /Wizard/1/URL "file://b" + // /Wizard/1/Title "MalWas" + // /Wizard/1/ImageIdentifier "icon_?" + // /Wizard/1/TargetName "_self" + // + // ... and so on ... + + sal_uInt32 nItem = 0 ; + sal_uInt32 nPosition = 0 ; + OUString sName ; + + // We must use these one instance object(!) to get information about installed modules. + // These information are used to filter menu entries wich need not installed modules ... + // Such entries shouldnt be available then! + // see impl_IsEntrySupported() too + SvtModuleOptions aModuleOptions; + + // Get names/values for new menu. + // 4 subkeys for every item! + for( nItem=0; nItem>= aItem.sURL ; + ++nPosition; + lValues[nPosition] >>= aItem.sTitle ; + ++nPosition; + lValues[nPosition] >>= aItem.sImageIdentifier ; + ++nPosition; + lValues[nPosition] >>= aItem.sTargetName ; + ++nPosition; + m_aNewMenu.AppendSetupEntry( aItem ); + } + + // Attention: Don't reset nPosition here! + + // Get names/values for wizard menu. + // 4 subkeys for every item! + for( nItem=0; nItem>= aItem.sURL ; + ++nPosition; + lValues[nPosition] >>= aItem.sTitle ; + ++nPosition; + lValues[nPosition] >>= aItem.sImageIdentifier ; + ++nPosition; + lValues[nPosition] >>= aItem.sTargetName ; + ++nPosition; + m_aWizardMenu.AppendSetupEntry( aItem ); + } + + // Attention: Don't reset nPosition here! + + // Get names/values for wizard menu. + // 4 subkeys for every item! + for( nItem=0; nItem>= aItem.sURL ; + ++nPosition; + lValues[nPosition] >>= aItem.sTitle ; + ++nPosition; + lValues[nPosition] >>= aItem.sImageIdentifier ; + ++nPosition; + lValues[nPosition] >>= aItem.sTargetName ; + ++nPosition; + m_aHelpBookmarksMenu.AppendSetupEntry( aItem ); + } + +/*TODO: Not used in the moment! see Notify() ... + // Enable notification mechanism of ouer baseclass. + // We need it to get information about changes outside these class on ouer used configuration keys! + EnableNotification( lNames ); +*/ +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtDynamicMenuOptions_Impl::~SvtDynamicMenuOptions_Impl() +{ + // We must save our current values .. if user forget it! + if( IsModified() == sal_True ) + { + Commit(); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtDynamicMenuOptions_Impl::Notify( const Sequence< OUString >& ) +{ + DBG_ASSERT( sal_False, "SvtDynamicMenuOptions_Impl::Notify()\nNot implemented yet! I don't know how I can handle a dynamical list of unknown properties ...\n" ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtDynamicMenuOptions_Impl::Commit() +{ + DBG_ERROR( "SvtDynamicMenuOptions_Impl::Commit()\nNot implemented yet!\n" ); + /* + // Write all properties! + // Delete complete sets first. + ClearNodeSet( SETNODE_NEWMENU ); + ClearNodeSet( SETNODE_WIZARDMENU ); + ClearNodeSet( SETNODE_HELPBOOKMARKS ); + + MenuEntry aItem ; + OUString sNode ; + Sequence< PropertyValue > lPropertyValues( PROPERTYCOUNT ); + sal_uInt32 nItem = 0 ; + + // Copy "new" menu entries to save-list! + sal_uInt32 nNewCount = m_aNewMenu.size(); + for( nItem=0; nItem > SvtDynamicMenuOptions_Impl::GetMenu( EDynamicMenuType eMenu ) const +{ + Sequence< Sequence< PropertyValue > > lReturn; + switch( eMenu ) + { + case E_NEWMENU : { + lReturn = m_aNewMenu.GetList(); + } + break; + + case E_WIZARDMENU : { + lReturn = m_aWizardMenu.GetList(); + } + break; + + case E_HELPBOOKMARKS : { + lReturn = m_aHelpBookmarksMenu.GetList(); + } + break; + } + return lReturn; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtDynamicMenuOptions_Impl::AppendItem( EDynamicMenuType eMenu , + const OUString& sURL , + const OUString& sTitle , + const OUString& sImageIdentifier, + const OUString& sTargetName ) +{ + SvtDynMenuEntry aItem( sURL, sTitle, sImageIdentifier, sTargetName ); + + switch( eMenu ) + { + case E_NEWMENU : { + m_aNewMenu.AppendUserEntry( aItem ); + SetModified(); + } + break; + + case E_WIZARDMENU : { + m_aWizardMenu.AppendUserEntry( aItem ); + SetModified(); + } + break; + + case E_HELPBOOKMARKS : { + m_aHelpBookmarksMenu.AppendUserEntry( aItem ); + SetModified(); + } + break; + } +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Sequence< OUString > SvtDynamicMenuOptions_Impl::impl_GetPropertyNames( sal_uInt32& nNewCount, sal_uInt32& nWizardCount, sal_uInt32& nHelpBookmarksCount ) +{ + // First get ALL names of current existing list items in configuration! + Sequence< OUString > lNewItems = GetNodeNames( SETNODE_NEWMENU ); + Sequence< OUString > lWizardItems = GetNodeNames( SETNODE_WIZARDMENU ); + Sequence< OUString > lHelpBookmarksItems = GetNodeNames( SETNODE_HELPBOOKMARKS ); + + // Get information about list counts ... + nNewCount = lNewItems.getLength (); + nWizardCount = lWizardItems.getLength (); + nHelpBookmarksCount = lHelpBookmarksItems.getLength(); + + // Sort and expand all three list to result list ... + Sequence< OUString > lProperties; + impl_SortAndExpandPropertyNames( lNewItems , lProperties, SETNODE_NEWMENU ); + impl_SortAndExpandPropertyNames( lWizardItems , lProperties, SETNODE_WIZARDMENU ); + impl_SortAndExpandPropertyNames( lHelpBookmarksItems, lProperties, SETNODE_HELPBOOKMARKS ); + + // Return result. + return lProperties; +} + +//***************************************************************************************************************** +// private helper +//***************************************************************************************************************** +class CountWithPrefixSort +{ + public: + int operator() ( const OUString& s1 , + const OUString& s2 ) const + { + // Get order numbers from entry name without prefix. + // e.g. "m10" => 10 + // "m5" => 5 + sal_Int32 n1 = s1.copy( 1, s1.getLength()-1 ).toInt32(); + sal_Int32 n2 = s2.copy( 1, s2.getLength()-1 ).toInt32(); + // MUST be in [0,1] ... because it's a difference between + // insert-positions of given entries in sorted list! + return( n1& lSource , + Sequence< OUString >& lDestination , + const OUString& sSetNode ) +{ + OUString sFixPath ; + vector< OUString > lTemp ; + sal_Int32 nSourceCount = lSource.getLength() ; + sal_Int32 nDestinationStep = lDestination.getLength() ; // start on end of current list ...! + + lDestination.realloc( (nSourceCount*PROPERTYCOUNT)+nDestinationStep ); // get enough memory for copy operations after nDestination ... + + // Copy all items to temp. vector to use fast sort operations :-) + for( sal_Int32 nSourceStep=0; nSourceStep::const_iterator pItem =lTemp.begin() ; + pItem!=lTemp.end() ; + ++pItem ) + { + sFixPath = sSetNode ; + sFixPath += PATHDELIMITER ; + sFixPath += *pItem ; + sFixPath += PATHDELIMITER ; + + lDestination[nDestinationStep] = sFixPath ; + lDestination[nDestinationStep] += PROPERTYNAME_URL ; + ++nDestinationStep; + lDestination[nDestinationStep] = sFixPath ; + lDestination[nDestinationStep] += PROPERTYNAME_TITLE ; + ++nDestinationStep; + lDestination[nDestinationStep] = sFixPath ; + lDestination[nDestinationStep] += PROPERTYNAME_IMAGEIDENTIFIER ; + ++nDestinationStep; + lDestination[nDestinationStep] = sFixPath ; + lDestination[nDestinationStep] += PROPERTYNAME_TARGETNAME ; + ++nDestinationStep; + } +} + +//***************************************************************************************************************** +// initialize static member +// DON'T DO IT IN YOUR HEADER! +// see definition for further informations +//***************************************************************************************************************** +SvtDynamicMenuOptions_Impl* SvtDynamicMenuOptions::m_pDataContainer = NULL ; +sal_Int32 SvtDynamicMenuOptions::m_nRefCount = 0 ; + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtDynamicMenuOptions::SvtDynamicMenuOptions() +{ + // Global access, must be guarded (multithreading!). + MutexGuard aGuard( GetOwnStaticMutex() ); + // Increase ouer refcount ... + ++m_nRefCount; + // ... and initialize ouer data container only if it not already exist! + if( m_pDataContainer == NULL ) + { + m_pDataContainer = new SvtDynamicMenuOptions_Impl; + ItemHolder1::holdConfigItem(E_DYNAMICMENUOPTIONS); + } +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtDynamicMenuOptions::~SvtDynamicMenuOptions() +{ + // Global access, must be guarded (multithreading!) + MutexGuard aGuard( GetOwnStaticMutex() ); + // Decrease ouer refcount. + --m_nRefCount; + // If last instance was deleted ... + // we must destroy ouer static data container! + if( m_nRefCount <= 0 ) + { + delete m_pDataContainer; + m_pDataContainer = NULL; + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtDynamicMenuOptions::Clear( EDynamicMenuType eMenu ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->Clear( eMenu ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +Sequence< Sequence< PropertyValue > > SvtDynamicMenuOptions::GetMenu( EDynamicMenuType eMenu ) const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetMenu( eMenu ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtDynamicMenuOptions::AppendItem( EDynamicMenuType eMenu , + const OUString& sURL , + const OUString& sTitle , + const OUString& sImageIdentifier, + const OUString& sTargetName ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->AppendItem( eMenu, sURL, sTitle, sImageIdentifier, sTargetName ); +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Mutex& SvtDynamicMenuOptions::GetOwnStaticMutex() +{ + // Initialize static mutex only for one time! + static Mutex* pMutex = NULL; + // If these method first called (Mutex not already exist!) ... + if( pMutex == NULL ) + { + // ... we must create a new one. Protect follow code with the global mutex - + // It must be - we create a static variable! + MutexGuard aGuard( Mutex::getGlobalMutex() ); + // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! + if( pMutex == NULL ) + { + // Create the new mutex and set it for return on static variable. + static Mutex aMutex; + pMutex = &aMutex; + } + } + // Return new created or already existing mutex object. + return *pMutex; +} diff --git a/unotools/source/config/eventcfg.cxx b/unotools/source/config/eventcfg.cxx new file mode 100644 index 000000000000..3155f4ac2fa7 --- /dev/null +++ b/unotools/source/config/eventcfg.cxx @@ -0,0 +1,458 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: eventcfg.cxx,v $ + * $Revision: 1.8.24.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef __SGI_STL_HASH_MAP +#include +#endif +#include +#include + +#include + +#include + +using namespace ::std ; +using namespace ::utl ; +using namespace ::rtl ; +using namespace ::osl ; +using namespace ::com::sun::star::uno ; +using namespace ::com::sun::star; + +#define ROOTNODE_EVENTS OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Events/ApplicationEvents" )) +#define PATHDELIMITER OUString(RTL_CONSTASCII_USTRINGPARAM("/")) +#define SETNODE_BINDINGS OUString(RTL_CONSTASCII_USTRINGPARAM("Bindings" )) +#define PROPERTYNAME_BINDINGURL OUString(RTL_CONSTASCII_USTRINGPARAM("BindingURL")) + +const char* pEventAsciiNames[] = +{ +"OnStartApp", +"OnCloseApp", +"OnCreate", +"OnNew", +"OnLoadFinished", +"OnLoad", +"OnPrepareUnload", +"OnUnload", +"OnSave", +"OnSaveDone", +"OnSaveFailed", +"OnSaveAs", +"OnSaveAsDone", +"OnSaveAsFailed", +"OnCopyTo", +"OnCopyToDone", +"OnCopyToFailed", +"OnFocus", +"OnUnfocus", +"OnPrint", +"OnViewCreated", +"OnPrepareViewClosing", +"OnViewClosed", +"OnModifyChanged", +"OnTitleChanged", +"OnVisAreaChanged", +"OnModeChanged", +"OnStorageChanged" +}; + +GlobalEventConfig_Impl::GlobalEventConfig_Impl() + : ConfigItem( ROOTNODE_EVENTS, CONFIG_MODE_IMMEDIATE_UPDATE ) +{ + // the supported event names + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_STARTAPP] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_CLOSEAPP] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_DOCCREATED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_CREATEDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_LOADFINISHED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_OPENDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_PREPARECLOSEDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_CLOSEDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEDOCDONE] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEDOCFAILED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEASDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEASDOCDONE] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEASDOCFAILED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVETODOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVETODOCDONE] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVETODOCFAILED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_ACTIVATEDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_DEACTIVATEDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_PRINTDOC] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_VIEWCREATED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_PREPARECLOSEVIEW] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_CLOSEVIEW] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_MODIFYCHANGED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_TITLECHANGED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_VISAREACHANGED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_MODECHANGED] ) ); + m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_STORAGECHANGED] ) ); + + initBindingInfo(); + +/*TODO: Not used in the moment! see Notify() ... + // Enable notification mechanism of our baseclass. + // We need it to get information about changes outside these class on our used configuration keys! */ + Sequence< OUString > aNotifySeq( 1 ); + aNotifySeq[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "Events" )); + EnableNotification( aNotifySeq, sal_True ); +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +GlobalEventConfig_Impl::~GlobalEventConfig_Impl() +{ + // We must save our current values .. if user forget it! + if( IsModified() == sal_True ) + { + Commit(); + } +} + +::rtl::OUString GlobalEventConfig_Impl::GetEventName( sal_Int32 nIndex ) +{ + if ( nIndex < (sal_Int32) m_supportedEvents.size() ) + return m_supportedEvents[nIndex]; + else + return rtl::OUString(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void GlobalEventConfig_Impl::Notify( const Sequence< OUString >& ) +{ + MutexGuard aGuard( GlobalEventConfig::GetOwnStaticMutex() ); + + initBindingInfo(); + + // dont forget to update all existing frames and her might cached dispatch objects! + // But look for already killed frames. We hold weak references instead of hard ones ... + for (FrameVector::const_iterator pIt = m_lFrames.begin(); + pIt != m_lFrames.end() ; + ++pIt ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame(pIt->get(), ::com::sun::star::uno::UNO_QUERY); + if (xFrame.is()) + xFrame->contextChanged(); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void GlobalEventConfig_Impl::Commit() +{ + //DF need to check it this is correct?? + OSL_TRACE("In GlobalEventConfig_Impl::Commit"); + EventBindingHash::const_iterator it = m_eventBindingHash.begin(); + EventBindingHash::const_iterator it_end = m_eventBindingHash.end(); + // clear the existing nodes + ClearNodeSet( SETNODE_BINDINGS ); + Sequence< beans::PropertyValue > seqValues( 1 ); + OUString sNode; + static const OUString sPrefix(SETNODE_BINDINGS + PATHDELIMITER + OUString::createFromAscii("BindingType['")); + static const OUString sPostfix(OUString::createFromAscii("']") + PATHDELIMITER + PROPERTYNAME_BINDINGURL); + //step through the list of events + for(int i=0;it!=it_end;++it,++i) + { + //no point in writing out empty bindings! + if(it->second.getLength() == 0 ) + continue; + sNode = sPrefix + it->first + sPostfix; + OSL_TRACE("writing binding for: %s",::rtl::OUStringToOString(sNode , RTL_TEXTENCODING_ASCII_US ).pData->buffer); + seqValues[ 0 ].Name = sNode; + seqValues[ 0 ].Value <<= it->second; + //write the data to the registry + SetSetProperties(SETNODE_BINDINGS,seqValues); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void GlobalEventConfig_Impl::EstablishFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame) +{ + // check if frame already exists inside list + // ignore double registrations + // every frame must be notified one times only! + ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XFrame > xWeak(xFrame); + FrameVector::const_iterator pIt = ::std::find(m_lFrames.begin(), m_lFrames.end(), xWeak); + if (pIt == m_lFrames.end()) + m_lFrames.push_back(xWeak); +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +void GlobalEventConfig_Impl::initBindingInfo() +{ + // Get ALL names of current existing list items in configuration! + Sequence< OUString > lEventNames = GetNodeNames( SETNODE_BINDINGS, utl::CONFIG_NAME_LOCAL_PATH ); + + OUString aSetNode( SETNODE_BINDINGS ); + aSetNode += PATHDELIMITER; + + OUString aCommandKey( PATHDELIMITER ); + aCommandKey += PROPERTYNAME_BINDINGURL; + + // Expand all keys + Sequence< OUString > lMacros(1); + for (sal_Int32 i=0; ibuffer); + Sequence< Any > lValues = GetProperties( lMacros ); + OUString sMacroURL; + if( lValues.getLength() > 0 ) + { + lValues[0] >>= sMacroURL; + sal_Int32 startIndex = lEventNames[i].indexOf('\''); + sal_Int32 endIndex = lEventNames[i].lastIndexOf('\''); + if( startIndex >=0 && endIndex > 0 ) + { + startIndex++; + OUString eventName = lEventNames[i].copy(startIndex,endIndex-startIndex); + m_eventBindingHash[ eventName ] = sMacroURL; + } + } + } +} + +Reference< container::XNameReplace > SAL_CALL GlobalEventConfig_Impl::getEvents() throw (::com::sun::star::uno::RuntimeException) +{ + //how to return this object as an XNameReplace? + Reference< container::XNameReplace > ret; + return ret; +} + +void SAL_CALL GlobalEventConfig_Impl::replaceByName( const OUString& aName, const Any& aElement ) throw (lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, RuntimeException) +{ + Sequence< beans::PropertyValue > props; + //DF should we prepopulate the hash with a list of valid event Names? + if( sal_False == ( aElement >>= props ) ) + { + throw lang::IllegalArgumentException( OUString(), + Reference< XInterface > (), 2); + } + OUString macroURL; + sal_Int32 nPropCount = props.getLength(); + for( sal_Int32 index = 0 ; index < nPropCount ; ++index ) + { + if ( props[ index ].Name.compareToAscii( "Script" ) == 0 ) + props[ index ].Value >>= macroURL; + } + m_eventBindingHash[ aName ] = macroURL; + SetModified(); +} + +Any SAL_CALL GlobalEventConfig_Impl::getByName( const OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, RuntimeException) +{ + Any aRet; + Sequence< beans::PropertyValue > props(2); + props[0].Name = OUString::createFromAscii("EventType"); + props[0].Value <<= OUString::createFromAscii("Script"); + props[1].Name = OUString::createFromAscii("Script"); + EventBindingHash::const_iterator it = m_eventBindingHash.find( aName ); + if( it != m_eventBindingHash.end() ) + { + props[1].Value <<= it->second; + } + else + { + // not yet accessed - is it a supported name? + SupportedEventsVector::const_iterator pos = ::std::find( + m_supportedEvents.begin(), m_supportedEvents.end(), aName ); + if ( pos == m_supportedEvents.end() ) + throw container::NoSuchElementException( aName, NULL ); + + props[1].Value <<= OUString(); + } + aRet <<= props; + return aRet; +} + +Sequence< OUString > SAL_CALL GlobalEventConfig_Impl::getElementNames( ) throw (RuntimeException) +{ + const ::rtl::OUString* pRet = m_supportedEvents.empty() ? NULL : &m_supportedEvents[0]; + return uno::Sequence< ::rtl::OUString >(pRet, m_supportedEvents.size()); +} + +sal_Bool SAL_CALL GlobalEventConfig_Impl::hasByName( const OUString& aName ) throw (RuntimeException) +{ + if ( m_eventBindingHash.find( aName ) != m_eventBindingHash.end() ) + return sal_True; + + // never accessed before - is it supported in general? + SupportedEventsVector::const_iterator pos = ::std::find( + m_supportedEvents.begin(), m_supportedEvents.end(), aName ); + if ( pos != m_supportedEvents.end() ) + return sal_True; + + return sal_False; +} + +Type SAL_CALL GlobalEventConfig_Impl::getElementType( ) throw (RuntimeException) +{ + //DF definitly not sure about this?? + return ::getCppuType((const Sequence*)0); +} + +sal_Bool SAL_CALL GlobalEventConfig_Impl::hasElements( ) throw (RuntimeException) +{ + return ( m_eventBindingHash.empty() ); +} + +// and now the wrapper + + +//initialize static member +GlobalEventConfig_Impl* GlobalEventConfig::m_pImpl = NULL ; +sal_Int32 GlobalEventConfig::m_nRefCount = 0 ; + +GlobalEventConfig::GlobalEventConfig() +{ + // Global access, must be guarded (multithreading!). + MutexGuard aGuard( GetOwnStaticMutex() ); + // Increase our refcount ... + ++m_nRefCount; + // ... and initialize our data container only if it not already exist! + if( m_pImpl == NULL ) + { + m_pImpl = new GlobalEventConfig_Impl; + ItemHolder1::holdConfigItem(E_EVENTCFG); + } +} + +GlobalEventConfig::~GlobalEventConfig() +{ + // Global access, must be guarded (multithreading!) + MutexGuard aGuard( GetOwnStaticMutex() ); + // Decrease our refcount. + --m_nRefCount; + // If last instance was deleted ... + // we must destroy our static data container! + if( m_nRefCount <= 0 ) + { + delete m_pImpl; + m_pImpl = NULL; + } +} + +void GlobalEventConfig::EstablishFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pImpl->EstablishFrameCallback( xFrame ); +} + +Reference< container::XNameReplace > SAL_CALL GlobalEventConfig::getEvents() throw (::com::sun::star::uno::RuntimeException) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + Reference< container::XNameReplace > ret(this); + return ret; +} + +void SAL_CALL GlobalEventConfig::replaceByName( const OUString& aName, const Any& aElement ) throw (lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, RuntimeException) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pImpl->replaceByName( aName, aElement ); +} +Any SAL_CALL GlobalEventConfig::getByName( const OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, RuntimeException) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pImpl->getByName( aName ); +} +Sequence< OUString > SAL_CALL GlobalEventConfig::getElementNames( ) throw (RuntimeException) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pImpl->getElementNames( ); +} +sal_Bool SAL_CALL GlobalEventConfig::hasByName( const OUString& aName ) throw (RuntimeException) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pImpl->hasByName( aName ); +} +Type SAL_CALL GlobalEventConfig::getElementType( ) throw (RuntimeException) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pImpl->getElementType( ); +} +sal_Bool SAL_CALL GlobalEventConfig::hasElements( ) throw (RuntimeException) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pImpl->hasElements( ); +} + +Mutex& GlobalEventConfig::GetOwnStaticMutex() +{ + // Initialize static mutex only for one time! + static Mutex* pMutex = NULL; + // If these method first called (Mutex not already exist!) ... + if( pMutex == NULL ) + { + // ... we must create a new one. Protect following code with + // the global mutex - + // It must be - we create a static variable! + MutexGuard aGuard( Mutex::getGlobalMutex() ); + // We must check our pointer again - because it can be that + // another instance of our class will be faster then these! + if( pMutex == NULL ) + { + // Create the new mutex and set it for return on static variable. + static Mutex aMutex; + pMutex = &aMutex; + } + } + // Return new created or already existing mutex object. + return *pMutex; +} + +::rtl::OUString GlobalEventConfig::GetEventName( sal_Int32 nIndex ) +{ + return GlobalEventConfig().m_pImpl->GetEventName( nIndex ); +} + diff --git a/unotools/source/config/extendedsecurityoptions.cxx b/unotools/source/config/extendedsecurityoptions.cxx new file mode 100644 index 000000000000..b4d21f79246b --- /dev/null +++ b/unotools/source/config/extendedsecurityoptions.cxx @@ -0,0 +1,541 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: extendedsecurityoptions.cxx,v $ + * $Revision: 1.10 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include "itemholder1.hxx" + +//_________________________________________________________________________________________________________________ +// namespaces +//_________________________________________________________________________________________________________________ + +using namespace ::utl ; +using namespace ::rtl ; +using namespace ::osl ; +using namespace ::com::sun::star::uno ; + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +#define ROOTNODE_SECURITY OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Security")) + +#define SECURE_EXTENSIONS_SET OUString(RTL_CONSTASCII_USTRINGPARAM("SecureExtensions")) +#define EXTENSION_PROPNAME OUString(RTL_CONSTASCII_USTRINGPARAM("/Extension")) + +#define PROPERTYNAME_HYPERLINKS_OPEN OUString(RTL_CONSTASCII_USTRINGPARAM("Hyperlinks/Open")) + +#define PROPERTYHANDLE_HYPERLINKS_OPEN 0 + +#define PROPERTYCOUNT 1 + +//_________________________________________________________________________________________________________________ +// private declarations! +//_________________________________________________________________________________________________________________ + +struct OUStringHashCode +{ + size_t operator()( const ::rtl::OUString& sString ) const + { + return sString.hashCode(); + } +}; + +class ExtensionHashMap : public ::std::hash_map< ::rtl::OUString, + sal_Int32, + OUStringHashCode, + ::std::equal_to< ::rtl::OUString > > +{ + public: + inline void free() + { + ExtensionHashMap().swap( *this ); + } +}; + +class SvtExtendedSecurityOptions_Impl : public ConfigItem +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + SvtExtendedSecurityOptions_Impl(); + ~SvtExtendedSecurityOptions_Impl(); + + //--------------------------------------------------------------------------------------------------------- + // overloaded methods of baseclass + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short called for notify of configmanager + @descr These method is called from the ConfigManager before application ends or from the + PropertyChangeListener if the sub tree broadcasts changes. You must update your + internal values. + + @seealso baseclass ConfigItem + + @param "seqPropertyNames" is the list of properties which should be updated. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void Notify( const Sequence< OUString >& seqPropertyNames ); + + /*-****************************************************************************************************//** + @short write changes to configuration + @descr These method writes the changed values into the sub tree + and should always called in our destructor to guarantee consistency of config data. + + @seealso baseclass ConfigItem + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void Commit(); + + //--------------------------------------------------------------------------------------------------------- + // public interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short Access method to check for security problems + @descr Different methods to check for security related problems. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + sal_Bool IsSecureHyperlink( const rtl::OUString& aURL ) const; + Sequence< rtl::OUString > GetSecureExtensionList() const; + + SvtExtendedSecurityOptions::OpenHyperlinkMode GetOpenHyperlinkMode(); + void SetOpenHyperlinkMode( SvtExtendedSecurityOptions::OpenHyperlinkMode aMode ); + sal_Bool IsOpenHyperlinkModeReadOnly() const; + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return list of key names of ouer configuration management which represent oue module tree + @descr These methods return a static const list of key names. We need it to get needed values from our + configuration management. + + @seealso - + + @param - + @return A list of needed configuration keys is returned. + + @onerror - + *//*-*****************************************************************************************************/ + + static Sequence< OUString > GetPropertyNames(); + + /*-****************************************************************************************************//** + @short Fills the hash map with all extensions known to be secure + @descr These methods fills the given hash map object with all extensions known to be secure. + + @seealso - + + @param aHashMap + A hash map to be filled with secure extension strings. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + void FillExtensionHashMap( ExtensionHashMap& aHashMap ); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + OUString m_aSecureExtensionsSetName; + OUString m_aExtensionPropName; + + SvtExtendedSecurityOptions::OpenHyperlinkMode m_eOpenHyperlinkMode; + sal_Bool m_bROOpenHyperlinkMode; + ExtensionHashMap m_aExtensionHashMap; +}; + +//_________________________________________________________________________________________________________________ +// definitions +//_________________________________________________________________________________________________________________ + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtExtendedSecurityOptions_Impl::SvtExtendedSecurityOptions_Impl() + // Init baseclasses first + : ConfigItem ( ROOTNODE_SECURITY ), + m_aSecureExtensionsSetName( SECURE_EXTENSIONS_SET ), + m_aExtensionPropName( EXTENSION_PROPNAME ), + m_bROOpenHyperlinkMode(sal_False) + // Init member then. +{ + // Fill the extension hash map with all secure extension strings + FillExtensionHashMap( m_aExtensionHashMap ); + + Sequence< OUString > seqNames = GetPropertyNames(); + Sequence< Any > seqValues = GetProperties( seqNames ); + Sequence< sal_Bool > seqRO = GetReadOnlyStates ( seqNames ); + + sal_Int32 nPropertyCount = seqValues.getLength(); + for( sal_Int32 nProperty=0; nProperty>= nMode ) + m_eOpenHyperlinkMode = (SvtExtendedSecurityOptions::OpenHyperlinkMode)nMode; + else { + DBG_ERROR("Wrong type for Open mode!"); + } + m_bROOpenHyperlinkMode = seqRO[nProperty]; + } + break; + } + } + + // Enable notification mechanism of our baseclass. + // We need it to get information about changes outside these class on ouer used configuration keys! + Sequence< OUString > seqNotifyNames( 1 ); + seqNotifyNames[0] = m_aSecureExtensionsSetName; + EnableNotification( seqNotifyNames ); +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtExtendedSecurityOptions_Impl::~SvtExtendedSecurityOptions_Impl() +{ + // We must save our current values .. if user forget it! + if( IsModified() == sal_True ) + { + Commit(); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtExtendedSecurityOptions_Impl::Notify( const Sequence< OUString >& ) +{ + // Not implemented +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtExtendedSecurityOptions_Impl::Commit() +{ + // Get names of supported properties, create a list for values and copy current values to it. + Sequence< OUString > seqNames = GetPropertyNames (); + sal_Int32 nCount = seqNames.getLength(); + Sequence< Any > seqValues ( nCount ); + for( sal_Int32 nProperty=0; nProperty SvtExtendedSecurityOptions_Impl::GetSecureExtensionList() const +{ + Sequence< OUString > aResult( m_aExtensionHashMap.size() ); + + sal_Int32 nIndex = 0; + for ( ExtensionHashMap::const_iterator pIter = m_aExtensionHashMap.begin(); + pIter != m_aExtensionHashMap.end(); pIter++ ) + { + aResult[nIndex++] = pIter->first; + } + + return aResult; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +SvtExtendedSecurityOptions::OpenHyperlinkMode SvtExtendedSecurityOptions_Impl::GetOpenHyperlinkMode() +{ + return m_eOpenHyperlinkMode; +} +/* -----------------09.07.2003 11:26----------------- + + --------------------------------------------------*/ +sal_Bool SvtExtendedSecurityOptions_Impl::IsOpenHyperlinkModeReadOnly() const +{ + return m_bROOpenHyperlinkMode; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtExtendedSecurityOptions_Impl::SetOpenHyperlinkMode( SvtExtendedSecurityOptions::OpenHyperlinkMode eNewMode ) +{ + m_eOpenHyperlinkMode = eNewMode; + SetModified(); +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +void SvtExtendedSecurityOptions_Impl::FillExtensionHashMap( ExtensionHashMap& aHashMap ) +{ + // Get sequence with secure extensions from configuration + Sequence< OUString > seqNodes = GetNodeNames( m_aSecureExtensionsSetName ); + + OUString aValue; + Sequence< Any > aValues; + Sequence< OUString > aPropSeq( 1 ); + for ( int i = 0; i < seqNodes.getLength(); i++ ) + { + // Create access name for property + OUStringBuffer aExtEntryProp( m_aSecureExtensionsSetName ); + aExtEntryProp.appendAscii( "/" ); + aExtEntryProp.append( seqNodes[i] ); + aExtEntryProp.append( m_aExtensionPropName ); + + aPropSeq[0] = aExtEntryProp.makeStringAndClear(); + aValues = GetProperties( aPropSeq ); + if ( aValues.getLength() == 1 ) + { + // Don't use value if sequence has not the correct length + if ( aValues[0] >>= aValue ) + // Add extension into secure extensions hash map + aHashMap.insert( ExtensionHashMap::value_type( aValue.toAsciiLowerCase(), 1 ) ); + else + { + DBG_ERRORFILE( "SvtExtendedSecurityOptions_Impl::FillExtensionHashMap(): not string value?" ); + } + } + } +} + +//***************************************************************************************************************** +// private method (currently not used) +//***************************************************************************************************************** +Sequence< OUString > SvtExtendedSecurityOptions_Impl::GetPropertyNames() +{ + // Build static list of configuration key names. + static const OUString pProperties[] = + { + PROPERTYNAME_HYPERLINKS_OPEN + }; + // Initialize return sequence with these list ... + static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + // ... and return it. + return seqPropertyNames; +} + +//***************************************************************************************************************** +// initialize static member +// DON'T DO IT IN YOUR HEADER! +// see definition for further informations +//***************************************************************************************************************** +SvtExtendedSecurityOptions_Impl* SvtExtendedSecurityOptions::m_pDataContainer = NULL ; +sal_Int32 SvtExtendedSecurityOptions::m_nRefCount = 0 ; + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtExtendedSecurityOptions::SvtExtendedSecurityOptions() +{ + // Global access, must be guarded (multithreading!). + MutexGuard aGuard( GetInitMutex() ); + // Increase ouer refcount ... + ++m_nRefCount; + // ... and initialize ouer data container only if it not already exist! + if( m_pDataContainer == NULL ) + { + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtExtendedSecurityOptions_Impl::ctor()"); + m_pDataContainer = new SvtExtendedSecurityOptions_Impl; + + ItemHolder1::holdConfigItem(E_EXTENDEDSECURITYOPTIONS); + } +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtExtendedSecurityOptions::~SvtExtendedSecurityOptions() +{ + // Global access, must be guarded (multithreading!) + MutexGuard aGuard( GetInitMutex() ); + // Decrease ouer refcount. + --m_nRefCount; + // If last instance was deleted ... + // we must destroy ouer static data container! + if( m_nRefCount <= 0 ) + { + delete m_pDataContainer; + m_pDataContainer = NULL; + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtExtendedSecurityOptions::IsSecureHyperlink( const rtl::OUString& aURL ) const +{ + MutexGuard aGuard( GetInitMutex() ); + return m_pDataContainer->IsSecureHyperlink( aURL ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +Sequence< rtl::OUString > SvtExtendedSecurityOptions::GetSecureExtensionList() const +{ + MutexGuard aGuard( GetInitMutex() ); + return m_pDataContainer->GetSecureExtensionList(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +SvtExtendedSecurityOptions::OpenHyperlinkMode SvtExtendedSecurityOptions::GetOpenHyperlinkMode() +{ + MutexGuard aGuard( GetInitMutex() ); + return m_pDataContainer->GetOpenHyperlinkMode(); +} +/* -----------------09.07.2003 11:26----------------- + + --------------------------------------------------*/ +sal_Bool SvtExtendedSecurityOptions::IsOpenHyperlinkModeReadOnly() const +{ + return m_pDataContainer->IsOpenHyperlinkModeReadOnly(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtExtendedSecurityOptions::SetOpenHyperlinkMode( SvtExtendedSecurityOptions::OpenHyperlinkMode eMode ) +{ + MutexGuard aGuard( GetInitMutex() ); + m_pDataContainer->SetOpenHyperlinkMode( eMode ); +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Mutex& SvtExtendedSecurityOptions::GetInitMutex() +{ + // Initialize static mutex only for one time! + static Mutex* pMutex = NULL; + // If these method first called (Mutex not already exist!) ... + if( pMutex == NULL ) + { + // ... we must create a new one. Protect follow code with the global mutex - + // It must be - we create a static variable! + MutexGuard aGuard( Mutex::getGlobalMutex() ); + // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! + if( pMutex == NULL ) + { + // Create the new mutex and set it for return on static variable. + static Mutex aMutex; + pMutex = &aMutex; + } + } + // Return new created or already existing mutex object. + return *pMutex; +} diff --git a/unotools/source/config/fltrcfg.cxx b/unotools/source/config/fltrcfg.cxx new file mode 100644 index 000000000000..7050e4734401 --- /dev/null +++ b/unotools/source/config/fltrcfg.cxx @@ -0,0 +1,611 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: fltrcfg.cxx,v $ + * $Revision: 1.12 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" + +#include +#include + +#include +#include +#include + +using namespace utl; +using namespace rtl; +using namespace com::sun::star::uno; + +#define C2U(cChar) OUString::createFromAscii(cChar) + +// ----------------------------------------------------------------------- +#define FILTERCFG_WORD_CODE 0x0001 +#define FILTERCFG_WORD_STORAGE 0x0002 +#define FILTERCFG_EXCEL_CODE 0x0004 +#define FILTERCFG_EXCEL_STORAGE 0x0008 +#define FILTERCFG_PPOINT_CODE 0x0010 +#define FILTERCFG_PPOINT_STORAGE 0x0020 +#define FILTERCFG_MATH_LOAD 0x0100 +#define FILTERCFG_MATH_SAVE 0x0200 +#define FILTERCFG_WRITER_LOAD 0x0400 +#define FILTERCFG_WRITER_SAVE 0x0800 +#define FILTERCFG_CALC_LOAD 0x1000 +#define FILTERCFG_CALC_SAVE 0x2000 +#define FILTERCFG_IMPRESS_LOAD 0x4000 +#define FILTERCFG_IMPRESS_SAVE 0x8000 +#define FILTERCFG_EXCEL_EXECTBL 0x10000 +#define FILTERCFG_ENABLE_PPT_PREVIEW 0x20000 +#define FILTERCFG_ENABLE_EXCEL_PREVIEW 0x40000 +#define FILTERCFG_ENABLE_WORD_PREVIEW 0x80000 +#define FILTERCFG_USE_ENHANCED_FIELDS 0x100000 + +static SvtFilterOptions* pOptions=0; + +/* -----------------------------22.01.01 10:23-------------------------------- + + ---------------------------------------------------------------------------*/ +class SvtAppFilterOptions_Impl : public utl::ConfigItem +{ + sal_Bool bLoadVBA; + sal_Bool bSaveVBA; +public: + SvtAppFilterOptions_Impl(const OUString& rRoot) : + utl::ConfigItem(rRoot), + bLoadVBA(sal_False), + bSaveVBA(sal_False) {} + ~SvtAppFilterOptions_Impl(); + virtual void Commit(); + void Load(); + + sal_Bool IsLoad() const {return bLoadVBA;} + void SetLoad(sal_Bool bSet) + { + if(bSet != bLoadVBA) + SetModified(); + bLoadVBA = bSet; + } + sal_Bool IsSave() const {return bSaveVBA;} + void SetSave(sal_Bool bSet) + { + if(bSet != bSaveVBA) + SetModified(); + bSaveVBA = bSet; + } +}; + +/* -----------------------------22.01.01 11:08-------------------------------- + + ---------------------------------------------------------------------------*/ +SvtAppFilterOptions_Impl::~SvtAppFilterOptions_Impl() +{ + if(IsModified()) + Commit(); +} +/* -----------------------------22.01.01 10:38-------------------------------- + + ---------------------------------------------------------------------------*/ +void SvtAppFilterOptions_Impl::Commit() +{ + Sequence aNames(2); + OUString* pNames = aNames.getArray(); + pNames[0] = C2U("Load"); + pNames[1] = C2U("Save"); + Sequence aValues(aNames.getLength()); + Any* pValues = aValues.getArray(); + + const Type& rType = ::getBooleanCppuType(); + pValues[0].setValue(&bLoadVBA, rType); + pValues[1].setValue(&bSaveVBA, rType); + + PutProperties(aNames, aValues); +} +/* -----------------------------22.01.01 10:38-------------------------------- + + ---------------------------------------------------------------------------*/ +void SvtAppFilterOptions_Impl::Load() +{ + Sequence aNames(2); + OUString* pNames = aNames.getArray(); + pNames[0] = C2U("Load"); + pNames[1] = C2U("Save"); + + Sequence aValues = GetProperties(aNames); + const Any* pValues = aValues.getConstArray(); + + if(pValues[0].hasValue()) + bLoadVBA = *(sal_Bool*)pValues[0].getValue(); + if(pValues[1].hasValue()) + bSaveVBA = *(sal_Bool*)pValues[1].getValue(); +} + +// ----------------------------------------------------------------------- +class SvtCalcFilterOptions_Impl : public SvtAppFilterOptions_Impl +{ + sal_Bool bLoadExecutable; +public: + SvtCalcFilterOptions_Impl(const OUString& rRoot) : + SvtAppFilterOptions_Impl(rRoot), + bLoadExecutable(sal_False) + {} + virtual void Commit(); + void Load(); + + sal_Bool IsLoadExecutable() const {return bLoadExecutable;} + void SetLoadExecutable(sal_Bool bSet) + { + if(bSet != bLoadExecutable) + SetModified(); + bLoadExecutable = bSet; + } +}; + +void SvtCalcFilterOptions_Impl::Commit() +{ + SvtAppFilterOptions_Impl::Commit(); + + Sequence aNames(1); + aNames[0] = C2U("Executable"); + Sequence aValues(1); + aValues[0] <<= bLoadExecutable; + + PutProperties(aNames, aValues); +} + +void SvtCalcFilterOptions_Impl::Load() +{ + SvtAppFilterOptions_Impl::Load(); + + Sequence aNames(1); + aNames[0] = C2U("Executable"); + + Sequence aValues = GetProperties(aNames); + const Any* pValues = aValues.getConstArray(); + if(pValues[0].hasValue()) + bLoadExecutable = *(sal_Bool*)pValues[0].getValue(); +} + +/* -----------------------------22.01.01 10:32-------------------------------- + + ---------------------------------------------------------------------------*/ +struct SvtFilterOptions_Impl +{ + ULONG nFlags; + SvtAppFilterOptions_Impl aWriterCfg; + SvtCalcFilterOptions_Impl aCalcCfg; + SvtAppFilterOptions_Impl aImpressCfg; + + SvtFilterOptions_Impl() : + aWriterCfg(C2U("Office.Writer/Filter/Import/VBA")), + aCalcCfg(C2U("Office.Calc/Filter/Import/VBA")), + aImpressCfg(C2U("Office.Impress/Filter/Import/VBA")) + { + nFlags = FILTERCFG_WORD_CODE | + FILTERCFG_WORD_STORAGE | + FILTERCFG_EXCEL_CODE | + FILTERCFG_EXCEL_STORAGE | + FILTERCFG_PPOINT_CODE | + FILTERCFG_PPOINT_STORAGE | + FILTERCFG_MATH_LOAD | + FILTERCFG_MATH_SAVE | + FILTERCFG_WRITER_LOAD | + FILTERCFG_WRITER_SAVE | + FILTERCFG_CALC_LOAD | + FILTERCFG_CALC_SAVE | + FILTERCFG_IMPRESS_LOAD | + FILTERCFG_IMPRESS_SAVE | + FILTERCFG_USE_ENHANCED_FIELDS; + Load(); + } + + void SetFlag( ULONG nFlag, BOOL bSet ); + BOOL IsFlag( ULONG nFlag ) const; + void Load() + { + aWriterCfg.Load(); + aCalcCfg.Load(); + aImpressCfg.Load(); + } +}; +/* -----------------------------22.01.01 10:34-------------------------------- + + ---------------------------------------------------------------------------*/ +void SvtFilterOptions_Impl::SetFlag( ULONG nFlag, BOOL bSet ) +{ + switch(nFlag) + { + case FILTERCFG_WORD_CODE: aWriterCfg.SetLoad(bSet);break; + case FILTERCFG_WORD_STORAGE: aWriterCfg.SetSave(bSet);break; + case FILTERCFG_EXCEL_CODE: aCalcCfg.SetLoad(bSet);break; + case FILTERCFG_EXCEL_STORAGE: aCalcCfg.SetSave(bSet);break; + case FILTERCFG_EXCEL_EXECTBL: aCalcCfg.SetLoadExecutable(bSet);break; + case FILTERCFG_PPOINT_CODE: aImpressCfg.SetLoad(bSet);break; + case FILTERCFG_PPOINT_STORAGE: aImpressCfg.SetSave(bSet);break; + default: + if( bSet ) + nFlags |= nFlag; + else + nFlags &= ~nFlag; + } +} +/* -----------------------------22.01.01 10:35-------------------------------- + + ---------------------------------------------------------------------------*/ +BOOL SvtFilterOptions_Impl::IsFlag( ULONG nFlag ) const +{ + BOOL bRet; + switch(nFlag) + { + case FILTERCFG_WORD_CODE : bRet = aWriterCfg.IsLoad();break; + case FILTERCFG_WORD_STORAGE : bRet = aWriterCfg.IsSave();break; + case FILTERCFG_EXCEL_CODE : bRet = aCalcCfg.IsLoad();break; + case FILTERCFG_EXCEL_STORAGE : bRet = aCalcCfg.IsSave();break; + case FILTERCFG_EXCEL_EXECTBL : bRet = aCalcCfg.IsLoadExecutable();break; + case FILTERCFG_PPOINT_CODE : bRet = aImpressCfg.IsLoad();break; + case FILTERCFG_PPOINT_STORAGE : bRet = aImpressCfg.IsSave();break; + default: + bRet = 0 != (nFlags & nFlag ); + } + return bRet; +} + +// ----------------------------------------------------------------------- + +SvtFilterOptions::SvtFilterOptions() : + ConfigItem( C2U("Office.Common/Filter/Microsoft") ), + pImp(new SvtFilterOptions_Impl) +{ + RTL_LOGFILE_CONTEXT(aLog, "unotools SvtFilterOptions::SvtFilterOptions()"); + EnableNotification(GetPropertyNames()); + Load(); +} +// ----------------------------------------------------------------------- +SvtFilterOptions::~SvtFilterOptions() +{ + delete pImp; +} +/* -----------------------------22.01.01 08:45-------------------------------- + + ---------------------------------------------------------------------------*/ +const Sequence& SvtFilterOptions::GetPropertyNames() +{ + static Sequence aNames; + if(!aNames.getLength()) + { + int nCount = 12; + aNames.realloc(nCount); + static const char* aPropNames[] = + { + "Import/MathTypeToMath", // 0 + "Import/WinWordToWriter", // 1 + "Import/PowerPointToImpress", // 2 + "Import/ExcelToCalc", // 3 + "Export/MathToMathType", // 4 + "Export/WriterToWinWord", // 5 + "Export/ImpressToPowerPoint", // 6 + "Export/CalcToExcel", // 7 + "Export/EnablePowerPointPreview", // 8 + "Export/EnableExcelPreview", // 9 + "Export/EnableWordPreview", // 10 + "Import/ImportWWFieldsAsEnhancedFields" // 11 + }; + OUString* pNames = aNames.getArray(); + for(int i = 0; i < nCount; i++) + pNames[i] = C2U(aPropNames[i]); + } + return aNames; +} +//----------------------------------------------------------------------- +static ULONG lcl_GetFlag(sal_Int32 nProp) +{ + ULONG nFlag = 0; + switch(nProp) + { + case 0: nFlag = FILTERCFG_MATH_LOAD; break; + case 1: nFlag = FILTERCFG_WRITER_LOAD; break; + case 2: nFlag = FILTERCFG_IMPRESS_LOAD; break; + case 3: nFlag = FILTERCFG_CALC_LOAD; break; + case 4: nFlag = FILTERCFG_MATH_SAVE; break; + case 5: nFlag = FILTERCFG_WRITER_SAVE; break; + case 6: nFlag = FILTERCFG_IMPRESS_SAVE; break; + case 7: nFlag = FILTERCFG_CALC_SAVE; break; + case 8: nFlag = FILTERCFG_ENABLE_PPT_PREVIEW; break; + case 9: nFlag = FILTERCFG_ENABLE_EXCEL_PREVIEW; break; + case 10: nFlag = FILTERCFG_ENABLE_WORD_PREVIEW; break; + case 11: nFlag = FILTERCFG_USE_ENHANCED_FIELDS; break; + + default: DBG_ERROR("illegal value"); + } + return nFlag; +} +/*-- 22.01.01 08:53:03--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvtFilterOptions::Notify( const Sequence& ) +{ + Load(); +} +/*-- 22.01.01 08:53:04--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvtFilterOptions::Commit() +{ + const Sequence& aNames = GetPropertyNames(); + Sequence aValues(aNames.getLength()); + Any* pValues = aValues.getArray(); + + const Type& rType = ::getBooleanCppuType(); + for(int nProp = 0; nProp < aNames.getLength(); nProp++) + { + ULONG nFlag = lcl_GetFlag(nProp); + sal_Bool bVal = pImp->IsFlag( nFlag); + pValues[nProp].setValue(&bVal, rType); + + } + PutProperties(aNames, aValues); +} +/*-- 22.01.01 08:53:04--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvtFilterOptions::Load() +{ + pImp->Load(); + const Sequence& rNames = GetPropertyNames(); + Sequence aValues = GetProperties(rNames); + const Any* pValues = aValues.getConstArray(); + DBG_ASSERT(aValues.getLength() == rNames.getLength(), "GetProperties failed"); + if(aValues.getLength() == rNames.getLength()) + { + for(int nProp = 0; nProp < rNames.getLength(); nProp++) + { + if(pValues[nProp].hasValue()) + { + sal_Bool bVal = *(sal_Bool*)pValues[nProp].getValue(); + ULONG nFlag = lcl_GetFlag(nProp); + pImp->SetFlag( nFlag, bVal); + } + } + } +} +// ----------------------------------------------------------------------- + +void SvtFilterOptions::SetLoadWordBasicCode( BOOL bFlag ) +{ + pImp->SetFlag( FILTERCFG_WORD_CODE, bFlag ); + SetModified(); +} + +BOOL SvtFilterOptions::IsLoadWordBasicCode() const +{ + return pImp->IsFlag( FILTERCFG_WORD_CODE ); +} + +void SvtFilterOptions::SetLoadWordBasicStorage( BOOL bFlag ) +{ + pImp->SetFlag( FILTERCFG_WORD_STORAGE, bFlag ); + SetModified(); +} + +BOOL SvtFilterOptions::IsLoadWordBasicStorage() const +{ + return pImp->IsFlag( FILTERCFG_WORD_STORAGE ); +} + +// ----------------------------------------------------------------------- + +void SvtFilterOptions::SetLoadExcelBasicCode( BOOL bFlag ) +{ + pImp->SetFlag( FILTERCFG_EXCEL_CODE, bFlag ); + SetModified(); +} + +BOOL SvtFilterOptions::IsLoadExcelBasicCode() const +{ + return pImp->IsFlag( FILTERCFG_EXCEL_CODE ); +} + +void SvtFilterOptions::SetLoadExcelBasicExecutable( BOOL bFlag ) +{ + pImp->SetFlag( FILTERCFG_EXCEL_EXECTBL, bFlag ); + SetModified(); +} + +BOOL SvtFilterOptions::IsLoadExcelBasicExecutable() const +{ + return pImp->IsFlag( FILTERCFG_EXCEL_EXECTBL ); +} + +void SvtFilterOptions::SetLoadExcelBasicStorage( BOOL bFlag ) +{ + pImp->SetFlag( FILTERCFG_EXCEL_STORAGE, bFlag ); + SetModified(); +} + +BOOL SvtFilterOptions::IsLoadExcelBasicStorage() const +{ + return pImp->IsFlag( FILTERCFG_EXCEL_STORAGE ); +} + +// ----------------------------------------------------------------------- + +void SvtFilterOptions::SetLoadPPointBasicCode( BOOL bFlag ) +{ + pImp->SetFlag( FILTERCFG_PPOINT_CODE, bFlag ); + SetModified(); +} + +BOOL SvtFilterOptions::IsLoadPPointBasicCode() const +{ + return pImp->IsFlag( FILTERCFG_PPOINT_CODE ); +} + +void SvtFilterOptions::SetLoadPPointBasicStorage( BOOL bFlag ) +{ + pImp->SetFlag( FILTERCFG_PPOINT_STORAGE, bFlag ); + SetModified(); +} + +BOOL SvtFilterOptions::IsLoadPPointBasicStorage() const +{ + return pImp->IsFlag( FILTERCFG_PPOINT_STORAGE ); +} + +// ----------------------------------------------------------------------- + +BOOL SvtFilterOptions::IsMathType2Math() const +{ + return pImp->IsFlag( FILTERCFG_MATH_LOAD ); +} + +void SvtFilterOptions::SetMathType2Math( BOOL bFlag ) +{ + pImp->SetFlag( FILTERCFG_MATH_LOAD, bFlag ); + SetModified(); +} + +BOOL SvtFilterOptions::IsMath2MathType() const +{ + return pImp->IsFlag( FILTERCFG_MATH_SAVE ); +} + +void SvtFilterOptions::SetMath2MathType( BOOL bFlag ) +{ + pImp->SetFlag( FILTERCFG_MATH_SAVE, bFlag ); + SetModified(); +} + + +// ----------------------------------------------------------------------- +BOOL SvtFilterOptions::IsWinWord2Writer() const +{ + return pImp->IsFlag( FILTERCFG_WRITER_LOAD ); +} + +void SvtFilterOptions::SetWinWord2Writer( BOOL bFlag ) +{ + pImp->SetFlag( FILTERCFG_WRITER_LOAD, bFlag ); + SetModified(); +} + +BOOL SvtFilterOptions::IsWriter2WinWord() const +{ + return pImp->IsFlag( FILTERCFG_WRITER_SAVE ); +} + +void SvtFilterOptions::SetWriter2WinWord( BOOL bFlag ) +{ + pImp->SetFlag( FILTERCFG_WRITER_SAVE, bFlag ); + SetModified(); +} + +BOOL SvtFilterOptions::IsUseEnhancedFields() const +{ + return false; // disable for now; +// return pImp->IsFlag( FILTERCFG_USE_ENHANCED_FIELDS ); +} + +void SvtFilterOptions::SetUseEnhancedFields( BOOL bFlag ) +{ + pImp->SetFlag( FILTERCFG_USE_ENHANCED_FIELDS, bFlag ); + SetModified(); +} + +// ----------------------------------------------------------------------- +BOOL SvtFilterOptions::IsExcel2Calc() const +{ + return pImp->IsFlag( FILTERCFG_CALC_LOAD ); +} + +void SvtFilterOptions::SetExcel2Calc( BOOL bFlag ) +{ + pImp->SetFlag( FILTERCFG_CALC_LOAD, bFlag ); + SetModified(); +} + +BOOL SvtFilterOptions::IsCalc2Excel() const +{ + return pImp->IsFlag( FILTERCFG_CALC_SAVE ); +} + +void SvtFilterOptions::SetCalc2Excel( BOOL bFlag ) +{ + pImp->SetFlag( FILTERCFG_CALC_SAVE, bFlag ); + SetModified(); +} + + +// ----------------------------------------------------------------------- +BOOL SvtFilterOptions::IsPowerPoint2Impress() const +{ + return pImp->IsFlag( FILTERCFG_IMPRESS_LOAD ); +} + +void SvtFilterOptions::SetPowerPoint2Impress( BOOL bFlag ) +{ + pImp->SetFlag( FILTERCFG_IMPRESS_LOAD, bFlag ); + SetModified(); +} + +BOOL SvtFilterOptions::IsImpress2PowerPoint() const +{ + return pImp->IsFlag( FILTERCFG_IMPRESS_SAVE ); +} + +void SvtFilterOptions::SetImpress2PowerPoint( BOOL bFlag ) +{ + pImp->SetFlag( FILTERCFG_IMPRESS_SAVE, bFlag ); + SetModified(); +} + +SvtFilterOptions* SvtFilterOptions::Get() +{ + if ( !pOptions ) + pOptions = new SvtFilterOptions; + return pOptions; +} + +// ----------------------------------------------------------------------- + +BOOL SvtFilterOptions::IsEnablePPTPreview() const +{ + return pImp->IsFlag( FILTERCFG_ENABLE_PPT_PREVIEW ); +} + + +BOOL SvtFilterOptions::IsEnableCalcPreview() const +{ + return pImp->IsFlag( FILTERCFG_ENABLE_EXCEL_PREVIEW ); +} + + +BOOL SvtFilterOptions::IsEnableWordPreview() const +{ + return pImp->IsFlag( FILTERCFG_ENABLE_WORD_PREVIEW ); +} + + diff --git a/unotools/source/config/fontoptions.cxx b/unotools/source/config/fontoptions.cxx new file mode 100644 index 000000000000..ac7fd2a94b62 --- /dev/null +++ b/unotools/source/config/fontoptions.cxx @@ -0,0 +1,514 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: fontoptions.cxx,v $ + * $Revision: 1.10 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +#ifndef GCC +#endif + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include +#include +#include +#include +#include +#include + +#include +#include "itemholder1.hxx" + +//_________________________________________________________________________________________________________________ +// namespaces +//_________________________________________________________________________________________________________________ + +using namespace ::utl ; +using namespace ::rtl ; +using namespace ::osl ; +using namespace ::com::sun::star::uno ; + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +#define ROOTNODE_FONT OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Font" )) + +#define PROPERTYNAME_REPLACEMENTTABLE OUString(RTL_CONSTASCII_USTRINGPARAM("Substitution/Replacement" )) +#define PROPERTYNAME_FONTHISTORY OUString(RTL_CONSTASCII_USTRINGPARAM("View/History" )) +#define PROPERTYNAME_FONTWYSIWYG OUString(RTL_CONSTASCII_USTRINGPARAM("View/ShowFontBoxWYSIWYG" )) + +#define PROPERTYHANDLE_REPLACEMENTTABLE 0 +#define PROPERTYHANDLE_FONTHISTORY 1 +#define PROPERTYHANDLE_FONTWYSIWYG 2 + +#define PROPERTYCOUNT 3 + +//_________________________________________________________________________________________________________________ +// private declarations! +//_________________________________________________________________________________________________________________ + +class SvtFontOptions_Impl : public ConfigItem +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + SvtFontOptions_Impl(); + ~SvtFontOptions_Impl(); + + //--------------------------------------------------------------------------------------------------------- + // overloaded methods of baseclass + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short called for notify of configmanager + @descr These method is called from the ConfigManager before application ends or from the + PropertyChangeListener if the sub tree broadcasts changes. You must update your + internal values. + + @seealso baseclass ConfigItem + + @param "seqPropertyNames" is the list of properties which should be updated. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void Notify( const Sequence< OUString >& seqPropertyNames ); + + /*-****************************************************************************************************//** + @short write changes to configuration + @descr These method writes the changed values into the sub tree + and should always called in our destructor to guarantee consistency of config data. + + @seealso baseclass ConfigItem + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void Commit(); + + //--------------------------------------------------------------------------------------------------------- + // public interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short access method to get internal values + @descr These method give us a chance to regulate acces to ouer internal values. + It's not used in the moment - but it's possible for the feature! + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + sal_Bool IsReplacementTableEnabled ( ) const ; + void EnableReplacementTable ( sal_Bool bState ) ; + + sal_Bool IsFontHistoryEnabled ( ) const ; + void EnableFontHistory ( sal_Bool bState ) ; + + sal_Bool IsFontWYSIWYGEnabled ( ) const ; + void EnableFontWYSIWYG ( sal_Bool bState ) ; + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return list of key names of ouer configuration management which represent oue module tree + @descr These methods return a static const list of key names. We need it to get needed values from our + configuration management. + + @seealso - + + @param - + @return A list of needed configuration keys is returned. + + @onerror - + *//*-*****************************************************************************************************/ + + static Sequence< OUString > impl_GetPropertyNames(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + sal_Bool m_bReplacementTable ; + sal_Bool m_bFontHistory ; + sal_Bool m_bFontWYSIWYG ; +}; + +//_________________________________________________________________________________________________________________ +// definitions +//_________________________________________________________________________________________________________________ + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtFontOptions_Impl::SvtFontOptions_Impl() + // Init baseclasses first + : ConfigItem ( ROOTNODE_FONT ) + // Init member then. + , m_bReplacementTable ( sal_False ) + , m_bFontHistory ( sal_False ) + , m_bFontWYSIWYG ( sal_False ) +{ + // Use our static list of configuration keys to get his values. + Sequence< OUString > seqNames = impl_GetPropertyNames ( ); + Sequence< Any > seqValues = GetProperties ( seqNames ); + + // Safe impossible cases. + // We need values from ALL configuration keys. + // Follow assignment use order of values in relation to our list of key names! + DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtFontOptions_Impl::SvtFontOptions_Impl()\nI miss some values of configuration keys!\n" ); + + // Copy values from list in right order to ouer internal member. + sal_Int32 nPropertyCount = seqValues.getLength(); + for( sal_Int32 nProperty=0; nProperty>= m_bReplacementTable; + } + break; + case PROPERTYHANDLE_FONTHISTORY : { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtFontOptions_Impl::SvtFontOptions_Impl()\nWho has changed the value type of \"Office.Common\\Font\\View\\History\"?" ); + seqValues[nProperty] >>= m_bFontHistory; + } + break; + case PROPERTYHANDLE_FONTWYSIWYG : { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtFontOptions_Impl::SvtFontOptions_Impl()\nWho has changed the value type of \"Office.Common\\Font\\View\\ShowFontBoxWYSIWYG\"?" ); + seqValues[nProperty] >>= m_bFontWYSIWYG; + } + break; + } + } + + // Enable notification mechanism of ouer baseclass. + // We need it to get information about changes outside these class on ouer used configuration keys! + EnableNotification( seqNames ); +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtFontOptions_Impl::~SvtFontOptions_Impl() +{ + // We must save our current values .. if user forget it! + if( IsModified() == sal_True ) + { + Commit(); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtFontOptions_Impl::Notify( const Sequence< OUString >& seqPropertyNames ) +{ + // Use given list of updated properties to get his values from configuration directly! + Sequence< Any > seqValues = GetProperties( seqPropertyNames ); + // Safe impossible cases. + // We need values from ALL notified configuration keys. + DBG_ASSERT( !(seqPropertyNames.getLength()!=seqValues.getLength()), "SvtFontOptions_Impl::Notify()\nI miss some values of configuration keys!\n" ); + // Step over list of property names and get right value from coreesponding value list to set it on internal members! + sal_Int32 nCount = seqPropertyNames.getLength(); + for( sal_Int32 nProperty=0; nProperty>= m_bReplacementTable; + } + else + if( seqPropertyNames[nProperty] == PROPERTYNAME_FONTHISTORY ) + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtFontOptions_Impl::Notify()\nWho has changed the value type of \"Office.Common\\Font\\View\\History\"?" ); + seqValues[nProperty] >>= m_bFontHistory; + } + else + if( seqPropertyNames[nProperty] == PROPERTYNAME_FONTWYSIWYG ) + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtFontOptions_Impl::Notify()\nWho has changed the value type of \"Office.Common\\Font\\View\\ShowFontBoxWYSIWYG\"?" ); + seqValues[nProperty] >>= m_bFontWYSIWYG; + } + #if OSL_DEBUG_LEVEL > 1 + else DBG_ASSERT( sal_False, "SvtFontOptions_Impl::Notify()\nUnkown property detected ... I can't handle these!\n" ); + #endif + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtFontOptions_Impl::Commit() +{ + // Get names of supported properties, create a list for values and copy current values to it. + Sequence< OUString > seqNames = impl_GetPropertyNames(); + sal_Int32 nCount = seqNames.getLength(); + Sequence< Any > seqValues ( nCount ); + for( sal_Int32 nProperty=0; nProperty SvtFontOptions_Impl::impl_GetPropertyNames() +{ + // Build static list of configuration key names. + static const OUString pProperties[] = + { + PROPERTYNAME_REPLACEMENTTABLE , + PROPERTYNAME_FONTHISTORY , + PROPERTYNAME_FONTWYSIWYG , + }; + // Initialize return sequence with these list ... + static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + // ... and return it. + return seqPropertyNames; +} + +//***************************************************************************************************************** +// initialize static member +// DON'T DO IT IN YOUR HEADER! +// see definition for further informations +//***************************************************************************************************************** +SvtFontOptions_Impl* SvtFontOptions::m_pDataContainer = NULL ; +sal_Int32 SvtFontOptions::m_nRefCount = 0 ; + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtFontOptions::SvtFontOptions() +{ + // Global access, must be guarded (multithreading!). + MutexGuard aGuard( impl_GetOwnStaticMutex() ); + // Increase ouer refcount ... + ++m_nRefCount; + // ... and initialize ouer data container only if it not already exist! + if( m_pDataContainer == NULL ) + { + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtFontOptions_Impl::ctor()"); + m_pDataContainer = new SvtFontOptions_Impl; + + ItemHolder1::holdConfigItem(E_FONTOPTIONS); + } +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtFontOptions::~SvtFontOptions() +{ + // Global access, must be guarded (multithreading!) + MutexGuard aGuard( impl_GetOwnStaticMutex() ); + // Decrease ouer refcount. + --m_nRefCount; + // If last instance was deleted ... + // we must destroy ouer static data container! + if( m_nRefCount <= 0 ) + { + delete m_pDataContainer; + m_pDataContainer = NULL; + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtFontOptions::IsReplacementTableEnabled() const +{ + MutexGuard aGuard( impl_GetOwnStaticMutex() ); + return m_pDataContainer->IsReplacementTableEnabled(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtFontOptions::EnableReplacementTable( sal_Bool bState ) +{ + MutexGuard aGuard( impl_GetOwnStaticMutex() ); + m_pDataContainer->EnableReplacementTable( bState ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtFontOptions::IsFontHistoryEnabled() const +{ + MutexGuard aGuard( impl_GetOwnStaticMutex() ); + return m_pDataContainer->IsFontHistoryEnabled(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtFontOptions::EnableFontHistory( sal_Bool bState ) +{ + MutexGuard aGuard( impl_GetOwnStaticMutex() ); + m_pDataContainer->EnableFontHistory( bState ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtFontOptions::IsFontWYSIWYGEnabled() const +{ + MutexGuard aGuard( impl_GetOwnStaticMutex() ); + return m_pDataContainer->IsFontWYSIWYGEnabled(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtFontOptions::EnableFontWYSIWYG( sal_Bool bState ) +{ + MutexGuard aGuard( impl_GetOwnStaticMutex() ); + m_pDataContainer->EnableFontWYSIWYG( bState ); +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Mutex& SvtFontOptions::impl_GetOwnStaticMutex() +{ + // Initialize static mutex only for one time! + static Mutex* pMutex = NULL; + // If these method first called (Mutex not already exist!) ... + if( pMutex == NULL ) + { + // ... we must create a new one. Protect follow code with the global mutex - + // It must be - we create a static variable! + MutexGuard aGuard( Mutex::getGlobalMutex() ); + // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! + if( pMutex == NULL ) + { + // Create the new mutex and set it for return on static variable. + static Mutex aMutex; + pMutex = &aMutex; + } + } + // Return new created or already existing mutex object. + return *pMutex; +} diff --git a/unotools/source/config/historyoptions.cxx b/unotools/source/config/historyoptions.cxx new file mode 100644 index 000000000000..73d006a27507 --- /dev/null +++ b/unotools/source/config/historyoptions.cxx @@ -0,0 +1,748 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: historyoptions.cxx,v $ + * $Revision: 1.21.234.2 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +#ifndef GCC +#endif + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include +#include +#include +#include +#include +#include +#include + +#ifndef __SGI_STL_DEQUE +#include +#endif + +#ifndef __SGI_STL_ALGORITHM +#include +#endif + +#include +#include "itemholder1.hxx" + +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include +#endif + +#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ +#include +#endif + +#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_ +#include +#endif + +#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_ +#include +#endif + +#ifndef _COMPHELPER_CONFIGURATIONHELPER_HXX_ +#include +#endif + +#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_ +#include +#endif + +#ifndef _SVT_LOGHELPER_HXX +#include +#endif + +//_________________________________________________________________________________________________________________ +// namespaces +//_________________________________________________________________________________________________________________ + +using namespace ::std ; +using namespace ::utl ; +using namespace ::rtl ; +using namespace ::osl ; +using namespace ::com::sun::star::uno ; +using namespace ::com::sun::star::beans ; + +namespace css = ::com::sun::star; + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +namespace { + static const ::sal_Int32 s_nOffsetURL = 0; + static const ::sal_Int32 s_nOffsetFilter = 1; + static const ::sal_Int32 s_nOffsetTitle = 2; + static const ::sal_Int32 s_nOffsetPassword = 3; +} + +//_________________________________________________________________________________________________________________ +// private declarations! +//_________________________________________________________________________________________________________________ + +struct IMPL_THistoryItem +{ + IMPL_THistoryItem() + { + } + + IMPL_THistoryItem( const OUString& sNewURL , + const OUString& sNewFilter , + const OUString& sNewTitle , + const OUString& sNewPassword ) + { + sURL = sNewURL ; + sFilter = sNewFilter ; + sTitle = sNewTitle ; + sPassword = sNewPassword ; + } + + sal_Bool operator==( const OUString& sSearchedURL ) + { + return( sURL == sSearchedURL ); + } + + OUString sURL ; + OUString sFilter ; + OUString sTitle ; + OUString sPassword ; +}; + +//***************************************************************************************************************** +// class SvtHistoryOptions_Impl +// redesigned +//***************************************************************************************************************** +class SvtHistoryOptions_Impl +{ +public: + SvtHistoryOptions_Impl(); + ~SvtHistoryOptions_Impl(); + + sal_uInt32 GetSize( EHistoryType eHistory ); + void SetSize( EHistoryType eHistory, sal_uInt32 nSize ); + void Clear( EHistoryType eHistory ); + Sequence< Sequence< PropertyValue > > GetList( EHistoryType eHistory ); + void AppendItem( EHistoryType eHistory , + const OUString& sURL , + const OUString& sFilter , + const OUString& sTitle , + const OUString& sPassword ); + +private: + void impl_truncateList (EHistoryType eHistory, sal_uInt32 nSize); + +private: + css::uno::Reference< css::container::XNameAccess > m_xCfg; + css::uno::Reference< css::container::XNameAccess > m_xCommonXCU; +}; + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtHistoryOptions_Impl::SvtHistoryOptions_Impl() +{ + try + { + m_xCfg = Reference< css::container::XNameAccess > ( + ::comphelper::ConfigurationHelper::openConfig( + utl::getProcessServiceFactory(), + s_sHistories, + ::comphelper::ConfigurationHelper::E_STANDARD), + css::uno::UNO_QUERY ); + + m_xCommonXCU = Reference< css::container::XNameAccess > ( + ::comphelper::ConfigurationHelper::openConfig( + utl::getProcessServiceFactory(), + s_sCommonHistory, + ::comphelper::ConfigurationHelper::E_STANDARD), + css::uno::UNO_QUERY ); + } + catch(const css::uno::Exception& ex) + { + m_xCfg.clear(); + m_xCommonXCU.clear(); + + LogHelper::logIt(ex); + } +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtHistoryOptions_Impl::~SvtHistoryOptions_Impl() +{ +} + +//***************************************************************************************************************** +// public method +// Attention: We return the max. size of our internal lists - That is the capacity not the size! +//***************************************************************************************************************** +sal_uInt32 SvtHistoryOptions_Impl::GetSize( EHistoryType eHistory ) +{ + sal_uInt32 nSize = 0 ; + css::uno::Reference< css::beans::XPropertySet > xListAccess(m_xCommonXCU, css::uno::UNO_QUERY); + + try + { + switch( eHistory ) + { + case ePICKLIST: + xListAccess->getPropertyValue(s_sPickListSize) >>= nSize; + break; + + case eHISTORY: + xListAccess->getPropertyValue(s_sURLHistorySize) >>= nSize; + break; + + case eHELPBOOKMARKS: + xListAccess->getPropertyValue(s_sHelpBookmarksSize) >>= nSize; + break; + + default: + break; + } + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } + + return nSize; +} + +//***************************************************************************************************************** +// public method +// Attention: We return the max. size of our internal lists - That is the capacity not the size! +//***************************************************************************************************************** +void SvtHistoryOptions_Impl::SetSize( EHistoryType eHistory, sal_uInt32 nSize ) +{ + css::uno::Reference< css::beans::XPropertySet > xListAccess(m_xCommonXCU, css::uno::UNO_QUERY); + if (! xListAccess.is ()) + return; + + try + { + switch( eHistory ) + { + case ePICKLIST: + if(nSize!=GetSize(ePICKLIST)) + { + xListAccess->setPropertyValue(s_sPickListSize, css::uno::makeAny(nSize)); + ::comphelper::ConfigurationHelper::flush(m_xCommonXCU); + } + break; + + case eHISTORY: + if(nSize!=GetSize(eHISTORY)) + { + xListAccess->setPropertyValue(s_sURLHistorySize, css::uno::makeAny(nSize)); + ::comphelper::ConfigurationHelper::flush(m_xCommonXCU); + } + break; + + case eHELPBOOKMARKS: + if(nSize!=GetSize(eHELPBOOKMARKS)) + { + xListAccess->setPropertyValue(s_sHelpBookmarksSize, css::uno::makeAny(nSize)); + ::comphelper::ConfigurationHelper::flush(m_xCommonXCU); + } + break; + + default: + break; + } + + impl_truncateList (eHistory, nSize); + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +//***************************************************************************************************************** +void SvtHistoryOptions_Impl::impl_truncateList ( EHistoryType eHistory, sal_uInt32 nSize ) +{ + css::uno::Reference< css::container::XNameAccess > xList; + css::uno::Reference< css::container::XNameContainer > xItemList; + css::uno::Reference< css::container::XNameContainer > xOrderList; + css::uno::Reference< css::beans::XPropertySet > xSet; + + try + { + switch( eHistory ) + { + case ePICKLIST: + m_xCfg->getByName(s_sPickList) >>= xList; + break; + + case eHISTORY: + m_xCfg->getByName(s_sURLHistory) >>= xList; + break; + + case eHELPBOOKMARKS: + m_xCfg->getByName(s_sHelpBookmarks) >>= xList; + break; + + default: + break; + } + + // If too much items in current list ... + // truncate the oldest items BEFORE you set the new one. + if ( ! xList.is()) + return; + + xList->getByName(s_sOrderList) >>= xOrderList; + xList->getByName(s_sItemList) >>= xItemList; + + const sal_uInt32 nLength = xOrderList->getElementNames().getLength(); + if (nSize < nLength) + { + for (sal_uInt32 i=nLength-1; i>=nSize; --i) + { + ::rtl::OUString sTmp; + const ::rtl::OUString sRemove = ::rtl::OUString::valueOf((sal_Int32)i); + xOrderList->getByName(sRemove) >>= xSet; + xSet->getPropertyValue(s_sHistoryItemRef) >>= sTmp; + xItemList->removeByName(sTmp); + xOrderList->removeByName(sRemove); + } + + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +//***************************************************************************************************************** +// public method +// Clear specified history list +//***************************************************************************************************************** +void SvtHistoryOptions_Impl::Clear( EHistoryType eHistory ) +{ + css::uno::Reference< css::container::XNameAccess > xListAccess; + css::uno::Reference< css::container::XNameContainer > xNode; + Sequence< ::rtl::OUString > lOrders; + + try + { + switch( eHistory ) + { + case ePICKLIST: + { + m_xCfg->getByName(s_sPickList) >>= xListAccess; + break; + } + + case eHISTORY: + { + m_xCfg->getByName(s_sURLHistory) >>= xListAccess; + break; + } + + case eHELPBOOKMARKS: + { + m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess; + break; + } + + default: + break; + } + + if (xListAccess.is()) + { + // clear ItemList + xListAccess->getByName(s_sItemList) >>= xNode ; + lOrders = xNode->getElementNames(); + const sal_Int32 nLength = lOrders.getLength(); + for(sal_Int32 i=0; iremoveByName(lOrders[i]); + + // clear OrderList + xListAccess->getByName(s_sOrderList) >>= xNode ; + lOrders = xNode->getElementNames(); + for(sal_Int32 j=0; jremoveByName(lOrders[j]); + + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +//***************************************************************************************************************** +// public method +// get a sequence list from the items +//***************************************************************************************************************** +Sequence< Sequence< PropertyValue > > SvtHistoryOptions_Impl::GetList( EHistoryType eHistory ) +{ + impl_truncateList (eHistory, GetSize (eHistory)); + + Sequence< Sequence< PropertyValue > > seqReturn; // Set default return value. + Sequence< PropertyValue > seqProperties( 4 ); + Sequence< ::rtl::OUString > lOrders; + + css::uno::Reference< css::container::XNameAccess > xListAccess; + css::uno::Reference< css::container::XNameAccess > xItemList; + css::uno::Reference< css::container::XNameAccess > xOrderList; + css::uno::Reference< css::beans::XPropertySet > xSet; + + seqProperties[s_nOffsetURL ].Name = HISTORY_PROPERTYNAME_URL; + seqProperties[s_nOffsetFilter ].Name = HISTORY_PROPERTYNAME_FILTER; + seqProperties[s_nOffsetTitle ].Name = HISTORY_PROPERTYNAME_TITLE; + seqProperties[s_nOffsetPassword ].Name = HISTORY_PROPERTYNAME_PASSWORD; + + try + { + switch( eHistory ) + { + case ePICKLIST: + { + m_xCfg->getByName(s_sPickList) >>= xListAccess; + break; + } + + case eHISTORY: + { + m_xCfg->getByName(s_sURLHistory) >>= xListAccess; + break; + } + + case eHELPBOOKMARKS: + { + m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess; + break; + } + + default: + break; + } + + if (xListAccess.is()) + { + xListAccess->getByName(s_sItemList) >>= xItemList; + xListAccess->getByName(s_sOrderList) >>= xOrderList; + + const sal_Int32 nLength = xOrderList->getElementNames().getLength(); + Sequence< Sequence< PropertyValue > > aRet(nLength); + + for(sal_Int32 nItem=0; nItemgetByName(::rtl::OUString::valueOf(nItem)) >>= xSet; + xSet->getPropertyValue(s_sHistoryItemRef) >>= sUrl; + + xItemList->getByName(sUrl) >>= xSet; + seqProperties[s_nOffsetURL ].Value <<= sUrl; + xSet->getPropertyValue(s_sFilter) >>= seqProperties[s_nOffsetFilter ].Value; + xSet->getPropertyValue(s_sTitle) >>= seqProperties[s_nOffsetTitle ].Value; + xSet->getPropertyValue(s_sPassword) >>= seqProperties[s_nOffsetPassword ].Value; + aRet[nItem] = seqProperties; + } + seqReturn = aRet; + } + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } + + return seqReturn; +} + +//***************************************************************************************************************** +// public method +// implements a deque in XML +//***************************************************************************************************************** +void SvtHistoryOptions_Impl::AppendItem( EHistoryType eHistory , + const OUString& sURL , + const OUString& sFilter , + const OUString& sTitle , + const OUString& sPassword ) +{ + impl_truncateList (eHistory, GetSize (eHistory)); + + css::uno::Reference< css::container::XNameAccess > xListAccess; + sal_Int32 nMaxSize = 0; + + switch(eHistory) + { + case ePICKLIST: + { + m_xCfg->getByName(s_sPickList) >>= xListAccess; + nMaxSize = GetSize(ePICKLIST); + } + break; + case eHISTORY: + { + m_xCfg->getByName(s_sURLHistory) >>= xListAccess; + nMaxSize = GetSize(eHISTORY); + } + break; + case eHELPBOOKMARKS: + { + m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess; + nMaxSize = GetSize(eHELPBOOKMARKS); + } + break; + default: + break; + } + + if (nMaxSize==0) + return; + + css::uno::Reference< css::container::XNameContainer > xItemList; + css::uno::Reference< css::container::XNameContainer > xOrderList; + css::uno::Reference< css::beans::XPropertySet > xSet; + + try + { + xListAccess->getByName(s_sItemList) >>= xItemList; + xListAccess->getByName(s_sOrderList) >>= xOrderList; + sal_Int32 nLength = xOrderList->getElementNames().getLength(); + + // The item to be appended is already existing! + if (xItemList->hasByName(sURL)) + { + for (sal_Int32 i=0; igetByName(::rtl::OUString::valueOf(i)) >>= xSet; + xSet->getPropertyValue(s_sHistoryItemRef) >>= sTmp; + + if(sURL == sTmp) + { + ::rtl::OUString sFind; + xOrderList->getByName( ::rtl::OUString::valueOf(i) ) >>= xSet; + xSet->getPropertyValue(s_sHistoryItemRef) >>= sFind; + for (sal_Int32 j=i-1; j>=0; --j) + { + css::uno::Reference< css::beans::XPropertySet > xPrevSet; + css::uno::Reference< css::beans::XPropertySet > xNextSet; + xOrderList->getByName( ::rtl::OUString::valueOf(j+1) ) >>= xPrevSet; + xOrderList->getByName( ::rtl::OUString::valueOf(j) ) >>= xNextSet; + + ::rtl::OUString sTemp; + xNextSet->getPropertyValue(s_sHistoryItemRef) >>= sTemp; + xPrevSet->setPropertyValue(s_sHistoryItemRef, css::uno::makeAny(sTemp)); + } + xOrderList->getByName( ::rtl::OUString::valueOf((sal_Int32)0) ) >>= xSet; + xSet->setPropertyValue(s_sHistoryItemRef, css::uno::makeAny(sFind)); + + ::comphelper::ConfigurationHelper::flush(m_xCfg); + break; + } + } + } + + // The item to be appended is not existing! + else + { + css::uno::Reference< css::lang::XSingleServiceFactory > xFac; + css::uno::Reference< css::uno::XInterface > xInst; + css::uno::Reference< css::beans::XPropertySet > xPrevSet; + css::uno::Reference< css::beans::XPropertySet > xNextSet; + + // Append new item to OrderList. + if ( nLength == nMaxSize ) + { + ::rtl::OUString sRemove; + xOrderList->getByName(::rtl::OUString::valueOf(nLength-1)) >>= xSet; + xSet->getPropertyValue(s_sHistoryItemRef) >>= sRemove; + xItemList->removeByName(sRemove); + } + if ( nLength != nMaxSize ) + { + xFac = css::uno::Reference< css::lang::XSingleServiceFactory >(xOrderList, css::uno::UNO_QUERY); + xInst = xFac->createInstance(); + ::rtl::OUString sPush = ::rtl::OUString::valueOf(nLength++); + xOrderList->insertByName(sPush, css::uno::makeAny(xInst)); + } + for (sal_Int32 j=nLength-1; j>0; --j) + { + xOrderList->getByName( ::rtl::OUString::valueOf(j) ) >>= xPrevSet; + xOrderList->getByName( ::rtl::OUString::valueOf(j-1) ) >>= xNextSet; + ::rtl::OUString sTemp; + xNextSet->getPropertyValue(s_sHistoryItemRef) >>= sTemp; + xPrevSet->setPropertyValue(s_sHistoryItemRef, css::uno::makeAny(sTemp)); + } + xOrderList->getByName( ::rtl::OUString::valueOf((sal_Int32)0) ) >>= xSet; + xSet->setPropertyValue(s_sHistoryItemRef, css::uno::makeAny(sURL)); + + // Append the item to ItemList. + xFac = css::uno::Reference< css::lang::XSingleServiceFactory >(xItemList, css::uno::UNO_QUERY); + xInst = xFac->createInstance(); + xItemList->insertByName(sURL, css::uno::makeAny(xInst)); + xSet = css::uno::Reference< css::beans::XPropertySet >(xInst, css::uno::UNO_QUERY); + xSet->setPropertyValue(s_sFilter, css::uno::makeAny(sFilter)); + xSet->setPropertyValue(s_sTitle, css::uno::makeAny(sTitle)); + xSet->setPropertyValue(s_sPassword, css::uno::makeAny(sPassword)); + + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +//***************************************************************************************************************** +// initialize static member +// DON'T DO IT IN YOUR HEADER! +// see definition for further informations +//***************************************************************************************************************** +SvtHistoryOptions_Impl* SvtHistoryOptions::m_pDataContainer = NULL ; +sal_Int32 SvtHistoryOptions::m_nRefCount = 0 ; + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtHistoryOptions::SvtHistoryOptions() +{ + // Global access, must be guarded (multithreading!). + MutexGuard aGuard( GetOwnStaticMutex() ); + // Increase ouer refcount ... + ++m_nRefCount; + // ... and initialize ouer data container only if it not already exist! + if( m_pDataContainer == NULL ) + { + RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtHistoryOptions_Impl::ctor()"); + m_pDataContainer = new SvtHistoryOptions_Impl; + + ItemHolder1::holdConfigItem(E_HISTORYOPTIONS); + } +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtHistoryOptions::~SvtHistoryOptions() +{ + // Global access, must be guarded (multithreading!) + MutexGuard aGuard( GetOwnStaticMutex() ); + // Decrease ouer refcount. + --m_nRefCount; + // If last instance was deleted ... + // we must destroy ouer static data container! + if( m_nRefCount <= 0 ) + { + delete m_pDataContainer; + m_pDataContainer = NULL; + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_uInt32 SvtHistoryOptions::GetSize( EHistoryType eHistory ) const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetSize( eHistory ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtHistoryOptions::SetSize( EHistoryType eHistory, sal_uInt32 nSize ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetSize( eHistory, nSize ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtHistoryOptions::Clear( EHistoryType eHistory ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->Clear( eHistory ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +Sequence< Sequence< PropertyValue > > SvtHistoryOptions::GetList( EHistoryType eHistory ) const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetList( eHistory ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtHistoryOptions::AppendItem( EHistoryType eHistory , + const OUString& sURL , + const OUString& sFilter , + const OUString& sTitle , + const OUString& sPassword ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->AppendItem( eHistory, sURL, sFilter, sTitle, sPassword ); +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Mutex& SvtHistoryOptions::GetOwnStaticMutex() +{ + // Initialize static mutex only for one time! + static Mutex* pMutex = NULL; + // If these method first called (Mutex not already exist!) ... + if( pMutex == NULL ) + { + // ... we must create a new one. Protect follow code with the global mutex - + // It must be - we create a static variable! + MutexGuard aGuard( Mutex::getGlobalMutex() ); + // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! + if( pMutex == NULL ) + { + // Create the new mutex and set it for return on static variable. + static Mutex aMutex; + pMutex = &aMutex; + } + } + // Return new created or already existing mutex object. + return *pMutex; +} diff --git a/unotools/source/config/inetoptions.cxx b/unotools/source/config/inetoptions.cxx new file mode 100644 index 000000000000..13c72d73152d --- /dev/null +++ b/unotools/source/config/inetoptions.cxx @@ -0,0 +1,557 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: inetoptions.cxx,v $ + * $Revision: 1.33 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +#include +#include "rtl/instance.hxx" +#include +#ifndef _WILDCARD_HXX +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "itemholder1.hxx" + +using namespace com::sun; + +//============================================================================ +// +// takeAny +// +//============================================================================ + +namespace { + +template< typename T > inline T takeAny(star::uno::Any const & rAny) +{ + T aValue = T(); + rAny >>= aValue; + return aValue; +} + +} + +//============================================================================ +// +// SvtInetOptions::Impl +// +//============================================================================ + +class SvtInetOptions::Impl: public salhelper::ReferenceObject, + public utl::ConfigItem +{ +public: + enum Index + { + INDEX_NO_PROXY, + INDEX_PROXY_TYPE, + INDEX_FTP_PROXY_NAME, + INDEX_FTP_PROXY_PORT, + INDEX_HTTP_PROXY_NAME, + INDEX_HTTP_PROXY_PORT + }; + + Impl(); + + star::uno::Any getProperty(Index nIndex); + + void + setProperty(Index nIndex, star::uno::Any const & rValue, bool bFlush); + + inline void flush() { Commit(); } + + void + addPropertiesChangeListener( + star::uno::Sequence< rtl::OUString > const & rPropertyNames, + star::uno::Reference< star::beans::XPropertiesChangeListener > const & + rListener); + + void + removePropertiesChangeListener( + star::uno::Sequence< rtl::OUString > const & rPropertyNames, + star::uno::Reference< star::beans::XPropertiesChangeListener > const & + rListener); + +private: + enum { ENTRY_COUNT = INDEX_HTTP_PROXY_PORT + 1 }; + + struct Entry + { + enum State { UNKNOWN, KNOWN, MODIFIED }; + + inline Entry(): m_eState(UNKNOWN) {} + + rtl::OUString m_aName; + star::uno::Any m_aValue; + State m_eState; + }; + + // MSVC has problems with the below Map type when + // star::uno::Reference< star::beans::XPropertiesChangeListener > is not + // wrapped in class Listener: + class Listener: + public star::uno::Reference< star::beans::XPropertiesChangeListener > + { + public: + Listener(star::uno::Reference< + star::beans::XPropertiesChangeListener > const & + rListener): + star::uno::Reference< star::beans::XPropertiesChangeListener >( + rListener) + {} + }; + + typedef std::map< Listener, std::set< rtl::OUString > > Map; + + osl::Mutex m_aMutex; + Entry m_aEntries[ENTRY_COUNT]; + Map m_aListeners; + + virtual inline ~Impl() { Commit(); } + + virtual void Notify(star::uno::Sequence< rtl::OUString > const & rKeys); + + virtual void Commit(); + + void notifyListeners(star::uno::Sequence< rtl::OUString > const & rKeys); +}; + +//============================================================================ +// virtual +void +SvtInetOptions::Impl::Notify(star::uno::Sequence< rtl::OUString > const & + rKeys) +{ + { + osl::MutexGuard aGuard(m_aMutex); + for (sal_Int32 i = 0; i < rKeys.getLength(); ++i) + for (sal_Int32 j = 0; j < ENTRY_COUNT; ++j) + if (rKeys[i] == m_aEntries[j].m_aName) + { + m_aEntries[j].m_eState = Entry::UNKNOWN; + break; + } + } + notifyListeners(rKeys); +} + +//============================================================================ +// virtual +void SvtInetOptions::Impl::Commit() +{ + star::uno::Sequence< rtl::OUString > aKeys(ENTRY_COUNT); + star::uno::Sequence< star::uno::Any > aValues(ENTRY_COUNT); + sal_Int32 nCount = 0; + { + osl::MutexGuard aGuard(m_aMutex); + for (sal_Int32 i = 0; i < ENTRY_COUNT; ++i) + if (m_aEntries[i].m_eState == Entry::MODIFIED) + { + aKeys[nCount] = m_aEntries[i].m_aName; + aValues[nCount] = m_aEntries[i].m_aValue; + ++nCount; + m_aEntries[i].m_eState = Entry::KNOWN; + } + } + if (nCount > 0) + { + aKeys.realloc(nCount); + aValues.realloc(nCount); + PutProperties(aKeys, aValues); + } +} + +//============================================================================ +void +SvtInetOptions::Impl::notifyListeners( + star::uno::Sequence< rtl::OUString > const & rKeys) +{ + typedef + std::vector< std::pair< star::uno::Reference< + star::beans::XPropertiesChangeListener >, + star::uno::Sequence< + star::beans::PropertyChangeEvent > > > + List; + List aNotifications; + { + osl::MutexGuard aGuard(m_aMutex); + aNotifications.reserve(m_aListeners.size()); + Map::const_iterator aMapEnd(m_aListeners.end()); + for (Map::const_iterator aIt(m_aListeners.begin()); aIt != aMapEnd; + ++aIt) + { + const Map::mapped_type &rSet = aIt->second; + Map::mapped_type::const_iterator aSetEnd(rSet.end()); + star::uno::Sequence< star::beans::PropertyChangeEvent > + aEvents(rKeys.getLength()); + sal_Int32 nCount = 0; + for (sal_Int32 i = 0; i < rKeys.getLength(); ++i) + { + rtl::OUString + aTheKey(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "Inet/"))); + aTheKey += rKeys[i]; + if (rSet.find(aTheKey) != aSetEnd) + { + aEvents[nCount].PropertyName = aTheKey; + aEvents[nCount].PropertyHandle = -1; + ++nCount; + } + } + if (nCount > 0) + { + aEvents.realloc(nCount); + aNotifications. + push_back(std::make_pair< List::value_type::first_type, + List::value_type::second_type >( + aIt->first, aEvents)); + } + } + } + for (List::size_type i = 0; i < aNotifications.size(); ++i) + if (aNotifications[i].first.is()) + aNotifications[i].first-> + propertiesChange(aNotifications[i].second); +} + +//============================================================================ +SvtInetOptions::Impl::Impl(): + ConfigItem(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Inet/Settings"))) +{ + m_aEntries[INDEX_NO_PROXY].m_aName + = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetNoProxy")); + m_aEntries[INDEX_PROXY_TYPE].m_aName + = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetProxyType")); + m_aEntries[INDEX_FTP_PROXY_NAME].m_aName + = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyName")); + m_aEntries[INDEX_FTP_PROXY_PORT].m_aName + = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyPort")); + m_aEntries[INDEX_HTTP_PROXY_NAME].m_aName + = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyName")); + m_aEntries[INDEX_HTTP_PROXY_PORT].m_aName + = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyPort")); + + star::uno::Sequence< rtl::OUString > aKeys(ENTRY_COUNT); + for (sal_Int32 i = 0; i < ENTRY_COUNT; ++i) + aKeys[i] = m_aEntries[i].m_aName; + if (!EnableNotification(aKeys)) + OSL_ENSURE(false, + "SvtInetOptions::Impl::Impl(): Bad EnableNotifications()"); +} + +//============================================================================ +star::uno::Any SvtInetOptions::Impl::getProperty(Index nPropIndex) +{ + for (int nTryCount = 0; nTryCount < 10; ++nTryCount) + { + { + osl::MutexGuard aGuard(m_aMutex); + if (m_aEntries[nPropIndex].m_eState != Entry::UNKNOWN) + return m_aEntries[nPropIndex].m_aValue; + } + star::uno::Sequence< rtl::OUString > aKeys(ENTRY_COUNT); + int nIndices[ENTRY_COUNT]; + sal_Int32 nCount = 0; + { + osl::MutexGuard aGuard(m_aMutex); + for (int i = 0; i < ENTRY_COUNT; ++i) + if (m_aEntries[i].m_eState == Entry::UNKNOWN) + { + aKeys[nCount] = m_aEntries[i].m_aName; + nIndices[nCount] = i; + ++nCount; + } + } + if (nCount > 0) + { + aKeys.realloc(nCount); + star::uno::Sequence< star::uno::Any > + aValues(GetProperties(aKeys)); + OSL_ENSURE(aValues.getLength() == nCount, + "SvtInetOptions::Impl::getProperty():" + " Bad GetProperties() result"); + nCount = std::min(nCount, aValues.getLength()); + { + osl::MutexGuard aGuard(m_aMutex); + for (sal_Int32 i = 0; i < nCount; ++i) + { + int nIndex = nIndices[i]; + if (m_aEntries[nIndex].m_eState == Entry::UNKNOWN) + { + m_aEntries[nIndices[i]].m_aValue = aValues[i]; + m_aEntries[nIndices[i]].m_eState = Entry::KNOWN; + } + } + } + } + } + OSL_ENSURE(false, + "SvtInetOptions::Impl::getProperty(): Possible life lock"); + { + osl::MutexGuard aGuard(m_aMutex); + return m_aEntries[nPropIndex].m_aValue; + } +} + +//============================================================================ +void SvtInetOptions::Impl::setProperty(Index nIndex, + star::uno::Any const & rValue, + bool bFlush) +{ + SetModified(); + { + osl::MutexGuard aGuard(m_aMutex); + m_aEntries[nIndex].m_aValue = rValue; + m_aEntries[nIndex].m_eState = bFlush ? Entry::KNOWN : Entry::MODIFIED; + } + + star::uno::Sequence< rtl::OUString > aKeys(1); + aKeys[0] = m_aEntries[nIndex].m_aName; + if (bFlush) + { + star::uno::Sequence< star::uno::Any > aValues(1); + aValues[0] = rValue; + PutProperties(aKeys, aValues); + } + else + notifyListeners(aKeys); +} + +//============================================================================ +void +SvtInetOptions::Impl::addPropertiesChangeListener( + star::uno::Sequence< rtl::OUString > const & rPropertyNames, + star::uno::Reference< star::beans::XPropertiesChangeListener > const & + rListener) +{ + osl::MutexGuard aGuard(m_aMutex); + Map::mapped_type & rEntry = m_aListeners[rListener]; + for (sal_Int32 i = 0; i < rPropertyNames.getLength(); ++i) + rEntry.insert(rPropertyNames[i]); +} + +//============================================================================ +void +SvtInetOptions::Impl::removePropertiesChangeListener( + star::uno::Sequence< rtl::OUString > const & rPropertyNames, + star::uno::Reference< star::beans::XPropertiesChangeListener > const & + rListener) +{ + osl::MutexGuard aGuard(m_aMutex); + Map::iterator aIt(m_aListeners.find(rListener)); + if (aIt != m_aListeners.end()) + { + for (sal_Int32 i = 0; i < rPropertyNames.getLength(); ++i) + aIt->second.erase(rPropertyNames[i]); + if (aIt->second.empty()) + m_aListeners.erase(aIt); + } +} + +//============================================================================ +// +// SvtInetOptions +// +//============================================================================ + +namespace +{ + class LocalSingleton : public rtl::Static< osl::Mutex, LocalSingleton > + { + }; +} + +// static +SvtInetOptions::Impl * SvtInetOptions::m_pImpl = 0; + +//============================================================================ +SvtInetOptions::SvtInetOptions() +{ + osl::MutexGuard aGuard(LocalSingleton::get()); + if (!m_pImpl) + { + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtInetOptions_Impl::ctor()"); + m_pImpl = new Impl; + + ItemHolder1::holdConfigItem(E_INETOPTIONS); + } + m_pImpl->acquire(); +} + +//============================================================================ +SvtInetOptions::~SvtInetOptions() +{ + osl::MutexGuard aGuard(LocalSingleton::get()); + if (m_pImpl->release() == 0) + m_pImpl = 0; +} + +//============================================================================ +rtl::OUString SvtInetOptions::GetProxyNoProxy() const +{ + return takeAny< rtl::OUString >(m_pImpl-> + getProperty(Impl::INDEX_NO_PROXY)); +} + +//============================================================================ +sal_Int32 SvtInetOptions::GetProxyType() const +{ + return takeAny< sal_Int32 >(m_pImpl-> + getProperty(Impl::INDEX_PROXY_TYPE)); +} + +//============================================================================ +rtl::OUString SvtInetOptions::GetProxyFtpName() const +{ + return takeAny< rtl::OUString >(m_pImpl-> + getProperty( + Impl::INDEX_FTP_PROXY_NAME)); +} + +//============================================================================ +sal_Int32 SvtInetOptions::GetProxyFtpPort() const +{ + return takeAny< sal_Int32 >(m_pImpl-> + getProperty(Impl::INDEX_FTP_PROXY_PORT)); +} + +//============================================================================ +rtl::OUString SvtInetOptions::GetProxyHttpName() const +{ + return takeAny< rtl::OUString >(m_pImpl-> + getProperty( + Impl::INDEX_HTTP_PROXY_NAME)); +} + +//============================================================================ +sal_Int32 SvtInetOptions::GetProxyHttpPort() const +{ + return takeAny< sal_Int32 >(m_pImpl-> + getProperty(Impl::INDEX_HTTP_PROXY_PORT)); +} + +//============================================================================ +void SvtInetOptions::SetProxyNoProxy(rtl::OUString const & rValue, + bool bFlush) +{ + m_pImpl->setProperty(Impl::INDEX_NO_PROXY, + star::uno::makeAny(rValue), + bFlush); +} + +//============================================================================ +void SvtInetOptions::SetProxyType(ProxyType eValue, bool bFlush) +{ + m_pImpl->setProperty(Impl::INDEX_PROXY_TYPE, + star::uno::makeAny(sal_Int32(eValue)), + bFlush); +} + +//============================================================================ +void SvtInetOptions::SetProxyFtpName(rtl::OUString const & rValue, + bool bFlush) +{ + m_pImpl->setProperty(Impl::INDEX_FTP_PROXY_NAME, + star::uno::makeAny(rValue), + bFlush); +} + +//============================================================================ +void SvtInetOptions::SetProxyFtpPort(sal_Int32 nValue, bool bFlush) +{ + m_pImpl->setProperty(Impl::INDEX_FTP_PROXY_PORT, + star::uno::makeAny(nValue), + bFlush); +} + +//============================================================================ +void SvtInetOptions::SetProxyHttpName(rtl::OUString const & rValue, + bool bFlush) +{ + m_pImpl->setProperty(Impl::INDEX_HTTP_PROXY_NAME, + star::uno::makeAny(rValue), + bFlush); +} + +//============================================================================ +void SvtInetOptions::SetProxyHttpPort(sal_Int32 nValue, bool bFlush) +{ + m_pImpl->setProperty(Impl::INDEX_HTTP_PROXY_PORT, + star::uno::makeAny(nValue), + bFlush); +} + +//============================================================================ +void SvtInetOptions::flush() +{ + m_pImpl->flush(); +} + +//============================================================================ +void +SvtInetOptions::addPropertiesChangeListener( + star::uno::Sequence< rtl::OUString > const & rPropertyNames, + star::uno::Reference< star::beans::XPropertiesChangeListener > const & + rListener) +{ + m_pImpl->addPropertiesChangeListener(rPropertyNames, rListener); +} + +//============================================================================ +void +SvtInetOptions::removePropertiesChangeListener( + star::uno::Sequence< rtl::OUString > const & rPropertyNames, + star::uno::Reference< star::beans::XPropertiesChangeListener > const & + rListener) +{ + m_pImpl->removePropertiesChangeListener(rPropertyNames, rListener); +} diff --git a/unotools/source/config/internaloptions.cxx b/unotools/source/config/internaloptions.cxx new file mode 100644 index 000000000000..54dce3d7094b --- /dev/null +++ b/unotools/source/config/internaloptions.cxx @@ -0,0 +1,631 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: internaloptions.cxx,v $ + * $Revision: 1.21 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +#ifndef GCC +#endif + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include "itemholder1.hxx" + +//_________________________________________________________________________________________________________________ +// namespaces +//_________________________________________________________________________________________________________________ + +using namespace ::utl ; +using namespace ::rtl ; +using namespace ::osl ; +using namespace ::std ; +using namespace ::com::sun::star::uno ; +using namespace ::com::sun::star::beans ; + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +#define ROOTNODE_INTERNAL OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Internal" )) +#define DEFAULT_SLOTCFG sal_False +#define DEFAULT_SENDCRASHMAIL sal_False +#define DEFAULT_USEMAILUI sal_True +#define DEFAULT_CURRENTTEMPURL OUString(RTL_CONSTASCII_USTRINGPARAM("")) + +#define FIXPROPERTYNAME_SLOTCFG OUString(RTL_CONSTASCII_USTRINGPARAM("Slot" )) +#define FIXPROPERTYNAME_SENDCRASHMAIL OUString(RTL_CONSTASCII_USTRINGPARAM("SendCrashMail" )) +#define FIXPROPERTYNAME_USEMAILUI OUString(RTL_CONSTASCII_USTRINGPARAM("UseMailUI" )) +#define FIXPROPERTYNAME_CURRENTTEMPURL OUString(RTL_CONSTASCII_USTRINGPARAM("CurrentTempURL" )) +//#define FIXPROPERTYNAME_REMOVEMENUENTRYCLOSE OUString(RTL_CONSTASCII_USTRINGPARAM("RemoveMenuEntryClose")) +//#define FIXPROPERTYNAME_REMOVEMENUENTRYBACKTOWEBTOP OUString(RTL_CONSTASCII_USTRINGPARAM("RemoveMenuEntryBackToWebtop")) +//#define FIXPROPERTYNAME_REMOVEMENUENTRYNEWWEBTOP OUString(RTL_CONSTASCII_USTRINGPARAM("RemoveMenuEntryNewWebtop")) +//#define FIXPROPERTYNAME_REMOVEMENUENTRYLOGOUT OUString(RTL_CONSTASCII_USTRINGPARAM("RemoveMenuEntryLogout")) + +#define FIXPROPERTYHANDLE_SLOTCFG 0 +#define FIXPROPERTYHANDLE_SENDCRASHMAIL 1 +#define FIXPROPERTYHANDLE_USEMAILUI 2 +#define FIXPROPERTYHANDLE_CURRENTTEMPURL 3 +//#define FIXPROPERTYHANDLE_REMOVEMENUENTRYCLOSE 3 +//#define FIXPROPERTYHANDLE_REMOVEMENUENTRYBACKTOWEBTOP 4 +//#define FIXPROPERTYHANDLE_REMOVEMENUENTRYNEWWEBTOP 5 +//#define FIXPROPERTYHANDLE_REMOVEMENUENTRYLOGOUT 6 + +#define FIXPROPERTYCOUNT 4 +/* +#define PROPERTYNAME_RECOVERYLIST OUString(RTL_CONSTASCII_USTRINGPARAM("RecoveryList" )) +#define PROPERTYNAME_URL OUString(RTL_CONSTASCII_USTRINGPARAM("OrgURL" )) +#define PROPERTYNAME_FILTER OUString(RTL_CONSTASCII_USTRINGPARAM("FilterName" )) +#define PROPERTYNAME_TEMPNAME OUString(RTL_CONSTASCII_USTRINGPARAM("TempURL" )) + +#define OFFSET_URL 0 +#define OFFSET_FILTER 1 +#define OFFSET_TEMPNAME 2 +*/ +#define PATHDELIMITER OUString(RTL_CONSTASCII_USTRINGPARAM("/" )) +#define FIXR OUString(RTL_CONSTASCII_USTRINGPARAM("r" )) + +//_________________________________________________________________________________________________________________ +// private declarations! +//_________________________________________________________________________________________________________________ +/* +struct tIMPL_RecoveryEntry +{ + OUString sURL ; + OUString sFilter ; + OUString sTempName ; + + tIMPL_RecoveryEntry() + { + sURL = OUString(); + sFilter = OUString(); + sTempName = OUString(); + } + + tIMPL_RecoveryEntry( const OUString& sNewURL , + const OUString& sNewFilter , + const OUString& sNewTempName ) + { + sURL = sNewURL ; + sFilter = sNewFilter ; + sTempName = sNewTempName ; + } +}; + +typedef deque< tIMPL_RecoveryEntry > tIMPL_RecoveryStack; +*/ +class SvtInternalOptions_Impl : public ConfigItem +{ + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + sal_Bool m_bRemoveMenuEntryClose; + sal_Bool m_bRemoveMenuEntryBackToWebtop; + sal_Bool m_bRemoveMenuEntryNewWebtop; + sal_Bool m_bRemoveMenuEntryLogout; + sal_Bool m_bSlotCFG ; /// cache "Slot" of Internal section + sal_Bool m_bSendCrashMail ; /// cache "SendCrashMail" of Internal section + sal_Bool m_bUseMailUI; + OUString m_aCurrentTempURL ; + // tIMPL_RecoveryStack m_aRecoveryList ; /// cache "RecoveryList" of Internal section + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + SvtInternalOptions_Impl(); + ~SvtInternalOptions_Impl(); + + //--------------------------------------------------------------------------------------------------------- + // overloaded methods of baseclass + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short called for notify of configmanager + @descr These method is called from the ConfigManager before application ends or from the + PropertyChangeListener if the sub tree broadcasts changes. You must update your + internal values. + + @seealso baseclass ConfigItem + + @param "seqPropertyNames" is the list of properties which should be updated. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void Notify( const Sequence< OUString >& ) + { + DBG_ASSERT( sal_False, "SvtInternalOptions::Notify()\nNot used yet ... but called!?\n" ); + } + + /*-****************************************************************************************************//** + @short write changes to configuration + @descr These method writes the changed values into the sub tree + and should always called in our destructor to guarantee consistency of config data. + + @seealso baseclass ConfigItem + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void Commit(); + + //--------------------------------------------------------------------------------------------------------- + // public interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short access method to get internal values + @descr These method give us a chance to regulate acces to ouer internal values. + It's not used in the moment - but it's possible for the feature! + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + sal_Bool IsRemoveMenuEntryClose() const { return m_bRemoveMenuEntryClose; } + sal_Bool IsRemoveMenuEntryBackToWebtop() const { return m_bRemoveMenuEntryBackToWebtop; } + sal_Bool IsRemoveMenuEntryNewWebtop() const { return m_bRemoveMenuEntryNewWebtop; } + sal_Bool IsRemoveMenuEntryLogout() const { return m_bRemoveMenuEntryLogout; } + sal_Bool SlotCFGEnabled () const { return m_bSlotCFG; } + sal_Bool CrashMailEnabled () const { return m_bSendCrashMail; } + sal_Bool MailUIEnabled () const { return m_bUseMailUI; } + + OUString GetCurrentTempURL() const { return m_aCurrentTempURL; } + void SetCurrentTempURL( const OUString& aNewCurrentTempURL ); +/* + void PushRecoveryItem ( const OUString& sURL , + const OUString& sFilter , + const OUString& sTempName ); + void PopRecoveryItem ( OUString& sURL , + OUString& sFilter , + OUString& sTempName ); + sal_Bool IsRecoveryListEmpty ( ) const; +*/ + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return list of fix key names of ouer configuration management which represent oue module tree + @descr These methods return a static const list of key names. We need it to get needed values from our + configuration management. We return well known key names only - because the "UserData" node + is handled in a special way! + + @seealso - + + @param - + @return A list of needed configuration keys is returned. + + @onerror - + *//*-*****************************************************************************************************/ + + Sequence< OUString > impl_GetPropertyNames(); +}; + +//_________________________________________________________________________________________________________________ +// definitions +//_________________________________________________________________________________________________________________ + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtInternalOptions_Impl::SvtInternalOptions_Impl() + // Init baseclasses first + : ConfigItem ( ROOTNODE_INTERNAL, CONFIG_MODE_IMMEDIATE_UPDATE ) + // Init member then. + , m_bRemoveMenuEntryClose ( sal_False ) + , m_bRemoveMenuEntryBackToWebtop ( sal_False ) + , m_bRemoveMenuEntryNewWebtop ( sal_False ) + , m_bRemoveMenuEntryLogout ( sal_False ) + , m_bSlotCFG ( DEFAULT_SLOTCFG ) + , m_bSendCrashMail ( DEFAULT_SENDCRASHMAIL ) + , m_bUseMailUI ( DEFAULT_USEMAILUI ) + , m_aCurrentTempURL ( DEFAULT_CURRENTTEMPURL ) +{ + // Use our list of configuration keys to get his values. + // structure of internal section: (first 2 entries are fixed - all other are member of a set!) + // "Slot" + // "SendCrashMail" + // "RecoveryList/r1/URL" + // "RecoveryList/r1/Filter" + // "RecoveryList/r1/TempName" + // "RecoveryList/r2/URL" + // "RecoveryList/r2/Filter" + // "RecoveryList/r2/TempName" + // "RecoveryList/.." + Sequence< OUString > seqNames = impl_GetPropertyNames() ; + Sequence< Any > seqValues = GetProperties( seqNames ) ; + + // Safe impossible cases. + // We need values from ALL configuration keys. + // Follow assignment use order of values in relation to our list of key names! + DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtInternalOptions_Impl::SvtInternalOptions_Impl()\nI miss some values of configuration keys!\n" ); + + // Read fixed values first! + DBG_ASSERT(!(seqValues[FIXPROPERTYHANDLE_SLOTCFG].getValueTypeClass()!=TypeClass_BOOLEAN) , "SvtInternalOptions_Impl::SvtInternalOptions_Impl()\nWho has changed the value type of \"Office.Common\\Internal\\Slot\"?" ); + DBG_ASSERT(!(seqValues[FIXPROPERTYHANDLE_SENDCRASHMAIL].getValueTypeClass()!=TypeClass_BOOLEAN) , "SvtInternalOptions_Impl::SvtInternalOptions_Impl()\nWho has changed the value type of \"Office.Common\\Internal\\SendCrashMail\"?" ); + seqValues[FIXPROPERTYHANDLE_SLOTCFG ] >>= m_bSlotCFG ; + seqValues[FIXPROPERTYHANDLE_SENDCRASHMAIL ] >>= m_bSendCrashMail ; + seqValues[FIXPROPERTYHANDLE_USEMAILUI ] >>= m_bUseMailUI ; + seqValues[FIXPROPERTYHANDLE_CURRENTTEMPURL ] >>= m_aCurrentTempURL ; +// seqValues[FIXPROPERTYHANDLE_REMOVEMENUENTRYCLOSE ] >>= m_bRemoveMenuEntryClose ; +// seqValues[FIXPROPERTYHANDLE_REMOVEMENUENTRYBACKTOWEBTOP ] >>= m_bRemoveMenuEntryBackToWebtop ; +// seqValues[FIXPROPERTYHANDLE_REMOVEMENUENTRYNEWWEBTOP ] >>= m_bRemoveMenuEntryNewWebtop ; +// seqValues[FIXPROPERTYHANDLE_REMOVEMENUENTRYLOGOUT ] >>= m_bRemoveMenuEntryLogout ; +/* + // Read dynamical set "RecoveryList" then. + // 3 subkeys for every item! + // Attention: Start at next element after last fixed entry! We must ignore "Slot" and "SendCrashMail" ... + tIMPL_RecoveryEntry aEntry; + sal_uInt32 nCount = seqValues.getLength() ; + sal_uInt32 nPosition = FIXPROPERTYCOUNT ; + + while( nPosition>= aEntry.sURL ; + ++nPosition; + seqValues[nPosition] >>= aEntry.sFilter ; + ++nPosition; + seqValues[nPosition] >>= aEntry.sTempName ; + ++nPosition; + m_aRecoveryList.push_front( aEntry ); + } +*/ + // We don't need any notifications here. + // "Slot" and "SendCrashMail" are readonly(!) and our recovery list should not modified during runtime - it's used + // by our crash guard only ... otherwise we have a big problem. +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtInternalOptions_Impl::~SvtInternalOptions_Impl() +{ + if( IsModified() == sal_True ) + { + Commit(); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtInternalOptions_Impl::Commit() +{ + // We have to write our current temp URL + Sequence< OUString > aNames( 1 ); + OUString* pNames = aNames.getArray(); + Sequence< Any > aValues( 1 ); + Any* pValues = aValues.getArray(); + + pNames[0] = FIXPROPERTYNAME_CURRENTTEMPURL; + pValues[0] <<= m_aCurrentTempURL; + + PutProperties( aNames, aValues ); + +/* + // Write set of dynamic properties then. + ClearNodeSet( PROPERTYNAME_RECOVERYLIST ); + + tIMPL_RecoveryEntry aItem ; + OUString sNode ; + Sequence< PropertyValue > seqPropertyValues( 3 ) ; // Every node in set has 3 sub-nodes!( url, filter, tempname ) + + // Copy list entries to save-list and write it to configuration. + + sal_uInt32 nCount = m_aRecoveryList.size(); + for( sal_uInt32 nItem=0; nItemsURL ; + seqPropertyValues[OFFSET_FILTER ].Value <<= iRecovery->sFilter ; + seqPropertyValues[OFFSET_TEMPNAME ].Value <<= iRecovery->sTempName ; + SetSetProperties( PROPERTYNAME_RECOVERYLIST, seqPropertyValues ); + } + + */ +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtInternalOptions_Impl::SetCurrentTempURL( const OUString& aNewCurrentTempURL ) +{ + m_aCurrentTempURL = aNewCurrentTempURL; + SetModified(); + Commit(); +} + +#if 0 +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtInternalOptions_Impl::PushRecoveryItem( const OUString& sURL , + const OUString& sFilter , + const OUString& sTempName ) +{ + tIMPL_RecoveryEntry aEntry( sURL, sFilter, sTempName ); + m_aRecoveryList.push_front( aEntry ); + SetModified(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtInternalOptions_Impl::PopRecoveryItem( OUString& sURL , + OUString& sFilter , + OUString& sTempName ) +{ + tIMPL_RecoveryEntry aEntry = m_aRecoveryList.front(); + m_aRecoveryList.pop_front(); + SetModified(); // Don't forget it - we delete an entry here! + sURL = aEntry.sURL ; + sFilter = aEntry.sFilter ; + sTempName = aEntry.sTempName ; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtInternalOptions_Impl::IsRecoveryListEmpty() const +{ + return ( m_aRecoveryList.empty() ); +} +#endif + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Sequence< OUString > SvtInternalOptions_Impl::impl_GetPropertyNames() +{ + /* + // First get ALL names of current existing list items in configuration! + Sequence< OUString > seqRecoveryItems = GetNodeNames( PROPERTYNAME_RECOVERYLIST ); + // Get information about list counts ... + sal_Int32 nRecoveryCount = seqRecoveryItems.getLength(); + // ... and create a property list with right size! (+2...for fix properties!) (*3 ... = sub nodes for every set node!) + Sequence< OUString > seqProperties( FIXPROPERTYCOUNT + (nRecoveryCount*3) ); + */ + Sequence< OUString > seqProperties(4); + + // Add names of fix properties to list. + seqProperties[FIXPROPERTYHANDLE_SLOTCFG ] = FIXPROPERTYNAME_SLOTCFG ; + seqProperties[FIXPROPERTYHANDLE_SENDCRASHMAIL ] = FIXPROPERTYNAME_SENDCRASHMAIL ; + seqProperties[FIXPROPERTYHANDLE_USEMAILUI ] = FIXPROPERTYNAME_USEMAILUI ; + seqProperties[FIXPROPERTYHANDLE_CURRENTTEMPURL ] = FIXPROPERTYNAME_CURRENTTEMPURL ; +// seqProperties[FIXPROPERTYHANDLE_REMOVEMENUENTRYCLOSE ] = FIXPROPERTYNAME_REMOVEMENUENTRYCLOSE; +// seqProperties[FIXPROPERTYHANDLE_REMOVEMENUENTRYBACKTOWEBTOP ] = FIXPROPERTYNAME_REMOVEMENUENTRYBACKTOWEBTOP; +// seqProperties[FIXPROPERTYHANDLE_REMOVEMENUENTRYNEWWEBTOP ] = FIXPROPERTYNAME_REMOVEMENUENTRYNEWWEBTOP; +// seqProperties[FIXPROPERTYHANDLE_REMOVEMENUENTRYLOGOUT ] = FIXPROPERTYNAME_REMOVEMENUENTRYLOGOUT; +/* + sal_uInt32 nPosition = FIXPROPERTYCOUNT; + // Add names for recovery list to list. + // 3 subkeys for every item! + // nPosition is the start point of an list item, nItem an index into right list of node names! + for( sal_Int32 nItem=0; nItemSlotCFGEnabled(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtInternalOptions::CrashMailEnabled() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->CrashMailEnabled(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtInternalOptions::MailUIEnabled() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->MailUIEnabled(); +} + +//***************************************************************************************************************** +// public methods +//***************************************************************************************************************** +sal_Bool SvtInternalOptions::IsRemoveMenuEntryClose() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsRemoveMenuEntryClose(); +} + +sal_Bool SvtInternalOptions::IsRemoveMenuEntryBackToWebtop() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsRemoveMenuEntryBackToWebtop(); +} + +sal_Bool SvtInternalOptions::IsRemoveMenuEntryNewWebtop() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsRemoveMenuEntryNewWebtop(); +} + +sal_Bool SvtInternalOptions::IsRemoveMenuEntryLogout() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsRemoveMenuEntryLogout(); +} + +OUString SvtInternalOptions::GetCurrentTempURL() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetCurrentTempURL(); +} + +void SvtInternalOptions::SetCurrentTempURL( const OUString& aNewCurrentTempURL ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetCurrentTempURL( aNewCurrentTempURL ); +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Mutex& SvtInternalOptions::GetOwnStaticMutex() +{ + // Initialize static mutex only for one time! + static Mutex* pMutex = NULL; + // If these method first called (Mutex not already exist!) ... + if( pMutex == NULL ) + { + // ... we must create a new one. Protect follow code with the global mutex - + // It must be - we create a static variable! + MutexGuard aGuard( Mutex::getGlobalMutex() ); + // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! + if( pMutex == NULL ) + { + // Create the new mutex and set it for return on static variable. + static Mutex aMutex; + pMutex = &aMutex; + } + } + // Return new created or already existing mutex object. + return *pMutex; +} diff --git a/unotools/source/config/itemholder1.cxx b/unotools/source/config/itemholder1.cxx new file mode 100644 index 000000000000..cf1194f6e652 --- /dev/null +++ b/unotools/source/config/itemholder1.cxx @@ -0,0 +1,326 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: itemholder1.cxx,v $ + * $Revision: 1.13 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" + +#include "itemholder1.hxx" + +//----------------------------------------------- +// includes +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//----------------------------------------------- +// namespaces + +namespace css = ::com::sun::star; + +//----------------------------------------------- +// declarations + +//----------------------------------------------- +ItemHolder1::ItemHolder1() + : ItemHolderMutexBase() +{ + try + { + css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); + css::uno::Reference< css::lang::XComponent > xCfg( + xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")), + css::uno::UNO_QUERY); + if (xCfg.is()) + xCfg->addEventListener(static_cast< css::lang::XEventListener* >(this)); + } +// #i37892 got errorhandling from ConfigManager::GetConfigurationProvider() +#ifdef DBG_UTIL + catch(css::uno::Exception& rEx) + { + static sal_Bool bMessage = sal_True; + if(bMessage) + { + bMessage = sal_False; + ::rtl::OString sMsg("CreateInstance with arguments exception: "); + sMsg += ::rtl::OString(rEx.Message.getStr(), + rEx.Message.getLength(), + RTL_TEXTENCODING_ASCII_US); + OSL_ENSURE(sal_False, sMsg.getStr()); + } + } +#else + catch(css::uno::Exception&){} +#endif +} + +//----------------------------------------------- +ItemHolder1::~ItemHolder1() +{ + impl_releaseAllItems(); +} + +//----------------------------------------------- +void ItemHolder1::holdConfigItem(EItem eItem) +{ + static ItemHolder1* pHolder = new ItemHolder1(); + pHolder->impl_addItem(eItem); +} + +//----------------------------------------------- +void SAL_CALL ItemHolder1::disposing(const css::lang::EventObject&) + throw(css::uno::RuntimeException) +{ + css::uno::Reference< css::uno::XInterface > xSelfHold(static_cast< css::lang::XEventListener* >(this), css::uno::UNO_QUERY); + impl_releaseAllItems(); +} + +//----------------------------------------------- +void ItemHolder1::impl_addItem(EItem eItem) +{ + ::osl::ResettableMutexGuard aLock(m_aLock); + + TItems::const_iterator pIt; + for ( pIt = m_lItems.begin(); + pIt != m_lItems.end() ; + ++pIt ) + { + const TItemInfo& rInfo = *pIt; + if (rInfo.eItem == eItem) + return; + } + + TItemInfo aNewItem; + aNewItem.eItem = eItem; + impl_newItem(aNewItem); + if (aNewItem.pItem) + m_lItems.push_back(aNewItem); +} + +//----------------------------------------------- +void ItemHolder1::impl_releaseAllItems() +{ + ::osl::ResettableMutexGuard aLock(m_aLock); + + TItems::iterator pIt; + for ( pIt = m_lItems.begin(); + pIt != m_lItems.end() ; + ++pIt ) + { + TItemInfo& rInfo = *pIt; + impl_deleteItem(rInfo); + } + m_lItems.clear(); +} + +//----------------------------------------------- +void ItemHolder1::impl_newItem(TItemInfo& rItem) +{ + switch(rItem.eItem) + { + case E_ACCELCFG : + rItem.pItem = new SvtAcceleratorConfiguration(); + break; + + case E_CMDOPTIONS : + rItem.pItem = new SvtCommandOptions(); + break; + + case E_COMPATIBILITY : + rItem.pItem = new SvtCompatibilityOptions(); + break; + + case E_DEFAULTOPTIONS : + rItem.pItem = new SvtDefaultOptions(); + break; + + case E_DYNAMICMENUOPTIONS : + rItem.pItem = new SvtDynamicMenuOptions(); + break; + + case E_EVENTCFG : + //rItem.pItem = new GlobalEventConfig(); + break; + + case E_EXTENDEDSECURITYOPTIONS : + rItem.pItem = new SvtExtendedSecurityOptions(); + break; + + case E_FLTRCFG : +// no ref count rItem.pItem = new SvtFilterOptions(); + break; + + case E_FONTOPTIONS : + rItem.pItem = new SvtFontOptions(); + break; + + case E_HISTORYOPTIONS : + rItem.pItem = new SvtHistoryOptions(); + break; + + case E_INETOPTIONS : + rItem.pItem = new SvtInetOptions(); + break; + + case E_INTERNALOPTIONS : + rItem.pItem = new SvtInternalOptions(); + break; + + case E_JAVAOPTIONS : +// no ref count rItem.pItem = new SvtJavaOptions(); + break; + + case E_LINGUCFG : + rItem.pItem = new SvtLinguConfig(); + break; + + case E_LOCALISATIONOPTIONS : + rItem.pItem = new SvtLocalisationOptions(); + break; + + case E_MODULEOPTIONS : + rItem.pItem = new SvtModuleOptions(); + break; + + case E_OPTIONSDLGOPTIONS : + rItem.pItem = new SvtOptionsDialogOptions(); + break; + + case E_PATHOPTIONS : + rItem.pItem = new SvtPathOptions(); + break; + + case E_PRINTWARNINGOPTIONS : + rItem.pItem = new SvtPrintWarningOptions(); + break; + + case E_REGOPTIONS : +// no ref count rItem.pItem = new ::utl::RegOptions(); + break; + + case E_SAVEOPTIONS : + rItem.pItem = new SvtSaveOptions(); + break; + + case E_SEARCHOPT : +// no ref count rItem.pItem = new SvtSearchOptions(); + break; + + case E_SECURITYOPTIONS : + rItem.pItem = new SvtSecurityOptions(); + break; + + case E_SOURCEVIEWCONFIG : + rItem.pItem = new ::utl::SourceViewConfig(); + break; + + case E_STARTOPTIONS : + rItem.pItem = new SvtStartOptions(); + break; + + case E_VIEWOPTIONS_DIALOG : + rItem.pItem = new SvtViewOptions(E_DIALOG, ::rtl::OUString()); + break; + + case E_VIEWOPTIONS_TABDIALOG : + rItem.pItem = new SvtViewOptions(E_TABDIALOG, ::rtl::OUString()); + break; + + case E_VIEWOPTIONS_TABPAGE : + rItem.pItem = new SvtViewOptions(E_TABPAGE, ::rtl::OUString()); + break; + + case E_VIEWOPTIONS_WINDOW : + rItem.pItem = new SvtViewOptions(E_WINDOW, ::rtl::OUString()); + break; + + case E_WORKINGSETOPTIONS : + rItem.pItem = new SvtWorkingSetOptions(); + break; + + case E_XMLACCELCFG : + // ??? TODO + break; + + case E_UNDOOPTIONS : + rItem.pItem = new SvtUndoOptions(); + break; + + case E_USEROPTIONS : + rItem.pItem = new SvtUserOptions(); + break; + + default: + OSL_ASSERT( "unknown item type" ); + break; + } +} + +//----------------------------------------------- +void ItemHolder1::impl_deleteItem(TItemInfo& rItem) +{ + if (rItem.pItem) + { + delete rItem.pItem; + rItem.pItem = 0; + } +} + diff --git a/unotools/source/config/itemholder1.hxx b/unotools/source/config/itemholder1.hxx new file mode 100644 index 000000000000..89a5bc3da299 --- /dev/null +++ b/unotools/source/config/itemholder1.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: itemholder1.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_unotools_ITEMHOLDER1_HXX_ +#define INCLUDED_unotools_ITEMHOLDER1_HXX_ + +//----------------------------------------------- +// includes + +#include +#include +#include + +//----------------------------------------------- +// namespaces + +#ifdef css +#error "Cant use css as namespace alias." +#else +#define css ::com::sun::star +#endif + +//----------------------------------------------- +// definitions + +class ItemHolder1 : private ItemHolderMutexBase + , public ::cppu::WeakImplHelper1< css::lang::XEventListener > +{ + //........................................... + // member + private: + + TItems m_lItems; + + //........................................... + // c++ interface + public: + + ItemHolder1(); + virtual ~ItemHolder1(); + static void holdConfigItem(EItem eItem); + + //........................................... + // uno interface + public: + + virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) + throw(css::uno::RuntimeException); + + //........................................... + // helper + private: + + void impl_addItem(EItem eItem); + void impl_releaseAllItems(); + void impl_newItem(TItemInfo& rItem); + void impl_deleteItem(TItemInfo& rItem); +}; + +//----------------------------------------------- +// namespaces + +#undef css + +#endif // INCLUDED_unotools_ITEMHOLDER1_HXX_ diff --git a/unotools/source/config/javaoptions.cxx b/unotools/source/config/javaoptions.cxx new file mode 100644 index 000000000000..91a74f43b886 --- /dev/null +++ b/unotools/source/config/javaoptions.cxx @@ -0,0 +1,367 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: javaoptions.cxx,v $ + * $Revision: 1.9 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +#ifndef GCC +#endif + +#ifndef _unotools_JAVAPTIONS_HXX +#include +#endif +#include +#include +#include + + +using namespace ::com::sun::star::uno; +using namespace ::rtl; + +#define C2U(cChar) OUString::createFromAscii(cChar) +#define CFG_READONLY_DEFAULT sal_False +/* -----------------------------10.04.01 12:39-------------------------------- + + ---------------------------------------------------------------------------*/ +class SvtExecAppletsItem_Impl : public utl::ConfigItem +{ + sal_Bool bExecute; + sal_Bool bRO; +public: + SvtExecAppletsItem_Impl(); + + virtual void Commit(); + + sal_Bool IsExecuteApplets() const {return bExecute;} + void SetExecuteApplets(sal_Bool bSet); + sal_Bool IsReadOnly() const {return bRO;} +}; +/* -----------------------------10.02.2003 07:46------------------------------ + + ---------------------------------------------------------------------------*/ +void SvtExecAppletsItem_Impl::SetExecuteApplets(sal_Bool bSet) +{ + OSL_ENSURE(!bRO, "SvtExecAppletsItem_Impl::SetExecuteApplets()\nYou tried to write on a readonly value!\n"); + if (!bRO) + { + bExecute = bSet; + SetModified(); + } +} +/* -----------------------------18.05.01 14:44-------------------------------- + + ---------------------------------------------------------------------------*/ +SvtExecAppletsItem_Impl::SvtExecAppletsItem_Impl() : + utl::ConfigItem(C2U("Office.Common/Java/Applet")), + bExecute (sal_False ), + bRO (CFG_READONLY_DEFAULT ) +{ + RTL_LOGFILE_CONTEXT(aLog, "unotools SvtExecAppletsItem_Impl::SvtExecAppletsItem_Impl()"); + + Sequence< OUString > aNames(1); + aNames.getArray()[0] = C2U("Enable"); + Sequence< Any > aValues = GetProperties(aNames); + Sequence< sal_Bool > aROStates = GetReadOnlyStates(aNames); + const Any* pValues = aValues.getConstArray(); + const sal_Bool* pROStates = aROStates.getConstArray(); + if(aValues.getLength() && aROStates.getLength() && pValues[0].hasValue()) + { + bExecute = *(sal_Bool*)pValues[0].getValue(); + bRO = pROStates[0]; + } +} +void SvtExecAppletsItem_Impl::Commit() +{ + if (bRO) + return; + + Sequence< OUString > aNames(1); + aNames.getArray()[0] = C2U("Enable"); + Sequence< Any > aValues(1); + aValues.getArray()[0].setValue(&bExecute, ::getBooleanCppuType()); + PutProperties(aNames, aValues); +} + + +struct SvtJavaOptions_Impl +{ + SvtExecAppletsItem_Impl aExecItem; + Sequence aPropertyNames; + sal_Bool bEnabled; + sal_Bool bSecurity; + sal_Int32 nNetAccess; + rtl::OUString sUserClassPath; + + sal_Bool bROEnabled; + sal_Bool bROSecurity; + sal_Bool bRONetAccess; + sal_Bool bROUserClassPath; + + SvtJavaOptions_Impl() : + aPropertyNames(4), + bEnabled (sal_False), + bSecurity (sal_False), + nNetAccess (0), + bROEnabled (CFG_READONLY_DEFAULT), + bROSecurity (CFG_READONLY_DEFAULT), + bRONetAccess (CFG_READONLY_DEFAULT), + bROUserClassPath (CFG_READONLY_DEFAULT) + { + OUString* pNames = aPropertyNames.getArray(); + pNames[0] = C2U("Enable"); + pNames[1] = C2U("Security"); + pNames[2] = C2U("NetAccess"); + pNames[3] = C2U("UserClassPath"); + } +}; +/* -----------------------------18.05.01 13:28-------------------------------- + + ---------------------------------------------------------------------------*/ +SvtJavaOptions::SvtJavaOptions() : + utl::ConfigItem(C2U("Office.Java/VirtualMachine")), + pImpl(new SvtJavaOptions_Impl) +{ + RTL_LOGFILE_CONTEXT(aLog, "unotools SvtJavaOptions::SvtJavaOptions()"); + + Sequence< Any > aValues = GetProperties(pImpl->aPropertyNames); + Sequence< sal_Bool > aROStates = GetReadOnlyStates(pImpl->aPropertyNames); + const Any* pValues = aValues.getConstArray(); + const sal_Bool* pROStates = aROStates.getConstArray(); + if ( aValues.getLength() == pImpl->aPropertyNames.getLength() && aROStates.getLength() == pImpl->aPropertyNames.getLength() ) + { + for ( int nProp = 0; nProp < pImpl->aPropertyNames.getLength(); nProp++ ) + { + if( pValues[nProp].hasValue() ) + { + switch ( nProp ) + { + case 0: pImpl->bEnabled = *(sal_Bool*)pValues[nProp].getValue(); break; + case 1: pImpl->bSecurity = *(sal_Bool*)pValues[nProp].getValue();break; + case 2: pValues[nProp] >>= pImpl->nNetAccess; break; + case 3: pValues[nProp] >>= pImpl->sUserClassPath; break; + } + } + } + pImpl->bROEnabled = pROStates[0]; + pImpl->bROSecurity = pROStates[1]; + pImpl->bRONetAccess = pROStates[2]; + pImpl->bROUserClassPath = pROStates[3]; + } +} +/* -----------------------------18.05.01 13:28-------------------------------- + + ---------------------------------------------------------------------------*/ +SvtJavaOptions::~SvtJavaOptions() +{ + delete pImpl; +} +/*-- 18.05.01 13:28:35--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvtJavaOptions::Commit() +{ + pImpl->aExecItem.Commit(); + + sal_Int32 nOrgCount = pImpl->aPropertyNames.getLength(); + Sequence< OUString > aNames(nOrgCount); + Sequence< Any > aValues(nOrgCount); + sal_Int32 nRealCount = 0; + + const Type& rType = ::getBooleanCppuType(); + for(int nProp = 0; nProp < nOrgCount; nProp++) + { + switch(nProp) + { + case 0: + { + if (!pImpl->bROEnabled) + { + aValues[nRealCount].setValue(&pImpl->bEnabled, rType); + aNames[nRealCount] = pImpl->aPropertyNames[nProp]; + ++nRealCount; + } + } + break; + case 1: + { + if (!pImpl->bROSecurity) + { + aValues[nRealCount].setValue(&pImpl->bSecurity, rType); + aNames[nRealCount] = pImpl->aPropertyNames[nProp]; + ++nRealCount; + } + } + break; + case 2: + { + if (!pImpl->bRONetAccess) + { + aValues[nRealCount] <<= pImpl->nNetAccess; + aNames[nRealCount] = pImpl->aPropertyNames[nProp]; + ++nRealCount; + } + } + break; + case 3: + { + if (!pImpl->bROUserClassPath) + { + aValues[nRealCount] <<= pImpl->sUserClassPath; + aNames[nRealCount] = pImpl->aPropertyNames[nProp]; + ++nRealCount; + } + } + break; + } + } + aValues.realloc(nRealCount); + aNames.realloc(nRealCount); + PutProperties(aNames,aValues); +} +/*-- 18.05.01 13:28:35--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Bool SvtJavaOptions::IsEnabled() const +{ + return pImpl->bEnabled; +} +/*-- 18.05.01 13:28:35--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Bool SvtJavaOptions::IsSecurity()const +{ + return pImpl->bSecurity; +} +/*-- 18.05.01 13:28:35--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Int32 SvtJavaOptions::GetNetAccess() const +{ + return pImpl->nNetAccess; +} +/*-- 18.05.01 13:28:36--------------------------------------------------- + + -----------------------------------------------------------------------*/ +rtl::OUString& SvtJavaOptions::GetUserClassPath()const +{ + return pImpl->sUserClassPath; +} +/*-- 18.05.01 13:28:37--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvtJavaOptions::SetEnabled(sal_Bool bSet) +{ + OSL_ENSURE(!pImpl->bROEnabled, "SvtJavaOptions::SetEnabled()\nYou tried to write on a readonly value!\n"); + if(!pImpl->bROEnabled && pImpl->bEnabled != bSet) + { + pImpl->bEnabled = bSet; + SetModified(); + } +} +/*-- 18.05.01 13:28:38--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvtJavaOptions::SetSecurity(sal_Bool bSet) +{ + OSL_ENSURE(!pImpl->bROSecurity, "SvtJavaOptions::SetSecurity()\nYou tried to write on a readonly value!\n"); + if(!pImpl->bROSecurity && pImpl->bSecurity != bSet) + { + pImpl->bSecurity = bSet; + SetModified(); + } +} +/*-- 18.05.01 13:28:38--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvtJavaOptions::SetNetAccess(sal_Int32 nSet) +{ + OSL_ENSURE(!pImpl->bRONetAccess, "SvtJavaOptions::SetNetAccess()\nYou tried to write on a readonly value!\n"); + if(!pImpl->bRONetAccess && pImpl->nNetAccess != nSet) + { + pImpl->nNetAccess = nSet; + SetModified(); + } +} +/*-- 18.05.01 13:28:38--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvtJavaOptions::SetUserClassPath(const rtl::OUString& rSet) +{ + OSL_ENSURE(!pImpl->bROUserClassPath, "SvtJavaOptions::SetUserClassPath()\nYou tried to write on a readonly value!\n"); + if(!pImpl->bROUserClassPath && pImpl->sUserClassPath != rSet) + { + pImpl->sUserClassPath = rSet; + SetModified(); + } +} + +/*-- 18.05.01 14:34:32--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Bool SvtJavaOptions::IsExecuteApplets() const +{ + return pImpl->aExecItem.IsExecuteApplets(); +} +/*-- 18.05.01 14:34:32--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvtJavaOptions::SetExecuteApplets(sal_Bool bSet) +{ + if(!pImpl->aExecItem.IsReadOnly() && pImpl->aExecItem.IsExecuteApplets() != bSet) + { + pImpl->aExecItem.SetExecuteApplets(bSet); + SetModified(); + } +} +/*--10.02.2003 08:40--------------------------------------------------- + +-----------------------------------------------------------------------*/ +sal_Bool SvtJavaOptions::IsReadOnly( EOption eOption ) const +{ + sal_Bool bRO = sal_True; + switch(eOption) + { + case E_ENABLED : + bRO = pImpl->bROEnabled; + break; + case E_SECURITY : + bRO = pImpl->bROSecurity; + break; + case E_NETACCESS : + bRO = pImpl->bRONetAccess; + break; + case E_USERCLASSPATH : + bRO = pImpl->bROUserClassPath; + break; + case E_EXECUTEAPPLETS : + bRO = pImpl->aExecItem.IsReadOnly(); + break; + } + return bRO; +} diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx new file mode 100644 index 000000000000..25da00dd4a26 --- /dev/null +++ b/unotools/source/config/lingucfg.cxx @@ -0,0 +1,1450 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: lingucfg.cxx,v $ + * $Revision: 1.14 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" + + +#include +#include +#include +#include +#include +#include +#include "com/sun/star/util/XMacroExpander.hpp" +#include "com/sun/star/beans/XPropertySet.hpp" +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +using namespace rtl; +using namespace com::sun::star; + +#define A2OU(x) ::rtl::OUString::createFromAscii( x ) +#define EXPAND_PROTOCOL "vnd.sun.star.expand:" +#define FILE_PROTOCOL "file:///" + +/////////////////////////////////////////////////////////////////////////// + + +static osl::Mutex & GetOwnMutex() +{ + static osl::Mutex aMutex; + return aMutex; +} + + +/////////////////////////////////////////////////////////////////////////// + + +static BOOL lcl_SetLocale( INT16 &rLanguage, const uno::Any &rVal ) +{ + BOOL bSucc = FALSE; + + lang::Locale aNew; + if (rVal >>= aNew) // conversion successful? + { + INT16 nNew = MsLangId::convertLocaleToLanguage( aNew ); + if (nNew != rLanguage) + { + rLanguage = nNew; + bSucc = TRUE; + } + } + return bSucc; +} + + +static inline const OUString lcl_LanguageToCfgLocaleStr( INT16 nLanguage ) +{ + OUString aRes; + if (LANGUAGE_SYSTEM != nLanguage) + aRes = MsLangId::convertLanguageToIsoString( nLanguage ); + return aRes; +} + + +static INT16 lcl_CfgAnyToLanguage( const uno::Any &rVal ) +{ + OUString aTmp; + rVal >>= aTmp; + return (aTmp.getLength() == 0) ? LANGUAGE_SYSTEM : MsLangId::convertIsoStringToLanguage( aTmp ); +} + + +////////////////////////////////////////////////////////////////////// + +SvtLinguOptions::SvtLinguOptions() +{ + nDefaultLanguage = LANGUAGE_NONE; + nDefaultLanguage_CJK = LANGUAGE_NONE; + nDefaultLanguage_CTL = LANGUAGE_NONE; + + // general options + bIsUseDictionaryList = + bIsIgnoreControlCharacters = TRUE; + + // spelling options + bIsSpellCapitalization = + bIsSpellSpecial = TRUE; + bIsSpellAuto = + bIsSpellReverse = + bIsSpellWithDigits = + bIsSpellUpperCase = FALSE; + + // text conversion options + bIsIgnorePostPositionalWord = TRUE; + bIsAutoCloseDialog = + bIsShowEntriesRecentlyUsedFirst = + bIsAutoReplaceUniqueEntries = FALSE; + bIsDirectionToSimplified = TRUE; + bIsUseCharacterVariants = + bIsTranslateCommonTerms = + bIsReverseMapping = FALSE; + + bROIsDirectionToSimplified = + bROIsUseCharacterVariants = + bROIsTranslateCommonTerms = + bROIsReverseMapping = FALSE; + + // hyphenation options + bIsHyphSpecial = TRUE; + bIsHyphAuto = FALSE; + nHyphMinLeading = + nHyphMinTrailing = 2; + nHyphMinWordLength = 0; + + nDataFilesChangedCheckValue = 0; + + //grammar options + bIsGrammarAuto = sal_False, + bIsGrammarInteractive = sal_False; + +} + + +////////////////////////////////////////////////////////////////////// + + +class SvtLinguConfigItem : public utl::ConfigItem +{ + SvtLinguOptions aOpt; + + // disallow copy-constructor and assignment-operator for now + SvtLinguConfigItem( const SvtLinguConfigItem & ); + SvtLinguConfigItem & operator = ( const SvtLinguConfigItem & ); + + static BOOL GetHdlByName( INT32 &rnHdl, const OUString &rPropertyName, sal_Bool bFullPropName = sal_False ); + static const uno::Sequence< OUString > & GetPropertyNames(); + BOOL LoadOptions( const uno::Sequence< OUString > &rProperyNames ); + BOOL SaveOptions( const uno::Sequence< OUString > &rProperyNames ); + +public: + SvtLinguConfigItem(); + virtual ~SvtLinguConfigItem(); + + // utl::ConfigItem + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString > &rPropertyNames ); + virtual void Commit(); + + // make some protected functions of utl::ConfigItem public + using utl::ConfigItem::GetNodeNames; + using utl::ConfigItem::GetProperties; + //using utl::ConfigItem::PutProperties; + //using utl::ConfigItem::SetSetProperties; + using utl::ConfigItem::ReplaceSetProperties; + //using utl::ConfigItem::GetReadOnlyStates; + + + com::sun::star::uno::Any + GetProperty( const rtl::OUString &rPropertyName ) const; + com::sun::star::uno::Any + GetProperty( INT32 nPropertyHandle ) const; + + BOOL SetProperty( const rtl::OUString &rPropertyName, + const com::sun::star::uno::Any &rValue ); + BOOL SetProperty( INT32 nPropertyHandle, + const com::sun::star::uno::Any &rValue ); + + BOOL GetOptions( SvtLinguOptions &rOptions ) const; + BOOL SetOptions( const SvtLinguOptions &rOptions ); + + BOOL IsReadOnly( const rtl::OUString &rPropertyName ) const; + BOOL IsReadOnly( INT32 nPropertyHandle ) const; +}; + + +SvtLinguConfigItem::SvtLinguConfigItem() : + utl::ConfigItem( String::CreateFromAscii( "Office.Linguistic" ) ) +{ + LoadOptions( GetPropertyNames() ); + ClearModified(); + + // request notify events when properties change + EnableNotification( GetPropertyNames() ); +} + + +SvtLinguConfigItem::~SvtLinguConfigItem() +{ + //! Commit (SaveOptions) will be called by the d-tor of the base called ! +} + + +void SvtLinguConfigItem::Notify( const uno::Sequence< OUString > &rPropertyNames ) +{ + LoadOptions( rPropertyNames ); +} + + +void SvtLinguConfigItem::Commit() +{ + SaveOptions( GetPropertyNames() ); +} + + +static struct NamesToHdl +{ + const char *pFullPropName; // full qualified name as used in configuration + const char *pPropName; // property name only (atom) of above + INT32 nHdl; // numeric handle representing the property +}aNamesToHdl[] = +{ +{/* 0 */ "General/DefaultLocale", UPN_DEFAULT_LOCALE, UPH_DEFAULT_LOCALE}, +{/* 1 */ "General/DictionaryList/ActiveDictionaries", UPN_ACTIVE_DICTIONARIES, UPH_ACTIVE_DICTIONARIES}, +{/* 2 */ "General/DictionaryList/IsUseDictionaryList", UPN_IS_USE_DICTIONARY_LIST, UPH_IS_USE_DICTIONARY_LIST}, +{/* 3 */ "General/IsIgnoreControlCharacters", UPN_IS_IGNORE_CONTROL_CHARACTERS, UPH_IS_IGNORE_CONTROL_CHARACTERS}, +{/* 5 */ "General/DefaultLocale_CJK", UPN_DEFAULT_LOCALE_CJK, UPH_DEFAULT_LOCALE_CJK}, +{/* 6 */ "General/DefaultLocale_CTL", UPN_DEFAULT_LOCALE_CTL, UPH_DEFAULT_LOCALE_CTL}, + +{/* 7 */ "SpellChecking/IsSpellUpperCase", UPN_IS_SPELL_UPPER_CASE, UPH_IS_SPELL_UPPER_CASE}, +{/* 8 */ "SpellChecking/IsSpellWithDigits", UPN_IS_SPELL_WITH_DIGITS, UPH_IS_SPELL_WITH_DIGITS}, +{/* 9 */ "SpellChecking/IsSpellCapitalization", UPN_IS_SPELL_CAPITALIZATION, UPH_IS_SPELL_CAPITALIZATION}, +{/* 10 */ "SpellChecking/IsSpellAuto", UPN_IS_SPELL_AUTO, UPH_IS_SPELL_AUTO}, +{/* 11 */ "SpellChecking/IsSpellSpecial", UPN_IS_SPELL_SPECIAL, UPH_IS_SPELL_SPECIAL}, +{/* 14 */ "SpellChecking/IsReverseDirection", UPN_IS_WRAP_REVERSE, UPH_IS_WRAP_REVERSE}, + +{/* 15 */ "Hyphenation/MinLeading", UPN_HYPH_MIN_LEADING, UPH_HYPH_MIN_LEADING}, +{/* 16 */ "Hyphenation/MinTrailing", UPN_HYPH_MIN_TRAILING, UPH_HYPH_MIN_TRAILING}, +{/* 17 */ "Hyphenation/MinWordLength", UPN_HYPH_MIN_WORD_LENGTH, UPH_HYPH_MIN_WORD_LENGTH}, +{/* 18 */ "Hyphenation/IsHyphSpecial", UPN_IS_HYPH_SPECIAL, UPH_IS_HYPH_SPECIAL}, +{/* 19 */ "Hyphenation/IsHyphAuto", UPN_IS_HYPH_AUTO, UPH_IS_HYPH_AUTO}, + +{/* 20 */ "TextConversion/ActiveConversionDictionaries", UPN_ACTIVE_CONVERSION_DICTIONARIES, UPH_ACTIVE_CONVERSION_DICTIONARIES}, +{/* 21 */ "TextConversion/IsIgnorePostPositionalWord", UPN_IS_IGNORE_POST_POSITIONAL_WORD, UPH_IS_IGNORE_POST_POSITIONAL_WORD}, +{/* 22 */ "TextConversion/IsAutoCloseDialog", UPN_IS_AUTO_CLOSE_DIALOG, UPH_IS_AUTO_CLOSE_DIALOG}, +{/* 23 */ "TextConversion/IsShowEntriesRecentlyUsedFirst", UPN_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST, UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST}, +{/* 24 */ "TextConversion/IsAutoReplaceUniqueEntries", UPN_IS_AUTO_REPLACE_UNIQUE_ENTRIES, UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES}, +{/* 25 */ "TextConversion/IsDirectionToSimplified", UPN_IS_DIRECTION_TO_SIMPLIFIED, UPH_IS_DIRECTION_TO_SIMPLIFIED}, +{/* 26 */ "TextConversion/IsUseCharacterVariants", UPN_IS_USE_CHARACTER_VARIANTS, UPH_IS_USE_CHARACTER_VARIANTS}, +{/* 27 */ "TextConversion/IsTranslateCommonTerms", UPN_IS_TRANSLATE_COMMON_TERMS, UPH_IS_TRANSLATE_COMMON_TERMS}, +{/* 28 */ "TextConversion/IsReverseMapping", UPN_IS_REVERSE_MAPPING, UPH_IS_REVERSE_MAPPING}, + +{/* 29 */ "ServiceManager/DataFilesChangedCheckValue", UPN_DATA_FILES_CHANGED_CHECK_VALUE, UPH_DATA_FILES_CHANGED_CHECK_VALUE}, + +{/* 30 */ "GrammarChecking/IsAutoCheck", UPN_IS_GRAMMAR_AUTO, UPH_IS_GRAMMAR_AUTO}, +{/* 31 */ "GrammarChecking/IsInteractiveCheck", UPN_IS_GRAMMAR_INTERACTIVE, UPH_IS_GRAMMAR_INTERACTIVE}, + + /* similar to entry 0 (thus no own configuration entry) but with different property name and type */ +{ NULL, UPN_DEFAULT_LANGUAGE, UPH_DEFAULT_LANGUAGE}, + +{ NULL, NULL, -1} +}; + + +const uno::Sequence< OUString > & SvtLinguConfigItem::GetPropertyNames() +{ + static uno::Sequence< OUString > aNames; + static sal_Bool bInitialized = sal_False; + + if (!bInitialized) + { + INT32 nMax = sizeof(aNamesToHdl) / sizeof(aNamesToHdl[0]); + + aNames.realloc( nMax ); + OUString *pNames = aNames.getArray(); + INT32 nIdx = 0; + for (INT32 i = 0; i < nMax; ++i) + { + const sal_Char *pFullPropName = aNamesToHdl[i].pFullPropName; + if (pFullPropName) + pNames[ nIdx++ ] = A2OU( pFullPropName ); + } + aNames.realloc( nIdx ); + bInitialized = sal_True; + } + return aNames; +} + + +BOOL SvtLinguConfigItem::GetHdlByName( + INT32 &rnHdl, + const OUString &rPropertyName, + sal_Bool bFullPropName ) +{ + NamesToHdl *pEntry = &aNamesToHdl[0]; + + if (bFullPropName) + { + while (pEntry && pEntry->pFullPropName != NULL) + { + if (0 == rPropertyName.compareToAscii( pEntry->pFullPropName )) + { + rnHdl = pEntry->nHdl; + break; + } + ++pEntry; + } + return pEntry && pEntry->pFullPropName != NULL; + } + else + { + while (pEntry && pEntry->pPropName != NULL) + { + if (0 == rPropertyName.compareToAscii( pEntry->pPropName )) + { + rnHdl = pEntry->nHdl; + break; + } + ++pEntry; + } + return pEntry && pEntry->pPropName != NULL; + } +} + + +uno::Any SvtLinguConfigItem::GetProperty( const OUString &rPropertyName ) const +{ + osl::MutexGuard aGuard( GetOwnMutex() ); + + INT32 nHdl; + return GetHdlByName( nHdl, rPropertyName ) ? GetProperty( nHdl ) : uno::Any(); +} + + +uno::Any SvtLinguConfigItem::GetProperty( INT32 nPropertyHandle ) const +{ + osl::MutexGuard aGuard( GetOwnMutex() ); + + uno::Any aRes; + + const INT16 *pnVal = 0; + const BOOL *pbVal = 0; + const INT32 *pnInt32Val = 0; + + const SvtLinguOptions &rOpt = const_cast< SvtLinguConfigItem * >(this)->aOpt; + switch (nPropertyHandle) + { + case UPH_IS_USE_DICTIONARY_LIST : pbVal = &rOpt.bIsUseDictionaryList; break; + case UPH_IS_IGNORE_CONTROL_CHARACTERS : pbVal = &rOpt.bIsIgnoreControlCharacters; break; + case UPH_IS_HYPH_AUTO : pbVal = &rOpt.bIsHyphAuto; break; + case UPH_IS_HYPH_SPECIAL : pbVal = &rOpt.bIsHyphSpecial; break; + case UPH_IS_SPELL_AUTO : pbVal = &rOpt.bIsSpellAuto; break; + case UPH_IS_SPELL_SPECIAL : pbVal = &rOpt.bIsSpellSpecial; break; + case UPH_IS_WRAP_REVERSE : pbVal = &rOpt.bIsSpellReverse; break; + case UPH_DEFAULT_LANGUAGE : pnVal = &rOpt.nDefaultLanguage; break; + case UPH_IS_SPELL_CAPITALIZATION : pbVal = &rOpt.bIsSpellCapitalization; break; + case UPH_IS_SPELL_WITH_DIGITS : pbVal = &rOpt.bIsSpellWithDigits; break; + case UPH_IS_SPELL_UPPER_CASE : pbVal = &rOpt.bIsSpellUpperCase; break; + case UPH_HYPH_MIN_LEADING : pnVal = &rOpt.nHyphMinLeading; break; + case UPH_HYPH_MIN_TRAILING : pnVal = &rOpt.nHyphMinTrailing; break; + case UPH_HYPH_MIN_WORD_LENGTH : pnVal = &rOpt.nHyphMinWordLength; break; + case UPH_ACTIVE_DICTIONARIES : + { + aRes <<= rOpt.aActiveDics; + break; + } + case UPH_ACTIVE_CONVERSION_DICTIONARIES : + { + aRes <<= rOpt.aActiveConvDics; + break; + } + case UPH_DEFAULT_LOCALE : + { + lang::Locale aLocale( MsLangId::convertLanguageToLocale( rOpt.nDefaultLanguage, false ) ); + aRes.setValue( &aLocale, ::getCppuType((lang::Locale*)0 )); + break; + } + case UPH_DEFAULT_LOCALE_CJK : + { + lang::Locale aLocale( MsLangId::convertLanguageToLocale( rOpt.nDefaultLanguage_CJK, false ) ); + aRes.setValue( &aLocale, ::getCppuType((lang::Locale*)0 )); + break; + } + case UPH_DEFAULT_LOCALE_CTL : + { + lang::Locale aLocale( MsLangId::convertLanguageToLocale( rOpt.nDefaultLanguage_CTL, false ) ); + aRes.setValue( &aLocale, ::getCppuType((lang::Locale*)0 )); + break; + } + case UPH_IS_IGNORE_POST_POSITIONAL_WORD : pbVal = &rOpt.bIsIgnorePostPositionalWord; break; + case UPH_IS_AUTO_CLOSE_DIALOG : pbVal = &rOpt.bIsAutoCloseDialog; break; + case UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST : pbVal = &rOpt.bIsShowEntriesRecentlyUsedFirst; break; + case UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES : pbVal = &rOpt.bIsAutoReplaceUniqueEntries; break; + + case UPH_IS_DIRECTION_TO_SIMPLIFIED: pbVal = &rOpt.bIsDirectionToSimplified; break; + case UPH_IS_USE_CHARACTER_VARIANTS : pbVal = &rOpt.bIsUseCharacterVariants; break; + case UPH_IS_TRANSLATE_COMMON_TERMS : pbVal = &rOpt.bIsTranslateCommonTerms; break; + case UPH_IS_REVERSE_MAPPING : pbVal = &rOpt.bIsReverseMapping; break; + + case UPH_DATA_FILES_CHANGED_CHECK_VALUE : pnInt32Val = &rOpt.nDataFilesChangedCheckValue; break; + case UPH_IS_GRAMMAR_AUTO: pbVal = &rOpt.bIsGrammarAuto; break; + case UPH_IS_GRAMMAR_INTERACTIVE: pbVal = &rOpt.bIsGrammarInteractive; break; + default : + DBG_ASSERT( 0, "unexpected property handle" ); + } + + if (pbVal) + aRes <<= *pbVal; + else if (pnVal) + aRes <<= *pnVal; + else if (pnInt32Val) + aRes <<= *pnInt32Val; + + return aRes; +} + + +BOOL SvtLinguConfigItem::SetProperty( const OUString &rPropertyName, const uno::Any &rValue ) +{ + osl::MutexGuard aGuard( GetOwnMutex() ); + + BOOL bSucc = FALSE; + INT32 nHdl; + if (GetHdlByName( nHdl, rPropertyName )) + bSucc = SetProperty( nHdl, rValue ); + return bSucc; +} + + +BOOL SvtLinguConfigItem::SetProperty( INT32 nPropertyHandle, const uno::Any &rValue ) +{ + osl::MutexGuard aGuard( GetOwnMutex() ); + + BOOL bSucc = FALSE; + if (!rValue.hasValue()) + return bSucc; + + BOOL bMod = FALSE; + + INT16 *pnVal = 0; + BOOL *pbVal = 0; + INT32 *pnInt32Val = 0; + + SvtLinguOptions &rOpt = aOpt; + switch (nPropertyHandle) + { + case UPH_IS_USE_DICTIONARY_LIST : pbVal = &rOpt.bIsUseDictionaryList; break; + case UPH_IS_IGNORE_CONTROL_CHARACTERS : pbVal = &rOpt.bIsIgnoreControlCharacters; break; + case UPH_IS_HYPH_AUTO : pbVal = &rOpt.bIsHyphAuto; break; + case UPH_IS_HYPH_SPECIAL : pbVal = &rOpt.bIsHyphSpecial; break; + case UPH_IS_SPELL_AUTO : pbVal = &rOpt.bIsSpellAuto; break; + case UPH_IS_SPELL_SPECIAL : pbVal = &rOpt.bIsSpellSpecial; break; + case UPH_IS_WRAP_REVERSE : pbVal = &rOpt.bIsSpellReverse; break; + case UPH_DEFAULT_LANGUAGE : pnVal = &rOpt.nDefaultLanguage; break; + case UPH_IS_SPELL_CAPITALIZATION : pbVal = &rOpt.bIsSpellCapitalization; break; + case UPH_IS_SPELL_WITH_DIGITS : pbVal = &rOpt.bIsSpellWithDigits; break; + case UPH_IS_SPELL_UPPER_CASE : pbVal = &rOpt.bIsSpellUpperCase; break; + case UPH_HYPH_MIN_LEADING : pnVal = &rOpt.nHyphMinLeading; break; + case UPH_HYPH_MIN_TRAILING : pnVal = &rOpt.nHyphMinTrailing; break; + case UPH_HYPH_MIN_WORD_LENGTH : pnVal = &rOpt.nHyphMinWordLength; break; + case UPH_ACTIVE_DICTIONARIES : + { + rValue >>= rOpt.aActiveDics; + bMod = TRUE; + break; + } + case UPH_ACTIVE_CONVERSION_DICTIONARIES : + { + rValue >>= rOpt.aActiveConvDics; + bMod = TRUE; + break; + } + case UPH_DEFAULT_LOCALE : + { + bSucc = lcl_SetLocale( rOpt.nDefaultLanguage, rValue ); + bMod = bSucc; + break; + } + case UPH_DEFAULT_LOCALE_CJK : + { + bSucc = lcl_SetLocale( rOpt.nDefaultLanguage_CJK, rValue ); + bMod = bSucc; + break; + } + case UPH_DEFAULT_LOCALE_CTL : + { + bSucc = lcl_SetLocale( rOpt.nDefaultLanguage_CTL, rValue ); + bMod = bSucc; + break; + } + case UPH_IS_IGNORE_POST_POSITIONAL_WORD : pbVal = &rOpt.bIsIgnorePostPositionalWord; break; + case UPH_IS_AUTO_CLOSE_DIALOG : pbVal = &rOpt.bIsAutoCloseDialog; break; + case UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST : pbVal = &rOpt.bIsShowEntriesRecentlyUsedFirst; break; + case UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES : pbVal = &rOpt.bIsAutoReplaceUniqueEntries; break; + + case UPH_IS_DIRECTION_TO_SIMPLIFIED : pbVal = &rOpt.bIsDirectionToSimplified; break; + case UPH_IS_USE_CHARACTER_VARIANTS : pbVal = &rOpt.bIsUseCharacterVariants; break; + case UPH_IS_TRANSLATE_COMMON_TERMS : pbVal = &rOpt.bIsTranslateCommonTerms; break; + case UPH_IS_REVERSE_MAPPING : pbVal = &rOpt.bIsReverseMapping; break; + + case UPH_DATA_FILES_CHANGED_CHECK_VALUE : pnInt32Val = &rOpt.nDataFilesChangedCheckValue; break; + case UPH_IS_GRAMMAR_AUTO: pbVal = &rOpt.bIsGrammarAuto; break; + case UPH_IS_GRAMMAR_INTERACTIVE: pbVal = &rOpt.bIsGrammarInteractive; break; + default : + DBG_ASSERT( 0, "unexpected property handle" ); + } + + if (pbVal) + { + BOOL bNew = BOOL(); + if (rValue >>= bNew) + { + if (bNew != *pbVal) + { + *pbVal = bNew; + bMod = TRUE; + } + bSucc = TRUE; + } + } + else if (pnVal) + { + INT16 nNew = INT16(); + if (rValue >>= nNew) + { + if (nNew != *pnVal) + { + *pnVal = nNew; + bMod = TRUE; + } + bSucc = TRUE; + } + } + else if (pnInt32Val) + { + INT32 nNew = INT32(); + if (rValue >>= nNew) + { + if (nNew != *pnInt32Val) + { + *pnInt32Val = nNew; + bMod = TRUE; + } + bSucc = TRUE; + } + } + + if (bMod) + SetModified(); + + return bSucc; +} + + +BOOL SvtLinguConfigItem::GetOptions( SvtLinguOptions &rOptions ) const +{ + osl::MutexGuard aGuard( GetOwnMutex() ); + + rOptions = aOpt; + return TRUE; +} + + +BOOL SvtLinguConfigItem::SetOptions( const SvtLinguOptions &rOptions ) +{ + osl::MutexGuard aGuard( GetOwnMutex() ); + + aOpt = rOptions; + SetModified(); + return TRUE; +} + + +BOOL SvtLinguConfigItem::LoadOptions( const uno::Sequence< OUString > &rProperyNames ) +{ + osl::MutexGuard aGuard( GetOwnMutex() ); + + BOOL bRes = FALSE; + + const OUString *pProperyNames = rProperyNames.getConstArray(); + INT32 nProps = rProperyNames.getLength(); + + const uno::Sequence< uno::Any > aValues = GetProperties( rProperyNames ); + const uno::Sequence< sal_Bool > aROStates = GetReadOnlyStates( rProperyNames ); + + if (nProps && aValues.getLength() == nProps && aROStates.getLength() == nProps) + { + SvtLinguOptions &rOpt = aOpt; + + const uno::Any *pValue = aValues.getConstArray(); + const sal_Bool *pROStates = aROStates.getConstArray(); + for (INT32 i = 0; i < nProps; ++i) + { + const uno::Any &rVal = pValue[i]; + INT32 nPropertyHandle; + GetHdlByName( nPropertyHandle, pProperyNames[i], sal_True ); + switch ( nPropertyHandle ) + { + case UPH_DEFAULT_LOCALE : + { rOpt.bRODefaultLanguage = pROStates[i]; rOpt.nDefaultLanguage = lcl_CfgAnyToLanguage( rVal ); } break; + case UPH_ACTIVE_DICTIONARIES : + { rOpt.bROActiveDics = pROStates[i]; rVal >>= rOpt.aActiveDics; } break; + case UPH_IS_USE_DICTIONARY_LIST : + { rOpt.bROIsUseDictionaryList = pROStates[i]; rVal >>= rOpt.bIsUseDictionaryList; } break; + case UPH_IS_IGNORE_CONTROL_CHARACTERS : + { rOpt.bROIsIgnoreControlCharacters = pROStates[i]; rVal >>= rOpt.bIsIgnoreControlCharacters; } break; + case UPH_DEFAULT_LOCALE_CJK : + { rOpt.bRODefaultLanguage_CJK = pROStates[i]; rOpt.nDefaultLanguage_CJK = lcl_CfgAnyToLanguage( rVal ); } break; + case UPH_DEFAULT_LOCALE_CTL : + { rOpt.bRODefaultLanguage_CTL = pROStates[i]; rOpt.nDefaultLanguage_CTL = lcl_CfgAnyToLanguage( rVal ); } break; + + case UPH_IS_SPELL_UPPER_CASE : + { rOpt.bROIsSpellUpperCase = pROStates[i]; rVal >>= rOpt.bIsSpellUpperCase; } break; + case UPH_IS_SPELL_WITH_DIGITS : + { rOpt.bROIsSpellWithDigits = pROStates[i]; rVal >>= rOpt.bIsSpellWithDigits; } break; + case UPH_IS_SPELL_CAPITALIZATION : + { rOpt.bROIsSpellCapitalization = pROStates[i]; rVal >>= rOpt.bIsSpellCapitalization; } break; + case UPH_IS_SPELL_AUTO : + { rOpt.bROIsSpellAuto = pROStates[i]; rVal >>= rOpt.bIsSpellAuto; } break; + case UPH_IS_SPELL_SPECIAL : + { rOpt.bROIsSpellSpecial = pROStates[i]; rVal >>= rOpt.bIsSpellSpecial; } break; + case UPH_IS_WRAP_REVERSE : + { rOpt.bROIsSpellReverse = pROStates[i]; rVal >>= rOpt.bIsSpellReverse; } break; + + case UPH_HYPH_MIN_LEADING : + { rOpt.bROHyphMinLeading = pROStates[i]; rVal >>= rOpt.nHyphMinLeading; } break; + case UPH_HYPH_MIN_TRAILING : + { rOpt.bROHyphMinTrailing = pROStates[i]; rVal >>= rOpt.nHyphMinTrailing; } break; + case UPH_HYPH_MIN_WORD_LENGTH : + { rOpt.bROHyphMinWordLength = pROStates[i]; rVal >>= rOpt.nHyphMinWordLength; } break; + case UPH_IS_HYPH_SPECIAL : + { rOpt.bROIsHyphSpecial = pROStates[i]; rVal >>= rOpt.bIsHyphSpecial; } break; + case UPH_IS_HYPH_AUTO : + { rOpt.bROIsHyphAuto = pROStates[i]; rVal >>= rOpt.bIsHyphAuto; } break; + + case UPH_ACTIVE_CONVERSION_DICTIONARIES : { rOpt.bROActiveConvDics = pROStates[i]; rVal >>= rOpt.aActiveConvDics; } break; + + case UPH_IS_IGNORE_POST_POSITIONAL_WORD : + { rOpt.bROIsIgnorePostPositionalWord = pROStates[i]; rVal >>= rOpt.bIsIgnorePostPositionalWord; } break; + case UPH_IS_AUTO_CLOSE_DIALOG : + { rOpt.bROIsAutoCloseDialog = pROStates[i]; rVal >>= rOpt.bIsAutoCloseDialog; } break; + case UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST : + { rOpt.bROIsShowEntriesRecentlyUsedFirst = pROStates[i]; rVal >>= rOpt.bIsShowEntriesRecentlyUsedFirst; } break; + case UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES : + { rOpt.bROIsAutoReplaceUniqueEntries = pROStates[i]; rVal >>= rOpt.bIsAutoReplaceUniqueEntries; } break; + + case UPH_IS_DIRECTION_TO_SIMPLIFIED : + { rOpt.bROIsDirectionToSimplified = pROStates[i]; + if( ! (rVal >>= rOpt.bIsDirectionToSimplified) ) + { + //default is locale dependent: + if( rOpt.nDefaultLanguage_CJK == LANGUAGE_CHINESE_HONGKONG + || rOpt.nDefaultLanguage_CJK == LANGUAGE_CHINESE_MACAU + || rOpt.nDefaultLanguage_CJK == LANGUAGE_CHINESE_TRADITIONAL ) + { + rOpt.bIsDirectionToSimplified = FALSE; + } + else + { + rOpt.bIsDirectionToSimplified = TRUE; + } + } + } break; + case UPH_IS_USE_CHARACTER_VARIANTS : + { rOpt.bROIsUseCharacterVariants = pROStates[i]; rVal >>= rOpt.bIsUseCharacterVariants; } break; + case UPH_IS_TRANSLATE_COMMON_TERMS : + { rOpt.bROIsTranslateCommonTerms = pROStates[i]; rVal >>= rOpt.bIsTranslateCommonTerms; } break; + case UPH_IS_REVERSE_MAPPING : + { rOpt.bROIsReverseMapping = pROStates[i]; rVal >>= rOpt.bIsReverseMapping; } break; + + case UPH_DATA_FILES_CHANGED_CHECK_VALUE : + { rOpt.bRODataFilesChangedCheckValue = pROStates[i]; rVal >>= rOpt.nDataFilesChangedCheckValue; } break; + + case UPH_IS_GRAMMAR_AUTO: + { rOpt.bROIsGrammarAuto = pROStates[i]; rVal >>= rOpt.bIsGrammarAuto; } + break; + case UPH_IS_GRAMMAR_INTERACTIVE: + { rOpt.bROIsGrammarInteractive = pROStates[i]; rVal >>= rOpt.bIsGrammarInteractive; } + break; + + default: + DBG_ASSERT( 0, "unexpected case" ); + } + } + + bRes = TRUE; + } + DBG_ASSERT( bRes, "LoadOptions failed" ); + + return bRes; +} + + +BOOL SvtLinguConfigItem::SaveOptions( const uno::Sequence< OUString > &rProperyNames ) +{ + if (!IsModified()) + return TRUE; + + osl::MutexGuard aGuard( GetOwnMutex() ); + + BOOL bRet = FALSE; + const uno::Type &rBOOL = ::getBooleanCppuType(); + const uno::Type &rINT16 = ::getCppuType( (INT16 *) NULL ); + const uno::Type &rINT32 = ::getCppuType( (INT32 *) NULL ); + + INT32 nProps = rProperyNames.getLength(); + uno::Sequence< uno::Any > aValues( nProps ); + uno::Any *pValue = aValues.getArray(); + + if (nProps && aValues.getLength() == nProps) + { + const SvtLinguOptions &rOpt = aOpt; + + OUString aTmp( lcl_LanguageToCfgLocaleStr( rOpt.nDefaultLanguage ) ); + *pValue++ = uno::makeAny( aTmp ); // 0 + *pValue++ = uno::makeAny( rOpt.aActiveDics ); // 1 + pValue++->setValue( &rOpt.bIsUseDictionaryList, rBOOL ); // 2 + pValue++->setValue( &rOpt.bIsIgnoreControlCharacters, rBOOL ); // 3 + aTmp = lcl_LanguageToCfgLocaleStr( rOpt.nDefaultLanguage_CJK ); + *pValue++ = uno::makeAny( aTmp ); // 5 + aTmp = lcl_LanguageToCfgLocaleStr( rOpt.nDefaultLanguage_CTL ); + *pValue++ = uno::makeAny( aTmp ); // 6 + + pValue++->setValue( &rOpt.bIsSpellUpperCase, rBOOL ); // 7 + pValue++->setValue( &rOpt.bIsSpellWithDigits, rBOOL ); // 8 + pValue++->setValue( &rOpt.bIsSpellCapitalization, rBOOL ); // 9 + pValue++->setValue( &rOpt.bIsSpellAuto, rBOOL ); // 10 + pValue++->setValue( &rOpt.bIsSpellSpecial, rBOOL ); // 11 + pValue++->setValue( &rOpt.bIsSpellReverse, rBOOL ); // 14 + + pValue++->setValue( &rOpt.nHyphMinLeading, rINT16 ); // 15 + pValue++->setValue( &rOpt.nHyphMinTrailing, rINT16 ); // 16 + pValue++->setValue( &rOpt.nHyphMinWordLength, rINT16 ); // 17 + pValue++->setValue( &rOpt.bIsHyphSpecial, rBOOL ); // 18 + pValue++->setValue( &rOpt.bIsHyphAuto, rBOOL ); // 19 + + *pValue++ = uno::makeAny( rOpt.aActiveConvDics ); // 20 + + pValue++->setValue( &rOpt.bIsIgnorePostPositionalWord, rBOOL ); // 21 + pValue++->setValue( &rOpt.bIsAutoCloseDialog, rBOOL ); // 22 + pValue++->setValue( &rOpt.bIsShowEntriesRecentlyUsedFirst, rBOOL ); // 23 + pValue++->setValue( &rOpt.bIsAutoReplaceUniqueEntries, rBOOL ); // 24 + + pValue++->setValue( &rOpt.bIsDirectionToSimplified, rBOOL ); // 25 + pValue++->setValue( &rOpt.bIsUseCharacterVariants, rBOOL ); // 26 + pValue++->setValue( &rOpt.bIsTranslateCommonTerms, rBOOL ); // 27 + pValue++->setValue( &rOpt.bIsReverseMapping, rBOOL ); // 28 + + pValue++->setValue( &rOpt.nDataFilesChangedCheckValue, rINT32 ); // 29 + pValue++->setValue( &rOpt.bIsGrammarAuto, rBOOL ); // 30 + pValue++->setValue( &rOpt.bIsGrammarInteractive, rBOOL ); // 31 + + bRet |= PutProperties( rProperyNames, aValues ); + } + + if (bRet) + ClearModified(); + + return bRet; +} + +BOOL SvtLinguConfigItem::IsReadOnly( const rtl::OUString &rPropertyName ) const +{ + osl::MutexGuard aGuard( GetOwnMutex() ); + + BOOL bReadOnly = FALSE; + INT32 nHdl; + if (GetHdlByName( nHdl, rPropertyName )) + bReadOnly = IsReadOnly( nHdl ); + return bReadOnly; +} + +BOOL SvtLinguConfigItem::IsReadOnly( INT32 nPropertyHandle ) const +{ + osl::MutexGuard aGuard( GetOwnMutex() ); + + BOOL bReadOnly = FALSE; + + const SvtLinguOptions &rOpt = const_cast< SvtLinguConfigItem * >(this)->aOpt; + switch(nPropertyHandle) + { + case UPH_IS_USE_DICTIONARY_LIST : bReadOnly = rOpt.bROIsUseDictionaryList ; break; + case UPH_IS_IGNORE_CONTROL_CHARACTERS : bReadOnly = rOpt.bROIsIgnoreControlCharacters; break; + case UPH_IS_HYPH_AUTO : bReadOnly = rOpt.bROIsHyphAuto ; break; + case UPH_IS_HYPH_SPECIAL : bReadOnly = rOpt.bROIsHyphSpecial ; break; + case UPH_IS_SPELL_AUTO : bReadOnly = rOpt.bROIsSpellAuto ; break; + case UPH_IS_SPELL_SPECIAL : bReadOnly = rOpt.bROIsSpellSpecial ; break; + case UPH_IS_WRAP_REVERSE : bReadOnly = rOpt.bROIsSpellReverse ; break; + case UPH_DEFAULT_LANGUAGE : bReadOnly = rOpt.bRODefaultLanguage ; break; + case UPH_IS_SPELL_CAPITALIZATION : bReadOnly = rOpt.bROIsSpellCapitalization ; break; + case UPH_IS_SPELL_WITH_DIGITS : bReadOnly = rOpt.bROIsSpellWithDigits ; break; + case UPH_IS_SPELL_UPPER_CASE : bReadOnly = rOpt.bROIsSpellUpperCase ; break; + case UPH_HYPH_MIN_LEADING : bReadOnly = rOpt.bROHyphMinLeading ; break; + case UPH_HYPH_MIN_TRAILING : bReadOnly = rOpt.bROHyphMinTrailing ; break; + case UPH_HYPH_MIN_WORD_LENGTH : bReadOnly = rOpt.bROHyphMinWordLength ; break; + case UPH_ACTIVE_DICTIONARIES : bReadOnly = rOpt.bROActiveDics ; break; + case UPH_ACTIVE_CONVERSION_DICTIONARIES : bReadOnly = rOpt.bROActiveConvDics ; break; + case UPH_DEFAULT_LOCALE : bReadOnly = rOpt.bRODefaultLanguage ; break; + case UPH_DEFAULT_LOCALE_CJK : bReadOnly = rOpt.bRODefaultLanguage_CJK ; break; + case UPH_DEFAULT_LOCALE_CTL : bReadOnly = rOpt.bRODefaultLanguage_CTL ; break; + case UPH_IS_IGNORE_POST_POSITIONAL_WORD : bReadOnly = rOpt.bROIsIgnorePostPositionalWord; break; + case UPH_IS_AUTO_CLOSE_DIALOG : bReadOnly = rOpt.bROIsAutoCloseDialog; break; + case UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST : bReadOnly = rOpt.bROIsShowEntriesRecentlyUsedFirst; break; + case UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES : bReadOnly = rOpt.bROIsAutoReplaceUniqueEntries; break; + case UPH_IS_DIRECTION_TO_SIMPLIFIED : bReadOnly = rOpt.bROIsDirectionToSimplified; break; + case UPH_IS_USE_CHARACTER_VARIANTS : bReadOnly = rOpt.bROIsUseCharacterVariants; break; + case UPH_IS_TRANSLATE_COMMON_TERMS : bReadOnly = rOpt.bROIsTranslateCommonTerms; break; + case UPH_IS_REVERSE_MAPPING : bReadOnly = rOpt.bROIsReverseMapping; break; + case UPH_DATA_FILES_CHANGED_CHECK_VALUE : bReadOnly = rOpt.bRODataFilesChangedCheckValue; break; + case UPH_IS_GRAMMAR_AUTO: bReadOnly = rOpt.bROIsGrammarAuto; break; + case UPH_IS_GRAMMAR_INTERACTIVE: bReadOnly = rOpt.bROIsGrammarInteractive; break; + default : + DBG_ASSERT( 0, "unexpected property handle" ); + } + return bReadOnly; +} + +////////////////////////////////////////////////////////////////////// + +static SvtLinguConfigItem *pCfgItem = 0; +static sal_Int32 nCfgItemRefCount = 0; + +static const rtl::OUString aG_SupportedDictionaryFormats( A2OU("SupportedDictionaryFormats") ); +static const rtl::OUString aG_Dictionaries( A2OU("Dictionaries") ); +static const rtl::OUString aG_Locations( A2OU("Locations") ); +static const rtl::OUString aG_Format( A2OU("Format") ); +static const rtl::OUString aG_Locales( A2OU("Locales") ); +static const rtl::OUString aG_DisabledDictionaries( A2OU("DisabledDictionaries") ); +static const rtl::OUString aG_LastActiveDictionaries( A2OU("LastActiveDictionaries") ); + +SvtLinguConfig::SvtLinguConfig() +{ + // Global access, must be guarded (multithreading) + osl::MutexGuard aGuard( GetOwnMutex() ); + ++nCfgItemRefCount; +} + + +SvtLinguConfig::~SvtLinguConfig() +{ + osl::MutexGuard aGuard( GetOwnMutex() ); + + if (pCfgItem && pCfgItem->IsModified()) + pCfgItem->Commit(); + + if (--nCfgItemRefCount <= 0) + { + if (pCfgItem) + delete pCfgItem; + pCfgItem = 0; + } +} + + +SvtLinguConfigItem & SvtLinguConfig::GetConfigItem() +{ + // Global access, must be guarded (multithreading) + osl::MutexGuard aGuard( GetOwnMutex() ); + if (!pCfgItem) + { + pCfgItem = new SvtLinguConfigItem; + ItemHolder1::holdConfigItem(E_LINGUCFG); + } + return *pCfgItem; +} + + +uno::Sequence< OUString > SvtLinguConfig::GetNodeNames( const OUString &rNode ) +{ + return GetConfigItem().GetNodeNames( rNode ); +} + + +uno::Sequence< uno::Any > SvtLinguConfig::GetProperties( const uno::Sequence< OUString > &rNames ) +{ + return GetConfigItem().GetProperties(rNames); +} + + +sal_Bool SvtLinguConfig::ReplaceSetProperties( + const OUString &rNode, uno::Sequence< beans::PropertyValue > rValues ) +{ + return GetConfigItem().ReplaceSetProperties( rNode, rValues ); +} + + +uno::Any SvtLinguConfig::GetProperty( const OUString &rPropertyName ) const +{ + return GetConfigItem().GetProperty( rPropertyName ); +} + + +uno::Any SvtLinguConfig::GetProperty( INT32 nPropertyHandle ) const +{ + return GetConfigItem().GetProperty( nPropertyHandle ); +} + + +BOOL SvtLinguConfig::SetProperty( const OUString &rPropertyName, const uno::Any &rValue ) +{ + return GetConfigItem().SetProperty( rPropertyName, rValue ); +} + + +BOOL SvtLinguConfig::SetProperty( INT32 nPropertyHandle, const uno::Any &rValue ) +{ + return GetConfigItem().SetProperty( nPropertyHandle, rValue ); +} + + +BOOL SvtLinguConfig::GetOptions( SvtLinguOptions &rOptions ) const +{ + return GetConfigItem().GetOptions( rOptions ); +} + + +BOOL SvtLinguConfig::SetOptions( const SvtLinguOptions &rOptions ) +{ + return GetConfigItem().SetOptions( rOptions ); +} + + +BOOL SvtLinguConfig::IsReadOnly( const rtl::OUString &rPropertyName ) const +{ + return GetConfigItem().IsReadOnly( rPropertyName ); +} + +BOOL SvtLinguConfig::IsReadOnly( INT32 nPropertyHandle ) const +{ + return GetConfigItem().IsReadOnly( nPropertyHandle ); +} + +BOOL SvtLinguConfig::GetElementNamesFor( + const rtl::OUString &rNodeName, + uno::Sequence< rtl::OUString > &rElementNames ) const +{ + bool bSuccess = false; + try + { + uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( rNodeName ), uno::UNO_QUERY_THROW ); + rElementNames = xNA->getElementNames(); + bSuccess = true; + } + catch (uno::Exception &) + { + } + return bSuccess; +} + +static uno::Reference< container::XNameAccess > GetOrCreateSetEntry_Impl( + const uno::Reference< container::XNameAccess > &rxSetNameAccess, + const rtl::OUString &rEntryName ) +{ + uno::Reference< container::XNameAccess > xResult; + try + { + if (!rxSetNameAccess->hasByName( rEntryName )) + { + uno::Reference< lang::XSingleServiceFactory > xFactory( rxSetNameAccess, uno::UNO_QUERY_THROW); + uno::Reference< uno::XInterface > xNewEntry( xFactory->createInstance() ); + uno::Reference< container::XNameContainer > xNC( rxSetNameAccess, uno::UNO_QUERY_THROW ); + xNC->insertByName( rEntryName, makeAny( xNewEntry ) ); + } + xResult.set( rxSetNameAccess->getByName( rEntryName ), uno::UNO_QUERY_THROW ); + } + catch (uno::Exception &) + { + } + return xResult; +} + +BOOL SvtLinguConfig::GetSupportedDictionaryFormatsFor( + const rtl::OUString &rSetName, + const rtl::OUString &rSetEntry, + uno::Sequence< rtl::OUString > &rFormatList ) const +{ + if (rSetName.getLength() == 0 || rSetEntry.getLength() == 0) + return sal_False; + bool bSuccess = false; + try + { + uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( rSetName ), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( rSetEntry ), uno::UNO_QUERY_THROW ); + if (xNA->getByName( aG_SupportedDictionaryFormats ) >>= rFormatList) + bSuccess = true; + DBG_ASSERT( rFormatList.getLength(), "supported dictionary format list is empty" ); + } + catch (uno::Exception &) + { + } + return bSuccess; +} + +void SvtLinguConfig::SetOrCreateSupportedDictionaryFormatsFor( + const rtl::OUString &rSetName, + const rtl::OUString &rSetEntry, + const uno::Sequence< rtl::OUString > &rFormatList ) const +{ + if (rSetName.getLength() == 0 || rSetEntry.getLength() == 0) + return; + try + { + DBG_ASSERT( rFormatList.getLength(), "applying empty format list. Really??" ); + + uno::Reference< util::XChangesBatch > xUpdateAccess( GetMainUpdateAccess() ); + uno::Reference< container::XNameAccess > xNA( xUpdateAccess, uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( rSetName ), uno::UNO_QUERY_THROW ); + xNA = GetOrCreateSetEntry_Impl( xNA, rSetEntry ); + + uno::Reference< container::XNameReplace > xNR( xNA, uno::UNO_QUERY_THROW ); + xNR->replaceByName( aG_SupportedDictionaryFormats, uno::makeAny( rFormatList ) ); + + xUpdateAccess->commitChanges(); + } + catch (uno::Exception &) + { + } +} + + +static uno::WeakReference< util::XMacroExpander > aG_xMacroExpander; + +static uno::Reference< util::XMacroExpander > lcl_GetMacroExpander() +{ + uno::Reference< util::XMacroExpander > xMacroExpander( aG_xMacroExpander ); + if ( !xMacroExpander.is() ) + { + if ( !xMacroExpander.is() ) + { + uno::Reference< uno::XComponentContext > xContext; + uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY ); + xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext; + if ( xContext.is() ) + { + aG_xMacroExpander = uno::Reference< com::sun::star::util::XMacroExpander >( xContext->getValueByName( + OUString( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander"))), + uno::UNO_QUERY ); + xMacroExpander = aG_xMacroExpander; + } + } + } + + return xMacroExpander; +} + + +static bool lcl_GetFileUrlFromOrigin( + OUString /*out*/ &rFileUrl, + const OUString &rOrigin, + uno::Reference< util::XMacroExpander > &rxMacroExpander ) +{ + bool bSuccess = false; + if (rOrigin.getLength() > 0 && rxMacroExpander.is()) + { + rtl::OUString aURL( rOrigin ); + if (( aURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( EXPAND_PROTOCOL )) == 0 ) && + rxMacroExpander.is() ) + { + // cut protocol + OUString aMacro( aURL.copy( sizeof ( EXPAND_PROTOCOL ) -1 ) ); + // decode uric class chars + aMacro = Uri::decode( aMacro, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); + // expand macro string + aURL = rxMacroExpander->expandMacros( aMacro ); + + bool bIsFileUrl = aURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( FILE_PROTOCOL )) == 0; + if (bIsFileUrl) + { + rFileUrl = aURL; + bSuccess = true; + } + else + { + DBG_ASSERT( bIsFileUrl, "not a file URL"); + } + } + else + { + DBG_ASSERT( 0, "failed to get file URL" ); + } + } + return bSuccess; +} + + +BOOL SvtLinguConfig::GetDictionaryEntry( + const rtl::OUString &rNodeName, + SvtLinguConfigDictionaryEntry &rDicEntry ) const +{ + if (rNodeName.getLength() == 0) + return sal_False; + bool bSuccess = false; + try + { + uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( aG_Dictionaries ), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( rNodeName ), uno::UNO_QUERY_THROW ); + + // read group data... + uno::Sequence< rtl::OUString > aLocations; + rtl::OUString aFormatName; + uno::Sequence< rtl::OUString > aLocaleNames; + bSuccess = (xNA->getByName( aG_Locations ) >>= aLocations) && + (xNA->getByName( aG_Format ) >>= aFormatName) && + (xNA->getByName( aG_Locales ) >>= aLocaleNames); + DBG_ASSERT( aLocations.getLength(), "Dictionary locations not set" ); + DBG_ASSERT( aFormatName.getLength(), "Dictionary format name not set" ); + DBG_ASSERT( aLocaleNames.getLength(), "No locales set for the dictionary" ); + + // if sucessful continue + if (bSuccess) + { + // get file URL's for the locations + uno::Reference< util::XMacroExpander > xMacroExpander( lcl_GetMacroExpander() ); + for (sal_Int32 i = 0; i < aLocations.getLength(); ++i) + { + rtl::OUString &rLocation = aLocations[i]; + if (!lcl_GetFileUrlFromOrigin( rLocation, rLocation, xMacroExpander )) + bSuccess = false; + } + + // if everything was fine return the result + if (bSuccess) + { + rDicEntry.aLocations = aLocations; + rDicEntry.aFormatName = aFormatName; + rDicEntry.aLocaleNames = aLocaleNames; + } + } + } + catch (uno::Exception &) + { + } + return bSuccess; +} + +void SvtLinguConfig::SetOrCreateDictionaryEntry( + const rtl::OUString &rNodeName, + const SvtLinguConfigDictionaryEntry &rDicEntry ) const +{ + if (rNodeName.getLength() == 0) + return; + try + { + uno::Reference< util::XChangesBatch > xUpdateAccess( GetMainUpdateAccess() ); + uno::Reference< container::XNameAccess > xNA( xUpdateAccess, uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( aG_Dictionaries ), uno::UNO_QUERY_THROW ); + xNA = GetOrCreateSetEntry_Impl( xNA, rNodeName ); + + DBG_ASSERT( rDicEntry.aLocations.getLength(), "Applying empty dictionary locations. Really correct??" ); + DBG_ASSERT( rDicEntry.aFormatName.getLength(), "Applying empty dictionary format name. Really correct??" ); + DBG_ASSERT( rDicEntry.aLocaleNames.getLength(), "Applying empty list of locales for the dictionary. Really correct??" ); + + uno::Reference< container::XNameReplace > xNR( xNA, uno::UNO_QUERY_THROW ); + xNR->replaceByName( aG_Locations, uno::makeAny( rDicEntry.aLocations ) ); + xNR->replaceByName( aG_Format, uno::makeAny( rDicEntry.aFormatName ) ); + xNR->replaceByName( aG_Locales, uno::makeAny( rDicEntry.aLocaleNames ) ); + + xUpdateAccess->commitChanges(); + } + catch (uno::Exception &) + { + } +} + +uno::Sequence< rtl::OUString > SvtLinguConfig::GetDisabledDictionaries() const +{ + uno::Sequence< rtl::OUString > aResult; + try + { + uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW ); + xNA->getByName( aG_DisabledDictionaries ) >>= aResult; + } + catch (uno::Exception &) + { + } + return aResult; +} + +void SvtLinguConfig::SetDisabledDictionaries( + const uno::Sequence< rtl::OUString > &rDictionaries ) const +{ + try + { + uno::Reference< util::XChangesBatch > xUpdateAccess( GetMainUpdateAccess() ); + uno::Reference< container::XNameAccess > xNA( xUpdateAccess, uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW ); + if (xNA->hasByName( aG_DisabledDictionaries )) + { + uno::Reference< container::XNameReplace > xNR( xNA, uno::UNO_QUERY_THROW ); + xNR->replaceByName( aG_DisabledDictionaries, makeAny( rDictionaries ) ); + } + else + { + uno::Reference< container::XNameContainer > xNC( xNA, uno::UNO_QUERY_THROW ); + xNC->insertByName( aG_DisabledDictionaries, makeAny( rDictionaries ) ); + } + + xUpdateAccess->commitChanges(); + } + catch (uno::Exception &) + { + } +} + +std::vector< SvtLinguConfigDictionaryEntry > SvtLinguConfig::GetActiveDictionariesByFormat( + const rtl::OUString &rFormatName ) +{ + std::vector< SvtLinguConfigDictionaryEntry > aRes; + if (rFormatName.getLength() == 0) + return aRes; + + try + { + uno::Sequence< rtl::OUString > aElementNames; + GetElementNamesFor( aG_Dictionaries, aElementNames ); + sal_Int32 nLen = aElementNames.getLength(); + const rtl::OUString *pElementNames = aElementNames.getConstArray(); + + SvtLinguConfigDictionaryEntry aDicEntry; + for (sal_Int32 i = 0; i < nLen; ++i) + { + // does dictionary match the format we are looking for? + if (GetDictionaryEntry( pElementNames[i], aDicEntry ) && + aDicEntry.aFormatName == rFormatName) + { + // check if it is active or not + bool bDicIsActive = true; + const uno::Sequence< rtl::OUString > aDisabledDics( GetDisabledDictionaries() ); + for (sal_Int32 k = 0; bDicIsActive && k < aDisabledDics.getLength(); ++k) + { + if (aDisabledDics[k] == pElementNames[i]) + bDicIsActive = false; + } + + if (bDicIsActive) + { + DBG_ASSERT( aDicEntry.aFormatName.getLength(), + "FormatName not set" ); + DBG_ASSERT( aDicEntry.aLocations.getLength(), + "Locations not set" ); + DBG_ASSERT( aDicEntry.aLocaleNames.getLength(), + "Locales not set" ); + aRes.push_back( aDicEntry ); + } + } + } + } + catch (uno::Exception &) + { + } + + return aRes; +} + + +uno::Reference< util::XChangesBatch > SvtLinguConfig::GetMainUpdateAccess() const +{ + if (!m_xMainUpdateAccess.is()) + { + try + { + // get configuration provider + uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider; + uno::Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); + if (xMgr.is()) + { + xConfigurationProvider = uno::Reference< lang::XMultiServiceFactory > ( + xMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.ConfigurationProvider" ) ) ), + uno::UNO_QUERY_THROW ) ; + } + + // get configuration update access + beans::PropertyValue aValue; + aValue.Name = A2OU( "nodepath" ); + aValue.Value = uno::makeAny( A2OU("org.openoffice.Office.Linguistic") ); + uno::Sequence< uno::Any > aProps(1); + aProps[0] <<= aValue; + m_xMainUpdateAccess = uno::Reference< util::XChangesBatch >( + xConfigurationProvider->createInstanceWithArguments( + A2OU( "com.sun.star.configuration.ConfigurationUpdateAccess" ), aProps ), + uno::UNO_QUERY_THROW ); + } + catch (uno::Exception &) + { + } + } + + return m_xMainUpdateAccess; +} + + +rtl::OUString SvtLinguConfig::GetVendorImageUrl_Impl( + const rtl::OUString &rServiceImplName, + const rtl::OUString &rImageName ) const +{ + rtl::OUString aRes; + try + { + uno::Reference< container::XNameAccess > xImagesNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); + xImagesNA.set( xImagesNA->getByName( A2OU("Images") ), uno::UNO_QUERY_THROW ); + + uno::Reference< container::XNameAccess > xNA( xImagesNA->getByName( A2OU("ServiceNameEntries") ), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( rServiceImplName ), uno::UNO_QUERY_THROW ); + uno::Any aAny( xNA->getByName( A2OU("VendorImagesNode") ) ); + rtl::OUString aVendorImagesNode; + if (aAny >>= aVendorImagesNode) + { + xNA = xImagesNA; + xNA.set( xNA->getByName( A2OU("VendorImages") ), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( aVendorImagesNode ), uno::UNO_QUERY_THROW ); + aAny = xNA->getByName( rImageName ); + rtl::OUString aTmp; + if (aAny >>= aTmp) + { + uno::Reference< util::XMacroExpander > xMacroExpander( lcl_GetMacroExpander() ); + if (lcl_GetFileUrlFromOrigin( aTmp, aTmp, xMacroExpander )) + aRes = aTmp; + } + } + } + catch (uno::Exception &) + { + DBG_ASSERT( 0, "exception caught. GetVendorImageUrl_Impl failed" ); + } + return aRes; +} + + +rtl::OUString SvtLinguConfig::GetSpellAndGrammarDialogImage( + const rtl::OUString &rServiceImplName, + bool bHighContrast ) const +{ + rtl::OUString aRes; + if (rServiceImplName.getLength() > 0) + { + rtl::OUString aImageName( A2OU( bHighContrast ? "SpellAndGrammarDialogImage_HC" : "SpellAndGrammarDialogImage" )); + rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) ); + aRes = aPath; + } + return aRes; +} + + +rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextSuggestionImage( + const rtl::OUString &rServiceImplName, + bool bHighContrast ) const +{ + rtl::OUString aRes; + if (rServiceImplName.getLength() > 0) + { + rtl::OUString aImageName( A2OU( bHighContrast ? "SpellAndGrammarContextMenuSuggestionImage_HC" : "SpellAndGrammarContextMenuSuggestionImage" )); + rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) ); + aRes = aPath; + } + return aRes; +} + + +rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextDictionaryImage( + const rtl::OUString &rServiceImplName, + bool bHighContrast ) const +{ + rtl::OUString aRes; + if (rServiceImplName.getLength() > 0) + { + rtl::OUString aImageName( A2OU( bHighContrast ? "SpellAndGrammarContextMenuDictionaryImage_HC" : "SpellAndGrammarContextMenuDictionaryImage" )); + rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) ); + aRes = aPath; + } + return aRes; +} + + +bool SvtLinguConfig::HasAnyVendorImages() const +{ + bool bRes = false; + try + { + uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( A2OU("Images") ), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( A2OU("VendorImages") ), uno::UNO_QUERY_THROW ); + + uno::Sequence< rtl::OUString > aElementNames( xNA->getElementNames() ); + bRes = aElementNames.getLength() > 0; + } + catch (uno::Exception &) + { + DBG_ASSERT( 0, "exception caught. HasAnyVendorImages failed" ); + } + return bRes; +} + + +bool SvtLinguConfig::HasGrammarChecker() const +{ + bool bRes = false; + + try + { + uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( A2OU("GrammarCheckerList") ), uno::UNO_QUERY_THROW ); + + uno::Sequence< rtl::OUString > aElementNames( xNA->getElementNames() ); + bRes = aElementNames.getLength() > 0; + } + catch (uno::Exception &) + { + } + + return bRes; +} + +////////////////////////////////////////////////////////////////////// + diff --git a/unotools/source/config/localisationoptions.cxx b/unotools/source/config/localisationoptions.cxx new file mode 100644 index 000000000000..a341021ca926 --- /dev/null +++ b/unotools/source/config/localisationoptions.cxx @@ -0,0 +1,459 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: localisationoptions.cxx,v $ + * $Revision: 1.12 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +#ifndef GCC +#endif + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include +#include +#include +#include +#include +#include + +#include +#include "itemholder1.hxx" + +//_________________________________________________________________________________________________________________ +// namespaces +//_________________________________________________________________________________________________________________ + +using namespace ::utl ; +using namespace ::rtl ; +using namespace ::osl ; +using namespace ::com::sun::star::uno ; + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +#define ROOTNODE_LOCALISATION OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/View/Localisation")) +#define DEFAULT_AUTOMNEMONIC sal_False +#define DEFAULT_DIALOGSCALE 0 + +#define PROPERTYNAME_AUTOMNEMONIC OUString(RTL_CONSTASCII_USTRINGPARAM("AutoMnemonic" )) +#define PROPERTYNAME_DIALOGSCALE OUString(RTL_CONSTASCII_USTRINGPARAM("DialogScale" )) + +#define PROPERTYHANDLE_AUTOMNEMONIC 0 +#define PROPERTYHANDLE_DIALOGSCALE 1 + +#define PROPERTYCOUNT 2 + +//_________________________________________________________________________________________________________________ +// private declarations! +//_________________________________________________________________________________________________________________ + +class SvtLocalisationOptions_Impl : public ConfigItem +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + SvtLocalisationOptions_Impl(); + ~SvtLocalisationOptions_Impl(); + + //--------------------------------------------------------------------------------------------------------- + // overloaded methods of baseclass + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short called for notify of configmanager + @descr These method is called from the ConfigManager before application ends or from the + PropertyChangeListener if the sub tree broadcasts changes. You must update your + internal values. + + @seealso baseclass ConfigItem + + @param "seqPropertyNames" is the list of properties which should be updated. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void Notify( const Sequence< OUString >& seqPropertyNames ); + + /*-****************************************************************************************************//** + @short write changes to configuration + @descr These method writes the changed values into the sub tree + and should always called in our destructor to guarantee consistency of config data. + + @seealso baseclass ConfigItem + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void Commit(); + + //--------------------------------------------------------------------------------------------------------- + // public interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short access method to get internal values + @descr These method give us a chance to regulate acces to ouer internal values. + It's not used in the moment - but it's possible for the feature! + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + sal_Bool IsAutoMnemonic ( ) const ; + void SetAutoMnemonic ( sal_Bool bState ) ; + sal_Int32 GetDialogScale ( ) const ; + void SetDialogScale ( sal_Int32 nScale ) ; + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return list of key names of ouer configuration management which represent oue module tree + @descr These methods return a static const list of key names. We need it to get needed values from our + configuration management. + + @seealso - + + @param - + @return A list of needed configuration keys is returned. + + @onerror - + *//*-*****************************************************************************************************/ + + static Sequence< OUString > GetPropertyNames(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + sal_Bool m_bAutoMnemonic ; + sal_Int32 m_nDialogScale ; +}; + +//_________________________________________________________________________________________________________________ +// definitions +//_________________________________________________________________________________________________________________ + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtLocalisationOptions_Impl::SvtLocalisationOptions_Impl() + // Init baseclasses first + : ConfigItem ( ROOTNODE_LOCALISATION ) + // Init member then. + , m_bAutoMnemonic ( DEFAULT_AUTOMNEMONIC ) + , m_nDialogScale ( DEFAULT_DIALOGSCALE ) +{ + // Use our static list of configuration keys to get his values. + Sequence< OUString > seqNames = GetPropertyNames ( ); + Sequence< Any > seqValues = GetProperties ( seqNames ); + + // Safe impossible cases. + // We need values from ALL configuration keys. + // Follow assignment use order of values in relation to our list of key names! + DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtLocalisationOptions_Impl::SvtLocalisationOptions_Impl()\nI miss some values of configuration keys!\n" ); + + // Copy values from list in right order to ouer internal member. + sal_Int32 nPropertyCount = seqValues.getLength(); + for( sal_Int32 nProperty=0; nProperty>= m_bAutoMnemonic; + } + break; + + case PROPERTYHANDLE_DIALOGSCALE : { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtLocalisationOptions_Impl::SvtLocalisationOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Localisation\\DialogScale\"?" ); + seqValues[nProperty] >>= m_nDialogScale; + } + break; + } + } + + // Enable notification mechanism of ouer baseclass. + // We need it to get information about changes outside these class on ouer used configuration keys! + EnableNotification( seqNames ); +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtLocalisationOptions_Impl::~SvtLocalisationOptions_Impl() +{ + // We must save our current values .. if user forget it! + if( IsModified() == sal_True ) + { + Commit(); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtLocalisationOptions_Impl::Notify( const Sequence< OUString >& seqPropertyNames ) +{ + // Use given list of updated properties to get his values from configuration directly! + Sequence< Any > seqValues = GetProperties( seqPropertyNames ); + // Safe impossible cases. + // We need values from ALL notified configuration keys. + DBG_ASSERT( !(seqPropertyNames.getLength()!=seqValues.getLength()), "SvtLocalisationOptions_Impl::Notify()\nI miss some values of configuration keys!\n" ); + // Step over list of property names and get right value from coreesponding value list to set it on internal members! + sal_Int32 nCount = seqPropertyNames.getLength(); + for( sal_Int32 nProperty=0; nProperty>= m_bAutoMnemonic; + } + else + if( seqPropertyNames[nProperty] == PROPERTYNAME_DIALOGSCALE ) + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtLocalisationOptions_Impl::SvtLocalisationOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Localisation\\DialogScale\"?" ); + seqValues[nProperty] >>= m_nDialogScale; + } + #if OSL_DEBUG_LEVEL > 1 + else DBG_ASSERT( sal_False, "SvtLocalisationOptions_Impl::Notify()\nUnkown property detected ... I can't handle these!\n" ); + #endif + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtLocalisationOptions_Impl::Commit() +{ + // Get names of supported properties, create a list for values and copy current values to it. + Sequence< OUString > seqNames = GetPropertyNames (); + sal_Int32 nCount = seqNames.getLength(); + Sequence< Any > seqValues ( nCount ); + for( sal_Int32 nProperty=0; nProperty SvtLocalisationOptions_Impl::GetPropertyNames() +{ + // Build static list of configuration key names. + static const OUString pProperties[] = + { + PROPERTYNAME_AUTOMNEMONIC , + PROPERTYNAME_DIALOGSCALE , + }; + // Initialize return sequence with these list ... + static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + // ... and return it. + return seqPropertyNames; +} + +//***************************************************************************************************************** +// initialize static member +// DON'T DO IT IN YOUR HEADER! +// see definition for further informations +//***************************************************************************************************************** +SvtLocalisationOptions_Impl* SvtLocalisationOptions::m_pDataContainer = NULL ; +sal_Int32 SvtLocalisationOptions::m_nRefCount = 0 ; + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtLocalisationOptions::SvtLocalisationOptions() +{ + // Global access, must be guarded (multithreading!). + MutexGuard aGuard( GetOwnStaticMutex() ); + // Increase ouer refcount ... + ++m_nRefCount; + // ... and initialize ouer data container only if it not already exist! + if( m_pDataContainer == NULL ) + { + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtLocalisationOptions_Impl::ctor()"); + m_pDataContainer = new SvtLocalisationOptions_Impl; + + ItemHolder1::holdConfigItem(E_LOCALISATIONOPTIONS); + } +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtLocalisationOptions::~SvtLocalisationOptions() +{ + // Global access, must be guarded (multithreading!) + MutexGuard aGuard( GetOwnStaticMutex() ); + // Decrease ouer refcount. + --m_nRefCount; + // If last instance was deleted ... + // we must destroy ouer static data container! + if( m_nRefCount <= 0 ) + { + delete m_pDataContainer; + m_pDataContainer = NULL; + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtLocalisationOptions::IsAutoMnemonic() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsAutoMnemonic(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtLocalisationOptions::SetAutoMnemonic( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetAutoMnemonic( bState ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Int32 SvtLocalisationOptions::GetDialogScale() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetDialogScale(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtLocalisationOptions::SetDialogScale( sal_Int32 nScale ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetDialogScale( nScale ); +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Mutex& SvtLocalisationOptions::GetOwnStaticMutex() +{ + // Initialize static mutex only for one time! + static Mutex* pMutex = NULL; + // If these method first called (Mutex not already exist!) ... + if( pMutex == NULL ) + { + // ... we must create a new one. Protect follow code with the global mutex - + // It must be - we create a static variable! + MutexGuard aGuard( Mutex::getGlobalMutex() ); + // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! + if( pMutex == NULL ) + { + // Create the new mutex and set it for return on static variable. + static Mutex aMutex; + pMutex = &aMutex; + } + } + // Return new created or already existing mutex object. + return *pMutex; +} diff --git a/unotools/source/config/makefile.mk b/unotools/source/config/makefile.mk index bd5a1b16512f..edc0c9f2ad4f 100644 --- a/unotools/source/config/makefile.mk +++ b/unotools/source/config/makefile.mk @@ -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 @@ -51,7 +51,40 @@ SLOFILES=\ $(SLO)$/configmgr.obj \ $(SLO)$/configpathes.obj \ $(SLO)$/docinfohelper.obj \ - $(SLO)$/bootstrap.obj + $(SLO)$/bootstrap.obj \ + $(SLO)$/accelcfg.obj \ + $(SLO)$/cacheoptions.obj \ + $(SLO)$/cmdoptions.obj \ + $(SLO)$/compatibility.obj \ + $(SLO)$/defaultoptions.obj \ + $(SLO)$/dynamicmenuoptions.obj \ + $(SLO)$/eventcfg.obj \ + $(SLO)$/extendedsecurityoptions.obj \ + $(SLO)$/fltrcfg.obj \ + $(SLO)$/fontoptions.obj \ + $(SLO)$/historyoptions.obj \ + $(SLO)$/inetoptions.obj \ + $(SLO)$/internaloptions.obj \ + $(SLO)$/itemholder1.obj \ + $(SLO)$/javaoptions.obj \ + $(SLO)$/lingucfg.obj \ + $(SLO)$/localisationoptions.obj \ + $(SLO)$/moduleoptions.obj \ + $(SLO)$/options.obj \ + $(SLO)$/optionsdlg.obj \ + $(SLO)$/pathoptions.obj \ + $(SLO)$/printwarningoptions.obj \ + $(SLO)$/regoptions.obj \ + $(SLO)$/saveopt.obj \ + $(SLO)$/searchopt.obj \ + $(SLO)$/securityoptions.obj \ + $(SLO)$/sourceviewconfig.obj \ + $(SLO)$/startoptions.obj \ + $(SLO)$/undoopt.obj \ + $(SLO)$/useroptions.obj \ + $(SLO)$/viewoptions.obj \ + $(SLO)$/workingsetoptions.obj \ + $(SLO)$/xmlaccelcfg.obj # --- Targets ---------------------------------- diff --git a/unotools/source/config/menuoptions.cxx b/unotools/source/config/menuoptions.cxx new file mode 100644 index 000000000000..c885d5a1e81c --- /dev/null +++ b/unotools/source/config/menuoptions.cxx @@ -0,0 +1,564 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: menuoptions.cxx,v $ + * $Revision: 1.14 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +#ifndef GCC +#endif + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include "itemholder1.hxx" + +//_________________________________________________________________________________________________________________ +// namespaces +//_________________________________________________________________________________________________________________ + +using namespace ::utl ; +using namespace ::rtl ; +using namespace ::osl ; +using namespace ::com::sun::star::uno ; + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +#define ROOTNODE_MENU OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/View/Menu" )) +#define DEFAULT_DONTHIDEDISABLEDENTRIES sal_False +#define DEFAULT_FOLLOWMOUSE sal_True +#define DEFAULT_MENUICONS 2 + +#define PROPERTYNAME_DONTHIDEDISABLEDENTRIES OUString(RTL_CONSTASCII_USTRINGPARAM("DontHideDisabledEntry" )) +#define PROPERTYNAME_FOLLOWMOUSE OUString(RTL_CONSTASCII_USTRINGPARAM("FollowMouse" )) +#define PROPERTYNAME_SHOWICONSINMENUES OUString(RTL_CONSTASCII_USTRINGPARAM("ShowIconsInMenues" )) +#define PROPERTYNAME_SYSTEMICONSINMENUES OUString(RTL_CONSTASCII_USTRINGPARAM("IsSystemIconsInMenus" )) + +#define PROPERTYHANDLE_DONTHIDEDISABLEDENTRIES 0 +#define PROPERTYHANDLE_FOLLOWMOUSE 1 +#define PROPERTYHANDLE_SHOWICONSINMENUES 2 +#define PROPERTYHANDLE_SYSTEMICONSINMENUES 3 + +#define PROPERTYCOUNT 4 + +#include +#include +DECLARE_LIST( LinkList, Link * ) + +//_________________________________________________________________________________________________________________ +// private declarations! +//_________________________________________________________________________________________________________________ + +class SvtMenuOptions_Impl : public ConfigItem +{ + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + LinkList aList; + sal_Bool m_bDontHideDisabledEntries ; /// cache "DontHideDisabledEntries" of Menu section + sal_Bool m_bFollowMouse ; /// cache "FollowMouse" of Menu section + sal_Int16 m_nMenuIcons ; /// cache "MenuIcons" of Menu section + + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + SvtMenuOptions_Impl(); + ~SvtMenuOptions_Impl(); + + void AddListener( const Link& rLink ); + void RemoveListener( const Link& rLink ); + + //--------------------------------------------------------------------------------------------------------- + // overloaded methods of baseclass + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short called for notify of configmanager + @descr These method is called from the ConfigManager before application ends or from the + PropertyChangeListener if the sub tree broadcasts changes. You must update your + internal values. + + @seealso baseclass ConfigItem + + @param "seqPropertyNames" is the list of properties which should be updated. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void Notify( const Sequence< OUString >& seqPropertyNames ); + + /*-****************************************************************************************************//** + @short write changes to configuration + @descr These method writes the changed values into the sub tree + and should always called in our destructor to guarantee consistency of config data. + + @seealso baseclass ConfigItem + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void Commit(); + + //--------------------------------------------------------------------------------------------------------- + // public interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short access method to get internal values + @descr These method give us a chance to regulate acces to ouer internal values. + It's not used in the moment - but it's possible for the feature! + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + sal_Bool IsEntryHidingEnabled() const + { return m_bDontHideDisabledEntries; } + + sal_Bool IsFollowMouseEnabled() const + { return m_bFollowMouse; } + + sal_Int16 GetMenuIconsState() const + { return m_nMenuIcons; } + + void SetEntryHidingState ( sal_Bool bState ) + { + m_bDontHideDisabledEntries = bState; + SetModified(); + for ( USHORT n=0; nCall( this ); + Commit(); + } + + void SetFollowMouseState ( sal_Bool bState ) + { + m_bFollowMouse = bState; + SetModified(); + for ( USHORT n=0; nCall( this ); + Commit(); + } + + void SetMenuIconsState ( sal_Int16 bState ) + { + m_nMenuIcons = bState; + SetModified(); + for ( USHORT n=0; nCall( this ); + Commit(); + } + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return list of fix key names of ouer configuration management which represent oue module tree + @descr These methods return a static const list of key names. We need it to get needed values from our + configuration management. + + @seealso - + + @param - + @return A list of needed configuration keys is returned. + + @onerror - + *//*-*****************************************************************************************************/ + + static Sequence< OUString > impl_GetPropertyNames(); +}; + +//_________________________________________________________________________________________________________________ +// definitions +//_________________________________________________________________________________________________________________ + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtMenuOptions_Impl::SvtMenuOptions_Impl() + // Init baseclasses first + : ConfigItem ( ROOTNODE_MENU ) + // Init member then. + , m_bDontHideDisabledEntries ( DEFAULT_DONTHIDEDISABLEDENTRIES ) + , m_bFollowMouse ( DEFAULT_FOLLOWMOUSE ) + , m_nMenuIcons ( DEFAULT_MENUICONS ) +{ + // Use our static list of configuration keys to get his values. + Sequence< OUString > seqNames = impl_GetPropertyNames(); + Sequence< Any > seqValues = GetProperties( seqNames ) ; + + // Safe impossible cases. + // We need values from ALL configuration keys. + // Follow assignment use order of values in relation to our list of key names! + DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nI miss some values of configuration keys!\n" ); + + sal_Bool bMenuIcons = true; + sal_Bool bSystemMenuIcons = true; + + // Copy values from list in right order to ouer internal member. + sal_Int32 nPropertyCount = seqValues.getLength() ; + sal_Int32 nProperty = 0 ; + for( nProperty=0; nProperty>= m_bDontHideDisabledEntries; + } + break; + + case PROPERTYHANDLE_FOLLOWMOUSE : { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\FollowMouse\"?" ); + seqValues[nProperty] >>= m_bFollowMouse; + } + break; + case PROPERTYHANDLE_SHOWICONSINMENUES : { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\ShowIconsInMenues\"?" ); + seqValues[nProperty] >>= bMenuIcons; + } + break; + case PROPERTYHANDLE_SYSTEMICONSINMENUES : { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\IsSystemIconsInMenus\"?" ); + seqValues[nProperty] >>= bSystemMenuIcons; + } + break; + } + } + + m_nMenuIcons = bSystemMenuIcons ? 2 : bMenuIcons; + + EnableNotification( seqNames ); +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtMenuOptions_Impl::~SvtMenuOptions_Impl() +{ + // Flush data to configuration! + // User has no chance to do that. + if( IsModified() == sal_True ) + { + Commit(); + } + + for ( USHORT n=0; n& seqPropertyNames ) +{ + // Use given list of updated properties to get his values from configuration directly! + Sequence< Any > seqValues = GetProperties( seqPropertyNames ); + // Safe impossible cases. + // We need values from ALL notified configuration keys. + DBG_ASSERT( !(seqPropertyNames.getLength()!=seqValues.getLength()), "SvtMenuOptions_Impl::Notify()\nI miss some values of configuration keys!\n" ); + + sal_Bool bMenuIcons = true; + sal_Bool bSystemMenuIcons = true; + + // Step over list of property names and get right value from coreesponding value list to set it on internal members! + sal_Int32 nCount = seqPropertyNames.getLength(); + for( sal_Int32 nProperty=0; nProperty>= m_bDontHideDisabledEntries; + } + else if( seqPropertyNames[nProperty] == PROPERTYNAME_FOLLOWMOUSE ) + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::Notify()\nWho has changed the value type of \"Office.Common\\View\\Menu\\FollowMouse\"?" ); + seqValues[nProperty] >>= m_bFollowMouse; + } + else if( seqPropertyNames[nProperty] == PROPERTYNAME_SHOWICONSINMENUES ) + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\ShowIconsInMenues\"?" ); + seqValues[nProperty] >>= bMenuIcons; + } + else if( seqPropertyNames[nProperty] == PROPERTYNAME_SYSTEMICONSINMENUES ) + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\IsSystemIconsInMenus\"?" ); + seqValues[nProperty] >>= bSystemMenuIcons; + } + + #if OSL_DEBUG_LEVEL > 1 + else DBG_ASSERT( sal_False, "SvtMenuOptions_Impl::Notify()\nUnkown property detected ... I can't handle these!\n" ); + #endif + } + + m_nMenuIcons = bSystemMenuIcons ? 2 : bMenuIcons; + + for ( USHORT n=0; nCall( this ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtMenuOptions_Impl::Commit() +{ + // Get names of supported properties, create a list for values and copy current values to it. + Sequence< OUString > seqNames = impl_GetPropertyNames(); + sal_Int32 nCount = seqNames.getLength(); + Sequence< Any > seqValues ( nCount ); + for( sal_Int32 nProperty=0; nProperty SvtMenuOptions_Impl::impl_GetPropertyNames() +{ + // Build static list of configuration key names. + static const OUString pProperties[] = + { + PROPERTYNAME_DONTHIDEDISABLEDENTRIES , + PROPERTYNAME_FOLLOWMOUSE , + PROPERTYNAME_SHOWICONSINMENUES , + PROPERTYNAME_SYSTEMICONSINMENUES + }; + // Initialize return sequence with these list ... + static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + // ... and return it. + return seqPropertyNames; +} + +void SvtMenuOptions_Impl::AddListener( const Link& rLink ) +{ + aList.Insert( new Link( rLink ) ); +} + +void SvtMenuOptions_Impl::RemoveListener( const Link& rLink ) +{ + for ( USHORT n=0; nIsEntryHidingEnabled(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtMenuOptions::IsFollowMouseEnabled() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsFollowMouseEnabled(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtMenuOptions::SetEntryHidingState( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetEntryHidingState( bState ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtMenuOptions::SetFollowMouseState( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetFollowMouseState( bState ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Int16 SvtMenuOptions::GetMenuIconsState() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetMenuIconsState(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtMenuOptions::SetMenuIconsState( sal_Int16 bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetMenuIconsState( bState ); +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Mutex& SvtMenuOptions::GetOwnStaticMutex() +{ + // Initialize static mutex only for one time! + static Mutex* pMutex = NULL; + // If these method first called (Mutex not already exist!) ... + if( pMutex == NULL ) + { + // ... we must create a new one. Protect follow code with the global mutex - + // It must be - we create a static variable! + MutexGuard aGuard( Mutex::getGlobalMutex() ); + // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! + if( pMutex == NULL ) + { + // Create the new mutex and set it for return on static variable. + static Mutex aMutex; + pMutex = &aMutex; + } + } + // Return new created or already existing mutex object. + return *pMutex; +} + +void SvtMenuOptions::AddListener( const Link& rLink ) +{ + m_pDataContainer->AddListener( rLink ); +} + +void SvtMenuOptions::RemoveListener( const Link& rLink ) +{ + m_pDataContainer->RemoveListener( rLink ); +} diff --git a/unotools/source/config/moduleoptions.cxx b/unotools/source/config/moduleoptions.cxx new file mode 100644 index 000000000000..f966d4415558 --- /dev/null +++ b/unotools/source/config/moduleoptions.cxx @@ -0,0 +1,1600 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: moduleoptions.cxx,v $ + * $Revision: 1.36 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +#ifndef GCC +#endif + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "itemholder1.hxx" + +//_________________________________________________________________________________________________________________ +// namespaces +//_________________________________________________________________________________________________________________ + +#ifndef css +namespace css = ::com::sun::star; +#endif + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @descr These values are used to define neccessary keys from our configuration management to support + all functionality of these implementation. + It's a fast way to make changes if some keys change his name or location! + + Property handle are neccessary to specify right position in return list of configuration + for asked values. We ask it with a list of properties to get his values. The returned list + has the same order like our given name list! + e.g.: + NAMELIST[ PROPERTYHANDLE_xxx ] => VALUELIST[ PROPERTYHANDLE_xxx ] +*//*-*************************************************************************************************************/ +#define ROOTNODE_FACTORIES ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Setup/Office/Factories" )) +#define PATHSEPERATOR ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/" )) + +// Attention: The property "ooSetupFactoryEmptyDocumentURL" is read from configuration but not used! There is +// special code that uses hard coded strings to return them. +#define PROPERTYNAME_SHORTNAME ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryShortName" )) +#define PROPERTYNAME_TEMPLATEFILE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryTemplateFile" )) +#define PROPERTYNAME_WINDOWATTRIBUTES ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryWindowAttributes")) +#define PROPERTYNAME_EMPTYDOCUMENTURL ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryEmptyDocumentURL")) +#define PROPERTYNAME_DEFAULTFILTER ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryDefaultFilter" )) +#define PROPERTYNAME_ICON ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryIcon" )) + +#define PROPERTYHANDLE_SHORTNAME 0 +#define PROPERTYHANDLE_TEMPLATEFILE 1 +#define PROPERTYHANDLE_WINDOWATTRIBUTES 2 +#define PROPERTYHANDLE_EMPTYDOCUMENTURL 3 +#define PROPERTYHANDLE_DEFAULTFILTER 4 +#define PROPERTYHANDLE_ICON 5 + +#define PROPERTYCOUNT 6 + +#define FACTORYNAME_WRITER ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" )) +#define FACTORYNAME_WRITERWEB ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.WebDocument" )) +#define FACTORYNAME_WRITERGLOBAL ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.GlobalDocument" )) +#define FACTORYNAME_CALC ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument" )) +#define FACTORYNAME_DRAW ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocument" )) +#define FACTORYNAME_IMPRESS ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument")) +#define FACTORYNAME_MATH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.formula.FormulaProperties" )) +#define FACTORYNAME_CHART ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.ChartDocument" )) +#define FACTORYNAME_DATABASE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.OfficeDatabaseDocument" )) +#define FACTORYNAME_STARTMODULE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StartModule" )) + +#define FACTORYCOUNT 10 + +/*-************************************************************************************************************//** + @descr This struct hold information about one factory. We declare a complete array which can hold infos + for all well known factories. Values of enum "EFactory" (see header!) are directly used as index! + So we can support a fast access on these informations. +*//*-*************************************************************************************************************/ +struct FactoryInfo +{ + public: + //--------------------------------------------------------------------------------------------------------- + // initialize empty struct + FactoryInfo() + { + free(); + // @@@ should be supplied from outside! + xSMgr = ::utl::getProcessServiceFactory(); + } + + //--------------------------------------------------------------------------------------------------------- + // easy way to reset struct member! + void free() + { + bInstalled = sal_False ; + sFactory = ::rtl::OUString() ; + sShortName = ::rtl::OUString() ; + sTemplateFile = ::rtl::OUString() ; + sWindowAttributes = ::rtl::OUString() ; + sEmptyDocumentURL = ::rtl::OUString() ; + sDefaultFilter = ::rtl::OUString() ; + nIcon = 0 ; + bChangedTemplateFile = sal_False ; + bChangedWindowAttributes = sal_False ; + bChangedEmptyDocumentURL = sal_False ; + bChangedDefaultFilter = sal_False ; + bChangedIcon = sal_False ; + bDefaultFilterReadonly = sal_False ; + } + + //--------------------------------------------------------------------------------------------------------- + // returns list of properties, which has changed only! + // We use given value of sNodeBase to build full qualified pathes ... + // Last sign of it must be "/". Beacuse we use it directly, without any additional things! + css::uno::Sequence< css::beans::PropertyValue > getChangedProperties( const ::rtl::OUString& sNodeBase ) + { + // a) reserve memory for max. count of changed properties + // b) add names and values of changed ones only and count it + // c) resize return list by using count + css::uno::Sequence< css::beans::PropertyValue > lProperties ( 4 ); + sal_Int8 nRealyChanged = 0 ; + + if( bChangedTemplateFile == sal_True ) + { + lProperties[nRealyChanged].Name = sNodeBase + PROPERTYNAME_TEMPLATEFILE; + + if ( sTemplateFile.getLength() > 0 ) + { + lProperties[nRealyChanged].Value + <<= getStringSubstitution() + ->reSubstituteVariables( sTemplateFile ); + } + else + { + lProperties[nRealyChanged].Value <<= sTemplateFile; + } + + ++nRealyChanged; + } + if( bChangedWindowAttributes == sal_True ) + { + lProperties[nRealyChanged].Name = sNodeBase + PROPERTYNAME_WINDOWATTRIBUTES; + lProperties[nRealyChanged].Value <<= sWindowAttributes; + ++nRealyChanged; + } + if( bChangedEmptyDocumentURL == sal_True ) + { + lProperties[nRealyChanged].Name = sNodeBase + PROPERTYNAME_EMPTYDOCUMENTURL; + lProperties[nRealyChanged].Value <<= sEmptyDocumentURL; + ++nRealyChanged; + } + if( bChangedDefaultFilter == sal_True ) + { + lProperties[nRealyChanged].Name = sNodeBase + PROPERTYNAME_DEFAULTFILTER; + lProperties[nRealyChanged].Value <<= sDefaultFilter; + ++nRealyChanged; + } + if( bChangedIcon == sal_True ) + { + lProperties[nRealyChanged].Name = sNodeBase + PROPERTYNAME_ICON; + lProperties[nRealyChanged].Value <<= nIcon; + ++nRealyChanged; + } + + // Don't forget to reset changed flags! Otherwise we save it again and again and ... + bChangedTemplateFile = sal_False ; + bChangedWindowAttributes = sal_False ; + bChangedEmptyDocumentURL = sal_False ; + bChangedDefaultFilter = sal_False ; + bChangedIcon = sal_False ; + + lProperties.realloc( nRealyChanged ); + return lProperties; + } + + //--------------------------------------------------------------------------------------------------------- + // We must support setting AND marking of changed values. + // That's why we can't make our member public. We must use get/set/init methods + // to control access on it! + sal_Bool getInstalled () const { return bInstalled; }; + ::rtl::OUString getFactory () const { return sFactory; }; + ::rtl::OUString getShortName () const { return sShortName; }; + ::rtl::OUString getTemplateFile () const { return sTemplateFile; }; + ::rtl::OUString getWindowAttributes () const { return sWindowAttributes; }; + ::rtl::OUString getEmptyDocumentURL () const { return sEmptyDocumentURL; }; + ::rtl::OUString getDefaultFilter () const { return sDefaultFilter; }; + sal_Bool isDefaultFilterReadonly() const { return bDefaultFilterReadonly; } + sal_Int32 getIcon () const { return nIcon; }; + + //--------------------------------------------------------------------------------------------------------- + // If you call set-methods - we check for changes of valkues and mark it. + // But if you whish to set it without that ... you must initialize it! + void initInstalled ( sal_Bool bNewInstalled ) { bInstalled = bNewInstalled ; } + void initFactory ( const ::rtl::OUString& sNewFactory ) { sFactory = sNewFactory ; } + void initShortName ( const ::rtl::OUString& sNewShortName ) { sShortName = sNewShortName ; } + void initWindowAttributes ( const ::rtl::OUString& sNewWindowAttributes ) { sWindowAttributes = sNewWindowAttributes ; } + void initEmptyDocumentURL ( const ::rtl::OUString& sNewEmptyDocumentURL ) { sEmptyDocumentURL = sNewEmptyDocumentURL ; } + void initDefaultFilter ( const ::rtl::OUString& sNewDefaultFilter ) { sDefaultFilter = sNewDefaultFilter ; } + void setDefaultFilterReadonly( const sal_Bool bVal){bDefaultFilterReadonly = bVal;} + void initIcon ( sal_Int32 nNewIcon ) { nIcon = nNewIcon ; } + + //--------------------------------------------------------------------------------------------------------- + void initTemplateFile( const ::rtl::OUString& sNewTemplateFile ) + { + if ( sNewTemplateFile.getLength() > 0 ) + { + sTemplateFile + = getStringSubstitution() + ->substituteVariables( sNewTemplateFile, sal_False ); + } + else + { + sTemplateFile = sNewTemplateFile; + } + } + + //--------------------------------------------------------------------------------------------------------- + void setInstalled( sal_Bool bNewInstalled ) + { + bInstalled = bNewInstalled; + }; + + //--------------------------------------------------------------------------------------------------------- + void setFactory( const ::rtl::OUString& sNewFactory ) + { + sFactory = sNewFactory; + }; + + //--------------------------------------------------------------------------------------------------------- + void setShortName( const ::rtl::OUString& sNewShortName ) + { + sShortName = sNewShortName; + }; + + //--------------------------------------------------------------------------------------------------------- + void setTemplateFile( const ::rtl::OUString& sNewTemplateFile ) + { + if( sTemplateFile != sNewTemplateFile ) + { + sTemplateFile = sNewTemplateFile; + bChangedTemplateFile = sal_True ; + } + }; + + //--------------------------------------------------------------------------------------------------------- + void setWindowAttributes( const ::rtl::OUString& sNewWindowAttributes ) + { + if( sWindowAttributes != sNewWindowAttributes ) + { + sWindowAttributes = sNewWindowAttributes; + bChangedWindowAttributes = sal_True ; + } + }; + + //--------------------------------------------------------------------------------------------------------- + void setEmptyDocumentURL( const ::rtl::OUString& sNewEmptyDocumentURL ) + { + if( sEmptyDocumentURL != sNewEmptyDocumentURL ) + { + sEmptyDocumentURL = sNewEmptyDocumentURL; + bChangedEmptyDocumentURL = sal_True ; + } + }; + + //--------------------------------------------------------------------------------------------------------- + void setDefaultFilter( const ::rtl::OUString& sNewDefaultFilter ) + { + if( sDefaultFilter != sNewDefaultFilter ) + { + sDefaultFilter = sNewDefaultFilter; + bChangedDefaultFilter = sal_True ; + } + }; + + //--------------------------------------------------------------------------------------------------------- + void setIcon( sal_Int32 nNewIcon ) + { + if( nNewIcon != nNewIcon ) + { + nNewIcon = nNewIcon; + bChangedIcon = sal_True; + } + }; + + private: + css::uno::Reference< css::util::XStringSubstitution > getStringSubstitution() + { + if ( !xSubstVars.is() ) + { + xSubstVars + = css::uno::Reference< css::util::XStringSubstitution >( + xSMgr->createInstance( + ::rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.util.PathSubstitution" ) ) ), + css::uno::UNO_QUERY ); + if ( !xSubstVars.is() ) + throw css::uno::RuntimeException( + ::rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "Cannot instanciate service " + "com.sun.star.util.PathSubstitution" ) ), + css::uno::Reference< css::uno::XInterface >() ); + } + return xSubstVars; + } + + sal_Bool bInstalled ; + ::rtl::OUString sFactory ; + ::rtl::OUString sShortName ; + ::rtl::OUString sTemplateFile ; + ::rtl::OUString sWindowAttributes ; + ::rtl::OUString sEmptyDocumentURL ; + ::rtl::OUString sDefaultFilter ; + sal_Int32 nIcon ; + + sal_Bool bChangedTemplateFile :1 ; + sal_Bool bChangedWindowAttributes :1 ; + sal_Bool bChangedEmptyDocumentURL :1 ; + sal_Bool bChangedDefaultFilter :1 ; + sal_Bool bChangedIcon :1 ; + sal_Bool bDefaultFilterReadonly :1 ; + + css::uno::Reference< css::lang::XMultiServiceFactory > xSMgr; + css::uno::Reference< css::util::XStringSubstitution > xSubstVars; +}; + +typedef FactoryInfo FactoryInfoList[FACTORYCOUNT]; + +/*-************************************************************************************************************//** + @short IMPL data container for wrapper class SvtModulOptions! + @descr These class is used as a static data container of class SvtModuleOptions. The hold it by using + a refcount and make it threadsafe by using an osl mutex. So we don't must do anything for that. + We can implement pure functionality to read/write configuration data only. + + @implements - + @base ConfigItem + + @devstatus ready to use + @threadsafe no +*//*-*************************************************************************************************************/ +class SvtModuleOptions_Impl : public ::utl::ConfigItem +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + SvtModuleOptions_Impl(SvtModuleOptions* pOutsideClass); + ~SvtModuleOptions_Impl(); + + //--------------------------------------------------------------------------------------------------------- + // overloaded methods of baseclass + //--------------------------------------------------------------------------------------------------------- + virtual void Notify( const css::uno::Sequence< ::rtl::OUString >& lPropertyNames ); + virtual void Commit( ); + + //--------------------------------------------------------------------------------------------------------- + // public interface + //--------------------------------------------------------------------------------------------------------- + sal_Bool IsModuleInstalled ( SvtModuleOptions::EModule eModule ) const; + ::com::sun::star::uno::Sequence < ::rtl::OUString > GetAllServiceNames(); + ::rtl::OUString GetFactoryName ( SvtModuleOptions::EFactory eFactory ) const; + ::rtl::OUString GetFactoryShortName ( SvtModuleOptions::EFactory eFactory ) const; + ::rtl::OUString GetFactoryStandardTemplate( SvtModuleOptions::EFactory eFactory ) const; + ::rtl::OUString GetFactoryWindowAttributes( SvtModuleOptions::EFactory eFactory ) const; + ::rtl::OUString GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory eFactory ) const; + ::rtl::OUString GetFactoryDefaultFilter ( SvtModuleOptions::EFactory eFactory ) const; + sal_Bool IsDefaultFilterReadonly( SvtModuleOptions::EFactory eFactory ) const; + sal_Int32 GetFactoryIcon ( SvtModuleOptions::EFactory eFactory ) const; + static sal_Bool ClassifyFactoryByName ( const ::rtl::OUString& sName , + SvtModuleOptions::EFactory& eFactory ); + void SetFactoryStandardTemplate( SvtModuleOptions::EFactory eFactory , + const ::rtl::OUString& sTemplate ); + void SetFactoryWindowAttributes( SvtModuleOptions::EFactory eFactory , + const ::rtl::OUString& sAttributes); + void SetFactoryDefaultFilter ( SvtModuleOptions::EFactory eFactory , + const ::rtl::OUString& sFilter ); + void MakeReadonlyStatesAvailable(); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + private: + static css::uno::Sequence< ::rtl::OUString > impl_ExpandSetNames ( const css::uno::Sequence< ::rtl::OUString >& lSetNames ); + void impl_Read ( const css::uno::Sequence< ::rtl::OUString >& lSetNames ); + + //------------------------------------------------------------------------------------------------------------- + // private types + //------------------------------------------------------------------------------------------------------------- + private: + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + private: + FactoryInfoList m_lFactories; + sal_Bool m_bReadOnlyStatesWellKnown; + SvtModuleOptions* m_pOutsideClass; +}; + +//_________________________________________________________________________________________________________________ +// definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short default ctor + @descr We open our configuration here and read all neccessary values from it. + These values are cached till everyone call Commit(). Then we write changed ones back to cfg. + + @seealso baseclass ConfigItem + @seealso method impl_Read() + + @param - + @return - + + @onerror - + @threadsafe no +*//*-*************************************************************************************************************/ +SvtModuleOptions_Impl::SvtModuleOptions_Impl(SvtModuleOptions* pOutsideClass) + : ::utl::ConfigItem( ROOTNODE_FACTORIES ) + , m_bReadOnlyStatesWellKnown( sal_False ) + , m_pOutsideClass( pOutsideClass ) +{ + // First initialize list of factory infos! Otherwise we couldnt gurantee right working of these class. + for( sal_Int32 nFactory=0; nFactory lFactories = GetNodeNames( ::rtl::OUString() ); + impl_Read( lFactories ); + + // Enable notification for changes by using configuration directly. + // So we can update our internal values immediatly. + EnableNotification( lFactories ); +} + +/*-************************************************************************************************************//** + @short default dtor + @descr If any values of our cache was modified we should write it back to configuration. + + @attention Don't forget to call "SetModified()" method of base class ConfigItem if any interface method + of this class modify internal member list m_lFactories! Otherwise Commit() will never be called!!! + + @seealso baseclass ConfigItem + + @param - + @return - + + @onerror - + @threadsafe no +*//*-*************************************************************************************************************/ +SvtModuleOptions_Impl::~SvtModuleOptions_Impl() +{ + if( IsModified() == sal_True ) + { + Commit(); + } +} + +/*-************************************************************************************************************//** + @short called for notify of configmanager + @descr These method is called from the ConfigManager before application ends or from the + PropertyChangeListener if the sub tree broadcasts changes. You must update our + internal values. + + @attention We are registered for pure set node names only. So we can use our internal method "impl_Read()" to + update our info list. Because - these method expand given name list to full qualified property list + and use it to read the values. These values are filled into our internal member list m_lFactories + at right position. + + @seealso method impl_Read() + + @param "lNames" is the list of set node entries which should be updated. + @return - + + @onerror - + @threadsafe no +*//*-*************************************************************************************************************/ +void SvtModuleOptions_Impl::Notify( const css::uno::Sequence< ::rtl::OUString >& ) +{ + OSL_ENSURE( sal_False, "SvtModuleOptions_Impl::Notify()\nNot implemented yet!\n" ); +} + +/*-****************************************************************************************************//** + @short write changes to configuration + @descr These method writes the changed values into the sub tree + and should always called in our destructor to guarantee consistency of config data. + + @attention We clear complete set in configuration first and write it completly new! So we don't must + distinguish between existing, added or removed elements. Our internal cached values + are the only and right ones. + + @seealso baseclass ConfigItem + + @param - + @return - + + @onerror - + @threadsafe no +*//*-*****************************************************************************************************/ +void SvtModuleOptions_Impl::Commit() +{ + // Reserve memory for ALL possible factory properties! + // Step over all factories and get her realy changed values only. + // Build list of these ones and use it for commit. + css::uno::Sequence< css::beans::PropertyValue > lCommitProperties( FACTORYCOUNT*PROPERTYCOUNT ); + FactoryInfo* pInfo = NULL ; + sal_Int32 nRealCount = 0 ; + ::rtl::OUString sBasePath ; + for( sal_Int32 nFactory=0; nFactorygetChangedProperties() for further informations + sBasePath = PATHSEPERATOR + pInfo->getFactory() + PATHSEPERATOR; + + const css::uno::Sequence< css::beans::PropertyValue > lChangedProperties = pInfo->getChangedProperties ( sBasePath ); + const css::beans::PropertyValue* pChangedProperties = lChangedProperties.getConstArray(); + sal_Int32 nPropertyCount = lChangedProperties.getLength(); + for( sal_Int32 nProperty=0; nProperty 0 ) + { + lCommitProperties.realloc( nRealCount ); + SetSetProperties( ::rtl::OUString(), lCommitProperties ); + } +} + +/*-****************************************************************************************************//** + @short access method to get internal values + @descr These methods implement easy access to our internal values. + You give us right enum value to specify which module interest you ... we return right information. + + @attention Some poeple use any value as enum ... but we support in header specified values only! + We use it directly as index in our internal list. If enum value isn't right - we crash with an + "index out of range"!!! Please use me right - otherwise there is no guarantee. + + @seealso - + + @param "eModule" , index in list - specify module + @param "eFactory" , index in list - specify factory + @param "sTemplate", set new standard template for these factory + @return Queried information. + + @onerror We return default values. (mostly "not installed"!) + @threadsafe no +*//*-*****************************************************************************************************/ +sal_Bool SvtModuleOptions_Impl::IsModuleInstalled( SvtModuleOptions::EModule eModule ) const +{ + sal_Bool bInstalled = sal_False; + switch( eModule ) + { + case SvtModuleOptions::E_SWRITER : bInstalled = m_lFactories[SvtModuleOptions::E_WRITER].getInstalled(); + break; + case SvtModuleOptions::E_SWEB : bInstalled = m_lFactories[SvtModuleOptions::E_WRITERWEB].getInstalled(); + break; + case SvtModuleOptions::E_SGLOBAL : bInstalled = m_lFactories[SvtModuleOptions::E_WRITERGLOBAL].getInstalled(); + break; + case SvtModuleOptions::E_SCALC : bInstalled = m_lFactories[SvtModuleOptions::E_CALC].getInstalled(); + break; + case SvtModuleOptions::E_SDRAW : bInstalled = m_lFactories[SvtModuleOptions::E_DRAW].getInstalled(); + break; + case SvtModuleOptions::E_SIMPRESS : bInstalled = m_lFactories[SvtModuleOptions::E_IMPRESS].getInstalled(); + break; + case SvtModuleOptions::E_SMATH : bInstalled = m_lFactories[SvtModuleOptions::E_MATH].getInstalled(); + break; + case SvtModuleOptions::E_SCHART : bInstalled = m_lFactories[SvtModuleOptions::E_CHART].getInstalled(); + break; + case SvtModuleOptions::E_SSTARTMODULE : bInstalled = m_lFactories[SvtModuleOptions::E_STARTMODULE].getInstalled(); + break; + case SvtModuleOptions::E_SBASIC : bInstalled = sal_True; // Couldn't be deselected by setup yet! + break; + case SvtModuleOptions::E_SDATABASE : bInstalled = m_lFactories[SvtModuleOptions::E_DATABASE].getInstalled(); + break; + } + + return bInstalled; +} + +::com::sun::star::uno::Sequence < ::rtl::OUString > SvtModuleOptions_Impl::GetAllServiceNames() +{ + sal_uInt32 nCount=0; + if( m_lFactories[SvtModuleOptions::E_WRITER].getInstalled() ) + nCount++; + if ( m_lFactories[SvtModuleOptions::E_WRITERWEB].getInstalled() ) + nCount++; + if ( m_lFactories[SvtModuleOptions::E_WRITERGLOBAL].getInstalled() ) + nCount++; + if( m_lFactories[SvtModuleOptions::E_SCALC].getInstalled() ) + nCount++; + if( m_lFactories[SvtModuleOptions::E_SDRAW].getInstalled() ) + nCount++; + if( m_lFactories[SvtModuleOptions::E_SIMPRESS].getInstalled() ) + nCount++; + if( m_lFactories[SvtModuleOptions::E_SCHART].getInstalled() ) + nCount++; + if( m_lFactories[SvtModuleOptions::E_SMATH].getInstalled() ) + nCount++; + if( m_lFactories[SvtModuleOptions::E_SBASIC].getInstalled() ) + nCount++; + if( m_lFactories[SvtModuleOptions::E_SDATABASE].getInstalled() ) + nCount++; + + css::uno::Sequence < ::rtl::OUString > aRet( nCount ); + sal_Int32 n=0; + if( m_lFactories[SvtModuleOptions::E_WRITER].getInstalled() ) + aRet[n++] = m_lFactories[SvtModuleOptions::E_WRITER].getFactory(); + if ( m_lFactories[SvtModuleOptions::E_WRITERWEB].getInstalled() ) + aRet[n++] = m_lFactories[SvtModuleOptions::E_WRITERWEB].getFactory(); + if ( m_lFactories[SvtModuleOptions::E_WRITERGLOBAL].getInstalled() ) + aRet[n++] = m_lFactories[SvtModuleOptions::E_WRITERGLOBAL].getFactory(); + if( m_lFactories[SvtModuleOptions::E_SCALC].getInstalled() ) + aRet[n++] = m_lFactories[SvtModuleOptions::E_SCALC].getFactory(); + if( m_lFactories[SvtModuleOptions::E_SDRAW].getInstalled() ) + aRet[n++] = m_lFactories[SvtModuleOptions::E_SDRAW].getFactory(); + if( m_lFactories[SvtModuleOptions::E_SIMPRESS].getInstalled() ) + aRet[n++] = m_lFactories[SvtModuleOptions::E_SIMPRESS].getFactory(); + if( m_lFactories[SvtModuleOptions::E_SCHART].getInstalled() ) + aRet[n++] = m_lFactories[SvtModuleOptions::E_SCHART].getFactory(); + if( m_lFactories[SvtModuleOptions::E_SMATH].getInstalled() ) + aRet[n++] = m_lFactories[SvtModuleOptions::E_SMATH].getFactory(); + if( m_lFactories[SvtModuleOptions::E_SBASIC].getInstalled() ) + aRet[n++] = m_lFactories[SvtModuleOptions::E_SBASIC].getFactory(); + if( m_lFactories[SvtModuleOptions::E_SDATABASE].getInstalled() ) + aRet[n++] = m_lFactories[SvtModuleOptions::E_SDATABASE].getFactory(); + + return aRet; +} + +//***************************************************************************************************************** +::rtl::OUString SvtModuleOptions_Impl::GetFactoryName( SvtModuleOptions::EFactory eFactory ) const +{ + ::rtl::OUString sName; + + if( eFactory>=0 && eFactory=0 && eFactory=0 && eFactory=0 && eFactory=0 && eFactory=0 && eFactory=0 && eFactory=0 && eFactory=0 && eFactory SvtModuleOptions_Impl::impl_ExpandSetNames( const css::uno::Sequence< ::rtl::OUString >& lSetNames ) +{ + sal_Int32 nCount = lSetNames.getLength() ; + css::uno::Sequence< ::rtl::OUString > lPropNames ( nCount*PROPERTYCOUNT ); + ::rtl::OUString* pPropNames = lPropNames.getArray() ; + sal_Int32 nPropStart = 0 ; + + for( sal_Int32 nName=0; nName& lFactories ) +{ + // Expand every set node name in lFactories to full qualified pathes to his properties + // and get right values from configuration. + const css::uno::Sequence< ::rtl::OUString > lProperties = impl_ExpandSetNames( lFactories ); + const css::uno::Sequence< css::uno::Any > lValues = GetProperties( lProperties ); + + // Safe impossible cases. + // We need values from ALL configuration keys. + // Follow assignment use order of values in relation to our list of key names! + OSL_ENSURE( !(lProperties.getLength()!=lValues.getLength()), "SvtModuleOptions_Impl::impl_Read()\nI miss some values of configuration keys!\n" ); + + // Algorithm: We step over all given factory names and classify it. These enum value can be used as direct index + // in our member list m_lFactories! VAriable nPropertyStart marks start position of every factory + // and her properties in expanded property/value list. The defines PROPERTHANDLE_xxx are used as offset values + // added to nPropertyStart. So we can address every property relative in these lists. + // If we found any valid values ... we reset all existing informations for corresponding m_lFactories-entry and + // use a pointer to these struct in memory directly to set new values. + // But we set it only, if bInstalled is true. Otherwise all other values of a factory can be undeclared .. They + // shouldn't be used then. + // Attention: If a propertyset of a factory will be ignored we must step to next start position of next factory infos! + // see "nPropertyStart += PROPERTYCOUNT" ... + + sal_Int32 nPropertyStart = 0 ; + sal_Int32 nNodeCount = lFactories.getLength(); + FactoryInfo* pInfo = NULL ; + SvtModuleOptions::EFactory eFactory ; + + for( sal_Int32 nSetNode=0; nSetNodefree(); + + pInfo->initInstalled( sal_True ); + pInfo->initFactory ( sFactoryName ); + + if (lValues[nPropertyStart+PROPERTYHANDLE_SHORTNAME] >>= sTemp) + pInfo->initShortName( sTemp ); + if (lValues[nPropertyStart+PROPERTYHANDLE_TEMPLATEFILE] >>= sTemp) + pInfo->initTemplateFile( sTemp ); + if (lValues[nPropertyStart+PROPERTYHANDLE_WINDOWATTRIBUTES] >>= sTemp) + pInfo->initWindowAttributes( sTemp ); + if (lValues[nPropertyStart+PROPERTYHANDLE_EMPTYDOCUMENTURL] >>= sTemp) + pInfo->initEmptyDocumentURL( sTemp ); + if (lValues[nPropertyStart+PROPERTYHANDLE_DEFAULTFILTER ] >>= sTemp) + pInfo->initDefaultFilter( sTemp ); + if (lValues[nPropertyStart+PROPERTYHANDLE_ICON] >>= nTemp) + pInfo->initIcon( nTemp ); + } + nPropertyStart += PROPERTYCOUNT; + } +} + +//***************************************************************************************************************** +void SvtModuleOptions_Impl::MakeReadonlyStatesAvailable() +{ + if (m_bReadOnlyStatesWellKnown) + return; + + css::uno::Sequence< ::rtl::OUString > lFactories = GetNodeNames(::rtl::OUString()); + sal_Int32 c = lFactories.getLength(); + sal_Int32 i = 0; + for (i=0; i lReadonlyStates = GetReadOnlyStates(lFactories); + for (i=0; iIsModuleInstalled( eModule ); +} + +//***************************************************************************************************************** +::rtl::OUString SvtModuleOptions::GetFactoryName( EFactory eFactory ) const +{ + ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); + return m_pDataContainer->GetFactoryName( eFactory ); +} + +//***************************************************************************************************************** +::rtl::OUString SvtModuleOptions::GetFactoryShortName( EFactory eFactory ) const +{ + ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); + return m_pDataContainer->GetFactoryShortName( eFactory ); +} + +//***************************************************************************************************************** +::rtl::OUString SvtModuleOptions::GetFactoryStandardTemplate( EFactory eFactory ) const +{ + ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); + return m_pDataContainer->GetFactoryStandardTemplate( eFactory ); +} + +//***************************************************************************************************************** +::rtl::OUString SvtModuleOptions::GetFactoryWindowAttributes( EFactory eFactory ) const +{ + ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); + return m_pDataContainer->GetFactoryWindowAttributes( eFactory ); +} + +//***************************************************************************************************************** +::rtl::OUString SvtModuleOptions::GetFactoryEmptyDocumentURL( EFactory eFactory ) const +{ + ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); + return m_pDataContainer->GetFactoryEmptyDocumentURL( eFactory ); +} + +//***************************************************************************************************************** +::rtl::OUString SvtModuleOptions::GetFactoryDefaultFilter( EFactory eFactory ) const +{ + ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); + return m_pDataContainer->GetFactoryDefaultFilter( eFactory ); +} +//***************************************************************************************************************** +sal_Bool SvtModuleOptions::IsDefaultFilterReadonly( EFactory eFactory ) const +{ + ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); + m_pDataContainer->MakeReadonlyStatesAvailable(); + return m_pDataContainer->IsDefaultFilterReadonly( eFactory ); +} +//***************************************************************************************************************** +sal_Int32 SvtModuleOptions::GetFactoryIcon( EFactory eFactory ) const +{ + ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); + return m_pDataContainer->GetFactoryIcon( eFactory ); +} + +//***************************************************************************************************************** +sal_Bool SvtModuleOptions::ClassifyFactoryByName( const ::rtl::OUString& sName , + EFactory& eFactory ) +{ + // We don't need any mutex here ... because we don't use any member here! + return SvtModuleOptions_Impl::ClassifyFactoryByName( sName, eFactory ); +} + +//***************************************************************************************************************** +void SvtModuleOptions::SetFactoryStandardTemplate( EFactory eFactory , + const ::rtl::OUString& sTemplate ) +{ + ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); + m_pDataContainer->SetFactoryStandardTemplate( eFactory, sTemplate ); +} + +//***************************************************************************************************************** +void SvtModuleOptions::SetFactoryWindowAttributes( EFactory eFactory , + const ::rtl::OUString& sAttributes) +{ + ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); + m_pDataContainer->SetFactoryWindowAttributes( eFactory, sAttributes ); +} + +//***************************************************************************************************************** +void SvtModuleOptions::SetFactoryDefaultFilter( EFactory eFactory, + const ::rtl::OUString& sFilter ) +{ + ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); + m_pDataContainer->SetFactoryDefaultFilter( eFactory, sFilter ); +} + +//***************************************************************************************************************** +sal_Bool SvtModuleOptions::IsMath() const +{ + ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); + return m_pDataContainer->IsModuleInstalled( E_SMATH ); +} + +//***************************************************************************************************************** +sal_Bool SvtModuleOptions::IsChart() const +{ + ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); + return m_pDataContainer->IsModuleInstalled( E_SCHART ); +} + +//***************************************************************************************************************** +sal_Bool SvtModuleOptions::IsCalc() const +{ + ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); + return m_pDataContainer->IsModuleInstalled( E_SCALC ); +} + +//***************************************************************************************************************** +sal_Bool SvtModuleOptions::IsDraw() const +{ + ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); + return m_pDataContainer->IsModuleInstalled( E_SDRAW ); +} + +//***************************************************************************************************************** +sal_Bool SvtModuleOptions::IsWriter() const +{ + ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); + return m_pDataContainer->IsModuleInstalled( E_SWRITER ); +} + +//***************************************************************************************************************** +sal_Bool SvtModuleOptions::IsImpress() const +{ + ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); + return m_pDataContainer->IsModuleInstalled( E_SIMPRESS ); +} + +//***************************************************************************************************************** +sal_Bool SvtModuleOptions::IsBasicIDE() const +{ + return sal_True; +} +//***************************************************************************************************************** +sal_Bool SvtModuleOptions::IsDataBase() const +{ + ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); + return m_pDataContainer->IsModuleInstalled( E_SDATABASE ); +} +//***************************************************************************************************************** +sal_uInt32 SvtModuleOptions::GetFeatures() const +{ + ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); + + sal_uInt32 nFeature = 0; + + if( m_pDataContainer->IsModuleInstalled( E_SWRITER ) == sal_True ) + nFeature |= FEATUREFLAG_WRITER; + if( m_pDataContainer->IsModuleInstalled( E_SCALC ) == sal_True ) + nFeature |= FEATUREFLAG_CALC; + if( m_pDataContainer->IsModuleInstalled( E_SDRAW ) == sal_True ) + nFeature |= FEATUREFLAG_DRAW; + if( m_pDataContainer->IsModuleInstalled( E_SIMPRESS ) == sal_True ) + nFeature |= FEATUREFLAG_IMPRESS; + if( m_pDataContainer->IsModuleInstalled( E_SCHART ) == sal_True ) + nFeature |= FEATUREFLAG_CHART; + if( m_pDataContainer->IsModuleInstalled( E_SMATH ) == sal_True ) + nFeature |= FEATUREFLAG_MATH; + if( m_pDataContainer->IsModuleInstalled( E_SBASIC ) == sal_True ) + nFeature |= FEATUREFLAG_BASICIDE; + if( m_pDataContainer->IsModuleInstalled( E_SDATABASE ) == sal_True ) + nFeature |= FEATUREFLAG_INSIGHT; + + return nFeature; +} + +/*-****************************************************************************************************//** + @short return a reference to a static mutex + @descr These class is threadsafe. + We create a static mutex only for one time and use it to protect our refcount and container + member! + + @seealso - + + @param - + @return A reference to a static mutex member. + + @onerror - + @threadsafe yes +*//*-*****************************************************************************************************/ +::osl::Mutex& SvtModuleOptions::impl_GetOwnStaticMutex() +{ + // Initialize static mutex only for one time! + static ::osl::Mutex* pMutex = NULL; + // If these method first called (Mutex not already exist!) ... + if( pMutex == NULL ) + { + // ... we must create a new one. Protect follow code with the global mutex - + // It must be - we create a static variable! + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! + if( pMutex == NULL ) + { + // Create the new mutex and set it for return on static variable. + static ::osl::Mutex aMutex; + pMutex = &aMutex; + } + } + // Return new created or already existing mutex object. + return *pMutex; +} + +::rtl::OUString SvtModuleOptions::GetModuleName( EModule eModule ) const +{ + switch( eModule ) + { + case SvtModuleOptions::E_SWRITER : { return ::rtl::OUString::createFromAscii("Writer"); } + case SvtModuleOptions::E_SWEB : { return ::rtl::OUString::createFromAscii("Web"); } + case SvtModuleOptions::E_SGLOBAL : { return ::rtl::OUString::createFromAscii("Global"); } + case SvtModuleOptions::E_SCALC : { return ::rtl::OUString::createFromAscii("Calc"); } + case SvtModuleOptions::E_SDRAW : { return ::rtl::OUString::createFromAscii("Draw"); } + case SvtModuleOptions::E_SIMPRESS : { return ::rtl::OUString::createFromAscii("Impress"); } + case SvtModuleOptions::E_SMATH : { return ::rtl::OUString::createFromAscii("Math"); } + case SvtModuleOptions::E_SCHART : { return ::rtl::OUString::createFromAscii("Chart"); } + case SvtModuleOptions::E_SBASIC : { return ::rtl::OUString::createFromAscii("Basic"); } + case SvtModuleOptions::E_SDATABASE : { return ::rtl::OUString::createFromAscii("Database"); } + default: + OSL_ASSERT( "unknown module" ); + break; + } + + return ::rtl::OUString(); +} + +::rtl::OUString SvtModuleOptions::GetModuleName( EFactory eFactory ) const +{ + switch( eFactory ) + { + case SvtModuleOptions::E_WRITER : { return ::rtl::OUString::createFromAscii("Writer"); } + case SvtModuleOptions::E_WRITERWEB : { return ::rtl::OUString::createFromAscii("Writer"); } + case SvtModuleOptions::E_WRITERGLOBAL : { return ::rtl::OUString::createFromAscii("Writer"); } + case SvtModuleOptions::E_CALC : { return ::rtl::OUString::createFromAscii("Calc"); } + case SvtModuleOptions::E_DRAW : { return ::rtl::OUString::createFromAscii("Draw"); } + case SvtModuleOptions::E_IMPRESS : { return ::rtl::OUString::createFromAscii("Impress"); } + case SvtModuleOptions::E_MATH : { return ::rtl::OUString::createFromAscii("Math"); } + case SvtModuleOptions::E_CHART : { return ::rtl::OUString::createFromAscii("Chart"); } + case SvtModuleOptions::E_BASIC : { return ::rtl::OUString::createFromAscii("Basic"); } + case SvtModuleOptions::E_DATABASE : { return ::rtl::OUString::createFromAscii("Database"); } + default: + OSL_ASSERT( "unknown factory" ); + break; + } + + return ::rtl::OUString(); +} + +/*----------------------------------------------- + 07.03.2004 15:03 +-----------------------------------------------*/ +SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByShortName(const ::rtl::OUString& sName) +{ + if (sName.equalsAscii("swriter")) + return E_WRITER; + if (sName.equalsIgnoreAsciiCaseAscii("swriter/Web")) // sometimes they are registerd for swriter/web :-( + return E_WRITERWEB; + if (sName.equalsIgnoreAsciiCaseAscii("swriter/GlobalDocument")) // sometimes they are registerd for swriter/globaldocument :-( + return E_WRITERGLOBAL; + if (sName.equalsAscii("scalc")) + return E_CALC; + if (sName.equalsAscii("sdraw")) + return E_DRAW; + if (sName.equalsAscii("simpress")) + return E_IMPRESS; + if (sName.equalsAscii("schart")) + return E_CHART; + if (sName.equalsAscii("smath")) + return E_MATH; + if (sName.equalsAscii("sbasic")) + return E_BASIC; + if (sName.equalsAscii("sdatabase")) + return E_DATABASE; + + return E_UNKNOWN_FACTORY; +} + +/*----------------------------------------------- + 31.07.2003 10:41 +-----------------------------------------------*/ +SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByServiceName(const ::rtl::OUString& sName) +{ + if (sName.equals(FACTORYNAME_WRITERGLOBAL)) + return E_WRITERGLOBAL; + if (sName.equals(FACTORYNAME_WRITERWEB)) + return E_WRITERWEB; + if (sName.equals(FACTORYNAME_WRITER)) + return E_WRITER; + if (sName.equals(FACTORYNAME_CALC)) + return E_CALC; + if (sName.equals(FACTORYNAME_DRAW)) + return E_DRAW; + if (sName.equals(FACTORYNAME_IMPRESS)) + return E_IMPRESS; + if (sName.equals(FACTORYNAME_MATH)) + return E_MATH; + if (sName.equals(FACTORYNAME_CHART)) + return E_CHART; + if (sName.equals(FACTORYNAME_DATABASE)) + return E_DATABASE; + + return E_UNKNOWN_FACTORY; +} + +/*----------------------------------------------- + 31.07.2003 14:39 +-----------------------------------------------*/ +SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByURL(const ::rtl::OUString& sURL , + const css::uno::Sequence< css::beans::PropertyValue >& lMediaDescriptor) +{ + css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::utl::getProcessServiceFactory(); + if (!xSMGR.is()) + return E_UNKNOWN_FACTORY; + + css::uno::Reference< css::container::XNameAccess > xFilterCfg; + css::uno::Reference< css::container::XNameAccess > xTypeCfg ; + try + { + xFilterCfg = css::uno::Reference< css::container::XNameAccess >( + xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.document.FilterFactory")), css::uno::UNO_QUERY); + xTypeCfg = css::uno::Reference< css::container::XNameAccess >( + xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.document.TypeDetection")), css::uno::UNO_QUERY); + } + catch(const css::uno::RuntimeException&) + { throw; } + catch(const css::uno::Exception&) + { return E_UNKNOWN_FACTORY; } + + ::comphelper::SequenceAsHashMap stlDesc(lMediaDescriptor); + + // is there already a filter inside the descriptor? + ::rtl::OUString sFilterName = stlDesc.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("FilterName"), ::rtl::OUString()); + if (sFilterName.getLength()) + { + try + { + ::comphelper::SequenceAsHashMap stlFilterProps (xFilterCfg->getByName(sFilterName)); + ::rtl::OUString sDocumentService = stlFilterProps.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("DocumentService"), ::rtl::OUString()); + SvtModuleOptions::EFactory eApp = SvtModuleOptions::ClassifyFactoryByServiceName(sDocumentService); + + if (eApp != E_UNKNOWN_FACTORY) + return eApp; + } + catch(const css::uno::RuntimeException&) + { throw; } + catch(const css::uno::Exception&) + { /* do nothing here ... may the following code can help!*/ } + } + + // is there already a type inside the descriptor? + ::rtl::OUString sTypeName = stlDesc.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("TypeName"), ::rtl::OUString()); + if (!sTypeName.getLength()) + { + // no :-( + // start flat detection of URL + css::uno::Reference< css::document::XTypeDetection > xDetect(xTypeCfg, css::uno::UNO_QUERY); + sTypeName = xDetect->queryTypeByURL(sURL); + } + + if (!sTypeName.getLength()) + return E_UNKNOWN_FACTORY; + + // yes - there is a type info + // Try to find the preferred filter. + try + { + ::comphelper::SequenceAsHashMap stlTypeProps (xTypeCfg->getByName(sTypeName)); + ::rtl::OUString sPreferredFilter = stlTypeProps.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("PreferredFilter"), ::rtl::OUString()); + ::comphelper::SequenceAsHashMap stlFilterProps (xFilterCfg->getByName(sPreferredFilter)); + ::rtl::OUString sDocumentService = stlFilterProps.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("DocumentService"), ::rtl::OUString()); + SvtModuleOptions::EFactory eApp = SvtModuleOptions::ClassifyFactoryByServiceName(sDocumentService); + + if (eApp != E_UNKNOWN_FACTORY) + return eApp; + } + catch(const css::uno::RuntimeException&) + { throw; } + catch(const css::uno::Exception&) + { /* do nothing here ... may the following code can help!*/ } + + // no filter/no type/no detection result => no fun :-) + return E_UNKNOWN_FACTORY; +} + +/*----------------------------------------------- + 31.07.2003 10:41 +-----------------------------------------------*/ +SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByModel(const css::uno::Reference< css::frame::XModel >& xModel) +{ + css::uno::Reference< css::lang::XServiceInfo > xInfo(xModel, css::uno::UNO_QUERY); + if (!xInfo.is()) + return E_UNKNOWN_FACTORY; + + const css::uno::Sequence< ::rtl::OUString > lServices = xInfo->getSupportedServiceNames(); + const ::rtl::OUString* pServices = lServices.getConstArray(); + + for (sal_Int32 i=0; i SvtModuleOptions::GetAllServiceNames() +{ + ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); + return m_pDataContainer->GetAllServiceNames(); +} + +::rtl::OUString SvtModuleOptions::GetDefaultModuleName() +{ + ::rtl::OUString aModule; + if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SWRITER)) + aModule = m_pDataContainer->GetFactoryShortName(SvtModuleOptions::E_WRITER); + else + if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SCALC)) + aModule = m_pDataContainer->GetFactoryShortName(SvtModuleOptions::E_CALC); + else + if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SIMPRESS)) + aModule = m_pDataContainer->GetFactoryShortName(SvtModuleOptions::E_IMPRESS); + else + if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SDATABASE)) + aModule = m_pDataContainer->GetFactoryShortName(SvtModuleOptions::E_DATABASE); + else + if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SDRAW)) + aModule = m_pDataContainer->GetFactoryShortName(SvtModuleOptions::E_DRAW); + else + if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SWEB)) + aModule = m_pDataContainer->GetFactoryShortName(SvtModuleOptions::E_WRITERWEB); + else + if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SGLOBAL)) + aModule = m_pDataContainer->GetFactoryShortName(SvtModuleOptions::E_WRITERGLOBAL); + else + if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SMATH)) + aModule = m_pDataContainer->GetFactoryShortName(SvtModuleOptions::E_MATH); + return aModule; +} + diff --git a/unotools/source/config/options.cxx b/unotools/source/config/options.cxx new file mode 100644 index 000000000000..eba75b347edf --- /dev/null +++ b/unotools/source/config/options.cxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: options.cxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" + +#include "sal/config.h" +#include +#include + +namespace utl +{ + DECLARE_LIST( IMPL_ConfigurationListenerList, ConfigurationListener* ); +} + +using utl::detail::Options; +using utl::ConfigurationBroadcaster; + +ConfigurationBroadcaster::ConfigurationBroadcaster() +: mpList(0) +{ +} + +ConfigurationBroadcaster::~ConfigurationBroadcaster() +{ + delete mpList; +} + +void ConfigurationBroadcaster::AddListener( utl::ConfigurationListener* pListener ) +{ + if ( !mpList ) + mpList = new IMPL_ConfigurationListenerList; + mpList->Insert( pListener ); +} + +void ConfigurationBroadcaster::RemoveListener( utl::ConfigurationListener* pListener ) +{ + if ( mpList ) + mpList->Remove( pListener ); +} + +void ConfigurationBroadcaster::NotifyListeners() +{ + if ( mpList ) + for ( sal_uInt32 n=0; nCount(); n++ ) + mpList->GetObject(n)->ConfigurationChanged(this); +} + +Options::Options() +{ +} + +Options::~Options() +{ +} + +void Options::ConfigurationChanged( utl::ConfigurationBroadcaster* ) +{ + NotifyListeners(); +} + diff --git a/unotools/source/config/optionsdlg.cxx b/unotools/source/config/optionsdlg.cxx new file mode 100644 index 000000000000..5ac76af8efd7 --- /dev/null +++ b/unotools/source/config/optionsdlg.cxx @@ -0,0 +1,293 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: optionsdlg.cxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "itemholder1.hxx" + +using namespace utl; +using namespace rtl; +using namespace com::sun::star::beans ; +using namespace com::sun::star::uno; + +#define CFG_FILENAME OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.OptionsDialog" ) ) +#define ROOT_NODE OUString( RTL_CONSTASCII_USTRINGPARAM( "OptionsDialogGroups" ) ) +#define PAGES_NODE OUString( RTL_CONSTASCII_USTRINGPARAM( "Pages" ) ) +#define OPTIONS_NODE OUString( RTL_CONSTASCII_USTRINGPARAM( "Options" ) ) +#define PROPERTY_HIDE OUString( RTL_CONSTASCII_USTRINGPARAM( "Hide" ) ) + +static SvtOptionsDlgOptions_Impl* pOptions = NULL; +static sal_Int32 nRefCount = 0; + +class SvtOptionsDlgOptions_Impl : public utl::ConfigItem +{ +private: + struct OUStringHashCode + { + size_t operator()( const ::rtl::OUString& sString ) const + { + return sString.hashCode(); + } + }; + + typedef std::hash_map< OUString, sal_Bool, OUStringHashCode, ::std::equal_to< OUString > > OptionNodeList; + + OUString m_sPathDelimiter; + OptionNodeList m_aOptionNodeList; + + enum NodeType{ NT_Group, NT_Page, NT_Option }; + void ReadNode( const OUString& _rNode, NodeType _eType ); + sal_Bool IsHidden( const OUString& _rPath ) const; + +public: + SvtOptionsDlgOptions_Impl(); + + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); + virtual void Commit(); + + static ::osl::Mutex & getInitMutex(); + + sal_Bool IsGroupHidden ( const OUString& _rGroup ) const; + sal_Bool IsPageHidden ( const OUString& _rPage, + const OUString& _rGroup ) const; + sal_Bool IsOptionHidden ( const OUString& _rOption, + const OUString& _rPage, + const OUString& _rGroup ) const; +}; + +::osl::Mutex & SvtOptionsDlgOptions_Impl::getInitMutex() +{ + static ::osl::Mutex *pMutex = 0; + + if( ! pMutex ) + { + ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() ); + if( ! pMutex ) + { + static ::osl::Mutex mutex; + pMutex = &mutex; + } + } + return *pMutex; +} + +// ----------------------------------------------------------------------- + +SvtOptionsDlgOptions_Impl::SvtOptionsDlgOptions_Impl() + : ConfigItem( OUString( CFG_FILENAME ) ), + + m_sPathDelimiter( RTL_CONSTASCII_USTRINGPARAM( "/" ) ), + m_aOptionNodeList( OptionNodeList() ) + +{ + OUString sRootNode( ROOT_NODE ); + Sequence< OUString > aNodeSeq = GetNodeNames( sRootNode ); + OUString sNode( sRootNode + m_sPathDelimiter ); + sal_uInt32 nCount = aNodeSeq.getLength(); + for ( sal_uInt32 n = 0; n < nCount; n++ ) + { + OUString sSubNode( sNode + aNodeSeq[n] ); + ReadNode( sSubNode, NT_Group ); + } +} + +// ----------------------------------------------------------------------- + +void SvtOptionsDlgOptions_Impl::Commit() +{ + // nothing to commit +} + +// ----------------------------------------------------------------------- + +void SvtOptionsDlgOptions_Impl::Notify( const Sequence< rtl::OUString >& ) +{ + // nothing to notify +} + +void SvtOptionsDlgOptions_Impl::ReadNode( const OUString& _rNode, NodeType _eType ) +{ + OUString sNode( _rNode + m_sPathDelimiter ); + OUString sSet; + sal_Int32 nLen = 0; + switch ( _eType ) + { + case NT_Group : + { + sSet = PAGES_NODE; + nLen = 2; + break; + } + + case NT_Page : + { + sSet = OPTIONS_NODE; + nLen = 2; + break; + } + + case NT_Option : + { + nLen = 1; + break; + } + } + + Sequence< OUString > lResult( nLen ); + lResult[0] = OUString( sNode + PROPERTY_HIDE ); + if ( _eType != NT_Option ) + lResult[1] = OUString( sNode + sSet ); + + Sequence< Any > aValues; + aValues = GetProperties( lResult ); + sal_Bool bHide = sal_False; + if ( aValues[0] >>= bHide ) + m_aOptionNodeList.insert( OptionNodeList::value_type( sNode, bHide ) ); + + if ( _eType != NT_Option ) + { + OUString sNodes( sNode + sSet ); + Sequence< OUString > aNodes = GetNodeNames( sNodes ); + if ( aNodes.getLength() > 0 ) + { + for ( sal_uInt32 n = 0; n < (sal_uInt32)aNodes.getLength(); ++n ) + { + OUString sSubNodeName( sNodes + m_sPathDelimiter + aNodes[n] ); + ReadNode( sSubNodeName, _eType == NT_Group ? NT_Page : NT_Option ); + } + } + } +} + +// ----------------------------------------------------------------------- + +OUString getGroupPath( const OUString& _rGroup ) +{ + return OUString( ROOT_NODE + OUString('/') + _rGroup + OUString('/') ); +} +OUString getPagePath( const OUString& _rPage ) +{ + return OUString( PAGES_NODE + OUString('/') + _rPage + OUString('/') ); +} +OUString getOptionPath( const OUString& _rOption ) +{ + return OUString( OPTIONS_NODE + OUString('/') + _rOption + OUString('/') ); +} + +// ----------------------------------------------------------------------- + +sal_Bool SvtOptionsDlgOptions_Impl::IsHidden( const OUString& _rPath ) const +{ + sal_Bool bRet = sal_False; + OptionNodeList::const_iterator pIter = m_aOptionNodeList.find( _rPath ); + if ( pIter != m_aOptionNodeList.end() ) + bRet = pIter->second; + return bRet; +} + +// ----------------------------------------------------------------------- + +sal_Bool SvtOptionsDlgOptions_Impl::IsGroupHidden( const OUString& _rGroup ) const +{ + return IsHidden( getGroupPath( _rGroup ) ); +} + +// ----------------------------------------------------------------------- + +sal_Bool SvtOptionsDlgOptions_Impl::IsPageHidden( const OUString& _rPage, const OUString& _rGroup ) const +{ + return IsHidden( getGroupPath( _rGroup ) + getPagePath( _rPage ) ); +} + +// ----------------------------------------------------------------------- + +sal_Bool SvtOptionsDlgOptions_Impl::IsOptionHidden( + const OUString& _rOption, const OUString& _rPage, const OUString& _rGroup ) const +{ + return IsHidden( getGroupPath( _rGroup ) + getPagePath( _rPage ) + getOptionPath( _rOption ) ); +} + +// ----------------------------------------------------------------------- + +SvtOptionsDialogOptions::SvtOptionsDialogOptions() +{ + // Global access, must be guarded (multithreading) + ::osl::MutexGuard aGuard( SvtOptionsDlgOptions_Impl::getInitMutex() ); + ++nRefCount; + if ( !pOptions ) + { + pOptions = new SvtOptionsDlgOptions_Impl; + + ItemHolder1::holdConfigItem( E_OPTIONSDLGOPTIONS ); + } + m_pImp = pOptions; +} + +// ----------------------------------------------------------------------- + +SvtOptionsDialogOptions::~SvtOptionsDialogOptions() +{ + // Global access, must be guarded (multithreading) + ::osl::MutexGuard aGuard( SvtOptionsDlgOptions_Impl::getInitMutex() ); + if ( !--nRefCount ) + { + if ( pOptions->IsModified() ) + pOptions->Commit(); + DELETEZ( pOptions ); + } +} + +sal_Bool SvtOptionsDialogOptions::IsGroupHidden( const String& _rGroup ) const +{ + return m_pImp->IsGroupHidden( _rGroup ); +} + +sal_Bool SvtOptionsDialogOptions::IsPageHidden( const String& _rPage, const String& _rGroup ) const +{ + return m_pImp->IsPageHidden( _rPage, _rGroup ); +} + +sal_Bool SvtOptionsDialogOptions::IsOptionHidden( + const String& _rOption, const String& _rPage, const String& _rGroup ) const +{ + return m_pImp->IsOptionHidden( _rOption, _rPage, _rGroup ); +} + diff --git a/unotools/source/config/optionsdrawinglayer.cxx b/unotools/source/config/optionsdrawinglayer.cxx new file mode 100644 index 000000000000..7bfefdcbef09 --- /dev/null +++ b/unotools/source/config/optionsdrawinglayer.cxx @@ -0,0 +1,1708 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: optionsdrawinglayer.cxx,v $ + * $Revision: 1.12 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifdef _MSC_VER +#pragma hdrstop +#endif + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include +#include +#include +#include +#include +#include +#include +#include + +//_________________________________________________________________________________________________________________ +// namespaces +//_________________________________________________________________________________________________________________ + +using namespace ::utl ; +using namespace ::rtl ; +using namespace ::osl ; +using namespace ::com::sun::star::uno ; + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +#define ROOTNODE_START OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Drawinglayer" )) +#define DEFAULT_OVERLAYBUFFER sal_True +#define DEFAULT_PAINTBUFFER sal_True +#define DEFAULT_STRIPE_COLOR_A 0 +#define DEFAULT_STRIPE_COLOR_B 16581375 +#define DEFAULT_STRIPE_LENGTH 4 + +// #i73602# +// #i74769#, #i75172# : Change default for Calc and Writer to True +#define DEFAULT_OVERLAYBUFFER_CALC sal_True +#define DEFAULT_OVERLAYBUFFER_WRITER sal_True +#define DEFAULT_OVERLAYBUFFER_DRAWIMPRESS sal_True + +// #i74769#, #i75172# +#define DEFAULT_PAINTBUFFER_CALC sal_True +#define DEFAULT_PAINTBUFFER_WRITER sal_True +#define DEFAULT_PAINTBUFFER_DRAWIMPRESS sal_True + +// #i4219# +#define DEFAULT_MAXIMUMPAPERWIDTH 300 +#define DEFAULT_MAXIMUMPAPERHEIGHT 300 +#define DEFAULT_MAXIMUMPAPERLEFTMARGIN 9999 +#define DEFAULT_MAXIMUMPAPERRIGHTMARGIN 9999 +#define DEFAULT_MAXIMUMPAPERTOPMARGIN 9999 +#define DEFAULT_MAXIMUMPAPERBOTTOMMARGIN 9999 + +// primitives +#define DEFAULT_ANTIALIASING sal_True +#define DEFAULT_SNAPHORVERLINESTODISCRETE sal_True +#define DEFAULT_SOLIDDRAGCREATE sal_True +#define DEFAULT_RENDERDECORATEDTEXTDIRECT sal_True +#define DEFAULT_RENDERSIMPLETEXTDIRECT sal_True +#define DEFAULT_QUADRATIC3DRENDERLIMIT 1000000 +#define DEFAULT_QUADRATICFORMCONTROLRENDERLIMIT 45000 + +// #i97672# selection settings +#define DEFAULT_TRANSPARENTSELECTION sal_True +#define DEFAULT_TRANSPARENTSELECTIONPERCENT 75 +#define DEFAULT_SELECTIONMAXIMUMLUMINANCEPERCENT 70 + +#define PROPERTYNAME_OVERLAYBUFFER OUString(RTL_CONSTASCII_USTRINGPARAM("OverlayBuffer" )) +#define PROPERTYNAME_PAINTBUFFER OUString(RTL_CONSTASCII_USTRINGPARAM("PaintBuffer" )) +#define PROPERTYNAME_STRIPE_COLOR_A OUString(RTL_CONSTASCII_USTRINGPARAM("StripeColorA" )) +#define PROPERTYNAME_STRIPE_COLOR_B OUString(RTL_CONSTASCII_USTRINGPARAM("StripeColorB" )) +#define PROPERTYNAME_STRIPE_LENGTH OUString(RTL_CONSTASCII_USTRINGPARAM("StripeLength" )) + +// #i73602# +#define PROPERTYNAME_OVERLAYBUFFER_CALC OUString(RTL_CONSTASCII_USTRINGPARAM("OverlayBuffer_Calc")) +#define PROPERTYNAME_OVERLAYBUFFER_WRITER OUString(RTL_CONSTASCII_USTRINGPARAM("OverlayBuffer_Writer")) +#define PROPERTYNAME_OVERLAYBUFFER_DRAWIMPRESS OUString(RTL_CONSTASCII_USTRINGPARAM("OverlayBuffer_DrawImpress")) + +// #i74769#, #i75172# +#define PROPERTYNAME_PAINTBUFFER_CALC OUString(RTL_CONSTASCII_USTRINGPARAM("PaintBuffer_Calc")) +#define PROPERTYNAME_PAINTBUFFER_WRITER OUString(RTL_CONSTASCII_USTRINGPARAM("PaintBuffer_Writer")) +#define PROPERTYNAME_PAINTBUFFER_DRAWIMPRESS OUString(RTL_CONSTASCII_USTRINGPARAM("PaintBuffer_DrawImpress")) + +// #i4219# +#define PROPERTYNAME_MAXIMUMPAPERWIDTH OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperWidth")) +#define PROPERTYNAME_MAXIMUMPAPERHEIGHT OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperHeight")) +#define PROPERTYNAME_MAXIMUMPAPERLEFTMARGIN OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperLeftMargin")) +#define PROPERTYNAME_MAXIMUMPAPERRIGHTMARGIN OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperRightMargin")) +#define PROPERTYNAME_MAXIMUMPAPERTOPMARGIN OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperTopMargin")) +#define PROPERTYNAME_MAXIMUMPAPERBOTTOMMARGIN OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperBottomMargin")) + +// primitives +#define PROPERTYNAME_ANTIALIASING OUString(RTL_CONSTASCII_USTRINGPARAM("AntiAliasing")) +#define PROPERTYNAME_SNAPHORVERLINESTODISCRETE OUString(RTL_CONSTASCII_USTRINGPARAM("SnapHorVerLinesToDiscrete")) +#define PROPERTYNAME_SOLIDDRAGCREATE OUString(RTL_CONSTASCII_USTRINGPARAM("SolidDragCreate")) +#define PROPERTYNAME_RENDERDECORATEDTEXTDIRECT OUString(RTL_CONSTASCII_USTRINGPARAM("RenderDecoratedTextDirect")) +#define PROPERTYNAME_RENDERSIMPLETEXTDIRECT OUString(RTL_CONSTASCII_USTRINGPARAM("RenderSimpleTextDirect")) +#define PROPERTYNAME_QUADRATIC3DRENDERLIMIT OUString(RTL_CONSTASCII_USTRINGPARAM("Quadratic3DRenderLimit")) +#define PROPERTYNAME_QUADRATICFORMCONTROLRENDERLIMIT OUString(RTL_CONSTASCII_USTRINGPARAM("QuadraticFormControlRenderLimit")) + +// #i97672# selection settings +#define PROPERTYNAME_TRANSPARENTSELECTION OUString(RTL_CONSTASCII_USTRINGPARAM("TransparentSelection")) +#define PROPERTYNAME_TRANSPARENTSELECTIONPERCENT OUString(RTL_CONSTASCII_USTRINGPARAM("TransparentSelectionPercent")) +#define PROPERTYNAME_SELECTIONMAXIMUMLUMINANCEPERCENT OUString(RTL_CONSTASCII_USTRINGPARAM("SelectionMaximumLuminancePercent")) + +#define PROPERTYHANDLE_OVERLAYBUFFER 0 +#define PROPERTYHANDLE_PAINTBUFFER 1 +#define PROPERTYHANDLE_STRIPE_COLOR_A 2 +#define PROPERTYHANDLE_STRIPE_COLOR_B 3 +#define PROPERTYHANDLE_STRIPE_LENGTH 4 + +// #i73602# +#define PROPERTYHANDLE_OVERLAYBUFFER_CALC 5 +#define PROPERTYHANDLE_OVERLAYBUFFER_WRITER 6 +#define PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS 7 + +// #i74769#, #i75172# +#define PROPERTYHANDLE_PAINTBUFFER_CALC 8 +#define PROPERTYHANDLE_PAINTBUFFER_WRITER 9 +#define PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS 10 + +// #i4219# +#define PROPERTYHANDLE_MAXIMUMPAPERWIDTH 11 +#define PROPERTYHANDLE_MAXIMUMPAPERHEIGHT 12 +#define PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN 13 +#define PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN 14 +#define PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN 15 +#define PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN 16 + +// primitives +#define PROPERTYHANDLE_ANTIALIASING 17 +#define PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE 18 +#define PROPERTYHANDLE_SOLIDDRAGCREATE 19 +#define PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT 20 +#define PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT 21 +#define PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT 22 +#define PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT 23 + +// #i97672# selection settings +#define PROPERTYHANDLE_TRANSPARENTSELECTION 24 +#define PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT 25 +#define PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT 26 + +#define PROPERTYCOUNT 27 + +class SvtOptionsDrawinglayer_Impl : public ConfigItem +{ +public: + +//--------------------------------------------------------------------------------------------------------- +// constructor / destructor +//--------------------------------------------------------------------------------------------------------- + + SvtOptionsDrawinglayer_Impl(); + ~SvtOptionsDrawinglayer_Impl(); + +//--------------------------------------------------------------------------------------------------------- +// overloaded methods of baseclass +//--------------------------------------------------------------------------------------------------------- + + virtual void Commit(); + +//--------------------------------------------------------------------------------------------------------- +// public interface +//--------------------------------------------------------------------------------------------------------- + + sal_Bool IsOverlayBuffer() const; + sal_Bool IsPaintBuffer() const; + Color GetStripeColorA() const; + Color GetStripeColorB() const; + sal_uInt16 GetStripeLength() const; + + // #i73602# + sal_Bool IsOverlayBuffer_Calc() const; + sal_Bool IsOverlayBuffer_Writer() const; + sal_Bool IsOverlayBuffer_DrawImpress() const; + + // #i74769#, #i75172# + sal_Bool IsPaintBuffer_Calc() const; + sal_Bool IsPaintBuffer_Writer() const; + sal_Bool IsPaintBuffer_DrawImpress() const; + + void SetOverlayBuffer( sal_Bool bState ); + void SetPaintBuffer( sal_Bool bState ); + void SetStripeColorA( Color aColor ); + void SetStripeColorB( Color aColor ); + void SetStripeLength( sal_uInt16 nLength ); + + // #i73602# + void SetOverlayBuffer_Calc( sal_Bool bState ); + void SetOverlayBuffer_Writer( sal_Bool bState ); + void SetOverlayBuffer_DrawImpress( sal_Bool bState ); + + // #i74769#, #i75172# + void SetPaintBuffer_Calc( sal_Bool bState ); + void SetPaintBuffer_Writer( sal_Bool bState ); + void SetPaintBuffer_DrawImpress( sal_Bool bState ); + + // #i4219# + sal_uInt32 GetMaximumPaperWidth() const; + sal_uInt32 GetMaximumPaperHeight() const; + sal_uInt32 GetMaximumPaperLeftMargin() const; + sal_uInt32 GetMaximumPaperRightMargin() const; + sal_uInt32 GetMaximumPaperTopMargin() const; + sal_uInt32 GetMaximumPaperBottomMargin() const; + + void SetMaximumPaperWidth(sal_uInt32 nNew); + void SetMaximumPaperHeight(sal_uInt32 nNew); + void SetMaximumPaperLeftMargin(sal_uInt32 nNew); + void SetMaximumPaperRightMargin(sal_uInt32 nNew); + void SetMaximumPaperTopMargin(sal_uInt32 nNew); + void SetMaximumPaperBottomMargin(sal_uInt32 nNew); + + // helper + sal_Bool IsAAPossibleOnThisSystem() const; + + // primitives + sal_Bool IsAntiAliasing() const; + sal_Bool IsSnapHorVerLinesToDiscrete() const; + sal_Bool IsSolidDragCreate() const; + sal_Bool IsRenderDecoratedTextDirect() const; + sal_Bool IsRenderSimpleTextDirect() const; + sal_uInt32 GetQuadratic3DRenderLimit() const; + sal_uInt32 GetQuadraticFormControlRenderLimit() const; + + void SetAntiAliasing( sal_Bool bState ); + void SetSnapHorVerLinesToDiscrete( sal_Bool bState ); + void SetSolidDragCreate( sal_Bool bState ); + void SetRenderDecoratedTextDirect( sal_Bool bState ); + void SetRenderSimpleTextDirect( sal_Bool bState ); + void SetQuadratic3DRenderLimit(sal_uInt32 nNew); + void SetQuadraticFormControlRenderLimit(sal_uInt32 nNew); + + // #i97672# selection settings + sal_Bool IsTransparentSelection() const; + sal_uInt16 GetTransparentSelectionPercent() const; + sal_uInt16 GetSelectionMaximumLuminancePercent() const; + + void SetTransparentSelection( sal_Bool bState ); + void SetTransparentSelectionPercent( sal_uInt16 nPercent ); + void SetSelectionMaximumLuminancePercent( sal_uInt16 nPercent ); + +//------------------------------------------------------------------------------------------------------------- +// private methods +//------------------------------------------------------------------------------------------------------------- + +private: + + static Sequence< OUString > impl_GetPropertyNames(); + +//------------------------------------------------------------------------------------------------------------- +// private member +//------------------------------------------------------------------------------------------------------------- + +private: + + sal_Bool m_bOverlayBuffer; + sal_Bool m_bPaintBuffer; + Color m_bStripeColorA; + Color m_bStripeColorB; + sal_uInt16 m_nStripeLength; + + // #i73602# + sal_Bool m_bOverlayBuffer_Calc; + sal_Bool m_bOverlayBuffer_Writer; + sal_Bool m_bOverlayBuffer_DrawImpress; + + // #i74769#, #i75172# + sal_Bool m_bPaintBuffer_Calc; + sal_Bool m_bPaintBuffer_Writer; + sal_Bool m_bPaintBuffer_DrawImpress; + + // #i4219# + sal_uInt32 m_nMaximumPaperWidth; + sal_uInt32 m_nMaximumPaperHeight; + sal_uInt32 m_nMaximumPaperLeftMargin; + sal_uInt32 m_nMaximumPaperRightMargin; + sal_uInt32 m_nMaximumPaperTopMargin; + sal_uInt32 m_nMaximumPaperBottomMargin; + + // primitives + sal_Bool m_bAntiAliasing; + sal_Bool m_bSnapHorVerLinesToDiscrete; + sal_Bool m_bSolidDragCreate; + sal_Bool m_bRenderDecoratedTextDirect; + sal_Bool m_bRenderSimpleTextDirect; + sal_uInt32 m_nQuadratic3DRenderLimit; + sal_uInt32 m_nQuadraticFormControlRenderLimit; + + // #i97672# selection settings + sal_uInt16 m_nTransparentSelectionPercent; + sal_uInt16 m_nSelectionMaximumLuminancePercent; + sal_Bool m_bTransparentSelection; + + // local values + bool m_bAllowAA : 1; + bool m_bAllowAAChecked : 1; +}; + +//_________________________________________________________________________________________________________________ +// definitions +//_________________________________________________________________________________________________________________ + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl() : + ConfigItem( ROOTNODE_START ), + m_bOverlayBuffer( DEFAULT_OVERLAYBUFFER ), + m_bPaintBuffer( DEFAULT_PAINTBUFFER ), + m_bStripeColorA(Color(DEFAULT_STRIPE_COLOR_A)), + m_bStripeColorB(Color(DEFAULT_STRIPE_COLOR_B)), + m_nStripeLength(DEFAULT_STRIPE_LENGTH), + + // #i73602# + m_bOverlayBuffer_Calc( DEFAULT_OVERLAYBUFFER_CALC ), + m_bOverlayBuffer_Writer( DEFAULT_OVERLAYBUFFER_WRITER ), + m_bOverlayBuffer_DrawImpress( DEFAULT_OVERLAYBUFFER_DRAWIMPRESS ), + + // #i74769#, #i75172# + m_bPaintBuffer_Calc( DEFAULT_PAINTBUFFER_CALC ), + m_bPaintBuffer_Writer( DEFAULT_PAINTBUFFER_WRITER ), + m_bPaintBuffer_DrawImpress( DEFAULT_PAINTBUFFER_DRAWIMPRESS ), + + // #i4219# + m_nMaximumPaperWidth(DEFAULT_MAXIMUMPAPERWIDTH), + m_nMaximumPaperHeight(DEFAULT_MAXIMUMPAPERHEIGHT), + m_nMaximumPaperLeftMargin(DEFAULT_MAXIMUMPAPERLEFTMARGIN), + m_nMaximumPaperRightMargin(DEFAULT_MAXIMUMPAPERRIGHTMARGIN), + m_nMaximumPaperTopMargin(DEFAULT_MAXIMUMPAPERTOPMARGIN), + m_nMaximumPaperBottomMargin(DEFAULT_MAXIMUMPAPERBOTTOMMARGIN), + + // primitives + m_bAntiAliasing(DEFAULT_ANTIALIASING), + m_bSnapHorVerLinesToDiscrete(DEFAULT_SNAPHORVERLINESTODISCRETE), + m_bSolidDragCreate(DEFAULT_SOLIDDRAGCREATE), + m_bRenderDecoratedTextDirect(DEFAULT_RENDERDECORATEDTEXTDIRECT), + m_bRenderSimpleTextDirect(DEFAULT_RENDERSIMPLETEXTDIRECT), + m_nQuadratic3DRenderLimit(DEFAULT_QUADRATIC3DRENDERLIMIT), + m_nQuadraticFormControlRenderLimit(DEFAULT_QUADRATICFORMCONTROLRENDERLIMIT), + + // #i97672# selection settings + m_nTransparentSelectionPercent(DEFAULT_TRANSPARENTSELECTIONPERCENT), + m_nSelectionMaximumLuminancePercent(DEFAULT_SELECTIONMAXIMUMLUMINANCEPERCENT), + m_bTransparentSelection(DEFAULT_TRANSPARENTSELECTION), + + // local values + m_bAllowAA(true), + m_bAllowAAChecked(false) +{ + Sequence< OUString > seqNames( impl_GetPropertyNames() ); + Sequence< Any > seqValues = GetProperties( seqNames ) ; + + DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nI miss some values of configuration keys!\n" ); + + // Copy values from list in right order to ouer internal member. + sal_Int32 nPropertyCount = seqValues.getLength(); + sal_Int32 nProperty = 0; + + for( nProperty=0; nProperty>= m_bOverlayBuffer; + } + break; + + case PROPERTYHANDLE_PAINTBUFFER: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer\"?" ); + seqValues[nProperty] >>= m_bPaintBuffer; + } + break; + + case PROPERTYHANDLE_STRIPE_COLOR_A: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeColorA\"?" ); + sal_Int32 nValue = 0; + seqValues[nProperty] >>= nValue; + m_bStripeColorA = nValue; + } + break; + + case PROPERTYHANDLE_STRIPE_COLOR_B: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeColorB\"?" ); + sal_Int32 nValue = 0; + seqValues[nProperty] >>= nValue; + m_bStripeColorB = nValue; + } + break; + + case PROPERTYHANDLE_STRIPE_LENGTH: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeLength\"?" ); + seqValues[nProperty] >>= m_nStripeLength; + } + break; + + // #i73602# + case PROPERTYHANDLE_OVERLAYBUFFER_CALC: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer_Calc\"?" ); + seqValues[nProperty] >>= m_bOverlayBuffer_Calc; + } + break; + + case PROPERTYHANDLE_OVERLAYBUFFER_WRITER: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer_Writer\"?" ); + seqValues[nProperty] >>= m_bOverlayBuffer_Writer; + } + break; + + case PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer_DrawImpress\"?" ); + seqValues[nProperty] >>= m_bOverlayBuffer_DrawImpress; + } + break; + + // #i74769#, #i75172# + case PROPERTYHANDLE_PAINTBUFFER_CALC: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer_Calc\"?" ); + seqValues[nProperty] >>= m_bPaintBuffer_Calc; + } + break; + + case PROPERTYHANDLE_PAINTBUFFER_WRITER: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer_Writer\"?" ); + seqValues[nProperty] >>= m_bPaintBuffer_Writer; + } + break; + + case PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer_DrawImpress\"?" ); + seqValues[nProperty] >>= m_bPaintBuffer_DrawImpress; + } + break; + + // #i4219# + case PROPERTYHANDLE_MAXIMUMPAPERWIDTH: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperWidth\"?" ); + seqValues[nProperty] >>= m_nMaximumPaperWidth; + } + break; + + case PROPERTYHANDLE_MAXIMUMPAPERHEIGHT: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperHeight\"?" ); + seqValues[nProperty] >>= m_nMaximumPaperHeight; + } + break; + + case PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperLeftMargin\"?" ); + seqValues[nProperty] >>= m_nMaximumPaperLeftMargin; + } + break; + + case PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperRightMargin\"?" ); + seqValues[nProperty] >>= m_nMaximumPaperRightMargin; + } + break; + + case PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperTopMargin\"?" ); + seqValues[nProperty] >>= m_nMaximumPaperTopMargin; + } + break; + + case PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperBottomMargin\"?" ); + seqValues[nProperty] >>= m_nMaximumPaperBottomMargin; + } + break; + + // primitives + case PROPERTYHANDLE_ANTIALIASING: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\AntiAliasing\"?" ); + seqValues[nProperty] >>= m_bAntiAliasing; + } + break; + + // primitives + case PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SnapHorVerLinesToDiscrete\"?" ); + seqValues[nProperty] >>= m_bSnapHorVerLinesToDiscrete; + } + break; + + case PROPERTYHANDLE_SOLIDDRAGCREATE: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SolidDragCreate\"?" ); + seqValues[nProperty] >>= m_bSolidDragCreate; + } + break; + + case PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\RenderDecoratedTextDirect\"?" ); + seqValues[nProperty] >>= m_bRenderDecoratedTextDirect; + } + break; + + case PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\RenderSimpleTextDirect\"?" ); + seqValues[nProperty] >>= m_bRenderSimpleTextDirect; + } + break; + + case PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\Quadratic3DRenderLimit\"?" ); + seqValues[nProperty] >>= m_nQuadratic3DRenderLimit; + } + break; + + case PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\QuadraticFormControlRenderLimit\"?" ); + seqValues[nProperty] >>= m_nQuadraticFormControlRenderLimit; + } + break; + + // #i97672# selection settings + case PROPERTYHANDLE_TRANSPARENTSELECTION: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\TransparentSelection\"?" ); + seqValues[nProperty] >>= m_bTransparentSelection; + } + break; + + case PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\TransparentSelectionPercent\"?" ); + seqValues[nProperty] >>= m_nTransparentSelectionPercent; + } + + case PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SelectionMaximumLuminancePercent\"?" ); + seqValues[nProperty] >>= m_nSelectionMaximumLuminancePercent; + } + break; + } + } +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtOptionsDrawinglayer_Impl::~SvtOptionsDrawinglayer_Impl() +{ + if( IsModified() ) + Commit(); +} + +//***************************************************************************************************************** +// Commit +//***************************************************************************************************************** +void SvtOptionsDrawinglayer_Impl::Commit() +{ + Sequence< OUString > aSeqNames( impl_GetPropertyNames() ); + Sequence< Any > aSeqValues( aSeqNames.getLength() ); + + for( sal_Int32 nProperty = 0, nCount = aSeqNames.getLength(); nProperty < nCount; ++nProperty ) + { + switch( nProperty ) + { + case PROPERTYHANDLE_OVERLAYBUFFER: + aSeqValues[nProperty] <<= m_bOverlayBuffer; + break; + + case PROPERTYHANDLE_PAINTBUFFER: + aSeqValues[nProperty] <<= m_bPaintBuffer; + break; + + case PROPERTYHANDLE_STRIPE_COLOR_A: + aSeqValues[nProperty] <<= m_bStripeColorA.GetColor(); + break; + + case PROPERTYHANDLE_STRIPE_COLOR_B: + aSeqValues[nProperty] <<= m_bStripeColorB.GetColor(); + break; + + case PROPERTYHANDLE_STRIPE_LENGTH: + aSeqValues[nProperty] <<= m_nStripeLength; + break; + + // #i73602# + case PROPERTYHANDLE_OVERLAYBUFFER_CALC: + aSeqValues[nProperty] <<= m_bOverlayBuffer_Calc; + break; + + case PROPERTYHANDLE_OVERLAYBUFFER_WRITER: + aSeqValues[nProperty] <<= m_bOverlayBuffer_Writer; + break; + + case PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS: + aSeqValues[nProperty] <<= m_bOverlayBuffer_DrawImpress; + break; + + // #i74769#, #i75172# + case PROPERTYHANDLE_PAINTBUFFER_CALC: + aSeqValues[nProperty] <<= m_bPaintBuffer_Calc; + break; + + case PROPERTYHANDLE_PAINTBUFFER_WRITER: + aSeqValues[nProperty] <<= m_bPaintBuffer_Writer; + break; + + case PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS: + aSeqValues[nProperty] <<= m_bPaintBuffer_DrawImpress; + break; + + // #i4219# + case PROPERTYHANDLE_MAXIMUMPAPERWIDTH: + aSeqValues[nProperty] <<= m_nMaximumPaperWidth; + break; + + case PROPERTYHANDLE_MAXIMUMPAPERHEIGHT: + aSeqValues[nProperty] <<= m_nMaximumPaperHeight; + break; + + case PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN: + aSeqValues[nProperty] <<= m_nMaximumPaperLeftMargin; + break; + + case PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN: + aSeqValues[nProperty] <<= m_nMaximumPaperRightMargin; + break; + + case PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN: + aSeqValues[nProperty] <<= m_nMaximumPaperTopMargin; + break; + + case PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN: + aSeqValues[nProperty] <<= m_nMaximumPaperBottomMargin; + break; + + // primitives + case PROPERTYHANDLE_ANTIALIASING: + aSeqValues[nProperty] <<= m_bAntiAliasing; + break; + + case PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE: + aSeqValues[nProperty] <<= m_bSnapHorVerLinesToDiscrete; + break; + + case PROPERTYHANDLE_SOLIDDRAGCREATE: + aSeqValues[nProperty] <<= m_bSolidDragCreate; + break; + + case PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT: + aSeqValues[nProperty] <<= m_bRenderDecoratedTextDirect; + break; + + case PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT: + aSeqValues[nProperty] <<= m_bRenderSimpleTextDirect; + break; + + case PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT: + aSeqValues[nProperty] <<= m_nQuadratic3DRenderLimit; + break; + + case PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT: + aSeqValues[nProperty] <<= m_nQuadraticFormControlRenderLimit; + break; + + // #i97672# selection settings + case PROPERTYHANDLE_TRANSPARENTSELECTION: + aSeqValues[nProperty] <<= m_bTransparentSelection; + break; + + case PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT: + aSeqValues[nProperty] <<= m_nTransparentSelectionPercent; + break; + + case PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT: + aSeqValues[nProperty] <<= m_nSelectionMaximumLuminancePercent; + break; + } + } + + PutProperties( aSeqNames, aSeqValues ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtOptionsDrawinglayer_Impl::IsOverlayBuffer() const +{ + return m_bOverlayBuffer; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtOptionsDrawinglayer_Impl::IsPaintBuffer() const +{ + return m_bPaintBuffer; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +Color SvtOptionsDrawinglayer_Impl::GetStripeColorA() const +{ + return m_bStripeColorA; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +Color SvtOptionsDrawinglayer_Impl::GetStripeColorB() const +{ + return m_bStripeColorB; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_uInt16 SvtOptionsDrawinglayer_Impl::GetStripeLength() const +{ + return m_nStripeLength; +} + +// #i73602# +sal_Bool SvtOptionsDrawinglayer_Impl::IsOverlayBuffer_Calc() const +{ + return m_bOverlayBuffer_Calc; +} + +sal_Bool SvtOptionsDrawinglayer_Impl::IsOverlayBuffer_Writer() const +{ + return m_bOverlayBuffer_Writer; +} + +sal_Bool SvtOptionsDrawinglayer_Impl::IsOverlayBuffer_DrawImpress() const +{ + return m_bOverlayBuffer_DrawImpress; +} + +// #i74769#, #i75172# +sal_Bool SvtOptionsDrawinglayer_Impl::IsPaintBuffer_Calc() const +{ + return m_bPaintBuffer_Calc; +} + +sal_Bool SvtOptionsDrawinglayer_Impl::IsPaintBuffer_Writer() const +{ + return m_bPaintBuffer_Writer; +} + +sal_Bool SvtOptionsDrawinglayer_Impl::IsPaintBuffer_DrawImpress() const +{ + return m_bPaintBuffer_DrawImpress; +} + +// #i4219# +sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperWidth() const +{ + return m_nMaximumPaperWidth; +} + +sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperHeight() const +{ + return m_nMaximumPaperHeight; +} + +sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperLeftMargin() const +{ + return m_nMaximumPaperLeftMargin; +} + +sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperRightMargin() const +{ + return m_nMaximumPaperRightMargin; +} + +sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperTopMargin() const +{ + return m_nMaximumPaperTopMargin; +} + +sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperBottomMargin() const +{ + return m_nMaximumPaperBottomMargin; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtOptionsDrawinglayer_Impl::SetOverlayBuffer( sal_Bool bState ) +{ + if(m_bOverlayBuffer != bState) + { + m_bOverlayBuffer = bState; + SetModified(); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtOptionsDrawinglayer_Impl::SetPaintBuffer( sal_Bool bState ) +{ + if(m_bPaintBuffer != bState) + { + m_bPaintBuffer = bState; + SetModified(); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtOptionsDrawinglayer_Impl::SetStripeColorA( Color aColor ) +{ + if(m_bStripeColorA != aColor) + { + m_bStripeColorA = aColor; + SetModified(); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtOptionsDrawinglayer_Impl::SetStripeColorB( Color aColor ) +{ + if(m_bStripeColorB != aColor) + { + m_bStripeColorB = aColor; + SetModified(); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtOptionsDrawinglayer_Impl::SetStripeLength( sal_uInt16 nLength ) +{ + if(m_nStripeLength != nLength) + { + m_nStripeLength = nLength; + SetModified(); + } +} + +// #i73602# +void SvtOptionsDrawinglayer_Impl::SetOverlayBuffer_Calc( sal_Bool bState ) +{ + if(m_bOverlayBuffer_Calc != bState) + { + m_bOverlayBuffer_Calc = bState; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetOverlayBuffer_Writer( sal_Bool bState ) +{ + if(m_bOverlayBuffer_Writer != bState) + { + m_bOverlayBuffer_Writer = bState; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetOverlayBuffer_DrawImpress( sal_Bool bState ) +{ + if(m_bOverlayBuffer_DrawImpress != bState) + { + m_bOverlayBuffer_DrawImpress = bState; + SetModified(); + } +} + +// #i74769#, #i75172# +void SvtOptionsDrawinglayer_Impl::SetPaintBuffer_Calc( sal_Bool bState ) +{ + if(m_bPaintBuffer_Calc != bState) + { + m_bPaintBuffer_Calc = bState; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetPaintBuffer_Writer( sal_Bool bState ) +{ + if(m_bPaintBuffer_Writer != bState) + { + m_bPaintBuffer_Writer = bState; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetPaintBuffer_DrawImpress( sal_Bool bState ) +{ + if(m_bPaintBuffer_DrawImpress != bState) + { + m_bPaintBuffer_DrawImpress = bState; + SetModified(); + } +} + +// #i4219# +void SvtOptionsDrawinglayer_Impl::SetMaximumPaperWidth( sal_uInt32 nNew ) +{ + if(m_nMaximumPaperWidth != nNew) + { + m_nMaximumPaperWidth = nNew; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetMaximumPaperHeight( sal_uInt32 nNew ) +{ + if(m_nMaximumPaperHeight != nNew) + { + m_nMaximumPaperHeight = nNew; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetMaximumPaperLeftMargin( sal_uInt32 nNew ) +{ + if(m_nMaximumPaperLeftMargin != nNew) + { + m_nMaximumPaperLeftMargin = nNew; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetMaximumPaperRightMargin( sal_uInt32 nNew ) +{ + if(m_nMaximumPaperRightMargin != nNew) + { + m_nMaximumPaperRightMargin = nNew; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetMaximumPaperTopMargin( sal_uInt32 nNew ) +{ + if(m_nMaximumPaperTopMargin != nNew) + { + m_nMaximumPaperTopMargin = nNew; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetMaximumPaperBottomMargin( sal_uInt32 nNew ) +{ + if(m_nMaximumPaperBottomMargin != nNew) + { + m_nMaximumPaperBottomMargin = nNew; + SetModified(); + } +} + +// helper +sal_Bool SvtOptionsDrawinglayer_Impl::IsAAPossibleOnThisSystem() const +{ + if(!m_bAllowAAChecked) + { + SvtOptionsDrawinglayer_Impl* pThat = const_cast< SvtOptionsDrawinglayer_Impl* >(this); + pThat->m_bAllowAAChecked = true; + +#ifdef WIN32 + // WIN32 uses GDIPlus with VCL forthe first incarnation; this will be enhanced + // in the future to use canvases and the canvas renderer, thus a AA-abled + // canvas needs to be checked here in the future. + // Currently, just allow AA for WIN32 +#endif + + // check XRenderExtension + if(m_bAllowAA && !Application::GetDefaultDevice()->supportsOperation( OutDevSupport_TransparentRect )) + { + pThat->m_bAllowAA = false; + } + } + + return m_bAllowAA; +} + +// primitives +sal_Bool SvtOptionsDrawinglayer_Impl::IsAntiAliasing() const +{ + return m_bAntiAliasing; +} + +sal_Bool SvtOptionsDrawinglayer_Impl::IsSnapHorVerLinesToDiscrete() const +{ + return m_bSnapHorVerLinesToDiscrete; +} + +sal_Bool SvtOptionsDrawinglayer_Impl::IsSolidDragCreate() const +{ + return m_bSolidDragCreate; +} + +sal_Bool SvtOptionsDrawinglayer_Impl::IsRenderDecoratedTextDirect() const +{ + return m_bRenderDecoratedTextDirect; +} + +sal_Bool SvtOptionsDrawinglayer_Impl::IsRenderSimpleTextDirect() const +{ + return m_bRenderSimpleTextDirect; +} + +sal_uInt32 SvtOptionsDrawinglayer_Impl::GetQuadratic3DRenderLimit() const +{ + return m_nQuadratic3DRenderLimit; +} + +sal_uInt32 SvtOptionsDrawinglayer_Impl::GetQuadraticFormControlRenderLimit() const +{ + return m_nQuadraticFormControlRenderLimit; +} + +void SvtOptionsDrawinglayer_Impl::SetAntiAliasing( sal_Bool bState ) +{ + if(m_bAntiAliasing != bState) + { + m_bAntiAliasing = bState; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetSnapHorVerLinesToDiscrete( sal_Bool bState ) +{ + if(m_bSnapHorVerLinesToDiscrete != bState) + { + m_bSnapHorVerLinesToDiscrete = bState; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetSolidDragCreate( sal_Bool bState ) +{ + if(m_bSolidDragCreate != bState) + { + m_bSolidDragCreate = bState; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetRenderDecoratedTextDirect( sal_Bool bState ) +{ + if(m_bRenderDecoratedTextDirect != bState) + { + m_bRenderDecoratedTextDirect = bState; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetRenderSimpleTextDirect( sal_Bool bState ) +{ + if(m_bRenderSimpleTextDirect != bState) + { + m_bRenderSimpleTextDirect = bState; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetQuadratic3DRenderLimit(sal_uInt32 nNew) +{ + if(m_nQuadratic3DRenderLimit != nNew) + { + m_nQuadratic3DRenderLimit = nNew; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetQuadraticFormControlRenderLimit(sal_uInt32 nNew) +{ + if(m_nQuadraticFormControlRenderLimit != nNew) + { + m_nQuadraticFormControlRenderLimit = nNew; + SetModified(); + } +} + +// #i97672# selection settings +sal_Bool SvtOptionsDrawinglayer_Impl::IsTransparentSelection() const +{ + return m_bTransparentSelection; +} + +void SvtOptionsDrawinglayer_Impl::SetTransparentSelection( sal_Bool bState ) +{ + if(m_bTransparentSelection != bState) + { + m_bTransparentSelection = bState; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetTransparentSelectionPercent( sal_uInt16 nPercent ) +{ + if(m_nTransparentSelectionPercent != nPercent) + { + m_nTransparentSelectionPercent = nPercent; + SetModified(); + } +} + +sal_uInt16 SvtOptionsDrawinglayer_Impl::GetTransparentSelectionPercent() const +{ + return m_nTransparentSelectionPercent; +} + +void SvtOptionsDrawinglayer_Impl::SetSelectionMaximumLuminancePercent( sal_uInt16 nPercent ) +{ + if(m_nSelectionMaximumLuminancePercent != nPercent) + { + m_nSelectionMaximumLuminancePercent = nPercent; + SetModified(); + } +} + +sal_uInt16 SvtOptionsDrawinglayer_Impl::GetSelectionMaximumLuminancePercent() const +{ + return m_nSelectionMaximumLuminancePercent; +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Sequence< OUString > SvtOptionsDrawinglayer_Impl::impl_GetPropertyNames() +{ + // Build static list of configuration key names. + static const OUString pProperties[] = + { + PROPERTYNAME_OVERLAYBUFFER , + PROPERTYNAME_PAINTBUFFER , + PROPERTYNAME_STRIPE_COLOR_A , + PROPERTYNAME_STRIPE_COLOR_B , + PROPERTYNAME_STRIPE_LENGTH , + + // #i73602# + PROPERTYNAME_OVERLAYBUFFER_CALC, + PROPERTYNAME_OVERLAYBUFFER_WRITER, + PROPERTYNAME_OVERLAYBUFFER_DRAWIMPRESS, + + // #i74769#, #i75172# + PROPERTYNAME_PAINTBUFFER_CALC, + PROPERTYNAME_PAINTBUFFER_WRITER, + PROPERTYNAME_PAINTBUFFER_DRAWIMPRESS, + + // #i4219# + PROPERTYNAME_MAXIMUMPAPERWIDTH, + PROPERTYNAME_MAXIMUMPAPERHEIGHT, + PROPERTYNAME_MAXIMUMPAPERLEFTMARGIN, + PROPERTYNAME_MAXIMUMPAPERRIGHTMARGIN, + PROPERTYNAME_MAXIMUMPAPERTOPMARGIN, + PROPERTYNAME_MAXIMUMPAPERBOTTOMMARGIN, + + // primitives + PROPERTYNAME_ANTIALIASING, + PROPERTYNAME_SNAPHORVERLINESTODISCRETE, + PROPERTYNAME_SOLIDDRAGCREATE, + PROPERTYNAME_RENDERDECORATEDTEXTDIRECT, + PROPERTYNAME_RENDERSIMPLETEXTDIRECT, + PROPERTYNAME_QUADRATIC3DRENDERLIMIT, + PROPERTYNAME_QUADRATICFORMCONTROLRENDERLIMIT, + + // #i97672# selection settings + PROPERTYNAME_TRANSPARENTSELECTION, + PROPERTYNAME_TRANSPARENTSELECTIONPERCENT, + PROPERTYNAME_SELECTIONMAXIMUMLUMINANCEPERCENT + }; + + // Initialize return sequence with these list ... + static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + // ... and return it. + return seqPropertyNames; +} + +//***************************************************************************************************************** +// initialize static member +// DON'T DO IT IN YOUR HEADER! +// see definition for further informations +//***************************************************************************************************************** +SvtOptionsDrawinglayer_Impl* SvtOptionsDrawinglayer::m_pDataContainer = NULL; +sal_Int32 SvtOptionsDrawinglayer::m_nRefCount = 0; + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtOptionsDrawinglayer::SvtOptionsDrawinglayer() +{ + // Global access, must be guarded (multithreading!). + MutexGuard aGuard( GetOwnStaticMutex() ); + // Increase ouer refcount ... + ++m_nRefCount; + // ... and initialize ouer data container only if it not already! + if( m_pDataContainer == NULL ) + { + m_pDataContainer = new SvtOptionsDrawinglayer_Impl(); + } +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtOptionsDrawinglayer::~SvtOptionsDrawinglayer() +{ + // Global access, must be guarded (multithreading!) + MutexGuard aGuard( GetOwnStaticMutex() ); + // Decrease ouer refcount. + --m_nRefCount; + // If last instance was deleted ... + // we must destroy ouer static data container! + if( m_nRefCount <= 0 ) + { + delete m_pDataContainer; + m_pDataContainer = NULL; + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtOptionsDrawinglayer::IsOverlayBuffer() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsOverlayBuffer(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtOptionsDrawinglayer::IsPaintBuffer() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsPaintBuffer(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +Color SvtOptionsDrawinglayer::GetStripeColorA() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetStripeColorA(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +Color SvtOptionsDrawinglayer::GetStripeColorB() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetStripeColorB(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_uInt16 SvtOptionsDrawinglayer::GetStripeLength() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetStripeLength(); +} + +// #i73602# +sal_Bool SvtOptionsDrawinglayer::IsOverlayBuffer_Calc() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsOverlayBuffer_Calc(); +} + +sal_Bool SvtOptionsDrawinglayer::IsOverlayBuffer_Writer() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsOverlayBuffer_Writer(); +} + +sal_Bool SvtOptionsDrawinglayer::IsOverlayBuffer_DrawImpress() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsOverlayBuffer_DrawImpress(); +} + +// #i74769#, #i75172# +sal_Bool SvtOptionsDrawinglayer::IsPaintBuffer_Calc() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsPaintBuffer_Calc(); +} + +sal_Bool SvtOptionsDrawinglayer::IsPaintBuffer_Writer() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsPaintBuffer_Writer(); +} + +sal_Bool SvtOptionsDrawinglayer::IsPaintBuffer_DrawImpress() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsPaintBuffer_DrawImpress(); +} + +// #i4219# +sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperWidth() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetMaximumPaperWidth(); +} + +sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperHeight() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetMaximumPaperHeight(); +} + +sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperLeftMargin() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetMaximumPaperLeftMargin(); +} + +sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperRightMargin() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetMaximumPaperRightMargin(); +} + +sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperTopMargin() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetMaximumPaperTopMargin(); +} + +sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperBottomMargin() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetMaximumPaperBottomMargin(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtOptionsDrawinglayer::SetOverlayBuffer( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetOverlayBuffer( bState ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtOptionsDrawinglayer::SetPaintBuffer( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetPaintBuffer( bState ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtOptionsDrawinglayer::SetStripeColorA( Color aColor ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetStripeColorA( aColor ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtOptionsDrawinglayer::SetStripeColorB( Color aColor ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetStripeColorB( aColor ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtOptionsDrawinglayer::SetStripeLength( sal_uInt16 nLength ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetStripeLength( nLength ); +} + +// #i73602# +void SvtOptionsDrawinglayer::SetOverlayBuffer_Calc( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetOverlayBuffer_Calc( bState ); +} + +void SvtOptionsDrawinglayer::SetOverlayBuffer_Writer( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetOverlayBuffer_Writer( bState ); +} + +void SvtOptionsDrawinglayer::SetOverlayBuffer_DrawImpress( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetOverlayBuffer_DrawImpress( bState ); +} + +// #i74769#, #i75172# +void SvtOptionsDrawinglayer::SetPaintBuffer_Calc( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetPaintBuffer_Calc( bState ); +} + +void SvtOptionsDrawinglayer::SetPaintBuffer_Writer( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetPaintBuffer_Writer( bState ); +} + +void SvtOptionsDrawinglayer::SetPaintBuffer_DrawImpress( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetPaintBuffer_DrawImpress( bState ); +} + +// #i4219# +void SvtOptionsDrawinglayer::SetMaximumPaperWidth( sal_uInt32 nNew ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetMaximumPaperWidth( nNew ); +} + +void SvtOptionsDrawinglayer::SetMaximumPaperHeight( sal_uInt32 nNew ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetMaximumPaperHeight( nNew ); +} + +void SvtOptionsDrawinglayer::SetMaximumPaperLeftMargin( sal_uInt32 nNew ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetMaximumPaperLeftMargin( nNew ); +} + +void SvtOptionsDrawinglayer::SetMaximumPaperRightMargin( sal_uInt32 nNew ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetMaximumPaperRightMargin( nNew ); +} + +void SvtOptionsDrawinglayer::SetMaximumPaperTopMargin( sal_uInt32 nNew ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetMaximumPaperTopMargin( nNew ); +} + +void SvtOptionsDrawinglayer::SetMaximumPaperBottomMargin( sal_uInt32 nNew ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetMaximumPaperBottomMargin( nNew ); +} + +// helper +sal_Bool SvtOptionsDrawinglayer::IsAAPossibleOnThisSystem() const +{ + return m_pDataContainer->IsAAPossibleOnThisSystem(); +} + +// primitives +sal_Bool SvtOptionsDrawinglayer::IsAntiAliasing() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsAntiAliasing() && IsAAPossibleOnThisSystem(); +} + +sal_Bool SvtOptionsDrawinglayer::IsSnapHorVerLinesToDiscrete() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsAntiAliasing() && m_pDataContainer->IsSnapHorVerLinesToDiscrete(); +} + +sal_Bool SvtOptionsDrawinglayer::IsSolidDragCreate() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsSolidDragCreate(); +} + +sal_Bool SvtOptionsDrawinglayer::IsRenderDecoratedTextDirect() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsRenderDecoratedTextDirect(); +} + +sal_Bool SvtOptionsDrawinglayer::IsRenderSimpleTextDirect() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsRenderSimpleTextDirect(); +} + +sal_uInt32 SvtOptionsDrawinglayer::GetQuadratic3DRenderLimit() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetQuadratic3DRenderLimit(); +} + +sal_uInt32 SvtOptionsDrawinglayer::GetQuadraticFormControlRenderLimit() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetQuadraticFormControlRenderLimit(); +} + +void SvtOptionsDrawinglayer::SetAntiAliasing( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetAntiAliasing( bState ); +} + +void SvtOptionsDrawinglayer::SetSnapHorVerLinesToDiscrete( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetSnapHorVerLinesToDiscrete( bState ); +} + +void SvtOptionsDrawinglayer::SetSolidDragCreate( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetSolidDragCreate( bState ); +} + +void SvtOptionsDrawinglayer::SetRenderDecoratedTextDirect( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetRenderDecoratedTextDirect( bState ); +} + +void SvtOptionsDrawinglayer::SetRenderSimpleTextDirect( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetRenderSimpleTextDirect( bState ); +} + +void SvtOptionsDrawinglayer::SetQuadratic3DRenderLimit(sal_uInt32 nNew) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetQuadratic3DRenderLimit( nNew ); +} + +void SvtOptionsDrawinglayer::SetQuadraticFormControlRenderLimit(sal_uInt32 nNew) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetQuadraticFormControlRenderLimit( nNew ); +} + +// #i97672# selection settings +sal_Bool SvtOptionsDrawinglayer::IsTransparentSelection() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsTransparentSelection(); +} + +void SvtOptionsDrawinglayer::SetTransparentSelection( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetTransparentSelection( bState ); +} + +sal_uInt16 SvtOptionsDrawinglayer::GetTransparentSelectionPercent() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + sal_uInt16 aRetval(m_pDataContainer->GetTransparentSelectionPercent()); + + // crop to range [10% .. 90%] + if(aRetval < 10) + { + aRetval = 10; + } + + if(aRetval > 90) + { + aRetval = 90; + } + + return aRetval; +} + +void SvtOptionsDrawinglayer::SetTransparentSelectionPercent( sal_uInt16 nPercent ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + + // crop to range [10% .. 90%] + if(nPercent < 10) + { + nPercent = 10; + } + + if(nPercent > 90) + { + nPercent = 90; + } + + m_pDataContainer->SetTransparentSelectionPercent( nPercent ); +} + +sal_uInt16 SvtOptionsDrawinglayer::GetSelectionMaximumLuminancePercent() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + sal_uInt16 aRetval(m_pDataContainer->GetSelectionMaximumLuminancePercent()); + + // crop to range [0% .. 100%] + if(aRetval > 90) + { + aRetval = 90; + } + + return aRetval; +} + +void SvtOptionsDrawinglayer::SetSelectionMaximumLuminancePercent( sal_uInt16 nPercent ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + + // crop to range [0% .. 100%] + if(nPercent > 90) + { + nPercent = 90; + } + + m_pDataContainer->SetSelectionMaximumLuminancePercent( nPercent ); +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Mutex& SvtOptionsDrawinglayer::GetOwnStaticMutex() +{ + // Initialize static mutex only for one time! + static Mutex* pMutex = NULL; + // If these method first called (Mutex not already exist!) ... + if( pMutex == NULL ) + { + // ... we must create a new one. Protect follow code with the global mutex - + // It must be - we create a static variable! + MutexGuard aGuard( Mutex::getGlobalMutex() ); + // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! + if( pMutex == NULL ) + { + // Create the new mutex and set it for return on static variable. + static Mutex aMutex; + pMutex = &aMutex; + } + } + // Return new created or already existing mutex object. + return *pMutex; +} + +// eof + diff --git a/unotools/source/config/pathoptions.cxx b/unotools/source/config/pathoptions.cxx new file mode 100644 index 000000000000..5b74ec1db879 --- /dev/null +++ b/unotools/source/config/pathoptions.cxx @@ -0,0 +1,1094 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: pathoptions.cxx,v $ + * $Revision: 1.81 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +#ifndef GCC +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +using namespace osl; +using namespace utl; +using namespace rtl; +using namespace com::sun::star::uno; +using namespace com::sun::star::beans; +using namespace com::sun::star::util; +using namespace com::sun::star::lang; + +// define ---------------------------------------------------------------- + +#define SEARCHPATH_DELIMITER ';' + +#define ASCII_STR(s) OUString( RTL_CONSTASCII_USTRINGPARAM(s) ) + +#define SIGN_STARTVARIABLE ASCII_STR("$(") +#define SIGN_ENDVARIABLE ASCII_STR(")") + +// Supported variables by the old SvtPathOptions implementation +#define SUBSTITUTE_INST "$(inst)" +#define SUBSTITUTE_PROG "$(prog)" +#define SUBSTITUTE_USER "$(user)" +#define SUBSTITUTE_INSTPATH "$(instpath)" +#define SUBSTITUTE_PROGPATH "$(progpath)" +#define SUBSTITUTE_USERPATH "$(userpath)" +#define SUBSTITUTE_INSTURL "$(insturl)" +#define SUBSTITUTE_PROGURL "$(progurl)" +#define SUBSTITUTE_USERURL "$(userurl)" +#define SUBSTITUTE_PATH "$(path)" +//#define SUBSTITUTE_LANG "$(lang)" +#define SUBSTITUTE_LANGID "$(langid)" +#define SUBSTITUTE_VLANG "$(vlang)" +#define SUBSTITUTE_WORKDIRURL "$(workdirurl)" + +#define STRPOS_NOTFOUND -1 + +struct OUStringHashCode +{ + size_t operator()( const ::rtl::OUString& sString ) const + { + return sString.hashCode(); + } +}; + +enum VarNameProperty +{ + VAR_NEEDS_SYSTEM_PATH, + VAR_NEEDS_FILEURL +}; + +class NameToHandleMap : public ::std::hash_map< ::rtl::OUString, sal_Int32, OUStringHashCode, ::std::equal_to< ::rtl::OUString > > +{ + public: + inline void free() { NameToHandleMap().swap( *this ); } +}; + +class EnumToHandleMap : public ::std::hash_map< sal_Int32, sal_Int32, std::hash< sal_Int32 >, std::equal_to< sal_Int32 > > +{ + public: + inline void free() { EnumToHandleMap().swap( *this ); } +}; + +class VarNameToEnumMap : public ::std::hash_map< OUString, VarNameProperty, OUStringHashCode, ::std::equal_to< OUString > > +{ + public: + inline void free() { VarNameToEnumMap().swap( *this ); } +}; + + +// class SvtPathOptions_Impl --------------------------------------------- +class SvtPathOptions_Impl +{ + private: + // Local variables to return const references + std::vector< String > m_aPathArray; + Reference< XFastPropertySet > m_xPathSettings; + Reference< XStringSubstitution > m_xSubstVariables; + mutable EnumToHandleMap m_aMapEnumToPropHandle; + VarNameToEnumMap m_aMapVarNamesToEnum; + + ::com::sun::star::lang::Locale m_aLocale; + String m_aEmptyString; + mutable ::osl::Mutex m_aMutex; + + public: + SvtPathOptions_Impl(); + + // get the pathes, not const because of using a mutex + const String& GetPath( SvtPathOptions::Pathes ); + const String& GetAddinPath() { return GetPath( SvtPathOptions::PATH_ADDIN ); } + const String& GetAutoCorrectPath() { return GetPath( SvtPathOptions::PATH_AUTOCORRECT ); } + const String& GetAutoTextPath() { return GetPath( SvtPathOptions::PATH_AUTOTEXT ); } + const String& GetBackupPath() { return GetPath( SvtPathOptions::PATH_BACKUP ); } + const String& GetBasicPath() { return GetPath( SvtPathOptions::PATH_BASIC ); } + const String& GetBitmapPath() { return GetPath( SvtPathOptions::PATH_BITMAP ); } + const String& GetConfigPath() { return GetPath( SvtPathOptions::PATH_CONFIG ); } + const String& GetDictionaryPath() { return GetPath( SvtPathOptions::PATH_DICTIONARY ); } + const String& GetFavoritesPath() { return GetPath( SvtPathOptions::PATH_FAVORITES ); } + const String& GetFilterPath() { return GetPath( SvtPathOptions::PATH_FILTER ); } + const String& GetGalleryPath() { return GetPath( SvtPathOptions::PATH_GALLERY ); } + const String& GetGraphicPath() { return GetPath( SvtPathOptions::PATH_GRAPHIC ); } + const String& GetHelpPath() { return GetPath( SvtPathOptions::PATH_HELP ); } + const String& GetLinguisticPath() { return GetPath( SvtPathOptions::PATH_LINGUISTIC ); } + const String& GetModulePath() { return GetPath( SvtPathOptions::PATH_MODULE ); } + const String& GetPalettePath() { return GetPath( SvtPathOptions::PATH_PALETTE ); } + const String& GetPluginPath() { return GetPath( SvtPathOptions::PATH_PLUGIN ); } + const String& GetStoragePath() { return GetPath( SvtPathOptions::PATH_STORAGE ); } + const String& GetTempPath() { return GetPath( SvtPathOptions::PATH_TEMP ); } + const String& GetTemplatePath() { return GetPath( SvtPathOptions::PATH_TEMPLATE ); } + const String& GetUserConfigPath() { return GetPath( SvtPathOptions::PATH_USERCONFIG ); } + const String& GetWorkPath() { return GetPath( SvtPathOptions::PATH_WORK ); } + const String& GetUIConfigPath() { return GetPath( SvtPathOptions::PATH_UICONFIG ); } + const String& GetFingerprintPath() { return GetPath( SvtPathOptions::PATH_FINGERPRINT ); } + + // set the pathes + void SetPath( SvtPathOptions::Pathes, const String& rNewPath ); + void SetAddinPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_ADDIN, rPath ); } + void SetAutoCorrectPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_AUTOCORRECT, rPath ); } + void SetAutoTextPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_AUTOTEXT, rPath ); } + void SetBackupPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_BACKUP, rPath ); } + void SetBasicPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_BASIC, rPath ); } + void SetBitmapPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_BITMAP, rPath ); } + void SetConfigPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_CONFIG, rPath ); } + void SetDictionaryPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_DICTIONARY, rPath ); } + void SetFavoritesPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_FAVORITES, rPath ); } + void SetFilterPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_FILTER, rPath ); } + void SetGalleryPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_GALLERY, rPath ); } + void SetGraphicPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_GRAPHIC, rPath ); } + void SetHelpPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_HELP, rPath ); } + void SetLinguisticPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_LINGUISTIC, rPath ); } + void SetModulePath( const String& rPath ) { SetPath( SvtPathOptions::PATH_MODULE, rPath ); } + void SetPalettePath( const String& rPath ) { SetPath( SvtPathOptions::PATH_PALETTE, rPath ); } + void SetPluginPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_PLUGIN, rPath ); } + void SetStoragePath( const String& rPath ) { SetPath( SvtPathOptions::PATH_STORAGE, rPath ); } + void SetTempPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_TEMP, rPath ); } + void SetTemplatePath( const String& rPath ) { SetPath( SvtPathOptions::PATH_TEMPLATE, rPath ); } + void SetUserConfigPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_USERCONFIG, rPath ); } + void SetWorkPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_WORK, rPath ); } + + rtl::OUString SubstVar( const rtl::OUString& rVar ); + rtl::OUString SubstituteAndConvert( const rtl::OUString& rPath ); + rtl::OUString UsePathVariables( const rtl::OUString& rPath ); + + ::com::sun::star::lang::Locale GetLocale() const { return m_aLocale; } + + BOOL IsPathReadonly(SvtPathOptions::Pathes ePath)const; +}; + +// global ---------------------------------------------------------------- + +static SvtPathOptions_Impl* pOptions = NULL; +static sal_Int32 nRefCount = 0; + +// functions ------------------------------------------------------------- +struct PropertyStruct +{ + const char* pPropName; // The ascii name of the Office path + SvtPathOptions::Pathes ePath; // The enum value used by SvtPathOptions +}; + +struct VarNameAttribute +{ + const char* pVarName; // The name of the path variable + VarNameProperty eVarProperty; // Which return value is needed by this path variable +}; + +static PropertyStruct aPropNames[] = +{ + { "Addin", SvtPathOptions::PATH_ADDIN }, + { "AutoCorrect", SvtPathOptions::PATH_AUTOCORRECT }, + { "AutoText", SvtPathOptions::PATH_AUTOTEXT }, + { "Backup", SvtPathOptions::PATH_BACKUP }, + { "Basic", SvtPathOptions::PATH_BASIC }, + { "Bitmap", SvtPathOptions::PATH_BITMAP }, + { "Config", SvtPathOptions::PATH_CONFIG }, + { "Dictionary", SvtPathOptions::PATH_DICTIONARY }, + { "Favorite", SvtPathOptions::PATH_FAVORITES }, + { "Filter", SvtPathOptions::PATH_FILTER }, + { "Gallery", SvtPathOptions::PATH_GALLERY }, + { "Graphic", SvtPathOptions::PATH_GRAPHIC }, + { "Help", SvtPathOptions::PATH_HELP }, + { "Linguistic", SvtPathOptions::PATH_LINGUISTIC }, + { "Module", SvtPathOptions::PATH_MODULE }, + { "Palette", SvtPathOptions::PATH_PALETTE }, + { "Plugin", SvtPathOptions::PATH_PLUGIN }, + { "Storage", SvtPathOptions::PATH_STORAGE }, + { "Temp", SvtPathOptions::PATH_TEMP }, + { "Template", SvtPathOptions::PATH_TEMPLATE }, + { "UserConfig", SvtPathOptions::PATH_USERCONFIG }, + { "Work", SvtPathOptions::PATH_WORK }, + { "UIConfig", SvtPathOptions::PATH_UICONFIG }, + { "Fingerprint", SvtPathOptions::PATH_FINGERPRINT } +}; + +static VarNameAttribute aVarNameAttribute[] = +{ + { SUBSTITUTE_INSTPATH, VAR_NEEDS_SYSTEM_PATH }, // $(instpath) + { SUBSTITUTE_PROGPATH, VAR_NEEDS_SYSTEM_PATH }, // $(progpath) + { SUBSTITUTE_USERPATH, VAR_NEEDS_SYSTEM_PATH }, // $(userpath) + { SUBSTITUTE_PATH, VAR_NEEDS_SYSTEM_PATH }, // $(path) +}; + +#if 0 +// currently unused +static Sequence< OUString > GetPathPropertyNames() +{ + const int nCount = sizeof( aPropNames ) / sizeof( PropertyStruct ); + Sequence< OUString > aNames( nCount ); + OUString* pNames = aNames.getArray(); + for ( int i = 0; i < nCount; i++ ) + pNames[i] = OUString::createFromAscii( aPropNames[i].pPropName ); + + return aNames; +} +#endif + +// class SvtPathOptions_Impl --------------------------------------------- + +const String& SvtPathOptions_Impl::GetPath( SvtPathOptions::Pathes ePath ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( ePath < SvtPathOptions::PATH_COUNT ) + { + OUString aPathValue; + String aResult; + sal_Int32 nHandle = m_aMapEnumToPropHandle[ (sal_Int32)ePath ]; + + // Substitution is done by the service itself using the substition service + Any a = m_xPathSettings->getFastPropertyValue( nHandle ); + a >>= aPathValue; + if( ePath == SvtPathOptions::PATH_ADDIN || + ePath == SvtPathOptions::PATH_FILTER || + ePath == SvtPathOptions::PATH_HELP || + ePath == SvtPathOptions::PATH_MODULE || + ePath == SvtPathOptions::PATH_PLUGIN || + ePath == SvtPathOptions::PATH_STORAGE + ) + { + // These office paths have to be converted to system pathes + utl::LocalFileHelper::ConvertURLToPhysicalName( aPathValue, aResult ); + aPathValue = aResult; + } + + m_aPathArray[ ePath ] = aPathValue; + return m_aPathArray[ ePath ]; + } + + return m_aEmptyString; +} +// ----------------------------------------------------------------------- +BOOL SvtPathOptions_Impl::IsPathReadonly(SvtPathOptions::Pathes ePath)const +{ + ::osl::MutexGuard aGuard( m_aMutex ); + BOOL bReadonly = FALSE; + if ( ePath < SvtPathOptions::PATH_COUNT ) + { + Reference xPrSet(m_xPathSettings, UNO_QUERY); + if(xPrSet.is()) + { + Reference xInfo = xPrSet->getPropertySetInfo(); + const char* pA = aPropNames[ePath].pPropName; + ::rtl::OUString sU = OUString::createFromAscii(pA); + Property aProperty = xInfo->getPropertyByName(sU); + bReadonly = 0 != (aProperty.Attributes & PropertyAttribute::READONLY); + } + } + return bReadonly; +} +// ----------------------------------------------------------------------- + +void SvtPathOptions_Impl::SetPath( SvtPathOptions::Pathes ePath, const String& rNewPath ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( ePath < SvtPathOptions::PATH_COUNT ) + { + String aResult; + OUString aNewValue; + Any a; + + switch ( ePath ) + { + case SvtPathOptions::PATH_ADDIN: + case SvtPathOptions::PATH_FILTER: + case SvtPathOptions::PATH_HELP: + case SvtPathOptions::PATH_MODULE: + case SvtPathOptions::PATH_PLUGIN: + case SvtPathOptions::PATH_STORAGE: + { + // These office paths have to be convert back to UCB-URL's + utl::LocalFileHelper::ConvertPhysicalNameToURL( rNewPath, aResult ); + aNewValue = aResult; + } + break; + + default: + aNewValue = rNewPath; + } + + // Resubstitution is done by the service itself using the substition service + a <<= aNewValue; + try + { + m_xPathSettings->setFastPropertyValue( m_aMapEnumToPropHandle[ (sal_Int32)ePath], a ); + } + catch (const Exception&) + { + } + } +} + +// ----------------------------------------------------------------------- + +OUString SvtPathOptions_Impl::SubstituteAndConvert( const rtl::OUString& rPath ) +{ + return SubstVar( rPath ); +} + +//------------------------------------------------------------------------- + +OUString SvtPathOptions_Impl::UsePathVariables( const OUString& rPath ) +{ + return m_xSubstVariables->reSubstituteVariables( rPath ); +} + +// ----------------------------------------------------------------------- + +OUString SvtPathOptions_Impl::SubstVar( const OUString& rVar ) +{ + // Don't work at parameter-string directly. Copy it. + OUString aWorkText = rVar; + + // Convert the returned path to system path! + BOOL bConvertLocal = FALSE; + + // Search for first occure of "$(...". + sal_Int32 nPosition = aWorkText.indexOf( SIGN_STARTVARIABLE ); // = first position of "$(" in string + sal_Int32 nLength = 0; // = count of letters from "$(" to ")" in string + + // Have we found any variable like "$(...)"? + if ( nPosition != STRPOS_NOTFOUND ) + { + // Yes; Get length of found variable. + // If no ")" was found - nLength is set to 0 by default! see before. + sal_Int32 nEndPosition = aWorkText.indexOf( SIGN_ENDVARIABLE, nPosition ); + if ( nEndPosition != STRPOS_NOTFOUND ) + nLength = nEndPosition - nPosition + 1; + } + + // Is there another path variable? + while ( ( nPosition != STRPOS_NOTFOUND ) && ( nLength > 0 ) ) + { + // YES; Get the next variable for replace. + OUString aReplacement; + OUString aSubString = aWorkText.copy( nPosition, nLength ); + aSubString = aSubString.toAsciiLowerCase(); + + // Look for special variable that needs a system path. + VarNameToEnumMap::const_iterator pIter = m_aMapVarNamesToEnum.find( aSubString ); + if ( pIter != m_aMapVarNamesToEnum.end() ) + bConvertLocal = TRUE; + + nPosition += nLength; + + // We must control index in string before call something at OUString! + // The OUString-implementation don't do it for us :-( but the result is not defined otherwise. + if ( nPosition + 1 > aWorkText.getLength() ) + { + // Position is out of range. Break loop! + nPosition = STRPOS_NOTFOUND; + nLength = 0; + } + else + { + // Else; Position is valid. Search for next variable. + nPosition = aWorkText.indexOf( SIGN_STARTVARIABLE, nPosition ); + // Have we found any variable like "$(...)"? + if ( nPosition != STRPOS_NOTFOUND ) + { + // Yes; Get length of found variable. If no ")" was found - nLength must set to 0! + nLength = 0; + sal_Int32 nEndPosition = aWorkText.indexOf( SIGN_ENDVARIABLE, nPosition ); + if ( nEndPosition != STRPOS_NOTFOUND ) + nLength = nEndPosition - nPosition + 1; + } + } + } + + aWorkText = m_xSubstVariables->substituteVariables( rVar, sal_False ); + + if ( bConvertLocal ) + { + // Convert the URL to a system path for special path variables + String aReturn; + utl::LocalFileHelper::ConvertURLToPhysicalName( aWorkText, aReturn ); + return aReturn; + } + + return aWorkText; +} + +// ----------------------------------------------------------------------- + +SvtPathOptions_Impl::SvtPathOptions_Impl() : + m_aPathArray( (sal_Int32)SvtPathOptions::PATH_COUNT ) +{ + Reference< XMultiServiceFactory > xSMgr = comphelper::getProcessServiceFactory(); + + // Create necessary services + m_xPathSettings = Reference< XFastPropertySet >( xSMgr->createInstance( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.util.PathSettings" ))), + UNO_QUERY ); + if ( !m_xPathSettings.is() ) + { + // #112719#: check for existance + DBG_ERROR( "SvtPathOptions_Impl::SvtPathOptions_Impl(): #112719# happened again!" ); + throw RuntimeException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Service com.sun.star.util.PathSettings cannot be created" )), + Reference< XInterface >() ); + } + + m_xSubstVariables = Reference< XStringSubstitution >( xSMgr->createInstance( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.util.PathSubstitution" ))), + UNO_QUERY ); + if ( !m_xSubstVariables.is() ) + { + // #112719#: check for existance + DBG_ERROR( "SvtPathOptions_Impl::SvtPathOptions_Impl(): #112719# happened again!" ); + throw RuntimeException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Service com.sun.star.util.PathSubstitution cannot be created" )), + Reference< XInterface >() ); + } + + // Create temporary hash map to have a mapping between property names and property handles + Reference< XPropertySet > xPropertySet = Reference< XPropertySet >( m_xPathSettings, UNO_QUERY ); + Reference< XPropertySetInfo > xPropSetInfo = xPropertySet->getPropertySetInfo(); + Sequence< Property > aPathPropSeq = xPropSetInfo->getProperties(); + + NameToHandleMap aTempHashMap; + for ( sal_Int32 n = 0; n < aPathPropSeq.getLength(); n++ ) + { + const com::sun::star::beans::Property& aProperty = aPathPropSeq[n]; + aTempHashMap.insert( NameToHandleMap::value_type( aProperty.Name, aProperty.Handle )); + } + + // Create mapping between internal enum (SvtPathOptions::Pathes) and property handle + sal_Int32 nCount = sizeof( aPropNames ) / sizeof( PropertyStruct ); + sal_Int32 i; + for ( i = 0; i < nCount; i++ ) + { + NameToHandleMap::const_iterator pIter = + aTempHashMap.find( rtl::OUString::createFromAscii( aPropNames[i].pPropName )); + + if ( pIter != aTempHashMap.end() ) + { + sal_Int32 nHandle = pIter->second; + sal_Int32 nEnum = aPropNames[i].ePath; + m_aMapEnumToPropHandle.insert( EnumToHandleMap::value_type( nEnum, nHandle )); + } + } + + // Create hash map for path variables that need a system path as a return value! + nCount = sizeof( aVarNameAttribute ) / sizeof( VarNameAttribute ); + for ( i = 0; i < nCount; i++ ) + { + m_aMapVarNamesToEnum.insert( VarNameToEnumMap::value_type( + OUString::createFromAscii( aVarNameAttribute[i].pVarName ), + aVarNameAttribute[i].eVarProperty )); + } + + // Set language type! + Any aLocale = ConfigManager::GetConfigManager()->GetDirectConfigProperty( ConfigManager::LOCALE ); + OUString aLocaleStr; + if ( aLocale >>= aLocaleStr ) + { + sal_Int32 nIndex = 0; + m_aLocale.Language = aLocaleStr.getToken(0, '-', nIndex ); + m_aLocale.Country = aLocaleStr.getToken(0, '-', nIndex ); + m_aLocale.Variant = aLocaleStr.getToken(0, '-', nIndex ); + } + else + { + DBG_ERRORFILE( "wrong any type" ); + m_aLocale.Language = OStringToOUString(OString("en"), RTL_TEXTENCODING_UTF8); + m_aLocale.Country = OStringToOUString(OString("US"), RTL_TEXTENCODING_UTF8); + m_aLocale.Variant = OStringToOUString(OString(""), RTL_TEXTENCODING_UTF8); + } +} + +// ----------------------------------------------------------------------- + +// class SvtPathOptions -------------------------------------------------- + +namespace { struct lclMutex : public rtl::Static< ::osl::Mutex, lclMutex > {}; } + +SvtPathOptions::SvtPathOptions() +{ + // Global access, must be guarded (multithreading) + ::osl::MutexGuard aGuard( lclMutex::get() ); + if ( !pOptions ) + { + pOptions = new SvtPathOptions_Impl; + ItemHolder1::holdConfigItem(E_PATHOPTIONS); + } + ++nRefCount; + pImp = pOptions; +} + +// ----------------------------------------------------------------------- + +SvtPathOptions::~SvtPathOptions() +{ + // Global access, must be guarded (multithreading) + ::osl::MutexGuard aGuard( lclMutex::get() ); + if ( !--nRefCount ) + { + DELETEZ( pOptions ); + } +} + +// ----------------------------------------------------------------------- + +const String& SvtPathOptions::GetAddinPath() const +{ + return pImp->GetAddinPath(); +} + +// ----------------------------------------------------------------------- + +const String& SvtPathOptions::GetAutoCorrectPath() const +{ + return pImp->GetAutoCorrectPath(); +} + +// ----------------------------------------------------------------------- + +const String& SvtPathOptions::GetAutoTextPath() const +{ + return pImp->GetAutoTextPath(); +} + +// ----------------------------------------------------------------------- + +const String& SvtPathOptions::GetBackupPath() const +{ + return pImp->GetBackupPath(); +} + +// ----------------------------------------------------------------------- + +const String& SvtPathOptions::GetBasicPath() const +{ + return pImp->GetBasicPath(); +} + +// ----------------------------------------------------------------------- + +const String& SvtPathOptions::GetBitmapPath() const +{ + return pImp->GetBitmapPath(); +} + +// ----------------------------------------------------------------------- + +const String& SvtPathOptions::GetConfigPath() const +{ + return pImp->GetConfigPath(); +} + +// ----------------------------------------------------------------------- + +const String& SvtPathOptions::GetDictionaryPath() const +{ + return pImp->GetDictionaryPath(); +} + +// ----------------------------------------------------------------------- + +const String& SvtPathOptions::GetFavoritesPath() const +{ + return pImp->GetFavoritesPath(); +} + +// ----------------------------------------------------------------------- + +const String& SvtPathOptions::GetFilterPath() const +{ + return pImp->GetFilterPath(); +} + +// ----------------------------------------------------------------------- + +const String& SvtPathOptions::GetGalleryPath() const +{ + return pImp->GetGalleryPath(); +} + +// ----------------------------------------------------------------------- + +const String& SvtPathOptions::GetGraphicPath() const +{ + return pImp->GetGraphicPath(); +} + +// ----------------------------------------------------------------------- + +const String& SvtPathOptions::GetHelpPath() const +{ + return pImp->GetHelpPath(); +} + +// ----------------------------------------------------------------------- + +const String& SvtPathOptions::GetLinguisticPath() const +{ + return pImp->GetLinguisticPath(); +} + +// ----------------------------------------------------------------------- + +const String& SvtPathOptions::GetFingerprintPath() const +{ + return pImp->GetFingerprintPath(); +} + +// ----------------------------------------------------------------------- + +const String& SvtPathOptions::GetModulePath() const +{ + return pImp->GetModulePath(); +} + +// ----------------------------------------------------------------------- + +const String& SvtPathOptions::GetPalettePath() const +{ + return pImp->GetPalettePath(); +} + +// ----------------------------------------------------------------------- + +const String& SvtPathOptions::GetPluginPath() const +{ + return pImp->GetPluginPath(); +} + +// ----------------------------------------------------------------------- + +const String& SvtPathOptions::GetStoragePath() const +{ + return pImp->GetStoragePath(); +} + +// ----------------------------------------------------------------------- + +const String& SvtPathOptions::GetTempPath() const +{ + return pImp->GetTempPath(); +} + +// ----------------------------------------------------------------------- + +const String& SvtPathOptions::GetTemplatePath() const +{ + return pImp->GetTemplatePath(); +} + +// ----------------------------------------------------------------------- + +const String& SvtPathOptions::GetUserConfigPath() const +{ + return pImp->GetUserConfigPath(); +} + +const String& SvtPathOptions::GetUIConfigPath() const +{ + return pImp->GetUIConfigPath(); +} + +// ----------------------------------------------------------------------- + +const String& SvtPathOptions::GetWorkPath() const +{ + return pImp->GetWorkPath(); +} + +// ----------------------------------------------------------------------- + +void SvtPathOptions::SetAddinPath( const String& rPath ) +{ + pImp->SetAddinPath( rPath ); +} + +// ----------------------------------------------------------------------- + +void SvtPathOptions::SetAutoCorrectPath( const String& rPath ) +{ + pImp->SetAutoCorrectPath( rPath ); +} + +// ----------------------------------------------------------------------- + +void SvtPathOptions::SetAutoTextPath( const String& rPath ) +{ + pImp->SetAutoTextPath( rPath ); +} + +// ----------------------------------------------------------------------- + +void SvtPathOptions::SetBackupPath( const String& rPath ) +{ + pImp->SetBackupPath( rPath ); +} + +// ----------------------------------------------------------------------- + +void SvtPathOptions::SetBasicPath( const String& rPath ) +{ + pImp->SetBasicPath( rPath ); +} + +// ----------------------------------------------------------------------- + +void SvtPathOptions::SetBitmapPath( const String& rPath ) +{ + pImp->SetBitmapPath( rPath ); +} + +// ----------------------------------------------------------------------- + +void SvtPathOptions::SetConfigPath( const String& rPath ) +{ + pImp->SetConfigPath( rPath ); +} + +// ----------------------------------------------------------------------- + +void SvtPathOptions::SetDictionaryPath( const String& rPath ) +{ + pImp->SetDictionaryPath( rPath ); +} + +// ----------------------------------------------------------------------- + +void SvtPathOptions::SetFavoritesPath( const String& rPath ) +{ + pImp->SetFavoritesPath( rPath ); +} + +// ----------------------------------------------------------------------- + +void SvtPathOptions::SetFilterPath( const String& rPath ) +{ + pImp->SetFilterPath( rPath ); +} + +// ----------------------------------------------------------------------- + +void SvtPathOptions::SetGalleryPath( const String& rPath ) +{ + pImp->SetGalleryPath( rPath ); +} + +// ----------------------------------------------------------------------- + +void SvtPathOptions::SetGraphicPath( const String& rPath ) +{ + pImp->SetGraphicPath( rPath ); +} + +// ----------------------------------------------------------------------- + +void SvtPathOptions::SetHelpPath( const String& rPath ) +{ + pImp->SetHelpPath( rPath ); +} + +// ----------------------------------------------------------------------- + +void SvtPathOptions::SetLinguisticPath( const String& rPath ) +{ + pImp->SetLinguisticPath( rPath ); +} + +// ----------------------------------------------------------------------- + +void SvtPathOptions::SetModulePath( const String& rPath ) +{ + pImp->SetModulePath( rPath ); +} + +// ----------------------------------------------------------------------- + +void SvtPathOptions::SetPalettePath( const String& rPath ) +{ + pImp->SetPalettePath( rPath ); +} + +// ----------------------------------------------------------------------- + +void SvtPathOptions::SetPluginPath( const String& rPath ) +{ + pImp->SetPluginPath( rPath ); +} + +// ----------------------------------------------------------------------- + +void SvtPathOptions::SetStoragePath( const String& rPath ) +{ + pImp->SetStoragePath( rPath ); +} + +// ----------------------------------------------------------------------- + +void SvtPathOptions::SetTempPath( const String& rPath ) +{ + pImp->SetTempPath( rPath ); +} + +// ----------------------------------------------------------------------- + +void SvtPathOptions::SetTemplatePath( const String& rPath ) +{ + pImp->SetTemplatePath( rPath ); +} + +// ----------------------------------------------------------------------- + +void SvtPathOptions::SetUserConfigPath( const String& rPath ) +{ + pImp->SetUserConfigPath( rPath ); +} + +// ----------------------------------------------------------------------- + +void SvtPathOptions::SetWorkPath( const String& rPath ) +{ + pImp->SetWorkPath( rPath ); +} + +// ----------------------------------------------------------------------- + +String SvtPathOptions::SubstituteVariable( const String& rVar ) +{ + String aRet = pImp->SubstituteAndConvert( rVar ); + return aRet; +} + +String SvtPathOptions::UseVariable( const String& rPath ) +{ + String aRet = pImp->UsePathVariables( rPath ); + return aRet; +} + +// ----------------------------------------------------------------------- + +sal_Bool SvtPathOptions::SearchFile( String& rIniFile, Pathes ePath ) +{ + // check parameter: empty inifile name? + if ( !rIniFile.Len() ) + { + DBG_ERRORFILE( "SvtPathOptions::SearchFile(): invalid parameter" ); + return sal_False; + } + + String aIniFile = pImp->SubstVar( rIniFile ); + sal_Bool bRet = sal_False; + + switch ( ePath ) + { + case PATH_USERCONFIG: + { + // path is a URL + bRet = sal_True; + INetURLObject aObj( GetUserConfigPath() ); + xub_StrLen i, nCount = aIniFile.GetTokenCount( '/' ); + for ( i = 0; i < nCount; ++i ) + aObj.insertName( aIniFile.GetToken( i, '/' ) ); + + if ( !::utl::UCBContentHelper::Exists( aObj.GetMainURL( INetURLObject::NO_DECODE ) ) ) + { + aObj.SetSmartURL( GetConfigPath() ); + aObj.insertName( aIniFile ); + bRet = ::utl::UCBContentHelper::Exists( aObj.GetMainURL( INetURLObject::NO_DECODE ) ); + } + + if ( bRet ) + rIniFile = aObj.GetMainURL( INetURLObject::NO_DECODE ); + + break; + } + + default: + { + String aPath; + switch ( ePath ) + { + case PATH_ADDIN: aPath = GetAddinPath(); break; + case PATH_AUTOCORRECT: aPath = GetAutoCorrectPath(); break; + case PATH_AUTOTEXT: aPath = GetAutoTextPath(); break; + case PATH_BACKUP: aPath = GetBackupPath(); break; + case PATH_BASIC: aPath = GetBasicPath(); break; + case PATH_BITMAP: aPath = GetBitmapPath(); break; + case PATH_CONFIG: aPath = GetConfigPath(); break; + case PATH_DICTIONARY: aPath = GetDictionaryPath(); break; + case PATH_FAVORITES: aPath = GetFavoritesPath(); break; + case PATH_FILTER: aPath = GetFilterPath(); break; + case PATH_GALLERY: aPath = GetGalleryPath(); break; + case PATH_GRAPHIC: aPath = GetGraphicPath(); break; + case PATH_HELP: aPath = GetHelpPath(); break; + case PATH_LINGUISTIC: aPath = GetLinguisticPath(); break; + case PATH_MODULE: aPath = GetModulePath(); break; + case PATH_PALETTE: aPath = GetPalettePath(); break; + case PATH_PLUGIN: aPath = GetPluginPath(); break; + case PATH_STORAGE: aPath = GetStoragePath(); break; + case PATH_TEMP: aPath = GetTempPath(); break; + case PATH_TEMPLATE: aPath = GetTemplatePath(); break; + case PATH_WORK: aPath = GetWorkPath(); break; + case PATH_UICONFIG: aPath = GetUIConfigPath(); break; + case PATH_FINGERPRINT: aPath = GetFingerprintPath(); break; + case PATH_USERCONFIG:/*-Wall???*/ break; + case PATH_COUNT: /*-Wall???*/ break; + } + + sal_uInt16 j, nIdx = 0, nTokenCount = aPath.GetTokenCount( SEARCHPATH_DELIMITER ); + for ( j = 0; j < nTokenCount; ++j ) + { + BOOL bIsURL = TRUE; + String aPathToken = aPath.GetToken( 0, SEARCHPATH_DELIMITER, nIdx ); + INetURLObject aObj( aPathToken ); + if ( aObj.HasError() ) + { + bIsURL = FALSE; + String aURL; + if ( LocalFileHelper::ConvertPhysicalNameToURL( aPathToken, aURL ) ) + aObj.SetURL( aURL ); + } + + xub_StrLen i, nCount = aIniFile.GetTokenCount( '/' ); + for ( i = 0; i < nCount; ++i ) + aObj.insertName( aIniFile.GetToken( i, '/' ) ); + bRet = ::utl::UCBContentHelper::Exists( aObj.GetMainURL( INetURLObject::NO_DECODE ) ); + + if ( bRet ) + { + if ( !bIsURL ) + ::utl::LocalFileHelper::ConvertURLToPhysicalName( + aObj.GetMainURL( INetURLObject::NO_DECODE ), rIniFile ); + else + rIniFile = aObj.GetMainURL( INetURLObject::NO_DECODE ); + break; + } + } + } + } + + return bRet; +} + +// ----------------------------------------------------------------------- + +::com::sun::star::lang::Locale SvtPathOptions::GetLocale() const +{ + return pImp->GetLocale(); +} +// ----------------------------------------------------------------------- +BOOL SvtPathOptions::IsPathReadonly(Pathes ePath)const +{ + return pImp->IsPathReadonly(ePath); +} +// ----------------------------------------------------------------------- +const String& SvtPathOptions::GetPath(Pathes ePath)const +{ + return pImp->GetPath(ePath); +} +// ----------------------------------------------------------------------- +void SvtPathOptions::SetPath( SvtPathOptions::Pathes ePath, const String& rNewPath ) +{ + pImp->SetPath(ePath, rNewPath); +} + +// class PathService ----------------------------------------------------- +#include +#include +#include + +class PathService : public ::cppu::WeakImplHelper2< ::com::sun::star::frame::XConfigManager, ::com::sun::star::lang::XServiceInfo > +{ + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL substituteVariables( const ::rtl::OUString& sText ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& sKeyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& sKeyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL flush( ) throw(::com::sun::star::uno::RuntimeException); +}; + +// class PathService ----------------------------------------------------- + +void SAL_CALL PathService::addPropertyChangeListener( const ::rtl::OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& ) throw(::com::sun::star::uno::RuntimeException) {} +void SAL_CALL PathService::removePropertyChangeListener( const ::rtl::OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& ) throw(::com::sun::star::uno::RuntimeException) {} +void SAL_CALL PathService::flush( ) throw(::com::sun::star::uno::RuntimeException) {} + +::rtl::OUString SAL_CALL PathService::substituteVariables( const ::rtl::OUString& sText ) throw(::com::sun::star::uno::RuntimeException) +{ + return SvtPathOptions().SubstituteVariable( sText ); +} + +::rtl::OUString SAL_CALL PathService::getImplementationName( ) throw(::com::sun::star::uno::RuntimeException) +{ + return OUString::createFromAscii("com.sun.star.comp.unotools.PathService"); +} + +sal_Bool SAL_CALL PathService::supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException) +{ + if ( ServiceName.compareToAscii("com.sun.star.config.SpecialConfigManager") == COMPARE_EQUAL ) + return sal_True; + else + return sal_False; +} + +::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL PathService::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) +{ + Sequence< OUString > aRet(1); + *aRet.getArray() = OUString::createFromAscii("com.sun.star.config.SpecialConfigManager"); + return aRet; +} diff --git a/unotools/source/config/printwarningoptions.cxx b/unotools/source/config/printwarningoptions.cxx new file mode 100644 index 000000000000..c64064c8fadc --- /dev/null +++ b/unotools/source/config/printwarningoptions.cxx @@ -0,0 +1,419 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: printwarningoptions.cxx,v $ + * $Revision: 1.8 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +#ifndef GCC +#endif + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include +#include +#include +#include +#include +#include + +#include + +//_________________________________________________________________________________________________________________ +// namespaces +//_________________________________________________________________________________________________________________ + +using namespace ::utl ; +using namespace ::rtl ; +using namespace ::osl ; +using namespace ::com::sun::star::uno ; + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +#define ROOTNODE_START OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Print")) + +#define PROPERTYNAME_PAPERSIZE OUString(RTL_CONSTASCII_USTRINGPARAM("Warning/PaperSize")) +#define PROPERTYNAME_PAPERORIENTATION OUString(RTL_CONSTASCII_USTRINGPARAM("Warning/PaperOrientation")) +#define PROPERTYNAME_NOTFOUND OUString(RTL_CONSTASCII_USTRINGPARAM("Warning/NotFound")) +#define PROPERTYNAME_TRANSPARENCY OUString(RTL_CONSTASCII_USTRINGPARAM("Warning/Transparency")) +#define PROPERTYNAME_PRINTINGMODIFIESDOCUMENT OUString(RTL_CONSTASCII_USTRINGPARAM("PrintingModifiesDocument")) + +#define PROPERTYHANDLE_PAPERSIZE 0 +#define PROPERTYHANDLE_PAPERORIENTATION 1 +#define PROPERTYHANDLE_NOTFOUND 2 +#define PROPERTYHANDLE_TRANSPARENCY 3 +#define PROPERTYHDL_PRINTINGMODIFIESDOCUMENT 4 + +#define PROPERTYCOUNT 5 + +class SvtPrintWarningOptions_Impl : public ConfigItem +{ +public: + +//--------------------------------------------------------------------------------------------------------- +// constructor / destructor +//--------------------------------------------------------------------------------------------------------- + + SvtPrintWarningOptions_Impl(); + ~SvtPrintWarningOptions_Impl(); + +//--------------------------------------------------------------------------------------------------------- +// overloaded methods of baseclass +//--------------------------------------------------------------------------------------------------------- + + virtual void Commit(); + +//--------------------------------------------------------------------------------------------------------- +// public interface +//--------------------------------------------------------------------------------------------------------- + + sal_Bool IsPaperSize() const { return m_bPaperSize; } + sal_Bool IsPaperOrientation() const { return m_bPaperOrientation; } + sal_Bool IsNotFound() const { return m_bNotFound; } + sal_Bool IsTransparency() const { return m_bTransparency; } + sal_Bool IsModifyDocumentOnPrintingAllowed() const { return m_bModifyDocumentOnPrintingAllowed; } + + void SetPaperSize( sal_Bool bState ) { m_bPaperSize = bState; SetModified(); } + void SetPaperOrientation( sal_Bool bState ) { m_bPaperOrientation = bState; SetModified(); } + void SetNotFound( sal_Bool bState ) { m_bNotFound = bState; SetModified(); } + void SetTransparency( sal_Bool bState ) { m_bTransparency = bState; SetModified(); } + void SetModifyDocumentOnPrintingAllowed( sal_Bool bState ) { m_bModifyDocumentOnPrintingAllowed = bState; SetModified(); } + +//------------------------------------------------------------------------------------------------------------- +// private methods +//------------------------------------------------------------------------------------------------------------- + +private: + + static Sequence< OUString > impl_GetPropertyNames(); + +//------------------------------------------------------------------------------------------------------------- +// private member +//------------------------------------------------------------------------------------------------------------- + +private: + + sal_Bool m_bPaperSize; + sal_Bool m_bPaperOrientation; + sal_Bool m_bNotFound; + sal_Bool m_bTransparency; + sal_Bool m_bModifyDocumentOnPrintingAllowed; +}; + +//_________________________________________________________________________________________________________________ +// definitions +//_________________________________________________________________________________________________________________ + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtPrintWarningOptions_Impl::SvtPrintWarningOptions_Impl() : + ConfigItem( ROOTNODE_START ), + m_bPaperSize( sal_False ), + m_bPaperOrientation( sal_False ), + m_bNotFound( sal_False ), + m_bTransparency( sal_True ), + m_bModifyDocumentOnPrintingAllowed( sal_True ) +{ + Sequence< OUString > seqNames( impl_GetPropertyNames() ); + Sequence< Any > seqValues( GetProperties( seqNames ) ); + + DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtPrintWarningOptions_Impl::SvtPrintWarningOptions_Impl()\nI miss some values of configuration keys!\n" ); + + // Copy values from list in right order to our internal member. + sal_Int32 nPropertyCount = seqValues.getLength(); + sal_Int32 nProperty = 0; + + for( nProperty=0; nProperty>= m_bPaperSize; + } + break; + + case PROPERTYHANDLE_PAPERORIENTATION: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" ); + seqValues[nProperty] >>= m_bPaperOrientation; + } + break; + + case PROPERTYHANDLE_NOTFOUND: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" ); + seqValues[nProperty] >>= m_bNotFound; + } + break; + + case PROPERTYHANDLE_TRANSPARENCY: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" ); + seqValues[nProperty] >>= m_bTransparency; + } + break; + case PROPERTYHDL_PRINTINGMODIFIESDOCUMENT: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" ); + seqValues[nProperty] >>= m_bModifyDocumentOnPrintingAllowed; + } + break; + + } + } +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtPrintWarningOptions_Impl::~SvtPrintWarningOptions_Impl() +{ + if( IsModified() ) + Commit(); +} + +//***************************************************************************************************************** +// Commit +//***************************************************************************************************************** +void SvtPrintWarningOptions_Impl::Commit() +{ + Sequence< OUString > aSeqNames( impl_GetPropertyNames() ); + Sequence< Any > aSeqValues( aSeqNames.getLength() ); + + for( sal_Int32 nProperty = 0, nCount = aSeqNames.getLength(); nProperty < nCount; ++nProperty ) + { + switch( nProperty ) + { + case PROPERTYHANDLE_PAPERSIZE: + aSeqValues[nProperty] <<= m_bPaperSize; + break; + + case PROPERTYHANDLE_PAPERORIENTATION: + aSeqValues[nProperty] <<= m_bPaperOrientation; + break; + + case PROPERTYHANDLE_NOTFOUND: + aSeqValues[nProperty] <<= m_bNotFound; + break; + + case PROPERTYHANDLE_TRANSPARENCY: + aSeqValues[nProperty] <<= m_bTransparency; + break; + case PROPERTYHDL_PRINTINGMODIFIESDOCUMENT: + aSeqValues[nProperty] <<= m_bModifyDocumentOnPrintingAllowed; + break; + } + } + + PutProperties( aSeqNames, aSeqValues ); +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Sequence< OUString > SvtPrintWarningOptions_Impl::impl_GetPropertyNames() +{ + // Build static list of configuration key names. + static const OUString pProperties[] = + { + PROPERTYNAME_PAPERSIZE, + PROPERTYNAME_PAPERORIENTATION, + PROPERTYNAME_NOTFOUND, + PROPERTYNAME_TRANSPARENCY, + PROPERTYNAME_PRINTINGMODIFIESDOCUMENT + }; + + // Initialize return sequence with these list ... + static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + + return seqPropertyNames; +} + +//***************************************************************************************************************** +// initialize static member +// DON'T DO IT IN YOUR HEADER! +// see definition for further informations +//***************************************************************************************************************** +SvtPrintWarningOptions_Impl* SvtPrintWarningOptions::m_pDataContainer = NULL; +sal_Int32 SvtPrintWarningOptions::m_nRefCount = 0; + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtPrintWarningOptions::SvtPrintWarningOptions() +{ + // Global access, must be guarded (multithreading!). + MutexGuard aGuard( GetOwnStaticMutex() ); + // Increase ouer refcount ... + ++m_nRefCount; + // ... and initialize ouer data container only if it not already! + if( m_pDataContainer == NULL ) + { + m_pDataContainer = new SvtPrintWarningOptions_Impl(); + ItemHolder1::holdConfigItem(E_PRINTWARNINGOPTIONS); + } +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtPrintWarningOptions::~SvtPrintWarningOptions() +{ + // Global access, must be guarded (multithreading!) + MutexGuard aGuard( GetOwnStaticMutex() ); + // Decrease ouer refcount. + --m_nRefCount; + // If last instance was deleted ... + // we must destroy ouer static data container! + if( m_nRefCount <= 0 ) + { + delete m_pDataContainer; + m_pDataContainer = NULL; + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtPrintWarningOptions::IsPaperSize() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsPaperSize(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtPrintWarningOptions::IsPaperOrientation() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsPaperOrientation(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtPrintWarningOptions::IsNotFound() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsNotFound(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtPrintWarningOptions::IsTransparency() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsTransparency(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtPrintWarningOptions::SetPaperSize( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetPaperSize( bState ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtPrintWarningOptions::SetPaperOrientation( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetPaperOrientation( bState ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtPrintWarningOptions::SetNotFound( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetNotFound( bState ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtPrintWarningOptions::SetTransparency( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetTransparency( bState ); +} +// ----------------------------------------------------------------------------- + +sal_Bool SvtPrintWarningOptions::IsModifyDocumentOnPrintingAllowed() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsModifyDocumentOnPrintingAllowed(); +} + +// ----------------------------------------------------------------------------- + +void SvtPrintWarningOptions::SetModifyDocumentOnPrintingAllowed( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetModifyDocumentOnPrintingAllowed( bState ) ; +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Mutex& SvtPrintWarningOptions::GetOwnStaticMutex() +{ + // Initialize static mutex only for one time! + static Mutex* pMutex = NULL; + // If these method first called (Mutex not already exist!) ... + if( pMutex == NULL ) + { + // ... we must create a new one. Protect follow code with the global mutex - + // It must be - we create a static variable! + MutexGuard aGuard( Mutex::getGlobalMutex() ); + // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! + if( pMutex == NULL ) + { + // Create the new mutex and set it for return on static variable. + static Mutex aMutex; + pMutex = &aMutex; + } + } + // Return new created or already existing mutex object. + return *pMutex; +} diff --git a/unotools/source/config/regoptions.cxx b/unotools/source/config/regoptions.cxx new file mode 100644 index 000000000000..9b1017785bd7 --- /dev/null +++ b/unotools/source/config/regoptions.cxx @@ -0,0 +1,554 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: regoptions.cxx,v $ + * $Revision: 1.8 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +#include +#include +#include +#include +#include +#include +#include + +//........................................................................ +namespace utl +{ +//........................................................................ + + using namespace ::utl; + using namespace ::com::sun::star::uno; + + //==================================================================== + //= local helpers + //==================================================================== + //-------------------------------------------------------------------- + /** converts a string representation of a date into a integer representation +

No semantic check is made, i.e. if the string describes the 40.12, this is not recognized. In opposite, + the string must have a valid structure (DD.MM.YYYY).

+ @return + the integer representation of the date which can be used with the Date class, + or 0 if the given string was no valid date representation + */ + static sal_Int32 lcl_convertString2Date( const ::rtl::OUString& _rStringRep ) + { + sal_Int32 nDateIntRep = 0; + if ( _rStringRep.getLength() == 2 + 1 + 2 + 1 + 4 ) // DD.MM.YYYY + { + // validate the string + sal_Bool bValid = sal_True; + + const sal_Unicode* pStringRep = _rStringRep.getStr(); + sal_Int32 nLen = _rStringRep.getLength(); + for ( sal_Int32 nPos = 0; + bValid && ( nPos < nLen ); + ++nPos, ++pStringRep + ) + { + if ( ( 2 == nPos ) || ( 5 == nPos ) ) + bValid = '.' == *pStringRep; // the number separators + else + bValid = ( *pStringRep >= '0' ) && ( *pStringRep <= '9' ); + } + + // passed the test? + if ( bValid ) + { + Date aDate; + aDate.SetDay ( (USHORT)_rStringRep.copy( 0, 2 ).toInt32( ) ); + aDate.SetMonth ( (USHORT)_rStringRep.copy( 3, 2 ).toInt32( ) ); + aDate.SetYear ( (USHORT)_rStringRep.copy( 6, 4 ).toInt32( ) ); + nDateIntRep = aDate.GetDate(); + } + } + + return nDateIntRep; + } + + //-------------------------------------------------------------------- + static const ::rtl::OUString& lcl_fillToken( const sal_Int32 /* [in] */ _nToken, const sal_Int16 /* [in] */ _nDigits, ::rtl::OUString& /* [out] */ _rToken ) + { + // convert into string + ::rtl::OUString sLeanToken = ::rtl::OUString::valueOf( _nToken ); + // check length + if ( sLeanToken.getLength() < _nDigits ) + { // fill + OSL_ENSURE( _nDigits <= 4, "lcl_fillToken: invalid digit number!" ); + _rToken = ::rtl::OUString( "0000", _nDigits - sLeanToken.getLength(), RTL_TEXTENCODING_ASCII_US ); + _rToken += sLeanToken; + } + else + _rToken = sLeanToken; + + return _rToken; + } + + //-------------------------------------------------------------------- + /** converts a integer representation of a date into a string representation + */ + static ::rtl::OUString lcl_ConvertDate2String( const Date& _rDate ) + { + OSL_ENSURE( _rDate.IsValid(), "lcl_ConvertDate2String: invalid integer representation!" ); + + sal_Unicode cSeparator( '.' ); + ::rtl::OUString sSeparator( &cSeparator, 1 ); + + ::rtl::OUString sStringRep; + ::rtl::OUString sToken; + sStringRep += lcl_fillToken( (sal_Int32)_rDate.GetDay(), 2, sToken ); + sStringRep += sSeparator; + sStringRep += lcl_fillToken( (sal_Int32)_rDate.GetMonth(), 2, sToken ); + sStringRep += sSeparator; + sStringRep += lcl_fillToken( (sal_Int32)_rDate.GetYear(), 4, sToken ); + + return sStringRep; + } + + //-------------------------------------------------------------------- + /// checks whether a given trigger date is reached (i.e. is _before_ the current date) + static sal_Bool lcl_reachedTriggerDate( const Date& _rTriggerDate ) + { + return _rTriggerDate <= Date(); + } + + //-------------------------------------------------------------------- + #define DECLARE_STATIC_LAZY_USTRING( name ) \ + static const ::rtl::OUString& lcl_get##name##Name() \ + { \ + static const ::rtl::OUString sName = ::rtl::OUString::createFromAscii( #name ); \ + return sName; \ + } + + DECLARE_STATIC_LAZY_USTRING( ReminderDate ); + DECLARE_STATIC_LAZY_USTRING( RequestDialog ); + DECLARE_STATIC_LAZY_USTRING( ShowMenuItem ); + DECLARE_STATIC_LAZY_USTRING( Patch ); + + //==================================================================== + //= RegOptionsImpl + //==================================================================== + class RegOptionsImpl + { + private: + OConfigurationTreeRoot m_aRegistrationNode; // the configuration node we need to access our persistent data + + String m_sRegistrationURL; // the URL to use when doing an online registration + Date m_aReminderDate; // the reminder date as found in the configuration + sal_Int32 m_nDialogCounter; // the dialog counter - see getDialogPermission + sal_Bool m_bShowMenuItem; // the flag indicating if the registration menu item is allowed + + static RegOptionsImpl* s_pSingleInstance; // the one and only instance of this class + static sal_Int32 s_nInstanceCount; // reference counter for the instances + static sal_Bool s_bThisSessionDone; // the flag indicating if for this session, everything beeing relevant has already been done + + private: + RegOptionsImpl( ); + + static ::osl::Mutex& getStaticMutex(); // get the mutex used to protect the static members of this class + + void commit( ); + sal_Int32 getBuildId() const; + + private: + RegOptions::DialogPermission implGetDialogPermission( ) const; + + public: + static RegOptionsImpl* registerClient( ); + static void revokeClient( ); + + inline sal_Bool hasURL( ) const { return ( 0 != m_sRegistrationURL.Len() ); } + inline sal_Bool allowMenu( ) const { return hasURL() && m_bShowMenuItem; } + inline String getRegistrationURL( ) const { return m_sRegistrationURL; } + + RegOptions::DialogPermission getDialogPermission( ) const; + void markSessionDone( ); + void activateReminder( sal_Int32 _nDaysFromNow ); + void removeReminder(); + bool hasReminderDateCome() const; + }; + + //-------------------------------------------------------------------- + RegOptionsImpl* RegOptionsImpl::s_pSingleInstance = NULL; + sal_Bool RegOptionsImpl::s_bThisSessionDone = sal_False; + sal_Int32 RegOptionsImpl::s_nInstanceCount = 0; + + //-------------------------------------------------------------------- + ::osl::Mutex& RegOptionsImpl::getStaticMutex() + { + static ::osl::Mutex* s_pStaticMutex = NULL; + if ( !s_pStaticMutex ) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + if ( !s_pStaticMutex ) + { + static ::osl::Mutex s_aStaticMutex; + s_pStaticMutex = &s_aStaticMutex; + } + } + return *s_pStaticMutex; + } + + //-------------------------------------------------------------------- + void RegOptionsImpl::commit( ) + { + m_aRegistrationNode.commit( ); + } + + //-------------------------------------------------------------------- + RegOptionsImpl* RegOptionsImpl::registerClient( ) + { + ::osl::MutexGuard aGuard( getStaticMutex() ); + + if ( !s_pSingleInstance ) + s_pSingleInstance = new RegOptionsImpl; + + ++s_nInstanceCount; + return s_pSingleInstance; + } + + //-------------------------------------------------------------------- + void RegOptionsImpl::revokeClient( ) + { + ::osl::MutexGuard aGuard( getStaticMutex() ); + OSL_ENSURE( s_nInstanceCount, "RegOptionsImpl::revokeClient: there are no clients alive!" ); + OSL_ENSURE( s_pSingleInstance || !s_nInstanceCount, "RegOptionsImpl::revokeClient: invalid instance pointer!" ); + + if ( s_nInstanceCount ) + { + if ( s_pSingleInstance ) + // commit the changes done by this client + s_pSingleInstance->commit(); + + if ( 0 == --s_nInstanceCount ) + { + delete s_pSingleInstance; + s_pSingleInstance = NULL; + } + } + } + + //-------------------------------------------------------------------- + RegOptionsImpl::RegOptionsImpl( ) + :m_nDialogCounter ( 0 ) + ,m_bShowMenuItem ( sal_False ) + { + // create the config node for all our registration information + m_aRegistrationNode = OConfigurationTreeRoot::createWithServiceFactory( + ::comphelper::getProcessServiceFactory(), + ::rtl::OUString::createFromAscii( "/org.openoffice.Office.Common/Help/Registration" ) + ); + + // cache some data + //the URL to use for online registration + ::rtl::OUString sStringValue; + m_aRegistrationNode.getNodeValue( ::rtl::OUString::createFromAscii( "URL" ) ) >>= sStringValue; + m_sRegistrationURL = sStringValue; + + // the state of the dialog + m_aRegistrationNode.getNodeValue( lcl_getRequestDialogName() ) >>= m_nDialogCounter; + + // the flag for showing the menu item + sal_Bool bBoolValue = sal_False; + m_aRegistrationNode.getNodeValue( lcl_getShowMenuItemName() ) >>= bBoolValue; + m_bShowMenuItem = bBoolValue; + + // the reminder date (if any) + sal_Int32 nIntDate = 0; + sStringValue = ::rtl::OUString(); + m_aRegistrationNode.getNodeValue( lcl_getReminderDateName() ) >>= sStringValue; + bool bIsPatchDate = ( sStringValue.equals( lcl_getPatchName() ) != sal_False ); + if ( !bIsPatchDate && sStringValue.getLength() ) + nIntDate = lcl_convertString2Date( sStringValue ); + m_aReminderDate.SetDate( nIntDate ); + } + + //-------------------------------------------------------------------- + RegOptions::DialogPermission RegOptionsImpl::implGetDialogPermission( ) const + { + RegOptions::DialogPermission eResult = RegOptions::dpDisabled; + // no URL or a counter already decreased to zero means the dialog is disabled + if ( hasURL() && ( m_nDialogCounter > 0 ) ) + { + // during every session, the counter will be decreased + // If it reaches zero, the dialog shall be executed + if ( 1 == m_nDialogCounter ) + { + if ( m_aReminderDate.IsValid( ) ) + { // valid reminder date + // assume remind later + eResult = RegOptions::dpRemindLater; + // and check if we reached the reminder date + if ( lcl_reachedTriggerDate( m_aReminderDate ) ) + eResult = RegOptions::dpThisSession; + } + else + eResult = RegOptions::dpThisSession; // execute in this session + } + else + eResult = RegOptions::dpNotThisSession; // first trigger session not reached + + // a last check .... + if ( ( s_bThisSessionDone ) // this session is already marked as "done" + && ( RegOptions::dpThisSession == eResult )// but without this, the state would be "now" + ) + eResult = RegOptions::dpDisabled; // -> change state to "disabled" + } + + return eResult; + } + + //-------------------------------------------------------------------- + RegOptions::DialogPermission RegOptionsImpl::getDialogPermission( ) const + { + OSL_ENSURE( !s_bThisSessionDone, "RegOptionsImpl::getDialogPermission: should never be asked in this session, again!" ); + // Somebody already marked this session as "everything relevant happened". So why sombody (else?) asks + // me again? + + return implGetDialogPermission( ); + } + + //-------------------------------------------------------------------- + void RegOptionsImpl::activateReminder( sal_Int32 _nDaysFromNow ) + { + OSL_ENSURE( s_bThisSessionDone || ( implGetDialogPermission( ) != RegOptions::dpDisabled ), "RegOptionsImpl::activateReminder: invalid call!" ); + OSL_ENSURE( _nDaysFromNow > 0, "RegOptionsImpl::activateReminder: invalid argument!" ); + + // calc the reminder + m_aReminderDate = Date() + _nDaysFromNow; // today (default ctor) + days + + // remember the date + m_aRegistrationNode.setNodeValue( + lcl_getReminderDateName(), + makeAny( lcl_ConvertDate2String( m_aReminderDate ) ) + ); + // to be on the save side, write the counter + m_aRegistrationNode.setNodeValue( + lcl_getRequestDialogName(), + makeAny( (sal_Int32)1 ) + ); + + // mark this session as done + if ( !s_bThisSessionDone ) + markSessionDone( ); + } + + //-------------------------------------------------------------------- + void RegOptionsImpl::removeReminder() + { + ::rtl::OUString aDefault; + ::rtl::OUString aReminderValue( lcl_getPatchName() ); + aReminderValue += ::rtl::OUString::valueOf(getBuildId()); + + m_aRegistrationNode.setNodeValue( + lcl_getReminderDateName(), + Any( aReminderValue ) + ); + } + + //-------------------------------------------------------------------- + sal_Int32 RegOptionsImpl::getBuildId() const + { + sal_Int32 nBuildId( 0 ); + ::rtl::OUString aDefault; + ::rtl::OUString aBuildIdData = utl::Bootstrap::getBuildIdData( aDefault ); + sal_Int32 nIndex1 = aBuildIdData.indexOf(':'); + sal_Int32 nIndex2 = aBuildIdData.indexOf(')'); + if (( nIndex1 > 0 ) && ( nIndex2 > 0 ) && ( nIndex2-1 > nIndex1+1 )) + { + ::rtl::OUString aBuildId = aBuildIdData.copy( nIndex1+1, nIndex2-nIndex1-1 ); + nBuildId = aBuildId.toInt32(); + } + + return nBuildId; + } + + //-------------------------------------------------------------------- + bool RegOptionsImpl::hasReminderDateCome() const + { + bool bRet = false; + sal_Int32 nDate = 0; + ::rtl::OUString sDate; + m_aRegistrationNode.getNodeValue( lcl_getReminderDateName() ) >>= sDate; + if ( sDate.getLength() ) + { + if ( sDate.indexOf( lcl_getPatchName() ) == 0) + { + if (sDate.equals( lcl_getPatchName() )) + bRet = true; + else if (sDate.getLength() > lcl_getPatchName().getLength() ) + { + // Check the build ID to determine if the registration + // dialog needs to be shown. + sal_Int32 nBuildId = getBuildId(); + ::rtl::OUString aStoredBuildId( sDate.copy(lcl_getPatchName().getLength())); + + // remind if the current build ID is not the same as the stored one + if ( nBuildId != aStoredBuildId.toInt32() ) + bRet = true; + } + } + else + { + nDate = lcl_convertString2Date( sDate ); + if ( nDate > 0 ) + { + Date aReminderDate; + aReminderDate.SetDate( nDate ); + bRet = aReminderDate <= Date(); + } + } + } + else + bRet = true; + + return bRet; + } + + //-------------------------------------------------------------------- + void RegOptionsImpl::markSessionDone( ) + { + OSL_ENSURE( !s_bThisSessionDone, "RegOptionsImpl::markSessionDone: already marked!" ); + OSL_ENSURE( implGetDialogPermission( ) != RegOptions::dpDisabled, "RegOptionsImpl::markSessionDone: invalid call!" ); + if ( !s_bThisSessionDone ) + { + RegOptions::DialogPermission eOldPermission = implGetDialogPermission( ); + + s_bThisSessionDone = sal_True; + + if ( RegOptions::dpRemindLater == eOldPermission ) + { // no action required. If we shall remind later, the counter is already at 1, we should not change this, + // as the next smaller number (which is 0 :) means that the dialog would be disabled + OSL_ENSURE( 1 == m_nDialogCounter, "RegOptionsImpl::markSessionDone: invalid session counter (1)!" ); + } + else + { + OSL_ENSURE( m_nDialogCounter > 0, "RegOptionsImpl::markSessionDone: invalid session counter (2)!" ); + --m_nDialogCounter; + + // decrease the session counter + m_aRegistrationNode.setNodeValue( + lcl_getRequestDialogName(), + makeAny( (sal_Int32)m_nDialogCounter ) + ); + + // and clear the reminder date + removeReminder(); + } + } + } + + //==================================================================== + //= RegOptions + //==================================================================== + //-------------------------------------------------------------------- + RegOptions::RegOptions() + :m_pImpl( NULL ) + { + } + + //-------------------------------------------------------------------- + void RegOptions::ensureImpl( ) + { + if ( !m_pImpl ) + m_pImpl = RegOptionsImpl::registerClient(); + } + + //-------------------------------------------------------------------- + RegOptions::~RegOptions() + { + if ( m_pImpl ) + { + RegOptionsImpl::revokeClient(); + m_pImpl = NULL; + } + } + + //-------------------------------------------------------------------- + String RegOptions::getRegistrationURL( ) const + { + const_cast< RegOptions* >( this )->ensureImpl( ); + return m_pImpl->getRegistrationURL(); + } + + //-------------------------------------------------------------------- + RegOptions::DialogPermission RegOptions::getDialogPermission( ) const + { + const_cast< RegOptions* >( this )->ensureImpl( ); + return m_pImpl->getDialogPermission(); + } + + //-------------------------------------------------------------------- + void RegOptions::markSessionDone( ) + { + const_cast< RegOptions* >( this )->ensureImpl( ); + m_pImpl->markSessionDone(); + } + + //-------------------------------------------------------------------- + void RegOptions::activateReminder( sal_Int32 _nDaysFromNow ) + { + const_cast< RegOptions* >( this )->ensureImpl( ); + m_pImpl->activateReminder( _nDaysFromNow ); + } + + //-------------------------------------------------------------------- + sal_Bool RegOptions::allowMenu( ) const + { + /// we cache this setting, 'cause it is needed very often + static sal_Bool bKnowMenuPermission = sal_False; + static sal_Bool bAllowMenu = sal_False; + + if ( !bKnowMenuPermission ) + { + const_cast< RegOptions* >( this )->ensureImpl( ); + bAllowMenu = m_pImpl->allowMenu(); + bKnowMenuPermission = sal_True; + } + return bAllowMenu; + } + + //-------------------------------------------------------------------- + void RegOptions::removeReminder() + { + const_cast< RegOptions* >( this )->ensureImpl( ); + m_pImpl->removeReminder(); + } + + //-------------------------------------------------------------------- + bool RegOptions::hasReminderDateCome() const + { + const_cast< RegOptions* >( this )->ensureImpl( ); + return m_pImpl->hasReminderDateCome(); + } + +//........................................................................ +} // namespace utl +//........................................................................ + diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx new file mode 100644 index 000000000000..49e01c0457e9 --- /dev/null +++ b/unotools/source/config/saveopt.cxx @@ -0,0 +1,1047 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: saveopt.cxx,v $ + * $Revision: 1.36 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" + +#ifndef GCC +#endif + +#include +#include "rtl/instance.hxx" +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include "itemholder1.hxx" + +using namespace utl; +using namespace rtl; +using namespace com::sun::star::uno; +namespace css = ::com::sun::star; + +class SvtSaveOptions_Impl; +class SvtLoadOptions_Impl; + +#define CFG_READONLY_DEFAULT sal_False + +struct SvtLoadSaveOptions_Impl +{ + SvtSaveOptions_Impl* pSaveOpt; + SvtLoadOptions_Impl* pLoadOpt; +}; + +static SvtLoadSaveOptions_Impl* pOptions = NULL; +static sal_Int32 nRefCount = 0; + +class SvtSaveOptions_Impl : public utl::ConfigItem +{ + sal_Int32 nAutoSaveTime; + sal_Bool bUseUserData, + bBackup, + bAutoSave, + bAutoSavePrompt, + bDocInfSave, + bSaveWorkingSet, + bSaveDocWins, + bSaveDocView, + bSaveRelINet, + bSaveRelFSys, + bSaveUnpacked, + bDoPrettyPrinting, + bWarnAlienFormat, + bLoadDocPrinter; + + sal_Bool bROAutoSaveTime, + bROUseUserData, + bROBackup, + bROAutoSave, + bROAutoSavePrompt, + bRODocInfSave, + bROSaveWorkingSet, + bROSaveDocWins, + bROSaveDocView, + bROSaveRelINet, + bROSaveRelFSys, + bROSaveUnpacked, + bROWarnAlienFormat, + bRODoPrettyPrinting, + bROLoadDocPrinter, + bROODFDefaultVersion; + + SvtSaveOptions::ODFDefaultVersion eODFDefaultVersion; + +public: + SvtSaveOptions_Impl(); + ~SvtSaveOptions_Impl(); + + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); + virtual void Commit(); + + sal_Int32 GetAutoSaveTime() const { return nAutoSaveTime; } + BOOL IsUseUserData() const { return bUseUserData; } + BOOL IsBackup() const { return bBackup; } + BOOL IsAutoSave() const { return bAutoSave; } + BOOL IsAutoSavePrompt() const { return bAutoSavePrompt; } + BOOL IsDocInfoSave() const { return bDocInfSave; } + BOOL IsSaveWorkingSet() const { return bSaveWorkingSet; } + BOOL IsSaveDocWins() const { return bSaveDocWins; } + BOOL IsSaveDocView() const { return bSaveDocView; } + BOOL IsSaveRelINet() const { return bSaveRelINet; } + BOOL IsSaveRelFSys() const { return bSaveRelFSys; } + BOOL IsSaveUnpacked() const { return bSaveUnpacked; } + sal_Bool IsPrettyPrintingEnabled( ) const { return bDoPrettyPrinting; } + sal_Bool IsWarnAlienFormat() const { return bWarnAlienFormat; } + sal_Bool IsLoadDocPrinter() const { return bLoadDocPrinter; } + SvtSaveOptions::ODFDefaultVersion + GetODFDefaultVersion() const { return eODFDefaultVersion; } + + void SetAutoSaveTime( sal_Int32 n ); + void SetUseUserData( BOOL b ); + void SetBackup( BOOL b ); + void SetAutoSave( BOOL b ); + void SetAutoSavePrompt( BOOL b ); + void SetDocInfoSave( BOOL b ); + void SetSaveWorkingSet( BOOL b ); + void SetSaveDocWins( BOOL b ); + void SetSaveDocView( BOOL b ); + void SetSaveRelINet( BOOL b ); + void SetSaveRelFSys( BOOL b ); + void SetSaveUnpacked( BOOL b ); + void EnablePrettyPrinting( sal_Bool _bDoPP ); + void SetWarnAlienFormat( sal_Bool _bDoPP ); + void SetLoadDocPrinter( sal_Bool bNew ); + void SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew ); + + sal_Bool IsReadOnly( SvtSaveOptions::EOption eOption ) const; +}; + +void SvtSaveOptions_Impl::SetAutoSaveTime( sal_Int32 n ) +{ + if (!bROAutoSaveTime && nAutoSaveTime!=n) + { + nAutoSaveTime = n; + SetModified(); + Commit(); + } +} + +void SvtSaveOptions_Impl::SetUseUserData( BOOL b ) +{ + if (!bROUseUserData && bUseUserData!=b) + { + bUseUserData = b; + SetModified(); + } +} + +void SvtSaveOptions_Impl::SetBackup( BOOL b ) +{ + if (!bROBackup && bBackup!=b) + { + bBackup = b; + SetModified(); + } +} + +void SvtSaveOptions_Impl::SetAutoSave( BOOL b ) +{ + if (!bROAutoSave && bAutoSave!=b) + { + bAutoSave = b; + SetModified(); + Commit(); + } +} + +void SvtSaveOptions_Impl::SetAutoSavePrompt( BOOL b ) +{ + if (!bROAutoSavePrompt && bAutoSavePrompt!=b) + { + bAutoSavePrompt = b; + SetModified(); + } +} + +void SvtSaveOptions_Impl::SetDocInfoSave(BOOL b) +{ + if (!bRODocInfSave && bDocInfSave!=b) + { + bDocInfSave = b; + SetModified(); + } +} + +void SvtSaveOptions_Impl::SetSaveWorkingSet( BOOL b ) +{ + if (!bROSaveWorkingSet && bSaveWorkingSet!=b) + { + bSaveWorkingSet = b; + SetModified(); + } +} + +void SvtSaveOptions_Impl::SetSaveDocWins( BOOL b ) +{ + if (!bROSaveDocWins && bSaveDocWins!=b) + { + bSaveDocWins = b; + SetModified(); + } +} + +void SvtSaveOptions_Impl::SetSaveDocView( BOOL b ) +{ + if (!bROSaveDocView && bSaveDocView!=b) + { + bSaveDocView = b; + SetModified(); + } +} + +void SvtSaveOptions_Impl::SetSaveRelINet( BOOL b ) +{ + if (!bROSaveRelINet && bSaveRelINet!=b) + { + bSaveRelINet = b; + SetModified(); + } +} + +void SvtSaveOptions_Impl::SetSaveRelFSys( BOOL b ) +{ + if (!bROSaveRelFSys && bSaveRelFSys!=b) + { + bSaveRelFSys = b; + SetModified(); + } +} + +void SvtSaveOptions_Impl::SetSaveUnpacked( BOOL b ) +{ + if (!bROSaveUnpacked && bSaveUnpacked!=b) + { + bSaveUnpacked = b; + SetModified(); + } +} + +void SvtSaveOptions_Impl::EnablePrettyPrinting( sal_Bool _bDoPP ) +{ + if (!bRODoPrettyPrinting && bDoPrettyPrinting!=_bDoPP) + { + bDoPrettyPrinting = _bDoPP; + SetModified(); + } +} + +void SvtSaveOptions_Impl::SetWarnAlienFormat( sal_Bool _bDoPP ) +{ + if (!bROWarnAlienFormat && bWarnAlienFormat!=_bDoPP) + { + bWarnAlienFormat = _bDoPP; + SetModified(); + } +} + +void SvtSaveOptions_Impl::SetLoadDocPrinter( sal_Bool bNew ) +{ + if ( !bROLoadDocPrinter && bLoadDocPrinter != bNew ) + { + bLoadDocPrinter = bNew; + SetModified(); + } +} + +void SvtSaveOptions_Impl::SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew ) +{ + if ( !bROODFDefaultVersion && eODFDefaultVersion != eNew ) + { + eODFDefaultVersion = eNew; + SetModified(); + } +} + +sal_Bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) const +{ + sal_Bool bReadOnly = CFG_READONLY_DEFAULT; + switch(eOption) + { + case SvtSaveOptions::E_AUTOSAVETIME : + bReadOnly = bROAutoSaveTime; + break; + case SvtSaveOptions::E_USEUSERDATA : + bReadOnly = bROUseUserData; + break; + case SvtSaveOptions::E_BACKUP : + bReadOnly = bROBackup; + break; + case SvtSaveOptions::E_AUTOSAVE : + bReadOnly = bROAutoSave; + break; + case SvtSaveOptions::E_AUTOSAVEPROMPT : + bReadOnly = bROAutoSavePrompt; + break; + case SvtSaveOptions::E_DOCINFSAVE : + bReadOnly = bRODocInfSave; + break; + case SvtSaveOptions::E_SAVEWORKINGSET : + bReadOnly = bROSaveWorkingSet; + break; + case SvtSaveOptions::E_SAVEDOCWINS : + bReadOnly = bROSaveDocWins; + break; + case SvtSaveOptions::E_SAVEDOCVIEW : + bReadOnly = bROSaveDocView; + break; + case SvtSaveOptions::E_SAVERELINET : + bReadOnly = bROSaveRelINet; + break; + case SvtSaveOptions::E_SAVERELFSYS : + bReadOnly = bROSaveRelFSys; + break; + case SvtSaveOptions::E_SAVEUNPACKED : + bReadOnly = bROSaveUnpacked; + break; + case SvtSaveOptions::E_DOPRETTYPRINTING : + bReadOnly = bRODoPrettyPrinting; + break; + case SvtSaveOptions::E_WARNALIENFORMAT : + bReadOnly = bROWarnAlienFormat; + break; + case SvtSaveOptions::E_LOADDOCPRINTER : + bReadOnly = bROLoadDocPrinter; + break; + case SvtSaveOptions::E_ODFDEFAULTVERSION : + bReadOnly = bROLoadDocPrinter; + break; + } + return bReadOnly; +} + +#define FORMAT 0 +#define TIMEINTERVALL 1 +#define USEUSERDATA 2 +#define CREATEBACKUP 3 +#define AUTOSAVE 4 +#define PROMPT 5 +#define EDITPROPERTY 6 +#define SAVEDOCWINS 7 +#define SAVEVIEWINFO 8 +#define UNPACKED 9 +#define PRETTYPRINTING 10 +#define WARNALIENFORMAT 11 +#define LOADDOCPRINTER 12 +#define FILESYSTEM 13 +#define INTERNET 14 +#define SAVEWORKINGSET 15 +#define ODFDEFAULTVERSION 16 + +Sequence< OUString > GetPropertyNames() +{ + static const char* aPropNames[] = + { + "Graphic/Format", + "Document/AutoSaveTimeIntervall", + "Document/UseUserData", + "Document/CreateBackup", + "Document/AutoSave", + "Document/AutoSavePrompt", + "Document/EditProperty", + "Document/DocumentWindows", + "Document/ViewInfo", + "Document/Unpacked", + "Document/PrettyPrinting", + "Document/WarnAlienFormat", + "Document/LoadPrinter", + "URL/FileSystem", + "URL/Internet", + "WorkingSet", + "ODF/DefaultVersion" + }; + + const int nCount = sizeof( aPropNames ) / sizeof( const char* ); + Sequence< OUString > aNames( nCount ); + OUString* pNames = aNames.getArray(); + for ( int i = 0; i < nCount; i++ ) + pNames[i] = OUString::createFromAscii( aPropNames[i] ); + + return aNames; +} + +// ----------------------------------------------------------------------- + +SvtSaveOptions_Impl::SvtSaveOptions_Impl() + : ConfigItem( OUString::createFromAscii("Office.Common/Save") ) + , nAutoSaveTime( 0 ) + , bUseUserData( sal_False ) + , bBackup( sal_False ) + , bAutoSave( sal_False ) + , bAutoSavePrompt( sal_False ) + , bDocInfSave( sal_False ) + , bSaveWorkingSet( sal_False ) + , bSaveDocWins( sal_False ) + , bSaveDocView( sal_False ) + , bSaveRelINet( sal_False ) + , bSaveRelFSys( sal_False ) + , bSaveUnpacked( sal_False ) + , bDoPrettyPrinting( sal_False ) + , bWarnAlienFormat( sal_True ) + , bLoadDocPrinter( sal_True ) + , bROAutoSaveTime( CFG_READONLY_DEFAULT ) + , bROUseUserData( CFG_READONLY_DEFAULT ) + , bROBackup( CFG_READONLY_DEFAULT ) + , bROAutoSave( CFG_READONLY_DEFAULT ) + , bROAutoSavePrompt( CFG_READONLY_DEFAULT ) + , bRODocInfSave( CFG_READONLY_DEFAULT ) + , bROSaveWorkingSet( CFG_READONLY_DEFAULT ) + , bROSaveDocWins( CFG_READONLY_DEFAULT ) + , bROSaveDocView( CFG_READONLY_DEFAULT ) + , bROSaveRelINet( CFG_READONLY_DEFAULT ) + , bROSaveRelFSys( CFG_READONLY_DEFAULT ) + , bROSaveUnpacked( CFG_READONLY_DEFAULT ) + , bROWarnAlienFormat( CFG_READONLY_DEFAULT ) + , bRODoPrettyPrinting( CFG_READONLY_DEFAULT ) + , bROLoadDocPrinter( CFG_READONLY_DEFAULT ) + , bROODFDefaultVersion( CFG_READONLY_DEFAULT ) + , eODFDefaultVersion( SvtSaveOptions::ODFVER_LATEST ) +{ + Sequence< OUString > aNames = GetPropertyNames(); + Sequence< Any > aValues = GetProperties( aNames ); + Sequence< sal_Bool > aROStates = GetReadOnlyStates( aNames ); + EnableNotification( aNames ); + const Any* pValues = aValues.getConstArray(); + const sal_Bool* pROStates = aROStates.getConstArray(); + DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" ); + DBG_ASSERT( aROStates.getLength() == aNames.getLength(), "GetReadOnlyStates failed" ); + if ( aValues.getLength() == aNames.getLength() && aROStates.getLength() == aNames.getLength() ) + { + for ( int nProp = 0; nProp < aNames.getLength(); nProp++ ) + { + DBG_ASSERT( pValues[nProp].hasValue(), "property value missing" ); + if ( pValues[nProp].hasValue() ) + { + sal_Int32 nTemp = 0; + switch ( nProp ) + { + case FORMAT: + // not supported anymore + break; + + case TIMEINTERVALL : + if ( pValues[nProp] >>= nTemp ) + nAutoSaveTime = nTemp; + else { + DBG_ERROR( "Wrong Type!" ); + }; + bROAutoSaveTime = pROStates[nProp]; + break; + + case ODFDEFAULTVERSION : + { + sal_Int16 nTmp = 0; + if ( pValues[nProp] >>= nTmp ) + { + if( nTmp == 3 ) + eODFDefaultVersion = SvtSaveOptions::ODFVER_LATEST; + else + eODFDefaultVersion = SvtSaveOptions::ODFDefaultVersion( nTmp ); + } + else { + DBG_ERRORFILE( "SvtSaveOptions_Impl::SvtSaveOptions_Impl(): Wrong Type!" ); + }; + bROODFDefaultVersion = pROStates[nProp]; + break; + } + + default: + { + sal_Bool bTemp = sal_Bool(); + if ( pValues[nProp] >>= bTemp ) + { + switch ( nProp ) + { + case USEUSERDATA : + bUseUserData = bTemp; + bROUseUserData = pROStates[nProp]; + break; + case CREATEBACKUP : + bBackup = bTemp; + bROBackup = pROStates[nProp]; + break; + case AUTOSAVE : + bAutoSave = bTemp; + bROAutoSave = pROStates[nProp]; + break; + case PROMPT : + bAutoSavePrompt = bTemp; + bROAutoSavePrompt = pROStates[nProp]; + break; + case EDITPROPERTY : + bDocInfSave = bTemp; + bRODocInfSave = pROStates[nProp]; + break; + case SAVEWORKINGSET : + bSaveWorkingSet = bTemp; + bROSaveWorkingSet = pROStates[nProp]; + break; + case SAVEDOCWINS : + bSaveDocWins = bTemp; + bROSaveDocWins = pROStates[nProp]; + break; + case SAVEVIEWINFO : + bSaveDocView = bTemp; + bROSaveDocView = pROStates[nProp]; + break; + case FILESYSTEM : + bSaveRelFSys = bTemp; + bROSaveRelFSys = pROStates[nProp]; + break; + case INTERNET : + bSaveRelINet = bTemp; + bROSaveRelINet = pROStates[nProp]; + break; + case UNPACKED : + bSaveUnpacked = bTemp; + bROSaveUnpacked = pROStates[nProp]; + break; + + case PRETTYPRINTING: + bDoPrettyPrinting = bTemp; + bRODoPrettyPrinting = pROStates[nProp]; + break; + + case WARNALIENFORMAT: + bWarnAlienFormat = bTemp; + bROWarnAlienFormat = pROStates[nProp]; + break; + + case LOADDOCPRINTER: + bLoadDocPrinter = bTemp; + bROLoadDocPrinter = pROStates[nProp]; + break; + + default : + DBG_ERRORFILE( "invalid index to load a path" ); + } + } + else + { + DBG_ERROR( "Wrong Type!" ); + } + } + } + } + } + } + + try + { + css::uno::Reference< css::uno::XInterface > xCFG = ::comphelper::ConfigurationHelper::openConfig( + ::utl::getProcessServiceFactory(), + ::rtl::OUString::createFromAscii("org.openoffice.Office.Recovery"), + ::comphelper::ConfigurationHelper::E_READONLY); + + ::comphelper::ConfigurationHelper::readRelativeKey( + xCFG, + ::rtl::OUString::createFromAscii("AutoSave"), + ::rtl::OUString::createFromAscii("Enabled")) >>= bAutoSave; + + ::comphelper::ConfigurationHelper::readRelativeKey( + xCFG, + ::rtl::OUString::createFromAscii("AutoSave"), + ::rtl::OUString::createFromAscii("TimeIntervall")) >>= nAutoSaveTime; + } + catch(const css::uno::Exception&) + { DBG_ERROR("Could not find needed informations for AutoSave feature."); } +} + +SvtSaveOptions_Impl::~SvtSaveOptions_Impl() +{} + +void SvtSaveOptions_Impl::Commit() +{ + Sequence< OUString > aOrgNames = GetPropertyNames(); + OUString* pOrgNames = aOrgNames.getArray(); + sal_Int32 nOrgCount = aOrgNames.getLength(); + + Sequence< OUString > aNames( nOrgCount ); + Sequence< Any > aValues( nOrgCount ); + OUString* pNames = aNames.getArray(); + Any* pValues = aValues.getArray(); + sal_Int32 nRealCount = 0; + + for (sal_Int32 i=0; i xCFG = ::comphelper::ConfigurationHelper::openConfig( + ::utl::getProcessServiceFactory(), + ::rtl::OUString::createFromAscii("org.openoffice.Office.Recovery"), + ::comphelper::ConfigurationHelper::E_STANDARD); + + ::comphelper::ConfigurationHelper::writeRelativeKey( + xCFG, + ::rtl::OUString::createFromAscii("AutoSave"), + ::rtl::OUString::createFromAscii("TimeIntervall"), + css::uno::makeAny(nAutoSaveTime)); + + ::comphelper::ConfigurationHelper::writeRelativeKey( + xCFG, + ::rtl::OUString::createFromAscii("AutoSave"), + ::rtl::OUString::createFromAscii("Enabled"), + css::uno::makeAny(bAutoSave)); + + ::comphelper::ConfigurationHelper::flush(xCFG); +} + +// ----------------------------------------------------------------------- + +void SvtSaveOptions_Impl::Notify( const Sequence& ) +{ +} + + +class SvtLoadOptions_Impl : public utl::ConfigItem +{ + + sal_Bool bLoadUserDefinedSettings; + +public: + SvtLoadOptions_Impl(); + ~SvtLoadOptions_Impl(); + + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); + virtual void Commit(); + + void SetLoadUserSettings(sal_Bool b){bLoadUserDefinedSettings = b; SetModified();} + sal_Bool IsLoadUserSettings() const {return bLoadUserDefinedSettings;} +}; +// ----------------------------------------------------------------------- +const sal_Char cUserDefinedSettings[] = "UserDefinedSettings"; + +SvtLoadOptions_Impl::SvtLoadOptions_Impl() + : ConfigItem( OUString::createFromAscii("Office.Common/Load") ) + , bLoadUserDefinedSettings( sal_False ) +{ + Sequence< OUString > aNames(1); + aNames[0] = OUString::createFromAscii(cUserDefinedSettings); + Sequence< Any > aValues = GetProperties( aNames ); + EnableNotification( aNames ); + const Any* pValues = aValues.getConstArray(); + DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" ); + if (pValues[0].getValueTypeClass() == ::com::sun::star::uno::TypeClass_BOOLEAN) + bLoadUserDefinedSettings = *(sal_Bool *)pValues[0].getValue(); +} +// ----------------------------------------------------------------------- +SvtLoadOptions_Impl::~SvtLoadOptions_Impl() +{ +} +// ----------------------------------------------------------------------- +void SvtLoadOptions_Impl::Commit() +{ + Sequence< OUString > aNames(1); + aNames[0] = OUString::createFromAscii(cUserDefinedSettings); + Sequence< Any > aValues( 1 ); + aValues[0].setValue(&bLoadUserDefinedSettings, ::getBooleanCppuType()); + PutProperties( aNames, aValues ); +} +// ----------------------------------------------------------------------- +void SvtLoadOptions_Impl::Notify( const Sequence& ) +{ + DBG_ERRORFILE( "properties have been changed" ); +} +// ----------------------------------------------------------------------- + +namespace +{ + class LocalSingleton : public rtl::Static< osl::Mutex, LocalSingleton > + { + }; +} + +// ----------------------------------------------------------------------- +SvtSaveOptions::SvtSaveOptions() +{ + // Global access, must be guarded (multithreading) + ::osl::MutexGuard aGuard( LocalSingleton::get() ); + if ( !pOptions ) + { + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtSaveOptions_Impl::ctor()"); + pOptions = new SvtLoadSaveOptions_Impl; + pOptions->pSaveOpt = new SvtSaveOptions_Impl; + pOptions->pLoadOpt = new SvtLoadOptions_Impl; + + ItemHolder1::holdConfigItem(E_SAVEOPTIONS); + } + ++nRefCount; + pImp = pOptions; +} + +// ----------------------------------------------------------------------- + +SvtSaveOptions::~SvtSaveOptions() +{ + // Global access, must be guarded (multithreading) + ::osl::MutexGuard aGuard( LocalSingleton::get() ); + if ( !--nRefCount ) + { + if ( pOptions->pSaveOpt->IsModified() ) + pOptions->pSaveOpt->Commit(); + if ( pOptions->pLoadOpt->IsModified() ) + pOptions->pLoadOpt->Commit(); + + DELETEZ( pOptions->pLoadOpt ); + DELETEZ( pOptions->pSaveOpt ); + DELETEZ( pOptions ); + } +} + +void SvtSaveOptions::SetAutoSaveTime( sal_Int32 n ) +{ + pImp->pSaveOpt->SetAutoSaveTime( n ); +} + +sal_Int32 SvtSaveOptions::GetAutoSaveTime() const +{ + return pImp->pSaveOpt->GetAutoSaveTime(); +} + +void SvtSaveOptions::SetUseUserData( sal_Bool b ) +{ + pImp->pSaveOpt->SetUseUserData( b ); +} + +sal_Bool SvtSaveOptions::IsUseUserData() const +{ + return pImp->pSaveOpt->IsUseUserData(); +} + +void SvtSaveOptions::SetBackup( sal_Bool b ) +{ + pImp->pSaveOpt->SetBackup( b ); +} + +sal_Bool SvtSaveOptions::IsBackup() const +{ + return pImp->pSaveOpt->IsBackup(); +} + +void SvtSaveOptions::SetAutoSave( sal_Bool b ) +{ + pImp->pSaveOpt->SetAutoSave( b ); +} + +sal_Bool SvtSaveOptions::IsAutoSave() const +{ + return pImp->pSaveOpt->IsAutoSave(); +} + +void SvtSaveOptions::SetAutoSavePrompt( sal_Bool b ) +{ + pImp->pSaveOpt->SetAutoSavePrompt( b ); +} + +sal_Bool SvtSaveOptions::IsAutoSavePrompt() const +{ + return pImp->pSaveOpt->IsAutoSavePrompt(); +} + +void SvtSaveOptions::SetDocInfoSave(sal_Bool b) +{ + pImp->pSaveOpt->SetDocInfoSave( b ); +} + +sal_Bool SvtSaveOptions::IsDocInfoSave() const +{ + return pImp->pSaveOpt->IsDocInfoSave(); +} + +void SvtSaveOptions::SetSaveWorkingSet( sal_Bool b ) +{ + pImp->pSaveOpt->SetSaveWorkingSet( b ); +} + +sal_Bool SvtSaveOptions::IsSaveWorkingSet() const +{ + return pImp->pSaveOpt->IsSaveWorkingSet(); +} + +void SvtSaveOptions::SetSaveDocWins( sal_Bool b ) +{ + pImp->pSaveOpt->SetSaveDocWins( b ); +} + +sal_Bool SvtSaveOptions::IsSaveDocWins() const +{ + return pImp->pSaveOpt->IsSaveDocWins(); +} + +void SvtSaveOptions::SetSaveDocView( sal_Bool b ) +{ + pImp->pSaveOpt->SetSaveDocView( b ); +} + +sal_Bool SvtSaveOptions::IsSaveDocView() const +{ + return pImp->pSaveOpt->IsSaveDocView(); +} + +void SvtSaveOptions::SetSaveRelINet( sal_Bool b ) +{ + pImp->pSaveOpt->SetSaveRelINet( b ); +} + +sal_Bool SvtSaveOptions::IsSaveRelINet() const +{ + return pImp->pSaveOpt->IsSaveRelINet(); +} + +void SvtSaveOptions::SetSaveRelFSys( sal_Bool b ) +{ + pImp->pSaveOpt->SetSaveRelFSys( b ); +} + +sal_Bool SvtSaveOptions::IsSaveRelFSys() const +{ + return pImp->pSaveOpt->IsSaveRelFSys(); +} + +void SvtSaveOptions::SetSaveUnpacked( sal_Bool b ) +{ + pImp->pSaveOpt->SetSaveUnpacked( b ); +} + +sal_Bool SvtSaveOptions::IsSaveUnpacked() const +{ + return pImp->pSaveOpt->IsSaveUnpacked(); +} + +void SvtSaveOptions::SetLoadUserSettings(sal_Bool b) +{ + pImp->pLoadOpt->SetLoadUserSettings(b); +} + +sal_Bool SvtSaveOptions::IsLoadUserSettings() const +{ + return pImp->pLoadOpt->IsLoadUserSettings(); +} + +void SvtSaveOptions::SetPrettyPrinting( sal_Bool _bEnable ) +{ + pImp->pSaveOpt->EnablePrettyPrinting( _bEnable ); +} + +sal_Bool SvtSaveOptions::IsPrettyPrinting() const +{ + return pImp->pSaveOpt->IsPrettyPrintingEnabled(); +} + +void SvtSaveOptions::SetWarnAlienFormat( sal_Bool _bEnable ) +{ + pImp->pSaveOpt->SetWarnAlienFormat( _bEnable ); +} + +sal_Bool SvtSaveOptions::IsWarnAlienFormat() const +{ + return pImp->pSaveOpt->IsWarnAlienFormat(); +} + +void SvtSaveOptions::SetLoadDocumentPrinter( sal_Bool _bEnable ) +{ + pImp->pSaveOpt->SetLoadDocPrinter( _bEnable ); +} + +sal_Bool SvtSaveOptions::IsLoadDocumentPrinter() const +{ + return pImp->pSaveOpt->IsLoadDocPrinter(); +} + +void SvtSaveOptions::SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eVersion ) +{ + pImp->pSaveOpt->SetODFDefaultVersion( eVersion ); +} + +SvtSaveOptions::ODFDefaultVersion SvtSaveOptions::GetODFDefaultVersion() const +{ + return pImp->pSaveOpt->GetODFDefaultVersion(); +} + +sal_Bool SvtSaveOptions::IsReadOnly( SvtSaveOptions::EOption eOption ) const +{ + return pImp->pSaveOpt->IsReadOnly(eOption); +} + diff --git a/unotools/source/config/searchopt.cxx b/unotools/source/config/searchopt.cxx new file mode 100644 index 000000000000..7ca888e8ef7b --- /dev/null +++ b/unotools/source/config/searchopt.cxx @@ -0,0 +1,634 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: searchopt.cxx,v $ + * $Revision: 1.13 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include + + +using namespace rtl; +using namespace utl; +using namespace com::sun::star::uno; +using namespace com::sun::star::i18n; + +#define MAX_FLAGS_OFFSET 25 + +////////////////////////////////////////////////////////////////////// + + +class SvtSearchOptions_Impl : public ConfigItem +{ + INT32 nFlags; + BOOL bModified; + + // disallow copy-constructor and assignment-operator for now + SvtSearchOptions_Impl( const SvtSearchOptions_Impl & ); + SvtSearchOptions_Impl & operator = ( const SvtSearchOptions_Impl & ); + +protected: + BOOL IsModified() const { return bModified; } + using ConfigItem::SetModified; + void SetModified( BOOL bVal ); + BOOL Load(); + BOOL Save(); + + Sequence< OUString > GetPropertyNames() const; + +public: + SvtSearchOptions_Impl(); + virtual ~SvtSearchOptions_Impl(); + + // ConfigItem + virtual void Commit(); + + BOOL GetFlag( USHORT nOffset ) const; + void SetFlag( USHORT nOffset, BOOL bVal ); +}; + + + +SvtSearchOptions_Impl::SvtSearchOptions_Impl() : + ConfigItem( OUString::createFromAscii( "Office.Common/SearchOptions" ) ) +{ + RTL_LOGFILE_CONTEXT(aLog, "unotools SvtSearchOptions_Impl::SvtSearchOptions_Impl()"); + nFlags = 0x0003FFFF; // set all options values to 'true' + Load(); + SetModified( FALSE ); +} + + +SvtSearchOptions_Impl::~SvtSearchOptions_Impl() +{ + Commit(); +} + + +void SvtSearchOptions_Impl::Commit() +{ + if (IsModified()) + Save(); +} + + +BOOL SvtSearchOptions_Impl::GetFlag( USHORT nOffset ) const +{ + DBG_ASSERT( nOffset <= MAX_FLAGS_OFFSET, "offset out of range"); + return ((nFlags >> nOffset) & 0x01) ? TRUE : FALSE; +} + + +void SvtSearchOptions_Impl::SetFlag( USHORT nOffset, BOOL bVal ) +{ + DBG_ASSERT( nOffset <= MAX_FLAGS_OFFSET, "offset out of range"); + INT32 nOldFlags = nFlags; + INT32 nMask = ((INT32) 1) << nOffset; + if (bVal) + nFlags |= nMask; + else + nFlags &= ~nMask; + if (nFlags != nOldFlags) + SetModified( TRUE ); +} + + +void SvtSearchOptions_Impl::SetModified( BOOL bVal ) +{ + bModified = bVal; + if (bModified) + { + ConfigItem::SetModified(); + } +} + + +Sequence< OUString > SvtSearchOptions_Impl::GetPropertyNames() const +{ + static const char* aPropNames[ MAX_FLAGS_OFFSET + 1 ] = + { + "IsWholeWordsOnly", // 0 + "IsBackwards", // 1 + "IsUseRegularExpression", // 2 + //"IsCurrentSelectionOnly", // interactively set or not... + "IsSearchForStyles", // 3 + "IsSimilaritySearch", // 4 + "IsUseAsianOptions", // 5 + "IsMatchCase", // 6 + "Japanese/IsMatchFullHalfWidthForms", // 7 + "Japanese/IsMatchHiraganaKatakana", // 8 + "Japanese/IsMatchContractions", // 9 + "Japanese/IsMatchMinusDashCho-on", // 10 + "Japanese/IsMatchRepeatCharMarks", // 11 + "Japanese/IsMatchVariantFormKanji", // 12 + "Japanese/IsMatchOldKanaForms", // 13 + "Japanese/IsMatch_DiZi_DuZu", // 14 + "Japanese/IsMatch_BaVa_HaFa", // 15 + "Japanese/IsMatch_TsiThiChi_DhiZi", // 16 + "Japanese/IsMatch_HyuIyu_ByuVyu", // 17 + "Japanese/IsMatch_SeShe_ZeJe", // 18 + "Japanese/IsMatch_IaIya", // 19 + "Japanese/IsMatch_KiKu", // 20 + "Japanese/IsIgnorePunctuation", // 21 + "Japanese/IsIgnoreWhitespace", // 22 + "Japanese/IsIgnoreProlongedSoundMark", // 23 + "Japanese/IsIgnoreMiddleDot", // 24 + "IsNotes" // 25 + }; + + const int nCount = sizeof( aPropNames ) / sizeof( aPropNames[0] ); + Sequence< OUString > aNames( nCount ); + OUString* pNames = aNames.getArray(); + for (INT32 i = 0; i < nCount; ++i) + pNames[i] = OUString::createFromAscii( aPropNames[i] ); + + return aNames; +} + + +BOOL SvtSearchOptions_Impl::Load() +{ + BOOL bSucc = FALSE; + + Sequence< OUString > aNames = GetPropertyNames(); + INT32 nProps = aNames.getLength(); + + const Sequence< Any > aValues = GetProperties( aNames ); + DBG_ASSERT( aValues.getLength() == aNames.getLength(), + "GetProperties failed" ); + //EnableNotification( aNames ); + + if (nProps && aValues.getLength() == nProps) + { + bSucc = TRUE; + + const Any* pValues = aValues.getConstArray(); + for (USHORT i = 0; i < nProps; ++i) + { + const Any &rVal = pValues[i]; + DBG_ASSERT( rVal.hasValue(), "property value missing" ); + if (rVal.hasValue()) + { + BOOL bVal = BOOL(); + if (rVal >>= bVal) + { + if (i <= MAX_FLAGS_OFFSET) + { + // use index in sequence as flag index + SetFlag( i, bVal ); + } + else { + DBG_ERROR( "unexpected index" ); + } + } + else + { + DBG_ERROR( "unexpected type" ); + bSucc = FALSE; + } + } + else + { + DBG_ERROR( "value missing" ); + bSucc = FALSE; + } + } + } + DBG_ASSERT( bSucc, "LoadConfig failed" ); + + return bSucc; +} + + +BOOL SvtSearchOptions_Impl::Save() +{ + BOOL bSucc = FALSE; + + const Sequence< OUString > aNames = GetPropertyNames(); + INT32 nProps = aNames.getLength(); + + Sequence< Any > aValues( nProps ); + Any *pValue = aValues.getArray(); + + DBG_ASSERT( nProps == MAX_FLAGS_OFFSET + 1, + "unexpected size of index" ); + if (nProps && nProps == MAX_FLAGS_OFFSET + 1) + { + for (USHORT i = 0; i < nProps; ++i) + pValue[i] <<= (BOOL) GetFlag(i); + bSucc |= PutProperties( aNames, aValues ); + } + + if (bSucc) + SetModified( FALSE ); + + return bSucc; +} + + +////////////////////////////////////////////////////////////////////// + +SvtSearchOptions::SvtSearchOptions() +{ + pImpl = new SvtSearchOptions_Impl; +} + + +SvtSearchOptions::~SvtSearchOptions() +{ + delete pImpl; +} + + +INT32 SvtSearchOptions::GetTransliterationFlags() const +{ + INT32 nRes = 0; + + if (!IsMatchCase()) // 'IsMatchCase' means act case sensitive + nRes |= TransliterationModules_IGNORE_CASE; + if ( IsMatchFullHalfWidthForms()) + nRes |= TransliterationModules_IGNORE_WIDTH; + if ( IsMatchHiraganaKatakana()) + nRes |= TransliterationModules_IGNORE_KANA; + if ( IsMatchContractions()) + nRes |= TransliterationModules_ignoreSize_ja_JP; + if ( IsMatchMinusDashChoon()) + nRes |= TransliterationModules_ignoreMinusSign_ja_JP; + if ( IsMatchRepeatCharMarks()) + nRes |= TransliterationModules_ignoreIterationMark_ja_JP; + if ( IsMatchVariantFormKanji()) + nRes |= TransliterationModules_ignoreTraditionalKanji_ja_JP; + if ( IsMatchOldKanaForms()) + nRes |= TransliterationModules_ignoreTraditionalKana_ja_JP; + if ( IsMatchDiziDuzu()) + nRes |= TransliterationModules_ignoreZiZu_ja_JP; + if ( IsMatchBavaHafa()) + nRes |= TransliterationModules_ignoreBaFa_ja_JP; + if ( IsMatchTsithichiDhizi()) + nRes |= TransliterationModules_ignoreTiJi_ja_JP; + if ( IsMatchHyuiyuByuvyu()) + nRes |= TransliterationModules_ignoreHyuByu_ja_JP; + if ( IsMatchSesheZeje()) + nRes |= TransliterationModules_ignoreSeZe_ja_JP; + if ( IsMatchIaiya()) + nRes |= TransliterationModules_ignoreIandEfollowedByYa_ja_JP; + if ( IsMatchKiku()) + nRes |= TransliterationModules_ignoreKiKuFollowedBySa_ja_JP; + if ( IsIgnorePunctuation()) + nRes |= TransliterationModules_ignoreSeparator_ja_JP; + if ( IsIgnoreWhitespace()) + nRes |= TransliterationModules_ignoreSpace_ja_JP; + if ( IsIgnoreProlongedSoundMark()) + nRes |= TransliterationModules_ignoreProlongedSoundMark_ja_JP; + if ( IsIgnoreMiddleDot()) + nRes |= TransliterationModules_ignoreMiddleDot_ja_JP; + + return nRes; +} + + +BOOL SvtSearchOptions::IsWholeWordsOnly() const +{ + return pImpl->GetFlag( 0 ); +} + + +void SvtSearchOptions::SetWholeWordsOnly( BOOL bVal ) +{ + pImpl->SetFlag( 0, bVal ); +} + + +BOOL SvtSearchOptions::IsBackwards() const +{ + return pImpl->GetFlag( 1 ); +} + + +void SvtSearchOptions::SetBackwards( BOOL bVal ) +{ + pImpl->SetFlag( 1, bVal ); +} + + +BOOL SvtSearchOptions::IsUseRegularExpression() const +{ + return pImpl->GetFlag( 2 ); +} + + +void SvtSearchOptions::SetUseRegularExpression( BOOL bVal ) +{ + pImpl->SetFlag( 2, bVal ); +} + + +BOOL SvtSearchOptions::IsSearchForStyles() const +{ + return pImpl->GetFlag( 3 ); +} + + +void SvtSearchOptions::SetSearchForStyles( BOOL bVal ) +{ + pImpl->SetFlag( 3, bVal ); +} + + +BOOL SvtSearchOptions::IsSimilaritySearch() const +{ + return pImpl->GetFlag( 4 ); +} + + +void SvtSearchOptions::SetSimilaritySearch( BOOL bVal ) +{ + pImpl->SetFlag( 4, bVal ); +} + + +BOOL SvtSearchOptions::IsUseAsianOptions() const +{ + return pImpl->GetFlag( 5 ); +} + + +void SvtSearchOptions::SetUseAsianOptions( BOOL bVal ) +{ + pImpl->SetFlag( 5, bVal ); +} + + +BOOL SvtSearchOptions::IsMatchCase() const +{ + return pImpl->GetFlag( 6 ); +} + + +void SvtSearchOptions::SetMatchCase( BOOL bVal ) +{ + pImpl->SetFlag( 6, bVal ); +} + + +BOOL SvtSearchOptions::IsMatchFullHalfWidthForms() const +{ + return pImpl->GetFlag( 7 ); +} + + +void SvtSearchOptions::SetMatchFullHalfWidthForms( BOOL bVal ) +{ + pImpl->SetFlag( 7, bVal ); +} + + +BOOL SvtSearchOptions::IsMatchHiraganaKatakana() const +{ + return pImpl->GetFlag( 8 ); +} + + +void SvtSearchOptions::SetMatchHiraganaKatakana( BOOL bVal ) +{ + pImpl->SetFlag( 8, bVal ); +} + + +BOOL SvtSearchOptions::IsMatchContractions() const +{ + return pImpl->GetFlag( 9 ); +} + + +void SvtSearchOptions::SetMatchContractions( BOOL bVal ) +{ + pImpl->SetFlag( 9, bVal ); +} + + +BOOL SvtSearchOptions::IsMatchMinusDashChoon() const +{ + return pImpl->GetFlag( 10 ); +} + + +void SvtSearchOptions::SetMatchMinusDashChoon( BOOL bVal ) +{ + pImpl->SetFlag( 10, bVal ); +} + + +BOOL SvtSearchOptions::IsMatchRepeatCharMarks() const +{ + return pImpl->GetFlag( 11 ); +} + + +void SvtSearchOptions::SetMatchRepeatCharMarks( BOOL bVal ) +{ + pImpl->SetFlag( 11, bVal ); +} + + +BOOL SvtSearchOptions::IsMatchVariantFormKanji() const +{ + return pImpl->GetFlag( 12 ); +} + + +void SvtSearchOptions::SetMatchVariantFormKanji( BOOL bVal ) +{ + pImpl->SetFlag( 12, bVal ); +} + + +BOOL SvtSearchOptions::IsMatchOldKanaForms() const +{ + return pImpl->GetFlag( 13 ); +} + + +void SvtSearchOptions::SetMatchOldKanaForms( BOOL bVal ) +{ + pImpl->SetFlag( 13, bVal ); +} + + +BOOL SvtSearchOptions::IsMatchDiziDuzu() const +{ + return pImpl->GetFlag( 14 ); +} + + +void SvtSearchOptions::SetMatchDiziDuzu( BOOL bVal ) +{ + pImpl->SetFlag( 14, bVal ); +} + + +BOOL SvtSearchOptions::IsMatchBavaHafa() const +{ + return pImpl->GetFlag( 15 ); +} + + +void SvtSearchOptions::SetMatchBavaHafa( BOOL bVal ) +{ + pImpl->SetFlag( 15, bVal ); +} + + +BOOL SvtSearchOptions::IsMatchTsithichiDhizi() const +{ + return pImpl->GetFlag( 16 ); +} + + +void SvtSearchOptions::SetMatchTsithichiDhizi( BOOL bVal ) +{ + pImpl->SetFlag( 16, bVal ); +} + + +BOOL SvtSearchOptions::IsMatchHyuiyuByuvyu() const +{ + return pImpl->GetFlag( 17 ); +} + + +void SvtSearchOptions::SetMatchHyuiyuByuvyu( BOOL bVal ) +{ + pImpl->SetFlag( 17, bVal ); +} + + +BOOL SvtSearchOptions::IsMatchSesheZeje() const +{ + return pImpl->GetFlag( 18 ); +} + + +void SvtSearchOptions::SetMatchSesheZeje( BOOL bVal ) +{ + pImpl->SetFlag( 18, bVal ); +} + + +BOOL SvtSearchOptions::IsMatchIaiya() const +{ + return pImpl->GetFlag( 19 ); +} + + +void SvtSearchOptions::SetMatchIaiya( BOOL bVal ) +{ + pImpl->SetFlag( 19, bVal ); +} + + +BOOL SvtSearchOptions::IsMatchKiku() const +{ + return pImpl->GetFlag( 20 ); +} + + +void SvtSearchOptions::SetMatchKiku( BOOL bVal ) +{ + pImpl->SetFlag( 20, bVal ); +} + + +BOOL SvtSearchOptions::IsIgnorePunctuation() const +{ + return pImpl->GetFlag( 21 ); +} + + +void SvtSearchOptions::SetIgnorePunctuation( BOOL bVal ) +{ + pImpl->SetFlag( 21, bVal ); +} + + +BOOL SvtSearchOptions::IsIgnoreWhitespace() const +{ + return pImpl->GetFlag( 22 ); +} + + +void SvtSearchOptions::SetIgnoreWhitespace( BOOL bVal ) +{ + pImpl->SetFlag( 22, bVal ); +} + + +BOOL SvtSearchOptions::IsIgnoreProlongedSoundMark() const +{ + return pImpl->GetFlag( 23 ); +} + + +void SvtSearchOptions::SetIgnoreProlongedSoundMark( BOOL bVal ) +{ + pImpl->SetFlag( 23, bVal ); +} + + +BOOL SvtSearchOptions::IsIgnoreMiddleDot() const +{ + return pImpl->GetFlag( 24 ); +} + + +void SvtSearchOptions::SetIgnoreMiddleDot( BOOL bVal ) +{ + pImpl->SetFlag( 24, bVal ); +} + +BOOL SvtSearchOptions::IsNotes() const +{ + return pImpl->GetFlag( 25 ); +} + + +void SvtSearchOptions::SetNotes( BOOL bVal ) +{ + pImpl->SetFlag( 25, bVal ); +} + +////////////////////////////////////////////////////////////////////// + diff --git a/unotools/source/config/securityoptions.cxx b/unotools/source/config/securityoptions.cxx new file mode 100644 index 000000000000..ca2968d3a807 --- /dev/null +++ b/unotools/source/config/securityoptions.cxx @@ -0,0 +1,1312 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: securityoptions.cxx,v $ + * $Revision: 1.33 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +#ifndef GCC +#endif + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include "itemholder1.hxx" + +//_________________________________________________________________________________________________________________ +// namespaces +//_________________________________________________________________________________________________________________ + +using namespace ::utl ; +using namespace ::rtl ; +using namespace ::osl ; +using namespace ::com::sun::star::uno ; + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +#define ROOTNODE_SECURITY OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Security/Scripting")) +#define DEFAULT_SECUREURL Sequence< OUString >() +#define DEFAULT_SECLEVEL 3 +#define DEFAULT_TRUSTEDAUTHORS Sequence< SvtSecurityOptions::Certificate >() + +// xmlsec05 depricated +#define DEFAULT_STAROFFICEBASIC eALWAYS_EXECUTE + +#define CSTR_SECUREURL "SecureURL" +#define CSTR_DOCWARN_SAVEORSEND "WarnSaveOrSendDoc" +#define CSTR_DOCWARN_SIGNING "WarnSignDoc" +#define CSTR_DOCWARN_PRINT "WarnPrintDoc" +#define CSTR_DOCWARN_CREATEPDF "WarnCreatePDF" +#define CSTR_DOCWARN_REMOVEPERSONALINFO "RemovePersonalInfoOnSaving" +#define CSTR_DOCWARN_RECOMMENDPASSWORD "RecommendPasswordProtection" +#define CSTR_CTRLCLICK_HYPERLINK "HyperlinksWithCtrlClick" +#define CSTR_MACRO_SECLEVEL "MacroSecurityLevel" +#define CSTR_MACRO_TRUSTEDAUTHORS "TrustedAuthors" +#define CSTR_MACRO_DISABLE "DisableMacrosExecution" +#define CSTR_TRUSTEDAUTHOR_SUBJECTNAME "SubjectName" +#define CSTR_TRUSTEDAUTHOR_SERIALNUMBER "SerialNumber" +#define CSTR_TRUSTEDAUTHOR_RAWDATA "RawData" + +#define PROPERTYNAME_SECUREURL OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_SECUREURL )) +#define PROPERTYNAME_DOCWARN_SAVEORSEND OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_DOCWARN_SAVEORSEND )) +#define PROPERTYNAME_DOCWARN_SIGNING OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_DOCWARN_SIGNING )) +#define PROPERTYNAME_DOCWARN_PRINT OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_DOCWARN_PRINT )) +#define PROPERTYNAME_DOCWARN_CREATEPDF OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_DOCWARN_CREATEPDF )) +#define PROPERTYNAME_DOCWARN_REMOVEPERSONALINFO OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_DOCWARN_REMOVEPERSONALINFO )) +#define PROPERTYNAME_DOCWARN_RECOMMENDPASSWORD OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_DOCWARN_RECOMMENDPASSWORD )) +#define PROPERTYNAME_CTRLCLICK_HYPERLINK OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_CTRLCLICK_HYPERLINK )) +#define PROPERTYNAME_MACRO_SECLEVEL OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_MACRO_SECLEVEL )) +#define PROPERTYNAME_MACRO_TRUSTEDAUTHORS OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_MACRO_TRUSTEDAUTHORS )) +#define PROPERTYNAME_MACRO_DISABLE OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_MACRO_DISABLE )) +#define PROPERTYNAME_TRUSTEDAUTHOR_SUBJECTNAME OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_TRUSTEDAUTHOR_SUBJECTNAME)) +#define PROPERTYNAME_TRUSTEDAUTHOR_SERIALNUMBER OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_TRUSTEDAUTHOR_SERIALNUMBER)) +#define PROPERTYNAME_TRUSTEDAUTHOR_RAWDATA OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_TRUSTEDAUTHOR_RAWDATA)) + +// xmlsec05 depricated +#define PROPERTYNAME_STAROFFICEBASIC OUString(RTL_CONSTASCII_USTRINGPARAM("OfficeBasic" )) +#define PROPERTYNAME_EXECUTEPLUGINS OUString(RTL_CONSTASCII_USTRINGPARAM("ExecutePlugins" )) +#define PROPERTYNAME_WARNINGENABLED OUString(RTL_CONSTASCII_USTRINGPARAM("Warning" )) +#define PROPERTYNAME_CONFIRMATIONENABLED OUString(RTL_CONSTASCII_USTRINGPARAM("Confirmation" )) +// xmlsec05 depricated + + +#define PROPERTYHANDLE_SECUREURL 0 + +// xmlsec05 depricated +#define PROPERTYHANDLE_STAROFFICEBASIC 1 +#define PROPERTYHANDLE_EXECUTEPLUGINS 2 +#define PROPERTYHANDLE_WARNINGENABLED 3 +#define PROPERTYHANDLE_CONFIRMATIONENABLED 4 +// xmlsec05 depricated + +#define PROPERTYHANDLE_DOCWARN_SAVEORSEND 5 +#define PROPERTYHANDLE_DOCWARN_SIGNING 6 +#define PROPERTYHANDLE_DOCWARN_PRINT 7 +#define PROPERTYHANDLE_DOCWARN_CREATEPDF 8 +#define PROPERTYHANDLE_DOCWARN_REMOVEPERSONALINFO 9 +#define PROPERTYHANDLE_DOCWARN_RECOMMENDPASSWORD 10 +#define PROPERTYHANDLE_CTRLCLICK_HYPERLINK 11 +#define PROPERTYHANDLE_MACRO_SECLEVEL 12 +#define PROPERTYHANDLE_MACRO_TRUSTEDAUTHORS 13 +#define PROPERTYHANDLE_MACRO_DISABLE 14 + +#define PROPERTYCOUNT 15 +#define PROPERTYHANDLE_INVALID -1 + +#define CFG_READONLY_DEFAULT sal_False + +//_________________________________________________________________________________________________________________ +// private declarations! +//_________________________________________________________________________________________________________________ + +class SvtSecurityOptions_Impl : public ConfigItem +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + SvtSecurityOptions_Impl(); + ~SvtSecurityOptions_Impl(); + + //--------------------------------------------------------------------------------------------------------- + // overloaded methods of baseclass + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short called for notify of configmanager + @descr These method is called from the ConfigManager before application ends or from the + PropertyChangeListener if the sub tree broadcasts changes. You must update your + internal values. + + @seealso baseclass ConfigItem + + @param "seqPropertyNames" is the list of properties which should be updated. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void Notify( const Sequence< OUString >& seqPropertyNames ); + + /*-****************************************************************************************************//** + @short write changes to configuration + @descr These method writes the changed values into the sub tree + and should always called in our destructor to guarantee consistency of config data. + + @seealso baseclass ConfigItem + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void Commit(); + + //--------------------------------------------------------------------------------------------------------- + // public interface + //--------------------------------------------------------------------------------------------------------- + + sal_Bool IsReadOnly ( SvtSecurityOptions::EOption eOption ) const ; + + Sequence< OUString > GetSecureURLs ( ) const ; + void SetSecureURLs ( const Sequence< OUString >& seqURLList ) ; + sal_Bool IsSecureURL ( const OUString& sURL, + const OUString& sReferer ) const ; + inline sal_Int32 GetMacroSecurityLevel ( ) const ; + void SetMacroSecurityLevel ( sal_Int32 _nLevel ) ; + + inline sal_Bool IsMacroDisabled ( ) const ; + + Sequence< SvtSecurityOptions::Certificate > GetTrustedAuthors ( ) const ; + void SetTrustedAuthors ( const Sequence< SvtSecurityOptions::Certificate >& rAuthors ) ; + sal_Bool IsTrustedAuthorsEnabled ( ) ; + + sal_Bool IsOptionSet ( SvtSecurityOptions::EOption eOption ) const ; + sal_Bool SetOption ( SvtSecurityOptions::EOption eOption, sal_Bool bValue ) ; + sal_Bool IsOptionEnabled ( SvtSecurityOptions::EOption eOption ) const ; +private: + + /*-****************************************************************************************************//** + @short return list of key names of ouer configuration management which represent our module tree + @descr These methods return a static const list of key names. We need it to get needed values from our + configuration management. + + @seealso - + + @param - + @return A list of needed configuration keys is returned. + + @onerror - + *//*-*****************************************************************************************************/ + + void SetProperty( sal_Int32 nHandle, const Any& rValue, sal_Bool bReadOnly ); + void LoadAuthors( void ); + static sal_Int32 GetHandle( const OUString& rPropertyName ); + bool GetOption( SvtSecurityOptions::EOption eOption, sal_Bool*& rpValue, sal_Bool*& rpRO ); + + static Sequence< OUString > GetPropertyNames(); + + Sequence< OUString > m_seqSecureURLs; + sal_Bool m_bSaveOrSend; + sal_Bool m_bSigning; + sal_Bool m_bPrint; + sal_Bool m_bCreatePDF; + sal_Bool m_bRemoveInfo; + sal_Bool m_bRecommendPwd; + sal_Bool m_bCtrlClickHyperlink; + sal_Int32 m_nSecLevel; + Sequence< SvtSecurityOptions::Certificate > m_seqTrustedAuthors; + sal_Bool m_bDisableMacros; + + sal_Bool m_bROSecureURLs; + sal_Bool m_bROSaveOrSend; + sal_Bool m_bROSigning; + sal_Bool m_bROPrint; + sal_Bool m_bROCreatePDF; + sal_Bool m_bRORemoveInfo; + sal_Bool m_bRORecommendPwd; + sal_Bool m_bROCtrlClickHyperlink; + sal_Bool m_bROSecLevel; + sal_Bool m_bROTrustedAuthors; + sal_Bool m_bRODisableMacros; + + + // xmlsec05 depricated + EBasicSecurityMode m_eBasicMode; + sal_Bool m_bExecutePlugins; + sal_Bool m_bWarning; + sal_Bool m_bConfirmation; + + sal_Bool m_bROConfirmation; + sal_Bool m_bROWarning; + sal_Bool m_bROExecutePlugins; + sal_Bool m_bROBasicMode; + public: + sal_Bool IsWarningEnabled() const; + void SetWarningEnabled( sal_Bool bSet ); + sal_Bool IsConfirmationEnabled() const; + void SetConfirmationEnabled( sal_Bool bSet ); + sal_Bool IsExecutePlugins() const; + void SetExecutePlugins( sal_Bool bSet ); + EBasicSecurityMode GetBasicMode ( ) const ; + void SetBasicMode ( EBasicSecurityMode eMode ) ; +}; + +//_________________________________________________________________________________________________________________ +// definitions +//_________________________________________________________________________________________________________________ + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtSecurityOptions_Impl::SvtSecurityOptions_Impl() + :ConfigItem ( ROOTNODE_SECURITY ) + ,m_seqSecureURLs ( DEFAULT_SECUREURL ) + ,m_bSaveOrSend ( sal_True ) + ,m_bSigning ( sal_True ) + ,m_bPrint ( sal_True ) + ,m_bCreatePDF ( sal_True ) + ,m_bRemoveInfo ( sal_True ) + ,m_nSecLevel ( sal_True ) + ,m_seqTrustedAuthors ( DEFAULT_TRUSTEDAUTHORS ) + ,m_bDisableMacros ( sal_False ) + ,m_bROSecureURLs ( CFG_READONLY_DEFAULT ) + ,m_bROSaveOrSend ( CFG_READONLY_DEFAULT ) + ,m_bROSigning ( CFG_READONLY_DEFAULT ) + ,m_bROPrint ( CFG_READONLY_DEFAULT ) + ,m_bROCreatePDF ( CFG_READONLY_DEFAULT ) + ,m_bRORemoveInfo ( CFG_READONLY_DEFAULT ) + ,m_bROSecLevel ( CFG_READONLY_DEFAULT ) + ,m_bROTrustedAuthors ( CFG_READONLY_DEFAULT ) + ,m_bRODisableMacros ( sal_True ) // currently is not intended to be changed + + // xmlsec05 depricated + , m_eBasicMode ( DEFAULT_STAROFFICEBASIC ) + , m_bExecutePlugins ( sal_True ) + , m_bWarning ( sal_True ) + , m_bConfirmation ( sal_True ) + , m_bROConfirmation ( CFG_READONLY_DEFAULT ) + , m_bROWarning ( CFG_READONLY_DEFAULT ) + , m_bROExecutePlugins ( CFG_READONLY_DEFAULT ) + , m_bROBasicMode ( CFG_READONLY_DEFAULT ) + // xmlsec05 depricated + +{ + Sequence< OUString > seqNames = GetPropertyNames ( ); + Sequence< Any > seqValues = GetProperties ( seqNames ); + Sequence< sal_Bool > seqRO = GetReadOnlyStates ( seqNames ); + + // Safe impossible cases. + // We need values from ALL configuration keys. + // Follow assignment use order of values in relation to our list of key names! + DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtSecurityOptions_Impl::SvtSecurityOptions_Impl()\nI miss some values of configuration keys!\n" ); + + // Copy values from list in right order to our internal member. + sal_Int32 nPropertyCount = seqValues.getLength(); + for( sal_Int32 nProperty = 0 ; nProperty < nPropertyCount ; ++nProperty ) + SetProperty( nProperty, seqValues[ nProperty ], seqRO[ nProperty ] ); + + LoadAuthors(); + + // Enable notification mechanism of our baseclass. + // We need it to get information about changes outside these class on our used configuration keys!*/ + + EnableNotification( seqNames ); +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtSecurityOptions_Impl::~SvtSecurityOptions_Impl() +{ + if( IsModified() ) + Commit(); +} + +void SvtSecurityOptions_Impl::SetProperty( sal_Int32 nProperty, const Any& rValue, sal_Bool bRO ) +{ + switch( nProperty ) + { + case PROPERTYHANDLE_SECUREURL: + { + m_seqSecureURLs.realloc( 0 ); + rValue >>= m_seqSecureURLs; + SvtPathOptions aOpt; + sal_uInt32 nCount = m_seqSecureURLs.getLength(); + for( sal_uInt32 nItem = 0 ; nItem < nCount ; ++nItem ) + m_seqSecureURLs[ nItem ] = aOpt.SubstituteVariable( m_seqSecureURLs[ nItem ] ); + m_bROSecureURLs = bRO; + } + break; + + case PROPERTYHANDLE_DOCWARN_SAVEORSEND: + { + rValue >>= m_bSaveOrSend; + m_bROSaveOrSend = bRO; + } + break; + + case PROPERTYHANDLE_DOCWARN_SIGNING: + { + rValue >>= m_bSigning; + m_bROSigning = bRO; + } + break; + + case PROPERTYHANDLE_DOCWARN_PRINT: + { + rValue >>= m_bPrint; + m_bROPrint = bRO; + } + break; + + case PROPERTYHANDLE_DOCWARN_CREATEPDF: + { + rValue >>= m_bCreatePDF; + m_bROCreatePDF = bRO; + } + break; + + case PROPERTYHANDLE_DOCWARN_REMOVEPERSONALINFO: + { + rValue >>= m_bRemoveInfo; + m_bRORemoveInfo = bRO; + } + break; + + case PROPERTYHANDLE_DOCWARN_RECOMMENDPASSWORD: + { + rValue >>= m_bRecommendPwd; + m_bRORecommendPwd = bRO; + } + break; + + case PROPERTYHANDLE_CTRLCLICK_HYPERLINK: + { + rValue >>= m_bCtrlClickHyperlink; + m_bROCtrlClickHyperlink = bRO; + } + break; + + case PROPERTYHANDLE_MACRO_SECLEVEL: + { + rValue >>= m_nSecLevel; + m_bROSecLevel = bRO; + } + break; + + case PROPERTYHANDLE_MACRO_TRUSTEDAUTHORS: + { + // don't care about value here... + m_bROTrustedAuthors = bRO; + } + break; + + case PROPERTYHANDLE_MACRO_DISABLE: + { + rValue >>= m_bDisableMacros; + m_bRODisableMacros = bRO; + } + break; + + + // xmlsec05 depricated + case PROPERTYHANDLE_STAROFFICEBASIC: + { + sal_Int32 nMode = 0; + rValue >>= nMode; + m_eBasicMode = (EBasicSecurityMode)nMode; + m_bROBasicMode = bRO; + } + break; + case PROPERTYHANDLE_EXECUTEPLUGINS: + { + rValue >>= m_bExecutePlugins; + m_bROExecutePlugins = bRO; + } + break; + case PROPERTYHANDLE_WARNINGENABLED: + { + rValue >>= m_bWarning; + m_bROWarning = bRO; + } + break; + case PROPERTYHANDLE_CONFIRMATIONENABLED: + { + rValue >>= m_bConfirmation; + m_bROConfirmation = bRO; + } + break; + // xmlsec05 depricated + + + #if OSL_DEBUG_LEVEL > 1 + default: + DBG_ASSERT( false, "SvtSecurityOptions_Impl::SetProperty()\nUnkown property!\n" ); + #endif + } +} + +void SvtSecurityOptions_Impl::LoadAuthors( void ) +{ + m_seqTrustedAuthors.realloc( 0 ); // first clear + Sequence< OUString > lAuthors = GetNodeNames( PROPERTYNAME_MACRO_TRUSTEDAUTHORS ); + sal_Int32 c1 = lAuthors.getLength(); + if( c1 ) + { + sal_Int32 c2 = c1 * 3; // 3 Properties inside Struct TrustedAuthor + Sequence< OUString > lAllAuthors( c2 ); + + sal_Int32 i1; + sal_Int32 i2; + OUString aSep( RTL_CONSTASCII_USTRINGPARAM( "/" ) ); + for( i1 = 0, i2 = 0 ; i1 < c1 ; ++i1 ) + { + lAllAuthors[ i2 ] = PROPERTYNAME_MACRO_TRUSTEDAUTHORS + aSep + lAuthors[ i1 ] + aSep + PROPERTYNAME_TRUSTEDAUTHOR_SUBJECTNAME; + ++i2; + lAllAuthors[ i2 ] = PROPERTYNAME_MACRO_TRUSTEDAUTHORS + aSep + lAuthors[ i1 ] + aSep + PROPERTYNAME_TRUSTEDAUTHOR_SERIALNUMBER; + ++i2; + lAllAuthors[ i2 ] = PROPERTYNAME_MACRO_TRUSTEDAUTHORS + aSep + lAuthors[ i1 ] + aSep + PROPERTYNAME_TRUSTEDAUTHOR_RAWDATA; + ++i2; + } + + Sequence< Any > lValues = GetProperties( lAllAuthors ); + if( lValues.getLength() == c2 ) + { + m_seqTrustedAuthors.realloc( c1 ); + SvtSecurityOptions::Certificate aCert( 3 ); + for( i1 = 0, i2 = 0 ; i1 < c1 ; ++i1 ) + { + lValues[ i2 ] >>= aCert[ 0 ]; + ++i2; + lValues[ i2 ] >>= aCert[ 1 ]; + ++i2; + lValues[ i2 ] >>= aCert[ 2 ]; + ++i2; + m_seqTrustedAuthors[ i1 ] = aCert; + } + } + } +} + +sal_Int32 SvtSecurityOptions_Impl::GetHandle( const OUString& rName ) +{ + sal_Int32 nHandle; + + if( rName.compareToAscii( CSTR_SECUREURL ) == 0 ) + nHandle = PROPERTYHANDLE_SECUREURL; + else if( rName.compareToAscii( CSTR_DOCWARN_SAVEORSEND ) == 0 ) + nHandle = PROPERTYHANDLE_DOCWARN_SAVEORSEND; + else if( rName.compareToAscii( CSTR_DOCWARN_SIGNING ) == 0 ) + nHandle = PROPERTYHANDLE_DOCWARN_SIGNING; + else if( rName.compareToAscii( CSTR_DOCWARN_PRINT ) == 0 ) + nHandle = PROPERTYHANDLE_DOCWARN_PRINT; + else if( rName.compareToAscii( CSTR_DOCWARN_CREATEPDF ) == 0 ) + nHandle = PROPERTYHANDLE_DOCWARN_CREATEPDF; + else if( rName.compareToAscii( CSTR_DOCWARN_REMOVEPERSONALINFO ) == 0 ) + nHandle = PROPERTYHANDLE_DOCWARN_REMOVEPERSONALINFO; + else if( rName.compareToAscii( CSTR_DOCWARN_RECOMMENDPASSWORD ) == 0 ) + nHandle = PROPERTYHANDLE_DOCWARN_RECOMMENDPASSWORD; + else if( rName.compareToAscii( CSTR_CTRLCLICK_HYPERLINK ) == 0 ) + nHandle = PROPERTYHANDLE_CTRLCLICK_HYPERLINK; + else if( rName.compareToAscii( CSTR_MACRO_SECLEVEL ) == 0 ) + nHandle = PROPERTYHANDLE_MACRO_SECLEVEL; + else if( rName.compareToAscii( CSTR_MACRO_TRUSTEDAUTHORS ) == 0 ) + nHandle = PROPERTYHANDLE_MACRO_TRUSTEDAUTHORS; + else if( rName.compareToAscii( CSTR_MACRO_DISABLE ) == 0 ) + nHandle = PROPERTYHANDLE_MACRO_DISABLE; + + // xmlsec05 depricated + else if( rName == PROPERTYNAME_STAROFFICEBASIC ) + nHandle = PROPERTYHANDLE_STAROFFICEBASIC; + else if( rName == PROPERTYNAME_EXECUTEPLUGINS ) + nHandle = PROPERTYHANDLE_EXECUTEPLUGINS; + else if( rName == PROPERTYNAME_WARNINGENABLED ) + nHandle = PROPERTYHANDLE_WARNINGENABLED; + else if( rName == PROPERTYNAME_CONFIRMATIONENABLED ) + nHandle = PROPERTYHANDLE_CONFIRMATIONENABLED; + // xmlsec05 depricated + + else + nHandle = PROPERTYHANDLE_INVALID; + + return nHandle; +} + +bool SvtSecurityOptions_Impl::GetOption( SvtSecurityOptions::EOption eOption, sal_Bool*& rpValue, sal_Bool*& rpRO ) +{ + switch( eOption ) + { + case SvtSecurityOptions::E_DOCWARN_SAVEORSEND: + rpValue = &m_bSaveOrSend; + rpRO = &m_bROSaveOrSend; + break; + case SvtSecurityOptions::E_DOCWARN_SIGNING: + rpValue = &m_bSigning; + rpRO = &m_bROSigning; + break; + case SvtSecurityOptions::E_DOCWARN_PRINT: + rpValue = &m_bPrint; + rpRO = &m_bROPrint; + break; + case SvtSecurityOptions::E_DOCWARN_CREATEPDF: + rpValue = &m_bCreatePDF; + rpRO = &m_bROCreatePDF; + break; + case SvtSecurityOptions::E_DOCWARN_REMOVEPERSONALINFO: + rpValue = &m_bRemoveInfo; + rpRO = &m_bRORemoveInfo; + break; + case SvtSecurityOptions::E_DOCWARN_RECOMMENDPASSWORD: + rpValue = &m_bRecommendPwd; + rpRO = &m_bRORecommendPwd; + break; + case SvtSecurityOptions::E_CTRLCLICK_HYPERLINK: + rpValue = &m_bCtrlClickHyperlink; + rpRO = &m_bROCtrlClickHyperlink; + break; + default: + rpValue = NULL; + rpRO = NULL; + break; + } + + return rpValue != NULL; +} + +void SvtSecurityOptions_Impl::Notify( const Sequence< OUString >& seqPropertyNames ) +{ + // Use given list of updated properties to get his values from configuration directly! + Sequence< Any > seqValues = GetProperties( seqPropertyNames ); + Sequence< sal_Bool > seqRO = GetReadOnlyStates( seqPropertyNames ); + // Safe impossible cases. + // We need values from ALL notified configuration keys. + DBG_ASSERT( !(seqPropertyNames.getLength()!=seqValues.getLength()), "SvtSecurityOptions_Impl::Notify()\nI miss some values of configuration keys!\n" ); + // Step over list of property names and get right value from coreesponding value list to set it on internal members! + sal_Int32 nCount = seqPropertyNames.getLength(); + for( sal_Int32 nProperty = 0 ; nProperty < nCount ; ++nProperty ) + SetProperty( GetHandle( seqPropertyNames[ nProperty ] ), seqValues[ nProperty ], seqRO[ nProperty ] ); + + // read set of trusted authors separately + LoadAuthors(); +} + +void SvtSecurityOptions_Impl::Commit() +{ + // Get names of supported properties, create a list for values and copy current values to it. + Sequence< OUString > lOrgNames = GetPropertyNames(); + sal_Int32 nOrgCount = lOrgNames.getLength(); + + Sequence< OUString > lNames(nOrgCount); + Sequence< Any > lValues(nOrgCount); + sal_Int32 nRealCount = 0; + bool bDone; + + ClearNodeSet( PROPERTYNAME_MACRO_TRUSTEDAUTHORS ); + + for( sal_Int32 nProperty = 0 ; nProperty < nOrgCount ; ++nProperty ) + { + switch( nProperty ) + { + case PROPERTYHANDLE_SECUREURL: + { + bDone = !m_bROSecureURLs; + if( bDone ) + { + Sequence< OUString > lURLs( m_seqSecureURLs ); + SvtPathOptions aOpt; + sal_Int32 nURLsCnt = lURLs.getLength(); + for( sal_Int32 nItem = 0 ; nItem < nURLsCnt ; ++nItem ) + lURLs[ nItem ] = aOpt.UseVariable( lURLs[ nItem ] ); + lValues[ nRealCount ] <<= lURLs; + } + } + break; + + case PROPERTYHANDLE_DOCWARN_SAVEORSEND: + { + bDone = !m_bROSaveOrSend; + if( bDone ) + lValues[ nRealCount ] <<= m_bSaveOrSend; + } + break; + + case PROPERTYHANDLE_DOCWARN_SIGNING: + { + bDone = !m_bROSigning; + if( bDone ) + lValues[ nRealCount ] <<= m_bSigning; + } + break; + + case PROPERTYHANDLE_DOCWARN_PRINT: + { + bDone = !m_bROPrint; + if( bDone ) + lValues[ nRealCount ] <<= m_bPrint; + } + break; + + case PROPERTYHANDLE_DOCWARN_CREATEPDF: + { + bDone = !m_bROCreatePDF; + if( bDone ) + lValues[ nRealCount ] <<= m_bCreatePDF; + } + break; + + case PROPERTYHANDLE_DOCWARN_REMOVEPERSONALINFO: + { + bDone = !m_bRORemoveInfo; + if( bDone ) + lValues[ nRealCount ] <<= m_bRemoveInfo; + } + break; + + case PROPERTYHANDLE_DOCWARN_RECOMMENDPASSWORD: + { + bDone = !m_bRORecommendPwd; + if( bDone ) + lValues[ nRealCount ] <<= m_bRecommendPwd; + } + break; + + case PROPERTYHANDLE_CTRLCLICK_HYPERLINK: + { + bDone = !m_bROCtrlClickHyperlink; + if( bDone ) + lValues[ nRealCount ] <<= m_bCtrlClickHyperlink; + } + break; + + case PROPERTYHANDLE_MACRO_SECLEVEL: + { + bDone = !m_bROSecLevel; + if( bDone ) + lValues[ nRealCount ] <<= m_nSecLevel; + } + break; + + case PROPERTYHANDLE_MACRO_TRUSTEDAUTHORS: + { + bDone = !m_bROTrustedAuthors; + if( bDone ) + { + sal_Int32 nCnt = m_seqTrustedAuthors.getLength(); + if( nCnt ) + { + String s; + s.AppendAscii( CSTR_MACRO_TRUSTEDAUTHORS ); + s.AppendAscii( "/a" ); + + Sequence< Sequence< com::sun::star::beans::PropertyValue > > lPropertyValuesSeq( nCnt ); + for( sal_Int32 i = 0 ; i < nCnt ; ++i ) + { + String aPrefix( s ); + aPrefix += String::CreateFromInt32( i ); + aPrefix.AppendAscii( "/" ); + Sequence< com::sun::star::beans::PropertyValue > lPropertyValues( 3 ); + lPropertyValues[ 0 ].Name = aPrefix + PROPERTYNAME_TRUSTEDAUTHOR_SUBJECTNAME; + lPropertyValues[ 0 ].Value <<= m_seqTrustedAuthors[ i ][0]; + lPropertyValues[ 1 ].Name = aPrefix + PROPERTYNAME_TRUSTEDAUTHOR_SERIALNUMBER; + lPropertyValues[ 1 ].Value <<= m_seqTrustedAuthors[ i ][1]; + lPropertyValues[ 2 ].Name = aPrefix + PROPERTYNAME_TRUSTEDAUTHOR_RAWDATA; + lPropertyValues[ 2 ].Value <<= m_seqTrustedAuthors[ i ][2]; + + + SetSetProperties( PROPERTYNAME_MACRO_TRUSTEDAUTHORS, lPropertyValues ); + } + + bDone = false; // because we save in loop above! + } + else + bDone = false; + } + } + break; + + case PROPERTYHANDLE_MACRO_DISABLE: + { + bDone = !m_bRODisableMacros; + if( bDone ) + lValues[ nRealCount ] <<= (sal_Bool)m_bDisableMacros; + } + break; + + + // xmlsec05 depricated + case PROPERTYHANDLE_STAROFFICEBASIC: + { + bDone = !m_bROBasicMode; + if( bDone ) + lValues[ nRealCount ] <<= (sal_Int32)m_eBasicMode; + } + break; + case PROPERTYHANDLE_EXECUTEPLUGINS: + { + bDone = !m_bROExecutePlugins; + if( bDone ) + lValues[ nRealCount ] <<= m_bExecutePlugins; + } + break; + case PROPERTYHANDLE_WARNINGENABLED: + { + bDone = !m_bROWarning; + if( bDone ) + lValues[ nRealCount ] <<= m_bWarning; + } + break; + case PROPERTYHANDLE_CONFIRMATIONENABLED: + { + bDone = !m_bROConfirmation; + if( bDone ) + lValues[ nRealCount ] <<= m_bConfirmation; + } + break; + // xmlsec05 depricated + + + default: + bDone = false; + } + + if( bDone ) + { + lNames[ nRealCount ] = lOrgNames[ nProperty ]; + ++nRealCount; + } + } + // Set properties in configuration. + lNames.realloc(nRealCount); + lValues.realloc(nRealCount); + PutProperties( lNames, lValues ); +} + +sal_Bool SvtSecurityOptions_Impl::IsReadOnly( SvtSecurityOptions::EOption eOption ) const +{ + sal_Bool bReadonly; + switch(eOption) + { + case SvtSecurityOptions::E_SECUREURLS : + bReadonly = m_bROSecureURLs; + break; + case SvtSecurityOptions::E_DOCWARN_SAVEORSEND: + bReadonly = m_bROSaveOrSend; + break; + case SvtSecurityOptions::E_DOCWARN_SIGNING: + bReadonly = m_bROSigning; + break; + case SvtSecurityOptions::E_DOCWARN_PRINT: + bReadonly = m_bROPrint; + break; + case SvtSecurityOptions::E_DOCWARN_CREATEPDF: + bReadonly = m_bROCreatePDF; + break; + case SvtSecurityOptions::E_DOCWARN_REMOVEPERSONALINFO: + bReadonly = m_bRORemoveInfo; + break; + case SvtSecurityOptions::E_DOCWARN_RECOMMENDPASSWORD: + bReadonly = m_bRORecommendPwd; + break; + case SvtSecurityOptions::E_MACRO_SECLEVEL: + bReadonly = m_bROSecLevel; + break; + case SvtSecurityOptions::E_MACRO_TRUSTEDAUTHORS: + bReadonly = m_bROTrustedAuthors; + break; + case SvtSecurityOptions::E_MACRO_DISABLE: + bReadonly = m_bRODisableMacros; + break; + case SvtSecurityOptions::E_CTRLCLICK_HYPERLINK: + bReadonly = m_bROCtrlClickHyperlink; + break; + + + // xmlsec05 depricated + case SvtSecurityOptions::E_BASICMODE: + bReadonly = m_bROBasicMode; + break; + case SvtSecurityOptions::E_EXECUTEPLUGINS: + bReadonly = m_bROExecutePlugins; + break; + case SvtSecurityOptions::E_WARNING: + bReadonly = m_bROWarning; + break; + case SvtSecurityOptions::E_CONFIRMATION: + bReadonly = m_bROConfirmation; + break; + // xmlsec05 depricated + + + default: + bReadonly = sal_True; + } + + return bReadonly; +} + +Sequence< OUString > SvtSecurityOptions_Impl::GetSecureURLs() const +{ + return m_seqSecureURLs; +} + +void SvtSecurityOptions_Impl::SetSecureURLs( const Sequence< OUString >& seqURLList ) +{ + DBG_ASSERT(!m_bROSecureURLs, "SvtSecurityOptions_Impl::SetSecureURLs()\nYou tried to write on a readonly value!\n"); + if (!m_bROSecureURLs && m_seqSecureURLs!=seqURLList) + { + m_seqSecureURLs = seqURLList; + SetModified(); + } +} + +sal_Bool SvtSecurityOptions_Impl::IsSecureURL( const OUString& sURL , + const OUString& sReferer) const +{ + sal_Bool bState = sal_False; + + // Check for uncritical protocols first + // All protocols different from "macro..." and "slot..." are secure per definition and must not be checked. + // "macro://#..." means AppBasic macros that are considered safe + INetURLObject aURL ( sURL ); + INetProtocol aProtocol = aURL.GetProtocol(); + + // All other URLs must checked in combination with referer and internal information about security + if ( (aProtocol != INET_PROT_MACRO && aProtocol != INET_PROT_SLOT) || + aURL.GetMainURL( INetURLObject::NO_DECODE ).matchIgnoreAsciiCaseAsciiL( "macro:///", 9 ) == 0) + { + // security check only for "macro" ( without app basic ) or "slot" protocols + bState = sal_True; + } + else + { + // check list of allowed URL patterns + // Trusted referer given? + // NO => bState will be false per default + // YES => search for it in our internal url list + if( sReferer.getLength() > 0 ) + { + // Search in internal list + ::rtl::OUString sRef = sReferer.toAsciiLowerCase(); + sal_uInt32 nCount = m_seqSecureURLs.getLength(); + for( sal_uInt32 nItem=0; nItem 3 || _nLevel < 0 ) + _nLevel = 3; + + if( m_nSecLevel != _nLevel ) + { + m_nSecLevel = _nLevel; + SetModified(); + } + } +} + +Sequence< SvtSecurityOptions::Certificate > SvtSecurityOptions_Impl::GetTrustedAuthors() const +{ + return m_seqTrustedAuthors; +} + +void SvtSecurityOptions_Impl::SetTrustedAuthors( const Sequence< SvtSecurityOptions::Certificate >& rAuthors ) +{ + DBG_ASSERT(!m_bROTrustedAuthors, "SvtSecurityOptions_Impl::SetTrustedAuthors()\nYou tried to write on a readonly value!\n"); + if( !m_bROTrustedAuthors && rAuthors != m_seqTrustedAuthors ) + { + m_seqTrustedAuthors = rAuthors; + SetModified(); + } +} + +sal_Bool SvtSecurityOptions_Impl::IsTrustedAuthorsEnabled() +{ + return m_bROTrustedAuthors; +} + +sal_Bool SvtSecurityOptions_Impl::IsOptionSet( SvtSecurityOptions::EOption eOption ) const +{ + sal_Bool* pValue; + sal_Bool* pRO; + sal_Bool bRet = sal_False; + + if( ( const_cast< SvtSecurityOptions_Impl* >( this ) )->GetOption( eOption, pValue, pRO ) ) + bRet = *pValue; + + return bRet; +} + +sal_Bool SvtSecurityOptions_Impl::SetOption( SvtSecurityOptions::EOption eOption, sal_Bool bValue ) +{ + sal_Bool* pValue; + sal_Bool* pRO; + sal_Bool bRet = sal_False; + + if( GetOption( eOption, pValue, pRO ) ) + { + if( !*pRO ) + { + bRet = sal_True; + if( *pValue != bValue ) + { + *pValue = bValue; + SetModified(); + } + } + } + + return bRet; +} + +sal_Bool SvtSecurityOptions_Impl::IsOptionEnabled( SvtSecurityOptions::EOption eOption ) const +{ + sal_Bool* pValue; + sal_Bool* pRO; + sal_Bool bRet = sal_False; + + if( ( const_cast< SvtSecurityOptions_Impl* >( this ) )->GetOption( eOption, pValue, pRO ) ) + bRet = !*pRO; + + return bRet; +} + +Sequence< OUString > SvtSecurityOptions_Impl::GetPropertyNames() +{ + // Build static list of configuration key names. + static const OUString pProperties[] = + { + PROPERTYNAME_SECUREURL, + PROPERTYNAME_STAROFFICEBASIC, + PROPERTYNAME_EXECUTEPLUGINS, + PROPERTYNAME_WARNINGENABLED, + PROPERTYNAME_CONFIRMATIONENABLED, + PROPERTYNAME_DOCWARN_SAVEORSEND, + PROPERTYNAME_DOCWARN_SIGNING, + PROPERTYNAME_DOCWARN_PRINT, + PROPERTYNAME_DOCWARN_CREATEPDF, + PROPERTYNAME_DOCWARN_REMOVEPERSONALINFO, + PROPERTYNAME_DOCWARN_RECOMMENDPASSWORD, + PROPERTYNAME_CTRLCLICK_HYPERLINK, + PROPERTYNAME_MACRO_SECLEVEL, + PROPERTYNAME_MACRO_TRUSTEDAUTHORS, + PROPERTYNAME_MACRO_DISABLE + }; + // Initialize return sequence with these list ... + static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + // ... and return it. + return seqPropertyNames; +} + +//***************************************************************************************************************** +// initialize static member +// DON'T DO IT IN YOUR HEADER! +// see definition for further informations +//***************************************************************************************************************** +SvtSecurityOptions_Impl* SvtSecurityOptions::m_pDataContainer = NULL ; +sal_Int32 SvtSecurityOptions::m_nRefCount = 0 ; + +SvtSecurityOptions::SvtSecurityOptions() +{ + // Global access, must be guarded (multithreading!). + MutexGuard aGuard( GetInitMutex() ); + // Increase ouer refcount ... + ++m_nRefCount; + // ... and initialize ouer data container only if it not already exist! + if( m_pDataContainer == NULL ) + { + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtSecurityOptions_Impl::ctor()"); + m_pDataContainer = new SvtSecurityOptions_Impl; + + ItemHolder1::holdConfigItem(E_SECURITYOPTIONS); + } +} + +SvtSecurityOptions::~SvtSecurityOptions() +{ + // Global access, must be guarded (multithreading!) + MutexGuard aGuard( GetInitMutex() ); + // Decrease ouer refcount. + --m_nRefCount; + // If last instance was deleted ... + // we must destroy ouer static data container! + if( m_nRefCount <= 0 ) + { + delete m_pDataContainer; + m_pDataContainer = NULL; + } +} + +sal_Bool SvtSecurityOptions::IsReadOnly( EOption eOption ) const +{ + MutexGuard aGuard( GetInitMutex() ); + return m_pDataContainer->IsReadOnly(eOption); +} + +Sequence< OUString > SvtSecurityOptions::GetSecureURLs() const +{ + MutexGuard aGuard( GetInitMutex() ); + return m_pDataContainer->GetSecureURLs(); +} + +void SvtSecurityOptions::SetSecureURLs( const Sequence< OUString >& seqURLList ) +{ + MutexGuard aGuard( GetInitMutex() ); + m_pDataContainer->SetSecureURLs( seqURLList ); +} + +sal_Bool SvtSecurityOptions::IsSecureURL( const OUString& sURL , + const OUString& sReferer ) const +{ + MutexGuard aGuard( GetInitMutex() ); + return m_pDataContainer->IsSecureURL( sURL, sReferer ); +} + +sal_Int32 SvtSecurityOptions::GetMacroSecurityLevel() const +{ + MutexGuard aGuard( GetInitMutex() ); + return m_pDataContainer->GetMacroSecurityLevel(); +} + +void SvtSecurityOptions::SetMacroSecurityLevel( sal_Int32 _nLevel ) +{ + MutexGuard aGuard( GetInitMutex() ); + m_pDataContainer->SetMacroSecurityLevel( _nLevel ); +} + +sal_Bool SvtSecurityOptions::IsMacroDisabled() const +{ + MutexGuard aGuard( GetInitMutex() ); + return m_pDataContainer->IsMacroDisabled(); +} + +Sequence< SvtSecurityOptions::Certificate > SvtSecurityOptions::GetTrustedAuthors() const +{ + MutexGuard aGuard( GetInitMutex() ); + return m_pDataContainer->GetTrustedAuthors(); +} + +void SvtSecurityOptions::SetTrustedAuthors( const Sequence< Certificate >& rAuthors ) +{ + MutexGuard aGuard( GetInitMutex() ); + m_pDataContainer->SetTrustedAuthors( rAuthors ); +} + +sal_Bool SvtSecurityOptions::IsTrustedAuthorsEnabled() +{ + MutexGuard aGuard( GetInitMutex() ); + return m_pDataContainer->IsTrustedAuthorsEnabled(); +} + +bool SvtSecurityOptions::IsOptionSet( EOption eOption ) const +{ + MutexGuard aGuard( GetInitMutex() ); + return m_pDataContainer->IsOptionSet( eOption ); +} + +bool SvtSecurityOptions::SetOption( EOption eOption, bool bValue ) +{ + MutexGuard aGuard( GetInitMutex() ); + return m_pDataContainer->SetOption( eOption, bValue ); +} + +bool SvtSecurityOptions::IsOptionEnabled( EOption eOption ) const +{ + MutexGuard aGuard( GetInitMutex() ); + return m_pDataContainer->IsOptionEnabled( eOption ); +} + +Mutex& SvtSecurityOptions::GetInitMutex() +{ + // Initialize static mutex only for one time! + static Mutex* pMutex = NULL; + // If these method first called (Mutex not already exist!) ... + if( pMutex == NULL ) + { + // ... we must create a new one. Protect follow code with the global mutex - + // It must be - we create a static variable! + MutexGuard aGuard( Mutex::getGlobalMutex() ); + // We must check our pointer again - because it can be that another instance of ouer class will be faster then these! + if( pMutex == NULL ) + { + // Create the new mutex and set it for return on static variable. + static Mutex aMutex; + pMutex = &aMutex; + } + } + // Return new created or already existing mutex object. + return *pMutex; +} + + + + +// xmlsec05 depricated + +EBasicSecurityMode SvtSecurityOptions_Impl::GetBasicMode() const +{ + return m_eBasicMode; +} + +void SvtSecurityOptions_Impl::SetBasicMode( EBasicSecurityMode eMode ) +{ + DBG_ASSERT(!m_bROBasicMode, "SvtSecurityOptions_Impl::SetBasicMode()\nYou tried to write on a readonly value!\n"); + if (!m_bROBasicMode && m_eBasicMode!=eMode) + { + m_eBasicMode = eMode; + SetModified(); + } +} + +sal_Bool SvtSecurityOptions_Impl::IsExecutePlugins() const +{ + return m_bExecutePlugins; +} + +void SvtSecurityOptions_Impl::SetExecutePlugins( sal_Bool bSet ) +{ + DBG_ASSERT(!m_bROExecutePlugins, "SvtSecurityOptions_Impl::SetExecutePlugins()\nYou tried to write on a readonly value!\n"); + if (!m_bROExecutePlugins && m_bExecutePlugins!=bSet) + { + m_bExecutePlugins = bSet; + SetModified(); + } +} + +sal_Bool SvtSecurityOptions_Impl::IsWarningEnabled() const +{ + return m_bWarning; +} + +void SvtSecurityOptions_Impl::SetWarningEnabled( sal_Bool bSet ) +{ + DBG_ASSERT(!m_bROWarning, "SvtSecurityOptions_Impl::SetWarningEnabled()\nYou tried to write on a readonly value!\n"); + if (!m_bROWarning && m_bWarning!=bSet) + { + m_bWarning = bSet; + SetModified(); + } +} + +sal_Bool SvtSecurityOptions_Impl::IsConfirmationEnabled() const +{ + return m_bConfirmation; +} + +void SvtSecurityOptions_Impl::SetConfirmationEnabled( sal_Bool bSet ) +{ + DBG_ASSERT(!m_bROConfirmation, "SvtSecurityOptions_Impl::SetConfirmationEnabled()\nYou tried to write on a readonly value!\n"); + if (!m_bROConfirmation && m_bConfirmation!=bSet) + { + m_bConfirmation = bSet; + SetModified(); + } +} + + +sal_Bool SvtSecurityOptions::IsExecutePlugins() const +{ + MutexGuard aGuard( GetInitMutex() ); + return m_pDataContainer->IsExecutePlugins(); +} + +void SvtSecurityOptions::SetExecutePlugins( sal_Bool bSet ) +{ + MutexGuard aGuard( GetInitMutex() ); + m_pDataContainer->SetExecutePlugins( bSet ); +} + +sal_Bool SvtSecurityOptions::IsWarningEnabled() const +{ + MutexGuard aGuard( GetInitMutex() ); + return m_pDataContainer->IsWarningEnabled(); +} + +void SvtSecurityOptions::SetWarningEnabled( sal_Bool bSet ) +{ + MutexGuard aGuard( GetInitMutex() ); + m_pDataContainer->SetWarningEnabled( bSet ); +} + +sal_Bool SvtSecurityOptions::IsConfirmationEnabled() const +{ + MutexGuard aGuard( GetInitMutex() ); + return m_pDataContainer->IsConfirmationEnabled(); +} + +void SvtSecurityOptions::SetConfirmationEnabled( sal_Bool bSet ) +{ + MutexGuard aGuard( GetInitMutex() ); + m_pDataContainer->SetConfirmationEnabled( bSet ); +} + +void SvtSecurityOptions::SetBasicMode( EBasicSecurityMode eMode ) +{ + MutexGuard aGuard( GetInitMutex() ); + m_pDataContainer->SetBasicMode( eMode ); +} + +EBasicSecurityMode SvtSecurityOptions::GetBasicMode() const +{ + MutexGuard aGuard( GetInitMutex() ); + return m_pDataContainer->GetBasicMode(); +} + diff --git a/unotools/source/config/sourceviewconfig.cxx b/unotools/source/config/sourceviewconfig.cxx new file mode 100644 index 000000000000..46c926ffb86e --- /dev/null +++ b/unotools/source/config/sourceviewconfig.cxx @@ -0,0 +1,271 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: sourceviewconfig.cxx,v $ + * $Revision: 1.8 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +#include +#include +#include +#include +#include +#include + +#include + +using namespace utl; +using namespace rtl; +using namespace com::sun::star::uno; +namespace utl +{ +class SourceViewConfig_Impl : public utl::ConfigItem +{ +private: + OUString m_sFontName; + sal_Int16 m_nFontHeight; + sal_Bool m_bProportionalFontOnly; + + void Load(); + + static Sequence< OUString > GetPropertyNames(); + +public: + SourceViewConfig_Impl(); + ~SourceViewConfig_Impl(); + + virtual void Notify( const Sequence< rtl::OUString >& aPropertyNames ); + virtual void Commit(); + + const rtl::OUString& GetFontName() const + {return m_sFontName;} + void SetFontName(const rtl::OUString& rName) + { + if(rName != m_sFontName) + { + m_sFontName = rName; + SetModified(); + } + } + + sal_Int16 GetFontHeight() const + {return m_nFontHeight;} + void SetFontHeight(sal_Int16 nHeight) + { + if(m_nFontHeight != nHeight) + { + m_nFontHeight = nHeight; + SetModified(); + } + } + + sal_Bool IsShowProportionalFontsOnly() const + {return m_bProportionalFontOnly;} + void SetShowProportionalFontsOnly(sal_Bool bSet) + { + if(m_bProportionalFontOnly != bSet) + { + m_bProportionalFontOnly = bSet; + SetModified(); + } + } +}; +// initialization of static members -------------------------------------- +SourceViewConfig_Impl* SourceViewConfig::m_pImplConfig = 0; +sal_Int32 SourceViewConfig::m_nRefCount = 0; +namespace { struct lclMutex : public rtl::Static< ::osl::Mutex, lclMutex > {}; } +/* -----------------------------28.08.2002 16:45------------------------------ + + ---------------------------------------------------------------------------*/ +SourceViewConfig_Impl::SourceViewConfig_Impl() : + ConfigItem(OUString::createFromAscii("Office.Common/Font/SourceViewFont")), + m_nFontHeight(12), + m_bProportionalFontOnly(sal_False) +{ + Load(); +} +/* -----------------------------28.08.2002 16:45------------------------------ + + ---------------------------------------------------------------------------*/ +SourceViewConfig_Impl::~SourceViewConfig_Impl() +{ +} +/* -----------------------------28.08.2002 16:25------------------------------ + + ---------------------------------------------------------------------------*/ +Sequence< OUString > SourceViewConfig_Impl::GetPropertyNames() +{ + //this list needs exactly to mach the enum PropertyNameIndex + static const char* aPropNames[] = + { + "FontName" // 0 + ,"FontHeight" // 1 + ,"NonProportionalFontsOnly" // 2 + }; + const int nCount = sizeof( aPropNames ) / sizeof( const char* ); + Sequence< OUString > aNames( nCount ); + OUString* pNames = aNames.getArray(); + for ( int i = 0; i < nCount; i++ ) + pNames[i] = OUString::createFromAscii( aPropNames[i] ); + + return aNames; +} + +/*-- 28.08.2002 16:37:59--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SourceViewConfig_Impl::Load() +{ + Sequence< OUString > aNames = GetPropertyNames(); + Sequence< Any > aValues = GetProperties( aNames ); + EnableNotification( aNames ); + const Any* pValues = aValues.getConstArray(); + DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" ); + if ( aValues.getLength() == aNames.getLength() ) + { + for ( int nProp = 0; nProp < aNames.getLength(); nProp++ ) + { + if ( pValues[nProp].hasValue() ) + { + switch( nProp ) + { + case 0: pValues[nProp] >>= m_sFontName; break; + case 1: pValues[nProp] >>= m_nFontHeight; break; + case 2: pValues[nProp] >>= m_bProportionalFontOnly; break; + } + } + } + } +} +/*-- 28.08.2002 16:38:00--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SourceViewConfig_Impl::Notify( const Sequence< OUString >& ) +{ + Load(); +} +/*-- 28.08.2002 16:38:00--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SourceViewConfig_Impl::Commit() +{ + ClearModified(); + Sequence< OUString > aNames = GetPropertyNames(); + Sequence< Any > aValues( aNames.getLength() ); + Any* pValues = aValues.getArray(); + for ( int nProp = 0; nProp < aNames.getLength(); nProp++ ) + { + switch( nProp ) + { + case 0: pValues[nProp] <<= m_sFontName; break; + case 1: pValues[nProp] <<= m_nFontHeight; break; + case 2: pValues[nProp] <<= m_bProportionalFontOnly; break; + default: + DBG_ERRORFILE( "invalid index to save a user token" ); + } + } + PutProperties( aNames, aValues ); + + NotifyListeners(); +} +/*-- 28.08.2002 16:32:19--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SourceViewConfig::SourceViewConfig() +{ + { + ::osl::MutexGuard aGuard( lclMutex::get() ); + if(!m_pImplConfig) + { + m_pImplConfig = new SourceViewConfig_Impl; + ItemHolder1::holdConfigItem(E_SOURCEVIEWCONFIG); + } + + ++m_nRefCount; + } + + m_pImplConfig->AddListener( this ); +} +/*-- 28.08.2002 16:32:19--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SourceViewConfig::~SourceViewConfig() +{ + m_pImplConfig->RemoveListener( this ); + ::osl::MutexGuard aGuard( lclMutex::get() ); + if( !--m_nRefCount ) + { + if( m_pImplConfig->IsModified() ) + m_pImplConfig->Commit(); + DELETEZ( m_pImplConfig ); + } +} +/*-- 28.08.2002 16:32:19--------------------------------------------------- + + -----------------------------------------------------------------------*/ +const OUString& SourceViewConfig::GetFontName() const +{ + return m_pImplConfig->GetFontName(); +} +/*-- 28.08.2002 16:32:20--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SourceViewConfig::SetFontName(const OUString& rName) +{ + m_pImplConfig->SetFontName(rName); +} +/*-- 28.08.2002 16:32:20--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Int16 SourceViewConfig::GetFontHeight() const +{ + return m_pImplConfig->GetFontHeight(); +} +/*-- 28.08.2002 16:32:20--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SourceViewConfig::SetFontHeight(sal_Int16 nHeight) +{ + m_pImplConfig->SetFontHeight(nHeight); +} +/*-- 28.08.2002 16:32:20--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Bool SourceViewConfig::IsShowProportionalFontsOnly() const +{ + return m_pImplConfig->IsShowProportionalFontsOnly(); +} +/*-- 28.08.2002 16:32:20--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SourceViewConfig::SetShowProportionalFontsOnly(sal_Bool bSet) +{ + m_pImplConfig->SetShowProportionalFontsOnly(bSet); +} +} +// namespace utl diff --git a/unotools/source/config/startoptions.cxx b/unotools/source/config/startoptions.cxx new file mode 100644 index 000000000000..172a931231fe --- /dev/null +++ b/unotools/source/config/startoptions.cxx @@ -0,0 +1,461 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: startoptions.cxx,v $ + * $Revision: 1.16 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +#ifndef GCC +#endif + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include +#include +#include +#include +#include +#include + +#include +#include "itemholder1.hxx" +//_________________________________________________________________________________________________________________ +// namespaces +//_________________________________________________________________________________________________________________ + +using namespace ::utl ; +using namespace ::rtl ; +using namespace ::osl ; +using namespace ::com::sun::star::uno ; + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +#define DEFAULT_SHOWINTRO sal_True +#define DEFAULT_CONNECTIONURL OUString() + +#define ROOTNODE_START OUString(RTL_CONSTASCII_USTRINGPARAM("Setup/Office" )) +#define PROPERTYNAME_SHOWINTRO OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupShowIntro" )) +#define PROPERTYNAME_CONNECTIONURL OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupConnectionURL" )) + +#define PROPERTYHANDLE_SHOWINTRO 0 +#define PROPERTYHANDLE_CONNECTIONURL 1 + +#define PROPERTYCOUNT 2 + +//_________________________________________________________________________________________________________________ +// private declarations! +//_________________________________________________________________________________________________________________ + +class SvtStartOptions_Impl : public ConfigItem +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + SvtStartOptions_Impl(); + ~SvtStartOptions_Impl(); + + //--------------------------------------------------------------------------------------------------------- + // overloaded methods of baseclass + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short called for notify of configmanager + @descr These method is called from the ConfigManager before application ends or from the + PropertyChangeListener if the sub tree broadcasts changes. You must update your + internal values. + + @ATTENTION We don't implement these method - because we support readonly values at runtime only! + + @seealso baseclass ConfigItem + + @param "seqPropertyNames" is the list of properties which should be updated. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void Notify( const Sequence< OUString >& seqPropertyNames ); + + /*-****************************************************************************************************//** + @short write changes to configuration + @descr These method writes the changed values into the sub tree + and should always called in our destructor to guarantee consistency of config data. + + @ATTENTION We don't implement these method - because we support readonly values at runtime only! + + @seealso baseclass ConfigItem + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void Commit(); + + //--------------------------------------------------------------------------------------------------------- + // public interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short access method to get internal values + @descr These method give us a chance to regulate acces to ouer internal values. + It's not used in the moment - but it's possible for the feature! + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + sal_Bool IsIntroEnabled ( ) const ; + void EnableIntro ( sal_Bool bState ) ; + OUString GetConnectionURL( ) const ; + void SetConnectionURL( const OUString& sURL ) ; + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return list of fix key names of ouer configuration management which represent oue module tree + @descr These methods return a static const list of key names. We need it to get needed values from our + configuration management. We return well known key names only - because the "UserData" node + is handled in a special way! + + @seealso - + + @param - + @return A list of needed configuration keys is returned. + + @onerror - + *//*-*****************************************************************************************************/ + + static Sequence< OUString > impl_GetPropertyNames(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + sal_Bool m_bShowIntro ; /// cache "ShowIntro" of Start section + OUString m_sConnectionURL ; /// cache "Connection" of Start section +}; + +//_________________________________________________________________________________________________________________ +// definitions +//_________________________________________________________________________________________________________________ + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtStartOptions_Impl::SvtStartOptions_Impl() + // Init baseclasses first + : ConfigItem ( ROOTNODE_START ) + // Init member then. + , m_bShowIntro ( DEFAULT_SHOWINTRO ) +{ + // Use our static list of configuration keys to get his values. + Sequence< OUString > seqNames = impl_GetPropertyNames(); + Sequence< Any > seqValues = GetProperties( seqNames ) ; + + // Safe impossible cases. + // We need values from ALL configuration keys. + // Follow assignment use order of values in relation to our list of key names! + DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtStartOptions_Impl::SvtStartOptions_Impl()\nI miss some values of configuration keys!\n" ); + + // Copy values from list in right order to ouer internal member. + sal_Int32 nPropertyCount = seqValues.getLength() ; + sal_Int32 nProperty = 0 ; + for( nProperty=0; nProperty>= m_bShowIntro; + } + break; + + case PROPERTYHANDLE_CONNECTIONURL : { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_STRING), "SvtStartOptions_Impl::SvtStartOptions_Impl()\nWho has changed the value type of \"Office.Common\\Start\\Connection\"?" ); + seqValues[nProperty] >>= m_sConnectionURL; + } + break; + } + } + + // Don't enable notification mechanism of ouer baseclass! + // We support readonly variables in the moment. +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtStartOptions_Impl::~SvtStartOptions_Impl() +{ + // We must save our current values .. if user forget it! + if( IsModified() == sal_True ) + { + Commit(); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtStartOptions_Impl::Notify( const Sequence< OUString >& seqPropertyNames ) +{ + // Use given list of updated properties to get his values from configuration directly! + Sequence< Any > seqValues = GetProperties( seqPropertyNames ); + // Safe impossible cases. + // We need values from ALL notified configuration keys. + DBG_ASSERT( !(seqPropertyNames.getLength()!=seqValues.getLength()), "SvtStartOptions_Impl::Notify()\nI miss some values of configuration keys!\n" ); + // Step over list of property names and get right value from coreesponding value list to set it on internal members! + sal_Int32 nCount = seqPropertyNames.getLength(); + for( sal_Int32 nProperty=0; nProperty>= m_bShowIntro; + } + else + if( seqPropertyNames[nProperty] == PROPERTYNAME_CONNECTIONURL ) + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_STRING), "SvtStartOptions_Impl::Notify()\nWho has changed the value type of \"Office.Common\\Start\\Connection\"?" ); + seqValues[nProperty] >>= m_sConnectionURL; + } + #if OSL_DEBUG_LEVEL > 1 + else DBG_ASSERT( sal_False, "SvtStartOptions_Impl::Notify()\nUnkown property detected ... I can't handle these!\n" ); + #endif + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtStartOptions_Impl::Commit() +{ + // Get names of supported properties, create a list for values and copy current values to it. + Sequence< OUString > seqNames = impl_GetPropertyNames(); + sal_Int32 nCount = seqNames.getLength(); + Sequence< Any > seqValues ( nCount ); + for( sal_Int32 nProperty=0; nProperty SvtStartOptions_Impl::impl_GetPropertyNames() +{ + // Build static list of configuration key names. + static const OUString pProperties[] = + { + PROPERTYNAME_SHOWINTRO , + PROPERTYNAME_CONNECTIONURL , + }; + // Initialize return sequence with these list ... + static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + // ... and return it. + return seqPropertyNames; +} + +//***************************************************************************************************************** +// initialize static member +// DON'T DO IT IN YOUR HEADER! +// see definition for further informations +//***************************************************************************************************************** +SvtStartOptions_Impl* SvtStartOptions::m_pDataContainer = NULL ; +sal_Int32 SvtStartOptions::m_nRefCount = 0 ; + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtStartOptions::SvtStartOptions() +{ + // Global access, must be guarded (multithreading!). + MutexGuard aGuard( GetOwnStaticMutex() ); + // Increase ouer refcount ... + ++m_nRefCount; + // ... and initialize ouer data container only if it not already! + if( m_pDataContainer == NULL ) + { + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtStartOptions_Impl::ctor()"); + m_pDataContainer = new SvtStartOptions_Impl(); + + ItemHolder1::holdConfigItem(E_STARTOPTIONS); + } +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtStartOptions::~SvtStartOptions() +{ + // Global access, must be guarded (multithreading!) + MutexGuard aGuard( GetOwnStaticMutex() ); + // Decrease ouer refcount. + --m_nRefCount; + // If last instance was deleted ... + // we must destroy ouer static data container! + if( m_nRefCount <= 0 ) + { + delete m_pDataContainer; + m_pDataContainer = NULL; + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtStartOptions::IsIntroEnabled() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsIntroEnabled(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtStartOptions::EnableIntro( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->EnableIntro( bState ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +OUString SvtStartOptions::GetConnectionURL() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetConnectionURL(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtStartOptions::SetConnectionURL( const OUString& sURL ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetConnectionURL( sURL ); +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Mutex& SvtStartOptions::GetOwnStaticMutex() +{ + // Initialize static mutex only for one time! + static Mutex* pMutex = NULL; + // If these method first called (Mutex not already exist!) ... + if( pMutex == NULL ) + { + // ... we must create a new one. Protect follow code with the global mutex - + // It must be - we create a static variable! + MutexGuard aGuard( Mutex::getGlobalMutex() ); + // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! + if( pMutex == NULL ) + { + // Create the new mutex and set it for return on static variable. + static Mutex aMutex; + pMutex = &aMutex; + } + } + // Return new created or already existing mutex object. + return *pMutex; +} diff --git a/unotools/source/config/undoopt.cxx b/unotools/source/config/undoopt.cxx new file mode 100644 index 000000000000..006de02e084a --- /dev/null +++ b/unotools/source/config/undoopt.cxx @@ -0,0 +1,208 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: undoopt.cxx,v $ + * $Revision: 1.14 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +#ifdef SVL_DLLIMPLEMENTATION +#undef SVL_DLLIMPLEMENTATION +#endif +#define SVT_DLLIMPLEMENTATION + +#include +#include "rtl/instance.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include "itemholder1.hxx" + +using namespace utl; +using namespace rtl; +using namespace com::sun::star::uno; + +static SvtUndoOptions_Impl* pOptions = NULL; +static sal_Int32 nRefCount = 0; + +#define STEPS 0 + +class SvtUndoOptions_Impl : public utl::ConfigItem +{ + sal_Int32 nUndoCount; + Sequence< rtl::OUString > m_aPropertyNames; + +public: + SvtUndoOptions_Impl(); + + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); + virtual void Commit(); + void Load(); + + void SetUndoCount( sal_Int32 n ) { nUndoCount = n; SetModified(); } + sal_Int32 GetUndoCount() const { return nUndoCount; } +}; + +// ----------------------------------------------------------------------- + +SvtUndoOptions_Impl::SvtUndoOptions_Impl() + : ConfigItem( OUString::createFromAscii("Office.Common/Undo") ) + , nUndoCount( 20 ) +{ + Load(); +} + +void SvtUndoOptions_Impl::Commit() +{ + Sequence< Any > aValues( m_aPropertyNames.getLength() ); + Any* pValues = aValues.getArray(); + for ( int nProp = 0; nProp < m_aPropertyNames.getLength(); nProp++ ) + { + switch ( nProp ) + { + case STEPS : + pValues[nProp] <<= nUndoCount; + break; + default: + DBG_ERRORFILE( "invalid index to save a path" ); + } + } + + PutProperties( m_aPropertyNames, aValues ); + NotifyListeners(); +} + +// ----------------------------------------------------------------------- +void SvtUndoOptions_Impl::Load() +{ + if(!m_aPropertyNames.getLength()) + { + static const char* aPropNames[] = + { + "Steps", + }; + + const int nCount = sizeof( aPropNames ) / sizeof( const char* ); + m_aPropertyNames.realloc(nCount); + OUString* pNames = m_aPropertyNames.getArray(); + for ( int i = 0; i < nCount; i++ ) + pNames[i] = OUString::createFromAscii( aPropNames[i] ); + EnableNotification( m_aPropertyNames ); + } + + Sequence< Any > aValues = GetProperties( m_aPropertyNames ); + const Any* pValues = aValues.getConstArray(); + DBG_ASSERT( aValues.getLength() == m_aPropertyNames.getLength(), "GetProperties failed" ); + if ( aValues.getLength() == m_aPropertyNames.getLength() ) + { + for ( int nProp = 0; nProp < m_aPropertyNames.getLength(); nProp++ ) + { + DBG_ASSERT( pValues[nProp].hasValue(), "property value missing" ); + if ( pValues[nProp].hasValue() ) + { + switch ( nProp ) + { + case STEPS : + { + sal_Int32 nTemp = 0; + if ( pValues[nProp] >>= nTemp ) + nUndoCount = nTemp; + else + { + DBG_ERROR( "Wrong Type!" ); + } + break; + } + + default: + DBG_ERROR( "Wrong Type!" ); + break; + } + } + } + } +} +// ----------------------------------------------------------------------- +void SvtUndoOptions_Impl::Notify( const Sequence& ) +{ + Load(); +} + +// ----------------------------------------------------------------------- +namespace +{ + class LocalSingleton : public rtl::Static< osl::Mutex, LocalSingleton > + { + }; +} + +// ----------------------------------------------------------------------- +SvtUndoOptions::SvtUndoOptions() +{ + // Global access, must be guarded (multithreading) + ::osl::MutexGuard aGuard( LocalSingleton::get() ); + if ( !pOptions ) + { + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtUndoOptions_Impl::ctor()"); + pOptions = new SvtUndoOptions_Impl; + + ItemHolder1::holdConfigItem(E_UNDOOPTIONS); + } + ++nRefCount; + pImp = pOptions; + pImp->AddListener(this); +} + +// ----------------------------------------------------------------------- + +SvtUndoOptions::~SvtUndoOptions() +{ + // Global access, must be guarded (multithreading) + ::osl::MutexGuard aGuard( LocalSingleton::get() ); + pImp->RemoveListener(this); + if ( !--nRefCount ) + { + if ( pOptions->IsModified() ) + pOptions->Commit(); + DELETEZ( pOptions ); + } +} + +void SvtUndoOptions::SetUndoCount( sal_Int32 n ) +{ + pImp->SetUndoCount( n ); +} + +sal_Int32 SvtUndoOptions::GetUndoCount() const +{ + return pImp->GetUndoCount(); +} diff --git a/unotools/source/config/useroptions.cxx b/unotools/source/config/useroptions.cxx new file mode 100644 index 000000000000..ad5f50977114 --- /dev/null +++ b/unotools/source/config/useroptions.cxx @@ -0,0 +1,1304 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: useroptions.cxx,v $ + * $Revision: 1.24.238.2 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +#ifdef SVL_DLLIMPLEMENTATION +#undef SVL_DLLIMPLEMENTATION +#endif +#define SVT_DLLIMPLEMENTATION + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include "itemholder1.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace utl; +using namespace rtl; +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace css = ::com::sun::star; + +// class SvtUserOptions_Impl --------------------------------------------- +class SvtUserOptions_Impl; +class SvtUserConfigChangeListener_Impl : public cppu::WeakImplHelper1 +< + com::sun::star::util::XChangesListener +> +{ + SvtUserOptions_Impl& m_rParent; + public: + SvtUserConfigChangeListener_Impl(SvtUserOptions_Impl& rParent); + ~SvtUserConfigChangeListener_Impl(); + + //XChangesListener + virtual void SAL_CALL changesOccurred( const util::ChangesEvent& Event ) throw(RuntimeException); + //XEventListener + virtual void SAL_CALL disposing( const lang::EventObject& Source ) throw(RuntimeException); +}; + +class SvtUserOptions_Impl : public utl::ConfigurationBroadcaster +{ +public: + SvtUserOptions_Impl(); + ~SvtUserOptions_Impl(); + + // get the user token + ::rtl::OUString GetCompany() const; + ::rtl::OUString GetFirstName() const; + ::rtl::OUString GetLastName() const; + ::rtl::OUString GetID() const; + ::rtl::OUString GetStreet() const; + ::rtl::OUString GetCity() const; + ::rtl::OUString GetState() const; + ::rtl::OUString GetZip() const; + ::rtl::OUString GetCountry() const; + ::rtl::OUString GetPosition() const; + ::rtl::OUString GetTitle() const; + ::rtl::OUString GetTelephoneHome() const; + ::rtl::OUString GetTelephoneWork() const; + ::rtl::OUString GetFax() const; + ::rtl::OUString GetEmail() const; + ::rtl::OUString GetCustomerNumber() const; + ::rtl::OUString GetFathersName() const; + ::rtl::OUString GetApartment() const; + + ::rtl::OUString GetFullName() const; + ::rtl::OUString GetLocale() const { return m_aLocale; } + + // set the address token + void SetCompany( const ::rtl::OUString& rNewToken ); + void SetFirstName( const ::rtl::OUString& rNewToken ); + void SetLastName( const ::rtl::OUString& rNewToken ); + void SetID( const ::rtl::OUString& rNewToken ); + void SetStreet( const ::rtl::OUString& rNewToken ); + void SetCity( const ::rtl::OUString& rNewToken ); + void SetState( const ::rtl::OUString& rNewToken ); + void SetZip( const ::rtl::OUString& rNewToken ); + void SetCountry( const ::rtl::OUString& rNewToken ); + void SetPosition( const ::rtl::OUString& rNewToken ); + void SetTitle( const ::rtl::OUString& rNewToken ); + void SetTelephoneHome( const ::rtl::OUString& rNewToken ); + void SetTelephoneWork( const ::rtl::OUString& rNewToken ); + void SetFax( const ::rtl::OUString& rNewToken ); + void SetEmail( const ::rtl::OUString& rNewToken ); + void SetCustomerNumber( const ::rtl::OUString& rNewToken ); + void SetFathersName( const ::rtl::OUString& rNewToken ); + void SetApartment( const ::rtl::OUString& rNewToken ); + + sal_Bool IsTokenReadonly( USHORT nToken ) const; + ::rtl::OUString GetToken(USHORT nToken) const; + void Notify(); + +private: + uno::Reference< util::XChangesListener > m_xChangeListener; + css::uno::Reference< css::container::XNameAccess > m_xCfg; + css::uno::Reference< css::beans::XPropertySet > m_xData; + ::rtl::OUString m_aLocale; +}; + +// global ---------------------------------------------------------------- + +static SvtUserOptions_Impl* pOptions = NULL; +static sal_Int32 nRefCount = 0; + +#define READONLY_DEFAULT sal_False + +/*-- 16.06.2009 14:22:56--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SvtUserConfigChangeListener_Impl::SvtUserConfigChangeListener_Impl(SvtUserOptions_Impl& rParent) : + m_rParent( rParent ) +{ +} +/*-- 16.06.2009 14:22:56--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SvtUserConfigChangeListener_Impl::~SvtUserConfigChangeListener_Impl() +{ +} +/*-- 16.06.2009 14:22:56--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvtUserConfigChangeListener_Impl::changesOccurred( const util::ChangesEvent& rEvent ) throw(RuntimeException) +{ + if(rEvent.Changes.getLength()) + m_rParent.Notify(); +} +/*-- 16.06.2009 14:22:56--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvtUserConfigChangeListener_Impl::disposing( const lang::EventObject& rSource ) throw(RuntimeException) +{ + try + { + uno::Reference< util::XChangesNotifier > xChgNot( rSource.Source, UNO_QUERY_THROW); + xChgNot->removeChangesListener(this); + } + catch(Exception& ) + { + } +} + +// class SvtUserOptions_Impl --------------------------------------------- + +// ----------------------------------------------------------------------- +SvtUserOptions_Impl::SvtUserOptions_Impl() : + m_xChangeListener( new SvtUserConfigChangeListener_Impl(*this) ) +{ + try + { + m_xCfg = Reference< css::container::XNameAccess > ( + ::comphelper::ConfigurationHelper::openConfig( + utl::getProcessServiceFactory(), + s_sData, + ::comphelper::ConfigurationHelper::E_STANDARD), + css::uno::UNO_QUERY ); + + m_xData = css::uno::Reference< css::beans::XPropertySet >(m_xCfg, css::uno::UNO_QUERY); + uno::Reference< util::XChangesNotifier > xChgNot( m_xCfg, UNO_QUERY); + try + { + xChgNot->addChangesListener( m_xChangeListener ); + } + catch(RuntimeException& ) + { + } + } + catch(const css::uno::Exception& ex) + { + m_xCfg.clear(); + LogHelper::logIt(ex); + } + + Any aAny = ConfigManager::GetConfigManager()->GetDirectConfigProperty( ConfigManager::LOCALE ); + ::rtl::OUString aLocale; + if ( aAny >>= aLocale ) + m_aLocale = aLocale; + else + { + DBG_ERRORFILE( "SvtUserOptions_Impl::SvtUserOptions_Impl(): no locale found" ); + } +} + +// ----------------------------------------------------------------------- + +SvtUserOptions_Impl::~SvtUserOptions_Impl() +{ +} + +::rtl::OUString SvtUserOptions_Impl::GetCompany() const +{ + ::rtl::OUString sCompany; + + try + { + m_xData->getPropertyValue(s_so) >>= sCompany; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sCompany; +} + +::rtl::OUString SvtUserOptions_Impl::GetFirstName() const +{ + ::rtl::OUString sFirstName; + + try + { + m_xData->getPropertyValue(s_sgivenname) >>= sFirstName; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sFirstName; +} + +::rtl::OUString SvtUserOptions_Impl::GetLastName() const +{ + ::rtl::OUString sLastName; + + try + { + m_xData->getPropertyValue(s_ssn) >>= sLastName; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sLastName; +} + +::rtl::OUString SvtUserOptions_Impl::GetID() const +{ + ::rtl::OUString sID; + + try + { + m_xData->getPropertyValue(s_sinitials) >>= sID; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sID; +} + +::rtl::OUString SvtUserOptions_Impl::GetStreet() const +{ + ::rtl::OUString sStreet; + + try + { + m_xData->getPropertyValue(s_sstreet) >>= sStreet; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sStreet; +} + +::rtl::OUString SvtUserOptions_Impl::GetCity() const +{ + ::rtl::OUString sCity; + + try + { + m_xData->getPropertyValue(s_sl) >>= sCity; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sCity; +} + +::rtl::OUString SvtUserOptions_Impl::GetState() const +{ + ::rtl::OUString sState; + + try + { + m_xData->getPropertyValue(s_sst) >>= sState; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sState; +} + +::rtl::OUString SvtUserOptions_Impl::GetZip() const +{ + ::rtl::OUString sZip; + + try + { + m_xData->getPropertyValue(s_spostalcode) >>= sZip; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sZip; +} + +::rtl::OUString SvtUserOptions_Impl::GetCountry() const +{ + ::rtl::OUString sCountry; + + try + { + m_xData->getPropertyValue(s_sc) >>= sCountry; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sCountry; +} + +::rtl::OUString SvtUserOptions_Impl::GetPosition() const +{ + ::rtl::OUString sPosition; + + try + { + m_xData->getPropertyValue(s_sposition) >>= sPosition; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sPosition; +} + +::rtl::OUString SvtUserOptions_Impl::GetTitle() const +{ + ::rtl::OUString sTitle; + + try + { + m_xData->getPropertyValue(s_stitle) >>= sTitle; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sTitle; +} + +::rtl::OUString SvtUserOptions_Impl::GetTelephoneHome() const +{ + ::rtl::OUString sTelephoneHome; + + try + { + m_xData->getPropertyValue(s_shomephone) >>= sTelephoneHome; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sTelephoneHome; +} + +::rtl::OUString SvtUserOptions_Impl::GetTelephoneWork() const +{ + ::rtl::OUString sTelephoneWork; + + try + { + m_xData->getPropertyValue(s_stelephonenumber) >>= sTelephoneWork; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sTelephoneWork; +} + +::rtl::OUString SvtUserOptions_Impl::GetFax() const +{ + ::rtl::OUString sFax; + + try + { + m_xData->getPropertyValue(s_sfacsimiletelephonenumber) >>= sFax; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sFax; +} + +::rtl::OUString SvtUserOptions_Impl::GetEmail() const +{ + ::rtl::OUString sEmail; + + try + { + m_xData->getPropertyValue(s_smail) >>= sEmail; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sEmail; +} + +::rtl::OUString SvtUserOptions_Impl::GetCustomerNumber() const +{ + ::rtl::OUString sCustomerNumber; + + try + { + m_xData->getPropertyValue(s_scustomernumber) >>= sCustomerNumber; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sCustomerNumber; +} + +::rtl::OUString SvtUserOptions_Impl::GetFathersName() const +{ + ::rtl::OUString sFathersName; + + try + { + m_xData->getPropertyValue(s_sfathersname) >>= sFathersName; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sFathersName; +} + +::rtl::OUString SvtUserOptions_Impl::GetApartment() const +{ + ::rtl::OUString sApartment; + + try + { + m_xData->getPropertyValue(s_sapartment) >>= sApartment; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sApartment; +} + +void SvtUserOptions_Impl::SetCompany( const ::rtl::OUString& sCompany ) +{ + try + { + m_xData->setPropertyValue(s_so, css::uno::makeAny(::rtl::OUString(sCompany))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetFirstName( const ::rtl::OUString& sFirstName ) +{ + try + { + m_xData->setPropertyValue(s_sgivenname, css::uno::makeAny(::rtl::OUString(sFirstName))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetLastName( const ::rtl::OUString& sLastName ) +{ + try + { + m_xData->setPropertyValue(s_ssn, css::uno::makeAny(::rtl::OUString(sLastName))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} +void SvtUserOptions_Impl::SetID( const ::rtl::OUString& sID ) +{ + try + { + m_xData->setPropertyValue(s_sinitials, css::uno::makeAny(::rtl::OUString(sID))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetStreet( const ::rtl::OUString& sStreet ) +{ + try + { + m_xData->setPropertyValue(s_sstreet, css::uno::makeAny(::rtl::OUString(sStreet))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetCity( const ::rtl::OUString& sCity ) +{ + try + { + m_xData->setPropertyValue(s_sl, css::uno::makeAny(::rtl::OUString(sCity))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetState( const ::rtl::OUString& sState ) +{ + try + { + m_xData->setPropertyValue(s_sst, css::uno::makeAny(::rtl::OUString(sState))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetZip( const ::rtl::OUString& sZip ) +{ + try + { + m_xData->setPropertyValue(s_spostalcode, css::uno::makeAny(::rtl::OUString(sZip))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetCountry( const ::rtl::OUString& sCountry ) +{ + try + { + m_xData->setPropertyValue(s_sc, css::uno::makeAny(::rtl::OUString(sCountry))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetPosition( const ::rtl::OUString& sPosition ) +{ + try + { + m_xData->setPropertyValue(s_sposition, css::uno::makeAny(::rtl::OUString(sPosition))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetTitle( const ::rtl::OUString& sTitle ) +{ + try + { + m_xData->setPropertyValue(s_stitle, css::uno::makeAny(::rtl::OUString(sTitle))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetTelephoneHome( const ::rtl::OUString& sTelephoneHome ) +{ + try + { + m_xData->setPropertyValue(s_shomephone, css::uno::makeAny(::rtl::OUString(sTelephoneHome))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetTelephoneWork( const ::rtl::OUString& sTelephoneWork ) +{ + try + { + m_xData->setPropertyValue(s_stelephonenumber, css::uno::makeAny(::rtl::OUString(sTelephoneWork))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetFax( const ::rtl::OUString& sFax ) +{ + try + { + m_xData->setPropertyValue(s_sfacsimiletelephonenumber, css::uno::makeAny(::rtl::OUString(sFax))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetEmail( const ::rtl::OUString& sEmail ) +{ + try + { + m_xData->setPropertyValue(s_smail, css::uno::makeAny(::rtl::OUString(sEmail))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetCustomerNumber( const ::rtl::OUString& sCustomerNumber ) +{ + try + { + m_xData->setPropertyValue(s_scustomernumber, css::uno::makeAny(::rtl::OUString(sCustomerNumber))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetFathersName( const ::rtl::OUString& sFathersName ) +{ + try + { + m_xData->setPropertyValue(s_sfathersname, css::uno::makeAny(::rtl::OUString(sFathersName))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetApartment( const ::rtl::OUString& sApartment ) +{ + try + { + m_xData->setPropertyValue(s_sapartment, css::uno::makeAny(::rtl::OUString(sApartment))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +// ----------------------------------------------------------------------- + +::rtl::OUString SvtUserOptions_Impl::GetFullName() const +{ + ::rtl::OUString sFullName; + + sFullName = GetFirstName(); + sFullName.trim(); + if ( sFullName.getLength() ) + sFullName += ::rtl::OUString::createFromAscii(" "); + sFullName += GetLastName(); + sFullName.trim(); + + return sFullName; +} + +// ----------------------------------------------------------------------- + +void SvtUserOptions_Impl::Notify() +{ + NotifyListeners(); +} + +// ----------------------------------------------------------------------- + +sal_Bool SvtUserOptions_Impl::IsTokenReadonly( USHORT nToken ) const +{ + css::uno::Reference< css::beans::XPropertySet > xData(m_xCfg, css::uno::UNO_QUERY); + css::uno::Reference< css::beans::XPropertySetInfo > xInfo = xData->getPropertySetInfo(); + css::beans::Property aProp; + sal_Bool bRet = sal_False; + + switch ( nToken ) + { + case USER_OPT_COMPANY: + { + aProp = xInfo->getPropertyByName(s_so); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_FIRSTNAME: + { + aProp = xInfo->getPropertyByName(s_sgivenname); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_LASTNAME: + { + aProp = xInfo->getPropertyByName(s_ssn); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_ID: + { + aProp = xInfo->getPropertyByName(s_sinitials); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_STREET: + { + aProp = xInfo->getPropertyByName(s_sstreet); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_CITY: + { + aProp = xInfo->getPropertyByName(s_sl); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_STATE: + { + aProp = xInfo->getPropertyByName(s_sst); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_ZIP: + { + aProp = xInfo->getPropertyByName(s_spostalcode); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_COUNTRY: + { + aProp = xInfo->getPropertyByName(s_sc); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_POSITION: + { + aProp = xInfo->getPropertyByName(s_sposition); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_TITLE: + { + aProp = xInfo->getPropertyByName(s_stitle); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_TELEPHONEHOME: + { + aProp = xInfo->getPropertyByName(s_shomephone); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_TELEPHONEWORK: + { + aProp = xInfo->getPropertyByName(s_stelephonenumber); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_FAX: + { + aProp = xInfo->getPropertyByName(s_sfacsimiletelephonenumber); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_EMAIL: + { + aProp = xInfo->getPropertyByName(s_smail); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_FATHERSNAME: + { + aProp = xInfo->getPropertyByName(s_sfathersname); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_APARTMENT: + { + aProp = xInfo->getPropertyByName(s_sapartment); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + default: + DBG_ERRORFILE( "SvtUserOptions_Impl::IsTokenReadonly(): invalid token" ); + } + + return bRet; +} + +//------------------------------------------------------------------------ +::rtl::OUString SvtUserOptions_Impl::GetToken(USHORT nToken) const +{ + ::rtl::OUString pRet; + switch(nToken) + { + case USER_OPT_COMPANY: pRet = GetCompany(); break; + case USER_OPT_FIRSTNAME: pRet = GetFirstName(); break; + case USER_OPT_LASTNAME: pRet = GetLastName(); break; + case USER_OPT_ID: pRet = GetID(); break; + case USER_OPT_STREET: pRet = GetStreet(); break; + case USER_OPT_CITY: pRet = GetCity(); break; + case USER_OPT_STATE: pRet = GetState(); break; + case USER_OPT_ZIP: pRet = GetZip(); break; + case USER_OPT_COUNTRY: pRet = GetCountry(); break; + case USER_OPT_POSITION: pRet = GetPosition(); break; + case USER_OPT_TITLE: pRet = GetTitle(); break; + case USER_OPT_TELEPHONEHOME: pRet = GetTelephoneHome(); break; + case USER_OPT_TELEPHONEWORK: pRet = GetTelephoneWork(); break; + case USER_OPT_FAX: pRet = GetFax(); break; + case USER_OPT_EMAIL: pRet = GetEmail(); break; + case USER_OPT_FATHERSNAME: pRet = GetFathersName(); break; + case USER_OPT_APARTMENT: pRet = GetApartment(); break; + default: + DBG_ERRORFILE( "SvtUserOptions_Impl::GetToken(): invalid token" ); + } + return pRet; +} + +// class SvtUserOptions -------------------------------------------------- + +SvtUserOptions::SvtUserOptions() +{ + // Global access, must be guarded (multithreading) + ::osl::MutexGuard aGuard( GetInitMutex() ); + + if ( !pOptions ) + { + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtUserOptions_Impl::ctor()"); + pOptions = new SvtUserOptions_Impl; + + ItemHolder1::holdConfigItem(E_USEROPTIONS); + } + ++nRefCount; + pImp = pOptions; + pImp->AddListener(this); +} + +// ----------------------------------------------------------------------- + +SvtUserOptions::~SvtUserOptions() +{ + // Global access, must be guarded (multithreading) + ::osl::MutexGuard aGuard( GetInitMutex() ); + pImp->RemoveListener(this); + if ( !--nRefCount ) + { + //if ( pOptions->IsModified() ) + // pOptions->Commit(); + DELETEZ( pOptions ); + } +} + +// ----------------------------------------------------------------------- + +::osl::Mutex& SvtUserOptions::GetInitMutex() +{ + // Initialize static mutex only for one time! + static ::osl::Mutex* pMutex = NULL; + // If these method first called (Mutex not already exist!) ... + if ( pMutex == NULL ) + { + // ... we must create a new one. Protect follow code with the global mutex - + // It must be - we create a static variable! + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + // We must check our pointer again - + // because another instance of our class will be faster then this instance! + if ( pMutex == NULL ) + { + // Create the new mutex and set it for return on static variable. + static ::osl::Mutex aMutex; + pMutex = &aMutex; + } + } + // Return new created or already existing mutex object. + return *pMutex; +} + +// ----------------------------------------------------------------------- + +::rtl::OUString SvtUserOptions::GetCompany() const +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + return pImp->GetCompany(); +} + +// ----------------------------------------------------------------------- + +::rtl::OUString SvtUserOptions::GetFirstName() const +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + return pImp->GetFirstName(); +} + +// ----------------------------------------------------------------------- + +::rtl::OUString SvtUserOptions::GetLastName() const +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + return pImp->GetLastName(); +} + +// ----------------------------------------------------------------------- + +::rtl::OUString SvtUserOptions::GetID() const +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + return pImp->GetID(); +} + +// ----------------------------------------------------------------------- + +::rtl::OUString SvtUserOptions::GetStreet() const +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + return pImp->GetStreet(); +} + +// ----------------------------------------------------------------------- + +::rtl::OUString SvtUserOptions::GetCity() const +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + return pImp->GetCity(); +} + +// ----------------------------------------------------------------------- + +::rtl::OUString SvtUserOptions::GetState() const +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + return pImp->GetState(); +} + +// ----------------------------------------------------------------------- + +::rtl::OUString SvtUserOptions::GetZip() const +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + return pImp->GetZip(); +} + +// ----------------------------------------------------------------------- + +::rtl::OUString SvtUserOptions::GetCountry() const +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + return pImp->GetCountry(); +} + +// ----------------------------------------------------------------------- + +::rtl::OUString SvtUserOptions::GetPosition() const +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + return pImp->GetPosition(); +} + +// ----------------------------------------------------------------------- + +::rtl::OUString SvtUserOptions::GetTitle() const +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + return pImp->GetTitle(); +} + +// ----------------------------------------------------------------------- + +::rtl::OUString SvtUserOptions::GetTelephoneHome() const +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + return pImp->GetTelephoneHome(); +} + +// ----------------------------------------------------------------------- + +::rtl::OUString SvtUserOptions::GetTelephoneWork() const +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + return pImp->GetTelephoneWork(); +} + +// ----------------------------------------------------------------------- + +::rtl::OUString SvtUserOptions::GetFax() const +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + return pImp->GetFax(); +} + +// ----------------------------------------------------------------------- + +::rtl::OUString SvtUserOptions::GetEmail() const +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + return pImp->GetEmail(); +} + +// ----------------------------------------------------------------------- + +::rtl::OUString SvtUserOptions::GetCustomerNumber() const +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + return pImp->GetCustomerNumber(); +} +// ----------------------------------------------------------------------- + +::rtl::OUString SvtUserOptions::GetFathersName() const +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + return pImp->GetFathersName() ; +} + +// ----------------------------------------------------------------------- + +::rtl::OUString SvtUserOptions::GetApartment() const +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + return pImp->GetApartment(); +} + +// ----------------------------------------------------------------------- + +::rtl::OUString SvtUserOptions::GetFullName() const +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + return pImp->GetFullName(); +} + +// ----------------------------------------------------------------------- + +::rtl::OUString SvtUserOptions::GetLocale() const +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + return pImp->GetLocale(); +} + +// ----------------------------------------------------------------------- + +void SvtUserOptions::SetCompany( const ::rtl::OUString& rNewToken ) +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + pImp->SetCompany( rNewToken ); +} + +// ----------------------------------------------------------------------- + +void SvtUserOptions::SetFirstName( const ::rtl::OUString& rNewToken ) +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + pImp->SetFirstName( rNewToken ); +} + +// ----------------------------------------------------------------------- + +void SvtUserOptions::SetLastName( const ::rtl::OUString& rNewToken ) +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + pImp->SetLastName( rNewToken ); +} + +// ----------------------------------------------------------------------- + +void SvtUserOptions::SetID( const ::rtl::OUString& rNewToken ) +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + pImp->SetID( rNewToken ); +} + +// ----------------------------------------------------------------------- + +void SvtUserOptions::SetStreet( const ::rtl::OUString& rNewToken ) +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + pImp->SetStreet( rNewToken ); +} + +// ----------------------------------------------------------------------- + +void SvtUserOptions::SetCity( const ::rtl::OUString& rNewToken ) +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + pImp->SetCity( rNewToken ); +} + +// ----------------------------------------------------------------------- + +void SvtUserOptions::SetState( const ::rtl::OUString& rNewToken ) +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + pImp->SetState( rNewToken ); +} + +// ----------------------------------------------------------------------- + +void SvtUserOptions::SetZip( const ::rtl::OUString& rNewToken ) +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + pImp->SetZip( rNewToken ); +} + +// ----------------------------------------------------------------------- + +void SvtUserOptions::SetCountry( const ::rtl::OUString& rNewToken ) +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + pImp->SetCountry( rNewToken ); +} + +// ----------------------------------------------------------------------- + +void SvtUserOptions::SetPosition( const ::rtl::OUString& rNewToken ) +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + pImp->SetPosition( rNewToken ); +} + +// ----------------------------------------------------------------------- + +void SvtUserOptions::SetTitle( const ::rtl::OUString& rNewToken ) +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + pImp->SetTitle( rNewToken ); +} + +// ----------------------------------------------------------------------- + +void SvtUserOptions::SetTelephoneHome( const ::rtl::OUString& rNewToken ) +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + pImp->SetTelephoneHome( rNewToken ); +} + +// ----------------------------------------------------------------------- + +void SvtUserOptions::SetTelephoneWork( const ::rtl::OUString& rNewToken ) +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + pImp->SetTelephoneWork( rNewToken ); +} + +// ----------------------------------------------------------------------- + +void SvtUserOptions::SetFax( const ::rtl::OUString& rNewToken ) +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + pImp->SetFax( rNewToken ); +} + +// ----------------------------------------------------------------------- + +void SvtUserOptions::SetEmail( const ::rtl::OUString& rNewToken ) +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + pImp->SetEmail( rNewToken ); +} + +// ----------------------------------------------------------------------- + +void SvtUserOptions::SetCustomerNumber( const ::rtl::OUString& rNewToken ) +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + pImp->SetCustomerNumber( rNewToken ); +} +// ----------------------------------------------------------------------- + +void SvtUserOptions::SetFathersName( const ::rtl::OUString& rNewToken ) +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + pImp->SetFathersName( rNewToken ); +} + +// ----------------------------------------------------------------------- + +void SvtUserOptions::SetApartment( const ::rtl::OUString& rNewToken ) +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + pImp->SetApartment( rNewToken ); +} + +// ----------------------------------------------------------------------- + +sal_Bool SvtUserOptions::IsTokenReadonly( USHORT nToken ) const +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + return pImp->IsTokenReadonly( nToken ); +} +//------------------------------------------------------------------------ +::rtl::OUString SvtUserOptions::GetToken(USHORT nToken) const +{ + ::osl::MutexGuard aGuard( GetInitMutex() ); + return pImp->GetToken( nToken ); +} diff --git a/unotools/source/config/viewoptions.cxx b/unotools/source/config/viewoptions.cxx new file mode 100644 index 000000000000..9ef8fc45d570 --- /dev/null +++ b/unotools/source/config/viewoptions.cxx @@ -0,0 +1,1304 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: viewoptions.cxx,v $ + * $Revision: 1.29.236.2 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +//_________________________________________________________________________________________________________________ +// namespaces +//_________________________________________________________________________________________________________________ + +namespace css = ::com::sun::star; + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +#ifdef CONST_ASCII + #error "Who define CONST_ASCII before! I use it to create const ascii strings ..." +#else + #define CONST_ASCII(SASCIIVALUE) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SASCIIVALUE)) +#endif + +#define PATHSEPERATOR CONST_ASCII("/") + +#define PACKAGE_VIEWS CONST_ASCII("org.openoffice.Office.Views") + +#define LIST_DIALOGS CONST_ASCII("Dialogs" ) +#define LIST_TABDIALOGS CONST_ASCII("TabDialogs") +#define LIST_TABPAGES CONST_ASCII("TabPages" ) +#define LIST_WINDOWS CONST_ASCII("Windows" ) + +#define PROPERTY_WINDOWSTATE CONST_ASCII("WindowState") +#define PROPERTY_PAGEID CONST_ASCII("PageID" ) +#define PROPERTY_VISIBLE CONST_ASCII("Visible" ) +#define PROPERTY_USERDATA CONST_ASCII("UserData" ) + +#define PROPCOUNT_DIALOGS 1 +#define PROPCOUNT_TABDIALOGS 2 +#define PROPCOUNT_TABPAGES 1 +#define PROPCOUNT_WINDOWS 2 + +#define DEFAULT_WINDOWSTATE ::rtl::OUString() +#define DEFAULT_USERDATA css::uno::Sequence< css::beans::NamedValue >() +#define DEFAULT_PAGEID 0 +#define DEFAULT_VISIBLE sal_False + +//#define DEBUG_VIEWOPTIONS + +#ifdef DEBUG_VIEWOPTIONS + #define _LOG_COUNTER_( _SVIEW_, _NREAD_, _NWRITE_ ) \ + { \ + FILE* pFile = fopen( "viewdbg.txt", "a" ); \ + fprintf( pFile, "%s[%d, %d]\n", ::rtl::OUStringToOString(_SVIEW_, RTL_TEXTENCODING_UTF8).getStr(), _NREAD_, _NWRITE_ ); \ + fclose( pFile ); \ + } +#endif // DEBUG_VIEWOPTIONS + +#define SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION_PARAM_EXCEPTION) \ + { \ + ::rtl::OUStringBuffer sMsg(256); \ + sMsg.appendAscii("Unexpected exception catched. Original message was:\n\"" ); \ + sMsg.append (SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION_PARAM_EXCEPTION.Message); \ + sMsg.appendAscii("\"" ); \ + OSL_ENSURE(sal_False, ::rtl::OUStringToOString(sMsg.makeStringAndClear(), RTL_TEXTENCODING_UTF8).getStr()); \ + } + +//_________________________________________________________________________________________________________________ +// initialization! +//_________________________________________________________________________________________________________________ + +SvtViewOptionsBase_Impl* SvtViewOptions::m_pDataContainer_Dialogs = NULL ; +sal_Int32 SvtViewOptions::m_nRefCount_Dialogs = 0 ; +SvtViewOptionsBase_Impl* SvtViewOptions::m_pDataContainer_TabDialogs = NULL ; +sal_Int32 SvtViewOptions::m_nRefCount_TabDialogs = 0 ; +SvtViewOptionsBase_Impl* SvtViewOptions::m_pDataContainer_TabPages = NULL ; +sal_Int32 SvtViewOptions::m_nRefCount_TabPages = 0 ; +SvtViewOptionsBase_Impl* SvtViewOptions::m_pDataContainer_Windows = NULL ; +sal_Int32 SvtViewOptions::m_nRefCount_Windows = 0 ; + +//_________________________________________________________________________________________________________________ +// private declarations! +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @descr declare one configuration item + These struct hold information about one view item. But not all member are used for all entries! + User must decide which information are usefull and which not. We are a container iztem only and doesnt + know anything about the context. + But; we support a feature: + decision between items with default values (should not realy exist in configuration!) + and items with real values - changed by user. So user can suppress saving of realy unused items + to disk - because; defaulted items could be restored on runtime without reading from disk!!! + And if only items with valid information was written to cfg - we mustn't read so much and save time. + So we start with an member m_bDefault=True and reset it to False after first set-call. + Deficiencies of these solution - we cant allow direct read/write access to our member. We must + support it by set/get-methods ... +*//*-*************************************************************************************************************/ +class IMPL_TViewData +{ + public: + //--------------------------------------------------------------------------------------------------------- + // create "default" item + IMPL_TViewData() + { + m_sWindowState = DEFAULT_WINDOWSTATE ; + m_lUserData = DEFAULT_USERDATA ; + m_nPageID = DEFAULT_PAGEID ; + m_bVisible = DEFAULT_VISIBLE ; + + m_bDefault = sal_True ; + } + + //--------------------------------------------------------------------------------------------------------- + // write access - with reseting of default state + void setWindowState( const ::rtl::OUString& sValue ) + { + m_bDefault = ( + ( m_bDefault == sal_True ) && + ( sValue == DEFAULT_WINDOWSTATE ) + ); + m_sWindowState = sValue; + } + + //--------------------------------------------------------------------------------------------------------- + void setUserData( const css::uno::Sequence< css::beans::NamedValue >& lValue ) + { + m_bDefault = ( + ( m_bDefault == sal_True ) && + ( lValue == DEFAULT_USERDATA ) + ); + m_lUserData = lValue; + } + + //--------------------------------------------------------------------------------------------------------- + void setPageID( sal_Int32 nValue ) + { + m_bDefault = ( + ( m_bDefault == sal_True ) && + ( nValue == DEFAULT_PAGEID ) + ); + m_nPageID = nValue; + } + + //--------------------------------------------------------------------------------------------------------- + void setVisible( sal_Bool bValue ) + { + m_bDefault = ( + ( m_bDefault == sal_True ) && + ( bValue == DEFAULT_VISIBLE ) + ); + m_bVisible = bValue; + } + + //--------------------------------------------------------------------------------------------------------- + // read access + ::rtl::OUString getWindowState() { return m_sWindowState; } + css::uno::Sequence< css::beans::NamedValue > getUserData () { return m_lUserData ; } + sal_Int32 getPageID () { return m_nPageID ; } + sal_Bool getVisible () { return m_bVisible ; } + + //--------------------------------------------------------------------------------------------------------- + // special operation for easy access on user data + void setUserItem( const ::rtl::OUString& sName , + const css::uno::Any& aValue ) + { + // we change UserData in every case! + // a) we change already existing item + // or b) we add a new one + m_bDefault = sal_False; + + sal_Bool bExist = sal_False; + sal_Int32 nCount = m_lUserData.getLength(); + + // change it, if it already exist ... + for( sal_Int32 nStep=0; nStep m_lUserData ; + sal_Int32 m_nPageID ; + sal_Bool m_bVisible ; + + sal_Bool m_bDefault ; +}; + +struct IMPL_TStringHashCode +{ + size_t operator()(const ::rtl::OUString& sString) const + { + return sString.hashCode(); + } +}; + +typedef ::std::hash_map< ::rtl::OUString , + IMPL_TViewData , + IMPL_TStringHashCode , + ::std::equal_to< ::rtl::OUString > > IMPL_TViewHash; + +/*-************************************************************************************************************//** + @descr Implement base data container for view options elements. + Every item support ALL possible configuration informations. + But not every superclass should use them! Because some view types don't + have it realy. + + @attention We implement a write-througt-cache! We use it for reading - but write all changes directly to + configuration. (changes are made on internal cache too!). So it's easier to distinguish + between added/changed/removed elements without any complex mask or bool flag informations. + Caches from configuration and our own one are synchronized every time - if we do so. +*//*-*************************************************************************************************************/ +class SvtViewOptionsBase_Impl +{ + //------------------------------------------------------------------------------------------------------------- + public: + SvtViewOptionsBase_Impl ( const ::rtl::OUString& sList ); + virtual ~SvtViewOptionsBase_Impl ( ); + sal_Bool Exists ( const ::rtl::OUString& sName ); + sal_Bool Delete ( const ::rtl::OUString& sName ); + ::rtl::OUString GetWindowState ( const ::rtl::OUString& sName ); + void SetWindowState ( const ::rtl::OUString& sName , + const ::rtl::OUString& sState ); + css::uno::Sequence< css::beans::NamedValue > GetUserData ( const ::rtl::OUString& sName ); + void SetUserData ( const ::rtl::OUString& sName , + const css::uno::Sequence< css::beans::NamedValue >& lData ); + sal_Int32 GetPageID ( const ::rtl::OUString& sName ); + void SetPageID ( const ::rtl::OUString& sName , + sal_Int32 nID ); + sal_Bool GetVisible ( const ::rtl::OUString& sName ); + void SetVisible ( const ::rtl::OUString& sName , + sal_Bool bVisible ); + css::uno::Any GetUserItem ( const ::rtl::OUString& sName , + const ::rtl::OUString& sItem ); + void SetUserItem ( const ::rtl::OUString& sName , + const ::rtl::OUString& sItem , + const css::uno::Any& aValue ); + + //------------------------------------------------------------------------------------------------------------- + private: + css::uno::Reference< css::uno::XInterface > impl_getSetNode( const ::rtl::OUString& sNode , + sal_Bool bCreateIfMissing); + + //------------------------------------------------------------------------------------------------------------- + private: + ::rtl::OUString m_sListName; + css::uno::Reference< css::container::XNameAccess > m_xRoot; + css::uno::Reference< css::container::XNameAccess > m_xSet; + + #ifdef DEBUG_VIEWOPTIONS + sal_Int32 m_nReadCount ; + sal_Int32 m_nWriteCount ; + #endif +}; + +/*-************************************************************************************************************//** + @descr Implement the base data container. +*//*-*************************************************************************************************************/ + +/*-************************************************************************************************************//** + @short ctor + @descr We use it to open right configuration file and let configuration objects fill her caches. + Then we read all existing entries from right list and cached it inside our object too. + Normaly we should enable notifications for changes on these values too ... but these feature + isn't full implemented in the moment. + + @seealso baseclass ::utl::ConfigItem + @seealso method Notify() + + @param - + @return - + + @last change 19.10.2001 07:54 +*//*-*************************************************************************************************************/ +SvtViewOptionsBase_Impl::SvtViewOptionsBase_Impl( const ::rtl::OUString& sList ) + : m_sListName ( sList ) // we must know, which view type we must support + #ifdef DEBUG_VIEWOPTIONS + , m_nReadCount ( 0 ) + , m_nWriteCount( 0 ) + #endif +{ + try + { + m_xRoot = css::uno::Reference< css::container::XNameAccess >( + ::comphelper::ConfigurationHelper::openConfig( + ::utl::getProcessServiceFactory(), + PACKAGE_VIEWS, + ::comphelper::ConfigurationHelper::E_STANDARD), + css::uno::UNO_QUERY); + if (m_xRoot.is()) + m_xRoot->getByName(sList) >>= m_xSet; + } + catch(const css::uno::Exception& ex) + { + m_xRoot.clear(); + m_xSet.clear(); + + SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) + } +} + +/*-************************************************************************************************************//** + @short dtor + @descr clean up something + + @attention We implement a write through cache! So we mustn't do it realy. All changes was written to cfg directly. + Commit isn't neccessary then. + + @seealso baseclass ::utl::ConfigItem + @seealso method IsModified() + @seealso method SetModified() + @seealso method Commit() + + @param - + @return - + + @last change 19.10.2001 08:02 +*//*-*************************************************************************************************************/ +SvtViewOptionsBase_Impl::~SvtViewOptionsBase_Impl() +{ + // dont flush configuration changes here to m_xRoot. + // That must be done inside every SetXXX() method already ! + // Here its to late - DisposedExceptions from used configuration access can occure otherwise. + + m_xRoot.clear(); + m_xSet.clear(); + + #ifdef DEBUG_VIEWOPTIONS + _LOG_COUNTER_( m_sListName, m_nReadCount, m_nWriteCount ) + #endif // DEBUG_VIEWOPTIONS +} + +/*-************************************************************************************************************//** + @short checks for already existing entries + @descr If user don't know, if an entry already exist - he can get this information by calling this method. + + @seealso member m_aList + + @param "sName", name of entry to check exist state + @return true , if item exist + false, otherwise +*//*-*************************************************************************************************************/ +sal_Bool SvtViewOptionsBase_Impl::Exists( const ::rtl::OUString& sName ) +{ + sal_Bool bExists = sal_False; + + try + { + if (m_xSet.is()) + bExists = m_xSet->hasByName(sName); + } + catch(const css::uno::Exception& ex) + { + bExists = sal_False; + SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) + } + + return bExists; +} + +/*-************************************************************************************************************//** + @short delete entry + @descr Use it to delete set entry by given name. + + @seealso member m_aList + + @param "sName", name of entry to delete it + @return true , if item not exist(!) or could be deleted (should be the same!) + false, otherwise +*//*-*************************************************************************************************************/ +sal_Bool SvtViewOptionsBase_Impl::Delete( const ::rtl::OUString& sName ) +{ + #ifdef DEBUG_VIEWOPTIONS + ++m_nWriteCount; + #endif + + sal_Bool bDeleted = sal_False; + try + { + css::uno::Reference< css::container::XNameContainer > xSet(m_xSet, css::uno::UNO_QUERY_THROW); + xSet->removeByName(sName); + bDeleted = sal_True; + ::comphelper::ConfigurationHelper::flush(m_xRoot); + } + catch(const css::container::NoSuchElementException&) + { bDeleted = sal_True; } + catch(const css::uno::Exception& ex) + { + bDeleted = sal_False; + SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) + } + + return bDeleted; +} + +/*-************************************************************************************************************//** + @short read/write access to cache view items and her properties + @descr Follow methods support read/write access to all cache view items. + + @seealso member m_sList + + @param - + @return - +*//*-*************************************************************************************************************/ +::rtl::OUString SvtViewOptionsBase_Impl::GetWindowState( const ::rtl::OUString& sName ) +{ + #ifdef DEBUG_VIEWOPTIONS + ++m_nReadCount; + #endif + + ::rtl::OUString sWindowState; + try + { + css::uno::Reference< css::beans::XPropertySet > xNode( + impl_getSetNode(sName, sal_False), + css::uno::UNO_QUERY); + if (xNode.is()) + xNode->getPropertyValue(PROPERTY_WINDOWSTATE) >>= sWindowState; + } + catch(const css::uno::Exception& ex) + { + sWindowState = ::rtl::OUString(); + SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) + } + + return sWindowState; +} + +//***************************************************************************************************************** +void SvtViewOptionsBase_Impl::SetWindowState( const ::rtl::OUString& sName , + const ::rtl::OUString& sState ) +{ + #ifdef DEBUG_VIEWOPTIONS + ++m_nWriteCount; + #endif + + try + { + css::uno::Reference< css::beans::XPropertySet > xNode( + impl_getSetNode(sName, sal_True), + css::uno::UNO_QUERY_THROW); + xNode->setPropertyValue(PROPERTY_WINDOWSTATE, css::uno::makeAny(sState)); + ::comphelper::ConfigurationHelper::flush(m_xRoot); + } + catch(const css::uno::Exception& ex) + { + SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) + } +} + +//***************************************************************************************************************** +css::uno::Sequence< css::beans::NamedValue > SvtViewOptionsBase_Impl::GetUserData( const ::rtl::OUString& sName ) +{ + #ifdef DEBUG_VIEWOPTIONS + ++m_nReadCount; + #endif + + try + { + css::uno::Reference< css::container::XNameAccess > xNode( + impl_getSetNode(sName, sal_False), + css::uno::UNO_QUERY); // no _THROW ! because we dont create missing items here. So we have to live with zero references .-) + css::uno::Reference< css::container::XNameAccess > xUserData; + if (xNode.is()) + xNode->getByName(PROPERTY_USERDATA) >>= xUserData; + if (xUserData.is()) + { + const css::uno::Sequence< ::rtl::OUString > lNames = xUserData->getElementNames(); + const ::rtl::OUString* pNames = lNames.getConstArray(); + sal_Int32 c = lNames.getLength(); + sal_Int32 i = 0; + css::uno::Sequence< css::beans::NamedValue > lUserData(c); + + for (i=0; igetByName(pNames[i]); + } + + return lUserData; + } + } + catch(const css::uno::Exception& ex) + { + SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) + } + + return css::uno::Sequence< css::beans::NamedValue >(); +} + +//***************************************************************************************************************** +void SvtViewOptionsBase_Impl::SetUserData( const ::rtl::OUString& sName , + const css::uno::Sequence< css::beans::NamedValue >& lData ) +{ + #ifdef DEBUG_VIEWOPTIONS + ++m_nWriteCount; + #endif + + try + { + css::uno::Reference< css::container::XNameAccess > xNode( + impl_getSetNode(sName, sal_True), + css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::container::XNameContainer > xUserData; + xNode->getByName(PROPERTY_USERDATA) >>= xUserData; + if (xUserData.is()) + { + const css::beans::NamedValue* pData = lData.getConstArray(); + sal_Int32 c = lData.getLength(); + sal_Int32 i = 0; + for (i=0; ihasByName(pData[i].Name)) + xUserData->replaceByName(pData[i].Name, pData[i].Value); + else + xUserData->insertByName(pData[i].Name, pData[i].Value); + } + } + ::comphelper::ConfigurationHelper::flush(m_xRoot); + } + catch(const css::uno::Exception& ex) + { + SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) + } +} + +//***************************************************************************************************************** +css::uno::Any SvtViewOptionsBase_Impl::GetUserItem( const ::rtl::OUString& sName , + const ::rtl::OUString& sItem ) +{ + #ifdef DEBUG_VIEWOPTIONS + ++m_nReadCount; + #endif + + css::uno::Any aItem; + try + { + css::uno::Reference< css::container::XNameAccess > xNode( + impl_getSetNode(sName, sal_False), + css::uno::UNO_QUERY); + css::uno::Reference< css::container::XNameAccess > xUserData; + if (xNode.is()) + xNode->getByName(PROPERTY_USERDATA) >>= xUserData; + if (xUserData.is()) + aItem = xUserData->getByName(sItem); + } + catch(const css::container::NoSuchElementException&) + { aItem.clear(); } + catch(const css::uno::Exception& ex) + { + aItem.clear(); + SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) + } + + return aItem; +} + +//***************************************************************************************************************** +void SvtViewOptionsBase_Impl::SetUserItem( const ::rtl::OUString& sName , + const ::rtl::OUString& sItem , + const css::uno::Any& aValue ) +{ + #ifdef DEBUG_VIEWOPTIONS + ++m_nWriteCount; + #endif + + try + { + css::uno::Reference< css::container::XNameAccess > xNode( + impl_getSetNode(sName, sal_True), + css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::container::XNameContainer > xUserData; + xNode->getByName(PROPERTY_USERDATA) >>= xUserData; + if (xUserData.is()) + { + if (xUserData->hasByName(sItem)) + xUserData->replaceByName(sItem, aValue); + else + xUserData->insertByName(sItem, aValue); + } + ::comphelper::ConfigurationHelper::flush(m_xRoot); + } + catch(const css::uno::Exception& ex) + { + SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) + } +} + +//***************************************************************************************************************** +sal_Int32 SvtViewOptionsBase_Impl::GetPageID( const ::rtl::OUString& sName ) +{ + #ifdef DEBUG_VIEWOPTIONS + ++m_nReadCount; + #endif + + sal_Int32 nID = 0; + try + { + css::uno::Reference< css::beans::XPropertySet > xNode( + impl_getSetNode(sName, sal_False), + css::uno::UNO_QUERY); + if (xNode.is()) + xNode->getPropertyValue(PROPERTY_PAGEID) >>= nID; + } + catch(const css::uno::Exception& ex) + { + nID = 0; + SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) + } + + return nID; +} + +//***************************************************************************************************************** +void SvtViewOptionsBase_Impl::SetPageID( const ::rtl::OUString& sName , + sal_Int32 nID ) +{ + #ifdef DEBUG_VIEWOPTIONS + ++m_nWriteCount; + #endif + + try + { + css::uno::Reference< css::beans::XPropertySet > xNode( + impl_getSetNode(sName, sal_True), + css::uno::UNO_QUERY_THROW); + xNode->setPropertyValue(PROPERTY_PAGEID, css::uno::makeAny(nID)); + ::comphelper::ConfigurationHelper::flush(m_xRoot); + } + catch(const css::uno::Exception& ex) + { + SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) + } +} + +//***************************************************************************************************************** +sal_Bool SvtViewOptionsBase_Impl::GetVisible( const ::rtl::OUString& sName ) +{ + #ifdef DEBUG_VIEWOPTIONS + ++m_nReadCount; + #endif + + sal_Bool bVisible = sal_False; + try + { + css::uno::Reference< css::beans::XPropertySet > xNode( + impl_getSetNode(sName, sal_False), + css::uno::UNO_QUERY); + if (xNode.is()) + xNode->getPropertyValue(PROPERTY_VISIBLE) >>= bVisible; + } + catch(const css::uno::Exception& ex) + { + bVisible = sal_False; + SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) + } + + return bVisible; +} + +//***************************************************************************************************************** +void SvtViewOptionsBase_Impl::SetVisible( const ::rtl::OUString& sName , + sal_Bool bVisible ) +{ + #ifdef DEBUG_VIEWOPTIONS + ++m_nWriteCount; + #endif + + try + { + css::uno::Reference< css::beans::XPropertySet > xNode( + impl_getSetNode(sName, sal_True), + css::uno::UNO_QUERY_THROW); + xNode->setPropertyValue(PROPERTY_VISIBLE, css::uno::makeAny(bVisible)); + ::comphelper::ConfigurationHelper::flush(m_xRoot); + } + catch(const css::uno::Exception& ex) + { + SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) + } +} + +/*-************************************************************************************************************//** + @short create new set node with default values on disk + @descr To create a new UserData item - the super node of these property must already exist! + You can call this method to create these new entry with default values and change UserData then. + + @seealso method impl_writeDirectProp() + + @param "sNode", name of new entry + @return - + + @last change 19.10.2001 08:42 +*//*-*************************************************************************************************************/ +css::uno::Reference< css::uno::XInterface > SvtViewOptionsBase_Impl::impl_getSetNode( const ::rtl::OUString& sNode , + sal_Bool bCreateIfMissing) +{ + css::uno::Reference< css::uno::XInterface > xNode; + + try + { + if (bCreateIfMissing) + xNode = ::comphelper::ConfigurationHelper::makeSureSetNodeExists(m_xRoot, m_sListName, sNode); + else + { + if (m_xSet.is()) + m_xSet->getByName(sNode) >>= xNode; + } + } + catch(const css::container::NoSuchElementException&) + { xNode.clear(); } + catch(const css::uno::Exception& ex) + { + xNode.clear(); + SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) + } + + return xNode; +} + +//_________________________________________________________________________________________________________________ +// definitions +//_________________________________________________________________________________________________________________ + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtViewOptions::SvtViewOptions( EViewType eType , + const ::rtl::OUString& sViewName ) + : m_eViewType ( eType ) + , m_sViewName ( sViewName ) +{ + // Global access, must be guarded (multithreading!) + ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); + + // Search for right dat container for this view type and initialize right data container or set right ref count! + switch( eType ) + { + case E_DIALOG : { + // Increase ref count for dialog data container first. + ++m_nRefCount_Dialogs; + // If these instance the first user of the dialog data container - create these impl static container! + if( m_nRefCount_Dialogs == 1 ) + { + //m_pDataContainer_Dialogs = new SvtViewDialogOptions_Impl( LIST_DIALOGS ); + m_pDataContainer_Dialogs = new SvtViewOptionsBase_Impl( LIST_DIALOGS ); + ItemHolder1::holdConfigItem(E_VIEWOPTIONS_DIALOG); + } + } + break; + case E_TABDIALOG : { + // Increase ref count for tab-dialog data container first. + ++m_nRefCount_TabDialogs; + // If these instance the first user of the tab-dialog data container - create these impl static container! + if( m_nRefCount_TabDialogs == 1 ) + { + m_pDataContainer_TabDialogs = new SvtViewOptionsBase_Impl( LIST_TABDIALOGS ); + ItemHolder1::holdConfigItem(E_VIEWOPTIONS_TABDIALOG); + } + } + break; + case E_TABPAGE : { + // Increase ref count for tab-page data container first. + ++m_nRefCount_TabPages; + // If these instance the first user of the tab-page data container - create these impl static container! + if( m_nRefCount_TabPages == 1 ) + { + m_pDataContainer_TabPages = new SvtViewOptionsBase_Impl( LIST_TABPAGES ); + ItemHolder1::holdConfigItem(E_VIEWOPTIONS_TABPAGE); + } + } + break; + case E_WINDOW : { + // Increase ref count for window data container first. + ++m_nRefCount_Windows; + // If these instance the first user of the window data container - create these impl static container! + if( m_nRefCount_Windows == 1 ) + { + m_pDataContainer_Windows = new SvtViewOptionsBase_Impl( LIST_WINDOWS ); + ItemHolder1::holdConfigItem(E_VIEWOPTIONS_WINDOW); + } + } + break; + default : OSL_ENSURE( sal_False, "SvtViewOptions::SvtViewOptions()\nThese view type is unknown! All following calls at these instance will do nothing!\n" ); + } +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtViewOptions::~SvtViewOptions() +{ + // Global access, must be guarded (multithreading!) + ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); + + // Search for right dat container for this view type and deinitialize right data container or set right ref count! + switch( m_eViewType ) + { + case E_DIALOG : { + // Decrease ref count for dialog data container first. + --m_nRefCount_Dialogs; + // If these instance the last user of the dialog data container - delete these impl static container! + if( m_nRefCount_Dialogs == 0 ) + { + delete m_pDataContainer_Dialogs; + m_pDataContainer_Dialogs = NULL; + } + } + break; + case E_TABDIALOG : { + // Decrease ref count for tab-dialog data container first. + --m_nRefCount_TabDialogs; + // If these instance the last user of the tab-dialog data container - delete these impl static container! + if( m_nRefCount_TabDialogs == 0 ) + { + delete m_pDataContainer_TabDialogs; + m_pDataContainer_TabDialogs = NULL; + } + } + break; + case E_TABPAGE : { + // Decrease ref count for tab-page data container first. + --m_nRefCount_TabPages; + // If these instance the last user of the tab-page data container - delete these impl static container! + if( m_nRefCount_TabPages == 0 ) + { + delete m_pDataContainer_TabPages; + m_pDataContainer_TabPages = NULL; + } + } + break; + case E_WINDOW : { + // Decrease ref count for window data container first. + --m_nRefCount_Windows; + // If these instance the last user of the window data container - delete these impl static container! + if( m_nRefCount_Windows == 0 ) + { + delete m_pDataContainer_Windows; + m_pDataContainer_Windows = NULL; + } + } + break; + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtViewOptions::Exists() const +{ + // Ready for multithreading + ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); + + sal_Bool bExists = sal_False; + switch( m_eViewType ) + { + case E_DIALOG : { + bExists = m_pDataContainer_Dialogs->Exists( m_sViewName ); + } + break; + case E_TABDIALOG : { + bExists = m_pDataContainer_TabDialogs->Exists( m_sViewName ); + } + break; + case E_TABPAGE : { + bExists = m_pDataContainer_TabPages->Exists( m_sViewName ); + } + break; + case E_WINDOW : { + bExists = m_pDataContainer_Windows->Exists( m_sViewName ); + } + break; + } + return bExists; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtViewOptions::Delete() +{ + // Ready for multithreading + ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); + + sal_Bool bState = sal_False; + switch( m_eViewType ) + { + case E_DIALOG : { + bState = m_pDataContainer_Dialogs->Delete( m_sViewName ); + } + break; + case E_TABDIALOG : { + bState = m_pDataContainer_TabDialogs->Delete( m_sViewName ); + } + break; + case E_TABPAGE : { + bState = m_pDataContainer_TabPages->Delete( m_sViewName ); + } + break; + case E_WINDOW : { + bState = m_pDataContainer_Windows->Delete( m_sViewName ); + } + break; + } + return bState; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +::rtl::OUString SvtViewOptions::GetWindowState() const +{ + // Ready for multithreading + ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); + + ::rtl::OUString sState; + switch( m_eViewType ) + { + case E_DIALOG : { + sState = m_pDataContainer_Dialogs->GetWindowState( m_sViewName ); + } + break; + case E_TABDIALOG : { + sState = m_pDataContainer_TabDialogs->GetWindowState( m_sViewName ); + } + break; + case E_TABPAGE : { + sState = m_pDataContainer_TabPages->GetWindowState( m_sViewName ); + } + break; + case E_WINDOW : { + sState = m_pDataContainer_Windows->GetWindowState( m_sViewName ); + } + break; + } + return sState; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtViewOptions::SetWindowState( const ::rtl::OUString& sState ) +{ + // Ready for multithreading + ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); + + switch( m_eViewType ) + { + case E_DIALOG : { + m_pDataContainer_Dialogs->SetWindowState( m_sViewName, sState ); + } + break; + case E_TABDIALOG : { + m_pDataContainer_TabDialogs->SetWindowState( m_sViewName, sState ); + } + break; + case E_TABPAGE : { + m_pDataContainer_TabPages->SetWindowState( m_sViewName, sState ); + } + break; + case E_WINDOW : { + m_pDataContainer_Windows->SetWindowState( m_sViewName, sState ); + } + break; + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Int32 SvtViewOptions::GetPageID() const +{ + // Ready for multithreading + ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); + + // Safe impossible cases. + // These call isn't allowed for dialogs, tab-pages or windows! + OSL_ENSURE( !(m_eViewType==E_DIALOG||m_eViewType==E_TABPAGE||m_eViewType==E_WINDOW), "SvtViewOptions::GetPageID()\nCall not allowed for Dialogs, TabPages or Windows! I do nothing!\n" ); + + sal_Int32 nID = 0; + if( m_eViewType == E_TABDIALOG ) + nID = m_pDataContainer_TabDialogs->GetPageID( m_sViewName ); + return nID; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtViewOptions::SetPageID( sal_Int32 nID ) +{ + // Ready for multithreading + ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); + + // Safe impossible cases. + // These call isn't allowed for dialogs, tab-pages or windows! + OSL_ENSURE( !(m_eViewType==E_DIALOG||m_eViewType==E_TABPAGE||m_eViewType==E_WINDOW), "SvtViewOptions::SetPageID()\nCall not allowed for Dialogs, TabPages or Windows! I do nothing!\n" ); + + if( m_eViewType == E_TABDIALOG ) + m_pDataContainer_TabDialogs->SetPageID( m_sViewName, nID ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtViewOptions::IsVisible() const +{ + // Ready for multithreading + ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); + + // Safe impossible cases. + // These call isn't allowed for dialogs, tab-dialogs or tab-pages! + OSL_ENSURE( !(m_eViewType==E_DIALOG||m_eViewType==E_TABDIALOG||m_eViewType==E_TABPAGE), "SvtViewOptions::IsVisible()\nCall not allowed for Dialogs, TabDialogs or TabPages! I do nothing!\n" ); + + sal_Bool bState = sal_False; + if( m_eViewType == E_WINDOW ) + bState = m_pDataContainer_Windows->GetVisible( m_sViewName ); + + return bState; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtViewOptions::SetVisible( sal_Bool bState ) +{ + // Ready for multithreading + ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); + + // Safe impossible cases. + // These call isn't allowed for dialogs, tab-dialogs or tab-pages! + OSL_ENSURE( !(m_eViewType==E_DIALOG||m_eViewType==E_TABDIALOG||m_eViewType==E_TABPAGE), "SvtViewOptions::SetVisible()\nCall not allowed for Dialogs, TabDialogs or TabPages! I do nothing!\n" ); + + if( m_eViewType == E_WINDOW ) + m_pDataContainer_Windows->SetVisible( m_sViewName, bState ); +} + +//***************************************************************************************************************** +css::uno::Sequence< css::beans::NamedValue > SvtViewOptions::GetUserData() const +{ + // Ready for multithreading + ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); + + css::uno::Sequence< css::beans::NamedValue > lData; + switch( m_eViewType ) + { + case E_DIALOG : { + lData = m_pDataContainer_Dialogs->GetUserData( m_sViewName ); + } + break; + case E_TABDIALOG : { + lData = m_pDataContainer_TabDialogs->GetUserData( m_sViewName ); + } + break; + case E_TABPAGE : { + lData = m_pDataContainer_TabPages->GetUserData( m_sViewName ); + } + break; + case E_WINDOW : { + lData = m_pDataContainer_Windows->GetUserData( m_sViewName ); + } + break; + } + return lData; +} + +//***************************************************************************************************************** +void SvtViewOptions::SetUserData( const css::uno::Sequence< css::beans::NamedValue >& lData ) +{ + // Ready for multithreading + ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); + + switch( m_eViewType ) + { + case E_DIALOG : { + m_pDataContainer_Dialogs->SetUserData( m_sViewName, lData ); + } + break; + case E_TABDIALOG : { + m_pDataContainer_TabDialogs->SetUserData( m_sViewName, lData ); + } + break; + case E_TABPAGE : { + m_pDataContainer_TabPages->SetUserData( m_sViewName, lData ); + } + break; + case E_WINDOW : { + m_pDataContainer_Windows->SetUserData( m_sViewName, lData ); + } + break; + } +} + +//***************************************************************************************************************** +css::uno::Any SvtViewOptions::GetUserItem( const ::rtl::OUString& sName ) const +{ + // Ready for multithreading + ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); + + css::uno::Any aItem; + switch( m_eViewType ) + { + case E_DIALOG : { + aItem = m_pDataContainer_Dialogs->GetUserItem( m_sViewName, sName ); + } + break; + case E_TABDIALOG : { + aItem = m_pDataContainer_TabDialogs->GetUserItem( m_sViewName, sName ); + } + break; + case E_TABPAGE : { + aItem = m_pDataContainer_TabPages->GetUserItem( m_sViewName, sName ); + } + break; + case E_WINDOW : { + aItem = m_pDataContainer_Windows->GetUserItem( m_sViewName, sName ); + } + break; + } + return aItem; +} + +//***************************************************************************************************************** +void SvtViewOptions::SetUserItem( const ::rtl::OUString& sName , + const css::uno::Any& aValue ) +{ + // Ready for multithreading + ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); + + switch( m_eViewType ) + { + case E_DIALOG : { + m_pDataContainer_Dialogs->SetUserItem( m_sViewName, sName, aValue ); + } + break; + case E_TABDIALOG : { + m_pDataContainer_TabDialogs->SetUserItem( m_sViewName, sName, aValue ); + } + break; + case E_TABPAGE : { + m_pDataContainer_TabPages->SetUserItem( m_sViewName, sName, aValue ); + } + break; + case E_WINDOW : { + m_pDataContainer_Windows->SetUserItem( m_sViewName, sName, aValue ); + } + break; + } +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +::osl::Mutex& SvtViewOptions::GetOwnStaticMutex() +{ + // Initialize static mutex only for one time! + static ::osl::Mutex* pMutex = NULL; + // If these method first called (Mutex not already exist!) ... + if( pMutex == NULL ) + { + // ... we must create a new one. Protect follow code with the global mutex - + // It must be - we create a static variable! + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! + if( pMutex == NULL ) + { + // Create the new mutex and set it for return on static variable. + static ::osl::Mutex aMutex; + pMutex = &aMutex; + } + } + // Return new created or already existing mutex object. + return *pMutex; +} + +void SvtViewOptions::AcquireOptions() +{ + ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); + if( ++m_nRefCount_Dialogs == 1 ) + { + m_pDataContainer_Dialogs = new SvtViewOptionsBase_Impl( LIST_DIALOGS ); + ItemHolder1::holdConfigItem(E_VIEWOPTIONS_DIALOG); + } + if( ++m_nRefCount_TabDialogs == 1 ) + { + m_pDataContainer_TabDialogs = new SvtViewOptionsBase_Impl( LIST_TABDIALOGS ); + ItemHolder1::holdConfigItem(E_VIEWOPTIONS_TABDIALOG); + } + if( ++m_nRefCount_TabPages == 1 ) + { + m_pDataContainer_TabPages = new SvtViewOptionsBase_Impl( LIST_TABPAGES ); + ItemHolder1::holdConfigItem(E_VIEWOPTIONS_TABPAGE); + } + if( ++m_nRefCount_Windows == 1 ) + { + m_pDataContainer_Windows = new SvtViewOptionsBase_Impl( LIST_WINDOWS ); + ItemHolder1::holdConfigItem(E_VIEWOPTIONS_WINDOW); + } +} + +void SvtViewOptions::ReleaseOptions() +{ + ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); + if( --m_nRefCount_Dialogs == 0 ) + { + delete m_pDataContainer_Dialogs; + m_pDataContainer_Dialogs = NULL; + } + if( --m_nRefCount_TabDialogs == 0 ) + { + delete m_pDataContainer_TabDialogs; + m_pDataContainer_TabDialogs = NULL; + } + if( --m_nRefCount_TabPages == 0 ) + { + delete m_pDataContainer_TabPages; + m_pDataContainer_TabPages = NULL; + } + if( --m_nRefCount_Windows == 0 ) + { + delete m_pDataContainer_Windows; + m_pDataContainer_Windows = NULL; + } +} diff --git a/unotools/source/config/workingsetoptions.cxx b/unotools/source/config/workingsetoptions.cxx new file mode 100644 index 000000000000..6b17a63dad4d --- /dev/null +++ b/unotools/source/config/workingsetoptions.cxx @@ -0,0 +1,396 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: workingsetoptions.cxx,v $ + * $Revision: 1.10 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +#ifndef GCC +#endif + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include +#include +#include +#include +#include +#include + +#include + +//_________________________________________________________________________________________________________________ +// namespaces +//_________________________________________________________________________________________________________________ + +using namespace ::utl ; +using namespace ::rtl ; +using namespace ::osl ; +using namespace ::com::sun::star::uno ; + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +#define ROOTNODE_WORKINGSET OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/WorkingSet")) +#define DEFAULT_WINDOWLIST Sequence< OUString >() + +#define PROPERTYNAME_WINDOWLIST OUString(RTL_CONSTASCII_USTRINGPARAM("WindowList" )) + +#define PROPERTYHANDLE_WINDOWLIST 0 + +#define PROPERTYCOUNT 1 + +//_________________________________________________________________________________________________________________ +// private declarations! +//_________________________________________________________________________________________________________________ + +class SvtWorkingSetOptions_Impl : public ConfigItem +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + SvtWorkingSetOptions_Impl(); + ~SvtWorkingSetOptions_Impl(); + + //--------------------------------------------------------------------------------------------------------- + // overloaded methods of baseclass + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short called for notify of configmanager + @descr These method is called from the ConfigManager before application ends or from the + PropertyChangeListener if the sub tree broadcasts changes. You must update your + internal values. + + @seealso baseclass ConfigItem + + @param "seqPropertyNames" is the list of properties which should be updated. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void Notify( const Sequence< OUString >& seqPropertyNames ); + + /*-****************************************************************************************************//** + @short write changes to configuration + @descr These method writes the changed values into the sub tree + and should always called in our destructor to guarantee consistency of config data. + + @seealso baseclass ConfigItem + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void Commit(); + + //--------------------------------------------------------------------------------------------------------- + // public interface + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short access method to get internal values + @descr These method give us a chance to regulate acces to ouer internal values. + It's not used in the moment - but it's possible for the feature! + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + Sequence< OUString > GetWindowList( ) const ; + void SetWindowList( const Sequence< OUString >& seqWindowList ) ; + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return list of key names of ouer configuration management which represent oue module tree + @descr These methods return a static const list of key names. We need it to get needed values from our + configuration management. + + @seealso - + + @param - + @return A list of needed configuration keys is returned. + + @onerror - + *//*-*****************************************************************************************************/ + + static Sequence< OUString > GetPropertyNames(); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + Sequence< OUString > m_seqWindowList ; +}; + +//_________________________________________________________________________________________________________________ +// definitions +//_________________________________________________________________________________________________________________ + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtWorkingSetOptions_Impl::SvtWorkingSetOptions_Impl() + // Init baseclasses first + : ConfigItem ( ROOTNODE_WORKINGSET ) + // Init member then. + , m_seqWindowList ( DEFAULT_WINDOWLIST ) +{ + // Use our static list of configuration keys to get his values. + Sequence< OUString > seqNames = GetPropertyNames ( ); + Sequence< Any > seqValues = GetProperties ( seqNames ); + + // Safe impossible cases. + // We need values from ALL configuration keys. + // Follow assignment use order of values in relation to our list of key names! + DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtWorkingSetOptions_Impl::SvtWorkingSetOptions_Impl()\nI miss some values of configuration keys!\n" ); + + // Copy values from list in right order to ouer internal member. + sal_Int32 nPropertyCount = seqValues.getLength(); + for( sal_Int32 nProperty=0; nProperty>= m_seqWindowList; + } + break; + } + } + + // Enable notification mechanism of ouer baseclass. + // We need it to get information about changes outside these class on ouer used configuration keys! + EnableNotification( seqNames ); +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtWorkingSetOptions_Impl::~SvtWorkingSetOptions_Impl() +{ + // We must save our current values .. if user forget it! + if( IsModified() == sal_True ) + { + Commit(); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtWorkingSetOptions_Impl::Notify( const Sequence< OUString >& seqPropertyNames ) +{ + // Use given list of updated properties to get his values from configuration directly! + Sequence< Any > seqValues = GetProperties( seqPropertyNames ); + // Safe impossible cases. + // We need values from ALL notified configuration keys. + DBG_ASSERT( !(seqPropertyNames.getLength()!=seqValues.getLength()), "SvtWorkingSetOptions_Impl::Notify()\nI miss some values of configuration keys!\n" ); + // Step over list of property names and get right value from coreesponding value list to set it on internal members! + sal_Int32 nCount = seqPropertyNames.getLength(); + for( sal_Int32 nProperty=0; nProperty>= m_seqWindowList; + } + #if OSL_DEBUG_LEVEL > 1 + else DBG_ASSERT( sal_False, "SvtWorkingSetOptions_Impl::Notify()\nUnkown property detected ... I can't handle these!\n" ); + #endif + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtWorkingSetOptions_Impl::Commit() +{ + // Get names of supported properties, create a list for values and copy current values to it. + Sequence< OUString > seqNames = GetPropertyNames (); + sal_Int32 nCount = seqNames.getLength(); + Sequence< Any > seqValues ( nCount ); + for( sal_Int32 nProperty=0; nProperty SvtWorkingSetOptions_Impl::GetWindowList() const +{ + return m_seqWindowList; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtWorkingSetOptions_Impl::SetWindowList( const Sequence< OUString >& seqWindowList ) +{ + m_seqWindowList = seqWindowList; + SetModified(); +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Sequence< OUString > SvtWorkingSetOptions_Impl::GetPropertyNames() +{ + // Build static list of configuration key names. + static const OUString pProperties[] = + { + PROPERTYNAME_WINDOWLIST , + }; + // Initialize return sequence with these list ... + static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + // ... and return it. + return seqPropertyNames; +} + +//***************************************************************************************************************** +// initialize static member +// DON'T DO IT IN YOUR HEADER! +// see definition for further informations +//***************************************************************************************************************** +SvtWorkingSetOptions_Impl* SvtWorkingSetOptions::m_pDataContainer = NULL ; +sal_Int32 SvtWorkingSetOptions::m_nRefCount = 0 ; + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtWorkingSetOptions::SvtWorkingSetOptions() +{ + // Global access, must be guarded (multithreading!). + MutexGuard aGuard( GetOwnStaticMutex() ); + // Increase ouer refcount ... + ++m_nRefCount; + // ... and initialize ouer data container only if it not already exist! + if( m_pDataContainer == NULL ) + { + m_pDataContainer = new SvtWorkingSetOptions_Impl; + ItemHolder1::holdConfigItem(E_WORKINGSETOPTIONS); + } +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtWorkingSetOptions::~SvtWorkingSetOptions() +{ + // Global access, must be guarded (multithreading!) + MutexGuard aGuard( GetOwnStaticMutex() ); + // Decrease ouer refcount. + --m_nRefCount; + // If last instance was deleted ... + // we must destroy ouer static data container! + if( m_nRefCount <= 0 ) + { + delete m_pDataContainer; + m_pDataContainer = NULL; + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +Sequence< OUString > SvtWorkingSetOptions::GetWindowList() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetWindowList(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtWorkingSetOptions::SetWindowList( const Sequence< OUString >& seqWindowList ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetWindowList( seqWindowList ); +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Mutex& SvtWorkingSetOptions::GetOwnStaticMutex() +{ + // Initialize static mutex only for one time! + static Mutex* pMutex = NULL; + // If these method first called (Mutex not already exist!) ... + if( pMutex == NULL ) + { + // ... we must create a new one. Protect follow code with the global mutex - + // It must be - we create a static variable! + MutexGuard aGuard( Mutex::getGlobalMutex() ); + // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! + if( pMutex == NULL ) + { + // Create the new mutex and set it for return on static variable. + static Mutex aMutex; + pMutex = &aMutex; + } + } + // Return new created or already existing mutex object. + return *pMutex; +} diff --git a/unotools/source/config/xmlaccelcfg.cxx b/unotools/source/config/xmlaccelcfg.cxx new file mode 100644 index 000000000000..b1c3f1e31e2d --- /dev/null +++ b/unotools/source/config/xmlaccelcfg.cxx @@ -0,0 +1,418 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: xmlaccelcfg.cxx,v $ + * $Revision: 1.8 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" + +#include + +#include +#include +#include + +using namespace rtl; +using namespace com::sun::star::uno; +using namespace com::sun::star::xml::sax; + +#define ELEMENT_ACCELERATORLIST "acceleratorlist" +#define ELEMENT_ACCELERATORITEM "item" + +#define ATTRIBUTE_KEYCODE "code" +#define ATTRIBUTE_MODIFIER "modifier" +#define ATTRIBUTE_URL "url" + +#define ATTRIBUTE_TYPE_CDATA "CDATA" + +// ------------------------------------------------------------------ + +struct AttributeListImpl_impl; +class AttributeListImpl : public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XAttributeList > +{ +protected: + ~AttributeListImpl(); + +public: + AttributeListImpl(); + AttributeListImpl( const AttributeListImpl & ); + +public: + virtual sal_Int16 SAL_CALL getLength(void) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getNameByIndex(sal_Int16 i) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTypeByIndex(sal_Int16 i) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTypeByName(const ::rtl::OUString& aName) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getValueByIndex(sal_Int16 i) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getValueByName(const ::rtl::OUString& aName) throw (::com::sun::star::uno::RuntimeException); + +public: + void addAttribute( const ::rtl::OUString &sName , const ::rtl::OUString &sType , const ::rtl::OUString &sValue ); + void clear(); + +private: + struct AttributeListImpl_impl *m_pImpl; +}; + +struct TagAttribute +{ + TagAttribute(){} + TagAttribute( const OUString &aName, const OUString &aType , const OUString &aValue ) + { + sName = aName; + sType = aType; + sValue = aValue; + } + + OUString sName; + OUString sType; + OUString sValue; +}; + +struct AttributeListImpl_impl +{ + AttributeListImpl_impl() + { + // performance improvement during adding + vecAttribute.reserve(20); + } + ::std::vector vecAttribute; +}; + + + +sal_Int16 SAL_CALL AttributeListImpl::getLength(void) throw (RuntimeException) +{ + return sal::static_int_cast< sal_Int16 >(m_pImpl->vecAttribute.size()); +} + + +AttributeListImpl::AttributeListImpl( const AttributeListImpl &r ) : + cppu::WeakImplHelper1(r) +{ + m_pImpl = new AttributeListImpl_impl; + *m_pImpl = *(r.m_pImpl); +} + +OUString AttributeListImpl::getNameByIndex(sal_Int16 i) throw (RuntimeException) +{ + if( i < sal::static_int_cast(m_pImpl->vecAttribute.size()) ) { + return m_pImpl->vecAttribute[i].sName; + } + return OUString(); +} + + +OUString AttributeListImpl::getTypeByIndex(sal_Int16 i) throw (RuntimeException) +{ + if( i < sal::static_int_cast(m_pImpl->vecAttribute.size()) ) { + return m_pImpl->vecAttribute[i].sType; + } + return OUString(); +} + +OUString AttributeListImpl::getValueByIndex(sal_Int16 i) throw (RuntimeException) +{ + if( i < sal::static_int_cast(m_pImpl->vecAttribute.size()) ) { + return m_pImpl->vecAttribute[i].sValue; + } + return OUString(); + +} + +OUString AttributeListImpl::getTypeByName( const OUString& sName ) throw (RuntimeException) +{ + ::std::vector::iterator ii = m_pImpl->vecAttribute.begin(); + + for( ; ii != m_pImpl->vecAttribute.end() ; ii ++ ) { + if( (*ii).sName == sName ) { + return (*ii).sType; + } + } + return OUString(); +} + +OUString AttributeListImpl::getValueByName(const OUString& sName) throw (RuntimeException) +{ + ::std::vector::iterator ii = m_pImpl->vecAttribute.begin(); + + for( ; ii != m_pImpl->vecAttribute.end() ; ii ++ ) { + if( (*ii).sName == sName ) { + return (*ii).sValue; + } + } + return OUString(); +} + + +AttributeListImpl::AttributeListImpl() +{ + m_pImpl = new AttributeListImpl_impl; +} + + + +AttributeListImpl::~AttributeListImpl() +{ + delete m_pImpl; +} + + +void AttributeListImpl::addAttribute( const OUString &sName , + const OUString &sType , + const OUString &sValue ) +{ + m_pImpl->vecAttribute.push_back( TagAttribute( sName , sType , sValue ) ); +} + +void AttributeListImpl::clear() +{ + ::std::vector dummy; + m_pImpl->vecAttribute.swap( dummy ); + + OSL_ASSERT( ! getLength() ); +} + +// ------------------------------------------------------------------ + +Any SAL_CALL OReadAccelatorDocumentHandler::queryInterface( const Type & rType ) throw( RuntimeException ) +{ + Any a = ::cppu::queryInterface( rType ,SAL_STATIC_CAST( XDocumentHandler*, this )); + if ( a.hasValue() ) + return a; + else + return OWeakObject::queryInterface( rType ); +} + +void SAL_CALL OReadAccelatorDocumentHandler::ignorableWhitespace( + const OUString& ) +throw( SAXException, RuntimeException ) +{ +} + +void SAL_CALL OReadAccelatorDocumentHandler::processingInstruction( + const OUString&, const OUString& ) +throw( SAXException, RuntimeException ) +{ +} + +void SAL_CALL OReadAccelatorDocumentHandler::setDocumentLocator( + const Reference< XLocator > &xLocator) +throw( SAXException, RuntimeException ) +{ + m_xLocator = xLocator; +} + +::rtl::OUString OReadAccelatorDocumentHandler::getErrorLineString() +{ + char buffer[32]; + + if ( m_xLocator.is() ) + { + return OUString::createFromAscii( buffer ); + } + else + return OUString(); +} + +void SAL_CALL OReadAccelatorDocumentHandler::startDocument(void) + throw ( SAXException, RuntimeException ) +{ +} + +void SAL_CALL OReadAccelatorDocumentHandler::endDocument(void) + throw( SAXException, RuntimeException ) +{ + if ( m_nElementDepth > 0 ) + { + OUString aErrorMessage = getErrorLineString(); + aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "A closing element is missing!" )); + throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); + } +} + + +void SAL_CALL OReadAccelatorDocumentHandler::startElement( + const OUString& aElementName, const Reference< XAttributeList > &xAttrList ) +throw( SAXException, RuntimeException ) +{ + m_nElementDepth++; + + if ( aElementName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ELEMENT_ACCELERATORLIST ))) + { + // acceleratorlist + if ( m_bAcceleratorMode ) + { + OUString aErrorMessage = getErrorLineString(); + aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "Accelerator list used twice!" )); + throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); + } + else + m_bAcceleratorMode = sal_True; + } + else if ( aElementName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ELEMENT_ACCELERATORITEM ))) + { + // accelerator item + if ( !m_bAcceleratorMode ) + { + OUString aErrorMessage = getErrorLineString(); + aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "Accelerator list element has to be used before!" )); + throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); + } + else + { + // read accelerator item + m_bItemCloseExpected = sal_True; + + SvtAcceleratorConfigItem aItem; + + // read attributes for accelerator + for ( sal_Int16 i=0; i< xAttrList->getLength(); i++ ) + { + OUString aName = xAttrList->getNameByIndex( i ); + OUString aValue = xAttrList->getValueByIndex( i ); + + if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_URL ))) + aItem.aCommand = aValue; + else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_MODIFIER ))) + aItem.nModifier = (sal_uInt16)aValue.toInt32(); + else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_KEYCODE ))) + aItem.nCode = (sal_uInt16)aValue.toInt32(); + } + + m_aReadAcceleratorList.push_back( aItem ); + } + } + else + { + OUString aErrorMessage = getErrorLineString(); + aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "Unknown element found!" )); + throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); + } +} + + +void SAL_CALL OReadAccelatorDocumentHandler::characters(const rtl::OUString&) +throw( SAXException, RuntimeException ) +{ +} + + +void SAL_CALL OReadAccelatorDocumentHandler::endElement( const OUString& aName ) + throw( SAXException, RuntimeException ) +{ + m_nElementDepth--; + + if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ELEMENT_ACCELERATORLIST ))) + { + // acceleratorlist + if ( !m_bAcceleratorMode ) + { + OUString aErrorMessage = getErrorLineString(); + aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "Accelerator list used twice!" )); + throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); + } + } + else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ELEMENT_ACCELERATORITEM ))) + { + if ( !m_bItemCloseExpected ) + { + OUString aErrorMessage = getErrorLineString(); + aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "Closing accelerator item element expected!" )); + throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); + } + } + else + { + OUString aErrorMessage = getErrorLineString(); + aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "Unknown closing element found!" )); + throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); + } +} + +// ------------------------------------------------------------------ + +OWriteAccelatorDocumentHandler::OWriteAccelatorDocumentHandler( + const SvtAcceleratorItemList& aWriteAcceleratorList, Reference< XDocumentHandler > xDocumentHandler ) : + m_xWriteDocumentHandler( xDocumentHandler ), + m_aWriteAcceleratorList( aWriteAcceleratorList ) +{ + m_aAttributeType = OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_TYPE_CDATA )); +} + +OWriteAccelatorDocumentHandler::~OWriteAccelatorDocumentHandler() +{ +} + +void OWriteAccelatorDocumentHandler::WriteAcceleratorDocument() + throw ( SAXException, RuntimeException ) +{ + AttributeListImpl* pList = new AttributeListImpl; + Reference< XAttributeList > rList( (XAttributeList *)pList , UNO_QUERY ); + + m_xWriteDocumentHandler->startDocument(); + m_xWriteDocumentHandler->startElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_ACCELERATORLIST )), rList ); + m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); + + std::list< SvtAcceleratorConfigItem>::const_iterator p; + for ( p = m_aWriteAcceleratorList.begin(); p != m_aWriteAcceleratorList.end(); p++ ) + WriteAcceleratorItem( *p ); + + m_xWriteDocumentHandler->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_ACCELERATORLIST )) ); + m_xWriteDocumentHandler->endDocument(); +} + +void OWriteAccelatorDocumentHandler::WriteAcceleratorItem( + const SvtAcceleratorConfigItem& aAcceleratorItem ) + throw( SAXException, RuntimeException ) +{ + AttributeListImpl* pAcceleratorAttributes = new AttributeListImpl; + Reference< XAttributeList > xAcceleratorAttrList( (XAttributeList *)pAcceleratorAttributes , UNO_QUERY ); + + // set attributes + pAcceleratorAttributes->addAttribute( + OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_KEYCODE )), + m_aAttributeType, + OUString::valueOf( aAcceleratorItem.nCode )); + + pAcceleratorAttributes->addAttribute( + OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_MODIFIER )), + m_aAttributeType, + OUString::valueOf( aAcceleratorItem.nModifier )); + + pAcceleratorAttributes->addAttribute( + OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_URL )), + m_aAttributeType, + aAcceleratorItem.aCommand ); + + // write start element + m_xWriteDocumentHandler->startElement( + OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_ACCELERATORITEM )), + xAcceleratorAttrList ); + m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); + m_xWriteDocumentHandler->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_ACCELERATORITEM )) ); +} -- cgit -- cgit From 480ff1e9c430b6e4feba8c81565a3d26267681a9 Mon Sep 17 00:00:00 2001 From: mathias Date: Tue, 6 Oct 2009 12:26:34 +0200 Subject: warnings fixed --- unotools/inc/unotools/historyoptions_const.hxx | 2 +- unotools/source/config/configitem.cxx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/unotools/inc/unotools/historyoptions_const.hxx b/unotools/inc/unotools/historyoptions_const.hxx index c9148aeb26f8..48632b66b018 100644 --- a/unotools/inc/unotools/historyoptions_const.hxx +++ b/unotools/inc/unotools/historyoptions_const.hxx @@ -34,7 +34,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" #ifndef INCLUDE_CONFIGITEMS_HISTORYOPTIONS_CONST_HXX #define INCLUDE_CONFIGITEMS_HISTORYOPTIONS_CONST_HXX diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx index 944ea0535a93..3170fae25a5d 100644 --- a/unotools/source/config/configitem.cxx +++ b/unotools/source/config/configitem.cxx @@ -104,7 +104,7 @@ namespace utl{ virtual void SAL_CALL disposing( const EventObject& Source ) throw(RuntimeException); //XAsyncCallback - virtual void SAL_CALL notify ( const Any& rData ); + virtual void SAL_CALL notify ( const Any& rData ) throw(RuntimeException); }; /* -----------------------------12.02.01 11:38-------------------------------- @@ -222,7 +222,7 @@ void ConfigChangeListener_Impl::changesOccurred( const ChangesEvent& rEvent ) th } } -void ConfigChangeListener_Impl::notify ( const Any& rData ) +void ConfigChangeListener_Impl::notify ( const Any& rData ) throw(RuntimeException) { Sequence aChangedNames; if ( (rData >>= aChangedNames) && pParent ) -- cgit From b429c6949ce70e47538f90f5c67979b9d0ec0333 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Tue, 6 Oct 2009 12:35:34 +0200 Subject: #i103496#: move kde_headers.h from vcl to shell --- vcl/prj/build.lst | 2 +- vcl/unx/inc/kde_headers.h | 97 ------------------------------------ vcl/unx/kde/kdedata.cxx | 2 +- vcl/unx/kde/salnativewidgets-kde.cxx | 2 +- 4 files changed, 3 insertions(+), 100 deletions(-) delete mode 100644 vcl/unx/inc/kde_headers.h diff --git a/vcl/prj/build.lst b/vcl/prj/build.lst index 908dd1eafd72..5d2aaf90c6f7 100644 --- a/vcl/prj/build.lst +++ b/vcl/prj/build.lst @@ -1,4 +1,4 @@ -vc vcl : l10n apple_remote BOOST:boost rsc sot ucbhelper unotools ICU:icu GRAPHITE:graphite i18npool i18nutil unoil ridljar X11_EXTENSIONS:x11_extensions offuh basegfx basebmp tools transex3 icc SO:print_header cpputools NULL +vc vcl : l10n apple_remote BOOST:boost rsc sot ucbhelper unotools ICU:icu GRAPHITE:graphite i18npool i18nutil unoil ridljar X11_EXTENSIONS:x11_extensions offuh basegfx basebmp tools transex3 icc SO:print_header cpputools shell NULL vc vcl usr1 - all vc_mkout NULL vc vcl\inc nmake - all vc_inc NULL vc vcl\source\glyphs nmake - all vc_glyphs vc_inc NULL diff --git a/vcl/unx/inc/kde_headers.h b/vcl/unx/inc/kde_headers.h deleted file mode 100644 index ccbffc99cb99..000000000000 --- a/vcl/unx/inc/kde_headers.h +++ /dev/null @@ -1,97 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: kde_headers.h,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_VCL_KDE_HEADERS_H -#define INCLUDED_VCL_KDE_HEADERS_H - -/* ********* Suppress warnings if needed */ -#include "sal/config.h" - -#if defined __GNUC__ -#pragma GCC system_header -#endif - - -/* ********* Hack, but needed because of conflicting types... */ -#define Region QtXRegion - - -/* ********* Qt headers */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* ********* See hack on top of this file */ -#undef Region - - -/* ********* KDE base headers */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -/* ********* KDE address book connectivity headers */ -#include -#include -#include -#include - - -#endif diff --git a/vcl/unx/kde/kdedata.cxx b/vcl/unx/kde/kdedata.cxx index 1b5a2f86dcee..9da57b6e790d 100644 --- a/vcl/unx/kde/kdedata.cxx +++ b/vcl/unx/kde/kdedata.cxx @@ -29,7 +29,7 @@ #include "precompiled_vcl.hxx" #define _SV_SALDATA_CXX -#include "kde_headers.h" +#include #include #include diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx index 8046d22d75d3..0eb8e9656774 100644 --- a/vcl/unx/kde/salnativewidgets-kde.cxx +++ b/vcl/unx/kde/salnativewidgets-kde.cxx @@ -32,7 +32,7 @@ #include "precompiled_vcl.hxx" #define _SV_SALNATIVEWIDGETS_KDE_CXX -#include "kde_headers.h" +#include #include #include -- cgit From fdf3420369d17bf418872a86848c0abe346e6c0b Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Tue, 6 Oct 2009 16:45:54 +0200 Subject: #i105613# catch exceptions in accessibility event handler (thanks cmc) --- vcl/unx/gtk/a11y/atkutil.cxx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx index 5206c8ce87ca..c92a69d3fb49 100644 --- a/vcl/unx/gtk/a11y/atkutil.cxx +++ b/vcl/unx/gtk/a11y/atkutil.cxx @@ -221,7 +221,7 @@ void DocumentFocusListener::notifyEvent( const accessibility::AccessibleEventObj if( accessibility::AccessibleStateType::FOCUSED == nState ) atk_wrapper_focus_tracker_notify_when_idle( getAccessible(aEvent) ); } - catch(lang::IndexOutOfBoundsException e) + catch(const lang::IndexOutOfBoundsException &e) { g_warning("Focused object has invalid index in parent"); } @@ -577,7 +577,14 @@ static void handle_get_focus(::VclWindowEvent const * pEvent) if( g_aWindowList.find(pWindow) == g_aWindowList.end() ) { g_aWindowList.insert(pWindow); - aDocumentFocusListener->attachRecursive(xAccessible, xContext, xStateSet); + try + { + aDocumentFocusListener->attachRecursive(xAccessible, xContext, xStateSet); + } + catch( const uno::Exception &e ) + { + g_warning( "Exception caught processing focus events" ); + } } #ifdef ENABLE_TRACING else @@ -608,7 +615,7 @@ static void handle_menu_highlighted(::VclMenuEvent const * pEvent) } } } - catch( uno::Exception e ) + catch( const uno::Exception& e ) { g_warning( "Exception caught processing menu highlight events" ); } -- cgit From e6b4345c7f4026cb9b3e8dee6ecc84b3531e1950 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Thu, 8 Oct 2009 12:20:11 +0200 Subject: #i103496#: split svtools in two libs, depending on whether the code needs vcl or not --- svl/inc/PasswordHelper.hxx | 57 + svl/inc/adrparse.hxx | 110 + svl/inc/broadcast.hxx | 70 + svl/inc/cntnrsrt.hxx | 177 + svl/inc/cntwids.hrc | 509 +++ svl/inc/filenotation.hxx | 74 + svl/inc/flbytes.hxx | 174 + svl/inc/folderrestriction.hxx | 59 + svl/inc/fstathelper.hxx | 68 + svl/inc/inetdef.hxx | 32 + svl/inc/inetmsg.hxx | 32 + svl/inc/inetstrm.hxx | 32 + svl/inc/instrm.hxx | 83 + svl/inc/listener.hxx | 68 + svl/inc/listeneriter.hxx | 82 + svl/inc/lngmisc.hxx | 76 + svl/inc/makefile.mk | 52 + svl/inc/memberid.hrc | 47 + svl/inc/misccfg.hxx | 75 + svl/inc/nfsymbol.hxx | 72 + svl/inc/numuno.hxx | 102 + svl/inc/outstrm.hxx | 69 + svl/inc/pch/precompiled_svtools.cxx | 32 + svl/inc/pch/precompiled_svtools.hxx | 440 ++ svl/inc/pickerhelper.hxx | 72 + svl/inc/pickerhistory.hxx | 54 + svl/inc/pickerhistoryaccess.hxx | 57 + svl/inc/poolcach.hxx | 61 + svl/inc/strmadpt.hxx | 138 + svl/inc/stylepool.hxx | 103 + svl/inc/svl/aeitem.hxx | 74 + svl/inc/svl/bintitem.hxx | 88 + svl/inc/svl/brdcst.hxx | 78 + svl/inc/svl/cancel.hxx | 145 + svl/inc/svl/cenumitm.hxx | 180 + svl/inc/svl/cintitem.hxx | 286 ++ svl/inc/svl/cjkoptions.hxx | 82 + svl/inc/svl/cnclhint.hxx | 51 + svl/inc/svl/cntwall.hxx | 83 + svl/inc/svl/cstitem.hxx | 94 + svl/inc/svl/ctloptions.hxx | 100 + svl/inc/svl/ctypeitm.hxx | 85 + svl/inc/svl/custritm.hxx | 95 + svl/inc/svl/dateitem.hxx | 109 + svl/inc/svl/documentlockfile.hxx | 75 + svl/inc/svl/dtritem.hxx | 93 + svl/inc/svl/eitem.hxx | 72 + svl/inc/svl/filerec.hxx | 1087 +++++ svl/inc/svl/flagitem.hxx | 83 + svl/inc/svl/frqitem.hxx | 178 + svl/inc/svl/globalnameitem.hxx | 62 + svl/inc/svl/hint.hxx | 75 + svl/inc/svl/httpcook.hxx | 155 + svl/inc/svl/ilstitem.hxx | 66 + svl/inc/svl/imageitm.hxx | 62 + svl/inc/svl/inethist.hxx | 135 + svl/inc/svl/inettype.hxx | 479 +++ svl/inc/svl/intitem.hxx | 176 + svl/inc/svl/isethint.hxx | 58 + svl/inc/svl/itemiter.hxx | 71 + svl/inc/svl/itempool.hxx | 306 ++ svl/inc/svl/itemprop.hxx | 222 + svl/inc/svl/itemset.hxx | 216 + svl/inc/svl/languageoptions.hxx | 131 + svl/inc/svl/lckbitem.hxx | 68 + svl/inc/svl/lockfilecommon.hxx | 84 + svl/inc/svl/lstner.hxx | 81 + svl/inc/svl/macitem.hxx | 212 + svl/inc/svl/metitem.hxx | 56 + svl/inc/svl/nfkeytab.hxx | 120 + svl/inc/svl/nfversi.hxx | 72 + svl/inc/svl/nranges.hxx | 97 + svl/inc/svl/ondemand.hxx | 468 ++ svl/inc/svl/ownlist.hxx | 102 + svl/inc/svl/poolitem.hxx | 491 +++ svl/inc/svl/ptitem.hxx | 80 + svl/inc/svl/rectitem.hxx | 80 + svl/inc/svl/restrictedpaths.hxx | 85 + svl/inc/svl/rngitem.hxx | 117 + svl/inc/svl/sfontitm.hxx | 244 ++ svl/inc/svl/sharecontrolfile.hxx | 88 + svl/inc/svl/slstitm.hxx | 87 + svl/inc/svl/smplhint.hxx | 102 + svl/inc/svl/solar.hrc | 312 ++ svl/inc/svl/stritem.hxx | 58 + svl/inc/svl/style.hrc | 42 + svl/inc/svl/style.hxx | 400 ++ svl/inc/svl/svarray.hxx | 1056 +++++ svl/inc/svl/svdde.hxx | 483 +++ svl/inc/svl/svldata.hxx | 117 + svl/inc/svl/svldllapi.h | 44 + svl/inc/svl/svstdarr.hxx | 274 ++ svl/inc/svl/svtools.hrc | 526 +++ svl/inc/svl/syslocale.hxx | 78 + svl/inc/svl/syslocaleoptions.hxx | 164 + svl/inc/svl/szitem.hxx | 80 + svl/inc/svl/tfrmitem.hxx | 90 + svl/inc/svl/tresitem.hxx | 65 + svl/inc/svl/undo.hxx | 240 ++ svl/inc/svl/urlfilter.hxx | 66 + svl/inc/svl/visitem.hxx | 96 + svl/inc/svl/zforlist.hxx | 1014 +++++ svl/inc/svl/zformat.hxx | 589 +++ svl/inc/urihelper.hxx | 238 ++ svl/inc/urlbmk.hxx | 72 + svl/inc/whiter.hxx | 63 + svl/inc/xmlement.hxx | 46 + svl/prj/build.lst | 55 + svl/prj/d.lst | 133 + svl/qa/complex/ConfigItems/CheckConfigItems.java | 186 + .../ConfigItems/helper/AccessibilityOptTest.cxx | 400 ++ .../ConfigItems/helper/AccessibilityOptTest.hxx | 78 + .../complex/ConfigItems/helper/ConfigItemTest.cxx | 253 ++ .../complex/ConfigItems/helper/HistoryOptTest.cxx | 806 ++++ .../complex/ConfigItems/helper/HistoryOptTest.hxx | 211 + svl/qa/complex/ConfigItems/helper/PrintOptTest.cxx | 743 ++++ svl/qa/complex/ConfigItems/helper/PrintOptTest.hxx | 92 + svl/qa/complex/ConfigItems/helper/UserOptTest.cxx | 274 ++ svl/qa/complex/ConfigItems/helper/UserOptTest.hxx | 78 + svl/qa/complex/ConfigItems/helper/exports.map | 10 + svl/qa/complex/ConfigItems/helper/makefile.mk | 81 + svl/qa/complex/ConfigItems/makefile.mk | 91 + .../passwordcontainer/MasterPasswdHandler.java | 61 + .../passwordcontainer/PasswordContainerTest.java | 36 + .../PasswordContainerUnitTest.java | 77 + svl/qa/complex/passwordcontainer/Test01.java | 115 + svl/qa/complex/passwordcontainer/Test02.java | 159 + svl/qa/complex/passwordcontainer/Test03.java | 122 + svl/qa/complex/passwordcontainer/TestHelper.java | 92 + svl/qa/complex/passwordcontainer/makefile.mk | 91 + svl/qa/export.map | 38 + svl/qa/makefile.mk | 103 + svl/qa/test_URIHelper.cxx | 462 ++ svl/source/config/cjkoptions.cxx | 510 +++ svl/source/config/ctloptions.cxx | 503 +++ svl/source/config/itemholder2.cxx | 242 ++ svl/source/config/itemholder2.hxx | 92 + svl/source/config/languageoptions.cxx | 283 ++ svl/source/config/makefile.mk | 66 + svl/source/config/misccfg.cxx | 195 + svl/source/config/syslocaleoptions.cxx | 637 +++ svl/source/filepicker/makefile.mk | 51 + svl/source/filepicker/pickerhelper.cxx | 102 + svl/source/filepicker/pickerhistory.cxx | 141 + svl/source/filerec/filerec.cxx | 1019 +++++ svl/source/filerec/makefile.mk | 50 + svl/source/fsstor/exports.map | 8 + svl/source/fsstor/fsfactory.cxx | 295 ++ svl/source/fsstor/fsstorage.cxx | 1617 +++++++ svl/source/fsstor/fsstorage.hxx | 340 ++ svl/source/fsstor/makefile.mk | 70 + svl/source/fsstor/oinputstreamcontainer.cxx | 350 ++ svl/source/fsstor/oinputstreamcontainer.hxx | 99 + svl/source/fsstor/ostreamcontainer.cxx | 570 +++ svl/source/fsstor/ostreamcontainer.hxx | 128 + svl/source/inc/fsfactory.hxx | 75 + svl/source/inc/passwordcontainer.hxx | 429 ++ svl/source/inc/poolio.hxx | 204 + svl/source/items/aeitem.cxx | 317 ++ svl/source/items/bintitem.cxx | 169 + svl/source/items/cenumitm.cxx | 297 ++ svl/source/items/cintitem.cxx | 565 +++ svl/source/items/cntwall.cxx | 170 + svl/source/items/cstitem.cxx | 252 ++ svl/source/items/cstitem.src | 112 + svl/source/items/ctypeitm.cxx | 254 ++ svl/source/items/custritm.cxx | 141 + svl/source/items/dateitem.cxx | 284 ++ svl/source/items/dtritem.cxx | 244 ++ svl/source/items/eitem.cxx | 50 + svl/source/items/flagitem.cxx | 166 + svl/source/items/frqitem.cxx | 580 +++ svl/source/items/globalnameitem.cxx | 117 + svl/source/items/ilstitem.cxx | 106 + svl/source/items/imageitm.cxx | 148 + svl/source/items/intitem.cxx | 261 ++ svl/source/items/itemiter.cxx | 122 + svl/source/items/itempool.cxx | 1176 +++++ svl/source/items/itemprop.cxx | 506 +++ svl/source/items/itemset.cxx | 2128 ++++++++++ svl/source/items/lckbitem.cxx | 194 + svl/source/items/macitem.cxx | 298 ++ svl/source/items/makefile.mk | 65 + svl/source/items/nranges.cxx | 853 ++++ svl/source/items/poolcach.cxx | 159 + svl/source/items/poolio.cxx | 1715 ++++++++ svl/source/items/poolitem.cxx | 527 +++ svl/source/items/ptitem.cxx | 208 + svl/source/items/rectitem.cxx | 204 + svl/source/items/rngitem.cxx | 57 + svl/source/items/rngitem_inc.cxx | 243 ++ svl/source/items/sfontitm.cxx | 142 + svl/source/items/sitem.cxx | 116 + svl/source/items/slstitm.cxx | 425 ++ svl/source/items/stritem.cxx | 75 + svl/source/items/style.cxx | 1381 ++++++ svl/source/items/stylepool.cxx | 542 +++ svl/source/items/szitem.cxx | 214 + svl/source/items/tfrmitem.cxx | 184 + svl/source/items/tresitem.cxx | 78 + svl/source/items/visitem.cxx | 148 + svl/source/items/whassert.hxx | 57 + svl/source/items/whiter.cxx | 127 + svl/source/memtools/makefile.mk | 50 + svl/source/memtools/svarray.cxx | 385 ++ svl/source/misc/PasswordHelper.cxx | 109 + svl/source/misc/adrparse.cxx | 921 ++++ svl/source/misc/documentlockfile.cxx | 238 ++ svl/source/misc/filenotation.cxx | 147 + svl/source/misc/flbytes.cxx | 432 ++ svl/source/misc/folderrestriction.cxx | 109 + svl/source/misc/fstathelper.cxx | 103 + svl/source/misc/inethist.cxx | 545 +++ svl/source/misc/inettype.cxx | 1348 ++++++ svl/source/misc/lngmisc.cxx | 141 + svl/source/misc/lockfilecommon.cxx | 276 ++ svl/source/misc/mediatyp.src | 610 +++ svl/source/misc/ownlist.cxx | 330 ++ svl/source/misc/restrictedpaths.cxx | 217 + svl/source/misc/sharecontrolfile.cxx | 376 ++ svl/source/misc/strmadpt.cxx | 1048 +++++ svl/source/misc/svldata.cxx | 113 + svl/source/misc/urihelper.cxx | 952 +++++ svl/source/notify/brdcst.cxx | 212 + svl/source/notify/broadcast.cxx | 151 + svl/source/notify/cancel.cxx | 204 + svl/source/notify/hint.cxx | 50 + svl/source/notify/isethint.cxx | 78 + svl/source/notify/listener.cxx | 169 + svl/source/notify/listenerbase.cxx | 84 + svl/source/notify/listenerbase.hxx | 60 + svl/source/notify/listeneriter.cxx | 195 + svl/source/notify/lstner.cxx | 196 + svl/source/notify/makefile.mk | 67 + svl/source/notify/smplhint.cxx | 50 + svl/source/numbers/makefile.mk | 78 + svl/source/numbers/nbdll.cxx | 82 + svl/source/numbers/numfmuno.cxx | 1144 +++++ svl/source/numbers/numfmuno.hxx | 324 ++ svl/source/numbers/numhead.cxx | 252 ++ svl/source/numbers/numhead.hxx | 109 + svl/source/numbers/numuno.cxx | 171 + svl/source/numbers/supservs.cxx | 233 + svl/source/numbers/supservs.hxx | 105 + svl/source/numbers/zforfind.cxx | 2819 ++++++++++++ svl/source/numbers/zforfind.hxx | 291 ++ svl/source/numbers/zforlist.cxx | 4362 +++++++++++++++++++ svl/source/numbers/zformat.cxx | 4480 ++++++++++++++++++++ svl/source/numbers/zforscan.cxx | 2812 ++++++++++++ svl/source/numbers/zforscan.hxx | 278 ++ svl/source/passwordcontainer/exports.map | 8 + svl/source/passwordcontainer/makefile.mk | 66 + svl/source/passwordcontainer/passwordcontainer.cxx | 1595 +++++++ svl/source/passwordcontainer/syscreds.cxx | 298 ++ svl/source/passwordcontainer/syscreds.hxx | 95 + svl/source/svdde/ddecli.cxx | 474 +++ svl/source/svdde/ddedata.cxx | 233 + svl/source/svdde/ddedll.cxx | 67 + svl/source/svdde/ddeimp.hxx | 180 + svl/source/svdde/ddeinf.cxx | 193 + svl/source/svdde/ddeml1.cxx | 2661 ++++++++++++ svl/source/svdde/ddeml2.cxx | 1014 +++++ svl/source/svdde/ddemldeb.cxx | 283 ++ svl/source/svdde/ddemldeb.hxx | 69 + svl/source/svdde/ddemlimp.hxx | 436 ++ svl/source/svdde/ddemlos2.h | 377 ++ svl/source/svdde/ddestrg.cxx | 81 + svl/source/svdde/ddesvr.cxx | 1107 +++++ svl/source/svdde/ddewrap.cxx | 103 + svl/source/svdde/ddewrap.hxx | 24 + svl/source/svdde/makefile.mk | 64 + svl/source/svsql/converter.cxx | 45 + svl/source/svsql/converter.hxx | 46 + svl/source/svsql/makefile.mk | 50 + svl/source/syslocale/makefile.mk | 48 + svl/source/syslocale/syslocale.cxx | 176 + svl/source/undo/makefile.mk | 51 + svl/source/undo/undo.cxx | 819 ++++ svl/source/uno/makefile.mk | 64 + svl/source/uno/registerservices.cxx | 135 + svl/uno/addrtempuno.cxx | 248 ++ svl/uno/exports.map | 8 + svl/uno/makefile.mk | 81 + svl/uno/miscservices.cxx | 160 + svl/uno/pathservice.cxx | 106 + svl/unx/inc/convert.hxx | 66 + svl/unx/source/svdde/ddedummy.cxx | 341 ++ svl/unx/source/svdde/makefile.mk | 50 + svl/util/makefile.mk | 274 ++ svl/util/svl.pmk | 35 + svtools/inc/PasswordHelper.hxx | 57 - svtools/inc/adrparse.hxx | 110 - svtools/inc/broadcast.hxx | 70 - svtools/inc/cntnrsrt.hxx | 177 - svtools/inc/cntwids.hrc | 509 --- svtools/inc/filectrl.hrc | 37 - svtools/inc/filedlg2.hrc | 44 + svtools/inc/filenotation.hxx | 74 - svtools/inc/flbytes.hxx | 174 - svtools/inc/folderrestriction.hxx | 59 - svtools/inc/fstathelper.hxx | 68 - svtools/inc/gifread.hxx | 147 - svtools/inc/gradwrap.hxx | 80 - svtools/inc/inetdef.hxx | 32 - svtools/inc/inetmsg.hxx | 32 - svtools/inc/inetstrm.hxx | 32 - svtools/inc/iniadrtk.hxx | 63 - svtools/inc/inidef.hxx | 146 - svtools/inc/iniprop.hxx | 64 - svtools/inc/instrm.hxx | 83 - svtools/inc/iodlg.hrc | 110 - svtools/inc/jpeg.hxx | 127 - svtools/inc/listener.hxx | 68 - svtools/inc/listeneriter.hxx | 82 - svtools/inc/lngmisc.hxx | 76 - svtools/inc/memberid.hrc | 47 - svtools/inc/misccfg.hxx | 75 - svtools/inc/msgrd.hxx | 40 - svtools/inc/msgwr.hxx | 41 - svtools/inc/nfsymbol.hxx | 72 - svtools/inc/numuno.hxx | 102 - svtools/inc/outstrm.hxx | 69 - svtools/inc/pickerhelper.hxx | 72 - svtools/inc/pickerhistory.hxx | 54 - svtools/inc/pickerhistoryaccess.hxx | 57 - svtools/inc/poolcach.hxx | 61 - svtools/inc/propctrl.hxx | 118 - svtools/inc/property.hxx | 588 --- svtools/inc/reginfo.hxx | 65 - svtools/inc/reqitem.hxx | 68 - svtools/inc/rtfkeywd.hxx | 1144 +++++ svtools/inc/rtfout.hxx | 70 + svtools/inc/rtftoken.h | 1276 ++++++ svtools/inc/sgfbram.hxx | 160 - svtools/inc/sgffilt.hxx | 49 - svtools/inc/sgvmain.hxx | 356 -- svtools/inc/sgvspln.hxx | 76 - svtools/inc/strmadpt.hxx | 138 - svtools/inc/stylepool.hxx | 103 - svtools/inc/svimpbox.hxx | 477 --- svtools/inc/svimpicn.hxx | 324 -- svtools/inc/svipcdef.h | 71 - svtools/inc/svtool.h | 40 - svtools/inc/svtools/aeitem.hxx | 74 - svtools/inc/svtools/bintitem.hxx | 88 - svtools/inc/svtools/brdcst.hxx | 78 - svtools/inc/svtools/cancel.hxx | 145 - svtools/inc/svtools/cenumitm.hxx | 180 - svtools/inc/svtools/cintitem.hxx | 286 -- svtools/inc/svtools/cjkoptions.hxx | 82 - svtools/inc/svtools/cnclhint.hxx | 51 - svtools/inc/svtools/cntwall.hxx | 83 - svtools/inc/svtools/cstitem.hxx | 94 - svtools/inc/svtools/ctloptions.hxx | 100 - svtools/inc/svtools/ctypeitm.hxx | 85 - svtools/inc/svtools/custritm.hxx | 95 - svtools/inc/svtools/dateitem.hxx | 109 - svtools/inc/svtools/documentlockfile.hxx | 75 - svtools/inc/svtools/dtritem.hxx | 93 - svtools/inc/svtools/eitem.hxx | 72 - svtools/inc/svtools/filerec.hxx | 1087 ----- svtools/inc/svtools/flagitem.hxx | 83 - svtools/inc/svtools/frqitem.hxx | 178 - svtools/inc/svtools/globalnameitem.hxx | 62 - svtools/inc/svtools/hint.hxx | 75 - svtools/inc/svtools/httpcook.hxx | 155 - svtools/inc/svtools/ilstitem.hxx | 66 - svtools/inc/svtools/imageitm.hxx | 62 - svtools/inc/svtools/inethist.hxx | 135 - svtools/inc/svtools/inettype.hxx | 479 --- svtools/inc/svtools/intitem.hxx | 176 - svtools/inc/svtools/isethint.hxx | 58 - svtools/inc/svtools/itemiter.hxx | 71 - svtools/inc/svtools/itempool.hxx | 306 -- svtools/inc/svtools/itemprop.hxx | 222 - svtools/inc/svtools/itemset.hxx | 216 - svtools/inc/svtools/languageoptions.hxx | 131 - svtools/inc/svtools/lckbitem.hxx | 68 - svtools/inc/svtools/lockfilecommon.hxx | 84 - svtools/inc/svtools/lstner.hxx | 81 - svtools/inc/svtools/macitem.hxx | 212 - svtools/inc/svtools/metitem.hxx | 56 - svtools/inc/svtools/nfkeytab.hxx | 120 - svtools/inc/svtools/nfversi.hxx | 72 - svtools/inc/svtools/nranges.hxx | 97 - svtools/inc/svtools/ondemand.hxx | 468 -- svtools/inc/svtools/ownlist.hxx | 102 - svtools/inc/svtools/poolitem.hxx | 491 --- svtools/inc/svtools/ptitem.hxx | 80 - svtools/inc/svtools/rectitem.hxx | 80 - svtools/inc/svtools/restrictedpaths.hxx | 85 - svtools/inc/svtools/rngitem.hxx | 117 - svtools/inc/svtools/sfontitm.hxx | 244 -- svtools/inc/svtools/sharecontrolfile.hxx | 88 - svtools/inc/svtools/slstitm.hxx | 87 - svtools/inc/svtools/smplhint.hxx | 102 - svtools/inc/svtools/solar.hrc | 312 -- svtools/inc/svtools/stritem.hxx | 58 - svtools/inc/svtools/style.hrc | 42 - svtools/inc/svtools/style.hxx | 400 -- svtools/inc/svtools/svarray.hxx | 1056 ----- svtools/inc/svtools/svdde.hxx | 483 --- svtools/inc/svtools/svldllapi.h | 44 - svtools/inc/svtools/svstdarr.hxx | 274 -- svtools/inc/svtools/svtools.hrc | 526 --- svtools/inc/svtools/syslocale.hxx | 78 - svtools/inc/svtools/syslocaleoptions.hxx | 164 - svtools/inc/svtools/szitem.hxx | 80 - svtools/inc/svtools/tfrmitem.hxx | 90 - svtools/inc/svtools/tresitem.hxx | 65 - svtools/inc/svtools/undo.hxx | 240 -- svtools/inc/svtools/urlfilter.hxx | 66 - svtools/inc/svtools/visitem.hxx | 96 - svtools/inc/svtools/zforlist.hxx | 1014 ----- svtools/inc/svtools/zformat.hxx | 589 --- svtools/inc/svtuno.hxx | 63 - svtools/inc/twain.hxx | 99 - svtools/inc/urihelper.hxx | 238 -- svtools/inc/urlbmk.hxx | 72 - svtools/inc/whiter.hxx | 63 - svtools/inc/whmap.hxx | 61 - svtools/inc/xbmread.hxx | 100 - svtools/inc/xmlcnimp.hxx | 143 - svtools/inc/xmlement.hxx | 46 - svtools/inc/xpmread.hxx | 134 - svtools/inc/zforfind.hxx | 291 -- .../qa/complex/ConfigItems/CheckConfigItems.java | 186 - .../ConfigItems/helper/AccessibilityOptTest.cxx | 400 -- .../ConfigItems/helper/AccessibilityOptTest.hxx | 78 - .../complex/ConfigItems/helper/ConfigItemTest.cxx | 253 -- .../complex/ConfigItems/helper/HistoryOptTest.cxx | 806 ---- .../complex/ConfigItems/helper/HistoryOptTest.hxx | 211 - .../qa/complex/ConfigItems/helper/PrintOptTest.cxx | 743 ---- .../qa/complex/ConfigItems/helper/PrintOptTest.hxx | 92 - .../qa/complex/ConfigItems/helper/UserOptTest.cxx | 274 -- .../qa/complex/ConfigItems/helper/UserOptTest.hxx | 78 - svtools/qa/complex/ConfigItems/helper/exports.map | 10 - svtools/qa/complex/ConfigItems/helper/makefile.mk | 81 - svtools/qa/complex/ConfigItems/makefile.mk | 91 - .../passwordcontainer/MasterPasswdHandler.java | 61 - .../passwordcontainer/PasswordContainerTest.java | 36 - .../PasswordContainerUnitTest.java | 77 - svtools/qa/complex/passwordcontainer/Test01.java | 115 - svtools/qa/complex/passwordcontainer/Test02.java | 159 - svtools/qa/complex/passwordcontainer/Test03.java | 122 - .../qa/complex/passwordcontainer/TestHelper.java | 92 - svtools/qa/complex/passwordcontainer/makefile.mk | 91 - svtools/qa/export.map | 38 - svtools/qa/makefile.mk | 103 - svtools/qa/test_URIHelper.cxx | 462 -- svtools/source/config/cjkoptions.cxx | 510 --- svtools/source/config/ctloptions.cxx | 503 --- svtools/source/config/languageoptions.cxx | 283 -- svtools/source/config/misccfg.cxx | 195 - svtools/source/config/syslocaleoptions.cxx | 637 --- svtools/source/dialogs/filedlg2.hrc | 44 - svtools/source/dialogs/propctrl.hxx | 118 + svtools/source/filepicker/makefile.mk | 51 - svtools/source/filepicker/pickerhelper.cxx | 102 - svtools/source/filepicker/pickerhistory.cxx | 141 - svtools/source/filerec/filerec.cxx | 1019 ----- svtools/source/filerec/makefile.mk | 50 - svtools/source/fsstor/exports.map | 8 - svtools/source/fsstor/fsfactory.cxx | 295 -- svtools/source/fsstor/fsstorage.cxx | 1617 ------- svtools/source/fsstor/fsstorage.hxx | 340 -- svtools/source/fsstor/makefile.mk | 70 - svtools/source/fsstor/oinputstreamcontainer.cxx | 350 -- svtools/source/fsstor/oinputstreamcontainer.hxx | 99 - svtools/source/fsstor/ostreamcontainer.cxx | 570 --- svtools/source/fsstor/ostreamcontainer.hxx | 128 - svtools/source/hatchwindow/hatchwindowfactory.hxx | 77 + svtools/source/inc/filectrl.hrc | 37 + svtools/source/inc/fsfactory.hxx | 75 - svtools/source/inc/gifread.hxx | 147 + svtools/source/inc/gradwrap.hxx | 80 + svtools/source/inc/hatchwindowfactory.hxx | 77 - svtools/source/inc/iodlg.hrc | 110 + svtools/source/inc/jpeg.hxx | 127 + svtools/source/inc/msgrd.hxx | 40 + svtools/source/inc/msgwr.hxx | 41 + svtools/source/inc/passwordcontainer.hxx | 429 -- svtools/source/inc/poolio.hxx | 204 - svtools/source/inc/property.hxx | 588 +++ svtools/source/inc/sgfbram.hxx | 160 + svtools/source/inc/sgffilt.hxx | 49 + svtools/source/inc/sgvmain.hxx | 356 ++ svtools/source/inc/sgvspln.hxx | 76 + svtools/source/inc/svimpbox.hxx | 477 +++ svtools/source/inc/svimpicn.hxx | 324 ++ svtools/source/inc/xbmread.hxx | 100 + svtools/source/inc/xpmread.hxx | 134 + svtools/source/items/aeitem.cxx | 317 -- svtools/source/items/eitem.cxx | 50 - svtools/source/items/flagitem.cxx | 166 - svtools/source/items/globalnameitem.cxx | 117 - svtools/source/items/imageitm.cxx | 148 - svtools/source/items/intitem.cxx | 261 -- svtools/source/items/itemdel.cxx | 138 - svtools/source/items/macitem.cxx | 298 -- svtools/source/items/makefile.mk | 65 - svtools/source/items/poolcach.cxx | 159 - svtools/source/items/ptitem.cxx | 208 - svtools/source/items/rectitem.cxx | 204 - svtools/source/items/rngitem.cxx | 57 - svtools/source/items/rngitem_inc.cxx | 243 -- svtools/source/items/stritem.cxx | 75 - svtools/source/items/style.cxx | 1381 ------ svtools/source/items/szitem.cxx | 214 - svtools/source/items/wallitem.cxx | 68 - svtools/source/items1/bintitem.cxx | 169 - svtools/source/items1/cenumitm.cxx | 297 -- svtools/source/items1/cintitem.cxx | 565 --- svtools/source/items1/cntwall.cxx | 170 - svtools/source/items1/cstitem.cxx | 252 -- svtools/source/items1/cstitem.src | 112 - svtools/source/items1/ctypeitm.cxx | 254 -- svtools/source/items1/custritm.cxx | 141 - svtools/source/items1/dateitem.cxx | 284 -- svtools/source/items1/dtritem.cxx | 244 -- svtools/source/items1/frqitem.cxx | 580 --- svtools/source/items1/ilstitem.cxx | 106 - svtools/source/items1/itemiter.cxx | 122 - svtools/source/items1/itempool.cxx | 1176 ----- svtools/source/items1/itemprop.cxx | 506 --- svtools/source/items1/itemset.cxx | 2128 ---------- svtools/source/items1/lckbitem.cxx | 194 - svtools/source/items1/makefile.mk | 79 - svtools/source/items1/nranges.cxx | 853 ---- svtools/source/items1/poolio.cxx | 1715 -------- svtools/source/items1/poolitem.cxx | 527 --- svtools/source/items1/sfontitm.cxx | 142 - svtools/source/items1/sitem.cxx | 116 - svtools/source/items1/slstitm.cxx | 425 -- svtools/source/items1/stylepool.cxx | 542 --- svtools/source/items1/tfrmitem.cxx | 184 - svtools/source/items1/tresitem.cxx | 78 - svtools/source/items1/visitem.cxx | 148 - svtools/source/items1/whassert.hxx | 57 - svtools/source/items1/whiter.cxx | 127 - svtools/source/memtools/makefile.mk | 50 - svtools/source/memtools/svarray.cxx | 385 -- svtools/source/misc/config.src | 66 - svtools/source/misc/documentlockfile.cxx | 238 -- svtools/source/misc/flbytes.cxx | 432 -- svtools/source/misc/inidef.cxx | 269 -- svtools/source/misc/iniman.src | 68 - svtools/source/misc/iniprop.cxx | 47 - svtools/source/misc/itemdel.cxx | 138 + svtools/source/misc/lockfilecommon.cxx | 276 -- svtools/source/misc/ownlist.cxx | 330 -- svtools/source/misc/restrictedpaths.cxx | 217 - svtools/source/misc/sharecontrolfile.cxx | 376 -- svtools/source/misc/svtdata.cxx | 113 + svtools/source/misc/urihelper.cxx | 952 ----- svtools/source/misc/vcldata.cxx | 57 - svtools/source/misc/wallitem.cxx | 68 + svtools/source/misc1/PasswordHelper.cxx | 109 - svtools/source/misc1/adrparse.cxx | 921 ---- svtools/source/misc1/filenotation.cxx | 147 - svtools/source/misc1/folderrestriction.cxx | 109 - svtools/source/misc1/fstathelper.cxx | 103 - svtools/source/misc1/inethist.cxx | 545 --- svtools/source/misc1/inettype.cxx | 1348 ------ svtools/source/misc1/iniadrtk.cxx | 76 - svtools/source/misc1/lngmisc.cxx | 141 - svtools/source/misc1/makefile.mk | 69 - svtools/source/misc1/mediatyp.src | 610 --- svtools/source/misc1/strmadpt.cxx | 1048 ----- svtools/source/misc1/svtdata.cxx | 113 - svtools/source/notify/brdcst.cxx | 212 - svtools/source/notify/broadcast.cxx | 151 - svtools/source/notify/cancel.cxx | 204 - svtools/source/notify/hint.cxx | 50 - svtools/source/notify/isethint.cxx | 78 - svtools/source/notify/listener.cxx | 169 - svtools/source/notify/listenerbase.cxx | 84 - svtools/source/notify/listenerbase.hxx | 60 - svtools/source/notify/listeneriter.cxx | 195 - svtools/source/notify/lstner.cxx | 196 - svtools/source/notify/makefile.mk | 67 - svtools/source/notify/smplhint.cxx | 50 - svtools/source/numbers/makefile.mk | 78 - svtools/source/numbers/nbdll.cxx | 82 - svtools/source/numbers/numfmuno.cxx | 1144 ----- svtools/source/numbers/numfmuno.hxx | 324 -- svtools/source/numbers/numhead.cxx | 252 -- svtools/source/numbers/numhead.hxx | 109 - svtools/source/numbers/numuno.cxx | 171 - svtools/source/numbers/supservs.cxx | 233 - svtools/source/numbers/supservs.hxx | 105 - svtools/source/numbers/zforfind.cxx | 2819 ------------ svtools/source/numbers/zforlist.cxx | 4362 ------------------- svtools/source/numbers/zformat.cxx | 4480 -------------------- svtools/source/numbers/zforscan.cxx | 2812 ------------ svtools/source/numbers/zforscan.hxx | 278 -- svtools/source/passwordcontainer/exports.map | 8 - svtools/source/passwordcontainer/makefile.mk | 66 - .../source/passwordcontainer/passwordcontainer.cxx | 1595 ------- svtools/source/passwordcontainer/syscreds.cxx | 298 -- svtools/source/passwordcontainer/syscreds.hxx | 95 - svtools/source/svdde/ddecli.cxx | 474 --- svtools/source/svdde/ddedata.cxx | 233 - svtools/source/svdde/ddedll.cxx | 67 - svtools/source/svdde/ddeimp.hxx | 180 - svtools/source/svdde/ddeinf.cxx | 193 - svtools/source/svdde/ddeml1.cxx | 2661 ------------ svtools/source/svdde/ddeml2.cxx | 1014 ----- svtools/source/svdde/ddemldeb.cxx | 283 -- svtools/source/svdde/ddemldeb.hxx | 69 - svtools/source/svdde/ddemlimp.hxx | 436 -- svtools/source/svdde/ddemlos2.h | 377 -- svtools/source/svdde/ddestrg.cxx | 81 - svtools/source/svdde/ddesvr.cxx | 1107 ----- svtools/source/svdde/ddewrap.cxx | 103 - svtools/source/svdde/ddewrap.hxx | 24 - svtools/source/svdde/makefile.mk | 64 - svtools/source/svrtf/rtfkeywd.hxx | 1144 ----- svtools/source/svrtf/rtfout.hxx | 70 - svtools/source/svrtf/rtftoken.h | 1276 ------ svtools/source/svsql/converter.cxx | 45 - svtools/source/svsql/converter.hxx | 46 - svtools/source/svsql/makefile.mk | 50 - svtools/source/syslocale/makefile.mk | 48 - svtools/source/syslocale/syslocale.cxx | 176 - svtools/source/undo/makefile.mk | 51 - svtools/source/undo/undo.cxx | 819 ---- svtools/source/uno/registerservices.cxx | 135 - svtools/uno/addrtempuno.cxx | 248 -- svtools/uno/exports.map | 8 - svtools/uno/makefile.mk | 81 - svtools/uno/miscservices.cxx | 160 - svtools/uno/pathservice.cxx | 106 - svtools/unx/inc/convert.hxx | 66 - svtools/unx/source/svdde/ddedummy.cxx | 341 -- svtools/unx/source/svdde/makefile.mk | 50 - svtools/util/svl.flt | 85 - svtools/util/svl.pmk | 35 - svtools/util/svt.flt | 81 - svtools/win/res/makefile.mk | 30 - 640 files changed, 92107 insertions(+), 92237 deletions(-) create mode 100644 svl/inc/PasswordHelper.hxx create mode 100644 svl/inc/adrparse.hxx create mode 100644 svl/inc/broadcast.hxx create mode 100644 svl/inc/cntnrsrt.hxx create mode 100644 svl/inc/cntwids.hrc create mode 100644 svl/inc/filenotation.hxx create mode 100644 svl/inc/flbytes.hxx create mode 100644 svl/inc/folderrestriction.hxx create mode 100644 svl/inc/fstathelper.hxx create mode 100644 svl/inc/inetdef.hxx create mode 100644 svl/inc/inetmsg.hxx create mode 100644 svl/inc/inetstrm.hxx create mode 100644 svl/inc/instrm.hxx create mode 100644 svl/inc/listener.hxx create mode 100644 svl/inc/listeneriter.hxx create mode 100644 svl/inc/lngmisc.hxx create mode 100644 svl/inc/makefile.mk create mode 100644 svl/inc/memberid.hrc create mode 100644 svl/inc/misccfg.hxx create mode 100644 svl/inc/nfsymbol.hxx create mode 100644 svl/inc/numuno.hxx create mode 100644 svl/inc/outstrm.hxx create mode 100644 svl/inc/pch/precompiled_svtools.cxx create mode 100644 svl/inc/pch/precompiled_svtools.hxx create mode 100644 svl/inc/pickerhelper.hxx create mode 100644 svl/inc/pickerhistory.hxx create mode 100644 svl/inc/pickerhistoryaccess.hxx create mode 100644 svl/inc/poolcach.hxx create mode 100644 svl/inc/strmadpt.hxx create mode 100644 svl/inc/stylepool.hxx create mode 100644 svl/inc/svl/aeitem.hxx create mode 100644 svl/inc/svl/bintitem.hxx create mode 100644 svl/inc/svl/brdcst.hxx create mode 100644 svl/inc/svl/cancel.hxx create mode 100644 svl/inc/svl/cenumitm.hxx create mode 100644 svl/inc/svl/cintitem.hxx create mode 100644 svl/inc/svl/cjkoptions.hxx create mode 100644 svl/inc/svl/cnclhint.hxx create mode 100644 svl/inc/svl/cntwall.hxx create mode 100644 svl/inc/svl/cstitem.hxx create mode 100644 svl/inc/svl/ctloptions.hxx create mode 100644 svl/inc/svl/ctypeitm.hxx create mode 100644 svl/inc/svl/custritm.hxx create mode 100644 svl/inc/svl/dateitem.hxx create mode 100644 svl/inc/svl/documentlockfile.hxx create mode 100644 svl/inc/svl/dtritem.hxx create mode 100644 svl/inc/svl/eitem.hxx create mode 100644 svl/inc/svl/filerec.hxx create mode 100644 svl/inc/svl/flagitem.hxx create mode 100644 svl/inc/svl/frqitem.hxx create mode 100644 svl/inc/svl/globalnameitem.hxx create mode 100644 svl/inc/svl/hint.hxx create mode 100644 svl/inc/svl/httpcook.hxx create mode 100644 svl/inc/svl/ilstitem.hxx create mode 100644 svl/inc/svl/imageitm.hxx create mode 100644 svl/inc/svl/inethist.hxx create mode 100644 svl/inc/svl/inettype.hxx create mode 100644 svl/inc/svl/intitem.hxx create mode 100644 svl/inc/svl/isethint.hxx create mode 100644 svl/inc/svl/itemiter.hxx create mode 100644 svl/inc/svl/itempool.hxx create mode 100644 svl/inc/svl/itemprop.hxx create mode 100644 svl/inc/svl/itemset.hxx create mode 100644 svl/inc/svl/languageoptions.hxx create mode 100644 svl/inc/svl/lckbitem.hxx create mode 100644 svl/inc/svl/lockfilecommon.hxx create mode 100644 svl/inc/svl/lstner.hxx create mode 100644 svl/inc/svl/macitem.hxx create mode 100644 svl/inc/svl/metitem.hxx create mode 100644 svl/inc/svl/nfkeytab.hxx create mode 100644 svl/inc/svl/nfversi.hxx create mode 100644 svl/inc/svl/nranges.hxx create mode 100644 svl/inc/svl/ondemand.hxx create mode 100644 svl/inc/svl/ownlist.hxx create mode 100644 svl/inc/svl/poolitem.hxx create mode 100644 svl/inc/svl/ptitem.hxx create mode 100644 svl/inc/svl/rectitem.hxx create mode 100644 svl/inc/svl/restrictedpaths.hxx create mode 100644 svl/inc/svl/rngitem.hxx create mode 100644 svl/inc/svl/sfontitm.hxx create mode 100644 svl/inc/svl/sharecontrolfile.hxx create mode 100644 svl/inc/svl/slstitm.hxx create mode 100644 svl/inc/svl/smplhint.hxx create mode 100644 svl/inc/svl/solar.hrc create mode 100644 svl/inc/svl/stritem.hxx create mode 100644 svl/inc/svl/style.hrc create mode 100644 svl/inc/svl/style.hxx create mode 100644 svl/inc/svl/svarray.hxx create mode 100644 svl/inc/svl/svdde.hxx create mode 100644 svl/inc/svl/svldata.hxx create mode 100644 svl/inc/svl/svldllapi.h create mode 100644 svl/inc/svl/svstdarr.hxx create mode 100644 svl/inc/svl/svtools.hrc create mode 100644 svl/inc/svl/syslocale.hxx create mode 100644 svl/inc/svl/syslocaleoptions.hxx create mode 100644 svl/inc/svl/szitem.hxx create mode 100644 svl/inc/svl/tfrmitem.hxx create mode 100644 svl/inc/svl/tresitem.hxx create mode 100644 svl/inc/svl/undo.hxx create mode 100644 svl/inc/svl/urlfilter.hxx create mode 100644 svl/inc/svl/visitem.hxx create mode 100644 svl/inc/svl/zforlist.hxx create mode 100644 svl/inc/svl/zformat.hxx create mode 100644 svl/inc/urihelper.hxx create mode 100644 svl/inc/urlbmk.hxx create mode 100644 svl/inc/whiter.hxx create mode 100644 svl/inc/xmlement.hxx create mode 100644 svl/prj/build.lst create mode 100644 svl/prj/d.lst create mode 100644 svl/qa/complex/ConfigItems/CheckConfigItems.java create mode 100644 svl/qa/complex/ConfigItems/helper/AccessibilityOptTest.cxx create mode 100644 svl/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx create mode 100644 svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx create mode 100644 svl/qa/complex/ConfigItems/helper/HistoryOptTest.cxx create mode 100644 svl/qa/complex/ConfigItems/helper/HistoryOptTest.hxx create mode 100644 svl/qa/complex/ConfigItems/helper/PrintOptTest.cxx create mode 100644 svl/qa/complex/ConfigItems/helper/PrintOptTest.hxx create mode 100644 svl/qa/complex/ConfigItems/helper/UserOptTest.cxx create mode 100644 svl/qa/complex/ConfigItems/helper/UserOptTest.hxx create mode 100644 svl/qa/complex/ConfigItems/helper/exports.map create mode 100644 svl/qa/complex/ConfigItems/helper/makefile.mk create mode 100644 svl/qa/complex/ConfigItems/makefile.mk create mode 100644 svl/qa/complex/passwordcontainer/MasterPasswdHandler.java create mode 100644 svl/qa/complex/passwordcontainer/PasswordContainerTest.java create mode 100644 svl/qa/complex/passwordcontainer/PasswordContainerUnitTest.java create mode 100644 svl/qa/complex/passwordcontainer/Test01.java create mode 100644 svl/qa/complex/passwordcontainer/Test02.java create mode 100644 svl/qa/complex/passwordcontainer/Test03.java create mode 100644 svl/qa/complex/passwordcontainer/TestHelper.java create mode 100644 svl/qa/complex/passwordcontainer/makefile.mk create mode 100755 svl/qa/export.map create mode 100644 svl/qa/makefile.mk create mode 100644 svl/qa/test_URIHelper.cxx create mode 100644 svl/source/config/cjkoptions.cxx create mode 100644 svl/source/config/ctloptions.cxx create mode 100644 svl/source/config/itemholder2.cxx create mode 100644 svl/source/config/itemholder2.hxx create mode 100644 svl/source/config/languageoptions.cxx create mode 100644 svl/source/config/makefile.mk create mode 100644 svl/source/config/misccfg.cxx create mode 100644 svl/source/config/syslocaleoptions.cxx create mode 100644 svl/source/filepicker/makefile.mk create mode 100644 svl/source/filepicker/pickerhelper.cxx create mode 100644 svl/source/filepicker/pickerhistory.cxx create mode 100644 svl/source/filerec/filerec.cxx create mode 100644 svl/source/filerec/makefile.mk create mode 100644 svl/source/fsstor/exports.map create mode 100644 svl/source/fsstor/fsfactory.cxx create mode 100644 svl/source/fsstor/fsstorage.cxx create mode 100644 svl/source/fsstor/fsstorage.hxx create mode 100644 svl/source/fsstor/makefile.mk create mode 100644 svl/source/fsstor/oinputstreamcontainer.cxx create mode 100644 svl/source/fsstor/oinputstreamcontainer.hxx create mode 100644 svl/source/fsstor/ostreamcontainer.cxx create mode 100644 svl/source/fsstor/ostreamcontainer.hxx create mode 100644 svl/source/inc/fsfactory.hxx create mode 100644 svl/source/inc/passwordcontainer.hxx create mode 100644 svl/source/inc/poolio.hxx create mode 100644 svl/source/items/aeitem.cxx create mode 100644 svl/source/items/bintitem.cxx create mode 100644 svl/source/items/cenumitm.cxx create mode 100644 svl/source/items/cintitem.cxx create mode 100644 svl/source/items/cntwall.cxx create mode 100644 svl/source/items/cstitem.cxx create mode 100644 svl/source/items/cstitem.src create mode 100644 svl/source/items/ctypeitm.cxx create mode 100644 svl/source/items/custritm.cxx create mode 100644 svl/source/items/dateitem.cxx create mode 100644 svl/source/items/dtritem.cxx create mode 100644 svl/source/items/eitem.cxx create mode 100644 svl/source/items/flagitem.cxx create mode 100644 svl/source/items/frqitem.cxx create mode 100644 svl/source/items/globalnameitem.cxx create mode 100644 svl/source/items/ilstitem.cxx create mode 100644 svl/source/items/imageitm.cxx create mode 100644 svl/source/items/intitem.cxx create mode 100644 svl/source/items/itemiter.cxx create mode 100644 svl/source/items/itempool.cxx create mode 100644 svl/source/items/itemprop.cxx create mode 100644 svl/source/items/itemset.cxx create mode 100644 svl/source/items/lckbitem.cxx create mode 100644 svl/source/items/macitem.cxx create mode 100644 svl/source/items/makefile.mk create mode 100644 svl/source/items/nranges.cxx create mode 100644 svl/source/items/poolcach.cxx create mode 100644 svl/source/items/poolio.cxx create mode 100644 svl/source/items/poolitem.cxx create mode 100644 svl/source/items/ptitem.cxx create mode 100644 svl/source/items/rectitem.cxx create mode 100644 svl/source/items/rngitem.cxx create mode 100755 svl/source/items/rngitem_inc.cxx create mode 100644 svl/source/items/sfontitm.cxx create mode 100644 svl/source/items/sitem.cxx create mode 100644 svl/source/items/slstitm.cxx create mode 100644 svl/source/items/stritem.cxx create mode 100644 svl/source/items/style.cxx create mode 100644 svl/source/items/stylepool.cxx create mode 100644 svl/source/items/szitem.cxx create mode 100644 svl/source/items/tfrmitem.cxx create mode 100644 svl/source/items/tresitem.cxx create mode 100644 svl/source/items/visitem.cxx create mode 100644 svl/source/items/whassert.hxx create mode 100644 svl/source/items/whiter.cxx create mode 100644 svl/source/memtools/makefile.mk create mode 100644 svl/source/memtools/svarray.cxx create mode 100644 svl/source/misc/PasswordHelper.cxx create mode 100644 svl/source/misc/adrparse.cxx create mode 100644 svl/source/misc/documentlockfile.cxx create mode 100644 svl/source/misc/filenotation.cxx create mode 100644 svl/source/misc/flbytes.cxx create mode 100644 svl/source/misc/folderrestriction.cxx create mode 100644 svl/source/misc/fstathelper.cxx create mode 100644 svl/source/misc/inethist.cxx create mode 100644 svl/source/misc/inettype.cxx create mode 100644 svl/source/misc/lngmisc.cxx create mode 100644 svl/source/misc/lockfilecommon.cxx create mode 100644 svl/source/misc/mediatyp.src create mode 100644 svl/source/misc/ownlist.cxx create mode 100644 svl/source/misc/restrictedpaths.cxx create mode 100644 svl/source/misc/sharecontrolfile.cxx create mode 100644 svl/source/misc/strmadpt.cxx create mode 100644 svl/source/misc/svldata.cxx create mode 100644 svl/source/misc/urihelper.cxx create mode 100644 svl/source/notify/brdcst.cxx create mode 100644 svl/source/notify/broadcast.cxx create mode 100644 svl/source/notify/cancel.cxx create mode 100644 svl/source/notify/hint.cxx create mode 100644 svl/source/notify/isethint.cxx create mode 100644 svl/source/notify/listener.cxx create mode 100644 svl/source/notify/listenerbase.cxx create mode 100644 svl/source/notify/listenerbase.hxx create mode 100644 svl/source/notify/listeneriter.cxx create mode 100644 svl/source/notify/lstner.cxx create mode 100644 svl/source/notify/makefile.mk create mode 100644 svl/source/notify/smplhint.cxx create mode 100644 svl/source/numbers/makefile.mk create mode 100644 svl/source/numbers/nbdll.cxx create mode 100644 svl/source/numbers/numfmuno.cxx create mode 100644 svl/source/numbers/numfmuno.hxx create mode 100644 svl/source/numbers/numhead.cxx create mode 100644 svl/source/numbers/numhead.hxx create mode 100644 svl/source/numbers/numuno.cxx create mode 100644 svl/source/numbers/supservs.cxx create mode 100644 svl/source/numbers/supservs.hxx create mode 100644 svl/source/numbers/zforfind.cxx create mode 100644 svl/source/numbers/zforfind.hxx create mode 100644 svl/source/numbers/zforlist.cxx create mode 100644 svl/source/numbers/zformat.cxx create mode 100644 svl/source/numbers/zforscan.cxx create mode 100644 svl/source/numbers/zforscan.hxx create mode 100644 svl/source/passwordcontainer/exports.map create mode 100644 svl/source/passwordcontainer/makefile.mk create mode 100644 svl/source/passwordcontainer/passwordcontainer.cxx create mode 100644 svl/source/passwordcontainer/syscreds.cxx create mode 100644 svl/source/passwordcontainer/syscreds.hxx create mode 100644 svl/source/svdde/ddecli.cxx create mode 100644 svl/source/svdde/ddedata.cxx create mode 100644 svl/source/svdde/ddedll.cxx create mode 100644 svl/source/svdde/ddeimp.hxx create mode 100644 svl/source/svdde/ddeinf.cxx create mode 100644 svl/source/svdde/ddeml1.cxx create mode 100644 svl/source/svdde/ddeml2.cxx create mode 100644 svl/source/svdde/ddemldeb.cxx create mode 100644 svl/source/svdde/ddemldeb.hxx create mode 100644 svl/source/svdde/ddemlimp.hxx create mode 100644 svl/source/svdde/ddemlos2.h create mode 100644 svl/source/svdde/ddestrg.cxx create mode 100644 svl/source/svdde/ddesvr.cxx create mode 100644 svl/source/svdde/ddewrap.cxx create mode 100644 svl/source/svdde/ddewrap.hxx create mode 100644 svl/source/svdde/makefile.mk create mode 100644 svl/source/svsql/converter.cxx create mode 100644 svl/source/svsql/converter.hxx create mode 100644 svl/source/svsql/makefile.mk create mode 100644 svl/source/syslocale/makefile.mk create mode 100644 svl/source/syslocale/syslocale.cxx create mode 100644 svl/source/undo/makefile.mk create mode 100644 svl/source/undo/undo.cxx create mode 100644 svl/source/uno/makefile.mk create mode 100644 svl/source/uno/registerservices.cxx create mode 100644 svl/uno/addrtempuno.cxx create mode 100644 svl/uno/exports.map create mode 100644 svl/uno/makefile.mk create mode 100644 svl/uno/miscservices.cxx create mode 100644 svl/uno/pathservice.cxx create mode 100644 svl/unx/inc/convert.hxx create mode 100644 svl/unx/source/svdde/ddedummy.cxx create mode 100644 svl/unx/source/svdde/makefile.mk create mode 100644 svl/util/makefile.mk create mode 100644 svl/util/svl.pmk delete mode 100644 svtools/inc/PasswordHelper.hxx delete mode 100644 svtools/inc/adrparse.hxx delete mode 100644 svtools/inc/broadcast.hxx delete mode 100644 svtools/inc/cntnrsrt.hxx delete mode 100644 svtools/inc/cntwids.hrc delete mode 100644 svtools/inc/filectrl.hrc create mode 100644 svtools/inc/filedlg2.hrc delete mode 100644 svtools/inc/filenotation.hxx delete mode 100644 svtools/inc/flbytes.hxx delete mode 100644 svtools/inc/folderrestriction.hxx delete mode 100644 svtools/inc/fstathelper.hxx delete mode 100644 svtools/inc/gifread.hxx delete mode 100644 svtools/inc/gradwrap.hxx delete mode 100644 svtools/inc/inetdef.hxx delete mode 100644 svtools/inc/inetmsg.hxx delete mode 100644 svtools/inc/inetstrm.hxx delete mode 100644 svtools/inc/iniadrtk.hxx delete mode 100644 svtools/inc/inidef.hxx delete mode 100644 svtools/inc/iniprop.hxx delete mode 100644 svtools/inc/instrm.hxx delete mode 100644 svtools/inc/iodlg.hrc delete mode 100644 svtools/inc/jpeg.hxx delete mode 100644 svtools/inc/listener.hxx delete mode 100644 svtools/inc/listeneriter.hxx delete mode 100644 svtools/inc/lngmisc.hxx delete mode 100644 svtools/inc/memberid.hrc delete mode 100644 svtools/inc/misccfg.hxx delete mode 100644 svtools/inc/msgrd.hxx delete mode 100644 svtools/inc/msgwr.hxx delete mode 100644 svtools/inc/nfsymbol.hxx delete mode 100644 svtools/inc/numuno.hxx delete mode 100644 svtools/inc/outstrm.hxx delete mode 100644 svtools/inc/pickerhelper.hxx delete mode 100644 svtools/inc/pickerhistory.hxx delete mode 100644 svtools/inc/pickerhistoryaccess.hxx delete mode 100644 svtools/inc/poolcach.hxx delete mode 100644 svtools/inc/propctrl.hxx delete mode 100644 svtools/inc/property.hxx delete mode 100644 svtools/inc/reginfo.hxx delete mode 100644 svtools/inc/reqitem.hxx create mode 100644 svtools/inc/rtfkeywd.hxx create mode 100644 svtools/inc/rtfout.hxx create mode 100644 svtools/inc/rtftoken.h delete mode 100644 svtools/inc/sgfbram.hxx delete mode 100644 svtools/inc/sgffilt.hxx delete mode 100644 svtools/inc/sgvmain.hxx delete mode 100644 svtools/inc/sgvspln.hxx delete mode 100644 svtools/inc/strmadpt.hxx delete mode 100644 svtools/inc/stylepool.hxx delete mode 100644 svtools/inc/svimpbox.hxx delete mode 100644 svtools/inc/svimpicn.hxx delete mode 100644 svtools/inc/svipcdef.h delete mode 100644 svtools/inc/svtool.h delete mode 100644 svtools/inc/svtools/aeitem.hxx delete mode 100644 svtools/inc/svtools/bintitem.hxx delete mode 100644 svtools/inc/svtools/brdcst.hxx delete mode 100644 svtools/inc/svtools/cancel.hxx delete mode 100644 svtools/inc/svtools/cenumitm.hxx delete mode 100644 svtools/inc/svtools/cintitem.hxx delete mode 100644 svtools/inc/svtools/cjkoptions.hxx delete mode 100644 svtools/inc/svtools/cnclhint.hxx delete mode 100644 svtools/inc/svtools/cntwall.hxx delete mode 100644 svtools/inc/svtools/cstitem.hxx delete mode 100644 svtools/inc/svtools/ctloptions.hxx delete mode 100644 svtools/inc/svtools/ctypeitm.hxx delete mode 100644 svtools/inc/svtools/custritm.hxx delete mode 100644 svtools/inc/svtools/dateitem.hxx delete mode 100644 svtools/inc/svtools/documentlockfile.hxx delete mode 100644 svtools/inc/svtools/dtritem.hxx delete mode 100644 svtools/inc/svtools/eitem.hxx delete mode 100644 svtools/inc/svtools/filerec.hxx delete mode 100644 svtools/inc/svtools/flagitem.hxx delete mode 100644 svtools/inc/svtools/frqitem.hxx delete mode 100644 svtools/inc/svtools/globalnameitem.hxx delete mode 100644 svtools/inc/svtools/hint.hxx delete mode 100644 svtools/inc/svtools/httpcook.hxx delete mode 100644 svtools/inc/svtools/ilstitem.hxx delete mode 100644 svtools/inc/svtools/imageitm.hxx delete mode 100644 svtools/inc/svtools/inethist.hxx delete mode 100644 svtools/inc/svtools/inettype.hxx delete mode 100644 svtools/inc/svtools/intitem.hxx delete mode 100644 svtools/inc/svtools/isethint.hxx delete mode 100644 svtools/inc/svtools/itemiter.hxx delete mode 100644 svtools/inc/svtools/itempool.hxx delete mode 100644 svtools/inc/svtools/itemprop.hxx delete mode 100644 svtools/inc/svtools/itemset.hxx delete mode 100644 svtools/inc/svtools/languageoptions.hxx delete mode 100644 svtools/inc/svtools/lckbitem.hxx delete mode 100644 svtools/inc/svtools/lockfilecommon.hxx delete mode 100644 svtools/inc/svtools/lstner.hxx delete mode 100644 svtools/inc/svtools/macitem.hxx delete mode 100644 svtools/inc/svtools/metitem.hxx delete mode 100644 svtools/inc/svtools/nfkeytab.hxx delete mode 100644 svtools/inc/svtools/nfversi.hxx delete mode 100644 svtools/inc/svtools/nranges.hxx delete mode 100644 svtools/inc/svtools/ondemand.hxx delete mode 100644 svtools/inc/svtools/ownlist.hxx delete mode 100644 svtools/inc/svtools/poolitem.hxx delete mode 100644 svtools/inc/svtools/ptitem.hxx delete mode 100644 svtools/inc/svtools/rectitem.hxx delete mode 100644 svtools/inc/svtools/restrictedpaths.hxx delete mode 100644 svtools/inc/svtools/rngitem.hxx delete mode 100644 svtools/inc/svtools/sfontitm.hxx delete mode 100644 svtools/inc/svtools/sharecontrolfile.hxx delete mode 100644 svtools/inc/svtools/slstitm.hxx delete mode 100644 svtools/inc/svtools/smplhint.hxx delete mode 100644 svtools/inc/svtools/solar.hrc delete mode 100644 svtools/inc/svtools/stritem.hxx delete mode 100644 svtools/inc/svtools/style.hrc delete mode 100644 svtools/inc/svtools/style.hxx delete mode 100644 svtools/inc/svtools/svarray.hxx delete mode 100644 svtools/inc/svtools/svdde.hxx delete mode 100644 svtools/inc/svtools/svldllapi.h delete mode 100644 svtools/inc/svtools/svstdarr.hxx delete mode 100644 svtools/inc/svtools/svtools.hrc delete mode 100644 svtools/inc/svtools/syslocale.hxx delete mode 100644 svtools/inc/svtools/syslocaleoptions.hxx delete mode 100644 svtools/inc/svtools/szitem.hxx delete mode 100644 svtools/inc/svtools/tfrmitem.hxx delete mode 100644 svtools/inc/svtools/tresitem.hxx delete mode 100644 svtools/inc/svtools/undo.hxx delete mode 100644 svtools/inc/svtools/urlfilter.hxx delete mode 100644 svtools/inc/svtools/visitem.hxx delete mode 100644 svtools/inc/svtools/zforlist.hxx delete mode 100644 svtools/inc/svtools/zformat.hxx delete mode 100644 svtools/inc/svtuno.hxx delete mode 100644 svtools/inc/twain.hxx delete mode 100644 svtools/inc/urihelper.hxx delete mode 100644 svtools/inc/urlbmk.hxx delete mode 100644 svtools/inc/whiter.hxx delete mode 100644 svtools/inc/whmap.hxx delete mode 100644 svtools/inc/xbmread.hxx delete mode 100644 svtools/inc/xmlcnimp.hxx delete mode 100644 svtools/inc/xmlement.hxx delete mode 100644 svtools/inc/xpmread.hxx delete mode 100644 svtools/inc/zforfind.hxx delete mode 100644 svtools/qa/complex/ConfigItems/CheckConfigItems.java delete mode 100644 svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.cxx delete mode 100644 svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx delete mode 100644 svtools/qa/complex/ConfigItems/helper/ConfigItemTest.cxx delete mode 100644 svtools/qa/complex/ConfigItems/helper/HistoryOptTest.cxx delete mode 100644 svtools/qa/complex/ConfigItems/helper/HistoryOptTest.hxx delete mode 100644 svtools/qa/complex/ConfigItems/helper/PrintOptTest.cxx delete mode 100644 svtools/qa/complex/ConfigItems/helper/PrintOptTest.hxx delete mode 100644 svtools/qa/complex/ConfigItems/helper/UserOptTest.cxx delete mode 100644 svtools/qa/complex/ConfigItems/helper/UserOptTest.hxx delete mode 100644 svtools/qa/complex/ConfigItems/helper/exports.map delete mode 100644 svtools/qa/complex/ConfigItems/helper/makefile.mk delete mode 100644 svtools/qa/complex/ConfigItems/makefile.mk delete mode 100644 svtools/qa/complex/passwordcontainer/MasterPasswdHandler.java delete mode 100644 svtools/qa/complex/passwordcontainer/PasswordContainerTest.java delete mode 100644 svtools/qa/complex/passwordcontainer/PasswordContainerUnitTest.java delete mode 100644 svtools/qa/complex/passwordcontainer/Test01.java delete mode 100644 svtools/qa/complex/passwordcontainer/Test02.java delete mode 100644 svtools/qa/complex/passwordcontainer/Test03.java delete mode 100644 svtools/qa/complex/passwordcontainer/TestHelper.java delete mode 100644 svtools/qa/complex/passwordcontainer/makefile.mk delete mode 100755 svtools/qa/export.map delete mode 100644 svtools/qa/makefile.mk delete mode 100644 svtools/qa/test_URIHelper.cxx delete mode 100644 svtools/source/config/cjkoptions.cxx delete mode 100644 svtools/source/config/ctloptions.cxx delete mode 100644 svtools/source/config/languageoptions.cxx delete mode 100644 svtools/source/config/misccfg.cxx delete mode 100644 svtools/source/config/syslocaleoptions.cxx delete mode 100644 svtools/source/dialogs/filedlg2.hrc create mode 100644 svtools/source/dialogs/propctrl.hxx delete mode 100644 svtools/source/filepicker/makefile.mk delete mode 100644 svtools/source/filepicker/pickerhelper.cxx delete mode 100644 svtools/source/filepicker/pickerhistory.cxx delete mode 100644 svtools/source/filerec/filerec.cxx delete mode 100644 svtools/source/filerec/makefile.mk delete mode 100644 svtools/source/fsstor/exports.map delete mode 100644 svtools/source/fsstor/fsfactory.cxx delete mode 100644 svtools/source/fsstor/fsstorage.cxx delete mode 100644 svtools/source/fsstor/fsstorage.hxx delete mode 100644 svtools/source/fsstor/makefile.mk delete mode 100644 svtools/source/fsstor/oinputstreamcontainer.cxx delete mode 100644 svtools/source/fsstor/oinputstreamcontainer.hxx delete mode 100644 svtools/source/fsstor/ostreamcontainer.cxx delete mode 100644 svtools/source/fsstor/ostreamcontainer.hxx create mode 100644 svtools/source/hatchwindow/hatchwindowfactory.hxx create mode 100644 svtools/source/inc/filectrl.hrc delete mode 100644 svtools/source/inc/fsfactory.hxx create mode 100644 svtools/source/inc/gifread.hxx create mode 100644 svtools/source/inc/gradwrap.hxx delete mode 100644 svtools/source/inc/hatchwindowfactory.hxx create mode 100644 svtools/source/inc/iodlg.hrc create mode 100644 svtools/source/inc/jpeg.hxx create mode 100644 svtools/source/inc/msgrd.hxx create mode 100644 svtools/source/inc/msgwr.hxx delete mode 100644 svtools/source/inc/passwordcontainer.hxx delete mode 100644 svtools/source/inc/poolio.hxx create mode 100644 svtools/source/inc/property.hxx create mode 100644 svtools/source/inc/sgfbram.hxx create mode 100644 svtools/source/inc/sgffilt.hxx create mode 100644 svtools/source/inc/sgvmain.hxx create mode 100644 svtools/source/inc/sgvspln.hxx create mode 100644 svtools/source/inc/svimpbox.hxx create mode 100644 svtools/source/inc/svimpicn.hxx create mode 100644 svtools/source/inc/xbmread.hxx create mode 100644 svtools/source/inc/xpmread.hxx delete mode 100644 svtools/source/items/aeitem.cxx delete mode 100644 svtools/source/items/eitem.cxx delete mode 100644 svtools/source/items/flagitem.cxx delete mode 100644 svtools/source/items/globalnameitem.cxx delete mode 100644 svtools/source/items/imageitm.cxx delete mode 100644 svtools/source/items/intitem.cxx delete mode 100644 svtools/source/items/itemdel.cxx delete mode 100644 svtools/source/items/macitem.cxx delete mode 100644 svtools/source/items/makefile.mk delete mode 100644 svtools/source/items/poolcach.cxx delete mode 100644 svtools/source/items/ptitem.cxx delete mode 100644 svtools/source/items/rectitem.cxx delete mode 100644 svtools/source/items/rngitem.cxx delete mode 100755 svtools/source/items/rngitem_inc.cxx delete mode 100644 svtools/source/items/stritem.cxx delete mode 100644 svtools/source/items/style.cxx delete mode 100644 svtools/source/items/szitem.cxx delete mode 100644 svtools/source/items/wallitem.cxx delete mode 100644 svtools/source/items1/bintitem.cxx delete mode 100644 svtools/source/items1/cenumitm.cxx delete mode 100644 svtools/source/items1/cintitem.cxx delete mode 100644 svtools/source/items1/cntwall.cxx delete mode 100644 svtools/source/items1/cstitem.cxx delete mode 100644 svtools/source/items1/cstitem.src delete mode 100644 svtools/source/items1/ctypeitm.cxx delete mode 100644 svtools/source/items1/custritm.cxx delete mode 100644 svtools/source/items1/dateitem.cxx delete mode 100644 svtools/source/items1/dtritem.cxx delete mode 100644 svtools/source/items1/frqitem.cxx delete mode 100644 svtools/source/items1/ilstitem.cxx delete mode 100644 svtools/source/items1/itemiter.cxx delete mode 100644 svtools/source/items1/itempool.cxx delete mode 100644 svtools/source/items1/itemprop.cxx delete mode 100644 svtools/source/items1/itemset.cxx delete mode 100644 svtools/source/items1/lckbitem.cxx delete mode 100644 svtools/source/items1/makefile.mk delete mode 100644 svtools/source/items1/nranges.cxx delete mode 100644 svtools/source/items1/poolio.cxx delete mode 100644 svtools/source/items1/poolitem.cxx delete mode 100644 svtools/source/items1/sfontitm.cxx delete mode 100644 svtools/source/items1/sitem.cxx delete mode 100644 svtools/source/items1/slstitm.cxx delete mode 100644 svtools/source/items1/stylepool.cxx delete mode 100644 svtools/source/items1/tfrmitem.cxx delete mode 100644 svtools/source/items1/tresitem.cxx delete mode 100644 svtools/source/items1/visitem.cxx delete mode 100644 svtools/source/items1/whassert.hxx delete mode 100644 svtools/source/items1/whiter.cxx delete mode 100644 svtools/source/memtools/makefile.mk delete mode 100644 svtools/source/memtools/svarray.cxx delete mode 100644 svtools/source/misc/config.src delete mode 100644 svtools/source/misc/documentlockfile.cxx delete mode 100644 svtools/source/misc/flbytes.cxx delete mode 100644 svtools/source/misc/inidef.cxx delete mode 100644 svtools/source/misc/iniman.src delete mode 100644 svtools/source/misc/iniprop.cxx create mode 100644 svtools/source/misc/itemdel.cxx delete mode 100644 svtools/source/misc/lockfilecommon.cxx delete mode 100644 svtools/source/misc/ownlist.cxx delete mode 100644 svtools/source/misc/restrictedpaths.cxx delete mode 100644 svtools/source/misc/sharecontrolfile.cxx create mode 100644 svtools/source/misc/svtdata.cxx delete mode 100644 svtools/source/misc/urihelper.cxx delete mode 100644 svtools/source/misc/vcldata.cxx create mode 100644 svtools/source/misc/wallitem.cxx delete mode 100644 svtools/source/misc1/PasswordHelper.cxx delete mode 100644 svtools/source/misc1/adrparse.cxx delete mode 100644 svtools/source/misc1/filenotation.cxx delete mode 100644 svtools/source/misc1/folderrestriction.cxx delete mode 100644 svtools/source/misc1/fstathelper.cxx delete mode 100644 svtools/source/misc1/inethist.cxx delete mode 100644 svtools/source/misc1/inettype.cxx delete mode 100644 svtools/source/misc1/iniadrtk.cxx delete mode 100644 svtools/source/misc1/lngmisc.cxx delete mode 100644 svtools/source/misc1/makefile.mk delete mode 100644 svtools/source/misc1/mediatyp.src delete mode 100644 svtools/source/misc1/strmadpt.cxx delete mode 100644 svtools/source/misc1/svtdata.cxx delete mode 100644 svtools/source/notify/brdcst.cxx delete mode 100644 svtools/source/notify/broadcast.cxx delete mode 100644 svtools/source/notify/cancel.cxx delete mode 100644 svtools/source/notify/hint.cxx delete mode 100644 svtools/source/notify/isethint.cxx delete mode 100644 svtools/source/notify/listener.cxx delete mode 100644 svtools/source/notify/listenerbase.cxx delete mode 100644 svtools/source/notify/listenerbase.hxx delete mode 100644 svtools/source/notify/listeneriter.cxx delete mode 100644 svtools/source/notify/lstner.cxx delete mode 100644 svtools/source/notify/makefile.mk delete mode 100644 svtools/source/notify/smplhint.cxx delete mode 100644 svtools/source/numbers/makefile.mk delete mode 100644 svtools/source/numbers/nbdll.cxx delete mode 100644 svtools/source/numbers/numfmuno.cxx delete mode 100644 svtools/source/numbers/numfmuno.hxx delete mode 100644 svtools/source/numbers/numhead.cxx delete mode 100644 svtools/source/numbers/numhead.hxx delete mode 100644 svtools/source/numbers/numuno.cxx delete mode 100644 svtools/source/numbers/supservs.cxx delete mode 100644 svtools/source/numbers/supservs.hxx delete mode 100644 svtools/source/numbers/zforfind.cxx delete mode 100644 svtools/source/numbers/zforlist.cxx delete mode 100644 svtools/source/numbers/zformat.cxx delete mode 100644 svtools/source/numbers/zforscan.cxx delete mode 100644 svtools/source/numbers/zforscan.hxx delete mode 100644 svtools/source/passwordcontainer/exports.map delete mode 100644 svtools/source/passwordcontainer/makefile.mk delete mode 100644 svtools/source/passwordcontainer/passwordcontainer.cxx delete mode 100644 svtools/source/passwordcontainer/syscreds.cxx delete mode 100644 svtools/source/passwordcontainer/syscreds.hxx delete mode 100644 svtools/source/svdde/ddecli.cxx delete mode 100644 svtools/source/svdde/ddedata.cxx delete mode 100644 svtools/source/svdde/ddedll.cxx delete mode 100644 svtools/source/svdde/ddeimp.hxx delete mode 100644 svtools/source/svdde/ddeinf.cxx delete mode 100644 svtools/source/svdde/ddeml1.cxx delete mode 100644 svtools/source/svdde/ddeml2.cxx delete mode 100644 svtools/source/svdde/ddemldeb.cxx delete mode 100644 svtools/source/svdde/ddemldeb.hxx delete mode 100644 svtools/source/svdde/ddemlimp.hxx delete mode 100644 svtools/source/svdde/ddemlos2.h delete mode 100644 svtools/source/svdde/ddestrg.cxx delete mode 100644 svtools/source/svdde/ddesvr.cxx delete mode 100644 svtools/source/svdde/ddewrap.cxx delete mode 100644 svtools/source/svdde/ddewrap.hxx delete mode 100644 svtools/source/svdde/makefile.mk delete mode 100644 svtools/source/svrtf/rtfkeywd.hxx delete mode 100644 svtools/source/svrtf/rtfout.hxx delete mode 100644 svtools/source/svrtf/rtftoken.h delete mode 100644 svtools/source/svsql/converter.cxx delete mode 100644 svtools/source/svsql/converter.hxx delete mode 100644 svtools/source/svsql/makefile.mk delete mode 100644 svtools/source/syslocale/makefile.mk delete mode 100644 svtools/source/syslocale/syslocale.cxx delete mode 100644 svtools/source/undo/makefile.mk delete mode 100644 svtools/source/undo/undo.cxx delete mode 100644 svtools/source/uno/registerservices.cxx delete mode 100644 svtools/uno/addrtempuno.cxx delete mode 100644 svtools/uno/exports.map delete mode 100644 svtools/uno/makefile.mk delete mode 100644 svtools/uno/miscservices.cxx delete mode 100644 svtools/uno/pathservice.cxx delete mode 100644 svtools/unx/inc/convert.hxx delete mode 100644 svtools/unx/source/svdde/ddedummy.cxx delete mode 100644 svtools/unx/source/svdde/makefile.mk delete mode 100644 svtools/util/svl.flt delete mode 100644 svtools/util/svl.pmk delete mode 100644 svtools/util/svt.flt delete mode 100644 svtools/win/res/makefile.mk diff --git a/svl/inc/PasswordHelper.hxx b/svl/inc/PasswordHelper.hxx new file mode 100644 index 000000000000..7139a3ebe361 --- /dev/null +++ b/svl/inc/PasswordHelper.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: PasswordHelper.hxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVTOOLS_PASSWORDHELPER_HXX +#define _SVTOOLS_PASSWORDHELPER_HXX + +#include "svtools/svldllapi.h" +#include "sal/types.h" +#include "com/sun/star/uno/Sequence.hxx" + +class String; + +class SvPasswordHelper +{ + static void GetHashPassword(com::sun::star::uno::Sequence & rPassHash, const sal_Char* pPass, sal_uInt32 nLen); + static void GetHashPasswordLittleEndian(com::sun::star::uno::Sequence& rPassHash, const String& sPass); + static void GetHashPasswordBigEndian(com::sun::star::uno::Sequence& rPassHash, const String& sPass); + +public: + SVL_DLLPUBLIC static void GetHashPassword(com::sun::star::uno::Sequence& rPassHash, const String& sPass); + /** + Use this method to compare a given string with another given Hash value. + This is necessary, because in older versions exists different hashs of the same string. They were endian dependent. + We need this to handle old files. This method will compare against big and little endian. See #101326# + */ + SVL_DLLPUBLIC static bool CompareHashPassword(const com::sun::star::uno::Sequence& rOldPassHash, const String& sNewPass); +}; + +#endif + diff --git a/svl/inc/adrparse.hxx b/svl/inc/adrparse.hxx new file mode 100644 index 000000000000..439168441057 --- /dev/null +++ b/svl/inc/adrparse.hxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: adrparse.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _ADRPARSE_HXX +#define _ADRPARSE_HXX + +#include "svtools/svldllapi.h" +#include +#include + +//============================================================================ +struct SvAddressEntry_Impl +{ + UniString m_aAddrSpec; + UniString m_aRealName; + + SvAddressEntry_Impl() {}; + SvAddressEntry_Impl(UniString const & rTheAddrSpec, + UniString const & rTheRealName): + m_aAddrSpec(rTheAddrSpec), m_aRealName(rTheRealName) {} +}; + +//============================================================================ +DECLARE_LIST(SvAddressList_Impl, SvAddressEntry_Impl *) + +//============================================================================ +class SVL_DLLPUBLIC SvAddressParser +{ + friend class SvAddressParser_Impl; + + SvAddressEntry_Impl m_aFirst; + SvAddressList_Impl m_aRest; + bool m_bHasFirst; + +public: + SvAddressParser(UniString const & rInput); + + ~SvAddressParser(); + + sal_Int32 Count() const { return m_bHasFirst ? m_aRest.Count() + 1 : 0; } + + inline UniString const & GetEmailAddress(sal_Int32 nIndex) const; + + inline UniString const &GetRealName(sal_Int32 nIndex) const; + + /** Create an RFC 822 (i.e., 'e-mail address'). + + @param rPhrase Either an empty string (the will have no + an will be of the form ), or some text that will + become the part of a form . Non + US-ASCII characters within the text are put into a + verbatim, so the result may actually not be a valid RFC 822 , + but a more human-readable representation. + + @param rAddrSpec A valid RFC 822 . (An RFC 822 + including a cannot be created by this method.) + + @param rMailbox If this method returns true, this parameter returns + the created RFC 822 (rather, a more human-readable + representation thereof). Otherwise, this parameter is not modified. + + @return True, if rAddrSpec is a valid RFC 822 . + */ + static bool createRFC822Mailbox(String const & rPhrase, + String const & rAddrSpec, + String & rMailbox); +}; + +inline UniString const & SvAddressParser::GetEmailAddress(sal_Int32 nIndex) + const +{ + return nIndex == 0 ? m_aFirst.m_aAddrSpec : + m_aRest.GetObject(nIndex - 1)->m_aAddrSpec; +} + +inline UniString const & SvAddressParser::GetRealName(sal_Int32 nIndex) const +{ + return nIndex == 0 ? m_aFirst.m_aRealName : + m_aRest.GetObject(nIndex - 1)->m_aRealName; +} + +#endif // _ADRPARSE_HXX + diff --git a/svl/inc/broadcast.hxx b/svl/inc/broadcast.hxx new file mode 100644 index 000000000000..e3e409c46e96 --- /dev/null +++ b/svl/inc/broadcast.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: broadcast.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVT_BROADCAST_HXX +#define _SVT_BROADCAST_HXX + +#include "svtools/svldllapi.h" +#include + +class SvtListener; +class SfxHint; +class SvtListenerBase; + +//------------------------------------------------------------------------- + +class SVL_DLLPUBLIC SvtBroadcaster +{ +friend class SvtListener; +friend class SvtListenerBase; +friend class SvtListenerIter; + SvtListenerBase* pRoot; + + const SvtBroadcaster& operator=(const SvtBroadcaster &); // verboten + +protected: + void Forward( SvtBroadcaster& rBC, + const SfxHint& rHint ); + virtual void ListenersGone(); + +public: + TYPEINFO(); + + SvtBroadcaster(); + SvtBroadcaster( const SvtBroadcaster &rBC ); + virtual ~SvtBroadcaster(); + + void Broadcast( const SfxHint &rHint ); + + BOOL HasListeners() const { return 0 != pRoot; } +}; + + +#endif + diff --git a/svl/inc/cntnrsrt.hxx b/svl/inc/cntnrsrt.hxx new file mode 100644 index 000000000000..13553f7f16fd --- /dev/null +++ b/svl/inc/cntnrsrt.hxx @@ -0,0 +1,177 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: cntnrsrt.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CNTRSRT_HXX +#define _CNTRSRT_HXX + +#if 0 +*********************************************************************** +* +* Hier folgt die Beschreibung fuer die exportierten Makros: +* +* DECLARE_CONTAINER_SORT( ClassName, Type ) +* IMPL_CONTAINER_SORT( ClassName, Type, SortFunc ) +* +* Definiert eine von Container abgeleitete Klasse "ClassName", +* in der die Elemente des Typs "Type" sortiert enthalten sind. +* Dazu muss einer Funktion "SortFunc" definiert sein, die als +* Paramter zwei "const Type&" erwartet und 0 zurueckgibt, wenn +* beide gleich sind, -1 wenn der erste Paramter kleiner ist als +* der zweite und +1 wenn der erste Paramter groesser ist als +* der zweite. +* +* Die Zugriffs-Methoden entsprechen in etwa denen der Container- +* Klasse, mit Ausnahme von Insert, DeleteAndDestroy und Seek_Entry, +* der den SV-Pointer-Arrays entsprechen. +* +* DECLARE_CONTAINER_SORT_DEL( ClassName, Type ) +* IMPL_CONTAINER_SORT( ClassName, Type, SortFunc ) +* +* Wie DECLARE_CONTAINER_SORT, nur dass beim Aufruf des Destruktors +* alle im Conatiner vorhandenen Objekte geloescht werden. +* +#endif + +#include + +#define DECLARE_CONTAINER_SORT_COMMON( ClassName, Type ) \ + ClassName( const ClassName& ); \ + ClassName& operator =( const ClassName& ); \ +public: \ + using Container::Count; \ + \ + ClassName( USHORT InitSize, USHORT ReSize ) : \ + Container( CONTAINER_MAXBLOCKSIZE, InitSize, ReSize ) {} \ + \ + BOOL Insert( Type* pObj ); \ + \ + Type *Remove( ULONG nPos ) \ + { return (Type *)Container::Remove( nPos ); } \ + \ + Type *Remove( Type* pObj ); \ + \ + void DeleteAndDestroy( ULONG nPos ) \ + { \ + Type *pObj = Remove( nPos ); \ + if( pObj ) \ + delete pObj; \ + } \ + \ + void DeleteAndDestroy() \ + { while( Count() ) DeleteAndDestroy( 0 ); } \ + \ + Type* GetObject( ULONG nPos ) const \ + { return (Type *)Container::GetObject( nPos ); } \ + \ + Type* operator[]( ULONG nPos ) const \ + { return GetObject(nPos); } \ + \ + BOOL Seek_Entry( const Type *pObj, ULONG* pPos ) const; \ + \ + ULONG GetPos( const Type* pObj ) const; \ + + +#define DECLARE_CONTAINER_SORT( ClassName, Type ) \ +class ClassName : private Container \ +{ \ + DECLARE_CONTAINER_SORT_COMMON( ClassName, Type ) \ + ~ClassName() {} \ +}; \ + + +#define DECLARE_CONTAINER_SORT_DEL( ClassName, Type ) \ +class ClassName : private Container \ +{ \ + DECLARE_CONTAINER_SORT_COMMON( ClassName, Type ) \ + ~ClassName() { DeleteAndDestroy(); } \ +}; \ + + +#define IMPL_CONTAINER_SORT( ClassName, Type, SortFunc ) \ +BOOL ClassName::Insert( Type *pObj ) \ +{ \ + ULONG nPos; \ + BOOL bExist = Seek_Entry( pObj, &nPos ); \ + if( !bExist ) \ + Container::Insert( pObj, nPos ); \ + return !bExist; \ +} \ + \ +Type *ClassName::Remove( Type* pObj ) \ +{ \ + ULONG nPos; \ + if( Seek_Entry( pObj, &nPos ) ) \ + return Remove( nPos ); \ + else \ + return 0; \ +} \ + \ +ULONG ClassName::GetPos( const Type* pObj ) const \ +{ \ + ULONG nPos; \ + if( Seek_Entry( pObj, &nPos ) ) \ + return nPos; \ + else \ + return CONTAINER_ENTRY_NOTFOUND; \ +} \ + \ +BOOL ClassName::Seek_Entry( const Type* pObj, ULONG* pPos ) const \ +{ \ + register ULONG nO = Count(), \ + nM, \ + nU = 0; \ + if( nO > 0 ) \ + { \ + nO--; \ + while( nU <= nO ) \ + { \ + nM = nU + ( nO - nU ) / 2; \ + int nCmp = SortFunc( *GetObject(nM), *pObj ); \ + \ + if( 0 == nCmp ) \ + { \ + if( pPos ) *pPos = nM; \ + return TRUE; \ + } \ + else if( nCmp < 0 ) \ + nU = nM + 1; \ + else if( nM == 0 ) \ + { \ + if( pPos ) *pPos = nU; \ + return FALSE; \ + } \ + else \ + nO = nM - 1; \ + } \ + } \ + if( pPos ) *pPos = nU; \ + return FALSE; \ +} \ + +#endif diff --git a/svl/inc/cntwids.hrc b/svl/inc/cntwids.hrc new file mode 100644 index 000000000000..fcb9f855453b --- /dev/null +++ b/svl/inc/cntwids.hrc @@ -0,0 +1,509 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: cntwids.hrc,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CNTWIDS_HRC +#define _CNTWIDS_HRC + +#ifndef OLD_CHAOS +#define TF_NEW_TABPAGES +#define CNT_COOL_ABO +#endif + +//========================================================================= +// ARGS, MSG, ALL, FOLDER, BOXALL, BOXEXT +//========================================================================= + +#define WID_CHAOS_START 500 + +//FUNC MSG +#define WID_MARK_THREAD_MARKED (499) +#define WID_MARK_THREAD_UNMARKED (498) + +// ARGS +#define WID_DUMMY_ARG1 (WID_CHAOS_START + 0) +#define WID_FACTORY_NO (WID_CHAOS_START + 1) +#define WID_FACTORY_NAME (WID_CHAOS_START + 2) +#define WID_NEWS_XREF (WID_CHAOS_START + 3) +#define WID_CREATION_FLAGS (WID_CHAOS_START + 4) +#define WID_FACTORY_HELP_ID (WID_CHAOS_START + 5) + +//FUNC MSG +#define WID_MSG_START (WID_CHAOS_START + 6) +#define WID_MAIL_REPLY (WID_CHAOS_START + 6) +#define WID_POST_REPLY (WID_CHAOS_START + 7) +#define WID_FORWARD (WID_CHAOS_START + 8) +#define WID_MARK_THREAD_READ (WID_CHAOS_START + 9) +#define WID_HIDE_THREAD (WID_CHAOS_START + 10) +#define WID_HIDE_AUTHOR (WID_CHAOS_START + 11) +#define WID_HIDE_SUBJECT (WID_CHAOS_START + 12) +#define WID_RESEND_MSG (WID_CHAOS_START + 13) +#define WID_MARK_THREAD_UNREAD (WID_CHAOS_START + 14) + +//PROP MSG +#define WID_PRIORITY (WID_CHAOS_START + 15) +#define WID_RULE_APPLIED (WID_CHAOS_START + 16) +#define WID_MSG_LOCK (WID_CHAOS_START + 17) +#define WID_SEEN_STATUS (WID_CHAOS_START + 18) +#define WID_REPLY_TO (WID_CHAOS_START + 19) +#define WID_IN_REPLY_TO (WID_CHAOS_START + 20) + +#define WID_MESSAGE_ID (WID_CHAOS_START + 21) +#define WID_BCC (WID_CHAOS_START + 22) +#define WID_CC (WID_CHAOS_START + 23) +#define WID_TO (WID_CHAOS_START + 24) +#define WID_FROM (WID_CHAOS_START + 25) +#define WID_TITLE (WID_CHAOS_START + 26) +#define WID_SUBJECT WID_TITLE // only here to prevent panic, should be removed +#define WID_MESSAGEBODY (WID_CHAOS_START + 27) + +#define WID_REFERENCES (WID_CHAOS_START + 28) +#define WID_NEWSGROUPS (WID_CHAOS_START + 29) +#define WID_NEWS_XREFLIST (WID_CHAOS_START + 30) + +#define WID_OUTMSGINTERNALSTATE (WID_CHAOS_START + 31) +#define WID_RECIPIENTLIST (WID_CHAOS_START + 32) +#define WID_MSG_END (WID_CHAOS_START + 32) + +//FUNC ALL +#define WID_ALL_START (WID_CHAOS_START + 33) +#define WID_DEFAULT (WID_CHAOS_START + 33) +#define WID_OPEN (WID_CHAOS_START + 34) +#define WID_DELETE (WID_CHAOS_START + 35) +#define WID_CUT (WID_CHAOS_START + 36) +#define WID_COPY (WID_CHAOS_START + 37) +#define WID_PASTE (WID_CHAOS_START + 38) +#define WID_RENAME (WID_CHAOS_START + 39) + +#define WID_HAS_DATA (WID_CHAOS_START + 40) +#define WID_GETDATA (WID_CHAOS_START + 41) +#define WID_PUTDATA (WID_CHAOS_START + 42) + +//PROP ALL +#define WID_INTERIM_URL (WID_CHAOS_START + 43) +#define WID_CONTENT_TYPE (WID_CHAOS_START + 44) + +#define WID_OWN_URL (WID_CHAOS_START + 45) +#define WID_REAL_URL (WID_CHAOS_START + 46) +#define WID_OBSOLETE_TITLE (WID_CHAOS_START + 47) +#define WID_FLAG_READONLY (WID_CHAOS_START + 48) + +#define WID_REFERED_URL (WID_CHAOS_START + 49) +#define WID_REFERER_COUNT (WID_CHAOS_START + 50) +#define WID_FLAG_IS_FOLDER (WID_CHAOS_START + 51) +#define WID_FLAG_HAS_FOLDER (WID_CHAOS_START + 52) +#define WID_FLAG_IS_MESSAGE (WID_CHAOS_START + 53) +#define WID_FLAG_IS_DOCUMENT (WID_FLAG_IS_MESSAGE) +#define WID_FLAG_HAS_MESSAGES (WID_CHAOS_START + 54) + +#define WID_DATE_CREATED (WID_CHAOS_START + 55) +#define WID_DATE_MODIFIED (WID_CHAOS_START + 56) +#define WID_VIEW_DESCRIPTION (WID_CHAOS_START + 57) +#define WID_IS_READ (WID_CHAOS_START + 58) +#define WID_IS_MARKED (WID_CHAOS_START + 59) +#define WID_ALL_END (WID_CHAOS_START + 59) + +//FUNC FOLDER +#define WID_FOLDER_START (WID_CHAOS_START + 60) +#define WID_SYNCHRONIZE (WID_CHAOS_START + 60) +#define WID_CREATE_NEW (WID_CHAOS_START + 61) +#define WID_INSERT (WID_CHAOS_START + 62) +#define WID_UPDATE (WID_CHAOS_START + 63) +#define WID_IMPORT (WID_CHAOS_START + 64) + +//PROP FOLDER VIEW +#define WID_DUMMY_PROPFOLDERVIEW1 (WID_CHAOS_START + 65) +#define WID_THREADING (WID_CHAOS_START + 66) +#define WID_MSG_COLUMN_INFO /* obsolete */ (WID_CHAOS_START + 67) +#define WID_FLD_COLUMN_INFO /* obsolete */ (WID_CHAOS_START + 68) +#define WID_FOLDERVIEW_MODE (WID_CHAOS_START + 69) +#define WID_MESSAGEVIEW_MODE (WID_CHAOS_START + 70) +#define WID_SENTMESSAGEVIEW_MODE (WID_CHAOS_START + 71) +#define WID_SORTING (WID_CHAOS_START + 72) +#define WID_THREADED (WID_CHAOS_START + 73) +#define WID_FILTERED (WID_CHAOS_START + 74) +#define WID_RULES (WID_CHAOS_START + 75) +#define WID_SUBSCRNEWSGROUPCOUNT (WID_CHAOS_START + 76) +#define WID_FLAG_SUBSCRIBED (WID_CHAOS_START + 77) +#define WID_FLAG_SUPPORTMODE (WID_CHAOS_START + 78) + +//PROP FOLDER DIR +#define WID_DUMMY_FOLDERDIR1 (WID_CHAOS_START + 79) +#define WID_TOTALCONTENTCOUNT (WID_CHAOS_START + 80) +#define WID_NEWSGROUPCOUNT /* ??? */ (WID_CHAOS_START + 81) +#define WID_ARTICLECOUNT /* ??? */ (WID_CHAOS_START + 82) +#define WID_KNOWN_RANGES (WID_CHAOS_START + 83) +#define WID_IMAPFOLDERINFO (WID_CHAOS_START + 84) + +//PROP FOLDER USER +#define WID_DUMMY_FOLDERUSER1 (WID_CHAOS_START + 85) +#define WID_SEENCONTENTCOUNT (WID_CHAOS_START + 86) +#define WID_UNREAD_ARTICLECOUNT (WID_SEENCONTENTCOUNT) +#define WID_SENTCONTENTCOUNT (WID_SEENCONTENTCOUNT) +#define WID_READ_RANGES (WID_CHAOS_START + 87) +#define WID_MARK_RANGES (WID_CHAOS_START + 88) +#define WID_FOLDER_END (WID_CHAOS_START + 88) + +//PROP BOXALL +#define WID_BOXALL_START (WID_CHAOS_START + 89) +// Used for d&d of View Storages... +#define WID_PREPARE_MOVE (WID_CHAOS_START + 89) +#define WID_OUTTRAY_WANTED (WID_CHAOS_START + 90) +#define WID_USERNAME (WID_CHAOS_START + 91) +#define WID_PASSWORD (WID_CHAOS_START + 92) +#define WID_SERVERNAME (WID_CHAOS_START + 93) +#define WID_SERVERPORT (WID_CHAOS_START + 94) +// obsolete +#define WID_MAILSEND_USERNAME (WID_CHAOS_START + 95) +#define WID_MAILSEND_PASSWORD (WID_CHAOS_START + 96) +#define WID_MAILSEND_SERVERNAME (WID_CHAOS_START + 97) +#define WID_NEWSSEND_USERNAME (WID_CHAOS_START + 98) +#define WID_NEWSSEND_PASSWORD (WID_CHAOS_START + 99) +#define WID_NEWSSEND_SERVERNAME (WID_CHAOS_START + 100) +// end obsolete +#define WID_SERVERBASE (WID_CHAOS_START + 101) +// not used +#define WID_SMTP_GATEWAY (WID_CHAOS_START + 102) + +// -> ..._DEFAULT +// obsolete +#define WID_FROM_DEFAULT (WID_CHAOS_START + 103) +// obsolete +#define WID_REPLY_TO_DEFAULT (WID_CHAOS_START + 104) + +#define WID_AUTOUPDATE_INTERVAL (WID_CHAOS_START + 105) +#define WID_UPDATE_ENABLED (WID_CHAOS_START + 106) +#define WID_BOXALL_END (WID_CHAOS_START + 106) + +//PROP BOX RNMGR +#define WID_BOXEXT_START (WID_CHAOS_START + 107) +#define WID_CONNECTION_MODE (WID_CHAOS_START + 107) +#define WID_NEWS_GROUPLIST (WID_CHAOS_START + 108) +#ifdef OLD_CHAOS +#define WID_BOX_CONNECTION_PROP (WID_CHAOS_START + 109) +#else +#define WID_MESSAGE_STOREMODE (WID_CHAOS_START + 109) +#endif +#define WID_DELETE_ON_SERVER (WID_CHAOS_START + 110) + +//PROP BOX USER + +//PROP BOX OUT DIR +#define WID_OUTMSGEXTERNALSTATE (WID_CHAOS_START + 111) + +//PROP RNM +#define WID_RNM_UPDATETIMER_LIST (WID_CHAOS_START + 112) +#define WID_BOXEXT_END (WID_CHAOS_START + 112) + +////////////////////////////////////////////////////////////////////////// +// MISC - Added after initial pool version +////////////////////////////////////////////////////////////////////////// + +// PROP BOX +#define WID_SERVER_RANGES (WID_CHAOS_START + 113) +#define WID_LAST_UPDATE (WID_CHAOS_START + 114) +#define WID_LAST_MSGID (WID_CHAOS_START + 115) +#define WID_LAST_UID (WID_CHAOS_START + 116) + +// FUNC ALL +#define WID_UNDELETE (WID_CHAOS_START + 117) +#define WID_CLOSE (WID_CHAOS_START + 118) +#define WID_REOPEN (WID_CHAOS_START + 119) + +// PROP RNM +#define WID_RNM_FILECONVERSION_LIST (WID_CHAOS_START + 120) + +// PROP FOLDER +#define WID_SHOW_MSGS_HAS_TIMELIMIT (WID_CHAOS_START + 121) +#define WID_SHOW_MSGS_TIMELIMIT (WID_CHAOS_START + 122) +#define WID_STORE_MSGS_HAS_TIMELIMIT (WID_CHAOS_START + 123) +#define WID_STORE_MSGS_TIMELIMIT (WID_CHAOS_START + 124) + +// PROP BOX +#define WID_MSG_COLUMN_WIDTHS /* obsolete */(WID_CHAOS_START + 125) + +#ifdef OLD_CHAOS + +#define WID_CHAOS_END (WID_CHAOS_START + 125) + +#else + +////////////////////////////////////////////////////////////////////////// +// WID's added after SO 4.0 release ( SUPD > 364 ) +////////////////////////////////////////////////////////////////////////// + +// PROP ALL +#define WID_PROPERTYLIST (WID_CHAOS_START + 126) + +// PROP BOXALL +#define WID_BOXALL_START2 (WID_CHAOS_START + 127) +#define WID_SEND_PUBLIC_PROT_ID (WID_CHAOS_START + 127) +#define WID_SEND_PRIVATE_PROT_ID (WID_CHAOS_START + 128) +#define WID_SEND_PUBLIC_OUTBOXPROPS (WID_CHAOS_START + 129) +#define WID_SEND_PRIVATE_OUTBOXPROPS (WID_CHAOS_START + 130) +#define WID_SEND_SERVERNAME (WID_CHAOS_START + 131) +#define WID_SEND_USERNAME (WID_CHAOS_START + 132) +#define WID_SEND_PASSWORD (WID_CHAOS_START + 133) +#define WID_SEND_REPLY_TO_DEFAULT (WID_CHAOS_START + 134) +#define WID_SEND_FROM_DEFAULT (WID_CHAOS_START + 135) +#define WID_VIM_POPATH (WID_CHAOS_START + 136) +#define WID_SEND_VIM_POPATH (WID_CHAOS_START + 137) +#define WID_PURGE (WID_CHAOS_START + 138) +#define WID_CLEAN_CACHE (WID_CHAOS_START + 139) +#define WID_SEARCH (WID_CHAOS_START + 140) +#define WID_JOURNAL (WID_CHAOS_START + 141) +#define WID_LOCALBASE (WID_CHAOS_START + 142) +#define WID_BOXALL_END2 (WID_CHAOS_START + 142) + +// PROP DOCUMENT +#define WID_DOCUMENT_HEADER (WID_CHAOS_START + 143) +#define WID_DOCUMENT_BODY (WID_CHAOS_START + 144) +#define WID_DOCUMENT_SIZE (WID_CHAOS_START + 145) + +// PROP ALL +#define WID_SIZE WID_DOCUMENT_SIZE + +// PROP PROJECT +#define WID_PRJ_MEDIUM (WID_CHAOS_START + 146) +#define WID_PRJ_FILENAMECONVENTION (WID_CHAOS_START + 147) + +// PROP FSYS +#define WID_FSYS_DISKSPACE_LEFT (WID_CHAOS_START + 148) +#define WID_TRANSFER (WID_CHAOS_START + 149) + +// PROP ALL +#define WID_KEYWORDS (WID_CHAOS_START + 150) +#define WID_IS_PROTECTED (WID_CHAOS_START + 151) + +// PROP SEARCH +#define WID_SEARCH_CRITERIA (WID_CHAOS_START + 152) +#define WID_SEARCH_LOCATIONS (WID_CHAOS_START + 153) +#define WID_SEARCH_RECURSIVE (WID_CHAOS_START + 154) +#define WID_SEARCH_FOLDER_VIEW (WID_CHAOS_START + 155) +#define WID_SEARCH_DOCUMENT_VIEW (WID_CHAOS_START + 156) + +// PROP Channel +#define WID_SCHEDULE_RANGE (WID_CHAOS_START + 157) +#define WID_ALLOWED_SCHEDULE_RANGE (WID_CHAOS_START + 158) +#define WID_TARGET_URL (WID_CHAOS_START + 159) +#define WID_FREQUENCY (WID_CHAOS_START + 160) + +// PROP HTTP +#define WID_HTTP_CONNECTION_LIMIT (WID_CHAOS_START + 161) +#define WID_HTTP_COOKIE_MANAGER (WID_CHAOS_START + 162) + +// PROP Channel +#define WID_COLUMN_NEXT_UPD (WID_CHAOS_START + 163) +#define WID_CRAWL_STATUS (WID_CHAOS_START + 164) +#define WID_CRAWL_LEVEL (WID_CHAOS_START + 165) +#define WID_CRAWL_MODE (WID_CHAOS_START + 166) +// WID_CRAWL_MAX_VOLUME shall be removed in the future! +// --> WID_SIZE_LIMIT +#define WID_CRAWL_MAX_VOLUME (WID_CHAOS_START + 167) +#define WID_CRAWL_IMAGE (WID_CHAOS_START + 168) +#define WID_CRAWL_LINK_OUT (WID_CHAOS_START + 169) +#define WID_NOTIFICATION_MODE (WID_CHAOS_START + 170) +#define WID_NOTIFICATION_ADDRESS (WID_CHAOS_START + 171) + +// PROP BOXALL +#define WID_ACCOUNT (WID_CHAOS_START + 172) + +// PROP FSYS +#define WID_FSYS_KIND (WID_CHAOS_START + 173) +#define WID_FSYS_FLAGS (WID_CHAOS_START + 174) + +// PROP FOLDER +#define WID_VIEWDATA /* obsolete */ (WID_CHAOS_START + 175) + +// PROP FSYS +#define WID_WHO_IS_MASTER (WID_CHAOS_START + 176) + +// FUNC HTTP +#define WID_HTTP_POST (WID_CHAOS_START + 177) + +// PROP ALL +#define WID_SUPPORTED_FUNCS (WID_CHAOS_START + 178) +#define WID_SIZE_LIMIT (WID_CHAOS_START + 179) + +// PROP FOLDER +#define WID_MARKED_DOCUMENT_COUNT (WID_CHAOS_START + 180) +#define WID_FOLDER_COUNT (WID_CHAOS_START + 181) + +// PROP FSYS +#define WID_FSYS_SHOW_HIDDEN (WID_CHAOS_START + 182) + +// TRASHCAN +#define WID_TRASHCAN_START (WID_CHAOS_START + 183) +#define WID_TRASHCAN_EMPTY_TRASH (WID_CHAOS_START + 183) +#define WID_TRASHCAN_FLAG_AUTODELETE (WID_CHAOS_START + 184) +#define WID_TRASHCAN_FLAG_CONFIRMEMPTY (WID_CHAOS_START + 185) +#define WID_TRASHCAN_DUMMY1 (WID_CHAOS_START + 186) +#define WID_TRASHCAN_DUMMY2 (WID_CHAOS_START + 187) +#define WID_TRASHCAN_END (WID_CHAOS_START + 187) + +// TRASH +#define WID_TRASH_START (WID_CHAOS_START + 188) +#define WID_TRASH_RESTORE (WID_CHAOS_START + 188) +#define WID_TRASH_ORIGIN (WID_CHAOS_START + 189) +#define WID_TRASH_DUMMY2 (WID_CHAOS_START + 190) +#define WID_TRASH_END (WID_CHAOS_START + 190) + +// PROP ALL +#define WID_TARGET_FRAMES (WID_CHAOS_START + 191) + +// FUNC FOLDER +#define WID_EXPORT (WID_CHAOS_START + 192) + +// COMPONENT +#define WID_COMPONENT_COMMAND (WID_CHAOS_START + 193) +#define WID_COMPONENT_MENU (WID_CHAOS_START + 194) + +// PROP Channel +#define WID_HREF (WID_CHAOS_START + 195) + +// PROP FOLDER (VIEW) +#define WID_VIEW_START (WID_CHAOS_START + 196) +#define WID_VIEW_COLS_BEAMER (WID_CHAOS_START + 196) +#define WID_VIEW_COLS_FILEDLG (WID_CHAOS_START + 197) +#define WID_VIEW_COLS_FLDWIN (WID_CHAOS_START + 198) +#define WID_VIEW_MODE_FLDWIN (WID_CHAOS_START + 199) +#define WID_VIEW_LAYOUT_FLDWIN (WID_CHAOS_START + 200) +#define WID_VIEW_ICON_POS_FLDWIN (WID_CHAOS_START + 201) +#define WID_VIEW_SORT_BEAMER (WID_CHAOS_START + 202) +#define WID_VIEW_SORT_FILEDLG (WID_CHAOS_START + 203) +#define WID_VIEW_SORT_FLDWIN_DETAILS (WID_CHAOS_START + 204) +#define WID_VIEW_SORT_FLDWIN_ICON (WID_CHAOS_START + 205) +#define WID_VIEW_WINDOW_POS_FLDWIN (WID_CHAOS_START + 206) +#define WID_VIEW_END (WID_CHAOS_START + 206) + +// PROP ALL +#define WID_IS_INVALID (WID_CHAOS_START + 207) + +// PROP Channel +#define WID_VIEW_TIPHELP (WID_CHAOS_START + 208) +#define WID_PUBLISHER_SCHEDULE (WID_CHAOS_START + 209) +#define WID_GETMODE (WID_CHAOS_START + 210) +#define WID_READ_OFFLINE (WID_CHAOS_START + 211) + +// PROP ALL +#define WID_ALL_START2 (WID_CHAOS_START + 212) +#define WID_REAL_NAME (WID_CHAOS_START + 212) +#define WID_FLAG_UPDATE_ON_OPEN (WID_CHAOS_START + 213) +#define WID_ACTION_LIST (WID_CHAOS_START + 214) +#define WID_EDIT_STRING (WID_CHAOS_START + 215) +#define WID_SET_AS_DEFAULT (WID_CHAOS_START + 216) +#define WID_ALL_END2 (WID_CHAOS_START + 216) + +// PROP FOLDER (VIEW) +#define WID_VIEW2_START (WID_CHAOS_START + 217) +#define WID_VIEW2_FLD_PIC (WID_CHAOS_START + 217) +#define WID_FLAG_EXPANDED (WID_CHAOS_START + 218) +#define WID_CHILD_DEFAULTS (WID_CHAOS_START + 219) +#define WID_VIEW2_END (WID_CHAOS_START + 219) + +// PROP HTTP +#define WID_HTTP_KEEP_EXPIRED (WID_CHAOS_START + 220) +#define WID_HTTP_VERIFY_MODE (WID_CHAOS_START + 221) +#define WID_HTTP_NOCACHE_LIST (WID_CHAOS_START + 222) +#define WID_HTTP_REFERER (WID_CHAOS_START + 223) + +// PROP FSYS +#define WID_FSYS_START (WID_CHAOS_START + 224) +#define WID_FSYS_VALUE_FOLDER (WID_CHAOS_START + 224) +#define WID_FSYS_SHOW_EXTENSION (WID_CHAOS_START + 225) +#define WID_VALUE_ADDED_MODE (WID_CHAOS_START + 226) +#define WID_FSYS_DUMMY3 (WID_CHAOS_START + 227) +#define WID_FSYS_DUMMY4 (WID_CHAOS_START + 228) +#define WID_FSYS_END (WID_CHAOS_START + 228) + +// FUNC HTTP +#define WID_HTTP_GET_COOKIE (WID_CHAOS_START + 229) +#define WID_HTTP_SET_COOKIE (WID_CHAOS_START + 230) + +// PROP HTTP +#define WID_HTTP_COOKIE (WID_CHAOS_START + 231) +#define WID_HTTP_DUMMY_1 (WID_CHAOS_START + 232) + +////////////////////////////////////////////////////////////////////////// +// WID's added after SO 5.0 release ( SUPD > 505 ) +////////////////////////////////////////////////////////////////////////// + +// PROP FOLDER +#define WID_FOLDER_START2 (WID_CHAOS_START + 233) +#define WID_USER_SORT_CRITERIUM (WID_CHAOS_START + 233) +#define WID_HEADER_CONFIG (WID_CHAOS_START + 234) +#define WID_GROUPVIEW_CONFIG (WID_CHAOS_START + 235) +#define WID_FLD_WEBVIEW_TEMPLATE (WID_CHAOS_START + 236) +// eigene Iconpositionen fuer den Explorer, da er noch +// keinen eigenen View-Storage hat +#define WID_VIEW_ICON_POS_GRPWIN (WID_CHAOS_START + 237) +#define WID_FOLDER_END2 (WID_CHAOS_START + 237) + +// PROP ALL +#define WID_SHOW_IN_EXPLORER (WID_CHAOS_START + 238) + +// PROP FOLDER (VIEW) +#define WID_VIEW3_START (WID_CHAOS_START + 239) +#define WID_FLD_FONT (WID_CHAOS_START + 239) +#define WID_FLD_WEBVIEW_USE_GLOBAL (WID_CHAOS_START + 240) +#define WID_VIEW3_DUMMY2 (WID_CHAOS_START + 241) +#define WID_VIEW3_DUMMY3 (WID_CHAOS_START + 242) +#define WID_VIEW3_END (WID_CHAOS_START + 242) + +// PROP FTP +#define WID_FTP_ACCOUNT (WID_CHAOS_START + 243) + +// PROP FOLDER +#define WID_STORE_MARKED (WID_CHAOS_START + 244) + +// REPLICATION ( Currently only here to have file compatibility between +// SO51 Client and SO51 Server, for which the functionality +// first shall be implemented ). +#define WID_REPLICATION_1 (WID_CHAOS_START + 245) +#define WID_REPLICATION_2 (WID_CHAOS_START + 246) +#define WID_REPLICATION_3 (WID_CHAOS_START + 247) +#define WID_REPLICATION_4 (WID_CHAOS_START + 248) +#define WID_REPLICATION_5 (WID_CHAOS_START + 249) + +// PROP SEARCH +#define WID_SEARCH_INDIRECTIONS (WID_CHAOS_START + 250) + +// PROP ALL +#define WID_SEND_FORMATS (WID_CHAOS_START + 251) +#define WID_SEND_COPY_TARGET (WID_CHAOS_START + 252) + +// FUNC ALL +#define WID_TRANSFER_RESULT (WID_CHAOS_START + 253) + +// END +#define WID_CHAOS_END (WID_CHAOS_START + 253) + +#endif /* OLD_CHAOS */ + +#endif /* !_CNTWIDS_HRC */ diff --git a/svl/inc/filenotation.hxx b/svl/inc/filenotation.hxx new file mode 100644 index 000000000000..460d425d471a --- /dev/null +++ b/svl/inc/filenotation.hxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: filenotation.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVTOOLS_FILENOTATION_HXX +#define SVTOOLS_FILENOTATION_HXX + +#include "svtools/svldllapi.h" +#include + +//......................................................................... +namespace svt +{ +//......................................................................... + + //===================================================================== + //= OFileNotation + //===================================================================== + class SVL_DLLPUBLIC OFileNotation + { + protected: + ::rtl::OUString m_sSystem; + ::rtl::OUString m_sFileURL; + + public: + enum NOTATION + { + N_SYSTEM, + N_URL + }; + + OFileNotation( const ::rtl::OUString& _rUrlOrPath ); + OFileNotation( const ::rtl::OUString& _rUrlOrPath, NOTATION _eInputNotation ); + + ::rtl::OUString get(NOTATION _eOutputNotation); + + private: + SVL_DLLPRIVATE void construct( const ::rtl::OUString& _rUrlOrPath ); + SVL_DLLPRIVATE bool implInitWithSystemNotation( const ::rtl::OUString& _rSystemPath ); + SVL_DLLPRIVATE bool implInitWithURLNotation( const ::rtl::OUString& _rURL ); + }; + +//......................................................................... +} // namespace svt +//......................................................................... + +#endif // SVTOOLS_FILENOTATION_HXX + diff --git a/svl/inc/flbytes.hxx b/svl/inc/flbytes.hxx new file mode 100644 index 000000000000..86c19191de2a --- /dev/null +++ b/svl/inc/flbytes.hxx @@ -0,0 +1,174 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: flbytes.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _FLBYTES_HXX +#define _FLBYTES_HXX + +#include +#include + +//============================================================================ +class SvFillLockBytes : public SvLockBytes +{ + SvLockBytesRef xLockBytes; + ULONG nFilledSize; + BOOL bTerminated; + BOOL bSync; +public: + TYPEINFO(); + + SvFillLockBytes( SvLockBytes* pLockBytes ); + virtual ErrCode ReadAt( + ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pRead ) const; + virtual ErrCode WriteAt( + ULONG nPos, const void* pBuffer, ULONG nCount, ULONG* pWritten ); + virtual ErrCode Flush() const; + virtual ErrCode SetSize( ULONG nSize ); + virtual ErrCode LockRegion( ULONG nPos, ULONG nCount, LockType ); + virtual ErrCode UnlockRegion( ULONG nPos, ULONG nCount, LockType ); + virtual ErrCode Stat( SvLockBytesStat*, SvLockBytesStatFlag ) const; + ErrCode FillAppend( const void* pBuffer, ULONG nCount, ULONG *pWritten ); + ULONG Tell() const { return nFilledSize; } + void Seek( ULONG nPos ) { nFilledSize = nPos; } + + void Terminate(); +}; + +SV_DECL_IMPL_REF( SvFillLockBytes ) + +//============================================================================ +class SvSyncLockBytes: public SvOpenLockBytes +{ + SvAsyncLockBytesRef m_xAsyncLockBytes; + +public: + TYPEINFO(); + + /// Create a synchronous wrapper around existing asynchronous lock bytes. + /// + /// @param pTheAsyncLockBytes Must not be null. + inline SvSyncLockBytes(SvAsyncLockBytes * pTheAsyncLockBytes); + + /// Create a synchronous wrapper around an existing stream. + /// + /// @descr This is like first creating asynchronous lock bytes around the + /// stream and than creating a synchronous wrapper around the asynchronous + /// lock bytes. + /// + /// @param pStream Must not be null. + /// + /// @param bOwner True if these lock bytes own the stream (delete it on + /// destruction). + SvSyncLockBytes(SvStream * pStream, BOOL bOwner): + m_xAsyncLockBytes(new SvAsyncLockBytes(pStream, bOwner)) {} + + virtual const SvStream * GetStream() const + { return m_xAsyncLockBytes->GetStream(); } + + virtual void SetSynchronMode(BOOL bSync = TRUE) + { m_xAsyncLockBytes->SetSynchronMode(bSync); } + + virtual BOOL IsSynchronMode() const + { return m_xAsyncLockBytes->IsSynchronMode(); } + + virtual ErrCode ReadAt(ULONG nPos, void * pBuffer, ULONG nCount, + ULONG * pRead) const; + + virtual ErrCode WriteAt(ULONG nPos, const void * pBuffer, ULONG nCount, + ULONG * pWritten); + + virtual ErrCode Flush() const { return m_xAsyncLockBytes->Flush(); } + + virtual ErrCode SetSize(ULONG nSize) + { return m_xAsyncLockBytes->SetSize(nSize); } + + virtual ErrCode LockRegion(ULONG nPos, ULONG nCount, LockType eType) + { return m_xAsyncLockBytes->LockRegion(nPos, nCount, eType); } + + virtual ErrCode UnlockRegion(ULONG nPos, ULONG nCount, LockType eType) + { return m_xAsyncLockBytes->UnlockRegion(nPos, nCount, eType); } + + virtual ErrCode Stat(SvLockBytesStat * pStat, SvLockBytesStatFlag eFlag) + const + { return m_xAsyncLockBytes->Stat(pStat, eFlag); } + + virtual ErrCode FillAppend(const void * pBuffer, ULONG nCount, + ULONG * pWritten) + { return m_xAsyncLockBytes->FillAppend(pBuffer, nCount, pWritten); } + + virtual ULONG Tell() const { return m_xAsyncLockBytes->Tell(); } + + virtual ULONG Seek(ULONG nPos) + { return m_xAsyncLockBytes->Seek(nPos); } + + virtual void Terminate() { m_xAsyncLockBytes->Terminate(); } +}; + +inline SvSyncLockBytes::SvSyncLockBytes(SvAsyncLockBytes * + pTheAsyncLockBytes): + m_xAsyncLockBytes(pTheAsyncLockBytes) +{ + DBG_ASSERT(m_xAsyncLockBytes.Is(), + "SvSyncLockBytes::SvSyncLockBytes(): Null"); +} + +SV_DECL_IMPL_REF(SvSyncLockBytes); + +//============================================================================ +struct SvCompositeLockBytes_Impl; +class SvCompositeLockBytes : public SvLockBytes +{ + SvCompositeLockBytes_Impl* pImpl; +public: + TYPEINFO(); + + SvCompositeLockBytes( ); + ~SvCompositeLockBytes(); + + void Append( SvLockBytes* pLockBytes, ULONG nPos, ULONG nOffset ); + ULONG RelativeOffset( ULONG nPos ) const; + void SetIsPending( BOOL bSet ); + SvLockBytes* GetLastLockBytes() const; + + virtual ErrCode ReadAt( + ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pRead ) const; + virtual ErrCode WriteAt( + ULONG nPos, const void* pBuffer, ULONG nCount, ULONG* pWritten ); + virtual ErrCode Flush() const; + virtual ErrCode SetSize( ULONG nSize ); + virtual ErrCode LockRegion( ULONG nPos, ULONG nCount, LockType ); + virtual ErrCode UnlockRegion( ULONG nPos, ULONG nCount, LockType ); + virtual ErrCode Stat( SvLockBytesStat*, SvLockBytesStatFlag ) const; +}; + +SV_DECL_IMPL_REF( SvCompositeLockBytes ) + + +#endif diff --git a/svl/inc/folderrestriction.hxx b/svl/inc/folderrestriction.hxx new file mode 100644 index 000000000000..f7e683b31ad6 --- /dev/null +++ b/svl/inc/folderrestriction.hxx @@ -0,0 +1,59 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: folderrestriction.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVTOOLS_FOLDER_RESTRICTION_HXX +#define SVTOOLS_FOLDER_RESTRICTION_HXX + +#include "svtools/svldllapi.h" +#include + +#ifndef INCLUDED_VECTOR +#include +#define INCLUDED_VECTOR +#endif + +//........................................................................ +namespace svt +{ +//........................................................................ + + /** retrieves a list of folders which's access is not restricted. + +

Note that this is not meant as security feature, but only as + method to restrict some UI presentation, such as browsing + in the file open dialog.

+ */ + SVL_DLLPUBLIC void getUnrestrictedFolders( ::std::vector< String >& _rFolders ); + +//........................................................................ +} // namespace svt +//........................................................................ + +#endif // SVTOOLS_FOLDER_RESTRICTION_HXX diff --git a/svl/inc/fstathelper.hxx b/svl/inc/fstathelper.hxx new file mode 100644 index 000000000000..b9761d7131a0 --- /dev/null +++ b/svl/inc/fstathelper.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: fstathelper.hxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVTOOLS_FSTATHELPER_HXX +#define _SVTOOLS_FSTATHELPER_HXX + +#include "svtools/svldllapi.h" +#include + +class UniString; +class Date; +class Time; + +namespace FStatHelper { + +/** Return the modified time and date stamp for this URL. + + @param URL the asking URL + + @param pDate if unequal 0, the function set the date stamp + + @param pTime if unequal 0, the function set the time stamp + + @return it was be able to get the date/time stamp +*/ +SVL_DLLPUBLIC sal_Bool GetModifiedDateTimeOfFile( const UniString& rURL, + Date* pDate, Time* pTime ); + +/** Return if under the URL a document exist. This is only a wrapper for the + UCB.IsContent. +*/ +SVL_DLLPUBLIC sal_Bool IsDocument( const UniString& rURL ); + +/** Return if under the URL a folder exist. This is only a wrapper for the + UCB.isFolder. +*/ +SVL_DLLPUBLIC sal_Bool IsFolder( const UniString& rURL ); + +} + +#endif diff --git a/svl/inc/inetdef.hxx b/svl/inc/inetdef.hxx new file mode 100644 index 000000000000..6ea380529147 --- /dev/null +++ b/svl/inc/inetdef.hxx @@ -0,0 +1,32 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: inetdef.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include + diff --git a/svl/inc/inetmsg.hxx b/svl/inc/inetmsg.hxx new file mode 100644 index 000000000000..f011102a79e2 --- /dev/null +++ b/svl/inc/inetmsg.hxx @@ -0,0 +1,32 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: inetmsg.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include + diff --git a/svl/inc/inetstrm.hxx b/svl/inc/inetstrm.hxx new file mode 100644 index 000000000000..46e15d5e4cf4 --- /dev/null +++ b/svl/inc/inetstrm.hxx @@ -0,0 +1,32 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: inetstrm.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include + diff --git a/svl/inc/instrm.hxx b/svl/inc/instrm.hxx new file mode 100644 index 000000000000..58a70fcc6917 --- /dev/null +++ b/svl/inc/instrm.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: instrm.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVTOOLS_INSTRM_HXX +#define SVTOOLS_INSTRM_HXX + +#include "svtools/svldllapi.h" +#include +#include + +namespace com { namespace sun { namespace star { namespace io { + class XInputStream; + class XSeekable; +} } } } + +class SvDataPipe_Impl; + +//============================================================================ +class SVL_DLLPUBLIC SvInputStream: public SvStream +{ + com::sun::star::uno::Reference< com::sun::star::io::XInputStream > + m_xStream; + com::sun::star::uno::Reference< com::sun::star::io::XSeekable > + m_xSeekable; + SvDataPipe_Impl * m_pPipe; + ULONG m_nSeekedFrom; + + SVL_DLLPRIVATE bool open(); + + SVL_DLLPRIVATE virtual ULONG GetData(void * pData, ULONG nSize); + + SVL_DLLPRIVATE virtual ULONG PutData(void const *, ULONG); + + SVL_DLLPRIVATE virtual ULONG SeekPos(ULONG nPos); + + SVL_DLLPRIVATE virtual void FlushData(); + + SVL_DLLPRIVATE virtual void SetSize(ULONG); + +public: + SvInputStream( + com::sun::star::uno::Reference< com::sun::star::io::XInputStream > + const & + rTheStream); + + virtual ~SvInputStream(); + + virtual USHORT IsA() const; + + virtual void AddMark(ULONG nPos); + + virtual void RemoveMark(ULONG nPos); +}; + +#endif // SVTOOLS_INSTRM_HXX + diff --git a/svl/inc/listener.hxx b/svl/inc/listener.hxx new file mode 100644 index 000000000000..6d70f135eb92 --- /dev/null +++ b/svl/inc/listener.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: listener.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVT_LISTENER_HXX +#define _SVT_LISTENER_HXX + +#include "svtools/svldllapi.h" +#include + +class SvtBroadcaster; +class SfxHint; +class SvtListenerBase; + +//------------------------------------------------------------------------- + +class SVL_DLLPUBLIC SvtListener +{ + friend class SvtListenerBase; + SvtListenerBase *pBrdCastLst; + + const SvtListener& operator=(const SvtListener &); // n.i., ist verboten + +public: + TYPEINFO(); + + SvtListener(); + SvtListener( const SvtListener &rCopy ); + virtual ~SvtListener(); + + BOOL StartListening( SvtBroadcaster& rBroadcaster ); + BOOL EndListening( SvtBroadcaster& rBroadcaster ); + void EndListeningAll(); + BOOL IsListening( SvtBroadcaster& rBroadcaster ) const; + + BOOL HasBroadcaster() const { return 0 != pBrdCastLst; } + + virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint ); +}; + + +#endif + diff --git a/svl/inc/listeneriter.hxx b/svl/inc/listeneriter.hxx new file mode 100644 index 000000000000..e531ead6bf5d --- /dev/null +++ b/svl/inc/listeneriter.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: listeneriter.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVT_LISTENERITER_HXX +#define _SVT_LISTENERITER_HXX + +#include "svtools/svldllapi.h" +#include + +class SvtListener; +class SvtListenerBase; +class SvtBroadcaster; + +//------------------------------------------------------------------------- + +class SVL_DLLPUBLIC SvtListenerIter +{ + friend class SvtListenerBase; + + SvtBroadcaster& rRoot; + SvtListenerBase *pAkt, *pDelNext; + + // for the update of all iterator's, if a listener is added or removed + // at the same time. + static SvtListenerIter *pListenerIters; + SvtListenerIter *pNxtIter; + TypeId aSrchId; // fuer First/Next - suche diesen Type + + SVL_DLLPRIVATE static void RemoveListener( SvtListenerBase& rDel, + SvtListenerBase* pNext ); + +public: + SvtListenerIter( SvtBroadcaster& ); + ~SvtListenerIter(); + + const SvtBroadcaster& GetBroadcaster() const { return rRoot; } + SvtBroadcaster& GetBroadcaster() { return rRoot; } + + SvtListener* GoNext(); // to the next + SvtListener* GoPrev(); // to the previous + + SvtListener* GoStart(); // to the start of the list + SvtListener* GoEnd(); // to the end of the list + + SvtListener* GoRoot(); // to the root + SvtListener* GetCurr() const; // returns the current + + int IsChanged() const { return pDelNext != pAkt; } + + SvtListener* First( TypeId nType ); + SvtListener* Next(); +}; + + +#endif + diff --git a/svl/inc/lngmisc.hxx b/svl/inc/lngmisc.hxx new file mode 100644 index 000000000000..6bfe7b1c737c --- /dev/null +++ b/svl/inc/lngmisc.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: lngmisc.hxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVTOOLS_LNGMISC_HXX_ +#define _SVTOOLS_LNGMISC_HXX_ + +#include "svtools/svldllapi.h" +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + +#define SVT_SOFT_HYPHEN ((sal_Unicode) 0x00AD) +#define SVT_HARD_HYPHEN ((sal_Unicode) 0x2011) + +// the non-breaking space +#define SVT_HARD_SPACE ((sal_Unicode) 0x00A0) + +namespace linguistic +{ + +inline BOOL IsHyphen( sal_Unicode cChar ) +{ + return cChar == SVT_SOFT_HYPHEN || cChar == SVT_HARD_HYPHEN; +} + + +inline BOOL IsControlChar( sal_Unicode cChar ) +{ + return cChar < (sal_Unicode) ' '; +} + + +inline BOOL HasHyphens( const rtl::OUString &rTxt ) +{ + return rTxt.indexOf( SVT_SOFT_HYPHEN ) != -1 || + rTxt.indexOf( SVT_HARD_HYPHEN ) != -1; +} + +SVL_DLLPUBLIC INT32 GetNumControlChars( const rtl::OUString &rTxt ); +SVL_DLLPUBLIC BOOL RemoveHyphens( rtl::OUString &rTxt ); +SVL_DLLPUBLIC BOOL RemoveControlChars( rtl::OUString &rTxt ); + +SVL_DLLPUBLIC BOOL ReplaceControlChars( rtl::OUString &rTxt, sal_Char aRplcChar = ' ' ); + +} // namespace linguistic + +#endif diff --git a/svl/inc/makefile.mk b/svl/inc/makefile.mk new file mode 100644 index 000000000000..a9974d75065c --- /dev/null +++ b/svl/inc/makefile.mk @@ -0,0 +1,52 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.4 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* +PRJ=.. + +PRJNAME=svtools +TARGET=inc + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/svt.pmk + +# --- Files -------------------------------------------------------- +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + +.IF "$(ENABLE_PCH)"!="" +ALLTAR : \ + $(SLO)$/precompiled.pch \ + $(SLO)$/precompiled_ex.pch + +.ENDIF # "$(ENABLE_PCH)"!="" + diff --git a/svl/inc/memberid.hrc b/svl/inc/memberid.hrc new file mode 100644 index 000000000000..c917bd993e97 --- /dev/null +++ b/svl/inc/memberid.hrc @@ -0,0 +1,47 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: memberid.hrc,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _MEMBERID_HRC +#define _MEMBERID_HRC + +#define SFX_MEMBERID(nUserData) ( ( (nUserData) >> 20 ) & 0xFF ) +#define SFX_SLOTID(nUserData) ( (nUserData) & 0xFFFF ) + +#define MID_X 1 +#define MID_Y 2 +#define MID_RECT_LEFT 3 +#define MID_RECT_TOP 4 +#define MID_WIDTH 5 +#define MID_HEIGHT 6 +#define MID_RECT_RIGHT 7 + + +#endif + diff --git a/svl/inc/misccfg.hxx b/svl/inc/misccfg.hxx new file mode 100644 index 000000000000..3f897e1cecc3 --- /dev/null +++ b/svl/inc/misccfg.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: misccfg.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFX_MISCCFG_HXX +#define _SFX_MISCCFG_HXX + +#include "svtools/svtdllapi.h" +#include "tools/solar.h" +#include "unotools/configitem.hxx" + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +class SVT_DLLPUBLIC SfxMiscCfg : public utl::ConfigItem +{ + BOOL bPaperSize; // printer warnings + BOOL bPaperOrientation; + BOOL bNotFound; + sal_Int32 nYear2000; // two digit year representation + + const com::sun::star::uno::Sequence& GetPropertyNames(); + void Load(); + +public: + SfxMiscCfg( ); + ~SfxMiscCfg( ); + + virtual void Notify( const com::sun::star::uno::Sequence& aPropertyNames); + virtual void Commit(); + + BOOL IsNotFoundWarning() const {return bNotFound;} + void SetNotFoundWarning( BOOL bSet); + + BOOL IsPaperSizeWarning() const {return bPaperSize;} + void SetPaperSizeWarning(BOOL bSet); + + BOOL IsPaperOrientationWarning() const {return bPaperOrientation;} + void SetPaperOrientationWarning( BOOL bSet); + + // 0 ... 99 + sal_Int32 GetYear2000() const { return nYear2000; } + void SetYear2000( sal_Int32 nSet ); + +}; + +#endif // _MISCCFG_HXX + + diff --git a/svl/inc/nfsymbol.hxx b/svl/inc/nfsymbol.hxx new file mode 100644 index 000000000000..46fe47599359 --- /dev/null +++ b/svl/inc/nfsymbol.hxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: nfsymbol.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_SVTOOLS_NFSYMBOL_HXX +#define INCLUDED_SVTOOLS_NFSYMBOL_HXX + +/* ATTENTION! If new types arrive that had its content previously handled as + * SYMBOLTYPE_STRING, they have to be added at several places in zforscan.cxx + * and/or zformat.cxx, and in xmloff/source/style/xmlnumfe.cxx. Mostly these + * are places where already NF_SYMBOLTYPE_STRING together with + * NF_SYMBOLTYPE_CURRENCY or NF_SYMBOLTYPE_DATESEP are used in the same case of + * a switch respectively an if-condition. + */ + +namespace svt { + +/// Number formatter's symbol types of a token, if not key words, which are >0 +enum NfSymbolType +{ + NF_SYMBOLTYPE_STRING = -1, // literal string in output + NF_SYMBOLTYPE_DEL = -2, // special character + NF_SYMBOLTYPE_BLANK = -3, // blank for '_' + NF_SYMBOLTYPE_STAR = -4, // *-character + NF_SYMBOLTYPE_DIGIT = -5, // digit place holder + NF_SYMBOLTYPE_DECSEP = -6, // decimal separator + NF_SYMBOLTYPE_THSEP = -7, // group AKA thousand separator + NF_SYMBOLTYPE_EXP = -8, // exponent E + NF_SYMBOLTYPE_FRAC = -9, // fraction / + NF_SYMBOLTYPE_EMPTY = -10, // deleted symbols + NF_SYMBOLTYPE_FRACBLANK = -11, // delimiter between integer and fraction + NF_SYMBOLTYPE_COMMENT = -12, // comment is following + NF_SYMBOLTYPE_CURRENCY = -13, // currency symbol + NF_SYMBOLTYPE_CURRDEL = -14, // currency symbol delimiter [$] + NF_SYMBOLTYPE_CURREXT = -15, // currency symbol extension -xxx + NF_SYMBOLTYPE_CALENDAR = -16, // calendar ID + NF_SYMBOLTYPE_CALDEL = -17, // calendar delimiter [~] + NF_SYMBOLTYPE_DATESEP = -18, // date separator + NF_SYMBOLTYPE_TIMESEP = -19, // time separator + NF_SYMBOLTYPE_TIME100SECSEP = -20, // time 100th seconds separator + NF_SYMBOLTYPE_PERCENT = -21 // percent % +}; + +} // namespace svt + +#endif // INCLUDED_SVTOOLS_NFSYMBOL_HXX diff --git a/svl/inc/numuno.hxx b/svl/inc/numuno.hxx new file mode 100644 index 000000000000..c31829dec020 --- /dev/null +++ b/svl/inc/numuno.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: numuno.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _NUMUNO_HXX +#define _NUMUNO_HXX + +#include "svtools/svtdllapi.h" +#include +#include +#include + +class SvNumberFormatter; +class SvNumFmtSuppl_Impl; + +namespace comphelper +{ + class SharedMutex; +} + +//------------------------------------------------------------------ + +// SvNumberFormatterServiceObj must be registered as service somewhere + +com::sun::star::uno::Reference SAL_CALL + SvNumberFormatterServiceObj_NewInstance( + const com::sun::star::uno::Reference< + com::sun::star::lang::XMultiServiceFactory>& rSMgr ); + +//------------------------------------------------------------------ + +// SvNumberFormatsSupplierObj: aggregate to document, +// construct with SvNumberFormatter + +class SVT_DLLPUBLIC SvNumberFormatsSupplierObj : public cppu::WeakAggImplHelper2< + com::sun::star::util::XNumberFormatsSupplier, + com::sun::star::lang::XUnoTunnel> +{ +private: + SvNumFmtSuppl_Impl* pImpl; + +public: + SvNumberFormatsSupplierObj(); + SvNumberFormatsSupplierObj(SvNumberFormatter* pForm); + virtual ~SvNumberFormatsSupplierObj(); + + void SetNumberFormatter(SvNumberFormatter* pNew); + SvNumberFormatter* GetNumberFormatter() const; + + // ueberladen, um Attribute im Dokument anzupassen + virtual void NumberFormatDeleted(sal_uInt32 nKey); + // ueberladen, um evtl. neu zu formatieren + virtual void SettingsChanged(); + + // XNumberFormatsSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL + getNumberFormatSettings() + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats > SAL_CALL + getNumberFormats() + throw(::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< + sal_Int8 >& aIdentifier ) + throw(::com::sun::star::uno::RuntimeException); + + static const com::sun::star::uno::Sequence& getUnoTunnelId(); + static SvNumberFormatsSupplierObj* getImplementation( const com::sun::star::uno::Reference< + com::sun::star::util::XNumberFormatsSupplier> xObj ); + + ::comphelper::SharedMutex& getSharedMutex() const; +}; + +#endif // #ifndef _NUMUNO_HXX + + diff --git a/svl/inc/outstrm.hxx b/svl/inc/outstrm.hxx new file mode 100644 index 000000000000..e11c7ed1c1a9 --- /dev/null +++ b/svl/inc/outstrm.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: outstrm.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVTOOLS_OUTSTRM_HXX +#define SVTOOLS_OUTSTRM_HXX + +#include "svtools/svldllapi.h" +#include +#include + +namespace com { namespace sun { namespace star { namespace io { + class XOutputStream; +} } } } + +//============================================================================ +class SVL_DLLPUBLIC SvOutputStream: public SvStream +{ + com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > + m_xStream; + + SVL_DLLPRIVATE virtual ULONG GetData(void *, ULONG); + + SVL_DLLPRIVATE virtual ULONG PutData(void const * pData, ULONG nSize); + + SVL_DLLPRIVATE virtual ULONG SeekPos(ULONG); + + SVL_DLLPRIVATE virtual void FlushData(); + + SVL_DLLPRIVATE virtual void SetSize(ULONG); + +public: + SvOutputStream(com::sun::star::uno::Reference< + com::sun::star::io::XOutputStream > const & + rTheStream); + + virtual ~SvOutputStream(); + + virtual USHORT IsA() const; +}; + +#endif // SVTOOLS_OUTSTRM_HXX + diff --git a/svl/inc/pch/precompiled_svtools.cxx b/svl/inc/pch/precompiled_svtools.cxx new file mode 100644 index 000000000000..2346d52b68af --- /dev/null +++ b/svl/inc/pch/precompiled_svtools.cxx @@ -0,0 +1,32 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: precompiled_svtools.cxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_svtools.hxx" + diff --git a/svl/inc/pch/precompiled_svtools.hxx b/svl/inc/pch/precompiled_svtools.hxx new file mode 100644 index 000000000000..cab81cac04ec --- /dev/null +++ b/svl/inc/pch/precompiled_svtools.hxx @@ -0,0 +1,440 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: precompiled_svtools.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): Generated on 2006-09-01 17:50:05.076676 + +#ifdef PRECOMPILED_HEADERS + +//---MARKER--- +#include "sal/config.h" +#include "sal/types.h" + +#include "com/sun/star/accessibility/AccessibleEventId.hpp" +#include "com/sun/star/accessibility/AccessibleRelationType.hpp" +#include "com/sun/star/accessibility/AccessibleRole.hpp" +#include "com/sun/star/accessibility/AccessibleStateType.hpp" +#include "com/sun/star/accessibility/AccessibleTextType.hpp" +#include "com/sun/star/accessibility/XAccessible.hpp" +#include "com/sun/star/accessibility/XAccessibleContext.hpp" +#include "com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "com/sun/star/awt/FontWeight.hpp" +#include "com/sun/star/beans/XPropertySet.hpp" +#include "com/sun/star/beans/XPropertySetInfo.hpp" +#include "com/sun/star/io/XAsyncOutputMonitor.hpp" +#include "com/sun/star/lang/EventObject.hpp" +#include "com/sun/star/lang/Locale.hpp" +#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" +#include "com/sun/star/lang/XComponent.hpp" +#include "com/sun/star/lang/XMultiComponentFactory.hpp" +#include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "com/sun/star/ucb/Command.hpp" +#include "com/sun/star/ucb/CommandAbortedException.hpp" +#include "com/sun/star/ucb/IllegalIdentifierException.hpp" +#include "com/sun/star/ucb/UnsupportedCommandException.hpp" +#include "com/sun/star/ucb/XCommandEnvironment.hpp" +#include "com/sun/star/ucb/XCommandProcessor.hpp" +#include "com/sun/star/ucb/XContent.hpp" +#include "com/sun/star/ucb/XContentIdentifier.hpp" +#include "com/sun/star/ucb/XContentIdentifierFactory.hpp" +#include "com/sun/star/ucb/XContentProvider.hpp" +#include "com/sun/star/ucb/XContentProviderManager.hpp" +#include "com/sun/star/ui/dialogs/XFilePicker.hpp" +#include "com/sun/star/ui/dialogs/XFolderPicker.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uri/XUriReference.hpp" +#include "com/sun/star/uri/XUriReferenceFactory.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + + +#include +#include + +#include "comphelper/processfactory.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cppuhelper/bootstrap.hxx" +#include "cppuhelper/exc_hlp.hxx" +#include "cppuhelper/factory.hxx" +#include "cppuhelper/interfacecontainer.hxx" +#include "cppuhelper/weakref.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "rtl/crc.h" +#include "rtl/memory.h" +#include "rtl/strbuf.hxx" +#include "rtl/string.h" +#include "rtl/string.hxx" +#include "rtl/textenc.h" +#include "rtl/ustrbuf.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "unotools/configitem.hxx" +#include "unotools/configmgr.hxx" + +#include + +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +//---MARKER--- + +#endif + diff --git a/svl/inc/pickerhelper.hxx b/svl/inc/pickerhelper.hxx new file mode 100644 index 000000000000..4be84296c678 --- /dev/null +++ b/svl/inc/pickerhelper.hxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: pickerhelper.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _PICKERHELPER_HXX +#define _PICKERHELPER_HXX + +#include "svtools/svldllapi.h" +#include "sal/types.h" +#include "com/sun/star/uno/Reference.hxx" + +namespace com +{ + namespace sun + { + namespace star + { + namespace ui + { + namespace dialogs + { + class XFilePicker; + class XFolderPicker; + } + } + } + } +} + + +namespace svt +{ + + SVL_DLLPUBLIC void SetDialogHelpId( + ::com::sun::star::uno::Reference < ::com::sun::star::ui::dialogs::XFilePicker > _mxFileDlg, + sal_Int32 _nHelpId ); + + SVL_DLLPUBLIC void SetDialogHelpId( + ::com::sun::star::uno::Reference < ::com::sun::star::ui::dialogs::XFolderPicker > _mxFileDlg, + sal_Int32 _nHelpId ); + +} + +//----------------------------------------------------------------------------- + +#endif diff --git a/svl/inc/pickerhistory.hxx b/svl/inc/pickerhistory.hxx new file mode 100644 index 000000000000..f99ad5dcc0f1 --- /dev/null +++ b/svl/inc/pickerhistory.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: pickerhistory.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVTOOLS_PICKERHISTORY_HXX +#define SVTOOLS_PICKERHISTORY_HXX + +#include "svtools/svldllapi.h" +#include + +//......................................................................... +namespace svt +{ +//......................................................................... + + // -------------------------------------------------------------------- + SVL_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > + GetTopMostFolderPicker( ); + + SVL_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > + GetTopMostFilePicker( ); + +//......................................................................... +} // namespace svt +//......................................................................... + +#endif // SVTOOLS_PICKERHISTORY_HXX + diff --git a/svl/inc/pickerhistoryaccess.hxx b/svl/inc/pickerhistoryaccess.hxx new file mode 100644 index 000000000000..983b0c416ef3 --- /dev/null +++ b/svl/inc/pickerhistoryaccess.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: pickerhistoryaccess.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVTOOLS_PICKERHISTORYACCESS_HXX +#define SVTOOLS_PICKERHISTORYACCESS_HXX + +#include "svtools/svldllapi.h" + +#ifndef _COM_SUN_STAR_UNO_REFERENX_HXX_ +#include +#endif + +//......................................................................... +namespace svt +{ +//......................................................................... + + // -------------------------------------------------------------------- + SVL_DLLPUBLIC void addFolderPicker( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxPicker ); + + SVL_DLLPUBLIC void addFilePicker( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxPicker ); + +//......................................................................... +} // namespace svt +//......................................................................... + +#endif // SVTOOLS_PICKERHISTORYACCESS_HXX + diff --git a/svl/inc/poolcach.hxx b/svl/inc/poolcach.hxx new file mode 100644 index 000000000000..20d9e4d19c43 --- /dev/null +++ b/svl/inc/poolcach.hxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: poolcach.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFXPOOLCACH_HXX +#define _SFXPOOLCACH_HXX + +#include "svtools/svtdllapi.h" +#include + +class SfxItemModifyArr_Impl; +class SfxItemPool; +class SfxItemSet; +class SfxPoolItem; +class SfxSetItem; + +class SVT_DLLPUBLIC SfxItemPoolCache +{ + SfxItemPool *pPool; + SfxItemModifyArr_Impl *pCache; + const SfxItemSet *pSetToPut; + const SfxPoolItem *pItemToPut; + +public: + SfxItemPoolCache( SfxItemPool *pPool, + const SfxPoolItem *pPutItem ); + SfxItemPoolCache( SfxItemPool *pPool, + const SfxItemSet *pPutSet ); + ~SfxItemPoolCache(); + + const SfxSetItem& ApplyTo( const SfxSetItem& rSetItem, BOOL bNew = FALSE ); +}; + + +#endif + diff --git a/svl/inc/strmadpt.hxx b/svl/inc/strmadpt.hxx new file mode 100644 index 000000000000..7a080c1c7bcc --- /dev/null +++ b/svl/inc/strmadpt.hxx @@ -0,0 +1,138 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: strmadpt.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVTOOLS_STRMADPT_HXX +#define SVTOOLS_STRMADPT_HXX + +#include "svtools/svldllapi.h" +#include +#include +#include +#include +#include + +//============================================================================ +class SVL_DLLPUBLIC SvOutputStreamOpenLockBytes: public SvOpenLockBytes +{ + com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > + m_xOutputStream; + sal_uInt32 m_nPosition; + +public: + TYPEINFO(); + + SvOutputStreamOpenLockBytes( + const com::sun::star::uno::Reference< + com::sun::star::io::XOutputStream > & + rTheOutputStream): + m_xOutputStream(rTheOutputStream), m_nPosition(0) {} + + virtual ErrCode ReadAt(ULONG, void *, ULONG, ULONG *) const; + + virtual ErrCode WriteAt(ULONG nPos, const void * pBuffer, ULONG nCount, + ULONG * pWritten); + + virtual ErrCode Flush() const; + + virtual ErrCode SetSize(ULONG); + + virtual ErrCode Stat(SvLockBytesStat * pStat, SvLockBytesStatFlag) const; + + virtual ErrCode FillAppend(const void * pBuffer, ULONG nCount, + ULONG * pWritten); + + virtual ULONG Tell() const; + + virtual ULONG Seek(ULONG); + + virtual void Terminate(); +}; + +//============================================================================ +class SVL_DLLPUBLIC SvLockBytesInputStream: public cppu::OWeakObject, + public com::sun::star::io::XInputStream, + public com::sun::star::io::XSeekable +{ + SvLockBytesRef m_xLockBytes; + sal_Int64 m_nPosition; + bool m_bDone; + +public: + SvLockBytesInputStream(SvLockBytes * pTheLockBytes): + m_xLockBytes(pTheLockBytes), m_nPosition(0), m_bDone(false) {} + + virtual com::sun::star::uno::Any SAL_CALL + queryInterface(const com::sun::star::uno::Type & rType) + throw (com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL acquire() throw(); + + virtual void SAL_CALL release() throw(); + + virtual sal_Int32 SAL_CALL + readBytes(com::sun::star::uno::Sequence< sal_Int8 > & rData, + sal_Int32 nBytesToRead) + throw (com::sun::star::io::IOException, + com::sun::star::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL + readSomeBytes(com::sun::star::uno::Sequence< sal_Int8 > & rData, + sal_Int32 nMaxBytesToRead) + throw (com::sun::star::io::IOException, + com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) + throw (com::sun::star::io::IOException, + com::sun::star::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL available() + throw (com::sun::star::io::IOException, + com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL closeInput() + throw (com::sun::star::io::IOException, + com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL seek(sal_Int64 nLocation) + throw (com::sun::star::lang::IllegalArgumentException, + com::sun::star::io::IOException, + com::sun::star::uno::RuntimeException); + + virtual sal_Int64 SAL_CALL getPosition() + throw (com::sun::star::io::IOException, + com::sun::star::uno::RuntimeException); + + virtual sal_Int64 SAL_CALL getLength() + throw (com::sun::star::io::IOException, + com::sun::star::uno::RuntimeException); +}; + +#endif // SVTOOLS_STRMADPT_HXX + diff --git a/svl/inc/stylepool.hxx b/svl/inc/stylepool.hxx new file mode 100644 index 000000000000..1b1f129d7f4c --- /dev/null +++ b/svl/inc/stylepool.hxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: stylepool.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_SVTOOLS_STYLEPOOL_HXX +#define INCLUDED_SVTOOLS_STYLEPOOL_HXX + +#include +#include +#include + +class StylePoolImpl; +class StylePoolIterImpl; +class IStylePoolIteratorAccess; + +class SVL_DLLPUBLIC StylePool +{ +private: + StylePoolImpl *pImpl; +public: + typedef boost::shared_ptr SfxItemSet_Pointer_t; + + // --> OD 2008-03-07 #i86923# + explicit StylePool( SfxItemSet* pIgnorableItems = 0 ); + // <-- + + /** Insert a SfxItemSet into the style pool. + + The pool makes a copy of the provided SfxItemSet. + + @param SfxItemSet + the SfxItemSet to insert + + @return a shared pointer to the SfxItemSet + */ + virtual SfxItemSet_Pointer_t insertItemSet( const SfxItemSet& rSet ); + + /** Create an iterator + + The iterator walks through the StylePool + OD 2008-03-07 #i86923# + introduce optional parameter to control, if unused SfxItemsSet are skipped or not + introduce optional parameter to control, if ignorable items are skipped or not + + @attention every change, e.g. destruction, of the StylePool could cause undefined effects. + + @param bSkipUnusedItemSets + input parameter - boolean, indicating if unused SfxItemSets are skipped or not + + @param bSkipIgnorableItems + input parameter - boolean, indicating if ignorable items are skipped or not + + @postcond the iterator "points before the first" SfxItemSet of the pool. + The first StylePoolIterator::getNext() call will deliver the first SfxItemSet. + */ + virtual IStylePoolIteratorAccess* createIterator( const bool bSkipUnusedItemSets = false, + const bool bSkipIgnorableItems = false ); + + /** Returns the number of styles + */ + virtual sal_Int32 getCount() const; + + virtual ~StylePool(); + + static ::rtl::OUString nameOf( SfxItemSet_Pointer_t pSet ); +}; + +class SVL_DLLPUBLIC IStylePoolIteratorAccess +{ +public: + /** Delivers a shared pointer to the next SfxItemSet of the pool + If there is no more SfxItemSet, the delivered share_pointer is empty. + */ + virtual StylePool::SfxItemSet_Pointer_t getNext() = 0; + virtual ::rtl::OUString getName() = 0; + virtual ~IStylePoolIteratorAccess() {}; +}; +#endif diff --git a/svl/inc/svl/aeitem.hxx b/svl/inc/svl/aeitem.hxx new file mode 100644 index 000000000000..5cfd3d0fc15e --- /dev/null +++ b/svl/inc/svl/aeitem.hxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: aeitem.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _AEITEM_HXX +#define _AEITEM_HXX + +#include "svtools/svtdllapi.h" +#include +#include + +class SfxAllEnumValueArr; +class SvUShorts; + +class SVT_DLLPUBLIC SfxAllEnumItem: public SfxEnumItem +{ + SfxAllEnumValueArr* pValues; + SvUShorts* pDisabledValues; + +protected: + USHORT _GetPosByValue( USHORT nValue ) const; + +public: + TYPEINFO(); + SfxAllEnumItem(); + SfxAllEnumItem( USHORT nWhich); + SfxAllEnumItem( USHORT nWhich, USHORT nVal ); + SfxAllEnumItem( USHORT nWhich, USHORT nVal, const XubString &rText ); + SfxAllEnumItem( USHORT nWhich, SvStream &rStream ); + SfxAllEnumItem( const SfxAllEnumItem & ); + ~SfxAllEnumItem(); + + void InsertValue( USHORT nValue ); + void InsertValue( USHORT nValue, const XubString &rText ); + void RemoveValue( USHORT nValue ); + void RemoveAllValues(); + + USHORT GetPosByValue( USHORT nValue ) const; + + virtual USHORT GetValueCount() const; + virtual USHORT GetValueByPos( USHORT nPos ) const; + virtual XubString GetValueTextByPos( USHORT nPos ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, USHORT nVersion) const; + virtual BOOL IsEnabled( USHORT ) const; + void DisableValue( USHORT ); +}; + +#endif diff --git a/svl/inc/svl/bintitem.hxx b/svl/inc/svl/bintitem.hxx new file mode 100644 index 000000000000..83119d9f3b18 --- /dev/null +++ b/svl/inc/svl/bintitem.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: bintitem.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _BINTITEM_HXX +#define _BINTITEM_HXX + +#include +#include +#include +#include + +#include + +class SfxArguments; +class SvStream; + +DBG_NAMEEX(SfxBigIntItem) + +class SfxBigIntItem: public SfxPoolItem +{ + BigInt aVal; + +public: + TYPEINFO(); + SfxBigIntItem(); + SfxBigIntItem(USHORT nWhich, const BigInt& rValue); + SfxBigIntItem(USHORT nWhich, SvStream &); + SfxBigIntItem(const SfxBigIntItem&); + ~SfxBigIntItem() { DBG_DTOR(SfxBigIntItem, 0); } + + virtual SfxItemPresentation GetPresentation( + SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + XubString &rText, + const IntlWrapper * = 0 ) const; + + virtual int operator==(const SfxPoolItem&) const; + using SfxPoolItem::Compare; + virtual int Compare(const SfxPoolItem &rWith) const; + virtual SfxPoolItem* Clone(SfxItemPool *pPool = 0) const; + virtual SfxPoolItem* Create(SvStream &, USHORT nVersion) const; + virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; + + virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ); + virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ) const; + + virtual SfxFieldUnit GetUnit() const; // FUNIT_NONE + + const BigInt& GetValue() const { return aVal; } + void SetValue(const BigInt& rNewVal) + { + DBG_ASSERT(GetRefCount() == 0, "SetValue() with pooled item"); + aVal = rNewVal; + } +}; + +#endif /* _BINTITEM_HXX */ + diff --git a/svl/inc/svl/brdcst.hxx b/svl/inc/svl/brdcst.hxx new file mode 100644 index 000000000000..2f9270f3cd4b --- /dev/null +++ b/svl/inc/svl/brdcst.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: brdcst.hxx,v $ + * $Revision: 1.3.60.2 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFXBRDCST_HXX +#define _SFXBRDCST_HXX + +#include "svtools/svldllapi.h" +#include +#include + +class SfxListener; +class SfxHint; + +#ifndef _SFX_BRDCST_CXX +typedef SvPtrarr SfxListenerArr_Impl; +#endif + +//------------------------------------------------------------------------- + +class SVL_DLLPUBLIC SfxBroadcaster +{ +friend class SfxListener; + + SfxListenerArr_Impl aListeners; + +private: + BOOL AddListener( SfxListener& rListener ); + void RemoveListener( SfxListener& rListener ); + const SfxBroadcaster& operator=(const SfxBroadcaster &); // verboten + +protected: + void Forward(SfxBroadcaster& rBC, const SfxHint& rHint); + virtual void ListenersGone(); + +public: + TYPEINFO(); + + SfxBroadcaster(); + SfxBroadcaster( const SfxBroadcaster &rBC ); + virtual ~SfxBroadcaster(); + + void Broadcast( const SfxHint &rHint ); + void BroadcastDelayed( const SfxHint& rHint ); + void BroadcastInIdle( const SfxHint& rHint ); + + BOOL HasListeners() const; + USHORT GetListenerCount() const { return aListeners.Count(); } + SfxListener* GetListener( USHORT nNo ) const + { return (SfxListener*) aListeners[nNo]; } +}; + +#endif diff --git a/svl/inc/svl/cancel.hxx b/svl/inc/svl/cancel.hxx new file mode 100644 index 000000000000..5929fc4db47a --- /dev/null +++ b/svl/inc/svl/cancel.hxx @@ -0,0 +1,145 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: cancel.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFXCANCEL_HXX +#define _SFXCANCEL_HXX + +#include "svtools/svldllapi.h" +#include +#include +#include +#include + +class SfxCancellable; + +#ifdef _SFX_CANCEL_CXX +#include + +SV_DECL_PTRARR( SfxCancellables_Impl, SfxCancellable*, 0, 4 ) + +#else + +typedef SvPtrarr SfxCancellables_Impl; + +#endif + +//------------------------------------------------------------------------- + +class SVL_DLLPUBLIC SfxCancelManager: public SfxBroadcaster +, public SvWeakBase + +/* [Beschreibung] + + An Instanzen dieser Klasse k"onnen nebenl"aufige Prozesse angemeldet + werden, um vom Benutzer abbrechbar zu sein. Werden abbrechbare + Prozesse (Instanzen von ) an- oder abgemeldet, wird + dies durch einen mit dem Flag SFX_HINT_CANCELLABLE + gebroadcastet. + + SfxCancelManager k"onnen hierarchisch angeordnet werden, so k"onnen + z.B. Dokument-lokale Prozesse getrennt gecancelt werden. + + [Beispiel] + + SfxCancelManager *pMgr = new SfxCancelManager; + StartListening( pMgr ); + pMailSystem->SetCancelManager( pMgr ) +*/ + +{ + SfxCancelManager* _pParent; + SfxCancellables_Impl _aJobs; + +public: + SfxCancelManager( SfxCancelManager *pParent = 0 ); + ~SfxCancelManager(); + + BOOL CanCancel() const; + void Cancel( BOOL bDeep ); + SfxCancelManager* GetParent() const { return _pParent; } + + void InsertCancellable( SfxCancellable *pJob ); + void RemoveCancellable( SfxCancellable *pJob ); + USHORT GetCancellableCount() const + { return _aJobs.Count(); } + SfxCancellable* GetCancellable( USHORT nPos ) const + { return (SfxCancellable*) _aJobs[nPos]; } +}; + +SV_DECL_WEAK( SfxCancelManager ) +//------------------------------------------------------------------------- + +class SVL_DLLPUBLIC SfxCancellable + +/* [Beschreibung] + + Instanzen dieser Klasse werden immer an einem Cancel-Manager angemeldet, + der dadurch dem Benutzer signalisieren kann, ob abbrechbare Prozesse + vorhanden sind und der die SfxCancellable-Instanzen auf 'abgebrochen' + setzen kann. + + Die im Ctor "ubergebene -Instanz mu\s die Instanz + dieser Klasse "uberleben! + + [Beispiel] + + { + SfxCancellable aCancel( pCancelMgr ); + while ( !aCancel && GetData() ) + Reschedule(); + } + +*/ + +{ + SfxCancelManager* _pMgr; + BOOL _bCancelled; + String _aTitle; + +public: + SfxCancellable( SfxCancelManager *pMgr, + const String &rTitle ) + : _pMgr( pMgr ), + _bCancelled( FALSE ), + _aTitle( rTitle ) + { pMgr->InsertCancellable( this ); } + + virtual ~SfxCancellable(); + + void SetManager( SfxCancelManager *pMgr ); + SfxCancelManager* GetManager() const { return _pMgr; } + + virtual void Cancel(); + BOOL IsCancelled() const { return _bCancelled; } + operator BOOL() const { return _bCancelled; } + const String& GetTitle() const { return _aTitle; } +}; + +#endif + diff --git a/svl/inc/svl/cenumitm.hxx b/svl/inc/svl/cenumitm.hxx new file mode 100644 index 000000000000..d65825849869 --- /dev/null +++ b/svl/inc/svl/cenumitm.hxx @@ -0,0 +1,180 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: cenumitm.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVTOOLS_CENUMITM_HXX +#define _SVTOOLS_CENUMITM_HXX + +#include "svtools/svldllapi.h" +#include +#include + +//============================================================================ +DBG_NAMEEX(SfxEnumItemInterface) + +class SVL_DLLPUBLIC SfxEnumItemInterface: public SfxPoolItem +{ +protected: + SfxEnumItemInterface(USHORT which): SfxPoolItem(which) {} + + SfxEnumItemInterface(const SfxEnumItemInterface & rItem): + SfxPoolItem(rItem) {} + +public: + TYPEINFO(); + + virtual int operator ==(const SfxPoolItem & rItem) const; + + virtual SfxItemPresentation GetPresentation(SfxItemPresentation, + SfxMapUnit, SfxMapUnit, + XubString & rText, + const IntlWrapper * = 0) + const; + + virtual BOOL QueryValue(com::sun::star::uno::Any & rVal, BYTE = 0) const; + + virtual BOOL PutValue(const com::sun::star::uno::Any & rVal, BYTE = 0); + + virtual USHORT GetValueCount() const = 0; + + virtual XubString GetValueTextByPos(USHORT nPos) const; + + virtual USHORT GetValueByPos(USHORT nPos) const; + + /// Return the position of some value within this enumeration. + /// + /// @descr This method is implemented using GetValueCount() and + /// GetValueByPos(). Derived classes may replace this with a more + /// efficient implementation. + /// + /// @param nValue Some value. + /// + /// @return The position of nValue within this enumeration, or USHRT_MAX + /// if not included. + virtual USHORT GetPosByValue(USHORT nValue) const; + + virtual BOOL IsEnabled(USHORT nValue) const; + + virtual USHORT GetEnumValue() const = 0; + + virtual void SetEnumValue(USHORT nValue) = 0; + + virtual int HasBoolValue() const; + + virtual BOOL GetBoolValue() const; + + virtual void SetBoolValue(BOOL bValue); +}; + +//============================================================================ +DBG_NAMEEX(CntEnumItem) + +class SVL_DLLPUBLIC CntEnumItem: public SfxEnumItemInterface +{ + USHORT m_nValue; + +protected: + CntEnumItem(USHORT which = 0, USHORT nTheValue = 0): + SfxEnumItemInterface(which), m_nValue(nTheValue) {} + + CntEnumItem(USHORT which, SvStream & rStream); + + CntEnumItem(const CntEnumItem & rItem): + SfxEnumItemInterface(rItem), m_nValue(rItem.m_nValue) {} + +public: + TYPEINFO(); + + virtual SvStream & Store(SvStream & rStream, USHORT) const; + + virtual USHORT GetEnumValue() const; + + virtual void SetEnumValue(USHORT nTheValue); + + USHORT GetValue() const { return m_nValue; } + + inline void SetValue(USHORT nTheValue); +}; + +inline void CntEnumItem::SetValue(USHORT nTheValue) +{ + DBG_ASSERT(GetRefCount() == 0, "CntEnumItem::SetValue(): Pooled item"); + m_nValue = nTheValue; +} + +//============================================================================ +DBG_NAMEEX(CntBoolItem) + +class SVL_DLLPUBLIC CntBoolItem: public SfxPoolItem +{ + BOOL m_bValue; + +public: + TYPEINFO(); + + CntBoolItem(USHORT which = 0, BOOL bTheValue = FALSE): + SfxPoolItem(which), m_bValue(bTheValue) {} + + CntBoolItem(USHORT nWhich, SvStream & rStream); + + CntBoolItem(const CntBoolItem & rItem): + SfxPoolItem(rItem), m_bValue(rItem.m_bValue) {} + + virtual int operator ==(const SfxPoolItem & rItem) const; + + using SfxPoolItem::Compare; + virtual int Compare(const SfxPoolItem & rWith) const; + + virtual SfxItemPresentation GetPresentation(SfxItemPresentation, + SfxMapUnit, SfxMapUnit, + UniString & rText, + const IntlWrapper * = 0) + const; + + virtual BOOL QueryValue(com::sun::star::uno::Any& rVal, BYTE = 0) const; + + virtual BOOL PutValue(const com::sun::star::uno::Any& rVal, BYTE = 0); + + virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const; + + virtual SvStream & Store(SvStream & rStream, USHORT) const; + + virtual SfxPoolItem * Clone(SfxItemPool * = 0) const; + + virtual USHORT GetValueCount() const; + + virtual UniString GetValueTextByVal(BOOL bTheValue) const; + + BOOL GetValue() const { return m_bValue; } + + void SetValue(BOOL bTheValue) { m_bValue = bTheValue; } +}; + +#endif // _SVTOOLS_CENUMITM_HXX + diff --git a/svl/inc/svl/cintitem.hxx b/svl/inc/svl/cintitem.hxx new file mode 100644 index 000000000000..a944e2139818 --- /dev/null +++ b/svl/inc/svl/cintitem.hxx @@ -0,0 +1,286 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: cintitem.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVTOOLS_CINTITEM_HXX +#define _SVTOOLS_CINTITEM_HXX + +#include "svtools/svldllapi.h" +#include +#include + +//============================================================================ +DBG_NAMEEX_VISIBILITY(CntByteItem, SVL_DLLPUBLIC) + +class SVL_DLLPUBLIC CntByteItem: public SfxPoolItem +{ + BYTE m_nValue; + +public: + TYPEINFO(); + + CntByteItem(USHORT which = 0, BYTE nTheValue = 0): + SfxPoolItem(which), m_nValue(nTheValue) { DBG_CTOR(CntByteItem, 0); } + + CntByteItem(USHORT which, SvStream & rStream); + + CntByteItem(const CntByteItem & rItem): + SfxPoolItem(rItem), m_nValue(rItem.m_nValue) + { DBG_CTOR(CntByteItem, 0); } + + virtual ~CntByteItem() { DBG_DTOR(CntByteItem, 0); } + + virtual int operator ==(const SfxPoolItem & rItem) const; + + using SfxPoolItem::Compare; + virtual int Compare(const SfxPoolItem & rWith) const; + + virtual SfxItemPresentation GetPresentation(SfxItemPresentation, + SfxMapUnit, SfxMapUnit, + XubString & rText, + const IntlWrapper * = 0) + const; + + virtual BOOL QueryValue(com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0) const; + + virtual BOOL PutValue(const com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0); + + virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const; + + virtual SvStream & Store(SvStream & rStream, USHORT) const; + + virtual SfxPoolItem * Clone(SfxItemPool * = 0) const; + + virtual BYTE GetMin() const; + + virtual BYTE GetMax() const; + + virtual SfxFieldUnit GetUnit() const; + + BYTE GetValue() const { return m_nValue; } + + inline void SetValue(BYTE nTheValue); +}; + +inline void CntByteItem::SetValue(BYTE nTheValue) +{ + DBG_ASSERT(GetRefCount() == 0, "CntByteItem::SetValue(): Pooled item"); + m_nValue = nTheValue; +} + +//============================================================================ +DBG_NAMEEX_VISIBILITY(CntUInt16Item, SVL_DLLPUBLIC) + +class SVL_DLLPUBLIC CntUInt16Item: public SfxPoolItem +{ + UINT16 m_nValue; + +public: + TYPEINFO(); + + CntUInt16Item(USHORT which = 0, UINT16 nTheValue = 0): + SfxPoolItem(which), m_nValue(nTheValue) + { DBG_CTOR(CntUInt16Item, 0); } + + CntUInt16Item(USHORT which, SvStream & rStream); + + CntUInt16Item(const CntUInt16Item & rItem): + SfxPoolItem(rItem), m_nValue(rItem.m_nValue) + { DBG_CTOR(CntUInt16Item, 0); } + + virtual ~CntUInt16Item() { DBG_DTOR(CntUInt16Item, 0); } + + virtual int operator ==(const SfxPoolItem & rItem) const; + + using SfxPoolItem::Compare; + virtual int Compare(const SfxPoolItem & rWith) const; + + virtual SfxItemPresentation GetPresentation(SfxItemPresentation, + SfxMapUnit, SfxMapUnit, + XubString & rText, + const IntlWrapper * = 0) + const; + + virtual BOOL QueryValue(com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0) const; + + virtual BOOL PutValue(const com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0); + + virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const; + + virtual SvStream & Store(SvStream & rStream, USHORT) const; + + virtual SfxPoolItem * Clone(SfxItemPool * = 0) const; + + virtual UINT16 GetMin() const; + + virtual UINT16 GetMax() const; + + virtual SfxFieldUnit GetUnit() const; + + INT16 GetValue() const { return m_nValue; } + + inline void SetValue(UINT16 nTheValue); +}; + +inline void CntUInt16Item::SetValue(UINT16 nTheValue) +{ + DBG_ASSERT(GetRefCount() == 0, "CntUInt16Item::SetValue(): Pooled item"); + m_nValue = nTheValue; +} + +//============================================================================ +DBG_NAMEEX_VISIBILITY(CntInt32Item, SVL_DLLPUBLIC) + +class SVL_DLLPUBLIC CntInt32Item: public SfxPoolItem +{ + INT32 m_nValue; + +public: + TYPEINFO(); + + CntInt32Item(USHORT which = 0, INT32 nTheValue = 0): + SfxPoolItem(which), m_nValue(nTheValue) + { DBG_CTOR(CntInt32Item, 0); } + + CntInt32Item(USHORT which, SvStream & rStream); + + CntInt32Item(const CntInt32Item & rItem): + SfxPoolItem(rItem), m_nValue(rItem.m_nValue) + { DBG_CTOR(CntInt32Item, 0); } + + virtual ~CntInt32Item() { DBG_DTOR(CntInt32Item, 0); } + + virtual int operator ==(const SfxPoolItem & rItem) const; + + using SfxPoolItem::Compare; + virtual int Compare(const SfxPoolItem & rWith) const; + + virtual SfxItemPresentation GetPresentation(SfxItemPresentation, + SfxMapUnit, SfxMapUnit, + XubString & rText, + const IntlWrapper * = 0) + const; + + virtual BOOL QueryValue(com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0) const; + + virtual BOOL PutValue(const com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0); + + virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const; + + virtual SvStream & Store(SvStream &, USHORT) const; + + virtual SfxPoolItem * Clone(SfxItemPool * = 0) const; + + virtual INT32 GetMin() const; + + virtual INT32 GetMax() const; + + virtual SfxFieldUnit GetUnit() const; + + INT32 GetValue() const { return m_nValue; } + + inline void SetValue(INT32 nTheValue); +}; + +inline void CntInt32Item::SetValue(INT32 nTheValue) +{ + DBG_ASSERT(GetRefCount() == 0, "CntInt32Item::SetValue(): Pooled item"); + m_nValue = nTheValue; +} + +//============================================================================ +DBG_NAMEEX_VISIBILITY(CntUInt32Item, SVL_DLLPUBLIC) + +class SVL_DLLPUBLIC CntUInt32Item: public SfxPoolItem +{ + UINT32 m_nValue; + +public: + TYPEINFO(); + + CntUInt32Item(USHORT which = 0, UINT32 nTheValue = 0): + SfxPoolItem(which), m_nValue(nTheValue) + { DBG_CTOR(CntUInt32Item, 0); } + + CntUInt32Item(USHORT nWhich, SvStream & rStream); + + CntUInt32Item(const CntUInt32Item & rItem): + SfxPoolItem(rItem), m_nValue(rItem.m_nValue) + { DBG_CTOR(CntUInt32Item, 0); } + + virtual ~CntUInt32Item() { DBG_DTOR(CntUInt32Item, 0); } + + virtual int operator ==(const SfxPoolItem & rItem) const; + + using SfxPoolItem::Compare; + virtual int Compare(const SfxPoolItem & rWith) const; + + virtual SfxItemPresentation GetPresentation(SfxItemPresentation, + SfxMapUnit, SfxMapUnit, + XubString & rText, + const IntlWrapper * = 0) + const; + + virtual BOOL QueryValue(com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0) const; + + virtual BOOL PutValue(const com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0); + + virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const; + + virtual SvStream & Store(SvStream & rStream, USHORT) const; + + virtual SfxPoolItem * Clone(SfxItemPool * = 0) const; + + virtual UINT32 GetMin() const; + + virtual UINT32 GetMax() const; + + virtual SfxFieldUnit GetUnit() const; + + UINT32 GetValue() const { return m_nValue; } + + inline void SetValue(UINT32 nTheValue); +}; + +inline void CntUInt32Item::SetValue(UINT32 nTheValue) +{ + DBG_ASSERT(GetRefCount() == 0, "CntUInt32Item::SetValue(): Pooled item"); + m_nValue = nTheValue; +} + +#endif // _SVTOOLS_CINTITEM_HXX + diff --git a/svl/inc/svl/cjkoptions.hxx b/svl/inc/svl/cjkoptions.hxx new file mode 100644 index 000000000000..1573a029f29f --- /dev/null +++ b/svl/inc/svl/cjkoptions.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: cjkoptions.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVTOOLS_CJKOPTIONS_HXX +#define _SVTOOLS_CJKOPTIONS_HXX + +#include "svtools/svtdllapi.h" +#include +#include + +class SvtCJKOptions_Impl; + +// class SvtCJKOptions -------------------------------------------------- + +class SVT_DLLPUBLIC SvtCJKOptions: public utl::detail::Options +{ +private: + SvtCJKOptions_Impl* pImp; + +public: + + enum EOption + { + E_CJKFONT, + E_VERTICALTEXT, + E_ASIANTYPOGRAPHY, + E_JAPANESEFIND, + E_RUBY, + E_CHANGECASEMAP, + E_DOUBLELINES, + E_EMPHASISMARKS, + E_VERTICALCALLOUT, + E_ALL // special one for IsAnyEnabled()/SetAll() functionality + }; + + // bDontLoad is for referencing purposes only + SvtCJKOptions(sal_Bool bDontLoad = sal_False); + virtual ~SvtCJKOptions(); + + sal_Bool IsCJKFontEnabled() const; + sal_Bool IsVerticalTextEnabled() const; + sal_Bool IsAsianTypographyEnabled() const; + sal_Bool IsJapaneseFindEnabled() const; + sal_Bool IsRubyEnabled() const; + sal_Bool IsChangeCaseMapEnabled() const; + sal_Bool IsDoubleLinesEnabled() const; + sal_Bool IsEmphasisMarksEnabled() const; + sal_Bool IsVerticalCallOutEnabled() const; + + void SetAll(sal_Bool bSet); + sal_Bool IsAnyEnabled() const; + sal_Bool IsReadOnly(EOption eOption) const; +}; + +#endif // _SVTOOLS_CJKOPTIONS_HXX + diff --git a/svl/inc/svl/cnclhint.hxx b/svl/inc/svl/cnclhint.hxx new file mode 100644 index 000000000000..38781a6c2143 --- /dev/null +++ b/svl/inc/svl/cnclhint.hxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: cnclhint.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFXCNCLHINT_HXX +#define _SFXCNCLHINT_HXX + +#include +#include +#include + +#define SFXCANCELHINT_REMOVED 1 + +class SfxCancelHint: public SfxHint +{ +private: + SfxCancellable* pCancellable; + USHORT nAction; +public: + TYPEINFO(); + SfxCancelHint( SfxCancellable*, USHORT nAction ); + USHORT GetAction() const { return nAction; } + const SfxCancellable& GetCancellable() const { return *pCancellable; } +}; + +#endif diff --git a/svl/inc/svl/cntwall.hxx b/svl/inc/svl/cntwall.hxx new file mode 100644 index 000000000000..51b2982fe1dd --- /dev/null +++ b/svl/inc/svl/cntwall.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: cntwall.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CNTWALL_HXX +#define _CNTWALL_HXX + +#include "svtools/svldllapi.h" + +#ifndef SHL_HXX +#include +#endif +#include +#include +#include + +class SvStream; + +class SVL_DLLPUBLIC CntWallpaperItem : public SfxPoolItem +{ +private: + UniString _aURL; + Color _nColor; + USHORT _nStyle; + +public: + TYPEINFO(); + + CntWallpaperItem( USHORT nWhich ); + CntWallpaperItem( USHORT nWhich, SvStream& rStream, USHORT nVersion ); + CntWallpaperItem( const CntWallpaperItem& rCpy ); + ~CntWallpaperItem(); + + virtual USHORT GetVersion(USHORT) const; + + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxPoolItem* Create( SvStream&, USHORT nItemVersion ) const; + virtual SvStream& Store( SvStream&, USHORT nItemVersion ) const; + virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; + + virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ) const; + virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ); + + void SetBitmapURL( const UniString& rURL ) { _aURL = rURL; } + void SetColor( Color nColor ) { _nColor = nColor; } + void SetStyle( USHORT nStyle ) { _nStyle = nStyle; } + + const UniString& GetBitmapURL() const { return _aURL; } + Color GetColor() const { return _nColor; } + USHORT GetStyle() const { return _nStyle; } +}; + +//////////////////////////////////////////////////////////////////////////////// + +#endif // _CNTWALL_HXX + diff --git a/svl/inc/svl/cstitem.hxx b/svl/inc/svl/cstitem.hxx new file mode 100644 index 000000000000..654ee9c15a75 --- /dev/null +++ b/svl/inc/svl/cstitem.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: cstitem.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CSTITEM_HXX +#define _CSTITEM_HXX + +#include + +#include + +class SvStream; + +enum CrawlStatus +{ + CSTAT_NEVER_UPD = 0, /* noch nie ueberprueft */ + CSTAT_IN_UPD = 1, /* Ueberpruefung laeuft */ + CSTAT_UPD_NEWER = 2, /* wurde ueberprueft und ist neuer */ + CSTAT_UPD_NOT_NEWER = 3, /* wurde ueberprueft und ist nicht neuer */ + CSTAT_UPD_CANCEL = 4, /* Ueberpruefung vom Benutzer abgebrochen */ + CSTAT_ERR_GENERAL = 5, /* allgemeiner Fehler */ + CSTAT_ERR_NOTEXISTS = 6, /* Server existiert nicht */ + CSTAT_ERR_NOTREACHED = 7, /* Server nicht ereicht */ + CSTAT_UPD_IMMEDIATELY = 8, /* es wird gleich ueberprueftt */ + CSTAT_ERR_OFFLINE = 9 /* Ueberpruefung nicht m�glich, da Offline */ +}; + +DBG_NAMEEX(SfxCrawlStatusItem) + +// class SfxDateTimeRangeItem ------------------------------------------------- + +class SfxCrawlStatusItem : public SfxPoolItem +{ +private: + CrawlStatus eStatus; +public: + TYPEINFO(); + + SfxCrawlStatusItem( const SfxCrawlStatusItem& rCpy ); + SfxCrawlStatusItem( USHORT nWhich ); + SfxCrawlStatusItem( USHORT nWhich, CrawlStatus eStat ); + ~SfxCrawlStatusItem() { DBG_DTOR(SfxCrawlStatusItem, 0); } + + virtual int operator==( const SfxPoolItem& ) const; + using SfxPoolItem::Compare; + virtual int Compare( const SfxPoolItem &rWith ) const; + virtual SfxPoolItem* Create( SvStream&, USHORT nItemVersion ) const; + virtual SvStream& Store( SvStream&, USHORT nItemVersion ) const; + virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + XubString &rText, + const IntlWrapper * pIntlWrapper = 0 ) + const; + + CrawlStatus GetStatus() const { return eStatus; } + void SetStatus(CrawlStatus eNew) { eStatus = eNew; } + + virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ); + virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ) const; +}; + +#endif + diff --git a/svl/inc/svl/ctloptions.hxx b/svl/inc/svl/ctloptions.hxx new file mode 100644 index 000000000000..4157d129cce1 --- /dev/null +++ b/svl/inc/svl/ctloptions.hxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ctloptions.hxx,v $ + * $Revision: 1.3.164.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVTOOLS_CTLOPTIONS_HXX +#define _SVTOOLS_CTLOPTIONS_HXX + +#include "svtools/svtdllapi.h" +#include +#include +#include +#include + +class SvtCTLOptions_Impl; + +// class SvtCTLOptions -------------------------------------------------------- + +class SVT_DLLPUBLIC SvtCTLOptions: + public utl::detail::Options, public SfxBroadcaster, public SfxListener +{ +private: + SvtCTLOptions_Impl* m_pImp; + +public: + + // bDontLoad is for referencing purposes only + SvtCTLOptions( sal_Bool bDontLoad = sal_False ); + virtual ~SvtCTLOptions(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + void SetCTLFontEnabled( sal_Bool _bEnabled ); + sal_Bool IsCTLFontEnabled() const; + + void SetCTLSequenceChecking( sal_Bool _bEnabled ); + sal_Bool IsCTLSequenceChecking() const; + + void SetCTLSequenceCheckingRestricted( sal_Bool _bEnable ); + sal_Bool IsCTLSequenceCheckingRestricted( void ) const; + + void SetCTLSequenceCheckingTypeAndReplace( sal_Bool _bEnable ); + sal_Bool IsCTLSequenceCheckingTypeAndReplace() const; + + enum CursorMovement + { + MOVEMENT_LOGICAL = 0, + MOVEMENT_VISUAL + }; + void SetCTLCursorMovement( CursorMovement _eMovement ); + CursorMovement GetCTLCursorMovement() const; + + enum TextNumerals + { + NUMERALS_ARABIC = 0, + NUMERALS_HINDI, + NUMERALS_SYSTEM, + NUMERALS_CONTEXT + }; + void SetCTLTextNumerals( TextNumerals _eNumerals ); + TextNumerals GetCTLTextNumerals() const; + + enum EOption + { + E_CTLFONT, + E_CTLSEQUENCECHECKING, + E_CTLCURSORMOVEMENT, + E_CTLTEXTNUMERALS, + E_CTLSEQUENCECHECKINGRESTRICTED, + E_CTLSEQUENCECHECKINGTYPEANDREPLACE + }; + sal_Bool IsReadOnly(EOption eOption) const; +}; + +#endif // _SVTOOLS_CTLOPTIONS_HXX + diff --git a/svl/inc/svl/ctypeitm.hxx b/svl/inc/svl/ctypeitm.hxx new file mode 100644 index 000000000000..2592c6e0f388 --- /dev/null +++ b/svl/inc/svl/ctypeitm.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ctypeitm.hxx,v $ + * $Revision: 1.3.136.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVTOOLS_CTYPEITM_HXX +#define _SVTOOLS_CTYPEITM_HXX + +#include +#include + +//========================================================================= + +class CntContentTypeItem : public CntUnencodedStringItem +{ +private: + INetContentType _eType; + XubString _aPresentation; + +public: + TYPEINFO(); + + CntContentTypeItem(); + CntContentTypeItem( USHORT nWhich, const XubString& rType ); + CntContentTypeItem( USHORT nWhich, const INetContentType eType ); + CntContentTypeItem( const CntContentTypeItem& rOrig ); + + virtual SfxPoolItem* Create( SvStream& rStream, + USHORT nItemVersion ) const; + virtual SvStream & Store(SvStream & rStream, USHORT) const; + + virtual int operator==( const SfxPoolItem& rOrig ) const; + + virtual USHORT GetVersion(USHORT) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = NULL ) const; + + void SetValue( const XubString& rNewVal ); + void SetPresentation( const XubString& rNewVal ); + + using SfxPoolItem::Compare; + virtual int Compare( const SfxPoolItem &rWith, const IntlWrapper& rIntlWrapper ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + XubString &rText, + const IntlWrapper* pIntlWrapper = 0 ) const; + + virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ) const; + virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0); + + INetContentType GetEnumValue() const; + + void SetValue( const INetContentType eType ); +}; + +#endif /* !_SVTOOLS_CTYPEITM_HXX */ + diff --git a/svl/inc/svl/custritm.hxx b/svl/inc/svl/custritm.hxx new file mode 100644 index 000000000000..83a88b1f240f --- /dev/null +++ b/svl/inc/svl/custritm.hxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: custritm.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVTOOLS_CUSTRITM_HXX +#define _SVTOOLS_CUSTRITM_HXX + +#include "svtools/svldllapi.h" +#include +#include + +//============================================================================ +DBG_NAMEEX_VISIBILITY(CntUnencodedStringItem, SVL_DLLPUBLIC) + +class SVL_DLLPUBLIC CntUnencodedStringItem: public SfxPoolItem +{ + XubString m_aValue; + +public: + TYPEINFO(); + + CntUnencodedStringItem(USHORT which = 0): SfxPoolItem(which) + { DBG_CTOR(CntUnencodedStringItem, 0); } + + CntUnencodedStringItem(USHORT which, const XubString & rTheValue): + SfxPoolItem(which), m_aValue(rTheValue) + { DBG_CTOR(CntUnencodedStringItem, 0); } + + CntUnencodedStringItem(const CntUnencodedStringItem & rItem): + SfxPoolItem(rItem), m_aValue(rItem.m_aValue) + { DBG_CTOR(CntUnencodedStringItem, 0); } + + virtual ~CntUnencodedStringItem() { DBG_DTOR(CntUnencodedStringItem, 0); } + + virtual int operator ==(const SfxPoolItem & rItem) const; + + virtual int Compare(const SfxPoolItem & rWith) const; + + virtual int Compare(SfxPoolItem const & rWith, + IntlWrapper const & rIntlWrapper) const; + + virtual SfxItemPresentation GetPresentation(SfxItemPresentation, + SfxMapUnit, SfxMapUnit, + XubString & rText, + const IntlWrapper * = 0) + const; + + virtual BOOL QueryValue(com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0) const; + + virtual BOOL PutValue(const com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0); + + virtual SfxPoolItem * Clone(SfxItemPool * = 0) const; + + const XubString & GetValue() const { return m_aValue; } + + inline void SetValue(const XubString & rTheValue); +}; + +inline void CntUnencodedStringItem::SetValue(const XubString & rTheValue) +{ + DBG_ASSERT(GetRefCount() == 0, + "CntUnencodedStringItem::SetValue(): Pooled item"); + m_aValue = rTheValue; +} + +#endif // _SVTOOLS_CUSTRITM_HXX + diff --git a/svl/inc/svl/dateitem.hxx b/svl/inc/svl/dateitem.hxx new file mode 100644 index 000000000000..073c1a6ef825 --- /dev/null +++ b/svl/inc/svl/dateitem.hxx @@ -0,0 +1,109 @@ + /************************************************************************* + * + * 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 + * + * $RCSfile: dateitem.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _DATETIMEITEM_HXX +#define _DATETIMEITEM_HXX + +#include +#include + +#include + +class SvStream; + +DBG_NAMEEX(SfxDateTimeItem) + +// class SfxDateTimeItem ------------------------------------------------- + +class SfxDateTimeItem : public SfxPoolItem +{ +private: + DateTime aDateTime; + +public: + TYPEINFO(); + + SfxDateTimeItem( USHORT nWhich ); + SfxDateTimeItem( USHORT nWhich, + const DateTime& rDT ); + SfxDateTimeItem( const SfxDateTimeItem& rCpy ); + + ~SfxDateTimeItem() { + DBG_DTOR(SfxDateTimeItem, 0); } + + virtual int operator==( const SfxPoolItem& ) const; + using SfxPoolItem::Compare; + virtual int Compare( const SfxPoolItem &rWith ) const; + virtual SfxPoolItem* Create( SvStream&, USHORT nItemVersion ) const; + virtual SvStream& Store( SvStream&, USHORT nItemVersion ) const; + virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + XubString &rText, + const IntlWrapper * pIntlWrapper = 0 ) + const; + + const DateTime& GetDateTime() const { return aDateTime; } + void SetDateTime( const DateTime& rDT ) { + DBG_ASSERT( GetRefCount() == 0, + "SetDateTime() with pooled item" ); + aDateTime = rDT; } + + virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ); + virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ) const; +}; + +class SfxColumnDateTimeItem : public SfxDateTimeItem +{ +public: + TYPEINFO(); + + SfxColumnDateTimeItem( USHORT nWhich ); + SfxColumnDateTimeItem( USHORT nWhich, + const DateTime& rDT ); + SfxColumnDateTimeItem( const SfxDateTimeItem& rCpy ); + + ~SfxColumnDateTimeItem() {} + + virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + XubString &rText, + const IntlWrapper * pIntlWrapper = 0 ) + const; +}; + +#endif + diff --git a/svl/inc/svl/documentlockfile.hxx b/svl/inc/svl/documentlockfile.hxx new file mode 100644 index 000000000000..f2625f7955bb --- /dev/null +++ b/svl/inc/svl/documentlockfile.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: documentlockfile.hxx,v $ + * + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVT_DOCUMENTLOCKFILE_HXX +#define _SVT_DOCUMENTLOCKFILE_HXX + +#include + +#include +#include +#include +#include +#include +#include + +#include + +namespace svt { + +class SVT_DLLPUBLIC DocumentLockFile : public LockFileCommon +{ + // the workaround for automated testing! + static sal_Bool m_bAllowInteraction; + + ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > OpenStream(); + + void WriteEntryToStream( ::com::sun::star::uno::Sequence< ::rtl::OUString > aEntry, ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xStream ); + +public: + DocumentLockFile( const ::rtl::OUString& aOrigURL, const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() ); + ~DocumentLockFile(); + + sal_Bool CreateOwnLockFile(); + ::com::sun::star::uno::Sequence< ::rtl::OUString > GetLockData(); + sal_Bool OverwriteOwnLockFile(); + void RemoveFile(); + + // the methods allow to control whether UI interaction regarding the locked document file is allowed + // this is a workaround for automated tests + static void AllowInteraction( sal_Bool bAllow ) { m_bAllowInteraction = bAllow; } + static sal_Bool IsInteractionAllowed() { return m_bAllowInteraction; } +}; + +} + +#endif + diff --git a/svl/inc/svl/dtritem.hxx b/svl/inc/svl/dtritem.hxx new file mode 100644 index 000000000000..87666a306a43 --- /dev/null +++ b/svl/inc/svl/dtritem.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: dtritem.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _DTRITEM_HXX +#define _DTRITEM_HXX + +#include +#include + +#include + +class SvStream; + +DBG_NAMEEX(SfxDateTimeRangeItem) + +// class SfxDateTimeRangeItem ------------------------------------------------- + +class SfxDateTimeRangeItem : public SfxPoolItem +{ +private: + DateTime aStartDateTime; + DateTime aEndDateTime; + +public: + TYPEINFO(); + + SfxDateTimeRangeItem( const SfxDateTimeRangeItem& rCpy ); + SfxDateTimeRangeItem( USHORT nWhich ); + SfxDateTimeRangeItem( USHORT nWhich, const DateTime& rStartDT, + const DateTime& rEndDT ); + + ~SfxDateTimeRangeItem() + { DBG_DTOR(SfxDateTimeRangeItem, 0); } + + virtual int operator==( const SfxPoolItem& ) const; + using SfxPoolItem::Compare; + virtual int Compare( const SfxPoolItem &rWith ) const; + virtual SfxPoolItem* Create( SvStream&, USHORT nItemVersion ) const; + virtual SvStream& Store( SvStream&, USHORT nItemVersion ) const; + virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + XubString &rText, + const IntlWrapper * pIntlWrapper = 0 ) + const; + + virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ); + virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ) const; + + const DateTime& GetStartDateTime() const { return aStartDateTime; } + const DateTime& GetEndDateTime() const { return aEndDateTime; } + + void SetStartDateTime( const DateTime& rDT ) + { DBG_ASSERT( GetRefCount() == 0, "SetDateTime() with pooled item" ); + aStartDateTime = rDT; } + + void SetEndDateTime( const DateTime& rDT ) + { DBG_ASSERT( GetRefCount() == 0, "SetDateTime() with pooled item" ); + aEndDateTime = rDT; } +}; + +#endif + diff --git a/svl/inc/svl/eitem.hxx b/svl/inc/svl/eitem.hxx new file mode 100644 index 000000000000..f9e1927a881d --- /dev/null +++ b/svl/inc/svl/eitem.hxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: eitem.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SFXENUMITEM_HXX +#define _SFXENUMITEM_HXX + +#include "svtools/svtdllapi.h" +#include + +//============================================================================ +class SVT_DLLPUBLIC SfxEnumItem: public CntEnumItem +{ +protected: + SfxEnumItem(USHORT which = 0, USHORT nValue = 0): + CntEnumItem(which, nValue) {} + + SfxEnumItem(USHORT which, SvStream & rStream): + CntEnumItem(which, rStream) {} + +public: + TYPEINFO(); + +}; + +//============================================================================ +class SVT_DLLPUBLIC SfxBoolItem: public CntBoolItem +{ +public: + TYPEINFO(); + + SfxBoolItem(USHORT which = 0, BOOL bValue = FALSE): + CntBoolItem(which, bValue) {} + + SfxBoolItem(USHORT which, SvStream & rStream): + CntBoolItem(which, rStream) {} + + virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const + { return new SfxBoolItem(Which(), rStream); } + + virtual SfxPoolItem * Clone(SfxItemPool * = 0) const + { return new SfxBoolItem(*this); } +}; + +#endif // _SFXENUMITEM_HXX + diff --git a/svl/inc/svl/filerec.hxx b/svl/inc/svl/filerec.hxx new file mode 100644 index 000000000000..77ba6c1b5c52 --- /dev/null +++ b/svl/inc/svl/filerec.hxx @@ -0,0 +1,1087 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: filerec.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SFXFILEREC_HXX +#define _SFXFILEREC_HXX + +//========================================================================= + +#include "svtools/svldllapi.h" +#include +#include +#include + +SV_DECL_VARARR( SfxUINT32s, UINT32, 8, 8 ) + +//------------------------------------------------------------------------ + +#define SFX_BOOL_DONTCARE BOOL(2) // Don't-Care-Wert f"ur BOOLs + +#define SFX_REC_PRETAG_EXT BYTE(0x00) // Pre-Tag f"ur Extended-Records +#define SFX_REC_PRETAG_EOR BYTE(0xFF) // Pre-Tag f"ur End-Of-Records + +#define SFX_REC_TYPE_NONE BYTE(0x00) // unbekannter Record-Typ +#define SFX_REC_TYPE_FIRST BYTE(0x01) +#define SFX_REC_TYPE_SINGLE BYTE(0x01) // Single-Content-Record +#define SFX_REC_TYPE_FIXSIZE BYTE(0x02) // Fix-Size-Multi-Content-Record +#define SFX_REC_TYPE_VARSIZE_RELOC BYTE(0x03) // variable Rec-Size +#define SFX_REC_TYPE_VARSIZE BYTE(0x04) // alt (nicht verschiebbar) +#define SFX_REC_TYPE_MIXTAGS_RELOC BYTE(0x07) // Mixed Tag Content-Record +#define SFX_REC_TYPE_MIXTAGS BYTE(0x08) // alt (nicht verschiebbar) +#define SFX_REC_TYPE_LAST BYTE(0x08) +#define SFX_REC_TYPE_MINI 0x100 // Mini-Record +#define SFX_REC_TYPE_DRAWENG 0x400 // Drawing-Engine-Record +#define SFX_REC_TYPE_EOR 0xF00 // End-Of-Records + +//------------------------------------------------------------------------ + +#define SFX_REC_HEADERSIZE_MINI 4 // Gr"o\se des Mini-Record-Headers +#define SFX_REC_HEADERSIZE_SINGLE 4 // zzgl. HEADERSIZE_MINI => 8 +#define SFX_REC_HEADERSIZE_MULTI 6 // zzgl. HEADERSIZE_SINGLE => 14 + +//------------------------------------------------------------------------ + +#ifndef DBG +#ifdef DBG_UTIL +#define DBG(x) x +#else +#define DBG(x) +#endif +#endif + +//------------------------------------------------------------------------ + +/* [Fileformat] + + Jeder Record beginnt mit einem Byte, dem sogenannten 'Pre-Tag'. + + Ist dieses 'Pre-Tag' == 0x00, dann handelt es sich um einen Extended- + Record, dessen Typ durch ein weiteres Byte an Position 5 n�her + beschrieben wird: + + 0x01: SfxSingleRecord + 0x02: SfxMultiFixRecord + 0x03+0x04: SfxMultiVarRecord + 0x07+0x08: SfxMultiMixRecord + (Alle weiteren Record-Typ-Kennungen sind reserviert.) + + I.d.R. werden File-Formate schon aus Performance-Gr"unden so aufgebaut, + da\s beim Lesen jeweils vorher schon feststeht, welcher Record-Typ + vorliegt. Diese Kennung dient daher hautps"achlich der "Uberpr"ufung + und File-Viewern, die das genaue File-Format (unterhalb der Records) + nicht kennen. + + Der 'SfxMiniRecordReader' verf"ugt dazu auch "uber eine statische + Methode 'ScanRecordType()', mit der festgestellt werden kann, welcher + Record-Typ in dem "ubergebenen Stream zu finden ist. + + Ein 'Pre-Tag' mit dem Wert 0xFF ist als Terminator reserviert. + Terminatoren werden verwendet, um das Suchen nach einem speziellen + Record zu terminieren, d.h. ist er bis dorthin nicht gefunden, wird + auch nicht weitergesucht. + + Bei allen anderen Werten des 'Pre-Tags' (also von 0x01 bis 0xFE) + handelt es sich um einen zum SW3 kompatbilen Record, der hier + 'SfxMiniRecord' genannt wird, er kann daher mit einem + gelesen werden. + + Beginnt ein Record mit 0x44 k"onnte es sich um einen Drawing-Engine- + Record handeln. Dies ist dann der Fall, wenn die folgenden drei Bytes + die Zeichenkette 'RMD' bzw. 'RVW' ergeben (zusammen mit 'D'==0x44 + ergibt dies die K"urzel f"ur 'DRaw-MoDel' bzw. 'DRaw-VieW'). Records + dieser Art k"onnen von den hier dargestellten Klassen weder gelesen, + noch in irgendeiner Weise interpretiert werden. Einzig die Methode + 'ScanRecordType()' kann sie erkennen - weitere Behandlung obliegt + jedoch der Anwendungsprogrammierung. + + Diese drei Bytes an den Positionen 2 bis 4 enthalten normalerweise + die Gr"o\se des Records ohne Pre-Tag und Gr"o\sen-Bytes selbst, + also die Restgr"o\se nach diesem 4-Byte-Header. + + Struktur des Mini-Records: + + 1 BYTE Pre-Tag + 3 BYTE OffsetToEndOfRec + OffsetToEndOfRec* 1 BYTE Content + + Bei den Extended-Reords folgt auf diesen 4-Byte-Header ein erweiterter + Header, der zun"achst den o.g. Record-Typ, dann eine Versions-Kennung + sowie ein Tag enth"alt, welches den Inhalt kennzeichnet. + + Struktur des Extended-Records: + + 1 BYTE Pre-Tag (==0x00) + 3 BYTE OffsetToEndOfRec + OffsetToEndOfRec* 1 BYTE Content + 1 BYTE Record-Type + 1 BYTE Version + 2 BYTE Tag + ContentSize* 1 BYTE Content + + (ContentSize = OffsetToEndOfRec - 8) + + [Anmerkung] + + Der Aufbau der Records wird wie folgt begr"undet: + + Der SW-Record-Typ war zuerst vorhanden, mu\ste also 1:1 "ubernommen + werden. Zum Gl"uck wurden einige Record-Tags nicht verwendet, (Z.B. + 0x00 und 0xFF). + => 1. Byte 0x00 kann als Kennung f"ur erweiterten Record verwendet werden + => 1. Byte 0xFF kann f"ur besondere Zwecke verwendet werden + + Egal welcher Record-Typ vorliegt, sollte eine Erkennung des Typs, ein + Auslesen des Headers und ein "uberpspringen des Records m"oglich sein, + ohne zu"uck-seeken zu m"ussen und ohne "uberfl"ussige Daten lesen zu + m"ussen. + => die Bytes 2-4 werden bei allen Records als Offset zum Ende des + Records interpretiert, so da\s die Gesamt-Recors-Size sich wie + folgt berechnet: sizeof(UINT32) + OffsetToEndOfRec + + Die Records sollten einfach zu parsen un einheitlich aufgebaut sein. + => Sie bauen aufeinander auf, so ist z.B. der SfxMiniRecord in jedem + anderen enthalten. + + Die Records sollten auch von denen der Drawing Enginge unterscheidbar + sein. Diese beginnen mit 'DRMD' und 'DRVW'. + => Mini-Records mit dem Pre-Tag 'D' d"urfen maximal 4MB gro\s sein, + um nicht in diesen Kennungs-Bereich zu reichen. + + [Erweiterungen] + + Es ist geplant das File-Format so zu erweitern, da\s das High-Nibble + des Record-Typs der erweiterten Records besondere Aufgaben "ubernehmen + soll. Zum Beispiel ist geplant, Record-Contents als 'nur aus Records + bestehend' zu kennzeichnen. Ein File-Viewer k"onnte sich dann automatisch + durch solche Strukturen 'hangeln', ohne Gefahr zu laufen, auf Daten + zu sto\sen, die sich zwar als Records interpretieren lassen, aber + tats"achlis als 'flache' Daten geschrieben wurden. Die m"ogliche + Erweiterung wird schon jetzt insofern vorbereitet, als da\s das + High-Nibble des Typs bei Vergleichen nicht ber"ucksichtigt wird. +*/ + +//------------------------------------------------------------------------ + +class SVL_DLLPUBLIC SfxMiniRecordWriter + +/* [Beschreibung] + + Mit Instanzen dieser Klasse kann ein einfacher Record in einen Stream + geschrieben werden, der sich durch ein BYTE-Tag identifiziert, sowie + seine eigene L"ange speichert und somit auch von "alteren Versionen + bzw. Readern, die diesen Record-Type (Tag) nicht kennen, "ubersprungen + werden kann. Es wird keine Version-Nummer gespeichert. + + Alternativ kann die Gr"o\se fest angegeben werden oder sie wird + automatisch aus der Differenz der Tell()-Angaben vor und nach dem + Streamen des Inhalts ermittelt. + + Um Auf- und Abw"artskompatiblit"at gew"ahrleisten zu k"onnen, m"ussen + neue Versionen die Daten der "alteren immer komplett enthalten, + es d"urfen allenfalls neue Daten hintenan geh"angt werden! + + [Fileformat] + + 1* BYTE Content-Tag (!= 0) + 1* 3-BYTE OffsetToEndOfRec in Bytes + SizeOfContent* BYTE Content + + [Beispiel] + + { + SfxMiniRecordWriter aRecord( pStream, MY_TAG_X ); + *aRecord << aMember1; + *aRecord << aMember2; + } +*/ + +{ +protected: + SvStream* _pStream; // , in dem der Record liegt + UINT32 _nStartPos; // Start-Position des Gesamt-Records im Stream + FASTBOOL _bHeaderOk; /* TRUE, wenn der Header schon geschrieben ist; + bei DBG_UTIL wird SFX_BOOL_DONTCARE ver- + wendet, um die Gr"o\se von Fix-Sized-Records + zu pr"ufen. */ + BYTE _nPreTag; // in den Header zu schreibendes 'Pre-Tag' + +public: + inline SfxMiniRecordWriter( SvStream *pStream, + BYTE nTag ); + inline SfxMiniRecordWriter( SvStream *pStream, BYTE nTag, + UINT32 nSize ); + + inline ~SfxMiniRecordWriter(); + + inline SvStream& operator*() const; + + inline void Reset(); + + UINT32 Close( FASTBOOL bSeekToEndOfRec = TRUE ); + +private: + // not implementend, not allowed + SfxMiniRecordWriter( const SfxMiniRecordWriter& ); + SfxMiniRecordWriter& operator=(const SfxMiniRecordWriter&); +}; + +//------------------------------------------------------------------------ + +class SVL_DLLPUBLIC SfxMiniRecordReader + +/* [Beschreibung] + + Mit Instanzen dieser Klasse kann ein einfacher Record aus einem Stream + gelesen werden, der mit der Klasse geschrieben wurde. + + Es ist auch m"oglich, den Record zu "uberspringen, ohne sein internes + Format zu kennen. + + [Beispiel] + + { + SfxMiniRecordReader aRecord( pStream ); + switch ( aRecord.GetTag() ) + { + case MY_TAG_X: + *aRecord >> aMember1; + *aRecord >> aMember2; + break; + + ... + } + } +*/ + +{ +protected: + SvStream* _pStream; // , aus dem gelesen wird + UINT32 _nEofRec; // Position direkt hinter dem Record + FASTBOOL _bSkipped; // TRUE: der Record wurde explizit geskippt + BYTE _nPreTag; // aus dem Header gelesenes Pre-Tag + + // Drei-Phasen-Ctor f"ur Subklassen + SfxMiniRecordReader() {} + void Construct_Impl( SvStream *pStream, BYTE nTag ) + { + _pStream = pStream; + _bSkipped = FALSE; + _nPreTag = nTag; + } + inline FASTBOOL SetHeader_Impl( UINT32 nHeader ); + + // als ung"ultig markieren und zur"uck-seeken + void SetInvalid_Impl( UINT32 nRecordStartPos ) + { + _nPreTag = SFX_REC_PRETAG_EOR; + _pStream->Seek( nRecordStartPos ); + } + +public: + static USHORT ScanRecordType( SvStream *pStream ); + + SfxMiniRecordReader( SvStream *pStream ); + SfxMiniRecordReader( SvStream *pStream, BYTE nTag ); + inline ~SfxMiniRecordReader(); + + inline BYTE GetTag() const; + inline FASTBOOL IsValid() const; + + inline SvStream& operator*() const; + + inline void Skip(); + +private: + // not implementend, not allowed + SfxMiniRecordReader( const SfxMiniRecordReader& ); + SfxMiniRecordReader& operator=(const SfxMiniRecordReader&); +}; + +//------------------------------------------------------------------------ + +class SVL_DLLPUBLIC SfxSingleRecordWriter: public SfxMiniRecordWriter + +/* [Beschreibung] + + Mit Instanzen dieser Klasse kann ein Record in einen Stream geschrieben + werden, dessen einziger Inhalt sich durch ein UINT16-Tag und eine + BYTE-Versions-Nummer identifiziert, sowie seine eigene L"ange speichert + und somit auch von "alteren Versionen bzw. Readern, die diesen + Record-Type (Tag) nicht kennen, "ubersprungen werden kann. + + Alternativ kann die Gr"o\se fest angegeben werden oder sie wird + automatisch aus der Differenz der Tell()-Angaben vor und nach dem + Streamen des Inhalts ermittelt. + + Um Auf- und Abw"artskompatiblit"at gew"ahrleisten zu k"onnen, m"ussen + neue Versionen die Daten der "alteren immer komplett enthalten, + es d"urfen allenfalls neue Daten hintenan geh"angt werden! + + [Fileformat] + + 1* BYTE Pre-Tag (!= 0) + 1* 3-BYTE OffsetToEndOfRec in Bytes + 1* BYTE Record-Type (==SFX_REC_TYPE_SINGLE) + 1* BYTE Content-Version + 1* USHORT Content-Tag + SizeOfContent* BYTE Content + + [Beispiel] + + { + SfxSingleRecordWriter aRecord( pStream, MY_TAG_X, MY_VERSION ); + *aRecord << aMember1; + *aRecord << aMember2; + } +*/ + +{ +protected: + SfxSingleRecordWriter( BYTE nRecordType, + SvStream *pStream, + UINT16 nTag, BYTE nCurVer ); + +public: + SfxSingleRecordWriter( SvStream *pStream, + UINT16 nTag, BYTE nCurVer ); + SfxSingleRecordWriter( SvStream *pStream, + UINT16 nTag, BYTE nCurVer, + UINT32 nSize ); + + inline void Reset(); + + UINT32 Close( FASTBOOL bSeekToEndOfRec = TRUE ); +}; + +//------------------------------------------------------------------------ + +class SVL_DLLPUBLIC SfxSingleRecordReader: public SfxMiniRecordReader + +/* [Beschreibung] + + Mit Instanzen dieser Klasse kann ein einfacher Record aus einem Stream + gelesen werden, der mit der Klasse geschrieben + wurde. + + Es ist auch m"oglich, den Record zu "uberspringen, ohne sein internes + Format zu kennen. + + [Beispiel] + + { + SfxSingleRecordReader aRecord( pStream ); + switch ( aRecord.GetTag() ) + { + case MY_TAG_X: + aRecord >> aMember1; + if ( aRecord.HasVersion(2) ) + *aRecord >> aMember2; + break; + + ... + } + } +*/ + +{ +protected: + UINT16 _nRecordTag; // Art des Gesamt-Inhalts + BYTE _nRecordVer; // Version des Gesamt-Inhalts + BYTE _nRecordType; // Record Type aus dem Header + + // Drei-Phasen-Ctor f"ur Subklassen + SfxSingleRecordReader() {} + void Construct_Impl( SvStream *pStream ) + { + SfxMiniRecordReader::Construct_Impl( + pStream, SFX_REC_PRETAG_EXT ); + } + FASTBOOL FindHeader_Impl( UINT16 nTypes, UINT16 nTag ); + FASTBOOL ReadHeader_Impl( USHORT nTypes ); + +public: + SfxSingleRecordReader( SvStream *pStream ); + SfxSingleRecordReader( SvStream *pStream, USHORT nTag ); + + inline UINT16 GetTag() const; + + inline BYTE GetVersion() const; + inline FASTBOOL HasVersion( USHORT nVersion ) const; +}; + +//------------------------------------------------------------------------ + +class SVL_DLLPUBLIC SfxMultiFixRecordWriter: public SfxSingleRecordWriter + +/* [Beschreibung] + + Mit Instanzen dieser Klasse kann ein Record in einen Stream geschrieben + werden, der seine eigene L"ange speichert und somit auch von "alteren + Versionen bzw. Readern, die diesen Record-Type (Tag) nicht kennen, + "ubersprungen werden kann. + + Er enth"alt mehrere Inhalte von demselben Typ (Tag) und derselben + Version, die einmalig (stellvertretend f"ur alle) im Header des Records + identifiziert werden. Alle Inhalte haben eine vorher bekannte und + identische L"ange. + + Um Auf- und Abw"artskompatiblit"at gew"ahrleisten zu k"onnen, m"ussen + neue Versionen die Daten der "alteren immer komplett enthalten, + es d"urfen allenfalls neue Daten hinten angeh"angt werden! Hier sind + damit selbstverst"andlich nur die Daten der einzelnen Inhalte gemeint, + die Anzahl der Inhalte ist selbstverst"andlich variabel und sollte + von lesenden Applikationen auch so behandelt werden. + + [Fileformat] + + 1* BYTE Pre-Tag (==0) + 1* 3-BYTE OffsetToEndOfRec in Bytes + 1* BYTE Record-Type (==SFX_REC_TYPE_FIXSIZE) + 1* BYTE Content-Version + 1* UINT16 Content-Tag + 1* UINT16 NumberOfContents + 1* UINT32 SizeOfEachContent + NumberOfContents* ( + SizeOfEachContent BYTE Content + ) + + [Beispiel] + + { + SfxMultiFixRecordWriter aRecord( pStream, MY_TAG_X, MY_VERSION ); + for ( USHORT n = 0; n < Count(); ++n ) + { + aRecord.NewContent(); + *aRecord << aMember1[n]; + *aRecord << aMember2[n]; + } + } +*/ + +{ +protected: + UINT32 _nContentStartPos; /* Startposition des jeweiligen + Contents - nur bei DBG_UTIL + und f"ur Subklassen */ + UINT32 _nContentSize; // Gr"o\se jedes Contents + UINT16 _nContentCount; // jeweilige Anzahl der Contents + + SfxMultiFixRecordWriter( BYTE nRecordType, + SvStream *pStream, + UINT16 nTag, BYTE nCurVer, + UINT32 nContentSize ); + +public: + SfxMultiFixRecordWriter( SvStream *pStream, + UINT16 nTag, BYTE nCurVer, + UINT32 nContentSize ); + inline ~SfxMultiFixRecordWriter(); + + inline void NewContent(); + + inline void Reset(); + + UINT32 Close( FASTBOOL bSeekToEndOfRec = TRUE ); +}; + +//------------------------------------------------------------------------ + +class SVL_DLLPUBLIC SfxMultiVarRecordWriter: public SfxMultiFixRecordWriter + +/* [Beschreibung] + + Mit Instanzen dieser Klasse kann ein Record in einen Stream geschrieben + werden, der seine eigene L"ange speichert und somit auch von "alteren + Versionen bzw. Readern, die diesen Record-Type (Tag) nicht kennen, + "ubersprungen werden kann. + + Er enth"alt mehrere Inhalte von demselben Typ (Tag) und derselben + Version, die einmalig (stellvertretend f"ur alle) im Header des Records + identifiziert werden. Die L"ange f"ur jeden einzelnen Inhalt wird + automatisch berechnet und gespeichert, so da\s auch einzelne Inhalte + "ubersprungen werden k"onnen, ohne sie interpretieren zu m"ussen. + + Um Auf- und Abw"artskompatiblit"at gew"ahrleisten zu k"onnen, m"ussen + neue Versionen die Daten der "alteren immer komplett enthalten, + es d"urfen allenfalls neue Daten hinten angeh"angt werden! + + [Fileformat] + + 1* BYTE Pre-Tag (==0) + 1* 3-BYTE OffsetToEndOfRec in Bytes + 1* BYTE Record-Type (==SFX_FILETYPE_TYPE_VARSIZE) + 1* BYTE Content-Version + 1* USHORT Content-Tag + 1* UINT16 NumberOfContents + 1* UINT32 OffsetToOfsTable + NumberOfContents* ( + ContentSize* BYTE Content + ) + NumberOfContents* UINT32 ContentOfs (je per <<8 verschoben) + + [Beispiel] + + { + SfxMultiVarRecordWriter aRecord( pStream, MY_TAG_X, MY_VERSION ); + for ( USHORT n = 0; n < Count(); ++n ) + { + aRecord.NewContent(); + *aRecord << aMember1[n]; + *aRecord << aMember2[n]; + } + } +*/ + +{ +protected: + SfxUINT32s _aContentOfs; + USHORT _nContentVer; // nur f"ur SfxMultiMixRecordWriter + + SfxMultiVarRecordWriter( BYTE nRecordType, + SvStream *pStream, + USHORT nRecordTag, + BYTE nRecordVer ); + + void FlushContent_Impl(); + +public: + SfxMultiVarRecordWriter( SvStream *pStream, + USHORT nRecordTag, + BYTE nRecordVer ); + virtual ~SfxMultiVarRecordWriter(); + + void NewContent(); + + virtual UINT32 Close( FASTBOOL bSeekToEndOfRec = TRUE ); +}; + +//------------------------------------------------------------------------ + +class SVL_DLLPUBLIC SfxMultiMixRecordWriter: public SfxMultiVarRecordWriter + +/* [Beschreibung] + + Mit Instanzen dieser Klasse kann ein Record in einen Stream geschrieben + werden, der seine eigene L"ange speichert und somit auch von "alteren + Versionen bzw. Readern, die diesen Record-Type (Tag) nicht kennen, + "ubersprungen werden kann. + + Er enth"alt mehrere Inhalte von demselben Typ (Tag) und derselben + Version, die einmalig (stellvertretend f"ur alle) im Header des Records + identifiziert werden. Alle Inhalte haben eine vorher bekannte und + identische L"ange. + + Um Auf- und Abw"artskompatiblit"at gew"ahrleisten zu k"onnen, m"ussen + neue Versionen die Daten der "alteren immer komplett enthalten, + es d"urfen allenfalls neue Daten hinten angeh"angt werden! + + [Fileformat] + + 1* BYTE Pre-Tag (==0) + 1* 3-BYTE OffsetToEndOfRec in Bytes + 1* BYTE Record-Type (==SFX_REC_TYPE_MIXTAGS) + 1* BYTE Content-Version + 1* USHORT Record-Tag + 1* UINT16 NumberOfContents + 1* UINT32 OffsetToOfsTable + NumberOfContents* ( + 1* USHORT Content-Tag + ContentSize* BYTE Content + ) + NumberOfContents* UINT32 ( ContentOfs << 8 + Version ) +*/ + +{ +public: + inline SfxMultiMixRecordWriter( SvStream *pStream, + USHORT nRecordTag, + BYTE nRecordVer ); + + void NewContent( USHORT nTag, BYTE nVersion ); + +// private: geht nicht, da einige Compiler dann auch vorherige privat machen + void NewContent() + { DBG_ERROR( "NewContent() only allowed with args" ); } +}; + +//------------------------------------------------------------------------ + +class SVL_DLLPUBLIC SfxMultiRecordReader: public SfxSingleRecordReader + +/* [Beschreibung] + + Mit Instanzen dieser Klasse kann ein aus mehreren Contents bestehender + Record aus einem Stream gelesen werden, der mit einer der Klassen + , oder + geschrieben wurde. + + Es ist auch m"oglich, den Record oder einzelne Contents zu "uberspringen, + ohne das jeweilis interne Format zu kennen. + + [Beispiel] + + { + SfxMultiRecordReader aRecord( pStream ); + for ( USHORT nRecNo = 0; aRecord.GetContent(); ++nRecNo ) + { + switch ( aRecord.GetTag() ) + { + case MY_TAG_X: + X *pObj = new X; + *aRecord >> pObj.>aMember1; + if ( aRecord.HasVersion(2) ) + *aRecord >> pObj->aMember2; + Append( pObj ); + break; + + ... + } + } + } +*/ + +{ + UINT32 _nStartPos; // Start-Position des Records + UINT32* _pContentOfs; // Offsets der Startpositionen + UINT32 _nContentSize; // Size jedes einzelnen / Tabellen-Pos + UINT16 _nContentCount; // Anzahl der Contents im Record + UINT16 _nContentNo; /* der Index des aktuellen Contents + enth"alt jeweils den Index des + Contents, der beim n"achsten + GetContent() geholt wird */ + UINT16 _nContentTag; // Art-Kennung des aktuellen Contents + BYTE _nContentVer; // Versions-Kennung des akt. Contents + + FASTBOOL ReadHeader_Impl(); + +public: + SfxMultiRecordReader( SvStream *pStream ); + SfxMultiRecordReader( SvStream *pStream, UINT16 nTag ); + ~SfxMultiRecordReader(); + + FASTBOOL GetContent(); + inline UINT16 GetContentTag(); + inline BYTE GetContentVersion() const; + inline FASTBOOL HasContentVersion( USHORT nVersion ) const; + + inline UINT32 ContentCount() const; +}; + +//========================================================================= + +inline SfxMiniRecordWriter::SfxMiniRecordWriter +( + SvStream* pStream, // Stream, in dem der Record angelegt wird + BYTE nTag // Record-Tag zwischen 0x01 und 0xFE +) + +/* [Beschreibung] + + Legt in 'pStream' einen 'SfxMiniRecord' an, dessen Content-Gr"o\se + nicht bekannt ist, sondern nach dam Streamen des Contents errechnet + werden soll. +*/ + +: _pStream( pStream ), + _nStartPos( pStream->Tell() ), + _bHeaderOk(FALSE), + _nPreTag( nTag ) +{ + DBG_ASSERT( _nPreTag != 0xFF, "invalid Tag" ); + DBG( DbgOutf( "SfxFileRec: writing record to %ul", pStream->Tell() ) ); + + pStream->SeekRel( + SFX_REC_HEADERSIZE_MINI ); +} + +//------------------------------------------------------------------------- + +inline SfxMiniRecordWriter::SfxMiniRecordWriter +( + SvStream* pStream, // Stream, in dem der Record angelegt wird + BYTE nTag, // Record-Tag zwischen 0x01 und 0xFE + UINT32 nSize // Gr"o\se der Daten in Bytes +) + +/* [Beschreibung] + + Legt in 'pStream' einen 'SfxMiniRecord' an, dessen Content-Gr"o\se + von vornherein bekannt ist. +*/ + +: _pStream( pStream ), + // _nTag( uninitialized ), + // _nStarPos( uninitialized ), + _bHeaderOk(SFX_BOOL_DONTCARE) +{ + DBG_ASSERT( nTag != 0 && nTag != 0xFF, "invalid Tag" ); + DBG(_nStartPos = pStream->Tell()); + DBG( DbgOutf( "SfxFileRec: writing record to %ul", _nStartPos ) ); + + *pStream << ( ( nTag << 24 ) | nSize ); +} + +//------------------------------------------------------------------------- + +inline SfxMiniRecordWriter::~SfxMiniRecordWriter() + +/* [Beschreibung] + + Der Dtor der Klasse schlie\st den Record + automatisch, falls nicht bereits + explizit gerufen wurde. +*/ + +{ + // wurde der Header noch nicht geschrieben oder mu\s er gepr"uft werden + if ( !_bHeaderOk DBG(||TRUE) ) + Close(); +} + +//------------------------------------------------------------------------- + +inline SvStream& SfxMiniRecordWriter::operator*() const + +/* [Beschreibung] + + Dieser Operator liefert den Stream, in dem der Record liegt. + Der Record darf noch nicht geschlossen worden sein. +*/ + +{ + DBG_ASSERT( !_bHeaderOk, "getting Stream of closed record" ); + return *_pStream; +} + +//------------------------------------------------------------------------- + +inline void SfxMiniRecordWriter::Reset() +{ + _pStream->Seek( _nStartPos + SFX_REC_HEADERSIZE_MINI ); + _bHeaderOk = FALSE; +} + +//========================================================================= + +inline SfxMiniRecordReader::~SfxMiniRecordReader() + +/* [Beschreibung] + + Der Dtor der Klasse positioniert den Stream + automatisch auf die Position direkt hinter dem Record, falls nicht + bereits explizit gerufen wurde. +*/ + +{ + // noch nicht explizit ans Ende gesprungen? + if ( !_bSkipped ) + Skip(); +} + +//------------------------------------------------------------------------- + +inline void SfxMiniRecordReader::Skip() + +/* [Beschreibung] + + Mit dieser Methode wird der Stream direkt hinter das Ende des Records + positioniert. +*/ + +{ + _pStream->Seek(_nEofRec); + _bSkipped = TRUE; +} + +//------------------------------------------------------------------------- + +inline BYTE SfxMiniRecordReader::GetTag() const + +/* [Beschreibung] + + Liefert des aus dem Header gelesene Pre-Tag des Records. Dieses kann + auch SFX_REC_PRETAG_EXT oder SFX_REC_PRETAG_EOR sein, im + letzteren Fall ist am Stream der Fehlercode ERRCODE_IO_WRONGFORMAT + gesetzt. SFX_REC_PRETAG_EXT ist g"ultig, da diese extended-Records + nur eine Erweiterung des SfxMiniRecord darstellen. +*/ + +{ + return _nPreTag; +} + +//------------------------------------------------------------------------- + +inline FASTBOOL SfxMiniRecordReader::IsValid() const + +/* [Beschreibung] + + Hiermit kann abgefragt werden, ob der Record erfolgreich aus dem + Stream konstruiert werden konnte, der Header also f"ur diesen Record-Typ + passend war. +*/ + +{ + return _nPreTag != SFX_REC_PRETAG_EOR; +} + +//------------------------------------------------------------------------- + +inline SvStream& SfxMiniRecordReader::operator*() const + +/* [Beschreibung] + + Dieser Operator liefert den Stream in dem der Record liegt. + Die aktuelle Position des Streams mu\s innerhalb des Records liegen. +*/ + +{ + DBG_ASSERT( _pStream->Tell() < _nEofRec, "read behind record" ); + return *_pStream; +} + +//========================================================================= + +inline UINT32 SfxSingleRecordWriter::Close( FASTBOOL bSeekToEndOfRec ) + +// siehe + +{ + UINT32 nRet = 0; + + // wurde der Header noch nicht geschrieben? + if ( !_bHeaderOk ) + { + // Basisklassen-Header schreiben + UINT32 nEndPos = SfxMiniRecordWriter::Close( bSeekToEndOfRec ); + + // ggf. ans Ende des eigenen Headers seeken oder hinter Rec bleiben + if ( !bSeekToEndOfRec ) + _pStream->SeekRel( SFX_REC_HEADERSIZE_SINGLE ); + nRet = nEndPos; + } +#ifdef DBG_UTIL + else + // Basisklassen-Header pr"ufen + SfxMiniRecordWriter::Close( bSeekToEndOfRec ); +#endif + + // Record war bereits geschlossen +// nRet = 0; + return nRet; +} + +//------------------------------------------------------------------------- + +inline void SfxSingleRecordWriter::Reset() +{ + _pStream->Seek( _nStartPos + SFX_REC_HEADERSIZE_MINI + + SFX_REC_HEADERSIZE_SINGLE ); + _bHeaderOk = FALSE; +} + +//========================================================================= + +inline UINT16 SfxSingleRecordReader::GetTag() const + +/* [Beschreibung] + + Liefert des aus dem Header gelesene Tag f"ur den Gesamt-Record. +*/ + +{ + return _nRecordTag; +} + +//------------------------------------------------------------------------- + +inline BYTE SfxSingleRecordReader::GetVersion() const + +/* [Beschreibung] + + Liefert die Version des aus dem Stream gelesenen Records. +*/ + +{ + return _nRecordVer; +} + +//------------------------------------------------------------------------- + +inline FASTBOOL SfxSingleRecordReader::HasVersion( USHORT nVersion ) const + +/* [Beschreibung] + + Stellt fest, ob der aus dem Stream gelese Record in der Version + 'nVersion' oder h"oher vorliegt. +*/ + +{ + return _nRecordVer >= nVersion; +} + +//========================================================================= + +inline SfxMultiFixRecordWriter::~SfxMultiFixRecordWriter() + +/* [Beschreibung] + + Der Dtor der Klasse schlie\st den Record + automatisch, falls nicht bereits + explizit gerufen wurde. +*/ + +{ + // wurde der Header noch nicht geschrieben oder mu\s er gepr"uft werden + if ( !_bHeaderOk ) + Close(); +} + +//------------------------------------------------------------------------- + +inline void SfxMultiFixRecordWriter::NewContent() + +/* [Beschreibung] + + Mit dieser Methode wird in den Record ein neuer Content eingef"ugt. + Jeder, auch der 1. Record mu\s durch Aufruf dieser Methode eingeleitet + werden. +*/ + +{ + #ifdef DBG_UTIL + ULONG nOldStartPos; + // Startposition des aktuellen Contents merken - Achtung Subklassen! + nOldStartPos = _nContentStartPos; + #endif + _nContentStartPos = _pStream->Tell(); + +#ifdef DBG_UTIL + // ist ein vorhergehender Content vorhanden? + if ( _nContentCount ) + { + // pr"ufen, ob der vorhergehende die Soll-Gr"o\se eingehalten hat + DBG_ASSERT( _nContentStartPos - nOldStartPos == _nContentSize, + "wrong content size detected" ); + } +#endif + + // Anzahl mitz"ahlen + ++_nContentCount; +} + +//========================================================================= + +inline SfxMultiMixRecordWriter::SfxMultiMixRecordWriter +( + SvStream* pStream, // Stream, in dem der Record angelegt wird + USHORT nRecordTag, // Gesamt-Record-Art-Kennung + BYTE nRecordVer // Gesamt-Record-Versions-Kennung +) + +/* [Beschreibung] + + Legt in 'pStream' einen 'SfxMultiMixRecord' an, f"ur dessen Contents + je eine separate Kennung f"ur Art (Tag) und Version gespeichert wird. + Die Gr"o\sen der einzelnen Contents werden automatisch ermittelt. +*/ + +: SfxMultiVarRecordWriter( SFX_REC_TYPE_MIXTAGS, + pStream, nRecordTag, nRecordVer ) +{ +} + +//========================================================================= + +inline void SfxMultiFixRecordWriter::Reset() +{ + _pStream->Seek( _nStartPos + SFX_REC_HEADERSIZE_MINI + + SFX_REC_HEADERSIZE_SINGLE + + SFX_REC_HEADERSIZE_MULTI ); + _bHeaderOk = FALSE; +} + +//========================================================================= + +inline UINT16 SfxMultiRecordReader::GetContentTag() + +/* [Beschreibung] + + Diese Methode liefert die Art-Kennung des zuletzt mit der Methode + ge"offneten Contents. +*/ + +{ + return _nContentTag; +} + +//------------------------------------------------------------------------- + +inline BYTE SfxMultiRecordReader::GetContentVersion() const + +/* [Beschreibung] + + Diese Methode liefert die Version-Kennung des zuletzt mit der Methode + ge"offneten Contents. +*/ + +{ + return _nContentVer; +} + +//------------------------------------------------------------------------- + +inline FASTBOOL SfxMultiRecordReader::HasContentVersion( USHORT nVersion ) const + +/* [Beschreibung] + + Diese Methode stellt fest, ob die Version 'nVersion' in der Version des + zuletzt mit der Methode ge"offneten + Contents enthalten ist. +*/ + +{ + return _nContentVer >= nVersion; +} + +//------------------------------------------------------------------------- + +inline UINT32 SfxMultiRecordReader::ContentCount() const + +/* [Beschreibung] + + Diese Methode liefert die Anzahl im Record befindlichen Contents. +*/ + +{ + return _nContentCount; +} + +#endif + diff --git a/svl/inc/svl/flagitem.hxx b/svl/inc/svl/flagitem.hxx new file mode 100644 index 000000000000..5298bbd1678b --- /dev/null +++ b/svl/inc/svl/flagitem.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: flagitem.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFXFLAGITEM_HXX +#define _SFXFLAGITEM_HXX + +#include "svtools/svtdllapi.h" +#include +#include +#include + +class SvStream; + +extern USHORT nSfxFlagVal[16]; + +// ----------------------------------------------------------------------- + +DBG_NAMEEX_VISIBILITY(SfxFlagItem, SVT_DLLPUBLIC) + +class SVT_DLLPUBLIC SfxFlagItem: public SfxPoolItem +{ + USHORT nVal; + +public: + TYPEINFO(); + + SfxFlagItem( USHORT nWhich = 0, USHORT nValue = 0 ); + SfxFlagItem( USHORT nWhich, SvStream & ); + SfxFlagItem( const SfxFlagItem& ); + + ~SfxFlagItem() { + DBG_DTOR(SfxFlagItem, 0); } + + virtual BYTE GetFlagCount() const; + virtual XubString GetFlagText( BYTE nFlag ) const; + + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxPoolItem* Create(SvStream &, USHORT nVersion) const; + virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + XubString &rText, + const IntlWrapper * = 0 ) const; + USHORT GetValue() const { return nVal; } + void SetValue( USHORT nNewVal ) { + DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); + nVal = nNewVal; + } + int GetFlag( BYTE nFlag ) const { + return ( (nVal & nSfxFlagVal[nFlag]) != 0 ); } + void SetFlag( BYTE nFlag, int bVal ); +}; + +#endif diff --git a/svl/inc/svl/frqitem.hxx b/svl/inc/svl/frqitem.hxx new file mode 100644 index 000000000000..11b2d31a1123 --- /dev/null +++ b/svl/inc/svl/frqitem.hxx @@ -0,0 +1,178 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: frqitem.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _FRQITEM_HXX +#define _FRQITEM_HXX + +#include +#include +#include +#include + +#include + +class SvStream; + +DBG_NAMEEX(SfxFrequencyItem) + +// class SfxFrequencyItem ------------------------------------------------- + +/////////////////////////////////////////////////////////////////////////////// +/* +FRQ_DAILY + * jeden X'ten Tag + nInterval1 = 1 .. 999 + + * jeden Wochentag + nInterval1 = USHRT_MAX + +FRQ_WEEKLY + + wiederhole jede X'te Woche + nInterval1 = 1 .. 99 + + + an SU, MO, TU, WE, TH, FR, SA + nInterval2 = WD_SUNDAY | WD_MONDAY | WD_TUESDAY | WD_WEDNESDAY | + WD_THURSDAY | WD_FRIDAY | WD_SATURDAY + +FRQ_MONTHLY_DAILY + * jeden X'ten Tag von jedem X'ten Monat + nInterval1 = 1 .. 31 + nInterval2 = 1 .. 6 + +FRQ_MONTHLY_LOGIC + * jeden ersten, zweiten, dritten, vierten oder letzten Wochentag jeden X'ten Monats + nInterval1 = 0 .. 4 + nInterval2 = WD_SUNDAY | WD_MONDAY | WD_TUESDAY | WD_WEDNESDAY | + WD_THURSDAY | WD_FRIDAY | WD_SATURDAY + nInterval3 = 1 .. 6 + +=============================================================================== + +FRQ_TIME_AT + * Update um Uhrzeit + nTime1 = 00:00:00 - 24:00:00 + +FRQ_TIME_REPEAT + * Wiederhole alle X Stunden + nTInterval1 = 1 .. 8 + + zwischen Uhrzeit 1 und 2 + nTime1 = 00:00:00 - 24:00:00 + nTime2 = 00:00:00 - 24:00:00 + +*/ +/////////////////////////////////////////////////////////////////////////////// + +enum FrequencyMode +{ + FRQ_DAILY = 1, + FRQ_WEEKLY = 2, + FRQ_MONTHLY_DAILY = 3, + FRQ_MONTHLY_LOGIC = 4 +}; + +enum FrequencyTimeMode +{ + FRQ_TIME_AT = 1, + FRQ_TIME_REPEAT = 2, + FRQ_TIME_REPEAT_RANGE = 3 +}; + +#define WD_SUNDAY 0x0001 +#define WD_MONDAY 0x0002 +#define WD_TUESDAY 0x0004 +#define WD_WEDNESDAY 0x0008 +#define WD_THURSDAY 0x0010 +#define WD_FRIDAY 0x0020 +#define WD_SATURDAY 0x0040 + +class SfxFrequencyItem : public SfxPoolItem +{ +private: + FrequencyMode eFrqMode; + FrequencyTimeMode eFrqTimeMode; + + USHORT nDInterval1; + USHORT nDInterval2; + USHORT nDInterval3; + + USHORT nTInterval1; + Time aTime1; + Time aTime2; + + BOOL bMissingDate; + DateTime aMissingDate; + + Time _CalcTime( BOOL bForToday ) const; +public: + TYPEINFO(); + + SfxFrequencyItem( const SfxFrequencyItem& rCpy ); + SfxFrequencyItem( USHORT nWhich ); + SfxFrequencyItem( USHORT nWhich, FrequencyMode eMode, FrequencyTimeMode eTMode, + USHORT nDI1, USHORT nDI2, USHORT nDI3, USHORT nTI1, + const Time& rT1, const Time& rT2 ); + ~SfxFrequencyItem() { DBG_DTOR(SfxFrequencyItem, 0); } + + virtual int operator==( const SfxPoolItem& ) const; + using SfxPoolItem::Compare; + virtual int Compare( const SfxPoolItem &rWith ) const; + virtual SfxPoolItem* Create( SvStream&, USHORT nItemVersion ) const; + virtual SvStream& Store( SvStream&, USHORT nItemVersion ) const; + virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, XubString &rText, + const IntlWrapper * = 0 ) const; + + DateTime CalcNextTick( const DateTime& rNow, BOOL bFirst = FALSE ); + + BOOL HasMissingDate() const { return bMissingDate; } + DateTime GetMissingDate() const { return aMissingDate; } + + FrequencyMode GetFrequencyMode() const { return eFrqMode; } + FrequencyTimeMode GetFrequencyTimeMode() const { return eFrqTimeMode; } + USHORT GetDInterval_1() const { return nDInterval1; } + USHORT GetDInterval_2() const { return nDInterval2; } + USHORT GetDInterval_3() const { return nDInterval3; } + USHORT GetTInterval_1() const { return nTInterval1; } + const Time& GetTime_1() const { return aTime1; } + const Time& GetTime_2() const { return aTime2; } + + void SetFrequencyMode(FrequencyMode eNew) { eFrqMode = eNew; } + void SetFrequencyTimeMode(FrequencyTimeMode eNew){ eFrqTimeMode = eNew; } + void SetDInterval_1(USHORT nNew) { nDInterval1 = nNew; } + void SetDInterval_2(USHORT nNew) { nDInterval2 = nNew; } + void SetDInterval_3(USHORT nNew) { nDInterval3 = nNew; } + void SetTInterval_1(USHORT nNew) { nTInterval1 = nNew; } + void SetTime_1(const Time& rNew) { aTime1 = rNew; } + void SetTime_2(const Time& rNew) { aTime2 = rNew; } +}; + +#endif + diff --git a/svl/inc/svl/globalnameitem.hxx b/svl/inc/svl/globalnameitem.hxx new file mode 100644 index 000000000000..f19ea1dd8457 --- /dev/null +++ b/svl/inc/svl/globalnameitem.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: globalnameitem.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _GLOBALNAMEITEM_HXX +#define _GLOBALNAMEITEM_HXX + +#include "svtools/svtdllapi.h" +#include +#include +#include +#include + +// ----------------------------------------------------------------------- + +class SVT_DLLPUBLIC SfxGlobalNameItem: public SfxPoolItem +{ + SvGlobalName m_aName; + +public: + TYPEINFO(); + SfxGlobalNameItem(); + SfxGlobalNameItem( USHORT nWhich, const SvGlobalName& ); + ~SfxGlobalNameItem(); + + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + SvGlobalName GetValue() const { return m_aName; } + + virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ); + virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ) const; +}; + +#endif + diff --git a/svl/inc/svl/hint.hxx b/svl/inc/svl/hint.hxx new file mode 100644 index 000000000000..9417b2bc1702 --- /dev/null +++ b/svl/inc/svl/hint.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: hint.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFXHINT_HXX +#define _SFXHINT_HXX + +#include "svtools/svldllapi.h" +#include + +class SVL_DLLPUBLIC SfxHint +{ +public: + TYPEINFO(); + + virtual ~SfxHint(); +}; + +//-------------------------------------------------------------------- + +#define DECL_PTRHINT(Visibility, Name, Type) \ + class Visibility Name: public SfxHint \ + { \ + Type* pObj; \ + BOOL bIsOwner; \ + \ + public: \ + TYPEINFO(); \ + Name( Type* Object, BOOL bOwnedByHint = FALSE ); \ + ~Name(); \ + \ + Type* GetObject() const { return pObj; } \ + BOOL IsOwner() const { return bIsOwner; } \ + } + +#define IMPL_PTRHINT_AUTODELETE(Name, Type) \ + TYPEINIT1(Name, SfxHint); \ + Name::Name( Type* pObject, BOOL bOwnedByHint ) \ + { pObj = pObject; bIsOwner = bOwnedByHint; } \ + Name::~Name() { if ( bIsOwner ) delete pObj; } + +#define IMPL_PTRHINT(Name, Type) \ + TYPEINIT1(Name, SfxHint); \ + Name::Name( Type* pObject, BOOL bOwnedByHint ) \ + { pObj = pObject; bIsOwner = bOwnedByHint; } \ + Name::~Name() {} + + +#endif + diff --git a/svl/inc/svl/httpcook.hxx b/svl/inc/svl/httpcook.hxx new file mode 100644 index 000000000000..354680a86f30 --- /dev/null +++ b/svl/inc/svl/httpcook.hxx @@ -0,0 +1,155 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: httpcook.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVTOOLS_HTTPCOOK_HXX +#define SVTOOLS_HTTPCOOK_HXX + +#include +#include +#include +#include + +/*======================================================================= + * + *=====================================================================*/ +#define CNTHTTP_COOKIE_FLAG_SECURE 0x01 + +#define CNTHTTP_COOKIE_POLICY_INTERACTIVE 0x00 +#define CNTHTTP_COOKIE_POLICY_ACCEPTED 0x01 +#define CNTHTTP_COOKIE_POLICY_BANNED 0x02 + +#define CNTHTTP_COOKIE_DOMAIN_POLICY 0x10 + +#define CNTHTTP_COOKIE_DOMAIN_ACCEPTED \ + (CNTHTTP_COOKIE_DOMAIN_POLICY | CNTHTTP_COOKIE_POLICY_ACCEPTED) +#define CNTHTTP_COOKIE_DOMAIN_BANNED \ + (CNTHTTP_COOKIE_DOMAIN_POLICY | CNTHTTP_COOKIE_POLICY_BANNED) + +/*======================================================================= + * + * CntHTTPCookie. + * + *=====================================================================*/ +struct CntHTTPCookie +{ + String m_aName; + String m_aValue; + String m_aDomain; + String m_aPath; + DateTime m_aExpires; + USHORT m_nFlags; + USHORT m_nPolicy; + + CntHTTPCookie (void) + : m_aExpires (Date(0), Time(0)), + m_nFlags (0), + m_nPolicy (CNTHTTP_COOKIE_POLICY_INTERACTIVE) + {} + + BOOL replaces (const CntHTTPCookie& rOther) const + { + return ((m_aDomain == rOther.m_aDomain) && + (m_aPath == rOther.m_aPath ) && + (m_aName == rOther.m_aName ) ); + } + + BOOL operator== (const CntHTTPCookie& rOther) const + { + return ((m_aName == rOther.m_aName ) && + (m_aValue == rOther.m_aValue ) && + (m_aDomain == rOther.m_aDomain ) && + (m_aPath == rOther.m_aPath ) && + (m_aExpires == rOther.m_aExpires) && + (m_nFlags == rOther.m_nFlags ) && + (m_nPolicy == rOther.m_nPolicy ) ); + } + + void write (SvStream& rStrm) const + { + SfxPoolItem::writeUnicodeString(rStrm, m_aName); + SfxPoolItem::writeUnicodeString(rStrm, m_aValue); + SfxPoolItem::writeUnicodeString(rStrm, m_aDomain); + SfxPoolItem::writeUnicodeString(rStrm, m_aPath); + + rStrm << m_aExpires.GetDate(); + rStrm << m_aExpires.GetTime(); + + rStrm << m_nFlags; + rStrm << m_nPolicy; + } + + void read (SvStream& rStrm, bool bUnicode) + { + SfxPoolItem::readUnicodeString(rStrm, m_aName, bUnicode); + SfxPoolItem::readUnicodeString(rStrm, m_aValue, bUnicode); + SfxPoolItem::readUnicodeString(rStrm, m_aDomain, bUnicode); + SfxPoolItem::readUnicodeString(rStrm, m_aPath, bUnicode); + + sal_uInt32 nValue = 0; + rStrm >> nValue; + m_aExpires.SetDate (nValue); + rStrm >> nValue; + m_aExpires.SetTime (nValue); + + rStrm >> m_nFlags; + rStrm >> m_nPolicy; + } +}; + +/*======================================================================= + * + * CntHTTPCookieRequest. + * + *=====================================================================*/ +enum CntHTTPCookieRequestType +{ + CNTHTTP_COOKIE_REQUEST_RECV = 0, + CNTHTTP_COOKIE_REQUEST_SEND +}; + +struct CntHTTPCookieRequest +{ + const String& m_rURL; + List& m_rCookieList; + CntHTTPCookieRequestType m_eType; + USHORT m_nRet; + + CntHTTPCookieRequest ( + const String& rURL, + List& rCookieList, + CntHTTPCookieRequestType eType) + : m_rURL (rURL), + m_rCookieList (rCookieList), + m_eType(eType), + m_nRet (CNTHTTP_COOKIE_POLICY_BANNED) {} +}; + +#endif // SVTOOLS_HTTPCOOK_HXX + diff --git a/svl/inc/svl/ilstitem.hxx b/svl/inc/svl/ilstitem.hxx new file mode 100644 index 000000000000..0bc76f1d0627 --- /dev/null +++ b/svl/inc/svl/ilstitem.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ilstitem.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SFXILSTITEM_HXX +#define _SFXILSTITEM_HXX + +#include "svtools/svldllapi.h" +#include +#include + +class SvULongs; + +class SVL_DLLPUBLIC SfxIntegerListItem : public SfxPoolItem +{ + ::com::sun::star::uno::Sequence < sal_Int32 > m_aList; + +public: + TYPEINFO(); + + SfxIntegerListItem(); + SfxIntegerListItem( USHORT nWhich, const SvULongs& rList ); + SfxIntegerListItem( const SfxIntegerListItem& rItem ); + ~SfxIntegerListItem(); + + ::com::sun::star::uno::Sequence < sal_Int32 > GetSequence() + { return m_aList; } + ::com::sun::star::uno::Sequence < sal_Int32 > GetConstSequence() const + { return SAL_CONST_CAST(SfxIntegerListItem *, this)->GetSequence(); } + + void GetList( SvULongs& rList ) const; + + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; +}; + +#endif // _SFXINTITEM_HXX + diff --git a/svl/inc/svl/imageitm.hxx b/svl/inc/svl/imageitm.hxx new file mode 100644 index 000000000000..e0151729c2e0 --- /dev/null +++ b/svl/inc/svl/imageitm.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: imageitm.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVT_IMAGEITM_HXX +#define _SVT_IMAGEITM_HXX + +#include "svtools/svtdllapi.h" +#include + +class String; + +struct SfxImageItem_Impl; +class SVT_DLLPUBLIC SfxImageItem : public SfxInt16Item +{ + SfxImageItem_Impl* pImp; +public: + TYPEINFO(); + SfxImageItem( USHORT nWhich = 0, UINT16 nImage = 0 ); + SfxImageItem( USHORT nWhich, const String& rURL ); + SfxImageItem( const SfxImageItem& ); + virtual ~SfxImageItem(); + + virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; + virtual int operator==( const SfxPoolItem& ) const; + virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; + virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + + void SetRotation( long nValue ); + long GetRotation() const; + void SetMirrored( BOOL bSet ); + BOOL IsMirrored() const; + String GetURL() const; +}; + +#endif // _SFX_IMAGEITM_HXX diff --git a/svl/inc/svl/inethist.hxx b/svl/inc/svl/inethist.hxx new file mode 100644 index 000000000000..ad64e1131bf3 --- /dev/null +++ b/svl/inc/svl/inethist.hxx @@ -0,0 +1,135 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: inethist.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _INETHIST_HXX +#define _INETHIST_HXX + +#include "svtools/svldllapi.h" +#include +#include +#include +#include +#include + +/*======================================================================== + * + * INetURLHistory interface. + * + *=======================================================================*/ +class INetURLHistory_Impl; +class INetURLHistory : public SfxBroadcaster +{ + struct StaticInstance + { + INetURLHistory * operator()(); + }; + friend INetURLHistory * StaticInstance::operator()(); + + /** Representation. + */ + INetURLHistory_Impl *m_pImpl; + + /** Construction/Destruction. + */ + INetURLHistory (void); + virtual ~INetURLHistory (void); + + /** Implementation. + */ + static void NormalizeUrl_Impl (INetURLObject &rUrl); + + SVL_DLLPUBLIC void PutUrl_Impl (const INetURLObject &rUrl); + SVL_DLLPUBLIC BOOL QueryUrl_Impl (const INetURLObject &rUrl); + + /** Not implemented. + */ + INetURLHistory (const INetURLHistory&); + INetURLHistory& operator= (const INetURLHistory&); + +public: + /** GetOrCreate. + */ + SVL_DLLPUBLIC static INetURLHistory* GetOrCreate (void); + + /** QueryProtocol. + */ + BOOL QueryProtocol (INetProtocol eProto) const + { + return ((eProto == INET_PROT_FILE ) || + (eProto == INET_PROT_FTP ) || + (eProto == INET_PROT_HTTP ) || + (eProto == INET_PROT_HTTPS) ); + } + + /** QueryUrl. + */ + BOOL QueryUrl (const INetURLObject &rUrl) + { + if (QueryProtocol (rUrl.GetProtocol())) + return QueryUrl_Impl (rUrl); + else + return FALSE; + } + + BOOL QueryUrl (const String &rUrl) + { + INetProtocol eProto = + INetURLObject::CompareProtocolScheme (rUrl); + if (QueryProtocol (eProto)) + return QueryUrl_Impl (INetURLObject (rUrl)); + else + return FALSE; + } + + /** PutUrl. + */ + void PutUrl (const INetURLObject &rUrl) + { + if (QueryProtocol (rUrl.GetProtocol())) + PutUrl_Impl (rUrl); + } + + void PutUrl (const String &rUrl) + { + INetProtocol eProto = + INetURLObject::CompareProtocolScheme (rUrl); + if (QueryProtocol (eProto)) + PutUrl_Impl (INetURLObject (rUrl)); + } +}; + +/*======================================================================== + * + * INetURLHistoryHint (broadcasted from PutUrl()). + * + *=======================================================================*/ +DECL_PTRHINT (SVL_DLLPUBLIC, INetURLHistoryHint, const INetURLObject); + +#endif /* _INETHIST_HXX */ + diff --git a/svl/inc/svl/inettype.hxx b/svl/inc/svl/inettype.hxx new file mode 100644 index 000000000000..2d9f0ba8694c --- /dev/null +++ b/svl/inc/svl/inettype.hxx @@ -0,0 +1,479 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: inettype.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _INETTYPE_HXX +#define _INETTYPE_HXX + +#include "svtools/svldllapi.h" +#include +#include + +//============================================================================ +/** Definitions for frequently used media type names. + */ +#define CONTENT_TYPE_STR_APP_OCTSTREAM "application/octet-stream" +#define CONTENT_TYPE_STR_APP_PDF "application/pdf" +#define CONTENT_TYPE_STR_APP_RTF "application/rtf" +#define CONTENT_TYPE_STR_APP_VND_CALC "application/vnd.stardivision.calc" +#define CONTENT_TYPE_STR_APP_VND_CHART "application/vnd.stardivision.chart" +#define CONTENT_TYPE_STR_APP_VND_DRAW "application/vnd.stardivision.draw" +#define CONTENT_TYPE_STR_APP_VND_IMAGE "application/vnd.stardivision.image" +#define CONTENT_TYPE_STR_APP_VND_IMPRESSPACKED \ + "application/vnd.stardivision.impress-packed" +#define CONTENT_TYPE_STR_APP_VND_IMPRESS \ + "application/vnd.stardivision.impress" +#define CONTENT_TYPE_STR_APP_VND_MAIL "application/vnd.stardivision.mail" +#define CONTENT_TYPE_STR_APP_VND_MATH "application/vnd.stardivision.math" +#define CONTENT_TYPE_STR_APP_VND_NEWS "application/vnd.stardivision.news" +#define CONTENT_TYPE_STR_APP_VND_OUTTRAY \ + "application/vnd.stardivision.outtray" +#define CONTENT_TYPE_STR_APP_VND_TEMPLATE \ + "application/vnd.stardivision.template" +#define CONTENT_TYPE_STR_APP_VND_WRITER_GLOBAL \ + "application/vnd.stardivision.writer-global" +#define CONTENT_TYPE_STR_APP_VND_WRITER_WEB \ + "application/vnd.stardivision.writer-web" +#define CONTENT_TYPE_STR_APP_VND_WRITER "application/vnd.stardivision.writer" +#define CONTENT_TYPE_STR_APP_FRAMESET "application/x-frameset" +#define CONTENT_TYPE_STR_APP_GALLERY_THEME "application/x-gallery-theme" +#define CONTENT_TYPE_STR_APP_GALLERY "application/x-gallery" +#define CONTENT_TYPE_STR_APP_JAR "application/x-jar" +#define CONTENT_TYPE_STR_APP_MACRO "application/x-macro" +#define CONTENT_TYPE_STR_APP_MSEXCEL_TEMPL "application/x-msexcel-template" +#define CONTENT_TYPE_STR_APP_MSEXCEL "application/x-msexcel" +#define CONTENT_TYPE_STR_APP_MSPPOINT_TEMPL "application/x-mspowerpoint-template" +#define CONTENT_TYPE_STR_APP_MSPPOINT "application/x-mspowerpoint" +#define CONTENT_TYPE_STR_APP_MSWORD_TEMPL "application/x-msword-template" +#define CONTENT_TYPE_STR_APP_MSWORD "application/x-msword" +#define CONTENT_TYPE_STR_APP_SCHEDULE_EVT "application/x-schedule-event" +#define CONTENT_TYPE_STR_APP_SCHEDULE_FEVT "application/x-schedule-form-event" +#define CONTENT_TYPE_STR_APP_SCHEDULE_FTASK "application/x-schedule-form-task" +#define CONTENT_TYPE_STR_APP_SCHEDULE_TASK "application/x-schedule-task" +#define CONTENT_TYPE_STR_APP_SCHEDULE_CMB "application/x-schedule" +#define CONTENT_TYPE_STR_APP_STARCALC "application/x-starcalc" +#define CONTENT_TYPE_STR_APP_STARCHART "application/x-starchart" +#define CONTENT_TYPE_STR_APP_STARDRAW "application/x-stardraw" +#define CONTENT_TYPE_STR_APP_STARHELP "application/x-starhelp" +#define CONTENT_TYPE_STR_APP_STARIMAGE "application/x-starimage" +#define CONTENT_TYPE_STR_APP_STARIMPRESS "application/x-starimpress" +#define CONTENT_TYPE_STR_APP_STARMAIL_SDM "application/x-starmail-sdm" +#define CONTENT_TYPE_STR_APP_STARMAIL_SMD "application/x-starmail-smd" +#define CONTENT_TYPE_STR_APP_STARMATH "application/x-starmath" +#define CONTENT_TYPE_STR_APP_STARWRITER_GLOB "application/x-starwriter-global" +#define CONTENT_TYPE_STR_APP_STARWRITER "application/x-starwriter" +#define CONTENT_TYPE_STR_APP_CDE_CALENDAR_APP "application/x-sun-ae-file" +#define CONTENT_TYPE_STR_APP_ZIP "application/x-zip-compressed" +#define CONTENT_TYPE_STR_AUDIO_AIFF "audio/aiff" +#define CONTENT_TYPE_STR_AUDIO_BASIC "audio/basic" +#define CONTENT_TYPE_STR_AUDIO_MIDI "audio/midi" +#define CONTENT_TYPE_STR_AUDIO_WAV "audio/wav" +#define CONTENT_TYPE_STR_X_CNT_DOCUMENT ".chaos/document" +#define CONTENT_TYPE_STR_X_CNT_FSYSBOX ".chaos/fsys-box" +#define CONTENT_TYPE_STR_X_CNT_CDROM_VOLUME ".chaos/fsys-cdrom-volume" +#define CONTENT_TYPE_STR_X_CNT_DISK_35 ".chaos/fsys-disk-35" +#define CONTENT_TYPE_STR_X_CNT_DISK_525 ".chaos/fsys-disk-525" +#define CONTENT_TYPE_STR_X_CNT_FSYSFILE ".chaos/fsys-file" +#define CONTENT_TYPE_STR_X_CNT_FIXED_VOLUME ".chaos/fsys-fixed-volume" +#define CONTENT_TYPE_STR_X_CNT_FSYSFOLDER ".chaos/fsys-folder" +#define CONTENT_TYPE_STR_X_CNT_RAM_VOLUME ".chaos/fsys-ram-volume" +#define CONTENT_TYPE_STR_X_CNT_REMOTE_VOLUME ".chaos/fsys-remote-volume" +#define CONTENT_TYPE_STR_X_CNT_REMOVEABLE_VOLUME \ + ".chaos/fsys-removeable-volume" +#define CONTENT_TYPE_STR_X_CNT_FSYSSPECIALFILE ".chaos/fsys-special-file" +#define CONTENT_TYPE_STR_X_CNT_FSYSSPECIALFOLDER ".chaos/fsys-special-folder" +#define CONTENT_TYPE_STR_X_CNT_TAPEDRIVE ".chaos/fsys-tapedrive" +#define CONTENT_TYPE_STR_X_CNT_FSYSURLFILE ".chaos/fsys-urlfile" +#define CONTENT_TYPE_STR_X_CNT_FTPBOX ".chaos/ftp-box" +#define CONTENT_TYPE_STR_X_CNT_FTPFILE ".chaos/ftp-file" +#define CONTENT_TYPE_STR_X_CNT_FTPFOLDER ".chaos/ftp-folder" +#define CONTENT_TYPE_STR_X_CNT_FTPLINK ".chaos/ftp-link" +#define CONTENT_TYPE_STR_X_CNT_HTTPBOX ".chaos/http-box" +#define CONTENT_TYPE_STR_X_CNT_HTTPFILE ".chaos/http-file" +#define CONTENT_TYPE_STR_X_CNT_IMAPBOX ".chaos/imap-box" +#define CONTENT_TYPE_STR_X_CNT_IMAPFOLDER ".chaos/imap-folder" +#define CONTENT_TYPE_STR_X_CNT_MESSAGE ".chaos/message" +#define CONTENT_TYPE_STR_X_CNT_NEWSBOX ".chaos/news-box" +#define CONTENT_TYPE_STR_X_CNT_NEWSGROUP ".chaos/news-group" +#define CONTENT_TYPE_STR_X_CNT_OUTBOX ".chaos/out-box" +#define CONTENT_TYPE_STR_X_CNT_POP3BOX ".chaos/pop3-box" +#define CONTENT_TYPE_STR_X_CNT_PUBLISHBOX ".chaos/publish-box" +#define CONTENT_TYPE_STR_X_CNT_SEARCHBOX ".chaos/search-box" +#define CONTENT_TYPE_STR_X_CNT_SEPARATOR ".chaos/separator" +#define CONTENT_TYPE_STR_X_CNT_BOOKMARK ".chaos/subscribe-bookmark" +#define CONTENT_TYPE_STR_X_CNT_SUBSCRIBEBOX ".chaos/subscribe-box" +#define CONTENT_TYPE_STR_X_CNT_CDFITEM ".chaos/subscribe-cdf-item" +#define CONTENT_TYPE_STR_X_CNT_CDFSUB ".chaos/subscribe-cdf-sub" +#define CONTENT_TYPE_STR_X_CNT_CDF ".chaos/subscribe-cdf" +#define CONTENT_TYPE_STR_X_CNT_STARCHANNEL ".chaos/subscribe-sdc" +#define CONTENT_TYPE_STR_X_CNT_TRASHBOX ".chaos/trash-box" +#define CONTENT_TYPE_STR_X_CNT_TRASH ".chaos/trash-item" +#define CONTENT_TYPE_STR_X_CNT_VIMBBOARDBOX ".chaos/vim-bboardbox" +#define CONTENT_TYPE_STR_X_CNT_VIMBBOARD ".chaos/vim-bboard" +#define CONTENT_TYPE_STR_X_CNT_VIMBOX ".chaos/vim-box" +#define CONTENT_TYPE_STR_X_CNT_VIMINBOX ".chaos/vim-inbox" +#define CONTENT_TYPE_STR_IMAGE_GENERIC "image/generic" +#define CONTENT_TYPE_STR_IMAGE_GIF "image/gif" +#define CONTENT_TYPE_STR_IMAGE_JPEG "image/jpeg" +#define CONTENT_TYPE_STR_IMAGE_PCX "image/pcx" +#define CONTENT_TYPE_STR_IMAGE_PNG "image/png" +#define CONTENT_TYPE_STR_IMAGE_TIFF "image/tiff" +#define CONTENT_TYPE_STR_IMAGE_BMP "image/x-MS-bmp" +#define CONTENT_TYPE_STR_INET_MSG_RFC822 "message/rfc822" +#define CONTENT_TYPE_STR_INET_MULTI_ALTERNATIVE "multipart/alternative" +#define CONTENT_TYPE_STR_INET_MULTI_DIGEST "multipart/digest" +#define CONTENT_TYPE_STR_INET_MULTI_MIXED "multipart/mixed" +#define CONTENT_TYPE_STR_INET_MULTI_PARALLEL "multipart/parallel" +#define CONTENT_TYPE_STR_INET_MULTI_RELATED "multipart/related" +#define CONTENT_TYPE_STR_TEXT_ICALENDAR "text/calendar" +#define CONTENT_TYPE_STR_TEXT_HTML "text/html" +#define CONTENT_TYPE_STR_TEXT_PLAIN "text/plain" +#define CONTENT_TYPE_STR_TEXT_XMLICALENDAR "text/x-icalxml" +#define CONTENT_TYPE_STR_TEXT_URL "text/x-url" +#define CONTENT_TYPE_STR_TEXT_VCALENDAR "text/x-vCalendar" +#define CONTENT_TYPE_STR_TEXT_VCARD "text/x-vCard" +#define CONTENT_TYPE_STR_VIDEO_VDO "video/vdo" +#define CONTENT_TYPE_STR_VIDEO_MSVIDEO "video/x-msvideo" +#define CONTENT_TYPE_STR_X_STARMAIL "x-starmail" +#define CONTENT_TYPE_STR_X_VRML "x-world/x-vrml" +#define CONTENT_TYPE_STR_APP_VND_SUN_XML_WRITER "application/vnd.sun.xml.writer" +#define CONTENT_TYPE_STR_APP_VND_SUN_XML_CALC "application/vnd.sun.xml.calc" +#define CONTENT_TYPE_STR_APP_VND_SUN_XML_IMPRESS "application/vnd.sun.xml.impress" +#define CONTENT_TYPE_STR_APP_VND_SUN_XML_DRAW "application/vnd.sun.xml.draw" +#define CONTENT_TYPE_STR_APP_VND_SUN_XML_CHART "application/vnd.sun.xml.chart" + +#define CONTENT_TYPE_STR_APP_VND_SUN_XML_MATH "application/vnd.sun.xml.math" +#define CONTENT_TYPE_STR_APP_VND_SUN_XML_WRITER_GLOBAL "application/vnd.sun.xml.writer-global" +#define CONTENT_TYPE_STR_APP_VND_SUN_XML_IMPRESSPACKED "application/vnd.sun.xml.impress-packed" + +//============================================================================ +/** Definitions for frequently used media type parameter names. + */ +#define INET_CONTENT_TYPE_PARAMETER_CHARSET "charset" + +//============================================================================ +/** Definitions for matching parts of URIs. + */ +#define INETTYPE_URL_PROT_COMPONENT ".component" +#define INETTYPE_URL_PROT_DATA "data" +#define INETTYPE_URL_PROT_FILE "file" +#define INETTYPE_URL_PROT_HTTP "http" +#define INETTYPE_URL_PROT_HTTPS "https" +#define INETTYPE_URL_PROT_MACRO "macro" +#define INETTYPE_URL_PROT_MAILTO "mailto" +#define INETTYPE_URL_PROT_PRIVATE "private" + +#define INETTYPE_URL_SUB_FACTORY "factory" +#define INETTYPE_URL_SUB_HELPID "helpid" + +#define INETTYPE_URL_SSUB_FRAMESET "frameset" +#define INETTYPE_URL_SSUB_SCALC "scalc" +#define INETTYPE_URL_SSUB_SCHART "schart" +#define INETTYPE_URL_SSUB_SDRAW "sdraw" +#define INETTYPE_URL_SSUB_SIMAGE "simage" +#define INETTYPE_URL_SSUB_SIMPRESS "simpress" +#define INETTYPE_URL_SSUB_SMATH "smath" +#define INETTYPE_URL_SSUB_SS "ss" +#define INETTYPE_URL_SSUB_SWRITER "swriter" + +#define INETTYPE_URL_SSSUB_GLOB "GlobalDocument" +#define INETTYPE_URL_SSSUB_WEB "web" + +#define INETTYPE_URL_SCHED_CMB "cmbview" +#define INETTYPE_URL_SCHED_FORM "formular" +#define INETTYPE_URL_SCHED_EVENT "type=event" +#define INETTYPE_URL_SCHED_TASK "type=task" + +//============================================================================ +enum INetContentType +{ + CONTENT_TYPE_UNKNOWN, + CONTENT_TYPE_APP_OCTSTREAM, + CONTENT_TYPE_APP_PDF, + CONTENT_TYPE_APP_RTF, + CONTENT_TYPE_APP_MSWORD, + CONTENT_TYPE_APP_MSWORD_TEMPL, + CONTENT_TYPE_APP_STARCALC, + CONTENT_TYPE_APP_STARCHART, + CONTENT_TYPE_APP_STARDRAW, + CONTENT_TYPE_APP_STARHELP, + CONTENT_TYPE_APP_STARIMAGE, + CONTENT_TYPE_APP_STARIMPRESS, + CONTENT_TYPE_APP_STARMATH, + CONTENT_TYPE_APP_STARWRITER, + CONTENT_TYPE_APP_ZIP, + CONTENT_TYPE_AUDIO_AIFF, + CONTENT_TYPE_AUDIO_BASIC, + CONTENT_TYPE_AUDIO_MIDI, + CONTENT_TYPE_AUDIO_WAV, + CONTENT_TYPE_IMAGE_GIF, + CONTENT_TYPE_IMAGE_JPEG, + CONTENT_TYPE_IMAGE_PCX, + CONTENT_TYPE_IMAGE_PNG, + CONTENT_TYPE_IMAGE_TIFF, + CONTENT_TYPE_IMAGE_BMP, + CONTENT_TYPE_TEXT_HTML, + CONTENT_TYPE_TEXT_PLAIN, + CONTENT_TYPE_TEXT_URL, + CONTENT_TYPE_TEXT_VCARD, + CONTENT_TYPE_VIDEO_VDO, + CONTENT_TYPE_VIDEO_MSVIDEO, + CONTENT_TYPE_X_CNT_MESSAGE, + CONTENT_TYPE_X_CNT_DOCUMENT, + CONTENT_TYPE_X_CNT_POP3BOX, + CONTENT_TYPE_X_CNT_IMAPBOX, + CONTENT_TYPE_X_CNT_IMAPFOLDER, + CONTENT_TYPE_X_CNT_VIMBOX, + CONTENT_TYPE_X_CNT_VIMINBOX, + CONTENT_TYPE_X_CNT_VIMBBOARDBOX, + CONTENT_TYPE_X_CNT_VIMBBOARD, + CONTENT_TYPE_X_CNT_NEWSBOX, + CONTENT_TYPE_X_CNT_NEWSGROUP, + CONTENT_TYPE_X_CNT_OUTBOX, + CONTENT_TYPE_X_CNT_FTPBOX, + CONTENT_TYPE_X_CNT_FTPFOLDER, + CONTENT_TYPE_X_CNT_FTPFILE, + CONTENT_TYPE_X_CNT_FTPLINK, + CONTENT_TYPE_X_CNT_HTTPBOX, + CONTENT_TYPE_X_CNT_FSYSBOX, + CONTENT_TYPE_X_CNT_FSYSFOLDER, + CONTENT_TYPE_X_CNT_FSYSFILE, + CONTENT_TYPE_X_CNT_FSYSURLFILE, + CONTENT_TYPE_X_CNT_PUBLISHBOX, + CONTENT_TYPE_X_CNT_SEARCHBOX, + CONTENT_TYPE_X_CNT_SUBSCRIBEBOX, + CONTENT_TYPE_X_CNT_BOOKMARK, + CONTENT_TYPE_X_CNT_CDF, + CONTENT_TYPE_X_CNT_CDFSUB, + CONTENT_TYPE_X_CNT_CDFITEM, + CONTENT_TYPE_X_CNT_TRASHBOX, + CONTENT_TYPE_X_CNT_TRASH, + CONTENT_TYPE_X_STARMAIL, + CONTENT_TYPE_X_VRML, + CONTENT_TYPE_X_CNT_REMOVEABLE_VOLUME, + CONTENT_TYPE_X_CNT_FIXED_VOLUME, + CONTENT_TYPE_X_CNT_REMOTE_VOLUME, + CONTENT_TYPE_X_CNT_RAM_VOLUME, + CONTENT_TYPE_X_CNT_CDROM_VOLUME, + CONTENT_TYPE_X_CNT_DISK_35, + CONTENT_TYPE_X_CNT_DISK_525, + CONTENT_TYPE_X_CNT_TAPEDRIVE, + CONTENT_TYPE_APP_GALLERY, + CONTENT_TYPE_APP_GALLERY_THEME, + CONTENT_TYPE_X_CNT_STARCHANNEL, + CONTENT_TYPE_X_CNT_SEPARATOR, + CONTENT_TYPE_APP_STARWRITER_GLOB, + CONTENT_TYPE_APP_STARMAIL_SDM, + CONTENT_TYPE_APP_STARMAIL_SMD, + CONTENT_TYPE_APP_VND_CALC, + CONTENT_TYPE_APP_VND_CHART, + CONTENT_TYPE_APP_VND_DRAW, + CONTENT_TYPE_APP_VND_IMAGE, + CONTENT_TYPE_APP_VND_IMPRESS, + CONTENT_TYPE_APP_VND_MAIL, + CONTENT_TYPE_APP_VND_MATH, + CONTENT_TYPE_APP_VND_WRITER, + CONTENT_TYPE_APP_VND_WRITER_GLOBAL, + CONTENT_TYPE_APP_VND_WRITER_WEB, + CONTENT_TYPE_APP_SCHEDULE, + CONTENT_TYPE_APP_SCHEDULE_EVT, + CONTENT_TYPE_APP_SCHEDULE_TASK, + CONTENT_TYPE_APP_SCHEDULE_FORM_EVT, + CONTENT_TYPE_APP_SCHEDULE_FORM_TASK, + CONTENT_TYPE_APP_FRAMESET, + CONTENT_TYPE_APP_MACRO, + CONTENT_TYPE_X_CNT_FSYSSPECIALFOLDER, + CONTENT_TYPE_X_CNT_FSYSSPECIALFILE, + CONTENT_TYPE_APP_VND_TEMPLATE, + CONTENT_TYPE_IMAGE_GENERIC, + CONTENT_TYPE_APP_VND_NEWS, + CONTENT_TYPE_APP_VND_OUTTRAY, + CONTENT_TYPE_X_CNT_HTTPFILE, + CONTENT_TYPE_APP_MSEXCEL, + CONTENT_TYPE_APP_MSEXCEL_TEMPL, + CONTENT_TYPE_APP_MSPPOINT, + CONTENT_TYPE_APP_MSPPOINT_TEMPL, + CONTENT_TYPE_TEXT_VCALENDAR, + CONTENT_TYPE_TEXT_ICALENDAR, + CONTENT_TYPE_TEXT_XMLICALENDAR, + CONTENT_TYPE_APP_CDE_CALENDAR_APP, + CONTENT_TYPE_INET_MESSAGE_RFC822, + CONTENT_TYPE_INET_MULTIPART_ALTERNATIVE, + CONTENT_TYPE_INET_MULTIPART_DIGEST, + CONTENT_TYPE_INET_MULTIPART_PARALLEL, + CONTENT_TYPE_INET_MULTIPART_RELATED, + CONTENT_TYPE_INET_MULTIPART_MIXED, + CONTENT_TYPE_APP_VND_IMPRESSPACKED, + CONTENT_TYPE_APP_JAR, + CONTENT_TYPE_APP_VND_SUN_XML_WRITER, + CONTENT_TYPE_APP_VND_SUN_XML_CALC, + CONTENT_TYPE_APP_VND_SUN_XML_IMPRESS, + CONTENT_TYPE_APP_VND_SUN_XML_DRAW, + CONTENT_TYPE_APP_VND_SUN_XML_CHART, + CONTENT_TYPE_APP_VND_SUN_XML_MATH, + CONTENT_TYPE_APP_VND_SUN_XML_WRITER_GLOBAL, + CONTENT_TYPE_APP_VND_SUN_XML_IMPRESSPACKED, + CONTENT_TYPE_LAST = CONTENT_TYPE_APP_VND_SUN_XML_IMPRESSPACKED +}; + +//============================================================================ +class SVL_DLLPUBLIC INetContentTypes +{ +public: + static void Uninitialize(); + + static INetContentType RegisterContentType(UniString const & rTypeName, + UniString const & + rPresentation, + UniString const * pExtension + = 0, + UniString const * + pSystemFileType = 0); + + static INetContentType GetContentType(UniString const & rTypeName); + + static UniString GetContentType(INetContentType eTypeID); + + static UniString GetPresentation(INetContentType eTypeID, + const ::com::sun::star::lang::Locale& aLocale); + + static UniString GetExtension(UniString const & rTypeName); + + static INetContentType GetContentType4Extension(UniString const & + rExtension); + + static INetContentType GetContentTypeFromURL(UniString const & rURL); + + static bool GetExtensionFromURL(UniString const & rURL, + UniString & rExtension); + + static INetContentType MapStringToContentType(UniString const & + rPresentation); + + /** Parse the body of an RFC 2045 Content-Type header field. + + @param rMediaType The body of the Content-Type header field. It must + be of the form + + token "/" token *(";" token "=" (token / quoted-string)) + + with intervening linear white space and comments (cf. RFCs 822, 2045). + The RFC 2231 extension are supported. The encoding of rMediaType + should be US-ASCII, but any values in the range 0x80--0xFF are + interpretet 'as appropriate.' + + @param rType Returns the type (the first of the above tokens), in US- + ASCII encoding and converted to lower case. + + @param rSubType Returns the sub type (the second of the above + tokens), in US-ASCII encoding and converted to lower case. + + @param rParameters If not null, returns the parameters as a list of + INetContentTypeParameters (the attributes are in US-ASCII encoding and + converted to lower case, the values are in Unicode encoding). If + null, only the syntax of the parameters is checked, but they are not + returned. + + @return True if the syntax of the field body is correct. If false is + returned, none of the output parameters will be modified! + */ + static bool parse(ByteString const & rMediaType, ByteString & rType, + ByteString & rSubType, + INetContentTypeParameterList * pParameters = 0); + + /** Parse the body of an RFC 2045 Content-Type header field. + + @param rMediaType The body of the Content-Type header field. It must + be of the form + + token "/" token *(";" token "=" (token / quoted-string)) + + with intervening linear white space and comments (cf. RFCs 822, 2045). + The RFC 2231 extension are supported. The encoding of rMediaType + should be US-ASCII, but any Unicode values in the range U+0080..U+FFFF + are interpretet 'as appropriate.' + + @param rType Returns the type (the first of the above tokens), in US- + ASCII encoding and converted to lower case. + + @param rSubType Returns the sub type (the second of the above + tokens), in US-ASCII encoding and converted to lower case. + + @param rParameters If not null, returns the parameters as a list of + INetContentTypeParameters (the attributes are in US-ASCII encoding and + converted to lower case, the values are in Unicode encoding). If + null, only the syntax of the parameters is checked, but they are not + returned. + + @return True if the syntax of the field body is correct. If false is + returned, none of the output parameters will be modified! + */ + static bool parse(UniString const & rMediaType, UniString & rType, + UniString & rSubType, + INetContentTypeParameterList * pParameters = 0); + + /** Append a parameter to the string representation of a MIME media type. + + @param rMediaType The string representation of a MIME media type. + + @param rAttribute The name of the parameter. Must be a valid RFC + 2045 token. + + @param rValue The value of the paramter. Must only consist of US- + ASCII characters. + + @return The string representation of rMediaType with the new + parameter appended. It is not checked whether a parameter with that + name already existed in rMediaType. + */ + static ByteString appendUSASCIIParameter(ByteString const & rMediaType, + ByteString const & rAttribute, + ByteString const & rValue); + + /** Append a parameter to the string representation of a MIME media type. + + @param rMediaType The string representation of a MIME media type. + + @param rAttribute The name of the parameter. Must be a valid RFC + 2045 token. + + @param rValue The value of the paramter. Must only consist of US- + ASCII characters. + + @return The string representation of rMediaType with the new + parameter appended. It is not checked whether a parameter with that + name already existed in rMediaType. + */ + static UniString appendUSASCIIParameter(UniString const & rMediaType, + UniString const & rAttribute, + UniString const & rValue); +}; + +#endif // _INETTYPE_HXX + diff --git a/svl/inc/svl/intitem.hxx b/svl/inc/svl/intitem.hxx new file mode 100644 index 000000000000..fe2a3543e630 --- /dev/null +++ b/svl/inc/svl/intitem.hxx @@ -0,0 +1,176 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: intitem.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SFXINTITEM_HXX +#define _SFXINTITEM_HXX + +#include "svtools/svtdllapi.h" +#include + +//============================================================================ +class SVT_DLLPUBLIC SfxByteItem: public CntByteItem +{ +public: + TYPEINFO(); + + SfxByteItem(USHORT which = 0, BYTE nValue = 0): + CntByteItem(which, nValue) {} + + SfxByteItem(USHORT which, SvStream & rStream): + CntByteItem(which, rStream) {} + + virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const; + + virtual SfxPoolItem * Clone(SfxItemPool * = 0) const + { return new SfxByteItem(*this); } +}; + +//============================================================================ +DBG_NAMEEX_VISIBILITY(SfxInt16Item, SVT_DLLPUBLIC) + +class SVT_DLLPUBLIC SfxInt16Item: public SfxPoolItem +{ + INT16 m_nValue; + +public: + TYPEINFO(); + + SfxInt16Item(USHORT which = 0, INT16 nTheValue = 0): + SfxPoolItem(which), m_nValue(nTheValue) + { DBG_CTOR(SfxInt16Item, 0); } + + SfxInt16Item(USHORT nWhich, SvStream & rStream); + + SfxInt16Item(const SfxInt16Item & rItem): + SfxPoolItem(rItem), m_nValue(rItem.m_nValue) + { DBG_CTOR(SfxInt16Item, 0); } + + virtual ~SfxInt16Item() { DBG_DTOR(SfxInt16Item, 0); } + + virtual int operator ==(const SfxPoolItem & rItem) const; + + using SfxPoolItem::Compare; + virtual int Compare(const SfxPoolItem & rWith) const; + + virtual SfxItemPresentation GetPresentation(SfxItemPresentation, + SfxMapUnit, SfxMapUnit, + XubString & rText, + const IntlWrapper * = 0) + const; + + virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ) const; + + virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ); + + virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const; + + virtual SvStream & Store(SvStream & rStream, USHORT) const; + + virtual SfxPoolItem * Clone(SfxItemPool * = 0) const; + + virtual INT16 GetMin() const; + + virtual INT16 GetMax() const; + + virtual SfxFieldUnit GetUnit() const; + + INT16 GetValue() const { return m_nValue; } + + inline void SetValue(INT16 nTheValue); +}; + +inline void SfxInt16Item::SetValue(INT16 nTheValue) +{ + DBG_ASSERT(GetRefCount() == 0, "SfxInt16Item::SetValue(); Pooled item"); + m_nValue = nTheValue; +} + +//============================================================================ +class SVT_DLLPUBLIC SfxUInt16Item: public CntUInt16Item +{ +public: + TYPEINFO(); + + SfxUInt16Item(USHORT which = 0, UINT16 nValue = 0): + CntUInt16Item(which, nValue) {} + + SfxUInt16Item(USHORT which, SvStream & rStream): + CntUInt16Item(which, rStream) {} + + virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const + { return new SfxUInt16Item(Which(), rStream); } + + virtual SfxPoolItem * Clone(SfxItemPool * = 0) const + { return new SfxUInt16Item(*this); } +}; + +//============================================================================ +class SVT_DLLPUBLIC SfxInt32Item: public CntInt32Item +{ +public: + TYPEINFO(); + + SfxInt32Item(USHORT which = 0, INT32 nValue = 0): + CntInt32Item(which, nValue) {} + + SfxInt32Item(USHORT which, SvStream & rStream): + CntInt32Item(which, rStream) {} + + virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const + { return new SfxInt32Item(Which(), rStream); } + + virtual SfxPoolItem * Clone(SfxItemPool * = 0) const + { return new SfxInt32Item(*this); } + +}; + +//============================================================================ +class SVT_DLLPUBLIC SfxUInt32Item: public CntUInt32Item +{ +public: + TYPEINFO(); + + SfxUInt32Item(USHORT which = 0, UINT32 nValue = 0): + CntUInt32Item(which, nValue) {} + + SfxUInt32Item(USHORT which, SvStream & rStream): + CntUInt32Item(which, rStream) {} + + virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const + { return new SfxUInt32Item(Which(), rStream); } + + virtual SfxPoolItem * Clone(SfxItemPool * = 0) const + { return new SfxUInt32Item(*this); } +}; + +#endif // _SFXINTITEM_HXX + diff --git a/svl/inc/svl/isethint.hxx b/svl/inc/svl/isethint.hxx new file mode 100644 index 000000000000..d30fc4a65b27 --- /dev/null +++ b/svl/inc/svl/isethint.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: isethint.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFXISETHINT_HXX +#define _SFXISETHINT_HXX + +#include "svtools/svldllapi.h" + +#ifndef _HINT_HXX +#include +#endif + +class SfxItemSet; + +//-------------------------------------------------------------------- + +class SVL_DLLPUBLIC SfxItemSetHint: public SfxHint +{ + SfxItemSet* _pItemSet; + +public: + TYPEINFO(); + + SfxItemSetHint( SfxItemSet *pItemSet ); + SfxItemSetHint( const SfxItemSet &rItemSet ); + virtual ~SfxItemSetHint(); + + const SfxItemSet& GetItemSet() const { return *_pItemSet; } +}; + +#endif + diff --git a/svl/inc/svl/itemiter.hxx b/svl/inc/svl/itemiter.hxx new file mode 100644 index 000000000000..6a9b5e212720 --- /dev/null +++ b/svl/inc/svl/itemiter.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: itemiter.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFXITEMITER_HXX +#define _SFXITEMITER_HXX + +#include "svtools/svldllapi.h" +#include +#include + +class SfxPoolItem; +class SfxItemSet; +class SfxItemPool; + +class SVL_DLLPUBLIC SfxItemIter +{ + // Item-Feld - Start & Ende + const SfxItemSet& _rSet; + USHORT _nStt, _nEnd, _nAkt; + +public: + SfxItemIter( const SfxItemSet& rSet ); + ~SfxItemIter(); + + // falls es diese gibt, returne sie, sonst 0 + const SfxPoolItem* FirstItem() + { _nAkt = _nStt; + return _rSet._nCount ? *(_rSet._aItems+_nAkt) : 0; } + const SfxPoolItem* LastItem() + { _nAkt = _nEnd; + return _rSet._nCount ? *(_rSet._aItems+_nAkt) : 0; } + const SfxPoolItem* GetCurItem() + { return _rSet._nCount ? *(_rSet._aItems+_nAkt) : 0; } + const SfxPoolItem* NextItem(); + const SfxPoolItem* PrevItem(); + + BOOL IsAtStart() const { return _nAkt == _nStt; } + BOOL IsAtEnd() const { return _nAkt == _nEnd; } + + USHORT GetCurPos() const { return _nAkt; } + USHORT GetFirstPos() const { return _nStt; } + USHORT GetLastPos() const { return _nEnd; } +}; + +#endif diff --git a/svl/inc/svl/itempool.hxx b/svl/inc/svl/itempool.hxx new file mode 100644 index 000000000000..81407cee2d0c --- /dev/null +++ b/svl/inc/svl/itempool.hxx @@ -0,0 +1,306 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: itempool.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SFXITEMPOOL_HXX +#define _SFXITEMPOOL_HXX + +#include "svtools/svldllapi.h" + +#ifndef INCLUDED_LIMITS_H +#include +#define INCLUDED_LIMITS_H +#endif +#include +#include +#include +#include +#include + +class SvStream; +class SfxBroadcaster; +struct SfxItemPool_Impl; + +#define SFX_WHICH_MAX 4999 + +DBG_NAMEEX(SfxItemPool) + +//==================================================================== + +#define SFX_ITEM_POOLABLE 0x0001 +#define SFX_ITEM_NOT_POOLABLE 0x0002 + +#define SFX_ITEM_USERFLAG0 0x0100 +#define SFX_ITEM_USERFLAG1 0x0200 +#define SFX_ITEM_USERFLAG2 0x0400 +#define SFX_ITEM_USERFLAG3 0x0800 +#define SFX_ITEM_USERFLAG4 0x1000 +#define SFX_ITEM_USERFLAG5 0x2000 +#define SFX_ITEM_USERFLAG6 0x4000 +#define SFX_ITEM_USERFLAG7 0x8000 +#define SFX_ITEM_USERFLAG8 0x0010 +#define SFX_ITEM_USERFLAG9 0x0020 +#define SFX_ITEM_USERFLAGA 0x0040 +#define SFX_ITEM_USERFLAGB 0x0080 + +//==================================================================== + +struct SfxItemInfo +{ + USHORT _nSID; + USHORT _nFlags; +}; + +//==================================================================== + +class SfxStyleSheetIterator; +struct SfxPoolItemArray_Impl; +class SfxItemPool; + +class SVL_DLLPUBLIC SfxItemPoolUser +{ +public: + virtual void ObjectInDestruction(const SfxItemPool& rSfxItemPool) = 0; +}; + +typedef ::std::vector< SfxItemPoolUser* > SfxItemPoolUserVector; + +class SVL_DLLPUBLIC SfxItemPool + +/* [Beschreibung] + + Die von dieser Klasse abgeleiteten Klassen dienen der Bereitstellung von + Defaults von SfxPoolItems und halten konkrete (konstante) Instanzen, die + dann von mehreren Stellen (i.d.R. eines Dokuments) referenziert werden + k�nnen. + + Dadurch ist jeder Wert nur einmalig gespeichert, was zu wenig Konstruktor + und Destruktor-Aufrufen f�hrt, Vergleiche zwischen Items eines Dokuments + beschleunigt und ein einfaches Laden und Speichern von Attributen + bereitstellt. +*/ + +{ + SVL_DLLPRIVATE void readTheItems(SvStream & rStream, USHORT nCount, USHORT nVersion, + SfxPoolItem * pDefItem, SfxPoolItemArray_Impl ** pArr); + + UniString aName; + USHORT nStart, nEnd; + USHORT _nFileFormatVersion; +#ifdef TF_POOLABLE + const SfxItemInfo* pItemInfos; +#else + USHORT* pSlotIds; +#endif + SfxItemPool_Impl* pImp; + SfxPoolItem** ppStaticDefaults; + SfxPoolItem** ppPoolDefaults; + SfxItemPool* pSecondary; + SfxItemPool* pMaster; + USHORT* _pPoolRanges; + FASTBOOL bPersistentRefCounts; + +private: + // ObjectUser section + SfxItemPoolUserVector maSfxItemPoolUsers; + +public: + void AddSfxItemPoolUser(SfxItemPoolUser& rNewUser); + void RemoveSfxItemPoolUser(SfxItemPoolUser& rOldUser); + + //--------------------------------------------------------------------- +#ifndef _SFXITEMS_HXX + +friend class SfxPoolWhichMap; + +private: + inline USHORT GetIndex_Impl(USHORT nWhich) const; + inline USHORT GetSize_Impl() const { return nEnd - nStart + 1; } + + SVL_DLLPRIVATE SvStream& Load1_Impl( SvStream &rStream ); + SVL_DLLPRIVATE FASTBOOL IsItemFlag_Impl( USHORT nWhich, USHORT nFlag ) const; + +public: + // fuer dflt. SfxItemSet::CTOR, setze dflt. WhichRanges + void FillItemIdRanges_Impl( USHORT*& pWhichRanges ) const; + const USHORT* GetFrozenIdRanges() const + { return _pPoolRanges; } + FASTBOOL IsVer2_Impl() const; + +#endif + //--------------------------------------------------------------------- + +protected: + static inline void SetRefCount( SfxPoolItem& rItem, ULONG n ); + static inline ULONG AddRef( const SfxPoolItem& rItem, ULONG n = 1 ); + static inline ULONG ReleaseRef( const SfxPoolItem& rItem, ULONG n = 1); + +public: + SfxItemPool( const SfxItemPool &rPool, + BOOL bCloneStaticDefaults = FALSE ); + SfxItemPool( const UniString &rName, + USHORT nStart, USHORT nEnd, +#ifdef TF_POOLABLE + const SfxItemInfo *pItemInfos, +#endif + SfxPoolItem **pDefaults = 0, +#ifndef TF_POOLABLE + USHORT *pSlotIds = 0, +#endif + FASTBOOL bLoadRefCounts = TRUE ); +protected: + virtual ~SfxItemPool(); +public: + static void Free(SfxItemPool* pPool); + + SfxBroadcaster& BC(); + + void SetPoolDefaultItem( const SfxPoolItem& ); + const SfxPoolItem* GetPoolDefaultItem( USHORT nWhich ) const; + void ResetPoolDefaultItem( USHORT nWhich ); + + void SetDefaults( SfxPoolItem **pDefaults ); + void ReleaseDefaults( BOOL bDelete = FALSE ); + static void ReleaseDefaults( SfxPoolItem **pDefaults, USHORT nCount, BOOL bDelete = FALSE ); + + virtual SfxMapUnit GetMetric( USHORT nWhich ) const; + void SetDefaultMetric( SfxMapUnit eNewMetric ); + virtual SfxItemPresentation GetPresentation( const SfxPoolItem& rItem, + SfxItemPresentation ePresentation, + SfxMapUnit ePresentationMetric, + XubString& rText, + const IntlWrapper * pIntlWrapper + = 0 ) const; + virtual SfxItemPool* Clone() const; + UniString const & GetName() const { return aName; } + + virtual const SfxPoolItem& Put( const SfxPoolItem&, USHORT nWhich = 0 ); + virtual void Remove( const SfxPoolItem& ); + virtual const SfxPoolItem& GetDefaultItem( USHORT nWhich ) const; + + const SfxPoolItem* LoadItem( SvStream &rStream, + FASTBOOL bDirect = FALSE, + const SfxItemPool *pRefPool = 0 ); + FASTBOOL StoreItem( SvStream &rStream, + const SfxPoolItem &rItem, + FASTBOOL bDirect = FALSE ) const; + + USHORT GetSurrogate(const SfxPoolItem *) const; + const SfxPoolItem * GetItem(USHORT nWhich, USHORT nSurrogate) const; + USHORT GetItemCount(USHORT nWhich) const; + const SfxPoolItem* LoadSurrogate(SvStream& rStream, + USHORT &rWhich, USHORT nSlotId, + const SfxItemPool* pRefPool = 0 ); + FASTBOOL StoreSurrogate(SvStream& rStream, + const SfxPoolItem *pItem ) const; + + virtual SvStream & Load(SvStream &); + virtual SvStream & Store(SvStream &) const; + int HasPersistentRefCounts() const { + return bPersistentRefCounts; } + void LoadCompleted(); + + USHORT GetFirstWhich() const { return nStart; } + USHORT GetLastWhich() const { return nEnd; } + FASTBOOL IsInRange( USHORT nWhich ) const { + return nWhich >= nStart && + nWhich <= nEnd; } + FASTBOOL IsInVersionsRange( USHORT nWhich ) const; + FASTBOOL IsInStoringRange( USHORT nWhich ) const; + void SetStoringRange( USHORT nFrom, USHORT nTo ); + void SetSecondaryPool( SfxItemPool *pPool ); + SfxItemPool* GetSecondaryPool() const { + return pSecondary; } + SfxItemPool* GetMasterPool() const { + return pMaster; } + void FreezeIdRanges(); + + void Cleanup(); + void Delete(); + +#ifdef TF_POOLABLE + FASTBOOL IsItemFlag( USHORT nWhich, USHORT nFlag ) const; + FASTBOOL IsItemFlag( const SfxPoolItem &rItem, USHORT nFlag ) const + { return IsItemFlag( rItem.Which(), nFlag ); } + void SetItemInfos( const SfxItemInfo *pInfos ) + { pItemInfos = pInfos; } +#else + int HasMap() const { return 0 != pSlotIds; } + void SetMap( USHORT *pNewSlotIds ) + { pSlotIds = pNewSlotIds; } +#endif + USHORT GetWhich( USHORT nSlot, BOOL bDeep = TRUE ) const; + USHORT GetSlotId( USHORT nWhich, BOOL bDeep = TRUE ) const; + USHORT GetTrueWhich( USHORT nSlot, BOOL bDeep = TRUE ) const; + USHORT GetTrueSlotId( USHORT nWhich, BOOL bDeep = TRUE ) const; + + void SetVersionMap( USHORT nVer, + USHORT nOldStart, USHORT nOldEnd, + USHORT *pWhichIdTab ); + USHORT GetNewWhich( USHORT nOldWhich ) const; + USHORT GetVersion() const; + USHORT GetFileFormatVersion() const + { return _nFileFormatVersion; } + void SetFileFormatVersion( USHORT nFileFormatVersion ); + USHORT GetLoadingVersion() const; + FASTBOOL IsCurrentVersionLoading() const; + + static int IsWhich(USHORT nId) { + return nId && nId <= SFX_WHICH_MAX; } + static int IsSlot(USHORT nId) { + return nId && nId > SFX_WHICH_MAX; } + + static const SfxItemPool* GetStoringPool(); + static void SetStoringPool( const SfxItemPool * ); + +private: + const SfxItemPool& operator=(const SfxItemPool &); // n.i.!! +}; + +// --------------- Inline Implementierungen ------------------------------ + +// nur der Pool darf den Referenz-Zaehler manipulieren !!! +inline void SfxItemPool::SetRefCount( SfxPoolItem& rItem, ULONG n ) +{ + rItem.SetRefCount(n); +} + +// nur der Pool darf den Referenz-Zaehler manipulieren !!! +inline ULONG SfxItemPool::AddRef( const SfxPoolItem& rItem, ULONG n ) +{ + return rItem.AddRef(n); +} + +// nur der Pool darf den Referenz-Zaehler manipulieren !!! +inline ULONG SfxItemPool::ReleaseRef( const SfxPoolItem& rItem, ULONG n ) +{ + return rItem.ReleaseRef(n); +} + +#endif diff --git a/svl/inc/svl/itemprop.hxx b/svl/inc/svl/itemprop.hxx new file mode 100644 index 000000000000..feab0eab004b --- /dev/null +++ b/svl/inc/svl/itemprop.hxx @@ -0,0 +1,222 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: itemprop.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFX_ITEMPROP_HXX +#define _SFX_ITEMPROP_HXX + +#include "svtools/svldllapi.h" +#include +#include +#include +#include +#include +#include +#include +#include +/* -----------------------------21.02.00 11:03-------------------------------- + UNO III - Implementation + ---------------------------------------------------------------------------*/ +#define MAP_CHAR_LEN(cchar) cchar, sizeof(cchar) - 1 + +struct SfxItemPropertyMapEntry +{ + const char* pName; + USHORT nNameLen; + USHORT nWID; + const com::sun::star::uno::Type* pType; + long nFlags; + BYTE nMemberId; + +}; + +struct SfxItemPropertySimpleEntry +{ + USHORT nWID; + const com::sun::star::uno::Type* pType; + long nFlags; + BYTE nMemberId; + + SfxItemPropertySimpleEntry() : + nWID( 0 ), + pType( 0 ), + nFlags( 0 ), + nMemberId( 0 ){} + + SfxItemPropertySimpleEntry(USHORT _nWID, const com::sun::star::uno::Type* _pType, + long _nFlags, BYTE _nMemberId) : + nWID( _nWID ), + pType( _pType ), + nFlags( _nFlags ), + nMemberId( _nMemberId ){} + + SfxItemPropertySimpleEntry( const SfxItemPropertyMapEntry* pMapEntry ) : + nWID( pMapEntry->nWID ), + pType( pMapEntry->pType ), + nFlags( pMapEntry->nFlags ), + nMemberId( pMapEntry->nMemberId ){} + +}; +struct SfxItemPropertyNamedEntry : public SfxItemPropertySimpleEntry +{ + ::rtl::OUString sName; + SfxItemPropertyNamedEntry( const String& rName, const SfxItemPropertySimpleEntry& rSimpleEntry) : + SfxItemPropertySimpleEntry( rSimpleEntry ), + sName( rName ){} + +}; +typedef std::vector< SfxItemPropertyNamedEntry > PropertyEntryVector_t; +class SfxItemPropertyMap_Impl; +class SVL_DLLPUBLIC SfxItemPropertyMap +{ + SfxItemPropertyMap_Impl* m_pImpl; +public: + SfxItemPropertyMap( const SfxItemPropertyMapEntry* pEntries ); + SfxItemPropertyMap( const SfxItemPropertyMap* pSource ); + ~SfxItemPropertyMap(); + + const SfxItemPropertySimpleEntry* getByName( const ::rtl::OUString &rName ) const; + com::sun::star::uno::Sequence< com::sun::star::beans::Property > getProperties() const; + com::sun::star::beans::Property getPropertyByName( const ::rtl::OUString rName ) const + throw( ::com::sun::star::beans::UnknownPropertyException ); + sal_Bool hasPropertyByName( const ::rtl::OUString& rName ) const; + + void mergeProperties( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& rPropSeq ); + PropertyEntryVector_t getPropertyEntries() const; + sal_uInt32 getSize() const; + +}; +/* -----------------------------21.02.00 11:19-------------------------------- + + ---------------------------------------------------------------------------*/ +class SVL_DLLPUBLIC SfxItemPropertySet +{ + SfxItemPropertyMap m_aMap; + mutable com::sun::star::uno::Reference m_xInfo; +protected: + virtual BOOL FillItem(SfxItemSet& rSet, USHORT nWhich, BOOL bGetProperty) const; + +public: + SfxItemPropertySet( const SfxItemPropertyMapEntry *pMap ) : + m_aMap(pMap) {} + virtual ~SfxItemPropertySet(); + + void getPropertyValue( const SfxItemPropertySimpleEntry& rEntry, + const SfxItemSet& rSet, + com::sun::star::uno::Any& rAny) const + throw(::com::sun::star::uno::RuntimeException); + void getPropertyValue( const ::rtl::OUString &rName, + const SfxItemSet& rSet, + com::sun::star::uno::Any& rAny) const + throw(::com::sun::star::uno::RuntimeException, + ::com::sun::star::beans::UnknownPropertyException); + com::sun::star::uno::Any + getPropertyValue( const ::rtl::OUString &rName, + const SfxItemSet& rSet ) const + throw(::com::sun::star::uno::RuntimeException, + ::com::sun::star::beans::UnknownPropertyException); + void setPropertyValue( const SfxItemPropertySimpleEntry& rEntry, + const com::sun::star::uno::Any& aVal, + SfxItemSet& rSet ) const + throw(::com::sun::star::uno::RuntimeException, + com::sun::star::lang::IllegalArgumentException); + void setPropertyValue( const ::rtl::OUString& rPropertyName, + const com::sun::star::uno::Any& aVal, + SfxItemSet& rSet ) const + throw(::com::sun::star::uno::RuntimeException, + com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::beans::UnknownPropertyException); + + com::sun::star::beans::PropertyState + getPropertyState(const ::rtl::OUString& rName, const SfxItemSet& rSet)const + throw(com::sun::star::beans::UnknownPropertyException); + com::sun::star::beans::PropertyState + getPropertyState(const SfxItemPropertySimpleEntry& rEntry, const SfxItemSet& rSet) const + throw(); + + com::sun::star::uno::Reference + getPropertySetInfo() const; + const SfxItemPropertyMap* + getPropertyMap() const {return &m_aMap;} + +}; +/* -----------------------------21.02.00 11:09-------------------------------- + + ---------------------------------------------------------------------------*/ +struct SfxItemPropertySetInfo_Impl; +class SVL_DLLPUBLIC SfxItemPropertySetInfo : public + cppu::WeakImplHelper1 +{ + SfxItemPropertySetInfo_Impl* m_pImpl; + +public: + SfxItemPropertySetInfo(const SfxItemPropertyMap *pMap ); + SfxItemPropertySetInfo(const SfxItemPropertyMapEntry *pEntries ); + virtual ~SfxItemPropertySetInfo(); + + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL + getProperties( ) + throw(::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::beans::Property SAL_CALL + getPropertyByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL + hasPropertyByName( const ::rtl::OUString& Name ) + throw(::com::sun::star::uno::RuntimeException); + + const SfxItemPropertyMap* getMap() const; +}; +/* -----------------------------21.02.00 12:01-------------------------------- + + ---------------------------------------------------------------------------*/ +class SVL_DLLPUBLIC SfxExtItemPropertySetInfo: public cppu::WeakImplHelper1 +{ + SfxItemPropertyMap aExtMap; +public: + SfxExtItemPropertySetInfo( + const SfxItemPropertyMapEntry *pMap, + const com::sun::star::uno::Sequence& rPropSeq ); + virtual ~SfxExtItemPropertySetInfo(); + + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL + getProperties( ) + throw(::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::beans::Property SAL_CALL + getPropertyByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL + hasPropertyByName( const ::rtl::OUString& Name ) + throw(::com::sun::star::uno::RuntimeException); +}; + +#endif diff --git a/svl/inc/svl/itemset.hxx b/svl/inc/svl/itemset.hxx new file mode 100644 index 000000000000..4cc3edcf65c7 --- /dev/null +++ b/svl/inc/svl/itemset.hxx @@ -0,0 +1,216 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: itemset.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFXITEMSET_HXX +#define _SFXITEMSET_HXX + +#include "svtools/svldllapi.h" + +#if STLPORT_VERSION<321 +#include +#else +#include // std::va_list and friends +#endif +#include +#include +#include + +class SfxItemPool; +class SfxPoolItem; +class SvStream; + +typedef SfxPoolItem const** SfxItemArray; + +#define USHORT_ARG int + +#ifdef MI_HATS_REPARIERT +#ifndef DBG +#ifdef DBG_UTILx +#define DBG(s) s +#define _pChildCount(THIS) ( *(USHORT**)SfxPointerServer::GetServer()->GetPointer(THIS) ) +#define _pChildCountCtor ( (*(USHORT**)SfxPointerServer::GetServer()->CreatePointer(this)) = new USHORT ) +#define _pChildCountDtor ( SfxPointerServer::GetServer()->ReleasePointer(this) ) +#else +#define DBG(s) +#endif +#endif +#else +#ifdef DBG +#undef DBG +#endif +#define DBG(s) +#endif + +//======================================================================== + +#define SFX_ITEMSET_GET( rSet, pItem, ItemType, nSlotId, bDeep ) \ + const ItemType *pItem = (const ItemType*) \ + (rSet).GetItem( nSlotId, bDeep, TYPE(ItemType) ) + +//======================================================================== + +class SVL_DLLPUBLIC SfxItemSet +{ + friend class SfxItemIter; + + SfxItemPool* _pPool; // der verwendete Pool + const SfxItemSet* _pParent; // Ableitung + SfxItemArray _aItems; // Item-Feld + USHORT* _pWhichRanges; // Array von Which-Bereichen + USHORT _nCount; // Anzahl Items + + //--------------------------------------------------------------------- +#ifndef _SFXITEMS_HXX + +friend class SfxItemPoolCache; +friend class SfxAllItemSet; +friend const char *DbgCheckItemSet( const void* ); + +private: + SVL_DLLPRIVATE void InitRanges_Impl(const USHORT *nWhichPairTable); + SVL_DLLPRIVATE void InitRanges_Impl(va_list pWhich, USHORT n1, USHORT n2, USHORT n3); + SVL_DLLPRIVATE void InitRanges_Impl(USHORT nWh1, USHORT nWh2); + +public: + SfxItemArray GetItems_Impl() const { return _aItems; } + +#endif + //--------------------------------------------------------------------- + +private: + const SfxItemSet& operator=(const SfxItemSet &); // n.i.!! + +protected: + // Notification-Callback + virtual void Changed( const SfxPoolItem& rOld, const SfxPoolItem& rNew ); + + // direkte Put-Methode + int PutDirect(const SfxPoolItem &rItem); + +public: + SfxItemSet( const SfxItemSet& ); + + SfxItemSet( SfxItemPool&, BOOL bTotalPoolRanges = FALSE ); + SfxItemSet( SfxItemPool&, USHORT nWhich1, USHORT nWhich2 ); + SfxItemSet( SfxItemPool&, USHORT_ARG nWh1, USHORT_ARG nWh2, USHORT_ARG nNull, ... ); + SfxItemSet( SfxItemPool&, const USHORT* nWhichPairTable ); + virtual ~SfxItemSet(); + + virtual SfxItemSet * Clone(BOOL bItems = TRUE, SfxItemPool *pToPool = 0) const; + + // Items erfragen + USHORT Count() const { return _nCount; } + USHORT TotalCount() const; + + virtual const SfxPoolItem& Get( USHORT nWhich, BOOL bSrchInParent = TRUE ) const; + const SfxPoolItem* GetItem( USHORT nWhich, BOOL bSrchInParent = TRUE, + TypeId aItemType = 0 ) const; + + // Which-Wert des Items an der Position nPos erfragen + USHORT GetWhichByPos(USHORT nPos) const; + + // Item-Status erfragen + SfxItemState GetItemState( USHORT nWhich, + BOOL bSrchInParent = TRUE, + const SfxPoolItem **ppItem = 0 ) const; + + virtual void DisableItem(USHORT nWhich); + virtual void InvalidateItem( USHORT nWhich ); + virtual USHORT ClearItem( USHORT nWhich = 0); + virtual void ClearInvalidItems( BOOL bHardDefault = FALSE ); + void InvalidateAllItems(); HACK(via nWhich = 0) + + inline void SetParent( const SfxItemSet* pNew ); + + // Items hinzufuegen, loeschen etc. + virtual const SfxPoolItem* Put( const SfxPoolItem&, USHORT nWhich ); + const SfxPoolItem* Put( const SfxPoolItem& rItem ) + { return Put(rItem, rItem.Which()); } + virtual int Put( const SfxItemSet&, + BOOL bInvalidAsDefault = TRUE ); + void PutExtended( const SfxItemSet&, + SfxItemState eDontCareAs = SFX_ITEM_UNKNOWN, + SfxItemState eDefaultAs = SFX_ITEM_UNKNOWN ); + + virtual int Set( const SfxItemSet&, BOOL bDeep = TRUE ); + + virtual void Intersect( const SfxItemSet& rSet ); + virtual void MergeValues( const SfxItemSet& rSet, BOOL bOverwriteDefaults = FALSE ); + virtual void Differentiate( const SfxItemSet& rSet ); + virtual void MergeValue( const SfxPoolItem& rItem, BOOL bOverwriteDefaults = FALSE ); + + SfxItemPool* GetPool() const { return _pPool; } + const USHORT* GetRanges() const { return _pWhichRanges; } + void SetRanges( const USHORT *pRanges ); + void MergeRange( USHORT nFrom, USHORT nTo ); + const SfxItemSet* GetParent() const { return _pParent; } + + virtual SvStream & Load( SvStream &, FASTBOOL bDirect = FALSE, + const SfxItemPool *pRefPool = 0 ); + virtual SvStream & Store( SvStream &, FASTBOOL bDirect = FALSE ) const; + + virtual int operator==(const SfxItemSet &) const; +}; + +// --------------- Inline Implementierungen ------------------------ + +inline void SfxItemSet::SetParent( const SfxItemSet* pNew ) +{ + DBG( if (_pParent) --*_pChildCount(_pParent) ); + _pParent = pNew; + DBG( if (_pParent) ++*_pChildCount(_pParent) ); +} + +//======================================================================== + +class SVL_DLLPUBLIC SfxAllItemSet: public SfxItemSet + +/* versteht alle Ranges; werden durch das Putten der Items + automatisch angepasst +*/ + +{ + SfxVoidItem aDefault; + USHORT nFree; + +public: + SfxAllItemSet( SfxItemPool &rPool ); + SfxAllItemSet( const SfxItemSet & ); + SfxAllItemSet( const SfxAllItemSet & ); + + virtual SfxItemSet * Clone( BOOL bItems = TRUE, SfxItemPool *pToPool = 0 ) const; + virtual const SfxPoolItem* Put( const SfxPoolItem&, USHORT nWhich ); + const SfxPoolItem* Put( const SfxPoolItem& rItem ) + { return Put(rItem, rItem.Which()); } + virtual int Put( const SfxItemSet&, + BOOL bInvalidAsDefault = TRUE ); +}; + +#endif // #ifndef _SFXITEMSET_HXX + diff --git a/svl/inc/svl/languageoptions.hxx b/svl/inc/svl/languageoptions.hxx new file mode 100644 index 000000000000..ed247ac01fa3 --- /dev/null +++ b/svl/inc/svl/languageoptions.hxx @@ -0,0 +1,131 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: languageoptions.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVTOOLS_LANGUAGEOPTIONS_HXX +#define _SVTOOLS_LANGUAGEOPTIONS_HXX + +#include "svtools/svtdllapi.h" +#include +#include +#include +#include +#include + +// class SvtLanguageOptions ---------------------------------------------------- + +// these defines can be ored +#define SCRIPTTYPE_LATIN 0x01 +#define SCRIPTTYPE_ASIAN 0x02 +#define SCRIPTTYPE_COMPLEX 0x04 + +class SvtCJKOptions; +class SvtCTLOptions; + +class SVT_DLLPUBLIC SvtLanguageOptions : public SfxBroadcaster, public SfxListener +{ +private: + SvtCJKOptions* m_pCJKOptions; + SvtCTLOptions* m_pCTLOptions; + +public: + enum EOption + { + // cjk options + E_CJKFONT, + E_VERTICALTEXT, + E_ASIANTYPOGRAPHY, + E_JAPANESEFIND, + E_RUBY, + E_CHANGECASEMAP, + E_DOUBLELINES, + E_EMPHASISMARKS, + E_VERTICALCALLOUT, + E_ALLCJK, + // ctl options + E_CTLFONT, + E_CTLSEQUENCECHECKING, + E_CTLCURSORMOVEMENT, + E_CTLTEXTNUMERALS + }; + + // bDontLoad is for referencing purposes only + SvtLanguageOptions( sal_Bool _bDontLoad = sal_False ); + ~SvtLanguageOptions(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // CJK options + sal_Bool IsCJKFontEnabled() const; + sal_Bool IsVerticalTextEnabled() const; + sal_Bool IsAsianTypographyEnabled() const; + sal_Bool IsJapaneseFindEnabled() const; + sal_Bool IsRubyEnabled() const; + sal_Bool IsChangeCaseMapEnabled() const; + sal_Bool IsDoubleLinesEnabled() const; + sal_Bool IsEmphasisMarksEnabled() const; + sal_Bool IsVerticalCallOutEnabled() const; + void SetAll( sal_Bool _bSet ); + sal_Bool IsAnyEnabled() const; + + // CTL options + void SetCTLFontEnabled( sal_Bool _bEnabled ); + sal_Bool IsCTLFontEnabled() const; + + void SetCTLSequenceChecking( sal_Bool _bEnabled ); + sal_Bool IsCTLSequenceChecking() const; + + void SetCTLSequenceCheckingRestricted( sal_Bool _bEnable ); + sal_Bool IsCTLSequenceCheckingRestricted( void ) const; + + void SetCTLSequenceCheckingTypeAndReplace( sal_Bool _bEnable ); + sal_Bool IsCTLSequenceCheckingTypeAndReplace() const; + + sal_Bool IsReadOnly(EOption eOption) const; + + // returns for a language the scripttype + static sal_uInt16 GetScriptTypeOfLanguage( sal_uInt16 nLang ); +}; +/** #i42730# Gives access to the Windows 16bit system locale + */ +class SVT_DLLPUBLIC SvtSystemLanguageOptions : public utl::ConfigItem +{ +private: + ::rtl::OUString m_sWin16SystemLocale; + +public: + SvtSystemLanguageOptions(); + ~SvtSystemLanguageOptions(); + + virtual void Commit(); + + LanguageType GetWin16SystemLanguage(); +}; + +#endif // _SVTOOLS_LANGUAGEOPTIONS_HXX + diff --git a/svl/inc/svl/lckbitem.hxx b/svl/inc/svl/lckbitem.hxx new file mode 100644 index 000000000000..b21e91a3fd46 --- /dev/null +++ b/svl/inc/svl/lckbitem.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: lckbitem.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _LCKBITEM_HXX +#define _LCKBITEM_HXX + +#include "svtools/svldllapi.h" +#include +#include +#include +#include + +// ----------------------------------------------------------------------- + +class SVL_DLLPUBLIC SfxLockBytesItem : public SfxPoolItem +{ + SvLockBytesRef _xVal; + +public: + TYPEINFO(); + SfxLockBytesItem(); + SfxLockBytesItem( USHORT nWhich, + SvLockBytes *pLockBytes ); + SfxLockBytesItem( USHORT nWhich, SvStream & ); + SfxLockBytesItem( const SfxLockBytesItem& ); + ~SfxLockBytesItem(); + + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, USHORT nItemVersion) const; + virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const; + + SvLockBytes* GetValue() const { return _xVal; } + + virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ); + virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ) const; +}; + +#endif + diff --git a/svl/inc/svl/lockfilecommon.hxx b/svl/inc/svl/lockfilecommon.hxx new file mode 100644 index 000000000000..c8bd6251f9cb --- /dev/null +++ b/svl/inc/svl/lockfilecommon.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: documentlockfile.hxx,v $ + * + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVT_LOCKFILECOMMON_HXX +#define _SVT_LOCKFILECOMMON_HXX + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#define LOCKFILE_OOOUSERNAME_ID 0 +#define LOCKFILE_SYSUSERNAME_ID 1 +#define LOCKFILE_LOCALHOST_ID 2 +#define LOCKFILE_EDITTIME_ID 3 +#define LOCKFILE_USERURL_ID 4 +#define LOCKFILE_ENTRYSIZE 5 + +namespace svt { + +// This is a general implementation that is used in document lock file implementation and in sharing control file implementation +class SVT_DLLPUBLIC LockFileCommon +{ +protected: + ::osl::Mutex m_aMutex; + + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; + ::rtl::OUString m_aURL; + + + INetURLObject ResolveLinks( const INetURLObject& aDocURL ); + +public: + LockFileCommon( const ::rtl::OUString& aOrigURL, const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory, const ::rtl::OUString& aPrefix ); + ~LockFileCommon(); + + static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > ParseList( const ::com::sun::star::uno::Sequence< sal_Int8 >& aBuffer ); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > ParseEntry( const ::com::sun::star::uno::Sequence< sal_Int8 >& aBuffer, sal_Int32& o_nCurPos ); + static ::rtl::OUString ParseName( const ::com::sun::star::uno::Sequence< sal_Int8 >& aBuffer, sal_Int32& o_nCurPos ); + static ::rtl::OUString EscapeCharacters( const ::rtl::OUString& aSource ); + static ::rtl::OUString GetOOOUserName(); + static ::rtl::OUString GetCurrentLocalTime(); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > GenerateOwnEntry(); +}; + +} + +#endif + diff --git a/svl/inc/svl/lstner.hxx b/svl/inc/svl/lstner.hxx new file mode 100644 index 000000000000..99a6e10701f5 --- /dev/null +++ b/svl/inc/svl/lstner.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: lstner.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFXLSTNER_HXX +#define _SFXLSTNER_HXX + +#include "svtools/svldllapi.h" +#include +#include + +class SfxBroadcaster; +class SfxHint; + +#ifndef _SFX_LSTNER_CXX +typedef SvPtrarr SfxBroadcasterArr_Impl; +#endif + +#define SFX_NOTIFY( rBC, rBCT, rHint, rHintT ) \ + Notify( rBC, rHint ) + +//------------------------------------------------------------------------- + +class SVL_DLLPUBLIC SfxListener +{ + SfxBroadcasterArr_Impl aBCs; + +private: + const SfxListener& operator=(const SfxListener &); // n.i., ist verboten + +public: + TYPEINFO(); + + SfxListener(); + SfxListener( const SfxListener &rCopy ); + virtual ~SfxListener(); + + BOOL StartListening( SfxBroadcaster& rBroadcaster, BOOL bPreventDups = FALSE ); + BOOL EndListening( SfxBroadcaster& rBroadcaster, BOOL bAllDups = FALSE ); + void EndListening( USHORT nNo ); + void EndListeningAll(); + BOOL IsListening( SfxBroadcaster& rBroadcaster ) const; + + USHORT GetBroadcasterCount() const + { return aBCs.Count(); } + SfxBroadcaster* GetBroadcasterJOE( USHORT nNo ) const + { return (SfxBroadcaster*) aBCs.GetObject(nNo); } + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + +#ifndef _NOTIFY_HXX + void RemoveBroadcaster_Impl( SfxBroadcaster& rBC ); +#endif +}; + +#endif diff --git a/svl/inc/svl/macitem.hxx b/svl/inc/svl/macitem.hxx new file mode 100644 index 000000000000..2e43120f653d --- /dev/null +++ b/svl/inc/svl/macitem.hxx @@ -0,0 +1,212 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: macitem.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFXMACITEM_HXX +#define _SFXMACITEM_HXX + +// class SvxMacroItem ---------------------------------------------------- + +#include "svtools/svtdllapi.h" +#include +#include +#include +#include + +#ifndef _TABLE_HXX +#include +#endif + +class SvStream; + +#define SVX_MACRO_LANGUAGE_JAVASCRIPT "JavaScript" +#define SVX_MACRO_LANGUAGE_STARBASIC "StarBasic" +#define SVX_MACRO_LANGUAGE_SF "Script" + +DBG_NAMEEX(SvxMacroItem) + +// ----------------------------------------------------------------------- + +//Ein Macro + +enum ScriptType +{ + STARBASIC, + JAVASCRIPT, + EXTENDED_STYPE +}; + +// Basisklasse fuer SjJSbxObject mit virtuellem Destruktor +class SjJSbxObjectBase +{ +public: + virtual ~SjJSbxObjectBase(); + virtual SjJSbxObjectBase* Clone( void ); + //virtual SjJSbxObjectBase& operator=( const SjJSbxObjectBase& rBase ); +}; + +class SjJSbxObject; + +class SVT_DLLPUBLIC SvxMacro +{ + String aMacName; + String aLibName; + // Fuer JavaScript muss ein Function-Objekt gehalten werden + SjJSbxObjectBase* pFunctionObject; + ScriptType eType; + +public: + + SvxMacro( const String &rMacName, const String &rLanguage); + + SvxMacro( const String &rMacName, const String &rLibName, + ScriptType eType); // = STARBASIC entfernt + + SvxMacro( SjJSbxObjectBase* _pFunctionObject, const String &rSource ); + ~SvxMacro(); // noetig fuer pFunctionObject + + const String &GetLibName() const { return aLibName; } + const String &GetMacName() const { return aMacName; } + String GetLanguage()const; + + ScriptType GetScriptType() const { return eType; } + + BOOL HasMacro() const { return aMacName.Len() ? TRUE : FALSE; } + +#ifdef SOLAR_JAVA + // JavaScript-Function-Objekt holen + // ACHTUNG: Implementation in SJ, Source/JScript/sjimpl.cxx + SjJSbxObjectBase* GetFunctionObject( SjJSbxObject* pParent ); +#endif + + SvxMacro& operator=( const SvxMacro& rBase ); +}; + +inline SvxMacro::SvxMacro( const String &rMacName, const String &rLibName, + ScriptType eTyp ) + : aMacName( rMacName ), aLibName( rLibName ), pFunctionObject(NULL), eType( eTyp ) +{} + +inline SvxMacro::SvxMacro( SjJSbxObjectBase* _pFunctionObject, const String &rSource ) + : aMacName( rSource ), pFunctionObject( _pFunctionObject ), eType( JAVASCRIPT ) +{} + +//Macro Table, zerstoert die Pointer im DTor! + +DECLARE_TABLE( _SvxMacroTableDtor, SvxMacro* ) + +#define SVX_MACROTBL_VERSION31 0 +#define SVX_MACROTBL_VERSION40 1 + +#define SVX_MACROTBL_AKTVERSION SVX_MACROTBL_VERSION40 + +class SVT_DLLPUBLIC SvxMacroTableDtor : public _SvxMacroTableDtor +{ +public: + inline SvxMacroTableDtor( const USHORT nInitSz = 0, const USHORT nReSz = 1 ); + inline SvxMacroTableDtor( const SvxMacroTableDtor &rCpy ) : _SvxMacroTableDtor() { *this = rCpy; } + inline ~SvxMacroTableDtor() { DelDtor(); } + SvxMacroTableDtor& operator=( const SvxMacroTableDtor &rCpy ); + + // loescht alle Eintraege + void DelDtor(); + + SvStream& Read( SvStream &, USHORT nVersion = SVX_MACROTBL_AKTVERSION ); + SvStream& Write( SvStream & ) const; + + USHORT GetVersion() const { return SVX_MACROTBL_AKTVERSION; } +}; + +inline SvxMacroTableDtor::SvxMacroTableDtor( const USHORT nInitSz, + const USHORT nReSz) + : _SvxMacroTableDtor( nInitSz, nReSz ) +{} + +/* +[Beschreibung] +Dieses Item beschreibt eine Makro-Tabelle. +*/ + +class SVT_DLLPUBLIC SvxMacroItem: public SfxPoolItem +{ +public: + TYPEINFO(); + + inline SvxMacroItem ( const USHORT nId /*= ITEMID_MACRO*/ ); + + // "pure virtual Methoden" vom SfxPoolItem + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + XubString &rText, + const IntlWrapper * = 0 ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, USHORT) const; + virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const; + virtual USHORT GetVersion( USHORT nFileFormatVersion ) const; + + inline const SvxMacroTableDtor& GetMacroTable() const { return aMacroTable;} + inline void SetMacroTable( const SvxMacroTableDtor& rTbl ) { aMacroTable = rTbl; } + + inline const SvxMacro& GetMacro( USHORT nEvent ) const; + inline BOOL HasMacro( USHORT nEvent ) const; + void SetMacro( USHORT nEvent, const SvxMacro& ); + inline BOOL DelMacro( USHORT nEvent ); + +private: + SvxMacroTableDtor aMacroTable; + + inline SvxMacroItem( const SvxMacroItem& ); + SvxMacroItem &operator=( const SvxMacroItem & ); +}; + +inline SvxMacroItem::SvxMacroItem( const USHORT nId ) + : SfxPoolItem( nId ) +{} +inline SvxMacroItem::SvxMacroItem( const SvxMacroItem &rCpy ) + : SfxPoolItem( rCpy ), + aMacroTable( rCpy.GetMacroTable() ) +{} + +inline BOOL SvxMacroItem::HasMacro( USHORT nEvent ) const +{ + return aMacroTable.IsKeyValid( nEvent ); +} +inline const SvxMacro& SvxMacroItem::GetMacro( USHORT nEvent ) const +{ + return *(aMacroTable.Get(nEvent)); +} +inline BOOL SvxMacroItem::DelMacro( USHORT nEvent ) +{ + SvxMacro *pMacro = aMacroTable.Remove( nEvent ); + delete pMacro; + return ( pMacro != 0 ); +} + +#endif diff --git a/svl/inc/svl/metitem.hxx b/svl/inc/svl/metitem.hxx new file mode 100644 index 000000000000..a37d119d57c1 --- /dev/null +++ b/svl/inc/svl/metitem.hxx @@ -0,0 +1,56 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: metitem.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFXMETRICITEM_HXX +#define _SFXMETRICITEM_HXX + +#include "svtools/svtdllapi.h" +#include + +DBG_NAMEEX_VISIBILITY(SfxMetricItem, SVT_DLLPUBLIC) + +// ----------------------------------------------------------------------- + +class SVT_DLLPUBLIC SfxMetricItem: public SfxInt32Item +{ +public: + TYPEINFO(); + SfxMetricItem( USHORT nWhich = 0, UINT32 nValue = 0 ); + SfxMetricItem( USHORT nWhich, SvStream & ); + SfxMetricItem( const SfxMetricItem& ); + ~SfxMetricItem() { + DBG_DTOR(SfxMetricItem, 0); } + + virtual int ScaleMetrics( long lMult, long lDiv ); + virtual int HasMetrics() const; + +}; + +#endif + diff --git a/svl/inc/svl/nfkeytab.hxx b/svl/inc/svl/nfkeytab.hxx new file mode 100644 index 000000000000..ba8c24f319f6 --- /dev/null +++ b/svl/inc/svl/nfkeytab.hxx @@ -0,0 +1,120 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: nfkeytab.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_SVTOOLS_NFKEYTAB_HXX +#define INCLUDED_SVTOOLS_NFKEYTAB_HXX + +#include + +//! For ImpSvNumberformatScan: first the short symbols, then the long symbols! +//! e.g. first TT then TTTT +//! The internal order is essentially for the format code string scanner! +//! New keywords MUST NOT be inserted, only the NF_KEY_UNUSEDn may be used, +//! NF_KEY_LASTKEYWORD must be adjusted accordingly. Otherwise old versions +//! will fail upon reading these entries. Nevertheless, old versions are NOT +//! able to display those new keywords => blank display. +// +// Note: 2005-09-02: the above applies to the binary file format. +// +// ER 15.12.99: This table is externally only to be used with method +// String SvNumberformat::GetMappedFormatstring( const NfKeywordTable&, const LocaleDataWrapper& ); +// and method +// void SvNumberFormatter::FillKeywordTable( NfKeywordTable&, LanguageType ); +enum NfKeywordIndex +{ + NF_KEY_NONE = 0, + NF_KEY_E, // exponential symbol + NF_KEY_AMPM, // AM/PM + NF_KEY_AP, // a/p + NF_KEY_MI, // minute (!) + NF_KEY_MMI, // minute 02 (!) + NF_KEY_M, // month (!) + NF_KEY_MM, // month 02 (!) + NF_KEY_MMM, // month short name + NF_KEY_MMMM, // month long name + NF_KEY_H, // hour + NF_KEY_HH, // hour 02 + NF_KEY_S, // second + NF_KEY_SS, // second 02 + NF_KEY_Q, // quarter + NF_KEY_QQ, // quarter 02 + NF_KEY_D, // day of month + NF_KEY_DD, // day of month 02 + NF_KEY_DDD, // day of week short + NF_KEY_DDDD, // day of week long + NF_KEY_YY, // year two digits + NF_KEY_YYYY, // year four digits + NF_KEY_NN, // day of week short + NF_KEY_NNNN, // day of week long with separator + NF_KEY_CCC, // currency bank symbol (old version) + NF_KEY_GENERAL, // General / Standard + NF_KEY_LASTOLDKEYWORD = NF_KEY_GENERAL, + NF_KEY_NNN, // day of week long without separator, as of version 6, 10.10.97 + NF_KEY_WW, // week of year, as of version 8, 19.06.98 + NF_KEY_MMMMM, // first letter of month name + NF_KEY_LASTKEYWORD = NF_KEY_MMMMM, + NF_KEY_UNUSED4, + NF_KEY_QUARTER, // was quarter word, not used anymore from SRC631 on (26.04.01) + NF_KEY_TRUE, // boolean true + NF_KEY_FALSE, // boolean false + NF_KEY_BOOLEAN, // boolean + NF_KEY_COLOR, // color + NF_KEY_FIRSTCOLOR, + NF_KEY_BLACK = NF_KEY_FIRSTCOLOR, // you do know colors, don't you? + NF_KEY_BLUE, + NF_KEY_GREEN, + NF_KEY_CYAN, + NF_KEY_RED, + NF_KEY_MAGENTA, + NF_KEY_BROWN, + NF_KEY_GREY, + NF_KEY_YELLOW, + NF_KEY_WHITE, + NF_KEY_LASTCOLOR = NF_KEY_WHITE, + NF_KEY_LASTKEYWORD_SO5 = NF_KEY_LASTCOLOR, + //! Keys from here on can't be saved in SO5 file format and MUST be + //! converted to string which means losing any information. + NF_KEY_AAA, // abbreviated day name from Japanese Xcl, same as DDD or NN English + NF_KEY_AAAA, // full day name from Japanese Xcl, same as DDDD or NNN English + NF_KEY_EC, // E non-gregorian calendar year without preceding 0 + NF_KEY_EEC, // EE non-gregorian calendar year with preceding 0 (two digit) + NF_KEY_G, // abbreviated era name, latin characters M T S or H for Gengou calendar + NF_KEY_GG, // abbreviated era name + NF_KEY_GGG, // full era name + NF_KEY_R, // acts as EE (Xcl) => GR==GEE, GGR==GGEE, GGGR==GGGEE + NF_KEY_RR, // acts as GGGEE (Xcl) + NF_KEY_THAI_T, // Thai T modifier, speciality of Thai Excel, only used with Thai locale and converted to [NatNum1] + NF_KEYWORD_ENTRIES_COUNT +}; + +typedef String NfKeywordTable [NF_KEYWORD_ENTRIES_COUNT]; + +#endif // INCLUDED_SVTOOLS_NFKEYTAB_HXX + diff --git a/svl/inc/svl/nfversi.hxx b/svl/inc/svl/nfversi.hxx new file mode 100644 index 000000000000..23375369ddb3 --- /dev/null +++ b/svl/inc/svl/nfversi.hxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: nfversi.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef NF_NFVERSI_HXX +#define NF_NFVERSI_HXX + +// file ID's + +#define SV_NUMBERFORMATTER_VERSION_SYSTORE 0x0004 +#define SV_NUMBERFORMATTER_VERSION_KEYWORDS 0x0005 +#define SV_NUMBERFORMATTER_VERSION_NEWSTANDARD 0x0006 +#define SV_NUMBERFORMATTER_VERSION_NF_TIME_HH_MMSS00 0x0007 +#define SV_NUMBERFORMATTER_VERSION_NF_DATE_WW 0x0008 +#define SV_NUMBERFORMATTER_VERSION_NEW_CURR 0x0009 +#define SV_NUMBERFORMATTER_VERSION_YEAR2000 0x000a +#define SV_NUMBERFORMATTER_VERSION_TWODIGITYEAR 0x000b +#define SV_NUMBERFORMATTER_VERSION_NF_DATETIME_SYS_DDMMYYYY_HHMMSS 0x000c +#define SV_NUMBERFORMATTER_VERSION_CALENDAR 0x000d +#define SV_NUMBERFORMATTER_VERSION_ADDITIONAL_I18N_FORMATS 0x000e + +#define SV_NUMBERFORMATTER_VERSION 0x000e + +// 1 bis 18.01.96 +// 2 ab 19.01.96, TT.MM.JJJJ dazu +// 3 ab 13.02.96 (nicht emergency) #.##0,00 CCC dazu +// 4 ab 30.07.97 364i speichern, was SYSTEM wirklich war (vorhandenes +// Dummy-Feld wird benutzt, keine File-Format Aenderung) +// 5 ab 07.08.97 nicht-deutsch ist nicht immer englisch +// aeltere nicht-deutsche benutzerdefinierte Formate onLoad +// konvertieren +// 6 ab 17.10.97 neu: Keyword NNN fuer langen Wochentag ohne Separator, +// wird in aelteren Versionen nicht ausgewertet! +// Neue Standard Datumformate, DIN etc. +// 7 ab 25.05.98 StandardFormat [HH]:MM:SS,00 (NF_TIME_HH_MMSS00) fuer +// automatische Eingabe-Erkennung von 100stel Sekunden mit Stunden +// 8 ab 19.06.98 StandardFormat WW (NF_DATE_WW) fuer Kalenderwoche +// 9 ab 17.12.98 neue Waehrungsformate [$DM-xxx] +// A ab 25.01.99 Year2000 speichern/laden +// B ab 12.02.99 Year2000 ist allgemeines TwoDigitYearStart +// C ??.??.?? date/time format of system variables +// D 23.11.00 new calendar +// E 19.01.01 additional formats provided by i18n + +#endif + diff --git a/svl/inc/svl/nranges.hxx b/svl/inc/svl/nranges.hxx new file mode 100644 index 000000000000..6996669cdeb1 --- /dev/null +++ b/svl/inc/svl/nranges.hxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: nranges.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifdef MACOSX +// We need an empty block in here. Otherwise, if the #ifndef _SFXNRANGES_HXX +// line is the first line, the Mac OS X version of the gcc preprocessor will +// incorrectly optimize the inclusion process and will never include this file +// a second time +#endif + +#ifndef _SFXNRANGES_HXX + +#ifndef NUMTYPE + +#define NUMTYPE USHORT +#define SfxNumRanges SfxUShortRanges +#include + +#undef NUMTYPE +#define NUMTYPE ULONG +#define SfxNumRanges SfxULongRanges +#include + +#define _SFXNRANGES_HXX + +#else +#include + +//======================================================================== + +#define NUMTYPE_ARG int + +class SfxNumRanges +{ + NUMTYPE* _pRanges; // 0-terminated array of NUMTYPE-pairs + +public: + SfxNumRanges() : _pRanges( 0 ) {} + SfxNumRanges( const SfxNumRanges &rOrig ); + SfxNumRanges( NUMTYPE nWhich1, NUMTYPE nWhich2 ); + SfxNumRanges( NUMTYPE_ARG nWh1, NUMTYPE_ARG nWh2, NUMTYPE_ARG nNull, ... ); + SfxNumRanges( const NUMTYPE* nNumTable ); + ~SfxNumRanges() + { delete [] _pRanges; } + + BOOL operator == ( const SfxNumRanges & ) const; + BOOL operator != ( const SfxNumRanges & rRanges ) const + { return !( *this == rRanges ); } + + SfxNumRanges& operator = ( const SfxNumRanges & ); + + SfxNumRanges& operator += ( const SfxNumRanges & ); + SfxNumRanges& operator -= ( const SfxNumRanges & ); + SfxNumRanges& operator /= ( const SfxNumRanges & ); + + NUMTYPE Count() const; + BOOL IsEmpty() const + { return !_pRanges || 0 == *_pRanges; } + BOOL Contains( NUMTYPE n ) const; + BOOL Intersects( const SfxNumRanges & ) const; + + operator const NUMTYPE* () const + { return _pRanges; } +}; + +#undef NUMTYPE +#undef SfxNumRanges + +#endif + +#endif diff --git a/svl/inc/svl/ondemand.hxx b/svl/inc/svl/ondemand.hxx new file mode 100644 index 000000000000..e8361307eb9e --- /dev/null +++ b/svl/inc/svl/ondemand.hxx @@ -0,0 +1,468 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ondemand.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_SVTOOLS_ONDEMAND_HXX +#define INCLUDED_SVTOOLS_ONDEMAND_HXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + On demand instanciation and initialization of several i18n wrappers, + helping the number formatter to not perform worse than it already does. + */ + +/** @short + Switch between LANGUAGE_SYSTEM and LANGUAGE_ENGLISH_US and any other + LocaleDataWrapper. + SvNumberformatter uses it upon switching locales. + + @descr + Avoids reloading and analysing of locale data again and again. + + @ATTENTION + If the default ctor is used the init() method MUST be called before + accessing any locale data. The passed parameters Locale and LanguageType + must match each other. + */ + +class OnDemandLocaleDataWrapper +{ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr; + SvtSysLocale aSysLocale; + LanguageType eCurrentLanguage; + LanguageType eLastAnyLanguage; + const LocaleDataWrapper* pSystem; + const LocaleDataWrapper* pEnglish; + LocaleDataWrapper* pAny; + const LocaleDataWrapper* pCurrent; + bool bInitialized; + +public: + OnDemandLocaleDataWrapper() + : eLastAnyLanguage( LANGUAGE_DONTKNOW ) + , pEnglish(0) + , pAny(0) + , bInitialized(false) + { + pCurrent = pSystem = aSysLocale.GetLocaleDataPtr(); + eCurrentLanguage = LANGUAGE_SYSTEM; + } + OnDemandLocaleDataWrapper( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, + ::com::sun::star::lang::Locale& rLocale, + LanguageType eLang + ) + : pEnglish(0) + , pAny(0) + , pCurrent(0) + , bInitialized(false) + { + pSystem = aSysLocale.GetLocaleDataPtr(); + init( rxSMgr, rLocale, eLang ); + } + ~OnDemandLocaleDataWrapper() + { + delete pEnglish; + delete pAny; + } + + bool isInitialized() const { return bInitialized; } + + bool is() const { return pCurrent != NULL; } + + void init( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, + ::com::sun::star::lang::Locale& rLocale, + LanguageType eLang + ) + { + xSMgr = rxSMgr; + changeLocale( rLocale, eLang ); + bInitialized = true; + } + + void changeLocale( ::com::sun::star::lang::Locale& rLocale, LanguageType eLang ) + { + switch ( eLang ) + { + case LANGUAGE_SYSTEM : + pCurrent = pSystem; + break; + case LANGUAGE_ENGLISH_US : + if ( !pEnglish ) + pEnglish = new LocaleDataWrapper( xSMgr, rLocale ); + pCurrent = pEnglish; + break; + default: + if ( !pAny ) + { + pAny = new LocaleDataWrapper( xSMgr, rLocale ); + eLastAnyLanguage = eLang; + } + else if ( eLastAnyLanguage != eLang ) + { + pAny->setLocale( rLocale ); + eLastAnyLanguage = eLang; + } + pCurrent = pAny; + } + eCurrentLanguage = eLang; + } + + LanguageType getCurrentLanguage() const + { return eCurrentLanguage; } + + LocaleDataWrapper* getAnyLocale() + { + if ( !pAny ) + { + pAny = new LocaleDataWrapper( xSMgr, pCurrent->getLocale() ); + eLastAnyLanguage = eCurrentLanguage; + } + else if ( pCurrent != pAny ) + { + pAny->setLocale( pCurrent->getLocale() ); + eLastAnyLanguage = eCurrentLanguage; + } + return pAny; + } + + const LocaleDataWrapper* get() const { return pCurrent; } + const LocaleDataWrapper* operator->() const { return get(); } + const LocaleDataWrapper& operator*() const { return *get(); } +}; + +/** Load a calendar only if it's needed. + SvNumberformatter uses it upon switching locales. + @ATTENTION If the default ctor is used the init() method MUST be called + before accessing the calendar. + */ +class OnDemandCalendarWrapper +{ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr; + ::com::sun::star::lang::Locale aLocale; + mutable CalendarWrapper* pPtr; + mutable bool bValid; + bool bInitialized; + +public: + OnDemandCalendarWrapper() + : pPtr(0) + , bValid(false) + , bInitialized(false) + {} + OnDemandCalendarWrapper( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, + ::com::sun::star::lang::Locale& rLocale + ) + : bValid(false) + , bInitialized(false) + { + init( rxSMgr, rLocale ); + } + ~OnDemandCalendarWrapper() + { + delete pPtr; + } + + bool isInitialized() const { return bInitialized; } + + bool is() const { return pPtr != NULL; } + + void init( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, + ::com::sun::star::lang::Locale& rLocale + ) + { + xSMgr = rxSMgr; + changeLocale( rLocale ); + if ( pPtr ) + { + delete pPtr; + pPtr = NULL; + } + bInitialized = true; + } + + void changeLocale( ::com::sun::star::lang::Locale& rLocale ) + { + bValid = false; + aLocale = rLocale; + } + + CalendarWrapper* get() const + { + if ( !bValid ) + { + if ( !pPtr ) + pPtr = new CalendarWrapper( xSMgr ); + pPtr->loadDefaultCalendar( aLocale ); + bValid = true; + } + return pPtr; + } + + CalendarWrapper* operator->() { return get(); } + CalendarWrapper& operator*() { return *get(); } +}; + +/** Load a collator only if it's needed. + SvNumberformatter uses it upon switching locales. + @ATTENTION If the default ctor is used the init() method MUST be called + before accessing the collator. + */ +class OnDemandCollatorWrapper +{ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr; + ::com::sun::star::lang::Locale aLocale; + mutable CollatorWrapper* pPtr; + mutable bool bValid; + bool bInitialized; + +public: + OnDemandCollatorWrapper() + : pPtr(0) + , bValid(false) + , bInitialized(false) + {} + OnDemandCollatorWrapper( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, + ::com::sun::star::lang::Locale& rLocale + ) + : bValid(false) + , bInitialized(false) + { + init( rxSMgr, rLocale ); + } + ~OnDemandCollatorWrapper() + { + delete pPtr; + } + + bool isInitialized() const { return bInitialized; } + + bool is() const { return pPtr != NULL; } + + void init( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, + ::com::sun::star::lang::Locale& rLocale + ) + { + xSMgr = rxSMgr; + changeLocale( rLocale ); + if ( pPtr ) + { + delete pPtr; + pPtr = NULL; + } + bInitialized = true; + } + + void changeLocale( ::com::sun::star::lang::Locale& rLocale ) + { + bValid = false; + aLocale = rLocale; + } + + const CollatorWrapper* get() const + { + if ( !bValid ) + { + if ( !pPtr ) + pPtr = new CollatorWrapper( xSMgr ); + pPtr->loadDefaultCollator( aLocale, ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE ); + bValid = true; + } + return pPtr; + } + + const CollatorWrapper* operator->() const { return get(); } + const CollatorWrapper& operator*() const { return *get(); } +}; + +/** Load a transliteration only if it's needed. + SvNumberformatter uses it upon switching locales. + @ATTENTION If the default ctor is used the init() method MUST be called + before accessing the transliteration. + */ +class OnDemandTransliterationWrapper +{ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr; + LanguageType eLanguage; + ::com::sun::star::i18n::TransliterationModules nType; + mutable ::utl::TransliterationWrapper* pPtr; + mutable bool bValid; + bool bInitialized; + +public: + OnDemandTransliterationWrapper() + : eLanguage( LANGUAGE_SYSTEM ) + , pPtr(0) + , bValid(false) + , bInitialized(false) + {} + OnDemandTransliterationWrapper( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, + LanguageType eLang, + ::com::sun::star::i18n::TransliterationModules nTypeP + ) + : bValid(false) + , bInitialized(false) + { + init( rxSMgr, eLang, nTypeP ); + } + ~OnDemandTransliterationWrapper() + { + delete pPtr; + } + + bool isInitialized() const { return bInitialized; } + + bool is() const { return pPtr != NULL; } + + void init( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, + LanguageType eLang, + ::com::sun::star::i18n::TransliterationModules nTypeP + ) + { + xSMgr = rxSMgr; + nType = nTypeP; + changeLocale( eLang ); + if ( pPtr ) + { + delete pPtr; + pPtr = NULL; + } + bInitialized = true; + } + + void changeLocale( LanguageType eLang ) + { + bValid = false; + eLanguage = eLang; + } + + const ::utl::TransliterationWrapper* get() const + { + if ( !bValid ) + { + if ( !pPtr ) + pPtr = new ::utl::TransliterationWrapper( xSMgr, nType ); + pPtr->loadModuleIfNeeded( eLanguage ); + bValid = true; + } + return pPtr; + } + + const ::utl::TransliterationWrapper* getForModule( const String& rModule, LanguageType eLang ) const + { + if ( !pPtr ) + pPtr = new ::utl::TransliterationWrapper( xSMgr, nType ); + pPtr->loadModuleByImplName( rModule, eLang ); + bValid = false; // reforce settings change in get() + return pPtr; + } + + const ::utl::TransliterationWrapper* operator->() const { return get(); } + const ::utl::TransliterationWrapper& operator*() const { return *get(); } +}; + +/** Load a native number service wrapper only if it's needed. + SvNumberformatter uses it. + + @ATTENTION + If the default ctor is used the init() method MUST be called + before accessing the native number supplier. + */ +class OnDemandNativeNumberWrapper +{ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr; + mutable NativeNumberWrapper* pPtr; + bool bInitialized; + +public: + OnDemandNativeNumberWrapper() + : pPtr(0) + , bInitialized(false) + {} + OnDemandNativeNumberWrapper( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr + ) + : pPtr(0) + , bInitialized(false) + { + init( rxSMgr ); + } + ~OnDemandNativeNumberWrapper() + { + delete pPtr; + } + + bool isInitialized() const { return bInitialized; } + + void init( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr + ) + { + xSMgr = rxSMgr; + if ( pPtr ) + { + delete pPtr; + pPtr = NULL; + } + bInitialized = true; + } + + bool is() const { return pPtr != NULL; } + + NativeNumberWrapper* get() const + { + if ( !pPtr ) + pPtr = new NativeNumberWrapper( xSMgr ); + return pPtr; + } + + NativeNumberWrapper* operator->() { return get(); } + NativeNumberWrapper& operator*() { return *get(); } +}; + +#endif // INCLUDED_SVTOOLS_ONDEMAND_HXX + diff --git a/svl/inc/svl/ownlist.hxx b/svl/inc/svl/ownlist.hxx new file mode 100644 index 000000000000..472f50e6ef60 --- /dev/null +++ b/svl/inc/svl/ownlist.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ownlist.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _OWNLIST_HXX +#define _OWNLIST_HXX + +#include "svtools/svtdllapi.h" +#include +#include +#include + +namespace com { namespace sun { namespace star { + namespace beans { + struct PropertyValue; + } +}}} + +//========================================================================= +class SvCommand +/* [Beschreibung] + + Enth"alt einen String, welcher das Kommando angibt und eine weiteren + String, der das Argument des Kommandos bildet. W"urde solch ein + Kommando "uber die Kommandozeile angegeben werden, s"ahe es wie folgt + aus: Kommando = Argument. +*/ +{ + String aCommand; + String aArgument; +public: + SvCommand() {} + SvCommand( const String & rCommand, const String & rArg ) + { + aCommand = rCommand; + aArgument = rArg; + } + const String & GetCommand() const { return aCommand; } + const String & GetArgument() const { return aArgument; } + + friend SvStream& operator >> ( SvStream& rStm, SvCommand & rThis ) + { + rStm.ReadByteString( rThis.aCommand, gsl_getSystemTextEncoding() ); + rStm.ReadByteString( rThis.aArgument, gsl_getSystemTextEncoding() ); + return rStm; + } + friend SvStream& operator << ( SvStream& rStm, const SvCommand & rThis ) + { + rStm.WriteByteString( rThis.aCommand, gsl_getSystemTextEncoding() ); + rStm.WriteByteString( rThis.aArgument, gsl_getSystemTextEncoding() ); + return rStm; + } +}; + +//========================================================================= +class SVT_DLLPUBLIC SvCommandList +/* [Beschreibung] + + Die Liste enth"alt Objekte vom Typ SvCommand. Wird ein Objekt + eingef"ugt, dann wird es kopiert und das neue Objekt wird + in die Liste gestellt. +*/ +{ + PRV_SV_DECL_OWNER_LIST(SvCommandList,SvCommand); + SvCommand & Append( const String & rCommand, const String & rArg ); + BOOL AppendCommands( const String & rCmd, USHORT * pEaten ); + String GetCommands() const; + + BOOL FillFromSequence( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& ); + void FillSequence( com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& ); + + SVT_DLLPUBLIC friend SvStream& operator >> ( SvStream& rStm, SvCommandList & ); + SVT_DLLPUBLIC friend SvStream& operator << ( SvStream&, const SvCommandList & ); +}; + +#endif // _OWNLIST_HXX diff --git a/svl/inc/svl/poolitem.hxx b/svl/inc/svl/poolitem.hxx new file mode 100644 index 000000000000..7e0fea44b87a --- /dev/null +++ b/svl/inc/svl/poolitem.hxx @@ -0,0 +1,491 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: poolitem.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFXPOOLITEM_HXX +#define _SFXPOOLITEM_HXX + +#include "svtools/svldllapi.h" +#include + +#define TF_POOLABLE +#include +#include +#include +#include +#include +#include +#include +#include + +typedef long SfxArgumentError; + +class SbxVariable; +class SbxObject; +class SvStream; +class Color; +class IntlWrapper; + +namespace com { namespace sun { namespace star { namespace uno { class Any; } } } } + +#define SFX_ITEMS_DIRECT 0xffff +#define SFX_ITEMS_NULL 0xfff0 // anstelle StoreSurrogate + +#define SFX_ITEMS_POOLDEFAULT 0xffff +#define SFX_ITEMS_STATICDEFAULT 0xfffe +#define SFX_ITEMS_DELETEONIDLE 0xfffd + +#define SFX_ITEMS_OLD_MAXREF 0xffef +#define SFX_ITEMS_MAXREF 0xfffffffe +#define SFX_ITEMS_SPECIAL 0xffffffff + +#define CONVERT_TWIPS 0x80 //Uno-Konvertierung fuer Massangaben (fuer MemberId) + +// ----------------------------------------------------------------------- + +// UNO3 shortcuts + +// warning, if there is no boolean inside the any this will always return the value false +inline sal_Bool Any2Bool( const ::com::sun::star::uno::Any&rValue ) +{ + sal_Bool nValue = sal_False; + if( rValue.hasValue() ) + { + if( rValue.getValueType() == ::getCppuBooleanType() ) + { + nValue = *(sal_Bool*)rValue.getValue(); + } + else + { + sal_Int32 nNum = 0; + if( rValue >>= nNum ) + nValue = nNum != 0; + } + } + + return nValue; +} + +inline ::com::sun::star::uno::Any Bool2Any( sal_Bool bValue ) +{ + return ::com::sun::star::uno::Any( &bValue, ::getCppuBooleanType() ); +} + +// ----------------------------------------------------------------------- + +//! Notloesung!!! +enum SfxFieldUnit +{ + SFX_FUNIT_NONE, SFX_FUNIT_MM, SFX_FUNIT_CM, SFX_FUNIT_M, SFX_FUNIT_KM, + SFX_FUNIT_TWIP, SFX_FUNIT_POINT, SFX_FUNIT_PICA, + SFX_FUNIT_INCH, SFX_FUNIT_FOOT, SFX_FUNIT_MILE, SFX_FUNIT_CUSTOM +}; + +enum SfxMapUnit +{ + SFX_MAPUNIT_100TH_MM, + SFX_MAPUNIT_10TH_MM, + SFX_MAPUNIT_MM, + SFX_MAPUNIT_CM, + SFX_MAPUNIT_1000TH_INCH, + SFX_MAPUNIT_100TH_INCH, + SFX_MAPUNIT_10TH_INCH, + SFX_MAPUNIT_INCH, + SFX_MAPUNIT_POINT, + SFX_MAPUNIT_TWIP, + SFX_MAPUNIT_PIXEL, + SFX_MAPUNIT_SYSFONT, + SFX_MAPUNIT_APPFONT, + SFX_MAPUNIT_RELATIVE, + SFX_MAPUNIT_ABSOLUTE +}; + +// ----------------------------------------------------------------------- + +enum SfxItemPresentation + +/* [Beschreibung] + + Die Werte dieses Enums bezeichnen den Grad der textuellen + Presentation eines Items nach Aufruf der virtuellen Methode + . +*/ + +{ + SFX_ITEM_PRESENTATION_NONE, + SFX_ITEM_PRESENTATION_NAMEONLY, + SFX_ITEM_PRESENTATION_NAMELESS, + SFX_ITEM_PRESENTATION_COMPLETE +}; + +// ----------------------------------------------------------------------- + +typedef USHORT SfxItemState; + +#define SFX_ITEM_UNKNOWN 0x0000 + +#define SFX_ITEM_DISABLED 0x0001 +#define SFX_ITEM_READONLY 0x0002 + +#define SFX_ITEM_DONTCARE 0x0010 +#define SFX_ITEM_DEFAULT 0x0020 +#define SFX_ITEM_SET 0x0030 + +// old stuff - dont use!!! +#define SFX_ITEM_AVAILABLE SFX_ITEM_DEFAULT +#define SFX_ITEM_OFF SFX_ITEM_DEFAULT +#define SFX_ITEM_ON SFX_ITEM_SET + +DBG_NAMEEX_VISIBILITY(SfxPoolItem, SVL_DLLPUBLIC) +DBG_NAMEEX(SfxVoidItem) +DBG_NAMEEX(SfxItemHandle) + +class SvXMLUnitConverter; +class SfxItemPool; +class SfxItemSet; + +class String; +namespace rtl +{ + class OUString; +} + +// ----------------------------------------------------------------------- + +class SVL_DLLPUBLIC SfxPoolItem +{ +friend class SfxItemPool; +friend class SfxItemDesruptor_Impl; +friend class SfxItemPoolCache; +friend class SfxItemSet; +friend class SfxVoidItem; + + ULONG nRefCount; // Referenzzaehler + USHORT nWhich; + USHORT nKind; + +private: + inline void SetRefCount( ULONG n ); + inline void SetKind( USHORT n ); +public: + inline ULONG AddRef( ULONG n = 1 ) const; +private: + inline ULONG ReleaseRef( ULONG n = 1 ) const; + SVL_DLLPRIVATE long Delete_Impl(void*); + +#if 0 + // @@@ virtual, but private, and dummy impl. @@@ + virtual void Store( SvStream & ) const; + virtual void GetVersion() const; +#endif + +protected: + SfxPoolItem( USHORT nWhich = 0 ); + SfxPoolItem( const SfxPoolItem& ); + +public: + TYPEINFO(); + virtual ~SfxPoolItem(); + + void SetWhich( USHORT nId ) { + DBG_CHKTHIS(SfxPoolItem, 0); + nWhich = nId; } + USHORT Which() const { + DBG_CHKTHIS(SfxPoolItem, 0); + return nWhich; } + virtual int operator==( const SfxPoolItem& ) const = 0; + int operator!=( const SfxPoolItem& rItem ) const + { return !(*this == rItem); } + virtual int Compare( const SfxPoolItem &rWith ) const; + virtual int Compare( const SfxPoolItem &rWith, const IntlWrapper& rIntlWrapper ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePresentation, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresentationMetric, + XubString &rText, + const IntlWrapper * pIntlWrapper = 0 ) const; + + virtual USHORT GetVersion( USHORT nFileFormatVersion ) const; + virtual int ScaleMetrics( long lMult, long lDiv ); + virtual int HasMetrics() const; + + virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; + virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + + virtual SfxPoolItem* Create( SvStream &, USHORT nItemVersion ) const; + virtual SvStream& Store( SvStream &, USHORT nItemVersion ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const = 0; + + ULONG GetRefCount() const { return nRefCount; } + inline USHORT GetKind() const { return nKind; } + + /** Read in a Unicode string from a streamed byte string representation. + + @param rStream Some (input) stream. Its Stream/TargetCharSets must + be set to correct values! + + @param rString On success, returns the reconstructed Unicode string. + + @return True if the string was successfuly read and reconstructed. + */ + static bool readByteString(SvStream & rStream, UniString & rString); + + /** Write a byte string representation of a Unicode string into a stream. + + @param rStream Some (output) stream. Its Stream/TargetCharSets must + be set to correct values! + + @param rString Some Unicode string. + */ + static void writeByteString(SvStream & rStream, + UniString const & rString); + + /** Read in a Unicode string from either a streamed Unicode or byte string + representation. + + @param rStream Some (input) stream. If bUnicode is false, its + Stream/TargetCharSets must be set to correct values! + + @param rString On success, returns the reconstructed Unicode string. + + @param bUnicode Whether to read in a stream Unicode (true) or byte + string (false) representation. + + @return True if the string was successfuly read and reconstructed. + */ + static bool readUnicodeString(SvStream & rStream, UniString & rString, + bool bUnicode); + + /** Write a Unicode string representation of a Unicode string into a + stream. + + @param rStream Some (output) stream. + + @param rString Some Unicode string. + */ + static void writeUnicodeString(SvStream & rStream, + UniString const & rString); + +private: + SfxPoolItem& operator=( const SfxPoolItem& ); // n.i.!! +}; + +// ----------------------------------------------------------------------- + +inline void SfxPoolItem::SetRefCount( ULONG n ) +{ + DBG_CHKTHIS( SfxPoolItem, 0 ); + nRefCount = n; + nKind = 0; +} + +inline void SfxPoolItem::SetKind( USHORT n ) +{ + DBG_CHKTHIS( SfxPoolItem, 0 ); + nRefCount = SFX_ITEMS_SPECIAL; + nKind = n; +} + +inline ULONG SfxPoolItem::AddRef( ULONG n ) const +{ + DBG_CHKTHIS( SfxPoolItem, 0 ); + DBG_ASSERT( nRefCount <= SFX_ITEMS_MAXREF, "AddRef mit nicht-Pool-Item" ); + DBG_ASSERT( ULONG_MAX - nRefCount > n, "AddRef: Referenzzaehler ueberschlaegt sich" ); + return ( ((SfxPoolItem *)this)->nRefCount += n ); +} + +inline ULONG SfxPoolItem::ReleaseRef( ULONG n ) const +{ + DBG_CHKTHIS( SfxPoolItem, 0 ); + DBG_ASSERT( nRefCount <= SFX_ITEMS_MAXREF, "AddRef mit nicht-Pool-Item" ); + DBG_ASSERT( nRefCount >= n, "ReleaseRef: Referenzzaehler ueberschlaegt sich" ); + ((SfxPoolItem *)this)->nRefCount -= n; + return nRefCount; +} + +// ----------------------------------------------------------------------- + +inline int IsPoolDefaultItem(const SfxPoolItem *pItem ) +{ + return pItem && pItem->GetKind() == SFX_ITEMS_POOLDEFAULT; +} + +inline int IsStaticDefaultItem(const SfxPoolItem *pItem ) +{ + return pItem && pItem->GetKind() == SFX_ITEMS_STATICDEFAULT; +} + +inline int IsDefaultItem( const SfxPoolItem *pItem ) +{ + return pItem && pItem->GetKind() >= SFX_ITEMS_STATICDEFAULT; +} + +inline int IsPooledItem( const SfxPoolItem *pItem ) +{ + return pItem && pItem->GetRefCount() > 0 && pItem->GetRefCount() <= SFX_ITEMS_MAXREF; +} + +inline int IsInvalidItem(const SfxPoolItem *pItem) +{ + return pItem == (SfxPoolItem *)-1; +} + +// ----------------------------------------------------------------------- + +class SVL_DLLPUBLIC SfxVoidItem: public SfxPoolItem +{ + SfxVoidItem & operator=( const SfxVoidItem& ); // not implemented. +public: + TYPEINFO(); + SfxVoidItem( USHORT nWhich ); + SfxVoidItem( USHORT nWhich, SvStream & ); + SfxVoidItem( const SfxVoidItem& ); + ~SfxVoidItem(); + + virtual int operator==( const SfxPoolItem& ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + XubString &rText, + const IntlWrapper * = 0 ) const; + + // von sich selbst eine Kopie erzeugen + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + void SetWhich(USHORT nWh) { nWhich = nWh; } +}; + +// ----------------------------------------------------------------------- + +class SVL_DLLPUBLIC SfxSetItem: public SfxPoolItem +{ + SfxItemSet *pSet; + + SfxSetItem & operator=( const SfxSetItem& ); // not implemented. + +public: + TYPEINFO(); + SfxSetItem( USHORT nWhich, SfxItemSet *pSet ); + SfxSetItem( USHORT nWhich, const SfxItemSet &rSet ); + SfxSetItem( const SfxSetItem&, SfxItemPool *pPool = 0 ); + ~SfxSetItem(); + + virtual int operator==( const SfxPoolItem& ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + XubString &rText, + const IntlWrapper * = 0 ) const; + + // von sich selbst eine Kopie erzeugen + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const = 0; + virtual SfxPoolItem* Create(SvStream &, USHORT nVersion) const = 0; + virtual SvStream& Store(SvStream &, USHORT nVer) const; + + const SfxItemSet& GetItemSet() const + { return *pSet; } + SfxItemSet& GetItemSet() + { return *pSet; } +}; + +// ----------------------------------------------------------------------- + +#if 0 /* @@@ NOT USED @@@ */ +class SfxInvalidItem: public SfxPoolItem +{ +friend class SfxItemSet; + + const SfxPoolItem* pDefaultItem; + +private: + TYPEINFO(); + SfxInvalidItem( USHORT nWhich, const SfxPoolItem &rDefault ); + SfxInvalidItem( const SfxInvalidItem& ); + virtual ~SfxInvalidItem(); + +public: + virtual int operator==( const SfxPoolItem& ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + XubString &rText, + const IntlWrapper * = 0 ) const; + const SfxPoolItem* GetDefaultItem() const { return pDefaultItem; } + + // von sich selbst eine Kopie erzeugen + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, USHORT nVersion) const; + virtual SvStream& Store(SvStream &, USHORT nVer ) const; +}; +#endif /* @@@ NOT USED @@@ */ + +// ----------------------------------------------------------------------- +// Handle Klasse fuer PoolItems + +class SVL_DLLPUBLIC SfxItemHandle +{ + USHORT *pRef; + SfxPoolItem *pItem; +public: + SfxItemHandle( SfxPoolItem& ); + SfxItemHandle( const SfxItemHandle& ); + ~SfxItemHandle(); + + const SfxItemHandle &operator=(const SfxItemHandle &); + const SfxPoolItem &GetItem() const { return *pItem; } +}; + +// ----------------------------------------------------------------------- + +DECL_PTRHINT(SVL_DLLPUBLIC, SfxPoolItemHint, SfxPoolItem); + +// ----------------------------------------------------------------------- + +#if 0 /* @@@ NOT USED @@@ */ +class SfxItemChangedHint: public SfxHint +{ + const SfxPoolItem& _rOld; + const SfxPoolItem& _rNew; + +public: + TYPEINFO(); \ + SfxItemChangedHint( const SfxPoolItem &rOld, + const SfxPoolItem &rNew ) + : _rOld( rOld ), + _rNew( rNew ) + {} + + const SfxPoolItem& GetOldItem() const { return _rOld; } + const SfxPoolItem& GetNewItem() const { return _rNew; } +}; + +#endif /* @@@ NOT USED @@@ */ + +#endif // #ifndef _SFXPOOLITEM_HXX diff --git a/svl/inc/svl/ptitem.hxx b/svl/inc/svl/ptitem.hxx new file mode 100644 index 000000000000..923ab73da1d5 --- /dev/null +++ b/svl/inc/svl/ptitem.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ptitem.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFXPTITEM_HXX +#define _SFXPTITEM_HXX + +#include "svtools/svtdllapi.h" +#include +#include + +class SvStream; + +DBG_NAMEEX_VISIBILITY(SfxPointItem, SVT_DLLPUBLIC) + +// ----------------------------------------------------------------------- + +class SVT_DLLPUBLIC SfxPointItem: public SfxPoolItem +{ + Point aVal; + +public: + TYPEINFO(); + SfxPointItem(); + SfxPointItem( USHORT nWhich, const Point& rVal ); + SfxPointItem( USHORT nWhich, SvStream & ); + SfxPointItem( const SfxPointItem& ); + ~SfxPointItem() { + DBG_DTOR(SfxPointItem, 0); } + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + XubString &rText, + const IntlWrapper * = 0 ) const; + + virtual int operator==( const SfxPoolItem& ) const; + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, USHORT nItemVersion) const; + virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; + + const Point& GetValue() const { return aVal; } + void SetValue( const Point& rNewVal ) { + DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); + aVal = rNewVal; + } + + virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ) const; + virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ); +}; + +#endif diff --git a/svl/inc/svl/rectitem.hxx b/svl/inc/svl/rectitem.hxx new file mode 100644 index 000000000000..39c85d9ab228 --- /dev/null +++ b/svl/inc/svl/rectitem.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: rectitem.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFXRECTITEM_HXX +#define _SFXRECTITEM_HXX + +#include "svtools/svtdllapi.h" +#include +#include +#include + +class SvStream; + +DBG_NAMEEX_VISIBILITY(SfxRectangleItem, SVT_DLLPUBLIC) + +// ----------------------------------------------------------------------- + +class SVT_DLLPUBLIC SfxRectangleItem: public SfxPoolItem +{ + Rectangle aVal; + +public: + TYPEINFO(); + SfxRectangleItem(); + SfxRectangleItem( USHORT nWhich, const Rectangle& rVal ); + SfxRectangleItem( USHORT nWhich, SvStream & ); + SfxRectangleItem( const SfxRectangleItem& ); + ~SfxRectangleItem() { + DBG_DTOR(SfxRectangleItem, 0); } + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + XubString &rText, + const IntlWrapper * = 0 ) const; + + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, USHORT nItemVersion) const; + virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; + + const Rectangle& GetValue() const { return aVal; } + void SetValue( const Rectangle& rNewVal ) { + DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); + aVal = rNewVal; + } + virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ) const; + virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ); +}; + +#endif + diff --git a/svl/inc/svl/restrictedpaths.hxx b/svl/inc/svl/restrictedpaths.hxx new file mode 100644 index 000000000000..218e34cd4556 --- /dev/null +++ b/svl/inc/svl/restrictedpaths.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: restrictedpaths.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVTOOLS_RESTRICTEDPATHS_HXX +#define SVTOOLS_RESTRICTEDPATHS_HXX + +#include +#include +#include + +#include + +namespace svt +{ + class SVT_DLLPUBLIC RestrictedPaths : public IUrlFilter + { + private: + ::std::vector< String > m_aUnrestrictedURLs; + bool m_bFilterIsEnabled; + + public: + RestrictedPaths(); + virtual ~RestrictedPaths(); + + inline bool hasFilter() const { return !m_aUnrestrictedURLs.empty(); } + inline const ::std::vector< String >& getFilter() const { return m_aUnrestrictedURLs; } + + inline void enableFilter( bool _bEnable ) { m_bFilterIsEnabled = _bEnable; } + inline bool isFilterEnabled() const { return m_bFilterIsEnabled; } + + public: + /** checks URL access permissions + +

with the "restriction" feature we have in the file dialog, it's possible that + only certain URLs can be browsed. This method checks whether a given URL belongs + to this set of permitted URLs.

+ +

If no "access restriction" is effective, this method always returns .

+ */ + virtual bool isUrlAllowed( const String& _rURL ) const; + + /** checks URL access permissions + +

with the "restriction" feature we have in the file dialog, it's possible that + only certain URLs can be browsed. This method checks whether a given URL belongs + to this set of permitted URLs.

+ +

Default behavior allows access to parent folder of a restricted folder (but not to its siblings). + If allowParents is set to parent folders will be treated as forbidden. + +

If no "access restriction" is effective, this method always returns .

+ */ + bool isUrlAllowed( const String& _rURL, bool allowParents ) const; + }; + +} // namespace svt + +#endif // SVTOOLS_RESTRICTEDPATHS_HXX diff --git a/svl/inc/svl/rngitem.hxx b/svl/inc/svl/rngitem.hxx new file mode 100644 index 000000000000..52831f93f71f --- /dev/null +++ b/svl/inc/svl/rngitem.hxx @@ -0,0 +1,117 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: rngitem.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SFXRNGITEM_HXX + +#ifndef NUMTYPE + +#define NUMTYPE USHORT +#define SfxXRangeItem SfxRangeItem +#define SfxXRangesItem SfxUShortRangesItem +#include +#undef NUMTYPE +#undef SfxXRangeItem +#undef SfxXRangesItem + +#ifndef _SFXITEMS_HXX +#define NUMTYPE ULONG +#define SfxXRangeItem SfxULongRangeItem +#define SfxXRangesItem SfxULongRangesItem +#include +#undef NUMTYPE +#undef SfxXRangeItem +#undef SfxXRangesItem +#endif + +#define _SFXRNGITEM_HXX + +#else +#include "svtools/svtdllapi.h" +#include + +class SvStream; + +// ----------------------------------------------------------------------- + +class SVT_DLLPUBLIC SfxXRangeItem : public SfxPoolItem +{ +private: + NUMTYPE nFrom; + NUMTYPE nTo; +public: + TYPEINFO(); + SfxXRangeItem(); + SfxXRangeItem( USHORT nWID, NUMTYPE nFrom, NUMTYPE nTo ); + SfxXRangeItem( USHORT nWID, SvStream &rStream ); + SfxXRangeItem( const SfxXRangeItem& rItem ); + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + XubString &rText, + const IntlWrapper * = 0 ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + inline NUMTYPE& From() { return nFrom; } + inline NUMTYPE From() const { return nFrom; } + inline NUMTYPE& To() { return nTo; } + inline NUMTYPE To() const { return nTo; } + inline BOOL HasRange() const { return nTo>nFrom; } + virtual SfxPoolItem* Create( SvStream &, USHORT nVersion ) const; + virtual SvStream& Store( SvStream &, USHORT nItemVersion ) const; +}; + +// ----------------------------------------------------------------------- + +class SVT_DLLPUBLIC SfxXRangesItem : public SfxPoolItem +{ +private: + NUMTYPE* _pRanges; + +public: + TYPEINFO(); + SfxXRangesItem(); + SfxXRangesItem( USHORT nWID, const NUMTYPE *pRanges ); + SfxXRangesItem( USHORT nWID, SvStream &rStream ); + SfxXRangesItem( const SfxXRangesItem& rItem ); + virtual ~SfxXRangesItem(); + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + XubString &rText, + const IntlWrapper * = 0 ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + inline const NUMTYPE* GetRanges() const { return _pRanges; } + virtual SfxPoolItem* Create( SvStream &, USHORT nVersion ) const; + virtual SvStream& Store( SvStream &, USHORT nItemVersion ) const; +}; + +#endif +#endif diff --git a/svl/inc/svl/sfontitm.hxx b/svl/inc/svl/sfontitm.hxx new file mode 100644 index 000000000000..e1394dec91b3 --- /dev/null +++ b/svl/inc/svl/sfontitm.hxx @@ -0,0 +1,244 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: sfontitm.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SFONTITM_HXX +#define _SFONTITM_HXX + +#include +#include +#include +#include + +//============================================================================ +class SfxFontItem: public SfxPoolItem +{ + XubString m_aName; + XubString m_aStyleName; + Size m_aSize; + Color m_aColor; + Color m_aFillColor; + rtl_TextEncoding m_nCharSet; + LanguageType m_nLanguage; + sal_Int16 m_nFamily; + sal_Int16 m_nPitch; + sal_Int16 m_nWeight; + sal_Int16 m_nWidthType; + sal_Int16 m_nItalic; + sal_Int16 m_nUnderline; + sal_Int16 m_nStrikeout; + sal_Int16 m_nOrientation; + unsigned m_bWordLine: 1; + unsigned m_bOutline: 1; + unsigned m_bShadow: 1; + unsigned m_bKerning: 1; + unsigned m_bHasFont: 1; + unsigned m_bHasColor: 1; + unsigned m_bHasFillColor: 1; + +public: + TYPEINFO(); + + inline SfxFontItem(USHORT nWhich); + + virtual int operator ==(const SfxPoolItem & rItem) const; + + virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const; + + virtual SvStream & Store(SvStream & rStream, USHORT) const; + + virtual SfxPoolItem * Clone(SfxItemPool * = 0) const + { return new SfxFontItem(*this); } + + sal_Bool hasFont() const { return m_bHasFont; } + + sal_Bool hasColor() const { return m_bHasColor; } + + sal_Bool hasFillColor() const { return m_bHasFillColor; } + + const XubString & getName() const { return m_aName; } + + const XubString & getStyleName() const { return m_aStyleName; } + + const Size & getSize() const { return m_aSize; } + + const Color & getColor() const { return m_aColor; } + + const Color & getFillColor() const { return m_aFillColor; } + + rtl_TextEncoding getCharSet() const { return m_nCharSet; } + + LanguageType getLanguage() const { return m_nLanguage; } + + sal_Int16 getFamily() const { return m_nFamily; } + + sal_Int16 getPitch() const { return m_nPitch; } + + sal_Int16 getWeight() const { return m_nWeight; } + + sal_Int16 getWidthType() const { return m_nWidthType; } + + sal_Int16 getItalic() const { return m_nItalic; } + + sal_Int16 getUnderline() const { return m_nUnderline; } + + sal_Int16 getStrikeout() const { return m_nStrikeout; } + + sal_Int16 getOrientation() const { return m_nOrientation; } + + sal_Bool getWordLine() const { return m_bWordLine; } + + sal_Bool getOutline() const { return m_bOutline; } + + sal_Bool getShadow() const { return m_bShadow; } + + sal_Bool getKerning() const { return m_bKerning; } + + inline void setFont(sal_Int16 nTheFamily, const XubString & rTheName, + const XubString & rTheStyleName, sal_Int16 nThePitch, + rtl_TextEncoding nTheCharSet); + + inline void setWeight(sal_Int16 nTheWeight); + + inline void setItalic(sal_Int16 nTheItalic); + + inline void setHeight(sal_Int32 nHeight); + + inline void setColor(const Color & rTheColor); + + inline void setFillColor(const Color & rTheFillColor); + + inline void setUnderline(sal_Int16 nTheUnderline); + + inline void setStrikeout(sal_Int16 nTheStrikeout); + + inline void setOutline(sal_Bool bTheOutline); + + inline void setShadow(sal_Bool bTheShadow); + + inline void setLanguage(LanguageType nTheLanguage); +}; + +inline SfxFontItem::SfxFontItem(USHORT which): + SfxPoolItem(which), + m_nCharSet(RTL_TEXTENCODING_DONTKNOW), + m_nLanguage(LANGUAGE_DONTKNOW), + m_nFamily(0), // FAMILY_DONTKNOW + m_nPitch(0), // PITCH_DONTKNOW + m_nWeight(0), // WEIGHT_DONTKNOW + m_nWidthType(0), // WIDTH_DONTKNOW + m_nItalic(3), // ITALIC_DONTKNOW + m_nUnderline(4), // UNDERLINE_DONTKNOW + m_nStrikeout(3), // STRIKEOUT_DONTKNOW + m_nOrientation(0), + m_bWordLine(sal_False), + m_bOutline(sal_False), + m_bShadow(sal_False), + m_bKerning(sal_False), + m_bHasFont(sal_False), + m_bHasColor(sal_False), + m_bHasFillColor(sal_False) +{} + +inline void SfxFontItem::setFont(sal_Int16 nTheFamily, + const XubString & rTheName, + const XubString & rTheStyleName, + sal_Int16 nThePitch, + rtl_TextEncoding nTheCharSet) +{ + m_nFamily = nTheFamily; + m_aName = rTheName; + m_aStyleName = rTheStyleName; + m_nPitch = nThePitch; + m_nCharSet = nTheCharSet; + m_bHasFont = sal_True; +} + +inline void SfxFontItem::setWeight(sal_Int16 nTheWeight) +{ + m_nWeight = nTheWeight; + m_bHasFont = sal_True; +} + +inline void SfxFontItem::setItalic(sal_Int16 nTheItalic) +{ + m_nItalic = nTheItalic; + m_bHasFont = sal_True; +} + +inline void SfxFontItem::setHeight(sal_Int32 nHeight) +{ + m_aSize.setHeight(nHeight); + m_bHasFont = sal_True; +} + +inline void SfxFontItem::setColor(const Color & rTheColor) +{ + m_aColor = rTheColor; + m_bHasColor = sal_True; +} + +inline void SfxFontItem::setFillColor(const Color & rTheFillColor) +{ + m_aFillColor = rTheFillColor; + m_bHasFillColor = sal_True; +} + +inline void SfxFontItem::setUnderline(sal_Int16 nTheUnderline) +{ + m_nUnderline = nTheUnderline; + m_bHasFont = sal_True; +} + +inline void SfxFontItem::setStrikeout(sal_Int16 nTheStrikeout) +{ + m_nStrikeout = nTheStrikeout; + m_bHasFont = sal_True; +} + +inline void SfxFontItem::setOutline(sal_Bool bTheOutline) +{ + m_bOutline = bTheOutline; + m_bHasFont = sal_True; +} + +inline void SfxFontItem::setShadow(sal_Bool bTheShadow) +{ + m_bShadow = bTheShadow; + m_bHasFont = sal_True; +} + +inline void SfxFontItem::setLanguage(LanguageType nTheLanguage) +{ + m_nLanguage = nTheLanguage; + m_bHasFont = sal_True; +} + +#endif // _SFONTITM_HXX + diff --git a/svl/inc/svl/sharecontrolfile.hxx b/svl/inc/svl/sharecontrolfile.hxx new file mode 100644 index 000000000000..8735f8c5ccf7 --- /dev/null +++ b/svl/inc/svl/sharecontrolfile.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: sharecontrolfile.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVT_SHARECONTROLFILE_HXX +#define _SVT_SHARECONTROLFILE_HXX + +#include + +#include +#include +#include +#include +#include +#include + +#include + +#define SHARED_OOOUSERNAME_ID LOCKFILE_OOOUSERNAME_ID +#define SHARED_SYSUSERNAME_ID LOCKFILE_SYSUSERNAME_ID +#define SHARED_LOCALHOST_ID LOCKFILE_LOCALHOST_ID +#define SHARED_EDITTIME_ID LOCKFILE_EDITTIME_ID +#define SHARED_USERURL_ID LOCKFILE_USERURL_ID +#define SHARED_ENTRYSIZE LOCKFILE_ENTRYSIZE + +namespace svt { + +class SVT_DLLPUBLIC ShareControlFile : public LockFileCommon +{ + ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xStream; + ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xInputStream; + ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > m_xOutputStream; + ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable > m_xSeekable; + ::com::sun::star::uno::Reference< ::com::sun::star::io::XTruncate > m_xTruncate; + + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > m_aUsersData; + + void OpenStream(); + void Close(); + sal_Bool IsValid() + { + return ( m_xFactory.is() && m_xStream.is() && m_xInputStream.is() && m_xOutputStream.is() && m_xSeekable.is() && m_xTruncate.is() ); + } + +public: + + // The constructor will throw exception in case the stream can not be opened + ShareControlFile( const ::rtl::OUString& aOrigURL, const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() ); + ~ShareControlFile(); + + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > GetUsersData(); + void SetUsersDataAndStore( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > >& aUserNames ); + ::com::sun::star::uno::Sequence< ::rtl::OUString > InsertOwnEntry(); + bool HasOwnEntry(); + void RemoveEntry( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aOptionalSpecification = ::com::sun::star::uno::Sequence< ::rtl::OUString >() ); + void RemoveFile(); +}; + +} + +#endif + diff --git a/svl/inc/svl/slstitm.hxx b/svl/inc/svl/slstitm.hxx new file mode 100644 index 000000000000..742d437fb842 --- /dev/null +++ b/svl/inc/svl/slstitm.hxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: slstitm.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFXSLSTITM_HXX +#define _SFXSLSTITM_HXX + +#include "svtools/svldllapi.h" +#include +#include +#include +#include + +class SfxImpStringList; + +class SVL_DLLPUBLIC SfxStringListItem : public SfxPoolItem +{ +protected: + SfxImpStringList* pImp; + +public: + TYPEINFO(); + + SfxStringListItem(); + SfxStringListItem( USHORT nWhich, const List* pList=NULL ); + SfxStringListItem( USHORT nWhich, SvStream& rStream ); + SfxStringListItem( const SfxStringListItem& rItem ); + ~SfxStringListItem(); + + List * GetList(); + + const List * GetList() const + { return SAL_CONST_CAST(SfxStringListItem *, this)->GetList(); } + +#ifndef TF_POOLABLE + virtual int IsPoolable() const; +#endif + + // String-Separator: \n + virtual void SetString( const XubString& ); + virtual XubString GetString(); + + void SetStringList( const com::sun::star::uno::Sequence< rtl::OUString >& rList ); + void GetStringList( com::sun::star::uno::Sequence< rtl::OUString >& rList ) const; + + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + XubString &rText, + const IntlWrapper * = 0 ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create( SvStream &, USHORT nVersion ) const; + virtual SvStream& Store( SvStream &, USHORT nItemVersion ) const; + void Sort( BOOL bAscending = TRUE, List* pParallelList = 0 ); + + virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ); + virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ) const; +}; +#endif diff --git a/svl/inc/svl/smplhint.hxx b/svl/inc/svl/smplhint.hxx new file mode 100644 index 000000000000..9858fefd86f0 --- /dev/null +++ b/svl/inc/svl/smplhint.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: smplhint.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFXSMPLHINT_HXX +#define _SFXSMPLHINT_HXX + +#include "svtools/svldllapi.h" +#include +#include + +#define SFX_HINT_DYING 0x00000001 +#define SFX_HINT_NAMECHANGED 0x00000002 +#define SFX_HINT_TITLECHANGED 0x00000004 +#define SFX_HINT_DATACHANGED 0x00000008 +#define SFX_HINT_DOCCHANGED 0x00000010 +#define SFX_HINT_UPDATEDONE 0x00000020 +#define SFX_HINT_DEINITIALIZING 0x00000040 +#define SFX_HINT_MODECHANGED 0x00000080 +#define SFX_HINT_CANCELLABLE 0x00000100 +#define SFX_HINT_DATAAVAILABLE 0x00000200 +#define SFX_HINT_SAVECOMPLETED 0x00000400 +#define SFX_HINT_RELEASEREF 0x00000800 +#define SFX_HINT_COLORS_CHANGED 0x00001000 +#define SFX_HINT_CTL_SETTINGS_CHANGED 0x00002000 +#define SFX_HINT_ACCESSIBILITY_CHANGED 0x00004000 +#define SFX_HINT_VIEWCREATED 0x00008000 +#define SFX_HINT_USER00 0x00010000 +#define SFX_HINT_USER01 0x00020000 +#define SFX_HINT_USER02 0x00040000 +#define SFX_HINT_USER03 0x00080000 +#define SFX_HINT_USER04 0x00100000 +#define SFX_HINT_USER05 0x00200000 +#define SFX_HINT_USER06 0x00400000 +#define SFX_HINT_USER07 0x00800000 +#define SFX_HINT_USER08 0x01000000 +#define SFX_HINT_USER09 0x02000000 +#define SFX_HINT_USER10 0x04000000 +#define SFX_HINT_USER11 0x08000000 +#define SFX_HINT_USER12 0x10000000 +#define SFX_HINT_USER13 0x20000000 +#define SFX_HINT_UNDO_OPTIONS_CHANGED 0x40000000 +#define SFX_HINT_USER_OPTIONS_CHANGED 0x80000000 +#define SFX_HINT_ALL 0xFFFFFFFF + +class SVL_DLLPUBLIC SfxSimpleHint: public SfxHint +{ +private: + ULONG nId; +public: + TYPEINFO(); + SfxSimpleHint( ULONG nId ); + ULONG GetId() const { return nId; } +}; + +//-------------------------------------------------------------------- + +#define DECL_OBJHINT(Name, Type) \ + class Name: public SfxSimpleHint \ + { \ + Type aObj; \ + \ + public: \ + TYPEINFO(); \ + Name( USHORT nId, const Type& rObject ); \ + ~Name(); \ + const Type& GetObject() const { return aObj; } \ + } + +#define IMPL_OBJHINT(Name, Type) \ + TYPEINIT1(Name, SfxSimpleHint); \ + Name::Name( USHORT nID, const Type& rObject ): \ + SfxSimpleHint( nID ), aObj(rObject) \ + { } \ + Name::~Name() {} + +#endif diff --git a/svl/inc/svl/solar.hrc b/svl/inc/svl/solar.hrc new file mode 100644 index 000000000000..348422ef6477 --- /dev/null +++ b/svl/inc/svl/solar.hrc @@ -0,0 +1,312 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: solar.hrc,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SOLAR_HRC +#define _SOLAR_HRC + +// defines ------------------------------------------------------------------ + +#define CREATERESMGR_NAME( Name ) #Name +#define CREATERESMGR( Name ) ResMgr::CreateResMgr( CREATERESMGR_NAME( Name ) ) + +#define RID_SFX_START 260 +#define RID_SFX_END 9999 + +#define RID_LIB_START 10000 +#define RID_LIB_END 19999 + +#define RID_SVX_START (RID_LIB_START) +#define RID_SVX_END (RID_LIB_START+499) + +#define RID_SBASIC_START (RID_LIB_START+500) +#define RID_SBASIC_END (RID_LIB_START+2999) + +#define RID_BASIC_START (RID_LIB_START+3000) +#define RID_BASIC_END (RID_LIB_START+4499) + +#define RID_UUI_START (RID_LIB_START+4500) +#define RID_UUI_END (RID_LIB_START+4599) + +#define RID_HELP_START (RID_LIB_START+4600) +#define RID_HELP_END (RID_LIB_START+4799) + +#define RID_MAIL_START (RID_LIB_START+4800) +#define RID_MAIL_END (RID_LIB_START+4849) + +#define RID_BASICIDE_START (RID_LIB_START+4850) +#define RID_BASICIDE_END (RID_LIB_START+4949) + +#define RID_SVXITEMS_START (RID_LIB_START+4950) +#define RID_SVXITEMS_END (RID_LIB_START+5599) + +#define RID_SBA_START (RID_LIB_START+5600) +#define RID_SBA_END (RID_LIB_START+5649) + +#define RID_ISETBRW_START (RID_LIB_START+5650) +#define RID_ISETBRW_END (RID_LIB_START+5699) + +#define RID_EXTENSIONS_START (RID_LIB_START+5700) +#define RID_EXTENSIONS_END (RID_LIB_START+5799) + +#define RID_EDIT_START (RID_LIB_START+5800) +#define RID_EDIT_END (RID_LIB_START+5899) + +#define RID_EDIT_START (RID_LIB_START+5800) +#define RID_EDIT_END (RID_LIB_START+5899) + +#define RID_OUTL_START (RID_LIB_START+5900) +#define RID_OUTL_END (RID_LIB_START+5919) + +#define RID_SVTOOLS_START (RID_LIB_START+5920) +#define RID_SVTOOLS_END (RID_LIB_START+5999) + +#define RID_INET_START (RID_LIB_START+6000) +#define RID_INET_END (RID_LIB_START+6059) + +#define RID_SO2_START (RID_LIB_START+6060) +#define RID_SO2_END (RID_LIB_START+6099) + +#define RID_GOODIES_START (RID_LIB_START+6100) +#define RID_GOODIES_END (RID_LIB_START+6149) + +#define RID_SJ_START (RID_LIB_START+6150) +#define RID_SJ_END (RID_LIB_START+6199) + +#define RID_SI_START (RID_LIB_START+6200) +#define RID_SI_END (RID_LIB_START+6399) + +#define RID_DLG_START (RID_LIB_START+6400) +#define RID_DLG_END (RID_LIB_START+6499) + +#define RID_OFA_START (RID_LIB_START+6500) +#define RID_OFA_END (RID_LIB_START+6999) + +#define RID_CHANNEL_START (RID_LIB_START+7000) +#define RID_CHANNEL_END (RID_LIB_START+7499) + +#define RID_CHAOS_START (RID_LIB_START+7500) +#define RID_CHAOS_END (RID_LIB_START+7999) + +#define RID_FORMS_START (RID_LIB_START+8000) +#define RID_FORMS_END (RID_LIB_START+8999) + +#define RID_FORMLAYER_START (RID_LIB_START+9000) +#define RID_FORMLAYER_END (RID_LIB_START+9199) + +#define RID_DBACCESS_START (RID_LIB_START+9200) +#define RID_DBACCESS_END (RID_LIB_START+9699) + +#define RID_MORE_EXTENSIONS_START (RID_LIB_START+9700) +#define RID_MORE_EXTENSIONS_END (RID_LIB_START+9999) + +#define RID_DB_EXTENSIONS_START (RID_LIB_START+10000) +#define RID_DB_EXTENSIONS_END (RID_LIB_START+10199) + +#define RID_FILTER_START (RID_LIB_START+10200) +#define RID_FILTER_END (RID_LIB_START+10299) + +#define RID_APP_START 20000 +#define RID_APP_END 31999 + +#define RID_SW_START (20000) +#define RID_SW_END (25999) + +#define RID_SC_START (26000) +#define RID_SC_END (26999) + +#define RID_SD_START (27000) +#define RID_SD_END (27999) + +#define RID_Sa_START (28000) +#define RID_Sa_END (28999) + +#define RID_Sb_START (29000) +#define RID_Sb_END (29999) + +#define RID_OBJ_START (30000) +#define RID_OBJ_END (32767) + +#define RID_SIM_START (RID_OBJ_START+ 0) +#define RID_SIM_END (RID_OBJ_START+ 255) + +#define RID_SMA_START (RID_OBJ_START+ 256) +#define RID_SMA_END (RID_OBJ_START+ 511) + +#define RID_SCH_START (RID_OBJ_START+ 512) +#define RID_SCH_END (RID_OBJ_START+ 767) + +#define RID_RPT_START (RID_OBJ_START+768) +#define RID_RPT_END (RID_OBJ_START+1000) + +#define RID_FORMULA_START (RID_OBJ_START+1001) +#define RID_FORMULA_END (RID_OBJ_START+1200) +// Help-Ids -------------------------------------------------------------- + +#define HID_OK_BUTTON 0 +#define HID_CANCEL_BUTTON 0 +#define HID_HELP_BUTTON 0 + +#define HID_START 32768 + +#define HID_SVTOOLS_START (HID_START+200) +#define HID_SVTOOLS_END (HID_START+299) + +#define HID_SFX_START (HID_START+300) +#define HID_SFX_END (HID_START+999) + +#define HID_LIB_START (HID_START+1000) +#define HID_LIB_END (HID_START+19999) + +#define HID_SVX_START (HID_LIB_START) +#define HID_SVX_END (HID_LIB_START+431) + +#define HID_WIZARD_START (HID_LIB_START+432) +#define HID_WIZARD_END (HID_LIB_START+999) +//please note: There is also HID_WIZARD2 below + +#define HID_EXTENSIONS_START (HID_LIB_START+1000) +#define HID_EXTENSIONS_END (HID_LIB_START+1099) + +#define HID_SO2_START (HID_LIB_START+1100) +#define HID_SO2_END (HID_LIB_START+1149) + +#define HID_MAIL_START (HID_LIB_START+1150) +#define HID_MAIL_END (HID_LIB_START+1199) + +#define HID_INET_START (HID_LIB_START+1200) +#define HID_INET_END (HID_LIB_START+1259) + +#define HID_OFA_START (HID_LIB_START+1260) +#define HID_OFA_END (HID_LIB_START+1399) + +#define HID_HELP_START (HID_LIB_START+2000) +#define HID_HELP_END (HID_LIB_START+2050) + +#define HID_CHAOS_START (HID_LIB_START+2051) +#define HID_CHAOS_END (HID_LIB_START+2069) + +#define HID_UUI_START (HID_LIB_START+2070) +#define HID_UUI_END (HID_LIB_START+2099) + +#define HID_GOODIES_START (HID_LIB_START+2100) +#define HID_GOODIES_END (HID_LIB_START+2199) + +#define HID_SCHEDULE_START (HID_LIB_START+2200) +#define HID_SCHEDULE_END (HID_LIB_START+3399) + +#define HID_CHANNEL_START (HID_LIB_START+3400) +#define HID_CHANNEL_END (HID_LIB_START+3499) + +#define HID_SBA_START (HID_LIB_START+ 3500) +#define HID_SBA_END (HID_LIB_START+ 3999) + +#define HID_FORMS_START (HID_LIB_START+4000) +#define HID_FORMS_END (HID_LIB_START+4999) + +#define HID_DBACCESS_START (HID_LIB_START+5000) +#define HID_DBACCESS_END (HID_LIB_START+5299) + +#define HID_PORTAL_START (HID_LIB_START+5300) +#define HID_PORTAL_END (HID_LIB_START+5599) + +#define HID_PORTAL_ADMIN_START (HID_LIB_START+5600) +#define HID_PORTAL_ADMIN_END (HID_LIB_START+5999) + +#define HID_SYNCACCESS_START (HID_LIB_START+6000) +#define HID_SYNCACCESS_END (HID_LIB_START+6099) + +#define HID_SVX_EXT0_START (HID_LIB_START+6100) +#define HID_SVX_EXT0_END (HID_LIB_START+6599) + +#define HID_FRAMEWORK_START (HID_LIB_START+6600) +#define HID_FRAMEWORK_END (HID_LIB_START+6999) + +#define HID_WIZARD2_START (HID_LIB_START+7000) +#define HID_WIZARD2_END (HID_LIB_START+8999) + +#define HID_DESKTOP_START (HID_LIB_START+9000) +#define HID_DESKTOP_END (HID_LIB_START+9299) + +#define HID_XMLSECURITY_START (HID_LIB_START+9300) +#define HID_XMLSECURITY_END (HID_LIB_START+9999) + +#define HID_APP_START (HID_START+20000) +#define HID_APP_END (HID_START+29999) + +#define HID_SW_START (HID_START+20000) +#define HID_SW_END (HID_START+24999) + +#define HID_SC_START (HID_START+25000) +#define HID_SC_END (HID_START+26999) + +#define HID_SD_START (HID_START+27000) +#define HID_SD_END (HID_START+27999) + +#define HID_Sa_START (HID_START+28000) +#define HID_Sa_END (HID_START+28999) + +#define HID_Sb_START (HID_START+29000) +#define HID_Sb_END (HID_START+29999) + +#define HID_OBJ_START (HID_START+30000) +#define HID_OBJ_END (HID_START+32767) + +#define HID_SIM_START (HID_OBJ_START+ 0) +#define HID_SIM_END (HID_OBJ_START+ 239) + +#define HID_AVMEDIA_START (HID_OBJ_START+ 240) +#define HID_AVMEDIA_END (HID_OBJ_START+ 255) + +#define HID_SMA_START (HID_OBJ_START+ 256) +#define HID_SMA_END (HID_OBJ_START+ 511) + +#define HID_SCH_START (HID_OBJ_START+ 512) +#define HID_SCH_END (HID_OBJ_START+ 767) + +#define HID_BASICIDE_START (HID_OBJ_START+ 768) +#define HID_BASICIDE_END (HID_OBJ_START+1023) + +#define HID_SMA2_START (HID_OBJ_START+1024) +#define HID_SMA2_END (HID_OBJ_START+1280) + +#define HID_FILTER_START (HID_OBJ_START+1281) +#define HID_FILTER_END (HID_OBJ_START+1580) + +#define HID_LICENSING_START (HID_OBJ_START+1581) +#define HID_LICENSING_END (HID_OBJ_START+1680) + +#define HID_RPT_START (HID_OBJ_START+1681) +#define HID_RPT_END (HID_OBJ_START+2080) + +#define HID_FORMULA_START (HID_OBJ_START+2081) +#define HID_FORMULA_END (HID_OBJ_START+2280) + +#endif + diff --git a/svl/inc/svl/stritem.hxx b/svl/inc/svl/stritem.hxx new file mode 100644 index 000000000000..a2430b142c1d --- /dev/null +++ b/svl/inc/svl/stritem.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: stritem.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SFXSTRITEM_HXX +#define _SFXSTRITEM_HXX + +#include "svtools/svtdllapi.h" +#include + +//============================================================================ +class SVT_DLLPUBLIC SfxStringItem: public CntUnencodedStringItem +{ +public: + TYPEINFO(); + + SfxStringItem() {} + + SfxStringItem(USHORT which, const XubString & rValue): + CntUnencodedStringItem(which, rValue) {} + + SfxStringItem(USHORT nWhich, SvStream & rStream); + + virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const; + + virtual SvStream & Store(SvStream & rStream, USHORT) const; + + virtual SfxPoolItem * Clone(SfxItemPool * = 0) const; +}; + +#endif // _SFXSTRITEM_HXX + diff --git a/svl/inc/svl/style.hrc b/svl/inc/svl/style.hrc new file mode 100644 index 000000000000..ed4db1bf46d0 --- /dev/null +++ b/svl/inc/svl/style.hrc @@ -0,0 +1,42 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: style.hrc,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SFX_STYLE_HRC +#define _SFX_STYLE_HRC + +#define SFXSTYLEBIT_AUTO 0x0000 // automatisch; Flags kommen von der Applikation +#define SFXSTYLEBIT_READONLY 0x2000 // benutzte Vorlage (als Suchmaske) +#define SFXSTYLEBIT_USED 0x4000 // benutzte Vorlage (als Suchmaske) +#define SFXSTYLEBIT_USERDEF 0x8000 // benutzerdefinierte Vorlage +#define SFXSTYLEBIT_ALL 0xFFFF // alle Vorlagen + +#endif + + diff --git a/svl/inc/svl/style.hxx b/svl/inc/svl/style.hxx new file mode 100644 index 000000000000..17e4bf7b9c06 --- /dev/null +++ b/svl/inc/svl/style.hxx @@ -0,0 +1,400 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: style.hxx,v $ + * $Revision: 1.5.60.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SFXSTYLE_HXX +#define _SFXSTYLE_HXX + +#include +#include + +#include +#include +#include +#include +#include "svtools/svtdllapi.h" +#include +#include +#include +#include +#include +#include + +#ifndef _SFX_STYLE_HRC +#include +#endif + +class SfxItemSet; +class SfxItemPool; + +class SfxStyleSheetBasePool; +class SvStream; + +/* +Everyone changing instances of SfxStyleSheetBasePool or SfxStyleSheetBase +mußt broadcast this using broadcasten. +The class is used for this, it contains an Action-Id and a +pointer to the . The actions are: + +#define SFX_STYLESHEET_CREATED // style is created +#define SFX_STYLESHEET_MODIFIED // style is modified +#define SFX_STYLESHEET_CHANGED // style is replaced +#define SFX_STYLESHEET_ERASED // style is deleted + +The following methods already broadcast themself + +SfxStyleSheetHint(SFX_STYLESHEET_MODIFIED) from: + SfxStyleSheetBase::SetName( const String& rName ) + SfxStyleSheetBase::SetParent( const String& rName ) + SfxStyleSheetBase::SetFollow( const String& rName ) + +SfxSimpleHint(SFX_HINT_DYING) from: + SfxStyleSheetBasePool::~SfxStyleSheetBasePool() + +SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *p ) from: + SfxStyleSheetBasePool::Make( const String& rName, + SfxStyleFamily eFam, USHORT mask, USHORT nPos) + +SfxStyleSheetHint( SFX_STYLESHEET_CHANGED, *pNew ) from: + SfxStyleSheetBasePool::Add( SfxStyleSheetBase& rSheet ) + +SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *p ) from: + SfxStyleSheetBasePool::Erase( SfxStyleSheetBase* p ) + SfxStyleSheetBasePool::Clear() +*/ + +#define VIRTUAL510 virtual + +class SVT_DLLPUBLIC SfxStyleSheetBase : public comphelper::OWeakTypeObject +{ + friend class SfxStyleSheetBasePool; + +protected: + SfxStyleSheetBasePool& rPool; // zugehoeriger Pool + SfxStyleFamily nFamily; // Familie + + UniString aName, aParent, aFollow; + rtl::OUString maDisplayName; + String aHelpFile; // Name der Hilfedatei + SfxItemSet* pSet; // ItemSet + USHORT nMask; // Flags + + ULONG nHelpId; // Hilfe-ID + + BOOL bMySet; // TRUE: Set loeschen im dtor + + SfxStyleSheetBase(); // do not use! + SfxStyleSheetBase( const UniString&, SfxStyleSheetBasePool&, SfxStyleFamily eFam, USHORT mask ); + SfxStyleSheetBase( const SfxStyleSheetBase& ); + virtual ~SfxStyleSheetBase(); + virtual void Load( SvStream&, USHORT ); + virtual void Store( SvStream& ); + +public: + TYPEINFO(); + + // returns the internal name of this style + virtual const UniString& GetName() const; + + // sets the internal name of this style + virtual BOOL SetName( const UniString& ); + + /** returns the display name of this style, it is used at the user interface. + If the display name is empty, this method returns the internal name. */ + virtual rtl::OUString GetDisplayName() const; + + // sets the display name of this style + virtual void SetDisplayName( const rtl::OUString& ); + + virtual const UniString& GetParent() const; + virtual BOOL SetParent( const UniString& ); + virtual const UniString& GetFollow() const; + virtual BOOL SetFollow( const UniString& ); + virtual BOOL HasFollowSupport() const; // Default TRUE + virtual BOOL HasParentSupport() const; // Default TRUE + virtual BOOL HasClearParentSupport() const; // Default FALSE + virtual BOOL IsUsed() const; // Default TRUE + // Default aus dem Itemset; entweder dem uebergebenen + // oder aus dem per GetItemSet() zurueckgelieferten Set + virtual UniString GetDescription(); + virtual UniString GetDescription( SfxMapUnit eMetric ); + + SfxStyleSheetBasePool& GetPool() { return rPool; } + SfxStyleFamily GetFamily() const { return nFamily; } + USHORT GetMask() const { return nMask; } + void SetMask( USHORT mask) { nMask = mask; } + BOOL IsUserDefined() const + { return BOOL( ( nMask & SFXSTYLEBIT_USERDEF) != 0 ); } + + virtual ULONG GetHelpId( String& rFile ); + virtual void SetHelpId( const String& r, ULONG nId ); + + virtual SfxItemSet& GetItemSet(); + virtual USHORT GetVersion() const; +}; + +//========================================================================= + +typedef std::vector< rtl::Reference< SfxStyleSheetBase > > SfxStyles; + +//========================================================================= + +class SVT_DLLPUBLIC SfxStyleSheetIterator + +/* [Beschreibung] + + Klasse zum Iterieren und Suchen auf einem SfxStyleSheetBasePool. + +*/ + +{ +public: + SfxStyleSheetIterator(SfxStyleSheetBasePool *pBase, + SfxStyleFamily eFam, USHORT n=0xFFFF ); + virtual USHORT GetSearchMask() const; + virtual SfxStyleFamily GetSearchFamily() const; + virtual USHORT Count(); + virtual SfxStyleSheetBase *operator[](USHORT nIdx); + virtual SfxStyleSheetBase* First(); + virtual SfxStyleSheetBase* Next(); + virtual SfxStyleSheetBase* Find(const UniString& rStr); + virtual ~SfxStyleSheetIterator(); + +protected: + + SfxStyleSheetBasePool* pBasePool; + SfxStyleFamily nSearchFamily; + USHORT nMask; + BOOL SearchUsed() const { return bSearchUsed; } + +private: + USHORT GetPos(){return nAktPosition;} + SVT_DLLPRIVATE BOOL IsTrivialSearch(); + SVT_DLLPRIVATE BOOL DoesStyleMatch(SfxStyleSheetBase *pStyle); + + void* pImp; + SfxStyleSheetBase* pAktStyle; + USHORT nAktPosition; + BOOL bSearchUsed; + +friend class SfxStyleSheetBasePool; +}; + +//========================================================================= + +class SfxStyleSheetBasePool_Impl; + +class SVT_DLLPUBLIC SfxStyleSheetBasePool: public SfxBroadcaster, public comphelper::OWeakTypeObject +{ +friend class SfxStyleSheetIterator; +friend class SfxStyleSheetBase; + + SfxStyleSheetBasePool_Impl *pImp; + +private: + SVT_DLLPRIVATE BOOL Load1_Impl( SvStream& ); + SVT_DLLPRIVATE SfxStyleSheetIterator& GetIterator_Impl(); +protected: + String aAppName; + SfxItemPool& rPool; + SfxStyles aStyles; + SfxStyleFamily nSearchFamily; + USHORT nMask; + + SfxStyleSheetBase& Add( SfxStyleSheetBase& ); + void ChangeParent( const UniString&, const UniString&, BOOL bVirtual = TRUE ); + virtual SfxStyleSheetBase* Create( const UniString&, SfxStyleFamily, USHORT ); + virtual SfxStyleSheetBase* Create( const SfxStyleSheetBase& ); + + ~SfxStyleSheetBasePool(); + +public: + SfxStyleSheetBasePool( SfxItemPool& ); + SfxStyleSheetBasePool( const SfxStyleSheetBasePool& ); + + static String GetStreamName(); + + const String& GetAppName() const { return aAppName; } + + SfxItemPool& GetPool(); + const SfxItemPool& GetPool() const; + + virtual SfxStyleSheetIterator* CreateIterator(SfxStyleFamily, USHORT nMask); + virtual USHORT Count(); + virtual SfxStyleSheetBase* operator[](USHORT nIdx); + + virtual SfxStyleSheetBase& Make(const UniString&, + SfxStyleFamily eFam, + USHORT nMask = 0xffff , + USHORT nPos = 0xffff); + + virtual void Replace( + SfxStyleSheetBase& rSource, SfxStyleSheetBase& rTarget ); + + virtual void Remove( SfxStyleSheetBase* ); + virtual void Insert( SfxStyleSheetBase* ); + + virtual void Clear(); + + SfxStyleSheetBasePool& operator=( const SfxStyleSheetBasePool& ); + SfxStyleSheetBasePool& operator+=( const SfxStyleSheetBasePool& ); + + const SfxStyles& GetStyles(); + virtual SfxStyleSheetBase* First(); + virtual SfxStyleSheetBase* Next(); + virtual SfxStyleSheetBase* Find( const UniString&, SfxStyleFamily eFam, USHORT n=0xFFFF ); + + virtual BOOL SetParent(SfxStyleFamily eFam, + const UniString &rStyle, + const UniString &rParent); + + SfxStyleSheetBase* Find(const UniString& rStr) + { return Find(rStr, nSearchFamily, nMask); } + + void SetSearchMask(SfxStyleFamily eFam, USHORT n=0xFFFF ); + USHORT GetSearchMask() const; + SfxStyleFamily GetSearchFamily() const { return nSearchFamily; } + + BOOL Load( SvStream& ); + BOOL Store( SvStream&, BOOL bUsed = TRUE ); +}; + +//========================================================================= + +class SVT_DLLPUBLIC SfxStyleSheet: public SfxStyleSheetBase, + public SfxListener, public SfxBroadcaster +{ +public: + TYPEINFO(); + + SfxStyleSheet( const UniString&, const SfxStyleSheetBasePool&, SfxStyleFamily, USHORT ); + SfxStyleSheet( const SfxStyleSheet& ); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + virtual BOOL SetParent( const UniString& ); + +protected: + SfxStyleSheet(); // do not use! + virtual ~SfxStyleSheet(); +}; + +//========================================================================= + +class SVT_DLLPUBLIC SfxStyleSheetPool: public SfxStyleSheetBasePool +{ +protected: + using SfxStyleSheetBasePool::Create; + virtual SfxStyleSheetBase* Create(const UniString&, SfxStyleFamily, USHORT mask); + virtual SfxStyleSheetBase* Create(const SfxStyleSheet &); + +public: + SfxStyleSheetPool( SfxItemPool const& ); + +// virtual BOOL CopyTo(SfxStyleSheetPool &rDest, const String &rSourceName); +}; + +//========================================================================= + +#define SFX_STYLESHEET_CREATED 1 // neu +#define SFX_STYLESHEET_MODIFIED 2 // ver"andert +#define SFX_STYLESHEET_CHANGED 3 // gel"oscht und neu (ausgetauscht) +#define SFX_STYLESHEET_ERASED 4 // gel"oscht +#define SFX_STYLESHEET_INDESTRUCTION 5 // wird gerade entfernt + +#define SFX_STYLESHEETPOOL_CHANGES 1 // Aenderungen, die den Zustand + // des Pools anedern, aber nicht + // ueber die STYLESHEET Hints + // verschickt werden sollen. + +//======================================================================== + +class SVT_DLLPUBLIC SfxStyleSheetPoolHint : public SfxHint +{ + USHORT nHint; + +public: + TYPEINFO(); + + SfxStyleSheetPoolHint(USHORT nArgHint) : nHint(nArgHint){} + USHORT GetHint() const + { return nHint; } +}; + +//========================================================================= + +class SVT_DLLPUBLIC SfxStyleSheetHint: public SfxHint +{ + SfxStyleSheetBase* pStyleSh; + USHORT nHint; + +public: + TYPEINFO(); + + SfxStyleSheetHint( USHORT ); + SfxStyleSheetHint( USHORT, SfxStyleSheetBase& ); + SfxStyleSheetBase* GetStyleSheet() const + { return pStyleSh; } + USHORT GetHint() const + { return nHint; } +}; + +class SVT_DLLPUBLIC SfxStyleSheetHintExtended: public SfxStyleSheetHint +{ + String aName; + +public: + TYPEINFO(); + + SfxStyleSheetHintExtended( + USHORT, const String& rOld ); + SfxStyleSheetHintExtended( + USHORT, const String& rOld, + SfxStyleSheetBase& ); + const String& GetOldName() { return aName; } +}; + +class SVT_DLLPUBLIC SfxUnoStyleSheet : public ::cppu::ImplInheritanceHelper2< SfxStyleSheet, ::com::sun::star::style::XStyle, ::com::sun::star::lang::XUnoTunnel > +{ +public: + SfxUnoStyleSheet( const UniString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, USHORT _nMaske ); + SfxUnoStyleSheet( const SfxStyleSheet& _rSheet ); + + static SfxUnoStyleSheet* getUnoStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >& xStyle ); + + // XUnoTunnel + virtual ::sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aIdentifier ) throw (::com::sun::star::uno::RuntimeException); + +private: + SfxUnoStyleSheet(); // not implemented + + static const ::com::sun::star::uno::Sequence< ::sal_Int8 >& getIdentifier(); +}; + +#endif + diff --git a/svl/inc/svl/svarray.hxx b/svl/inc/svl/svarray.hxx new file mode 100644 index 000000000000..3ab3676fa5e0 --- /dev/null +++ b/svl/inc/svl/svarray.hxx @@ -0,0 +1,1056 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: svarray.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVARRAY_HXX +#define _SVARRAY_HXX + +#if 0 +*********************************************************************** +* +* Hier folgt die Beschreibung fuer die exportierten Makros: +* +* SV_DECL_VARARR(nm, AE, IS, GS) +* SV_IMPL_VARARR( nm, AE ) +* definiere/implementiere ein Array das einfache Objecte +* enthaelt. (Sie werden im Speicher verschoben, koennen also +* z.B. keine String sein) +* +* SV_DECL_OBJARR(nm, AE, IS, GS) +* SV_IMPL_OBJARR( nm, AE ) +* definiere/implementiere ein Array das Objecte enthaelt. +* (Hier koennen es auch Strings sein) +* +* +* SV_DECL_PTRARR(nm, AE, IS, GS) +* SV_IMPL_PTRARR(nm, AE) +* definiere/implementiere ein Array das Pointer haelt. Diese +* werden von aussen angelegt und zerstoert. Das IMPL-Makro +* wird nur benoetigt, wenn die DeleteAndDestroy Methode genutzt +* wird, diese loescht dann die Pointer und ruft deren Destruktoren +* +* SV_DECL_PTRARR_DEL(nm, AE, IS, GS) +* SV_IMPL_PTRARR(nm, AE) +* definiere/implementiere ein Array das Pointer haelt. Diese +* werden von aussen angelegt und im Destructor zerstoert. +* +* +* SV_DECL_PTRARR_SORT(nm, AE, IS, GS) +* SV_IMPL_PTRARR_SORT( nm,AE ) +* defieniere/implementiere ein Sort-Array mit Pointern, das nach +* Pointern sortiert ist. Basiert auf einem PTRARR +* +* SV_DECL_PTRARR_SORT_DEL(nm, AE, IS, GS) +* SV_IMPL_PTRARR_SORT( nm,AE ) +* defieniere/implementiere ein Sort-Array mit Pointern, das nach +* Pointern sortiert ist. Basiert auf einem PTRARR_DEL +* +* SV_DECL_PTRARR_SORT(nm, AE, IS, GS) +* SV_IMPL_OP_PTRARR_SORT( nm,AE ) +* defieniere/implementiere ein Sort-Array mit Pointern, das nach +* Objecten sortiert ist. Basiert auf einem PTRARR. +* Sortierung mit Hilfe der Object-operatoren "<" und "==" +* +* SV_DECL_PTRARR_SORT_DEL(nm, AE, IS, GS) +* SV_IMPL_OP_PTRARR_SORT( nm,AE ) +* defieniere/implementiere ein Sort-Array mit Pointern, das nach +* Objecten sortiert ist. Basiert auf einem PTRARR_DEL. +* Sortierung mit Hilfe der Object-operatoren "<" und "==" +* +* SV_DECL_VARARR_SORT(nm, AE, IS, GS) +* SV_IMPL_VARARR_SORT( nm,AE ) +* defieniere/implementiere ein Sort-Array mit einfachen Objecten. +* Basiert auf einem VARARR. +* Sortierung mit Hilfe der Object-operatoren "<" und "==" +* +* JP 23.12.94 neu: +* SV_DECL_PTRARR_STACK(nm, AE, IS, GS) +* ein Stack mit einem PtrArray als Grundlage. +* +* JP 09.10.96: vordefinierte Arrays: +* VarArr: SvBools, SvULongs, SvUShorts, SvLongs, SvShorts +* PtrArr: SvStrings, SvStringsDtor +* SortArr: SvStringsSort, SvStringsSortDtor, +* SvStringsISort, SvStringsISortDtor +*********************************************************************** +#endif + +#include "svtools/svldllapi.h" + +#ifndef INCLUDED_STRING_H +#include // memmove() +#define INCLUDED_STRING_H +#endif + +#ifndef INCLUDED_LIMITS_H +#include // USHRT_MAX +#define INCLUDED_LIMITS_H +#endif +#include +#include + +class String; + +#ifndef CONCAT +#define CONCAT(x,y) x##y +#endif + +class DummyType; +inline void* operator new( size_t, DummyType* pPtr ) +{ + return pPtr; +} +inline void operator delete( void*, DummyType* ) {} + +#if defined(PRODUCT) + +#define _SVVARARR_DEF_GET_OP_INLINE( nm, ArrElem ) \ +ArrElem& operator[](USHORT nP) const { return *(pData+nP); }\ +\ +void Insert( const nm * pI, USHORT nP,\ + USHORT nS = 0, USHORT nE = USHRT_MAX )\ +{\ + if( USHRT_MAX == nE ) \ + nE = pI->nA; \ + if( nS < nE ) \ + Insert( (const ArrElem*)pI->pData+nS, (USHORT)nE-nS, nP );\ +} + +#define _SVVARARR_IMPL_GET_OP_INLINE( nm, ArrElem ) + +#else + +#define _SVVARARR_DEF_GET_OP_INLINE( nm,ArrElem )\ +ArrElem& operator[](USHORT nP) const;\ +void Insert( const nm *pI, USHORT nP,\ + USHORT nS = 0, USHORT nE = USHRT_MAX ); + +#define _SVVARARR_IMPL_GET_OP_INLINE( nm, ArrElem )\ +ArrElem& nm::operator[](USHORT nP) const\ +{\ + DBG_ASSERT( pData && nP < nA,"Op[]");\ + return *(pData+nP);\ +}\ +void nm::Insert( const nm *pI, USHORT nP, USHORT nStt, USHORT nE)\ +{\ + DBG_ASSERT(nP<=nA,"Ins,Ar[Start.End]");\ + if( USHRT_MAX == nE ) \ + nE = pI->nA; \ + if( nStt < nE ) \ + Insert( (const ArrElem*)pI->pData+nStt, (USHORT)nE-nStt, nP );\ +} + +#endif + +#define _SV_DECL_VARARR_GEN(nm, AE, IS, GS, AERef, vis )\ +typedef BOOL (*FnForEach_##nm)( const AERef, void* );\ +class vis nm\ +{\ +protected:\ + AE *pData;\ + USHORT nFree;\ + USHORT nA;\ +\ + void _resize(size_t n);\ +\ +public:\ + nm( USHORT= IS, BYTE= GS );\ + ~nm() { rtl_freeMemory( pData ); }\ +\ + _SVVARARR_DEF_GET_OP_INLINE(nm, AE )\ + AERef GetObject(USHORT nP) const { return (*this)[nP]; } \ +\ + void Insert( const AERef aE, USHORT nP );\ + void Insert( const AE *pE, USHORT nL, USHORT nP );\ + void Remove( USHORT nP, USHORT nL = 1 );\ + void Replace( const AERef aE, USHORT nP );\ + void Replace( const AE *pE, USHORT nL, USHORT nP );\ + USHORT Count() const { return nA; }\ + const AE* GetData() const { return (const AE*)pData; }\ +\ + void ForEach( CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ + {\ + _ForEach( 0, nA, fnForEach, pArgs );\ + }\ + void ForEach( USHORT nS, USHORT nE, \ + CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ + {\ + _ForEach( nS, nE, fnForEach, pArgs );\ + }\ +\ + void _ForEach( USHORT nStt, USHORT nE, \ + CONCAT( FnForEach_, nm ) fnCall, void* pArgs = 0 );\ +\ + +#define _SV_DECL_VARARR(nm, AE, IS, GS ) \ +_SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE & ) +#define _SV_DECL_VARARR_PLAIN(nm, AE, IS, GS ) \ +_SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE ) + +#define SV_DECL_VARARR_GEN(nm, AE, IS, GS, AERef, vis )\ +_SV_DECL_VARARR_GEN(nm, AE, IS, GS, AERef, vis )\ +private:\ +nm( const nm& );\ +nm& operator=( const nm& );\ +}; + +#define SV_DECL_VARARR(nm, AE, IS, GS ) \ +SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE &, ) +#define SV_DECL_VARARR_PLAIN(nm, AE, IS, GS ) \ +SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE, ) + +#define SV_DECL_VARARR_VISIBILITY(nm, AE, IS, GS, vis ) \ +SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE &, vis ) + +#define SV_DECL_VARARR_PLAIN_VISIBILITY(nm, AE, IS, GS, vis ) \ +SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE, vis ) + +#define SV_IMPL_VARARR_GEN( nm, AE, AERef )\ +nm::nm( USHORT nInit, BYTE )\ + : pData (0),\ + nFree (nInit),\ + nA (0)\ +{\ + if( nInit )\ + {\ + pData = (AE*)(rtl_allocateMemory(sizeof(AE) * nInit));\ + DBG_ASSERT( pData, "CTOR, allocate");\ + }\ +}\ +\ +void nm::_resize (size_t n)\ +{\ + USHORT nL = ((n < USHRT_MAX) ? USHORT(n) : USHRT_MAX);\ + AE* pE = (AE*)(rtl_reallocateMemory (pData, sizeof(AE) * nL));\ + if ((pE != 0) || (nL == 0))\ + {\ + pData = pE;\ + nFree = nL - nA;\ + }\ +}\ +\ +void nm::Insert( const AERef aE, USHORT nP )\ +{\ + DBG_ASSERT(nP <= nA && nA < USHRT_MAX, "Ins 1");\ + if (nFree < 1)\ + _resize (nA + ((nA > 1) ? nA : 1));\ + if( pData && nP < nA )\ + memmove( pData+nP+1, pData+nP, (nA-nP) * sizeof( AE ));\ + *(pData+nP) = (AE&)aE;\ + ++nA; --nFree;\ +}\ +\ +void nm::Insert( const AE* pE, USHORT nL, USHORT nP )\ +{\ + DBG_ASSERT(nP<=nA && ((long)nA+nL) nL) ? nA : nL));\ + if( pData && nP < nA )\ + memmove( pData+nP+nL, pData+nP, (nA-nP) * sizeof( AE ));\ + if( pE )\ + memcpy( pData+nP, pE, nL * sizeof( AE ));\ + nA = nA + nL; nFree = nFree - nL;\ +}\ +\ +void nm::Replace( const AERef aE, USHORT nP )\ +{\ + if( nP < nA )\ + *(pData+nP) = (AE&)aE;\ +}\ +\ +void nm::Replace( const AE *pE, USHORT nL, USHORT nP )\ +{\ + if( pE && nP < nA )\ + {\ + if( nP + nL < nA )\ + memcpy( pData + nP, pE, nL * sizeof( AE ));\ + else if( nP + nL < nA + nFree )\ + {\ + memcpy( pData + nP, pE, nL * sizeof( AE ));\ + nP = nP + (nL - nA); \ + nFree = nP;\ + }\ + else \ + {\ + USHORT nTmpLen = nA + nFree - nP; \ + memcpy( pData + nP, pE, nTmpLen * sizeof( AE ));\ + nA = nA + nFree; \ + nFree = 0; \ + Insert( pE + nTmpLen, nL - nTmpLen, nA );\ + }\ + }\ +}\ +\ +void nm::Remove( USHORT nP, USHORT nL )\ +{\ + if( !nL )\ + return;\ + DBG_ASSERT( nP < nA && nP + nL <= nA,"Del");\ + if( pData && nP+1 < nA )\ + memmove( pData+nP, pData+nP+nL, (nA-nP-nL) * sizeof( AE ));\ + nA = nA - nL; nFree = nFree + nL;\ + if (nFree > nA)\ + _resize (nA);\ +}\ +\ +void nm::_ForEach( USHORT nStt, USHORT nE, \ + CONCAT( FnForEach_, nm ) fnCall, void* pArgs )\ +{\ + if( nStt >= nE || nE > nA )\ + return;\ + for( ; nStt < nE && (*fnCall)( *(const AE*)(pData+nStt), pArgs ); nStt++)\ + ;\ +}\ +\ +_SVVARARR_IMPL_GET_OP_INLINE(nm, AE )\ + +#define SV_IMPL_VARARR( nm, AE ) \ +SV_IMPL_VARARR_GEN( nm, AE, AE & ) +#define SV_IMPL_VARARR_PLAIN( nm, AE ) \ +SV_IMPL_VARARR_GEN( nm, AE, AE ) + +#if defined(PRODUCT) + +#define _SVOBJARR_DEF_GET_OP_INLINE( nm,ArrElem )\ +ArrElem& operator[](USHORT nP) const { return *(pData+nP); }\ +\ +void Insert( const nm *pI, USHORT nP,\ + USHORT nS = 0, USHORT nE = USHRT_MAX )\ +{\ + if( USHRT_MAX == nE ) \ + nE = pI->nA; \ + if( nS < nE ) \ + Insert( (const ArrElem*)pI->pData+nS, (USHORT)nE-nS, nP );\ +} + +#define _SVOBJARR_IMPL_GET_OP_INLINE( nm, ArrElem ) + +#else + +#define _SVOBJARR_DEF_GET_OP_INLINE( nm,ArrElem ) \ +ArrElem& operator[](USHORT nP) const;\ +void Insert( const nm *pI, USHORT nP,\ + USHORT nS = 0, USHORT nE = USHRT_MAX ); + +#define _SVOBJARR_IMPL_GET_OP_INLINE( nm, ArrElem )\ +ArrElem& nm::operator[](USHORT nP) const\ +{\ + DBG_ASSERT( pData && nP < nA,"Op[]");\ + return *(pData+nP);\ +}\ +void nm::Insert( const nm *pI, USHORT nP, USHORT nStt, USHORT nE )\ +{\ + DBG_ASSERT( nP <= nA,"Ins,Ar[Start.End]");\ + if( USHRT_MAX == nE ) \ + nE = pI->nA; \ + if( nStt < nE ) \ + Insert( (const ArrElem*)pI->pData+nStt, (USHORT)nE-nStt, nP );\ +} + +#endif + +#define _SV_DECL_OBJARR(nm, AE, IS, GS)\ +typedef BOOL (*FnForEach_##nm)( const AE&, void* );\ +class nm\ +{\ +protected:\ + AE *pData;\ + USHORT nFree;\ + USHORT nA;\ +\ + void _resize(size_t n);\ + void _destroy();\ +\ +public:\ + nm( USHORT= IS, BYTE= GS );\ + ~nm() { _destroy(); }\ +\ + _SVOBJARR_DEF_GET_OP_INLINE(nm,AE)\ + AE& GetObject(USHORT nP) const { return (*this)[nP]; } \ +\ + void Insert( const AE &aE, USHORT nP );\ + void Insert( const AE *pE, USHORT nL, USHORT nP );\ + void Remove( USHORT nP, USHORT nL = 1 );\ + USHORT Count() const { return nA; }\ + const AE* GetData() const { return (const AE*)pData; }\ +\ + void ForEach( CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ + {\ + _ForEach( 0, nA, fnForEach, pArgs );\ + }\ + void ForEach( USHORT nS, USHORT nE, \ + CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ + {\ + _ForEach( nS, nE, fnForEach, pArgs );\ + }\ +\ + void _ForEach( USHORT nStt, USHORT nE, \ + CONCAT( FnForEach_, nm ) fnCall, void* pArgs = 0 );\ +\ + +#define SV_DECL_OBJARR(nm, AE, IS, GS)\ +_SV_DECL_OBJARR(nm, AE, IS, GS)\ +private:\ +nm( const nm& );\ +nm& operator=( const nm& );\ +}; + +#define SV_IMPL_OBJARR( nm, AE )\ +nm::nm( USHORT nInit, BYTE )\ + : pData (0),\ + nFree (nInit),\ + nA (0)\ +{\ + if( nInit )\ + {\ + pData = (AE*)(rtl_allocateMemory(sizeof(AE) * nInit));\ + DBG_ASSERT( pData, "CTOR, allocate");\ + }\ +}\ +\ +void nm::_destroy()\ +{\ + if(pData)\ + {\ + AE* pTmp=pData;\ + for(USHORT n=0; n < nA; n++,pTmp++ )\ + {\ + pTmp->~AE();\ + }\ + rtl_freeMemory(pData);\ + pData = 0;\ + }\ +}\ +\ +void nm::_resize (size_t n)\ +{\ + USHORT nL = ((n < USHRT_MAX) ? USHORT(n) : USHRT_MAX);\ + AE* pE = (AE*)(rtl_reallocateMemory (pData, sizeof(AE) * nL));\ + if ((pE != 0) || (nL == 0))\ + {\ + pData = pE;\ + nFree = nL - nA;\ + }\ +}\ +\ +void nm::Insert( const AE &aE, USHORT nP )\ +{\ + DBG_ASSERT( nP <= nA && nA < USHRT_MAX,"Ins 1");\ + if (nFree < 1)\ + _resize (nA + ((nA > 1) ? nA : 1));\ + if( pData && nP < nA )\ + memmove( pData+nP+1, pData+nP, (nA-nP) * sizeof( AE ));\ + AE* pTmp = pData+nP;\ + new( (DummyType*) pTmp ) AE( (AE&)aE );\ + ++nA; --nFree;\ +}\ +\ +void nm::Insert( const AE* pE, USHORT nL, USHORT nP )\ +{\ + DBG_ASSERT(nP<=nA && ((long)nA+nL) < USHRT_MAX, "Ins n");\ + if (nFree < nL)\ + _resize (nA + ((nA > nL) ? nA : nL));\ + if( pData && nP < nA )\ + memmove( pData+nP+nL, pData+nP, (nA-nP) * sizeof( AE ));\ + if( pE )\ + {\ + AE* pTmp = pData+nP;\ + for( USHORT n = 0; n < nL; n++, pTmp++, pE++)\ + {\ + new( (DummyType*) pTmp ) AE( (AE&)*pE );\ + }\ + }\ + nA = nA + nL; nFree = nFree - nL;\ +}\ +\ +void nm::Remove( USHORT nP, USHORT nL )\ +{\ + if( !nL )\ + return;\ + DBG_ASSERT( nP < nA && nP + nL <= nA,"Del");\ + AE* pTmp=pData+nP;\ + USHORT nCtr = nP;\ + for(USHORT n=0; n < nL; n++,pTmp++,nCtr++)\ + {\ + if( nCtr < nA )\ + pTmp->~AE();\ + }\ + if( pData && nP+1 < nA )\ + memmove( pData+nP, pData+nP+nL, (nA-nP-nL) * sizeof( AE ));\ + nA = nA - nL; nFree = nFree + nL;\ + if (nFree > nA) \ + _resize (nA);\ +}\ +\ +void nm::_ForEach( USHORT nStt, USHORT nE, \ + CONCAT( FnForEach_, nm ) fnCall, void* pArgs )\ +{\ + if( nStt >= nE || nE > nA )\ + return;\ + for( ; nStt < nE && (*fnCall)( *(pData+nStt), pArgs ); nStt++)\ + ;\ +}\ +\ +_SVOBJARR_IMPL_GET_OP_INLINE(nm, AE)\ + +#define _SV_DECL_PTRARR_DEF_GEN( nm, AE, IS, GS, AERef, vis )\ +_SV_DECL_VARARR_GEN( nm, AE, IS, GS, AERef, vis)\ +USHORT GetPos( const AERef aE ) const;\ +}; + +#define _SV_DECL_PTRARR_DEF( nm, AE, IS, GS, vis )\ +_SV_DECL_PTRARR_DEF_GEN( nm, AE, IS, GS, AE &, vis ) +#define _SV_DECL_PTRARR_DEF_PLAIN( nm, AE, IS, GS, vis )\ +_SV_DECL_PTRARR_DEF_GEN( nm, AE, IS, GS, AE, vis ) + +#define SV_DECL_PTRARR_GEN(nm, AE, IS, GS, Base, AERef, VPRef, vis )\ +typedef BOOL (*FnForEach_##nm)( const AERef, void* );\ +class vis nm: public Base \ +{\ +public:\ + nm( USHORT nIni=IS, BYTE nG=GS )\ + : Base(nIni,nG) {}\ + void Insert( const nm *pI, USHORT nP, \ + USHORT nS = 0, USHORT nE = USHRT_MAX ) {\ + Base::Insert((const Base*)pI, nP, nS, nE);\ + }\ + void Insert( const AERef aE, USHORT nP ) {\ + Base::Insert( (const VPRef )aE, nP );\ + }\ + void Insert( const AE *pE, USHORT nL, USHORT nP ) {\ + Base::Insert( (const VoidPtr*)pE, nL, nP );\ + }\ + void Replace( const AERef aE, USHORT nP ) {\ + Base::Replace( (const VPRef)aE, nP );\ + }\ + void Replace( const AE *pE, USHORT nL, USHORT nP ) {\ + Base::Replace( (const VoidPtr*)pE, nL, nP );\ + }\ + void Remove( USHORT nP, USHORT nL = 1) {\ + Base::Remove(nP,nL);\ + }\ + const AE* GetData() const {\ + return (const AE*)Base::GetData();\ + }\ + void ForEach( CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ + {\ + _ForEach( 0, nA, (FnForEach_##Base)fnForEach, pArgs );\ + }\ + void ForEach( USHORT nS, USHORT nE, \ + CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ + {\ + _ForEach( nS, nE, (FnForEach_##Base)fnForEach, pArgs );\ + }\ + AE operator[]( USHORT nP )const { \ + return (AE)Base::operator[](nP); }\ + AE GetObject(USHORT nP) const { \ + return (AE)Base::GetObject(nP); }\ + \ + USHORT GetPos( const AERef aE ) const { \ + return Base::GetPos((const VPRef)aE);\ + }\ + void DeleteAndDestroy( USHORT nP, USHORT nL=1 );\ +private:\ + nm( const nm& );\ + nm& operator=( const nm& );\ +}; + +#define SV_DECL_PTRARR(nm, AE, IS, GS )\ +SV_DECL_PTRARR_GEN(nm, AE, IS, GS, SvPtrarr, AE &, VoidPtr &, ) +#define SV_DECL_PTRARR_PLAIN(nm, AE, IS, GS )\ +SV_DECL_PTRARR_GEN(nm, AE, IS, GS, SvPtrarrPlain, AE, VoidPtr, ) + +#define SV_DECL_PTRARR_VISIBILITY(nm, AE, IS, GS, vis )\ +SV_DECL_PTRARR_GEN(nm, AE, IS, GS, SvPtrarr, AE &, VoidPtr &, vis ) +#define SV_DECL_PTRARR_PLAIN_VISIBILITY(nm, AE, IS, GS, vis )\ +SV_DECL_PTRARR_GEN(nm, AE, IS, GS, SvPtrarrPlain, AE, VoidPtr, vis ) + +#define SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, Base, AERef, VPRef, vis )\ +typedef BOOL (*FnForEach_##nm)( const AERef, void* );\ +class vis nm: public Base \ +{\ +public:\ + nm( USHORT nIni=IS, BYTE nG=GS )\ + : Base(nIni,nG) {}\ + ~nm() { DeleteAndDestroy( 0, Count() ); }\ + void Insert( const nm *pI, USHORT nP, \ + USHORT nS = 0, USHORT nE = USHRT_MAX ) {\ + Base::Insert((const Base*)pI, nP, nS, nE);\ + }\ + void Insert( const AERef aE, USHORT nP ) {\ + Base::Insert((const VPRef)aE, nP );\ + }\ + void Insert( const AE *pE, USHORT nL, USHORT nP ) {\ + Base::Insert( (const VoidPtr *)pE, nL, nP );\ + }\ + void Replace( const AERef aE, USHORT nP ) {\ + Base::Replace( (const VPRef)aE, nP );\ + }\ + void Replace( const AE *pE, USHORT nL, USHORT nP ) {\ + Base::Replace( (const VoidPtr*)pE, nL, nP );\ + }\ + void Remove( USHORT nP, USHORT nL = 1) {\ + Base::Remove(nP,nL);\ + }\ + const AE* GetData() const {\ + return (const AE*)Base::GetData();\ + }\ + void ForEach( CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ + {\ + _ForEach( 0, nA, (FnForEach_##Base)fnForEach, pArgs );\ + }\ + void ForEach( USHORT nS, USHORT nE, \ + CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ + {\ + _ForEach( nS, nE, (FnForEach_##Base)fnForEach, pArgs );\ + }\ + AE operator[]( USHORT nP )const { \ + return (AE)Base::operator[](nP); }\ + AE GetObject( USHORT nP )const { \ + return (AE)Base::GetObject(nP); }\ + \ + USHORT GetPos( const AERef aE ) const { \ + return Base::GetPos((const VPRef)aE);\ + } \ + void DeleteAndDestroy( USHORT nP, USHORT nL=1 );\ +private:\ + nm( const nm& );\ + nm& operator=( const nm& );\ +}; + +#define SV_DECL_PTRARR_DEL(nm, AE, IS, GS )\ +SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, SvPtrarr, AE &, VoidPtr &, ) +#define SV_DECL_PTRARR_DEL_PLAIN(nm, AE, IS, GS )\ +SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, SvPtrarrPlain, AE, VoidPtr, ) + +#define SV_DECL_PTRARR_DEL_VISIBILITY(nm, AE, IS, GS, vis )\ +SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, SvPtrarr, AE &, VoidPtr &, vis) +#define SV_DECL_PTRARR_DEL_PLAIN_VISIBILITY(nm, AE, IS, GS, vis )\ +SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, SvPtrarrPlain, AE, VoidPtr, vis) + +#define SV_IMPL_PTRARR_GEN(nm, AE, Base)\ +void nm::DeleteAndDestroy( USHORT nP, USHORT nL )\ +{ \ + if( nL ) {\ + DBG_ASSERT( nP < nA && nP + nL <= nA,"Del");\ + for( USHORT n=nP; n < nP + nL; n++ ) \ + delete *((AE*)pData+n); \ + Base::Remove( nP, nL ); \ + } \ +} + +#define SV_IMPL_PTRARR(nm, AE )\ +SV_IMPL_PTRARR_GEN(nm, AE, SvPtrarr ) +#define SV_IMPL_PTRARR_PLAIN(nm, AE )\ +SV_IMPL_PTRARR_GEN(nm, AE, SvPtrarrPlain ) + +typedef void* VoidPtr; +_SV_DECL_PTRARR_DEF( SvPtrarr, VoidPtr, 0, 1, SVL_DLLPUBLIC ) +_SV_DECL_PTRARR_DEF_PLAIN( SvPtrarrPlain, VoidPtr, 0, 1, SVL_DLLPUBLIC ) + +// SORTARR - Begin + +#ifdef __MWERKS__ +#define __MWERKS__PRIVATE public +#else +#define __MWERKS__PRIVATE private +#endif + +#define _SORT_CLASS_DEF(nm, AE, IS, GS, vis)\ +typedef BOOL (*FnForEach_##nm)( const AE&, void* );\ +class vis nm : __MWERKS__PRIVATE nm##_SAR \ +{\ +public:\ + nm(USHORT nSize = IS, BYTE nG = GS)\ + : nm##_SAR(nSize,nG) {}\ + void Insert( const nm *pI, USHORT nS=0, USHORT nE=USHRT_MAX );\ + BOOL Insert( const AE& aE );\ + BOOL Insert( const AE& aE, USHORT& rP );\ + void Insert( const AE *pE, USHORT nL );\ + void Remove( USHORT nP, USHORT nL = 1 );\ + void Remove( const AE& aE, USHORT nL = 1 );\ + USHORT Count() const { return nm##_SAR::Count(); }\ + const AE* GetData() const { return (const AE*)pData; }\ +\ +/* Das Ende stehe im DECL-Makro !!! */ + +#define _SV_SEEK_PTR(nm,AE)\ +BOOL nm::Seek_Entry( const AE aE, USHORT* pP ) const\ +{\ + register USHORT nO = nm##_SAR::Count(),\ + nM, \ + nU = 0;\ + if( nO > 0 )\ + {\ + nO--;\ + register long rCmp = (long)aE;\ + while( nU <= nO )\ + {\ + nM = nU + ( nO - nU ) / 2;\ + if( (long)*(pData + nM) == rCmp )\ + {\ + if( pP ) *pP = nM;\ + return TRUE;\ + }\ + else if( (long)*(pData+ nM) < (long)aE )\ + nU = nM + 1;\ + else if( nM == 0 )\ + {\ + if( pP ) *pP = nU;\ + return FALSE;\ + }\ + else\ + nO = nM - 1;\ + }\ + }\ + if( pP ) *pP = nU;\ + return FALSE;\ +} + +#define _SV_SEEK_PTR_TO_OBJECT( nm,AE )\ +BOOL nm::Seek_Entry( const AE aE, USHORT* pP ) const\ +{\ + register USHORT nO = nm##_SAR::Count(),\ + nM, \ + nU = 0;\ + if( nO > 0 )\ + {\ + nO--;\ + while( nU <= nO )\ + {\ + nM = nU + ( nO - nU ) / 2;\ + if( *(*((AE*)pData + nM)) == *(aE) )\ + {\ + if( pP ) *pP = nM;\ + return TRUE;\ + }\ + else if( *(*((AE*)pData + nM)) < *(aE) )\ + nU = nM + 1;\ + else if( nM == 0 )\ + {\ + if( pP ) *pP = nU;\ + return FALSE;\ + }\ + else\ + nO = nM - 1;\ + }\ + }\ + if( pP ) *pP = nU;\ + return FALSE;\ +} + +#define _SV_SEEK_OBJECT( nm,AE )\ +BOOL nm::Seek_Entry( const AE & aE, USHORT* pP ) const\ +{\ + register USHORT nO = nm##_SAR::Count(),\ + nM, \ + nU = 0;\ + if( nO > 0 )\ + {\ + nO--;\ + while( nU <= nO )\ + {\ + nM = nU + ( nO - nU ) / 2;\ + if( *(pData + nM) == aE )\ + {\ + if( pP ) *pP = nM;\ + return TRUE;\ + }\ + else if( *(pData + nM) < aE )\ + nU = nM + 1;\ + else if( nM == 0 )\ + {\ + if( pP ) *pP = nU;\ + return FALSE;\ + }\ + else\ + nO = nM - 1;\ + }\ + }\ + if( pP ) *pP = nU;\ + return FALSE;\ +} + +#define _SV_IMPL_SORTAR_ALG(nm, AE)\ +void nm::Insert( const nm * pI, USHORT nS, USHORT nE )\ +{\ + if( USHRT_MAX == nE )\ + nE = pI->Count();\ + USHORT nP;\ + const AE * pIArr = pI->GetData();\ + for( ; nS < nE; ++nS )\ + {\ + if( ! Seek_Entry( *(pIArr+nS), &nP) )\ + nm##_SAR::Insert( *(pIArr+nS), nP );\ + if( ++nP >= Count() )\ + {\ + nm##_SAR::Insert( pI, nP, nS+1, nE );\ + nS = nE;\ + }\ + }\ +}\ +\ +BOOL nm::Insert( const AE & aE )\ +{\ + USHORT nP;\ + BOOL bExist;\ + bExist = Seek_Entry( aE, &nP );\ + if( ! bExist )\ + nm##_SAR::Insert( aE, nP );\ + return !bExist;\ +}\ +BOOL nm::Insert( const AE & aE, USHORT& rP )\ +{\ + BOOL bExist;\ + bExist = Seek_Entry( aE, &rP );\ + if( ! bExist )\ + nm##_SAR::Insert( aE, rP );\ + return !bExist;\ +}\ +void nm::Insert( const AE* pE, USHORT nL)\ +{\ + USHORT nP;\ + for( USHORT n = 0; n < nL; ++n )\ + if( ! Seek_Entry( *(pE+n), &nP ))\ + nm##_SAR::Insert( *(pE+n), nP );\ +}\ +void nm::Remove( USHORT nP, USHORT nL )\ +{\ + if( nL )\ + nm##_SAR::Remove( nP, nL);\ +}\ +\ +void nm::Remove( const AE &aE, USHORT nL )\ +{\ + USHORT nP;\ + if( nL && Seek_Entry( aE, &nP ) ) \ + nm##_SAR::Remove( nP, nL);\ +}\ + +#if defined(TCPP) + +#define _SORTARR_BLC_CASTS(nm, AE )\ + BOOL Insert( AE &aE ) {\ + return Insert( (const AE&)aE );\ + }\ + USHORT GetPos( AE& aE ) const { \ + return SvPtrarr::GetPos((const VoidPtr&)aE);\ + }\ + void Remove( AE& aE, USHORT nL = 1 ) { \ + Remove( (const AE&) aE, nL );\ + } + +#else + +#define _SORTARR_BLC_CASTS(nm, AE )\ + USHORT GetPos( const AE& aE ) const { \ + return SvPtrarr::GetPos((const VoidPtr&)aE);\ + } + +#endif + +#define _SV_DECL_PTRARR_SORT_ALG(nm, AE, IS, GS, vis)\ +SV_DECL_PTRARR_VISIBILITY(nm##_SAR, AE, IS, GS, vis)\ +_SORT_CLASS_DEF(nm, AE, IS, GS, vis)\ + AE operator[](USHORT nP) const {\ + return nm##_SAR::operator[]( nP );\ + }\ + AE GetObject(USHORT nP) const {\ + return nm##_SAR::GetObject( nP );\ + }\ + BOOL Seek_Entry( const AE aE, USHORT* pP = 0 ) const;\ + void ForEach( CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ + {\ + _ForEach( 0, nA, (FnForEach_SvPtrarr)fnForEach, pArgs );\ + }\ + void ForEach( USHORT nS, USHORT nE, \ + CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ + {\ + _ForEach( nS, nE, (FnForEach_SvPtrarr)fnForEach, pArgs );\ + }\ + void DeleteAndDestroy( USHORT nP, USHORT nL=1 ); \ + _SORTARR_BLC_CASTS(nm, AE )\ +\ +/* Das Ende stehe im DECL-Makro !!! */ + +#define _SV_DECL_PTRARR_SORT(nm, AE, IS, GS, vis)\ +_SV_DECL_PTRARR_SORT_ALG(nm, AE, IS, GS, vis)\ +private:\ + nm( const nm& );\ + nm& operator=( const nm& );\ +}; + +#define SV_DECL_PTRARR_SORT(nm, AE, IS, GS)\ +_SV_DECL_PTRARR_SORT(nm, AE, IS, GS, ) + +#define SV_DECL_PTRARR_SORT_VISIBILITY(nm, AE, IS, GS, vis)\ +_SV_DECL_PTRARR_SORT(nm, AE, IS, GS, vis) + + +#define _SV_DECL_PTRARR_SORT_DEL(nm, AE, IS, GS, vis)\ +_SV_DECL_PTRARR_SORT_ALG(nm, AE, IS, GS, vis)\ + ~nm() { DeleteAndDestroy( 0, Count() ); }\ +private:\ + nm( const nm& );\ + nm& operator=( const nm& );\ +}; + +#define SV_DECL_PTRARR_SORT_DEL(nm, AE, IS, GS)\ +_SV_DECL_PTRARR_SORT_DEL(nm, AE, IS, GS, ) + +#define SV_DECL_PTRARR_SORT_DEL_VISIBILITY(nm, AE, IS, GS, vis)\ +_SV_DECL_PTRARR_SORT_DEL(nm, AE, IS, GS, vis) + +#define _SV_DECL_VARARR_SORT(nm, AE, IS, GS, vis)\ +SV_DECL_VARARR_VISIBILITY(nm##_SAR, AE, IS, GS, vis)\ +_SORT_CLASS_DEF(nm, AE, IS, GS, vis) \ + const AE& operator[](USHORT nP) const {\ + return nm##_SAR::operator[]( nP );\ + }\ + const AE& GetObject(USHORT nP) const {\ + return nm##_SAR::GetObject( nP );\ + }\ + BOOL Seek_Entry( const AE & aE, USHORT* pP = 0 ) const;\ + void ForEach( CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ + {\ + _ForEach( 0, nA, (FnForEach_##nm##_SAR)fnForEach, pArgs );\ + }\ + void ForEach( USHORT nS, USHORT nE, \ + CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ + {\ + _ForEach( nS, nE, (FnForEach_##nm##_SAR)fnForEach, pArgs );\ + }\ +private:\ + nm( const nm& );\ + nm& operator=( const nm& );\ +}; + +#define SV_DECL_VARARR_SORT(nm, AE, IS, GS)\ +_SV_DECL_VARARR_SORT(nm, AE, IS, GS,) + +#define SV_DECL_VARARR_SORT_VISIBILITY(nm, AE, IS, GS, vis)\ +_SV_DECL_VARARR_SORT(nm, AE, IS, GS, vis) + +#define SV_IMPL_PTRARR_SORT( nm,AE )\ +_SV_IMPL_SORTAR_ALG( nm,AE )\ + void nm::DeleteAndDestroy( USHORT nP, USHORT nL ) { \ + if( nL ) {\ + DBG_ASSERT( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" );\ + for( USHORT n=nP; n < nP + nL; n++ ) \ + delete *((AE*)pData+n); \ + SvPtrarr::Remove( nP, nL ); \ + } \ + } \ +_SV_SEEK_PTR( nm, AE ) + +#define SV_IMPL_OP_PTRARR_SORT( nm,AE )\ +_SV_IMPL_SORTAR_ALG( nm,AE )\ + void nm::DeleteAndDestroy( USHORT nP, USHORT nL ) { \ + if( nL ) {\ + DBG_ASSERT( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" );\ + for( USHORT n=nP; n < nP + nL; n++ ) \ + delete *((AE*)pData+n); \ + SvPtrarr::Remove( nP, nL ); \ + } \ + } \ +_SV_SEEK_PTR_TO_OBJECT( nm,AE ) + +#define SV_IMPL_VARARR_SORT( nm,AE )\ +SV_IMPL_VARARR(nm##_SAR, AE)\ +_SV_IMPL_SORTAR_ALG( nm,AE )\ +_SV_SEEK_OBJECT( nm,AE ) + +#define SV_DECL_PTRARR_STACK(nm, AE, IS, GS)\ +class nm: private SvPtrarr \ +{\ +public:\ + nm( USHORT nIni=IS, BYTE nG=GS )\ + : SvPtrarr(nIni,nG) {}\ + void Insert( const nm *pI, USHORT nP,\ + USHORT nS = 0, USHORT nE = USHRT_MAX ) {\ + SvPtrarr::Insert( pI, nP, nS, nE ); \ + }\ + void Remove( USHORT nP, USHORT nL = 1 ) {\ + SvPtrarr::Remove( nP, nL ); \ + }\ + void Push( const AE &aE ) {\ + SvPtrarr::Insert( (const VoidPtr &)aE, SvPtrarr::Count() );\ + }\ + USHORT Count() const { return SvPtrarr::Count(); }\ + AE operator[](USHORT nP) const {\ + return (AE)SvPtrarr::operator[]( nP );\ + }\ + AE GetObject(USHORT nP) const {\ + return (AE)SvPtrarr::GetObject( nP );\ + }\ + AE Pop(){\ + AE pRet = 0;\ + if( SvPtrarr::Count() ){\ + pRet = GetObject( SvPtrarr::Count()-1 );\ + SvPtrarr::Remove(Count()-1);\ + }\ + return pRet;\ + }\ + AE Top() const {\ + AE pRet = 0;\ + if( SvPtrarr::Count() )\ + pRet = GetObject( SvPtrarr::Count()-1 ); \ + return pRet;\ + }\ +}; + +#if defined (C40) || defined (C41) || defined (C42) || defined(C50) || defined(C52) +#define C40_INSERT( c, p, n) Insert( (c const *) p, n ) +#define C40_PUSH( c, p) Push( (c const *) p ) +#define C40_PTR_INSERT( c, p) Insert( (c const *) p ) +#define C40_REMOVE( c, p ) Remove( (c const *) p ) +#define C40_REPLACE( c, p, n) Replace( (c const *) p, n ) +#define C40_PTR_REPLACE( c, p) Replace( (c const *) p ) +#define C40_GETPOS( c, r) GetPos( (c const *)r ) +#else +#if defined WTC || defined IRIX || defined ICC || defined HPUX || (defined GCC && __GNUC__ >= 3) || (defined(WNT) && _MSC_VER >= 1400) +#define C40_INSERT( c, p, n ) Insert( (c const *&) p, n ) +#define C40_PUSH( c, p) Push( (c const *&) p ) +#define C40_PTR_INSERT( c, p ) Insert( (c const *&) p ) +#define C40_REMOVE( c, p ) Remove( (c const *&) p ) +#define C40_REPLACE( c, p, n ) Replace( (c const *&) p, n ) +#define C40_PTR_REPLACE( c, p ) Replace( (c const *&) p ) +#define C40_GETPOS( c, r) GetPos( (c const *&) r ) +#else +#define C40_INSERT( c, p, n ) Insert( p, n ) +#define C40_PUSH( c, p) Push( p ) +#define C40_PTR_INSERT( c, p ) Insert( p ) +#define C40_REMOVE( c, p) Remove( p ) +#define C40_REPLACE( c, p, n ) Replace( p, n ) +#define C40_PTR_REPLACE( c, p ) Replace( p ) +#define C40_GETPOS( c, r) GetPos( r ) +#endif +#endif + +#endif //_SVARRAY_HXX diff --git a/svl/inc/svl/svdde.hxx b/svl/inc/svl/svdde.hxx new file mode 100644 index 000000000000..82681ed9d240 --- /dev/null +++ b/svl/inc/svl/svdde.hxx @@ -0,0 +1,483 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: svdde.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVDDE_HXX +#define _SVDDE_HXX + +#include "svtools/svtdllapi.h" +#include +#include +#include +#include + +class DdeString; +class DdeData; +class DdeConnection; +class DdeTransaction; +class DdeLink; +class DdeRequest; +class DdeWarmLink; +class DdeHotLink; +class DdePoke; +class DdeExecute; +class DdeItem; +class DdeTopic; +class DdeService; +class ConvList; +struct DdeDataImp; +struct DdeImp; +class DdeItemImp; + +#ifndef _SVDDE_NOLISTS +DECLARE_LIST( DdeConnections, DdeConnection* ) +DECLARE_LIST( DdeServices, DdeService* ) +DECLARE_LIST( DdeTopics, DdeTopic* ) +DECLARE_LIST( DdeItems, DdeItem* ) +#else +typedef List DdeConnections; +typedef List DdeServices; +typedef List DdeTopics; +typedef List DdeItems; +#endif + +//#if 0 // _SOLAR__PRIVATE +DECLARE_LIST( DdeTransactions, DdeTransaction* ) +DECLARE_LIST( DdeFormats, long ) +//#else +//typedef List DdeTransactions; +//typedef List DdeFormats; +//#endif + +#ifndef STRING_LIST +#define STRING_LIST +DECLARE_LIST( StringList, String * ) +#endif + +// ----------- +// - DdeData - +// ----------- + +class SVT_DLLPUBLIC DdeData +{ + friend class DdeInternal; + friend class DdeService; + friend class DdeConnection; + friend class DdeTransaction; + DdeDataImp* pImp; + +//#if 0 // _SOLAR__PRIVATE + SVT_DLLPRIVATE void Lock(); +//#endif + void SetFormat( ULONG nFmt ); + +public: + DdeData(); + DdeData( const void*, long, ULONG = FORMAT_STRING ); + DdeData( const String& ); + DdeData( const DdeData& ); + ~DdeData(); + + operator const void*() const; + operator long() const; + + ULONG GetFormat() const; + + DdeData& operator = ( const DdeData& ); + + static ULONG GetExternalFormat( ULONG nFmt ); + static ULONG GetInternalFormat( ULONG nFmt ); +}; +// ------------------ +// - DdeServiceList - +// ------------------ + +class DdeServiceList +{ + StringList aServices; + +public: + DdeServiceList( const String* = NULL ); + ~DdeServiceList(); + + StringList& GetServices() { return aServices; } + +private: + DdeServiceList( const DdeServiceList& ); + const DdeServiceList& operator= ( const DdeServiceList& ); +}; + +// ---------------- +// - DdeTopicList - +// ---------------- + +class DdeTopicList +{ + StringList aTopics; + +//#if 0 // _SOLAR__PRIVATE + DECL_LINK( Data, DdeData* ); +//#endif +public: + DdeTopicList( const String& ); + ~DdeTopicList(); + + StringList& GetTopics() { return aTopics; } +}; + +// ------------------ +// - DdeTransaction - +// ------------------ + +class SVT_DLLPUBLIC DdeTransaction +{ +public: + virtual void Data( const DdeData* ); + virtual void Done( BOOL bDataValid ); +protected: + DdeConnection& rDde; + DdeData aDdeData; + DdeString* pName; + short nType; + long nId; + long nTime; + Link aData; + Link aDone; + BOOL bBusy; + + DdeTransaction( DdeConnection&, const String&, long = 0 ); + +public: + virtual ~DdeTransaction(); + + BOOL IsBusy() { return bBusy; } + const String& GetName() const; + + void Execute(); + + void SetDataHdl( const Link& rLink ) { aData = rLink; } + const Link& GetDataHdl() const { return aData; } + + void SetDoneHdl( const Link& rLink ) { aDone = rLink; } + const Link& GetDoneHdl() const { return aDone; } + + void SetFormat( ULONG nFmt ) { aDdeData.SetFormat( nFmt ); } + ULONG GetFormat() const { return aDdeData.GetFormat(); } + + long GetError(); + +private: + friend class DdeInternal; + friend class DdeConnection; + + DdeTransaction( const DdeTransaction& ); + const DdeTransaction& operator= ( const DdeTransaction& ); + +}; + +// ----------- +// - DdeLink - +// ----------- + +class SVT_DLLPUBLIC DdeLink : public DdeTransaction +{ + Link aNotify; + +public: + DdeLink( DdeConnection&, const String&, long = 0 ); + virtual ~DdeLink(); + + void SetNotifyHdl( const Link& rLink ) { aNotify = rLink; } + const Link& GetNotifyHdl() const { return aNotify; } + virtual void Notify(); +}; + +// --------------- +// - DdeWarmLink - +// --------------- + +class SVT_DLLPUBLIC DdeWarmLink : public DdeLink +{ +public: + DdeWarmLink( DdeConnection&, const String&, long = 0 ); +}; + +// -------------- +// - DdeHotLink - +// -------------- + +class SVT_DLLPUBLIC DdeHotLink : public DdeLink +{ +public: + DdeHotLink( DdeConnection&, const String&, long = 0 ); +}; + +// -------------- +// - DdeRequest - +// -------------- + +class SVT_DLLPUBLIC DdeRequest : public DdeTransaction +{ +public: + DdeRequest( DdeConnection&, const String&, long = 0 ); +}; + +// ----------- +// - DdePoke - +// ----------- + +class SVT_DLLPUBLIC DdePoke : public DdeTransaction +{ +public: + DdePoke( DdeConnection&, const String&, const char*, long, + ULONG = FORMAT_STRING, long = 0 ); + DdePoke( DdeConnection&, const String&, const DdeData&, long = 0 ); + DdePoke( DdeConnection&, const String&, const String&, long = 0 ); +}; + +// -------------- +// - DdeExecute - +// -------------- + +class SVT_DLLPUBLIC DdeExecute : public DdeTransaction +{ +public: + DdeExecute( DdeConnection&, const String&, long = 0 ); +}; + +// ----------------- +// - DdeConnection - +// ----------------- + +class SVT_DLLPUBLIC DdeConnection +{ + friend class DdeInternal; + friend class DdeTransaction; + DdeTransactions aTransactions; + DdeString* pService; + DdeString* pTopic; + DdeImp* pImp; + +public: + DdeConnection( const String&, const String& ); + ~DdeConnection(); + + long GetError(); + long GetConvId(); + + static const DdeConnections& GetConnections(); + + BOOL IsConnected(); + + const String& GetServiceName(); + const String& GetTopicName(); + +private: + DdeConnection( const DdeConnection& ); + const DdeConnection& operator= ( const DdeConnection& ); +}; + +// ----------- +// - DdeItem - +// ----------- + +class SVT_DLLPUBLIC DdeItem +{ + friend class DdeInternal; + friend class DdeTopic; + DdeString* pName; + DdeTopic* pMyTopic; + DdeItemImp* pImpData; + + void IncMonitor( ULONG ); + void DecMonitor( ULONG ); + +protected: + BYTE nType; + +public: + DdeItem( const sal_Unicode* ); + DdeItem( const String& ); + DdeItem( const DdeItem& ); + virtual ~DdeItem(); + + const String& GetName() const; + short GetLinks(); + void NotifyClient(); +}; + +// ----------- +// - DdeItem - +// ----------- + +class SVT_DLLPUBLIC DdeGetPutItem : public DdeItem +{ +public: + DdeGetPutItem( const sal_Unicode* p ); + DdeGetPutItem( const String& rStr ); + DdeGetPutItem( const DdeItem& rItem ); + + virtual DdeData* Get( ULONG ); + virtual BOOL Put( const DdeData* ); + virtual void AdviseLoop( BOOL ); // AdviseLoop starten/stoppen +}; + +// ------------ +// - DdeTopic - +// ------------ + +class SVT_DLLPUBLIC DdeTopic +{ + SVT_DLLPRIVATE void _Disconnect( long ); + +public: + virtual void Connect( long ); + virtual void Disconnect( long ); + virtual DdeData* Get( ULONG ); + virtual BOOL Put( const DdeData* ); + virtual BOOL Execute( const String* ); + // evt. ein neues anlegen; return 0 -> es konnte nicht angelegt werden + virtual BOOL MakeItem( const String& rItem ); + + // es wird ein Warm-/Hot-Link eingerichtet. Return-Wert + // besagt ob es geklappt hat + virtual BOOL StartAdviseLoop(); + virtual BOOL StopAdviseLoop(); + +private: + friend class DdeInternal; + friend class DdeService; + friend class DdeItem; + +private: + DdeString* pName; + String aItem; + DdeItems aItems; + Link aConnectLink; + Link aDisconnectLink; + Link aGetLink; + Link aPutLink; + Link aExecLink; + +public: + DdeTopic( const String& ); + virtual ~DdeTopic(); + + const String& GetName() const; + long GetConvId(); + + void SetConnectHdl( const Link& rLink ) { aConnectLink = rLink; } + const Link& GetConnectHdl() const { return aConnectLink; } + void SetDisconnectHdl( const Link& rLink ) { aDisconnectLink = rLink; } + const Link& GetDisconnectHdl() const { return aDisconnectLink; } + void SetGetHdl( const Link& rLink ) { aGetLink = rLink; } + const Link& GetGetHdl() const { return aGetLink; } + void SetPutHdl( const Link& rLink ) { aPutLink = rLink; } + const Link& GetPutHdl() const { return aPutLink; } + void SetExecuteHdl( const Link& rLink ) { aExecLink = rLink; } + const Link& GetExecuteHdl() const { return aExecLink; } + + void NotifyClient( const String& ); + BOOL IsSystemTopic(); + + void InsertItem( DdeItem* ); // fuer eigene Ableitungen! + DdeItem* AddItem( const DdeItem& ); // werden kopiert ! + void RemoveItem( const DdeItem& ); + const String& GetCurItem() { return aItem; } + const DdeItems& GetItems() { return aItems; } + +private: + DdeTopic( const DdeTopic& ); + const DdeTopic& operator= ( const DdeTopic& ); +}; + +// -------------- +// - DdeService - +// -------------- + +class SVT_DLLPUBLIC DdeService +{ + friend class DdeInternal; + +public: + virtual BOOL IsBusy(); + virtual String GetHelp(); + // evt. ein neues anlegen; return 0 -> es konnte nicht angelegt werden + virtual BOOL MakeTopic( const String& rItem ); + +protected: + virtual String Topics(); + virtual String Formats(); + virtual String SysItems(); + virtual String Status(); + virtual String SysTopicGet( const String& ); + virtual BOOL SysTopicExecute( const String* ); + + const DdeTopic* GetSysTopic() const { return pSysTopic; } +private: + DdeTopics aTopics; + DdeFormats aFormats; + DdeTopic* pSysTopic; + DdeString* pName; + ConvList* pConv; + short nStatus; + + SVT_DLLPRIVATE BOOL HasCbFormat( USHORT ); + +public: + DdeService( const String& ); + virtual ~DdeService(); + + const String& GetName() const; + short GetError() { return nStatus; } + + static DdeServices& GetServices(); + DdeTopics& GetTopics() { return aTopics; } + + void AddTopic( const DdeTopic& ); + void RemoveTopic( const DdeTopic& ); + + void AddFormat( ULONG ); + void RemoveFormat( ULONG ); + BOOL HasFormat( ULONG ); + +private: + // DdeService( const DdeService& ); + //int operator= ( const DdeService& ); +}; + +// ------------------ +// - DdeTransaction - +// ------------------ + +inline long DdeTransaction::GetError() +{ + return rDde.GetError(); +} +#endif // _SVDDE_HXX diff --git a/svl/inc/svl/svldata.hxx b/svl/inc/svl/svldata.hxx new file mode 100644 index 000000000000..c929faad3d13 --- /dev/null +++ b/svl/inc/svl/svldata.hxx @@ -0,0 +1,117 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: svtdata.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVTOOLS_SVTDATA_HXX +#define _SVTOOLS_SVTDATA_HXX + +#include +#include + +class ResMgr; +class SfxItemDesruptorList_Impl; +class SfxItemPool; +class Twain; + +//============================================================================ +class ImpSvtData +{ +public: + Twain * pTwain; + const SfxItemPool * pStoringPool; + SfxItemDesruptorList_Impl * pItemDesruptList; + + ResMgr * pResMgr; + ResMgr * pPatchResMgr; + + void* m_pThreadsafeRMs; + // one SimpleResMgr for each language for which a resource was requested + // (When using the 'non-simple' resmgr, the first request for any language wins, any + // further request for any other language supply the resmgr of the first call. + // For the simple resmgr we have a mgr for each language ever requested). + +private: + ImpSvtData(): + pTwain(0), pStoringPool(0), pItemDesruptList(0), pResMgr(0), + pPatchResMgr(NULL), m_pThreadsafeRMs(NULL) + {} + + ~ImpSvtData(); + +public: + ResMgr * GetResMgr(const ::com::sun::star::lang::Locale aLocale); + ResMgr * GetResMgr(); // VCL dependant, only available in SVT, not in SVL! + + ResMgr * GetPatchResMgr(); + ResMgr * GetPatchResMgr(const ::com::sun::star::lang::Locale& aLocale); + + + SimpleResMgr * GetSimpleRM(const ::com::sun::star::lang::Locale& rLocale); + + static ImpSvtData & GetSvtData(); +}; + +//============================================================================ + +class SvpResId: public ResId +{ +public: + SvpResId( USHORT nId, const ::com::sun::star::lang::Locale aLocale ): + ResId( nId, *ImpSvtData::GetSvtData().GetResMgr( aLocale ) ) {} + + // VCL dependant, only available in SVT, not in SVL! + SvpResId( USHORT nId ); +}; + + +class SvtResId: public ResId +{ +public: + SvtResId(USHORT nId, const ::com::sun::star::lang::Locale aLocale): + ResId(nId, *ImpSvtData::GetSvtData().GetResMgr(aLocale)) {} + + SvtResId(USHORT nId): ResId(nId, *ImpSvtData::GetSvtData().GetResMgr()) {} + // VCL dependant, only available in SVT, not in SVL! +}; + +//============================================================================ +class SvtSimpleResId +{ + String m_sValue; + +public: + SvtSimpleResId(USHORT nId, const ::com::sun::star::lang::Locale aLocale) : m_sValue(ImpSvtData::GetSvtData().GetSimpleRM(aLocale)->ReadString(nId)) { }; + + operator String () const { return m_sValue; } +}; + + + +#endif // _SVTOOLS_SVTDATA_HXX + diff --git a/svl/inc/svl/svldllapi.h b/svl/inc/svl/svldllapi.h new file mode 100644 index 000000000000..29b2ae29100a --- /dev/null +++ b/svl/inc/svl/svldllapi.h @@ -0,0 +1,44 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: svldllapi.h,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_SVLDLLAPI_H +#define INCLUDED_SVLDLLAPI_H + +#include "sal/types.h" + +#if defined(SVL_DLLIMPLEMENTATION) +#define SVL_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define SVL_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif +#define SVL_DLLPRIVATE SAL_DLLPRIVATE + +#endif /* INCLUDED_SVLDLLAPI_H */ + diff --git a/svl/inc/svl/svstdarr.hxx b/svl/inc/svl/svstdarr.hxx new file mode 100644 index 000000000000..050b228be4ab --- /dev/null +++ b/svl/inc/svl/svstdarr.hxx @@ -0,0 +1,274 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: svstdarr.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if 0 +*********************************************************************** +* +* Die vordefinierte Arrays werden ueber POSITIV-Defines aktiviert: +* (die defines setzen sich aus "_SVSTDARR_" und dem Namen des Array +* ohne "Sv" zusammen) +* +* VarArr: SvBools, SvULongs, SvUShorts, SvLongs, SvShorts +* PtrArr: SvStrings, SvStringsDtor +* SortArr: SvStringsSort, SvStringsSortDtor, +* SvStringsISort, SvStringsISortDtor, +* SvUShortsSort +*********************************************************************** +#endif + +#include "svtools/svldllapi.h" +#include + +//#ifdef _SVSTDARR_BOOLS +#ifndef _SVSTDARR_BOOLS_DECL +SV_DECL_VARARR_VISIBILITY( SvBools, BOOL, 1, 1, SVL_DLLPUBLIC ) +#define _SVSTDARR_BOOLS_DECL +#endif +//#endif + +//#ifdef _SVSTDARR_BYTES +#ifndef _SVSTDARR_BYTES_DECL +SV_DECL_VARARR_VISIBILITY( SvBytes, BYTE, 1, 1, SVL_DLLPUBLIC ) +#define _SVSTDARR_BYTES_DECL +#endif +//#endif + +//#ifdef _SVSTDARR_ULONGS +#ifndef _SVSTDARR_ULONGS_DECL +SV_DECL_VARARR_VISIBILITY( SvULongs, ULONG, 1, 1, SVL_DLLPUBLIC ) +#define _SVSTDARR_ULONGS_DECL +#endif +//#endif + +//#ifdef _SVSTDARR_ULONGSSORT +#ifndef _SVSTDARR_ULONGSSORT_DECL +SV_DECL_VARARR_SORT_VISIBILITY( SvULongsSort, ULONG, 1, 1, SVL_DLLPUBLIC ) +#define _SVSTDARR_ULONGSSORT_DECL +#endif +//#endif + +//#ifdef _SVSTDARR_USHORTS +#ifndef _SVSTDARR_USHORTS_DECL +SV_DECL_VARARR_VISIBILITY( SvUShorts, USHORT, 1, 1, SVL_DLLPUBLIC ) +#define _SVSTDARR_USHORTS_DECL +#endif +//#endif + +//#ifdef _SVSTDARR_USHORTSSORT +#ifndef _SVSTDARR_USHORTSSORT_DECL + +typedef BOOL (*FnForEach_SvUShortsSort)( const USHORT&, void* ); +class SVL_DLLPUBLIC SvUShortsSort : __MWERKS__PRIVATE SvUShorts +{ +public: + SvUShortsSort(BYTE nSize = 1, BYTE nG = 1) + : SvUShorts(nSize,nG) {} + + void Insert( const SvUShortsSort *pI, USHORT nS=0, USHORT nE=USHRT_MAX ); + BOOL Insert( const USHORT aE ); + BOOL Insert( const USHORT aE, USHORT& rP ); + void Insert( const USHORT *pE, USHORT nL ); + // remove ab Pos + void RemoveAt( const USHORT nP, USHORT nL = 1 ); + // remove ab dem Eintrag + void Remove( const USHORT nP, USHORT nL = 1 ); + BOOL Seek_Entry( const USHORT aE, USHORT* pP = 0 ) const; + + USHORT Count() const { return SvUShorts::Count(); } + const USHORT* GetData() const { return (const USHORT*)pData; } + + const USHORT& operator[](USHORT nP) const { + return SvUShorts::operator[]( nP ); + } + const USHORT& GetObject(USHORT nP) const { + return SvUShorts::GetObject( nP ); + } + void ForEach( FnForEach_SvUShortsSort fnForEach, void* pArgs = 0 ) + { + _ForEach( 0, nA, (FnForEach_SvUShorts)fnForEach, pArgs ); + } + void ForEach( USHORT nS, USHORT nE, + FnForEach_SvUShortsSort fnForEach, void* pArgs = 0 ) + { + _ForEach( nS, nE, (FnForEach_SvUShorts)fnForEach, pArgs ); + } +private: + SvUShortsSort( const SvUShortsSort& ); + SvUShortsSort& operator=( const SvUShortsSort& ); +}; + +#define _SVSTDARR_USHORTSSORT_DECL +#endif +//#endif + +//#ifdef _SVSTDARR_LONGS +#ifndef _SVSTDARR_LONGS_DECL +SV_DECL_VARARR_VISIBILITY( SvLongs, long, 1, 1, SVL_DLLPUBLIC ) +#define _SVSTDARR_LONGS_DECL +#endif +//#endif + +//#ifdef _SVSTDARR_LONGSSORT +#ifndef _SVSTDARR_LONGSSORT_DECL +SV_DECL_VARARR_SORT_VISIBILITY( SvLongsSort, long, 1, 1, SVL_DLLPUBLIC ) +#define _SVSTDARR_LONGSSORT_DECL +#endif +//#endif + +//#ifdef _SVSTDARR_SHORTS +#ifndef _SVSTDARR_SHORTS_DECL +SV_DECL_VARARR_VISIBILITY( SvShorts, short, 1, 1, SVL_DLLPUBLIC ) +#define _SVSTDARR_SHORTS_DECL +#endif +//#endif + +/* + form here all Arrays for Strings, ByteString and then + len of a string (xub_StrLen) +#if (defined(_SVSTDARR_STRINGS) && !defined(_SVSTDARR_STRINGS_DECL)) || \ + (defined(_SVSTDARR_STRINGSDTOR) && !defined(_SVSTDARR_STRINGSDTOR_DECL)) || \ + (defined(_SVSTDARR_STRINGSSORT) && !defined(_SVSTDARR_STRINGSSORT_DECL)) || \ + (defined(_SVSTDARR_STRINGSSORTDTOR) && !defined(_SVSTDARR_STRINGSSORTDTOR_DECL)) || \ + (defined(_SVSTDARR_STRINGSISORT) && !defined(_SVSTDARR_STRINGSISORT_DECL)) || \ + (defined(_SVSTDARR_STRINGSISORTDTOR) && !defined(_SVSTDARR_STRINGSISORTDTOR_DECL)) || \ + (defined(_SVSTDARR_BYTESTRINGS) && !defined(_SVSTDARR_BYTESTRINGS_DECL)) || \ + (defined(_SVSTDARR_BYTESTRINGSDTOR) && !defined(_SVSTDARR_BYTESTRINGSDTOR_DECL)) || \ + (defined(_SVSTDARR_BYTESTRINGSSORT) && !defined(_SVSTDARR_BYTESTRINGSSORT_DECL)) || \ + (defined(_SVSTDARR_BYTESTRINGSSORTDTOR) && !defined(_SVSTDARR_BYTESTRINGSSORTDTOR_DECL)) || \ + (defined(_SVSTDARR_BYTESTRINGSISORT) && !defined(_SVSTDARR_BYTESTRINGSISORT_DECL)) || \ + (defined(_SVSTDARR_BYTESTRINGSISORTDTOR) && !defined(_SVSTDARR_BYTESTRINGSISORTDTOR_DECL)) || \ + (defined(_SVSTDARR_XUB_STRLEN) && !defined(_SVSTDARR_XUB_STRLEN_DECL)) ||\ + (defined(_SVSTDARR_XUB_STRLENSORT) && !defined(_SVSTDARR_XUB_STRLENSORT_DECL)) +*/ +#include + +typedef String* StringPtr; +typedef ByteString* ByteStringPtr; + +//#endif + +//#ifdef _SVSTDARR_STRINGS +#ifndef _SVSTDARR_STRINGS_DECL +SV_DECL_PTRARR_VISIBILITY( SvStrings, StringPtr, 1, 1, SVL_DLLPUBLIC ) +#define _SVSTDARR_STRINGS_DECL +#endif +//#endif + +//#ifdef _SVSTDARR_STRINGSDTOR +#ifndef _SVSTDARR_STRINGSDTOR_DECL +SV_DECL_PTRARR_DEL_VISIBILITY( SvStringsDtor, StringPtr, 1, 1, SVL_DLLPUBLIC ) +#define _SVSTDARR_STRINGSDTOR_DECL +#endif +//#endif + +//#ifdef _SVSTDARR_STRINGSSORT +#ifndef _SVSTDARR_STRINGSSORT_DECL +SV_DECL_PTRARR_SORT_VISIBILITY( SvStringsSort, StringPtr, 1, 1, SVL_DLLPUBLIC ) +#define _SVSTDARR_STRINGSSORT_DECL +#endif +//#endif + +//#ifdef _SVSTDARR_STRINGSSORTDTOR +#ifndef _SVSTDARR_STRINGSSORTDTOR_DECL +SV_DECL_PTRARR_SORT_DEL_VISIBILITY( SvStringsSortDtor, StringPtr, 1, 1, SVL_DLLPUBLIC ) +#define _SVSTDARR_STRINGSSORTDTOR_DECL +#endif +//#endif + +//#ifdef _SVSTDARR_STRINGSISORT +#ifndef _SVSTDARR_STRINGSISORT_DECL +SV_DECL_PTRARR_SORT_VISIBILITY( SvStringsISort, StringPtr, 1, 1, SVL_DLLPUBLIC ) +#define _SVSTDARR_STRINGSISORT_DECL +#endif +//#endif + +//#ifdef _SVSTDARR_STRINGSISORTDTOR +#ifndef _SVSTDARR_STRINGSISORTDTOR_DECL +SV_DECL_PTRARR_SORT_DEL_VISIBILITY( SvStringsISortDtor, StringPtr, 1, 1, SVL_DLLPUBLIC ) +#define _SVSTDARR_STRINGSISORTDTOR_DECL +#endif +//#endif + +//#ifdef _SVSTDARR_BYTESTRINGS +#ifndef _SVSTDARR_BYTESTRINGS_DECL +SV_DECL_PTRARR_VISIBILITY( SvByteStrings, ByteStringPtr, 1, 1, SVL_DLLPUBLIC ) +#define _SVSTDARR_BYTESTRINGS_DECL +#endif +//#endif + +//#ifdef _SVSTDARR_BYTESTRINGSDTOR +#ifndef _SVSTDARR_BYTESTRINGSDTOR_DECL +SV_DECL_PTRARR_DEL_VISIBILITY( SvByteStringsDtor, ByteStringPtr, 1, 1, SVL_DLLPUBLIC ) +#define _SVSTDARR_BYTESTRINGSDTOR_DECL +#endif +//#endif + +//#ifdef _SVSTDARR_BYTESTRINGSSORT +#ifndef _SVSTDARR_BYTESTRINGSSORT_DECL +SV_DECL_PTRARR_SORT_VISIBILITY( SvByteStringsSort, ByteStringPtr, 1, 1, SVL_DLLPUBLIC ) +#define _SVSTDARR_BYTESTRINGSSORT_DECL +#endif +//#endif + +//#ifdef _SVSTDARR_BYTESTRINGSSORTDTOR +#ifndef _SVSTDARR_BYTESTRINGSSORTDTOR_DECL +SV_DECL_PTRARR_SORT_DEL_VISIBILITY( SvByteStringsSortDtor, ByteStringPtr, 1, 1, SVL_DLLPUBLIC ) +#define _SVSTDARR_BYTESTRINGSSORTDTOR_DECL +#endif +//#endif + +//#ifdef _SVSTDARR_BYTESTRINGSISORT +#ifndef _SVSTDARR_BYTESTRINGSISORT_DECL +SV_DECL_PTRARR_SORT_VISIBILITY( SvByteStringsISort, ByteStringPtr, 1, 1, SVL_DLLPUBLIC ) +#define _SVSTDARR_BYTESTRINGSISORT_DECL +#endif +//#endif + +//#ifdef _SVSTDARR_BYTESTRINGSISORTDTOR +#ifndef _SVSTDARR_BYTESTRINGSISORTDTOR_DECL +SV_DECL_PTRARR_SORT_DEL_VISIBILITY( SvByteStringsISortDtor, ByteStringPtr, 1, 1, SVL_DLLPUBLIC ) +#define _SVSTDARR_BYTESTRINGSISORTDTOR_DECL +#endif +//#endif + +//#ifdef _SVSTDARR_XUB_STRLEN +#ifndef _SVSTDARR_XUB_STRLEN_DECL +SV_DECL_VARARR_VISIBILITY( SvXub_StrLens, xub_StrLen, 1, 1, SVL_DLLPUBLIC ) +#define _SVSTDARR_XUB_STRLEN_DECL +#endif +//#endif + +//#ifdef _SVSTDARR_XUB_STRLENSORT +#ifndef _SVSTDARR_XUB_STRLENSORT_DECL +SV_DECL_VARARR_SORT_VISIBILITY( SvXub_StrLensSort, xub_StrLen, 1, 1, SVL_DLLPUBLIC ) +#define _SVSTDARR_XUB_STRLENSORT_DECL +#endif +//#endif + diff --git a/svl/inc/svl/svtools.hrc b/svl/inc/svl/svtools.hrc new file mode 100644 index 000000000000..245d31a2dd21 --- /dev/null +++ b/svl/inc/svl/svtools.hrc @@ -0,0 +1,526 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: svtools.hrc,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVTOOLS_HRC +#define _SVTOOLS_HRC "$Revision: 1.0" + +#include + +#define RID_SVTOOLS_BITMAP_START (RID_SVTOOLS_START + 0) +#define RID_SVTOOLS_IMAGELIST_START (RID_SVTOOLS_START + 0) + +//............................................................................. +// various unsorted stuff + +#define DLG_EXPORT_PIX (RID_SVTOOLS_START+1) +#define DLG_EXPORT_VEC (RID_SVTOOLS_START+2) +#define DLG_TWAIN_SOURCE (RID_SVTOOLS_START+3) + +#define DLG_SVT_EXPLORERFILE (RID_SVTOOLS_START+4) +#define DLG_SVT_QUERYFOLDERNAME (RID_SVTOOLS_START+5) +#define DLG_SVT_QUERYDELETE (RID_SVTOOLS_START+6) + +#define EXPORT_DIALOG_TITLE (RID_SVTOOLS_START+4) +#define KEY_MODE (RID_SVTOOLS_START+5) +#define KEY_RES (RID_SVTOOLS_START+6) +#define KEY_SIZE (RID_SVTOOLS_START+7) + +#define KEY_COLORS (RID_SVTOOLS_START+9) +#define KEY_RLE_CODING (RID_SVTOOLS_START+10) + +#define STR_SVT_AUTOMATIC_COLOR (RID_SVTOOLS_START+16) + +#define STR_SVT_FILEVIEW_COLUMN_TITLE (RID_SVTOOLS_START + 20) +#define STR_SVT_FILEVIEW_COLUMN_SIZE (RID_SVTOOLS_START + 21) +#define STR_SVT_FILEVIEW_COLUMN_DATE (RID_SVTOOLS_START + 22) +#define STR_SVT_FOLDER (RID_SVTOOLS_START + 23) +#define STR_SVT_FILEVIEW_ERR_MAKEFOLDER (RID_SVTOOLS_START + 24) +#define STR_SVT_BYTES (RID_SVTOOLS_START + 25) +#define STR_SVT_KB (RID_SVTOOLS_START + 26) +#define STR_SVT_MB (RID_SVTOOLS_START + 27) +#define STR_SVT_GB (RID_SVTOOLS_START + 28) +#define STR_FILTERNAME_ALL (RID_SVTOOLS_START + 29) +#define STR_SVT_NEW_FOLDER (RID_SVTOOLS_START + 30) +#define STR_SVT_ALREADYEXISTOVERWRITE (RID_SVTOOLS_START + 31) +#define STR_SVT_FILEVIEW_COLUMN_TYPE (RID_SVTOOLS_START + 32) +#define RID_FILEVIEW_CONTEXTMENU (RID_SVTOOLS_START + 33) +#define RID_FILEOPEN_INVALIDFOLDER (RID_SVTOOLS_START + 34) +#define RID_FILEOPEN_NOTEXISTENTFILE (RID_SVTOOLS_START + 35) +#define STR_SVT_NOREMOVABLEDEVICE (RID_SVTOOLS_START + 36) + +// doc template dialog +#define DLG_DOCTEMPLATE (RID_SVTOOLS_START+50) +#define CTRL_FILEVIEW (RID_SVTOOLS_START+51) +#define STR_SVT_NEWDOC (RID_SVTOOLS_START+52) +#define STR_SVT_MYDOCS (RID_SVTOOLS_START+53) +#define STR_SVT_TEMPLATES (RID_SVTOOLS_START+54) +#define STR_SVT_SAMPLES (RID_SVTOOLS_START+55) +#define TB_SVT_FILEVIEW (RID_SVTOOLS_START+56) +#define TB_SVT_FRAMEWIN (RID_SVTOOLS_START+57) +#define STRARY_SVT_DOCINFO (RID_SVTOOLS_START+58) +#define STR_SVT_NEWDOC_HELP (RID_SVTOOLS_START+63) +#define STR_SVT_MYDOCS_HELP (RID_SVTOOLS_START+64) +#define STR_SVT_TEMPLATES_HELP (RID_SVTOOLS_START+65) +#define STR_SVT_SAMPLES_HELP (RID_SVTOOLS_START+66) + +#define STR_WARNING_ITEM (RID_SVTOOLS_START+90) +#define STR_CSTAT_NEVER_UPD (RID_SVTOOLS_START+91) +#define STR_CSTAT_IN_UPD (RID_SVTOOLS_START+92) +#define STR_CSTAT_UPD_NEWER (RID_SVTOOLS_START+93) +#define STR_CSTAT_UPD_NOT_NEWER (RID_SVTOOLS_START+94) +#define STR_CSTAT_UPD_CANCEL (RID_SVTOOLS_START+95) +#define STR_CSTAT_ERR_GENERAL (RID_SVTOOLS_START+96) +#define STR_CSTAT_ERR_NOTEXISTS (RID_SVTOOLS_START+97) +#define STR_CSTAT_ERR_NOTREACHED (RID_SVTOOLS_START+98) +#define STR_COLUM_DT_AUTO (RID_SVTOOLS_START+99) +#define STR_CSTAT_UPD_IMMEDIATELY (RID_SVTOOLS_START+100) +#define STR_CSTAT_ERR_OFFLINE (RID_SVTOOLS_START+101) + +#define CONFIG_BASIC_FORMAT_START (RID_SVTOOLS_START+102) +#define STR_BASICKEY_FORMAT_ON (RID_SVTOOLS_START+103) +#define STR_BASICKEY_FORMAT_OFF (RID_SVTOOLS_START+104) +#define STR_BASICKEY_FORMAT_YES (RID_SVTOOLS_START+105) +#define STR_BASICKEY_FORMAT_NO (RID_SVTOOLS_START+106) +#define STR_BASICKEY_FORMAT_TRUE (RID_SVTOOLS_START+107) +#define STR_BASICKEY_FORMAT_FALSE (RID_SVTOOLS_START+108) +#define CONFIG_BASIC_FORMAT_END (RID_SVTOOLS_START+109) + +#define STR_INVALIDTRYBUY (RID_SVTOOLS_START+120) +#define STR_OLDTRYBUY (RID_SVTOOLS_START+121) +#define STR_TRYBUY (RID_SVTOOLS_START+122) +#define STR_PVER_LANGUAGECODE (RID_SVTOOLS_START+124) +#define STR_PVER_LONG_LANGUAGECODE (RID_SVTOOLS_START+125) +#define STR_INVALIDPUFF (RID_SVTOOLS_START+126) +#define STR_LIMITEDPUFF (RID_SVTOOLS_START+127) +#define STR_OLDLIMITEDPUFF (RID_SVTOOLS_START+128) +#define RID_REGISTER_DIALOG (RID_SVTOOLS_START+129) +#define STR_BASICKEY_FORMAT_CURRENCY (RID_SVTOOLS_START+130) +#define STR_KEYERR_GENERAL_HELP (RID_SVTOOLS_START+131) +#define STR_KEYERR_INVALID_KEY (RID_SVTOOLS_START+132) +#define STR_KEYERR_INVALID_USERDATA (RID_SVTOOLS_START+133) +#define STR_KEYERR_INVALID_ADDRESSDATA (RID_SVTOOLS_START+134) +#define STR_KEYERR_INVALID_LICENSE (RID_SVTOOLS_START+135) +#define STR_KEYERR_INVALID_LANGUAGE (RID_SVTOOLS_START+136) +#define STR_KEYERR_INVALID_OS (RID_SVTOOLS_START+137) +#define STR_KEYERR_INVALID_NO_CNR (RID_SVTOOLS_START+138) +#define STR_KEYERR_INVALID_CNR (RID_SVTOOLS_START+139) +#define RID_LIMITED_DIALOG (RID_SVTOOLS_START+140) + +#define STR_SVT_MIMETYPE_START (RID_SVTOOLS_START+141) +#define STR_SVT_MIMETYPE_APP_OCTSTREAM (STR_SVT_MIMETYPE_START+0) +#define STR_SVT_MIMETYPE_APP_PDF (STR_SVT_MIMETYPE_START+1) +#define STR_SVT_MIMETYPE_APP_RTF (STR_SVT_MIMETYPE_START+2) +#define STR_SVT_MIMETYPE_APP_MSWORD (STR_SVT_MIMETYPE_START+3) +#define STR_SVT_MIMETYPE_APP_STARCALC (STR_SVT_MIMETYPE_START+4) +#define STR_SVT_MIMETYPE_APP_STARCHART (STR_SVT_MIMETYPE_START+5) +#define STR_SVT_MIMETYPE_APP_STARDRAW (STR_SVT_MIMETYPE_START+6) +#define STR_SVT_MIMETYPE_APP_STARIMAGE (STR_SVT_MIMETYPE_START+7) +#define STR_SVT_MIMETYPE_APP_STARMATH (STR_SVT_MIMETYPE_START+8) +#define STR_SVT_MIMETYPE_APP_STARWRITER (STR_SVT_MIMETYPE_START+9) +#define STR_SVT_MIMETYPE_APP_ZIP (STR_SVT_MIMETYPE_START+10) +#define STR_SVT_MIMETYPE_AUDIO_AIFF (STR_SVT_MIMETYPE_START+11) +#define STR_SVT_MIMETYPE_AUDIO_BASIC (STR_SVT_MIMETYPE_START+12) +#define STR_SVT_MIMETYPE_AUDIO_MIDI (STR_SVT_MIMETYPE_START+13) +#define STR_SVT_MIMETYPE_AUDIO_WAV (STR_SVT_MIMETYPE_START+14) +#define STR_SVT_MIMETYPE_IMAGE_GIF (STR_SVT_MIMETYPE_START+15) +#define STR_SVT_MIMETYPE_IMAGE_JPEG (STR_SVT_MIMETYPE_START+16) +#define STR_SVT_MIMETYPE_IMAGE_PCX (STR_SVT_MIMETYPE_START+17) +#define STR_SVT_MIMETYPE_IMAGE_BMP (STR_SVT_MIMETYPE_START+18) +#define STR_SVT_MIMETYPE_TEXT_HTML (STR_SVT_MIMETYPE_START+19) +#define STR_SVT_MIMETYPE_TEXT_PLAIN (STR_SVT_MIMETYPE_START+20) +#define STR_SVT_MIMETYPE_TEXT_URL (STR_SVT_MIMETYPE_START+21) +#define STR_SVT_MIMETYPE_TEXT_VCARD (STR_SVT_MIMETYPE_START+22) +#define STR_SVT_MIMETYPE_VIDEO_VDO (STR_SVT_MIMETYPE_START+23) +#define STR_SVT_MIMETYPE_VIDEO_MSVIDEO (STR_SVT_MIMETYPE_START+24) +#define STR_SVT_MIMETYPE_X_STARMAIL (STR_SVT_MIMETYPE_START+25) +#define STR_SVT_MIMETYPE_X_VRML (STR_SVT_MIMETYPE_START+26) +#define STR_SVT_MIMETYPE_APP_STARHELP (STR_SVT_MIMETYPE_START+27) +#define STR_SVT_MIMETYPE_APP_STARIMPRESS (STR_SVT_MIMETYPE_START+28) +#define STR_SVT_MIMETYPE_APP_SCHED_CMB (STR_SVT_MIMETYPE_START+29) +#define STR_SVT_MIMETYPE_APP_SCHED_EVT (STR_SVT_MIMETYPE_START+30) +#define STR_SVT_MIMETYPE_APP_SCHED_TASK (STR_SVT_MIMETYPE_START+31) +#define STR_SVT_MIMETYPE_APP_SCHED_TVIEW (STR_SVT_MIMETYPE_START+32) + +#define STR_SVT_MIMETYPE_CNT_MSG (STR_SVT_MIMETYPE_START+33) +#define STR_SVT_MIMETYPE_CNT_DOCUMENT (STR_SVT_MIMETYPE_START+34) +#define STR_SVT_MIMETYPE_CNT_POP3BOX (STR_SVT_MIMETYPE_START+35) +#define STR_SVT_MIMETYPE_CNT_IMAPBOX (STR_SVT_MIMETYPE_START+36) +#define STR_SVT_MIMETYPE_CNT_IMAPFLD (STR_SVT_MIMETYPE_START+37) +#define STR_SVT_MIMETYPE_CNT_VIMBOX (STR_SVT_MIMETYPE_START+38) +#define STR_SVT_MIMETYPE_CNT_VIMINBOX (STR_SVT_MIMETYPE_START+39) +#define STR_SVT_MIMETYPE_CNT_BBBOX (STR_SVT_MIMETYPE_START+40) +#define STR_SVT_MIMETYPE_CNT_VIM_BB (STR_SVT_MIMETYPE_START+41) +#define STR_SVT_MIMETYPE_CNT_NEWSBOX (STR_SVT_MIMETYPE_START+42) +#define STR_SVT_MIMETYPE_CNT_NEWSGRP (STR_SVT_MIMETYPE_START+43) +#define STR_SVT_MIMETYPE_CNT_OUTBOX (STR_SVT_MIMETYPE_START+44) +#define STR_SVT_MIMETYPE_CNT_FTPBOX (STR_SVT_MIMETYPE_START+45) +#define STR_SVT_MIMETYPE_CNT_FTPFLD (STR_SVT_MIMETYPE_START+46) +#define STR_SVT_MIMETYPE_CNT_FTPFILE (STR_SVT_MIMETYPE_START+47) +#define STR_SVT_MIMETYPE_CNT_FTPLINK (STR_SVT_MIMETYPE_START+48) +#define STR_SVT_MIMETYPE_CNT_HTTPBOX (STR_SVT_MIMETYPE_START+49) +#define STR_SVT_MIMETYPE_CNT_FSYSBOX (STR_SVT_MIMETYPE_START+50) +#define STR_SVT_MIMETYPE_CNT_FSYSFLD (STR_SVT_MIMETYPE_START+51) +#define STR_SVT_MIMETYPE_CNT_FSYSFILE (STR_SVT_MIMETYPE_START+52) +#define STR_SVT_MIMETYPE_CNT_FSYSURLFILE (STR_SVT_MIMETYPE_START+53) +#define STR_SVT_MIMETYPE_CNT_PUBLBOX (STR_SVT_MIMETYPE_START+54) +#define STR_SVT_MIMETYPE_CNT_SRCHBOX (STR_SVT_MIMETYPE_START+55) +#define STR_SVT_MIMETYPE_CNT_SUBSCRBOX (STR_SVT_MIMETYPE_START+56) +#define STR_SVT_MIMETYPE_CNT_BOOKMARK (STR_SVT_MIMETYPE_START+57) +#define STR_SVT_MIMETYPE_CNT_CDF (STR_SVT_MIMETYPE_START+58) +#define STR_SVT_MIMETYPE_CNT_CDFSUB (STR_SVT_MIMETYPE_START+59) +#define STR_SVT_MIMETYPE_CNT_CDFITEM (STR_SVT_MIMETYPE_START+60) +#define STR_SVT_MIMETYPE_CNT_STARCHANNEL (STR_SVT_MIMETYPE_START+61) +#define STR_SVT_MIMETYPE_CNT_TRASHBOX (STR_SVT_MIMETYPE_START+62) +#define STR_SVT_MIMETYPE_CNT_TRASH (STR_SVT_MIMETYPE_START+63) +#define STR_SVT_MIMETYPE_CNT_REMOV_VOL (STR_SVT_MIMETYPE_START+64) +#define STR_SVT_MIMETYPE_CNT_FIX_VOL (STR_SVT_MIMETYPE_START+65) +#define STR_SVT_MIMETYPE_CNT_REM_VOL (STR_SVT_MIMETYPE_START+66) +#define STR_SVT_MIMETYPE_CNT_RAM_VOL (STR_SVT_MIMETYPE_START+67) +#define STR_SVT_MIMETYPE_CNT_CDROM (STR_SVT_MIMETYPE_START+68) +#define STR_SVT_MIMETYPE_CNT_DISK_35 (STR_SVT_MIMETYPE_START+69) +#define STR_SVT_MIMETYPE_CNT_DISK_525 (STR_SVT_MIMETYPE_START+70) +#define STR_SVT_MIMETYPE_CNT_TAPEDRIVE (STR_SVT_MIMETYPE_START+71) +#define STR_SVT_MIMETYPE_APP_GAL (STR_SVT_MIMETYPE_START+72) +#define STR_SVT_MIMETYPE_APP_GAL_THEME (STR_SVT_MIMETYPE_START+73) +#define STR_SVT_MIMETYPE_CNT_SEPARATOR (STR_SVT_MIMETYPE_START+74) +#define STR_SVT_MIMETYPE_APP_STARW_GLOB (STR_SVT_MIMETYPE_START+75) +#define STR_SVT_MIMETYPE_APP_SDM (STR_SVT_MIMETYPE_START+76) +#define STR_SVT_MIMETYPE_APP_SMD (STR_SVT_MIMETYPE_START+77) +#define STR_SVT_MIMETYPE_APP_STARW_WEB (STR_SVT_MIMETYPE_START+78) +#define STR_SVT_MIMETYPE_SCHEDULE (STR_SVT_MIMETYPE_START+79) +#define STR_SVT_MIMETYPE_SCHEDULE_EVT (STR_SVT_MIMETYPE_START+80) +#define STR_SVT_MIMETYPE_SCHEDULE_TASK (STR_SVT_MIMETYPE_START+81) +#define STR_SVT_MIMETYPE_SCHEDULE_FEVT (STR_SVT_MIMETYPE_START+82) +#define STR_SVT_MIMETYPE_SCHEDULE_FTASK (STR_SVT_MIMETYPE_START+83) +#define STR_SVT_MIMETYPE_FRAMESET (STR_SVT_MIMETYPE_START+84) +#define STR_SVT_MIMETYPE_MACRO (STR_SVT_MIMETYPE_START+85) +#define STR_SVT_MIMETYPE_CNT_SFSYSFOLDER (STR_SVT_MIMETYPE_START+86) +#define STR_SVT_MIMETYPE_CNT_SFSYSFILE (STR_SVT_MIMETYPE_START+87) +#define STR_SVT_MIMETYPE_APP_TEMPLATE (STR_SVT_MIMETYPE_START+88) +#define STR_SVT_MIMETYPE_IMAGE_GENERIC (STR_SVT_MIMETYPE_START+89) +#define STR_SVT_MIMETYPE_APP_MSEXCEL (STR_SVT_MIMETYPE_START+90) +#define STR_SVT_MIMETYPE_APP_MSEXCEL_TEMPL (STR_SVT_MIMETYPE_START+91) +#define STR_SVT_MIMETYPE_APP_MSPPOINT (STR_SVT_MIMETYPE_START+92) +#define STR_SVT_MIMETYPE_TEXT_VCALENDAR (STR_SVT_MIMETYPE_START+93) +#define STR_SVT_MIMETYPE_TEXT_ICALENDAR (STR_SVT_MIMETYPE_START+94) +#define STR_SVT_MIMETYPE_TEXT_XMLICALENDAR (STR_SVT_MIMETYPE_START+95) +#define STR_SVT_MIMETYPE_TEXT_CDE_CALENDAR_APP (STR_SVT_MIMETYPE_START+96) +#define STR_SVT_MIMETYPE_INET_MSG_RFC822 (STR_SVT_MIMETYPE_START+97) +#define STR_SVT_MIMETYPE_INET_MULTI_ALTERNATIVE (STR_SVT_MIMETYPE_START+98) +#define STR_SVT_MIMETYPE_INET_MULTI_DIGEST (STR_SVT_MIMETYPE_START+99) +#define STR_SVT_MIMETYPE_INET_MULTI_PARALLEL (STR_SVT_MIMETYPE_START+100) +#define STR_SVT_MIMETYPE_INET_MULTI_RELATED (STR_SVT_MIMETYPE_START+101) +#define STR_SVT_MIMETYPE_INET_MULTI_MIXED (STR_SVT_MIMETYPE_START+102) +#define STR_SVT_MIMETYPE_APP_IMPRESSPACKED (STR_SVT_MIMETYPE_START+103) +#define STR_SVT_MIMETYPE_APP_JAR (STR_SVT_MIMETYPE_START+104) +#define STR_SVT_MIMETYPE_IMAGE_PNG (STR_SVT_MIMETYPE_START+105) +#define STR_SVT_MIMETYPE_IMAGE_TIFF (STR_SVT_MIMETYPE_START+106) + +#define STR_SVT_MIMETYPE_APP_SXCALC (STR_SVT_MIMETYPE_START+107) +#define STR_SVT_MIMETYPE_APP_SXCHART (STR_SVT_MIMETYPE_START+108) +#define STR_SVT_MIMETYPE_APP_SXDRAW (STR_SVT_MIMETYPE_START+109) +#define STR_SVT_MIMETYPE_APP_SXMATH (STR_SVT_MIMETYPE_START+110) +#define STR_SVT_MIMETYPE_APP_SXWRITER (STR_SVT_MIMETYPE_START+111) +#define STR_SVT_MIMETYPE_APP_SXIMPRESS (STR_SVT_MIMETYPE_START+112) +#define STR_SVT_MIMETYPE_APP_SXGLOBAL (STR_SVT_MIMETYPE_START+113) +#define STR_SVT_MIMETYPE_APP_SXIPACKED (STR_SVT_MIMETYPE_START+114) +#define STR_SVT_MIMETYPE_END (STR_SVT_MIMETYPE_APP_SXIPACKED) + +#define STR_SVT_PRNDLG_START (STR_SVT_MIMETYPE_END+1) +#define DLG_SVT_PRNDLG_PRNSETUPDLG (STR_SVT_PRNDLG_START+0) +#define DLG_SVT_PRNDLG_PRINTDLG (STR_SVT_PRNDLG_START+1) +#define STR_SVT_PRNDLG_READY (STR_SVT_PRNDLG_START+2) +#define STR_SVT_PRNDLG_PAUSED (STR_SVT_PRNDLG_START+3) +#define STR_SVT_PRNDLG_PENDING (STR_SVT_PRNDLG_START+4) +#define STR_SVT_PRNDLG_BUSY (STR_SVT_PRNDLG_START+5) +#define STR_SVT_PRNDLG_INITIALIZING (STR_SVT_PRNDLG_START+6) +#define STR_SVT_PRNDLG_WAITING (STR_SVT_PRNDLG_START+7) +#define STR_SVT_PRNDLG_WARMING_UP (STR_SVT_PRNDLG_START+8) +#define STR_SVT_PRNDLG_PROCESSING (STR_SVT_PRNDLG_START+9) +#define STR_SVT_PRNDLG_PRINTING (STR_SVT_PRNDLG_START+10) +#define STR_SVT_PRNDLG_OFFLINE (STR_SVT_PRNDLG_START+11) +#define STR_SVT_PRNDLG_ERROR (STR_SVT_PRNDLG_START+12) +#define STR_SVT_PRNDLG_SERVER_UNKNOWN (STR_SVT_PRNDLG_START+13) +#define STR_SVT_PRNDLG_PAPER_JAM (STR_SVT_PRNDLG_START+14) +#define STR_SVT_PRNDLG_PAPER_OUT (STR_SVT_PRNDLG_START+15) +#define STR_SVT_PRNDLG_MANUAL_FEED (STR_SVT_PRNDLG_START+16) +#define STR_SVT_PRNDLG_PAPER_PROBLEM (STR_SVT_PRNDLG_START+17) +#define STR_SVT_PRNDLG_IO_ACTIVE (STR_SVT_PRNDLG_START+18) +#define STR_SVT_PRNDLG_OUTPUT_BIN_FULL (STR_SVT_PRNDLG_START+19) +#define STR_SVT_PRNDLG_TONER_LOW (STR_SVT_PRNDLG_START+20) +#define STR_SVT_PRNDLG_NO_TONER (STR_SVT_PRNDLG_START+21) +#define STR_SVT_PRNDLG_PAGE_PUNT (STR_SVT_PRNDLG_START+22) +#define STR_SVT_PRNDLG_USER_INTERVENTION (STR_SVT_PRNDLG_START+23) +#define STR_SVT_PRNDLG_OUT_OF_MEMORY (STR_SVT_PRNDLG_START+24) +#define STR_SVT_PRNDLG_DOOR_OPEN (STR_SVT_PRNDLG_START+25) +#define STR_SVT_PRNDLG_POWER_SAVE (STR_SVT_PRNDLG_START+26) +#define STR_SVT_PRNDLG_DEFPRINTER (STR_SVT_PRNDLG_START+27) +#define STR_SVT_PRNDLG_JOBCOUNT (STR_SVT_PRNDLG_START+28) +#define STR_SVT_PRNDLG_END (RID_IMG_PRNDLG_NOCOLLATE_HC) + +#define STR_SVT_CALENDAR_START (STR_SVT_PRNDLG_END+1) +#define STR_SVT_CALENDAR_DAY (STR_SVT_CALENDAR_START+0) +#define STR_SVT_CALENDAR_WEEK (STR_SVT_CALENDAR_START+1) +#define STR_SVT_CALENDAR_TODAY (STR_SVT_CALENDAR_START+2) +#define STR_SVT_CALENDAR_NONE (STR_SVT_CALENDAR_START+3) +#define STR_SVT_CALENDAR_END (STR_SVT_CALENDAR_NONE) + +#define STR_SVT_PVER_START (STR_SVT_CALENDAR_END+1) +#define STR_SVT_PVER_INTERNAL (STR_SVT_PVER_START+0) +#define STR_SVT_PVER_PERSONAL_DELUXE (STR_SVT_PVER_START+1) +#define STR_SVT_PVER_PERSONAL (STR_SVT_PVER_START+2) +#define STR_SVT_PVER_PROFESSIONAL (STR_SVT_PVER_START+3) +#define STR_SVT_PVER_BUSINESS (STR_SVT_PVER_START+4) +#define STR_SVT_PVER_ENTERPRICE (STR_SVT_PVER_START+5) +#define STR_SVT_PVER_EDUCATION (STR_SVT_PVER_START+6) +#define STR_SVT_PVER_DEMO (STR_SVT_PVER_START+7) +#define STR_SVT_PVER_BETA (STR_SVT_PVER_START+8) +#define STR_SVT_PVER_OEM (STR_SVT_PVER_START+9) +#define STR_SVT_PVER_NOT_REGISTERED (STR_SVT_PVER_START+10) +#define STR_SVT_PVER_PILOT (STR_SVT_PVER_START+11) +#define STR_SVT_PVER_CAMPUS (STR_SVT_PVER_START+12) +#define STR_SVT_PVER_EVALUATION (STR_SVT_PVER_START+13) +#define STR_SVT_PVER_PARTNER (STR_SVT_PVER_START+14) +#define STR_SVT_PVER_SMALLBUSINESS (STR_SVT_PVER_START+15) +#define STR_SVT_PVER_OEM_PROFESSIONAL (STR_SVT_PVER_START+16) +#define STR_SVT_PVER_END (STR_SVT_PVER_OEM_PROFESSIONAL) + +#define STR_SVT_STYLE_START (STR_SVT_PVER_END+1) +#define STR_SVT_STYLE_LIGHT (STR_SVT_STYLE_START+0) +#define STR_SVT_STYLE_LIGHT_ITALIC (STR_SVT_STYLE_START+1) +#define STR_SVT_STYLE_NORMAL (STR_SVT_STYLE_START+2) +#define STR_SVT_STYLE_NORMAL_ITALIC (STR_SVT_STYLE_START+3) +#define STR_SVT_STYLE_BOLD (STR_SVT_STYLE_START+4) +#define STR_SVT_STYLE_BOLD_ITALIC (STR_SVT_STYLE_START+5) +#define STR_SVT_STYLE_BLACK (STR_SVT_STYLE_START+6) +#define STR_SVT_STYLE_BLACK_ITALIC (STR_SVT_STYLE_START+7) +#define STR_SVT_STYLE_END (STR_SVT_STYLE_BLACK_ITALIC) + +#define STR_SVT_FONTMAP_START (STR_SVT_STYLE_END+1) +#define STR_SVT_FONTMAP_BOTH (STR_SVT_FONTMAP_START+0) +#define STR_SVT_FONTMAP_PRINTERONLY (STR_SVT_FONTMAP_START+1) +#define STR_SVT_FONTMAP_SCREENONLY (STR_SVT_FONTMAP_START+2) +#define STR_SVT_FONTMAP_SIZENOTAVAILABLE (STR_SVT_FONTMAP_START+3) +#define STR_SVT_FONTMAP_STYLENOTAVAILABLE (STR_SVT_FONTMAP_START+4) +#define STR_SVT_FONTMAP_NOTAVAILABLE (STR_SVT_FONTMAP_START+5) +#define STR_SVT_FONTMAP_END (STR_SVT_FONTMAP_NOTAVAILABLE) + +#define STR_SVT_ERRORCONTEXT_START (STR_SVT_FONTMAP_END+1) +#define STR_ERR_HDLMESS (STR_SVT_ERRORCONTEXT_START+0) +#define RID_ERRHDL_CLASS (STR_SVT_ERRORCONTEXT_START+1) +#define RID_ERRCTX (STR_SVT_ERRORCONTEXT_START+2) +#define RID_ERRHDL (STR_SVT_ERRORCONTEXT_START+3) +#define STR_SVT_ERRORCONTEXT_END (RID_ERRHDL) + +#define STR_WIZARDDIALOG_START (STR_SVT_ERRORCONTEXT_END + 1) +#define STR_WIZDLG_FINISH (STR_WIZARDDIALOG_START + 0) +#define STR_WIZDLG_NEXT (STR_WIZARDDIALOG_START + 1) +#define STR_WIZDLG_PREVIOUS (STR_WIZARDDIALOG_START + 2) +#define STR_WIZDLG_ROADMAP_TITLE (STR_WIZARDDIALOG_START + 3) +#define STR_WIZARDDIALOG_END (STR_WIZDLG_ROADMAP_TITLE) + +#define STR_SVT_COLLATE_START (STR_WIZARDDIALOG_END+1) +#define STR_SVT_COLLATE_NORMAL (STR_SVT_COLLATE_START+0) +#define STR_SVT_COLLATE_DICTIONARY (STR_SVT_COLLATE_START+1) +#define STR_SVT_COLLATE_PINYIN (STR_SVT_COLLATE_START+2) +#define STR_SVT_COLLATE_STROKE (STR_SVT_COLLATE_START+3) +#define STR_SVT_COLLATE_RADICAL (STR_SVT_COLLATE_START+4) +#define STR_SVT_COLLATE_CHARSET (STR_SVT_COLLATE_START+5) +#define STR_SVT_COLLATE_ZHUYIN (STR_SVT_COLLATE_START+6) +#define STR_SVT_COLLATE_ALPHANUMERIC (STR_SVT_COLLATE_START+7) +#define STR_SVT_COLLATE_UNICODE (STR_SVT_COLLATE_START+8) +#define STR_SVT_COLLATE_PHONEBOOK (STR_SVT_COLLATE_START+9) +#define STR_SVT_COLLATE_PHONETIC_F (STR_SVT_COLLATE_START+10) +#define STR_SVT_COLLATE_PHONETIC_L (STR_SVT_COLLATE_START+11) +#define STR_SVT_COLLATE_END (STR_SVT_COLLATE_PHONETIC_L) + +#define STR_SVT_FILEPICKER_START (STR_SVT_COLLATE_END+1) +#define STR_SVT_FILEPICKER_AUTO_EXTENSION (STR_SVT_FILEPICKER_START+ 0) +#define STR_SVT_FILEPICKER_PASSWORD (STR_SVT_FILEPICKER_START+ 1) +#define STR_SVT_FILEPICKER_FILTER_OPTIONS (STR_SVT_FILEPICKER_START+ 2) +#define STR_SVT_FILEPICKER_READONLY (STR_SVT_FILEPICKER_START+ 3) +#define STR_SVT_FILEPICKER_INSERT_AS_LINK (STR_SVT_FILEPICKER_START+ 4) +#define STR_SVT_FILEPICKER_SHOW_PREVIEW (STR_SVT_FILEPICKER_START+ 5) +#define STR_SVT_FILEPICKER_PLAY (STR_SVT_FILEPICKER_START+ 6) +#define STR_SVT_FILEPICKER_VERSION (STR_SVT_FILEPICKER_START+ 7) +#define STR_SVT_FILEPICKER_TEMPLATES (STR_SVT_FILEPICKER_START+ 8) +#define STR_SVT_FILEPICKER_IMAGE_TEMPLATE (STR_SVT_FILEPICKER_START+ 9) +#define STR_SVT_FILEPICKER_SELECTION (STR_SVT_FILEPICKER_START+10) +#define STR_SVT_FILEPICKER_FILTER_TITLE (STR_SVT_FILEPICKER_START+11) +#define STR_SVT_FOLDERPICKER_DEFAULT_TITLE (STR_SVT_FILEPICKER_START+12) +#define STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION (STR_SVT_FILEPICKER_START+13) +#define STR_SVT_FILEPICKER_END (STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION) + +// String-Ids for accessibility +#define STR_SVT_ACC_BEGIN (STR_SVT_FILEPICKER_END+1) + // FREE + // FREE +#define STR_SVT_ACC_DESC_TABLISTBOX (STR_SVT_ACC_BEGIN+2) +#define STR_SVT_ACC_DESC_FILEVIEW (STR_SVT_ACC_BEGIN+3) +#define STR_SVT_ACC_DESC_FOLDER (STR_SVT_ACC_BEGIN+4) +#define STR_SVT_ACC_DESC_FILE (STR_SVT_ACC_BEGIN+5) +#define STR_SVT_ACC_EMPTY_FIELD (STR_SVT_ACC_BEGIN+6) +#define STR_SVT_ACC_END (STR_SVT_ACC_EMPTY_FIELD) + +#define STR_SVT_INDEXENTRY_START (STR_SVT_ACC_END + 1) +#define STR_SVT_INDEXENTRY_ALPHANUMERIC (STR_SVT_INDEXENTRY_START+0) +#define STR_SVT_INDEXENTRY_DICTIONARY (STR_SVT_INDEXENTRY_START+1) +#define STR_SVT_INDEXENTRY_PINYIN (STR_SVT_INDEXENTRY_START+2) +#define STR_SVT_INDEXENTRY_RADICAL (STR_SVT_INDEXENTRY_START+3) +#define STR_SVT_INDEXENTRY_STROKE (STR_SVT_INDEXENTRY_START+4) +#define STR_SVT_INDEXENTRY_ZHUYIN (STR_SVT_INDEXENTRY_START+5) +#define STR_SVT_INDEXENTRY_PHONETIC_FS (STR_SVT_INDEXENTRY_START+6) +#define STR_SVT_INDEXENTRY_PHONETIC_FC (STR_SVT_INDEXENTRY_START+7) +#define STR_SVT_INDEXENTRY_PHONETIC_LS (STR_SVT_INDEXENTRY_START+8) +#define STR_SVT_INDEXENTRY_PHONETIC_LC (STR_SVT_INDEXENTRY_START+9) +#define STR_SVT_INDEXENTRY_END (STR_SVT_INDEXENTRY_PHONETIC_LC) + +//String - Ids for Java errors, messages +//These strings come from project desktop +//There was no time for translation, therefore the defines needed to +//remain the same. +#define STR_SVT_JAVAERROR_START (STR_SVT_INDEXENTRY_END + 1) +#define STR_QUESTION_JAVADISABLED (STR_SVT_JAVAERROR_START+0) +#define STR_ERROR_JVMCREATIONFAILED (STR_SVT_JAVAERROR_START+1) +#define STR_WARNING_JAVANOTFOUND (STR_SVT_JAVAERROR_START+2) +#define STR_WARNING_INVALIDJAVASETTINGS (STR_SVT_JAVAERROR_START+3) +#define STR_ERROR_RESTARTREQUIRED (STR_SVT_JAVAERROR_START+4) +#define STR_SVT_JAVAERROR_END (STR_ERROR_RESTARTREQUIRED) + +// String array to match UI language names to LanguageType values and vice versa +#define STR_ARR_SVT_LANGUAGE_TABLE_START (STR_SVT_JAVAERROR_END + 1) +#define STR_ARR_SVT_LANGUAGE_TABLE (STR_ARR_SVT_LANGUAGE_TABLE_START + 0) +#define STR_ARR_SVT_LANGUAGE_TABLE_END (STR_ARR_SVT_LANGUAGE_TABLE) + +//............................................................................. +// dialogs + +#define DLG_EXPORT_JPG_START (RID_SVTOOLS_START+110) +#define DLG_EXPORT_JPG (RID_SVTOOLS_START+111) +#define DLG_EXPORT_JPG_END (RID_SVTOOLS_START+112) + +#define DLG_LOGIN (RID_SVTOOLS_START+113) +#define DLG_ADDRESSBOOKSOURCE (RID_SVTOOLS_START+114) + +#define DLG_REGISTRATION_REQUEST (RID_SVTOOLS_START+115) + +#define DLG_EXPORT_EPNG (RID_SVTOOLS_START+116) +//............................................................................. +// bitmaps + +#define BMP_DEMO_FINGER (RID_SVTOOLS_BITMAP_START + 0) +#define BMP_HELP_AGENT_IMAGE (RID_SVTOOLS_BITMAP_START + 1) +#define BMP_HELP_AGENT_CLOSER (RID_SVTOOLS_BITMAP_START + 2) +#define BMP_PLUGIN (RID_SVTOOLS_BITMAP_START + 3) + +//............................................................................. +// image lists + +#define RID_IMG_EXPANDER (RID_SVTOOLS_IMAGELIST_START + 0) +#define RID_SVTOOLS_IMAGELIST_BIG (RID_SVTOOLS_IMAGELIST_START + 1) +#define RID_SVTOOLS_IMAGELIST_SMALL (RID_SVTOOLS_IMAGELIST_START + 2) +#define RID_SVTOOLS_IMAGELIST_EDITBROWSEBOX (RID_SVTOOLS_IMAGELIST_START + 3) +#define RID_SVTOOLS_IMAGELIST_BIG_HIGHCONTRAST (RID_SVTOOLS_IMAGELIST_START + 4) +#define RID_SVTOOLS_IMAGELIST_SMALL_HIGHCONTRAST (RID_SVTOOLS_IMAGELIST_START + 5) +#define RID_SVTOOLS_IMAGELIST_EDITBWSEBOX_H (RID_SVTOOLS_IMAGELIST_START + 6) +#define RID_FILEPICKER_IMAGES (RID_SVTOOLS_IMAGELIST_START + 7) +#define RID_FILEPICKER_IMAGES_HC (RID_SVTOOLS_IMAGELIST_START + 8) + +//............................................................................. +// error boxes +#define ERRBOX_REG_NOSYSBROWSER ( RID_SVTOOLS_START + 0 ) +#define ERRBOX_CHECK_PLZ ( RID_SVTOOLS_START + 11 ) + +// Java message boxes +//These strings come from project desktop +//There was no time for translation, therefore the defines needed to +//remain the same. +#define QBX_JAVADISABLED (RID_SVTOOLS_START+20) +#define ERRORBOX_JVMCREATIONFAILED (RID_SVTOOLS_START+21) +#define WARNINGBOX_JAVANOTFOUND (RID_SVTOOLS_START+22) +#define WARNINGBOX_INVALIDJAVASETTINGS (RID_SVTOOLS_START+23) +#define ERRORBOX_RESTARTREQUIRED (RID_SVTOOLS_START+24) + +//............................................................................. +// images +#define RID_IMG_TREENODE_COLLAPSED (RID_SVTOOLS_START + 0) +#define RID_IMG_TREENODE_EXPANDED (RID_SVTOOLS_START + 1) +#define RID_IMG_TREENODE_COLLAPSED_HC (RID_SVTOOLS_START + 2) +#define RID_IMG_TREENODE_EXPANDED_HC (RID_SVTOOLS_START + 3) + +#define RID_IMG_PRINTERFONT (RID_SVTOOLS_START + 12) +#define RID_IMG_BITMAPFONT (RID_SVTOOLS_START + 13) +#define RID_IMG_SCALABLEFONT (RID_SVTOOLS_START + 14) +#define RID_IMG_PRINTERFONT_HC (RID_SVTOOLS_START + 15) +#define RID_IMG_BITMAPFONT_HC (RID_SVTOOLS_START + 16) +#define RID_IMG_SCALABLEFONT_HC (RID_SVTOOLS_START + 17) + +#define IMG_SVT_FOLDER (RID_SVTOOLS_START + 40) + +#define IMG_SVT_NEWDOC (RID_SVTOOLS_START + 52) +#define IMG_SVT_MYDOCS (RID_SVTOOLS_START + 53) +#define IMG_SVT_TEMPLATES (RID_SVTOOLS_START + 54) +#define IMG_SVT_SAMPLES (RID_SVTOOLS_START + 55) + +#define IMG_SVT_NEWDOC_HC (RID_SVTOOLS_START + 59) +#define IMG_SVT_MYDOCS_HC (RID_SVTOOLS_START + 60) +#define IMG_SVT_TEMPLATES_HC (RID_SVTOOLS_START + 61) +#define IMG_SVT_SAMPLES_HC (RID_SVTOOLS_START + 62) + +#define IMG_SVT_DOCTEMPLATE_BACK_SMALL (RID_SVTOOLS_START + 70) +#define IMG_SVT_DOCTEMPLATE_BACK_LARGE (RID_SVTOOLS_START + 71) +#define IMG_SVT_DOCTEMPLATE_PREV_SMALL (RID_SVTOOLS_START + 72) +#define IMG_SVT_DOCTEMPLATE_PREV_LARGE (RID_SVTOOLS_START + 73) +#define IMG_SVT_DOCTEMPLATE_PRINT_SMALL (RID_SVTOOLS_START + 74) +#define IMG_SVT_DOCTEMPLATE_PRINT_LARGE (RID_SVTOOLS_START + 75) +#define IMG_SVT_DOCTEMPLATE_DOCINFO_SMALL (RID_SVTOOLS_START + 76) +#define IMG_SVT_DOCTEMPLATE_DOCINFO_LARGE (RID_SVTOOLS_START + 77) +#define IMG_SVT_DOCTEMPLATE_PREVIEW_SMALL (RID_SVTOOLS_START + 78) +#define IMG_SVT_DOCTEMPLATE_PREVIEW_LARGE (RID_SVTOOLS_START + 79) + +#define IMG_SVT_DOCTEMPL_HC_BACK_SMALL (RID_SVTOOLS_START + 80) +#define IMG_SVT_DOCTEMPL_HC_BACK_LARGE (RID_SVTOOLS_START + 81) +#define IMG_SVT_DOCTEMPL_HC_PREV_SMALL (RID_SVTOOLS_START + 82) +#define IMG_SVT_DOCTEMPL_HC_PREV_LARGE (RID_SVTOOLS_START + 83) +#define IMG_SVT_DOCTEMPL_HC_PRINT_SMALL (RID_SVTOOLS_START + 84) +#define IMG_SVT_DOCTEMPL_HC_PRINT_LARGE (RID_SVTOOLS_START + 85) +#define IMG_SVT_DOCTEMPL_HC_DOCINFO_SMALL (RID_SVTOOLS_START + 86) +#define IMG_SVT_DOCTEMPL_HC_DOCINFO_LARGE (RID_SVTOOLS_START + 87) +#define IMG_SVT_DOCTEMPL_HC_PREVIEW_SMALL (RID_SVTOOLS_START + 88) +#define IMG_SVT_DOCTEMPL_HC_PREVIEW_LARGE (RID_SVTOOLS_START + 89) + +#define RID_IMG_PRNDLG_COLLATE (STR_SVT_PRNDLG_START + 29) +#define RID_IMG_PRNDLG_NOCOLLATE (STR_SVT_PRNDLG_START + 30) +#define RID_IMG_PRNDLG_COLLATE_HC (STR_SVT_PRNDLG_START + 31) +#define RID_IMG_PRNDLG_NOCOLLATE_HC (STR_SVT_PRNDLG_START + 32) + +#endif // #ifndef _SVTOOLS_HRC + +// ******************************************************************* EOF + diff --git a/svl/inc/svl/syslocale.hxx b/svl/inc/svl/syslocale.hxx new file mode 100644 index 000000000000..bd853d0d4eeb --- /dev/null +++ b/svl/inc/svl/syslocale.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: syslocale.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_SVTOOLS_SYSLOCALE_HXX +#define INCLUDED_SVTOOLS_SYSLOCALE_HXX + +#include "svtools/svtdllapi.h" +#include +#include +#include + + +class SvtSysLocale_Impl; +namespace osl { class Mutex; } +class LocaleDataWrapper; + +/** + SvtSysLocale provides a refcounted single instance of an application wide + LocaleDataWrapper and CharClass which always + follow the locale as it is currently configured by the user. You may use + it anywhere to access the locale data elements like decimal separator and + simple date formatting and so on. Contructing and destructing a + SvtSysLocale is not expensive as long as there is at least one instance + left. + */ +class SVT_DLLPUBLIC SvtSysLocale +{ + friend class SvtSysLocale_Impl; // access to mutex + + static SvtSysLocale_Impl* pImpl; + static sal_Int32 nRefCount; + + SVT_DLLPRIVATE static ::osl::Mutex& GetMutex(); + +public: + SvtSysLocale(); + ~SvtSysLocale(); + + const LocaleDataWrapper& GetLocaleData() const; + const CharClass& GetCharClass() const; + + /** It is safe to store the pointers locally and use them AS LONG AS THE + INSTANCE OF SvtSysLocale LIVES! + It is a faster access but be sure what you do! + */ + const LocaleDataWrapper* GetLocaleDataPtr() const; + const CharClass* GetCharClassPtr() const; + +}; + +#endif // INCLUDED_SVTOOLS_SYSLOCALE_HXX diff --git a/svl/inc/svl/syslocaleoptions.hxx b/svl/inc/svl/syslocaleoptions.hxx new file mode 100644 index 000000000000..8b03785d541e --- /dev/null +++ b/svl/inc/svl/syslocaleoptions.hxx @@ -0,0 +1,164 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: syslocaleoptions.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX +#define INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX + +#include "svtools/svtdllapi.h" +#include +#include +#include +#include +#include +#include +#include + +// bits for broadcasting hints of changes in a SfxSimpleHint, may be combined +const ULONG SYSLOCALEOPTIONS_HINT_LOCALE = 0x00000001; +const ULONG SYSLOCALEOPTIONS_HINT_CURRENCY = 0x00000002; + +class SvtSysLocaleOptions_Impl; +class SvtListener; +namespace osl { class Mutex; } + +class SVT_DLLPUBLIC SvtSysLocaleOptions: public utl::detail::Options +{ + static SvtSysLocaleOptions_Impl* pOptions; + static sal_Int32 nRefCount; + + SVT_DLLPRIVATE static ::osl::Mutex& GetMutex(); + +public: + + enum EOption + { + E_LOCALE, + E_CURRENCY + }; + SvtSysLocaleOptions(); + virtual ~SvtSysLocaleOptions(); + + // ConfigItem methods + + sal_Bool IsModified(); + void Commit(); + + /** Add a listener to react on config changes + which are broadcasted in a SfxSimpleHint + @return + if added + if not added + */ + BOOL AddListener( SvtListener& ); + BOOL RemoveListener( SvtListener& ); + + /** Block broadcasts and accumulate hints. This may be useful if, for + example, the locale and currency are changed and the currency was + empty before, since changing the locale with an empty currency does + also broadcast a change hint for the currency which would result in + two currency changes broadcasted. + + @param bBlock + : broadcasts are blocked until reversed. + : broadcasts are not blocked anymore. Pending hints are + broadcasted if no other instance blocks the broadcast. + + @ATTENTION + All SvtSysLocaleOptions instances point to exactly one refcounted + internal representation instance and broadcast blocks are counted. + Thus if you issue a BlockBroadcasts(TRUE) you MUST issue a matching + BlockBroadcasts(FALSE) or otherwise pending hints would never be + broadcasted again. + */ + void BlockBroadcasts( BOOL bBlock ); + + // config value access methods + + /// The config string may be empty to denote the SYSTEM locale + const ::rtl::OUString& GetLocaleConfigString() const; + void SetLocaleConfigString( const ::rtl::OUString& rStr ); + + /// The config string may be empty to denote the default currency of the locale + const ::rtl::OUString& GetCurrencyConfigString() const; + void SetCurrencyConfigString( const ::rtl::OUString& rStr ); + // determine whether the decimal separator defined in the keyboard layout is used + // or the one approriate to the locale + sal_Bool IsDecimalSeparatorAsLocale() const; + void SetDecimalSeparatorAsLocale( sal_Bool bSet); + + // convenience methods + + /** Get the LanguageType of the current locale, may be LANGUAGE_SYSTEM if + LocaleConfigString is empty. If you need the real locale used in the + application, call Application::GetSettings().GetLanguage() instead */ + LanguageType GetLocaleLanguageType() const; + + /// Get currency abbreviation and locale from an USD-en-US or EUR-de-DE string + static void GetCurrencyAbbrevAndLanguage( + String& rAbbrev, + LanguageType& eLang, + const ::rtl::OUString& rConfigString ); + + /// Create an USD-en-US or EUR-de-DE string + static ::rtl::OUString CreateCurrencyConfigString( + const String& rAbbrev, + LanguageType eLang ); + + void GetCurrencyAbbrevAndLanguage( + String& rAbbrev, + LanguageType& eLang ) const + { + GetCurrencyAbbrevAndLanguage( rAbbrev, + eLang, GetCurrencyConfigString() ); + } + + void SetCurrencyAbbrevAndLanguage( + const String& rAbbrev, + LanguageType eLang ) + { + SetCurrencyConfigString( + CreateCurrencyConfigString( + rAbbrev, eLang ) ); + } + + /** Set a link to a method to be called whenever the default currency + changes. This can be only one method, and normally it is the static + link method which calls SvNumberFormatter::SetDefaultSystemCurrency(). + This is needed because the number formatter isn't part of the svl light + library, otherwise we could call SetDefaultSystemCurrency() directly. + */ + static void SetCurrencyChangeLink( const Link& rLink ); + static const Link& GetCurrencyChangeLink(); + + /** return the readonly state of the queried option. */ + sal_Bool IsReadOnly( EOption eOption ) const; +}; + +#endif // INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX diff --git a/svl/inc/svl/szitem.hxx b/svl/inc/svl/szitem.hxx new file mode 100644 index 000000000000..d3fb920aa012 --- /dev/null +++ b/svl/inc/svl/szitem.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: szitem.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFXSZITEM_HXX +#define _SFXSZITEM_HXX + +#include + +#include + +class SfxArguments; +class SvStream; + +DBG_NAMEEX(SfxSizeItem) + +// ----------------------------------------------------------------------- + +class SfxSizeItem : public SfxPoolItem +{ +private: + Size aVal; + +public: + TYPEINFO(); + SfxSizeItem(); + SfxSizeItem( USHORT nWhich, const Size& rVal ); + SfxSizeItem( USHORT nWhich, SvStream & ); + SfxSizeItem( const SfxSizeItem& ); + ~SfxSizeItem() { DBG_DTOR(SfxSizeItem, 0); } + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + XubString &rText, + const IntlWrapper * = 0 ) const; + + virtual int operator==( const SfxPoolItem& ) const; + virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ) const; + virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ); + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, USHORT nItemVersion) const; + virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; + + const Size& GetValue() const { return aVal; } + void SetValue( const Size& rNewVal ) { + DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); + aVal = rNewVal; } +}; + +#endif + diff --git a/svl/inc/svl/tfrmitem.hxx b/svl/inc/svl/tfrmitem.hxx new file mode 100644 index 000000000000..93e245a731a2 --- /dev/null +++ b/svl/inc/svl/tfrmitem.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: tfrmitem.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _TFRMITEM_HXX +#define _TFRMITEM_HXX + +#include + +#include + +class SvStream; + +enum SfxOpenMode +{ + SfxOpenSelect = 0, // selected in view + SfxOpenOpen = 1, // doubleclicked or + SfxOpenAddTask = 2, // doubleclicked or with Ctrl-Modifier + SfxOpenDontKnow = 3, + SfxOpenReserved1 = 4, + SfxOpenReserved2 = 5, + SfxOpenModeLast = 5 +}; + +DBG_NAMEEX(SfxTargetFrameItem) + +// class SfxTargetFrameItem ------------------------------------------------- + +class SfxTargetFrameItem : public SfxPoolItem +{ +private: + String _aFrames[ (USHORT)SfxOpenModeLast+1 ]; +public: + TYPEINFO(); + + SfxTargetFrameItem( const SfxTargetFrameItem& rCpy ); + SfxTargetFrameItem( USHORT nWhich ); + SfxTargetFrameItem( + USHORT nWhich, + const String& rOpenSelectFrame, + const String& rOpenOpenFrame, + const String& rOpenAddTaskFrame ); + ~SfxTargetFrameItem(); + + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxPoolItem* Create( SvStream&, USHORT nItemVersion ) const; + virtual SvStream& Store( SvStream&, USHORT nItemVersion ) const; + virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; + + virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ) const; + virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ); + /* + Framebezeichner im Sfx: + _browser : Beamerview + _document : Desktopview + _blank : new task + "" : do nothing + */ + String GetTargetFrame( SfxOpenMode eMode ) const; +}; + +#endif + diff --git a/svl/inc/svl/tresitem.hxx b/svl/inc/svl/tresitem.hxx new file mode 100644 index 000000000000..6282d3a7d4ff --- /dev/null +++ b/svl/inc/svl/tresitem.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: tresitem.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVTOOLS_TRESITEM_HXX +#define SVTOOLS_TRESITEM_HXX + +#include +#include + +//============================================================================ +class CntTransferResultItem: public SfxPoolItem +{ + com::sun::star::ucb::TransferResult m_aResult; + +public: + TYPEINFO(); + + CntTransferResultItem(USHORT which = 0): SfxPoolItem(which) {} + + CntTransferResultItem(USHORT which, + com::sun::star::ucb::TransferResult const & + rTheResult): + SfxPoolItem(which), m_aResult(rTheResult) {} + + virtual int operator ==(SfxPoolItem const & rItem) const; + + virtual BOOL QueryValue(com::sun::star::uno::Any & rVal, BYTE = 0) const; + + virtual BOOL PutValue(const com::sun::star::uno::Any & rVal, BYTE = 0); + + virtual SfxPoolItem * Clone(SfxItemPool * = 0) const; + + com::sun::star::ucb::TransferResult const & GetValue() const + { return m_aResult; } +}; + +#endif // SVTOOLS_TRESITEM_HXX + diff --git a/svl/inc/svl/undo.hxx b/svl/inc/svl/undo.hxx new file mode 100644 index 000000000000..38cbfb227f1b --- /dev/null +++ b/svl/inc/svl/undo.hxx @@ -0,0 +1,240 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: undo.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _UNDO_HXX +#define _UNDO_HXX + +#include "svtools/svtdllapi.h" +#include +#include +#include + +//==================================================================== + +class SVT_DLLPUBLIC SfxRepeatTarget +{ +public: + TYPEINFO(); + virtual ~SfxRepeatTarget() = 0; +}; + +//==================================================================== + +class SVT_DLLPUBLIC SfxUndoAction +{ + BOOL bLinked; +public: + TYPEINFO(); + SfxUndoAction(); + virtual ~SfxUndoAction(); + + virtual BOOL IsLinked(); + virtual void SetLinked( BOOL bIsLinked = TRUE ); + virtual void Undo(); + virtual void Redo(); + virtual void Repeat(SfxRepeatTarget&); + virtual BOOL CanRepeat(SfxRepeatTarget&) const; + + virtual BOOL Merge( SfxUndoAction *pNextAction ); + + virtual UniString GetComment() const; + virtual UniString GetRepeatComment(SfxRepeatTarget&) const; + virtual USHORT GetId() const; + +private: + SfxUndoAction& operator=( const SfxUndoAction& ); // n.i.!! +}; + +//======================================================================== + +SV_DECL_PTRARR( SfxUndoActions, SfxUndoAction*, 20, 8 ) + +//==================================================================== + +/** do not make use of this implementation details, unless you + really really have to! */ +struct SVT_DLLPUBLIC SfxUndoArray +{ + SfxUndoActions aUndoActions; + USHORT nMaxUndoActions; + USHORT nCurUndoAction; + SfxUndoArray *pFatherUndoArray; + SfxUndoArray(USHORT nMax=0): + nMaxUndoActions(nMax), nCurUndoAction(0), + pFatherUndoArray(0) {} + ~SfxUndoArray(); +}; + +//========================================================================= + +/** do not make use of this implementation details, unless you + really really have to! */ +class SVT_DLLPUBLIC SfxListUndoAction : public SfxUndoAction, public SfxUndoArray + +/* [Beschreibung] + + UndoAction zur Klammerung mehrerer Undos in einer UndoAction. + Diese Actions werden vom SfxUndoManager verwendet. Dort + wird mit < SfxUndoManager::EnterListAction > eine Klammerebene + geoeffnet und mit wieder + geschlossen. Redo und Undo auf SfxListUndoActions wirken + Elementweise. + +*/ +{ + public: + TYPEINFO(); + + SfxListUndoAction( const UniString &rComment, + const UniString rRepeatComment, USHORT Id, SfxUndoArray *pFather); + virtual void Undo(); + virtual void Redo(); + virtual void Repeat(SfxRepeatTarget&); + virtual BOOL CanRepeat(SfxRepeatTarget&) const; + + virtual BOOL Merge( SfxUndoAction *pNextAction ); + + virtual UniString GetComment() const; + virtual UniString GetRepeatComment(SfxRepeatTarget&) const; + virtual USHORT GetId() const; + + void SetComment( const UniString& rComment ); + + private: + + USHORT nId; + UniString aComment, aRepeatComment; + +}; + +//========================================================================= + +class SVT_DLLPUBLIC SfxUndoManager +{ + friend class SfxLinkUndoAction; + + SfxUndoArray *pUndoArray; + SfxUndoArray *pActUndoArray; + SfxUndoArray *pFatherUndoArray; + + bool mbUndoEnabled; +public: + SfxUndoManager( USHORT nMaxUndoActionCount = 20 ); + virtual ~SfxUndoManager(); + + virtual void SetMaxUndoActionCount( USHORT nMaxUndoActionCount ); + virtual USHORT GetMaxUndoActionCount() const; + virtual void Clear(); + + virtual void AddUndoAction( SfxUndoAction *pAction, BOOL bTryMerg=FALSE ); + + virtual USHORT GetUndoActionCount() const; + virtual USHORT GetUndoActionId(USHORT nNo=0) const; + virtual UniString GetUndoActionComment( USHORT nNo=0 ) const; + /** returns the nNo'th undo action from the top */ + SfxUndoAction* GetUndoAction( USHORT nNo=0 ) const; + + virtual BOOL Undo( USHORT nCount=1 ); + virtual void Undo( SfxUndoAction &rAction ); + + virtual USHORT GetRedoActionCount() const; + virtual USHORT GetRedoActionId(USHORT nNo=0) const; + virtual UniString GetRedoActionComment( USHORT nNo=0 ) const; + + virtual BOOL Redo( USHORT nCount=1 ); + virtual void Redo( SfxUndoAction &rAction ); + virtual void ClearRedo(); + + virtual USHORT GetRepeatActionCount() const; + virtual UniString GetRepeatActionComment( SfxRepeatTarget &rTarget, USHORT nNo = 0) const; + virtual BOOL Repeat( SfxRepeatTarget &rTarget, USHORT nFrom=0, USHORT nCount=1 ); + virtual void Repeat( SfxRepeatTarget &rTarget, SfxUndoAction &rAction ); + virtual BOOL CanRepeat( SfxRepeatTarget &rTarget, USHORT nNo = 0 ) const; + virtual BOOL CanRepeat( SfxRepeatTarget &rTarget, SfxUndoAction &rAction ) const; + + virtual void EnterListAction(const UniString &rComment, const UniString& rRepeatComment, USHORT nId=0); + virtual void LeaveListAction(); + + /** clears the redo stack and removes the top undo action */ + void RemoveLastUndoAction(); + + // enables (true) or disables (false) recording of undo actions + // If undo actions are added while undo is disabled, they are deleted. + // Disabling undo does not clear the current undo buffer! + void EnableUndo( bool bEnable ); + + // returns true if undo is currently enabled + // This returns false if undo was disabled using EnableUndo( false ) and + // also during the runtime of the Undo() and Redo() methods. + bool IsUndoEnabled() const { return mbUndoEnabled; } +}; + +//========================================================================= + +class SVT_DLLPUBLIC SfxLinkUndoAction : public SfxUndoAction + +/* [Beschreibung] + + Die SfxLinkUndoAction dient zur Verbindung zweier SfxUndoManager. Die + im ersten SfxUndoManager eingefuegten SfxUndoAction leiten ihr Undo und Redo + an den zweiten weiter, so dass ein Undo und Redo am ersten + SfxUndoManager wie eine am zweiten wirkt. + + Die SfxLinkUndoAction ist nach dem Einfuegen der SfxUndoAction am + zweiten SfxUndoManager einzufuegen. Waehrend der zweite SfxUndoManager + vom ersten ferngesteuert wird, duerfen an ihm weder Actions eingefuegt werden, + noch darf Undo/Redo aufgerufen werden. + +*/ + +{ +public: + TYPEINFO(); + SfxLinkUndoAction(SfxUndoManager *pManager); + ~SfxLinkUndoAction(); + + virtual void Undo(); + virtual void Redo(); + virtual BOOL CanRepeat(SfxRepeatTarget& r) const; + + virtual void Repeat(SfxRepeatTarget&r); + + virtual UniString GetComment() const; + virtual UniString GetRepeatComment(SfxRepeatTarget&r) const; + virtual USHORT GetId() const; + + SfxUndoAction* GetAction() const { return pAction; } + +protected: + SfxUndoManager *pUndoManager; + SfxUndoAction *pAction; + +}; + +#endif diff --git a/svl/inc/svl/urlfilter.hxx b/svl/inc/svl/urlfilter.hxx new file mode 100644 index 000000000000..6370a75a1fd7 --- /dev/null +++ b/svl/inc/svl/urlfilter.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: urlfilter.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVTOOLS_URL_FILTER_HXX +#define SVTOOLS_URL_FILTER_HXX + +#include +#include +#include +#include +/** filters allowed URLs +*/ +class IUrlFilter +{ +public: + virtual bool isUrlAllowed( const String& _rURL ) const = 0; + +protected: + virtual inline ~IUrlFilter() = 0; +}; + +inline IUrlFilter::~IUrlFilter() {} + +struct FilterMatch : public ::std::unary_function< bool, WildCard > +{ +private: + const String& m_rCompareString; +public: + FilterMatch( const String& _rCompareString ) : m_rCompareString( _rCompareString ) { } + + bool operator()( const WildCard& _rMatcher ) + { + return _rMatcher.Matches( m_rCompareString ) ? true : false; + } + + static void createWildCardFilterList(const String& _rFilterList,::std::vector< WildCard >& _rFilters); +}; + +#endif // SVTOOLS_URL_FILTER_HXX diff --git a/svl/inc/svl/visitem.hxx b/svl/inc/svl/visitem.hxx new file mode 100644 index 000000000000..9ace1212d967 --- /dev/null +++ b/svl/inc/svl/visitem.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: visitem.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SFXVISIBILITYITEM_HXX +#define _SFXVISIBILITYITEM_HXX + +#include "svtools/svldllapi.h" +#include +#include +#include + +//============================================================================ +DBG_NAMEEX_VISIBILITY(SfxVisibilityItem, SVL_DLLPUBLIC) + +class SVL_DLLPUBLIC SfxVisibilityItem: public SfxPoolItem +{ + ::com::sun::star::frame::status::Visibility m_nValue; + +public: + TYPEINFO(); + + SfxVisibilityItem(USHORT which = 0, sal_Bool bVisible = sal_True): + SfxPoolItem(which) + { + m_nValue.bVisible = bVisible; + DBG_CTOR(SfxVisibilityItem, 0); + } + + SfxVisibilityItem(USHORT which, SvStream & rStream); + + SfxVisibilityItem(const SfxVisibilityItem & rItem): + SfxPoolItem(rItem), m_nValue(rItem.m_nValue) + { DBG_CTOR(SfxVisibilityItem, 0); } + + virtual ~SfxVisibilityItem() { DBG_DTOR(SfxVisibilityItem, 0); } + + virtual int operator ==(const SfxPoolItem & rItem) const; + + using SfxPoolItem::Compare; + virtual int Compare(const SfxPoolItem & rWith) const; + + virtual SfxItemPresentation GetPresentation(SfxItemPresentation, + SfxMapUnit, SfxMapUnit, + XubString & rText, + const IntlWrapper * = 0) + const; + + virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ) const; + + virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ); + + virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const; + + virtual SvStream & Store(SvStream & rStream, USHORT) const; + + virtual SfxPoolItem * Clone(SfxItemPool * = 0) const; + + virtual USHORT GetValueCount() const; + + virtual UniString GetValueTextByVal(BOOL bTheValue) const; + + BOOL GetValue() const { return m_nValue.bVisible; } + + void SetValue(BOOL bVisible) { m_nValue.bVisible = bVisible; } +}; + +#endif // _SFXVISIBILITYITEM_HXX diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx new file mode 100644 index 000000000000..22a258d32f88 --- /dev/null +++ b/svl/inc/svl/zforlist.hxx @@ -0,0 +1,1014 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: zforlist.hxx,v $ + * $Revision: 1.3.148.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _ZFORLIST_HXX +#define _ZFORLIST_HXX + +#include "svtools/svtdllapi.h" +#include +#ifndef _TABLE_HXX //autogen +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +class Date; +class SvStream; +class Color; +class SvUShorts; +class CharClass; +class CalendarWrapper; + +class ImpSvNumberformatScan; +class ImpSvNumberInputScan; +class SvNumberformat; + +namespace com { namespace sun { namespace star { + namespace lang { + class XMultiServiceFactory; + } +}}} + + +#define SV_COUNTRY_LANGUAGE_OFFSET 5000 // Max count of formats per country/language +#define SV_MAX_ANZ_STANDARD_FORMATE 100 // Max count of builtin default formats per CL + +// Format types +#ifndef NUMBERFORMAT_ALL +// also defined in com/sun/star/util/NumberFormat.hpp +//! => put in single .idl file and include here +#define NUMBERFORMAT_ALL 0x000 /// Just for Output of total list, not a real format type +#define NUMBERFORMAT_DEFINED 0x001 /// Format defined by user +#define NUMBERFORMAT_DATE 0x002 /// Number as date +#define NUMBERFORMAT_TIME 0x004 /// Number as time +#define NUMBERFORMAT_CURRENCY 0x008 /// Number as currency +#define NUMBERFORMAT_NUMBER 0x010 /// Any "normal" number format +#define NUMBERFORMAT_SCIENTIFIC 0x020 /// Number as scientific +#define NUMBERFORMAT_FRACTION 0x040 /// Number as fraction +#define NUMBERFORMAT_PERCENT 0x080 /// Number as percent +#define NUMBERFORMAT_TEXT 0x100 /// Text format +#define NUMBERFORMAT_DATETIME 0x006 /// Number as date and time +#define NUMBERFORMAT_LOGICAL 0x400 /// Number as boolean value +#define NUMBERFORMAT_UNDEFINED 0x800 /// Format undefined yet in analyzing +#endif +#define NUMBERFORMAT_ENTRY_NOT_FOUND (sal_uInt32)(0xffffffff) /// MAX_ULONG + + +/** enum values for SvNumberFormatter::GetFormatIndex + +

+ Builtin standard formats, order should be also the arrangement in the + dialog list box representation.

+ +

+ Date specials:

    +
  • SYSTEM: As set in System Regional Settings. +
  • SYS: short/long defined, order and separators from System Regional Settings. +
  • DEF: short/long and order defined, separators from System Regional Settings. +
  • DIN: all settings hard coded as DIN (Deutsche Industrie Norm) and EN (European Norm) require. +
  • all other: hard coded +
+ */ +enum NfIndexTableOffset +{ + NF_NUMERIC_START = 0, + + NF_NUMBER_START = NF_NUMERIC_START, + NF_NUMBER_STANDARD = NF_NUMBER_START, // Standard/General + NF_NUMBER_INT, // 0 + NF_NUMBER_DEC2, // 0.00 + NF_NUMBER_1000INT, // #,##0 + NF_NUMBER_1000DEC2, // #,##0.00 + NF_NUMBER_SYSTEM, // #,##0.00 or whatever is set in System Regional Settings + NF_NUMBER_END = NF_NUMBER_SYSTEM, + + NF_SCIENTIFIC_START, + NF_SCIENTIFIC_000E000 = NF_SCIENTIFIC_START, // 0.00E+000 + NF_SCIENTIFIC_000E00, // 0.00E+00 + NF_SCIENTIFIC_END = NF_SCIENTIFIC_000E00, + + NF_PERCENT_START, + NF_PERCENT_INT = NF_PERCENT_START, // 0% + NF_PERCENT_DEC2, // 0.00% + NF_PERCENT_END = NF_PERCENT_DEC2, + + NF_FRACTION_START, + NF_FRACTION_1 = NF_FRACTION_START, // # ?/? + NF_FRACTION_2, // # ??/?? + NF_FRACTION_END = NF_FRACTION_2, + + NF_NUMERIC_END = NF_FRACTION_END, + + NF_CURRENCY_START, + NF_CURRENCY_1000INT = NF_CURRENCY_START,// #,##0 DM + NF_CURRENCY_1000DEC2, // #,##0.00 DM + NF_CURRENCY_1000INT_RED, // #,##0 DM negative in red + NF_CURRENCY_1000DEC2_RED, // #,##0.00 DM negative in red + NF_CURRENCY_1000DEC2_CCC, // #,##0.00 DEM currency abbreviation + NF_CURRENCY_1000DEC2_DASHED, // #,##0.-- DM + NF_CURRENCY_END = NF_CURRENCY_1000DEC2_DASHED, + + NF_DATE_START, + NF_DATE_SYSTEM_SHORT = NF_DATE_START, // 08.10.97 + NF_DATE_SYSTEM_LONG, // Wednesday, 8. October 1997 + NF_DATE_SYS_DDMMYY, // 08.10.97 + NF_DATE_SYS_DDMMYYYY, // 08.10.1997 + NF_DATE_SYS_DMMMYY, // 8. Oct 97 + NF_DATE_SYS_DMMMYYYY, // 8. Oct 1997 + NF_DATE_DIN_DMMMYYYY, // 8. Oct. 1997 DIN + NF_DATE_SYS_DMMMMYYYY, // 8. October 1997 + NF_DATE_DIN_DMMMMYYYY, // 8. October 1997 DIN + NF_DATE_SYS_NNDMMMYY, // Wed, 8. Okt 97 + NF_DATE_DEF_NNDDMMMYY, // Wed 08.Okt 97 + NF_DATE_SYS_NNDMMMMYYYY, // Wed, 8. Oktober 1997 + NF_DATE_SYS_NNNNDMMMMYYYY, // Wednesday, 8. Oktober 1997 + NF_DATE_DIN_MMDD, // 10-08 DIN + NF_DATE_DIN_YYMMDD, // 97-10-08 DIN + NF_DATE_DIN_YYYYMMDD, // 1997-10-08 DIN + NF_DATE_SYS_MMYY, // 10.97 + NF_DATE_SYS_DDMMM, // 08.Oct + NF_DATE_MMMM, // October + NF_DATE_QQJJ, // 4. Quarter 97 + NF_DATE_WW, // week of year + NF_DATE_END = NF_DATE_WW, + + NF_TIME_START, + NF_TIME_HHMM = NF_TIME_START, // HH:MM + NF_TIME_HHMMSS, // HH:MM:SS + NF_TIME_HHMMAMPM, // HH:MM AM/PM + NF_TIME_HHMMSSAMPM, // HH:MM:SS AM/PM + NF_TIME_HH_MMSS, // [HH]:MM:SS + NF_TIME_MMSS00, // MM:SS,00 + NF_TIME_HH_MMSS00, // [HH]:MM:SS,00 + NF_TIME_END = NF_TIME_HH_MMSS00, + + NF_DATETIME_START, + NF_DATETIME_SYSTEM_SHORT_HHMM = NF_DATETIME_START, // 08.10.97 01:23 + NF_DATETIME_SYS_DDMMYYYY_HHMMSS, // 08.10.1997 01:23:45 + NF_DATETIME_END = NF_DATETIME_SYS_DDMMYYYY_HHMMSS, + + NF_BOOLEAN, // BOOLEAN + NF_TEXT, // @ + NF_INDEX_TABLE_ENTRIES +}; + + +// #45717# IsNumberFormat( "98-10-24", 30, x ), YMD Format set with DMY +// International settings doesn't recognize the string as a date. +/** enum values for SvNumberFormatter::SetEvalDateFormat + +

How ImpSvNumberInputScan::GetDateRef shall take the + DateFormat order (YMD,DMY,MDY) into account, if called from IsNumberFormat + with a date format to match against. + */ +enum NfEvalDateFormat +{ + /** DateFormat only from International, default. */ + NF_EVALDATEFORMAT_INTL, + + /** DateFormat only from date format passed to function (if any). + If no date format is passed then the DateFormat is taken from International. */ + NF_EVALDATEFORMAT_FORMAT, + + /** First try the DateFormat from International. If it doesn't match a + valid date try the DateFormat from the date format passed. */ + NF_EVALDATEFORMAT_INTL_FORMAT, + + /** First try the DateFormat from the date format passed. If it doesn't + match a valid date try the DateFormat from International. */ + NF_EVALDATEFORMAT_FORMAT_INTL +}; + + +//#if 0 // _SOLAR__PRIVATE +#define _ZFORLIST_DECLARE_TABLE +//#endif +#ifdef _ZFORLIST_DECLARE_TABLE +DECLARE_TABLE (SvNumberFormatTable, SvNumberformat*) +DECLARE_TABLE (SvNumberFormatterIndexTable, sal_uInt32*) +#else +typedef Table SvNumberFormatTable; +typedef Table SvNumberFormatterIndexTable; +#endif + +typedef ::std::map< sal_uInt32, sal_uInt32 > SvNumberFormatterMergeMap; + + +/** Language/country dependent currency entries + */ +class SVT_DLLPUBLIC NfCurrencyEntry +{ + String aSymbol; /// currency symbol + String aBankSymbol; /// currency abbreviation + LanguageType eLanguage; /// language/country value + USHORT nPositiveFormat; /// position of symbol + USHORT nNegativeFormat; /// position of symbol and type and position of negative sign + USHORT nDigits; /// count of decimal digits + sal_Unicode cZeroChar; /// which character is used for zeros as last decimal digits + + /// not implemented, prevent usage + NfCurrencyEntry( const NfCurrencyEntry& ); + /// not implemented, prevent usage + NfCurrencyEntry& operator=( const NfCurrencyEntry& ); + +private: + +//#if 0 // _SOLAR__PRIVATE + // nDecimalFormat := 0, 1, 2 + // #,##0 or #,##0.00 or #,##0.-- are assigned + SVT_DLLPRIVATE void Impl_BuildFormatStringNumChars( String&, + const LocaleDataWrapper&, USHORT nDecimalFormat ) const; +//#endif // __PRIVATE + +public: + + NfCurrencyEntry(); + NfCurrencyEntry( const LocaleDataWrapper& rLocaleData, + LanguageType eLang ); + NfCurrencyEntry( + const ::com::sun::star::i18n::Currency & rCurr, + const LocaleDataWrapper& rLocaleData, + LanguageType eLang ); + ~NfCurrencyEntry() {} + + /// Symbols and language identical + BOOL operator==( const NfCurrencyEntry& r ) const; + + /// Set this format to be the EURo entry, overwrite other settings + void SetEuro(); + BOOL IsEuro() const; + + /** Apply format information (nPositiveFormat, + nNegativeFormat, nDigits, cZeroChar) of another format. */ + void ApplyVariableInformation( const NfCurrencyEntry& ); + + const String& GetSymbol() const { return aSymbol; } + const String& GetBankSymbol() const { return aBankSymbol; } + LanguageType GetLanguage() const { return eLanguage; } + USHORT GetPositiveFormat() const { return nPositiveFormat; } + USHORT GetNegativeFormat() const { return nNegativeFormat; } + USHORT GetDigits() const { return nDigits; } + sal_Unicode GetZeroChar() const { return cZeroChar; } + + /** [$DM-407] (bBank==FALSE) or [$DEM] (bBank==TRUE) + is assigned to rStr, if bBank==FALSE and + bWithoutExtension==TRUE only [$DM] */ + void BuildSymbolString( String& rStr, BOOL bBank, + BOOL bWithoutExtension = FALSE ) const; + + /** #,##0.00 [$DM-407] is assigned to rStr, separators + from rLoc, incl. minus sign but without [RED] */ + void BuildPositiveFormatString( String& rStr, BOOL bBank, + const LocaleDataWrapper&, USHORT nDecimalFormat = 1 ) const; + void BuildNegativeFormatString( String& rStr, BOOL bBank, + const LocaleDataWrapper&, USHORT nDecimalFormat = 1 ) const; + + /** [$DM-407] (or [$DEM] if bBank==TRUE) + is appended/prepended to rStr, incl. minus sign */ + void CompletePositiveFormatString( String& rStr, BOOL bBank, + USHORT nPosiFormat ) const; + void CompleteNegativeFormatString( String& rStr, BOOL bBank, + USHORT nNegaFormat ) const; + + /// rSymStr is appended/prepended to rStr, incl. minus sign + static void CompletePositiveFormatString( String& rStr, + const String& rSymStr, USHORT nPosiFormat ); + static void CompleteNegativeFormatString( String& rStr, + const String& rSymStr, USHORT nNegaFormat ); + + /** Representation of a currency (symbol position and + negative sign) in other language settings */ + static USHORT GetEffectivePositiveFormat( USHORT nIntlFormat, + USHORT nCurrFormat, BOOL bBank ); + static USHORT GetEffectiveNegativeFormat( USHORT nIntlFormat, + USHORT nCurrFormat, BOOL bBank ); + + /// General Unicode Euro symbol + static inline sal_Unicode GetEuroSymbol() { return sal_Unicode(0x20AC); } + /** Platform and CharSet dependent Euro symbol, + needed for import/export */ + static sal_Char GetEuroSymbol( rtl_TextEncoding eTextEncoding ); +}; + +typedef NfCurrencyEntry* NfCurrencyEntryPtr; +SV_DECL_PTRARR_DEL( NfCurrencyTable, NfCurrencyEntryPtr, 128, 1 ) +typedef String* WSStringPtr; +SV_DECL_PTRARR_DEL_VISIBILITY( NfWSStringsDtor, WSStringPtr, 8, 1, SVT_DLLPUBLIC ) + + +class SvNumberFormatterRegistry_Impl; + +class SVT_DLLPUBLIC SvNumberFormatter +{ +public: + + /// Preferred ctor with service manager and language/country enum + SvNumberFormatter( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMgr, + LanguageType eLang + ); + + /// Depricated ctor without service manager + SvNumberFormatter( LanguageType eLang ); + + ~SvNumberFormatter(); + + /// Set CallBack to ColorTable + void SetColorLink( const Link& rColorTableCallBack ) { aColorLink = rColorTableCallBack; } + /// Do the CallBack to ColorTable + Color* GetUserDefColor(USHORT nIndex); + + /// Change language/country, also input and format scanner + void ChangeIntl( LanguageType eLnge ); + /// Change the reference null date + void ChangeNullDate(USHORT nDay, USHORT nMonth, USHORT nYear); + /// Change standard precision + void ChangeStandardPrec(short nPrec); + /// Set zero value suppression + void SetNoZero(BOOL bNZ) { bNoZero = bNZ; } + + /** The language with which the formatter was initialized (system setting), + NOT the current language after a ChangeIntl() */ + LanguageType GetLanguage() const { return IniLnge; } + + // Determine whether two format types are input compatible or not + BOOL IsCompatible(short eOldType, short eNewType); + + /** Get table of formats of a specific type of a locale. A format FIndex is + tested whether it has the type and locale requested, if it doesn't + match FIndex returns the default format for the type/locale. If no + specific format is to be selected FIndex may be initialized to 0. */ + SvNumberFormatTable& GetEntryTable(short eType, + sal_uInt32& FIndex, + LanguageType eLnge); + + /** Get table of formats of a specific type of a language/country. + FIndex returns the default format of that type. + If the language/country was never touched before new entries are generated */ + SvNumberFormatTable& ChangeCL(short eType, + sal_uInt32& FIndex, + LanguageType eLnge); + + /** Get table of formats of the same type as FIndex; eType and rLnge are + set accordingly. An unknown format is set to Standard/General */ + SvNumberFormatTable& GetFirstEntryTable(short& eType, + sal_uInt32& FIndex, + LanguageType& rLnge); + + /// Delete an entry including the format it is refering to + void DeleteEntry(sal_uInt32 nKey); + + /** Create new entry of a format code string for language/country. + @return + if string new and ok and inserted. + if string already exists or an unresolvable parse error + occured, in which case nCheckPos is the error position within rString. + If the error occurs at position 0 or rString is empty nCheckPos + will be 1, so an error in the string is always indicated by + nCheckPos not being zero. + The content of the rString variable can be changed and corrected + by the method. + nType contains the type of the format. + nKey contains the index key of the format. + */ + BOOL PutEntry( String& rString, xub_StrLen& nCheckPos, short& nType, sal_uInt32& nKey, + LanguageType eLnge = LANGUAGE_DONTKNOW ); + + /** Same as PutEntry but the format code string is + considered to be of language/country eLnge and is converted to + language/country eNewLnge */ + BOOL PutandConvertEntry( String& rString, xub_StrLen& nCheckPos, + short& nType, sal_uInt32& nKey, + LanguageType eLnge, LanguageType eNewLnge ); + + /** Same as PutandConvertEntry but the format code string + is considered to be of the System language/country eLnge and is + converted to another System language/country eNewLnge. In this case + the automatic currency is converted too. */ + BOOL PutandConvertEntrySystem( String& rString, xub_StrLen& nCheckPos, + short& nType, sal_uInt32& nKey, + LanguageType eLnge, LanguageType eNewLnge ); + + /** Similar to PutEntry and + PutandConvertEntry or + PutandConvertEntrySystem, the format code string + passed is considered to be of language/country eLnge. If + eLnge==LANGUAGE_SYSTEM the format code has to match eSysLnge, and if + eSysLnge is not the current application locale the format code is + converted to the current locale. Additionally, if the format code + represents an old "automatic" currency format, it is converted to the + new default currency format of the eLnge locale. The rString format + code passed as an argument may get adapted in case eLnge was used (or + is LANGUAGE_SYSTEM and eSysLnge is identical); in case it wasn't the + method works on a copy instead, otherwise the resulting string would + not match eSysLnge anymore. + +

This method was introduced to handle the legacy currency formats of + the "autotbl.fmt" file used by Calc and Writer and convert them to + fixed currency codes of the actual currency. Note that in the case of + legacy currency formats no special attribution is converted, only the + default currency format of the locale is chosen, and that new fixed + currency codes are of course not converted to other currencies. The + method may also be used as a general method taking, converting and + inserting almost arbitrary format codes. To insert or use, for example, + the default currency format code matching the current locale, the + method could be called with
+ + + GetIndexPuttingAndConverting( "0 $", LANGUAGE_SYSTEM, LANGUAGE_ENGLISH_US, ...); + + + @return + The index key of the resulting number format. If the format code + was empty, could not be converted or has errors, the eLnge locale's + standard number format is chosen instead. The index key is + guaranteed to represent some valid number format. If + rNewInserted==FALSE and rCheckPos>0 the format code has errors + and/or could not be converted. + */ + sal_uInt32 GetIndexPuttingAndConverting( String & rString, LanguageType eLnge, + LanguageType eSysLnge, short & rType, + BOOL & rNewInserted, + xub_StrLen & rCheckPos ); + + /** Create a format code string using format nIndex as a template and + applying other settings (passed from the dialog) */ + void GenerateFormat( String& sString, sal_uInt32 nIndex, + LanguageType eLnge = LANGUAGE_DONTKNOW, + BOOL bThousand = FALSE, BOOL IsRed = FALSE, + USHORT nPrecision = 0, USHORT nAnzLeading = 1 ); + + /** Analyze an input string + @return + if input is a number or is matching a format F_Index + F_Index is set to a matching format if number, the value is + returned in fOutNumber + if input is not a number + */ + BOOL IsNumberFormat( const String& sString, sal_uInt32& F_Index, double& fOutNumber ); + + /// Format a number according to a format index, return string and color + void GetOutputString( const double& fOutNumber, sal_uInt32 nFIndex, + String& sOutString, Color** ppColor ); + + /** Format a string according to a format index, return string and color. + Formats only if the format code is of type text or the 4th subcode + of a format code is specified, otherwise sOutString will be == "" */ + void GetOutputString( String& sString, sal_uInt32 nFIndex, + String& sOutString, Color** ppColor ); + + /** Format a number according to the standard default format matching + the given format index */ + void GetInputLineString( const double& fOutNumber, + sal_uInt32 nFIndex, String& sOutString ); + + /** Format a number according to a format code string to be scanned. + @return + if format code contains an error + else, in which case the string and color are returned. + */ + BOOL GetPreviewString( const String& sFormatString, double fPreviewNumber, + String& sOutString, Color** ppColor, + LanguageType eLnge = LANGUAGE_DONTKNOW ); + + /** Same as GetPreviewString but the format code string + may be either language/country eLnge or en_US english US */ + BOOL GetPreviewStringGuess( const String& sFormatString, double fPreviewNumber, + String& sOutString, Color** ppColor, + LanguageType eLnge = LANGUAGE_DONTKNOW ); + + /** Test whether the format code string is already present in container + @return + NUMBERFORMAT_ENTRY_NOT_FOUND if not found, else the format index. + */ + sal_uInt32 TestNewString( const String& sFormatString, + LanguageType eLnge = LANGUAGE_DONTKNOW ); + + /// Whether format index nFIndex is of type text or not + BOOL IsTextFormat(sal_uInt32 nFIndex) const; + /// Whether the 4th string subcode of format index nFIndex is present + BOOL HasTextFormat(sal_uInt32 nFIndex) const; + + /// Load all formats from a stream + BOOL Load( SvStream& rStream ); + /// Save all formats to a stream + BOOL Save( SvStream& rStream ) const; + /// Reset of "Used" flags + void PrepareSave(); + + /// Flag format index as used + void SetFormatUsed(sal_uInt32 nFIndex); + + /// Get additional info of a format index, e.g. for dialog box + void GetFormatSpecialInfo(sal_uInt32 nFormat, BOOL& bThousand, BOOL& IsRed, + USHORT& nPrecision, USHORT& nAnzLeading); + + /// Count of decimals + USHORT GetFormatPrecision( sal_uInt32 nFormat ) const; + + /** Get additional info of a format code string, e.g. for dialog box. + Uses a temporary parse, if possible use only if format code is not + present in container yet, otherwise ineffective. + @return + 0 if format code string parsed without errors, otherwise error + position (like nCheckPos on PutEntry) + */ + sal_uInt32 GetFormatSpecialInfo( const String&, BOOL& bThousand, BOOL& IsRed, + USHORT& nPrecision, USHORT& nAnzLeading, + LanguageType eLnge = LANGUAGE_DONTKNOW ); + + /// Check if format code string may be deleted by user + BOOL IsUserDefined( const String& sStr, LanguageType eLnge = LANGUAGE_DONTKNOW ); + + /** Return the format index of the format code string for language/country, + or NUMBERFORMAT_ENTRY_NOT_FOUND */ + sal_uInt32 GetEntryKey( const String& sStr, LanguageType eLnge = LANGUAGE_DONTKNOW ); + + /// Return the format for a format index + const SvNumberformat* GetEntry(sal_uInt32 nKey) const + { return (SvNumberformat*) aFTable.Get(nKey); } + + /// Return the format index of the standard default number format for language/country + sal_uInt32 GetStandardIndex(LanguageType eLnge = LANGUAGE_DONTKNOW); + + /// Return the format index of the default format of a type for language/country + sal_uInt32 GetStandardFormat(short eType, LanguageType eLnge = LANGUAGE_DONTKNOW); + + /** Return the format index of the default format of a type for language/country. + Maybe not the default format but a special builtin format, e.g. for + NF_TIME_HH_MMSS00, if that format is passed in nFIndex. */ + sal_uInt32 GetStandardFormat( sal_uInt32 nFIndex, short eType, LanguageType eLnge ); + + /** Return the format index of the default format of a type for language/country. + Maybe not the default format but a special builtin format, e.g. for + NF_TIME_HH_MMSS00, or NF_TIME_HH_MMSS if fNumber >= 1.0 */ + sal_uInt32 GetStandardFormat( double fNumber, sal_uInt32 nFIndex, short eType, + LanguageType eLnge ); + + /// Whether nFIndex is a special builtin format + BOOL IsSpecialStandardFormat( sal_uInt32 nFIndex, LanguageType eLnge ); + + /// Return the reference date + Date* GetNullDate(); + /// Return the standard decimal precision + short GetStandardPrec(); + /// Return whether zero suppression is switched on + BOOL GetNoZero() { return bNoZero; } + /** Get the type of a format (or NUMBERFORMAT_UNDEFINED if no entry), + but with NUMBERFORMAT_DEFINED masked out */ + short GetType(sal_uInt32 nFIndex); + + /// As the name says + void ClearMergeTable(); + /// Merge in all new entries from rNewTable and return a table of resulting new format indices + SvNumberFormatterIndexTable* MergeFormatter(SvNumberFormatter& rNewTable); + + /// Whether a merge table is present or not + inline BOOL HasMergeFmtTbl() const; + /// Return the new format index for an old format index, if a merge table exists + inline sal_uInt32 GetMergeFmtIndex( sal_uInt32 nOldFmt ) const; + + /** Convert the ugly old tools' Table type bloated with new'ed sal_uInt32 + entries merge table to ::std::map with old index key and new index key. + @ATTENTION! Also clears the old table using ClearMergeTable() */ + SvNumberFormatterMergeMap ConvertMergeTableToMap(); + + /// Return the last used position ever of a language/country combination + USHORT GetLastInsertKey(sal_uInt32 CLOffset); + + /** Return the format index of a builtin format for a specific language/country. + If nFormat is not a builtin format nFormat is returned. */ + sal_uInt32 GetFormatForLanguageIfBuiltIn( sal_uInt32 nFormat, + LanguageType eLnge = LANGUAGE_DONTKNOW ); + + /** Return the format index for a builtin format of a specific language + @see NfIndexTableOffset + */ + sal_uInt32 GetFormatIndex( NfIndexTableOffset, LanguageType eLnge = LANGUAGE_DONTKNOW ); + + /** Return enum index of a format index of a builtin format, + NF_INDEX_TABLE_ENTRIES if it's not a builtin format. + @see NfIndexTableOffset + */ + NfIndexTableOffset GetIndexTableOffset( sal_uInt32 nFormat ) const; + + /** Set evaluation type and order of input date strings + @see NfEvalDateFormat + */ + void SetEvalDateFormat( NfEvalDateFormat eEDF ) { eEvalDateFormat = eEDF; } + NfEvalDateFormat GetEvalDateFormat() const { return eEvalDateFormat; } + + /** Set TwoDigitYearStart, how the input string scanner handles a two digit year. + Default from VCL: 1930, 30-99 19xx, 00-29 20xx + +

Historically (prior to src513e) it was a two digit number determing + until which number the string scanner recognizes a year to be 20xx, + default <= 29 is used by SFX/OfaMiscCfg. + The name Year2000 is kept although the actual functionality is now a + TwoDigitYearStart which might be in any century. + */ + void SetYear2000( USHORT nVal ); + USHORT GetYear2000() const; + static USHORT GetYear2000Default(); + + USHORT ExpandTwoDigitYear( USHORT nYear ) const; + inline static USHORT ExpandTwoDigitYear( USHORT nYear, USHORT nTwoDigitYearStart ); + + /// DEPRICATED: Return first character of the decimal separator of the current language/country + sal_Unicode GetDecSep() const { return GetNumDecimalSep().GetChar(0); } + /// Return the decimal separator of the current language/country + String GetDecimalSep() const { return GetNumDecimalSep(); } + + /// Return the decimal separator matching the locale of the given format + String GetFormatDecimalSep( sal_uInt32 nFormat ) const; + + /// Return a SvPtrArr with pointers to NfCurrencyEntry entries + static const NfCurrencyTable& GetTheCurrencyTable(); + + /** Searches, according to the default locale currency, an entry of the + CurrencyTable which is not the first (LANGUAGE_SYSTEM) entry. + @return + if not found + else pointer to NfCurrencyEntry + */ + static const NfCurrencyEntry* MatchSystemCurrency(); + + /** Return a NfCurrencyEntry matching a language/country. + If language/country is LANGUAGE_SYSTEM a MatchSystemCurrency + call is tried to get an entry. If that fails or the corresponding + language/country is not present the entry for LANGUAGE_SYSTEM is returned. + */ + static const NfCurrencyEntry& GetCurrencyEntry( LanguageType ); + + /** Return a NfCurrencyEntry pointer matching a language/country + and currency abbreviation (AKA banking symbol). + This method is meant for the configuration of the default currency. + @return + if not found + else pointer to NfCurrencyEntry + */ + static const NfCurrencyEntry* GetCurrencyEntry( const String& rAbbrev, + LanguageType eLang ); + + /** Return a NfCurrencyEntry pointer matching the symbol + combination of a LegacyOnly currency. Note that this means only that + the currency matching both symbols was once used in the Office, but is + not offered in dialogs anymore. It doesn't even mean that the currency + symbol combination is valid, since the reason for removing it may have + been just that. #i61657# + @return + A matching entry, or else . + */ + static const NfCurrencyEntry* GetLegacyOnlyCurrencyEntry( + const String& rSymbol, const String& rAbbrev ); + + /** Set the default system currency. The combination of abbreviation and + language must match an existent element of theCurrencyTable. If not, + the SYSTEM (current locale) entry becomes the default. + This method is meant for the configuration of the default currency. + */ + static void SetDefaultSystemCurrency( const String& rAbbrev, LanguageType eLang ); + + /** Get all standard formats for a specific currency, formats are + appended to the NfWSStringsDtor list. + @param bBank + : generate only format strings with currency abbreviation + : mixed format strings + @return + position of default format + */ + USHORT GetCurrencyFormatStrings( NfWSStringsDtor&, const NfCurrencyEntry&, + BOOL bBank ) const; + + /** Whether nFormat is of type NUMBERFORMAT_CURRENCY and the format code + contains a new SYMBOLTYPE_CURRENCY and if so which one [$xxx-nnn]. + If ppEntry is not NULL and exactly one entry is found, a [$xxx-nnn] is + returned, even if the format code only contains [$xxx] ! + */ + BOOL GetNewCurrencySymbolString( sal_uInt32 nFormat, String& rSymbol, + const NfCurrencyEntry** ppEntry = NULL, BOOL* pBank = NULL ) const; + + /** Look up the corresponding NfCurrencyEntry matching + rSymbol (may be CurrencySymbol or CurrencyAbbreviation) and possibly + a rExtension (being yyy of [$xxx-yyy]) or a given language/country + value. Tries to match a rSymbol with rExtension first, then with + eFormatLanguage, then rSymbol only. This is because a currency entry + might have been constructed using I18N locale data where a used locale + of a currrency format code must not necessarily match the locale of + the locale data itself, e.g. [$HK$-40C] (being "zh_HK" locale) in + zh_CN locale data. Here the rExtension would have the value 0x40c but + eFormatLanguage of the number format would have the value of zh_CN + locale, the value with which the corresponding CurrencyEntry is + constructed. + + @param bFoundBank + Only used for output. + If the return value is not this value is set to if + the matching entry was found by comparing rSymbol against the + CurrencyAbbreviation (AKA BankSymbol). + If the return value is the value of bFoundBank is undefined. + @param rSymbol + Currency symbol, preferably obtained of a format by a call to + SvNumberformat::GetNewCurrencySymbol() + @param rExtension + Currency extension, preferably obtained of a format by a call to + SvNumberformat::GetNewCurrencySymbol() + @param eFormatLanguage + The language/country value of the format of which rSymbol and + rExtension are obtained (SvNumberformat::GetLanguage()). + @param bOnlyStringLanguage + If only entries with language/country of rExtension are + checked, no match on eFormatLanguage. If rExtension is empty all + entries are checked. + @return + The matching entry if unique (in which case bFoundBank is set), + else . + */ + static const NfCurrencyEntry* GetCurrencyEntry( BOOL & bFoundBank, + const String& rSymbol, const String& rExtension, + LanguageType eFormatLanguage, BOOL bOnlyStringLanguage = FALSE ); + + /// Get compatibility ("automatic" old style) currency from I18N locale data + void GetCompatibilityCurrency( String& rSymbol, String& rAbbrev ) const; + + /// Fill rList with the language/country codes that have been allocated + void GetUsedLanguages( SvUShorts& rList ); + + /// Fill a NfKeywordIndex table with keywords of a language/country + void FillKeywordTable( NfKeywordTable& rKeywords, LanguageType eLang ); + + /** Return a keyword for a language/country and NfKeywordIndex + for XML import, to generate number format strings. */ + String GetKeyword( LanguageType eLnge, USHORT nIndex ); + + /** Return the GENERAL keyword in proper case ("General") for a + language/country, used in XML import */ + String GetStandardName( LanguageType eLnge ); + + /// Skip a NumberFormatter in stream, Chart needs this + static void SkipNumberFormatterInStream( SvStream& ); + + +private: + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager; + ::com::sun::star::lang::Locale aLocale; + SvNumberFormatTable aFTable; // Table of format keys to format entries + Table aDefaultFormatKeys; // Table of default standard to format keys + SvNumberFormatTable* pFormatTable; // For the UI dialog + SvNumberFormatterIndexTable* pMergeTable; // List of indices for merging two formatters + CharClass* pCharClass; // CharacterClassification + OnDemandLocaleDataWrapper xLocaleData; // LocaleData switched between SYSTEM, ENGLISH and other + OnDemandTransliterationWrapper xTransliteration; // Transliteration loaded on demand + OnDemandCalendarWrapper xCalendar; // Calendar loaded on demand + OnDemandNativeNumberWrapper xNatNum; // Native number service loaded on demand + ImpSvNumberInputScan* pStringScanner; // Input string scanner + ImpSvNumberformatScan* pFormatScanner; // Format code string scanner + Link aColorLink; // User defined color table CallBack + sal_uInt32 MaxCLOffset; // Max language/country offset used + sal_uInt32 nDefaultSystemCurrencyFormat; // NewCurrency matching SYSTEM locale + LanguageType IniLnge; // Initialized setting language/country + LanguageType ActLnge; // Current setting language/country + NfEvalDateFormat eEvalDateFormat; // DateFormat evaluation + BOOL bNoZero; // Zero value suppression + + // cached locale data items needed almost any time + String aDecimalSep; + String aThousandSep; + String aDateSep; + +#ifdef _ZFORLIST_CXX // ----- private Methoden ----- + + SVT_DLLPRIVATE static BOOL bCurrencyTableInitialized; + SVT_DLLPRIVATE static USHORT nSystemCurrencyPosition; + SVT_DLLPRIVATE static SvNumberFormatterRegistry_Impl* pFormatterRegistry; + + // get the registry, create one if none exists + SVT_DLLPRIVATE static SvNumberFormatterRegistry_Impl& GetFormatterRegistry(); + + // called by ctors + SVT_DLLPRIVATE void ImpConstruct( LanguageType eLang ); + + // Changes initialized language/country, clears the entries and generates + // new ones, may ONLY be called by the binary file format load + SVT_DLLPRIVATE void ImpChangeSysCL( LanguageType eLnge, BOOL bLoadingSO5 ); + + // Generate builtin formats provided by i18n behind CLOffset, + // if bLoadingSO5==FALSE also generate additional i18n formats. + SVT_DLLPRIVATE void ImpGenerateFormats( sal_uInt32 CLOffset, BOOL bLoadingSO5 ); + + // Generate additional formats provided by i18n + SVT_DLLPRIVATE void ImpGenerateAdditionalFormats( + sal_uInt32 CLOffset, + NumberFormatCodeWrapper& rNumberFormatCode, + BOOL bAfterLoadingSO5 ); + + SVT_DLLPRIVATE SvNumberformat* ImpInsertFormat( + const ::com::sun::star::i18n::NumberFormatCode& rCode, + sal_uInt32 nPos, + BOOL bAfterLoadingSO5 = FALSE, + sal_Int16 nOrgIndex = 0 ); + // ImpInsertNewStandardFormat for new (since version ...) builtin formats + SVT_DLLPRIVATE SvNumberformat* ImpInsertNewStandardFormat( + const ::com::sun::star::i18n::NumberFormatCode& rCode, + sal_uInt32 nPos, + USHORT nVersion, + BOOL bAfterLoadingSO5 = FALSE, + sal_Int16 nOrgIndex = 0 ); + + // Return CLOffset or (MaxCLOffset + SV_COUNTRY_LANGUAGE_OFFSET) if new language/country + SVT_DLLPRIVATE sal_uInt32 ImpGetCLOffset(LanguageType eLnge) const; + + // Test whether format code already exists, then return index key, + // otherwise NUMBERFORMAT_ENTRY_NOT_FOUND + SVT_DLLPRIVATE sal_uInt32 ImpIsEntry( const String& rString, + sal_uInt32 CLOffset, + LanguageType eLnge ); + + // Create builtin formats for language/country if necessary, return CLOffset + SVT_DLLPRIVATE sal_uInt32 ImpGenerateCL( LanguageType eLnge, BOOL bLoadingSO5 = FALSE ); + + // Build negative currency format, old compatibility style + SVT_DLLPRIVATE void ImpGetNegCurrFormat( String& sNegStr, const String& rCurrSymbol ); + // Build positive currency format, old compatibility style + SVT_DLLPRIVATE void ImpGetPosCurrFormat( String& sPosStr, const String& rCurrSymbol ); + + // Create theCurrencyTable with all NfCurrencyEntry + SVT_DLLPRIVATE static void ImpInitCurrencyTable(); + + // Return the format index of the currency format of the system locale. + // Format is created if not already present. + SVT_DLLPRIVATE sal_uInt32 ImpGetDefaultSystemCurrencyFormat(); + + // Return the format index of the currency format of the current locale. + // Format is created if not already present. + SVT_DLLPRIVATE sal_uInt32 ImpGetDefaultCurrencyFormat(); + + // Return the default format for a given type and current locale. + // May ONLY be called from within GetStandardFormat(). + SVT_DLLPRIVATE sal_uInt32 ImpGetDefaultFormat( short nType ); + + // Return the index in a sequence of format codes matching an enum of + // NfIndexTableOffset. If not found 0 is returned. If the sequence doesn't + // contain any format code elements a default element is created and inserted. + SVT_DLLPRIVATE sal_Int32 ImpGetFormatCodeIndex( + ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode >& rSeq, + const NfIndexTableOffset nTabOff ); + + // Adjust a sequence of format codes to contain only one (THE) default + // instead of multiple defaults for short/medium/long types. + // If there is no medium but a short and a long default the long is taken. + // Return the default index in the sequence. + // Non-PRODUCT version may check locale data for matching defaults in one + // FormatElement group. + SVT_DLLPRIVATE sal_Int32 ImpAdjustFormatCodeDefault( + ::com::sun::star::i18n::NumberFormatCode * pFormatArr, + sal_Int32 nCount, BOOL bCheckCorrectness = TRUE + ); + + // used as a loop body inside of GetNewCurrencySymbolString() and GetCurrencyEntry() +#ifndef DBG_UTIL + inline +#endif + static BOOL ImpLookupCurrencyEntryLoopBody( + const NfCurrencyEntry*& pFoundEntry, BOOL& bFoundBank, + const NfCurrencyEntry* pData, USHORT nPos, const String& rSymbol ); + + // link to be set at SvtSysLocaleOptions::SetCurrencyChangeLink() + DECL_DLLPRIVATE_STATIC_LINK( SvNumberFormatter, CurrencyChangeLink, void* ); + +#endif // _ZFORLIST_CXX + +public: + + // own static mutex, may also be used by internal class SvNumberFormatterRegistry_Impl + static ::osl::Mutex& GetMutex(); + + // called by SvNumberFormatterRegistry_Impl::Notify if the default system currency changes + void ResetDefaultSystemCurrency(); + + // Replace the SYSTEM language/country format codes. Called upon change of + // the user configurable locale. + // Old compatibility codes are replaced, user defined are converted, and + // new format codes are appended. + void ReplaceSystemCL( LanguageType eOldLanguage ); + + inline ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XMultiServiceFactory > + GetServiceManager() const { return xServiceManager; } + + + + //! The following method is not to be used from outside but must be + //! public for the InputScanner. + // return the current FormatScanner + inline const ImpSvNumberformatScan* GetFormatScanner() const { return pFormatScanner; } + + + + //! The following methods are not to be used from outside but must be + //! public for the InputScanner and FormatScanner. + + // return current (!) Locale + inline const ::com::sun::star::lang::Locale& GetLocale() const { return aLocale; } + + // return corresponding Transliteration wrapper + inline const ::utl::TransliterationWrapper* GetTransliteration() const + { return xTransliteration.get(); } + + // return corresponding Transliteration wrapper with loadModuleByImplName() + inline const ::utl::TransliterationWrapper* GetTransliterationForModule( + const String& rModule, LanguageType eLang ) const + { return xTransliteration.getForModule( rModule, eLang ); } + + // return the corresponding CharacterClassification wrapper + inline const CharClass* GetCharClass() const { return pCharClass; } + + // return the corresponding LocaleData wrapper + inline const LocaleDataWrapper* GetLocaleData() const { return xLocaleData.get(); } + + // return the corresponding Calendar wrapper + inline CalendarWrapper* GetCalendar() const { return xCalendar.get(); } + + // return the corresponding NativeNumberSupplier wrapper + inline const NativeNumberWrapper* GetNatNum() const { return xNatNum.get(); } + + // cached locale data items + + // return the corresponding decimal separator + inline const String& GetNumDecimalSep() const { return aDecimalSep; } + + // return the corresponding group (AKA thousand) separator + inline const String& GetNumThousandSep() const { return aThousandSep; } + + // return the corresponding date separator + inline const String& GetDateSep() const { return aDateSep; } + +}; + + +// --------------------------- inline -------------------------------------- + +inline sal_uInt32 SvNumberFormatter::GetMergeFmtIndex( sal_uInt32 nOldFmt ) const +{ + sal_uInt32* pU = (pMergeTable && pMergeTable->Count()) ? (sal_uInt32*)pMergeTable->Get( nOldFmt ) : 0; + return pU ? *pU : nOldFmt; +} + +inline BOOL SvNumberFormatter::HasMergeFmtTbl() const +{ + return pMergeTable && (0 != pMergeTable->Count()); +} + + +// static +inline USHORT SvNumberFormatter::ExpandTwoDigitYear( + USHORT nYear, USHORT nTwoDigitYearStart ) +{ + if ( nYear < 100 ) + { + if ( nYear < (nTwoDigitYearStart % 100) ) + return nYear + (((nTwoDigitYearStart / 100) + 1) * 100); + else + return nYear + ((nTwoDigitYearStart / 100) * 100); + } + return nYear; +} + + + +#endif // _ZFORLIST_HXX diff --git a/svl/inc/svl/zformat.hxx b/svl/inc/svl/zformat.hxx new file mode 100644 index 000000000000..ae7d961c0bc6 --- /dev/null +++ b/svl/inc/svl/zformat.hxx @@ -0,0 +1,589 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: zformat.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _ZFORMAT_HXX +#define _ZFORMAT_HXX + +#include "svtools/svtdllapi.h" +#include +#include +#include +#include +#include + +// We need ImpSvNumberformatScan for the private SvNumberformat definitions. +#ifdef _ZFORMAT_CXX +#include "zforscan.hxx" +#endif + +// If comment field is also in format code string, was used for SUPD versions 371-372 +#define NF_COMMENT_IN_FORMATSTRING 0 + +namespace utl { + class DigitGroupingIterator; +} + +class SvStream; +class Color; + +class ImpSvNumberformatScan; // format code string scanner +class ImpSvNumberInputScan; // input string scanner +class ImpSvNumMultipleWriteHeader; // compatible file format +class ImpSvNumMultipleReadHeader; // compatible file format +class SvNumberFormatter; + +enum SvNumberformatLimitOps +{ + NUMBERFORMAT_OP_NO = 0, // Undefined, no OP + NUMBERFORMAT_OP_EQ = 1, // Operator = + NUMBERFORMAT_OP_NE = 2, // Operator <> + NUMBERFORMAT_OP_LT = 3, // Operator < + NUMBERFORMAT_OP_LE = 4, // Operator <= + NUMBERFORMAT_OP_GT = 5, // Operator > + NUMBERFORMAT_OP_GE = 6 // Operator >= +}; + +// SYSTEM-german to SYSTEM-xxx and vice versa conversion hack onLoad +enum NfHackConversion +{ + NF_CONVERT_NONE, + NF_CONVERT_GERMAN_ENGLISH, + NF_CONVERT_ENGLISH_GERMAN +}; + +struct ImpSvNumberformatInfo // Struct for FormatInfo +{ + String* sStrArray; // Array of symbols + short* nTypeArray; // Array of infos + USHORT nThousand; // Count of group separator sequences + USHORT nCntPre; // Count of digits before decimal point + USHORT nCntPost; // Count of digits after decimal point + USHORT nCntExp; // Count of exponent digits, or AM/PM + short eScannedType; // Type determined by scan + BOOL bThousand; // Has group (AKA thousand) separator + + void Copy( const ImpSvNumberformatInfo& rNumFor, USHORT nAnz ); + void Load(SvStream& rStream, USHORT nAnz); + void Save(SvStream& rStream, USHORT nAnz) const; +}; + +// NativeNumber, represent numbers using CJK or other digits if nNum>0, +// eLang specifies the Locale to use. +class SvNumberNatNum +{ + LanguageType eLang; + BYTE nNum; + BOOL bDBNum :1; // DBNum, to be converted to NatNum + BOOL bDate :1; // Used in date? (needed for DBNum/NatNum mapping) + BOOL bSet :1; // If set, since NatNum0 is possible + +public: + + static BYTE MapDBNumToNatNum( BYTE nDBNum, LanguageType eLang, BOOL bDate ); + static BYTE MapNatNumToDBNum( BYTE nNatNum, LanguageType eLang, BOOL bDate ); + + SvNumberNatNum() : eLang( LANGUAGE_DONTKNOW ), nNum(0), + bDBNum(0), bDate(0), bSet(0) {} + BOOL IsComplete() const { return bSet && eLang != LANGUAGE_DONTKNOW; } + BYTE GetRawNum() const { return nNum; } + BYTE GetNatNum() const { return bDBNum ? MapDBNumToNatNum( nNum, eLang, bDate ) : nNum; } + BYTE GetDBNum() const { return bDBNum ? nNum : MapNatNumToDBNum( nNum, eLang, bDate ); } + LanguageType GetLang() const { return eLang; } + void SetLang( LanguageType e ) { eLang = e; } + void SetNum( BYTE nNumber, BOOL bDBNumber ) + { + nNum = nNumber; + bDBNum = bDBNumber; + bSet = TRUE; + } + BOOL IsSet() const { return bSet; } + void SetDate( BOOL bDateP ) { bDate = (bDateP != 0); } +}; + +class CharClass; + +class ImpSvNumFor // One of four subformats of the format code string +{ +public: + ImpSvNumFor(); // Ctor without filling the Info + ~ImpSvNumFor(); + + void Enlarge(USHORT nAnz); // Init of arrays to the right size + void Load( SvStream& rStream, ImpSvNumberformatScan& rSc, + String& rLoadedColorName); + void Save( SvStream& rStream ) const; + + // if pSc is set, it is used to get the Color pointer + void Copy( const ImpSvNumFor& rNumFor, ImpSvNumberformatScan* pSc ); + + // Access to Info; call Enlarge before! + ImpSvNumberformatInfo& Info() { return aI;} + const ImpSvNumberformatInfo& Info() const { return aI; } + + // Get count of substrings (symbols) + USHORT GetnAnz() const { return nAnzStrings;} + + Color* GetColor() const { return pColor; } + void SetColor( Color* pCol, String& rName ) + { pColor = pCol; sColorName = rName; } + const String& GetColorName() const { return sColorName; } + + // new SYMBOLTYPE_CURRENCY in subformat? + BOOL HasNewCurrency() const; + BOOL GetNewCurrencySymbol( String& rSymbol, String& rExtension ) const; + void SaveNewCurrencyMap( SvStream& rStream ) const; + void LoadNewCurrencyMap( SvStream& rStream ); + + // [NatNum1], [NatNum2], ... + void SetNatNumNum( BYTE nNum, BOOL bDBNum ) { aNatNum.SetNum( nNum, bDBNum ); } + void SetNatNumLang( LanguageType eLang ) { aNatNum.SetLang( eLang ); } + void SetNatNumDate( BOOL bDate ) { aNatNum.SetDate( bDate ); } + const SvNumberNatNum& GetNatNum() const { return aNatNum; } + +private: + ImpSvNumberformatInfo aI; // Hilfsstruct fuer die restlichen Infos + String sColorName; // color name + Color* pColor; // pointer to color of subformat + USHORT nAnzStrings; // count of symbols + SvNumberNatNum aNatNum; // DoubleByteNumber + +}; + +class SVT_DLLPUBLIC SvNumberformat +{ +public: + // Ctor for Load + SvNumberformat( ImpSvNumberformatScan& rSc, LanguageType eLge ); + + // Normal ctor + SvNumberformat( String& rString, + ImpSvNumberformatScan* pSc, + ImpSvNumberInputScan* pISc, + xub_StrLen& nCheckPos, + LanguageType& eLan, + BOOL bStand = FALSE ); + + // Copy ctor + SvNumberformat( SvNumberformat& rFormat ); + + // Copy ctor with exchange of format code string scanner (used in merge) + SvNumberformat( SvNumberformat& rFormat, ImpSvNumberformatScan& rSc ); + + ~SvNumberformat(); + + /// Get type of format, may include NUMBERFORMAT_DEFINED bit + short GetType() const + { return (nNewStandardDefined && + (nNewStandardDefined <= SV_NUMBERFORMATTER_VERSION)) ? + (eType & ~NUMBERFORMAT_DEFINED) : eType; } + + void SetType(const short eSetType) { eType = eSetType; } + // Standard means the I18N defined standard format of this type + void SetStandard() { bStandard = TRUE; } + BOOL IsStandard() const { return bStandard; } + + // For versions before version nVer it is UserDefined, for newer versions + // it is builtin. nVer of SV_NUMBERFORMATTER_VERSION_... + void SetNewStandardDefined( USHORT nVer ) + { nNewStandardDefined = nVer; eType |= NUMBERFORMAT_DEFINED; } + + USHORT GetNewStandardDefined() const { return nNewStandardDefined; } + BOOL IsAdditionalStandardDefined() const + { return nNewStandardDefined == SV_NUMBERFORMATTER_VERSION_ADDITIONAL_I18N_FORMATS; } + + LanguageType GetLanguage() const { return eLnge;} + + const String& GetFormatstring() const { return sFormatstring; } + + // Build a format string of application defined keywords + String GetMappedFormatstring( const NfKeywordTable& rKeywords, + const LocaleDataWrapper& rLoc, + BOOL bDontQuote = FALSE ) const; + + void SetUsed(const BOOL b) { bIsUsed = b; } + BOOL GetUsed() const { return bIsUsed; } + BOOL IsStarFormatSupported() const { return bStarFlag; } + void SetStarFormatSupport( BOOL b ) { bStarFlag = b; } + + NfHackConversion Load( SvStream& rStream, ImpSvNumMultipleReadHeader& rHdr, + SvNumberFormatter* pConverter, ImpSvNumberInputScan& rISc ); + void Save( SvStream& rStream, ImpSvNumMultipleWriteHeader& rHdr ) const; + + // Load a string which might contain an Euro symbol, + // in fact that could be any string used in number formats. + static void LoadString( SvStream& rStream, String& rStr ); + + BOOL GetOutputString( double fNumber, String& OutString, Color** ppColor ); + BOOL GetOutputString( String& sString, String& OutString, Color** ppColor ); + + // True if type text + BOOL IsTextFormat() const { return (eType & NUMBERFORMAT_TEXT) != 0; } + // True if 4th subformat present + BOOL HasTextFormat() const + { + return (NumFor[3].GetnAnz() > 0) || + (NumFor[3].Info().eScannedType == NUMBERFORMAT_TEXT); + } + + void GetFormatSpecialInfo(BOOL& bThousand, + BOOL& IsRed, + USHORT& nPrecision, + USHORT& nAnzLeading) const; + + /// Count of decimal precision + USHORT GetFormatPrecision() const { return NumFor[0].Info().nCntPost; } + + //! Read/write access on a special USHORT component, may only be used on the + //! standard format 0, 5000, ... and only by the number formatter! + USHORT GetLastInsertKey() const + { return NumFor[0].Info().nThousand; } + void SetLastInsertKey(USHORT nKey) + { NumFor[0].Info().nThousand = nKey; } + + //! Only onLoad: convert from stored to current system language/country + void ConvertLanguage( SvNumberFormatter& rConverter, + LanguageType eConvertFrom, LanguageType eConvertTo, BOOL bSystem = FALSE ); + + // Substring of a subformat code nNumFor (0..3) + // nPos == 0xFFFF => last substring + // bString==TRUE: first/last SYMBOLTYPE_STRING or SYMBOLTYPE_CURRENCY + const String* GetNumForString( USHORT nNumFor, USHORT nPos, + BOOL bString = FALSE ) const; + + // Subtype of a subformat code nNumFor (0..3) + // nPos == 0xFFFF => last substring + // bString==TRUE: first/last SYMBOLTYPE_STRING or SYMBOLTYPE_CURRENCY + short GetNumForType( USHORT nNumFor, USHORT nPos, BOOL bString = FALSE ) const; + + /** If the count of string elements (substrings, ignoring [modifiers] and + so on) in a subformat code nNumFor (0..3) is equal to the given number. + Used by ImpSvNumberInputScan::IsNumberFormatMain() to detect a matched + format. */ + BOOL IsNumForStringElementCountEqual( USHORT nNumFor, USHORT nAllCount, + USHORT nNumCount ) const + { + if ( nNumFor < 4 ) + { + // First try a simple approach. Note that this is called only + // if all MidStrings did match so far, to verify that all + // strings of the format were matched and not just the starting + // sequence, so we don't have to check if GetnAnz() includes + // [modifiers] or anything else if both counts are equal. + USHORT nCnt = NumFor[nNumFor].GetnAnz(); + if ( nAllCount == nCnt ) + return TRUE; + if ( nAllCount < nCnt ) // check ignoring [modifiers] and so on + return ImpGetNumForStringElementCount( nNumFor ) == + (nAllCount - nNumCount); + } + return FALSE; + } + + // Whether the second subformat code is really for negative numbers + // or another limit set. + BOOL IsNegativeRealNegative() const + { + return fLimit1 == 0.0 && fLimit2 == 0.0 && + ( (eOp1 == NUMBERFORMAT_OP_GE && eOp2 == NUMBERFORMAT_OP_NO) || + (eOp1 == NUMBERFORMAT_OP_GT && eOp2 == NUMBERFORMAT_OP_LT) || + (eOp1 == NUMBERFORMAT_OP_NO && eOp2 == NUMBERFORMAT_OP_NO) ); + } + + // Whether the negative format is without a sign or not + BOOL IsNegativeWithoutSign() const; + + // Whether a new SYMBOLTYPE_CURRENCY is contained in the format + BOOL HasNewCurrency() const; + + // Build string from NewCurrency for saving it SO50 compatible + void Build50Formatstring( String& rStr ) const; + + // strip [$-yyy] from all [$xxx-yyy] leaving only xxx's, + // if bQuoteSymbol==TRUE the xxx will become "xxx" + static String StripNewCurrencyDelimiters( const String& rStr, + BOOL bQuoteSymbol ); + + // If a new SYMBOLTYPE_CURRENCY is contained if the format is of type + // NUMBERFORMAT_CURRENCY, and if so the symbol xxx and the extension nnn + // of [$xxx-nnn] are returned + BOOL GetNewCurrencySymbol( String& rSymbol, String& rExtension ) const; + + static BOOL HasStringNegativeSign( const String& rStr ); + + /** + Whether a character at position nPos is somewhere between two matching + cQuote or not. + If nPos points to a cQuote, a TRUE is returned on an opening cQuote, + a FALSE is returned on a closing cQuote. + A cQuote between quotes may be escaped by a cEscIn, a cQuote outside of + quotes may be escaped by a cEscOut. + The default '\0' results in no escapement possible. + Defaults are set right according to the "unlogic" of the Numberformatter + */ + static BOOL IsInQuote( const String& rString, xub_StrLen nPos, + sal_Unicode cQuote = '"', + sal_Unicode cEscIn = '\0', sal_Unicode cEscOut = '\\' ); + + /** + Return the position of a matching closing cQuote if the character at + position nPos is between two matching cQuote, otherwise return + STRING_NOTFOUND. + If nPos points to an opening cQuote the position of the matching + closing cQuote is returned. + If nPos points to a closing cQuote nPos is returned. + If nPos points into a part which starts with an opening cQuote but has + no closing cQuote, rString.Len() is returned. + Uses IsInQuote internally, so you don't have to call + that prior to a call of this method. + */ + static xub_StrLen GetQuoteEnd( const String& rString, xub_StrLen nPos, + sal_Unicode cQuote = '"', + sal_Unicode cEscIn = '\0', sal_Unicode cEscOut = '\\' ); + + void SetComment( const String& rStr ) +#if NF_COMMENT_IN_FORMATSTRING + { SetComment( rStr, sFormatstring, sComment ); } +#else + { sComment = rStr; } +#endif + const String& GetComment() const { return sComment; } + + // Erase "{ "..." }" from format subcode string to get the pure comment (old version) + static void EraseCommentBraces( String& rStr ); + // Set comment rStr in format string rFormat and in rComment (old version) + static void SetComment( const String& rStr, String& rFormat, String& rComment ); + // Erase comment at end of rStr to get pure format code string (old version) + static void EraseComment( String& rStr ); + + /** Insert the number of blanks into the string that is needed to simulate + the width of character c for underscore formats */ + static xub_StrLen InsertBlanks( String& r, xub_StrLen nPos, sal_Unicode c ); + + /// One of YMD,DMY,MDY if date format + DateFormat GetDateOrder() const; + + /** A coded value of the exact YMD combination used, if date format. + For example: YYYY-MM-DD => ('Y' << 16) | ('M' << 8) | 'D' + or: MM/YY => ('M' << 8) | 'Y' */ + sal_uInt32 GetExactDateOrder() const; + + ImpSvNumberformatScan& ImpGetScan() const { return rScan; } + + // used in XML export + void GetConditions( SvNumberformatLimitOps& rOper1, double& rVal1, + SvNumberformatLimitOps& rOper2, double& rVal2 ) const; + Color* GetColor( USHORT nNumFor ) const; + void GetNumForInfo( USHORT nNumFor, short& rScannedType, + BOOL& bThousand, USHORT& nPrecision, USHORT& nAnzLeading ) const; + + // rAttr.Number not empty if NatNum attributes are to be stored + void GetNatNumXml( + ::com::sun::star::i18n::NativeNumberXmlAttributes& rAttr, + USHORT nNumFor ) const; + + /** @returns if E,EE,R,RR,AAA,AAAA in format code of subformat + nNumFor (0..3) and no preceding calendar was specified and the + currently loaded calendar is "gregorian". */ + BOOL IsOtherCalendar( USHORT nNumFor ) const + { + if ( nNumFor < 4 ) + return ImpIsOtherCalendar( NumFor[nNumFor] ); + return FALSE; + } + + /** Switches to the first non-"gregorian" calendar, but only if the current + calendar is "gregorian"; original calendar name and date/time returned, + but only if calendar switched and rOrgCalendar was empty. */ + void SwitchToOtherCalendar( String& rOrgCalendar, double& fOrgDateTime ) const; + + /** Switches to the "gregorian" calendar, but only if the current calendar + is non-"gregorian" and rOrgCalendar is not empty. Thus a preceding + ImpSwitchToOtherCalendar() call should have been placed prior to + calling this method. */ + void SwitchToGregorianCalendar( const String& rOrgCalendar, double fOrgDateTime ) const; + + /** Switches to the first specified calendar, if any, in subformat nNumFor + (0..3). Original calendar name and date/time returned, but only if + calendar switched and rOrgCalendar was empty. + + @return + if a calendar was specified and switched to, + else. + */ + BOOL SwitchToSpecifiedCalendar( String& rOrgCalendar, double& fOrgDateTime, + USHORT nNumFor ) const + { + if ( nNumFor < 4 ) + return ImpSwitchToSpecifiedCalendar( rOrgCalendar, + fOrgDateTime, NumFor[nNumFor] ); + return FALSE; + } + +private: + ImpSvNumFor NumFor[4]; // Array for the 4 subformats + String sFormatstring; // The format code string + String sComment; // Comment, since number formatter version 6 + double fLimit1; // Value for first condition + double fLimit2; // Value for second condition + ImpSvNumberformatScan& rScan; // Format code scanner + LanguageType eLnge; // Language/country of the format + SvNumberformatLimitOps eOp1; // Operator for first condition + SvNumberformatLimitOps eOp2; // Operator for second condition + USHORT nNewStandardDefined; // new builtin formats as of version 6 + short eType; // Type of format + BOOL bStarFlag; // Take *n format as ESC n + BOOL bStandard; // If this is a default standard format + BOOL bIsUsed; // Flag as used for storing + + SVT_DLLPRIVATE USHORT ImpGetNumForStringElementCount( USHORT nNumFor ) const; + + SVT_DLLPRIVATE BOOL ImpIsOtherCalendar( const ImpSvNumFor& rNumFor ) const; + + SVT_DLLPRIVATE BOOL ImpSwitchToSpecifiedCalendar( String& rOrgCalendar, + double& fOrgDateTime, const ImpSvNumFor& rNumFor ) const; + +#ifdef _ZFORMAT_CXX // ----- private implementation methods ----- + + const CharClass& rChrCls() const { return rScan.GetChrCls(); } + const LocaleDataWrapper& rLoc() const { return rScan.GetLoc(); } + CalendarWrapper& GetCal() const { return rScan.GetCal(); } + const SvNumberFormatter& GetFormatter() const { return *rScan.GetNumberformatter(); } + + // divide in substrings and color conditions + SVT_DLLPRIVATE short ImpNextSymbol( String& rString, + xub_StrLen& nPos, + String& sSymbol ); + + // read string until ']' and strip blanks (after condition) + SVT_DLLPRIVATE static xub_StrLen ImpGetNumber( String& rString, + xub_StrLen& nPos, + String& sSymbol ); + + // get xxx of "[$-xxx]" as LanguageType, starting at and advancing position nPos + SVT_DLLPRIVATE static LanguageType ImpGetLanguageType( const String& rString, xub_StrLen& nPos ); + + // standard number output + SVT_DLLPRIVATE void ImpGetOutputStandard( double& fNumber, String& OutString ); + // numbers in input line + SVT_DLLPRIVATE void ImpGetOutputInputLine( double fNumber, String& OutString ); + + // check subcondition + // OP undefined => -1 + // else 0 or 1 + SVT_DLLPRIVATE short ImpCheckCondition(double& fNumber, + double& fLimit, + SvNumberformatLimitOps eOp); + + SVT_DLLPRIVATE ULONG ImpGGT(ULONG x, ULONG y); + SVT_DLLPRIVATE ULONG ImpGGTRound(ULONG x, ULONG y); + + // Helper function for number strings + // append string symbols, insert leading 0 or ' ', or ... + SVT_DLLPRIVATE BOOL ImpNumberFill( String& sStr, + double& rNumber, + xub_StrLen& k, + USHORT& j, + USHORT nIx, + short eSymbolType ); + + // Helper function to fill in the integer part and the group (AKA thousand) separators + SVT_DLLPRIVATE BOOL ImpNumberFillWithThousands( String& sStr, + double& rNumber, + xub_StrLen k, + USHORT j, + USHORT nIx, + USHORT nDigCnt ); + // Hilfsfunktion zum Auffuellen der Vor- + // kommazahl auch mit Tausenderpunkt + + // Helper function to fill in the group (AKA thousand) separators + // or to skip additional digits + SVT_DLLPRIVATE void ImpDigitFill( String& sStr, + xub_StrLen nStart, + xub_StrLen& k, + USHORT nIx, + xub_StrLen & nDigitCount, + utl::DigitGroupingIterator & ); + + SVT_DLLPRIVATE BOOL ImpGetDateOutput( double fNumber, + USHORT nIx, + String& OutString ); + SVT_DLLPRIVATE BOOL ImpGetTimeOutput( double fNumber, + USHORT nIx, + String& OutString ); + SVT_DLLPRIVATE BOOL ImpGetDateTimeOutput( double fNumber, + USHORT nIx, + String& OutString ); + + // Switches to the "gregorian" calendar if the current calendar is + // non-"gregorian" and the era is a "Dummy" era of a calendar which doesn't + // know a "before" era (like zh_TW ROC or ja_JP Gengou). If switched and + // rOrgCalendar was "gregorian" the string is emptied. If rOrgCalendar was + // empty the previous calendar name and date/time are returned. + SVT_DLLPRIVATE BOOL ImpFallBackToGregorianCalendar( String& rOrgCalendar, double& fOrgDateTime ); + + // Append a "G" short era string of the given calendar. In the case of a + // Gengou calendar this is a one character abbreviation, for other + // calendars the XExtendedCalendar::getDisplayString() method is called. + SVT_DLLPRIVATE static void ImpAppendEraG( String& OutString, const CalendarWrapper& rCal, + sal_Int16 nNatNum ); + + SVT_DLLPRIVATE BOOL ImpGetNumberOutput( double fNumber, + USHORT nIx, + String& OutString ); + + SVT_DLLPRIVATE void ImpCopyNumberformat( const SvNumberformat& rFormat ); + + // normal digits or other digits, depending on ImpSvNumFor.aNatNum, + // [NatNum1], [NatNum2], ... + SVT_DLLPRIVATE String ImpGetNatNumString( const SvNumberNatNum& rNum, sal_Int32 nVal, + USHORT nMinDigits = 0 ) const; + + String ImpIntToString( USHORT nIx, sal_Int32 nVal, USHORT nMinDigits = 0 ) const + { + const SvNumberNatNum& rNum = NumFor[nIx].GetNatNum(); + if ( nMinDigits || rNum.IsComplete() ) + return ImpGetNatNumString( rNum, nVal, nMinDigits ); + return String::CreateFromInt32( nVal ); + } + + // transliterate according to NativeNumber + SVT_DLLPRIVATE void ImpTransliterateImpl( String& rStr, const SvNumberNatNum& rNum ) const; + + void ImpTransliterate( String& rStr, const SvNumberNatNum& rNum ) const + { + if ( rNum.IsComplete() ) + ImpTransliterateImpl( rStr, rNum ); + } + +#endif // _ZFORMAT_CXX + +}; + +#endif // _ZFORMAT_HXX diff --git a/svl/inc/urihelper.hxx b/svl/inc/urihelper.hxx new file mode 100644 index 000000000000..209f3f04e28a --- /dev/null +++ b/svl/inc/urihelper.hxx @@ -0,0 +1,238 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: urihelper.hxx,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVTOOLS_URIHELPER_HXX +#define SVTOOLS_URIHELPER_HXX + +#include "svtools/svtdllapi.h" +#include "com/sun/star/uno/Reference.hxx" +#include +#include +#include +#include +#include + +namespace com { namespace sun { namespace star { + namespace uno { class XComponentContext; } + namespace uri { class XUriReference; } +} } } +namespace rtl { class OUString; } +class ByteString; +class CharClass; +class UniString; + +//============================================================================ +namespace URIHelper { + +/** + @ATT + Calling this function with defaulted arguments rMaybeFileHdl = Link() and + bCheckFileExists = true often leads to results that are not intended: + Whenever the given rTheBaseURIRef is a file URL, the given rTheRelURIRef is + relative, and rTheRelURIRef could also be smart-parsed as a non-file URL + (e.g., the relative URL "foo/bar" can be smart-parsed as "http://foo/bar"), + then SmartRel2Abs called with rMaybeFileHdl = Link() and bCheckFileExists = + true returns the non-file URL interpretation. To avoid this, either pass + some non-null rMaybeFileHdl if you want to check generated file URLs for + existence (see URIHelper::GetMaybeFileHdl), or use bCheckFileExists = false + if you want to generate file URLs without checking for their existence. +*/ +SVT_DLLPUBLIC UniString +SmartRel2Abs(INetURLObject const & rTheBaseURIRef, + ByteString const & rTheRelURIRef, + Link const & rMaybeFileHdl = Link(), + bool bCheckFileExists = true, + bool bIgnoreFragment = false, + INetURLObject::EncodeMechanism eEncodeMechanism + = INetURLObject::WAS_ENCODED, + INetURLObject::DecodeMechanism eDecodeMechanism + = INetURLObject::DECODE_TO_IURI, + rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8, + bool bRelativeNonURIs = false, + INetURLObject::FSysStyle eStyle = INetURLObject::FSYS_DETECT); + +/** + @ATT + Calling this function with defaulted arguments rMaybeFileHdl = Link() and + bCheckFileExists = true often leads to results that are not intended: + Whenever the given rTheBaseURIRef is a file URL, the given rTheRelURIRef is + relative, and rTheRelURIRef could also be smart-parsed as a non-file URL + (e.g., the relative URL "foo/bar" can be smart-parsed as "http://foo/bar"), + then SmartRel2Abs called with rMaybeFileHdl = Link() and bCheckFileExists = + true returns the non-file URL interpretation. To avoid this, either pass + some non-null rMaybeFileHdl if you want to check generated file URLs for + existence (see URIHelper::GetMaybeFileHdl), or use bCheckFileExists = false + if you want to generate file URLs without checking for their existence. +*/ +SVT_DLLPUBLIC UniString +SmartRel2Abs(INetURLObject const & rTheBaseURIRef, + UniString const & rTheRelURIRef, + Link const & rMaybeFileHdl = Link(), + bool bCheckFileExists = true, + bool bIgnoreFragment = false, + INetURLObject::EncodeMechanism eEncodeMechanism + = INetURLObject::WAS_ENCODED, + INetURLObject::DecodeMechanism eDecodeMechanism + = INetURLObject::DECODE_TO_IURI, + rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8, + bool bRelativeNonURIs = false, + INetURLObject::FSysStyle eStyle = INetURLObject::FSYS_DETECT); + +//============================================================================ +SVT_DLLPUBLIC void SetMaybeFileHdl(Link const & rTheMaybeFileHdl); + +//============================================================================ +SVT_DLLPUBLIC Link GetMaybeFileHdl(); + +/** + Converts a URI reference to a relative one, ignoring certain differences (for + example, treating file URLs for case-ignoring file systems + case-insensitively). + + @param context a component context; must not be null + + @param baseUriReference a base URI reference + + @param uriReference a URI reference + + @return a URI reference representing the given uriReference relative to the + given baseUriReference; if the given baseUriReference is not an absolute, + hierarchical URI reference, or the given uriReference is not a valid URI + reference, null is returned + + @exception std::bad_alloc if an out-of-memory condition occurs + + @exception com::sun::star::uno::RuntimeException if any error occurs + */ +SVT_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::uri::XUriReference > +normalizedMakeRelative( + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > + const & context, + rtl::OUString const & baseUriReference, rtl::OUString const & uriReference); + +/** + A variant of normalizedMakeRelative with a simplified interface. + + Internally calls normalizedMakeRelative with the default component context. + + @param baseUriReference a base URI reference, passed to + normalizedMakeRelative + + @param uriReference a URI reference, passed to normalizedMakeRelative + + @return if the XUriReference returnd by normalizedMakeRelative is empty, + uriReference is returned unmodified; otherwise, the result of calling + XUriReference::getUriReference on the XUriReference returnd by + normalizedMakeRelative is returned + + @exception std::bad_alloc if an out-of-memory condition occurs + + @exception com::sun::star::uno::RuntimeException if any error occurs + + @deprecated + No code should rely on the default component context. +*/ +SVT_DLLPUBLIC rtl::OUString simpleNormalizedMakeRelative( + rtl::OUString const & baseUriReference, rtl::OUString const & uriReference); + +//============================================================================ +SVT_DLLPUBLIC UniString +FindFirstURLInText(UniString const & rText, + xub_StrLen & rBegin, + xub_StrLen & rEnd, + CharClass const & rCharClass, + INetURLObject::EncodeMechanism eMechanism + = INetURLObject::WAS_ENCODED, + rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8, + INetURLObject::FSysStyle eStyle + = INetURLObject::FSYS_DETECT); + +//============================================================================ +/** Remove any password component from both absolute and relative URLs. + + @ATT The current implementation will not remove a password from a + relative URL that has an authority component (e.g., the password is not + removed from the relative ftp URL ). But + since our functions to translate between absolute and relative URLs never + produce relative URLs with authority components, this is no real problem. + + @ATT For relative URLs (or anything not recognized as an absolute URI), + the current implementation will return the input unmodified, not applying + any translations implied by the encode/decode parameters. + + @param rURI An absolute or relative URI reference. + + @param eEncodeMechanism See the general discussion for INetURLObject set- + methods. + + @param eDecodeMechanism See the general discussion for INetURLObject get- + methods. + + @param eCharset See the general discussion for INetURLObject get- and + set-methods. + + @return The input URI with any password component removed. + */ +SVT_DLLPUBLIC UniString +removePassword(UniString const & rURI, + INetURLObject::EncodeMechanism eEncodeMechanism + = INetURLObject::WAS_ENCODED, + INetURLObject::DecodeMechanism eDecodeMechanism + = INetURLObject::DECODE_TO_IURI, + rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); + +//============================================================================ +/** Query the notational conventions used in the file system provided by some + file content provider. + + @param rFileUrl This file URL determines which file content provider is + used to query the desired information. (The UCB's usual mapping from URLs + to content providers is used.) + + @param bAddConvenienceStyles If true, the return value contains not only + the style bit corresponding to the queried content provider's conventions, + but may also contain additional style bits that make using this function + more convenient in certain situations. Currently, the effect is that + FSYS_UNX is extended with FSYS_VOS, and both FSYS_DOS and FSYS_MAC are + extended with FSYS_VOS and FSYS_UNX (i.e., the---unambiguous---detection + of VOS style and Unix style file system paths is always enabled); also, in + case the content provider's conventions cannot be determined, FSYS_DETECT + is returned instead of FSysStyle(0). + + @return The style bit corresponding to the queried content provider's + conventions, or FSysStyle(0) if these cannot be determined. + */ +SVT_DLLPUBLIC INetURLObject::FSysStyle queryFSysStyle(UniString const & rFileUrl, + bool bAddConvenienceStyles = true) + throw (com::sun::star::uno::RuntimeException); + +} + +#endif // SVTOOLS_URIHELPER_HXX diff --git a/svl/inc/urlbmk.hxx b/svl/inc/urlbmk.hxx new file mode 100644 index 000000000000..d3342b398878 --- /dev/null +++ b/svl/inc/urlbmk.hxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: urlbmk.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _URLBMK_HXX +#define _URLBMK_HXX + + +#include + +//========================================================================= + +class INetBookmark + +/* [Beschreibung] + + Diese Klasse stellt ein Bookmark dar, welches aus einer URL und + einem dazuge"horigen Beschreibungstext besteht. + + Es gibt ein eigenes Clipboardformat und Hilfsmethoden zum Kopieren + und Einf"ugen in und aus Clipboard und DragServer. +*/ + +{ + String aUrl; + String aDescr; + +protected: + + void SetURL( const String& rS ) { aUrl = rS; } + void SetDescription( const String& rS ) { aDescr = rS; } + +public: + INetBookmark( const String &rUrl, const String &rDescr ) + : aUrl( rUrl ), aDescr( rDescr ) + {} + INetBookmark() + {} + + const String& GetURL() const { return aUrl; } + const String& GetDescription() const { return aDescr; } +}; + + +#endif + diff --git a/svl/inc/whiter.hxx b/svl/inc/whiter.hxx new file mode 100644 index 000000000000..87ed2cbc76f0 --- /dev/null +++ b/svl/inc/whiter.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: whiter.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFX_WHITER_HXX +#define _SFX_WHITER_HXX + +#include "svtools/svldllapi.h" + +#ifndef INCLUDED_LIMITS_H +#include +#define INCLUDED_LIMITS_H +#endif +#include + +class SfxItemSet; + + +// INCLUDE --------------------------------------------------------------- + +class SVL_DLLPUBLIC SfxWhichIter +{ + const USHORT *pRanges, *pStart; + USHORT nOfst, nFrom, nTo; + +public: + SfxWhichIter( const SfxItemSet& rSet, USHORT nFrom = 0, USHORT nTo = USHRT_MAX ); + ~SfxWhichIter(); + + USHORT GetCurWhich() const { return *pRanges + nOfst; } + USHORT NextWhich(); + USHORT PrevWhich(); + + USHORT FirstWhich(); + USHORT LastWhich(); +}; + +#endif diff --git a/svl/inc/xmlement.hxx b/svl/inc/xmlement.hxx new file mode 100644 index 000000000000..ed0e4dafc57a --- /dev/null +++ b/svl/inc/xmlement.hxx @@ -0,0 +1,46 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: xmlement.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVTOOLS_XMLEMENT_HXX +#define _SVTOOLS_XMLEMENT_HXX + +#ifndef _SAL_TYPES_H +#include +#endif + +struct SvXMLEnumMapEntry +{ + const sal_Char *pName; + sal_uInt16 nValue; +}; + + +#endif // _SVTOOLS_XMLEMENT_HXX + diff --git a/svl/prj/build.lst b/svl/prj/build.lst new file mode 100644 index 000000000000..a60199740561 --- /dev/null +++ b/svl/prj/build.lst @@ -0,0 +1,55 @@ +st svtools : l10n offuh toolkit ucbhelper unotools JPEG:jpeg cppu cppuhelper comphelper sal sot jvmfwk NULL +st svtools usr1 - all st_mkout NULL +st svtools\inc nmake - all st_inc NULL +st svtools\inc\sane get - all st_incsa NULL +st svtools\prj get - all st_prj NULL +st svtools\res get - all st_res NULL +st svtools\win\inc get - all st_winc NULL +st svtools\win\res get - all st_wres NULL +st svtools\os2\inc get - all st_oinc NULL +st svtools\mac\inc get - all st_minc NULL +st svtools\unx\inc get - all st_uinc NULL +st svtools\bmpmaker nmake - all st_bmp st_inc NULL +st svtools\source\memtools nmake - all st_mem st_inc NULL +st svtools\source\numbers nmake - all st_num st_inc NULL +st svtools\source\notify nmake - all st_not st_inc NULL +st svtools\source\config nmake - all st_conf st_inc NULL +st svtools\unx\source\svdde nmake - u st_usdde st_inc NULL +st svtools\unx\source\svdde nmake - p st_psdde st_inc NULL +st svtools\mac\source\svdde nmake - m st_msdde st_inc NULL +st svtools\mac\source\misc nmake - m st_msc st_inc NULL +st svtools\source\control nmake - all st_ctl st_inc NULL +st svtools\source\filerec nmake - all st_file st_inc NULL +st svtools\source\filter.vcl\filter nmake - all st_vfilt st_inc NULL +st svtools\source\filter.vcl\wmf nmake - all st_vwmf st_inc NULL +st svtools\source\filter.vcl\igif nmake - all st_vigif st_inc NULL +st svtools\source\filter.vcl\jpeg nmake - all st_vjpeg st_inc NULL +st svtools\source\filter.vcl\ixbm nmake - all st_vixbm st_inc NULL +st svtools\source\filter.vcl\ixpm nmake - all st_vixpm st_inc NULL +st svtools\source\brwbox nmake - all st__brw st_bmp st_inc NULL +st svtools\source\urlobj nmake - all st__url st_inc NULL +st svtools\source\misc nmake - all st__misc st_bmp st_inc NULL +st svtools\source\misc1 nmake - all st__misc1 st_inc NULL +st svtools\source\contnr nmake - all st__ctr st_inc NULL +st svtools\source\svdde nmake - all st__dde st_inc NULL +st svtools\source\items nmake - all st__item st_inc NULL +st svtools\source\items1 nmake - all st__item1 st_inc NULL +st svtools\source\undo nmake - all st_undo st_inc NULL +st svtools\source\plugapp nmake - all st_papp st_inc NULL +st svtools\source\dialogs nmake - all st_dial st_inc NULL +st svtools\source\edit nmake - all st_edit st_inc NULL +st svtools\source\table nmake - all st_table st_inc NULL +st svtools\source\uno nmake - all st_uno st_inc NULL +st svtools\source\svrtf nmake - all st_rtf st_inc NULL +st svtools\source\svsql nmake - all st_sql st_inc NULL +st svtools\source\svhtml nmake - all st_html st_inc NULL +st svtools\source\syslocale nmake - all st_sysloc st_inc NULL +st svtools\source\filepicker nmake - all st_filepick st_inc NULL +st svtools\util nmake - all st_util st__brw st__ctr st__dde st__item st__item1 st__misc st__misc1 st__url st_ctl st_dial st_edit st_file st_html st_papp st_rtf st_sql st_usdde.u st_psdde.p st_msdde.m st_msc.m st_undo st_table st_uno st_vfilt st_vigif st_vixbm st_vixpm st_vjpeg st_vwmf st_sysloc st_filepick st_not st_conf st_mem st_num st_svtjava NULL +st svtools\source\fsstor nmake - all st_fsstor st_inc NULL +st svtools\source\hatchwindow nmake - all st_hatchwin st_inc NULL +st svtools\source\passwordcontainer nmake - all st_passcont st_inc NULL +st svtools\source\productregistration nmake - all st_prodreg st_util st_inc NULL +st svtools\uno nmake - all st_svtuno st_util st_inc NULL +st svtools\source\java nmake - all st_svtjava st_inc NULL +st svtools\workben\unodialog nmake - all st_workben_udlg st_util NULL diff --git a/svl/prj/d.lst b/svl/prj/d.lst new file mode 100644 index 000000000000..a3a7679f8aea --- /dev/null +++ b/svl/prj/d.lst @@ -0,0 +1,133 @@ +mkdir: %COMMON_DEST%\bin%_EXT%\hid +mkdir: %COMMON_DEST%\res%_EXT% +mkdir: %_DEST%\inc%_EXT%\svtools + +..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid +..\%__SRC%\srs\ehdl.srs %_DEST%\res%_EXT%\svtools.srs +..\%COMMON_OUTDIR%\srs\ehdl_srs.hid %COMMON_DEST%\res%_EXT%\svtools_srs.hid +..\%__SRC%\lib\isvl.lib %_DEST%\lib%_EXT%\isvl.lib +..\%__SRC%\lib\svtool.lib %_DEST%\lib%_EXT%\svtool.lib +..\%__SRC%\slb\svt.lib %_DEST%\lib%_EXT%\xsvtool.lib +..\%__SRC%\bin\dllver.exe %_DEST%\bin%_EXT%\dllver.exe +..\%__SRC%\bin\dllver %_DEST%\bin%_EXT%\dllver +..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\* +..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\* +..\%__SRC%\bin\bmp.* %_DEST%\bin%_EXT%\bmp.* +..\%__SRC%\bin\bmpsum.* %_DEST%\bin%_EXT%\bmpsum.* +..\%__SRC%\bin\bmpgui.* %_DEST%\bin%_EXT%\bmpgui.* +..\%__SRC%\bin\g2g.* %_DEST%\bin%_EXT%\g2g.* +..\%__SRC%\bin\bmp %_DEST%\bin%_EXT%\bmp +..\%__SRC%\bin\bmpsum %_DEST%\bin%_EXT%\bmpsum +..\%__SRC%\bin\bmpgui %_DEST%\bin%_EXT%\bmpgui +..\%__SRC%\bin\g2g %_DEST%\bin%_EXT%\g2g +..\%__SRC%\res\bmp.* %_DEST%\bin%_EXT%\bmp.* +..\%__SRC%\res\bmpgui.* %_DEST%\bin%_EXT%\bmpgui.* +..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\* +..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\* + +..\inc\svtools\*.hxx %_DEST%\inc%_EXT%\svtools\*.hxx +..\inc\svtools\*.h %_DEST%\inc%_EXT%\svtools\*.h +..\inc\svtools\*.hrc %_DEST%\inc%_EXT%\svtools\*.hrc + +..\inc\imagemgr.hxx %_DEST%\inc%_EXT%\svtools\imagemgr.hxx +..\inc\imagemgr.hrc %_DEST%\inc%_EXT%\svtools\imagemgr.hrc +..\inc\testtool.hxx %_DEST%\inc%_EXT%\svtools\testtool.hxx +..\inc\flbytes.hxx %_DEST%\inc%_EXT%\svtools\flbytes.hxx +..\inc\adrparse.hxx %_DEST%\inc%_EXT%\svtools\adrparse.hxx +..\inc\broadcast.hxx %_DEST%\inc%_EXT%\svtools\broadcast.hxx +..\inc\calendar.hxx %_DEST%\inc%_EXT%\svtools\calendar.hxx +..\inc\cntnrsrt.hxx %_DEST%\inc%_EXT%\svtools\cntnrsrt.hxx +..\inc\ctrlbox.hxx %_DEST%\inc%_EXT%\svtools\ctrlbox.hxx +..\inc\ctrltool.hxx %_DEST%\inc%_EXT%\svtools\ctrltool.hxx +..\inc\collatorres.hxx %_DEST%\inc%_EXT%\svtools\collatorres.hxx +..\inc\indexentryres.hxx %_DEST%\inc%_EXT%\svtools\indexentryres.hxx +..\inc\cntwids.hrc %_DEST%\inc%_EXT%\svtools\cntwids.hrc +..\inc\itemdel.hxx %_DEST%\inc%_EXT%\svtools\itemdel.hxx +..\inc\wallitem.hxx %_DEST%\inc%_EXT%\svtools\wallitem.hxx +..\inc\stylepool.hxx %_DEST%\inc%_EXT%\svtools\stylepool.hxx +..\inc\dialogcontrolling.hxx %_DEST%\inc%_EXT%\svtools\dialogcontrolling.hxx +..\inc\filedlg.hxx %_DEST%\inc%_EXT%\svtools\filedlg.hxx +..\inc\fltdefs.hxx %_DEST%\inc%_EXT%\svtools\fltdefs.hxx +..\inc\imgdef.hxx %_DEST%\inc%_EXT%\svtools\imgdef.hxx +..\inc\inetdef.hxx %_DEST%\inc%_EXT%\svtools\inetdef.hxx +..\inc\inetmsg.hxx %_DEST%\inc%_EXT%\svtools\inetmsg.hxx +..\inc\inetstrm.hxx %_DEST%\inc%_EXT%\svtools\inetstrm.hxx +..\inc\listener.hxx %_DEST%\inc%_EXT%\svtools\listener.hxx +..\inc\listeneriter.hxx %_DEST%\inc%_EXT%\svtools\listeneriter.hxx +..\inc\memberid.hrc %_DEST%\inc%_EXT%\svtools\memberid.hrc +..\inc\prgsbar.hxx %_DEST%\inc%_EXT%\svtools\prgsbar.hxx +..\inc\poolcach.hxx %_DEST%\inc%_EXT%\svtools\poolcach.hxx +..\inc\ruler.hxx %_DEST%\inc%_EXT%\svtools\ruler.hxx +..\inc\scrwin.hxx %_DEST%\inc%_EXT%\svtools\scrwin.hxx +..\inc\scriptedtext.hxx %_DEST%\inc%_EXT%\svtools\scriptedtext.hxx +..\inc\tabbar.hxx %_DEST%\inc%_EXT%\svtools\tabbar.hxx +..\inc\taskbar.hxx %_DEST%\inc%_EXT%\svtools\taskbar.hxx +..\inc\whiter.hxx %_DEST%\inc%_EXT%\svtools\whiter.hxx +..\inc\stdmenu.hxx %_DEST%\inc%_EXT%\svtools\stdmenu.hxx +..\inc\tooltiplbox.hxx %_DEST%\inc%_EXT%\svtools\tooltiplbox.hxx +..\inc\txtattr.hxx %_DEST%\inc%_EXT%\svtools\txtattr.hxx +..\inc\sychconv.hxx %_DEST%\inc%_EXT%\svtools\sychconv.hxx +..\inc\cliplistener.hxx %_DEST%\inc%_EXT%\svtools\cliplistener.hxx +..\inc\txtcmp.hxx %_DEST%\inc%_EXT%\svtools\txtcmp.hxx +..\inc\urlbmk.hxx %_DEST%\inc%_EXT%\svtools\urlbmk.hxx +..\inc\inetimg.hxx %_DEST%\inc%_EXT%\svtools\inetimg.hxx +..\inc\nfsymbol.hxx %_DEST%\inc%_EXT%\svtools\nfsymbol.hxx +..\inc\numuno.hxx %_DEST%\inc%_EXT%\svtools\numuno.hxx +..\inc\imageresourceaccess.hxx %_DEST%\inc%_EXT%\svtools\imageresourceaccess.hxx +..\inc\addresstemplate.hxx %_DEST%\inc%_EXT%\svtools\addresstemplate.hxx +..\inc\templatefoldercache.hxx %_DEST%\inc%_EXT%\svtools\templatefoldercache.hxx +..\inc\folderrestriction.hxx %_DEST%\inc%_EXT%\svtools\folderrestriction.hxx +..\inc\filenotation.hxx %_DEST%\inc%_EXT%\svtools\filenotation.hxx +..\inc\framestatuslistener.hxx %_DEST%\inc%_EXT%\svtools\framestatuslistener.hxx +..\inc\statusbarcontroller.hxx %_DEST%\inc%_EXT%\svtools\statusbarcontroller.hxx +..\inc\htmltokn.h %_DEST%\inc%_EXT%\svtools\htmltokn.h +..\inc\htmlkywd.hxx %_DEST%\inc%_EXT%\svtools\htmlkywd.hxx +..\source\svrtf\rtfout.hxx %_DEST%\inc%_EXT%\svtools\rtfout.hxx +..\source\svrtf\rtftoken.h %_DEST%\inc%_EXT%\svtools\rtftoken.h +..\source\svrtf\rtfkeywd.hxx %_DEST%\inc%_EXT%\svtools\rtfkeywd.hxx +..\inc\strmadpt.hxx %_DEST%\inc%_EXT%\svtools\strmadpt.hxx +..\inc\instrm.hxx %_DEST%\inc%_EXT%\svtools\instrm.hxx +..\inc\outstrm.hxx %_DEST%\inc%_EXT%\svtools\outstrm.hxx +..\inc\sectctr.hxx %_DEST%\inc%_EXT%\svtools\sectctr.hxx +..\inc\privsplt.hxx %_DEST%\inc%_EXT%\svtools\privsplt.hxx +..\inc\expander.hxx %_DEST%\inc%_EXT%\svtools\expander.hxx +..\source\svsql\converter.hxx %_DEST%\inc%_EXT%\svtools\converter.hxx +..\inc\filectrl.hxx %_DEST%\inc%_EXT%\svtools\filectrl.hxx +..\inc\sfxecode.hxx %_DEST%\inc%_EXT%\svtools\sfxecode.hxx +..\source\dialogs\filedlg2.hrc %_DEST%\inc%_EXT%\svtools\filedlg2.hrc +..\inc\xmlement.hxx %_DEST%\inc%_EXT%\svtools\xmlement.hxx +..\inc\urihelper.hxx %_DEST%\inc%_EXT%\svtools\urihelper.hxx +..\inc\reginfo.hxx %_DEST%\inc%_EXT%\svtools\reginfo.hxx +..\inc\fstathelper.hxx %_DEST%\inc%_EXT%\svtools\fstathelper.hxx +..\inc\localresaccess.hxx %_DEST%\inc%_EXT%\svtools\localresaccess.hxx +..\inc\roadmap.hxx %_DEST%\inc%_EXT%\svtools\roadmap.hxx +..\inc\helpagentwindow.hxx %_DEST%\inc%_EXT%\svtools\helpagentwindow.hxx +..\inc\pickerhistory.hxx %_DEST%\inc%_EXT%\svtools\pickerhistory.hxx +..\inc\pickerhistoryaccess.hxx %_DEST%\inc%_EXT%\svtools\pickerhistoryaccess.hxx +..\inc\pickerhelper.hxx %_DEST%\inc%_EXT%\svtools\pickerhelper.hxx +..\inc\lngmisc.hxx %_DEST%\inc%_EXT%\svtools\lngmisc.hxx +..\inc\PasswordHelper.hxx %_DEST%\inc%_EXT%\svtools\PasswordHelper.hxx +..\inc\unoimap.hxx %_DEST%\inc%_EXT%\svtools\unoimap.hxx +..\inc\unoevent.hxx %_DEST%\inc%_EXT%\svtools\unoevent.hxx +..\inc\ivctrl.hxx %_DEST%\inc%_EXT%\svtools\ivctrl.hxx +..\inc\fileview.hxx %_DEST%\inc%_EXT%\svtools\fileview.hxx +..\inc\templdlg.hxx %_DEST%\inc%_EXT%\svtools\templdlg.hxx +..\inc\asynclink.hxx %_DEST%\inc%_EXT%\svtools\asynclink.hxx +..\inc\controldims.hrc %_DEST%\inc%_EXT%\svtools\controldims.hrc +..\inc\soerr.hxx %_DEST%\inc%_EXT%\svtools\soerr.hxx +..\inc\sores.hxx %_DEST%\inc%_EXT%\svtools\sores.hxx +..\inc\textwindowaccessibility.hxx %_DEST%\inc%_EXT%\svtools\textwindowaccessibility.hxx +..\inc\fontsubstconfig.hxx %_DEST%\inc%_EXT%\svtools\fontsubstconfig.hxx +..\inc\apearcfg.hxx %_DEST%\inc%_EXT%\svtools\apearcfg.hxx +..\inc\misccfg.hxx %_DEST%\inc%_EXT%\svtools\misccfg.hxx +..\inc\acceleratorexecute.hxx %_DEST%\inc%_EXT%\svtools\acceleratorexecute.hxx +..\inc\QueryFolderName.hxx %_DEST%\inc%_EXT%\svtools\QueryFolderName.hxx +..\inc\DocumentInfoPreview.hxx %_DEST%\inc%_EXT%\svtools\DocumentInfoPreview.hxx +..\inc\dialogclosedlistener.hxx %_DEST%\inc%_EXT%\svtools\dialogclosedlistener.hxx +..\inc\contextmenuhelper.hxx %_DEST%\inc%_EXT%\svtools\contextmenuhelper.hxx +..\inc\extcolorcfg.hxx %_DEST%\inc%_EXT%\svtools\extcolorcfg.hxx + +dos: sh -c "if test %OS% = MACOSX; then macosx-create-bundle %_DEST%\bin%_EXT%\bmp=%__PRJROOT%\%__SRC%\bin%_EXT%; fi" + +*.xml %_DEST%\xml%_EXT%\*.xml + diff --git a/svl/qa/complex/ConfigItems/CheckConfigItems.java b/svl/qa/complex/ConfigItems/CheckConfigItems.java new file mode 100644 index 000000000000..97cc21fdec9f --- /dev/null +++ b/svl/qa/complex/ConfigItems/CheckConfigItems.java @@ -0,0 +1,186 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: CheckConfigItems.java,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:09:22 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +package complex.ConfigItems; + +import com.sun.star.beans.*; +import com.sun.star.lang.*; +import com.sun.star.uno.*; +import com.sun.star.task.*; + +import complexlib.*; + +import java.lang.*; +import java.util.*; + +//----------------------------------------------- +/** @short todo document me + */ +public class CheckConfigItems extends ComplexTestCase +{ + //------------------------------------------- + // some const + + //------------------------------------------- + // member + + /** points to the global uno service manager. */ + private XMultiServiceFactory m_xSmgr = null; + + /** implements real config item tests in C++. */ + private XJob m_xTest = null; + + //------------------------------------------- + // test environment + + //------------------------------------------- + /** @short A function to tell the framework, + which test functions are available. + + @return All test methods. + @todo Think about selection of tests from outside ... + */ + public String[] getTestMethodNames() + { + return new String[] + { + "checkPicklist", + "checkURLHistory", + "checkHelpBookmarks", + "checkPrintOptions", + "checkAccessibilityOptions", + "checkUserOptions" + }; + } + + //------------------------------------------- + /** @short Create the environment for following tests. + + @descr Use either a component loader from desktop or + from frame + */ + public void before() + throws java.lang.Exception + { + // get uno service manager from global test environment + m_xSmgr = (XMultiServiceFactory)param.getMSF(); + + // TODO register helper service + + // create module manager + m_xTest = (XJob)UnoRuntime.queryInterface( + XJob.class, + m_xSmgr.createInstance("com.sun.star.comp.svtools.ConfigItemTest")); + } + + //------------------------------------------- + /** @short close the environment. + */ + public void after() + throws java.lang.Exception + { + // TODO deregister helper service + + m_xTest = null; + m_xSmgr = null; + } + + //------------------------------------------- + /** @todo document me + */ + public void checkPicklist() + throws java.lang.Exception + { + impl_triggerTest("checkPicklist"); + } + + //------------------------------------------- + /** @todo document me + */ + public void checkURLHistory() + throws java.lang.Exception + { + impl_triggerTest("checkURLHistory"); + } + + //------------------------------------------- + /** @todo document me + */ + public void checkHelpBookmarks() + throws java.lang.Exception + { + impl_triggerTest("checkHelpBookmarks"); + } + + //------------------------------------------- + /** @todo document me + */ + public void checkPrintOptions() + throws java.lang.Exception + { + impl_triggerTest("checkPrintOptions"); + } + + //------------------------------------------- + /** @todo document me + */ + public void checkAccessibilityOptions() + throws java.lang.Exception + { + impl_triggerTest("checkAccessibilityOptions"); + } + + //------------------------------------------- + /** @todo document me + */ + public void checkUserOptions() + throws java.lang.Exception + { + impl_triggerTest("checkUserOptions"); + } + + //------------------------------------------- + /** @todo document me + */ + private void impl_triggerTest(String sTest) + throws java.lang.Exception + { + NamedValue[] lArgs = new NamedValue[1]; + lArgs[0] = new NamedValue(); + lArgs[0].Name = "Test"; + lArgs[0].Value = sTest; + m_xTest.execute(lArgs); + } +} diff --git a/svl/qa/complex/ConfigItems/helper/AccessibilityOptTest.cxx b/svl/qa/complex/ConfigItems/helper/AccessibilityOptTest.cxx new file mode 100644 index 000000000000..d853bf926467 --- /dev/null +++ b/svl/qa/complex/ConfigItems/helper/AccessibilityOptTest.cxx @@ -0,0 +1,400 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AccessibilityOptTest.cxx,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:09:23 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#include "AccessibilityOptTest.hxx" +#include "configitems/accessibilityoptions_const.hxx" + +#include +#include + +#include +#include + +namespace css = ::com::sun::star; + +AccessibilityOptTest::AccessibilityOptTest() +{ + m_xCfg = css::uno::Reference< css::container::XNameAccess >( + ::comphelper::ConfigurationHelper::openConfig( + ::utl::getProcessServiceFactory(), + s_sAccessibility, + ::comphelper::ConfigurationHelper::E_STANDARD), + css::uno::UNO_QUERY); +} + +AccessibilityOptTest::~AccessibilityOptTest() +{ + if (m_xCfg.is()) + m_xCfg.clear(); +} + +//============================================================================= +//test GetAutoDetectSystemHC() +void AccessibilityOptTest::impl_checkGetAutoDetectSystemHC() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bAutoDetectSystemHC; + sal_Bool bAutoDetectSystemHC_; + + bAutoDetectSystemHC = aAccessibilityOpt.GetAutoDetectSystemHC(); + xSet->setPropertyValue( s_sAutoDetectSystemHC, css::uno::makeAny(bAutoDetectSystemHC ? sal_False:sal_True) ); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + bAutoDetectSystemHC_ = aAccessibilityOpt.GetAutoDetectSystemHC(); + + if ( bAutoDetectSystemHC_ == bAutoDetectSystemHC )//old config item will not throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetAutoDetectSystemHC() error!")), 0); +} + +//============================================================================= +//test GetIsForPagePreviews() +void AccessibilityOptTest::impl_checkGetIsForPagePreviews() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsForPagePreviews ; + sal_Bool bIsForPagePreviews_; + + bIsForPagePreviews = aAccessibilityOpt.GetIsForPagePreviews(); + xSet->setPropertyValue( s_sIsForPagePreviews, css::uno::makeAny(bIsForPagePreviews ? sal_False:sal_True) ); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + bIsForPagePreviews_ = aAccessibilityOpt.GetIsForPagePreviews(); + + if ( bIsForPagePreviews_ == bIsForPagePreviews )//old config item will not throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsForPagePreviews() error!")), 0); +} + +//============================================================================= +//test impl_checkGetIsHelpTipsDisappear() +void AccessibilityOptTest::impl_checkGetIsHelpTipsDisappear() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsHelpTipsDisappear ; + sal_Bool bIsHelpTipsDisappear_; + + bIsHelpTipsDisappear = aAccessibilityOpt.GetIsHelpTipsDisappear(); + xSet->setPropertyValue( s_sIsHelpTipsDisappear, css::uno::makeAny(bIsHelpTipsDisappear ? sal_False:sal_True) ); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + bIsHelpTipsDisappear_ = aAccessibilityOpt.GetIsHelpTipsDisappear(); + + if ( bIsHelpTipsDisappear_ == bIsHelpTipsDisappear )//old config item will not throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsHelpTipsDisappear() error!")), 0); +} + +//============================================================================= +//test impl_checkGetIsAllowAnimatedGraphics() +void AccessibilityOptTest::impl_checkGetIsAllowAnimatedGraphics() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsAllowAnimatedGraphics ; + sal_Bool bIsAllowAnimatedGraphics_; + + bIsAllowAnimatedGraphics = aAccessibilityOpt.GetIsAllowAnimatedGraphics(); + xSet->setPropertyValue( s_sIsAllowAnimatedGraphics, css::uno::makeAny(bIsAllowAnimatedGraphics ? sal_False:sal_True) ); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + bIsAllowAnimatedGraphics_ = aAccessibilityOpt.GetIsAllowAnimatedGraphics(); + + if ( bIsAllowAnimatedGraphics_ == bIsAllowAnimatedGraphics )//old config item will not throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsAllowAnimatedGraphics() error!")), 0); +} + +//============================================================================= +//test impl_checkGetIsAllowAnimatedText() +void AccessibilityOptTest::impl_checkGetIsAllowAnimatedText() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsAllowAnimatedText ; + sal_Bool bIsAllowAnimatedText_; + + bIsAllowAnimatedText = aAccessibilityOpt.GetIsAllowAnimatedText(); + xSet->setPropertyValue( s_sIsAllowAnimatedText, css::uno::makeAny(bIsAllowAnimatedText ? sal_False:sal_True) ); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + bIsAllowAnimatedText_ = aAccessibilityOpt.GetIsAllowAnimatedText(); + + if ( bIsAllowAnimatedText_ == bIsAllowAnimatedText )//old config item will not throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsAllowAnimatedText() error!")), 0); +} + +//============================================================================= +//test impl_checkGetIsAutomaticFontColor() +void AccessibilityOptTest::impl_checkGetIsAutomaticFontColor() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsAutomaticFontColor ; + sal_Bool bIsAutomaticFontColor_; + + bIsAutomaticFontColor = aAccessibilityOpt.GetIsAutomaticFontColor(); + xSet->setPropertyValue( s_sIsAutomaticFontColor, css::uno::makeAny(bIsAutomaticFontColor ? sal_False:sal_True) ); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + bIsAutomaticFontColor_ = aAccessibilityOpt.GetIsAutomaticFontColor(); + + if ( bIsAutomaticFontColor_ == bIsAutomaticFontColor )//old config item will not throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsAutomaticFontColor() error!")), 0); +} + +//============================================================================= +//test impl_checkGetIsSystemFont() +void AccessibilityOptTest::impl_checkGetIsSystemFont() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsSystemFont ; + sal_Bool bIsSystemFont_; + + bIsSystemFont = aAccessibilityOpt.GetIsSystemFont(); + xSet->setPropertyValue( s_sIsSystemFont, css::uno::makeAny(bIsSystemFont ? sal_False:sal_True) ); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + bIsSystemFont_ = aAccessibilityOpt.GetIsSystemFont(); + + if ( bIsSystemFont_ == bIsSystemFont )//old config item will not throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsSystemFont() error!")), 0); +} + +//============================================================================= +//test impl_checkGetHelpTipSeconds() +void AccessibilityOptTest::impl_checkGetHelpTipSeconds() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Int16 nHelpTipSeconds ; + sal_Int16 nHelpTipSeconds_; + + nHelpTipSeconds = aAccessibilityOpt.GetHelpTipSeconds(); + xSet->setPropertyValue( s_sHelpTipSeconds, css::uno::makeAny(sal_Int16(nHelpTipSeconds+1)) ); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + nHelpTipSeconds_ = aAccessibilityOpt.GetHelpTipSeconds(); + + if ( nHelpTipSeconds_ == nHelpTipSeconds )//old config item will not throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetHelpTipSeconds() error!")), 0); +} + +//============================================================================= +//test impl_checkIsSelectionInReadonly() +void AccessibilityOptTest::impl_checkIsSelectionInReadonly() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsSelectionInReadonly ; + sal_Bool bIsSelectionInReadonly_; + + bIsSelectionInReadonly = aAccessibilityOpt.IsSelectionInReadonly(); + xSet->setPropertyValue( s_sIsSelectionInReadonly, css::uno::makeAny(bIsSelectionInReadonly ? sal_False:sal_True) ); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + bIsSelectionInReadonly_ = aAccessibilityOpt.IsSelectionInReadonly(); + + if ( bIsSelectionInReadonly_ == bIsSelectionInReadonly )//old config item will not throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsSelectionInReadonly() error!")), 0); +} + +//============================================================================= +//test SetAutoDetectSystemHC() +void AccessibilityOptTest::impl_checkSetAutoDetectSystemHC() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bAutoDetectSystemHC; + sal_Bool bAutoDetectSystemHC_; + + xSet->getPropertyValue(s_sAutoDetectSystemHC) >>= bAutoDetectSystemHC; + aAccessibilityOpt.SetAutoDetectSystemHC( bAutoDetectSystemHC ? sal_False:sal_True ); + xSet->getPropertyValue(s_sAutoDetectSystemHC) >>= bAutoDetectSystemHC_; + + if ( bAutoDetectSystemHC_ == bAutoDetectSystemHC )//old config item will throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetAutoDetectSystemHC() error!")), 0); +} + +//============================================================================= +//test SetIsForPagePreviews() +void AccessibilityOptTest::impl_checkSetIsForPagePreviews() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsForPagePreviews ; + sal_Bool bIsForPagePreviews_; + + xSet->getPropertyValue(s_sIsForPagePreviews) >>= bIsForPagePreviews; + aAccessibilityOpt.SetIsForPagePreviews( bIsForPagePreviews ? sal_False:sal_True ); + xSet->getPropertyValue(s_sIsForPagePreviews) >>= bIsForPagePreviews_; + + if ( bIsForPagePreviews_ == bIsForPagePreviews )//old config item will throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsForPagePreviews() error!")), 0); +} + +//============================================================================= +//test impl_checkSetIsHelpTipsDisappear() +void AccessibilityOptTest::impl_checkSetIsHelpTipsDisappear() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsHelpTipsDisappear ; + sal_Bool bIsHelpTipsDisappear_; + + xSet->getPropertyValue(s_sIsHelpTipsDisappear) >>= bIsHelpTipsDisappear; + aAccessibilityOpt.SetIsHelpTipsDisappear( bIsHelpTipsDisappear ? sal_False:sal_True ); + xSet->getPropertyValue(s_sIsHelpTipsDisappear) >>= bIsHelpTipsDisappear_; + + if ( bIsHelpTipsDisappear_ == bIsHelpTipsDisappear )//old config item will throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsHelpTipsDisappear() error!")), 0); +} + +//============================================================================= +//test impl_checkSetIsAllowAnimatedGraphics() +void AccessibilityOptTest::impl_checkSetIsAllowAnimatedGraphics() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsAllowAnimatedGraphics ; + sal_Bool bIsAllowAnimatedGraphics_; + + xSet->getPropertyValue(s_sIsAllowAnimatedGraphics) >>= bIsAllowAnimatedGraphics; + aAccessibilityOpt.SetIsAllowAnimatedGraphics( bIsAllowAnimatedGraphics ? sal_False:sal_True ); + xSet->getPropertyValue(s_sIsAllowAnimatedGraphics) >>= bIsAllowAnimatedGraphics_; + + if ( bIsAllowAnimatedGraphics_ == bIsAllowAnimatedGraphics )//old config item will throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsAllowAnimatedGraphics() error!")), 0); +} + +//============================================================================= +//test impl_checkSetIsAllowAnimatedText() +void AccessibilityOptTest::impl_checkSetIsAllowAnimatedText() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsAllowAnimatedText ; + sal_Bool bIsAllowAnimatedText_; + + xSet->getPropertyValue(s_sIsAllowAnimatedText) >>= bIsAllowAnimatedText; + aAccessibilityOpt.SetIsAllowAnimatedText( bIsAllowAnimatedText ? sal_False:sal_True ); + xSet->getPropertyValue(s_sIsAllowAnimatedText) >>= bIsAllowAnimatedText_; + + if ( bIsAllowAnimatedText_ == bIsAllowAnimatedText )//old config item will throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsAllowAnimatedText() error!")), 0); +} + +//============================================================================= +//test impl_checkSetIsAutomaticFontColor() +void AccessibilityOptTest::impl_checkSetIsAutomaticFontColor() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsAutomaticFontColor ; + sal_Bool bIsAutomaticFontColor_; + + xSet->getPropertyValue(s_sIsAutomaticFontColor) >>= bIsAutomaticFontColor; + aAccessibilityOpt.SetIsAutomaticFontColor( bIsAutomaticFontColor ? sal_False:sal_True ); + xSet->getPropertyValue(s_sIsAutomaticFontColor) >>= bIsAutomaticFontColor_; + + if ( bIsAutomaticFontColor_ == bIsAutomaticFontColor )//old config item will throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsAutomaticFontColor() error!")), 0); +} + +//============================================================================= +//test impl_checkSetIsSystemFont() +void AccessibilityOptTest::impl_checkSetIsSystemFont() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsSystemFont ; + sal_Bool bIsSystemFont_; + + xSet->getPropertyValue(s_sIsSystemFont) >>= bIsSystemFont; + aAccessibilityOpt.SetIsSystemFont( bIsSystemFont ? sal_False:sal_True ); + xSet->getPropertyValue(s_sIsSystemFont) >>= bIsSystemFont_; + + if ( bIsSystemFont_ == bIsSystemFont )//old config item will throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsSystemFont() error!")), 0); +} + +//============================================================================= +//test impl_checkSetHelpTipSeconds() +void AccessibilityOptTest::impl_checkSetHelpTipSeconds() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Int16 nHelpTipSeconds ; + sal_Int16 nHelpTipSeconds_; + + xSet->getPropertyValue(s_sHelpTipSeconds) >>= nHelpTipSeconds; + aAccessibilityOpt.SetHelpTipSeconds( sal_Int16(nHelpTipSeconds+1) ); + xSet->getPropertyValue(s_sHelpTipSeconds) >>= nHelpTipSeconds_; + + if ( nHelpTipSeconds_ == nHelpTipSeconds )//old config item will throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetHelpTipSeconds() error!")), 0); +} + +//============================================================================= +//test impl_checkSetSelectionInReadonly() +void AccessibilityOptTest::impl_checkSetSelectionInReadonly() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsSelectionInReadonly ; + sal_Bool bIsSelectionInReadonly_; + + xSet->getPropertyValue(s_sIsSelectionInReadonly) >>= bIsSelectionInReadonly; + aAccessibilityOpt.SetSelectionInReadonly( bIsSelectionInReadonly ? sal_False:sal_True ); + xSet->getPropertyValue(s_sIsSelectionInReadonly) >>= bIsSelectionInReadonly_; + + if ( bIsSelectionInReadonly_ == bIsSelectionInReadonly )//old config item will throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetSelectionInReadonly() error!")), 0); +} + +//============================================================================= +void AccessibilityOptTest::impl_checkAccessibilityOptions() +{ + impl_checkGetAutoDetectSystemHC(); + impl_checkGetIsForPagePreviews(); + impl_checkGetIsHelpTipsDisappear(); + impl_checkGetIsAllowAnimatedGraphics(); + impl_checkGetIsAllowAnimatedText(); + impl_checkGetIsAutomaticFontColor(); + impl_checkGetIsSystemFont(); + impl_checkGetHelpTipSeconds(); + impl_checkIsSelectionInReadonly(); + + impl_checkSetAutoDetectSystemHC(); + impl_checkSetIsForPagePreviews(); + impl_checkSetIsHelpTipsDisappear(); + impl_checkSetIsAllowAnimatedGraphics(); + impl_checkSetIsAllowAnimatedText(); + impl_checkSetIsAutomaticFontColor(); + impl_checkSetIsSystemFont(); + impl_checkSetHelpTipSeconds(); + impl_checkSetSelectionInReadonly(); +} diff --git a/svl/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx b/svl/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx new file mode 100644 index 000000000000..fc2f4681e4fe --- /dev/null +++ b/svl/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AccessibilityOptTest.hxx,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:09:23 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef SVTOOLS_ACCESSIBILITYOPTTEST_HXX +#define SVTOOLS_ACCESSIBILITYOPTTEST_HXX + +#include +#include + +namespace css = ::com::sun::star; + +class AccessibilityOptTest +{ +public: + AccessibilityOptTest(); + ~AccessibilityOptTest(); + + void impl_checkAccessibilityOptions(); + +private: + void impl_checkGetAutoDetectSystemHC(); + void impl_checkGetIsForPagePreviews(); + void impl_checkGetIsHelpTipsDisappear(); + void impl_checkGetIsAllowAnimatedGraphics(); + void impl_checkGetIsAllowAnimatedText(); + void impl_checkGetIsAutomaticFontColor(); + void impl_checkGetIsSystemFont(); + void impl_checkGetHelpTipSeconds(); + void impl_checkIsSelectionInReadonly(); + + void impl_checkSetAutoDetectSystemHC(); + void impl_checkSetIsForPagePreviews(); + void impl_checkSetIsHelpTipsDisappear(); + void impl_checkSetIsAllowAnimatedGraphics(); + void impl_checkSetIsAllowAnimatedText(); + void impl_checkSetIsAutomaticFontColor(); + void impl_checkSetIsSystemFont(); + void impl_checkSetHelpTipSeconds(); + void impl_checkSetSelectionInReadonly(); + +private: + css::uno::Reference< css::container::XNameAccess > m_xCfg; + SvtAccessibilityOptions aAccessibilityOpt; +}; + +#endif // #ifndef SVTOOLS_ACCESSIBILITYOPTTEST_HXX diff --git a/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx b/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx new file mode 100644 index 000000000000..b21d9d76755e --- /dev/null +++ b/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx @@ -0,0 +1,253 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ConfigItemTest.cxx,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:09:23 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#include "HistoryOptTest.hxx" +#include "AccessibilityOptTest.hxx" +#include "PrintOptTest.hxx" +#include "UserOptTest.hxx" + +#include +#include +#include +#include + +#include +#include +#include +#include + +//============================================================================= +namespace css = ::com::sun::star; + +namespace svtools{ + +//============================================================================= +static const ::rtl::OUString PROP_TEST = ::rtl::OUString::createFromAscii("Test"); +static const ::rtl::OUString TEST_PICKLIST = ::rtl::OUString::createFromAscii("checkPicklist"); +static const ::rtl::OUString TEST_URLHISTORY = ::rtl::OUString::createFromAscii("checkURLHistory"); +static const ::rtl::OUString TEST_HELPBOOKMARKS = ::rtl::OUString::createFromAscii("checkHelpBookmarks"); +static const ::rtl::OUString TEST_ACCESSIBILITYOPTIONS = ::rtl::OUString::createFromAscii("checkAccessibilityOptions"); +static const ::rtl::OUString TEST_PRINTOPTIONS = ::rtl::OUString::createFromAscii("checkPrintOptions"); +static const ::rtl::OUString TEST_USEROPTIONS = ::rtl::OUString::createFromAscii("checkUserOptions"); + +//============================================================================= +class ConfigItemTest : public ::cppu::WeakImplHelper2< css::task::XJob , + css::lang::XServiceInfo > +{ + //------------------------------------------------------------------------- + // interface + public: + explicit ConfigItemTest(const css::uno::Reference< css::uno::XComponentContext >& xContext); + + // css::task::XJob + virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue >& lArguments) + throw (css::uno::RuntimeException , + css::lang::IllegalArgumentException, + css::uno::Exception ); + + // css::lang::XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException); + + virtual ::sal_Bool SAL_CALL supportsService(const ::rtl::OUString& sServiceName) + throw (css::uno::RuntimeException); + + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw (css::uno::RuntimeException); + + //------------------------------------------------------------------------- + // internal + private: + ConfigItemTest(ConfigItemTest &); // not defined + virtual ~ConfigItemTest() {} + void operator=(ConfigItemTest &); // not defined + + //------------------------------------------------------------------------- + // helper for registration ! + public: + static ::rtl::OUString SAL_CALL st_getImplementationName(); + static css::uno::Sequence< ::rtl::OUString > SAL_CALL st_getSupportedServiceNames(); + static css::uno::Reference< css::uno::XInterface > SAL_CALL st_create(const css::uno::Reference< css::uno::XComponentContext >& XContext); + + //------------------------------------------------------------------------- + // member + private: + css::uno::Reference< css::uno::XComponentContext > m_xContext; +}; + +//============================================================================= +ConfigItemTest::ConfigItemTest(const css::uno::Reference< css::uno::XComponentContext >& xContext) + : m_xContext(xContext) +{} + +//============================================================================= +// css::task::XJob +css::uno::Any SAL_CALL ConfigItemTest::execute(const css::uno::Sequence< css::beans::NamedValue >& lArguments) + throw (css::uno::RuntimeException , + css::lang::IllegalArgumentException, + css::uno::Exception ) +{ + ::rtl::OUString sTest; + ::sal_Int32 i = 0; + ::sal_Int32 c = lArguments.getLength(); + for (i=0; i>= sTest; + } + + if (sTest.equals(TEST_PICKLIST)) + { + HistoryOptTest aOptTest; + aOptTest.checkPicklist(); + } + else if (sTest.equals(TEST_URLHISTORY)) + { + HistoryOptTest aOptTest; + aOptTest.checkURLHistory(); + } + else if (sTest.equals(TEST_HELPBOOKMARKS)) + { + HistoryOptTest aOptTest; + aOptTest.checkHelpBookmarks(); + } + else if (sTest.equals(TEST_ACCESSIBILITYOPTIONS)) + { + AccessibilityOptTest aOptTest; + aOptTest.impl_checkAccessibilityOptions(); + } + else if (sTest.equals(TEST_PRINTOPTIONS)) + { + PrintOptTest aOptTest; + aOptTest.impl_checkPrint(); + } + else if (sTest.equals(TEST_USEROPTIONS)) + { + UserOptTest aOptTest; + aOptTest.impl_checkUserData(); + } + + return css::uno::Any(); +} + +//============================================================================= +// com::sun::star::uno::XServiceInfo +::rtl::OUString SAL_CALL ConfigItemTest::getImplementationName() + throw (css::uno::RuntimeException) +{ + return ConfigItemTest::st_getImplementationName(); +} + +//============================================================================= +// com::sun::star::uno::XServiceInfo +::sal_Bool SAL_CALL ConfigItemTest::supportsService(const ::rtl::OUString& sServiceName) + throw (css::uno::RuntimeException) +{ + css::uno::Sequence< ::rtl::OUString > lServiceNames = ConfigItemTest::st_getSupportedServiceNames(); + for (::sal_Int32 i = 0; i < lServiceNames.getLength(); ++i) + { + if (lServiceNames[i].equals(sServiceName)) + return sal_True; + } + return sal_False; +} + +//============================================================================= +// com::sun::star::uno::XServiceInfo +css::uno::Sequence< ::rtl::OUString > SAL_CALL ConfigItemTest::getSupportedServiceNames() + throw (css::uno::RuntimeException) +{ + return ConfigItemTest::st_getSupportedServiceNames(); +} + +//============================================================================= +::rtl::OUString SAL_CALL ConfigItemTest::st_getImplementationName() +{ + return ::rtl::OUString::createFromAscii("com.sun.star.comp.svtools.ConfigItemTest"); +} + +//============================================================================= +css::uno::Sequence< ::rtl::OUString > SAL_CALL ConfigItemTest::st_getSupportedServiceNames() +{ + css::uno::Sequence< ::rtl::OUString > lServices(1); + lServices[0] = ::rtl::OUString::createFromAscii("com.sun.star.test.ConfigItems"); + return lServices; +} + +//============================================================================= +css::uno::Reference< css::uno::XInterface > SAL_CALL ConfigItemTest::st_create(const css::uno::Reference< css::uno::XComponentContext >& xContext) +{ + ConfigItemTest* pObject = new ConfigItemTest(xContext); + css::uno::Reference< css::uno::XInterface > xObject (static_cast< ::cppu::OWeakObject* >(pObject)); + return xObject; +} + +} // namespace svtools + +//============================================================================= +static ::cppu::ImplementationEntry const lRegEntries[] = +{ + { + &::svtools::ConfigItemTest::st_create, + &::svtools::ConfigItemTest::st_getImplementationName, + &::svtools::ConfigItemTest::st_getSupportedServiceNames, + &::cppu::createSingleComponentFactory, 0, 0 + }, + + { 0, 0, 0, 0, 0, 0 } +}; + +//============================================================================= +extern "C" void SAL_CALL component_getImplementationEnvironment(const char** pEnvTypeName, + uno_Environment** ) +{ + *pEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +//============================================================================= +extern "C" void * SAL_CALL component_getFactory(const char* sImplName , + void* pServiceManager, + void* pRegistryKey ) +{ + return ::cppu::component_getFactoryHelper(sImplName, pServiceManager, pRegistryKey, lRegEntries); +} + +//============================================================================= +extern "C" sal_Bool SAL_CALL component_writeInfo(void* pServiceManager, + void* pRegistryKey ) +{ + return ::cppu::component_writeInfoHelper(pServiceManager, pRegistryKey, lRegEntries); +} diff --git a/svl/qa/complex/ConfigItems/helper/HistoryOptTest.cxx b/svl/qa/complex/ConfigItems/helper/HistoryOptTest.cxx new file mode 100644 index 000000000000..082328835fca --- /dev/null +++ b/svl/qa/complex/ConfigItems/helper/HistoryOptTest.cxx @@ -0,0 +1,806 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: HistoryOptTest.cxx,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:09:23 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#include "HistoryOptTest.hxx" +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace css = ::com::sun::star; + +//============================================================================= +static const ::rtl::OUString MESSAGE_CLEAR_FAILED = ::rtl::OUString::createFromAscii("Clearing the list failed."); +static const ::rtl::OUString MESSAGE_SETSIZE_FAILED = ::rtl::OUString::createFromAscii("Setting a new size for a list failed."); +static const ::rtl::OUString MESSAGE_MISS_HISTORY = ::rtl::OUString::createFromAscii("Could not get config access to history list inside config."); +static const ::rtl::OUString MESSAGE_MISS_ITEMLIST = ::rtl::OUString::createFromAscii("Could not get config access to item list inside config."); +static const ::rtl::OUString MESSAGE_MISS_ORDERLIST = ::rtl::OUString::createFromAscii("Could not get config access to order list inside config."); +static const ::rtl::OUString MESSAGE_MISS_ITEM = ::rtl::OUString::createFromAscii("Could not locate item."); +static const ::rtl::OUString MESSAGE_UNEXPECTED_ITEM = ::rtl::OUString::createFromAscii("Found an unexpected item."); +static const ::rtl::OUString MESSAGE_WRONG_ORDER = ::rtl::OUString::createFromAscii("Wrong order in history list."); + +//============================================================================= +HistoryOptTest::HistoryOptTest() + : m_aConfigItem ( ) + , m_eList (ePICKLIST) + , m_xHistoriesXCU( ) + , m_xCommonXCU ( ) +{ +} + +//============================================================================= +HistoryOptTest::~HistoryOptTest() +{ + m_xHistoriesXCU.clear(); + m_xCommonXCU.clear(); +} + +//============================================================================= +void HistoryOptTest::checkPicklist() +{ + impl_testHistory(ePICKLIST, 4); +} + +//============================================================================= +void HistoryOptTest::checkURLHistory() +{ + impl_testHistory(eHISTORY, 10); +} + +//============================================================================= +void HistoryOptTest::checkHelpBookmarks() +{ + impl_testHistory(eHELPBOOKMARKS, 100); +} + +//============================================================================= +void HistoryOptTest::impl_testHistory(EHistoryType eHistory , + ::sal_Int32 nMaxItems) +{ + try + { + m_eList = eHistory; + ::sal_Int32 c = nMaxItems; + ::sal_Int32 i = 0; + + impl_clearList( ); + impl_setSize (c); + + // a) fill list completely and check if all items could be realy created. + // But dont check its order here! Because every new item will change that order. + for (i=0; i xList; + xList = impl_getItemList(); + nCount = xList->getElementNames().getLength(); + + if (nCount != 0) + throw css::uno::Exception(MESSAGE_CLEAR_FAILED, 0); + + xList = impl_getOrderList(); + nCount = xList->getElementNames().getLength(); + + if (nCount != 0) + throw css::uno::Exception(MESSAGE_CLEAR_FAILED, 0); +} + +//============================================================================= +void HistoryOptTest::impl_setSize(::sal_Int32 nSize) +{ + m_aConfigItem.SetSize (m_eList, nSize); + + // a) size info returned by GetSize() means "MaxSize" + // so it must match exactly ! + ::sal_Int32 nCheck = m_aConfigItem.GetSize(m_eList); + if (nCheck != nSize) + throw css::uno::Exception(MESSAGE_SETSIZE_FAILED, 0); + + // b) current size of used XCU lists reflects the current state of + // history list and not max size. So it can be less then size ! + css::uno::Reference< css::container::XNameAccess > xList; + xList = impl_getItemList(); + nCheck = xList->getElementNames().getLength(); + if (nCheck > nSize) + throw css::uno::Exception(MESSAGE_SETSIZE_FAILED, 0); + + xList = impl_getOrderList(); + nCheck = xList->getElementNames().getLength(); + if (nCheck > nSize) + throw css::uno::Exception(MESSAGE_SETSIZE_FAILED, 0); +} + +//============================================================================= +void HistoryOptTest::impl_appendItem(::sal_Int32 nItem) +{ + const ::rtl::OUString sURL = impl_createItemURL (nItem); + const ::rtl::OUString sTitle = impl_createItemTitle (nItem); + const ::rtl::OUString sPassword = impl_createItemPassword(nItem); + + m_aConfigItem.AppendItem(m_eList, sURL, ::rtl::OUString(), sTitle, sPassword); +} + +//============================================================================= +::rtl::OUString HistoryOptTest::impl_createItemURL(::sal_Int32 nItem) +{ + ::rtl::OUStringBuffer sURL(256); + sURL.appendAscii("file:///ooo_api_test/non_existing_test_url_"); + sURL.append ((::sal_Int32)nItem ); + sURL.appendAscii(".odt" ); + + return sURL.makeStringAndClear(); +} + +//============================================================================= +::rtl::OUString HistoryOptTest::impl_createItemTitle(::sal_Int32 nItem) +{ + ::rtl::OUStringBuffer sTitle(256); + sTitle.appendAscii("Non Existing Test Item Nr "); + sTitle.append ((::sal_Int32)nItem ); + + return sTitle.makeStringAndClear(); +} + +//============================================================================= +::rtl::OUString HistoryOptTest::impl_createItemPassword(::sal_Int32 nItem) +{ + ::rtl::OUStringBuffer sPassword(256); + sPassword.appendAscii("Password_" ); + sPassword.append ((::sal_Int32)nItem); + + return sPassword.makeStringAndClear(); +} + +//============================================================================= +::sal_Bool HistoryOptTest::impl_existsItem(::sal_Int32 nItem) +{ + const ::rtl::OUString sURL = impl_createItemURL(nItem); + const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > lItems = m_aConfigItem.GetList(m_eList); + const ::sal_Int32 c = lItems.getLength (); + ::sal_Int32 i = 0; + ::sal_Bool bFound = sal_False; + + for (i=0; i xItemList = impl_getItemList(); + css::uno::Reference< css::container::XNameAccess > xItem ; + xItemList->getByName(sURL) >>= xItem; + + bFound = xItem.is(); + } + catch(const css::container::NoSuchElementException&) + {} + + return bFound; +} + +//============================================================================= +::sal_Bool HistoryOptTest::impl_existsItemAtIndex(::sal_Int32 nItem , + ::sal_Int32 nIndex) +{ + const ::rtl::OUString sURL = impl_createItemURL(nItem); + const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > lItems = m_aConfigItem.GetList(m_eList); + const ::sal_Int32 c = lItems.getLength (); + ::sal_Bool bFound = sal_False; + + if (nIndex >= c) + return sal_False; + + const ::comphelper::SequenceAsHashMap aItem(lItems[nIndex]); + ::rtl::OUString sCheck = aItem.getUnpackedValueOrDefault(s_sURL, ::rtl::OUString()); + + bFound = sCheck.equals(sURL); + if ( ! bFound) + return sal_False; + bFound = sal_False; + + try + { + css::uno::Reference< css::container::XNameAccess > xItemList = impl_getItemList(); + css::uno::Reference< css::container::XNameAccess > xItem ; + xItemList->getByName(sURL) >>= xItem; + + bFound = xItem.is(); + } + catch(const css::container::NoSuchElementException&) + {} + + if ( ! bFound) + return sal_False; + bFound = sal_False; + + try + { + const ::rtl::OUString sOrder = ::rtl::OUString::valueOf(nIndex); + css::uno::Reference< css::container::XNameAccess > xOrderList = impl_getOrderList(); + css::uno::Reference< css::container::XNameAccess > xOrder ; + xOrderList->getByName(sOrder) >>= xOrder; + + if (xOrder.is()) + { + xOrder->getByName(s_sHistoryItemRef) >>= sCheck; + bFound = sCheck.equals(sURL); + } + } + catch(const css::container::NoSuchElementException&) + {} + + return bFound; +} + +//============================================================================= +css::uno::Reference< css::container::XNameAccess > HistoryOptTest::impl_getItemList() +{ + css::uno::Reference< css::container::XNameAccess > xHistory = impl_getNewHistory(); + css::uno::Reference< css::container::XNameAccess > xList ; + xHistory->getByName (s_sItemList) >>= xList; + + if ( ! xList.is()) + throw css::uno::Exception(MESSAGE_MISS_ITEMLIST, 0); + + return xList; +} + +//============================================================================= +css::uno::Reference< css::container::XNameAccess > HistoryOptTest::impl_getOrderList() +{ + css::uno::Reference< css::container::XNameAccess > xHistory = impl_getNewHistory(); + css::uno::Reference< css::container::XNameAccess > xList ; + xHistory->getByName (s_sOrderList) >>= xList; + + if ( ! xList.is()) + throw css::uno::Exception(MESSAGE_MISS_ORDERLIST, 0); + + return xList; +} + +//============================================================================= +css::uno::Reference< css::container::XNameAccess > HistoryOptTest::impl_getNewHistory() +{ + if ( ! m_xHistoriesXCU.is()) + { + m_xHistoriesXCU = css::uno::Reference< css::container::XNameAccess >( + ::comphelper::ConfigurationHelper::openConfig( + ::utl::getProcessServiceFactory(), + s_sHistories, + ::comphelper::ConfigurationHelper::E_STANDARD), + css::uno::UNO_QUERY_THROW); + } + + css::uno::Reference< css::container::XNameAccess > xHistory; + + switch (m_eList) + { + case ePICKLIST : + m_xHistoriesXCU->getByName(s_sPickList) >>= xHistory; + break; + + case eHISTORY : + m_xHistoriesXCU->getByName(s_sURLHistory) >>= xHistory; + break; + + case eHELPBOOKMARKS : + m_xHistoriesXCU->getByName(s_sHelpBookmarks) >>= xHistory; + break; + } + + if ( ! xHistory.is()) + throw css::uno::Exception(MESSAGE_MISS_HISTORY, 0); + + return xHistory; +} + +//============================================================================= +css::uno::Reference< css::container::XNameAccess > HistoryOptTest::impl_getOldHistory() +{ + if ( ! m_xCommonXCU.is()) + { + m_xCommonXCU = css::uno::Reference< css::container::XNameAccess >( + ::comphelper::ConfigurationHelper::openConfig( + ::utl::getProcessServiceFactory(), + s_sCommonHistory, + ::comphelper::ConfigurationHelper::E_STANDARD), + css::uno::UNO_QUERY_THROW); + } + + css::uno::Reference< css::container::XNameAccess > xHistory; + + switch (m_eList) + { + case ePICKLIST : + m_xCommonXCU->getByName(s_sPickList) >>= xHistory; + break; + + case eHISTORY : + m_xCommonXCU->getByName(s_sURLHistory) >>= xHistory; + break; + + case eHELPBOOKMARKS : + m_xCommonXCU->getByName(s_sHelpBookmarks) >>= xHistory; + break; + } + + if ( ! xHistory.is()) + throw css::uno::Exception(MESSAGE_MISS_HISTORY, 0); + + return xHistory; +} + +/* +//============================================================================= +// clear the list in XML directly when using the new Histories.xcs +void HistoryOptTest::impl_clearList(const ::rtl::OUString& sList) +{ + css::uno::Reference< css::container::XNameAccess > xListAccess; + css::uno::Reference< css::container::XNameContainer > xItemOrder; + css::uno::Reference< css::beans::XPropertySet > xFirstItem; + css::uno::Sequence< ::rtl::OUString > sFileList; + + if (sList.equalsAscii("PickList")) + m_xCfg->getByName(s_sPickList) >>= xListAccess; + + else if (sList.equalsAscii("URLHistory")) + m_xCfg->getByName(s_sURLHistory) >>= xListAccess; + + else if (sList.equalsAscii("HelpBookmarks")) + m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess; + + if (xListAccess.is()) + { + xListAccess->getByName(s_sItemList) >>= xItemOrder ; + sFileList = xItemOrder->getElementNames(); + for(sal_Int32 i=0; iremoveByName(sFileList[i]); + + xListAccess->getByName(s_sOrderList) >>= xItemOrder ; + sFileList = xItemOrder->getElementNames(); + for(sal_Int32 j=0; jremoveByName(sFileList[j]); + + xFirstItem = css::uno::Reference< css::beans::XPropertySet >(xListAccess, css::uno::UNO_QUERY); + xFirstItem->setPropertyValue( s_sFirstItem, css::uno::makeAny((sal_Int32)0) ); + + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } +} + +//============================================================================= +// use configuration API (not ConfigItem!) to verify the results within XML ! +sal_Bool HistoryOptTest::impl_isListEmpty(const ::rtl::OUString& sList) +{ + css::uno::Reference< css::container::XNameAccess > xListAccess; + css::uno::Reference< css::container::XNameAccess > xItemList; + css::uno::Reference< css::container::XNameAccess > xOrderList; + sal_Bool bRet = sal_True; + + if (sList.equalsAscii("PickList")) + m_xCfg->getByName(s_sPickList) >>= xListAccess; + + else if (sList.equalsAscii("URLHistory")) + m_xCfg->getByName(s_sURLHistory) >>= xListAccess; + + else if (sList.equalsAscii("HelpBookmarks")) + m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess; + + if (xListAccess.is()) + { + xListAccess->getByName(s_sItemList) >>= xItemList; + xListAccess->getByName(s_sOrderList) >>= xOrderList; + + css::uno::Sequence< ::rtl::OUString > sItemList = xItemList->getElementNames(); + css::uno::Sequence< ::rtl::OUString > sOrderList = xOrderList->getElementNames(); + if (sItemList.getLength()!=0 || sOrderList.getLength()!=0) + bRet = sal_False; + } + + return bRet; +} + +//============================================================================= +// append a item: use configuration API (not ConfigItem!) to verify the results within XML ! +void HistoryOptTest::impl_appendItem(const ::rtl::OUString& sList) +{//to do... +} + +//============================================================================= +// test SvtHistoryOptions::GetSize() +void HistoryOptTest::impl_checkGetSize(const ::rtl::OUString& sList) +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCommonXCU, css::uno::UNO_QUERY); + + sal_uInt32 nSize = 0; + sal_uInt32 nSize_ = 0; + + if (sList.equalsAscii("PickList")) + { + nSize = aHistoryOpt.GetSize(ePICKLIST); + + xSet->setPropertyValue(s_sPickListSize, css::uno::makeAny(nSize+1)); + ::comphelper::ConfigurationHelper::flush(m_xCommonXCU); + + nSize_ = aHistoryOpt.GetSize(ePICKLIST); + if (nSize_ == nSize) + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetSize(ePICKLIST) error!")), 0); + } + + else if (sList.equalsAscii("URLHistory")) + { + nSize = aHistoryOpt.GetSize(eHISTORY); + + xSet->setPropertyValue(s_sURLHistorySize, css::uno::makeAny(nSize+1)); + ::comphelper::ConfigurationHelper::flush(m_xCommonXCU); + + nSize_ = aHistoryOpt.GetSize(eHISTORY); + + if (nSize_ == nSize) + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetSize(eHISTORY) error!")), 0); + } + + else if (sList.equalsAscii("HelpBookmarks")) + { + nSize = aHistoryOpt.GetSize(eHELPBOOKMARKS); + + xSet->setPropertyValue(s_sHelpBookmarksSize, css::uno::makeAny(nSize+1)); + ::comphelper::ConfigurationHelper::flush(m_xCommonXCU); + + nSize_ = aHistoryOpt.GetSize(eHELPBOOKMARKS); + + if (nSize_ == nSize) + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetSize(eHELPBOOKMARKS) error!")), 0); + } +} + +//============================================================================= +// test SvtHistoryOptions::SetSize() +void HistoryOptTest::impl_checkSetSize(const ::rtl::OUString& sList) +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCommonXCU, css::uno::UNO_QUERY); + + sal_uInt32 nSize = 0; + sal_uInt32 nSize_ = 0; + + if (sList.equalsAscii("PickList")) + { + xSet->getPropertyValue(s_sPickListSize) >>= nSize; + aHistoryOpt.SetSize(ePICKLIST, (nSize+1)); + xSet->getPropertyValue(s_sPickListSize) >>= nSize_; + + if (nSize_ == nSize) //old config item will throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetSize(ePICKLIST) error!")), 0); + } + + else if (sList.equalsAscii("URLHistory")) + { + xSet->getPropertyValue(s_sURLHistorySize) >>= nSize; + aHistoryOpt.SetSize(eHISTORY, (nSize+1)); + xSet->getPropertyValue(s_sURLHistorySize) >>= nSize_; + + if (nSize_ == nSize) //old config item will throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetSize(eHISTORY) error!")), 0); + } + + else if (sList.equalsAscii("HelpBookmarks")) + { + xSet->getPropertyValue(s_sHelpBookmarksSize) >>= nSize; + aHistoryOpt.SetSize(eHELPBOOKMARKS, (nSize+1)); + xSet->getPropertyValue(s_sHelpBookmarksSize) >>= nSize_; + + if (nSize_ == nSize) //old config item will throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetSize(eHELPBOOKMARKS) error!")), 0); + } +} + +//============================================================================= +// test SvtHistoryOptions::Clear() +void HistoryOptTest::impl_checkClear(const ::rtl::OUString& sList) +{ + if (sList.equalsAscii("PickList")) + { + aHistoryOpt.Clear(ePICKLIST); + if ( !impl_isListEmpty(s_sPickList) ) + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Clear(ePICKLIST) error!")), 0); + } + + else if (sList.equalsAscii("URLHistory")) + { + aHistoryOpt.Clear(eHISTORY); + if ( !impl_isListEmpty(s_sURLHistory) ) + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Clear(eHISTORY) error!")), 0); + } + + else if (sList.equalsAscii("HelpBookmarks")) + { + aHistoryOpt.Clear(eHELPBOOKMARKS); + if ( !impl_isListEmpty(s_sHelpBookmarks) ) + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Clear(eHELPBOOKMARKS) error!")), 0); + } +} + +//============================================================================= +// test SvtHistoryOptions::GetList() +void HistoryOptTest::impl_checkGetList(const ::rtl::OUString& sList) +{ + if (sList.equalsAscii("PickList")) + { + impl_clearList(s_sPickList); + aHistoryOpt.AppendItem( ePICKLIST , + ::rtl::OUString::createFromAscii("file:///c/test1"), + ::rtl::OUString::createFromAscii(""), + ::rtl::OUString::createFromAscii(""), + ::rtl::OUString::createFromAscii("") ); + css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aHistoryList = aHistoryOpt.GetList( ePICKLIST ); + + if ( aHistoryList.getLength()==0 ) + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetList(ePICKLIST) error!")), 0); + } + + else if (sList.equalsAscii("URLHistory")) + { + impl_clearList(s_sURLHistory); + aHistoryOpt.AppendItem( eHISTORY , + ::rtl::OUString::createFromAscii("file:///c/test1"), + ::rtl::OUString::createFromAscii(""), + ::rtl::OUString::createFromAscii(""), + ::rtl::OUString::createFromAscii("") ); + css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aHistoryList = aHistoryOpt.GetList( eHISTORY ); + + if ( aHistoryList.getLength()==0 ) + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetList(eHISTORY) error!")), 0); + } + + else if (sList.equalsAscii("HelpBookmarks")) + { + impl_clearList(s_sHelpBookmarks); + aHistoryOpt.AppendItem( eHELPBOOKMARKS , + ::rtl::OUString::createFromAscii("file:///c/test1"), + ::rtl::OUString::createFromAscii(""), + ::rtl::OUString::createFromAscii(""), + ::rtl::OUString::createFromAscii("") ); + css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aHistoryList = aHistoryOpt.GetList( eHELPBOOKMARKS ); + + if ( aHistoryList.getLength()==0 ) + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetList(eHELPBOOKMARKS) error!")), 0); + } +} + +void HistoryOptTest::impl_checkAppendItem(const ::rtl::OUString& sList) +{ + if (sList.equalsAscii("PickList")) + { + impl_clearList(s_sPickList); + sal_Int32 nListSize = aHistoryOpt.GetSize(ePICKLIST); + + for (sal_Int32 i=0; i +#include + +namespace css = ::com::sun::star; + +class HistoryOptTest +{ + public: + + HistoryOptTest(); + virtual ~HistoryOptTest(); + + //--------------------------------------------------------------------- + /** unit test of picklist */ + void checkPicklist(); + + //--------------------------------------------------------------------- + /** unit test of URL list */ + void checkURLHistory(); + + //--------------------------------------------------------------------- + /** unit test of Help bookmarks */ + void checkHelpBookmarks(); + + private: + + //--------------------------------------------------------------------- + /** test every well known history list in the same way. + * Only the count of created and tested items can be defined from outside + * e.g. usefull for stress tests. + * + * @param eHistory + * specify the history list for testing. + * + * @param nMaxItems + * max count of new created and tested history items. + */ + void impl_testHistory(EHistoryType eHistory , + ::sal_Int32 nMaxItems); + + //--------------------------------------------------------------------- + /** try to clear the whole list and check the results. + * If list could not be cleared successfully an exception is thrown. + */ + void impl_clearList(); + + //--------------------------------------------------------------------- + /** define a new size for the current list and check the results. + * Note: The given size must match against the defined constraints. + * That must be checked before this method is called. + * + * @param nSize + * the new size. + */ + void impl_setSize(::sal_Int32 nSize); + + //--------------------------------------------------------------------- + /** create a new item (means it's properties using a special schema using the + * item id). + * + * Note: This method does not check if creation was successfully. + * Therefore exists more specialized method impl_existsItem() + * and impl_existsItemAtPosition(). + * + * @param nItem + * id of the item + */ + void impl_appendItem(::sal_Int32 nItem); + + //--------------------------------------------------------------------- + /** check if an entry for given item id realy exists (in memory and xcu file). + * + * @param nItem + * id of the item + * + * @return true if item exists - false otherwise. + */ + ::sal_Bool impl_existsItem(::sal_Int32 nItem); + + //--------------------------------------------------------------------- + /** check if an entry for given item id realy exists (in memory and xcu file). + * Further it checks if the requested item is placed at the also specified + * position inside history list. + * + * @param nItem + * id of the item + * + * @param nIndex + * expected position of item inside history list. + * + * @return true if item exists at right position - false otherwise. + */ + ::sal_Bool impl_existsItemAtIndex(::sal_Int32 nItem , + ::sal_Int32 nIndex); + + //--------------------------------------------------------------------- + /** create an URL suitable for the given item id. + * + * @param nItem + * id of the item + * + * @return the new created URL. + */ + ::rtl::OUString impl_createItemURL(::sal_Int32 nItem); + + //--------------------------------------------------------------------- + /** create a title suitable for the given item id. + * + * @param nItem + * id of the item + * + * @return the new created title. + */ + ::rtl::OUString impl_createItemTitle(::sal_Int32 nItem); + + //--------------------------------------------------------------------- + /** create a password suitable for the given item id. + * + * @param nItem + * id of the item + * + * @return the new created password. + */ + ::rtl::OUString impl_createItemPassword(::sal_Int32 nItem); + + //--------------------------------------------------------------------- + /** returns direct access to the item list inside histories.xcu + * suitable for the current defined list type (m_eList). + * + * @return reference to the item list configuration + */ + css::uno::Reference< css::container::XNameAccess > impl_getItemList(); + + //--------------------------------------------------------------------- + /** returns direct access to the order list inside histories.xcu + * suitable for the current defined list type (m_eList). + * + * @return reference to the order list configuration + */ + css::uno::Reference< css::container::XNameAccess > impl_getOrderList(); + + //--------------------------------------------------------------------- + /** returns direct access to the history list inside histories.xcu + * suitable for the current defined list type (m_eList). + * + * @return reference to the history list configuration + */ + css::uno::Reference< css::container::XNameAccess > impl_getNewHistory(); + + //--------------------------------------------------------------------- + /** returns direct access to the history config inside common.xcu + * suitable for the current defined list type (m_eList). + * + * @return reference to the history configuration + */ + css::uno::Reference< css::container::XNameAccess > impl_getOldHistory(); + + private: + + // the config item which should be tested here + SvtHistoryOptions m_aConfigItem; + + // defines the special list for testing (picklist, history or url list) + EHistoryType m_eList; + + // underlying configuration of the tested config items for cross over checks + css::uno::Reference< css::container::XNameAccess > m_xHistoriesXCU; + + // underlying configuration of the tested config items for cross over checks + css::uno::Reference< css::container::XNameAccess > m_xCommonXCU; +}; + +#endif // #ifndef SVTOOLS_HISTORYOPTTEST_HXX diff --git a/svl/qa/complex/ConfigItems/helper/PrintOptTest.cxx b/svl/qa/complex/ConfigItems/helper/PrintOptTest.cxx new file mode 100644 index 000000000000..69504e4d5d7e --- /dev/null +++ b/svl/qa/complex/ConfigItems/helper/PrintOptTest.cxx @@ -0,0 +1,743 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: PrintOptTest.cxx,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:09:24 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#include "PrintOptTest.hxx" + +#include + +#include +#include + +namespace css = ::com::sun::star; + +// using test only +#define ROOTNODE_PRINTOPTION rtl::OUString::createFromAscii("org.openoffice.Office.Common/Print/Option") +#define PROPERTYNAME_REDUCETRANSPARENCY rtl::OUString::createFromAscii("ReduceTransparency") +#define PROPERTYNAME_REDUCEDTRANSPARENCYMODE rtl::OUString::createFromAscii("ReducedTransparencyMode") +#define PROPERTYNAME_REDUCEGRADIENTS rtl::OUString::createFromAscii("ReduceGradients") +#define PROPERTYNAME_REDUCEDGRADIENTMODE rtl::OUString::createFromAscii("ReducedGradientMode") +#define PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT rtl::OUString::createFromAscii("ReducedGradientStepCount") +#define PROPERTYNAME_REDUCEBITMAPS rtl::OUString::createFromAscii("ReduceBitmaps") +#define PROPERTYNAME_REDUCEDBITMAPMODE rtl::OUString::createFromAscii("ReducedBitmapMode") +#define PROPERTYNAME_REDUCEDBITMAPRESOLUTION rtl::OUString::createFromAscii("ReducedBitmapResolution") +#define PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY rtl::OUString::createFromAscii("ReducedBitmapIncludesTransparency") +#define PROPERTYNAME_CONVERTTOGREYSCALES rtl::OUString::createFromAscii("ConvertToGreyscales") + +PrintOptTest::PrintOptTest() +{ + m_xCfg = css::uno::Reference< css::container::XNameAccess >( + ::comphelper::ConfigurationHelper::openConfig( + ::utl::getProcessServiceFactory(), + rtl::OUString::createFromAscii("org.openoffice.Office.Common/Print/Option"), + ::comphelper::ConfigurationHelper::E_STANDARD), + css::uno::UNO_QUERY); + + if (m_xCfg.is()) + { + //UniString sTmp = UniString("printer"); + //xub_StrLen nTokenCount = sTmp.GetTokenCount('/'); + //sTmp = sTmp.GetToken(nTokenCount - 1, '/'); + m_xCfg->getByName(rtl::OUString::createFromAscii("Printer")) >>= m_xNode; + } +} + +sal_Int16 PrintOptTest::impl_GetReducedTransparencyMode() const +{ + sal_Int16 nRet = 0; + if (m_xNode.is()) + { + css::uno::Reference< css::beans::XPropertySet > xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + xSet->getPropertyValue(PROPERTYNAME_REDUCEDTRANSPARENCYMODE) >>= nRet; + } + return nRet; +} +void PrintOptTest::impl_SetReducedTransparencyMode(sal_Int16 nMode ) +{ + if (m_xNode.is()) + { + css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + sal_Int16 nUpdate; + xSet->getPropertyValue(PROPERTYNAME_REDUCEDTRANSPARENCYMODE) >>= nUpdate; + if (nUpdate != nMode) + { + xSet->setPropertyValue( PROPERTYNAME_REDUCEDTRANSPARENCYMODE, css::uno::makeAny(nMode)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + } +} + +sal_Bool PrintOptTest::impl_IsReduceTransparency() const +{ + sal_Bool bRet = sal_False; + if (m_xNode.is()) + { + css::uno::Reference< css::beans::XPropertySet > xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + xSet->getPropertyValue(PROPERTYNAME_REDUCETRANSPARENCY) >>= bRet; + } + return bRet; +} +void PrintOptTest::impl_SetReduceTransparency(sal_Bool bState ) +{ + if (m_xNode.is()) + { + css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + sal_Bool bUpdate; + xSet->getPropertyValue(PROPERTYNAME_REDUCETRANSPARENCY) >>= bUpdate; + if (bUpdate != bState) + { + xSet->setPropertyValue( PROPERTYNAME_REDUCETRANSPARENCY, css::uno::makeAny(bState)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + } +} + +sal_Bool PrintOptTest::impl_IsReduceGradients() const +{ + sal_Bool bRet = sal_False; + if (m_xNode.is()) + { + css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + xSet->getPropertyValue(PROPERTYNAME_REDUCEGRADIENTS) >>= bRet; + } + } + return bRet; +} + +void PrintOptTest::impl_SetReduceGradients(sal_Bool bState ) +{ + if (m_xNode.is()) + { + css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + sal_Bool bUpdate; + xSet->getPropertyValue(PROPERTYNAME_REDUCEGRADIENTS) >>= bUpdate; + if (bUpdate != bState) + { + xSet->setPropertyValue( PROPERTYNAME_REDUCEGRADIENTS, css::uno::makeAny(bState)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + } +} + +sal_Int16 PrintOptTest::impl_GetReducedGradientMode() const +{ + sal_Int16 nRet = 0; + if (m_xNode.is()) + { + css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTMODE) >>= nRet; + } + } + return nRet; +} + +void PrintOptTest::impl_SetReducedGradientMode(sal_Int16 nMode ) +{ + if (m_xNode.is()) + { + css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + sal_Int16 nUpdate; + xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTMODE) >>= nUpdate; + if (nUpdate != nMode) + { + xSet->setPropertyValue( PROPERTYNAME_REDUCEDGRADIENTMODE, css::uno::makeAny(nMode)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + } +} + +sal_Int16 PrintOptTest::impl_GetReducedGradientStepCount() const +{ + sal_Int16 nRet = 64; + if (m_xNode.is()) + { + css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT) >>= nRet; + } + } + return nRet; +} +void PrintOptTest::impl_SetReducedGradientStepCount(sal_Int16 nStepCount ) +{ + if (m_xNode.is()) + { + css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + sal_Int16 nUpdate; + xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT) >>= nUpdate; + if (nUpdate != nStepCount) + { + xSet->setPropertyValue( PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT, css::uno::makeAny(nStepCount)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + } +} + +sal_Bool PrintOptTest::impl_IsReduceBitmaps() const +{ + sal_Bool bRet = sal_False; + if (m_xNode.is()) + { + css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + xSet->getPropertyValue(PROPERTYNAME_REDUCEBITMAPS) >>= bRet; + } + } + return bRet; +} + +void PrintOptTest::impl_SetReduceBitmaps(sal_Bool bState ) +{ + if (m_xNode.is()) + { + css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + sal_Bool bUpdate; + xSet->getPropertyValue(PROPERTYNAME_REDUCEBITMAPS) >>= bUpdate; + if (bUpdate != bState) + { + xSet->setPropertyValue( PROPERTYNAME_REDUCEBITMAPS, css::uno::makeAny(bState)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + } +} + +sal_Int16 PrintOptTest::impl_GetReducedBitmapMode() const +{ + sal_Int16 nRet = 1; + if (m_xNode.is()) + { + css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPMODE) >>= nRet; + } + } + return nRet; +} + +void PrintOptTest::impl_SetReducedBitmapMode(sal_Int16 nMode ) +{ + if (m_xNode.is()) + { + css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + sal_Int16 nUpdate; + xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPMODE) >>= nUpdate; + if (nUpdate != nMode) + { + xSet->setPropertyValue( PROPERTYNAME_REDUCEDBITMAPMODE, css::uno::makeAny(nMode)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + } +} + +sal_Int16 PrintOptTest::impl_GetReducedBitmapResolution() const +{ + sal_Int16 nRet = 3; + if (m_xNode.is()) + { + css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPRESOLUTION) >>= nRet; + } + } + return nRet; +} + +void PrintOptTest::impl_SetReducedBitmapResolution(sal_Int16 nResolution ) +{ + if (m_xNode.is()) + { + css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + sal_Int16 nUpdate; + xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPRESOLUTION) >>= nUpdate; + if (nUpdate != nResolution) + { + xSet->setPropertyValue( PROPERTYNAME_REDUCEDBITMAPRESOLUTION, css::uno::makeAny(nResolution)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + } +} + +sal_Bool PrintOptTest::impl_IsReducedBitmapIncludesTransparency() const +{ + sal_Bool bRet = sal_True; + if (m_xNode.is()) + { + css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY) >>= bRet; + } + } + return bRet; +} + +void PrintOptTest::impl_SetReducedBitmapIncludesTransparency(sal_Bool bState ) +{ + if (m_xNode.is()) + { + css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + sal_Bool bUpdate; + xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY) >>= bUpdate; + if (bUpdate != bState) + { + xSet->setPropertyValue( PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY, css::uno::makeAny(bState)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + } +} + +sal_Bool PrintOptTest::impl_IsConvertToGreyscales() const +{ + sal_Bool bRet = sal_False; + if (m_xNode.is()) + { + css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + xSet->getPropertyValue(PROPERTYNAME_CONVERTTOGREYSCALES) >>= bRet; + } + } + return bRet; +} + +void PrintOptTest::impl_SetConvertToGreyscales(sal_Bool bState ) +{ + if (m_xNode.is()) + { + css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + sal_Bool bUpdate; + xSet->getPropertyValue(PROPERTYNAME_CONVERTTOGREYSCALES) >>= bUpdate; + if (bUpdate != bState) + { + xSet->setPropertyValue( PROPERTYNAME_CONVERTTOGREYSCALES, css::uno::makeAny(bState)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + } +} + + +PrintOptTest::~PrintOptTest() +{ +} + +void PrintOptTest::impl_checkPrint() +{ + //test SetReduceTransparency() + sal_Bool bNewValue = sal_False; + sal_Bool bOldValue = sal_False; + bOldValue = PrintOptTest::impl_IsReduceTransparency(); + bNewValue = !bOldValue; + aPrintOpt.SetReduceTransparency(bNewValue) ; + bNewValue = impl_IsReduceTransparency(); + // if(bNewValue != bOldValue) // test the old source + if ( bNewValue == bOldValue ) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the SetReduceTransparency() error!"), + 0); + } + + //test IsReduceTransparemcy() + bNewValue = bOldValue = sal_False; + bOldValue = impl_IsReduceTransparency(); + bNewValue = !bOldValue; + impl_SetReduceTransparency(bNewValue); + bNewValue = aPrintOpt.IsReduceTransparency(); + //if(bNewValue != bOldValue) // test the old source + if(bNewValue == bOldValue) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the IsReduceTransparency() error!"), + 0); + } + + // test SetReducedTransparencyMode() + sal_Int16 nOldMode, nNewMode; + nOldMode = nNewMode = 0; + nOldMode = impl_GetReducedTransparencyMode(); + nNewMode = nOldMode + 1; + aPrintOpt.SetReducedTransparencyMode( nNewMode ); + nNewMode = impl_GetReducedTransparencyMode(); + //if(nNewMode != nOldMode) // test the old source + if ( nNewMode == nOldMode ) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the SetReducedTransparencyMode() error!"), + 0); + } + + //test IsReducedTransparencyMode() + nOldMode = nNewMode = 0; + nOldMode = impl_GetReducedTransparencyMode(); + nNewMode = nOldMode + 1; + impl_SetReducedTransparencyMode(nNewMode); + nNewMode = aPrintOpt.GetReducedTransparencyMode(); + //if(nNewMode != nOldMode) // test the old source + if(nNewMode == nOldMode) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the IsReducedTransparencyMode() error!" + "nOldMode's value is :"), + 0); + } + + // test the SetReduceGradients() + bNewValue = bOldValue = sal_False; + bOldValue = impl_IsReduceGradients(); + bNewValue = !bOldValue; + aPrintOpt.SetReduceGradients(bNewValue); + bNewValue = impl_IsReduceGradients(); + //if (bNewValue != bOldValue) //test the old source + if (bNewValue == bOldValue) //test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the SetReduceGradients() error!"), + 0); + + } + + // test the IsReduceGradients() + bNewValue = bOldValue = sal_False; + bOldValue = impl_IsReduceGradients(); + bNewValue = !bOldValue; + this->impl_SetReduceGradients(bNewValue); + bNewValue = aPrintOpt.IsReduceGradients(); + // if (bNewValue != bOldValue) // test the old source + if (bNewValue == bOldValue) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the IsReduceGradients() error!"), + 0); + + } + + //test SetRedecedGradientMode() + nOldMode = nNewMode = 0; + nOldMode = this->impl_GetReducedGradientMode(); + nNewMode = nOldMode + 1; + aPrintOpt.SetReducedGradientMode(nNewMode); + nNewMode = this->impl_GetReducedGradientMode(); + //if (nNewMode != nOldMode) // test the old source + if (nNewMode == nOldMode)// test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the SetRedecedGradientMode() error!"), + 0); + } + + // test GetReducedGradientMode() + nOldMode = nNewMode = 0; + nOldMode = this->impl_GetReducedGradientMode(); + nNewMode = nOldMode + 1; + this->impl_SetReducedGradientMode(nNewMode); + nNewMode = aPrintOpt.GetReducedGradientMode(); + //if (nNewMode != nOldMode) // test the old source + if (nNewMode == nOldMode) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the GetReducedGradientMode() error!"), + 0); + + } + + //test the SetReducedGradientStepCount() + sal_Int16 nNewStepCount; + sal_Int16 nOldStepCount; + nNewStepCount = nOldStepCount = 0; + nOldStepCount = this->impl_GetReducedGradientStepCount(); + nNewStepCount = nOldStepCount + 1; + aPrintOpt.SetReducedGradientStepCount(nNewStepCount); + nNewStepCount = this->impl_GetReducedGradientStepCount(); + // if (nNewStepCount != nOldStepCount) // test the old source + if (nNewStepCount == nOldStepCount) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the SetReducedGradientStepCount() error!"), + 0); + + } + + // test the GetReduceGradientStepCount() + nNewStepCount = nOldStepCount = 0; + nOldStepCount = this->impl_GetReducedGradientStepCount(); + nNewStepCount = nOldStepCount + 1; + this->impl_SetReducedGradientStepCount(nNewStepCount); + nNewStepCount = aPrintOpt.GetReducedGradientStepCount(); + // if (nNewStepCount != nOldStepCount) //test the old source + if (nNewStepCount == nOldStepCount) //test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the GetReduceGradientStepCount() error!"), + 0); + } + + // test the SetReduceBitmaps() + bNewValue = bOldValue = sal_False; + bOldValue = this->impl_IsReduceBitmaps(); + bNewValue = !bOldValue; + aPrintOpt.SetReduceBitmaps(bNewValue); + bNewValue = this->impl_IsReduceBitmaps(); + //if (bNewValue != bOldValue) // test the old source + if (bNewValue == bOldValue) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the SetReduceBitmaps() error!"), + 0); + } + + // test the IsReduceBitmaps() + bNewValue = bOldValue = sal_False; + bOldValue = this->impl_IsReduceBitmaps(); + bNewValue = !bOldValue; + this->impl_SetReduceBitmaps(bNewValue); + bNewValue = aPrintOpt.IsReduceBitmaps(); + //if (bNewValue != bOldValue) // test the old source + if (bNewValue == bOldValue) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the IsReduceBitmaps() error!"), + 0); + } + + // test the SetReduceBitmap() + nNewMode = nOldMode = 0; + nOldMode = impl_GetReducedBitmapMode(); + nNewMode = nOldMode + 1; + aPrintOpt.SetReducedBitmapMode(nNewMode); + nNewMode = impl_GetReducedBitmapMode(); + //if (nNewMode != nOldMode) // test the old source + if (nNewMode == nOldMode)// test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the SetReduceBitmap() error!"), + 0); + } + + // test the SetReduceBitmapMode() + nNewMode = nOldMode = 0; + nOldMode = this->impl_GetReducedBitmapMode(); + nNewMode = nOldMode + 1; + aPrintOpt.SetReducedBitmapMode(nNewMode); + nNewMode = this->impl_GetReducedBitmapMode(); + //if (nNewMode != nOldMode) // test the old source + if (nNewMode == nOldMode) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the SetReduceBitmapMode() error!"), + 0); + } + + // test the GetReduceBitmapMode() + nNewMode = nOldMode = 0; + nOldMode = this->impl_GetReducedBitmapMode(); + nNewMode = nOldMode + 1; + this->impl_SetReducedBitmapMode(nNewMode); + nNewMode = aPrintOpt.GetReducedBitmapMode(); + //if (nNewMode != nOldMode) // test the old source + if (nNewMode == nOldMode)// test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the GetReduceBitmapMode() error!"), + 0); + + } + + // test the SetReducedBitmapResolution() + sal_Int16 nOldResolution ; + sal_Int16 nNewResolution ; + nNewResolution = nOldResolution = 0; + nOldResolution = impl_GetReducedBitmapResolution(); + nNewResolution = nOldResolution + 1; + aPrintOpt.SetReducedBitmapResolution(nNewResolution); + nNewResolution = impl_GetReducedBitmapResolution(); + //if (nNewResolution != nOldResolution) // test the old source + if (nNewResolution == nOldResolution)// test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the SetReducedBitmapResolution() error!"), + 0); + } + + // test the GetReduceBitmapResolution() + nNewResolution = nOldResolution = 0; + nOldResolution = impl_GetReducedBitmapResolution(); + nNewResolution = nOldResolution + 1; + impl_SetReducedBitmapResolution(nNewResolution); + nNewResolution = impl_GetReducedBitmapResolution(); + //if (nNewResolution != nOldResolution) // test the old source + if (nNewResolution == nOldResolution) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the GetReduceBitmapResolution() error!"), + 0); + } + + // test SetReducedBitmapIncludesTransparency() + bNewValue = bOldValue = sal_False; + bOldValue = impl_IsReducedBitmapIncludesTransparency(); + bNewValue = !bOldValue; + aPrintOpt.SetReducedBitmapIncludesTransparency(bNewValue); + bNewValue = impl_IsReducedBitmapIncludesTransparency(); + //if (bNewValue != bOldValue) // test the new source + if (bNewValue == bOldValue) // test the old source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the SetReducedBitmapIncludesTransparency() error!"), + 0); + } + + // test the IsReducedBitmapIncludesTransparency() + bNewValue = bOldValue = sal_False; + bOldValue = impl_IsReducedBitmapIncludesTransparency(); + bNewValue = !bOldValue; + impl_SetReducedBitmapIncludesTransparency(bNewValue); + bNewValue = aPrintOpt.IsReducedBitmapIncludesTransparency(); + //if (bNewValue != bOldValue) // test the old source + if (bNewValue == bOldValue) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the IsReducedBitmapIncludesTransparency() error!"), + 0); + } + + // test the SetConvertToGreyscales() + bNewValue = bOldValue = sal_False; + bOldValue = this->impl_IsConvertToGreyscales(); + bNewValue = !bOldValue; + aPrintOpt.SetConvertToGreyscales(bNewValue); + bNewValue = this->impl_IsConvertToGreyscales(); + //if (bNewValue != bOldValue) // test the old source + if (bNewValue == bOldValue) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the SetConvertToGreyscales() error!"), + 0); + } + + // test the IsConvertToGreyscales() + bNewValue = bOldValue = sal_False; + bOldValue = this->impl_IsConvertToGreyscales(); + bNewValue = !bOldValue; + impl_SetConvertToGreyscales(bNewValue); + bNewValue = aPrintOpt.IsConvertToGreyscales(); + //if (bNewValue != bOldValue) // test the old source + if (bNewValue == bOldValue) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the IsConvertToGreyscales() error!"), + 0); + } +} diff --git a/svl/qa/complex/ConfigItems/helper/PrintOptTest.hxx b/svl/qa/complex/ConfigItems/helper/PrintOptTest.hxx new file mode 100644 index 000000000000..14d4267b8878 --- /dev/null +++ b/svl/qa/complex/ConfigItems/helper/PrintOptTest.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: PrintOptTest.hxx,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:09:24 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef SVTOOLS_PRINTOPTTEST_HXX +#define SVTOOLS_PRINTOPTTEST_HXX + +#include +#include + +namespace css = ::com::sun::star; + +class PrintOptTest +{ +public: + + PrintOptTest(); + ~PrintOptTest(); + + void impl_checkPrint(); + +private: //members + + SvtPrinterOptions aPrintOpt; + css::uno::Reference< css::container::XNameAccess > m_xCfg; + css::uno::Reference< css::container::XNameAccess > m_xNode; + +private: // methods + sal_Bool impl_IsReduceTransparency() const ; + void impl_SetReduceTransparency( sal_Bool bState ) ; + + sal_Int16 impl_GetReducedTransparencyMode() const ; + void impl_SetReducedTransparencyMode( sal_Int16 nMode ) ; + + sal_Bool impl_IsReduceGradients() const ; + void impl_SetReduceGradients( sal_Bool bState ) ; + + sal_Int16 impl_GetReducedGradientMode() const ; + void impl_SetReducedGradientMode( sal_Int16 nMode ) ; + + sal_Int16 impl_GetReducedGradientStepCount() const ; + void impl_SetReducedGradientStepCount( sal_Int16 nStepCount ); + + sal_Bool impl_IsReduceBitmaps() const ; + void impl_SetReduceBitmaps( sal_Bool bState ) ; + + sal_Int16 impl_GetReducedBitmapMode() const ; + void impl_SetReducedBitmapMode( sal_Int16 nMode ) ; + + sal_Int16 impl_GetReducedBitmapResolution() const ; + void impl_SetReducedBitmapResolution( sal_Int16 nResolution ) ; + + sal_Bool impl_IsReducedBitmapIncludesTransparency() const ; + void impl_SetReducedBitmapIncludesTransparency( sal_Bool bState ) ; + + sal_Bool impl_IsConvertToGreyscales() const; + void impl_SetConvertToGreyscales( sal_Bool bState ) ; + +}; + +#endif // #ifndef SVTOOLS_PRINTOPTTEST_HXX diff --git a/svl/qa/complex/ConfigItems/helper/UserOptTest.cxx b/svl/qa/complex/ConfigItems/helper/UserOptTest.cxx new file mode 100644 index 000000000000..14ee513ee0cb --- /dev/null +++ b/svl/qa/complex/ConfigItems/helper/UserOptTest.cxx @@ -0,0 +1,274 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: UserOptTest.cxx,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:09:24 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#include "UserOptTest.hxx" + +namespace css = ::com::sun::star; + +//============================================================================= +static const ::rtl::OUString MESSAGE_SETCOMPANY_FAILED = ::rtl::OUString::createFromAscii("set company failed") ; +static const ::rtl::OUString MESSAGE_SETFIRSTNAME_FAILED = ::rtl::OUString::createFromAscii("set firstname failed") ; +static const ::rtl::OUString MESSAGE_SETLASTNAME_FAILED = ::rtl::OUString::createFromAscii("set lastname failed") ; +static const ::rtl::OUString MESSAGE_SETID_FAILED = ::rtl::OUString::createFromAscii("set ID failed") ; +static const ::rtl::OUString MESSAGE_SETSTREET_FAILED = ::rtl::OUString::createFromAscii("set street failed") ; +static const ::rtl::OUString MESSAGE_SETCITY_FAILED = ::rtl::OUString::createFromAscii("set city failed") ; +static const ::rtl::OUString MESSAGE_SETSTATE_FAILED = ::rtl::OUString::createFromAscii("set state failed") ; +static const ::rtl::OUString MESSAGE_SETZIP_FAILED = ::rtl::OUString::createFromAscii("set zip failed") ; +static const ::rtl::OUString MESSAGE_SETCOUNTRY_FAILED = ::rtl::OUString::createFromAscii("set country failed") ; +static const ::rtl::OUString MESSAGE_SETPOSITION_FAILED = ::rtl::OUString::createFromAscii("set position failed") ; +static const ::rtl::OUString MESSAGE_SETTITLE_FAILED = ::rtl::OUString::createFromAscii("set title failed") ; +static const ::rtl::OUString MESSAGE_SETTELEPHONEHOME_FAILED = ::rtl::OUString::createFromAscii("set telephonehome failed") ; +static const ::rtl::OUString MESSAGE_SETTELEPHONEWORK_FAILED = ::rtl::OUString::createFromAscii("set telephonework failed") ; +static const ::rtl::OUString MESSAGE_SETFAX_FAILED = ::rtl::OUString::createFromAscii("set fax failed") ; +static const ::rtl::OUString MESSAGE_SETEMAIL_FAILED = ::rtl::OUString::createFromAscii("set email failed") ; +static const ::rtl::OUString MESSAGE_SETCUSTOMERNUMBER_FAILED = ::rtl::OUString::createFromAscii("set customernumber failed"); +static const ::rtl::OUString MESSAGE_SETFATHERSNAME_FAILED = ::rtl::OUString::createFromAscii("set fathersname failed") ; +static const ::rtl::OUString MESSAGE_SETAPARTMENT_FAILED = ::rtl::OUString::createFromAscii("set apartment failed") ; + +//============================================================================= + + +UserOptTest::UserOptTest() + :m_aConfigItem() + ,m_xCfg() +{ +} + +UserOptTest::~UserOptTest() +{ +} + +void UserOptTest::impl_checkUserData() +{ + impl_checkSetCompany( ::rtl::OUString() ); + impl_checkSetFirstName( ::rtl::OUString() ); + impl_checkSetLastName( ::rtl::OUString() ); + impl_checkSetID( ::rtl::OUString() ); + impl_checkSetStreet( ::rtl::OUString() ); + impl_checkSetCity( ::rtl::OUString() ); + impl_checkSetState( ::rtl::OUString() ); + impl_checkSetZip( ::rtl::OUString() ); + impl_checkSetCountry( ::rtl::OUString() ); + impl_checkSetPosition( ::rtl::OUString() ); + impl_checkSetTitle( ::rtl::OUString() ); + impl_checkSetTelephoneHome( ::rtl::OUString() ); + impl_checkSetTelephoneWork( ::rtl::OUString() ); + impl_checkSetFax( ::rtl::OUString() ); + impl_checkSetEmail( ::rtl::OUString() ); + //impl_checkSetCustomerNumber( ::rtl::OUString() ); + impl_checkSetFathersName( ::rtl::OUString() ); + impl_checkSetApartment( ::rtl::OUString() ); + + impl_checkSetCompany( ::rtl::OUString::createFromAscii("RedFlag2000") ); + impl_checkSetFirstName( ::rtl::OUString::createFromAscii("Yan") ); + impl_checkSetLastName( ::rtl::OUString::createFromAscii("Wu") ); + impl_checkSetID( ::rtl::OUString::createFromAscii("wuy") ); + impl_checkSetStreet( ::rtl::OUString::createFromAscii("SouthFifthRing") ); + impl_checkSetCity( ::rtl::OUString::createFromAscii("Beijing") ); + impl_checkSetState( ::rtl::OUString::createFromAscii("Beijing") ); + impl_checkSetZip( ::rtl::OUString::createFromAscii("100176") ); + impl_checkSetCountry( ::rtl::OUString::createFromAscii("China") ); + impl_checkSetPosition( ::rtl::OUString::createFromAscii("Engineer") ); + impl_checkSetTitle( ::rtl::OUString::createFromAscii("Software Engineer") ); + impl_checkSetTelephoneHome( ::rtl::OUString::createFromAscii("010-51570010") ); + impl_checkSetTelephoneWork( ::rtl::OUString::createFromAscii("010-51570010") ); + impl_checkSetFax( ::rtl::OUString::createFromAscii("010-51570010") ); + impl_checkSetEmail( ::rtl::OUString::createFromAscii("wuy@redflag2000.cn") ); + //impl_checkSetCustomerNumber( ::rtl::OUString::createFromAscii("87654321") ); + impl_checkSetFathersName( ::rtl::OUString::createFromAscii("father") ); + impl_checkSetApartment( ::rtl::OUString::createFromAscii("apartment") ); +} + +void UserOptTest::impl_checkSetCompany( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetCompany( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetCompany(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETCOMPANY_FAILED, 0); +} + +void UserOptTest::impl_checkSetFirstName( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetFirstName( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetFirstName(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETFIRSTNAME_FAILED, 0); +} + +void UserOptTest::impl_checkSetLastName( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetLastName( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetLastName(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETLASTNAME_FAILED, 0); +} + +void UserOptTest::impl_checkSetID( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetID( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetID(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETID_FAILED, 0); +} + +void UserOptTest::impl_checkSetStreet( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetStreet( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetStreet(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETSTREET_FAILED, 0); +} + +void UserOptTest::impl_checkSetCity( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetCity( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetCity(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETCITY_FAILED, 0); +} + +void UserOptTest::impl_checkSetState( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetState( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetState(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETSTATE_FAILED, 0); +} + +void UserOptTest::impl_checkSetZip( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetZip( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetZip(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETZIP_FAILED, 0); +} + +void UserOptTest::impl_checkSetCountry( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetCountry( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetCountry(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETCOUNTRY_FAILED, 0); +} + +void UserOptTest::impl_checkSetPosition( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetPosition( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetPosition(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETPOSITION_FAILED, 0); +} + +void UserOptTest::impl_checkSetTitle( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetTitle( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetTitle(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETTITLE_FAILED, 0); +} + +void UserOptTest::impl_checkSetTelephoneHome( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetTelephoneHome( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetTelephoneHome(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETTELEPHONEHOME_FAILED, 0); +} + +void UserOptTest::impl_checkSetTelephoneWork( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetTelephoneWork( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetTelephoneWork(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETTELEPHONEWORK_FAILED, 0); +} + +void UserOptTest::impl_checkSetFax( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetFax( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetFax(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETFAX_FAILED, 0); +} + +void UserOptTest::impl_checkSetEmail( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetEmail( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetEmail(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETEMAIL_FAILED, 0); +} + +void UserOptTest::impl_checkSetCustomerNumber( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetCustomerNumber( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetCustomerNumber(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETCUSTOMERNUMBER_FAILED, 0); +} + +void UserOptTest::impl_checkSetFathersName( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetFathersName( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetFathersName(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETFATHERSNAME_FAILED, 0); +} + +void UserOptTest::impl_checkSetApartment( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetApartment( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetApartment(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETAPARTMENT_FAILED, 0); +} diff --git a/svl/qa/complex/ConfigItems/helper/UserOptTest.hxx b/svl/qa/complex/ConfigItems/helper/UserOptTest.hxx new file mode 100644 index 000000000000..72ff71cafe2d --- /dev/null +++ b/svl/qa/complex/ConfigItems/helper/UserOptTest.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: UserOptTest.hxx,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:09:25 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef SVTOOLS_USEROPTTEST_HXX +#define SVTOOLS_USEROPTTEST_HXX + +#include +#include + +namespace css = ::com::sun::star; + +class UserOptTest +{ +public: + UserOptTest(); + ~UserOptTest(); + + void impl_checkUserData(); + +private: + void impl_checkSetCompany( const ::rtl::OUString& sUserData ); + void impl_checkSetFirstName( const ::rtl::OUString& sUserData ); + void impl_checkSetLastName( const ::rtl::OUString& sUserData ); + void impl_checkSetID( const ::rtl::OUString& sUserData ); + void impl_checkSetStreet( const ::rtl::OUString& sUserData ); + void impl_checkSetCity( const ::rtl::OUString& sUserData ); + void impl_checkSetState( const ::rtl::OUString& sUserData ); + void impl_checkSetZip( const ::rtl::OUString& sUserData ); + void impl_checkSetCountry( const ::rtl::OUString& sUserData ); + void impl_checkSetPosition( const ::rtl::OUString& sUserData ); + void impl_checkSetTitle( const ::rtl::OUString& sUserData ); + void impl_checkSetTelephoneHome( const ::rtl::OUString& sUserData ); + void impl_checkSetTelephoneWork( const ::rtl::OUString& sUserData ); + void impl_checkSetFax( const ::rtl::OUString& sUserData ); + void impl_checkSetEmail( const ::rtl::OUString& sUserData ); + void impl_checkSetCustomerNumber( const ::rtl::OUString& sUserData ); + void impl_checkSetFathersName( const ::rtl::OUString& sUserData ); + void impl_checkSetApartment( const ::rtl::OUString& sUserData ); + +private: + SvtUserOptions m_aConfigItem; + + css::uno::Reference< css::container::XNameAccess > m_xCfg; +}; + +#endif // #ifndef SVTOOLS_USEROPTTEST_HXX diff --git a/svl/qa/complex/ConfigItems/helper/exports.map b/svl/qa/complex/ConfigItems/helper/exports.map new file mode 100644 index 000000000000..85610ad80888 --- /dev/null +++ b/svl/qa/complex/ConfigItems/helper/exports.map @@ -0,0 +1,10 @@ +UDK_3_0_0 { + global: + GetVersionInfo; + component_getImplementationEnvironment; + component_getFactory; + component_writeInfo; + + local: + *; +}; diff --git a/svl/qa/complex/ConfigItems/helper/makefile.mk b/svl/qa/complex/ConfigItems/helper/makefile.mk new file mode 100644 index 000000000000..6070d25b7bd4 --- /dev/null +++ b/svl/qa/complex/ConfigItems/helper/makefile.mk @@ -0,0 +1,81 @@ +#************************************************************************* +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.4.2 $ +# +# last change: $Author: as $ $Date: 2008/03/19 11:09:25 $ +# +# The Contents of this file are made available subject to +# the terms of GNU Lesser General Public License Version 2.1. +# +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2005 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +#************************************************************************* +PRJ=..$/..$/..$/.. + +PRJNAME= svtools +TARGET= ConfigItemTest +USE_DEFFILE= TRUE +ENABLE_EXCEPTIONS= TRUE +NO_BSYMBOLIC= TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +# --- Generate ----------------------------------------------------- + +INCPOST += $(PRJ)$/source$/inc + +# --- light services library ---------------------------------------------------- + +SHL1TARGET= svt_$(TARGET) + +SHL1OBJS= \ + $(SLO)$/UserOptTest.obj \ + $(SLO)$/PrintOptTest.obj \ + $(SLO)$/AccessibilityOptTest.obj \ + $(SLO)$/HistoryOptTest.obj \ + $(SLO)$/ConfigItemTest.obj + +SHL1STDLIBS= \ + $(SVTOOLLIB) \ + $(SVLLIB) \ + $(UNOTOOLSLIB) \ + $(COMPHELPERLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(SALLIB) + +SHL1DEF= $(MISC)$/$(SHL1TARGET).def +#SHL1DEPN= $(SHL1IMPLIBN) $(SHL1TARGETN) + +DEF1NAME= $(SHL1TARGET) + +SHL1VERSIONMAP= exports.map + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + diff --git a/svl/qa/complex/ConfigItems/makefile.mk b/svl/qa/complex/ConfigItems/makefile.mk new file mode 100644 index 000000000000..f85c5b0a8e65 --- /dev/null +++ b/svl/qa/complex/ConfigItems/makefile.mk @@ -0,0 +1,91 @@ +#************************************************************************* +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.4.2 $ +# +# last change: $Author: as $ $Date: 2008/03/19 11:09:22 $ +# +# The Contents of this file are made available subject to +# the terms of GNU Lesser General Public License Version 2.1. +# +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2005 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +#************************************************************************* +PRJ = ..$/..$/.. +TARGET = CheckConfigItems +PRJNAME = svtools +PACKAGE = complex$/ConfigItems + +# --- Settings ----------------------------------------------------- +.INCLUDE: settings.mk + + +#----- compile .java files ----------------------------------------- + +JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar jut.jar java_uno.jar \ + OOoRunner.jar + +JAVAFILES = CheckConfigItems.java + +JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) + +SUBDIRS = helper + +#----- make a jar from compiled files ------------------------------ + +MAXLINELENGTH = 100000 + +JARCLASSDIRS = $(PACKAGE) +JARTARGET = $(TARGET).jar +JARCOMPRESS = TRUE + +# --- Parameters for the test -------------------------------------- + +# start an office if the parameter is set for the makefile +.IF "$(OFFICE)" == "" +CT_APPEXECCOMMAND = +.ELSE +CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;" +.ENDIF + +# test base is java complex +CT_TESTBASE = -TestBase java_complex + +# test looks something like the.full.package.TestName +CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b) + +# start the runner application +CT_APP = org.openoffice.Runner + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + +RUN: run + +run: + java -cp $(CLASSPATH) $(CT_APP) $(CT_TESTBASE) $(CT_APPEXECCOMMAND) $(CT_TEST) + + + diff --git a/svl/qa/complex/passwordcontainer/MasterPasswdHandler.java b/svl/qa/complex/passwordcontainer/MasterPasswdHandler.java new file mode 100644 index 000000000000..bf6159ee38c5 --- /dev/null +++ b/svl/qa/complex/passwordcontainer/MasterPasswdHandler.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author zxf + */ + +package complex.passwordcontainer; + +import com.sun.star.lib.uno.helper.WeakBase; +import com.sun.star.task.XInteractionContinuation; +import com.sun.star.ucb.XInteractionSupplyAuthentication; +import com.sun.star.task.XInteractionRequest; +import com.sun.star.task.XInteractionHandler; +import com.sun.star.task.MasterPasswordRequest; +import com.sun.star.uno.UnoRuntime; + +public class MasterPasswdHandler extends WeakBase + implements XInteractionHandler { + XInteractionHandler m_xHandler; + + public MasterPasswdHandler( XInteractionHandler xHandler ) { + m_xHandler = xHandler; + } + + public void handle( XInteractionRequest xRequest ) { + try { + MasterPasswordRequest aMasterPasswordRequest; + if( xRequest.getRequest() instanceof MasterPasswordRequest ) { + aMasterPasswordRequest = (MasterPasswordRequest)xRequest.getRequest(); + if( aMasterPasswordRequest != null ) { + XInteractionContinuation xContinuations[] = xRequest.getContinuations(); + XInteractionSupplyAuthentication xAuthentication = null; + + for( int i = 0; i < xContinuations.length; ++i ) { + xAuthentication = (XInteractionSupplyAuthentication)UnoRuntime.queryInterface( XInteractionSupplyAuthentication.class, xContinuations[i]); + if( xAuthentication != null ) + break; + } + if( xAuthentication.canSetPassword() ) + xAuthentication.setPassword( "abcdefghijklmnopqrstuvwxyz123456" ); + xAuthentication.select(); + } + } else { + m_xHandler.handle( xRequest ); + } + } catch( Exception e ) { + System.out.println( "MasterPasswordHandler Error: " + e ); + } + } +} + + + + + + + diff --git a/svl/qa/complex/passwordcontainer/PasswordContainerTest.java b/svl/qa/complex/passwordcontainer/PasswordContainerTest.java new file mode 100644 index 000000000000..5da0676f8bb9 --- /dev/null +++ b/svl/qa/complex/passwordcontainer/PasswordContainerTest.java @@ -0,0 +1,36 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: PasswordContainerTest.java,v $ + * + * $Revision: 1.2 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package complex.passwordcontainer; + +public interface PasswordContainerTest { + boolean test(); +} diff --git a/svl/qa/complex/passwordcontainer/PasswordContainerUnitTest.java b/svl/qa/complex/passwordcontainer/PasswordContainerUnitTest.java new file mode 100644 index 000000000000..aee1c9355a3f --- /dev/null +++ b/svl/qa/complex/passwordcontainer/PasswordContainerUnitTest.java @@ -0,0 +1,77 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: PasswordContainerUnitTest.java,v $ + * + * $Revision: 1.2 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package complex.passwordcontainer; + +import complexlib.ComplexTestCase; +import com.sun.star.lang.XMultiServiceFactory; + +public class PasswordContainerUnitTest extends ComplexTestCase { + private XMultiServiceFactory m_xMSF = null; + + public String[] getTestMethodNames() { + return new String[] { + "ExecuteTest01", + "ExecuteTest02", + "ExecuteTest03"}; + } + public String getTestObjectName() { + return "PasswordContainerUnitTest"; + } + + public void before() { + try { + m_xMSF = (XMultiServiceFactory) param.getMSF(); + } catch (Exception e) { + failed ("Cannot create service factory!"); + } + if (m_xMSF == null) { + failed ("Cannot create service factory!"); + } + } + + public void after() { + m_xMSF = null; + } + + public void ExecuteTest01() { + PasswordContainerTest aTest = new Test01(m_xMSF, log); + assure("Test01 failed!", aTest.test()); + } + public void ExecuteTest02() { + PasswordContainerTest aTest = new Test02(m_xMSF, log); + assure("Test02 failed!", aTest.test()); + } + public void ExecuteTest03() { + PasswordContainerTest aTest = new Test03(m_xMSF, log); + assure("Test03 failed!", aTest.test()); + } +} diff --git a/svl/qa/complex/passwordcontainer/Test01.java b/svl/qa/complex/passwordcontainer/Test01.java new file mode 100644 index 000000000000..6de96de05ec9 --- /dev/null +++ b/svl/qa/complex/passwordcontainer/Test01.java @@ -0,0 +1,115 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: Test01.java,v $ + * + * $Revision: 1.2 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package complex.passwordcontainer; + +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.task.XInteractionHandler; +import com.sun.star.task.XPasswordContainer; +import com.sun.star.task.UrlRecord; +import com.sun.star.task.UserRecord; +import com.sun.star.task.XMasterPasswordHandling; + +import com.sun.star.uno.UnoRuntime; + +import share.LogWriter; + +public class Test01 implements PasswordContainerTest { + XMultiServiceFactory m_xMSF = null; + XPasswordContainer m_xPasswordContainer = null; + TestHelper m_aTestHelper = null; + + public Test01 ( XMultiServiceFactory xMSF, LogWriter aLogWriter ) + { + m_xMSF = xMSF; + m_aTestHelper = new TestHelper (aLogWriter, "Test01: "); + } + + public boolean test() { + final String sURL = "http://www.openoffice.org"; + final String sUserPre = "OOoUser"; + final String sPwdPre = "Password"; + final int iUserNum1 = 10; + final int iUserNum2 = 5; + + UserRecord aInputUserList1[] = new UserRecord[iUserNum1]; + for(int i = 0; i < iUserNum1; i++) { + String sTemp[] = {sPwdPre + "_1_" + i}; // currently one password for one user + aInputUserList1[i] = new UserRecord(sUserPre + "_1_" + i, sTemp); + } + UserRecord aInputUserList2[] = new UserRecord[iUserNum2]; + for(int i = 0; i < iUserNum2; i++) { + String sTemp[] = {sPwdPre + "_2_" + i}; + aInputUserList2[i] = new UserRecord(sUserPre + "_2_" + i, sTemp); + } + try { + Object oPasswordContainer = m_xMSF.createInstance( "com.sun.star.task.PasswordContainer" ); + XPasswordContainer xContainer = (XPasswordContainer)UnoRuntime.queryInterface(XPasswordContainer.class, oPasswordContainer); + Object oHandler = m_xMSF.createInstance( "com.sun.star.task.InteractionHandler" ); + XInteractionHandler xHandler = (XInteractionHandler)UnoRuntime.queryInterface(XInteractionHandler.class, oHandler); + MasterPasswdHandler aMHandler = new MasterPasswdHandler( xHandler ); + + // add a set of users and passwords for the same URL for runtime + for(int i = 0; i < iUserNum1; i++) { + xContainer.add(sURL, aInputUserList1[i].UserName, aInputUserList1[i].Passwords, aMHandler); + } + for (int i = 0; i < iUserNum2; i++) { + xContainer.add(sURL, aInputUserList2[i].UserName, aInputUserList2[i].Passwords, aMHandler); + } + + // remove some of the passwords + for (int i = 0; i < iUserNum1; i++) { + xContainer.remove(sURL, aInputUserList1[i].UserName); + } + + // get the result and check it with the expected one + UrlRecord aRecord = xContainer.find(sURL, aMHandler); + if(!aRecord.Url.equals(sURL)) { + m_aTestHelper.Error("URL mismatch. Got " + aRecord.Url + "; should be " + sURL); + return false; + } + if(!m_aTestHelper.sameLists(aRecord.UserList, aInputUserList2)) { + m_aTestHelper.Error("User list is not the expected"); + return false; + } + + // remove the runtime passwords + aRecord = xContainer.find(sURL, aMHandler); + for(int i = 0; i < aRecord.UserList.length; i++) { + xContainer.remove(sURL, aRecord.UserList[i].UserName); + } + } catch(Exception e) { + m_aTestHelper.Error("Exception: " + e); + return false; + } + return true; + } +} diff --git a/svl/qa/complex/passwordcontainer/Test02.java b/svl/qa/complex/passwordcontainer/Test02.java new file mode 100644 index 000000000000..5d65d8090cf9 --- /dev/null +++ b/svl/qa/complex/passwordcontainer/Test02.java @@ -0,0 +1,159 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: Test02.java,v $ + * + * $Revision: 1.2 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package complex.passwordcontainer; + +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.task.XPasswordContainer; +import com.sun.star.task.XMasterPasswordHandling; +import com.sun.star.task.XInteractionHandler; +import com.sun.star.task.UrlRecord; +import com.sun.star.task.UserRecord; + +import com.sun.star.uno.UnoRuntime; + +import share.LogWriter; + +public class Test02 implements PasswordContainerTest { + XMultiServiceFactory m_xMSF = null; + XPasswordContainer m_xPasswordContainer = null; + TestHelper m_aTestHelper = null; + + public Test02 ( XMultiServiceFactory xMSF, LogWriter aLogWriter ) + { + m_xMSF = xMSF; + m_aTestHelper = new TestHelper (aLogWriter, "Test02: "); + } + + public boolean test() { + final String sURL = "http://www.openoffice.org"; + final String sUserPre = "OOoUser"; + final String sPwdPre = "Password"; + final int iUserNum1 = 10; + final int iUserNum2 = 5; + + UserRecord aInputUserList1[] = new UserRecord[iUserNum1]; + for(int i = 0; i < iUserNum1; i++) { + String sTemp[] = {sPwdPre + "_1_" + i}; // currently one password for one user + aInputUserList1[i] = new UserRecord(sUserPre + "_1_" + i, sTemp); + } + UserRecord aInputUserList2[] = new UserRecord[iUserNum2]; + for(int i = 0; i < iUserNum2; i++) { + String sTemp[] = {sPwdPre + "_2_" + i}; + aInputUserList2[i] = new UserRecord(sUserPre + "_2_" + i, sTemp); + } + + try { + Object oPasswordContainer = m_xMSF.createInstance("com.sun.star.task.PasswordContainer"); + XPasswordContainer xContainer = (XPasswordContainer)UnoRuntime.queryInterface(XPasswordContainer.class, oPasswordContainer); + Object oHandler = m_xMSF.createInstance("com.sun.star.task.InteractionHandler"); + XInteractionHandler xHandler = (XInteractionHandler)UnoRuntime.queryInterface(XInteractionHandler.class, oHandler); + MasterPasswdHandler aMHandler = new MasterPasswdHandler(xHandler); + XMasterPasswordHandling xMHandling = (XMasterPasswordHandling)UnoRuntime.queryInterface(XMasterPasswordHandling.class, oPasswordContainer); + + // allow the storing of the passwords + xMHandling.allowPersistentStoring(true); + + // add a set of users and passwords for the same URL persistently + for(int i = 0; i < iUserNum1; ++i) { + xContainer.addPersistent(sURL, aInputUserList1[i].UserName, aInputUserList1[i].Passwords, aMHandler); + } + for(int i = 0; i < iUserNum2; ++i) { + xContainer.addPersistent(sURL, aInputUserList2[i].UserName, aInputUserList2[i].Passwords, aMHandler); + } + + // remove some of the passwords + for(int i = 0; i < iUserNum1; ++i) { + xContainer.remove(sURL, aInputUserList1[i].UserName); + } + + // get the result with find() and check it with the expected one + UrlRecord aRecord = xContainer.find(sURL, aMHandler); + if(!aRecord.Url.equals(sURL)) { + m_aTestHelper.Error("URL mismatch. Got " + aRecord.Url + "; should be " + sURL); + return false; + } + if(!m_aTestHelper.sameLists(aRecord.UserList, aInputUserList2)) { + m_aTestHelper.Error("User list is not the expected"); + return false; + } + + // get the result with getAllPersistent() and check + UrlRecord aRecords[] = xContainer.getAllPersistent(aMHandler); + if(!aRecords[0].Url.equals(sURL)) { + m_aTestHelper.Error("URL mismatch"); + return false; + } + if(!m_aTestHelper.sameLists(aRecords[0].UserList, aInputUserList2)) { + m_aTestHelper.Error("User list is not the expected"); + return false; + } + + // remove all the persistent passwords + xContainer.removeAllPersistent(); + + // remove the runtime passwords + for(int i = 0; i < aRecords[0].UserList.length; ++i) { + xContainer.remove(sURL, aRecords[0].UserList[i].UserName); + } + + // disallow the storing of the passwords + xMHandling.allowPersistentStoring(false); + } catch(Exception e) { + m_aTestHelper.Error("Exception: " + e); + return false; + } + return true; + } +} + + + + + + + + + + + + + + + + + + + + + + + diff --git a/svl/qa/complex/passwordcontainer/Test03.java b/svl/qa/complex/passwordcontainer/Test03.java new file mode 100644 index 000000000000..69de8b88578b --- /dev/null +++ b/svl/qa/complex/passwordcontainer/Test03.java @@ -0,0 +1,122 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: Test03.java,v $ + * + * $Revision: 1.2 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package complex.passwordcontainer; + +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.task.UrlRecord; +import com.sun.star.task.UserRecord; +import com.sun.star.task.XPasswordContainer; +import com.sun.star.task.XMasterPasswordHandling; +import com.sun.star.task.XInteractionHandler; + + +import com.sun.star.uno.UnoRuntime; +import share.LogWriter; + +public class Test03 implements PasswordContainerTest { + XMultiServiceFactory m_xMSF = null; + XPasswordContainer m_xPasswordContainer = null; + TestHelper m_aTestHelper = null; + + public Test03 ( XMultiServiceFactory xMSF, LogWriter aLogWriter ) + { + m_xMSF = xMSF; + m_aTestHelper = new TestHelper (aLogWriter, "Test03: "); + } + + public boolean test() { + final String sURL = "http://www.openoffice.org"; + final String sUserPre = "OOoUser"; + final String sPwdPre = "Password"; + final int iPersistentUserNum = 10; + final int iRuntimeUserNum = 5; + + UserRecord aInputUserList[] = new UserRecord[iPersistentUserNum+iRuntimeUserNum]; + for(int i = 0; i < iPersistentUserNum; i++) { + String sTemp[] = {sPwdPre + "_1_" + i}; // currently one password for one user + aInputUserList[i] = new UserRecord(sUserPre + "_1_" + i, sTemp); + } + for(int i = 0; i < iRuntimeUserNum; i++) { + String sTemp[] = {sPwdPre + "_2_" + i}; + aInputUserList[i+iPersistentUserNum] = new UserRecord(sUserPre + "_2_" + i, sTemp); + } + + try { + Object oPasswordContainer = m_xMSF.createInstance("com.sun.star.task.PasswordContainer"); + XPasswordContainer xContainer = (XPasswordContainer)UnoRuntime.queryInterface(XPasswordContainer.class, oPasswordContainer); + Object oHandler = m_xMSF.createInstance("com.sun.star.task.InteractionHandler"); + XInteractionHandler xHandler = (XInteractionHandler)UnoRuntime.queryInterface(XInteractionHandler.class, oHandler); + MasterPasswdHandler aMHandler = new MasterPasswdHandler(xHandler); + XMasterPasswordHandling xMHandling = (XMasterPasswordHandling)UnoRuntime.queryInterface(XMasterPasswordHandling.class, oPasswordContainer); + + // allow the storing of the passwords + xMHandling.allowPersistentStoring(true); + + // add a set of users and passwords for the same URL persistently + for(int i = 0; i < iPersistentUserNum; i++) { + xContainer.addPersistent(sURL, aInputUserList[i].UserName, aInputUserList[i].Passwords, aMHandler); + } + + // add a set of users and passwords for the same URL for runtime + for(int i = 0; i < iRuntimeUserNum; i++) { + xContainer.add(sURL, aInputUserList[i+iPersistentUserNum].UserName, aInputUserList[i+iPersistentUserNum].Passwords, aMHandler); + } + + // get the result for the URL and check that it contains persistent and runtime passwords + UrlRecord aRecord = xContainer.find(sURL, aMHandler); + if(!aRecord.Url.equals(sURL)) { + m_aTestHelper.Error("URL mismatch. Got " + aRecord.Url + "; should be " + sURL); + return false; + } + if(!m_aTestHelper.sameLists(aRecord.UserList, aInputUserList)) { + m_aTestHelper.Error("User list is not the expected"); + return false; + } + + // remove all the persistent passwords + xContainer.removeAllPersistent(); + + // remove the runtime passwords + aRecord = xContainer.find(sURL, aMHandler); + for(int i = 0; i < aRecord.UserList.length; i++) { + xContainer.remove(sURL, aRecord.UserList[i].UserName); + } + + // disallow the storing of the passwords + xMHandling.allowPersistentStoring(false); + }catch(Exception e){ + m_aTestHelper.Error("Exception: " + e); + return false; + } + return true; + } +} diff --git a/svl/qa/complex/passwordcontainer/TestHelper.java b/svl/qa/complex/passwordcontainer/TestHelper.java new file mode 100644 index 000000000000..0f83a9ef9963 --- /dev/null +++ b/svl/qa/complex/passwordcontainer/TestHelper.java @@ -0,0 +1,92 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: TestHelper.java,v $ + * + * $Revision: 1.2 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package complex.passwordcontainer; + +import com.sun.star.task.UserRecord; + +import share.LogWriter; + +public class TestHelper { + LogWriter m_aLogWriter; + String m_sTestPrefix; + + public TestHelper( LogWriter aLogWriter, String sTestPrefix ) { + m_aLogWriter = aLogWriter; + m_sTestPrefix = sTestPrefix; + } + + public void Error( String sError ) { + m_aLogWriter.println( m_sTestPrefix + "Error: " + sError ); + } + + public void Message( String sMessage ) { + m_aLogWriter.println( m_sTestPrefix + sMessage ); + } + + public boolean sameLists(UserRecord aUserList1[], UserRecord aUserList2[]) { + // only works when every name is unique within the list containing it + + if(aUserList1.length != aUserList2.length) { + Message("User list lengths: " + aUserList1.length + " <--> " + aUserList2.length + " respectively "); + return false; + } + + for(int i = 0; i < aUserList1.length; i++) { + int j; + for(j = 0; j < aUserList2.length; j++) { + if(!aUserList1[i].UserName.equals(aUserList2[j].UserName)) + continue; + if(aUserList1[i].Passwords[0].equals(aUserList2[j].Passwords[0])) { + break; + } + } + if(j == aUserList2.length) { + for(int k = 0; k < aUserList1.length; k++) { + Message(aUserList1[k].UserName + " <--> " + aUserList2[i].UserName); + } + return false; + } + } + return true; + } +} + + + + + + + + + + + diff --git a/svl/qa/complex/passwordcontainer/makefile.mk b/svl/qa/complex/passwordcontainer/makefile.mk new file mode 100644 index 000000000000..4ce811bd3616 --- /dev/null +++ b/svl/qa/complex/passwordcontainer/makefile.mk @@ -0,0 +1,91 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.2.38.1 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ = ..$/..$/.. +TARGET = PasswordContainerUnitTest +PRJNAME = svtools +PACKAGE = complex$/passwordcontainer + +# --- Settings ----------------------------------------------------- +.INCLUDE: settings.mk + + +#----- compile .java files ----------------------------------------- + +JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar + +JAVAFILES =\ + PasswordContainerUnitTest.java\ + PasswordContainerTest.java\ + TestHelper.java\ + Test01.java\ + Test02.java\ + Test03.java\ + MasterPasswdHandler.java + +JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) + +#----- make a jar from compiled files ------------------------------ + +MAXLINELENGTH = 100000 + +JARCLASSDIRS = $(PACKAGE) +JARTARGET = $(TARGET).jar +JARCOMPRESS = TRUE + +# --- Parameters for the test -------------------------------------- + +# start an office if the parameter is set for the makefile +.IF "$(OFFICE)" == "" +CT_APPEXECCOMMAND = +.ELSE +CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;" +.ENDIF + +# test base is java complex +CT_TESTBASE = -TestBase java_complex + +# test looks something like the.full.package.TestName +CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b) + +# start the runner application +CT_APP = org.openoffice.Runner + +# --- Targets ------------------------------------------------------ + +.INCLUDE: target.mk + +RUN: run + +run: + +java -cp $(CLASSPATH) $(CT_APP) $(CT_TESTBASE) $(CT_APPEXECCOMMAND) $(CT_TEST) + + diff --git a/svl/qa/export.map b/svl/qa/export.map new file mode 100755 index 000000000000..80373c145ac1 --- /dev/null +++ b/svl/qa/export.map @@ -0,0 +1,38 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: export.map,v $ +# +# $Revision: 1.4 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +UDK_3_0_0 { + global: + registerAllTestFunction; + + local: + *; +}; diff --git a/svl/qa/makefile.mk b/svl/qa/makefile.mk new file mode 100644 index 000000000000..c56dc2804a64 --- /dev/null +++ b/svl/qa/makefile.mk @@ -0,0 +1,103 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.5 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ = .. +PRJNAME = svtools +TARGET = qa + +ENABLE_EXCEPTIONS = true + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +# BEGIN ---------------------------------------------------------------- +# auto generated Target:job by codegen.pl +SHL1OBJS= \ + $(SLO)$/test_URIHelper.obj + +SHL1TARGET= URIHelper +SHL1STDLIBS=\ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(SALLIB) \ + $(SVTOOLLIB) \ + $(TOOLSLIB) \ + $(UNOTOOLSLIB) \ + $(TESTSHL2LIB) \ + $(CPPUNITLIB) + +SHL1IMPLIB= i$(SHL1TARGET) +DEF1NAME =$(SHL1TARGET) +SHL1VERSIONMAP= export.map +# auto generated Target:job +# END ------------------------------------------------------------------ + +#------------------------------- All object files ------------------------------- +# do this here, so we get right dependencies +# SLOFILES=$(SHL1OBJS) + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk +.INCLUDE : _cppunit.mk + +# LLA: old stuff +# USE_DEFFILE = true +# +# .INCLUDE: settings.mk +# +# .IF "$(OS)" == "WNT" +# REGEXP = "s/^[\#].*$$//" +# .ELSE # OS, WNT +# REGEXP = 's/^[\#].*$$//' +# .ENDIF # OS, WNT +# +# SHL1TARGET = URIHelper +# SHL1OBJS = \ +# $(SLO)$/test_URIHelper.obj +# SHL1STDLIBS = \ +# $(CPPULIB) \ +# $(CPPUHELPERLIB) \ +# $(SALLIB) \ +# $(SVTOOLLIB) \ +# $(TOOLSLIB) \ +# $(UNOTOOLSLIB) +# +# DEF1NAME = $(SHL1TARGET) +# DEF1EXPORTFILE = $(MISC)$/$(SHL1TARGET).dxp +# +# .INCLUDE: target.mk +# +# $(MISC)$/$(SHL1TARGET).dxp: sce$/$(SHL1TARGET).sce +# + $(TYPE) $< | sed $(REGEXP) > $@ +# + $(TYPE) $@ | sed "s/^/test_/" > $(MISC)$/$(SHL1TARGET).tst +# + $(TYPE) $(MISC)$/$(SHL1TARGET).tst | sed "/test_./ w $@" diff --git a/svl/qa/test_URIHelper.cxx b/svl/qa/test_URIHelper.cxx new file mode 100644 index 000000000000..a90fbe039b6d --- /dev/null +++ b/svl/qa/test_URIHelper.cxx @@ -0,0 +1,462 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: test_URIHelper.cxx,v $ + * $Revision: 1.11 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include "sal/config.h" + +#include + +#include "com/sun/star/lang/Locale.hpp" +#include "com/sun/star/lang/XComponent.hpp" +#include "com/sun/star/lang/XMultiComponentFactory.hpp" +#include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "com/sun/star/ucb/Command.hpp" +#include "com/sun/star/ucb/CommandAbortedException.hpp" +#include "com/sun/star/ucb/IllegalIdentifierException.hpp" +#include "com/sun/star/ucb/XCommandProcessor.hpp" +#include "com/sun/star/ucb/XContent.hpp" +#include "com/sun/star/ucb/XContentIdentifier.hpp" +#include "com/sun/star/ucb/XContentProvider.hpp" +#include "com/sun/star/ucb/XContentProviderManager.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uri/XUriReference.hpp" +#include "cppuhelper/bootstrap.hxx" +#include "cppuhelper/implbase1.hxx" +#include "cppuhelper/implbase2.hxx" +#include "testshl/simpleheader.hxx" +#include "osl/diagnose.h" +#include "rtl/strbuf.hxx" +#include "rtl/string.h" +#include "rtl/string.hxx" +#include "rtl/textenc.h" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "tools/solar.h" +#include "unotools/charclass.hxx" + +#include "urihelper.hxx" + +// This test needs a UNO component context that supports various services (the +// UCB, an UriReferenceFactory, ...), so it is best executed within an OOo +// installation. + +namespace com { namespace sun { namespace star { namespace ucb { + class XCommandEnvironment; + class XContentEventListener; +} } } } + +namespace { + +namespace css = com::sun::star; + +// This class only implements that subset of functionality of a proper +// css::ucb::Content that is known to be needed here: +class Content: + public cppu::WeakImplHelper2< + css::ucb::XContent, css::ucb::XCommandProcessor > +{ +public: + explicit Content( + css::uno::Reference< css::ucb::XContentIdentifier > const & identifier); + + virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL + getIdentifier() throw (css::uno::RuntimeException) { + return m_identifier; + } + + virtual rtl::OUString SAL_CALL getContentType() + throw (css::uno::RuntimeException) + { + return rtl::OUString(); + } + + virtual void SAL_CALL addContentEventListener( + css::uno::Reference< css::ucb::XContentEventListener > const &) + throw (css::uno::RuntimeException) + {} + + virtual void SAL_CALL removeContentEventListener( + css::uno::Reference< css::ucb::XContentEventListener > const &) + throw (css::uno::RuntimeException) + {} + + virtual sal_Int32 SAL_CALL createCommandIdentifier() + throw (css::uno::RuntimeException) + { + return 0; + } + + virtual css::uno::Any SAL_CALL execute( + css::ucb::Command const & command, sal_Int32 commandId, + css::uno::Reference< css::ucb::XCommandEnvironment > const &) + throw ( + css::uno::Exception, css::ucb::CommandAbortedException, + css::uno::RuntimeException); + + virtual void SAL_CALL abort(sal_Int32) throw (css::uno::RuntimeException) {} + +private: + static char const m_prefix[]; + + css::uno::Reference< css::ucb::XContentIdentifier > m_identifier; +}; + +char const Content::m_prefix[] = "test:"; + +Content::Content( + css::uno::Reference< css::ucb::XContentIdentifier > const & identifier): + m_identifier(identifier) +{ + OSL_ASSERT(m_identifier.is()); + rtl::OUString uri(m_identifier->getContentIdentifier()); + if (!uri.matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM(m_prefix)) + || uri.indexOf('#', RTL_CONSTASCII_LENGTH(m_prefix)) != -1) + { + throw css::ucb::IllegalIdentifierException(); + } +} + +css::uno::Any Content::execute( + css::ucb::Command const & command, sal_Int32, + css::uno::Reference< css::ucb::XCommandEnvironment > const &) + throw ( + css::uno::Exception, css::ucb::CommandAbortedException, + css::uno::RuntimeException) +{ + if (!command.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("getCasePreservingURL"))) + { + throw css::uno::RuntimeException(); + } + // If any non-empty segment starts with anything but '0', '1', or '2', fail; + // otherwise, if the last non-empty segment starts with '1', add a final + // slash, and if the last non-empty segment starts with '2', remove a final + // slash (if any); also, turn the given uri into all-lowercase: + rtl::OUString uri(m_identifier->getContentIdentifier()); + sal_Unicode c = '0'; + for (sal_Int32 i = RTL_CONSTASCII_LENGTH(m_prefix); i != -1;) { + rtl::OUString seg(uri.getToken(0, '/', i)); + if (seg.getLength() > 0) { + c = seg[0]; + if (c < '0' || c > '2') { + throw css::uno::Exception(); + } + } + } + switch (c) { + case '1': + uri += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); + break; + case '2': + if (uri.getLength() > 0 && uri[uri.getLength() - 1] == '/') { + uri = uri.copy(0, uri.getLength() -1); + } + break; + } + return css::uno::makeAny(uri.toAsciiLowerCase()); +} + +class Provider: public cppu::WeakImplHelper1< css::ucb::XContentProvider > { +public: + virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent( + css::uno::Reference< css::ucb::XContentIdentifier > const & identifier) + throw (css::ucb::IllegalIdentifierException, css::uno::RuntimeException) + { + return new Content(identifier); + } + + virtual sal_Int32 SAL_CALL compareContentIds( + css::uno::Reference< css::ucb::XContentIdentifier > const & id1, + css::uno::Reference< css::ucb::XContentIdentifier > const & id2) + throw (css::uno::RuntimeException) + { + OSL_ASSERT(id1.is() && id2.is()); + return + id1->getContentIdentifier().compareTo(id2->getContentIdentifier()); + } +}; + +class Test: public CppUnit::TestFixture { +public: + virtual void setUp(); + + void finish(); + + void testNormalizedMakeRelative(); + + void testFindFirstURLInText(); + + CPPUNIT_TEST_SUITE(Test); + CPPUNIT_TEST(testNormalizedMakeRelative); + CPPUNIT_TEST(testFindFirstURLInText); + CPPUNIT_TEST(finish); + CPPUNIT_TEST_SUITE_END(); + +private: + static css::uno::Reference< css::uno::XComponentContext > m_context; +}; + +void Test::setUp() { + // For whatever reason, on W32 it does not work to create/destroy a fresh + // component context for each test in Test::setUp/tearDown; therefore, a + // single component context is used for all tests and destroyed in the last + // pseudo-test "finish": + if (!m_context.is()) { + m_context = cppu::defaultBootstrap_InitialComponentContext(); + } +} + +void Test::finish() { + css::uno::Reference< css::lang::XComponent >( + m_context, css::uno::UNO_QUERY_THROW)->dispose(); +} + +void Test::testNormalizedMakeRelative() { + css::uno::Sequence< css::uno::Any > args(2); + args[0] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Local")); + args[1] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Office")); + css::uno::Reference< css::ucb::XContentProviderManager >( + (css::uno::Reference< css::lang::XMultiComponentFactory >( + m_context->getServiceManager(), css::uno::UNO_QUERY_THROW)-> + createInstanceWithArgumentsAndContext( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.ucb.UniversalContentBroker")), + args, m_context)), + css::uno::UNO_QUERY_THROW)->registerContentProvider( + new Provider, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("test")), + true); + struct Test { + char const * base; + char const * absolute; + char const * relative; + }; + static Test const tests[] = { + { "hierarchical:/", "mailto:def@a.b.c.", "mailto:def@a.b.c." }, + { "hierarchical:/", "a/b/c", "a/b/c" }, + { "hierarchical:/a", "hierarchical:/a/b/c?d#e", "/a/b/c?d#e" }, + { "hierarchical:/a/", "hierarchical:/a/b/c?d#e", "b/c?d#e" }, + { "test:/0/0/a", "test:/0/b", "../b" }, + { "test:/1/1/a", "test:/1/b", "../b" }, + { "test:/2/2//a", "test:/2/b", "../../b" }, + { "test:/0a/b", "test:/0A/c#f", "c#f" }, + { "file:///usr/bin/nonex1/nonex2", + "file:///usr/bin/nonex1/nonex3/nonex4", "nonex3/nonex4" }, + { "file:///usr/bin/nonex1/nonex2#fragmentA", + "file:///usr/bin/nonex1/nonex3/nonex4#fragmentB", + "nonex3/nonex4#fragmentB" }, + { "file:///usr/nonex1/nonex2", "file:///usr/nonex3", "../nonex3" }, + { "file:///c:/windows/nonex1", "file:///c:/nonex2", "../nonex2" }, +#if defined WNT + { "file:///c:/nonex1/nonex2", "file:///C:/nonex1/nonex3/nonex4", + "nonex3/nonex4" } +#endif + }; + for (std::size_t i = 0; i < sizeof tests / sizeof tests[0]; ++i) { + css::uno::Reference< css::uri::XUriReference > ref( + URIHelper::normalizedMakeRelative( + m_context, rtl::OUString::createFromAscii(tests[i].base), + rtl::OUString::createFromAscii(tests[i].absolute))); + bool ok = tests[i].relative == 0 + ? !ref.is() + : ref.is() && ref->getUriReference().equalsAscii(tests[i].relative); + rtl::OString msg; + if (!ok) { + rtl::OStringBuffer buf; + buf.append('<'); + buf.append(tests[i].base); + buf.append(RTL_CONSTASCII_STRINGPARAM(">, <")); + buf.append(tests[i].absolute); + buf.append(RTL_CONSTASCII_STRINGPARAM(">: ")); + if (ref.is()) { + buf.append('<'); + buf.append( + rtl::OUStringToOString( + ref->getUriReference(), RTL_TEXTENCODING_UTF8)); + buf.append('>'); + } else { + buf.append(RTL_CONSTASCII_STRINGPARAM("none")); + } + buf.append(RTL_CONSTASCII_STRINGPARAM(" instead of ")); + if (tests[i].relative == 0) { + buf.append(RTL_CONSTASCII_STRINGPARAM("none")); + } else { + buf.append('<'); + buf.append(tests[i].relative); + buf.append('>'); + } + msg = buf.makeStringAndClear(); + } + CPPUNIT_ASSERT_MESSAGE(msg.getStr(), ok); + } +} + +void Test::testFindFirstURLInText() { + struct Test { + char const * input; + char const * result; + xub_StrLen begin; + xub_StrLen end; + }; + static Test const tests[] = { + { "...ftp://bla.bla.bla/blubber/...", + "ftp://bla.bla.bla/blubber/", 3, 29 }, + { "..\\ftp://bla.bla.bla/blubber/...", 0, 0, 0 }, + { "..\\ftp:\\\\bla.bla.bla\\blubber/...", + "file://bla.bla.bla/blubber%2F", 7, 29 }, + { "http://sun.com", "http://sun.com/", 0, 14 }, + { "http://sun.com/", "http://sun.com/", 0, 15 }, + { "http://www.xerox.com@www.pcworld.com/go/3990332.htm", 0, 0, 0 }, + { "ftp://www.xerox.com@www.pcworld.com/go/3990332.htm", + "ftp://www.xerox.com@www.pcworld.com/go/3990332.htm", 0, 50 }, + { "Version.1.2.3", 0, 0, 0 }, + { "Version:1.2.3", 0, 0, 0 }, + { "a.b.c", 0, 0, 0 }, + { "file:///a|...", "file:///a:", 0, 10 }, + { "file:///a||...", "file:///a%7C%7C", 0, 11 }, + { "file:///a|/bc#...", "file:///a:/bc", 0, 13 }, + { "file:///a|/bc#de...", "file:///a:/bc#de", 0, 16 }, + { "abc.def.ghi,ftp.xxx.yyy/zzz...", "ftp://ftp.xxx.yyy/zzz", 12, 27 }, + { "abc.def.ghi,Ftp.xxx.yyy/zzz...", "ftp://Ftp.xxx.yyy/zzz", 12, 27 }, + { "abc.def.ghi,www.xxx.yyy...", "http://www.xxx.yyy/", 12, 23 }, + { "abc.def.ghi,wwww.xxx.yyy...", 0, 0, 0 }, + { "abc.def.ghi,wWW.xxx.yyy...", "http://wWW.xxx.yyy/", 12, 23 }, + { "Bla {mailto.me@abc.def.g.h.i}...", + "mailto:%7Bmailto.me@abc.def.g.h.i", 4, 28 }, + { "abc@def@ghi", 0, 0, 0 }, + { "lala@sun.com", "mailto:lala@sun.com", 0, 12 }, + { "1lala@sun.com", "mailto:1lala@sun.com", 0, 13 }, + { "aaa_bbb@xxx.yy", "mailto:aaa_bbb@xxx.yy", 0, 14 }, + { "{a:\\bla/bla/bla...}", "file:///a:/bla/bla/bla", 1, 15 }, + { "#b:/c/d#e#f#", "file:///b:/c/d", 1, 7 }, + { "a:/", "file:///a:/", 0, 3 }, + { ".component:", 0, 0, 0 }, + { ".uno:", 0, 0, 0 }, + { "cid:", 0, 0, 0 }, + { "data:", 0, 0, 0 }, + { "db:", 0, 0, 0 }, + { "file:", 0, 0, 0 }, + { "ftp:", 0, 0, 0 }, + { "http:", 0, 0, 0 }, + { "https:", 0, 0, 0 }, + { "imap:", 0, 0, 0 }, + { "javascript:", 0, 0, 0 }, + { "ldap:", 0, 0, 0 }, + { "macro:", 0, 0, 0 }, + { "mailto:", 0, 0, 0 }, + { "news:", 0, 0, 0 }, + { "out:", 0, 0, 0 }, + { "pop3:", 0, 0, 0 }, + { "private:", 0, 0, 0 }, + { "slot:", 0, 0, 0 }, + { "staroffice.component:", 0, 0, 0 }, + { "staroffice.db:", 0, 0, 0 }, + { "staroffice.factory:", 0, 0, 0 }, + { "staroffice.helpid:", 0, 0, 0 }, + { "staroffice.java:", 0, 0, 0 }, + { "staroffice.macro:", 0, 0, 0 }, + { "staroffice.out:", 0, 0, 0 }, + { "staroffice.pop3:", 0, 0, 0 }, + { "staroffice.private:", 0, 0, 0 }, + { "staroffice.searchfolder:", 0, 0, 0 }, + { "staroffice.slot:", 0, 0, 0 }, + { "staroffice.trashcan:", 0, 0, 0 }, + { "staroffice.uno:", 0, 0, 0 }, + { "staroffice.vim:", 0, 0, 0 }, + { "staroffice:", 0, 0, 0 }, + { "vim:", 0, 0, 0 }, + { "vnd.sun.star.cmd:", 0, 0, 0 }, + { "vnd.sun.star.help:", 0, 0, 0 }, + { "vnd.sun.star.hier:", 0, 0, 0 }, + { "vnd.sun.star.odma:", 0, 0, 0 }, + { "vnd.sun.star.pkg:", 0, 0, 0 }, + { "vnd.sun.star.script:", 0, 0, 0 }, + { "vnd.sun.star.webdav:", 0, 0, 0 }, + { "vnd.sun.star.wfs:", 0, 0, 0 }, + { "generic:path", 0, 0, 0 }, + { "wfs:", 0, 0, 0 } + }; + CharClass charClass( + css::uno::Reference< css::lang::XMultiServiceFactory >( + m_context->getServiceManager(), css::uno::UNO_QUERY_THROW), + com::sun::star::lang::Locale( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en")), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("US")), rtl::OUString())); + for (std::size_t i = 0; i < sizeof tests / sizeof tests[0]; ++i) { + rtl::OUString input(rtl::OUString::createFromAscii(tests[i].input)); + xub_StrLen begin = 0; + xub_StrLen end = static_cast< xub_StrLen >(input.getLength()); + rtl::OUString result( + URIHelper::FindFirstURLInText(input, begin, end, charClass)); + bool ok = tests[i].result == 0 + ? (result.getLength() == 0 && begin == input.getLength() + && end == input.getLength()) + : (result.equalsAscii(tests[i].result) && begin == tests[i].begin + && end == tests[i].end); + rtl::OString msg; + if (!ok) { + rtl::OStringBuffer buf; + buf.append('"'); + buf.append(tests[i].input); + buf.append(RTL_CONSTASCII_STRINGPARAM("\" -> ")); + buf.append(tests[i].result == 0 ? "none" : tests[i].result); + buf.append(RTL_CONSTASCII_STRINGPARAM(" (")); + buf.append(static_cast< sal_Int32 >(tests[i].begin)); + buf.append(RTL_CONSTASCII_STRINGPARAM(", ")); + buf.append(static_cast< sal_Int32 >(tests[i].end)); + buf.append(')'); + buf.append(RTL_CONSTASCII_STRINGPARAM(" != ")); + buf.append(rtl::OUStringToOString(result, RTL_TEXTENCODING_UTF8)); + buf.append(RTL_CONSTASCII_STRINGPARAM(" (")); + buf.append(static_cast< sal_Int32 >(begin)); + buf.append(RTL_CONSTASCII_STRINGPARAM(", ")); + buf.append(static_cast< sal_Int32 >(end)); + buf.append(')'); + msg = buf.makeStringAndClear(); + } + CPPUNIT_ASSERT_MESSAGE(msg.getStr(), ok); + } +} + +css::uno::Reference< css::uno::XComponentContext > Test::m_context; + +CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests"); + +} + +NOADDITIONAL; diff --git a/svl/source/config/cjkoptions.cxx b/svl/source/config/cjkoptions.cxx new file mode 100644 index 000000000000..66d70cd1e2a3 --- /dev/null +++ b/svl/source/config/cjkoptions.cxx @@ -0,0 +1,510 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: cjkoptions.cxx,v $ + * $Revision: 1.22 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#ifdef SVL_DLLIMPLEMENTATION +#undef SVL_DLLIMPLEMENTATION +#endif +#define SVT_DLLIMPLEMENTATION + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace ::com::sun::star::uno; +using namespace ::rtl; + +#define C2U(cChar) OUString::createFromAscii(cChar) +#define CFG_READONLY_DEFAULT sal_False +/* -----------------------------10.04.01 12:39-------------------------------- + + ---------------------------------------------------------------------------*/ +class SvtCJKOptions_Impl : public utl::ConfigItem +{ + sal_Bool bIsLoaded; + sal_Bool bCJKFont; + sal_Bool bVerticalText; + sal_Bool bAsianTypography; + sal_Bool bJapaneseFind; + sal_Bool bRuby; + sal_Bool bChangeCaseMap; + sal_Bool bDoubleLines; + sal_Bool bEmphasisMarks; + sal_Bool bVerticalCallOut; + + sal_Bool bROCJKFont; + sal_Bool bROVerticalText; + sal_Bool bROAsianTypography; + sal_Bool bROJapaneseFind; + sal_Bool bRORuby; + sal_Bool bROChangeCaseMap; + sal_Bool bRODoubleLines; + sal_Bool bROEmphasisMarks; + sal_Bool bROVerticalCallOut; + +public: + SvtCJKOptions_Impl(); + ~SvtCJKOptions_Impl(); + + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames ); + virtual void Commit(); + void Load(); + + sal_Bool IsLoaded() { return bIsLoaded; } + + sal_Bool IsCJKFontEnabled() const { return bCJKFont; } + sal_Bool IsVerticalTextEnabled() const { return bVerticalText; } + sal_Bool IsAsianTypographyEnabled() const { return bAsianTypography; } + sal_Bool IsJapaneseFindEnabled() const { return bJapaneseFind; } + sal_Bool IsRubyEnabled() const { return bRuby; } + sal_Bool IsChangeCaseMapEnabled() const { return bChangeCaseMap; } + sal_Bool IsDoubleLinesEnabled() const { return bDoubleLines; } + sal_Bool IsEmphasisMarksEnabled() const { return bEmphasisMarks; } + sal_Bool IsVerticalCallOutEnabled() const { return bVerticalCallOut; } + + sal_Bool IsAnyEnabled() const { + return bCJKFont||bVerticalText||bAsianTypography||bJapaneseFind|| + bRuby||bChangeCaseMap||bDoubleLines||bEmphasisMarks||bVerticalCallOut; } + void SetAll(sal_Bool bSet); + sal_Bool IsReadOnly(SvtCJKOptions::EOption eOption) const; +}; +/*-- 10.04.01 12:41:57--------------------------------------------------- + + -----------------------------------------------------------------------*/ +namespace +{ + struct PropertyNames + : public rtl::Static< Sequence, PropertyNames > {}; +} + +SvtCJKOptions_Impl::SvtCJKOptions_Impl() : + utl::ConfigItem(C2U("Office.Common/I18N/CJK")), + bIsLoaded(sal_False), + bCJKFont(sal_True), + bVerticalText(sal_True), + bAsianTypography(sal_True), + bJapaneseFind(sal_True), + bRuby(sal_True), + bChangeCaseMap(sal_True), + bDoubleLines(sal_True), + bEmphasisMarks(sal_True), + bVerticalCallOut(sal_True), + bROCJKFont(CFG_READONLY_DEFAULT), + bROVerticalText(CFG_READONLY_DEFAULT), + bROAsianTypography(CFG_READONLY_DEFAULT), + bROJapaneseFind(CFG_READONLY_DEFAULT), + bRORuby(CFG_READONLY_DEFAULT), + bROChangeCaseMap(CFG_READONLY_DEFAULT), + bRODoubleLines(CFG_READONLY_DEFAULT), + bROEmphasisMarks(CFG_READONLY_DEFAULT), + bROVerticalCallOut(CFG_READONLY_DEFAULT) +{ +} +/*-- 10.04.01 12:41:57--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SvtCJKOptions_Impl::~SvtCJKOptions_Impl() +{ +} +/* -----------------------------20.04.01 14:34-------------------------------- + + ---------------------------------------------------------------------------*/ +void SvtCJKOptions_Impl::SetAll(sal_Bool bSet) +{ + if ( + !bROCJKFont && + !bROVerticalText && + !bROAsianTypography && + !bROJapaneseFind && + !bRORuby && + !bROChangeCaseMap && + !bRODoubleLines && + !bROEmphasisMarks && + !bROVerticalCallOut + ) + { + bCJKFont=bSet; + bVerticalText=bSet; + bAsianTypography=bSet; + bJapaneseFind=bSet; + bRuby=bSet; + bChangeCaseMap=bSet; + bDoubleLines=bSet; + bEmphasisMarks=bSet; + bVerticalCallOut=bSet; + + SetModified(); + Commit(); + } +} +/*-- 10.04.01 12:41:56--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvtCJKOptions_Impl::Load() +{ + Sequence &rPropertyNames = PropertyNames::get(); + if(!rPropertyNames.getLength()) + { + rPropertyNames.realloc(9); + OUString* pNames = rPropertyNames.getArray(); + + pNames[0] = C2U("CJKFont"); + pNames[1] = C2U("VerticalText"); + pNames[2] = C2U("AsianTypography"); + pNames[3] = C2U("JapaneseFind"); + pNames[4] = C2U("Ruby"); + pNames[5] = C2U("ChangeCaseMap"); + pNames[6] = C2U("DoubleLines"); + pNames[7] = C2U("EmphasisMarks"); + pNames[8] = C2U("VerticalCallOut"); + + EnableNotification( rPropertyNames ); + } + Sequence< Any > aValues = GetProperties(rPropertyNames); + Sequence< sal_Bool > aROStates = GetReadOnlyStates(rPropertyNames); + const Any* pValues = aValues.getConstArray(); + const sal_Bool* pROStates = aROStates.getConstArray(); + DBG_ASSERT( aValues.getLength() == rPropertyNames.getLength(), "GetProperties failed" ); + DBG_ASSERT( aROStates.getLength() == rPropertyNames.getLength(), "GetReadOnlyStates failed" ); + if ( aValues.getLength() == rPropertyNames.getLength() && aROStates.getLength() == rPropertyNames.getLength() ) + { + for ( int nProp = 0; nProp < rPropertyNames.getLength(); nProp++ ) + { + if( pValues[nProp].hasValue() ) + { + sal_Bool bValue = *(sal_Bool*)pValues[nProp].getValue(); + switch ( nProp ) + { + case 0: { bCJKFont = bValue; bROCJKFont = pROStates[nProp]; } break; + case 1: { bVerticalText = bValue; bROVerticalText = pROStates[nProp]; } break; + case 2: { bAsianTypography = bValue; bROAsianTypography = pROStates[nProp]; } break; + case 3: { bJapaneseFind = bValue; bROJapaneseFind = pROStates[nProp]; } break; + case 4: { bRuby = bValue; bRORuby = pROStates[nProp]; } break; + case 5: { bChangeCaseMap = bValue; bROChangeCaseMap = pROStates[nProp]; } break; + case 6: { bDoubleLines = bValue; bRODoubleLines = pROStates[nProp]; } break; + case 7: { bEmphasisMarks = bValue; bROEmphasisMarks = pROStates[nProp]; } break; + case 8: { bVerticalCallOut = bValue; bROVerticalCallOut = pROStates[nProp]; } break; + } + } + } + } + + SvtSystemLanguageOptions aSystemLocaleSettings; + LanguageType eSystemLanguage = aSystemLocaleSettings.GetWin16SystemLanguage(); + sal_uInt16 nWinScript = SvtLanguageOptions::GetScriptTypeOfLanguage( eSystemLanguage ); + + sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage(LANGUAGE_SYSTEM); + if ( !bCJKFont && (( nScriptType & SCRIPTTYPE_ASIAN )|| + ((eSystemLanguage != LANGUAGE_SYSTEM) && ( nWinScript & SCRIPTTYPE_ASIAN )))) + { + SetAll(sal_True); + } + bIsLoaded = sal_True; +} +/*-- 10.04.01 12:41:57--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvtCJKOptions_Impl::Notify( const Sequence< OUString >& ) +{ + Load(); +} +/*-- 10.04.01 12:41:57--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvtCJKOptions_Impl::Commit() +{ + Sequence &rPropertyNames = PropertyNames::get(); + OUString* pOrgNames = rPropertyNames.getArray(); + sal_Int32 nOrgCount = rPropertyNames.getLength(); + + Sequence< OUString > aNames(nOrgCount); + Sequence< Any > aValues(nOrgCount); + + OUString* pNames = aNames.getArray(); + Any* pValues = aValues.getArray(); + sal_Int32 nRealCount = 0; + + const Type& rType = ::getBooleanCppuType(); + for(int nProp = 0; nProp < nOrgCount; nProp++) + { + switch(nProp) + { + case 0: + { + if (!bROCJKFont) + { + pNames[nRealCount] = pOrgNames[nProp]; + pValues[nRealCount].setValue(&bCJKFont, rType); + ++nRealCount; + } + } + break; + + case 1: + { + if (!bROVerticalText) + { + pNames[nRealCount] = pOrgNames[nProp]; + pValues[nRealCount].setValue(&bVerticalText, rType); + ++nRealCount; + } + } + break; + + case 2: + { + if (!bROAsianTypography) + { + pNames[nRealCount] = pOrgNames[nProp]; + pValues[nRealCount].setValue(&bAsianTypography, rType); + ++nRealCount; + } + } + break; + + case 3: + { + if (!bROJapaneseFind) + { + pNames[nRealCount] = pOrgNames[nProp]; + pValues[nRealCount].setValue(&bJapaneseFind, rType); + ++nRealCount; + } + } + break; + + case 4: + { + if (!bRORuby) + { + pNames[nRealCount] = pOrgNames[nProp]; + pValues[nRealCount].setValue(&bRuby, rType); + ++nRealCount; + } + } + break; + + case 5: + { + if (!bROChangeCaseMap) + { + pNames[nRealCount] = pOrgNames[nProp]; + pValues[nRealCount].setValue(&bChangeCaseMap, rType); + ++nRealCount; + } + } + break; + + case 6: + { + if (!bRODoubleLines) + { + pNames[nRealCount] = pOrgNames[nProp]; + pValues[nRealCount].setValue(&bDoubleLines, rType); + ++nRealCount; + } + } + break; + + case 7: + { + if (!bROEmphasisMarks) + { + pNames[nRealCount] = pOrgNames[nProp]; + pValues[nRealCount].setValue(&bEmphasisMarks, rType); + ++nRealCount; + } + } + break; + + case 8: + { + if (!bROVerticalCallOut) + { + pNames[nRealCount] = pOrgNames[nProp]; + pValues[nRealCount].setValue(&bVerticalCallOut, rType); + ++nRealCount; + } + } + break; + } + } + aNames.realloc(nRealCount); + aValues.realloc(nRealCount); + PutProperties(aNames, aValues); +} +/*-- 13.02.2003 12:12--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Bool SvtCJKOptions_Impl::IsReadOnly(SvtCJKOptions::EOption eOption) const +{ + sal_Bool bReadOnly = CFG_READONLY_DEFAULT; + switch(eOption) + { + case SvtCJKOptions::E_CJKFONT : bReadOnly = bROCJKFont; break; + case SvtCJKOptions::E_VERTICALTEXT : bReadOnly = bROVerticalText; break; + case SvtCJKOptions::E_ASIANTYPOGRAPHY : bReadOnly = bROAsianTypography; break; + case SvtCJKOptions::E_JAPANESEFIND : bReadOnly = bROJapaneseFind; break; + case SvtCJKOptions::E_RUBY : bReadOnly = bRORuby; break; + case SvtCJKOptions::E_CHANGECASEMAP : bReadOnly = bROChangeCaseMap; break; + case SvtCJKOptions::E_DOUBLELINES : bReadOnly = bRODoubleLines; break; + case SvtCJKOptions::E_EMPHASISMARKS : bReadOnly = bROEmphasisMarks; break; + case SvtCJKOptions::E_VERTICALCALLOUT : bReadOnly = bROVerticalCallOut; break; + case SvtCJKOptions::E_ALL : if (bROCJKFont || bROVerticalText || bROAsianTypography || bROJapaneseFind || bRORuby || bROChangeCaseMap || bRODoubleLines || bROEmphasisMarks || bROVerticalCallOut) + bReadOnly = sal_True; + break; + } + return bReadOnly; +} + +// global ---------------------------------------------------------------- + +static SvtCJKOptions_Impl* pCJKOptions = NULL; +static sal_Int32 nCJKRefCount = 0; +namespace { struct CJKMutex : public rtl::Static< ::osl::Mutex , CJKMutex >{}; } + + +// class SvtCJKOptions -------------------------------------------------- + +SvtCJKOptions::SvtCJKOptions(sal_Bool bDontLoad) +{ + // Global access, must be guarded (multithreading) + ::osl::MutexGuard aGuard( CJKMutex::get() ); + if ( !pCJKOptions ) + { + pCJKOptions = new SvtCJKOptions_Impl; + ItemHolder2::holdConfigItem(E_CJKOPTIONS); + } + if( !bDontLoad && !pCJKOptions->IsLoaded()) + pCJKOptions->Load(); + + ++nCJKRefCount; + pImp = pCJKOptions; +} + +// ----------------------------------------------------------------------- + +SvtCJKOptions::~SvtCJKOptions() +{ + // Global access, must be guarded (multithreading) + ::osl::MutexGuard aGuard( CJKMutex::get() ); + if ( !--nCJKRefCount ) + DELETEZ( pCJKOptions ); +} +// ----------------------------------------------------------------------- +sal_Bool SvtCJKOptions::IsCJKFontEnabled() const +{ + DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); + return pCJKOptions->IsCJKFontEnabled(); +} +// ----------------------------------------------------------------------- +sal_Bool SvtCJKOptions::IsVerticalTextEnabled() const +{ + DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); + return pCJKOptions->IsVerticalTextEnabled(); +} +// ----------------------------------------------------------------------- +sal_Bool SvtCJKOptions::IsAsianTypographyEnabled() const +{ + DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); + return pCJKOptions->IsAsianTypographyEnabled(); +} +// ----------------------------------------------------------------------- +sal_Bool SvtCJKOptions::IsJapaneseFindEnabled() const +{ + DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); + return pCJKOptions->IsJapaneseFindEnabled(); +} +// ----------------------------------------------------------------------- +sal_Bool SvtCJKOptions::IsRubyEnabled() const +{ + DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); + return pCJKOptions->IsRubyEnabled(); +} +// ----------------------------------------------------------------------- +sal_Bool SvtCJKOptions::IsChangeCaseMapEnabled() const +{ + DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); + return pCJKOptions->IsChangeCaseMapEnabled(); +} +// ----------------------------------------------------------------------- +sal_Bool SvtCJKOptions::IsDoubleLinesEnabled() const +{ + DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); + return pCJKOptions->IsDoubleLinesEnabled(); +} +// ----------------------------------------------------------------------- +sal_Bool SvtCJKOptions::IsEmphasisMarksEnabled() const +{ + DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); + return pCJKOptions->IsEmphasisMarksEnabled(); +} +// ----------------------------------------------------------------------- +sal_Bool SvtCJKOptions::IsVerticalCallOutEnabled() const +{ + DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); + return pCJKOptions->IsVerticalCallOutEnabled(); +} +/*-- 20.04.01 14:32:04--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvtCJKOptions::SetAll(sal_Bool bSet) +{ + DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); + pCJKOptions->SetAll(bSet); +} +/*-- 20.04.01 14:32:06--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Bool SvtCJKOptions::IsAnyEnabled() const +{ + DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); + return pCJKOptions->IsAnyEnabled(); +} +/*-- 13.02.2003 12:11--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Bool SvtCJKOptions::IsReadOnly(EOption eOption) const +{ + DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); + return pCJKOptions->IsReadOnly(eOption); +} + diff --git a/svl/source/config/ctloptions.cxx b/svl/source/config/ctloptions.cxx new file mode 100644 index 000000000000..5d2bf131add1 --- /dev/null +++ b/svl/source/config/ctloptions.cxx @@ -0,0 +1,503 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ctloptions.cxx,v $ + * $Revision: 1.18.140.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#ifdef SVL_DLLIMPLEMENTATION +#undef SVL_DLLIMPLEMENTATION +#endif +#define SVT_DLLIMPLEMENTATION + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + +#define ASCII_STR(s) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(s) ) +#define CFG_READONLY_DEFAULT sal_False + +// SvtCJKOptions_Impl ---------------------------------------------------------- + +class SvtCTLOptions_Impl : public utl::ConfigItem, public SfxBroadcaster +{ +private: + sal_Bool m_bIsLoaded; + sal_Bool m_bCTLFontEnabled; + sal_Bool m_bCTLSequenceChecking; + sal_Bool m_bCTLRestricted; + sal_Bool m_bCTLTypeAndReplace; + SvtCTLOptions::CursorMovement m_eCTLCursorMovement; + SvtCTLOptions::TextNumerals m_eCTLTextNumerals; + + sal_Bool m_bROCTLFontEnabled; + sal_Bool m_bROCTLSequenceChecking; + sal_Bool m_bROCTLRestricted; + sal_Bool m_bROCTLTypeAndReplace; + sal_Bool m_bROCTLCursorMovement; + sal_Bool m_bROCTLTextNumerals; + +public: + SvtCTLOptions_Impl(); + ~SvtCTLOptions_Impl(); + + virtual void Notify( const Sequence< rtl::OUString >& _aPropertyNames ); + virtual void Commit(); + void Load(); + + sal_Bool IsLoaded() { return m_bIsLoaded; } + void SetCTLFontEnabled( sal_Bool _bEnabled ); + sal_Bool IsCTLFontEnabled() const { return m_bCTLFontEnabled; } + + void SetCTLSequenceChecking( sal_Bool _bEnabled ); + sal_Bool IsCTLSequenceChecking() const { return m_bCTLSequenceChecking;} + + void SetCTLSequenceCheckingRestricted( sal_Bool _bEnable ); + sal_Bool IsCTLSequenceCheckingRestricted( void ) const { return m_bCTLRestricted; } + + void SetCTLSequenceCheckingTypeAndReplace( sal_Bool _bEnable ); + sal_Bool IsCTLSequenceCheckingTypeAndReplace() const { return m_bCTLTypeAndReplace; } + + void SetCTLCursorMovement( SvtCTLOptions::CursorMovement _eMovement ); + SvtCTLOptions::CursorMovement + GetCTLCursorMovement() const { return m_eCTLCursorMovement; } + + void SetCTLTextNumerals( SvtCTLOptions::TextNumerals _eNumerals ); + SvtCTLOptions::TextNumerals + GetCTLTextNumerals() const { return m_eCTLTextNumerals; } + + sal_Bool IsReadOnly(SvtCTLOptions::EOption eOption) const; +}; +//------------------------------------------------------------------------------ +namespace +{ + struct PropertyNames + : public rtl::Static< Sequence< rtl::OUString >, PropertyNames > {}; +} +//------------------------------------------------------------------------------ +sal_Bool SvtCTLOptions_Impl::IsReadOnly(SvtCTLOptions::EOption eOption) const +{ + sal_Bool bReadOnly = CFG_READONLY_DEFAULT; + switch(eOption) + { + case SvtCTLOptions::E_CTLFONT : bReadOnly = m_bROCTLFontEnabled ; break; + case SvtCTLOptions::E_CTLSEQUENCECHECKING : bReadOnly = m_bROCTLSequenceChecking ; break; + case SvtCTLOptions::E_CTLCURSORMOVEMENT : bReadOnly = m_bROCTLCursorMovement ; break; + case SvtCTLOptions::E_CTLTEXTNUMERALS : bReadOnly = m_bROCTLTextNumerals ; break; + case SvtCTLOptions::E_CTLSEQUENCECHECKINGRESTRICTED: bReadOnly = m_bROCTLRestricted ; break; + case SvtCTLOptions::E_CTLSEQUENCECHECKINGTYPEANDREPLACE: bReadOnly = m_bROCTLTypeAndReplace; break; + default: DBG_ERROR( "SvtCTLOptions_Impl::IsReadOnly() - invalid option" ); + } + return bReadOnly; +} +//------------------------------------------------------------------------------ +SvtCTLOptions_Impl::SvtCTLOptions_Impl() : + + utl::ConfigItem( ASCII_STR("Office.Common/I18N/CTL") ), + + m_bIsLoaded ( sal_False ), + m_bCTLFontEnabled ( sal_False ), + m_bCTLSequenceChecking ( sal_False ), + m_bCTLRestricted ( sal_False ), + m_eCTLCursorMovement ( SvtCTLOptions::MOVEMENT_LOGICAL ), + m_eCTLTextNumerals ( SvtCTLOptions::NUMERALS_ARABIC ), + + m_bROCTLFontEnabled ( CFG_READONLY_DEFAULT ), + m_bROCTLSequenceChecking( CFG_READONLY_DEFAULT ), + m_bROCTLRestricted ( CFG_READONLY_DEFAULT ), + m_bROCTLCursorMovement ( CFG_READONLY_DEFAULT ), + m_bROCTLTextNumerals ( CFG_READONLY_DEFAULT ) +{ +} +//------------------------------------------------------------------------------ +SvtCTLOptions_Impl::~SvtCTLOptions_Impl() +{ + if ( IsModified() == sal_True ) + Commit(); +} +// ----------------------------------------------------------------------------- +void SvtCTLOptions_Impl::Notify( const Sequence< rtl::OUString >& ) +{ + Load(); + Broadcast(SfxSimpleHint(SFX_HINT_CTL_SETTINGS_CHANGED)); +} +// ----------------------------------------------------------------------------- +void SvtCTLOptions_Impl::Commit() +{ + Sequence< rtl::OUString > &rPropertyNames = PropertyNames::get(); + rtl::OUString* pOrgNames = rPropertyNames.getArray(); + sal_Int32 nOrgCount = rPropertyNames.getLength(); + + Sequence< rtl::OUString > aNames( nOrgCount ); + Sequence< Any > aValues( nOrgCount ); + + rtl::OUString* pNames = aNames.getArray(); + Any* pValues = aValues.getArray(); + sal_Int32 nRealCount = 0; + + const uno::Type& rType = ::getBooleanCppuType(); + + for ( int nProp = 0; nProp < nOrgCount; nProp++ ) + { + switch ( nProp ) + { + case 0: + { + if (!m_bROCTLFontEnabled) + { + pNames[nRealCount] = pOrgNames[nProp]; + pValues[nRealCount].setValue( &m_bCTLFontEnabled, rType ); + ++nRealCount; + } + } + break; + + case 1: + { + if (!m_bROCTLSequenceChecking) + { + pNames[nRealCount] = pOrgNames[nProp]; + pValues[nRealCount].setValue( &m_bCTLSequenceChecking, rType ); + ++nRealCount; + } + } + break; + + case 2: + { + if (!m_bROCTLCursorMovement) + { + pNames[nRealCount] = pOrgNames[nProp]; + pValues[nRealCount] <<= (sal_Int32)m_eCTLCursorMovement; + ++nRealCount; + } + } + break; + + case 3: + { + if (!m_bROCTLTextNumerals) + { + pNames[nRealCount] = pOrgNames[nProp]; + pValues[nRealCount] <<= (sal_Int32)m_eCTLTextNumerals; + ++nRealCount; + } + } + break; + + case 4: + { + if (!m_bROCTLRestricted) + { + pNames[nRealCount] = pOrgNames[nProp]; + pValues[nRealCount].setValue( &m_bCTLRestricted, rType ); + ++nRealCount; + } + } + break; + case 5: + { + if(!m_bROCTLTypeAndReplace) + { + pNames[nRealCount] = pOrgNames[nProp]; + pValues[nRealCount].setValue( &m_bCTLTypeAndReplace, rType ); + ++nRealCount; + } + } + break; + } + } + aNames.realloc(nRealCount); + aValues.realloc(nRealCount); + PutProperties( aNames, aValues ); + //broadcast changes + Broadcast(SfxSimpleHint(SFX_HINT_CTL_SETTINGS_CHANGED)); +} +// ----------------------------------------------------------------------------- +void SvtCTLOptions_Impl::Load() +{ + Sequence< rtl::OUString >& rPropertyNames = PropertyNames::get(); + if ( !rPropertyNames.getLength() ) + { + rPropertyNames.realloc(6); + rtl::OUString* pNames = rPropertyNames.getArray(); + pNames[0] = ASCII_STR("CTLFont"); + pNames[1] = ASCII_STR("CTLSequenceChecking"); + pNames[2] = ASCII_STR("CTLCursorMovement"); + pNames[3] = ASCII_STR("CTLTextNumerals"); + pNames[4] = ASCII_STR("CTLSequenceCheckingRestricted"); + pNames[5] = ASCII_STR("CTLSequenceCheckingTypeAndReplace"); + EnableNotification( rPropertyNames ); + } + Sequence< Any > aValues = GetProperties( rPropertyNames ); + Sequence< sal_Bool > aROStates = GetReadOnlyStates( rPropertyNames ); + const Any* pValues = aValues.getConstArray(); + const sal_Bool* pROStates = aROStates.getConstArray(); + DBG_ASSERT( aValues.getLength() == rPropertyNames.getLength(), "GetProperties failed" ); + DBG_ASSERT( aROStates.getLength() == rPropertyNames.getLength(), "GetReadOnlyStates failed" ); + if ( aValues.getLength() == rPropertyNames.getLength() && aROStates.getLength() == rPropertyNames.getLength() ) + { + sal_Bool bValue = sal_False; + sal_Int32 nValue = 0; + + for ( int nProp = 0; nProp < rPropertyNames.getLength(); nProp++ ) + { + if ( pValues[nProp].hasValue() ) + { + if ( pValues[nProp] >>= bValue ) + { + switch ( nProp ) + { + case 0: { m_bCTLFontEnabled = bValue; m_bROCTLFontEnabled = pROStates[nProp]; } break; + case 1: { m_bCTLSequenceChecking = bValue; m_bROCTLSequenceChecking = pROStates[nProp]; } break; + case 4: { m_bCTLRestricted = bValue; m_bROCTLRestricted = pROStates[nProp]; } break; + case 5: { m_bCTLTypeAndReplace = bValue; m_bROCTLTypeAndReplace = pROStates[nProp]; } break; + } + } + else if ( pValues[nProp] >>= nValue ) + { + switch ( nProp ) + { + case 2: { m_eCTLCursorMovement = (SvtCTLOptions::CursorMovement)nValue; m_bROCTLCursorMovement = pROStates[nProp]; } break; + case 3: { m_eCTLTextNumerals = (SvtCTLOptions::TextNumerals)nValue; m_bROCTLTextNumerals = pROStates[nProp]; } break; + } + } + } + } + } + sal_uInt16 nType = SvtLanguageOptions::GetScriptTypeOfLanguage(LANGUAGE_SYSTEM); + SvtSystemLanguageOptions aSystemLocaleSettings; + LanguageType eSystemLanguage = aSystemLocaleSettings.GetWin16SystemLanguage(); + sal_uInt16 nWinScript = SvtLanguageOptions::GetScriptTypeOfLanguage( eSystemLanguage ); + if( !m_bCTLFontEnabled && (( nType & SCRIPTTYPE_COMPLEX ) || + ((eSystemLanguage != LANGUAGE_SYSTEM) && ( nWinScript & SCRIPTTYPE_COMPLEX ))) ) + { + m_bCTLFontEnabled = sal_True; + sal_uInt16 nLanguage = Application::GetSettings().GetLanguage(); + //enable sequence checking for the appropriate languages + m_bCTLSequenceChecking = m_bCTLRestricted = m_bCTLTypeAndReplace = + (MsLangId::needsSequenceChecking( nLanguage) || + MsLangId::needsSequenceChecking( eSystemLanguage)); + Commit(); + } + m_bIsLoaded = sal_True; +} +//------------------------------------------------------------------------------ +void SvtCTLOptions_Impl::SetCTLFontEnabled( sal_Bool _bEnabled ) +{ + if(!m_bROCTLFontEnabled && m_bCTLFontEnabled != _bEnabled) + { + m_bCTLFontEnabled = _bEnabled; + SetModified(); + } +} +//------------------------------------------------------------------------------ +void SvtCTLOptions_Impl::SetCTLSequenceChecking( sal_Bool _bEnabled ) +{ + if(!m_bROCTLSequenceChecking && m_bCTLSequenceChecking != _bEnabled) + { + SetModified(); + m_bCTLSequenceChecking = _bEnabled; + } +} +//------------------------------------------------------------------------------ +void SvtCTLOptions_Impl::SetCTLSequenceCheckingRestricted( sal_Bool _bEnabled ) +{ + if(!m_bROCTLRestricted && m_bCTLRestricted != _bEnabled) + { + SetModified(); + m_bCTLRestricted = _bEnabled; + } +} +//------------------------------------------------------------------------------ +void SvtCTLOptions_Impl::SetCTLSequenceCheckingTypeAndReplace( sal_Bool _bEnabled ) +{ + if(!m_bROCTLTypeAndReplace && m_bCTLTypeAndReplace != _bEnabled) + { + SetModified(); + m_bCTLTypeAndReplace = _bEnabled; + } +} +//------------------------------------------------------------------------------ +void SvtCTLOptions_Impl::SetCTLCursorMovement( SvtCTLOptions::CursorMovement _eMovement ) +{ + if (!m_bROCTLCursorMovement && m_eCTLCursorMovement != _eMovement ) + { + SetModified(); + m_eCTLCursorMovement = _eMovement; + } +} +//------------------------------------------------------------------------------ +void SvtCTLOptions_Impl::SetCTLTextNumerals( SvtCTLOptions::TextNumerals _eNumerals ) +{ + if (!m_bROCTLTextNumerals && m_eCTLTextNumerals != _eNumerals ) + { + SetModified(); + m_eCTLTextNumerals = _eNumerals; + } +} +// global ---------------------------------------------------------------- + +static SvtCTLOptions_Impl* pCTLOptions = NULL; +static sal_Int32 nCTLRefCount = 0; +namespace { struct CTLMutex : public rtl::Static< osl::Mutex, CTLMutex > {}; } + +// class SvtCTLOptions -------------------------------------------------- + +SvtCTLOptions::SvtCTLOptions( sal_Bool bDontLoad ) +{ + // Global access, must be guarded (multithreading) + ::osl::MutexGuard aGuard( CTLMutex::get() ); + if ( !pCTLOptions ) + { + pCTLOptions = new SvtCTLOptions_Impl; + ItemHolder2::holdConfigItem(E_CTLOPTIONS); + } + if( !bDontLoad && !pCTLOptions->IsLoaded() ) + pCTLOptions->Load(); + + ++nCTLRefCount; + m_pImp = pCTLOptions; + StartListening( *m_pImp); +} + +// ----------------------------------------------------------------------- + +SvtCTLOptions::~SvtCTLOptions() +{ + // Global access, must be guarded (multithreading) + ::osl::MutexGuard aGuard( CTLMutex::get() ); + + if ( !--nCTLRefCount ) + DELETEZ( pCTLOptions ); +} +// ----------------------------------------------------------------------------- +void SvtCTLOptions::SetCTLFontEnabled( sal_Bool _bEnabled ) +{ + DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); + pCTLOptions->SetCTLFontEnabled( _bEnabled ); +} +// ----------------------------------------------------------------------------- +sal_Bool SvtCTLOptions::IsCTLFontEnabled() const +{ + DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); + return pCTLOptions->IsCTLFontEnabled(); +} +// ----------------------------------------------------------------------------- +void SvtCTLOptions::SetCTLSequenceChecking( sal_Bool _bEnabled ) +{ + DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); + pCTLOptions->SetCTLSequenceChecking(_bEnabled); +} +// ----------------------------------------------------------------------------- +sal_Bool SvtCTLOptions::IsCTLSequenceChecking() const +{ + DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); + return pCTLOptions->IsCTLSequenceChecking(); +} +// ----------------------------------------------------------------------------- +void SvtCTLOptions::SetCTLSequenceCheckingRestricted( sal_Bool _bEnable ) +{ + DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); + pCTLOptions->SetCTLSequenceCheckingRestricted(_bEnable); +} +// ----------------------------------------------------------------------------- +sal_Bool SvtCTLOptions::IsCTLSequenceCheckingRestricted( void ) const +{ + DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); + return pCTLOptions->IsCTLSequenceCheckingRestricted(); +} +// ----------------------------------------------------------------------------- +void SvtCTLOptions::SetCTLSequenceCheckingTypeAndReplace( sal_Bool _bEnable ) +{ + DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); + pCTLOptions->SetCTLSequenceCheckingTypeAndReplace(_bEnable); +} +// ----------------------------------------------------------------------------- +sal_Bool SvtCTLOptions::IsCTLSequenceCheckingTypeAndReplace() const +{ + DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); + return pCTLOptions->IsCTLSequenceCheckingTypeAndReplace(); +} +// ----------------------------------------------------------------------------- +void SvtCTLOptions::SetCTLCursorMovement( SvtCTLOptions::CursorMovement _eMovement ) +{ + DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); + pCTLOptions->SetCTLCursorMovement( _eMovement ); +} +// ----------------------------------------------------------------------------- +SvtCTLOptions::CursorMovement SvtCTLOptions::GetCTLCursorMovement() const +{ + DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); + return pCTLOptions->GetCTLCursorMovement(); +} +// ----------------------------------------------------------------------------- +void SvtCTLOptions::SetCTLTextNumerals( SvtCTLOptions::TextNumerals _eNumerals ) +{ + DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); + pCTLOptions->SetCTLTextNumerals( _eNumerals ); +} +// ----------------------------------------------------------------------------- +SvtCTLOptions::TextNumerals SvtCTLOptions::GetCTLTextNumerals() const +{ + DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); + return pCTLOptions->GetCTLTextNumerals(); +} +// ----------------------------------------------------------------------------- +sal_Bool SvtCTLOptions::IsReadOnly(EOption eOption) const +{ + DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); + return pCTLOptions->IsReadOnly(eOption); +} +/* -----------------30.04.2003 10:40----------------- + + --------------------------------------------------*/ +void SvtCTLOptions::Notify( SfxBroadcaster&, const SfxHint& rHint ) +{ + vos::OGuard aVclGuard( Application::GetSolarMutex() ); + Broadcast( rHint ); +} + +// ----------------------------------------------------------------------------- + diff --git a/svl/source/config/itemholder2.cxx b/svl/source/config/itemholder2.cxx new file mode 100644 index 000000000000..d0e5b30007f9 --- /dev/null +++ b/svl/source/config/itemholder2.cxx @@ -0,0 +1,242 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: itemholder2.cxx,v $ + * $Revision: 1.13 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#ifdef SVL_DLLIMPLEMENTATION +#undef SVL_DLLIMPLEMENTATION +#endif +#define SVT_DLLIMPLEMENTATION + +#include "itemholder2.hxx" + +//----------------------------------------------- +// includes +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include + +//----------------------------------------------- +// namespaces + +namespace css = ::com::sun::star; + +//----------------------------------------------- +// declarations + +//----------------------------------------------- +ItemHolder2::ItemHolder2() + : ItemHolderMutexBase() +{ + try + { + css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); + css::uno::Reference< css::lang::XComponent > xCfg( + xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")), + css::uno::UNO_QUERY); + if (xCfg.is()) + xCfg->addEventListener(static_cast< css::lang::XEventListener* >(this)); + } +// #i37892 got errorhandling from ConfigManager::GetConfigurationProvider() + catch(css::uno::RuntimeException& rREx) + { + throw rREx; + } +#ifdef DBG_UTIL + catch(css::uno::Exception& rEx) + { + static sal_Bool bMessage = sal_True; + if(bMessage) + { + bMessage = sal_False; + ::rtl::OString sMsg("CreateInstance with arguments exception: "); + sMsg += ::rtl::OString(rEx.Message.getStr(), + rEx.Message.getLength(), + RTL_TEXTENCODING_ASCII_US); + DBG_ERROR(sMsg.getStr()); + } + } +#else + catch(css::uno::Exception&){} +#endif +} + +//----------------------------------------------- +ItemHolder2::~ItemHolder2() +{ + impl_releaseAllItems(); +} + +//----------------------------------------------- +void ItemHolder2::holdConfigItem(EItem eItem) +{ + static ItemHolder2* pHolder = new ItemHolder2(); + pHolder->impl_addItem(eItem); +} + +//----------------------------------------------- +void SAL_CALL ItemHolder2::disposing(const css::lang::EventObject&) + throw(css::uno::RuntimeException) +{ + impl_releaseAllItems(); +} + +//----------------------------------------------- +void ItemHolder2::impl_addItem(EItem eItem) +{ + ::osl::ResettableMutexGuard aLock(m_aLock); + + TItems::const_iterator pIt; + for ( pIt = m_lItems.begin(); + pIt != m_lItems.end() ; + ++pIt ) + { + const TItemInfo& rInfo = *pIt; + if (rInfo.eItem == eItem) + return; + } + + TItemInfo aNewItem; + aNewItem.eItem = eItem; + impl_newItem(aNewItem); + if (aNewItem.pItem) + m_lItems.push_back(aNewItem); +} + +//----------------------------------------------- +void ItemHolder2::impl_releaseAllItems() +{ + ::osl::ResettableMutexGuard aLock(m_aLock); + + TItems::iterator pIt; + for ( pIt = m_lItems.begin(); + pIt != m_lItems.end() ; + ++pIt ) + { + TItemInfo& rInfo = *pIt; + impl_deleteItem(rInfo); + } + m_lItems.clear(); +} + +//----------------------------------------------- +void ItemHolder2::impl_newItem(TItemInfo& rItem) +{ + switch(rItem.eItem) + { + case E_ACCESSIBILITYOPTIONS : + rItem.pItem = new SvtAccessibilityOptions(); + break; + + case E_APEARCFG : +// no ref count rItem.pItem = new SvtTabAppearanceCfg(); + break; + + case E_CJKOPTIONS : + rItem.pItem = new SvtCJKOptions(); + break; + + case E_COLORCFG : + rItem.pItem = new ::svtools::ColorConfig(); + break; + + case E_CTLOPTIONS : + rItem.pItem = new SvtCTLOptions(); + break; + + case E_FONTSUBSTCONFIG : +// no ref count rItem.pItem = new SvtFontSubstConfig(); + break; + + case E_HELPOPTIONS : + rItem.pItem = new SvtHelpOptions(); + break; + + case E_LANGUAGEOPTIONS : +// capsulate CTL and CJL options ! rItem.pItem = new SvtLanguageOptions(); + break; + + case E_MISCCFG : +// no ref count rItem.pItem = new SfxMiscCfg(); + break; + + case E_MENUOPTIONS : + rItem.pItem = new SvtMenuOptions(); + break; + + case E_PRINTOPTIONS : + rItem.pItem = new SvtPrinterOptions(); + break; + + case E_PRINTFILEOPTIONS : + rItem.pItem = new SvtPrintFileOptions(); + break; + + case E_SYSLOCALEOPTIONS : + rItem.pItem = new SvtSysLocaleOptions(); + break; + + case E_MISCOPTIONS : + rItem.pItem = new SvtMiscOptions(); + break; + + default: + OSL_ASSERT(false); + break; + } +} + +//----------------------------------------------- +void ItemHolder2::impl_deleteItem(TItemInfo& rItem) +{ + if (rItem.pItem) + { + delete rItem.pItem; + rItem.pItem = 0; + } +} diff --git a/svl/source/config/itemholder2.hxx b/svl/source/config/itemholder2.hxx new file mode 100644 index 000000000000..192df8f746c9 --- /dev/null +++ b/svl/source/config/itemholder2.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: itemholder2.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_SVTOOLS_ITEMHOLDER2_HXX_ +#define INCLUDED_SVTOOLS_ITEMHOLDER2_HXX_ + +//----------------------------------------------- +// includes + +#include +#include +#include + +//----------------------------------------------- +// namespaces + +#ifdef css +#error "Cant use css as namespace alias." +#else +#define css ::com::sun::star +#endif + +//----------------------------------------------- +// definitions + +class ItemHolder2 : private ItemHolderMutexBase + , public ::cppu::WeakImplHelper1< css::lang::XEventListener > +{ + //........................................... + // member + private: + + TItems m_lItems; + + //........................................... + // c++ interface + public: + + ItemHolder2(); + virtual ~ItemHolder2(); + static void holdConfigItem(EItem eItem); + + //........................................... + // uno interface + public: + + virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) + throw(css::uno::RuntimeException); + + //........................................... + // helper + private: + + void impl_addItem(EItem eItem); + void impl_releaseAllItems(); + void impl_newItem(TItemInfo& rItem); + void impl_deleteItem(TItemInfo& rItem); +}; + +//----------------------------------------------- +// namespaces + +#undef css + +#endif // INCLUDED_SVTOOLS_ITEMHOLDER2_HXX_ diff --git a/svl/source/config/languageoptions.cxx b/svl/source/config/languageoptions.cxx new file mode 100644 index 000000000000..0dffafee86d2 --- /dev/null +++ b/svl/source/config/languageoptions.cxx @@ -0,0 +1,283 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: languageoptions.cxx,v $ + * $Revision: 1.21 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#ifdef SVL_DLLIMPLEMENTATION +#undef SVL_DLLIMPLEMENTATION +#endif +#define SVT_DLLIMPLEMENTATION + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace ::com::sun::star; +// global ---------------------------------------------------------------------- + +namespace { struct ALMutex : public rtl::Static< ::osl::Mutex, ALMutex > {}; } + +// class SvtLanguageOptions ---------------------------------------------------- + +SvtLanguageOptions::SvtLanguageOptions( sal_Bool _bDontLoad ) +{ + // Global access, must be guarded (multithreading) + ::osl::MutexGuard aGuard( ALMutex::get() ); + + m_pCJKOptions = new SvtCJKOptions( _bDontLoad ); + m_pCTLOptions = new SvtCTLOptions( _bDontLoad ); + StartListening(*m_pCTLOptions); +} +//------------------------------------------------------------------------------ +SvtLanguageOptions::~SvtLanguageOptions() +{ + // Global access, must be guarded (multithreading) + ::osl::MutexGuard aGuard( ALMutex::get() ); + + delete m_pCJKOptions; + delete m_pCTLOptions; +} +//------------------------------------------------------------------------------ +// CJK options ----------------------------------------------------------------- +//------------------------------------------------------------------------------ +sal_Bool SvtLanguageOptions::IsCJKFontEnabled() const +{ + return m_pCJKOptions->IsCJKFontEnabled(); +} +//------------------------------------------------------------------------------ +sal_Bool SvtLanguageOptions::IsVerticalTextEnabled() const +{ + return m_pCJKOptions->IsVerticalTextEnabled(); +} +//------------------------------------------------------------------------------ +sal_Bool SvtLanguageOptions::IsAsianTypographyEnabled() const +{ + return m_pCJKOptions->IsAsianTypographyEnabled(); +} +//------------------------------------------------------------------------------ +sal_Bool SvtLanguageOptions::IsJapaneseFindEnabled() const +{ + return m_pCJKOptions->IsJapaneseFindEnabled(); +} +//------------------------------------------------------------------------------ +sal_Bool SvtLanguageOptions::IsRubyEnabled() const +{ + return m_pCJKOptions->IsRubyEnabled(); +} +//------------------------------------------------------------------------------ +sal_Bool SvtLanguageOptions::IsChangeCaseMapEnabled() const +{ + return m_pCJKOptions->IsChangeCaseMapEnabled(); +} +//------------------------------------------------------------------------------ +sal_Bool SvtLanguageOptions::IsDoubleLinesEnabled() const +{ + return m_pCJKOptions->IsDoubleLinesEnabled(); +} +//------------------------------------------------------------------------------ +sal_Bool SvtLanguageOptions::IsEmphasisMarksEnabled() const +{ + return m_pCJKOptions->IsEmphasisMarksEnabled(); +} +//------------------------------------------------------------------------------ +sal_Bool SvtLanguageOptions::IsVerticalCallOutEnabled() const +{ + return m_pCJKOptions->IsVerticalCallOutEnabled(); +} +//------------------------------------------------------------------------------ +void SvtLanguageOptions::SetAll( sal_Bool _bSet ) +{ + m_pCJKOptions->SetAll( _bSet ); +} +//------------------------------------------------------------------------------ +sal_Bool SvtLanguageOptions::IsAnyEnabled() const +{ + return m_pCJKOptions->IsAnyEnabled(); +} +//------------------------------------------------------------------------------ +// CTL options ----------------------------------------------------------------- +//------------------------------------------------------------------------------ +void SvtLanguageOptions::SetCTLFontEnabled( sal_Bool _bEnabled ) +{ + m_pCTLOptions->SetCTLFontEnabled( _bEnabled ); +} +//------------------------------------------------------------------------------ +sal_Bool SvtLanguageOptions::IsCTLFontEnabled() const +{ + return m_pCTLOptions->IsCTLFontEnabled(); +} +//------------------------------------------------------------------------------ +void SvtLanguageOptions::SetCTLSequenceChecking( sal_Bool _bEnabled ) +{ + m_pCTLOptions->SetCTLSequenceChecking( _bEnabled ); +} +//------------------------------------------------------------------------------ +sal_Bool SvtLanguageOptions::IsCTLSequenceChecking() const +{ + return m_pCTLOptions->IsCTLSequenceChecking(); +} +/*-- 26.09.2005 15:48:23--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvtLanguageOptions::SetCTLSequenceCheckingRestricted( sal_Bool _bEnable ) +{ + m_pCTLOptions->SetCTLSequenceCheckingRestricted( _bEnable ); +} +/*-- 26.09.2005 15:48:23--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Bool SvtLanguageOptions::IsCTLSequenceCheckingRestricted( void ) const +{ + return m_pCTLOptions->IsCTLSequenceCheckingRestricted(); +} +/*-- 26.09.2005 15:48:23--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvtLanguageOptions::SetCTLSequenceCheckingTypeAndReplace( sal_Bool _bEnable ) +{ + m_pCTLOptions->SetCTLSequenceCheckingTypeAndReplace( _bEnable ); +} +/*-- 26.09.2005 15:48:24--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Bool SvtLanguageOptions::IsCTLSequenceCheckingTypeAndReplace() const +{ + return m_pCTLOptions->IsCTLSequenceCheckingTypeAndReplace(); +} + +//------------------------------------------------------------------------------ +sal_Bool SvtLanguageOptions::IsReadOnly(SvtLanguageOptions::EOption eOption) const +{ + sal_Bool bReadOnly = sal_False; + switch(eOption) + { + // cjk options + case SvtLanguageOptions::E_CJKFONT : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_CJKFONT ); break; + case SvtLanguageOptions::E_VERTICALTEXT : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_VERTICALTEXT ); break; + case SvtLanguageOptions::E_ASIANTYPOGRAPHY : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_ASIANTYPOGRAPHY); break; + case SvtLanguageOptions::E_JAPANESEFIND : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_JAPANESEFIND ); break; + case SvtLanguageOptions::E_RUBY : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_RUBY ); break; + case SvtLanguageOptions::E_CHANGECASEMAP : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_CHANGECASEMAP ); break; + case SvtLanguageOptions::E_DOUBLELINES : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_DOUBLELINES ); break; + case SvtLanguageOptions::E_EMPHASISMARKS : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_EMPHASISMARKS ); break; + case SvtLanguageOptions::E_VERTICALCALLOUT : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_VERTICALCALLOUT); break; + case SvtLanguageOptions::E_ALLCJK : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_ALL ); break; + // ctl options + case SvtLanguageOptions::E_CTLFONT : bReadOnly = m_pCTLOptions->IsReadOnly(SvtCTLOptions::E_CTLFONT ); break; + case SvtLanguageOptions::E_CTLSEQUENCECHECKING : bReadOnly = m_pCTLOptions->IsReadOnly(SvtCTLOptions::E_CTLSEQUENCECHECKING); break; + case SvtLanguageOptions::E_CTLCURSORMOVEMENT : bReadOnly = m_pCTLOptions->IsReadOnly(SvtCTLOptions::E_CTLCURSORMOVEMENT ); break; + case SvtLanguageOptions::E_CTLTEXTNUMERALS : bReadOnly = m_pCTLOptions->IsReadOnly(SvtCTLOptions::E_CTLTEXTNUMERALS ); break; + } + return bReadOnly; +} +/* -----------------30.04.2003 11:03----------------- + + --------------------------------------------------*/ +void SvtLanguageOptions::Notify( SfxBroadcaster&, const SfxHint& rHint ) +{ + vos::OGuard aVclGuard( Application::GetSolarMutex() ); + Broadcast( rHint ); +} + +// ----------------------------------------------------------------------------- +// returns for a language the scripttype +sal_uInt16 SvtLanguageOptions::GetScriptTypeOfLanguage( sal_uInt16 nLang ) +{ + if( LANGUAGE_DONTKNOW == nLang ) + nLang = LANGUAGE_ENGLISH_US; + else if( LANGUAGE_SYSTEM == nLang ) + nLang = Application::GetSettings().GetLanguage(); + + sal_Int16 nScriptType = MsLangId::getScriptType( nLang ); + USHORT nScript; + switch (nScriptType) + { + case ::com::sun::star::i18n::ScriptType::ASIAN: + nScript = SCRIPTTYPE_ASIAN; + break; + case ::com::sun::star::i18n::ScriptType::COMPLEX: + nScript = SCRIPTTYPE_COMPLEX; + break; + default: + nScript = SCRIPTTYPE_LATIN; + } + return nScript; +} +// ----------------------------------------------------------------------------- + + +/*-- 27.10.2005 08:18:01--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SvtSystemLanguageOptions::SvtSystemLanguageOptions() : + utl::ConfigItem( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("System/L10N") )) +{ + uno::Sequence< rtl::OUString > aPropertyNames(1); + rtl::OUString* pNames = aPropertyNames.getArray(); + pNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SystemLocale")); + uno::Sequence< uno::Any > aValues = GetProperties( aPropertyNames ); + + if ( aValues.getLength() ) + { + aValues[0]>>= m_sWin16SystemLocale; + } +} +/*-- 27.10.2005 08:18:01--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SvtSystemLanguageOptions::~SvtSystemLanguageOptions() +{ +} +/*-- 27.10.2005 08:18:02--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvtSystemLanguageOptions::Commit() +{ + //does nothing +} +/*-- 27.10.2005 08:36:14--------------------------------------------------- + + -----------------------------------------------------------------------*/ +LanguageType SvtSystemLanguageOptions::GetWin16SystemLanguage() +{ + if( m_sWin16SystemLocale.getLength() == 0 ) + return LANGUAGE_NONE; + return MsLangId::convertIsoStringToLanguage( m_sWin16SystemLocale ); +} + + diff --git a/svl/source/config/makefile.mk b/svl/source/config/makefile.mk new file mode 100644 index 000000000000..d3f2615776da --- /dev/null +++ b/svl/source/config/makefile.mk @@ -0,0 +1,66 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.61 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* +PRJ=..$/.. + +PRJNAME=svtools +TARGET=config + +ENABLE_EXCEPTIONS := TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/svl.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES= \ + $(SLO)$/accessibilityoptions.obj \ + $(SLO)$/apearcfg.obj \ + $(SLO)$/cjkoptions.obj \ + $(SLO)$/colorcfg.obj \ + $(SLO)$/ctloptions.obj \ + $(SLO)$/extcolorcfg.obj \ + $(SLO)$/fontsubstconfig.obj \ + $(SLO)$/helpopt.obj \ + $(SLO)$/itemholder2.obj \ + $(SLO)$/languageoptions.obj \ + $(SLO)$/menuoptions.obj \ + $(SLO)$/misccfg.obj \ + $(SLO)$/miscopt.obj \ + $(SLO)$/optionsdrawinglayer.obj \ + $(SLO)$/printoptions.obj \ + $(SLO)$/syslocaleoptions.obj + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + diff --git a/svl/source/config/misccfg.cxx b/svl/source/config/misccfg.cxx new file mode 100644 index 000000000000..06cc9b7446c0 --- /dev/null +++ b/svl/source/config/misccfg.cxx @@ -0,0 +1,195 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: misccfg.cxx,v $ + * $Revision: 1.9 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#ifdef SVL_DLLIMPLEMENTATION +#undef SVL_DLLIMPLEMENTATION +#endif +#define SVT_DLLIMPLEMENTATION + +#include "misccfg.hxx" +#include +#include + +#include + + +#define DEFAULT_TAB 2000 + +#define DEF_INCH 2540L +#define DEF_RELTWIP 1440L + +using namespace rtl; +using namespace com::sun::star::uno; + +#define C2U(cChar) OUString::createFromAscii(cChar) +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ +SfxMiscCfg::SfxMiscCfg() : + ConfigItem(C2U("Office.Common") ), + bPaperSize(FALSE), + bPaperOrientation (FALSE), + bNotFound (FALSE), + nYear2000( SvNumberFormatter::GetYear2000Default() ) +{ + RTL_LOGFILE_CONTEXT(aLog, "svtools SfxMiscCfg::SfxMiscCfg()"); + + Load(); +} +/* -----------------------------02.03.01 15:31-------------------------------- + + ---------------------------------------------------------------------------*/ +SfxMiscCfg::~SfxMiscCfg() +{ +} +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +void SfxMiscCfg::SetNotFoundWarning( BOOL bSet) +{ + if(bNotFound != bSet) + SetModified(); + bNotFound = bSet; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +void SfxMiscCfg::SetPaperSizeWarning( BOOL bSet) +{ + if(bPaperSize != bSet) + SetModified(); + bPaperSize = bSet; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ +void SfxMiscCfg::SetPaperOrientationWarning( BOOL bSet) +{ + if(bPaperOrientation != bSet) + SetModified(); + bPaperOrientation = bSet; +} +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +void SfxMiscCfg::SetYear2000( sal_Int32 nSet ) +{ + if(nYear2000 != nSet) + SetModified(); + nYear2000 = nSet; +} +/* -----------------------------02.03.01 15:31-------------------------------- + + ---------------------------------------------------------------------------*/ +const Sequence& SfxMiscCfg::GetPropertyNames() +{ + static Sequence aNames; + if(!aNames.getLength()) + { + static const char* aPropNames[] = + { + "Print/Warning/PaperSize", // 0 + "Print/Warning/PaperOrientation", // 1 + "Print/Warning/NotFound", // 2 + "DateFormat/TwoDigitYear", // 3 + }; + const int nCount = 4; + aNames.realloc(nCount); + OUString* pNames = aNames.getArray(); + for(int i = 0; i < nCount; i++) + pNames[i] = OUString::createFromAscii(aPropNames[i]); + } + return aNames; +} +/* -----------------------------02.03.01 15:31-------------------------------- + + ---------------------------------------------------------------------------*/ +void SfxMiscCfg::Load() +{ + const Sequence& aNames = GetPropertyNames(); + Sequence aValues = GetProperties(aNames); + EnableNotification(aNames); + const Any* pValues = aValues.getConstArray(); + DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed"); + if(aValues.getLength() == aNames.getLength()) + { + for(int nProp = 0; nProp < aNames.getLength(); nProp++) + { + if(pValues[nProp].hasValue()) + { + switch(nProp) + { + case 0: bPaperSize = *(sal_Bool*)pValues[nProp].getValue(); break; //"Print/Warning/PaperSize", + case 1: bPaperOrientation = *(sal_Bool*)pValues[nProp].getValue(); break; //"Print/Warning/PaperOrientation", + case 2: bNotFound = *(sal_Bool*)pValues[nProp].getValue() ; break; //"Print/Warning/NotFound", + case 3: pValues[nProp] >>= nYear2000;break; //"DateFormat/TwoDigitYear", + } + } + } + } +} +/* -----------------------------02.03.01 15:31-------------------------------- + + ---------------------------------------------------------------------------*/ +void SfxMiscCfg::Notify( const com::sun::star::uno::Sequence& ) +{ + Load(); +} +/* -----------------------------02.03.01 15:31-------------------------------- + + ---------------------------------------------------------------------------*/ +void SfxMiscCfg::Commit() +{ + const Sequence& aNames = GetPropertyNames(); + Sequence aValues(aNames.getLength()); + Any* pValues = aValues.getArray(); + + const Type& rType = ::getBooleanCppuType(); + for(int nProp = 0; nProp < aNames.getLength(); nProp++) + { + switch(nProp) + { + case 0: pValues[nProp].setValue(&bPaperSize, rType);break; //"Print/Warning/PaperSize", + case 1: pValues[nProp].setValue(&bPaperOrientation, rType);break; //"Print/Warning/PaperOrientation", + case 2: pValues[nProp].setValue(&bNotFound, rType);break; //"Print/Warning/NotFound", + case 3: pValues[nProp] <<= nYear2000;break; //"DateFormat/TwoDigitYear", + } + } + PutProperties(aNames, aValues); +} + diff --git a/svl/source/config/syslocaleoptions.cxx b/svl/source/config/syslocaleoptions.cxx new file mode 100644 index 000000000000..a75c63e34af0 --- /dev/null +++ b/svl/source/config/syslocaleoptions.cxx @@ -0,0 +1,637 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: syslocaleoptions.cxx,v $ + * $Revision: 1.23 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#ifdef SVL_DLLIMPLEMENTATION +#undef SVL_DLLIMPLEMENTATION +#endif +#define SVT_DLLIMPLEMENTATION + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "itemholder2.hxx" + + +#define CFG_READONLY_DEFAULT sal_False + +using namespace osl; +using namespace utl; +using namespace rtl; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; + + +SvtSysLocaleOptions_Impl* SvtSysLocaleOptions::pOptions = NULL; +sal_Int32 SvtSysLocaleOptions::nRefCount = 0; +namespace +{ + struct CurrencyChangeLink + : public rtl::Static {}; +} + +class SvtSysLocaleOptions_Impl : public utl::ConfigItem +{ + OUString m_aLocaleString; // en-US or de-DE or empty for SYSTEM + LanguageType m_eLocaleLanguageType; // same for convenience access + OUString m_aCurrencyString; // USD-en-US or EUR-de-DE + SvtBroadcaster m_aBroadcaster; + ULONG m_nBlockedHint; // pending hints + sal_Int32 m_nBroadcastBlocked; // broadcast only if this is 0 + sal_Bool m_bDecimalSeparator; //use decimal separator same as locale + + + sal_Bool m_bROLocale; + sal_Bool m_bROCurrency; + sal_Bool m_bRODecimalSeparator; + + static const Sequence< /* const */ OUString > GetPropertyNames(); + + void UpdateMiscSettings_Impl(); + ULONG ChangeLocaleSettings(); + void ChangeDefaultCurrency() const; + void Broadcast( ULONG nHint ); + +public: + SvtSysLocaleOptions_Impl(); + virtual ~SvtSysLocaleOptions_Impl(); + + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); + virtual void Commit(); + + const OUString& GetLocaleString() const + { return m_aLocaleString; } + void SetLocaleString( const OUString& rStr ); + LanguageType GetLocaleLanguageType() const + { return m_eLocaleLanguageType; } + + const OUString& GetCurrencyString() const + { return m_aCurrencyString; } + void SetCurrencyString( const OUString& rStr ); + + sal_Bool IsDecimalSeparatorAsLocale() const { return m_bDecimalSeparator;} + void SetDecimalSeparatorAsLocale( sal_Bool bSet); + + SvtBroadcaster& GetBroadcaster() + { return m_aBroadcaster; } + void BlockBroadcasts( BOOL bBlock ); + sal_Bool IsReadOnly( SvtSysLocaleOptions::EOption eOption ) const; +}; + + +#define ROOTNODE_SYSLOCALE OUString(RTL_CONSTASCII_USTRINGPARAM("Setup/L10N")) + +#define PROPERTYNAME_LOCALE OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupSystemLocale")) +#define PROPERTYNAME_CURRENCY OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupCurrency")) +#define PROPERTYNAME_DECIMALSEPARATOR OUString(RTL_CONSTASCII_USTRINGPARAM("DecimalSeparatorAsLocale")) + +#define PROPERTYHANDLE_LOCALE 0 +#define PROPERTYHANDLE_CURRENCY 1 +#define PROPERTYHANDLE_DECIMALSEPARATOR 2 + +#define PROPERTYCOUNT 3 + +const Sequence< OUString > SvtSysLocaleOptions_Impl::GetPropertyNames() +{ + static const OUString pProperties[] = + { + PROPERTYNAME_LOCALE, + PROPERTYNAME_CURRENCY, + PROPERTYNAME_DECIMALSEPARATOR + }; + static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + return seqPropertyNames; +} + + +// ----------------------------------------------------------------------- + +SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl() + : ConfigItem( ROOTNODE_SYSLOCALE ) + , m_nBlockedHint( 0 ) + , m_nBroadcastBlocked( 0 ) + , m_bDecimalSeparator( sal_True ) + , m_bROLocale(CFG_READONLY_DEFAULT) + , m_bROCurrency(CFG_READONLY_DEFAULT) + , m_bRODecimalSeparator(sal_False) + +{ + if ( !IsValidConfigMgr() ) + ChangeLocaleSettings(); // assume SYSTEM defaults during Setup + else + { + const Sequence< OUString > aNames = GetPropertyNames(); + Sequence< Any > aValues = GetProperties( aNames ); + Sequence< sal_Bool > aROStates = GetReadOnlyStates( aNames ); + const Any* pValues = aValues.getConstArray(); + const sal_Bool* pROStates = aROStates.getConstArray(); + DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" ); + DBG_ASSERT( aROStates.getLength() == aNames.getLength(), "GetReadOnlyStates failed" ); + if ( aValues.getLength() == aNames.getLength() && aROStates.getLength() == aNames.getLength() ) + { + for ( sal_Int32 nProp = 0; nProp < aNames.getLength(); nProp++ ) + { + DBG_ASSERT( pValues[nProp].hasValue(), "property value missing" ); + if ( pValues[nProp].hasValue() ) + { + switch ( nProp ) + { + case PROPERTYHANDLE_LOCALE : + { + OUString aStr; + if ( pValues[nProp] >>= aStr ) + m_aLocaleString = aStr; + else + { + DBG_ERRORFILE( "Wrong property type!" ); + } + m_bROLocale = pROStates[nProp]; + } + break; + case PROPERTYHANDLE_CURRENCY : + { + OUString aStr; + if ( pValues[nProp] >>= aStr ) + m_aCurrencyString = aStr; + else + { + DBG_ERRORFILE( "Wrong property type!" ); + } + m_bROCurrency = pROStates[nProp]; + } + break; + case PROPERTYHANDLE_DECIMALSEPARATOR: + { + sal_Bool bValue = sal_Bool(); + if ( pValues[nProp] >>= bValue ) + m_bDecimalSeparator = bValue; + else + { + DBG_ERRORFILE( "Wrong property type!" ); + } + m_bRODecimalSeparator = pROStates[nProp]; + } + break; + default: + DBG_ERRORFILE( "Wrong property type!" ); + } + } + } + } + UpdateMiscSettings_Impl(); + ChangeLocaleSettings(); + EnableNotification( aNames ); + } +} + + +SvtSysLocaleOptions_Impl::~SvtSysLocaleOptions_Impl() +{ + if ( IsModified() ) + Commit(); +} + + +void SvtSysLocaleOptions_Impl::BlockBroadcasts( BOOL bBlock ) +{ + if ( bBlock ) + ++m_nBroadcastBlocked; + else if ( m_nBroadcastBlocked ) + { + if ( --m_nBroadcastBlocked == 0 ) + Broadcast( 0 ); + } +} + +sal_Bool SvtSysLocaleOptions_Impl::IsReadOnly( SvtSysLocaleOptions::EOption eOption ) const +{ + sal_Bool bReadOnly = CFG_READONLY_DEFAULT; + switch(eOption) + { + case SvtSysLocaleOptions::E_LOCALE : + { + bReadOnly = m_bROLocale; + break; + } + case SvtSysLocaleOptions::E_CURRENCY : + { + bReadOnly = m_bROCurrency; + break; + } + } + return bReadOnly; +} + + +void SvtSysLocaleOptions_Impl::Broadcast( ULONG nHint ) +{ + if ( m_nBroadcastBlocked ) + m_nBlockedHint |= nHint; + else + { + nHint |= m_nBlockedHint; + m_nBlockedHint = 0; + if ( nHint ) + { + if ( nHint & SYSLOCALEOPTIONS_HINT_CURRENCY ) + ChangeDefaultCurrency(); + SfxSimpleHint aHint( nHint ); + GetBroadcaster().Broadcast( aHint ); + } + } +} + + +void SvtSysLocaleOptions_Impl::Commit() +{ + const Sequence< OUString > aOrgNames = GetPropertyNames(); + sal_Int32 nOrgCount = aOrgNames.getLength(); + + Sequence< OUString > aNames( nOrgCount ); + Sequence< Any > aValues( nOrgCount ); + + OUString* pNames = aNames.getArray(); + Any* pValues = aValues.getArray(); + sal_Int32 nRealCount = 0; + + for ( sal_Int32 nProp = 0; nProp < nOrgCount; nProp++ ) + { + switch ( nProp ) + { + case PROPERTYHANDLE_LOCALE : + { + if (!m_bROLocale) + { + pNames[nRealCount] = aOrgNames[nProp]; + pValues[nRealCount] <<= m_aLocaleString; + ++nRealCount; + } + } + break; + case PROPERTYHANDLE_CURRENCY : + { + if (!m_bROLocale) + { + pNames[nRealCount] = aOrgNames[nProp]; + pValues[nRealCount] <<= m_aCurrencyString; + ++nRealCount; + } + } + break; + case PROPERTYHANDLE_DECIMALSEPARATOR: + if( !m_bRODecimalSeparator ) + { + pNames[nRealCount] = aOrgNames[nProp]; + pValues[nRealCount] <<= m_bDecimalSeparator; + ++nRealCount; + } + break; + default: + DBG_ERRORFILE( "invalid index to save a path" ); + } + } + aNames.realloc(nRealCount); + aValues.realloc(nRealCount); + PutProperties( aNames, aValues ); + ClearModified(); +} + + +void SvtSysLocaleOptions_Impl::SetLocaleString( const OUString& rStr ) +{ + if (!m_bROLocale && rStr != m_aLocaleString ) + { + m_aLocaleString = rStr; + SetModified(); + ULONG nHint = SYSLOCALEOPTIONS_HINT_LOCALE; + nHint |= ChangeLocaleSettings(); + Broadcast( nHint ); + } +} + + +ULONG SvtSysLocaleOptions_Impl::ChangeLocaleSettings() +{ + // An empty config value denotes SYSTEM locale + if ( m_aLocaleString.getLength() ) + m_eLocaleLanguageType = MsLangId::convertIsoStringToLanguage( m_aLocaleString ); + else + m_eLocaleLanguageType = LANGUAGE_SYSTEM; + ULONG nHint = 0; + // new locale and no fixed currency => locale default currency might change + if ( !m_aCurrencyString.getLength() ) + nHint |= SYSLOCALEOPTIONS_HINT_CURRENCY; + return nHint; +} + + +void SvtSysLocaleOptions_Impl::SetCurrencyString( const OUString& rStr ) +{ + if (!m_bROCurrency && rStr != m_aCurrencyString ) + { + m_aCurrencyString = rStr; + SetModified(); + Broadcast( SYSLOCALEOPTIONS_HINT_CURRENCY ); + } +} + +void SvtSysLocaleOptions_Impl::SetDecimalSeparatorAsLocale( sal_Bool bSet) +{ + if(bSet != m_bDecimalSeparator) + { + m_bDecimalSeparator = bSet; + SetModified(); + UpdateMiscSettings_Impl(); + } +} + + +void SvtSysLocaleOptions_Impl::ChangeDefaultCurrency() const +{ + const Link& rLink = SvtSysLocaleOptions::GetCurrencyChangeLink(); + if ( rLink.IsSet() ) + rLink.Call( NULL ); +} + + +void SvtSysLocaleOptions_Impl::Notify( const Sequence< rtl::OUString >& seqPropertyNames ) +{ + ULONG nHint = 0; + Sequence< Any > seqValues = GetProperties( seqPropertyNames ); + Sequence< sal_Bool > seqROStates = GetReadOnlyStates( seqPropertyNames ); + sal_Int32 nCount = seqPropertyNames.getLength(); + for( sal_Int32 nProp = 0; nProp < nCount; ++nProp ) + { + if( seqPropertyNames[nProp] == PROPERTYNAME_LOCALE ) + { + DBG_ASSERT( seqValues[nProp].getValueTypeClass() == TypeClass_STRING, "Locale property type" ); + seqValues[nProp] >>= m_aLocaleString; + m_bROLocale = seqROStates[nProp]; + nHint |= SYSLOCALEOPTIONS_HINT_LOCALE; + nHint |= ChangeLocaleSettings(); + } + else if( seqPropertyNames[nProp] == PROPERTYNAME_CURRENCY ) + { + DBG_ASSERT( seqValues[nProp].getValueTypeClass() == TypeClass_STRING, "Currency property type" ); + seqValues[nProp] >>= m_aCurrencyString; + m_bROCurrency = seqROStates[nProp]; + nHint |= SYSLOCALEOPTIONS_HINT_CURRENCY; + } + else if( seqPropertyNames[nProp] == PROPERTYNAME_DECIMALSEPARATOR ) + { + seqValues[nProp] >>= m_bDecimalSeparator; + m_bRODecimalSeparator = seqROStates[nProp]; + UpdateMiscSettings_Impl(); + } + } + if ( nHint ) + Broadcast( nHint ); +} +/* -----------------10.02.2004 15:25----------------- + + --------------------------------------------------*/ +void SvtSysLocaleOptions_Impl::UpdateMiscSettings_Impl() +{ + AllSettings aAllSettings( Application::GetSettings() ); + MiscSettings aMiscSettings = aAllSettings.GetMiscSettings(); + aMiscSettings.SetEnableLocalizedDecimalSep(m_bDecimalSeparator); + aAllSettings.SetMiscSettings( aMiscSettings ); + Application::SetSettings( aAllSettings ); +} + +// ==================================================================== + +SvtSysLocaleOptions::SvtSysLocaleOptions() +{ + MutexGuard aGuard( GetMutex() ); + if ( !pOptions ) + { + RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtSysLocaleOptions_Impl::ctor()"); + pOptions = new SvtSysLocaleOptions_Impl; + + ItemHolder2::holdConfigItem(E_SYSLOCALEOPTIONS); + } + ++nRefCount; +} + + +SvtSysLocaleOptions::~SvtSysLocaleOptions() +{ + MutexGuard aGuard( GetMutex() ); + if ( !--nRefCount ) + { + delete pOptions; + pOptions = NULL; + } +} + + +// static +Mutex& SvtSysLocaleOptions::GetMutex() +{ + static Mutex* pMutex = NULL; + if( !pMutex ) + { + MutexGuard aGuard( Mutex::getGlobalMutex() ); + if( !pMutex ) + { + // #i77768# Due to a static reference in the toolkit lib + // we need a mutex that lives longer than the svtools library. + // Otherwise the dtor would use a destructed mutex!! + pMutex = new Mutex; + } + } + return *pMutex; +} + + +sal_Bool SvtSysLocaleOptions::IsModified() +{ + MutexGuard aGuard( GetMutex() ); + return pOptions->IsModified(); +} + + +void SvtSysLocaleOptions::Commit() +{ + MutexGuard aGuard( GetMutex() ); + pOptions->Commit(); +} + + +BOOL SvtSysLocaleOptions::AddListener( SvtListener& rLst ) +{ + MutexGuard aGuard( GetMutex() ); + return rLst.StartListening( pOptions->GetBroadcaster() ); +} + + +BOOL SvtSysLocaleOptions::RemoveListener( SvtListener& rLst ) +{ + MutexGuard aGuard( GetMutex() ); + return rLst.EndListening( pOptions->GetBroadcaster() ); +} + + +void SvtSysLocaleOptions::BlockBroadcasts( BOOL bBlock ) +{ + MutexGuard aGuard( GetMutex() ); + pOptions->BlockBroadcasts( bBlock ); +} + + +const OUString& SvtSysLocaleOptions::GetLocaleConfigString() const +{ + MutexGuard aGuard( GetMutex() ); + return pOptions->GetLocaleString(); +} + + +void SvtSysLocaleOptions::SetLocaleConfigString( const OUString& rStr ) +{ + MutexGuard aGuard( GetMutex() ); + pOptions->SetLocaleString( rStr ); +} + + +const OUString& SvtSysLocaleOptions::GetCurrencyConfigString() const +{ + MutexGuard aGuard( GetMutex() ); + return pOptions->GetCurrencyString(); +} + + +void SvtSysLocaleOptions::SetCurrencyConfigString( const OUString& rStr ) +{ + MutexGuard aGuard( GetMutex() ); + pOptions->SetCurrencyString( rStr ); +} + + +LanguageType SvtSysLocaleOptions::GetLocaleLanguageType() const +{ + MutexGuard aGuard( GetMutex() ); + return pOptions->GetLocaleLanguageType(); +} + +/*-- 11.02.2004 13:31:41--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Bool SvtSysLocaleOptions::IsDecimalSeparatorAsLocale() const +{ + MutexGuard aGuard( GetMutex() ); + return pOptions->IsDecimalSeparatorAsLocale(); +} +/*-- 11.02.2004 13:31:41--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvtSysLocaleOptions::SetDecimalSeparatorAsLocale( sal_Bool bSet) +{ + MutexGuard aGuard( GetMutex() ); + pOptions->SetDecimalSeparatorAsLocale(bSet); +} + + +sal_Bool SvtSysLocaleOptions::IsReadOnly( EOption eOption ) const +{ + MutexGuard aGuard( GetMutex() ); + return pOptions->IsReadOnly( eOption ); +} + +// static +void SvtSysLocaleOptions::GetCurrencyAbbrevAndLanguage( String& rAbbrev, + LanguageType& eLang, const ::rtl::OUString& rConfigString ) +{ + sal_Int32 nDelim = rConfigString.indexOf( '-' ); + if ( nDelim >= 0 ) + { + rAbbrev = rConfigString.copy( 0, nDelim ); + String aIsoStr( rConfigString.copy( nDelim+1 ) ); + eLang = MsLangId::convertIsoStringToLanguage( aIsoStr ); + } + else + { + rAbbrev = rConfigString; + eLang = (rAbbrev.Len() ? LANGUAGE_NONE : LANGUAGE_SYSTEM); + } +} + + +// static +::rtl::OUString SvtSysLocaleOptions::CreateCurrencyConfigString( + const String& rAbbrev, LanguageType eLang ) +{ + String aIsoStr( MsLangId::convertLanguageToIsoString( eLang ) ); + if ( aIsoStr.Len() ) + { + ::rtl::OUStringBuffer aStr( rAbbrev.Len() + 1 + aIsoStr.Len() ); + aStr.append( rAbbrev.GetBuffer(), rAbbrev.Len() ); + aStr.append( sal_Unicode('-') ); + aStr.append( aIsoStr.GetBuffer(), aIsoStr.Len() ); + return aStr.makeStringAndClear(); + } + else + return rAbbrev; +} + + +// static +void SvtSysLocaleOptions::SetCurrencyChangeLink( const Link& rLink ) +{ + MutexGuard aGuard( GetMutex() ); + DBG_ASSERT( !CurrencyChangeLink::get().IsSet(), "SvtSysLocaleOptions::SetCurrencyChangeLink: already set" ); + CurrencyChangeLink::get() = rLink; +} + + +// static +const Link& SvtSysLocaleOptions::GetCurrencyChangeLink() +{ + MutexGuard aGuard( GetMutex() ); + return CurrencyChangeLink::get(); +} + diff --git a/svl/source/filepicker/makefile.mk b/svl/source/filepicker/makefile.mk new file mode 100644 index 000000000000..d00ac5170e1a --- /dev/null +++ b/svl/source/filepicker/makefile.mk @@ -0,0 +1,51 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.12 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* +PRJ=..$/.. + +PRJNAME=svtools +TARGET=filepicker +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/svl.pmk + +# --- Files -------------------------------------------------------------- + +SLOFILES =\ + $(SLO)$/pickerhelper.obj \ + $(SLO)$/pickerhistory.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/svl/source/filepicker/pickerhelper.cxx b/svl/source/filepicker/pickerhelper.cxx new file mode 100644 index 000000000000..0d8b2db9d8a0 --- /dev/null +++ b/svl/source/filepicker/pickerhelper.cxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: pickerhelper.cxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include "pickerhelper.hxx" +#include "rtl/ustring.hxx" +#include "com/sun/star/ui/dialogs/XFilePicker.hpp" +#include "com/sun/star/ui/dialogs/XFolderPicker.hpp" +#include "com/sun/star/beans/XPropertySet.hpp" +#include "com/sun/star/beans/XPropertySetInfo.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "tools/debug.hxx" + +namespace css = com::sun::star; + +using css::uno::Reference; +using rtl::OUString; + +namespace svt +{ + void SetDialogHelpId( + Reference < css::ui::dialogs::XFilePicker > _mxFileDlg, sal_Int32 _nHelpId ) + { + try + { + // does the dialog haver a help URL property? + Reference< css::beans::XPropertySet > xDialogProps( _mxFileDlg, css::uno::UNO_QUERY ); + Reference< css::beans::XPropertySetInfo > xInfo; + if( xDialogProps.is() ) + xInfo = xDialogProps->getPropertySetInfo( ); + + const OUString sHelpURLPropertyName( RTL_CONSTASCII_USTRINGPARAM( "HelpURL" ) ); + + if( xInfo.is() && xInfo->hasPropertyByName( sHelpURLPropertyName ) ) + { // yep + OUString sId( RTL_CONSTASCII_USTRINGPARAM( "HID:" ) ); + sId += OUString::valueOf( _nHelpId ); + xDialogProps->setPropertyValue( sHelpURLPropertyName, css::uno::makeAny( sId ) ); + } + } + catch( const css::uno::Exception& ) + { + DBG_ERROR( "svt::SetDialogHelpId(): caught an exception while setting the help id!" ); + } + } + + void SetDialogHelpId( + Reference< css::ui::dialogs::XFolderPicker > _mxFileDlg, sal_Int32 _nHelpId ) + { + try + { + // does the dialog haver a help URL property? + Reference< css::beans::XPropertySet > xDialogProps( _mxFileDlg, css::uno::UNO_QUERY ); + Reference< css::beans::XPropertySetInfo > xInfo; + if( xDialogProps.is() ) + xInfo = xDialogProps->getPropertySetInfo( ); + + const OUString sHelpURLPropertyName( RTL_CONSTASCII_USTRINGPARAM( "HelpURL" ) ); + + if( xInfo.is() && xInfo->hasPropertyByName( sHelpURLPropertyName ) ) + { // yep + OUString sId( RTL_CONSTASCII_USTRINGPARAM( "HID:" ) ); + sId += OUString::valueOf( _nHelpId ); + xDialogProps->setPropertyValue( sHelpURLPropertyName, css::uno::makeAny( sId ) ); + } + } + catch( const css::uno::Exception& ) + { + DBG_ERROR( "svt::SetDialogHelpId(): caught an exception while setting the help id!" ); + } + } +} + diff --git a/svl/source/filepicker/pickerhistory.cxx b/svl/source/filepicker/pickerhistory.cxx new file mode 100644 index 000000000000..5bd584618f09 --- /dev/null +++ b/svl/source/filepicker/pickerhistory.cxx @@ -0,0 +1,141 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: pickerhistory.cxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include "pickerhistory.hxx" +#include "pickerhistoryaccess.hxx" +#include +#include + +//......................................................................... +namespace svt +{ +//......................................................................... + using namespace ::com::sun::star::uno; + + namespace + { + typedef ::com::sun::star::uno::WeakReference< XInterface > InterfaceAdapter; + typedef ::std::vector< InterfaceAdapter > InterfaceArray; + + // ---------------------------------------------------------------- + InterfaceArray& getFolderPickerHistory() + { + static InterfaceArray s_aHistory; + return s_aHistory; + } + + // ---------------------------------------------------------------- + InterfaceArray& getFilePickerHistory() + { + static InterfaceArray s_aHistory; + return s_aHistory; + } + + // ---------------------------------------------------------------- + void implPushBackPicker( InterfaceArray& _rHistory, const Reference< XInterface >& _rxPicker ) + { + if ( !_rxPicker.is() ) + return; + + //============================================================= + // first, check which of the objects we hold in s_aHistory can be removed + { + InterfaceArray aCleanedHistory; + for ( InterfaceArray::const_iterator aLoop = _rHistory.begin(); + aLoop != _rHistory.end(); + ++aLoop + ) + { + Reference< XInterface > xCurrent( aLoop->get() ); + if ( xCurrent.is() ) + { + if ( aCleanedHistory.empty() ) + // make some room, assume that all interfaces (from here on) are valie + aCleanedHistory.reserve( _rHistory.size() - ( aLoop - _rHistory.begin() ) ); + aCleanedHistory.push_back( InterfaceAdapter( xCurrent ) ); + } + } + _rHistory.swap( aCleanedHistory ); + } + + //============================================================= + // then push_back the picker + _rHistory.push_back( InterfaceAdapter( _rxPicker ) ); + } + + //----------------------------------------------------------------- + Reference< XInterface > implGetTopMostPicker( const InterfaceArray& _rHistory ) + { + Reference< XInterface > xTopMostAlive; + + //============================================================= + // search the first picker which is still alive ... + for ( InterfaceArray::const_reverse_iterator aLoop = _rHistory.rbegin(); + ( aLoop != _rHistory.rend() ) && !xTopMostAlive.is(); + ++aLoop + ) + { + xTopMostAlive = aLoop->get(); + } + + return xTopMostAlive; + } + } + + //--------------------------------------------------------------------- + Reference< XInterface > GetTopMostFolderPicker( ) + { + return implGetTopMostPicker( getFolderPickerHistory() ); + } + + //--------------------------------------------------------------------- + Reference< XInterface > GetTopMostFilePicker( ) + { + return implGetTopMostPicker( getFilePickerHistory() ); + } + + //--------------------------------------------------------------------- + void addFolderPicker( const Reference< XInterface >& _rxPicker ) + { + implPushBackPicker( getFolderPickerHistory(), _rxPicker ); + } + + //--------------------------------------------------------------------- + void addFilePicker( const Reference< XInterface >& _rxPicker ) + { + implPushBackPicker( getFilePickerHistory(), _rxPicker ); + } + +//......................................................................... +} // namespace svt +//......................................................................... + diff --git a/svl/source/filerec/filerec.cxx b/svl/source/filerec/filerec.cxx new file mode 100644 index 000000000000..262e5135572a --- /dev/null +++ b/svl/source/filerec/filerec.cxx @@ -0,0 +1,1019 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: filerec.cxx,v $ + * $Revision: 1.13 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include +#include + +//======================================================================== + +SV_IMPL_VARARR( SfxUINT32s, UINT32 ); + +//======================================================================== + +/* Die folgenden Makros extrahieren Teilbereiche aus einem UINT32 Wert. + Diese UINT32-Werte werden anstelle der einzelnen Werte gestreamt, + um Calls zu sparen. +*/ + +#define SFX_REC_PRE(n) ( ((n) & 0x000000FF) ) +#define SFX_REC_OFS(n) ( ((n) & 0xFFFFFF00) >> 8 ) +#define SFX_REC_TYP(n) ( ((n) & 0x000000FF) ) +#define SFX_REC_VER(n) ( ((n) & 0x0000FF00) >> 8 ) +#define SFX_REC_TAG(n) ( ((n) & 0xFFFF0000) >> 16 ) + +#define SFX_REC_CONTENT_VER(n) ( ((n) & 0x000000FF) ) +#define SFX_REC_CONTENT_OFS(n) ( ((n) & 0xFFFFFF00) >> 8 ) + +//------------------------------------------------------------------------- + +/* Die folgenden Makros setzen Teilbereiche zu einem UINT32 Wert zusammen. + Diese UINT32-Werte werden anstelle der einzelnen Werte gestreamt, + um Calls zu sparen. +*/ + +#define SFX_REC_MINI_HEADER(nPreTag,nStartPos,nEndPos) \ + ( UINT32(nPreTag) | \ + UINT32(nEndPos-nStartPos-SFX_REC_HEADERSIZE_MINI) << 8 ) + +#define SFX_REC_HEADER(nRecType,nContentTag,nContentVer) \ + ( UINT32(nRecType) | \ + ( UINT32(nContentVer) << 8 ) | \ + ( UINT32(nContentTag) << 16 ) ) + +#define SFX_REC_CONTENT_HEADER(nContentVer,n1StStartPos,nCurStartPos) \ + ( UINT32(nContentVer) | \ + UINT32( nCurStartPos - n1StStartPos ) << 8 ) + +//========================================================================= + +UINT32 SfxMiniRecordWriter::Close +( + FASTBOOL bSeekToEndOfRec /* TRUE (default) + Der Stream wird an das Ende des Records + positioniert. + + FALSE + Der Stream wird an den Anfang des + Contents (also hinter den Header) + positioniert. + */ +) + +/* [Beschreibung] + + Diese Methode schlie\st den Record. Dabei wird haupts"achlich der + Header geschrieben. + + Wurde der Header bereits geschrieben, hat der Aufruf keine Wirkung. + + + [R"uckgabewert] + + UINT32 != 0 + Position im Stream, die direkt hinter dem Record liegt. + 'bSeekToEndOfRecord==TRUE' + => R"uckgabewert == aktuelle Stream-Position nach Aufruf + + == 0 + Der Header war bereits geschrieben worden. +*/ + +{ + // wurde der Header noch nicht geschrieben? + if ( !_bHeaderOk ) + { + // Header an den Anfang des Records schreiben + UINT32 nEndPos = _pStream->Tell(); + _pStream->Seek( _nStartPos ); + *_pStream << SFX_REC_MINI_HEADER( _nPreTag, _nStartPos, nEndPos ); + + // je nachdem ans Ende des Records seeken oder hinter Header bleiben + if ( bSeekToEndOfRec ) + _pStream->Seek( nEndPos ); + + // Header wurde JETZT geschrieben + _bHeaderOk = TRUE; + return nEndPos; + } +#ifdef DBG_UTIL + // mu\s Fix-Size-Record gepr"uft werden? + else if ( SFX_BOOL_DONTCARE == _bHeaderOk ) + { + // Header auslesen, um Soll-Gr"o\se zu bestimmen + UINT32 nEndPos = _pStream->Tell(); + _pStream->Seek( _nStartPos ); + UINT32 nHeader; + *_pStream >> nHeader; + _pStream->Seek( nEndPos ); + + // Soll-Gr"o\se mit Ist-Gr"o\se vergleichen + DBG_ASSERT( nEndPos - SFX_REC_OFS(nHeader) == _nStartPos + sizeof(UINT32), + "fixed record size incorrect" ); + DbgOutf( "SfxFileRec: written record until %ul", nEndPos ); + } +#endif + + // Record war bereits geschlossen + return 0; +} + +//========================================================================= + +USHORT SfxMiniRecordReader::ScanRecordType +( + SvStream* pStream /* an dessen aktueller Position + ein Record liegt, dessen Typ erkannt werden + soll. + */ +) + +/* [Beschreibung] + + Mit dieser statischen Methode kann ermittelt werden, ob sich an der + aktuellen Position in einem Stream ein Record befindet, und der Typ + des Records kann ermittelt werden. + + Die Position im Stream ist nach dem Aufruf aufver"andert. + + + [Anmerkung] + + Die Record-Typen k"onnen zwar (abgesehen vom Drawing-Enginge-Record) + untereinander eindeutig erkannt werden, es besteht jedoch die Gefahr + der Verwechslung von Records mit normalen Daten. File-Formate sollten + darauf R"ucksicht nehmen. Handelt es sich um keinen Record, wird + am wahrscheinlichsten SFX_REC_TYPE_MINI zur"uckgeliefert, da dieser + Typ sich aufgrund seines sparsam kurzen Headers durch die k"urzeste + Kennung auszeichnet. + + + [R"uckgabewert] + + USHORT SFX_REC_TYPE_EOR + An der aktuellen Position des Streams + steht eine End-Of-Records-Kennung. + + SFX_REC_TYPE_MINI + Es handelt sich um einen SW3 kompatiblen + Mini-Record, dessen einzige Kennung sein + 'Mini-Tag' ist. + + SFX_REC_TYPE_SINGLE + Es handelt sich um einen Extended-Record + mit einem einzigen Content, der durch eine + Version und ein Tag n"aher gekennzeichnet + ist. + + SFX_REC_TYPE_FIXSIZE + Es handelt sich um einen Extended-Record + mit mehreren Contents gleicher Gr"o\se, + die gemeinsam durch eine einzige Version + und ein einziges gemeinsames Tag n"aher + gekennzeichnet sind. + + SFX_REC_TYPE_VARSIZE + Es handelt sich um einen Extended-Record + mit mehreren Contents variabler Gr"o\se, + die gemeinsam durch eine einzige Version + und ein einziges gemeinsames Tag n"aher + gekennzeichnet sind. + + SFX_REC_TYPE_MIXTAGS + Es handelt sich um einen Extended-Record + mit mehreren Contents variabler Gr"o\se, + die jeweils durch ein eignes Tag und + eine eigene Versions-Nummer n"aher + gekennzeichnet sind. + + SFX_REC_TYPE_DRAWENG + Es handelt sich wahrscheinlich um einen + Drawing-Engine-Record. Dieser Record-Typ + kann von den Klassen dieser Gruppe nicht + interpretiert werden. +*/ + +{ + // die ersten 4 Bytes als Mini-Header lesen + sal_uInt32 nHeader; + *pStream >> nHeader; + + // k"onnte es sich um einen extended-Record handeln? + USHORT nPreTag = sal::static_int_cast< USHORT >(SFX_REC_PRE(nHeader)); + if ( SFX_REC_PRETAG_EXT == nPreTag ) + { + // die n"achsten 4 Bytes als extended-Header lesen + *pStream >> nHeader; + + // Stream-Position restaurieren + pStream->SeekRel(-8); + + // liegt eine g"ultige Record-Kennung vor? + USHORT nType = sal::static_int_cast< USHORT >(SFX_REC_TYP(nHeader)); + if ( nType >= SFX_REC_TYPE_FIRST && nType <= SFX_REC_TYPE_LAST ) + // entsprechenden extended-Record-Typ zur"uckliefern + return nType; + + // sonst ist der Record-Typ unbekannt + return SFX_REC_TYPE_NONE; + } + + // Stream-Position restaurieren + pStream->SeekRel(-4); + + // liegt eine End-Of-Record-Kennung vor? + if ( SFX_REC_PRETAG_EOR == nPreTag ) + return nPreTag; + + // liegt ein Drawin-Engine-Record vor? + if ( nHeader == UINT32(*"DRMD") || nHeader == UINT32(*"DRVW") ) + return SFX_REC_TYPE_DRAWENG; + + // alle anderen sind grunds"atzlich g"ultige Mini-Records + return SFX_REC_TYPE_MINI; +} + +//------------------------------------------------------------------------- + +FASTBOOL SfxMiniRecordReader::SetHeader_Impl( UINT32 nHeader ) + +/* [Beschreibung] + + Interne Methode zum nachtr"aglichen Verarbeiten eines extern gelesenen + Headers. Falls der Header eine End-Of-Records-Kennung darstellt, + wird am Stream ein Errorcode gesetzt und FALSE zur"uckgeliefert. Im + Fehlerfall wird der Stream jedoch nicht auf den Record-Anfang zur"uck- + gesetzt. +*/ + +{ + FASTBOOL bRet = TRUE; + + // Record-Ende und Pre-Tag aus dem Header ermitteln + _nEofRec = _pStream->Tell() + SFX_REC_OFS(nHeader); + _nPreTag = sal::static_int_cast< BYTE >(SFX_REC_PRE(nHeader)); + + // wenn End-Of-Record-Kennung, dann Fehler + if ( _nPreTag == SFX_REC_PRETAG_EOR ) + { + _pStream->SetError( ERRCODE_IO_WRONGFORMAT ); + bRet = FALSE; + } + return bRet; +} + +//------------------------------------------------------------------------- + +SfxMiniRecordReader::SfxMiniRecordReader +( + SvStream* pStream /* , an dessen aktueller + Position sich ein + befindet. + */ +) + +/* [Beschreibung] + + Dieser Ctor liest den Header eines ab der aktuellen + Position von 'pStream'. Da grunds"atzlich fast 4-Byte Kombination ein + g"ultiger SfxMiniRecord-Header ist, bleiben die einzig m"oglichen + Fehler der EOF-Status des Streams, und ein SFX_REC_PRETAG_EOR + als Pre-Tag. Ein entsprechender Error-Code (ERRCODE_IO_EOF bzw. + ERRCODE_IO_WRONGFORMAT) ist dann am Stream gesetzt, dessen Position + dann au\serdem unver"andert ist. +*/ + +: _pStream( pStream ), + _bSkipped( FALSE ) +{ + // Header einlesen + UINT32 nStartPos = pStream->Tell(); // um im Fehlerfall zur"uck zu-seeken + DBG( DbgOutf( "SfxFileRec: reading record at %ul", nStartPos ) ); + UINT32 nHeader; + *pStream >> nHeader; + + // Headerdaten extrahieren + SetHeader_Impl( nHeader ); + + // Fehlerbehandlung + if ( pStream->IsEof() ) + _nPreTag = SFX_REC_PRETAG_EOR; + else if ( _nPreTag == SFX_REC_PRETAG_EOR ) + pStream->SetError( ERRCODE_IO_WRONGFORMAT ); + if ( !IsValid() ) + pStream->Seek( nStartPos ); +} + +//------------------------------------------------------------------------- + +SfxMiniRecordReader::SfxMiniRecordReader +( + SvStream* pStream, /* , an dessen aktueller + Position sich ein + befindet. + */ + BYTE nTag // Pre-Tag des gew"unschten Records +) + +/* [Beschreibung] + + Dieser Ctor interpretiert 'pStream' ab der aktuellen Position als + eine l"uckenlose Folge von, von dieser Klassen-Gruppe interpretierbaren, + Records. Der in dieser Folge erste als interpretierbare + (also ggf. auch ein extended-Record) mit dem PreTag 'nTag' wird ge"offnet + und durch diese Instanz repr"asentiert. + + Wird das Ende des Streams oder die Kennung SFX_REC_PRETAG_EOR + erreicht, bevor ein Record mit dem ge"unschten Pre-Tag gefunden wird, + ist die erzeugte Instanz ung"ultig ('IsValid() == FALSE'). Ein ent- + sprechender Error-Code (ERRCODE_IO_EOF bzw. ERRCODE_IO_WRONGFORMAT) + ist dann am Stream gesetzt, dessen Position ist dann au\serdem unver- + "andert. + + Bei 'nTag==SFX_FILEREC_PRETAG_EOR' wird nicht versucht, einen Record + zu lesen, es wird sofort 'IsValid()' auf FALSE gesetzt und kein Error-Code + am Stream gesetzt. Dies ist dauzu gedacht, ohne 'new' und 'delete' + abw"rtskompatibel SfxMiniRecords einbauen zu k"onnen. Siehe dazu + . + + + [Anwendungsvorschlag] + + Wird dieser Ctor in einer bereits ausgelieferten Programmversion + verwendet, k"onnen in das File-Format jeweils davor kompatibel neue + Records mit einer anderen Kennung eingef"ugt werden. Diese werden + schlie\slich automatisch "uberlesen. Erkauft wird diese M"oglichkeit + allerdings mit etwas schlechterem Laufzeitverhalten im Vergleich mit + direktem 'drauf-los-lesen', der sich jedoch auf einen Vergleich zweier + Bytes reduziert, falls der gesuchte Record der erste in der Folge ist. +*/ + +: _pStream( pStream ), + _bSkipped( nTag == SFX_REC_PRETAG_EOR ) +{ + // ggf. ignorieren (s.o.) + if ( _bSkipped ) + { + _nPreTag = nTag; + return; + } + + // StartPos merken, um im Fehlerfall zur"uck-seeken zu k"onnen + UINT32 nStartPos = pStream->Tell(); + + // passenden Record suchen + while(TRUE) + { + // Header lesen + DBG( DbgOutf( "SfxFileRec: searching record at %ul", pStream->Tell() ) ); + UINT32 nHeader; + *pStream >> nHeader; + + // Headerdaten von Basisklasse extrahieren lassen + SetHeader_Impl( nHeader ); + + // ggf. Fehler behandeln + if ( pStream->IsEof() ) + _nPreTag = SFX_REC_PRETAG_EOR; + else if ( _nPreTag == SFX_REC_PRETAG_EOR ) + pStream->SetError( ERRCODE_IO_WRONGFORMAT ); + else + { + // wenn gefunden, dann Schleife abbrechen + if ( _nPreTag == nTag ) + break; + + // sonst skippen und weitersuchen + pStream->Seek( _nEofRec ); + continue; + } + + // Fehler => zur"uck-seeken + pStream->Seek( nStartPos ); + break; + } +} + +//========================================================================= + +SfxSingleRecordWriter::SfxSingleRecordWriter +( + BYTE nRecordType, // f"ur Subklassen + SvStream* pStream, // Stream, in dem der Record angelegt wird + UINT16 nContentTag, // Inhalts-Art-Kennung + BYTE nContentVer // Inhalts-Versions-Kennung +) + +/* [Beschreibung] + + Interner Ctor f"ur Subklassen. +*/ + +: SfxMiniRecordWriter( pStream, SFX_REC_PRETAG_EXT ) +{ + // Erweiterten Header hiner den des SfxMiniRec schreiben + *pStream << SFX_REC_HEADER(nRecordType, nContentTag, nContentVer); +} + +//------------------------------------------------------------------------- + +SfxSingleRecordWriter::SfxSingleRecordWriter +( + SvStream* pStream, // Stream, in dem der Record angelegt wird + UINT16 nContentTag, // Inhalts-Art-Kennung + BYTE nContentVer // Inhalts-Versions-Kennung +) + +/* [Beschreibung] + + Legt in 'pStream' einen 'SfxSingleRecord' an, dessen Content-Gr"o\se + nicht bekannt ist, sondern nach dam Streamen des Contents errechnet + werden soll. +*/ + +: SfxMiniRecordWriter( pStream, SFX_REC_PRETAG_EXT ) +{ + // Erweiterten Header hiner den des SfxMiniRec schreiben + *pStream << SFX_REC_HEADER( SFX_REC_TYPE_SINGLE, nContentTag, nContentVer); +} + +//------------------------------------------------------------------------- + +SfxSingleRecordWriter::SfxSingleRecordWriter +( + SvStream* pStream, // Stream, in dem der Record angelegt wird + UINT16 nContentTag, // Inhalts-Art-Kennung + BYTE nContentVer, // Inhalts-Versions-Kennung + UINT32 nContentSize // Gr"o\se des Inhalts in Bytes +) + +/* [Beschreibung] + + Legt in 'pStream' einen 'SfxSingleRecord' an, dessen Content-Gr"o\se + von vornherein bekannt ist. +*/ + +: SfxMiniRecordWriter( pStream, SFX_REC_PRETAG_EXT, + nContentSize + SFX_REC_HEADERSIZE_SINGLE ) +{ + // Erweiterten Header hinter den des SfxMiniRec schreiben + *pStream << SFX_REC_HEADER( SFX_REC_TYPE_SINGLE, nContentTag, nContentVer); +} + +//========================================================================= + +inline FASTBOOL SfxSingleRecordReader::ReadHeader_Impl( USHORT nTypes ) + +/* [Beschreibung] + + Interne Methode zum Einlesen eines SfxMultiRecord-Headers, nachdem + die Basisklasse bereits initialisiert und deren Header gelesen ist. + Ggf. ist ein Error-Code am Stream gesetzt, im Fehlerfall wird jedoch + nicht zur"uckge-seekt. +*/ + +{ + FASTBOOL bRet; + + // Basisklassen-Header einlesen + UINT32 nHeader=0; + *_pStream >> nHeader; + if ( !SetHeader_Impl( nHeader ) ) + bRet = FALSE; + else + { + // eigenen Header einlesen + *_pStream >> nHeader; + _nRecordVer = sal::static_int_cast< BYTE >(SFX_REC_VER(nHeader)); + _nRecordTag = sal::static_int_cast< UINT16 >(SFX_REC_TAG(nHeader)); + + // falscher Record-Typ? + _nRecordType = sal::static_int_cast< BYTE >(SFX_REC_TYP(nHeader)); + bRet = 0 != ( nTypes & _nRecordType); + } + return bRet; +} + +//------------------------------------------------------------------------- + +SfxSingleRecordReader::SfxSingleRecordReader( SvStream *pStream ) +: SfxMiniRecordReader() +{ + // Startposition merken, um im Fehlerfall zur"uck-seeken zu k"onnen + #ifdef DBG_UTIL + UINT32 nStartPos = pStream->Tell(); + DBG( DbgOutf( "SfxFileRec: reading record at %ul", nStartPos ) ); + #endif + + // Basisklasse initialisieren (nicht via Ctor, da der nur MiniRecs akzept.) + Construct_Impl( pStream ); + + // nur Header mit korrektem Record-Type akzeptieren + if ( !ReadHeader_Impl( SFX_REC_TYPE_SINGLE ) ) + { + // Error-Code setzen und zur"uck-seeken + pStream->SeekRel( - SFX_REC_HEADERSIZE_SINGLE ); + pStream->SetError( ERRCODE_IO_WRONGFORMAT ); + } +} + +//------------------------------------------------------------------------- + +SfxSingleRecordReader::SfxSingleRecordReader( SvStream *pStream, USHORT nTag ) +{ + // StartPos merken, um im Fehlerfall zur"uck-seeken zu k"onnen + UINT32 nStartPos = pStream->Tell(); + + // richtigen Record suchen, ggf. Error-Code setzen und zur"uck-seeken + Construct_Impl( pStream ); + if ( !FindHeader_Impl( SFX_REC_TYPE_SINGLE, nTag ) ) + { + // Error-Code setzen und zur"uck-seeken + pStream->Seek( nStartPos ); + pStream->SetError( ERRCODE_IO_WRONGFORMAT ); + } +} + +//------------------------------------------------------------------------- + +FASTBOOL SfxSingleRecordReader::FindHeader_Impl +( + UINT16 nTypes, // arithm. Veroderung erlaubter Record-Typen + UINT16 nTag // zu findende Record-Art-Kennung +) + +/* [Beschreibung] + + Interne Methode zum lesen des Headers des ersten Record, der einem + der Typen in 'nTypes' entspricht und mit der Art-Kennung 'nTag' + gekennzeichnet ist. + + Kann ein solcher Record nicht gefunden werden, wird am Stream ein + Errorcode gesetzt, zur"uck-geseekt und FALSE zur"uckgeliefert. +*/ + +{ + // StartPos merken, um im Fehlerfall zur"uck-seeken zu k"onnen + UINT32 nStartPos = _pStream->Tell(); + + // richtigen Record suchen + while ( !_pStream->IsEof() ) + { + // Header lesen + UINT32 nHeader; + DBG( DbgOutf( "SfxFileRec: searching record at %ul", _pStream->Tell() ) ); + *_pStream >> nHeader; + if ( !SetHeader_Impl( nHeader ) ) + // EOR => Such-Schleife abbreichen + break; + + // Extended Record gefunden? + if ( _nPreTag == SFX_REC_PRETAG_EXT ) + { + // Extended Header lesen + *_pStream >> nHeader; + _nRecordTag = sal::static_int_cast< UINT16 >(SFX_REC_TAG(nHeader)); + + // richtigen Record gefunden? + if ( _nRecordTag == nTag ) + { + // gefundener Record-Typ passend? + _nRecordType = sal::static_int_cast< BYTE >( + SFX_REC_TYP(nHeader)); + if ( nTypes & _nRecordType ) + // ==> gefunden + return TRUE; + + // error => Such-Schleife abbrechen + break; + } + } + + // sonst skippen + if ( !_pStream->IsEof() ) + _pStream->Seek( _nEofRec ); + } + + // Fehler setzen und zur"uck-seeken + _pStream->SetError( ERRCODE_IO_WRONGFORMAT ); + _pStream->Seek( nStartPos ); + return FALSE; +} + +//========================================================================= + +SfxMultiFixRecordWriter::SfxMultiFixRecordWriter +( + BYTE nRecordType, // Subklassen Record-Kennung + SvStream* pStream, // Stream, in dem der Record angelegt wird + UINT16 nContentTag, // Content-Art-Kennung + BYTE nContentVer, // Content-Versions-Kennung + UINT32 // Gr"o\se jedes einzelnen Contents in Bytes +) + +/* [Beschreibung] + + Interne Methode f"ur Subklassen. +*/ + +: SfxSingleRecordWriter( nRecordType, pStream, nContentTag, nContentVer ), + _nContentCount( 0 ) +{ + // Platz f"ur eigenen Header + pStream->SeekRel( + SFX_REC_HEADERSIZE_MULTI ); +} + +//------------------------------------------------------------------------ + +SfxMultiFixRecordWriter::SfxMultiFixRecordWriter +( + SvStream* pStream, // Stream, in dem der Record angelegt wird + UINT16 nContentTag, // Content-Art-Kennung + BYTE nContentVer, // Content-Versions-Kennung + UINT32 // Gr"o\se jedes einzelnen Contents in Bytes +) + +/* [Beschreibung] + + Legt in 'pStream' einen 'SfxMultiFixRecord' an, dessen Content-Gr"o\se + konstant und von vornherein bekannt ist. +*/ + +: SfxSingleRecordWriter( SFX_REC_TYPE_FIXSIZE, + pStream, nContentTag, nContentVer ), + _nContentCount( 0 ) +{ + // Platz f"ur eigenen Header + pStream->SeekRel( + SFX_REC_HEADERSIZE_MULTI ); +} + +//------------------------------------------------------------------------ + +UINT32 SfxMultiFixRecordWriter::Close( FASTBOOL bSeekToEndOfRec ) + +// siehe + +{ + // Header noch nicht geschrieben? + if ( !_bHeaderOk ) + { + // Position hinter Record merken, um sie restaurieren zu k"onnen + UINT32 nEndPos = SfxSingleRecordWriter::Close( FALSE ); + + // gegen"uber SfxSingleRecord erweiterten Header schreiben + *_pStream << _nContentCount; + *_pStream << _nContentSize; + + // je nachdem ans Ende des Records seeken oder hinter Header bleiben + if ( bSeekToEndOfRec ) + _pStream->Seek(nEndPos); + return nEndPos; + } + + // Record war bereits geschlossen + return 0; +} + +//========================================================================= + +SfxMultiVarRecordWriter::SfxMultiVarRecordWriter +( + BYTE nRecordType, // Record-Kennung der Subklasse + SvStream* pStream, // Stream, in dem der Record angelegt wird + UINT16 nRecordTag, // Gesamt-Art-Kennung + BYTE nRecordVer // Gesamt-Versions-Kennung +) + +/* [Beschreibung] + + Interner Ctor f"ur Subklassen. +*/ + +: SfxMultiFixRecordWriter( nRecordType, pStream, nRecordTag, nRecordVer, 0 ), + _nContentVer( 0 ) +{ +} + +//------------------------------------------------------------------------- + +SfxMultiVarRecordWriter::SfxMultiVarRecordWriter +( + SvStream* pStream, // Stream, in dem der Record angelegt wird + UINT16 nRecordTag, // Gesamt-Art-Kennung + BYTE nRecordVer // Gesamt-Versions-Kennung +) + +/* [Beschreibung] + + Legt in 'pStream' einen 'SfxMultiVarRecord' an, dessen Content-Gr"o\sen + weder bekannt sind noch identisch sein m"ussen, sondern jeweils nach dem + Streamen jedes einzelnen Contents errechnet werden sollen. + + + [Anmerkung] + + Diese Methode ist nicht inline, da f"ur die Initialisierung eines + -Members zu viel Code generiert werden w"urde. +*/ + +: SfxMultiFixRecordWriter( SFX_REC_TYPE_VARSIZE, + pStream, nRecordTag, nRecordVer, 0 ), + _nContentVer( 0 ) +{ +} + +//------------------------------------------------------------------------- + +SfxMultiVarRecordWriter::~SfxMultiVarRecordWriter() + +/* [Beschreibung] + + Der Dtor der Klasse schlie\st den Record + automatisch, falls nicht bereits + explizit gerufen wurde. +*/ + +{ + // wurde der Header noch nicht geschrieben oder mu\s er gepr"uft werden + if ( !_bHeaderOk ) + Close(); +} + +//------------------------------------------------------------------------- + +void SfxMultiVarRecordWriter::FlushContent_Impl() + +/* [Beschreibung] + + Interne Methode zum Abschlie\sen eines einzelnen Contents. +*/ + +{ + // Versions-Kennung und Positions-Offset des aktuellen Contents merken; + // das Positions-Offset ist relativ zur Startposition des ersten Contents + _aContentOfs.Insert( + SFX_REC_CONTENT_HEADER(_nContentVer,_nStartPos,_nContentStartPos), + _nContentCount-1 ); +} + +//------------------------------------------------------------------------- + +void SfxMultiVarRecordWriter::NewContent() + +// siehe + +{ + // schon ein Content geschrieben? + if ( _nContentCount ) + FlushContent_Impl(); + + // neuen Content beginnen + _nContentStartPos = _pStream->Tell(); + ++_nContentCount; +} + +//------------------------------------------------------------------------- + +UINT32 SfxMultiVarRecordWriter::Close( FASTBOOL bSeekToEndOfRec ) + +// siehe + +{ + // Header noch nicht geschrieben? + if ( !_bHeaderOk ) + { + // ggf. letzten Content abschlie\sen + if ( _nContentCount ) + FlushContent_Impl(); + + // Content-Offset-Tabelle schreiben + UINT32 nContentOfsPos = _pStream->Tell(); + //! darf man das so einr"ucken? + #if defined(OSL_LITENDIAN) + _pStream->Write( _aContentOfs.GetData(), + sizeof(UINT32)*_nContentCount ); + #else + for ( USHORT n = 0; n < _nContentCount; ++n ) + *_pStream << UINT32(_aContentOfs[n]); + #endif + + // SfxMultiFixRecordWriter::Close() "uberspringen! + UINT32 nEndPos = SfxSingleRecordWriter::Close( FALSE ); + + // eigenen Header schreiben + *_pStream << _nContentCount; + if ( SFX_REC_TYPE_VARSIZE_RELOC == _nPreTag || + SFX_REC_TYPE_MIXTAGS_RELOC == _nPreTag ) + *_pStream << static_cast(nContentOfsPos - ( _pStream->Tell() + sizeof(UINT32) )); + else + *_pStream << nContentOfsPos; + + // ans Ende des Records seeken bzw. am Ende des Headers bleiben + if ( bSeekToEndOfRec ) + _pStream->Seek(nEndPos); + return nEndPos; + } + + // Record war bereits vorher geschlossen + return 0; +} + +//========================================================================= + +void SfxMultiMixRecordWriter::NewContent +( + UINT16 nContentTag, // Kennung f"ur die Art des Contents + BYTE nContentVer // Kennung f"ur die Version des Contents +) + +/* [Beschreibung] + + Mit dieser Methode wird in den Record ein neuer Content eingef"ugt + und dessen Content-Tag sowie dessen Content-Version angegeben. Jeder, + auch der 1. Record mu\s durch Aufruf dieser Methode eingeleitet werden. +*/ + +{ + // ggf. vorherigen Record abschlie\sen + if ( _nContentCount ) + FlushContent_Impl(); + + // Tag vor den Content schreiben, Version und Startposition merken + _nContentStartPos = _pStream->Tell(); + ++_nContentCount; + *_pStream << nContentTag; + _nContentVer = nContentVer; +} + +//========================================================================= + +FASTBOOL SfxMultiRecordReader::ReadHeader_Impl() + +/* [Beschreibung] + + Interne Methode zum Einlesen eines SfxMultiRecord-Headers, nachdem + die Basisklasse bereits initialisiert und deren Header gelesen ist. + Ggf. ist ein Error-Code am Stream gesetzt, im Fehlerfall wird jedoch + nicht zur"uckge-seekt. +*/ + +{ + // eigenen Header lesen + *_pStream >> _nContentCount; + *_pStream >> _nContentSize; // Fix: jedes einzelnen, Var|Mix: Tabellen-Pos. + + // mu\s noch eine Tabelle mit Content-Offsets geladen werden? + if ( _nRecordType != SFX_REC_TYPE_FIXSIZE ) + { + // Tabelle aus dem Stream einlesen + UINT32 nContentPos = _pStream->Tell(); + if ( _nRecordType == SFX_REC_TYPE_VARSIZE_RELOC || + _nRecordType == SFX_REC_TYPE_MIXTAGS_RELOC ) + _pStream->SeekRel( + _nContentSize ); + else + _pStream->Seek( _nContentSize ); + _pContentOfs = new UINT32[_nContentCount]; + //! darf man jetzt so einr"ucken + #if defined(OSL_LITENDIAN) + _pStream->Read( _pContentOfs, sizeof(UINT32)*_nContentCount ); + #else + for ( USHORT n = 0; n < _nContentCount; ++n ) + *_pStream >> _pContentOfs[n]; + #endif + _pStream->Seek( nContentPos ); + } + + // Header konnte gelesen werden, wenn am Stream kein Error gesetzt ist + return !_pStream->GetError(); +} + +//------------------------------------------------------------------------- + +SfxMultiRecordReader::SfxMultiRecordReader( SvStream *pStream ) +: _pContentOfs( NULL ), _nContentNo(0) +{ + // Position im Stream merken, um im Fehlerfall zur"uck-seeken zu k"onnen + _nStartPos = pStream->Tell(); + + // Basisklasse konstruieren (normaler Ctor w"urde nur SingleRecs lesen) + SfxSingleRecordReader::Construct_Impl( pStream ); + + // Header der Basisklasse lesen + if ( !SfxSingleRecordReader::ReadHeader_Impl( SFX_REC_TYPE_FIXSIZE | + SFX_REC_TYPE_VARSIZE | SFX_REC_TYPE_VARSIZE_RELOC | + SFX_REC_TYPE_MIXTAGS | SFX_REC_TYPE_MIXTAGS_RELOC ) || + !ReadHeader_Impl() ) + // als ung"ultig markieren und zur"uck-seeken + SetInvalid_Impl( _nStartPos ); +} + +//------------------------------------------------------------------------- + +SfxMultiRecordReader::SfxMultiRecordReader( SvStream *pStream, UINT16 nTag ) +: _nContentNo(0) +{ + // Position im Stream merken, um im Fehlerfall zur"uck-seeken zu k"onnen + _nStartPos = pStream->Tell(); + + // passenden Record suchen und Basisklasse initialisieren + SfxSingleRecordReader::Construct_Impl( pStream ); + if ( SfxSingleRecordReader::FindHeader_Impl( SFX_REC_TYPE_FIXSIZE | + SFX_REC_TYPE_VARSIZE | SFX_REC_TYPE_VARSIZE_RELOC | + SFX_REC_TYPE_MIXTAGS | SFX_REC_TYPE_MIXTAGS_RELOC, + nTag ) ) + { + // eigenen Header dazu-lesen + if ( !ReadHeader_Impl() ) + // nicht lesbar => als ung"ultig markieren und zur"uck-seeken + SetInvalid_Impl( _nStartPos); + } +} + +//------------------------------------------------------------------------- + +SfxMultiRecordReader::~SfxMultiRecordReader() +{ + delete[] _pContentOfs; +} + +//------------------------------------------------------------------------- + +FASTBOOL SfxMultiRecordReader::GetContent() + +/* [Beschreibung] + + Positioniert den Stream an den Anfang des n"chsten bzw. beim 1. Aufruf + auf den Anfang des ersten Contents im Record und liest ggf. dessen + Header ein. + + Liegt laut Record-Header kein Content mehr vor, wird FALSE zur"uck- + gegeben. Trotz einem TRUE-Returnwert kann am Stream ein Fehlercode + gesetzt sein, z.B. falls er unvorhergesehenerweise (kaputtes File) + zuende ist. +*/ + +{ + // noch ein Content vorhanden? + if ( _nContentNo < _nContentCount ) + { + // den Stream an den Anfang des Contents positionieren + UINT32 nOffset = _nRecordType == SFX_REC_TYPE_FIXSIZE + ? _nContentNo * _nContentSize + : SFX_REC_CONTENT_OFS(_pContentOfs[_nContentNo]); + UINT32 nNewPos = _nStartPos + nOffset; + DBG_ASSERT( nNewPos >= _pStream->Tell(), "SfxMultiRecordReader::GetContent() - New position before current, to much data red!" ); + + // #99366#: correct stream pos in every case; + // the if clause was added by MT a long time ago, + // maybe to 'repair' other corrupt documents; but this + // gives errors when writing with 5.1 and reading with current + // versions, so we decided to remove the if clause (KA-05/17/2002) + // if ( nNewPos > _pStream->Tell() ) + _pStream->Seek( nNewPos ); + + // ggf. Content-Header lesen + if ( _nRecordType == SFX_REC_TYPE_MIXTAGS || + _nRecordType == SFX_REC_TYPE_MIXTAGS_RELOC ) + { + _nContentVer = sal::static_int_cast< BYTE >( + SFX_REC_CONTENT_VER(_pContentOfs[_nContentNo])); + *_pStream >> _nContentTag; + } + + // ContentNo weiterz"ahlen + ++_nContentNo; + return TRUE; + } + + return FALSE; +} + + diff --git a/svl/source/filerec/makefile.mk b/svl/source/filerec/makefile.mk new file mode 100644 index 000000000000..33e4b4923183 --- /dev/null +++ b/svl/source/filerec/makefile.mk @@ -0,0 +1,50 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.6 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=svtools +TARGET=filerec + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/svl.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/filerec.obj + +# --- Tagets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/svl/source/fsstor/exports.map b/svl/source/fsstor/exports.map new file mode 100644 index 000000000000..f4ed78b9e970 --- /dev/null +++ b/svl/source/fsstor/exports.map @@ -0,0 +1,8 @@ +UDK_3_0_0 { + global: + component_getImplementationEnvironment; + component_writeInfo; + component_getFactory; + local: + *; +}; diff --git a/svl/source/fsstor/fsfactory.cxx b/svl/source/fsstor/fsfactory.cxx new file mode 100644 index 000000000000..33df962be846 --- /dev/null +++ b/svl/source/fsstor/fsfactory.cxx @@ -0,0 +1,295 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: fsfactory.cxx,v $ + * $Revision: 1.10 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include "fsfactory.hxx" +#include "cppuhelper/factory.hxx" +#include +#include +#include +#include + + +#include +#include +#include + +#include +#include + +#include "fsstorage.hxx" + + +using namespace ::com::sun::star; + +//------------------------------------------------------------------------- +uno::Sequence< ::rtl::OUString > SAL_CALL FSStorageFactory::impl_staticGetSupportedServiceNames() +{ + uno::Sequence< ::rtl::OUString > aRet(2); + aRet[0] = ::rtl::OUString::createFromAscii("com.sun.star.embed.FileSystemStorageFactory"); + aRet[1] = ::rtl::OUString::createFromAscii("com.sun.star.comp.embed.FileSystemStorageFactory"); + return aRet; +} + +//------------------------------------------------------------------------- +::rtl::OUString SAL_CALL FSStorageFactory::impl_staticGetImplementationName() +{ + return ::rtl::OUString::createFromAscii("com.sun.star.comp.embed.FileSystemStorageFactory"); +} + +//------------------------------------------------------------------------- +uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::impl_staticCreateSelfInstance( + const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) +{ + return uno::Reference< uno::XInterface >( *new FSStorageFactory( xServiceManager ) ); +} + +//------------------------------------------------------------------------- +uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::createInstance() + throw ( uno::Exception, + uno::RuntimeException ) +{ + ::rtl::OUString aTempURL; + + aTempURL = ::utl::TempFile( NULL, sal_True ).GetURL(); + + if ( !aTempURL.getLength() ) + throw uno::RuntimeException(); // TODO: can not create tempfile + + ::ucbhelper::Content aResultContent( + aTempURL, uno::Reference< ucb::XCommandEnvironment >() ); + + return uno::Reference< uno::XInterface >( + static_cast< OWeakObject* >( + new FSStorage( aResultContent, + embed::ElementModes::READWRITE, + uno::Sequence< beans::PropertyValue >(), + m_xFactory ) ), + uno::UNO_QUERY ); +} + +//------------------------------------------------------------------------- +uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::createInstanceWithArguments( + const uno::Sequence< uno::Any >& aArguments ) + throw ( uno::Exception, + uno::RuntimeException ) +{ + // The request for storage can be done with up to three arguments + + // The first argument specifies a source for the storage + // it must be URL. + // The second value is a mode the storage should be open in. + // And the third value is a media descriptor. + + sal_Int32 nArgNum = aArguments.getLength(); + OSL_ENSURE( nArgNum < 4, "Wrong parameter number" ); + + if ( !nArgNum ) + return createInstance(); + + // first try to retrieve storage open mode if any + // by default the storage will be open in readonly mode + sal_Int32 nStorageMode = embed::ElementModes::READ; + if ( nArgNum >= 2 ) + { + if( !( aArguments[1] >>= nStorageMode ) ) + { + OSL_ENSURE( sal_False, "Wrong second argument!\n" ); + throw uno::Exception(); // TODO: Illegal argument + } + // it's allways possible to read written storage in this implementation + nStorageMode |= embed::ElementModes::READ; + } + + // retrieve storage source URL + ::rtl::OUString aURL; + + if ( aArguments[0] >>= aURL ) + { + if ( !aURL.getLength() ) + { + OSL_ENSURE( sal_False, "Empty URL is provided!\n" ); + throw uno::Exception(); // TODO: illegal argument + } + } + else + { + OSL_ENSURE( sal_False, "Wrong first argument!\n" ); + throw uno::Exception(); // TODO: Illegal argument + } + + // retrieve mediadescriptor and set storage properties + uno::Sequence< beans::PropertyValue > aDescr; + uno::Sequence< beans::PropertyValue > aPropsToSet; + + if ( nArgNum >= 3 ) + { + if( aArguments[2] >>= aDescr ) + { + aPropsToSet.realloc(1); + aPropsToSet[0].Name = ::rtl::OUString::createFromAscii( "URL" ); + aPropsToSet[0].Value <<= aURL; + + for ( sal_Int32 nInd = 0, nNumArgs = 1; nInd < aDescr.getLength(); nInd++ ) + { + if ( aDescr[nInd].Name.equalsAscii( "InteractionHandler" ) ) + { + aPropsToSet.realloc( ++nNumArgs ); + aPropsToSet[nNumArgs-1].Name = aDescr[nInd].Name; + aPropsToSet[nNumArgs-1].Value = aDescr[nInd].Value; + break; + } + else + OSL_ENSURE( sal_False, "Unacceptable property, will be ignored!\n" ); + } + } + else + { + OSL_ENSURE( sal_False, "Wrong third argument!\n" ); + throw uno::Exception(); // TODO: Illegal argument + } + } + + // allow to use other ucp's + // if ( !isLocalNotFile_Impl( aURL ) ) + if ( aURL.equalsIgnoreAsciiCaseAsciiL( "vnd.sun.star.pkg", 16 ) + || aURL.equalsIgnoreAsciiCaseAsciiL( "vnd.sun.star.zip", 16 ) + || ::utl::UCBContentHelper::IsDocument( aURL ) ) + { + OSL_ENSURE( sal_False, "File system storages can be based only on file URLs!\n" ); // ??? + throw uno::Exception(); // TODO: illegal argument + } + + if ( ( nStorageMode & embed::ElementModes::WRITE ) && !( nStorageMode & embed::ElementModes::NOCREATE ) ) + FSStorage::MakeFolderNoUI( aURL, sal_False ); + else if ( !::utl::UCBContentHelper::IsFolder( aURL ) ) + throw io::IOException(); // there is no such folder + + ::ucbhelper::Content aResultContent( + aURL, uno::Reference< ucb::XCommandEnvironment >() ); + + // create storage based on source + return uno::Reference< uno::XInterface >( + static_cast< OWeakObject* >( new FSStorage( aResultContent, + nStorageMode, + aPropsToSet, + m_xFactory ) ), + uno::UNO_QUERY ); +} + +//------------------------------------------------------------------------- +::rtl::OUString SAL_CALL FSStorageFactory::getImplementationName() + throw ( uno::RuntimeException ) +{ + return impl_staticGetImplementationName(); +} + +//------------------------------------------------------------------------- +sal_Bool SAL_CALL FSStorageFactory::supportsService( const ::rtl::OUString& ServiceName ) + throw ( uno::RuntimeException ) +{ + uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames(); + + for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ ) + if ( ServiceName.compareTo( aSeq[nInd] ) == 0 ) + return sal_True; + + return sal_False; +} + +//------------------------------------------------------------------------- +uno::Sequence< ::rtl::OUString > SAL_CALL FSStorageFactory::getSupportedServiceNames() + throw ( uno::RuntimeException ) +{ + return impl_staticGetSupportedServiceNames(); +} + +//------------------------------------------------------------------------- + +extern "C" +{ +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( + const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( + void * /* pServiceManager */, void * pRegistryKey) +{ + if (pRegistryKey) + { + uno::Reference< registry::XRegistryKey > xRegistryKey ( + reinterpret_cast< registry::XRegistryKey*>(pRegistryKey)); + + uno::Reference< registry::XRegistryKey > xNewKey; + xNewKey = xRegistryKey->createKey( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + + FSStorageFactory::impl_staticGetImplementationName() + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES"))); + + const uno::Sequence< ::rtl::OUString > aServices ( + FSStorageFactory::impl_staticGetSupportedServiceNames()); + for( sal_Int32 i = 0; i < aServices.getLength(); i++ ) + xNewKey->createKey( aServices.getConstArray()[i] ); + + return sal_True; + } + return sal_False; +} + +SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( + const sal_Char * pImplementationName, void * pServiceManager, void * /* pRegistryKey */) +{ + void * pResult = 0; + if (pServiceManager) + { + uno::Reference< lang::XSingleServiceFactory > xFactory; + if (FSStorageFactory::impl_staticGetImplementationName().compareToAscii (pImplementationName) == 0) + { + xFactory = cppu::createOneInstanceFactory ( + reinterpret_cast< lang::XMultiServiceFactory* >(pServiceManager), + FSStorageFactory::impl_staticGetImplementationName(), + FSStorageFactory::impl_staticCreateSelfInstance, + FSStorageFactory::impl_staticGetSupportedServiceNames() ); + } + if (xFactory.is()) + { + xFactory->acquire(); + pResult = xFactory.get(); + } + } + return pResult; +} + +} // extern "C" + diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx new file mode 100644 index 000000000000..cec018533a9a --- /dev/null +++ b/svl/source/fsstor/fsstorage.cxx @@ -0,0 +1,1617 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: fsstorage.cxx,v $ + * $Revision: 1.11 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include +#include +#include +#include +#include +#include + +#ifndef _COM_SUN_STAR_UCB_INTERACTIVEIODEXCEPTION_HPP_ +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#ifndef _COMPHELPER_PROCESSFACTORY_HXX +#include +#endif +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "fsstorage.hxx" +#include "oinputstreamcontainer.hxx" +#include "ostreamcontainer.hxx" + +using namespace ::com::sun::star; + +//========================================================= + +// TODO: move to a standard helper +sal_Bool isLocalFile_Impl( ::rtl::OUString aURL ) +{ + ::rtl::OUString aSystemPath; + ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get(); + if ( !pBroker ) + throw uno::RuntimeException(); + + uno::Reference< ucb::XContentProviderManager > xManager = + pBroker->getContentProviderManagerInterface(); + try + { + aSystemPath = ::ucbhelper::getSystemPathFromFileURL( xManager, aURL ); + } + catch ( uno::Exception& ) + { + } + + return ( aSystemPath.getLength() != 0 ); +} + + +//========================================================= + +struct FSStorage_Impl +{ + ::rtl::OUString m_aURL; + + ::ucbhelper::Content* m_pContent; + sal_Int32 m_nMode; + + ::cppu::OInterfaceContainerHelper* m_pListenersContainer; // list of listeners + ::cppu::OTypeCollection* m_pTypeCollection; + + uno::Reference< lang::XMultiServiceFactory > m_xFactory; + + + FSStorage_Impl( const ::rtl::OUString& aURL, sal_Int32 nMode, uno::Reference< lang::XMultiServiceFactory > xFactory ) + : m_aURL( aURL ) + , m_pContent( NULL ) + , m_nMode( nMode ) + , m_pListenersContainer( NULL ) + , m_pTypeCollection( NULL ) + , m_xFactory( xFactory ) + { + OSL_ENSURE( m_aURL.getLength(), "The URL must not be empty" ); + } + + FSStorage_Impl( const ::ucbhelper::Content& aContent, sal_Int32 nMode, uno::Reference< lang::XMultiServiceFactory > xFactory ) + : m_aURL( aContent.getURL() ) + , m_pContent( new ::ucbhelper::Content( aContent ) ) + , m_nMode( nMode ) + , m_pListenersContainer( NULL ) + , m_pTypeCollection( NULL ) + , m_xFactory( xFactory ) + { + OSL_ENSURE( m_aURL.getLength(), "The URL must not be empty" ); + } + + ~FSStorage_Impl(); +}; + +//========================================================= + +FSStorage_Impl::~FSStorage_Impl() +{ + if ( m_pListenersContainer ) + delete m_pListenersContainer; + if ( m_pTypeCollection ) + delete m_pTypeCollection; + if ( m_pContent ) + delete m_pContent; +} + +//===================================================== +// FSStorage implementation +//===================================================== + +//----------------------------------------------- +FSStorage::FSStorage( const ::ucbhelper::Content& aContent, + sal_Int32 nMode, + uno::Sequence< beans::PropertyValue >, + uno::Reference< lang::XMultiServiceFactory > xFactory ) +: m_pImpl( new FSStorage_Impl( aContent, nMode, xFactory ) ) +{ + // TODO: use properties + if ( !xFactory.is() ) + throw uno::RuntimeException(); + + GetContent(); +} + +//----------------------------------------------- +FSStorage::~FSStorage() +{ + { + ::osl::MutexGuard aGuard( m_aMutex ); + m_refCount++; // to call dispose + try { + dispose(); + } + catch( uno::RuntimeException& ) + {} + } +} + +//----------------------------------------------- +sal_Bool FSStorage::MakeFolderNoUI( const String& rFolder, sal_Bool ) +{ + INetURLObject aURL( rFolder ); + ::rtl::OUString aTitle = aURL.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); + aURL.removeSegment(); + ::ucbhelper::Content aParent; + ::ucbhelper::Content aResultContent; + + if ( ::ucbhelper::Content::create( aURL.GetMainURL( INetURLObject::NO_DECODE ), + uno::Reference< ucb::XCommandEnvironment >(), + aParent ) ) + return ::utl::UCBContentHelper::MakeFolder( aParent, aTitle, aResultContent, sal_False ); + + return sal_False; +} + +//----------------------------------------------- +::ucbhelper::Content* FSStorage::GetContent() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_pImpl->m_pContent ) + { + uno::Reference< ucb::XCommandEnvironment > xDummyEnv; + + try + { + m_pImpl->m_pContent = new ::ucbhelper::Content( m_pImpl->m_aURL, xDummyEnv ); + } + catch( uno::Exception& ) + { + } + } + + return m_pImpl->m_pContent; +} + +//----------------------------------------------- +void FSStorage::CopyStreamToSubStream( const ::rtl::OUString& aSourceURL, + const uno::Reference< embed::XStorage >& xDest, + const ::rtl::OUString& aNewEntryName ) +{ + if ( !xDest.is() ) + throw uno::RuntimeException(); + + uno::Reference< ucb::XCommandEnvironment > xDummyEnv; + ::ucbhelper::Content aSourceContent( aSourceURL, xDummyEnv ); + uno::Reference< io::XInputStream > xSourceInput = aSourceContent.openStream(); + + if ( !xSourceInput.is() ) + throw io::IOException(); // TODO: error handling + + uno::Reference< io::XStream > xSubStream = xDest->openStreamElement( + aNewEntryName, + embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE ); + if ( !xSubStream.is() ) + throw uno::RuntimeException(); + + uno::Reference< io::XOutputStream > xDestOutput = xSubStream->getOutputStream(); + if ( !xDestOutput.is() ) + throw uno::RuntimeException(); + + ::comphelper::OStorageHelper::CopyInputToOutput( xSourceInput, xDestOutput ); + xDestOutput->closeOutput(); +} + +//----------------------------------------------- +void FSStorage::CopyContentToStorage_Impl( ::ucbhelper::Content* pContent, const uno::Reference< embed::XStorage >& xDest ) +{ + if ( !pContent ) + throw uno::RuntimeException(); + + // get list of contents of the Content + // create cursor for access to children + uno::Sequence< ::rtl::OUString > aProps( 2 ); + ::rtl::OUString* pProps = aProps.getArray(); + pProps[0] = ::rtl::OUString::createFromAscii( "TargetURL" ); + pProps[1] = ::rtl::OUString::createFromAscii( "IsFolder" ); + ::ucbhelper::ResultSetInclude eInclude = ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS; + + try + { + uno::Reference< sdbc::XResultSet > xResultSet = pContent->createCursor( aProps, eInclude ); + uno::Reference< ucb::XContentAccess > xContentAccess( xResultSet, uno::UNO_QUERY ); + uno::Reference< sdbc::XRow > xRow( xResultSet, uno::UNO_QUERY ); + if ( xResultSet.is() ) + { + // go through the list: insert files as streams, insert folders as substorages using recursion + while ( xResultSet->next() ) + { + ::rtl::OUString aSourceURL( xRow->getString( 1 ) ); + sal_Bool bIsFolder( xRow->getBoolean(2) ); + + // TODO/LATER: not sure whether the entry name must be encoded + ::rtl::OUString aNewEntryName( INetURLObject( aSourceURL ).getName( INetURLObject::LAST_SEGMENT, + true, + INetURLObject::NO_DECODE ) ); + if ( bIsFolder ) + { + uno::Reference< embed::XStorage > xSubStorage = xDest->openStorageElement( aNewEntryName, + embed::ElementModes::READWRITE ); + if ( !xSubStorage.is() ) + throw uno::RuntimeException(); + + uno::Reference< ucb::XCommandEnvironment > xDummyEnv; + ::ucbhelper::Content aSourceContent( aSourceURL, xDummyEnv ); + CopyContentToStorage_Impl( &aSourceContent, xSubStorage ); + } + else + { + CopyStreamToSubStream( aSourceURL, xDest, aNewEntryName ); + } + } + } + + uno::Reference< embed::XTransactedObject > xTransact( xDest, uno::UNO_QUERY ); + if ( xTransact.is() ) + xTransact->commit(); + } + catch( ucb::InteractiveIOException& r ) + { + if ( r.Code == ucb::IOErrorCode_NOT_EXISTING ) + OSL_ENSURE( sal_False, "The folder does not exist!\n" ); + else + throw; + } +} + +//____________________________________________________________________________________________________ +// XInterface +//____________________________________________________________________________________________________ + +//----------------------------------------------- +uno::Any SAL_CALL FSStorage::queryInterface( const uno::Type& rType ) + throw( uno::RuntimeException ) +{ + uno::Any aReturn; + aReturn <<= ::cppu::queryInterface + ( rType + , static_cast ( this ) + , static_cast ( this ) + , static_cast ( this ) + , static_cast ( this ) + , static_cast ( this ) + , static_cast ( this ) + , static_cast ( this ) ); + + if ( aReturn.hasValue() == sal_True ) + return aReturn ; + + return OWeakObject::queryInterface( rType ); +} + +//----------------------------------------------- +void SAL_CALL FSStorage::acquire() throw() +{ + OWeakObject::acquire(); +} + +//----------------------------------------------- +void SAL_CALL FSStorage::release() throw() +{ + OWeakObject::release(); +} + +//____________________________________________________________________________________________________ +// XTypeProvider +//____________________________________________________________________________________________________ + +//----------------------------------------------- +uno::Sequence< uno::Type > SAL_CALL FSStorage::getTypes() + throw( uno::RuntimeException ) +{ + if ( m_pImpl->m_pTypeCollection == NULL ) + { + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_pImpl->m_pTypeCollection == NULL ) + { + m_pImpl->m_pTypeCollection = new ::cppu::OTypeCollection + ( ::getCppuType( ( const uno::Reference< lang::XTypeProvider >* )NULL ) + , ::getCppuType( ( const uno::Reference< embed::XStorage >* )NULL ) + , ::getCppuType( ( const uno::Reference< embed::XHierarchicalStorageAccess >* )NULL ) + , ::getCppuType( ( const uno::Reference< beans::XPropertySet >* )NULL ) ); + } + } + + return m_pImpl->m_pTypeCollection->getTypes() ; +} + +//----------------------------------------------- +uno::Sequence< sal_Int8 > SAL_CALL FSStorage::getImplementationId() + throw( uno::RuntimeException ) +{ + static ::cppu::OImplementationId* pID = NULL ; + + if ( pID == NULL ) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ) ; + + if ( pID == NULL ) + { + static ::cppu::OImplementationId aID( sal_False ) ; + pID = &aID ; + } + } + + return pID->getImplementationId() ; + +} + +//____________________________________________________________________________________________________ +// XStorage +//____________________________________________________________________________________________________ + +//----------------------------------------------- +void SAL_CALL FSStorage::copyToStorage( const uno::Reference< embed::XStorage >& xDest ) + throw ( embed::InvalidStorageException, + io::IOException, + lang::IllegalArgumentException, + embed::StorageWrappedTargetException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + if ( !xDest.is() || xDest == uno::Reference< uno::XInterface >( static_cast< OWeakObject*> ( this ), uno::UNO_QUERY ) ) + throw lang::IllegalArgumentException(); // TODO: + + if ( !GetContent() ) + throw io::IOException(); // TODO: error handling + + try + { + CopyContentToStorage_Impl( GetContent(), xDest ); + } + catch( embed::InvalidStorageException& ) + { + throw; + } + catch( lang::IllegalArgumentException& ) + { + throw; + } + catch( embed::StorageWrappedTargetException& ) + { + throw; + } + catch( io::IOException& ) + { + throw; + } + catch( uno::RuntimeException& ) + { + throw; + } + catch( uno::Exception& ) + { + uno::Any aCaught( ::cppu::getCaughtException() ); + throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy raw stream" ), + uno::Reference< io::XInputStream >(), + aCaught ); + } +} + +//----------------------------------------------- +uno::Reference< io::XStream > SAL_CALL FSStorage::openStreamElement( + const ::rtl::OUString& aStreamName, sal_Int32 nOpenMode ) + throw ( embed::InvalidStorageException, + lang::IllegalArgumentException, + packages::WrongPasswordException, + io::IOException, + embed::StorageWrappedTargetException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + if ( !GetContent() ) + throw io::IOException(); // TODO: error handling + + // TODO/LATER: may need possibility to create folder if it was removed, since the folder can not be locked + INetURLObject aFileURL( m_pImpl->m_aURL ); + aFileURL.Append( aStreamName ); + + if ( ::utl::UCBContentHelper::IsFolder( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) + throw io::IOException(); + + if ( ( nOpenMode & embed::ElementModes::NOCREATE ) + && !::utl::UCBContentHelper::IsDocument( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) + throw io::IOException(); // TODO: + + uno::Reference< ucb::XCommandEnvironment > xDummyEnv; // TODO: provide InteractionHandler if any + uno::Reference< io::XStream > xResult; + try + { + if ( nOpenMode & embed::ElementModes::WRITE ) + { + if ( isLocalFile_Impl( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) + { + uno::Reference< ucb::XSimpleFileAccess > xSimpleFileAccess( + m_pImpl->m_xFactory->createInstance( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) ) ), + uno::UNO_QUERY_THROW ); + xResult = xSimpleFileAccess->openFileReadWrite( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ); + } + else + { + // TODO: test whether it really works for http and fwp + SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( aFileURL.GetMainURL( INetURLObject::NO_DECODE ), + STREAM_STD_WRITE ); + if ( pStream ) + { + if ( !pStream->GetError() ) + xResult = uno::Reference < io::XStream >( new ::utl::OStreamWrapper( *pStream ) ); + else + delete pStream; + } + } + + if ( !xResult.is() ) + throw io::IOException(); + + if ( ( nOpenMode & embed::ElementModes::TRUNCATE ) ) + { + uno::Reference< io::XTruncate > xTrunc( xResult->getOutputStream(), uno::UNO_QUERY_THROW ); + xTrunc->truncate(); + } + } + else + { + if ( ( nOpenMode & embed::ElementModes::TRUNCATE ) + || !::utl::UCBContentHelper::IsDocument( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) + throw io::IOException(); // TODO: access denied + + ::ucbhelper::Content aResultContent( aFileURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv ); + uno::Reference< io::XInputStream > xInStream = aResultContent.openStream(); + xResult = static_cast< io::XStream* >( new OFSInputStreamContainer( xInStream ) ); + } + } + catch( embed::InvalidStorageException& ) + { + throw; + } + catch( lang::IllegalArgumentException& ) + { + throw; + } + catch( packages::WrongPasswordException& ) + { + throw; + } + catch( embed::StorageWrappedTargetException& ) + { + throw; + } + catch( io::IOException& ) + { + throw; + } + catch( uno::RuntimeException& ) + { + throw; + } + catch( uno::Exception& ) + { + uno::Any aCaught( ::cppu::getCaughtException() ); + throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy raw stream" ), + uno::Reference< io::XInputStream >(), + aCaught ); + } + + return xResult; +} + +//----------------------------------------------- +uno::Reference< io::XStream > SAL_CALL FSStorage::openEncryptedStreamElement( + const ::rtl::OUString&, sal_Int32, const ::rtl::OUString& ) + throw ( embed::InvalidStorageException, + lang::IllegalArgumentException, + packages::NoEncryptionException, + packages::WrongPasswordException, + io::IOException, + embed::StorageWrappedTargetException, + uno::RuntimeException ) +{ + throw packages::NoEncryptionException(); +} + +//----------------------------------------------- +uno::Reference< embed::XStorage > SAL_CALL FSStorage::openStorageElement( + const ::rtl::OUString& aStorName, sal_Int32 nStorageMode ) + throw ( embed::InvalidStorageException, + lang::IllegalArgumentException, + io::IOException, + embed::StorageWrappedTargetException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + if ( !GetContent() ) + throw io::IOException(); // TODO: error handling + + if ( ( nStorageMode & embed::ElementModes::WRITE ) + && !( m_pImpl->m_nMode & embed::ElementModes::WRITE ) ) + throw io::IOException(); // TODO: error handling + + // TODO/LATER: may need possibility to create folder if it was removed, since the folder can not be locked + INetURLObject aFolderURL( m_pImpl->m_aURL ); + aFolderURL.Append( aStorName ); + + sal_Bool bFolderExists = ::utl::UCBContentHelper::IsFolder( aFolderURL.GetMainURL( INetURLObject::NO_DECODE ) ); + if ( !bFolderExists && ::utl::UCBContentHelper::IsDocument( aFolderURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) + throw io::IOException(); // TODO: + + if ( ( nStorageMode & embed::ElementModes::NOCREATE ) && !bFolderExists ) + throw io::IOException(); // TODO: + + uno::Reference< ucb::XCommandEnvironment > xDummyEnv; // TODO: provide InteractionHandler if any + uno::Reference< embed::XStorage > xResult; + try + { + if ( nStorageMode & embed::ElementModes::WRITE ) + { + if ( ( nStorageMode & embed::ElementModes::TRUNCATE ) && bFolderExists ) + { + ::utl::UCBContentHelper::Kill( aFolderURL.GetMainURL( INetURLObject::NO_DECODE ) ); + bFolderExists = + MakeFolderNoUI( aFolderURL.GetMainURL( INetURLObject::NO_DECODE ), sal_True ); // TODO: not atomar :( + } + else if ( !bFolderExists ) + { + bFolderExists = + MakeFolderNoUI( aFolderURL.GetMainURL( INetURLObject::NO_DECODE ), sal_True ); // TODO: not atomar :( + } + } + else if ( ( nStorageMode & embed::ElementModes::TRUNCATE ) ) + throw io::IOException(); // TODO: access denied + + if ( !bFolderExists ) + throw io::IOException(); // there is no such folder + + ::ucbhelper::Content aResultContent( aFolderURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv ); + xResult = uno::Reference< embed::XStorage >( + static_cast< OWeakObject* >( new FSStorage( aResultContent, + nStorageMode, + uno::Sequence< beans::PropertyValue >(), + m_pImpl->m_xFactory ) ), + uno::UNO_QUERY ); + } + catch( embed::InvalidStorageException& ) + { + throw; + } + catch( lang::IllegalArgumentException& ) + { + throw; + } + catch( embed::StorageWrappedTargetException& ) + { + throw; + } + catch( io::IOException& ) + { + throw; + } + catch( uno::RuntimeException& ) + { + throw; + } + catch( uno::Exception& ) + { + uno::Any aCaught( ::cppu::getCaughtException() ); + throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy raw stream" ), + uno::Reference< io::XInputStream >(), + aCaught ); + } + + return xResult; +} + +//----------------------------------------------- +uno::Reference< io::XStream > SAL_CALL FSStorage::cloneStreamElement( const ::rtl::OUString& aStreamName ) + throw ( embed::InvalidStorageException, + lang::IllegalArgumentException, + packages::WrongPasswordException, + io::IOException, + embed::StorageWrappedTargetException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + if ( !GetContent() ) + throw io::IOException(); // TODO: error handling + + // TODO/LATER: may need possibility to create folder if it was removed, since the folder can not be locked + INetURLObject aFileURL( m_pImpl->m_aURL ); + aFileURL.Append( aStreamName ); + + uno::Reference < io::XStream > xTempResult; + try + { + uno::Reference< ucb::XCommandEnvironment > xDummyEnv; + ::ucbhelper::Content aResultContent( aFileURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv ); + uno::Reference< io::XInputStream > xInStream = aResultContent.openStream(); + + xTempResult = uno::Reference < io::XStream >( + m_pImpl->m_xFactory->createInstance ( ::rtl::OUString::createFromAscii( "com.sun.star.io.TempFile" ) ), + uno::UNO_QUERY_THROW ); + uno::Reference < io::XOutputStream > xTempOut = xTempResult->getOutputStream(); + uno::Reference < io::XInputStream > xTempIn = xTempResult->getInputStream(); + + if ( !xTempOut.is() || !xTempIn.is() ) + throw io::IOException(); + + ::comphelper::OStorageHelper::CopyInputToOutput( xInStream, xTempOut ); + xTempOut->closeOutput(); + } + catch( embed::InvalidStorageException& ) + { + throw; + } + catch( lang::IllegalArgumentException& ) + { + throw; + } + catch( packages::WrongPasswordException& ) + { + throw; + } + catch( io::IOException& ) + { + throw; + } + catch( embed::StorageWrappedTargetException& ) + { + throw; + } + catch( uno::RuntimeException& ) + { + throw; + } + catch( uno::Exception& ) + { + uno::Any aCaught( ::cppu::getCaughtException() ); + throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy raw stream" ), + uno::Reference< io::XInputStream >(), + aCaught ); + } + + return xTempResult; +} + +//----------------------------------------------- +uno::Reference< io::XStream > SAL_CALL FSStorage::cloneEncryptedStreamElement( + const ::rtl::OUString&, + const ::rtl::OUString& ) + throw ( embed::InvalidStorageException, + lang::IllegalArgumentException, + packages::NoEncryptionException, + packages::WrongPasswordException, + io::IOException, + embed::StorageWrappedTargetException, + uno::RuntimeException ) +{ + throw packages::NoEncryptionException(); +} + +//----------------------------------------------- +void SAL_CALL FSStorage::copyLastCommitTo( + const uno::Reference< embed::XStorage >& xTargetStorage ) + throw ( embed::InvalidStorageException, + lang::IllegalArgumentException, + io::IOException, + embed::StorageWrappedTargetException, + uno::RuntimeException ) +{ + copyToStorage( xTargetStorage ); +} + +//----------------------------------------------- +void SAL_CALL FSStorage::copyStorageElementLastCommitTo( + const ::rtl::OUString& aStorName, + const uno::Reference< embed::XStorage >& xTargetStorage ) + throw ( embed::InvalidStorageException, + lang::IllegalArgumentException, + io::IOException, + embed::StorageWrappedTargetException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + uno::Reference< embed::XStorage > xSourceStor( openStorageElement( aStorName, embed::ElementModes::READ ), + uno::UNO_QUERY_THROW ); + xSourceStor->copyToStorage( xTargetStorage ); +} + +//----------------------------------------------- +sal_Bool SAL_CALL FSStorage::isStreamElement( const ::rtl::OUString& aElementName ) + throw ( embed::InvalidStorageException, + lang::IllegalArgumentException, + container::NoSuchElementException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + if ( !GetContent() ) + throw embed::InvalidStorageException(); // TODO: error handling + + INetURLObject aURL( m_pImpl->m_aURL ); + aURL.Append( aElementName ); + + return !::utl::UCBContentHelper::IsFolder( aURL.GetMainURL( INetURLObject::NO_DECODE ) ); +} + +//----------------------------------------------- +sal_Bool SAL_CALL FSStorage::isStorageElement( const ::rtl::OUString& aElementName ) + throw ( embed::InvalidStorageException, + lang::IllegalArgumentException, + container::NoSuchElementException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + if ( !GetContent() ) + throw embed::InvalidStorageException(); // TODO: error handling + + INetURLObject aURL( m_pImpl->m_aURL ); + aURL.Append( aElementName ); + + return ::utl::UCBContentHelper::IsFolder( aURL.GetMainURL( INetURLObject::NO_DECODE ) ); +} + +//----------------------------------------------- +void SAL_CALL FSStorage::removeElement( const ::rtl::OUString& aElementName ) + throw ( embed::InvalidStorageException, + lang::IllegalArgumentException, + container::NoSuchElementException, + io::IOException, + embed::StorageWrappedTargetException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + if ( !GetContent() ) + throw io::IOException(); // TODO: error handling + + INetURLObject aURL( m_pImpl->m_aURL ); + aURL.Append( aElementName ); + + if ( !::utl::UCBContentHelper::IsFolder( aURL.GetMainURL( INetURLObject::NO_DECODE ) ) + && !::utl::UCBContentHelper::IsDocument( aURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) + throw container::NoSuchElementException(); // TODO: + + ::utl::UCBContentHelper::Kill( aURL.GetMainURL( INetURLObject::NO_DECODE ) ); +} + +//----------------------------------------------- +void SAL_CALL FSStorage::renameElement( const ::rtl::OUString& aElementName, const ::rtl::OUString& aNewName ) + throw ( embed::InvalidStorageException, + lang::IllegalArgumentException, + container::NoSuchElementException, + container::ElementExistException, + io::IOException, + embed::StorageWrappedTargetException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + if ( !GetContent() ) + throw io::IOException(); // TODO: error handling + + INetURLObject aOldURL( m_pImpl->m_aURL ); + aOldURL.Append( aElementName ); + + INetURLObject aNewURL( m_pImpl->m_aURL ); + aNewURL.Append( aNewName ); + + if ( !::utl::UCBContentHelper::IsFolder( aOldURL.GetMainURL( INetURLObject::NO_DECODE ) ) + && !::utl::UCBContentHelper::IsDocument( aOldURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) + throw container::NoSuchElementException(); // TODO: + + if ( ::utl::UCBContentHelper::IsFolder( aNewURL.GetMainURL( INetURLObject::NO_DECODE ) ) + || ::utl::UCBContentHelper::IsDocument( aNewURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) + throw container::ElementExistException(); // TODO: + + try + { + uno::Reference< ucb::XCommandEnvironment > xDummyEnv; + ::ucbhelper::Content aSourceContent( aOldURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv ); + + if ( !GetContent()->transferContent( aSourceContent, + ::ucbhelper::InsertOperation_MOVE, + aNewName, + ucb::NameClash::ERROR ) ) + throw io::IOException(); // TODO: error handling + } + catch( embed::InvalidStorageException& ) + { + throw; + } + catch( lang::IllegalArgumentException& ) + { + throw; + } + catch( container::NoSuchElementException& ) + { + throw; + } + catch( container::ElementExistException& ) + { + throw; + } + catch( io::IOException& ) + { + throw; + } + catch( embed::StorageWrappedTargetException& ) + { + throw; + } + catch( uno::RuntimeException& ) + { + throw; + } + catch( uno::Exception& ) + { + uno::Any aCaught( ::cppu::getCaughtException() ); + throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy raw stream" ), + uno::Reference< io::XInputStream >(), + aCaught ); + } +} + +//----------------------------------------------- +void SAL_CALL FSStorage::copyElementTo( const ::rtl::OUString& aElementName, + const uno::Reference< embed::XStorage >& xDest, + const ::rtl::OUString& aNewName ) + throw ( embed::InvalidStorageException, + lang::IllegalArgumentException, + container::NoSuchElementException, + container::ElementExistException, + io::IOException, + embed::StorageWrappedTargetException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + if ( !xDest.is() ) + throw uno::RuntimeException(); + + if ( !GetContent() ) + throw io::IOException(); // TODO: error handling + + INetURLObject aOwnURL( m_pImpl->m_aURL ); + aOwnURL.Append( aElementName ); + + if ( xDest->hasByName( aNewName ) ) + throw container::ElementExistException(); // TODO: + + try + { + uno::Reference< ucb::XCommandEnvironment > xDummyEnv; + if ( ::utl::UCBContentHelper::IsFolder( aOwnURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) + { + ::ucbhelper::Content aSourceContent( aOwnURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv ); + uno::Reference< embed::XStorage > xDestSubStor( + xDest->openStorageElement( aNewName, embed::ElementModes::READWRITE ), + uno::UNO_QUERY_THROW ); + + CopyContentToStorage_Impl( &aSourceContent, xDestSubStor ); + } + else if ( ::utl::UCBContentHelper::IsDocument( aOwnURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) + { + CopyStreamToSubStream( aOwnURL.GetMainURL( INetURLObject::NO_DECODE ), xDest, aNewName ); + } + else + throw container::NoSuchElementException(); // TODO: + } + catch( embed::InvalidStorageException& ) + { + throw; + } + catch( lang::IllegalArgumentException& ) + { + throw; + } + catch( container::NoSuchElementException& ) + { + throw; + } + catch( container::ElementExistException& ) + { + throw; + } + catch( embed::StorageWrappedTargetException& ) + { + throw; + } + catch( io::IOException& ) + { + throw; + } + catch( uno::RuntimeException& ) + { + throw; + } + catch( uno::Exception& ) + { + uno::Any aCaught( ::cppu::getCaughtException() ); + throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy raw stream" ), + uno::Reference< io::XInputStream >(), + aCaught ); + } +} + +//----------------------------------------------- +void SAL_CALL FSStorage::moveElementTo( const ::rtl::OUString& aElementName, + const uno::Reference< embed::XStorage >& xDest, + const ::rtl::OUString& aNewName ) + throw ( embed::InvalidStorageException, + lang::IllegalArgumentException, + container::NoSuchElementException, + container::ElementExistException, + io::IOException, + embed::StorageWrappedTargetException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + copyElementTo( aElementName, xDest, aNewName ); + + INetURLObject aOwnURL( m_pImpl->m_aURL ); + aOwnURL.Append( aElementName ); + if ( !::utl::UCBContentHelper::Kill( aOwnURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) + throw io::IOException(); // TODO: error handling +} + +//____________________________________________________________________________________________________ +// XNameAccess +//____________________________________________________________________________________________________ + +//----------------------------------------------- +uno::Any SAL_CALL FSStorage::getByName( const ::rtl::OUString& aName ) + throw ( container::NoSuchElementException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + if ( !GetContent() ) + throw io::IOException(); // TODO: error handling + + if ( !aName.getLength() ) + throw lang::IllegalArgumentException(); + + INetURLObject aURL( m_pImpl->m_aURL ); + aURL.Append( aName ); + + uno::Any aResult; + try + { + if ( ::utl::UCBContentHelper::IsFolder( aURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) + { + aResult <<= openStorageElement( aName, embed::ElementModes::READ ); + } + else if ( ::utl::UCBContentHelper::IsDocument( aURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) + { + aResult <<= openStreamElement( aName, embed::ElementModes::READ ); + } + else + throw container::NoSuchElementException(); // TODO: + } + catch( container::NoSuchElementException& ) + { + throw; + } + catch( lang::WrappedTargetException& ) + { + throw; + } + catch( uno::RuntimeException& ) + { + throw; + } + catch ( uno::Exception& ) + { + uno::Any aCaught( ::cppu::getCaughtException() ); + throw lang::WrappedTargetException( ::rtl::OUString::createFromAscii( "Can not open element!\n" ), + uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), + uno::UNO_QUERY ), + aCaught ); + } + + return aResult; +} + + +//----------------------------------------------- +uno::Sequence< ::rtl::OUString > SAL_CALL FSStorage::getElementNames() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + if ( !GetContent() ) + throw io::IOException(); // TODO: error handling + + uno::Sequence< ::rtl::OUString > aProps( 1 ); + ::rtl::OUString* pProps = aProps.getArray(); + pProps[0] = ::rtl::OUString::createFromAscii( "Title" ); + ::ucbhelper::ResultSetInclude eInclude = ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS; + + uno::Sequence< ::rtl::OUString > aResult; + sal_Int32 nSize = 0; + + try + { + uno::Reference< sdbc::XResultSet > xResultSet = GetContent()->createCursor( aProps, eInclude ); + uno::Reference< ucb::XContentAccess > xContentAccess( xResultSet, uno::UNO_QUERY ); + uno::Reference< sdbc::XRow > xRow( xResultSet, uno::UNO_QUERY ); + if ( xResultSet.is() ) + { + // go through the list + while ( xResultSet->next() ) + { + ::rtl::OUString aName( xRow->getString( 1 ) ); + aResult.realloc( ++nSize ); + aResult[nSize-1] = aName; + } + } + } + catch( ucb::InteractiveIOException& r ) + { + if ( r.Code == ucb::IOErrorCode_NOT_EXISTING ) + OSL_ENSURE( sal_False, "The folder does not exist!\n" ); + else + { + uno::Any aCaught( ::cppu::getCaughtException() ); + throw lang::WrappedTargetRuntimeException( ::rtl::OUString::createFromAscii( "Can not open storage!\n" ), + uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), + uno::UNO_QUERY ), + aCaught ); + } + } + catch( uno::RuntimeException& ) + { + throw; + } + catch ( uno::Exception& ) + { + uno::Any aCaught( ::cppu::getCaughtException() ); + throw lang::WrappedTargetRuntimeException( ::rtl::OUString::createFromAscii( "Can not open storage!\n" ), + uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), + uno::UNO_QUERY ), + aCaught ); + } + + return aResult; +} + + +//----------------------------------------------- +sal_Bool SAL_CALL FSStorage::hasByName( const ::rtl::OUString& aName ) + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + try + { + if ( !GetContent() ) + throw io::IOException(); // TODO: error handling + + if ( !aName.getLength() ) + throw lang::IllegalArgumentException(); + } + catch( uno::RuntimeException& ) + { + throw; + } + catch ( uno::Exception& ) + { + uno::Any aCaught( ::cppu::getCaughtException() ); + throw lang::WrappedTargetRuntimeException( ::rtl::OUString::createFromAscii( "Can not open storage!\n" ), + uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), + uno::UNO_QUERY ), + aCaught ); + } + + INetURLObject aURL( m_pImpl->m_aURL ); + aURL.Append( aName ); + + return ( ::utl::UCBContentHelper::IsFolder( aURL.GetMainURL( INetURLObject::NO_DECODE ) ) + || ::utl::UCBContentHelper::IsDocument( aURL.GetMainURL( INetURLObject::NO_DECODE ) ) ); +} + +//----------------------------------------------- +uno::Type SAL_CALL FSStorage::getElementType() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + // it is a multitype container + return uno::Type(); +} + +//----------------------------------------------- +sal_Bool SAL_CALL FSStorage::hasElements() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + if ( !GetContent() ) + throw io::IOException(); // TODO: error handling + + uno::Sequence< ::rtl::OUString > aProps( 1 ); + aProps[0] = ::rtl::OUString::createFromAscii( "TargetURL" ); + ::ucbhelper::ResultSetInclude eInclude = ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS; + + try + { + uno::Reference< sdbc::XResultSet > xResultSet = GetContent()->createCursor( aProps, eInclude ); + return ( xResultSet.is() && xResultSet->next() ); + } + catch( uno::Exception& ) + { + throw uno::RuntimeException(); + } +} + + +//____________________________________________________________________________________________________ +// XDisposable +//____________________________________________________________________________________________________ + +//----------------------------------------------- +void SAL_CALL FSStorage::dispose() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + if ( m_pImpl->m_pListenersContainer ) + { + lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >(this) ); + m_pImpl->m_pListenersContainer->disposeAndClear( aSource ); + } + + delete m_pImpl; + m_pImpl = NULL; +} + +//----------------------------------------------- +void SAL_CALL FSStorage::addEventListener( + const uno::Reference< lang::XEventListener >& xListener ) + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + if ( !m_pImpl->m_pListenersContainer ) + m_pImpl->m_pListenersContainer = new ::cppu::OInterfaceContainerHelper( m_aMutex ); + + m_pImpl->m_pListenersContainer->addInterface( xListener ); +} + +//----------------------------------------------- +void SAL_CALL FSStorage::removeEventListener( + const uno::Reference< lang::XEventListener >& xListener ) + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + if ( m_pImpl->m_pListenersContainer ) + m_pImpl->m_pListenersContainer->removeInterface( xListener ); +} + +//____________________________________________________________________________________________________ +// XPropertySet +//____________________________________________________________________________________________________ + +//----------------------------------------------- +uno::Reference< beans::XPropertySetInfo > SAL_CALL FSStorage::getPropertySetInfo() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + //TODO: + return uno::Reference< beans::XPropertySetInfo >(); +} + + +//----------------------------------------------- +void SAL_CALL FSStorage::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& ) + throw ( beans::UnknownPropertyException, + beans::PropertyVetoException, + lang::IllegalArgumentException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + if ( aPropertyName.equalsAscii( "URL" ) || aPropertyName.equalsAscii( "OpenMode" ) ) + throw beans::PropertyVetoException(); // TODO + else + throw beans::UnknownPropertyException(); // TODO +} + + +//----------------------------------------------- +uno::Any SAL_CALL FSStorage::getPropertyValue( const ::rtl::OUString& aPropertyName ) + throw ( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + if ( aPropertyName.equalsAscii( "URL" ) ) + return uno::makeAny( m_pImpl->m_aURL ); + else if ( aPropertyName.equalsAscii( "OpenMode" ) ) + return uno::makeAny( m_pImpl->m_nMode ); + + throw beans::UnknownPropertyException(); // TODO +} + + +//----------------------------------------------- +void SAL_CALL FSStorage::addPropertyChangeListener( + const ::rtl::OUString& /*aPropertyName*/, + const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ ) + throw ( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + //TODO: +} + + +//----------------------------------------------- +void SAL_CALL FSStorage::removePropertyChangeListener( + const ::rtl::OUString& /*aPropertyName*/, + const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ ) + throw ( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + //TODO: +} + + +//----------------------------------------------- +void SAL_CALL FSStorage::addVetoableChangeListener( + const ::rtl::OUString& /*PropertyName*/, + const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ ) + throw ( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + //TODO: +} + + +//----------------------------------------------- +void SAL_CALL FSStorage::removeVetoableChangeListener( + const ::rtl::OUString& /*PropertyName*/, + const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ ) + throw ( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + //TODO: +} + +//____________________________________________________________________________________________________ +// XHierarchicalStorageAccess +//____________________________________________________________________________________________________ +//----------------------------------------------- +uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openStreamElementByHierarchicalName( const ::rtl::OUString& sStreamPath, ::sal_Int32 nOpenMode ) + throw ( embed::InvalidStorageException, + lang::IllegalArgumentException, + packages::WrongPasswordException, + io::IOException, + embed::StorageWrappedTargetException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + if ( sStreamPath.toChar() == '/' ) + throw lang::IllegalArgumentException(); + + if ( !GetContent() ) + throw io::IOException(); // TODO: error handling + + INetURLObject aBaseURL( m_pImpl->m_aURL ); + if ( !aBaseURL.setFinalSlash() ) + throw uno::RuntimeException(); + + INetURLObject aFileURL = INetURLObject::GetAbsURL( + aBaseURL.GetMainURL( INetURLObject::NO_DECODE ), + sStreamPath ); + + if ( ::utl::UCBContentHelper::IsFolder( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) + throw io::IOException(); + + if ( ( nOpenMode & embed::ElementModes::NOCREATE ) + && !::utl::UCBContentHelper::IsDocument( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) + throw io::IOException(); // TODO: + + uno::Reference< ucb::XCommandEnvironment > xDummyEnv; // TODO: provide InteractionHandler if any + uno::Reference< io::XStream > xResult; + try + { + if ( nOpenMode & embed::ElementModes::WRITE ) + { + if ( isLocalFile_Impl( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) + { + uno::Reference< ucb::XSimpleFileAccess > xSimpleFileAccess( + m_pImpl->m_xFactory->createInstance( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) ) ), + uno::UNO_QUERY_THROW ); + uno::Reference< io::XStream > xStream = + xSimpleFileAccess->openFileReadWrite( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ); + + xResult = static_cast< io::XStream* >( new OFSStreamContainer( xStream ) ); + } + else + { + // TODO: test whether it really works for http and fwp + SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( aFileURL.GetMainURL( INetURLObject::NO_DECODE ), + STREAM_STD_WRITE ); + if ( pStream ) + { + if ( !pStream->GetError() ) + { + uno::Reference< io::XStream > xStream = + uno::Reference < io::XStream >( new ::utl::OStreamWrapper( *pStream ) ); + xResult = static_cast< io::XStream* >( new OFSStreamContainer( xStream ) ); + } + else + delete pStream; + } + } + + if ( !xResult.is() ) + throw io::IOException(); + + if ( ( nOpenMode & embed::ElementModes::TRUNCATE ) ) + { + uno::Reference< io::XTruncate > xTrunc( xResult->getOutputStream(), uno::UNO_QUERY_THROW ); + xTrunc->truncate(); + } + } + else + { + if ( ( nOpenMode & embed::ElementModes::TRUNCATE ) + || !::utl::UCBContentHelper::IsDocument( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) + throw io::IOException(); // TODO: access denied + + ::ucbhelper::Content aResultContent( aFileURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv ); + uno::Reference< io::XInputStream > xInStream = aResultContent.openStream(); + xResult = static_cast< io::XStream* >( new OFSInputStreamContainer( xInStream ) ); + } + } + catch( embed::InvalidStorageException& ) + { + throw; + } + catch( lang::IllegalArgumentException& ) + { + throw; + } + catch( packages::WrongPasswordException& ) + { + throw; + } + catch( embed::StorageWrappedTargetException& ) + { + throw; + } + catch( io::IOException& ) + { + throw; + } + catch( uno::RuntimeException& ) + { + throw; + } + catch( uno::Exception& ) + { + uno::Any aCaught( ::cppu::getCaughtException() ); + throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy raw stream" ), + uno::Reference< io::XInputStream >(), + aCaught ); + } + + return uno::Reference< embed::XExtendedStorageStream >( xResult, uno::UNO_QUERY_THROW ); +} + +//----------------------------------------------- +uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openEncryptedStreamElementByHierarchicalName( const ::rtl::OUString& /*sStreamName*/, ::sal_Int32 /*nOpenMode*/, const ::rtl::OUString& /*sPassword*/ ) + throw ( embed::InvalidStorageException, + lang::IllegalArgumentException, + packages::NoEncryptionException, + packages::WrongPasswordException, + io::IOException, + embed::StorageWrappedTargetException, + uno::RuntimeException ) +{ + throw packages::NoEncryptionException(); +} + +//----------------------------------------------- +void SAL_CALL FSStorage::removeStreamElementByHierarchicalName( const ::rtl::OUString& sStreamPath ) + throw ( embed::InvalidStorageException, + lang::IllegalArgumentException, + container::NoSuchElementException, + io::IOException, + embed::StorageWrappedTargetException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pImpl ) + throw lang::DisposedException(); + + if ( !GetContent() ) + throw io::IOException(); // TODO: error handling + + // TODO/LATER: may need possibility to create folder if it was removed, since the folder can not be locked + INetURLObject aBaseURL( m_pImpl->m_aURL ); + if ( !aBaseURL.setFinalSlash() ) + throw uno::RuntimeException(); + + INetURLObject aFileURL = INetURLObject::GetAbsURL( + aBaseURL.GetMainURL( INetURLObject::NO_DECODE ), + sStreamPath ); + + if ( !::utl::UCBContentHelper::IsDocument( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) + { + if ( ::utl::UCBContentHelper::IsFolder( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) + throw lang::IllegalArgumentException(); + else + throw container::NoSuchElementException(); // TODO: + } + + if ( !::utl::UCBContentHelper::Kill( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) + throw io::IOException(); // TODO: error handling +} + + diff --git a/svl/source/fsstor/fsstorage.hxx b/svl/source/fsstor/fsstorage.hxx new file mode 100644 index 000000000000..670a6917dd40 --- /dev/null +++ b/svl/source/fsstor/fsstorage.hxx @@ -0,0 +1,340 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: fsstorage.hxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __XSTORAGE_HXX_ +#define __XSTORAGE_HXX_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +struct FSStorage_Impl; +class FSStorage : public ::com::sun::star::lang::XTypeProvider + , public ::com::sun::star::embed::XStorage + , public ::com::sun::star::embed::XHierarchicalStorageAccess + , public ::com::sun::star::beans::XPropertySet + , public ::cppu::OWeakObject +{ + ::osl::Mutex m_aMutex; + FSStorage_Impl* m_pImpl; + +protected: + +public: + + FSStorage( const ::ucbhelper::Content& aContent, + sal_Int32 nMode, + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > xProperties, + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory ); + + virtual ~FSStorage(); + + ::ucbhelper::Content* GetContent(); + + void CopyStreamToSubStream( const ::rtl::OUString& aSourceURL, + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest, + const ::rtl::OUString& aNewEntryName ); + + void CopyContentToStorage_Impl( ::ucbhelper::Content* pContent, + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest ); + + static sal_Bool MakeFolderNoUI( const String& rFolder, sal_Bool bNewOnly ); + + //____________________________________________________________________________________________________ + // XInterface + //____________________________________________________________________________________________________ + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL acquire() throw(); + + virtual void SAL_CALL release() throw(); + + //____________________________________________________________________________________________________ + // XTypeProvider + //____________________________________________________________________________________________________ + + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw( ::com::sun::star::uno::RuntimeException ); + + //____________________________________________________________________________________________________ + // XStorage + //____________________________________________________________________________________________________ + + virtual void SAL_CALL copyToStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest ) + throw ( ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::io::IOException, + ::com::sun::star::embed::StorageWrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL openStreamElement( + const ::rtl::OUString& aStreamName, sal_Int32 nOpenMode ) + throw ( ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::packages::WrongPasswordException, + ::com::sun::star::io::IOException, + ::com::sun::star::embed::StorageWrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL openEncryptedStreamElement( + const ::rtl::OUString& aStreamName, sal_Int32 nOpenMode, const ::rtl::OUString& aPass ) + throw ( ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::packages::NoEncryptionException, + ::com::sun::star::packages::WrongPasswordException, + ::com::sun::star::io::IOException, + ::com::sun::star::embed::StorageWrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > SAL_CALL openStorageElement( + const ::rtl::OUString& aStorName, sal_Int32 nStorageMode ) + throw ( ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::io::IOException, + ::com::sun::star::embed::StorageWrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL cloneStreamElement( + const ::rtl::OUString& aStreamName ) + throw ( ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::packages::WrongPasswordException, + ::com::sun::star::io::IOException, + ::com::sun::star::embed::StorageWrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL cloneEncryptedStreamElement( + const ::rtl::OUString& aStreamName, const ::rtl::OUString& aPass ) + throw ( ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::packages::NoEncryptionException, + ::com::sun::star::packages::WrongPasswordException, + ::com::sun::star::io::IOException, + ::com::sun::star::embed::StorageWrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL copyLastCommitTo( + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xTargetStorage ) + throw ( ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::io::IOException, + ::com::sun::star::embed::StorageWrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL copyStorageElementLastCommitTo( + const ::rtl::OUString& aStorName, + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xTargetStorage ) + throw ( ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::io::IOException, + ::com::sun::star::embed::StorageWrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL isStreamElement( const ::rtl::OUString& aElementName ) + throw ( ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL isStorageElement( const ::rtl::OUString& aElementName ) + throw ( ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL removeElement( const ::rtl::OUString& aElementName ) + throw ( ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::io::IOException, + ::com::sun::star::embed::StorageWrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL renameElement( const ::rtl::OUString& rEleName, const ::rtl::OUString& rNewName ) + throw ( ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::container::ElementExistException, + ::com::sun::star::io::IOException, + ::com::sun::star::embed::StorageWrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL copyElementTo( const ::rtl::OUString& aElementName, + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest, + const ::rtl::OUString& aNewName ) + throw ( ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::container::ElementExistException, + ::com::sun::star::io::IOException, + ::com::sun::star::embed::StorageWrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL moveElementTo( const ::rtl::OUString& aElementName, + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest, + const ::rtl::OUString& rNewName ) + throw ( ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::container::ElementExistException, + ::com::sun::star::io::IOException, + ::com::sun::star::embed::StorageWrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + //____________________________________________________________________________________________________ + // XNameAccess + //____________________________________________________________________________________________________ + + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw ( ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw ( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw ( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw ( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL hasElements() + throw ( ::com::sun::star::uno::RuntimeException ); + + //____________________________________________________________________________________________________ + // XComponent + //____________________________________________________________________________________________________ + + virtual void SAL_CALL dispose() + throw ( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL addEventListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) + throw ( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL removeEventListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) + throw ( ::com::sun::star::uno::RuntimeException ); + + //____________________________________________________________________________________________________ + // XPropertySet + //____________________________________________________________________________________________________ + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() + throw ( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) + throw ( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) + throw ( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL addPropertyChangeListener( + const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw ( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL removePropertyChangeListener( + const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw ( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL addVetoableChangeListener( + const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw ( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw ( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + //____________________________________________________________________________________________________ + // XHierarchicalStorageAccess + //____________________________________________________________________________________________________ + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XExtendedStorageStream > SAL_CALL openStreamElementByHierarchicalName( const ::rtl::OUString& sStreamPath, ::sal_Int32 nOpenMode ) + throw ( ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::packages::WrongPasswordException, + ::com::sun::star::io::IOException, + ::com::sun::star::embed::StorageWrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XExtendedStorageStream > SAL_CALL openEncryptedStreamElementByHierarchicalName( const ::rtl::OUString& sStreamName, ::sal_Int32 nOpenMode, const ::rtl::OUString& sPassword ) + throw ( ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::packages::NoEncryptionException, + ::com::sun::star::packages::WrongPasswordException, + ::com::sun::star::io::IOException, + ::com::sun::star::embed::StorageWrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL removeStreamElementByHierarchicalName( const ::rtl::OUString& sElementPath ) + throw ( ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::io::IOException, + ::com::sun::star::embed::StorageWrappedTargetException, + ::com::sun::star::uno::RuntimeException ); +}; + +#endif + diff --git a/svl/source/fsstor/makefile.mk b/svl/source/fsstor/makefile.mk new file mode 100644 index 000000000000..f55f6747f9e1 --- /dev/null +++ b/svl/source/fsstor/makefile.mk @@ -0,0 +1,70 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.6 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. +PRJNAME=svtools +TARGET=fsstorage.uno +LIBTARGET=NO +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ---------------------------------- + +.INCLUDE : settings.mk +DLLPRE= + +# --- Files ------------------------------------- + +SLOFILES=\ + $(SLO)$/fsfactory.obj \ + $(SLO)$/fsstorage.obj \ + $(SLO)$/oinputstreamcontainer.obj \ + $(SLO)$/ostreamcontainer.obj + +SHL1TARGET= $(TARGET) +SHL1IMPLIB= i$(TARGET) +SHL1OBJS= $(SLOFILES) +SHL1STDLIBS=\ + $(UNOTOOLSLIB) \ + $(TOOLSLIB) \ + $(COMPHELPERLIB) \ + $(UCBHELPERLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(SALLIB) + +SHL1VERSIONMAP=exports.map +SHL1DEF= $(MISC)$/$(SHL1TARGET).def +DEF1NAME= $(SHL1TARGET) + +# --- Targets ---------------------------------- + +.INCLUDE : target.mk + diff --git a/svl/source/fsstor/oinputstreamcontainer.cxx b/svl/source/fsstor/oinputstreamcontainer.cxx new file mode 100644 index 000000000000..dc08a7a34602 --- /dev/null +++ b/svl/source/fsstor/oinputstreamcontainer.cxx @@ -0,0 +1,350 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: oinputstreamcontainer.cxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include "oinputstreamcontainer.hxx" +#include + +using namespace ::com::sun::star; + +//----------------------------------------------- +OFSInputStreamContainer::OFSInputStreamContainer( const uno::Reference< io::XInputStream >& xStream ) +: m_xInputStream( xStream ) +, m_xSeekable( xStream, uno::UNO_QUERY ) +, m_bSeekable( sal_False ) +, m_bDisposed( sal_False ) +, m_pListenersContainer( NULL ) +{ + m_bSeekable = m_xSeekable.is(); +} + +//----------------------------------------------- +OFSInputStreamContainer::~OFSInputStreamContainer() +{ + if ( m_pListenersContainer ) + { + delete m_pListenersContainer; + m_pListenersContainer = NULL; + } +} + +//----------------------------------------------- +uno::Sequence< uno::Type > SAL_CALL OFSInputStreamContainer::getTypes() + throw ( uno::RuntimeException ) +{ + static ::cppu::OTypeCollection* pTypeCollection = NULL ; + + if ( pTypeCollection == NULL ) + { + ::osl::MutexGuard aGuard( m_aMutex ) ; + + if ( pTypeCollection == NULL ) + { + if ( m_bSeekable ) + { + static ::cppu::OTypeCollection aTypeCollection( + ::getCppuType(( const uno::Reference< io::XStream >* )NULL ), + ::getCppuType(( const uno::Reference< io::XInputStream >* )NULL ), + ::getCppuType(( const uno::Reference< io::XSeekable >* )NULL ) ); + + pTypeCollection = &aTypeCollection ; + } + else + { + static ::cppu::OTypeCollection aTypeCollection( + ::getCppuType(( const uno::Reference< io::XStream >* )NULL ), + ::getCppuType(( const uno::Reference< io::XInputStream >* )NULL ) ); + + pTypeCollection = &aTypeCollection ; + } + } + } + + return pTypeCollection->getTypes() ; + +} + +//----------------------------------------------- +uno::Any SAL_CALL OFSInputStreamContainer::queryInterface( const uno::Type& rType ) + throw( uno::RuntimeException ) +{ + // Attention: + // Don't use mutex or guard in this method!!! Is a method of XInterface. + + uno::Any aReturn; + if ( m_bSeekable ) + aReturn = uno::Any( ::cppu::queryInterface( rType, + static_cast< io::XStream* >( this ), + static_cast< io::XInputStream* >( this ), + static_cast< io::XSeekable* >( this ) ) ); + else + aReturn = uno::Any( ::cppu::queryInterface( rType, + static_cast< io::XStream* >( this ), + static_cast< io::XInputStream* >( this ) ) ); + + if ( aReturn.hasValue() == sal_True ) + return aReturn ; + + return ::cppu::OWeakObject::queryInterface( rType ) ; +} + +//----------------------------------------------- +void SAL_CALL OFSInputStreamContainer::acquire() + throw() +{ + ::cppu::OWeakObject::acquire(); +} + +//----------------------------------------------- +void SAL_CALL OFSInputStreamContainer::release() + throw() +{ + ::cppu::OWeakObject::release(); +} + +//----------------------------------------------- +sal_Int32 SAL_CALL OFSInputStreamContainer::readBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) + throw ( io::NotConnectedException, + io::BufferSizeExceededException, + io::IOException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xInputStream.is() ) + throw uno::RuntimeException(); + + return m_xInputStream->readBytes( aData, nBytesToRead ); +} + +//----------------------------------------------- +sal_Int32 SAL_CALL OFSInputStreamContainer::readSomeBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) + throw ( io::NotConnectedException, + io::BufferSizeExceededException, + io::IOException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xInputStream.is() ) + throw uno::RuntimeException(); + + return m_xInputStream->readSomeBytes( aData, nMaxBytesToRead ); +} + +//----------------------------------------------- +void SAL_CALL OFSInputStreamContainer::skipBytes( sal_Int32 nBytesToSkip ) + throw ( io::NotConnectedException, + io::BufferSizeExceededException, + io::IOException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xInputStream.is() ) + throw uno::RuntimeException(); + + m_xInputStream->skipBytes( nBytesToSkip ); +} + +//----------------------------------------------- +sal_Int32 SAL_CALL OFSInputStreamContainer::available( ) + throw ( io::NotConnectedException, + io::IOException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xInputStream.is() ) + throw uno::RuntimeException(); + + return m_xInputStream->available(); +} + +//----------------------------------------------- +void SAL_CALL OFSInputStreamContainer::closeInput( ) + throw ( io::NotConnectedException, + io::IOException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xInputStream.is() ) + throw uno::RuntimeException(); + + dispose(); +} + +//----------------------------------------------- +uno::Reference< io::XInputStream > SAL_CALL OFSInputStreamContainer::getInputStream() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xInputStream.is() ) + return uno::Reference< io::XInputStream >(); + + return uno::Reference< io::XInputStream >( static_cast< io::XInputStream* >( this ), uno::UNO_QUERY ); +} + +//----------------------------------------------- +uno::Reference< io::XOutputStream > SAL_CALL OFSInputStreamContainer::getOutputStream() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + return uno::Reference< io::XOutputStream >(); +} + +//----------------------------------------------- +void SAL_CALL OFSInputStreamContainer::seek( sal_Int64 location ) + throw ( lang::IllegalArgumentException, + io::IOException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xSeekable.is() ) + throw uno::RuntimeException(); + + m_xSeekable->seek( location ); +} + +//----------------------------------------------- +sal_Int64 SAL_CALL OFSInputStreamContainer::getPosition() + throw ( io::IOException, + uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xSeekable.is() ) + throw uno::RuntimeException(); + + return m_xSeekable->getPosition(); +} + +//----------------------------------------------- +sal_Int64 SAL_CALL OFSInputStreamContainer::getLength() + throw ( io::IOException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xSeekable.is() ) + throw uno::RuntimeException(); + + return m_xSeekable->getLength(); +} + +//----------------------------------------------- +void SAL_CALL OFSInputStreamContainer::dispose( ) + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xInputStream.is() ) + throw uno::RuntimeException(); + + m_xInputStream->closeInput(); + + if ( m_pListenersContainer ) + { + lang::EventObject aSource( static_cast< ::cppu::OWeakObject*>( this ) ); + m_pListenersContainer->disposeAndClear( aSource ); + } + + m_bDisposed = sal_True; +} + +//----------------------------------------------- +void SAL_CALL OFSInputStreamContainer::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_pListenersContainer ) + m_pListenersContainer = new ::cppu::OInterfaceContainerHelper( m_aMutex ); + + m_pListenersContainer->addInterface( xListener ); +} + +//----------------------------------------------- +void SAL_CALL OFSInputStreamContainer::removeEventListener( const uno::Reference< lang::XEventListener >& xListener ) + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( m_pListenersContainer ) + m_pListenersContainer->removeInterface( xListener ); +} + + + diff --git a/svl/source/fsstor/oinputstreamcontainer.hxx b/svl/source/fsstor/oinputstreamcontainer.hxx new file mode 100644 index 000000000000..308f4283b430 --- /dev/null +++ b/svl/source/fsstor/oinputstreamcontainer.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: oinputstreamcontainer.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _OINPUTSTREAMCONTAINER_HXX_ +#define _OINPUTSTREAMCONTAINER_HXX_ + +#include +#include +#include + + +#include +#include + +#include + +class OFSInputStreamContainer : public cppu::WeakImplHelper2 < ::com::sun::star::io::XInputStream + ,::com::sun::star::embed::XExtendedStorageStream > + , public ::com::sun::star::io::XSeekable +{ +protected: + ::osl::Mutex m_aMutex; + + ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream > m_xInputStream; + ::com::sun::star::uno::Reference < ::com::sun::star::io::XSeekable > m_xSeekable; + + sal_Bool m_bSeekable; + + sal_Bool m_bDisposed; + + ::cppu::OInterfaceContainerHelper* m_pListenersContainer; // list of listeners + +public: + OFSInputStreamContainer( const ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream >& xStream ); + + virtual ~OFSInputStreamContainer(); + + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XInputStream + virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) + throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) + throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) + throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL available( ) + throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL closeInput( ) + throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + + //XStream + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > SAL_CALL getOutputStream( ) throw (::com::sun::star::uno::RuntimeException); + + //XSeekable + virtual void SAL_CALL seek( sal_Int64 location ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL getPosition() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL getLength() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + + //XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + +}; + +#endif + diff --git a/svl/source/fsstor/ostreamcontainer.cxx b/svl/source/fsstor/ostreamcontainer.cxx new file mode 100644 index 000000000000..d801f49532b2 --- /dev/null +++ b/svl/source/fsstor/ostreamcontainer.cxx @@ -0,0 +1,570 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ostreamcontainer.cxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include "ostreamcontainer.hxx" + + +using namespace ::com::sun::star; + +//----------------------------------------------- +OFSStreamContainer::OFSStreamContainer( const uno::Reference < io::XStream >& xStream ) +: m_bDisposed( sal_False ) +, m_bInputClosed( sal_False ) +, m_bOutputClosed( sal_False ) +, m_pListenersContainer( NULL ) +, m_pTypeCollection( NULL ) +{ + try + { + m_xStream = xStream; + if ( !m_xStream.is() ) + throw uno::RuntimeException(); + + m_xSeekable = uno::Reference< io::XSeekable >( xStream, uno::UNO_QUERY ); + m_xInputStream = xStream->getInputStream(); + m_xOutputStream = xStream->getOutputStream(); + m_xTruncate = uno::Reference< io::XTruncate >( m_xOutputStream, uno::UNO_QUERY ); + m_xAsyncOutputMonitor = uno::Reference< io::XAsyncOutputMonitor >( m_xOutputStream, uno::UNO_QUERY ); + } + catch( uno::Exception& ) + { + m_xStream = uno::Reference< io::XStream >(); + m_xSeekable = uno::Reference< io::XSeekable >(); + m_xInputStream = uno::Reference< io::XInputStream >(); + m_xOutputStream = uno::Reference< io::XOutputStream >(); + m_xTruncate = uno::Reference< io::XTruncate >(); + m_xAsyncOutputMonitor = uno::Reference< io::XAsyncOutputMonitor >(); + } +} + +//----------------------------------------------- +OFSStreamContainer::~OFSStreamContainer() +{ + if ( m_pListenersContainer ) + { + delete m_pListenersContainer; + m_pListenersContainer = NULL; + } +} + +// XInterface +//----------------------------------------------- +uno::Any SAL_CALL OFSStreamContainer::queryInterface( const uno::Type& rType ) + throw( uno::RuntimeException ) +{ + uno::Any aReturn; + + aReturn <<= ::cppu::queryInterface + ( rType + , static_cast ( this ) + , static_cast ( this ) + , static_cast ( this ) + , static_cast ( this ) ); + + if ( aReturn.hasValue() == sal_True ) + return aReturn ; + + if ( m_xSeekable.is() ) + { + aReturn <<= ::cppu::queryInterface + ( rType + , static_cast ( this ) ); + + if ( aReturn.hasValue() == sal_True ) + return aReturn ; + } + + if ( m_xInputStream.is() ) + { + aReturn <<= ::cppu::queryInterface + ( rType + , static_cast ( this ) ); + + if ( aReturn.hasValue() == sal_True ) + return aReturn ; + } + if ( m_xOutputStream.is() ) + { + aReturn <<= ::cppu::queryInterface + ( rType + , static_cast ( this ) ); + + if ( aReturn.hasValue() == sal_True ) + return aReturn ; + } + if ( m_xTruncate.is() ) + { + aReturn <<= ::cppu::queryInterface + ( rType + , static_cast ( this ) ); + + if ( aReturn.hasValue() == sal_True ) + return aReturn ; + } + if ( m_xAsyncOutputMonitor.is() ) + { + aReturn <<= ::cppu::queryInterface + ( rType + , static_cast ( this ) ); + + if ( aReturn.hasValue() == sal_True ) + return aReturn ; + } + + return OWeakObject::queryInterface( rType ); +} + +//----------------------------------------------- +void SAL_CALL OFSStreamContainer::acquire() + throw() +{ + OWeakObject::acquire(); +} + +//----------------------------------------------- +void SAL_CALL OFSStreamContainer::release() + throw() +{ + OWeakObject::release(); +} + +// XTypeProvider +//----------------------------------------------- +uno::Sequence< uno::Type > SAL_CALL OFSStreamContainer::getTypes() + throw( uno::RuntimeException ) +{ + if ( m_pTypeCollection == NULL ) + { + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_pTypeCollection == NULL ) + { + ::cppu::OTypeCollection aTypeCollection + ( ::getCppuType( ( const uno::Reference< lang::XTypeProvider >* )NULL ) + , ::getCppuType( ( const uno::Reference< embed::XExtendedStorageStream >* )NULL ) ); + + if ( m_xSeekable.is() ) + aTypeCollection = ::cppu::OTypeCollection + ( ::getCppuType( ( const uno::Reference< io::XSeekable >* )NULL ), + aTypeCollection.getTypes() ); + if ( m_xInputStream.is() ) + aTypeCollection = ::cppu::OTypeCollection + ( ::getCppuType( ( const uno::Reference< io::XInputStream >* )NULL ), + aTypeCollection.getTypes() ); + + if ( m_xOutputStream.is() ) + aTypeCollection = ::cppu::OTypeCollection + ( ::getCppuType( ( const uno::Reference< io::XOutputStream >* )NULL ), + aTypeCollection.getTypes() ); + if ( m_xTruncate.is() ) + aTypeCollection = ::cppu::OTypeCollection + ( ::getCppuType( ( const uno::Reference< io::XTruncate >* )NULL ), + aTypeCollection.getTypes() ); + if ( m_xAsyncOutputMonitor.is() ) + aTypeCollection = ::cppu::OTypeCollection + ( ::getCppuType( ( const uno::Reference< io::XAsyncOutputMonitor >* )NULL ), + aTypeCollection.getTypes() ); + + m_pTypeCollection = new ::cppu::OTypeCollection( aTypeCollection ); + } + } + return m_pTypeCollection->getTypes() ; +} + +//----------------------------------------------- +uno::Sequence< sal_Int8 > SAL_CALL OFSStreamContainer::getImplementationId() + throw( uno::RuntimeException ) +{ + static ::cppu::OImplementationId* pID = NULL ; + + if ( pID == NULL ) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ) ; + + if ( pID == NULL ) + { + static ::cppu::OImplementationId aID( sal_False ) ; + pID = &aID ; + } + } + + return pID->getImplementationId() ; +} + +// XStream +//----------------------------------------------- +uno::Reference< io::XInputStream > SAL_CALL OFSStreamContainer::getInputStream() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xStream.is() ) + throw uno::RuntimeException(); + + if ( m_xInputStream.is() ) + return uno::Reference< io::XInputStream >( static_cast< io::XInputStream* >( this ) ); + + return uno::Reference< io::XInputStream >(); +} + +//----------------------------------------------- +uno::Reference< io::XOutputStream > SAL_CALL OFSStreamContainer::getOutputStream() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xStream.is() ) + throw uno::RuntimeException(); + + if ( m_xOutputStream.is() ) + return uno::Reference< io::XOutputStream >( static_cast< io::XOutputStream* >( this ) ); + + return uno::Reference< io::XOutputStream >(); +} + +// XComponent +//----------------------------------------------- +void SAL_CALL OFSStreamContainer::dispose() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xStream.is() ) + throw uno::RuntimeException(); + + if ( m_xInputStream.is() && !m_bInputClosed ) + { + m_xInputStream->closeInput(); + m_bInputClosed = sal_True; + } + + if ( m_xOutputStream.is() && !m_bOutputClosed ) + { + m_xOutputStream->closeOutput(); + m_bOutputClosed = sal_True; + } + + if ( m_pListenersContainer ) + { + lang::EventObject aSource( static_cast< ::cppu::OWeakObject*>( this ) ); + m_pListenersContainer->disposeAndClear( aSource ); + } + + m_bDisposed = sal_True; +} + +//----------------------------------------------- +void SAL_CALL OFSStreamContainer::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_pListenersContainer ) + m_pListenersContainer = new ::cppu::OInterfaceContainerHelper( m_aMutex ); + + m_pListenersContainer->addInterface( xListener ); +} + +//----------------------------------------------- +void SAL_CALL OFSStreamContainer::removeEventListener( const uno::Reference< lang::XEventListener >& xListener ) + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( m_pListenersContainer ) + m_pListenersContainer->removeInterface( xListener ); +} + + +// XSeekable +//----------------------------------------------- +void SAL_CALL OFSStreamContainer::seek( sal_Int64 location ) + throw ( lang::IllegalArgumentException, + io::IOException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xStream.is() || !m_xSeekable.is() ) + throw uno::RuntimeException(); + + m_xSeekable->seek( location ); +} + +//----------------------------------------------- +sal_Int64 SAL_CALL OFSStreamContainer::getPosition() + throw ( io::IOException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xStream.is() || !m_xSeekable.is() ) + throw uno::RuntimeException(); + + return m_xSeekable->getPosition(); +} + +//----------------------------------------------- +sal_Int64 SAL_CALL OFSStreamContainer::getLength() + throw ( io::IOException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xStream.is() || !m_xSeekable.is() ) + throw uno::RuntimeException(); + + return m_xSeekable->getLength(); +} + + +// XInputStream +//----------------------------------------------- +sal_Int32 SAL_CALL OFSStreamContainer::readBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) + throw( io::NotConnectedException, + io::BufferSizeExceededException, + io::IOException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xStream.is() || !m_xInputStream.is() ) + throw uno::RuntimeException(); + + return m_xInputStream->readBytes( aData, nBytesToRead ); +} + +//----------------------------------------------- +sal_Int32 SAL_CALL OFSStreamContainer::readSomeBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) + throw( io::NotConnectedException, + io::BufferSizeExceededException, + io::IOException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xStream.is() || !m_xInputStream.is() ) + throw uno::RuntimeException(); + + return m_xInputStream->readSomeBytes( aData, nMaxBytesToRead ); +} + +//----------------------------------------------- +void SAL_CALL OFSStreamContainer::skipBytes( sal_Int32 nBytesToSkip ) + throw( io::NotConnectedException, + io::BufferSizeExceededException, + io::IOException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xStream.is() || !m_xInputStream.is() ) + throw uno::RuntimeException(); + + m_xInputStream->skipBytes( nBytesToSkip ); +} + +//----------------------------------------------- +sal_Int32 SAL_CALL OFSStreamContainer::available() + throw( io::NotConnectedException, + io::IOException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xStream.is() || !m_xInputStream.is() ) + throw uno::RuntimeException(); + + return m_xInputStream->available(); +} + +//----------------------------------------------- +void SAL_CALL OFSStreamContainer::closeInput() + throw( io::NotConnectedException, + io::IOException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xStream.is() || !m_xInputStream.is() ) + throw uno::RuntimeException(); + + if ( m_xInputStream.is() ) + { + m_xInputStream->closeInput(); + m_bInputClosed = sal_True; + } + + if ( m_bOutputClosed ) + dispose(); +} + +// XOutputStream +//----------------------------------------------- +void SAL_CALL OFSStreamContainer::writeBytes( const uno::Sequence< sal_Int8 >& aData ) + throw ( io::NotConnectedException, + io::BufferSizeExceededException, + io::IOException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xStream.is() || !m_xOutputStream.is() ) + throw uno::RuntimeException(); + + return m_xOutputStream->writeBytes( aData ); +} + +//----------------------------------------------- +void SAL_CALL OFSStreamContainer::flush() + throw ( io::NotConnectedException, + io::BufferSizeExceededException, + io::IOException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xStream.is() || !m_xOutputStream.is() ) + throw uno::RuntimeException(); + + return m_xOutputStream->flush(); +} + +//----------------------------------------------- +void SAL_CALL OFSStreamContainer::closeOutput() + throw ( io::NotConnectedException, + io::BufferSizeExceededException, + io::IOException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xStream.is() || !m_xOutputStream.is() ) + throw uno::RuntimeException(); + + if ( m_xOutputStream.is() ) + { + m_xOutputStream->closeOutput(); + m_bOutputClosed = sal_True; + } + + if ( m_bInputClosed ) + dispose(); +} + + +// XTruncate +//----------------------------------------------- +void SAL_CALL OFSStreamContainer::truncate() + throw ( io::IOException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xStream.is() || !m_xTruncate.is() ) + throw uno::RuntimeException(); + + m_xTruncate->truncate(); +} + + +// XAsyncOutputMonitor +//----------------------------------------------- +void SAL_CALL OFSStreamContainer::waitForCompletion() + throw ( io::IOException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( m_bDisposed ) + throw lang::DisposedException(); + + if ( !m_xStream.is() || !m_xAsyncOutputMonitor.is() ) + throw uno::RuntimeException(); + + m_xAsyncOutputMonitor->waitForCompletion(); +} + + + diff --git a/svl/source/fsstor/ostreamcontainer.hxx b/svl/source/fsstor/ostreamcontainer.hxx new file mode 100644 index 000000000000..6198587c3d35 --- /dev/null +++ b/svl/source/fsstor/ostreamcontainer.hxx @@ -0,0 +1,128 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ostreamcontainer.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _OSTREAMCONTAINER_HXX_ +#define _OSTREAMCONTAINER_HXX_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "com/sun/star/io/XAsyncOutputMonitor.hpp" +#include +#include +#include +#include + +class OFSStreamContainer : public cppu::OWeakObject, + public ::com::sun::star::lang::XTypeProvider, + public ::com::sun::star::embed::XExtendedStorageStream, + public ::com::sun::star::io::XSeekable, + public ::com::sun::star::io::XInputStream, + public ::com::sun::star::io::XOutputStream, + public ::com::sun::star::io::XTruncate, + public ::com::sun::star::io::XAsyncOutputMonitor +{ + ::osl::Mutex m_aMutex; + + ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xStream; + ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable > m_xSeekable; + ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xInputStream; + ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > m_xOutputStream; + ::com::sun::star::uno::Reference< ::com::sun::star::io::XTruncate > m_xTruncate; + ::com::sun::star::uno::Reference< ::com::sun::star::io::XAsyncOutputMonitor > m_xAsyncOutputMonitor; + + sal_Bool m_bDisposed; + sal_Bool m_bInputClosed; + sal_Bool m_bOutputClosed; + + ::cppu::OInterfaceContainerHelper* m_pListenersContainer; // list of listeners + ::cppu::OTypeCollection* m_pTypeCollection; + +public: + OFSStreamContainer( const ::com::sun::star::uno::Reference < ::com::sun::star::io::XStream >& xStream ); + virtual ~OFSStreamContainer(); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType ) + throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw( ::com::sun::star::uno::RuntimeException ); + + // XStream + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > SAL_CALL getOutputStream( ) throw (::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + + // XSeekable + virtual void SAL_CALL seek( sal_Int64 location ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL getPosition() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL getLength() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + + // XInputStream + virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) + throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) + throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL available( ) + throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL closeInput( ) + throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + + // XOutputStream + virtual void SAL_CALL writeBytes( const ::com::sun::star::uno::Sequence< sal_Int8 >& aData ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL flush( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL closeOutput( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + + // XTruncate + virtual void SAL_CALL truncate() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + + // XAsyncOutputMonitor + virtual void SAL_CALL waitForCompletion( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + +}; + +#endif + diff --git a/svl/source/inc/fsfactory.hxx b/svl/source/inc/fsfactory.hxx new file mode 100644 index 000000000000..5954ecebabc2 --- /dev/null +++ b/svl/source/inc/fsfactory.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: fsfactory.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FSFACTORY_HXX_ +#define __FSACTORY_HXX_ + +#include +#include +#include + + +class FSStorage; + +class FSStorageFactory : public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XSingleServiceFactory, + ::com::sun::star::lang::XServiceInfo > +{ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; + +public: + FSStorageFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory ) + : m_xFactory( xFactory ) + { + OSL_ENSURE( xFactory.is(), "No service manager is provided!\n" ); + } + + static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + impl_staticGetSupportedServiceNames(); + + static ::rtl::OUString SAL_CALL impl_staticGetImplementationName(); + + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL + impl_staticCreateSelfInstance( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + + + // XSingleServiceFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + +}; + +#endif + diff --git a/svl/source/inc/passwordcontainer.hxx b/svl/source/inc/passwordcontainer.hxx new file mode 100644 index 000000000000..a067672f3cf6 --- /dev/null +++ b/svl/source/inc/passwordcontainer.hxx @@ -0,0 +1,429 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: passwordcontainer.hxx,v $ + * $Revision: 1.11 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_COMPHELPER_PASSWORDCONTAINER_HXX +#define INCLUDED_COMPHELPER_PASSWORDCONTAINER_HXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include "syscreds.hxx" + +#define MEMORY_RECORD 0 +#define PERSISTENT_RECORD 1 + +//---------------------------------------------------------------------------------- + +class NamePassRecord +{ + ::rtl::OUString m_aName; + + // there are two lists of passwords, memory passwords and persistent passwords + sal_Bool m_bHasMemPass; + ::std::vector< ::rtl::OUString > m_aMemPass; + + // persistent passwords are encrypted in one string + sal_Bool m_bHasPersPass; + ::rtl::OUString m_aPersPass; + + void InitArrays( sal_Bool bHasMemoryList, const ::std::vector< ::rtl::OUString >& aMemoryList, + sal_Bool bHasPersistentList, const ::rtl::OUString& aPersistentList ) + { + m_bHasMemPass = bHasMemoryList; + if ( bHasMemoryList ) + m_aMemPass = aMemoryList; + + m_bHasPersPass = bHasPersistentList; + if ( bHasPersistentList ) + m_aPersPass = aPersistentList; + } + +public: + + NamePassRecord( const ::rtl::OUString& aName ) + : m_aName( aName ) + , m_bHasMemPass( sal_False ) + , m_bHasPersPass( sal_False ) + { + } + + NamePassRecord( const ::rtl::OUString& aName, const ::std::vector< ::rtl::OUString >& aMemoryList ) + : m_aName( aName ) + , m_bHasMemPass( sal_True ) + , m_aMemPass( aMemoryList ) + , m_bHasPersPass( sal_False ) + { + } + + NamePassRecord( const ::rtl::OUString& aName, const ::rtl::OUString& aPersistentList ) + : m_aName( aName ) + , m_bHasMemPass( sal_False ) + , m_bHasPersPass( sal_True ) + , m_aPersPass( aPersistentList ) + { + } + + NamePassRecord( const ::rtl::OUString& aName, + sal_Bool bHasMemoryList, const ::std::vector< ::rtl::OUString >& aMemoryList, + sal_Bool bHasPersistentList, const ::rtl::OUString aPersistentList ) + : m_aName( aName ) + , m_bHasMemPass( bHasMemoryList ) + , m_bHasPersPass( bHasPersistentList ) + { + InitArrays( bHasMemoryList, aMemoryList, bHasPersistentList, aPersistentList ); + } + + NamePassRecord( const NamePassRecord& aRecord ) + : m_aName( aRecord.m_aName ) + , m_bHasMemPass( sal_False ) + , m_bHasPersPass( sal_False ) + { + InitArrays( aRecord.m_bHasMemPass, aRecord.m_aMemPass, aRecord.m_bHasPersPass, aRecord.m_aPersPass ); + } + + NamePassRecord& operator=( const NamePassRecord& aRecord ) + { + m_aName = aRecord.m_aName; + + m_aMemPass.clear(); + m_aPersPass = ::rtl::OUString(); + InitArrays( aRecord.m_bHasMemPass, aRecord.m_aMemPass, aRecord.m_bHasPersPass, aRecord.m_aPersPass ); + + return *this; + } + + ::rtl::OUString GetUserName() const + { + return m_aName; + } + + sal_Bool HasPasswords( sal_Int8 nStatus ) const + { + if ( nStatus == MEMORY_RECORD ) + return m_bHasMemPass; + if ( nStatus == PERSISTENT_RECORD ) + return m_bHasPersPass; + + return sal_False; + } + + ::std::vector< ::rtl::OUString > GetMemPasswords() const + { + if ( m_bHasMemPass ) + return m_aMemPass; + + return ::std::vector< ::rtl::OUString >(); + } + + ::rtl::OUString GetPersPasswords() const + { + if ( m_bHasPersPass ) + return m_aPersPass; + + return ::rtl::OUString(); + } + + void SetMemPasswords( const ::std::vector< ::rtl::OUString >& aMemList ) + { + m_aMemPass = aMemList; + m_bHasMemPass = sal_True; + } + + void SetPersPasswords( const ::rtl::OUString& aPersList ) + { + m_aPersPass = aPersList; + m_bHasPersPass = sal_True; + } + + void RemovePasswords( sal_Int8 nStatus ) + { + if ( nStatus == MEMORY_RECORD ) + { + m_bHasMemPass = sal_False; + m_aMemPass.clear(); + } + else if ( nStatus == PERSISTENT_RECORD ) + { + m_bHasPersPass = sal_False; + m_aPersPass = ::rtl::OUString(); + } + } + +}; + +//---------------------------------------------------------------------------------- + +typedef ::std::pair< const ::rtl::OUString, ::std::list< NamePassRecord > > PairUrlRecord; +typedef ::std::map< ::rtl::OUString, ::std::list< NamePassRecord > > PassMap; + +//---------------------------------------------------------------------------------- + +class PasswordContainer; + +class StorageItem : public ::utl::ConfigItem { + PasswordContainer* mainCont; + sal_Bool hasEncoded; + ::rtl::OUString mEncoded; +public: + StorageItem( PasswordContainer* point, const ::rtl::OUString& path ) : + ConfigItem( path, CONFIG_MODE_IMMEDIATE_UPDATE ), + mainCont( point ), + hasEncoded( sal_False ) + { + ::com::sun::star::uno::Sequence< ::rtl::OUString > aNode( 1 ); + *aNode.getArray() = path; + *aNode.getArray() += ::rtl::OUString::createFromAscii( "/Store" ); + EnableNotification( aNode ); + } + + PassMap getInfo(); + void update( const ::rtl::OUString& url, const NamePassRecord& rec ); + void remove( const ::rtl::OUString& url, const ::rtl::OUString& rec ); + void clear(); + + sal_Bool getEncodedMP( ::rtl::OUString& aResult ); + void setEncodedMP( const ::rtl::OUString& aResult, sal_Bool bAcceptEnmpty = sal_False ); + void setUseStorage( sal_Bool bUse ); + sal_Bool useStorage(); + + virtual void Notify( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ); + virtual void Commit(); +}; + +//---------------------------------------------------------------------------------- + +enum PasswordState { + no_password, + entered, + cancelled +}; + +class PasswordContainer : public ::cppu::WeakImplHelper5< + ::com::sun::star::task::XPasswordContainer, + ::com::sun::star::task::XMasterPasswordHandling2, + ::com::sun::star::task::XUrlContainer, + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::lang::XEventListener > +{ +private: + PassMap m_aContainer; + StorageItem* m_pStorageFile; + ::osl::Mutex mMutex; + ::rtl::OUString m_aMasterPasswd; // master password is set when the string is not empty + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mComponent; + SysCredentialsConfig mUrlContainer; + + ::com::sun::star::uno::Sequence< ::com::sun::star::task::UserRecord > CopyToUserRecordSequence( + const ::std::list< NamePassRecord >& original, + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) + throw(::com::sun::star::uno::RuntimeException); + + ::com::sun::star::task::UserRecord CopyToUserRecord( + const NamePassRecord& aRecord, + sal_Bool& io_bTryToDecode, + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler ); + + ::com::sun::star::uno::Sequence< ::com::sun::star::task::UserRecord > FindUsr( + const ::std::list< NamePassRecord >& userlist, + const ::rtl::OUString& name, + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) + throw(::com::sun::star::uno::RuntimeException); +bool createUrlRecord( + const PassMap::iterator & rIter, + bool bName, + const ::rtl::OUString & aName, + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler, + ::com::sun::star::task::UrlRecord & rRec ) + throw( ::com::sun::star::uno::RuntimeException ); + +::com::sun::star::task::UrlRecord find( + const ::rtl::OUString& aURL, + const ::rtl::OUString& aName, + bool bName, // only needed to support empty user names + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler ) throw(::com::sun::star::uno::RuntimeException); + + ::rtl::OUString GetDefaultMasterPassword(); + + ::rtl::OUString RequestPasswordFromUser( + ::com::sun::star::task::PasswordRequestMode aRMode, + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ); + + ::rtl::OUString GetMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) + throw(::com::sun::star::uno::RuntimeException); + + void UpdateVector( const ::rtl::OUString& url, ::std::list< NamePassRecord >& toUpdate, NamePassRecord& rec, sal_Bool writeFile ) + throw(::com::sun::star::uno::RuntimeException); + + void PrivateAdd( const ::rtl::OUString& aUrl, + const ::rtl::OUString& aUserName, + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPasswords, + char aMode, + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) + throw(::com::sun::star::uno::RuntimeException); + + ::std::vector< ::rtl::OUString > DecodePasswords( const ::rtl::OUString& aLine, const ::rtl::OUString& aMasterPassword ) + throw(::com::sun::star::uno::RuntimeException); + + ::rtl::OUString EncodePasswords( ::std::vector< ::rtl::OUString > lines, const ::rtl::OUString& aMasterPassword ) + throw(::com::sun::star::uno::RuntimeException); + +public: + PasswordContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); + ~PasswordContainer(); + + virtual void SAL_CALL add( const ::rtl::OUString& aUrl, + const ::rtl::OUString& aUserName, + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPasswords, + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) + throw(::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL addPersistent( const ::rtl::OUString& aUrl, + const ::rtl::OUString& aUserName, + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPasswords, + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) + throw(::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::task::UrlRecord SAL_CALL + find( const ::rtl::OUString& aUrl, + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) + throw(::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::task::UrlRecord SAL_CALL + findForName( const ::rtl::OUString& aUrl, + const ::rtl::OUString& aUserName, + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) + throw(::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL remove( const ::rtl::OUString& aUrl, + const ::rtl::OUString& aUserName ) + throw(::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL removePersistent( const ::rtl::OUString& aUrl, + const ::rtl::OUString& aUserName ) + throw(::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL removeAllPersistent() throw(::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::task::UrlRecord > SAL_CALL + getAllPersistent( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) throw(::com::sun::star::uno::RuntimeException); + + + // provide factory + static ::rtl::OUString SAL_CALL impl_getStaticImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + impl_getStaticSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > SAL_CALL + impl_createFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ServiceManager ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL + impl_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) throw( ::com::sun::star::uno::RuntimeException ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) + throw(::com::sun::star::uno::RuntimeException); + + // XMasterPasswordHandling + virtual ::sal_Bool SAL_CALL authorizateWithMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL changeMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeMasterPassword() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasMasterPassword( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL allowPersistentStoring( ::sal_Bool bAllow ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isPersistentStoringAllowed( ) throw (::com::sun::star::uno::RuntimeException); + + // XMasterPasswordHandling2 + virtual ::sal_Bool SAL_CALL useDefaultMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isDefaultMasterPasswordUsed( ) throw (::com::sun::star::uno::RuntimeException); + + // XUrlContainer + virtual void SAL_CALL addUrl( const ::rtl::OUString& Url, ::sal_Bool MakePersistent ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL findUrl( const ::rtl::OUString& Url ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeUrl( const ::rtl::OUString& Url ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getUrls( ::sal_Bool OnlyPersistent ) throw (::com::sun::star::uno::RuntimeException); + + void Notify(); +}; + +//---------------------------------------------------------------------------------- + +class MasterPasswordRequest_Impl : public ucbhelper::InteractionRequest +{ + ::rtl::Reference< ucbhelper::InteractionSupplyAuthentication > m_xAuthSupplier; + +public: + MasterPasswordRequest_Impl( ::com::sun::star::task::PasswordRequestMode Mode ); + + const ::rtl::Reference< ucbhelper::InteractionSupplyAuthentication > & + getAuthenticationSupplier() const { return m_xAuthSupplier; } + +}; + +//---------------------------------------------------------------------------------- + +class RW_SvMemoryStream : public SvMemoryStream { +public: + RW_SvMemoryStream( void* Buf, ULONG Size, StreamMode eMode ): + SvMemoryStream( Buf, Size, eMode){} + + RW_SvMemoryStream( ULONG InitSize=512, ULONG Resize=64 ): + SvMemoryStream( InitSize, Resize ){} + + ULONG getActualSize(){ return nEndOfData; } +}; + + + +#endif // #ifndef INCLUDED_COMPHELPER_PASSWORDCONTAINER_HXX + diff --git a/svl/source/inc/poolio.hxx b/svl/source/inc/poolio.hxx new file mode 100644 index 000000000000..fb30fc04832d --- /dev/null +++ b/svl/source/inc/poolio.hxx @@ -0,0 +1,204 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: poolio.hxx,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include + + +#ifndef DELETEZ +#define DELETEZ(pPtr) { delete pPtr; pPtr = 0; } +#endif + + +struct SfxPoolVersion_Impl +{ + USHORT _nVer; + USHORT _nStart, _nEnd; + USHORT* _pMap; + + SfxPoolVersion_Impl( USHORT nVer, USHORT nStart, USHORT nEnd, + USHORT *pMap ) + : _nVer( nVer ), + _nStart( nStart ), + _nEnd( nEnd ), + _pMap( pMap ) + {} + SfxPoolVersion_Impl( const SfxPoolVersion_Impl &rOrig ) + : _nVer( rOrig._nVer ), + _nStart( rOrig._nStart ), + _nEnd( rOrig._nEnd ), + _pMap( rOrig._pMap ) + {} +}; + +SV_DECL_PTRARR( SfxPoolItemArrayBase_Impl, SfxPoolItem*, 0, 5 ) +SV_DECL_PTRARR_DEL( SfxPoolVersionArr_Impl, SfxPoolVersion_Impl*, 0, 2 ) + +struct SfxPoolItemArray_Impl: public SfxPoolItemArrayBase_Impl +{ + USHORT nFirstFree; + + SfxPoolItemArray_Impl (USHORT nInitSize = 0) + : SfxPoolItemArrayBase_Impl( nInitSize ), + nFirstFree( 0 ) + {} +}; + +class SfxStyleSheetIterator; + +struct SfxItemPool_Impl +{ + SfxBroadcaster aBC; + SfxPoolItemArray_Impl** ppPoolItems; + SfxPoolVersionArr_Impl aVersions; + USHORT nVersion; + USHORT nLoadingVersion; + USHORT nInitRefCount; // 1, beim Laden ggf. 2 + USHORT nVerStart, nVerEnd; // WhichRange in Versions + USHORT nStoringStart, nStoringEnd; // zu speichernder Range + BYTE nMajorVer, nMinorVer; // Pool selbst + SfxMapUnit eDefMetric; + FASTBOOL bInSetItem; + FASTBOOL bStreaming; // in Load() bzw. Store() + + SfxItemPool_Impl( USHORT nStart, USHORT nEnd ) + : ppPoolItems (new SfxPoolItemArray_Impl*[ nEnd - nStart + 1]) + { + memset( ppPoolItems, 0, sizeof( SfxPoolItemArray_Impl* ) * ( nEnd - nStart + 1) ); + } + + ~SfxItemPool_Impl() + { + delete[] ppPoolItems; + } + + void DeleteItems() + { + delete[] ppPoolItems; ppPoolItems = 0; + } +}; + +// ----------------------------------------------------------------------- + +// IBM-C-Set mag keine doppelten Defines +#ifdef DBG +# undef DBG +#endif + +#if defined(DBG_UTIL) && defined(MSC) +#define SFX_TRACE(s,p) \ + { \ + ByteString aPtr(RTL_CONSTASCII_STRINGPARAM("0x0000:0x0000")); \ + _snprintf(const_cast< sal_Char *>(aPtr.GetBuffer()), aPtr.Len(), \ + "%lp", p ); \ + aPtr.Insert(s, 0); \ + DbgTrace( aPtr.GetBuffer() ); \ + } +#define DBG(x) x +#else +#define SFX_TRACE(s,p) +#define DBG(x) +#endif + +#define CHECK_FILEFORMAT( rStream, nTag ) \ + { USHORT nFileTag; \ + rStream >> nFileTag; \ + if ( nTag != nFileTag ) \ + { \ + DBG_ERROR( #nTag ); /*! s.u. */ \ + /*! error-code setzen und auswerten! */ \ + (rStream).SetError(SVSTREAM_FILEFORMAT_ERROR); \ + pImp->bStreaming = FALSE; \ + return rStream; \ + } \ + } + +#define CHECK_FILEFORMAT_RELEASE( rStream, nTag, pPointer ) \ + { USHORT nFileTag; \ + rStream >> nFileTag; \ + if ( nTag != nFileTag ) \ + { \ + DBG_ERROR( #nTag ); /*! s.u. */ \ + /*! error-code setzen und auswerten! */ \ + (rStream).SetError(SVSTREAM_FILEFORMAT_ERROR); \ + pImp->bStreaming = FALSE; \ + delete pPointer; \ + return rStream; \ + } \ + } + +#define CHECK_FILEFORMAT2( rStream, nTag1, nTag2 ) \ + { USHORT nFileTag; \ + rStream >> nFileTag; \ + if ( nTag1 != nFileTag && nTag2 != nFileTag ) \ + { \ + DBG_ERROR( #nTag1 ); /*! s.u. */ \ + /*! error-code setzen und auswerten! */ \ + (rStream).SetError(SVSTREAM_FILEFORMAT_ERROR); \ + pImp->bStreaming = FALSE; \ + return rStream; \ + } \ + } + +#define SFX_ITEMPOOL_VER_MAJOR BYTE(2) +#define SFX_ITEMPOOL_VER_MINOR BYTE(0) + +#define SFX_ITEMPOOL_TAG_STARTPOOL_4 USHORT(0x1111) +#define SFX_ITEMPOOL_TAG_STARTPOOL_5 USHORT(0xBBBB) +#define SFX_ITEMPOOL_TAG_ITEMPOOL USHORT(0xAAAA) +#define SFX_ITEMPOOL_TAG_ITEMS USHORT(0x2222) +#define SFX_ITEMPOOL_TAG_ITEM USHORT(0x7777) +#define SFX_ITEMPOOL_TAG_SIZES USHORT(0x3333) +#define SFX_ITEMPOOL_TAG_DEFAULTS USHORT(0x4444) +#define SFX_ITEMPOOL_TAG_VERSIONMAP USHORT(0x5555) +#define SFX_ITEMPOOL_TAG_HEADER USHORT(0x6666) +#define SFX_ITEMPOOL_TAG_ENDPOOL USHORT(0xEEEE) +#define SFX_ITEMPOOL_TAG_TRICK4OLD USHORT(0xFFFF) + +#define SFX_ITEMPOOL_REC BYTE(0x01) +#define SFX_ITEMPOOL_REC_HEADER BYTE(0x10) +#define SFX_ITEMPOOL_REC_VERSIONMAP USHORT(0x0020) +#define SFX_ITEMPOOL_REC_WHICHIDS USHORT(0x0030) +#define SFX_ITEMPOOL_REC_ITEMS USHORT(0x0040) +#define SFX_ITEMPOOL_REC_DEFAULTS USHORT(0x0050) + +#define SFX_ITEMSET_REC BYTE(0x02) + +#define SFX_STYLES_REC BYTE(0x03) +#define SFX_STYLES_REC_HEADER USHORT(0x0010) +#define SFX_STYLES_REC_STYLES USHORT(0x0020) + +//======================================================================== + +inline USHORT SfxItemPool::GetIndex_Impl(USHORT nWhich) const +{ + DBG_CHKTHIS(SfxItemPool, 0); + DBG_ASSERT(nWhich >= nStart && nWhich <= nEnd, "Which-Id nicht im Pool-Bereich"); + return nWhich - nStart; +} + diff --git a/svl/source/items/aeitem.cxx b/svl/source/items/aeitem.cxx new file mode 100644 index 000000000000..63fbd1db6227 --- /dev/null +++ b/svl/source/items/aeitem.cxx @@ -0,0 +1,317 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: aeitem.cxx,v $ + * $Revision: 1.11 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#ifndef GCC +#endif + +#include + +#define _SVSTDARR_USHORTS +#include +#include +#include + +// STATIC DATA ----------------------------------------------------------- + +DBG_NAME(SfxAllEnumItem) + +TYPEINIT1_AUTOFACTORY(SfxAllEnumItem, SfxEnumItem) + +// ----------------------------------------------------------------------- + +struct SfxAllEnumValue_Impl +{ + USHORT nValue; + XubString aText; +}; + +SV_DECL_PTRARR_DEL(SfxAllEnumValueArr, SfxAllEnumValue_Impl*, 0, 8) +SV_IMPL_PTRARR(SfxAllEnumValueArr, SfxAllEnumValue_Impl*) + +// ----------------------------------------------------------------------- + +SfxAllEnumItem::SfxAllEnumItem() : + SfxEnumItem(), + pValues( 0 ), + pDisabledValues( 0 ) +{ +} + +SfxAllEnumItem::SfxAllEnumItem( USHORT which, USHORT nVal, const XubString &rText ): + SfxEnumItem(which, nVal), + pValues( 0 ), + pDisabledValues( 0 ) +{ + DBG_CTOR(SfxAllEnumItem, 0); + InsertValue( nVal, rText ); +} + +// ----------------------------------------------------------------------- + +SfxAllEnumItem::SfxAllEnumItem(USHORT which, USHORT nVal): + SfxEnumItem(which, nVal), + pValues( 0 ), + pDisabledValues( 0 ) +{ + DBG_CTOR(SfxAllEnumItem, 0); + InsertValue( nVal ); +} + +// ----------------------------------------------------------------------- + +SfxAllEnumItem::SfxAllEnumItem( USHORT which, SvStream &rStream ): + SfxEnumItem(which, rStream), + pValues( 0 ), + pDisabledValues( 0 ) +{ + DBG_CTOR(SfxAllEnumItem, 0); + InsertValue( GetValue() ); +} + +// ----------------------------------------------------------------------- + + +SfxAllEnumItem::SfxAllEnumItem(USHORT which): + SfxEnumItem(which, 0), + pValues( 0 ), + pDisabledValues( 0 ) +{ + DBG_CTOR(SfxAllEnumItem, 0); +} + + +// ----------------------------------------------------------------------- + +SfxAllEnumItem::SfxAllEnumItem(const SfxAllEnumItem &rCopy): + SfxEnumItem(rCopy), + pValues(0), + pDisabledValues( 0 ) +{ + DBG_CTOR(SfxAllEnumItem, 0); + if ( !rCopy.pValues ) + return; + + pValues = new SfxAllEnumValueArr; + + for ( USHORT nPos = 0; nPos < rCopy.pValues->Count(); ++nPos ) + { + SfxAllEnumValue_Impl *pVal = new SfxAllEnumValue_Impl; + pVal->nValue = rCopy.pValues->GetObject(nPos)->nValue; + pVal->aText = rCopy.pValues->GetObject(nPos)->aText; + const SfxAllEnumValue_Impl *pTemp = pVal; + pValues->Insert( pTemp, nPos ); + } + + if( rCopy.pDisabledValues ) + { + pDisabledValues = new SvUShorts; + for ( USHORT nPos = 0; nPos < rCopy.pDisabledValues->Count(); ++nPos ) + { + pDisabledValues->Insert( rCopy.pDisabledValues->GetObject(nPos), + nPos ); + } + } +} + +// ----------------------------------------------------------------------- + +SfxAllEnumItem::~SfxAllEnumItem() +{ + DBG_DTOR(SfxAllEnumItem, 0); + delete pValues; + delete pDisabledValues; +} + +// ----------------------------------------------------------------------- + +USHORT SfxAllEnumItem::GetValueCount() const +{ + DBG_CHKTHIS(SfxAllEnumItem, 0); + return pValues ? pValues->Count() : 0; +} + +// ----------------------------------------------------------------------- + +XubString SfxAllEnumItem::GetValueTextByPos( USHORT nPos ) const +{ + DBG_CHKTHIS(SfxAllEnumItem, 0); + DBG_ASSERT( pValues && nPos < pValues->Count(), "enum overflow" ); + return pValues->GetObject(nPos)->aText; +} + +// ----------------------------------------------------------------------- + +USHORT SfxAllEnumItem::GetValueByPos( USHORT nPos ) const +{ + DBG_CHKTHIS(SfxAllEnumItem, 0); + DBG_ASSERT( pValues && nPos < pValues->Count(), "enum overflow" ); + return pValues->GetObject(nPos)->nValue; +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxAllEnumItem::Clone( SfxItemPool * ) const +{ + DBG_CHKTHIS(SfxAllEnumItem, 0); + return new SfxAllEnumItem(*this); +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxAllEnumItem::Create( SvStream & rStream, USHORT ) const +{ + DBG_CHKTHIS(SfxAllEnumItem, 0); + return new SfxAllEnumItem( Which(), rStream ); +} + + +// ----------------------------------------------------------------------- + +USHORT SfxAllEnumItem::_GetPosByValue( USHORT nVal ) const + +/* [Beschreibung] + + Im Ggs. zu liefert + diese interne Methode bei nicht vorhandenen Values die Position, + an der der Wert liegen w"urde. +*/ + +{ + DBG_CHKTHIS(SfxAllEnumItem, 0); + + if ( !pValues ) + return 0; + + //!O: binaere Suche oder SortArray verwenden + USHORT nPos; + for ( nPos = 0; nPos < pValues->Count(); ++nPos ) + if ( pValues->GetObject(nPos)->nValue >= nVal ) + return nPos; + return nPos; +} + +// ----------------------------------------------------------------------- + +USHORT SfxAllEnumItem::GetPosByValue( USHORT nValue ) const + +/* [Beschreibung] + + Liefert im Gegensatz zu + immer nValue zur"uck, solange nicht mindestens ein Wert mit einer der + Methoden eingef"ugt wurde. +*/ + +{ + DBG_CHKTHIS(SfxAllEnumItem, 0); + + if ( !pValues || !pValues->Count() ) + return nValue; + + return SfxEnumItem::GetPosByValue( nValue ); +} + +// ----------------------------------------------------------------------- + +void SfxAllEnumItem::InsertValue( USHORT nValue, const XubString &rValue ) +{ + DBG_CHKTHIS(SfxAllEnumItem, 0); + SfxAllEnumValue_Impl *pVal = new SfxAllEnumValue_Impl; + pVal->nValue = nValue; + pVal->aText = rValue; + const SfxAllEnumValue_Impl *pTemp = pVal; + if ( !pValues ) + pValues = new SfxAllEnumValueArr; + else if ( GetPosByValue( nValue ) != USHRT_MAX ) + // remove when exists + RemoveValue( nValue ); + // then insert + pValues->Insert( pTemp, _GetPosByValue(nValue) ); //! doppelte?! +} + +// ----------------------------------------------------------------------- + +void SfxAllEnumItem::InsertValue( USHORT nValue ) +{ + DBG_CHKTHIS(SfxAllEnumItem, 0); + SfxAllEnumValue_Impl *pVal = new SfxAllEnumValue_Impl; + pVal->nValue = nValue; + pVal->aText = XubString::CreateFromInt32( nValue ); + const SfxAllEnumValue_Impl *pTemp = pVal; + if ( !pValues ) + pValues = new SfxAllEnumValueArr; + + pValues->Insert( pTemp, _GetPosByValue(nValue) ); //! doppelte?! +} + +void SfxAllEnumItem::DisableValue( USHORT nValue ) +{ + DBG_CHKTHIS(SfxAllEnumItem, 0); + if ( !pDisabledValues ) + pDisabledValues = new SvUShorts; + + pDisabledValues->Insert( nValue, pDisabledValues->Count() ); +} + +BOOL SfxAllEnumItem::IsEnabled( USHORT nValue ) const +{ + if ( pDisabledValues ) + { + for ( USHORT i=0; iCount(); i++ ) + if ( (*pDisabledValues)[i] == nValue ) + return FALSE; + } + + return TRUE; +} + +// ----------------------------------------------------------------------- + +void SfxAllEnumItem::RemoveValue( USHORT nValue ) +{ + DBG_CHKTHIS(SfxAllEnumItem, 0); + USHORT nPos = GetPosByValue(nValue); + DBG_ASSERT( nPos != USHRT_MAX, "removing value not in enum" ); + pValues->Remove( nPos ); +} + +// ----------------------------------------------------------------------- + + +void SfxAllEnumItem::RemoveAllValues() +{ + DBG_CHKTHIS(SfxAllEnumItem, 0); + if ( pValues ) + pValues->DeleteAndDestroy( 0, pValues->Count() ); +} + + + diff --git a/svl/source/items/bintitem.cxx b/svl/source/items/bintitem.cxx new file mode 100644 index 000000000000..a3b6c1c2b54d --- /dev/null +++ b/svl/source/items/bintitem.cxx @@ -0,0 +1,169 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: bintitem.cxx,v $ + * $Revision: 1.8 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include +#include +#include +#include + +// STATIC DATA + +DBG_NAME(SfxBigIntItem) + +// RTTI +TYPEINIT1_AUTOFACTORY(SfxBigIntItem, SfxPoolItem); + +// SfxBigIntItem + +//============================================================================ +SfxBigIntItem::SfxBigIntItem() + : SfxPoolItem(0), + aVal(0) +{ + DBG_CTOR(SfxBigIntItem, 0); +} + +//============================================================================ +SfxBigIntItem::SfxBigIntItem(USHORT which, const BigInt& rValue) + : SfxPoolItem(which), + aVal(rValue) +{ + DBG_CTOR(SfxBigIntItem, 0); +} + +//============================================================================ +SfxBigIntItem::SfxBigIntItem(USHORT which, SvStream &rStream) + : SfxPoolItem(which) +{ + DBG_CTOR(SfxBigIntItem, 0); + ByteString sTmp; + rStream.ReadByteString(sTmp); + BigInt aTmp(sTmp); + aVal = aTmp; +} + +//============================================================================ +SfxBigIntItem::SfxBigIntItem(const SfxBigIntItem& rItem) + : SfxPoolItem(rItem), + aVal(rItem.aVal) +{ + DBG_CTOR(SfxBigIntItem, 0); +} + +//============================================================================ +SfxItemPresentation SfxBigIntItem::GetPresentation( + SfxItemPresentation /*ePresentation*/, + SfxMapUnit /*eCoreMetric*/, + SfxMapUnit /*ePresentationMetric*/, + XubString& rText, + const IntlWrapper * ) const +{ + DBG_CHKTHIS(SfxBigIntItem, 0); + rText = aVal.GetString(); + return SFX_ITEM_PRESENTATION_NAMELESS; +} + +//============================================================================ +int SfxBigIntItem::operator==(const SfxPoolItem& rItem) const +{ + DBG_CHKTHIS(SfxBigIntItem, 0); + DBG_ASSERT(SfxPoolItem::operator==(rItem), "unequal type"); + return ((SfxBigIntItem&)rItem).aVal == aVal; +} + +//============================================================================ +int SfxBigIntItem::Compare(const SfxPoolItem& rItem) const +{ + DBG_CHKTHIS(SfxBigIntItem, 0); + DBG_ASSERT(SfxPoolItem::operator==(rItem), "unequal type"); + + if (((const SfxBigIntItem&)rItem ).aVal < aVal ) + return -1; + else if (((const SfxBigIntItem&)rItem ).aVal == aVal) + return 0; + else + return 1; +} + +//============================================================================ +SfxPoolItem* SfxBigIntItem::Clone(SfxItemPool *) const +{ + DBG_CHKTHIS(SfxBigIntItem, 0); + return new SfxBigIntItem(*this); +} + +//============================================================================ +SfxPoolItem* SfxBigIntItem::Create(SvStream &rStream, USHORT) const +{ + DBG_CHKTHIS(SfxBigIntItem, 0); + return new SfxBigIntItem(Which(), rStream); +} + +//============================================================================ +SvStream& SfxBigIntItem::Store(SvStream &rStream, USHORT ) const +{ + DBG_CHKTHIS(SfxBigIntItem, 0); + rStream.WriteByteString( aVal.GetByteString() ); + return rStream; +} + +//============================================================================ +SfxFieldUnit SfxBigIntItem::GetUnit() const +{ + DBG_CHKTHIS(SfxBigIntItem, 0); + return SFX_FUNIT_NONE; +} + +//============================================================================ +// virtual +BOOL SfxBigIntItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE ) +{ + double aValue = 0.0; + if ( rVal >>= aValue ) + { + SetValue( aValue ); + return TRUE; + } + + DBG_ERROR( "SfxBigIntItem::PutValue - Wrong type!" ); + return FALSE; +} + +//============================================================================ +// virtual +BOOL SfxBigIntItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE ) const +{ + double aValue = GetValue(); + rVal <<= aValue; + return TRUE; +} + diff --git a/svl/source/items/cenumitm.cxx b/svl/source/items/cenumitm.cxx new file mode 100644 index 000000000000..1906e62a8cf8 --- /dev/null +++ b/svl/source/items/cenumitm.cxx @@ -0,0 +1,297 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: cenumitm.cxx,v $ + * $Revision: 1.9 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include +#include +#include +#include + +#ifndef _CPPUHELPER_EXTRACT_HXX_ +#include +#endif + +//============================================================================ +// +// class SfxEnumItemInterface +// +//============================================================================ + +DBG_NAME(SfxEnumItemInterface) + +//============================================================================ +TYPEINIT1(SfxEnumItemInterface, SfxPoolItem) + +//============================================================================ +// virtual +int SfxEnumItemInterface::operator ==(const SfxPoolItem & rItem) const +{ + SFX_ASSERT(SfxPoolItem::operator ==(rItem), Which(), "unequal type"); + return GetEnumValue() + == static_cast< const SfxEnumItemInterface * >(&rItem)-> + GetEnumValue(); +} + +//============================================================================ +// virtual +SfxItemPresentation +SfxEnumItemInterface::GetPresentation(SfxItemPresentation, SfxMapUnit, + SfxMapUnit, XubString & rText, + const IntlWrapper *) const +{ + rText = XubString::CreateFromInt32(GetEnumValue()); + return SFX_ITEM_PRESENTATION_NAMELESS; +} + +//============================================================================ +// virtual +BOOL SfxEnumItemInterface::QueryValue(com::sun::star::uno::Any& rVal, BYTE) + const +{ + rVal <<= sal_Int32(GetEnumValue()); + return true; +} + +//============================================================================ +// virtual +BOOL SfxEnumItemInterface::PutValue(const com::sun::star::uno::Any& rVal, + BYTE) +{ + sal_Int32 nTheValue = 0; + + if ( ::cppu::enum2int( nTheValue, rVal ) ) + { + SetEnumValue(USHORT(nTheValue)); + return true; + } + DBG_ERROR("SfxEnumItemInterface::PutValue(): Wrong type"); + return false; +} + +//============================================================================ +XubString SfxEnumItemInterface::GetValueTextByPos(USHORT) const +{ + DBG_WARNING("SfxEnumItemInterface::GetValueTextByPos(): Pure virtual"); + return XubString(); +} + +//============================================================================ +// virtual +USHORT SfxEnumItemInterface::GetValueByPos(USHORT nPos) const +{ + return nPos; +} + +//============================================================================ +// virtual +USHORT SfxEnumItemInterface::GetPosByValue(USHORT nValue) const +{ + USHORT nCount = GetValueCount(); + for (USHORT i = 0; i < nCount; ++i) + if (GetValueByPos(i) == nValue) + return i; + return USHRT_MAX; +} + +BOOL SfxEnumItemInterface::IsEnabled(USHORT) const +{ + return TRUE; +} + +//============================================================================ +// virtual +int SfxEnumItemInterface::HasBoolValue() const +{ + return false; +} + +//============================================================================ +// virtual +BOOL SfxEnumItemInterface::GetBoolValue() const +{ + return false; +} + +//============================================================================ +// virtual +void SfxEnumItemInterface::SetBoolValue(BOOL) +{} + +//============================================================================ +// +// class CntEnumItem +// +//============================================================================ + +DBG_NAME(CntEnumItem) + +//============================================================================ +CntEnumItem::CntEnumItem(USHORT which, SvStream & rStream): + SfxEnumItemInterface(which) +{ + m_nValue = 0; + rStream >> m_nValue; +} + +//============================================================================ +TYPEINIT1(CntEnumItem, SfxEnumItemInterface) + +//============================================================================ +// virtual +SvStream & CntEnumItem::Store(SvStream & rStream, USHORT) const +{ + rStream << m_nValue; + return rStream; +} + +//============================================================================ +// virtual +USHORT CntEnumItem::GetEnumValue() const +{ + return GetValue(); +} + +//============================================================================ +// virtual +void CntEnumItem::SetEnumValue(USHORT nTheValue) +{ + SetValue(nTheValue); +} + +//============================================================================ +// +// class CntBoolItem +// +//============================================================================ + +DBG_NAME(CntBoolItem) + +//============================================================================ +TYPEINIT1_AUTOFACTORY(CntBoolItem, SfxPoolItem) + +//============================================================================ +CntBoolItem::CntBoolItem(USHORT which, SvStream & rStream): + SfxPoolItem(which) +{ + m_bValue = false; + rStream >> m_bValue; +} + +//============================================================================ +// virtual +int CntBoolItem::operator ==(const SfxPoolItem & rItem) const +{ + DBG_ASSERT(rItem.ISA(CntBoolItem), + "CntBoolItem::operator ==(): Bad type"); + return m_bValue == static_cast< CntBoolItem const * >(&rItem)->m_bValue; +} + +//============================================================================ +// virtual +int CntBoolItem::Compare(const SfxPoolItem & rWith) const +{ + DBG_ASSERT(rWith.ISA(CntBoolItem), "CntBoolItem::Compare(): Bad type"); + return m_bValue == static_cast< CntBoolItem const * >(&rWith)->m_bValue ? + 0 : m_bValue ? -1 : 1; +} + +//============================================================================ +// virtual +SfxItemPresentation CntBoolItem::GetPresentation(SfxItemPresentation, + SfxMapUnit, SfxMapUnit, + UniString & rText, + const IntlWrapper *) const +{ + rText = GetValueTextByVal(m_bValue); + return SFX_ITEM_PRESENTATION_NAMELESS; +} + +//============================================================================ +// virtual +BOOL CntBoolItem::QueryValue(com::sun::star::uno::Any& rVal, BYTE) const +{ + rVal <<= sal_Bool(m_bValue); + return true; +} + +//============================================================================ +// virtual +BOOL CntBoolItem::PutValue(const com::sun::star::uno::Any& rVal, BYTE) +{ + sal_Bool bTheValue = sal_Bool(); + if (rVal >>= bTheValue) + { + m_bValue = bTheValue; + return true; + } + DBG_ERROR("CntBoolItem::PutValue(): Wrong type"); + return false; +} + +//============================================================================ +// virtual +SfxPoolItem * CntBoolItem::Create(SvStream & rStream, USHORT) const +{ + return new CntBoolItem(Which(), rStream); +} + +//============================================================================ +// virtual +SvStream & CntBoolItem::Store(SvStream & rStream, USHORT) const +{ + rStream << m_bValue; + return rStream; +} + +//============================================================================ +// virtual +SfxPoolItem * CntBoolItem::Clone(SfxItemPool *) const +{ + return new CntBoolItem(*this); +} + +//============================================================================ +// virtual +USHORT CntBoolItem::GetValueCount() const +{ + return 2; +} + +//============================================================================ +// virtual +UniString CntBoolItem::GetValueTextByVal(BOOL bTheValue) const +{ + return + bTheValue ? + UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("TRUE")) : + UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("FALSE")); +} + diff --git a/svl/source/items/cintitem.cxx b/svl/source/items/cintitem.cxx new file mode 100644 index 000000000000..97cce9b75591 --- /dev/null +++ b/svl/source/items/cintitem.cxx @@ -0,0 +1,565 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: cintitem.cxx,v $ + * $Revision: 1.10 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include +#include +#include + +//============================================================================ +// +// class CntByteItem +// +//============================================================================ + +DBG_NAME(CntByteItem) + +//============================================================================ +TYPEINIT1_AUTOFACTORY(CntByteItem, SfxPoolItem); + +//============================================================================ +CntByteItem::CntByteItem(USHORT which, SvStream & rStream): + SfxPoolItem(which) +{ + DBG_CTOR(CntByteItem, 0); + rStream >> m_nValue; +} + +//============================================================================ +// virtual +int CntByteItem::operator ==(const SfxPoolItem & rItem) const +{ + DBG_CHKTHIS(CntByteItem, 0); + DBG_ASSERT(rItem.ISA(CntByteItem), + "CntByteItem::operator ==(): Bad type"); + return m_nValue == SAL_STATIC_CAST(const CntByteItem *, &rItem)->m_nValue; +} + +//============================================================================ +// virtual +int CntByteItem::Compare(const SfxPoolItem & rWith) const +{ + DBG_CHKTHIS(CntByteItem, 0); + DBG_ASSERT(rWith.ISA(CntByteItem), "CntByteItem::Compare(): Bad type"); + return SAL_STATIC_CAST(const CntByteItem *, &rWith)->m_nValue < m_nValue ? + -1 : + SAL_STATIC_CAST(const CntByteItem *, &rWith)->m_nValue + == m_nValue ? + 0 : 1; +} + +//============================================================================ +// virtual +SfxItemPresentation CntByteItem::GetPresentation(SfxItemPresentation, + SfxMapUnit, SfxMapUnit, + XubString & rText, + const IntlWrapper *) const +{ + DBG_CHKTHIS(CntByteItem, 0); + rText = XubString::CreateFromInt32(m_nValue); + return SFX_ITEM_PRESENTATION_NAMELESS; +} + +//============================================================================ +// virtual +BOOL CntByteItem::QueryValue(com::sun::star::uno::Any& rVal,BYTE) const +{ + sal_Int8 nValue = m_nValue; + rVal <<= nValue; + return TRUE; +} + +//============================================================================ +// virtual +BOOL CntByteItem::PutValue(const com::sun::star::uno::Any& rVal,BYTE) +{ + sal_Int8 nValue = sal_Int8(); + if (rVal >>= nValue) + { + m_nValue = nValue; + return TRUE; + } + + DBG_ERROR( "CntByteItem::PutValue - Wrong type!" ); + return FALSE; +} + +//============================================================================ +// virtual +SfxPoolItem * CntByteItem::Create(SvStream & rStream, USHORT) const +{ + DBG_CHKTHIS(CntByteItem, 0); + short nTheValue = 0; + rStream >> nTheValue; + return new CntByteItem(Which(), BYTE(nTheValue)); +} + +//============================================================================ +// virtual +SvStream & CntByteItem::Store(SvStream & rStream, USHORT) const +{ + DBG_CHKTHIS(CntByteItem, 0); + rStream << short(m_nValue); + return rStream; +} + +//============================================================================ +// virtual +SfxPoolItem * CntByteItem::Clone(SfxItemPool *) const +{ + DBG_CHKTHIS(CntByteItem, 0); + return new CntByteItem(*this); +} + +//============================================================================ +// virtual +BYTE CntByteItem::GetMin() const +{ + DBG_CHKTHIS(CntByteItem, 0); + return 0; +} + +//============================================================================ +// virtual +BYTE CntByteItem::GetMax() const +{ + DBG_CHKTHIS(CntByteItem, 0); + return 255; +} + +//============================================================================ +// virtual +SfxFieldUnit CntByteItem::GetUnit() const +{ + DBG_CHKTHIS(CntByteItem, 0); + return SFX_FUNIT_NONE; +} + +//============================================================================ +// +// class CntUInt16Item +// +//============================================================================ + +DBG_NAME(CntUInt16Item); + +//============================================================================ +TYPEINIT1_AUTOFACTORY(CntUInt16Item, SfxPoolItem); + +//============================================================================ +CntUInt16Item::CntUInt16Item(USHORT which, SvStream & rStream) : + SfxPoolItem(which) +{ + DBG_CTOR(CntUInt16Item, 0); + USHORT nTheValue = 0; + rStream >> nTheValue; + m_nValue = nTheValue; +} + +//============================================================================ +// virtual +int CntUInt16Item::operator ==(const SfxPoolItem & rItem) const +{ + DBG_CHKTHIS(CntUInt16Item, 0); + DBG_ASSERT(rItem.ISA(CntUInt16Item), + "CntUInt16Item::operator ==(): Bad type"); + return m_nValue == SAL_STATIC_CAST(const CntUInt16Item *, &rItem)-> + m_nValue; +} + +//============================================================================ +// virtual +int CntUInt16Item::Compare(const SfxPoolItem & rWith) const +{ + DBG_CHKTHIS(CntUInt16Item, 0); + DBG_ASSERT(rWith.ISA(CntUInt16Item), + "CntUInt16Item::Compare(): Bad type"); + return SAL_STATIC_CAST(const CntUInt16Item *, &rWith)->m_nValue + < m_nValue ? + -1 : + SAL_STATIC_CAST(const CntUInt16Item *, &rWith)->m_nValue + == m_nValue ? + 0 : 1; +} + +//============================================================================ +// virtual +SfxItemPresentation CntUInt16Item::GetPresentation(SfxItemPresentation, + SfxMapUnit, SfxMapUnit, + XubString & rText, + const IntlWrapper *) + const +{ + DBG_CHKTHIS(CntUInt16Item, 0); + rText = XubString::CreateFromInt32(m_nValue); + return SFX_ITEM_PRESENTATION_NAMELESS; +} + +//============================================================================ +// virtual +BOOL CntUInt16Item::QueryValue(com::sun::star::uno::Any& rVal,BYTE) const +{ + sal_Int32 nValue = m_nValue; + rVal <<= nValue; + return TRUE; +} + +//============================================================================ +// virtual +BOOL CntUInt16Item::PutValue(const com::sun::star::uno::Any& rVal,BYTE) +{ + sal_Int32 nValue = 0; + if (rVal >>= nValue) + { + DBG_ASSERT( nValue <= USHRT_MAX, "Overflow in UInt16 value!"); + m_nValue = (sal_uInt16)nValue; + return TRUE; + } + + DBG_ERROR( "CntUInt16Item::PutValue - Wrong type!" ); + return FALSE; +} + +//============================================================================ +// virtual +SfxPoolItem * CntUInt16Item::Create(SvStream & rStream, USHORT) const +{ + DBG_CHKTHIS(CntUInt16Item, 0); + return new CntUInt16Item(Which(), rStream); +} + +//============================================================================ +// virtual +SvStream & CntUInt16Item::Store(SvStream &rStream, USHORT) const +{ + DBG_CHKTHIS(CntUInt16Item, 0); + rStream << USHORT(m_nValue); + return rStream; +} + +//============================================================================ +// virtual +SfxPoolItem * CntUInt16Item::Clone(SfxItemPool *) const +{ + DBG_CHKTHIS(CntUInt16Item, 0); + return new CntUInt16Item(*this); +} + +//============================================================================ +// virtual +UINT16 CntUInt16Item::GetMin() const +{ + DBG_CHKTHIS(CntUInt16Item, 0); + return 0; +} + +//============================================================================ +// virtual +UINT16 CntUInt16Item::GetMax() const +{ + DBG_CHKTHIS(CntUInt16Item, 0); + return 65535; +} + +//============================================================================ +// virtual +SfxFieldUnit CntUInt16Item::GetUnit() const +{ + DBG_CHKTHIS(CntUInt16Item, 0); + return SFX_FUNIT_NONE; +} + +//============================================================================ +// +// class CntInt32Item +// +//============================================================================ + +DBG_NAME(CntInt32Item); + +//============================================================================ +TYPEINIT1_AUTOFACTORY(CntInt32Item, SfxPoolItem); + +//============================================================================ +CntInt32Item::CntInt32Item(USHORT which, SvStream & rStream) : + SfxPoolItem(which) +{ + DBG_CTOR(CntInt32Item, 0); + long nTheValue = 0; + rStream >> nTheValue; + m_nValue = nTheValue; +} + +//============================================================================ +// virtual +int CntInt32Item::operator ==(const SfxPoolItem & rItem) const +{ + DBG_CHKTHIS(CntInt32Item, 0); + DBG_ASSERT(rItem.ISA(CntInt32Item), + "CntInt32Item::operator ==(): Bad type"); + return m_nValue == SAL_STATIC_CAST(const CntInt32Item *, &rItem)-> + m_nValue; +} + +//============================================================================ +// virtual +int CntInt32Item::Compare(const SfxPoolItem & rWith) const +{ + DBG_CHKTHIS(CntInt32Item, 0); + DBG_ASSERT(rWith.ISA(CntInt32Item), "CntInt32Item::Compare(): Bad type"); + return SAL_STATIC_CAST(const CntInt32Item *, &rWith)->m_nValue + < m_nValue ? + -1 : + SAL_STATIC_CAST(const CntInt32Item *, &rWith)->m_nValue + == m_nValue ? + 0 : 1; +} + +//============================================================================ +// virtual +SfxItemPresentation CntInt32Item::GetPresentation(SfxItemPresentation, + SfxMapUnit, SfxMapUnit, + XubString & rText, + const IntlWrapper *) const +{ + DBG_CHKTHIS(CntInt32Item, 0); + rText = XubString::CreateFromInt32(m_nValue); + return SFX_ITEM_PRESENTATION_NAMELESS; +} + +//============================================================================ +// virtual +BOOL CntInt32Item::QueryValue(com::sun::star::uno::Any& rVal,BYTE) const +{ + sal_Int32 nValue = m_nValue; + rVal <<= nValue; + return TRUE; +} + +//============================================================================ +// virtual +BOOL CntInt32Item::PutValue(const com::sun::star::uno::Any& rVal,BYTE) +{ + sal_Int32 nValue = 0; + if (rVal >>= nValue) + { + m_nValue = nValue; + return TRUE; + } + + DBG_ERROR( "CntInt32Item::PutValue - Wrong type!" ); + return FALSE; +} + +//============================================================================ +// virtual +SfxPoolItem * CntInt32Item::Create(SvStream & rStream, USHORT) const +{ + DBG_CHKTHIS(CntInt32Item, 0); + return new CntInt32Item(Which(), rStream); +} + +//============================================================================ +// virtual +SvStream & CntInt32Item::Store(SvStream &rStream, USHORT) const +{ + DBG_CHKTHIS(CntInt32Item, 0); + rStream << long(m_nValue); + return rStream; +} + +//============================================================================ +// virtual +SfxPoolItem * CntInt32Item::Clone(SfxItemPool *) const +{ + DBG_CHKTHIS(CntInt32Item, 0); + return new CntInt32Item(*this); +} + +//============================================================================ +// virtual +INT32 CntInt32Item::GetMin() const +{ + DBG_CHKTHIS(CntInt32Item, 0); + return INT32(0x80000000); +} + +//============================================================================ +// virtual +INT32 CntInt32Item::GetMax() const +{ + DBG_CHKTHIS(CntInt32Item, 0); + return 0x7FFFFFFF; +} + +//============================================================================ +// virtual +SfxFieldUnit CntInt32Item::GetUnit() const +{ + DBG_CHKTHIS(CntInt32Item, 0); + return SFX_FUNIT_NONE; +} + +//============================================================================ +// +// class CntUInt32Item +// +//============================================================================ + +DBG_NAME(CntUInt32Item); + +//============================================================================ +TYPEINIT1_AUTOFACTORY(CntUInt32Item, SfxPoolItem); + +//============================================================================ +CntUInt32Item::CntUInt32Item(USHORT which, SvStream & rStream) : + SfxPoolItem(which) +{ + DBG_CTOR(CntUInt32Item, 0); + sal_uInt32 nTheValue = 0; + rStream >> nTheValue; + m_nValue = nTheValue; +} + +//============================================================================ +// virtual +int CntUInt32Item::operator ==(const SfxPoolItem & rItem) const +{ + DBG_CHKTHIS(CntUInt32Item, 0); + DBG_ASSERT(rItem.ISA(CntUInt32Item), + "CntUInt32Item::operator ==(): Bad type"); + return m_nValue == SAL_STATIC_CAST(const CntUInt32Item *, &rItem)-> + m_nValue; +} + +//============================================================================ +// virtual +int CntUInt32Item::Compare(const SfxPoolItem & rWith) const +{ + DBG_CHKTHIS(CntUInt32Item, 0); + DBG_ASSERT(rWith.ISA(CntUInt32Item), + "CntUInt32Item::operator ==(): Bad type"); + return SAL_STATIC_CAST(const CntUInt32Item *, &rWith)->m_nValue + < m_nValue ? + -1 : + SAL_STATIC_CAST(const CntUInt32Item *, &rWith)->m_nValue + == m_nValue ? + 0 : 1; +} + +//============================================================================ +// virtual +SfxItemPresentation CntUInt32Item::GetPresentation(SfxItemPresentation, + SfxMapUnit, SfxMapUnit, + XubString & rText, + const IntlWrapper *) + const +{ + DBG_CHKTHIS(CntUInt32Item, 0); + rText = XubString::CreateFromInt64(m_nValue); + return SFX_ITEM_PRESENTATION_NAMELESS; +} + +//============================================================================ +// virtual +BOOL CntUInt32Item::QueryValue(com::sun::star::uno::Any& rVal,BYTE) const +{ + sal_Int32 nValue = m_nValue; + DBG_ASSERT( nValue>=0, "Overflow in UInt32 value!"); + rVal <<= nValue; + return TRUE; +} + +//============================================================================ +// virtual +BOOL CntUInt32Item::PutValue(const com::sun::star::uno::Any& rVal,BYTE) +{ + sal_Int32 nValue = 0; + if (rVal >>= nValue) + { + DBG_ASSERT( nValue>=0, "Overflow in UInt32 value!"); + m_nValue = nValue; + return TRUE; + } + + DBG_ERROR( "CntUInt32Item::PutValue - Wrong type!" ); + return FALSE; +} + +//============================================================================ +// virtual +SfxPoolItem * CntUInt32Item::Create(SvStream & rStream, USHORT) const +{ + DBG_CHKTHIS(CntUInt32Item, 0); + return new CntUInt32Item(Which(), rStream); +} + +//============================================================================ +// virtual +SvStream & CntUInt32Item::Store(SvStream &rStream, USHORT) const +{ + DBG_CHKTHIS(CntUInt32Item, 0); + rStream << static_cast(m_nValue); + return rStream; +} + +//============================================================================ +// virtual +SfxPoolItem * CntUInt32Item::Clone(SfxItemPool *) const +{ + DBG_CHKTHIS(CntUInt32Item, 0); + return new CntUInt32Item(*this); +} + +//============================================================================ +// virtual +UINT32 CntUInt32Item::GetMin() const +{ + DBG_CHKTHIS(CntUInt32Item, 0); + return 0; +} + +//============================================================================ +// virtual +UINT32 CntUInt32Item::GetMax() const +{ + DBG_CHKTHIS(CntUInt32Item, 0); + return 0xFFFFFFFF; +} + +//============================================================================ +// virtual +SfxFieldUnit CntUInt32Item::GetUnit() const +{ + DBG_CHKTHIS(CntUInt32Item, 0); + return SFX_FUNIT_NONE; +} + diff --git a/svl/source/items/cntwall.cxx b/svl/source/items/cntwall.cxx new file mode 100644 index 000000000000..67e9387fbe26 --- /dev/null +++ b/svl/source/items/cntwall.cxx @@ -0,0 +1,170 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: cntwall.cxx,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include +#include +#include +#include + +#include + +#define CNTWALLPAPERITEM_STREAM_MAGIC ( (UINT32)0xfefefefe ) +#define CNTWALLPAPERITEM_STREAM_SEEKREL (-( (long)( sizeof( UINT32 ) ) ) ) + +TYPEINIT1( CntWallpaperItem, SfxPoolItem ); + +// ----------------------------------------------------------------------- +CntWallpaperItem::CntWallpaperItem( USHORT which ) + : SfxPoolItem( which ), _nColor( COL_TRANSPARENT ), _nStyle( 0 ) +{ +} + +// ----------------------------------------------------------------------- +CntWallpaperItem::CntWallpaperItem( USHORT which, SvStream& rStream, USHORT nVersion ) + : SfxPoolItem( which ), _nColor( COL_TRANSPARENT ), _nStyle( 0 ) +{ + UINT32 nMagic = 0; + rStream >> nMagic; + if ( nMagic == CNTWALLPAPERITEM_STREAM_MAGIC ) + { + // Okay, data were stored by CntWallpaperItem. + + readUnicodeString(rStream, _aURL, nVersion >= 1); + // !!! Color stream operators do not work - they discard any + // transparency info !!! + _nColor.Read( rStream, TRUE ); + rStream >> _nStyle; + } + else + { + rStream.SeekRel( CNTWALLPAPERITEM_STREAM_SEEKREL ); + + // Data were stored by SfxWallpaperItem ( SO < 6.0 ). The only + // thing we can do here is to get the URL and to position the stream. + + { + // "Read" Wallpaper member - The version compat object positions + // the stream after the wallpaper data in its dtor. We must use + // this trick here as no VCL must be used here ( No Wallpaper + // object allowed ). + VersionCompat aCompat( rStream, STREAM_READ ); + } + + // Read SfxWallpaperItem's string member _aURL. + readUnicodeString(rStream, _aURL, false); + + // "Read" SfxWallpaperItem's string member _aFilter. + ByteString aDummy; + rStream.ReadByteString(aDummy); + } +} + +// ----------------------------------------------------------------------- +CntWallpaperItem::CntWallpaperItem( const CntWallpaperItem& rItem ) : + SfxPoolItem( rItem ), + _aURL( rItem._aURL ), + _nColor( rItem._nColor ), + _nStyle( rItem._nStyle ) +{ +} + +// ----------------------------------------------------------------------- +CntWallpaperItem::~CntWallpaperItem() +{ +} + +// ----------------------------------------------------------------------- +int CntWallpaperItem::operator==( const SfxPoolItem& rItem ) const +{ + DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); + + const CntWallpaperItem& rWallItem = (const CntWallpaperItem&)rItem; + + if( ( rWallItem._nStyle == _nStyle ) && + ( rWallItem._nColor == _nColor ) && + ( rWallItem._aURL == _aURL ) ) + return TRUE; + else + return FALSE; +} + +//============================================================================ +// virtual +USHORT CntWallpaperItem::GetVersion(USHORT) const +{ + return 1; // because it uses SfxPoolItem::read/writeUnicodeString() +} + +// ----------------------------------------------------------------------- +SfxPoolItem* CntWallpaperItem::Create( SvStream& rStream, USHORT nVersion) const +{ + return new CntWallpaperItem( Which(), rStream, nVersion ); +} + +// ----------------------------------------------------------------------- +SvStream& CntWallpaperItem::Store( SvStream& rStream, USHORT ) const +{ + rStream << CNTWALLPAPERITEM_STREAM_MAGIC; + writeUnicodeString(rStream, _aURL); + // !!! Color stream operators do not work - they discard any + // transparency info !!! + // ??? Why the hell Color::Write(...) isn't const ??? + SAL_CONST_CAST( CntWallpaperItem*, this )->_nColor.Write( rStream, TRUE ); + rStream << _nStyle; + + return rStream; +} + +// ----------------------------------------------------------------------- +SfxPoolItem* CntWallpaperItem::Clone( SfxItemPool* ) const +{ + return new CntWallpaperItem( *this ); +} + +//---------------------------------------------------------------------------- +// virtual +BOOL CntWallpaperItem::QueryValue( com::sun::star::uno::Any&,BYTE ) const +{ + DBG_ERROR("Not implemented!"); + return FALSE; +} + +//---------------------------------------------------------------------------- +// virtual +BOOL CntWallpaperItem::PutValue( const com::sun::star::uno::Any&,BYTE ) +{ + DBG_ERROR("Not implemented!"); + return FALSE; +} + + diff --git a/svl/source/items/cstitem.cxx b/svl/source/items/cstitem.cxx new file mode 100644 index 000000000000..9755f4bb9944 --- /dev/null +++ b/svl/source/items/cstitem.cxx @@ -0,0 +1,252 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: cstitem.cxx,v $ + * $Revision: 1.9 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include + +#include + +#include +#include +#include + +#include +#include + +#include +#include + +DBG_NAME( SfxCrawlStatusItem ) +TYPEINIT1( SfxCrawlStatusItem, SfxPoolItem ); + +// ----------------------------------------------------------------------- + +SfxCrawlStatusItem::SfxCrawlStatusItem( USHORT which ) : + SfxPoolItem( which ) +{ + DBG_CTOR( SfxCrawlStatusItem, 0 ); +} + +// ----------------------------------------------------------------------- + +SfxCrawlStatusItem::SfxCrawlStatusItem( USHORT which, CrawlStatus eStat ) : + SfxPoolItem( which ), + eStatus( eStat ) +{ + DBG_CTOR( SfxCrawlStatusItem, 0 ); +} + +// ----------------------------------------------------------------------- + +SfxCrawlStatusItem::SfxCrawlStatusItem( const SfxCrawlStatusItem& rItem ) : + SfxPoolItem( rItem ), + eStatus( rItem.eStatus ) +{ + DBG_CTOR( SfxCrawlStatusItem, 0 ); +} + +// ----------------------------------------------------------------------- + +int SfxCrawlStatusItem::operator==( const SfxPoolItem& rItem ) const +{ + DBG_CHKTHIS( SfxCrawlStatusItem, 0 ); + DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); + + return ((SfxCrawlStatusItem&)rItem).eStatus == eStatus; +} + +// ----------------------------------------------------------------------- + +int SfxCrawlStatusItem::Compare( const SfxPoolItem& rItem ) const +{ + DBG_CHKTHIS( SfxCrawlStatusItem, 0 ); + DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); + + if( ((const SfxCrawlStatusItem&)rItem).eStatus < eStatus ) + return -1; + else if( ((const SfxCrawlStatusItem&)rItem).eStatus == eStatus ) + return 0; + else + return 1; +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxCrawlStatusItem::Create( SvStream& rStream, USHORT ) const +{ + DBG_CHKTHIS(SfxCrawlStatusItem, 0); + + USHORT _eStatus; + rStream >> _eStatus; + + return new SfxCrawlStatusItem( Which(), (CrawlStatus)_eStatus ); +} + +// ----------------------------------------------------------------------- + +SvStream& SfxCrawlStatusItem::Store( SvStream& rStream, USHORT ) const +{ + DBG_CHKTHIS( SfxCrawlStatusItem, 0 ); + + USHORT nStatus = (USHORT)eStatus; + rStream << (USHORT) nStatus; + + return rStream; +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxCrawlStatusItem::Clone( SfxItemPool* ) const +{ + DBG_CHKTHIS( SfxCrawlStatusItem, 0 ); + return new SfxCrawlStatusItem( *this ); +} +// ----------------------------------------------------------------------- + +SfxItemPresentation SfxCrawlStatusItem::GetPresentation +( + SfxItemPresentation /*ePresentation*/, + SfxMapUnit /*eCoreMetric*/, + SfxMapUnit /*ePresentationMetric*/, + XubString& rText, + const IntlWrapper * pIntlWrapper +) const +{ + DBG_CHKTHIS(SfxCrawlStatusItem, 0); + DBG_ASSERT(pIntlWrapper, + "SfxCrawlStatusItem::GetPresentation():" + " Using default IntlWrapper"); + + ::com::sun::star::lang::Locale aLocale; + + switch (eStatus) + { + case CSTAT_NEVER_UPD: + rText = String(SvtResId(STR_CSTAT_NEVER_UPD, + pIntlWrapper ? + pIntlWrapper->getLocale() : + aLocale)); + break; + + case CSTAT_IN_UPD: + rText = String(SvtResId(STR_CSTAT_IN_UPD, + pIntlWrapper ? + pIntlWrapper->getLocale() : + aLocale)); + break; + + case CSTAT_UPD_NEWER: + rText = String(SvtResId(STR_CSTAT_UPD_NEWER, + pIntlWrapper ? + pIntlWrapper->getLocale() : + aLocale)); + break; + + case CSTAT_UPD_NOT_NEWER: + rText = String(SvtResId(STR_CSTAT_UPD_NOT_NEWER, + pIntlWrapper ? + pIntlWrapper->getLocale() : + aLocale)); + break; + + case CSTAT_UPD_CANCEL: + rText = String(SvtResId(STR_CSTAT_UPD_CANCEL, + pIntlWrapper ? + pIntlWrapper->getLocale() : + aLocale)); + break; + + case CSTAT_ERR_GENERAL: + rText = String(SvtResId(STR_CSTAT_ERR_GENERAL, + pIntlWrapper ? + pIntlWrapper->getLocale() : + aLocale)); + break; + + case CSTAT_ERR_NOTEXISTS: + rText = String(SvtResId(STR_CSTAT_ERR_NOTEXISTS, + pIntlWrapper ? + pIntlWrapper->getLocale() : + aLocale)); + break; + + case CSTAT_ERR_NOTREACHED: + rText = String(SvtResId(STR_CSTAT_ERR_NOTREACHED, + pIntlWrapper ? + pIntlWrapper->getLocale() : + aLocale)); + break; + + case CSTAT_UPD_IMMEDIATELY: + rText = String(SvtResId(STR_CSTAT_UPD_IMMEDIATELY, + pIntlWrapper ? + pIntlWrapper->getLocale() : + aLocale)); + break; + + case CSTAT_ERR_OFFLINE: + rText = String(SvtResId(STR_CSTAT_ERR_OFFLINE, + pIntlWrapper ? + pIntlWrapper->getLocale() : + aLocale)); + break; + + default: + rText.Erase(); + break; + } + return SFX_ITEM_PRESENTATION_NAMELESS; +} + +//---------------------------------------------------------------------------- +// virtual +BOOL SfxCrawlStatusItem::PutValue( const com::sun::star::uno::Any& rVal,BYTE ) +{ + sal_Int16 aValue = sal_Int16(); + if ( rVal >>= aValue ) + { + SetStatus( static_cast< CrawlStatus >( aValue ) ); + return TRUE; + } + + DBG_ERROR( "SfxCrawlStatusItem::PutValue - Wrong type!" ); + return FALSE; +} + +//---------------------------------------------------------------------------- +// virtual +BOOL SfxCrawlStatusItem::QueryValue( com::sun::star::uno::Any& rVal,BYTE ) const +{ + sal_Int16 aValue = sal::static_int_cast< sal_Int16 >(GetStatus()); + rVal <<= aValue; + return TRUE; +} + diff --git a/svl/source/items/cstitem.src b/svl/source/items/cstitem.src new file mode 100644 index 000000000000..8d6e2d0280c0 --- /dev/null +++ b/svl/source/items/cstitem.src @@ -0,0 +1,112 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: cstitem.src,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include +String STR_CSTAT_NEVER_UPD +{ + Text [ en-US ] = "No update has occurred" ; +}; +String STR_CSTAT_IN_UPD +{ + Text [ en-US ] = "Updating in progress" ; +}; +String STR_CSTAT_UPD_NEWER +{ + Text [ en-US ] = "Changes discovered" ; +}; +String STR_CSTAT_UPD_NOT_NEWER +{ + Text [ en-US ] = "No changes discovered" ; +}; +String STR_CSTAT_UPD_CANCEL +{ + Text [ en-US ] = "Canceled by user" ; +}; +String STR_CSTAT_UPD_IMMEDIATELY +{ + Text [ en-US ] = "Updating immediately" ; +}; +String STR_CSTAT_ERR_OFFLINE +{ + Text [ en-US ] = "failed, you have not been online" ; +}; +String STR_CSTAT_ERR_GENERAL +{ + Text [ en-US ] = "General error" ; +}; +String STR_CSTAT_ERR_NOTEXISTS +{ + Text [ en-US ] = "Server does not exist" ; +}; +String STR_CSTAT_ERR_NOTREACHED +{ + Text [ en-US ] = "Server not available" ; +}; +String STR_COLUM_DT_AUTO +{ + Text [ en-US ] = "automatic" ; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/svl/source/items/ctypeitm.cxx b/svl/source/items/ctypeitm.cxx new file mode 100644 index 000000000000..552d4a6a9041 --- /dev/null +++ b/svl/source/items/ctypeitm.cxx @@ -0,0 +1,254 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ctypeitm.cxx,v $ + * $Revision: 1.7.136.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include + +#include +#include +#include + +//============================================================================ +// The following defines are copied from chaos/source/items/cstritem.cxx: +#define CNTSTRINGITEM_STREAM_MAGIC ( (UINT32)0xfefefefe ) +#define CNTSTRINGITEM_STREAM_SEEKREL (-( (long)( sizeof( UINT32 ) ) ) ) + +//============================================================================ +// +// class CntContentTypeItem Implementation. +// +//============================================================================ + +TYPEINIT1_AUTOFACTORY( CntContentTypeItem, CntUnencodedStringItem ); + +#define CONTENT_TYPE_NOT_INIT ( (INetContentType)-1 ) + +//---------------------------------------------------------------------------- +CntContentTypeItem::CntContentTypeItem() +: CntUnencodedStringItem(), + _eType( CONTENT_TYPE_NOT_INIT ) +{ +} + +//---------------------------------------------------------------------------- +CntContentTypeItem::CntContentTypeItem( USHORT which, const XubString& rType ) +: CntUnencodedStringItem( which, rType ), + _eType( CONTENT_TYPE_NOT_INIT ) +{ +} + +//---------------------------------------------------------------------------- +CntContentTypeItem::CntContentTypeItem( USHORT which, + const INetContentType eType ) +: CntUnencodedStringItem( which, INetContentTypes::GetContentType( eType ) ), + _eType( eType ) +{ +} + +//---------------------------------------------------------------------------- +CntContentTypeItem::CntContentTypeItem( const CntContentTypeItem& rOrig ) +: CntUnencodedStringItem( rOrig ), + _eType( rOrig._eType ), + _aPresentation( rOrig._aPresentation ) +{ +} + +//============================================================================ +// virtual +USHORT CntContentTypeItem::GetVersion(USHORT) const +{ + return 1; // because it uses SfxPoolItem::read/writeUnicodeString() +} + +//---------------------------------------------------------------------------- +// virtual +SfxPoolItem* CntContentTypeItem::Create( SvStream& rStream, + USHORT nItemVersion ) const +{ + // CntContentTypeItem used to be derived from CntStringItem, so take that + // into account: + UniString aValue; + readUnicodeString(rStream, aValue, nItemVersion >= 1); + UINT32 nMagic = 0; + rStream >> nMagic; + if (nMagic == CNTSTRINGITEM_STREAM_MAGIC) + { + BOOL bEncrypted = FALSE; + rStream >> bEncrypted; + DBG_ASSERT(!bEncrypted, + "CntContentTypeItem::Create() reads encrypted data"); + } + else + rStream.SeekRel(CNTSTRINGITEM_STREAM_SEEKREL); + + return new CntContentTypeItem(Which(), aValue); +} + +//---------------------------------------------------------------------------- +// virtual +SvStream & CntContentTypeItem::Store(SvStream & rStream, USHORT) const +{ + // CntContentTypeItem used to be derived from CntStringItem, so take that + // into account: + writeUnicodeString(rStream, GetValue()); + rStream << CNTSTRINGITEM_STREAM_MAGIC << BOOL(FALSE); + return rStream; +} + +//---------------------------------------------------------------------------- +// virtual +int CntContentTypeItem::operator==( const SfxPoolItem& rOrig ) const +{ + const CntContentTypeItem& rOther = (const CntContentTypeItem&)rOrig; + + if ( ( _eType != CONTENT_TYPE_NOT_INIT ) && + ( rOther._eType != CONTENT_TYPE_NOT_INIT ) ) + return _eType == rOther._eType; + else + return CntUnencodedStringItem::operator==( rOther ); +} + +//---------------------------------------------------------------------------- +// virtual +SfxPoolItem* CntContentTypeItem::Clone( SfxItemPool* /* pPool */ ) const +{ + return new CntContentTypeItem( *this ); +} + +//---------------------------------------------------------------------------- +void CntContentTypeItem::SetValue( const XubString& rNewVal ) +{ + // De-initialize enum type and presentation. + _eType = CONTENT_TYPE_NOT_INIT; + _aPresentation.Erase(); + + CntUnencodedStringItem::SetValue( rNewVal ); +} + +//---------------------------------------------------------------------------- +void CntContentTypeItem::SetPresentation( const XubString& rNewVal ) +{ + _aPresentation = rNewVal; +} + +//---------------------------------------------------------------------------- +int CntContentTypeItem::Compare( const SfxPoolItem &rWith, const IntlWrapper& rIntlWrapper ) const +{ + String aOwnText, aWithText; + GetPresentation( SFX_ITEM_PRESENTATION_NAMELESS, + SFX_MAPUNIT_APPFONT, SFX_MAPUNIT_APPFONT, aOwnText, &rIntlWrapper ); + rWith.GetPresentation( SFX_ITEM_PRESENTATION_NAMELESS, + SFX_MAPUNIT_APPFONT, SFX_MAPUNIT_APPFONT, aWithText, &rIntlWrapper ); + return rIntlWrapper.getCollator()->compareString( aOwnText, aWithText ); +} + +//---------------------------------------------------------------------------- +SfxItemPresentation CntContentTypeItem::GetPresentation( + SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + XubString & rText, + const IntlWrapper * pIntlWrapper) const +{ + if (_aPresentation.Len() == 0) + { + DBG_ASSERT(pIntlWrapper, + "CntContentTypeItem::GetPresentation(): No IntlWrapper"); + if (pIntlWrapper) + SAL_CONST_CAST(CntContentTypeItem *, this)->_aPresentation + = INetContentTypes::GetPresentation(GetEnumValue(), + pIntlWrapper-> + getLocale()); + } + if (_aPresentation.Len() > 0) + { + rText = _aPresentation; + return SFX_ITEM_PRESENTATION_COMPLETE; + } + else + return CntUnencodedStringItem::GetPresentation(ePres, eCoreMetric, + ePresMetric, rText, + pIntlWrapper); +} + +//---------------------------------------------------------------------------- +INetContentType CntContentTypeItem::GetEnumValue() const +{ + if ( _eType == CONTENT_TYPE_NOT_INIT ) + { + // Not yet initialized... Get enum value for string content type. + + CntContentTypeItem* pVarThis = SAL_CONST_CAST( CntContentTypeItem*, this ); + + pVarThis->_eType = INetContentTypes::GetContentType( GetValue() ); + } + + return _eType; +} + +//---------------------------------------------------------------------------- +void CntContentTypeItem::SetValue( const INetContentType eType ) +{ + SetValue( INetContentTypes::GetContentType( eType ) ); + + // Note: SetValue( const String& ....) resets _eType. Set new enum value + // after(!) calling it. + _eType = eType; +} + +//---------------------------------------------------------------------------- +// virtual +BOOL CntContentTypeItem::QueryValue( com::sun::star::uno::Any& rVal,BYTE ) const +{ + rVal <<= rtl::OUString(GetValue()); + return true; +} + +//---------------------------------------------------------------------------- +// virtual +BOOL CntContentTypeItem::PutValue( const com::sun::star::uno::Any& rVal,BYTE ) +{ + rtl::OUString aValue; + if ( rVal >>= aValue ) + { + // SetValue with an empty string resets the item; so call that + // function when PutValue is called with an empty string + if (aValue.getLength() == 0) + SetValue(aValue); + else + SetValue( + INetContentTypes::RegisterContentType(aValue, UniString())); + return true; + } + + DBG_ERROR( "CntContentTypeItem::PutValue - Wrong type!" ); + return false; +} diff --git a/svl/source/items/custritm.cxx b/svl/source/items/custritm.cxx new file mode 100644 index 000000000000..9f573beb56fd --- /dev/null +++ b/svl/source/items/custritm.cxx @@ -0,0 +1,141 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: custritm.cxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include + +#include +#include +#include + +//============================================================================ +// +// class CntUnencodedStringItem +// +//============================================================================ + +DBG_NAME(CntUnencodedStringItem) + +//============================================================================ +TYPEINIT1_AUTOFACTORY(CntUnencodedStringItem, SfxPoolItem) + +//============================================================================ +// virtual +int CntUnencodedStringItem::operator ==(const SfxPoolItem & rItem) const +{ + DBG_CHKTHIS(CntUnencodedStringItem, 0); + DBG_ASSERT(rItem.ISA(CntUnencodedStringItem), + "CntUnencodedStringItem::operator ==(): Bad type"); + return m_aValue + == SAL_STATIC_CAST(const CntUnencodedStringItem *, &rItem)-> + m_aValue; +} + +//============================================================================ +// virtual +int CntUnencodedStringItem::Compare(SfxPoolItem const & rWith) const +{ + DBG_ERROR("CntUnencodedStringItem::Compare(): No international"); + DBG_CHKTHIS(CntUnencodedStringItem, 0); + DBG_ASSERT(rWith.ISA(CntUnencodedStringItem), + "CntUnencodedStringItem::Compare(): Bad type"); + switch (m_aValue.CompareTo(static_cast< CntUnencodedStringItem const * >( + &rWith)-> + m_aValue)) + { + case COMPARE_LESS: + return -1; + + case COMPARE_EQUAL: + return 0; + + default: // COMPARE_GREATER + return 1; + } +} + +//============================================================================ +// virtual +int CntUnencodedStringItem::Compare(SfxPoolItem const & rWith, + IntlWrapper const & rIntlWrapper) + const +{ + DBG_CHKTHIS(CntUnencodedStringItem, 0); + DBG_ASSERT(rWith.ISA(CntUnencodedStringItem), + "CntUnencodedStringItem::Compare(): Bad type"); + return rIntlWrapper.getCollator()->compareString( m_aValue, + static_cast< CntUnencodedStringItem const * >(&rWith)->m_aValue ); +} + +//============================================================================ +// virtual +SfxItemPresentation +CntUnencodedStringItem::GetPresentation(SfxItemPresentation, SfxMapUnit, + SfxMapUnit, XubString & rText, + const IntlWrapper *) const +{ + DBG_CHKTHIS(CntUnencodedStringItem, 0); + rText = m_aValue; + return SFX_ITEM_PRESENTATION_NAMELESS; +} + +//============================================================================ +// virtual +BOOL CntUnencodedStringItem::QueryValue(com::sun::star::uno::Any& rVal, BYTE) + const +{ + rVal <<= rtl::OUString(m_aValue); + return true; +} + +//============================================================================ +// virtual +BOOL CntUnencodedStringItem::PutValue(const com::sun::star::uno::Any& rVal, + BYTE) +{ + rtl::OUString aTheValue; + if (rVal >>= aTheValue) + { + m_aValue = UniString(aTheValue); + return true; + } + DBG_ERROR("CntUnencodedStringItem::PutValue(): Wrong type"); + return false; +} + +//============================================================================ +// virtual +SfxPoolItem * CntUnencodedStringItem::Clone(SfxItemPool *) const +{ + DBG_CHKTHIS(CntUnencodedStringItem, 0); + return new CntUnencodedStringItem(*this); +} + diff --git a/svl/source/items/dateitem.cxx b/svl/source/items/dateitem.cxx new file mode 100644 index 000000000000..4ba6e1d460f9 --- /dev/null +++ b/svl/source/items/dateitem.cxx @@ -0,0 +1,284 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: dateitem.cxx,v $ + * $Revision: 1.8 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +// include --------------------------------------------------------------- + +#define _DATETIMEITEM_CXX +#include + +#include +#include + + +#include +#include +#include +#include +#include +#include + + +#include + +#include +#include + +// STATIC DATA ----------------------------------------------------------- + +DBG_NAME(SfxDateTimeItem) + + +// ----------------------------------------------------------------------- + +TYPEINIT1(SfxDateTimeItem, SfxPoolItem); + +// ----------------------------------------------------------------------- + +SfxDateTimeItem::SfxDateTimeItem( USHORT which ) : + SfxPoolItem( which ) +{ + DBG_CTOR(SfxDateTimeItem, 0); +} + +// ----------------------------------------------------------------------- + +SfxDateTimeItem::SfxDateTimeItem( USHORT which, const DateTime& rDT ) : + SfxPoolItem( which ), + aDateTime( rDT ) + +{ + DBG_CTOR(SfxDateTimeItem, 0); +} + +// ----------------------------------------------------------------------- + +SfxDateTimeItem::SfxDateTimeItem( const SfxDateTimeItem& rItem ) : + SfxPoolItem( rItem ), + aDateTime( rItem.aDateTime ) +{ + DBG_CTOR(SfxDateTimeItem, 0); +} + +// ----------------------------------------------------------------------- + +int SfxDateTimeItem::operator==( const SfxPoolItem& rItem ) const +{ + DBG_CHKTHIS(SfxDateTimeItem, 0); + DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); + return ( ( (SfxDateTimeItem&)rItem ).aDateTime == aDateTime ); +} + +// ----------------------------------------------------------------------- + +int SfxDateTimeItem::Compare( const SfxPoolItem& rItem ) const +{ + DBG_CHKTHIS(SfxDateTimeItem, 0); + DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); + + // da X.Compare( Y ) am String einem Compare( Y, X ) entspricht, + // vergleichen wir hier Y mit X + if ( ( (const SfxDateTimeItem&)rItem ).aDateTime < aDateTime ) + return -1; + else if ( ( (const SfxDateTimeItem&)rItem ).aDateTime == aDateTime ) + return 0; + else + return 1; +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxDateTimeItem::Create( SvStream& rStream, USHORT ) const +{ + DBG_CHKTHIS(SfxDateTimeItem, 0); + sal_uInt32 nDate = 0; + sal_Int32 nTime = 0; + rStream >> nDate; + rStream >> nTime; + DateTime aDT(nDate, nTime); + return new SfxDateTimeItem( Which(), aDT ); +} + +// ----------------------------------------------------------------------- + +SvStream& SfxDateTimeItem::Store( SvStream& rStream, USHORT ) const +{ + DBG_CHKTHIS(SfxDateTimeItem, 0); + rStream << aDateTime.GetDate(); + rStream << aDateTime.GetTime(); + return rStream; +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxDateTimeItem::Clone( SfxItemPool* ) const +{ + DBG_CHKTHIS(SfxDateTimeItem, 0); + return new SfxDateTimeItem( *this ); +} + +// ----------------------------------------------------------------------- + +SfxItemPresentation SfxDateTimeItem::GetPresentation +( + SfxItemPresentation /*ePresentation*/, + SfxMapUnit /*eCoreMetric*/, + SfxMapUnit /*ePresentationMetric*/, + XubString& rText, + const IntlWrapper * pIntlWrapper +) const +{ + DBG_CHKTHIS(SfxDateTimeItem, 0); + if (aDateTime.IsValid()) + if (pIntlWrapper) + { + rText = pIntlWrapper->getLocaleData()->getDate(aDateTime); + rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + rText += pIntlWrapper->getLocaleData()->getTime(aDateTime); + } + else + { + DBG_WARNING("SfxDateTimeItem::GetPresentation():" + " Using default en_US IntlWrapper"); + const IntlWrapper aIntlWrapper( + ::comphelper::getProcessServiceFactory(), LANGUAGE_ENGLISH_US ); + rText = aIntlWrapper.getLocaleData()->getDate(aDateTime); + rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + rText += aIntlWrapper.getLocaleData()->getTime(aDateTime); + } + else + rText.Erase(); + return SFX_ITEM_PRESENTATION_NAMELESS; +} + +//---------------------------------------------------------------------------- +// virtual +BOOL SfxDateTimeItem::PutValue( const com::sun::star::uno::Any& rVal, + BYTE nMemberId ) +{ + nMemberId &= ~CONVERT_TWIPS; + com::sun::star::util::DateTime aValue; + if ( rVal >>= aValue ) + { + aDateTime = DateTime( Date( aValue.Day, + aValue.Month, + aValue.Year ), + Time( aValue.Hours, + aValue.Minutes, + aValue.Seconds, + aValue.HundredthSeconds ) ); + return TRUE; + } + + DBG_ERROR( "SfxDateTimeItem::PutValue - Wrong type!" ); + return FALSE; +} + +//---------------------------------------------------------------------------- +// virtual +BOOL SfxDateTimeItem::QueryValue( com::sun::star::uno::Any& rVal, + BYTE nMemberId ) const +{ + nMemberId &= ~CONVERT_TWIPS; + com::sun::star::util::DateTime aValue( aDateTime.Get100Sec(), + aDateTime.GetSec(), + aDateTime.GetMin(), + aDateTime.GetHour(), + aDateTime.GetDay(), + aDateTime.GetMonth(), + aDateTime.GetYear() ); + rVal <<= aValue; + return TRUE; +} + +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- + +TYPEINIT1(SfxColumnDateTimeItem, SfxDateTimeItem); + + +SfxColumnDateTimeItem::SfxColumnDateTimeItem( USHORT which ) : + SfxDateTimeItem( which ) +{} + +SfxColumnDateTimeItem::SfxColumnDateTimeItem( USHORT which, const DateTime& rDT ) : + SfxDateTimeItem( which, rDT ) +{} + +SfxColumnDateTimeItem::SfxColumnDateTimeItem( const SfxDateTimeItem& rCpy ) : + SfxDateTimeItem( rCpy ) +{} + +SfxPoolItem* SfxColumnDateTimeItem::Clone( SfxItemPool* ) const +{ + return new SfxColumnDateTimeItem( *this ); +} + +SfxItemPresentation SfxColumnDateTimeItem::GetPresentation +( + SfxItemPresentation /*ePresentation*/, + SfxMapUnit /*eCoreMetric*/, + SfxMapUnit /*ePresentationMetric*/, + XubString& rText, + const IntlWrapper * pIntlWrapper +) const +{ + DBG_ASSERT(pIntlWrapper, + "SfxColumnDateTimeItem::GetPresentation():" + " Using default en_US IntlWrapper"); + + ::com::sun::star::lang::Locale aLocale; + if (GetDateTime() == DateTime(Date(1, 2, 3), Time(3, 2, 1))) + rText = String(SvtResId(STR_COLUM_DT_AUTO, + pIntlWrapper ? + pIntlWrapper->getLocale() : + aLocale)); + else if (pIntlWrapper) + { + rText = pIntlWrapper->getLocaleData()->getDate(GetDateTime()); + rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + rText += pIntlWrapper->getLocaleData()->getTime(GetDateTime()); + } + else + { + const IntlWrapper aIntlWrapper( + ::comphelper::getProcessServiceFactory(), LANGUAGE_ENGLISH_US ); + rText = aIntlWrapper.getLocaleData()->getDate(GetDateTime()); + rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + rText += aIntlWrapper.getLocaleData()->getTime(GetDateTime()); + } + return SFX_ITEM_PRESENTATION_NAMELESS; +} + + + diff --git a/svl/source/items/dtritem.cxx b/svl/source/items/dtritem.cxx new file mode 100644 index 000000000000..fa3a36b762f5 --- /dev/null +++ b/svl/source/items/dtritem.cxx @@ -0,0 +1,244 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: dtritem.cxx,v $ + * $Revision: 1.8 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include + +#include + + +DBG_NAME( SfxDateTimeRangeItem ) +TYPEINIT1( SfxDateTimeRangeItem, SfxPoolItem ); + +// ----------------------------------------------------------------------- + +SfxDateTimeRangeItem::SfxDateTimeRangeItem( USHORT which ) : + SfxPoolItem( which ) +{ + DBG_CTOR( SfxDateTimeRangeItem, 0 ); +} + +// ----------------------------------------------------------------------- + +SfxDateTimeRangeItem::SfxDateTimeRangeItem( USHORT which, const DateTime& rStartDT, + const DateTime& rEndDT ) : + SfxPoolItem( which ), + aStartDateTime( rStartDT ), + aEndDateTime( rEndDT ) +{ + DBG_CTOR( SfxDateTimeRangeItem, 0 ); +} + +// ----------------------------------------------------------------------- + +SfxDateTimeRangeItem::SfxDateTimeRangeItem( const SfxDateTimeRangeItem& rItem ) : + SfxPoolItem( rItem ), + aStartDateTime( rItem.aStartDateTime ), + aEndDateTime( rItem.aEndDateTime ) +{ + DBG_CTOR( SfxDateTimeRangeItem, 0 ); +} + +// ----------------------------------------------------------------------- + +int SfxDateTimeRangeItem::operator==( const SfxPoolItem& rItem ) const +{ + DBG_CHKTHIS( SfxDateTimeRangeItem, 0 ); + DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); + + return ((SfxDateTimeRangeItem&)rItem ).aStartDateTime == aStartDateTime && + ((SfxDateTimeRangeItem&)rItem ).aEndDateTime == aEndDateTime; +} + +// ----------------------------------------------------------------------- + +int SfxDateTimeRangeItem::Compare( const SfxPoolItem& rItem ) const +{ + DBG_CHKTHIS( SfxDateTimeRangeItem, 0 ); + DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); + + double fThisRange = aEndDateTime - aStartDateTime; + double fRange = ((const SfxDateTimeRangeItem&)rItem).aEndDateTime - + ((const SfxDateTimeRangeItem&)rItem).aStartDateTime; + + if ( ::rtl::math::approxEqual( fRange, fThisRange ) ) + return 0; + else if ( fRange < fThisRange ) + return -1; + else + return 1; +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxDateTimeRangeItem::Create( SvStream& rStream, USHORT ) const +{ + DBG_CHKTHIS(SfxDateTimeRangeItem, 0); + + sal_uInt32 nStartDate, nEndDate; + sal_Int32 nStartTime, nEndTime; + + rStream >> nStartDate; + rStream >> nStartTime; + + rStream >> nEndDate; + rStream >> nEndTime; + + DateTime aStartDT, aEndDT; + + aStartDT.SetDate( nStartDate ); + aStartDT.SetTime( nStartTime ); + + aEndDT.SetDate( nEndDate ); + aEndDT.SetTime( nEndTime ); + + return new SfxDateTimeRangeItem( Which(), aStartDT, aEndDT ); +} + +// ----------------------------------------------------------------------- + +SvStream& SfxDateTimeRangeItem::Store( SvStream& rStream, USHORT ) const +{ + DBG_CHKTHIS( SfxDateTimeRangeItem, 0 ); + + rStream << aStartDateTime.GetDate(); + rStream << aStartDateTime.GetTime(); + + rStream << aEndDateTime.GetDate(); + rStream << aEndDateTime.GetTime(); + + return rStream; +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxDateTimeRangeItem::Clone( SfxItemPool* ) const +{ + DBG_CHKTHIS( SfxDateTimeRangeItem, 0 ); + + return new SfxDateTimeRangeItem( *this ); +} +// ----------------------------------------------------------------------- + +SfxItemPresentation SfxDateTimeRangeItem::GetPresentation +( + SfxItemPresentation /*ePresentation*/, + SfxMapUnit /*eCoreMetric*/, + SfxMapUnit /*ePresentationMetric*/, + XubString& rText, + const IntlWrapper * pIntlWrapper +) const +{ + DBG_CHKTHIS(SfxDateTimeRangeItem, 0); + DateTime aRange(aEndDateTime - (const Time&)aStartDateTime); + if (pIntlWrapper) + { + rText = pIntlWrapper->getLocaleData()->getDate(aRange); + rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + rText += pIntlWrapper->getLocaleData()->getTime(aRange); + } + else + { + DBG_WARNING("SfxDateTimeRangeItem::GetPresentation():" + " Using default en_US IntlWrapper"); + const IntlWrapper aIntlWrapper( + ::comphelper::getProcessServiceFactory(), LANGUAGE_ENGLISH_US ); + rText = aIntlWrapper.getLocaleData()->getDate(aRange); + rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + rText += aIntlWrapper.getLocaleData()->getTime(aRange); + } + return SFX_ITEM_PRESENTATION_NAMELESS; +} + +//---------------------------------------------------------------------------- +// virtual +BOOL SfxDateTimeRangeItem::PutValue( const com::sun::star::uno::Any& rVal,BYTE ) +{ + com::sun::star::util::DateTimeRange aValue; + if ( rVal >>= aValue ) + { + aStartDateTime = DateTime( Date( aValue.StartDay, + aValue.StartMonth, + aValue.StartYear ), + Time( aValue.StartHours, + aValue.StartMinutes, + aValue.StartSeconds, + aValue.StartHundredthSeconds ) ); + aEndDateTime = DateTime( Date( aValue.EndDay, + aValue.EndMonth, + aValue.EndYear ), + Time( aValue.EndHours, + aValue.EndMinutes, + aValue.EndSeconds, + aValue.EndHundredthSeconds ) ); + return TRUE; + } + + DBG_ERROR( "SfxDateTimeRangeItem::PutValue - Wrong type!" ); + return FALSE; +} + +//---------------------------------------------------------------------------- +// virtual +BOOL SfxDateTimeRangeItem::QueryValue( com::sun::star::uno::Any& rVal, + BYTE nMemberId ) const +{ + nMemberId &= ~CONVERT_TWIPS; + com::sun::star::util::DateTimeRange aValue( aStartDateTime.Get100Sec(), + aStartDateTime.GetSec(), + aStartDateTime.GetMin(), + aStartDateTime.GetHour(), + aStartDateTime.GetDay(), + aStartDateTime.GetMonth(), + aStartDateTime.GetYear(), + aEndDateTime.Get100Sec(), + aEndDateTime.GetSec(), + aEndDateTime.GetMin(), + aEndDateTime.GetHour(), + aEndDateTime.GetDay(), + aEndDateTime.GetMonth(), + aEndDateTime.GetYear() ); + rVal <<= aValue; + return TRUE; +} + + diff --git a/svl/source/items/eitem.cxx b/svl/source/items/eitem.cxx new file mode 100644 index 000000000000..f7b95665391d --- /dev/null +++ b/svl/source/items/eitem.cxx @@ -0,0 +1,50 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: eitem.cxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include +//============================================================================ +// +// class SfxEnumItem +// +//============================================================================ + +TYPEINIT1(SfxEnumItem, CntEnumItem); + +//============================================================================ +// +// class SfxBoolItem +// +//============================================================================ + +TYPEINIT1_AUTOFACTORY(SfxBoolItem, CntBoolItem); + + diff --git a/svl/source/items/flagitem.cxx b/svl/source/items/flagitem.cxx new file mode 100644 index 000000000000..e59f981c5afa --- /dev/null +++ b/svl/source/items/flagitem.cxx @@ -0,0 +1,166 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: flagitem.cxx,v $ + * $Revision: 1.11 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include +#include +#include + +// STATIC DATA ----------------------------------------------------------- + +DBG_NAME(SfxFlagItem) + +USHORT nSfxFlagVal[16] = +{ + 0x0001, 0x0002, 0x0004, 0x0008, + 0x0010, 0x0020, 0x0040, 0x0080, + 0x0100, 0x0200, 0x0400, 0x0800, + 0x1000, 0x2000, 0x4000, 0x8000 +}; + + +// ----------------------------------------------------------------------- + +TYPEINIT1(SfxFlagItem, SfxPoolItem); + +// ----------------------------------------------------------------------- + +SfxFlagItem::SfxFlagItem( USHORT nW, USHORT nV ) : + SfxPoolItem( nW ), + nVal(nV) +{ + DBG_CTOR(SfxFlagItem, 0); +} + +// ----------------------------------------------------------------------- + +SfxFlagItem::SfxFlagItem( USHORT nW, SvStream &rStream) : + SfxPoolItem( nW ) +{ + DBG_CTOR(SfxFlagItem, 0); + rStream >> nVal; +} + +// ----------------------------------------------------------------------- + +SfxFlagItem::SfxFlagItem( const SfxFlagItem& rItem ) : + SfxPoolItem( rItem ), + nVal( rItem.nVal ) +{ + DBG_CTOR(SfxFlagItem, 0); +} + +// ----------------------------------------------------------------------- + +SvStream& SfxFlagItem::Store(SvStream &rStream, USHORT) const +{ + DBG_CHKTHIS(SfxFlagItem, 0); + rStream << nVal; + return rStream; +} + +// ----------------------------------------------------------------------- + +SfxItemPresentation SfxFlagItem::GetPresentation +( + SfxItemPresentation /*ePresentation*/, + SfxMapUnit /*eCoreMetric*/, + SfxMapUnit /*ePresentationMetric*/, + XubString& rText, + const IntlWrapper * +) const +{ + DBG_CHKTHIS(SfxFlagItem, 0); + rText.Erase(); + for ( BYTE nFlag = 0; nFlag < GetFlagCount(); ++nFlag ) + rText += XubString::CreateFromInt32( GetFlag(nFlag) ); + return SFX_ITEM_PRESENTATION_NAMELESS; +} + +// ----------------------------------------------------------------------- + +XubString SfxFlagItem::GetFlagText( BYTE ) const +{ + DBG_CHKTHIS(SfxFlagItem, 0); + DBG_WARNING( "calling GetValueText(USHORT) on SfxFlagItem -- overload!" ); + return XubString(); +} + +// ----------------------------------------------------------------------- + +BYTE SfxFlagItem::GetFlagCount() const +{ + DBG_CHKTHIS(SfxFlagItem, 0); + DBG_WARNING( "calling GetValueText(USHORT) on SfxFlagItem -- overload!" ); + return 0; +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxFlagItem::Create(SvStream &, USHORT) const +{ + DBG_CHKTHIS(SfxFlagItem, 0); + DBG_WARNING( "calling Create() on SfxFlagItem -- overload!" ); + return 0; +} + +// ----------------------------------------------------------------------- + +int SfxFlagItem::operator==( const SfxPoolItem& rItem ) const +{ + DBG_CHKTHIS(SfxFlagItem, 0); + DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); + return (((SfxFlagItem&)rItem).nVal == nVal); +} + +// ----------------------------------------------------------------------- + +void SfxFlagItem::SetFlag( BYTE nFlag, int bVal ) +{ + if ( bVal ) + nVal |= nSfxFlagVal[nFlag]; + else + nVal &= ~nSfxFlagVal[nFlag]; +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxFlagItem::Clone(SfxItemPool *) const +{ + DBG_CHKTHIS(SfxFlagItem, 0); + return new SfxFlagItem( *this ); +} + + + + + diff --git a/svl/source/items/frqitem.cxx b/svl/source/items/frqitem.cxx new file mode 100644 index 000000000000..4068ef8f97f1 --- /dev/null +++ b/svl/source/items/frqitem.cxx @@ -0,0 +1,580 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: frqitem.cxx,v $ + * $Revision: 1.8.136.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#ifndef GCC +#endif + +#include + +#include +#include +#include + +#include + +DBG_NAME( SfxFrequencyItem ) + +TYPEINIT1( SfxFrequencyItem, SfxPoolItem ); + +#define MAX_GOTO 32000 + +#define DECL_SAVE_GOTO() \ + ULONG nSafetyMeasures = 0; + +#define SAVE_GOTO(tag) \ + if(nSafetyMeasures < MAX_GOTO) \ + { nSafetyMeasures++; goto tag; } + +// ----------------------------------------------------------------------- + +SfxFrequencyItem::SfxFrequencyItem( USHORT which ) : + SfxPoolItem ( which ), + eFrqMode ( FRQ_DAILY ), + eFrqTimeMode ( FRQ_TIME_AT ), + nDInterval1 ( 1 ), + nDInterval2 ( 0 ), + nDInterval3 ( 0 ), + nTInterval1 ( 1 ), + aTime1 ( Time( 12, 0, 0 ) ), + aTime2 ( Time( 12, 0, 0 ) ), + bMissingDate ( FALSE ), + aMissingDate ( DateTime(0, 0) ) +{ + DBG_CTOR( SfxFrequencyItem, 0 ); +} + +// ----------------------------------------------------------------------- + +SfxFrequencyItem::SfxFrequencyItem( USHORT which, FrequencyMode eMode, FrequencyTimeMode eTMode, + USHORT nDI1, USHORT nDI2, USHORT nDI3, USHORT nTI1, + const Time& rT1, const Time& rT2 ) : + SfxPoolItem ( which ), + eFrqMode ( eMode ), + eFrqTimeMode ( eTMode ), + nDInterval1 ( nDI1 ), + nDInterval2 ( nDI2 ), + nDInterval3 ( nDI3 ), + nTInterval1 ( nTI1 ), + aTime1 ( rT1 ), + aTime2 ( rT2 ), + bMissingDate ( FALSE ) +{ + DBG_CTOR( SfxFrequencyItem, 0 ); +} + +// ----------------------------------------------------------------------- + +SfxFrequencyItem::SfxFrequencyItem( const SfxFrequencyItem& rItem ) : + SfxPoolItem ( rItem ), + eFrqMode ( rItem.eFrqMode ), + eFrqTimeMode ( rItem.eFrqTimeMode ), + nDInterval1 ( rItem.nDInterval1 ), + nDInterval2 ( rItem.nDInterval2 ), + nDInterval3 ( rItem.nDInterval3 ), + nTInterval1 ( rItem.nTInterval1 ), + aTime1 ( rItem.aTime1 ), + aTime2 ( rItem.aTime2 ), + bMissingDate ( rItem.bMissingDate ) +{ + DBG_CTOR( SfxFrequencyItem, 0 ); +} + +// ----------------------------------------------------------------------- + +int SfxFrequencyItem::operator==( const SfxPoolItem& rItem ) const +{ + DBG_CHKTHIS( SfxFrequencyItem, 0 ); + DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); + + return ((SfxFrequencyItem&)rItem ).eFrqMode == eFrqMode && + ((SfxFrequencyItem&)rItem ).eFrqTimeMode == eFrqTimeMode && + ((SfxFrequencyItem&)rItem ).nDInterval1 == nDInterval1 && + ((SfxFrequencyItem&)rItem ).nDInterval2 == nDInterval2 && + ((SfxFrequencyItem&)rItem ).nDInterval3 == nDInterval3 && + ((SfxFrequencyItem&)rItem ).nTInterval1 == nTInterval1 && + ((SfxFrequencyItem&)rItem ).aTime1 == aTime1 && + ((SfxFrequencyItem&)rItem ).aTime2 == aTime2; +} + +// ----------------------------------------------------------------------- + +int SfxFrequencyItem::Compare( const SfxPoolItem& +#ifdef DBG_UTIL +rItem +#endif +) const +{ + DBG_CHKTHIS( SfxFrequencyItem, 0 ); + DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); + +/* DateTime aThisRange( aEndDateTime - aStartDateTime ); + DateTime aRange(((const SfxFrequencyItem&)rItem).aEndDateTime - + ((const SfxFrequencyItem&)rItem).aStartDateTime ); + if( aRange < aThisRange ) + return -1; + else if( aRange == aThisRange ) + return 0; + else +*/ + return 1; +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxFrequencyItem::Create( SvStream& rStream, USHORT ) const +{ + DBG_CHKTHIS(SfxFrequencyItem, 0); + + USHORT _eFrqMode; + USHORT _eFrqTimeMode; + USHORT _nDInterval1; + USHORT _nDInterval2; + USHORT _nDInterval3; + USHORT _nTInterval1; + long _nTime1; + long _nTime2; + + rStream >> _eFrqMode; + rStream >> _eFrqTimeMode; + rStream >> _nDInterval1; + rStream >> _nDInterval2; + rStream >> _nDInterval3; + rStream >> _nTInterval1; + rStream >> _nTime1; + rStream >> _nTime2; + + return new SfxFrequencyItem( Which(), (FrequencyMode)_eFrqMode, + (FrequencyTimeMode) _eFrqTimeMode, _nDInterval1, _nDInterval2, _nDInterval3, + _nTInterval1, Time(_nTime1), Time(_nTime2) ); +} + +// ----------------------------------------------------------------------- + +SvStream& SfxFrequencyItem::Store( SvStream& rStream, USHORT ) const +{ + DBG_CHKTHIS( SfxFrequencyItem, 0 ); + + USHORT nEMode = (USHORT)eFrqMode; + USHORT nETimeMode = (USHORT)eFrqTimeMode; + + rStream << (USHORT) nEMode; + rStream << (USHORT) nETimeMode; + + rStream << nDInterval1; + rStream << nDInterval2; + rStream << nDInterval3; + + rStream << nTInterval1; + rStream << aTime1.GetTime(); + rStream << aTime2.GetTime(); + + return rStream; +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxFrequencyItem::Clone( SfxItemPool* ) const +{ + DBG_CHKTHIS( SfxFrequencyItem, 0 ); + return new SfxFrequencyItem( *this ); +} + +// ----------------------------------------------------------------------- + +SfxItemPresentation SfxFrequencyItem::GetPresentation +( + SfxItemPresentation /*ePresentation*/, + SfxMapUnit /*eCoreMetric*/, + SfxMapUnit /*ePresentationMetric*/, + XubString& rText, + const IntlWrapper * +) const +{ + DBG_CHKTHIS(SfxFrequencyItem, 0); + rText.AssignAscii(RTL_CONSTASCII_STRINGPARAM("SNIY")); + return SFX_ITEM_PRESENTATION_NAMELESS; +} + +// ----------------------------------------------------------------------- + +Time SfxFrequencyItem::_CalcTime( BOOL bForToday ) const +{ + Time aNow; + Time aTime; + + DECL_SAVE_GOTO(); + + switch( eFrqTimeMode ) + { + ////////////////////////////////////////////////////////// + // FRQ_TIME_AT + // + // Update um Uhrzeit + // nTime1 = 00:00:00 - 24:00:00 + // + case FRQ_TIME_AT : + aTime = aTime1; + break; + + ////////////////////////////////////////////////////////// + // FRQ_TIME_REPEAT + // + // Wiederhole alle X Stunden + // nTInterval1 = 1 .. 8 + // + case FRQ_TIME_REPEAT : + aTime = Time( 0, 0 ); + if( bForToday ) + { + + RECALC_TIME_REPEAT: + if( aNow > aTime ) + { + aTime += Time( nTInterval1, 0 ); + SAVE_GOTO( RECALC_TIME_REPEAT ); + } + break; + } + break; + + ////////////////////////////////////////////////////////// + // FRQ_TIME_REPEAT_RANGE + // + // FRQ_TIME_REPEAT zwischen Uhrzeit 1 und 2 + // nTime1 = 00:00:00 - 24:00:00 + // nTime2 = 00:00:00 - 24:00:00 + // + case FRQ_TIME_REPEAT_RANGE : + aTime = aTime1; + if( bForToday ) + { + if( aNow > aTime2 ) + return aTime1; + + RECALC_TIME_REPEAT_RANGE: + if( aNow > aTime ) + { + aTime += Time( nTInterval1, 0 ); + if( aTime > aTime2 ) + return aTime1; + SAVE_GOTO( RECALC_TIME_REPEAT_RANGE ); + } + break; + } + break; + } + return aTime; +} + +DateTime SfxFrequencyItem::CalcNextTick( const DateTime& rBase, BOOL bFirst ) +{ + Date aDateToday; + Time aTimeToday; + Date aDateBase; + Time aTimeBase; + + if( bFirst ) + { + aDateBase = Date( 17, 2, 1969 ); + aTimeBase = Time( 8, 0, 0 ); + } + else + { + aDateBase = rBase.GetDate(); + aTimeBase = rBase.GetTime(); + } + + Time aNextTime( _CalcTime(FALSE) ); + Date aNextDate( aDateBase ); + bMissingDate = FALSE; + + DECL_SAVE_GOTO(); + + switch( eFrqMode ) + { + ////////////////////////////////////////////////////////// + // FRQ_DAILY + // + // jeden X'ten Tag + // nInterval1 = 1 .. 999 + // + // jeden Wochentag + // nInterval1 = USHRT_MAX + // + case FRQ_DAILY : + { + if( bFirst ) + { + aNextTime = _CalcTime( TRUE ); + if( aNextTime < aTimeToday ) + { + aNextTime = _CalcTime( FALSE ); + aNextDate = aDateToday + (USHORT) + ((nDInterval1 == USHRT_MAX)? 1 : nDInterval1); + } + else + aNextDate = aDateToday; + break; + } + + RECALC_FRQ_DAILY: + if( aNextDate < aDateToday ) + { + bMissingDate = TRUE; + aMissingDate.SetDate(aNextDate.GetDate()); + aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); + + aNextDate += (USHORT)((nDInterval1 == USHRT_MAX)? 1 : nDInterval1); + SAVE_GOTO( RECALC_FRQ_DAILY ); + } + + if( aNextDate == aDateToday ) + { + aNextTime = _CalcTime( TRUE ); + if( aNextTime < aTimeToday ) + { + bMissingDate = TRUE; + aMissingDate.SetDate(aNextDate.GetDate()); + aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); + + aNextDate += (USHORT)((nDInterval1 == USHRT_MAX)? 1 : nDInterval1); + aNextTime = _CalcTime( FALSE ); + } + } + else + aNextTime = _CalcTime( FALSE ); + } break; + + ////////////////////////////////////////////////////////// + // FRQ_WEEKLY + // wiederhole jede X'te Woche + // nInterval1 = 1 .. 99 + // + // an SU, MO, TU, WE, TH, FR, SA + // nInterval2 = WD_SUNDAY | WD_MONDAY | WD_TUESDAY | + // WD_WEDNESDAY | WD_THURSDAY | WD_FRIDAY | + // WD_SATURDAY + // + case FRQ_WEEKLY : + { + BOOL bInRecalc = FALSE; + + RECALC_FRQ_WEEKLY: + if( !bFirst || bInRecalc ) + aNextDate += (nDInterval1 - 1) * 7; + + aNextDate -= (USHORT) ((aNextDate.GetDayOfWeek() != SUNDAY) ? + aNextDate.GetDayOfWeek() + 1 : 0); + + if( nDInterval2 & WD_SUNDAY && (aNextDate >= aDateToday) ) + aNextDate += 0; + else if( nDInterval2 & WD_MONDAY && (aNextDate + 1 >= aDateToday) ) + aNextDate += 1; + else if( nDInterval2 & WD_TUESDAY && (aNextDate + 2 >= aDateToday) ) + aNextDate += 2; + else if( nDInterval2 & WD_WEDNESDAY && (aNextDate + 3 >= aDateToday) ) + aNextDate += 3; + else if( nDInterval2 & WD_THURSDAY && (aNextDate + 4 >= aDateToday) ) + aNextDate += 4; + else if( nDInterval2 & WD_FRIDAY && (aNextDate + 5 >= aDateToday) ) + aNextDate += 5; + else if( nDInterval2 & WD_SATURDAY && (aNextDate + 6 >= aDateToday) ) + aNextDate += 6; + + if( aNextDate < aDateToday ) + { + bMissingDate = TRUE; + aMissingDate.SetDate(aNextDate.GetDate()); + aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); + + bInRecalc = TRUE; + aNextDate += 7; + SAVE_GOTO( RECALC_FRQ_WEEKLY ); + } + if( aNextDate == aDateToday ) + { + aNextTime = _CalcTime( TRUE ); + if( aNextTime < aTimeToday ) + { + bInRecalc = TRUE; + aNextDate += 7; + SAVE_GOTO( RECALC_FRQ_WEEKLY ); + } + } + else + aNextTime = _CalcTime( FALSE ); + } break; + + ////////////////////////////////////////////////////////// + // FRQ_MONTHLY_DAILY + // + // jeden X'ten Tag von jedem X'ten Monat + // nInterval1 = 1 .. 31 + // nInterval2 = 1 .. 6 + // + case FRQ_MONTHLY_DAILY : + { + BOOL bInRecalc = FALSE; + aNextDate.SetDay( nDInterval1 ); + + RECALC_FRQ_MONTHLY_DAILY: + if( nDInterval2 > 1 || bInRecalc ) + { + long nMonth = aNextDate.GetMonth() - 1; + nMonth += nDInterval2; + aNextDate.SetYear( + sal::static_int_cast< USHORT >( + aNextDate.GetYear() + nMonth / 12 ) ); + aNextDate.SetMonth( + sal::static_int_cast< USHORT >( ( nMonth % 12 ) + 1 ) ); + } + + if( aNextDate < aDateToday ) + { + bMissingDate = TRUE; + aMissingDate.SetDate(aNextDate.GetDate()); + aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); + + bInRecalc = TRUE; + SAVE_GOTO( RECALC_FRQ_MONTHLY_DAILY ); + } + + if( aNextDate == aDateToday ) + { + aNextTime = _CalcTime( TRUE ); + if( aNextTime < aTimeToday ) + { + bMissingDate = TRUE; + aMissingDate.SetDate(aNextDate.GetDate()); + aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); + + bInRecalc = TRUE; + SAVE_GOTO( RECALC_FRQ_MONTHLY_DAILY ); + } + } + else + aNextTime = _CalcTime( FALSE ); + } break; + + ////////////////////////////////////////////////////////// + // FRQ_MONTHLY_LOGIC + // + // jeden ersten, zweiten, dritten, vierten oder letzten + // Wochentag jeden X'ten Monats + // nInterval1 = 0 .. 4 + // nInterval2 = WD_SUNDAY | WD_MONDAY | WD_TUESDAY | + // WD_WEDNESDAY | WD_THURSDAY | WD_FRIDAY | + // WD_SATURDAY + // nInterval3 = 1 .. 6 + // + case FRQ_MONTHLY_LOGIC : + { + BOOL bInRecalc = FALSE; + + RECALC_FRQ_MONTHLY_LOGIC: + if( nDInterval3 > 1 || bInRecalc ) + { + long nMonth = aNextDate.GetMonth() - 1; + nMonth += nDInterval3; + aNextDate.SetYear( + sal::static_int_cast< USHORT >( + aNextDate.GetYear() + nMonth / 12 ) ); + aNextDate.SetMonth( + sal::static_int_cast< USHORT >( ( nMonth % 12 ) + 1 ) ); + } + + USHORT nDay; + if( nDInterval2 & WD_SUNDAY ) + nDay = 6; + else if( nDInterval2 & WD_MONDAY ) + nDay = 0; + else if( nDInterval2 & WD_TUESDAY ) + nDay = 1; + else if( nDInterval2 & WD_WEDNESDAY ) + nDay = 2; + else if( nDInterval2 & WD_THURSDAY ) + nDay = 3; + else if( nDInterval2 & WD_FRIDAY ) + nDay = 4; + else nDay = 5; + + if( nDInterval1 == 4 ) + { + DateTime aDT = aNextDate; + aDT.SetDay( 1 ); + aDT += (long)(aNextDate.GetDaysInMonth() - 1); + if( aDT.GetDayOfWeek() != nDay ) + for( aDT--; aDT.GetDayOfWeek() != nDay; aDT-- ) ; + aNextDate = aDT; + } + else + { + DateTime aDT = aNextDate; + aDT.SetDay( 1 ); + aDT += (long)(nDay - USHORT(aDT.GetDayOfWeek())); + if( aDT.GetMonth() != aNextDate.GetMonth() ) + aDT += 7L; + aDT += (long)(nDInterval1 * 7); + aNextDate = aDT; + } + + if( aNextDate < aDateToday ) + { + bMissingDate = TRUE; + aMissingDate.SetDate(aNextDate.GetDate()); + aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); + + bInRecalc = TRUE; + SAVE_GOTO( RECALC_FRQ_MONTHLY_LOGIC ); + } + + if( aNextDate == aDateToday ) + { + aNextTime = _CalcTime( TRUE ); + if( aNextTime < aTimeToday ) + { + bMissingDate = TRUE; + aMissingDate.SetDate(aNextDate.GetDate()); + aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); + + bInRecalc = TRUE; + SAVE_GOTO( RECALC_FRQ_MONTHLY_LOGIC ); + } + } + else + aNextTime = _CalcTime( FALSE ); + } break; + } + + return DateTime( aNextDate, aNextTime ); +} + diff --git a/svl/source/items/globalnameitem.cxx b/svl/source/items/globalnameitem.cxx new file mode 100644 index 000000000000..6a8359fb39b8 --- /dev/null +++ b/svl/source/items/globalnameitem.cxx @@ -0,0 +1,117 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: globalnameitem.cxx,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include +#include +#include + +#include + +#include + +#include + +// STATIC DATA ----------------------------------------------------------- + + +// ----------------------------------------------------------------------- + +TYPEINIT1_AUTOFACTORY(SfxGlobalNameItem, SfxPoolItem); + +// ----------------------------------------------------------------------- + +SfxGlobalNameItem::SfxGlobalNameItem() +{ +} + +// ----------------------------------------------------------------------- + +SfxGlobalNameItem::SfxGlobalNameItem( USHORT nW, const SvGlobalName& rName ) +: SfxPoolItem( nW ), + m_aName( rName ) +{ +} + +// ----------------------------------------------------------------------- + +SfxGlobalNameItem::~SfxGlobalNameItem() +{ +} + +// ----------------------------------------------------------------------- + +int SfxGlobalNameItem::operator==( const SfxPoolItem& rItem ) const +{ + return ((SfxGlobalNameItem&)rItem).m_aName == m_aName; +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxGlobalNameItem::Clone(SfxItemPool *) const +{ + return new SfxGlobalNameItem( *this ); +} + +//---------------------------------------------------------------------------- +// virtual +BOOL SfxGlobalNameItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE ) +{ + com::sun::star::uno::Reference < com::sun::star::script::XTypeConverter > xConverter + ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.script.Converter")), + com::sun::star::uno::UNO_QUERY ); + com::sun::star::uno::Sequence< sal_Int8 > aSeq; + com::sun::star::uno::Any aNew; + + try { aNew = xConverter->convertTo( rVal, ::getCppuType((const com::sun::star::uno::Sequence < sal_Int8 >*)0) ); } + catch (com::sun::star::uno::Exception&) {} + aNew >>= aSeq; + if ( aSeq.getLength() == 16 ) + { + m_aName.MakeFromMemory( (void*) aSeq.getConstArray() ); + return TRUE; + } + + DBG_ERROR( "SfxGlobalNameItem::PutValue - Wrong type!" ); + return FALSE; +} + +//---------------------------------------------------------------------------- +// virtual +BOOL SfxGlobalNameItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE ) const +{ + com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 ); + void* pData = ( void* ) &m_aName.GetCLSID(); + memcpy( aSeq.getArray(), pData, 16 ); + rVal <<= aSeq; + return TRUE; +} + diff --git a/svl/source/items/ilstitem.cxx b/svl/source/items/ilstitem.cxx new file mode 100644 index 000000000000..a26c054eeadb --- /dev/null +++ b/svl/source/items/ilstitem.cxx @@ -0,0 +1,106 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ilstitem.cxx,v $ + * $Revision: 1.8 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include +#include + +#include + +#include + +#define _SVSTDARR_ULONGS +#include + +TYPEINIT1_AUTOFACTORY(SfxIntegerListItem, SfxPoolItem); + +SfxIntegerListItem::SfxIntegerListItem() +{ +} + +SfxIntegerListItem::SfxIntegerListItem( USHORT which, const SvULongs& rList ) + : SfxPoolItem( which ) +{ + m_aList.realloc( rList.Count() ); + for ( USHORT n=0; n xConverter + ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.script.Converter")), + ::com::sun::star::uno::UNO_QUERY ); + ::com::sun::star::uno::Any aNew; + try { aNew = xConverter->convertTo( rVal, ::getCppuType((const ::com::sun::star::uno::Sequence < sal_Int32 >*)0) ); } + catch (::com::sun::star::uno::Exception&) + { + return FALSE; + } + + return ( aNew >>= m_aList ); +} + +BOOL SfxIntegerListItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE ) const +{ + rVal <<= m_aList; + return TRUE; +} + +void SfxIntegerListItem::GetList( SvULongs& rList ) const +{ + for ( sal_Int32 n=0; n(n) ); +} diff --git a/svl/source/items/imageitm.cxx b/svl/source/items/imageitm.cxx new file mode 100644 index 000000000000..cc4a2ebd4f3b --- /dev/null +++ b/svl/source/items/imageitm.cxx @@ -0,0 +1,148 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: imageitm.cxx,v $ + * $Revision: 1.9 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include +#include + +TYPEINIT1( SfxImageItem, SfxInt16Item ); + +struct SfxImageItem_Impl +{ + String aURL; + long nAngle; + BOOL bMirrored; + int operator == ( const SfxImageItem_Impl& rOther ) const + { return nAngle == rOther.nAngle && bMirrored == rOther.bMirrored; } +}; + +//--------------------------------------------------------- + +SfxImageItem::SfxImageItem( USHORT which, UINT16 nImage ) + : SfxInt16Item( which, nImage ) +{ + pImp = new SfxImageItem_Impl; + pImp->nAngle = 0; + pImp->bMirrored = FALSE; +} + +SfxImageItem::SfxImageItem( USHORT which, const String& rURL ) + : SfxInt16Item( which, 0 ) +{ + pImp = new SfxImageItem_Impl; + pImp->nAngle = 0; + pImp->bMirrored = FALSE; + pImp->aURL = rURL; +} + +SfxImageItem::SfxImageItem( const SfxImageItem& rItem ) + : SfxInt16Item( rItem ) +{ + pImp = new SfxImageItem_Impl( *(rItem.pImp) ); +} + +//--------------------------------------------------------- +SfxImageItem::~SfxImageItem() +{ + delete pImp; +} + +//--------------------------------------------------------- + +SfxPoolItem* SfxImageItem::Clone( SfxItemPool* ) const +{ + return new SfxImageItem( *this ); +} + +//--------------------------------------------------------- + +int SfxImageItem::operator==( const SfxPoolItem& rItem ) const +{ + return( ((SfxImageItem&) rItem).GetValue() == GetValue() && (*pImp == *(((SfxImageItem&)rItem).pImp) ) ); +} + +BOOL SfxImageItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE ) const +{ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aSeq( 4 ); + aSeq[0] = ::com::sun::star::uno::makeAny( GetValue() ); + aSeq[1] = ::com::sun::star::uno::makeAny( pImp->nAngle ); + aSeq[2] = ::com::sun::star::uno::makeAny( pImp->bMirrored ); + aSeq[3] = ::com::sun::star::uno::makeAny( rtl::OUString( pImp->aURL )); + + rVal = ::com::sun::star::uno::makeAny( aSeq ); + return TRUE; +} + +BOOL SfxImageItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE ) +{ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aSeq; + if (( rVal >>= aSeq ) && ( aSeq.getLength() == 4 )) + { + sal_Int16 nVal = sal_Int16(); + rtl::OUString aURL; + if ( aSeq[0] >>= nVal ) + SetValue( nVal ); + aSeq[1] >>= pImp->nAngle; + aSeq[2] >>= pImp->bMirrored; + if ( aSeq[3] >>= aURL ) + pImp->aURL = aURL; + return TRUE; + } + + return FALSE; +} + +void SfxImageItem::SetRotation( long nValue ) +{ + pImp->nAngle = nValue; +} + +long SfxImageItem::GetRotation() const +{ + return pImp->nAngle; +} + +void SfxImageItem::SetMirrored( BOOL bSet ) +{ + pImp->bMirrored = bSet; +} + +BOOL SfxImageItem::IsMirrored() const +{ + return pImp->bMirrored; +} + +String SfxImageItem::GetURL() const +{ + return pImp->aURL; +} + diff --git a/svl/source/items/intitem.cxx b/svl/source/items/intitem.cxx new file mode 100644 index 000000000000..b20f245f964b --- /dev/null +++ b/svl/source/items/intitem.cxx @@ -0,0 +1,261 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: intitem.cxx,v $ + * $Revision: 1.9 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include +#include +#include +#include +#include + +//============================================================================ +// +// class SfxByteItem +// +//============================================================================ + +TYPEINIT1_AUTOFACTORY(SfxByteItem, CntByteItem); + +//============================================================================ +// virtual +SfxPoolItem * SfxByteItem::Create(SvStream & rStream, USHORT) const +{ + short nValue = 0; + rStream >> nValue; + return new SfxByteItem(Which(), BYTE(nValue)); +} + +//============================================================================ +// +// class SfxInt16Item +// +//============================================================================ + +DBG_NAME(SfxInt16Item); + +//============================================================================ +TYPEINIT1_AUTOFACTORY(SfxInt16Item, SfxPoolItem); + +//============================================================================ +SfxInt16Item::SfxInt16Item(USHORT which, SvStream & rStream): + SfxPoolItem(which) +{ + DBG_CTOR(SfxInt16Item, 0); + short nTheValue = 0; + rStream >> nTheValue; + m_nValue = nTheValue; +} + +//============================================================================ +// virtual +int SfxInt16Item::operator ==(const SfxPoolItem & rItem) const +{ + DBG_CHKTHIS(SfxInt16Item, 0); + DBG_ASSERT(SfxPoolItem::operator ==(rItem), "unequal type"); + return m_nValue == SAL_STATIC_CAST(const SfxInt16Item *, &rItem)-> + m_nValue; +} + +//============================================================================ +// virtual +int SfxInt16Item::Compare(const SfxPoolItem & rWith) const +{ + DBG_CHKTHIS(SfxInt16Item, 0); + DBG_ASSERT(SfxPoolItem::operator ==(rWith), "unequal type"); + return SAL_STATIC_CAST(const SfxInt16Item *, &rWith)->m_nValue + < m_nValue ? + -1 : + SAL_STATIC_CAST(const SfxInt16Item *, &rWith)->m_nValue + == m_nValue ? + 0 : 1; +} + +//============================================================================ +// virtual +SfxItemPresentation SfxInt16Item::GetPresentation(SfxItemPresentation, + SfxMapUnit, SfxMapUnit, + XubString & rText, + const IntlWrapper *) const +{ + DBG_CHKTHIS(SfxInt16Item, 0); + rText = UniString::CreateFromInt32(m_nValue); + return SFX_ITEM_PRESENTATION_NAMELESS; +} + + +//============================================================================ +// virtual +BOOL SfxInt16Item::QueryValue(com::sun::star::uno::Any& rVal, BYTE) const +{ + sal_Int16 nValue = m_nValue; + rVal <<= nValue; + return TRUE; +} + +//============================================================================ +// virtual +BOOL SfxInt16Item::PutValue(const com::sun::star::uno::Any& rVal, BYTE ) +{ + sal_Int16 nValue = sal_Int16(); + if (rVal >>= nValue) + { + m_nValue = nValue; + return TRUE; + } + + DBG_ERROR( "SfxInt16Item::PutValue - Wrong type!" ); + return FALSE; +} + +//============================================================================ +// virtual +SfxPoolItem * SfxInt16Item::Create(SvStream & rStream, USHORT) const +{ + DBG_CHKTHIS(SfxInt16Item, 0); + return new SfxInt16Item(Which(), rStream); +} + +//============================================================================ +// virtual +SvStream & SfxInt16Item::Store(SvStream & rStream, USHORT) const +{ + DBG_CHKTHIS(SfxInt16Item, 0); + rStream << short(m_nValue); + return rStream; +} + +//============================================================================ +SfxPoolItem * SfxInt16Item::Clone(SfxItemPool *) const +{ + DBG_CHKTHIS(SfxInt16Item, 0); + return new SfxInt16Item(*this); +} + +//============================================================================ +INT16 SfxInt16Item::GetMin() const +{ + DBG_CHKTHIS(SfxInt16Item, 0); + return -32768; +} + +//============================================================================ +INT16 SfxInt16Item::GetMax() const +{ + DBG_CHKTHIS(SfxInt16Item, 0); + return 32767; +} + +//============================================================================ +SfxFieldUnit SfxInt16Item::GetUnit() const +{ + DBG_CHKTHIS(SfxInt16Item, 0); + return SFX_FUNIT_NONE; +} + +//============================================================================ +// +// class SfxUInt16Item +// +//============================================================================ + +TYPEINIT1_AUTOFACTORY(SfxUInt16Item, CntUInt16Item); + + +//============================================================================ +// +// class SfxInt32Item +// +//============================================================================ + +TYPEINIT1_AUTOFACTORY(SfxInt32Item, CntInt32Item); + + +//============================================================================ +// +// class SfxUInt32Item +// +//============================================================================ + +TYPEINIT1_AUTOFACTORY(SfxUInt32Item, CntUInt32Item); + + +//============================================================================ +// +// class SfxMetricItem +// +//============================================================================ + +DBG_NAME(SfxMetricItem); + +//============================================================================ +TYPEINIT1_AUTOFACTORY(SfxMetricItem, SfxInt32Item); + +//============================================================================ +SfxMetricItem::SfxMetricItem(USHORT which, UINT32 nValue): + SfxInt32Item(which, nValue) +{ + DBG_CTOR(SfxMetricItem, 0); +} + +//============================================================================ +SfxMetricItem::SfxMetricItem(USHORT which, SvStream & rStream): + SfxInt32Item(which, rStream) +{ + DBG_CTOR(SfxMetricItem, 0); +} + +//============================================================================ +SfxMetricItem::SfxMetricItem(const SfxMetricItem & rItem): + SfxInt32Item(rItem) +{ + DBG_CTOR(SfxMetricItem, 0); +} + +//============================================================================ +// virtual +int SfxMetricItem::ScaleMetrics(long nMult, long nDiv) +{ + BigInt aTheValue(GetValue()); + aTheValue *= nMult; + aTheValue += nDiv / 2; + aTheValue /= nDiv; + SetValue(aTheValue); + return 1; +} + +//============================================================================ +// virtual +int SfxMetricItem::HasMetrics() const +{ + return 1; +} + diff --git a/svl/source/items/itemiter.cxx b/svl/source/items/itemiter.cxx new file mode 100644 index 000000000000..9a7fa4d72c88 --- /dev/null +++ b/svl/source/items/itemiter.cxx @@ -0,0 +1,122 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: itemiter.cxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#ifndef GCC +#endif + +#include +#include +#include + +// STATIC DATA ----------------------------------------------------------- + +DBG_NAME(SfxItemIter); + + +// -------------------------------------------------------------------------- + + +SfxItemIter::SfxItemIter( const SfxItemSet& rItemSet ) + : _rSet( rItemSet ) +{ + DBG_CTOR(SfxItemIter, 0); + DBG_ASSERTWARNING( _rSet.Count(), "es gibt gar keine Attribute" ); + + if ( !_rSet._nCount ) + { + _nStt = 1; + _nEnd = 0; + } + else + { + SfxItemArray ppFnd = _rSet._aItems; + + // suche das 1. gesetzte Item + for ( _nStt = 0; !*(ppFnd + _nStt ); ++_nStt ) + ; // empty loop + if ( 1 < _rSet.Count() ) + for( _nEnd = _rSet.TotalCount(); !*( ppFnd + --_nEnd); ) + ; // empty loop + else + _nEnd = _nStt; + } + + _nAkt = _nStt; +} + +// -------------------------------------------------------------------------- + + +SfxItemIter::~SfxItemIter() +{ + DBG_DTOR(SfxItemIter, 0); +} + +// -------------------------------------------------------------------------- + + +const SfxPoolItem* SfxItemIter::NextItem() +{ + DBG_CHKTHIS(SfxItemIter, 0); + SfxItemArray ppFnd = _rSet._aItems; + + if( _nAkt < _nEnd ) + { + do { + _nAkt++; + } while( _nAkt < _nEnd && !*(ppFnd + _nAkt ) ); + return *(ppFnd+_nAkt); + } + return 0; +} + +// -------------------------------------------------------------------------- + + +const SfxPoolItem* SfxItemIter::PrevItem() +{ + DBG_CHKTHIS(SfxItemIter, 0); + SfxItemArray ppFnd = _rSet._aItems; + + if ( _nAkt > _nStt ) + { + do { + --_nAkt; + } while( _nAkt && !*(ppFnd + _nAkt )); + return *(ppFnd+_nAkt); + } + return 0; +} + + + diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx new file mode 100644 index 000000000000..823658132fe0 --- /dev/null +++ b/svl/source/items/itempool.cxx @@ -0,0 +1,1176 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: itempool.cxx,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include +#include +#ifndef GCC +#endif + +#include +#include "whassert.hxx" +#include +#include +#include "poolio.hxx" +#include + +// STATIC DATA ----------------------------------------------------------- + + +//======================================================================== + +SV_IMPL_PTRARR( SfxPoolVersionArr_Impl, SfxPoolVersion_Impl* ); + +//======================================================================== + + +void SfxItemPool::AddSfxItemPoolUser(SfxItemPoolUser& rNewUser) +{ + maSfxItemPoolUsers.push_back(&rNewUser); +} + +void SfxItemPool::RemoveSfxItemPoolUser(SfxItemPoolUser& rOldUser) +{ + const SfxItemPoolUserVector::iterator aFindResult = ::std::find(maSfxItemPoolUsers.begin(), maSfxItemPoolUsers.end(), &rOldUser); + if(aFindResult != maSfxItemPoolUsers.end()) + { + maSfxItemPoolUsers.erase(aFindResult); + } +} + +const SfxPoolItem* SfxItemPool::GetPoolDefaultItem( USHORT nWhich ) const +{ + DBG_CHKTHIS(SfxItemPool, 0); + const SfxPoolItem* pRet; + if( IsInRange( nWhich ) ) + pRet = *(ppPoolDefaults + GetIndex_Impl( nWhich )); + else if( pSecondary ) + pRet = pSecondary->GetPoolDefaultItem( nWhich ); + else + { + SFX_ASSERT( 0, nWhich, "unknown Which-Id - cannot get pool default" ); + pRet = 0; + } + return pRet; +} + +// ----------------------------------------------------------------------- + +inline FASTBOOL SfxItemPool::IsItemFlag_Impl( USHORT nPos, USHORT nFlag ) const +{ + USHORT nItemFlag = pItemInfos[nPos]._nFlags; + return nFlag == (nItemFlag & nFlag); +} + +// ----------------------------------------------------------------------- + +FASTBOOL SfxItemPool::IsItemFlag( USHORT nWhich, USHORT nFlag ) const +{ + for ( const SfxItemPool *pPool = this; pPool; pPool = pPool->pSecondary ) + { + if ( pPool->IsInRange(nWhich) ) + return pPool->IsItemFlag_Impl( pPool->GetIndex_Impl(nWhich), nFlag); + } + DBG_ASSERT( !IsWhich(nWhich), "unknown which-id" ); + return FALSE; +} + +// ----------------------------------------------------------------------- + +SfxBroadcaster& SfxItemPool::BC() +{ + return pImp->aBC; +} + +// ----------------------------------------------------------------------- + + +SfxItemPool::SfxItemPool +( + UniString const & rName, /* Name des Pools zur Idetifikation + im File-Format */ + USHORT nStartWhich, /* erste Which-Id des Pools */ + USHORT nEndWhich, /* letzte Which-Id des Pools */ +#ifdef TF_POOLABLE + const SfxItemInfo* pInfos, /* SID-Map und Item-Flags */ +#endif + SfxPoolItem** pDefaults, /* Pointer auf statische Defaults, + wird direkt vom Pool referenziert, + jedoch kein Eigent"umer"ubergang */ +#ifndef TF_POOLABLE + USHORT* pSlotIdArray, /* Zuordnung von Slot-Ids zu Which-Ids */ +#endif + FASTBOOL bLoadRefCounts /* Ref-Counts mitladen oder auf 1 setzen */ +) + +/* [Beschreibung] + + Der im Normalfall verwendete Konstruktor der Klasse SfxItemPool. Es + wird eine SfxItemPool-Instanz initialisiert, die Items im b"undigen + Which-Bereich von 'nStartWhich' bis 'nEndWhich' verwalten kann. + + F"ur jede dieser Which-Ids mu\s ein statischer Default im Array 'pDefaults' + vorhanden sein, die dort beginnend mit einem mit der + Which-Id 'nStartWhich' nach Which-Ids sortiert aufeinanderfolgend + eingetragen sein m"ussen. + + 'pItemInfos' ist ein identisch angeordnetes Array von USHORTs, die + Slot-Ids darstellen und Flags. Die Slot-Ids k"onnen 0 sein, wenn die + betreffenden Items ausschlie\slich in der Core verwendet werden. + "Uber die Flags kann z.B. bestimmt werden, ob Value-Sharing + (SFX_ITEM_POOLABLE) stattfinden soll. + + [Anmerkung] + + Wenn der Pool s enthalten soll, k"onnen im Konstruktor noch + keine static-Defaults angegeben werden. Dies mu\s dann nachtr"aglich + mit geschehen. + + + [Querverweise] + + + + +*/ + +: aName(rName), + nStart(nStartWhich), + nEnd(nEndWhich), +#ifdef TF_POOLABLE + pItemInfos(pInfos), +#else + pSlotIds(pSlotIdArray), +#endif + pImp( new SfxItemPool_Impl( nStart, nEnd ) ), + ppStaticDefaults(0), + ppPoolDefaults(new SfxPoolItem* [ nEndWhich - nStartWhich + 1]), + pSecondary(0), + pMaster(this), + _pPoolRanges( 0 ), + bPersistentRefCounts(bLoadRefCounts), + maSfxItemPoolUsers() +{ + DBG_CTOR(SfxItemPool, 0); + DBG_ASSERT(nStart, "Start-Which-Id must be greater 0" ); + + pImp->eDefMetric = SFX_MAPUNIT_TWIP; + pImp->nVersion = 0; + pImp->bStreaming = FALSE; + pImp->nLoadingVersion = 0; + pImp->nInitRefCount = 1; + pImp->nVerStart = nStart; + pImp->nVerEnd = nEnd; + pImp->bInSetItem = FALSE; + pImp->nStoringStart = nStartWhich; + pImp->nStoringEnd = nEndWhich; + + memset( ppPoolDefaults, 0, sizeof( SfxPoolItem* ) * (nEnd - nStart + 1)); + + if ( pDefaults ) + SetDefaults(pDefaults); +} + +// ----------------------------------------------------------------------- + + +SfxItemPool::SfxItemPool +( + const SfxItemPool& rPool, // von dieser Instanz kopieren + BOOL bCloneStaticDefaults /* TRUE + statische Defaults kopieren + + FALSE + statische Defaults + "ubernehehmen */ +) + +/* [Beschreibung] + + Copy-Konstruktor der Klasse SfxItemPool. + + + [Querverweise] + + +*/ + +: aName(rPool.aName), + nStart(rPool.nStart), + nEnd(rPool.nEnd), +#ifdef TF_POOLABLE + pItemInfos(rPool.pItemInfos), +#else + pSlotIds(rPool.pSlotIds), +#endif + pImp( new SfxItemPool_Impl( nStart, nEnd ) ), + ppStaticDefaults(0), + ppPoolDefaults(new SfxPoolItem* [ nEnd - nStart + 1]), + pSecondary(0), + pMaster(this), + _pPoolRanges( 0 ), + bPersistentRefCounts(rPool.bPersistentRefCounts ), + maSfxItemPoolUsers() +{ + DBG_CTOR(SfxItemPool, 0); + pImp->eDefMetric = rPool.pImp->eDefMetric; + pImp->nVersion = rPool.pImp->nVersion; + pImp->bStreaming = FALSE; + pImp->nLoadingVersion = 0; + pImp->nInitRefCount = 1; + pImp->nVerStart = rPool.pImp->nVerStart; + pImp->nVerEnd = rPool.pImp->nVerEnd; + pImp->bInSetItem = FALSE; + pImp->nStoringStart = nStart; + pImp->nStoringEnd = nEnd; + + memset( ppPoolDefaults, 0, sizeof( SfxPoolItem* ) * (nEnd - nStart + 1)); + + // Static Defaults "ubernehmen + if ( bCloneStaticDefaults ) + { + SfxPoolItem **ppDefaults = new SfxPoolItem*[nEnd-nStart+1]; + for ( USHORT n = 0; n <= nEnd - nStart; ++n ) + { + (*( ppDefaults + n )) = (*( rPool.ppStaticDefaults + n ))->Clone(this); + (*( ppDefaults + n ))->SetKind( SFX_ITEMS_STATICDEFAULT ); + } + + SetDefaults( ppDefaults ); + } + else + SetDefaults( rPool.ppStaticDefaults ); + + // Pool Defaults kopieren + for ( USHORT n = 0; n <= nEnd - nStart; ++n ) + if ( (*( rPool.ppPoolDefaults + n )) ) + { + (*( ppPoolDefaults + n )) = (*( rPool.ppPoolDefaults + n ))->Clone(this); + (*( ppPoolDefaults + n ))->SetKind( SFX_ITEMS_POOLDEFAULT ); + } + + // Version-Map kopieren + USHORT nVerCount = rPool.pImp->aVersions.Count(); + for ( USHORT nVer = 0; nVer < nVerCount; ++nVer ) + { + const SfxPoolVersion_Impl *pOld = rPool.pImp->aVersions.GetObject(nVer); + const SfxPoolVersion_Impl *pNew = new SfxPoolVersion_Impl( *pOld ); + pImp->aVersions.Insert( pNew, nVer ); + } + + // Verkettung wiederherstellen + if ( rPool.pSecondary ) + SetSecondaryPool( rPool.pSecondary->Clone() ); +} + +// ----------------------------------------------------------------------- + +void SfxItemPool::SetDefaults( SfxPoolItem **pDefaults ) +{ + DBG_CHKTHIS(SfxItemPool, 0); + DBG_ASSERT( pDefaults, "erst wollen, dann nichts geben..." ); + DBG_ASSERT( !ppStaticDefaults, "habe schon defaults" ); + + ppStaticDefaults = pDefaults; + //! if ( (*ppStaticDefaults)->GetKind() != SFX_ITEMS_STATICDEFAULT ) + //! geht wohl nicht im Zshg mit SetItems, die hinten stehen + { + DBG_ASSERT( (*ppStaticDefaults)->GetRefCount() == 0 || + IsDefaultItem( (*ppStaticDefaults) ), + "das sind keine statics" ); + for ( USHORT n = 0; n <= nEnd - nStart; ++n ) + { + SFX_ASSERT( (*( ppStaticDefaults + n ))->Which() == n + nStart, + n + nStart, "static defaults not sorted" ); + (*( ppStaticDefaults + n ))->SetKind( SFX_ITEMS_STATICDEFAULT ); + DBG_ASSERT( !(pImp->ppPoolItems[n]), "defaults with setitems with items?!" ); + } + } +} + +// ----------------------------------------------------------------------- + +void SfxItemPool::ReleaseDefaults +( + BOOL bDelete /* TRUE + l"oscht sowohl das Array als auch die einzelnen + statischen Defaults + + FALSE + l"oscht weder das Array noch die einzelnen + statischen Defaults */ +) + +/* [Beschreibung] + + Gibt die statischen Defaults der betreffenden SfxItemPool-Instanz frei + und l"oscht ggf. die statischen Defaults. + + Nach Aufruf dieser Methode darf die SfxItemPool-Instanz nicht mehr + verwendet werden, einzig ist der Aufruf des Destruktors zu"lassig. +*/ + +{ + DBG_ASSERT( ppStaticDefaults, "keine Arme keine Kekse" ); + ReleaseDefaults( ppStaticDefaults, nEnd - nStart + 1, bDelete ); + + // KSO (22.10.98): ppStaticDefaults zeigt auf geloeschten Speicher, + // wenn bDelete == TRUE. + if ( bDelete ) + ppStaticDefaults = 0; +} + +// ----------------------------------------------------------------------- + +void SfxItemPool::ReleaseDefaults +( + SfxPoolItem** pDefaults, /* freizugebende statische Defaults */ + + USHORT nCount, /* Anzahl der statischen Defaults */ + + BOOL bDelete /* TRUE + l"oscht sowohl das Array als auch die + einzelnen statischen Defaults + + FALSE + l"oscht weder das Array noch die + einzelnen statischen Defaults */ +) + +/* [Beschreibung] + + Gibt die angegebenen statischen Defaults frei und l"oscht ggf. + die statischen Defaults. + + Diese Methode darf erst nach Zerst"orung aller SfxItemPool-Instanzen, + welche die angegebenen statischen Defaults 'pDefault' verwenden, + aufgerufen werden. +*/ + +{ + DBG_ASSERT( pDefaults, "erst wollen, dann nichts geben..." ); + + for ( USHORT n = 0; n < nCount; ++n ) + { + SFX_ASSERT( IsStaticDefaultItem( *(pDefaults+n) ), + n, "das ist kein static-default" ); + (*( pDefaults + n ))->SetRefCount( 0 ); + if ( bDelete ) + { delete *( pDefaults + n ); *(pDefaults + n) = 0; } + } + + if ( bDelete ) + { delete[] pDefaults; pDefaults = 0; } +} + +// ----------------------------------------------------------------------- + +SfxItemPool::~SfxItemPool() +{ + DBG_DTOR(SfxItemPool, 0); + DBG_ASSERT( pMaster == this, "destroying active Secondary-Pool" ); + + if ( pImp->ppPoolItems && ppPoolDefaults ) + Delete(); + delete[] _pPoolRanges; + delete pImp; +} + +void SfxItemPool::Free(SfxItemPool* pPool) +{ + if(pPool) + { + // tell all the registered SfxItemPoolUsers that the pool is in destruction + SfxItemPoolUserVector aListCopy(pPool->maSfxItemPoolUsers.begin(), pPool->maSfxItemPoolUsers.end()); + for(SfxItemPoolUserVector::iterator aIterator = aListCopy.begin(); aIterator != aListCopy.end(); aIterator++) + { + SfxItemPoolUser* pSfxItemPoolUser = *aIterator; + DBG_ASSERT(pSfxItemPoolUser, "corrupt SfxItemPoolUser list (!)"); + pSfxItemPoolUser->ObjectInDestruction(*pPool); + } + + // Clear the vector. This means that user do not need to call RemoveSfxItemPoolUser() + // when they get called from ObjectInDestruction(). + pPool->maSfxItemPoolUsers.clear(); + + // delete pool + delete pPool; + } +} + +// ----------------------------------------------------------------------- + + +void SfxItemPool::SetSecondaryPool( SfxItemPool *pPool ) +{ + // ggf. an abgeh"angten Pools den Master zur"ucksetzen + if ( pSecondary ) + { +#ifdef DBG_UTIL + HACK( "fuer Image, dort gibt es derzeit keine Statics - Bug" ) + if ( ppStaticDefaults ) + { + // Delete() ist noch nicht gelaufen? + if ( pImp->ppPoolItems && pSecondary->pImp->ppPoolItems ) + { + // hat der master SetItems? + BOOL bHasSetItems = FALSE; + for ( USHORT i = 0; !bHasSetItems && i < nEnd-nStart; ++i ) + bHasSetItems = ppStaticDefaults[i]->ISA(SfxSetItem); + + // abgehaengte Pools muessen leer sein + BOOL bOK = bHasSetItems; + for ( USHORT n = 0; + bOK && n <= pSecondary->nEnd - pSecondary->nStart; + ++n ) + { + SfxPoolItemArray_Impl** ppItemArr = + pSecondary->pImp->ppPoolItems + n; + if ( *ppItemArr ) + { + SfxPoolItem** ppHtArr = + (SfxPoolItem**)(*ppItemArr)->GetData(); + for( USHORT i = (*ppItemArr)->Count(); i; ++ppHtArr, --i ) + if ( !(*ppHtArr) ) + { + DBG_ERROR( "old secondary pool must be empty" ); + bOK = FALSE; + break; + } + } + } + } + } +#endif + + pSecondary->pMaster = pSecondary; + for ( SfxItemPool *p = pSecondary->pSecondary; p; p = p->pSecondary ) + p->pMaster = pSecondary; + } + + // ggf. den Master der neuen Secondary-Pools setzen + DBG_ASSERT( !pPool || pPool->pMaster == pPool, "Secondary tanzt auf zwei Hochzeiten " ); + SfxItemPool *pNewMaster = pMaster ? pMaster : this; + for ( SfxItemPool *p = pPool; p; p = p->pSecondary ) + p->pMaster = pNewMaster; + + // neuen Secondary-Pool merken + pSecondary = pPool; +} + +// ----------------------------------------------------------------------- + +SfxMapUnit SfxItemPool::GetMetric( USHORT ) const +{ + DBG_CHKTHIS(SfxItemPool, 0); + + return pImp->eDefMetric; +} + +// ----------------------------------------------------------------------- + +void SfxItemPool::SetDefaultMetric( SfxMapUnit eNewMetric ) +{ + DBG_CHKTHIS(SfxItemPool, 0); + + pImp->eDefMetric = eNewMetric; +} + +// ----------------------------------------------------------------------- + +SfxItemPresentation SfxItemPool::GetPresentation +( + const SfxPoolItem& rItem, /* IN: , dessen textuelle + Wert-Darstellung geliefert werden + soll */ + SfxItemPresentation ePresent, /* IN: gew"unschte Art der Darstellung; + siehe */ + SfxMapUnit eMetric, /* IN: gew"unschte Ma\seinheit der Darstellung */ + XubString& rText, /* OUT: textuelle Darstellung von 'rItem' */ + const IntlWrapper * pIntlWrapper +) const + +/* [Beschreibung] + + "Uber diese virtuelle Methode k"onnen textuelle Darstellungen der + von der jeweilige SfxItemPool-Subklasse verwalteten SfxPoolItems + angefordert werden. + + In Ableitungen sollte diese Methode "uberladen werden und auf + SfxPoolItems reagiert werden, die bei + keine vollst"andige Information liefern k"onnen. + + Die Basisklasse liefert die unver"anderte Presentation von 'rItem'. +*/ + +{ + DBG_CHKTHIS(SfxItemPool, 0); + return rItem.GetPresentation( + ePresent, GetMetric(rItem.Which()), eMetric, rText, pIntlWrapper ); +} + + +// ----------------------------------------------------------------------- + +SfxItemPool* SfxItemPool::Clone() const +{ + DBG_CHKTHIS(SfxItemPool, 0); + + SfxItemPool *pPool = new SfxItemPool( *this ); + return pPool; +} + +// ---------------------------------------------------------------------- + +void SfxItemPool::Delete() +{ + DBG_CHKTHIS(SfxItemPool, 0); + + // schon deleted? + if ( !pImp->ppPoolItems || !ppPoolDefaults ) + return; + + // z.B. laufenden Requests bescheidsagen + pImp->aBC.Broadcast( SfxSimpleHint( SFX_HINT_DYING ) ); + + //MA 16. Apr. 97: Zweimal durchlaufen, in der ersten Runde fuer die SetItems. + //Der Klarheit halber wird das jetzt in zwei besser lesbare Schleifen aufgeteilt. + + SfxPoolItemArray_Impl** ppItemArr = pImp->ppPoolItems; + SfxPoolItem** ppDefaultItem = ppPoolDefaults; + SfxPoolItem** ppStaticDefaultItem = ppStaticDefaults; + USHORT nArrCnt; + + //Erst die SetItems abraeumen + HACK( "fuer Image, dort gibt es derzeit keine Statics - Bug" ) + if ( ppStaticDefaults ) + { + for ( nArrCnt = GetSize_Impl(); + nArrCnt; + --nArrCnt, ++ppItemArr, ++ppDefaultItem, ++ppStaticDefaultItem ) + { + // KSO (22.10.98): *ppStaticDefaultItem kann im dtor einer + // von SfxItemPool abgeleiteten Klasse bereits geloescht worden + // sein! -> CHAOS Itempool + if ( *ppStaticDefaultItem && (*ppStaticDefaultItem)->ISA(SfxSetItem) ) + { + if ( *ppItemArr ) + { + SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData(); + for ( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr ) + if (*ppHtArr) + { +#ifdef DBG_UTIL + ReleaseRef( **ppHtArr, (*ppHtArr)->GetRefCount() ); +#endif + delete *ppHtArr; + } + DELETEZ( *ppItemArr ); + } + if ( *ppDefaultItem ) + { +#ifdef DBG_UTIL + SetRefCount( **ppDefaultItem, 0 ); +#endif + DELETEZ( *ppDefaultItem ); + } + } + } + } + + ppItemArr = pImp->ppPoolItems; + ppDefaultItem = ppPoolDefaults; + + //Jetzt die 'einfachen' Items + for ( nArrCnt = GetSize_Impl(); + nArrCnt; + --nArrCnt, ++ppItemArr, ++ppDefaultItem ) + { + if ( *ppItemArr ) + { + SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData(); + for ( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr ) + if (*ppHtArr) + { +#ifdef DBG_UTIL + ReleaseRef( **ppHtArr, (*ppHtArr)->GetRefCount() ); +#endif + delete *ppHtArr; + } + delete *ppItemArr; + } + if ( *ppDefaultItem ) + { +#ifdef DBG_UTIL + SetRefCount( **ppDefaultItem, 0 ); +#endif + delete *ppDefaultItem; + } + } + + pImp->DeleteItems(); + delete[] ppPoolDefaults; ppPoolDefaults = 0; +} + +// ---------------------------------------------------------------------- + +void SfxItemPool::Cleanup() +{ + DBG_CHKTHIS(SfxItemPool, 0); + + //MA 16. Apr. 97: siehe ::Delete() + + SfxPoolItemArray_Impl** ppItemArr = pImp->ppPoolItems; + SfxPoolItem** ppDefaultItem = ppPoolDefaults; + SfxPoolItem** ppStaticDefaultItem = ppStaticDefaults; + USHORT nArrCnt; + + HACK( "fuer Image, dort gibt es derzeit keine Statics - Bug" ) + if ( ppStaticDefaults ) //HACK fuer Image, dort gibt es keine Statics!! + { + for ( nArrCnt = GetSize_Impl(); + nArrCnt; + --nArrCnt, ++ppItemArr, ++ppDefaultItem, ++ppStaticDefaultItem ) + { + //Fuer jedes Item gibt es entweder ein Default oder ein static Default! + if ( *ppItemArr && + ((*ppDefaultItem && (*ppDefaultItem)->ISA(SfxSetItem)) || + (*ppStaticDefaultItem)->ISA(SfxSetItem)) ) + { + SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData(); + for ( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr ) + if ( *ppHtArr && !(*ppHtArr)->GetRefCount() ) + { + DELETEZ(*ppHtArr); + } + } + } + } + + ppItemArr = pImp->ppPoolItems; + + for ( nArrCnt = GetSize_Impl(); + nArrCnt; + --nArrCnt, ++ppItemArr ) + { + if ( *ppItemArr ) + { + SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData(); + for ( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr ) + if ( *ppHtArr && !(*ppHtArr)->GetRefCount() ) + DELETEZ( *ppHtArr ); + } + } +} + +// ---------------------------------------------------------------------- + +void SfxItemPool::SetPoolDefaultItem(const SfxPoolItem &rItem) +{ + DBG_CHKTHIS(SfxItemPool, 0); + if ( IsInRange(rItem.Which()) ) + { + SfxPoolItem **ppOldDefault = + ppPoolDefaults + GetIndex_Impl(rItem.Which()); + SfxPoolItem *pNewDefault = rItem.Clone(this); + pNewDefault->SetKind(SFX_ITEMS_POOLDEFAULT); + if ( *ppOldDefault ) + { + (*ppOldDefault)->SetRefCount(0); + DELETEZ( *ppOldDefault ); + } + *ppOldDefault = pNewDefault; + } + else if ( pSecondary ) + pSecondary->SetPoolDefaultItem(rItem); + else + { + SFX_ASSERT( 0, rItem.Which(), "unknown Which-Id - cannot set pool default" ); + } +} + +/* + * Resets the default of the given back to the static default. + * If a pool default exists it is removed. + */ +void SfxItemPool::ResetPoolDefaultItem( USHORT nWhichId ) +{ + DBG_CHKTHIS(SfxItemPool, 0); + if ( IsInRange(nWhichId) ) + { + SfxPoolItem **ppOldDefault = + ppPoolDefaults + GetIndex_Impl( nWhichId ); + if ( *ppOldDefault ) + { + (*ppOldDefault)->SetRefCount(0); + DELETEZ( *ppOldDefault ); + } + } + else if ( pSecondary ) + pSecondary->ResetPoolDefaultItem(nWhichId); + else + { + SFX_ASSERT( 0, nWhichId, "unknown Which-Id - cannot set pool default" ); + } +} + +// ----------------------------------------------------------------------- + +const SfxPoolItem& SfxItemPool::Put( const SfxPoolItem& rItem, USHORT nWhich ) +{ + DBG_ASSERT( !rItem.ISA(SfxSetItem) || + 0 != &((const SfxSetItem&)rItem).GetItemSet(), + "SetItem without ItemSet" ); + + DBG_CHKTHIS(SfxItemPool, 0); + if ( 0 == nWhich ) + nWhich = rItem.Which(); + + // richtigen Secondary-Pool finden + BOOL bSID = nWhich > SFX_WHICH_MAX; + if ( !bSID && !IsInRange(nWhich) ) + { + if ( pSecondary ) + return pSecondary->Put( rItem, nWhich ); + DBG_ERROR( "unknown Which-Id - cannot put item" ); + } + + // SID oder nicht poolable (neue Definition)? + USHORT nIndex = bSID ? USHRT_MAX : GetIndex_Impl(nWhich); + if ( USHRT_MAX == nIndex || + IsItemFlag_Impl( nIndex, SFX_ITEM_NOT_POOLABLE ) ) + { + SFX_ASSERT( USHRT_MAX != nIndex || rItem.Which() != nWhich || + !IsDefaultItem(&rItem) || rItem.GetKind() == SFX_ITEMS_DELETEONIDLE, + nWhich, "ein nicht Pool-Item ist Default?!" ); + SfxPoolItem *pPoolItem = rItem.Clone(pMaster); + pPoolItem->SetWhich(nWhich); + AddRef( *pPoolItem ); + return *pPoolItem; + } + + SFX_ASSERT( rItem.IsA(GetDefaultItem(nWhich).Type()), nWhich, + "SFxItemPool: wrong item type in Put" ); + + SfxPoolItemArray_Impl** ppItemArr = pImp->ppPoolItems + nIndex; + if( !*ppItemArr ) + *ppItemArr = new SfxPoolItemArray_Impl; + + SfxPoolItem **ppFree = 0; + SfxPoolItem** ppHtArray = (SfxPoolItem**)(*ppItemArr)->GetData(); + if ( IsItemFlag_Impl( nIndex, SFX_ITEM_POOLABLE ) ) + { + // wenn es ueberhaupt gepoolt ist, koennte es schon drin sein + if ( IsPooledItem(&rItem) ) + { + // 1. Schleife: teste ob der Pointer vorhanden ist. + for( USHORT n = (*ppItemArr)->Count(); n; ++ppHtArray, --n ) + if( &rItem == (*ppHtArray) ) + { + AddRef( **ppHtArray ); + return **ppHtArray; + } + } + + // 2. Schleife: dann muessen eben die Attribute verglichen werden + USHORT n; + for ( n = (*ppItemArr)->Count(), ppHtArray = (SfxPoolItem**)(*ppItemArr)->GetData(); + n; ++ppHtArray, --n ) + { + if ( *ppHtArray ) + { + if( **ppHtArray == rItem ) + { + AddRef( **ppHtArray ); + return **ppHtArray; + } + } + else + if ( !ppFree ) + ppFree = ppHtArray; + } + } + else + { + // freien Platz suchen + SfxPoolItem** ppHtArr; + USHORT n, nCount = (*ppItemArr)->Count(); + for ( n = (*ppItemArr)->nFirstFree, + ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData() + n; + n < nCount; + ++ppHtArr, ++n ) + if ( !*ppHtArr ) + { + ppFree = ppHtArr; + break; + } + + // naechstmoeglichen freien Platz merken + (*ppItemArr)->nFirstFree = n; + } + + // nicht vorhanden, also im PtrArray eintragen + SfxPoolItem* pNewItem = rItem.Clone(pMaster); + pNewItem->SetWhich(nWhich); +#ifdef DBG_UTIL + SFX_ASSERT( rItem.Type() == pNewItem->Type(), nWhich, "unequal types in Put(): no Clone()?" ) +#ifdef TF_POOLABLE + if ( !rItem.ISA(SfxSetItem) ) + { + SFX_ASSERT( !IsItemFlag(nWhich, SFX_ITEM_POOLABLE) || + rItem == *pNewItem, + nWhich, "unequal items in Put(): no operator==?" ); + SFX_ASSERT( !IsItemFlag(*pNewItem, SFX_ITEM_POOLABLE) || + *pNewItem == rItem, + nWhich, "unequal items in Put(): no operator==?" ); + } +#endif +#endif + AddRef( *pNewItem, pImp->nInitRefCount ); + const SfxPoolItem* pTemp = pNewItem; + if ( !ppFree ) + (*ppItemArr)->Insert( pTemp, (*ppItemArr)->Count() ); + else + { + DBG_ASSERT( *ppFree == 0, "using surrogate in use" ); + *ppFree = pNewItem; + } + return *pNewItem; +} + +// ----------------------------------------------------------------------- + +void SfxItemPool::Remove( const SfxPoolItem& rItem ) +{ + DBG_CHKTHIS(SfxItemPool, 0); + + DBG_ASSERT( !rItem.ISA(SfxSetItem) || + 0 != &((const SfxSetItem&)rItem).GetItemSet(), + "SetItem without ItemSet" ); + + SFX_ASSERT( !IsPoolDefaultItem(&rItem), rItem.Which(), + "wo kommt denn hier ein Pool-Default her" ); + + // richtigen Secondary-Pool finden + const USHORT nWhich = rItem.Which(); + BOOL bSID = nWhich > SFX_WHICH_MAX; + if ( !bSID && !IsInRange(nWhich) ) + { + if ( pSecondary ) + { + pSecondary->Remove( rItem ); + return; + } + DBG_ERROR( "unknown Which-Id - cannot remove item" ); + } + + // SID oder nicht poolable (neue Definition)? + USHORT nIndex = bSID ? USHRT_MAX : GetIndex_Impl(nWhich); + if ( bSID || IsItemFlag_Impl( nIndex, SFX_ITEM_NOT_POOLABLE ) ) + { + SFX_ASSERT( USHRT_MAX != nIndex || + !IsDefaultItem(&rItem), rItem.Which(), + "ein nicht Pool-Item ist Default?!" ); + if ( 0 == ReleaseRef(rItem) ) + { + SfxPoolItem *pItem = &(SfxPoolItem &)rItem; + delete pItem; + } + return; + } + + SFX_ASSERT( rItem.GetRefCount(), rItem.Which(), "RefCount == 0, Remove unmoeglich" ); + + // statische Defaults sind eben einfach da + if ( rItem.GetKind() == SFX_ITEMS_STATICDEFAULT && + &rItem == *( ppStaticDefaults + GetIndex_Impl(nWhich) ) ) + return; + + // Item im eigenen Pool suchen + SfxPoolItemArray_Impl** ppItemArr = (pImp->ppPoolItems + nIndex); + SFX_ASSERT( *ppItemArr, rItem.Which(), "removing Item not in Pool" ); + SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData(); + for( USHORT n = (*ppItemArr)->Count(); n; ++ppHtArr, --n ) + if( *ppHtArr == &rItem ) + { + if ( (*ppHtArr)->GetRefCount() ) //! + ReleaseRef( **ppHtArr ); + else + { + SFX_ASSERT( 0, rItem.Which(), "removing Item without ref" ); + SFX_TRACE( "to be removed, but not no refs: ", *ppHtArr ); + } + + // ggf. kleinstmoegliche freie Position merken + USHORT nPos = (*ppItemArr)->Count() - n; + if ( (*ppItemArr)->nFirstFree > nPos ) + (*ppItemArr)->nFirstFree = nPos; + + //! MI: Hack, solange wir das Problem mit dem Outliner haben + //! siehe anderes MI-REF + if ( 0 == (*ppHtArr)->GetRefCount() && nWhich < 4000 ) + DELETEZ(*ppHtArr); + return; + } + + // nicht vorhanden + SFX_ASSERT( 0, rItem.Which(), "removing Item not in Pool" ); + SFX_TRACE( "to be removed, but not in pool: ", &rItem ); +} + +// ----------------------------------------------------------------------- + +const SfxPoolItem& SfxItemPool::GetDefaultItem( USHORT nWhich ) const +{ + DBG_CHKTHIS(SfxItemPool, 0); + + if ( !IsInRange(nWhich) ) + { + if ( pSecondary ) + return pSecondary->GetDefaultItem( nWhich ); + SFX_ASSERT( 0, nWhich, "unknown which - dont ask me for defaults" ); + } + + DBG_ASSERT( ppStaticDefaults, "no defaults known - dont ask me for defaults" ); + USHORT nPos = GetIndex_Impl(nWhich); + SfxPoolItem *pDefault = *(ppPoolDefaults + nPos); + if ( pDefault ) + return *pDefault; + return **(ppStaticDefaults + nPos); +} + +// ----------------------------------------------------------------------- + + +void SfxItemPool::FreezeIdRanges() + +/* [Beschreibung] + + This method should be called at the master pool, when all secondary + pools are appended to it. + + It calculates the ranges of 'which-ids' for fast construction of + item-sets, which contains all 'which-ids'. +*/ + +{ + FillItemIdRanges_Impl( _pPoolRanges ); +} + + +// ----------------------------------------------------------------------- + +void SfxItemPool::FillItemIdRanges_Impl( USHORT*& pWhichRanges ) const +{ + DBG_CHKTHIS(SfxItemPool, 0); + DBG_ASSERT( !_pPoolRanges, "GetFrozenRanges() would be faster!" ); + + const SfxItemPool *pPool; + USHORT nLevel = 0; + for( pPool = this; pPool; pPool = pPool->pSecondary ) + ++nLevel; + + pWhichRanges = new USHORT[ 2*nLevel + 1 ]; + + nLevel = 0; + for( pPool = this; pPool; pPool = pPool->pSecondary ) + { + *(pWhichRanges+(nLevel++)) = pPool->nStart; + *(pWhichRanges+(nLevel++)) = pPool->nEnd; + *(pWhichRanges+nLevel) = 0; + } +} + +// ----------------------------------------------------------------------- + +const SfxPoolItem *SfxItemPool::GetItem(USHORT nWhich, USHORT nOfst) const +{ + DBG_CHKTHIS(SfxItemPool, 0); + + if ( !IsInRange(nWhich) ) + { + if ( pSecondary ) + return pSecondary->GetItem( nWhich, nOfst ); + SFX_ASSERT( 0, nWhich, "unknown Which-Id - cannot resolve surrogate" ); + return 0; + } + + // dflt-Attribut? + if ( nOfst == SFX_ITEMS_STATICDEFAULT ) + return *(ppStaticDefaults + GetIndex_Impl(nWhich)); + + SfxPoolItemArray_Impl* pItemArr = *(pImp->ppPoolItems + GetIndex_Impl(nWhich)); + if( pItemArr && nOfst < pItemArr->Count() ) + return (*pItemArr)[nOfst]; + + return 0; +} + +// ----------------------------------------------------------------------- + +USHORT SfxItemPool::GetItemCount(USHORT nWhich) const +{ + DBG_CHKTHIS(SfxItemPool, 0); + + if ( !IsInRange(nWhich) ) + { + if ( pSecondary ) + return pSecondary->GetItemCount( nWhich ); + SFX_ASSERT( 0, nWhich, "unknown Which-Id - cannot resolve surrogate" ); + return 0; + } + + SfxPoolItemArray_Impl* pItemArr = *(pImp->ppPoolItems + GetIndex_Impl(nWhich)); + if ( pItemArr ) + return pItemArr->Count(); + return 0; +} + +// ----------------------------------------------------------------------- + +USHORT SfxItemPool::GetWhich( USHORT nSlotId, BOOL bDeep ) const +{ + if ( !IsSlot(nSlotId) ) + return nSlotId; + +#ifdef TF_POOLABLE + USHORT nCount = nEnd - nStart + 1; + for ( USHORT nOfs = 0; nOfs < nCount; ++nOfs ) + if ( pItemInfos[nOfs]._nSID == nSlotId ) + return nOfs + nStart; +#else + if ( pSlotIds ) + { + USHORT nCount = nEnd - nStart + 1; + for ( USHORT nOfs = 0; nOfs < nCount; ++nOfs ) + if ( pSlotIds[nOfs] == nSlotId ) + return nOfs + nStart; + } +#endif + if ( pSecondary && bDeep ) + return pSecondary->GetWhich(nSlotId); + return nSlotId; +} + +// ----------------------------------------------------------------------- + +USHORT SfxItemPool::GetSlotId( USHORT nWhich, BOOL bDeep ) const +{ + if ( !IsWhich(nWhich) ) + return nWhich; + + if ( !IsInRange( nWhich ) ) + { + if ( pSecondary && bDeep ) + return pSecondary->GetSlotId(nWhich); + SFX_ASSERT( 0, nWhich, "unknown Which-Id - cannot get slot-id" ); + return 0; + } +#ifdef TF_POOLABLE + + USHORT nSID = pItemInfos[nWhich - nStart]._nSID; + return nSID ? nSID : nWhich; +#else + else if ( pSlotIds ) + return pSlotIds[nWhich - nStart]; + return nWhich; +#endif +} + +// ----------------------------------------------------------------------- + +USHORT SfxItemPool::GetTrueWhich( USHORT nSlotId, BOOL bDeep ) const +{ + if ( !IsSlot(nSlotId) ) + return 0; + +#ifdef TF_POOLABLE + USHORT nCount = nEnd - nStart + 1; + for ( USHORT nOfs = 0; nOfs < nCount; ++nOfs ) + if ( pItemInfos[nOfs]._nSID == nSlotId ) + return nOfs + nStart; +#else + if ( pSlotIds ) + { + USHORT nCount = nEnd - nStart + 1; + for ( USHORT nOfs = 0; nOfs < nCount; ++nOfs ) + if ( pSlotIds[nOfs] == nSlotId ) + return nOfs + nStart; + } +#endif + if ( pSecondary && bDeep ) + return pSecondary->GetTrueWhich(nSlotId); + return 0; +} + +// ----------------------------------------------------------------------- + +USHORT SfxItemPool::GetTrueSlotId( USHORT nWhich, BOOL bDeep ) const +{ + if ( !IsWhich(nWhich) ) + return 0; + + if ( !IsInRange( nWhich ) ) + { + if ( pSecondary && bDeep ) + return pSecondary->GetTrueSlotId(nWhich); + SFX_ASSERT( 0, nWhich, "unknown Which-Id - cannot get slot-id" ); + return 0; + } +#ifdef TF_POOLABLE + return pItemInfos[nWhich - nStart]._nSID; +#else + else if ( pSlotIds ) + return pSlotIds[nWhich - nStart]; + else + return 0; +#endif +} +// ----------------------------------------------------------------------- +void SfxItemPool::SetFileFormatVersion( USHORT nFileFormatVersion ) + +/* [Description] + + You must call this function to set the file format version after + concatenating your secondary-pools but before you store any + pool, itemset or item. Only set the version at the master pool, + never at any secondary pool. +*/ + +{ + DBG_ASSERT( this == pMaster, + "SfxItemPool::SetFileFormatVersion() but not a master pool" ); + for ( SfxItemPool *pPool = this; pPool; pPool = pPool->pSecondary ) + pPool->_nFileFormatVersion = nFileFormatVersion; +} + + diff --git a/svl/source/items/itemprop.cxx b/svl/source/items/itemprop.cxx new file mode 100644 index 000000000000..354e0a1441ba --- /dev/null +++ b/svl/source/items/itemprop.cxx @@ -0,0 +1,506 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: itemprop.cxx,v $ + * $Revision: 1.9 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include +#include +#include +#include +#include +/************************************************************************* + UNO III Implementation +*************************************************************************/ +using namespace com::sun::star; +using namespace com::sun::star::beans; +using namespace com::sun::star::lang; +using namespace com::sun::star::uno; +using namespace ::rtl; +/*-- 16.02.2009 10:03:55--------------------------------------------------- + + -----------------------------------------------------------------------*/ + +struct equalOUString +{ + bool operator()(const ::rtl::OUString& r1, const ::rtl::OUString& r2) const + { + return r1.equals( r2 ); + } +}; + +typedef ::std::hash_map< ::rtl::OUString, + SfxItemPropertySimpleEntry, + ::rtl::OUStringHash, + equalOUString > SfxItemPropertyHashMap_t; + +class SfxItemPropertyMap_Impl : public SfxItemPropertyHashMap_t +{ +public: + mutable uno::Sequence< beans::Property > m_aPropSeq; + + SfxItemPropertyMap_Impl(){} + SfxItemPropertyMap_Impl( const SfxItemPropertyMap_Impl* pSource ); +}; +SfxItemPropertyMap_Impl::SfxItemPropertyMap_Impl( const SfxItemPropertyMap_Impl* pSource ) +{ + this->SfxItemPropertyHashMap_t::operator=( *pSource ); + m_aPropSeq = pSource->m_aPropSeq; +} + +/*-- 16.02.2009 10:03:51--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SfxItemPropertyMap::SfxItemPropertyMap( const SfxItemPropertyMapEntry* pEntries ) : + m_pImpl( new SfxItemPropertyMap_Impl ) +{ + while( pEntries->pName ) + { + ::rtl::OUString sEntry(pEntries->pName, pEntries->nNameLen, RTL_TEXTENCODING_ASCII_US ); + (*m_pImpl) [ sEntry ] = pEntries; + ++pEntries; + } +} +/*-- 16.02.2009 12:46:41--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SfxItemPropertyMap::SfxItemPropertyMap( const SfxItemPropertyMap* pSource ) : + m_pImpl( new SfxItemPropertyMap_Impl( pSource->m_pImpl ) ) +{ +} +/*-- 16.02.2009 10:03:51--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SfxItemPropertyMap::~SfxItemPropertyMap() +{ + delete m_pImpl; +} +/*-- 16.02.2009 10:03:51--------------------------------------------------- + + -----------------------------------------------------------------------*/ +const SfxItemPropertySimpleEntry* SfxItemPropertyMap::getByName( const ::rtl::OUString &rName ) const +{ + SfxItemPropertyHashMap_t::const_iterator aIter = m_pImpl->find(rName); + if( aIter == m_pImpl->end() ) + return 0; + return &aIter->second; +} + +/*-- 16.02.2009 10:44:24--------------------------------------------------- + + -----------------------------------------------------------------------*/ +uno::Sequence SfxItemPropertyMap::getProperties() const +{ + if( !m_pImpl->m_aPropSeq.getLength() ) + { + m_pImpl->m_aPropSeq.realloc( m_pImpl->size() ); + beans::Property* pPropArray = m_pImpl->m_aPropSeq.getArray(); + sal_uInt32 n = 0; + SfxItemPropertyHashMap_t::const_iterator aIt = m_pImpl->begin(); + while( aIt != m_pImpl->end() ) + //for ( const SfxItemPropertyMap *pMap = _pMap; pMap->pName; ++pMap ) + { + const SfxItemPropertySimpleEntry* pEntry = &(*aIt).second; + pPropArray[n].Name = (*aIt).first; + pPropArray[n].Handle = pEntry->nWID; + if(pEntry->pType) + pPropArray[n].Type = *pEntry->pType; + pPropArray[n].Attributes = + sal::static_int_cast< sal_Int16 >(pEntry->nFlags); + n++; + ++aIt; + } + } + + return m_pImpl->m_aPropSeq; +} +/*-- 16.02.2009 11:04:31--------------------------------------------------- + + -----------------------------------------------------------------------*/ +beans::Property SfxItemPropertyMap::getPropertyByName( const ::rtl::OUString rName ) const + throw( beans::UnknownPropertyException ) +{ + SfxItemPropertyHashMap_t::const_iterator aIter = m_pImpl->find(rName); + if( aIter == m_pImpl->end() ) + throw UnknownPropertyException(); + const SfxItemPropertySimpleEntry* pEntry = &aIter->second; + beans::Property aProp; + aProp.Name = rName; + aProp.Handle = pEntry->nWID; + if(pEntry->pType) + aProp.Type = *pEntry->pType; + aProp.Attributes = sal::static_int_cast< sal_Int16 >(pEntry->nFlags); + return aProp; +} +/*-- 16.02.2009 11:09:16--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Bool SfxItemPropertyMap::hasPropertyByName( const ::rtl::OUString& rName ) const +{ + SfxItemPropertyHashMap_t::const_iterator aIter = m_pImpl->find(rName); + return aIter != m_pImpl->end(); +} +/*-- 16.02.2009 11:25:14--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SfxItemPropertyMap::mergeProperties( const uno::Sequence< beans::Property >& rPropSeq ) +{ + const beans::Property* pPropArray = rPropSeq.getConstArray(); + sal_uInt32 nElements = rPropSeq.getLength(); + for( sal_uInt32 nElement = 0; nElement < nElements; ++nElement ) + { + SfxItemPropertySimpleEntry aTemp( + sal::static_int_cast< sal_Int16 >( pPropArray[nElement].Handle ), //nWID + &pPropArray[nElement].Type, //pType + pPropArray[nElement].Attributes, //nFlags + 0 ); //nMemberId + (*m_pImpl)[pPropArray[nElement].Name] = aTemp; + } +} +/*-- 18.02.2009 12:04:42--------------------------------------------------- + + -----------------------------------------------------------------------*/ +PropertyEntryVector_t SfxItemPropertyMap::getPropertyEntries() const +{ + PropertyEntryVector_t aRet; + aRet.reserve(m_pImpl->size()); + + SfxItemPropertyHashMap_t::const_iterator aIt = m_pImpl->begin(); + while( aIt != m_pImpl->end() ) + { + const SfxItemPropertySimpleEntry* pEntry = &(*aIt).second; + aRet.push_back( SfxItemPropertyNamedEntry( (*aIt).first, * pEntry ) ); + ++aIt; + } + return aRet; +} +/*-- 18.02.2009 15:11:06--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_uInt32 SfxItemPropertyMap::getSize() const +{ + return m_pImpl->size(); +} +/*-- 16.02.2009 13:44:54--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SfxItemPropertySet::~SfxItemPropertySet() +{ +} +/* -----------------------------21.02.00 11:26-------------------------------- + + ---------------------------------------------------------------------------*/ +BOOL SfxItemPropertySet::FillItem(SfxItemSet&, USHORT, BOOL) const +{ + return FALSE; +} +/* -----------------------------06.06.01 12:32-------------------------------- + + ---------------------------------------------------------------------------*/ +void SfxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry& rEntry, + const SfxItemSet& rSet, Any& rAny ) const + throw(RuntimeException) +{ + // get the SfxPoolItem + const SfxPoolItem* pItem = 0; + SfxItemState eState = rSet.GetItemState( rEntry.nWID, TRUE, &pItem ); + if(SFX_ITEM_SET != eState && SFX_WHICH_MAX > rEntry.nWID ) + pItem = &rSet.GetPool()->GetDefaultItem(rEntry.nWID); + // return item values as uno::Any + if(eState >= SFX_ITEM_DEFAULT && pItem) + { + pItem->QueryValue( rAny, rEntry.nMemberId ); + } + else + { + SfxItemSet aSet(*rSet.GetPool(), rEntry.nWID, rEntry.nWID); + if(FillItem(aSet, rEntry.nWID, TRUE)) + { + const SfxPoolItem& rItem = aSet.Get(rEntry.nWID); + rItem.QueryValue( rAny, rEntry.nMemberId ); + } + else if(0 == (rEntry.nFlags & PropertyAttribute::MAYBEVOID)) + throw RuntimeException(); + } + + + // convert general SfxEnumItem values to specific values + if( rEntry.pType && TypeClass_ENUM == rEntry.pType->getTypeClass() && + rAny.getValueTypeClass() == TypeClass_LONG ) + { + INT32 nTmp = *(INT32*)rAny.getValue(); + rAny.setValue( &nTmp, *rEntry.pType ); + } +} +/* -----------------------------06.06.01 12:32-------------------------------- + + ---------------------------------------------------------------------------*/ +void SfxItemPropertySet::getPropertyValue( const OUString &rName, + const SfxItemSet& rSet, Any& rAny ) const + throw(RuntimeException, UnknownPropertyException) +{ + // detect which-id + const SfxItemPropertySimpleEntry* pEntry = m_aMap.getByName( rName ); + if ( !pEntry ) + throw UnknownPropertyException(); + getPropertyValue( *pEntry,rSet, rAny ); +} +/* -----------------------------21.02.00 11:26-------------------------------- + + ---------------------------------------------------------------------------*/ +Any SfxItemPropertySet::getPropertyValue( const OUString &rName, + const SfxItemSet& rSet ) const + throw(RuntimeException, UnknownPropertyException) +{ + Any aVal; + getPropertyValue( rName,rSet, aVal ); + return aVal; +} +/* -----------------------------15.11.00 14:46-------------------------------- + + ---------------------------------------------------------------------------*/ +void SfxItemPropertySet::setPropertyValue( const SfxItemPropertySimpleEntry& rEntry, + const Any& aVal, + SfxItemSet& rSet ) const + throw(RuntimeException, + IllegalArgumentException) +{ + // get the SfxPoolItem + const SfxPoolItem* pItem = 0; + SfxPoolItem *pNewItem = 0; + SfxItemState eState = rSet.GetItemState( rEntry.nWID, TRUE, &pItem ); + if(SFX_ITEM_SET != eState && SFX_WHICH_MAX > rEntry.nWID ) + pItem = &rSet.GetPool()->GetDefaultItem(rEntry.nWID); + //maybe there's another way to find an Item + if(eState < SFX_ITEM_DEFAULT) + { + SfxItemSet aSet(*rSet.GetPool(), rEntry.nWID, rEntry.nWID); + if(FillItem(aSet, rEntry.nWID, FALSE)) + { + const SfxPoolItem &rItem = aSet.Get(rEntry.nWID); + pNewItem = rItem.Clone(); + } + } + if(!pNewItem && pItem) + { + pNewItem = pItem->Clone(); + } + if(pNewItem) + { + if( !pNewItem->PutValue( aVal, rEntry.nMemberId ) ) + { + DELETEZ(pNewItem); + throw IllegalArgumentException(); + } + // apply new item + rSet.Put( *pNewItem, rEntry.nWID ); + delete pNewItem; + } +} +/* -----------------------------21.02.00 11:26-------------------------------- + + ---------------------------------------------------------------------------*/ +void SfxItemPropertySet::setPropertyValue( const OUString &rName, + const Any& aVal, + SfxItemSet& rSet ) const + throw(RuntimeException, + IllegalArgumentException, + UnknownPropertyException) +{ + const SfxItemPropertySimpleEntry* pEntry = m_aMap.getByName( rName ); + if ( !pEntry ) + { + throw UnknownPropertyException(); + } + setPropertyValue(*pEntry, aVal, rSet); +} +/* -----------------------------21.02.00 11:26-------------------------------- + + ---------------------------------------------------------------------------*/ +PropertyState SfxItemPropertySet::getPropertyState(const SfxItemPropertySimpleEntry& rEntry, const SfxItemSet& rSet) const + throw() +{ + PropertyState eRet = PropertyState_DIRECT_VALUE; + USHORT nWhich = rEntry.nWID; + + // item state holen + SfxItemState eState = rSet.GetItemState( nWhich, FALSE ); + // item-Wert als UnoAny zurueckgeben + if(eState == SFX_ITEM_DEFAULT) + eRet = PropertyState_DEFAULT_VALUE; + else if(eState < SFX_ITEM_DEFAULT) + eRet = PropertyState_AMBIGUOUS_VALUE; + return eRet; +} +PropertyState SfxItemPropertySet::getPropertyState( + const OUString& rName, const SfxItemSet& rSet) const + throw(UnknownPropertyException) +{ + PropertyState eRet = PropertyState_DIRECT_VALUE; + + // which-id ermitteln + const SfxItemPropertySimpleEntry* pEntry = m_aMap.getByName( rName ); + if( !pEntry || !pEntry->nWID ) + { + throw UnknownPropertyException(); + } + USHORT nWhich = pEntry->nWID; + + // item holen + const SfxPoolItem* pItem = 0; + SfxItemState eState = rSet.GetItemState( nWhich, FALSE, &pItem ); + if(!pItem && nWhich != rSet.GetPool()->GetSlotId(nWhich)) + pItem = &rSet.GetPool()->GetDefaultItem(nWhich); + // item-Wert als UnoAny zurueckgeben + if(eState == SFX_ITEM_DEFAULT) + eRet = PropertyState_DEFAULT_VALUE; + else if(eState < SFX_ITEM_DEFAULT) + eRet = PropertyState_AMBIGUOUS_VALUE; + return eRet; +} +/* -----------------------------21.02.00 11:26-------------------------------- + + ---------------------------------------------------------------------------*/ +Reference + SfxItemPropertySet::getPropertySetInfo() const +{ + if( !m_xInfo.is() ) + m_xInfo = new SfxItemPropertySetInfo( &m_aMap ); + return m_xInfo; +} +/*-- 16.02.2009 13:49:25--------------------------------------------------- + + -----------------------------------------------------------------------*/ +struct SfxItemPropertySetInfo_Impl +{ + SfxItemPropertyMap* m_pOwnMap; +}; +/*-- 16.02.2009 13:49:24--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SfxItemPropertySetInfo::SfxItemPropertySetInfo(const SfxItemPropertyMap *pMap ) : + m_pImpl( new SfxItemPropertySetInfo_Impl ) +{ + m_pImpl->m_pOwnMap = new SfxItemPropertyMap( pMap ); +} +/*-- 16.02.2009 13:49:25--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SfxItemPropertySetInfo::SfxItemPropertySetInfo(const SfxItemPropertyMapEntry *pEntries ) : + m_pImpl( new SfxItemPropertySetInfo_Impl ) +{ + m_pImpl->m_pOwnMap = new SfxItemPropertyMap( pEntries ); +} +/* -----------------------------21.02.00 11:09-------------------------------- + + ---------------------------------------------------------------------------*/ +Sequence< Property > SAL_CALL + SfxItemPropertySetInfo::getProperties( ) + throw(RuntimeException) +{ + return m_pImpl->m_pOwnMap->getProperties(); +} +/*-- 16.02.2009 13:49:27--------------------------------------------------- + + -----------------------------------------------------------------------*/ +const SfxItemPropertyMap* SfxItemPropertySetInfo::getMap() const +{ + return m_pImpl->m_pOwnMap; +} + +/*-- 16.02.2009 12:43:36--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SfxItemPropertySetInfo::~SfxItemPropertySetInfo() +{ + delete m_pImpl->m_pOwnMap; + delete m_pImpl; +} +/* -----------------------------21.02.00 11:27-------------------------------- + + ---------------------------------------------------------------------------*/ +Property SAL_CALL + SfxItemPropertySetInfo::getPropertyByName( const ::rtl::OUString& rName ) + throw(UnknownPropertyException, RuntimeException) +{ + return m_pImpl->m_pOwnMap->getPropertyByName( rName ); +} +/* -----------------------------21.02.00 11:28-------------------------------- + + ---------------------------------------------------------------------------*/ +sal_Bool SAL_CALL + SfxItemPropertySetInfo::hasPropertyByName( const ::rtl::OUString& rName ) + throw(RuntimeException) +{ + return m_pImpl->m_pOwnMap->hasPropertyByName( rName ); +} +/* -----------------------------21.02.00 12:03-------------------------------- + + ---------------------------------------------------------------------------*/ +SfxExtItemPropertySetInfo::SfxExtItemPropertySetInfo( + const SfxItemPropertyMapEntry *pMap, + const Sequence& rPropSeq ) : + aExtMap( pMap ) +{ + aExtMap.mergeProperties( rPropSeq ); +} +/*-- 16.02.2009 12:06:49--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SfxExtItemPropertySetInfo::~SfxExtItemPropertySetInfo() +{ +} +/* -----------------------------21.02.00 12:03-------------------------------- + + ---------------------------------------------------------------------------*/ +Sequence< Property > SAL_CALL + SfxExtItemPropertySetInfo::getProperties( ) throw(RuntimeException) +{ + return aExtMap.getProperties(); +} +/* -----------------------------21.02.00 12:03-------------------------------- + + ---------------------------------------------------------------------------*/ +Property SAL_CALL + SfxExtItemPropertySetInfo::getPropertyByName( const OUString& rPropertyName ) + throw(UnknownPropertyException, RuntimeException) +{ + return aExtMap.getPropertyByName( rPropertyName ); +} +/* -----------------------------21.02.00 12:03-------------------------------- + + ---------------------------------------------------------------------------*/ +sal_Bool SAL_CALL + SfxExtItemPropertySetInfo::hasPropertyByName( const OUString& rPropertyName ) + throw(RuntimeException) +{ + return aExtMap.hasPropertyByName( rPropertyName ); +} + diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx new file mode 100644 index 000000000000..fee00dca854a --- /dev/null +++ b/svl/source/items/itemset.cxx @@ -0,0 +1,2128 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: itemset.cxx,v $ + * $Revision: 1.9 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include + +#if STLPORT_VERSION>=321 +#include +#endif + +#ifndef GCC +#endif + +#define _SVSTDARR_USHORTS +#define _SVSTDARR_ULONGS + +#include +#include +#include +#include +#include "whiter.hxx" +#include +#include "whassert.hxx" + +#include +#include + +// STATIC DATA ----------------------------------------------------------- + +static const USHORT nInitCount = 10; // einzelne USHORTs => 5 Paare ohne '0' +#ifdef DBG_UTIL +static ULONG nRangesCopyCount = 0; // wie oft wurden Ranges kopiert +#endif + +DBG_NAME(SfxItemSet) + +//======================================================================== + +#define NUMTYPE USHORT +#define SvNums SvUShorts +#define SfxNumRanges SfxUShortRanges +#include "nranges.cxx" +#undef NUMTYPE +#undef SvNums +#undef SfxNumRanges + +#define NUMTYPE ULONG +#define SvNums SvULongs +#define SfxNumRanges SfxULongRanges +#include "nranges.cxx" +#undef NUMTYPE +#undef SvNums +#undef SfxNumRanges + +//======================================================================== + +#ifdef DBG_UTIL + + +const sal_Char *DbgCheckItemSet( const void* pVoid ) +{ + const SfxItemSet *pSet = (const SfxItemSet*) pVoid; + SfxWhichIter aIter( *pSet ); + USHORT nCount = 0, n = 0; + for ( USHORT nWh = aIter.FirstWhich(); nWh; nWh = aIter.NextWhich(), ++n ) + { + const SfxPoolItem *pItem = pSet->_aItems[n]; + if ( pItem ) + { + ++nCount; + DBG_ASSERT( IsInvalidItem(pItem) || + pItem->Which() == 0 || pItem->Which() == nWh, + "SfxItemSet: invalid which-id" ); + DBG_ASSERT( IsInvalidItem(pItem) || !pItem->Which() || + !SfxItemPool::IsWhich(pItem->Which()) || + pSet->GetPool()->IsItemFlag(nWh, SFX_ITEM_NOT_POOLABLE) || + SFX_ITEMS_NULL != pSet->GetPool()->GetSurrogate(pItem), + "SfxItemSet: item in set which is not in pool" ); + } + + } + DBG_ASSERT( pSet->_nCount == nCount, "wrong SfxItemSet::nCount detected" ); + + return 0; +} + +#endif +// ----------------------------------------------------------------------- + +SfxItemSet::SfxItemSet +( + SfxItemPool& rPool, /* der Pool, in dem die SfxPoolItems, + welche in dieses SfxItemSet gelangen, + aufgenommen werden sollen */ + BOOL +#ifdef DBG_UTIL +#ifdef SFX_ITEMSET_NO_DEFAULT_CTOR + + bTotalRanges /* komplette Pool-Ranges uebernehmen, + muss auf TRUE gesetzt werden */ +#endif +#endif +) +/* [Beschreibung] + + Konstruktor fuer ein SfxItemSet mit genau den Which-Bereichen, welche + dem angegebenen bekannt sind. + + + [Anmerkung] + + F"ur Sfx-Programmierer ein derart konstruiertes SfxItemSet kann + keinerlei Items mit Slot-Ids als Which-Werte aufnehmen! +*/ + +: _pPool( &rPool ), + _pParent( 0 ), + _nCount( 0 ) +{ + DBG_CTOR(SfxItemSet, DbgCheckItemSet); + DBG_ASSERTWARNING( _pPool == _pPool->GetMasterPool(), "kein Master-Pool" ); + DBG( _pChildCountCtor; *_pChildCount(this) = 0 ); +// DBG_ASSERT( bTotalRanges || abs( &bTotalRanges - this ) < 1000, +// "please use suitable ranges" ); +#ifdef DBG_UTIL +#ifdef SFX_ITEMSET_NO_DEFAULT_CTOR + if ( !bTotalRanges ) + *(int*)0 = 0; // GPF +#endif +#endif + + _pWhichRanges = (USHORT*) _pPool->GetFrozenIdRanges(); + DBG_ASSERT( _pWhichRanges, "don't create ItemSets with full range before FreezeIdRanges()" ); + if ( !_pWhichRanges ) + _pPool->FillItemIdRanges_Impl( _pWhichRanges ); + + const USHORT nSize = TotalCount(); + _aItems = new const SfxPoolItem* [ nSize ]; + memset( (void*) _aItems, 0, nSize * sizeof( SfxPoolItem* ) ); +} + +// ----------------------------------------------------------------------- + +SfxItemSet::SfxItemSet( SfxItemPool& rPool, USHORT nWhich1, USHORT nWhich2 ): + _pPool( &rPool ), + _pParent( 0 ), + _nCount( 0 ) +{ + DBG_CTOR(SfxItemSet, DbgCheckItemSet); + DBG_ASSERT( nWhich1 <= nWhich2, "Ungueltiger Bereich" ); + DBG_ASSERTWARNING( _pPool == _pPool->GetMasterPool(), "kein Master-Pool" ); + DBG( _pChildCountCtor; *_pChildCount(this) = 0 ); + + InitRanges_Impl(nWhich1, nWhich2); +} + +// ----------------------------------------------------------------------- + +void SfxItemSet::InitRanges_Impl(USHORT nWh1, USHORT nWh2) +{ + DBG_CHKTHIS(SfxItemSet, 0); + _pWhichRanges = new USHORT[ 3 ]; + *(_pWhichRanges+0) = nWh1; + *(_pWhichRanges+1) = nWh2; + *(_pWhichRanges+2) = 0; + const USHORT nRg = nWh2 - nWh1 + 1; + _aItems = new const SfxPoolItem* [ nRg ]; + memset( (void*) _aItems, 0, nRg * sizeof( SfxPoolItem* ) ); +} + +// ----------------------------------------------------------------------- + +void SfxItemSet::InitRanges_Impl(va_list pArgs, USHORT nWh1, USHORT nWh2, USHORT nNull) +{ + DBG_CHKTHIS(SfxItemSet, 0); + + USHORT nSize = InitializeRanges_Impl( _pWhichRanges, pArgs, nWh1, nWh2, nNull ); + _aItems = new const SfxPoolItem* [ nSize ]; + memset( (void*) _aItems, 0, sizeof( SfxPoolItem* ) * nSize ); +} + +// ----------------------------------------------------------------------- + +SfxItemSet::SfxItemSet( SfxItemPool& rPool, + USHORT_ARG nWh1, USHORT_ARG nWh2, USHORT_ARG nNull, ... ): + _pPool( &rPool ), + _pParent( 0 ), + _pWhichRanges( 0 ), + _nCount( 0 ) +{ + DBG_CTOR(SfxItemSet, DbgCheckItemSet); + DBG_ASSERT( nWh1 <= nWh2, "Ungueltiger Bereich" ); + DBG_ASSERTWARNING( _pPool == _pPool->GetMasterPool(), "kein Master-Pool" ); + DBG( _pChildCountCtor; *_pChildCount(this) = 0 ); + + if(!nNull) + InitRanges_Impl( + sal::static_int_cast< USHORT >(nWh1), + sal::static_int_cast< USHORT >(nWh2)); + else { + va_list pArgs; + va_start( pArgs, nNull ); + InitRanges_Impl( + pArgs, sal::static_int_cast< USHORT >(nWh1), + sal::static_int_cast< USHORT >(nWh2), + sal::static_int_cast< USHORT >(nNull)); + } +} + +// ----------------------------------------------------------------------- + +void SfxItemSet::InitRanges_Impl(const USHORT *pWhichPairTable) +{ + DBG_CHKTHIS(SfxItemSet, 0); + DBG_TRACE1("SfxItemSet: Ranges-CopyCount==%ul", ++nRangesCopyCount); + + USHORT nCnt = 0; + const USHORT* pPtr = pWhichPairTable; + while( *pPtr ) + { + nCnt += ( *(pPtr+1) - *pPtr ) + 1; + pPtr += 2; + } + + _aItems = new const SfxPoolItem* [ nCnt ]; + memset( (void*) _aItems, 0, sizeof( SfxPoolItem* ) * nCnt ); + + std::ptrdiff_t cnt = pPtr - pWhichPairTable +1; + _pWhichRanges = new USHORT[ cnt ]; + memcpy( _pWhichRanges, pWhichPairTable, sizeof( USHORT ) * cnt ); +} + + +// ----------------------------------------------------------------------- + +SfxItemSet::SfxItemSet( SfxItemPool& rPool, const USHORT* pWhichPairTable ): + _pPool( &rPool ), + _pParent( 0 ), + _pWhichRanges(0), + _nCount( 0 ) +{ + DBG_CTOR(SfxItemSet, 0); + DBG_ASSERTWARNING( _pPool == _pPool->GetMasterPool(), "kein Master-Pool" ); + DBG( _pChildCountCtor; *_pChildCount(this) = 0 ); + + // pWhichPairTable == 0 ist f"ur das SfxAllEnumItemSet + if ( pWhichPairTable ) + InitRanges_Impl(pWhichPairTable); +} + +// ----------------------------------------------------------------------- + +SfxItemSet::SfxItemSet( const SfxItemSet& rASet ): + _pPool( rASet._pPool ), + _pParent( rASet._pParent ), + _nCount( rASet._nCount ) +{ + DBG_CTOR(SfxItemSet, DbgCheckItemSet); + DBG_ASSERTWARNING( _pPool == _pPool->GetMasterPool(), "kein Master-Pool" ); + DBG( _pChildCountCtor; *_pChildCount(this) = 0 ); + DBG( ++*_pChildCount(_pParent) ); + + // errechne die Anzahl von Attributen + USHORT nCnt = 0; + USHORT* pPtr = rASet._pWhichRanges; + while( *pPtr ) + { + nCnt += ( *(pPtr+1) - *pPtr ) + 1; + pPtr += 2; + } + + _aItems = new const SfxPoolItem* [ nCnt ]; + + // Attribute kopieren + SfxItemArray ppDst = _aItems, ppSrc = rASet._aItems; + for( USHORT n = nCnt; n; --n, ++ppDst, ++ppSrc ) + if ( 0 == *ppSrc || // aktueller Default? + IsInvalidItem(*ppSrc) || // Dont Care? + IsStaticDefaultItem(*ppSrc) ) // nicht zu poolende Defaults + // einfach Pointer kopieren + *ppDst = *ppSrc; + else if ( _pPool->IsItemFlag( **ppSrc, SFX_ITEM_POOLABLE ) ) + { + // einfach Pointer kopieren und Ref-Count erh"ohen + *ppDst = *ppSrc; + ( (SfxPoolItem*) (*ppDst) )->AddRef(); + } + else if ( !(*ppSrc)->Which() ) + *ppDst = (*ppSrc)->Clone(); + else + // !IsPoolable() => via Pool zuweisen + *ppDst = &_pPool->Put( **ppSrc ); + + // dann noch die Which Ranges kopieren + DBG_TRACE1("SfxItemSet: Ranges-CopyCount==%ul", ++nRangesCopyCount); + std::ptrdiff_t cnt = pPtr - rASet._pWhichRanges+1; + _pWhichRanges = new USHORT[ cnt ]; + memcpy( _pWhichRanges, rASet._pWhichRanges, sizeof( USHORT ) * cnt); +} + +// ----------------------------------------------------------------------- + +SfxItemSet::~SfxItemSet() +{ + DBG_DTOR(SfxItemSet, DbgCheckItemSet); +#ifdef DBG_UTIL + DBG( DBG_ASSERT( 0 == *_pChildCount(this), "SfxItemSet: deleting parent-itemset" ) ) +#endif + + USHORT nCount = TotalCount(); + if( Count() ) + { + SfxItemArray ppFnd = _aItems; + for( USHORT nCnt = nCount; nCnt; --nCnt, ++ppFnd ) + if( *ppFnd && !IsInvalidItem(*ppFnd) ) + { + if( !(*ppFnd)->Which() ) + delete (SfxPoolItem*) *ppFnd; + else { + // noch mehrer Referenzen vorhanden, also nur den + // ReferenzCounter manipulieren + if ( 1 < (*ppFnd)->GetRefCount() && !IsDefaultItem(*ppFnd) ) + (*ppFnd)->ReleaseRef(); + else + if ( !IsDefaultItem(*ppFnd) ) + // aus dem Pool loeschen + _pPool->Remove( **ppFnd ); + } + } + } + + // FIXME: could be delete[] (SfxPoolItem **)_aItems; + delete[] _aItems; + if ( _pWhichRanges != _pPool->GetFrozenIdRanges() ) + delete[] _pWhichRanges; + _pWhichRanges = 0; // for invariant-testing + + DBG( --*_pChildCount(_pParent) ); + DBG( delete _pChildCount(this); _pChildCountDtor ); +} + +// ----------------------------------------------------------------------- + +USHORT SfxItemSet::ClearItem( USHORT nWhich ) + +// einzelnes Item oder alle Items (nWhich==0) l"oschen + +{ + DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); + if( !Count() ) + return 0; + + USHORT nDel = 0; + SfxItemArray ppFnd = _aItems; + + if( nWhich ) + { + const USHORT* pPtr = _pWhichRanges; + while( *pPtr ) + { + // in diesem Bereich? + if( *pPtr <= nWhich && nWhich <= *(pPtr+1) ) + { + // "uberhaupt gesetzt? + ppFnd += nWhich - *pPtr; + if( *ppFnd ) + { + // wegen der Assertions ins Sub-Calls mu\s das hier sein + --_nCount; + const SfxPoolItem *pItemToClear = *ppFnd; + *ppFnd = 0; + + if ( !IsInvalidItem(pItemToClear) ) + { + if ( nWhich <= SFX_WHICH_MAX ) + { + const SfxPoolItem& rNew = _pParent + ? _pParent->Get( nWhich, TRUE ) + : _pPool->GetDefaultItem( nWhich ); + + Changed( *pItemToClear, rNew ); + } + if ( pItemToClear->Which() ) + _pPool->Remove( *pItemToClear ); + } + ++nDel; + } + + // gefunden => raus + break; + } + ppFnd += *(pPtr+1) - *pPtr + 1; + pPtr += 2; + } + } + else + { + nDel = _nCount; + + USHORT* pPtr = _pWhichRanges; + while( *pPtr ) + { + for( nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd ) + if( *ppFnd ) + { + // wegen der Assertions ins Sub-Calls mu\s das hier sein + --_nCount; + const SfxPoolItem *pItemToClear = *ppFnd; + *ppFnd = 0; + + if ( !IsInvalidItem(pItemToClear) ) + { + if ( nWhich <= SFX_WHICH_MAX ) + { + const SfxPoolItem& rNew = _pParent + ? _pParent->Get( nWhich, TRUE ) + : _pPool->GetDefaultItem( nWhich ); + + Changed( *pItemToClear, rNew ); + } + + // #i32448# + // Take care of disabled items, too. + if(!pItemToClear->nWhich) + { + // item is disabled, delete it + delete pItemToClear; + } + else + { + // remove item from pool + _pPool->Remove( *pItemToClear ); + } + } + } + pPtr += 2; + } + } + return nDel; +} + +// ----------------------------------------------------------------------- + +void SfxItemSet::ClearInvalidItems( BOOL bHardDefault ) +{ + DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); + USHORT* pPtr = _pWhichRanges; + SfxItemArray ppFnd = _aItems; + if ( bHardDefault ) + while( *pPtr ) + { + for ( USHORT nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd ) + if ( IsInvalidItem(*ppFnd) ) + *ppFnd = &_pPool->Put( _pPool->GetDefaultItem(nWhich) ); + pPtr += 2; + } + else + while( *pPtr ) + { + for( USHORT nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd ) + if( IsInvalidItem(*ppFnd) ) + { + *ppFnd = 0; + --_nCount; + } + pPtr += 2; + } +} + +//------------------------------------------------------------------------ + + +void SfxItemSet::InvalidateAllItems() +{ + DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); + DBG_ASSERT( !_nCount, "Es sind noch Items gesetzt" ); + + memset( (void*)_aItems, -1, ( _nCount = TotalCount() ) * sizeof( SfxPoolItem*) ); +} + +// ----------------------------------------------------------------------- + +SfxItemState SfxItemSet::GetItemState( USHORT nWhich, + BOOL bSrchInParent, + const SfxPoolItem **ppItem ) const +{ + DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); + // suche den Bereich in dem das Which steht: + const SfxItemSet* pAktSet = this; + SfxItemState eRet = SFX_ITEM_UNKNOWN; + do + { + SfxItemArray ppFnd = pAktSet->_aItems; + const USHORT* pPtr = pAktSet->_pWhichRanges; + if (pPtr) + { + while ( *pPtr ) + { + if ( *pPtr <= nWhich && nWhich <= *(pPtr+1) ) + { + // in diesem Bereich + ppFnd += nWhich - *pPtr; + if ( !*ppFnd ) + { + eRet = SFX_ITEM_DEFAULT; + if( !bSrchInParent ) + return eRet; // nicht vorhanden + break; // JP: in den Parents weitersuchen !!! + } + + if ( (SfxPoolItem*) -1 == *ppFnd ) + // Unterschiedlich vorhanden + return SFX_ITEM_DONTCARE; + + if ( (*ppFnd)->Type() == TYPE(SfxVoidItem) ) + return SFX_ITEM_DISABLED; + + if (ppItem) + { + #ifdef DBG_UTIL + const SfxPoolItem *pItem = *ppFnd; + DBG_ASSERT( !pItem->ISA(SfxSetItem) || + 0 != &((const SfxSetItem*)pItem)->GetItemSet(), + "SetItem without ItemSet" ); + #endif + *ppItem = *ppFnd; + } + return SFX_ITEM_SET; + } + ppFnd += *(pPtr+1) - *pPtr + 1; + pPtr += 2; + } + } + } while( bSrchInParent && 0 != ( pAktSet = pAktSet->_pParent )); + return eRet; +} + +// ----------------------------------------------------------------------- + +const SfxPoolItem* SfxItemSet::Put( const SfxPoolItem& rItem, USHORT nWhich ) +{ + DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); + DBG_ASSERT( !rItem.ISA(SfxSetItem) || + 0 != &((const SfxSetItem&)rItem).GetItemSet(), + "SetItem without ItemSet" ); + if ( !nWhich ) + return 0; //! nur wegen Outliner-Bug + SfxItemArray ppFnd = _aItems; + const USHORT* pPtr = _pWhichRanges; + while( *pPtr ) + { + if( *pPtr <= nWhich && nWhich <= *(pPtr+1) ) + { + // in diesem Bereich + ppFnd += nWhich - *pPtr; + if( *ppFnd ) // schon einer vorhanden + { + // selbes Item bereits vorhanden? + if ( *ppFnd == &rItem ) + return 0; + + // wird dontcare oder disabled mit was echtem ueberschrieben? + if ( rItem.Which() && ( IsInvalidItem(*ppFnd) || !(*ppFnd)->Which() ) ) + { + *ppFnd = &_pPool->Put( rItem, nWhich ); + return *ppFnd; + } + + // wird disabled? + if( !rItem.Which() ) + { + *ppFnd = rItem.Clone(_pPool); + return 0; + } + else + { + // selber Wert bereits vorhanden? + if ( rItem == **ppFnd ) + return 0; + + // den neuen eintragen, den alten austragen + const SfxPoolItem& rNew = _pPool->Put( rItem, nWhich ); + const SfxPoolItem* pOld = *ppFnd; + *ppFnd = &rNew; + if(nWhich <= SFX_WHICH_MAX) + Changed( *pOld, rNew ); + _pPool->Remove( *pOld ); + } + } + else + { + ++_nCount; + if( !rItem.Which() ) + *ppFnd = rItem.Clone(_pPool); + else { + const SfxPoolItem& rNew = _pPool->Put( rItem, nWhich ); + *ppFnd = &rNew; + if (nWhich <= SFX_WHICH_MAX ) + { + const SfxPoolItem& rOld = _pParent + ? _pParent->Get( nWhich, TRUE ) + : _pPool->GetDefaultItem( nWhich ); + Changed( rOld, rNew ); + } + } + } + SFX_ASSERT( !_pPool->IsItemFlag(nWhich, SFX_ITEM_POOLABLE) || + rItem.ISA(SfxSetItem) || **ppFnd == rItem, + nWhich, "putted Item unequal" ); + return *ppFnd; + } + ppFnd += *(pPtr+1) - *pPtr + 1; + pPtr += 2; + } + return 0; +} + +// ----------------------------------------------------------------------- + +int SfxItemSet::Put( const SfxItemSet& rSet, BOOL bInvalidAsDefault ) +{ + DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); + BOOL bRet = FALSE; + if( rSet.Count() ) + { + SfxItemArray ppFnd = rSet._aItems; + const USHORT* pPtr = rSet._pWhichRanges; + while ( *pPtr ) + { + for ( USHORT nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd ) + if( *ppFnd ) + { + if ( IsInvalidItem( *ppFnd ) ) + { + if ( bInvalidAsDefault ) + bRet |= 0 != ClearItem( nWhich ); + // gab GPF bei non.WIDs: + // bRet |= 0 != Put( rSet.GetPool()->GetDefaultItem(nWhich), nWhich ); + else + InvalidateItem( nWhich ); + } + else + bRet |= 0 != Put( **ppFnd, nWhich ); + } + pPtr += 2; + } + } + return bRet; +} + +// ----------------------------------------------------------------------- + +void SfxItemSet::PutExtended +( + const SfxItemSet& rSet, // Quelle der zu puttenden Items + SfxItemState eDontCareAs, // was mit DontCare-Items passiert + SfxItemState eDefaultAs // was mit Default-Items passiert +) + +/* [Beschreibung] + + Diese Methode "ubernimmt die Items aus 'rSet' in '*this'. Die + Which-Bereiche in '*this', die in 'rSet' nicht vorkommen bleiben unver- + "andert. Der Which-Bereich von '*this' bleibt auch unver"andert. + + In 'rSet' gesetzte Items werden auch in '*this*' gesetzt. Default- + (0 Pointer) und Invalid- (-1 Pointer) Items werden je nach Parameter + ('eDontCareAs' und 'eDefaultAs' behandelt: + + SFX_ITEM_SET: hart auf Default des Pools gesetzt + SFX_ITEM_DEFAULT: gel"oscht (0 Pointer) + SFX_ITEM_DONTCARE: invalidiert (-1 Pointer) + + Alle anderen Werte f"ur 'eDontCareAs' und 'eDefaultAs' sind ung"ultig. +*/ + +{ + DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); + + // don't "optimize" with "if( rSet.Count()" because of dont-care + defaults + SfxItemArray ppFnd = rSet._aItems; + const USHORT* pPtr = rSet._pWhichRanges; + while ( *pPtr ) + { + for ( USHORT nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd ) + if( *ppFnd ) + { + if ( IsInvalidItem( *ppFnd ) ) + { + // Item ist DontCare: + switch ( eDontCareAs ) + { + case SFX_ITEM_SET: + Put( rSet.GetPool()->GetDefaultItem(nWhich), nWhich ); + break; + + case SFX_ITEM_DEFAULT: + ClearItem( nWhich ); + break; + + case SFX_ITEM_DONTCARE: + InvalidateItem( nWhich ); + break; + + default: + DBG_ERROR( "invalid Argument for eDontCareAs" ); + } + } + else + // Item ist gesetzt: + Put( **ppFnd, nWhich ); + } + else + { + // Item ist Default: + switch ( eDefaultAs ) + { + case SFX_ITEM_SET: + Put( rSet.GetPool()->GetDefaultItem(nWhich), nWhich ); + break; + + case SFX_ITEM_DEFAULT: + ClearItem( nWhich ); + break; + + case SFX_ITEM_DONTCARE: + InvalidateItem( nWhich ); + break; + + default: + DBG_ERROR( "invalid Argument for eDefaultAs" ); + } + } + pPtr += 2; + } +} + +// ----------------------------------------------------------------------- + +void SfxItemSet::MergeRange( USHORT nFrom, USHORT nTo ) +/**

Description

+ + Expands the ranges of settable items by 'nFrom' to 'nTo'. Keeps state of + items which are new ranges too. +*/ + +{ + // special case: exactly one USHORT which is already included? + if ( nFrom == nTo && SFX_ITEM_AVAILABLE <= GetItemState(nFrom, FALSE) ) + return; + + // merge new range + SfxUShortRanges aRanges( _pWhichRanges ); + aRanges += SfxUShortRanges( nFrom, nTo ); + SetRanges( aRanges ); +} + +// ----------------------------------------------------------------------- + +void SfxItemSet::SetRanges( const USHORT *pNewRanges ) + +/**

Description

+ + Modifies the ranges of settable items. Keeps state of items which + are new ranges too. +*/ + +{ + // identische Ranges? + if ( _pWhichRanges == pNewRanges ) + return; + const USHORT* pOld = _pWhichRanges; + const USHORT* pNew = pNewRanges; + while ( *pOld == *pNew ) + { + if ( !*pOld && !*pNew ) + return; + ++pOld, ++pNew; + } + + // create new item-array (by iterating through all new ranges) + ULONG nSize = Capacity_Impl(pNewRanges); + SfxItemArray aNewItems = new const SfxPoolItem* [ nSize ]; + USHORT n = 0, nNewCount = 0; + if ( _nCount == 0 ) + memset( aNewItems, 0, nSize * sizeof( SfxPoolItem* ) ); + else + { + for ( const USHORT *pRange = pNewRanges; *pRange; pRange += 2 ) + { + // iterate through all ids in the range + for ( USHORT nWID = *pRange; nWID <= pRange[1]; ++nWID, ++n ) + { + // direct move of pointer (not via pool) + SfxItemState eState = GetItemState( nWID, FALSE, aNewItems+n ); + if ( SFX_ITEM_SET == eState ) + { + // increment new item count and possibly increment ref count + ++nNewCount; + aNewItems[n]->AddRef(); + } + else if ( SFX_ITEM_DISABLED == eState ) + { + // put "disabled" item + ++nNewCount; + aNewItems[n] = new SfxVoidItem(0); + } + else if ( SFX_ITEM_DONTCARE == eState ) + { + ++nNewCount; + aNewItems[n] = (SfxPoolItem*)-1; + } + else + { + // default + aNewItems[n] = 0; + } + } + } + // free old items + USHORT nOldTotalCount = TotalCount(); + for ( USHORT nItem = 0; nItem < nOldTotalCount; ++nItem ) + { + const SfxPoolItem *pItem = _aItems[nItem]; + if ( pItem && !IsInvalidItem(pItem) && pItem->Which() ) + _pPool->Remove(*pItem); + } + } + + // replace old items-array and ranges + delete[] _aItems; + _aItems = aNewItems; + _nCount = nNewCount; + + if( pNewRanges == GetPool()->GetFrozenIdRanges() ) + { + delete[] _pWhichRanges; + _pWhichRanges = ( USHORT* ) pNewRanges; + } + else + { + USHORT nCount = Count_Impl(pNewRanges) + 1; + if ( _pWhichRanges != _pPool->GetFrozenIdRanges() ) + delete[] _pWhichRanges; + _pWhichRanges = new USHORT[ nCount ]; + memcpy( _pWhichRanges, pNewRanges, sizeof( USHORT ) * nCount ); + } +} + +// ----------------------------------------------------------------------- + +int SfxItemSet::Set +( + const SfxItemSet& rSet, /* das SfxItemSet, dessen SfxPoolItems + "ubernommen werden sollen */ + + BOOL bDeep /* TRUE (default) + auch die SfxPoolItems aus den ggf. an + rSet vorhandenen Parents werden direkt + in das SfxItemSet "ubernommen + + FALSE + die SfxPoolItems aus den Parents von + rSet werden nicht ber"ucksichtigt */ +) + +/* [Beschreibung] + + Das SfxItemSet nimmt genau die SfxPoolItems an, die auch in + rSet gesetzt sind und im eigenen liegen. Alle + anderen werden entfernt. Der SfxItemPool wird dabei beibehalten, + so da"s die "ubernommenen SfxPoolItems dabei ggf. vom SfxItemPool + von rSet in den SfxItemPool von *this "ubernommen werden. + + SfxPoolItems, f"ur die in rSet IsInvalidItem() == TRUE gilt, + werden als Invalid-Item "ubernommen. + + + [R"uckgabewert] + + int TRUE + es wurden SfxPoolItems "ubernommen + + FALSE + es wurden keine SfxPoolItems "ubernommen, + da z.B. die Which-Bereiche der SfxItemSets + keine Schnittmenge haben oder in der + Schnittmenge keine SfxPoolItems in rSet + gesetzt sind + +*/ + +{ + DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); + int bRet = FALSE; + if ( _nCount ) + ClearItem(); + if ( bDeep ) + { + SfxWhichIter aIter(*this); + USHORT nWhich = aIter.FirstWhich(); + while ( nWhich ) + { + const SfxPoolItem* pItem; + if( SFX_ITEM_SET == rSet.GetItemState( nWhich, TRUE, &pItem ) ) + bRet |= 0 != Put( *pItem, pItem->Which() ); + nWhich = aIter.NextWhich(); + } + } + else + bRet = Put(rSet, FALSE); + + return bRet; +} + +//------------------------------------------------------------------------ + +const SfxPoolItem* SfxItemSet::GetItem +( + USHORT nId, // Slot-Id oder Which-Id des Items + BOOL bSrchInParent, // TRUE: auch in Parent-ItemSets suchen + TypeId aItemType // != 0 => RTTI Pruefung mit Assertion +) const + +/* [Beschreibung] + + Mit dieser Methode wird der Zugriff auf einzelne Items im + SfxItemSet wesentlich vereinfacht. Insbesondere wird die Typpr"ufung + (per Assertion) durchgef"uhrt, wodurch die Applikations-Sourcen + wesentlich "ubersichtlicher werden. In der PRODUCT-Version wird + eine 0 zur"uckgegeben, wenn das gefundene Item nicht von der + angegebenen Klasse ist. Ist kein Item mit der Id 'nWhich' in dem ItemSet, + so wird 0 zurueckgegeben. +*/ + +{ + // ggf. in Which-Id umrechnen + USHORT nWhich = GetPool()->GetWhich(nId); + + // ist das Item gesetzt oder bei bDeep==TRUE verf"ugbar? + const SfxPoolItem *pItem = 0; + SfxItemState eState = GetItemState( nWhich, bSrchInParent, &pItem ); + if ( bSrchInParent && SFX_ITEM_AVAILABLE == eState && + nWhich <= SFX_WHICH_MAX ) + pItem = &_pPool->GetDefaultItem(nWhich); + if ( pItem ) + { + // stimmt der Typ "uberein? + if ( !aItemType || pItem->IsA(aItemType) ) + return pItem; + + // sonst Fehler melden + DBG_ERROR( "invalid argument type" ); + } + + // kein Item gefunden oder falschen Typ gefunden + return 0; +} + + +//------------------------------------------------------------------------ + + +const SfxPoolItem& SfxItemSet::Get( USHORT nWhich, BOOL bSrchInParent) const +{ + DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); + // suche den Bereich in dem das Which steht: + const SfxItemSet* pAktSet = this; + do + { + if( pAktSet->Count() ) + { + SfxItemArray ppFnd = pAktSet->_aItems; + const USHORT* pPtr = pAktSet->_pWhichRanges; + while( *pPtr ) + { + if( *pPtr <= nWhich && nWhich <= *(pPtr+1) ) + { + // in diesem Bereich + ppFnd += nWhich - *pPtr; + if( *ppFnd ) + { + if( (SfxPoolItem*)-1 == *ppFnd ) { + //?MI: folgender code ist Doppelt (unten) + SFX_ASSERT(_pPool, nWhich, "kein Pool, aber Status uneindeutig"); + //!((SfxAllItemSet *)this)->aDefault.SetWhich(nWhich); + //!return aDefault; + return _pPool->GetDefaultItem( nWhich ); + } +#ifdef DBG_UTIL + const SfxPoolItem *pItem = *ppFnd; + DBG_ASSERT( !pItem->ISA(SfxSetItem) || + 0 != &((const SfxSetItem*)pItem)->GetItemSet(), + "SetItem without ItemSet" ); + if ( pItem->ISA(SfxVoidItem) || !pItem->Which() ) + DBG_WARNING( "SFX_WARNING: Getting disabled Item" ); +#endif + return **ppFnd; + } + break; // dann beim Parent suchen + } + ppFnd += *(pPtr+1) - *pPtr + 1; + pPtr += 2; + } + } +// bis zum Ende vom Such-Bereich: was nun ? zum Parent, oder Default ?? +// if( !*pPtr ) // bis zum Ende vom Such-Bereich ? +// break; + } while( bSrchInParent && 0 != ( pAktSet = pAktSet->_pParent )); + + // dann das Default vom Pool holen und returnen + SFX_ASSERT(_pPool, nWhich, "kein Pool, aber Status uneindeutig"); + const SfxPoolItem *pItem = &_pPool->GetDefaultItem( nWhich ); + DBG_ASSERT( !pItem->ISA(SfxSetItem) || + 0 != &((const SfxSetItem*)pItem)->GetItemSet(), + "SetItem without ItemSet" ); + return *pItem; +} + + // Notification-Callback +// ----------------------------------------------------------------------- + +void SfxItemSet::Changed( const SfxPoolItem&, const SfxPoolItem& ) +{ + DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); +} + +// ----------------------------------------------------------------------- + +USHORT SfxItemSet::TotalCount() const +{ + DBG_CHKTHIS(SfxItemSet, 0); // wird im Ctor benutzt bevor vollst. init. + USHORT nRet = 0; + USHORT* pPtr = _pWhichRanges; + while( *pPtr ) + { + nRet += ( *(pPtr+1) - *pPtr ) + 1; + pPtr += 2; + } + return nRet; +} +// ----------------------------------------------------------------------- + +// behalte nur die Items, die auch in rSet enthalten sein (Wert egal) + +void SfxItemSet::Intersect( const SfxItemSet& rSet ) +{ + DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); + DBG_ASSERT(_pPool, "nicht implementiert ohne Pool"); + if( !Count() ) // gar keine gesetzt ? + return; + + // loesche alle Items, die im rSet nicht mehr vorhanden sind + if( !rSet.Count() ) + { + ClearItem(); // alles loeschen + return; + } + + // teste mal, ob sich die Which-Bereiche unterscheiden. + BOOL bEqual = TRUE; + USHORT* pWh1 = _pWhichRanges; + USHORT* pWh2 = rSet._pWhichRanges; + USHORT nSize = 0; + + for( USHORT n = 0; *pWh1 && *pWh2; ++pWh1, ++pWh2, ++n ) + { + if( *pWh1 != *pWh2 ) + { + bEqual = FALSE; + break; + } + if( n & 1 ) + nSize += ( *(pWh1) - *(pWh1-1) ) + 1; + } + bEqual = *pWh1 == *pWh2; // auch die 0 abpruefen + + // sind die Bereiche identisch, ist es einfacher zu handhaben ! + if( bEqual ) + { + SfxItemArray ppFnd1 = _aItems; + SfxItemArray ppFnd2 = rSet._aItems; + + for( ; nSize; --nSize, ++ppFnd1, ++ppFnd2 ) + if( *ppFnd1 && !*ppFnd2 ) + { + // aus dem Pool loeschen + if( !IsInvalidItem( *ppFnd1 ) ) + { + USHORT nWhich = (*ppFnd1)->Which(); + if(nWhich <= SFX_WHICH_MAX) + { + const SfxPoolItem& rNew = _pParent + ? _pParent->Get( nWhich, TRUE ) + : _pPool->GetDefaultItem( nWhich ); + + Changed( **ppFnd1, rNew ); + } + _pPool->Remove( **ppFnd1 ); + } + *ppFnd1 = 0; + --_nCount; + } + } + else + { + SfxItemIter aIter( *this ); + const SfxPoolItem* pItem = aIter.GetCurItem(); + while( TRUE ) + { + USHORT nWhich = IsInvalidItem( pItem ) + ? GetWhichByPos( aIter.GetCurPos() ) + : pItem->Which(); + if( 0 == rSet.GetItemState( nWhich, FALSE ) ) + ClearItem( nWhich ); // loeschen + if( aIter.IsAtEnd() ) + break; + pItem = aIter.NextItem(); + } + } +} + +// ----------------------------------------------------------------------- + +void SfxItemSet::Differentiate( const SfxItemSet& rSet ) +{ + DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); + if( !Count() || !rSet.Count() ) // gar keine gesetzt ? + return; + + // teste mal, ob sich die Which-Bereiche unterscheiden. + BOOL bEqual = TRUE; + USHORT* pWh1 = _pWhichRanges; + USHORT* pWh2 = rSet._pWhichRanges; + USHORT nSize = 0; + + for( USHORT n = 0; *pWh1 && *pWh2; ++pWh1, ++pWh2, ++n ) + { + if( *pWh1 != *pWh2 ) + { + bEqual = FALSE; + break; + } + if( n & 1 ) + nSize += ( *(pWh1) - *(pWh1-1) ) + 1; + } + bEqual = *pWh1 == *pWh2; // auch die 0 abpruefen + + // sind die Bereiche identisch, ist es einfacher zu handhaben ! + if( bEqual ) + { + SfxItemArray ppFnd1 = _aItems; + SfxItemArray ppFnd2 = rSet._aItems; + + for( ; nSize; --nSize, ++ppFnd1, ++ppFnd2 ) + if( *ppFnd1 && *ppFnd2 ) + { + // aus dem Pool loeschen + if( !IsInvalidItem( *ppFnd1 ) ) + { + USHORT nWhich = (*ppFnd1)->Which(); + if(nWhich <= SFX_WHICH_MAX) + { + const SfxPoolItem& rNew = _pParent + ? _pParent->Get( nWhich, TRUE ) + : _pPool->GetDefaultItem( nWhich ); + + Changed( **ppFnd1, rNew ); + } + _pPool->Remove( **ppFnd1 ); + } + *ppFnd1 = 0; + --_nCount; + } + } + else + { + SfxItemIter aIter( *this ); + const SfxPoolItem* pItem = aIter.GetCurItem(); + while( TRUE ) + { + USHORT nWhich = IsInvalidItem( pItem ) + ? GetWhichByPos( aIter.GetCurPos() ) + : pItem->Which(); + if( SFX_ITEM_SET == rSet.GetItemState( nWhich, FALSE ) ) + ClearItem( nWhich ); // loeschen + if( aIter.IsAtEnd() ) + break; + pItem = aIter.NextItem(); + } + + } +} + +// ----------------------------------------------------------------------- +/* Entscheidungstabelle fuer MergeValue[s] + +Grundsaetze: + 1. Ist der Which-Wert im 1.Set "unknown", dann folgt niemals eine Aktion. + 2. Ist der Which-Wert im 2.Set "unknown", dann gilt er als "default". + 3. Es gelten fuer Vergleiche die Werte der "default"-Items. + +1.-Item 2.-Item Values bIgnoreDefs Remove Assign Add + +set set == FALSE - - - +default set == FALSE - - - +dontcare set == FALSE - - - +unknown set == FALSE - - - +set default == FALSE - - - +default default == FALSE - - - +dontcare default == FALSE - - - +unknown default == FALSE - - - +set dontcare == FALSE 1.-Item -1 - +default dontcare == FALSE - -1 - +dontcare dontcare == FALSE - - - +unknown dontcare == FALSE - - - +set unknown == FALSE 1.-Item -1 - +default unknown == FALSE - - - +dontcare unknown == FALSE - - - +unknown unknown == FALSE - - - + +set set != FALSE 1.-Item -1 - +default set != FALSE - -1 - +dontcare set != FALSE - - - +unknown set != FALSE - - - +set default != FALSE 1.-Item -1 - +default default != FALSE - - - +dontcare default != FALSE - - - +unknown default != FALSE - - - +set dontcare != FALSE 1.-Item -1 - +default dontcare != FALSE - -1 - +dontcare dontcare != FALSE - - - +unknown dontcare != FALSE - - - +set unknown != FALSE 1.-Item -1 - +default unknown != FALSE - - - +dontcare unknown != FALSE - - - +unknown unknown != FALSE - - - + +set set == TRUE - - - +default set == TRUE - 2.-Item 2.-Item +dontcare set == TRUE - - - +unknown set == TRUE - - - +set default == TRUE - - - +default default == TRUE - - - +dontcare default == TRUE - - - +unknown default == TRUE - - - +set dontcare == TRUE - - - +default dontcare == TRUE - -1 - +dontcare dontcare == TRUE - - - +unknown dontcare == TRUE - - - +set unknown == TRUE - - - +default unknown == TRUE - - - +dontcare unknown == TRUE - - - +unknown unknown == TRUE - - - + +set set != TRUE 1.-Item -1 - +default set != TRUE - 2.-Item 2.-Item +dontcare set != TRUE - - - +unknown set != TRUE - - - +set default != TRUE - - - +default default != TRUE - - - +dontcare default != TRUE - - - +unknown default != TRUE - - - +set dontcare != TRUE 1.-Item -1 - +default dontcare != TRUE - -1 - +dontcare dontcare != TRUE - - - +unknown dontcare != TRUE - - - +set unknown != TRUE - - - +default unknown != TRUE - - - +dontcare unknown != TRUE - - - +unknown unknown != TRUE - - - +*/ + + +static void MergeItem_Impl( SfxItemPool *_pPool, USHORT &rCount, + const SfxPoolItem **ppFnd1, const SfxPoolItem *pFnd2, + BOOL bIgnoreDefaults ) +{ + DBG_ASSERT( ppFnd1 != 0, "Merging to 0-Item" ); + + // 1. Item ist default? + if ( !*ppFnd1 ) + { + if ( IsInvalidItem(pFnd2) ) + // Entscheidungstabelle: default, dontcare, egal, egal + *ppFnd1 = (SfxPoolItem*) -1; + + else if ( pFnd2 && !bIgnoreDefaults && + _pPool->GetDefaultItem(pFnd2->Which()) != *pFnd2 ) + // Entscheidungstabelle: default, set, !=, FALSE + *ppFnd1 = (SfxPoolItem*) -1; + + else if ( pFnd2 && bIgnoreDefaults ) + // Entscheidungstabelle: default, set, egal, TRUE + *ppFnd1 = &_pPool->Put( *pFnd2 ); + + if ( *ppFnd1 ) + ++rCount; + } + + // 1. Item ist gesetzt? + else if ( !IsInvalidItem(*ppFnd1) ) + { + if ( !pFnd2 ) + { + // 2. Item ist default + if ( !bIgnoreDefaults && + **ppFnd1 != _pPool->GetDefaultItem((*ppFnd1)->Which()) ) + { + // Entscheidungstabelle: set, default, !=, FALSE + _pPool->Remove( **ppFnd1 ); + *ppFnd1 = (SfxPoolItem*) -1; + } + } + else if ( IsInvalidItem(pFnd2) ) + { + // 2. Item ist dontcare + if ( !bIgnoreDefaults || + **ppFnd1 != _pPool->GetDefaultItem( (*ppFnd1)->Which()) ) + { + // Entscheidungstabelle: set, dontcare, egal, FALSE + // oder: set, dontcare, !=, TRUE + _pPool->Remove( **ppFnd1 ); + *ppFnd1 = (SfxPoolItem*) -1; + } + } + else + { + // 2. Item ist gesetzt + if ( **ppFnd1 != *pFnd2 ) + { + // Entscheidungstabelle: set, set, !=, egal + _pPool->Remove( **ppFnd1 ); + *ppFnd1 = (SfxPoolItem*) -1; + } + } + } +} + +// ----------------------------------------------------------------------- + +void SfxItemSet::MergeValues( const SfxItemSet& rSet, BOOL bIgnoreDefaults ) +{ + // Achtung!!! Bei Aenderungen/Bugfixes immer obenstehende Tabelle pflegen! + DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); + DBG_ASSERT( GetPool() == rSet.GetPool(), "MergeValues mit verschiedenen Pools" ); + + // teste mal, ob sich die Which-Bereiche unterscheiden. + BOOL bEqual = TRUE; + USHORT* pWh1 = _pWhichRanges; + USHORT* pWh2 = rSet._pWhichRanges; + USHORT nSize = 0; + + for( USHORT n = 0; *pWh1 && *pWh2; ++pWh1, ++pWh2, ++n ) + { + if( *pWh1 != *pWh2 ) + { + bEqual = FALSE; + break; + } + if( n & 1 ) + nSize += ( *(pWh1) - *(pWh1-1) ) + 1; + } + bEqual = *pWh1 == *pWh2; // auch die 0 abpruefen + + // sind die Bereiche identisch, ist es effizieter zu handhaben ! + if( bEqual ) + { + SfxItemArray ppFnd1 = _aItems; + SfxItemArray ppFnd2 = rSet._aItems; + + for( ; nSize; --nSize, ++ppFnd1, ++ppFnd2 ) + MergeItem_Impl( _pPool, _nCount, ppFnd1, *ppFnd2, bIgnoreDefaults ); + } + else + { + SfxWhichIter aIter( rSet ); + register USHORT nWhich; + while( 0 != ( nWhich = aIter.NextWhich() ) ) + { + const SfxPoolItem* pItem = 0; + rSet.GetItemState( nWhich, TRUE, &pItem ); + if( !pItem ) + { + // nicht gesetzt, also default + if ( !bIgnoreDefaults ) + MergeValue( rSet.GetPool()->GetDefaultItem( nWhich ), bIgnoreDefaults ); + } + else if( IsInvalidItem( pItem ) ) + // dont care + InvalidateItem( nWhich ); + else + MergeValue( *pItem, bIgnoreDefaults ); + } + } +} + +// ----------------------------------------------------------------------- + +void SfxItemSet::MergeValue( const SfxPoolItem& rAttr, BOOL bIgnoreDefaults ) +{ + DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); + SfxItemArray ppFnd = _aItems; + const USHORT* pPtr = _pWhichRanges; + const USHORT nWhich = rAttr.Which(); + while( *pPtr ) + { + // in diesem Bereich? + if( *pPtr <= nWhich && nWhich <= *(pPtr+1) ) + { + ppFnd += nWhich - *pPtr; + MergeItem_Impl( _pPool, _nCount, ppFnd, &rAttr, bIgnoreDefaults ); + break; + } + ppFnd += *(pPtr+1) - *pPtr + 1; + pPtr += 2; + } +} + +// ----------------------------------------------------------------------- + +void SfxItemSet::InvalidateItem( USHORT nWhich ) +{ + DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); + SfxItemArray ppFnd = _aItems; + const USHORT* pPtr = _pWhichRanges; + while( *pPtr ) + { + if( *pPtr <= nWhich && nWhich <= *(pPtr+1) ) + { + // in diesem Bereich + ppFnd += nWhich - *pPtr; + + if( *ppFnd ) // bei mir gesetzt + { + if( (SfxPoolItem*)-1 != *ppFnd ) // noch nicht dontcare ! + { + _pPool->Remove( **ppFnd ); + *ppFnd = (SfxPoolItem*)-1; + } + } + else + { + *ppFnd = (SfxPoolItem*)-1; + ++_nCount; + } + break; + } + ppFnd += *(pPtr+1) - *pPtr + 1; + pPtr += 2; + } +} + +// ----------------------------------------------------------------------- + +USHORT SfxItemSet::GetWhichByPos( USHORT nPos ) const +{ + DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); + USHORT n = 0; + USHORT* pPtr = _pWhichRanges; + while( *pPtr ) + { + n = ( *(pPtr+1) - *pPtr ) + 1; + if( nPos < n ) + return *(pPtr)+nPos; + nPos = nPos - n; + pPtr += 2; + } + DBG_ASSERT( FALSE, "Hier sind wir falsch" ); + return 0; +} + +// ----------------------------------------------------------------------- + +SvStream &SfxItemSet::Store +( + SvStream& rStream, // Zielstream f"ur normale Items + FASTBOOL bDirect // TRUE: Items direkt speicher, FALSE: Surrogate +) const + +/* [Beschreibung] + + Speichert die -Instanz in den angegebenen Stream. Dabei + werden die Surrorage der gesetzten s bzw. ('bDirect==TRUE') + die gesetzten Items selbst wie folgt im Stream abgelegt: + + USHORT (Count) Anzahl der gesetzten Items + Count* _pPool->StoreItem() siehe + + + [Querverweise] + + +*/ + +{ + DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); + DBG_ASSERT( _pPool, "Kein Pool" ); + DBG_ASSERTWARNING( _pPool == _pPool->GetMasterPool(), "kein Master-Pool" ); + + // Position des Counts merken, um ggf. zu korrigieren + ULONG nCountPos = rStream.Tell(); + rStream << _nCount; + + // wenn nichts zu speichern ist, auch keinen ItemIter aufsetzen! + if ( _nCount ) + { + // mitz"ahlen wieviel Items tats"achlich gespeichert werden + USHORT nWrittenCount = 0; // Anzahl in 'rStream' gestreamter Items + + // "uber alle gesetzten Items iterieren + SfxItemIter aIter(*this); + for ( const SfxPoolItem *pItem = aIter.FirstItem(); + pItem; + pItem = aIter.NextItem() ) + { + // Item (ggf. als Surrogat) via Pool speichern lassen + DBG_ASSERT( !IsInvalidItem(pItem), "can't store invalid items" ); + if ( !IsInvalidItem(pItem) && + _pPool->StoreItem( rStream, *pItem, bDirect ) ) + // Item wurde in 'rStream' gestreamt + ++nWrittenCount; + }; + + // weniger geschrieben als enthalten (z.B. altes Format) + if ( nWrittenCount != _nCount ) + { + // tats"achlichen Count im Stream ablegen + ULONG nPos = rStream.Tell(); + rStream.Seek( nCountPos ); + rStream << nWrittenCount; + rStream.Seek( nPos ); + } + } + + return rStream; +} + +// ----------------------------------------------------------------------- + +SvStream &SfxItemSet::Load +( + SvStream& rStream, // Stream, aus dem geladen werden soll + + FASTBOOL bDirect, /* TRUE + Items werden direkt aus dem Stream + gelesen, nicht "uber Surrogate + + FALSE (default) + Items werden "uber Surrogate gelesen */ + + const SfxItemPool* pRefPool /* Pool, der die Surrogate aufl"osen kann + (z.B. zum Einf"ugen von Dokumenten) */ +) + +/* [Beschreibung] + + Diese Methode l"adt ein aus einem Stream. Falls der + ohne Ref-Counts geladen wurde, werden die geladenen + Item-Referenzen in den Items hochgez"ahlt, ansonsten wird vorausgesetzt, + da\s sie schon beim Laden des SfxItemPools ber"ucksichtigt waren. + + [Querverweise] + + +*/ + +{ + DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); + DBG_ASSERT( _pPool, "Kein Pool"); + DBG_ASSERTWARNING( _pPool == _pPool->GetMasterPool(), "Kein Master-Pool"); + + // kein Ref-Pool => Surrogate mit Pool des ItemSets aufl"osen + if ( !pRefPool ) + pRefPool = _pPool; + + // Anzahl der zu ladenden Items laden und dann ebensoviele Items + USHORT nCount = 0; + rStream >> nCount; + for ( USHORT i = 0; i < nCount; ++i ) + { + // Surrogat/Item laden und (Surrogat) aufl"osen lassen + const SfxPoolItem *pItem = + _pPool->LoadItem( rStream, bDirect, pRefPool ); + + // konnte ein Item geladen oder via Surrogat aufgel"ost werden? + if ( pItem ) + { + // Position f"ur Item-Pointer im Set suchen + USHORT nWhich = pItem->Which(); + SfxItemArray ppFnd = _aItems; + const USHORT* pPtr = _pWhichRanges; + while ( *pPtr ) + { + // in diesem Bereich? + if ( *pPtr <= nWhich && nWhich <= *(pPtr+1) ) + { + // Item-Pointer im Set merken + ppFnd += nWhich - *pPtr; + SFX_ASSERT( !*ppFnd, nWhich, "Item doppelt eingetragen"); + *ppFnd = pItem; + ++_nCount; + break; + } + + // im Range-Array und Item-Array zum n"achsten Which-Range + ppFnd += *(pPtr+1) - *pPtr + 1; + pPtr += 2; + } + } + } + + return rStream; +} + +// ----------------------------------------------------------------------- + +int SfxItemSet::operator==(const SfxItemSet &rCmp) const +{ + DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); + DBG_CHKOBJ(&rCmp, SfxItemSet, DbgCheckItemSet); + + // besonders schnell zu ermittelnde Werte muessen gleich sein + if ( _pParent != rCmp._pParent || + _pPool != rCmp._pPool || + Count() != rCmp.Count() ) + return FALSE; + + // Ranges durchzaehlen lassen dauert laenger, muss aber auch gleich sein + USHORT nCount1 = TotalCount(); + USHORT nCount2 = rCmp.TotalCount(); + if ( nCount1 != nCount2 ) + return FALSE; + + // sind die Ranges selbst ungleich? + for ( USHORT nRange = 0; _pWhichRanges[nRange]; nRange += 2 ) + if ( _pWhichRanges[nRange] != rCmp._pWhichRanges[nRange] || + _pWhichRanges[nRange+1] != rCmp._pWhichRanges[nRange+1] ) + { + // dann m"ussen wir die langsame Methode verwenden + SfxWhichIter aIter( *this ); + for ( USHORT nWh = aIter.FirstWhich(); + nWh; + nWh = aIter.NextWhich() ) + { + // wenn die Pointer von poolable Items ungleich sind, + // muessen die Items gleich sein + const SfxPoolItem *pItem1 = 0, *pItem2 = 0; + if ( GetItemState( nWh, FALSE, &pItem1 ) != + rCmp.GetItemState( nWh, FALSE, &pItem2 ) || + ( pItem1 != pItem2 && + ( !pItem1 || IsInvalidItem(pItem1) || + ( _pPool->IsItemFlag(*pItem1, SFX_ITEM_POOLABLE) && + *pItem1 != *pItem2 ) ) ) ) + return FALSE; + } + + return TRUE; + } + + // Pointer alle gleich? + if ( 0 == memcmp( _aItems, rCmp._aItems, nCount1 * sizeof(_aItems[0]) ) ) + return TRUE; + + // dann werden wir wohl alle einzeln vergleichen muessen + const SfxPoolItem **ppItem1 = (const SfxPoolItem**) _aItems; + const SfxPoolItem **ppItem2 = (const SfxPoolItem**) rCmp._aItems; + for ( USHORT nPos = 0; nPos < nCount1; ++nPos ) + { + // wenn die Pointer von poolable Items ungleich sind, + // muessen die Items gleich sein + if ( *ppItem1 != *ppItem2 && + ( ( !*ppItem1 || !*ppItem2 ) || + ( IsInvalidItem(*ppItem1) || IsInvalidItem(*ppItem2) ) || + ( _pPool->IsItemFlag(**ppItem1, SFX_ITEM_POOLABLE) ) || + **ppItem1 != **ppItem2 ) ) + return FALSE; + + ++ppItem1; + ++ppItem2; + } + + return TRUE; +} + +// ----------------------------------------------------------------------- + +SfxItemSet *SfxItemSet::Clone(BOOL bItems, SfxItemPool *pToPool ) const +{ + DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); + if ( pToPool && pToPool != _pPool ) + { + SfxItemSet *pNewSet = new SfxItemSet( *pToPool, _pWhichRanges ); + if ( bItems ) + { + SfxWhichIter aIter(*pNewSet); + USHORT nWhich = aIter.FirstWhich(); + while ( nWhich ) + { + const SfxPoolItem* pItem; + if ( SFX_ITEM_SET == GetItemState( nWhich, FALSE, &pItem ) ) + pNewSet->Put( *pItem, pItem->Which() ); + nWhich = aIter.NextWhich(); + } + } + return pNewSet; + } + else + return bItems + ? new SfxItemSet(*this) + : new SfxItemSet(*_pPool, _pWhichRanges); +} + +// ----------------------------------------------------------------------- + +int SfxItemSet::PutDirect(const SfxPoolItem &rItem) +{ + DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); + SfxItemArray ppFnd = _aItems; + const USHORT* pPtr = _pWhichRanges; + const USHORT nWhich = rItem.Which(); +#ifdef DBG_UTIL + IsPoolDefaultItem(&rItem) || _pPool->GetSurrogate(&rItem); + // nur Assertion in den callees provozieren +#endif + while( *pPtr ) + { + if( *pPtr <= nWhich && nWhich <= *(pPtr+1) ) + { + // in diesem Bereich + ppFnd += nWhich - *pPtr; + const SfxPoolItem* pOld = *ppFnd; + if( pOld ) // schon einer vorhanden + { + if( rItem == **ppFnd ) + return FALSE; // schon vorhanden ! + _pPool->Remove( *pOld ); + } + else + ++_nCount; + + // den neuen eintragen + if( IsPoolDefaultItem(&rItem) ) + *ppFnd = &_pPool->Put( rItem ); + else + { + *ppFnd = &rItem; + if( !IsStaticDefaultItem( &rItem ) ) + rItem.AddRef(); + } + + return TRUE; + } + ppFnd += *(pPtr+1) - *pPtr + 1; + pPtr += 2; + } + return FALSE; +} + +// ----------------------------------------------------------------------- + +SfxAllItemSet::SfxAllItemSet( SfxItemPool &rPool ) +: SfxItemSet(rPool, (const USHORT*) 0), + aDefault(0), + nFree(nInitCount) +{ + // initial keine Items + _aItems = 0; + + // nInitCount Paare an USHORTs fuer Ranges allozieren + _pWhichRanges = new USHORT[ nInitCount + 1 ]; + memset( _pWhichRanges, 0, ( nInitCount + 1 ) * sizeof(USHORT) ); +} + + +// ----------------------------------------------------------------------- + + +SfxAllItemSet::SfxAllItemSet(const SfxItemSet &rCopy) +: SfxItemSet(rCopy), + aDefault(0), + nFree(0) +{ +} + +// ----------------------------------------------------------------------- + + + +SfxAllItemSet::SfxAllItemSet(const SfxAllItemSet &rCopy) +: SfxItemSet(rCopy), + aDefault(0), + nFree(0) +/* [Anmerkung] + + Der mu\s sein, da sonst vom Compiler einer generiert wird, er nimmt + nicht den Ctor mit der 'const SfxItemSet&'! +*/ +{ +} + +// ----------------------------------------------------------------------- + +static USHORT *AddRanges_Impl( + USHORT *pUS, std::ptrdiff_t nOldSize, USHORT nIncr) + +/* Diese interne Funktion erzeugt ein neues Which-Range-Array, welches von + dem 'nOldSize'-USHORTs langen 'pUS' kopiert wird und hinten an Platz + f"ur 'nIncr' neue USHORTs hat. Das terminierende USHORT mit der '0' + wird weder in 'nOldSize' noch in 'nIncr' mitgez"ahlt, sondern implizit + hinzugerechnet. + + Das neue Which-Range-Array wird als Returnwert zur"uckgegeben, das alte + 'pUS' freigegeben. +*/ + +{ + // neues Which-Range-Array anlegen + USHORT *pNew = new USHORT[ nOldSize + nIncr + 1 ]; + + // die alten Ranges "ubernehmen + memcpy( pNew, pUS, nOldSize * sizeof(USHORT) ); + + // die neuen auf 0 initialisieren + memset( pNew + nOldSize, 0, ( nIncr + 1 ) * sizeof(USHORT) ); + + // das alte Array freigeben + delete[] pUS; + + return pNew; +} + +// ----------------------------------------------------------------------- + +static SfxItemArray AddItem_Impl(SfxItemArray pItems, USHORT nOldSize, USHORT nPos) + +/* Diese interne Funktion erzeugt ein neues ItemArray, welches von 'pItems' + kopiert wird, an der Position 'nPos' jedoch Platz f"ur einen neuen + ItemPointer hat. + + Das neue ItemArray wird als Returnwert zur"uckgegeben, das alte 'pItems' + wird freigegeben. +*/ + +{ + // neues ItemArray anlegen + SfxItemArray pNew = new const SfxPoolItem*[nOldSize+1]; + + // war schon vorher eins da? + if ( pItems ) + { + // alte Items vor nPos kopieren + if ( nPos ) + memcpy( (void*) pNew, pItems, nPos * sizeof(SfxPoolItem **) ); + + // alte Items hinter nPos kopieren + if ( nPos < nOldSize ) + memcpy( (void*) (pNew + nPos + 1), pItems + nPos, + (nOldSize-nPos) * sizeof(SfxPoolItem **) ); + } + + // neues Item initialisieren + *(pNew + nPos) = 0; + + // altes ItemArray freigeben + delete[] pItems; + + return pNew; +} + +// ----------------------------------------------------------------------- + +const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, USHORT nWhich ) + +// Putten mit automatischer Erweiterung der Whichs-Ids um die ID +// des Items. + +{ + USHORT nPos = 0; // Position f"ur 'rItem' in '_aItems' + const USHORT nItemCount = TotalCount(); + + // erstmal sehen, ob es schon einen passenden Bereich gibt + USHORT *pPtr = _pWhichRanges; + while ( *pPtr ) + { + // Which-Id liegt in diesem Bereich? + if( *pPtr <= nWhich && nWhich <= *(pPtr+1) ) + { + // Einfuegen + nPos += nWhich - *pPtr; + break; + } + + // Position des Items in _aItems mitf"uhren + nPos += *(pPtr+1) - *pPtr + 1; + + // zum n"achsten Bereich + pPtr += 2; + } + + // Which-Id noch nicht vorhanden? + if ( !*pPtr ) + { + // suchen, ob man sie irgendwo dranpacken kann + pPtr = _pWhichRanges; + nPos = 0; + while ( *pPtr ) + { + // Which-Id liegt exakt vor diesem Bereich? + if ( (nWhich+1) == *pPtr ) + { + // Bereich waechst nach unten + (*pPtr)--; + + // vor erstem Item dieses Bereichs Platz schaffen + _aItems = AddItem_Impl(_aItems, nItemCount, nPos); + break; + } + + // Which-Id liegt exakt hinter diesem Bereich? + else if ( (nWhich-1) == *(pPtr+1) ) + { + // Bereich waechst nach oben + (*(pPtr+1))++; + + // hinter letztem Item dieses Bereichs Platz schaffen + nPos += nWhich - *pPtr; + _aItems = AddItem_Impl(_aItems, nItemCount, nPos); + break; + } + + // Position des Items in _aItems mitf"uhren + nPos += *(pPtr+1) - *pPtr + 1; + + // zum n"achsten Bereich + pPtr += 2; + } + } + + // keinen erweiterbaren Bereich gefunden? + if ( !*pPtr ) + { + // kein Platz mehr in _pWhichRanges => erweitern + std::ptrdiff_t nSize = pPtr - _pWhichRanges; + if( !nFree ) + { + _pWhichRanges = AddRanges_Impl(_pWhichRanges, nSize, nInitCount); + nFree += nInitCount; + } + + // neuen Which-Range anh"angen + pPtr = _pWhichRanges + nSize; + *pPtr++ = nWhich; + *pPtr = nWhich; + nFree -= 2; + + // Itemarray vergroessern + nPos = nItemCount; + _aItems = AddItem_Impl(_aItems, nItemCount, nPos); + } + + // neues Item in Pool aufnehmen + const SfxPoolItem& rNew = _pPool->Put( rItem, nWhich ); + + // altes Item merken + BOOL bIncrementCount = FALSE; + const SfxPoolItem* pOld = *( _aItems + nPos ); + if ( reinterpret_cast< SfxPoolItem* >( -1 ) == pOld ) // state "dontcare" + pOld = NULL; + if ( !pOld ) + { + bIncrementCount = TRUE; + pOld = _pParent ? + &_pParent->Get( nWhich, TRUE ) + : nWhich <= SFX_WHICH_MAX ? &_pPool->GetDefaultItem( nWhich ) : 0; + } + + // neue Item in ItemSet aufnehmen + *(_aItems + nPos) = &rNew; + + // Changed Notification versenden + if ( pOld ) + { + Changed( *pOld, rNew ); + if ( !IsDefaultItem(pOld) ) + _pPool->Remove( *pOld ); + } + + if ( bIncrementCount ) + ++_nCount; + + return &rNew; +} + +// ----------------------------------------------------------------------- + + +/* Diese Methode wird forwarded, damit sie nicht durch die anderen + Put-Methoden dieser SubClass gehided wird. +*/ + +int SfxAllItemSet::Put( const SfxItemSet& rSet, BOOL bInvalidAsDefault ) +{ + //? pruefen, ob Which-Ranges erweitert werden + return SfxItemSet::Put( rSet, bInvalidAsDefault ); +} + +// ----------------------------------------------------------------------- +// Item disablen, wenn durch ein VoidItem mit dem Which-Wert 0 ausgedrueckt + +void SfxItemSet::DisableItem(USHORT nWhich) +{ + DBG_CHKTHIS(SfxItemSet, 0); + Put( SfxVoidItem(0), nWhich ); +} + +// ----------------------------------------------------------------------- + +#if 0 +BOOL SfxAllItemSet::Remove(USHORT nWhich) +{ + DBG_CHKTHIS(SfxAllItemSet, 0); + USHORT *pPtr = _pWhichRanges; + USHORT nPos = 0; + while( *pPtr ) + { + if( *pPtr <= nWhich && nWhich <= *(pPtr+1) ) + { + USHORT *pTmp = pPtr; + USHORT nLeft = 0; + USHORT nRest = 0; + while(*++pTmp){ + if( nLeft & 1 ) + nRest = *pTmp - *(pTmp-1) + 1; + ++nLeft; + } + + // in diesem Bereich + nPos += nWhich - *pPtr; + nRest -= nWhich - *pPtr; + // 3,3 + if(*pPtr == nWhich && *(pPtr+1) == nWhich) { + memmove(pPtr, pPtr + 2, nLeft * sizeof(USHORT)); + nFree += 2; + } + // Anfang + else if(*pPtr == nWhich) + (*pPtr)++; + // Ende + else if(*(pPtr+1) == nWhich) + (*(pPtr+1))--; + else { + if(nPos + nRest + 2 > nFree) { + USHORT nOf = pPtr - _pWhichRanges; + _pWhichRanges = IncrSize(_pWhichRanges, nPos + nRest, nInitCount); + nFree += nInitCount; + pPtr = _pWhichRanges + nOf; + } + memmove(pPtr +2, pPtr, (nLeft+2) * sizeof(USHORT)); + *++pPtr = nWhich-1; + *++pPtr = nWhich+1; + nFree -= 2; + } + SfxPoolItem* pItem = *( _aItems + nPos ); + if( pItem ) + { + if(_pPool) + _pPool->Remove(*pItem ); + else + delete pItem; + --_nCount; + } + memmove(_aItems + nPos +1, _aItems + nPos, + sizeof(SfxPoolItem *) * (nRest - 1)); + break; // dann beim Parent suchen + } + nPos += *(pPtr+1) - *pPtr + 1; + pPtr += 2; + } + return *pPtr? TRUE: FALSE; +} +#endif + +// ----------------------------------------------------------------------- + +SfxItemSet *SfxAllItemSet::Clone(BOOL bItems, SfxItemPool *pToPool ) const +{ + DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); + if ( pToPool && pToPool != _pPool ) + { + SfxAllItemSet *pNewSet = new SfxAllItemSet( *pToPool ); + if ( bItems ) + pNewSet->Set( *this ); + return pNewSet; + } + else + return bItems ? new SfxAllItemSet(*this) : new SfxAllItemSet(*_pPool); +} + diff --git a/svl/source/items/lckbitem.cxx b/svl/source/items/lckbitem.cxx new file mode 100644 index 000000000000..c848e377b257 --- /dev/null +++ b/svl/source/items/lckbitem.cxx @@ -0,0 +1,194 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: lckbitem.cxx,v $ + * $Revision: 1.8 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#define _LCKBITEM_CXX +#include +#include +#include +#include +#include + +// STATIC DATA ----------------------------------------------------------- + + +// ----------------------------------------------------------------------- + +TYPEINIT1_AUTOFACTORY(SfxLockBytesItem, SfxPoolItem); + +// ----------------------------------------------------------------------- + +SfxLockBytesItem::SfxLockBytesItem() +{ +} + +// ----------------------------------------------------------------------- + +SfxLockBytesItem::SfxLockBytesItem( USHORT nW, SvLockBytes *pLockBytes ) +: SfxPoolItem( nW ), + _xVal( pLockBytes ) +{ +} + +// ----------------------------------------------------------------------- + +SfxLockBytesItem::SfxLockBytesItem( USHORT nW, SvStream &rStream ) +: SfxPoolItem( nW ) +{ + rStream.Seek( 0L ); + _xVal = new SvLockBytes( new SvCacheStream(), TRUE ); + + SvStream aLockBytesStream( _xVal ); + rStream >> aLockBytesStream; +} + +// ----------------------------------------------------------------------- + +SfxLockBytesItem::SfxLockBytesItem( const SfxLockBytesItem& rItem ) +: SfxPoolItem( rItem ), + _xVal( rItem._xVal ) +{ +} + +// ----------------------------------------------------------------------- + +SfxLockBytesItem::~SfxLockBytesItem() +{ +} + +// ----------------------------------------------------------------------- + +int SfxLockBytesItem::operator==( const SfxPoolItem& rItem ) const +{ + return ((SfxLockBytesItem&)rItem)._xVal == _xVal; +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxLockBytesItem::Clone(SfxItemPool *) const +{ + return new SfxLockBytesItem( *this ); +} + +// ----------------------------------------------------------------------- + +#define MAX_BUF 32000 + +SfxPoolItem* SfxLockBytesItem::Create( SvStream &rStream, USHORT ) const +{ + sal_uInt32 nSize = 0; + ULONG nActRead = 0; + sal_Char cTmpBuf[MAX_BUF]; + SvMemoryStream aNewStream; + rStream >> nSize; + + do { + ULONG nToRead; + if( (nSize - nActRead) > MAX_BUF ) + nToRead = MAX_BUF; + else + nToRead = nSize - nActRead; + nActRead += rStream.Read( cTmpBuf, nToRead ); + aNewStream.Write( cTmpBuf, nToRead ); + } while( nSize > nActRead ); + + return new SfxLockBytesItem( Which(), aNewStream ); +} + +// ----------------------------------------------------------------------- + +SvStream& SfxLockBytesItem::Store(SvStream &rStream, USHORT ) const +{ + SvStream aLockBytesStream( _xVal ); + sal_uInt32 nSize = aLockBytesStream.Seek( STREAM_SEEK_TO_END ); + aLockBytesStream.Seek( 0L ); + + rStream << nSize; + rStream << aLockBytesStream; + + return rStream; +} + +//---------------------------------------------------------------------------- +// virtual +BOOL SfxLockBytesItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE ) +{ + com::sun::star::uno::Sequence< sal_Int8 > aSeq; + if ( rVal >>= aSeq ) + { + if ( aSeq.getLength() ) + { + SvCacheStream* pStream = new SvCacheStream; + pStream->Write( (void*)aSeq.getConstArray(), aSeq.getLength() ); + pStream->Seek(0); + + _xVal = new SvLockBytes( pStream, TRUE ); + } + else + _xVal = NULL; + + return TRUE; + } + + DBG_ERROR( "SfxLockBytesItem::PutValue - Wrong type!" ); + return FALSE; +} + +//---------------------------------------------------------------------------- +// virtual +BOOL SfxLockBytesItem::QueryValue( com::sun::star::uno::Any& rVal,BYTE ) const +{ + if ( _xVal.Is() ) + { + sal_uInt32 nLen; + SvLockBytesStat aStat; + + if ( _xVal->Stat( &aStat, SVSTATFLAG_DEFAULT ) == ERRCODE_NONE ) + nLen = aStat.nSize; + else + return FALSE; + + ULONG nRead = 0; + com::sun::star::uno::Sequence< sal_Int8 > aSeq( nLen ); + + _xVal->ReadAt( 0, aSeq.getArray(), nLen, &nRead ); + rVal <<= aSeq; + } + else + { + com::sun::star::uno::Sequence< sal_Int8 > aSeq( 0 ); + rVal <<= aSeq; + } + + return TRUE; +} + diff --git a/svl/source/items/macitem.cxx b/svl/source/items/macitem.cxx new file mode 100644 index 000000000000..480fb844ccc7 --- /dev/null +++ b/svl/source/items/macitem.cxx @@ -0,0 +1,298 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: macitem.cxx,v $ + * $Revision: 1.11 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include + +#ifndef GCC +#endif + +#include + +// STATIC DATA ----------------------------------------------------------- + +DBG_NAME(SvxMacroItem); + +// ----------------------------------------------------------------------- + +TYPEINIT1_FACTORY(SvxMacroItem, SfxPoolItem, new SvxMacroItem(0)); + +// ----------------------------------------------------------------------- + + +SjJSbxObjectBase::~SjJSbxObjectBase() +{ +} + +SjJSbxObjectBase* SjJSbxObjectBase::Clone( void ) +{ + return NULL; +} + +SvxMacro::SvxMacro( const String &rMacName, const String &rLanguage) + : aMacName( rMacName ), aLibName( rLanguage), + pFunctionObject(NULL), eType( EXTENDED_STYPE) +{ + if (rLanguage.EqualsAscii(SVX_MACRO_LANGUAGE_STARBASIC)) + eType=STARBASIC; + else if (rLanguage.EqualsAscii(SVX_MACRO_LANGUAGE_JAVASCRIPT)) + eType=JAVASCRIPT; +} + + +SvxMacro::~SvxMacro() +{ + delete pFunctionObject; +} + +String SvxMacro::GetLanguage()const +{ + if(eType==STARBASIC) + { + return UniString::CreateFromAscii( + RTL_CONSTASCII_STRINGPARAM(SVX_MACRO_LANGUAGE_STARBASIC)); + } + else if(eType==JAVASCRIPT) + { + return UniString::CreateFromAscii( + RTL_CONSTASCII_STRINGPARAM(SVX_MACRO_LANGUAGE_JAVASCRIPT)); + } + else if(eType==EXTENDED_STYPE) + { + return UniString::CreateFromAscii( + RTL_CONSTASCII_STRINGPARAM(SVX_MACRO_LANGUAGE_SF)); + + } + return aLibName; +} + + + +SvxMacro& SvxMacro::operator=( const SvxMacro& rBase ) +{ + if( this != &rBase ) + { + aMacName = rBase.aMacName; + aLibName = rBase.aLibName; + delete pFunctionObject; + pFunctionObject = rBase.pFunctionObject ? rBase.pFunctionObject->Clone() : NULL; + eType = rBase.eType; + } + return *this; +} + + +SvxMacroTableDtor& SvxMacroTableDtor::operator=( const SvxMacroTableDtor& rTbl ) +{ + DelDtor(); + SvxMacro* pTmp = ((SvxMacroTableDtor&)rTbl).First(); + while( pTmp ) + { + SvxMacro *pNew = new SvxMacro( *pTmp ); + Insert( rTbl.GetCurKey(), pNew ); + pTmp = ((SvxMacroTableDtor&)rTbl).Next(); + } + return *this; +} + + +SvStream& SvxMacroTableDtor::Read( SvStream& rStrm, USHORT nVersion ) +{ + if( SVX_MACROTBL_VERSION40 <= nVersion ) + rStrm >> nVersion; + short nMacro; + rStrm >> nMacro; + + for( short i = 0; i < nMacro; ++i ) + { + USHORT nCurKey, eType = STARBASIC; + String aLibName, aMacName; + rStrm >> nCurKey; + SfxPoolItem::readByteString(rStrm, aLibName); + SfxPoolItem::readByteString(rStrm, aMacName); + + if( SVX_MACROTBL_VERSION40 <= nVersion ) + rStrm >> eType; + + SvxMacro* pNew = new SvxMacro( aMacName, aLibName, (ScriptType)eType ); + + SvxMacro *pOld = Get( nCurKey ); + if( pOld ) + { + delete pOld; + Replace( nCurKey, pNew ); + } + else + Insert( nCurKey, pNew ); + } + return rStrm; +} + + +SvStream& SvxMacroTableDtor::Write( SvStream& rStream ) const +{ + USHORT nVersion = SOFFICE_FILEFORMAT_31 == rStream.GetVersion() + ? SVX_MACROTBL_VERSION31 + : SVX_MACROTBL_AKTVERSION; + + if( SVX_MACROTBL_VERSION40 <= nVersion ) + rStream << nVersion; + + rStream << (USHORT)Count(); + + SvxMacro* pMac = ((SvxMacroTableDtor*)this)->First(); + while( pMac && rStream.GetError() == SVSTREAM_OK ) + { + rStream << (short)GetCurKey(); + SfxPoolItem::writeByteString(rStream, pMac->GetLibName()); + SfxPoolItem::writeByteString(rStream, pMac->GetMacName()); + + if( SVX_MACROTBL_VERSION40 <= nVersion ) + rStream << (USHORT)pMac->GetScriptType(); + pMac = ((SvxMacroTableDtor*)this)->Next(); + } + return rStream; +} + +// ----------------------------------------------------------------------- + +void SvxMacroTableDtor::DelDtor() +{ + SvxMacro* pTmp = First(); + while( pTmp ) + { + delete pTmp; + pTmp = Next(); + } + Clear(); +} + +// ----------------------------------------------------------------------- + +int SvxMacroItem::operator==( const SfxPoolItem& rAttr ) const +{ + DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); + + const SvxMacroTableDtor& rOwn = aMacroTable; + const SvxMacroTableDtor& rOther = ( (SvxMacroItem&) rAttr ).aMacroTable; + + // Anzahl unterschiedlich => auf jeden Fall ungleich + if ( rOwn.Count() != rOther.Count() ) + return FALSE; + + // einzeln verleichen; wegen Performance ist die Reihenfolge wichtig + for ( USHORT nNo = 0; nNo < rOwn.Count(); ++nNo ) + { + const SvxMacro *pOwnMac = rOwn.GetObject(nNo); + const SvxMacro *pOtherMac = rOther.GetObject(nNo); + if ( rOwn.GetKey(pOwnMac) != rOther.GetKey(pOtherMac) || + pOwnMac->GetLibName() != pOtherMac->GetLibName() || + pOwnMac->GetMacName() != pOtherMac->GetMacName() ) + return FALSE; + } + + return TRUE; +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SvxMacroItem::Clone( SfxItemPool* ) const +{ + return new SvxMacroItem( *this ); +} + +//------------------------------------------------------------------------ + +SfxItemPresentation SvxMacroItem::GetPresentation +( + SfxItemPresentation /*ePres*/, + SfxMapUnit /*eCoreUnit*/, + SfxMapUnit /*ePresUnit*/, + XubString& rText, + const IntlWrapper * +) const +{ +/*!!! + SvxMacroTableDtor& rTbl = (SvxMacroTableDtor&)GetMacroTable(); + SvxMacro* pMac = rTbl.First(); + + while ( pMac ) + { + rText += pMac->GetLibName(); + rText += cpDelim; + rText += pMac->GetMacName(); + pMac = rTbl.Next(); + if ( pMac ) + rText += cpDelim; + } +*/ + rText.Erase(); + return SFX_ITEM_PRESENTATION_NONE; +} + +// ----------------------------------------------------------------------- + +SvStream& SvxMacroItem::Store( SvStream& rStrm , USHORT ) const +{ + return aMacroTable.Write( rStrm ); +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SvxMacroItem::Create( SvStream& rStrm, USHORT nVersion ) const +{ + SvxMacroItem* pAttr = new SvxMacroItem( Which() ); + pAttr->aMacroTable.Read( rStrm, nVersion ); + return pAttr; +} + +// ----------------------------------------------------------------------- + +void SvxMacroItem::SetMacro( USHORT nEvent, const SvxMacro& rMacro ) +{ + SvxMacro *pMacro; + if ( 0 != (pMacro=aMacroTable.Get(nEvent)) ) + { + delete pMacro; + aMacroTable.Replace(nEvent, new SvxMacro( rMacro ) ); + } + else + aMacroTable.Insert(nEvent, new SvxMacro( rMacro ) ); +} + +// ----------------------------------------------------------------------- + +USHORT SvxMacroItem::GetVersion( USHORT nFileFormatVersion ) const +{ + return SOFFICE_FILEFORMAT_31 == nFileFormatVersion + ? 0 : aMacroTable.GetVersion(); +} + diff --git a/svl/source/items/makefile.mk b/svl/source/items/makefile.mk new file mode 100644 index 000000000000..651e54bb7e23 --- /dev/null +++ b/svl/source/items/makefile.mk @@ -0,0 +1,65 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.13 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. +PRJNAME=svtools +TARGET=items +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/svt.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES=\ + $(SLO)$/aeitem.obj \ + $(SLO)$/eitem.obj \ + $(SLO)$/flagitem.obj \ + $(SLO)$/globalnameitem.obj \ + $(SLO)$/imageitm.obj \ + $(SLO)$/intitem.obj \ + $(SLO)$/itemdel.obj \ + $(SLO)$/macitem.obj \ + $(SLO)$/poolcach.obj \ + $(SLO)$/ptitem.obj \ + $(SLO)$/rectitem.obj \ + $(SLO)$/rngitem.obj \ + $(SLO)$/stritem.obj \ + $(SLO)$/style.obj \ + $(SLO)$/szitem.obj \ + $(SLO)$/wallitem.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/svl/source/items/nranges.cxx b/svl/source/items/nranges.cxx new file mode 100644 index 000000000000..e12c7428d513 --- /dev/null +++ b/svl/source/items/nranges.cxx @@ -0,0 +1,853 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: nranges.cxx,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +// compiled via include from itemset.cxx only! + +//======================================================================== + +#ifdef DBG_UTIL + +#define DBG_CHECK_RANGES(NUMTYPE, pArr) \ + for ( const NUMTYPE *pRange = pArr; *pRange; pRange += 2 ) \ + { \ + DBG_ASSERT( pRange[0] <= pRange[1], "ranges must be sorted" ); \ + DBG_ASSERT( !pRange[2] || ( pRange[2] - pRange[1] ) > 1, \ + "ranges must be sorted and discrete" ); \ + } + +#else + +#define DBG_CHECK_RANGES(NUMTYPE,pArr) + +#endif + +//============================================================================ +inline void Swap_Impl(const NUMTYPE *& rp1, const NUMTYPE *& rp2) +{ + const NUMTYPE * pTemp = rp1; + rp1 = rp2; + rp2 = pTemp; +} + +//======================================================================== + +NUMTYPE InitializeRanges_Impl( NUMTYPE *&rpRanges, va_list pArgs, + NUMTYPE nWh1, NUMTYPE nWh2, NUMTYPE nNull ) + +/**

Description

+ + Creates an USHORT-ranges-array in 'rpRanges' using 'nWh1' and 'nWh2' as + first range, 'nNull' as terminator or start of 2nd range and 'pArgs' as + remaider. + + It returns the number of NUMTYPEs which are contained in the described + set of NUMTYPEs. +*/ + +{ + NUMTYPE nSize = 0, nIns = 0; + USHORT nCnt = 0; + SvNums aNumArr( 11, 8 ); + aNumArr.Insert( nWh1, nCnt++ ); + aNumArr.Insert( nWh2, nCnt++ ); + DBG_ASSERT( nWh1 <= nWh2, "Ungueltiger Bereich" ); + nSize += nWh2 - nWh1 + 1; + aNumArr.Insert( nNull, nCnt++ ); + while ( 0 != + ( nIns = + sal::static_int_cast< NUMTYPE >( + va_arg( pArgs, NUMTYPE_ARG ) ) ) ) + { + aNumArr.Insert( nIns, nCnt++ ); + if ( 0 == (nCnt & 1) ) // 4,6,8, usw. + { + DBG_ASSERT( aNumArr[ nCnt-2 ] <= nIns, "Ungueltiger Bereich" ); + nSize += nIns - aNumArr[ nCnt-2 ] + 1; + } + } + va_end( pArgs ); + + DBG_ASSERT( 0 == (nCnt & 1), "ungerade Anzahl von Which-Paaren!" ); + + // so, jetzt sind alle Bereiche vorhanden und + rpRanges = new NUMTYPE[ nCnt+1 ]; + memcpy( rpRanges, aNumArr.GetData(), sizeof(NUMTYPE) * nCnt ); + *(rpRanges+nCnt) = 0; + + return nSize; +} + +//------------------------------------------------------------------------ + +NUMTYPE Count_Impl( const NUMTYPE *pRanges ) + +/**

Description

+ + Determines the number of NUMTYPEs in an 0-terminated array of pairs of + NUMTYPEs. The terminating 0 is not included in the count. +*/ + +{ + NUMTYPE nCount = 0; + while ( *pRanges ) + { + nCount += 2; + pRanges += 2; + } + return nCount; +} + +//------------------------------------------------------------------------ + +NUMTYPE Capacity_Impl( const NUMTYPE *pRanges ) + +/**

Description

+ + Determines the total number of NUMTYPEs described in an 0-terminated + array of pairs of NUMTYPEs, each representing an range of NUMTYPEs. +*/ + +{ + NUMTYPE nCount = 0; + + if ( pRanges ) + { + while ( *pRanges ) + { + nCount += pRanges[1] - pRanges[0] + 1; + pRanges += 2; + } + } + return nCount; +} + +//------------------------------------------------------------------------ + +SfxNumRanges::SfxNumRanges( const SfxNumRanges &rOrig ) + +/**

Description

+ + Copy-Ctor. +*/ + +{ + if ( rOrig._pRanges ) + { + NUMTYPE nCount = Count_Impl( rOrig._pRanges ) + 1; + _pRanges = new NUMTYPE[nCount]; + memcpy( _pRanges, rOrig._pRanges, sizeof(NUMTYPE) * nCount ); + } + else + _pRanges = 0; +} + +//------------------------------------------------------------------------ + +SfxNumRanges::SfxNumRanges( NUMTYPE nWhich1, NUMTYPE nWhich2 ) + +/**

Description

+ + Constructs an SfxNumRanges-instance from one range of NUMTYPEs. + + precondition: + nWhich1 <= nWhich2 +*/ + +: _pRanges( new NUMTYPE[3] ) +{ + _pRanges[0] = nWhich1; + _pRanges[1] = nWhich2; + _pRanges[2] = 0; +} + +//------------------------------------------------------------------------ + +SfxNumRanges::SfxNumRanges( NUMTYPE_ARG nWh0, NUMTYPE_ARG nWh1, NUMTYPE_ARG nNull, ... ) + +/**

Description

+ + Constructs an SfxNumRanges-instance from more than one sorted ranges of + NUMTYPEs terminated with one 0. + + precondition: for each n >= 0 && n < nArgs + nWh(2n) <= nWh(2n+1) && ( nWh(2n+2)-nWh(2n+1) ) > 1 +*/ + +{ + va_list pArgs; + va_start( pArgs, nNull ); + InitializeRanges_Impl( + _pRanges, pArgs, sal::static_int_cast< NUMTYPE >(nWh0), + sal::static_int_cast< NUMTYPE >(nWh1), + sal::static_int_cast< NUMTYPE >(nNull)); + DBG_CHECK_RANGES(NUMTYPE, _pRanges); +} + +//------------------------------------------------------------------------ + +SfxNumRanges::SfxNumRanges( const NUMTYPE* pArr ) + +/**

Description

+ + Constcurts an SfxNumRanges-instance from an sorted ranges of NUMTYPEs, + terminates with on 0. + + precondition: for each n >= 0 && n < (sizeof(pArr)-1) + pArr[2n] <= pArr[2n+1] && ( pArr[2n+2]-pArr[2n+1] ) > 1 +*/ + +{ + DBG_CHECK_RANGES(NUMTYPE, pArr); + NUMTYPE nCount = Count_Impl(pArr) + 1; + _pRanges = new NUMTYPE[ nCount ]; + memcpy( _pRanges, pArr, sizeof(NUMTYPE) * nCount ); +} + +//------------------------------------------------------------------------ + +BOOL SfxNumRanges::operator==( const SfxNumRanges &rOther ) const +{ + // Object pointers equal? + if ( this == &rOther ) + return TRUE; + + // Ranges pointers equal? + if ( _pRanges == rOther._pRanges ) + return TRUE; + + // Counts equal? + NUMTYPE nCount = Count(); + if ( nCount != rOther.Count() ) + return FALSE; + + // Check arrays. + NUMTYPE n = 0; + while( _pRanges[ n ] != 0 ) + { + // Elements at current position equal? + if ( _pRanges[ n ] != rOther._pRanges[ n ] ) + return FALSE; + + ++n; + } + + return TRUE; +} + +//------------------------------------------------------------------------ + +SfxNumRanges& SfxNumRanges::operator = +( + const SfxNumRanges &rRanges +) + +/**

Description

+ + Assigns ranges from 'rRanges' to '*this'. +*/ + +{ + // special case: assign itself + if ( &rRanges == this ) + return *this; + + delete[] _pRanges; + + // special case: 'rRanges' is empty + if ( rRanges.IsEmpty() ) + _pRanges = 0; + else + { + // copy ranges + NUMTYPE nCount = Count_Impl( rRanges._pRanges ) + 1; + _pRanges = new NUMTYPE[ nCount ]; + memcpy( _pRanges, rRanges._pRanges, sizeof(NUMTYPE) * nCount ); + } + return *this; +} + +//------------------------------------------------------------------------ + +SfxNumRanges& SfxNumRanges::operator += +( + const SfxNumRanges &rRanges +) + +/**

Description

+ + Merges *this with 'rRanges'. + + for each NUMTYPE n: + this->Contains( n ) || rRanges.Contains( n ) => this'->Contains( n ) + !this->Contains( n ) && !rRanges.Contains( n ) => !this'->Contains( n ) +*/ + +{ + // special cases: one is empty + if ( rRanges.IsEmpty() ) + return *this; + if ( IsEmpty() ) + return *this = rRanges; + + // First, run thru _pRanges and rRanges._pRanges and determine the size of + // the new, merged ranges: + NUMTYPE nCount = 0; + const NUMTYPE * pRA = _pRanges; + const NUMTYPE * pRB = rRanges._pRanges; + + for (;;) + { + // The first pair of pRA has a lower lower bound than the first pair + // of pRB: + if (pRA[0] > pRB[0]) + Swap_Impl(pRA, pRB); + + // We are done with the merging if at least pRA is exhausted: + if (!pRA[0]) + break; + + for (;;) + { + // Skip those pairs in pRB that completely lie in the first pair + // of pRA: + while (pRB[1] <= pRA[1]) + { + pRB += 2; + + // Watch out for exhaustion of pRB: + if (!pRB[0]) + { + Swap_Impl(pRA, pRB); + goto count_rest; + } + } + + // If the next pair of pRA does not at least touch the current new + // pair, we are done with the current new pair: + if (pRB[0] > pRA[1] + 1) + break; + + // The next pair of pRB extends the current new pair; first, + // extend the current new pair (we are done if pRB is then + // exhausted); second, switch the roles of pRA and pRB in order to + // merge in those following pairs of the original pRA that will + // lie in the (now larger) current new pair or will even extend it + // further: + pRA += 2; + if (!pRA[0]) + goto count_rest; + Swap_Impl(pRA, pRB); + } + + // Done with the current new pair: + pRA += 2; + nCount += 2; + } + + // Only pRB has more pairs available, pRA is already exhausted: +count_rest: + for (; pRB[0]; pRB += 2) + nCount += 2; + + // Now, create new ranges of the correct size and, on a second run thru + // _pRanges and rRanges._pRanges, copy the merged pairs into the new + // ranges: + NUMTYPE * pNew = new NUMTYPE[nCount + 1]; + pRA = _pRanges; + pRB = rRanges._pRanges; + NUMTYPE * pRN = pNew; + + for (;;) + { + // The first pair of pRA has a lower lower bound than the first pair + // of pRB: + if (pRA[0] > pRB[0]) + Swap_Impl(pRA, pRB); + + // We are done with the merging if at least pRA is exhausted: + if (!pRA[0]) + break; + + // Lower bound of current new pair is already known: + *pRN++ = pRA[0]; + + for (;;) + { + // Skip those pairs in pRB that completely lie in the first pair + // of pRA: + while (pRB[1] <= pRA[1]) + { + pRB += 2; + + // Watch out for exhaustion of pRB: + if (!pRB[0]) + { + Swap_Impl(pRA, pRB); + ++pRB; + goto copy_rest; + } + } + + // If the next pair of pRA does not at least touch the current new + // pair, we are done with the current new pair: + if (pRB[0] > pRA[1] + 1) + break; + + // The next pair of pRB extends the current new pair; first, + // extend the current new pair (we are done if pRB is then + // exhausted); second, switch the roles of pRA and pRB in order to + // merge in those following pairs of the original pRA that will + // lie in the (now larger) current new pair or will even extend it + // further: + pRA += 2; + if (!pRA[0]) + { + ++pRB; + goto copy_rest; + } + Swap_Impl(pRA, pRB); + } + + // Done with the current new pair, now upper bound is also known: + *pRN++ = pRA[1]; + pRA += 2; + } + + // Only pRB has more pairs available (which are copied to the new ranges + // unchanged), pRA is already exhausted: +copy_rest: + for (; *pRB;) + *pRN++ = *pRB++; + *pRN = 0; + + delete[] _pRanges; + _pRanges = pNew; + + return *this; +} + +//------------------------------------------------------------------------ + +SfxNumRanges& SfxNumRanges::operator -= +( + const SfxNumRanges &rRanges +) + +/**

Description

+ + Removes 'rRanges' from '*this'. + + for each NUMTYPE n: + this->Contains( n ) && rRanges.Contains( n ) => !this'->Contains( n ) + this->Contains( n ) && !rRanges.Contains( n ) => this'->Contains( n ) + !this->Contains( n ) => !this'->Contains( n ) +*/ + +{ + // special cases: one is empty + if ( rRanges.IsEmpty() || IsEmpty() ) + return *this; + + // differentiate 'rRanges' in a temporary copy of '*this' + // (size is computed for maximal possibly split-count plus terminating 0) + NUMTYPE nThisSize = Count_Impl(_pRanges); + NUMTYPE nTargetSize = 1 + ( nThisSize + Count_Impl(rRanges._pRanges) ); + NUMTYPE *pTarget = new NUMTYPE[ nTargetSize ]; + memset( pTarget, sizeof(NUMTYPE)*nTargetSize, 0 ); + memcpy( pTarget, _pRanges, sizeof(NUMTYPE)*nThisSize ); + + NUMTYPE nPos1 = 0, nPos2 = 0, nTargetPos = 0; + while( _pRanges[ nPos1 ] ) + { + NUMTYPE l1 = _pRanges[ nPos1 ]; // lower bound of interval 1 + NUMTYPE u1 = _pRanges[ nPos1+1 ]; // upper bound of interval 1 + NUMTYPE l2 = rRanges._pRanges[ nPos2 ]; // lower bound of interval 2 + NUMTYPE u2 = rRanges._pRanges[ nPos2+1 ]; // upper bound of interval 2 + + // boundary cases + // * subtrahend is empty -> copy the minuend + if( !l2 ) + { + pTarget[ nTargetPos ] = l1; + pTarget[ nTargetPos+1 ] = u1; + nTargetPos += 2; + nPos1 += 2; + continue; + } + // * next subtrahend interval is completely higher -> copy the minuend + if( u1 < l2 ) + { + pTarget[ nTargetPos ] = l1; + pTarget[ nTargetPos+1 ] = u1; + nTargetPos += 2; + nPos1 += 2; + continue; + } + + // * next subtrahend interval is completely lower -> try next + if( u2 < l1 ) + { + nPos2 += 2; + continue; + } + + // intersecting cases + // * subtrahend cuts out from the beginning of the minuend + if( l2 <= l1 && u2 <= u1 ) + { + // reduce minuend interval, try again (minuend might be affected by other subtrahend intervals) + _pRanges[ nPos1 ] = u2 + 1; + nPos2 += 2; // this cannot hurt any longer + continue; + } + + // * subtrahend cuts out from the end of the minuend + if( l1 <= l2 && u1 <= u2 ) + { + // copy remaining part of minuend (cannot be affected by other intervals) + if( l1 < l2 ) // anything left at all? + { + pTarget[ nTargetPos ] = l1; + pTarget[ nTargetPos+1 ] = l2 - 1; + nTargetPos += 2; + // do not increment nPos2, might affect next minuend interval, too + } + nPos1 += 2; // nothing left at all + continue; + } + + // * subtrahend completely deletes minuend (larger or same at both ends) + if( l1 >= l2 && u1 <= u2 ) + { + nPos1 += 2; // minuend deleted + // do not increment nPos2, might affect next minuend interval, too + continue; + } + + // * subtrahend divides minuend into two pieces + if( l1 <= l2 && u1 >= u2 ) // >= and <= since they may be something left only at one side + { + // left side + if( l1 < l2 ) // anything left at all + { + pTarget[ nTargetPos ] = l1; + pTarget[ nTargetPos+1 ] = l2 - 1; + nTargetPos += 2; + } + + // right side + if( u1 > u2 ) // anything left at all + { + // reduce minuend interval, try again (minuend might be affected by other subtrahend itnervals ) + _pRanges[ nPos1 ] = u2 + 1; + } + + // subtrahend is completely used + nPos2 += 2; + continue; + } + + // we should never be here + DBG_ERROR( "SfxNumRanges::operator-=: internal error" ); + } // while + + pTarget[ nTargetPos ] = 0; + + // assign the differentiated ranges + delete[] _pRanges; + + NUMTYPE nUShorts = Count_Impl(pTarget) + 1; + if ( 1 != nUShorts ) + { + _pRanges = new NUMTYPE[ nUShorts ]; + memcpy( _pRanges, pTarget, nUShorts * sizeof(NUMTYPE) ); + } + else + _pRanges = 0; + + delete [] pTarget; + return *this; + + /* untested code from MI commented out (MDA, 28.01.97) + do + { + // 1st range is smaller than 2nd range? + if ( pRange1[1] < pRange2[0] ) + // => keep 1st range + pRange1 += 2; + + // 2nd range is smaller than 1st range? + else if ( pRange2[1] < pRange1[0] ) + // => skip 2nd range + pRange2 += 2; + + // 2nd range totally overlaps the 1st range? + else if ( pRange2[0] <= pRange1[0] && pRange2[1] >= pRange1[1] ) + // => remove 1st range + memmove( pRange1, pRange1+2, sizeof(NUMTYPE) * (pEndOfTarget-pRange1+2) ); + + // 2nd range overlaps only the beginning of 1st range? + else if ( pRange2[0] <= pRange1[0] && pRange2[1] < pRange1[1] ) + { + // => cut the beginning of 1st range and goto next 2nd range + pRange1[0] = pRange2[1] + 1; + pRange2 += 2; + } + + // 2nd range overlaps only the end of 1st range? + else if ( pRange2[0] > pRange1[0] && pRange2[1] >= pRange1[0] ) + // => cut the beginning of 1st range + pRange1[0] = pRange2[1]+1; + + // 2nd range is a real subset of 1st range + else + { + // => split 1st range and goto next 2nd range + memmove( pRange1+3, pRange1+1, sizeof(NUMTYPE) * (pEndOfTarget-pRange1-1) ); + pRange1[1] = pRange2[0] - 1; + pRange1[2] = pRange2[1] + 1; + pRange1 += 2; + pRange2 += 2; + } + } + while ( *pRange1 && *pRange2 ); + + // assign the differentiated ranges + delete[] _pRanges; + NUMTYPE nUShorts = Count_Impl(pTarget) + 1; + if ( 1 != nUShorts ) + { + _pRanges = new NUMTYPE[ nUShorts ]; + memcpy( _pRanges, pTarget, nUShorts * sizeof(NUMTYPE) ); + _pRanges[ nUShorts-1 ] = 0; + } + else + _pRanges = 0; + return *this; + */ +} + +//------------------------------------------------------------------------ + +SfxNumRanges& SfxNumRanges::operator /= +( + const SfxNumRanges &rRanges +) + +/**

Description

+ + Determines intersection of '*this' with 'rRanges'. + + for each NUMTYPE n: + this->Contains( n ) && rRanges.Contains( n ) => this'->Contains( n ) + !this->Contains( n ) => !this'->Contains( n ) + !rRanges.Contains( n ) => !this'->Contains( n ) +*/ + +{ + // boundary cases + // * first set is empty -> nothing to be done + // * second set is empty -> delete first set + if( rRanges.IsEmpty() ) + { + delete[] _pRanges; + + _pRanges = new NUMTYPE[1]; + _pRanges[0] = 0; + + return *this; + } + + // intersect 'rRanges' in a temporary copy of '*this' + // (size is computed for maximal possibly split-count plus terminating 0) + NUMTYPE nThisSize = Count_Impl(_pRanges); + NUMTYPE nTargetSize = 1 + ( nThisSize + Count_Impl(rRanges._pRanges) ); + NUMTYPE *pTarget = new NUMTYPE[ nTargetSize ]; + memset( pTarget, sizeof(NUMTYPE)*nTargetSize, 0 ); + memcpy( pTarget, _pRanges, sizeof(NUMTYPE)*nThisSize ); + + NUMTYPE nPos1 = 0, nPos2 = 0, nTargetPos = 0; + while( _pRanges[ nPos1 ] != 0 && rRanges._pRanges[ nPos2 ] != 0 ) + { + NUMTYPE l1 = _pRanges[ nPos1 ]; // lower bound of interval 1 + NUMTYPE u1 = _pRanges[ nPos1+1 ]; // upper bound of interval 1 + NUMTYPE l2 = rRanges._pRanges[ nPos2 ]; // lower bound of interval 2 + NUMTYPE u2 = rRanges._pRanges[ nPos2+1 ]; // upper bound of interval 2 + + if( u1 < l2 ) + { + // current interval in s1 is completely before ci in s2 + nPos1 += 2; + continue; + } + if( u2 < l1 ) + { + // ci in s2 is completely before ci in s1 + nPos2 += 2; + continue; + } + + // assert: there exists an intersection between ci1 and ci2 + + if( l1 <= l2 ) + { + // c1 "is more to the left" than c2 + + if( u1 <= u2 ) + { + pTarget[ nTargetPos ] = l2; + pTarget[ nTargetPos+1 ] = u1; + nTargetPos += 2; + nPos1 += 2; + continue; + } + else + { + pTarget[ nTargetPos ] = l2; + pTarget[ nTargetPos+1 ] = u2; + nTargetPos += 2; + nPos2 += 2; + } + } + else + { + // c2 "is more to the left" than c1" + + if( u1 > u2 ) + { + pTarget[ nTargetPos ] = l1; + pTarget[ nTargetPos+1 ] = u2; + nTargetPos += 2; + nPos2 += 2; + } + else + { + pTarget[ nTargetPos ] = l1; + pTarget[ nTargetPos+1 ] = u1; + nTargetPos += 2; + nPos1 += 2; + } + } + }; // while + pTarget[ nTargetPos ] = 0; + + // assign the intersected ranges + delete[] _pRanges; + + NUMTYPE nUShorts = Count_Impl(pTarget) + 1; + if ( 1 != nUShorts ) + { + _pRanges = new NUMTYPE[ nUShorts ]; + memcpy( _pRanges, pTarget, nUShorts * sizeof(NUMTYPE) ); + } + else + _pRanges = 0; + + delete [] pTarget; + return *this; +} + +//------------------------------------------------------------------------ + +BOOL SfxNumRanges::Intersects( const SfxNumRanges &rRanges ) const + +/**

Description

+ + Determines if at least one range in 'rRanges' intersects with one + range in '*this'. + + TRUE, if there is at least one with: + this->Contains( n ) && rRanges.Contains( n ) +*/ + +{ + // special cases: one is empty + if ( rRanges.IsEmpty() || IsEmpty() ) + return FALSE; + + // find at least one intersecting range + const NUMTYPE *pRange1 = _pRanges; + const NUMTYPE *pRange2 = rRanges._pRanges; + + do + { + // 1st range is smaller than 2nd range? + if ( pRange1[1] < pRange2[0] ) + // => keep 1st range + pRange1 += 2; + + // 2nd range is smaller than 1st range? + else if ( pRange2[1] < pRange1[0] ) + // => skip 2nd range + pRange2 += 2; + + // the ranges are overlappung + else + return TRUE; + } + while ( *pRange2 ); + + // no intersection found + return FALSE; +} + +//------------------------------------------------------------------------ + +NUMTYPE SfxNumRanges::Count() const + +/**

Description

+ + Determines the number of USHORTs in the set described by the ranges + of USHORTs in '*this'. +*/ + +{ + return Capacity_Impl( _pRanges ); +} + +//------------------------------------------------------------------------ + +BOOL SfxNumRanges::Contains( NUMTYPE n ) const + +/**

Description

+ + Determines if '*this' contains 'n'. +*/ + +{ + for ( NUMTYPE *pRange = _pRanges; *pRange && *pRange <= n; pRange += 2 ) + if ( pRange[0] <= n && n <= pRange[1] ) + return TRUE; + return FALSE; + +} diff --git a/svl/source/items/poolcach.cxx b/svl/source/items/poolcach.cxx new file mode 100644 index 000000000000..2c758a7e25fa --- /dev/null +++ b/svl/source/items/poolcach.cxx @@ -0,0 +1,159 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: poolcach.cxx,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include + +#ifndef GCC +#endif + +#include +#include +#include "poolcach.hxx" + +// STATIC DATA ----------------------------------------------------------- + +DBG_NAME(SfxItemPoolCache) + + +//------------------------------------------------------------------------ + +struct SfxItemModifyImpl +{ + const SfxSetItem *pOrigItem; + SfxSetItem *pPoolItem; +}; + +SV_DECL_VARARR( SfxItemModifyArr_Impl, SfxItemModifyImpl, 8, 8 ) +SV_IMPL_VARARR( SfxItemModifyArr_Impl, SfxItemModifyImpl); + +//------------------------------------------------------------------------ + +SfxItemPoolCache::SfxItemPoolCache( SfxItemPool *pItemPool, + const SfxPoolItem *pPutItem ): + pPool(pItemPool), + pCache(new SfxItemModifyArr_Impl), + pSetToPut( 0 ), + pItemToPut( &pItemPool->Put(*pPutItem) ) +{ + DBG_CTOR(SfxItemPoolCache, 0); + DBG_ASSERT(pItemPool, "kein Pool angegeben"); +} + +//------------------------------------------------------------------------ + +SfxItemPoolCache::SfxItemPoolCache( SfxItemPool *pItemPool, + const SfxItemSet *pPutSet ): + pPool(pItemPool), + pCache(new SfxItemModifyArr_Impl), + pSetToPut( pPutSet ), + pItemToPut( 0 ) +{ + DBG_CTOR(SfxItemPoolCache, 0); + DBG_ASSERT(pItemPool, "kein Pool angegeben"); +} + +//------------------------------------------------------------------------ + +SfxItemPoolCache::~SfxItemPoolCache() +{ + DBG_DTOR(SfxItemPoolCache, 0); + for ( USHORT nPos = 0; nPos < pCache->Count(); ++nPos ) { + pPool->Remove( *(*pCache)[nPos].pPoolItem ); + pPool->Remove( *(*pCache)[nPos].pOrigItem ); + } + delete pCache; pCache = 0; + + if ( pItemToPut ) + pPool->Remove( *pItemToPut ); +} + +//------------------------------------------------------------------------ + +const SfxSetItem& SfxItemPoolCache::ApplyTo( const SfxSetItem &rOrigItem, BOOL bNew ) +{ + DBG_CHKTHIS(SfxItemPoolCache, 0); + DBG_ASSERT( pPool == rOrigItem.GetItemSet().GetPool(), "invalid Pool" ); + DBG_ASSERT( IsDefaultItem( &rOrigItem ) || IsPooledItem( &rOrigItem ), + "original not in pool" ); + + // Suchen, ob diese Transformations schon einmal vorkam + for ( USHORT nPos = 0; nPos < pCache->Count(); ++nPos ) + { + SfxItemModifyImpl &rMapEntry = (*pCache)[nPos]; + if ( rMapEntry.pOrigItem == &rOrigItem ) + { + // aendert sich ueberhaupt etwas? + if ( rMapEntry.pPoolItem != &rOrigItem ) + { + rMapEntry.pPoolItem->AddRef(2); // einen davon fuer den Cache + if ( bNew ) + pPool->Put( rOrigItem ); //! AddRef?? + } + return *rMapEntry.pPoolItem; + } + } + + // die neue Attributierung in einem neuen Set eintragen + SfxSetItem *pNewItem = (SfxSetItem *)rOrigItem.Clone(); + if ( pItemToPut ) + { + pNewItem->GetItemSet().PutDirect( *pItemToPut ); + DBG_ASSERT( &pNewItem->GetItemSet().Get( pItemToPut->Which() ) == pItemToPut, + "wrong item in temporary set" ); + } + else + pNewItem->GetItemSet().Put( *pSetToPut ); + const SfxSetItem* pNewPoolItem = (const SfxSetItem*) &pPool->Put( *pNewItem ); + DBG_ASSERT( pNewPoolItem != pNewItem, "Pool: rein == raus?" ); + delete pNewItem; + + // Refernzzaehler anpassen, je einen davon fuer den Cache + pNewPoolItem->AddRef( pNewPoolItem != &rOrigItem ? 2 : 1 ); + if ( bNew ) + pPool->Put( rOrigItem ); //! AddRef?? + + // die Transformation im Cache eintragen + SfxItemModifyImpl aModify; + aModify.pOrigItem = &rOrigItem; + aModify.pPoolItem = (SfxSetItem*) pNewPoolItem; + pCache->Insert( aModify, pCache->Count() ); + + DBG_ASSERT( !pItemToPut || + &pNewPoolItem->GetItemSet().Get( pItemToPut->Which() ) == pItemToPut, + "wrong item in resulting set" ); + + return *pNewPoolItem; +} + + + diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx new file mode 100644 index 000000000000..f2eb94ef7f67 --- /dev/null +++ b/svl/source/items/poolio.cxx @@ -0,0 +1,1715 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: poolio.cxx,v $ + * $Revision: 1.11 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include +#include + +#ifndef GCC +#endif + +#include +#include +#include "whassert.hxx" +#include +#include +#include +#include "poolio.hxx" + +// STATIC DATA ----------------------------------------------------------- + +DBG_NAME(SfxItemPool); + +//======================================================================== + +void SfxItemPool::SetStoringPool( const SfxItemPool *pStoringPool ) + +/* [Beschreibung] + + Diese Methode setzt den , der gerade gespeichert wird. + Sie sollte nur in Notf"allen verwendet werden, um z.B. File-Format- + Kompatibilit"at zu gew"ahrleisten o."o. - z.B. in der "uberladung eines + zus"atzliche Daten aus dem dazuge"horigen + Pool mit zu besorgen. + + Sie wird von bedient, kann jedoch f"ur nicht + poolable Items auch direkt gerufen werden. Bitte m"oglichst nicht + f"ur jedes Item einzeln, da 2 Calls! +*/ + +{ + ImpSvtData::GetSvtData().pStoringPool = pStoringPool; +} + +//------------------------------------------------------------------------- + +const SfxItemPool* SfxItemPool::GetStoringPool() + +/* [Beschreibung] + + Diese Methode liefert den , der gerade gespeichert wird. + Sie sollte nur in Notf"allen verwendet werden, um z.B. File-Format- + Kompatibilit"at zu gew"ahrleisten o."o. - z.B. in der "uberladung eines + zus"atzliche Daten aus dem dazuge"horigen + Pool zu besorgen. +*/ + +{ + return ImpSvtData::GetSvtData().pStoringPool; +} + +//------------------------------------------------------------------------- + +SvStream &SfxItemPool::Store(SvStream &rStream) const + +/* [Beschreibung] + + Der SfxItemPool wird inklusive aller seiner Sekund"arpools mit + Pool-Defaults und gepoolten Items in dem angegebenen Stream gespeichert. + Die statischen Defaults werden nicht gespeichert. + + + [Fileformat] + + ;zun"achst ein Kompatiblit"ats-Header-Block + Start: 0x1111 SFX_ITEMPOOL_TAG_STARTPOOLS(_4/_5) + BYTE MAJOR_VER ;SfxItemPool-Version + BYTE MINOR_VER ;" + 0xFFFF SFX_ITEMPOOL_TAG_TRICK4OLD ;ex. GetVersion() + USHORT 0x0000 ;Pseudo-StyleSheetPool + USHORT 0x0000 ;Pseudo-StyleSheetPool + + ;den ganzen Pool in einen Record + record SfxMiniRecod(SFX_ITEMPOOL_REC) + + ;je ein Header vorweg + Header: record SfxMiniRecord(SFX_ITEMPOOL_REC_HEADER) + USHORT GetVersion() ;Which-Ranges etc. + String GetName() ;Pool-Name + + ;die Versions-Map, um WhichIds neuer File-Versionen mappen zu k"onnen + Versions: record SfxMultiRecord(SFX_ITEMPOOL_REC_VERSIONS, 0) + USHORT OldVersion + USHORT OldStartWhich + USHORT OldEndWhich + USHORT[] NewWhich (OldEndWhich-OldStartWhich+1) + + ;jetzt die gepoolten Items (zuerst nicht-SfxSetItems) + Items: record SfxMultiRecord(SFX_ITEMPOOL_REC_WHICHIDS, 0) + content SlotId, 0 + USHORT WhichId + USHORT pItem->GetVersion() + USHORT Array-Size + record SfxMultiRecord(SFX_, 0) + content Surrogate + USHORT RefCount + unknown pItem->Store() + + ;jetzt die gesetzten Pool-Defaults + Defaults: record SfxMultiRecord(SFX_ITEMPOOL_REC_DEFAULTS, 0) + content SlotId, 0 + USHORT WhichId + USHORT pPoolDef->GetVersion() + unknown pPoolDef->Store(); + + ;dahinter folgt ggf. der Secondary ohne Kompatiblit"ats-Header-Block +*/ + +{ + DBG_CHKTHIS(SfxItemPool, 0); + + // Store-Master finden + SfxItemPool *pStoreMaster = pMaster != this ? pMaster : 0; + while ( pStoreMaster && !pStoreMaster->pImp->bStreaming ) + pStoreMaster = pStoreMaster->pSecondary; + + // Alter-Header (Version des Pools an sich und Inhalts-Version 0xffff) + pImp->bStreaming = TRUE; + if ( !pStoreMaster ) + { + rStream << ( rStream.GetVersion() >= SOFFICE_FILEFORMAT_50 + ? SFX_ITEMPOOL_TAG_STARTPOOL_5 + : SFX_ITEMPOOL_TAG_STARTPOOL_4 ); + rStream << SFX_ITEMPOOL_VER_MAJOR << SFX_ITEMPOOL_VER_MINOR; + rStream << SFX_ITEMPOOL_TAG_TRICK4OLD; + + // SfxStyleSheet-Bug umgehen + rStream << UINT16(0); // Version + rStream << UINT16(0); // Count (2. Schleife f"allt sonst auf die Fresse) + } + + // jeder Pool ist als ganzes ein Record + SfxMiniRecordWriter aPoolRec( &rStream, SFX_ITEMPOOL_REC ); + ImpSvtData::GetSvtData().pStoringPool = this; + + // Einzel-Header (Version des Inhalts und Name) + { + SfxMiniRecordWriter aPoolHeaderRec( &rStream, SFX_ITEMPOOL_REC_HEADER); + rStream << pImp->nVersion; + SfxPoolItem::writeByteString(rStream, aName); + } + + // Version-Maps + { + SfxMultiVarRecordWriter aVerRec( &rStream, SFX_ITEMPOOL_REC_VERSIONMAP, 0 ); + for ( USHORT nVerNo = 0; nVerNo < pImp->aVersions.Count(); ++nVerNo ) + { + aVerRec.NewContent(); + SfxPoolVersion_Impl *pVer = pImp->aVersions[nVerNo]; + rStream << pVer->_nVer << pVer->_nStart << pVer->_nEnd; + USHORT nCount = pVer->_nEnd - pVer->_nStart + 1; + USHORT nNewWhich = 0; + for ( USHORT n = 0; n < nCount; ++n ) + { + nNewWhich = pVer->_pMap[n]; + rStream << nNewWhich; + } + + // Workaround gegen Bug in SetVersionMap der 312 + if ( SOFFICE_FILEFORMAT_31 == _nFileFormatVersion ) + rStream << USHORT(nNewWhich+1); + } + } + + // gepoolte Items + { + SfxMultiMixRecordWriter aWhichIdsRec( &rStream, SFX_ITEMPOOL_REC_WHICHIDS, 0 ); + + // erst Atomaren-Items und dann die Sets schreiben (wichtig beim Laden) + for ( pImp->bInSetItem = FALSE; pImp->bInSetItem <= TRUE && !rStream.GetError(); ++pImp->bInSetItem ) + { + SfxPoolItemArray_Impl **pArr = pImp->ppPoolItems; + SfxPoolItem **ppDefItem = ppStaticDefaults; + const USHORT nSize = GetSize_Impl(); + for ( USHORT i = 0; i < nSize && !rStream.GetError(); ++i, ++pArr, ++ppDefItem ) + { + // Version des Items feststellen + USHORT nItemVersion = (*ppDefItem)->GetVersion( _nFileFormatVersion ); + if ( USHRT_MAX == nItemVersion ) + // => kam in zu exportierender Version gar nicht vor + continue; + + // !poolable wird gar nicht im Pool gespeichert + // und itemsets/plain-items je nach Runde +#ifdef TF_POOLABLE + if ( *pArr && IsItemFlag(**ppDefItem, SFX_ITEM_POOLABLE) && +#else + if ( *pArr && (*ppDefItem)->IsPoolable() && +#endif + pImp->bInSetItem == (*ppDefItem)->ISA(SfxSetItem) ) + { + // eigene Kennung, globale Which-Id und Item-Version + USHORT nSlotId = GetSlotId( (*ppDefItem)->Which(), FALSE ); + aWhichIdsRec.NewContent(nSlotId, 0); + rStream << (*ppDefItem)->Which(); + rStream << nItemVersion; + const USHORT nCount = (*pArr)->Count(); + DBG_ASSERT(nCount, "ItemArr ist leer"); + rStream << nCount; + + // Items an sich schreiben + SfxMultiMixRecordWriter aItemsRec( &rStream, SFX_ITEMPOOL_REC_ITEMS, 0 ); + for ( USHORT j = 0; j < nCount; ++j ) + { + // Item selbst besorgen + const SfxPoolItem *pItem = (*pArr)->GetObject(j); + if ( pItem && pItem->GetRefCount() ) //! siehe anderes MI-REF + { + aItemsRec.NewContent(j, 'X' ); + + if ( pItem->GetRefCount() == SFX_ITEMS_SPECIAL ) + rStream << (USHORT) pItem->GetKind(); + else + { + rStream << (USHORT) pItem->GetRefCount(); + if( pItem->GetRefCount() > SFX_ITEMS_OLD_MAXREF ) + rStream.SetError( ERRCODE_IO_NOTSTORABLEINBINARYFORMAT ); + } + + if ( !rStream.GetError() ) + pItem->Store(rStream, nItemVersion); + else + break; +#ifdef DBG_UTIL_MI + if ( !pItem->ISA(SfxSetItem) ) + { + ULONG nMark = rStream.Tell(); + rStream.Seek( nItemStartPos + sizeof(USHORT) ); + SfxPoolItem *pClone = pItem->Create(rStream, nItemVersion ); + USHORT nWh = pItem->Which(); + SFX_ASSERT( rStream.Tell() == nMark, nWh,"asymmetric store/create" ); + SFX_ASSERT( *pClone == *pItem, nWh, "unequal after store/create" ); + delete pClone; + } +#endif + } + } + } + } + } + + pImp->bInSetItem = FALSE; + } + + // die gesetzten Defaults speichern (Pool-Defaults) + if ( !rStream.GetError() ) + { + SfxMultiMixRecordWriter aDefsRec( &rStream, SFX_ITEMPOOL_REC_DEFAULTS, 0 ); + USHORT nCount = GetSize_Impl(); + for ( USHORT n = 0; n < nCount; ++n ) + { + const SfxPoolItem* pDefaultItem = ppPoolDefaults[n]; + if ( pDefaultItem ) + { + // Version ermitteln + USHORT nItemVersion = pDefaultItem->GetVersion( _nFileFormatVersion ); + if ( USHRT_MAX == nItemVersion ) + // => gab es in der Version noch nicht + continue; + + // eigene Kennung, globale Kennung, Version + USHORT nSlotId = GetSlotId( pDefaultItem->Which(), FALSE ); + aDefsRec.NewContent( nSlotId, 0 ); + rStream << pDefaultItem->Which(); + rStream << nItemVersion; + + // Item an sich + pDefaultItem->Store( rStream, nItemVersion ); + } + } + } + + // weitere Pools rausschreiben + ImpSvtData::GetSvtData().pStoringPool = 0; + aPoolRec.Close(); + if ( !rStream.GetError() && pSecondary ) + pSecondary->Store( rStream ); + + pImp->bStreaming = FALSE; + return rStream; +} + +// ----------------------------------------------------------------------- + +void SfxItemPool::LoadCompleted() + +/* [Beschreibung] + + Wurde der SfxItemPool mit 'bRefCounts' == FALSE geladen, mu\s das + Laden der Dokumentinhalte mit einem Aufruf dieser Methode beendet + werden. Ansonsten hat der Aufruf dieser Methode keine Funktion. + + + [Anmerkung] + + Beim Laden ohne Ref-Counts werden diese tats"achlich auf 1 gesetzt, + damit nicht w"ahrend des Ladevorgangs SfxPoolItems gel"oscht werden, + die danach, aber auch noch beim Ladevorgang, ben"otigt werden. Diese + Methode setzt den Ref-Count wieder zur"uck und entfernt dabei + gleichzeitig alle nicht mehr ben"otigten Items. + + + [Querverweise] + + +*/ + +{ + // wurden keine Ref-Counts mitgeladen? + if ( pImp->nInitRefCount > 1 ) + { + + // "uber alle Which-Werte iterieren + SfxPoolItemArray_Impl** ppItemArr = pImp->ppPoolItems; + for( USHORT nArrCnt = GetSize_Impl(); nArrCnt; --nArrCnt, ++ppItemArr ) + { + // ist "uberhaupt ein Item mit dem Which-Wert da? + if ( *ppItemArr ) + { + // "uber alle Items mit dieser Which-Id iterieren + SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData(); + for( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr ) + if (*ppHtArr) + { + #ifdef DBG_UTIL + const SfxPoolItem &rItem = **ppHtArr; + DBG_ASSERT( !rItem.ISA(SfxSetItem) || + 0 != &((const SfxSetItem&)rItem).GetItemSet(), + "SetItem without ItemSet" ); + #endif + + if ( !ReleaseRef( **ppHtArr, 1 ) ) + DELETEZ( *ppHtArr ); + } + } + } + + // from now on normal initial ref count + pImp->nInitRefCount = 1; + } + + // notify secondary pool + if ( pSecondary ) + pSecondary->LoadCompleted(); +} + +//============================================================================ +// This had to be moved to a method of its own to keep Solaris GCC happy: +void SfxItemPool::readTheItems ( + SvStream & rStream, USHORT nItemCount, USHORT nVersion, + SfxPoolItem * pDefItem, SfxPoolItemArray_Impl ** ppArr) +{ + SfxMultiRecordReader aItemsRec( &rStream, SFX_ITEMPOOL_REC_ITEMS ); + + SfxPoolItemArray_Impl *pNewArr = new SfxPoolItemArray_Impl( nItemCount ); + SfxPoolItem *pItem = 0; + + USHORT n, nLastSurrogate = USHORT(-1); + while (aItemsRec.GetContent()) + { + // n"achstes Surrogat holen + USHORT nSurrogate = aItemsRec.GetContentTag(); + DBG_ASSERT( aItemsRec.GetContentVersion() == 'X', + "not an item content" ); + + // fehlende auff"ullen + for ( pItem = 0, n = nLastSurrogate+1; n < nSurrogate; ++n ) + pNewArr->C40_INSERT(SfxPoolItem, pItem, n); + nLastSurrogate = nSurrogate; + + // Ref-Count und Item laden + USHORT nRef; + rStream >> nRef; + + pItem = pDefItem->Create(rStream, nVersion); + pNewArr->C40_INSERT(SfxPoolItem, pItem, nSurrogate); + + if ( !bPersistentRefCounts ) + // bis festhalten + AddRef(*pItem, 1); + else + { + if ( nRef > SFX_ITEMS_OLD_MAXREF ) + pItem->SetKind( nRef ); + else + AddRef(*pItem, nRef); + } + } + + // fehlende auff"ullen + for ( pItem = 0, n = nLastSurrogate+1; n < nItemCount; ++n ) + pNewArr->C40_INSERT(SfxPoolItem, pItem, n); + + SfxPoolItemArray_Impl *pOldArr = *ppArr; + *ppArr = pNewArr; + + // die Items merken, die schon im Pool sind + int bEmpty = TRUE; + if ( 0 != pOldArr ) + for ( n = 0; bEmpty && n < pOldArr->Count(); ++n ) + bEmpty = pOldArr->GetObject(n) == 0; + DBG_ASSERTWARNING( bEmpty, "loading non-empty pool" ); + if ( !bEmpty ) + { + // f"ur alle alten suchen, ob ein gleiches neues existiert + for ( USHORT nOld = 0; nOld < pOldArr->Count(); ++nOld ) + { + SfxPoolItem *pOldItem = (*pOldArr)[nOld]; + if ( pOldItem ) + { + USHORT nFree = USHRT_MAX; + int bFound = FALSE; + USHORT nCount = (*ppArr)->Count(); + for ( USHORT nNew = nCount; !bFound && nNew--; ) + { + // geladenes Item + SfxPoolItem *&rpNewItem = + (SfxPoolItem*&)(*ppArr)->GetData()[nNew]; + + // surrogat unbenutzt? + if ( !rpNewItem ) + nFree = nNew; + + // gefunden? + else if ( *rpNewItem == *pOldItem ) + { + // wiederverwenden + AddRef( *pOldItem, rpNewItem->GetRefCount() ); + SetRefCount( *rpNewItem, 0 ); + delete rpNewItem; + rpNewItem = pOldItem; + bFound = TRUE; + } + } + + // vorhervorhandene, nicht geladene uebernehmen + if ( !bFound ) + { + if ( nFree != USHRT_MAX ) + (SfxPoolItem*&)(*ppArr)->GetData()[nFree] = pOldItem; + else + (*ppArr)->C40_INSERT( SfxPoolItem, pOldItem, nCount ); + } + } + } + } + delete pOldArr; +} + +// ----------------------------------------------------------------------- + +SvStream &SfxItemPool::Load(SvStream &rStream) +{ + DBG_CHKTHIS(SfxItemPool, 0); + DBG_ASSERT(ppStaticDefaults, "kein DefaultArray"); + + // protect items by increasing ref count + if ( !bPersistentRefCounts ) + { + + // "uber alle Which-Werte iterieren + SfxPoolItemArray_Impl** ppItemArr = pImp->ppPoolItems; + for( USHORT nArrCnt = GetSize_Impl(); nArrCnt; --nArrCnt, ++ppItemArr ) + { + // ist "uberhaupt ein Item mit dem Which-Wert da? + if ( *ppItemArr ) + { + // "uber alle Items mit dieser Which-Id iterieren + SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData(); + for( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr ) + if (*ppHtArr) + { + #ifdef DBG_UTIL + const SfxPoolItem &rItem = **ppHtArr; + DBG_ASSERT( !rItem.ISA(SfxSetItem) || + 0 != &((const SfxSetItem&)rItem).GetItemSet(), + "SetItem without ItemSet" ); + DBG_WARNING( "loading non-empty ItemPool" ); + #endif + + AddRef( **ppHtArr, 1 ); + } + } + } + + // during loading (until LoadCompleted()) protect all items + pImp->nInitRefCount = 2; + } + + // Load-Master finden + SfxItemPool *pLoadMaster = pMaster != this ? pMaster : 0; + while ( pLoadMaster && !pLoadMaster->pImp->bStreaming ) + pLoadMaster = pLoadMaster->pSecondary; + + // Gesamt Header einlesen + pImp->bStreaming = TRUE; + if ( !pLoadMaster ) + { + // Format-Version laden + CHECK_FILEFORMAT2( rStream, + SFX_ITEMPOOL_TAG_STARTPOOL_5, SFX_ITEMPOOL_TAG_STARTPOOL_4 ); + rStream >> pImp->nMajorVer >> pImp->nMinorVer; + + // Format-Version in Master-Pool "ubertragen + pMaster->pImp->nMajorVer = pImp->nMajorVer; + pMaster->pImp->nMinorVer = pImp->nMinorVer; + + // altes Format? + if ( pImp->nMajorVer < 2 ) + // pImp->bStreaming wird von Load1_Impl() zur"uckgesetzt + return Load1_Impl( rStream ); + + // zu neues Format? + if ( pImp->nMajorVer > SFX_ITEMPOOL_VER_MAJOR ) + { + rStream.SetError(SVSTREAM_FILEFORMAT_ERROR); + pImp->bStreaming = FALSE; + return rStream; + } + + // Version 1.2-Trick-Daten "uberspringen + CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_TRICK4OLD ); + rStream.SeekRel( 4 ); // Hack-Daten wegen SfxStyleSheetPool-Bug skippen + } + + // neues Record-orientiertes Format + SfxMiniRecordReader aPoolRec( &rStream, SFX_ITEMPOOL_REC ); + if ( rStream.GetError() ) + { + pImp->bStreaming = FALSE; + return rStream; + } + + // Einzel-Header + int bOwnPool = TRUE; + UniString aExternName; + { + // Header-Record suchen + SfxMiniRecordReader aPoolHeaderRec( &rStream, SFX_ITEMPOOL_REC_HEADER ); + if ( rStream.GetError() ) + { + pImp->bStreaming = FALSE; + return rStream; + } + + // Header-lesen + rStream >> pImp->nLoadingVersion; + SfxPoolItem::readByteString(rStream, aExternName); + bOwnPool = aExternName == aName; + + //! solange wir keine fremden Pools laden k"onnen + if ( !bOwnPool ) + { + rStream.SetError(SVSTREAM_FILEFORMAT_ERROR); + aPoolRec.Skip(); + pImp->bStreaming = FALSE; + return rStream; + } + } + + // Version-Maps + { + SfxMultiRecordReader aVerRec( &rStream, SFX_ITEMPOOL_REC_VERSIONMAP ); + if ( rStream.GetError() ) + { + pImp->bStreaming = FALSE; + return rStream; + } + + // Versions-Maps einlesen + USHORT nOwnVersion = pImp->nVersion; + for ( USHORT nVerNo = 0; aVerRec.GetContent(); ++nVerNo ) + { + // Header f"ur einzelne Version einlesen + USHORT nVersion, nHStart, nHEnd; + rStream >> nVersion >> nHStart >> nHEnd; + USHORT nCount = nHEnd - nHStart + 1; + + // Version neuer als bekannt? + if ( nVerNo >= pImp->aVersions.Count() ) + { + // neue Version hinzufuegen + USHORT *pMap = new USHORT[nCount]; + for ( USHORT n = 0; n < nCount; ++n ) + rStream >> pMap[n]; + SetVersionMap( nVersion, nHStart, nHEnd, pMap ); + } + } + pImp->nVersion = nOwnVersion; + } + + // Items laden + FASTBOOL bSecondaryLoaded = FALSE; + long nSecondaryEnd = 0; + { + SfxMultiRecordReader aWhichIdsRec( &rStream, SFX_ITEMPOOL_REC_WHICHIDS); + while ( aWhichIdsRec.GetContent() ) + { + // SlotId, Which-Id und Item-Version besorgen + USHORT nCount, nVersion, nWhich; + //!USHORT nSlotId = aWhichIdsRec.GetContentTag(); + rStream >> nWhich; + if ( pImp->nLoadingVersion != pImp->nVersion ) + // Which-Id aus File-Version in Pool-Version verschieben + nWhich = GetNewWhich( nWhich ); + + // unbekanntes Item aus neuerer Version + if ( !IsInRange(nWhich) ) + continue; + + rStream >> nVersion; + rStream >> nCount; + //!SFX_ASSERTWARNING( !nSlotId || !HasMap() || + //! ( nSlotId == GetSlotId( nWhich, FALSE ) ) || + //! !GetSlotId( nWhich, FALSE ), + //! nWhich, "Slot/Which mismatch" ); + + USHORT nIndex = GetIndex_Impl(nWhich); + SfxPoolItemArray_Impl **ppArr = pImp->ppPoolItems + nIndex; + + // SfxSetItems k"onnten Items aus Sekund"arpools beinhalten + SfxPoolItem *pDefItem = *(ppStaticDefaults + nIndex); + pImp->bInSetItem = pDefItem->ISA(SfxSetItem); + if ( !bSecondaryLoaded && pSecondary && pImp->bInSetItem ) + { + // an das Ende des eigenen Pools seeken + ULONG nLastPos = rStream.Tell(); + aPoolRec.Skip(); + + // Sekund"arpool einlesen + pSecondary->Load( rStream ); + bSecondaryLoaded = TRUE; + nSecondaryEnd = rStream.Tell(); + + // zur"uck zu unseren eigenen Items + rStream.Seek(nLastPos); + } + + // Items an sich lesen + readTheItems(rStream, nCount, nVersion, pDefItem, ppArr); + + pImp->bInSetItem = FALSE; + } + } + + // Pool-Defaults lesen + { + SfxMultiRecordReader aDefsRec( &rStream, SFX_ITEMPOOL_REC_DEFAULTS ); + + while ( aDefsRec.GetContent() ) + { + // SlotId, Which-Id und Item-Version besorgen + USHORT nVersion, nWhich; + //!USHORT nSlotId = aDefsRec.GetContentTag(); + rStream >> nWhich; + if ( pImp->nLoadingVersion != pImp->nVersion ) + // Which-Id aus File-Version in Pool-Version verschieben + nWhich = GetNewWhich( nWhich ); + + // unbekanntes Item aus neuerer Version + if ( !IsInRange(nWhich) ) + continue; + + rStream >> nVersion; + //!SFX_ASSERTWARNING( !HasMap() || ( nSlotId == GetSlotId( nWhich, FALSE ) ), + //! nWhich, "Slot/Which mismatch" ); + + // Pool-Default-Item selbst laden + SfxPoolItem *pItem = + ( *( ppStaticDefaults + GetIndex_Impl(nWhich) ) ) + ->Create( rStream, nVersion ); + pItem->SetKind( SFX_ITEMS_POOLDEFAULT ); + *( ppPoolDefaults + GetIndex_Impl(nWhich) ) = pItem; + } + } + + // ggf. Secondary-Pool laden + aPoolRec.Skip(); + if ( pSecondary ) + { + if ( !bSecondaryLoaded ) + pSecondary->Load( rStream ); + else + rStream.Seek( nSecondaryEnd ); + } + + // wenn nicht own-Pool, dann kein Name + if ( aExternName != aName ) + aName.Erase(); + + pImp->bStreaming = FALSE; + return rStream; +}; + +// ----------------------------------------------------------------------- + +SvStream &SfxItemPool::Load1_Impl(SvStream &rStream) +{ + // beim Master ist der Header schon von geladen worden + if ( !pImp->bStreaming ) + { + // Header des Secondary lesen + CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_STARTPOOL_4 ); + rStream >> pImp->nMajorVer >> pImp->nMinorVer; + } + sal_uInt32 nAttribSize; + int bOwnPool = TRUE; + UniString aExternName; + if ( pImp->nMajorVer > 1 || pImp->nMinorVer >= 2 ) + rStream >> pImp->nLoadingVersion; + SfxPoolItem::readByteString(rStream, aExternName); + bOwnPool = aExternName == aName; + pImp->bStreaming = TRUE; + + //! solange wir keine fremden laden k"onnen + if ( !bOwnPool ) + { + rStream.SetError(SVSTREAM_FILEFORMAT_ERROR); + pImp->bStreaming = FALSE; + return rStream; + } + + // Versionen bis 1.3 k"onnen noch keine Which-Verschiebungen lesen + if ( pImp->nMajorVer == 1 && pImp->nMinorVer <= 2 && + pImp->nVersion < pImp->nLoadingVersion ) + { + rStream.SetError(ERRCODE_IO_WRONGVERSION); + pImp->bStreaming = FALSE; + return rStream; + } + + // Size-Table liegt hinter den eigentlichen Attributen + rStream >> nAttribSize; + + // Size-Table einlesen + ULONG nStartPos = rStream.Tell(); + rStream.SeekRel( nAttribSize ); + CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_SIZES ); + sal_uInt32 nSizeTableLen; + rStream >> nSizeTableLen; + sal_Char *pBuf = new sal_Char[nSizeTableLen]; + rStream.Read( pBuf, nSizeTableLen ); + ULONG nEndOfSizes = rStream.Tell(); + SvMemoryStream aSizeTable( pBuf, nSizeTableLen, STREAM_READ ); + + // ab Version 1.3 steht in der Size-Table eine Versions-Map + if ( pImp->nMajorVer > 1 || pImp->nMinorVer >= 3 ) + { + // Version-Map finden (letztes ULONG der Size-Table gibt Pos an) + rStream.Seek( nEndOfSizes - sizeof(sal_uInt32) ); + sal_uInt32 nVersionMapPos; + rStream >> nVersionMapPos; + rStream.Seek( nVersionMapPos ); + + // Versions-Maps einlesen + CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_VERSIONMAP ); + USHORT nVerCount; + rStream >> nVerCount; + for ( USHORT nVerNo = 0; nVerNo < nVerCount; ++nVerNo ) + { + // Header f"ur einzelne Version einlesen + USHORT nVersion, nHStart, nHEnd; + rStream >> nVersion >> nHStart >> nHEnd; + USHORT nCount = nHEnd - nHStart + 1; + USHORT nBytes = (nCount)*sizeof(USHORT); + + // Version neuer als bekannt? + if ( nVerNo >= pImp->aVersions.Count() ) + { + // neue Version hinzufuegen + USHORT *pMap = new USHORT[nCount]; + for ( USHORT n = 0; n < nCount; ++n ) + rStream >> pMap[n]; + SetVersionMap( nVersion, nHStart, nHEnd, pMap ); + } + else + // Version schon bekannt => "uberspringen + rStream.SeekRel( nBytes ); + } + } + + // Items laden + rStream.Seek( nStartPos ); + CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_ITEMS ); + FASTBOOL bSecondaryLoaded = FALSE; + long nSecondaryEnd = 0; + USHORT nWhich, nSlot; + while ( rStream >> nWhich, nWhich ) + { + // ggf. Which-Id aus alter Version verschieben? + if ( pImp->nLoadingVersion != pImp->nVersion ) + nWhich = GetNewWhich( nWhich ); + + rStream >> nSlot; + USHORT nMappedWhich = GetWhich(nSlot, FALSE); + int bKnownItem = bOwnPool || IsWhich(nMappedWhich); + + USHORT nRef, nCount, nVersion; + sal_uInt32 nAttrSize; + rStream >> nVersion >> nCount; + + SfxPoolItemArray_Impl **ppArr = 0; + SfxPoolItemArray_Impl *pNewArr = 0; + SfxPoolItem *pDefItem = 0; + if ( bKnownItem ) + { + if ( !bOwnPool ) + nWhich = nMappedWhich; + + //!SFX_ASSERTWARNING( !nSlot || !HasMap() || + //! ( nSlot == GetSlotId( nWhich, FALSE ) ) || + //! !GetSlotId( nWhich, FALSE ), + //! nWhich, "Slot/Which mismatch" ); + + USHORT nIndex = GetIndex_Impl(nWhich); + ppArr = pImp->ppPoolItems + nIndex; + pNewArr = new SfxPoolItemArray_Impl( nCount ); + pDefItem = *(ppStaticDefaults + nIndex); + } + + // Position vor ersten Item merken + ULONG nLastPos = rStream.Tell(); + + // SfxSetItems k"onnten Items aus Sekund"arpools beinhalten + if ( !bSecondaryLoaded && pSecondary && pDefItem->ISA(SfxSetItem) ) + { + // an das Ende des eigenen Pools seeken + rStream.Seek(nEndOfSizes); + CHECK_FILEFORMAT_RELEASE( rStream, SFX_ITEMPOOL_TAG_ENDPOOL, pNewArr ); + CHECK_FILEFORMAT_RELEASE( rStream, SFX_ITEMPOOL_TAG_ENDPOOL, pNewArr ); + + // Sekund"arpool einlesen + pSecondary->Load1_Impl( rStream ); + bSecondaryLoaded = TRUE; + nSecondaryEnd = rStream.Tell(); + + // zur"uck zu unseren eigenen Items + rStream.Seek(nLastPos); + } + + // Items an sich lesen + for ( USHORT j = 0; j < nCount; ++j ) + { + ULONG nPos = nLastPos; + rStream >> nRef; + + if ( bKnownItem ) + { + SfxPoolItem *pItem = 0; + if ( nRef ) + { + pItem = pDefItem->Create(rStream, nVersion); + + if ( !bPersistentRefCounts ) + // bis festhalten + AddRef(*pItem, 1); + else + { + if ( nRef > SFX_ITEMS_OLD_MAXREF ) + pItem->SetKind( nRef ); + else + AddRef(*pItem, nRef); + } + } + + pNewArr->C40_INSERT( SfxPoolItem, pItem, j); + + // restliche gespeicherte Laenge skippen (neueres Format) + nLastPos = rStream.Tell(); + } + + aSizeTable >> nAttrSize; + SFX_ASSERT( !bKnownItem || ( nPos + nAttrSize) >= nLastPos, + nPos, + "too many bytes read - version mismatch?" ); + + if ( !bKnownItem || ( nLastPos < (nPos + nAttrSize) ) ) + { + nLastPos = nPos + nAttrSize; + rStream.Seek( nLastPos ); + } + } + + if ( bKnownItem ) + { + SfxPoolItemArray_Impl *pOldArr = *ppArr; + *ppArr = pNewArr; + + // die Items merken, die schon im Pool sind + int bEmpty = TRUE; + if ( 0 != pOldArr ) + for ( USHORT n = 0; bEmpty && n < pOldArr->Count(); ++n ) + bEmpty = pOldArr->GetObject(n) == 0; + DBG_ASSERTWARNING( bEmpty, "loading non-empty pool" ); + if ( !bEmpty ) + { + // f"ur alle alten suchen, ob ein gleiches neues existiert + for ( USHORT nOld = 0; nOld < pOldArr->Count(); ++nOld ) + { + SfxPoolItem *pOldItem = (*pOldArr)[nOld]; + if ( pOldItem ) + { + int bFound = FALSE; + for ( USHORT nNew = 0; + !bFound && nNew < (*ppArr)->Count(); + ++nNew ) + { + SfxPoolItem *&rpNewItem = + (SfxPoolItem*&)(*ppArr)->GetData()[nNew]; + + if ( rpNewItem && *rpNewItem == *pOldItem ) + { + AddRef( *pOldItem, rpNewItem->GetRefCount() ); + SetRefCount( *rpNewItem, 0 ); + delete rpNewItem; + rpNewItem = pOldItem; + bFound = TRUE; + SFX_TRACE( "reusing item", pOldItem ); + } + } + //! DBG_ASSERT( bFound, "old-item not found in file" ); + if ( !bFound ) + { + SFX_TRACE( "item not found: ", pOldItem ); + } + } + } + } + delete pOldArr; /* @@@ */ + } + } + + // Pool-Defaults lesen + if ( pImp->nMajorVer > 1 || pImp->nMinorVer > 0 ) + CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_DEFAULTS ); + + ULONG nLastPos = rStream.Tell(); + while ( rStream >> nWhich, nWhich ) + { + // ggf. Which-Id aus alter Version verschieben? + if ( pImp->nLoadingVersion != pImp->nVersion ) + nWhich = GetNewWhich( nWhich ); + + rStream >> nSlot; + USHORT nMappedWhich = GetWhich(nSlot, FALSE); + int bKnownItem = bOwnPool || IsWhich(nMappedWhich); + + ULONG nPos = nLastPos; + sal_uInt32 nSize; + USHORT nVersion; + rStream >> nVersion; + + if ( bKnownItem ) + { + if ( !bOwnPool ) + nWhich = nMappedWhich; + SfxPoolItem *pItem = + ( *( ppStaticDefaults + GetIndex_Impl(nWhich) ) ) + ->Create( rStream, nVersion ); + pItem->SetKind( SFX_ITEMS_POOLDEFAULT ); + *( ppPoolDefaults + GetIndex_Impl(nWhich) ) = pItem; + } + + nLastPos = rStream.Tell(); + aSizeTable >> nSize; + SFX_ASSERT( ( nPos + nSize) >= nLastPos, nPos, + "too many bytes read - version mismatch?" ); + if ( nLastPos < (nPos + nSize) ) + rStream.Seek( nPos + nSize ); + } + + delete[] pBuf; + rStream.Seek(nEndOfSizes); + CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_ENDPOOL ); + CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_ENDPOOL ); + + if ( pSecondary ) + { + if ( !bSecondaryLoaded ) + pSecondary->Load1_Impl( rStream ); + else + rStream.Seek( nSecondaryEnd ); + } + + if ( aExternName != aName ) + aName.Erase(); + + pImp->bStreaming = FALSE; + return rStream; +} + +// ----------------------------------------------------------------------- + +const SfxPoolItem* SfxItemPool::LoadSurrogate +( + SvStream& rStream, // vor einem Surrogat positionierter Stream + USHORT& rWhich, // Which-Id des zu ladenden s + USHORT nSlotId, // Slot-Id des zu ladenden s + const SfxItemPool* pRefPool // in dem das Surrogat gilt +) + +/* [Beschreibung] + + L"adt Surrogat aus 'rStream' und liefert das dadurch in 'rRefPool' + repr"asentierte SfxPoolItem zu"ruck. Ist das im Stream befindliche + Surrogat == SFX_ITEMS_DIRECT (!SFX_ITEM_POOLABLE) wird 0 zur"uckgegeben, + das Item ist direkt aus dem Stream zu laden. Bei 0xfff0 (SFX_ITEMS_NULL) + wird auch 0 zurueckgegeben und rWhich auf 0 gesetzt, das Item ist nicht + verfuegbar. + + Ansonsten wird ber"ucksichtigt, ob der betroffene Pool ohne Ref-Counts + geladen wird, ob aus einem neuen Pool nachgeladen wird (&rRefPool != this) + oder ob aus einem g"anzlich anders aufgebauten Pool geladen wird. + + Wird aus einem anders aufgebauten Pool geladen und die 'nSlotId' kann + nicht in eine Which-Id dieses Pools gemappt werden, wird ebenfalls 0 + zur"uckgeliefert. + + Preconditions: - Pool mu\s geladen sein + - LoadCompleted darf noch nicht gerufen worden sein + - 'rStream' steht genau an der Position, an der ein + Surrogat f"ur ein Item mit der SlotId 'nSlotId' und + der WhichId 'rWhichId' mit StoreSurrogate gepeichert + wurde + + Postconditions: - 'rStream' ist so positioniert, wie auch StoreSurrogate + sein speichern beendet hatte + - konnte ein Item geladen werden, befindet es sich + in diesem SfxItemPool + - 'rWhichId' enth"alt die ggf. gemappte Which-Id + Laufzeit: Tiefe des Ziel Sekund"arpools * 10 + 10 + + [Querverweise] + + +*/ + +{ + // erstmal das Surrogat lesen + USHORT nSurrogat; + rStream >> nSurrogat; + + // direkt gespeichertes Item? + if ( SFX_ITEMS_DIRECT == nSurrogat ) + return 0; + + // nicht vorhandenes Item? + if ( SFX_ITEMS_NULL == nSurrogat ) + { + rWhich = 0; + return 0; + } + + // Bei einem identisch aufgebauten Pool (im Stream) kann das Surrogat + // auf jeden Fall aufgel"ost werden. + if ( !pRefPool ) + pRefPool = this; + FASTBOOL bResolvable = pRefPool->GetName().Len() > 0; + if ( !bResolvable ) + { + // Bei einem anders aufgebauten Pool im Stream, mu\s die SlotId + // aus dem Stream in eine Which-Id gemappt werden k"onnen. + USHORT nMappedWhich = nSlotId ? GetWhich(nSlotId, TRUE) : 0; + if ( IsWhich(nMappedWhich) ) + { + // gemappte SlotId kann "ubernommen werden + rWhich = nMappedWhich; + bResolvable = TRUE; + } + } + + // kann Surrogat aufgel"ost werden? + const SfxPoolItem *pItem = 0; + if ( bResolvable ) + { + for ( SfxItemPool *pTarget = this; pTarget; pTarget = pTarget->pSecondary ) + { + // richtigen (Folge-) Pool gefunden? + if ( pTarget->IsInRange(rWhich) ) + { + // dflt-Attribut? + if ( SFX_ITEMS_STATICDEFAULT == nSurrogat ) + return *(pTarget->ppStaticDefaults + + pTarget->GetIndex_Impl(rWhich)); + + SfxPoolItemArray_Impl* pItemArr = *(pTarget->pImp->ppPoolItems + + pTarget->GetIndex_Impl(rWhich)); + pItem = pItemArr && nSurrogat < pItemArr->Count() + ? (*pItemArr)[nSurrogat] + : 0; + if ( !pItem ) + { + DBG_ERROR( "can't resolve surrogate" ); + rWhich = 0; // nur zur Sicherheit fuer richtige Stream-Pos + return 0; + } + + // Nachladen aus Ref-Pool? + if ( pRefPool != pMaster ) + return &pTarget->Put( *pItem ); + + // Referenzen sind NICHT schon mit Pool geladen worden? + if ( !pTarget->HasPersistentRefCounts() ) + AddRef( *pItem, 1 ); + else + return pItem; + + return pItem; + } + } + + SFX_ASSERT( FALSE, rWhich, "can't resolve Which-Id in LoadSurrogate" ); + } + + return 0; +} + +//------------------------------------------------------------------------- + + +FASTBOOL SfxItemPool::StoreSurrogate +( + SvStream& rStream, + const SfxPoolItem* pItem +) const + +/* [Beschreibung] + + Speichert ein Surrogat f"ur '*pItem' in 'rStream'. + + + [R"uckgabewert] + + FASTBOOL TRUE + es wurde ein echtes Surrogat gespeichert, auch + SFX_ITEMS_NULL bei 'pItem==0', + SFX_ITEMS_STATICDEFAULT und SFX_ITEMS_POOLDEFAULT + gelten als 'echte' Surrogate + + FALSE + es wurde ein Dummy-Surrogat (SFX_ITEMS_DIRECT) + gespeichert, das eigentliche Item mu\s direkt + hinterher selbst gespeichert werden +*/ + +{ + if ( pItem ) + { + FASTBOOL bRealSurrogate = IsItemFlag(*pItem, SFX_ITEM_POOLABLE); + rStream << ( bRealSurrogate + ? GetSurrogate( pItem ) + : (UINT16) SFX_ITEMS_DIRECT ); + return bRealSurrogate; + } + + rStream << (UINT16) SFX_ITEMS_NULL; + return TRUE; +} + +// ----------------------------------------------------------------------- + +USHORT SfxItemPool::GetSurrogate(const SfxPoolItem *pItem) const +{ + DBG_CHKTHIS(SfxItemPool, 0); + DBG_ASSERT( pItem, "no 0-Pointer Surrogate" ); + DBG_ASSERT( !IsInvalidItem(pItem), "no Invalid-Item Surrogate" ); + DBG_ASSERT( !IsPoolDefaultItem(pItem), "no Pool-Default-Item Surrogate" ); + + if ( !IsInRange(pItem->Which()) ) + { + if ( pSecondary ) + return pSecondary->GetSurrogate( pItem ); + SFX_ASSERT( 0, pItem->Which(), "unknown Which-Id - dont ask me for surrogates" ); + } + + // Pointer auf static- oder pool-dflt-Attribut? + if( IsStaticDefaultItem(pItem) || IsPoolDefaultItem(pItem) ) + return SFX_ITEMS_STATICDEFAULT; + + SfxPoolItemArray_Impl* pItemArr = *(pImp->ppPoolItems + GetIndex_Impl(pItem->Which())); + DBG_ASSERT(pItemArr, "ItemArr nicht vorhanden"); + const USHORT nCount = pItemArr->Count(); + for ( USHORT i = 0; i < nCount; ++i ) + { + const SfxPoolItem *p = (*pItemArr)[i]; + if ( p == pItem ) + return i; + } + SFX_ASSERT( 0, pItem->Which(), "Item nicht im Pool"); + return SFX_ITEMS_NULL; +} + +// ----------------------------------------------------------------------- + +FASTBOOL SfxItemPool::IsInStoringRange( USHORT nWhich ) const +{ + return nWhich >= pImp->nStoringStart && + nWhich <= pImp->nStoringEnd; +} + +//------------------------------------------------------------------------ + +void SfxItemPool::SetStoringRange( USHORT nFrom, USHORT nTo ) + +/* [Beschreibung] + + Mit dieser Methode kann der Which-Bereich eingeengt werden, der + von ItemSets dieses Pool (und dem Pool selbst) gespeichert wird. + Die Methode muss dazu vor gerufen werden + und die Werte muessen auch noch gesetzt sein, wenn das eigentliche + Dokument (also die ItemSets gespeicher werden). + + Ein Zuruecksetzen ist dann nicht noetig, wenn dieser Range vor + JEDEM Speichern richtig gesetzt wird, da er nur beim Speichern + beruecksichtigt wird. + + Dieses muss fuer das 3.1-Format gemacht werden, da dort eine + Bug in der Pool-Lade-Methode vorliegt. +*/ + +{ + pImp->nStoringStart = nFrom; + pImp->nStoringEnd = nTo; +} + +// ----------------------------------------------------------------------- + +void SfxItemPool::SetVersionMap +( + USHORT nVer, /* neue Versionsnummer */ + USHORT nOldStart, /* alte erste Which-Id */ + USHORT nOldEnd, /* alte letzte Which-Id */ + USHORT* pOldWhichIdTab /* Array mit genau dem Aufbau der Which-Ids + der vorhergehenden Version, in denen + die jeweils neue Which-Id steht. */ +) + +/* [Beschreibung] + + Mit dieser Methode k"onnen neue, inkompatible Which-Id-Folgen oder + Verteilungen realisiert werden. Pools, die noch mit alten Versionen + gespeichert wurden, werden dann "uber die angegebene Tabelle solange + gemappt, bis die aktuelle Version erreicht ist. Neuere Pools k"onnen + unter Verlust neuer Attribute geladen werden, da die Map mit dem Pool + gespeichert wird. + + Precondition: Pool darf noch nicht geladen sein + Postcondition: Which-Ids aus fr"uheren Versionen k"onnen bei Laden auf + Version 'nVer' gemappt werden + Laufzeit: 1.5 * new + 10 + + [Anmerkung] + + F"ur neue Which-Ranges (nStart,nEnd) m"ssen im Vergleich zur Vorg"anger- + Version (nOldStart,nOldEnd) immer gelten, da\s (nOldStart,nOldEnd) + vollst"andig in (nStart,nEnd) enthalten ist. Es ist also zul"assig, den + Which-Range in beide Richtungen zu erweitern, auch durch Einf"ugung + von Which-Ids, nicht aber ihn zu beschneiden. + + Diese Methode sollte nur im oder direkt nach Aufruf des Konstruktors + gerufen werden. + + Das Array mu\s statisch sein, da es nicht kopiert wird und au\serdem + im Copy-Ctor des SfxItemPool wiederverwendet wird. + + + [Beispiel] + + Urspr"unglich (Version 0) hatte der Pool folgende Which-Ids: + + 1:A, 2:B, 3:C, 4:D + + Nun soll eine neue Version (Version 1) zwei zus"atzliche Ids X und Y + zwischen B und C erhalten, also wie folgt aussehen: + + 1:A, 2:B, 3:X, 4:Y, 5:C, 6:D + + Dabei haben sich also die Ids 3 und 4 ge"andert. F"ur die neue Version + m"u\ste am Pool folgendes gesetzt werden: + + static USHORT nVersion1Map = { 1, 2, 5, 6 }; + pPool->SetVersionMap( 1, 1, 4, &nVersion1Map ); + + + [Querverweise] + + + + + +*/ + +{ + // neuen Map-Eintrag erzeugen und einf"ugen + const SfxPoolVersion_Impl *pVerMap = new SfxPoolVersion_Impl( + nVer, nOldStart, nOldEnd, pOldWhichIdTab ); + pImp->aVersions.Insert( pVerMap, pImp->aVersions.Count() ); + + DBG_ASSERT( nVer > pImp->nVersion, "Versions not sorted" ); + pImp->nVersion = nVer; + + // Versions-Range anpassen + for ( USHORT n = 0; n < nOldEnd-nOldStart+1; ++n ) + { + USHORT nWhich = pOldWhichIdTab[n]; + if ( nWhich < pImp->nVerStart ) + { + if ( !nWhich ) + nWhich = 0; + pImp->nVerStart = nWhich; + } + else if ( nWhich > pImp->nVerEnd ) + pImp->nVerEnd = nWhich; + } +} + +// ----------------------------------------------------------------------- + +USHORT SfxItemPool::GetNewWhich +( + USHORT nFileWhich // die aus dem Stream geladene Which-Id +) const + +/* [Beschreibung] + + Diese Methoden rechnet Which-Ids aus einem File-Format in die der + aktuellen Pool-Version um. Ist das File-Format "alter, werden die vom + Pool-Entwickler mit SetVersion() gesetzten Tabellen verwendet, + ist das File-Format neuer, dann die aus dem File geladenen Tabellen. + Im letzteren Fall kann ggf. nicht jede Which-Id gemappt werden, + so da\s 0 zur"uckgeliefert wird. + + Die Berechnung ist nur f"ur Which-Ids definiert, die in der betreffenden + File-Version unterst"utzt wurden. Dies ist per Assertion abgesichert. + + Precondition: Pool mu\s geladen sein + Postcondition: unver"andert + Laufzeit: linear(Anzahl der Sekund"arpools) + + linear(Differenz zwischen alter und neuer Version) + + + [Querverweise] + + + + + +*/ + +{ + // (Sekund"ar-) Pool bestimmen + if ( !IsInVersionsRange(nFileWhich) ) + { + if ( pSecondary ) + return pSecondary->GetNewWhich( nFileWhich ); + SFX_ASSERT( 0, nFileWhich, "unknown which in GetNewWhich()" ); + } + + // Version neuer/gleich/"alter? + short nDiff = (short)pImp->nLoadingVersion - (short)pImp->nVersion; + + // Which-Id einer neueren Version? + if ( nDiff > 0 ) + { + // von der Top-Version bis runter zur File-Version stufenweise mappen + for ( USHORT nMap = pImp->aVersions.Count(); nMap > 0; --nMap ) + { + SfxPoolVersion_Impl *pVerInfo = pImp->aVersions[nMap-1]; + if ( pVerInfo->_nVer > pImp->nVersion ) + { USHORT nOfs; + USHORT nCount = pVerInfo->_nEnd - pVerInfo->_nStart + 1; + for ( nOfs = 0; + nOfs <= nCount && + pVerInfo->_pMap[nOfs] != nFileWhich; + ++nOfs ) + continue; + + if ( pVerInfo->_pMap[nOfs] == nFileWhich ) + nFileWhich = pVerInfo->_nStart + nOfs; + else + return 0; + } + else + break; + } + } + + // Which-Id einer neueren Version? + else if ( nDiff < 0 ) + { + // von der File-Version bis zur aktuellen Version stufenweise mappen + for ( USHORT nMap = 0; nMap < pImp->aVersions.Count(); ++nMap ) + { + SfxPoolVersion_Impl *pVerInfo = pImp->aVersions[nMap]; + if ( pVerInfo->_nVer > pImp->nLoadingVersion ) + { + DBG_ASSERT( nFileWhich >= pVerInfo->_nStart && + nFileWhich <= pVerInfo->_nEnd, + "which-id unknown in version" ); + nFileWhich = pVerInfo->_pMap[nFileWhich - pVerInfo->_nStart]; + } + } + } + + // originale (nDiff==0) bzw. gemappte (nDiff!=0) Id zur"uckliefern + return nFileWhich; +} + +// ----------------------------------------------------------------------- + + +FASTBOOL SfxItemPool::IsInVersionsRange( USHORT nWhich ) const +{ + return nWhich >= pImp->nVerStart && nWhich <= pImp->nVerEnd; +} + +// ----------------------------------------------------------------------- + +FASTBOOL SfxItemPool::IsCurrentVersionLoading() const + +/* [Beschreibung] + + Mit dieser Methode kann festgestellt werden, ob die geladene Pool-Version + dem aktuellen Pool-Aufbau entspricht. + + Precondition: Pool mu\s geladen sein + Postcondition: unver"andert + Laufzeit: linear(Anzahl der Sekund"arpools) + + + [Querverweise] + + + + + +*/ + +{ + return ( pImp->nVersion == pImp->nLoadingVersion ) && + ( !pSecondary || pSecondary->IsCurrentVersionLoading() ); +} + +// ----------------------------------------------------------------------- + +USHORT SfxItemPool::GetVersion() const + +/* [Beschreibung] + + Diese Methode liefert die aktuelle Versionsnummer des SfxItemPool-Aufbaus + (also des Which-Bereichs). + + Precondition: keine + Postcondition: unver"andert + Laufzeit: 2 + + + [Anmerkung] + + Achtung: Es mu\s ggf. die Versionsnummer von Sekund"arpools + ber"ucksichtigt werden. + + + [Querverweise] + + + + + +*/ + +{ + return pImp->nVersion; +} + +// ----------------------------------------------------------------------- + +USHORT SfxItemPool::GetLoadingVersion() const + +/* [Beschreibung] + + Diese Methode liefert die Versionsnummer des SfxItemPool-Aufbaus + (also des Which-Bereichs), die bei Laden vorgefunden wurde. + + Precondition: Pool mu\s geladen sein + Postcondition: unver"andert + Laufzeit: 2 + + + [Anmerkung] + + Achtung: Es mu\s ggf. die Versionsnummer von Sekund"arpools + ber"ucksichtigt werden. + + + [Querverweise] + + + + + +*/ + +{ + return pImp->nLoadingVersion; +} + +//------------------------------------------------------------------------- + +FASTBOOL SfxItemPool::IsVer2_Impl() const +{ + return pMaster->pImp->nMajorVer >= 2; +} + +//------------------------------------------------------------------------- + + +FASTBOOL SfxItemPool::StoreItem( SvStream &rStream, const SfxPoolItem &rItem, + FASTBOOL bDirect ) const + +/* [Beschreibung] + + Speichert das 'rItem' in den 'rStream' + entweder als Surrogat ('bDirect == FALSE') oder direkt mit 'rItem.Store()'. + Nicht poolable Items werden immer direkt gespeichert. Items ohne Which-Id, + also SID-Items, werden nicht gespeichert, ebenso wenn Items, die in der + File-Format-Version noch nicht vorhanden waren (return FALSE). + + Das Item wird im Stream wie folgt abgelegt: + + USHORT rItem.Which() + USHORT GetSlotId( rItem.Which() ) bzw. 0 falls nicht verf"urbar + USHORT GetSurrogate( &rItem ) bzw. SFX_ITEM_DIRECT bei '!SFX_ITEM_POOLBLE' + + optional (falls 'bDirect == TRUE' oder '!rItem.IsPoolable()': + + USHORT rItem.GetVersion() + ULONG Size + Size rItem.Store() + + + [Querverweise] + + +*/ + +{ + DBG_ASSERT( !IsInvalidItem(&rItem), "cannot store invalid items" ); + + if ( IsSlot( rItem.Which() ) ) + return FALSE; + const SfxItemPool *pPool = this; + while ( !pPool->IsInStoringRange(rItem.Which()) ) + if ( 0 == ( pPool = pPool->pSecondary ) ) + return FALSE; + + DBG_ASSERT( !pImp->bInSetItem || !rItem.ISA(SfxSetItem), + "SetItem contains ItemSet with SetItem" ); + + USHORT nSlotId = pPool->GetSlotId( rItem.Which(), TRUE ); + USHORT nItemVersion = rItem.GetVersion(_nFileFormatVersion); + if ( USHRT_MAX == nItemVersion ) + return FALSE; + + rStream << rItem.Which() << nSlotId; + if ( bDirect || !pPool->StoreSurrogate( rStream, &rItem ) ) + { + rStream << nItemVersion; + rStream << (UINT32) 0L; // Platz fuer Laenge in Bytes + ULONG nIStart = rStream.Tell(); + rItem.Store(rStream, nItemVersion); + ULONG nIEnd = rStream.Tell(); + rStream.Seek( nIStart-4 ); + rStream << (INT32) ( nIEnd-nIStart ); + rStream.Seek( nIEnd ); + } + + return TRUE; +} + +//------------------------------------------------------------------------- + + +const SfxPoolItem* SfxItemPool::LoadItem( SvStream &rStream, FASTBOOL bDirect, + const SfxItemPool *pRefPool ) + +// pRefPool==-1 => nicht putten! + +{ + USHORT nWhich, nSlot; // nSurrogate; + rStream >> nWhich >> nSlot; + + BOOL bDontPut = (SfxItemPool*)-1 == pRefPool; + if ( bDontPut || !pRefPool ) + pRefPool = this; + + // richtigen Sekund"ar-Pool finden + while ( !pRefPool->IsInVersionsRange(nWhich) ) + { + if ( pRefPool->pSecondary ) + pRefPool = pRefPool->pSecondary; + else + { + // WID in der Version nicht vorhanden => ueberspringen + USHORT nSurro, nVersion, nLen; + rStream >> nSurro; + if ( SFX_ITEMS_DIRECT == nSurro ) + { + rStream >> nVersion >> nLen; + rStream.SeekRel( nLen ); + } + return 0; + } + } + + // wird eine andere Version geladen? + FASTBOOL bCurVersion = pRefPool->IsCurrentVersionLoading(); + if ( !bCurVersion ) + // Which-Id auf neue Version mappen + nWhich = pRefPool->GetNewWhich( nWhich ); + + DBG_ASSERT( !nWhich || !pImp->bInSetItem || + !pRefPool->ppStaticDefaults[pRefPool->GetIndex_Impl(nWhich)]->ISA(SfxSetItem), + "loading SetItem in ItemSet of SetItem" ); + + // soll "uber Surrogat geladen werden? + const SfxPoolItem *pItem = 0; + if ( !bDirect ) + { + // Which-Id in dieser Version bekannt? + if ( nWhich ) + // Surrogat laden, reagieren falls keins vorhanden + pItem = LoadSurrogate( rStream, nWhich, nSlot, pRefPool ); + else + // sonst "uberspringen + rStream.SeekRel( sizeof(USHORT) ); + } + + // wird direkt, also nicht "uber Surrogat geladen? + if ( bDirect || ( nWhich && !pItem ) ) + { + // bDirekt bzw. nicht IsPoolable() => Item direkt laden + USHORT nVersion; + sal_uInt32 nLen; + rStream >> nVersion >> nLen; + ULONG nIStart = rStream.Tell(); + + // Which-Id in dieser Version bekannt? + if ( nWhich ) + { + // Item direkt laden + SfxPoolItem *pNewItem = + pRefPool->GetDefaultItem(nWhich).Create(rStream, nVersion); + if ( bDontPut ) + pItem = pNewItem; + else + if ( pNewItem ) + { + pItem = &Put(*pNewItem); + delete pNewItem; + } + else + pItem = 0; + ULONG nIEnd = rStream.Tell(); + DBG_ASSERT( nIEnd <= (nIStart+nLen), "read past end of item" ); + if ( (nIStart+nLen) != nIEnd ) + rStream.Seek( nIStart+nLen ); + } + else + // Item "uberspringen + rStream.Seek( nIStart+nLen ); + } + + return pItem; +} + + diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx new file mode 100644 index 000000000000..ef160b4a8b4c --- /dev/null +++ b/svl/source/items/poolitem.cxx @@ -0,0 +1,527 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: poolitem.cxx,v $ + * $Revision: 1.8 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include +#include + +// STATIC DATA ----------------------------------------------------------- + +DBG_NAME(SfxPoolItem) +DBG_NAME(SfxVoidItem) +// @@@ DBG_NAME(SfxInvalidItem); +DBG_NAME(SfxItemHandle) + +BYTE nSfxFlag8Val[8] = +{ + 1, 2, 4, 8, 16, 32, 64, 128 +}; + +USHORT nSfxFlag16Val[16] = +{ + 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, + 1024, 2048, 4096, 8192, 16384, 32768 +}; + +ULONG nSfxFlag32Val[32] = +{ + 0x1L, 0x2L, 0x4L, 0x8L, + 0x10L, 0x20L, 0x40L, 0x80L, + 0x100L, 0x200L, 0x400L, 0x800L, + 0x1000L, 0x2000L, 0x40000L, 0x8000L, + 0x10000L, 0x20000L, 0x40000L, 0x80000L, + 0x100000L, 0x200000L, 0x400000L, 0x800000L, + 0x1000000L, 0x2000000L, 0x4000000L, 0x8000000L, + 0x10000000L, 0x20000000L, 0x40000000L, 0x80000000L +}; + +// RTTI ------------------------------------------------------------------ + +TYPEINIT0(SfxPoolItem); +TYPEINIT1(SfxVoidItem, SfxPoolItem); +// @@@ TYPEINIT1(SfxInvalidItem, SfxPoolItem); +TYPEINIT1(SfxSetItem, SfxPoolItem); +// @@@ TYPEINIT1(SfxItemChangedHint, SfxHint); + +// ------------------------------------------------------------------------ +#if OSL_DEBUG_LEVEL > 1 +static ULONG nItemCount = 0; + +const char* pw1 = "Wow! 10.000 items!"; +const char* pw2 = "Wow! 100.000 items!"; +const char* pw3 = "Wow! 1.000.000 items!"; +const char* pw4 = "Wow! 50.000.000 items!"; +const char* pw5 = "Wow! 10.000.000 items!"; +#endif + +IMPL_PTRHINT(SfxPoolItemHint,SfxPoolItem) + +// SfxPoolItem ----------------------------------------------------------- +SfxPoolItem::SfxPoolItem( USHORT nW ) + : nRefCount( 0 ), + nWhich( nW ) + , nKind( 0 ) +{ + DBG_CTOR(SfxPoolItem, 0); + DBG_ASSERT(nW <= SHRT_MAX, "Which Bereich ueberschritten"); +#if OSL_DEBUG_LEVEL > 1 + ++nItemCount; + if ( pw1 && nItemCount>=10000 ) + { + DBG_WARNING( pw1 ); + pw1 = NULL; + } + if ( pw2 && nItemCount>=100000 ) + { + DBG_WARNING( pw2 ); + pw2 = NULL; + } + if ( pw3 && nItemCount>=1000000 ) + { + DBG_WARNING( pw3 ); + pw3 = NULL; + } + if ( pw4 && nItemCount>=5000000 ) + { + DBG_WARNING( pw4 ); + pw4 = NULL; + } + if ( pw5 && nItemCount>=10000000 ) + { + DBG_WARNING( pw5 ); + pw5 = NULL; + } +#endif +} + +// ----------------------------------------------------------------------- +SfxPoolItem::SfxPoolItem( const SfxPoolItem& rCpy ) + : nRefCount( 0 ), // wird ja ein neues Object! + nWhich( rCpy.Which() ) // Funktion rufen wg. ChkThis() + , nKind( 0 ) +{ + DBG_CTOR(SfxPoolItem, 0); +#if OSL_DEBUG_LEVEL > 1 + ++nItemCount; + if ( pw1 && nItemCount>=10000 ) + { + DBG_WARNING( pw1 ); + pw1 = NULL; + } + if ( pw2 && nItemCount>=100000 ) + { + DBG_WARNING( pw2 ); + pw2 = NULL; + } + if ( pw3 && nItemCount>=1000000 ) + { + DBG_WARNING( pw3 ); + pw3 = NULL; + } + if ( pw4 && nItemCount>=5000000 ) + { + DBG_WARNING( pw4 ); + pw4 = NULL; + } + if ( pw5 && nItemCount>=10000000 ) + { + DBG_WARNING( pw5 ); + pw5 = NULL; + } +#endif +} + +// ------------------------------------------------------------------------ +SfxPoolItem::~SfxPoolItem() +{ + DBG_DTOR(SfxPoolItem, 0); + DBG_ASSERT(nRefCount == 0 || nRefCount > SFX_ITEMS_MAXREF, "destroying item in use" ); +#if OSL_DEBUG_LEVEL > 1 + --nItemCount; +#endif +} + +// ------------------------------------------------------------------------ +int SfxPoolItem::Compare( const SfxPoolItem& ) const +{ + return 0; +} + +// ------------------------------------------------------------------------ +int SfxPoolItem::Compare( const SfxPoolItem& rWith, const IntlWrapper& ) const +{ + return Compare( rWith ); +} + +// ------------------------------------------------------------------------ +int SfxPoolItem::operator==( const SfxPoolItem& rCmp ) const +{ + DBG_CHKTHIS(SfxPoolItem, 0); + return rCmp.Type() == Type(); +} + +// ----------------------------------------------------------------------- +#ifndef TF_POOLABLE + +int SfxPoolItem::IsPoolable() const +{ + DBG_CHKTHIS(SfxPoolItem, 0); + return TRUE; +} +#endif + +// ----------------------------------------------------------------------- +SfxPoolItem* SfxPoolItem::Create(SvStream &, USHORT) const +{ + DBG_CHKTHIS(SfxPoolItem, 0); + return Clone(0); +} + +// ----------------------------------------------------------------------- +USHORT SfxPoolItem::GetVersion( USHORT ) const +{ + DBG_CHKTHIS(SfxPoolItem, 0); + return 0; +} + +// ----------------------------------------------------------------------- +SvStream& SfxPoolItem::Store(SvStream &rStream, USHORT ) const +{ + DBG_CHKTHIS(SfxPoolItem, 0); + return rStream; +} + +//============================================================================ +// static +bool SfxPoolItem::readByteString(SvStream & rStream, UniString & rString) +{ + rStream.ReadByteString(rString); + return rStream.GetError() == ERRCODE_NONE; +} + +//============================================================================ +// static +void SfxPoolItem::writeByteString(SvStream & rStream, + UniString const & rString) +{ + rStream.WriteByteString(rString); +} + +//============================================================================ +// static +bool SfxPoolItem::readUnicodeString(SvStream & rStream, UniString & rString, + bool bUnicode) +{ + rStream.ReadByteString(rString, + bUnicode ? RTL_TEXTENCODING_UCS2 : + rStream.GetStreamCharSet()); + return rStream.GetError() == ERRCODE_NONE; +} + +//============================================================================ +// static +void SfxPoolItem::writeUnicodeString(SvStream & rStream, + UniString const & rString) +{ + rStream.WriteByteString(rString, RTL_TEXTENCODING_UCS2); +} + +// ------------------------------------------------------------------------ +SfxItemPresentation SfxPoolItem::GetPresentation +( + SfxItemPresentation /*ePresentation*/, // IN: wie formatiert werden soll + SfxMapUnit /*eCoreMetric*/, // IN: Ma\seinheit des SfxPoolItems + SfxMapUnit /*ePresentationMetric*/, // IN: Wunsch-Ma\einheit der Darstellung + XubString& /*rText*/, // OUT: textuelle Darstellung + const IntlWrapper * +) const + +/* [Beschreibung] + + "Uber diese virtuelle Methode kann von den SfxPoolItem-Subklassen + eine textuelle Datstellung des Wertes erhalten werden. Sie sollte + von allen UI-relevanten SfxPoolItem-Subklassen "uberladen werden. + + Da die Ma\seinheit des Wertes im SfxItemPool nur "uber + erfragbar ist, und nicht etwa + in der SfxPoolItem-Instanz oder -Subklasse verf"ugbar ist, wird die + eigene Ma\seinheit als 'eCoreMetric' "ubergeben. + + Die darzustellende Ma\seinheit wird als 'ePresentationMetric' + "ubergeben. + + + [R"uckgabewert] + + SfxItemPresentation SFX_ITEM_PRESENTATION_NONE + es konnte keine Text-Darstellung erzeugt werden + + SFX_ITEM_PRESENTATION_NAMELESS + es konnte eine Text-Darstellung (ggf. mit + Ma\seinheit) erzeugt werden, die jedoch keine + semantische Bedeutung enth"alt + + SFX_ITEM_PRESENTATION_COMPLETE + es konnte eine komplette Text-Darstellung mit + semantischer Bedeutung (und ggf. Ma\seinheit) + erzeugt werden + + + [Beispiele] + + pSvxFontItem->GetPresentation( SFX_PRESENTATION_NAMELESS, ... ) + "12pt" mit return SFX_ITEM_PRESENTATION_NAMELESS + + pSvxColorItem->GetPresentation( SFX_PRESENTATION_COMPLETE, ... ) + "rot" mit return SFX_ITEM_PRESENTATION_NAMELESS + (das das SvxColorItem nicht wei\s, was f"ur eine Farbe es darstellt, + kann es keinen Namen angeben, was durch den Returnwert mitgeteilt wird. + + pSvxBorderItem->GetPresentation( SFX_PRESENTATION_COMPLETE, ... ) + "1cm oberer Rand, 2cm linker Rand, 0,2cm unterer Rand, ..." +*/ + +{ + return SFX_ITEM_PRESENTATION_NONE; +} + +// SfxVoidItem ------------------------------------------------------------ +SfxVoidItem::SfxVoidItem( USHORT which ): + SfxPoolItem(which) +{ + DBG_CTOR(SfxVoidItem, 0); +} + +// SfxVoidItem ------------------------------------------------------------ +SfxVoidItem::SfxVoidItem( const SfxVoidItem& rCopy): + SfxPoolItem(rCopy) +{ + DBG_CTOR(SfxVoidItem, 0); +} + +// ------------------------------------------------------------------------ +int SfxVoidItem::operator==( const SfxPoolItem& +#ifdef DBG_UTIL +rCmp +#endif +) const +{ + DBG_CHKTHIS(SfxVoidItem, 0); + DBG_ASSERT( SfxPoolItem::operator==( rCmp ), "unequal type" ); + return TRUE; +} + +// ------------------------------------------------------------------------ +SfxItemPresentation SfxVoidItem::GetPresentation +( + SfxItemPresentation /*ePresentation*/, + SfxMapUnit /*eCoreMetric*/, + SfxMapUnit /*ePresentationMetric*/, + XubString& rText, + const IntlWrapper * +) const +{ + DBG_CHKTHIS(SfxVoidItem, 0); + rText.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Void")); + return SFX_ITEM_PRESENTATION_NAMELESS; +} + +// ------------------------------------------------------------------------ +SfxPoolItem* SfxVoidItem::Clone(SfxItemPool *) const +{ + DBG_CHKTHIS(SfxVoidItem, 0); + return new SfxVoidItem(*this); +} + +// SfxInvalidItem --------------------------------------------------------- +#if 0 /* @@@ NOT USED @@@ */ +SfxInvalidItem::SfxInvalidItem( USHORT nWhich, const SfxPoolItem &rDefault ): + SfxPoolItem(nWhich), + pDefaultItem(&rDefault) +{ + DBG_CTOR(SfxInvalidItem, 0); +} + +// ------------------------------------------------------------------------ +SfxInvalidItem::SfxInvalidItem( const SfxInvalidItem& rCopy): + SfxPoolItem(rCopy), + pDefaultItem(rCopy.pDefaultItem) +{ + DBG_CTOR(SfxInvalidItem, 0); + //! pDefaultItem->ReleaseRef? +} + +// ------------------------------------------------------------------------ +SfxInvalidItem::~SfxInvalidItem() +{ + DBG_DTOR(SfxInvalidItem, 0); +} + +// ------------------------------------------------------------------------ +int SfxInvalidItem::operator==( const SfxPoolItem& rCmp) const +{ + DBG_CHKTHIS(SfxInvalidItem, 0); + DBG_ASSERT( SfxPoolItem::operator==(rCmp), "unequal type" ); + return *pDefaultItem == *((SfxInvalidItem&)rCmp).pDefaultItem; +} + +// ------------------------------------------------------------------------ +SfxItemPresentation SfxInvalidItem::GetPresentation +( + SfxItemPresentation ePresentation, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresentationMetric, + XubString& rText, + const IntlWrapper * +) const +{ + DBG_CHKTHIS(SfxInvalidItem, 0); + rText.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Invalid")); + return SFX_ITEM_PRESENTATION_NAMELESS; +} + +// ------------------------------------------------------------------------ +SfxPoolItem* SfxInvalidItem::Clone(SfxItemPool *) const +{ + DBG_CHKTHIS(SfxInvalidItem, 0); + return new SfxInvalidItem(*this); +} + +// ------------------------------------------------------------------------ +SfxPoolItem* SfxInvalidItem::Create(SvStream &, USHORT nVersion) const +{ + DBG_CHKTHIS(SfxInvalidItem, 0); + DBG_ERROR("SfxInvalidItem::Create() ist sinnlos"); + return Clone(); +} + +// ------------------------------------------------------------------------ +SvStream& SfxInvalidItem::Store(SvStream &rStream, USHORT nItemVersion ) const +{ + DBG_CHKTHIS(SfxInvalidItem, 0); + DBG_ERROR("SfxInvalidItem::Store() ist sinnlos"); + return rStream; +} +#endif /* @@@ NOT USED @@@ */ + +// SfxItemHandle ---------------------------------------------------------- +SfxItemHandle::SfxItemHandle(SfxPoolItem &rItem): + pRef(new USHORT(1)), + pItem(rItem.Clone(0)) +{ + DBG_CTOR(SfxItemHandle, 0); +} + +// ------------------------------------------------------------------------ +SfxItemHandle::SfxItemHandle(const SfxItemHandle &rCopy): + pRef(rCopy.pRef), + pItem(rCopy.pItem) +{ + DBG_CTOR(SfxItemHandle, 0); + ++(*pRef); +} + +// ------------------------------------------------------------------------ +const SfxItemHandle &SfxItemHandle::operator=(const SfxItemHandle &rCopy) +{ + DBG_CHKTHIS(SfxItemHandle, 0); + if(&rCopy == this || pItem == rCopy.pItem) + return *this; + --(*pRef); + if(!(*pRef)) + { + delete pItem; + pItem = 0; + } + pRef = rCopy.pRef; + ++(*pRef); + pItem = rCopy.pItem; + return *this; +} + +// ------------------------------------------------------------------------ +SfxItemHandle::~SfxItemHandle() +{ + DBG_DTOR(SfxItemHandle, 0); + --(*pRef); + if(!(*pRef)) { + delete pRef; pRef = 0; + delete pItem; pItem = 0; + } +} + +// ------------------------------------------------------------------------ +int SfxPoolItem::ScaleMetrics( long /*lMult*/, long /*lDiv*/ ) +{ + return 0; +} + +// ------------------------------------------------------------------------ +int SfxPoolItem::HasMetrics() const +{ + return 0; +} + +// ----------------------------------------------------------------------- +#if 0 /* @@@ NOT USED @@@ */ +void SfxPoolItem::GetVersion() const +{ + DBG_ERROR( "dummy called" ); +} + +// ----------------------------------------------------------------------- +void SfxPoolItem::Store(SvStream &rStream) const +{ + DBG_ERROR( "dummy called" ); +} +#endif /* @@@ NOT USED @@@ */ + +// ----------------------------------------------------------------------- + +BOOL SfxPoolItem::QueryValue( com::sun::star::uno::Any&, BYTE ) const +{ + DBG_ERROR("There is no implementation for QueryValue for this item!"); + return FALSE; +} + +// ----------------------------------------------------------------------- + +BOOL SfxPoolItem::PutValue( const com::sun::star::uno::Any&, BYTE ) +{ + DBG_ERROR("There is no implementation for PutValue for this item!"); + return FALSE; +} + +SfxVoidItem::~SfxVoidItem() +{ + DBG_DTOR(SfxVoidItem, 0); +} diff --git a/svl/source/items/ptitem.cxx b/svl/source/items/ptitem.cxx new file mode 100644 index 000000000000..ac1e94fd1727 --- /dev/null +++ b/svl/source/items/ptitem.cxx @@ -0,0 +1,208 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ptitem.cxx,v $ + * $Revision: 1.12 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include +#include +#include +#include + +#include +#include "memberid.hrc" + +using namespace ::com::sun::star; +// STATIC DATA ----------------------------------------------------------- + +DBG_NAME(SfxPointItem) + +#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) +#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) + +// ----------------------------------------------------------------------- + +TYPEINIT1_AUTOFACTORY(SfxPointItem, SfxPoolItem); + +// ----------------------------------------------------------------------- + +SfxPointItem::SfxPointItem() +{ + DBG_CTOR(SfxPointItem, 0); +} + +// ----------------------------------------------------------------------- + +SfxPointItem::SfxPointItem( USHORT nW, const Point& rVal ) : + SfxPoolItem( nW ), + aVal( rVal ) +{ + DBG_CTOR(SfxPointItem, 0); +} + +// ----------------------------------------------------------------------- + +SfxPointItem::SfxPointItem( USHORT nW, SvStream &rStream ) : + SfxPoolItem( nW ) +{ + DBG_CTOR(SfxPointItem, 0); + rStream >> aVal; +} + +// ----------------------------------------------------------------------- + +SfxPointItem::SfxPointItem( const SfxPointItem& rItem ) : + SfxPoolItem( rItem ), + aVal( rItem.aVal ) +{ + DBG_CTOR(SfxPointItem, 0); +} + +// ----------------------------------------------------------------------- + +SfxItemPresentation SfxPointItem::GetPresentation +( + SfxItemPresentation /*ePresentation*/, + SfxMapUnit /*eCoreMetric*/, + SfxMapUnit /*ePresentationMetric*/, + XubString& rText, + const IntlWrapper * +) const +{ + DBG_CHKTHIS(SfxPointItem, 0); + rText = UniString::CreateFromInt32(aVal.X()); + rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + rText += UniString::CreateFromInt32(aVal.Y()); + rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + return SFX_ITEM_PRESENTATION_NAMELESS; +} + +// ----------------------------------------------------------------------- + +int SfxPointItem::operator==( const SfxPoolItem& rItem ) const +{ + DBG_CHKTHIS(SfxPointItem, 0); + DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); + return ((SfxPointItem&)rItem).aVal == aVal; +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxPointItem::Clone(SfxItemPool *) const +{ + DBG_CHKTHIS(SfxPointItem, 0); + return new SfxPointItem( *this ); +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxPointItem::Create(SvStream &rStream, USHORT ) const +{ + DBG_CHKTHIS(SfxPointItem, 0); + Point aStr; + rStream >> aStr; + return new SfxPointItem(Which(), aStr); +} + +// ----------------------------------------------------------------------- + +SvStream& SfxPointItem::Store(SvStream &rStream, USHORT ) const +{ + DBG_CHKTHIS(SfxPointItem, 0); + rStream << aVal; + return rStream; +} + +// ----------------------------------------------------------------------- + +BOOL SfxPointItem::QueryValue( uno::Any& rVal, + BYTE nMemberId ) const +{ + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + awt::Point aTmp(aVal.X(), aVal.Y()); + if( bConvert ) + { + aTmp.X = TWIP_TO_MM100(aTmp.X); + aTmp.Y = TWIP_TO_MM100(aTmp.Y); + } + nMemberId &= ~CONVERT_TWIPS; + switch ( nMemberId ) + { + case 0: rVal <<= aTmp; break; + case MID_X: rVal <<= aTmp.X; break; + case MID_Y: rVal <<= aTmp.Y; break; + default: DBG_ERROR("Wrong MemberId!"); return FALSE; + } + + return TRUE; +} + +// ----------------------------------------------------------------------- + +BOOL SfxPointItem::PutValue( const uno::Any& rVal, + BYTE nMemberId ) +{ + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; + BOOL bRet = FALSE; + awt::Point aValue; + sal_Int32 nVal = 0; + if ( !nMemberId ) + { + bRet = ( rVal >>= aValue ); + if( bConvert ) + { + aValue.X = MM100_TO_TWIP(aValue.X); + aValue.Y = MM100_TO_TWIP(aValue.Y); + } + } + else + { + bRet = ( rVal >>= nVal ); + if( bConvert ) + nVal = MM100_TO_TWIP( nVal ); + } + + if ( bRet ) + { + switch ( nMemberId ) + { + case 0: aVal.setX( aValue.X ); aVal.setY( aValue.Y ); break; + case MID_X: aVal.setX( nVal ); break; + case MID_Y: aVal.setY( nVal ); break; + default: DBG_ERROR("Wrong MemberId!"); return FALSE; + } + } + + return bRet; +} + + + diff --git a/svl/source/items/rectitem.cxx b/svl/source/items/rectitem.cxx new file mode 100644 index 000000000000..f9faeeeaa824 --- /dev/null +++ b/svl/source/items/rectitem.cxx @@ -0,0 +1,204 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: rectitem.cxx,v $ + * $Revision: 1.12 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include +#include +#include +#include + +#include +#include "memberid.hrc" + +// STATIC DATA ----------------------------------------------------------- + +DBG_NAME(SfxRectangleItem) + + +// ----------------------------------------------------------------------- + +TYPEINIT1_AUTOFACTORY(SfxRectangleItem, SfxPoolItem); + +// ----------------------------------------------------------------------- + +SfxRectangleItem::SfxRectangleItem() +{ + DBG_CTOR(SfxRectangleItem, 0); +} + +// ----------------------------------------------------------------------- + +SfxRectangleItem::SfxRectangleItem( USHORT nW, const Rectangle& rVal ) : + SfxPoolItem( nW ), + aVal( rVal ) +{ + DBG_CTOR(SfxRectangleItem, 0); +} + +// ----------------------------------------------------------------------- + +SfxRectangleItem::SfxRectangleItem( USHORT nW, SvStream &rStream ) : + SfxPoolItem( nW ) +{ + DBG_CTOR(SfxRectangleItem, 0); + rStream >> aVal; +} + +// ----------------------------------------------------------------------- + +SfxRectangleItem::SfxRectangleItem( const SfxRectangleItem& rItem ) : + SfxPoolItem( rItem ), + aVal( rItem.aVal ) +{ + DBG_CTOR(SfxRectangleItem, 0); +} + +// ----------------------------------------------------------------------- + +SfxItemPresentation SfxRectangleItem::GetPresentation +( + SfxItemPresentation /*ePresentation*/, + SfxMapUnit /*eCoreMetric*/, + SfxMapUnit /*ePresentationMetric*/, + XubString& rText, + const IntlWrapper * +) const +{ + DBG_CHKTHIS(SfxRectangleItem, 0); + rText = UniString::CreateFromInt32(aVal.Top()); + rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + rText += UniString::CreateFromInt32(aVal.Left()); + rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + rText += UniString::CreateFromInt32(aVal.Bottom()); + rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + rText += UniString::CreateFromInt32(aVal.Right()); + return SFX_ITEM_PRESENTATION_NAMELESS; +} + +// ----------------------------------------------------------------------- + +int SfxRectangleItem::operator==( const SfxPoolItem& rItem ) const +{ + DBG_CHKTHIS(SfxRectangleItem, 0); + DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); + return ((SfxRectangleItem&)rItem).aVal == aVal; +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxRectangleItem::Clone(SfxItemPool *) const +{ + DBG_CHKTHIS(SfxRectangleItem, 0); + return new SfxRectangleItem( *this ); +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxRectangleItem::Create(SvStream &rStream, USHORT ) const +{ + DBG_CHKTHIS(SfxRectangleItem, 0); + Rectangle aStr; + rStream >> aStr; + return new SfxRectangleItem(Which(), aStr); +} + +// ----------------------------------------------------------------------- + +SvStream& SfxRectangleItem::Store(SvStream &rStream, USHORT ) const +{ + DBG_CHKTHIS(SfxRectangleItem, 0); + rStream << aVal; + return rStream; +} + + +// ----------------------------------------------------------------------- +BOOL SfxRectangleItem::QueryValue( com::sun::star::uno::Any& rVal, + BYTE nMemberId) const +{ + nMemberId &= ~CONVERT_TWIPS; + switch ( nMemberId ) + { + case 0: + { + rVal <<= com::sun::star::awt::Rectangle( aVal.getX(), + aVal.getY(), + aVal.getWidth(), + aVal.getHeight() ); + break; + } + case MID_RECT_LEFT: rVal <<= aVal.getX(); break; + case MID_RECT_RIGHT: rVal <<= aVal.getY(); break; + case MID_WIDTH: rVal <<= aVal.getWidth(); break; + case MID_HEIGHT: rVal <<= aVal.getHeight(); break; + default: DBG_ERROR("Wrong MemberID!"); return FALSE; + } + + return TRUE; +} + +// ----------------------------------------------------------------------- +BOOL SfxRectangleItem::PutValue( const com::sun::star::uno::Any& rVal, + BYTE nMemberId ) +{ + BOOL bRet = FALSE; + nMemberId &= ~CONVERT_TWIPS; + com::sun::star::awt::Rectangle aValue; + sal_Int32 nVal = 0; + if ( !nMemberId ) + bRet = (rVal >>= aValue); + else + bRet = (rVal >>= nVal); + + if ( bRet ) + { + switch ( nMemberId ) + { + case 0: + aVal.setX( aValue.X ); + aVal.setY( aValue.Y ); + aVal.setWidth( aValue.Width ); + aVal.setHeight( aValue.Height ); + break; + case MID_RECT_LEFT: aVal.setX( nVal ); break; + case MID_RECT_RIGHT: aVal.setY( nVal ); break; + case MID_WIDTH: aVal.setWidth( nVal ); break; + case MID_HEIGHT: aVal.setHeight( nVal ); break; + default: DBG_ERROR("Wrong MemberID!"); return FALSE; + } + } + + return bRet; +} + + + diff --git a/svl/source/items/rngitem.cxx b/svl/source/items/rngitem.cxx new file mode 100644 index 000000000000..0c62de7229f4 --- /dev/null +++ b/svl/source/items/rngitem.cxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: rngitem.cxx,v $ + * $Revision: 1.12 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include + +#ifndef NUMTYPE + +#define NUMTYPE USHORT +#define SfxXRangeItem SfxRangeItem +#define SfxXRangesItem SfxUShortRangesItem +#include +#include "rngitem_inc.cxx" + +#define NUMTYPE sal_uInt32 +#define SfxXRangeItem SfxULongRangeItem +#define SfxXRangesItem SfxULongRangesItem +#include +#include "rngitem_inc.cxx" + +#else + +// We leave this condition just in case NUMTYPE has been defined externally to this +// file and we are supposed to define the SfxXRangeItem based on that. + +#include "rngitem_inc.cxx" + +#endif + diff --git a/svl/source/items/rngitem_inc.cxx b/svl/source/items/rngitem_inc.cxx new file mode 100755 index 000000000000..d8cc7ed185ae --- /dev/null +++ b/svl/source/items/rngitem_inc.cxx @@ -0,0 +1,243 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: rngitem_inc.cxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// This snippet of code is included by rngitem.cxx but not compiled directly. +// Ugly hack, probably due to lack of templates in the 20th century. + +static inline NUMTYPE Count_Impl(const NUMTYPE * pRanges) +{ + NUMTYPE nCount = 0; + for (; *pRanges; pRanges += 2) nCount += 2; + return nCount; +} + +// ----------------------------------------------------------------------- + +TYPEINIT1_AUTOFACTORY(SfxXRangeItem, SfxPoolItem); +TYPEINIT1_AUTOFACTORY(SfxXRangesItem, SfxPoolItem); + +NUMTYPE Count_Impl( const NUMTYPE *pRanges ); + +// ----------------------------------------------------------------------- + +SfxXRangeItem::SfxXRangeItem() +{ + nFrom = 0; + nTo = 0; +} + +// ----------------------------------------------------------------------- + +SfxXRangeItem::SfxXRangeItem( USHORT which, NUMTYPE from, NUMTYPE to ): + SfxPoolItem( which ), + nFrom( from ), + nTo( to ) +{ +} + + +// ----------------------------------------------------------------------- + +SfxXRangeItem::SfxXRangeItem( USHORT nW, SvStream &rStream ) : + SfxPoolItem( nW ) +{ + rStream >> nFrom; + rStream >> nTo; +} + +// ----------------------------------------------------------------------- + +SfxXRangeItem::SfxXRangeItem( const SfxXRangeItem& rItem ) : + SfxPoolItem( rItem ) +{ + nFrom = rItem.nFrom; + nTo = rItem.nTo; +} + +// ----------------------------------------------------------------------- + +SfxItemPresentation SfxXRangeItem::GetPresentation +( + SfxItemPresentation /*ePresentation*/, + SfxMapUnit /*eCoreMetric*/, + SfxMapUnit /*ePresentationMetric*/, + XubString& rText, + const IntlWrapper * +) const +{ + rText = UniString::CreateFromInt64(nFrom); + rText += ':'; + rText += UniString::CreateFromInt64(nTo); + return SFX_ITEM_PRESENTATION_NAMELESS; +} + +// ----------------------------------------------------------------------- + +int SfxXRangeItem::operator==( const SfxPoolItem& rItem ) const +{ + DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); + SfxXRangeItem* pT = (SfxXRangeItem*)&rItem; + if( nFrom==pT->nFrom && nTo==pT->nTo ) + return 1; + return 0; +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxXRangeItem::Clone(SfxItemPool *) const +{ + return new SfxXRangeItem( Which(), nFrom, nTo ); +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxXRangeItem::Create(SvStream &rStream, USHORT) const +{ + NUMTYPE nVon, nBis; + rStream >> nVon; + rStream >> nBis; + return new SfxXRangeItem( Which(), nVon, nBis ); +} + +// ----------------------------------------------------------------------- + +SvStream& SfxXRangeItem::Store(SvStream &rStream, USHORT) const +{ + rStream << nFrom; + rStream << nTo; + return rStream; +} + +//========================================================================= + +SfxXRangesItem::SfxXRangesItem() +: _pRanges(0) +{ +} + +//------------------------------------------------------------------------- + +SfxXRangesItem::SfxXRangesItem( USHORT nWID, const NUMTYPE *pRanges ) +: SfxPoolItem( nWID ) +{ + NUMTYPE nCount = Count_Impl(pRanges) + 1; + _pRanges = new NUMTYPE[nCount]; + memcpy( _pRanges, pRanges, sizeof(NUMTYPE) * nCount ); +} + +//------------------------------------------------------------------------- + +SfxXRangesItem::SfxXRangesItem( USHORT nWID, SvStream &rStream ) +: SfxPoolItem( nWID ) +{ + NUMTYPE nCount; + rStream >> nCount; + _pRanges = new NUMTYPE[nCount + 1]; + for ( NUMTYPE n = 0; n < nCount; ++n ) + rStream >> _pRanges[n]; + _pRanges[nCount] = 0; +} + +//------------------------------------------------------------------------- + +SfxXRangesItem::SfxXRangesItem( const SfxXRangesItem& rItem ) +: SfxPoolItem( rItem ) +{ + NUMTYPE nCount = Count_Impl(rItem._pRanges) + 1; + _pRanges = new NUMTYPE[nCount]; + memcpy( _pRanges, rItem._pRanges, sizeof(NUMTYPE) * nCount ); +} + +//------------------------------------------------------------------------- + +SfxXRangesItem::~SfxXRangesItem() +{ + delete _pRanges; +} + +//------------------------------------------------------------------------- + +int SfxXRangesItem::operator==( const SfxPoolItem &rItem ) const +{ + const SfxXRangesItem &rOther = (const SfxXRangesItem&) rItem; + if ( !_pRanges && !rOther._pRanges ) + return TRUE; + if ( _pRanges || rOther._pRanges ) + return FALSE; + + NUMTYPE n; + for ( n = 0; _pRanges[n] && rOther._pRanges[n]; ++n ) + if ( *_pRanges != rOther._pRanges[n] ) + return 0; + + return !_pRanges[n] && !rOther._pRanges[n]; +} + +//------------------------------------------------------------------------- + +SfxItemPresentation SfxXRangesItem::GetPresentation( SfxItemPresentation /*ePres*/, + SfxMapUnit /*eCoreMetric*/, + SfxMapUnit /*ePresMetric*/, + XubString &/*rText*/, + const IntlWrapper * ) const +{ + HACK(n. i.) + return SFX_ITEM_PRESENTATION_NONE; +} + +//------------------------------------------------------------------------- + +SfxPoolItem* SfxXRangesItem::Clone( SfxItemPool * ) const +{ + return new SfxXRangesItem( *this ); +} + +//------------------------------------------------------------------------- + +SfxPoolItem* SfxXRangesItem::Create( SvStream &rStream, USHORT ) const +{ + return new SfxXRangesItem( Which(), rStream ); +} + +//------------------------------------------------------------------------- + +SvStream& SfxXRangesItem::Store( SvStream &rStream, USHORT ) const +{ + NUMTYPE nCount = Count_Impl( _pRanges ); + rStream >> nCount; + for ( NUMTYPE n = 0; _pRanges[n]; ++n ) + rStream >> _pRanges[n]; + return rStream; +} + + +#undef NUMTYPE +#undef SfxXRangeItem +#undef SfxXRangesItem diff --git a/svl/source/items/sfontitm.cxx b/svl/source/items/sfontitm.cxx new file mode 100644 index 000000000000..ee7119c95e1c --- /dev/null +++ b/svl/source/items/sfontitm.cxx @@ -0,0 +1,142 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: sfontitm.cxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include +#include +#include + +//============================================================================ +// +// class SfxFontItem +// +//============================================================================ + +TYPEINIT1(SfxFontItem, SfxPoolItem); + +//============================================================================ +// virtual +int SfxFontItem::operator ==(const SfxPoolItem & rItem) const +{ + const SfxFontItem * pFontItem = PTR_CAST(SfxFontItem, &rItem); + return pFontItem && m_bHasFont == pFontItem->m_bHasFont + && m_bHasColor == pFontItem->m_bHasColor + && m_bHasFillColor == pFontItem->m_bHasFillColor + && (!m_bHasColor || m_aColor == pFontItem->m_aColor) + && (!m_bHasFillColor || m_aFillColor == pFontItem->m_aFillColor) + && (!m_bHasFont || (m_bKerning == pFontItem->m_bKerning + && m_bShadow == pFontItem->m_bShadow + && m_bOutline == pFontItem->m_bOutline + && m_bWordLine == pFontItem->m_bWordLine + && m_nOrientation == pFontItem->m_nOrientation + && m_nStrikeout == pFontItem->m_nStrikeout + && m_nUnderline == pFontItem->m_nUnderline + && m_nItalic == pFontItem->m_nItalic + && m_nWidthType == pFontItem->m_nWidthType + && m_nWeight == pFontItem->m_nWeight + && m_nPitch == pFontItem->m_nPitch + && m_nFamily == pFontItem->m_nFamily + && m_nLanguage == pFontItem->m_nLanguage + && m_nCharSet == pFontItem->m_nCharSet + && m_aFillColor == pFontItem->m_aFillColor + && m_aColor == pFontItem->m_aColor + && m_aSize == pFontItem->m_aSize + && m_aStyleName == pFontItem->m_aStyleName + && m_aName == pFontItem->m_aName)); +} + +//============================================================================ +// virtual +SfxPoolItem * SfxFontItem::Create(SvStream & rStream, USHORT) const +{ + VersionCompat aItemCompat(rStream, STREAM_READ); + SfxFontItem * pItem = new SfxFontItem(Which()); + { + VersionCompat aFontCompat(rStream, STREAM_READ); + readByteString(rStream, pItem->m_aName); + readByteString(rStream, pItem->m_aStyleName); + rStream >> pItem->m_aSize; + sal_Int16 nCharSet = 0; + rStream >> nCharSet; + pItem->m_nCharSet = rtl_TextEncoding(nCharSet); + rStream >> pItem->m_nFamily >> pItem->m_nPitch >> pItem->m_nWeight + >> pItem->m_nUnderline >> pItem->m_nStrikeout + >> pItem->m_nItalic; + sal_Int16 nLanguage = 0; + rStream >> nLanguage; + pItem->m_nLanguage = LanguageType(nLanguage); + rStream >> pItem->m_nWidthType >> pItem->m_nOrientation; + sal_Int8 nWordLine = 0; + rStream >> nWordLine; + pItem->m_bWordLine = nWordLine != 0; + sal_Int8 nOutline = 0; + rStream >> nOutline; + pItem->m_bOutline = nOutline != 0; + sal_Int8 nShadow = 0; + rStream >> nShadow; + pItem->m_bShadow = nShadow != 0; + sal_Int8 nKerning = 0; + rStream >> nKerning; + pItem->m_bKerning = nKerning != 0; + } + pItem->m_aColor.Read(rStream, TRUE); + pItem->m_aFillColor.Read(rStream, TRUE); + sal_Int16 nFlags = 0; + rStream >> nFlags; + pItem->m_bHasFont = (nFlags & 4) != 0; + pItem->m_bHasColor = (nFlags & 1) != 0; + pItem->m_bHasFillColor = (nFlags & 2) != 0; + return pItem; +} + +//============================================================================ +// virtual +SvStream & SfxFontItem::Store(SvStream & rStream, USHORT) const +{ + VersionCompat aItemCompat(rStream, STREAM_WRITE, 1); + { + VersionCompat aFontCompat(rStream, STREAM_WRITE, 1); + writeByteString(rStream, m_aName); + writeByteString(rStream, m_aStyleName); + rStream << m_aSize << sal_Int16(m_nCharSet) + << m_nFamily << m_nPitch << m_nWeight << m_nUnderline + << m_nStrikeout << m_nItalic << sal_Int16(m_nLanguage) + << m_nWidthType << m_nOrientation << sal_Int8(m_bWordLine) + << sal_Int8(m_bOutline) << sal_Int8(m_bShadow) + << sal_Int8(m_bKerning); + } + SAL_CONST_CAST(Color &, m_aColor).Write(rStream, TRUE); + SAL_CONST_CAST(Color &, m_aFillColor).Write(rStream, TRUE); + rStream << sal_Int16(m_bHasFont << 2 | m_bHasColor + | m_bHasFillColor << 1); + return rStream; +} + diff --git a/svl/source/items/sitem.cxx b/svl/source/items/sitem.cxx new file mode 100644 index 000000000000..2a917e93bb79 --- /dev/null +++ b/svl/source/items/sitem.cxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: sitem.cxx,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +// INCLUDE --------------------------------------------------------------- + +#ifndef GCC +#endif + +#include +#include + +#include +#include + + +// STATIC DATA ----------------------------------------------------------- + +DBG_NAME(SfxSetItem) + +// -------------------------------------------------------------------------- + +SfxSetItem::SfxSetItem( USHORT which, const SfxItemSet &rSet) : + SfxPoolItem(which), + pSet(rSet.Clone(TRUE)) +{ + DBG_CTOR(SfxSetItem, 0); +} + +// -------------------------------------------------------------------------- + +SfxSetItem::SfxSetItem( USHORT which, SfxItemSet *pS) : + SfxPoolItem(which), + pSet(pS) +{ + DBG_CTOR(SfxSetItem, 0); + DBG_ASSERT(pS, "SfxSetItem without set constructed" ); +} + +// -------------------------------------------------------------------------- + +SfxSetItem::SfxSetItem( const SfxSetItem& rCopy, SfxItemPool *pPool ) : + SfxPoolItem(rCopy.Which()), + pSet(rCopy.pSet->Clone(TRUE, pPool)) +{ + DBG_CTOR(SfxSetItem, 0); +} + +// -------------------------------------------------------------------------- + +SfxSetItem::~SfxSetItem() +{ + DBG_DTOR(SfxSetItem, 0); + delete pSet; pSet = 0; +} + +// -------------------------------------------------------------------------- + +int SfxSetItem::operator==( const SfxPoolItem& rCmp) const +{ + DBG_CHKTHIS(SfxSetItem, 0); + DBG_ASSERT( SfxPoolItem::operator==( rCmp ), "unequal type" ); + return *pSet == *(((const SfxSetItem &)rCmp).pSet); +} + +// -------------------------------------------------------------------------- + +SfxItemPresentation SfxSetItem::GetPresentation +( + SfxItemPresentation /*ePresentation*/, + SfxMapUnit /*eCoreMetric*/, + SfxMapUnit /*ePresentationMetric*/, + XubString& /*rText*/, + const IntlWrapper * +) const +{ + DBG_CHKTHIS(SfxSetItem, 0); + return SFX_ITEM_PRESENTATION_NONE; +} + +// -------------------------------------------------------------------------- + +SvStream& SfxSetItem::Store(SvStream& rStream, USHORT) const +{ + GetItemSet().Store(rStream); + return rStream; +} + diff --git a/svl/source/items/slstitm.cxx b/svl/source/items/slstitm.cxx new file mode 100644 index 000000000000..87163d41e033 --- /dev/null +++ b/svl/source/items/slstitm.cxx @@ -0,0 +1,425 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: slstitm.cxx,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include +#include +#include +#include +#include + +// STATIC DATA ----------------------------------------------------------- + +DBG_NAME(SfxStringListItem) + +// ----------------------------------------------------------------------- + +TYPEINIT1_AUTOFACTORY(SfxStringListItem, SfxPoolItem); + +class SfxImpStringList +{ +public: + USHORT nRefCount; + List aList; + + SfxImpStringList() { nRefCount = 1; } + ~SfxImpStringList(); + void Sort( BOOL bAscending, List* ); +}; + +//------------------------------------------------------------------------ + +SfxImpStringList::~SfxImpStringList() +{ + DBG_ASSERT(nRefCount!=0xffff,"ImpList already deleted"); + String* pStr = (String*)aList.First(); + while( pStr ) + { + delete pStr; + pStr = (String*)aList.Next(); + } + nRefCount = 0xffff; +} + +//------------------------------------------------------------------------ + +void SfxImpStringList::Sort( BOOL bAscending, List* pParallelList ) +{ + DBG_ASSERT(!pParallelList || pParallelList->Count() >= aList.Count(),"Sort:ParallelList too small"); + ULONG nCount = aList.Count(); + if( nCount > 1 ) + { + nCount -= 2; + // Bubble Dir Einen + BOOL bSwapped = TRUE; + while( bSwapped ) + { + bSwapped = FALSE; + for( ULONG nCur = 0; nCur <= nCount; nCur++ ) + { + String* pStr1 = (String*)aList.GetObject( nCur ); + String* pStr2 = (String*)aList.GetObject( nCur+1 ); + // COMPARE_GREATER => pStr2 ist groesser als pStr1 + StringCompare eCompare = pStr1->CompareIgnoreCaseToAscii( *pStr2 ); //@@@ + BOOL bSwap = FALSE; + if( bAscending ) + { + if( eCompare == COMPARE_LESS ) + bSwap = TRUE; + } + else if( eCompare == COMPARE_GREATER ) + bSwap = TRUE; + + if( bSwap ) + { + bSwapped = TRUE; + aList.Replace( pStr1, nCur + 1 ); + aList.Replace( pStr2, nCur ); + if( pParallelList ) + { + void* p1 = pParallelList->GetObject( nCur ); + void* p2 = pParallelList->GetObject( nCur + 1 ); + pParallelList->Replace( p1, nCur + 1 ); + pParallelList->Replace( p2, nCur ); + } + } + } + } + } +} + +// class SfxStringListItem ----------------------------------------------- + +SfxStringListItem::SfxStringListItem() : + pImp(NULL) +{ +} + +//------------------------------------------------------------------------ + +SfxStringListItem::SfxStringListItem( USHORT which, const List* pList ) : + SfxPoolItem( which ), + pImp(NULL) +{ + // PB: das Putten einer leeren Liste funktionierte nicht, + // deshalb habe ich hier die Abfrage nach dem Count auskommentiert + if( pList /*!!! && pList->Count() */ ) + { + pImp = new SfxImpStringList; + + long i, nCount = pList->Count(); + String *pStr1, *pStr2; + for( i=0; i < nCount; i++ ) + { + pStr1 = (String*)pList->GetObject(i); + pStr2 = new String( *pStr1 ); + pImp->aList.Insert( pStr2, LIST_APPEND ); + } + } +} + +//------------------------------------------------------------------------ + +SfxStringListItem::SfxStringListItem( USHORT which, SvStream& rStream ) : + SfxPoolItem( which ), + pImp(NULL) +{ + long nEntryCount; + rStream >> nEntryCount; + + if( nEntryCount ) + pImp = new SfxImpStringList; + + long i; + String* pStr; + for( i=0; i < nEntryCount; i++ ) + { + pStr = new String; + readByteString(rStream, *pStr); + pImp->aList.Insert( pStr, LIST_APPEND ); + } +} + +//------------------------------------------------------------------------ + +SfxStringListItem::SfxStringListItem( const SfxStringListItem& rItem ) : + SfxPoolItem( rItem ), + pImp(NULL) +{ + pImp = rItem.pImp; + + if( pImp ) + { + DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid"); + pImp->nRefCount++; + } +} + +//------------------------------------------------------------------------ + +SfxStringListItem::~SfxStringListItem() +{ + if( pImp ) + { + DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid"); + if( pImp->nRefCount > 1 ) + pImp->nRefCount--; + else + delete pImp; + } +} + +//------------------------------------------------------------------------ + +List* SfxStringListItem::GetList() +{ + if( !pImp ) + pImp = new SfxImpStringList; + DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid"); + return &(pImp->aList); +} + +//------------------------------------------------------------------------ + +int SfxStringListItem::operator==( const SfxPoolItem& rItem ) const +{ + DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); + + SfxStringListItem* pItem = (SfxStringListItem*)&rItem; + + if( pImp == pItem->pImp ) + return TRUE; + else + return FALSE; +} + +//------------------------------------------------------------------------ + +SfxItemPresentation SfxStringListItem::GetPresentation +( + SfxItemPresentation /*ePresentation*/, + SfxMapUnit /*eCoreMetric*/, + SfxMapUnit /*ePresentationMetric*/, + XubString& rText, + const IntlWrapper * +) const +{ + rText.AssignAscii(RTL_CONSTASCII_STRINGPARAM("(List)")); + return SFX_ITEM_PRESENTATION_NONE; +} + +//------------------------------------------------------------------------ + +SfxPoolItem* SfxStringListItem::Clone( SfxItemPool *) const +{ + return new SfxStringListItem( *this ); + /* + if( pImp ) + return new SfxStringListItem( Which(), &(pImp->aList) ); + else + return new SfxStringListItem( Which(), NULL ); + */ + +} + +//------------------------------------------------------------------------ + +SfxPoolItem* SfxStringListItem::Create( SvStream & rStream, USHORT ) const +{ + return new SfxStringListItem( Which(), rStream ); +} + +//------------------------------------------------------------------------ + +SvStream& SfxStringListItem::Store( SvStream & rStream, USHORT ) const +{ + if( !pImp ) + { + rStream << 0L; + return rStream; + } + + DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid"); + + long nCount = pImp->aList.Count(); + rStream << nCount; + + long i; + String* pStr; + for( i=0; i < nCount; i++ ) + { + pStr = (String*)(pImp->aList.GetObject( i )); + writeByteString(rStream, *pStr); + } + + return rStream; +} + +//------------------------------------------------------------------------ + +void SfxStringListItem::SetString( const XubString& rStr ) +{ + DBG_ASSERT(GetRefCount()==0,"SetString:RefCount!=0"); + + if ( pImp && (pImp->nRefCount == 1) ) + delete pImp; + else + if( pImp ) + pImp->nRefCount--; + pImp = new SfxImpStringList; + + xub_StrLen nStart = 0; + xub_StrLen nDelimPos; + XubString aStr(rStr); + aStr.ConvertLineEnd(LINEEND_CR); + do + { + nDelimPos = aStr.Search( _CR, nStart ); + xub_StrLen nLen; + if ( nDelimPos == STRING_NOTFOUND ) + nLen = 0xffff; + else + nLen = nDelimPos - nStart; + + XubString* pStr = new XubString(aStr.Copy(nStart, nLen)); + // String gehoert der Liste + pImp->aList.Insert( pStr, LIST_APPEND ); + + nStart += nLen + 1 ; // delimiter ueberspringen + } while( nDelimPos != STRING_NOTFOUND ); + + // Kein Leerstring am Ende + if( pImp->aList.Last() && + !((XubString*)pImp->aList.Last())->Len() ) + delete (XubString*)pImp->aList.Remove( pImp->aList.Count()-1 ); +} + +//------------------------------------------------------------------------ + +XubString SfxStringListItem::GetString() +{ + XubString aStr; + if ( pImp ) + { + DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid"); + XubString* pStr = (XubString*)(pImp->aList.First()); + while( pStr ) + { + aStr += *pStr; + pStr = (XubString*)(pImp->aList.Next()); + if ( pStr ) + aStr += '\r'; + } + } + aStr.ConvertLineEnd(); + return aStr; +} + +//------------------------------------------------------------------------ + +#ifndef TF_POOLABLE + +int SfxStringListItem::IsPoolable() const +{ + return FALSE; +} + +#endif + +//------------------------------------------------------------------------ + +void SfxStringListItem::Sort( BOOL bAscending, List* pParallelList ) +{ + DBG_ASSERT(GetRefCount()==0,"Sort:RefCount!=0"); + if( pImp ) + pImp->Sort( bAscending, pParallelList ); +} + +//---------------------------------------------------------------------------- +void SfxStringListItem::SetStringList( const com::sun::star::uno::Sequence< rtl::OUString >& rList ) +{ + DBG_ASSERT(GetRefCount()==0,"SetString:RefCount!=0"); + + if ( pImp && (pImp->nRefCount == 1) ) + delete pImp; + else + if( pImp ) + pImp->nRefCount--; + pImp = new SfxImpStringList; + + for ( sal_Int32 n = 0; n < rList.getLength(); n++ ) + { + XubString* pStr = new XubString( rList[n] ); + // String gehoert der Liste + pImp->aList.Insert( pStr, LIST_APPEND ); + } +} + +//---------------------------------------------------------------------------- +void SfxStringListItem::GetStringList( com::sun::star::uno::Sequence< rtl::OUString >& rList ) const +{ + long nCount = pImp->aList.Count(); + + rList.realloc( nCount ); + for( long i=0; i < nCount; i++ ) + rList[i] = *(String*)(pImp->aList.GetObject( i )); +} + +//---------------------------------------------------------------------------- +// virtual +BOOL SfxStringListItem::PutValue( const com::sun::star::uno::Any& rVal,BYTE ) +{ + com::sun::star::uno::Sequence< rtl::OUString > aValue; + if ( rVal >>= aValue ) + { + SetStringList( aValue ); + return TRUE; + } + + DBG_ERROR( "SfxStringListItem::PutValue - Wrong type!" ); + return FALSE; +} + +//---------------------------------------------------------------------------- +// virtual +BOOL SfxStringListItem::QueryValue( com::sun::star::uno::Any& rVal,BYTE ) const +{ + // GetString() is not const!!! + SfxStringListItem* pThis = const_cast< SfxStringListItem * >( this ); + + com::sun::star::uno::Sequence< rtl::OUString > aStringList; + pThis->GetStringList( aStringList ); + rVal = ::com::sun::star::uno::makeAny( aStringList ); + return TRUE; +} + + diff --git a/svl/source/items/stritem.cxx b/svl/source/items/stritem.cxx new file mode 100644 index 000000000000..37968dc3ee1d --- /dev/null +++ b/svl/source/items/stritem.cxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: stritem.cxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include + +//============================================================================ +// +// class SfxStringItem +// +//============================================================================ + +TYPEINIT1_AUTOFACTORY(SfxStringItem, CntUnencodedStringItem) + +//============================================================================ +// virtual +SfxStringItem::SfxStringItem(USHORT which, SvStream & rStream): + CntUnencodedStringItem(which) +{ + UniString aValue; + readByteString(rStream, aValue); + SetValue(aValue); +} + + +//============================================================================ +// virtual +SfxPoolItem * SfxStringItem::Create(SvStream & rStream, USHORT) const +{ + return new SfxStringItem(Which(), rStream); +} + +//============================================================================ +// virtual +SvStream & SfxStringItem::Store(SvStream & rStream, USHORT) const +{ + writeByteString(rStream, GetValue()); + return rStream; +} + +//============================================================================ +// virtual +SfxPoolItem * SfxStringItem::Clone(SfxItemPool *) const +{ + return new SfxStringItem(*this); +} + diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx new file mode 100644 index 000000000000..ad11f1527ce7 --- /dev/null +++ b/svl/source/items/style.cxx @@ -0,0 +1,1381 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: style.cxx,v $ + * $Revision: 1.19.60.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#ifndef GCC +#endif + +#define _SVSTDARR_STRINGS +#define _SVSTDARR_STRINGSSORTDTOR +#define _SVSTDARR_BYTESTRINGS +#define _SVSTDARR_BYTESTRINGSSORTDTOR + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define STYLESTREAM "SfxStyleSheets" +#define STYLESTREAM_VERSION USHORT(50) + +#ifdef DBG_UTIL +class DbgStyleSheetReferences +{ +public: + DbgStyleSheetReferences() : mnStyles(0), mnPools(0) {} + ~DbgStyleSheetReferences() + { + OSL_TRACE("DbgStyleSheetReferences\nSfxStyleSheetBase left %ld\nSfxStyleSheetBasePool left %ld\n", mnStyles, mnPools ); + } + + sal_uInt32 mnStyles; + sal_uInt32 mnPools; +} +aDbgStyleSheetReferences; + +#endif + +TYPEINIT0(SfxStyleSheetBase) + +TYPEINIT3(SfxStyleSheet, SfxStyleSheetBase, SfxListener, SfxBroadcaster) + + +//========================================================================= + +TYPEINIT1(SfxStyleSheetHint, SfxHint); +TYPEINIT1(SfxStyleSheetHintExtended, SfxStyleSheetHint); +TYPEINIT1(SfxStyleSheetPoolHint, SfxHint); + +SfxStyleSheetHintExtended::SfxStyleSheetHintExtended +( + USHORT nAction, // SFX_STYLESHEET_... (s.o.) + const String& rOldName +) +: SfxStyleSheetHint( nAction ), + aName( rOldName ) +{} +SfxStyleSheetHintExtended::SfxStyleSheetHintExtended +( + USHORT nAction, // SFX_STYLESHEET_... (s.o.) + const String& rOldName, + SfxStyleSheetBase& rStyleSheet // geh"ort weiterhin dem Aufrufer +) +: SfxStyleSheetHint( nAction, rStyleSheet ), + aName( rOldName ) +{} + +//------------------------------------------------------------------------- + +SfxStyleSheetHint::SfxStyleSheetHint +( + USHORT nAction, // SFX_STYLESHEET_... (s.o.) + SfxStyleSheetBase& rStyleSheet // geh"ort weiterhin dem Aufrufer +) +: pStyleSh( &rStyleSheet ), + nHint( nAction ) +{} + +SfxStyleSheetHint::SfxStyleSheetHint +( + USHORT nAction // SFX_STYLESHEET_... (s.o.) +) +: pStyleSh( NULL ), + nHint( nAction ) +{} + +//========================================================================= + +class SfxStyleSheetBasePool_Impl +{ + public: + SfxStyles aStyles; + SfxStyleSheetIterator *pIter; + SfxStyleSheetBasePool_Impl() : pIter(0){} + ~SfxStyleSheetBasePool_Impl(){delete pIter;} +}; + + +//////////////////////////// SfxStyleSheetBase /////////////////////////////// + +// Konstruktoren + +SfxStyleSheetBase::SfxStyleSheetBase( const XubString& rName, SfxStyleSheetBasePool& r, SfxStyleFamily eFam, USHORT mask ) + : rPool( r ) + , nFamily( eFam ) + , aName( rName ) + , aParent() + , aFollow( rName ) + , pSet( NULL ) + , nMask(mask) + , nHelpId( 0 ) + , bMySet( FALSE ) +{ +#ifdef DBG_UTIL + aDbgStyleSheetReferences.mnStyles++; +#endif +} + +SfxStyleSheetBase::SfxStyleSheetBase( const SfxStyleSheetBase& r ) + : comphelper::OWeakTypeObject() + , rPool( r.rPool ) + , nFamily( r.nFamily ) + , aName( r.aName ) + , aParent( r.aParent ) + , aFollow( r.aFollow ) + , aHelpFile( r.aHelpFile ) + , nMask( r.nMask ) + , nHelpId( r.nHelpId ) + , bMySet( r.bMySet ) +{ +#ifdef DBG_UTIL + aDbgStyleSheetReferences.mnStyles++; +#endif + if( r.pSet ) + pSet = bMySet ? new SfxItemSet( *r.pSet ) : r.pSet; + else + pSet = NULL; +} + +static SfxStyleSheetBasePool& implGetStaticPool() +{ + static SfxStyleSheetBasePool* pSheetPool = 0; + static SfxItemPool* pBasePool = 0; + if( !pSheetPool ) + { + UniString aName; + pBasePool = new SfxItemPool( aName, 0, 0, 0 ); + pSheetPool = new SfxStyleSheetBasePool(*pBasePool); + } + return *pSheetPool; +} + +SfxStyleSheetBase::SfxStyleSheetBase() +: comphelper::OWeakTypeObject() +, rPool( implGetStaticPool() ) +{ +} + +SfxStyleSheetBase::~SfxStyleSheetBase() +{ +#ifdef DBG_UTIL + --aDbgStyleSheetReferences.mnStyles; +#endif + + if( bMySet ) + { + delete pSet; + pSet = 0; + } +} + +USHORT SfxStyleSheetBase::GetVersion() const +{ + return 0x0000; +} + +// Namen aendern + +const XubString& SfxStyleSheetBase::GetName() const +{ + return aName; +} + +BOOL SfxStyleSheetBase::SetName( const XubString& rName ) +{ + if(rName.Len() == 0) + return FALSE; + if( aName != rName ) + { + String aOldName = aName; + SfxStyleSheetBase *pOther = rPool.Find( rName, nFamily ) ; + if ( pOther && pOther != this ) + return FALSE; + + SfxStyleFamily eTmpFam=rPool.GetSearchFamily(); + USHORT nTmpMask=rPool.GetSearchMask(); + + rPool.SetSearchMask(nFamily); + + if ( aName.Len() ) + rPool.ChangeParent( aName, rName, FALSE ); + if ( aFollow.Equals( aName ) ) + aFollow = rName; + aName = rName; + rPool.SetSearchMask(eTmpFam, nTmpMask); + rPool.Broadcast( SfxStyleSheetHintExtended( + SFX_STYLESHEET_MODIFIED, aOldName, *this ) ); + } + return TRUE; +} + +rtl::OUString SfxStyleSheetBase::GetDisplayName() const +{ + if( maDisplayName.getLength() == 0 ) + { + return aName; + } + else + { + return maDisplayName; + } +} + +void SfxStyleSheetBase::SetDisplayName( const rtl::OUString& rDisplayName ) +{ + maDisplayName = rDisplayName; +} + +// Parent aendern + +const XubString& SfxStyleSheetBase::GetParent() const +{ + return aParent; +} + +BOOL SfxStyleSheetBase::SetParent( const XubString& rName ) +{ + if ( rName == aName ) + return FALSE; + + if( aParent != rName ) + { + SfxStyleSheetBase* pIter = rPool.Find(rName, nFamily); + if( rName.Len() && !pIter ) + { + DBG_ERROR( "StyleSheet-Parent nicht gefunden" ); + return FALSE; + } + // rekursive Verknuepfungen verhindern + if( aName.Len() ) + while(pIter) + { + if(pIter->GetName() == aName && aName != rName) + return FALSE; + pIter = rPool.Find(pIter->GetParent(), nFamily); + } + aParent = rName; + } + rPool.Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED, *this ) ); + return TRUE; +} + +// Follow aendern + +const XubString& SfxStyleSheetBase::GetFollow() const +{ + return aFollow; +} + +BOOL SfxStyleSheetBase::SetFollow( const XubString& rName ) +{ + if( aFollow != rName ) + { + if( !rPool.Find( rName, nFamily ) ) + { + DBG_ERROR( "StyleSheet-Follow nicht gefunden" ); + return FALSE; + } + aFollow = rName; + } + rPool.Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED, *this ) ); + return TRUE; +} + +// Itemset setzen. Die Dflt-Implementation legt ein neues Set an. + +SfxItemSet& SfxStyleSheetBase::GetItemSet() +{ + if( !pSet ) + { + pSet = new SfxItemSet( rPool.GetPool() ); + bMySet = TRUE; + } + return *pSet; +} + +// Hilfe-Datei und -ID setzen und abfragen + +ULONG SfxStyleSheetBase::GetHelpId( String& rFile ) +{ + rFile = aHelpFile; + return nHelpId; +} + +void SfxStyleSheetBase::SetHelpId( const String& rFile, ULONG nId ) +{ + aHelpFile = rFile; + nHelpId = nId; +} + +// Folgevorlage m"oglich? Default: Ja + +BOOL SfxStyleSheetBase::HasFollowSupport() const +{ + return TRUE; +} + +// Basisvorlage m"oglich? Default: Ja + +BOOL SfxStyleSheetBase::HasParentSupport() const +{ + return TRUE; +} + +// Basisvorlage uf NULL setzen m"oglich? Default: Nein + +BOOL SfxStyleSheetBase::HasClearParentSupport() const +{ + return FALSE; +} + +// Defaultmaessig sind alle StyleSheets Used + +BOOL SfxStyleSheetBase::IsUsed() const +{ + return TRUE; +} + +// eingestellte Attribute ausgeben + + +XubString SfxStyleSheetBase::GetDescription() +{ + return GetDescription( SFX_MAPUNIT_CM ); +} + +// eingestellte Attribute ausgeben + +XubString SfxStyleSheetBase::GetDescription( SfxMapUnit eMetric ) +{ + SfxItemIter aIter( GetItemSet() ); + XubString aDesc; + const SfxPoolItem* pItem = aIter.FirstItem(); + + IntlWrapper aIntlWrapper(comphelper::getProcessServiceFactory(), + Application::GetSettings().GetLanguage()); + while ( pItem ) + { + XubString aItemPresentation; + + if ( !IsInvalidItem( pItem ) && + rPool.GetPool().GetPresentation( + *pItem, SFX_ITEM_PRESENTATION_COMPLETE, + eMetric, aItemPresentation, &aIntlWrapper ) ) + { + if ( aDesc.Len() && aItemPresentation.Len() ) + aDesc.AppendAscii(RTL_CONSTASCII_STRINGPARAM(" + ")); + if ( aItemPresentation.Len() ) + aDesc += aItemPresentation; + } + pItem = aIter.NextItem(); + } + return aDesc; +} + +/////////////////////////// SfxStyleSheetIterator /////////////////////////////// + +SfxStyleFamily SfxStyleSheetIterator::GetSearchFamily() const +{ + return nSearchFamily; +} + +inline BOOL SfxStyleSheetIterator::IsTrivialSearch() +{ + return nMask == 0xFFFF && GetSearchFamily() == SFX_STYLE_FAMILY_ALL; +} + +BOOL SfxStyleSheetIterator::DoesStyleMatch(SfxStyleSheetBase *pStyle) +{ + return ((GetSearchFamily() == SFX_STYLE_FAMILY_ALL) || + ( pStyle->GetFamily() == GetSearchFamily() )) + && (( pStyle->GetMask() & ( GetSearchMask() & ~SFXSTYLEBIT_USED )) || + ( bSearchUsed ? pStyle->IsUsed() : FALSE ) || + GetSearchMask() == SFXSTYLEBIT_ALL ); +} + + +SfxStyleSheetIterator::SfxStyleSheetIterator(SfxStyleSheetBasePool *pBase, + SfxStyleFamily eFam, USHORT n) +{ + pBasePool=pBase; + nSearchFamily=eFam; + bSearchUsed=FALSE; + if((n != SFXSTYLEBIT_ALL ) && ((n & SFXSTYLEBIT_USED) == SFXSTYLEBIT_USED)) + { + bSearchUsed = TRUE; + n &= ~SFXSTYLEBIT_USED; + } + nMask=n; +} + +SfxStyleSheetIterator::~SfxStyleSheetIterator() +{ +} + + +USHORT SfxStyleSheetIterator::Count() +{ + USHORT n = 0; + if( IsTrivialSearch()) + n = (USHORT) pBasePool->aStyles.size(); + else + for(USHORT i=0; iaStyles.size(); i++) + { + SfxStyleSheetBase* pStyle = pBasePool->aStyles[i].get(); + if(DoesStyleMatch(pStyle)) + n++; + } + return n; +} + +SfxStyleSheetBase* SfxStyleSheetIterator::operator[](USHORT nIdx) +{ + if( IsTrivialSearch()) + return pBasePool->aStyles[nIdx].get(); + + USHORT z = 0; + for(USHORT n=0; naStyles.size(); n++) + { + SfxStyleSheetBase* pStyle = pBasePool->aStyles[n].get(); + if( DoesStyleMatch(pStyle)) + { + if(z == nIdx) + { + nAktPosition=n; + return pAktStyle=pStyle; + } + ++z; + } + } + DBG_ERROR("falscher Index"); + return 0; +} + +SfxStyleSheetBase* SfxStyleSheetIterator::First() +{ + INT32 nIdx = -1; + + if ( IsTrivialSearch() && pBasePool->aStyles.size() ) + nIdx = 0; + else + for( USHORT n = 0; n < pBasePool->aStyles.size(); n++ ) + { + SfxStyleSheetBase* pStyle = pBasePool->aStyles[n].get(); + + if ( DoesStyleMatch( pStyle ) ) + { + nIdx = n; + break; + } + } + + if ( nIdx != -1 ) + { + nAktPosition = (USHORT)nIdx; + return pAktStyle = pBasePool->aStyles[nIdx].get(); + } + return 0; +} + + +SfxStyleSheetBase* SfxStyleSheetIterator::Next() +{ + INT32 nIdx = -1; + + if ( IsTrivialSearch() && + (USHORT)pBasePool->aStyles.size() > nAktPosition + 1 ) + nIdx = nAktPosition + 1; + else + for( USHORT n = nAktPosition + 1; n < pBasePool->aStyles.size(); n++ ) + { + SfxStyleSheetBase* pStyle = pBasePool->aStyles[n].get(); + + if ( DoesStyleMatch( pStyle ) ) + { + nIdx = n; + break; + } + } + + if ( nIdx != -1 ) + { + nAktPosition = (USHORT)nIdx; + return pAktStyle = pBasePool->aStyles[nIdx].get(); + } + return 0; +} + + +SfxStyleSheetBase* SfxStyleSheetIterator::Find(const XubString& rStr) +{ + for ( USHORT n = 0; n < pBasePool->aStyles.size(); n++ ) + { + SfxStyleSheetBase* pStyle = pBasePool->aStyles[n].get(); + + // #98454# performance: in case of bSearchUsed==TRUE it may be + // significant to first compare the name and only if it matches to call + // the style sheet IsUsed() method in DoesStyleMatch(). + if ( pStyle->GetName().Equals( rStr ) && DoesStyleMatch( pStyle ) ) + { + nAktPosition = n; + return pAktStyle = pStyle; + } + } + return 0; +} + + +USHORT SfxStyleSheetIterator::GetSearchMask() const +{ + USHORT mask = nMask; + + if ( bSearchUsed ) + mask |= SFXSTYLEBIT_USED; + return mask; +} + +/////////////////////////// SfxStyleSheetBasePool /////////////////////////////// + +void SfxStyleSheetBasePool::Replace( + SfxStyleSheetBase& rSource, SfxStyleSheetBase& rTarget ) +{ + rTarget.SetFollow( rSource.GetFollow() ); + rTarget.SetParent( rSource.GetParent() ); + SfxItemSet& rSourceSet = rSource.GetItemSet(); + SfxItemSet& rTargetSet = rTarget.GetItemSet(); + rTargetSet.Intersect( rSourceSet ); + rTargetSet.Put( rSourceSet ); +} + +SfxStyleSheetIterator& SfxStyleSheetBasePool::GetIterator_Impl() +{ + SfxStyleSheetIterator*& rpIter = pImp->pIter; + if( !rpIter || (rpIter->GetSearchMask() != nMask) || (rpIter->GetSearchFamily() != nSearchFamily) ) + { + delete rpIter; + rpIter = CreateIterator( nSearchFamily, nMask ); + } + return *rpIter; +} + + +SfxStyleSheetBasePool::SfxStyleSheetBasePool( SfxItemPool& r ) + : aAppName(r.GetName()) + , rPool(r) + , nSearchFamily(SFX_STYLE_FAMILY_PARA) + , nMask(0xFFFF) +{ +#ifdef DBG_UTIL + aDbgStyleSheetReferences.mnPools++; +#endif + + pImp = new SfxStyleSheetBasePool_Impl; +} + +SfxStyleSheetBasePool::SfxStyleSheetBasePool( const SfxStyleSheetBasePool& r ) + : SfxBroadcaster( r ) + , comphelper::OWeakTypeObject() + , aAppName(r.aAppName) + , rPool(r.rPool) + , nSearchFamily(r.nSearchFamily) + , nMask( r.nMask ) +{ +#ifdef DBG_UTIL + aDbgStyleSheetReferences.mnPools++; +#endif + + pImp = new SfxStyleSheetBasePool_Impl; + *this += r; +} + +SfxStyleSheetBasePool::~SfxStyleSheetBasePool() +{ +#ifdef DBG_UTIL + aDbgStyleSheetReferences.mnPools--; +#endif + + Broadcast( SfxSimpleHint(SFX_HINT_DYING) ); + Clear(); + delete pImp; +} + +BOOL SfxStyleSheetBasePool::SetParent(SfxStyleFamily eFam, const XubString& rStyle, const XubString& rParent) +{ + SfxStyleSheetIterator aIter(this,eFam,SFXSTYLEBIT_ALL); + SfxStyleSheetBase *pStyle = + aIter.Find(rStyle); + DBG_ASSERT(pStyle, "Vorlage nicht gefunden. Writer mit Solar <2541??"); + if(pStyle) + return pStyle->SetParent(rParent); + else + return FALSE; +} + + +void SfxStyleSheetBasePool::SetSearchMask(SfxStyleFamily eFam, USHORT n) +{ + nSearchFamily = eFam; nMask = n; +} + +USHORT SfxStyleSheetBasePool::GetSearchMask() const +{ + return nMask; +} + + +// Der Name des Streams + +String SfxStyleSheetBasePool::GetStreamName() +{ + return String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(STYLESTREAM)); +} + +/////////////////////////////////// Factory //////////////////////////////// + + + +SfxStyleSheetIterator* SfxStyleSheetBasePool::CreateIterator +( + SfxStyleFamily eFam, + USHORT mask +) +{ + return new SfxStyleSheetIterator(this,eFam,mask); +} + + +SfxStyleSheetBase* SfxStyleSheetBasePool::Create +( + const XubString& rName, + SfxStyleFamily eFam, + USHORT mask +) +{ + return new SfxStyleSheetBase( rName, *this, eFam, mask ); +} + +SfxStyleSheetBase* SfxStyleSheetBasePool::Create( const SfxStyleSheetBase& r ) +{ + return new SfxStyleSheetBase( r ); +} + +SfxStyleSheetBase& SfxStyleSheetBasePool::Make( const XubString& rName, SfxStyleFamily eFam, USHORT mask, USHORT nPos) +{ + DBG_ASSERT( eFam != SFX_STYLE_FAMILY_ALL, "svtools::SfxStyleSheetBasePool::Make(), FamilyAll is not a allowed Familie" ); + + SfxStyleSheetIterator aIter(this, eFam, mask); + rtl::Reference< SfxStyleSheetBase > xStyle( aIter.Find( rName ) ); + DBG_ASSERT( !xStyle.is(), "svtools::SfxStyleSheetBasePool::Make(), StyleSheet already exists" ); + SfxStyleSheetIterator& rIter = GetIterator_Impl(); + + if( !xStyle.is() ) + { + xStyle = Create( rName, eFam, mask ); + if(0xffff == nPos || nPos == aStyles.size() || nPos == rIter.Count()) + { + aStyles.push_back( xStyle ); + } + else + { + rIter[nPos]; + aStyles.insert( aStyles.begin() + rIter.GetPos(), xStyle ); + } + Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *xStyle.get() ) ); + } + return *xStyle.get(); +} + +/////////////////////////////// Kopieren /////////////////////////////////// + +// Hilfsroutine: Falls eine Vorlage dieses Namens existiert, wird +// sie neu erzeugt. Alle Vorlagen, die diese Vorlage zum Parent haben, +// werden umgehaengt. + +SfxStyleSheetBase& SfxStyleSheetBasePool::Add( SfxStyleSheetBase& rSheet ) +{ + SfxStyleSheetIterator aIter(this, rSheet.GetFamily(), nMask); + SfxStyleSheetBase* pOld = aIter.Find( rSheet.GetName() ); + Remove( pOld ); + rtl::Reference< SfxStyleSheetBase > xNew( Create( rSheet ) ); + aStyles.push_back( xNew ); + Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CHANGED, *xNew.get() ) ); + return *xNew.get(); +} + +SfxStyleSheetBasePool& SfxStyleSheetBasePool::operator=( const SfxStyleSheetBasePool& r ) +{ + if( &r != this ) + { + Clear(); + *this += r; + } + return *this; +} + +SfxStyleSheetBasePool& SfxStyleSheetBasePool::operator+=( const SfxStyleSheetBasePool& r ) +{ + if( &r != this ) + { + SfxStyles::const_iterator aIter( r.aStyles.begin() ); + while( aIter != r.aStyles.end() ) + { + Add(*(*aIter++).get()); + } + } + return *this; +} + +//////////////////////////////// Suchen //////////////////////////////////// + +USHORT SfxStyleSheetBasePool::Count() +{ + return GetIterator_Impl().Count(); +} + +SfxStyleSheetBase *SfxStyleSheetBasePool::operator[](USHORT nIdx) +{ + return GetIterator_Impl()[nIdx]; +} + +SfxStyleSheetBase* SfxStyleSheetBasePool::Find(const XubString& rName, + SfxStyleFamily eFam, + USHORT mask) +{ + SfxStyleSheetIterator aIter(this,eFam,mask); + return aIter.Find(rName); +} + +const SfxStyles& SfxStyleSheetBasePool::GetStyles() +{ + return aStyles; +} + +SfxStyleSheetBase* SfxStyleSheetBasePool::First() +{ + return GetIterator_Impl().First(); +} + +SfxStyleSheetBase* SfxStyleSheetBasePool::Next() +{ + return GetIterator_Impl().Next(); +} + +//////////////////////////////// Loeschen ///////////////////////////////// + +void SfxStyleSheetBasePool::Remove( SfxStyleSheetBase* p ) +{ + if( p ) + { + SfxStyles::iterator aIter( std::find( aStyles.begin(), aStyles.end(), rtl::Reference< SfxStyleSheetBase >( p ) ) ); + if( aIter != aStyles.end() ) + { + // Alle Styles umsetzen, deren Parent dieser hier ist + ChangeParent( p->GetName(), p->GetParent() ); + aStyles.erase(aIter); + Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *p ) ); + } + } +} + +void SfxStyleSheetBasePool::Insert( SfxStyleSheetBase* p ) +{ + DBG_ASSERT( p, "svtools::SfxStyleSheetBasePool::Insert(), no stylesheet?" ); + + SfxStyleSheetIterator aIter(this, p->GetFamily(), p->GetMask()); + SfxStyleSheetBase* pOld = aIter.Find( p->GetName() ); + DBG_ASSERT( !pOld, "svtools::SfxStyleSheetBasePool::Insert(), StyleSheet already inserted" ); + if( p->GetParent().Len() ) + { + pOld = aIter.Find( p->GetParent() ); + DBG_ASSERT( pOld, "svtools::SfxStyleSheetBasePool::Insert(), Parent not found!" ); + } + aStyles.push_back( rtl::Reference< SfxStyleSheetBase >( p ) ); + Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *p ) ); +} + +void SfxStyleSheetBasePool::Clear() +{ + SfxStyles aClearStyles; + aClearStyles.swap( aStyles ); + + SfxStyles::iterator aIter( aClearStyles.begin() ); + while( aIter != aClearStyles.end() ) + { + Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *(*aIter++).get() ) ); + } +} + +/////////////////////////// Parents umsetzen //////////////////////////////// + +void SfxStyleSheetBasePool::ChangeParent(const XubString& rOld, + const XubString& rNew, + BOOL bVirtual) +{ + const USHORT nTmpMask = GetSearchMask(); + SetSearchMask(GetSearchFamily(), 0xffff); + for( SfxStyleSheetBase* p = First(); p; p = Next() ) + { + if( p->GetParent().Equals( rOld ) ) + { + if(bVirtual) + p->SetParent( rNew ); + else + p->aParent = rNew; + } + } + SetSearchMask(GetSearchFamily(), nTmpMask); +} + +/////////////////////////// Laden/Speichern ///////////////////////////////// + +void SfxStyleSheetBase::Load( SvStream&, USHORT ) +{ +} + +void SfxStyleSheetBase::Store( SvStream& ) +{ +} + + +BOOL SfxStyleSheetBasePool::Load( SvStream& rStream ) +{ + // alte Version? + if ( !rPool.IsVer2_Impl() ) + return Load1_Impl( rStream ); + + // gesamten StyleSheetPool in neuer Version aus einem MiniRecord lesen + SfxMiniRecordReader aPoolRec( &rStream, SFX_STYLES_REC ); + + // Header-Record lesen + short nCharSet = 0; + if ( !rStream.GetError() ) + { + SfxSingleRecordReader aHeaderRec( &rStream, SFX_STYLES_REC_HEADER ); + if ( !aHeaderRec.IsValid() ) + return FALSE; + + aAppName = rPool.GetName(); + rStream >> nCharSet; + } + + // Styles-Record lesen + if ( !rStream.GetError() ) + { + SfxMultiRecordReader aStylesRec( &rStream, SFX_STYLES_REC_STYLES ); + if ( !aStylesRec.IsValid() ) + return FALSE; + + rtl_TextEncoding eEnc = GetSOLoadTextEncoding( + (rtl_TextEncoding)nCharSet, + sal::static_int_cast< USHORT >(rStream.GetVersion()) ); + rtl_TextEncoding eOldEnc = rStream.GetStreamCharSet(); + rStream.SetStreamCharSet( eEnc ); + + USHORT nStyles; + for ( nStyles = 0; aStylesRec.GetContent(); nStyles++ ) + { + // kann nicht mehr weiterlesen? + if ( rStream.GetError() ) + break; + + // Globale Teile + XubString aName, aParent, aFollow; + String aHelpFile; + USHORT nFamily, nStyleMask,nCount; + sal_uInt32 nHelpId; + rStream.ReadByteString(aName, eEnc ); + rStream.ReadByteString(aParent, eEnc ); + rStream.ReadByteString(aFollow, eEnc ); + rStream >> nFamily >> nStyleMask; + SfxPoolItem::readByteString(rStream, aHelpFile); + rStream >> nHelpId; + + SfxStyleSheetBase& rSheet = Make( aName, (SfxStyleFamily)nFamily , nStyleMask); + rSheet.SetHelpId( aHelpFile, nHelpId ); + // Hier erst einmal Parent und Follow zwischenspeichern + rSheet.aParent = aParent; + rSheet.aFollow = aFollow; + UINT32 nPos = rStream.Tell(); + rStream >> nCount; + if(nCount) + { + rStream.Seek( nPos ); + // Das Laden des ItemSets bedient sich der Methode GetItemSet(), + // damit eigene ItemSets untergeschoben werden koennen + SfxItemSet& rSet = rSheet.GetItemSet(); + rSet.ClearItem(); + //! SfxItemSet aTmpSet( *pTmpPool ); + /*!aTmpSet*/ rSet.Load( rStream ); + //! rSet.Put( aTmpSet ); + } + // Lokale Teile + UINT32 nSize; + USHORT nVer; + rStream >> nVer >> nSize; + nPos = rStream.Tell() + nSize; + rSheet.Load( rStream, nVer ); + rStream.Seek( nPos ); + } + + // #72939# only loop through the styles that were really inserted + ULONG n = aStyles.size(); + + //! delete pTmpPool; + // Jetzt Parent und Follow setzen. Alle Sheets sind geladen. + // Mit Setxxx() noch einmal den String eintragen, da diese + // virtuellen Methoden evtl. ueberlagert sind. + for ( ULONG i = 0; i < n; i++ ) + { + SfxStyleSheetBase* p = aStyles[ i ].get(); + XubString aText = p->aParent; + p->aParent.Erase(); + p->SetParent( aText ); + aText = p->aFollow; + p->aFollow.Erase(); + p->SetFollow( aText ); + } + + rStream.SetStreamCharSet( eOldEnc ); + } + + // alles klar? + return BOOL( rStream.GetError() == SVSTREAM_OK ); +} + +BOOL SfxStyleSheetBasePool::Load1_Impl( SvStream& rStream ) +{ + aAppName = rPool.GetName(); + USHORT nVersion; + short nCharSet; + rStream >> nVersion; + + if(nVersion!=STYLESTREAM_VERSION) + nCharSet=nVersion; + else + rStream >> nCharSet; + + rtl_TextEncoding eEnc = GetSOLoadTextEncoding( + (rtl_TextEncoding)nCharSet, + sal::static_int_cast< USHORT >(rStream.GetVersion()) ); + rtl_TextEncoding eOldEnc = rStream.GetStreamCharSet(); + rStream.SetStreamCharSet( eEnc ); + + USHORT nStyles; + rStream >> nStyles; + USHORT i; + for ( i = 0; i < nStyles; i++ ) + { + // kann nicht mehr weiterlesen? + if ( rStream.GetError() ) + { + nStyles = i; + break; + } + + // Globale Teile + XubString aName, aParent, aFollow; + String aHelpFile; + USHORT nFamily, nStyleMask,nCount; + sal_uInt32 nHelpId; + rStream.ReadByteString(aName, eEnc ); + rStream.ReadByteString(aParent, eEnc ); + rStream.ReadByteString(aFollow, eEnc ); + rStream >> nFamily >> nStyleMask; + SfxPoolItem::readByteString(rStream, aHelpFile); + if(nVersion!=STYLESTREAM_VERSION) + { + USHORT nTmpHelpId; + rStream >> nTmpHelpId; + nHelpId=nTmpHelpId; + } + else + rStream >> nHelpId; + + SfxStyleSheetBase& rSheet = Make( aName, (SfxStyleFamily)nFamily , nStyleMask); + rSheet.SetHelpId( aHelpFile, nHelpId ); + // Hier erst einmal Parent und Follow zwischenspeichern + rSheet.aParent = aParent; + rSheet.aFollow = aFollow; + UINT32 nPos = rStream.Tell(); + rStream >> nCount; + if(nCount) { + rStream.Seek( nPos ); + // Das Laden des ItemSets bedient sich der Methode GetItemSet(), + // damit eigene ItemSets untergeschoben werden koennen + SfxItemSet& rSet = rSheet.GetItemSet(); + rSet.ClearItem(); +//! SfxItemSet aTmpSet( *pTmpPool ); + /*!aTmpSet*/ rSet.Load( rStream ); + //! rSet.Put( aTmpSet ); + } + // Lokale Teile + UINT32 nSize; + USHORT nVer; + rStream >> nVer >> nSize; + nPos = rStream.Tell() + nSize; + rSheet.Load( rStream, nVer ); + rStream.Seek( nPos ); + } + + //! delete pTmpPool; + // Jetzt Parent und Follow setzen. Alle Sheets sind geladen. + // Mit Setxxx() noch einmal den String eintragen, da diese + // virtuellen Methoden evtl. ueberlagert sind. + for ( i = 0; i < nStyles; i++ ) + { + SfxStyleSheetBase* p = aStyles[ i ].get(); + XubString aText = p->aParent; + p->aParent.Erase(); + p->SetParent( aText ); + aText = p->aFollow; + p->aFollow.Erase(); + p->SetFollow( aText ); + } + + rStream.SetStreamCharSet( eOldEnc ); + + return BOOL( rStream.GetError() == SVSTREAM_OK ); +} + +BOOL SfxStyleSheetBasePool::Store( SvStream& rStream, BOOL bUsed ) +{ + // den ganzen StyleSheet-Pool in einen Mini-Record + SfxMiniRecordWriter aPoolRec( &rStream, SFX_STYLES_REC ); + + // Erst einmal die Dummies rauszaehlen; die werden nicht gespeichert + USHORT nCount = 0; + for( SfxStyleSheetBase* p = First(); p; p = Next() ) + { + if(!bUsed || p->IsUsed()) + nCount++; + } + + // einen Header-Record vorweg + rtl_TextEncoding eEnc + = ::GetSOStoreTextEncoding( + rStream.GetStreamCharSet(), + sal::static_int_cast< USHORT >(rStream.GetVersion()) ); + rtl_TextEncoding eOldEnc = rStream.GetStreamCharSet(); + rStream.SetStreamCharSet( eEnc ); + + { + SfxSingleRecordWriter aHeaderRec( &rStream, + SFX_STYLES_REC_HEADER, + STYLESTREAM_VERSION ); + rStream << (short) eEnc; + } + + // die StyleSheets in einen MultiVarRecord + { + // Bug 79478: + // make a check loop, to be shure, that the converted names are also + // unique like the originals! In other cases we get a loop. + SvStringsSortDtor aSortOrigNames( 0, 128 ); + SvStrings aOrigNames( 0, 128 ); + SvByteStringsSortDtor aSortConvNames( 0, 128 ); + SvByteStrings aConvNames( 0, 128 ); + + { + + for( SfxStyleSheetBase* p = First(); p; p = Next() ) + { + if(!bUsed || p->IsUsed()) + { + USHORT nFamily = (USHORT)p->GetFamily(); + String* pName = new String( p->GetName() ); + ByteString* pConvName = new ByteString( *pName, eEnc ); + + pName->Insert( (sal_Unicode)nFamily, 0 ); + pConvName->Insert( " ", 0 ); + pConvName->SetChar( + 0, + sal::static_int_cast< char >(0xff & (nFamily >> 8)) ); + pConvName->SetChar( + 1, sal::static_int_cast< char >(0xff & nFamily) ); + + USHORT nInsPos, nAdd = aSortConvNames.Count(); + while( !aSortConvNames.Insert( pConvName, nInsPos ) ) + (pConvName->Append( '_' )).Append( + ByteString::CreateFromInt32( nAdd++ )); + aOrigNames.Insert( pName, nInsPos ); + } + } + + // now we have the list of the names, sorted by convertede names + // But now we need the sorted list of orignames. + { + USHORT nInsPos, nEnd = aOrigNames.Count(); + const ByteStringPtr* ppB = aSortConvNames.GetData(); + for( USHORT n = 0; n < nEnd; ++n, ++ppB ) + { + String* p = aOrigNames.GetObject( n ); + aSortOrigNames.Insert( p, nInsPos ); + aConvNames.Insert( *ppB, nInsPos ); + } + + } + } + + + ByteString sEmpty; + USHORT nFndPos; + String sNm; + SfxMultiVarRecordWriter aStylesRec( &rStream, SFX_STYLES_REC_STYLES, 0 ); + for( SfxStyleSheetBase* p = First(); p; p = Next() ) + { + if(!bUsed || p->IsUsed()) + { + aStylesRec.NewContent(); + + // Globale Teile speichern + String aHelpFile; + sal_uInt32 nHelpId = p->GetHelpId( aHelpFile ); + USHORT nFamily = sal::static_int_cast< USHORT >(p->GetFamily()); + String sFamily( (sal_Unicode)nFamily ); + + (sNm = sFamily) += p->GetName(); + if( aSortOrigNames.Seek_Entry( &sNm, &nFndPos )) + rStream.WriteByteString( aConvNames.GetObject( nFndPos )->Copy( 2 )); + else + rStream.WriteByteString( sEmpty ); + + (sNm = sFamily) += p->GetParent(); + if( aSortOrigNames.Seek_Entry( &sNm, &nFndPos )) + rStream.WriteByteString( aConvNames.GetObject( nFndPos )->Copy( 2 )); + else + rStream.WriteByteString( sEmpty ); + + (sNm = sFamily) += p->GetFollow(); + if( aSortOrigNames.Seek_Entry( &sNm, &nFndPos )) + rStream.WriteByteString( aConvNames.GetObject( nFndPos )->Copy( 2 )); + else + rStream.WriteByteString( sEmpty ); + + rStream << nFamily << p->GetMask(); + SfxPoolItem::writeByteString(rStream, aHelpFile); + rStream << nHelpId; + if(p->pSet) + p->pSet->Store( rStream ); + else + rStream << (USHORT)0; + + // Lokale Teile speichern + // Vor dem lokalen Teil wird die Laenge der lokalen Daten + // als UINT32 sowie die Versionsnummer gespeichert. + rStream << (USHORT) p->GetVersion(); + ULONG nPos1 = rStream.Tell(); + rStream << (UINT32) 0; + p->Store( rStream ); + ULONG nPos2 = rStream.Tell(); + rStream.Seek( nPos1 ); + rStream << (UINT32) ( nPos2 - nPos1 - sizeof( UINT32 ) ); + rStream.Seek( nPos2 ); + if( rStream.GetError() != SVSTREAM_OK ) + break; + } + } + } + + rStream.SetStreamCharSet( eOldEnc ); + + return BOOL( rStream.GetError() == SVSTREAM_OK ); +} + +SfxItemPool& SfxStyleSheetBasePool::GetPool() +{ + return rPool; +} + +const SfxItemPool& SfxStyleSheetBasePool::GetPool() const +{ + return rPool; +} + +/////////////////////// SfxStyleSheet ///////////////////////////////// + +SfxStyleSheet::SfxStyleSheet(const XubString &rName, + const SfxStyleSheetBasePool& r_Pool, + SfxStyleFamily eFam, + USHORT mask ): + SfxStyleSheetBase(rName, const_cast< SfxStyleSheetBasePool& >( r_Pool ), eFam, mask) +{} + +SfxStyleSheet::SfxStyleSheet(const SfxStyleSheet& rStyle) : + SfxStyleSheetBase(rStyle), + SfxListener( rStyle ), + SfxBroadcaster( rStyle ) +{} + +SfxStyleSheet::SfxStyleSheet() +{ +} + +SfxStyleSheet::~SfxStyleSheet() +{ + Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_INDESTRUCTION, *this ) ); +} + + +BOOL SfxStyleSheet::SetParent( const XubString& rName ) +{ + if(aParent == rName) + return TRUE; + const XubString aOldParent(aParent); + if(SfxStyleSheetBase::SetParent(rName)) { + // aus der Benachrichtigungskette des alten + // Parents gfs. austragen + if(aOldParent.Len()) { + SfxStyleSheet *pParent = (SfxStyleSheet *)rPool.Find(aOldParent, nFamily, 0xffff); + if(pParent) + EndListening(*pParent); + } + // in die Benachrichtigungskette des neuen + // Parents eintragen + if(aParent.Len()) { + SfxStyleSheet *pParent = (SfxStyleSheet *)rPool.Find(aParent, nFamily, 0xffff); + if(pParent) + StartListening(*pParent); + } + return TRUE; + } + return FALSE; +} + +// alle Zuhoerer benachtichtigen + +void SfxStyleSheet::Notify(SfxBroadcaster& rBC, const SfxHint& rHint ) +{ + Forward(rBC, rHint); +} + +//////////////////////// SfxStyleSheetPool /////////////////////////////// + +SfxStyleSheetPool::SfxStyleSheetPool( SfxItemPool const& rSet) +: SfxStyleSheetBasePool( const_cast< SfxItemPool& >( rSet ) ) +{ +} + +/////////////////////////////////// Factory //////////////////////////////// + +SfxStyleSheetBase* SfxStyleSheetPool::Create( const XubString& rName, + SfxStyleFamily eFam, USHORT mask ) +{ + return new SfxStyleSheet( rName, *this, eFam, mask ); +} + +SfxStyleSheetBase* SfxStyleSheetPool::Create( const SfxStyleSheet& r ) +{ + return new SfxStyleSheet( r ); +} +/* +BOOL SfxStyleSheetPool::CopyTo(SfxStyleSheetPool &, const String &) +{ + return FALSE; +} +*/ + +// -------------------------------------------------------------------- +// class SfxUnoStyleSheet +// -------------------------------------------------------------------- + +SfxUnoStyleSheet::SfxUnoStyleSheet( const UniString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, USHORT _nMaske ) +: ::cppu::ImplInheritanceHelper2< SfxStyleSheet, ::com::sun::star::style::XStyle, ::com::sun::star::lang::XUnoTunnel >( _rName, _rPool, _eFamily, _nMaske ) +{ +} + +// -------------------------------------------------------------------- +SfxUnoStyleSheet::SfxUnoStyleSheet( const SfxStyleSheet& _rSheet ) +: ::cppu::ImplInheritanceHelper2< SfxStyleSheet, ::com::sun::star::style::XStyle, ::com::sun::star::lang::XUnoTunnel >( _rSheet ) +{ +} + +// -------------------------------------------------------------------- + +SfxUnoStyleSheet* SfxUnoStyleSheet::getUnoStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >& xStyle ) +{ + SfxUnoStyleSheet* pRet = dynamic_cast< SfxUnoStyleSheet* >( xStyle.get() ); + if( !pRet ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUT( xStyle, ::com::sun::star::uno::UNO_QUERY ); + if( xUT.is() ) + pRet = reinterpret_cast(sal::static_int_cast(xUT->getSomething( SfxUnoStyleSheet::getIdentifier()))); + } + return pRet; +} + +// -------------------------------------------------------------------- +// XUnoTunnel +// -------------------------------------------------------------------- + +::sal_Int64 SAL_CALL SfxUnoStyleSheet::getSomething( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& rId ) throw (::com::sun::star::uno::RuntimeException) +{ + if( rId.getLength() == 16 && 0 == rtl_compareMemory( getIdentifier().getConstArray(), rId.getConstArray(), 16 ) ) + { + return sal::static_int_cast(reinterpret_cast(this)); + } + else + { + return 0; + } +} + +// -------------------------------------------------------------------- + +const ::com::sun::star::uno::Sequence< ::sal_Int8 >& SfxUnoStyleSheet::getIdentifier() +{ + static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0; + if( !pSeq ) + { + ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); + if( !pSeq ) + { + static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + pSeq = &aSeq; + } + } + return *pSeq; +} + +// -------------------------------------------------------------------- diff --git a/svl/source/items/stylepool.cxx b/svl/source/items/stylepool.cxx new file mode 100644 index 000000000000..5f31500be73c --- /dev/null +++ b/svl/source/items/stylepool.cxx @@ -0,0 +1,542 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: stylepool.cxx,v $ + * $Revision: 1.10.78.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include +#include + +#include "stylepool.hxx" +#include +#include + + +using namespace boost; + +namespace { + // A "Node" represents a subset of inserted SfxItemSets + // The root node represents the empty set + // The other nodes contain a SfxPoolItem and represents an item set which contains their + // pool item and the pool items of their parents. + class Node + { + std::vector mChildren; // child nodes, create by findChildNode(..) + // container of shared pointers of inserted item sets; for non-poolable + // items more than one item set is needed + std::vector< StylePool::SfxItemSet_Pointer_t > maItemSet; + const SfxPoolItem *mpItem; // my pool item + Node *mpUpper; // if I'm a child node that's my parent node + // --> OD 2008-03-07 #i86923# + const bool mbIsItemIgnorable; + // <-- + public: + // --> OD 2008-03-07 #i86923# + Node() // root node Ctor + : mChildren(), + maItemSet(), + mpItem( 0 ), + mpUpper( 0 ), + mbIsItemIgnorable( false ) + {} + Node( const SfxPoolItem& rItem, Node* pParent, const bool bIgnorable ) // child node Ctor + : mChildren(), + maItemSet(), + mpItem( rItem.Clone() ), + mpUpper( pParent ), + mbIsItemIgnorable( bIgnorable ) + {} + // <-- + ~Node(); + // --> OD 2008-03-11 #i86923# + bool hasItemSet( const bool bCheckUsage ) const; + // <-- + // --> OD 2008-04-29 #i87808# +// const StylePool::SfxItemSet_Pointer_t getItemSet() const { return aItemSet[aItemSet.size()-1]; } + const StylePool::SfxItemSet_Pointer_t getItemSet() const + { + return maItemSet.back(); + } + const StylePool::SfxItemSet_Pointer_t getUsedOrLastAddedItemSet() const; + // <-- + void setItemSet( const SfxItemSet& rSet ){ maItemSet.push_back( StylePool::SfxItemSet_Pointer_t( rSet.Clone() ) ); } + // --> OD 2008-03-11 #i86923# + Node* findChildNode( const SfxPoolItem& rItem, + const bool bIsItemIgnorable = false ); + Node* nextItemSet( Node* pLast, + const bool bSkipUnusedItemSet, + const bool bSkipIgnorable ); + // <-- + const SfxPoolItem& getPoolItem() const { return *mpItem; } + // --> OD 2008-03-11 #i86923# + bool hasIgnorableChildren( const bool bCheckUsage ) const; + const StylePool::SfxItemSet_Pointer_t getItemSetOfIgnorableChild( + const bool bSkipUnusedItemSets ) const; + // <-- + }; + + // --> OD 2008-04-29 #i87808# + const StylePool::SfxItemSet_Pointer_t Node::getUsedOrLastAddedItemSet() const + { + std::vector< StylePool::SfxItemSet_Pointer_t >::const_reverse_iterator aIter; + + for ( aIter = maItemSet.rbegin(); aIter != maItemSet.rend(); ++aIter ) + { + if ( (*aIter).use_count() > 1 ) + { + return *aIter; + } + } + + return maItemSet.back(); + } + // <-- + + // --> OD 2008-05-06 #i86923# + bool Node::hasItemSet( const bool bCheckUsage ) const + { + bool bHasItemSet = false; + + if ( maItemSet.size() > 0 ) + { + if ( bCheckUsage ) + { + std::vector< StylePool::SfxItemSet_Pointer_t >::const_reverse_iterator aIter; + + for ( aIter = maItemSet.rbegin(); aIter != maItemSet.rend(); ++aIter ) + { + if ( (*aIter).use_count() > 1 ) + { + bHasItemSet = true; + break; + } + } + } + else + { + bHasItemSet = true; + } + } + return bHasItemSet; + } + // <-- + + // --> OD 2008-03-07 #i86923# + Node* Node::findChildNode( const SfxPoolItem& rItem, + const bool bIsItemIgnorable ) + // <-- + { + Node* pNextNode = this; + std::vector::iterator aIter = mChildren.begin(); + while( aIter != mChildren.end() ) + { + if( rItem.Which() == (*aIter)->getPoolItem().Which() && + rItem == (*aIter)->getPoolItem() ) + return *aIter; + ++aIter; + } + // --> OD 2008-03-07 #i86923# + pNextNode = new Node( rItem, pNextNode, bIsItemIgnorable ); + // <-- + mChildren.push_back( pNextNode ); + return pNextNode; + } + + /* Find the next node which has a SfxItemSet. + The input parameter pLast has a sophisticated meaning: + downstairs only: + pLast == 0 => scan your children and their children + but neither your parents neither your siblings + downstairs and upstairs: + pLast == this => scan your children, their children, + the children of your parent behind you, and so on + partial downstairs and upstairs + pLast != 0 && pLast != this => scan your children behind the given children, + the children of your parent behind you and so on. + + OD 2008-03-11 #i86923# + introduce parameters and + and its handling. + */ + Node* Node::nextItemSet( Node* pLast, + const bool bSkipUnusedItemSets, + const bool bSkipIgnorable ) + { + // Searching downstairs + std::vector::iterator aIter = mChildren.begin(); + // For pLast == 0 and pLast == this all children are of interest + // for another pLast the search starts behind pLast... + if( pLast && pLast != this ) + { + aIter = std::find( mChildren.begin(), mChildren.end(), pLast ); + if( aIter != mChildren.end() ) + ++aIter; + } + Node *pNext = 0; + while( aIter != mChildren.end() ) + { + // --> OD 2008-03-11 #i86923# + if ( bSkipIgnorable && (*aIter)->mbIsItemIgnorable ) + { + ++aIter; + continue; + } + // <-- + pNext = *aIter; + // --> OD 2008-03-11 #i86923# + if ( pNext->hasItemSet( bSkipUnusedItemSets ) ) + { + return pNext; + } + if ( bSkipIgnorable && + pNext->hasIgnorableChildren( bSkipUnusedItemSets ) ) + { + return pNext; + } + pNext = pNext->nextItemSet( 0, bSkipUnusedItemSets, bSkipIgnorable ); // 0 => downstairs only + // <-- + if( pNext ) + return pNext; + ++aIter; + } + // Searching upstairs + if( pLast && mpUpper ) + { + // --> OD 2008-03-11 #i86923# + pNext = mpUpper->nextItemSet( this, bSkipUnusedItemSets, bSkipIgnorable ); + // <-- + } + return pNext; + } + + // --> OD 2008-03-11 #i86923# + bool Node::hasIgnorableChildren( const bool bCheckUsage ) const + { + bool bHasIgnorableChildren( false ); + + std::vector::const_iterator aIter = mChildren.begin(); + while( aIter != mChildren.end() && !bHasIgnorableChildren ) + { + Node* pChild = *aIter; + if ( pChild->mbIsItemIgnorable ) + { + bHasIgnorableChildren = + !bCheckUsage || + ( pChild->hasItemSet( bCheckUsage /* == true */ ) || + pChild->hasIgnorableChildren( bCheckUsage /* == true */ ) ); + } + ++aIter; + } + + return bHasIgnorableChildren; + } + + const StylePool::SfxItemSet_Pointer_t Node::getItemSetOfIgnorableChild( + const bool bSkipUnusedItemSets ) const + { + DBG_ASSERT( hasIgnorableChildren( bSkipUnusedItemSets ), + " - node has no ignorable children" ); + + std::vector::const_iterator aIter = mChildren.begin(); + while( aIter != mChildren.end() ) + { + Node* pChild = *aIter; + if ( pChild->mbIsItemIgnorable ) + { + if ( pChild->hasItemSet( bSkipUnusedItemSets ) ) + { + return pChild->getUsedOrLastAddedItemSet(); + } + else + { + pChild = pChild->nextItemSet( 0, bSkipUnusedItemSets, false ); + if ( pChild ) + { + return pChild->getUsedOrLastAddedItemSet(); + } + } + } + ++aIter; + } + + StylePool::SfxItemSet_Pointer_t pReturn; + return pReturn; + } + // <-- + + Node::~Node() + { + std::vector::iterator aIter = mChildren.begin(); + while( aIter != mChildren.end() ) + { + delete *aIter; + ++aIter; + } + delete mpItem; + } + + class Iterator : public IStylePoolIteratorAccess + { + std::map< const SfxItemSet*, Node >& mrRoot; + std::map< const SfxItemSet*, Node >::iterator mpCurrNode; + Node* mpNode; + const bool mbSkipUnusedItemSets; + const bool mbSkipIgnorable; + public: + // --> OD 2008-03-07 #i86923# + Iterator( std::map< const SfxItemSet*, Node >& rR, + const bool bSkipUnusedItemSets, + const bool bSkipIgnorable ) + : mrRoot( rR ), + mpCurrNode( rR.begin() ), + mpNode(0), + mbSkipUnusedItemSets( bSkipUnusedItemSets ), + mbSkipIgnorable( bSkipIgnorable ) + {} + // <-- + virtual StylePool::SfxItemSet_Pointer_t getNext(); + virtual ::rtl::OUString getName(); + }; + + StylePool::SfxItemSet_Pointer_t Iterator::getNext() + { + StylePool::SfxItemSet_Pointer_t pReturn; + while( mpNode || mpCurrNode != mrRoot.end() ) + { + if( !mpNode ) + { + mpNode = &mpCurrNode->second; + ++mpCurrNode; + // --> OD 2008-03-11 #i86923# + if ( mpNode->hasItemSet( mbSkipUnusedItemSets ) ) + { + // --> OD 2008-04-30 #i87808# +// return pNode->getItemSet(); + return mpNode->getUsedOrLastAddedItemSet(); + // <-- + } + // <-- + } + // --> OD 2008-03-11 #i86923# + mpNode = mpNode->nextItemSet( mpNode, mbSkipUnusedItemSets, mbSkipIgnorable ); + if ( mpNode && mpNode->hasItemSet( mbSkipUnusedItemSets ) ) + { + // --> OD 2008-04-30 #i87808# +// return pNode->getItemSet(); + return mpNode->getUsedOrLastAddedItemSet(); + // <-- + } + if ( mbSkipIgnorable && + mpNode && mpNode->hasIgnorableChildren( mbSkipUnusedItemSets ) ) + { + return mpNode->getItemSetOfIgnorableChild( mbSkipUnusedItemSets ); + } + // <-- + } + return pReturn; + } + + ::rtl::OUString Iterator::getName() + { + ::rtl::OUString aString; + if( mpNode && mpNode->hasItemSet( false ) ) + { + // --> OD 2008-04-30 #i87808# +// aString = StylePool::nameOf( pNode->getItemSet() ); + aString = StylePool::nameOf( mpNode->getUsedOrLastAddedItemSet() ); + // <-- + } + return aString; + } + +} + +/* This static method creates a unique name from a shared pointer to a SfxItemSet + The name is the memory address of the SfxItemSet itself. */ + +::rtl::OUString StylePool::nameOf( SfxItemSet_Pointer_t pSet ) +{ + return ::rtl::OUString::valueOf( reinterpret_cast( pSet.get() ), 16 ); +} + +// class StylePoolImpl organized a tree-structure where every node represents a SfxItemSet. +// The insertItemSet method adds a SfxItemSet into the tree if necessary and returns a shared_ptr +// to a copy of the SfxItemSet. +// The aRoot-Node represents an empty SfxItemSet. + +class StylePoolImpl +{ +private: + std::map< const SfxItemSet*, Node > maRoot; + sal_Int32 mnCount; + // --> OD 2008-03-07 #i86923# + SfxItemSet* mpIgnorableItems; + // <-- +public: + // --> OD 2008-03-07 #i86923# + explicit StylePoolImpl( SfxItemSet* pIgnorableItems = 0 ) + : maRoot(), + mnCount(0), + mpIgnorableItems( pIgnorableItems != 0 + ? pIgnorableItems->Clone( FALSE ) + : 0 ) + { + DBG_ASSERT( !pIgnorableItems || !pIgnorableItems->Count(), + " - misusage: item set for ignorable item should be empty. Please correct usage." ); + DBG_ASSERT( !mpIgnorableItems || !mpIgnorableItems->Count(), + " - does not work as excepted - is not empty. Please inform OD." ); + } + + ~StylePoolImpl() + { + delete mpIgnorableItems; + } + // <-- + + StylePool::SfxItemSet_Pointer_t insertItemSet( const SfxItemSet& rSet ); + + // --> OD 2008-03-07 #i86923# + IStylePoolIteratorAccess* createIterator( bool bSkipUnusedItemSets = false, + bool bSkipIgnorableItems = false ); + // <-- + sal_Int32 getCount() const { return mnCount; } +}; + +StylePool::SfxItemSet_Pointer_t StylePoolImpl::insertItemSet( const SfxItemSet& rSet ) +{ + bool bNonPoolable = false; + Node* pCurNode = &maRoot[ rSet.GetParent() ]; + SfxItemIter aIter( rSet ); + const SfxPoolItem* pItem = aIter.GetCurItem(); + // Every SfxPoolItem in the SfxItemSet causes a step deeper into the tree, + // a complete empty SfxItemSet would stay at the root node. + // --> OD 2008-03-07 #i86923# + // insert ignorable items to the tree leaves. + std::auto_ptr pFoundIgnorableItems; + if ( mpIgnorableItems ) + { + pFoundIgnorableItems.reset( new SfxItemSet( *mpIgnorableItems ) ); + } + while( pItem ) + { + if( !rSet.GetPool()->IsItemFlag(pItem->Which(), SFX_ITEM_POOLABLE ) ) + bNonPoolable = true; + if ( !pFoundIgnorableItems.get() || + ( pFoundIgnorableItems.get() && + pFoundIgnorableItems->Put( *pItem ) == 0 ) ) + { + pCurNode = pCurNode->findChildNode( *pItem ); + } + pItem = aIter.NextItem(); + } + if ( pFoundIgnorableItems.get() && + pFoundIgnorableItems->Count() > 0 ) + { + SfxItemIter aIgnorableItemsIter( *pFoundIgnorableItems ); + pItem = aIgnorableItemsIter.GetCurItem(); + while( pItem ) + { + if( !rSet.GetPool()->IsItemFlag(pItem->Which(), SFX_ITEM_POOLABLE ) ) + bNonPoolable = true; + pCurNode = pCurNode->findChildNode( *pItem, true ); + pItem = aIgnorableItemsIter.NextItem(); + } + } + // <-- + // Every leaf node represents an inserted item set, but "non-leaf" nodes represents subsets + // of inserted itemsets. + // These nodes could have but does not need to have a shared_ptr to a item set. + if( !pCurNode->hasItemSet( false ) ) + { + pCurNode->setItemSet( rSet ); + bNonPoolable = false; // to avoid a double insertion + ++mnCount; + } + // If rSet contains at least one non poolable item, a new itemset has to be inserted + if( bNonPoolable ) + pCurNode->setItemSet( rSet ); +#ifdef DEBUG + { + sal_Int32 nCheck = -1; + sal_Int32 nNo = -1; + IStylePoolIteratorAccess* pIter = createIterator(); + StylePool::SfxItemSet_Pointer_t pTemp; + do + { + ++nCheck; + pTemp = pIter->getNext(); + if( pCurNode->hasItemSet( false ) && pTemp.get() == pCurNode->getItemSet().get() ) + { + ::rtl::OUString aStr = StylePool::nameOf( pTemp ); + nNo = nCheck; + } + } while( pTemp.get() ); + DBG_ASSERT( mnCount == nCheck, "Wrong counting"); + delete pIter; + } +#endif + return pCurNode->getItemSet(); +} + +// --> OD 2008-03-07 #i86923# +IStylePoolIteratorAccess* StylePoolImpl::createIterator( bool bSkipUnusedItemSets, + bool bSkipIgnorableItems ) +{ + return new Iterator( maRoot, bSkipUnusedItemSets, bSkipIgnorableItems ); +} +// <-- + +// Ctor, Dtor and redirected methods of class StylePool, nearly inline ;-) + +// --> OD 2008-03-07 #i86923# +StylePool::StylePool( SfxItemSet* pIgnorableItems ) + : pImpl( new StylePoolImpl( pIgnorableItems ) ) +{} +// <-- + +StylePool::SfxItemSet_Pointer_t StylePool::insertItemSet( const SfxItemSet& rSet ) +{ return pImpl->insertItemSet( rSet ); } + +// --> OD 2008-03-11 #i86923# +IStylePoolIteratorAccess* StylePool::createIterator( const bool bSkipUnusedItemSets, + const bool bSkipIgnorableItems ) +{ + return pImpl->createIterator( bSkipUnusedItemSets, bSkipIgnorableItems ); +} +// <-- + +sal_Int32 StylePool::getCount() const +{ return pImpl->getCount(); } + +StylePool::~StylePool() { delete pImpl; } + +// End of class StylePool + diff --git a/svl/source/items/szitem.cxx b/svl/source/items/szitem.cxx new file mode 100644 index 000000000000..ec3ff83dd2ec --- /dev/null +++ b/svl/source/items/szitem.cxx @@ -0,0 +1,214 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: szitem.cxx,v $ + * $Revision: 1.11 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include +#include +#include +#include +#include + +#include +#include "memberid.hrc" + +// STATIC DATA ----------------------------------------------------------- + +DBG_NAME(SfxSizeItem) + +// ----------------------------------------------------------------------- + +TYPEINIT1_AUTOFACTORY(SfxSizeItem, SfxPoolItem); + +// ----------------------------------------------------------------------- + +SfxSizeItem::SfxSizeItem() +{ + DBG_CTOR(SfxSizeItem, 0); +} + +// ----------------------------------------------------------------------- + +SfxSizeItem::SfxSizeItem( USHORT nW, const Size& rVal ) : + SfxPoolItem( nW ), + aVal( rVal ) +{ + DBG_CTOR(SfxSizeItem, 0); +} + +// ----------------------------------------------------------------------- + +SfxSizeItem::SfxSizeItem( USHORT nW, SvStream &rStream ) : + SfxPoolItem( nW ) +{ + DBG_CTOR(SfxSizeItem, 0); + rStream >> aVal; +} + +// ----------------------------------------------------------------------- + +SfxSizeItem::SfxSizeItem( const SfxSizeItem& rItem ) : + SfxPoolItem( rItem ), + aVal( rItem.aVal ) +{ + DBG_CTOR(SfxSizeItem, 0); +} + +// ----------------------------------------------------------------------- + +SfxItemPresentation SfxSizeItem::GetPresentation +( + SfxItemPresentation /*ePresentation*/, + SfxMapUnit /*eCoreMetric*/, + SfxMapUnit /*ePresentationMetric*/, + XubString& rText, + const IntlWrapper * +) const +{ + DBG_CHKTHIS(SfxSizeItem, 0); + rText = UniString::CreateFromInt32(aVal.Width()); + rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + rText += UniString::CreateFromInt32(aVal.Height()); + rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + return SFX_ITEM_PRESENTATION_NAMELESS; +} + +// ----------------------------------------------------------------------- + +int SfxSizeItem::operator==( const SfxPoolItem& rItem ) const +{ + DBG_CHKTHIS(SfxSizeItem, 0); + DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); + return ((SfxSizeItem&)rItem).aVal == aVal; +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxSizeItem::Clone(SfxItemPool *) const +{ + DBG_CHKTHIS(SfxSizeItem, 0); + return new SfxSizeItem( *this ); +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxSizeItem::Create(SvStream &rStream, USHORT ) const +{ + DBG_CHKTHIS(SfxSizeItem, 0); + Size aStr; + rStream >> aStr; + return new SfxSizeItem(Which(), aStr); +} + +// ----------------------------------------------------------------------- + +SvStream& SfxSizeItem::Store(SvStream &rStream, USHORT ) const +{ + DBG_CHKTHIS(SfxSizeItem, 0); + rStream << aVal; + return rStream; +} + +// ----------------------------------------------------------------------- +BOOL SfxSizeItem::QueryValue( com::sun::star::uno::Any& rVal, + BYTE nMemberId ) const +{ + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; + + Size aTmp(aVal); + if( bConvert ) + { + aTmp.Height() = ( aTmp.Height() * 127 + 36) / 72; + aTmp.Width() = ( aTmp.Width() * 127 + 36) / 72; + } + + switch ( nMemberId ) + { + case 0: + { + rVal <<= com::sun::star::awt::Size( aTmp.getWidth(), aTmp.getHeight() ); + break; + } + case MID_WIDTH: + rVal <<= aTmp.getWidth(); break; + case MID_HEIGHT: + rVal <<= aTmp.getHeight(); break; + default: DBG_ERROR("Wrong MemberId!"); return FALSE; + } + + return TRUE; +} + +// ----------------------------------------------------------------------- +BOOL SfxSizeItem::PutValue( const com::sun::star::uno::Any& rVal, + BYTE nMemberId ) +{ + sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); + nMemberId &= ~CONVERT_TWIPS; + + BOOL bRet = FALSE; + com::sun::star::awt::Size aValue; + sal_Int32 nVal = 0; + if ( !nMemberId ) + bRet = ( rVal >>= aValue ); + else + { + bRet = ( rVal >>= nVal ); + if ( nMemberId == MID_WIDTH ) + { + aValue.Width = nVal; + aValue.Height = aVal.Height(); + } + else + { + aValue.Height = nVal; + aValue.Width = aVal.Width(); + } + } + + if ( bRet ) + { + Size aTmp( aValue.Width, aValue.Height ); + if( bConvert ) + { + aTmp.Height() = ( aTmp.Height() * 72 + 63) / 127; + aTmp.Width() = ( aTmp.Width() * 72 + 63) / 127; + } + + aVal = aTmp; + } + + return bRet; +} + + + diff --git a/svl/source/items/tfrmitem.cxx b/svl/source/items/tfrmitem.cxx new file mode 100644 index 000000000000..a7019ff69947 --- /dev/null +++ b/svl/source/items/tfrmitem.cxx @@ -0,0 +1,184 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: tfrmitem.cxx,v $ + * $Revision: 1.8 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include + +#include +#include +#include + +#include + +DBG_NAME( SfxTargetFrameItem ) +TYPEINIT1( SfxTargetFrameItem, SfxPoolItem ); + +// ----------------------------------------------------------------------- + +SfxTargetFrameItem::SfxTargetFrameItem( USHORT which ) : + SfxPoolItem( which ) +{ + DBG_CTOR( SfxTargetFrameItem, 0 ); +} + +// ----------------------------------------------------------------------- + +SfxTargetFrameItem::SfxTargetFrameItem( const SfxTargetFrameItem& rItem ) : + SfxPoolItem( rItem ) +{ + DBG_CTOR( SfxTargetFrameItem, 0 ); + for( USHORT nCur = 0; nCur <= (USHORT)SfxOpenModeLast; nCur++ ) + _aFrames[nCur] = rItem._aFrames[nCur]; +} + +// ----------------------------------------------------------------------- + +SfxTargetFrameItem::SfxTargetFrameItem( USHORT which, + const String& rOpenSelectFrame, const String& rOpenOpenFrame, + const String& rOpenAddTaskFrame ) : SfxPoolItem( which ) +{ + DBG_CTOR( SfxTargetFrameItem, 0 ); + _aFrames[ (USHORT)SfxOpenSelect ] = rOpenSelectFrame; + _aFrames[ (USHORT)SfxOpenOpen ] = rOpenOpenFrame; + _aFrames[ (USHORT)SfxOpenAddTask ] = rOpenAddTaskFrame; +} + +// ----------------------------------------------------------------------- + +SfxTargetFrameItem::~SfxTargetFrameItem() +{ + DBG_DTOR(SfxTargetFrameItem, 0); +} + +// ----------------------------------------------------------------------- + +String SfxTargetFrameItem::GetTargetFrame( SfxOpenMode eMode ) const +{ + DBG_CHKTHIS( SfxTargetFrameItem, 0 ); + if( eMode <= SfxOpenModeLast ) + return _aFrames[ (USHORT)eMode ]; + String aResult; + return aResult; +} + +// ----------------------------------------------------------------------- + +int SfxTargetFrameItem::operator==( const SfxPoolItem& rItem ) const +{ + DBG_CHKTHIS( SfxTargetFrameItem, 0 ); + DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); + + for( USHORT nCur = 0; nCur <= (USHORT)SfxOpenModeLast; nCur++ ) + { + if( _aFrames[nCur] != ((const SfxTargetFrameItem&)rItem)._aFrames[nCur] ) + return 0; + } + return 1; +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxTargetFrameItem::Create( SvStream& rStream, USHORT ) const +{ + DBG_CHKTHIS(SfxTargetFrameItem, 0); + SfxTargetFrameItem* pItem = new SfxTargetFrameItem( Which() ); + USHORT nCount = 0; + rStream >> nCount; + for(USHORT nCur=0; nCur<= (USHORT)SfxOpenModeLast && nCount; nCur++,nCount--) + { + readByteString(rStream, pItem->_aFrames[ nCur ]); + } + // die uebriggebliebenen ueberspringen + String aTemp; + while( nCount ) + { + readByteString(rStream, aTemp); + nCount--; + } + return pItem; +} + +// ----------------------------------------------------------------------- + +SvStream& SfxTargetFrameItem::Store( SvStream& rStream, USHORT ) const +{ + DBG_CHKTHIS( SfxTargetFrameItem, 0 ); + USHORT nCount = (USHORT)(SfxOpenModeLast+1); + rStream << nCount; + for( USHORT nCur = 0; nCur <= (USHORT)SfxOpenModeLast; nCur++ ) + { + writeByteString(rStream, _aFrames[ nCur ]); + } + return rStream; +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxTargetFrameItem::Clone( SfxItemPool* ) const +{ + DBG_CHKTHIS( SfxTargetFrameItem, 0 ); + return new SfxTargetFrameItem( *this ); +} + +// ----------------------------------------------------------------------- +// virtual +BOOL SfxTargetFrameItem::QueryValue( com::sun::star::uno::Any& rVal,BYTE ) const +{ + String aVal; + for ( int i = 0; i <= SfxOpenModeLast; i++ ) + { + aVal += _aFrames[ i ]; + aVal += ';' ; + } + + rVal <<= rtl::OUString( aVal ); + return TRUE; +} + +// ----------------------------------------------------------------------- +// virtual +BOOL SfxTargetFrameItem::PutValue( const com::sun::star::uno::Any& rVal,BYTE ) +{ + rtl::OUString aValue; + if ( rVal >>= aValue ) + { + const String aVal( aValue ); + + for ( USHORT i = 0; i <= SfxOpenModeLast; i++ ) + _aFrames[ i ] = aVal.GetToken( i ); + + return TRUE; + } + + DBG_ERROR( "SfxTargetFrameItem::PutValue - Wrong type!" ); + return FALSE; +} + diff --git a/svl/source/items/tresitem.cxx b/svl/source/items/tresitem.cxx new file mode 100644 index 000000000000..6e70c82a4d03 --- /dev/null +++ b/svl/source/items/tresitem.cxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: tresitem.cxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include + +using namespace com::sun::star; + +//============================================================================ +// +// CntTransferResultItem +// +//============================================================================ + +TYPEINIT1_AUTOFACTORY(CntTransferResultItem, SfxPoolItem) + +//============================================================================ +// virtual +int CntTransferResultItem::operator ==(SfxPoolItem const & rItem) const +{ + if (CntTransferResultItem * pResultItem = PTR_CAST(CntTransferResultItem, + &rItem)) + return m_aResult.Source == pResultItem->m_aResult.Source + && m_aResult.Target == pResultItem->m_aResult.Target + && m_aResult.Result == pResultItem->m_aResult.Result; + return false; +} + +//============================================================================ +// virtual +BOOL CntTransferResultItem::QueryValue(uno::Any & rVal, BYTE) const +{ + rVal <<= m_aResult; + return true; +} + +//============================================================================ +// virtual +BOOL CntTransferResultItem::PutValue(uno::Any const & rVal, BYTE) +{ + return rVal >>= m_aResult; +} + +//============================================================================ +// virtual +SfxPoolItem * CntTransferResultItem::Clone(SfxItemPool *) const +{ + return new CntTransferResultItem(*this); +} + diff --git a/svl/source/items/visitem.cxx b/svl/source/items/visitem.cxx new file mode 100644 index 000000000000..112b223a8be0 --- /dev/null +++ b/svl/source/items/visitem.cxx @@ -0,0 +1,148 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: visitem.cxx,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include +#include +#include + +//============================================================================ +// +// class SfxVisibilityItem +// +//============================================================================ + +DBG_NAME(SfxVisibilityItem) + +//============================================================================ +TYPEINIT1_AUTOFACTORY(SfxVisibilityItem, SfxPoolItem); + +//============================================================================ +SfxVisibilityItem::SfxVisibilityItem(USHORT which, SvStream & rStream): + SfxPoolItem(which) +{ + DBG_CTOR(SfxVisibilityItem, 0); + sal_Bool bValue = 0; + rStream >> bValue; + m_nValue.bVisible = bValue; +} + +//============================================================================ +// virtual +int SfxVisibilityItem::operator ==(const SfxPoolItem & rItem) const +{ + DBG_CHKTHIS(SfxVisibilityItem, 0); + DBG_ASSERT(SfxPoolItem::operator ==(rItem), "unequal type"); + return m_nValue.bVisible == SAL_STATIC_CAST(const SfxVisibilityItem *, &rItem)-> + m_nValue.bVisible; +} + +//============================================================================ +// virtual +int SfxVisibilityItem::Compare(const SfxPoolItem & rWith) const +{ + DBG_ASSERT(rWith.ISA(SfxVisibilityItem), "SfxVisibilityItem::Compare(): Bad type"); + return m_nValue.bVisible == static_cast< SfxVisibilityItem const * >(&rWith)->m_nValue.bVisible ? + 0 : m_nValue.bVisible ? -1 : 1; +} + +//============================================================================ +// virtual +SfxItemPresentation SfxVisibilityItem::GetPresentation(SfxItemPresentation, + SfxMapUnit, SfxMapUnit, + XubString & rText, + const IntlWrapper *) const +{ + rText = GetValueTextByVal(m_nValue.bVisible); + return SFX_ITEM_PRESENTATION_NAMELESS; +} + + +//============================================================================ +// virtual +BOOL SfxVisibilityItem::QueryValue(com::sun::star::uno::Any& rVal,BYTE) const +{ + rVal <<= m_nValue; + return TRUE; +} + +//============================================================================ +// virtual +BOOL SfxVisibilityItem::PutValue(const com::sun::star::uno::Any& rVal,BYTE) +{ + if (rVal >>= m_nValue) + return TRUE; + + DBG_ERROR( "SfxInt16Item::PutValue - Wrong type!" ); + return FALSE; +} + +//============================================================================ +// virtual +SfxPoolItem * SfxVisibilityItem::Create(SvStream & rStream, USHORT) const +{ + DBG_CHKTHIS(SfxVisibilityItem, 0); + return new SfxVisibilityItem(Which(), rStream); +} + +//============================================================================ +// virtual +SvStream & SfxVisibilityItem::Store(SvStream & rStream, USHORT) const +{ + DBG_CHKTHIS(SfxVisibilityItem, 0); + rStream << m_nValue.bVisible; + return rStream; +} + +//============================================================================ +// virtual +SfxPoolItem * SfxVisibilityItem::Clone(SfxItemPool *) const +{ + DBG_CHKTHIS(SfxVisibilityItem, 0); + return new SfxVisibilityItem(*this); +} + +//============================================================================ +// virtual +USHORT SfxVisibilityItem::GetValueCount() const +{ + return 2; +} + +//============================================================================ +// virtual +UniString SfxVisibilityItem::GetValueTextByVal(BOOL bTheValue) const +{ + return + bTheValue ? + UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("TRUE")) : + UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("FALSE")); +} diff --git a/svl/source/items/whassert.hxx b/svl/source/items/whassert.hxx new file mode 100644 index 000000000000..fe9a834816c2 --- /dev/null +++ b/svl/source/items/whassert.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: whassert.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SFX_WHASSERT_HXX +#define _SFX_WHASSERT_HXX + +#include +#include + +//------------------------------------------------------------------------ + +#ifdef DBG_UTIL +#define SFX_ASSERT( bCondition, nId, sMessage ) \ +{ \ + if ( DbgIsAssert() ) \ + { \ + if ( !(bCondition) ) \ + { \ + ByteString aMsg( sMessage ); \ + aMsg.Append(RTL_CONSTASCII_STRINGPARAM("\nwith Id/Pos: ")); \ + aMsg += ByteString::CreateFromInt32( nId ); \ + DbgOut( aMsg.GetBuffer(), DBG_OUT_ERROR, __FILE__, __LINE__); \ + } \ + } \ +} +#else +#define SFX_ASSERT( bCondition, nId, sMessage ) +#endif + + +#endif diff --git a/svl/source/items/whiter.cxx b/svl/source/items/whiter.cxx new file mode 100644 index 000000000000..461daf7ac012 --- /dev/null +++ b/svl/source/items/whiter.cxx @@ -0,0 +1,127 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: whiter.cxx,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +// INCLUDE --------------------------------------------------------------- +#ifndef GCC +#endif + +#include "whiter.hxx" +#include + +DBG_NAME(SfxWhichIter) + +// ----------------------------------------------------------------------- + +SfxWhichIter::SfxWhichIter( const SfxItemSet& rSet, USHORT nFromWh, USHORT nToWh ): + pRanges(rSet.GetRanges()), + pStart(rSet.GetRanges()), + nOfst(0), nFrom(nFromWh), nTo(nToWh) +{ + DBG_CTOR(SfxWhichIter, 0); + if ( nFrom > 0 ) + FirstWhich(); +} + +// ----------------------------------------------------------------------- + +SfxWhichIter::~SfxWhichIter() +{ + DBG_DTOR(SfxWhichIter, 0); +} + +// ----------------------------------------------------------------------- + +USHORT SfxWhichIter::NextWhich() +{ + DBG_CHKTHIS(SfxWhichIter, 0); + while ( 0 != *pRanges ) + { + const USHORT nLastWhich = *pRanges + nOfst; + ++nOfst; + if (*(pRanges+1) == nLastWhich) + { + pRanges += 2; + nOfst = 0; + } + USHORT nWhich = *pRanges + nOfst; + if ( 0 == nWhich || ( nWhich >= nFrom && nWhich <= nTo ) ) + return nWhich; + } + return 0; +} + +// ----------------------------------------------------------------------- + +USHORT SfxWhichIter::PrevWhich() +{ + DBG_CHKTHIS(SfxWhichIter, 0); + while ( pRanges != pStart || 0 != nOfst ) + { + if(nOfst) + --nOfst; + else { + pRanges -= 2; + nOfst = *(pRanges+1) - (*pRanges); + } + USHORT nWhich = *pRanges + nOfst; + if ( nWhich >= nFrom && nWhich <= nTo ) + return nWhich; + } + return 0; +} + +// ----------------------------------------------------------------------- + +USHORT SfxWhichIter::FirstWhich() +{ + DBG_CHKTHIS(SfxWhichIter, 0); + pRanges = pStart; + nOfst = 0; + if ( *pRanges >= nFrom && *pRanges <= nTo ) + return *pRanges; + return NextWhich(); +} + +// ----------------------------------------------------------------------- + +USHORT SfxWhichIter::LastWhich() +{ + DBG_CHKTHIS(SfxWhichIter, 0); + while(*pRanges) + ++pRanges; + nOfst = 0; + USHORT nWhich = *(pRanges-1); + if ( nWhich >= nFrom && nWhich <= nTo ) + return nWhich; + return PrevWhich(); +} + diff --git a/svl/source/memtools/makefile.mk b/svl/source/memtools/makefile.mk new file mode 100644 index 000000000000..4592bceff8cc --- /dev/null +++ b/svl/source/memtools/makefile.mk @@ -0,0 +1,50 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.5 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=svtools +TARGET=svarray + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/svl.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES=\ + $(SLO)$/svarray.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/svl/source/memtools/svarray.cxx b/svl/source/memtools/svarray.cxx new file mode 100644 index 000000000000..fe682e5f535d --- /dev/null +++ b/svl/source/memtools/svarray.cxx @@ -0,0 +1,385 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: svarray.cxx,v $ + * $Revision: 1.8 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#define _SVARRAY_CXX + +#define _SVSTDARR_BOOLS +#define _SVSTDARR_BYTES +#define _SVSTDARR_ULONGS +#define _SVSTDARR_ULONGSSORT +#define _SVSTDARR_USHORTS +#define _SVSTDARR_LONGS +#define _SVSTDARR_LONGSSORT +#define _SVSTDARR_SHORTS +#define _SVSTDARR_STRINGS +#define _SVSTDARR_STRINGSDTOR +#define _SVSTDARR_STRINGSSORT +#define _SVSTDARR_STRINGSSORTDTOR +#define _SVSTDARR_STRINGSISORT +#define _SVSTDARR_STRINGSISORTDTOR +#define _SVSTDARR_USHORTSSORT + +#define _SVSTDARR_BYTESTRINGS +#define _SVSTDARR_BYTESTRINGSDTOR +#define _SVSTDARR_BYTESTRINGSSORT +#define _SVSTDARR_BYTESTRINGSSORTDTOR +#define _SVSTDARR_BYTESTRINGSISORT +#define _SVSTDARR_BYTESTRINGSISORTDTOR + +#define _SVSTDARR_XUB_STRLEN +#define _SVSTDARR_XUB_STRLENSORT + +#include +#include +#include + +SV_IMPL_VARARR(SvPtrarr,VoidPtr) +SV_IMPL_VARARR_PLAIN(SvPtrarrPlain,VoidPtr) + +USHORT SvPtrarr::GetPos( const VoidPtr& aElement ) const +{ USHORT n; + for( n=0; n < nA && *(GetData()+n) != aElement; ) n++; + return ( n >= nA ? USHRT_MAX : n ); +} + +USHORT SvPtrarrPlain::GetPos( const VoidPtr aElement ) const +{ USHORT n; + for( n=0; n < nA && *(GetData()+n) != aElement; ) n++; + return ( n >= nA ? USHRT_MAX : n ); +} + + +SV_IMPL_VARARR( SvBools, BOOL ) +SV_IMPL_VARARR( SvBytes, BYTE ) +SV_IMPL_VARARR( SvULongs, ULONG ) +SV_IMPL_VARARR( SvUShorts, USHORT ) +SV_IMPL_VARARR( SvLongs, long) +SV_IMPL_VARARR( SvShorts, short ) + +SV_IMPL_VARARR_SORT( SvULongsSort, ULONG ) +SV_IMPL_VARARR_SORT( SvLongsSort, long ) +SV_IMPL_VARARR_SORT( SvXub_StrLensSort, xub_StrLen ) + +SV_IMPL_VARARR( SvXub_StrLens, xub_StrLen ) + +SV_IMPL_PTRARR( SvStrings, StringPtr ) +SV_IMPL_PTRARR( SvStringsDtor, StringPtr ) +SV_IMPL_OP_PTRARR_SORT( SvStringsSort, StringPtr ) +SV_IMPL_OP_PTRARR_SORT( SvStringsSortDtor, StringPtr ) + +SV_IMPL_PTRARR( SvByteStrings, ByteStringPtr ) +SV_IMPL_PTRARR( SvByteStringsDtor, ByteStringPtr ) +SV_IMPL_OP_PTRARR_SORT( SvByteStringsSort, ByteStringPtr ) +SV_IMPL_OP_PTRARR_SORT( SvByteStringsSortDtor, ByteStringPtr ) + + + +// ---------------- strings ------------------------------------- + +// Array mit anderer Seek-Methode! +_SV_IMPL_SORTAR_ALG( SvStringsISort, StringPtr ) +void SvStringsISort::DeleteAndDestroy( USHORT nP, USHORT nL ) +{ + if( nL ) + { + DBG_ASSERT( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" ); + for( USHORT n=nP; n < nP + nL; n++ ) + delete *((StringPtr*)pData+n); + SvPtrarr::Remove( nP, nL ); + } +} +BOOL SvStringsISort::Seek_Entry( const StringPtr aE, USHORT* pP ) const +{ + register USHORT nO = SvStringsISort_SAR::Count(), + nM, + nU = 0; + if( nO > 0 ) + { + nO--; + while( nU <= nO ) + { + nM = nU + ( nO - nU ) / 2; + StringCompare eCmp = (*((StringPtr*)pData + nM))-> + CompareIgnoreCaseToAscii( *(aE) ); + if( COMPARE_EQUAL == eCmp ) + { + if( pP ) *pP = nM; + return TRUE; + } + else if( COMPARE_LESS == eCmp ) + nU = nM + 1; + else if( nM == 0 ) + { + if( pP ) *pP = nU; + return FALSE; + } + else + nO = nM - 1; + } + } + if( pP ) *pP = nU; + return FALSE; +} + +// ---------------- strings ------------------------------------- + +// Array mit anderer Seek-Methode! +_SV_IMPL_SORTAR_ALG( SvStringsISortDtor, StringPtr ) +void SvStringsISortDtor::DeleteAndDestroy( USHORT nP, USHORT nL ) +{ + if( nL ) + { + DBG_ASSERT( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" ); + for( USHORT n=nP; n < nP + nL; n++ ) + delete *((StringPtr*)pData+n); + SvPtrarr::Remove( nP, nL ); + } +} +BOOL SvStringsISortDtor::Seek_Entry( const StringPtr aE, USHORT* pP ) const +{ + register USHORT nO = SvStringsISortDtor_SAR::Count(), + nM, + nU = 0; + if( nO > 0 ) + { + nO--; + while( nU <= nO ) + { + nM = nU + ( nO - nU ) / 2; + StringCompare eCmp = (*((StringPtr*)pData + nM))-> + CompareIgnoreCaseToAscii( *(aE) ); + if( COMPARE_EQUAL == eCmp ) + { + if( pP ) *pP = nM; + return TRUE; + } + else if( COMPARE_LESS == eCmp ) + nU = nM + 1; + else if( nM == 0 ) + { + if( pP ) *pP = nU; + return FALSE; + } + else + nO = nM - 1; + } + } + if( pP ) *pP = nU; + return FALSE; +} + +// ---------------- Ushorts ------------------------------------- + +/* SortArray fuer UShorts */ +BOOL SvUShortsSort::Seek_Entry( const USHORT aE, USHORT* pP ) const +{ + register USHORT nO = SvUShorts::Count(), + nM, + nU = 0; + if( nO > 0 ) + { + nO--; + while( nU <= nO ) + { + nM = nU + ( nO - nU ) / 2; + if( *(pData + nM) == aE ) + { + if( pP ) *pP = nM; + return TRUE; + } + else if( *(pData + nM) < aE ) + nU = nM + 1; + else if( nM == 0 ) + { + if( pP ) *pP = nU; + return FALSE; + } + else + nO = nM - 1; + } + } + if( pP ) *pP = nU; + return FALSE; +} + +void SvUShortsSort::Insert( const SvUShortsSort * pI, USHORT nS, USHORT nE ) +{ + if( USHRT_MAX == nE ) + nE = pI->Count(); + USHORT nP; + const USHORT * pIArr = pI->GetData(); + for( ; nS < nE; ++nS ) + { + if( ! Seek_Entry( *(pIArr+nS), &nP) ) + SvUShorts::Insert( *(pIArr+nS), nP ); + if( ++nP >= Count() ) + { + SvUShorts::Insert( pI, nP, nS+1, nE ); + nS = nE; + } + } +} + +BOOL SvUShortsSort::Insert( const USHORT aE ) +{ + USHORT nP; + BOOL bExist = Seek_Entry( aE, &nP ); + if( !bExist ) + SvUShorts::Insert( aE, nP ); + return !bExist; +} + +BOOL SvUShortsSort::Insert( const USHORT aE, USHORT& rP ) +{ + BOOL bExist = Seek_Entry( aE, &rP ); + if( !bExist ) + SvUShorts::Insert( aE, rP ); + return !bExist; +} + +void SvUShortsSort::Insert( const USHORT* pE, USHORT nL) +{ + USHORT nP; + for( USHORT n = 0; n < nL; ++n ) + if( ! Seek_Entry( *(pE+n), &nP )) + SvUShorts::Insert( *(pE+n), nP ); +} + +// remove ab Pos +void SvUShortsSort::RemoveAt( const USHORT nP, USHORT nL ) +{ + if( nL ) + SvUShorts::Remove( nP, nL); +} + +// remove ab dem Eintrag +void SvUShortsSort::Remove( const USHORT aE, USHORT nL ) +{ + USHORT nP; + if( nL && Seek_Entry( aE, &nP ) ) + SvUShorts::Remove( nP, nL); +} + +// ---------------- bytestrings ------------------------------------- + +// Array mit anderer Seek-Methode! +_SV_IMPL_SORTAR_ALG( SvByteStringsISort, ByteStringPtr ) +void SvByteStringsISort::DeleteAndDestroy( USHORT nP, USHORT nL ) +{ + if( nL ) + { + DBG_ASSERT( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" ); + for( USHORT n=nP; n < nP + nL; n++ ) + delete *((ByteStringPtr*)pData+n); + SvPtrarr::Remove( nP, nL ); + } +} +BOOL SvByteStringsISort::Seek_Entry( const ByteStringPtr aE, USHORT* pP ) const +{ + register USHORT nO = SvByteStringsISort_SAR::Count(), + nM, + nU = 0; + if( nO > 0 ) + { + nO--; + while( nU <= nO ) + { + nM = nU + ( nO - nU ) / 2; + StringCompare eCmp = (*((ByteStringPtr*)pData + nM))-> + CompareIgnoreCaseToAscii( *(aE) ); + if( COMPARE_EQUAL == eCmp ) + { + if( pP ) *pP = nM; + return TRUE; + } + else if( COMPARE_LESS == eCmp ) + nU = nM + 1; + else if( nM == 0 ) + { + if( pP ) *pP = nU; + return FALSE; + } + else + nO = nM - 1; + } + } + if( pP ) *pP = nU; + return FALSE; +} + + +// Array mit anderer Seek-Methode! +_SV_IMPL_SORTAR_ALG( SvByteStringsISortDtor, ByteStringPtr ) +void SvByteStringsISortDtor::DeleteAndDestroy( USHORT nP, USHORT nL ) +{ + if( nL ) + { + DBG_ASSERT( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" ); + for( USHORT n=nP; n < nP + nL; n++ ) + delete *((ByteStringPtr*)pData+n); + SvPtrarr::Remove( nP, nL ); + } +} +BOOL SvByteStringsISortDtor::Seek_Entry( const ByteStringPtr aE, USHORT* pP ) const +{ + register USHORT nO = SvByteStringsISortDtor_SAR::Count(), + nM, + nU = 0; + if( nO > 0 ) + { + nO--; + while( nU <= nO ) + { + nM = nU + ( nO - nU ) / 2; + StringCompare eCmp = (*((ByteStringPtr*)pData + nM))-> + CompareIgnoreCaseToAscii( *(aE) ); + if( COMPARE_EQUAL == eCmp ) + { + if( pP ) *pP = nM; + return TRUE; + } + else if( COMPARE_LESS == eCmp ) + nU = nM + 1; + else if( nM == 0 ) + { + if( pP ) *pP = nU; + return FALSE; + } + else + nO = nM - 1; + } + } + if( pP ) *pP = nU; + return FALSE; +} + diff --git a/svl/source/misc/PasswordHelper.cxx b/svl/source/misc/PasswordHelper.cxx new file mode 100644 index 000000000000..53c447bde830 --- /dev/null +++ b/svl/source/misc/PasswordHelper.cxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: PasswordHelper.cxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + + +#ifndef GCC +#endif +#include "PasswordHelper.hxx" +#include +#include + +using namespace com::sun::star; + +void SvPasswordHelper::GetHashPassword(uno::Sequence& rPassHash, const sal_Char* pPass, sal_uInt32 nLen) +{ + rPassHash.realloc(RTL_DIGEST_LENGTH_SHA1); + + rtlDigestError aError = rtl_digest_SHA1 (pPass, nLen, reinterpret_cast(rPassHash.getArray()), rPassHash.getLength()); + if (aError != rtl_Digest_E_None) + { + rPassHash.realloc(0); + } +} + +void SvPasswordHelper::GetHashPasswordLittleEndian(uno::Sequence& rPassHash, const String& sPass) +{ + xub_StrLen nSize(sPass.Len()); + sal_Char* pCharBuffer = new sal_Char[nSize * sizeof(sal_Unicode)]; + + for (xub_StrLen i = 0; i < nSize; ++i) + { + sal_Unicode ch(sPass.GetChar(i)); + pCharBuffer[2 * i] = static_cast< sal_Char >(ch & 0xFF); + pCharBuffer[2 * i + 1] = static_cast< sal_Char >(ch >> 8); + } + + GetHashPassword(rPassHash, pCharBuffer, nSize * sizeof(sal_Unicode)); + + delete[] pCharBuffer; +} + +void SvPasswordHelper::GetHashPasswordBigEndian(uno::Sequence& rPassHash, const String& sPass) +{ + xub_StrLen nSize(sPass.Len()); + sal_Char* pCharBuffer = new sal_Char[nSize * sizeof(sal_Unicode)]; + + for (xub_StrLen i = 0; i < nSize; ++i) + { + sal_Unicode ch(sPass.GetChar(i)); + pCharBuffer[2 * i] = static_cast< sal_Char >(ch >> 8); + pCharBuffer[2 * i + 1] = static_cast< sal_Char >(ch & 0xFF); + } + + GetHashPassword(rPassHash, pCharBuffer, nSize * sizeof(sal_Unicode)); + + delete[] pCharBuffer; +} + +void SvPasswordHelper::GetHashPassword(uno::Sequence& rPassHash, const String& sPass) +{ + GetHashPasswordLittleEndian(rPassHash, sPass); +} + +bool SvPasswordHelper::CompareHashPassword(const uno::Sequence& rOldPassHash, const String& sNewPass) +{ + bool bResult = false; + + uno::Sequence aNewPass(RTL_DIGEST_LENGTH_SHA1); + GetHashPasswordLittleEndian(aNewPass, sNewPass); + if (aNewPass == rOldPassHash) + bResult = true; + else + { + GetHashPasswordBigEndian(aNewPass, sNewPass); + bResult = (aNewPass == rOldPassHash); + } + + return bResult; +} + diff --git a/svl/source/misc/adrparse.cxx b/svl/source/misc/adrparse.cxx new file mode 100644 index 000000000000..37c25d6c669f --- /dev/null +++ b/svl/source/misc/adrparse.cxx @@ -0,0 +1,921 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: adrparse.cxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include +#include + +namespace unnamed_svtools_adrparse {} +using namespace unnamed_svtools_adrparse; + // unnamed namespaces don't work well yet + +//============================================================================ +namespace unnamed_svtools_adrparse { + +enum ElementType { ELEMENT_START, ELEMENT_DELIM, ELEMENT_ITEM, ELEMENT_END }; + +//============================================================================ +struct ParsedAddrSpec +{ + sal_Unicode const * m_pBegin; + sal_Unicode const * m_pEnd; + ElementType m_eLastElem; + bool m_bAtFound; + bool m_bReparse; + + ParsedAddrSpec() { reset(); } + + bool isPoorlyValid() const { return m_eLastElem >= ELEMENT_ITEM; } + + bool isValid() const { return isPoorlyValid() && m_bAtFound; } + + inline void reset(); + + inline void finish(); +}; + +inline void ParsedAddrSpec::reset() +{ + m_pBegin = 0; + m_pEnd = 0; + m_eLastElem = ELEMENT_START; + m_bAtFound = false; + m_bReparse = false; +} + +inline void ParsedAddrSpec::finish() +{ + if (isPoorlyValid()) + m_eLastElem = ELEMENT_END; + else + reset(); +} + +} + +//============================================================================ +class SvAddressParser_Impl +{ + enum State { BEFORE_COLON, BEFORE_LESS, AFTER_LESS, AFTER_GREATER }; + + enum TokenType { TOKEN_QUOTED = 0x80000000, TOKEN_DOMAIN, TOKEN_COMMENT, + TOKEN_ATOM }; + + sal_Unicode const * m_pInputPos; + sal_Unicode const * m_pInputEnd; + sal_uInt32 m_nCurToken; + sal_Unicode const * m_pCurTokenBegin; + sal_Unicode const * m_pCurTokenEnd; + sal_Unicode const * m_pCurTokenContentBegin; + sal_Unicode const * m_pCurTokenContentEnd; + bool m_bCurTokenReparse; + ParsedAddrSpec m_aOuterAddrSpec; + ParsedAddrSpec m_aInnerAddrSpec; + ParsedAddrSpec * m_pAddrSpec; + sal_Unicode const * m_pRealNameBegin; + sal_Unicode const * m_pRealNameEnd; + sal_Unicode const * m_pRealNameContentBegin; + sal_Unicode const * m_pRealNameContentEnd; + bool m_bRealNameReparse; + bool m_bRealNameFinished; + sal_Unicode const * m_pFirstCommentBegin; + sal_Unicode const * m_pFirstCommentEnd; + bool m_bFirstCommentReparse; + State m_eState; + TokenType m_eType; + + inline void resetRealNameAndFirstComment(); + + inline void reset(); + + inline void addTokenToAddrSpec(ElementType eTokenElem); + + inline void addTokenToRealName(); + + bool readToken(); + + static UniString reparse(sal_Unicode const * pBegin, + sal_Unicode const * pEnd, bool bAddrSpec); + + static UniString reparseComment(sal_Unicode const * pBegin, + sal_Unicode const * pEnd); + +public: + SvAddressParser_Impl(SvAddressParser * pParser, UniString const & rInput); +}; + +inline void SvAddressParser_Impl::resetRealNameAndFirstComment() +{ + m_pRealNameBegin = 0; + m_pRealNameEnd = 0; + m_pRealNameContentBegin = 0; + m_pRealNameContentEnd = 0; + m_bRealNameReparse = false; + m_bRealNameFinished = false; + m_pFirstCommentBegin = 0; + m_pFirstCommentEnd = 0; + m_bFirstCommentReparse = false; +} + +inline void SvAddressParser_Impl::reset() +{ + m_aOuterAddrSpec.reset(); + m_aInnerAddrSpec.reset(); + m_pAddrSpec = &m_aOuterAddrSpec; + resetRealNameAndFirstComment(); + m_eState = BEFORE_COLON; + m_eType = TOKEN_ATOM; +} + +inline void SvAddressParser_Impl::addTokenToAddrSpec(ElementType eTokenElem) +{ + if (!m_pAddrSpec->m_pBegin) + m_pAddrSpec->m_pBegin = m_pCurTokenBegin; + else if (m_pAddrSpec->m_pEnd < m_pCurTokenBegin) + m_pAddrSpec->m_bReparse = true; + m_pAddrSpec->m_pEnd = m_pCurTokenEnd; + m_pAddrSpec->m_eLastElem = eTokenElem; +} + +inline void SvAddressParser_Impl::addTokenToRealName() +{ + if (!m_bRealNameFinished && m_eState != AFTER_LESS) + { + if (!m_pRealNameBegin) + m_pRealNameBegin = m_pRealNameContentBegin = m_pCurTokenBegin; + else if (m_pRealNameEnd < m_pCurTokenBegin - 1 + || (m_pRealNameEnd == m_pCurTokenBegin - 1 + && *m_pRealNameEnd != ' ')) + m_bRealNameReparse = true; + m_pRealNameEnd = m_pRealNameContentEnd = m_pCurTokenEnd; + } +} + +//============================================================================ +// +// SvAddressParser_Impl +// +//============================================================================ + +bool SvAddressParser_Impl::readToken() +{ + m_nCurToken = m_eType; + m_bCurTokenReparse = false; + switch (m_eType) + { + case TOKEN_QUOTED: + { + m_pCurTokenBegin = m_pInputPos - 1; + m_pCurTokenContentBegin = m_pInputPos; + bool bEscaped = false; + for (;;) + { + if (m_pInputPos >= m_pInputEnd) + return false; + sal_Unicode cChar = *m_pInputPos++; + if (bEscaped) + { + m_bCurTokenReparse = true; + bEscaped = false; + } + else if (cChar == '"') + { + m_pCurTokenEnd = m_pInputPos; + m_pCurTokenContentEnd = m_pInputPos - 1; + return true; + } + else if (cChar == '\\') + bEscaped = true; + } + } + + case TOKEN_DOMAIN: + { + m_pCurTokenBegin = m_pInputPos - 1; + m_pCurTokenContentBegin = m_pInputPos; + bool bEscaped = false; + for (;;) + { + if (m_pInputPos >= m_pInputEnd) + return false; + sal_Unicode cChar = *m_pInputPos++; + if (bEscaped) + bEscaped = false; + else if (cChar == ']') + { + m_pCurTokenEnd = m_pInputPos; + return true; + } + else if (cChar == '\\') + bEscaped = true; + } + } + + case TOKEN_COMMENT: + { + m_pCurTokenBegin = m_pInputPos - 1; + m_pCurTokenContentBegin = 0; + m_pCurTokenContentEnd = 0; + bool bEscaped = false; + xub_StrLen nLevel = 0; + for (;;) + { + if (m_pInputPos >= m_pInputEnd) + return false; + sal_Unicode cChar = *m_pInputPos++; + if (bEscaped) + { + m_bCurTokenReparse = true; + m_pCurTokenContentEnd = m_pInputPos; + bEscaped = false; + } + else if (cChar == '(') + { + if (!m_pCurTokenContentBegin) + m_pCurTokenContentBegin = m_pInputPos - 1; + m_pCurTokenContentEnd = m_pInputPos; + ++nLevel; + } + else if (cChar == ')') + if (nLevel) + { + m_pCurTokenContentEnd = m_pInputPos; + --nLevel; + } + else + return true; + else if (cChar == '\\') + { + if (!m_pCurTokenContentBegin) + m_pCurTokenContentBegin = m_pInputPos - 1; + bEscaped = true; + } + else if (cChar > ' ' && cChar != 0x7F) // DEL + { + if (!m_pCurTokenContentBegin) + m_pCurTokenContentBegin = m_pInputPos - 1; + m_pCurTokenContentEnd = m_pInputPos; + } + } + } + + default: + { + sal_Unicode cChar; + for (;;) + { + if (m_pInputPos >= m_pInputEnd) + return false; + cChar = *m_pInputPos++; + if (cChar > ' ' && cChar != 0x7F) // DEL + break; + } + m_pCurTokenBegin = m_pInputPos - 1; + if (cChar == '"' || cChar == '(' || cChar == ')' || cChar == ',' + || cChar == '.' || cChar == ':' || cChar == ';' + || cChar == '<' || cChar == '>' || cChar == '@' + || cChar == '[' || cChar == '\\' || cChar == ']') + { + m_nCurToken = cChar; + m_pCurTokenEnd = m_pInputPos; + return true; + } + else + for (;;) + { + if (m_pInputPos >= m_pInputEnd) + { + m_pCurTokenEnd = m_pInputPos; + return true; + } + cChar = *m_pInputPos++; + if (cChar <= ' ' || cChar == '"' || cChar == '(' + || cChar == ')' || cChar == ',' || cChar == '.' + || cChar == ':' || cChar == ';' || cChar == '<' + || cChar == '>' || cChar == '@' || cChar == '[' + || cChar == '\\' || cChar == ']' + || cChar == 0x7F) // DEL + { + m_pCurTokenEnd = --m_pInputPos; + return true; + } + } + } + } +} + +//============================================================================ +// static +UniString SvAddressParser_Impl::reparse(sal_Unicode const * pBegin, + sal_Unicode const * pEnd, + bool bAddrSpec) +{ + UniString aResult; + TokenType eMode = TOKEN_ATOM; + bool bEscaped = false; + bool bEndsWithSpace = false; + xub_StrLen nLevel = 0; + while (pBegin < pEnd) + { + sal_Unicode cChar = *pBegin++; + switch (eMode) + { + case TOKEN_QUOTED: + if (bEscaped) + { + aResult += cChar; + bEscaped = false; + } + else if (cChar == '"') + { + if (bAddrSpec) + aResult += cChar; + eMode = TOKEN_ATOM; + } + else if (cChar == '\\') + { + if (bAddrSpec) + aResult += cChar; + bEscaped = true; + } + else + aResult += cChar; + break; + + case TOKEN_DOMAIN: + if (bEscaped) + { + aResult += cChar; + bEscaped = false; + } + else if (cChar == ']') + { + aResult += cChar; + eMode = TOKEN_ATOM; + } + else if (cChar == '\\') + { + if (bAddrSpec) + aResult += cChar; + bEscaped = true; + } + else + aResult += cChar; + break; + + case TOKEN_COMMENT: + if (bEscaped) + bEscaped = false; + else if (cChar == '(') + ++nLevel; + else if (cChar == ')') + if (nLevel) + --nLevel; + else + eMode = TOKEN_ATOM; + else if (cChar == '\\') + bEscaped = true; + break; + + case TOKEN_ATOM: + if (cChar <= ' ' || cChar == 0x7F) // DEL + { + if (!bAddrSpec && !bEndsWithSpace) + { + aResult += ' '; + bEndsWithSpace = true; + } + } + else if (cChar == '(') + { + if (!bAddrSpec && !bEndsWithSpace) + { + aResult += ' '; + bEndsWithSpace = true; + } + eMode = TOKEN_COMMENT; + } + else + { + bEndsWithSpace = false; + if (cChar == '"') + { + if (bAddrSpec) + aResult += cChar; + eMode = TOKEN_QUOTED; + } + else if (cChar == '[') + { + aResult += cChar; + eMode = TOKEN_QUOTED; + } + else + aResult += cChar; + } + break; + } + } + return aResult; +} + +//============================================================================ +// static +UniString SvAddressParser_Impl::reparseComment(sal_Unicode const * pBegin, + sal_Unicode const * pEnd) +{ + UniString aResult; + while (pBegin < pEnd) + { + sal_Unicode cChar = *pBegin++; + if (cChar == '\\') + cChar = *pBegin++; + aResult += cChar; + } + return aResult; +} + +//============================================================================ +SvAddressParser_Impl::SvAddressParser_Impl(SvAddressParser * pParser, + UniString const & rInput) +{ + m_pInputPos = rInput.GetBuffer(); + m_pInputEnd = m_pInputPos + rInput.Len(); + + reset(); + bool bDone = false; + for (;;) + { + if (!readToken()) + { + m_bRealNameFinished = true; + if (m_eState == AFTER_LESS) + m_nCurToken = '>'; + else + { + m_nCurToken = ','; + bDone = true; + } + } + switch (m_nCurToken) + { + case TOKEN_QUOTED: + if (m_pAddrSpec->m_eLastElem != ELEMENT_END) + { + if (m_pAddrSpec->m_bAtFound + || m_pAddrSpec->m_eLastElem <= ELEMENT_DELIM) + m_pAddrSpec->reset(); + addTokenToAddrSpec(ELEMENT_ITEM); + } + if (!m_bRealNameFinished && m_eState != AFTER_LESS) + { + if (m_bCurTokenReparse) + { + if (!m_pRealNameBegin) + m_pRealNameBegin = m_pCurTokenBegin; + m_pRealNameEnd = m_pCurTokenEnd; + m_bRealNameReparse = true; + } + else if (m_bRealNameReparse) + m_pRealNameEnd = m_pCurTokenEnd; + else if (!m_pRealNameBegin) + { + m_pRealNameBegin = m_pCurTokenBegin; + m_pRealNameContentBegin = m_pCurTokenContentBegin; + m_pRealNameEnd = m_pRealNameContentEnd + = m_pCurTokenContentEnd; + } + else + { + m_pRealNameEnd = m_pCurTokenEnd; + m_bRealNameReparse = true; + } + } + m_eType = TOKEN_ATOM; + break; + + case TOKEN_DOMAIN: + if (m_pAddrSpec->m_eLastElem != ELEMENT_END) + { + if (m_pAddrSpec->m_bAtFound + && m_pAddrSpec->m_eLastElem == ELEMENT_DELIM) + addTokenToAddrSpec(ELEMENT_ITEM); + else + m_pAddrSpec->reset(); + } + addTokenToRealName(); + m_eType = TOKEN_ATOM; + break; + + case TOKEN_COMMENT: + if (!m_bRealNameFinished && m_eState != AFTER_LESS + && !m_pFirstCommentBegin && m_pCurTokenContentBegin) + { + m_pFirstCommentBegin = m_pCurTokenContentBegin; + m_pFirstCommentEnd = m_pCurTokenContentEnd; + m_bFirstCommentReparse = m_bCurTokenReparse; + } + m_eType = TOKEN_ATOM; + break; + + case TOKEN_ATOM: + if (m_pAddrSpec->m_eLastElem != ELEMENT_END) + { + if (m_pAddrSpec->m_eLastElem != ELEMENT_DELIM) + m_pAddrSpec->reset(); + addTokenToAddrSpec(ELEMENT_ITEM); + } + addTokenToRealName(); + break; + + case '(': + m_eType = TOKEN_COMMENT; + break; + + case ')': + case '\\': + case ']': + m_pAddrSpec->finish(); + addTokenToRealName(); + break; + + case '<': + switch (m_eState) + { + case BEFORE_COLON: + case BEFORE_LESS: + m_aOuterAddrSpec.finish(); + if (m_pRealNameBegin) + m_bRealNameFinished = true; + m_pAddrSpec = &m_aInnerAddrSpec; + m_eState = AFTER_LESS; + break; + + case AFTER_LESS: + m_aInnerAddrSpec.finish(); + break; + + case AFTER_GREATER: + m_aOuterAddrSpec.finish(); + addTokenToRealName(); + break; + } + break; + + case '>': + if (m_eState == AFTER_LESS) + { + m_aInnerAddrSpec.finish(); + if (m_aInnerAddrSpec.isValid()) + m_aOuterAddrSpec.m_eLastElem = ELEMENT_END; + m_pAddrSpec = &m_aOuterAddrSpec; + m_eState = AFTER_GREATER; + } + else + { + m_aOuterAddrSpec.finish(); + addTokenToRealName(); + } + break; + + case '@': + if (m_pAddrSpec->m_eLastElem != ELEMENT_END) + { + if (!m_pAddrSpec->m_bAtFound + && m_pAddrSpec->m_eLastElem == ELEMENT_ITEM) + { + addTokenToAddrSpec(ELEMENT_DELIM); + m_pAddrSpec->m_bAtFound = true; + } + else + m_pAddrSpec->reset(); + } + addTokenToRealName(); + break; + + case ',': + case ';': + if (m_eState == AFTER_LESS) + if (m_nCurToken == ',') + { + if (m_aInnerAddrSpec.m_eLastElem + != ELEMENT_END) + m_aInnerAddrSpec.reset(); + } + else + m_aInnerAddrSpec.finish(); + else + { + m_pAddrSpec = m_aInnerAddrSpec.isValid() + || (!m_aOuterAddrSpec.isValid() + && m_aInnerAddrSpec.isPoorlyValid()) ? + &m_aInnerAddrSpec : + m_aOuterAddrSpec.isPoorlyValid() ? + &m_aOuterAddrSpec : 0; + if (m_pAddrSpec) + { + UniString aTheAddrSpec; + if (m_pAddrSpec->m_bReparse) + aTheAddrSpec = reparse(m_pAddrSpec->m_pBegin, + m_pAddrSpec->m_pEnd, true); + else + { + xub_StrLen nLen = + sal::static_int_cast< xub_StrLen >( + m_pAddrSpec->m_pEnd + - m_pAddrSpec->m_pBegin); + if (nLen == rInput.Len()) + aTheAddrSpec = rInput; + else + aTheAddrSpec + = rInput.Copy( + sal::static_int_cast< xub_StrLen >( + m_pAddrSpec->m_pBegin + - rInput.GetBuffer()), + nLen); + } + UniString aTheRealName; + if (!m_pRealNameBegin + || (m_pAddrSpec == &m_aOuterAddrSpec + && m_pRealNameBegin + == m_aOuterAddrSpec.m_pBegin + && m_pRealNameEnd == m_aOuterAddrSpec.m_pEnd + && m_pFirstCommentBegin)) + if (!m_pFirstCommentBegin) + aTheRealName = aTheAddrSpec; + else if (m_bFirstCommentReparse) + aTheRealName + = reparseComment(m_pFirstCommentBegin, + m_pFirstCommentEnd); + else + aTheRealName + = rInput.Copy( + sal::static_int_cast< xub_StrLen >( + m_pFirstCommentBegin + - rInput.GetBuffer()), + sal::static_int_cast< xub_StrLen >( + m_pFirstCommentEnd + - m_pFirstCommentBegin)); + else if (m_bRealNameReparse) + aTheRealName = reparse(m_pRealNameBegin, + m_pRealNameEnd, false); + else + { + xub_StrLen nLen = + sal::static_int_cast< xub_StrLen >( + m_pRealNameContentEnd + - m_pRealNameContentBegin); + if (nLen == rInput.Len()) + aTheRealName = rInput; + else + aTheRealName + = rInput.Copy( + sal::static_int_cast< xub_StrLen >( + m_pRealNameContentBegin + - rInput.GetBuffer()), + nLen); + } + if (pParser->m_bHasFirst) + pParser->m_aRest.Insert(new SvAddressEntry_Impl( + aTheAddrSpec, + aTheRealName), + LIST_APPEND); + else + { + pParser->m_bHasFirst = true; + pParser->m_aFirst.m_aAddrSpec = aTheAddrSpec; + pParser->m_aFirst.m_aRealName = aTheRealName; + } + } + if (bDone) + return; + reset(); + } + break; + + case ':': + switch (m_eState) + { + case BEFORE_COLON: + m_aOuterAddrSpec.reset(); + resetRealNameAndFirstComment(); + m_eState = BEFORE_LESS; + break; + + case BEFORE_LESS: + case AFTER_GREATER: + m_aOuterAddrSpec.finish(); + addTokenToRealName(); + break; + + case AFTER_LESS: + m_aInnerAddrSpec.reset(); + break; + } + break; + + case '"': + m_eType = TOKEN_QUOTED; + break; + + case '.': + if (m_pAddrSpec->m_eLastElem != ELEMENT_END) + { + if (m_pAddrSpec->m_eLastElem != ELEMENT_DELIM) + addTokenToAddrSpec(ELEMENT_DELIM); + else + m_pAddrSpec->reset(); + } + addTokenToRealName(); + break; + + case '[': + m_eType = TOKEN_DOMAIN; + break; + } + } +} + +//============================================================================ +// +// SvAddressParser +// +//============================================================================ + +SvAddressParser::SvAddressParser(UniString const & rInput): m_bHasFirst(false) +{ + SvAddressParser_Impl(this, rInput); +} + +//============================================================================ +SvAddressParser::~SvAddressParser() +{ + for (ULONG i = m_aRest.Count(); i != 0;) + delete m_aRest.Remove(--i); +} + +//============================================================================ +// static +bool SvAddressParser::createRFC822Mailbox(String const & rPhrase, + String const & rAddrSpec, + String & rMailbox) +{ + String aTheAddrSpec; + sal_Unicode const * p = rAddrSpec.GetBuffer(); + sal_Unicode const * pEnd = p + rAddrSpec.Len(); + {for (bool bSegment = false;;) + { + p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); + if (p == pEnd) + return false; + if (bSegment) + { + sal_Unicode c = *p++; + if (c == '@') + break; + else if (c != '.') + return false; + aTheAddrSpec += '.'; + p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); + if (p == pEnd) + return false; + } + else + bSegment = true; + if (*p == '"') + { + aTheAddrSpec += *p++; + for (;;) + { + if (INetMIME::startsWithLineFolding(p, pEnd)) + p += 2; + if (p == pEnd) + return false; + if (*p == '"') + break; + if (*p == '\x0D' || (*p == '\\' && ++p == pEnd) + || !INetMIME::isUSASCII(*p)) + return false; + if (INetMIME::needsQuotedStringEscape(*p)) + aTheAddrSpec += '\\'; + aTheAddrSpec += *p++; + } + aTheAddrSpec += *p++; + } + else if (INetMIME::isAtomChar(*p)) + while (p != pEnd && INetMIME::isAtomChar(*p)) + aTheAddrSpec += *p++; + else + return false; + }} + aTheAddrSpec += '@'; + {for (bool bSegment = false;;) + { + p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); + if (p == pEnd) + { + if (bSegment) + break; + else + return false; + } + if (bSegment) + { + if (*p++ != '.') + return false; + aTheAddrSpec += '.'; + p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); + if (p == pEnd) + return false; + } + else + bSegment = true; + if (*p == '[') + { + aTheAddrSpec += *p++; + for (;;) + { + if (INetMIME::startsWithLineFolding(p, pEnd)) + p += 2; + if (p == pEnd) + return false; + if (*p == ']') + break; + if (*p == '\x0D' || *p == '[' || (*p == '\\' && ++p == pEnd) + || !INetMIME::isUSASCII(*p)) + return false; + if (*p >= '[' && *p <= ']') + aTheAddrSpec += '\\'; + aTheAddrSpec += *p++; + } + aTheAddrSpec += *p++; + } + else if (INetMIME::isAtomChar(*p)) + while (p != pEnd && INetMIME::isAtomChar(*p)) + aTheAddrSpec += *p++; + else + return false; + }} + + if (rPhrase.Len() == 0) + rMailbox = aTheAddrSpec; + else + { + bool bQuotedString = false; + p = rPhrase.GetBuffer(); + pEnd = p + rPhrase.Len(); + for (;p != pEnd; ++p) + if (!(INetMIME::isAtomChar(*p))) + { + bQuotedString = true; + break; + } + String aTheMailbox; + if (bQuotedString) + { + aTheMailbox = '"'; + for (p = rPhrase.GetBuffer(); p != pEnd; ++p) + { + if (INetMIME::needsQuotedStringEscape(*p)) + aTheMailbox += '\\'; + aTheMailbox += *p; + } + aTheMailbox += '"'; + } + else + aTheMailbox = rPhrase; + aTheMailbox.AppendAscii(RTL_CONSTASCII_STRINGPARAM(" <")); + aTheMailbox += aTheAddrSpec; + aTheMailbox += '>'; + rMailbox = aTheMailbox; + } + return true; +} + diff --git a/svl/source/misc/documentlockfile.cxx b/svl/source/misc/documentlockfile.cxx new file mode 100644 index 000000000000..1f54a6771f95 --- /dev/null +++ b/svl/source/misc/documentlockfile.cxx @@ -0,0 +1,238 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: documentlockfile.cxx,v $ + * + * $Revision: 1.3.82.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include + +#include + +#include + +#include + +using namespace ::com::sun::star; + +namespace svt { + +sal_Bool DocumentLockFile::m_bAllowInteraction = sal_True; + +// ---------------------------------------------------------------------- +DocumentLockFile::DocumentLockFile( const ::rtl::OUString& aOrigURL, const uno::Reference< lang::XMultiServiceFactory >& xFactory ) +: LockFileCommon( aOrigURL, xFactory, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".~lock." ) ) ) +{ +} + +// ---------------------------------------------------------------------- +DocumentLockFile::~DocumentLockFile() +{ +} + +// ---------------------------------------------------------------------- +void DocumentLockFile::WriteEntryToStream( uno::Sequence< ::rtl::OUString > aEntry, uno::Reference< io::XOutputStream > xOutput ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + ::rtl::OUStringBuffer aBuffer; + + for ( sal_Int32 nEntryInd = 0; nEntryInd < aEntry.getLength(); nEntryInd++ ) + { + aBuffer.append( EscapeCharacters( aEntry[nEntryInd] ) ); + if ( nEntryInd < aEntry.getLength() - 1 ) + aBuffer.append( (sal_Unicode)',' ); + else + aBuffer.append( (sal_Unicode)';' ); + } + + ::rtl::OString aStringData( ::rtl::OUStringToOString( aBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ) ); + uno::Sequence< sal_Int8 > aData( (sal_Int8*)aStringData.getStr(), aStringData.getLength() ); + xOutput->writeBytes( aData ); +} + +// ---------------------------------------------------------------------- +sal_Bool DocumentLockFile::CreateOwnLockFile() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + try + { + uno::Reference< io::XStream > xTempFile( + m_xFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.io.TempFile" ) ), + uno::UNO_QUERY_THROW ); + uno::Reference< io::XSeekable > xSeekable( xTempFile, uno::UNO_QUERY_THROW ); + + uno::Reference< io::XInputStream > xInput = xTempFile->getInputStream(); + uno::Reference< io::XOutputStream > xOutput = xTempFile->getOutputStream(); + + if ( !xInput.is() || !xOutput.is() ) + throw uno::RuntimeException(); + + uno::Sequence< ::rtl::OUString > aNewEntry = GenerateOwnEntry(); + WriteEntryToStream( aNewEntry, xOutput ); + xOutput->closeOutput(); + + xSeekable->seek( 0 ); + + uno::Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv; + ::ucbhelper::Content aTargetContent( m_aURL, xEnv ); + + ucb::InsertCommandArgument aInsertArg; + aInsertArg.Data = xInput; + aInsertArg.ReplaceExisting = sal_False; + uno::Any aCmdArg; + aCmdArg <<= aInsertArg; + aTargetContent.executeCommand( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ), aCmdArg ); + + // try to let the file be hidden if possible + try { + aTargetContent.setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsHidden" ) ), uno::makeAny( sal_True ) ); + } catch( uno::Exception& ) {} + } + catch( ucb::NameClashException& ) + { + return sal_False; + } + + return sal_True; +} + +// ---------------------------------------------------------------------- +uno::Sequence< ::rtl::OUString > DocumentLockFile::GetLockData() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + uno::Reference< io::XInputStream > xInput = OpenStream(); + if ( !xInput.is() ) + throw uno::RuntimeException(); + + const sal_Int32 nBufLen = 32000; + uno::Sequence< sal_Int8 > aBuffer( nBufLen ); + + sal_Int32 nRead = 0; + + nRead = xInput->readBytes( aBuffer, nBufLen ); + xInput->closeInput(); + + if ( nRead == nBufLen ) + throw io::WrongFormatException(); + + sal_Int32 nCurPos = 0; + return ParseEntry( aBuffer, nCurPos ); +} + +// ---------------------------------------------------------------------- +uno::Reference< io::XInputStream > DocumentLockFile::OpenStream() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSimpleFileAccess( + xFactory->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.ucb.SimpleFileAccess") ), + uno::UNO_QUERY_THROW ); + + // the file can be opened readonly, no locking will be done + return xSimpleFileAccess->openFileRead( m_aURL ); +} + +// ---------------------------------------------------------------------- +sal_Bool DocumentLockFile::OverwriteOwnLockFile() +{ + // allows to overwrite the lock file with the current data + try + { + uno::Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv; + ::ucbhelper::Content aTargetContent( m_aURL, xEnv ); + + uno::Sequence< ::rtl::OUString > aNewEntry = GenerateOwnEntry(); + + uno::Reference< io::XStream > xStream = aTargetContent.openWriteableStreamNoLock(); + uno::Reference< io::XOutputStream > xOutput = xStream->getOutputStream(); + uno::Reference< io::XTruncate > xTruncate( xOutput, uno::UNO_QUERY_THROW ); + + xTruncate->truncate(); + WriteEntryToStream( aNewEntry, xOutput ); + xOutput->closeOutput(); + } + catch( uno::Exception& ) + { + return sal_False; + } + + return sal_True; +} + +// ---------------------------------------------------------------------- +void DocumentLockFile::RemoveFile() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + // TODO/LATER: the removing is not atomar, is it possible in general to make it atomar? + uno::Sequence< ::rtl::OUString > aNewEntry = GenerateOwnEntry(); + uno::Sequence< ::rtl::OUString > aFileData = GetLockData(); + + if ( aFileData.getLength() < LOCKFILE_ENTRYSIZE ) + throw io::WrongFormatException(); + + if ( !aFileData[LOCKFILE_SYSUSERNAME_ID].equals( aNewEntry[LOCKFILE_SYSUSERNAME_ID] ) + || !aFileData[LOCKFILE_LOCALHOST_ID].equals( aNewEntry[LOCKFILE_LOCALHOST_ID] ) + || !aFileData[LOCKFILE_USERURL_ID].equals( aNewEntry[LOCKFILE_USERURL_ID] ) ) + throw io::IOException(); // not the owner, access denied + + uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSimpleFileAccess( + xFactory->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.ucb.SimpleFileAccess") ), + uno::UNO_QUERY_THROW ); + xSimpleFileAccess->kill( m_aURL ); +} + +} // namespace svt + diff --git a/svl/source/misc/filenotation.cxx b/svl/source/misc/filenotation.cxx new file mode 100644 index 000000000000..f5e5ae934e3d --- /dev/null +++ b/svl/source/misc/filenotation.cxx @@ -0,0 +1,147 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: filenotation.cxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include "filenotation.hxx" +#include +#include +#include + +//......................................................................... +namespace svt +{ +//......................................................................... + + //===================================================================== + //= OFileNotation + //===================================================================== + //--------------------------------------------------------------------- + OFileNotation::OFileNotation( const ::rtl::OUString& _rUrlOrPath ) + { + construct( _rUrlOrPath ); + } + + //--------------------------------------------------------------------- + OFileNotation::OFileNotation( const ::rtl::OUString& _rUrlOrPath, NOTATION _eInputNotation ) + { + if ( _eInputNotation == N_URL ) + { + INetURLObject aParser( _rUrlOrPath ); + if ( aParser.GetProtocol() == INET_PROT_FILE ) + implInitWithURLNotation( _rUrlOrPath ); + else + m_sSystem = m_sFileURL = _rUrlOrPath; + } + else + implInitWithSystemNotation( _rUrlOrPath ); + } + + //--------------------------------------------------------------------- + bool OFileNotation::implInitWithSystemNotation( const ::rtl::OUString& _rSystemPath ) + { + bool bSuccess = false; + + m_sSystem = _rSystemPath; + if ( ( osl_File_E_None != osl_getFileURLFromSystemPath( m_sSystem.pData, &m_sFileURL.pData ) ) + && ( 0 == m_sFileURL.getLength() ) + ) + { + if ( _rSystemPath.getLength() ) + { + INetURLObject aSmartParser; + aSmartParser.SetSmartProtocol( INET_PROT_FILE ); + if ( aSmartParser.SetSmartURL( _rSystemPath ) ) + { + m_sFileURL = aSmartParser.GetMainURL( INetURLObject::NO_DECODE ); + osl_getSystemPathFromFileURL( m_sFileURL.pData, &m_sSystem.pData ); + bSuccess = true; + } + } + } + else + bSuccess = true; + return bSuccess; + } + + //--------------------------------------------------------------------- + bool OFileNotation::implInitWithURLNotation( const ::rtl::OUString& _rURL ) + { + m_sFileURL = _rURL; + osl_getSystemPathFromFileURL( _rURL.pData, &m_sSystem.pData ); + return true; + } + + //--------------------------------------------------------------------- + void OFileNotation::construct( const ::rtl::OUString& _rUrlOrPath ) + { + bool bSuccess = false; + // URL notation? + INetURLObject aParser( _rUrlOrPath ); + switch ( aParser.GetProtocol() ) + { + case INET_PROT_FILE: + // file URL + bSuccess = implInitWithURLNotation( _rUrlOrPath ); + break; + + case INET_PROT_NOT_VALID: + // assume system notation + bSuccess = implInitWithSystemNotation( _rUrlOrPath ); + break; + + default: + // it's a known scheme, but no file-URL -> assume that bothe the URL representation and the + // system representation are the URL itself + m_sSystem = m_sFileURL = _rUrlOrPath; + bSuccess = true; + break; + } + + OSL_ENSURE( bSuccess, "OFileNotation::OFileNotation: could not detect the format!" ); + } + + //--------------------------------------------------------------------- + ::rtl::OUString OFileNotation::get(NOTATION _eOutputNotation) + { + switch (_eOutputNotation) + { + case N_SYSTEM: return m_sSystem; + case N_URL: return m_sFileURL; + } + + OSL_ENSURE(sal_False, "OFileNotation::get: inavlid enum value!"); + return ::rtl::OUString(); + } + +//......................................................................... +} // namespace svt +//......................................................................... + diff --git a/svl/source/misc/flbytes.cxx b/svl/source/misc/flbytes.cxx new file mode 100644 index 000000000000..acf53d9b3e94 --- /dev/null +++ b/svl/source/misc/flbytes.cxx @@ -0,0 +1,432 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: flbytes.cxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include +#include + +#ifndef _SVSTDARR_ULONGS_DECL +#define _SVSTDARR_ULONGS +#include +#undef _SVSTDARR_ULONGS +#endif + +namespace unnamed_svtools_flbytes {} using namespace unnamed_svtools_flbytes; + // unnamed namespaces don't work well yet + +//============================================================================ +namespace unnamed_svtools_flbytes { + +inline ULONG MyMin( long a, long b ) +{ + return Max( long( Min( a , b ) ), 0L ); +} + +} + +//============================================================================ +// +// SvFillLockBytes +// +//============================================================================ + +TYPEINIT1(SvFillLockBytes, SvLockBytes); + +//============================================================================ +SvFillLockBytes::SvFillLockBytes( SvLockBytes* pLockBytes ) + : xLockBytes( pLockBytes ), + nFilledSize( 0 ), + bTerminated( FALSE ) +{ +} + +//============================================================================ +ErrCode SvFillLockBytes::ReadAt( ULONG nPos, void* pBuffer, ULONG nCount, + ULONG *pRead ) const +{ + if( bTerminated ) + return xLockBytes->ReadAt( nPos, pBuffer, nCount, pRead ); + else + { + ULONG nWanted = nPos + nCount; + if( IsSynchronMode() ) + { + while( nWanted > nFilledSize && !bTerminated ) + Application::Yield(); + return xLockBytes->ReadAt( nPos, pBuffer, nCount, pRead ); + } + else + { + ULONG nRead = MyMin( nCount, long( nFilledSize ) - nPos ); + ULONG nErr = xLockBytes->ReadAt( nPos, pBuffer, nRead, pRead ); + return ( !nCount || nRead == nCount || nErr ) ? + nErr : ERRCODE_IO_PENDING; + } + } +} + +//============================================================================ +ErrCode SvFillLockBytes::WriteAt( ULONG nPos, const void* pBuffer, + ULONG nCount, ULONG *pWritten ) +{ + if( bTerminated ) + return xLockBytes->WriteAt( nPos, pBuffer, nCount, pWritten ); + else + { + ULONG nWanted = nPos + nCount; + if( IsSynchronMode() ) + { + while( nWanted > nFilledSize && !bTerminated ) + Application::Yield(); + return xLockBytes->WriteAt( nPos, pBuffer, nCount, pWritten ); + } + else + { + ULONG nRead = MyMin( nCount, long( nFilledSize ) - nPos ); + ULONG nErr = xLockBytes->WriteAt( nPos, pBuffer, nRead, pWritten ); + return ( !nCount || nRead == nCount || nErr ) ? + nErr : ERRCODE_IO_PENDING; + } + } +} + +//============================================================================ +ErrCode SvFillLockBytes::Flush() const +{ + return xLockBytes->Flush( ); +} + +//============================================================================ +ErrCode SvFillLockBytes::SetSize( ULONG nSize ) +{ + return xLockBytes->SetSize( nSize ); +} + +//============================================================================ +ErrCode SvFillLockBytes::LockRegion( ULONG nPos, ULONG nCount, LockType eType) +{ + return xLockBytes->LockRegion( nPos, nCount, eType ); +} + +//============================================================================ +ErrCode SvFillLockBytes::UnlockRegion( + ULONG nPos, ULONG nCount, LockType eType) +{ + return xLockBytes->UnlockRegion( nPos, nCount, eType ); +} + +//============================================================================ +ErrCode SvFillLockBytes::Stat( + SvLockBytesStat* pStat, SvLockBytesStatFlag eFlag) const +{ + return xLockBytes->Stat( pStat, eFlag ); +} + +//============================================================================ +ErrCode SvFillLockBytes::FillAppend( const void* pBuffer, ULONG nCount, ULONG *pWritten ) +{ + ErrCode nRet = xLockBytes->WriteAt( + nFilledSize, pBuffer, nCount, pWritten ); + nFilledSize += *pWritten; + return nRet; +} + +//============================================================================ +void SvFillLockBytes::Terminate() +{ + bTerminated = TRUE; +} + +//============================================================================ +SV_DECL_IMPL_REF_LIST( SvLockBytes, SvLockBytes* ) + +//============================================================================ +// +// SvSyncLockBytes +// +//============================================================================ + +TYPEINIT1(SvSyncLockBytes, SvOpenLockBytes); + +//============================================================================ +// virtual +ErrCode SvSyncLockBytes::ReadAt(ULONG nPos, void * pBuffer, ULONG nCount, + ULONG * pRead) const +{ + for (ULONG nReadTotal = 0;;) + { + ULONG nReadCount = 0; + ErrCode nError = m_xAsyncLockBytes->ReadAt(nPos, pBuffer, nCount, + &nReadCount); + nReadTotal += nReadCount; + if (nError != ERRCODE_IO_PENDING || !IsSynchronMode()) + { + if (pRead) + *pRead = nReadTotal; + return nError; + } + nPos += nReadCount; + pBuffer = static_cast< sal_Char * >(pBuffer) + nReadCount; + nCount -= nReadCount; + Application::Yield(); + } +} + +//============================================================================ +// virtual +ErrCode SvSyncLockBytes::WriteAt(ULONG nPos, const void * pBuffer, + ULONG nCount, ULONG * pWritten) +{ + for (ULONG nWrittenTotal = 0;;) + { + ULONG nWrittenCount = 0; + ErrCode nError = m_xAsyncLockBytes->WriteAt(nPos, pBuffer, nCount, + &nWrittenCount); + nWrittenTotal += nWrittenCount; + if (nError != ERRCODE_IO_PENDING || !IsSynchronMode()) + { + if (pWritten) + *pWritten = nWrittenTotal; + return nError; + } + nPos += nWrittenCount; + pBuffer = static_cast< sal_Char const * >(pBuffer) + nWrittenCount; + nCount -= nWrittenCount; + Application::Yield(); + } +} + +//============================================================================ +// +// SvCompositeLockBytes +// +//============================================================================ + +struct SvCompositeLockBytes_Impl +{ + SvLockBytesMemberList aLockBytes; + SvULongs aPositions; + SvULongs aOffsets; + BOOL bPending; + ULONG RelativeOffset( ULONG nPos ) const; + ErrCode ReadWrite_Impl( + ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pProcessed, + BOOL bRead ); + SvCompositeLockBytes_Impl() : bPending( FALSE ){} +}; + +//============================================================================ +ULONG SvCompositeLockBytes_Impl::RelativeOffset( ULONG nPos ) const +{ + const SvULongs& rPositions = aPositions; + const SvULongs& rOffsets = aOffsets; + + USHORT nMinPos = 0; + USHORT nListCount = rPositions.Count(); + + // Erster Lockbytes, der bearbeitet werden muss + while( nMinPos + 1 < nListCount && rPositions[ nMinPos + 1 ] <= nPos ) + nMinPos ++; + ULONG nSectionStart = rPositions[ nMinPos ]; + if( nSectionStart > nPos ) + return ULONG_MAX; + return rOffsets[ nMinPos ] + nPos - nSectionStart; +} + +//============================================================================ +ErrCode SvCompositeLockBytes_Impl::ReadWrite_Impl( + ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pProcessed, + BOOL bRead ) +{ + ErrCode nErr = ERRCODE_NONE; + SvULongs& rPositions = aPositions; + SvULongs& rOffsets = aOffsets; + SvLockBytesMemberList& rLockBytes = aLockBytes; + + ULONG nBytes = nCount; + USHORT nListCount = rPositions.Count(); + USHORT nMinPos = 0; + + // Erster Lockbytes, der bearbeitet werden muss + while( nMinPos + 1 < nListCount && rPositions[ nMinPos + 1 ] <= nPos ) + nMinPos ++; + ULONG nSectionStart = rPositions[ nMinPos ]; + + if( nSectionStart > nPos ) + { + // Es wird aus fuehrendem Leerbereich gearbeitet + *pProcessed = 0; + return ERRCODE_IO_CANTREAD; + } + + ULONG nDone; + while( nMinPos < nListCount ) + { + ULONG nToProcess; + ULONG nSectionStop; + if( nMinPos + 1 < nListCount ) + { + nSectionStop = rPositions[ nMinPos + 1 ]; + nToProcess = MyMin( long( nSectionStop ) - nPos, nBytes ); + } + else + { + nToProcess = nBytes; + nSectionStop = 0; + } + ULONG nAbsPos = nPos - nSectionStart + rOffsets[ nMinPos ]; + SvLockBytes* pLB = rLockBytes.GetObject( nMinPos ); + if( bRead ) + nErr = pLB->ReadAt( nAbsPos, pBuffer, nToProcess, &nDone ); + else + nErr = pLB->WriteAt( nAbsPos, pBuffer, nToProcess, &nDone ); + nBytes -= nDone; + if( nErr || nDone < nToProcess || !nBytes ) + { + *pProcessed = nCount - nBytes; + // Wenn aus dem letzten LockBytes nichts mehr gelesen wurde und + // bPending gesetzt ist, Pending zurueck + if( !nDone && nMinPos == nListCount - 1 ) + return bPending ? ERRCODE_IO_PENDING : nErr; + else return nErr; + } + pBuffer = static_cast< sal_Char * >(pBuffer) + nDone; + nPos += nDone; + nSectionStart = nSectionStop; + nMinPos++; + } + return nErr; +} + +//============================================================================ +TYPEINIT1(SvCompositeLockBytes, SvLockBytes); + +//============================================================================ +SvCompositeLockBytes::SvCompositeLockBytes() + : pImpl( new SvCompositeLockBytes_Impl ) +{ +} + +//============================================================================ +SvCompositeLockBytes::~SvCompositeLockBytes() +{ + delete pImpl; +} + +//============================================================================ +void SvCompositeLockBytes::SetIsPending( BOOL bSet ) +{ + pImpl->bPending = bSet; +} + +//============================================================================ +ULONG SvCompositeLockBytes::RelativeOffset( ULONG nPos ) const +{ + return pImpl->RelativeOffset( nPos ); +} + +//============================================================================ +ErrCode SvCompositeLockBytes::ReadAt( + ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pRead ) const +{ + return pImpl->ReadWrite_Impl( nPos, pBuffer, nCount, pRead, TRUE ); +} + +//============================================================================ +ErrCode SvCompositeLockBytes::WriteAt( + ULONG nPos, const void* pBuffer, ULONG nCount, ULONG* pWritten ) +{ + return pImpl->ReadWrite_Impl( + nPos, const_cast< void * >(pBuffer), nCount, pWritten, FALSE ); +} + +//============================================================================ +ErrCode SvCompositeLockBytes::Flush() const +{ + SvLockBytesMemberList& rLockBytes = pImpl->aLockBytes; + ErrCode nErr = ERRCODE_NONE; + for( USHORT nCount = (USHORT)rLockBytes.Count(); !nErr && nCount--; ) + nErr = rLockBytes.GetObject( nCount )->Flush(); + return nErr; +} + +//============================================================================ +ErrCode SvCompositeLockBytes::SetSize( ULONG ) +{ + DBG_ERROR( "not implemented" ); + return ERRCODE_IO_NOTSUPPORTED; +} + +//============================================================================ +ErrCode SvCompositeLockBytes::LockRegion( ULONG, ULONG, LockType ) +{ + DBG_ERROR( "not implemented" ); + return ERRCODE_IO_NOTSUPPORTED; +} + +//============================================================================ +ErrCode SvCompositeLockBytes::UnlockRegion( + ULONG, ULONG, LockType ) +{ + DBG_ERROR( "not implemented" ); + return ERRCODE_IO_NOTSUPPORTED; +} + +//============================================================================ +ErrCode SvCompositeLockBytes::Stat( + SvLockBytesStat* pStat, SvLockBytesStatFlag eFlag) const +{ + USHORT nMax = pImpl->aPositions.Count() - 1; + + SvLockBytesStat aStat; + ErrCode nErr = pImpl->aLockBytes.GetObject( nMax )->Stat( &aStat, eFlag ); + pStat->nSize = pImpl->aPositions[ nMax ] + aStat.nSize; + + return nErr; +} + +//============================================================================ +void SvCompositeLockBytes::Append( + SvLockBytes* pLockBytes, ULONG nPos, ULONG nOffset ) +{ + USHORT nCount = pImpl->aOffsets.Count(); + pImpl->aLockBytes.Insert( pLockBytes, nCount ); + pImpl->aPositions.Insert( nPos, nCount ); + pImpl->aOffsets.Insert( nOffset, nCount ); +} + +//============================================================================ +SvLockBytes* SvCompositeLockBytes::GetLastLockBytes() const +{ + return pImpl->aLockBytes.Count() ? + pImpl->aLockBytes.GetObject( pImpl->aLockBytes.Count() - 1 ) : 0; +} + diff --git a/svl/source/misc/folderrestriction.cxx b/svl/source/misc/folderrestriction.cxx new file mode 100644 index 000000000000..7f95bdaaa0bc --- /dev/null +++ b/svl/source/misc/folderrestriction.cxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: folderrestriction.cxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include "folderrestriction.hxx" +#include "osl/process.h" +#include "tools/urlobj.hxx" +#include "unotools/localfilehelper.hxx" + +//----------------------------------------------------------------------------- + +static void convertStringListToUrls ( + const String& _rColonSeparatedList, ::std::vector< String >& _rTokens, bool _bFinalSlash ) +{ + const sal_Unicode s_cSeparator = +#if defined(WNT) + ';' +#else + ':' +#endif + ; + xub_StrLen nTokens = _rColonSeparatedList.GetTokenCount( s_cSeparator ); + _rTokens.resize( 0 ); _rTokens.reserve( nTokens ); + for ( xub_StrLen i=0; i if and only if the retrieved string value is not empty +*/ +static bool getEnvironmentValue( const sal_Char* _pAsciiEnvName, ::rtl::OUString& _rValue ) +{ + _rValue = ::rtl::OUString(); + ::rtl::OUString sEnvName = ::rtl::OUString::createFromAscii( _pAsciiEnvName ); + osl_getEnvironment( sEnvName.pData, &_rValue.pData ); + return _rValue.getLength() != 0; +} + +//----------------------------------------------------------------------------- + +namespace svt +{ + + void getUnrestrictedFolders( ::std::vector< String >& _rFolders ) + { + _rFolders.resize( 0 ); + ::rtl::OUString sRestrictedPathList; + if ( getEnvironmentValue( "RestrictedPath", sRestrictedPathList ) ) + { + // append a final slash. This ensures that when we later on check + // for unrestricted paths, we don't allow paths like "/home/user35" just because + // "/home/user3" is allowed - with the final slash, we make it "/home/user3/". + convertStringListToUrls( sRestrictedPathList, _rFolders, true ); + } + } + +} // namespace svt + diff --git a/svl/source/misc/fstathelper.cxx b/svl/source/misc/fstathelper.cxx new file mode 100644 index 000000000000..82480fc83473 --- /dev/null +++ b/svl/source/misc/fstathelper.cxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: fstathelper.cxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include +#include +#include +#include +#include + +#include + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::ucb; +using namespace ::rtl; + +sal_Bool FStatHelper::GetModifiedDateTimeOfFile( const UniString& rURL, + Date* pDate, Time* pTime ) +{ + sal_Bool bRet = FALSE; + try + { + ::ucbhelper::Content aTestContent( rURL, + uno::Reference< XCommandEnvironment > ()); + uno::Any aAny = aTestContent.getPropertyValue( + OUString::createFromAscii( "DateModified" ) ); + if( aAny.hasValue() ) + { + bRet = sal_True; + const util::DateTime* pDT = (util::DateTime*)aAny.getValue(); + if( pDate ) + *pDate = Date( pDT->Day, pDT->Month, pDT->Year ); + if( pTime ) + *pTime = Time( pDT->Hours, pDT->Minutes, + pDT->Seconds, pDT->HundredthSeconds ); + } + } + catch(...) + { + } + + return bRet; +} + +sal_Bool FStatHelper::IsDocument( const UniString& rURL ) +{ + BOOL bExist = FALSE; + try + { + ::ucbhelper::Content aTestContent( rURL, + uno::Reference< XCommandEnvironment > ()); + bExist = aTestContent.isDocument(); + } + catch(...) + { + } + return bExist; +} + +sal_Bool FStatHelper::IsFolder( const UniString& rURL ) +{ + BOOL bExist = FALSE; + try + { + ::ucbhelper::Content aTestContent( rURL, + uno::Reference< XCommandEnvironment > ()); + bExist = aTestContent.isFolder(); + } + catch(...) + { + } + return bExist; +} + diff --git a/svl/source/misc/inethist.cxx b/svl/source/misc/inethist.cxx new file mode 100644 index 000000000000..5a1a3719d7ca --- /dev/null +++ b/svl/source/misc/inethist.cxx @@ -0,0 +1,545 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: inethist.cxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include + +#ifndef INCLUDED_ALGORITHM +#include +#define INCLUDED_ALGORITHM +#endif +#include "rtl/instance.hxx" +#include "rtl/crc.h" +#include "rtl/memory.h" +#include +#include +#include +#include + +/*======================================================================== + * + * INetURLHistory internals. + * + *======================================================================*/ +#define INETHIST_DEF_FTP_PORT 21 +#define INETHIST_DEF_HTTP_PORT 80 +#define INETHIST_DEF_HTTPS_PORT 443 + +#define INETHIST_SIZE_LIMIT 1024 +#define INETHIST_MAGIC_HEAD 0x484D4849UL + +/* + * INetURLHistoryHint implementation. + */ +IMPL_PTRHINT (INetURLHistoryHint, const INetURLObject); + +/*======================================================================== + * + * INetURLHistory_Impl interface. + * + *======================================================================*/ +class INetURLHistory_Impl +{ + /** head_entry. + */ + struct head_entry + { + /** Representation. + */ + UINT32 m_nMagic; + UINT16 m_nNext; + UINT16 m_nMBZ; + + /** Initialization. + */ + void initialize (void) + { + m_nMagic = INETHIST_MAGIC_HEAD; + m_nNext = 0; + m_nMBZ = 0; + } + }; + + /** hash_entry. + */ + struct hash_entry + { + /** Representation. + */ + UINT32 m_nHash; + UINT16 m_nLru; + UINT16 m_nMBZ; + + /** Initialization. + */ + void initialize (UINT16 nLru, UINT32 nHash = 0) + { + m_nHash = nHash; + m_nLru = nLru; + m_nMBZ = 0; + } + + /** Comparison. + */ + BOOL operator== (const hash_entry &rOther) const + { + return (m_nHash == rOther.m_nHash); + } + BOOL operator< (const hash_entry &rOther) const + { + return (m_nHash < rOther.m_nHash); + } + + BOOL operator== (UINT32 nHash) const + { + return (m_nHash == nHash); + } + BOOL operator< (UINT32 nHash) const + { + return (m_nHash < nHash); + } + }; + + /** lru_entry. + */ + struct lru_entry + { + /** Representation. + */ + UINT32 m_nHash; + UINT16 m_nNext; + UINT16 m_nPrev; + + /** Initialization. + */ + void initialize (UINT16 nThis, UINT32 nHash = 0) + { + m_nHash = nHash; + m_nNext = nThis; + m_nPrev = nThis; + } + }; + + /** Representation. + */ + head_entry m_aHead; + hash_entry m_pHash[INETHIST_SIZE_LIMIT]; + lru_entry m_pList[INETHIST_SIZE_LIMIT]; + + /** Initialization. + */ + void initialize (void); + + void downheap (hash_entry a[], UINT16 n, UINT16 k); + void heapsort (hash_entry a[], UINT16 n); + + /** capacity. + */ + UINT16 capacity (void) const + { + return (UINT16)(INETHIST_SIZE_LIMIT); + } + + /** crc32. + */ + UINT32 crc32 (UniString const & rData) const + { + return rtl_crc32 (0, rData.GetBuffer(), rData.Len() * sizeof(sal_Unicode)); + } + + /** find. + */ + UINT16 find (UINT32 nHash) const; + + /** move. + */ + void move (UINT16 nSI, UINT16 nDI); + + /** backlink. + */ + void backlink (UINT16 nThis, UINT16 nTail) + { + register lru_entry &rThis = m_pList[nThis]; + register lru_entry &rTail = m_pList[nTail]; + + rTail.m_nNext = nThis; + rTail.m_nPrev = rThis.m_nPrev; + rThis.m_nPrev = nTail; + m_pList[rTail.m_nPrev].m_nNext = nTail; + } + + /** unlink. + */ + void unlink (UINT16 nThis) + { + register lru_entry &rThis = m_pList[nThis]; + + m_pList[rThis.m_nPrev].m_nNext = rThis.m_nNext; + m_pList[rThis.m_nNext].m_nPrev = rThis.m_nPrev; + rThis.m_nNext = nThis; + rThis.m_nPrev = nThis; + } + + /** Not implemented. + */ + INetURLHistory_Impl (const INetURLHistory_Impl&); + INetURLHistory_Impl& operator= (const INetURLHistory_Impl&); + +public: + INetURLHistory_Impl (void); + ~INetURLHistory_Impl (void); + + /** putUrl/queryUrl. + */ + void putUrl (const String &rUrl); + BOOL queryUrl (const String &rUrl); +}; + +/*======================================================================== + * + * INetURLHistory_Impl implementation. + * + *======================================================================*/ +/* + * INetURLHistory_Impl. + */ +INetURLHistory_Impl::INetURLHistory_Impl (void) +{ + initialize(); +} + +/* + * ~INetURLHistory_Impl. + */ +INetURLHistory_Impl::~INetURLHistory_Impl (void) +{ +} + +/* + * initialize. + */ +void INetURLHistory_Impl::initialize (void) +{ + m_aHead.initialize(); + + USHORT i, n = capacity(); + for (i = 0; i < n; i++) + m_pHash[i].initialize(i); + for (i = 0; i < n; i++) + m_pList[i].initialize(i); + for (i = 1; i < n; i++) + backlink (m_aHead.m_nNext, i); +} + +/* + * downheap. + */ +void INetURLHistory_Impl::downheap (hash_entry a[], UINT16 n, UINT16 k) +{ + hash_entry h = a[k]; + while (k < n / 2) + { + UINT16 i = k + k + 1; + if (((i + 1) < n) && (a[i] < a[i + 1])) i++; + if (!(h < a[i])) break; + a[k] = a[i]; + k = i; + } + a[k] = h; +} + +/* + * heapsort. + */ +void INetURLHistory_Impl::heapsort (hash_entry a[], UINT16 n) +{ + hash_entry h; + + for (UINT16 k = (n - 1) / 2 + 1; k > 0; k--) + downheap (a, n, k - 1); + + while (n > 0) + { + h = a[0 ]; + a[0 ] = a[n - 1]; + a[n - 1] = h; + downheap (a, --n, 0); + } +} + +/* + * find. + */ +UINT16 INetURLHistory_Impl::find (UINT32 nHash) const +{ + UINT16 l = 0; + UINT16 r = capacity() - 1; + UINT16 c = capacity(); + + while ((l < r) && (r < c)) + { + UINT16 m = (l + r) / 2; + if (m_pHash[m] == nHash) + return m; + + if (m_pHash[m] < nHash) + l = m + 1; + else + r = m - 1; + } + return l; +} + +/* + * move. + */ +void INetURLHistory_Impl::move (UINT16 nSI, UINT16 nDI) +{ + hash_entry e = m_pHash[nSI]; + if (nSI < nDI) + { + // shift left. + rtl_moveMemory ( + &m_pHash[nSI ], + &m_pHash[nSI + 1], + (nDI - nSI) * sizeof(hash_entry)); + } + if (nSI > nDI) + { + // shift right. + rtl_moveMemory ( + &m_pHash[nDI + 1], + &m_pHash[nDI ], + (nSI - nDI) * sizeof(hash_entry)); + } + m_pHash[nDI] = e; +} + +/* + * putUrl. + */ +void INetURLHistory_Impl::putUrl (const String &rUrl) +{ + UINT32 h = crc32 (rUrl); + UINT16 k = find (h); + if ((k < capacity()) && (m_pHash[k] == h)) + { + // Cache hit. + UINT16 nMRU = m_pHash[k].m_nLru; + if (nMRU != m_aHead.m_nNext) + { + // Update LRU chain. + unlink (nMRU); + backlink (m_aHead.m_nNext, nMRU); + + // Rotate LRU chain. + m_aHead.m_nNext = m_pList[m_aHead.m_nNext].m_nPrev; + } + } + else + { + // Cache miss. Obtain least recently used. + UINT16 nLRU = m_pList[m_aHead.m_nNext].m_nPrev; + + UINT16 nSI = find (m_pList[nLRU].m_nHash); + if (!(nLRU == m_pHash[nSI].m_nLru)) + { + // Update LRU chain. + nLRU = m_pHash[nSI].m_nLru; + unlink (nLRU); + backlink (m_aHead.m_nNext, nLRU); + } + + // Rotate LRU chain. + m_aHead.m_nNext = m_pList[m_aHead.m_nNext].m_nPrev; + + // Check source and destination. + UINT16 nDI = std::min (k, UINT16(capacity() - 1)); + if (nSI < nDI) + { + if (!(m_pHash[nDI] < h)) + nDI -= 1; + } + if (nDI < nSI) + { + if (m_pHash[nDI] < h) + nDI += 1; + } + + // Assign data. + m_pList[m_aHead.m_nNext].m_nHash = m_pHash[nSI].m_nHash = h; + move (nSI, nDI); + } +} + +/* + * queryUrl. + */ +BOOL INetURLHistory_Impl::queryUrl (const String &rUrl) +{ + UINT32 h = crc32 (rUrl); + UINT16 k = find (h); + if ((k < capacity()) && (m_pHash[k] == h)) + { + // Cache hit. + return TRUE; + } + else + { + // Cache miss. + return FALSE; + } +} + +/*======================================================================== + * + * INetURLHistory::StaticInstance implementation. + * + *======================================================================*/ +INetURLHistory * INetURLHistory::StaticInstance::operator ()() +{ + static INetURLHistory g_aInstance; + return &g_aInstance; +} + +/*======================================================================== + * + * INetURLHistory implementation. + * + *======================================================================*/ +/* + * INetURLHistory. + */ +INetURLHistory::INetURLHistory() : m_pImpl (new INetURLHistory_Impl()) +{ +} + +/* + * ~INetURLHistory. + */ +INetURLHistory::~INetURLHistory() +{ + DELETEZ (m_pImpl); +} + +/* + * GetOrCreate. + */ +INetURLHistory* INetURLHistory::GetOrCreate() +{ + return rtl_Instance< + INetURLHistory, StaticInstance, + osl::MutexGuard, osl::GetGlobalMutex >::create ( + StaticInstance(), osl::GetGlobalMutex()); +} + +/* + * NormalizeUrl_Impl. + */ +void INetURLHistory::NormalizeUrl_Impl (INetURLObject &rUrl) +{ + switch (rUrl.GetProtocol()) + { + case INET_PROT_FILE: + if (!rUrl.IsCaseSensitive()) + { + String aPath (rUrl.GetURLPath(INetURLObject::NO_DECODE)); + aPath.ToLowerAscii(); + rUrl.SetURLPath (aPath, INetURLObject::NOT_CANONIC); + } + break; + + case INET_PROT_FTP: + if (!rUrl.HasPort()) + rUrl.SetPort (INETHIST_DEF_FTP_PORT); + break; + + case INET_PROT_HTTP: + if (!rUrl.HasPort()) + rUrl.SetPort (INETHIST_DEF_HTTP_PORT); + if (!rUrl.HasURLPath()) + rUrl.SetURLPath ("/"); + break; + + case INET_PROT_HTTPS: + if (!rUrl.HasPort()) + rUrl.SetPort (INETHIST_DEF_HTTPS_PORT); + if (!rUrl.HasURLPath()) + rUrl.SetURLPath ("/"); + break; + + default: + break; + } +} + +/* + * PutUrl_Impl. + */ +void INetURLHistory::PutUrl_Impl (const INetURLObject &rUrl) +{ + DBG_ASSERT (m_pImpl, "PutUrl_Impl(): no Implementation"); + if (m_pImpl) + { + INetURLObject aHistUrl (rUrl); + NormalizeUrl_Impl (aHistUrl); + + m_pImpl->putUrl (aHistUrl.GetMainURL(INetURLObject::NO_DECODE)); + Broadcast (INetURLHistoryHint (&rUrl)); + + if (aHistUrl.HasMark()) + { + aHistUrl.SetURL (aHistUrl.GetURLNoMark(INetURLObject::NO_DECODE), + INetURLObject::NOT_CANONIC); + + m_pImpl->putUrl (aHistUrl.GetMainURL(INetURLObject::NO_DECODE)); + Broadcast (INetURLHistoryHint (&aHistUrl)); + } + } +} + +/* + * QueryUrl_Impl. + */ +BOOL INetURLHistory::QueryUrl_Impl (const INetURLObject &rUrl) +{ + DBG_ASSERT (m_pImpl, "QueryUrl_Impl(): no Implementation"); + if (m_pImpl) + { + INetURLObject aHistUrl (rUrl); + NormalizeUrl_Impl (aHistUrl); + + return m_pImpl->queryUrl (aHistUrl.GetMainURL(INetURLObject::NO_DECODE)); + } + return FALSE; +} + + diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx new file mode 100644 index 000000000000..ce62d7f3b2fc --- /dev/null +++ b/svl/source/misc/inettype.cxx @@ -0,0 +1,1348 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: inettype.cxx,v $ + * $Revision: 1.9 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include +#include +#include +#include +#ifndef _SVTOOLS_HRC +#include +#endif + +#ifndef _SVSTDARR_STRINGSSORT_DECL +#define _SVSTDARR_STRINGSSORT +#include +#undef _SVSTDARR_STRINGSSORT +#endif + +namespace unnamed_svtools_inettype {} +using namespace unnamed_svtools_inettype; + // unnamed namespaces don't work well yet + +//============================================================================ +namespace unnamed_svtools_inettype { + +//============================================================================ +struct MediaTypeEntry +{ + sal_Char const * m_pTypeName; + INetContentType m_eTypeID; + sal_Char const * m_pExtension; +}; + +//============================================================================ +struct TypeIDMapEntry +{ + UniString m_aTypeName; + UniString m_aPresentation; + UniString m_aSystemFileType; +}; + +//============================================================================ +struct TypeNameMapEntry: public UniString +{ + UniString m_aExtension; + INetContentType m_eTypeID; + + TypeNameMapEntry(const UniString & rType): + UniString(rType), m_eTypeID(CONTENT_TYPE_UNKNOWN) {} +}; + +//============================================================================ +struct ExtensionMapEntry: public UniString +{ + INetContentType m_eTypeID; + + ExtensionMapEntry(const UniString & rExt): + UniString(rExt), m_eTypeID(CONTENT_TYPE_UNKNOWN) {} +}; + +//============================================================================ +class Registration +{ + static Registration * m_pRegistration; + + Table m_aTypeIDMap; // map TypeID to TypeName, Presentation + SvStringsSort m_aTypeNameMap; // map TypeName to TypeID, Extension + SvStringsSort m_aExtensionMap; // map Extension to TypeID + sal_uInt32 m_nNextDynamicID; + +public: + Registration(): m_nNextDynamicID(CONTENT_TYPE_LAST + 1) {} + + ~Registration(); + + static inline void deinitialize(); + + static inline TypeIDMapEntry * getEntry(INetContentType eTypeID); + + static TypeNameMapEntry * getExtensionEntry(UniString const & rTypeName); + + static INetContentType RegisterContentType(UniString const & rTypeName, + UniString const & + rPresentation, + UniString const * pExtension, + UniString const * + pSystemFileType); + + static INetContentType GetContentType(UniString const & rTypeName); + + static UniString GetContentType(INetContentType eTypeID); + + static UniString GetPresentation(INetContentType eTypeID); + + static UniString GetExtension(const UniString & rTypeName); + + static INetContentType GetContentType4Extension(UniString const & + rExtension); + +}; + +// static +inline void Registration::deinitialize() +{ + delete m_pRegistration; + m_pRegistration = 0; +} + +// static +inline TypeIDMapEntry * Registration::getEntry(INetContentType eTypeID) +{ + return + m_pRegistration ? + static_cast< TypeIDMapEntry * >(m_pRegistration-> + m_aTypeIDMap.Get(eTypeID)) : + 0; +} + +//============================================================================ +MediaTypeEntry const * seekEntry(UniString const & rTypeName, + MediaTypeEntry const * pMap, sal_Size nSize); + +//============================================================================ +/** A mapping from type names to type ids and extensions. Sorted by type + name. + */ +MediaTypeEntry const aStaticTypeNameMap[CONTENT_TYPE_LAST + 1] + = { { " ", CONTENT_TYPE_UNKNOWN, "" }, + { CONTENT_TYPE_STR_X_CNT_DOCUMENT, CONTENT_TYPE_X_CNT_DOCUMENT, + "tmp" }, + { CONTENT_TYPE_STR_X_CNT_FSYSBOX, CONTENT_TYPE_X_CNT_FSYSBOX, "tmp" }, + { CONTENT_TYPE_STR_X_CNT_CDROM_VOLUME, + CONTENT_TYPE_X_CNT_CDROM_VOLUME, "tmp" }, + { CONTENT_TYPE_STR_X_CNT_DISK_35, CONTENT_TYPE_X_CNT_DISK_35, "tmp" }, + { CONTENT_TYPE_STR_X_CNT_DISK_525, CONTENT_TYPE_X_CNT_DISK_525, + "tmp" }, + { CONTENT_TYPE_STR_X_CNT_FSYSFILE, CONTENT_TYPE_X_CNT_FSYSFILE, + "tmp" }, + { CONTENT_TYPE_STR_X_CNT_FIXED_VOLUME, + CONTENT_TYPE_X_CNT_FIXED_VOLUME, "tmp" }, + { CONTENT_TYPE_STR_X_CNT_FSYSFOLDER, CONTENT_TYPE_X_CNT_FSYSFOLDER, + "tmp" }, + { CONTENT_TYPE_STR_X_CNT_RAM_VOLUME, CONTENT_TYPE_X_CNT_RAM_VOLUME, + "tmp" }, + { CONTENT_TYPE_STR_X_CNT_REMOTE_VOLUME, + CONTENT_TYPE_X_CNT_REMOTE_VOLUME, "tmp" }, + { CONTENT_TYPE_STR_X_CNT_REMOVEABLE_VOLUME, + CONTENT_TYPE_X_CNT_REMOVEABLE_VOLUME, "tmp" }, + { CONTENT_TYPE_STR_X_CNT_FSYSSPECIALFILE, + CONTENT_TYPE_X_CNT_FSYSSPECIALFILE, "tmp" }, + { CONTENT_TYPE_STR_X_CNT_FSYSSPECIALFOLDER, + CONTENT_TYPE_X_CNT_FSYSSPECIALFOLDER, "tmp" }, + { CONTENT_TYPE_STR_X_CNT_TAPEDRIVE, CONTENT_TYPE_X_CNT_TAPEDRIVE, + "tmp" }, + { CONTENT_TYPE_STR_X_CNT_FSYSURLFILE, CONTENT_TYPE_X_CNT_FSYSURLFILE, + "tmp" }, + { CONTENT_TYPE_STR_X_CNT_FTPBOX, CONTENT_TYPE_X_CNT_FTPBOX, "tmp" }, + { CONTENT_TYPE_STR_X_CNT_FTPFILE, CONTENT_TYPE_X_CNT_FTPFILE, "tmp" }, + { CONTENT_TYPE_STR_X_CNT_FTPFOLDER, CONTENT_TYPE_X_CNT_FTPFOLDER, + "tmp" }, + { CONTENT_TYPE_STR_X_CNT_FTPLINK, CONTENT_TYPE_X_CNT_FTPLINK, "tmp" }, + { CONTENT_TYPE_STR_X_CNT_HTTPBOX, CONTENT_TYPE_X_CNT_HTTPBOX, "tmp" }, + { CONTENT_TYPE_STR_X_CNT_HTTPFILE, CONTENT_TYPE_X_CNT_HTTPFILE, + "tmp" }, + { CONTENT_TYPE_STR_X_CNT_IMAPBOX, CONTENT_TYPE_X_CNT_IMAPBOX, "tmp" }, + { CONTENT_TYPE_STR_X_CNT_IMAPFOLDER, CONTENT_TYPE_X_CNT_IMAPFOLDER, + "tmp" }, + { CONTENT_TYPE_STR_X_CNT_MESSAGE, CONTENT_TYPE_X_CNT_MESSAGE, "tmp" }, + { CONTENT_TYPE_STR_X_CNT_NEWSBOX, CONTENT_TYPE_X_CNT_NEWSBOX, "tmp" }, + { CONTENT_TYPE_STR_X_CNT_NEWSGROUP, CONTENT_TYPE_X_CNT_NEWSGROUP, + "tmp" }, + { CONTENT_TYPE_STR_X_CNT_OUTBOX, CONTENT_TYPE_X_CNT_OUTBOX, "tmp" }, + { CONTENT_TYPE_STR_X_CNT_POP3BOX, CONTENT_TYPE_X_CNT_POP3BOX, "tmp" }, + { CONTENT_TYPE_STR_X_CNT_PUBLISHBOX, CONTENT_TYPE_X_CNT_PUBLISHBOX, + "tmp" }, + { CONTENT_TYPE_STR_X_CNT_SEARCHBOX, CONTENT_TYPE_X_CNT_SEARCHBOX, + "tmp" }, + { CONTENT_TYPE_STR_X_CNT_SEPARATOR, CONTENT_TYPE_X_CNT_SEPARATOR, + "tmp" }, + { CONTENT_TYPE_STR_X_CNT_BOOKMARK, CONTENT_TYPE_X_CNT_BOOKMARK, + "tmp" }, + { CONTENT_TYPE_STR_X_CNT_SUBSCRIBEBOX, + CONTENT_TYPE_X_CNT_SUBSCRIBEBOX, "tmp" }, + { CONTENT_TYPE_STR_X_CNT_CDF, CONTENT_TYPE_X_CNT_CDF, "tmp" }, + { CONTENT_TYPE_STR_X_CNT_CDFITEM, CONTENT_TYPE_X_CNT_CDFITEM, "tmp" }, + { CONTENT_TYPE_STR_X_CNT_CDFSUB, CONTENT_TYPE_X_CNT_CDFSUB, "tmp" }, + { CONTENT_TYPE_STR_X_CNT_STARCHANNEL, CONTENT_TYPE_X_CNT_STARCHANNEL, + "tmp" }, + { CONTENT_TYPE_STR_X_CNT_TRASHBOX, CONTENT_TYPE_X_CNT_TRASHBOX, + "tmp" }, + { CONTENT_TYPE_STR_X_CNT_TRASH, CONTENT_TYPE_X_CNT_TRASH, "tmp" }, + { CONTENT_TYPE_STR_X_CNT_VIMBBOARD, CONTENT_TYPE_X_CNT_VIMBBOARD, + "tmp" }, + { CONTENT_TYPE_STR_X_CNT_VIMBBOARDBOX, + CONTENT_TYPE_X_CNT_VIMBBOARDBOX, "tmp" }, + { CONTENT_TYPE_STR_X_CNT_VIMBOX, CONTENT_TYPE_X_CNT_VIMBOX, "tmp" }, + { CONTENT_TYPE_STR_X_CNT_VIMINBOX, CONTENT_TYPE_X_CNT_VIMINBOX, + "tmp" }, + { CONTENT_TYPE_STR_APP_OCTSTREAM, CONTENT_TYPE_APP_OCTSTREAM, "tmp" }, + { CONTENT_TYPE_STR_APP_PDF, CONTENT_TYPE_APP_PDF, "pdf" }, + { CONTENT_TYPE_STR_APP_RTF, CONTENT_TYPE_APP_RTF, "rtf" }, + { CONTENT_TYPE_STR_APP_VND_CALC, CONTENT_TYPE_APP_VND_CALC, "sdc" }, + { CONTENT_TYPE_STR_APP_VND_CHART, CONTENT_TYPE_APP_VND_CHART, "sds" }, + { CONTENT_TYPE_STR_APP_VND_DRAW, CONTENT_TYPE_APP_VND_DRAW, "sda" }, + { CONTENT_TYPE_STR_APP_VND_IMAGE, CONTENT_TYPE_APP_VND_IMAGE, "sim" }, + { CONTENT_TYPE_STR_APP_VND_IMPRESS, CONTENT_TYPE_APP_VND_IMPRESS, + "sdd" }, + { CONTENT_TYPE_STR_APP_VND_IMPRESSPACKED, + CONTENT_TYPE_APP_VND_IMPRESSPACKED, "sdp" }, + { CONTENT_TYPE_STR_APP_VND_MAIL, CONTENT_TYPE_APP_VND_MAIL, "sdm" }, + { CONTENT_TYPE_STR_APP_VND_MATH, CONTENT_TYPE_APP_VND_MATH, "smf" }, + { CONTENT_TYPE_STR_APP_VND_NEWS, CONTENT_TYPE_APP_VND_NEWS, "sdm" }, + { CONTENT_TYPE_STR_APP_VND_OUTTRAY, CONTENT_TYPE_APP_VND_OUTTRAY, + "sdm" }, + { CONTENT_TYPE_STR_APP_VND_TEMPLATE, CONTENT_TYPE_APP_VND_TEMPLATE, + "vor" }, + { CONTENT_TYPE_STR_APP_VND_WRITER, CONTENT_TYPE_APP_VND_WRITER, + "sdw" }, + { CONTENT_TYPE_STR_APP_VND_WRITER_GLOBAL, + CONTENT_TYPE_APP_VND_WRITER_GLOBAL, "sgl" }, + { CONTENT_TYPE_STR_APP_VND_WRITER_WEB, + CONTENT_TYPE_APP_VND_WRITER_WEB, "htm" }, + { CONTENT_TYPE_STR_APP_VND_SUN_XML_CALC, CONTENT_TYPE_APP_VND_SUN_XML_CALC, "sxc" }, + { CONTENT_TYPE_STR_APP_VND_SUN_XML_CHART, CONTENT_TYPE_APP_VND_SUN_XML_CHART, "sxs" }, + { CONTENT_TYPE_STR_APP_VND_SUN_XML_DRAW, CONTENT_TYPE_APP_VND_SUN_XML_DRAW, "sxd" }, + { CONTENT_TYPE_STR_APP_VND_SUN_XML_IMPRESS, CONTENT_TYPE_APP_VND_SUN_XML_IMPRESS, "sxi" }, + { CONTENT_TYPE_STR_APP_VND_SUN_XML_IMPRESSPACKED, CONTENT_TYPE_APP_VND_SUN_XML_IMPRESSPACKED, "sxp" }, + { CONTENT_TYPE_STR_APP_VND_SUN_XML_MATH, CONTENT_TYPE_APP_VND_SUN_XML_MATH, "sxm" }, + { CONTENT_TYPE_STR_APP_VND_SUN_XML_WRITER, CONTENT_TYPE_APP_VND_SUN_XML_WRITER, "sxw" }, + { CONTENT_TYPE_STR_APP_VND_SUN_XML_WRITER_GLOBAL, CONTENT_TYPE_APP_VND_SUN_XML_WRITER_GLOBAL, "sxg" }, + { CONTENT_TYPE_STR_APP_FRAMESET, CONTENT_TYPE_APP_FRAMESET, "sfs" }, + { CONTENT_TYPE_STR_APP_GALLERY, CONTENT_TYPE_APP_GALLERY, "gal" }, + { CONTENT_TYPE_STR_APP_GALLERY_THEME, CONTENT_TYPE_APP_GALLERY_THEME, + "thm" }, + { CONTENT_TYPE_STR_APP_JAR, CONTENT_TYPE_APP_JAR, "jar" }, + { CONTENT_TYPE_STR_APP_MACRO, CONTENT_TYPE_APP_MACRO, "tmp" }, + { CONTENT_TYPE_STR_APP_MSEXCEL, CONTENT_TYPE_APP_MSEXCEL, "xls" }, + { CONTENT_TYPE_STR_APP_MSEXCEL_TEMPL, CONTENT_TYPE_APP_MSEXCEL_TEMPL, + "xlt" }, + { CONTENT_TYPE_STR_APP_MSPPOINT, CONTENT_TYPE_APP_MSPPOINT, "ppt" }, + { CONTENT_TYPE_STR_APP_MSPPOINT_TEMPL, + CONTENT_TYPE_APP_MSPPOINT_TEMPL, "pot" }, + { CONTENT_TYPE_STR_APP_MSWORD, CONTENT_TYPE_APP_MSWORD, "doc" }, + { CONTENT_TYPE_STR_APP_MSWORD_TEMPL, CONTENT_TYPE_APP_MSWORD_TEMPL, + "dot" }, + { CONTENT_TYPE_STR_APP_SCHEDULE_CMB, CONTENT_TYPE_APP_SCHEDULE, + "tmp" }, + { CONTENT_TYPE_STR_APP_SCHEDULE_EVT, CONTENT_TYPE_APP_SCHEDULE_EVT, + "tmp" }, + { CONTENT_TYPE_STR_APP_SCHEDULE_FEVT, + CONTENT_TYPE_APP_SCHEDULE_FORM_EVT, "tmp" }, + { CONTENT_TYPE_STR_APP_SCHEDULE_FTASK, + CONTENT_TYPE_APP_SCHEDULE_FORM_TASK, "tmp" }, + { CONTENT_TYPE_STR_APP_SCHEDULE_TASK, CONTENT_TYPE_APP_SCHEDULE_TASK, + "tmp" }, + { CONTENT_TYPE_STR_APP_STARCALC, CONTENT_TYPE_APP_STARCALC, "sdc" }, + { CONTENT_TYPE_STR_APP_STARCHART, CONTENT_TYPE_APP_STARCHART, "sds" }, + { CONTENT_TYPE_STR_APP_STARDRAW, CONTENT_TYPE_APP_STARDRAW, "sda" }, + { CONTENT_TYPE_STR_APP_STARHELP, CONTENT_TYPE_APP_STARHELP, "svh" }, + { CONTENT_TYPE_STR_APP_STARIMAGE, CONTENT_TYPE_APP_STARIMAGE, "sim" }, + { CONTENT_TYPE_STR_APP_STARIMPRESS, CONTENT_TYPE_APP_STARIMPRESS, + "sdd" }, + { CONTENT_TYPE_STR_APP_STARMAIL_SDM, CONTENT_TYPE_APP_STARMAIL_SDM, + "sdm" }, + { CONTENT_TYPE_STR_APP_STARMAIL_SMD, CONTENT_TYPE_APP_STARMAIL_SMD, + "smd" }, + { CONTENT_TYPE_STR_APP_STARMATH, CONTENT_TYPE_APP_STARMATH, "smf" }, + { CONTENT_TYPE_STR_APP_STARWRITER, CONTENT_TYPE_APP_STARWRITER, + "sdw" }, + { CONTENT_TYPE_STR_APP_STARWRITER_GLOB, + CONTENT_TYPE_APP_STARWRITER_GLOB, "sgl" }, + { CONTENT_TYPE_STR_APP_CDE_CALENDAR_APP, + CONTENT_TYPE_APP_CDE_CALENDAR_APP, "appt" }, + { CONTENT_TYPE_STR_APP_ZIP, CONTENT_TYPE_APP_ZIP, "zip" }, + { CONTENT_TYPE_STR_AUDIO_AIFF, CONTENT_TYPE_AUDIO_AIFF, "aif" }, + { CONTENT_TYPE_STR_AUDIO_BASIC, CONTENT_TYPE_AUDIO_BASIC, "au" }, + { CONTENT_TYPE_STR_AUDIO_MIDI, CONTENT_TYPE_AUDIO_MIDI, "mid" }, + { CONTENT_TYPE_STR_AUDIO_WAV, CONTENT_TYPE_AUDIO_WAV, "wav" }, + { CONTENT_TYPE_STR_IMAGE_GENERIC, CONTENT_TYPE_IMAGE_GENERIC, "tmp" }, + { CONTENT_TYPE_STR_IMAGE_GIF, CONTENT_TYPE_IMAGE_GIF, "gif" }, + { CONTENT_TYPE_STR_IMAGE_JPEG, CONTENT_TYPE_IMAGE_JPEG, "jpg" }, + { CONTENT_TYPE_STR_IMAGE_PCX, CONTENT_TYPE_IMAGE_PCX, "pcx" }, + { CONTENT_TYPE_STR_IMAGE_PNG, CONTENT_TYPE_IMAGE_PNG, "png" }, + { CONTENT_TYPE_STR_IMAGE_TIFF, CONTENT_TYPE_IMAGE_TIFF, "tif" }, + { CONTENT_TYPE_STR_IMAGE_BMP, CONTENT_TYPE_IMAGE_BMP, "bmp" }, + { CONTENT_TYPE_STR_INET_MSG_RFC822, CONTENT_TYPE_INET_MESSAGE_RFC822, + "tmp" }, + { CONTENT_TYPE_STR_INET_MULTI_ALTERNATIVE, + CONTENT_TYPE_INET_MULTIPART_ALTERNATIVE, "tmp" }, + { CONTENT_TYPE_STR_INET_MULTI_DIGEST, + CONTENT_TYPE_INET_MULTIPART_DIGEST, "tmp" }, + { CONTENT_TYPE_STR_INET_MULTI_MIXED, + CONTENT_TYPE_INET_MULTIPART_MIXED, "tmp" }, + { CONTENT_TYPE_STR_INET_MULTI_PARALLEL, + CONTENT_TYPE_INET_MULTIPART_PARALLEL, "tmp" }, + { CONTENT_TYPE_STR_INET_MULTI_RELATED, + CONTENT_TYPE_INET_MULTIPART_RELATED, "tmp" }, + { CONTENT_TYPE_STR_TEXT_ICALENDAR, CONTENT_TYPE_TEXT_ICALENDAR, + "ics" }, + { CONTENT_TYPE_STR_TEXT_HTML, CONTENT_TYPE_TEXT_HTML, "htm" }, + { CONTENT_TYPE_STR_TEXT_PLAIN, CONTENT_TYPE_TEXT_PLAIN, "txt" }, + { CONTENT_TYPE_STR_TEXT_XMLICALENDAR, CONTENT_TYPE_TEXT_XMLICALENDAR, + "xcs" }, + { CONTENT_TYPE_STR_TEXT_URL, CONTENT_TYPE_TEXT_URL, "url" }, + { CONTENT_TYPE_STR_TEXT_VCALENDAR, CONTENT_TYPE_TEXT_VCALENDAR, + "vcs" }, + { CONTENT_TYPE_STR_TEXT_VCARD, CONTENT_TYPE_TEXT_VCARD, "vcf" }, + { CONTENT_TYPE_STR_VIDEO_VDO, CONTENT_TYPE_VIDEO_VDO, "vdo" }, + { CONTENT_TYPE_STR_VIDEO_MSVIDEO, CONTENT_TYPE_VIDEO_MSVIDEO, "avi" }, + { CONTENT_TYPE_STR_X_STARMAIL, CONTENT_TYPE_X_STARMAIL, "smd" }, + { CONTENT_TYPE_STR_X_VRML, CONTENT_TYPE_X_VRML, "wrl" } +}; + +//============================================================================ +/** A mapping from type IDs to presentation resource IDs. Sorted by type ID. + */ +USHORT const aStaticResourceIDMap[CONTENT_TYPE_LAST + 1] + = { STR_SVT_MIMETYPE_APP_OCTSTREAM, // CONTENT_TYPE_UNKNOWN + STR_SVT_MIMETYPE_APP_OCTSTREAM, // CONTENT_TYPE_APP_OCTSTREAM + STR_SVT_MIMETYPE_APP_PDF, // CONTENT_TYPE_APP_PDF + STR_SVT_MIMETYPE_APP_RTF, // CONTENT_TYPE_APP_RTF + STR_SVT_MIMETYPE_APP_MSWORD, // CONTENT_TYPE_APP_MSWORD + STR_SVT_MIMETYPE_APP_MSWORD, // CONTENT_TYPE_APP_MSWORD_TEMPL //@todo new presentation string? + STR_SVT_MIMETYPE_APP_STARCALC, // CONTENT_TYPE_APP_STARCALC + STR_SVT_MIMETYPE_APP_STARCHART, // CONTENT_TYPE_APP_STARCHART + STR_SVT_MIMETYPE_APP_STARDRAW, // CONTENT_TYPE_APP_STARDRAW + STR_SVT_MIMETYPE_APP_STARHELP, // CONTENT_TYPE_APP_STARHELP + STR_SVT_MIMETYPE_APP_STARIMAGE, // CONTENT_TYPE_APP_STARIMAGE + STR_SVT_MIMETYPE_APP_STARIMPRESS, // CONTENT_TYPE_APP_STARIMPRESS + STR_SVT_MIMETYPE_APP_STARMATH, // CONTENT_TYPE_APP_STARMATH + STR_SVT_MIMETYPE_APP_STARWRITER, // CONTENT_TYPE_APP_STARWRITER + STR_SVT_MIMETYPE_APP_ZIP, // CONTENT_TYPE_APP_ZIP + STR_SVT_MIMETYPE_AUDIO_AIFF, // CONTENT_TYPE_AUDIO_AIFF + STR_SVT_MIMETYPE_AUDIO_BASIC, // CONTENT_TYPE_AUDIO_BASIC + STR_SVT_MIMETYPE_AUDIO_MIDI, // CONTENT_TYPE_AUDIO_MIDI + STR_SVT_MIMETYPE_AUDIO_WAV, // CONTENT_TYPE_AUDIO_WAV + STR_SVT_MIMETYPE_IMAGE_GIF, // CONTENT_TYPE_IMAGE_GIF + STR_SVT_MIMETYPE_IMAGE_JPEG, // CONTENT_TYPE_IMAGE_JPEG + STR_SVT_MIMETYPE_IMAGE_PCX, // CONTENT_TYPE_IMAGE_PCX + STR_SVT_MIMETYPE_IMAGE_PNG, // CONTENT_TYPE_IMAGE_PNG + STR_SVT_MIMETYPE_IMAGE_TIFF, // CONTENT_TYPE_IMAGE_TIFF + STR_SVT_MIMETYPE_IMAGE_BMP, // CONTENT_TYPE_IMAGE_BMP + STR_SVT_MIMETYPE_TEXT_HTML, // CONTENT_TYPE_TEXT_HTML + STR_SVT_MIMETYPE_TEXT_PLAIN, // CONTENT_TYPE_TEXT_PLAIN + STR_SVT_MIMETYPE_TEXT_URL, // CONTENT_TYPE_TEXT_URL + STR_SVT_MIMETYPE_TEXT_VCARD, // CONTENT_TYPE_TEXT_VCARD + STR_SVT_MIMETYPE_VIDEO_VDO, // CONTENT_TYPE_VIDEO_VDO + STR_SVT_MIMETYPE_VIDEO_MSVIDEO, // CONTENT_TYPE_VIDEO_MSVIDEO + STR_SVT_MIMETYPE_CNT_MSG, // CONTENT_TYPE_X_CNT_MESSAGE + STR_SVT_MIMETYPE_CNT_DOCUMENT, // CONTENT_TYPE_X_CNT_DOCUMENT + STR_SVT_MIMETYPE_CNT_POP3BOX, // CONTENT_TYPE_X_CNT_POP3BOX + STR_SVT_MIMETYPE_CNT_IMAPBOX, // CONTENT_TYPE_X_CNT_IMAPBOX + STR_SVT_MIMETYPE_CNT_IMAPFLD, // CONTENT_TYPE_X_CNT_IMAPFOLDER + STR_SVT_MIMETYPE_CNT_VIMBOX, // CONTENT_TYPE_X_CNT_VIMBOX + STR_SVT_MIMETYPE_CNT_VIMINBOX, // CONTENT_TYPE_X_CNT_VIMINBOX + STR_SVT_MIMETYPE_CNT_BBBOX, // CONTENT_TYPE_X_CNT_VIMBBOARDBOX + STR_SVT_MIMETYPE_CNT_VIM_BB, // CONTENT_TYPE_X_CNT_VIMBBOARD + STR_SVT_MIMETYPE_CNT_NEWSBOX, // CONTENT_TYPE_X_CNT_NEWSBOX + STR_SVT_MIMETYPE_CNT_NEWSGRP, // CONTENT_TYPE_X_CNT_NEWSGROUP + STR_SVT_MIMETYPE_CNT_OUTBOX, // CONTENT_TYPE_X_CNT_OUTBOX + STR_SVT_MIMETYPE_CNT_FTPBOX, // CONTENT_TYPE_X_CNT_FTPBOX + STR_SVT_MIMETYPE_CNT_FTPFLD, // CONTENT_TYPE_X_CNT_FTPFOLDER + STR_SVT_MIMETYPE_CNT_FTPFILE, // CONTENT_TYPE_X_CNT_FTPFILE + STR_SVT_MIMETYPE_CNT_FTPLINK, // CONTENT_TYPE_X_CNT_FTPLINK + STR_SVT_MIMETYPE_CNT_HTTPBOX, // CONTENT_TYPE_X_CNT_HTTPBOX + STR_SVT_MIMETYPE_CNT_FSYSBOX, // CONTENT_TYPE_X_CNT_FSYSBOX + STR_SVT_MIMETYPE_CNT_FSYSFLD, // CONTENT_TYPE_X_CNT_FSYSFOLDER + STR_SVT_MIMETYPE_CNT_FSYSFILE, // CONTENT_TYPE_X_CNT_FSYSFILE + STR_SVT_MIMETYPE_CNT_FSYSURLFILE, // CONTENT_TYPE_X_CNT_FSYSURLFILE + STR_SVT_MIMETYPE_CNT_PUBLBOX, // CONTENT_TYPE_X_CNT_PUBLISHBOX + STR_SVT_MIMETYPE_CNT_SRCHBOX, // CONTENT_TYPE_X_CNT_SEARCHBOX + STR_SVT_MIMETYPE_CNT_SUBSCRBOX, // CONTENT_TYPE_X_CNT_SUBSCRIBEBOX + STR_SVT_MIMETYPE_CNT_BOOKMARK, // CONTENT_TYPE_X_CNT_BOOKMARK + STR_SVT_MIMETYPE_CNT_CDF, // CONTENT_TYPE_X_CNT_CDF + STR_SVT_MIMETYPE_CNT_CDFSUB, // CONTENT_TYPE_X_CNT_CDFSUB + STR_SVT_MIMETYPE_CNT_CDFITEM, // CONTENT_TYPE_X_CNT_CDFITEM + STR_SVT_MIMETYPE_CNT_TRASHBOX, // CONTENT_TYPE_X_CNT_TRASHBOX + STR_SVT_MIMETYPE_CNT_TRASH, // CONTENT_TYPE_X_CNT_TRASH + STR_SVT_MIMETYPE_X_STARMAIL, // CONTENT_TYPE_X_STARMAIL + STR_SVT_MIMETYPE_X_VRML, // CONTENT_TYPE_X_VRML + STR_SVT_MIMETYPE_CNT_REMOV_VOL, + // CONTENT_TYPE_X_CNT_REMOVEABLE_VOLUME + STR_SVT_MIMETYPE_CNT_FIX_VOL, // CONTENT_TYPE_X_CNT_FIXED_VOLUME + STR_SVT_MIMETYPE_CNT_REM_VOL, // CONTENT_TYPE_X_CNT_REMOTE_VOLUME + STR_SVT_MIMETYPE_CNT_RAM_VOL, // CONTENT_TYPE_X_CNT_RAM_VOLUME + STR_SVT_MIMETYPE_CNT_CDROM, // CONTENT_TYPE_X_CNT_CDROM_VOLUME + STR_SVT_MIMETYPE_CNT_DISK_35, // CONTENT_TYPE_X_CNT_DISK_35 + STR_SVT_MIMETYPE_CNT_DISK_525, // CONTENT_TYPE_X_CNT_DISK_525 + STR_SVT_MIMETYPE_CNT_TAPEDRIVE, // CONTENT_TYPE_X_CNT_TAPEDRIVE + STR_SVT_MIMETYPE_APP_GAL, // CONTENT_TYPE_APP_GALLERY + STR_SVT_MIMETYPE_APP_GAL_THEME, // CONTENT_TYPE_APP_GALLERY_THEME + STR_SVT_MIMETYPE_CNT_STARCHANNEL, // CONTENT_TYPE_X_CNT_STARCHANNEL + STR_SVT_MIMETYPE_CNT_SEPARATOR, // CONTENT_TYPE_X_CNT_SEPARATOR + STR_SVT_MIMETYPE_APP_STARW_GLOB, // CONTENT_TYPE_APP_STARWRITER_GLOB + STR_SVT_MIMETYPE_APP_SDM, // CONTENT_TYPE_APP_STARMAIL_SDM + STR_SVT_MIMETYPE_APP_SMD, // CONTENT_TYPE_APP_STARMAIL_SMD + STR_SVT_MIMETYPE_APP_STARCALC, // CONTENT_TYPE_APP_VND_CALC + STR_SVT_MIMETYPE_APP_STARCHART, // CONTENT_TYPE_APP_VND_CHART + STR_SVT_MIMETYPE_APP_STARDRAW, // CONTENT_TYPE_APP_VND_DRAW + STR_SVT_MIMETYPE_APP_STARIMAGE, // CONTENT_TYPE_APP_VND_IMAGE + STR_SVT_MIMETYPE_APP_STARIMPRESS, // CONTENT_TYPE_APP_VND_IMPRESS + STR_SVT_MIMETYPE_X_STARMAIL, // CONTENT_TYPE_APP_VND_MAIL + STR_SVT_MIMETYPE_APP_STARMATH, // CONTENT_TYPE_APP_VND_MATH + STR_SVT_MIMETYPE_APP_STARWRITER, // CONTENT_TYPE_APP_VND_WRITER + STR_SVT_MIMETYPE_APP_STARW_GLOB, // CONTENT_TYPE_APP_VND_WRITER_GLOBAL + STR_SVT_MIMETYPE_APP_STARW_WEB, // CONTENT_TYPE_APP_VND_WRITER_WEB + STR_SVT_MIMETYPE_SCHEDULE, // CONTENT_TYPE_APP_SCHEDULE + STR_SVT_MIMETYPE_SCHEDULE_EVT, // CONTENT_TYPE_APP_SCHEDULE_EVT + STR_SVT_MIMETYPE_SCHEDULE_TASK, // CONTENT_TYPE_APP_SCHEDULE_TASK + STR_SVT_MIMETYPE_SCHEDULE_FEVT, // CONTENT_TYPE_APP_SCHEDULE_FORM_EVT + STR_SVT_MIMETYPE_SCHEDULE_FTASK, + // CONTENT_TYPE_APP_SCHEDULE_FORM_TASK + STR_SVT_MIMETYPE_FRAMESET, // CONTENT_TYPE_APP_FRAMESET + STR_SVT_MIMETYPE_MACRO, // CONTENT_TYPE_APP_MACRO + STR_SVT_MIMETYPE_CNT_SFSYSFOLDER, + // CONTENT_TYPE_X_CNT_FSYSSPECIALFOLDER + STR_SVT_MIMETYPE_CNT_SFSYSFILE, // CONTENT_TYPE_X_CNT_FSYSSPECIALFILE + STR_SVT_MIMETYPE_APP_TEMPLATE, // CONTENT_TYPE_APP_VND_TEMPLATE + STR_SVT_MIMETYPE_IMAGE_GENERIC, // CONTENT_TYPE_IMAGE_GENERIC + STR_SVT_MIMETYPE_X_STARMAIL, // CONTENT_TYPE_APP_VND_NEWS + STR_SVT_MIMETYPE_X_STARMAIL, // CONTENT_TYPE_APP_VND_OUTTRAY + STR_SVT_MIMETYPE_TEXT_HTML, // CONTENT_TYPE_X_CNT_HTTPFILE + STR_SVT_MIMETYPE_APP_MSEXCEL, // CONTENT_TYPE_APP_MSEXCEL + STR_SVT_MIMETYPE_APP_MSEXCEL_TEMPL, // CONTENT_TYPE_APP_MSEXCEL_TEMPL + STR_SVT_MIMETYPE_APP_MSPPOINT, // CONTENT_TYPE_APP_MSPPOINT + STR_SVT_MIMETYPE_APP_MSPPOINT, // CONTENT_TYPE_APP_MSPPOINT_TEMPL //@todo new presentation string? + STR_SVT_MIMETYPE_TEXT_VCALENDAR, // CONTENT_TYPE_TEXT_VCALENDAR + STR_SVT_MIMETYPE_TEXT_ICALENDAR, // CONTENT_TYPE_TEXT_ICALENDAR + STR_SVT_MIMETYPE_TEXT_XMLICALENDAR, // CONTENT_TYPE_TEXT_XMLICALENDAR + STR_SVT_MIMETYPE_TEXT_CDE_CALENDAR_APP, + // CONTENT_TYPE_APP_CDE_CALENDAR_APP + STR_SVT_MIMETYPE_INET_MSG_RFC822, // CONTENT_TYPE_INET_MESSAGE_RFC822 + STR_SVT_MIMETYPE_INET_MULTI_ALTERNATIVE, + // CONTENT_TYPE_INET_MULTIPART_ALTERNATIVE + STR_SVT_MIMETYPE_INET_MULTI_DIGEST, + // CONTENT_TYPE_INET_MULTIPART_DIGEST + STR_SVT_MIMETYPE_INET_MULTI_PARALLEL, + // CONTENT_TYPE_INET_MULTIPART_PARALLEL + STR_SVT_MIMETYPE_INET_MULTI_RELATED, + // CONTENT_TYPE_INET_MULTIPART_RELATED + STR_SVT_MIMETYPE_INET_MULTI_MIXED, + // CONTENT_TYPE_INET_MULTIPART_MIXED + STR_SVT_MIMETYPE_APP_IMPRESSPACKED, + // CONTENT_TYPE_APP_VND_IMPRESSPACKED + STR_SVT_MIMETYPE_APP_JAR, // CONTENT_TYPE_APP_JAR + STR_SVT_MIMETYPE_APP_SXWRITER, // CONTENT_TYPE_APP_VND_SUN_XML_WRITER + STR_SVT_MIMETYPE_APP_SXCALC, // CONTENT_TYPE_APP_VND_SUN_XML_CALC + STR_SVT_MIMETYPE_APP_SXIMPRESS, // CONTENT_TYPE_APP_VND_SUN_XML_IMPRESS + STR_SVT_MIMETYPE_APP_SXDRAW, // CONTENT_TYPE_APP_VND_SUN_XML_DRAW + STR_SVT_MIMETYPE_APP_SXCHART, // CONTENT_TYPE_APP_VND_SUN_XML_CHART + STR_SVT_MIMETYPE_APP_SXMATH, // CONTENT_TYPE_APP_VND_SUN_XML_MATH + STR_SVT_MIMETYPE_APP_SXGLOBAL, // CONTENT_TYPE_APP_VND_SUN_XML_WRITER_GLOBAL + STR_SVT_MIMETYPE_APP_SXIPACKED, // CONTENT_TYPE_APP_VND_SUN_XML_IMPRESSPACKED + }; + +//============================================================================ +/** A mapping from extensions to type IDs. Sorted by extension. + */ +MediaTypeEntry const aStaticExtensionMap[] + = { { "aif", CONTENT_TYPE_AUDIO_AIFF, "" }, + { "aiff", CONTENT_TYPE_AUDIO_AIFF, "" }, + { "appt", CONTENT_TYPE_APP_CDE_CALENDAR_APP, "" }, + { "au", CONTENT_TYPE_AUDIO_BASIC, "" }, + { "avi", CONTENT_TYPE_VIDEO_MSVIDEO, "" }, + { "bmp", CONTENT_TYPE_IMAGE_BMP, "" }, + { "cgm", CONTENT_TYPE_IMAGE_GENERIC, "" }, + { "doc", CONTENT_TYPE_APP_MSWORD, "" }, + { "dot", CONTENT_TYPE_APP_MSWORD_TEMPL, "" }, + { "dxf", CONTENT_TYPE_IMAGE_GENERIC, "" }, + { "eps", CONTENT_TYPE_IMAGE_GENERIC, "" }, + { "gal", CONTENT_TYPE_APP_GALLERY, "" }, + { "gif", CONTENT_TYPE_IMAGE_GIF, "" }, + { "htm", CONTENT_TYPE_TEXT_HTML, "" }, + { "html", CONTENT_TYPE_TEXT_HTML, "" }, + { "ics", CONTENT_TYPE_TEXT_ICALENDAR, "" }, + { "jar", CONTENT_TYPE_APP_JAR, "" }, + { "jpeg", CONTENT_TYPE_IMAGE_JPEG, "" }, + { "jpg", CONTENT_TYPE_IMAGE_JPEG, "" }, + { "met", CONTENT_TYPE_IMAGE_GENERIC, "" }, + { "mid", CONTENT_TYPE_AUDIO_MIDI, "" }, + { "midi", CONTENT_TYPE_AUDIO_MIDI, "" }, + { "pbm", CONTENT_TYPE_IMAGE_GENERIC, "" }, + { "pcd", CONTENT_TYPE_IMAGE_GENERIC, "" }, + { "pct", CONTENT_TYPE_IMAGE_GENERIC, "" }, + { "pcx", CONTENT_TYPE_IMAGE_PCX, "" }, + { "pdf", CONTENT_TYPE_APP_PDF, "" }, + { "pgm", CONTENT_TYPE_IMAGE_GENERIC, "" }, + { "png", CONTENT_TYPE_IMAGE_PNG, "" }, + { "pot", CONTENT_TYPE_APP_MSPPOINT_TEMPL, "" }, + { "ppm", CONTENT_TYPE_IMAGE_GENERIC, "" }, + { "ppt", CONTENT_TYPE_APP_MSPPOINT, "" }, + { "psd", CONTENT_TYPE_IMAGE_GENERIC, "" }, + { "ras", CONTENT_TYPE_IMAGE_GENERIC, "" }, + { "rtf", CONTENT_TYPE_APP_RTF, "" }, + { "sda", CONTENT_TYPE_APP_VND_DRAW, "" }, + { "sdc", CONTENT_TYPE_APP_VND_CALC, "" }, + { "sdd", CONTENT_TYPE_APP_VND_IMPRESS, "" }, + { "sdm", CONTENT_TYPE_APP_VND_MAIL, "" }, + { "sdp", CONTENT_TYPE_APP_VND_IMPRESSPACKED, "" }, + { "sds", CONTENT_TYPE_APP_VND_CHART, "" }, + { "sdw", CONTENT_TYPE_APP_VND_WRITER, "" }, + { "sd~", CONTENT_TYPE_X_STARMAIL, "" }, + { "sfs", CONTENT_TYPE_APP_FRAMESET , "" }, + { "sgl", CONTENT_TYPE_APP_VND_WRITER_GLOBAL , "" }, + { "sim", CONTENT_TYPE_APP_VND_IMAGE, "" }, + { "smd", CONTENT_TYPE_APP_STARMAIL_SMD, "" }, //CONTENT_TYPE_X_STARMAIL + { "smf", CONTENT_TYPE_APP_VND_MATH, "" }, + { "svh", CONTENT_TYPE_APP_STARHELP, "" }, + { "svm", CONTENT_TYPE_IMAGE_GENERIC, "" }, + { "sxc", CONTENT_TYPE_APP_VND_SUN_XML_CALC, "" }, + { "sxd", CONTENT_TYPE_APP_VND_SUN_XML_DRAW, "" }, + { "sxg", CONTENT_TYPE_APP_VND_SUN_XML_WRITER_GLOBAL, "" }, + { "sxi", CONTENT_TYPE_APP_VND_SUN_XML_IMPRESS, "" }, + { "sxm", CONTENT_TYPE_APP_VND_SUN_XML_MATH, "" }, + { "sxp", CONTENT_TYPE_APP_VND_SUN_XML_IMPRESSPACKED, "" }, + { "sxs", CONTENT_TYPE_APP_VND_SUN_XML_CHART, "" }, + { "sxw", CONTENT_TYPE_APP_VND_SUN_XML_WRITER, "" }, + { "tga", CONTENT_TYPE_IMAGE_GENERIC, "" }, + { "thm", CONTENT_TYPE_APP_GALLERY_THEME, "" }, + { "tif", CONTENT_TYPE_IMAGE_TIFF, "" }, + { "tiff", CONTENT_TYPE_IMAGE_TIFF, "" }, + { "txt", CONTENT_TYPE_TEXT_PLAIN, "" }, + { "url", CONTENT_TYPE_TEXT_URL, "" }, + { "vcf", CONTENT_TYPE_TEXT_VCARD, "" }, + { "vcs", CONTENT_TYPE_TEXT_VCALENDAR, "" }, + { "vdo", CONTENT_TYPE_VIDEO_VDO, "" }, + { "vor", CONTENT_TYPE_APP_VND_TEMPLATE, "" }, + { "wav", CONTENT_TYPE_AUDIO_WAV, "" }, + { "wmf", CONTENT_TYPE_IMAGE_GENERIC, "" }, + { "wrl", CONTENT_TYPE_X_VRML, "" }, + { "xbm", CONTENT_TYPE_IMAGE_GENERIC, "" }, + { "xcs", CONTENT_TYPE_TEXT_XMLICALENDAR, "" }, + { "xls", CONTENT_TYPE_APP_MSEXCEL, "" }, + { "xlt", CONTENT_TYPE_APP_MSEXCEL_TEMPL, "" }, + { "xlw", CONTENT_TYPE_APP_MSEXCEL, "" }, + { "xpm", CONTENT_TYPE_IMAGE_GENERIC, "" }, + { "zip", CONTENT_TYPE_APP_ZIP, "" } }; + +//============================================================================ +/** A mapping from presentations to type IDs. Sorted by presentations. + */ +MediaTypeEntry const aStaticPresentationMap[] + = { { "Binary Data", CONTENT_TYPE_APP_OCTSTREAM, "" }, + { "Bitmap", CONTENT_TYPE_IMAGE_BMP, "" }, + { "DOS Command File", CONTENT_TYPE_APP_OCTSTREAM, "" }, + { "Digital Video", CONTENT_TYPE_VIDEO_MSVIDEO, "" }, + { "Executable", CONTENT_TYPE_APP_OCTSTREAM, "" }, + { "Grafik", CONTENT_TYPE_IMAGE_GENERIC, "" }, + { "HTM", CONTENT_TYPE_TEXT_HTML, "" }, + { "HTML", CONTENT_TYPE_TEXT_HTML, "" }, + { "Hypertext", CONTENT_TYPE_TEXT_HTML, "" }, + { "Icon", CONTENT_TYPE_IMAGE_GENERIC, "" }, + { "Image File", CONTENT_TYPE_IMAGE_GENERIC, "" }, + { "MIDI", CONTENT_TYPE_AUDIO_MIDI, "" }, + { "Master Document", CONTENT_TYPE_APP_VND_WRITER_GLOBAL, "" }, + { "Plain Text", CONTENT_TYPE_TEXT_PLAIN, "" }, + { "StarCalc", CONTENT_TYPE_APP_VND_CALC, "" }, + { "StarCalc 3.0", CONTENT_TYPE_APP_VND_CALC, "" }, + { "StarCalc 4.0", CONTENT_TYPE_APP_VND_CALC, "" }, + { "StarCalc 5.0", CONTENT_TYPE_APP_VND_CALC, "" }, + { "StarCalc Datei", CONTENT_TYPE_APP_VND_CALC, "" }, + { "StarCalc Document", CONTENT_TYPE_APP_VND_CALC, "" }, + { "StarCalc File", CONTENT_TYPE_APP_VND_CALC, "" }, + { "StarChart 3.0", CONTENT_TYPE_APP_VND_CHART, "" }, + { "StarChart 4.0", CONTENT_TYPE_APP_VND_CHART, "" }, + { "StarChart 5.0", CONTENT_TYPE_APP_VND_CHART, "" }, + { "StarChart Document", CONTENT_TYPE_APP_VND_CHART, "" }, + { "StarDraw 3.0", CONTENT_TYPE_APP_VND_DRAW, "" }, + { "StarDraw 5.0", CONTENT_TYPE_APP_VND_DRAW, "" }, + { "StarDraw", CONTENT_TYPE_APP_VND_DRAW, "" }, + { "StarDraw Document", CONTENT_TYPE_APP_VND_DRAW, "" }, + { "StarImpress 4.0", CONTENT_TYPE_APP_VND_IMPRESS, "" }, + { "StarImpress 5.0 (packed)", CONTENT_TYPE_APP_VND_IMPRESSPACKED, "" }, + { "StarImpress 5.0", CONTENT_TYPE_APP_VND_IMPRESS, "" }, + { "StarImpress Document", CONTENT_TYPE_APP_VND_IMPRESS, "" }, + { "StarMath 3.0", CONTENT_TYPE_APP_VND_MATH, "" }, + { "StarMath 4.0", CONTENT_TYPE_APP_VND_MATH, "" }, + { "StarMath 5.0", CONTENT_TYPE_APP_VND_MATH, "" }, + { "StarMath Document", CONTENT_TYPE_APP_VND_MATH, "" }, + { "StarMessage5", CONTENT_TYPE_APP_VND_MAIL, "" }, + { "StarOffice XML (Calc)", CONTENT_TYPE_APP_VND_SUN_XML_CALC, "" }, + { "StarOffice XML (Impress)", CONTENT_TYPE_APP_VND_SUN_XML_IMPRESS, "" }, + { "StarOffice XML (Draw)", CONTENT_TYPE_APP_VND_SUN_XML_DRAW, "" }, + { "StarOffice XML (Chart)", CONTENT_TYPE_APP_VND_SUN_XML_CHART, "" }, + { "StarOffice XML (Writer)", CONTENT_TYPE_APP_VND_SUN_XML_WRITER, "" }, + { "StarWriter", CONTENT_TYPE_APP_VND_WRITER, "" }, + { "StarWriter 3.0", CONTENT_TYPE_APP_VND_WRITER, "" }, + { "StarWriter 4.0", CONTENT_TYPE_APP_VND_WRITER, "" }, + { "StarWriter 5.0", CONTENT_TYPE_APP_VND_WRITER, "" }, + { "StarWriter Document", CONTENT_TYPE_APP_VND_WRITER, "" }, + { "StarWriter/Global 5.0", CONTENT_TYPE_APP_VND_WRITER_GLOBAL, "" }, + { "StarWriter/Global Document", CONTENT_TYPE_APP_VND_WRITER_GLOBAL, "" }, + { "StarWriter/Web 5.0", CONTENT_TYPE_APP_VND_WRITER_WEB, "" }, + { "StarWriterGlobal Document", CONTENT_TYPE_APP_VND_WRITER_GLOBAL, "" }, + { "StarWriterHtml Document", CONTENT_TYPE_APP_VND_WRITER_WEB, "" }, + { "UniformResourceLocator", CONTENT_TYPE_TEXT_URL, "" }, + { "text/html", CONTENT_TYPE_TEXT_HTML, "" } }; + +} + +//============================================================================ +// +// Registration +// +//============================================================================ + +// static +Registration * Registration::m_pRegistration = 0; + +//============================================================================ +Registration::~Registration() +{ + {for (ULONG i = 0; i < m_aTypeIDMap.Count(); ++i) + delete static_cast< TypeIDMapEntry * >(m_aTypeIDMap.GetObject(i)); + } + m_aTypeIDMap.Clear(); + {for (USHORT i = 0; i < m_aTypeNameMap.Count(); ++i) + delete static_cast< TypeNameMapEntry * >(m_aTypeNameMap.GetObject(i)); + } + m_aTypeNameMap.Remove(USHORT(0), m_aTypeNameMap.Count()); + {for (USHORT i = 0; i < m_aExtensionMap.Count(); ++i) + delete + static_cast< ExtensionMapEntry * >(m_aExtensionMap.GetObject(i)); + } + m_aExtensionMap.Remove(USHORT(0), m_aExtensionMap.Count()); +} + +//============================================================================ +// static +TypeNameMapEntry * Registration::getExtensionEntry(UniString const & + rTypeName) +{ + if (m_pRegistration) + { + UniString aTheTypeName = rTypeName; + aTheTypeName.ToLowerAscii(); + USHORT nPos; + if (m_pRegistration->m_aTypeNameMap.Seek_Entry(&aTheTypeName, &nPos)) + return static_cast< TypeNameMapEntry * >(m_pRegistration-> + m_aTypeNameMap. + GetObject(nPos)); + } + return 0; +} + +//============================================================================ +// static +INetContentType Registration::RegisterContentType(UniString const & rTypeName, + UniString const & + rPresentation, + UniString const * + pExtension, + UniString const * + pSystemFileType) +{ + if (!m_pRegistration) + m_pRegistration = new Registration; + + DBG_ASSERT(GetContentType(rTypeName) == CONTENT_TYPE_UNKNOWN, + "Registration::RegisterContentType(): Already registered"); + + INetContentType eTypeID + = INetContentType(m_pRegistration->m_nNextDynamicID++); + UniString aTheTypeName = rTypeName; + aTheTypeName.ToLowerAscii(); + + TypeIDMapEntry * pTypeIDMapEntry = new TypeIDMapEntry; + pTypeIDMapEntry->m_aTypeName = aTheTypeName; + pTypeIDMapEntry->m_aPresentation = rPresentation; + if (pSystemFileType) + pTypeIDMapEntry->m_aSystemFileType = *pSystemFileType; + m_pRegistration->m_aTypeIDMap.Insert(eTypeID, pTypeIDMapEntry); + + TypeNameMapEntry * pTypeNameMapEntry = new TypeNameMapEntry(aTheTypeName); + if (pExtension) + pTypeNameMapEntry->m_aExtension = *pExtension; + pTypeNameMapEntry->m_eTypeID = eTypeID; + m_pRegistration->m_aTypeNameMap.Insert(pTypeNameMapEntry); + + if (pExtension) + { + ExtensionMapEntry * pExtensionMapEntry + = new ExtensionMapEntry(*pExtension); + pExtensionMapEntry->m_eTypeID = eTypeID; + m_pRegistration->m_aExtensionMap.Insert(pExtensionMapEntry); + } + + return eTypeID; +} + +//============================================================================ +// static +INetContentType Registration::GetContentType(UniString const & rTypeName) +{ + if (!m_pRegistration) + m_pRegistration = new Registration; + + UniString aTheTypeName = rTypeName; + aTheTypeName.ToLowerAscii(); + USHORT nPos; + return m_pRegistration->m_aTypeNameMap.Seek_Entry(&aTheTypeName, &nPos) ? + static_cast< TypeNameMapEntry * >(m_pRegistration-> + m_aTypeNameMap. + GetObject(nPos))-> + m_eTypeID : + CONTENT_TYPE_UNKNOWN; +} + +//============================================================================ +// static +UniString Registration::GetContentType(INetContentType eTypeID) +{ + if (!m_pRegistration) + m_pRegistration = new Registration; + + TypeIDMapEntry * pEntry + = static_cast< TypeIDMapEntry * >(m_pRegistration-> + m_aTypeIDMap.Get(eTypeID)); + return pEntry ? pEntry->m_aTypeName : UniString(); +} + +//============================================================================ +// static +UniString Registration::GetPresentation(INetContentType eTypeID) +{ + if (!m_pRegistration) + m_pRegistration = new Registration; + + TypeIDMapEntry * pEntry + = static_cast< TypeIDMapEntry * >(m_pRegistration-> + m_aTypeIDMap.Get(eTypeID)); + return pEntry ? pEntry->m_aPresentation : UniString(); +} + +//============================================================================ +// static +UniString Registration::GetExtension(UniString const & rTypeName) +{ + if (!m_pRegistration) + m_pRegistration = new Registration; + + UniString aTheTypeName = rTypeName; + aTheTypeName.ToLowerAscii(); + USHORT nPos; + return m_pRegistration->m_aTypeNameMap.Seek_Entry(&aTheTypeName, &nPos) ? + static_cast< TypeNameMapEntry * >(m_pRegistration-> + m_aTypeNameMap. + GetObject(nPos))-> + m_aExtension : + UniString(); +} + +//============================================================================ +// static +INetContentType Registration::GetContentType4Extension(UniString const & + rExtension) +{ + if (!m_pRegistration) + m_pRegistration = new Registration; + + USHORT nPos; + return m_pRegistration-> + m_aExtensionMap. + Seek_Entry(const_cast< UniString * >(&rExtension), + &nPos) ? + static_cast< ExtensionMapEntry * >(m_pRegistration-> + m_aExtensionMap. + GetObject(nPos))-> + m_eTypeID : + CONTENT_TYPE_UNKNOWN; +} + +//============================================================================ +// +// seekEntry +// +//============================================================================ + +namespace unnamed_svtools_inettype { + +MediaTypeEntry const * seekEntry(UniString const & rTypeName, + MediaTypeEntry const * pMap, sal_Size nSize) +{ +#if defined DBG_UTIL || defined INETTYPE_DEBUG + static bool bChecked = false; + if (!bChecked) + { + for (sal_Size i = 0; i < nSize - 1; ++i) + DBG_ASSERT(pMap[i].m_pTypeName < pMap[i + 1].m_pTypeName, + "seekEntry(): Bad map"); + bChecked = true; + } +#endif // DBG_UTIL, INETTYPE_DEBUG + + sal_Size nLow = 0; + sal_Size nHigh = nSize; + while (nLow != nHigh) + { + sal_Size nMiddle = (nLow + nHigh) / 2; + MediaTypeEntry const * pEntry = pMap + nMiddle; + switch (rTypeName.CompareIgnoreCaseToAscii(pEntry->m_pTypeName)) + { + case COMPARE_LESS: + nHigh = nMiddle; + break; + + case COMPARE_EQUAL: + return pEntry; + + case COMPARE_GREATER: + nLow = nMiddle + 1; + break; + } + } + return 0; +} + +} + +//============================================================================ +// +// INetContentTypes +// +//============================================================================ + +//static +void INetContentTypes::Uninitialize() +{ + Registration::deinitialize(); +} + +//============================================================================ +//static +INetContentType INetContentTypes::RegisterContentType(UniString const & + rTypeName, + UniString const & + rPresentation, + UniString const * + pExtension, + UniString const * + pSystemFileType) +{ + INetContentType eTypeID = GetContentType(rTypeName); + if (eTypeID == CONTENT_TYPE_UNKNOWN) + eTypeID = Registration::RegisterContentType(rTypeName, rPresentation, + pExtension, + pSystemFileType); + else if (eTypeID > CONTENT_TYPE_LAST) + { + TypeIDMapEntry * pTypeEntry = Registration::getEntry(eTypeID); + if (pTypeEntry) + { + if (rPresentation.Len() != 0) + pTypeEntry->m_aPresentation = rPresentation; + if (pSystemFileType) + pTypeEntry->m_aSystemFileType = *pSystemFileType; + } + if (pExtension) + { + TypeNameMapEntry * pEntry + = Registration::getExtensionEntry(rTypeName); + if (pEntry) + pEntry->m_aExtension = *pExtension; + } + } + return eTypeID; +} + +//============================================================================ +// static +INetContentType INetContentTypes::GetContentType(UniString const & rTypeName) +{ + UniString aType; + UniString aSubType; + if (parse(rTypeName, aType, aSubType)) + { + aType += '/'; + aType += aSubType; + MediaTypeEntry const * pEntry = seekEntry(aType, aStaticTypeNameMap, + CONTENT_TYPE_LAST + 1); + return pEntry ? pEntry->m_eTypeID : + Registration::GetContentType(aType); + } + else + return + rTypeName.EqualsIgnoreCaseAscii(CONTENT_TYPE_STR_X_STARMAIL) ? + CONTENT_TYPE_X_STARMAIL : CONTENT_TYPE_UNKNOWN; + // the content type "x-starmail" has no sub type +} + +//============================================================================ +//static +UniString INetContentTypes::GetContentType(INetContentType eTypeID) +{ + static sal_Char const * aMap[CONTENT_TYPE_LAST + 1]; + static bool bInitialized = false; + if (!bInitialized) + { + for (sal_Size i = 0; i <= CONTENT_TYPE_LAST; ++i) + aMap[aStaticTypeNameMap[i].m_eTypeID] + = aStaticTypeNameMap[i].m_pTypeName; + aMap[CONTENT_TYPE_UNKNOWN] = CONTENT_TYPE_STR_APP_OCTSTREAM; + aMap[CONTENT_TYPE_TEXT_PLAIN] = CONTENT_TYPE_STR_TEXT_PLAIN + "; charset=iso-8859-1"; + bInitialized = true; + } + + UniString aTypeName = eTypeID <= CONTENT_TYPE_LAST ? + UniString::CreateFromAscii(aMap[eTypeID]) : + Registration::GetContentType(eTypeID); + if (aTypeName.Len() == 0) + { + DBG_ERROR("INetContentTypes::GetContentType(): Bad ID"); + return + UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM( + CONTENT_TYPE_STR_APP_OCTSTREAM)); + } + return aTypeName; +} + +//============================================================================ +//static +UniString INetContentTypes::GetPresentation(INetContentType eTypeID, + const ::com::sun::star::lang::Locale& aLocale) +{ + USHORT nResID = USHORT(); + if (eTypeID <= CONTENT_TYPE_LAST) + nResID = aStaticResourceIDMap[eTypeID]; + else + { + UniString aPresentation = Registration::GetPresentation(eTypeID); + if (aPresentation.Len() == 0) + nResID = STR_SVT_MIMETYPE_APP_OCTSTREAM; + else + return aPresentation; + } + return SvtSimpleResId(nResID, aLocale); +} + +//============================================================================ +//static +UniString INetContentTypes::GetExtension(UniString const & rTypeName) +{ + MediaTypeEntry const * pEntry = seekEntry(rTypeName, aStaticTypeNameMap, + CONTENT_TYPE_LAST + 1); + if (pEntry) + return UniString::CreateFromAscii(pEntry->m_pExtension); + + UniString aExtension = Registration::GetExtension(rTypeName); + if (aExtension.Len() != 0) + return aExtension; + // special handling of text types, which come in uncounted variations: + return rTypeName.EqualsIgnoreCaseAscii("text", 0, + RTL_CONSTASCII_LENGTH("text")) ? + UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("txt")) : + UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("tmp")); +} + +//============================================================================ +//static +INetContentType INetContentTypes::GetContentType4Extension(UniString const & + rExtension) +{ + MediaTypeEntry const * pEntry = seekEntry(rExtension, aStaticExtensionMap, + sizeof aStaticExtensionMap + / sizeof (MediaTypeEntry)); + if (pEntry) + return pEntry->m_eTypeID; + INetContentType eTypeID + = Registration::GetContentType4Extension(rExtension); + return eTypeID == CONTENT_TYPE_UNKNOWN ? CONTENT_TYPE_APP_OCTSTREAM : + eTypeID; +} + +//============================================================================ +//static +INetContentType INetContentTypes::GetContentTypeFromURL(UniString const & + rURL) +{ + INetContentType eTypeID = CONTENT_TYPE_UNKNOWN; + UniString aToken = rURL.GetToken(0, ':'); + if (aToken.Len() != 0) + { + if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_FILE)) + if (rURL.GetChar(rURL.Len() - 1) == '/') // folder + if (rURL.Len() > RTL_CONSTASCII_LENGTH("file:///")) + if (WildCard(UniString(RTL_CONSTASCII_USTRINGPARAM( + "*/{*}/"))). + Matches(rURL)) // special folder + eTypeID = CONTENT_TYPE_X_CNT_FSYSSPECIALFOLDER; + else + // drive? -> "file:///?|/" + if (rURL.Len() == 11 + && rURL.GetChar(rURL.Len() - 2) == '|') + { + // Drives need further processing, because of + // dynamic type according to underlying volume, + // which cannot be determined here. + } + else // normal folder + eTypeID = CONTENT_TYPE_X_CNT_FSYSFOLDER; + else // file system root + eTypeID = CONTENT_TYPE_X_CNT_FSYSBOX; + else // file + { + //@@@ + } + else if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_HTTP) + || aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_HTTPS)) + eTypeID = CONTENT_TYPE_TEXT_HTML; + else if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_PRIVATE)) + { + UniString aSecondPart = rURL.GetToken(1, ':'); + aToken = aSecondPart.GetToken(0, '/'); + if (aToken.EqualsAscii(INETTYPE_URL_SUB_FACTORY)) + { + aToken = aSecondPart.GetToken(1, '/'); + if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SWRITER)) + { + aToken = aSecondPart.GetToken(2, '/'); + eTypeID = aToken.EqualsAscii(INETTYPE_URL_SSSUB_WEB) ? + CONTENT_TYPE_APP_VND_WRITER_WEB : + aToken.EqualsAscii(INETTYPE_URL_SSSUB_GLOB) ? + CONTENT_TYPE_APP_VND_WRITER_GLOBAL : + CONTENT_TYPE_APP_VND_WRITER; + } + else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SCALC)) + eTypeID = CONTENT_TYPE_APP_VND_CALC; + else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SDRAW)) + eTypeID = CONTENT_TYPE_APP_VND_DRAW; + else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SIMPRESS)) + eTypeID = CONTENT_TYPE_APP_VND_IMPRESS; + else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SCHART)) + eTypeID = CONTENT_TYPE_APP_VND_CHART; + else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SIMAGE)) + eTypeID = CONTENT_TYPE_APP_VND_IMAGE; + else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SMATH)) + eTypeID = CONTENT_TYPE_APP_VND_MATH; + else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_FRAMESET)) + eTypeID = CONTENT_TYPE_APP_FRAMESET; + } + else if (aToken.EqualsAscii(INETTYPE_URL_SUB_HELPID)) + eTypeID = CONTENT_TYPE_APP_STARHELP; + } + else if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_COMPONENT)) + { + aToken = rURL.GetToken(1, ':'); // aToken now equals ss / * + aToken = aToken.GetToken(0, '/'); + if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SS)) + eTypeID = rURL.SearchAscii(INETTYPE_URL_SCHED_CMB) + == STRING_NOTFOUND + && rURL.SearchAscii(INETTYPE_URL_SCHED_FORM) + == STRING_NOTFOUND ? + CONTENT_TYPE_APP_SCHEDULE : + rURL.SearchAscii(INETTYPE_URL_SCHED_TASK) + == STRING_NOTFOUND ? + CONTENT_TYPE_APP_SCHEDULE_EVT : + CONTENT_TYPE_APP_SCHEDULE_TASK; + } + else if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_MAILTO)) + eTypeID = CONTENT_TYPE_APP_VND_OUTTRAY; + else if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_MACRO)) + eTypeID = CONTENT_TYPE_APP_MACRO; + else if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_DATA)) + { + UniString aSecondPart = rURL.GetToken(1, ':'); + aToken = aSecondPart.GetToken(0, ','); + eTypeID = GetContentType(aToken); + } + } + if (eTypeID == CONTENT_TYPE_UNKNOWN) + { + UniString aExtension; + if (GetExtensionFromURL(rURL, aExtension)) + eTypeID = GetContentType4Extension(aExtension); + } + return eTypeID; +} + +//============================================================================ +//static +bool INetContentTypes::GetExtensionFromURL(UniString const & rURL, + UniString & rExtension) +{ + xub_StrLen nSlashPos = 0; + xub_StrLen i = 0; + while (i != STRING_NOTFOUND) + { + nSlashPos = i; + i = rURL.Search('/', i + 1); + } + if (nSlashPos != 0) + { + xub_StrLen nLastDotPos = i = rURL.Search('.', nSlashPos); + while (i != STRING_NOTFOUND) + { + nLastDotPos = i; + i = rURL.Search('.', i + 1); + } + if (nLastDotPos != STRING_NOTFOUND) + rExtension = rURL.Copy(nLastDotPos + 1); + return true; + } + return false; +} + +//============================================================================ +//static +INetContentType INetContentTypes::MapStringToContentType(UniString const & + rPresentation) +{ + MediaTypeEntry const * pEntry = seekEntry(rPresentation, + aStaticPresentationMap, + sizeof aStaticPresentationMap + / sizeof (MediaTypeEntry)); + return pEntry ? pEntry->m_eTypeID : CONTENT_TYPE_UNKNOWN; +} + +//============================================================================ +// static +bool INetContentTypes::parse(ByteString const & rMediaType, + ByteString & rType, ByteString & rSubType, + INetContentTypeParameterList * pParameters) +{ + sal_Char const * p = rMediaType.GetBuffer(); + sal_Char const * pEnd = p + rMediaType.Len(); + + p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); + sal_Char const * pToken = p; + bool bDowncase = false; + while (p != pEnd && INetMIME::isTokenChar(*p)) + { + bDowncase = bDowncase || INetMIME::isUpperCase(*p); + ++p; + } + if (p == pToken) + return false; + rType = ByteString(pToken, sal::static_int_cast< xub_StrLen >(p - pToken)); + if (bDowncase) + rType.ToLowerAscii(); + + p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); + if (p == pEnd || *p++ != '/') + return false; + + p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); + pToken = p; + bDowncase = false; + while (p != pEnd && INetMIME::isTokenChar(*p)) + { + bDowncase = bDowncase || INetMIME::isUpperCase(*p); + ++p; + } + if (p == pToken) + return false; + rSubType = ByteString( + pToken, sal::static_int_cast< xub_StrLen >(p - pToken)); + if (bDowncase) + rSubType.ToLowerAscii(); + + return INetMIME::scanParameters(p, pEnd, pParameters) == pEnd; +} + +//============================================================================ +// static +bool INetContentTypes::parse(UniString const & rMediaType, + UniString & rType, UniString & rSubType, + INetContentTypeParameterList * pParameters) +{ + sal_Unicode const * p = rMediaType.GetBuffer(); + sal_Unicode const * pEnd = p + rMediaType.Len(); + + p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); + sal_Unicode const * pToken = p; + bool bDowncase = false; + while (p != pEnd && INetMIME::isTokenChar(*p)) + { + bDowncase = bDowncase || INetMIME::isUpperCase(*p); + ++p; + } + if (p == pToken) + return false; + rType = UniString(pToken, sal::static_int_cast< xub_StrLen >(p - pToken)); + if (bDowncase) + rType.ToLowerAscii(); + + p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); + if (p == pEnd || *p++ != '/') + return false; + + p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); + pToken = p; + bDowncase = false; + while (p != pEnd && INetMIME::isTokenChar(*p)) + { + bDowncase = bDowncase || INetMIME::isUpperCase(*p); + ++p; + } + if (p == pToken) + return false; + rSubType = UniString( + pToken, sal::static_int_cast< xub_StrLen >(p - pToken)); + if (bDowncase) + rSubType.ToLowerAscii(); + + return INetMIME::scanParameters(p, pEnd, pParameters) == pEnd; +} + +//============================================================================ +// static +ByteString INetContentTypes::appendUSASCIIParameter(ByteString const & + rMediaType, + ByteString const & + rAttribute, + ByteString const & rValue) +{ + ByteString aResult = rMediaType; + aResult.Append(RTL_CONSTASCII_STRINGPARAM("; ")); + aResult += rAttribute; + aResult += '='; + bool bQuote = false; + for (xub_StrLen i = 0; i < rValue.Len(); ++i) + { + // When the value contains any ' characters, use a quoted string + // instead of a token, in order to avoid confusion with RFC 2231 + // extensions: + sal_uInt32 nChar = sal_uChar(rValue.GetChar(i)); + DBG_ASSERT(INetMIME::isUSASCII(nChar), + "INetContentTypes::appendUSASCIIParameter(): Bad value"); + if (!INetMIME::isTokenChar(nChar) || nChar == '\'') + { + bQuote = true; + break; + } + } + if (bQuote) + { + aResult += '"'; + for (xub_StrLen i = 0; i < rValue.Len(); ++i) + { + // Escape LF as well as CR to avoid confusion with line folding: + sal_uInt32 nChar = sal_uChar(rValue.GetChar(i)); + DBG_ASSERT(INetMIME::isUSASCII(nChar), + "INetContentTypes::appendUSASCIIParameter():" + " Bad value"); + switch (nChar) + { + case 0x0A: // LF + case 0x0D: // CR + case '"': + case '\\': + aResult += '\\'; + default: + aResult += static_cast< char >(nChar); + break; + } + } + aResult += '"'; + } + else + aResult += rValue; + return aResult; +} + +//============================================================================ +// static +UniString INetContentTypes::appendUSASCIIParameter(UniString const & + rMediaType, + UniString const & + rAttribute, + UniString const & rValue) +{ + UniString aResult = rMediaType; + aResult.AppendAscii(RTL_CONSTASCII_STRINGPARAM("; ")); + aResult += rAttribute; + aResult += '='; + bool bQuote = false; + for (xub_StrLen i = 0; i < rValue.Len(); ++i) + { + // When the value contains any ' characters, use a quoted string + // instead of a token, in order to avoid confusion with RFC 2231 + // extensions: + sal_uInt32 nChar = rValue.GetChar(i); + DBG_ASSERT(INetMIME::isUSASCII(nChar), + "INetContentTypes::appendUSASCIIParameter(): Bad value"); + if (!INetMIME::isTokenChar(nChar) || nChar == '\'') + { + bQuote = true; + break; + } + } + if (bQuote) + { + aResult += '"'; + for (xub_StrLen i = 0; i < rValue.Len(); ++i) + { + // Escape LF as well as CR to avoid confusion with line folding: + sal_uInt32 nChar = rValue.GetChar(i); + DBG_ASSERT(INetMIME::isUSASCII(nChar), + "INetContentTypes::appendUSASCIIParameter():" + " Bad value"); + switch (nChar) + { + case 0x0A: // LF + case 0x0D: // CR + case '"': + case '\\': + aResult += '\\'; + default: + aResult += sal_Unicode(nChar); + break; + } + } + aResult += '"'; + } + else + aResult += rValue; + return aResult; +} + diff --git a/svl/source/misc/lngmisc.cxx b/svl/source/misc/lngmisc.cxx new file mode 100644 index 000000000000..e00540af1ab1 --- /dev/null +++ b/svl/source/misc/lngmisc.cxx @@ -0,0 +1,141 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: lngmisc.cxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include +#include +#include +#include +#include +#include + + +using namespace rtl; + +namespace linguistic +{ + +/////////////////////////////////////////////////////////////////////////// + +INT32 GetNumControlChars( const OUString &rTxt ) +{ + INT32 nCnt = 0; + INT32 nLen = rTxt.getLength(); + for (INT32 i = 0; i < nLen; ++i) + { + if (IsControlChar( rTxt[i] )) + ++nCnt; + } + return nCnt; +} + + +BOOL RemoveHyphens( OUString &rTxt ) +{ + BOOL bModified = FALSE; + if (HasHyphens( rTxt )) + { + String aTmp( rTxt ); + aTmp.EraseAllChars( SVT_SOFT_HYPHEN ); + aTmp.EraseAllChars( SVT_HARD_HYPHEN ); + rTxt = aTmp; + bModified = TRUE; + } + return bModified; +} + + +BOOL RemoveControlChars( OUString &rTxt ) +{ + BOOL bModified = FALSE; + INT32 nCtrlChars = GetNumControlChars( rTxt ); + if (nCtrlChars) + { + INT32 nLen = rTxt.getLength(); + INT32 nSize = nLen - nCtrlChars; + OUStringBuffer aBuf( nSize ); + aBuf.setLength( nSize ); + INT32 nCnt = 0; + for (INT32 i = 0; i < nLen; ++i) + { + sal_Unicode cChar = rTxt[i]; + if (!IsControlChar( cChar )) + { + DBG_ASSERT( nCnt < nSize, "index out of range" ); + aBuf.setCharAt( nCnt++, cChar ); + } + } + DBG_ASSERT( nCnt == nSize, "wrong size" ); + rTxt = aBuf.makeStringAndClear(); + bModified = TRUE; + } + return bModified; +} + + +// non breaking field character +#define CH_TXTATR_INWORD ((sal_Char) 0x02) + +BOOL ReplaceControlChars( rtl::OUString &rTxt, sal_Char /*aRplcChar*/ ) +{ + // the resulting string looks like this: + // 1. non breaking field characters get removed + // 2. remaining control characters will be replaced by ' ' + + BOOL bModified = FALSE; + INT32 nCtrlChars = GetNumControlChars( rTxt ); + if (nCtrlChars) + { + INT32 nLen = rTxt.getLength(); + OUStringBuffer aBuf( nLen ); + INT32 nCnt = 0; + for (INT32 i = 0; i < nLen; ++i) + { + sal_Unicode cChar = rTxt[i]; + if (CH_TXTATR_INWORD != cChar) + { + if (IsControlChar( cChar )) + cChar = ' '; + DBG_ASSERT( nCnt < nLen, "index out of range" ); + aBuf.setCharAt( nCnt++, cChar ); + } + } + aBuf.setLength( nCnt ); + rTxt = aBuf.makeStringAndClear(); + bModified = TRUE; + } + return bModified; +} + +/////////////////////////////////////////////////////////////////////////// + +} // namespace linguistic + diff --git a/svl/source/misc/lockfilecommon.cxx b/svl/source/misc/lockfilecommon.cxx new file mode 100644 index 000000000000..ba4440c462a8 --- /dev/null +++ b/svl/source/misc/lockfilecommon.cxx @@ -0,0 +1,276 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ,v $ + * + * $Revision: $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include + +#include + +#include + +#include + +using namespace ::com::sun::star; + +namespace svt { + +// ---------------------------------------------------------------------- +LockFileCommon::LockFileCommon( const ::rtl::OUString& aOrigURL, const uno::Reference< lang::XMultiServiceFactory >& xFactory, const ::rtl::OUString& aPrefix ) +: m_xFactory( xFactory ) +{ + if ( !m_xFactory.is() ) + m_xFactory = ::comphelper::getProcessServiceFactory(); + + INetURLObject aDocURL = ResolveLinks( INetURLObject( aOrigURL ) ); + + ::rtl::OUString aShareURLString = aDocURL.GetPartBeforeLastName(); + aShareURLString += aPrefix; + aShareURLString += aDocURL.GetName(); + aShareURLString += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "#" ) ); + m_aURL = INetURLObject( aShareURLString ).GetMainURL( INetURLObject::NO_DECODE ); +} + +// ---------------------------------------------------------------------- +LockFileCommon::~LockFileCommon() +{ +} + +// ---------------------------------------------------------------------- +INetURLObject LockFileCommon::ResolveLinks( const INetURLObject& aDocURL ) +{ + if ( aDocURL.HasError() ) + throw lang::IllegalArgumentException(); + + ::rtl::OUString aURLToCheck = aDocURL.GetMainURL( INetURLObject::NO_DECODE ); + + sal_Bool bNeedsChecking = sal_True; + sal_Int32 nMaxLinkCount = 128; + sal_Int32 nCount = 0; + + while( bNeedsChecking ) + { + bNeedsChecking = sal_False; + + // do not allow too deep links + if ( nCount++ >= nMaxLinkCount ) + throw io::IOException(); + + // there is currently no UCB functionality to resolve the symbolic links; + // since the lock files are used only for local file systems the osl functionality is used directly + + ::osl::FileStatus aStatus( FileStatusMask_Type | FileStatusMask_LinkTargetURL ); + ::osl::DirectoryItem aItem; + if ( ::osl::FileBase::E_None == ::osl::DirectoryItem::get( aURLToCheck, aItem ) + && aItem.is() && ::osl::FileBase::E_None == aItem.getFileStatus( aStatus ) ) + { + if ( aStatus.isValid( FileStatusMask_Type ) + && aStatus.isValid( FileStatusMask_LinkTargetURL ) + && aStatus.getFileType() == ::osl::FileStatus::Link ) + { + aURLToCheck = aStatus.getLinkTargetURL(); + bNeedsChecking = sal_True; + } + } + } + + return INetURLObject( aURLToCheck ); +} + +// ---------------------------------------------------------------------- +uno::Sequence< uno::Sequence< ::rtl::OUString > > LockFileCommon::ParseList( const uno::Sequence< sal_Int8 >& aBuffer ) +{ + sal_Int32 nCurPos = 0; + sal_Int32 nCurEntry = 0; + uno::Sequence< uno::Sequence< ::rtl::OUString > > aResult( 10 ); + + while ( nCurPos < aBuffer.getLength() ) + { + if ( nCurEntry >= aResult.getLength() ) + aResult.realloc( nCurEntry + 10 ); + aResult[nCurEntry] = ParseEntry( aBuffer, nCurPos ); + nCurEntry++; + } + + aResult.realloc( nCurEntry ); + return aResult; +} + +// ---------------------------------------------------------------------- +uno::Sequence< ::rtl::OUString > LockFileCommon::ParseEntry( const uno::Sequence< sal_Int8 >& aBuffer, sal_Int32& io_nCurPos ) +{ + uno::Sequence< ::rtl::OUString > aResult( LOCKFILE_ENTRYSIZE ); + + for ( int nInd = 0; nInd < LOCKFILE_ENTRYSIZE; nInd++ ) + { + aResult[nInd] = ParseName( aBuffer, io_nCurPos ); + if ( io_nCurPos >= aBuffer.getLength() + || ( nInd < LOCKFILE_ENTRYSIZE - 1 && aBuffer[io_nCurPos++] != ',' ) + || ( nInd == LOCKFILE_ENTRYSIZE - 1 && aBuffer[io_nCurPos++] != ';' ) ) + throw io::WrongFormatException(); + } + + return aResult; +} + +// ---------------------------------------------------------------------- +::rtl::OUString LockFileCommon::ParseName( const uno::Sequence< sal_Int8 >& aBuffer, sal_Int32& io_nCurPos ) +{ + ::rtl::OStringBuffer aResult; + sal_Bool bHaveName = sal_False; + sal_Bool bEscape = sal_False; + + while( !bHaveName ) + { + if ( io_nCurPos >= aBuffer.getLength() ) + throw io::WrongFormatException(); + + if ( bEscape ) + { + if ( aBuffer[io_nCurPos] == ',' || aBuffer[io_nCurPos] == ';' || aBuffer[io_nCurPos] == '\\' ) + aResult.append( (sal_Char)aBuffer[io_nCurPos] ); + else + throw io::WrongFormatException(); + + bEscape = sal_False; + io_nCurPos++; + } + else if ( aBuffer[io_nCurPos] == ',' || aBuffer[io_nCurPos] == ';' ) + bHaveName = sal_True; + else + { + if ( aBuffer[io_nCurPos] == '\\' ) + bEscape = sal_True; + else + aResult.append( (sal_Char)aBuffer[io_nCurPos] ); + + io_nCurPos++; + } + } + + return ::rtl::OStringToOUString( aResult.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ); +} + +// ---------------------------------------------------------------------- +::rtl::OUString LockFileCommon::EscapeCharacters( const ::rtl::OUString& aSource ) +{ + ::rtl::OUStringBuffer aBuffer; + const sal_Unicode* pStr = aSource.getStr(); + for ( sal_Int32 nInd = 0; nInd < aSource.getLength() && pStr[nInd] != 0; nInd++ ) + { + if ( pStr[nInd] == '\\' || pStr[nInd] == ';' || pStr[nInd] == ',' ) + aBuffer.append( (sal_Unicode)'\\' ); + aBuffer.append( pStr[nInd] ); + } + + return aBuffer.makeStringAndClear(); +} + +// ---------------------------------------------------------------------- +::rtl::OUString LockFileCommon::GetOOOUserName() +{ + SvtUserOptions aUserOpt; + ::rtl::OUString aName = aUserOpt.GetFirstName(); + if ( aName.getLength() ) + aName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " ) ); + aName += aUserOpt.GetLastName(); + + return aName; +} + +// ---------------------------------------------------------------------- +::rtl::OUString LockFileCommon::GetCurrentLocalTime() +{ + ::rtl::OUString aTime; + + TimeValue aSysTime; + if ( osl_getSystemTime( &aSysTime ) ) + { + TimeValue aLocTime; + if ( osl_getLocalTimeFromSystemTime( &aSysTime, &aLocTime ) ) + { + oslDateTime aDateTime; + if ( osl_getDateTimeFromTimeValue( &aLocTime, &aDateTime ) ) + { + char pDateTime[20]; + sprintf( pDateTime, "%02d.%02d.%4d %02d:%02d", aDateTime.Day, aDateTime.Month, aDateTime.Year, aDateTime.Hours, aDateTime.Minutes ); + aTime = ::rtl::OUString::createFromAscii( pDateTime ); + } + } + } + + return aTime; +} + +// ---------------------------------------------------------------------- +uno::Sequence< ::rtl::OUString > LockFileCommon::GenerateOwnEntry() +{ + uno::Sequence< ::rtl::OUString > aResult( LOCKFILE_ENTRYSIZE ); + + aResult[LOCKFILE_OOOUSERNAME_ID] = GetOOOUserName(); + + ::osl::Security aSecurity; + aSecurity.getUserName( aResult[LOCKFILE_SYSUSERNAME_ID] ); + + aResult[LOCKFILE_LOCALHOST_ID] = ::osl::SocketAddr::getLocalHostname(); + + aResult[LOCKFILE_EDITTIME_ID] = GetCurrentLocalTime(); + + ::utl::Bootstrap::locateUserInstallation( aResult[LOCKFILE_USERURL_ID] ); + + + return aResult; +} + +} // namespace svt + diff --git a/svl/source/misc/mediatyp.src b/svl/source/misc/mediatyp.src new file mode 100644 index 000000000000..c7acdf8efc45 --- /dev/null +++ b/svl/source/misc/mediatyp.src @@ -0,0 +1,610 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: mediatyp.src,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +//============================================================================ +// +// Internet Media Type Presentations +// +// $Author: rt $ $Date: 2008-04-10 21:44:39 $ $Revision: 1.7 $ +//============================================================================ + +#ifndef _SVTOOLS_HRC +#include +#endif + +String STR_SVT_MIMETYPE_APP_OCTSTREAM +{ + Text [ en-US ] = "Binary file" ; +}; + +String STR_SVT_MIMETYPE_APP_PDF +{ + Text [ en-US ] = "PDF file" ; +}; + +String STR_SVT_MIMETYPE_APP_RTF +{ + Text [ en-US ] = "RTF File" ; +}; + +String STR_SVT_MIMETYPE_APP_MSWORD +{ + Text [ en-US ] = "MS-Word document" ; +}; + +String STR_SVT_MIMETYPE_APP_STARCALC +{ + Text [ en-US ] = "%PRODUCTNAME Spreadsheet" ; +}; + +String STR_SVT_MIMETYPE_APP_STARCHART +{ + Text [ en-US ] = "%PRODUCTNAME Chart" ; +}; + +String STR_SVT_MIMETYPE_APP_STARDRAW +{ + Text [ en-US ] = "%PRODUCTNAME Drawing" ; +}; + +String STR_SVT_MIMETYPE_APP_STARIMAGE +{ + Text [ en-US ] = "%PRODUCTNAME Image" ; +}; + +String STR_SVT_MIMETYPE_APP_STARMATH +{ + Text [ en-US ] = "%PRODUCTNAME Formula" ; +}; + +String STR_SVT_MIMETYPE_APP_STARWRITER +{ + Text [ en-US ] = "%PRODUCTNAME Text" ; +}; + +String STR_SVT_MIMETYPE_APP_ZIP +{ + Text [ en-US ] = "ZIP file" ; +}; + +String STR_SVT_MIMETYPE_APP_JAR +{ + Text [ en-US ] = "JAR file" ; +}; + +String STR_SVT_MIMETYPE_AUDIO_AIFF +{ + Text [ en-US ] = "Audio file" ; +}; + +String STR_SVT_MIMETYPE_AUDIO_BASIC +{ + Text [ en-US ] = "Audio file" ; +}; + +String STR_SVT_MIMETYPE_AUDIO_MIDI +{ + Text [ en-US ] = "Audio file" ; +}; + +String STR_SVT_MIMETYPE_AUDIO_WAV +{ + Text [ en-US ] = "Audio file" ; +}; + +String STR_SVT_MIMETYPE_IMAGE_GIF +{ + Text [ en-US ] = "Graphics" ; +}; + +String STR_SVT_MIMETYPE_IMAGE_JPEG +{ + Text [ en-US ] = "Graphics" ; +}; + +String STR_SVT_MIMETYPE_IMAGE_PCX +{ + Text [ en-US ] = "Graphics" ; +}; + +String STR_SVT_MIMETYPE_IMAGE_BMP +{ + Text [ en-US ] = "Bitmap" ; +}; + +String STR_SVT_MIMETYPE_TEXT_HTML +{ + Text [ en-US ] = "HTML document" ; +}; + +String STR_SVT_MIMETYPE_TEXT_PLAIN +{ + Text [ en-US ] = "Text file" ; +}; + +String STR_SVT_MIMETYPE_TEXT_URL +{ + Text [ en-US ] = "Bookmark" ; +}; + +String STR_SVT_MIMETYPE_TEXT_VCARD +{ + Text [ en-US ] = "vCard file" ; +}; + +String STR_SVT_MIMETYPE_VIDEO_VDO +{ + Text [ en-US ] = "Video file" ; +}; + +String STR_SVT_MIMETYPE_VIDEO_MSVIDEO +{ + Text [ en-US ] = "Video file" ; +}; + +String STR_SVT_MIMETYPE_X_STARMAIL +{ + Text [ en-US ] = "Message" ; +}; + +String STR_SVT_MIMETYPE_X_VRML +{ + Text [ en-US ] = "VRML file" ; +}; + +String STR_SVT_MIMETYPE_APP_STARIMPRESS +{ + Text [ en-US ] = "%PRODUCTNAME Presentation" ; +}; + +String STR_SVT_MIMETYPE_APP_IMPRESSPACKED +{ + Text [ en-US ] = "%PRODUCTNAME Presentation (packed)"; +}; + +String STR_SVT_MIMETYPE_APP_STARHELP +{ + Text [ en-US ] = "%PRODUCTNAME Help" ; +}; + + +String STR_SVT_MIMETYPE_CNT_MSG +{ + Text [ en-US ] = "Message" ; +}; + +String STR_SVT_MIMETYPE_CNT_DOCUMENT +{ + Text [ en-US ] = "Document" ; +}; + +String STR_SVT_MIMETYPE_CNT_POP3BOX +{ + Text [ en-US ] = "POP3 Account" ; +}; + +String STR_SVT_MIMETYPE_CNT_IMAPBOX +{ + Text [ en-US ] = "IMAP Account" ; +}; + +String STR_SVT_MIMETYPE_CNT_IMAPFLD +{ + Text [ en-US ] = "Folder" ; +}; + +String STR_SVT_MIMETYPE_CNT_VIMBOX +{ + Text [ en-US ] = "VIM Account" ; +}; + +String STR_SVT_MIMETYPE_CNT_VIMINBOX +{ + Text [ en-US ] = "Inbox" ; +}; + +String STR_SVT_MIMETYPE_CNT_BBBOX +{ + Text [ en-US ] = "Newsgroups" ; +}; + +String STR_SVT_MIMETYPE_CNT_VIM_BB +{ + Text [ en-US ] = "Newsgroup" ; +}; + +String STR_SVT_MIMETYPE_CNT_NEWSBOX +{ + Text [ en-US ] = "News" ; +}; + +String STR_SVT_MIMETYPE_CNT_NEWSGRP +{ + Text [ en-US ] = "Group" ; +}; + +String STR_SVT_MIMETYPE_CNT_OUTBOX +{ + Text [ en-US ] = "Outbox" ; +}; + +String STR_SVT_MIMETYPE_CNT_FTPBOX +{ + Text [ en-US ] = "FTP Account" ; +}; + +String STR_SVT_MIMETYPE_CNT_FTPFLD +{ + Text [ en-US ] = "FTP Folder" ; +}; + +String STR_SVT_MIMETYPE_CNT_FTPFILE +{ + Text [ en-US ] = "FTP File" ; +}; + +String STR_SVT_MIMETYPE_CNT_FTPLINK +{ + Text [ en-US ] = "FTP Link" ; +}; + +String STR_SVT_MIMETYPE_CNT_HTTPBOX +{ + Text [ en-US ] = "HTTP" ; +}; + +String STR_SVT_MIMETYPE_CNT_FSYSBOX +{ + Text [ en-US ] = "Workplace" ; +}; + +String STR_SVT_MIMETYPE_CNT_FSYSFLD +{ + Text [ en-US ] = "Folder" ; +}; + +String STR_SVT_MIMETYPE_CNT_FSYSFILE +{ + Text [ en-US ] = "File" ; +}; + +String STR_SVT_MIMETYPE_CNT_FSYSURLFILE +{ + Text [ en-US ] = "Link" ; +}; + +String STR_SVT_MIMETYPE_CNT_PUBLBOX +{ + Text [ en-US ] = "Project" ; +}; + +String STR_SVT_MIMETYPE_CNT_SRCHBOX +{ + Text [ en-US ] = "Find" ; +}; + +String STR_SVT_MIMETYPE_CNT_SUBSCRBOX +{ + Text [ en-US ] = "Subscriptions" ; +}; + +String STR_SVT_MIMETYPE_CNT_BOOKMARK +{ + Text [ en-US ] = "Bookmark subscription" ; +}; + +String STR_SVT_MIMETYPE_CNT_CDF +{ + Text [ en-US ] = "Channel subscription" ; +}; + +String STR_SVT_MIMETYPE_CNT_CDFSUB +{ + Text [ en-US ] = "Channel subscription" ; +}; + +String STR_SVT_MIMETYPE_CNT_CDFITEM +{ + Text [ en-US ] = "Channel subscription" ; +}; + +String STR_SVT_MIMETYPE_CNT_STARCHANNEL +{ + Text [ en-US ] = "StarChannel" ; +}; + +String STR_SVT_MIMETYPE_CNT_TRASHBOX +{ + Text [ en-US ] = "Recycle Bin" ; +}; + +String STR_SVT_MIMETYPE_CNT_TRASH +{ + Text [ en-US ] = "Deleted Object" ; +}; + +String STR_SVT_MIMETYPE_CNT_REMOV_VOL +{ + Text [ en-US ] = "Local drive" ; +}; + +String STR_SVT_MIMETYPE_CNT_FIX_VOL +{ + Text [ en-US ] = "Local drive" ; +}; + +String STR_SVT_MIMETYPE_CNT_REM_VOL +{ + Text [ en-US ] = "Network connection" ; +}; + +String STR_SVT_MIMETYPE_CNT_RAM_VOL +{ + Text [ en-US ] = "RAM Disk" ; +}; + +String STR_SVT_MIMETYPE_CNT_CDROM +{ + Text [ en-US ] = "CD-ROM drive" ; +}; + +String STR_SVT_MIMETYPE_CNT_DISK_35 +{ + Text [ en-US ] = "3.5'' Disk" ; +}; + +String STR_SVT_MIMETYPE_CNT_DISK_525 +{ + Text [ en-US ] = "5.25'' Disk" ; +}; + +String STR_SVT_MIMETYPE_CNT_TAPEDRIVE +{ + Text [ en-US ] = "Tape drive" ; +}; + +String STR_SVT_MIMETYPE_APP_GAL +{ + Text [ en-US ] = "Gallery"; +}; + +String STR_SVT_MIMETYPE_APP_GAL_THEME +{ + Text [ en-US ] = "Gallery theme" ; +}; + +String STR_SVT_MIMETYPE_CNT_SEPARATOR +{ + Text = "CntMenuView-Separator" ; +}; + +String STR_SVT_MIMETYPE_APP_STARW_GLOB +{ + Text [ en-US ] = "%PRODUCTNAME Master Document" ; +}; + +String STR_SVT_MIMETYPE_APP_SDM +{ + Text [ en-US ] = "Message" ; +}; + +String STR_SVT_MIMETYPE_APP_SMD +{ + Text [ en-US ] = "Message" ; +}; + +String STR_SVT_MIMETYPE_APP_STARW_WEB +{ + Text [ en-US ] = "%PRODUCTNAME Writer/Web" ; +}; + +String STR_SVT_MIMETYPE_SCHEDULE +{ + Text [ en-US ] = "Tasks & Events" ; +}; + +String STR_SVT_MIMETYPE_SCHEDULE_EVT +{ + Text [ en-US ] = "%PRODUCTNAME Events View" ; +}; + +String STR_SVT_MIMETYPE_SCHEDULE_TASK +{ + Text [ en-US ] = "%PRODUCTNAME Task View" ; +}; + +String STR_SVT_MIMETYPE_SCHEDULE_FEVT +{ + Text [ en-US ] = "%PRODUCTNAME Event" ; +}; + +String STR_SVT_MIMETYPE_SCHEDULE_FTASK +{ + Text [ en-US ] = "%PRODUCTNAME Task" ; +}; + +String STR_SVT_MIMETYPE_FRAMESET +{ + Text [ en-US ] = "Frameset Document" ; +}; + +String STR_SVT_MIMETYPE_MACRO +{ + Text [ en-US ] = "Macro file" ; +}; + +String STR_SVT_MIMETYPE_CNT_SFSYSFOLDER +{ + Text [ en-US ] = "System folder" ; +}; + +String STR_SVT_MIMETYPE_CNT_SFSYSFILE +{ + Text [ en-US ] = "System object" ; +}; + +String STR_SVT_MIMETYPE_APP_TEMPLATE +{ + Text [ en-US ] = "%PRODUCTNAME Template"; +}; + +String STR_SVT_MIMETYPE_IMAGE_GENERIC +{ + Text [ en-US ] = "Graphics"; +}; + +String STR_SVT_MIMETYPE_APP_MSEXCEL +{ + Text [ en-US ] = "MS Excel document" ; +}; + +String STR_SVT_MIMETYPE_APP_MSEXCEL_TEMPL +{ + Text [ en-US ] = "MS Excel Template" ; +}; + +String STR_SVT_MIMETYPE_APP_MSPPOINT +{ + Text [ en-US ] = "MS PowerPoint document" ; +}; + +String STR_SVT_MIMETYPE_TEXT_VCALENDAR +{ + Text [ en-US ] = "vCalendar-file" ; +}; + +String STR_SVT_MIMETYPE_TEXT_ICALENDAR +{ + Text [ en-US ] = "iCalendar-File"; +}; + +String STR_SVT_MIMETYPE_TEXT_XMLICALENDAR +{ + Text [ en-US ] = "XML-iCalendar-File"; +}; + +String STR_SVT_MIMETYPE_TEXT_CDE_CALENDAR_APP +{ + Text [ en-US ] = "CDE-Calendar-File"; +}; + +String STR_SVT_MIMETYPE_INET_MSG_RFC822 +{ + Text [ en-US ] = "message/rfc822" ; +}; + +String STR_SVT_MIMETYPE_INET_MULTI_ALTERNATIVE +{ + Text [ en-US ] = "multipart/alternative" ; +}; + +String STR_SVT_MIMETYPE_INET_MULTI_DIGEST +{ + Text [ en-US ] = "multipart/digest" ; +}; + +String STR_SVT_MIMETYPE_INET_MULTI_PARALLEL +{ + Text [ en-US ] = "multipart/parallel" ; +}; + +String STR_SVT_MIMETYPE_INET_MULTI_RELATED +{ + Text [ en-US ] = "multipart/related" ; +}; + +String STR_SVT_MIMETYPE_INET_MULTI_MIXED +{ + Text [ en-US ] = "multipart/mixed" ; +}; + +String STR_SVT_MIMETYPE_APP_SXCALC +{ + Text [ en-US ] = "%PRODUCTNAME %PRODUCTXMLFILEFORMATVERSION Spreadsheet" ; +}; + +String STR_SVT_MIMETYPE_APP_SXCHART +{ + Text [ en-US ] = "%PRODUCTNAME %PRODUCTXMLFILEFORMATVERSION Chart" ; +}; + +String STR_SVT_MIMETYPE_APP_SXDRAW +{ + Text [ en-US ] = "%PRODUCTNAME %PRODUCTXMLFILEFORMATVERSION Drawing" ; +}; + +String STR_SVT_MIMETYPE_APP_SXMATH +{ + Text [ en-US ] = "%PRODUCTNAME %PRODUCTXMLFILEFORMATVERSION Formula" ; +}; + +String STR_SVT_MIMETYPE_APP_SXWRITER +{ + Text [ en-US ] = "%PRODUCTNAME %PRODUCTXMLFILEFORMATVERSION Text Document" ; +}; + +String STR_SVT_MIMETYPE_APP_SXIMPRESS +{ + Text [ en-US ] = "%PRODUCTNAME %PRODUCTXMLFILEFORMATVERSION Presentation" ; +}; + +String STR_SVT_MIMETYPE_APP_SXGLOBAL +{ + Text [ en-US ] = "%PRODUCTNAME %PRODUCTXMLFILEFORMATVERSION Master Document" ; +}; + +String STR_SVT_MIMETYPE_APP_SXIPACKED +{ + Text [ en-US ] = "%PRODUCTNAME %PRODUCTXMLFILEFORMATVERSION Presentation (packed)" ; +}; + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/svl/source/misc/ownlist.cxx b/svl/source/misc/ownlist.cxx new file mode 100644 index 000000000000..346b4ff7251e --- /dev/null +++ b/svl/source/misc/ownlist.cxx @@ -0,0 +1,330 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ownlist.cxx,v $ + * $Revision: 1.6.136.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include +#include +#include + +#include + +using namespace com::sun::star; + +//========================================================================= +//============== SvCommandList ============================================ +//========================================================================= +PRV_SV_IMPL_OWNER_LIST(SvCommandList,SvCommand) + + +static String parseString(const String & rCmd, USHORT * pIndex) +{ + String result; + + if(rCmd.GetChar( *pIndex ) == '\"') { + (*pIndex) ++; + + USHORT begin = *pIndex; + + while(*pIndex < rCmd.Len() && rCmd.GetChar((*pIndex) ++) != '\"') ; + + result = String(rCmd.Copy(begin, *pIndex - begin - 1)); + } + + return result; +} + +static String parseWord(const String & rCmd, USHORT * pIndex) +{ + USHORT begin = *pIndex; + + while(*pIndex < rCmd.Len() && !isspace(rCmd.GetChar(*pIndex)) && rCmd.GetChar(*pIndex) != '=') + (*pIndex) ++; + + return String(rCmd.Copy(begin, *pIndex - begin)); +} + +static void eatSpace(const String & rCmd, USHORT * pIndex) +{ + while(*pIndex < rCmd.Len() && isspace(rCmd.GetChar(*pIndex))) + (*pIndex) ++; +} + + +//========================================================================= +BOOL SvCommandList::AppendCommands +( + const String & rCmd, /* Dieser Text wird in Kommandos umgesetzt */ + USHORT * pEaten /* Anzahl der Zeichen, die gelesen wurden */ +) +/* [Beschreibung] + + Es wird eine Text geparsed und die einzelnen Kommandos werden an + die Liste angeh"angt. + + [R"uckgabewert] + + BOOL TRUE, der Text wurde korrekt geparsed. + FALSE, der Text wurde nicht korrekt geparsed. +*/ +{ + USHORT index = 0; + while(index < rCmd.Len()) + { + + eatSpace(rCmd, &index); + String name = (rCmd.GetChar(index) == '\"') ? parseString(rCmd, &index) : parseWord(rCmd, &index); + + eatSpace(rCmd, &index); + String value; + if(index < rCmd.Len() && rCmd.GetChar(index) == '=') + { + index ++; + + eatSpace(rCmd, &index); + value = (rCmd.GetChar(index) == '\"') ? parseString(rCmd, &index) : parseWord(rCmd, &index); + } + + SvCommand * pCmd = new SvCommand(name, value); + aTypes.Insert(pCmd, LIST_APPEND); + } + + *pEaten = index; + +// USHORT nPos = 0; +// while( nPos < rCmd.Len() ) +// { +// // ein Zeichen ? Dann faengt hier eine Option an +// if( isalpha( rCmd[nPos] ) ) +// { +// String aValue; +// USHORT nStt = nPos; +// register char c; + +// while( nPos < rCmd.Len() && +// ( isalnum(c=rCmd[nPos]) || '-'==c || '.'==c ) ) +// nPos++; + +// String aToken( rCmd.Copy( nStt, nPos-nStt ) ); + +// while( nPos < rCmd.Len() && +// ( !String::IsPrintable( (c=rCmd[nPos]), +// RTL_TEXTENCODING_MS_1252 ) || isspace(c) ) ) +// nPos++; + +// // hat die Option auch einen Wert? +// if( nPos!=rCmd.Len() && '='==c ) +// { +// nPos++; + +// while( nPos < rCmd.Len() && +// ( !String::IsPrintable( (c=rCmd[nPos]), +// RTL_TEXTENCODING_MS_1252 ) || isspace(c) ) ) +// nPos++; + +// if( nPos != rCmd.Len() ) +// { +// USHORT nLen = 0; +// nStt = nPos; +// if( '"' == c ) +// { +// nPos++; nStt++; +// while( nPos < rCmd.Len() && +// '"' != rCmd[nPos] ) +// nPos++, nLen++; +// if( nPos!=rCmd.Len() ) +// nPos++; +// } +// else +// // hier sind wir etwas laxer als der +// // Standard und erlauben alles druckbare +// while( nPos < rCmd.Len() && +// String::IsPrintable( (c=rCmd[nPos]), +// RTL_TEXTENCODING_MS_1252 ) && +// !isspace( c ) ) +// nPos++, nLen++; + +// if( nLen ) +// aValue = rCmd( nStt, nLen ); +// } +// } + +// SvCommand * pCmd = new SvCommand( aToken, aValue ); +// aTypes.Insert( pCmd, LIST_APPEND ); +// } +// else +// // white space un unerwartete Zeichen ignorieren wie +// nPos++; +// } +// *pEaten = nPos; + return TRUE; +} + +//========================================================================= +String SvCommandList::GetCommands() const +/* [Beschreibung] + + Die Kommandos in der Liste werden als Text hintereinander, durch ein + Leerzeichen getrennt geschrieben. Der Text muss nicht genauso + aussehen wie der in "ubergebene. + + [R"uckgabewert] + + String Die Kommandos werden zur"uckgegeben. +*/ +{ + String aRet; + for( ULONG i = 0; i < aTypes.Count(); i++ ) + { + if( i != 0 ) + aRet += ' '; + SvCommand * pCmd = (SvCommand *)aTypes.GetObject( i ); + aRet += pCmd->GetCommand(); + if( pCmd->GetArgument().Len() ) + { + aRet.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "=\"" ) ); + aRet += pCmd->GetArgument(); + aRet.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "\"" ) ); + } + } + return aRet; +} + +//========================================================================= +SvCommand & SvCommandList::Append +( + const String & rCommand, /* das Kommando */ + const String & rArg /* dasArgument des Kommandos */ +) +/* [Beschreibung] + + Es wird eine Objekt vom Typ SvCommand erzeugt und an die Liste + angeh"angt. + + [R"uckgabewert] + + SvCommand & Das erteugte Objekt wird zur"uckgegeben. +*/ +{ + SvCommand * pCmd = new SvCommand( rCommand, rArg ); + aTypes.Insert( pCmd, LIST_APPEND ); + return *pCmd; +} + +//========================================================================= +SvStream & operator >> +( + SvStream & rStm, /* Stream aus dem gelesen wird */ + SvCommandList & rThis /* Die zu f"ullende Liste */ +) +/* [Beschreibung] + + Die Liste mit ihren Elementen wird gelesen. Das Format ist: + 1. Anzahl der Elemente + 2. Alle Elemente + + [R"uckgabewert] + + SvStream & Der "ubergebene Stream. +*/ +{ + UINT32 nCount = 0; + rStm >> nCount; + if( !rStm.GetError() ) + { + while( nCount-- ) + { + SvCommand * pCmd = new SvCommand(); + rStm >> *pCmd; + rThis.aTypes.Insert( pCmd, LIST_APPEND ); + } + } + return rStm; +} + +//========================================================================= +SvStream & operator << +( + SvStream & rStm, /* Stream in den geschrieben wird */ + const SvCommandList & rThis /* Die zu schreibende Liste */ +) +/* [Beschreibung] + + Die Liste mit ihren Elementen wir geschrieben. Das Format ist: + 1. Anzahl der Elemente + 2. Alle Elemente + + [R"uckgabewert] + + SvStream & Der "ubergebene Stream. +*/ +{ + UINT32 nCount = rThis.aTypes.Count(); + rStm << nCount; + + for( UINT32 i = 0; i < nCount; i++ ) + { + SvCommand * pCmd = (SvCommand *)rThis.aTypes.GetObject( i ); + rStm << *pCmd; + } + return rStm; +} + +BOOL SvCommandList::FillFromSequence( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& aCommandSequence ) +{ + const sal_Int32 nCount = aCommandSequence.getLength(); + String aCommand, aArg; + ::rtl::OUString aApiArg; + for( sal_Int32 nIndex=0; nIndex>= aApiArg ) ) + return sal_False; + aArg = aApiArg; + Append( aCommand, aArg ); + } + + return TRUE; +} + +void SvCommandList::FillSequence( com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& aCommandSequence ) +{ + const sal_Int32 nCount = Count(); + aCommandSequence.realloc( nCount ); + for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ ) + { + const SvCommand& rCommand = (*this)[ nIndex ]; + aCommandSequence[nIndex].Name = rCommand.GetCommand(); + aCommandSequence[nIndex].Handle = -1; + aCommandSequence[nIndex].Value = uno::makeAny( ::rtl::OUString( rCommand.GetArgument() ) ); + aCommandSequence[nIndex].State = beans::PropertyState_DIRECT_VALUE; + } +} + diff --git a/svl/source/misc/restrictedpaths.cxx b/svl/source/misc/restrictedpaths.cxx new file mode 100644 index 000000000000..354e32126680 --- /dev/null +++ b/svl/source/misc/restrictedpaths.cxx @@ -0,0 +1,217 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: restrictedpaths.cxx,v $ + * $Revision: 1.8 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include + +#include +#include +#include +#include +#include + +namespace svt +{ + namespace + { + // ---------------------------------------------------------------- + /** retrieves the value of an environment variable + @return if and only if the retrieved string value is not empty + */ + bool lcl_getEnvironmentValue( const sal_Char* _pAsciiEnvName, ::rtl::OUString& _rValue ) + { + _rValue = ::rtl::OUString(); + ::rtl::OUString sEnvName = ::rtl::OUString::createFromAscii( _pAsciiEnvName ); + osl_getEnvironment( sEnvName.pData, &_rValue.pData ); + return _rValue.getLength() != 0; + } + + //----------------------------------------------------------------- + void lcl_convertStringListToUrls( const String& _rColonSeparatedList, ::std::vector< String >& _rTokens, bool _bFinalSlash ) + { + const sal_Unicode s_cSeparator = + #if defined(WNT) + ';' + #else + ':' + #endif + ; + xub_StrLen nTokens = _rColonSeparatedList.GetTokenCount( s_cSeparator ); + _rTokens.resize( 0 ); _rTokens.reserve( nTokens ); + for ( xub_StrLen i=0; i nLenChecked ) + { + if ( m_bAllowParent ) + { + if ( sApprovedURL.Search( m_sCheckURL ) == 0 ) + { + if ( ( m_sCheckURL.GetChar( nLenChecked - 1 ) == '/' ) + || ( sApprovedURL.GetChar( nLenChecked ) == '/' ) ) + return true; + } + } + else + { + // just a difference in final slash? + if ( ( nLenApproved == ( nLenChecked + 1 ) ) && + ( sApprovedURL.GetChar( nLenApproved - 1 ) == '/' ) ) + return true; + } + return false; + } + else if ( nLenApproved < nLenChecked ) + { + if ( m_sCheckURL.Search( sApprovedURL ) == 0 ) + { + if ( ( sApprovedURL.GetChar( nLenApproved - 1 ) == '/' ) + || ( m_sCheckURL.GetChar( nLenApproved ) == '/' ) ) + return true; + } + return false; + } + else + { + // strings have equal length + return ( sApprovedURL == m_sCheckURL ); + } + } + }; + + //===================================================================== + //= RestrictedPaths + //===================================================================== + //--------------------------------------------------------------------- + RestrictedPaths::RestrictedPaths() + :m_bFilterIsEnabled( true ) + { + ::rtl::OUString sRestrictedPathList; + if ( lcl_getEnvironmentValue( "RestrictedPath", sRestrictedPathList ) ) + // append a final slash. This ensures that when we later on check + // for unrestricted paths, we don't allow paths like "/home/user35" just because + // "/home/user3" is allowed - with the final slash, we make it "/home/user3/". + lcl_convertStringListToUrls( sRestrictedPathList, m_aUnrestrictedURLs, true ); + } + + RestrictedPaths::~RestrictedPaths() {} + + // -------------------------------------------------------------------- + bool RestrictedPaths::isUrlAllowed( const String& _rURL ) const + { + if ( m_aUnrestrictedURLs.empty() || !m_bFilterIsEnabled ) + return true; + + ::std::vector< String >::const_iterator aApprovedURL = ::std::find_if( + m_aUnrestrictedURLs.begin(), + m_aUnrestrictedURLs.end(), + CheckURLAllowed( _rURL, true ) + ); + + return ( aApprovedURL != m_aUnrestrictedURLs.end() ); + } + + // -------------------------------------------------------------------- + bool RestrictedPaths::isUrlAllowed( const String& _rURL, bool allowParents ) const + { + if ( m_aUnrestrictedURLs.empty() || !m_bFilterIsEnabled ) + return true; + + ::std::vector< String >::const_iterator aApprovedURL = ::std::find_if( + m_aUnrestrictedURLs.begin(), + m_aUnrestrictedURLs.end(), + CheckURLAllowed( _rURL, allowParents ) + ); + + return ( aApprovedURL != m_aUnrestrictedURLs.end() ); + } + +} // namespace svt diff --git a/svl/source/misc/sharecontrolfile.cxx b/svl/source/misc/sharecontrolfile.cxx new file mode 100644 index 000000000000..32d7b1873f68 --- /dev/null +++ b/svl/source/misc/sharecontrolfile.cxx @@ -0,0 +1,376 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: sharecontrolfile.cxx,v $ + * $Revision: 1.6.82.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include + +#include + +using namespace ::com::sun::star; + +namespace svt { + +// ---------------------------------------------------------------------- +ShareControlFile::ShareControlFile( const ::rtl::OUString& aOrigURL, const uno::Reference< lang::XMultiServiceFactory >& xFactory ) +: LockFileCommon( aOrigURL, xFactory, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".~sharing." ) ) ) +{ + OpenStream(); + + if ( !IsValid() ) + throw io::NotConnectedException(); +} + +// ---------------------------------------------------------------------- +ShareControlFile::~ShareControlFile() +{ + try + { + Close(); + } + catch( uno::Exception& ) + {} +} + +// ---------------------------------------------------------------------- +void ShareControlFile::OpenStream() +{ + // if it is called outside of constructor the mutex must be locked already + + if ( !m_xStream.is() && m_aURL.getLength() ) + { + uno::Reference< ucb::XCommandEnvironment > xDummyEnv; + ::ucbhelper::Content aContent = ::ucbhelper::Content( m_aURL, xDummyEnv ); + + uno::Reference< ucb::XContentIdentifier > xContId( aContent.get().is() ? aContent.get()->getIdentifier() : 0 ); + if ( !xContId.is() || !xContId->getContentProviderScheme().equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "file" ) ) ) ) + throw io::IOException(); // the implementation supports only local files for now + + uno::Reference< io::XStream > xStream; + + // Currently the locking of the original document is intended to be used. + // That means that the shared file should be accessed only when the original document is locked and only by user who has locked the document. + // TODO/LATER: should the own file locking be used? + + try + { + xStream = aContent.openWriteableStreamNoLock(); + } + catch ( ucb::InteractiveIOException const & e ) + { + if ( e.Code == ucb::IOErrorCode_NOT_EXISTING ) + { + // Create file... + SvMemoryStream aStream(0,0); + uno::Reference< io::XInputStream > xInput( new ::utl::OInputStreamWrapper( aStream ) ); + ucb::InsertCommandArgument aInsertArg; + aInsertArg.Data = xInput; + aInsertArg.ReplaceExisting = sal_False; + aContent.executeCommand( rtl::OUString::createFromAscii( "insert" ), uno::makeAny( aInsertArg ) ); + + // try to let the file be hidden if possible + try { + aContent.setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsHidden" ) ), uno::makeAny( sal_True ) ); + } catch( uno::Exception& ) {} + + // Try to open one more time + xStream = aContent.openWriteableStreamNoLock(); + } + else + throw; + } + + m_xSeekable.set( xStream, uno::UNO_QUERY_THROW ); + m_xInputStream.set( xStream->getInputStream(), uno::UNO_QUERY_THROW ); + m_xOutputStream.set( xStream->getOutputStream(), uno::UNO_QUERY_THROW ); + m_xTruncate.set( m_xOutputStream, uno::UNO_QUERY_THROW ); + m_xStream = xStream; + } +} + +// ---------------------------------------------------------------------- +void ShareControlFile::Close() +{ + // if it is called outside of destructor the mutex must be locked + + if ( m_xStream.is() ) + { + try + { + if ( m_xInputStream.is() ) + m_xInputStream->closeInput(); + if ( m_xOutputStream.is() ) + m_xOutputStream->closeOutput(); + } + catch( uno::Exception& ) + {} + + m_xStream = uno::Reference< io::XStream >(); + m_xInputStream = uno::Reference< io::XInputStream >(); + m_xOutputStream = uno::Reference< io::XOutputStream >(); + m_xSeekable = uno::Reference< io::XSeekable >(); + m_xTruncate = uno::Reference< io::XTruncate >(); + m_aUsersData.realloc( 0 ); + } +} + +// ---------------------------------------------------------------------- +uno::Sequence< uno::Sequence< ::rtl::OUString > > ShareControlFile::GetUsersData() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !IsValid() ) + throw io::NotConnectedException(); + + if ( !m_aUsersData.getLength() ) + { + sal_Int64 nLength = m_xSeekable->getLength(); + if ( nLength > SAL_MAX_INT32 ) + throw uno::RuntimeException(); + + uno::Sequence< sal_Int8 > aBuffer( (sal_Int32)nLength ); + m_xSeekable->seek( 0 ); + + sal_Int32 nRead = m_xInputStream->readBytes( aBuffer, (sal_Int32)nLength ); + nLength -= nRead; + while ( nLength > 0 ) + { + uno::Sequence< sal_Int8 > aTmpBuf( (sal_Int32)nLength ); + nRead = m_xInputStream->readBytes( aTmpBuf, (sal_Int32)nLength ); + if ( nRead > nLength ) + throw uno::RuntimeException(); + + for ( sal_Int32 nInd = 0; nInd < nRead; nInd++ ) + aBuffer[aBuffer.getLength() - (sal_Int32)nLength + nInd] = aTmpBuf[nInd]; + nLength -= nRead; + } + + m_aUsersData = ParseList( aBuffer ); + } + + return m_aUsersData; +} + +// ---------------------------------------------------------------------- +void ShareControlFile::SetUsersDataAndStore( const uno::Sequence< uno::Sequence< ::rtl::OUString > >& aUsersData ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !IsValid() ) + throw io::NotConnectedException(); + + if ( !m_xTruncate.is() || !m_xOutputStream.is() || !m_xSeekable.is() ) + throw uno::RuntimeException(); + + m_xTruncate->truncate(); + m_xSeekable->seek( 0 ); + + ::rtl::OUStringBuffer aBuffer; + for ( sal_Int32 nInd = 0; nInd < aUsersData.getLength(); nInd++ ) + { + if ( aUsersData[nInd].getLength() != SHARED_ENTRYSIZE ) + throw lang::IllegalArgumentException(); + + for ( sal_Int32 nEntryInd = 0; nEntryInd < SHARED_ENTRYSIZE; nEntryInd++ ) + { + aBuffer.append( EscapeCharacters( aUsersData[nInd][nEntryInd] ) ); + if ( nEntryInd < SHARED_ENTRYSIZE - 1 ) + aBuffer.append( (sal_Unicode)',' ); + else + aBuffer.append( (sal_Unicode)';' ); + } + } + + ::rtl::OString aStringData( ::rtl::OUStringToOString( aBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ) ); + uno::Sequence< sal_Int8 > aData( (sal_Int8*)aStringData.getStr(), aStringData.getLength() ); + m_xOutputStream->writeBytes( aData ); + m_aUsersData = aUsersData; +} + +// ---------------------------------------------------------------------- +uno::Sequence< ::rtl::OUString > ShareControlFile::InsertOwnEntry() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !IsValid() ) + throw io::NotConnectedException(); + + GetUsersData(); + uno::Sequence< ::uno::Sequence< ::rtl::OUString > > aNewData( m_aUsersData.getLength() + 1 ); + uno::Sequence< ::rtl::OUString > aNewEntry = GenerateOwnEntry(); + + sal_Bool bExists = sal_False; + sal_Int32 nNewInd = 0; + for ( sal_Int32 nInd = 0; nInd < m_aUsersData.getLength(); nInd++ ) + { + if ( m_aUsersData[nInd].getLength() == SHARED_ENTRYSIZE ) + { + if ( m_aUsersData[nInd][SHARED_LOCALHOST_ID] == aNewEntry[SHARED_LOCALHOST_ID] + && m_aUsersData[nInd][SHARED_SYSUSERNAME_ID] == aNewEntry[SHARED_SYSUSERNAME_ID] + && m_aUsersData[nInd][SHARED_USERURL_ID] == aNewEntry[SHARED_USERURL_ID] ) + { + if ( !bExists ) + { + aNewData[nNewInd] = aNewEntry; + bExists = sal_True; + } + } + else + { + aNewData[nNewInd] = m_aUsersData[nInd]; + } + + nNewInd++; + } + } + + if ( !bExists ) + aNewData[nNewInd++] = aNewEntry; + + aNewData.realloc( nNewInd ); + SetUsersDataAndStore( aNewData ); + + return aNewEntry; +} + +// ---------------------------------------------------------------------- +bool ShareControlFile::HasOwnEntry() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !IsValid() ) + { + throw io::NotConnectedException(); + } + + GetUsersData(); + uno::Sequence< ::rtl::OUString > aEntry = GenerateOwnEntry(); + + for ( sal_Int32 nInd = 0; nInd < m_aUsersData.getLength(); ++nInd ) + { + if ( m_aUsersData[nInd].getLength() == SHARED_ENTRYSIZE && + m_aUsersData[nInd][SHARED_LOCALHOST_ID] == aEntry[SHARED_LOCALHOST_ID] && + m_aUsersData[nInd][SHARED_SYSUSERNAME_ID] == aEntry[SHARED_SYSUSERNAME_ID] && + m_aUsersData[nInd][SHARED_USERURL_ID] == aEntry[SHARED_USERURL_ID] ) + { + return true; + } + } + + return false; +} + +// ---------------------------------------------------------------------- +void ShareControlFile::RemoveEntry( const uno::Sequence< ::rtl::OUString >& aArgEntry ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !IsValid() ) + throw io::NotConnectedException(); + + GetUsersData(); + + uno::Sequence< ::rtl::OUString > aEntry = aArgEntry; + if ( aEntry.getLength() != SHARED_ENTRYSIZE ) + aEntry = GenerateOwnEntry(); + + uno::Sequence< ::uno::Sequence< ::rtl::OUString > > aNewData( m_aUsersData.getLength() + 1 ); + + sal_Int32 nNewInd = 0; + for ( sal_Int32 nInd = 0; nInd < m_aUsersData.getLength(); nInd++ ) + { + if ( m_aUsersData[nInd].getLength() == SHARED_ENTRYSIZE ) + { + if ( m_aUsersData[nInd][SHARED_LOCALHOST_ID] != aEntry[SHARED_LOCALHOST_ID] + || m_aUsersData[nInd][SHARED_SYSUSERNAME_ID] != aEntry[SHARED_SYSUSERNAME_ID] + || m_aUsersData[nInd][SHARED_USERURL_ID] != aEntry[SHARED_USERURL_ID] ) + { + aNewData[nNewInd] = m_aUsersData[nInd]; + nNewInd++; + } + } + } + + aNewData.realloc( nNewInd ); + SetUsersDataAndStore( aNewData ); + + if ( !nNewInd ) + { + // try to remove the file if it is empty + RemoveFile(); + } +} + +// ---------------------------------------------------------------------- +void ShareControlFile::RemoveFile() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !IsValid() ) + throw io::NotConnectedException(); + + Close(); + + uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSimpleFileAccess( + xFactory->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.ucb.SimpleFileAccess") ), + uno::UNO_QUERY_THROW ); + xSimpleFileAccess->kill( m_aURL ); +} + +} // namespace svt + diff --git a/svl/source/misc/strmadpt.cxx b/svl/source/misc/strmadpt.cxx new file mode 100644 index 000000000000..4c4835609b7b --- /dev/null +++ b/svl/source/misc/strmadpt.cxx @@ -0,0 +1,1048 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: strmadpt.cxx,v $ + * $Revision: 1.5.136.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include // needed under Solaris when including ... + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace com::sun::star; + +//============================================================================ +class SvDataPipe_Impl +{ +public: + enum SeekResult { SEEK_BEFORE_MARKED, SEEK_OK, SEEK_PAST_END }; + +private: + struct Page + { + Page * m_pPrev; + Page * m_pNext; + sal_Int8 * m_pStart; + sal_Int8 * m_pRead; + sal_Int8 * m_pEnd; + sal_uInt32 m_nOffset; + sal_Int8 m_aBuffer[1]; + }; + + std::multiset< sal_uInt32 > m_aMarks; + Page * m_pFirstPage; + Page * m_pReadPage; + Page * m_pWritePage; + sal_Int8 * m_pReadBuffer; + sal_uInt32 m_nReadBufferSize; + sal_uInt32 m_nReadBufferFilled; + sal_uInt32 m_nPageSize; + sal_uInt32 m_nMinPages; + sal_uInt32 m_nMaxPages; + sal_uInt32 m_nPages; + bool m_bEOF; + + bool remove(Page * pPage); + +public: + inline SvDataPipe_Impl(sal_uInt32 nThePageSize = 1000, + sal_uInt32 nTheMinPages = 100, + sal_uInt32 nTheMaxPages + = std::numeric_limits< sal_uInt32 >::max()); + + ~SvDataPipe_Impl(); + + inline void setReadBuffer(sal_Int8 * pBuffer, sal_uInt32 nSize); + + sal_uInt32 read(); + + void clearReadBuffer() { m_pReadBuffer = 0; } + + sal_uInt32 write(sal_Int8 const * pBuffer, sal_uInt32 nSize); + + void setEOF() { m_bEOF = true; } + + inline bool isEOF() const; + + bool addMark(sal_uInt32 nPosition); + + bool removeMark(sal_uInt32 nPosition); + + inline sal_uInt32 getReadPosition() const; + + SeekResult setReadPosition(sal_uInt32 nPosition); +}; + +SvDataPipe_Impl::SvDataPipe_Impl(sal_uInt32 nThePageSize, + sal_uInt32 nTheMinPages, + sal_uInt32 nTheMaxPages): + m_pFirstPage(0), + m_pReadPage(0), + m_pWritePage(0), + m_pReadBuffer(0), + m_nPageSize(std::min< sal_uInt32 >( + std::max< sal_uInt32 >(nThePageSize, sal_uInt32(1)), + sal_uInt32(std::numeric_limits< sal_uInt32 >::max() + - sizeof (Page) + 1))), + m_nMinPages(std::max< sal_uInt32 >(nTheMinPages, sal_uInt32(1))), + m_nMaxPages(std::max< sal_uInt32 >(nTheMaxPages, sal_uInt32(1))), + m_nPages(0), + m_bEOF(false) +{} + +inline void SvDataPipe_Impl::setReadBuffer(sal_Int8 * pBuffer, + sal_uInt32 nSize) +{ + m_pReadBuffer = pBuffer; + m_nReadBufferSize = nSize; + m_nReadBufferFilled = 0; +} + +inline bool SvDataPipe_Impl::isEOF() const +{ + return m_bEOF && m_pReadPage == m_pWritePage + && (!m_pReadPage || m_pReadPage->m_pRead == m_pReadPage->m_pEnd); +} + +inline sal_uInt32 SvDataPipe_Impl::getReadPosition() const +{ + return m_pReadPage == 0 ? 0 : + m_pReadPage->m_nOffset + + (m_pReadPage->m_pRead + - m_pReadPage->m_aBuffer); +} + +//============================================================================ +// +// SvOutputStreamOpenLockBytes +// +//============================================================================ + +TYPEINIT1(SvOutputStreamOpenLockBytes, SvOpenLockBytes) + +//============================================================================ +// virtual +ErrCode SvOutputStreamOpenLockBytes::ReadAt(ULONG, void *, ULONG, ULONG *) + const +{ + return ERRCODE_IO_CANTREAD; +} + +//============================================================================ +// virtual +ErrCode SvOutputStreamOpenLockBytes::WriteAt(ULONG nPos, void const * pBuffer, + ULONG nCount, ULONG * pWritten) +{ + if (nPos != m_nPosition) + return ERRCODE_IO_CANTWRITE; + return FillAppend(pBuffer, nCount, pWritten); +} + +//============================================================================ +// virtual +ErrCode SvOutputStreamOpenLockBytes::Flush() const +{ + if (!m_xOutputStream.is()) + return ERRCODE_IO_CANTWRITE; + try + { + m_xOutputStream->flush(); + } + catch (io::IOException) + { + return ERRCODE_IO_CANTWRITE; + } + return ERRCODE_NONE; +} + +//============================================================================ +// virtual +ErrCode SvOutputStreamOpenLockBytes::SetSize(ULONG) +{ + return ERRCODE_IO_NOTSUPPORTED; +} + +//============================================================================ +// virtual +ErrCode SvOutputStreamOpenLockBytes::Stat(SvLockBytesStat * pStat, + SvLockBytesStatFlag) const +{ + if (pStat) + pStat->nSize = m_nPosition; + return ERRCODE_NONE; +} + +//============================================================================ +// virtual +ErrCode SvOutputStreamOpenLockBytes::FillAppend(void const * pBuffer, + ULONG nCount, + ULONG * pWritten) +{ + if (!m_xOutputStream.is()) + return ERRCODE_IO_CANTWRITE; + if (nCount > 0 + && nCount > std::numeric_limits< ULONG >::max() - m_nPosition) + { + nCount = std::numeric_limits< ULONG >::max() - m_nPosition; + if (nCount == 0) + return ERRCODE_IO_CANTWRITE; + } + try + { + m_xOutputStream-> + writeBytes(uno::Sequence< sal_Int8 >( + static_cast< sal_Int8 const * >(pBuffer), nCount)); + } + catch (io::IOException) + { + return ERRCODE_IO_CANTWRITE; + } + m_nPosition += nCount; + if (pWritten) + *pWritten = nCount; + return ERRCODE_NONE; +} + +//============================================================================ +// virtual +ULONG SvOutputStreamOpenLockBytes::Tell() const +{ + return m_nPosition; +} + +//============================================================================ +// virtual +ULONG SvOutputStreamOpenLockBytes::Seek(ULONG) +{ + return m_nPosition; +} + +//============================================================================ +// virtual +void SvOutputStreamOpenLockBytes::Terminate() +{ + if (m_xOutputStream.is()) + try + { + m_xOutputStream->closeOutput(); + } + catch (io::IOException) {} +} + +//============================================================================ +// +// SvLockBytesInputStream +// +//============================================================================ + +// virtual +uno::Any SAL_CALL SvLockBytesInputStream::queryInterface(uno::Type const & + rType) + throw (uno::RuntimeException) +{ + uno::Any + aReturn(cppu::queryInterface(rType, + static_cast< io::XInputStream * >(this), + static_cast< io::XSeekable * >(this))); + return aReturn.hasValue() ? aReturn : OWeakObject::queryInterface(rType); +} + +//============================================================================ +// virtual +void SAL_CALL SvLockBytesInputStream::acquire() throw () +{ + OWeakObject::acquire(); +} + +//============================================================================ +// virtual +void SAL_CALL SvLockBytesInputStream::release() throw () +{ + OWeakObject::release(); +} + +//============================================================================ +// virtual +sal_Int32 SAL_CALL +SvLockBytesInputStream::readBytes(uno::Sequence< sal_Int8 > & rData, + sal_Int32 nBytesToRead) + throw (io::IOException, uno::RuntimeException) +{ + OSL_ASSERT(m_nPosition >= 0); + if (!m_xLockBytes.Is()) + throw io::NotConnectedException(); + if ( + nBytesToRead < 0 || + ( + static_cast(m_nPosition) > SAL_MAX_SIZE && + nBytesToRead > 0 + ) + ) + { + throw io::IOException(); + } + rData.realloc(nBytesToRead); + sal_Int32 nSize = 0; + while (nSize < nBytesToRead) + { + sal_Size nCount; + ErrCode nError = m_xLockBytes->ReadAt(static_cast( + m_nPosition), + rData.getArray() + nSize, + nBytesToRead - nSize, &nCount); + if (nError != ERRCODE_NONE && nError != ERRCODE_IO_PENDING) + throw io::IOException(); + m_nPosition += nCount; + nSize += nCount; + if (nError == ERRCODE_NONE && nCount == 0) + break; + } + rData.realloc(nSize); + return nSize; +} + +//============================================================================ +// virtual +sal_Int32 SAL_CALL +SvLockBytesInputStream::readSomeBytes(uno::Sequence< sal_Int8 > & rData, + sal_Int32 nMaxBytesToRead) + throw (io::IOException, uno::RuntimeException) +{ + OSL_ASSERT(m_nPosition >= 0); + if (!m_xLockBytes.Is()) + throw io::NotConnectedException(); + if (static_cast(m_nPosition) > SAL_MAX_SIZE + && nMaxBytesToRead > 0) + throw io::IOException(); + rData.realloc(nMaxBytesToRead); + sal_Size nCount = 0; + if (nMaxBytesToRead > 0) + { + ErrCode nError; + do + { + nError = m_xLockBytes->ReadAt(static_cast(m_nPosition), + rData.getArray(), + nMaxBytesToRead < 0 ? + 0 : nMaxBytesToRead, + &nCount); + if (nError != ERRCODE_NONE && nError != ERRCODE_IO_PENDING) + throw io::IOException(); + m_nPosition += nCount; + } + while (nCount == 0 && nError == ERRCODE_IO_PENDING); + } + rData.realloc(sal_Int32(nCount)); + return sal_Int32(nCount); +} + +//============================================================================ +// virtual +void SAL_CALL SvLockBytesInputStream::skipBytes(sal_Int32 nBytesToSkip) + throw (io::IOException, uno::RuntimeException) +{ + if (!m_xLockBytes.Is()) + throw io::NotConnectedException(); + if (nBytesToSkip < 0) + throw io::IOException(); + if (nBytesToSkip > SAL_MAX_INT64 - m_nPosition) + throw io::BufferSizeExceededException(); + m_nPosition += nBytesToSkip; +} + +//============================================================================ +// virtual +sal_Int32 SAL_CALL SvLockBytesInputStream::available() + throw (io::IOException, uno::RuntimeException) +{ + OSL_ASSERT(m_nPosition >= 0); + if (!m_xLockBytes.Is()) + throw io::NotConnectedException(); + SvLockBytesStat aStat; + if (m_xLockBytes->Stat(&aStat, SVSTATFLAG_DEFAULT) != ERRCODE_NONE) + throw io::IOException(); + return aStat.nSize <= static_cast(m_nPosition) ? + 0 : + static_cast(aStat.nSize - m_nPosition) <= + static_cast(SAL_MAX_INT32) ? + static_cast(aStat.nSize - m_nPosition) : + SAL_MAX_INT32; +} + +//============================================================================ +// virtual +void SAL_CALL SvLockBytesInputStream::closeInput() + throw (io::IOException, uno::RuntimeException) +{ + if (!m_xLockBytes.Is()) + throw io::NotConnectedException(); + m_xLockBytes = 0; +} + +//============================================================================ +// virtual +void SAL_CALL SvLockBytesInputStream::seek(sal_Int64 nLocation) + throw (lang::IllegalArgumentException, io::IOException, + uno::RuntimeException) +{ + if (nLocation < 0) + throw lang::IllegalArgumentException(); + if (!m_xLockBytes.Is()) + throw io::NotConnectedException(); + m_nPosition = nLocation; +} + +//============================================================================ +// virtual +sal_Int64 SAL_CALL SvLockBytesInputStream::getPosition() + throw (io::IOException, uno::RuntimeException) +{ + if (!m_xLockBytes.Is()) + throw io::NotConnectedException(); + return m_nPosition; +} + +//============================================================================ +// virtual +sal_Int64 SAL_CALL SvLockBytesInputStream::getLength() + throw (io::IOException, uno::RuntimeException) +{ + if (!m_xLockBytes.Is()) + throw io::NotConnectedException(); + SvLockBytesStat aStat; + if (m_xLockBytes->Stat(&aStat, SVSTATFLAG_DEFAULT) != ERRCODE_NONE) + throw io::IOException(); +#if SAL_TYPES_SIZEOFPOINTER > 4 // avoid warnings if sal_Size < sal_Int64 + if (aStat.nSize > static_cast(SAL_MAX_INT64)) + throw io::IOException(); +#endif + return aStat.nSize; +} + +//============================================================================ +// +// SvInputStream +// +//============================================================================ + +bool SvInputStream::open() +{ + if (GetError() != ERRCODE_NONE) + return false; + if (!(m_xSeekable.is() || m_pPipe)) + { + if (!m_xStream.is()) + { + SetError(ERRCODE_IO_INVALIDDEVICE); + return false; + } + m_xSeekable + = uno::Reference< io::XSeekable >(m_xStream, uno::UNO_QUERY); + if (!m_xSeekable.is()) + m_pPipe = new SvDataPipe_Impl; + } + return true; +} + +//============================================================================ +// virtual +ULONG SvInputStream::GetData(void * pData, ULONG nSize) +{ + if (!open()) + { + SetError(ERRCODE_IO_CANTREAD); + return 0; + } + sal_uInt32 nRead = 0; + if (m_xSeekable.is()) + { + if (m_nSeekedFrom != STREAM_SEEK_TO_END) + { + try + { + m_xSeekable->seek(m_nSeekedFrom); + } + catch (io::IOException) + { + SetError(ERRCODE_IO_CANTREAD); + return 0; + } + m_nSeekedFrom = STREAM_SEEK_TO_END; + } + for (;;) + { + sal_Int32 nRemain + = sal_Int32( + std::min(ULONG(nSize - nRead), + ULONG(std::numeric_limits< sal_Int32 >::max()))); + if (nRemain == 0) + break; + uno::Sequence< sal_Int8 > aBuffer; + sal_Int32 nCount; + try + { + nCount = m_xStream->readBytes(aBuffer, nRemain); + } + catch (io::IOException) + { + SetError(ERRCODE_IO_CANTREAD); + return nRead; + } + rtl_copyMemory(static_cast< sal_Int8 * >(pData) + nRead, + aBuffer.getConstArray(), sal_uInt32(nCount)); + nRead += nCount; + if (nCount < nRemain) + break; + } + } + else + { + if (m_nSeekedFrom != STREAM_SEEK_TO_END) + { + SetError(ERRCODE_IO_CANTREAD); + return 0; + } + m_pPipe->setReadBuffer(static_cast< sal_Int8 * >(pData), nSize); + nRead = m_pPipe->read(); + if (nRead < nSize && !m_pPipe->isEOF()) + for (;;) + { + sal_Int32 nRemain + = sal_Int32( + std::min( + ULONG(nSize - nRead), + ULONG(std::numeric_limits< sal_Int32 >::max()))); + if (nRemain == 0) + break; + uno::Sequence< sal_Int8 > aBuffer; + sal_Int32 nCount; + try + { + nCount = m_xStream->readBytes(aBuffer, nRemain); + } + catch (io::IOException) + { + SetError(ERRCODE_IO_CANTREAD); + break; + } + m_pPipe->write(aBuffer.getConstArray(), sal_uInt32(nCount)); + nRead += m_pPipe->read(); + if (nCount < nRemain) + { + m_xStream->closeInput(); + m_pPipe->setEOF(); + break; + } + } + m_pPipe->clearReadBuffer(); + } + return nRead; +} + +//============================================================================ +// virtual +ULONG SvInputStream::PutData(void const *, ULONG) +{ + SetError(ERRCODE_IO_NOTSUPPORTED); + return 0; +} + +//============================================================================ +// virtual +void SvInputStream::FlushData() +{} + +//============================================================================ +// virtual +ULONG SvInputStream::SeekPos(ULONG nPos) +{ + if (open()) + { + if (nPos == STREAM_SEEK_TO_END) + { + if (m_nSeekedFrom == STREAM_SEEK_TO_END) + { + if (m_xSeekable.is()) + try + { + sal_Int64 nLength = m_xSeekable->getLength(); + OSL_ASSERT(nLength >= 0); + if (static_cast(nLength) + < STREAM_SEEK_TO_END) + { + m_nSeekedFrom = Tell(); + return ULONG(nLength); + } + } + catch (io::IOException) {} + else + return Tell(); //@@@ + } + else + return Tell(); + } + else if (nPos == m_nSeekedFrom) + { + m_nSeekedFrom = STREAM_SEEK_TO_END; + return nPos; + } + else if (m_xSeekable.is()) + try + { + m_xSeekable->seek(nPos); + m_nSeekedFrom = STREAM_SEEK_TO_END; + return nPos; + } + catch (io::IOException) {} + else if (m_pPipe->setReadPosition(nPos) == SvDataPipe_Impl::SEEK_OK) + { + m_nSeekedFrom = STREAM_SEEK_TO_END; + return nPos; + } + } + SetError(ERRCODE_IO_CANTSEEK); + return Tell(); +} + +//============================================================================ +// virtual +void SvInputStream::SetSize(ULONG) +{ + SetError(ERRCODE_IO_NOTSUPPORTED); +} + +//============================================================================ +SvInputStream::SvInputStream( + com::sun::star::uno::Reference< com::sun::star::io::XInputStream > + const & + rTheStream): + m_xStream(rTheStream), + m_pPipe(0), + m_nSeekedFrom(STREAM_SEEK_TO_END) +{ + SetBufferSize(0); +} + +//============================================================================ +// virtual +SvInputStream::~SvInputStream() +{ + if (m_xStream.is()) + try + { + m_xStream->closeInput(); + } + catch (io::IOException) {} + delete m_pPipe; +} + +//============================================================================ +// virtual +USHORT SvInputStream::IsA() const +{ + return 0; +} + +//============================================================================ +// virtual +void SvInputStream::AddMark(ULONG nPos) +{ + if (open() && m_pPipe) + m_pPipe->addMark(nPos); +} + +//============================================================================ +// virtual +void SvInputStream::RemoveMark(ULONG nPos) +{ + if (open() && m_pPipe) + m_pPipe->removeMark(nPos); +} + +//============================================================================ +// +// SvOutputStream +// +//============================================================================ + +// virtual +ULONG SvOutputStream::GetData(void *, ULONG) +{ + SetError(ERRCODE_IO_NOTSUPPORTED); + return 0; +} + +//============================================================================ +// virtual +ULONG SvOutputStream::PutData(void const * pData, ULONG nSize) +{ + if (!m_xStream.is()) + { + SetError(ERRCODE_IO_CANTWRITE); + return 0; + } + ULONG nWritten = 0; + for (;;) + { + sal_Int32 nRemain + = sal_Int32( + std::min(ULONG(nSize - nWritten), + ULONG(std::numeric_limits< sal_Int32 >::max()))); + if (nRemain == 0) + break; + try + { + m_xStream->writeBytes(uno::Sequence< sal_Int8 >( + static_cast(pData) + + nWritten, + nRemain)); + } + catch (io::IOException) + { + SetError(ERRCODE_IO_CANTWRITE); + break; + } + nWritten += nRemain; + } + return nWritten; +} + +//============================================================================ +// virtual +ULONG SvOutputStream::SeekPos(ULONG) +{ + SetError(ERRCODE_IO_NOTSUPPORTED); + return 0; +} + +//============================================================================ +// virtual +void SvOutputStream::FlushData() +{ + if (!m_xStream.is()) + { + SetError(ERRCODE_IO_INVALIDDEVICE); + return; + } + try + { + m_xStream->flush(); + } + catch (io::IOException) {} +} + +//============================================================================ +// virtual +void SvOutputStream::SetSize(ULONG) +{ + SetError(ERRCODE_IO_NOTSUPPORTED); +} + +//============================================================================ +SvOutputStream::SvOutputStream(uno::Reference< io::XOutputStream > const & + rTheStream): + m_xStream(rTheStream) +{ + SetBufferSize(0); +} + +//============================================================================ +// virtual +SvOutputStream::~SvOutputStream() +{ + if (m_xStream.is()) + try + { + m_xStream->closeOutput(); + } + catch (io::IOException) {} +} + +//============================================================================ +// virtual +USHORT SvOutputStream::IsA() const +{ + return 0; +} + +//============================================================================ +// +// SvDataPipe_Impl +// +//============================================================================ + +bool SvDataPipe_Impl::remove(Page * pPage) +{ + if ( + pPage != m_pFirstPage || + m_pReadPage == m_pFirstPage || + ( + !m_aMarks.empty() && + *m_aMarks.begin() < m_pFirstPage->m_nOffset + m_nPageSize + ) + ) + { + return false; + } + + m_pFirstPage = m_pFirstPage->m_pNext; + + if (m_nPages <= m_nMinPages) + return true; + + pPage->m_pPrev->m_pNext = pPage->m_pNext; + pPage->m_pNext->m_pPrev = pPage->m_pPrev; + rtl_freeMemory(pPage); + --m_nPages; + + return true; +} + +//============================================================================ +SvDataPipe_Impl::~SvDataPipe_Impl() +{ + if (m_pFirstPage != 0) + for (Page * pPage = m_pFirstPage;;) + { + Page * pNext = pPage->m_pNext; + rtl_freeMemory(pPage); + if (pNext == m_pFirstPage) + break; + pPage = pNext; + } +} + +//============================================================================ +sal_uInt32 SvDataPipe_Impl::read() +{ + if (m_pReadBuffer == 0 || m_nReadBufferSize == 0 || m_pReadPage == 0) + return 0; + + sal_uInt32 nSize = m_nReadBufferSize; + sal_uInt32 nRemain = m_nReadBufferSize - m_nReadBufferFilled; + + m_pReadBuffer += m_nReadBufferFilled; + m_nReadBufferSize -= m_nReadBufferFilled; + m_nReadBufferFilled = 0; + + while (nRemain > 0) + { + sal_uInt32 nBlock = std::min(sal_uInt32(m_pReadPage->m_pEnd + - m_pReadPage->m_pRead), + nRemain); + rtl_copyMemory(m_pReadBuffer, m_pReadPage->m_pRead, nBlock); + m_pReadPage->m_pRead += nBlock; + m_pReadBuffer += nBlock; + m_nReadBufferSize -= nBlock; + m_nReadBufferFilled = 0; + nRemain -= nBlock; + + if (m_pReadPage == m_pWritePage) + break; + + if (m_pReadPage->m_pRead == m_pReadPage->m_pEnd) + { + Page * pRemove = m_pReadPage; + m_pReadPage = pRemove->m_pNext; + remove(pRemove); + } + } + + return nSize - nRemain; +} + +//============================================================================ +sal_uInt32 SvDataPipe_Impl::write(sal_Int8 const * pBuffer, sal_uInt32 nSize) +{ + if (nSize == 0) + return 0; + + if (m_pWritePage == 0) + { + m_pFirstPage + = static_cast< Page * >(rtl_allocateMemory(sizeof (Page) + + m_nPageSize + - 1)); + m_pFirstPage->m_pPrev = m_pFirstPage; + m_pFirstPage->m_pNext = m_pFirstPage; + m_pFirstPage->m_pStart = m_pFirstPage->m_aBuffer; + m_pFirstPage->m_pRead = m_pFirstPage->m_aBuffer; + m_pFirstPage->m_pEnd = m_pFirstPage->m_aBuffer; + m_pFirstPage->m_nOffset = 0; + m_pReadPage = m_pFirstPage; + m_pWritePage = m_pFirstPage; + ++m_nPages; + } + + sal_uInt32 nRemain = nSize; + + if (m_pReadBuffer != 0 && m_pReadPage == m_pWritePage + && m_pReadPage->m_pRead == m_pWritePage->m_pEnd) + { + sal_uInt32 nBlock = std::min(nRemain, + sal_uInt32(m_nReadBufferSize + - m_nReadBufferFilled)); + sal_uInt32 nPosition = m_pWritePage->m_nOffset + + (m_pWritePage->m_pEnd + - m_pWritePage->m_aBuffer); + if (!m_aMarks.empty()) + nBlock = *m_aMarks.begin() > nPosition ? + std::min(nBlock, sal_uInt32(*m_aMarks.begin() + - nPosition)) : + 0; + + if (nBlock > 0) + { + rtl_copyMemory(m_pReadBuffer + m_nReadBufferFilled, pBuffer, + nBlock); + m_nReadBufferFilled += nBlock; + nRemain -= nBlock; + + nPosition += nBlock; + m_pWritePage->m_nOffset = (nPosition / m_nPageSize) * m_nPageSize; + m_pWritePage->m_pStart = m_pWritePage->m_aBuffer + + nPosition % m_nPageSize; + m_pWritePage->m_pRead = m_pWritePage->m_pStart; + m_pWritePage->m_pEnd = m_pWritePage->m_pStart; + } + } + + if (nRemain > 0) + for (;;) + { + sal_uInt32 nBlock + = std::min(sal_uInt32(m_pWritePage->m_aBuffer + m_nPageSize + - m_pWritePage->m_pEnd), + nRemain); + rtl_copyMemory(m_pWritePage->m_pEnd, pBuffer, nBlock); + m_pWritePage->m_pEnd += nBlock; + pBuffer += nBlock; + nRemain -= nBlock; + + if (nRemain == 0) + break; + + if (m_pWritePage->m_pNext == m_pFirstPage) + { + if (m_nPages == m_nMaxPages) + break; + + Page * pNew + = static_cast< Page * >(rtl_allocateMemory( + sizeof (Page) + m_nPageSize + - 1)); + pNew->m_pPrev = m_pWritePage; + pNew->m_pNext = m_pWritePage->m_pNext; + + m_pWritePage->m_pNext->m_pPrev = pNew; + m_pWritePage->m_pNext = pNew; + ++m_nPages; + } + + m_pWritePage->m_pNext->m_nOffset = m_pWritePage->m_nOffset + + m_nPageSize; + m_pWritePage = m_pWritePage->m_pNext; + m_pWritePage->m_pStart = m_pWritePage->m_aBuffer; + m_pWritePage->m_pRead = m_pWritePage->m_aBuffer; + m_pWritePage->m_pEnd = m_pWritePage->m_aBuffer; + } + + return nSize - nRemain; +} + +//============================================================================ +bool SvDataPipe_Impl::addMark(sal_uInt32 nPosition) +{ + if (m_pFirstPage != 0 && m_pFirstPage->m_nOffset > nPosition) + return false; + m_aMarks.insert(nPosition); + return true; +} + +//============================================================================ +bool SvDataPipe_Impl::removeMark(sal_uInt32 nPosition) +{ + std::multiset< sal_uInt32 >::iterator t = m_aMarks.find(nPosition); + if (t == m_aMarks.end()) + return false; + m_aMarks.erase(t); + while (remove(m_pFirstPage)) ; + return true; +} + +//============================================================================ +SvDataPipe_Impl::SeekResult SvDataPipe_Impl::setReadPosition(sal_uInt32 + nPosition) +{ + if (m_pFirstPage == 0) + return nPosition == 0 ? SEEK_OK : SEEK_PAST_END; + + if (nPosition + <= m_pReadPage->m_nOffset + + (m_pReadPage->m_pRead - m_pReadPage->m_aBuffer)) + { + if (nPosition + < m_pFirstPage->m_nOffset + + (m_pFirstPage->m_pStart - m_pFirstPage->m_aBuffer)) + return SEEK_BEFORE_MARKED; + + while (nPosition < m_pReadPage->m_nOffset) + { + m_pReadPage->m_pRead = m_pReadPage->m_pStart; + m_pReadPage = m_pReadPage->m_pPrev; + } + } + else + { + if (nPosition + > m_pWritePage->m_nOffset + + (m_pWritePage->m_pEnd - m_pWritePage->m_aBuffer)) + return SEEK_PAST_END; + + while (m_pReadPage != m_pWritePage + && nPosition >= m_pReadPage->m_nOffset + m_nPageSize) + { + Page * pRemove = m_pReadPage; + m_pReadPage = pRemove->m_pNext; + remove(pRemove); + } + } + + m_pReadPage->m_pRead = m_pReadPage->m_aBuffer + + (nPosition - m_pReadPage->m_nOffset); + return SEEK_OK; +} + diff --git a/svl/source/misc/svldata.cxx b/svl/source/misc/svldata.cxx new file mode 100644 index 000000000000..51247a628c0e --- /dev/null +++ b/svl/source/misc/svldata.cxx @@ -0,0 +1,113 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: svtdata.cxx,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include +#include +#include +#include +#include + +namespace unnamed_svtools_svtdata {} +using namespace unnamed_svtools_svtdata; + // unnamed namespaces don't work well yet + +//============================================================================ +namespace unnamed_svtools_svtdata { + +typedef std::map< rtl::OUString, SimpleResMgr * > SimpleResMgrMap; + +} + +//============================================================================ +// +// ImpSvtData +// +//============================================================================ + +ImpSvtData::~ImpSvtData() +{ + delete pResMgr; + for (SimpleResMgrMap::iterator t + = static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs)->begin(); + t != static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs)->end(); ++t) + delete t->second; + delete static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs); +} + +//============================================================================ +ResMgr * ImpSvtData::GetResMgr(const ::com::sun::star::lang::Locale aLocale) +{ + if (!pResMgr) + { + pResMgr = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(svt), aLocale ); + } + return pResMgr; +} + +//============================================================================ +SimpleResMgr* ImpSvtData::GetSimpleRM(const ::com::sun::star::lang::Locale& rLocale) +{ + if (!m_pThreadsafeRMs) + m_pThreadsafeRMs = new SimpleResMgrMap; + rtl::OUString aISOcode = rLocale.Language; + aISOcode += rtl::OStringToOUString("-", RTL_TEXTENCODING_UTF8); + aISOcode += rLocale.Country; + + SimpleResMgr *& rResMgr + = (*static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs))[aISOcode]; + if (!rResMgr) + { + rResMgr = new SimpleResMgr(CREATEVERSIONRESMGR_NAME(svs), rLocale ); + } + return rResMgr; +} + +ResMgr * ImpSvtData::GetPatchResMgr(const ::com::sun::star::lang::Locale& aLocale) +{ + if (!pPatchResMgr) + { + pPatchResMgr = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(svp), aLocale); + } + return pPatchResMgr; +} + +//============================================================================ +// static +ImpSvtData & ImpSvtData::GetSvtData() +{ + void ** pAppData = GetAppData(SHL_SVT); + if (!*pAppData) + *pAppData= new ImpSvtData; + return *static_cast(*pAppData); +} + diff --git a/svl/source/misc/urihelper.cxx b/svl/source/misc/urihelper.cxx new file mode 100644 index 000000000000..1ddb4c6dd6f9 --- /dev/null +++ b/svl/source/misc/urihelper.cxx @@ -0,0 +1,952 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: urihelper.cxx,v $ + * $Revision: 1.22.136.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include +#include +#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" +#include "com/sun/star/lang/XMultiComponentFactory.hpp" +#include "com/sun/star/ucb/Command.hpp" +#include +#include "com/sun/star/ucb/IllegalIdentifierException.hpp" +#include "com/sun/star/ucb/UnsupportedCommandException.hpp" +#include "com/sun/star/ucb/XCommandEnvironment.hpp" +#include "com/sun/star/ucb/XCommandProcessor.hpp" +#include "com/sun/star/ucb/XContent.hpp" +#include "com/sun/star/ucb/XContentIdentifierFactory.hpp" +#include "com/sun/star/ucb/XContentProvider.hpp" +#include +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uri/UriReferenceFactory.hpp" +#include "com/sun/star/uri/XUriReference.hpp" +#include "com/sun/star/uri/XUriReferenceFactory.hpp" +#include "cppuhelper/exc_hlp.hxx" +#include "comphelper/processfactory.hxx" +#include "osl/diagnose.h" +#include "rtl/ustrbuf.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include +#include +#include +#include +#include "rtl/instance.hxx" + +namespace unnamed_svtools_urihelper {} +using namespace unnamed_svtools_urihelper; + // unnamed namespaces don't work well yet... + +namespace css = com::sun::star; +using namespace com::sun::star; + +//============================================================================ +// +// SmartRel2Abs +// +//============================================================================ + +namespace unnamed_svtools_urihelper { + +inline UniString toUniString(ByteString const & rString) +{ + return UniString(rString, RTL_TEXTENCODING_ISO_8859_1); +} + +inline UniString toUniString(UniString const & rString) +{ + return rString; +} + +template< typename Str > +inline UniString SmartRel2Abs_Impl(INetURLObject const & rTheBaseURIRef, + Str const & rTheRelURIRef, + Link const & rMaybeFileHdl, + bool bCheckFileExists, + bool bIgnoreFragment, + INetURLObject::EncodeMechanism + eEncodeMechanism, + INetURLObject::DecodeMechanism + eDecodeMechanism, + rtl_TextEncoding eCharset, + bool bRelativeNonURIs, + INetURLObject::FSysStyle eStyle) +{ + // Backwards compatibility: + if (rTheRelURIRef.Len() != 0 && rTheRelURIRef.GetChar(0) == '#') + return toUniString(rTheRelURIRef); + + INetURLObject aAbsURIRef; + if (rTheBaseURIRef.HasError()) + aAbsURIRef. + SetSmartURL(rTheRelURIRef, eEncodeMechanism, eCharset, eStyle); + else + { + bool bWasAbsolute; + aAbsURIRef = rTheBaseURIRef.smartRel2Abs(rTheRelURIRef, + bWasAbsolute, + bIgnoreFragment, + eEncodeMechanism, + eCharset, + bRelativeNonURIs, + eStyle); + if (bCheckFileExists + && !bWasAbsolute + && (aAbsURIRef.GetProtocol() == INET_PROT_FILE + || aAbsURIRef.GetProtocol() == INET_PROT_VND_SUN_STAR_WFS)) + { + INetURLObject aNonFileURIRef; + aNonFileURIRef.SetSmartURL(rTheRelURIRef, + eEncodeMechanism, + eCharset, + eStyle); + if (!aNonFileURIRef.HasError() + && aNonFileURIRef.GetProtocol() != INET_PROT_FILE) + { + bool bMaybeFile = false; + if (rMaybeFileHdl.IsSet()) + { + UniString aFilePath(toUniString(rTheRelURIRef)); + bMaybeFile = rMaybeFileHdl.Call(&aFilePath) != 0; + } + if (!bMaybeFile) + aAbsURIRef = aNonFileURIRef; + } + } + } + return aAbsURIRef.GetMainURL(eDecodeMechanism, eCharset); +} + +} + +UniString +URIHelper::SmartRel2Abs(INetURLObject const & rTheBaseURIRef, + ByteString const & rTheRelURIRef, + Link const & rMaybeFileHdl, + bool bCheckFileExists, + bool bIgnoreFragment, + INetURLObject::EncodeMechanism eEncodeMechanism, + INetURLObject::DecodeMechanism eDecodeMechanism, + rtl_TextEncoding eCharset, + bool bRelativeNonURIs, + INetURLObject::FSysStyle eStyle) +{ + return SmartRel2Abs_Impl(rTheBaseURIRef, rTheRelURIRef, rMaybeFileHdl, + bCheckFileExists, bIgnoreFragment, + eEncodeMechanism, eDecodeMechanism, eCharset, + bRelativeNonURIs, eStyle); +} + +UniString +URIHelper::SmartRel2Abs(INetURLObject const & rTheBaseURIRef, + UniString const & rTheRelURIRef, + Link const & rMaybeFileHdl, + bool bCheckFileExists, + bool bIgnoreFragment, + INetURLObject::EncodeMechanism eEncodeMechanism, + INetURLObject::DecodeMechanism eDecodeMechanism, + rtl_TextEncoding eCharset, + bool bRelativeNonURIs, + INetURLObject::FSysStyle eStyle) +{ + return SmartRel2Abs_Impl(rTheBaseURIRef, rTheRelURIRef, rMaybeFileHdl, + bCheckFileExists, bIgnoreFragment, + eEncodeMechanism, eDecodeMechanism, eCharset, + bRelativeNonURIs, eStyle); +} + +//============================================================================ +// +// SetMaybeFileHdl +// +//============================================================================ + +namespace { struct MaybeFileHdl : public rtl::Static< Link, MaybeFileHdl > {}; } + +void URIHelper::SetMaybeFileHdl(Link const & rTheMaybeFileHdl) +{ + MaybeFileHdl::get() = rTheMaybeFileHdl; +} + +//============================================================================ +// +// GetMaybeFileHdl +// +//============================================================================ + +Link URIHelper::GetMaybeFileHdl() +{ + return MaybeFileHdl::get(); +} + +namespace { + +bool isAbsoluteHierarchicalUriReference( + css::uno::Reference< css::uri::XUriReference > const & uriReference) +{ + return uriReference.is() && uriReference->isAbsolute() + && uriReference->isHierarchical() && !uriReference->hasRelativePath(); +} + +// To improve performance, assume that if for any prefix URL of a given +// hierarchical URL either a UCB content cannot be created, or the UCB content +// does not support the getCasePreservingURL command, then this will hold for +// any other prefix URL of the given URL, too: +enum Result { Success, GeneralFailure, SpecificFailure }; + +Result normalizePrefix( + css::uno::Reference< css::ucb::XContentProvider > const & broker, + rtl::OUString const & uri, rtl::OUString * normalized) +{ + OSL_ASSERT(broker.is() && normalized != 0); + css::uno::Reference< css::ucb::XContent > content; + try { + content = broker->queryContent( + css::uno::Reference< css::ucb::XContentIdentifierFactory >( + broker, css::uno::UNO_QUERY_THROW)->createContentIdentifier( + uri)); + } catch (css::ucb::IllegalIdentifierException &) {} + if (!content.is()) { + return GeneralFailure; + } + try { + #if OSL_DEBUG_LEVEL > 0 + bool ok = + #endif + (css::uno::Reference< css::ucb::XCommandProcessor >( + content, css::uno::UNO_QUERY_THROW)->execute( + css::ucb::Command( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "getCasePreservingURL")), + -1, css::uno::Any()), + 0, + css::uno::Reference< css::ucb::XCommandEnvironment >()) + >>= *normalized); + OSL_ASSERT(ok); + } catch (css::uno::RuntimeException &) { + throw; + } catch (css::ucb::UnsupportedCommandException &) { + return GeneralFailure; + } catch (css::uno::Exception &) { + return SpecificFailure; + } + return Success; +} + +rtl::OUString normalize( + css::uno::Reference< css::ucb::XContentProvider > const & broker, + css::uno::Reference< css::uri::XUriReferenceFactory > const & uriFactory, + rtl::OUString const & uriReference) +{ + // normalizePrefix can potentially fail (a typically example being a file + // URL that denotes a non-existing resource); in such a case, try to + // normalize as long a prefix of the given URL as possible (i.e., normalize + // all the existing directories within the path): + rtl::OUString normalized; + sal_Int32 n = uriReference.indexOf('#'); + normalized = n == -1 ? uriReference : uriReference.copy(0, n); + switch (normalizePrefix(broker, normalized, &normalized)) { + case Success: + return n == -1 ? normalized : normalized + uriReference.copy(n); + case GeneralFailure: + return uriReference; + case SpecificFailure: + default: + break; + } + css::uno::Reference< css::uri::XUriReference > ref( + uriFactory->parse(uriReference)); + if (!isAbsoluteHierarchicalUriReference(ref)) { + return uriReference; + } + sal_Int32 count = ref->getPathSegmentCount(); + if (count < 2) { + return uriReference; + } + rtl::OUStringBuffer head(ref->getScheme()); + head.append(static_cast< sal_Unicode >(':')); + if (ref->hasAuthority()) { + head.appendAscii(RTL_CONSTASCII_STRINGPARAM("//")); + head.append(ref->getAuthority()); + } + for (sal_Int32 i = count - 1; i > 0; --i) { + rtl::OUStringBuffer buf(head); + for (sal_Int32 j = 0; j < i; ++j) { + buf.append(static_cast< sal_Unicode >('/')); + buf.append(ref->getPathSegment(j)); + } + normalized = buf.makeStringAndClear(); + if (normalizePrefix(broker, normalized, &normalized) != SpecificFailure) + { + buf.append(normalized); + css::uno::Reference< css::uri::XUriReference > preRef( + uriFactory->parse(normalized)); + if (!isAbsoluteHierarchicalUriReference(preRef)) { + // This could only happen if something is inconsistent: + break; + } + sal_Int32 preCount = preRef->getPathSegmentCount(); + // normalizePrefix may have added or removed a final slash: + if (preCount != i) { + if (preCount == i - 1) { + buf.append(static_cast< sal_Unicode >('/')); + } else if (preCount - 1 == i && buf.getLength() > 0 + && buf.charAt(buf.getLength() - 1) == '/') + { + buf.setLength(buf.getLength() - 1); + } else { + // This could only happen if something is inconsistent: + break; + } + } + for (sal_Int32 j = i; j < count; ++j) { + buf.append(static_cast< sal_Unicode >('/')); + buf.append(ref->getPathSegment(j)); + } + if (ref->hasQuery()) { + buf.append(static_cast< sal_Unicode >('?')); + buf.append(ref->getQuery()); + } + if (ref->hasFragment()) { + buf.append(static_cast< sal_Unicode >('#')); + buf.append(ref->getFragment()); + } + return buf.makeStringAndClear(); + } + } + return uriReference; +} + +} + +css::uno::Reference< css::uri::XUriReference > +URIHelper::normalizedMakeRelative( + css::uno::Reference< css::uno::XComponentContext > const & context, + rtl::OUString const & baseUriReference, rtl::OUString const & uriReference) +{ + OSL_ASSERT(context.is()); + css::uno::Reference< css::lang::XMultiComponentFactory > componentFactory( + context->getServiceManager()); + if (!componentFactory.is()) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "component context has no service manager")), + css::uno::Reference< css::uno::XInterface >()); + } + css::uno::Sequence< css::uno::Any > args(2); + args[0] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Local")); + args[1] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Office")); + css::uno::Reference< css::ucb::XContentProvider > broker; + try { + broker = css::uno::Reference< css::ucb::XContentProvider >( + componentFactory->createInstanceWithArgumentsAndContext( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.ucb.UniversalContentBroker")), + args, context), + css::uno::UNO_QUERY_THROW); + } catch (css::uno::RuntimeException &) { + throw; + } catch (css::uno::Exception &) { + css::uno::Any exception(cppu::getCaughtException()); + throw css::lang::WrappedTargetRuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "creating com.sun.star.ucb.UniversalContentBroker failed")), + css::uno::Reference< css::uno::XInterface >(), + exception); + } + css::uno::Reference< css::uri::XUriReferenceFactory > uriFactory( + css::uri::UriReferenceFactory::create(context)); + return uriFactory->makeRelative( + uriFactory->parse(normalize(broker, uriFactory, baseUriReference)), + uriFactory->parse(normalize(broker, uriFactory, uriReference)), true, + true, false); +} + +rtl::OUString URIHelper::simpleNormalizedMakeRelative( + rtl::OUString const & baseUriReference, rtl::OUString const & uriReference) +{ + com::sun::star::uno::Reference< com::sun::star::uri::XUriReference > rel( + URIHelper::normalizedMakeRelative( + com::sun::star::uno::Reference< + com::sun::star::uno::XComponentContext >( + (com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet >( + comphelper::getProcessServiceFactory(), + com::sun::star::uno::UNO_QUERY_THROW)-> + getPropertyValue( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("DefaultContext")))), + com::sun::star::uno::UNO_QUERY_THROW), + baseUriReference, uriReference)); + return rel.is() ? rel->getUriReference() : uriReference; +} + +//============================================================================ +// +// FindFirstURLInText +// +//============================================================================ + +namespace unnamed_svtools_urihelper { + +inline xub_StrLen nextChar(UniString const & rStr, xub_StrLen nPos) +{ + return INetMIME::isHighSurrogate(rStr.GetChar(nPos)) + && rStr.Len() - nPos >= 2 + && INetMIME::isLowSurrogate(rStr.GetChar(nPos + 1)) ? + nPos + 2 : nPos + 1; +} + +bool isBoundary1(CharClass const & rCharClass, UniString const & rStr, + xub_StrLen nPos, xub_StrLen nEnd) +{ + if (nPos == nEnd) + return true; + if (rCharClass.isLetterNumeric(rStr, nPos)) + return false; + switch (rStr.GetChar(nPos)) + { + case '$': + case '%': + case '&': + case '-': + case '/': + case '@': + case '\\': + return false; + default: + return true; + } +} + +bool isBoundary2(CharClass const & rCharClass, UniString const & rStr, + xub_StrLen nPos, xub_StrLen nEnd) +{ + if (nPos == nEnd) + return true; + if (rCharClass.isLetterNumeric(rStr, nPos)) + return false; + switch (rStr.GetChar(nPos)) + { + case '!': + case '#': + case '$': + case '%': + case '&': + case '\'': + case '*': + case '+': + case '-': + case '/': + case '=': + case '?': + case '@': + case '^': + case '_': + case '`': + case '{': + case '|': + case '}': + case '~': + return false; + default: + return true; + } +} + +bool checkWChar(CharClass const & rCharClass, UniString const & rStr, + xub_StrLen * pPos, xub_StrLen * pEnd, bool bBackslash = false, + bool bPipe = false) +{ + sal_Unicode c = rStr.GetChar(*pPos); + if (INetMIME::isUSASCII(c)) + { + static sal_uInt8 const aMap[128] + = { 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 4, 4, 4, 1, // !"#$%&' + 1, 1, 1, 1, 1, 4, 1, 4, // ()*+,-./ + 4, 4, 4, 4, 4, 4, 4, 4, // 01234567 + 4, 4, 1, 1, 0, 1, 0, 1, // 89:;<=>? + 4, 4, 4, 4, 4, 4, 4, 4, // @ABCDEFG + 4, 4, 4, 4, 4, 4, 4, 4, // HIJKLMNO + 4, 4, 4, 4, 4, 4, 4, 4, // PQRSTUVW + 4, 4, 4, 1, 2, 1, 0, 1, // XYZ[\]^_ + 0, 4, 4, 4, 4, 4, 4, 4, // `abcdefg + 4, 4, 4, 4, 4, 4, 4, 4, // hijklmno + 4, 4, 4, 4, 4, 4, 4, 4, // pqrstuvw + 4, 4, 4, 0, 3, 0, 1, 0 }; // xyz{|}~ + switch (aMap[c]) + { + default: // not uric + return false; + + case 1: // uric + ++(*pPos); + return true; + + case 2: // "\" + if (bBackslash) + { + *pEnd = ++(*pPos); + return true; + } + else + return false; + + case 3: // "|" + if (bPipe) + { + *pEnd = ++(*pPos); + return true; + } + else + return false; + + case 4: // alpha, digit, "$", "%", "&", "-", "/", "@" (see + // isBoundary1) + *pEnd = ++(*pPos); + return true; + } + } + else if (rCharClass.isLetterNumeric(rStr, *pPos)) + { + *pEnd = *pPos = nextChar(rStr, *pPos); + return true; + } + else + return false; +} + +sal_uInt32 scanDomain(UniString const & rStr, xub_StrLen * pPos, + xub_StrLen nEnd) +{ + sal_Unicode const * pBuffer = rStr.GetBuffer(); + sal_Unicode const * p = pBuffer + *pPos; + sal_uInt32 nLabels = INetURLObject::scanDomain(p, pBuffer + nEnd, false); + *pPos = sal::static_int_cast< xub_StrLen >(p - pBuffer); + return nLabels; +} + +} + +UniString +URIHelper::FindFirstURLInText(UniString const & rText, + xub_StrLen & rBegin, + xub_StrLen & rEnd, + CharClass const & rCharClass, + INetURLObject::EncodeMechanism eMechanism, + rtl_TextEncoding eCharset, + INetURLObject::FSysStyle eStyle) +{ + if (!(rBegin <= rEnd && rEnd <= rText.Len())) + return UniString(); + + // Search for the first substring of [rBegin..rEnd[ that matches any of the + // following productions (for which the appropriate style bit is set in + // eStyle, if applicable). + // + // 1st Production (known scheme): + // \B1 ":" 1*wchar ["#" 1*wchar] + // \B1 + // + // 2nd Production (file): + // \B1 "FILE:" 1*(wchar / "\" / "|") ["#" 1*wchar] \B1 + // + // 3rd Production (ftp): + // \B1 "FTP" 2*("." label) ["/" *wchar] ["#" 1*wchar] \B1 + // + // 4th Production (http): + // \B1 "WWW" 2*("." label) ["/" *wchar] ["#" 1*wchar] \B1 + // + // 5th Production (mailto): + // \B2 local-part "@" domain \B1 + // + // 6th Production (UNC file): + // \B1 "\\" domain "\" *(wchar / "\") \B1 + // + // 7th Production (DOS file): + // \B1 ALPHA ":\" *(wchar / "\") \B1 + // + // 8th Production (Unix-like DOS file): + // \B1 ALPHA ":/" *(wchar / "\") \B1 + // + // The productions use the following auxiliary rules. + // + // local-part = atom *("." atom) + // atom = 1*(alphanum / "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" + // / "-" / "/" / "=" / "?" / "^" / "_" / "`" / "{" / "|" / "}" + // / "~") + // domain = label *("." label) + // label = alphanum [*(alphanum / "-") alphanum] + // alphanum = ALPHA / DIGIT + // wchar = + // + // "\B1" (boundary 1) stands for the beginning or end of the block of text, + // or a character that is neither (a) a letter or digit (according to + // rCharClass), nor (b) any of "$", "%", "&", "-", "/", "@", or "\". + // (FIXME: What was the rationale for this set of punctuation characters?) + // + // "\B2" (boundary 2) stands for the beginning or end of the block of text, + // or a character that is neither (a) a letter or digit (according to + // rCharClass), nor (b) any of "!", "#", "$", "%", "&", "'", "*", "+", "-", + // "/", "=", "?", "@", "^", "_", "`", "{", "|", "}", or "~" (i.e., an RFC + // 822 character, or "@" from \B1's set above). + // + // Productions 1--4, and 6--8 try to find a maximum-length match, but they + // stop at the first character that is a "\B1" character which is + // only followed by "\B1" characters (taking "\" and "|" characters into + // account appropriately). Production 5 simply tries to find a maximum- + // length match. + // + // Productions 1--4 use the given eMechanism and eCharset. Productions 5--9 + // use ENCODE_ALL. + // + // Productions 6--9 are only applicable if the FSYS_DOS bit is set in + // eStyle. + + bool bBoundary1 = true; + bool bBoundary2 = true; + for (xub_StrLen nPos = rBegin; nPos != rEnd; nPos = nextChar(rText, nPos)) + { + sal_Unicode c = rText.GetChar(nPos); + if (bBoundary1) + { + if (INetMIME::isAlpha(c)) + { + xub_StrLen i = nPos; + INetProtocol eScheme + = INetURLObject::CompareProtocolScheme(UniString(rText, i, + rEnd)); + if (eScheme == INET_PROT_FILE) // 2nd + { + while (rText.GetChar(i++) != ':') ; + xub_StrLen nPrefixEnd = i; + xub_StrLen nUriEnd = i; + while (i != rEnd + && checkWChar(rCharClass, rText, &i, &nUriEnd, true, + true)) ; + if (i != nPrefixEnd && rText.GetChar(i) == '#') + { + ++i; + while (i != rEnd + && checkWChar(rCharClass, rText, &i, &nUriEnd)) ; + } + if (nUriEnd != nPrefixEnd + && isBoundary1(rCharClass, rText, nUriEnd, rEnd)) + { + INetURLObject aUri(UniString(rText, nPos, + nUriEnd - nPos), + INET_PROT_FILE, eMechanism, eCharset, + eStyle); + if (!aUri.HasError()) + { + rBegin = nPos; + rEnd = nUriEnd; + return + aUri.GetMainURL(INetURLObject::DECODE_TO_IURI); + } + } + } + else if (eScheme != INET_PROT_NOT_VALID) // 1st + { + while (rText.GetChar(i++) != ':') ; + xub_StrLen nPrefixEnd = i; + xub_StrLen nUriEnd = i; + while (i != rEnd + && checkWChar(rCharClass, rText, &i, &nUriEnd)) ; + if (i != nPrefixEnd && rText.GetChar(i) == '#') + { + ++i; + while (i != rEnd + && checkWChar(rCharClass, rText, &i, &nUriEnd)) ; + } + if (nUriEnd != nPrefixEnd + && (isBoundary1(rCharClass, rText, nUriEnd, rEnd) + || rText.GetChar(nUriEnd) == '\\')) + { + INetURLObject aUri(UniString(rText, nPos, + nUriEnd - nPos), + INET_PROT_HTTP, eMechanism, + eCharset); + if (!aUri.HasError()) + { + rBegin = nPos; + rEnd = nUriEnd; + return + aUri.GetMainURL(INetURLObject::DECODE_TO_IURI); + } + } + } + + // 3rd, 4th: + i = nPos; + sal_uInt32 nLabels = scanDomain(rText, &i, rEnd); + if (nLabels >= 3 + && rText.GetChar(nPos + 3) == '.' + && (((rText.GetChar(nPos) == 'w' + || rText.GetChar(nPos) == 'W') + && (rText.GetChar(nPos + 1) == 'w' + || rText.GetChar(nPos + 1) == 'W') + && (rText.GetChar(nPos + 2) == 'w' + || rText.GetChar(nPos + 2) == 'W')) + || ((rText.GetChar(nPos) == 'f' + || rText.GetChar(nPos) == 'F') + && (rText.GetChar(nPos + 1) == 't' + || rText.GetChar(nPos + 1) == 'T') + && (rText.GetChar(nPos + 2) == 'p' + || rText.GetChar(nPos + 2) == 'P')))) + // (note that rText.GetChar(nPos + 3) is guaranteed to be + // valid) + { + xub_StrLen nUriEnd = i; + if (i != rEnd && rText.GetChar(i) == '/') + { + nUriEnd = ++i; + while (i != rEnd + && checkWChar(rCharClass, rText, &i, &nUriEnd)) ; + } + if (i != rEnd && rText.GetChar(i) == '#') + { + ++i; + while (i != rEnd + && checkWChar(rCharClass, rText, &i, &nUriEnd)) ; + } + if (isBoundary1(rCharClass, rText, nUriEnd, rEnd) + || rText.GetChar(nUriEnd) == '\\') + { + INetURLObject aUri(UniString(rText, nPos, + nUriEnd - nPos), + INET_PROT_HTTP, eMechanism, + eCharset); + if (!aUri.HasError()) + { + rBegin = nPos; + rEnd = nUriEnd; + return + aUri.GetMainURL(INetURLObject::DECODE_TO_IURI); + } + } + } + + if ((eStyle & INetURLObject::FSYS_DOS) != 0 && rEnd - nPos >= 3 + && rText.GetChar(nPos + 1) == ':' + && (rText.GetChar(nPos + 2) == '/' + || rText.GetChar(nPos + 2) == '\\')) // 7th, 8th + { + i = nPos + 3; + xub_StrLen nUriEnd = i; + while (i != rEnd + && checkWChar(rCharClass, rText, &i, &nUriEnd)) ; + if (isBoundary1(rCharClass, rText, nUriEnd, rEnd)) + { + INetURLObject aUri(UniString(rText, nPos, + nUriEnd - nPos), + INET_PROT_FILE, + INetURLObject::ENCODE_ALL, + RTL_TEXTENCODING_UTF8, + INetURLObject::FSYS_DOS); + if (!aUri.HasError()) + { + rBegin = nPos; + rEnd = nUriEnd; + return + aUri.GetMainURL(INetURLObject::DECODE_TO_IURI); + } + } + } + } + else if ((eStyle & INetURLObject::FSYS_DOS) != 0 && rEnd - nPos >= 2 + && rText.GetChar(nPos) == '\\' + && rText.GetChar(nPos + 1) == '\\') // 6th + { + xub_StrLen i = nPos + 2; + sal_uInt32 nLabels = scanDomain(rText, &i, rEnd); + if (nLabels >= 1 && i != rEnd && rText.GetChar(i) == '\\') + { + xub_StrLen nUriEnd = ++i; + while (i != rEnd + && checkWChar(rCharClass, rText, &i, &nUriEnd, + true)) ; + if (isBoundary1(rCharClass, rText, nUriEnd, rEnd)) + { + INetURLObject aUri(UniString(rText, nPos, + nUriEnd - nPos), + INET_PROT_FILE, + INetURLObject::ENCODE_ALL, + RTL_TEXTENCODING_UTF8, + INetURLObject::FSYS_DOS); + if (!aUri.HasError()) + { + rBegin = nPos; + rEnd = nUriEnd; + return + aUri.GetMainURL(INetURLObject::DECODE_TO_IURI); + } + } + } + } + } + if (bBoundary2 && INetMIME::isAtomChar(c)) // 5th + { + bool bDot = false; + for (xub_StrLen i = nPos + 1; i != rEnd; ++i) + { + sal_Unicode c2 = rText.GetChar(i); + if (INetMIME::isAtomChar(c2)) + bDot = false; + else if (bDot) + break; + else if (c2 == '.') + bDot = true; + else + { + if (c2 == '@') + { + ++i; + sal_uInt32 nLabels = scanDomain(rText, &i, rEnd); + if (nLabels >= 1 + && isBoundary1(rCharClass, rText, i, rEnd)) + { + INetURLObject aUri(UniString(rText, nPos, i - nPos), + INET_PROT_MAILTO, + INetURLObject::ENCODE_ALL); + if (!aUri.HasError()) + { + rBegin = nPos; + rEnd = i; + return aUri.GetMainURL( + INetURLObject::DECODE_TO_IURI); + } + } + } + break; + } + } + } + bBoundary1 = isBoundary1(rCharClass, rText, nPos, rEnd); + bBoundary2 = isBoundary2(rCharClass, rText, nPos, rEnd); + } + rBegin = rEnd; + return UniString(); +} + +//============================================================================ +// +// removePassword +// +//============================================================================ + +UniString +URIHelper::removePassword(UniString const & rURI, + INetURLObject::EncodeMechanism eEncodeMechanism, + INetURLObject::DecodeMechanism eDecodeMechanism, + rtl_TextEncoding eCharset) +{ + INetURLObject aObj(rURI, eEncodeMechanism, eCharset); + return aObj.HasError() ? + rURI : + String(aObj.GetURLNoPass(eDecodeMechanism, eCharset)); +} + +//============================================================================ +// +// queryFSysStyle +// +//============================================================================ + +INetURLObject::FSysStyle URIHelper::queryFSysStyle(UniString const & rFileUrl, + bool bAddConvenienceStyles) + throw (uno::RuntimeException) +{ + ::ucbhelper::ContentBroker const * pBroker = ::ucbhelper::ContentBroker::get(); + uno::Reference< ucb::XContentProviderManager > xManager; + if (pBroker) + xManager = pBroker->getContentProviderManagerInterface(); + uno::Reference< beans::XPropertySet > xProperties; + if (xManager.is()) + xProperties + = uno::Reference< beans::XPropertySet >( + xManager->queryContentProvider(rFileUrl), uno::UNO_QUERY); + sal_Int32 nNotation = ucb::FileSystemNotation::UNKNOWN_NOTATION; + if (xProperties.is()) + try + { + xProperties->getPropertyValue(rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "FileSystemNotation"))) + >>= nNotation; + } + catch (beans::UnknownPropertyException const &) {} + catch (lang::WrappedTargetException const &) {} + + // The following code depends on the fact that the + // com::sun::star::ucb::FileSystemNotation constants range from UNKNOWN to + // MAC, without any holes. The table below has two entries per notation, + // the first is used if bAddConvenienceStyles == false, while the second + // is used if bAddConvenienceStyles == true: + static INetURLObject::FSysStyle const aMap[][2] + = { { INetURLObject::FSysStyle(0), + INetURLObject::FSYS_DETECT }, + // UNKNOWN + { INetURLObject::FSYS_UNX, + INetURLObject::FSysStyle(INetURLObject::FSYS_VOS + | INetURLObject::FSYS_UNX) }, + // UNIX + { INetURLObject::FSYS_DOS, + INetURLObject::FSysStyle(INetURLObject::FSYS_VOS + | INetURLObject::FSYS_UNX + | INetURLObject::FSYS_DOS) }, + // DOS + { INetURLObject::FSYS_MAC, + INetURLObject::FSysStyle(INetURLObject::FSYS_VOS + | INetURLObject::FSYS_UNX + | INetURLObject::FSYS_MAC) } }; + return aMap[nNotation < ucb::FileSystemNotation::UNKNOWN_NOTATION + || nNotation > ucb::FileSystemNotation::MAC_NOTATION ? + 0 : + nNotation + - ucb::FileSystemNotation::UNKNOWN_NOTATION] + [bAddConvenienceStyles]; +} diff --git a/svl/source/notify/brdcst.cxx b/svl/source/notify/brdcst.cxx new file mode 100644 index 000000000000..3a698c725c5c --- /dev/null +++ b/svl/source/notify/brdcst.cxx @@ -0,0 +1,212 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: brdcst.cxx,v $ + * $Revision: 1.8.60.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#ifndef GCC +#endif +#include + +#include +#include +#include + +SV_DECL_PTRARR( SfxListenerArr_Impl, SfxListener*, 0, 2 ) + +#define _SFX_BRDCST_CXX +#include + +//==================================================================== +DBG_NAME(SfxBroadcaster) +TYPEINIT0(SfxBroadcaster); + +//==================================================================== + +//==================================================================== +// broadcast immediately + + +void SfxBroadcaster::Broadcast( const SfxHint &rHint ) +{ + DBG_CHKTHIS(SfxBroadcaster, 0); + + // is anybody to notify? + if ( aListeners.Count() /*! || aGlobListeners.Count() */ ) + { + // notify all registered listeners exactly once + for ( USHORT n = 0; n < aListeners.Count(); ++n ) + { + SfxListener* pListener = aListeners[n]; + if ( pListener ) + pListener->Notify( *this, rHint ); + } + } +} + +//-------------------------------------------------------------------- + +// broadcast after a timeout + + +void SfxBroadcaster::BroadcastDelayed( const SfxHint& rHint ) +{ + DBG_WARNING( "not implemented" ); + Broadcast(rHint); +} +//-------------------------------------------------------------------- + +// broadcast in idle-handler + +void SfxBroadcaster::BroadcastInIdle( const SfxHint& rHint ) +{ + DBG_WARNING( "not implemented" ); + Broadcast(rHint); +} +//-------------------------------------------------------------------- + +// unregister all listeners + +SfxBroadcaster::~SfxBroadcaster() +{ + DBG_DTOR(SfxBroadcaster, 0); + + Broadcast( SfxSimpleHint(SFX_HINT_DYING) ); + + // remove all still registered listeners + for ( USHORT nPos = 0; nPos < aListeners.Count(); ++nPos ) + { + SfxListener *pListener = aListeners[nPos]; + if ( pListener ) + pListener->RemoveBroadcaster_Impl(*this); + } +} + +//-------------------------------------------------------------------- + +// simple ctor of class SfxBroadcaster + +SfxBroadcaster::SfxBroadcaster() +{ + DBG_CTOR(SfxBroadcaster, 0); +} + +//-------------------------------------------------------------------- + +// copy ctor of class SfxBroadcaster + + +SfxBroadcaster::SfxBroadcaster( const SfxBroadcaster &rBC ) +{ + DBG_CTOR(SfxBroadcaster, 0); + + for ( USHORT n = 0; n < rBC.aListeners.Count(); ++n ) + { + SfxListener *pListener = rBC.aListeners[n]; + if ( pListener ) + pListener->StartListening( *this ); + } +} + +//-------------------------------------------------------------------- + +// add a new SfxListener to the list + +BOOL SfxBroadcaster::AddListener( SfxListener& rListener ) +{ + DBG_CHKTHIS(SfxBroadcaster, 0); + const SfxListener *pListener = &rListener; + const SfxListener *pNull = 0; + USHORT nFreePos = aListeners.GetPos( pNull ); + if ( nFreePos < aListeners.Count() ) + aListeners.GetData()[nFreePos] = pListener; + else if ( aListeners.Count() < (USHRT_MAX-1) ) + aListeners.Insert( pListener, aListeners.Count() ); + else + { + DBG_ERROR( "array overflow" ); + return FALSE; + } + + DBG_ASSERT( USHRT_MAX != aListeners.GetPos(pListener), + "AddListener failed" ); + return TRUE; +} + +//-------------------------------------------------------------------- + +// called, if no more listeners exists + +void SfxBroadcaster::ListenersGone() +{ + DBG_CHKTHIS(SfxBroadcaster,0); +} + +//-------------------------------------------------------------------- + +// forward a notification to all registered listeners + +void SfxBroadcaster::Forward(SfxBroadcaster& rBC, const SfxHint& rHint) +{ + const USHORT nCount = aListeners.Count(); + for ( USHORT i = 0; i < nCount; ++i ) + { + SfxListener *pListener = aListeners[i]; + if ( pListener ) + pListener->Notify( rBC, rHint ); + } +} + +//-------------------------------------------------------------------- + +// remove one SfxListener from the list + +void SfxBroadcaster::RemoveListener( SfxListener& rListener ) +{ + {DBG_CHKTHIS(SfxBroadcaster, 0);} + const SfxListener *pListener = &rListener; + USHORT nPos = aListeners.GetPos(pListener); + DBG_ASSERT( nPos != USHRT_MAX, "RemoveListener: Listener unknown" ); + aListeners.GetData()[nPos] = 0; + if ( !HasListeners() ) + ListenersGone(); +} + +//-------------------------------------------------------------------- + +BOOL SfxBroadcaster::HasListeners() const +{ + for ( USHORT n = 0; n < aListeners.Count(); ++n ) + if ( aListeners.GetObject(n) != 0 ) + return TRUE; + return FALSE; +} + +//-------------------------------------------------------------------- diff --git a/svl/source/notify/broadcast.cxx b/svl/source/notify/broadcast.cxx new file mode 100644 index 000000000000..e363f545c719 --- /dev/null +++ b/svl/source/notify/broadcast.cxx @@ -0,0 +1,151 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: broadcast.cxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#ifndef GCC +#endif +#include + +#include "listener.hxx" +#include "listeneriter.hxx" +#include "broadcast.hxx" +#include + + +//==================================================================== +TYPEINIT0(SvtBroadcaster); + +//==================================================================== + +// simple ctor of class SvtBroadcaster + +SvtBroadcaster::SvtBroadcaster() + : pRoot( 0 ) +{ +} + +//-------------------------------------------------------------------- + +// copy ctor of class SvtBroadcaster + +SvtBroadcaster::SvtBroadcaster( const SvtBroadcaster &rBC ) + : pRoot( 0 ) +{ + SvtListenerIter aIter( (SvtBroadcaster&)rBC ); + SvtListener* pLast = aIter.GoStart(); + if( pLast ) + do { + pLast->StartListening( *this ); + } while( 0 != ( pLast = aIter.GoNext() )); +} + +//-------------------------------------------------------------------- + +// unregister all listeners + +SvtBroadcaster::~SvtBroadcaster() +{ + Broadcast( SfxSimpleHint(SFX_HINT_DYING) ); + + SvtListenerIter aIter( *this ); + SvtListener* pLast = aIter.GoStart(); + if( pLast ) + do { + pLast->EndListening( *this ); + if( !HasListeners() ) // all gone ?? + break; + } while( 0 != ( pLast = aIter.GoNext() )); +} + +//-------------------------------------------------------------------- + +// broadcast immedeately + +void SvtBroadcaster::Broadcast( const SfxHint &rHint ) +{ + // is anybody to notify? + if( HasListeners() /* && !IsModifyLocked()*/ ) + { +// LockModify(); +// bInModify = TRUE; + + SvtListenerIter aIter( *this ); + SvtListener* pLast = aIter.GoStart(); + if( pLast ) + do { + pLast->Notify( *this, rHint ); + if( !HasListeners() ) // all gone ?? + break; + } while( 0 != ( pLast = aIter.GoNext() )); + +// bInModify = FALSE; +// UnlockModify(); + } +} + +//-------------------------------------------------------------------- + + +// called, if no more listeners exists + +void SvtBroadcaster::ListenersGone() +{ +} + +//-------------------------------------------------------------------- + +// forward a notification to all registered listeners + +void SvtBroadcaster::Forward( SvtBroadcaster& rBC, const SfxHint& rHint ) +{ + // is anybody to notify? + if( rBC.HasListeners() /* && !IsModifyLocked()*/ ) + { +// LockModify(); +// bInModify = TRUE; + + SvtListenerIter aIter( rBC ); + SvtListener* pLast = aIter.GoStart(); + if( pLast ) + do { + pLast->Notify( rBC, rHint ); + if( !rBC.HasListeners() ) // all gone ?? + break; + } while( 0 != ( pLast = aIter.GoNext() )); + +// bInModify = FALSE; +// UnlockModify(); + } +} + + + diff --git a/svl/source/notify/cancel.cxx b/svl/source/notify/cancel.cxx new file mode 100644 index 000000000000..32a76a7df9c1 --- /dev/null +++ b/svl/source/notify/cancel.cxx @@ -0,0 +1,204 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: cancel.cxx,v $ + * $Revision: 1.9 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#define _SFX_CANCEL_CXX +#include + +#include +#include + +#include +#include +#include + +namespace { struct lclMutex : public rtl::Static< ::vos::OMutex, lclMutex >{}; } + +//========================================================================= + +SfxCancelManager::SfxCancelManager( SfxCancelManager *pParent ) +: _pParent( pParent ) +{ +} + +//------------------------------------------------------------------------- + +SfxCancelManager::~SfxCancelManager() +{ + DBG_ASSERT( _pParent || !_aJobs.Count(), "deleting SfxCancelManager in use" ); + for ( USHORT n = _aJobs.Count(); n--; ) + _aJobs.GetObject(n)->SetManager( _pParent ); +} + +//------------------------------------------------------------------------- + +BOOL SfxCancelManager::CanCancel() const + +/* [Beschreibung] + + Liefert TRUE wenn an diesem CancelManager oder an einem Parent + ein Job l"auft. +*/ + +{ + ::vos::OGuard aGuard( lclMutex::get() ); + return _aJobs.Count() > 0 || ( _pParent && _pParent->CanCancel() ); +} + +//------------------------------------------------------------------------- + +void SfxCancelManager::Cancel( BOOL bDeep ) + +/* [Beschreibung] + + Diese Methode markiert alle angemeldeten -Instanzen + als suspendiert. +*/ + +{ + ::vos::OGuard aGuard( lclMutex::get() ); + SfxCancelManagerWeak xWeak( this ); + for ( USHORT n = _aJobs.Count(); n-- && xWeak.Is(); ) + if ( n < _aJobs.Count() ) + _aJobs.GetObject(n)->Cancel(); + if ( xWeak.Is() && _pParent ) + _pParent->Cancel( bDeep ); +} + +//------------------------------------------------------------------------- + +void SfxCancelManager::InsertCancellable( SfxCancellable *pJob ) + +/* [Beschreibung] + + Diese interne Methode tr"agt 'pJob' in die Liste der unterbrechbaren + Jobs ein und Broadcastet dies. Jeder darf nur + maximal einmal angemeldet sein, dies geschiet in seinem Ctor. +*/ + +{ +#ifdef GPF_ON_EMPTY_TITLE + if ( !pJob->GetTitle() ) + { + DBG_ERROR( "SfxCancellable: empty titles not allowed (Vermummungsverbot)" ) + *(int*)0 = 0; + } +#endif + + ::vos::OClearableGuard aGuard( lclMutex::get() ); + _aJobs.C40_INSERT( SfxCancellable, pJob, _aJobs.Count() ); + + aGuard.clear(); + Broadcast( SfxSimpleHint( SFX_HINT_CANCELLABLE ) ); +} + +//------------------------------------------------------------------------- + + +void SfxCancelManager::RemoveCancellable( SfxCancellable *pJob ) + +/* [Beschreibung] + + Diese interne Methode tr"agt 'pJob' aus die Liste der unterbrechbaren + Jobs aus und Broadcastet dies. Dieser Aufruf mu\s paarig nach einem + erfolgen und wird im Dtor des + ausgel"ost. +*/ + +{ + ::vos::OClearableGuard aGuard( lclMutex::get() ); + const SfxCancellable *pTmp = pJob; + USHORT nPos = _aJobs.GetPos( pTmp ); + if ( nPos != 0xFFFF ) + { + _aJobs.Remove( nPos , 1 ); + aGuard.clear(); + Broadcast( SfxSimpleHint( SFX_HINT_CANCELLABLE ) ); + Broadcast( SfxCancelHint( pJob, SFXCANCELHINT_REMOVED ) ); + } +} + +//------------------------------------------------------------------------- + +SfxCancellable::~SfxCancellable() +{ + SfxCancelManager* pMgr = _pMgr; + if ( pMgr ) + pMgr->RemoveCancellable( this ); +} + +//------------------------------------------------------------------------- + +void SfxCancellable::Cancel() + +/* [Description] + + This virtual function is called when the user hits the cancel-button. + If you overload it, you can stop your activities. Please always call + 'SfxCancellable::Cancel()'. +*/ + +{ +#ifdef GFP_ON_NO_CANCEL + if ( _bCancelled < 5 ) + ++_bCancelled; + else + { + delete this; + } +#else + _bCancelled = TRUE; +#endif +} + +//------------------------------------------------------------------------- + +void SfxCancellable::SetManager( SfxCancelManager *pMgr ) +{ + SfxCancelManager* pTmp = _pMgr; + if ( pTmp ) + pTmp->RemoveCancellable( this ); + _pMgr = pMgr; + if ( pMgr ) + pMgr->InsertCancellable( this ); +} + +//------------------------------------------------------------------------- + +TYPEINIT1(SfxCancelHint, SfxHint); + +SfxCancelHint::SfxCancelHint( SfxCancellable* pJob, USHORT _nAction ) +{ + pCancellable = pJob; + nAction = _nAction; +} + + diff --git a/svl/source/notify/hint.cxx b/svl/source/notify/hint.cxx new file mode 100644 index 000000000000..9ae3bf8f8b21 --- /dev/null +++ b/svl/source/notify/hint.cxx @@ -0,0 +1,50 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: hint.cxx,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#ifndef GCC +#endif + +#include + +//==================================================================== + +TYPEINIT0(SfxHint); + +//==================================================================== +// virtual dtor for the typical base-class Hint + +SfxHint::~SfxHint() +{ +} + + + diff --git a/svl/source/notify/isethint.cxx b/svl/source/notify/isethint.cxx new file mode 100644 index 000000000000..67d484219ac6 --- /dev/null +++ b/svl/source/notify/isethint.cxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: isethint.cxx,v $ + * $Revision: 1.9 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#ifndef GCC +#endif + +#include +#include + +//==================================================================== + +TYPEINIT1(SfxItemSetHint, SfxHint); + +//==================================================================== + +SfxItemSetHint::SfxItemSetHint( SfxItemSet *pItemSet ) + +/* [Beschreibung] + + Dieser Ctor "ubernimmt das als Parameter "ubergeben , + das im Dtor gel"oscht wird. +*/ + +: _pItemSet( pItemSet ) +{ +} + +//-------------------------------------------------------------------- + +SfxItemSetHint::SfxItemSetHint( const SfxItemSet &rItemSet ) + +/* [Beschreibung] + + Dieser Ctor kopiert das als Parameter "ubergeben . +*/ + +: _pItemSet( rItemSet.Clone() ) +{ +} + +//-------------------------------------------------------------------- + +SfxItemSetHint::~SfxItemSetHint() +{ + delete _pItemSet; +} + +//-------------------------------------------------------------------- diff --git a/svl/source/notify/listener.cxx b/svl/source/notify/listener.cxx new file mode 100644 index 000000000000..0ce072b44dfb --- /dev/null +++ b/svl/source/notify/listener.cxx @@ -0,0 +1,169 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: listener.cxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#ifndef GCC +#endif + +#ifndef DEBUG_HXX +#include +#endif + +#include "broadcast.hxx" +#include "listener.hxx" +#include "listenerbase.hxx" +#include "listeneriter.hxx" + + +//==================================================================== +TYPEINIT0(SvtListener); + +//==================================================================== +// simple ctor of class SvtListener + +SvtListener::SvtListener() + : pBrdCastLst( 0 ) +{ +} +//-------------------------------------------------------------------- + +// copy ctor of class SvtListener + +SvtListener::SvtListener( const SvtListener &rListener ) + : pBrdCastLst( 0 ) +{ + SvtListenerBase* pLst = rListener.pBrdCastLst; + while( pLst ) + { + new SvtListenerBase( *this, *pLst->GetBroadcaster() ); + pLst = pLst->GetNext(); + } +} +//-------------------------------------------------------------------- + +// unregisteres the SvtListener from its SvtBroadcasters + +SvtListener::~SvtListener() +{ + EndListeningAll(); +} + +//-------------------------------------------------------------------- + +// registeres at a specific SvtBroadcaster + +BOOL SvtListener::StartListening( SvtBroadcaster& rBroadcaster ) +{ + const SvtListenerBase* pLst = pBrdCastLst; + while( pLst ) + { + if( &rBroadcaster == pLst->GetBroadcaster() ) + { + // double, than return + return FALSE; + } + pLst = pLst->GetNext(); + } + new SvtListenerBase( *this, rBroadcaster ); + return TRUE; +} + +//-------------------------------------------------------------------- + +// unregisteres at a specific SvtBroadcaster + +BOOL SvtListener::EndListening( SvtBroadcaster& rBroadcaster ) +{ + SvtListenerBase *pLst = pBrdCastLst, *pPrev = pLst; + while( pLst ) + { + if( &rBroadcaster == pLst->GetBroadcaster() ) + { + if( pBrdCastLst == pLst ) + pBrdCastLst = pLst->GetNext(); + else + pPrev->SetNext( pLst->GetNext() ); + + delete pLst; + return TRUE; + } + pPrev = pLst; + pLst = pLst->GetNext(); + } + return FALSE; +} + +//-------------------------------------------------------------------- + +// unregisteres all Broadcasters + +void SvtListener::EndListeningAll() +{ + SvtListenerBase *pLst = pBrdCastLst; + while( pLst ) + { + SvtListenerBase *pDel = pLst; + pLst = pLst->GetNext(); + + delete pDel; + } + pBrdCastLst = 0; +} + +//-------------------------------------------------------------------- + +BOOL SvtListener::IsListening( SvtBroadcaster& rBroadcaster ) const +{ + const SvtListenerBase *pLst = pBrdCastLst; + while( pLst ) + { + if( &rBroadcaster == pLst->GetBroadcaster() ) + break; + pLst = pLst->GetNext(); + } + return 0 != pLst; +} + +//-------------------------------------------------------------------- + +// base implementation of notification handler + +void SvtListener::Notify( SvtBroadcaster& +#ifdef DBG_UTIL +rBC +#endif +, const SfxHint& ) +{ + DBG_ASSERT( IsListening( rBC ), + "notification from unregistered broadcaster" ); +} + + diff --git a/svl/source/notify/listenerbase.cxx b/svl/source/notify/listenerbase.cxx new file mode 100644 index 000000000000..25f1f1da1901 --- /dev/null +++ b/svl/source/notify/listenerbase.cxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: listenerbase.cxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#ifndef GCC +#endif + +#ifndef DEBUG_HXX +#include +#endif + +#include "listenerbase.hxx" +#include "listeneriter.hxx" +#include "listener.hxx" +#include "broadcast.hxx" + + +SvtListenerBase::SvtListenerBase( SvtListener& rLst, + SvtBroadcaster& rBroadcaster ) + : pLeft( 0 ), pRight( 0 ), + pBroadcaster( &rBroadcaster ), pListener( &rLst ) +{ + pNext = rLst.pBrdCastLst; + rLst.pBrdCastLst = this; + + if( pBroadcaster->pRoot ) + { + // set ever behind the root + pRight = pBroadcaster->pRoot->pRight; + pBroadcaster->pRoot->pRight = this; + this->pLeft = pBroadcaster->pRoot; + if( pRight ) + pRight->pLeft = this; + } + else + pBroadcaster->pRoot = this; +} + +SvtListenerBase::~SvtListenerBase() +{ + SvtListenerBase *pR = pRight, *pL = pLeft; + if( pBroadcaster->pRoot ) + pBroadcaster->pRoot = pL ? pL : pR; + + if( pL ) + pL->pRight = pR; + if( pR ) + pR->pLeft = pL; + + SvtListenerIter::RemoveListener( *this, pR ); + + if( !pBroadcaster->pRoot ) + pBroadcaster->ListenersGone(); +} + + diff --git a/svl/source/notify/listenerbase.hxx b/svl/source/notify/listenerbase.hxx new file mode 100644 index 000000000000..e73f9dfc37c5 --- /dev/null +++ b/svl/source/notify/listenerbase.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: listenerbase.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVT_LISTENERBASE_HXX +#define _SVT_LISTENERBASE_HXX + +class SvtBroadcaster; +class SvtListener; + +class SvtListenerBase +{ + SvtListenerBase *pNext; + SvtListenerBase *pLeft, *pRight; + SvtBroadcaster *pBroadcaster; + SvtListener *pListener; + +public: + + SvtListenerBase( SvtListener& rLst, SvtBroadcaster& rBroadcaster ); + ~SvtListenerBase(); + + SvtListenerBase* GetNext() const { return pNext; } + void SetNext( SvtListenerBase* p ) { pNext = p; } + + SvtBroadcaster* GetBroadcaster() const { return pBroadcaster; } + SvtListener* GetListener() const { return pListener; } + + SvtListenerBase* GetLeft() const { return pLeft; } + SvtListenerBase* GetRight() const { return pRight; } +}; + + +#endif + diff --git a/svl/source/notify/listeneriter.cxx b/svl/source/notify/listeneriter.cxx new file mode 100644 index 000000000000..08fcb5b7e9ac --- /dev/null +++ b/svl/source/notify/listeneriter.cxx @@ -0,0 +1,195 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: listeneriter.cxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#ifndef GCC +#endif +#include + +#include "listenerbase.hxx" +#include "listeneriter.hxx" +#include "broadcast.hxx" +#include "listener.hxx" + +SvtListenerIter* SvtListenerIter::pListenerIters = 0; + +SvtListenerIter::SvtListenerIter( SvtBroadcaster& rBrdcst ) + : rRoot( rBrdcst ) +{ + // hinten einketten! + pNxtIter = 0; + if( pListenerIters ) + { + SvtListenerIter* pTmp = pListenerIters; + while( pTmp->pNxtIter ) + pTmp = pTmp->pNxtIter; + pTmp->pNxtIter = this; + } + else + pListenerIters = this; + + pAkt = rRoot.pRoot; + pDelNext = pAkt; +} + + + +SvtListenerIter::~SvtListenerIter() +{ + if( pListenerIters ) + { + if( pListenerIters == this ) + pListenerIters = pNxtIter; + else + { + SvtListenerIter* pTmp = pListenerIters; + while( pTmp->pNxtIter != this ) + if( 0 == ( pTmp = pTmp->pNxtIter ) ) + return ; + pTmp->pNxtIter = pNxtIter; + } + } +} + +void SvtListenerIter::RemoveListener( SvtListenerBase& rDel, + SvtListenerBase* pNext ) +{ + // Update the ListenerIter + SvtListenerIter* pTmp = pListenerIters; + while( pTmp ) + { + if( pTmp->pAkt == &rDel || pTmp->pDelNext == &rDel ) + pTmp->pDelNext = pNext; + pTmp = pTmp->pNxtIter; + } +} + +SvtListener* SvtListenerIter::GoNext() +{ + if( pDelNext == pAkt ) + { + pAkt = pAkt->GetRight(); + pDelNext = pAkt; + } + else + pAkt = pDelNext; + return pAkt ? pAkt->GetListener() : 0; +} + + +SvtListener* SvtListenerIter::GoPrev() +{ + if( pDelNext == pAkt ) + pAkt = pAkt->GetLeft(); + else + pAkt = pDelNext->GetLeft(); + pDelNext = pAkt; + return pAkt ? pAkt->GetListener() : 0; +} + + +SvtListener* SvtListenerIter::GoStart() // zum Anfang des Baums +{ + pAkt = rRoot.pRoot; + if( pAkt ) + while( pAkt->GetLeft() ) + pAkt = pAkt->GetLeft(); + pDelNext = pAkt; + return pAkt ? pAkt->GetListener() : 0; +} + + +SvtListener* SvtListenerIter::GoEnd() // zum End des Baums +{ + pAkt = pDelNext; + if( !pAkt ) + pAkt = rRoot.pRoot; + if( pAkt ) + while( pAkt->GetRight() ) + pAkt = pAkt->GetRight(); + pDelNext = pAkt; + return pAkt ? pAkt->GetListener() : 0; +} + + + +SvtListener* SvtListenerIter::First( TypeId nType ) +{ + aSrchId = nType; + GoStart(); + if( pAkt ) + do { + if( pAkt->GetListener()->IsA( aSrchId ) ) + break; + + if( pDelNext == pAkt ) + { + pAkt = pAkt->GetRight(); + pDelNext = pAkt; + } + else + pAkt = pDelNext; + + } while( pAkt ); + return pAkt ? pAkt->GetListener() : 0; +} + + +SvtListener* SvtListenerIter::Next() +{ + do { + // erstmal zum naechsten + if( pDelNext == pAkt ) + { + pAkt = pAkt->GetRight(); + pDelNext = pAkt; + } + else + pAkt = pDelNext; + + if( pAkt && pAkt->GetListener()->IsA( aSrchId ) ) + break; + } while( pAkt ); + return pAkt ? pAkt->GetListener() : 0; +} + + +SvtListener* SvtListenerIter::GoRoot() // wieder ab Root anfangen +{ + pDelNext = pAkt = rRoot.pRoot; + return pAkt ? pAkt->GetListener() : 0; +} + +SvtListener* SvtListenerIter::GetCurr() const // returns the current +{ + return pDelNext ? pDelNext->GetListener() : 0; +} + diff --git a/svl/source/notify/lstner.cxx b/svl/source/notify/lstner.cxx new file mode 100644 index 000000000000..d7345d7ed3db --- /dev/null +++ b/svl/source/notify/lstner.cxx @@ -0,0 +1,196 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: lstner.cxx,v $ + * $Revision: 1.8.60.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#ifndef GCC +#endif + +#ifndef DEBUG_HXX +#include +#endif + +#include +#include + +SV_DECL_PTRARR( SfxBroadcasterArr_Impl, SfxBroadcaster*, 0, 2 ) + +#define _SFX_LSTNER_CXX +#include + +//==================================================================== +DBG_NAME(SfxListener) +TYPEINIT0(SfxListener); + +//==================================================================== +// simple ctor of class SfxListener + +SfxListener::SfxListener() +{ + DBG_CTOR(SfxListener, 0); +} +//-------------------------------------------------------------------- + +// copy ctor of class SfxListener + +SfxListener::SfxListener( const SfxListener &rListener ) +{ + DBG_CTOR(SfxListener, 0); + + for ( USHORT n = 0; n < rListener.aBCs.Count(); ++n ) + StartListening( *rListener.aBCs[n] ); +} +//-------------------------------------------------------------------- + +// unregisteres the SfxListener from its SfxBroadcasters + +SfxListener::~SfxListener() +{ + DBG_DTOR(SfxListener, 0); + + // unregister at all remainding broadcasters + for ( USHORT nPos = 0; nPos < aBCs.Count(); ++nPos ) + { + SfxBroadcaster *pBC = aBCs[nPos]; + pBC->RemoveListener(*this); + } +} + +//-------------------------------------------------------------------- + +// unregisteres at a specific SfxBroadcaster + +void SfxListener::RemoveBroadcaster_Impl( SfxBroadcaster& rBC ) +{ + DBG_CHKTHIS(SfxListener, 0); + + const SfxBroadcaster *pBC = &rBC; + aBCs.Remove( aBCs.GetPos(pBC), 1 ); +} + +//-------------------------------------------------------------------- + +// registeres at a specific SfxBroadcaster + +BOOL SfxListener::StartListening( SfxBroadcaster& rBroadcaster, BOOL bPreventDups ) +{ + DBG_CHKTHIS(SfxListener, 0); + + if ( !bPreventDups || !IsListening( rBroadcaster ) ) + { + if ( rBroadcaster.AddListener(*this) ) + { + const SfxBroadcaster *pBC = &rBroadcaster; + aBCs.Insert( pBC, aBCs.Count() ); + + DBG_ASSERT( IsListening(rBroadcaster), "StartListening failed" ); + return TRUE; + } + + } + return FALSE; +} + +//-------------------------------------------------------------------- + +// unregisteres at a specific SfxBroadcaster + +BOOL SfxListener::EndListening( SfxBroadcaster& rBroadcaster, BOOL bAllDups ) +{ + DBG_CHKTHIS(SfxListener, 0); + + if ( !IsListening( rBroadcaster ) ) + return FALSE; + + do + { + rBroadcaster.RemoveListener(*this); + const SfxBroadcaster *pBC = &rBroadcaster; + aBCs.Remove( aBCs.GetPos(pBC), 1 ); + } + while ( bAllDups && IsListening( rBroadcaster ) ); + return TRUE; +} + +//-------------------------------------------------------------------- + +// unregisteres at a specific SfxBroadcaster by index + +void SfxListener::EndListening( USHORT nNo ) +{ + DBG_CHKTHIS(SfxListener, 0); + + SfxBroadcaster *pBC = aBCs.GetObject(nNo); + pBC->RemoveListener(*this); + aBCs.Remove( nNo, 1 ); +} + +//-------------------------------------------------------------------- + +// unregisteres all Broadcasters + +void SfxListener::EndListeningAll() +{ + DBG_CHKTHIS(SfxListener, 0); + + // MI: bei Optimierung beachten: Seiteneffekte von RemoveListener beachten! + while ( aBCs.Count() ) + { + SfxBroadcaster *pBC = aBCs.GetObject(0); + pBC->RemoveListener(*this); + aBCs.Remove( 0, 1 ); + } +} + +//-------------------------------------------------------------------- + +BOOL SfxListener::IsListening( SfxBroadcaster& rBroadcaster ) const +{ + const SfxBroadcaster *pBC = &rBroadcaster; + return USHRT_MAX != aBCs.GetPos( pBC ); +} + +//-------------------------------------------------------------------- + +// base implementation of notification handler + +#ifdef DBG_UTIL +void SfxListener::Notify( SfxBroadcaster& rBC, const SfxHint& ) +#else +void SfxListener::Notify( SfxBroadcaster&, const SfxHint& ) +#endif +{ + #ifdef DBG_UTIL + const SfxBroadcaster *pBC = &rBC; + DBG_ASSERT( USHRT_MAX != aBCs.GetPos(pBC), + "notification from unregistered broadcaster" ); + #endif +} + diff --git a/svl/source/notify/makefile.mk b/svl/source/notify/makefile.mk new file mode 100644 index 000000000000..8e4c4b211258 --- /dev/null +++ b/svl/source/notify/makefile.mk @@ -0,0 +1,67 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.6 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=svtools +TARGET=notify + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/svl.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/smplhint.obj \ + $(SLO)$/hint.obj \ + $(SLO)$/lstner.obj \ + $(SLO)$/isethint.obj \ + $(SLO)$/cancel.obj \ + $(SLO)$/brdcst.obj \ + $(SLO)$/listener.obj \ + $(SLO)$/listenerbase.obj \ + $(SLO)$/listeneriter.obj \ + $(SLO)$/broadcast.obj + +HXX1TARGET= notify +HXX1EXT= hxx +HXX1FILES= $(INC)$/hint.hxx \ + $(INC)$/smplhint.hxx \ + $(INC)$/lstner.hxx \ + $(INC)$/brdcst.hxx +HXX1EXCL= -E:*include* + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/svl/source/notify/smplhint.cxx b/svl/source/notify/smplhint.cxx new file mode 100644 index 000000000000..6fddffc23e56 --- /dev/null +++ b/svl/source/notify/smplhint.cxx @@ -0,0 +1,50 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: smplhint.cxx,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#ifndef GCC +#endif + +#include + +//==================================================================== + +TYPEINIT1(SfxSimpleHint, SfxHint); + +//==================================================================== +// creates a SimpleHint with the type nId + +SfxSimpleHint::SfxSimpleHint( ULONG nIdP ) +{ + nId = nIdP; +} + + diff --git a/svl/source/numbers/makefile.mk b/svl/source/numbers/makefile.mk new file mode 100644 index 000000000000..46cd3985df1a --- /dev/null +++ b/svl/source/numbers/makefile.mk @@ -0,0 +1,78 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.12.148.1 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=svtools +TARGET=numbers +LIBTARGET=NO + +PROJECTPCH= +PROJECTPCHSOURCE= + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/svt.pmk + +# --- Files -------------------------------------------------------- + +EXCEPTIONSFILES= \ + $(SLO)$/numuno.obj \ + $(SLO)$/numfmuno.obj \ + $(SLO)$/supservs.obj \ + $(SLO)$/zforlist.obj + +SLOFILES = \ + $(EXCEPTIONSFILES) \ + $(SLO)$/zforfind.obj \ + $(SLO)$/zformat.obj \ + $(SLO)$/zforscan.obj \ + $(SLO)$/numhead.obj + +LIB1TARGET= $(SLB)$/$(TARGET).uno.lib +LIB1OBJFILES= \ + $(SLO)$/numfmuno.obj \ + $(SLO)$/supservs.obj + +LIB2TARGET= $(SLB)$/$(TARGET).lib +LIB2OBJFILES= \ + $(SLO)$/zforfind.obj \ + $(SLO)$/zforlist.obj \ + $(SLO)$/zformat.obj \ + $(SLO)$/zforscan.obj \ + $(SLO)$/numuno.obj \ + $(SLO)$/numhead.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/svl/source/numbers/nbdll.cxx b/svl/source/numbers/nbdll.cxx new file mode 100644 index 000000000000..d7cf20f6059f --- /dev/null +++ b/svl/source/numbers/nbdll.cxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: nbdll.cxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#ifdef WIN +#include + +#ifndef _SYSDEP_HXX +#include +#endif + +// Statische DLL-Verwaltungs-Variablen +static HINSTANCE hDLLInst = 0; // HANDLE der DLL + + +/*************************************************************************** +|* +|* LibMain() +|* +|* Beschreibung Initialisierungsfunktion der DLL +|* Ersterstellung TH 05.05.93 +|* Letzte Aenderung TH 05.05.93 +|* +***************************************************************************/ + +extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) +{ +#ifndef WNT + if ( nHeap ) + UnlockData( 0 ); +#endif + + hDLLInst = hDLL; + + return TRUE; +} + +/*************************************************************************** +|* +|* WEP() +|* +|* Beschreibung DLL-Deinitialisierung +|* Ersterstellung TH 05.05.93 +|* Letzte Aenderung TH 05.05.93 +|* +***************************************************************************/ + +extern "C" int CALLBACK WEP( int ) +{ + return 1; +} + +#endif diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx new file mode 100644 index 000000000000..d65a2fd696ce --- /dev/null +++ b/svl/source/numbers/numfmuno.cxx @@ -0,0 +1,1144 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: numfmuno.cxx,v $ + * $Revision: 1.15 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#ifndef GCC +#endif + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "numfmuno.hxx" +#include "numuno.hxx" +#include +#include +#include + +using namespace com::sun::star; + +//------------------------------------------------------------------------ + +#define SERVICENAME_NUMBERFORMATTER "com.sun.star.util.NumberFormatter" +#define SERVICENAME_NUMBERSETTINGS "com.sun.star.util.NumberFormatSettings" +#define SERVICENAME_NUMBERFORMATS "com.sun.star.util.NumberFormats" +#define SERVICENAME_NUMBERFORMAT "com.sun.star.util.NumberFormatProperties" + +//------------------------------------------------------------------------ + +#define PROPERTYNAME_FMTSTR "FormatString" +#define PROPERTYNAME_LOCALE "Locale" +#define PROPERTYNAME_TYPE "Type" +#define PROPERTYNAME_COMMENT "Comment" +#define PROPERTYNAME_CURREXT "CurrencyExtension" +#define PROPERTYNAME_CURRSYM "CurrencySymbol" +#define PROPERTYNAME_CURRABB "CurrencyAbbreviation" +#define PROPERTYNAME_DECIMALS "Decimals" +#define PROPERTYNAME_LEADING "LeadingZeros" +#define PROPERTYNAME_NEGRED "NegativeRed" +#define PROPERTYNAME_STDFORM "StandardFormat" +#define PROPERTYNAME_THOUS "ThousandsSeparator" +#define PROPERTYNAME_USERDEF "UserDefined" + +#define PROPERTYNAME_NOZERO "NoZero" +#define PROPERTYNAME_NULLDATE "NullDate" +#define PROPERTYNAME_STDDEC "StandardDecimals" +#define PROPERTYNAME_TWODIGIT "TwoDigitDateStart" + +//------------------------------------------------------------------------ + +// alles ohne Which-ID, Map nur fuer PropertySetInfo + +const SfxItemPropertyMapEntry* lcl_GetNumberFormatPropertyMap() +{ + static SfxItemPropertyMapEntry aNumberFormatPropertyMap_Impl[] = + { + {MAP_CHAR_LEN(PROPERTYNAME_FMTSTR), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, + {MAP_CHAR_LEN(PROPERTYNAME_LOCALE), 0, &getCppuType((lang::Locale*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, + {MAP_CHAR_LEN(PROPERTYNAME_TYPE), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, + {MAP_CHAR_LEN(PROPERTYNAME_COMMENT), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, + {MAP_CHAR_LEN(PROPERTYNAME_CURREXT), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, + {MAP_CHAR_LEN(PROPERTYNAME_CURRSYM), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, + {MAP_CHAR_LEN(PROPERTYNAME_DECIMALS), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, + {MAP_CHAR_LEN(PROPERTYNAME_LEADING), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, + {MAP_CHAR_LEN(PROPERTYNAME_NEGRED), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, + {MAP_CHAR_LEN(PROPERTYNAME_STDFORM), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, + {MAP_CHAR_LEN(PROPERTYNAME_THOUS), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, + {MAP_CHAR_LEN(PROPERTYNAME_USERDEF), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, + {MAP_CHAR_LEN(PROPERTYNAME_CURRABB), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, + {0,0,0,0,0,0} + }; + return aNumberFormatPropertyMap_Impl; +} + +const SfxItemPropertyMapEntry* lcl_GetNumberSettingsPropertyMap() +{ + static SfxItemPropertyMapEntry aNumberSettingsPropertyMap_Impl[] = + { + {MAP_CHAR_LEN(PROPERTYNAME_NOZERO), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND, 0}, + {MAP_CHAR_LEN(PROPERTYNAME_NULLDATE), 0, &getCppuType((util::Date*)0), beans::PropertyAttribute::BOUND, 0}, + {MAP_CHAR_LEN(PROPERTYNAME_STDDEC), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND, 0}, + {MAP_CHAR_LEN(PROPERTYNAME_TWODIGIT), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND, 0}, + {0,0,0,0,0,0} + }; + return aNumberSettingsPropertyMap_Impl; +} + +//---------------------------------------------------------------------------------------- + +LanguageType lcl_GetLanguage( const lang::Locale& rLocale ) +{ + // empty language -> LANGUAGE_SYSTEM + if ( rLocale.Language.getLength() == 0 ) + return LANGUAGE_SYSTEM; + + LanguageType eRet = MsLangId::convertLocaleToLanguage( rLocale ); + if ( eRet == LANGUAGE_NONE ) + eRet = LANGUAGE_SYSTEM; //! or throw an exception? + + return eRet; +} + +//---------------------------------------------------------------------------------------- + +SvNumberFormatterServiceObj::SvNumberFormatterServiceObj() + :m_aMutex() +{ +} + +SvNumberFormatterServiceObj::~SvNumberFormatterServiceObj() +{ +} + +com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvNumberFormatterServiceObj_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ) +{ + return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new SvNumberFormatterServiceObj ); +} + +// XNumberFormatter + +void SAL_CALL SvNumberFormatterServiceObj::attachNumberFormatsSupplier( + const uno::Reference& _xSupplier ) + throw(uno::RuntimeException) +{ + ::rtl::Reference< SvNumberFormatsSupplierObj > xAutoReleaseOld; + + // SYNCHRONIZED -> + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + + SvNumberFormatsSupplierObj* pNew = SvNumberFormatsSupplierObj::getImplementation( _xSupplier ); + if (!pNew) + throw uno::RuntimeException(); // wrong object + + xAutoReleaseOld = xSupplier; + + xSupplier = pNew; + m_aMutex = xSupplier->getSharedMutex(); + } + // <- SYNCHRONIZED +} + +uno::Reference SAL_CALL + SvNumberFormatterServiceObj::getNumberFormatsSupplier() + throw(uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + return xSupplier.get(); +} + +sal_Int32 SAL_CALL SvNumberFormatterServiceObj::detectNumberFormat( + sal_Int32 nKey, const rtl::OUString& aString ) + throw(util::NotNumericException, uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + INT32 nRet = 0; + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; + if (pFormatter) + { + String aTemp = aString; + sal_uInt32 nUKey = nKey; + double fValue = 0.0; + if ( pFormatter->IsNumberFormat(aTemp, nUKey, fValue) ) + nRet = nUKey; + else + throw util::NotNumericException(); + } + else + throw uno::RuntimeException(); + + return nRet; +} + +double SAL_CALL SvNumberFormatterServiceObj::convertStringToNumber( + sal_Int32 nKey, const rtl::OUString& aString ) + throw(util::NotNumericException, uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + double fRet = 0.0; + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; + if (pFormatter) + { + String aTemp = aString; + sal_uInt32 nUKey = nKey; + double fValue = 0.0; + if ( pFormatter->IsNumberFormat(aTemp, nUKey, fValue) ) + fRet = fValue; + else + throw util::NotNumericException(); + } + else + throw uno::RuntimeException(); + + return fRet; +} + +rtl::OUString SAL_CALL SvNumberFormatterServiceObj::convertNumberToString( + sal_Int32 nKey, double fValue ) throw(uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + String aRet; + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; + if (pFormatter) + { + Color* pColor = NULL; + pFormatter->GetOutputString(fValue, nKey, aRet, &pColor); + } + else + throw uno::RuntimeException(); + + return aRet; +} + +util::Color SAL_CALL SvNumberFormatterServiceObj::queryColorForNumber( sal_Int32 nKey, + double fValue, util::Color aDefaultColor ) + throw(uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + util::Color nRet = aDefaultColor; // color = INT32 + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; + if (pFormatter) + { + String aStr; + Color* pColor = NULL; + pFormatter->GetOutputString(fValue, nKey, aStr, &pColor); + if (pColor) + nRet = pColor->GetColor(); + // sonst Default behalten + } + else + throw uno::RuntimeException(); + + return nRet; +} + +rtl::OUString SAL_CALL SvNumberFormatterServiceObj::formatString( sal_Int32 nKey, + const rtl::OUString& aString ) throw(uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + String aRet; + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; + if (pFormatter) + { + String aTemp = aString; + Color* pColor = NULL; + pFormatter->GetOutputString(aTemp, nKey, aRet, &pColor); + } + else + throw uno::RuntimeException(); + + return aRet; +} + +util::Color SAL_CALL SvNumberFormatterServiceObj::queryColorForString( sal_Int32 nKey, + const rtl::OUString& aString,util::Color aDefaultColor ) + throw(uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + util::Color nRet = aDefaultColor; // color = INT32 + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; + if (pFormatter) + { + String aTemp = aString; + String aStr; + Color* pColor = NULL; + pFormatter->GetOutputString(aTemp, nKey, aStr, &pColor); + if (pColor) + nRet = pColor->GetColor(); + // sonst Default behalten + } + else + throw uno::RuntimeException(); + + return nRet; +} + +rtl::OUString SAL_CALL SvNumberFormatterServiceObj::getInputString( sal_Int32 nKey, double fValue ) + throw(uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + String aRet; + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; + if (pFormatter) + pFormatter->GetInputLineString(fValue, nKey, aRet); + else + throw uno::RuntimeException(); + + return aRet; +} + +// XNumberFormatPreviewer + +rtl::OUString SAL_CALL SvNumberFormatterServiceObj::convertNumberToPreviewString( + const rtl::OUString& aFormat, double fValue, + const lang::Locale& nLocale, sal_Bool bAllowEnglish ) + throw(util::MalformedNumberFormatException, uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + String aRet; + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; + if (pFormatter) + { + String aOutString; + String aFormString = aFormat; + LanguageType eLang = lcl_GetLanguage( nLocale ); + Color* pColor = NULL; + + BOOL bOk; + if ( bAllowEnglish ) + bOk = pFormatter->GetPreviewStringGuess( + aFormString, fValue, aOutString, &pColor, eLang ); + else + bOk = pFormatter->GetPreviewString( + aFormString, fValue, aOutString, &pColor, eLang ); + + if (bOk) + aRet = aOutString; + else + throw util::MalformedNumberFormatException(); + } + else + throw uno::RuntimeException(); + + return aRet; +} + +util::Color SAL_CALL SvNumberFormatterServiceObj::queryPreviewColorForNumber( + const rtl::OUString& aFormat, double fValue, + const lang::Locale& nLocale, sal_Bool bAllowEnglish, + util::Color aDefaultColor ) + throw(util::MalformedNumberFormatException, uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + util::Color nRet = aDefaultColor; // color = INT32 + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; + if (pFormatter) + { + String aOutString; + String aFormString = aFormat; + LanguageType eLang = lcl_GetLanguage( nLocale ); + Color* pColor = NULL; + + BOOL bOk; + if ( bAllowEnglish ) + bOk = pFormatter->GetPreviewStringGuess( + aFormString, fValue, aOutString, &pColor, eLang ); + else + bOk = pFormatter->GetPreviewString( + aFormString, fValue, aOutString, &pColor, eLang ); + + if (bOk) + { + if (pColor) + nRet = pColor->GetColor(); + // sonst Default behalten + } + else + throw util::MalformedNumberFormatException(); + } + else + throw uno::RuntimeException(); + + return nRet; +} + +// XServiceInfo + +rtl::OUString SAL_CALL SvNumberFormatterServiceObj::getImplementationName() + throw(uno::RuntimeException) +{ + return rtl::OUString::createFromAscii("com.sun.star.uno.util.numbers.SvNumberFormatterServiceObject"); +} + +sal_Bool SAL_CALL SvNumberFormatterServiceObj::supportsService( const rtl::OUString& ServiceName ) + throw(uno::RuntimeException) +{ + return ( ServiceName.compareToAscii(SERVICENAME_NUMBERFORMATTER) == 0 ); +} + +uno::Sequence SAL_CALL SvNumberFormatterServiceObj::getSupportedServiceNames() + throw(uno::RuntimeException) +{ + uno::Sequence aRet(1); + rtl::OUString* pArray = aRet.getArray(); + pArray[0] = rtl::OUString::createFromAscii(SERVICENAME_NUMBERFORMATTER); + return aRet; +} + +//------------------------------------------------------------------------ + +SvNumberFormatsObj::SvNumberFormatsObj( SvNumberFormatsSupplierObj& _rParent, ::comphelper::SharedMutex& _rMutex ) + :rSupplier( _rParent ) + ,m_aMutex( _rMutex ) +{ + rSupplier.acquire(); +} + +SvNumberFormatsObj::~SvNumberFormatsObj() +{ + rSupplier.release(); +} + +// XNumberFormats + +uno::Reference SAL_CALL SvNumberFormatsObj::getByKey( sal_Int32 nKey ) + throw(uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : NULL; + if (pFormat) + return new SvNumberFormatObj( rSupplier, nKey, m_aMutex ); + else + throw uno::RuntimeException(); +} + +uno::Sequence SAL_CALL SvNumberFormatsObj::queryKeys( sal_Int16 nType, + const lang::Locale& nLocale, sal_Bool bCreate ) + throw(uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + if ( pFormatter ) + { + sal_uInt32 nIndex = 0; + LanguageType eLang = lcl_GetLanguage( nLocale ); + SvNumberFormatTable& rTable = bCreate ? + pFormatter->ChangeCL( nType, nIndex, eLang ) : + pFormatter->GetEntryTable( nType, nIndex, eLang ); + sal_uInt32 nCount = rTable.Count(); + uno::Sequence aSeq(nCount); + sal_Int32* pAry = aSeq.getArray(); + for (sal_uInt32 i=0; iGetEntryKey( aFormat, eLang ); + } + else + throw uno::RuntimeException(); + + return nRet; +} + +sal_Int32 SAL_CALL SvNumberFormatsObj::addNew( const rtl::OUString& aFormat, + const lang::Locale& nLocale ) + throw(util::MalformedNumberFormatException, uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + INT32 nRet = 0; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + if (pFormatter) + { + String aFormStr = aFormat; + LanguageType eLang = lcl_GetLanguage( nLocale ); + sal_uInt32 nKey = 0; + xub_StrLen nCheckPos = 0; + short nType = 0; + BOOL bOk = pFormatter->PutEntry( aFormStr, nCheckPos, nType, nKey, eLang ); + if (bOk) + nRet = nKey; + else if (nCheckPos) + { + throw util::MalformedNumberFormatException(); // ungueltiges Format + } + else + throw uno::RuntimeException(); // anderer Fehler (z.B. schon vorhanden) + } + else + throw uno::RuntimeException(); + + return nRet; +} + +sal_Int32 SAL_CALL SvNumberFormatsObj::addNewConverted( const rtl::OUString& aFormat, + const lang::Locale& nLocale, const lang::Locale& nNewLocale ) + throw(util::MalformedNumberFormatException, uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + INT32 nRet = 0; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + if (pFormatter) + { + String aFormStr = aFormat; + LanguageType eLang = lcl_GetLanguage( nLocale ); + LanguageType eNewLang = lcl_GetLanguage( nNewLocale ); + sal_uInt32 nKey = 0; + xub_StrLen nCheckPos = 0; + short nType = 0; + BOOL bOk = pFormatter->PutandConvertEntry( aFormStr, nCheckPos, nType, nKey, eLang, eNewLang ); + if (bOk || nKey > 0) + nRet = nKey; + else if (nCheckPos) + { + throw util::MalformedNumberFormatException(); // ungueltiges Format + } + else + throw uno::RuntimeException(); // anderer Fehler (z.B. schon vorhanden) + } + else + throw uno::RuntimeException(); + + return nRet; +} + +void SAL_CALL SvNumberFormatsObj::removeByKey( sal_Int32 nKey ) throw(uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + + if (pFormatter) + { + pFormatter->DeleteEntry(nKey); + rSupplier.NumberFormatDeleted(nKey); // Benachrichtigung fuers Dokument + } +} + +rtl::OUString SAL_CALL SvNumberFormatsObj::generateFormat( sal_Int32 nBaseKey, + const lang::Locale& nLocale, sal_Bool bThousands, + sal_Bool bRed, sal_Int16 nDecimals, sal_Int16 nLeading ) + throw(uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + String aRet; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + if (pFormatter) + { + LanguageType eLang = lcl_GetLanguage( nLocale ); + pFormatter->GenerateFormat( aRet, nBaseKey, eLang, bThousands, bRed, nDecimals, nLeading ); + } + else + throw uno::RuntimeException(); + + return aRet; +} + +// XNumberFormatTypes + +sal_Int32 SAL_CALL SvNumberFormatsObj::getStandardIndex( const lang::Locale& nLocale ) + throw(uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + INT32 nRet = 0; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + if (pFormatter) + { + LanguageType eLang = lcl_GetLanguage( nLocale ); + nRet = pFormatter->GetStandardIndex(eLang); + } + else + throw uno::RuntimeException(); + + return nRet; +} + +sal_Int32 SAL_CALL SvNumberFormatsObj::getStandardFormat( sal_Int16 nType, const lang::Locale& nLocale ) + throw(uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + INT32 nRet = 0; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + if (pFormatter) + { + LanguageType eLang = lcl_GetLanguage( nLocale ); + // mask out "defined" bit, so type from an existing number format + // can directly be used for getStandardFormat + nType &= ~NUMBERFORMAT_DEFINED; + nRet = pFormatter->GetStandardFormat(nType, eLang); + } + else + throw uno::RuntimeException(); + + return nRet; +} + +sal_Int32 SAL_CALL SvNumberFormatsObj::getFormatIndex( sal_Int16 nIndex, const lang::Locale& nLocale ) + throw(uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + INT32 nRet = 0; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + if (pFormatter) + { + LanguageType eLang = lcl_GetLanguage( nLocale ); + nRet = pFormatter->GetFormatIndex( (NfIndexTableOffset)nIndex, eLang ); + } + else + throw uno::RuntimeException(); + + return nRet; +} + +sal_Bool SAL_CALL SvNumberFormatsObj::isTypeCompatible( sal_Int16 nOldType, sal_Int16 nNewType ) + throw(uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + BOOL bRet = FALSE; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + if (pFormatter) + bRet = pFormatter->IsCompatible( nOldType, nNewType ); + else + throw uno::RuntimeException(); + + return bRet; +} + +sal_Int32 SAL_CALL SvNumberFormatsObj::getFormatForLocale( sal_Int32 nKey, const lang::Locale& nLocale ) + throw(uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + INT32 nRet = 0; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + if (pFormatter) + { + LanguageType eLang = lcl_GetLanguage( nLocale ); + nRet = pFormatter->GetFormatForLanguageIfBuiltIn(nKey, eLang); + } + else + throw uno::RuntimeException(); + + return nRet; +} + +// XServiceInfo + +rtl::OUString SAL_CALL SvNumberFormatsObj::getImplementationName() + throw(uno::RuntimeException) +{ + return rtl::OUString::createFromAscii("SvNumberFormatsObj"); +} + +sal_Bool SAL_CALL SvNumberFormatsObj::supportsService( const rtl::OUString& ServiceName ) + throw(uno::RuntimeException) +{ + return ( ServiceName.compareToAscii(SERVICENAME_NUMBERFORMATS) == 0 ); +} + +uno::Sequence SAL_CALL SvNumberFormatsObj::getSupportedServiceNames() + throw(uno::RuntimeException) +{ + uno::Sequence aRet(1); + rtl::OUString* pArray = aRet.getArray(); + pArray[0] = rtl::OUString::createFromAscii(SERVICENAME_NUMBERFORMATS); + return aRet; +} + +//------------------------------------------------------------------------ + +SvNumberFormatObj::SvNumberFormatObj( SvNumberFormatsSupplierObj& rParent, ULONG nK, const ::comphelper::SharedMutex& _rMutex ) + :rSupplier( rParent ) + ,nKey( nK ) + ,m_aMutex( _rMutex ) +{ + rSupplier.acquire(); +} + +SvNumberFormatObj::~SvNumberFormatObj() +{ + rSupplier.release(); +} + +// XPropertySet + +uno::Reference SAL_CALL SvNumberFormatObj::getPropertySetInfo() + throw(uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + static uno::Reference aRef = + new SfxItemPropertySetInfo( lcl_GetNumberFormatPropertyMap() ); + return aRef; +} + +void SAL_CALL SvNumberFormatObj::setPropertyValue( const rtl::OUString&, + const uno::Any& ) + throw(beans::UnknownPropertyException, beans::PropertyVetoException, + lang::IllegalArgumentException, lang::WrappedTargetException, + uno::RuntimeException) +{ + throw beans::UnknownPropertyException(); // everything is read-only +} + +uno::Any SAL_CALL SvNumberFormatObj::getPropertyValue( const rtl::OUString& aPropertyName ) + throw(beans::UnknownPropertyException, lang::WrappedTargetException, + uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + uno::Any aRet; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : NULL; + if (pFormat) + { + BOOL bThousand, bRed; + USHORT nDecimals, nLeading; + + String aString = aPropertyName; + if (aString.EqualsAscii( PROPERTYNAME_FMTSTR )) + { + aRet <<= rtl::OUString( pFormat->GetFormatstring() ); + } + else if (aString.EqualsAscii( PROPERTYNAME_LOCALE )) + { + lang::Locale aLocale( MsLangId::convertLanguageToLocale( + pFormat->GetLanguage())); + aRet <<= aLocale; + } + else if (aString.EqualsAscii( PROPERTYNAME_TYPE )) + { + aRet <<= (sal_Int16)( pFormat->GetType() ); + } + else if (aString.EqualsAscii( PROPERTYNAME_COMMENT )) + { + aRet <<= rtl::OUString( pFormat->GetComment() ); + } + else if (aString.EqualsAscii( PROPERTYNAME_STDFORM )) + { + //! SvNumberformat Member bStandard rausreichen? + BOOL bStandard = ( ( nKey % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 ); + aRet.setValue( &bStandard, getBooleanCppuType() ); + } + else if (aString.EqualsAscii( PROPERTYNAME_USERDEF )) + { + BOOL bUserDef = ( ( pFormat->GetType() & NUMBERFORMAT_DEFINED ) != 0 ); + aRet.setValue( &bUserDef, getBooleanCppuType() ); + } + else if (aString.EqualsAscii( PROPERTYNAME_DECIMALS )) + { + pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading ); + aRet <<= (sal_Int16)( nDecimals ); + } + else if (aString.EqualsAscii( PROPERTYNAME_LEADING )) + { + pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading ); + aRet <<= (sal_Int16)( nLeading ); + } + else if (aString.EqualsAscii( PROPERTYNAME_NEGRED )) + { + pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading ); + aRet.setValue( &bRed, getBooleanCppuType() ); + } + else if (aString.EqualsAscii( PROPERTYNAME_THOUS )) + { + pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading ); + aRet.setValue( &bThousand, getBooleanCppuType() ); + } + else if (aString.EqualsAscii( PROPERTYNAME_CURRSYM )) + { + String aSymbol, aExt; + pFormat->GetNewCurrencySymbol( aSymbol, aExt ); + aRet <<= rtl::OUString( aSymbol ); + } + else if (aString.EqualsAscii( PROPERTYNAME_CURREXT )) + { + String aSymbol, aExt; + pFormat->GetNewCurrencySymbol( aSymbol, aExt ); + aRet <<= rtl::OUString( aExt ); + } + else if (aString.EqualsAscii( PROPERTYNAME_CURRABB )) + { + String aSymbol, aExt; + BOOL bBank = FALSE; + pFormat->GetNewCurrencySymbol( aSymbol, aExt ); + const NfCurrencyEntry* pCurr = pFormatter->GetCurrencyEntry( bBank, + aSymbol, aExt, pFormat->GetLanguage() ); + if ( pCurr ) + aRet <<= rtl::OUString( pCurr->GetBankSymbol() ); + else + aRet <<= rtl::OUString(); + } + else + throw beans::UnknownPropertyException(); + } + else + throw uno::RuntimeException(); + + return aRet; +} + +void SAL_CALL SvNumberFormatObj::addPropertyChangeListener( const rtl::OUString&, + const uno::Reference&) + throw(beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException) +{ + DBG_ERROR("not implemented"); +} + +void SAL_CALL SvNumberFormatObj::removePropertyChangeListener( const rtl::OUString&, + const uno::Reference&) + throw(beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException) +{ + DBG_ERROR("not implemented"); +} + +void SAL_CALL SvNumberFormatObj::addVetoableChangeListener( const rtl::OUString&, + const uno::Reference&) + throw(beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException) +{ + DBG_ERROR("not implemented"); +} + +void SAL_CALL SvNumberFormatObj::removeVetoableChangeListener( const rtl::OUString&, + const uno::Reference&) + throw(beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException) +{ + DBG_ERROR("not implemented"); +} + +// XPropertyAccess + +uno::Sequence SAL_CALL SvNumberFormatObj::getPropertyValues() + throw(uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : NULL; + if (pFormat) + { + String aSymbol, aExt, aAbb; + BOOL bBank = FALSE; + pFormat->GetNewCurrencySymbol( aSymbol, aExt ); + const NfCurrencyEntry* pCurr = pFormatter->GetCurrencyEntry( bBank, + aSymbol, aExt, pFormat->GetLanguage() ); + if ( pCurr ) + aAbb = pCurr->GetBankSymbol(); + + String aFmtStr = pFormat->GetFormatstring(); + String aComment = pFormat->GetComment(); + BOOL bStandard = ( ( nKey % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 ); + //! SvNumberformat Member bStandard rausreichen? + BOOL bUserDef = ( ( pFormat->GetType() & NUMBERFORMAT_DEFINED ) != 0 ); + BOOL bThousand, bRed; + USHORT nDecimals, nLeading; + pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading ); + lang::Locale aLocale( MsLangId::convertLanguageToLocale( + pFormat->GetLanguage())); + + uno::Sequence aSeq(13); + beans::PropertyValue* pArray = aSeq.getArray(); + + pArray[0].Name = rtl::OUString::createFromAscii( PROPERTYNAME_FMTSTR ); + pArray[0].Value <<= rtl::OUString( aFmtStr ); + pArray[1].Name = rtl::OUString::createFromAscii( PROPERTYNAME_LOCALE ); + pArray[1].Value <<= aLocale; + pArray[2].Name = rtl::OUString::createFromAscii( PROPERTYNAME_TYPE ); + pArray[2].Value <<= (sal_Int16)( pFormat->GetType() ); + pArray[3].Name = rtl::OUString::createFromAscii( PROPERTYNAME_COMMENT ); + pArray[3].Value <<= rtl::OUString( aComment ); + pArray[4].Name = rtl::OUString::createFromAscii( PROPERTYNAME_STDFORM ); + pArray[4].Value.setValue( &bStandard, getBooleanCppuType() ); + pArray[5].Name = rtl::OUString::createFromAscii( PROPERTYNAME_USERDEF ); + pArray[5].Value.setValue( &bUserDef, getBooleanCppuType() ); + pArray[6].Name = rtl::OUString::createFromAscii( PROPERTYNAME_DECIMALS ); + pArray[6].Value <<= (sal_Int16)( nDecimals ); + pArray[7].Name = rtl::OUString::createFromAscii( PROPERTYNAME_LEADING ); + pArray[7].Value <<= (sal_Int16)( nLeading ); + pArray[8].Name = rtl::OUString::createFromAscii( PROPERTYNAME_NEGRED ); + pArray[8].Value.setValue( &bRed, getBooleanCppuType() ); + pArray[9].Name = rtl::OUString::createFromAscii( PROPERTYNAME_THOUS ); + pArray[9].Value.setValue( &bThousand, getBooleanCppuType() ); + pArray[10].Name = rtl::OUString::createFromAscii( PROPERTYNAME_CURRSYM ); + pArray[10].Value <<= rtl::OUString( aSymbol ); + pArray[11].Name = rtl::OUString::createFromAscii( PROPERTYNAME_CURREXT ); + pArray[11].Value <<= rtl::OUString( aExt ); + pArray[12].Name = rtl::OUString::createFromAscii( PROPERTYNAME_CURRABB ); + pArray[12].Value <<= rtl::OUString( aAbb ); + + return aSeq; + } + else + throw uno::RuntimeException(); +} + +void SAL_CALL SvNumberFormatObj::setPropertyValues( const uno::Sequence& ) + throw(beans::UnknownPropertyException, beans::PropertyVetoException, + lang::IllegalArgumentException, lang::WrappedTargetException, + uno::RuntimeException) +{ + throw beans::UnknownPropertyException(); // everything is read-only +} + +// XServiceInfo + +rtl::OUString SAL_CALL SvNumberFormatObj::getImplementationName() + throw(uno::RuntimeException) +{ + return rtl::OUString::createFromAscii("SvNumberFormatObj"); +} + +sal_Bool SAL_CALL SvNumberFormatObj::supportsService( const rtl::OUString& ServiceName ) + throw(uno::RuntimeException) +{ + return ( ServiceName.compareToAscii(SERVICENAME_NUMBERFORMAT) == 0 ); +} + +uno::Sequence SAL_CALL SvNumberFormatObj::getSupportedServiceNames() + throw(uno::RuntimeException) +{ + uno::Sequence aRet(1); + rtl::OUString* pArray = aRet.getArray(); + pArray[0] = rtl::OUString::createFromAscii(SERVICENAME_NUMBERFORMAT); + return aRet; +} + +//------------------------------------------------------------------------ + +SvNumberFormatSettingsObj::SvNumberFormatSettingsObj( SvNumberFormatsSupplierObj& rParent, const ::comphelper::SharedMutex& _rMutex ) + :rSupplier( rParent ) + ,m_aMutex( _rMutex ) +{ + rSupplier.acquire(); +} + +SvNumberFormatSettingsObj::~SvNumberFormatSettingsObj() +{ + rSupplier.release(); +} + +// XPropertySet + +uno::Reference SAL_CALL SvNumberFormatSettingsObj::getPropertySetInfo() + throw(uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + static uno::Reference aRef = + new SfxItemPropertySetInfo( lcl_GetNumberSettingsPropertyMap() ); + return aRef; +} + +void SAL_CALL SvNumberFormatSettingsObj::setPropertyValue( const rtl::OUString& aPropertyName, + const uno::Any& aValue ) + throw(beans::UnknownPropertyException, beans::PropertyVetoException, + lang::IllegalArgumentException, lang::WrappedTargetException, + uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + if (pFormatter) + { + String aString = aPropertyName; + if (aString.EqualsAscii( PROPERTYNAME_NOZERO )) + { + // operator >>= shouldn't be used for bool (?) + if ( aValue.getValueTypeClass() == uno::TypeClass_BOOLEAN ) + pFormatter->SetNoZero( *(sal_Bool*)aValue.getValue() ); + } + else if (aString.EqualsAscii( PROPERTYNAME_NULLDATE )) + { + util::Date aDate; + if ( aValue >>= aDate ) + pFormatter->ChangeNullDate( aDate.Day, aDate.Month, aDate.Year ); + } + else if (aString.EqualsAscii( PROPERTYNAME_STDDEC )) + { + sal_Int16 nInt16 = sal_Int16(); + if ( aValue >>= nInt16 ) + pFormatter->ChangeStandardPrec( nInt16 ); + } + else if (aString.EqualsAscii( PROPERTYNAME_TWODIGIT )) + { + sal_Int16 nInt16 = sal_Int16(); + if ( aValue >>= nInt16 ) + pFormatter->SetYear2000( nInt16 ); + } + else + throw beans::UnknownPropertyException(); + + rSupplier.SettingsChanged(); + } + else + throw uno::RuntimeException(); +} + +uno::Any SAL_CALL SvNumberFormatSettingsObj::getPropertyValue( const rtl::OUString& aPropertyName ) + throw(beans::UnknownPropertyException, lang::WrappedTargetException, + uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + uno::Any aRet; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); + if (pFormatter) + { + String aString = aPropertyName; + if (aString.EqualsAscii( PROPERTYNAME_NOZERO )) + { + BOOL bNoZero = pFormatter->GetNoZero(); + aRet.setValue( &bNoZero, getBooleanCppuType() ); + } + else if (aString.EqualsAscii( PROPERTYNAME_NULLDATE )) + { + Date* pDate = pFormatter->GetNullDate(); + if (pDate) + { + util::Date aUnoDate( pDate->GetDay(), pDate->GetMonth(), pDate->GetYear() ); + aRet <<= aUnoDate; + } + } + else if (aString.EqualsAscii( PROPERTYNAME_STDDEC )) + aRet <<= (sal_Int16)( pFormatter->GetStandardPrec() ); + else if (aString.EqualsAscii( PROPERTYNAME_TWODIGIT )) + aRet <<= (sal_Int16)( pFormatter->GetYear2000() ); + else + throw beans::UnknownPropertyException(); + } + else + throw uno::RuntimeException(); + + return aRet; +} + +void SAL_CALL SvNumberFormatSettingsObj::addPropertyChangeListener( const rtl::OUString&, + const uno::Reference&) + throw(beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException) +{ + DBG_ERROR("not implemented"); +} + +void SAL_CALL SvNumberFormatSettingsObj::removePropertyChangeListener( const rtl::OUString&, + const uno::Reference&) + throw(beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException) +{ + DBG_ERROR("not implemented"); +} + +void SAL_CALL SvNumberFormatSettingsObj::addVetoableChangeListener( const rtl::OUString&, + const uno::Reference&) + throw(beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException) +{ + DBG_ERROR("not implemented"); +} + +void SAL_CALL SvNumberFormatSettingsObj::removeVetoableChangeListener( const rtl::OUString&, + const uno::Reference&) + throw(beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException) +{ + DBG_ERROR("not implemented"); +} + +// XServiceInfo + +rtl::OUString SAL_CALL SvNumberFormatSettingsObj::getImplementationName() + throw(uno::RuntimeException) +{ + return rtl::OUString::createFromAscii("SvNumberFormatSettingsObj"); +} + +sal_Bool SAL_CALL SvNumberFormatSettingsObj::supportsService( const rtl::OUString& ServiceName ) + throw(uno::RuntimeException) +{ + return ( ServiceName.compareToAscii(SERVICENAME_NUMBERSETTINGS) == 0 ); +} + +uno::Sequence SAL_CALL SvNumberFormatSettingsObj::getSupportedServiceNames() + throw(uno::RuntimeException) +{ + uno::Sequence aRet(1); + rtl::OUString* pArray = aRet.getArray(); + pArray[0] = rtl::OUString::createFromAscii(SERVICENAME_NUMBERSETTINGS); + return aRet; +} + + diff --git a/svl/source/numbers/numfmuno.hxx b/svl/source/numbers/numfmuno.hxx new file mode 100644 index 000000000000..4148069fb37e --- /dev/null +++ b/svl/source/numbers/numfmuno.hxx @@ -0,0 +1,324 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: numfmuno.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _NUMFMUNO_HXX +#define _NUMFMUNO_HXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class SvNumberformat; +class SvNumberFormatter; +class SvNumberFormatsSupplierObj; + + +// SvNumberFormatterServiceObj wird global als Service angemeldet + +class SvNumberFormatterServiceObj : public cppu::WeakImplHelper3< + com::sun::star::util::XNumberFormatter, + com::sun::star::util::XNumberFormatPreviewer, + com::sun::star::lang::XServiceInfo> +{ +private: + ::rtl::Reference< SvNumberFormatsSupplierObj > xSupplier; + mutable ::comphelper::SharedMutex m_aMutex; + +public: + SvNumberFormatterServiceObj(); + virtual ~SvNumberFormatterServiceObj(); + + // XNumberFormatter + virtual void SAL_CALL attachNumberFormatsSupplier( + const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XNumberFormatsSupplier >& xSupplier ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > + SAL_CALL getNumberFormatsSupplier() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL detectNumberFormat( sal_Int32 nKey, const ::rtl::OUString& aString ) + throw(::com::sun::star::util::NotNumericException, + ::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL convertStringToNumber( sal_Int32 nKey, const ::rtl::OUString& aString ) + throw(::com::sun::star::util::NotNumericException, + ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL convertNumberToString( sal_Int32 nKey, double fValue ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Color SAL_CALL queryColorForNumber( sal_Int32 nKey, + double fValue, ::com::sun::star::util::Color aDefaultColor ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL formatString( sal_Int32 nKey, const ::rtl::OUString& aString ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Color SAL_CALL queryColorForString( sal_Int32 nKey, + const ::rtl::OUString& aString, + ::com::sun::star::util::Color aDefaultColor ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getInputString( sal_Int32 nKey, double fValue ) + throw(::com::sun::star::uno::RuntimeException); + + // XNumberFormatPreviewer + virtual ::rtl::OUString SAL_CALL convertNumberToPreviewString( + const ::rtl::OUString& aFormat, double fValue, + const ::com::sun::star::lang::Locale& nLocale, sal_Bool bAllowEnglish ) + throw(::com::sun::star::util::MalformedNumberFormatException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Color SAL_CALL queryPreviewColorForNumber( + const ::rtl::OUString& aFormat, double fValue, + const ::com::sun::star::lang::Locale& nLocale, sal_Bool bAllowEnglish, + ::com::sun::star::util::Color aDefaultColor ) + throw(::com::sun::star::util::MalformedNumberFormatException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class SvNumberFormatsObj : public cppu::WeakImplHelper3< + com::sun::star::util::XNumberFormats, + com::sun::star::util::XNumberFormatTypes, + com::sun::star::lang::XServiceInfo> +{ +private: + SvNumberFormatsSupplierObj& rSupplier; + mutable ::comphelper::SharedMutex m_aMutex; + +public: + SvNumberFormatsObj(SvNumberFormatsSupplierObj& pParent, ::comphelper::SharedMutex& _rMutex); + virtual ~SvNumberFormatsObj(); + + + // XNumberFormats + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL + getByKey( sal_Int32 nKey ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL queryKeys( sal_Int16 nType, + const ::com::sun::star::lang::Locale& nLocale, sal_Bool bCreate ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL queryKey( const ::rtl::OUString& aFormat, + const ::com::sun::star::lang::Locale& nLocale, sal_Bool bScan ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL addNew( const ::rtl::OUString& aFormat, + const ::com::sun::star::lang::Locale& nLocale ) + throw(::com::sun::star::util::MalformedNumberFormatException, + ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL addNewConverted( const ::rtl::OUString& aFormat, + const ::com::sun::star::lang::Locale& nLocale, + const ::com::sun::star::lang::Locale& nNewLocale ) + throw(::com::sun::star::util::MalformedNumberFormatException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByKey( sal_Int32 nKey ) throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL generateFormat( sal_Int32 nBaseKey, + const ::com::sun::star::lang::Locale& nLocale, sal_Bool bThousands, + sal_Bool bRed, sal_Int16 nDecimals, sal_Int16 nLeading ) + throw(::com::sun::star::uno::RuntimeException); + + // XNumberFormatTypes + virtual sal_Int32 SAL_CALL getStandardIndex( const ::com::sun::star::lang::Locale& nLocale ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getStandardFormat( sal_Int16 nType, + const ::com::sun::star::lang::Locale& nLocale ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getFormatIndex( sal_Int16 nIndex, + const ::com::sun::star::lang::Locale& nLocale ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isTypeCompatible( sal_Int16 nOldType, sal_Int16 nNewType ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getFormatForLocale( sal_Int32 nKey, + const ::com::sun::star::lang::Locale& nLocale ) + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + +private: + SvNumberFormatsObj(); // never implemented +}; + + +class SvNumberFormatObj : public cppu::WeakImplHelper3< + com::sun::star::beans::XPropertySet, + com::sun::star::beans::XPropertyAccess, + com::sun::star::lang::XServiceInfo> +{ +private: + SvNumberFormatsSupplierObj& rSupplier; + ULONG nKey; + mutable ::comphelper::SharedMutex m_aMutex; + +public: + SvNumberFormatObj( SvNumberFormatsSupplierObj& rParent, ULONG nK, const ::comphelper::SharedMutex& _rMutex ); + virtual ~SvNumberFormatObj(); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo( ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XPropertyAccess + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL + getPropertyValues() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue >& aProps ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class SvNumberFormatSettingsObj : public cppu::WeakImplHelper2< + com::sun::star::beans::XPropertySet, + com::sun::star::lang::XServiceInfo> +{ +private: + SvNumberFormatsSupplierObj& rSupplier; + mutable ::comphelper::SharedMutex m_aMutex; + +public: + SvNumberFormatSettingsObj( SvNumberFormatsSupplierObj& rParent, const ::comphelper::SharedMutex& _rMutex); + virtual ~SvNumberFormatSettingsObj(); + + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo( ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + + +#endif + diff --git a/svl/source/numbers/numhead.cxx b/svl/source/numbers/numhead.cxx new file mode 100644 index 000000000000..7e79aad624f3 --- /dev/null +++ b/svl/source/numbers/numhead.cxx @@ -0,0 +1,252 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: numhead.cxx,v $ + * $Revision: 1.9 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#ifndef GCC +#endif +#include + +#include "numhead.hxx" + +// ID's fuer Dateien: +#define SV_NUMID_SIZES 0x4200 + +// STATIC DATA ----------------------------------------------------------- + +//SEG_EOFGLOBALS() + +// ======================================================================= +/* wird fuer SvNumberformatter nicht gebraucht +//#pragma SEG_FUNCDEF(numhead_01) + +SvNumReadHeader::SvNumReadHeader(SvStream& rNewStream) : + rStream( rNewStream ) +{ + ULONG nDataSize; + rStream >> nDataSize; + nDataEnd = rStream.Tell() + nDataSize; +} + +//#pragma SEG_FUNCDEF(numhead_02) + +SvNumReadHeader::~SvNumReadHeader() +{ + ULONG nReadEnd = rStream.Tell(); + DBG_ASSERT( nReadEnd <= nDataEnd, "zuviele Bytes gelesen" ); + if ( nReadEnd != nDataEnd ) + rStream.Seek(nDataEnd); // Rest ueberspringen +} + +//#pragma SEG_FUNCDEF(numhead_03) + +ULONG SvNumReadHeader::BytesLeft() const +{ + ULONG nReadEnd = rStream.Tell(); + if (nReadEnd <= nDataEnd) + return nDataEnd-nReadEnd; + + DBG_ERROR("Fehler bei SvNumReadHeader::BytesLeft"); + return 0; +} + +// ----------------------------------------------------------------------- + +//#pragma SEG_FUNCDEF(numhead_04) + +SvNumWriteHeader::SvNumWriteHeader(SvStream& rNewStream, ULONG nDefault) : + rStream( rNewStream ) +{ + nDataSize = nDefault; + rStream << nDataSize; + nDataPos = rStream.Tell(); +} + +//#pragma SEG_FUNCDEF(numhead_05) + +SvNumWriteHeader::~SvNumWriteHeader() +{ + ULONG nPos = rStream.Tell(); + + if ( nPos - nDataPos != nDataSize ) // Default getroffen? + { + nDataSize = nPos - nDataPos; + rStream.Seek(nDataPos - sizeof(sal_uInt32)); + rStream << nDataSize; // Groesse am Anfang eintragen + rStream.Seek(nPos); + } +} +*/ + +// ======================================================================= + +//#pragma SEG_FUNCDEF(numhead_06) + +//! mit Skip() synchron +ImpSvNumMultipleReadHeader::ImpSvNumMultipleReadHeader(SvStream& rNewStream) : + rStream( rNewStream ) +{ + sal_uInt32 nDataSize; + rStream >> nDataSize; + ULONG nDataPos = rStream.Tell(); + nEntryEnd = nDataPos; + + rStream.SeekRel(nDataSize); + USHORT nID; + rStream >> nID; + if (nID != SV_NUMID_SIZES) + { + DBG_ERROR("SV_NUMID_SIZES nicht gefunden"); + } + sal_uInt32 nSizeTableLen; + rStream >> nSizeTableLen; + pBuf = new char[nSizeTableLen]; + rStream.Read( pBuf, nSizeTableLen ); + pMemStream = new SvMemoryStream( pBuf, nSizeTableLen, STREAM_READ ); + + nEndPos = rStream.Tell(); + rStream.Seek( nDataPos ); +} + +//#pragma SEG_FUNCDEF(numhead_07) + +ImpSvNumMultipleReadHeader::~ImpSvNumMultipleReadHeader() +{ + DBG_ASSERT( pMemStream->Tell() == pMemStream->GetSize(), + "Sizes nicht vollstaendig gelesen" ); + delete pMemStream; + delete [] pBuf; + + rStream.Seek(nEndPos); +} + +//! mit ctor synchron +// static +void ImpSvNumMultipleReadHeader::Skip( SvStream& rStream ) +{ + sal_uInt32 nDataSize; + rStream >> nDataSize; + rStream.SeekRel( nDataSize ); + USHORT nID; + rStream >> nID; + if ( nID != SV_NUMID_SIZES ) + { + DBG_ERROR("SV_NUMID_SIZES nicht gefunden"); + } + sal_uInt32 nSizeTableLen; + rStream >> nSizeTableLen; + rStream.SeekRel( nSizeTableLen ); +} + +//#pragma SEG_FUNCDEF(numhead_08) + +void ImpSvNumMultipleReadHeader::EndEntry() +{ + ULONG nPos = rStream.Tell(); + DBG_ASSERT( nPos <= nEntryEnd, "zuviel gelesen" ); + if ( nPos != nEntryEnd ) + rStream.Seek( nEntryEnd ); // Rest ueberspringen +} + +//#pragma SEG_FUNCDEF(numhead_0d) + +void ImpSvNumMultipleReadHeader::StartEntry() +{ + ULONG nPos = rStream.Tell(); + sal_uInt32 nEntrySize; + (*pMemStream) >> nEntrySize; + + nEntryEnd = nPos + nEntrySize; +} + +//#pragma SEG_FUNCDEF(numhead_09) + +ULONG ImpSvNumMultipleReadHeader::BytesLeft() const +{ + ULONG nReadEnd = rStream.Tell(); + if (nReadEnd <= nEntryEnd) + return nEntryEnd-nReadEnd; + + DBG_ERROR("Fehler bei ImpSvNumMultipleReadHeader::BytesLeft"); + return 0; +} + +// ----------------------------------------------------------------------- + +//#pragma SEG_FUNCDEF(numhead_0a) + +ImpSvNumMultipleWriteHeader::ImpSvNumMultipleWriteHeader(SvStream& rNewStream, + ULONG nDefault) : + rStream( rNewStream ), + aMemStream( 4096, 4096 ) +{ + nDataSize = nDefault; + rStream << nDataSize; + + nDataPos = rStream.Tell(); + nEntryStart = nDataPos; +} + +//#pragma SEG_FUNCDEF(numhead_0b) + +ImpSvNumMultipleWriteHeader::~ImpSvNumMultipleWriteHeader() +{ + ULONG nDataEnd = rStream.Tell(); + + rStream << (USHORT) SV_NUMID_SIZES; + rStream << static_cast(aMemStream.Tell()); + rStream.Write( aMemStream.GetData(), aMemStream.Tell() ); + + if ( nDataEnd - nDataPos != nDataSize ) // Default getroffen? + { + nDataSize = nDataEnd - nDataPos; + ULONG nPos = rStream.Tell(); + rStream.Seek(nDataPos-sizeof(sal_uInt32)); + rStream << nDataSize; // Groesse am Anfang eintragen + rStream.Seek(nPos); + } +} + +//#pragma SEG_FUNCDEF(numhead_0c) + +void ImpSvNumMultipleWriteHeader::EndEntry() +{ + ULONG nPos = rStream.Tell(); + aMemStream << static_cast(nPos - nEntryStart); +} + +//#pragma SEG_FUNCDEF(numhead_0e) + +void ImpSvNumMultipleWriteHeader::StartEntry() +{ + ULONG nPos = rStream.Tell(); + nEntryStart = nPos; +} + diff --git a/svl/source/numbers/numhead.hxx b/svl/source/numbers/numhead.hxx new file mode 100644 index 000000000000..de23b3cbccf4 --- /dev/null +++ b/svl/source/numbers/numhead.hxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: numhead.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef NF_NUMHEAD_HXX +#define NF_NUMHEAD_HXX + +#include + +// ----------------------------------------------------------------------- + + // "Automatischer" Record-Header mit Groessenangabe + +/* wird fuer SvNumberFormatter nicht gebraucht +class SvNumReadHeader +{ +private: + SvStream& rStream; + ULONG nDataEnd; + +public: + SvNumReadHeader(SvStream& rNewStream); + ~SvNumReadHeader(); + + ULONG BytesLeft() const; +}; + +class SvNumWriteHeader +{ +private: + SvStream& rStream; + ULONG nDataPos; + ULONG nDataSize; + +public: + SvNumWriteHeader(SvStream& rNewStream, ULONG nDefault = 0); + ~SvNumWriteHeader(); +}; + +*/ + + // Header mit Groessenangaben fuer mehrere Objekte + +class ImpSvNumMultipleReadHeader +{ +private: + SvStream& rStream; + char* pBuf; + SvMemoryStream* pMemStream; + ULONG nEndPos; + ULONG nEntryEnd; + +public: + ImpSvNumMultipleReadHeader(SvStream& rNewStream); + ~ImpSvNumMultipleReadHeader(); + + void StartEntry(); + void EndEntry(); + ULONG BytesLeft() const; + + static void Skip( SvStream& ); // komplett ueberspringen +}; + +class ImpSvNumMultipleWriteHeader +{ +private: + SvStream& rStream; + SvMemoryStream aMemStream; + ULONG nDataPos; + sal_uInt32 nDataSize; + ULONG nEntryStart; + +public: + ImpSvNumMultipleWriteHeader(SvStream& rNewStream, ULONG nDefault = 0); + ~ImpSvNumMultipleWriteHeader(); + + void StartEntry(); + void EndEntry(); +}; + +#endif + + diff --git a/svl/source/numbers/numuno.cxx b/svl/source/numbers/numuno.cxx new file mode 100644 index 000000000000..f91bf82b4e60 --- /dev/null +++ b/svl/source/numbers/numuno.cxx @@ -0,0 +1,171 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: numuno.cxx,v $ + * $Revision: 1.9 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#ifndef GCC +#endif + +#define _ZFORLIST_DECLARE_TABLE + +#include +#include +#include +#include +#include +#include + +#include "numuno.hxx" +#include "numfmuno.hxx" +#include + +using namespace com::sun::star; + +//------------------------------------------------------------------------ + +class SvNumFmtSuppl_Impl +{ +public: + SvNumberFormatter* pFormatter; + mutable ::comphelper::SharedMutex aMutex; + + SvNumFmtSuppl_Impl(SvNumberFormatter* p) : + pFormatter(p) {} +}; + +//------------------------------------------------------------------------ + +// Default-ctor fuer getReflection +SvNumberFormatsSupplierObj::SvNumberFormatsSupplierObj() +{ + pImpl = new SvNumFmtSuppl_Impl(NULL); +} + +SvNumberFormatsSupplierObj::SvNumberFormatsSupplierObj(SvNumberFormatter* pForm) +{ + pImpl = new SvNumFmtSuppl_Impl(pForm); +} + +SvNumberFormatsSupplierObj::~SvNumberFormatsSupplierObj() +{ + delete pImpl; +} + +::comphelper::SharedMutex& SvNumberFormatsSupplierObj::getSharedMutex() const +{ + return pImpl->aMutex; +} + +SvNumberFormatter* SvNumberFormatsSupplierObj::GetNumberFormatter() const +{ + return pImpl->pFormatter; +} + +void SvNumberFormatsSupplierObj::SetNumberFormatter(SvNumberFormatter* pNew) +{ + // der alte Numberformatter ist ungueltig geworden, nicht mehr darauf zugreifen! + pImpl->pFormatter = pNew; +} + +void SvNumberFormatsSupplierObj::NumberFormatDeleted(sal_uInt32) +{ + // Basis-Implementierung tut nix... +} + +void SvNumberFormatsSupplierObj::SettingsChanged() +{ + // Basis-Implementierung tut nix... +} + +// XNumberFormatsSupplier + +uno::Reference SAL_CALL SvNumberFormatsSupplierObj::getNumberFormatSettings() + throw(uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( pImpl->aMutex ); + + return new SvNumberFormatSettingsObj( *this, pImpl->aMutex ); +} + +uno::Reference SAL_CALL SvNumberFormatsSupplierObj::getNumberFormats() + throw(uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( pImpl->aMutex ); + + return new SvNumberFormatsObj( *this, pImpl->aMutex ); +} + +// XUnoTunnel + +sal_Int64 SAL_CALL SvNumberFormatsSupplierObj::getSomething( + const uno::Sequence& rId ) throw(uno::RuntimeException) +{ + if ( rId.getLength() == 16 && + 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), + rId.getConstArray(), 16 ) ) + { + return sal::static_int_cast(reinterpret_cast(this)); + } + return 0; +} + +// static +const uno::Sequence& SvNumberFormatsSupplierObj::getUnoTunnelId() +{ + static uno::Sequence * pSeq = 0; + if( !pSeq ) + { + osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); + if( !pSeq ) + { + static uno::Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + pSeq = &aSeq; + } + } + return *pSeq; +} + +// static +SvNumberFormatsSupplierObj* SvNumberFormatsSupplierObj::getImplementation( + const uno::Reference xObj ) +{ + SvNumberFormatsSupplierObj* pRet = NULL; + uno::Reference xUT( xObj, uno::UNO_QUERY ); + if (xUT.is()) + pRet = reinterpret_cast(sal::static_int_cast(xUT->getSomething( getUnoTunnelId() ))); + return pRet; +} + + +//------------------------------------------------------------------------ + + + diff --git a/svl/source/numbers/supservs.cxx b/svl/source/numbers/supservs.cxx new file mode 100644 index 000000000000..1035cd056406 --- /dev/null +++ b/svl/source/numbers/supservs.cxx @@ -0,0 +1,233 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: supservs.cxx,v $ + * $Revision: 1.10 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include "supservs.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include "instrm.hxx" + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::io; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::util; +using namespace ::vos; +using namespace ::utl; + +#define PERSISTENT_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.util.NumberFormatsSupplier"); + +//------------------------------------------------------------------------- +Reference< XInterface > SAL_CALL SvNumberFormatsSupplierServiceObject_CreateInstance(const Reference< XMultiServiceFactory >& _rxFactory) +{ + return static_cast< ::cppu::OWeakObject* >(new SvNumberFormatsSupplierServiceObject(_rxFactory)); +} + +//------------------------------------------------------------------------- +SvNumberFormatsSupplierServiceObject::SvNumberFormatsSupplierServiceObject(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB) + :m_pOwnFormatter(NULL) + ,m_xORB(_rxORB) +{ +} + +//------------------------------------------------------------------------- +SvNumberFormatsSupplierServiceObject::~SvNumberFormatsSupplierServiceObject() +{ + if (m_pOwnFormatter) + { + delete m_pOwnFormatter; + m_pOwnFormatter = NULL; + } +} + +//------------------------------------------------------------------------- +Any SAL_CALL SvNumberFormatsSupplierServiceObject::queryAggregation( const Type& _rType ) throw (RuntimeException) +{ + Any aReturn = ::cppu::queryInterface(_rType, + static_cast< XInitialization* >(this), + static_cast< XPersistObject* >(this), + static_cast< XServiceInfo* >(this) + ); + + if (!aReturn.hasValue()) + aReturn = SvNumberFormatsSupplierObj::queryAggregation(_rType); + + return aReturn; +} + +//------------------------------------------------------------------------- +void SAL_CALL SvNumberFormatsSupplierServiceObject::initialize( const Sequence< Any >& _rArguments ) throw(Exception, RuntimeException) +{ + ::osl::MutexGuard aGuard( getSharedMutex() ); + + DBG_ASSERT(m_pOwnFormatter == NULL, + "SvNumberFormatsSupplierServiceObject::initialize : already initialized !"); + // maybe you already called a method which needed the formatter + // you should use XMultiServiceFactory::createInstanceWithArguments to avoid that + if (m_pOwnFormatter) + { // !!! this is only a emergency handling, normally this should not occur !!! + delete m_pOwnFormatter; + m_pOwnFormatter = NULL; + SetNumberFormatter(m_pOwnFormatter); + } + + Type aExpectedArgType = ::getCppuType(static_cast(NULL)); + LanguageType eNewFormatterLanguage = LANGUAGE_ENGLISH_US; + // the default + + const Any* pArgs = _rArguments.getConstArray(); + for (sal_Int32 i=0; i<_rArguments.getLength(); ++i, ++pArgs) + { + if (pArgs->getValueType().equals(aExpectedArgType)) + { + Locale aLocale; + *pArgs >>= aLocale; + eNewFormatterLanguage = MsLangId::convertLocaleToLanguage( aLocale); + } +#ifdef DBG_UTIL + else + { + DBG_ERROR("SvNumberFormatsSupplierServiceObject::initialize : unknown argument !"); + } +#endif + } + + m_pOwnFormatter = new SvNumberFormatter(m_xORB, eNewFormatterLanguage); + m_pOwnFormatter->SetEvalDateFormat( NF_EVALDATEFORMAT_FORMAT_INTL ); + SetNumberFormatter(m_pOwnFormatter); +} + +//------------------------------------------------------------------------- +::rtl::OUString SAL_CALL SvNumberFormatsSupplierServiceObject::getImplementationName( ) throw(RuntimeException) +{ + return ::rtl::OUString::createFromAscii("com.sun.star.uno.util.numbers.SvNumberFormatsSupplierServiceObject"); +} + +//------------------------------------------------------------------------- +sal_Bool SAL_CALL SvNumberFormatsSupplierServiceObject::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) +{ + Sequence< ::rtl::OUString > aServices = getSupportedServiceNames(); + const ::rtl::OUString* pServices = aServices.getConstArray(); + for (sal_Int32 i=0; iequals(_rServiceName)) + return sal_True; + + return sal_False; +} + +//------------------------------------------------------------------------- +Sequence< ::rtl::OUString > SAL_CALL SvNumberFormatsSupplierServiceObject::getSupportedServiceNames( ) throw(RuntimeException) +{ + Sequence< ::rtl::OUString > aSupported(1); + aSupported.getArray()[0] = PERSISTENT_SERVICE_NAME; + return aSupported; +} + +//------------------------------------------------------------------------- +::rtl::OUString SAL_CALL SvNumberFormatsSupplierServiceObject::getServiceName( ) throw(RuntimeException) +{ + return PERSISTENT_SERVICE_NAME; +} + +//------------------------------------------------------------------------- +void SAL_CALL SvNumberFormatsSupplierServiceObject::write( const Reference< XObjectOutputStream >& _rxOutStream ) throw(IOException, RuntimeException) +{ + ::osl::MutexGuard aGuard( getSharedMutex() ); + implEnsureFormatter(); + + Reference< XOutputStream > xStream(_rxOutStream.get()); + SvLockBytesRef aLockBytes = new SvOutputStreamOpenLockBytes(xStream); + SvStream aSvOutputSteam(aLockBytes); + + m_pOwnFormatter->Save(aSvOutputSteam); +} + +//------------------------------------------------------------------------- +void SAL_CALL SvNumberFormatsSupplierServiceObject::read( const Reference< XObjectInputStream >& _rxInStream ) throw(IOException, RuntimeException) +{ + ::osl::MutexGuard aGuard( getSharedMutex() ); + implEnsureFormatter(); + + Reference< XInputStream > xStream(_rxInStream.get()); + SvInputStream aSvInputSteam(xStream); + + m_pOwnFormatter->Load(aSvInputSteam); +} + +//------------------------------------------------------------------------- +Reference< XPropertySet > SAL_CALL SvNumberFormatsSupplierServiceObject::getNumberFormatSettings() throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( getSharedMutex() ); + implEnsureFormatter(); + return SvNumberFormatsSupplierObj::getNumberFormatSettings(); +} + +//------------------------------------------------------------------------- +Reference< XNumberFormats > SAL_CALL SvNumberFormatsSupplierServiceObject::getNumberFormats() throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( getSharedMutex() ); + implEnsureFormatter(); + return SvNumberFormatsSupplierObj::getNumberFormats(); +} + +//------------------------------------------------------------------------- +sal_Int64 SAL_CALL SvNumberFormatsSupplierServiceObject::getSomething( const Sequence< sal_Int8 >& aIdentifier ) throw (RuntimeException) +{ + sal_Int64 nReturn = SvNumberFormatsSupplierObj::getSomething( aIdentifier ); + if ( nReturn ) + // if somebody accesses internals then we should have the formatter + implEnsureFormatter(); + return nReturn; +} + +//------------------------------------------------------------------------- +void SvNumberFormatsSupplierServiceObject::implEnsureFormatter() +{ + if (!m_pOwnFormatter) + { + // get the office's UI locale + SvtSysLocale aSysLocale; + Locale aOfficeLocale = aSysLocale.GetLocaleData().getLocale(); + + // initi with this locale + Sequence< Any > aFakedInitProps( 1 ); + aFakedInitProps[0] <<= aOfficeLocale; + + initialize( aFakedInitProps ); + } +} + diff --git a/svl/source/numbers/supservs.hxx b/svl/source/numbers/supservs.hxx new file mode 100644 index 000000000000..df48d6567ecc --- /dev/null +++ b/svl/source/numbers/supservs.hxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: supservs.hxx,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVTOOLS_NUMBERS_SUPPLIERSERVICE_HXX_ +#define _SVTOOLS_NUMBERS_SUPPLIERSERVICE_HXX_ + +#include "numuno.hxx" +#include +#include +#include +#include + +//========================================================================= +//= SvNumberFormatsSupplierServiceObject - a number formats supplier which +//= - can be instantiated as an service +//= - supports the ::com::sun::star::io::XPersistObject interface +//= - works with it's own SvNumberFormatter instance +//= - can be initialized (::com::sun::star::lang::XInitialization) +//= with a specific language (i.e. ::com::sun::star::lang::Locale) +//========================================================================= +class SvNumberFormatsSupplierServiceObject + :protected SvNumberFormatsSupplierObj + ,public ::com::sun::star::lang::XInitialization + ,public ::com::sun::star::io::XPersistObject + ,public ::com::sun::star::lang::XServiceInfo +{ // don't want the Set-/GetNumberFormatter to be accessable from outside + + friend ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > + SAL_CALL SvNumberFormatsSupplierServiceObject_CreateInstance( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&); + +protected: + SvNumberFormatter* m_pOwnFormatter; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > + m_xORB; + +public: + SvNumberFormatsSupplierServiceObject(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); + ~SvNumberFormatsSupplierServiceObject(); + + // XInterface + virtual void SAL_CALL acquire() throw() { SvNumberFormatsSupplierObj::acquire(); } + virtual void SAL_CALL release() throw() { SvNumberFormatsSupplierObj::release(); } + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException) + { return SvNumberFormatsSupplierObj::queryInterface(_rType); } + + // XAggregation + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // XPersistObject + virtual ::rtl::OUString SAL_CALL getServiceName( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + + // XNumberFormatsSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL + getNumberFormatSettings() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats > SAL_CALL + getNumberFormats() throw(::com::sun::star::uno::RuntimeException); + + // XUnoTunnler + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw (::com::sun::star::uno::RuntimeException); + +protected: + void implEnsureFormatter(); +}; + + +#endif // _SVTOOLS_NUMBERS_SUPPLIERSERVICE_HXX_ + diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx new file mode 100644 index 000000000000..aa7d75a098b7 --- /dev/null +++ b/svl/source/numbers/zforfind.cxx @@ -0,0 +1,2819 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: zforfind.cxx,v $ + * $Revision: 1.51.96.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include // NUMBERFORMAT_XXX +#include "zforscan.hxx" +#include + +#define _ZFORFIND_CXX +#include "zforfind.hxx" +#undef _ZFORFIND_CXX + + +#ifndef DBG_UTIL +#define NF_TEST_CALENDAR 0 +#else +#define NF_TEST_CALENDAR 0 +#endif +#if NF_TEST_CALENDAR +#include +#include +#endif + + +const BYTE ImpSvNumberInputScan::nMatchedEndString = 0x01; +const BYTE ImpSvNumberInputScan::nMatchedMidString = 0x02; +const BYTE ImpSvNumberInputScan::nMatchedStartString = 0x04; +const BYTE ImpSvNumberInputScan::nMatchedVirgin = 0x08; +const BYTE ImpSvNumberInputScan::nMatchedUsedAsReturn = 0x10; + +/* It is not clear how we want timezones to be handled. Convert them to local + * time isn't wanted, as it isn't done in any other place and timezone + * information isn't stored anywhere. Ignoring them and pretending local time + * may be wrong too and might not be what the user expects. Keep the input as + * string so that no information is lost. + * Anyway, defining NF_RECOGNIZE_ISO8601_TIMEZONES to 1 would be the way how it + * would work, together with the nTimezonePos handling in GetTimeRef(). */ +#define NF_RECOGNIZE_ISO8601_TIMEZONES 0 + +//--------------------------------------------------------------------------- +// Konstruktor + +ImpSvNumberInputScan::ImpSvNumberInputScan( SvNumberFormatter* pFormatterP ) + : + pUpperMonthText( NULL ), + pUpperAbbrevMonthText( NULL ), + pUpperDayText( NULL ), + pUpperAbbrevDayText( NULL ) +{ + pFormatter = pFormatterP; + pNullDate = new Date(30,12,1899); + nYear2000 = SvNumberFormatter::GetYear2000Default(); + Reset(); + ChangeIntl(); +} + + +//--------------------------------------------------------------------------- +// Destruktor + +ImpSvNumberInputScan::~ImpSvNumberInputScan() +{ + Reset(); + delete pNullDate; + delete [] pUpperMonthText; + delete [] pUpperAbbrevMonthText; + delete [] pUpperDayText; + delete [] pUpperAbbrevDayText; +} + + +//--------------------------------------------------------------------------- +// Reset + +void ImpSvNumberInputScan::Reset() +{ +#if 0 +// ER 16.06.97 18:56 Vorbelegung erfolgt jetzt in NumberStringDivision, +// wozu immer alles loeschen wenn einiges wieder benutzt oder gar nicht +// gebraucht wird.. + for (USHORT i = 0; i < SV_MAX_ANZ_INPUT_STRINGS; i++) + { + sStrArray[i].Erase(); + nNums[i] = SV_MAX_ANZ_INPUT_STRINGS-1; + IsNum[i] = FALSE; + } +#endif + nMonth = 0; + nMonthPos = 0; + nTimePos = 0; + nSign = 0; + nESign = 0; + nDecPos = 0; + nNegCheck = 0; + nAnzStrings = 0; + nAnzNums = 0; + nThousand = 0; + eScannedType = NUMBERFORMAT_UNDEFINED; + nAmPm = 0; + nPosThousandString = 0; + nLogical = 0; + nStringScanNumFor = 0; + nStringScanSign = 0; + nMatchedAllStrings = nMatchedVirgin; + nMayBeIso8601 = 0; + nTimezonePos = 0; +} + + +//--------------------------------------------------------------------------- +// +// static +inline BOOL ImpSvNumberInputScan::MyIsdigit( sal_Unicode c ) +{ + // If the input string wouldn't be converted using TransformInput() we'd + // to use something similar to the following and to adapt many places. +#if 0 + // use faster isdigit() if possible + if ( c < 128 ) + return isdigit( (unsigned char) c ) != 0; + if ( c < 256 ) + return FALSE; + String aTmp( c ); + return pFormatter->GetCharClass()->isDigit( aTmp, 0 ); +#else + return c < 128 && isdigit( (unsigned char) c ); +#endif +} + + +//--------------------------------------------------------------------------- +// +void ImpSvNumberInputScan::TransformInput( String& rStr ) +{ + xub_StrLen nPos, nLen; + for ( nPos = 0, nLen = rStr.Len(); nPos < nLen; ++nPos ) + { + if ( 256 <= rStr.GetChar( nPos ) && + pFormatter->GetCharClass()->isDigit( rStr, nPos ) ) + break; + } + if ( nPos < nLen ) + rStr = pFormatter->GetNatNum()->getNativeNumberString( rStr, + pFormatter->GetLocale(), 0 ); +} + + +//--------------------------------------------------------------------------- +// StringToDouble +// +// Only simple unsigned floating point values without any error detection, +// decimal separator has to be '.' + +double ImpSvNumberInputScan::StringToDouble( const String& rStr, BOOL bForceFraction ) +{ + double fNum = 0.0; + double fFrac = 0.0; + int nExp = 0; + xub_StrLen nPos = 0; + xub_StrLen nLen = rStr.Len(); + BOOL bPreSep = !bForceFraction; + + while (nPos < nLen) + { + if (rStr.GetChar(nPos) == '.') + bPreSep = FALSE; + else if (bPreSep) + fNum = fNum * 10.0 + (double) (rStr.GetChar(nPos) - '0'); + else + { + fFrac = fFrac * 10.0 + (double) (rStr.GetChar(nPos) - '0'); + --nExp; + } + nPos++; + } + if ( fFrac ) + return fNum + ::rtl::math::pow10Exp( fFrac, nExp ); + return fNum; +} + + +//--------------------------------------------------------------------------- +// NextNumberStringSymbol +// +// Zerlegt die Eingabe in Zahlen und Strings fuer die weitere +// Verarbeitung (Turing-Maschine). +//--------------------------------------------------------------------------- +// Ausgangs Zustand = GetChar +//---------------+-------------------+-----------------------+--------------- +// Alter Zustand | gelesenes Zeichen | Aktion | Neuer Zustand +//---------------+-------------------+-----------------------+--------------- +// GetChar | Ziffer | Symbol=Zeichen | GetValue +// | Sonst | Symbol=Zeichen | GetString +//---------------|-------------------+-----------------------+--------------- +// GetValue | Ziffer | Symbol=Symbol+Zeichen | GetValue +// | Sonst | Dec(CharPos) | Stop +//---------------+-------------------+-----------------------+--------------- +// GetString | Ziffer | Dec(CharPos) | Stop +// | Sonst | Symbol=Symbol+Zeichen | GetString +//---------------+-------------------+-----------------------+--------------- + +enum ScanState // States der Turing-Maschine +{ + SsStop = 0, + SsStart = 1, + SsGetValue = 2, + SsGetString = 3 +}; + +BOOL ImpSvNumberInputScan::NextNumberStringSymbol( + const sal_Unicode*& pStr, + String& rSymbol ) +{ + BOOL isNumber = FALSE; + sal_Unicode cToken; + ScanState eState = SsStart; + register const sal_Unicode* pHere = pStr; + register xub_StrLen nChars = 0; + + while ( ((cToken = *pHere) != 0) && eState != SsStop) + { + pHere++; + switch (eState) + { + case SsStart: + if ( MyIsdigit( cToken ) ) + { + eState = SsGetValue; + isNumber = TRUE; + } + else + eState = SsGetString; + nChars++; + break; + case SsGetValue: + if ( MyIsdigit( cToken ) ) + nChars++; + else + { + eState = SsStop; + pHere--; + } + break; + case SsGetString: + if ( !MyIsdigit( cToken ) ) + nChars++; + else + { + eState = SsStop; + pHere--; + } + break; + default: + break; + } // switch + } // while + + if ( nChars ) + rSymbol.Assign( pStr, nChars ); + else + rSymbol.Erase(); + + pStr = pHere; + + return isNumber; +} + + +//--------------------------------------------------------------------------- +// SkipThousands + +// FIXME: should be grouping; it is only used though in case nAnzStrings is +// near SV_MAX_ANZ_INPUT_STRINGS, in NumberStringDivision(). + +BOOL ImpSvNumberInputScan::SkipThousands( + const sal_Unicode*& pStr, + String& rSymbol ) +{ + BOOL res = FALSE; + sal_Unicode cToken; + const String& rThSep = pFormatter->GetNumThousandSep(); + register const sal_Unicode* pHere = pStr; + ScanState eState = SsStart; + xub_StrLen nCounter = 0; // counts 3 digits + + while ( ((cToken = *pHere) != 0) && eState != SsStop) + { + pHere++; + switch (eState) + { + case SsStart: + if ( StringPtrContains( rThSep, pHere-1, 0 ) ) + { + nCounter = 0; + eState = SsGetValue; + pHere += rThSep.Len()-1; + } + else + { + eState = SsStop; + pHere--; + } + break; + case SsGetValue: + if ( MyIsdigit( cToken ) ) + { + rSymbol += cToken; + nCounter++; + if (nCounter == 3) + { + eState = SsStart; + res = TRUE; // .000 combination found + } + } + else + { + eState = SsStop; + pHere--; + } + break; + default: + break; + } // switch + } // while + + if (eState == SsGetValue) // break witth less than 3 digits + { + if ( nCounter ) + rSymbol.Erase( rSymbol.Len() - nCounter, nCounter ); + pHere -= nCounter + rThSep.Len(); // put back ThSep also + } + pStr = pHere; + + return res; +} + + +//--------------------------------------------------------------------------- +// NumberStringDivision + +void ImpSvNumberInputScan::NumberStringDivision( const String& rString ) +{ + const sal_Unicode* pStr = rString.GetBuffer(); + const sal_Unicode* const pEnd = pStr + rString.Len(); + while ( pStr < pEnd && nAnzStrings < SV_MAX_ANZ_INPUT_STRINGS ) + { + if ( NextNumberStringSymbol( pStr, sStrArray[nAnzStrings] ) ) + { // Zahl + IsNum[nAnzStrings] = TRUE; + nNums[nAnzNums] = nAnzStrings; + nAnzNums++; + if (nAnzStrings >= SV_MAX_ANZ_INPUT_STRINGS - 7 && + nPosThousandString == 0) // nur einmal + if ( SkipThousands( pStr, sStrArray[nAnzStrings] ) ) + nPosThousandString = nAnzStrings; + } + else + { + IsNum[nAnzStrings] = FALSE; + } + nAnzStrings++; + } +} + + +//--------------------------------------------------------------------------- +// Whether rString contains rWhat at nPos + +BOOL ImpSvNumberInputScan::StringContainsImpl( const String& rWhat, + const String& rString, xub_StrLen nPos ) +{ + if ( nPos + rWhat.Len() <= rString.Len() ) + return StringPtrContainsImpl( rWhat, rString.GetBuffer(), nPos ); + return FALSE; +} + + +//--------------------------------------------------------------------------- +// Whether pString contains rWhat at nPos + +BOOL ImpSvNumberInputScan::StringPtrContainsImpl( const String& rWhat, + const sal_Unicode* pString, xub_StrLen nPos ) +{ + if ( rWhat.Len() == 0 ) + return FALSE; + register const sal_Unicode* pWhat = rWhat.GetBuffer(); + register const sal_Unicode* const pEnd = pWhat + rWhat.Len(); + register const sal_Unicode* pStr = pString + nPos; + while ( pWhat < pEnd ) + { + if ( *pWhat != *pStr ) + return FALSE; + pWhat++; + pStr++; + } + return TRUE; +} + + +//--------------------------------------------------------------------------- +// SkipChar +// +// ueberspringt genau das angegebene Zeichen + +inline BOOL ImpSvNumberInputScan::SkipChar( sal_Unicode c, const String& rString, + xub_StrLen& nPos ) +{ + if ((nPos < rString.Len()) && (rString.GetChar(nPos) == c)) + { + nPos++; + return TRUE; + } + return FALSE; +} + + +//--------------------------------------------------------------------------- +// SkipBlanks +// +// Ueberspringt Leerzeichen + +inline void ImpSvNumberInputScan::SkipBlanks( const String& rString, + xub_StrLen& nPos ) +{ + if ( nPos < rString.Len() ) + { + register const sal_Unicode* p = rString.GetBuffer() + nPos; + while ( *p == ' ' ) + { + nPos++; + p++; + } + } +} + + +//--------------------------------------------------------------------------- +// SkipString +// +// jump over rWhat in rString at nPos + +inline BOOL ImpSvNumberInputScan::SkipString( const String& rWhat, + const String& rString, xub_StrLen& nPos ) +{ + if ( StringContains( rWhat, rString, nPos ) ) + { + nPos = nPos + rWhat.Len(); + return TRUE; + } + return FALSE; +} + + +//--------------------------------------------------------------------------- +// GetThousandSep +// +// recognizes exactly ,111 in {3} and {3,2} or ,11 in {3,2} grouping + +inline BOOL ImpSvNumberInputScan::GetThousandSep( + const String& rString, + xub_StrLen& nPos, + USHORT nStringPos ) +{ + const String& rSep = pFormatter->GetNumThousandSep(); + // Is it an ordinary space instead of a non-breaking space? + bool bSpaceBreak = rSep.GetChar(0) == 0xa0 && rString.GetChar(0) == 0x20 && + rSep.Len() == 1 && rString.Len() == 1; + if (!( (rString == rSep || bSpaceBreak) // nothing else + && nStringPos < nAnzStrings - 1 // safety first! + && IsNum[nStringPos+1] )) // number follows + return FALSE; // no? => out + + utl::DigitGroupingIterator aGrouping( + pFormatter->GetLocaleData()->getDigitGrouping()); + // Match ,### in {3} or ,## in {3,2} + /* FIXME: this could be refined to match ,## in {3,2} only if ,##,## or + * ,##,### and to match ,### in {3,2} only if it's the last. However, + * currently there is no track kept where group separators occur. In {3,2} + * #,###,### and #,##,## would be valid input, which maybe isn't even bad + * for #,###,###. Other combinations such as #,###,## maybe not. */ + xub_StrLen nLen = sStrArray[nStringPos+1].Len(); + if (nLen == aGrouping.get() // with 3 (or so) digits + || nLen == aGrouping.advance().get() // or with 2 (or 3 or so) digits + || nPosThousandString == nStringPos+1 // or concatenated + ) + { + nPos = nPos + rSep.Len(); + return TRUE; + } + return FALSE; +} + + +//--------------------------------------------------------------------------- +// GetLogical +// +// Conversion of text to logial value +// "TRUE" => 1: +// "FALSE"=> -1: +// else => 0: + +short ImpSvNumberInputScan::GetLogical( const String& rString ) +{ + short res; + + const ImpSvNumberformatScan* pFS = pFormatter->GetFormatScanner(); + if ( rString == pFS->GetTrueString() ) + res = 1; + else if ( rString == pFS->GetFalseString() ) + res = -1; + else + res = 0; + + return res; +} + + +//--------------------------------------------------------------------------- +// GetMonth +// +// Converts a string containing a month name (JAN, January) at nPos into the +// month number (negative if abbreviated), returns 0 if nothing found + +short ImpSvNumberInputScan::GetMonth( const String& rString, xub_StrLen& nPos ) +{ + // #102136# The correct English form of month September abbreviated is + // SEPT, but almost every data contains SEP instead. + static const String aSeptCorrect( RTL_CONSTASCII_USTRINGPARAM( "SEPT" ) ); + static const String aSepShortened( RTL_CONSTASCII_USTRINGPARAM( "SEP" ) ); + + short res = 0; // no month found + + if (rString.Len() > nPos) // only if needed + { + if ( !bTextInitialized ) + InitText(); + sal_Int16 nMonths = pFormatter->GetCalendar()->getNumberOfMonthsInYear(); + for ( sal_Int16 i = 0; i < nMonths; i++ ) + { + if ( StringContains( pUpperMonthText[i], rString, nPos ) ) + { // full names first + nPos = nPos + pUpperMonthText[i].Len(); + res = i+1; + break; // for + } + else if ( StringContains( pUpperAbbrevMonthText[i], rString, nPos ) ) + { // abbreviated + nPos = nPos + pUpperAbbrevMonthText[i].Len(); + res = sal::static_int_cast< short >(-(i+1)); // negative + break; // for + } + else if ( i == 8 && pUpperAbbrevMonthText[i] == aSeptCorrect && + StringContains( aSepShortened, rString, nPos ) ) + { // #102136# SEPT/SEP + nPos = nPos + aSepShortened.Len(); + res = sal::static_int_cast< short >(-(i+1)); // negative + break; // for + } + } + } + + return res; +} + + +//--------------------------------------------------------------------------- +// GetDayOfWeek +// +// Converts a string containing a DayOfWeek name (Mon, Monday) at nPos into the +// DayOfWeek number + 1 (negative if abbreviated), returns 0 if nothing found + +int ImpSvNumberInputScan::GetDayOfWeek( const String& rString, xub_StrLen& nPos ) +{ + int res = 0; // no day found + + if (rString.Len() > nPos) // only if needed + { + if ( !bTextInitialized ) + InitText(); + sal_Int16 nDays = pFormatter->GetCalendar()->getNumberOfDaysInWeek(); + for ( sal_Int16 i = 0; i < nDays; i++ ) + { + if ( StringContains( pUpperDayText[i], rString, nPos ) ) + { // full names first + nPos = nPos + pUpperDayText[i].Len(); + res = i + 1; + break; // for + } + if ( StringContains( pUpperAbbrevDayText[i], rString, nPos ) ) + { // abbreviated + nPos = nPos + pUpperAbbrevDayText[i].Len(); + res = -(i + 1); // negative + break; // for + } + } + } + + return res; +} + + +//--------------------------------------------------------------------------- +// GetCurrency +// +// Lesen eines Waehrungssysmbols +// '$' => TRUE +// sonst => FALSE + +BOOL ImpSvNumberInputScan::GetCurrency( const String& rString, xub_StrLen& nPos, + const SvNumberformat* pFormat ) +{ + if ( rString.Len() > nPos ) + { + if ( !aUpperCurrSymbol.Len() ) + { // if no format specified the currency of the initialized formatter + LanguageType eLang = (pFormat ? pFormat->GetLanguage() : + pFormatter->GetLanguage()); + aUpperCurrSymbol = pFormatter->GetCharClass()->upper( + SvNumberFormatter::GetCurrencyEntry( eLang ).GetSymbol() ); + } + if ( StringContains( aUpperCurrSymbol, rString, nPos ) ) + { + nPos = nPos + aUpperCurrSymbol.Len(); + return TRUE; + } + if ( pFormat ) + { + String aSymbol, aExtension; + if ( pFormat->GetNewCurrencySymbol( aSymbol, aExtension ) ) + { + if ( aSymbol.Len() <= rString.Len() - nPos ) + { + pFormatter->GetCharClass()->toUpper( aSymbol ); + if ( StringContains( aSymbol, rString, nPos ) ) + { + nPos = nPos + aSymbol.Len(); + return TRUE; + } + } + } + } + } + + return FALSE; +} + + +//--------------------------------------------------------------------------- +// GetTimeAmPm +// +// Lesen des Zeitsymbols (AM od. PM) f. kurze Zeitangabe +// +// Rueckgabe: +// "AM" od. "PM" => TRUE +// sonst => FALSE +// +// nAmPos: +// "AM" => 1 +// "PM" => -1 +// sonst => 0 + +BOOL ImpSvNumberInputScan::GetTimeAmPm( const String& rString, xub_StrLen& nPos ) +{ + + if ( rString.Len() > nPos ) + { + const CharClass* pChr = pFormatter->GetCharClass(); + const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData(); + if ( StringContains( pChr->upper( pLoc->getTimeAM() ), rString, nPos ) ) + { + nAmPm = 1; + nPos = nPos + pLoc->getTimeAM().Len(); + return TRUE; + } + else if ( StringContains( pChr->upper( pLoc->getTimePM() ), rString, nPos ) ) + { + nAmPm = -1; + nPos = nPos + pLoc->getTimePM().Len(); + return TRUE; + } + } + + return FALSE; +} + + +//--------------------------------------------------------------------------- +// GetDecSep +// +// Lesen eines Dezimaltrenners (',') +// ',' => TRUE +// sonst => FALSE + +inline BOOL ImpSvNumberInputScan::GetDecSep( const String& rString, xub_StrLen& nPos ) +{ + if ( rString.Len() > nPos ) + { + const String& rSep = pFormatter->GetNumDecimalSep(); + if ( rString.Equals( rSep, nPos, rSep.Len() ) ) + { + nPos = nPos + rSep.Len(); + return TRUE; + } + } + return FALSE; +} + + +//--------------------------------------------------------------------------- +// read a hundredth seconds separator + +inline BOOL ImpSvNumberInputScan::GetTime100SecSep( const String& rString, xub_StrLen& nPos ) +{ + if ( rString.Len() > nPos ) + { + const String& rSep = pFormatter->GetLocaleData()->getTime100SecSep(); + if ( rString.Equals( rSep, nPos, rSep.Len() ) ) + { + nPos = nPos + rSep.Len(); + return TRUE; + } + } + return FALSE; +} + + +//--------------------------------------------------------------------------- +// GetSign +// +// Lesen eines Vorzeichens, auch Klammer !?! +// '+' => 1 +// '-' => -1 +// '(' => -1, nNegCheck = 1 +// sonst => 0 + +int ImpSvNumberInputScan::GetSign( const String& rString, xub_StrLen& nPos ) +{ + if (rString.Len() > nPos) + switch (rString.GetChar(nPos)) + { + case '+': + nPos++; + return 1; + case '(': // '(' aehnlich wie '-' ?!? + nNegCheck = 1; + //! fallthru + case '-': + nPos++; + return -1; + default: + break; + } + + return 0; +} + + +//--------------------------------------------------------------------------- +// GetESign +// +// Lesen eines Vorzeichens, gedacht fuer Exponent ?!? +// '+' => 1 +// '-' => -1 +// sonst => 0 + +short ImpSvNumberInputScan::GetESign( const String& rString, xub_StrLen& nPos ) +{ + if (rString.Len() > nPos) + switch (rString.GetChar(nPos)) + { + case '+': + nPos++; + return 1; + case '-': + nPos++; + return -1; + default: + break; + } + + return 0; +} + + +//--------------------------------------------------------------------------- +// GetNextNumber +// +// i counts string portions, j counts numbers thereof. +// It should had been called SkipNumber instead. + +inline BOOL ImpSvNumberInputScan::GetNextNumber( USHORT& i, USHORT& j ) +{ + if ( i < nAnzStrings && IsNum[i] ) + { + j++; + i++; + return TRUE; + } + return FALSE; +} + + +//--------------------------------------------------------------------------- +// GetTimeRef + +void ImpSvNumberInputScan::GetTimeRef( + double& fOutNumber, + USHORT nIndex, // j-value of the first numeric time part of input, default 0 + USHORT nAnz ) // count of numeric time parts +{ + USHORT nHour; + USHORT nMinute = 0; + USHORT nSecond = 0; + double fSecond100 = 0.0; + USHORT nStartIndex = nIndex; + + if (nTimezonePos) + { + // find first timezone number index and adjust count + for (USHORT j=0; jGetCalendar()->getNumberOfMonthsInYear(); + + if (sStrArray[nNums[nIndex]].Len() <= 2) + { + USHORT nNum = (USHORT) sStrArray[nNums[nIndex]].ToInt32(); + if ( 0 < nNum && nNum <= nRes ) + nRes = nNum - 1; // zero based for CalendarFieldIndex::MONTH + } + + return nRes; +} + + +//--------------------------------------------------------------------------- +// ImplGetYear +// +// 30 -> 1930, 29 -> 2029, oder 56 -> 1756, 55 -> 1855, ... + +USHORT ImpSvNumberInputScan::ImplGetYear( USHORT nIndex ) +{ + USHORT nYear = 0; + + if (sStrArray[nNums[nIndex]].Len() <= 4) + { + nYear = (USHORT) sStrArray[nNums[nIndex]].ToInt32(); + nYear = SvNumberFormatter::ExpandTwoDigitYear( nYear, nYear2000 ); + } + + return nYear; +} + +//--------------------------------------------------------------------------- + +bool ImpSvNumberInputScan::MayBeIso8601() +{ + if (nMayBeIso8601 == 0) + { + if (nAnzNums >= 3 && nNums[0] < nAnzStrings && + sStrArray[nNums[0]].ToInt32() > 31) + nMayBeIso8601 = 1; + else + nMayBeIso8601 = 2; + } + return nMayBeIso8601 == 1; +} + +//--------------------------------------------------------------------------- +// GetDateRef + +BOOL ImpSvNumberInputScan::GetDateRef( double& fDays, USHORT& nCounter, + const SvNumberformat* pFormat ) +{ + using namespace ::com::sun::star::i18n; + NfEvalDateFormat eEDF; + int nFormatOrder; + if ( pFormat && ((pFormat->GetType() & NUMBERFORMAT_DATE) == NUMBERFORMAT_DATE) ) + { + eEDF = pFormatter->GetEvalDateFormat(); + switch ( eEDF ) + { + case NF_EVALDATEFORMAT_INTL : + case NF_EVALDATEFORMAT_FORMAT : + nFormatOrder = 1; // only one loop + break; + default: + nFormatOrder = 2; + if ( nMatchedAllStrings ) + eEDF = NF_EVALDATEFORMAT_FORMAT_INTL; + // we have a complete match, use it + } + } + else + { + eEDF = NF_EVALDATEFORMAT_INTL; + nFormatOrder = 1; + } + BOOL res = TRUE; + + const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData(); + CalendarWrapper* pCal = pFormatter->GetCalendar(); + for ( int nTryOrder = 1; nTryOrder <= nFormatOrder; nTryOrder++ ) + { + pCal->setGregorianDateTime( Date() ); // today + String aOrgCalendar; // empty => not changed yet + DateFormat DateFmt; + BOOL bFormatTurn; + switch ( eEDF ) + { + case NF_EVALDATEFORMAT_INTL : + bFormatTurn = FALSE; + DateFmt = pLoc->getDateFormat(); + break; + case NF_EVALDATEFORMAT_FORMAT : + bFormatTurn = TRUE; + DateFmt = pFormat->GetDateOrder(); + break; + case NF_EVALDATEFORMAT_INTL_FORMAT : + if ( nTryOrder == 1 ) + { + bFormatTurn = FALSE; + DateFmt = pLoc->getDateFormat(); + } + else + { + bFormatTurn = TRUE; + DateFmt = pFormat->GetDateOrder(); + } + break; + case NF_EVALDATEFORMAT_FORMAT_INTL : + if ( nTryOrder == 2 ) + { + bFormatTurn = FALSE; + DateFmt = pLoc->getDateFormat(); + } + else + { + bFormatTurn = TRUE; + DateFmt = pFormat->GetDateOrder(); + } + break; + default: + DBG_ERROR( "ImpSvNumberInputScan::GetDateRef: unknown NfEvalDateFormat" ); + DateFmt = YMD; + bFormatTurn = FALSE; + } + if ( bFormatTurn ) + { +#if 0 +/* TODO: +We are currently not able to fully support a switch to another calendar during +input for the following reasons: +1. We do have a problem if both (locale's default and format's) calendars + define the same YMD order and use the same date separator, there is no way + to distinguish between them if the input results in valid calendar input for + both calendars. How to solve? Would NfEvalDateFormat be sufficient? Should + it always be set to NF_EVALDATEFORMAT_FORMAT_INTL and thus the format's + calendar be preferred? This could be confusing if a Calc cell was formatted + different to the locale's default and has no content yet, then the user has + no clue about the format or calendar being set. +2. In Calc cell edit mode a date is always displayed and edited using the + default edit format of the default calendar (normally being Gregorian). If + input was ambiguous due to issue #1 we'd need a mechanism to tell that a + date was edited and not newly entered. Not feasible. Otherwise we'd need a + mechanism to use a specific edit format with a specific calendar according + to the format set. +3. For some calendars like Japanese Gengou we'd need era input, which isn't + implemented at all. Though this is a rare and special case, forcing a + calendar dependent edit format as suggested in item #2 might require era + input, if it shouldn't result in a fallback to Gregorian calendar. +4. Last and least: the GetMonth() method currently only matches month names of + the default calendar. Alternating month names of the actual format's + calendar would have to be implemented. No problem. + +*/ + if ( pFormat->IsOtherCalendar( nStringScanNumFor ) ) + pFormat->SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); + else + pFormat->SwitchToSpecifiedCalendar( aOrgCalendar, fOrgDateTime, + nStringScanNumFor ); +#endif + } + + res = TRUE; + nCounter = 0; + // For incomplete dates, always assume first day of month if not specified. + pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, 1 ); + + switch (nAnzNums) // count of numbers in string + { + case 0: // none + if (nMonthPos) // only month (Jan) + pCal->setValue( CalendarFieldIndex::MONTH, Abs(nMonth)-1 ); + else + res = FALSE; + break; + + case 1: // only one number + nCounter = 1; + switch (nMonthPos) // where is the month + { + case 0: // not found => only day entered + pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) ); + break; + case 1: // month at the beginning (Jan 01) + pCal->setValue( CalendarFieldIndex::MONTH, Abs(nMonth)-1 ); + switch (DateFmt) + { + case MDY: + case YMD: + pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) ); + break; + case DMY: + pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) ); + break; + default: + res = FALSE; + break; + } + break; + case 3: // month at the end (10 Jan) + pCal->setValue( CalendarFieldIndex::MONTH, Abs(nMonth)-1 ); + switch (DateFmt) + { + case DMY: + pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) ); + break; + case YMD: + pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) ); + break; + default: + res = FALSE; + break; + } + break; + default: + res = FALSE; + break; + } // switch (nMonthPos) + break; + + case 2: // 2 numbers + nCounter = 2; + switch (nMonthPos) // where is the month + { + case 0: // not found + { + bool bHadExact; + sal_uInt32 nExactDateOrder = (bFormatTurn ? pFormat->GetExactDateOrder() : 0); + if ( 0xff < nExactDateOrder && nExactDateOrder <= 0xffff ) + { // formatted as date and exactly 2 parts + bHadExact = true; + switch ( (nExactDateOrder >> 8) & 0xff ) + { + case 'Y': + pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) ); + break; + case 'M': + pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(0) ); + break; + case 'D': + pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) ); + break; + default: + bHadExact = false; + } + switch ( nExactDateOrder & 0xff ) + { + case 'Y': + pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) ); + break; + case 'M': + pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(1) ); + break; + case 'D': + pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) ); + break; + default: + bHadExact = false; + } + } + else + bHadExact = false; + if ( !bHadExact || !pCal->isValid() ) + { + if ( !bHadExact && nExactDateOrder ) + pCal->setGregorianDateTime( Date() ); // reset today + switch (DateFmt) + { + case MDY: + // M D + pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) ); + pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(0) ); + if ( !pCal->isValid() ) // 2nd try + { // M Y + pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, 1 ); + pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(0) ); + pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) ); + } + break; + case DMY: + // D M + pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) ); + pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(1) ); + if ( !pCal->isValid() ) // 2nd try + { // M Y + pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, 1 ); + pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(0) ); + pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) ); + } + break; + case YMD: + // M D + pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) ); + pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(0) ); + if ( !pCal->isValid() ) // 2nd try + { // Y M + pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, 1 ); + pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(1) ); + pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) ); + } + break; + default: + res = FALSE; + break; + } + } + } + break; + case 1: // month at the beginning (Jan 01 01) + { + // The input is valid as MDY in almost any + // constellation, there is no date order (M)YD except if + // set in a format applied. + pCal->setValue( CalendarFieldIndex::MONTH, Abs(nMonth)-1 ); + sal_uInt32 nExactDateOrder = (bFormatTurn ? pFormat->GetExactDateOrder() : 0); + if ((((nExactDateOrder >> 8) & 0xff) == 'Y') && ((nExactDateOrder & 0xff) == 'D')) + { + pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) ); + pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) ); + } + else + { + pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) ); + pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) ); + } + } + break; + case 2: // month in the middle (10 Jan 94) + pCal->setValue( CalendarFieldIndex::MONTH, Abs(nMonth)-1 ); + switch (DateFmt) + { + case MDY: // yes, "10-Jan-94" is valid + case DMY: + pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) ); + pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) ); + break; + case YMD: + pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) ); + pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) ); + break; + default: + res = FALSE; + break; + } + break; + default: // else, e.g. month at the end (94 10 Jan) + res = FALSE; + break; + } // switch (nMonthPos) + break; + + default: // more than two numbers (31.12.94 8:23) (31.12. 8:23) + switch (nMonthPos) // where is the month + { + case 0: // not found + { + nCounter = 3; + if ( nTimePos > 1 ) + { // find first time number index (should only be 3 or 2 anyway) + for ( USHORT j = 0; j < nAnzNums; j++ ) + { + if ( nNums[j] == nTimePos - 2 ) + { + nCounter = j; + break; // for + } + } + } + // ISO 8601 yyyy-mm-dd forced recognition + DateFormat eDF = (MayBeIso8601() ? YMD : DateFmt); + switch (eDF) + { + case MDY: + pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) ); + pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(0) ); + if ( nCounter > 2 ) + pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(2) ); + break; + case DMY: + pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) ); + pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(1) ); + if ( nCounter > 2 ) + pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(2) ); + break; + case YMD: + if ( nCounter > 2 ) + pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(2) ); + pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(1) ); + pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) ); + break; + default: + res = FALSE; + break; + } + } + break; + case 1: // month at the beginning (Jan 01 01 8:23) + nCounter = 2; + switch (DateFmt) + { + case MDY: + pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) ); + pCal->setValue( CalendarFieldIndex::MONTH, Abs(nMonth)-1 ); + pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) ); + break; + default: + res = FALSE; + break; + } + break; + case 2: // month in the middle (10 Jan 94 8:23) + nCounter = 2; + pCal->setValue( CalendarFieldIndex::MONTH, Abs(nMonth)-1 ); + switch (DateFmt) + { + case DMY: + pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) ); + pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) ); + break; + case YMD: + pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) ); + pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) ); + break; + default: + res = FALSE; + break; + } + break; + default: // else, e.g. month at the end (94 10 Jan 8:23) + nCounter = 2; + res = FALSE; + break; + } // switch (nMonthPos) + break; + } // switch (nAnzNums) + + if ( res && pCal->isValid() ) + { + double fDiff = DateTime(*pNullDate) - pCal->getEpochStart(); + fDays = ::rtl::math::approxFloor( pCal->getLocalDateTime() ); + fDays -= fDiff; + nTryOrder = nFormatOrder; // break for + } + else + res = FALSE; + + if ( aOrgCalendar.Len() ) + pCal->loadCalendar( aOrgCalendar, pLoc->getLocale() ); // restore calendar + +#if NF_TEST_CALENDAR +{ + using namespace ::com::sun::star; + struct entry { const char* lan; const char* cou; const char* cal; }; + const entry cals[] = { + { "en", "US", "gregorian" }, + { "ar", "TN", "hijri" }, + { "he", "IL", "jewish" }, + { "ja", "JP", "gengou" }, + { "ko", "KR", "hanja_yoil" }, + { "th", "TH", "buddhist" }, + { "zh", "TW", "ROC" }, + {0,0,0} + }; + lang::Locale aLocale; + sal_Bool bValid; + sal_Int16 nDay, nMyMonth, nYear, nHour, nMinute, nSecond; + sal_Int16 nDaySet, nMonthSet, nYearSet, nHourSet, nMinuteSet, nSecondSet; + sal_Int16 nZO, nDST1, nDST2, nDST, nZOmillis, nDST1millis, nDST2millis, nDSTmillis; + sal_Int32 nZoneInMillis, nDST1InMillis, nDST2InMillis; + uno::Reference< lang::XMultiServiceFactory > xSMgr = + ::comphelper::getProcessServiceFactory(); + uno::Reference< ::com::sun::star::i18n::XExtendedCalendar > xCal( + xSMgr->createInstance( ::rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.i18n.LocaleCalendar" ) ) ), + uno::UNO_QUERY ); + for ( const entry* p = cals; p->lan; ++p ) + { + aLocale.Language = ::rtl::OUString::createFromAscii( p->lan ); + aLocale.Country = ::rtl::OUString::createFromAscii( p->cou ); + xCal->loadCalendar( ::rtl::OUString::createFromAscii( p->cal ), + aLocale ); + double nDateTime = 0.0; // 1-Jan-1970 00:00:00 + nZO = xCal->getValue( i18n::CalendarFieldIndex::ZONE_OFFSET ); + nZOmillis = xCal->getValue( i18n::CalendarFieldIndex::ZONE_OFFSET_SECOND_MILLIS ); + nZoneInMillis = static_cast(nZO) * 60000 + + (nZO < 0 ? -1 : 1) * static_cast(nZOmillis); + nDST1 = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET ); + nDST1millis = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET_SECOND_MILLIS ); + nDST1InMillis = static_cast(nDST1) * 60000 + + (nDST1 < 0 ? -1 : 1) * static_cast(nDST1millis); + nDateTime -= (double)(nZoneInMillis + nDST1InMillis) / 1000.0 / 60.0 / 60.0 / 24.0; + xCal->setDateTime( nDateTime ); + nDST2 = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET ); + nDST2millis = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET_SECOND_MILLIS ); + nDST2InMillis = static_cast(nDST2) * 60000 + + (nDST2 < 0 ? -1 : 1) * static_cast(nDST2millis); + if ( nDST1InMillis != nDST2InMillis ) + { + nDateTime = 0.0 - (double)(nZoneInMillis + nDST2InMillis) / 1000.0 / 60.0 / 60.0 / 24.0; + xCal->setDateTime( nDateTime ); + } + nDaySet = xCal->getValue( i18n::CalendarFieldIndex::DAY_OF_MONTH ); + nMonthSet = xCal->getValue( i18n::CalendarFieldIndex::MONTH ); + nYearSet = xCal->getValue( i18n::CalendarFieldIndex::YEAR ); + nHourSet = xCal->getValue( i18n::CalendarFieldIndex::HOUR ); + nMinuteSet = xCal->getValue( i18n::CalendarFieldIndex::MINUTE ); + nSecondSet = xCal->getValue( i18n::CalendarFieldIndex::SECOND ); + nZO = xCal->getValue( i18n::CalendarFieldIndex::ZONE_OFFSET ); + nZOmillis = xCal->getValue( i18n::CalendarFieldIndex::ZONE_OFFSET_SECOND_MILLIS ); + nDST = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET ); + nDSTmillis = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET_SECOND_MILLIS ); + xCal->setValue( i18n::CalendarFieldIndex::DAY_OF_MONTH, nDaySet ); + xCal->setValue( i18n::CalendarFieldIndex::MONTH, nMonthSet ); + xCal->setValue( i18n::CalendarFieldIndex::YEAR, nYearSet ); + xCal->setValue( i18n::CalendarFieldIndex::HOUR, nHourSet ); + xCal->setValue( i18n::CalendarFieldIndex::MINUTE, nMinuteSet ); + xCal->setValue( i18n::CalendarFieldIndex::SECOND, nSecondSet ); + bValid = xCal->isValid(); + nDay = xCal->getValue( i18n::CalendarFieldIndex::DAY_OF_MONTH ); + nMyMonth= xCal->getValue( i18n::CalendarFieldIndex::MONTH ); + nYear = xCal->getValue( i18n::CalendarFieldIndex::YEAR ); + nHour = xCal->getValue( i18n::CalendarFieldIndex::HOUR ); + nMinute = xCal->getValue( i18n::CalendarFieldIndex::MINUTE ); + nSecond = xCal->getValue( i18n::CalendarFieldIndex::SECOND ); + bValid = bValid && nDay == nDaySet && nMyMonth == nMonthSet && nYear == + nYearSet && nHour == nHourSet && nMinute == nMinuteSet && nSecond + == nSecondSet; + } +} +#endif // NF_TEST_CALENDAR + + } + + return res; +} + + +//--------------------------------------------------------------------------- +// ScanStartString +// +// ersten String analysieren +// Alles weg => TRUE +// sonst => FALSE + +BOOL ImpSvNumberInputScan::ScanStartString( const String& rString, + const SvNumberformat* pFormat ) +{ + xub_StrLen nPos = 0; + int nDayOfWeek; + + // First of all, eat leading blanks + SkipBlanks(rString, nPos); + + // Yes, nMatchedAllStrings should know about the sign position + nSign = GetSign(rString, nPos); + if ( nSign ) // sign? + SkipBlanks(rString, nPos); + + // #102371# match against format string only if start string is not a sign character + if ( nMatchedAllStrings && !(nSign && rString.Len() == 1) ) + { // Match against format in any case, so later on for a "x1-2-3" input + // we may distinguish between a xy-m-d (or similar) date and a x0-0-0 + // format. No sign detection here! + if ( ScanStringNumFor( rString, nPos, pFormat, 0, TRUE ) ) + nMatchedAllStrings |= nMatchedStartString; + else + nMatchedAllStrings = 0; + } + + if ( GetDecSep(rString, nPos) ) // decimal separator in start string + { + nDecPos = 1; + SkipBlanks(rString, nPos); + } + else if ( GetCurrency(rString, nPos, pFormat) ) // currency (DM 1)? + { + eScannedType = NUMBERFORMAT_CURRENCY; // !!! it IS currency !!! + SkipBlanks(rString, nPos); + if (nSign == 0) // no sign yet + { + nSign = GetSign(rString, nPos); + if ( nSign ) // DM -1 + SkipBlanks(rString, nPos); + } + } + else + { + nMonth = GetMonth(rString, nPos); + if ( nMonth ) // month (Jan 1)? + { + eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date !!! + nMonthPos = 1; // month at the beginning + if ( nMonth < 0 ) + SkipChar( '.', rString, nPos ); // abbreviated + SkipBlanks(rString, nPos); + } + else + { + nDayOfWeek = GetDayOfWeek( rString, nPos ); + if ( nDayOfWeek ) + { // day of week is just parsed away + eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date !!! + if ( nPos < rString.Len() ) + { + if ( nDayOfWeek < 0 ) + { // abbreviated + if ( rString.GetChar( nPos ) == '.' ) + ++nPos; + } + else + { // full long name + SkipBlanks(rString, nPos); + SkipString( pFormatter->GetLocaleData()->getLongDateDayOfWeekSep(), rString, nPos ); + } + SkipBlanks(rString, nPos); + nMonth = GetMonth(rString, nPos); + if ( nMonth ) // month (Jan 1)? + { + nMonthPos = 1; // month a the beginning + if ( nMonth < 0 ) + SkipChar( '.', rString, nPos ); // abbreviated + SkipBlanks(rString, nPos); + } + } + } + } + } + + if (nPos < rString.Len()) // not everything consumed + { + // Does input StartString equal StartString of format? + // This time with sign detection! + if ( !ScanStringNumFor( rString, nPos, pFormat, 0 ) ) + return MatchedReturn(); + } + + return TRUE; +} + + +//--------------------------------------------------------------------------- +// ScanMidString +// +// String in der Mitte analysieren +// Alles weg => TRUE +// sonst => FALSE + +BOOL ImpSvNumberInputScan::ScanMidString( const String& rString, + USHORT nStringPos, const SvNumberformat* pFormat ) +{ + xub_StrLen nPos = 0; + short eOldScannedType = eScannedType; + + if ( nMatchedAllStrings ) + { // Match against format in any case, so later on for a "1-2-3-4" input + // we may distinguish between a y-m-d (or similar) date and a 0-0-0-0 + // format. + if ( ScanStringNumFor( rString, 0, pFormat, nStringPos ) ) + nMatchedAllStrings |= nMatchedMidString; + else + nMatchedAllStrings = 0; + } + + SkipBlanks(rString, nPos); + if (GetDecSep(rString, nPos)) // decimal separator? + { + if (nDecPos == 1 || nDecPos == 3) // .12.4 or 1.E2.1 + return MatchedReturn(); + else if (nDecPos == 2) // . dup: 12.4. + { + if (bDecSepInDateSeps) // . also date separator + { + if ( eScannedType != NUMBERFORMAT_UNDEFINED && + eScannedType != NUMBERFORMAT_DATE && + eScannedType != NUMBERFORMAT_DATETIME) // already another type + return MatchedReturn(); + if (eScannedType == NUMBERFORMAT_UNDEFINED) + eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date + SkipBlanks(rString, nPos); + } + else + return MatchedReturn(); + } + else + { + nDecPos = 2; // . in mid string + SkipBlanks(rString, nPos); + } + } + else if ( ((eScannedType & NUMBERFORMAT_TIME) == NUMBERFORMAT_TIME) + && GetTime100SecSep( rString, nPos ) ) + { // hundredth seconds separator + if ( nDecPos ) + return MatchedReturn(); + nDecPos = 2; // . in mid string + SkipBlanks(rString, nPos); + } + + if (SkipChar('/', rString, nPos)) // fraction? + { + if ( eScannedType != NUMBERFORMAT_UNDEFINED // already another type + && eScannedType != NUMBERFORMAT_DATE) // except date + return MatchedReturn(); // => jan/31/1994 + else if ( eScannedType != NUMBERFORMAT_DATE // analyzed date until now + && ( eSetType == NUMBERFORMAT_FRACTION // and preset was fraction + || (nAnzNums == 3 // or 3 numbers + && nStringPos > 2) ) ) // and what ??? + { + SkipBlanks(rString, nPos); + eScannedType = NUMBERFORMAT_FRACTION; // !!! it IS a fraction + } + else + nPos--; // put '/' back + } + + if (GetThousandSep(rString, nPos, nStringPos)) // 1,000 + { + if ( eScannedType != NUMBERFORMAT_UNDEFINED // already another type + && eScannedType != NUMBERFORMAT_CURRENCY) // except currency + return MatchedReturn(); + nThousand++; + } + + const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData(); + const String& rDate = pFormatter->GetDateSep(); + const String& rTime = pLoc->getTimeSep(); + sal_Unicode cTime = rTime.GetChar(0); + SkipBlanks(rString, nPos); + if ( SkipString(rDate, rString, nPos) // 10., 10-, 10/ + || ((cTime != '.') && SkipChar('.', rString, nPos)) // TRICKY: + || ((cTime != '/') && SkipChar('/', rString, nPos)) // short boolean + || ((cTime != '-') && SkipChar('-', rString, nPos)) ) // evaluation! + { + if ( eScannedType != NUMBERFORMAT_UNDEFINED // already another type + && eScannedType != NUMBERFORMAT_DATE) // except date + return MatchedReturn(); + SkipBlanks(rString, nPos); + eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date + short nTmpMonth = GetMonth(rString, nPos); // 10. Jan 94 + if (nMonth && nTmpMonth) // month dup + return MatchedReturn(); + if (nTmpMonth) + { + nMonth = nTmpMonth; + nMonthPos = 2; // month in the middle + if ( nMonth < 0 && SkipChar( '.', rString, nPos ) ) + ; // short month may be abbreviated Jan. + else if ( SkipChar( '-', rString, nPos ) ) + ; // #79632# recognize 17-Jan-2001 to be a date + // #99065# short and long month name + else + SkipString( pLoc->getLongDateMonthSep(), rString, nPos ); + SkipBlanks(rString, nPos); + } + } + + short nTempMonth = GetMonth(rString, nPos); // month in the middle (10 Jan 94) + if (nTempMonth) + { + if (nMonth != 0) // month dup + return MatchedReturn(); + if ( eScannedType != NUMBERFORMAT_UNDEFINED // already another type + && eScannedType != NUMBERFORMAT_DATE) // except date + return MatchedReturn(); + eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date + nMonth = nTempMonth; + nMonthPos = 2; // month in the middle + if ( nMonth < 0 ) + SkipChar( '.', rString, nPos ); // abbreviated + SkipString( pLoc->getLongDateMonthSep(), rString, nPos ); + SkipBlanks(rString, nPos); + } + + if ( SkipChar('E', rString, nPos) // 10E, 10e, 10,Ee + || SkipChar('e', rString, nPos) ) + { + if (eScannedType != NUMBERFORMAT_UNDEFINED) // already another type + return MatchedReturn(); + else + { + SkipBlanks(rString, nPos); + eScannedType = NUMBERFORMAT_SCIENTIFIC; // !!! it IS scientific + if ( nThousand+2 == nAnzNums // special case 1.E2 + && nDecPos == 2 ) + nDecPos = 3; // 1,100.E2 1,100,100.E3 + } + nESign = GetESign(rString, nPos); // signed exponent? + SkipBlanks(rString, nPos); + } + + if ( SkipString(rTime, rString, nPos) ) // time separator? + { + if (nDecPos) // already . => maybe error + { + if (bDecSepInDateSeps) // . also date sep + { + if ( eScannedType != NUMBERFORMAT_DATE && // already another type than date + eScannedType != NUMBERFORMAT_DATETIME) // or date time + return MatchedReturn(); + if (eScannedType == NUMBERFORMAT_DATE) + nDecPos = 0; // reset for time transition + } + else + return MatchedReturn(); + } + if ( ( eScannedType == NUMBERFORMAT_DATE // already date type + || eScannedType == NUMBERFORMAT_DATETIME) // or date time + && nAnzNums > 3) // and more than 3 numbers? (31.Dez.94 8:23) + { + SkipBlanks(rString, nPos); + eScannedType = NUMBERFORMAT_DATETIME; // !!! it IS date with time + } + else if ( eScannedType != NUMBERFORMAT_UNDEFINED // already another type + && eScannedType != NUMBERFORMAT_TIME) // except time + return MatchedReturn(); + else + { + SkipBlanks(rString, nPos); + eScannedType = NUMBERFORMAT_TIME; // !!! it IS a time + } + if ( !nTimePos ) + nTimePos = nStringPos + 1; + } + + if (nPos < rString.Len()) + { + switch (eScannedType) + { + case NUMBERFORMAT_DATE: + if (nMonthPos == 1 && pLoc->getLongDateFormat() == MDY) + { + // #68232# recognize long date separators like ", " in "September 5, 1999" + if (SkipString( pLoc->getLongDateDaySep(), rString, nPos )) + SkipBlanks( rString, nPos ); + } + else if (nStringPos == 5 && nPos == 0 && rString.Len() == 1 && + rString.GetChar(0) == 'T' && MayBeIso8601()) + { + // ISO 8601 combined date and time, yyyy-mm-ddThh:mm + ++nPos; + } + break; +#if NF_RECOGNIZE_ISO8601_TIMEZONES + case NUMBERFORMAT_DATETIME: + if (nPos == 0 && rString.Len() == 1 && nStringPos >= 9 && + MayBeIso8601()) + { + // ISO 8601 timezone offset + switch (rString.GetChar(0)) + { + case '+': + case '-': + if (nStringPos == nAnzStrings-2 || + nStringPos == nAnzStrings-4) + { + ++nPos; // yyyy-mm-ddThh:mm[:ss]+xx[[:]yy] + // nTimezonePos needed for GetTimeRef() + if (!nTimezonePos) + nTimezonePos = nStringPos + 1; + } + break; + case ':': + if (nTimezonePos && nStringPos >= 11 && + nStringPos == nAnzStrings-2) + ++nPos; // yyyy-mm-ddThh:mm[:ss]+xx:yy + break; + } + } + break; +#endif + } + } + + if (nPos < rString.Len()) // not everything consumed? + { + if ( nMatchedAllStrings & ~nMatchedVirgin ) + eScannedType = eOldScannedType; + else + return FALSE; + } + + return TRUE; +} + + +//--------------------------------------------------------------------------- +// ScanEndString +// +// Schlussteil analysieren +// Alles weg => TRUE +// sonst => FALSE + +BOOL ImpSvNumberInputScan::ScanEndString( const String& rString, + const SvNumberformat* pFormat ) +{ + xub_StrLen nPos = 0; + + if ( nMatchedAllStrings ) + { // Match against format in any case, so later on for a "1-2-3-4" input + // we may distinguish between a y-m-d (or similar) date and a 0-0-0-0 + // format. + if ( ScanStringNumFor( rString, 0, pFormat, 0xFFFF ) ) + nMatchedAllStrings |= nMatchedEndString; + else + nMatchedAllStrings = 0; + } + + SkipBlanks(rString, nPos); + if (GetDecSep(rString, nPos)) // decimal separator? + { + if (nDecPos == 1 || nDecPos == 3) // .12.4 or 12.E4. + return MatchedReturn(); + else if (nDecPos == 2) // . dup: 12.4. + { + if (bDecSepInDateSeps) // . also date sep + { + if ( eScannedType != NUMBERFORMAT_UNDEFINED && + eScannedType != NUMBERFORMAT_DATE && + eScannedType != NUMBERFORMAT_DATETIME) // already another type + return MatchedReturn(); + if (eScannedType == NUMBERFORMAT_UNDEFINED) + eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date + SkipBlanks(rString, nPos); + } + else + return MatchedReturn(); + } + else + { + nDecPos = 3; // . in end string + SkipBlanks(rString, nPos); + } + } + + if ( nSign == 0 // conflict - not signed + && eScannedType != NUMBERFORMAT_DATE) // and not date +//!? catch time too? + { // not signed yet + nSign = GetSign(rString, nPos); // 1- DM + if (nNegCheck) // '(' as sign + return MatchedReturn(); + } + + SkipBlanks(rString, nPos); + if (nNegCheck && SkipChar(')', rString, nPos)) // skip ')' if appropriate + { + nNegCheck = 0; + SkipBlanks(rString, nPos); + } + + if ( GetCurrency(rString, nPos, pFormat) ) // currency symbol? + { + if (eScannedType != NUMBERFORMAT_UNDEFINED) // currency dup + return MatchedReturn(); + else + { + SkipBlanks(rString, nPos); + eScannedType = NUMBERFORMAT_CURRENCY; + } // behind currency a '-' is allowed + if (nSign == 0) // not signed yet + { + nSign = GetSign(rString, nPos); // DM - + SkipBlanks(rString, nPos); + if (nNegCheck) // 3 DM ( + return MatchedReturn(); + } + if ( nNegCheck && eScannedType == NUMBERFORMAT_CURRENCY + && SkipChar(')', rString, nPos) ) + { + nNegCheck = 0; // ')' skipped + SkipBlanks(rString, nPos); // only if currency + } + } + + if ( SkipChar('%', rString, nPos) ) // 1 % + { + if (eScannedType != NUMBERFORMAT_UNDEFINED) // already another type + return MatchedReturn(); + SkipBlanks(rString, nPos); + eScannedType = NUMBERFORMAT_PERCENT; + } + + const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData(); + const String& rDate = pFormatter->GetDateSep(); + const String& rTime = pLoc->getTimeSep(); + if ( SkipString(rTime, rString, nPos) ) // 10: + { + if (nDecPos) // already , => error + return MatchedReturn(); + if (eScannedType == NUMBERFORMAT_DATE && nAnzNums > 2) // 31.Dez.94 8: + { + SkipBlanks(rString, nPos); + eScannedType = NUMBERFORMAT_DATETIME; + } + else if (eScannedType != NUMBERFORMAT_UNDEFINED && + eScannedType != NUMBERFORMAT_TIME) // already another type + return MatchedReturn(); + else + { + SkipBlanks(rString, nPos); + eScannedType = NUMBERFORMAT_TIME; + } + if ( !nTimePos ) + nTimePos = nAnzStrings; + } + + sal_Unicode cTime = rTime.GetChar(0); + if ( SkipString(rDate, rString, nPos) // 10., 10-, 10/ + || ((cTime != '.') && SkipChar('.', rString, nPos)) // TRICKY: + || ((cTime != '/') && SkipChar('/', rString, nPos)) // short boolean + || ((cTime != '-') && SkipChar('-', rString, nPos)) ) // evaluation! + { + if (eScannedType != NUMBERFORMAT_UNDEFINED && + eScannedType != NUMBERFORMAT_DATE) // already another type + return MatchedReturn(); + else + { + SkipBlanks(rString, nPos); + eScannedType = NUMBERFORMAT_DATE; + } + short nTmpMonth = GetMonth(rString, nPos); // 10. Jan + if (nMonth && nTmpMonth) // month dup + return MatchedReturn(); + if (nTmpMonth) + { + nMonth = nTmpMonth; + nMonthPos = 3; // month at end + if ( nMonth < 0 ) + SkipChar( '.', rString, nPos ); // abbreviated + SkipBlanks(rString, nPos); + } + } + + short nTempMonth = GetMonth(rString, nPos); // 10 Jan + if (nTempMonth) + { + if (nMonth) // month dup + return MatchedReturn(); + if (eScannedType != NUMBERFORMAT_UNDEFINED && + eScannedType != NUMBERFORMAT_DATE) // already another type + return MatchedReturn(); + eScannedType = NUMBERFORMAT_DATE; + nMonth = nTempMonth; + nMonthPos = 3; // month at end + if ( nMonth < 0 ) + SkipChar( '.', rString, nPos ); // abbreviated + SkipBlanks(rString, nPos); + } + + xub_StrLen nOrigPos = nPos; + if (GetTimeAmPm(rString, nPos)) + { + if (eScannedType != NUMBERFORMAT_UNDEFINED && + eScannedType != NUMBERFORMAT_TIME && + eScannedType != NUMBERFORMAT_DATETIME) // already another type + return MatchedReturn(); + else + { + // If not already scanned as time, 6.78am does not result in 6 + // seconds and 78 hundredths in the morning. Keep as suffix. + if (eScannedType != NUMBERFORMAT_TIME && nDecPos == 2 && nAnzNums == 2) + nPos = nOrigPos; // rewind am/pm + else + { + SkipBlanks(rString, nPos); + if ( eScannedType != NUMBERFORMAT_DATETIME ) + eScannedType = NUMBERFORMAT_TIME; + } + } + } + + if ( nNegCheck && SkipChar(')', rString, nPos) ) + { + if (eScannedType == NUMBERFORMAT_CURRENCY) // only if currency + { + nNegCheck = 0; // skip ')' + SkipBlanks(rString, nPos); + } + else + return MatchedReturn(); + } + + if ( nPos < rString.Len() && + (eScannedType == NUMBERFORMAT_DATE + || eScannedType == NUMBERFORMAT_DATETIME) ) + { // day of week is just parsed away + xub_StrLen nOldPos = nPos; + const String& rSep = pFormatter->GetLocaleData()->getLongDateDayOfWeekSep(); + if ( StringContains( rSep, rString, nPos ) ) + { + nPos = nPos + rSep.Len(); + SkipBlanks(rString, nPos); + } + int nDayOfWeek = GetDayOfWeek( rString, nPos ); + if ( nDayOfWeek ) + { + if ( nPos < rString.Len() ) + { + if ( nDayOfWeek < 0 ) + { // short + if ( rString.GetChar( nPos ) == '.' ) + ++nPos; + } + SkipBlanks(rString, nPos); + } + } + else + nPos = nOldPos; + } + +#if NF_RECOGNIZE_ISO8601_TIMEZONES + if (nPos == 0 && eScannedType == NUMBERFORMAT_DATETIME && + rString.Len() == 1 && rString.GetChar(0) == 'Z' && MayBeIso8601()) + { + // ISO 8601 timezone UTC yyyy-mm-ddThh:mmZ + ++nPos; + } +#endif + + if (nPos < rString.Len()) // everything consumed? + { + // does input EndString equal EndString in Format? + if ( !ScanStringNumFor( rString, nPos, pFormat, 0xFFFF ) ) + return FALSE; + } + + return TRUE; +} + + +BOOL ImpSvNumberInputScan::ScanStringNumFor( + const String& rString, // String to scan + xub_StrLen nPos, // Position until which was consumed + const SvNumberformat* pFormat, // The format to match + USHORT nString, // Substring of format, 0xFFFF => last + BOOL bDontDetectNegation // Suppress sign detection + ) +{ + if ( !pFormat ) + return FALSE; + const ::utl::TransliterationWrapper* pTransliteration = pFormatter->GetTransliteration(); + const String* pStr; + String aString( rString ); + BOOL bFound = FALSE; + BOOL bFirst = TRUE; + BOOL bContinue = TRUE; + USHORT nSub; + do + { + // Don't try "lower" subformats ff the very first match was the second + // or third subformat. + nSub = nStringScanNumFor; + do + { // Step through subformats, first positive, then negative, then + // other, but not the last (text) subformat. + pStr = pFormat->GetNumForString( nSub, nString, TRUE ); + if ( pStr && pTransliteration->isEqual( aString, *pStr ) ) + { + bFound = TRUE; + bContinue = FALSE; + } + else if ( nSub < 2 ) + ++nSub; + else + bContinue = FALSE; + } while ( bContinue ); + if ( !bFound && bFirst && nPos ) + { // try remaining substring + bFirst = FALSE; + aString.Erase( 0, nPos ); + bContinue = TRUE; + } + } while ( bContinue ); + + if ( !bFound ) + { + if ( !bDontDetectNegation && (nString == 0) && !bFirst && (nSign < 0) + && pFormat->IsNegativeRealNegative() ) + { // simply negated twice? --1 + aString.EraseAllChars( ' ' ); + if ( (aString.Len() == 1) && (aString.GetChar(0) == '-') ) + { + bFound = TRUE; + nStringScanSign = -1; + nSub = 0; //! not 1 + } + } + if ( !bFound ) + return FALSE; + } + else if ( !bDontDetectNegation && (nSub == 1) && + pFormat->IsNegativeRealNegative() ) + { // negative + if ( nStringScanSign < 0 ) + { + if ( (nSign < 0) && (nStringScanNumFor != 1) ) + nStringScanSign = 1; // triple negated --1 yyy + } + else if ( nStringScanSign == 0 ) + { + if ( nSign < 0 ) + { // nSign and nStringScanSign will be combined later, + // flip sign if doubly negated + if ( (nString == 0) && !bFirst + && SvNumberformat::HasStringNegativeSign( aString ) ) + nStringScanSign = -1; // direct double negation + else if ( pFormat->IsNegativeWithoutSign() ) + nStringScanSign = -1; // indirect double negation + } + else + nStringScanSign = -1; + } + else // > 0 + nStringScanSign = -1; + } + nStringScanNumFor = nSub; + return TRUE; +} + + +//--------------------------------------------------------------------------- +// IsNumberFormatMain +// +// Recognizes types of number, exponential, fraction, percent, currency, date, time. +// Else text => return FALSE + +BOOL ImpSvNumberInputScan::IsNumberFormatMain( + const String& rString, // string to be analyzed + double& , // OUT: result as number, if possible + const SvNumberformat* pFormat ) // maybe number format set to match against +{ + Reset(); + NumberStringDivision( rString ); // breakdown into strings and numbers + if (nAnzStrings >= SV_MAX_ANZ_INPUT_STRINGS) // too many elements + return FALSE; // Njet, Nope, ... + + if (nAnzNums == 0) // no number in input + { + if ( nAnzStrings > 0 ) + { + // Here we may change the original, we don't need it anymore. + // This saves copies and ToUpper() in GetLogical() and is faster. + String& rStrArray = sStrArray[0]; + rStrArray.EraseTrailingChars( ' ' ); + rStrArray.EraseLeadingChars( ' ' ); + nLogical = GetLogical( rStrArray ); + if ( nLogical ) + { + eScannedType = NUMBERFORMAT_LOGICAL; // !!! it's a BOOLEAN + nMatchedAllStrings &= ~nMatchedVirgin; + return TRUE; + } + else + return FALSE; // simple text + } + else + return FALSE; // simple text + } + + USHORT i = 0; // mark any symbol + USHORT j = 0; // mark only numbers + + switch ( nAnzNums ) + { + case 1 : // Exactly 1 number in input + { // nAnzStrings >= 1 + if (GetNextNumber(i,j)) // i=1,0 + { // Number at start + if (eSetType == NUMBERFORMAT_FRACTION) // Fraction 1 = 1/1 + { + if (i >= nAnzStrings || // no end string nor decimal separator + sStrArray[i] == pFormatter->GetNumDecimalSep()) + { + eScannedType = NUMBERFORMAT_FRACTION; + nMatchedAllStrings &= ~nMatchedVirgin; + return TRUE; + } + } + } + else + { // Analyze start string + if (!ScanStartString( sStrArray[i], pFormat )) // i=0 + return FALSE; // already an error + i++; // next symbol, i=1 + } + GetNextNumber(i,j); // i=1,2 + if (eSetType == NUMBERFORMAT_FRACTION) // Fraction -1 = -1/1 + { + if (nSign && !nNegCheck && // Sign +, - + eScannedType == NUMBERFORMAT_UNDEFINED && // not date or currency + nDecPos == 0 && // no previous decimal separator + (i >= nAnzStrings || // no end string nor decimal separator + sStrArray[i] == pFormatter->GetNumDecimalSep()) + ) + { + eScannedType = NUMBERFORMAT_FRACTION; + nMatchedAllStrings &= ~nMatchedVirgin; + return TRUE; + } + } + if (i < nAnzStrings && !ScanEndString( sStrArray[i], pFormat )) + return FALSE; + } + break; + case 2 : // Exactly 2 numbers in input + { // nAnzStrings >= 3 + if (!GetNextNumber(i,j)) // i=1,0 + { // Analyze start string + if (!ScanStartString( sStrArray[i], pFormat )) + return FALSE; // already an error + i++; // i=1 + } + GetNextNumber(i,j); // i=1,2 + if ( !ScanMidString( sStrArray[i], i, pFormat ) ) + return FALSE; + i++; // next symbol, i=2,3 + GetNextNumber(i,j); // i=3,4 + if (i < nAnzStrings && !ScanEndString( sStrArray[i], pFormat )) + return FALSE; + if (eSetType == NUMBERFORMAT_FRACTION) // -1,200. as fraction + { + if (!nNegCheck && // no sign '(' + eScannedType == NUMBERFORMAT_UNDEFINED && + (nDecPos == 0 || nDecPos == 3) // no decimal separator or at end + ) + { + eScannedType = NUMBERFORMAT_FRACTION; + nMatchedAllStrings &= ~nMatchedVirgin; + return TRUE; + } + } + } + break; + case 3 : // Exactly 3 numbers in input + { // nAnzStrings >= 5 + if (!GetNextNumber(i,j)) // i=1,0 + { // Analyze start string + if (!ScanStartString( sStrArray[i], pFormat )) + return FALSE; // already an error + i++; // i=1 + if (nDecPos == 1) // decimal separator at start => error + return FALSE; + } + GetNextNumber(i,j); // i=1,2 + if ( !ScanMidString( sStrArray[i], i, pFormat ) ) + return FALSE; + i++; // i=2,3 + if (eScannedType == NUMBERFORMAT_SCIENTIFIC) // E only at end + return FALSE; + GetNextNumber(i,j); // i=3,4 + if ( !ScanMidString( sStrArray[i], i, pFormat ) ) + return FALSE; + i++; // i=4,5 + GetNextNumber(i,j); // i=5,6 + if (i < nAnzStrings && !ScanEndString( sStrArray[i], pFormat )) + return FALSE; + if (eSetType == NUMBERFORMAT_FRACTION) // -1,200,100. as fraction + { + if (!nNegCheck && // no sign '(' + eScannedType == NUMBERFORMAT_UNDEFINED && + (nDecPos == 0 || nDecPos == 3) // no decimal separator or at end + ) + { + eScannedType = NUMBERFORMAT_FRACTION; + nMatchedAllStrings &= ~nMatchedVirgin; + return TRUE; + } + } + if ( eScannedType == NUMBERFORMAT_FRACTION && nDecPos ) + return FALSE; // #36857# not a real fraction + } + break; + default: // More than 3 numbers in input + { // nAnzStrings >= 7 + if (!GetNextNumber(i,j)) // i=1,0 + { // Analyze startstring + if (!ScanStartString( sStrArray[i], pFormat )) + return FALSE; // already an error + i++; // i=1 + if (nDecPos == 1) // decimal separator at start => error + return FALSE; + } + GetNextNumber(i,j); // i=1,2 + if ( !ScanMidString( sStrArray[i], i, pFormat ) ) + return FALSE; + i++; // i=2,3 + USHORT nThOld = 10; // just not 0 or 1 + while (nThOld != nThousand && j < nAnzNums-1) + // Execute at least one time + // but leave one number. + { // Loop over group separators + nThOld = nThousand; + if (eScannedType == NUMBERFORMAT_SCIENTIFIC) // E only at end + return FALSE; + GetNextNumber(i,j); + if ( i < nAnzStrings && !ScanMidString( sStrArray[i], i, pFormat ) ) + return FALSE; + i++; + } + if (eScannedType == NUMBERFORMAT_DATE || // long date or + eScannedType == NUMBERFORMAT_TIME || // long time or + eScannedType == NUMBERFORMAT_UNDEFINED) // long number + { + for (USHORT k = j; k < nAnzNums-1; k++) + { + if (eScannedType == NUMBERFORMAT_SCIENTIFIC) // E only at endd + return FALSE; + GetNextNumber(i,j); + if ( i < nAnzStrings && !ScanMidString( sStrArray[i], i, pFormat ) ) + return FALSE; + i++; + } + } + GetNextNumber(i,j); + if (i < nAnzStrings && !ScanEndString( sStrArray[i], pFormat )) + return FALSE; + if (eSetType == NUMBERFORMAT_FRACTION) // -1,200,100. as fraction + { + if (!nNegCheck && // no sign '(' + eScannedType == NUMBERFORMAT_UNDEFINED && + (nDecPos == 0 || nDecPos == 3) // no decimal separator or at end + ) + { + eScannedType = NUMBERFORMAT_FRACTION; + nMatchedAllStrings &= ~nMatchedVirgin; + return TRUE; + } + } + if ( eScannedType == NUMBERFORMAT_FRACTION && nDecPos ) + return FALSE; // #36857# not a real fraction + } + } + + if (eScannedType == NUMBERFORMAT_UNDEFINED) + { + nMatchedAllStrings &= ~nMatchedVirgin; + // did match including nMatchedUsedAsReturn + BOOL bDidMatch = (nMatchedAllStrings != 0); + if ( nMatchedAllStrings ) + { + BOOL bMatch = (pFormat ? pFormat->IsNumForStringElementCountEqual( + nStringScanNumFor, nAnzStrings, nAnzNums ) : FALSE); + if ( !bMatch ) + nMatchedAllStrings = 0; + } + if ( nMatchedAllStrings ) + eScannedType = eSetType; + else if ( bDidMatch ) + return FALSE; + else + eScannedType = NUMBERFORMAT_NUMBER; + // everything else should have been recognized by now + } + else if ( eScannedType == NUMBERFORMAT_DATE ) + { // the very relaxed date input checks may interfere with a preset format + nMatchedAllStrings &= ~nMatchedVirgin; + BOOL bWasReturn = ((nMatchedAllStrings & nMatchedUsedAsReturn) != 0); + if ( nMatchedAllStrings ) + { + BOOL bMatch = (pFormat ? pFormat->IsNumForStringElementCountEqual( + nStringScanNumFor, nAnzStrings, nAnzNums ) : FALSE); + if ( !bMatch ) + nMatchedAllStrings = 0; + } + if ( nMatchedAllStrings ) + eScannedType = eSetType; + else if ( bWasReturn ) + return FALSE; + } + else + nMatchedAllStrings = 0; // reset flag to no substrings matched + + return TRUE; +} + + +//--------------------------------------------------------------------------- +// return TRUE or FALSE depending on the nMatched... state and remember usage +BOOL ImpSvNumberInputScan::MatchedReturn() +{ + if ( nMatchedAllStrings & ~nMatchedVirgin ) + { + nMatchedAllStrings |= nMatchedUsedAsReturn; + return TRUE; + } + return FALSE; +} + + +//--------------------------------------------------------------------------- +// Initialize uppercase months and weekdays + +void ImpSvNumberInputScan::InitText() +{ + sal_Int32 j, nElems; + const CharClass* pChrCls = pFormatter->GetCharClass(); + const CalendarWrapper* pCal = pFormatter->GetCalendar(); + delete [] pUpperMonthText; + delete [] pUpperAbbrevMonthText; + ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > xElems + = pCal->getMonths(); + nElems = xElems.getLength(); + pUpperMonthText = new String[nElems]; + pUpperAbbrevMonthText = new String[nElems]; + for ( j=0; jupper( xElems[j].FullName ); + pUpperAbbrevMonthText[j] = pChrCls->upper( xElems[j].AbbrevName ); + } + delete [] pUpperDayText; + delete [] pUpperAbbrevDayText; + xElems = pCal->getDays(); + nElems = xElems.getLength(); + pUpperDayText = new String[nElems]; + pUpperAbbrevDayText = new String[nElems]; + for ( j=0; jupper( xElems[j].FullName ); + pUpperAbbrevDayText[j] = pChrCls->upper( xElems[j].AbbrevName ); + } + bTextInitialized = TRUE; +} + + +//=========================================================================== +// P U B L I C + +//--------------------------------------------------------------------------- +// ChangeIntl +// +// MUST be called if International/Locale is changed + +void ImpSvNumberInputScan::ChangeIntl() +{ + sal_Unicode cDecSep = pFormatter->GetNumDecimalSep().GetChar(0); + bDecSepInDateSeps = ( cDecSep == '-' || + cDecSep == '/' || + cDecSep == '.' || + cDecSep == pFormatter->GetDateSep().GetChar(0) ); + bTextInitialized = FALSE; + aUpperCurrSymbol.Erase(); +} + + +//--------------------------------------------------------------------------- +// ChangeNullDate + +void ImpSvNumberInputScan::ChangeNullDate( + const USHORT Day, + const USHORT Month, + const USHORT Year ) +{ + if ( pNullDate ) + *pNullDate = Date(Day, Month, Year); + else + pNullDate = new Date(Day, Month, Year); +} + + +//--------------------------------------------------------------------------- +// IsNumberFormat +// +// => does rString represent a number (also date, time et al) + +BOOL ImpSvNumberInputScan::IsNumberFormat( + const String& rString, // string to be analyzed + short& F_Type, // IN: old type, OUT: new type + double& fOutNumber, // OUT: number if convertable + const SvNumberformat* pFormat ) // maybe a number format to match against +{ + String sResString; + String aString; + BOOL res; // return value + eSetType = F_Type; // old type set + + if ( !rString.Len() ) + res = FALSE; + else if (rString.Len() > 308) // arbitrary + res = FALSE; + else + { + // NoMoreUpperNeeded, all comparisons on UpperCase + aString = pFormatter->GetCharClass()->upper( rString ); + // convert native number to ASCII if necessary + TransformInput( aString ); + res = IsNumberFormatMain( aString, fOutNumber, pFormat ); + } + + if (res) + { + if ( nNegCheck // ')' not found for '(' + || (nSign && (eScannedType == NUMBERFORMAT_DATE + || eScannedType == NUMBERFORMAT_DATETIME)) + ) // signed date/datetime + res = FALSE; + else + { // check count of partial number strings + switch (eScannedType) + { + case NUMBERFORMAT_PERCENT: + case NUMBERFORMAT_CURRENCY: + case NUMBERFORMAT_NUMBER: + if (nDecPos == 1) // .05 + { + // matched MidStrings function like group separators + if ( nMatchedAllStrings ) + nThousand = nAnzNums - 1; + else if ( nAnzNums != 1 ) + res = FALSE; + } + else if (nDecPos == 2) // 1.05 + { + // matched MidStrings function like group separators + if ( nMatchedAllStrings ) + nThousand = nAnzNums - 1; + else if ( nAnzNums != nThousand+2 ) + res = FALSE; + } + else // 1,100 or 1,100. + { + // matched MidStrings function like group separators + if ( nMatchedAllStrings ) + nThousand = nAnzNums - 1; + else if ( nAnzNums != nThousand+1 ) + res = FALSE; + } + break; + + case NUMBERFORMAT_SCIENTIFIC: // 1.0e-2 + if (nDecPos == 1) // .05 + { + if (nAnzNums != 2) + res = FALSE; + } + else if (nDecPos == 2) // 1.05 + { + if (nAnzNums != nThousand+3) + res = FALSE; + } + else // 1,100 or 1,100. + { + if (nAnzNums != nThousand+2) + res = FALSE; + } + break; + + case NUMBERFORMAT_DATE: + if (nMonth) + { // month name and numbers + if (nAnzNums > 2) + res = FALSE; + } + else + { + if (nAnzNums > 3) + res = FALSE; + } + break; + + case NUMBERFORMAT_TIME: + if (nDecPos) + { // hundredth seconds included + if (nAnzNums > 4) + res = FALSE; + } + else + { + if (nAnzNums > 3) + res = FALSE; + } + break; + + case NUMBERFORMAT_DATETIME: + if (nMonth) + { // month name and numbers + if (nDecPos) + { // hundredth seconds included + if (nAnzNums > 6) + res = FALSE; + } + else + { + if (nAnzNums > 5) + res = FALSE; + } + } + else + { + if (nDecPos) + { // hundredth seconds included + if (nAnzNums > 7) + res = FALSE; + } + else + { + if (nAnzNums > 6) + res = FALSE; + } + } + break; + + default: + break; + } // switch + } // else + } // if (res) + + if (res) + { // we finally have a number + switch (eScannedType) + { + case NUMBERFORMAT_LOGICAL: + if (nLogical == 1) + fOutNumber = 1.0; // True + else if (nLogical == -1) + fOutNumber = 0.0; // False + else + res = FALSE; // Oops + break; + + case NUMBERFORMAT_PERCENT: + case NUMBERFORMAT_CURRENCY: + case NUMBERFORMAT_NUMBER: + case NUMBERFORMAT_SCIENTIFIC: + case NUMBERFORMAT_DEFINED: // if no category detected handle as number + { + if ( nDecPos == 1 ) // . at start + sResString.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "0." ) ); + else + sResString.Erase(); + USHORT k; + for ( k = 0; k <= nThousand; k++) + sResString += sStrArray[nNums[k]]; // integer part + if ( nDecPos == 2 && k < nAnzNums ) // . somewhere + { + sResString += '.'; + USHORT nStop = (eScannedType == NUMBERFORMAT_SCIENTIFIC ? + nAnzNums-1 : nAnzNums); + for ( ; k < nStop; k++) + sResString += sStrArray[nNums[k]]; // fractional part + } + + if (eScannedType != NUMBERFORMAT_SCIENTIFIC) + fOutNumber = StringToDouble(sResString); + else + { // append exponent + sResString += 'E'; + if ( nESign == -1 ) + sResString += '-'; + sResString += sStrArray[nNums[nAnzNums-1]]; + rtl_math_ConversionStatus eStatus; + fOutNumber = ::rtl::math::stringToDouble( + sResString, '.', ',', &eStatus, NULL ); + if ( eStatus == rtl_math_ConversionStatus_OutOfRange ) + { + F_Type = NUMBERFORMAT_TEXT; // overflow/underflow -> Text + if (nESign == -1) + fOutNumber = 0.0; + else + fOutNumber = DBL_MAX; +/*!*/ return TRUE; + } + } + + if ( nStringScanSign ) + { + if ( nSign ) + nSign *= nStringScanSign; + else + nSign = nStringScanSign; + } + if ( nSign < 0 ) + fOutNumber = -fOutNumber; + + if (eScannedType == NUMBERFORMAT_PERCENT) + fOutNumber/= 100.0; + } + break; + + case NUMBERFORMAT_FRACTION: + if (nAnzNums == 1) + fOutNumber = StringToDouble(sStrArray[nNums[0]]); + else if (nAnzNums == 2) + { + if (nThousand == 1) + { + sResString = sStrArray[nNums[0]]; + sResString += sStrArray[nNums[1]]; // integer part + fOutNumber = StringToDouble(sResString); + } + else + { + double fZaehler = StringToDouble(sStrArray[nNums[0]]); + double fNenner = StringToDouble(sStrArray[nNums[1]]); + if (fNenner != 0.0) + fOutNumber = fZaehler/fNenner; + else + res = FALSE; + } + } + else // nAnzNums > 2 + { + USHORT k = 1; + sResString = sStrArray[nNums[0]]; + if (nThousand > 0) + for (k = 1; k <= nThousand; k++) + sResString += sStrArray[nNums[k]]; + fOutNumber = StringToDouble(sResString); + + if (k == nAnzNums-2) + { + double fZaehler = StringToDouble(sStrArray[nNums[k]]); + double fNenner = StringToDouble(sStrArray[nNums[k+1]]); + if (fNenner != 0.0) + fOutNumber += fZaehler/fNenner; + else + res = FALSE; + } + } + + if ( nStringScanSign ) + { + if ( nSign ) + nSign *= nStringScanSign; + else + nSign = nStringScanSign; + } + if ( nSign < 0 ) + fOutNumber = -fOutNumber; + break; + + case NUMBERFORMAT_TIME: + GetTimeRef(fOutNumber, 0, nAnzNums); + if ( nSign < 0 ) + fOutNumber = -fOutNumber; + break; + + case NUMBERFORMAT_DATE: + { + USHORT nCounter = 0; // dummy here + res = GetDateRef( fOutNumber, nCounter, pFormat ); + } + break; + + case NUMBERFORMAT_DATETIME: + { + USHORT nCounter = 0; // needed here + res = GetDateRef( fOutNumber, nCounter, pFormat ); + if ( res ) + { + double fTime; + GetTimeRef( fTime, nCounter, nAnzNums - nCounter ); + fOutNumber += fTime; + } + } + break; + + default: + DBG_ERRORFILE( "Some number recognized but what's it?" ); + fOutNumber = 0.0; + break; + } + } + + if (res) // overflow/underflow -> Text + { + if (fOutNumber < -DBL_MAX) // -1.7E308 + { + F_Type = NUMBERFORMAT_TEXT; + fOutNumber = -DBL_MAX; + return TRUE; + } + else if (fOutNumber > DBL_MAX) // 1.7E308 + { + F_Type = NUMBERFORMAT_TEXT; + fOutNumber = DBL_MAX; + return TRUE; + } + } + + if (res == FALSE) + { + eScannedType = NUMBERFORMAT_TEXT; + fOutNumber = 0.0; + } + + F_Type = eScannedType; + return res; +} + + + diff --git a/svl/source/numbers/zforfind.hxx b/svl/source/numbers/zforfind.hxx new file mode 100644 index 000000000000..049925f2034f --- /dev/null +++ b/svl/source/numbers/zforfind.hxx @@ -0,0 +1,291 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: zforfind.hxx,v $ + * $Revision: 1.13 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _ZFORFIND_HXX +#define _ZFORFIND_HXX + +#include + +class Date; +class SvNumberformat; +class SvNumberFormatter; + +#define SV_MAX_ANZ_INPUT_STRINGS 20 // max count of substrings in input scanner + +class ImpSvNumberInputScan +{ +public: + ImpSvNumberInputScan( SvNumberFormatter* pFormatter ); + ~ImpSvNumberInputScan(); + +/*!*/ void ChangeIntl(); // MUST be called if language changes + + /// set reference date for offset calculation + void ChangeNullDate( + const USHORT nDay, + const USHORT nMonth, + const USHORT nYear ); + + /// convert input string to number + BOOL IsNumberFormat( + const String& rString, /// input string + short& F_Type, /// format type (in + out) + double& fOutNumber, /// value determined (out) + const SvNumberformat* pFormat = NULL /// optional a number format to which compare against + ); + + /// after IsNumberFormat: get decimal position + short GetDecPos() const { return nDecPos; } + /// after IsNumberFormat: get count of numeric substrings in input string + USHORT GetAnzNums() const { return nAnzNums; } + + /// set threshold of two-digit year input + void SetYear2000( USHORT nVal ) { nYear2000 = nVal; } + /// get threshold of two-digit year input + USHORT GetYear2000() const { return nYear2000; } + +private: + SvNumberFormatter* pFormatter; + String* pUpperMonthText; // Array of month names, uppercase + String* pUpperAbbrevMonthText; // Array of month names, abbreviated, uppercase + String* pUpperDayText; // Array of day of week names, uppercase + String* pUpperAbbrevDayText; // Array of day of week names, abbreviated, uppercase + String aUpperCurrSymbol; // Currency symbol, uppercase + BOOL bTextInitialized; // Whether days and months are initialized + Date* pNullDate; // 30Dec1899 + // Variables for provisional results: + String sStrArray[SV_MAX_ANZ_INPUT_STRINGS]; // Array of scanned substrings + BOOL IsNum[SV_MAX_ANZ_INPUT_STRINGS]; // Whether a substring is numeric + USHORT nNums[SV_MAX_ANZ_INPUT_STRINGS]; // Sequence of offsets to numeric strings + USHORT nAnzStrings; // Total count of scanned substrings + USHORT nAnzNums; // Count of numeric substrings + BOOL bDecSepInDateSeps; // True <=> DecSep in {.,-,/,DateSep} + BYTE nMatchedAllStrings; // Scan...String() matched all substrings, + // bit mask of nMatched... constants + + static const BYTE nMatchedEndString; // 0x01 + static const BYTE nMatchedMidString; // 0x02 + static const BYTE nMatchedStartString; // 0x04 + static const BYTE nMatchedVirgin; // 0x08 + static const BYTE nMatchedUsedAsReturn; // 0x10 + + int nSign; // Sign of number + short nMonth; // Month (1..x) if date + // negative => short format + short nMonthPos; // 1 = front, 2 = middle + // 3 = end + USHORT nTimePos; // Index of first time separator (+1) + short nDecPos; // Index of substring containing "," (+1) + short nNegCheck; // '( )' for negative + short nESign; // Sign of exponent + short nAmPm; // +1 AM, -1 PM, 0 if none + short nLogical; // -1 => False, 1 => True + USHORT nThousand; // Count of group (AKA thousand) separators + USHORT nPosThousandString; // Position of concatenaded 000,000,000 string + short eScannedType; // Scanned type + short eSetType; // Preset Type + + USHORT nStringScanNumFor; // Fixed strings recognized in + // pFormat->NumFor[nNumForStringScan] + short nStringScanSign; // Sign resulting of FixString + USHORT nYear2000; // Two-digit threshold + // Year as 20xx + // default 18 + // number <= nYear2000 => 20xx + // number > nYear2000 => 19xx + USHORT nTimezonePos; // Index of timezone separator (+1) + BYTE nMayBeIso8601; // 0:=dontknowyet, 1:=yes, 2:=no + +#ifdef _ZFORFIND_CXX // methods private to implementation + void Reset(); // Reset all variables before start of analysis + + void InitText(); // Init of months and days of week + + // Convert string to double. + // Only simple unsigned floating point values without any error detection, + // decimal separator has to be '.' + // If bForceFraction==TRUE the string is taken to be the fractional part + // of 0.1234 without the leading 0. (thus being just "1234"). + double StringToDouble( + const String& rStr, + BOOL bForceFraction = FALSE ); + + BOOL NextNumberStringSymbol( // Next number/string symbol + const sal_Unicode*& pStr, + String& rSymbol ); + + BOOL SkipThousands( // Concatenate ,000,23 blocks + const sal_Unicode*& pStr, // in input to 000123 + String& rSymbol ); + + void NumberStringDivision( // Divide numbers/strings into + const String& rString ); // arrays and variables above. + // Leading blanks and blanks + // after numbers are thrown away + + + // optimized substring versions + + static inline BOOL StringContains( // Whether rString contains rWhat at nPos + const String& rWhat, + const String& rString, + xub_StrLen nPos ) + { // mostly used with one character + if ( rWhat.GetChar(0) != rString.GetChar(nPos) ) + return FALSE; + return StringContainsImpl( rWhat, rString, nPos ); + } + static inline BOOL StringPtrContains( // Whether pString contains rWhat at nPos + const String& rWhat, + const sal_Unicode* pString, + xub_StrLen nPos ) // nPos MUST be a valid offset from pString + { // mostly used with one character + if ( rWhat.GetChar(0) != *(pString+nPos) ) + return FALSE; + return StringPtrContainsImpl( rWhat, pString, nPos ); + } + static BOOL StringContainsImpl( //! DO NOT use directly + const String& rWhat, + const String& rString, + xub_StrLen nPos ); + static BOOL StringPtrContainsImpl( //! DO NOT use directly + const String& rWhat, + const sal_Unicode* pString, + xub_StrLen nPos ); + + + static inline BOOL SkipChar( // Skip a special character + sal_Unicode c, + const String& rString, + xub_StrLen& nPos ); + static inline void SkipBlanks( // Skip blank + const String& rString, + xub_StrLen& nPos ); + static inline BOOL SkipString( // Jump over rWhat in rString at nPos + const String& rWhat, + const String& rString, + xub_StrLen& nPos ); + + inline BOOL GetThousandSep( // Recognizes exactly ,111 as group separator + const String& rString, + xub_StrLen& nPos, + USHORT nStringPos ); + short GetLogical( // Get boolean value + const String& rString ); + short GetMonth( // Get month and advance string position + const String& rString, + xub_StrLen& nPos ); + int GetDayOfWeek( // Get day of week and advance string position + const String& rString, + xub_StrLen& nPos ); + BOOL GetCurrency( // Get currency symbol and advance string position + const String& rString, + xub_StrLen& nPos, + const SvNumberformat* pFormat = NULL ); // optional number format to match against + BOOL GetTimeAmPm( // Get symbol AM or PM and advance string position + const String& rString, + xub_StrLen& nPos ); + inline BOOL GetDecSep( // Get decimal separator and advance string position + const String& rString, + xub_StrLen& nPos ); + inline BOOL GetTime100SecSep( // Get hundredth seconds separator and advance string position + const String& rString, + xub_StrLen& nPos ); + int GetSign( // Get sign and advance string position + const String& rString, // Including special case '(' + xub_StrLen& nPos ); + short GetESign( // Get sign of exponent and advance string position + const String& rString, + xub_StrLen& nPos ); + + inline BOOL GetNextNumber( // Get next number as array offset + USHORT& i, + USHORT& j ); + + void GetTimeRef( // Converts time -> double (only decimals) + double& fOutNumber, // result as double + USHORT nIndex, // Index of hour in input + USHORT nAnz ); // Count of time substrings in input + USHORT ImplGetDay ( USHORT nIndex ); // Day input, 0 if no match + USHORT ImplGetMonth( USHORT nIndex ); // Month input, zero based return, NumberOfMonths if no match + USHORT ImplGetYear ( USHORT nIndex ); // Year input, 0 if no match + BOOL GetDateRef( // Conversion of date to number + double& fDays, // OUT: days diff to null date + USHORT& nCounter, // Count of date substrings + const SvNumberformat* pFormat = NULL ); // optional number format to match against + + BOOL ScanStartString( // Analyze start of string + const String& rString, + const SvNumberformat* pFormat = NULL ); + BOOL ScanMidString( // Analyze middle substring + const String& rString, + USHORT nStringPos, + const SvNumberformat* pFormat = NULL ); + BOOL ScanEndString( // Analyze end of string + const String& rString, + const SvNumberformat* pFormat = NULL ); + + // Whether input may be a ISO 8601 date format, yyyy-mm-dd... + // checks if at least 3 numbers and first number>31 + bool MayBeIso8601(); + + // Compare rString to substring of array indexed by nString + // nString == 0xFFFF => last substring + BOOL ScanStringNumFor( + const String& rString, + xub_StrLen nPos, + const SvNumberformat* pFormat, + USHORT nString, + BOOL bDontDetectNegation = FALSE ); + + // if nMatchedAllStrings set nMatchedUsedAsReturn and return TRUE, + // else do nothing and return FALSE + BOOL MatchedReturn(); + + //! Be sure that the string to be analyzed is already converted to upper + //! case and if it contained native humber digits that they are already + //! converted to ASCII. + BOOL IsNumberFormatMain( // Main anlyzing function + const String& rString, + double& fOutNumber, // return value if string is numeric + const SvNumberformat* pFormat = NULL // optional number format to match against + ); + + static inline BOOL MyIsdigit( sal_Unicode c ); + + // native number transliteration if necessary + void TransformInput( String& rString ); + +#endif // _ZFORFIND_CXX +}; + + + +#endif // _ZFORFIND_HXX diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx new file mode 100644 index 000000000000..fcae93964e72 --- /dev/null +++ b/svl/source/numbers/zforlist.cxx @@ -0,0 +1,4362 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: zforlist.cxx,v $ + * $Revision: 1.72.60.2 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#ifndef GCC +#endif + +// #include +#include +#ifndef _SOUND_HXX //autogen +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define _SVSTDARR_USHORTS +#include + +#define _ZFORLIST_CXX +#include +#include +#undef _ZFORLIST_CXX + +#include "zforscan.hxx" +#include "zforfind.hxx" +#include +#include "numhead.hxx" + +#include +#include "listener.hxx" +#include +#include +#include +#include + +#include + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::i18n; +using namespace ::com::sun::star::lang; + + +// Constants for type offsets per Country/Language (CL) +#define ZF_STANDARD 0 +#define ZF_STANDARD_PERCENT 10 +#define ZF_STANDARD_CURRENCY 20 +#define ZF_STANDARD_DATE 30 +#define ZF_STANDARD_TIME 40 +#define ZF_STANDARD_DATETIME 50 +#define ZF_STANDARD_SCIENTIFIC 60 +#define ZF_STANDARD_FRACTION 70 +#define ZF_STANDARD_NEWEXTENDED 75 +#define ZF_STANDARD_NEWEXTENDEDMAX SV_MAX_ANZ_STANDARD_FORMATE-2 // 98 +#define ZF_STANDARD_LOGICAL SV_MAX_ANZ_STANDARD_FORMATE-1 // 99 +#define ZF_STANDARD_TEXT SV_MAX_ANZ_STANDARD_FORMATE // 100 + +/* Locale that is set if an unknown locale (from another system) is loaded of + * legacy documents. Can not be SYSTEM because else, for example, a German "DM" + * (old currency) is recognized as a date (#53155#). */ +#define UNKNOWN_SUBSTITUTE LANGUAGE_ENGLISH_US + +static BOOL bIndexTableInitialized = FALSE; +static sal_uInt32 __FAR_DATA theIndexTable[NF_INDEX_TABLE_ENTRIES]; + + +// ==================================================================== + +/** + instead of every number formatter being a listener we have a registry which + also handles one instance of the SysLocale options + */ + +class SvNumberFormatterRegistry_Impl : public SvtListener +{ + List aFormatters; + SvtSysLocaleOptions aSysLocaleOptions; + LanguageType eSysLanguage; + +public: + SvNumberFormatterRegistry_Impl(); + virtual ~SvNumberFormatterRegistry_Impl(); + + void Insert( SvNumberFormatter* pThis ) + { aFormatters.Insert( pThis, LIST_APPEND ); } + SvNumberFormatter* Remove( SvNumberFormatter* pThis ) + { return (SvNumberFormatter*)aFormatters.Remove( pThis ); } + sal_uInt32 Count() + { return aFormatters.Count(); } + + virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint ); + +}; + + +SvNumberFormatterRegistry_Impl::SvNumberFormatterRegistry_Impl() +{ + eSysLanguage = MsLangId::getRealLanguage( LANGUAGE_SYSTEM ); + aSysLocaleOptions.AddListener( *this ); +} + + +SvNumberFormatterRegistry_Impl::~SvNumberFormatterRegistry_Impl() +{ + aSysLocaleOptions.RemoveListener( *this ); +} + + +void SvNumberFormatterRegistry_Impl::Notify( SvtBroadcaster&, const SfxHint& rHint ) +{ + const SfxSimpleHint* pHint = PTR_CAST( SfxSimpleHint, &rHint ); + if( pHint ) + { + if ( pHint->GetId() & SYSLOCALEOPTIONS_HINT_LOCALE ) + { + ::osl::MutexGuard aGuard( SvNumberFormatter::GetMutex() ); + for ( SvNumberFormatter* p = (SvNumberFormatter*)aFormatters.First(); + p; p = (SvNumberFormatter*)aFormatters.Next() ) + { + p->ReplaceSystemCL( eSysLanguage ); + } + eSysLanguage = MsLangId::getRealLanguage( LANGUAGE_SYSTEM ); + } + if ( pHint->GetId() & SYSLOCALEOPTIONS_HINT_CURRENCY ) + { + ::osl::MutexGuard aGuard( SvNumberFormatter::GetMutex() ); + for ( SvNumberFormatter* p = (SvNumberFormatter*)aFormatters.First(); + p; p = (SvNumberFormatter*)aFormatters.Next() ) + { + p->ResetDefaultSystemCurrency(); + } + } + } +} + + +// ==================================================================== + +SvNumberFormatterRegistry_Impl* SvNumberFormatter::pFormatterRegistry = NULL; +BOOL SvNumberFormatter::bCurrencyTableInitialized = FALSE; +namespace +{ + struct theCurrencyTable : + public rtl::Static< NfCurrencyTable, theCurrencyTable > {}; + + struct theLegacyOnlyCurrencyTable : + public rtl::Static< NfCurrencyTable, theLegacyOnlyCurrencyTable > {}; +} +USHORT SvNumberFormatter::nSystemCurrencyPosition = 0; +SV_IMPL_PTRARR( NfCurrencyTable, NfCurrencyEntry* ); +SV_IMPL_PTRARR( NfWSStringsDtor, String* ); + +// ob das BankSymbol immer am Ende ist (1 $;-1 $) oder sprachabhaengig +#define NF_BANKSYMBOL_FIX_POSITION 1 + + +/***********************Funktionen SvNumberFormatter**************************/ + +SvNumberFormatter::SvNumberFormatter( + const Reference< XMultiServiceFactory >& xSMgr, + LanguageType eLang ) + : + xServiceManager( xSMgr ) +{ + ImpConstruct( eLang ); +} + + +SvNumberFormatter::SvNumberFormatter( LanguageType eLang ) +{ + ImpConstruct( eLang ); +} + + +SvNumberFormatter::~SvNumberFormatter() +{ + { + ::osl::MutexGuard aGuard( GetMutex() ); + pFormatterRegistry->Remove( this ); + if ( !pFormatterRegistry->Count() ) + { + delete pFormatterRegistry; + pFormatterRegistry = NULL; + } + } + + SvNumberformat* pEntry = aFTable.First(); + while (pEntry) + { + delete pEntry; + pEntry = aFTable.Next(); + } + delete pFormatTable; + delete pCharClass; + delete pStringScanner; + delete pFormatScanner; + ClearMergeTable(); + delete pMergeTable; +} + + +void SvNumberFormatter::ImpConstruct( LanguageType eLang ) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aTimeLog, "svtools", "er93726", "SvNumberFormatter::ImpConstruct" ); + + if ( eLang == LANGUAGE_DONTKNOW ) + eLang = UNKNOWN_SUBSTITUTE; + IniLnge = eLang; + ActLnge = eLang; + eEvalDateFormat = NF_EVALDATEFORMAT_INTL; + nDefaultSystemCurrencyFormat = NUMBERFORMAT_ENTRY_NOT_FOUND; + + aLocale = MsLangId::convertLanguageToLocale( eLang ); + pCharClass = new CharClass( xServiceManager, aLocale ); + xLocaleData.init( xServiceManager, aLocale, eLang ); + xCalendar.init( xServiceManager, aLocale ); + xTransliteration.init( xServiceManager, eLang, + ::com::sun::star::i18n::TransliterationModules_IGNORE_CASE ); + xNatNum.init( xServiceManager ); + + // cached locale data items + const LocaleDataWrapper* pLoc = GetLocaleData(); + aDecimalSep = pLoc->getNumDecimalSep(); + aThousandSep = pLoc->getNumThousandSep(); + aDateSep = pLoc->getDateSep(); + + pStringScanner = new ImpSvNumberInputScan( this ); + pFormatScanner = new ImpSvNumberformatScan( this ); + pFormatTable = NULL; + MaxCLOffset = 0; + ImpGenerateFormats( 0, FALSE ); // 0 .. 999 for initialized language formats + pMergeTable = NULL; + bNoZero = FALSE; + + ::osl::MutexGuard aGuard( GetMutex() ); + GetFormatterRegistry().Insert( this ); +} + + +void SvNumberFormatter::ChangeIntl(LanguageType eLnge) +{ + if (ActLnge != eLnge) + { + ActLnge = eLnge; + + aLocale = MsLangId::convertLanguageToLocale( eLnge ); + pCharClass->setLocale( aLocale ); + xLocaleData.changeLocale( aLocale, eLnge ); + xCalendar.changeLocale( aLocale ); + xTransliteration.changeLocale( eLnge ); + + // cached locale data items, initialize BEFORE calling ChangeIntl below + const LocaleDataWrapper* pLoc = GetLocaleData(); + aDecimalSep = pLoc->getNumDecimalSep(); + aThousandSep = pLoc->getNumThousandSep(); + aDateSep = pLoc->getDateSep(); + + pFormatScanner->ChangeIntl(); + pStringScanner->ChangeIntl(); + } +} + + +// static +::osl::Mutex& SvNumberFormatter::GetMutex() +{ + static ::osl::Mutex* pMutex = NULL; + if( !pMutex ) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + if( !pMutex ) + { + // #i77768# Due to a static reference in the toolkit lib + // we need a mutex that lives longer than the svtools library. + // Otherwise the dtor would use a destructed mutex!! + pMutex = new ::osl::Mutex; + } + } + return *pMutex; +} + + +// static +SvNumberFormatterRegistry_Impl& SvNumberFormatter::GetFormatterRegistry() +{ + ::osl::MutexGuard aGuard( GetMutex() ); + if ( !pFormatterRegistry ) + pFormatterRegistry = new SvNumberFormatterRegistry_Impl; + return *pFormatterRegistry; +} + + +Color* SvNumberFormatter::GetUserDefColor(USHORT nIndex) +{ + if( aColorLink.IsSet() ) + return (Color*) ( aColorLink.Call( (void*) &nIndex )); + else + return NULL; +} + +void SvNumberFormatter::ChangeNullDate(USHORT nDay, + USHORT nMonth, + USHORT nYear) +{ + pFormatScanner->ChangeNullDate(nDay, nMonth, nYear); + pStringScanner->ChangeNullDate(nDay, nMonth, nYear); +} + +Date* SvNumberFormatter::GetNullDate() +{ + return pFormatScanner->GetNullDate(); +} + +void SvNumberFormatter::ChangeStandardPrec(short nPrec) +{ + pFormatScanner->ChangeStandardPrec(nPrec); +} + +short SvNumberFormatter::GetStandardPrec() +{ + return pFormatScanner->GetStandardPrec(); +} + +void SvNumberFormatter::ImpChangeSysCL( LanguageType eLnge, BOOL bLoadingSO5 ) +{ + if (eLnge == LANGUAGE_DONTKNOW) + eLnge = UNKNOWN_SUBSTITUTE; + if (eLnge != IniLnge) + { + IniLnge = eLnge; + ChangeIntl(eLnge); + SvNumberformat* pEntry = aFTable.First(); + while (pEntry) // delete old formats + { + pEntry = (SvNumberformat*) aFTable.Remove(aFTable.GetCurKey()); + delete pEntry; + pEntry = (SvNumberformat*) aFTable.First(); + } + ImpGenerateFormats( 0, bLoadingSO5 ); // new standard formats + } + else if ( bLoadingSO5 ) + { // delete additional standard formats + sal_uInt32 nKey; + aFTable.Seek( SV_MAX_ANZ_STANDARD_FORMATE + 1 ); + while ( (nKey = aFTable.GetCurKey()) > SV_MAX_ANZ_STANDARD_FORMATE && + nKey < SV_COUNTRY_LANGUAGE_OFFSET ) + { + SvNumberformat* pEntry = (SvNumberformat*) aFTable.Remove( nKey ); + delete pEntry; + } + } +} + + +void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage ) +{ + sal_uInt32 nCLOffset = ImpGetCLOffset( LANGUAGE_SYSTEM ); + if ( nCLOffset > MaxCLOffset ) + return ; // no SYSTEM entries to replace + + const sal_uInt32 nMaxBuiltin = nCLOffset + SV_MAX_ANZ_STANDARD_FORMATE; + const sal_uInt32 nNextCL = nCLOffset + SV_COUNTRY_LANGUAGE_OFFSET; + sal_uInt32 nKey; + + // remove old builtin formats + aFTable.Seek( nCLOffset ); + while ( (nKey = aFTable.GetCurKey()) >= nCLOffset && nKey <= nMaxBuiltin && aFTable.Count() ) + { + SvNumberformat* pEntry = (SvNumberformat*) aFTable.Remove( nKey ); + delete pEntry; + } + + // move additional and user defined to temporary table + Table aOldTable; + while ( (nKey = aFTable.GetCurKey()) >= nCLOffset && nKey < nNextCL && aFTable.Count() ) + { + SvNumberformat* pEntry = (SvNumberformat*) aFTable.Remove( nKey ); + aOldTable.Insert( nKey, pEntry ); + } + + // generate new old builtin formats + // reset ActLnge otherwise ChangeIntl() wouldn't switch if already LANGUAGE_SYSTEM + ActLnge = LANGUAGE_DONTKNOW; + ChangeIntl( LANGUAGE_SYSTEM ); + ImpGenerateFormats( nCLOffset, TRUE ); + + // convert additional and user defined from old system to new system + SvNumberformat* pStdFormat = (SvNumberformat*) aFTable.Get( nCLOffset + ZF_STANDARD ); + sal_uInt32 nLastKey = nMaxBuiltin; + pFormatScanner->SetConvertMode( eOldLanguage, LANGUAGE_SYSTEM, TRUE ); + aOldTable.First(); + while ( aOldTable.Count() ) + { + nKey = aOldTable.GetCurKey(); + if ( nLastKey < nKey ) + nLastKey = nKey; + SvNumberformat* pOldEntry = (SvNumberformat*) aOldTable.Remove( nKey ); + String aString( pOldEntry->GetFormatstring() ); + xub_StrLen nCheckPos = STRING_NOTFOUND; + + // Same as PutEntry() but assures key position even if format code is + // a duplicate. Also won't mix up any LastInsertKey. + ChangeIntl( eOldLanguage ); + LanguageType eLge = eOldLanguage; // ConvertMode changes this + BOOL bCheck = FALSE; + SvNumberformat* pNewEntry = new SvNumberformat( aString, pFormatScanner, + pStringScanner, nCheckPos, eLge ); + if ( nCheckPos != 0 ) + delete pNewEntry; + else + { + short eCheckType = pNewEntry->GetType(); + if ( eCheckType != NUMBERFORMAT_UNDEFINED ) + pNewEntry->SetType( eCheckType | NUMBERFORMAT_DEFINED ); + else + pNewEntry->SetType( NUMBERFORMAT_DEFINED ); + + if ( !aFTable.Insert( nKey, pNewEntry ) ) + delete pNewEntry; + else + bCheck = TRUE; + } + DBG_ASSERT( bCheck, "SvNumberFormatter::ReplaceSystemCL: couldn't convert" ); + + delete pOldEntry; + } + pFormatScanner->SetConvertMode(FALSE); + pStdFormat->SetLastInsertKey( USHORT(nLastKey - nCLOffset) ); + + // append new system additional formats + NumberFormatCodeWrapper aNumberFormatCode( xServiceManager, GetLocale() ); + ImpGenerateAdditionalFormats( nCLOffset, aNumberFormatCode, TRUE ); +} + + +BOOL SvNumberFormatter::IsTextFormat(sal_uInt32 F_Index) const +{ + SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(F_Index); + if (!pFormat) + return FALSE; + else + return pFormat->IsTextFormat(); +} + +BOOL SvNumberFormatter::HasTextFormat(sal_uInt32 F_Index) const +{ + SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(F_Index); + if (!pFormat) + return FALSE; + else + return pFormat->HasTextFormat(); +} + +BOOL SvNumberFormatter::PutEntry(String& rString, + xub_StrLen& nCheckPos, + short& nType, + sal_uInt32& nKey, // Formatnummer + LanguageType eLnge) +{ + nKey = 0; + if (rString.Len() == 0) // keinen Leerstring + { + nCheckPos = 1; // -> Fehler + return FALSE; + } + if (eLnge == LANGUAGE_DONTKNOW) + eLnge = IniLnge; + + ChangeIntl(eLnge); // ggfs. austauschen + LanguageType eLge = eLnge; // Umgehung const fuer ConvertMode + BOOL bCheck = FALSE; + SvNumberformat* p_Entry = new SvNumberformat(rString, + pFormatScanner, + pStringScanner, + nCheckPos, + eLge); + if (nCheckPos == 0) // Format ok + { // Typvergleich: + short eCheckType = p_Entry->GetType(); + if ( eCheckType != NUMBERFORMAT_UNDEFINED) + { + p_Entry->SetType(eCheckType | NUMBERFORMAT_DEFINED); + nType = eCheckType; + } + else + { + p_Entry->SetType(NUMBERFORMAT_DEFINED); + nType = NUMBERFORMAT_DEFINED; + } + sal_uInt32 CLOffset = ImpGenerateCL(eLge); // ggfs. neu Standard- + // formate anlegen + nKey = ImpIsEntry(p_Entry->GetFormatstring(),CLOffset, eLge); + if (nKey != NUMBERFORMAT_ENTRY_NOT_FOUND) // schon vorhanden + delete p_Entry; + else + { + SvNumberformat* pStdFormat = + (SvNumberformat*) aFTable.Get(CLOffset + ZF_STANDARD); + sal_uInt32 nPos = CLOffset + pStdFormat->GetLastInsertKey(); + if (nPos - CLOffset >= SV_COUNTRY_LANGUAGE_OFFSET) + { + Sound::Beep(); + DBG_ERROR("SvNumberFormatter:: Zu viele Formate pro CL"); + delete p_Entry; + } + else if (!aFTable.Insert(nPos+1,p_Entry)) + delete p_Entry; + else + { + bCheck = TRUE; + nKey = nPos+1; + pStdFormat->SetLastInsertKey((USHORT) (nKey-CLOffset)); + } + } + } + else + delete p_Entry; + return bCheck; +} + +BOOL SvNumberFormatter::PutandConvertEntry(String& rString, + xub_StrLen& nCheckPos, + short& nType, + sal_uInt32& nKey, + LanguageType eLnge, + LanguageType eNewLnge) +{ + BOOL bRes; + if (eNewLnge == LANGUAGE_DONTKNOW) + eNewLnge = IniLnge; + + pFormatScanner->SetConvertMode(eLnge, eNewLnge); + bRes = PutEntry(rString, nCheckPos, nType, nKey, eLnge); + pFormatScanner->SetConvertMode(FALSE); + return bRes; +} + + +BOOL SvNumberFormatter::PutandConvertEntrySystem(String& rString, + xub_StrLen& nCheckPos, + short& nType, + sal_uInt32& nKey, + LanguageType eLnge, + LanguageType eNewLnge) +{ + BOOL bRes; + if (eNewLnge == LANGUAGE_DONTKNOW) + eNewLnge = IniLnge; + + pFormatScanner->SetConvertMode(eLnge, eNewLnge, TRUE); + bRes = PutEntry(rString, nCheckPos, nType, nKey, eLnge); + pFormatScanner->SetConvertMode(FALSE); + return bRes; +} + + +sal_uInt32 SvNumberFormatter::GetIndexPuttingAndConverting( String & rString, + LanguageType eLnge, LanguageType eSysLnge, short & rType, + BOOL & rNewInserted, xub_StrLen & rCheckPos ) +{ + sal_uInt32 nKey = NUMBERFORMAT_ENTRY_NOT_FOUND; + rNewInserted = FALSE; + rCheckPos = 0; + + // #62389# empty format string (of Writer) => General standard format + if (!rString.Len()) + ; // nothing + else if (eLnge == LANGUAGE_SYSTEM && eSysLnge != + Application::GetSettings().GetLanguage()) + { + sal_uInt32 nOrig = GetEntryKey( rString, eSysLnge ); + if (nOrig == NUMBERFORMAT_ENTRY_NOT_FOUND) + nKey = nOrig; // none avaliable, maybe user-defined + else + nKey = GetFormatForLanguageIfBuiltIn( nOrig, + Application::GetSettings().GetLanguage()); + if (nKey == nOrig) + { + // Not a builtin format, convert. + // The format code string may get modified and adapted to the real + // language and wouldn't match eSysLnge anymore, do that on a copy. + String aTmp( rString); + rNewInserted = PutandConvertEntrySystem( aTmp, rCheckPos, rType, + nKey, eLnge, Application::GetSettings().GetLanguage()); + if (rCheckPos > 0) + { + DBG_ERRORFILE("SvNumberFormatter::GetIndexPuttingAndConverting: bad format code string for current locale"); + nKey = NUMBERFORMAT_ENTRY_NOT_FOUND; + } + } + } + else + { + nKey = GetEntryKey( rString, eLnge); + if (nKey == NUMBERFORMAT_ENTRY_NOT_FOUND) + { + rNewInserted = PutEntry( rString, rCheckPos, rType, nKey, eLnge); + if (rCheckPos > 0) + { + DBG_ERRORFILE("SvNumberFormatter::GetIndexPuttingAndConverting: bad format code string for specified locale"); + nKey = NUMBERFORMAT_ENTRY_NOT_FOUND; + } + } + } + if (nKey == NUMBERFORMAT_ENTRY_NOT_FOUND) + nKey = GetStandardIndex( eLnge); + rType = GetType( nKey); + // Convert any (!) old "automatic" currency format to new fixed currency + // default format. + if ((rType & NUMBERFORMAT_CURRENCY) != 0) + { + const SvNumberformat* pFormat = GetEntry( nKey); + if (!pFormat->HasNewCurrency()) + { + if (rNewInserted) + { + DeleteEntry( nKey); // don't leave trails of rubbish + rNewInserted = FALSE; + } + nKey = GetStandardFormat( NUMBERFORMAT_CURRENCY, eLnge); + } + } + return nKey; +} + + +void SvNumberFormatter::DeleteEntry(sal_uInt32 nKey) +{ + SvNumberformat* pEntry = aFTable.Remove(nKey); + delete pEntry; +} + +void SvNumberFormatter::PrepareSave() +{ + SvNumberformat* pFormat = aFTable.First(); + while (pFormat) + { + pFormat->SetUsed(FALSE); + pFormat = aFTable.Next(); + } +} + +void SvNumberFormatter::SetFormatUsed(sal_uInt32 nFIndex) +{ + SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nFIndex); + if (pFormat) + pFormat->SetUsed(TRUE); +} + +BOOL SvNumberFormatter::Load( SvStream& rStream ) +{ + LanguageType eSysLang = Application::GetSettings().GetLanguage(); + SvNumberFormatter* pConverter = NULL; + + ImpSvNumMultipleReadHeader aHdr( rStream ); + USHORT nVersion; + rStream >> nVersion; + SvNumberformat* pEntry; + sal_uInt32 nPos; + LanguageType eSaveSysLang, eLoadSysLang; + USHORT nSysOnStore, eLge, eDummy; // Dummy fuer kompatibles Format + rStream >> nSysOnStore >> eLge; // Systemeinstellung aus + // Dokument + eSaveSysLang = (nVersion < SV_NUMBERFORMATTER_VERSION_SYSTORE ? + LANGUAGE_SYSTEM : (LanguageType) nSysOnStore); + LanguageType eLnge = (LanguageType) eLge; + ImpChangeSysCL( eLnge, TRUE ); + + rStream >> nPos; + while (nPos != NUMBERFORMAT_ENTRY_NOT_FOUND) + { + rStream >> eDummy >> eLge; + eLnge = (LanguageType) eLge; + ImpGenerateCL( eLnge, TRUE ); // ggfs. neue Standardformate anlegen + + sal_uInt32 nOffset = nPos % SV_COUNTRY_LANGUAGE_OFFSET; // relativIndex + BOOL bUserDefined = (nOffset > SV_MAX_ANZ_STANDARD_FORMATE); + //! HACK! ER 29.07.97 15:15 + // SaveLang wurde bei SYSTEM nicht gespeichert sondern war auch SYSTEM, + // erst ab 364i Unterscheidung moeglich + BOOL bConversionHack; + if ( eLnge == LANGUAGE_SYSTEM ) + { + if ( nVersion < SV_NUMBERFORMATTER_VERSION_SYSTORE ) + { + bConversionHack = bUserDefined; + eLoadSysLang = eSaveSysLang; + } + else + { + bConversionHack = FALSE; + eLoadSysLang = eSysLang; + } + } + else + { + bConversionHack = FALSE; + eLoadSysLang = eSaveSysLang; + } + + pEntry = new SvNumberformat(*pFormatScanner, eLnge); + if ( bConversionHack ) + { // SYSTEM + // nVersion < SV_NUMBERFORMATTER_VERSION_SYSTORE + // nVersion < SV_NUMBERFORMATTER_VERSION_KEYWORDS + if ( !pConverter ) + pConverter = new SvNumberFormatter( xServiceManager, eSysLang ); + NfHackConversion eHackConversion = pEntry->Load( + rStream, aHdr, pConverter, *pStringScanner ); + switch ( eHackConversion ) + { + case NF_CONVERT_GERMAN_ENGLISH : + pEntry->ConvertLanguage( *pConverter, + LANGUAGE_ENGLISH_US, eSysLang, TRUE ); + break; + case NF_CONVERT_ENGLISH_GERMAN : + switch ( eSysLang ) + { + case LANGUAGE_GERMAN: + case LANGUAGE_GERMAN_SWISS: + case LANGUAGE_GERMAN_AUSTRIAN: + case LANGUAGE_GERMAN_LUXEMBOURG: + case LANGUAGE_GERMAN_LIECHTENSTEIN: + // alles beim alten + break; + default: + pEntry->ConvertLanguage( *pConverter, + LANGUAGE_GERMAN, eSysLang, TRUE ); + } + break; + case NF_CONVERT_NONE : + break; // -Wall not handled. + } + + } + else + { + pEntry->Load( rStream, aHdr, NULL, *pStringScanner ); + if ( !bUserDefined ) + bUserDefined = (pEntry->GetNewStandardDefined() > SV_NUMBERFORMATTER_VERSION); + if ( bUserDefined ) + { + if ( eSaveSysLang != eLoadSysLang ) + { // SYSTEM verschieden + if ( !pConverter ) + pConverter = new SvNumberFormatter( xServiceManager, eSysLang ); + if ( nVersion < SV_NUMBERFORMATTER_VERSION_KEYWORDS ) + { + switch ( eSaveSysLang ) + { + case LANGUAGE_GERMAN: + case LANGUAGE_GERMAN_SWISS: + case LANGUAGE_GERMAN_AUSTRIAN: + case LANGUAGE_GERMAN_LUXEMBOURG: + case LANGUAGE_GERMAN_LIECHTENSTEIN: + // alles beim alten + pEntry->ConvertLanguage( *pConverter, + eSaveSysLang, eLoadSysLang, TRUE ); + break; + default: + // alte english nach neuem anderen + pEntry->ConvertLanguage( *pConverter, + LANGUAGE_ENGLISH_US, eLoadSysLang, TRUE ); + } + } + else + pEntry->ConvertLanguage( *pConverter, + eSaveSysLang, eLoadSysLang, TRUE ); + } + else + { // nicht SYSTEM oder gleiches SYSTEM + if ( nVersion < SV_NUMBERFORMATTER_VERSION_KEYWORDS ) + { + LanguageType eLoadLang; + BOOL bSystem; + if ( eLnge == LANGUAGE_SYSTEM ) + { + eLoadLang = eSysLang; + bSystem = TRUE; + } + else + { + eLoadLang = eLnge; + bSystem = FALSE; + } + switch ( eLoadLang ) + { + case LANGUAGE_GERMAN: + case LANGUAGE_GERMAN_SWISS: + case LANGUAGE_GERMAN_AUSTRIAN: + case LANGUAGE_GERMAN_LUXEMBOURG: + case LANGUAGE_GERMAN_LIECHTENSTEIN: + // alles beim alten + break; + default: + // alte english nach neuem anderen + if ( !pConverter ) + pConverter = new SvNumberFormatter( xServiceManager, eSysLang ); + pEntry->ConvertLanguage( *pConverter, + LANGUAGE_ENGLISH_US, eLoadLang, bSystem ); + } + } + } + } + } + if ( nOffset == 0 ) // StandardFormat + { + SvNumberformat* pEnt = aFTable.Get(nPos); + if (pEnt) + pEnt->SetLastInsertKey(pEntry->GetLastInsertKey()); + } + if (!aFTable.Insert(nPos, pEntry)) + delete pEntry; + rStream >> nPos; + } + + // ab SV_NUMBERFORMATTER_VERSION_YEAR2000 + if ( nVersion >= SV_NUMBERFORMATTER_VERSION_YEAR2000 ) + { + aHdr.StartEntry(); + if ( aHdr.BytesLeft() >= sizeof(UINT16) ) + { + UINT16 nY2k; + rStream >> nY2k; + if ( nVersion < SV_NUMBERFORMATTER_VERSION_TWODIGITYEAR && nY2k < 100 ) + nY2k += 1901; // war vor src513e: 29, jetzt: 1930 + SetYear2000( nY2k ); + } + aHdr.EndEntry(); + } + + if ( pConverter ) + delete pConverter; + + // generate additional i18n standard formats for all used locales + LanguageType eOldLanguage = ActLnge; + NumberFormatCodeWrapper aNumberFormatCode( xServiceManager, GetLocale() ); + SvUShorts aList; + GetUsedLanguages( aList ); + USHORT nCount = aList.Count(); + for ( USHORT j=0; jFirst(); + while (pEntry) + { + // Gespeichert werden alle markierten, benutzerdefinierten Formate und + // jeweils das Standardformat zu allen angewaehlten CL-Kombinationen + // sowie NewStandardDefined + if ( pEntry->GetUsed() || (pEntry->GetType() & NUMBERFORMAT_DEFINED) || + pEntry->GetNewStandardDefined() || + (pTable->GetCurKey() % SV_COUNTRY_LANGUAGE_OFFSET == 0) ) + { + rStream << static_cast(pTable->GetCurKey()) + << (USHORT) LANGUAGE_SYSTEM + << (USHORT) pEntry->GetLanguage(); + pEntry->Save(rStream, aHdr); + } + pEntry = (SvNumberformat*) pTable->Next(); + } + rStream << NUMBERFORMAT_ENTRY_NOT_FOUND; // EndeKennung + + // ab SV_NUMBERFORMATTER_VERSION_YEAR2000 + aHdr.StartEntry(); + rStream << (UINT16) GetYear2000(); + aHdr.EndEntry(); + + if (rStream.GetError()) + return FALSE; + else + return TRUE; +} + +// static +void SvNumberFormatter::SkipNumberFormatterInStream( SvStream& rStream ) +{ + ImpSvNumMultipleReadHeader::Skip( rStream ); +} + +void SvNumberFormatter::GetUsedLanguages( SvUShorts& rList ) +{ + rList.Remove( 0, rList.Count() ); + + sal_uInt32 nOffset = 0; + while (nOffset <= MaxCLOffset) + { + SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nOffset); + if (pFormat) + rList.Insert( pFormat->GetLanguage(), rList.Count() ); + nOffset += SV_COUNTRY_LANGUAGE_OFFSET; + } +} + + +void SvNumberFormatter::FillKeywordTable( NfKeywordTable& rKeywords, + LanguageType eLang ) +{ + ChangeIntl( eLang ); + const String* pTable = pFormatScanner->GetKeywords(); + for ( USHORT i = 0; i < NF_KEYWORD_ENTRIES_COUNT; ++i ) + { + rKeywords[i] = pTable[i]; + } +} + + +String SvNumberFormatter::GetKeyword( LanguageType eLnge, USHORT nIndex ) +{ + ChangeIntl(eLnge); + const String* pTable = pFormatScanner->GetKeywords(); + if ( pTable && nIndex < NF_KEYWORD_ENTRIES_COUNT ) + return pTable[nIndex]; + + DBG_ERROR("GetKeyword: invalid index"); + return String(); +} + + +String SvNumberFormatter::GetStandardName( LanguageType eLnge ) +{ + ChangeIntl( eLnge ); + return pFormatScanner->GetStandardName(); +} + + +sal_uInt32 SvNumberFormatter::ImpGetCLOffset(LanguageType eLnge) const +{ + SvNumberformat* pFormat; + sal_uInt32 nOffset = 0; + while (nOffset <= MaxCLOffset) + { + pFormat = (SvNumberformat*) aFTable.Get(nOffset); + if (pFormat && pFormat->GetLanguage() == eLnge) + return nOffset; + nOffset += SV_COUNTRY_LANGUAGE_OFFSET; + } + return nOffset; +} + +sal_uInt32 SvNumberFormatter::ImpIsEntry(const String& rString, + sal_uInt32 nCLOffset, + LanguageType eLnge) +{ +#ifndef NF_COMMENT_IN_FORMATSTRING +#error NF_COMMENT_IN_FORMATSTRING not defined (zformat.hxx) +#endif +#if NF_COMMENT_IN_FORMATSTRING + String aStr( rString ); + SvNumberformat::EraseComment( aStr ); +#endif + sal_uInt32 res = NUMBERFORMAT_ENTRY_NOT_FOUND; + SvNumberformat* pEntry; + pEntry = (SvNumberformat*) aFTable.Seek(nCLOffset); + while ( res == NUMBERFORMAT_ENTRY_NOT_FOUND && + pEntry && pEntry->GetLanguage() == eLnge ) + { +#if NF_COMMENT_IN_FORMATSTRING + if ( pEntry->GetComment().Len() ) + { + String aFormat( pEntry->GetFormatstring() ); + SvNumberformat::EraseComment( aFormat ); + if ( aStr == aFormat ) + res = aFTable.GetCurKey(); + else + pEntry = (SvNumberformat*) aFTable.Next(); + } + else + { + if ( aStr == pEntry->GetFormatstring() ) + res = aFTable.GetCurKey(); + else + pEntry = (SvNumberformat*) aFTable.Next(); + } +#else + if ( rString == pEntry->GetFormatstring() ) + res = aFTable.GetCurKey(); + else + pEntry = (SvNumberformat*) aFTable.Next(); +#endif + } + return res; +} + + +SvNumberFormatTable& SvNumberFormatter::GetFirstEntryTable( + short& eType, + sal_uInt32& FIndex, + LanguageType& rLnge) +{ + short eTypetmp = eType; + if (eType == NUMBERFORMAT_ALL) // Leere Zelle oder don't care + rLnge = IniLnge; + else + { + SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(FIndex); + if (!pFormat) + { +// DBG_ERROR("SvNumberFormatter:: Unbekanntes altes Zahlformat (1)"); + rLnge = IniLnge; + eType = NUMBERFORMAT_ALL; + eTypetmp = eType; + } + else + { + rLnge = pFormat->GetLanguage(); + eType = pFormat->GetType()&~NUMBERFORMAT_DEFINED; + if (eType == 0) + { + eType = NUMBERFORMAT_DEFINED; + eTypetmp = eType; + } + else if (eType == NUMBERFORMAT_DATETIME) + { + eTypetmp = eType; + eType = NUMBERFORMAT_DATE; + } + else + eTypetmp = eType; + } + } + ChangeIntl(rLnge); + return GetEntryTable(eTypetmp, FIndex, rLnge); +} + +sal_uInt32 SvNumberFormatter::ImpGenerateCL( LanguageType eLnge, BOOL bLoadingSO5 ) +{ + ChangeIntl(eLnge); + sal_uInt32 CLOffset = ImpGetCLOffset(ActLnge); + if (CLOffset > MaxCLOffset) + { // new CL combination + if (LocaleDataWrapper::areChecksEnabled()) + { + Locale aLoadedLocale = xLocaleData->getLoadedLocale(); + if ( aLoadedLocale.Language != aLocale.Language || + aLoadedLocale.Country != aLocale.Country ) + { + String aMsg( RTL_CONSTASCII_USTRINGPARAM( + "SvNumerFormatter::ImpGenerateCL: locales don't match:")); + LocaleDataWrapper::outputCheckMessage( + xLocaleData->appendLocaleInfo( aMsg )); + } + // test XML locale data FormatElement entries + { + uno::Sequence< i18n::FormatElement > xSeq = + xLocaleData->getAllFormats(); + // A test for completeness of formatindex="0" ... + // formatindex="47" is not needed here since it is done in + // ImpGenerateFormats(). + + // Test for dupes of formatindex="..." + for ( sal_Int32 j = 0; j < xSeq.getLength(); j++ ) + { + sal_Int16 nIdx = xSeq[j].formatIndex; + String aDupes; + for ( sal_Int32 i = 0; i < xSeq.getLength(); i++ ) + { + if ( i != j && xSeq[i].formatIndex == nIdx ) + { + aDupes += String::CreateFromInt32( i ); + aDupes += '('; + aDupes += String( xSeq[i].formatKey ); + aDupes += ')'; + aDupes += ' '; + } + } + if ( aDupes.Len() ) + { + String aMsg( RTL_CONSTASCII_USTRINGPARAM( + "XML locale data FormatElement formatindex dupe: ")); + aMsg += String::CreateFromInt32( nIdx ); + aMsg.AppendAscii( RTL_CONSTASCII_STRINGPARAM( + "\nFormatElements: ")); + aMsg += String::CreateFromInt32( j ); + aMsg += '('; + aMsg += String( xSeq[j].formatKey ); + aMsg += ')'; + aMsg += ' '; + aMsg += aDupes; + LocaleDataWrapper::outputCheckMessage( + xLocaleData->appendLocaleInfo( aMsg )); + } + } + } + } + + MaxCLOffset += SV_COUNTRY_LANGUAGE_OFFSET; + ImpGenerateFormats( MaxCLOffset, bLoadingSO5 ); + CLOffset = MaxCLOffset; + } + return CLOffset; +} + +SvNumberFormatTable& SvNumberFormatter::ChangeCL(short eType, + sal_uInt32& FIndex, + LanguageType eLnge) +{ + ImpGenerateCL(eLnge); + return GetEntryTable(eType, FIndex, ActLnge); +} + +SvNumberFormatTable& SvNumberFormatter::GetEntryTable( + short eType, + sal_uInt32& FIndex, + LanguageType eLnge) +{ + if ( pFormatTable ) + pFormatTable->Clear(); + else + pFormatTable = new SvNumberFormatTable; + ChangeIntl(eLnge); + sal_uInt32 CLOffset = ImpGetCLOffset(ActLnge); + + // Might generate and insert a default format for the given type + // (e.g. currency) => has to be done before collecting formats. + sal_uInt32 nDefaultIndex = GetStandardFormat( eType, ActLnge ); + + SvNumberformat* pEntry; + pEntry = (SvNumberformat*) aFTable.Seek(CLOffset); + + if (eType == NUMBERFORMAT_ALL) + { + while (pEntry && pEntry->GetLanguage() == ActLnge) + { // copy all entries to output table + pFormatTable->Insert( aFTable.GetCurKey(), pEntry ); + pEntry = (SvNumberformat*) aFTable.Next(); + } + } + else + { + while (pEntry && pEntry->GetLanguage() == ActLnge) + { // copy entries of queried type to output table + if ((pEntry->GetType()) & eType) + pFormatTable->Insert(aFTable.GetCurKey(),pEntry); + pEntry = (SvNumberformat*) aFTable.Next(); + } + } + if ( pFormatTable->Count() > 0 ) + { // select default if queried format doesn't exist or queried type or + // language differ from existing format + pEntry = aFTable.Get(FIndex); + if ( !pEntry || !(pEntry->GetType() & eType) || pEntry->GetLanguage() != ActLnge ) + FIndex = nDefaultIndex; + } + return *pFormatTable; +} + +BOOL SvNumberFormatter::IsNumberFormat(const String& sString, + sal_uInt32& F_Index, + double& fOutNumber) +{ + short FType; + const SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(F_Index); + if (!pFormat) + { +// DBG_ERROR("SvNumberFormatter:: Unbekanntes altes Zahlformat (2)"); + ChangeIntl(IniLnge); + FType = NUMBERFORMAT_NUMBER; + } + else + { + FType = pFormat->GetType() &~NUMBERFORMAT_DEFINED; + if (FType == 0) + FType = NUMBERFORMAT_DEFINED; + ChangeIntl(pFormat->GetLanguage()); + } + BOOL res; + short RType = FType; + // Ergebnistyp + // ohne def-Kennung + if (RType == NUMBERFORMAT_TEXT) // Zahlzelle ->Stringz. + res = FALSE; + else + res = pStringScanner->IsNumberFormat(sString, RType, fOutNumber, pFormat); + + if (res && !IsCompatible(FType, RType)) // unpassender Typ + { + switch ( RType ) + { + case NUMBERFORMAT_TIME : + { + if ( pStringScanner->GetDecPos() ) + { // 100stel Sekunden + if ( pStringScanner->GetAnzNums() > 3 || fOutNumber < 0.0 ) + F_Index = GetFormatIndex( NF_TIME_HH_MMSS00, ActLnge ); + else + F_Index = GetFormatIndex( NF_TIME_MMSS00, ActLnge ); + } + else if ( fOutNumber >= 1.0 || fOutNumber < 0.0 ) + F_Index = GetFormatIndex( NF_TIME_HH_MMSS, ActLnge ); + else + F_Index = GetStandardFormat( RType, ActLnge ); + } + break; + default: + F_Index = GetStandardFormat( RType, ActLnge ); + } + } + return res; +} + +BOOL SvNumberFormatter::IsCompatible(short eOldType, + short eNewType) +{ + if (eOldType == eNewType) + return TRUE; + else if (eOldType == NUMBERFORMAT_DEFINED) + return TRUE; + else + { + switch (eNewType) + { + case NUMBERFORMAT_NUMBER: + { + switch (eOldType) + { + case NUMBERFORMAT_PERCENT: + case NUMBERFORMAT_CURRENCY: + case NUMBERFORMAT_SCIENTIFIC: + case NUMBERFORMAT_FRACTION: +// case NUMBERFORMAT_LOGICAL: + case NUMBERFORMAT_DEFINED: + return TRUE; + default: + return FALSE; + } + } + break; + case NUMBERFORMAT_DATE: + { + switch (eOldType) + { + case NUMBERFORMAT_DATETIME: + return TRUE; + default: + return FALSE; + } + } + break; + case NUMBERFORMAT_TIME: + { + switch (eOldType) + { + case NUMBERFORMAT_DATETIME: + return TRUE; + default: + return FALSE; + } + } + break; + case NUMBERFORMAT_DATETIME: + { + switch (eOldType) + { + case NUMBERFORMAT_TIME: + case NUMBERFORMAT_DATE: + return TRUE; + default: + return FALSE; + } + } + break; + default: + return FALSE; + } + return FALSE; + } +} + + +sal_uInt32 SvNumberFormatter::ImpGetDefaultFormat( short nType ) +{ + sal_uInt32 CLOffset = ImpGetCLOffset( ActLnge ); + sal_uInt32 nSearch; + switch( nType ) + { + case NUMBERFORMAT_DATE : + nSearch = CLOffset + ZF_STANDARD_DATE; + break; + case NUMBERFORMAT_TIME : + nSearch = CLOffset + ZF_STANDARD_TIME; + break; + case NUMBERFORMAT_DATETIME : + nSearch = CLOffset + ZF_STANDARD_DATETIME; + break; + case NUMBERFORMAT_PERCENT : + nSearch = CLOffset + ZF_STANDARD_PERCENT; + break; + case NUMBERFORMAT_SCIENTIFIC: + nSearch = CLOffset + ZF_STANDARD_SCIENTIFIC; + break; + default: + nSearch = CLOffset + ZF_STANDARD; + } + sal_uInt32 nDefaultFormat = (sal_uInt32)(sal_uIntPtr) aDefaultFormatKeys.Get( nSearch ); + if ( !nDefaultFormat ) + nDefaultFormat = NUMBERFORMAT_ENTRY_NOT_FOUND; + if ( nDefaultFormat == NUMBERFORMAT_ENTRY_NOT_FOUND ) + { // look for a defined standard + sal_uInt32 nStopKey = CLOffset + SV_COUNTRY_LANGUAGE_OFFSET; + sal_uInt32 nKey; + aFTable.Seek( CLOffset ); + while ( (nKey = aFTable.GetCurKey()) >= CLOffset && nKey < nStopKey ) + { + const SvNumberformat* pEntry = + (const SvNumberformat*) aFTable.GetCurObject(); + if ( pEntry->IsStandard() && ((pEntry->GetType() & + ~NUMBERFORMAT_DEFINED) == nType) ) + { + nDefaultFormat = nKey; + break; // while + } + aFTable.Next(); + } + + if ( nDefaultFormat == NUMBERFORMAT_ENTRY_NOT_FOUND ) + { // none found, use old fixed standards + switch( nType ) + { + case NUMBERFORMAT_DATE : + nDefaultFormat = CLOffset + ZF_STANDARD_DATE; + break; + case NUMBERFORMAT_TIME : + nDefaultFormat = CLOffset + ZF_STANDARD_TIME+1; + break; + case NUMBERFORMAT_DATETIME : + nDefaultFormat = CLOffset + ZF_STANDARD_DATETIME; + break; + case NUMBERFORMAT_PERCENT : + nDefaultFormat = CLOffset + ZF_STANDARD_PERCENT+1; + break; + case NUMBERFORMAT_SCIENTIFIC: + nDefaultFormat = CLOffset + ZF_STANDARD_SCIENTIFIC; + break; + default: + nDefaultFormat = CLOffset + ZF_STANDARD; + } + } + aDefaultFormatKeys.Insert( nSearch, (void*) nDefaultFormat ); + } + return nDefaultFormat; +} + + +sal_uInt32 SvNumberFormatter::GetStandardFormat( short eType, LanguageType eLnge ) +{ + sal_uInt32 CLOffset = ImpGenerateCL(eLnge); + switch(eType) + { + case NUMBERFORMAT_CURRENCY : + { + if ( eLnge == LANGUAGE_SYSTEM ) + return ImpGetDefaultSystemCurrencyFormat(); + else + return ImpGetDefaultCurrencyFormat(); + } + case NUMBERFORMAT_DATE : + case NUMBERFORMAT_TIME : + case NUMBERFORMAT_DATETIME : + case NUMBERFORMAT_PERCENT : + case NUMBERFORMAT_SCIENTIFIC: + return ImpGetDefaultFormat( eType ); + + case NUMBERFORMAT_FRACTION : return CLOffset + ZF_STANDARD_FRACTION; + case NUMBERFORMAT_LOGICAL : return CLOffset + ZF_STANDARD_LOGICAL; + case NUMBERFORMAT_TEXT : return CLOffset + ZF_STANDARD_TEXT; + case NUMBERFORMAT_ALL : + case NUMBERFORMAT_DEFINED : + case NUMBERFORMAT_NUMBER : + case NUMBERFORMAT_UNDEFINED : + default : return CLOffset + ZF_STANDARD; + } +} + +BOOL SvNumberFormatter::IsSpecialStandardFormat( sal_uInt32 nFIndex, + LanguageType eLnge ) +{ + return + nFIndex == GetFormatIndex( NF_TIME_MMSS00, eLnge ) || + nFIndex == GetFormatIndex( NF_TIME_HH_MMSS00, eLnge ) || + nFIndex == GetFormatIndex( NF_TIME_HH_MMSS, eLnge ) + ; +} + +sal_uInt32 SvNumberFormatter::GetStandardFormat( sal_uInt32 nFIndex, short eType, + LanguageType eLnge ) +{ + if ( IsSpecialStandardFormat( nFIndex, eLnge ) ) + return nFIndex; + else + return GetStandardFormat( eType, eLnge ); +} + +sal_uInt32 SvNumberFormatter::GetStandardFormat( double fNumber, sal_uInt32 nFIndex, + short eType, LanguageType eLnge ) +{ + if ( IsSpecialStandardFormat( nFIndex, eLnge ) ) + return nFIndex; + + switch( eType ) + { + case NUMBERFORMAT_TIME : + { + BOOL bSign; + if ( fNumber < 0.0 ) + { + bSign = TRUE; + fNumber = -fNumber; + } + else + bSign = FALSE; + double fSeconds = fNumber * 86400; + if ( floor( fSeconds + 0.5 ) * 100 != floor( fSeconds * 100 + 0.5 ) ) + { // mit 100stel Sekunden + if ( bSign || fSeconds >= 3600 ) + return GetFormatIndex( NF_TIME_HH_MMSS00, eLnge ); + else + return GetFormatIndex( NF_TIME_MMSS00, eLnge ); + } + else + { + if ( bSign || fNumber >= 1.0 ) + return GetFormatIndex( NF_TIME_HH_MMSS, eLnge ); + else + return GetStandardFormat( eType, eLnge ); + } + } + default: + return GetStandardFormat( eType, eLnge ); + } +} + +void SvNumberFormatter::GetInputLineString(const double& fOutNumber, + sal_uInt32 nFIndex, + String& sOutString) +{ + SvNumberformat* pFormat; + short nOldPrec; + Color* pColor; + pFormat = (SvNumberformat*) aFTable.Get(nFIndex); + if (!pFormat) + pFormat = aFTable.Get(ZF_STANDARD); + LanguageType eLang = pFormat->GetLanguage(); + ChangeIntl( eLang ); + short eType = pFormat->GetType() & ~NUMBERFORMAT_DEFINED; + if (eType == 0) + eType = NUMBERFORMAT_DEFINED; + nOldPrec = -1; + if (eType == NUMBERFORMAT_NUMBER || eType == NUMBERFORMAT_PERCENT + || eType == NUMBERFORMAT_CURRENCY + || eType == NUMBERFORMAT_SCIENTIFIC + || eType == NUMBERFORMAT_FRACTION) + { + if (eType != NUMBERFORMAT_PERCENT) // spaeter Sonderbehandlung % + eType = NUMBERFORMAT_NUMBER; + nOldPrec = pFormatScanner->GetStandardPrec(); + ChangeStandardPrec(300); // Merkwert + } + sal_uInt32 nKey = nFIndex; + switch ( eType ) + { // #61619# immer vierstelliges Jahr editieren + case NUMBERFORMAT_DATE : + nKey = GetFormatIndex( NF_DATE_SYS_DDMMYYYY, eLang ); + break; + case NUMBERFORMAT_DATETIME : + nKey = GetFormatIndex( NF_DATETIME_SYS_DDMMYYYY_HHMMSS, eLang ); + break; + default: + nKey = GetStandardFormat( fOutNumber, nFIndex, eType, eLang ); + } + if ( nKey != nFIndex ) + pFormat = (SvNumberformat*) aFTable.Get( nKey ); + if (pFormat) + { + if ( eType == NUMBERFORMAT_TIME && pFormat->GetFormatPrecision() ) + { + nOldPrec = pFormatScanner->GetStandardPrec(); + ChangeStandardPrec(300); // Merkwert + } + pFormat->GetOutputString(fOutNumber, sOutString, &pColor); + } + if (nOldPrec != -1) + ChangeStandardPrec(nOldPrec); +} + +void SvNumberFormatter::GetOutputString(const double& fOutNumber, + sal_uInt32 nFIndex, + String& sOutString, + Color** ppColor) +{ + if (bNoZero && fOutNumber == 0.0) + { + sOutString.Erase(); + return; + } + SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nFIndex); + if (!pFormat) + pFormat = aFTable.Get(ZF_STANDARD); + ChangeIntl(pFormat->GetLanguage()); + pFormat->GetOutputString(fOutNumber, sOutString, ppColor); +} + +void SvNumberFormatter::GetOutputString(String& sString, + sal_uInt32 nFIndex, + String& sOutString, + Color** ppColor) +{ + SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nFIndex); + if (!pFormat) + pFormat = aFTable.Get(ZF_STANDARD_TEXT); + if (!pFormat->IsTextFormat() && !pFormat->HasTextFormat()) + { + *ppColor = NULL; + sOutString = sString; + } + else + { + ChangeIntl(pFormat->GetLanguage()); + pFormat->GetOutputString(sString, sOutString, ppColor); + } +} + +BOOL SvNumberFormatter::GetPreviewString(const String& sFormatString, + double fPreviewNumber, + String& sOutString, + Color** ppColor, + LanguageType eLnge) +{ + if (sFormatString.Len() == 0) // keinen Leerstring + return FALSE; + + xub_StrLen nCheckPos = STRING_NOTFOUND; + sal_uInt32 nKey; + if (eLnge == LANGUAGE_DONTKNOW) + eLnge = IniLnge; + ChangeIntl(eLnge); // ggfs. austauschen + eLnge = ActLnge; + String sTmpString = sFormatString; + SvNumberformat* p_Entry = new SvNumberformat(sTmpString, + pFormatScanner, + pStringScanner, + nCheckPos, + eLnge); + if (nCheckPos == 0) // String ok + { + sal_uInt32 CLOffset = ImpGenerateCL(eLnge); // ggfs. neu Standard- + // formate anlegen + nKey = ImpIsEntry(p_Entry->GetFormatstring(),CLOffset, eLnge); + if (nKey != NUMBERFORMAT_ENTRY_NOT_FOUND) // schon vorhanden + GetOutputString(fPreviewNumber,nKey,sOutString,ppColor); + else + p_Entry->GetOutputString(fPreviewNumber,sOutString, ppColor); + delete p_Entry; + return TRUE; + } + else + { + delete p_Entry; + return FALSE; + } +} + +BOOL SvNumberFormatter::GetPreviewStringGuess( const String& sFormatString, + double fPreviewNumber, + String& sOutString, + Color** ppColor, + LanguageType eLnge ) +{ + if (sFormatString.Len() == 0) // keinen Leerstring + return FALSE; + + if (eLnge == LANGUAGE_DONTKNOW) + eLnge = IniLnge; + + ChangeIntl( eLnge ); + eLnge = ActLnge; + BOOL bEnglish = (eLnge == LANGUAGE_ENGLISH_US); + + String aFormatStringUpper( pCharClass->upper( sFormatString ) ); + sal_uInt32 nCLOffset = ImpGenerateCL( eLnge ); + sal_uInt32 nKey = ImpIsEntry( aFormatStringUpper, nCLOffset, eLnge ); + if ( nKey != NUMBERFORMAT_ENTRY_NOT_FOUND ) + { // Zielformat vorhanden + GetOutputString( fPreviewNumber, nKey, sOutString, ppColor ); + return TRUE; + } + + SvNumberformat *pEntry = NULL; + xub_StrLen nCheckPos = STRING_NOTFOUND; + String sTmpString; + + if ( bEnglish ) + { + sTmpString = sFormatString; + pEntry = new SvNumberformat( sTmpString, pFormatScanner, + pStringScanner, nCheckPos, eLnge ); + } + else + { + nCLOffset = ImpGenerateCL( LANGUAGE_ENGLISH_US ); + nKey = ImpIsEntry( aFormatStringUpper, nCLOffset, LANGUAGE_ENGLISH_US ); + BOOL bEnglishFormat = (nKey != NUMBERFORMAT_ENTRY_NOT_FOUND); + + // try english --> other bzw. english nach other konvertieren + LanguageType eFormatLang = LANGUAGE_ENGLISH_US; + pFormatScanner->SetConvertMode( LANGUAGE_ENGLISH_US, eLnge ); + sTmpString = sFormatString; + pEntry = new SvNumberformat( sTmpString, pFormatScanner, + pStringScanner, nCheckPos, eFormatLang ); + pFormatScanner->SetConvertMode( FALSE ); + ChangeIntl( eLnge ); + + if ( !bEnglishFormat ) + { + if ( nCheckPos > 0 || xTransliteration->isEqual( sFormatString, + pEntry->GetFormatstring() ) ) + { // other Format + delete pEntry; + sTmpString = sFormatString; + pEntry = new SvNumberformat( sTmpString, pFormatScanner, + pStringScanner, nCheckPos, eLnge ); + } + else + { // verify english + xub_StrLen nCheckPos2 = STRING_NOTFOUND; + // try other --> english + eFormatLang = eLnge; + pFormatScanner->SetConvertMode( eLnge, LANGUAGE_ENGLISH_US ); + sTmpString = sFormatString; + SvNumberformat* pEntry2 = new SvNumberformat( sTmpString, pFormatScanner, + pStringScanner, nCheckPos2, eFormatLang ); + pFormatScanner->SetConvertMode( FALSE ); + ChangeIntl( eLnge ); + if ( nCheckPos2 == 0 && !xTransliteration->isEqual( sFormatString, + pEntry2->GetFormatstring() ) ) + { // other Format + delete pEntry; + sTmpString = sFormatString; + pEntry = new SvNumberformat( sTmpString, pFormatScanner, + pStringScanner, nCheckPos, eLnge ); + } + delete pEntry2; + } + } + } + + if (nCheckPos == 0) // String ok + { + ImpGenerateCL( eLnge ); // ggfs. neu Standardformate anlegen + pEntry->GetOutputString( fPreviewNumber, sOutString, ppColor ); + delete pEntry; + return TRUE; + } + delete pEntry; + return FALSE; +} + +sal_uInt32 SvNumberFormatter::TestNewString(const String& sFormatString, + LanguageType eLnge) +{ + if (sFormatString.Len() == 0) // keinen Leerstring + return NUMBERFORMAT_ENTRY_NOT_FOUND; + + xub_StrLen nCheckPos = STRING_NOTFOUND; + if (eLnge == LANGUAGE_DONTKNOW) + eLnge = IniLnge; + ChangeIntl(eLnge); // ggfs. austauschen + eLnge = ActLnge; + sal_uInt32 nRes; + String sTmpString = sFormatString; + SvNumberformat* pEntry = new SvNumberformat(sTmpString, + pFormatScanner, + pStringScanner, + nCheckPos, + eLnge); + if (nCheckPos == 0) // String ok + { + sal_uInt32 CLOffset = ImpGenerateCL(eLnge); // ggfs. neu Standard- + // formate anlegen + nRes = ImpIsEntry(pEntry->GetFormatstring(),CLOffset, eLnge); + // schon vorhanden ? + } + else + nRes = NUMBERFORMAT_ENTRY_NOT_FOUND; + delete pEntry; + return nRes; +} + +SvNumberformat* SvNumberFormatter::ImpInsertFormat( + const ::com::sun::star::i18n::NumberFormatCode& rCode, + sal_uInt32 nPos, BOOL bAfterLoadingSO5, sal_Int16 nOrgIndex ) +{ + String aCodeStr( rCode.Code ); + if ( rCode.Index < NF_INDEX_TABLE_ENTRIES && + rCode.Usage == ::com::sun::star::i18n::KNumberFormatUsage::CURRENCY && + rCode.Index != NF_CURRENCY_1000DEC2_CCC ) + { // strip surrounding [$...] on automatic currency + if ( aCodeStr.SearchAscii( "[$" ) != STRING_NOTFOUND ) + aCodeStr = SvNumberformat::StripNewCurrencyDelimiters( aCodeStr, FALSE ); + else + { + if (LocaleDataWrapper::areChecksEnabled() && + rCode.Index != NF_CURRENCY_1000DEC2_CCC ) + { + String aMsg( RTL_CONSTASCII_USTRINGPARAM( + "SvNumberFormatter::ImpInsertFormat: no [$...] on currency format code, index ")); + aMsg += String::CreateFromInt32( rCode.Index ); + aMsg.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ":\n")); + aMsg += String( rCode.Code ); + LocaleDataWrapper::outputCheckMessage( + xLocaleData->appendLocaleInfo( aMsg)); + } + } + } + xub_StrLen nCheckPos = 0; + SvNumberformat* pFormat = new SvNumberformat(aCodeStr, + pFormatScanner, + pStringScanner, + nCheckPos, + ActLnge); + if ( !pFormat || nCheckPos > 0 ) + { + if (LocaleDataWrapper::areChecksEnabled()) + { + String aMsg( RTL_CONSTASCII_USTRINGPARAM( + "SvNumberFormatter::ImpInsertFormat: bad format code, index ")); + aMsg += String::CreateFromInt32( rCode.Index ); + aMsg += '\n'; + aMsg += String( rCode.Code ); + LocaleDataWrapper::outputCheckMessage( + xLocaleData->appendLocaleInfo( aMsg)); + } + delete pFormat; + return NULL; + } + if ( rCode.Index >= NF_INDEX_TABLE_ENTRIES ) + { + sal_uInt32 nCLOffset = nPos - (nPos % SV_COUNTRY_LANGUAGE_OFFSET); + sal_uInt32 nKey = ImpIsEntry( aCodeStr, nCLOffset, ActLnge ); + if ( nKey != NUMBERFORMAT_ENTRY_NOT_FOUND ) + { + if (LocaleDataWrapper::areChecksEnabled()) + { + switch ( nOrgIndex ) + { + // These may be dupes of integer versions for locales where + // currencies have no decimals like Italian Lira. + case NF_CURRENCY_1000DEC2 : // NF_CURRENCY_1000INT + case NF_CURRENCY_1000DEC2_RED : // NF_CURRENCY_1000INT_RED + case NF_CURRENCY_1000DEC2_DASHED : // NF_CURRENCY_1000INT_RED + break; + default: + if ( !bAfterLoadingSO5 ) + { // If bAfterLoadingSO5 there will definitely be some dupes, + // don't cry. But we need this test for verification of locale + // data if not loading old SO5 documents. + String aMsg( RTL_CONSTASCII_USTRINGPARAM( + "SvNumberFormatter::ImpInsertFormat: dup format code, index ")); + aMsg += String::CreateFromInt32( rCode.Index ); + aMsg += '\n'; + aMsg += String( rCode.Code ); + LocaleDataWrapper::outputCheckMessage( + xLocaleData->appendLocaleInfo( aMsg)); + } + } + } + delete pFormat; + return NULL; + } + else if ( nPos - nCLOffset >= SV_COUNTRY_LANGUAGE_OFFSET ) + { + if (LocaleDataWrapper::areChecksEnabled()) + { + String aMsg( RTL_CONSTASCII_USTRINGPARAM( + "SvNumberFormatter::ImpInsertFormat: too many format codes, index ")); + aMsg += String::CreateFromInt32( rCode.Index ); + aMsg += '\n'; + aMsg += String( rCode.Code ); + LocaleDataWrapper::outputCheckMessage( + xLocaleData->appendLocaleInfo( aMsg)); + } + delete pFormat; + return NULL; + } + } + if ( !aFTable.Insert( nPos, pFormat ) ) + { + if (LocaleDataWrapper::areChecksEnabled()) + { + String aMsg( RTL_CONSTASCII_USTRINGPARAM( + "ImpInsertFormat: can't insert number format key pos: ")); + aMsg += String::CreateFromInt32( nPos ); + aMsg.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", code index ")); + aMsg += String::CreateFromInt32( rCode.Index ); + aMsg += '\n'; + aMsg += String( rCode.Code ); + LocaleDataWrapper::outputCheckMessage( + xLocaleData->appendLocaleInfo( aMsg)); + } + delete pFormat; + return NULL; + } + if ( rCode.Default ) + pFormat->SetStandard(); + if ( rCode.DefaultName.getLength() ) + pFormat->SetComment( rCode.DefaultName ); + return pFormat; +} + +SvNumberformat* SvNumberFormatter::ImpInsertNewStandardFormat( + const ::com::sun::star::i18n::NumberFormatCode& rCode, + sal_uInt32 nPos, USHORT nVersion, BOOL bAfterLoadingSO5, + sal_Int16 nOrgIndex ) +{ + SvNumberformat* pNewFormat = ImpInsertFormat( rCode, nPos, + bAfterLoadingSO5, nOrgIndex ); + if (pNewFormat) + pNewFormat->SetNewStandardDefined( nVersion ); + // so that it gets saved, displayed properly, and converted by old versions + return pNewFormat; +} + +void SvNumberFormatter::GetFormatSpecialInfo(sal_uInt32 nFormat, + BOOL& bThousand, + BOOL& IsRed, + USHORT& nPrecision, + USHORT& nAnzLeading) + +{ + const SvNumberformat* pFormat = aFTable.Get(nFormat); + if (pFormat) + pFormat->GetFormatSpecialInfo(bThousand, IsRed, + nPrecision, nAnzLeading); + else + { + bThousand = FALSE; + IsRed = FALSE; + nPrecision = pFormatScanner->GetStandardPrec(); + nAnzLeading = 0; + } +} + +USHORT SvNumberFormatter::GetFormatPrecision( sal_uInt32 nFormat ) const +{ + const SvNumberformat* pFormat = aFTable.Get( nFormat ); + if ( pFormat ) + return pFormat->GetFormatPrecision(); + else + return pFormatScanner->GetStandardPrec(); +} + + +String SvNumberFormatter::GetFormatDecimalSep( sal_uInt32 nFormat ) const +{ + const SvNumberformat* pFormat = aFTable.Get( nFormat ); + if ( !pFormat || pFormat->GetLanguage() == ActLnge ) + return GetNumDecimalSep(); + + String aRet; + LanguageType eSaveLang = xLocaleData.getCurrentLanguage(); + if ( pFormat->GetLanguage() == eSaveLang ) + aRet = xLocaleData->getNumDecimalSep(); + else + { + ::com::sun::star::lang::Locale aSaveLocale( xLocaleData->getLocale() ); + ::com::sun::star::lang::Locale aTmpLocale(MsLangId::convertLanguageToLocale(pFormat->GetLanguage())); + ((SvNumberFormatter*)this)->xLocaleData.changeLocale(aTmpLocale, pFormat->GetLanguage() ); + aRet = xLocaleData->getNumDecimalSep(); + ((SvNumberFormatter*)this)->xLocaleData.changeLocale( aSaveLocale, eSaveLang ); + } + return aRet; +} + + +sal_uInt32 SvNumberFormatter::GetFormatSpecialInfo( const String& rFormatString, + BOOL& bThousand, BOOL& IsRed, USHORT& nPrecision, + USHORT& nAnzLeading, LanguageType eLnge ) + +{ + xub_StrLen nCheckPos = 0; + if (eLnge == LANGUAGE_DONTKNOW) + eLnge = IniLnge; + ChangeIntl(eLnge); // ggfs. austauschen + eLnge = ActLnge; + String aTmpStr( rFormatString ); + SvNumberformat* pFormat = new SvNumberformat( aTmpStr, + pFormatScanner, pStringScanner, nCheckPos, eLnge ); + if ( nCheckPos == 0 ) + pFormat->GetFormatSpecialInfo( bThousand, IsRed, nPrecision, nAnzLeading ); + else + { + bThousand = FALSE; + IsRed = FALSE; + nPrecision = pFormatScanner->GetStandardPrec(); + nAnzLeading = 0; + } + delete pFormat; + return nCheckPos; +} + + +inline sal_uInt32 SetIndexTable( NfIndexTableOffset nTabOff, sal_uInt32 nIndOff ) +{ + if ( !bIndexTableInitialized ) + { + DBG_ASSERT( theIndexTable[nTabOff] == NUMBERFORMAT_ENTRY_NOT_FOUND, + "SetIndexTable: theIndexTable[nTabOff] already occupied" ); + theIndexTable[nTabOff] = nIndOff; + } + return nIndOff; +} + + +sal_Int32 SvNumberFormatter::ImpGetFormatCodeIndex( + ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode >& rSeq, + const NfIndexTableOffset nTabOff ) +{ + const sal_Int32 nLen = rSeq.getLength(); + for ( sal_Int32 j=0; jappendLocaleInfo( + aMsg)); + } + if ( nLen ) + { + sal_Int32 j; + // look for a preset default + for ( j=0; jappendLocaleInfo( aUMsg)); + aMsg.Erase(); + } + } + if ( nShort != -1 && nShortDef == -1 ) + aMsg += "no short type default "; + if ( nMedium != -1 && nMediumDef == -1 ) + aMsg += "no medium type default "; + if ( nLong != -1 && nLongDef == -1 ) + aMsg += "no long type default "; + if ( aMsg.Len() ) + { + aMsg.Insert( "SvNumberFormatter::ImpAdjustFormatCodeDefault: ", 0 ); + aMsg += "\nXML locale data FormatElement group of: "; + String aUMsg( aMsg, RTL_TEXTENCODING_ASCII_US); + aUMsg += String( pFormatArr[0].NameID ); + LocaleDataWrapper::outputCheckMessage( + xLocaleData->appendLocaleInfo( aUMsg)); + aMsg.Erase(); + } + } + // find the default (medium preferred, then long) and reset all other defaults + sal_Int32 nElem, nDef, nMedium; + nDef = nMedium = -1; + for ( nElem = 0; nElem < nCnt; nElem++ ) + { + if ( pFormatArr[nElem].Default ) + { + switch ( pFormatArr[nElem].Type ) + { + case i18n::KNumberFormatType::MEDIUM : + nDef = nMedium = nElem; + break; + case i18n::KNumberFormatType::LONG : + if ( nMedium == -1 ) + nDef = nElem; + // fallthru + default: + if ( nDef == -1 ) + nDef = nElem; + pFormatArr[nElem].Default = sal_False; + } + } + } + if ( nDef == -1 ) + nDef = 0; + pFormatArr[nDef].Default = sal_True; + return nDef; +} + + +void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, BOOL bLoadingSO5 ) +{ + using namespace ::com::sun::star; + + if ( !bIndexTableInitialized ) + { + for ( USHORT j=0; jGetConvertMode(); + if (bOldConvertMode) + pFormatScanner->SetConvertMode(FALSE); // switch off for this function + + NumberFormatCodeWrapper aNumberFormatCode( xServiceManager, GetLocale() ); + + xub_StrLen nCheckPos = 0; + SvNumberformat* pNewFormat = NULL; + String aFormatCode; + sal_Int32 nIdx; + sal_Bool bDefault; + + // Counter for additional builtin formats not fitting into the first 10 + // of a category (TLOT:=The Legacy Of Templin), altogether about 20 formats. + // Has to be incremented on each ImpInsertNewStandardformat, new formats + // must be appended, not inserted! + USHORT nNewExtended = ZF_STANDARD_NEWEXTENDED; + + // Number + uno::Sequence< i18n::NumberFormatCode > aFormatSeq + = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::FIXED_NUMBER ); + ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() ); + + // General + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_STANDARD ); + SvNumberformat* pStdFormat = ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_NUMBER_STANDARD, ZF_STANDARD )); + if (pStdFormat) + { + // This is _the_ standard format. + if (LocaleDataWrapper::areChecksEnabled() && + pStdFormat->GetType() != NUMBERFORMAT_NUMBER) + { + String aMsg( RTL_CONSTASCII_USTRINGPARAM( + "SvNumberFormatter::ImpGenerateFormats: General format not NUMBER")); + LocaleDataWrapper::outputCheckMessage( + xLocaleData->appendLocaleInfo( aMsg)); + } + pStdFormat->SetType( NUMBERFORMAT_NUMBER ); + pStdFormat->SetStandard(); + pStdFormat->SetLastInsertKey( SV_MAX_ANZ_STANDARD_FORMATE ); + } + else + { + if (LocaleDataWrapper::areChecksEnabled()) + { + String aMsg( RTL_CONSTASCII_USTRINGPARAM( + "SvNumberFormatter::ImpGenerateFormats: General format not insertable, nothing will work")); + LocaleDataWrapper::outputCheckMessage( + xLocaleData->appendLocaleInfo( aMsg)); + } + } + + // Boolean + aFormatCode = pFormatScanner->GetBooleanString(); + pNewFormat = new SvNumberformat( aFormatCode, + pFormatScanner, pStringScanner, nCheckPos, ActLnge ); + pNewFormat->SetType(NUMBERFORMAT_LOGICAL); + pNewFormat->SetStandard(); + if ( !aFTable.Insert( + CLOffset + SetIndexTable( NF_BOOLEAN, ZF_STANDARD_LOGICAL ), + pNewFormat)) + delete pNewFormat; + + // Text + aFormatCode = '@'; + pNewFormat = new SvNumberformat( aFormatCode, + pFormatScanner, pStringScanner, nCheckPos, ActLnge ); + pNewFormat->SetType(NUMBERFORMAT_TEXT); + pNewFormat->SetStandard(); + if ( !aFTable.Insert( + CLOffset + SetIndexTable( NF_TEXT, ZF_STANDARD_TEXT ), + pNewFormat)) + delete pNewFormat; + + + + // 0 + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_INT ); + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_NUMBER_INT, ZF_STANDARD+1 )); + + // 0.00 + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_DEC2 ); + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_NUMBER_DEC2, ZF_STANDARD+2 )); + + // #,##0 + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_1000INT ); + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_NUMBER_1000INT, ZF_STANDARD+3 )); + + // #,##0.00 + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_1000DEC2 ); + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_NUMBER_1000DEC2, ZF_STANDARD+4 )); + + // #.##0,00 System country/language dependent since number formatter version 6 + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_SYSTEM ); + ImpInsertNewStandardFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_NUMBER_SYSTEM, ZF_STANDARD+5 ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + + + // Percent number + aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::PERCENT_NUMBER ); + ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() ); + + // 0% + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_PERCENT_INT ); + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_PERCENT_INT, ZF_STANDARD_PERCENT )); + + // 0.00% + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_PERCENT_DEC2 ); + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_PERCENT_DEC2, ZF_STANDARD_PERCENT+1 )); + + + + // Currency. NO default standard option! Default is determined of locale + // data default currency and format is generated if needed. + aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::CURRENCY ); + if (LocaleDataWrapper::areChecksEnabled()) + { + // though no default desired here, test for correctness of locale data + ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() ); + } + + // #,##0 + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_CURRENCY_1000INT ); + bDefault = aFormatSeq[nIdx].Default; + aFormatSeq[nIdx].Default = sal_False; + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_CURRENCY_1000INT, ZF_STANDARD_CURRENCY )); + aFormatSeq[nIdx].Default = bDefault; + + // #,##0.00 + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_CURRENCY_1000DEC2 ); + bDefault = aFormatSeq[nIdx].Default; + aFormatSeq[nIdx].Default = sal_False; + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_CURRENCY_1000DEC2, ZF_STANDARD_CURRENCY+1 )); + aFormatSeq[nIdx].Default = bDefault; + + // #,##0 negative red + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_CURRENCY_1000INT_RED ); + bDefault = aFormatSeq[nIdx].Default; + aFormatSeq[nIdx].Default = sal_False; + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_CURRENCY_1000INT_RED, ZF_STANDARD_CURRENCY+2 )); + aFormatSeq[nIdx].Default = bDefault; + + // #,##0.00 negative red + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_CURRENCY_1000DEC2_RED ); + bDefault = aFormatSeq[nIdx].Default; + aFormatSeq[nIdx].Default = sal_False; + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_CURRENCY_1000DEC2_RED, ZF_STANDARD_CURRENCY+3 )); + aFormatSeq[nIdx].Default = bDefault; + + // #,##0.00 USD since number formatter version 3 + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_CURRENCY_1000DEC2_CCC ); + bDefault = aFormatSeq[nIdx].Default; + aFormatSeq[nIdx].Default = sal_False; + pNewFormat = ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_CURRENCY_1000DEC2_CCC, ZF_STANDARD_CURRENCY+4 )); + if ( pNewFormat ) + pNewFormat->SetUsed(TRUE); // must be saved for older versions + aFormatSeq[nIdx].Default = bDefault; + + // #.##0,-- since number formatter version 6 + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_CURRENCY_1000DEC2_DASHED ); + bDefault = aFormatSeq[nIdx].Default; + aFormatSeq[nIdx].Default = sal_False; + ImpInsertNewStandardFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_CURRENCY_1000DEC2_DASHED, ZF_STANDARD_CURRENCY+5 ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + aFormatSeq[nIdx].Default = bDefault; + + + + // Date + aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::DATE ); + ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() ); + + // DD.MM.YY System + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYSTEM_SHORT ); + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_DATE_SYSTEM_SHORT, ZF_STANDARD_DATE )); + + // NN DD.MMM YY + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DEF_NNDDMMMYY ); + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_DATE_DEF_NNDDMMMYY, ZF_STANDARD_DATE+1 )); + + // DD.MM.YY def/System + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_MMYY ); + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_DATE_SYS_MMYY, ZF_STANDARD_DATE+2 )); + + // DD MMM + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_DDMMM ); + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_DATE_SYS_DDMMM, ZF_STANDARD_DATE+3 )); + + // MMMM + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_MMMM ); + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_DATE_MMMM, ZF_STANDARD_DATE+4 )); + + // QQ YY + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_QQJJ ); + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_DATE_QQJJ, ZF_STANDARD_DATE+5 )); + + // DD.MM.YYYY since number formatter version 2, was DD.MM.[YY]YY + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_DDMMYYYY ); + pNewFormat = ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_DATE_SYS_DDMMYYYY, ZF_STANDARD_DATE+6 )); + if ( pNewFormat ) + pNewFormat->SetUsed(TRUE); // must be saved for older versions + + // DD.MM.YY def/System, since number formatter version 6 + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_DDMMYY ); + ImpInsertNewStandardFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_DATE_SYS_DDMMYY, ZF_STANDARD_DATE+7 ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + + // NNN, D. MMMM YYYY System + // Long day of week: "NNNN" instead of "NNN," because of compatibility + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYSTEM_LONG ); + ImpInsertNewStandardFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_DATE_SYSTEM_LONG, ZF_STANDARD_DATE+8 ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + + // Hard coded but system (regional settings) delimiters dependent long date formats + // since numberformatter version 6 + + // D. MMM YY def/System + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_DMMMYY ); + ImpInsertNewStandardFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_DATE_SYS_DMMMYY, ZF_STANDARD_DATE+9 ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + + //! Unfortunally TLOT intended only 10 builtin formats per category, more + //! would overwrite the next category (ZF_STANDARD_TIME) :-(( + //! Therefore they are inserted with nNewExtended++ (which is also limited) + + // D. MMM YYYY def/System + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_DMMMYYYY ); + ImpInsertNewStandardFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_DATE_SYS_DMMMYYYY, nNewExtended++ ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + + // D. MMMM YYYY def/System + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_DMMMMYYYY ); + ImpInsertNewStandardFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_DATE_SYS_DMMMMYYYY, nNewExtended++ ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + + // NN, D. MMM YY def/System + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_NNDMMMYY ); + ImpInsertNewStandardFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_DATE_SYS_NNDMMMYY, nNewExtended++ ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + + // NN, D. MMMM YYYY def/System + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_NNDMMMMYYYY ); + ImpInsertNewStandardFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_DATE_SYS_NNDMMMMYYYY, nNewExtended++ ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + + // NNN, D. MMMM YYYY def/System + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_NNNNDMMMMYYYY ); + ImpInsertNewStandardFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_DATE_SYS_NNNNDMMMMYYYY, nNewExtended++ ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + + // Hard coded DIN (Deutsche Industrie Norm) and EN (European Norm) date formats + + // D. MMM. YYYY DIN/EN + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DIN_DMMMYYYY ); + ImpInsertNewStandardFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_DATE_DIN_DMMMYYYY, nNewExtended++ ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + + // D. MMMM YYYY DIN/EN + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DIN_DMMMMYYYY ); + ImpInsertNewStandardFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_DATE_DIN_DMMMMYYYY, nNewExtended++ ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + + // MM-DD DIN/EN + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DIN_MMDD ); + ImpInsertNewStandardFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_DATE_DIN_MMDD, nNewExtended++ ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + + // YY-MM-DD DIN/EN + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DIN_YYMMDD ); + ImpInsertNewStandardFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_DATE_DIN_YYMMDD, nNewExtended++ ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + + // YYYY-MM-DD DIN/EN + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DIN_YYYYMMDD ); + ImpInsertNewStandardFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_DATE_DIN_YYYYMMDD, nNewExtended++ ), + SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); + + + + // Time + aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::TIME ); + ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() ); + + // HH:MM + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_HHMM ); + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_TIME_HHMM, ZF_STANDARD_TIME )); + + // HH:MM:SS + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_HHMMSS ); + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_TIME_HHMMSS, ZF_STANDARD_TIME+1 )); + + // HH:MM AM/PM + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_HHMMAMPM ); + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_TIME_HHMMAMPM, ZF_STANDARD_TIME+2 )); + + // HH:MM:SS AM/PM + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_HHMMSSAMPM ); + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_TIME_HHMMSSAMPM, ZF_STANDARD_TIME+3 )); + + // [HH]:MM:SS + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_HH_MMSS ); + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_TIME_HH_MMSS, ZF_STANDARD_TIME+4 )); + + // MM:SS,00 + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_MMSS00 ); + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_TIME_MMSS00, ZF_STANDARD_TIME+5 )); + + // [HH]:MM:SS,00 + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_HH_MMSS00 ); + ImpInsertNewStandardFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_TIME_HH_MMSS00, ZF_STANDARD_TIME+6 ), + SV_NUMBERFORMATTER_VERSION_NF_TIME_HH_MMSS00 ); + + + + // DateTime + aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::DATE_TIME ); + ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() ); + + // DD.MM.YY HH:MM System + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATETIME_SYSTEM_SHORT_HHMM ); + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_DATETIME_SYSTEM_SHORT_HHMM, ZF_STANDARD_DATETIME )); + + // DD.MM.YYYY HH:MM:SS System + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATETIME_SYS_DDMMYYYY_HHMMSS ); + ImpInsertNewStandardFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_DATETIME_SYS_DDMMYYYY_HHMMSS, ZF_STANDARD_DATETIME+1 ), + SV_NUMBERFORMATTER_VERSION_NF_DATETIME_SYS_DDMMYYYY_HHMMSS ); + + + + // Scientific number + aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::SCIENTIFIC_NUMBER ); + ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() ); + + // 0.00E+000 + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_SCIENTIFIC_000E000 ); + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_SCIENTIFIC_000E000, ZF_STANDARD_SCIENTIFIC )); + + // 0.00E+00 + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_SCIENTIFIC_000E00 ); + ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_SCIENTIFIC_000E00, ZF_STANDARD_SCIENTIFIC+1 )); + + + + // Fraction number (no default option) + i18n::NumberFormatCode aSingleFormatCode; + + // # ?/? + aSingleFormatCode.Code = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "# ?/?" ) ); + String s25( RTL_CONSTASCII_USTRINGPARAM( "# ?/?" ) ); // # ?/? + ImpInsertFormat( aSingleFormatCode, + CLOffset + SetIndexTable( NF_FRACTION_1, ZF_STANDARD_FRACTION )); + + // # ??/?? + //! "??/" would be interpreted by the compiler as a trigraph for '\' + aSingleFormatCode.Code = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "# ?\?/?\?" ) ); + ImpInsertFormat( aSingleFormatCode, + CLOffset + SetIndexTable( NF_FRACTION_2, ZF_STANDARD_FRACTION+1 )); + + // Week of year must be appended here because of nNewExtended + const String* pKeyword = pFormatScanner->GetKeywords(); + aSingleFormatCode.Code = pKeyword[NF_KEY_WW]; + ImpInsertNewStandardFormat( aSingleFormatCode, + CLOffset + SetIndexTable( NF_DATE_WW, nNewExtended++ ), + SV_NUMBERFORMATTER_VERSION_NF_DATE_WW ); + + + + bIndexTableInitialized = TRUE; + DBG_ASSERT( nNewExtended <= ZF_STANDARD_NEWEXTENDEDMAX, + "ImpGenerateFormats: overflow of nNewExtended standard formats" ); + + // Now all additional format codes provided by I18N, but only if not + // loading from old SO5 file format, then they are appended last. + if ( !bLoadingSO5 ) + ImpGenerateAdditionalFormats( CLOffset, aNumberFormatCode, FALSE ); + + if (bOldConvertMode) + pFormatScanner->SetConvertMode(TRUE); +} + + +void SvNumberFormatter::ImpGenerateAdditionalFormats( sal_uInt32 CLOffset, + NumberFormatCodeWrapper& rNumberFormatCode, BOOL bAfterLoadingSO5 ) +{ + using namespace ::com::sun::star; + + SvNumberformat* pStdFormat = + (SvNumberformat*) aFTable.Get( CLOffset + ZF_STANDARD ); + if ( !pStdFormat ) + { + DBG_ERRORFILE( "ImpGenerateAdditionalFormats: no GENERAL format" ); + return ; + } + sal_uInt32 nPos = CLOffset + pStdFormat->GetLastInsertKey(); + rNumberFormatCode.setLocale( GetLocale() ); + sal_Int32 j; + + // All currencies, this time with [$...] which was stripped in + // ImpGenerateFormats for old "automatic" currency formats. + uno::Sequence< i18n::NumberFormatCode > aFormatSeq = + rNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::CURRENCY ); + i18n::NumberFormatCode * pFormatArr = aFormatSeq.getArray(); + sal_Int32 nCodes = aFormatSeq.getLength(); + ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), nCodes ); + for ( j = 0; j < nCodes; j++ ) + { + if ( nPos - CLOffset >= SV_COUNTRY_LANGUAGE_OFFSET ) + { + DBG_ERRORFILE( "ImpGenerateAdditionalFormats: too many formats" ); + break; // for + } + if ( pFormatArr[j].Index < NF_INDEX_TABLE_ENTRIES && + pFormatArr[j].Index != NF_CURRENCY_1000DEC2_CCC ) + { // Insert only if not already inserted, but internal index must be + // above so ImpInsertFormat can distinguish it. + sal_Int16 nOrgIndex = pFormatArr[j].Index; + pFormatArr[j].Index = sal::static_int_cast< sal_Int16 >( + pFormatArr[j].Index + nCodes + NF_INDEX_TABLE_ENTRIES); + //! no default on currency + sal_Bool bDefault = aFormatSeq[j].Default; + aFormatSeq[j].Default = sal_False; + if ( ImpInsertNewStandardFormat( pFormatArr[j], nPos+1, + SV_NUMBERFORMATTER_VERSION_ADDITIONAL_I18N_FORMATS, + bAfterLoadingSO5, nOrgIndex ) ) + nPos++; + pFormatArr[j].Index = nOrgIndex; + aFormatSeq[j].Default = bDefault; + } + } + + // all additional format codes provided by I18N that are not old standard index + aFormatSeq = rNumberFormatCode.getAllFormatCodes(); + nCodes = aFormatSeq.getLength(); + if ( nCodes ) + { + pFormatArr = aFormatSeq.getArray(); + // don't check ALL + sal_Int32 nDef = ImpAdjustFormatCodeDefault( pFormatArr, nCodes, FALSE); + // don't have any defaults here + pFormatArr[nDef].Default = sal_False; + for ( j = 0; j < nCodes; j++ ) + { + if ( nPos - CLOffset >= SV_COUNTRY_LANGUAGE_OFFSET ) + { + DBG_ERRORFILE( "ImpGenerateAdditionalFormats: too many formats" ); + break; // for + } + if ( pFormatArr[j].Index >= NF_INDEX_TABLE_ENTRIES ) + if ( ImpInsertNewStandardFormat( pFormatArr[j], nPos+1, + SV_NUMBERFORMATTER_VERSION_ADDITIONAL_I18N_FORMATS, + bAfterLoadingSO5 ) ) + nPos++; + } + } + + pStdFormat->SetLastInsertKey( (USHORT)(nPos - CLOffset) ); +} + + +void SvNumberFormatter::ImpGetPosCurrFormat( String& sPosStr, const String& rCurrSymbol ) +{ + NfCurrencyEntry::CompletePositiveFormatString( sPosStr, + rCurrSymbol, xLocaleData->getCurrPositiveFormat() ); +} + +void SvNumberFormatter::ImpGetNegCurrFormat( String& sNegStr, const String& rCurrSymbol ) +{ + NfCurrencyEntry::CompleteNegativeFormatString( sNegStr, + rCurrSymbol, xLocaleData->getCurrNegativeFormat() ); +} + +void SvNumberFormatter::GenerateFormat(String& sString, + sal_uInt32 nIndex, + LanguageType eLnge, + BOOL bThousand, + BOOL IsRed, + USHORT nPrecision, + USHORT nAnzLeading) +{ + if (eLnge == LANGUAGE_DONTKNOW) + eLnge = IniLnge; + short eType = GetType(nIndex); + USHORT i; + ImpGenerateCL(eLnge); // ggfs. neu Standard- + // formate anlegen + sString.Erase(); + + utl::DigitGroupingIterator aGrouping( xLocaleData->getDigitGrouping()); + const xub_StrLen nDigitsInFirstGroup = static_cast(aGrouping.get()); + const String& rThSep = GetNumThousandSep(); + if (nAnzLeading == 0) + { + if (!bThousand) + sString += '#'; + else + { + sString += '#'; + sString += rThSep; + sString.Expand( sString.Len() + nDigitsInFirstGroup, '#' ); + } + } + else + { + for (i = 0; i < nAnzLeading; i++) + { + if (bThousand && i > 0 && i == aGrouping.getPos()) + { + sString.Insert( rThSep, 0 ); + aGrouping.advance(); + } + sString.Insert('0',0); + } + if (bThousand && nAnzLeading < nDigitsInFirstGroup + 1) + { + for (i = nAnzLeading; i < nDigitsInFirstGroup + 1; i++) + { + if (bThousand && i % nDigitsInFirstGroup == 0) + sString.Insert( rThSep, 0 ); + sString.Insert('#',0); + } + } + } + if (nPrecision > 0) + { + sString += GetNumDecimalSep(); + sString.Expand( sString.Len() + nPrecision, '0' ); + } + if (eType == NUMBERFORMAT_PERCENT) + sString += '%'; + else if (eType == NUMBERFORMAT_CURRENCY) + { + String sNegStr = sString; + String aCurr; + const NfCurrencyEntry* pEntry; + BOOL bBank; + if ( GetNewCurrencySymbolString( nIndex, aCurr, &pEntry, &bBank ) ) + { + if ( pEntry ) + { + USHORT nPosiForm = NfCurrencyEntry::GetEffectivePositiveFormat( + xLocaleData->getCurrPositiveFormat(), + pEntry->GetPositiveFormat(), bBank ); + USHORT nNegaForm = NfCurrencyEntry::GetEffectiveNegativeFormat( + xLocaleData->getCurrNegativeFormat(), + pEntry->GetNegativeFormat(), bBank ); + pEntry->CompletePositiveFormatString( sString, bBank, + nPosiForm ); + pEntry->CompleteNegativeFormatString( sNegStr, bBank, + nNegaForm ); + } + else + { // assume currency abbreviation (AKA banking symbol), not symbol + USHORT nPosiForm = NfCurrencyEntry::GetEffectivePositiveFormat( + xLocaleData->getCurrPositiveFormat(), + xLocaleData->getCurrPositiveFormat(), TRUE ); + USHORT nNegaForm = NfCurrencyEntry::GetEffectiveNegativeFormat( + xLocaleData->getCurrNegativeFormat(), + xLocaleData->getCurrNegativeFormat(), TRUE ); + NfCurrencyEntry::CompletePositiveFormatString( sString, aCurr, + nPosiForm ); + NfCurrencyEntry::CompleteNegativeFormatString( sNegStr, aCurr, + nNegaForm ); + } + } + else + { // "automatic" old style + String aSymbol, aAbbrev; + GetCompatibilityCurrency( aSymbol, aAbbrev ); + ImpGetPosCurrFormat( sString, aSymbol ); + ImpGetNegCurrFormat( sNegStr, aSymbol ); + } + if (IsRed) + { + sString += ';'; + sString += '['; + sString += pFormatScanner->GetRedString(); + sString += ']'; + } + else + sString += ';'; + sString += sNegStr; + } + if (IsRed && eType != NUMBERFORMAT_CURRENCY) + { + String sTmpStr = sString; + sTmpStr += ';'; + sTmpStr += '['; + sTmpStr += pFormatScanner->GetRedString(); + sTmpStr += ']'; + sTmpStr += '-'; + sTmpStr +=sString; + sString = sTmpStr; + } +} + +BOOL SvNumberFormatter::IsUserDefined(const String& sStr, + LanguageType eLnge) +{ + if (eLnge == LANGUAGE_DONTKNOW) + eLnge = IniLnge; + sal_uInt32 CLOffset = ImpGenerateCL(eLnge); // ggfs. neu Standard- + // formate anlegen + eLnge = ActLnge; + sal_uInt32 nKey = ImpIsEntry(sStr, CLOffset, eLnge); + if (nKey == NUMBERFORMAT_ENTRY_NOT_FOUND) + return TRUE; + SvNumberformat* pEntry = aFTable.Get(nKey); + if ( pEntry && ((pEntry->GetType() & NUMBERFORMAT_DEFINED) != 0) ) + return TRUE; + return FALSE; +} + +sal_uInt32 SvNumberFormatter::GetEntryKey(const String& sStr, + LanguageType eLnge) +{ + if (eLnge == LANGUAGE_DONTKNOW) + eLnge = IniLnge; + sal_uInt32 CLOffset = ImpGenerateCL(eLnge); // ggfs. neu Standard- + // formate anlegen + return ImpIsEntry(sStr, CLOffset, eLnge); +} + +sal_uInt32 SvNumberFormatter::GetStandardIndex(LanguageType eLnge) +{ + if (eLnge == LANGUAGE_DONTKNOW) + eLnge = IniLnge; + return GetStandardFormat(NUMBERFORMAT_NUMBER, eLnge); +} + +short SvNumberFormatter::GetType(sal_uInt32 nFIndex) +{ + short eType; + SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nFIndex); + if (!pFormat) + eType = NUMBERFORMAT_UNDEFINED; + else + { + eType = pFormat->GetType() &~NUMBERFORMAT_DEFINED; + if (eType == 0) + eType = NUMBERFORMAT_DEFINED; + } + return eType; +} + +void SvNumberFormatter::ClearMergeTable() +{ + if ( pMergeTable ) + { + sal_uInt32* pIndex = (sal_uInt32*) pMergeTable->First(); + while (pIndex) + { + delete pIndex; + pIndex = pMergeTable->Next(); + } + pMergeTable->Clear(); + } +} + +SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter& rTable) +{ + if ( pMergeTable ) + ClearMergeTable(); + else + pMergeTable = new SvNumberFormatterIndexTable; + sal_uInt32 nCLOffset = 0; + sal_uInt32 nOldKey, nOffset, nNewKey; + sal_uInt32* pNewIndex; + SvNumberformat* pNewEntry; + SvNumberformat* pFormat = rTable.aFTable.First(); + while (pFormat) + { + nOldKey = rTable.aFTable.GetCurKey(); + nOffset = nOldKey % SV_COUNTRY_LANGUAGE_OFFSET; // relativIndex + if (nOffset == 0) // 1. Format von CL + nCLOffset = ImpGenerateCL(pFormat->GetLanguage()); + + if (nOffset <= SV_MAX_ANZ_STANDARD_FORMATE) // Std.form. + { + nNewKey = nCLOffset + nOffset; + if (!aFTable.Get(nNewKey)) // noch nicht da + { +// pNewEntry = new SvNumberformat(*pFormat); // Copy reicht nicht !!! + pNewEntry = new SvNumberformat( *pFormat, *pFormatScanner ); + if (!aFTable.Insert(nNewKey, pNewEntry)) + delete pNewEntry; + } + if (nNewKey != nOldKey) // neuer Index + { + pNewIndex = new sal_uInt32(nNewKey); + if (!pMergeTable->Insert(nOldKey,pNewIndex)) + delete pNewIndex; + } + } + else // benutzerdef. + { +// pNewEntry = new SvNumberformat(*pFormat); // Copy reicht nicht !!! + pNewEntry = new SvNumberformat( *pFormat, *pFormatScanner ); + nNewKey = ImpIsEntry(pNewEntry->GetFormatstring(), + nCLOffset, + pFormat->GetLanguage()); + if (nNewKey != NUMBERFORMAT_ENTRY_NOT_FOUND) // schon vorhanden + delete pNewEntry; + else + { + SvNumberformat* pStdFormat = + (SvNumberformat*) aFTable.Get(nCLOffset + ZF_STANDARD); + sal_uInt32 nPos = nCLOffset + pStdFormat->GetLastInsertKey(); + nNewKey = nPos+1; + if (nPos - nCLOffset >= SV_COUNTRY_LANGUAGE_OFFSET) + { + Sound::Beep(); + DBG_ERROR( + "SvNumberFormatter:: Zu viele Formate pro CL"); + delete pNewEntry; + } + else if (!aFTable.Insert(nNewKey, pNewEntry)) + delete pNewEntry; + else + pStdFormat->SetLastInsertKey((USHORT) (nNewKey - nCLOffset)); + } + if (nNewKey != nOldKey) // neuer Index + { + pNewIndex = new sal_uInt32(nNewKey); + if (!pMergeTable->Insert(nOldKey,pNewIndex)) + delete pNewIndex; + } + } + pFormat = rTable.aFTable.Next(); + } + return pMergeTable; +} + + +SvNumberFormatterMergeMap SvNumberFormatter::ConvertMergeTableToMap() +{ + if (!HasMergeFmtTbl()) + return SvNumberFormatterMergeMap(); + + SvNumberFormatterMergeMap aMap; + for (sal_uInt32* pIndex = pMergeTable->First(); pIndex; pIndex = pMergeTable->Next()) + { + sal_uInt32 nOldKey = pMergeTable->GetCurKey(); + aMap.insert( SvNumberFormatterMergeMap::value_type( nOldKey, *pIndex)); + } + ClearMergeTable(); + return aMap; +} + + +sal_uInt32 SvNumberFormatter::GetFormatForLanguageIfBuiltIn( sal_uInt32 nFormat, + LanguageType eLnge ) +{ + if ( eLnge == LANGUAGE_DONTKNOW ) + eLnge = IniLnge; + if ( nFormat < SV_COUNTRY_LANGUAGE_OFFSET && eLnge == IniLnge ) + return nFormat; // es bleibt wie es ist + sal_uInt32 nOffset = nFormat % SV_COUNTRY_LANGUAGE_OFFSET; // relativIndex + if ( nOffset > SV_MAX_ANZ_STANDARD_FORMATE ) + return nFormat; // kein eingebautes Format + sal_uInt32 nCLOffset = ImpGenerateCL(eLnge); // ggbf. generieren + return nCLOffset + nOffset; +} + + +sal_uInt32 SvNumberFormatter::GetFormatIndex( NfIndexTableOffset nTabOff, + LanguageType eLnge ) +{ + if ( nTabOff >= NF_INDEX_TABLE_ENTRIES + || theIndexTable[nTabOff] == NUMBERFORMAT_ENTRY_NOT_FOUND ) + return NUMBERFORMAT_ENTRY_NOT_FOUND; + if ( eLnge == LANGUAGE_DONTKNOW ) + eLnge = IniLnge; + sal_uInt32 nCLOffset = ImpGenerateCL(eLnge); // ggbf. generieren + return nCLOffset + theIndexTable[nTabOff]; +} + + +NfIndexTableOffset SvNumberFormatter::GetIndexTableOffset( sal_uInt32 nFormat ) const +{ + sal_uInt32 nOffset = nFormat % SV_COUNTRY_LANGUAGE_OFFSET; // relativIndex + if ( nOffset > SV_MAX_ANZ_STANDARD_FORMATE ) + return NF_INDEX_TABLE_ENTRIES; // kein eingebautes Format + for ( USHORT j = 0; j < NF_INDEX_TABLE_ENTRIES; j++ ) + { + if ( theIndexTable[j] == nOffset ) + return (NfIndexTableOffset) j; + } + return NF_INDEX_TABLE_ENTRIES; // bad luck +} + + +void SvNumberFormatter::SetYear2000( USHORT nVal ) +{ + pStringScanner->SetYear2000( nVal ); +} + + +USHORT SvNumberFormatter::GetYear2000() const +{ + return pStringScanner->GetYear2000(); +} + + +USHORT SvNumberFormatter::ExpandTwoDigitYear( USHORT nYear ) const +{ + if ( nYear < 100 ) + return SvNumberFormatter::ExpandTwoDigitYear( nYear, + pStringScanner->GetYear2000() ); + return nYear; +} + + +// static +USHORT SvNumberFormatter::GetYear2000Default() +{ + return Application::GetSettings().GetMiscSettings().GetTwoDigitYearStart(); +} + + +// static +const NfCurrencyTable& SvNumberFormatter::GetTheCurrencyTable() +{ + ::osl::MutexGuard aGuard( GetMutex() ); + while ( !bCurrencyTableInitialized ) + ImpInitCurrencyTable(); + return theCurrencyTable::get(); +} + + +// static +const NfCurrencyEntry* SvNumberFormatter::MatchSystemCurrency() +{ + // MUST call GetTheCurrencyTable() before accessing nSystemCurrencyPosition + const NfCurrencyTable& rTable = GetTheCurrencyTable(); + return nSystemCurrencyPosition ? rTable[nSystemCurrencyPosition] : NULL; +} + + +// static +const NfCurrencyEntry& SvNumberFormatter::GetCurrencyEntry( LanguageType eLang ) +{ + if ( eLang == LANGUAGE_SYSTEM ) + { + const NfCurrencyEntry* pCurr = MatchSystemCurrency(); + return pCurr ? *pCurr : *(GetTheCurrencyTable()[0]); + } + else + { + eLang = MsLangId::getRealLanguage( eLang ); + const NfCurrencyTable& rTable = GetTheCurrencyTable(); + USHORT nCount = rTable.Count(); + const NfCurrencyEntryPtr* ppData = rTable.GetData(); + for ( USHORT j = 0; j < nCount; j++, ppData++ ) + { + if ( (*ppData)->GetLanguage() == eLang ) + return **ppData; + } + return *(rTable[0]); + } +} + + +// static +const NfCurrencyEntry* SvNumberFormatter::GetCurrencyEntry( + const String& rAbbrev, LanguageType eLang ) +{ + eLang = MsLangId::getRealLanguage( eLang ); + const NfCurrencyTable& rTable = GetTheCurrencyTable(); + USHORT nCount = rTable.Count(); + const NfCurrencyEntryPtr* ppData = rTable.GetData(); + for ( USHORT j = 0; j < nCount; j++, ppData++ ) + { + if ( (*ppData)->GetLanguage() == eLang && + (*ppData)->GetBankSymbol() == rAbbrev ) + return *ppData; + } + return NULL; +} + + +// static +const NfCurrencyEntry* SvNumberFormatter::GetLegacyOnlyCurrencyEntry( + const String& rSymbol, const String& rAbbrev ) +{ + if (!bCurrencyTableInitialized) + GetTheCurrencyTable(); // just for initialization + const NfCurrencyTable& rTable = theLegacyOnlyCurrencyTable::get(); + USHORT nCount = rTable.Count(); + const NfCurrencyEntryPtr* ppData = rTable.GetData(); + for ( USHORT j = 0; j < nCount; j++, ppData++ ) + { + if ( (*ppData)->GetSymbol() == rSymbol && + (*ppData)->GetBankSymbol() == rAbbrev ) + return *ppData; + } + return NULL; +} + + +// static +IMPL_STATIC_LINK_NOINSTANCE( SvNumberFormatter, CurrencyChangeLink, void*, EMPTYARG ) +{ + ::osl::MutexGuard aGuard( GetMutex() ); + String aAbbrev; + LanguageType eLang = LANGUAGE_SYSTEM; + SvtSysLocaleOptions().GetCurrencyAbbrevAndLanguage( aAbbrev, eLang ); + SetDefaultSystemCurrency( aAbbrev, eLang ); + return 0; +} + + +// static +void SvNumberFormatter::SetDefaultSystemCurrency( const String& rAbbrev, LanguageType eLang ) +{ + ::osl::MutexGuard aGuard( GetMutex() ); + if ( eLang == LANGUAGE_SYSTEM ) + eLang = Application::GetSettings().GetLanguage(); + const NfCurrencyTable& rTable = GetTheCurrencyTable(); + USHORT nCount = rTable.Count(); + const NfCurrencyEntryPtr* ppData = rTable.GetData(); + if ( rAbbrev.Len() ) + { + for ( USHORT j = 0; j < nCount; j++, ppData++ ) + { + if ( (*ppData)->GetLanguage() == eLang && (*ppData)->GetBankSymbol() == rAbbrev ) + { + nSystemCurrencyPosition = j; + return ; + } + } + } + else + { + for ( USHORT j = 0; j < nCount; j++, ppData++ ) + { + if ( (*ppData)->GetLanguage() == eLang ) + { + nSystemCurrencyPosition = j; + return ; + } + } + } + nSystemCurrencyPosition = 0; // not found => simple SYSTEM +} + + +void SvNumberFormatter::ResetDefaultSystemCurrency() +{ + nDefaultSystemCurrencyFormat = NUMBERFORMAT_ENTRY_NOT_FOUND; +} + + +sal_uInt32 SvNumberFormatter::ImpGetDefaultSystemCurrencyFormat() +{ + if ( nDefaultSystemCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND ) + { + xub_StrLen nCheck; + short nType; + NfWSStringsDtor aCurrList; + USHORT nDefault = GetCurrencyFormatStrings( aCurrList, + GetCurrencyEntry( LANGUAGE_SYSTEM ), FALSE ); + DBG_ASSERT( aCurrList.Count(), "where is the NewCurrency System standard format?!?" ); + // if already loaded or user defined nDefaultSystemCurrencyFormat + // will be set to the right value + PutEntry( *aCurrList.GetObject( nDefault ), nCheck, nType, + nDefaultSystemCurrencyFormat, LANGUAGE_SYSTEM ); + DBG_ASSERT( nCheck == 0, "NewCurrency CheckError" ); + DBG_ASSERT( nDefaultSystemCurrencyFormat != NUMBERFORMAT_ENTRY_NOT_FOUND, + "nDefaultSystemCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND" ); + } + return nDefaultSystemCurrencyFormat; +} + + +sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat() +{ + sal_uInt32 CLOffset = ImpGetCLOffset( ActLnge ); + sal_uInt32 nDefaultCurrencyFormat = + (sal_uInt32)(sal_uIntPtr) aDefaultFormatKeys.Get( CLOffset + ZF_STANDARD_CURRENCY ); + if ( !nDefaultCurrencyFormat ) + nDefaultCurrencyFormat = NUMBERFORMAT_ENTRY_NOT_FOUND; + if ( nDefaultCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND ) + { + // look for a defined standard + sal_uInt32 nStopKey = CLOffset + SV_COUNTRY_LANGUAGE_OFFSET; + sal_uInt32 nKey; + aFTable.Seek( CLOffset ); + while ( (nKey = aFTable.GetCurKey()) >= CLOffset && nKey < nStopKey ) + { + const SvNumberformat* pEntry = + (const SvNumberformat*) aFTable.GetCurObject(); + if ( pEntry->IsStandard() && (pEntry->GetType() & NUMBERFORMAT_CURRENCY) ) + { + nDefaultCurrencyFormat = nKey; + break; // while + } + aFTable.Next(); + } + + if ( nDefaultCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND ) + { // none found, create one + xub_StrLen nCheck; + short nType; + NfWSStringsDtor aCurrList; + USHORT nDefault = GetCurrencyFormatStrings( aCurrList, + GetCurrencyEntry( ActLnge ), FALSE ); + DBG_ASSERT( aCurrList.Count(), "where is the NewCurrency standard format?" ); + if ( aCurrList.Count() ) + { + // if already loaded or user defined nDefaultSystemCurrencyFormat + // will be set to the right value + PutEntry( *aCurrList.GetObject( nDefault ), nCheck, nType, + nDefaultCurrencyFormat, ActLnge ); + DBG_ASSERT( nCheck == 0, "NewCurrency CheckError" ); + DBG_ASSERT( nDefaultCurrencyFormat != NUMBERFORMAT_ENTRY_NOT_FOUND, + "nDefaultCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND" ); + } + // old automatic currency format as a last resort + if ( nDefaultCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND ) + nDefaultCurrencyFormat = CLOffset + ZF_STANDARD_CURRENCY+3; + else + { // mark as standard so that it is found next time + SvNumberformat* pEntry = aFTable.Get( nDefaultCurrencyFormat ); + if ( pEntry ) + pEntry->SetStandard(); + } + } + aDefaultFormatKeys.Insert( CLOffset + ZF_STANDARD_CURRENCY, + (void*) nDefaultCurrencyFormat ); + } + return nDefaultCurrencyFormat; +} + + +// static +// try to make it inline if possible since this a loop body +// TRUE: continue; FALSE: break loop, if pFoundEntry==NULL dupe found +#ifndef DBG_UTIL +inline +#endif + BOOL SvNumberFormatter::ImpLookupCurrencyEntryLoopBody( + const NfCurrencyEntry*& pFoundEntry, BOOL& bFoundBank, + const NfCurrencyEntry* pData, USHORT nPos, const String& rSymbol ) +{ + BOOL bFound; + if ( pData->GetSymbol() == rSymbol ) + { + bFound = TRUE; + bFoundBank = FALSE; + } + else if ( pData->GetBankSymbol() == rSymbol ) + { + bFound = TRUE; + bFoundBank = TRUE; + } + else + bFound = FALSE; + if ( bFound ) + { + if ( pFoundEntry && pFoundEntry != pData ) + { + pFoundEntry = NULL; + return FALSE; // break loop, not unique + } + if ( nPos == 0 ) + { // first entry is SYSTEM + pFoundEntry = MatchSystemCurrency(); + if ( pFoundEntry ) + return FALSE; // break loop + // even if there are more matching entries + // this one is propably the one we are looking for + else + pFoundEntry = pData; + } + else + pFoundEntry = pData; + } + return TRUE; +} + + +BOOL SvNumberFormatter::GetNewCurrencySymbolString( sal_uInt32 nFormat, + String& rStr, const NfCurrencyEntry** ppEntry /* = NULL */, + BOOL* pBank /* = NULL */ ) const +{ + rStr.Erase(); + if ( ppEntry ) + *ppEntry = NULL; + if ( pBank ) + *pBank = FALSE; + SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get( nFormat ); + if ( pFormat ) + { + String aSymbol, aExtension; + if ( pFormat->GetNewCurrencySymbol( aSymbol, aExtension ) ) + { + if ( ppEntry ) + { + BOOL bFoundBank = FALSE; + // we definiteley need an entry matching the format code string + const NfCurrencyEntry* pFoundEntry = GetCurrencyEntry( + bFoundBank, aSymbol, aExtension, pFormat->GetLanguage(), + TRUE ); + if ( pFoundEntry ) + { + *ppEntry = pFoundEntry; + if ( pBank ) + *pBank = bFoundBank; + pFoundEntry->BuildSymbolString( rStr, bFoundBank ); + } + } + if ( !rStr.Len() ) + { // analog zu BuildSymbolString + rStr = '['; + rStr += '$'; + if ( aSymbol.Search( '-' ) != STRING_NOTFOUND || + aSymbol.Search( ']' ) != STRING_NOTFOUND ) + { + rStr += '"'; + rStr += aSymbol; + rStr += '"'; + } + else + rStr += aSymbol; + if ( aExtension.Len() ) + rStr += aExtension; + rStr += ']'; + } + return TRUE; + } + } + return FALSE; +} + + +// static +const NfCurrencyEntry* SvNumberFormatter::GetCurrencyEntry( BOOL & bFoundBank, + const String& rSymbol, const String& rExtension, + LanguageType eFormatLanguage, BOOL bOnlyStringLanguage ) +{ + xub_StrLen nExtLen = rExtension.Len(); + LanguageType eExtLang; + if ( nExtLen ) + { + sal_Int32 nExtLang = ::rtl::OUString( rExtension ).toInt32( 16 ); + if ( !nExtLang ) + eExtLang = LANGUAGE_DONTKNOW; + else + eExtLang = (LanguageType) ((nExtLang < 0) ? + -nExtLang : nExtLang); + } + else + eExtLang = LANGUAGE_DONTKNOW; + const NfCurrencyEntry* pFoundEntry = NULL; + const NfCurrencyTable& rTable = GetTheCurrencyTable(); + USHORT nCount = rTable.Count(); + BOOL bCont = TRUE; + + // first try with given extension language/country + if ( nExtLen ) + { + const NfCurrencyEntryPtr* ppData = rTable.GetData(); + for ( USHORT j = 0; j < nCount && bCont; j++, ppData++ ) + { + LanguageType eLang = (*ppData)->GetLanguage(); + if ( eLang == eExtLang || + ((eExtLang == LANGUAGE_DONTKNOW) && + (eLang == LANGUAGE_SYSTEM)) + ) + { + bCont = ImpLookupCurrencyEntryLoopBody( pFoundEntry, bFoundBank, + *ppData, j, rSymbol ); + } + } + } + + // ok? + if ( pFoundEntry || !bCont || (bOnlyStringLanguage && nExtLen) ) + return pFoundEntry; + + if ( !bOnlyStringLanguage ) + { + // now try the language/country of the number format + const NfCurrencyEntryPtr* ppData = rTable.GetData(); + for ( USHORT j = 0; j < nCount && bCont; j++, ppData++ ) + { + LanguageType eLang = (*ppData)->GetLanguage(); + if ( eLang == eFormatLanguage || + ((eFormatLanguage == LANGUAGE_DONTKNOW) && + (eLang == LANGUAGE_SYSTEM)) + ) + { + bCont = ImpLookupCurrencyEntryLoopBody( pFoundEntry, bFoundBank, + *ppData, j, rSymbol ); + } + } + + // ok? + if ( pFoundEntry || !bCont ) + return pFoundEntry; + } + + // then try without language/country if no extension specified + if ( !nExtLen ) + { + const NfCurrencyEntryPtr* ppData = rTable.GetData(); + for ( USHORT j = 0; j < nCount && bCont; j++, ppData++ ) + { + bCont = ImpLookupCurrencyEntryLoopBody( pFoundEntry, bFoundBank, + *ppData, j, rSymbol ); + } + } + + return pFoundEntry; +} + + +void SvNumberFormatter::GetCompatibilityCurrency( String& rSymbol, String& rAbbrev ) const +{ + ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Currency2 > + xCurrencies = xLocaleData->getAllCurrencies(); + sal_Int32 nCurrencies = xCurrencies.getLength(); + sal_Int32 j; + for ( j=0; j < nCurrencies; ++j ) + { + if ( xCurrencies[j].UsedInCompatibleFormatCodes ) + { + rSymbol = xCurrencies[j].Symbol; + rAbbrev = xCurrencies[j].BankSymbol; + break; + } + } + if ( j >= nCurrencies ) + { + if (LocaleDataWrapper::areChecksEnabled()) + { + String aMsg( RTL_CONSTASCII_USTRINGPARAM( + "GetCompatibilityCurrency: none?")); + LocaleDataWrapper::outputCheckMessage( + xLocaleData->appendLocaleInfo( aMsg)); + } + rSymbol = xLocaleData->getCurrSymbol(); + rAbbrev = xLocaleData->getCurrBankSymbol(); + } +} + + +void lcl_CheckCurrencySymbolPosition( const NfCurrencyEntry& rCurr ) +{ + short nPos = -1; // -1:=unknown, 0:=vorne, 1:=hinten + short nNeg = -1; + switch ( rCurr.GetPositiveFormat() ) + { + case 0: // $1 + nPos = 0; + break; + case 1: // 1$ + nPos = 1; + break; + case 2: // $ 1 + nPos = 0; + break; + case 3: // 1 $ + nPos = 1; + break; + default: + LocaleDataWrapper::outputCheckMessage( + "lcl_CheckCurrencySymbolPosition: unknown PositiveFormat"); + break; + } + switch ( rCurr.GetNegativeFormat() ) + { + case 0: // ($1) + nNeg = 0; + break; + case 1: // -$1 + nNeg = 0; + break; + case 2: // $-1 + nNeg = 0; + break; + case 3: // $1- + nNeg = 0; + break; + case 4: // (1$) + nNeg = 1; + break; + case 5: // -1$ + nNeg = 1; + break; + case 6: // 1-$ + nNeg = 1; + break; + case 7: // 1$- + nNeg = 1; + break; + case 8: // -1 $ + nNeg = 1; + break; + case 9: // -$ 1 + nNeg = 0; + break; + case 10: // 1 $- + nNeg = 1; + break; + case 11: // $ -1 + nNeg = 0; + break; + case 12 : // $ 1- + nNeg = 0; + break; + case 13 : // 1- $ + nNeg = 1; + break; + case 14 : // ($ 1) + nNeg = 0; + break; + case 15 : // (1 $) + nNeg = 1; + break; + default: + LocaleDataWrapper::outputCheckMessage( + "lcl_CheckCurrencySymbolPosition: unknown NegativeFormat"); + break; + } + if ( nPos >= 0 && nNeg >= 0 && nPos != nNeg ) + { + ByteString aStr( "positions of currency symbols differ\nLanguage: " ); + aStr += ByteString::CreateFromInt32( rCurr.GetLanguage() ); + aStr += " <"; + aStr += ByteString( rCurr.GetSymbol(), RTL_TEXTENCODING_UTF8 ); + aStr += "> positive: "; + aStr += ByteString::CreateFromInt32( rCurr.GetPositiveFormat() ); + aStr += ( nPos ? " (postfix)" : " (prefix)" ); + aStr += ", negative: "; + aStr += ByteString::CreateFromInt32( rCurr.GetNegativeFormat() ); + aStr += ( nNeg ? " (postfix)" : " (prefix)" ); +#if 0 +// seems that there really are some currencies which differ, e.g. YugoDinar + DBG_ERRORFILE( aStr.GetBuffer() ); +#endif + } +} + + +// static +void SvNumberFormatter::ImpInitCurrencyTable() +{ + // racing condition possible: + // ::osl::MutexGuard aGuard( GetMutex() ); + // while ( !bCurrencyTableInitialized ) + // ImpInitCurrencyTable(); + static BOOL bInitializing = FALSE; + if ( bCurrencyTableInitialized || bInitializing ) + return ; + bInitializing = TRUE; + + RTL_LOGFILE_CONTEXT_AUTHOR( aTimeLog, "svtools", "er93726", "SvNumberFormatter::ImpInitCurrencyTable" ); + + LanguageType eSysLang = Application::GetSettings().GetLanguage(); + LocaleDataWrapper* pLocaleData = new LocaleDataWrapper( + ::comphelper::getProcessServiceFactory(), + MsLangId::convertLanguageToLocale( eSysLang ) ); + // get user configured currency + String aConfiguredCurrencyAbbrev; + LanguageType eConfiguredCurrencyLanguage = LANGUAGE_SYSTEM; + SvtSysLocaleOptions().GetCurrencyAbbrevAndLanguage( + aConfiguredCurrencyAbbrev, eConfiguredCurrencyLanguage ); + USHORT nSecondarySystemCurrencyPosition = 0; + USHORT nMatchingSystemCurrencyPosition = 0; + NfCurrencyEntryPtr pEntry; + + // first entry is SYSTEM + pEntry = new NfCurrencyEntry( *pLocaleData, LANGUAGE_SYSTEM ); + theCurrencyTable::get().Insert( pEntry, 0 ); + USHORT nCurrencyPos = 1; + + ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > xLoc = + LocaleDataWrapper::getInstalledLocaleNames(); + sal_Int32 nLocaleCount = xLoc.getLength(); + RTL_LOGFILE_CONTEXT_TRACE1( aTimeLog, "number of locales: %ld", nLocaleCount ); + Locale const * const pLocales = xLoc.getConstArray(); + NfCurrencyTable &rCurrencyTable = theCurrencyTable::get(); + NfCurrencyTable &rLegacyOnlyCurrencyTable = theLegacyOnlyCurrencyTable::get(); + USHORT nLegacyOnlyCurrencyPos = 0; + for ( sal_Int32 nLocale = 0; nLocale < nLocaleCount; nLocale++ ) + { + LanguageType eLang = MsLangId::convertLocaleToLanguage( + pLocales[nLocale]); +#if OSL_DEBUG_LEVEL > 1 + LanguageType eReal = MsLangId::getRealLanguage( eLang ); + if ( eReal != eLang ) { + BOOL bBreak; + bBreak = TRUE; + } +#endif + pLocaleData->setLocale( pLocales[nLocale] ); + Sequence< Currency2 > aCurrSeq = pLocaleData->getAllCurrencies(); + sal_Int32 nCurrencyCount = aCurrSeq.getLength(); + Currency2 const * const pCurrencies = aCurrSeq.getConstArray(); + + // one default currency for each locale, insert first so it is found first + sal_Int32 nDefault; + for ( nDefault = 0; nDefault < nCurrencyCount; nDefault++ ) + { + if ( pCurrencies[nDefault].Default ) + break; + } + if ( nDefault < nCurrencyCount ) + pEntry = new NfCurrencyEntry( pCurrencies[nDefault], *pLocaleData, eLang ); + else + pEntry = new NfCurrencyEntry( *pLocaleData, eLang ); // first or ShellsAndPebbles + + if (LocaleDataWrapper::areChecksEnabled()) + lcl_CheckCurrencySymbolPosition( *pEntry ); + + rCurrencyTable.Insert( pEntry, nCurrencyPos++ ); + if ( !nSystemCurrencyPosition && (aConfiguredCurrencyAbbrev.Len() ? + pEntry->GetBankSymbol() == aConfiguredCurrencyAbbrev && + pEntry->GetLanguage() == eConfiguredCurrencyLanguage : FALSE) ) + nSystemCurrencyPosition = nCurrencyPos-1; + if ( !nMatchingSystemCurrencyPosition && + pEntry->GetLanguage() == eSysLang ) + nMatchingSystemCurrencyPosition = nCurrencyPos-1; + + // all remaining currencies for each locale + if ( nCurrencyCount > 1 ) + { + sal_Int32 nCurrency; + for ( nCurrency = 0; nCurrency < nCurrencyCount; nCurrency++ ) + { + if (pCurrencies[nCurrency].LegacyOnly) + { + pEntry = new NfCurrencyEntry( pCurrencies[nCurrency], *pLocaleData, eLang ); + rLegacyOnlyCurrencyTable.Insert( pEntry, nLegacyOnlyCurrencyPos++ ); + } + else if ( nCurrency != nDefault ) + { + pEntry = new NfCurrencyEntry( pCurrencies[nCurrency], *pLocaleData, eLang ); + // no dupes + BOOL bInsert = TRUE; + NfCurrencyEntry const * const * pData = rCurrencyTable.GetData(); + USHORT n = rCurrencyTable.Count(); + pData++; // skip first SYSTEM entry + for ( USHORT j=1; jGetBankSymbol() == aConfiguredCurrencyAbbrev : + pEntry->GetLanguage() == eConfiguredCurrencyLanguage) ) + nSecondarySystemCurrencyPosition = nCurrencyPos-1; + if ( !nMatchingSystemCurrencyPosition && + pEntry->GetLanguage() == eSysLang ) + nMatchingSystemCurrencyPosition = nCurrencyPos-1; + } + } + } + } + } + if ( !nSystemCurrencyPosition ) + nSystemCurrencyPosition = nSecondarySystemCurrencyPosition; + if ((aConfiguredCurrencyAbbrev.Len() && !nSystemCurrencyPosition) && + LocaleDataWrapper::areChecksEnabled()) + LocaleDataWrapper::outputCheckMessage( + "SvNumberFormatter::ImpInitCurrencyTable: configured currency not in I18N locale data."); + // match SYSTEM if no configured currency found + if ( !nSystemCurrencyPosition ) + nSystemCurrencyPosition = nMatchingSystemCurrencyPosition; + if ((!aConfiguredCurrencyAbbrev.Len() && !nSystemCurrencyPosition) && + LocaleDataWrapper::areChecksEnabled()) + LocaleDataWrapper::outputCheckMessage( + "SvNumberFormatter::ImpInitCurrencyTable: system currency not in I18N locale data."); + delete pLocaleData; + SvtSysLocaleOptions::SetCurrencyChangeLink( + STATIC_LINK( NULL, SvNumberFormatter, CurrencyChangeLink ) ); + bInitializing = FALSE; + bCurrencyTableInitialized = TRUE; +} + + +USHORT SvNumberFormatter::GetCurrencyFormatStrings( NfWSStringsDtor& rStrArr, + const NfCurrencyEntry& rCurr, BOOL bBank ) const +{ + USHORT nDefault = 0; + if ( bBank ) + { // nur Bankensymbole + String aPositiveBank, aNegativeBank; + rCurr.BuildPositiveFormatString( aPositiveBank, TRUE, *xLocaleData, 1 ); + rCurr.BuildNegativeFormatString( aNegativeBank, TRUE, *xLocaleData, 1 ); + + WSStringPtr pFormat1 = new String( aPositiveBank ); + *pFormat1 += ';'; + WSStringPtr pFormat2 = new String( *pFormat1 ); + + String aRed( '[' ); + aRed += pFormatScanner->GetRedString(); + aRed += ']'; + + *pFormat2 += aRed; + + *pFormat1 += aNegativeBank; + *pFormat2 += aNegativeBank; + + rStrArr.Insert( pFormat1, rStrArr.Count() ); + rStrArr.Insert( pFormat2, rStrArr.Count() ); + nDefault = rStrArr.Count() - 1; + } + else + { // gemischte Formate wie in SvNumberFormatter::ImpGenerateFormats + // aber keine doppelten, wenn keine Nachkommastellen in Waehrung + String aPositive, aNegative, aPositiveNoDec, aNegativeNoDec, + aPositiveDashed, aNegativeDashed; + WSStringPtr pFormat1, pFormat2, pFormat3, pFormat4, pFormat5; + + String aRed( '[' ); + aRed += pFormatScanner->GetRedString(); + aRed += ']'; + + rCurr.BuildPositiveFormatString( aPositive, FALSE, *xLocaleData, 1 ); + rCurr.BuildNegativeFormatString( aNegative, FALSE, *xLocaleData, 1 ); + if ( rCurr.GetDigits() ) + { + rCurr.BuildPositiveFormatString( aPositiveNoDec, FALSE, *xLocaleData, 0 ); + rCurr.BuildNegativeFormatString( aNegativeNoDec, FALSE, *xLocaleData, 0 ); + rCurr.BuildPositiveFormatString( aPositiveDashed, FALSE, *xLocaleData, 2 ); + rCurr.BuildNegativeFormatString( aNegativeDashed, FALSE, *xLocaleData, 2 ); + + pFormat1 = new String( aPositiveNoDec ); + *pFormat1 += ';'; + pFormat3 = new String( *pFormat1 ); + pFormat5 = new String( aPositiveDashed ); + *pFormat5 += ';'; + + *pFormat1 += aNegativeNoDec; + + *pFormat3 += aRed; + *pFormat5 += aRed; + + *pFormat3 += aNegativeNoDec; + *pFormat5 += aNegativeDashed; + } + else + { + pFormat1 = NULL; + pFormat3 = NULL; + pFormat5 = NULL; + } + + pFormat2 = new String( aPositive ); + *pFormat2 += ';'; + pFormat4 = new String( *pFormat2 ); + + *pFormat2 += aNegative; + + *pFormat4 += aRed; + *pFormat4 += aNegative; + + if ( pFormat1 ) + rStrArr.Insert( pFormat1, rStrArr.Count() ); + rStrArr.Insert( pFormat2, rStrArr.Count() ); + if ( pFormat3 ) + rStrArr.Insert( pFormat3, rStrArr.Count() ); + rStrArr.Insert( pFormat4, rStrArr.Count() ); + nDefault = rStrArr.Count() - 1; + if ( pFormat5 ) + rStrArr.Insert( pFormat5, rStrArr.Count() ); + } + return nDefault; +} + + +//--- NfCurrencyEntry ---------------------------------------------------- + +NfCurrencyEntry::NfCurrencyEntry() + : eLanguage( LANGUAGE_DONTKNOW ), + nPositiveFormat(3), + nNegativeFormat(8), + nDigits(2), + cZeroChar('0') +{ +} + + +NfCurrencyEntry::NfCurrencyEntry( const LocaleDataWrapper& rLocaleData, LanguageType eLang ) +{ + aSymbol = rLocaleData.getCurrSymbol(); + aBankSymbol = rLocaleData.getCurrBankSymbol(); + eLanguage = eLang; + nPositiveFormat = rLocaleData.getCurrPositiveFormat(); + nNegativeFormat = rLocaleData.getCurrNegativeFormat(); + nDigits = rLocaleData.getCurrDigits(); + cZeroChar = rLocaleData.getCurrZeroChar(); +} + + +NfCurrencyEntry::NfCurrencyEntry( const ::com::sun::star::i18n::Currency & rCurr, + const LocaleDataWrapper& rLocaleData, LanguageType eLang ) +{ + aSymbol = rCurr.Symbol; + aBankSymbol = rCurr.BankSymbol; + eLanguage = eLang; + nPositiveFormat = rLocaleData.getCurrPositiveFormat(); + nNegativeFormat = rLocaleData.getCurrNegativeFormat(); + nDigits = rCurr.DecimalPlaces; + cZeroChar = rLocaleData.getCurrZeroChar(); +} + + +BOOL NfCurrencyEntry::operator==( const NfCurrencyEntry& r ) const +{ + return aSymbol == r.aSymbol + && aBankSymbol == r.aBankSymbol + && eLanguage == r.eLanguage + ; +} + + +void NfCurrencyEntry::SetEuro() +{ + aSymbol = NfCurrencyEntry::GetEuroSymbol(); + aBankSymbol.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "EUR" ) ); + eLanguage = LANGUAGE_DONTKNOW; + nPositiveFormat = 3; + nNegativeFormat = 8; + nDigits = 2; + cZeroChar = '0'; +} + + +BOOL NfCurrencyEntry::IsEuro() const +{ + if ( aBankSymbol.EqualsAscii( "EUR" ) ) + return TRUE; + String aEuro( NfCurrencyEntry::GetEuroSymbol() ); + return aSymbol == aEuro; +} + + +void NfCurrencyEntry::ApplyVariableInformation( const NfCurrencyEntry& r ) +{ + nPositiveFormat = r.nPositiveFormat; + nNegativeFormat = r.nNegativeFormat; + cZeroChar = r.cZeroChar; +} + + +void NfCurrencyEntry::BuildSymbolString( String& rStr, BOOL bBank, + BOOL bWithoutExtension ) const +{ + rStr = '['; + rStr += '$'; + if ( bBank ) + rStr += aBankSymbol; + else + { + if ( aSymbol.Search( '-' ) != STRING_NOTFOUND || aSymbol.Search( ']' ) != STRING_NOTFOUND ) + { + rStr += '"'; + rStr += aSymbol; + rStr += '"'; + } + else + rStr += aSymbol; + if ( !bWithoutExtension && eLanguage != LANGUAGE_DONTKNOW && eLanguage != LANGUAGE_SYSTEM ) + { + rStr += '-'; + rStr += String::CreateFromInt32( sal_Int32( eLanguage ), 16 ).ToUpperAscii(); + } + } + rStr += ']'; +} + + +void NfCurrencyEntry::Impl_BuildFormatStringNumChars( String& rStr, + const LocaleDataWrapper& rLoc, USHORT nDecimalFormat ) const +{ + rStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "###0" ) ); + rStr.Insert( rLoc.getNumThousandSep(), 1 ); + if ( nDecimalFormat && nDigits ) + { + rStr += rLoc.getNumDecimalSep(); + rStr.Expand( rStr.Len() + nDigits, (nDecimalFormat == 2 ? '-' : cZeroChar) ); + } +} + + +void NfCurrencyEntry::BuildPositiveFormatString( String& rStr, BOOL bBank, + const LocaleDataWrapper& rLoc, USHORT nDecimalFormat ) const +{ + Impl_BuildFormatStringNumChars( rStr, rLoc, nDecimalFormat ); + USHORT nPosiForm = NfCurrencyEntry::GetEffectivePositiveFormat( + rLoc.getCurrPositiveFormat(), nPositiveFormat, bBank ); + CompletePositiveFormatString( rStr, bBank, nPosiForm ); +} + + +void NfCurrencyEntry::BuildNegativeFormatString( String& rStr, BOOL bBank, + const LocaleDataWrapper& rLoc, USHORT nDecimalFormat ) const +{ + Impl_BuildFormatStringNumChars( rStr, rLoc, nDecimalFormat ); + USHORT nNegaForm = NfCurrencyEntry::GetEffectiveNegativeFormat( + rLoc.getCurrNegativeFormat(), nNegativeFormat, bBank ); + CompleteNegativeFormatString( rStr, bBank, nNegaForm ); +} + + +void NfCurrencyEntry::CompletePositiveFormatString( String& rStr, BOOL bBank, + USHORT nPosiForm ) const +{ + String aSymStr; + BuildSymbolString( aSymStr, bBank ); + NfCurrencyEntry::CompletePositiveFormatString( rStr, aSymStr, nPosiForm ); +} + + +void NfCurrencyEntry::CompleteNegativeFormatString( String& rStr, BOOL bBank, + USHORT nNegaForm ) const +{ + String aSymStr; + BuildSymbolString( aSymStr, bBank ); + NfCurrencyEntry::CompleteNegativeFormatString( rStr, aSymStr, nNegaForm ); +} + + +// static +void NfCurrencyEntry::CompletePositiveFormatString( String& rStr, + const String& rSymStr, USHORT nPositiveFormat ) +{ + switch( nPositiveFormat ) + { + case 0: // $1 + rStr.Insert( rSymStr , 0 ); + break; + case 1: // 1$ + rStr += rSymStr; + break; + case 2: // $ 1 + { + rStr.Insert( ' ', 0 ); + rStr.Insert( rSymStr, 0 ); + } + break; + case 3: // 1 $ + { + rStr += ' '; + rStr += rSymStr; + } + break; + default: + DBG_ERROR("NfCurrencyEntry::CompletePositiveFormatString: unknown option"); + break; + } +} + + +// static +void NfCurrencyEntry::CompleteNegativeFormatString( String& rStr, + const String& rSymStr, USHORT nNegativeFormat ) +{ + switch( nNegativeFormat ) + { + case 0: // ($1) + { + rStr.Insert( rSymStr, 0); + rStr.Insert('(',0); + rStr += ')'; + } + break; + case 1: // -$1 + { + rStr.Insert( rSymStr, 0); + rStr.Insert('-',0); + } + break; + case 2: // $-1 + { + rStr.Insert('-',0); + rStr.Insert( rSymStr, 0); + } + break; + case 3: // $1- + { + rStr.Insert( rSymStr, 0); + rStr += '-'; + } + break; + case 4: // (1$) + { + rStr.Insert('(',0); + rStr += rSymStr; + rStr += ')'; + } + break; + case 5: // -1$ + { + rStr += rSymStr; + rStr.Insert('-',0); + } + break; + case 6: // 1-$ + { + rStr += '-'; + rStr += rSymStr; + } + break; + case 7: // 1$- + { + rStr += rSymStr; + rStr += '-'; + } + break; + case 8: // -1 $ + { + rStr += ' '; + rStr += rSymStr; + rStr.Insert('-',0); + } + break; + case 9: // -$ 1 + { + rStr.Insert(' ',0); + rStr.Insert( rSymStr, 0); + rStr.Insert('-',0); + } + break; + case 10: // 1 $- + { + rStr += ' '; + rStr += rSymStr; + rStr += '-'; + } + break; + case 11: // $ -1 + { + String aTmp( rSymStr ); + aTmp += ' '; + aTmp += '-'; + rStr.Insert( aTmp, 0 ); + } + break; + case 12 : // $ 1- + { + rStr.Insert(' ', 0); + rStr.Insert( rSymStr, 0); + rStr += '-'; + } + break; + case 13 : // 1- $ + { + rStr += '-'; + rStr += ' '; + rStr += rSymStr; + } + break; + case 14 : // ($ 1) + { + rStr.Insert(' ',0); + rStr.Insert( rSymStr, 0); + rStr.Insert('(',0); + rStr += ')'; + } + break; + case 15 : // (1 $) + { + rStr.Insert('(',0); + rStr += ' '; + rStr += rSymStr; + rStr += ')'; + } + break; + default: + DBG_ERROR("NfCurrencyEntry::CompleteNegativeFormatString: unknown option"); + break; + } +} + + +// static +USHORT NfCurrencyEntry::GetEffectivePositiveFormat( USHORT +#if ! NF_BANKSYMBOL_FIX_POSITION + nIntlFormat +#endif + , USHORT nCurrFormat, BOOL bBank ) +{ + if ( bBank ) + { +#if NF_BANKSYMBOL_FIX_POSITION + return 3; +#else + switch ( nIntlFormat ) + { + case 0: // $1 + nIntlFormat = 2; // $ 1 + break; + case 1: // 1$ + nIntlFormat = 3; // 1 $ + break; + case 2: // $ 1 + break; + case 3: // 1 $ + break; + default: + DBG_ERROR("NfCurrencyEntry::GetEffectivePositiveFormat: unknown option"); + break; + } + return nIntlFormat; +#endif + } + else + return nCurrFormat; +} + + +// nur aufrufen, wenn nCurrFormat wirklich mit Klammern ist +USHORT lcl_MergeNegativeParenthesisFormat( USHORT nIntlFormat, USHORT nCurrFormat ) +{ + short nSign = 0; // -1:=Klammer 0:=links, 1:=mitte, 2:=rechts + switch ( nIntlFormat ) + { + case 0: // ($1) + case 4: // (1$) + case 14 : // ($ 1) + case 15 : // (1 $) + return nCurrFormat; + case 1: // -$1 + case 5: // -1$ + case 8: // -1 $ + case 9: // -$ 1 + nSign = 0; + break; + case 2: // $-1 + case 6: // 1-$ + case 11 : // $ -1 + case 13 : // 1- $ + nSign = 1; + break; + case 3: // $1- + case 7: // 1$- + case 10: // 1 $- + case 12 : // $ 1- + nSign = 2; + break; + default: + DBG_ERROR("lcl_MergeNegativeParenthesisFormat: unknown option"); + break; + } + + switch ( nCurrFormat ) + { + case 0: // ($1) + switch ( nSign ) + { + case 0: + return 1; // -$1 + case 1: + return 2; // $-1 + case 2: + return 3; // $1- + } + break; + case 4: // (1$) + switch ( nSign ) + { + case 0: + return 5; // -1$ + case 1: + return 6; // 1-$ + case 2: + return 7; // 1$- + } + break; + case 14 : // ($ 1) + switch ( nSign ) + { + case 0: + return 9; // -$ 1 + case 1: + return 11; // $ -1 + case 2: + return 12; // $ 1- + } + break; + case 15 : // (1 $) + switch ( nSign ) + { + case 0: + return 8; // -1 $ + case 1: + return 13; // 1- $ + case 2: + return 10; // 1 $- + } + break; + } + return nCurrFormat; +} + + +// static +USHORT NfCurrencyEntry::GetEffectiveNegativeFormat( USHORT nIntlFormat, + USHORT nCurrFormat, BOOL bBank ) +{ + if ( bBank ) + { +#if NF_BANKSYMBOL_FIX_POSITION + return 8; +#else + switch ( nIntlFormat ) + { + case 0: // ($1) +// nIntlFormat = 14; // ($ 1) + nIntlFormat = 9; // -$ 1 + break; + case 1: // -$1 + nIntlFormat = 9; // -$ 1 + break; + case 2: // $-1 + nIntlFormat = 11; // $ -1 + break; + case 3: // $1- + nIntlFormat = 12; // $ 1- + break; + case 4: // (1$) +// nIntlFormat = 15; // (1 $) + nIntlFormat = 8; // -1 $ + break; + case 5: // -1$ + nIntlFormat = 8; // -1 $ + break; + case 6: // 1-$ + nIntlFormat = 13; // 1- $ + break; + case 7: // 1$- + nIntlFormat = 10; // 1 $- + break; + case 8: // -1 $ + break; + case 9: // -$ 1 + break; + case 10: // 1 $- + break; + case 11: // $ -1 + break; + case 12 : // $ 1- + break; + case 13 : // 1- $ + break; + case 14 : // ($ 1) +// nIntlFormat = 14; // ($ 1) + nIntlFormat = 9; // -$ 1 + break; + case 15 : // (1 $) +// nIntlFormat = 15; // (1 $) + nIntlFormat = 8; // -1 $ + break; + default: + DBG_ERROR("NfCurrencyEntry::GetEffectiveNegativeFormat: unknown option"); + break; + } +#endif + } + else if ( nIntlFormat != nCurrFormat ) + { + switch ( nCurrFormat ) + { + case 0: // ($1) + nIntlFormat = lcl_MergeNegativeParenthesisFormat( + nIntlFormat, nCurrFormat ); + break; + case 1: // -$1 + nIntlFormat = nCurrFormat; + break; + case 2: // $-1 + nIntlFormat = nCurrFormat; + break; + case 3: // $1- + nIntlFormat = nCurrFormat; + break; + case 4: // (1$) + nIntlFormat = lcl_MergeNegativeParenthesisFormat( + nIntlFormat, nCurrFormat ); + break; + case 5: // -1$ + nIntlFormat = nCurrFormat; + break; + case 6: // 1-$ + nIntlFormat = nCurrFormat; + break; + case 7: // 1$- + nIntlFormat = nCurrFormat; + break; + case 8: // -1 $ + nIntlFormat = nCurrFormat; + break; + case 9: // -$ 1 + nIntlFormat = nCurrFormat; + break; + case 10: // 1 $- + nIntlFormat = nCurrFormat; + break; + case 11: // $ -1 + nIntlFormat = nCurrFormat; + break; + case 12 : // $ 1- + nIntlFormat = nCurrFormat; + break; + case 13 : // 1- $ + nIntlFormat = nCurrFormat; + break; + case 14 : // ($ 1) + nIntlFormat = lcl_MergeNegativeParenthesisFormat( + nIntlFormat, nCurrFormat ); + break; + case 15 : // (1 $) + nIntlFormat = lcl_MergeNegativeParenthesisFormat( + nIntlFormat, nCurrFormat ); + break; + default: + DBG_ERROR("NfCurrencyEntry::GetEffectiveNegativeFormat: unknown option"); + break; + } + } + return nIntlFormat; +} + + +// we only support default encodings here +// static +sal_Char NfCurrencyEntry::GetEuroSymbol( rtl_TextEncoding eTextEncoding ) +{ + switch ( eTextEncoding ) + { + case RTL_TEXTENCODING_MS_1252 : // WNT Ansi + case RTL_TEXTENCODING_ISO_8859_1 : // UNX for use with TrueType fonts + return '\x80'; + case RTL_TEXTENCODING_ISO_8859_15 : // UNX real + return '\xA4'; + case RTL_TEXTENCODING_IBM_850 : // OS2 + return '\xD5'; + case RTL_TEXTENCODING_APPLE_ROMAN : // MAC + return '\xDB'; + default: // default system +#if WNT + return '\x80'; +#elif OS2 + return '\xD5'; +#elif UNX +// return '\xA4'; // #56121# 0xA4 waere korrekt fuer iso-8859-15 + return '\x80'; // aber Windoze-Code fuer die konvertierten TrueType-Fonts +#else +#error EuroSymbol is what? + return '\x80'; +#endif + } + return '\x80'; +} + + + diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx new file mode 100644 index 000000000000..0afbf3b4a3f5 --- /dev/null +++ b/svl/source/numbers/zformat.cxx @@ -0,0 +1,4480 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: zformat.cxx,v $ + * $Revision: 1.78.138.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include +#include +#include +// #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define _ZFORMAT_CXX +#include +#include "zforscan.hxx" + +#include "zforfind.hxx" +#include +#include "numhead.hxx" +#include +#include "nfsymbol.hxx" +using namespace svt; + +namespace { +struct Gregorian + : public rtl::StaticWithInit { + const ::rtl::OUString operator () () { + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("gregorian")); + } +}; +} + +const double _D_MAX_U_LONG_ = (double) 0xffffffff; // 4294967295.0 +const double _D_MAX_LONG_ = (double) 0x7fffffff; // 2147483647.0 +const USHORT _MAX_FRACTION_PREC = 3; +const double D_EPS = 1.0E-2; + +const double _D_MAX_D_BY_100 = 1.7E306; +const double _D_MIN_M_BY_1000 = 2.3E-305; + +static BYTE cCharWidths[ 128-32 ] = { + 1,1,1,2,2,3,2,1,1,1,1,2,1,1,1,1, + 2,2,2,2,2,2,2,2,2,2,1,1,2,2,2,2, + 3,2,2,2,2,2,2,3,2,1,2,2,2,3,3,3, + 2,3,2,2,2,2,2,3,2,2,2,1,1,1,2,2, + 1,2,2,2,2,2,1,2,2,1,1,2,1,3,2,2, + 2,2,1,2,1,2,2,2,2,2,2,1,1,1,2,1 +}; + +// static +xub_StrLen SvNumberformat::InsertBlanks( String& r, xub_StrLen nPos, sal_Unicode c ) +{ + if( c >= 32 ) + { + USHORT n = 2; // Default fuer Zeichen > 128 (HACK!) + if( c <= 127 ) + n = cCharWidths[ c - 32 ]; + while( n-- ) + r.Insert( ' ', nPos++ ); + } + return nPos; +} + +static long GetPrecExp( double fAbsVal ) +{ + DBG_ASSERT( fAbsVal > 0.0, "GetPrecExp: fAbsVal <= 0.0" ); + if ( fAbsVal < 1e-7 || fAbsVal > 1e7 ) + { // die Schere, ob's schneller ist oder nicht, liegt zwischen 1e6 und 1e7 + return (long) floor( log10( fAbsVal ) ) + 1; + } + else + { + long nPrecExp = 1; + while( fAbsVal < 1 ) + { + fAbsVal *= 10; + nPrecExp--; + } + while( fAbsVal >= 10 ) + { + fAbsVal /= 10; + nPrecExp++; + } + return nPrecExp; + } +} + +const USHORT nNewCurrencyVersionId = 0x434E; // "NC" +const sal_Unicode cNewCurrencyMagic = 0x01; // Magic for format code in comment +const USHORT nNewStandardFlagVersionId = 0x4653; // "SF" + +/***********************Funktion SvNumberformatInfo******************************/ + +void ImpSvNumberformatInfo::Copy( const ImpSvNumberformatInfo& rNumFor, USHORT nAnz ) +{ + for (USHORT i = 0; i < nAnz; i++) + { + sStrArray[i] = rNumFor.sStrArray[i]; + nTypeArray[i] = rNumFor.nTypeArray[i]; + } + eScannedType = rNumFor.eScannedType; + bThousand = rNumFor.bThousand; + nThousand = rNumFor.nThousand; + nCntPre = rNumFor.nCntPre; + nCntPost = rNumFor.nCntPost; + nCntExp = rNumFor.nCntExp; +} + +void ImpSvNumberformatInfo::Save(SvStream& rStream, USHORT nAnz) const +{ + for (USHORT i = 0; i < nAnz; i++) + { + rStream.WriteByteString( sStrArray[i], rStream.GetStreamCharSet() ); + short nType = nTypeArray[i]; + switch ( nType ) + { // der Krampf fuer Versionen vor SV_NUMBERFORMATTER_VERSION_NEW_CURR + case NF_SYMBOLTYPE_CURRENCY : + rStream << short( NF_SYMBOLTYPE_STRING ); + break; + case NF_SYMBOLTYPE_CURRDEL : + case NF_SYMBOLTYPE_CURREXT : + rStream << short(0); // werden ignoriert (hoffentlich..) + break; + default: + if ( nType > NF_KEY_LASTKEYWORD_SO5 ) + rStream << short( NF_SYMBOLTYPE_STRING ); // all new keywords are string + else + rStream << nType; + } + + } + rStream << eScannedType << bThousand << nThousand + << nCntPre << nCntPost << nCntExp; +} + +void ImpSvNumberformatInfo::Load(SvStream& rStream, USHORT nAnz) +{ + for (USHORT i = 0; i < nAnz; i++) + { + SvNumberformat::LoadString( rStream, sStrArray[i] ); + rStream >> nTypeArray[i]; + } + rStream >> eScannedType >> bThousand >> nThousand + >> nCntPre >> nCntPost >> nCntExp; +} + + +//============================================================================ + +// static +BYTE SvNumberNatNum::MapDBNumToNatNum( BYTE nDBNum, LanguageType eLang, BOOL bDate ) +{ + BYTE nNatNum = 0; + eLang = MsLangId::getRealLanguage( eLang ); // resolve SYSTEM etc. + eLang &= 0x03FF; // 10 bit primary language + if ( bDate ) + { + if ( nDBNum == 4 && eLang == LANGUAGE_KOREAN ) + nNatNum = 9; + else if ( nDBNum <= 3 ) + nNatNum = nDBNum; // known to be good for: zh,ja,ko / 1,2,3 + } + else + { + switch ( nDBNum ) + { + case 1: + switch ( eLang ) + { + case (LANGUAGE_CHINESE & 0x03FF) : nNatNum = 4; break; + case (LANGUAGE_JAPANESE & 0x03FF) : nNatNum = 1; break; + case (LANGUAGE_KOREAN & 0x03FF) : nNatNum = 1; break; + } + break; + case 2: + switch ( eLang ) + { + case (LANGUAGE_CHINESE & 0x03FF) : nNatNum = 5; break; + case (LANGUAGE_JAPANESE & 0x03FF) : nNatNum = 4; break; + case (LANGUAGE_KOREAN & 0x03FF) : nNatNum = 2; break; + } + break; + case 3: + switch ( eLang ) + { + case (LANGUAGE_CHINESE & 0x03FF) : nNatNum = 6; break; + case (LANGUAGE_JAPANESE & 0x03FF) : nNatNum = 5; break; + case (LANGUAGE_KOREAN & 0x03FF) : nNatNum = 3; break; + } + break; + case 4: + switch ( eLang ) + { + case (LANGUAGE_JAPANESE & 0x03FF) : nNatNum = 7; break; + case (LANGUAGE_KOREAN & 0x03FF) : nNatNum = 9; break; + } + break; + } + } + return nNatNum; +} + + +// static +BYTE SvNumberNatNum::MapNatNumToDBNum( BYTE nNatNum, LanguageType eLang, BOOL bDate ) +{ + BYTE nDBNum = 0; + eLang = MsLangId::getRealLanguage( eLang ); // resolve SYSTEM etc. + eLang &= 0x03FF; // 10 bit primary language + if ( bDate ) + { + if ( nNatNum == 9 && eLang == LANGUAGE_KOREAN ) + nDBNum = 4; + else if ( nNatNum <= 3 ) + nDBNum = nNatNum; // known to be good for: zh,ja,ko / 1,2,3 + } + else + { + switch ( nNatNum ) + { + case 1: + switch ( eLang ) + { + case (LANGUAGE_JAPANESE & 0x03FF) : nDBNum = 1; break; + case (LANGUAGE_KOREAN & 0x03FF) : nDBNum = 1; break; + } + break; + case 2: + switch ( eLang ) + { + case (LANGUAGE_KOREAN & 0x03FF) : nDBNum = 2; break; + } + break; + case 3: + switch ( eLang ) + { + case (LANGUAGE_KOREAN & 0x03FF) : nDBNum = 3; break; + } + break; + case 4: + switch ( eLang ) + { + case (LANGUAGE_CHINESE & 0x03FF) : nDBNum = 1; break; + case (LANGUAGE_JAPANESE & 0x03FF) : nDBNum = 2; break; + } + break; + case 5: + switch ( eLang ) + { + case (LANGUAGE_CHINESE & 0x03FF) : nDBNum = 2; break; + case (LANGUAGE_JAPANESE & 0x03FF) : nDBNum = 3; break; + } + break; + case 6: + switch ( eLang ) + { + case (LANGUAGE_CHINESE & 0x03FF) : nDBNum = 3; break; + } + break; + case 7: + switch ( eLang ) + { + case (LANGUAGE_JAPANESE & 0x03FF) : nDBNum = 4; break; + } + break; + case 8: + break; + case 9: + switch ( eLang ) + { + case (LANGUAGE_KOREAN & 0x03FF) : nDBNum = 4; break; + } + break; + case 10: + break; + case 11: + break; + } + } + return nDBNum; +} + +/***********************Funktionen SvNumFor******************************/ + +ImpSvNumFor::ImpSvNumFor() +{ + nAnzStrings = 0; + aI.nTypeArray = NULL; + aI.sStrArray = NULL; + aI.eScannedType = NUMBERFORMAT_UNDEFINED; + aI.bThousand = FALSE; + aI.nThousand = 0; + aI.nCntPre = 0; + aI.nCntPost = 0; + aI.nCntExp = 0; + pColor = NULL; +} + +ImpSvNumFor::~ImpSvNumFor() +{ + for (USHORT i = 0; i < nAnzStrings; i++) + aI.sStrArray[i].Erase(); + delete [] aI.sStrArray; + delete [] aI.nTypeArray; +} + +void ImpSvNumFor::Enlarge(USHORT nAnz) +{ + if ( nAnzStrings != nAnz ) + { + if ( aI.nTypeArray ) + delete [] aI.nTypeArray; + if ( aI.sStrArray ) + delete [] aI.sStrArray; + nAnzStrings = nAnz; + if ( nAnz ) + { + aI.nTypeArray = new short[nAnz]; + aI.sStrArray = new String[nAnz]; + } + else + { + aI.nTypeArray = NULL; + aI.sStrArray = NULL; + } + } +} + +void ImpSvNumFor::Copy( const ImpSvNumFor& rNumFor, ImpSvNumberformatScan* pSc ) +{ + Enlarge( rNumFor.nAnzStrings ); + aI.Copy( rNumFor.aI, nAnzStrings ); + sColorName = rNumFor.sColorName; + if ( pSc ) + pColor = pSc->GetColor( sColorName ); // #121103# don't copy pointer between documents + else + pColor = rNumFor.pColor; + aNatNum = rNumFor.aNatNum; +} + +void ImpSvNumFor::Save(SvStream& rStream) const +{ + rStream << nAnzStrings; + aI.Save(rStream, nAnzStrings); + rStream.WriteByteString( sColorName, rStream.GetStreamCharSet() ); +} + +void ImpSvNumFor::Load(SvStream& rStream, ImpSvNumberformatScan& rSc, + String& rLoadedColorName ) +{ + USHORT nAnz; + rStream >> nAnz; //! noch nicht direkt nAnzStrings wg. Enlarge + Enlarge( nAnz ); + aI.Load( rStream, nAnz ); + rStream.ReadByteString( sColorName, rStream.GetStreamCharSet() ); + rLoadedColorName = sColorName; + pColor = rSc.GetColor(sColorName); +} + + +BOOL ImpSvNumFor::HasNewCurrency() const +{ + for ( USHORT j=0; j> nCnt; + for ( USHORT j=0; j> nPos >> nType; + if ( nPos < nAnzStrings ) + aI.nTypeArray[nPos] = nType; + } +} + + +/***********************Funktionen SvNumberformat************************/ + +enum BracketFormatSymbolType +{ + BRACKET_SYMBOLTYPE_FORMAT = -1, // subformat string + BRACKET_SYMBOLTYPE_COLOR = -2, // color + BRACKET_SYMBOLTYPE_ERROR = -3, // error + BRACKET_SYMBOLTYPE_DBNUM1 = -4, // DoubleByteNumber, represent numbers + BRACKET_SYMBOLTYPE_DBNUM2 = -5, // using CJK characters, Excel compatible. + BRACKET_SYMBOLTYPE_DBNUM3 = -6, + BRACKET_SYMBOLTYPE_DBNUM4 = -7, + BRACKET_SYMBOLTYPE_DBNUM5 = -8, + BRACKET_SYMBOLTYPE_DBNUM6 = -9, + BRACKET_SYMBOLTYPE_DBNUM7 = -10, + BRACKET_SYMBOLTYPE_DBNUM8 = -11, + BRACKET_SYMBOLTYPE_DBNUM9 = -12, + BRACKET_SYMBOLTYPE_LOCALE = -13, + BRACKET_SYMBOLTYPE_NATNUM0 = -14, // Our NativeNumber support, ASCII + BRACKET_SYMBOLTYPE_NATNUM1 = -15, // Our NativeNumber support, represent + BRACKET_SYMBOLTYPE_NATNUM2 = -16, // numbers using CJK, CTL, ... + BRACKET_SYMBOLTYPE_NATNUM3 = -17, + BRACKET_SYMBOLTYPE_NATNUM4 = -18, + BRACKET_SYMBOLTYPE_NATNUM5 = -19, + BRACKET_SYMBOLTYPE_NATNUM6 = -20, + BRACKET_SYMBOLTYPE_NATNUM7 = -21, + BRACKET_SYMBOLTYPE_NATNUM8 = -22, + BRACKET_SYMBOLTYPE_NATNUM9 = -23, + BRACKET_SYMBOLTYPE_NATNUM10 = -24, + BRACKET_SYMBOLTYPE_NATNUM11 = -25, + BRACKET_SYMBOLTYPE_NATNUM12 = -26, + BRACKET_SYMBOLTYPE_NATNUM13 = -27, + BRACKET_SYMBOLTYPE_NATNUM14 = -28, + BRACKET_SYMBOLTYPE_NATNUM15 = -29, + BRACKET_SYMBOLTYPE_NATNUM16 = -30, + BRACKET_SYMBOLTYPE_NATNUM17 = -31, + BRACKET_SYMBOLTYPE_NATNUM18 = -32, + BRACKET_SYMBOLTYPE_NATNUM19 = -33 +}; + +SvNumberformat::SvNumberformat( ImpSvNumberformatScan& rSc, LanguageType eLge ) + : + rScan(rSc), + eLnge(eLge), + nNewStandardDefined(0), + bStarFlag( FALSE ) +{ +} + +void SvNumberformat::ImpCopyNumberformat( const SvNumberformat& rFormat ) +{ + sFormatstring = rFormat.sFormatstring; + eType = rFormat.eType; + eLnge = rFormat.eLnge; + fLimit1 = rFormat.fLimit1; + fLimit2 = rFormat.fLimit2; + eOp1 = rFormat.eOp1; + eOp2 = rFormat.eOp2; + bStandard = rFormat.bStandard; + bIsUsed = rFormat.bIsUsed; + sComment = rFormat.sComment; + nNewStandardDefined = rFormat.nNewStandardDefined; + + // #121103# when copying between documents, get color pointers from own scanner + ImpSvNumberformatScan* pColorSc = ( &rScan != &rFormat.rScan ) ? &rScan : NULL; + + for (USHORT i = 0; i < 4; i++) + NumFor[i].Copy(rFormat.NumFor[i], pColorSc); +} + +SvNumberformat::SvNumberformat( SvNumberformat& rFormat ) + : rScan(rFormat.rScan), bStarFlag( rFormat.bStarFlag ) +{ + ImpCopyNumberformat( rFormat ); +} + +SvNumberformat::SvNumberformat( SvNumberformat& rFormat, ImpSvNumberformatScan& rSc ) + : rScan(rSc), bStarFlag( rFormat.bStarFlag ) +{ + ImpCopyNumberformat( rFormat ); +} + + +BOOL lcl_SvNumberformat_IsBracketedPrefix( short nSymbolType ) +{ + if ( nSymbolType > 0 ) + return TRUE; // conditions + switch ( nSymbolType ) + { + case BRACKET_SYMBOLTYPE_COLOR : + case BRACKET_SYMBOLTYPE_DBNUM1 : + case BRACKET_SYMBOLTYPE_DBNUM2 : + case BRACKET_SYMBOLTYPE_DBNUM3 : + case BRACKET_SYMBOLTYPE_DBNUM4 : + case BRACKET_SYMBOLTYPE_DBNUM5 : + case BRACKET_SYMBOLTYPE_DBNUM6 : + case BRACKET_SYMBOLTYPE_DBNUM7 : + case BRACKET_SYMBOLTYPE_DBNUM8 : + case BRACKET_SYMBOLTYPE_DBNUM9 : + case BRACKET_SYMBOLTYPE_LOCALE : + case BRACKET_SYMBOLTYPE_NATNUM0 : + case BRACKET_SYMBOLTYPE_NATNUM1 : + case BRACKET_SYMBOLTYPE_NATNUM2 : + case BRACKET_SYMBOLTYPE_NATNUM3 : + case BRACKET_SYMBOLTYPE_NATNUM4 : + case BRACKET_SYMBOLTYPE_NATNUM5 : + case BRACKET_SYMBOLTYPE_NATNUM6 : + case BRACKET_SYMBOLTYPE_NATNUM7 : + case BRACKET_SYMBOLTYPE_NATNUM8 : + case BRACKET_SYMBOLTYPE_NATNUM9 : + case BRACKET_SYMBOLTYPE_NATNUM10 : + case BRACKET_SYMBOLTYPE_NATNUM11 : + case BRACKET_SYMBOLTYPE_NATNUM12 : + case BRACKET_SYMBOLTYPE_NATNUM13 : + case BRACKET_SYMBOLTYPE_NATNUM14 : + case BRACKET_SYMBOLTYPE_NATNUM15 : + case BRACKET_SYMBOLTYPE_NATNUM16 : + case BRACKET_SYMBOLTYPE_NATNUM17 : + case BRACKET_SYMBOLTYPE_NATNUM18 : + case BRACKET_SYMBOLTYPE_NATNUM19 : + return TRUE; + } + return FALSE; +} + + +SvNumberformat::SvNumberformat(String& rString, + ImpSvNumberformatScan* pSc, + ImpSvNumberInputScan* pISc, + xub_StrLen& nCheckPos, + LanguageType& eLan, + BOOL bStan) + : + rScan(*pSc), + nNewStandardDefined(0), + bStarFlag( FALSE ) +{ + // If the group (AKA thousand) separator is a Non-Breaking Space (French) + // replace all occurences by a simple space. + // The tokens will be changed to the LocaleData separator again later on. + const sal_Unicode cNBSp = 0xA0; + const String& rThSep = GetFormatter().GetNumThousandSep(); + if ( rThSep.GetChar(0) == cNBSp && rThSep.Len() == 1 ) + { + xub_StrLen nIndex = 0; + do + nIndex = rString.SearchAndReplace( cNBSp, ' ', nIndex ); + while ( nIndex != STRING_NOTFOUND ); + } + + if (rScan.GetConvertMode()) + { + eLnge = rScan.GetNewLnge(); + eLan = eLnge; // Wechsel auch zurueckgeben + } + else + eLnge = eLan; + bStandard = bStan; + bIsUsed = FALSE; + fLimit1 = 0.0; + fLimit2 = 0.0; + eOp1 = NUMBERFORMAT_OP_NO; + eOp2 = NUMBERFORMAT_OP_NO; + eType = NUMBERFORMAT_DEFINED; + + BOOL bCancel = FALSE; + BOOL bCondition = FALSE; + short eSymbolType; + xub_StrLen nPos = 0; + xub_StrLen nPosOld; + nCheckPos = 0; + String aComment; + + // Split into 4 sub formats + USHORT nIndex; + for ( nIndex = 0; nIndex < 4 && !bCancel; nIndex++ ) + { + // Original language/country may have to be reestablished + if (rScan.GetConvertMode()) + (rScan.GetNumberformatter())->ChangeIntl(rScan.GetTmpLnge()); + + String sStr; + nPosOld = nPos; // Start position of substring + // first get bracketed prefixes; e.g. conditions, color + do + { + eSymbolType = ImpNextSymbol(rString, nPos, sStr); + if (eSymbolType > 0) // condition + { + if ( nIndex == 0 && !bCondition ) + { + bCondition = TRUE; + eOp1 = (SvNumberformatLimitOps) eSymbolType; + } + else if ( nIndex == 1 && bCondition ) + eOp2 = (SvNumberformatLimitOps) eSymbolType; + else // error + { + bCancel = TRUE; // break for + nCheckPos = nPosOld; + } + if (!bCancel) + { + double fNumber; + xub_StrLen nAnzChars = ImpGetNumber(rString, nPos, sStr); + if (nAnzChars > 0) + { + short F_Type; + if (!pISc->IsNumberFormat(sStr,F_Type,fNumber) || + ( F_Type != NUMBERFORMAT_NUMBER && + F_Type != NUMBERFORMAT_SCIENTIFIC) ) + { + fNumber = 0.0; + nPos = nPos - nAnzChars; + rString.Erase(nPos, nAnzChars); + rString.Insert('0',nPos); + nPos++; + } + } + else + { + fNumber = 0.0; + rString.Insert('0',nPos++); + } + if (nIndex == 0) + fLimit1 = fNumber; + else + fLimit2 = fNumber; + if ( rString.GetChar(nPos) == ']' ) + nPos++; + else + { + bCancel = TRUE; // break for + nCheckPos = nPos; + } + } + nPosOld = nPos; // position before string + } + else if ( lcl_SvNumberformat_IsBracketedPrefix( eSymbolType ) ) + { + switch ( eSymbolType ) + { + case BRACKET_SYMBOLTYPE_COLOR : + { + if ( NumFor[nIndex].GetColor() != NULL ) + { // error, more than one color + bCancel = TRUE; // break for + nCheckPos = nPosOld; + } + else + { + Color* pColor = pSc->GetColor( sStr); + NumFor[nIndex].SetColor( pColor, sStr); + if (pColor == NULL) + { // error + bCancel = TRUE; // break for + nCheckPos = nPosOld; + } + } + } + break; + case BRACKET_SYMBOLTYPE_NATNUM0 : + case BRACKET_SYMBOLTYPE_NATNUM1 : + case BRACKET_SYMBOLTYPE_NATNUM2 : + case BRACKET_SYMBOLTYPE_NATNUM3 : + case BRACKET_SYMBOLTYPE_NATNUM4 : + case BRACKET_SYMBOLTYPE_NATNUM5 : + case BRACKET_SYMBOLTYPE_NATNUM6 : + case BRACKET_SYMBOLTYPE_NATNUM7 : + case BRACKET_SYMBOLTYPE_NATNUM8 : + case BRACKET_SYMBOLTYPE_NATNUM9 : + case BRACKET_SYMBOLTYPE_NATNUM10 : + case BRACKET_SYMBOLTYPE_NATNUM11 : + case BRACKET_SYMBOLTYPE_NATNUM12 : + case BRACKET_SYMBOLTYPE_NATNUM13 : + case BRACKET_SYMBOLTYPE_NATNUM14 : + case BRACKET_SYMBOLTYPE_NATNUM15 : + case BRACKET_SYMBOLTYPE_NATNUM16 : + case BRACKET_SYMBOLTYPE_NATNUM17 : + case BRACKET_SYMBOLTYPE_NATNUM18 : + case BRACKET_SYMBOLTYPE_NATNUM19 : + { + if ( NumFor[nIndex].GetNatNum().IsSet() ) + { + bCancel = TRUE; // break for + nCheckPos = nPosOld; + } + else + { + sStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "NatNum" ) ); + //! eSymbolType is negative + BYTE nNum = sal::static_int_cast< BYTE >(0 - (eSymbolType - BRACKET_SYMBOLTYPE_NATNUM0)); + sStr += String::CreateFromInt32( nNum ); + NumFor[nIndex].SetNatNumNum( nNum, FALSE ); + } + } + break; + case BRACKET_SYMBOLTYPE_DBNUM1 : + case BRACKET_SYMBOLTYPE_DBNUM2 : + case BRACKET_SYMBOLTYPE_DBNUM3 : + case BRACKET_SYMBOLTYPE_DBNUM4 : + case BRACKET_SYMBOLTYPE_DBNUM5 : + case BRACKET_SYMBOLTYPE_DBNUM6 : + case BRACKET_SYMBOLTYPE_DBNUM7 : + case BRACKET_SYMBOLTYPE_DBNUM8 : + case BRACKET_SYMBOLTYPE_DBNUM9 : + { + if ( NumFor[nIndex].GetNatNum().IsSet() ) + { + bCancel = TRUE; // break for + nCheckPos = nPosOld; + } + else + { + sStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "DBNum" ) ); + //! eSymbolType is negative + BYTE nNum = sal::static_int_cast< BYTE >(1 - (eSymbolType - BRACKET_SYMBOLTYPE_DBNUM1)); + sStr += static_cast< sal_Unicode >('0' + nNum); + NumFor[nIndex].SetNatNumNum( nNum, TRUE ); + } + } + break; + case BRACKET_SYMBOLTYPE_LOCALE : + { + if ( NumFor[nIndex].GetNatNum().GetLang() != LANGUAGE_DONTKNOW ) + { + bCancel = TRUE; // break for + nCheckPos = nPosOld; + } + else + { + xub_StrLen nTmp = 2; + LanguageType eLang = ImpGetLanguageType( sStr, nTmp ); + if ( eLang == LANGUAGE_DONTKNOW ) + { + bCancel = TRUE; // break for + nCheckPos = nPosOld; + } + else + { + sStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "$-" ) ); + sStr += String::CreateFromInt32( sal_Int32( eLang ), 16 ).ToUpperAscii(); + NumFor[nIndex].SetNatNumLang( eLang ); + } + } + } + break; + } + if ( !bCancel ) + { + rString.Erase(nPosOld,nPos-nPosOld); + rString.Insert(sStr,nPosOld); + nPos = nPosOld + sStr.Len(); + rString.Insert(']', nPos); + rString.Insert('[', nPosOld); + nPos += 2; + nPosOld = nPos; // position before string + } + } + } while ( !bCancel && lcl_SvNumberformat_IsBracketedPrefix( eSymbolType ) ); + + // The remaining format code string + if ( !bCancel ) + { + if (eSymbolType == BRACKET_SYMBOLTYPE_FORMAT) + { + if (nIndex == 1 && eOp1 == NUMBERFORMAT_OP_NO) + eOp1 = NUMBERFORMAT_OP_GT; // undefined condition, default: > 0 + else if (nIndex == 2 && eOp2 == NUMBERFORMAT_OP_NO) + eOp2 = NUMBERFORMAT_OP_LT; // undefined condition, default: < 0 + if (sStr.Len() == 0) + { // empty sub format + } + else + { + xub_StrLen nStrPos = pSc->ScanFormat( sStr, aComment ); + USHORT nAnz = pSc->GetAnzResStrings(); + if (nAnz == 0) // error + nStrPos = 1; + if (nStrPos == 0) // ok + { + // e.g. Thai T speciality + if (pSc->GetNatNumModifier() && !NumFor[nIndex].GetNatNum().IsSet()) + { + String aNat( RTL_CONSTASCII_USTRINGPARAM( "[NatNum")); + aNat += String::CreateFromInt32( pSc->GetNatNumModifier()); + aNat += ']'; + sStr.Insert( aNat, 0); + NumFor[nIndex].SetNatNumNum( pSc->GetNatNumModifier(), FALSE ); + } + // #i53826# #i42727# For the Thai T speciality we need + // to freeze the locale and immunize it against + // conversions during exports, just in case we want to + // save to Xcl. This disables the feature of being able + // to convert a NatNum to another locale. You can't + // have both. + // FIXME: implement a specialized export conversion + // that works on tokens (have to tokenize all first) + // and doesn't use the format string and + // PutandConvertEntry() to LANGUAGE_ENGLISH_US in + // sc/source/filter/excel/xestyle.cxx + // XclExpNumFmtBuffer::WriteFormatRecord(). + LanguageType eLanguage; + if (NumFor[nIndex].GetNatNum().GetNatNum() == 1 && + ((eLanguage = + MsLangId::getRealLanguage( eLan)) + == LANGUAGE_THAI) && + NumFor[nIndex].GetNatNum().GetLang() == + LANGUAGE_DONTKNOW) + { + String aLID( RTL_CONSTASCII_USTRINGPARAM( "[$-")); + aLID += String::CreateFromInt32( sal_Int32( + eLanguage), 16 ).ToUpperAscii(); + aLID += ']'; + sStr.Insert( aLID, 0); + NumFor[nIndex].SetNatNumLang( eLanguage); + } + rString.Erase(nPosOld,nPos-nPosOld); + rString.Insert(sStr,nPosOld); + nPos = nPosOld + sStr.Len(); + if (nPos < rString.Len()) + { + rString.Insert(';',nPos); + nPos++; + } + NumFor[nIndex].Enlarge(nAnz); + pSc->CopyInfo(&(NumFor[nIndex].Info()), nAnz); + // type check + if (nIndex == 0) + eType = (short) NumFor[nIndex].Info().eScannedType; + else if (nIndex == 3) + { // #77026# Everything recognized IS text + NumFor[nIndex].Info().eScannedType = NUMBERFORMAT_TEXT; + } + else if ( (short) NumFor[nIndex].Info().eScannedType != + eType) + eType = NUMBERFORMAT_DEFINED; + } + else + { + nCheckPos = nPosOld + nStrPos; // error in string + bCancel = TRUE; // break for + } + } + } + else if (eSymbolType == BRACKET_SYMBOLTYPE_ERROR) // error + { + nCheckPos = nPosOld; + bCancel = TRUE; + } + else if ( lcl_SvNumberformat_IsBracketedPrefix( eSymbolType ) ) + { + nCheckPos = nPosOld+1; // error, prefix in string + bCancel = TRUE; // break for + } + } + if ( bCancel && !nCheckPos ) + nCheckPos = 1; // nCheckPos is used as an error condition + if ( !bCancel ) + { + if ( NumFor[nIndex].GetNatNum().IsSet() && + NumFor[nIndex].GetNatNum().GetLang() == LANGUAGE_DONTKNOW ) + NumFor[nIndex].SetNatNumLang( eLan ); + } + if (rString.Len() == nPos) + { + if ( nIndex == 2 && eSymbolType == BRACKET_SYMBOLTYPE_FORMAT && + rString.GetChar(nPos-1) == ';' ) + { // #83510# A 4th subformat explicitly specified to be empty + // hides any text. Need the type here for HasTextFormat() + NumFor[3].Info().eScannedType = NUMBERFORMAT_TEXT; + } + bCancel = TRUE; + } + if ( NumFor[nIndex].GetNatNum().IsSet() ) + NumFor[nIndex].SetNatNumDate( + (NumFor[nIndex].Info().eScannedType & NUMBERFORMAT_DATE) != 0 ); + } + + if ( bCondition && !nCheckPos ) + { + if ( nIndex == 1 && NumFor[0].GetnAnz() == 0 && + rString.GetChar(rString.Len()-1) != ';' ) + { // No format code => GENERAL but not if specified empty + String aAdd( pSc->GetStandardName() ); + String aTmp; + if ( !pSc->ScanFormat( aAdd, aTmp ) ) + { + USHORT nAnz = pSc->GetAnzResStrings(); + if ( nAnz ) + { + NumFor[0].Enlarge(nAnz); + pSc->CopyInfo( &(NumFor[0].Info()), nAnz ); + rString += aAdd; + } + } + } + else if ( nIndex == 1 && NumFor[nIndex].GetnAnz() == 0 && + rString.GetChar(rString.Len()-1) != ';' && + (NumFor[0].GetnAnz() > 1 || (NumFor[0].GetnAnz() == 1 && + NumFor[0].Info().nTypeArray[0] != NF_KEY_GENERAL)) ) + { // No trailing second subformat => GENERAL but not if specified empty + // and not if first subformat is GENERAL + String aAdd( pSc->GetStandardName() ); + String aTmp; + if ( !pSc->ScanFormat( aAdd, aTmp ) ) + { + USHORT nAnz = pSc->GetAnzResStrings(); + if ( nAnz ) + { + NumFor[nIndex].Enlarge(nAnz); + pSc->CopyInfo( &(NumFor[nIndex].Info()), nAnz ); + rString += ';'; + rString += aAdd; + } + } + } + else if ( nIndex == 2 && NumFor[nIndex].GetnAnz() == 0 && + rString.GetChar(rString.Len()-1) != ';' && + eOp2 != NUMBERFORMAT_OP_NO ) + { // No trailing third subformat => GENERAL but not if specified empty + String aAdd( pSc->GetStandardName() ); + String aTmp; + if ( !pSc->ScanFormat( aAdd, aTmp ) ) + { + USHORT nAnz = pSc->GetAnzResStrings(); + if ( nAnz ) + { + NumFor[nIndex].Enlarge(nAnz); + pSc->CopyInfo( &(NumFor[nIndex].Info()), nAnz ); + rString += ';'; + rString += aAdd; + } + } + } + } + sFormatstring = rString; + if ( aComment.Len() ) + { + SetComment( aComment ); // setzt sComment und sFormatstring + rString = sFormatstring; // geaenderten sFormatstring uebernehmen + } + if (NumFor[2].GetnAnz() == 0 && // kein 3. Teilstring + eOp1 == NUMBERFORMAT_OP_GT && eOp2 == NUMBERFORMAT_OP_NO && + fLimit1 == 0.0 && fLimit2 == 0.0) + eOp1 = NUMBERFORMAT_OP_GE; // 0 zum ersten Format dazu + +} + +SvNumberformat::~SvNumberformat() +{ +} + +//--------------------------------------------------------------------------- +// Next_Symbol +//--------------------------------------------------------------------------- +// Zerlegt die Eingabe in Symbole fuer die weitere +// Verarbeitung (Turing-Maschine). +//--------------------------------------------------------------------------- +// Ausgangs Zustand = SsStart +//---------------+-------------------+-----------------------+--------------- +// Alter Zustand | gelesenes Zeichen | Aktion | Neuer Zustand +//---------------+-------------------+-----------------------+--------------- +// SsStart | ; | Pos-- | SsGetString +// | [ | Symbol += Zeichen | SsGetBracketed +// | ] | Fehler | SsStop +// | BLANK | | +// | Sonst | Symbol += Zeichen | SsGetString +//---------------+-------------------+-----------------------+--------------- +// SsGetString | ; | | SsStop +// | Sonst | Symbol+=Zeichen | +//---------------+-------------------+-----------------------+--------------- +// SsGetBracketed| <, > = | del [ | +// | | Symbol += Zeichen | SsGetCon +// | BLANK | | +// | h, H, m, M, s, S | Symbol += Zeichen | SsGetTime +// | sonst | del [ | +// | | Symbol += Zeichen | SsGetPrefix +//---------------+-------------------+-----------------------+--------------- +// SsGetTime | ] | Symbol += Zeichen | SsGetString +// | h, H, m, M, s, S | Symbol += Zeichen, * | SsGetString +// | sonst | del [; Symbol+=Zeichen| SsGetPrefix +//---------------+-------------------+-----------------------+--------------- +// SsGetPrefix | ] | | SsStop +// | sonst | Symbol += Zeichen | +//---------------+-------------------+-----------------------+--------------- +// SsGetCon | >, = | Symbol+=Zeichen | +// | ] | | SsStop +// | sonst | Fehler | SsStop +//---------------+-------------------+-----------------------+--------------- +// * : Sonderbedingung + +enum ScanState +{ + SsStop, + SsStart, + SsGetCon, // condition + SsGetString, // format string + SsGetPrefix, // color or NatNumN + SsGetTime, // [HH] for time + SsGetBracketed // any [...] not decided yet +}; + + +// read a string until ']' and delete spaces in input +// static +xub_StrLen SvNumberformat::ImpGetNumber(String& rString, + xub_StrLen& nPos, + String& sSymbol) +{ + xub_StrLen nStartPos = nPos; + sal_Unicode cToken; + xub_StrLen nLen = rString.Len(); + sSymbol.Erase(); + while ( nPos < nLen && ((cToken = rString.GetChar(nPos)) != ']') ) + { + if (cToken == ' ') + { // delete spaces + rString.Erase(nPos,1); + nLen--; + } + else + { + nPos++; + sSymbol += cToken; + } + } + return nPos - nStartPos; +} + + +// static +LanguageType SvNumberformat::ImpGetLanguageType( const String& rString, + xub_StrLen& nPos ) +{ + sal_Int32 nNum = 0; + sal_Unicode cToken = 0; + xub_StrLen nLen = rString.Len(); + while ( nPos < nLen && ((cToken = rString.GetChar(nPos)) != ']') ) + { + if ( '0' <= cToken && cToken <= '9' ) + { + nNum *= 16; + nNum += cToken - '0'; + } + else if ( 'a' <= cToken && cToken <= 'f' ) + { + nNum *= 16; + nNum += cToken - 'a' + 10; + } + else if ( 'A' <= cToken && cToken <= 'F' ) + { + nNum *= 16; + nNum += cToken - 'A' + 10; + } + else + return LANGUAGE_DONTKNOW; + ++nPos; + } + return (nNum && (cToken == ']' || nPos == nLen)) ? (LanguageType)nNum : + LANGUAGE_DONTKNOW; +} + + +short SvNumberformat::ImpNextSymbol(String& rString, + xub_StrLen& nPos, + String& sSymbol) +{ + short eSymbolType = BRACKET_SYMBOLTYPE_FORMAT; + sal_Unicode cToken; + sal_Unicode cLetter = ' '; // Zwischenergebnis + xub_StrLen nLen = rString.Len(); + ScanState eState = SsStart; + sSymbol.Erase(); + const String* pKeywords = rScan.GetKeywords(); + while (nPos < nLen && eState != SsStop) + { + cToken = rString.GetChar(nPos); + nPos++; + switch (eState) + { + case SsStart: + { + if (cToken == '[') + { + eState = SsGetBracketed; + sSymbol += cToken; + } + else if (cToken == ';') + { + eState = SsGetString; + nPos--; + eSymbolType = BRACKET_SYMBOLTYPE_FORMAT; + } + else if (cToken == ']') + { + eState = SsStop; + eSymbolType = BRACKET_SYMBOLTYPE_ERROR; + } + else if (cToken == ' ') // Skip Blanks + { + rString.Erase(nPos-1,1); + nPos--; + nLen--; + } + else + { + sSymbol += cToken; + eState = SsGetString; + eSymbolType = BRACKET_SYMBOLTYPE_FORMAT; + } + } + break; + case SsGetBracketed: + { + switch (cToken) + { + case '<': + case '>': + case '=': + { + sSymbol.EraseAllChars('['); + sSymbol += cToken; + cLetter = cToken; + eState = SsGetCon; + switch (cToken) + { + case '<': eSymbolType = NUMBERFORMAT_OP_LT; break; + case '>': eSymbolType = NUMBERFORMAT_OP_GT; break; + case '=': eSymbolType = NUMBERFORMAT_OP_EQ; break; + default: break; + } + } + break; + case ' ': + { + rString.Erase(nPos-1,1); + nPos--; + nLen--; + } + break; + case '$' : + { + if ( rString.GetChar(nPos) == '-' ) + { // [$-xxx] locale + sSymbol.EraseAllChars('['); + eSymbolType = BRACKET_SYMBOLTYPE_LOCALE; + eState = SsGetPrefix; + } + else + { // currency as of SV_NUMBERFORMATTER_VERSION_NEW_CURR + eSymbolType = BRACKET_SYMBOLTYPE_FORMAT; + eState = SsGetString; + } + sSymbol += cToken; + } + break; + case '~' : + { // calendarID as of SV_NUMBERFORMATTER_VERSION_CALENDAR + eSymbolType = BRACKET_SYMBOLTYPE_FORMAT; + sSymbol += cToken; + eState = SsGetString; + } + break; + default: + { + static const String aNatNum( RTL_CONSTASCII_USTRINGPARAM( "NATNUM" ) ); + static const String aDBNum( RTL_CONSTASCII_USTRINGPARAM( "DBNUM" ) ); + String aUpperNatNum( rChrCls().toUpper( rString, nPos-1, aNatNum.Len() ) ); + String aUpperDBNum( rChrCls().toUpper( rString, nPos-1, aDBNum.Len() ) ); + sal_Unicode cUpper = aUpperNatNum.GetChar(0); + sal_Int32 nNatNumNum = rString.Copy( nPos-1+aNatNum.Len() ).ToInt32(); + sal_Unicode cDBNum = rString.GetChar( nPos-1+aDBNum.Len() ); + if ( aUpperNatNum == aNatNum && 0 <= nNatNumNum && nNatNumNum <= 19 ) + { + sSymbol.EraseAllChars('['); + sSymbol += rString.Copy( --nPos, aNatNum.Len()+1 ); + nPos += aNatNum.Len()+1; + //! SymbolType is negative + eSymbolType = (short) (BRACKET_SYMBOLTYPE_NATNUM0 - nNatNumNum); + eState = SsGetPrefix; + } + else if ( aUpperDBNum == aDBNum && '1' <= cDBNum && cDBNum <= '9' ) + { + sSymbol.EraseAllChars('['); + sSymbol += rString.Copy( --nPos, aDBNum.Len()+1 ); + nPos += aDBNum.Len()+1; + //! SymbolType is negative + eSymbolType = sal::static_int_cast< short >( + BRACKET_SYMBOLTYPE_DBNUM1 - (cDBNum - '1')); + eState = SsGetPrefix; + } + else if (cUpper == pKeywords[NF_KEY_H].GetChar(0) || // H + cUpper == pKeywords[NF_KEY_MI].GetChar(0) || // M + cUpper == pKeywords[NF_KEY_S].GetChar(0) ) // S + { + sSymbol += cToken; + eState = SsGetTime; + cLetter = cToken; + } + else + { + sSymbol.EraseAllChars('['); + sSymbol += cToken; + eSymbolType = BRACKET_SYMBOLTYPE_COLOR; + eState = SsGetPrefix; + } + } + break; + } + } + break; + case SsGetString: + { + if (cToken == ';') + eState = SsStop; + else + sSymbol += cToken; + } + break; + case SsGetTime: + { + if (cToken == ']') + { + sSymbol += cToken; + eState = SsGetString; + eSymbolType = BRACKET_SYMBOLTYPE_FORMAT; + } + else + { + sal_Unicode cUpper = rChrCls().toUpper( rString, nPos-1, 1 ).GetChar(0); + if (cUpper == pKeywords[NF_KEY_H].GetChar(0) || // H + cUpper == pKeywords[NF_KEY_MI].GetChar(0) || // M + cUpper == pKeywords[NF_KEY_S].GetChar(0) ) // S + { + if (cLetter == cToken) + { + sSymbol += cToken; + cLetter = ' '; + } + else + { + sSymbol.EraseAllChars('['); + sSymbol += cToken; + eState = SsGetPrefix; + } + } + else + { + sSymbol.EraseAllChars('['); + sSymbol += cToken; + eSymbolType = BRACKET_SYMBOLTYPE_COLOR; + eState = SsGetPrefix; + } + } + } + break; + case SsGetCon: + { + switch (cToken) + { + case '<': + { + eState = SsStop; + eSymbolType = BRACKET_SYMBOLTYPE_ERROR; + } + break; + case '>': + { + if (cLetter == '<') + { + sSymbol += cToken; + cLetter = ' '; + eState = SsStop; + eSymbolType = NUMBERFORMAT_OP_NE; + } + else + { + eState = SsStop; + eSymbolType = BRACKET_SYMBOLTYPE_ERROR; + } + } + break; + case '=': + { + if (cLetter == '<') + { + sSymbol += cToken; + cLetter = ' '; + eSymbolType = NUMBERFORMAT_OP_LE; + } + else if (cLetter == '>') + { + sSymbol += cToken; + cLetter = ' '; + eSymbolType = NUMBERFORMAT_OP_GE; + } + else + { + eState = SsStop; + eSymbolType = BRACKET_SYMBOLTYPE_ERROR; + } + } + break; + case ' ': + { + rString.Erase(nPos-1,1); + nPos--; + nLen--; + } + break; + default: + { + eState = SsStop; + nPos--; + } + break; + } + } + break; + case SsGetPrefix: + { + if (cToken == ']') + eState = SsStop; + else + sSymbol += cToken; + } + break; + default: + break; + } // of switch + } // of while + + return eSymbolType; +} + +NfHackConversion SvNumberformat::Load( SvStream& rStream, + ImpSvNumMultipleReadHeader& rHdr, SvNumberFormatter* pHackConverter, + ImpSvNumberInputScan& rISc ) +{ + rHdr.StartEntry(); + USHORT nOp1, nOp2; + SvNumberformat::LoadString( rStream, sFormatstring ); + rStream >> eType >> fLimit1 >> fLimit2 + >> nOp1 >> nOp2 >> bStandard >> bIsUsed; + NfHackConversion eHackConversion = NF_CONVERT_NONE; + BOOL bOldConvert = FALSE; + LanguageType eOldTmpLang = 0; + LanguageType eOldNewLang = 0; + if ( pHackConverter ) + { // werden nur hierbei gebraucht + bOldConvert = rScan.GetConvertMode(); + eOldTmpLang = rScan.GetTmpLnge(); + eOldNewLang = rScan.GetNewLnge(); + } + String aLoadedColorName; + for (USHORT i = 0; i < 4; i++) + { + NumFor[i].Load( rStream, rScan, aLoadedColorName ); + if ( pHackConverter && eHackConversion == NF_CONVERT_NONE ) + { + //! HACK! ER 29.07.97 13:52 + // leider wurde nicht gespeichert, was SYSTEM on Save wirklich war :-/ + // aber immerhin wird manchmal fuer einen Entry FARBE oder COLOR gespeichert.. + // System-German FARBE nach System-xxx COLOR umsetzen und vice versa, + //! geht davon aus, dass onSave nur GERMAN und ENGLISH KeyWords in + //! ImpSvNumberformatScan existierten + if ( aLoadedColorName.Len() && !NumFor[i].GetColor() + && aLoadedColorName != rScan.GetColorString() ) + { + if ( rScan.GetColorString().EqualsAscii( "FARBE" ) ) + { // English -> German + eHackConversion = NF_CONVERT_ENGLISH_GERMAN; + rScan.GetNumberformatter()->ChangeIntl( LANGUAGE_ENGLISH_US ); + rScan.SetConvertMode( LANGUAGE_ENGLISH_US, LANGUAGE_GERMAN ); + } + else + { // German -> English + eHackConversion = NF_CONVERT_GERMAN_ENGLISH; + rScan.GetNumberformatter()->ChangeIntl( LANGUAGE_GERMAN ); + rScan.SetConvertMode( LANGUAGE_GERMAN, LANGUAGE_ENGLISH_US ); + } + String aColorName = NumFor[i].GetColorName(); + const Color* pColor = rScan.GetColor( aColorName ); + if ( !pColor && aLoadedColorName == aColorName ) + eHackConversion = NF_CONVERT_NONE; + rScan.GetNumberformatter()->ChangeIntl( LANGUAGE_SYSTEM ); + rScan.SetConvertMode( eOldTmpLang, eOldNewLang ); + rScan.SetConvertMode( bOldConvert ); + } + } + } + eOp1 = (SvNumberformatLimitOps) nOp1; + eOp2 = (SvNumberformatLimitOps) nOp2; + String aComment; // wird nach dem NewCurrency-Geraffel richtig gesetzt + if ( rHdr.BytesLeft() ) + { // ab SV_NUMBERFORMATTER_VERSION_NEWSTANDARD + SvNumberformat::LoadString( rStream, aComment ); + rStream >> nNewStandardDefined; + } + + xub_StrLen nNewCurrencyEnd = STRING_NOTFOUND; + BOOL bNewCurrencyComment = ( aComment.GetChar(0) == cNewCurrencyMagic && + (nNewCurrencyEnd = aComment.Search( cNewCurrencyMagic, 1 )) != STRING_NOTFOUND ); + BOOL bNewCurrencyLoaded = FALSE; + BOOL bNewCurrency = FALSE; + + BOOL bGoOn = TRUE; + while ( rHdr.BytesLeft() && bGoOn ) + { // as of SV_NUMBERFORMATTER_VERSION_NEW_CURR + USHORT nId; + rStream >> nId; + switch ( nId ) + { + case nNewCurrencyVersionId : + { + bNewCurrencyLoaded = TRUE; + rStream >> bNewCurrency; + if ( bNewCurrency ) + { + for ( USHORT j=0; j<4; j++ ) + { + NumFor[j].LoadNewCurrencyMap( rStream ); + } + } + } + break; + case nNewStandardFlagVersionId : + rStream >> bStandard; // the real standard flag + break; + default: + DBG_ERRORFILE( "SvNumberformat::Load: unknown header bytes left nId" ); + bGoOn = FALSE; // stop reading unknown stream left over of newer versions + // Would be nice to have multiple read/write headers instead + // but old versions wouldn't know it, TLOT. + } + } + rHdr.EndEntry(); + + if ( bNewCurrencyLoaded ) + { + if ( bNewCurrency && bNewCurrencyComment ) + { // original Formatstring und Kommentar wiederherstellen + sFormatstring = aComment.Copy( 1, nNewCurrencyEnd-1 ); + aComment.Erase( 0, nNewCurrencyEnd+1 ); + } + } + else if ( bNewCurrencyComment ) + { // neu, aber mit Version vor SV_NUMBERFORMATTER_VERSION_NEW_CURR gespeichert + // original Formatstring und Kommentar wiederherstellen + sFormatstring = aComment.Copy( 1, nNewCurrencyEnd-1 ); + aComment.Erase( 0, nNewCurrencyEnd+1 ); + // Zustaende merken + short nDefined = ( eType & NUMBERFORMAT_DEFINED ); + USHORT nNewStandard = nNewStandardDefined; + // neu parsen etc. + String aStr( sFormatstring ); + xub_StrLen nCheckPos = 0; + SvNumberformat* pFormat = new SvNumberformat( aStr, &rScan, &rISc, + nCheckPos, eLnge, bStandard ); + DBG_ASSERT( !nCheckPos, "SvNumberformat::Load: NewCurrencyRescan nCheckPos" ); + ImpCopyNumberformat( *pFormat ); + delete pFormat; + // Zustaende wiederherstellen + eType |= nDefined; + if ( nNewStandard ) + SetNewStandardDefined( nNewStandard ); + } + SetComment( aComment ); + + if ( eHackConversion != NF_CONVERT_NONE ) + { //! und weiter mit dem HACK! + switch ( eHackConversion ) + { + case NF_CONVERT_ENGLISH_GERMAN : + ConvertLanguage( *pHackConverter, + LANGUAGE_ENGLISH_US, LANGUAGE_GERMAN, TRUE ); + break; + case NF_CONVERT_GERMAN_ENGLISH : + ConvertLanguage( *pHackConverter, + LANGUAGE_GERMAN, LANGUAGE_ENGLISH_US, TRUE ); + break; + default: + DBG_ERRORFILE( "SvNumberformat::Load: eHackConversion unknown" ); + } + } + return eHackConversion; +} + +void SvNumberformat::ConvertLanguage( SvNumberFormatter& rConverter, + LanguageType eConvertFrom, LanguageType eConvertTo, BOOL bSystem ) +{ + xub_StrLen nCheckPos; + sal_uInt32 nKey; + short nType = eType; + String aFormatString( sFormatstring ); + if ( bSystem ) + rConverter.PutandConvertEntrySystem( aFormatString, nCheckPos, nType, + nKey, eConvertFrom, eConvertTo ); + else + rConverter.PutandConvertEntry( aFormatString, nCheckPos, nType, + nKey, eConvertFrom, eConvertTo ); + const SvNumberformat* pFormat = rConverter.GetEntry( nKey ); + DBG_ASSERT( pFormat, "SvNumberformat::ConvertLanguage: Conversion ohne Format" ); + if ( pFormat ) + { + ImpCopyNumberformat( *pFormat ); + // aus Formatter/Scanner uebernommene Werte zuruecksetzen + if ( bSystem ) + eLnge = LANGUAGE_SYSTEM; + // pColor zeigt noch auf Tabelle in temporaerem Formatter/Scanner + for ( USHORT i = 0; i < 4; i++ ) + { + String aColorName = NumFor[i].GetColorName(); + Color* pColor = rScan.GetColor( aColorName ); + NumFor[i].SetColor( pColor, aColorName ); + } + } +} + + +// static +void SvNumberformat::LoadString( SvStream& rStream, String& rStr ) +{ + CharSet eStream = rStream.GetStreamCharSet(); + ByteString aStr; + rStream.ReadByteString( aStr ); + sal_Char cStream = NfCurrencyEntry::GetEuroSymbol( eStream ); + if ( aStr.Search( cStream ) == STRING_NOTFOUND ) + { // simple conversion to unicode + rStr = UniString( aStr, eStream ); + } + else + { + sal_Unicode cTarget = NfCurrencyEntry::GetEuroSymbol(); + register const sal_Char* p = aStr.GetBuffer(); + register const sal_Char* const pEnd = p + aStr.Len(); + register sal_Unicode* pUni = rStr.AllocBuffer( aStr.Len() ); + while ( p < pEnd ) + { + if ( *p == cStream ) + *pUni = cTarget; + else + *pUni = ByteString::ConvertToUnicode( *p, eStream ); + p++; + pUni++; + } + *pUni = 0; + } +} + + +void SvNumberformat::Save( SvStream& rStream, ImpSvNumMultipleWriteHeader& rHdr ) const +{ + String aFormatstring( sFormatstring ); + String aComment( sComment ); +#if NF_COMMENT_IN_FORMATSTRING + // der Kommentar im Formatstring wird nicht gespeichert, um in alten Versionen + // nicht ins schleudern zu kommen und spaeter getrennte Verarbeitung + // (z.B. im Dialog) zu ermoeglichen + SetComment( "", aFormatstring, aComment ); +#endif + + BOOL bNewCurrency = HasNewCurrency(); + if ( bNewCurrency ) + { // SV_NUMBERFORMATTER_VERSION_NEW_CURR im Kommentar speichern + aComment.Insert( cNewCurrencyMagic, 0 ); + aComment.Insert( cNewCurrencyMagic, 0 ); + aComment.Insert( aFormatstring, 1 ); + Build50Formatstring( aFormatstring ); // alten Formatstring generieren + } + + // old SO5 versions do behave strange (no output) if standard flag is set + // on formats not prepared for it (not having the following exact types) + BOOL bOldStandard = bStandard; + if ( bOldStandard ) + { + switch ( eType ) + { + case NUMBERFORMAT_NUMBER : + case NUMBERFORMAT_DATE : + case NUMBERFORMAT_TIME : + case NUMBERFORMAT_DATETIME : + case NUMBERFORMAT_PERCENT : + case NUMBERFORMAT_SCIENTIFIC : + // ok to save + break; + default: + bOldStandard = FALSE; + } + } + + rHdr.StartEntry(); + rStream.WriteByteString( aFormatstring, rStream.GetStreamCharSet() ); + rStream << eType << fLimit1 << fLimit2 << (USHORT) eOp1 << (USHORT) eOp2 + << bOldStandard << bIsUsed; + for (USHORT i = 0; i < 4; i++) + NumFor[i].Save(rStream); + // ab SV_NUMBERFORMATTER_VERSION_NEWSTANDARD + rStream.WriteByteString( aComment, rStream.GetStreamCharSet() ); + rStream << nNewStandardDefined; + // ab SV_NUMBERFORMATTER_VERSION_NEW_CURR + rStream << nNewCurrencyVersionId; + rStream << bNewCurrency; + if ( bNewCurrency ) + { + for ( USHORT j=0; j<4; j++ ) + { + NumFor[j].SaveNewCurrencyMap( rStream ); + } + } + + // the real standard flag to load with versions >638 if different + if ( bStandard != bOldStandard ) + { + rStream << nNewStandardFlagVersionId; + rStream << bStandard; + } + + rHdr.EndEntry(); +} + + +BOOL SvNumberformat::HasNewCurrency() const +{ + for ( USHORT j=0; j<4; j++ ) + { + if ( NumFor[j].HasNewCurrency() ) + return TRUE; + } + return FALSE; +} + + +BOOL SvNumberformat::GetNewCurrencySymbol( String& rSymbol, + String& rExtension ) const +{ + for ( USHORT j=0; j<4; j++ ) + { + if ( NumFor[j].GetNewCurrencySymbol( rSymbol, rExtension ) ) + return TRUE; + } + rSymbol.Erase(); + rExtension.Erase(); + return FALSE; +} + + +// static +String SvNumberformat::StripNewCurrencyDelimiters( const String& rStr, + BOOL bQuoteSymbol ) +{ + String aTmp; + xub_StrLen nStartPos, nPos, nLen; + nLen = rStr.Len(); + nStartPos = 0; + while ( (nPos = rStr.SearchAscii( "[$", nStartPos )) != STRING_NOTFOUND ) + { + xub_StrLen nEnd; + if ( (nEnd = GetQuoteEnd( rStr, nPos )) < nLen ) + { + aTmp += rStr.Copy( nStartPos, ++nEnd - nStartPos ); + nStartPos = nEnd; + } + else + { + aTmp += rStr.Copy( nStartPos, nPos - nStartPos ); + nStartPos = nPos + 2; + xub_StrLen nDash; + nEnd = nStartPos - 1; + do + { + nDash = rStr.Search( '-', ++nEnd ); + } while ( (nEnd = GetQuoteEnd( rStr, nDash )) < nLen ); + xub_StrLen nClose; + nEnd = nStartPos - 1; + do + { + nClose = rStr.Search( ']', ++nEnd ); + } while ( (nEnd = GetQuoteEnd( rStr, nClose )) < nLen ); + nPos = ( nDash < nClose ? nDash : nClose ); + if ( !bQuoteSymbol || rStr.GetChar( nStartPos ) == '"' ) + aTmp += rStr.Copy( nStartPos, nPos - nStartPos ); + else + { + aTmp += '"'; + aTmp += rStr.Copy( nStartPos, nPos - nStartPos ); + aTmp += '"'; + } + nStartPos = nClose + 1; + } + } + if ( nLen > nStartPos ) + aTmp += rStr.Copy( nStartPos, nLen - nStartPos ); + return aTmp; +} + + +void SvNumberformat::Build50Formatstring( String& rStr ) const +{ + rStr = StripNewCurrencyDelimiters( sFormatstring, TRUE ); +} + + +void SvNumberformat::ImpGetOutputStandard(double& fNumber, String& OutString) +{ + USHORT nStandardPrec = rScan.GetStandardPrec(); + if ( fabs(fNumber) > 1.0E15 ) // #58531# war E16 + OutString = ::rtl::math::doubleToUString( fNumber, + rtl_math_StringFormat_E, nStandardPrec /*2*/, + GetFormatter().GetNumDecimalSep().GetChar(0)); + else + { +#if 0 +{ + // debugger test case for ANSI standard correctness + ::rtl::OUString aTest; + // expect 0.00123 OK + aTest = ::rtl::math::doubleToUString( 0.001234567, + rtl_math_StringFormat_G, 3, '.', sal_True ); + // expect 123 OK + aTest = ::rtl::math::doubleToUString( 123.4567, + rtl_math_StringFormat_G, 3, '.', sal_True ); + // expect 123.5 OK + aTest = ::rtl::math::doubleToUString( 123.4567, + rtl_math_StringFormat_G, 4, '.', sal_True ); + // expect 1e+03 (as 999.6 rounded to 3 significant digits results in + // 1000 with an exponent equal to significant digits) + // Currently (24-Jan-2003) we do fail in this case and output 1000 + // instead, negligible. + aTest = ::rtl::math::doubleToUString( 999.6, + rtl_math_StringFormat_G, 3, '.', sal_True ); + // expect what? result is 1.2e+004 + aTest = ::rtl::math::doubleToUString( 12345.6789, + rtl_math_StringFormat_G, -3, '.', sal_True ); +} +#endif + + OutString = ::rtl::math::doubleToUString( fNumber, + rtl_math_StringFormat_F, nStandardPrec /*2*/, + GetFormatter().GetNumDecimalSep().GetChar(0), sal_True ); + if (OutString.GetChar(0) == '-' && + OutString.GetTokenCount('0') == OutString.Len()) + OutString.EraseLeadingChars('-'); // nicht -0 + } + ImpTransliterate( OutString, NumFor[0].GetNatNum() ); + return; +} + +void SvNumberformat::ImpGetOutputInputLine(double fNumber, String& OutString) +{ + BOOL bModified = FALSE; + if ( (eType & NUMBERFORMAT_PERCENT) && (fabs(fNumber) < _D_MAX_D_BY_100)) + { + if (fNumber == 0.0) + { + OutString.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "0%" ) ); + return; + } + fNumber *= 100; + bModified = TRUE; + } + + if (fNumber == 0.0) + { + OutString = '0'; + return; + } + + OutString = ::rtl::math::doubleToUString( fNumber, + rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, + GetFormatter().GetNumDecimalSep().GetChar(0), sal_True ); + + if ( eType & NUMBERFORMAT_PERCENT && bModified) + OutString += '%'; + return; +} + +short SvNumberformat::ImpCheckCondition(double& fNumber, + double& fLimit, + SvNumberformatLimitOps eOp) +{ + switch(eOp) + { + case NUMBERFORMAT_OP_NO: return -1; + case NUMBERFORMAT_OP_EQ: return (short) (fNumber == fLimit); + case NUMBERFORMAT_OP_NE: return (short) (fNumber != fLimit); + case NUMBERFORMAT_OP_LT: return (short) (fNumber < fLimit); + case NUMBERFORMAT_OP_LE: return (short) (fNumber <= fLimit); + case NUMBERFORMAT_OP_GT: return (short) (fNumber > fLimit); + case NUMBERFORMAT_OP_GE: return (short) (fNumber >= fLimit); + default: return -1; + } +} + +BOOL SvNumberformat::GetOutputString(String& sString, + String& OutString, + Color** ppColor) +{ + OutString.Erase(); + USHORT nIx; + if (eType & NUMBERFORMAT_TEXT) + nIx = 0; + else if (NumFor[3].GetnAnz() > 0) + nIx = 3; + else + { + *ppColor = NULL; // no change of color + return FALSE; + } + *ppColor = NumFor[nIx].GetColor(); + const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info(); + if (rInfo.eScannedType == NUMBERFORMAT_TEXT) + { + BOOL bRes = FALSE; + const USHORT nAnz = NumFor[nIx].GetnAnz(); + for (USHORT i = 0; i < nAnz; i++) + { + switch (rInfo.nTypeArray[i]) + { + case NF_SYMBOLTYPE_STAR: + if( bStarFlag ) + { + OutString += (sal_Unicode) 0x1B; + OutString += rInfo.sStrArray[i].GetChar(1); + bRes = TRUE; + } + break; + case NF_SYMBOLTYPE_BLANK: + InsertBlanks( OutString, OutString.Len(), + rInfo.sStrArray[i].GetChar(1) ); + break; + case NF_KEY_GENERAL : // #77026# "General" is the same as "@" + case NF_SYMBOLTYPE_DEL : + OutString += sString; + break; + default: + OutString += rInfo.sStrArray[i]; + } + } + return bRes; + } + return FALSE; +} +/* +void SvNumberformat::GetNextFareyNumber(ULONG nPrec, ULONG x0, ULONG x1, + ULONG y0, ULONG y1, + ULONG& x2,ULONG& y2) +{ + x2 = ((y0+nPrec)/y1)*x1 - x0; + y2 = ((y0+nPrec)/y1)*y1 - y0; +} +*/ +ULONG SvNumberformat::ImpGGT(ULONG x, ULONG y) +{ + if (y == 0) + return x; + else + { + ULONG z = x%y; + while (z) + { + x = y; + y = z; + z = x%y; + } + return y; + } +} + +ULONG SvNumberformat::ImpGGTRound(ULONG x, ULONG y) +{ + if (y == 0) + return x; + else + { + ULONG z = x%y; + while ((double)z/(double)y > D_EPS) + { + x = y; + y = z; + z = x%y; + } + return y; + } +} + +BOOL SvNumberformat::GetOutputString(double fNumber, + String& OutString, + Color** ppColor) +{ + BOOL bRes = FALSE; + OutString.Erase(); // alles loeschen + *ppColor = NULL; // keine Farbaenderung + if (eType & NUMBERFORMAT_LOGICAL) + { + if (fNumber) + OutString = rScan.GetTrueString(); + else + OutString = rScan.GetFalseString(); + return FALSE; + } + if (eType & NUMBERFORMAT_TEXT && bStandard) + { + ImpGetOutputStandard(fNumber, OutString); + return FALSE; + } + BOOL bHadStandard = FALSE; + if (bStandard) // einzelne Standardformate + { + if (rScan.GetStandardPrec() == 300) // alle Zahlformate InputLine + { + ImpGetOutputInputLine(fNumber, OutString); + return FALSE; + } + switch (eType) + { + case NUMBERFORMAT_NUMBER: // Standardzahlformat + ImpGetOutputStandard(fNumber, OutString); + bHadStandard = TRUE; + break; + case NUMBERFORMAT_DATE: + bRes |= ImpGetDateOutput(fNumber, 0, OutString); + bHadStandard = TRUE; + break; + case NUMBERFORMAT_TIME: + bRes |= ImpGetTimeOutput(fNumber, 0, OutString); + bHadStandard = TRUE; + break; + case NUMBERFORMAT_DATETIME: + bRes |= ImpGetDateTimeOutput(fNumber, 0, OutString); + bHadStandard = TRUE; + break; + } + } + if ( !bHadStandard ) + { + USHORT nIx; // Index des Teilformats + short nCheck = ImpCheckCondition(fNumber, fLimit1, eOp1); + if (nCheck == -1 || nCheck == 1) // nur 1 String oder True + nIx = 0; + else + { + nCheck = ImpCheckCondition(fNumber, fLimit2, eOp2); + if (nCheck == -1 || nCheck == 1) + nIx = 1; + else + nIx = 2; + } + if (nIx == 1 && fNumber < 0.0 && // negatives Format + IsNegativeRealNegative() ) // ohne Vorzeichen + fNumber = -fNumber; // Vorzeichen eliminieren + *ppColor = NumFor[nIx].GetColor(); + const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info(); + const USHORT nAnz = NumFor[nIx].GetnAnz(); + if (nAnz == 0 && rInfo.eScannedType == NUMBERFORMAT_UNDEFINED) + return FALSE; // leer => nichts + else if (nAnz == 0) // sonst Standard-Format + { + ImpGetOutputStandard(fNumber, OutString); + return FALSE; + } + switch (rInfo.eScannedType) + { + case NUMBERFORMAT_TEXT: + case NUMBERFORMAT_DEFINED: + { + for (USHORT i = 0; i < nAnz; i++) + { + switch (rInfo.nTypeArray[i]) + { + case NF_SYMBOLTYPE_STAR: + if( bStarFlag ) + { + OutString += (sal_Unicode) 0x1B; + OutString += rInfo.sStrArray[i].GetChar(1); + bRes = TRUE; + } + break; + case NF_SYMBOLTYPE_BLANK: + InsertBlanks( OutString, OutString.Len(), + rInfo.sStrArray[i].GetChar(1) ); + break; + case NF_SYMBOLTYPE_STRING: + case NF_SYMBOLTYPE_CURRENCY: + OutString += rInfo.sStrArray[i]; + break; + case NF_SYMBOLTYPE_THSEP: + if (rInfo.nThousand == 0) + OutString += rInfo.sStrArray[i]; + break; + default: + break; + } + } + } + break; + case NUMBERFORMAT_DATE: + bRes |= ImpGetDateOutput(fNumber, nIx, OutString); + break; + case NUMBERFORMAT_TIME: + bRes |= ImpGetTimeOutput(fNumber, nIx, OutString); + break; + case NUMBERFORMAT_DATETIME: + bRes |= ImpGetDateTimeOutput(fNumber, nIx, OutString); + break; + case NUMBERFORMAT_NUMBER: + case NUMBERFORMAT_PERCENT: + case NUMBERFORMAT_CURRENCY: + bRes |= ImpGetNumberOutput(fNumber, nIx, OutString); + break; + case NUMBERFORMAT_FRACTION: + { + String sStr, sFrac, sDiv; // Strings, Wert fuer + ULONG nFrac, nDiv; // Vorkommaanteil + // Zaehler und Nenner + BOOL bSign = FALSE; + if (fNumber < 0) + { + if (nIx == 0) // nicht in hinteren + bSign = TRUE; // Formaten + fNumber = -fNumber; + } + double fNum = floor(fNumber); // Vorkommateil + fNumber -= fNum; // Nachkommateil + if (fNum > _D_MAX_U_LONG_ || rInfo.nCntExp > 9) + // zu gross + { + OutString = rScan.GetErrorString(); + return FALSE; + } + if (rInfo.nCntExp == 0) + { + DBG_ERROR("SvNumberformat:: Bruch, nCntExp == 0"); + return FALSE; + } + ULONG nBasis = ((ULONG)floor( // 9, 99, 999 ,... + pow(10.0,rInfo.nCntExp))) - 1; + ULONG x0, y0, x1, y1; + + if (rInfo.nCntExp <= _MAX_FRACTION_PREC) + { + BOOL bUpperHalf; + if (fNumber > 0.5) + { + bUpperHalf = TRUE; + fNumber -= (fNumber - 0.5) * 2.0; + } + else + bUpperHalf = FALSE; + // Einstieg in Farey-Serie + // finden: + x0 = (ULONG) floor(fNumber*nBasis); // z.B. 2/9 <= x < 3/9 + if (x0 == 0) // => x0 = 2 + { + y0 = 1; + x1 = 1; + y1 = nBasis; + } + else if (x0 == (nBasis-1)/2) // (b-1)/2, 1/2 + { // geht (nBasis ungerade) + y0 = nBasis; + x1 = 1; + y1 = 2; + } + else if (x0 == 1) + { + y0 = nBasis; // 1/n; 1/(n-1) + x1 = 1; + y1 = nBasis - 1; + } + else + { + y0 = nBasis; // z.B. 2/9 2/8 + x1 = x0; + y1 = nBasis - 1; + double fUg = (double) x0 / (double) y0; + double fOg = (double) x1 / (double) y1; + ULONG nGgt = ImpGGT(y0, x0); // x0/y0 kuerzen + x0 /= nGgt; + y0 /= nGgt; // Einschachteln: + ULONG x2 = 0; + ULONG y2 = 0; + BOOL bStop = FALSE; + while (!bStop) + { +#ifdef GCC + // #i21648# GCC over-optimizes something resulting + // in wrong fTest values throughout the loops. + volatile +#endif + double fTest = (double)x1/(double)y1; + while (!bStop) + { + while (fTest > fOg) + { + x1--; + fTest = (double)x1/(double)y1; + } + while (fTest < fUg && y1 > 1) + { + y1--; + fTest = (double)x1/(double)y1; + } + if (fTest <= fOg) + { + fOg = fTest; + bStop = TRUE; + } + else if (y1 == 1) + bStop = TRUE; + } // of while + nGgt = ImpGGT(y1, x1); // x1/y1 kuerzen + x2 = x1 / nGgt; + y2 = y1 / nGgt; + if (x2*y0 - x0*y2 == 1 || y1 <= 1) // Test, ob x2/y2 + bStop = TRUE; // naechste Farey-Zahl + else + { + y1--; + bStop = FALSE; + } + } // of while + x1 = x2; + y1 = y2; + } // of else + double fup, flow; + flow = (double)x0/(double)y0; + fup = (double)x1/(double)y1; + while (fNumber > fup) + { + ULONG x2 = ((y0+nBasis)/y1)*x1 - x0; // naechste Farey-Zahl + ULONG y2 = ((y0+nBasis)/y1)*y1 - y0; +// GetNextFareyNumber(nBasis, x0, x1, y0, y1, x2, y2); + x0 = x1; + y0 = y1; + x1 = x2; + y1 = y2; + flow = fup; + fup = (double)x1/(double)y1; + } + if (fNumber - flow < fup - fNumber) + { + nFrac = x0; + nDiv = y0; + } + else + { + nFrac = x1; + nDiv = y1; + } + if (bUpperHalf) // Original restaur. + { + if (nFrac == 0 && nDiv == 1) // 1/1 + fNum += 1.0; + else + nFrac = nDiv - nFrac; + } + } + else // grosse Nenner + { // 0,1234->123/1000 + ULONG nGgt; +/* + nDiv = nBasis+1; + nFrac = ((ULONG)floor(0.5 + fNumber * + pow(10.0,rInfo.nCntExp))); +*/ + nDiv = 10000000; + nFrac = ((ULONG)floor(0.5 + fNumber * 10000000.0)); + nGgt = ImpGGT(nDiv, nFrac); + if (nGgt > 1) + { + nDiv /= nGgt; + nFrac /= nGgt; + } + if (nDiv > nBasis) + { + nGgt = ImpGGTRound(nDiv, nFrac); + if (nGgt > 1) + { + nDiv /= nGgt; + nFrac /= nGgt; + } + } + if (nDiv > nBasis) + { + nDiv = nBasis; + nFrac = ((ULONG)floor(0.5 + fNumber * + pow(10.0,rInfo.nCntExp))); + nGgt = ImpGGTRound(nDiv, nFrac); + if (nGgt > 1) + { + nDiv /= nGgt; + nFrac /= nGgt; + } + } + } + + if (rInfo.nCntPre == 0) // unechter Bruch + { + double fNum1 = fNum * (double)nDiv + (double)nFrac; + if (fNum1 > _D_MAX_U_LONG_) + { + OutString = rScan.GetErrorString(); + return FALSE; + } + nFrac = (ULONG) floor(fNum1); + sStr.Erase(); + } + else if (fNum == 0.0 && nFrac != 0) + sStr.Erase(); + else + { + char aBuf[100]; + sprintf( aBuf, "%.f", fNum ); // simple rounded integer (#100211# - checked) + sStr.AssignAscii( aBuf ); + ImpTransliterate( sStr, NumFor[nIx].GetNatNum() ); + } + if (rInfo.nCntPre > 0 && nFrac == 0) + { + sFrac.Erase(); + sDiv.Erase(); + } + else + { + sFrac = ImpIntToString( nIx, nFrac ); + sDiv = ImpIntToString( nIx, nDiv ); + } + + USHORT j = nAnz-1; // letztes Symbol->rueckw. + xub_StrLen k; // Nenner: + bRes |= ImpNumberFill(sDiv, fNumber, k, j, nIx, NF_SYMBOLTYPE_FRAC); + BOOL bCont = TRUE; + if (rInfo.nTypeArray[j] == NF_SYMBOLTYPE_FRAC) + { + if (rInfo.nCntPre > 0 && nFrac == 0) + sDiv.Insert(' ',0); + else + sDiv.Insert( rInfo.sStrArray[j].GetChar(0), 0 ); + if ( j ) + j--; + else + bCont = FALSE; + } + // weiter Zaehler: + if ( !bCont ) + sFrac.Erase(); + else + { + bRes |= ImpNumberFill(sFrac, fNumber, k, j, nIx, NF_SYMBOLTYPE_FRACBLANK); + if (rInfo.nTypeArray[j] == NF_SYMBOLTYPE_FRACBLANK) + { + sFrac.Insert(rInfo.sStrArray[j],0); + if ( j ) + j--; + else + bCont = FALSE; + } + } + // weiter Hauptzahl + if ( !bCont ) + sStr.Erase(); + else + { + k = sStr.Len(); // hinter letzter Ziffer + bRes |= ImpNumberFillWithThousands(sStr, fNumber, k, j, nIx, + rInfo.nCntPre); + } + if (bSign && !(nFrac == 0 && fNum == 0.0)) + OutString.Insert('-',0); // nicht -0 + OutString += sStr; + OutString += sFrac; + OutString += sDiv; + } + break; + case NUMBERFORMAT_SCIENTIFIC: + { + BOOL bSign = FALSE; + if (fNumber < 0) + { + if (nIx == 0) // nicht in hinteren + bSign = TRUE; // Formaten + fNumber = -fNumber; + } + String sStr( ::rtl::math::doubleToUString( fNumber, + rtl_math_StringFormat_E, + rInfo.nCntPre + rInfo.nCntPost - 1, '.' )); + + String ExpStr; + short nExpSign = 1; + xub_StrLen nExPos = sStr.Search('E'); + if ( nExPos != STRING_NOTFOUND ) + { + // split into mantisse and exponent and get rid of "E+" or "E-" + xub_StrLen nExpStart = nExPos + 1; + switch ( sStr.GetChar( nExpStart ) ) + { + case '-' : + nExpSign = -1; + // fallthru + case '+' : + ++nExpStart; + break; + } + ExpStr = sStr.Copy( nExpStart ); // part following the "E+" + sStr.Erase( nExPos ); + sStr.EraseAllChars('.'); // cut any decimal delimiter + if ( rInfo.nCntPre != 1 ) // rescale Exp + { + sal_Int32 nExp = ExpStr.ToInt32() * nExpSign; + nExp -= sal_Int32(rInfo.nCntPre)-1; + if ( nExp < 0 ) + { + nExpSign = -1; + nExp = -nExp; + } + else + nExpSign = 1; + ExpStr = String::CreateFromInt32( nExp ); + } + } + USHORT j = nAnz-1; // last symbol + xub_StrLen k; // position in ExpStr + bRes |= ImpNumberFill(ExpStr, fNumber, k, j, nIx, NF_SYMBOLTYPE_EXP); + + xub_StrLen nZeros = 0; // erase leading zeros + while (nZeros < k && ExpStr.GetChar(nZeros) == '0') + ++nZeros; + if (nZeros) + ExpStr.Erase( 0, nZeros); + + BOOL bCont = TRUE; + if (rInfo.nTypeArray[j] == NF_SYMBOLTYPE_EXP) + { + const String& rStr = rInfo.sStrArray[j]; + if (nExpSign == -1) + ExpStr.Insert('-',0); + else if (rStr.Len() > 1 && rStr.GetChar(1) == '+') + ExpStr.Insert('+',0); + ExpStr.Insert(rStr.GetChar(0),0); + if ( j ) + j--; + else + bCont = FALSE; + } + // weiter Hauptzahl: + if ( !bCont ) + sStr.Erase(); + else + { + k = sStr.Len(); // hinter letzter Ziffer + bRes |= ImpNumberFillWithThousands(sStr,fNumber, k,j,nIx, + rInfo.nCntPre + + rInfo.nCntPost); + } + if (bSign) + sStr.Insert('-',0); + OutString = sStr; + OutString += ExpStr; + } + break; + } + } + return bRes; +} + +BOOL SvNumberformat::ImpGetTimeOutput(double fNumber, + USHORT nIx, + String& OutString) +{ + using namespace ::com::sun::star::i18n; + BOOL bCalendarSet = FALSE; + double fNumberOrig = fNumber; + BOOL bRes = FALSE; + BOOL bSign = FALSE; + if (fNumber < 0.0) + { + fNumber = -fNumber; + if (nIx == 0) + bSign = TRUE; + } + const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info(); + if (rInfo.bThousand) // []-Format + { + if (fNumber > 1.0E10) // zu gross + { + OutString = rScan.GetErrorString(); + return FALSE; + } + } + else + fNumber -= floor(fNumber); // sonst Datum abtrennen + BOOL bInputLine; + xub_StrLen nCntPost; + if ( rScan.GetStandardPrec() == 300 && + 0 < rInfo.nCntPost && rInfo.nCntPost < 7 ) + { // round at 7 decimals (+5 of 86400 == 12 significant digits) + bInputLine = TRUE; + nCntPost = 7; + } + else + { + bInputLine = FALSE; + nCntPost = xub_StrLen(rInfo.nCntPost); + } + if (bSign && !rInfo.bThousand) // kein []-Format + fNumber = 1.0 - fNumber; // "Kehrwert" + double fTime = fNumber * 86400.0; + fTime = ::rtl::math::round( fTime, int(nCntPost) ); + if (bSign && fTime == 0.0) + bSign = FALSE; // nicht -00:00:00 + + if( floor( fTime ) > _D_MAX_U_LONG_ ) + { + OutString = rScan.GetErrorString(); + return FALSE; + } + ULONG nSeconds = (ULONG)floor( fTime ); + + String sSecStr( ::rtl::math::doubleToUString( fTime-nSeconds, + rtl_math_StringFormat_F, int(nCntPost), '.')); + sSecStr.EraseLeadingChars('0'); + sSecStr.EraseLeadingChars('.'); + if ( bInputLine ) + { + sSecStr.EraseTrailingChars('0'); + if ( sSecStr.Len() < xub_StrLen(rInfo.nCntPost) ) + sSecStr.Expand( xub_StrLen(rInfo.nCntPost), '0' ); + ImpTransliterate( sSecStr, NumFor[nIx].GetNatNum() ); + nCntPost = sSecStr.Len(); + } + else + ImpTransliterate( sSecStr, NumFor[nIx].GetNatNum() ); + + xub_StrLen nSecPos = 0; // Zum Ziffernweisen + // abarbeiten + ULONG nHour, nMin, nSec; + if (!rInfo.bThousand) // kein [] Format + { + nHour = (nSeconds/3600) % 24; + nMin = (nSeconds%3600) / 60; + nSec = nSeconds%60; + } + else if (rInfo.nThousand == 3) // [ss] + { + nHour = 0; + nMin = 0; + nSec = nSeconds; + } + else if (rInfo.nThousand == 2) // [mm]:ss + { + nHour = 0; + nMin = nSeconds / 60; + nSec = nSeconds % 60; + } + else if (rInfo.nThousand == 1) // [hh]:mm:ss + { + nHour = nSeconds / 3600; + nMin = (nSeconds%3600) / 60; + nSec = nSeconds%60; + } + else { + // TODO What should these be set to? + nHour = 0; + nMin = 0; + nSec = 0; + } + + sal_Unicode cAmPm = ' '; // a oder p + if (rInfo.nCntExp) // AM/PM + { + if (nHour == 0) + { + nHour = 12; + cAmPm = 'a'; + } + else if (nHour < 12) + cAmPm = 'a'; + else + { + cAmPm = 'p'; + if (nHour > 12) + nHour -= 12; + } + } + const USHORT nAnz = NumFor[nIx].GetnAnz(); + for (USHORT i = 0; i < nAnz; i++) + { + switch (rInfo.nTypeArray[i]) + { + case NF_SYMBOLTYPE_STAR: + if( bStarFlag ) + { + OutString += (sal_Unicode) 0x1B; + OutString += rInfo.sStrArray[i].GetChar(1); + bRes = TRUE; + } + break; + case NF_SYMBOLTYPE_BLANK: + InsertBlanks( OutString, OutString.Len(), + rInfo.sStrArray[i].GetChar(1) ); + break; + case NF_SYMBOLTYPE_STRING: + case NF_SYMBOLTYPE_CURRENCY: + case NF_SYMBOLTYPE_DATESEP: + case NF_SYMBOLTYPE_TIMESEP: + case NF_SYMBOLTYPE_TIME100SECSEP: + OutString += rInfo.sStrArray[i]; + break; + case NF_SYMBOLTYPE_DIGIT: + { + xub_StrLen nLen = ( bInputLine && i > 0 && + (rInfo.nTypeArray[i-1] == NF_SYMBOLTYPE_STRING || + rInfo.nTypeArray[i-1] == NF_SYMBOLTYPE_TIME100SECSEP) ? + nCntPost : rInfo.sStrArray[i].Len() ); + for (xub_StrLen j = 0; j < nLen && nSecPos < nCntPost; j++) + { + OutString += sSecStr.GetChar(nSecPos); + nSecPos++; + } + } + break; + case NF_KEY_AMPM: // AM/PM + { + if ( !bCalendarSet ) + { + double fDiff = DateTime(*(rScan.GetNullDate())) - GetCal().getEpochStart(); + fDiff += fNumberOrig; + GetCal().setLocalDateTime( fDiff ); + bCalendarSet = TRUE; + } + if (cAmPm == 'a') + OutString += GetCal().getDisplayName( + CalendarDisplayIndex::AM_PM, AmPmValue::AM, 0 ); + else + OutString += GetCal().getDisplayName( + CalendarDisplayIndex::AM_PM, AmPmValue::PM, 0 ); + } + break; + case NF_KEY_AP: // A/P + { + if (cAmPm == 'a') + OutString += 'a'; + else + OutString += 'p'; + } + break; + case NF_KEY_MI: // M + OutString += ImpIntToString( nIx, nMin ); + break; + case NF_KEY_MMI: // MM + OutString += ImpIntToString( nIx, nMin, 2 ); + break; + case NF_KEY_H: // H + OutString += ImpIntToString( nIx, nHour ); + break; + case NF_KEY_HH: // HH + OutString += ImpIntToString( nIx, nHour, 2 ); + break; + case NF_KEY_S: // S + OutString += ImpIntToString( nIx, nSec ); + break; + case NF_KEY_SS: // SS + OutString += ImpIntToString( nIx, nSec, 2 ); + break; + default: + break; + } + } + if (bSign && rInfo.bThousand) + OutString.Insert('-',0); + return bRes; +} + + +BOOL SvNumberformat::ImpIsOtherCalendar( const ImpSvNumFor& rNumFor ) const +{ + if ( GetCal().getUniqueID() != Gregorian::get() ) + return FALSE; + const ImpSvNumberformatInfo& rInfo = rNumFor.Info(); + const USHORT nAnz = rNumFor.GetnAnz(); + USHORT i; + for ( i = 0; i < nAnz; i++ ) + { + switch ( rInfo.nTypeArray[i] ) + { + case NF_SYMBOLTYPE_CALENDAR : + return FALSE; + case NF_KEY_EC : + case NF_KEY_EEC : + case NF_KEY_R : + case NF_KEY_RR : + case NF_KEY_AAA : + case NF_KEY_AAAA : + return TRUE; + } + } + return FALSE; +} + + +void SvNumberformat::SwitchToOtherCalendar( String& rOrgCalendar, + double& fOrgDateTime ) const +{ + CalendarWrapper& rCal = GetCal(); + const rtl::OUString &rGregorian = Gregorian::get(); + if ( rCal.getUniqueID() == rGregorian ) + { + using namespace ::com::sun::star::i18n; + ::com::sun::star::uno::Sequence< ::rtl::OUString > xCals + = rCal.getAllCalendars( rLoc().getLocale() ); + sal_Int32 nCnt = xCals.getLength(); + if ( nCnt > 1 ) + { + for ( sal_Int32 j=0; j < nCnt; j++ ) + { + if ( xCals[j] != rGregorian ) + { + if ( !rOrgCalendar.Len() ) + { + rOrgCalendar = rCal.getUniqueID(); + fOrgDateTime = rCal.getDateTime(); + } + rCal.loadCalendar( xCals[j], rLoc().getLocale() ); + rCal.setDateTime( fOrgDateTime ); + break; // for + } + } + } + } +} + + +void SvNumberformat::SwitchToGregorianCalendar( const String& rOrgCalendar, + double fOrgDateTime ) const +{ + CalendarWrapper& rCal = GetCal(); + const rtl::OUString &rGregorian = Gregorian::get(); + if ( rOrgCalendar.Len() && rCal.getUniqueID() != rGregorian ) + { + rCal.loadCalendar( rGregorian, rLoc().getLocale() ); + rCal.setDateTime( fOrgDateTime ); + } +} + + +BOOL SvNumberformat::ImpFallBackToGregorianCalendar( String& rOrgCalendar, double& fOrgDateTime ) +{ + using namespace ::com::sun::star::i18n; + CalendarWrapper& rCal = GetCal(); + const rtl::OUString &rGregorian = Gregorian::get(); + if ( rCal.getUniqueID() != rGregorian ) + { + sal_Int16 nVal = rCal.getValue( CalendarFieldIndex::ERA ); + if ( nVal == 0 && rCal.getLoadedCalendar().Eras[0].ID.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "Dummy" ) ) ) + { + if ( !rOrgCalendar.Len() ) + { + rOrgCalendar = rCal.getUniqueID(); + fOrgDateTime = rCal.getDateTime(); + } + else if ( rOrgCalendar == String(rGregorian) ) + rOrgCalendar.Erase(); + rCal.loadCalendar( rGregorian, rLoc().getLocale() ); + rCal.setDateTime( fOrgDateTime ); + return TRUE; + } + } + return FALSE; +} + + +BOOL SvNumberformat::ImpSwitchToSpecifiedCalendar( String& rOrgCalendar, + double& fOrgDateTime, const ImpSvNumFor& rNumFor ) const +{ + const ImpSvNumberformatInfo& rInfo = rNumFor.Info(); + const USHORT nAnz = rNumFor.GetnAnz(); + for ( USHORT i = 0; i < nAnz; i++ ) + { + if ( rInfo.nTypeArray[i] == NF_SYMBOLTYPE_CALENDAR ) + { + CalendarWrapper& rCal = GetCal(); + if ( !rOrgCalendar.Len() ) + { + rOrgCalendar = rCal.getUniqueID(); + fOrgDateTime = rCal.getDateTime(); + } + rCal.loadCalendar( rInfo.sStrArray[i], rLoc().getLocale() ); + rCal.setDateTime( fOrgDateTime ); + return TRUE; + } + } + return FALSE; +} + + +// static +void SvNumberformat::ImpAppendEraG( String& OutString, + const CalendarWrapper& rCal, sal_Int16 nNatNum ) +{ + using namespace ::com::sun::star::i18n; + if ( rCal.getUniqueID().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "gengou" ) ) ) + { + sal_Unicode cEra; + sal_Int16 nVal = rCal.getValue( CalendarFieldIndex::ERA ); + switch ( nVal ) + { + case 1 : cEra = 'M'; break; + case 2 : cEra = 'T'; break; + case 3 : cEra = 'S'; break; + case 4 : cEra = 'H'; break; + default: + cEra = '?'; + } + OutString += cEra; + } + else + OutString += rCal.getDisplayString( CalendarDisplayCode::SHORT_ERA, nNatNum ); +} + + +BOOL SvNumberformat::ImpGetDateOutput(double fNumber, + USHORT nIx, + String& OutString) +{ + using namespace ::com::sun::star::i18n; + BOOL bRes = FALSE; + CalendarWrapper& rCal = GetCal(); + double fDiff = DateTime(*(rScan.GetNullDate())) - rCal.getEpochStart(); + fNumber += fDiff; + rCal.setLocalDateTime( fNumber ); + String aOrgCalendar; // empty => not changed yet + double fOrgDateTime; + BOOL bOtherCalendar = ImpIsOtherCalendar( NumFor[nIx] ); + if ( bOtherCalendar ) + SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); + if ( ImpFallBackToGregorianCalendar( aOrgCalendar, fOrgDateTime ) ) + bOtherCalendar = FALSE; + const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info(); + const USHORT nAnz = NumFor[nIx].GetnAnz(); + sal_Int16 nNatNum = NumFor[nIx].GetNatNum().GetNatNum(); + for (USHORT i = 0; i < nAnz; i++) + { + switch (rInfo.nTypeArray[i]) + { + case NF_SYMBOLTYPE_CALENDAR : + if ( !aOrgCalendar.Len() ) + { + aOrgCalendar = rCal.getUniqueID(); + fOrgDateTime = rCal.getDateTime(); + } + rCal.loadCalendar( rInfo.sStrArray[i], rLoc().getLocale() ); + rCal.setDateTime( fOrgDateTime ); + ImpFallBackToGregorianCalendar( aOrgCalendar, fOrgDateTime ); + break; + case NF_SYMBOLTYPE_STAR: + if( bStarFlag ) + { + OutString += (sal_Unicode) 0x1B; + OutString += rInfo.sStrArray[i].GetChar(1); + bRes = TRUE; + } + break; + case NF_SYMBOLTYPE_BLANK: + InsertBlanks( OutString, OutString.Len(), + rInfo.sStrArray[i].GetChar(1) ); + break; + case NF_SYMBOLTYPE_STRING: + case NF_SYMBOLTYPE_CURRENCY: + case NF_SYMBOLTYPE_DATESEP: + case NF_SYMBOLTYPE_TIMESEP: + case NF_SYMBOLTYPE_TIME100SECSEP: + OutString += rInfo.sStrArray[i]; + break; + case NF_KEY_M: // M + OutString += rCal.getDisplayString( + CalendarDisplayCode::SHORT_MONTH, nNatNum ); + break; + case NF_KEY_MM: // MM + OutString += rCal.getDisplayString( + CalendarDisplayCode::LONG_MONTH, nNatNum ); + break; + case NF_KEY_MMM: // MMM + OutString += rCal.getDisplayString( + CalendarDisplayCode::SHORT_MONTH_NAME, nNatNum ); + break; + case NF_KEY_MMMM: // MMMM + OutString += rCal.getDisplayString( + CalendarDisplayCode::LONG_MONTH_NAME, nNatNum ); + break; + case NF_KEY_MMMMM: // MMMMM + OutString += rCal.getDisplayString( + CalendarDisplayCode::LONG_MONTH_NAME, nNatNum ).GetChar(0); + break; + case NF_KEY_Q: // Q + OutString += rCal.getDisplayString( + CalendarDisplayCode::SHORT_QUARTER, nNatNum ); + break; + case NF_KEY_QQ: // QQ + OutString += rCal.getDisplayString( + CalendarDisplayCode::LONG_QUARTER, nNatNum ); + break; + case NF_KEY_D: // D + OutString += rCal.getDisplayString( + CalendarDisplayCode::SHORT_DAY, nNatNum ); + break; + case NF_KEY_DD: // DD + OutString += rCal.getDisplayString( + CalendarDisplayCode::LONG_DAY, nNatNum ); + break; + case NF_KEY_DDD: // DDD + { + if ( bOtherCalendar ) + SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime ); + OutString += rCal.getDisplayString( + CalendarDisplayCode::SHORT_DAY_NAME, nNatNum ); + if ( bOtherCalendar ) + SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); + } + break; + case NF_KEY_DDDD: // DDDD + { + if ( bOtherCalendar ) + SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime ); + OutString += rCal.getDisplayString( + CalendarDisplayCode::LONG_DAY_NAME, nNatNum ); + if ( bOtherCalendar ) + SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); + } + break; + case NF_KEY_YY: // YY + { + if ( bOtherCalendar ) + SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime ); + OutString += rCal.getDisplayString( + CalendarDisplayCode::SHORT_YEAR, nNatNum ); + if ( bOtherCalendar ) + SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); + } + break; + case NF_KEY_YYYY: // YYYY + { + if ( bOtherCalendar ) + SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime ); + OutString += rCal.getDisplayString( + CalendarDisplayCode::LONG_YEAR, nNatNum ); + if ( bOtherCalendar ) + SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); + } + break; + case NF_KEY_EC: // E + OutString += rCal.getDisplayString( + CalendarDisplayCode::SHORT_YEAR, nNatNum ); + break; + case NF_KEY_EEC: // EE + case NF_KEY_R: // R + OutString += rCal.getDisplayString( + CalendarDisplayCode::LONG_YEAR, nNatNum ); + break; + case NF_KEY_NN: // NN + case NF_KEY_AAA: // AAA + OutString += rCal.getDisplayString( + CalendarDisplayCode::SHORT_DAY_NAME, nNatNum ); + break; + case NF_KEY_NNN: // NNN + case NF_KEY_AAAA: // AAAA + OutString += rCal.getDisplayString( + CalendarDisplayCode::LONG_DAY_NAME, nNatNum ); + break; + case NF_KEY_NNNN: // NNNN + { + OutString += rCal.getDisplayString( + CalendarDisplayCode::LONG_DAY_NAME, nNatNum ); + OutString += rLoc().getLongDateDayOfWeekSep(); + } + break; + case NF_KEY_WW : // WW + { + sal_Int16 nVal = rCal.getValue( CalendarFieldIndex::WEEK_OF_YEAR ); + OutString += ImpIntToString( nIx, nVal ); + } + break; + case NF_KEY_G: // G + ImpAppendEraG( OutString, rCal, nNatNum ); + break; + case NF_KEY_GG: // GG + OutString += rCal.getDisplayString( + CalendarDisplayCode::SHORT_ERA, nNatNum ); + break; + case NF_KEY_GGG: // GGG + OutString += rCal.getDisplayString( + CalendarDisplayCode::LONG_ERA, nNatNum ); + break; + case NF_KEY_RR: // RR => GGGEE + OutString += rCal.getDisplayString( + CalendarDisplayCode::LONG_YEAR_AND_ERA, nNatNum ); + break; + } + } + if ( aOrgCalendar.Len() ) + rCal.loadCalendar( aOrgCalendar, rLoc().getLocale() ); // restore calendar + return bRes; +} + +BOOL SvNumberformat::ImpGetDateTimeOutput(double fNumber, + USHORT nIx, + String& OutString) +{ + using namespace ::com::sun::star::i18n; + BOOL bRes = FALSE; + + CalendarWrapper& rCal = GetCal(); + double fDiff = DateTime(*(rScan.GetNullDate())) - rCal.getEpochStart(); + fNumber += fDiff; + + const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info(); + BOOL bInputLine; + xub_StrLen nCntPost; + if ( rScan.GetStandardPrec() == 300 && + 0 < rInfo.nCntPost && rInfo.nCntPost < 7 ) + { // round at 7 decimals (+5 of 86400 == 12 significant digits) + bInputLine = TRUE; + nCntPost = 7; + } + else + { + bInputLine = FALSE; + nCntPost = xub_StrLen(rInfo.nCntPost); + } + double fTime = (fNumber - floor( fNumber )) * 86400.0; + fTime = ::rtl::math::round( fTime, int(nCntPost) ); + if (fTime >= 86400.0) + { + // result of fNumber==x.999999999... rounded up, use correct date/time + fTime -= 86400.0; + fNumber = floor( fNumber + 0.5) + fTime; + } + rCal.setLocalDateTime( fNumber ); + + String aOrgCalendar; // empty => not changed yet + double fOrgDateTime; + BOOL bOtherCalendar = ImpIsOtherCalendar( NumFor[nIx] ); + if ( bOtherCalendar ) + SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); + if ( ImpFallBackToGregorianCalendar( aOrgCalendar, fOrgDateTime ) ) + bOtherCalendar = FALSE; + sal_Int16 nNatNum = NumFor[nIx].GetNatNum().GetNatNum(); + + ULONG nSeconds = (ULONG)floor( fTime ); + String sSecStr( ::rtl::math::doubleToUString( fTime-nSeconds, + rtl_math_StringFormat_F, int(nCntPost), '.')); + sSecStr.EraseLeadingChars('0'); + sSecStr.EraseLeadingChars('.'); + if ( bInputLine ) + { + sSecStr.EraseTrailingChars('0'); + if ( sSecStr.Len() < xub_StrLen(rInfo.nCntPost) ) + sSecStr.Expand( xub_StrLen(rInfo.nCntPost), '0' ); + ImpTransliterate( sSecStr, NumFor[nIx].GetNatNum() ); + nCntPost = sSecStr.Len(); + } + else + ImpTransliterate( sSecStr, NumFor[nIx].GetNatNum() ); + + xub_StrLen nSecPos = 0; // Zum Ziffernweisen + // abarbeiten + ULONG nHour, nMin, nSec; + if (!rInfo.bThousand) // [] Format + { + nHour = (nSeconds/3600) % 24; + nMin = (nSeconds%3600) / 60; + nSec = nSeconds%60; + } + else if (rInfo.nThousand == 3) // [ss] + { + nHour = 0; + nMin = 0; + nSec = nSeconds; + } + else if (rInfo.nThousand == 2) // [mm]:ss + { + nHour = 0; + nMin = nSeconds / 60; + nSec = nSeconds % 60; + } + else if (rInfo.nThousand == 1) // [hh]:mm:ss + { + nHour = nSeconds / 3600; + nMin = (nSeconds%3600) / 60; + nSec = nSeconds%60; + } + else { + nHour = 0; // TODO What should these values be? + nMin = 0; + nSec = 0; + } + sal_Unicode cAmPm = ' '; // a oder p + if (rInfo.nCntExp) // AM/PM + { + if (nHour == 0) + { + nHour = 12; + cAmPm = 'a'; + } + else if (nHour < 12) + cAmPm = 'a'; + else + { + cAmPm = 'p'; + if (nHour > 12) + nHour -= 12; + } + } + const USHORT nAnz = NumFor[nIx].GetnAnz(); + for (USHORT i = 0; i < nAnz; i++) + { + switch (rInfo.nTypeArray[i]) + { + case NF_SYMBOLTYPE_CALENDAR : + if ( !aOrgCalendar.Len() ) + { + aOrgCalendar = rCal.getUniqueID(); + fOrgDateTime = rCal.getDateTime(); + } + rCal.loadCalendar( rInfo.sStrArray[i], rLoc().getLocale() ); + rCal.setDateTime( fOrgDateTime ); + ImpFallBackToGregorianCalendar( aOrgCalendar, fOrgDateTime ); + break; + case NF_SYMBOLTYPE_STAR: + if( bStarFlag ) + { + OutString += (sal_Unicode) 0x1B; + OutString += rInfo.sStrArray[i].GetChar(1); + bRes = TRUE; + } + break; + case NF_SYMBOLTYPE_BLANK: + InsertBlanks( OutString, OutString.Len(), + rInfo.sStrArray[i].GetChar(1) ); + break; + case NF_SYMBOLTYPE_STRING: + case NF_SYMBOLTYPE_CURRENCY: + case NF_SYMBOLTYPE_DATESEP: + case NF_SYMBOLTYPE_TIMESEP: + case NF_SYMBOLTYPE_TIME100SECSEP: + OutString += rInfo.sStrArray[i]; + break; + case NF_SYMBOLTYPE_DIGIT: + { + xub_StrLen nLen = ( bInputLine && i > 0 && + (rInfo.nTypeArray[i-1] == NF_SYMBOLTYPE_STRING || + rInfo.nTypeArray[i-1] == NF_SYMBOLTYPE_TIME100SECSEP) ? + nCntPost : rInfo.sStrArray[i].Len() ); + for (xub_StrLen j = 0; j < nLen && nSecPos < nCntPost; j++) + { + OutString += sSecStr.GetChar(nSecPos); + nSecPos++; + } + } + break; + case NF_KEY_AMPM: // AM/PM + { + if (cAmPm == 'a') + OutString += rCal.getDisplayName( CalendarDisplayIndex::AM_PM, + AmPmValue::AM, 0 ); + else + OutString += rCal.getDisplayName( CalendarDisplayIndex::AM_PM, + AmPmValue::PM, 0 ); + } + break; + case NF_KEY_AP: // A/P + { + if (cAmPm == 'a') + OutString += 'a'; + else + OutString += 'p'; + } + break; + case NF_KEY_MI: // M + OutString += ImpIntToString( nIx, nMin ); + break; + case NF_KEY_MMI: // MM + OutString += ImpIntToString( nIx, nMin, 2 ); + break; + case NF_KEY_H: // H + OutString += ImpIntToString( nIx, nHour ); + break; + case NF_KEY_HH: // HH + OutString += ImpIntToString( nIx, nHour, 2 ); + break; + case NF_KEY_S: // S + OutString += ImpIntToString( nIx, nSec ); + break; + case NF_KEY_SS: // SS + OutString += ImpIntToString( nIx, nSec, 2 ); + break; + case NF_KEY_M: // M + OutString += rCal.getDisplayString( + CalendarDisplayCode::SHORT_MONTH, nNatNum ); + break; + case NF_KEY_MM: // MM + OutString += rCal.getDisplayString( + CalendarDisplayCode::LONG_MONTH, nNatNum ); + break; + case NF_KEY_MMM: // MMM + OutString += rCal.getDisplayString( + CalendarDisplayCode::SHORT_MONTH_NAME, nNatNum ); + break; + case NF_KEY_MMMM: // MMMM + OutString += rCal.getDisplayString( + CalendarDisplayCode::LONG_MONTH_NAME, nNatNum ); + break; + case NF_KEY_MMMMM: // MMMMM + OutString += rCal.getDisplayString( + CalendarDisplayCode::LONG_MONTH_NAME, nNatNum ).GetChar(0); + break; + case NF_KEY_Q: // Q + OutString += rCal.getDisplayString( + CalendarDisplayCode::SHORT_QUARTER, nNatNum ); + break; + case NF_KEY_QQ: // QQ + OutString += rCal.getDisplayString( + CalendarDisplayCode::LONG_QUARTER, nNatNum ); + break; + case NF_KEY_D: // D + OutString += rCal.getDisplayString( + CalendarDisplayCode::SHORT_DAY, nNatNum ); + break; + case NF_KEY_DD: // DD + OutString += rCal.getDisplayString( + CalendarDisplayCode::LONG_DAY, nNatNum ); + break; + case NF_KEY_DDD: // DDD + { + if ( bOtherCalendar ) + SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime ); + OutString += rCal.getDisplayString( + CalendarDisplayCode::SHORT_DAY_NAME, nNatNum ); + if ( bOtherCalendar ) + SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); + } + break; + case NF_KEY_DDDD: // DDDD + { + if ( bOtherCalendar ) + SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime ); + OutString += rCal.getDisplayString( + CalendarDisplayCode::LONG_DAY_NAME, nNatNum ); + if ( bOtherCalendar ) + SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); + } + break; + case NF_KEY_YY: // YY + { + if ( bOtherCalendar ) + SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime ); + OutString += rCal.getDisplayString( + CalendarDisplayCode::SHORT_YEAR, nNatNum ); + if ( bOtherCalendar ) + SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); + } + break; + case NF_KEY_YYYY: // YYYY + { + if ( bOtherCalendar ) + SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime ); + OutString += rCal.getDisplayString( + CalendarDisplayCode::LONG_YEAR, nNatNum ); + if ( bOtherCalendar ) + SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); + } + break; + case NF_KEY_EC: // E + OutString += rCal.getDisplayString( + CalendarDisplayCode::SHORT_YEAR, nNatNum ); + break; + case NF_KEY_EEC: // EE + case NF_KEY_R: // R + OutString += rCal.getDisplayString( + CalendarDisplayCode::LONG_YEAR, nNatNum ); + break; + case NF_KEY_NN: // NN + case NF_KEY_AAA: // AAA + OutString += rCal.getDisplayString( + CalendarDisplayCode::SHORT_DAY_NAME, nNatNum ); + break; + case NF_KEY_NNN: // NNN + case NF_KEY_AAAA: // AAAA + OutString += rCal.getDisplayString( + CalendarDisplayCode::LONG_DAY_NAME, nNatNum ); + break; + case NF_KEY_NNNN: // NNNN + { + OutString += rCal.getDisplayString( + CalendarDisplayCode::LONG_DAY_NAME, nNatNum ); + OutString += rLoc().getLongDateDayOfWeekSep(); + } + break; + case NF_KEY_WW : // WW + { + sal_Int16 nVal = rCal.getValue( CalendarFieldIndex::WEEK_OF_YEAR ); + OutString += ImpIntToString( nIx, nVal ); + } + break; + case NF_KEY_G: // G + ImpAppendEraG( OutString, rCal, nNatNum ); + break; + case NF_KEY_GG: // GG + OutString += rCal.getDisplayString( + CalendarDisplayCode::SHORT_ERA, nNatNum ); + break; + case NF_KEY_GGG: // GGG + OutString += rCal.getDisplayString( + CalendarDisplayCode::LONG_ERA, nNatNum ); + break; + case NF_KEY_RR: // RR => GGGEE + OutString += rCal.getDisplayString( + CalendarDisplayCode::LONG_YEAR_AND_ERA, nNatNum ); + break; + } + } + if ( aOrgCalendar.Len() ) + rCal.loadCalendar( aOrgCalendar, rLoc().getLocale() ); // restore calendar + return bRes; +} + +BOOL SvNumberformat::ImpGetNumberOutput(double fNumber, + USHORT nIx, + String& OutString) +{ + BOOL bRes = FALSE; + BOOL bSign; + if (fNumber < 0.0) + { + if (nIx == 0) // nicht in hinteren + bSign = TRUE; // Formaten + else + bSign = FALSE; + fNumber = -fNumber; + } + else + { + bSign = FALSE; + if ( ::rtl::math::isSignBitSet( fNumber ) ) + fNumber = -fNumber; // yes, -0.0 is possible, eliminate '-' + } + const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info(); + if (rInfo.eScannedType == NUMBERFORMAT_PERCENT) + { + if (fNumber < _D_MAX_D_BY_100) + fNumber *= 100.0; + else + { + OutString = rScan.GetErrorString(); + return FALSE; + } + } + USHORT i, j; + xub_StrLen k; + String sStr; + long nPrecExp; + BOOL bInteger = FALSE; + if ( rInfo.nThousand != FLAG_STANDARD_IN_FORMAT ) + { // special formatting only if no GENERAL keyword in format code + const USHORT nThousand = rInfo.nThousand; + for (i = 0; i < nThousand; i++) + { + if (fNumber > _D_MIN_M_BY_1000) + fNumber /= 1000.0; + else + fNumber = 0.0; + } + if (fNumber > 0.0) + nPrecExp = GetPrecExp( fNumber ); + else + nPrecExp = 0; + if (rInfo.nCntPost) // NachkommaStellen + { + if (rInfo.nCntPost + nPrecExp > 15 && nPrecExp < 15) + { + sStr = ::rtl::math::doubleToUString( fNumber, + rtl_math_StringFormat_F, 15-nPrecExp, '.'); + for (long l = 15-nPrecExp; l < (long) rInfo.nCntPost; l++) + sStr += '0'; + } + else + sStr = ::rtl::math::doubleToUString( fNumber, + rtl_math_StringFormat_F, rInfo.nCntPost, '.' ); + sStr.EraseLeadingChars('0'); // fuehrende Nullen weg + } + else if (fNumber == 0.0) // Null + { + // nothing to be done here, keep empty string sStr, + // ImpNumberFillWithThousands does the rest + } + else // Integer + { + sStr = ::rtl::math::doubleToUString( fNumber, + rtl_math_StringFormat_F, 0, '.'); + sStr.EraseLeadingChars('0'); // fuehrende Nullen weg + } + xub_StrLen nPoint = sStr.Search( '.' ); + if ( nPoint != STRING_NOTFOUND ) + { + register const sal_Unicode* p = sStr.GetBuffer() + nPoint; + while ( *++p == '0' ) + ; + if ( !*p ) + bInteger = TRUE; + sStr.Erase( nPoint, 1 ); // . herausnehmen + } + if (bSign && + (sStr.Len() == 0 || sStr.GetTokenCount('0') == sStr.Len()+1)) // nur 00000 + bSign = FALSE; // nicht -0.00 + } // End of != FLAG_STANDARD_IN_FORMAT + + // von hinten nach vorn + // editieren: + k = sStr.Len(); // hinter letzter Ziffer + j = NumFor[nIx].GetnAnz()-1; // letztes Symbol + // Nachkommastellen: + if (rInfo.nCntPost > 0) + { + BOOL bTrailing = TRUE; // ob Endnullen? + BOOL bFilled = FALSE; // ob aufgefuellt wurde ? + short nType; + while (j > 0 && // rueckwaerts + (nType = rInfo.nTypeArray[j]) != NF_SYMBOLTYPE_DECSEP) + { + switch ( nType ) + { + case NF_SYMBOLTYPE_STAR: + if( bStarFlag ) + { + sStr.Insert( (sal_Unicode) 0x1B, k /*++*/ ); + sStr.Insert(rInfo.sStrArray[j].GetChar(1),k); + bRes = TRUE; + } + break; + case NF_SYMBOLTYPE_BLANK: + /*k = */ InsertBlanks( sStr,k,rInfo.sStrArray[j].GetChar(1) ); + break; + case NF_SYMBOLTYPE_STRING: + case NF_SYMBOLTYPE_CURRENCY: + case NF_SYMBOLTYPE_PERCENT: + sStr.Insert(rInfo.sStrArray[j],k); + break; + case NF_SYMBOLTYPE_THSEP: + if (rInfo.nThousand == 0) + sStr.Insert(rInfo.sStrArray[j],k); + break; + case NF_SYMBOLTYPE_DIGIT: + { + const String& rStr = rInfo.sStrArray[j]; + const sal_Unicode* p1 = rStr.GetBuffer(); + register const sal_Unicode* p = p1 + rStr.Len(); + while ( p1 < p-- ) + { + const sal_Unicode c = *p; + k--; + if ( sStr.GetChar(k) != '0' ) + bTrailing = FALSE; + if (bTrailing) + { + if ( c == '0' ) + bFilled = TRUE; + else if ( c == '-' ) + { + if ( bInteger ) + sStr.SetChar( k, '-' ); + bFilled = TRUE; + } + else if ( c == '?' ) + { + sStr.SetChar( k, ' ' ); + bFilled = TRUE; + } + else if ( !bFilled ) // # + sStr.Erase(k,1); + } + } // of for + } // of case digi + break; + case NF_KEY_CCC: // CCC-Waehrung + sStr.Insert(rScan.GetCurAbbrev(), k); + break; + case NF_KEY_GENERAL: // Standard im String + { + String sNum; + ImpGetOutputStandard(fNumber, sNum); + sNum.EraseLeadingChars('-'); + sStr.Insert(sNum, k); + } + break; + default: + break; + } // of switch + j--; + } // of while + } // of Nachkomma + + bRes |= ImpNumberFillWithThousands(sStr, fNumber, k, j, nIx, // ggfs Auffuellen mit . + rInfo.nCntPre); + if ( rInfo.nCntPost > 0 ) + { + const String& rDecSep = GetFormatter().GetNumDecimalSep(); + xub_StrLen nLen = rDecSep.Len(); + if ( sStr.Len() > nLen && sStr.Equals( rDecSep, sStr.Len() - nLen, nLen ) ) + sStr.Erase( sStr.Len() - nLen ); // no decimals => strip DecSep + } + if (bSign) + sStr.Insert('-',0); + ImpTransliterate( sStr, NumFor[nIx].GetNatNum() ); + OutString = sStr; + return bRes; +} + +BOOL SvNumberformat::ImpNumberFillWithThousands( + String& sStr, // number string + double& rNumber, // number + xub_StrLen k, // position within string + USHORT j, // symbol index within format code + USHORT nIx, // subformat index + USHORT nDigCnt) // count of integer digits in format +{ + BOOL bRes = FALSE; + xub_StrLen nLeadingStringChars = 0; // inserted StringChars before number + xub_StrLen nDigitCount = 0; // count of integer digits from the right + BOOL bStop = FALSE; + const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info(); + // no normal thousands separators if number divided by thousands + BOOL bDoThousands = (rInfo.nThousand == 0); + utl::DigitGroupingIterator aGrouping( + GetFormatter().GetLocaleData()->getDigitGrouping()); + while (!bStop) // backwards + { + if (j == 0) + bStop = TRUE; + switch (rInfo.nTypeArray[j]) + { + case NF_SYMBOLTYPE_DECSEP: + aGrouping.reset(); + // fall thru + case NF_SYMBOLTYPE_STRING: + case NF_SYMBOLTYPE_CURRENCY: + case NF_SYMBOLTYPE_PERCENT: + sStr.Insert(rInfo.sStrArray[j],k); + if ( k == 0 ) + nLeadingStringChars = + nLeadingStringChars + rInfo.sStrArray[j].Len(); + break; + case NF_SYMBOLTYPE_STAR: + if( bStarFlag ) + { + sStr.Insert( (sal_Unicode) 0x1B, k/*++*/ ); + sStr.Insert(rInfo.sStrArray[j].GetChar(1),k); + bRes = TRUE; + } + break; + case NF_SYMBOLTYPE_BLANK: + /*k = */ InsertBlanks( sStr,k,rInfo.sStrArray[j].GetChar(1) ); + break; + case NF_SYMBOLTYPE_THSEP: + { + // #i7284# #102685# Insert separator also if number is divided + // by thousands and the separator is specified somewhere in + // between and not only at the end. + // #i12596# But do not insert if it's a parenthesized negative + // format like (#,) + // In fact, do not insert if divided and regex [0#,],[^0#] and + // no other digit symbol follows (which was already detected + // during scan of format code, otherwise there would be no + // division), else do insert. Same in ImpNumberFill() below. + if ( !bDoThousands && j < NumFor[nIx].GetnAnz()-1 ) + bDoThousands = ((j == 0) || + (rInfo.nTypeArray[j-1] != NF_SYMBOLTYPE_DIGIT && + rInfo.nTypeArray[j-1] != NF_SYMBOLTYPE_THSEP) || + (rInfo.nTypeArray[j+1] == NF_SYMBOLTYPE_DIGIT)); + if ( bDoThousands ) + { + if (k > 0) + sStr.Insert(rInfo.sStrArray[j],k); + else if (nDigitCount < nDigCnt) + { + // Leading '#' displays nothing (e.g. no leading + // separator for numbers <1000 with #,##0 format). + // Leading '?' displays blank. + // Everything else, including nothing, displays the + // separator. + sal_Unicode cLeader = 0; + if (j > 0 && rInfo.nTypeArray[j-1] == NF_SYMBOLTYPE_DIGIT) + { + const String& rStr = rInfo.sStrArray[j-1]; + xub_StrLen nLen = rStr.Len(); + if (nLen) + cLeader = rStr.GetChar(nLen-1); + } + switch (cLeader) + { + case '#': + ; // nothing + break; + case '?': + // erAck: 2008-04-03T16:24+0200 + // Actually this currently isn't executed + // because the format scanner in the context of + // "?," doesn't generate a group separator but + // a literal ',' character instead that is + // inserted unconditionally. Should be changed + // on some occasion. + sStr.Insert(' ',k); + break; + default: + sStr.Insert(rInfo.sStrArray[j],k); + } + } + aGrouping.advance(); + } + } + break; + case NF_SYMBOLTYPE_DIGIT: + { + const String& rStr = rInfo.sStrArray[j]; + const sal_Unicode* p1 = rStr.GetBuffer(); + register const sal_Unicode* p = p1 + rStr.Len(); + while ( p1 < p-- ) + { + nDigitCount++; + if (k > 0) + k--; + else + { + switch (*p) + { + case '0': + sStr.Insert('0',0); + break; + case '?': + sStr.Insert(' ',0); + break; + } + } + if (nDigitCount == nDigCnt && k > 0) + { // more digits than specified + ImpDigitFill(sStr, 0, k, nIx, nDigitCount, aGrouping); + } + } + } + break; + case NF_KEY_CCC: // CCC currency + sStr.Insert(rScan.GetCurAbbrev(), k); + break; + case NF_KEY_GENERAL: // "General" in string + { + String sNum; + ImpGetOutputStandard(rNumber, sNum); + sNum.EraseLeadingChars('-'); + sStr.Insert(sNum, k); + } + break; + + default: + break; + } // switch + j--; // next format code string + } // while + k = k + nLeadingStringChars; // MSC converts += to int and then warns, so ... + if (k > nLeadingStringChars) + ImpDigitFill(sStr, nLeadingStringChars, k, nIx, nDigitCount, aGrouping); + return bRes; +} + +void SvNumberformat::ImpDigitFill( + String& sStr, // number string + xub_StrLen nStart, // start of digits + xub_StrLen& k, // position within string + USHORT nIx, // subformat index + xub_StrLen & nDigitCount, // count of integer digits from the right so far + utl::DigitGroupingIterator & rGrouping ) // current grouping +{ + if (NumFor[nIx].Info().bThousand) // only if grouping + { // fill in separators + const String& rThousandSep = GetFormatter().GetNumThousandSep(); + while (k > nStart) + { + if (nDigitCount == rGrouping.getPos()) + { + sStr.Insert( rThousandSep, k ); + rGrouping.advance(); + } + nDigitCount++; + k--; + } + } + else // simply skip + k = nStart; +} + +BOOL SvNumberformat::ImpNumberFill( String& sStr, // number string + double& rNumber, // number for "General" format + xub_StrLen& k, // position within string + USHORT& j, // symbol index within format code + USHORT nIx, // subformat index + short eSymbolType ) // type of stop condition +{ + BOOL bRes = FALSE; + k = sStr.Len(); // behind last digit + const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info(); + // no normal thousands separators if number divided by thousands + BOOL bDoThousands = (rInfo.nThousand == 0); + short nType; + while (j > 0 && (nType = rInfo.nTypeArray[j]) != eSymbolType ) + { // rueckwaerts: + switch ( nType ) + { + case NF_SYMBOLTYPE_STAR: + if( bStarFlag ) + { + sStr.Insert( sal_Unicode(0x1B), k++ ); + sStr.Insert(rInfo.sStrArray[j].GetChar(1),k); + bRes = TRUE; + } + break; + case NF_SYMBOLTYPE_BLANK: + k = InsertBlanks( sStr,k,rInfo.sStrArray[j].GetChar(1) ); + break; + case NF_SYMBOLTYPE_THSEP: + { + // Same as in ImpNumberFillWithThousands() above, do not insert + // if divided and regex [0#,],[^0#] and no other digit symbol + // follows (which was already detected during scan of format + // code, otherwise there would be no division), else do insert. + if ( !bDoThousands && j < NumFor[nIx].GetnAnz()-1 ) + bDoThousands = ((j == 0) || + (rInfo.nTypeArray[j-1] != NF_SYMBOLTYPE_DIGIT && + rInfo.nTypeArray[j-1] != NF_SYMBOLTYPE_THSEP) || + (rInfo.nTypeArray[j+1] == NF_SYMBOLTYPE_DIGIT)); + if ( bDoThousands && k > 0 ) + { + sStr.Insert(rInfo.sStrArray[j],k); + } + } + break; + case NF_SYMBOLTYPE_DIGIT: + { + const String& rStr = rInfo.sStrArray[j]; + const sal_Unicode* p1 = rStr.GetBuffer(); + register const sal_Unicode* p = p1 + rStr.Len(); + while ( p1 < p-- ) + { + if (k > 0) + k--; + else + { + switch (*p) + { + case '0': + sStr.Insert('0',0); + break; + case '?': + sStr.Insert(' ',0); + break; + } + } + } + } + break; + case NF_KEY_CCC: // CCC-Waehrung + sStr.Insert(rScan.GetCurAbbrev(), k); + break; + case NF_KEY_GENERAL: // Standard im String + { + String sNum; + ImpGetOutputStandard(rNumber, sNum); + sNum.EraseLeadingChars('-'); // Vorzeichen weg!! + sStr.Insert(sNum, k); + } + break; + + default: + sStr.Insert(rInfo.sStrArray[j],k); + break; + } // of switch + j--; // naechster String + } // of while + return bRes; +} + +void SvNumberformat::GetFormatSpecialInfo(BOOL& bThousand, + BOOL& IsRed, + USHORT& nPrecision, + USHORT& nAnzLeading) const +{ + // as before: take info from nNumFor=0 for whole format (for dialog etc.) + + short nDummyType; + GetNumForInfo( 0, nDummyType, bThousand, nPrecision, nAnzLeading ); + + // "negative in red" is only useful for the whole format + + const Color* pColor = NumFor[1].GetColor(); + if (fLimit1 == 0.0 && fLimit2 == 0.0 && pColor + && (*pColor == rScan.GetRedColor())) + IsRed = TRUE; + else + IsRed = FALSE; +} + +void SvNumberformat::GetNumForInfo( USHORT nNumFor, short& rScannedType, + BOOL& bThousand, USHORT& nPrecision, USHORT& nAnzLeading ) const +{ + // take info from a specified sub-format (for XML export) + + if ( nNumFor > 3 ) + return; // invalid + + const ImpSvNumberformatInfo& rInfo = NumFor[nNumFor].Info(); + rScannedType = rInfo.eScannedType; + bThousand = rInfo.bThousand; + nPrecision = rInfo.nCntPost; + if (bStandard && rInfo.eScannedType == NUMBERFORMAT_NUMBER) + // StandardFormat + nAnzLeading = 1; + else + { + nAnzLeading = 0; + BOOL bStop = FALSE; + USHORT i = 0; + const USHORT nAnz = NumFor[nNumFor].GetnAnz(); + while (!bStop && i < nAnz) + { + short nType = rInfo.nTypeArray[i]; + if ( nType == NF_SYMBOLTYPE_DIGIT) + { + register const sal_Unicode* p = rInfo.sStrArray[i].GetBuffer(); + while ( *p == '#' ) + p++; + while ( *p++ == '0' ) + nAnzLeading++; + } + else if (nType == NF_SYMBOLTYPE_DECSEP || nType == NF_SYMBOLTYPE_EXP) + bStop = TRUE; + i++; + } + } +} + +const String* SvNumberformat::GetNumForString( USHORT nNumFor, USHORT nPos, + BOOL bString /* = FALSE */ ) const +{ + if ( nNumFor > 3 ) + return NULL; + USHORT nAnz = NumFor[nNumFor].GetnAnz(); + if ( !nAnz ) + return NULL; + if ( nPos == 0xFFFF ) + { + nPos = nAnz - 1; + if ( bString ) + { // rueckwaerts + short* pType = NumFor[nNumFor].Info().nTypeArray + nPos; + while ( nPos > 0 && (*pType != NF_SYMBOLTYPE_STRING) && + (*pType != NF_SYMBOLTYPE_CURRENCY) ) + { + pType--; + nPos--; + } + if ( (*pType != NF_SYMBOLTYPE_STRING) && (*pType != NF_SYMBOLTYPE_CURRENCY) ) + return NULL; + } + } + else if ( nPos > nAnz - 1 ) + return NULL; + else if ( bString ) + { // vorwaerts + short* pType = NumFor[nNumFor].Info().nTypeArray + nPos; + while ( nPos < nAnz && (*pType != NF_SYMBOLTYPE_STRING) && + (*pType != NF_SYMBOLTYPE_CURRENCY) ) + { + pType++; + nPos++; + } + if ( nPos >= nAnz || ((*pType != NF_SYMBOLTYPE_STRING) && + (*pType != NF_SYMBOLTYPE_CURRENCY)) ) + return NULL; + } + return &NumFor[nNumFor].Info().sStrArray[nPos]; +} + + +short SvNumberformat::GetNumForType( USHORT nNumFor, USHORT nPos, + BOOL bString /* = FALSE */ ) const +{ + if ( nNumFor > 3 ) + return 0; + USHORT nAnz = NumFor[nNumFor].GetnAnz(); + if ( !nAnz ) + return 0; + if ( nPos == 0xFFFF ) + { + nPos = nAnz - 1; + if ( bString ) + { // rueckwaerts + short* pType = NumFor[nNumFor].Info().nTypeArray + nPos; + while ( nPos > 0 && (*pType != NF_SYMBOLTYPE_STRING) && + (*pType != NF_SYMBOLTYPE_CURRENCY) ) + { + pType--; + nPos--; + } + if ( (*pType != NF_SYMBOLTYPE_STRING) && (*pType != NF_SYMBOLTYPE_CURRENCY) ) + return 0; + } + } + else if ( nPos > nAnz - 1 ) + return 0; + else if ( bString ) + { // vorwaerts + short* pType = NumFor[nNumFor].Info().nTypeArray + nPos; + while ( nPos < nAnz && (*pType != NF_SYMBOLTYPE_STRING) && + (*pType != NF_SYMBOLTYPE_CURRENCY) ) + { + pType++; + nPos++; + } + if ( (*pType != NF_SYMBOLTYPE_STRING) && (*pType != NF_SYMBOLTYPE_CURRENCY) ) + return 0; + } + return NumFor[nNumFor].Info().nTypeArray[nPos]; +} + + +BOOL SvNumberformat::IsNegativeWithoutSign() const +{ + if ( IsNegativeRealNegative() ) + { + const String* pStr = GetNumForString( 1, 0, TRUE ); + if ( pStr ) + return !HasStringNegativeSign( *pStr ); + } + return FALSE; +} + + +DateFormat SvNumberformat::GetDateOrder() const +{ + if ( (eType & NUMBERFORMAT_DATE) == NUMBERFORMAT_DATE ) + { + short const * const pType = NumFor[0].Info().nTypeArray; + USHORT nAnz = NumFor[0].GetnAnz(); + for ( USHORT j=0; j 3 ) + return NULL; + + return NumFor[nNumFor].GetColor(); +} + + +void lcl_SvNumberformat_AddLimitStringImpl( String& rStr, + SvNumberformatLimitOps eOp, double fLimit, const String& rDecSep ) +{ + if ( eOp != NUMBERFORMAT_OP_NO ) + { + switch ( eOp ) + { + case NUMBERFORMAT_OP_EQ : + rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "[=" ) ); + break; + case NUMBERFORMAT_OP_NE : + rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "[<>" ) ); + break; + case NUMBERFORMAT_OP_LT : + rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "[<" ) ); + break; + case NUMBERFORMAT_OP_LE : + rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "[<=" ) ); + break; + case NUMBERFORMAT_OP_GT : + rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "[>" ) ); + break; + case NUMBERFORMAT_OP_GE : + rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "[>=" ) ); + break; + default: + OSL_ASSERT( "unsupported number format" ); + break; + } + rStr += String( ::rtl::math::doubleToUString( fLimit, + rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, + rDecSep.GetChar(0), sal_True)); + rStr += ']'; + } +} + + +String SvNumberformat::GetMappedFormatstring( + const NfKeywordTable& rKeywords, const LocaleDataWrapper& rLocWrp, + BOOL bDontQuote ) const +{ + String aStr; + BOOL bDefault[4]; + // 1 subformat matches all if no condition specified, + bDefault[0] = ( NumFor[1].GetnAnz() == 0 && eOp1 == NUMBERFORMAT_OP_NO ); + // with 2 subformats [>=0];[<0] is implied if no condition specified + bDefault[1] = ( !bDefault[0] && NumFor[2].GetnAnz() == 0 && + eOp1 == NUMBERFORMAT_OP_GE && fLimit1 == 0.0 && + eOp2 == NUMBERFORMAT_OP_NO && fLimit2 == 0.0 ); + // with 3 or more subformats [>0];[<0];[=0] is implied if no condition specified, + // note that subformats may be empty (;;;) and NumFor[2].GetnAnz()>0 is not checked. + bDefault[2] = ( !bDefault[0] && !bDefault[1] && + eOp1 == NUMBERFORMAT_OP_GT && fLimit1 == 0.0 && + eOp2 == NUMBERFORMAT_OP_LT && fLimit2 == 0.0 ); + BOOL bDefaults = bDefault[0] || bDefault[1] || bDefault[2]; + // from now on bDefault[] values are used to append empty subformats at the end + bDefault[3] = FALSE; + if ( !bDefaults ) + { // conditions specified + if ( eOp1 != NUMBERFORMAT_OP_NO && eOp2 == NUMBERFORMAT_OP_NO ) + bDefault[0] = bDefault[1] = TRUE; // [];x + else if ( eOp1 != NUMBERFORMAT_OP_NO && eOp2 != NUMBERFORMAT_OP_NO && + NumFor[2].GetnAnz() == 0 ) + bDefault[0] = bDefault[1] = bDefault[2] = bDefault[3] = TRUE; // [];[];; + // nothing to do if conditions specified for every subformat + } + else if ( bDefault[0] ) + bDefault[0] = FALSE; // a single unconditional subformat is never delimited + else + { + if ( bDefault[2] && NumFor[2].GetnAnz() == 0 && NumFor[1].GetnAnz() > 0 ) + bDefault[3] = TRUE; // special cases x;x;; and ;x;; + for ( int i=0; i<3 && !bDefault[i]; ++i ) + bDefault[i] = TRUE; + } + int nSem = 0; // needed ';' delimiters + int nSub = 0; // subformats delimited so far + for ( int n=0; n<4; n++ ) + { + if ( n > 0 ) + nSem++; + + String aPrefix; + + if ( !bDefaults ) + { + switch ( n ) + { + case 0 : + lcl_SvNumberformat_AddLimitStringImpl( aPrefix, eOp1, + fLimit1, rLocWrp.getNumDecimalSep() ); + break; + case 1 : + lcl_SvNumberformat_AddLimitStringImpl( aPrefix, eOp2, + fLimit2, rLocWrp.getNumDecimalSep() ); + break; + } + } + + const String& rColorName = NumFor[n].GetColorName(); + if ( rColorName.Len() ) + { + const String* pKey = rScan.GetKeywords() + NF_KEY_FIRSTCOLOR; + for ( int j=NF_KEY_FIRSTCOLOR; j<=NF_KEY_LASTCOLOR; j++, pKey++ ) + { + if ( *pKey == rColorName ) + { + aPrefix += '['; + aPrefix += rKeywords[j]; + aPrefix += ']'; + break; // for + } + } + } + + const SvNumberNatNum& rNum = NumFor[n].GetNatNum(); + // The Thai T NatNum modifier during Xcl export. + if (rNum.IsSet() && rNum.GetNatNum() == 1 && + rKeywords[NF_KEY_THAI_T].EqualsAscii( "T") && + MsLangId::getRealLanguage( rNum.GetLang()) == + LANGUAGE_THAI) + { + aPrefix += 't'; // must be lowercase, otherwise taken as literal + } + + USHORT nAnz = NumFor[n].GetnAnz(); + if ( nSem && (nAnz || aPrefix.Len()) ) + { + for ( ; nSem; --nSem ) + aStr += ';'; + for ( ; nSub <= n; ++nSub ) + bDefault[nSub] = FALSE; + } + + if ( aPrefix.Len() ) + aStr += aPrefix; + + if ( nAnz ) + { + const short* pType = NumFor[n].Info().nTypeArray; + const String* pStr = NumFor[n].Info().sStrArray; + for ( USHORT j=0; j= nMinDigits ) + aStr = aValStr; + else + { + aStr.Fill( nMinDigits - aValStr.Len(), '0' ); + aStr += aValStr; + } + } + } + else + aStr = String::CreateFromInt32( nVal ); + ImpTransliterate( aStr, rNum ); + return aStr; +} + + +void SvNumberformat::ImpTransliterateImpl( String& rStr, + const SvNumberNatNum& rNum ) const +{ + com::sun::star::lang::Locale aLocale( + MsLangId::convertLanguageToLocale( rNum.GetLang() ) ); + rStr = GetFormatter().GetNatNum()->getNativeNumberString( rStr, + aLocale, rNum.GetNatNum() ); +} + + +void SvNumberformat::GetNatNumXml( + com::sun::star::i18n::NativeNumberXmlAttributes& rAttr, + USHORT nNumFor ) const +{ + if ( nNumFor <= 3 ) + { + const SvNumberNatNum& rNum = NumFor[nNumFor].GetNatNum(); + if ( rNum.IsSet() ) + { + com::sun::star::lang::Locale aLocale( + MsLangId::convertLanguageToLocale( rNum.GetLang() ) ); + rAttr = GetFormatter().GetNatNum()->convertToXmlAttributes( + aLocale, rNum.GetNatNum() ); + } + else + rAttr = com::sun::star::i18n::NativeNumberXmlAttributes(); + } + else + rAttr = com::sun::star::i18n::NativeNumberXmlAttributes(); +} + +// static +BOOL SvNumberformat::HasStringNegativeSign( const String& rStr ) +{ + // fuer Sign muss '-' am Anfang oder am Ende des TeilStrings sein (Blanks ignored) + xub_StrLen nLen = rStr.Len(); + if ( !nLen ) + return FALSE; + const sal_Unicode* const pBeg = rStr.GetBuffer(); + const sal_Unicode* const pEnd = pBeg + nLen; + register const sal_Unicode* p = pBeg; + do + { // Anfang + if ( *p == '-' ) + return TRUE; + } while ( *p == ' ' && ++p < pEnd ); + p = pEnd - 1; + do + { // Ende + if ( *p == '-' ) + return TRUE; + } while ( *p == ' ' && pBeg < --p ); + return FALSE; +} + + +// static +void SvNumberformat::SetComment( const String& rStr, String& rFormat, + String& rComment ) +{ + if ( rComment.Len() ) + { // alten Kommentar aus Formatstring loeschen + //! nicht per EraseComment, der Kommentar muss matchen + String aTmp( '{' ); + aTmp += ' '; + aTmp += rComment; + aTmp += ' '; + aTmp += '}'; + xub_StrLen nCom = 0; + do + { + nCom = rFormat.Search( aTmp, nCom ); + } while ( (nCom != STRING_NOTFOUND) && (nCom + aTmp.Len() != rFormat.Len()) ); + if ( nCom != STRING_NOTFOUND ) + rFormat.Erase( nCom ); + } + if ( rStr.Len() ) + { // neuen Kommentar setzen + rFormat += '{'; + rFormat += ' '; + rFormat += rStr; + rFormat += ' '; + rFormat += '}'; + rComment = rStr; + } +} + + +// static +void SvNumberformat::EraseCommentBraces( String& rStr ) +{ + xub_StrLen nLen = rStr.Len(); + if ( nLen && rStr.GetChar(0) == '{' ) + { + rStr.Erase( 0, 1 ); + --nLen; + } + if ( nLen && rStr.GetChar(0) == ' ' ) + { + rStr.Erase( 0, 1 ); + --nLen; + } + if ( nLen && rStr.GetChar( nLen-1 ) == '}' ) + rStr.Erase( --nLen, 1 ); + if ( nLen && rStr.GetChar( nLen-1 ) == ' ' ) + rStr.Erase( --nLen, 1 ); +} + + +// static +void SvNumberformat::EraseComment( String& rStr ) +{ + register const sal_Unicode* p = rStr.GetBuffer(); + BOOL bInString = FALSE; + BOOL bEscaped = FALSE; + BOOL bFound = FALSE; + xub_StrLen nPos = 0; + while ( !bFound && *p ) + { + switch ( *p ) + { + case '\\' : + bEscaped = !bEscaped; + break; + case '\"' : + if ( !bEscaped ) + bInString = !bInString; + break; + case '{' : + if ( !bEscaped && !bInString ) + { + bFound = TRUE; + nPos = sal::static_int_cast< xub_StrLen >( + p - rStr.GetBuffer()); + } + break; + } + if ( bEscaped && *p != '\\' ) + bEscaped = FALSE; + ++p; + } + if ( bFound ) + rStr.Erase( nPos ); +} + + +// static +BOOL SvNumberformat::IsInQuote( const String& rStr, xub_StrLen nPos, + sal_Unicode cQuote, sal_Unicode cEscIn, sal_Unicode cEscOut ) +{ + xub_StrLen nLen = rStr.Len(); + if ( nPos >= nLen ) + return FALSE; + register const sal_Unicode* p0 = rStr.GetBuffer(); + register const sal_Unicode* p = p0; + register const sal_Unicode* p1 = p0 + nPos; + BOOL bQuoted = FALSE; + while ( p <= p1 ) + { + if ( *p == cQuote ) + { + if ( p == p0 ) + bQuoted = TRUE; + else if ( bQuoted ) + { + if ( *(p-1) != cEscIn ) + bQuoted = FALSE; + } + else + { + if ( *(p-1) != cEscOut ) + bQuoted = TRUE; + } + } + p++; + } + return bQuoted; +} + + +// static +xub_StrLen SvNumberformat::GetQuoteEnd( const String& rStr, xub_StrLen nPos, + sal_Unicode cQuote, sal_Unicode cEscIn, sal_Unicode cEscOut ) +{ + xub_StrLen nLen = rStr.Len(); + if ( nPos >= nLen ) + return STRING_NOTFOUND; + if ( !IsInQuote( rStr, nPos, cQuote, cEscIn, cEscOut ) ) + { + if ( rStr.GetChar( nPos ) == cQuote ) + return nPos; // schliessendes cQuote + return STRING_NOTFOUND; + } + register const sal_Unicode* p0 = rStr.GetBuffer(); + register const sal_Unicode* p = p0 + nPos; + register const sal_Unicode* p1 = p0 + nLen; + while ( p < p1 ) + { + if ( *p == cQuote && p > p0 && *(p-1) != cEscIn ) + return sal::static_int_cast< xub_StrLen >(p - p0); + p++; + } + return nLen; // String Ende +} + + +USHORT SvNumberformat::ImpGetNumForStringElementCount( USHORT nNumFor ) const +{ + USHORT nCnt = 0; + USHORT nAnz = NumFor[nNumFor].GetnAnz(); + short const * const pType = NumFor[nNumFor].Info().nTypeArray; + for ( USHORT j=0; j + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#ifndef GCC +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define _ZFORSCAN_CXX +#include "zforscan.hxx" +#undef _ZFORSCAN_CXX +#include "nfsymbol.hxx" +using namespace svt; + +const sal_Unicode cNonBreakingSpace = 0xA0; + +namespace +{ + struct ImplEnglishColors + { + const String* operator()() + { + static const String aEnglishColors[NF_MAX_DEFAULT_COLORS] = + { + String( RTL_CONSTASCII_USTRINGPARAM( "BLACK" ) ), + String( RTL_CONSTASCII_USTRINGPARAM( "BLUE" ) ), + String( RTL_CONSTASCII_USTRINGPARAM( "GREEN" ) ), + String( RTL_CONSTASCII_USTRINGPARAM( "CYAN" ) ), + String( RTL_CONSTASCII_USTRINGPARAM( "RED" ) ), + String( RTL_CONSTASCII_USTRINGPARAM( "MAGENTA" ) ), + String( RTL_CONSTASCII_USTRINGPARAM( "BROWN" ) ), + String( RTL_CONSTASCII_USTRINGPARAM( "GREY" ) ), + String( RTL_CONSTASCII_USTRINGPARAM( "YELLOW" ) ), + String( RTL_CONSTASCII_USTRINGPARAM( "WHITE" ) ) + }; + return &aEnglishColors[0]; + } + }; + + struct theEnglishColors + : public rtl::StaticAggregate< const String, ImplEnglishColors> {}; + +} + +ImpSvNumberformatScan::ImpSvNumberformatScan( SvNumberFormatter* pFormatterP ) +{ + pFormatter = pFormatterP; + bConvertMode = FALSE; + //! All keywords MUST be UPPERCASE! + sKeyword[NF_KEY_E].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "E" ) ); // Exponent + sKeyword[NF_KEY_AMPM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "AM/PM" ) ); // AM/PM + sKeyword[NF_KEY_AP].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "A/P" ) ); // AM/PM short + sKeyword[NF_KEY_MI].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "M" ) ); // Minute + sKeyword[NF_KEY_MMI].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MM" ) ); // Minute 02 + sKeyword[NF_KEY_S].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "S" ) ); // Second + sKeyword[NF_KEY_SS].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "SS" ) ); // Second 02 + sKeyword[NF_KEY_Q].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Q" ) ); // Quarter short 'Q' + sKeyword[NF_KEY_QQ].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "QQ" ) ); // Quarter long + sKeyword[NF_KEY_NN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "NN" ) ); // Day of week short + sKeyword[NF_KEY_NNN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "NNN" ) ); // Day of week long + sKeyword[NF_KEY_NNNN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "NNNN" ) ); // Day of week long incl. separator + sKeyword[NF_KEY_WW].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "WW" ) ); // Week of year + sKeyword[NF_KEY_CCC].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "CCC" ) ); // Currency abbreviation + bKeywordsNeedInit = TRUE; // locale dependent keywords + bCompatCurNeedInit = TRUE; // locale dependent compatibility currency strings + + StandardColor[0] = Color(COL_BLACK); + StandardColor[1] = Color(COL_LIGHTBLUE); + StandardColor[2] = Color(COL_LIGHTGREEN); + StandardColor[3] = Color(COL_LIGHTCYAN); + StandardColor[4] = Color(COL_LIGHTRED); + StandardColor[5] = Color(COL_LIGHTMAGENTA); + StandardColor[6] = Color(COL_BROWN); + StandardColor[7] = Color(COL_GRAY); + StandardColor[8] = Color(COL_YELLOW); + StandardColor[9] = Color(COL_WHITE); + + pNullDate = new Date(30,12,1899); + nStandardPrec = 2; + + sErrStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "###" ) ); + Reset(); +} + +ImpSvNumberformatScan::~ImpSvNumberformatScan() +{ + delete pNullDate; + Reset(); +} + + +void ImpSvNumberformatScan::ChangeIntl() +{ + bKeywordsNeedInit = TRUE; + bCompatCurNeedInit = TRUE; + // may be initialized by InitSpecialKeyword() + sKeyword[NF_KEY_TRUE].Erase(); + sKeyword[NF_KEY_FALSE].Erase(); +} + + +void ImpSvNumberformatScan::InitSpecialKeyword( NfKeywordIndex eIdx ) const +{ + switch ( eIdx ) + { + case NF_KEY_TRUE : + ((ImpSvNumberformatScan*)this)->sKeyword[NF_KEY_TRUE] = + pFormatter->GetCharClass()->upper( + pFormatter->GetLocaleData()->getTrueWord() ); + if ( !sKeyword[NF_KEY_TRUE].Len() ) + { + DBG_ERRORFILE( "InitSpecialKeyword: TRUE_WORD?" ); + ((ImpSvNumberformatScan*)this)->sKeyword[NF_KEY_TRUE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "TRUE" ) ); + } + break; + case NF_KEY_FALSE : + ((ImpSvNumberformatScan*)this)->sKeyword[NF_KEY_FALSE] = + pFormatter->GetCharClass()->upper( + pFormatter->GetLocaleData()->getFalseWord() ); + if ( !sKeyword[NF_KEY_FALSE].Len() ) + { + DBG_ERRORFILE( "InitSpecialKeyword: FALSE_WORD?" ); + ((ImpSvNumberformatScan*)this)->sKeyword[NF_KEY_FALSE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "FALSE" ) ); + } + break; + default: + DBG_ERRORFILE( "InitSpecialKeyword: unknown request" ); + } +} + + +void ImpSvNumberformatScan::InitCompatCur() const +{ + ImpSvNumberformatScan* pThis = (ImpSvNumberformatScan*)this; + // currency symbol for old style ("automatic") compatibility format codes + pFormatter->GetCompatibilityCurrency( pThis->sCurSymbol, pThis->sCurAbbrev ); + // currency symbol upper case + pThis->sCurString = pFormatter->GetCharClass()->upper( sCurSymbol ); + bCompatCurNeedInit = FALSE; +} + + +void ImpSvNumberformatScan::InitKeywords() const +{ + if ( !bKeywordsNeedInit ) + return ; + ((ImpSvNumberformatScan*)this)->SetDependentKeywords(); + bKeywordsNeedInit = FALSE; +} + + +/** Extract the name of General, Standard, Whatever, ignoring leading modifiers + such as [NatNum1]. */ +static String lcl_extractStandardGeneralName( const ::rtl::OUString & rCode ) +{ + String aStr; + const sal_Unicode* p = rCode.getStr(); + const sal_Unicode* const pStop = p + rCode.getLength(); + const sal_Unicode* pBeg = p; // name begins here + bool bMod = false; + bool bDone = false; + while (p < pStop && !bDone) + { + switch (*p) + { + case '[': + bMod = true; + break; + case ']': + if (bMod) + { + bMod = false; + pBeg = p+1; + } + // else: would be a locale data error, easily to be spotted in + // UI dialog + break; + case ';': + if (!bMod) + { + bDone = true; + --p; // put back, increment by one follows + } + break; + } + ++p; + if (bMod) + pBeg = p; + } + if (pBeg < p) + aStr = rCode.copy( pBeg - rCode.getStr(), p - pBeg); + return aStr; +} + + +void ImpSvNumberformatScan::SetDependentKeywords() +{ + using namespace ::com::sun::star; + using namespace ::com::sun::star::uno; + + const CharClass* pCharClass = pFormatter->GetCharClass(); + const LocaleDataWrapper* pLocaleData = pFormatter->GetLocaleData(); + // #80023# be sure to generate keywords for the loaded Locale, not for the + // requested Locale, otherwise number format codes might not match + lang::Locale aLoadedLocale = pLocaleData->getLoadedLocale(); + LanguageType eLang = MsLangId::convertLocaleToLanguage( aLoadedLocale ); + NumberFormatCodeWrapper aNumberFormatCode( pFormatter->GetServiceManager(), aLoadedLocale ); + + i18n::NumberFormatCode aFormat = aNumberFormatCode.getFormatCode( NF_NUMBER_STANDARD ); + sNameStandardFormat = lcl_extractStandardGeneralName( aFormat.Code); + sKeyword[NF_KEY_GENERAL] = pCharClass->upper( sNameStandardFormat ); + + // preset new calendar keywords + sKeyword[NF_KEY_AAA].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "AAA" ) ); + sKeyword[NF_KEY_AAAA].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "AAAA" ) ); + sKeyword[NF_KEY_EC].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "E" ) ); + sKeyword[NF_KEY_EEC].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "EE" ) ); + sKeyword[NF_KEY_G].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "G" ) ); + sKeyword[NF_KEY_GG].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GG" ) ); + sKeyword[NF_KEY_GGG].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GGG" ) ); + sKeyword[NF_KEY_R].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "R" ) ); + sKeyword[NF_KEY_RR].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "RR" ) ); + + // Thai T NatNum special. Other locale's small letter 't' results in upper + // case comparison not matching but length does in conversion mode. Ugly. + if (eLang == LANGUAGE_THAI) + sKeyword[NF_KEY_THAI_T].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "T")); + else + sKeyword[NF_KEY_THAI_T].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "t")); + + switch ( eLang ) + { + case LANGUAGE_GERMAN: + case LANGUAGE_GERMAN_SWISS: + case LANGUAGE_GERMAN_AUSTRIAN: + case LANGUAGE_GERMAN_LUXEMBOURG: + case LANGUAGE_GERMAN_LIECHTENSTEIN: + { + //! all capital letters + sKeyword[NF_KEY_M].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "M" ) ); // month 1 + sKeyword[NF_KEY_MM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MM" ) ); // month 01 + sKeyword[NF_KEY_MMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MMM" ) ); // month Jan + sKeyword[NF_KEY_MMMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MMMM" ) ); // month Januar + sKeyword[NF_KEY_MMMMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MMMMM" ) );// month J + sKeyword[NF_KEY_H].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "H" ) ); // hour 2 + sKeyword[NF_KEY_HH].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "HH" ) ); // hour 02 + sKeyword[NF_KEY_D].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "T" ) ); + sKeyword[NF_KEY_DD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "TT" ) ); + sKeyword[NF_KEY_DDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "TTT" ) ); + sKeyword[NF_KEY_DDDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "TTTT" ) ); + sKeyword[NF_KEY_YY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJ" ) ); + sKeyword[NF_KEY_YYYY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJJJ" ) ); + sKeyword[NF_KEY_BOOLEAN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "LOGISCH" ) ); + sKeyword[NF_KEY_COLOR].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "FARBE" ) ); + sKeyword[NF_KEY_BLACK].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "SCHWARZ" ) ); + sKeyword[NF_KEY_BLUE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "BLAU" ) ); + sKeyword[NF_KEY_GREEN] = UniString( "GR" "\xDC" "N", RTL_TEXTENCODING_ISO_8859_1 ); + sKeyword[NF_KEY_CYAN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "CYAN" ) ); + sKeyword[NF_KEY_RED].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "ROT" ) ); + sKeyword[NF_KEY_MAGENTA].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MAGENTA" ) ); + sKeyword[NF_KEY_BROWN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "BRAUN" ) ); + sKeyword[NF_KEY_GREY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GRAU" ) ); + sKeyword[NF_KEY_YELLOW].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GELB" ) ); + sKeyword[NF_KEY_WHITE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "WEISS" ) ); + } + break; + default: + { + // day + switch ( eLang ) + { + case LANGUAGE_ITALIAN : + case LANGUAGE_ITALIAN_SWISS : + sKeyword[NF_KEY_D].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "G" ) ); + sKeyword[NF_KEY_DD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GG" ) ); + sKeyword[NF_KEY_DDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GGG" ) ); + sKeyword[NF_KEY_DDDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GGGG" ) ); + // must exchange the era code, same as Xcl + sKeyword[NF_KEY_G].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "X" ) ); + sKeyword[NF_KEY_GG].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "XX" ) ); + sKeyword[NF_KEY_GGG].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "XXX" ) ); + break; + case LANGUAGE_FRENCH : + case LANGUAGE_FRENCH_BELGIAN : + case LANGUAGE_FRENCH_CANADIAN : + case LANGUAGE_FRENCH_SWISS : + case LANGUAGE_FRENCH_LUXEMBOURG : + case LANGUAGE_FRENCH_MONACO : + sKeyword[NF_KEY_D].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "J" ) ); + sKeyword[NF_KEY_DD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJ" ) ); + sKeyword[NF_KEY_DDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJJ" ) ); + sKeyword[NF_KEY_DDDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJJJ" ) ); + break; + case LANGUAGE_FINNISH : + sKeyword[NF_KEY_D].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "P" ) ); + sKeyword[NF_KEY_DD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "PP" ) ); + sKeyword[NF_KEY_DDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "PPP" ) ); + sKeyword[NF_KEY_DDDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "PPPP" ) ); + break; + default: + sKeyword[NF_KEY_D].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "D" ) ); + sKeyword[NF_KEY_DD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "DD" ) ); + sKeyword[NF_KEY_DDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "DDD" ) ); + sKeyword[NF_KEY_DDDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "DDDD" ) ); + } + // month + switch ( eLang ) + { + case LANGUAGE_FINNISH : + sKeyword[NF_KEY_M].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "K" ) ); + sKeyword[NF_KEY_MM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "KK" ) ); + sKeyword[NF_KEY_MMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "KKK" ) ); + sKeyword[NF_KEY_MMMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "KKKK" ) ); + sKeyword[NF_KEY_MMMMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "KKKKK" ) ); + break; + default: + sKeyword[NF_KEY_M].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "M" ) ); + sKeyword[NF_KEY_MM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MM" ) ); + sKeyword[NF_KEY_MMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MMM" ) ); + sKeyword[NF_KEY_MMMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MMMM" ) ); + sKeyword[NF_KEY_MMMMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MMMMM" ) ); + } + // year + switch ( eLang ) + { + case LANGUAGE_ITALIAN : + case LANGUAGE_ITALIAN_SWISS : + case LANGUAGE_FRENCH : + case LANGUAGE_FRENCH_BELGIAN : + case LANGUAGE_FRENCH_CANADIAN : + case LANGUAGE_FRENCH_SWISS : + case LANGUAGE_FRENCH_LUXEMBOURG : + case LANGUAGE_FRENCH_MONACO : + case LANGUAGE_PORTUGUESE : + case LANGUAGE_PORTUGUESE_BRAZILIAN : + case LANGUAGE_SPANISH_MODERN : + case LANGUAGE_SPANISH_DATED : + case LANGUAGE_SPANISH_MEXICAN : + case LANGUAGE_SPANISH_GUATEMALA : + case LANGUAGE_SPANISH_COSTARICA : + case LANGUAGE_SPANISH_PANAMA : + case LANGUAGE_SPANISH_DOMINICAN_REPUBLIC : + case LANGUAGE_SPANISH_VENEZUELA : + case LANGUAGE_SPANISH_COLOMBIA : + case LANGUAGE_SPANISH_PERU : + case LANGUAGE_SPANISH_ARGENTINA : + case LANGUAGE_SPANISH_ECUADOR : + case LANGUAGE_SPANISH_CHILE : + case LANGUAGE_SPANISH_URUGUAY : + case LANGUAGE_SPANISH_PARAGUAY : + case LANGUAGE_SPANISH_BOLIVIA : + case LANGUAGE_SPANISH_EL_SALVADOR : + case LANGUAGE_SPANISH_HONDURAS : + case LANGUAGE_SPANISH_NICARAGUA : + case LANGUAGE_SPANISH_PUERTO_RICO : + sKeyword[NF_KEY_YY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "AA" ) ); + sKeyword[NF_KEY_YYYY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "AAAA" ) ); + // must exchange the day of week name code, same as Xcl + sKeyword[NF_KEY_AAA].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "OOO" ) ); + sKeyword[NF_KEY_AAAA].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "OOOO" ) ); + break; + case LANGUAGE_DUTCH : + case LANGUAGE_DUTCH_BELGIAN : + sKeyword[NF_KEY_YY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJ" ) ); + sKeyword[NF_KEY_YYYY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJJJ" ) ); + break; + case LANGUAGE_FINNISH : + sKeyword[NF_KEY_YY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "VV" ) ); + sKeyword[NF_KEY_YYYY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "VVVV" ) ); + break; + default: + sKeyword[NF_KEY_YY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "YY" ) ); + sKeyword[NF_KEY_YYYY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "YYYY" ) ); + } + // hour + switch ( eLang ) + { + case LANGUAGE_DUTCH : + case LANGUAGE_DUTCH_BELGIAN : + sKeyword[NF_KEY_H].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "U" ) ); + sKeyword[NF_KEY_HH].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "UU" ) ); + break; + case LANGUAGE_FINNISH : + case LANGUAGE_SWEDISH : + case LANGUAGE_SWEDISH_FINLAND : + case LANGUAGE_DANISH : + case LANGUAGE_NORWEGIAN : + case LANGUAGE_NORWEGIAN_BOKMAL : + case LANGUAGE_NORWEGIAN_NYNORSK : + sKeyword[NF_KEY_H].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "T" ) ); + sKeyword[NF_KEY_HH].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "TT" ) ); + break; + default: + sKeyword[NF_KEY_H].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "H" ) ); + sKeyword[NF_KEY_HH].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "HH" ) ); + } + // boolean + sKeyword[NF_KEY_BOOLEAN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "BOOLEAN" ) ); + // colours + sKeyword[NF_KEY_COLOR].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "COLOR" ) ); + sKeyword[NF_KEY_BLACK].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "BLACK" ) ); + sKeyword[NF_KEY_BLUE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "BLUE" ) ); + sKeyword[NF_KEY_GREEN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GREEN" ) ); + sKeyword[NF_KEY_CYAN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "CYAN" ) ); + sKeyword[NF_KEY_RED].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "RED" ) ); + sKeyword[NF_KEY_MAGENTA].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MAGENTA" ) ); + sKeyword[NF_KEY_BROWN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "BROWN" ) ); + sKeyword[NF_KEY_GREY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GREY" ) ); + sKeyword[NF_KEY_YELLOW].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "YELLOW" ) ); + sKeyword[NF_KEY_WHITE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "WHITE" ) ); + } + break; + } + + // boolean keyords + InitSpecialKeyword( NF_KEY_TRUE ); + InitSpecialKeyword( NF_KEY_FALSE ); + + // compatibility currency strings + InitCompatCur(); +} + + +void ImpSvNumberformatScan::ChangeNullDate(USHORT nDay, USHORT nMonth, USHORT nYear) +{ + if ( pNullDate ) + *pNullDate = Date(nDay, nMonth, nYear); + else + pNullDate = new Date(nDay, nMonth, nYear); +} + +void ImpSvNumberformatScan::ChangeStandardPrec(short nPrec) +{ + nStandardPrec = nPrec; +} + +Color* ImpSvNumberformatScan::GetColor(String& sStr) +{ + String sString = pFormatter->GetCharClass()->upper(sStr); + const String* pKeyword = GetKeywords(); + size_t i = 0; + while (i < NF_MAX_DEFAULT_COLORS && + sString != pKeyword[NF_KEY_FIRSTCOLOR+i] ) + i++; + if ( i >= NF_MAX_DEFAULT_COLORS ) + { + const String* pEnglishColors = theEnglishColors::get(); + size_t j = 0; + while ( j < NF_MAX_DEFAULT_COLORS && + sString != pEnglishColors[j] ) + ++j; + if ( j < NF_MAX_DEFAULT_COLORS ) + i = j; + } + + Color* pResult = NULL; + if (i >= NF_MAX_DEFAULT_COLORS) + { + const String& rColorWord = pKeyword[NF_KEY_COLOR]; + xub_StrLen nPos = sString.Match(rColorWord); + if (nPos > 0) + { + sStr.Erase(0, nPos); + sStr.EraseLeadingChars(); + sStr.EraseTrailingChars(); + if (bConvertMode) + { + pFormatter->ChangeIntl(eNewLnge); + sStr.Insert( GetKeywords()[NF_KEY_COLOR], 0 ); // Color -> FARBE + pFormatter->ChangeIntl(eTmpLnge); + } + else + sStr.Insert(rColorWord,0); + sString.Erase(0, nPos); + sString.EraseLeadingChars(); + sString.EraseTrailingChars(); + + if ( CharClass::isAsciiNumeric( sString ) ) + { + long nIndex = sString.ToInt32(); + if (nIndex > 0 && nIndex <= 64) + pResult = pFormatter->GetUserDefColor((USHORT)nIndex-1); + } + } + } + else + { + sStr.Erase(); + if (bConvertMode) + { + pFormatter->ChangeIntl(eNewLnge); + sStr = GetKeywords()[NF_KEY_FIRSTCOLOR+i]; // red -> rot + pFormatter->ChangeIntl(eTmpLnge); + } + else + sStr = pKeyword[NF_KEY_FIRSTCOLOR+i]; + + pResult = &(StandardColor[i]); + } + return pResult; +} + + +short ImpSvNumberformatScan::GetKeyWord( const String& sSymbol, xub_StrLen nPos ) +{ + String sString = pFormatter->GetCharClass()->toUpper( sSymbol, nPos, sSymbol.Len() - nPos ); + const String* pKeyword = GetKeywords(); + // #77026# for the Xcl perverts: the GENERAL keyword is recognized anywhere + if ( sString.Search( pKeyword[NF_KEY_GENERAL] ) == 0 ) + return NF_KEY_GENERAL; + //! MUST be a reverse search to find longer strings first + short i = NF_KEYWORD_ENTRIES_COUNT-1; + BOOL bFound = FALSE; + for ( ; i > NF_KEY_LASTKEYWORD_SO5; --i ) + { + bFound = sString.Search(pKeyword[i]) == 0; + if ( bFound ) + { + break; + } + } + // new keywords take precedence over old keywords + if ( !bFound ) + { // skip the gap of colors et al between new and old keywords and search on + i = NF_KEY_LASTKEYWORD; + while ( i > 0 && sString.Search(pKeyword[i]) != 0 ) + i--; + if ( i > NF_KEY_LASTOLDKEYWORD && sString != pKeyword[i] ) + { // found something, but maybe it's something else? + // e.g. new NNN is found in NNNN, for NNNN we must search on + short j = i - 1; + while ( j > 0 && sString.Search(pKeyword[j]) != 0 ) + j--; + if ( j && pKeyword[j].Len() > pKeyword[i].Len() ) + return j; + } + } + // The Thai T NatNum modifier during Xcl import. + if (i == 0 && bConvertMode && sString.GetChar(0) == 'T' && eTmpLnge == + LANGUAGE_ENGLISH_US && MsLangId::getRealLanguage( eNewLnge) == + LANGUAGE_THAI) + i = NF_KEY_THAI_T; + return i; // 0 => not found +} + +//--------------------------------------------------------------------------- +// Next_Symbol +//--------------------------------------------------------------------------- +// Zerlegt die Eingabe in Symbole fuer die weitere +// Verarbeitung (Turing-Maschine). +//--------------------------------------------------------------------------- +// Ausgangs Zustand = SsStart +//---------------+-------------------+-----------------------+--------------- +// Alter Zustand | gelesenes Zeichen | Aktion | Neuer Zustand +//---------------+-------------------+-----------------------+--------------- +// SsStart | Buchstabe | Symbol=Zeichen | SsGetWord +// | " | Typ = String | SsGetString +// | \ | Typ = String | SsGetChar +// | * | Typ = Star | SsGetStar +// | _ | Typ = Blank | SsGetBlank +// | @ # 0 ? / . , % [ | Symbol = Zeichen; | +// | ] ' Blank | Typ = Steuerzeichen | SsStop +// | $ - + ( ) : | Typ = String; | +// | | | Typ = Comment | SsStop +// | Sonst | Symbol = Zeichen | SsStop +//---------------|-------------------+-----------------------+--------------- +// SsGetChar | Sonst | Symbol=Zeichen | SsStop +//---------------+-------------------+-----------------------+--------------- +// GetString | " | | SsStop +// | Sonst | Symbol+=Zeichen | GetString +//---------------+-------------------+-----------------------+--------------- +// SsGetWord | Buchstabe | Symbol += Zeichen | +// | + - (E+ E-)| Symbol += Zeichen | SsStop +// | / (AM/PM)| Symbol += Zeichen | +// | Sonst | Pos--, if Key Typ=Word| SsStop +//---------------+-------------------+-----------------------+--------------- +// SsGetStar | Sonst | Symbol+=Zeichen | SsStop +// | | markiere Sonderfall * | +//---------------+-------------------+-----------------------+--------------- +// SsGetBlank | Sonst | Symbol+=Zeichen | SsStop +// | | markiere Sonderfall _ | +//---------------+-------------------+-----------------------+--------------- +// Wurde im State SsGetWord ein Schluesselwort erkannt (auch als +// Anfangsteilwort des Symbols) +// so werden die restlichen Buchstaben zurueckgeschrieben !! + +enum ScanState +{ + SsStop = 0, + SsStart = 1, + SsGetChar = 2, + SsGetString = 3, + SsGetWord = 4, + SsGetStar = 5, + SsGetBlank = 6 +}; + +short ImpSvNumberformatScan::Next_Symbol( const String& rStr, + xub_StrLen& nPos, String& sSymbol ) +{ + if ( bKeywordsNeedInit ) + InitKeywords(); + const CharClass* pChrCls = pFormatter->GetCharClass(); + const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData(); + const xub_StrLen nStart = nPos; + short eType = 0; + ScanState eState = SsStart; + sSymbol.Erase(); + while ( nPos < rStr.Len() && eState != SsStop ) + { + sal_Unicode cToken = rStr.GetChar( nPos++ ); + switch (eState) + { + case SsStart: + { + // Fetch any currency longer than one character and don't get + // confused later on by "E/" or other combinations of letters + // and meaningful symbols. Necessary for old automatic currency. + // #96158# But don't do it if we're starting a "[...]" section, + // for example a "[$...]" new currency symbol to not parse away + // "$U" (symbol) of "[$UYU]" (abbreviation). + if ( nCurrPos != STRING_NOTFOUND && sCurString.Len() > 1 && + nPos-1 + sCurString.Len() <= rStr.Len() && + !(nPos > 1 && rStr.GetChar( nPos-2 ) == '[') ) + { + String aTest( rStr.Copy( nPos-1, sCurString.Len() ) ); + pChrCls->toUpper( aTest ); + if ( aTest == sCurString ) + { + sSymbol = rStr.Copy( --nPos, sCurString.Len() ); + nPos = nPos + sSymbol.Len(); + eState = SsStop; + eType = NF_SYMBOLTYPE_STRING; + return eType; + } + } + switch (cToken) + { + case '#': + case '0': + case '?': + case '%': + case '@': + case '[': + case ']': + case ',': + case '.': + case '/': + case '\'': + case ' ': + case ':': + case '-': + { + eType = NF_SYMBOLTYPE_DEL; + sSymbol += cToken; + eState = SsStop; + } + break; + case '*': + { + eType = NF_SYMBOLTYPE_STAR; + sSymbol += cToken; + eState = SsGetStar; + } + break; + case '_': + { + eType = NF_SYMBOLTYPE_BLANK; + sSymbol += cToken; + eState = SsGetBlank; + } + break; +#if NF_COMMENT_IN_FORMATSTRING + case '{': + eType = NF_SYMBOLTYPE_COMMENT; + eState = SsStop; + sSymbol.Append( rStr.GetBuffer() + (nPos-1), rStr.Len() - (nPos-1) ); + nPos = rStr.Len(); + break; +#endif + case '"': + eType = NF_SYMBOLTYPE_STRING; + eState = SsGetString; + sSymbol += cToken; + break; + case '\\': + eType = NF_SYMBOLTYPE_STRING; + eState = SsGetChar; + sSymbol += cToken; + break; + case '$': + case '+': + case '(': + case ')': + eType = NF_SYMBOLTYPE_STRING; + eState = SsStop; + sSymbol += cToken; + break; + default : + { + if (StringEqualsChar( pFormatter->GetNumDecimalSep(), cToken) || + StringEqualsChar( pFormatter->GetNumThousandSep(), cToken) || + StringEqualsChar( pFormatter->GetDateSep(), cToken) || + StringEqualsChar( pLoc->getTimeSep(), cToken) || + StringEqualsChar( pLoc->getTime100SecSep(), cToken)) + { + // Another separator than pre-known ASCII + eType = NF_SYMBOLTYPE_DEL; + sSymbol += cToken; + eState = SsStop; + } + else if ( pChrCls->isLetter( rStr, nPos-1 ) ) + { + short nTmpType = GetKeyWord( rStr, nPos-1 ); + if ( nTmpType ) + { + BOOL bCurrency = FALSE; + // "Automatic" currency may start with keyword, + // like "R" (Rand) and 'R' (era) + if ( nCurrPos != STRING_NOTFOUND && + nPos-1 + sCurString.Len() <= rStr.Len() && + sCurString.Search( sKeyword[nTmpType] ) == 0 ) + { + String aTest( rStr.Copy( nPos-1, sCurString.Len() ) ); + pChrCls->toUpper( aTest ); + if ( aTest == sCurString ) + bCurrency = TRUE; + } + if ( bCurrency ) + { + eState = SsGetWord; + sSymbol += cToken; + } + else + { + eType = nTmpType; + xub_StrLen nLen = sKeyword[eType].Len(); + sSymbol = rStr.Copy( nPos-1, nLen ); + if ( eType == NF_KEY_E || IsAmbiguousE( eType ) ) + { + sal_Unicode cNext = rStr.GetChar(nPos); + switch ( cNext ) + { + case '+' : + case '-' : // E+ E- combine to one symbol + sSymbol += cNext; + eType = NF_KEY_E; + nPos++; + break; + case '0' : + case '#' : // scientific E without sign + eType = NF_KEY_E; + break; + } + } + nPos--; + nPos = nPos + nLen; + eState = SsStop; + } + } + else + { + eState = SsGetWord; + sSymbol += cToken; + } + } + else + { + eType = NF_SYMBOLTYPE_STRING; + eState = SsStop; + sSymbol += cToken; + } + } + break; + } + } + break; + case SsGetChar: + { + sSymbol += cToken; + eState = SsStop; + } + break; + case SsGetString: + { + if (cToken == '"') + eState = SsStop; + sSymbol += cToken; + } + break; + case SsGetWord: + { + if ( pChrCls->isLetter( rStr, nPos-1 ) ) + { + short nTmpType = GetKeyWord( rStr, nPos-1 ); + if ( nTmpType ) + { // beginning of keyword, stop scan and put back + eType = NF_SYMBOLTYPE_STRING; + eState = SsStop; + nPos--; + } + else + sSymbol += cToken; + } + else + { + BOOL bDontStop = FALSE; + switch (cToken) + { + case '/': // AM/PM, A/P + { + sal_Unicode cNext = rStr.GetChar(nPos); + if ( cNext == 'P' || cNext == 'p' ) + { + xub_StrLen nLen = sSymbol.Len(); + if ( 1 <= nLen + && (sSymbol.GetChar(0) == 'A' || sSymbol.GetChar(0) == 'a') + && (nLen == 1 || (nLen == 2 + && (sSymbol.GetChar(1) == 'M' || sSymbol.GetChar(1) == 'm') + && (rStr.GetChar(nPos+1) == 'M' || rStr.GetChar(nPos+1) == 'm'))) ) + { + sSymbol += cToken; + bDontStop = TRUE; + } + } + } + break; + } + // anything not recognized will stop the scan + if ( eState != SsStop && !bDontStop ) + { + eState = SsStop; + nPos--; + eType = NF_SYMBOLTYPE_STRING; + } + } + } + break; + case SsGetStar: + { + eState = SsStop; + sSymbol += cToken; + nRepPos = (nPos - nStart) - 1; // everytime > 0!! + } + break; + case SsGetBlank: + { + eState = SsStop; + sSymbol += cToken; + } + break; + default: + break; + } // of switch + } // of while + if (eState == SsGetWord) + eType = NF_SYMBOLTYPE_STRING; + return eType; +} + +xub_StrLen ImpSvNumberformatScan::Symbol_Division(const String& rString) +{ + nCurrPos = STRING_NOTFOUND; + // Ist Waehrung im Spiel? + String sString = pFormatter->GetCharClass()->upper(rString); + xub_StrLen nCPos = 0; + while (nCPos != STRING_NOTFOUND) + { + nCPos = sString.Search(GetCurString(),nCPos); + if (nCPos != STRING_NOTFOUND) + { + // in Quotes? + xub_StrLen nQ = SvNumberformat::GetQuoteEnd( sString, nCPos ); + if ( nQ == STRING_NOTFOUND ) + { + sal_Unicode c; + if ( nCPos == 0 || + ((c = sString.GetChar(xub_StrLen(nCPos-1))) != '"' + && c != '\\') ) // dm kann durch "dm + { // \d geschuetzt werden + nCurrPos = nCPos; + nCPos = STRING_NOTFOUND; // Abbruch + } + else + nCPos++; // weitersuchen + } + else + nCPos = nQ + 1; // weitersuchen + } + } + nAnzStrings = 0; + BOOL bStar = FALSE; // wird bei '*'Detektion gesetzt + Reset(); + + xub_StrLen nPos = 0; + const xub_StrLen nLen = rString.Len(); + while (nPos < nLen && nAnzStrings < NF_MAX_FORMAT_SYMBOLS) + { + nTypeArray[nAnzStrings] = Next_Symbol(rString, nPos, sStrArray[nAnzStrings]); + if (nTypeArray[nAnzStrings] == NF_SYMBOLTYPE_STAR) + { // Ueberwachung des '*' + if (bStar) + return nPos; // Fehler: doppelter '*' + else + bStar = TRUE; + } + nAnzStrings++; + } + + return 0; // 0 => ok +} + +void ImpSvNumberformatScan::SkipStrings(USHORT& i, xub_StrLen& nPos) +{ + while (i < nAnzStrings && ( nTypeArray[i] == NF_SYMBOLTYPE_STRING + || nTypeArray[i] == NF_SYMBOLTYPE_BLANK + || nTypeArray[i] == NF_SYMBOLTYPE_STAR) ) + { + nPos = nPos + sStrArray[i].Len(); + i++; + } +} + + +USHORT ImpSvNumberformatScan::PreviousKeyword(USHORT i) +{ + short res = 0; + if (i > 0 && i < nAnzStrings) + { + i--; + while (i > 0 && nTypeArray[i] <= 0) + i--; + if (nTypeArray[i] > 0) + res = nTypeArray[i]; + } + return res; +} + +USHORT ImpSvNumberformatScan::NextKeyword(USHORT i) +{ + short res = 0; + if (i < nAnzStrings-1) + { + i++; + while (i < nAnzStrings-1 && nTypeArray[i] <= 0) + i++; + if (nTypeArray[i] > 0) + res = nTypeArray[i]; + } + return res; +} + +short ImpSvNumberformatScan::PreviousType( USHORT i ) +{ + if ( i > 0 && i < nAnzStrings ) + { + do + { + i--; + } while ( i > 0 && nTypeArray[i] == NF_SYMBOLTYPE_EMPTY ); + return nTypeArray[i]; + } + return 0; +} + +sal_Unicode ImpSvNumberformatScan::PreviousChar(USHORT i) +{ + sal_Unicode res = ' '; + if (i > 0 && i < nAnzStrings) + { + i--; + while (i > 0 && ( nTypeArray[i] == NF_SYMBOLTYPE_EMPTY + || nTypeArray[i] == NF_SYMBOLTYPE_STRING + || nTypeArray[i] == NF_SYMBOLTYPE_STAR + || nTypeArray[i] == NF_SYMBOLTYPE_BLANK ) ) + i--; + if (sStrArray[i].Len() > 0) + res = sStrArray[i].GetChar(xub_StrLen(sStrArray[i].Len()-1)); + } + return res; +} + +sal_Unicode ImpSvNumberformatScan::NextChar(USHORT i) +{ + sal_Unicode res = ' '; + if (i < nAnzStrings-1) + { + i++; + while (i < nAnzStrings-1 && + ( nTypeArray[i] == NF_SYMBOLTYPE_EMPTY + || nTypeArray[i] == NF_SYMBOLTYPE_STRING + || nTypeArray[i] == NF_SYMBOLTYPE_STAR + || nTypeArray[i] == NF_SYMBOLTYPE_BLANK)) + i++; + if (sStrArray[i].Len() > 0) + res = sStrArray[i].GetChar(0); + } + return res; +} + +BOOL ImpSvNumberformatScan::IsLastBlankBeforeFrac(USHORT i) +{ + BOOL res = TRUE; + if (i < nAnzStrings-1) + { + BOOL bStop = FALSE; + i++; + while (i < nAnzStrings-1 && !bStop) + { + i++; + if ( nTypeArray[i] == NF_SYMBOLTYPE_DEL && + sStrArray[i].GetChar(0) == '/') + bStop = TRUE; + else if ( nTypeArray[i] == NF_SYMBOLTYPE_DEL && + sStrArray[i].GetChar(0) == ' ') + res = FALSE; + } + if (!bStop) // kein '/' + res = FALSE; + } + else + res = FALSE; // kein '/' mehr + + return res; +} + +void ImpSvNumberformatScan::Reset() +{ + nAnzStrings = 0; + nAnzResStrings = 0; +#if 0 +// ER 20.06.97 14:05 nicht noetig, wenn nAnzStrings beachtet wird + for (size_t i = 0; i < NF_MAX_FORMAT_SYMBOLS; i++) + { + sStrArray[i].Erase(); + nTypeArray[i] = 0; + } +#endif + eScannedType = NUMBERFORMAT_UNDEFINED; + nRepPos = 0; + bExp = FALSE; + bThousand = FALSE; + nThousand = 0; + bDecSep = FALSE; + nDecPos = -1; + nExpPos = (USHORT) -1; + nBlankPos = (USHORT) -1; + nCntPre = 0; + nCntPost = 0; + nCntExp = 0; + bFrac = FALSE; + bBlank = FALSE; + nNatNumModifier = 0; +} + + +BOOL ImpSvNumberformatScan::Is100SecZero( USHORT i, BOOL bHadDecSep ) +{ + USHORT nIndexPre = PreviousKeyword( i ); + return (nIndexPre == NF_KEY_S || nIndexPre == NF_KEY_SS) + && (bHadDecSep // S, SS ',' + || (i>0 && nTypeArray[i-1] == NF_SYMBOLTYPE_STRING)); + // SS"any"00 take "any" as a valid decimal separator +} + + +xub_StrLen ImpSvNumberformatScan::ScanType(const String&) +{ + const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData(); + + xub_StrLen nPos = 0; + USHORT i = 0; + short eNewType; + BOOL bMatchBracket = FALSE; + bool bHaveGeneral = false; // if General/Standard encountered + + SkipStrings(i, nPos); + while (i < nAnzStrings) + { + if (nTypeArray[i] > 0) + { // keyword + switch (nTypeArray[i]) + { + case NF_KEY_E: // E + eNewType = NUMBERFORMAT_SCIENTIFIC; + break; + case NF_KEY_AMPM: // AM,A,PM,P + case NF_KEY_AP: + case NF_KEY_H: // H + case NF_KEY_HH: // HH + case NF_KEY_S: // S + case NF_KEY_SS: // SS + eNewType = NUMBERFORMAT_TIME; + break; + case NF_KEY_M: // M + case NF_KEY_MM: // MM + { // minute or month + USHORT nIndexPre = PreviousKeyword(i); + USHORT nIndexNex = NextKeyword(i); + sal_Unicode cChar = PreviousChar(i); + if (nIndexPre == NF_KEY_H || // H + nIndexPre == NF_KEY_HH || // HH + nIndexNex == NF_KEY_S || // S + nIndexNex == NF_KEY_SS || // SS + cChar == '[' ) // [M + { + eNewType = NUMBERFORMAT_TIME; + nTypeArray[i] -= 2; // 6 -> 4, 7 -> 5 + } + else + eNewType = NUMBERFORMAT_DATE; + } + break; + case NF_KEY_MMM: // MMM + case NF_KEY_MMMM: // MMMM + case NF_KEY_MMMMM: // MMMMM + case NF_KEY_Q: // Q + case NF_KEY_QQ: // QQ + case NF_KEY_D: // D + case NF_KEY_DD: // DD + case NF_KEY_DDD: // DDD + case NF_KEY_DDDD: // DDDD + case NF_KEY_YY: // YY + case NF_KEY_YYYY: // YYYY + case NF_KEY_NN: // NN + case NF_KEY_NNN: // NNN + case NF_KEY_NNNN: // NNNN + case NF_KEY_WW : // WW + case NF_KEY_AAA : // AAA + case NF_KEY_AAAA : // AAAA + case NF_KEY_EC : // E + case NF_KEY_EEC : // EE + case NF_KEY_G : // G + case NF_KEY_GG : // GG + case NF_KEY_GGG : // GGG + case NF_KEY_R : // R + case NF_KEY_RR : // RR + eNewType = NUMBERFORMAT_DATE; + break; + case NF_KEY_CCC: // CCC + eNewType = NUMBERFORMAT_CURRENCY; + break; + case NF_KEY_GENERAL: // Standard + eNewType = NUMBERFORMAT_NUMBER; + bHaveGeneral = true; + break; + default: + eNewType = NUMBERFORMAT_UNDEFINED; + break; + } + } + else + { // control character + switch ( sStrArray[i].GetChar(0) ) + { + case '#': + case '?': + eNewType = NUMBERFORMAT_NUMBER; + break; + case '0': + { + if ( (eScannedType & NUMBERFORMAT_TIME) == NUMBERFORMAT_TIME ) + { + if ( Is100SecZero( i, bDecSep ) ) + { + bDecSep = TRUE; // subsequent 0's + eNewType = NUMBERFORMAT_TIME; + } + else + return nPos; // Error + } + else + eNewType = NUMBERFORMAT_NUMBER; + } + break; + case '%': + eNewType = NUMBERFORMAT_PERCENT; + break; + case '/': + eNewType = NUMBERFORMAT_FRACTION; + break; + case '[': + { + if ( i < nAnzStrings-1 && + nTypeArray[i+1] == NF_SYMBOLTYPE_STRING && + sStrArray[i+1].GetChar(0) == '$' ) + { // as of SV_NUMBERFORMATTER_VERSION_NEW_CURR + eNewType = NUMBERFORMAT_CURRENCY; + bMatchBracket = TRUE; + } + else if ( i < nAnzStrings-1 && + nTypeArray[i+1] == NF_SYMBOLTYPE_STRING && + sStrArray[i+1].GetChar(0) == '~' ) + { // as of SV_NUMBERFORMATTER_VERSION_CALENDAR + eNewType = NUMBERFORMAT_DATE; + bMatchBracket = TRUE; + } + else + { + USHORT nIndexNex = NextKeyword(i); + if (nIndexNex == NF_KEY_H || // H + nIndexNex == NF_KEY_HH || // HH + nIndexNex == NF_KEY_M || // M + nIndexNex == NF_KEY_MM || // MM + nIndexNex == NF_KEY_S || // S + nIndexNex == NF_KEY_SS ) // SS + eNewType = NUMBERFORMAT_TIME; + else + return nPos; // Error + } + } + break; + case '@': + eNewType = NUMBERFORMAT_TEXT; + break; + default: + if ( sStrArray[i] == pLoc->getTime100SecSep() ) + bDecSep = TRUE; // for SS,0 + eNewType = NUMBERFORMAT_UNDEFINED; + break; + } + } + if (eScannedType == NUMBERFORMAT_UNDEFINED) + eScannedType = eNewType; + else if (eScannedType == NUMBERFORMAT_TEXT || eNewType == NUMBERFORMAT_TEXT) + eScannedType = NUMBERFORMAT_TEXT; // Text bleibt immer Text + else if (eNewType == NUMBERFORMAT_UNDEFINED) + { // bleibt wie bisher + } + else if (eScannedType != eNewType) + { + switch (eScannedType) + { + case NUMBERFORMAT_DATE: + { + switch (eNewType) + { + case NUMBERFORMAT_TIME: + eScannedType = NUMBERFORMAT_DATETIME; + break; + case NUMBERFORMAT_FRACTION: // DD/MM + break; + default: + { + if (nCurrPos != STRING_NOTFOUND) + eScannedType = NUMBERFORMAT_UNDEFINED; + else if ( sStrArray[i] != pFormatter->GetDateSep() ) + return nPos; + } + } + } + break; + case NUMBERFORMAT_TIME: + { + switch (eNewType) + { + case NUMBERFORMAT_DATE: + eScannedType = NUMBERFORMAT_DATETIME; + break; + case NUMBERFORMAT_FRACTION: // MM/SS + break; + default: + { + if (nCurrPos != STRING_NOTFOUND) + eScannedType = NUMBERFORMAT_UNDEFINED; + else if ( sStrArray[i] != pLoc->getTimeSep() ) + return nPos; + } + } + } + break; + case NUMBERFORMAT_DATETIME: + { + switch (eNewType) + { + case NUMBERFORMAT_TIME: + case NUMBERFORMAT_DATE: + break; + case NUMBERFORMAT_FRACTION: // DD/MM + break; + default: + { + if (nCurrPos != STRING_NOTFOUND) + eScannedType = NUMBERFORMAT_UNDEFINED; + else if ( sStrArray[i] != pFormatter->GetDateSep() + && sStrArray[i] != pLoc->getTimeSep() ) + return nPos; + } + } + } + break; + case NUMBERFORMAT_PERCENT: + { + switch (eNewType) + { + case NUMBERFORMAT_NUMBER: // nur Zahl nach Prozent + break; + default: + return nPos; + } + } + break; + case NUMBERFORMAT_SCIENTIFIC: + { + switch (eNewType) + { + case NUMBERFORMAT_NUMBER: // nur Zahl nach E + break; + default: + return nPos; + } + } + break; + case NUMBERFORMAT_NUMBER: + { + switch (eNewType) + { + case NUMBERFORMAT_SCIENTIFIC: + case NUMBERFORMAT_PERCENT: + case NUMBERFORMAT_FRACTION: + case NUMBERFORMAT_CURRENCY: + eScannedType = eNewType; + break; + default: + if (nCurrPos != STRING_NOTFOUND) + eScannedType = NUMBERFORMAT_UNDEFINED; + else + return nPos; + } + } + break; + case NUMBERFORMAT_FRACTION: + { + switch (eNewType) + { + case NUMBERFORMAT_NUMBER: // nur Zahl nach Bruch + break; + default: + return nPos; + } + } + break; + default: + break; + } + } + nPos = nPos + sStrArray[i].Len(); // Korrekturposition + i++; + if ( bMatchBracket ) + { // no type detection inside of matching brackets if [$...], [~...] + while ( bMatchBracket && i < nAnzStrings ) + { + if ( nTypeArray[i] == NF_SYMBOLTYPE_DEL + && sStrArray[i].GetChar(0) == ']' ) + bMatchBracket = FALSE; + else + nTypeArray[i] = NF_SYMBOLTYPE_STRING; + nPos = nPos + sStrArray[i].Len(); + i++; + } + if ( bMatchBracket ) + return nPos; // missing closing bracket at end of code + } + SkipStrings(i, nPos); + } + + if ((eScannedType == NUMBERFORMAT_NUMBER || eScannedType == NUMBERFORMAT_UNDEFINED) + && nCurrPos != STRING_NOTFOUND && !bHaveGeneral) + eScannedType = NUMBERFORMAT_CURRENCY; // old "automatic" currency + if (eScannedType == NUMBERFORMAT_UNDEFINED) + eScannedType = NUMBERFORMAT_DEFINED; + return 0; // Alles ok +} + + +bool ImpSvNumberformatScan::InsertSymbol( USHORT & nPos, svt::NfSymbolType eType, const String& rStr ) +{ + if (nAnzStrings >= NF_MAX_FORMAT_SYMBOLS || nPos > nAnzStrings) + return false; + ++nAnzResStrings; + if (nPos > 0 && nTypeArray[nPos-1] == NF_SYMBOLTYPE_EMPTY) + --nPos; // reuse position + else + { + ++nAnzStrings; + for (size_t i = nAnzStrings; i > nPos; --i) + { + nTypeArray[i] = nTypeArray[i-1]; + sStrArray[i] = sStrArray[i-1]; + } + } + nTypeArray[nPos] = static_cast(eType); + sStrArray[nPos] = rStr; + return true; +} + + +int ImpSvNumberformatScan::FinalScanGetCalendar( xub_StrLen& nPos, USHORT& i, + USHORT& rAnzResStrings ) +{ + if ( sStrArray[i].GetChar(0) == '[' && + i < nAnzStrings-1 && + nTypeArray[i+1] == NF_SYMBOLTYPE_STRING && + sStrArray[i+1].GetChar(0) == '~' ) + { // [~calendarID] + // as of SV_NUMBERFORMATTER_VERSION_CALENDAR + nPos = nPos + sStrArray[i].Len(); // [ + nTypeArray[i] = NF_SYMBOLTYPE_CALDEL; + nPos = nPos + sStrArray[++i].Len(); // ~ + sStrArray[i-1] += sStrArray[i]; // [~ + nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; + rAnzResStrings--; + if ( ++i >= nAnzStrings ) + return -1; // error + nPos = nPos + sStrArray[i].Len(); // calendarID + String& rStr = sStrArray[i]; + nTypeArray[i] = NF_SYMBOLTYPE_CALENDAR; // convert + i++; + while ( i < nAnzStrings && + sStrArray[i].GetChar(0) != ']' ) + { + nPos = nPos + sStrArray[i].Len(); + rStr += sStrArray[i]; + nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; + rAnzResStrings--; + i++; + } + if ( rStr.Len() && i < nAnzStrings && + sStrArray[i].GetChar(0) == ']' ) + { + nTypeArray[i] = NF_SYMBOLTYPE_CALDEL; + nPos = nPos + sStrArray[i].Len(); + i++; + } + else + return -1; // error + return 1; + } + return 0; +} + +xub_StrLen ImpSvNumberformatScan::FinalScan( String& rString, String& rComment ) +{ + const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData(); + + // save values for convert mode + String sOldDecSep = pFormatter->GetNumDecimalSep(); + String sOldThousandSep = pFormatter->GetNumThousandSep(); + String sOldDateSep = pFormatter->GetDateSep(); + String sOldTimeSep = pLoc->getTimeSep(); + String sOldTime100SecSep= pLoc->getTime100SecSep(); + String sOldCurSymbol = GetCurSymbol(); + String sOldCurString = GetCurString(); + sal_Unicode cOldKeyH = sKeyword[NF_KEY_H].GetChar(0); + sal_Unicode cOldKeyMI = sKeyword[NF_KEY_MI].GetChar(0); + sal_Unicode cOldKeyS = sKeyword[NF_KEY_S].GetChar(0); + + // If the group separator is a Non-Breaking Space (French) continue with a + // normal space instead so queries on space work correctly. + // The format string is adjusted to allow both. + // For output of the format code string the LocaleData characters are used. + if ( sOldThousandSep.GetChar(0) == cNonBreakingSpace && sOldThousandSep.Len() == 1 ) + sOldThousandSep = ' '; + + // change locale data et al + if (bConvertMode) + { + pFormatter->ChangeIntl(eNewLnge); + //! pointer may have changed + pLoc = pFormatter->GetLocaleData(); + //! init new keywords + InitKeywords(); + } + const CharClass* pChrCls = pFormatter->GetCharClass(); + + xub_StrLen nPos = 0; // error correction position + USHORT i = 0; // symbol loop counter + USHORT nCounter = 0; // counts digits + nAnzResStrings = nAnzStrings; // counts remaining symbols + bDecSep = FALSE; // reset in case already used in TypeCheck + bool bThaiT = false; // Thai T NatNum modifier present + + switch (eScannedType) + { + case NUMBERFORMAT_TEXT: + case NUMBERFORMAT_DEFINED: + { + while (i < nAnzStrings) + { + switch (nTypeArray[i]) + { + case NF_SYMBOLTYPE_BLANK: + case NF_SYMBOLTYPE_STAR: + break; + case NF_SYMBOLTYPE_COMMENT: + { + String& rStr = sStrArray[i]; + nPos = nPos + rStr.Len(); + SvNumberformat::EraseCommentBraces( rStr ); + rComment += rStr; + nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; + nAnzResStrings--; + } + break; + case NF_KEY_GENERAL : // #77026# "General" is the same as "@" + break; + default: + { + if ( nTypeArray[i] != NF_SYMBOLTYPE_DEL || + sStrArray[i].GetChar(0) != '@' ) + nTypeArray[i] = NF_SYMBOLTYPE_STRING; + } + break; + } + nPos = nPos + sStrArray[i].Len(); + i++; + } // of while + } + break; + case NUMBERFORMAT_NUMBER: + case NUMBERFORMAT_PERCENT: + case NUMBERFORMAT_CURRENCY: + case NUMBERFORMAT_SCIENTIFIC: + case NUMBERFORMAT_FRACTION: + { + sal_Unicode cThousandFill = ' '; + while (i < nAnzStrings) + { + if (eScannedType == NUMBERFORMAT_FRACTION && // special case + nTypeArray[i] == NF_SYMBOLTYPE_DEL && // # ### #/# + StringEqualsChar( sOldThousandSep, ' ' ) && // e.g. France or Sweden + StringEqualsChar( sStrArray[i], ' ' ) && + !bFrac && + IsLastBlankBeforeFrac(i) ) + { + nTypeArray[i] = NF_SYMBOLTYPE_STRING; // del->string + } // kein Taus.p. + + + if (nTypeArray[i] == NF_SYMBOLTYPE_BLANK || + nTypeArray[i] == NF_SYMBOLTYPE_STAR || + nTypeArray[i] == NF_KEY_CCC || // CCC + nTypeArray[i] == NF_KEY_GENERAL ) // Standard + { + if (nTypeArray[i] == NF_KEY_GENERAL) + { + nThousand = FLAG_STANDARD_IN_FORMAT; + if ( bConvertMode ) + sStrArray[i] = sNameStandardFormat; + } + nPos = nPos + sStrArray[i].Len(); + i++; + } + else if (nTypeArray[i] == NF_SYMBOLTYPE_STRING || // Strings oder + nTypeArray[i] > 0) // Keywords + { + if (eScannedType == NUMBERFORMAT_SCIENTIFIC && + nTypeArray[i] == NF_KEY_E) // E+ + { + if (bExp) // doppelt + return nPos; + bExp = TRUE; + nExpPos = i; + if (bDecSep) + nCntPost = nCounter; + else + nCntPre = nCounter; + nCounter = 0; + nTypeArray[i] = NF_SYMBOLTYPE_EXP; + } + else if (eScannedType == NUMBERFORMAT_FRACTION && + sStrArray[i].GetChar(0) == ' ') + { + if (!bBlank && !bFrac) // nicht doppelt oder hinter / + { + if (bDecSep && nCounter > 0) // Nachkommastellen + return nPos; // Fehler + bBlank = TRUE; + nBlankPos = i; + nCntPre = nCounter; + nCounter = 0; + } + nTypeArray[i] = NF_SYMBOLTYPE_FRACBLANK; + } + else if (nTypeArray[i] == NF_KEY_THAI_T) + { + bThaiT = true; + sStrArray[i] = sKeyword[nTypeArray[i]]; + } + else + nTypeArray[i] = NF_SYMBOLTYPE_STRING; + nPos = nPos + sStrArray[i].Len(); + i++; + } + else if (nTypeArray[i] == NF_SYMBOLTYPE_DEL) + { + sal_Unicode cHere = sStrArray[i].GetChar(0); + // Handle not pre-known separators in switch. + sal_Unicode cSimplified; + if (StringEqualsChar( pFormatter->GetNumThousandSep(), cHere)) + cSimplified = ','; + else if (StringEqualsChar( pFormatter->GetNumDecimalSep(), cHere)) + cSimplified = '.'; + else + cSimplified = cHere; + switch ( cSimplified ) + { + case '#': + case '0': + case '?': + { + if (nThousand > 0) // #... # + return nPos; // Fehler + else if (bFrac && cHere == '0') + return nPos; // 0 im Nenner + nTypeArray[i] = NF_SYMBOLTYPE_DIGIT; + String& rStr = sStrArray[i]; + nPos = nPos + rStr.Len(); + i++; + nCounter++; + while (i < nAnzStrings && + (sStrArray[i].GetChar(0) == '#' || + sStrArray[i].GetChar(0) == '0' || + sStrArray[i].GetChar(0) == '?') + ) + { + nTypeArray[i] = NF_SYMBOLTYPE_DIGIT; + nPos = nPos + sStrArray[i].Len(); + nCounter++; + i++; + } + } + break; + case '-': + { + if ( bDecSep && nDecPos+1 == i && + nTypeArray[nDecPos] == NF_SYMBOLTYPE_DECSEP ) + { // "0.--" + nTypeArray[i] = NF_SYMBOLTYPE_DIGIT; + String& rStr = sStrArray[i]; + nPos = nPos + rStr.Len(); + i++; + nCounter++; + while (i < nAnzStrings && + (sStrArray[i].GetChar(0) == '-') ) + { + // If more than two dashes are present in + // currency formats the last dash will be + // interpreted literally as a minus sign. + // Has to be this ugly. Period. + if ( eScannedType == NUMBERFORMAT_CURRENCY + && rStr.Len() >= 2 && + (i == nAnzStrings-1 || + sStrArray[i+1].GetChar(0) != '-') ) + break; + rStr += sStrArray[i]; + nPos = nPos + sStrArray[i].Len(); + nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; + nAnzResStrings--; + nCounter++; + i++; + } + } + else + { + nTypeArray[i] = NF_SYMBOLTYPE_STRING; + nPos = nPos + sStrArray[i].Len(); + i++; + } + } + break; + case '.': + case ',': + case '\'': + case ' ': + { + sal_Unicode cSep = cHere; // remember + if ( StringEqualsChar( sOldThousandSep, cSep ) ) + { + // previous char with skip empty + sal_Unicode cPre = PreviousChar(i); + sal_Unicode cNext; + if (bExp || bBlank || bFrac) + { // after E, / or ' ' + if ( !StringEqualsChar( sOldThousandSep, ' ' ) ) + { + nPos = nPos + sStrArray[i].Len(); + nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; + nAnzResStrings--; + i++; // eat it + } + else + nTypeArray[i] = NF_SYMBOLTYPE_STRING; + } + else if (i > 0 && i < nAnzStrings-1 && + (cPre == '#' || cPre == '0') && + ((cNext = NextChar(i)) == '#' || cNext == '0') + ) // #,# + { + nPos = nPos + sStrArray[i].Len(); + if (!bThousand) // only once + { + bThousand = TRUE; + cThousandFill = sStrArray[i+1].GetChar(0); + } + // Eat it, will be reinserted at proper + // grouping positions further down. + nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; + nAnzResStrings--; + i++; + } + else if (i > 0 && (cPre == '#' || cPre == '0') + && PreviousType(i) == NF_SYMBOLTYPE_DIGIT + && nThousand < FLAG_STANDARD_IN_FORMAT ) + { // #,,,, + if ( StringEqualsChar( sOldThousandSep, ' ' ) ) + { // strange, those French.. + BOOL bFirst = TRUE; + String& rStr = sStrArray[i]; + // set a hard Non-Breaking Space or ConvertMode + const String& rSepF = pFormatter->GetNumThousandSep(); + while ( i < nAnzStrings + && sStrArray[i] == sOldThousandSep + && StringEqualsChar( sOldThousandSep, NextChar(i) ) ) + { // last was a space or another space + // is following => separator + nPos = nPos + sStrArray[i].Len(); + if ( bFirst ) + { + bFirst = FALSE; + rStr = rSepF; + nTypeArray[i] = NF_SYMBOLTYPE_THSEP; + } + else + { + rStr += rSepF; + nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; + nAnzResStrings--; + } + nThousand++; + i++; + } + if ( i < nAnzStrings-1 + && sStrArray[i] == sOldThousandSep ) + { // something following last space + // => space if currency contained, + // else separator + nPos = nPos + sStrArray[i].Len(); + if ( (nPos <= nCurrPos && + nCurrPos < nPos + sStrArray[i+1].Len()) + || nTypeArray[i+1] == NF_KEY_CCC + || (i < nAnzStrings-2 && + sStrArray[i+1].GetChar(0) == '[' && + sStrArray[i+2].GetChar(0) == '$') ) + { + nTypeArray[i] = NF_SYMBOLTYPE_STRING; + } + else + { + if ( bFirst ) + { + bFirst = FALSE; + rStr = rSepF; + nTypeArray[i] = NF_SYMBOLTYPE_THSEP; + } + else + { + rStr += rSepF; + nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; + nAnzResStrings--; + } + nThousand++; + } + i++; + } + } + else + { + do + { + nThousand++; + nTypeArray[i] = NF_SYMBOLTYPE_THSEP; + nPos = nPos + sStrArray[i].Len(); + sStrArray[i] = pFormatter->GetNumThousandSep(); + i++; + } while (i < nAnzStrings && + sStrArray[i] == sOldThousandSep); + } + } + else // any grsep + { + nTypeArray[i] = NF_SYMBOLTYPE_STRING; + String& rStr = sStrArray[i]; + nPos = nPos + rStr.Len(); + i++; + while ( i < nAnzStrings && + sStrArray[i] == sOldThousandSep ) + { + rStr += sStrArray[i]; + nPos = nPos + sStrArray[i].Len(); + nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; + nAnzResStrings--; + i++; + } + } + } + else if ( StringEqualsChar( sOldDecSep, cSep ) ) + { + if (bBlank || bFrac) // . behind / or ' ' + return nPos; // error + else if (bExp) // behind E + { + nPos = nPos + sStrArray[i].Len(); + nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; + nAnzResStrings--; + i++; // eat it + } + else if (bDecSep) // any . + { + nTypeArray[i] = NF_SYMBOLTYPE_STRING; + String& rStr = sStrArray[i]; + nPos = nPos + rStr.Len(); + i++; + while ( i < nAnzStrings && + sStrArray[i] == sOldDecSep ) + { + rStr += sStrArray[i]; + nPos = nPos + sStrArray[i].Len(); + nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; + nAnzResStrings--; + i++; + } + } + else + { + nPos = nPos + sStrArray[i].Len(); + nTypeArray[i] = NF_SYMBOLTYPE_DECSEP; + sStrArray[i] = pFormatter->GetNumDecimalSep(); + bDecSep = TRUE; + nDecPos = i; + nCntPre = nCounter; + nCounter = 0; + + i++; + } + } // of else = DecSep + else // . without meaning + { + if (cSep == ' ' && + eScannedType == NUMBERFORMAT_FRACTION && + StringEqualsChar( sStrArray[i], ' ' ) ) + { + if (!bBlank && !bFrac) // no dups + { // or behind / + if (bDecSep && nCounter > 0)// dec. + return nPos; // error + bBlank = TRUE; + nBlankPos = i; + nCntPre = nCounter; + nCounter = 0; + } + nTypeArray[i] = NF_SYMBOLTYPE_STRING; + nPos = nPos + sStrArray[i].Len(); + } + else + { + nTypeArray[i] = NF_SYMBOLTYPE_STRING; + String& rStr = sStrArray[i]; + nPos = nPos + rStr.Len(); + i++; + while (i < nAnzStrings && + StringEqualsChar( sStrArray[i], cSep ) ) + { + rStr += sStrArray[i]; + nPos = nPos + sStrArray[i].Len(); + nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; + nAnzResStrings--; + i++; + } + } + } + } + break; + case '/': + { + if (eScannedType == NUMBERFORMAT_FRACTION) + { + if ( i == 0 || + (nTypeArray[i-1] != NF_SYMBOLTYPE_DIGIT && + nTypeArray[i-1] != NF_SYMBOLTYPE_EMPTY) ) + return nPos ? nPos : 1; // /? not allowed + else if (!bFrac || (bDecSep && nCounter > 0)) + { + bFrac = TRUE; + nCntPost = nCounter; + nCounter = 0; + nTypeArray[i] = NF_SYMBOLTYPE_FRAC; + nPos = nPos + sStrArray[i].Len(); + i++; + } + else // / doppelt od. , imZaehl + return nPos; // Fehler + } + else + { + nTypeArray[i] = NF_SYMBOLTYPE_STRING; + nPos = nPos + sStrArray[i].Len(); + i++; + } + } + break; + case '[' : + { + if ( eScannedType == NUMBERFORMAT_CURRENCY && + i < nAnzStrings-1 && + nTypeArray[i+1] == NF_SYMBOLTYPE_STRING && + sStrArray[i+1].GetChar(0) == '$' ) + { // [$DM-xxx] + // ab SV_NUMBERFORMATTER_VERSION_NEW_CURR + nPos = nPos + sStrArray[i].Len(); // [ + nTypeArray[i] = NF_SYMBOLTYPE_CURRDEL; + nPos = nPos + sStrArray[++i].Len(); // $ + sStrArray[i-1] += sStrArray[i]; // [$ + nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; + nAnzResStrings--; + if ( ++i >= nAnzStrings ) + return nPos; // Fehler + nPos = nPos + sStrArray[i].Len(); // DM + String& rStr = sStrArray[i]; + String* pStr = &sStrArray[i]; + nTypeArray[i] = NF_SYMBOLTYPE_CURRENCY; // wandeln + BOOL bHadDash = FALSE; + i++; + while ( i < nAnzStrings && + sStrArray[i].GetChar(0) != ']' ) + { + nPos = nPos + sStrArray[i].Len(); + if ( bHadDash ) + { + *pStr += sStrArray[i]; + nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; + nAnzResStrings--; + } + else + { + if ( sStrArray[i].GetChar(0) == '-' ) + { + bHadDash = TRUE; + pStr = &sStrArray[i]; + nTypeArray[i] = NF_SYMBOLTYPE_CURREXT; + } + else + { + *pStr += sStrArray[i]; + nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; + nAnzResStrings--; + } + } + i++; + } + if ( rStr.Len() && i < nAnzStrings && + sStrArray[i].GetChar(0) == ']' ) + { + nTypeArray[i] = NF_SYMBOLTYPE_CURRDEL; + nPos = nPos + sStrArray[i].Len(); + i++; + } + else + return nPos; // Fehler + } + else + { + nTypeArray[i] = NF_SYMBOLTYPE_STRING; + nPos = nPos + sStrArray[i].Len(); + i++; + } + } + break; + default: // andere Dels + { + if (eScannedType == NUMBERFORMAT_PERCENT && + cHere == '%') + nTypeArray[i] = NF_SYMBOLTYPE_PERCENT; + else + nTypeArray[i] = NF_SYMBOLTYPE_STRING; + nPos = nPos + sStrArray[i].Len(); + i++; + } + break; + } // of switch (Del) + } // of else Del + else if ( nTypeArray[i] == NF_SYMBOLTYPE_COMMENT ) + { + String& rStr = sStrArray[i]; + nPos = nPos + rStr.Len(); + SvNumberformat::EraseCommentBraces( rStr ); + rComment += rStr; + nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; + nAnzResStrings--; + i++; + } + else + { + DBG_ERRORFILE( "unknown NF_SYMBOLTYPE_..." ); + nPos = nPos + sStrArray[i].Len(); + i++; + } + } // of while + if (eScannedType == NUMBERFORMAT_FRACTION) + { + if (bFrac) + nCntExp = nCounter; + else if (bBlank) + nCntPost = nCounter; + else + nCntPre = nCounter; + } + else + { + if (bExp) + nCntExp = nCounter; + else if (bDecSep) + nCntPost = nCounter; + else + nCntPre = nCounter; + } + if (bThousand) // Expansion of grouping separators + { + USHORT nMaxPos; + if (bFrac) + { + if (bBlank) + nMaxPos = nBlankPos; + else + nMaxPos = 0; // no grouping + } + else if (bDecSep) // decimal separator present + nMaxPos = nDecPos; + else if (bExp) // 'E' exponent present + nMaxPos = nExpPos; + else // up to end + nMaxPos = i; + // Insert separators at proper positions. + xub_StrLen nCount = 0; + utl::DigitGroupingIterator aGrouping( pLoc->getDigitGrouping()); + size_t nFirstDigitSymbol = nMaxPos; + size_t nFirstGroupingSymbol = nMaxPos; + i = nMaxPos; + while (i-- > 0) + { + if (nTypeArray[i] == NF_SYMBOLTYPE_DIGIT) + { + nFirstDigitSymbol = i; + nCount = nCount + sStrArray[i].Len(); // MSC converts += to int and then warns, so ... + // Insert separator only if not leftmost symbol. + if (i > 0 && nCount >= aGrouping.getPos()) + { + DBG_ASSERT( sStrArray[i].Len() == 1, + "ImpSvNumberformatScan::FinalScan: combined digits in group separator insertion"); + if (!InsertSymbol( i, NF_SYMBOLTYPE_THSEP, + pFormatter->GetNumThousandSep())) + // nPos isn't correct here, but signals error + return nPos; + // i may have been decremented by 1 + nFirstDigitSymbol = i + 1; + nFirstGroupingSymbol = i; + aGrouping.advance(); + } + } + } + // Generated something like "string",000; remove separator again. + if (nFirstGroupingSymbol < nFirstDigitSymbol) + { + nTypeArray[nFirstGroupingSymbol] = NF_SYMBOLTYPE_EMPTY; + nAnzResStrings--; + } + } + // Combine digits into groups to save memory (Info will be copied + // later, taking only non-empty symbols). + for (i = 0; i < nAnzStrings; ++i) + { + if (nTypeArray[i] == NF_SYMBOLTYPE_DIGIT) + { + String& rStr = sStrArray[i]; + while (++i < nAnzStrings && + nTypeArray[i] == NF_SYMBOLTYPE_DIGIT) + { + rStr += sStrArray[i]; + nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; + nAnzResStrings--; + } + } + } + } + break; // of NUMBERFORMAT_NUMBER + case NUMBERFORMAT_DATE: + { + while (i < nAnzStrings) + { + switch (nTypeArray[i]) + { + case NF_SYMBOLTYPE_BLANK: + case NF_SYMBOLTYPE_STAR: + case NF_SYMBOLTYPE_STRING: + nPos = nPos + sStrArray[i].Len(); + i++; + break; + case NF_SYMBOLTYPE_COMMENT: + { + String& rStr = sStrArray[i]; + nPos = nPos + rStr.Len(); + SvNumberformat::EraseCommentBraces( rStr ); + rComment += rStr; + nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; + nAnzResStrings--; + i++; + } + break; + case NF_SYMBOLTYPE_DEL: + { + int nCalRet; + if (sStrArray[i] == sOldDateSep) + { + nTypeArray[i] = NF_SYMBOLTYPE_DATESEP; + nPos = nPos + sStrArray[i].Len(); + if (bConvertMode) + sStrArray[i] = pFormatter->GetDateSep(); + i++; + } + else if ( (nCalRet = FinalScanGetCalendar( nPos, i, nAnzResStrings )) != 0 ) + { + if ( nCalRet < 0 ) + return nPos; // error + } + else + { + nTypeArray[i] = NF_SYMBOLTYPE_STRING; + nPos = nPos + sStrArray[i].Len(); + i++; + } + } + break; + case NF_KEY_THAI_T : + bThaiT = true; + // fall thru + case NF_KEY_M: // M + case NF_KEY_MM: // MM + case NF_KEY_MMM: // MMM + case NF_KEY_MMMM: // MMMM + case NF_KEY_MMMMM: // MMMMM + case NF_KEY_Q: // Q + case NF_KEY_QQ: // QQ + case NF_KEY_D: // D + case NF_KEY_DD: // DD + case NF_KEY_DDD: // DDD + case NF_KEY_DDDD: // DDDD + case NF_KEY_YY: // YY + case NF_KEY_YYYY: // YYYY + case NF_KEY_NN: // NN + case NF_KEY_NNN: // NNN + case NF_KEY_NNNN: // NNNN + case NF_KEY_WW : // WW + case NF_KEY_AAA : // AAA + case NF_KEY_AAAA : // AAAA + case NF_KEY_EC : // E + case NF_KEY_EEC : // EE + case NF_KEY_G : // G + case NF_KEY_GG : // GG + case NF_KEY_GGG : // GGG + case NF_KEY_R : // R + case NF_KEY_RR : // RR + sStrArray[i] = sKeyword[nTypeArray[i]]; // tTtT -> TTTT + nPos = nPos + sStrArray[i].Len(); + i++; + break; + default: // andere Keywords + nTypeArray[i] = NF_SYMBOLTYPE_STRING; + nPos = nPos + sStrArray[i].Len(); + i++; + break; + } + } // of while + } + break; // of NUMBERFORMAT_DATE + case NUMBERFORMAT_TIME: + { + while (i < nAnzStrings) + { + switch (nTypeArray[i]) + { + case NF_SYMBOLTYPE_BLANK: + case NF_SYMBOLTYPE_STAR: + { + nPos = nPos + sStrArray[i].Len(); + i++; + } + break; + case NF_SYMBOLTYPE_DEL: + { + switch( sStrArray[i].GetChar(0) ) + { + case '0': + { + if ( Is100SecZero( i, bDecSep ) ) + { + bDecSep = TRUE; + nTypeArray[i] = NF_SYMBOLTYPE_DIGIT; + String& rStr = sStrArray[i]; + i++; + nPos = nPos + sStrArray[i].Len(); + nCounter++; + while (i < nAnzStrings && + sStrArray[i].GetChar(0) == '0') + { + rStr += sStrArray[i]; + nPos = nPos + sStrArray[i].Len(); + nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; + nAnzResStrings--; + nCounter++; + i++; + } + } + else + return nPos; + } + break; + case '#': + case '?': + return nPos; + case '[': + { + if (bThousand) // doppelt + return nPos; + bThousand = TRUE; // bei Time frei + sal_Unicode cChar = pChrCls->upper( NextChar(i) ).GetChar(0); + if ( cChar == cOldKeyH ) + nThousand = 1; // H + else if ( cChar == cOldKeyMI ) + nThousand = 2; // M + else if ( cChar == cOldKeyS ) + nThousand = 3; // S + else + return nPos; + nPos = nPos + sStrArray[i].Len(); + i++; + } + break; + case ']': + { + if (!bThousand) // kein [ vorher + return nPos; + nPos = nPos + sStrArray[i].Len(); + i++; + } + break; + default: + { + nPos = nPos + sStrArray[i].Len(); + if ( sStrArray[i] == sOldTimeSep ) + { + nTypeArray[i] = NF_SYMBOLTYPE_TIMESEP; + if ( bConvertMode ) + sStrArray[i] = pLoc->getTimeSep(); + } + else if ( sStrArray[i] == sOldTime100SecSep ) + { + bDecSep = TRUE; + nTypeArray[i] = NF_SYMBOLTYPE_TIME100SECSEP; + if ( bConvertMode ) + sStrArray[i] = pLoc->getTime100SecSep(); + } + else + nTypeArray[i] = NF_SYMBOLTYPE_STRING; + i++; + } + break; + } + } + break; + case NF_SYMBOLTYPE_STRING: + { + nPos = nPos + sStrArray[i].Len(); + i++; + } + break; + case NF_SYMBOLTYPE_COMMENT: + { + String& rStr = sStrArray[i]; + nPos = nPos + rStr.Len(); + SvNumberformat::EraseCommentBraces( rStr ); + rComment += rStr; + nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; + nAnzResStrings--; + i++; + } + break; + case NF_KEY_AMPM: // AM/PM + case NF_KEY_AP: // A/P + { + bExp = TRUE; // missbraucht fuer A/P + sStrArray[i] = sKeyword[nTypeArray[i]]; // tTtT -> TTTT + nPos = nPos + sStrArray[i].Len(); + i++; + } + break; + case NF_KEY_THAI_T : + bThaiT = true; + // fall thru + case NF_KEY_MI: // M + case NF_KEY_MMI: // MM + case NF_KEY_H: // H + case NF_KEY_HH: // HH + case NF_KEY_S: // S + case NF_KEY_SS: // SS + { + sStrArray[i] = sKeyword[nTypeArray[i]]; // tTtT -> TTTT + nPos = nPos + sStrArray[i].Len(); + i++; + } + break; + default: // andere Keywords + { + nTypeArray[i] = NF_SYMBOLTYPE_STRING; + nPos = nPos + sStrArray[i].Len(); + i++; + } + break; + } + } // of while + nCntPost = nCounter; // Zaehler der Nullen + if (bExp) + nCntExp = 1; // merkt AM/PM + } + break; // of NUMBERFORMAT_TIME + case NUMBERFORMAT_DATETIME: + { + BOOL bTimePart = FALSE; + while (i < nAnzStrings) + { + switch (nTypeArray[i]) + { + case NF_SYMBOLTYPE_BLANK: + case NF_SYMBOLTYPE_STAR: + case NF_SYMBOLTYPE_STRING: + nPos = nPos + sStrArray[i].Len(); + i++; + break; + case NF_SYMBOLTYPE_COMMENT: + { + String& rStr = sStrArray[i]; + nPos = nPos + rStr.Len(); + SvNumberformat::EraseCommentBraces( rStr ); + rComment += rStr; + nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; + nAnzResStrings--; + i++; + } + break; + case NF_SYMBOLTYPE_DEL: + { + int nCalRet; + if ( (nCalRet = FinalScanGetCalendar( nPos, i, nAnzResStrings )) != 0 ) + { + if ( nCalRet < 0 ) + return nPos; // error + } + else + { + switch( sStrArray[i].GetChar(0) ) + { + case '0': + { + if ( bTimePart && Is100SecZero( i, bDecSep ) ) + { + bDecSep = TRUE; + nTypeArray[i] = NF_SYMBOLTYPE_DIGIT; + String& rStr = sStrArray[i]; + i++; + nPos = nPos + sStrArray[i].Len(); + nCounter++; + while (i < nAnzStrings && + sStrArray[i].GetChar(0) == '0') + { + rStr += sStrArray[i]; + nPos = nPos + sStrArray[i].Len(); + nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; + nAnzResStrings--; + nCounter++; + i++; + } + } + else + return nPos; + } + break; + case '#': + case '?': + return nPos; + default: + { + nPos = nPos + sStrArray[i].Len(); + if (bTimePart) + { + if ( sStrArray[i] == sOldTimeSep ) + { + nTypeArray[i] = NF_SYMBOLTYPE_TIMESEP; + if ( bConvertMode ) + sStrArray[i] = pLoc->getTimeSep(); + } + else if ( sStrArray[i] == sOldTime100SecSep ) + { + bDecSep = TRUE; + nTypeArray[i] = NF_SYMBOLTYPE_TIME100SECSEP; + if ( bConvertMode ) + sStrArray[i] = pLoc->getTime100SecSep(); + } + else + nTypeArray[i] = NF_SYMBOLTYPE_STRING; + } + else + { + if ( sStrArray[i] == sOldDateSep ) + { + nTypeArray[i] = NF_SYMBOLTYPE_DATESEP; + if (bConvertMode) + sStrArray[i] = pFormatter->GetDateSep(); + } + else + nTypeArray[i] = NF_SYMBOLTYPE_STRING; + } + i++; + } + } + } + } + break; + case NF_KEY_AMPM: // AM/PM + case NF_KEY_AP: // A/P + { + bTimePart = TRUE; + bExp = TRUE; // missbraucht fuer A/P + sStrArray[i] = sKeyword[nTypeArray[i]]; // tTtT -> TTTT + nPos = nPos + sStrArray[i].Len(); + i++; + } + break; + case NF_KEY_MI: // M + case NF_KEY_MMI: // MM + case NF_KEY_H: // H + case NF_KEY_HH: // HH + case NF_KEY_S: // S + case NF_KEY_SS: // SS + bTimePart = TRUE; + sStrArray[i] = sKeyword[nTypeArray[i]]; // tTtT -> TTTT + nPos = nPos + sStrArray[i].Len(); + i++; + break; + case NF_KEY_M: // M + case NF_KEY_MM: // MM + case NF_KEY_MMM: // MMM + case NF_KEY_MMMM: // MMMM + case NF_KEY_MMMMM: // MMMMM + case NF_KEY_Q: // Q + case NF_KEY_QQ: // QQ + case NF_KEY_D: // D + case NF_KEY_DD: // DD + case NF_KEY_DDD: // DDD + case NF_KEY_DDDD: // DDDD + case NF_KEY_YY: // YY + case NF_KEY_YYYY: // YYYY + case NF_KEY_NN: // NN + case NF_KEY_NNN: // NNN + case NF_KEY_NNNN: // NNNN + case NF_KEY_WW : // WW + case NF_KEY_AAA : // AAA + case NF_KEY_AAAA : // AAAA + case NF_KEY_EC : // E + case NF_KEY_EEC : // EE + case NF_KEY_G : // G + case NF_KEY_GG : // GG + case NF_KEY_GGG : // GGG + case NF_KEY_R : // R + case NF_KEY_RR : // RR + bTimePart = FALSE; + sStrArray[i] = sKeyword[nTypeArray[i]]; // tTtT -> TTTT + nPos = nPos + sStrArray[i].Len(); + i++; + break; + case NF_KEY_THAI_T : + bThaiT = true; + sStrArray[i] = sKeyword[nTypeArray[i]]; + nPos = nPos + sStrArray[i].Len(); + i++; + break; + default: // andere Keywords + nTypeArray[i] = NF_SYMBOLTYPE_STRING; + nPos = nPos + sStrArray[i].Len(); + i++; + break; + } + } // of while + nCntPost = nCounter; // decimals (100th seconds) + if (bExp) + nCntExp = 1; // merkt AM/PM + } + break; // of NUMBERFORMAT_DATETIME + default: + break; + } + if (eScannedType == NUMBERFORMAT_SCIENTIFIC && + (nCntPre + nCntPost == 0 || nCntExp == 0)) + return nPos; + else if (eScannedType == NUMBERFORMAT_FRACTION && (nCntExp > 8 || nCntExp == 0)) + return nPos; + + if (bThaiT && !GetNatNumModifier()) + SetNatNumModifier(1); + + if ( bConvertMode ) + { // strings containing keywords of the target locale must be quoted, so + // the user sees the difference and is able to edit the format string + for ( i=0; i < nAnzStrings; i++ ) + { + if ( nTypeArray[i] == NF_SYMBOLTYPE_STRING && + sStrArray[i].GetChar(0) != '\"' ) + { + if ( bConvertSystemToSystem && eScannedType == NUMBERFORMAT_CURRENCY ) + { // don't stringize automatic currency, will be converted + if ( sStrArray[i] == sOldCurSymbol ) + continue; // for + // DM might be splitted into D and M + if ( sStrArray[i].Len() < sOldCurSymbol.Len() && + pChrCls->toUpper( sStrArray[i], 0, 1 ).GetChar(0) == + sOldCurString.GetChar(0) ) + { + String aTmp( sStrArray[i] ); + USHORT j = i + 1; + while ( aTmp.Len() < sOldCurSymbol.Len() && + j < nAnzStrings && + nTypeArray[j] == NF_SYMBOLTYPE_STRING ) + { + aTmp += sStrArray[j++]; + } + if ( pChrCls->upper( aTmp ) == sOldCurString ) + { + sStrArray[i++] = aTmp; + for ( ; iGetNumThousandSep(), + c) || StringEqualsChar( + pFormatter->GetNumDecimalSep(), + c) || (c == ' ' && + StringEqualsChar( + pFormatter->GetNumThousandSep(), + cNonBreakingSpace)))) + rString += sStrArray[i]; + else if ((eScannedType & NUMBERFORMAT_DATE) && + StringEqualsChar( + pFormatter->GetDateSep(), c)) + rString += sStrArray[i]; + else if ((eScannedType & NUMBERFORMAT_TIME) && + (StringEqualsChar( pLoc->getTimeSep(), + c) || + StringEqualsChar( + pLoc->getTime100SecSep(), c))) + rString += sStrArray[i]; + else if (eScannedType & NUMBERFORMAT_FRACTION) + rString += sStrArray[i]; + else + rString += c; + break; + default: + rString += sStrArray[i]; + } + } + else + rString += sStrArray[i]; + if ( RemoveQuotes( sStrArray[i] ) > 0 ) + { // update currency up to quoted string + if ( eScannedType == NUMBERFORMAT_CURRENCY ) + { // dM -> DM or DM -> $ in old automatic + // currency formats, oh my ..., why did we ever + // introduce them? + String aTmp( pChrCls->toUpper( + sStrArray[iPos], nArrPos, + sStrArray[iPos].Len()-nArrPos ) ); + xub_StrLen nCPos = aTmp.Search( sOldCurString ); + if ( nCPos != STRING_NOTFOUND ) + { + const String& rCur = + bConvertMode && bConvertSystemToSystem ? + GetCurSymbol() : sOldCurSymbol; + sStrArray[iPos].Replace( nArrPos+nCPos, + sOldCurString.Len(), rCur ); + rString.Replace( nStringPos+nCPos, + sOldCurString.Len(), rCur ); + } + nStringPos = rString.Len(); + if ( iPos == i ) + nArrPos = sStrArray[iPos].Len(); + else + nArrPos = sStrArray[iPos].Len() + sStrArray[i].Len(); + } + } + if ( iPos != i ) + { + sStrArray[iPos] += sStrArray[i]; + nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; + nAnzResStrings--; + } + i++; + } while ( i < nAnzStrings && nTypeArray[i] == NF_SYMBOLTYPE_STRING ); + if ( i < nAnzStrings ) + i--; // enter switch on next symbol again + if ( eScannedType == NUMBERFORMAT_CURRENCY && nStringPos < rString.Len() ) + { // same as above, since last RemoveQuotes + String aTmp( pChrCls->toUpper( + sStrArray[iPos], nArrPos, + sStrArray[iPos].Len()-nArrPos ) ); + xub_StrLen nCPos = aTmp.Search( sOldCurString ); + if ( nCPos != STRING_NOTFOUND ) + { + const String& rCur = + bConvertMode && bConvertSystemToSystem ? + GetCurSymbol() : sOldCurSymbol; + sStrArray[iPos].Replace( nArrPos+nCPos, + sOldCurString.Len(), rCur ); + rString.Replace( nStringPos+nCPos, + sOldCurString.Len(), rCur ); + } + } + } + break; + case NF_SYMBOLTYPE_CURRENCY : + { + rString += sStrArray[i]; + RemoveQuotes( sStrArray[i] ); + } + break; + case NF_KEY_THAI_T: + if (bThaiT && GetNatNumModifier() == 1) + { // Remove T from format code, will be replaced with a [NatNum1] prefix. + nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; + nAnzResStrings--; + } + else + rString += sStrArray[i]; + break; + case NF_SYMBOLTYPE_EMPTY : + // nothing + break; + default: + rString += sStrArray[i]; + } + i++; + } + return 0; +} + + +xub_StrLen ImpSvNumberformatScan::RemoveQuotes( String& rStr ) +{ + if ( rStr.Len() > 1 ) + { + sal_Unicode c = rStr.GetChar(0); + xub_StrLen n; + if ( c == '"' && rStr.GetChar( (n = xub_StrLen(rStr.Len()-1)) ) == '"' ) + { + rStr.Erase(n,1); + rStr.Erase(0,1); + return 2; + } + else if ( c == '\\' ) + { + rStr.Erase(0,1); + return 1; + } + } + return 0; +} + + +xub_StrLen ImpSvNumberformatScan::ScanFormat( String& rString, String& rComment ) +{ + xub_StrLen res = Symbol_Division(rString); //lexikalische Analyse + if (!res) + res = ScanType(rString); // Erkennung des Formattyps + if (!res) + res = FinalScan( rString, rComment ); // Typabhaengige Endanalyse + return res; // res = Kontrollposition + // res = 0 => Format ok +} + +void ImpSvNumberformatScan::CopyInfo(ImpSvNumberformatInfo* pInfo, USHORT nAnz) +{ + size_t i,j; + j = 0; + i = 0; + while (i < nAnz && j < NF_MAX_FORMAT_SYMBOLS) + { + if (nTypeArray[j] != NF_SYMBOLTYPE_EMPTY) + { + pInfo->sStrArray[i] = sStrArray[j]; + pInfo->nTypeArray[i] = nTypeArray[j]; + i++; + } + j++; + } + pInfo->eScannedType = eScannedType; + pInfo->bThousand = bThousand; + pInfo->nThousand = nThousand; + pInfo->nCntPre = nCntPre; + pInfo->nCntPost = nCntPost; + pInfo->nCntExp = nCntExp; +} + + diff --git a/svl/source/numbers/zforscan.hxx b/svl/source/numbers/zforscan.hxx new file mode 100644 index 000000000000..bc19ac5b633f --- /dev/null +++ b/svl/source/numbers/zforscan.hxx @@ -0,0 +1,278 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: zforscan.hxx,v $ + * $Revision: 1.24.136.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _ZFORSCAN_HXX +#define _ZFORSCAN_HXX + +#include +#include +#include +#include +#include +#include "nfsymbol.hxx" + +class SvNumberFormatter; +struct ImpSvNumberformatInfo; + + +const size_t NF_MAX_FORMAT_SYMBOLS = 100; +const size_t NF_MAX_DEFAULT_COLORS = 10; + +// Hack: nThousand==1000 => "Default" occurs in format string +const USHORT FLAG_STANDARD_IN_FORMAT = 1000; + +class ImpSvNumberformatScan +{ +public: + + ImpSvNumberformatScan( SvNumberFormatter* pFormatter ); + ~ImpSvNumberformatScan(); + void ChangeIntl(); // tauscht Keywords aus + + void ChangeNullDate(USHORT nDay, USHORT nMonth, USHORT nYear); + // tauscht Referenzdatum aus + void ChangeStandardPrec(short nPrec); // tauscht Standardprecision aus + + xub_StrLen ScanFormat( String& rString, String& rComment ); // Aufruf der Scan-Analyse + + void CopyInfo(ImpSvNumberformatInfo* pInfo, + USHORT nAnz); // Kopiert die FormatInfo + USHORT GetAnzResStrings() const { return nAnzResStrings; } + + const CharClass& GetChrCls() const { return *pFormatter->GetCharClass(); } + const LocaleDataWrapper& GetLoc() const { return *pFormatter->GetLocaleData(); } + CalendarWrapper& GetCal() const { return *pFormatter->GetCalendar(); } + + const String* GetKeywords() const + { + if ( bKeywordsNeedInit ) + InitKeywords(); + return sKeyword; + } + // Keywords used in output like TRUE and FALSE + const String& GetSpecialKeyword( NfKeywordIndex eIdx ) const + { + if ( !sKeyword[eIdx].Len() ) + InitSpecialKeyword( eIdx ); + return sKeyword[eIdx]; + } + const String& GetTrueString() const { return GetSpecialKeyword( NF_KEY_TRUE ); } + const String& GetFalseString() const { return GetSpecialKeyword( NF_KEY_FALSE ); } + const String& GetColorString() const { return GetKeywords()[NF_KEY_COLOR]; } + const String& GetRedString() const { return GetKeywords()[NF_KEY_RED]; } + const String& GetBooleanString() const { return GetKeywords()[NF_KEY_BOOLEAN]; } + const String& GetErrorString() const { return sErrStr; } + + Date* GetNullDate() const { return pNullDate; } + const String& GetStandardName() const + { + if ( bKeywordsNeedInit ) + InitKeywords(); + return sNameStandardFormat; + } + short GetStandardPrec() const { return nStandardPrec; } + const Color& GetRedColor() const { return StandardColor[4]; } + Color* GetColor(String& sStr); // Setzt Hauptfarben oder + // definierte Farben + + // the compatibility currency symbol for old automatic currency formats + const String& GetCurSymbol() const + { + if ( bCompatCurNeedInit ) + InitCompatCur(); + return sCurSymbol; + } + + // the compatibility currency abbreviation for CCC format code + const String& GetCurAbbrev() const + { + if ( bCompatCurNeedInit ) + InitCompatCur(); + return sCurAbbrev; + } + + // the compatibility currency symbol upper case for old automatic currency formats + const String& GetCurString() const + { + if ( bCompatCurNeedInit ) + InitCompatCur(); + return sCurString; + } + + void SetConvertMode(LanguageType eTmpLge, LanguageType eNewLge, + BOOL bSystemToSystem = FALSE ) + { + bConvertMode = TRUE; + eNewLnge = eNewLge; + eTmpLnge = eTmpLge; + bConvertSystemToSystem = bSystemToSystem; + } + void SetConvertMode(BOOL bMode) { bConvertMode = bMode; } + // Veraendert nur die Bool-Variable + // (zum temporaeren Unterbrechen des + // Convert-Modus) + BOOL GetConvertMode() const { return bConvertMode; } + LanguageType GetNewLnge() const { return eNewLnge; } + // Lesezugriff auf ConvertMode + // und Konvertierungsland/Spr. + LanguageType GetTmpLnge() const { return eTmpLnge; } + // Lesezugriff auf + // und Ausgangsland/Spr. + + /// get Thai T speciality + BYTE GetNatNumModifier() const { return nNatNumModifier; } + /// set Thai T speciality + void SetNatNumModifier( BYTE n ) { nNatNumModifier = n; } + + SvNumberFormatter* GetNumberformatter() { return pFormatter; } + // Zugriff auf Formatierer + // (fuer zformat.cxx) + + +private: // ---- privater Teil + NfKeywordTable sKeyword; // Schluesselworte der Syntax + Color StandardColor[NF_MAX_DEFAULT_COLORS]; + // Array der Standardfarben + Date* pNullDate; // 30Dec1899 + String sNameStandardFormat; // "Standard" + short nStandardPrec; // default Precision fuer Standardformat (2) + SvNumberFormatter* pFormatter; // Pointer auf die Formatliste + + String sStrArray[NF_MAX_FORMAT_SYMBOLS]; // Array der Symbole + short nTypeArray[NF_MAX_FORMAT_SYMBOLS]; // Array der Infos + // externe Infos: + USHORT nAnzResStrings; // Anzahl der Ergebnissymbole +#if !(defined SOLARIS && defined X86) + short eScannedType; // Typ gemaess Scan +#else + int eScannedType; // wg. Optimierung +#endif + BOOL bThousand; // Mit Tausenderpunkt + USHORT nThousand; // Zaehlt ....-Folgen + USHORT nCntPre; // Zaehlt Vorkommastellen + USHORT nCntPost; // Zaehlt Nachkommastellen + USHORT nCntExp; // Zaehlt Exp.Stellen, AM/PM + // interne Infos: + USHORT nAnzStrings; // Anzahl der Symbole + USHORT nRepPos; // Position eines '*' + USHORT nExpPos; // interne Position des E + USHORT nBlankPos; // interne Position des Blank + short nDecPos; // interne Pos. des , + BOOL bExp; // wird bei Lesen des E gesetzt + BOOL bFrac; // wird bei Lesen des / gesetzt + BOOL bBlank; // wird bei ' '(Fraction) ges. + BOOL bDecSep; // Wird beim ersten , gesetzt + mutable BOOL bKeywordsNeedInit; // Locale dependent keywords need to be initialized + mutable BOOL bCompatCurNeedInit; // Locale dependent compatibility currency need to be initialized + String sCurSymbol; // Currency symbol for compatibility format codes + String sCurString; // Currency symbol in upper case + String sCurAbbrev; // Currency abbreviation + String sErrStr; // String fuer Fehlerausgaben + + BOOL bConvertMode; // Wird im Convert-Mode gesetzt + // Land/Sprache, in die der + LanguageType eNewLnge; // gescannte String konvertiert + // wird (fuer Excel Filter) + // Land/Sprache, aus der der + LanguageType eTmpLnge; // gescannte String konvertiert + // wird (fuer Excel Filter) + BOOL bConvertSystemToSystem; // Whether the conversion is + // from one system locale to + // another system locale (in + // this case the automatic + // currency symbol is converted + // too). + + xub_StrLen nCurrPos; // Position des Waehrungssymbols + + BYTE nNatNumModifier; // Thai T speciality + + void InitKeywords() const; + void InitSpecialKeyword( NfKeywordIndex eIdx ) const; + void InitCompatCur() const; + +#ifdef _ZFORSCAN_CXX // ----- private Methoden ----- + void SetDependentKeywords(); + // Setzt die Sprachabh. Keyw. + void SkipStrings(USHORT& i,xub_StrLen& nPos);// Ueberspringt StringSymbole + USHORT PreviousKeyword(USHORT i); // Gibt Index des vorangeh. + // Schluesselworts oder 0 + USHORT NextKeyword(USHORT i); // Gibt Index des naechsten + // Schluesselworts oder 0 + sal_Unicode PreviousChar(USHORT i); // Gibt letzten Buchstaben + // vor der Position, + // skipt EMPTY, STRING, STAR, BLANK + sal_Unicode NextChar(USHORT i); // Gibt ersten Buchst. danach + short PreviousType( USHORT i ); // Gibt Typ vor Position, + // skipt EMPTY + BOOL IsLastBlankBeforeFrac(USHORT i); // True <=> es kommt kein ' ' + // mehr bis zum '/' + void Reset(); // Reset aller Variablen + // vor Analysestart + short GetKeyWord( const String& sSymbol, // determine keyword at nPos + xub_StrLen nPos ); // return 0 <=> not found + + inline BOOL IsAmbiguousE( short nKey ) // whether nKey is ambiguous E of NF_KEY_E/NF_KEY_EC + { + return (nKey == NF_KEY_EC || nKey == NF_KEY_E) && + (GetKeywords()[NF_KEY_EC] == GetKeywords()[NF_KEY_E]); + } + + // if 0 at strArray[i] is of S,00 or SS,00 or SS"any"00 in ScanType() or FinalScan() + BOOL Is100SecZero( USHORT i, BOOL bHadDecSep ); + + short Next_Symbol(const String& rStr, + xub_StrLen& nPos, + String& sSymbol); // Naechstes Symbol + xub_StrLen Symbol_Division(const String& rString);// lexikalische Voranalyse + xub_StrLen ScanType(const String& rString); // Analyse des Formattyps + xub_StrLen FinalScan( String& rString, String& rComment ); // Endanalyse mit Vorgabe + // des Typs + // -1:= error, return nPos in FinalScan; 0:= no calendar, 1:= calendar found + int FinalScanGetCalendar( xub_StrLen& nPos, USHORT& i, USHORT& nAnzResStrings ); + + /** Insert symbol into nTypeArray and sStrArray, e.g. grouping separator. + If at nPos-1 a symbol type NF_SYMBOLTYPE_EMPTY is present, that is + reused instead of shifting all one up and nPos is decremented! */ + bool InsertSymbol( USHORT & nPos, svt::NfSymbolType eType, const String& rStr ); + + static inline BOOL StringEqualsChar( const String& rStr, sal_Unicode ch ) + { return rStr.GetChar(0) == ch && rStr.Len() == 1; } + // Yes, for efficiency get the character first and then compare length + // because in most places where this is used the string is one char. + + // remove "..." and \... quotes from rStr, return how many chars removed + static xub_StrLen RemoveQuotes( String& rStr ); + +#endif //_ZFORSCAN_CXX +}; + + + +#endif // _ZFORSCAN_HXX diff --git a/svl/source/passwordcontainer/exports.map b/svl/source/passwordcontainer/exports.map new file mode 100644 index 000000000000..f4ed78b9e970 --- /dev/null +++ b/svl/source/passwordcontainer/exports.map @@ -0,0 +1,8 @@ +UDK_3_0_0 { + global: + component_getImplementationEnvironment; + component_writeInfo; + component_getFactory; + local: + *; +}; diff --git a/svl/source/passwordcontainer/makefile.mk b/svl/source/passwordcontainer/makefile.mk new file mode 100644 index 000000000000..31e1336ad966 --- /dev/null +++ b/svl/source/passwordcontainer/makefile.mk @@ -0,0 +1,66 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.6 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. +PRJNAME=svtools +TARGET=passwordcontainer.uno +LIBTARGET=NO +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ---------------------------------- + +.INCLUDE : settings.mk +DLLPRE= + +# --- Files ------------------------------------- + +SLOFILES= \ + $(SLO)$/passwordcontainer.obj\ + $(SLO)$/syscreds.obj + +SHL1TARGET= $(TARGET) +SHL1IMPLIB= i$(TARGET) +SHL1OBJS= $(SLOFILES) +SHL1STDLIBS=\ + $(UNOTOOLSLIB) \ + $(UCBHELPERLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(SALLIB) + +SHL1VERSIONMAP=exports.map +SHL1DEF= $(MISC)$/$(SHL1TARGET).def +DEF1NAME= $(SHL1TARGET) + +# --- Targets ---------------------------------- + +.INCLUDE : target.mk + diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx new file mode 100644 index 000000000000..5f9ce207ff6b --- /dev/null +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -0,0 +1,1595 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: passwordcontainer.cxx,v $ + * $Revision: 1.17 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include "passwordcontainer.hxx" + +#include +#include "cppuhelper/factory.hxx" +#include +#include +#include +#include + +#include +#include +#include + +#ifndef _TOOLS_INETSTRM_HXX +// @@@ #include +#endif + +using namespace std; +using namespace osl; +using namespace utl; +using namespace com::sun::star; +using namespace com::sun::star::uno; +using namespace com::sun::star::registry; +using namespace com::sun::star::lang; +using namespace com::sun::star::task; +using namespace com::sun::star::ucb; + +//------------------------------------------------------------------------- +//------------------------------------------------------------------------- + +static ::rtl::OUString createIndex( vector< ::rtl::OUString > lines ) +{ + ::rtl::OString aResult; + const sal_Char* pLine; + + for( unsigned int i = 0; i < lines.size(); i++ ) + { + if( i ) + aResult += ::rtl::OString( "__" ); + ::rtl::OString line = ::rtl::OUStringToOString( lines[i], RTL_TEXTENCODING_UTF8 ); + pLine = line.getStr(); + + while( *pLine ) + { + if( ( *pLine >= 'A' && *pLine <= 'Z' ) + || ( *pLine >= 'a' && *pLine <= 'z' ) + || ( *pLine >= '0' && *pLine <= '9' ) ) + { + aResult += ::rtl::OString::valueOf( *pLine ); + } + else + { + aResult += ::rtl::OString("_"); + aResult += ::rtl::OString::valueOf( (sal_Int32) *pLine, 16 ); + } + + pLine++; + } + } + + return ::rtl::OUString::createFromAscii( aResult.getStr() ); +} + +//------------------------------------------------------------------------- + +static vector< ::rtl::OUString > getInfoFromInd( ::rtl::OUString aInd ) +{ + vector< ::rtl::OUString > aResult; + sal_Bool aStart = sal_True; + + ::rtl::OString line = ::rtl::OUStringToOString( aInd, RTL_TEXTENCODING_ASCII_US ); + const sal_Char* pLine = line.getStr(); + do + { + ::rtl::OUString newItem; + if( !aStart ) + pLine += 2; + else + aStart = sal_False; + + while( *pLine && !( pLine[0] == '_' && pLine[1] == '_' )) + if( *pLine != '_' ) + { + newItem += ::rtl::OUString::valueOf( (sal_Unicode) *pLine ); + pLine++; + } + else + { + ::rtl::OUString aNum; + for( int i = 1; i < 3; i++ ) + { + if( !pLine[i] + || ( ( pLine[i] < '0' || pLine[i] > '9' ) + && ( pLine[i] < 'a' || pLine[i] > 'f' ) + && ( pLine[i] < 'A' || pLine[i] > 'F' ) ) ) + { + OSL_ENSURE( sal_False, "Wrong index syntax!\n" ); + return aResult; + } + + aNum += ::rtl::OUString::valueOf( (sal_Unicode) pLine[i] ); + } + + newItem += ::rtl::OUString::valueOf( (sal_Unicode) aNum.toInt32( 16 ) ); + pLine += 3; + } + + aResult.push_back( newItem ); + } while( pLine[0] == '_' && pLine[1] == '_' ); + + if( *pLine ) + OSL_ENSURE( sal_False, "Wrong index syntax!\n" ); + + return aResult; +} + +//------------------------------------------------------------------------- + +static sal_Bool shorterUrl( ::rtl::OUString& aURL ) +{ + sal_Int32 aInd = aURL.lastIndexOf( sal_Unicode( '/' ) ); + + if( aInd > 0 ) + { + sal_Int32 aPrevInd = aURL.lastIndexOf( sal_Unicode( '/' ), aInd ); + if ( aURL.indexOf( ::rtl::OUString::createFromAscii( "://" ) ) + != aPrevInd - 2 || + aInd != aURL.getLength() - 1 ) + { + aURL = aURL.copy( 0, aInd ); + return sal_True; + } + } + + return sal_False; +} + +//------------------------------------------------------------------------- + +static ::rtl::OUString getAsciiLine( const ::rtl::ByteSequence& buf ) +{ + ::rtl::OUString aResult; + + ::rtl::ByteSequence outbuf( buf.getLength()*2+1 ); + + for( int ind = 0; ind < buf.getLength(); ind++ ) + { + outbuf[ind*2] = ( ((sal_uInt8)buf[ind]) >> 4 ) + 'a'; + outbuf[ind*2+1] = ( ((sal_uInt8)buf[ind]) & 0x0f ) + 'a'; + } + outbuf[buf.getLength()*2] = '\0'; + + aResult = ::rtl::OUString::createFromAscii( (sal_Char*)outbuf.getArray() ); + + return aResult; +} + +//------------------------------------------------------------------------- + +static ::rtl::ByteSequence getBufFromAsciiLine( ::rtl::OUString line ) +{ + OSL_ENSURE( line.getLength() % 2 == 0, "Wrong syntax!\n" ); + ::rtl::OString tmpLine = ::rtl::OUStringToOString( line, RTL_TEXTENCODING_ASCII_US ); + ::rtl::ByteSequence aResult(line.getLength()/2); + + for( int ind = 0; ind < tmpLine.getLength()/2; ind++ ) + { + aResult[ind] = ( (sal_uInt8)( tmpLine.getStr()[ind*2] - 'a' ) << 4 ) | (sal_uInt8)( tmpLine.getStr()[ind*2+1] - 'a' ); + } + + return aResult; +} + +//------------------------------------------------------------------------- + +static Sequence< ::rtl::OUString > copyVectorToSequence( const vector< ::rtl::OUString >& original ) +{ + Sequence< ::rtl::OUString > newOne ( original.size() ); + for( unsigned int i = 0; i < original.size() ; i++ ) + newOne[i] = original[i]; + + return newOne; +} + +static vector< ::rtl::OUString > copySequenceToVector( const Sequence< ::rtl::OUString >& original ) +{ + vector< ::rtl::OUString > newOne ( original.getLength() ); + for( int i = 0; i < original.getLength() ; i++ ) + newOne[i] = original[i]; + + return newOne; +} + +//------------------------------------------------------------------------- +//------------------------------------------------------------------------- + +PassMap StorageItem::getInfo() +{ + PassMap aResult; + + Sequence< ::rtl::OUString > aNodeNames = ConfigItem::GetNodeNames( ::rtl::OUString::createFromAscii("Store") ); + sal_Int32 aNodeCount = aNodeNames.getLength(); + Sequence< ::rtl::OUString > aPropNames( aNodeCount ); + sal_Int32 aNodeInd; + + for( aNodeInd = 0; aNodeInd < aNodeCount; ++aNodeInd ) + { + aPropNames[aNodeInd] = ::rtl::OUString::createFromAscii( "Store/Passwordstorage['" ); + aPropNames[aNodeInd] += aNodeNames[aNodeInd]; + aPropNames[aNodeInd] += ::rtl::OUString::createFromAscii( "']/Password" ); + } + + Sequence< Any > aPropertyValues = ConfigItem::GetProperties( aPropNames ); + + if( aPropertyValues.getLength() != aNodeNames.getLength() ) + { + OSL_ENSURE( aPropertyValues.getLength() == aNodeNames.getLength(), "Problems during reading\n" ); + return aResult; + } + + for( aNodeInd = 0; aNodeInd < aNodeCount; ++aNodeInd ) + { + vector< ::rtl::OUString > aUrlUsr = getInfoFromInd( aNodeNames[aNodeInd] ); + + if( aUrlUsr.size() == 2 ) + { + ::rtl::OUString aUrl = aUrlUsr[0]; + ::rtl::OUString aName = aUrlUsr[1]; + + ::rtl::OUString aEPasswd; + aPropertyValues[aNodeInd] >>= aEPasswd; + + PassMap::iterator aIter = aResult.find( aUrl ); + if( aIter != aResult.end() ) + aIter->second.push_back( NamePassRecord( aName, aEPasswd ) ); + else + { + NamePassRecord aNewRecord( aName, aEPasswd ); + list< NamePassRecord > listToAdd( 1, aNewRecord ); + + aResult.insert( PairUrlRecord( aUrl, listToAdd ) ); + } + } + else + OSL_ENSURE( sal_False, "Wrong index sintax!\n" ); + } + + return aResult; +} + +//------------------------------------------------------------------------- + +void StorageItem::setUseStorage( sal_Bool bUse ) +{ + Sequence< ::rtl::OUString > sendNames(1); + Sequence< uno::Any > sendVals(1); + + sendNames[0] = ::rtl::OUString::createFromAscii( "UseStorage" ); + + sendVals[0] <<= bUse; + + ConfigItem::SetModified(); + ConfigItem::PutProperties( sendNames, sendVals ); +} + +//------------------------------------------------------------------------- + +sal_Bool StorageItem::useStorage() +{ + Sequence< ::rtl::OUString > aNodeNames( 1 ); + aNodeNames[0] = ::rtl::OUString::createFromAscii( "UseStorage" ); + + Sequence< Any > aPropertyValues = ConfigItem::GetProperties( aNodeNames ); + + if( aPropertyValues.getLength() != aNodeNames.getLength() ) + { + OSL_ENSURE( aPropertyValues.getLength() == aNodeNames.getLength(), "Problems during reading\n" ); + return sal_False; + } + + sal_Bool aResult = false; + aPropertyValues[0] >>= aResult; + + return aResult; +} + +//------------------------------------------------------------------------- + +sal_Bool StorageItem::getEncodedMP( ::rtl::OUString& aResult ) +{ + if( hasEncoded ) + { + aResult = mEncoded; + return sal_True; + } + + Sequence< ::rtl::OUString > aNodeNames( 2 ); + aNodeNames[0] = ::rtl::OUString::createFromAscii( "HasMaster" ); + aNodeNames[1] = ::rtl::OUString::createFromAscii( "Master" ); + + Sequence< Any > aPropertyValues = ConfigItem::GetProperties( aNodeNames ); + + if( aPropertyValues.getLength() != aNodeNames.getLength() ) + { + OSL_ENSURE( aPropertyValues.getLength() == aNodeNames.getLength(), "Problems during reading\n" ); + return sal_False; + } + + aPropertyValues[0] >>= hasEncoded; + aPropertyValues[1] >>= mEncoded; + + aResult = mEncoded; + + return hasEncoded; +} + +//------------------------------------------------------------------------- + +void StorageItem::setEncodedMP( const ::rtl::OUString& aEncoded, sal_Bool bAcceptEmpty ) +{ + Sequence< ::rtl::OUString > sendNames(2); + Sequence< uno::Any > sendVals(2); + + sendNames[0] = ::rtl::OUString::createFromAscii( "HasMaster" ); + sendNames[1] = ::rtl::OUString::createFromAscii( "Master" ); + + sal_Bool bHasMaster = ( aEncoded.getLength() > 0 || bAcceptEmpty ); + sendVals[0] <<= bHasMaster; + sendVals[1] <<= aEncoded; + + ConfigItem::SetModified(); + ConfigItem::PutProperties( sendNames, sendVals ); + + hasEncoded = bHasMaster; + mEncoded = aEncoded; +} + +//------------------------------------------------------------------------- + +void StorageItem::remove( const ::rtl::OUString& aURL, const ::rtl::OUString& aName ) +{ + vector < ::rtl::OUString > forIndex; + forIndex.push_back( aURL ); + forIndex.push_back( aName ); + + Sequence< ::rtl::OUString > sendSeq(1); + + sendSeq[0] = createIndex( forIndex ); + // sendSeq[0] = ::rtl::OUString::createFromAscii( "Store/Passwordstorage['" ); + // sendSeq[0] += createIndex( forIndex ); + // sendSeq[0] += ::rtl::OUString::createFromAscii( "']" ); + + ConfigItem::ClearNodeElements( ::rtl::OUString::createFromAscii( "Store" ), sendSeq ); +} + +//------------------------------------------------------------------------- + +void StorageItem::clear() +{ + Sequence< ::rtl::OUString > sendSeq(1); + + ConfigItem::ClearNodeSet( ::rtl::OUString::createFromAscii( "Store" ) ); +} + +//------------------------------------------------------------------------- + +void StorageItem::update( const ::rtl::OUString& aURL, const NamePassRecord& aRecord ) +{ + if ( !aRecord.HasPasswords( PERSISTENT_RECORD ) ) + { + OSL_ASSERT( "Unexpected storing of a record!" ); + return; + } + + vector < ::rtl::OUString > forIndex; + forIndex.push_back( aURL ); + forIndex.push_back( aRecord.GetUserName() ); + + Sequence< beans::PropertyValue > sendSeq(1); + + sendSeq[0].Name = ::rtl::OUString::createFromAscii( "Store/Passwordstorage['" ); + sendSeq[0].Name += createIndex( forIndex ); + sendSeq[0].Name += ::rtl::OUString::createFromAscii( "']/Password" ); + + sendSeq[0].Value <<= aRecord.GetPersPasswords(); + + ConfigItem::SetModified(); + ConfigItem::SetSetProperties( ::rtl::OUString::createFromAscii( "Store" ), sendSeq ); +} + +//------------------------------------------------------------------------- + +void StorageItem::Notify( const Sequence< ::rtl::OUString >& ) +{ + // this feature still should not be used + if( mainCont ) + mainCont->Notify(); +} + +//------------------------------------------------------------------------- + +void StorageItem::Commit() +{ + // Do nothing, we stored everything we want already +} + +//------------------------------------------------------------------------- +//------------------------------------------------------------------------- + +PasswordContainer::PasswordContainer( const Reference& xServiceFactory ): + m_pStorageFile( NULL ) +{ + // m_pStorageFile->Notify() can be called + ::osl::MutexGuard aGuard( mMutex ); + + mComponent = Reference< XComponent >( xServiceFactory, UNO_QUERY ); + mComponent->addEventListener( this ); + + m_pStorageFile = new StorageItem( this, ::rtl::OUString::createFromAscii( "Office.Common/Passwords" ) ); + if( m_pStorageFile ) + if( m_pStorageFile->useStorage() ) + m_aContainer = m_pStorageFile->getInfo(); +} + +//------------------------------------------------------------------------- + +PasswordContainer::~PasswordContainer() +{ + ::osl::MutexGuard aGuard( mMutex ); + + if( m_pStorageFile ) + { + delete m_pStorageFile; + m_pStorageFile = NULL; + } + + if( mComponent.is() ) + { + mComponent->removeEventListener(this); + mComponent = Reference< XComponent >(); + } +} + +//------------------------------------------------------------------------- + +void SAL_CALL PasswordContainer::disposing( const EventObject& ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( mMutex ); + + if( m_pStorageFile ) + { + delete m_pStorageFile; + m_pStorageFile = NULL; + } + + if( mComponent.is() ) + { + //mComponent->removeEventListener(this); + mComponent = Reference< XComponent >(); + } +} + +//------------------------------------------------------------------------- + +vector< ::rtl::OUString > PasswordContainer::DecodePasswords( const ::rtl::OUString& aLine, const ::rtl::OUString& aMasterPasswd ) throw(RuntimeException) +{ + if( aMasterPasswd.getLength() ) + { + rtlCipher aDecoder = rtl_cipher_create (rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeStream ); + OSL_ENSURE( aDecoder, "Can't create decoder\n" ); + + if( aDecoder ) + { + OSL_ENSURE( aMasterPasswd.getLength() == RTL_DIGEST_LENGTH_MD5 * 2, "Wrong master password format!\n" ); + + unsigned char code[RTL_DIGEST_LENGTH_MD5]; + for( int ind = 0; ind < RTL_DIGEST_LENGTH_MD5; ind++ ) + code[ ind ] = (char)(aMasterPasswd.copy( ind*2, 2 ).toInt32(16)); + + rtlCipherError result = rtl_cipher_init ( + aDecoder, rtl_Cipher_DirectionDecode, + code, RTL_DIGEST_LENGTH_MD5, NULL, 0 ); + + if( result == rtl_Cipher_E_None ) + { + ::rtl::ByteSequence aSeq = getBufFromAsciiLine( aLine ); + + ::rtl::ByteSequence resSeq( aSeq.getLength() ); + + result = rtl_cipher_decode ( aDecoder, (sal_uInt8*)aSeq.getArray(), aSeq.getLength(), + (sal_uInt8*)resSeq.getArray(), resSeq.getLength() ); + + ::rtl::OUString aPasswd( ( sal_Char* )resSeq.getArray(), resSeq.getLength(), RTL_TEXTENCODING_UTF8 ); + + rtl_cipher_destroy (aDecoder); + + return getInfoFromInd( aPasswd ); + } + + rtl_cipher_destroy (aDecoder); + } + } + else + { + OSL_ENSURE( sal_False, "No master password provided!\n" ); + // throw special exception + } + + // problems with decoding + OSL_ENSURE( sal_False, "Problem with decoding\n" ); + throw RuntimeException( ::rtl::OUString::createFromAscii( "Can't decode!" ), Reference< XInterface >() ); +} + + +//------------------------------------------------------------------------- + +::rtl::OUString PasswordContainer::EncodePasswords( vector< ::rtl::OUString > lines, const ::rtl::OUString& aMasterPasswd ) throw(RuntimeException) +{ + if( aMasterPasswd.getLength() ) + { + ::rtl::OString aSeq = ::rtl::OUStringToOString( createIndex( lines ), RTL_TEXTENCODING_UTF8 ); + + rtlCipher aEncoder = rtl_cipher_create (rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeStream ); + OSL_ENSURE( aEncoder, "Can't create encoder\n" ); + + if( aEncoder ) + { + OSL_ENSURE( aMasterPasswd.getLength() == RTL_DIGEST_LENGTH_MD5 * 2, "Wrong master password format!\n" ); + + unsigned char code[RTL_DIGEST_LENGTH_MD5]; + for( int ind = 0; ind < RTL_DIGEST_LENGTH_MD5; ind++ ) + code[ ind ] = (char)(aMasterPasswd.copy( ind*2, 2 ).toInt32(16)); + + rtlCipherError result = rtl_cipher_init ( + aEncoder, rtl_Cipher_DirectionEncode, + code, RTL_DIGEST_LENGTH_MD5, NULL, 0 ); + + if( result == rtl_Cipher_E_None ) + { + ::rtl::ByteSequence resSeq(aSeq.getLength()+1); + + result = rtl_cipher_encode ( aEncoder, (sal_uInt8*)aSeq.getStr(), aSeq.getLength()+1, + (sal_uInt8*)resSeq.getArray(), resSeq.getLength() ); + +/* + //test + rtlCipherError result = rtl_cipher_init ( + aEncoder, rtl_Cipher_DirectionDecode, + code, RTL_DIGEST_LENGTH_MD5, NULL, 0 ); + + + if( result == rtl_Cipher_E_None ) + { + ::rtl::OUString testOU = getAsciiLine( resSeq ); + ::rtl::ByteSequence aSeq1 = getBufFromAsciiLine( testOU ); + + ::rtl::ByteSequence resSeq1( aSeq1.getLength() ); + + if( resSeq.getLength() == aSeq1.getLength() ) + { + for( int ind = 0; ind < aSeq1.getLength(); ind++ ) + if( resSeq[ind] != aSeq1[ind] ) + testOU = ::rtl::OUString(); + } + + result = rtl_cipher_decode ( aEncoder, (sal_uInt8*)aSeq1.getArray(), aSeq1.getLength(), + (sal_uInt8*)resSeq1.getArray(), resSeq1.getLength() ); + + ::rtl::OUString aPasswd( ( sal_Char* )resSeq1.getArray(), resSeq1.getLength(), RTL_TEXTENCODING_UTF8 ); + } +*/ + + rtl_cipher_destroy (aEncoder); + + if( result == rtl_Cipher_E_None ) + return getAsciiLine( resSeq ); + + } + + rtl_cipher_destroy (aEncoder); + } + } + else + { + OSL_ENSURE( sal_False, "No master password provided!\n" ); + // throw special exception + } + + // problems with encoding + OSL_ENSURE( sal_False, "Problem with encoding\n" ); + throw RuntimeException( ::rtl::OUString::createFromAscii( "Can't encode!" ), Reference< XInterface >() ); +} + +//------------------------------------------------------------------------- + +void PasswordContainer::UpdateVector( const ::rtl::OUString& aURL, list< NamePassRecord >& toUpdate, NamePassRecord& aRecord, sal_Bool writeFile ) throw(RuntimeException) +{ + for( list< NamePassRecord >::iterator aNPIter = toUpdate.begin(); aNPIter != toUpdate.end(); aNPIter++ ) + if( aNPIter->GetUserName().equals( aRecord.GetUserName() ) ) + { + if( aRecord.HasPasswords( MEMORY_RECORD ) ) + aNPIter->SetMemPasswords( aRecord.GetMemPasswords() ); + + if( aRecord.HasPasswords( PERSISTENT_RECORD ) ) + { + aNPIter->SetPersPasswords( aRecord.GetPersPasswords() ); + + if( writeFile ) + { + // the password must be already encoded + m_pStorageFile->update( aURL, aRecord ); // change existing ( aURL, aName ) record in the configfile + } + } + + return; + } + + + if( aRecord.HasPasswords( PERSISTENT_RECORD ) && writeFile ) + { + // the password must be already encoded + m_pStorageFile->update( aURL, aRecord ); // add new aName to the existing url + } + + toUpdate.insert( toUpdate.begin(), aRecord ); +} + +//------------------------------------------------------------------------- + +UserRecord PasswordContainer::CopyToUserRecord( const NamePassRecord& aRecord, sal_Bool& io_bTryToDecode, const Reference< XInteractionHandler >& aHandler ) +{ + ::std::vector< ::rtl::OUString > aPasswords; + if( aRecord.HasPasswords( MEMORY_RECORD ) ) + aPasswords = aRecord.GetMemPasswords(); + + if( io_bTryToDecode && aRecord.HasPasswords( PERSISTENT_RECORD ) ) + { + try + { + ::std::vector< ::rtl::OUString > aDecodedPasswords = DecodePasswords( aRecord.GetPersPasswords(), GetMasterPassword( aHandler ) ); + aPasswords.insert( aPasswords.end(), aDecodedPasswords.begin(), aDecodedPasswords.end() ); + } + catch( NoMasterException& ) + { + // if master password could not be detected the entry will be just ignored + io_bTryToDecode = sal_False; + } + } + + return UserRecord( aRecord.GetUserName(), copyVectorToSequence( aPasswords ) ); +} + +//------------------------------------------------------------------------- + +Sequence< UserRecord > PasswordContainer::CopyToUserRecordSequence( const list< NamePassRecord >& original, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) +{ + Sequence< UserRecord > aResult( original.size() ); + sal_uInt32 nInd = 0; + sal_Bool bTryToDecode = sal_True; + + for( list< NamePassRecord >::const_iterator aNPIter = original.begin(); + aNPIter != original.end(); + aNPIter++, nInd++ ) + { + aResult[nInd] = CopyToUserRecord( *aNPIter, bTryToDecode, aHandler ); + } + + return aResult; +} + +//------------------------------------------------------------------------- + +void SAL_CALL PasswordContainer::add( const ::rtl::OUString& Url, const ::rtl::OUString& UserName, const Sequence< ::rtl::OUString >& Passwords, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( mMutex ); + + PrivateAdd( Url, UserName, Passwords, MEMORY_RECORD, aHandler ); +} + +//------------------------------------------------------------------------- + +void SAL_CALL PasswordContainer::addPersistent( const ::rtl::OUString& Url, const ::rtl::OUString& UserName, const Sequence< ::rtl::OUString >& Passwords, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( mMutex ); + + PrivateAdd( Url, UserName, Passwords, PERSISTENT_RECORD, aHandler ); +} + +//------------------------------------------------------------------------- + +void PasswordContainer::PrivateAdd( const ::rtl::OUString& Url, const ::rtl::OUString& UserName, const Sequence< ::rtl::OUString >& Passwords, char Mode, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) +{ + NamePassRecord aRecord( UserName ); + ::std::vector< ::rtl::OUString > aStorePass = copySequenceToVector( Passwords ); + + if( Mode == PERSISTENT_RECORD ) + aRecord.SetPersPasswords( EncodePasswords( aStorePass, GetMasterPassword( aHandler ) ) ); + else if( Mode == MEMORY_RECORD ) + aRecord.SetMemPasswords( aStorePass ); + else + { + OSL_ASSERT( "Unexpected persistence status!" ); + return; + } + + if( !m_aContainer.empty() ) + { + PassMap::iterator aIter = m_aContainer.find( Url ); + + if( aIter != m_aContainer.end() ) + { + UpdateVector( aIter->first, aIter->second, aRecord, sal_True ); + return; + } + } + + list< NamePassRecord > listToAdd( 1, aRecord ); + m_aContainer.insert( PairUrlRecord( Url, listToAdd ) ); + + if( Mode == PERSISTENT_RECORD && m_pStorageFile && m_pStorageFile->useStorage() ) + m_pStorageFile->update( Url, aRecord ); + +} + +//------------------------------------------------------------------------- + + +UrlRecord SAL_CALL PasswordContainer::find( const ::rtl::OUString& aURL, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) +{ + return find( aURL, rtl::OUString(), false, aHandler ); +} + +//------------------------------------------------------------------------- + +UrlRecord SAL_CALL PasswordContainer::findForName( const ::rtl::OUString& aURL, const ::rtl::OUString& aName, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) +{ + return find( aURL, aName, true, aHandler ); +} + +//------------------------------------------------------------------------- + +Sequence< UserRecord > PasswordContainer::FindUsr( const list< NamePassRecord >& userlist, const ::rtl::OUString& aName, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) +{ + sal_uInt32 nInd = 0; + for( list< NamePassRecord >::const_iterator aNPIter = userlist.begin(); + aNPIter != userlist.end(); + aNPIter++, nInd++ ) + { + if( aNPIter->GetUserName().equals( aName ) ) + { + Sequence< UserRecord > aResult(1); + sal_Bool bTryToDecode = sal_True; + aResult[0] = CopyToUserRecord( *aNPIter, bTryToDecode, aHandler ); + + return aResult; + } + } + + return Sequence< UserRecord >(); +} + +//------------------------------------------------------------------------- + +bool PasswordContainer::createUrlRecord( + const PassMap::iterator & rIter, + bool bName, + const ::rtl::OUString & aName, + const Reference< XInteractionHandler >& aHandler, + UrlRecord & rRec ) + throw( RuntimeException ) +{ + if ( bName ) + { + Sequence< UserRecord > aUsrRec + = FindUsr( rIter->second, aName, aHandler ); + if( aUsrRec.getLength() ) + { + rRec = UrlRecord( rIter->first, aUsrRec ); + return true; + } + } + else + { + rRec = UrlRecord( + rIter->first, + CopyToUserRecordSequence( rIter->second, aHandler ) ); + return true; + } + return false; +} + +//------------------------------------------------------------------------- + +UrlRecord PasswordContainer::find( + const ::rtl::OUString& aURL, + const ::rtl::OUString& aName, + bool bName, // only needed to support empty user names + const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( mMutex ); + + if( !m_aContainer.empty() && aURL.getLength() ) + { + ::rtl::OUString aUrl( aURL ); + + // each iteration remove last '/...' section from the aUrl + // while it's possible, up to the most left '://' + do + { + // first look for /somename and then look for /somename/... + PassMap::iterator aIter = m_aContainer.find( aUrl ); + if( aIter != m_aContainer.end() ) + { + UrlRecord aRec; + if ( createUrlRecord( aIter, bName, aName, aHandler, aRec ) ) + return aRec; + } + else + { + ::rtl::OUString tmpUrl( aUrl ); + if ( tmpUrl.getStr()[tmpUrl.getLength() - 1] != (sal_Unicode)'/' ) + tmpUrl += ::rtl::OUString::createFromAscii( "/" ); + + aIter = m_aContainer.lower_bound( tmpUrl ); + if( aIter != m_aContainer.end() && aIter->first.match( tmpUrl ) ) + { + UrlRecord aRec; + if ( createUrlRecord( aIter, bName, aName, aHandler, aRec ) ) + return aRec; + } + } + } + while( shorterUrl( aUrl ) && aUrl.getLength() ); + } + + return UrlRecord(); +} + +//------------------------------------------------------------------------- +::rtl::OUString PasswordContainer::GetDefaultMasterPassword() +{ + ::rtl::OUString aResult; + for ( sal_Int32 nInd = 0; nInd < RTL_DIGEST_LENGTH_MD5; nInd++ ) + aResult += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "aa" ) ); + + return aResult; +} + +//------------------------------------------------------------------------- +::rtl::OUString PasswordContainer::RequestPasswordFromUser( PasswordRequestMode aRMode, const uno::Reference< task::XInteractionHandler >& xHandler ) +{ + // empty string means that the call was cancelled or just failed + ::rtl::OUString aResult; + + if ( xHandler.is() ) + { + ::rtl::Reference< MasterPasswordRequest_Impl > xRequest = new MasterPasswordRequest_Impl( aRMode ); + + xHandler->handle( xRequest.get() ); + + ::rtl::Reference< ucbhelper::InteractionContinuation > xSelection = xRequest->getSelection(); + + if ( xSelection.is() ) + { + Reference< XInteractionAbort > xAbort( xSelection.get(), UNO_QUERY ); + if ( !xAbort.is() ) + { + const ::rtl::Reference< ucbhelper::InteractionSupplyAuthentication > & xSupp + = xRequest->getAuthenticationSupplier(); + + aResult = xSupp->getPassword(); + } + } + } + + return aResult; +} + +//------------------------------------------------------------------------- + +::rtl::OUString PasswordContainer::GetMasterPassword( const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) +{ + PasswordRequestMode aRMode = PasswordRequestMode_PASSWORD_ENTER; + if( !m_pStorageFile || !m_pStorageFile->useStorage() ) + throw NoMasterException( ::rtl::OUString::createFromAscii( "Password storing is not active!" ), Reference< XInterface >(), aRMode ); + + if( !m_aMasterPasswd.getLength() && aHandler.is() ) + { + ::rtl::OUString aEncodedMP; + sal_Bool bAskAgain = sal_False; + sal_Bool bDefaultPassword = sal_False; + + if( !m_pStorageFile->getEncodedMP( aEncodedMP ) ) + aRMode = PasswordRequestMode_PASSWORD_CREATE; + else if ( !aEncodedMP.getLength() ) + { + m_aMasterPasswd = GetDefaultMasterPassword(); + bDefaultPassword = sal_True; + } + + if ( !bDefaultPassword ) + { + do { + bAskAgain = sal_False; + + ::rtl::OUString aPass = RequestPasswordFromUser( aRMode, aHandler ); + if ( aPass.getLength() ) + { + if( aRMode == PasswordRequestMode_PASSWORD_CREATE ) + { + m_aMasterPasswd = aPass; + vector< ::rtl::OUString > aMaster( 1, m_aMasterPasswd ); + + m_pStorageFile->setEncodedMP( EncodePasswords( aMaster, m_aMasterPasswd ) ); + } + else + { + vector< ::rtl::OUString > aRM( DecodePasswords( aEncodedMP, aPass ) ); + if( !aRM.size() || !aPass.equals( aRM[0] ) ) + { + bAskAgain = sal_True; + aRMode = PasswordRequestMode_PASSWORD_REENTER; + } + else + m_aMasterPasswd = aPass; + } + } + + } while( bAskAgain ); + } + } + + if ( !m_aMasterPasswd.getLength() ) + throw NoMasterException( ::rtl::OUString::createFromAscii( "No master password!" ), Reference< XInterface >(), aRMode ); + + return m_aMasterPasswd; +} + +//------------------------------------------------------------------------- + +void SAL_CALL PasswordContainer::remove( const ::rtl::OUString& aURL, const ::rtl::OUString& aName ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( mMutex ); + + ::rtl::OUString aUrl( aURL ); + if( !m_aContainer.empty() ) + { + PassMap::iterator aIter = m_aContainer.find( aUrl ); + + if( aIter == m_aContainer.end() ) + { + sal_Int32 aInd = aUrl.lastIndexOf( sal_Unicode( '/' ) ); + if( aInd > 0 && aUrl.getLength()-1 == aInd ) + aUrl = aUrl.copy( 0, aUrl.getLength() - 1 ); + else + aUrl += ::rtl::OUString::createFromAscii( "/" ); + + aIter = m_aContainer.find( aUrl ); + } + + if( aIter != m_aContainer.end() ) + { + for( list< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); aNPIter++ ) + if( aNPIter->GetUserName().equals( aName ) ) + { + if( aNPIter->HasPasswords( PERSISTENT_RECORD ) && m_pStorageFile ) + m_pStorageFile->remove( aURL, aName ); // remove record ( aURL, aName ) + + // the iterator will not be used any more so it can be removed directly + aIter->second.erase( aNPIter ); + + if( aIter->second.begin() == aIter->second.end() ) + m_aContainer.erase( aIter ); + + return; + } + } + } +} + +//------------------------------------------------------------------------- + +void SAL_CALL PasswordContainer::removePersistent( const ::rtl::OUString& aURL, const ::rtl::OUString& aName ) throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( mMutex ); + + ::rtl::OUString aUrl( aURL ); + if( !m_aContainer.empty() ) + { + PassMap::iterator aIter = m_aContainer.find( aUrl ); + + if( aIter == m_aContainer.end() ) + { + sal_Int32 aInd = aUrl.lastIndexOf( sal_Unicode( '/' ) ); + if( aInd > 0 && aUrl.getLength()-1 == aInd ) + aUrl = aUrl.copy( 0, aUrl.getLength() - 1 ); + else + aUrl += ::rtl::OUString::createFromAscii( "/" ); + + aIter = m_aContainer.find( aUrl ); + } + + if( aIter != m_aContainer.end() ) + { + for( list< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); aNPIter++ ) + if( aNPIter->GetUserName().equals( aName ) ) + { + if( aNPIter->HasPasswords( PERSISTENT_RECORD ) ) + { + // TODO/LATER: should the password be converted to MemoryPassword? + aNPIter->RemovePasswords( PERSISTENT_RECORD ); + + if ( m_pStorageFile ) + m_pStorageFile->remove( aURL, aName ); // remove record ( aURL, aName ) + } + + if( !aNPIter->HasPasswords( MEMORY_RECORD ) ) + aIter->second.erase( aNPIter ); + + if( aIter->second.begin() == aIter->second.end() ) + m_aContainer.erase( aIter ); + + return; + } + } + } +} +//------------------------------------------------------------------------- + +void SAL_CALL PasswordContainer::removeAllPersistent() throw(RuntimeException) +{ + ::osl::MutexGuard aGuard( mMutex ); + + if( m_pStorageFile ) + m_pStorageFile->clear(); + + for( PassMap::iterator aIter = m_aContainer.begin(); aIter != m_aContainer.end(); ) + { + for( list< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); ) + { + if( aNPIter->HasPasswords( PERSISTENT_RECORD ) ) + { + // TODO/LATER: should the password be converted to MemoryPassword? + aNPIter->RemovePasswords( PERSISTENT_RECORD ); + + if ( m_pStorageFile ) + m_pStorageFile->remove( aIter->first, aNPIter->GetUserName() ); // remove record ( aURL, aName ) + } + + if( !aNPIter->HasPasswords( MEMORY_RECORD ) ) + { + list< NamePassRecord >::iterator aIterToDelete( aNPIter ); + aNPIter++; + aIter->second.erase( aIterToDelete ); + } + else + aNPIter++; + } + + if( aIter->second.begin() == aIter->second.end() ) + { + PassMap::iterator aIterToDelete( aIter ); + aIter++; + m_aContainer.erase( aIterToDelete ); + } + else + aIter++; + } +} +//------------------------------------------------------------------------- + +Sequence< UrlRecord > SAL_CALL PasswordContainer::getAllPersistent( const Reference< XInteractionHandler >& xHandler ) throw(RuntimeException) +{ + Sequence< UrlRecord > aResult; + + ::osl::MutexGuard aGuard( mMutex ); + for( PassMap::iterator aIter = m_aContainer.begin(); aIter != m_aContainer.end(); aIter++ ) + { + Sequence< UserRecord > aUsers; + for( list< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); aNPIter++ ) + if( aNPIter->HasPasswords( PERSISTENT_RECORD ) ) + { + sal_Int32 oldLen = aUsers.getLength(); + aUsers.realloc( oldLen + 1 ); + aUsers[ oldLen ] = UserRecord( aNPIter->GetUserName(), copyVectorToSequence( DecodePasswords( aNPIter->GetPersPasswords(), GetMasterPassword( xHandler ) ) ) ); + } + + if( aUsers.getLength() ) + { + sal_Int32 oldLen = aResult.getLength(); + aResult.realloc( oldLen + 1 ); + aResult[ oldLen ] = UrlRecord( aIter->first, aUsers ); + } + } + + return aResult; +} + +//------------------------------------------------------------------------- +sal_Bool SAL_CALL PasswordContainer::authorizateWithMasterPassword( const uno::Reference< task::XInteractionHandler >& xHandler ) + throw (uno::RuntimeException) +{ + sal_Bool bResult = sal_False; + ::rtl::OUString aEncodedMP; + uno::Reference< task::XInteractionHandler > xTmpHandler = xHandler; + ::osl::MutexGuard aGuard( mMutex ); + + // the method should fail if there is no master password + if( m_pStorageFile && m_pStorageFile->useStorage() && m_pStorageFile->getEncodedMP( aEncodedMP ) ) + { + if ( !aEncodedMP.getLength() ) + { + // this is a default master password + // no UI is necessary + bResult = sal_True; + } + else + { + if ( !xTmpHandler.is() ) + { + uno::Reference< lang::XMultiServiceFactory > xFactory( mComponent, uno::UNO_QUERY_THROW ); + xTmpHandler.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ), uno::UNO_QUERY_THROW ); + } + + if ( m_aMasterPasswd.getLength() ) + { + // there is a password, it should be just rechecked + PasswordRequestMode aRMode = PasswordRequestMode_PASSWORD_ENTER; + ::rtl::OUString aPass; + + do { + aPass = RequestPasswordFromUser( aRMode, xTmpHandler ); + bResult = ( aPass.getLength() && aPass.equals( m_aMasterPasswd ) ); + aRMode = PasswordRequestMode_PASSWORD_REENTER; // further questions with error notification + } while( !bResult && aPass.getLength() ); + } + else + { + try + { + // ask for the password, if user provide no correct password an exception will be thrown + bResult = ( GetMasterPassword( xTmpHandler ).getLength() > 0 ); + } + catch( uno::Exception& ) + {} + } + } + } + + return bResult; +} + +//------------------------------------------------------------------------- +sal_Bool SAL_CALL PasswordContainer::changeMasterPassword( const uno::Reference< task::XInteractionHandler >& xHandler ) + throw (uno::RuntimeException) +{ + sal_Bool bResult = sal_False; + uno::Reference< task::XInteractionHandler > xTmpHandler = xHandler; + ::osl::MutexGuard aGuard( mMutex ); + + if ( m_pStorageFile && m_pStorageFile->useStorage() ) + { + if ( !xTmpHandler.is() ) + { + uno::Reference< lang::XMultiServiceFactory > xFactory( mComponent, uno::UNO_QUERY_THROW ); + xTmpHandler.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ), uno::UNO_QUERY_THROW ); + } + + sal_Bool bCanChangePassword = sal_True; + // if there is already a stored master password it should be entered by the user before the change happen + ::rtl::OUString aEncodedMP; + if( m_aMasterPasswd.getLength() || m_pStorageFile->getEncodedMP( aEncodedMP ) ) + bCanChangePassword = authorizateWithMasterPassword( xTmpHandler ); + + if ( bCanChangePassword ) + { + // ask for the new password, but do not set it + PasswordRequestMode aRMode = PasswordRequestMode_PASSWORD_CREATE; + ::rtl::OUString aPass = RequestPasswordFromUser( aRMode, xTmpHandler ); + + if ( aPass.getLength() ) + { + // get all the persistent entries if it is possible + Sequence< UrlRecord > aPersistent = getAllPersistent( uno::Reference< task::XInteractionHandler >() ); + + // remove the master password and the entries persistence + removeMasterPassword(); + + // store the new master password + m_aMasterPasswd = aPass; + vector< ::rtl::OUString > aMaster( 1, m_aMasterPasswd ); + m_pStorageFile->setEncodedMP( EncodePasswords( aMaster, m_aMasterPasswd ) ); + + // store all the entries with the new password + for ( int nURLInd = 0; nURLInd < aPersistent.getLength(); nURLInd++ ) + for ( int nNameInd = 0; nNameInd< aPersistent[nURLInd].UserList.getLength(); nNameInd++ ) + addPersistent( aPersistent[nURLInd].Url, + aPersistent[nURLInd].UserList[nNameInd].UserName, + aPersistent[nURLInd].UserList[nNameInd].Passwords, + uno::Reference< task::XInteractionHandler >() ); + + bResult = sal_True; + } + } + } + + return bResult; +} + +//------------------------------------------------------------------------- +void SAL_CALL PasswordContainer::removeMasterPassword() + throw (uno::RuntimeException) +{ + // remove all the stored passwords and the master password + removeAllPersistent(); + + ::osl::MutexGuard aGuard( mMutex ); + if ( m_pStorageFile ) + { + m_aMasterPasswd = ::rtl::OUString(); + m_pStorageFile->setEncodedMP( ::rtl::OUString() ); // let the master password be removed from configuration + } +} + +//------------------------------------------------------------------------- +::sal_Bool SAL_CALL PasswordContainer::hasMasterPassword( ) + throw (::com::sun::star::uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( mMutex ); + + if ( !m_pStorageFile ) + throw uno::RuntimeException(); + + ::rtl::OUString aEncodedMP; + return ( m_pStorageFile->useStorage() && m_pStorageFile->getEncodedMP( aEncodedMP ) ); +} + +//------------------------------------------------------------------------- +::sal_Bool SAL_CALL PasswordContainer::allowPersistentStoring( ::sal_Bool bAllow ) + throw (::com::sun::star::uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( mMutex ); + + if ( !m_pStorageFile ) + throw uno::RuntimeException(); + + if ( !bAllow ) + removeMasterPassword(); + + if ( m_pStorageFile->useStorage() == bAllow ) + return bAllow; + + m_pStorageFile->setUseStorage( bAllow ); + return !bAllow; +} + +//------------------------------------------------------------------------- +::sal_Bool SAL_CALL PasswordContainer::isPersistentStoringAllowed() + throw (::com::sun::star::uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( mMutex ); + + if ( !m_pStorageFile ) + throw uno::RuntimeException(); + + return m_pStorageFile->useStorage(); +} + +//------------------------------------------------------------------------- +::sal_Bool SAL_CALL PasswordContainer::useDefaultMasterPassword( const uno::Reference< task::XInteractionHandler >& xHandler ) + throw ( uno::RuntimeException ) +{ + sal_Bool bResult = sal_False; + uno::Reference< task::XInteractionHandler > xTmpHandler = xHandler; + ::osl::MutexGuard aGuard( mMutex ); + + if ( m_pStorageFile && m_pStorageFile->useStorage() ) + { + if ( !xTmpHandler.is() ) + { + uno::Reference< lang::XMultiServiceFactory > xFactory( mComponent, uno::UNO_QUERY_THROW ); + xTmpHandler.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ), uno::UNO_QUERY_THROW ); + } + + sal_Bool bCanChangePassword = sal_True; + // if there is already a stored nondefault master password it should be entered by the user before the change happen + ::rtl::OUString aEncodedMP; + if( m_pStorageFile->getEncodedMP( aEncodedMP ) && aEncodedMP.getLength() ) + bCanChangePassword = authorizateWithMasterPassword( xTmpHandler ); + + if ( bCanChangePassword ) + { + // generate the default password + ::rtl::OUString aPass = GetDefaultMasterPassword(); + if ( aPass.getLength() ) + { + // get all the persistent entries if it is possible + Sequence< UrlRecord > aPersistent = getAllPersistent( uno::Reference< task::XInteractionHandler >() ); + + // remove the master password and the entries persistence + removeMasterPassword(); + + // store the empty string to flag the default master password + m_aMasterPasswd = aPass; + m_pStorageFile->setEncodedMP( ::rtl::OUString(), sal_True ); + + // store all the entries with the new password + for ( int nURLInd = 0; nURLInd < aPersistent.getLength(); nURLInd++ ) + for ( int nNameInd = 0; nNameInd< aPersistent[nURLInd].UserList.getLength(); nNameInd++ ) + addPersistent( aPersistent[nURLInd].Url, + aPersistent[nURLInd].UserList[nNameInd].UserName, + aPersistent[nURLInd].UserList[nNameInd].Passwords, + uno::Reference< task::XInteractionHandler >() ); + + bResult = sal_True; + } + } + } + + return bResult; + +} + +//------------------------------------------------------------------------- +::sal_Bool SAL_CALL PasswordContainer::isDefaultMasterPasswordUsed() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( mMutex ); + + if ( !m_pStorageFile ) + throw uno::RuntimeException(); + + ::rtl::OUString aEncodedMP; + return ( m_pStorageFile->useStorage() && m_pStorageFile->getEncodedMP( aEncodedMP ) && !aEncodedMP.getLength() ); +} + + +//------------------------------------------------------------------------- +void SAL_CALL PasswordContainer::addUrl( const ::rtl::OUString& Url, ::sal_Bool MakePersistent ) + throw (uno::RuntimeException) +{ + mUrlContainer.add( Url, MakePersistent ); +} + +//------------------------------------------------------------------------- +::rtl::OUString SAL_CALL PasswordContainer::findUrl( const ::rtl::OUString& Url ) + throw (uno::RuntimeException) +{ + return mUrlContainer.find( Url ); +} + +//------------------------------------------------------------------------- +void SAL_CALL PasswordContainer::removeUrl( const ::rtl::OUString& Url ) + throw (uno::RuntimeException) +{ + mUrlContainer.remove( Url ); +} + +//------------------------------------------------------------------------- +uno::Sequence< ::rtl::OUString > SAL_CALL PasswordContainer::getUrls( ::sal_Bool OnlyPersistent ) + throw (uno::RuntimeException) +{ + return mUrlContainer.list( OnlyPersistent ); +} + +//------------------------------------------------------------------------- + +void PasswordContainer::Notify() +{ + ::osl::MutexGuard aGuard( mMutex ); + + PassMap::iterator aIter; + + // remove the cached persistent values in the memory + for( aIter = m_aContainer.begin(); aIter != m_aContainer.end(); aIter++ ) + { + for( list< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); ) + { + if( aNPIter->HasPasswords( PERSISTENT_RECORD ) ) + { + aNPIter->RemovePasswords( PERSISTENT_RECORD ); + + if ( m_pStorageFile ) + m_pStorageFile->remove( aIter->first, aNPIter->GetUserName() ); // remove record ( aURL, aName ) + } + + if( !aNPIter->HasPasswords( MEMORY_RECORD ) ) + { + list< NamePassRecord >::iterator aIterToDelete( aNPIter ); + aNPIter++; + aIter->second.erase( aIterToDelete ); + } + else + aNPIter++; + } + } + + PassMap addon; + if( m_pStorageFile ) + addon = m_pStorageFile->getInfo(); + + for( aIter = addon.begin(); aIter != addon.end(); aIter++ ) + { + PassMap::iterator aSearchIter = m_aContainer.find( aIter->first ); + if( aSearchIter != m_aContainer.end() ) + for( list< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); aNPIter++ ) + UpdateVector( aSearchIter->first, aSearchIter->second, *aNPIter, sal_False ); + else + m_aContainer.insert( PairUrlRecord( aIter->first, aIter->second ) ); + } +} + +//------------------------------------------------------------------------- + +::rtl::OUString SAL_CALL PasswordContainer::getImplementationName( ) throw(uno::RuntimeException) +{ + return impl_getStaticImplementationName(); +} + +//------------------------------------------------------------------------- + +sal_Bool SAL_CALL PasswordContainer::supportsService( const ::rtl::OUString& ServiceName ) throw(uno::RuntimeException) +{ + if ( ServiceName.compareToAscii("com.sun.star.task.PasswordContainer") == 0 ) + return sal_True; + else + return sal_False; +} + +//------------------------------------------------------------------------- + +Sequence< ::rtl::OUString > SAL_CALL PasswordContainer::getSupportedServiceNames( ) throw(uno::RuntimeException) +{ + return impl_getStaticSupportedServiceNames(); +} + +//------------------------------------------------------------------------- + +Sequence< ::rtl::OUString > SAL_CALL PasswordContainer::impl_getStaticSupportedServiceNames( ) throw(uno::RuntimeException) +{ + Sequence< ::rtl::OUString > aRet(1); + *aRet.getArray() = ::rtl::OUString::createFromAscii("com.sun.star.task.PasswordContainer"); + return aRet; +} + +//------------------------------------------------------------------------- + +::rtl::OUString SAL_CALL PasswordContainer::impl_getStaticImplementationName() throw(uno::RuntimeException) +{ + return ::rtl::OUString::createFromAscii("stardiv.svtools.PasswordContainer"); +} + +//------------------------------------------------------------------------- + +Reference< XInterface > SAL_CALL PasswordContainer::impl_createInstance( const Reference< XMultiServiceFactory >& xServiceManager ) throw( RuntimeException ) +{ + return Reference< XInterface >( *new PasswordContainer( xServiceManager ) ); +} + +//------------------------------------------------------------------------- + +Reference< XSingleServiceFactory > SAL_CALL PasswordContainer::impl_createFactory( const Reference< XMultiServiceFactory >& ServiceManager ) throw(RuntimeException) +{ + Reference< XSingleServiceFactory > xReturn( ::cppu::createOneInstanceFactory( ServiceManager, + PasswordContainer::impl_getStaticImplementationName(), + PasswordContainer::impl_createInstance, + PasswordContainer::impl_getStaticSupportedServiceNames())); + return xReturn ; + +} + +//------------------------------------------------------------------------- +//------------------------------------------------------------------------- + +MasterPasswordRequest_Impl::MasterPasswordRequest_Impl( PasswordRequestMode Mode ) +{ + MasterPasswordRequest aRequest; + + aRequest.Classification = InteractionClassification_ERROR; + aRequest.Mode = Mode; + + setRequest( makeAny( aRequest ) ); + + // Fill continuations... + Sequence< RememberAuthentication > aRememberModes( 1 ); + aRememberModes[ 0 ] = RememberAuthentication_NO; + + m_xAuthSupplier + = new ::ucbhelper::InteractionSupplyAuthentication( + this, + sal_False, // bCanSetRealm + sal_False, // bCanSetUserName + sal_True, // bCanSetPassword + sal_False, // bCanSetAccount + aRememberModes, // rRememberPasswordModes + RememberAuthentication_NO, // eDefaultRememberPasswordMode + aRememberModes, // rRememberAccountModes + RememberAuthentication_NO, // eDefaultRememberAccountMode + sal_False, // bCanUseSystemCredentials + sal_False // bDefaultUseSystemCredentials + ); + + Sequence< + Reference< XInteractionContinuation > > aContinuations( 3 ); + aContinuations[ 0 ] = new ::ucbhelper::InteractionAbort( this ); + aContinuations[ 1 ] = new ::ucbhelper::InteractionRetry( this ); + aContinuations[ 2 ] = m_xAuthSupplier.get(); + + setContinuations( aContinuations ); +} + +//------------------------------------------------------------------------- +//------------------------------------------------------------------------- + +extern "C" +{ +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( + const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( + void * /* pServiceManager */, void * pRegistryKey) +{ + if (pRegistryKey) + { + Reference< XRegistryKey > xRegistryKey ( + reinterpret_cast< XRegistryKey* >( pRegistryKey )); + Reference< XRegistryKey > xNewKey; + + xNewKey = xRegistryKey->createKey( + ::rtl::OUString::createFromAscii( "/stardiv.svtools.PasswordContainer/UNO/SERVICES" )); + xNewKey->createKey( ::rtl::OUString::createFromAscii("com.sun.star.task.PasswordContainer")); + + return sal_True; + } + return sal_False; +} + +SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( + const sal_Char * pImplementationName, void * pServiceManager, void * /* pRegistryKey */) +{ + void * pResult = 0; + if (pServiceManager) + { + Reference< XSingleServiceFactory > xFactory; + if (PasswordContainer::impl_getStaticImplementationName().compareToAscii (pImplementationName) == 0) + { + xFactory = PasswordContainer::impl_createFactory ( + reinterpret_cast< XMultiServiceFactory* >(pServiceManager)); + } + if (xFactory.is()) + { + xFactory->acquire(); + pResult = xFactory.get(); + } + } + return pResult; +} + +} // extern "C" diff --git a/svl/source/passwordcontainer/syscreds.cxx b/svl/source/passwordcontainer/syscreds.cxx new file mode 100644 index 000000000000..b8c223040e6d --- /dev/null +++ b/svl/source/passwordcontainer/syscreds.cxx @@ -0,0 +1,298 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: $ + * $Revision: $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "syscreds.hxx" +#include "com/sun/star/beans/PropertyValue.hpp" + +using namespace com::sun::star; + +SysCredentialsConfigItem::SysCredentialsConfigItem( + SysCredentialsConfig * pOwner ) +: utl::ConfigItem( rtl::OUString::createFromAscii( "Office.Common/Passwords" ), + CONFIG_MODE_IMMEDIATE_UPDATE ), + m_bInited( false ), + m_pOwner( pOwner ) +{ + uno::Sequence< ::rtl::OUString > aNode( 1 ); + aNode[ 0 ] = rtl::OUString::createFromAscii( + "Office.Common/Passwords/AuthenticateUsingSystemCredentials" ); + EnableNotification( aNode ); +} + +//virtual +void SysCredentialsConfigItem::Notify( + const uno::Sequence< rtl::OUString > & /*seqPropertyNames*/ ) +{ + { + ::osl::MutexGuard aGuard( m_aMutex ); + m_bInited = false; + // rebuild m_seqURLs + getSystemCredentialsURLs(); + } + m_pOwner->persistentConfigChanged(); +} + +uno::Sequence< rtl::OUString > +SysCredentialsConfigItem::getSystemCredentialsURLs() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !m_bInited ) + { + // read config item + uno::Sequence< ::rtl::OUString > aPropNames( 1 ); + aPropNames[ 0 ] = rtl::OUString::createFromAscii( + "AuthenticateUsingSystemCredentials" ); + uno::Sequence< uno::Any > aAnyValues( + utl::ConfigItem::GetProperties( aPropNames ) ); + + OSL_ENSURE( + aAnyValues.getLength() == 1, + "SysCredentialsConfigItem::getSystemCredentialsURLs: " + "Error reading config item!" ); + + uno::Sequence< rtl::OUString > aValues; + if ( ( aAnyValues[ 0 ] >>= aValues ) || + ( !aAnyValues[ 0 ].hasValue() ) ) + { + m_seqURLs = aValues; + m_bInited = true; + } + } + return m_seqURLs; +} + +void SysCredentialsConfigItem::setSystemCredentialsURLs( + const uno::Sequence< rtl::OUString > & seqURLList ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + // write config item. + uno::Sequence< rtl::OUString > aPropNames( 1 ); + uno::Sequence< uno::Any > aPropValues( 1 ); + aPropNames[ 0 ] + = ::rtl::OUString::createFromAscii( + "AuthenticateUsingSystemCredentials" ); + aPropValues[ 0 ] <<= seqURLList; + + utl::ConfigItem::SetModified(); + utl::ConfigItem::PutProperties( aPropNames, aPropValues ); + + m_seqURLs = seqURLList; + m_bInited = true; +} + +//============================================================================ + +namespace +{ + // TODO: This code is actually copied from svtools/source/passwordcontainer.cxx + bool removeLastSegment( ::rtl::OUString & aURL ) + { + sal_Int32 aInd = aURL.lastIndexOf( sal_Unicode( '/' ) ); + + if( aInd > 0 ) + { + sal_Int32 aPrevInd = aURL.lastIndexOf( sal_Unicode( '/' ), aInd ); + if ( aURL.indexOf( ::rtl::OUString::createFromAscii( "://" ) ) + != aPrevInd - 2 || + aInd != aURL.getLength() - 1 ) + { + aURL = aURL.copy( 0, aInd ); + return true; + } + } + + return false; + } + + bool findURL( StringSet const & rContainer, rtl::OUString const & aURL, rtl::OUString & aResult ) + { + // TODO: This code is actually copied from svtools/source/passwordcontainer.cxx + if( !rContainer.empty() && aURL.getLength() ) + { + ::rtl::OUString aUrl( aURL ); + + // each iteration remove last '/...' section from the aUrl + // while it's possible, up to the most left '://' + do + { + // first look for /somename and then look for /somename/... + StringSet::const_iterator aIter = rContainer.find( aUrl ); + if( aIter != rContainer.end() ) + { + aResult = *aIter; + return true; + } + else + { + ::rtl::OUString tmpUrl( aUrl ); + if ( tmpUrl.getStr()[tmpUrl.getLength() - 1] != (sal_Unicode)'/' ) + tmpUrl += ::rtl::OUString::createFromAscii( "/" ); + + aIter = rContainer.lower_bound( tmpUrl ); + if( aIter != rContainer.end() && aIter->match( tmpUrl ) ) + { + aResult = *aIter; + return true; + } + } + } + while( removeLastSegment( aUrl ) && aUrl.getLength() ); + } + aResult = rtl::OUString(); + return false; + } + +} // namespace + +SysCredentialsConfig::SysCredentialsConfig() +: m_aConfigItem( this ), + m_bCfgInited( false ) +{ +} + +void SysCredentialsConfig::initCfg() +{ + osl::MutexGuard aGuard( m_aMutex ); + if ( !m_bCfgInited ) + { + uno::Sequence< rtl::OUString > aURLs( + m_aConfigItem.getSystemCredentialsURLs() ); + for ( sal_Int32 n = 0; n < aURLs.getLength(); ++n ) + m_aCfgContainer.insert( aURLs[ n ] ); + + m_bCfgInited = true; + } +} + +void SysCredentialsConfig::writeCfg() +{ + osl::MutexGuard aGuard( m_aMutex ); + + OSL_ENSURE( m_bCfgInited, "SysCredentialsConfig::writeCfg : not initialized!" ); + + uno::Sequence< rtl::OUString > aURLs( m_aCfgContainer.size() ); + StringSet::const_iterator it = m_aCfgContainer.begin(); + const StringSet::const_iterator end = m_aCfgContainer.end(); + sal_Int32 n = 0; + + while ( it != end ) + { + aURLs[ n ] = *it; + ++it; + ++n; + } + + m_aConfigItem.setSystemCredentialsURLs( aURLs ); +} + +rtl::OUString SysCredentialsConfig::find( rtl::OUString const & aURL ) +{ + osl::MutexGuard aGuard( m_aMutex ); + rtl::OUString aResult; + if ( findURL( m_aMemContainer, aURL, aResult ) ) + return aResult; + + initCfg(); + if ( findURL( m_aCfgContainer, aURL, aResult ) ) + return aResult; + + return rtl::OUString(); +} + +void SysCredentialsConfig::add( rtl::OUString const & rURL, bool bPersistent ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( bPersistent ) + { + m_aMemContainer.erase( rURL ); + + initCfg(); + m_aCfgContainer.insert( rURL ); + writeCfg(); + } + else + { + initCfg(); + if ( m_aCfgContainer.erase( rURL ) > 0 ) + writeCfg(); + + m_aMemContainer.insert( rURL ); + } +} + +void SysCredentialsConfig::remove( rtl::OUString const & rURL ) +{ + m_aMemContainer.erase( rURL ); + + initCfg(); + if ( m_aCfgContainer.erase( rURL ) > 0 ) + writeCfg(); +} + +uno::Sequence< rtl::OUString > SysCredentialsConfig::list( bool bOnlyPersistent ) +{ + initCfg(); + sal_Int32 nCount = m_aCfgContainer.size() + + ( bOnlyPersistent ? 0 : m_aMemContainer.size() ); + uno::Sequence< rtl::OUString > aResult( nCount ); + + StringSet::const_iterator it = m_aCfgContainer.begin(); + StringSet::const_iterator end = m_aCfgContainer.end(); + sal_Int32 n = 0; + + while ( it != end ) + { + aResult[ n ] = *it; + ++it; + ++n; + } + + if ( !bOnlyPersistent ) + { + it = m_aMemContainer.begin(); + end = m_aMemContainer.end(); + + while ( it != end ) + { + aResult[ n ] = *it; + ++it; + ++n; + } + } + return aResult; +} + +void SysCredentialsConfig::persistentConfigChanged() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + m_bCfgInited = false; // re-init on demand. +} diff --git a/svl/source/passwordcontainer/syscreds.hxx b/svl/source/passwordcontainer/syscreds.hxx new file mode 100644 index 000000000000..b037e17c348e --- /dev/null +++ b/svl/source/passwordcontainer/syscreds.hxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: $ + * $Revision: $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_SVTOOLS_SYSCREDS_HXX +#define INCLUDED_SVTOOLS_SYSCREDS_HXX + +#include +#include +#include "osl/mutex.hxx" +#include "rtl/ustring.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "unotools/configitem.hxx" + +class SysCredentialsConfig; + +class SysCredentialsConfigItem : public utl::ConfigItem +{ + public: + SysCredentialsConfigItem( SysCredentialsConfig * pOwner ); + //virtual ~SysCredentialsConfigItem(); + + virtual void Notify( + const com::sun::star::uno::Sequence< rtl::OUString > & + seqPropertyNames ); + //virtual void Commit(); + + com::sun::star::uno::Sequence< rtl::OUString > + getSystemCredentialsURLs(); + + void setSystemCredentialsURLs( + const com::sun::star::uno::Sequence< rtl::OUString > & + seqURLList ); + + //bool isSystemCredentialsURL( const rtl::OUString & rURL ) const; + +private: + ::osl::Mutex m_aMutex; + bool m_bInited; + com::sun::star::uno::Sequence< rtl::OUString > m_seqURLs; + SysCredentialsConfig * m_pOwner; +}; + +typedef std::set< rtl::OUString > StringSet; + +class SysCredentialsConfig +{ + public: + SysCredentialsConfig(); + + rtl::OUString find( rtl::OUString const & rURL ); + void add( rtl::OUString const & rURL, bool bPersistent ); + void remove( rtl::OUString const & rURL ); + com::sun::star::uno::Sequence< rtl::OUString > list( bool bOnlyPersistent ); + + void persistentConfigChanged(); + + private: + void initCfg(); + void writeCfg(); + + ::osl::Mutex m_aMutex; + StringSet m_aMemContainer; + StringSet m_aCfgContainer; + SysCredentialsConfigItem m_aConfigItem; + bool m_bCfgInited; +}; + +#endif // INCLUDED_SVTOOLS_SYSCREDS_HXX diff --git a/svl/source/svdde/ddecli.cxx b/svl/source/svdde/ddecli.cxx new file mode 100644 index 000000000000..e31e53d07522 --- /dev/null +++ b/svl/source/svdde/ddecli.cxx @@ -0,0 +1,474 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ddecli.cxx,v $ + * $Revision: 1.9 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#define UNICODE +#include // memset +#include "ddeimp.hxx" +#include + +#include +#include +#include +#include + +// static DWORD hDdeInst = NULL; +// static short nInstance = 0; + +// DdeConnections* DdeConnection::pConnections = NULL; + +DdeInstData* ImpInitInstData() +{ + DdeInstData* pData = new DdeInstData; + memset( pData,0,sizeof(DdeInstData) ); + DdeInstData** ppInst = (DdeInstData**)GetAppData( SHL_SVDDE ); + *ppInst = pData; + return pData; +} + +void ImpDeinitInstData() +{ + DdeInstData** ppInst = (DdeInstData**)GetAppData( SHL_SVDDE ); + delete (*ppInst); + *ppInst = 0; +} + + +struct DdeImp +{ + HCONV hConv; + long nStatus; +}; + +// --- DdeInternat::CliCallback() ---------------------------------- + +HDDEDATA CALLBACK DdeInternal::CliCallback( + WORD nCode, WORD nCbType, HCONV hConv, HSZ, HSZ hText2, + HDDEDATA hData, DWORD nInfo1, DWORD ) +{ + HDDEDATA nRet = DDE_FNOTPROCESSED; + DdeConnections& rAll = (DdeConnections&)DdeConnection::GetConnections(); + DdeConnection* self = 0; + + DdeInstData* pInst = ImpGetInstData(); + DBG_ASSERT(pInst,"SVDDE:No instance data"); + + for ( self = rAll.First(); self; self = rAll.Next() ) + if ( self->pImp->hConv == hConv ) + break; + + if( self ) + { + DdeTransaction* t; + BOOL bFound = FALSE; + for( t = self->aTransactions.First(); t; t = self->aTransactions.Next() ) + { + switch( nCode ) + { + case XTYP_XACT_COMPLETE: + if( (DWORD)t->nId == nInfo1 ) + { + nCode = t->nType & (XCLASS_MASK | XTYP_MASK); + t->bBusy = FALSE; + t->Done( 0 != hData ); + bFound = TRUE; + } + break; + + case XTYP_DISCONNECT: + self->pImp->hConv = DdeReconnect( hConv ); + self->pImp->nStatus = self->pImp->hConv + ? DMLERR_NO_ERROR + : DdeGetLastError( pInst->hDdeInstCli ); + t = 0; + nRet = 0; + bFound = TRUE; + break; + + case XTYP_ADVDATA: + bFound = BOOL( *t->pName == hText2 ); + break; + } + if( bFound ) + break; + } + + if( t ) + { + switch( nCode ) + { + case XTYP_ADVDATA: + if( !hData ) + { + ((DdeLink*) t)->Notify(); + nRet = (HDDEDATA)DDE_FACK; + break; + } + // kein break; + + case XTYP_REQUEST: + if( !hData && XTYP_REQUEST == nCode ) + { + + } + + DdeData d; + d.pImp->hData = hData; + d.pImp->nFmt = DdeData::GetInternalFormat( nCbType ); + d.Lock(); + t->Data( &d ); + nRet = (HDDEDATA)DDE_FACK; + break; + } + } + } + return nRet; +} + +// --- DdeConnection::DdeConnection() ------------------------------ + +DdeConnection::DdeConnection( const String& rService, const String& rTopic ) +{ + pImp = new DdeImp; + pImp->nStatus = DMLERR_NO_ERROR; + pImp->hConv = NULL; + + DdeInstData* pInst = ImpGetInstData(); + if( !pInst ) + pInst = ImpInitInstData(); + pInst->nRefCount++; + pInst->nInstanceCli++; + if ( !pInst->hDdeInstCli ) + { + pImp->nStatus = DdeInitialize( &pInst->hDdeInstCli, + (PFNCALLBACK)DdeInternal::CliCallback, + APPCLASS_STANDARD | APPCMD_CLIENTONLY | + CBF_FAIL_ALLSVRXACTIONS | + CBF_SKIP_REGISTRATIONS | + CBF_SKIP_UNREGISTRATIONS, 0L ); + pInst->pConnections = new DdeConnections; + } + + pService = new DdeString( pInst->hDdeInstCli, rService ); + pTopic = new DdeString( pInst->hDdeInstCli, rTopic ); + + if ( pImp->nStatus == DMLERR_NO_ERROR ) + { + pImp->hConv = DdeConnect( pInst->hDdeInstCli,*pService,*pTopic, NULL); + if( !pImp->hConv ) + pImp->nStatus = DdeGetLastError( pInst->hDdeInstCli ); + } + + if ( pInst->pConnections ) + pInst->pConnections->Insert( this ); +} + +// --- DdeConnection::~DdeConnection() ----------------------------- + +DdeConnection::~DdeConnection() +{ + if ( pImp->hConv ) + DdeDisconnect( pImp->hConv ); + + delete pService; + delete pTopic; + + DdeInstData* pInst = ImpGetInstData(); + DBG_ASSERT(pInst,"SVDDE:No instance data"); + if ( pInst->pConnections ) + pInst->pConnections->Remove( this ); + + pInst->nInstanceCli--; + pInst->nRefCount--; + if ( !pInst->nInstanceCli && pInst->hDdeInstCli ) + { + if( DdeUninitialize( pInst->hDdeInstCli ) ) + { + pInst->hDdeInstCli = NULL; + delete pInst->pConnections; + pInst->pConnections = NULL; + if( pInst->nRefCount == 0 ) + ImpDeinitInstData(); + } + } + delete pImp; +} + +// --- DdeConnection::IsConnected() -------------------------------- + +BOOL DdeConnection::IsConnected() +{ + CONVINFO c; +#ifdef OS2 + c.nSize = sizeof( c ); +#else + c.cb = sizeof( c ); +#endif + if ( DdeQueryConvInfo( pImp->hConv, QID_SYNC, &c ) ) + return TRUE; + else + { + DdeInstData* pInst = ImpGetInstData(); + pImp->hConv = DdeReconnect( pImp->hConv ); + pImp->nStatus = pImp->hConv ? DMLERR_NO_ERROR : DdeGetLastError( pInst->hDdeInstCli ); + return BOOL( pImp->nStatus == DMLERR_NO_ERROR ); + } +} + +// --- DdeConnection::GetServiceName() ----------------------------- + +const String& DdeConnection::GetServiceName() +{ + return (const String&)*pService; +} + +// --- DdeConnection::GetTopicName() ------------------------------- + +const String& DdeConnection::GetTopicName() +{ + return (const String&)*pTopic; +} + +// --- DdeConnection::GetConvId() ---------------------------------- + +long DdeConnection::GetConvId() +{ + return (long)pImp->hConv; +} + +const DdeConnections& DdeConnection::GetConnections() +{ + DdeInstData* pInst = ImpGetInstData(); + DBG_ASSERT(pInst,"SVDDE:No instance data"); + return *(pInst->pConnections); +} + +// --- DdeTransaction::DdeTransaction() ---------------------------- + +DdeTransaction::DdeTransaction( DdeConnection& d, const String& rItemName, + long n ) : + rDde( d ) +{ + DdeInstData* pInst = ImpGetInstData(); + pName = new DdeString( pInst->hDdeInstCli, rItemName ); + nTime = n; + nId = 0; + nType = 0; + bBusy = FALSE; + + rDde.aTransactions.Insert( this ); +} + +// --- DdeTransaction::~DdeTransaction() --------------------------- + +DdeTransaction::~DdeTransaction() +{ + if ( nId && rDde.pImp->hConv ) + { + DdeInstData* pInst = ImpGetInstData(); + DdeAbandonTransaction( pInst->hDdeInstCli, rDde.pImp->hConv, nId ); + } + + delete pName; + rDde.aTransactions.Remove( this ); +} + +// --- DdeTransaction::Execute() ----------------------------------- + +void DdeTransaction::Execute() +{ + HSZ hItem = *pName; + void* pData = (void*)(const void *)aDdeData; + DWORD nData = (DWORD)(long)aDdeData; + ULONG nIntFmt = aDdeData.pImp->nFmt; + UINT nExtFmt = DdeData::GetExternalFormat( nIntFmt ); + DdeInstData* pInst = ImpGetInstData(); + + if ( nType == XTYP_EXECUTE ) + hItem = NULL; + if ( nType != XTYP_EXECUTE && nType != XTYP_POKE ) + { + pData = NULL; + nData = 0L; + } + if ( nTime ) + { + HDDEDATA hData = DdeClientTransaction( (unsigned char*)pData, + nData, rDde.pImp->hConv, + hItem, nExtFmt, (UINT)nType, + (DWORD)nTime, (DWORD FAR*)NULL ); + + rDde.pImp->nStatus = DdeGetLastError( pInst->hDdeInstCli ); + if( hData && nType == XTYP_REQUEST ) + { + { + DdeData d; + d.pImp->hData = hData; + d.pImp->nFmt = nIntFmt; + d.Lock(); + Data( &d ); + } + DdeFreeDataHandle( hData ); + } + } + else + { + if ( nId && rDde.pImp->hConv ) + DdeAbandonTransaction( pInst->hDdeInstCli, rDde.pImp->hConv, nId); + nId = 0; + bBusy = TRUE; + HDDEDATA hRet = DdeClientTransaction( (unsigned char*)pData, nData, + rDde.pImp->hConv, hItem, nExtFmt, + (UINT)nType, TIMEOUT_ASYNC, + (DWORD FAR *) ((long*) &nId) ); + rDde.pImp->nStatus = hRet ? DMLERR_NO_ERROR + : DdeGetLastError( pInst->hDdeInstCli ); + } +} + +// --- DdeTransaction::GetName() ----------------------------------- + +const String& DdeTransaction::GetName() const +{ + return *pName; +} + +// --- DdeTransaction::Data() -------------------------------------- + + +void __EXPORT DdeTransaction::Data( const DdeData* p ) +{ + Application::GetSolarMutex().acquire(); + aData.Call( (void*)p ); + Application::GetSolarMutex().release(); +} + +// --- DdeTransaction::Done() -------------------------------------- + +void __EXPORT DdeTransaction::Done( BOOL bDataValid ) +{ + aDone.Call( (void*)bDataValid ); +} + +// --- DdeLink::DdeLink() ------------------------------------------ + +DdeLink::DdeLink( DdeConnection& d, const String& aItemName, long n ) : + DdeTransaction (d, aItemName, n) +{ +} + +// --- DdeLink::~DdeLink() ----------------------------------------- + +DdeLink::~DdeLink() +{ + nType = (USHORT)XTYP_ADVSTOP; + nTime = 0; +} + +// --- DdeLink::Notify() ----------------------------------------- + +void __EXPORT DdeLink::Notify() +{ + aNotify.Call( NULL ); +} + +// --- DdeRequest::DdeRequest() ------------------------------------ + +DdeRequest::DdeRequest( DdeConnection& d, const String& i, long n ) : + DdeTransaction( d, i, n ) +{ + nType = XTYP_REQUEST; +} + +// --- DdeWarmLink::DdeWarmLink() ---------------------------------- + +DdeWarmLink::DdeWarmLink( DdeConnection& d, const String& i, long n ) : + DdeLink( d, i, n ) +{ + nType = XTYP_ADVSTART | XTYPF_NODATA; +} + +// --- DdeHotLink::DdeHotLink() ------------------------------------ + +DdeHotLink::DdeHotLink( DdeConnection& d, const String& i, long n ) : + DdeLink( d, i, n ) +{ + nType = XTYP_ADVSTART; +} + +// --- DdePoke::DdePoke() ------------------------------------------ + +DdePoke::DdePoke( DdeConnection& d, const String& i, const char* p, + long l, ULONG f, long n ) : + DdeTransaction( d, i, n ) +{ + aDdeData = DdeData( p, l, f ); + nType = XTYP_POKE; +} + +// --- DdePoke::DdePoke() ------------------------------------------ + +DdePoke::DdePoke( DdeConnection& d, const String& i, const String& rData, + long n ) : + DdeTransaction( d, i, n ) +{ +// ByteString aByteStr( rData, osl_getThreadTextEncoding() ); + aDdeData = DdeData( (void*) rData.GetBuffer(), sizeof(sal_Unicode) * (rData.Len()), CF_TEXT ); + nType = XTYP_POKE; +} + +// --- DdePoke::DdePoke() ------------------------------------------ + +DdePoke::DdePoke( DdeConnection& d, const String& i, const DdeData& rData, + long n ) : + DdeTransaction( d, i, n ) +{ + aDdeData = rData; + nType = XTYP_POKE; +} + +// --- DdeExecute::DdeExecute() ------------------------------------ + +DdeExecute::DdeExecute( DdeConnection& d, const String& rData, long n ) : + DdeTransaction( d, String(), n ) +{ +// ByteString aByteStr( rData, osl_getThreadTextEncoding() ); + aDdeData = DdeData( (void*)rData.GetBuffer(), sizeof(sal_Unicode) * (rData.Len() + 1), CF_TEXT ); + nType = XTYP_EXECUTE; +} + +// --- DdeConnection::GetError() ----------------------------------- + +long DdeConnection::GetError() +{ + return pImp->nStatus; +} diff --git a/svl/source/svdde/ddedata.cxx b/svl/source/svdde/ddedata.cxx new file mode 100644 index 000000000000..9167c8585b08 --- /dev/null +++ b/svl/source/svdde/ddedata.cxx @@ -0,0 +1,233 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ddedata.cxx,v $ + * $Revision: 1.8 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +// ACHTUNG: es wird angenommen, dass StarView-Clipboard-Foamatnummern +// und Windows-Formatnummern identisch sind! Ist dies einmal nicht der +// Fall, muessen die Routinen hier angepasst werden. Die Implementation +// verwendet die hier defineirten Konversionen. + +#define UNICODE + +#include +#include "ddeimp.hxx" +#include + +#include + +#if defined( WIN ) && defined( MSC ) +#pragma code_seg( "SVDDE_MISC_CODE" ) +#endif + +// --- DdeData::DdeData() ------------------------------------------ + +DdeData::DdeData() +{ + pImp = new DdeDataImp; + pImp->hData = NULL; + pImp->nData = 0; + pImp->pData = NULL; + pImp->nFmt = CF_TEXT; +} + +// --- DdeData::DdeData() ------------------------------------------ + +DdeData::DdeData( const void* p, long n, ULONG f ) +{ + pImp = new DdeDataImp; + pImp->hData = NULL; + pImp->pData = (LPBYTE)p; + pImp->nData = n; + pImp->nFmt = f; +} + +// --- DdeData::DdeData() ------------------------------------------ + +DdeData::DdeData( const String& s ) +{ + pImp = new DdeDataImp; + pImp->hData = NULL; + pImp->pData = (LPBYTE)s.GetBuffer(); + pImp->nData = s.Len()+1; + pImp->nFmt = CF_TEXT; +} + +// --- DdeData::DdeData() ------------------------------------------ + +DdeData::DdeData( const DdeData& rData ) +{ + pImp = new DdeDataImp; + pImp->hData = rData.pImp->hData; + pImp->nData = rData.pImp->nData; + pImp->pData = rData.pImp->pData; + pImp->nFmt = rData.pImp->nFmt; + Lock(); +} + +// --- DdeData::~DdeData() ----------------------------------------- + +DdeData::~DdeData() +{ + if ( pImp && pImp->hData ) + DdeUnaccessData( pImp->hData ); + delete pImp; +} + +// --- DdeData::Lock() --------------------------------------------- + +void DdeData::Lock() +{ + if ( pImp->hData ) + pImp->pData = DdeAccessData( pImp->hData, (LPDWORD) &pImp->nData ); +} + +// --- DdeData::GetFormat() ---------------------------------------- + +ULONG DdeData::GetFormat() const +{ + return pImp->nFmt; +} + +void DdeData::SetFormat( ULONG nFmt ) +{ + pImp->nFmt = nFmt; +} + +// --- DdeData::operator const char*() ----------------------------- + +DdeData::operator const void*() const +{ + return pImp->pData; +} + +// --- DdeData::operator long() ------------------------------------ + +DdeData::operator long() const +{ + return pImp->nData; +} + +// --- DdeData::operator =() --------------------------------------- + +DdeData& DdeData::operator = ( const DdeData& rData ) +{ + if ( &rData != this ) + { + DdeData tmp( rData ); + delete pImp; + pImp = tmp.pImp; + tmp.pImp = NULL; + } + + return *this; +} + +ULONG DdeData::GetExternalFormat( ULONG nFmt ) +{ + switch( nFmt ) + { + case FORMAT_STRING: + nFmt = CF_TEXT; + break; + case FORMAT_BITMAP: + nFmt = CF_BITMAP; + break; + case FORMAT_GDIMETAFILE: + nFmt = CF_METAFILEPICT; + break; + + default: + { +#if defined(WNT) || defined(WIN) || defined( PM2 ) + String aName( SotExchange::GetFormatName( nFmt ) ); + +#if defined(WNT) || defined(WIN) + + if( aName.Len() ) + nFmt = RegisterClipboardFormat( reinterpret_cast(aName.GetBuffer()) ); +#endif +#if defined( PM2 ) + + if( aName.Len() ) + { + HATOMTBL hSysTable = WinQuerySystemAtomTable(); + nFmt = (ULONG)WinAddAtom( hSysTable, (PSZ)aName.GetBuffer() ); + } +#endif +#endif + } + } + return nFmt; +} + +ULONG DdeData::GetInternalFormat( ULONG nFmt ) +{ + switch( nFmt ) + { + case CF_TEXT: + nFmt = FORMAT_STRING; + break; + + case CF_BITMAP: + nFmt = FORMAT_BITMAP; + break; + + case CF_METAFILEPICT: + nFmt = FORMAT_GDIMETAFILE; + break; + + default: +#if defined(WIN) || defined(WNT) + if( nFmt >= CF_MAX ) + { + TCHAR szName[ 256 ]; + + if( GetClipboardFormatName( nFmt, szName, sizeof(szName) ) ) + nFmt = SotExchange::RegisterFormatName( String(reinterpret_cast(szName)) ); + } +#endif +#if defined(PM2) + if( nFmt > CF_PALETTE ) + { + char szName[ 256 ]; + + HATOMTBL hSysTable = WinQuerySystemAtomTable(); + WinQueryAtomName( hSysTable, (ATOM)nFmt, (PSZ)szName, + sizeof( szName ) ); + nFmt = SotExchange::RegisterFormatName( String( szName ) ); + } +#endif + break; + } + return nFmt; +} + diff --git a/svl/source/svdde/ddedll.cxx b/svl/source/svdde/ddedll.cxx new file mode 100644 index 000000000000..696d7b2851d2 --- /dev/null +++ b/svl/source/svdde/ddedll.cxx @@ -0,0 +1,67 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ddedll.cxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#ifdef WIN + + +#include // included svwin.h + +// Statische DLL-Verwaltungs-Variablen +static HINSTANCE hDLLInst = 0; // HANDLE der DLL + +/*************************************************************************** +|* LibMain() +|* Beschreibung Initialisierungsfunktion der DLL +***************************************************************************/ +extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) +{ +#ifndef WNT + if ( nHeap ) + UnlockData( 0 ); +#endif + + hDLLInst = hDLL; + + return TRUE; +} + +/*************************************************************************** +|* WEP() +|* Beschreibung DLL-Deinitialisierung +***************************************************************************/ +extern "C" int CALLBACK WEP( int ) +{ + return 1; +} + +#endif + diff --git a/svl/source/svdde/ddeimp.hxx b/svl/source/svdde/ddeimp.hxx new file mode 100644 index 000000000000..dcdf5b3be33c --- /dev/null +++ b/svl/source/svdde/ddeimp.hxx @@ -0,0 +1,180 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ddeimp.hxx,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _DDEIMP_HXX +#define _DDEIMP_HXX + +#ifdef OS2 + +#include "ddemlos2.h" + +#define WORD USHORT +#define DWORD ULONG +#define LPBYTE BYTE* +#define LPWORD USHORT* +#define LPDWORD ULONG* +#define LPCTSTR PCSZ + +#else + +#include +#include +#include +#include "ddewrap.hxx" + +/* +extern "C" +{ +#define BOOL WIN_BOOL +#define BYTE WIN_BYTE +#undef BOOL +#undef BYTE +}; +*/ + +#endif +#include +#include +#include + +class DdeService; +class DdeTopic; +class DdeItem; +class DdeTopics; +class DdeItems; + +// ---------------- +// - Conversation - +// ---------------- + +struct Conversation +{ + HCONV hConv; + DdeTopic* pTopic; +}; + +DECLARE_LIST( ConvList, Conversation* ); + +// --------------- +// - DdeInternal - +// --------------- + +class DdeInternal +{ +public: +#ifdef WNT + static HDDEDATA CALLBACK CliCallback + ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); + static HDDEDATA CALLBACK SvrCallback + ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); + static HDDEDATA CALLBACK InfCallback + ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); +#else +#if defined ( MTW ) || ( defined ( GCC ) && defined ( OS2 )) || defined( ICC ) + static HDDEDATA CALLBACK __EXPORT CliCallback + ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); + static HDDEDATA CALLBACK __EXPORT SvrCallback + ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); + static HDDEDATA CALLBACK __EXPORT InfCallback + ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); +#else + static HDDEDATA CALLBACK _export CliCallback + ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); + static HDDEDATA CALLBACK _export SvrCallback + ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); + static HDDEDATA CALLBACK _export InfCallback + ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); +#endif +#endif + static DdeService* FindService( HSZ ); + static DdeTopic* FindTopic( DdeService&, HSZ ); + static DdeItem* FindItem( DdeTopic&, HSZ ); +}; + +// ------------- +// - DdeString - +// ------------- + +class DdeString : public String +{ +protected: + HSZ hString; + DWORD hInst; + +public: + DdeString( DWORD, const sal_Unicode* ); + DdeString( DWORD, const String& ); + ~DdeString(); + + int operator==( HSZ ); + operator HSZ(); +}; + +// -------------- +// - DdeDataImp - +// -------------- + +struct DdeDataImp +{ + HDDEDATA hData; + LPBYTE pData; + long nData; + ULONG nFmt; +}; + +class DdeConnections; +class DdeServices; + +struct DdeInstData +{ + USHORT nRefCount; + DdeConnections* pConnections; + // Server + long hCurConvSvr; + ULONG hDdeInstSvr; + short nInstanceSvr; + DdeServices* pServicesSvr; + // Client + ULONG hDdeInstCli; + short nInstanceCli; +}; + +#ifndef SHL_SVDDE +#define SHL_SVDDE SHL_SHL2 +#endif + +inline DdeInstData* ImpGetInstData() +{ + return (DdeInstData*)(*GetAppData( SHL_SVDDE )); +} +DdeInstData* ImpInitInstData(); +void ImpDeinitInstData(); + +#endif // _DDEIMP_HXX diff --git a/svl/source/svdde/ddeinf.cxx b/svl/source/svdde/ddeinf.cxx new file mode 100644 index 000000000000..7c2fb82789e6 --- /dev/null +++ b/svl/source/svdde/ddeinf.cxx @@ -0,0 +1,193 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ddeinf.cxx,v $ + * $Revision: 1.8 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#define UNICODE + +#include +#include "ddeimp.hxx" +#include + +// --- DdeInternal::InfCallback() ---------------------------------- + +#ifdef WNT +HDDEDATA CALLBACK DdeInternal::InfCallback( + WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ) +#else +#if defined ( MTW ) || ( defined ( GCC ) && defined ( OS2 )) || defined( ICC ) +HDDEDATA CALLBACK __EXPORT DdeInternal::InfCallback( + WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ) +#else +HDDEDATA CALLBACK _export DdeInternal::InfCallback( + WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ) +#endif +#endif +{ + return (HDDEDATA)DDE_FNOTPROCESSED; +} + +// --- DdeServiceList::DdeServiceList() ---------------------------- + +DdeServiceList::DdeServiceList( const String* pTopic ) +{ + DWORD hDdeInst = NULL; + HCONVLIST hConvList = NULL; + HCONV hConv = NULL; + UINT nStatus = DMLERR_NO_ERROR; + HSZ hTopic = NULL; + +#ifndef OS2 // YD FIXME + + nStatus = DdeInitialize( &hDdeInst, (PFNCALLBACK) DdeInternal::InfCallback, + APPCLASS_STANDARD | APPCMD_CLIENTONLY | + CBF_FAIL_ALLSVRXACTIONS | + CBF_SKIP_ALLNOTIFICATIONS, 0L ); + + if ( nStatus == DMLERR_NO_ERROR ) + { + if ( pTopic ) + { + LPCTSTR p = reinterpret_cast(pTopic->GetBuffer()); +#ifdef __MINGW32__ + hTopic = DdeCreateStringHandle( hDdeInst, const_cast(p), CP_WINUNICODE ); +#else + hTopic = DdeCreateStringHandle( hDdeInst, p, CP_WINUNICODE ); +#endif + } + + hConvList = DdeConnectList( hDdeInst, NULL, hTopic, NULL, NULL ); + nStatus = DdeGetLastError( hDdeInst ); + } + + if ( nStatus == DMLERR_NO_ERROR ) + { + while ( ( hConv = DdeQueryNextServer( hConvList, hConv ) ) != NULL) + { + CONVINFO aInf; + TCHAR buf[256], *p; + HSZ h; +#ifdef OS2 + aInf.nSize = sizeof( aInf ); +#else + aInf.cb = sizeof( aInf ); +#endif + if( DdeQueryConvInfo( hConv, QID_SYNC, &aInf)) + { + h = aInf.hszServiceReq; + if ( !h ) +#ifndef OS2 + h = aInf.hszSvcPartner; +#else + h = aInf.hszPartner; +#endif + DdeQueryString( hDdeInst, h, buf, sizeof(buf) / sizeof(TCHAR), CP_WINUNICODE ); + p = buf + lstrlen( buf ); + *p++ = '|'; *p = 0; + DdeQueryString( hDdeInst, aInf.hszTopic, p, sizeof(buf)/sizeof(TCHAR)-lstrlen( buf ), + CP_WINUNICODE ); + aServices.Insert( new String( reinterpret_cast(buf) ) ); + } + } + DdeDisconnectList( hConvList ); + } + + if ( hTopic) + DdeFreeStringHandle( hDdeInst, hTopic ); + if ( hDdeInst ) + DdeUninitialize( hDdeInst ); + +#endif + +} + +// --- DdeServiceList::~DdeServiceList() --------------------------- + +DdeServiceList::~DdeServiceList() +{ + String* s; + while ( ( s = aServices.First() ) != NULL ) + { + aServices.Remove( s ); + delete s; + } +} + +// --- DdeTopicList::DdeTopicList() -------------------------------- + +DdeTopicList::DdeTopicList( const String& rService ) +{ + DdeConnection aSys( rService, String( reinterpret_cast(SZDDESYS_TOPIC) ) ); + + if ( !aSys.GetError() ) + { + DdeRequest aReq( aSys, String( reinterpret_cast(SZDDESYS_ITEM_TOPICS) ), 500 ); + aReq.SetDataHdl( LINK( this, DdeTopicList, Data ) ); + aReq.Execute(); + } +} + +// --- DdeTopicList::~DdeTopicList() ------------------------------- + +DdeTopicList::~DdeTopicList() +{ + String* s; + while ( ( s = aTopics.First() ) != NULL ) + { + aTopics.Remove( s ); + delete s; + } +} + +// --- DdeTopicList::Data() -------------------------------------------- + +IMPL_LINK( DdeTopicList, Data, DdeData*, pData ) +{ + char* p = (char*) (const void *) *pData; + char* q = p; + short i; + char buf[256]; + + while ( *p && *p != '\r' && *p != '\n' ) + { + q = buf; i = 0; + while ( i < 255 && *p && *p != '\r' && *p != '\n' && *p != '\t' ) + *q++ = *p++, i++; + *q = 0; + while ( *p && *p != '\r' && *p != '\n' && *p != '\t' ) + p++; + aTopics.Insert( new String( String::CreateFromAscii(buf) ) ); + if ( *p == '\t' ) + p++; + } + return 0; +} + diff --git a/svl/source/svdde/ddeml1.cxx b/svl/source/svdde/ddeml1.cxx new file mode 100644 index 000000000000..6cc09b612ecf --- /dev/null +++ b/svl/source/svdde/ddeml1.cxx @@ -0,0 +1,2661 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ddeml1.cxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +/* + ToDo / Bugs: + + - DdeInitiate: Eigener Thread? + - Timeout bei Disconnects (IBM:nicht auf Ack warten!) + - Konzept Errorhandling (globale/lokale Fehler) + - Bedeutung/Anwendung Conversation-Contexte + - Bei Zugriffen auf ConversationHandles WindowHandles checken + - Namen der Partner-App ermitteln + - Codepage-Geraffel +*/ +#define INCL_DOSPROCESS + +#include "ddemlimp.hxx" + +#define LOGFILE +#define STATUSFILE +#define DDEDATAFILE +#include "ddemldeb.hxx" + + +#if defined (OS2) && defined (__BORLANDC__) +#pragma option -w-par +#endif + +// static +inline BOOL ImpDdeMgr::MyWinDdePostMsg( HWND hWndTo, HWND hWndFrom, + USHORT nMsg, PDDESTRUCT pData, ULONG nFlags ) +{ + BOOL bSuccess = WinDdePostMsg( hWndTo,hWndFrom,nMsg,pData,nFlags); + if( !bSuccess ) + { + WRITELOG("WinDdePostMsg:Failed!") + if ( !(nFlags & DDEPM_NOFREE) ) + { + MyDosFreeMem( pData,"MyWinDdePostMsg" ); + } + } + return bSuccess; +} + + +// ********************************************************************* +// ImpDdeMgr +// ********************************************************************* + +USHORT ImpDdeMgr::nLastErrInstance = 0; + +// +// Conversation-WndProc +// Steuert Transaktionen eines Conversationhandles +// +MRESULT EXPENTRY ConvWndProc(HWND hWnd,ULONG nMsg,MPARAM nPar1,MPARAM nPar2) +{ +#if defined(DBG_UTIL) && defined(OV_DEBUG) + if( nMsg >= WM_DDE_FIRST && nMsg <= WM_DDE_LAST) + { + ////WRITELOG("::ConvWndProc:DDE-Msg received") + } +#endif + ImpConvWndData* pObj = (ImpConvWndData*)WinQueryWindowULong( hWnd, 0 ); + return pObj->pThis->ConvWndProc( hWnd, nMsg, nPar1, nPar2 ); +} + +// +// Server-WndProc +// DDE-Server-Window der App +// +MRESULT EXPENTRY ServerWndProc(HWND hWnd,ULONG nMsg,MPARAM nPar1,MPARAM nPar2) +{ +#if defined(DBG_UTIL) && defined(OV_DEBUG) + if( nMsg >= WM_DDE_FIRST && nMsg <= WM_DDE_LAST) + { + ////WRITELOG("::ServerWndProc:DDE-Msg received") + } +#endif + ImpDdeMgr* pObj = (ImpDdeMgr*)WinQueryWindowULong( hWnd, 0 ); + return pObj->SrvWndProc( hWnd, nMsg, nPar1, nPar2 ); +} + + +inline HDDEDATA ImpDdeMgr::Callback( USHORT nTransactionType, + USHORT nClipboardFormat, HCONV hConversationHandle, HSZ hsz1, + HSZ hsz2, HDDEDATA hData, ULONG nData1, ULONG nData2 ) +{ + HDDEDATA hRet = (HDDEDATA)0; + if( pCallback ) + hRet = (*pCallback)(nTransactionType, nClipboardFormat, + hConversationHandle, hsz1, hsz2, hData, nData1, nData2); + return hRet; +} + + + +ImpDdeMgr::ImpDdeMgr() +{ + nLastErrInstance = DMLERR_NO_ERROR; + pCallback = 0; + nTransactFilter = 0; + nServiceCount = 0; + pServices = 0; + pAppTable = 0; + pConvTable = 0; + pTransTable = 0; + bServFilterOn = TRUE; + bInSyncTrans = FALSE; + + CreateServerWnd(); + pData = InitAll(); + if ( !pData ) + nLastErrInstance = DMLERR_MEMORY_ERROR; + else + RegisterDDEMLApp(); +} + +ImpDdeMgr::~ImpDdeMgr() +{ + CleanUp(); + DestroyServerWnd(); +// Named Shared Mem vom BS loeschen lassen, da nicht bekannt ist, +// wieviele DDEML-Instanzen die App erzeugt hat, und OS/2 +// keinen App-Referenzzaehler fuer shared mem fuehrt. +// if ( pData ) +// DosFreeMem( pData ); +} + + +BOOL ImpDdeMgr::IsSameInstance( HWND hWnd ) +{ + TID tid; PID pid; + WinQueryWindowProcess( hWnd, &pid, &tid ); + return (BOOL)(pid == pidThis); +} + +HSZ ImpDdeMgr::GetAppName( HWND hWnd ) +{ + return 0; +} + +// static +ImpDdeMgr* ImpDdeMgr::GetImpDdeMgrInstance( HWND hWnd ) +{ + ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData(); + if( !pData ) + return 0; + + ImpDdeMgr* pResult = 0; + TID tid; PID pidApp; + WinQueryWindowProcess( hWnd, &pidApp, &tid ); + HWND* pApp = ImpDdeMgr::GetAppTable( pData ); + USHORT nCurApp = 0; + while( nCurApp < pData->nMaxAppCount ) + { + HWND hCurWin = *pApp; + if( hCurWin ) + { + PID pidCurApp; + WinQueryWindowProcess( hCurWin, &pidCurApp, &tid ); + if( pidCurApp == pidApp ) + { + pResult = (ImpDdeMgr*)WinQueryWindowULong( hCurWin, 0 ); + break; + } + } + pApp++; + nCurApp++; + } + return pResult; +} + + + + + +void ImpDdeMgr::CleanUp() +{ + DisconnectAll(); + ImpService* pPtr = pServices; + if( pPtr ) + { + for( USHORT nIdx = 0; nIdx < nServiceCount; nIdx++, pPtr++ ) + { + HSZ hStr = pPtr->hBaseServName; + if( hStr ) + DdeFreeStringHandle( hStr ); + hStr = pPtr->hInstServName; + if( hStr ) + DdeFreeStringHandle( hStr ); + } + nServiceCount = 0; + delete pServices; + pServices = 0; + } + bServFilterOn = TRUE; // default setting DDEML + UnregisterDDEMLApp(); +} + +void ImpDdeMgr::RegisterDDEMLApp() +{ + HWND* pPtr = pAppTable; + HWND hCur; + USHORT nPos = 0; + while( nPos < pData->nMaxAppCount ) + { + hCur = *pPtr; + if (hCur == (HWND)0 ) + { + // in Tabelle stellen + *pPtr = hWndServer; + break; + } + nPos++; + pPtr++; + } +} + +void ImpDdeMgr::UnregisterDDEMLApp() +{ + HWND* pPtr = pAppTable; + USHORT nPos = 0; + while( nPos < pData->nMaxAppCount ) + { + if (*pPtr == hWndServer ) + { + *pPtr = 0; + break; + } + nPos++; + pPtr++; + } +} + +// static +ImpDdeMgrData* ImpDdeMgr::AccessMgrData() +{ + ImpDdeMgrData* pData = 0; + APIRET nRet = DosGetNamedSharedMem((PPVOID)&pData,DDEMLDATA,PAG_READ|PAG_WRITE); + DBG_ASSERT(!nRet,"DDE:AccessMgrData failed"); + return pData; +} + +USHORT ImpDdeMgr::DdeGetLastError() +{ + USHORT nErr; + if ( !pData ) + nErr = DMLERR_DLL_NOT_INITIALIZED; + else if ( nLastErrInstance ) + nErr = nLastErrInstance; + else + nErr = pData->nLastErr; + + nLastErrInstance = 0; + pData->nLastErr = 0; + return nErr; +} + + + +USHORT ImpDdeMgr::DdeInitialize( PFNCALLBACK pCallbackProc, ULONG nTransactionFilter ) +{ + if ( !nLastErrInstance ) + { + if ( !pCallbackProc ) + { + nLastErrInstance = DMLERR_INVALIDPARAMETER; + return nLastErrInstance; + } + pCallback = pCallbackProc; + nTransactFilter = nTransactionFilter; + nTransactFilter |= CBF_FAIL_SELFCONNECTIONS; + } + return nLastErrInstance; +} + + +// static +HWND ImpDdeMgr::NextFrameWin( HENUM hEnum ) +{ + char aBuf[ 10 ]; + + HWND hWnd = WinGetNextWindow( hEnum ); + while( hWnd ) + { + WinQueryClassName( hWnd, sizeof(aBuf)-1, (PCH)aBuf ); + // Frame-Window ? + if( !strcmp( aBuf, "#1" ) ) // #define WC_FRAME ((PSZ)0xffff0001L) + break; + hWnd = WinGetNextWindow( hEnum ); + } + return hWnd; +} + + +HCONV ImpDdeMgr::DdeConnectImp( HSZ hszService,HSZ hszTopic,CONVCONTEXT* pCC) +{ + hCurConv = 0; + if( !pCC ) + pCC = &aDefaultContext; + + ULONG nBufLen; + PSZ pService = AllocAtomName( (ATOM)hszService, nBufLen ); + PSZ pTopic = AllocAtomName( (ATOM)hszTopic, nBufLen ); +#if 0 && defined(OV_DEBUG) + String aStr("DdeConnectImp Service:"); + aStr += pService; + aStr += " Topic:"; + aStr += pTopic; + WRITELOG((char*)(const char*)aStr) +#endif + +#if defined(OV_DEBUG) + if( !strcmp(pService,"oliver voeltz") ) + { + WRITESTATUS("Table of connections"); + MyDosFreeMem( pTopic,"DdeConnectImp" ); + MyDosFreeMem( pService,"DdeConnectImp" ); + return 0; + } +#endif + +#if 0 + // original pm-fkt benutzen + HWND hWndCurClient = CreateConversationWnd(); + WinDdeInitiate( hWndCurClient, pService, pTopic, pCC ); + if( GetConversationWndRefCount(hWndCurClient) == 0) + DestroyConversationWnd( hWndCurClient ); +#else + // eigener Verbindungsaufbau + HENUM hEnum = WinBeginEnumWindows( HWND_DESKTOP ); + HWND hWndCurSrv = NextFrameWin( hEnum ); + HWND hWndCurClient = CreateConversationWnd(); + while( hWndCurSrv && !hCurConv ) + { + if( hWndCurSrv != hWndServer || + ((nTransactFilter & CBF_FAIL_SELFCONNECTIONS)==0 )) + { + // pro DDE-Server ein Conversation-Window erzeugen + if( GetConversationWndRefCount(hWndCurClient) >= 2) + { + DestroyConversationWnd( hWndCurClient ); + hWndCurClient = CreateConversationWnd(); + } + MyInitiateDde(hWndCurSrv,hWndCurClient,hszService,hszTopic,pCC); + if( !bListConnect && hCurConv ) + break; + } + hWndCurSrv = NextFrameWin( hEnum ); + } + + if( GetConversationWndRefCount(hWndCurClient) == 0) + DestroyConversationWnd( hWndCurClient ); + WinEndEnumWindows( hEnum ); +#endif + + if( !hCurConv ) + nLastErrInstance = DMLERR_NO_CONV_ESTABLISHED; + +#if 0 && defined(OV_DEBUG) + String aCStr( "DdeConnectImp:End "); + if( nLastErrInstance != DMLERR_NO_CONV_ESTABLISHED ) + aCStr += "(Success)"; + else + aCStr += "(Failed)"; + WRITELOG((char*)aCStr.GetStr()) +#endif + + MyDosFreeMem( pTopic,"DdeConnectImp" ); + MyDosFreeMem( pService,"DdeConnectImp" ); + return hCurConv; +} + +HCONV ImpDdeMgr::DdeConnect( HSZ hszService, HSZ hszTopic, CONVCONTEXT* pCC) +{ + ////WRITELOG("DdeConnect:Start") + bListConnect = FALSE; + HCONV hResult = DdeConnectImp( hszService, hszTopic, pCC ); + ////WRITELOG("DdeConnect:End") + ////WRITESTATUS("DdeConnect:End") + return hResult; +} + + +HCONVLIST ImpDdeMgr::DdeConnectList( HSZ hszService, HSZ hszTopic, + HCONVLIST hConvList, CONVCONTEXT* pCC ) +{ + nPrevConv = 0; + ////WRITESTATUS("Before DdeConnectList") + if( hConvList ) + { + HCONV hLastConvInList; + + hCurListId = hConvList; + ImpHCONV* pConv = pConvTable; + pConv += (USHORT)hConvList; + if( (USHORT)hConvList >= pData->nMaxConvCount ||pConv->hWndThis==0 ) + { + nLastErrInstance = DMLERR_INVALIDPARAMETER; + return 0; + } + GetLastServer(pData, hConvList, hLastConvInList); + nPrevConv = (USHORT)hLastConvInList; + } + else + hCurListId = (HCONVLIST)WinCreateWindow( HWND_OBJECT, WC_FRAME, + CONVLISTNAME, 0,0,0,0,0, HWND_DESKTOP, HWND_BOTTOM, 0,0,0); + + bListConnect = TRUE; + DdeConnectImp( hszService, hszTopic, pCC ); +#if 0 && defined(OV_DEBUG) + WRITELOG("DdeConnectList:ConnectionList:") + HCONV hDebug = 0; + do + { + hDebug = DdeQueryNextServer( hCurListId, hDebug); + String aStr( (ULONG)hDebug ); + WRITELOG((char*)(const char*)aStr) + } while( hDebug ); +#endif + ////WRITESTATUS("After DdeConnectList") + return (HCONVLIST)hCurListId; +} + +DDEINIT* ImpDdeMgr::CreateDDEInitData( HWND hWndDestination, HSZ hszService, + HSZ hszTopic, CONVCONTEXT* pCC ) +{ + ULONG nLen1 = 0, nLen2 = 0; + HATOMTBL hAtomTable = WinQuerySystemAtomTable(); + + if( hszService ) + nLen1 = WinQueryAtomLength( hAtomTable, hszService ); + if( hszTopic ) + nLen2 = WinQueryAtomLength( hAtomTable, hszTopic ); + nLen1++; nLen2++; + + DDEINIT* pBuf = 0; + + ULONG nLen = sizeof(DDEINIT) + nLen1+ nLen2 + sizeof(CONVCONTEXT); + if( !(MyDosAllocSharedMem((PPVOID)&pBuf, NULL, nLen, + PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GIVEABLE | OBJ_ANY, + "CreateDDEInitData"))) + { + memset( pBuf, 0, nLen ); + + /* + PID pid; TID tid; + WinQueryWindowProcess( hWndDestination, &pid, &tid ); + APIRET nRet = DosGiveSharedMem( pBuf, pid, PAG_READ | PAG_WRITE ); + */ + + pBuf->cb = nLen; + pBuf->offConvContext = sizeof( DDEINIT ); + char* pBase = (char*)pBuf; + pBase += sizeof(DDEINIT); + if( pCC ) + memcpy( pBase, pCC, sizeof(CONVCONTEXT) ); + pBase += sizeof(CONVCONTEXT); + pBuf->pszAppName = pBase; + if( hszService ) + WinQueryAtomName( hAtomTable, hszService, pBase, nLen1 ); + pBase += nLen1; + pBuf->pszTopic = pBase; + if( hszTopic ) + WinQueryAtomName( hAtomTable, hszTopic, pBase, nLen2 ); + } + return pBuf; +} + + + +void ImpDdeMgr::MyInitiateDde( HWND hWndSrv, HWND hWndClient, + HSZ hszService, HSZ hszTopic, CONVCONTEXT* pCC ) +{ + DDEINIT* pBuf = CreateDDEInitData( hWndSrv, hszService, hszTopic, pCC ); + if( pBuf ) + { + PID pid; TID tid; + WinQueryWindowProcess( hWndSrv, &pid, &tid ); + APIRET nRet = DosGiveSharedMem( pBuf, pid, PAG_READ | PAG_WRITE ); + WinSendMsg( hWndSrv,WM_DDE_INITIATE,(MPARAM)hWndClient,(MPARAM)pBuf); + MyDosFreeMem( pBuf,"MyInitiateDde" ); + } +} + +// static +ImpHCONV* ImpDdeMgr::GetFirstServer(ImpDdeMgrData* pData, HCONVLIST hConvList, + HCONV& rhConv ) +{ + ImpHCONV* pPtr = GetConvTable( pData ); + HCONV hConv; + if( !rhConv ) + { + pPtr++; + hConv = 1; + } + else + { + // Startposition + pPtr += (USHORT)rhConv; + hConv = rhConv; + pPtr++; hConv++; // auf den naechsten + } + while( hConv < pData->nMaxConvCount ) + { + if( pPtr->hConvList == hConvList ) + { + rhConv = hConv; + return pPtr; + } + pPtr++; + hConv++; + } + rhConv = 0; + return 0; +} + +// static +ImpHCONV* ImpDdeMgr::GetLastServer(ImpDdeMgrData* pData, HCONVLIST hConvList, + HCONV& rhConv ) +{ + ImpHCONV* pPtr = GetConvTable( pData ); + pPtr += pData->nMaxConvCount; + pPtr--; + HCONV hConv = pData->nMaxConvCount; + hConv--; + while( hConv > 0 ) + { + if( pPtr->hConvList == hConvList ) + { + rhConv = hConv; + return pPtr; + } + pPtr--; + hConv--; + } + rhConv = 0; + return 0; +} + +// static +BOOL ImpDdeMgr::CheckConvListId( HCONVLIST hConvListId ) +{ + HAB hAB = WinQueryAnchorBlock( (HWND)hConvListId ); + if( hAB ) + return WinIsWindow( hAB, (HWND)hConvListId ); + return FALSE; + /* + HAB hAB = WinQueryAnchorBlock( (HWND)hConvListId ); + if( hAB ) + { + char aBuf[ 16 ]; + WinQueryWindowText( (HWND)hConvListId, sizeof(aBuf), aBuf ); + if( strcmp(aBuf, CONVLISTNAME ) == 0 ) + return TRUE; + } + return FALSE; + */ +} + +// static +HCONV ImpDdeMgr::DdeQueryNextServer(HCONVLIST hConvList, HCONV hConvPrev) +{ + if( !CheckConvListId( hConvList ) ) + return (HCONV)0; + ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData(); + GetFirstServer( pData, hConvList, hConvPrev ); + return hConvPrev; +} + +// static + +// Idee: DisconnectAll uebergibt das ServerWindow. Zu jedem HCONV +// wird das Creator-Server-Wnd gespeichert. Disconnect braucht +// dann nur noch die Window-Handles zu vergleichen +BOOL ImpDdeMgr::DdeDisconnect( HCONV hConv ) +{ + WRITELOG("DdeDisconnect:Start") + ////WRITESTATUS("DdeDisconnect:Start") + + ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData(); + if ( !pData ) + { + ImpDdeMgr::nLastErrInstance = DMLERR_DLL_NOT_INITIALIZED; + return FALSE; + } + ImpHCONV* pConv = GetConvTable(pData) + (USHORT)hConv; + + if( (USHORT)hConv >= pData->nMaxConvCount || pConv->hWndThis==0 ) + { + nLastErrInstance = DMLERR_NO_CONV_ESTABLISHED; + return FALSE; + } + + PID pidApp; TID tid; + HWND hWndDummy = WinCreateWindow( HWND_OBJECT, WC_FRAME, + "Bla", 0, 0,0,0,0, HWND_DESKTOP, HWND_BOTTOM, 0, 0, 0 ); + WinQueryWindowProcess( hWndDummy, &pidApp, &tid ); + WinDestroyWindow( hWndDummy ); + PID pidThis; PID pidPartner; + + HWND hWndThis = pConv->hWndThis; + HWND hWndPartner = pConv->hWndPartner; + + WinQueryWindowProcess( hWndThis, &pidThis, &tid ); + WinQueryWindowProcess( hWndPartner, &pidPartner, &tid ); + if( pidApp != pidThis && pidApp != pidPartner ) + return TRUE; // gehoert nicht der App -> ueberspringen + + HCONV hConvPartner = pConv->hConvPartner; + + // die App benachrichtigen, dass alle offenen Advise-Loops + // beendet werden, egal ob sie vom Server oder Client + // initiiert wurden. Die Dinger aber nicht loeschen, da sie evtl. + // noch vom Partner gebraucht werden. + ImpConvWndData* pObj = + (ImpConvWndData*)WinQueryWindowULong( pConv->hWndThis, 0 ); + ImpDdeMgr* pThis = pObj->pThis; + pThis->SendUnadvises( hConv, 0, FALSE ); // alle Formate & NICHT loeschen + pThis->SendUnadvises( hConvPartner, 0, FALSE ); // alle Formate & NICHT loeschen + + pConv->nStatus |= ST_TERMINATED; + + HAB hAB = WinQueryAnchorBlock( pConv->hWndThis ); + // um die MessageQueue inne Gaenge zu halten + ULONG nTimerId = WinStartTimer( hAB, 0, 0, 50 ); + + /* + Die Partner-App muss ein DDE_TERMINATE posten, auf das + wir warten muessen, um alle Messages zu bearbeiten, die + _vor_ dem DdeDisconnect von der Partner-App gepostet + wurden. + */ + WRITELOG("DdeDisconnect:Waiting for acknowledge...") + WinDdePostMsg( hWndPartner, hWndThis, WM_DDE_TERMINATE, + (PDDESTRUCT)0,DDEPM_RETRY); + + QMSG aQueueMsg; + BOOL bContinue = TRUE; + while( bContinue ) + { + if( WinGetMsg( hAB, &aQueueMsg, 0, 0, 0 )) + { + WinDispatchMsg( hAB, &aQueueMsg ); + if( (!WinIsWindow( hAB, hWndPartner)) || + (pConv->nStatus & ST_TERMACKREC) ) + { + bContinue = FALSE; + if( pConv->nStatus & ST_TERMACKREC ) + { + WRITELOG("DdeDisconnect: TermAck received") + } + else + { + WRITELOG("DdeDisconnect: Partner died") + } + } + } + else + bContinue = FALSE; + } + + WinStopTimer( hAB, 0, nTimerId ); + + // WRITELOG("DdeDisconnect:Freeing data") + // Transaktionstabelle aufraeumen + FreeTransactions( pData, hConv ); + if( hConvPartner ) + FreeTransactions( pData, hConvPartner ); + + FreeConvHandle( pData, hConv ); + + WRITELOG("DdeDisconnect:End") + //WRITESTATUS("DdeDisconnect:End") + return TRUE; +} + +// static +BOOL ImpDdeMgr::DdeDisconnectList( HCONVLIST hConvList ) +{ + if( !CheckConvListId( hConvList ) ) + { + ImpDdeMgr::nLastErrInstance = DMLERR_INVALIDPARAMETER; + return FALSE; + } + + ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData(); + if ( !pData ) + { + ImpDdeMgr::nLastErrInstance = DMLERR_DLL_NOT_INITIALIZED; + return FALSE; + } + HCONV hConv = 0; + GetFirstServer( pData, hConvList, hConv ); + while( hConv ) + { + DdeDisconnect( hConv ); + GetFirstServer( pData, hConvList, hConv ); + } + WinDestroyWindow( (HWND)hConvList ); + return TRUE; +} + + + +// static +HCONV ImpDdeMgr::DdeReconnect(HCONV hConv) +{ + ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData(); + if ( !pData ) + { + ImpDdeMgr::nLastErrInstance = DMLERR_DLL_NOT_INITIALIZED; + return 0; + } + return 0; +} + +// static +USHORT ImpDdeMgr::DdeQueryConvInfo(HCONV hConv, ULONG nTransId, CONVINFO* pCI) +{ + if( !pCI || pCI->nSize == 0) + return 0; + ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData(); + if ( !pData ) + { + ImpDdeMgr::nLastErrInstance = DMLERR_DLL_NOT_INITIALIZED; + return 0; + } + Transaction* pTrans; + if( nTransId != QID_SYNC ) + { + pTrans = ImpDdeMgr::GetTransTable( pData ); + pTrans += nTransId; + if( nTransId >= pData->nMaxTransCount || pTrans->hConvOwner == 0 ) + { + ImpDdeMgr::nLastErrInstance = DMLERR_UNFOUND_QUEUE_ID; + return 0; + } + } + else + pTrans = 0; + + ImpHCONV* pConv = ImpDdeMgr::GetConvTable( pData ); + pConv += (ULONG)hConv; + if( hConv >= pData->nMaxConvCount || pConv->hWndThis == 0 ) + { + ImpDdeMgr::nLastErrInstance = DMLERR_NO_CONV_ESTABLISHED; + return 0; + } + + USHORT nSize = pCI->nSize; + if( nSize > sizeof(CONVINFO) ) + nSize = sizeof(CONVINFO); + CONVINFO aTempInfo; + memset( &aTempInfo, 0, sizeof(CONVINFO) ); + aTempInfo.nSize = pCI->nSize; + aTempInfo.hConvPartner = pConv->hConvPartner; + aTempInfo.hszPartner = pConv->hszPartner; + aTempInfo.hszServiceReq = pConv->hszServiceReq; + aTempInfo.hszTopic = pConv->hszTopic; + aTempInfo.nStatus = pConv->nStatus; + aTempInfo.hConvList = pConv->hConvList; + aTempInfo.aConvCtxt = pConv->aConvContext; + if( pTrans ) + { + aTempInfo.nUser = pTrans->nUser; + aTempInfo.hszItem = pTrans->hszItem; + aTempInfo.nFormat = pTrans->nFormat; + aTempInfo.nType = pTrans->nType; + aTempInfo.nConvst = pTrans->nConvst; + aTempInfo.nLastError= pTrans->nLastError; + } + memcpy( pCI, &aTempInfo, nSize ); + + return nSize; +} + +// static +BOOL ImpDdeMgr::DdeSetUserHandle(HCONV hConv, ULONG nTransId, ULONG hUser) +{ + ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData(); + if ( !pData ) + { + ImpDdeMgr::nLastErrInstance = DMLERR_DLL_NOT_INITIALIZED; + return FALSE; + } + Transaction* pTrans = GetTransTable( pData ); + pTrans += nTransId; + if( !nTransId || !hConv || nTransId >= pData->nMaxTransCount || + pTrans->hConvOwner != hConv ) + { + ImpDdeMgr::nLastErrInstance = DMLERR_INVALIDPARAMETER; + return FALSE; + } + if( !pTrans->hConvOwner) + { + ImpDdeMgr::nLastErrInstance = DMLERR_UNFOUND_QUEUE_ID; + return FALSE; + } + pTrans->nUser = hUser; + return TRUE; +} + +BOOL ImpDdeMgr::DdeAbandonTransaction( HCONV hConv, ULONG nTransId ) +{ + ////WRITELOG("DdeAbandonTransaction:Start") + if( !pData ) + { + nLastErrInstance = DMLERR_DLL_NOT_INITIALIZED; + return FALSE; + } + ImpHCONV* pConv = pConvTable; + pConv += (USHORT)hConv; + if( nTransId < 1 || nTransId >= pData->nMaxTransCount || + hConv < 1 || hConv >= pData->nMaxConvCount || !pConv->hWndThis) + { + nLastErrInstance = DMLERR_INVALIDPARAMETER; + return FALSE; + } + if( !hConv ) + { + DBG_ASSERT(0,"DdeAbandonTransaction:NULL-hConv not supported"); + nLastErrInstance = DMLERR_INVALIDPARAMETER; + return FALSE; + } + Transaction* pTrans = pTransTable; + pTrans += (USHORT)nTransId; + if( pTrans->hConvOwner != hConv ) + { + nLastErrInstance = DMLERR_UNFOUND_QUEUE_ID; + return FALSE; + } + + if( bInSyncTrans && nTransId == nSyncTransId ) + { + bSyncAbandonTrans = TRUE; + return TRUE; + } + USHORT nTempType = pTrans->nType; + nTempType &= (~XTYPF_MASK); + if( nTempType == (XTYP_ADVREQ & ~(XTYPF_NOBLOCK))) + { + ////WRITELOG("DdeAbandTrans:Advise Loop") + +// ---------------------------------------------------------------------- +// Der von der Deutschen Bank eingesetzte DDE-Server +// "Invision V2.71 Build 36 Mar 12 1999 V4.8.2" hat einen Bug, der +// dazu fuehrt, dass auf per WM_DDE_TERMINATE geschlossene Verbindungen +// nicht mit einem WM_DDE_TERMINATE geantwortet wird, wenn der +// entsprechende Link vorher per WM_DDE_UNADVISE beendet wurde. Dieser +// Bug tritt ab zwei parallel laufenden Links auf. Auf Wunsch der DB +// wurde das folgende Workaround eingebaut. +// ---------------------------------------------------------------------- +#define DEUTSCHE_BANK +#ifndef DEUTSCHE_BANK + +// Acknowledge ist beim Unadvise nicht ueblich +//#define SO_DDE_ABANDON_TRANSACTION_WAIT_ACK +#ifdef SO_DDE_ABANDON_TRANSACTION_WAIT_ACK + DDESTRUCT* pOutDDEData = MakeDDEObject( pConv->hWndPartner, + pTrans->hszItem, DDE_FACKREQ, 0 /*pTrans->nFormat*/, 0, 0); +#else + DDESTRUCT* pOutDDEData = MakeDDEObject( pConv->hWndPartner, + pTrans->hszItem, 0, 0 /*pTrans->nFormat*/, 0, 0); +#endif + WRITELOG("DdeAbandTrans:Waiting for acknowledge...") + pTrans->nConvst = XST_UNADVSENT; + if ( !MyWinDdePostMsg( pConv->hWndPartner, pConv->hWndThis, + WM_DDE_UNADVISE, pOutDDEData, DDEPM_RETRY ) ) + { + WRITELOG("DdeAbandTrans:PostMsg Failed") + return FALSE; + } +#ifdef SO_DDE_ABANDON_TRANSACTION_WAIT_ACK + WaitTransState( pTrans, nTransId, XST_UNADVACKRCVD, 0 ); +#else + pTrans->nConvst = XST_UNADVACKRCVD; +#endif + +#endif // DEUTSCHE_BANK + + WRITELOG("DdeAbandTrans:Ack received->Freeing transaction") + FreeTransaction( pData, nTransId ); + } + WRITELOG("DdeAbandonTransaction:End") + return TRUE; +} + +// wird von einem Server aufgerufen, wenn sich die Daten des +// Topic/Item-Paars geaendert haben. Diese Funktion fordert +// dann den Server auf, die Daten zu rendern (bei Hotlinks) und +// benachrichtigt die Clients +BOOL ImpDdeMgr::DdePostAdvise( HSZ hszTopic, HSZ hszItem) +{ + ////WRITELOG("DdePostAdvise:Start") + ////WRITESTATUS("DdePostAdvise:Start") + +#if 0 && defined( OV_DEBUG ) + String aDebStr("DdePostAdvise:Item "); + aDebStr += (ULONG)hszItem; + WRITELOG((char*)(const char*)aDebStr) +#endif + + Transaction* pTrans = pTransTable; + pTrans++; + USHORT nCurTrans = 1; + USHORT nUsedTransactions = pData->nCurTransCount; + while( nUsedTransactions && nCurTrans < pData->nMaxTransCount ) + { + HCONV hOwner = pTrans->hConvOwner; + if( hOwner ) + { + nUsedTransactions--; + USHORT nTempType = pTrans->nType; + nTempType &= (~XTYPF_MASK); + if( nTempType == (XTYP_ADVREQ & (~XTYPF_NOBLOCK) ) ) + { + ImpHCONV* pConv = pConvTable; + pConv += (USHORT)hOwner; + if(hszItem == pTrans->hszItem && pConv->hszTopic == hszTopic) + { + if( pConv->hConvPartner ) + { + // Transaktionen werden immer vom Client erzeugt + // -> auf Server-HCONV umschalten + hOwner = pConv->hConvPartner; + pConv = pConvTable; + pConv += (USHORT)hOwner; + } + HWND hWndClient = pConv->hWndPartner; + HWND hWndServer = pConv->hWndThis; +#if 0 && defined( OV_DEBUG ) + String aDebStr("DdePostAdvise: Server:"); + aDebStr += (ULONG)hWndServer; + aDebStr += " Client:"; + aDebStr += (ULONG)hWndClient; + WRITELOG((char*)(const char*)aDebStr) +#endif + DDESTRUCT* pOutDDEData; + if ( pTrans->nType & XTYPF_NODATA ) + { + // Warm link + ////WRITELOG("DdePostAdvise:Warm link found") + pOutDDEData = MakeDDEObject( hWndClient, hszItem, + DDE_FNODATA, pTrans->nFormat, 0, 0 ); + } + else + { + // Hot link + ////WRITELOG("DdePostAdvise:Hot link found") + pOutDDEData = Callback( XTYP_ADVREQ, + pTrans->nFormat, hOwner, hszTopic, + hszItem, (HDDEDATA)0, 1, 0 ); + } + if( pOutDDEData ) + { + // todo: FACK_REQ in Out-Data setzen, wenn pTrans->nType & XTYPF_ACKREQ + ////WRITELOG("DdePostAdvise:Sending data/notification") + BOOL bSuccess = MyWinDdePostMsg( hWndClient, + hWndServer,WM_DDE_DATA, pOutDDEData, DDEPM_RETRY); + if( bSuccess ) + { + // auf Acknowledge des Partners warten ? + if( pTrans->nType & XTYPF_ACKREQ ) + { + pTrans->nConvst = XST_ADVDATASENT; + // Impl. ist falsch! => korrekt: XST_ADVDATAACKRCVD + WaitTransState(pTrans, nCurTrans, + XST_UNADVACKRCVD, 0); + } + } + else + { + ////WRITELOG("DdePostAdvise:PostMsg failed") + nLastErrInstance = DMLERR_POSTMSG_FAILED; + } + } + else + { + ////WRITELOG("DdePostAdvise:No data to send") + } + } + } + } + nCurTrans++; + pTrans++; + } + ////WRITELOG("DdePostAdvise:End") + return TRUE; +} + +BOOL ImpDdeMgr::DdeEnableCallback( HCONV hConv, USHORT wCmd) +{ + return FALSE; +} + +// Rueckgabe: 0==Service nicht registriert; sonst Pointer auf Service-Eintrag +ImpService* ImpDdeMgr::GetService( HSZ hszService ) +{ + ImpService* pPtr = pServices; + if( !pPtr || !hszService ) + return 0; + for( ULONG nIdx = 0; nIdx < nServiceCount; nIdx++, pPtr++ ) + { + if(( hszService == pPtr->hBaseServName ) || + ( hszService == pPtr->hInstServName ) ) + return pPtr; + } + return 0; +} + + +// legt Service in Service-Tabelle ab. Tabelle wird ggf. expandiert +ImpService* ImpDdeMgr::PutService( HSZ hszService ) +{ + if( !pServices ) + { + DBG_ASSERT(nServiceCount==0,"DDE:Bad ServiceCount"); + pServices = new ImpService[ DDEMLSERVICETABLE_INISIZE ]; + memset( pServices, 0, DDEMLSERVICETABLE_INISIZE* sizeof(ImpService)); + nServiceCount = DDEMLSERVICETABLE_INISIZE; + } + ImpService* pPtr = pServices; + USHORT nCurPos = 0; + while( pPtr ) + { + if( pPtr->hBaseServName == 0 ) + break; + nCurPos++; + if( nCurPos < nServiceCount ) + pPtr++; + else + pPtr = 0; + } + if( !pPtr ) + { + // Tabelle vergroessern + pPtr = new ImpService[ nServiceCount + DDEMLSERVICETABLE_INISIZE ]; + memset( pPtr, 0, DDEMLSERVICETABLE_INISIZE* sizeof(ImpService)); + memcpy( pPtr, pServices, nServiceCount * sizeof(ImpService) ); +#ifdef DBG_UTIL + memset( pServices, 0, nServiceCount * sizeof(ImpService) ); +#endif + delete pServices; + pServices = pPtr; + pPtr += nServiceCount; // zeigt auf erste neue Position + nServiceCount += DDEMLSERVICETABLE_INISIZE; + } + DBG_ASSERT(pPtr->hBaseServName==0,"DDE:Service not empty"); + DBG_ASSERT(pPtr->hInstServName==0,"DDE:Service not empty"); + + DdeKeepStringHandle( hszService ); + + USHORT nStrLen = (USHORT)DdeQueryString( hszService, 0, 0, 0); + char* pBuf = new char[ nStrLen + 1 ]; + DdeQueryString(hszService, pBuf, nStrLen, 850 /* CodePage*/ ); + pBuf[ nStrLen ] = 0; + String aStr( (ULONG)hWndServer ); + aStr += pBuf; + HSZ hszInstServ = DdeCreateStringHandle( (PSZ)(const char*)pBuf, 850 ); + delete pBuf; + + pPtr->hBaseServName = hszService; + pPtr->hInstServName = hszInstServ; + return pPtr; +} + +void ImpDdeMgr::BroadcastService( ImpService* pService, BOOL bRegistered ) +{ + DBG_ASSERT(pService,"DDE:No Service"); + if( !pService ) + return; + MPARAM aMp1 = (MPARAM)(pService->hBaseServName); + MPARAM aMp2 = (MPARAM)(pService->hInstServName); + ULONG nMsg; + if( bRegistered ) + nMsg = WM_DDEML_REGISTER; + else + nMsg = WM_DDEML_UNREGISTER; + + HWND* pPtr = pAppTable; + for( USHORT nPos = 0; nPos < pData->nMaxAppCount; nPos++, pPtr++ ) + { + HWND hWndCurWin = *pPtr; + if ( hWndCurWin && hWndCurWin != hWndServer ) + WinSendMsg( hWndCurWin, nMsg, aMp1, aMp2 ); + } +} + +HDDEDATA ImpDdeMgr::DdeNameService( HSZ hszService, USHORT afCmd ) +{ + HDDEDATA hRet = (HDDEDATA)1; + + if( afCmd & DNS_FILTERON ) + bServFilterOn = TRUE; + else if( afCmd & DNS_FILTEROFF ) + bServFilterOn = FALSE; + ImpService* pService = GetService( hszService ); + BOOL bRegister = (BOOL)(afCmd & DNS_REGISTER); + if( bRegister ) + { + if( !pService ) + { + pService = PutService( hszService ); + BroadcastService( pService, TRUE ); + } + } + else + { + if( pService ) + { + BroadcastService( pService, FALSE ); + DdeFreeStringHandle( pService->hBaseServName ); + pService->hBaseServName = 0; + DdeFreeStringHandle( pService->hInstServName ); + pService->hInstServName = 0; + } + hRet = (HDDEDATA)0; // Service nicht gefunden + } + return hRet; +} + + +// static +HDDEDATA ImpDdeMgr::DdeClientTransaction(void* pDdeData, ULONG cbData, + HCONV hConv, HSZ hszItem, USHORT nFormat, USHORT nType, + ULONG nTimeout, ULONG* pResult) +{ + //WRITELOG("DdeClientTransaction:Start") + +#if 0 && defined(OV_DEBUG) + if( nType == XTYP_REQUEST ) + { + WRITELOG("Start XTYP_REQUEST"); + WinMessageBox(HWND_DESKTOP,HWND_DESKTOP, + "Start XTYP_REQUEST","DdeClientTransaction", + HWND_DESKTOP,MB_OK); + } +#endif + + if( pResult ) + *pResult = 0; + + ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData(); + if ( !pData ) + { + ImpDdeMgr::nLastErrInstance = DMLERR_DLL_NOT_INITIALIZED; + return (HDDEDATA)0; + } + + BOOL bIsDdeHandle = (BOOL)(pDdeData && cbData==0xffffffff); + BOOL bAppOwnsHandle = (BOOL)( bIsDdeHandle && + (((DDESTRUCT*)pDdeData)->fsStatus & IMP_HDATAAPPOWNED) ); + + BOOL bNoData = (BOOL)(nType & XTYPF_NODATA)!=0; + BOOL bAckReq = (BOOL)(nType & XTYPF_ACKREQ)!=0; + USHORT nTypeFlags = nType & XTYPF_MASK; + nType &= (~XTYPF_MASK); + + BOOL bSync = (BOOL)( nTimeout != TIMEOUT_ASYNC ) != 0; + if( nType == XTYP_ADVSTART ) + bSync = TRUE; + + // Mapping transaction -> OS/2-Message + USHORT nTimeoutErr, nMsg; + switch ( nType ) + { + case XTYP_ADVSTART: + nMsg = WM_DDE_ADVISE; + nTimeoutErr = DMLERR_ADVACKTIMEOUT; +{ + nTimeout = 60000; +#if 0 && defined(OV_DEBUG) + char aBuf[ 128 ]; + ImpDdeMgr::DdeQueryString( hszItem,aBuf,127,850); + String aXXStr("Establishing hotlink "); + aXXStr += aBuf; + WRITELOG((char*)aXXStr.GetStr()); +#endif + +} + break; + + case XTYP_ADVSTOP: + nMsg = WM_DDE_UNADVISE; + nTimeoutErr = DMLERR_UNADVACKTIMEOUT; + break; + + case XTYP_REQUEST: + nMsg = WM_DDE_REQUEST; + nTimeoutErr = DMLERR_DATAACKTIMEOUT; + break; + + case XTYP_POKE: + nMsg = WM_DDE_POKE; + nTimeoutErr = DMLERR_POKEACKTIMEOUT; + break; + + case XTYP_EXECUTE: + nMsg = WM_DDE_EXECUTE; + nTimeoutErr = DMLERR_EXECACKTIMEOUT; + break; + + default: + nMsg = 0; + } + if(!hConv || (USHORT)hConv>= pData->nMaxConvCount || !nType || !nMsg || + (nType != XTYP_EXECUTE && (!hszItem || !nFormat)) ) + { + WRITELOG("DdeClientTransaction:Invalid parameter") + ImpDdeMgr::nLastErrInstance = DMLERR_INVALIDPARAMETER; + if( bIsDdeHandle && !bAppOwnsHandle ) + DdeFreeDataHandle( (HDDEDATA)pDdeData ); + return (HDDEDATA)0; + } + + // ueber den Conversation handle das ImpDdeMgr-Objekt holen + ImpHCONV* pConv = GetConvTable( pData ); + pConv += (USHORT)hConv; + ImpConvWndData* pObj = + (ImpConvWndData*)WinQueryWindowULong( pConv->hWndThis, 0 ); + ImpDdeMgr* pThis = pObj->pThis; + + if( bSync && pThis->bInSyncTrans ) + { + WRITELOG("DdeClientTransaction:Already in sync. transaction") + ImpDdeMgr::nLastErrInstance = DMLERR_REENTRANCY; + if( bIsDdeHandle && !bAppOwnsHandle ) + DdeFreeDataHandle( (HDDEDATA)pDdeData ); + return (HDDEDATA)0; + } + + Transaction* pTrans; + + BOOL bReqOnAdvLoop = FALSE; + ULONG nTransId = GetTransaction( pData, hConv, hszItem, nFormat ); + if( nTransId ) + { + // WRITELOG("DdeClientTransaction:Transaction found") + pTrans = GetTransTable( pData ); + pTrans += (USHORT)nTransId; + USHORT nTransType = pTrans->nType; + nTransType &= (~XTYPF_MASK); + if( (nType != XTYP_REQUEST && nTransType == nType) || + // wird Advise-Loop schon zum requesten missbraucht ? + (nType == XTYP_REQUEST && + nTransType == XTYP_ADVREQ && + pTrans->nConvst == XST_WAITING_REQDATA)) + { + // dieser Kanal ist dicht! + WRITELOG("DdeClientTransaction:Transaction already used") + ImpDdeMgr::nLastErrInstance = DMLERR_REENTRANCY; + if( bIsDdeHandle && !bAppOwnsHandle ) + DdeFreeDataHandle( (HDDEDATA)pDdeData ); + return (HDDEDATA)0; + } + else if( nTransType == XTYP_ADVREQ ) + { + switch( nType ) + { + case XTYP_ADVSTOP: + //WRITELOG("DdeClientTransaction:Stopping advise trans") + pTrans->nType = XTYP_ADVSTOP; + break; + + case XTYP_ADVSTART: + //WRITELOG("DdeClientTransaction:Adj. Advise-Params") + pTrans->nType = XTYP_ADVREQ; + if( bNoData ) + pTrans->nType |= XTYPF_NODATA; + if( bAckReq ) + pTrans->nType |= XTYPF_ACKREQ; + if( pResult ) + *pResult = nTransId; + return (HDDEDATA)TRUE; + + case XTYP_REQUEST: + // WRITELOG("DdeClientTransaction:Using adv trans for req") + // nConvst wird unten auf XST_WAITING_REQDATA gesetzt + bReqOnAdvLoop = TRUE; + break; + + default: + WRITELOG("DdeClientTransaction:Invalid parameter") + ImpDdeMgr::nLastErrInstance = DMLERR_INVALIDPARAMETER; + if( bIsDdeHandle && !bAppOwnsHandle ) + DdeFreeDataHandle( (HDDEDATA)pDdeData ); + return (HDDEDATA)FALSE; + } + } + } + else + { + // WRITELOG("DdeClientTransaction:Creating transaction") + nTransId = CreateTransaction(pData, hConv, hszItem, nFormat, nType); + } + + pTrans = GetTransTable( pData ); + pTrans += (USHORT)nTransId; + pTrans->nConvst = XST_WAITING_ACK; + if( nType == XTYP_REQUEST ) + pTrans->nConvst = XST_WAITING_REQDATA; + + HWND hWndServer = pConv->hWndPartner; + HWND hWndClient = pConv->hWndThis; + + HDDEDATA pOutDDEData; + if( bIsDdeHandle ) + { + if( bAppOwnsHandle ) + { + // wir muessen leider leider duplizieren, da uns OS/2 + // keine Chance laesst, diesen Status im Datenobjekt + // zu versenken. + ////WRITELOG("DdeClientTransaction:Copying handle") + HDDEDATA pNew; + HDDEDATA pData = (HDDEDATA)pDdeData; + if( !(MyDosAllocSharedMem((PPVOID)&pNew, NULL, pData->cbData, + PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GIVEABLE | OBJ_ANY, + "MakeDDEObject"))) + { + memcpy( pNew, pData, pData->cbData ); + pOutDDEData = pNew; + } + else + { + WRITELOG("DdeClientTransaction:No Memory") + ImpDdeMgr::nLastErrInstance = DMLERR_LOW_MEMORY; + return (HDDEDATA)0; + } + } + else + pOutDDEData = (HDDEDATA)pDdeData; + } + else + pOutDDEData=MakeDDEObject(hWndServer,hszItem,0,nFormat,pDdeData,cbData); + + pOutDDEData->fsStatus |= nTypeFlags; + + HDDEDATA pDDEInData = 0; + if( bSync ) + { + if( nType != XTYP_REQUEST ) + pOutDDEData->fsStatus |= DDE_FACKREQ; + + // WRITELOG("DdeClientTransaction:Starting sync. trans.") + pThis->hSyncResponseData = (HDDEDATA)0; + pThis->nSyncResponseMsg = 0; + pThis->bInSyncTrans = TRUE; + pThis->nSyncTransId = nTransId; + pThis->bSyncAbandonTrans = FALSE; + + if ( !MyWinDdePostMsg( hWndServer, hWndClient, nMsg, pOutDDEData, + DDEPM_RETRY) ) + { + WRITELOG("DdeClientTransaction:PostMsg failed") + nLastErrInstance = DMLERR_POSTMSG_FAILED; + if( !bReqOnAdvLoop ) + FreeTransaction( pData, nTransId ); + else + { + DBG_ASSERT(pTrans->nType==XTYP_ADVREQ,"DDE:Error!") + pTrans->nConvst = 0; + } + return FALSE; + } + HAB hAB = WinQueryAnchorBlock( hWndClient ); + ULONG nDummyTimer = WinStartTimer( hAB, 0, 0, 50 ); + ULONG nTimeoutId = TID_USERMAX - nTransId; + WinStartTimer( hAB, hWndClient, nTimeoutId, nTimeout ); + QMSG aQueueMsg; + BOOL bLoop = TRUE; + while( bLoop ) + { + if( pThis->nSyncResponseMsg ) + bLoop = FALSE; + else + { + if( WinGetMsg(hAB,&aQueueMsg,0,0,0 )) + { + WinDispatchMsg( hAB, &aQueueMsg ); + } + else + bLoop = FALSE; + } + } + + WinStopTimer( hAB, hWndClient, nTimeoutId ); + WinStopTimer( hAB, 0, nDummyTimer ); + + // + // Der Speicherblock pOutDDEData muss vom Server geloescht worden sein! + // Ueberlegen: Nochmal loeschen, falls Server buggy ist, ansonsten + // platzt uns bald der Adressraum! + // + if( !pThis->nSyncResponseMsg ) + { + // unsere App wurde beendet + ////WRITELOG("DdeClientTransaction:App terminated") + return 0; + } + pDDEInData = pThis->hSyncResponseData; + nMsg = pThis->nSyncResponseMsg; + pThis->hSyncResponseData= 0; + pThis->nSyncResponseMsg = 0; + pThis->bInSyncTrans = FALSE; + pThis->nSyncTransId = 0; + if( !pDDEInData && nMsg != WM_TIMER ) + { + DBG_ASSERT(0,"Dde:No data!"); + WRITELOG("DdeClientTransaction: No Data!") + return (HDDEDATA)0; + } + switch( nMsg ) + { + case WM_TIMER: + WRITELOG("DdeClientTransaction:Timeout!") + nLastErrInstance = nTimeoutErr; + if( bReqOnAdvLoop ) + // auf normalen Loop-Betrieb zurueckschalten + pTrans->nConvst = XST_WAITING_ADVDATA; + break; + + case WM_DDE_ACK: + { + // WRITELOG("DdeClientTransaction:Ack received") + BOOL bPositive = (BOOL)(pDDEInData->fsStatus & DDE_FACK); + MyDosFreeMem( pDDEInData,"DdeClientTransaction" ); + pDDEInData = (HDDEDATA)bPositive; + if( nType == XTYP_ADVSTART && pDDEInData ) + { + +#if 0 && defined(OV_DEBUG) + char aBuf[ 128 ]; + ImpDdeMgr::DdeQueryString( pTrans->hszItem,aBuf,128,850); + String aXXStr("Hotlink "); +#endif + + if( bPositive ) + { + pTrans->nType = XTYP_ADVREQ; + // Hot/Warmlink, Ack + pTrans->nType |= nTypeFlags; + // XST_WAITING_ACK ==> XST_WAITING_ADVDATA + pTrans->nConvst = XST_WAITING_ADVDATA; + +#if 0 && defined(OV_DEBUG) + aXXStr += "established "; + aXXStr += aBuf; +#endif + + } + +#if 0 && defined(OV_DEBUG) + else + { + aXXStr += "failed "; + aXXStr += aBuf; + } + WRITELOG((char*)aXXStr.GetStr()); +#endif + + } + } + break; + + case WM_DDE_DATA: + // WRITELOG("DdeClientTransaction:Data received") + // WRITEDATA(pDDEInData) + if( bReqOnAdvLoop ) + { + DBG_ASSERT(pTrans->nConvst==XST_WAITING_REQDATA,"DDE:Bad state"); + DBG_ASSERT(pTrans->nType==XTYP_ADVREQ,"DDE:Bad state"); + // auf Loop-Betrieb umschalten + pTrans->nConvst = XST_WAITING_ADVDATA; + } + break; + + default: + WRITELOG("DdeClientTransaction:Unexpected msg") + MyDosFreeMem( pDDEInData,"DdeClientTransaction" ); + pDDEInData = 0; + } + pThis->bSyncAbandonTrans = FALSE; + pThis->bInSyncTrans = FALSE; + if( pThis->bSyncAbandonTrans && bReqOnAdvLoop ) + pThis->DdeAbandonTransaction( hConv, nTransId ); + } + else + { + // WRITELOG("DdeClientTransaction:Starting async. trans.") + pDDEInData = (HDDEDATA)MyWinDdePostMsg( hWndServer, hWndClient, nMsg, + pOutDDEData, DDEPM_RETRY); + if( !pDDEInData ) + { + WRITELOG("DdeClientTransaction:PostMsg failed") + nLastErrInstance = DMLERR_POSTMSG_FAILED; + if( !bReqOnAdvLoop ) + FreeTransaction( pData, nTransId ); + else + { + DBG_ASSERT(pTrans->nType==XTYP_ADVREQ,"DDE:Error!") + pTrans->nConvst = 0; + } + } + else + { + // WRITELOG("DdeClientTransaction:Async trans. success") + if( pResult ) + *pResult = nTransId; + } + } +#if 0 && defined( OV_DEBUG ) + if( nType == XTYP_REQUEST ) + { + WRITELOG("End XTYP_REQUEST"); + WinMessageBox(HWND_DESKTOP,HWND_DESKTOP, + "End XTYP_REQUEST","DdeClientTransaction", + HWND_DESKTOP,MB_OK); + } +#endif + //WRITELOG("DdeClientTransaction:End") + //WRITESTATUS("DdeClientTransaction:End") + return pDDEInData; +} + +MRESULT ImpDdeMgr::DdeRegister( ImpWndProcParams* pParams ) +{ + MRESULT nRet = (MRESULT)0; + if ( !(nTransactFilter & CBF_SKIP_REGISTRATIONS) ) + { + HSZ hSBaseName = (HSZ)pParams->nPar1; + HSZ hIBaseName = (HSZ)pParams->nPar2; + nRet=(MRESULT)Callback(XTYP_REGISTER,0,0,hSBaseName,hIBaseName,0,0,0); + } + return nRet; +} + +MRESULT ImpDdeMgr::DdeUnregister( ImpWndProcParams* pParams ) +{ + MRESULT nRet = (MRESULT)0; + if ( !(nTransactFilter & CBF_SKIP_UNREGISTRATIONS) ) + { + HSZ hSBaseName = (HSZ)pParams->nPar1; + HSZ hIBaseName = (HSZ)pParams->nPar2; + nRet=(MRESULT)Callback(XTYP_UNREGISTER,0,0,hSBaseName,hIBaseName,0,0,0); + } + return nRet; +} + +MRESULT ImpDdeMgr::DdeTimeout( ImpWndProcParams* pParams ) +{ + ////WRITELOG("DdeTimeout:Received") + if( nSyncResponseMsg ) + { + ////WRITELOG("DdeTimeout:Trans already processed->ignoring timeout") + return (MRESULT)1; + } + ULONG nTimerId = (ULONG)pParams->nPar1; + ULONG nTransId = TID_USERMAX - nTimerId; + Transaction* pTrans = pTransTable; + pTrans += (USHORT)nTransId; + if( nTransId < 1 || nTransId >= pData->nMaxTransCount || + pTrans->hConvOwner == 0 ) + { + DBG_ASSERT(0,"DdeTimeout:Invalid TransactionId"); + return (MRESULT)1; + } + if( bInSyncTrans && nTransId == nSyncTransId ) + { + USHORT nTempType = pTrans->nType; + nTempType &= (~XTYPF_MASK); + // advise-loops koennen nur innerhalb synchroner + // requests timeouts bekommen. die transaktion wird + // in diesem fall nicht geloescht. + if( nTempType != (XTYP_ADVREQ & (~XTYPF_NOBLOCK) )) + { + ////WRITELOG("DdeTimeout:Freeing transaction") + FreeTransaction( pData, nTransId ); + } + nSyncResponseMsg = WM_TIMER; +#if 0 && defined( OV_DEBUG ) + String aMsg("DdeTimeout:Transaction="); + aMsg += nTransId; + WRITELOG((char*)(const char*)aMsg) +#endif + } + else + { + ////WRITELOG("DdeTimeout:Async transaction timed out") + pTrans->nConvst = XST_TIMEOUT; + } + return (MRESULT)1; +} + + + +MRESULT ImpDdeMgr::DdeTerminate( ImpWndProcParams* pParams ) +{ + WRITELOG("DdeTerminate:Received") + HWND hWndThis = pParams->hWndReceiver; + HWND hWndPartner = (HWND)(pParams->nPar1); + + HCONV hConv = GetConvHandle( pData, hWndThis, hWndPartner ); +#if 0 && defined( OV_DEBUG ) + String strDebug("DdeTerminate:ConvHandle="); + strDebug += (USHORT)hConv; + WRITELOG((char*)(const char*)strDebug) +#endif + ImpHCONV* pConv = pConvTable + (USHORT)hConv; + if( hConv ) + { + // warten wir auf ein DDE_TERMINATE Acknowledge ? + if( pConv->nStatus & ST_TERMINATED ) + { + ////WRITELOG("DdeTerminate:TERMINATE-Ack received") + pConv->nStatus |= ST_TERMACKREC; + return (MRESULT)0; // DdeDisconnect raeumt jetzt auf + } + + // sind wir Server?, wenn ja: die App benachrichtigen, + // dass die Advise loops gestoppt wurden und die + // Transaktionen loeschen + + // OV 26.07.96: Die das TERMINATE empfangende App muss + // die Transaction-Tabelle abraeumen, egal ob Server oder Client!! + // Es muessen alle Trans geloescht werden, die als Owner den + // Client oder den Server haben! + // if( !(pConv->nStatus & ST_CLIENT ) ) + SendUnadvises( hConv, 0, FALSE ); // alle Formate & nicht loeschen + SendUnadvises( pConv->hConvPartner, 0, FALSE ); + + // wir werden von draussen gekillt + if ( !(nTransactFilter & CBF_SKIP_DISCONNECTS) ) + { + Callback( XTYP_DISCONNECT, 0, hConv, 0, 0, 0, + 0, (ULONG)IsSameInstance(hWndPartner)); + } + + // kann unsere Partner-App DDEML ? + if( !(pConv->hConvPartner) ) + { + // nein, deshalb Transaktionstabelle selbst loeschen + ////WRITELOG("DdeTerminate:Freeing transactions") + FreeTransactions( pData, hConv ); + } + } + else + nLastErrInstance = DMLERR_NO_CONV_ESTABLISHED; + +#if 0 && defined(OV_DEBUG) + if( !WinIsWindow(0,hWndPartner)) + { + WRITELOG("DdeTerminate:hWndPartner not valid") + } + if(!WinIsWindow(0,hWndThis)) + { + WRITELOG("DdeTerminate:hWndThis not valid") + } +#endif + + if( hConv ) + { + // hWndThis nicht loeschen, da wir den Handle noch fuer + // das Acknowledge brauchen + ////WRITELOG("DdeTerminate:Freeing conversation") + FreeConvHandle( pData, hConv, FALSE ); + } + + ////WRITELOG("DdeTerminate:Acknowledging DDE_TERMINATE") + +#ifdef OV_DEBUG + DBG_ASSERT(WinIsWindow( 0, hWndThis ),"hWndThis not valid"); +#endif + + if( !WinDdePostMsg( hWndPartner, hWndThis, WM_DDE_TERMINATE, 0, DDEPM_RETRY )) + { + ////WRITELOG("DdeTerminate:Acknowledging DDE_TERMINATE failed") + } + // jetzt hWndThis loeschen + DestroyConversationWnd( hWndThis ); + + return (MRESULT)0; +} + + +/* + Zuordnung des Conversationhandles: + + Verbindungsaufbau: + Client: DdeInitiate( HWNDClient ) + Server: Post( WM_DDE_INITIATEACK( HWNDServer )) + Client: CreateConvHandle( HWNDClient, HWNDServer ) + + Datenaustausch: + Server: Post(WM_DDE_ACK( HWNDSender )) + Client: GetConvHandle( HWNDClient, HWNDSender ) +*/ + +MRESULT ImpDdeMgr::ConvWndProc( HWND hWnd,ULONG nMsg,MPARAM nPar1,MPARAM nPar2 ) +{ + ImpWndProcParams aParams; + + MRESULT nRet = (MRESULT)0; + aParams.hWndReceiver= hWnd; + aParams.nPar1 = nPar1; + aParams.nPar2 = nPar2; + + switch( nMsg ) + { + +#ifdef DBG_UTIL + case WM_DDE_INITIATE : + DBG_ASSERT(0,"dde:unexpected msg"); + nRet = (MRESULT)TRUE; + break; +#endif + + case WM_DDE_INITIATEACK : nRet = DdeInitiateAck(&aParams); break; + case WM_DDE_ACK : nRet = DdeAck( &aParams ); break; + case WM_DDE_ADVISE : nRet = DdeAdvise( &aParams ); break; + case WM_DDE_DATA : nRet = DdeData( &aParams ); break; + case WM_DDE_EXECUTE : nRet = DdeExecute( &aParams ); break; + case WM_DDE_POKE : nRet = DdePoke( &aParams ); break; + case WM_DDE_REQUEST : nRet = DdeRequest( &aParams ); break; + case WM_DDE_TERMINATE : nRet = DdeTerminate( &aParams ); break; + case WM_DDE_UNADVISE : nRet = DdeUnadvise( &aParams ); break; + case WM_TIMER : nRet = DdeTimeout( &aParams ); break; + } + return nRet; +} + +MRESULT ImpDdeMgr::SrvWndProc( HWND hWnd,ULONG nMsg,MPARAM nPar1,MPARAM nPar2 ) +{ + MRESULT nRet = (MRESULT)0; + + ImpWndProcParams aParams; + aParams.hWndReceiver= hWnd; + aParams.nPar1 = nPar1; + aParams.nPar2 = nPar2; + + switch( nMsg ) + { +#ifdef DBG_UTIL + case WM_DDE_ACK : + case WM_DDE_ADVISE : + case WM_DDE_EXECUTE : + case WM_DDE_POKE : + case WM_DDE_REQUEST : + case WM_DDE_UNADVISE : + case WM_DDE_DATA : + case WM_DDE_INITIATEACK : + DBG_ASSERT(0,"dde:unexpected msg"); + nRet = (MRESULT)TRUE; + break; +#endif + + case WM_DDE_TERMINATE : + break; // DDE_INITIATE wurde im DDE_INITIATEACK terminiert + + // ein Client will was von uns + case WM_DDE_INITIATE : + nRet = DdeInitiate( &aParams ); + break; + + // eine ddeml-faehige App. hat einen Service (typ. AppName) [de]reg. + case WM_DDEML_REGISTER : + nRet = DdeRegister( &aParams ); + break; + + case WM_DDEML_UNREGISTER : + nRet = DdeUnregister( &aParams ); + break; + }; + return nRet; +} + + +MRESULT ImpDdeMgr::DdeAck( ImpWndProcParams* pParams ) +{ + //WRITELOG("DdeAck:Start") + HSZ hszItem; + DDESTRUCT* pInDDEData = (DDESTRUCT*)(pParams->nPar2); + if( pInDDEData ) + { + BOOL bPositive = (BOOL)(pInDDEData->fsStatus & DDE_FACK ) != 0; + BOOL bBusy = bPositive ? FALSE : (BOOL)(pInDDEData->fsStatus & DDE_FBUSY ) != 0; + BOOL bNotProcessed = (BOOL)(pInDDEData->fsStatus & DDE_NOTPROCESSED ) != 0; +#if 0 && defined( OV_DEBUG ) + String aDebStr("DdeAck:Received "); + if( bPositive ) + aDebStr += "(positive)"; + else + aDebStr += "(negative)"; + if( bBusy ) + aDebStr += "(busy)"; + if( bNotProcessed ) + aDebStr += "(not processed)"; + WRITELOG((char*)(const char*)aDebStr) +#endif + // ein DDE_ACK niemals bestaetigen (um endlosschleifen zu vermeiden) + pInDDEData->fsStatus &= (~DDE_FACKREQ); + } + else + { + //WRITELOG("DdeAck:Received (no data!)") + return (MRESULT)0; + } + + HCONV hConv = CheckIncoming(pParams, 0, hszItem); +#ifdef OV_DEBUG + if( !hConv ) + { + WRITELOG("DdeAck:HCONV not found") + } +#endif + ULONG nTransId=GetTransaction(pData,hConv,hszItem,pInDDEData->usFormat); + if( !nTransId ) + { + WRITELOG("DdeAck:Transaction not found") + MyDosFreeMem( pInDDEData,"DdeAck" ); + return (MRESULT)0; + } + + BOOL bThisIsSync = (BOOL)( bInSyncTrans && nTransId == nSyncTransId ); +#if 0 && defined( OV_DEBUG ) + if( bThisIsSync) + WRITELOG("DdeAck: sync transaction") + else + WRITELOG("DdeAck: async transaction") +#endif + // pruefen, ob die Transaktion abgeschlossen ist. + Transaction* pTrans = pTransTable; + pTrans += (USHORT)nTransId; + ImpHCONV* pConv = pConvTable; + pConv += (USHORT)hConv; + + if( pTrans->nConvst == XST_UNADVSENT ) + { + //WRITELOG("DdeAck:Unadvise-Ack received") + pTrans->nConvst = XST_UNADVACKRCVD; + MyDosFreeMem( pInDDEData,"DdeAck" ); + DdeFreeStringHandle( hszItem ); + return (MRESULT)0; + } + if( pTrans->nConvst == XST_ADVDATASENT ) + { + //WRITELOG("DdeAck:AdvData-Ack received") + pTrans->nConvst = XST_ADVDATAACKRCVD; + MyDosFreeMem( pInDDEData,"DdeAck" ); + DdeFreeStringHandle( hszItem ); + return (MRESULT)0; + } + + USHORT nType = pTrans->nType; + nType &= (~XTYPF_MASK); + // beginn einer advise-loop oder request auf advise-loop ? + // wenn ja: transaktion nicht loeschen + BOOL bFinished = (BOOL)(nType != XTYP_ADVSTART && + nType != (XTYP_ADVREQ & (~XTYPF_NOBLOCK)) ); + if( bFinished ) + { + if( !bThisIsSync ) + { + ////WRITELOG("DdeAck:Transaction completed") + Callback( XTYP_XACT_COMPLETE, pInDDEData->usFormat, hConv, + pConv->hszTopic, hszItem, (HDDEDATA)0, nTransId, 0 ); + } + ////WRITELOG("DdeAck:Freeing transaction") + FreeTransaction( pData, nTransId ); + } + + if( bThisIsSync ) + { + hSyncResponseData = pInDDEData; + nSyncResponseMsg = WM_DDE_ACK; + } + else + { + MyDosFreeMem( pInDDEData,"DdeAck" ); + } + + DdeFreeStringHandle( hszItem ); + + return (MRESULT)0; +} + + +USHORT ImpDdeMgr::SendUnadvises(HCONV hConvServer,USHORT nFormat,BOOL bFree) +{ + USHORT nTransFound = 0; + BOOL bCallApp = (BOOL)(!(nTransactFilter & CBF_FAIL_ADVISES)); +#if 0 && defined( OV_DEBUG ) + String aStr("Unadvising transactions for HCONV="); + aStr += (ULONG)hConvServer; + aStr += " CallApp:"; aStr += (USHORT)bCallApp; + WRITELOG((char*)aStr.GetStr()) +#endif + + + // wenn wir weder loeschen noch die App benachrichtigen sollen, + // koennen wir gleich wieder returnen + if( !hConvServer || ( !bFree && !bCallApp ) ) + return 0; + + ImpHCONV* pConvSrv = pConvTable; + pConvSrv += (USHORT)hConvServer; + HSZ hszTopic = pConvSrv->hszTopic; + + Transaction* pTrans = pTransTable; + pTrans++; + USHORT nCurTransId = 1; + USHORT nCurTransactions = pData->nCurTransCount; + while( nCurTransactions && nCurTransId < pData->nMaxTransCount ) + { + if( pTrans->hConvOwner ) + nCurTransactions--; + if( pTrans->hConvOwner == hConvServer && + (pTrans->nType & XTYP_ADVREQ) ) + { + if( !nFormat || (nFormat == pTrans->nFormat) ) + { + nTransFound++; + if( bCallApp ) + { + //WRITELOG("SendUnadvises:Notifying App") + Callback( XTYP_ADVSTOP, pTrans->nFormat, hConvServer, + hszTopic, pTrans->hszItem, 0,0,0 ); + } + if( bFree ) + FreeTransaction( pData, (ULONG)nCurTransId ); + } + } + nCurTransId++; + pTrans++; + } + return nTransFound; +} + + + +HCONV ImpDdeMgr::CheckIncoming( ImpWndProcParams* pParams, ULONG nTransMask, + HSZ& rhszItem ) +{ +// ////WRITELOG("CheckIncoming") + rhszItem = 0; + DDESTRUCT* pInDDEData = (DDESTRUCT*)(pParams->nPar2); + if( !pInDDEData ) + { + // ////WRITELOG("CheckIncoming:PDDESTRUCT==0") + return (HCONV)0; + } + + HWND hWndThis = pParams->hWndReceiver; + HWND hWndClient = (HWND)pParams->nPar1; + + BOOL bReject = (BOOL)(nTransactFilter & nTransMask); + HCONV hConv; + if( !bReject ) + hConv = GetConvHandle( pData, hWndThis, hWndClient ); + if ( bReject || !hConv ) + return (HCONV)0; + + rhszItem = DdeCreateStringHandle( + ((char*)(pInDDEData)+pInDDEData->offszItemName), 850 ); + + // ////WRITELOG("CheckIncoming:OK"); + return hConv; +} + + +MRESULT ImpDdeMgr::DdeAdvise( ImpWndProcParams* pParams ) +{ + ////WRITELOG("DdeAdvise:Received") + HSZ hszItem; + HCONV hConv = CheckIncoming(pParams, CBF_FAIL_ADVISES, hszItem); + DDESTRUCT* pInDDEData = (DDESTRUCT*)(pParams->nPar2); + HWND hWndThis = pParams->hWndReceiver; + HWND hWndClient = (HWND)pParams->nPar1; + if( !hConv ) + { + ////WRITELOG("DdeAdvise:Conversation not found") + pInDDEData->fsStatus &= (~DDE_FACK); + MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY); + DdeFreeStringHandle( hszItem ); + return (MRESULT)0; + } + + Transaction* pTrans = pTransTable; + ImpHCONV* pConv = pConvTable; + pConv += (USHORT)hConv; + + // existiert schon ein Link auf Topic/Item/Format-Vektor ? + + ULONG nTransId=GetTransaction(pData,hConv,hszItem,pInDDEData->usFormat); + if( nTransId ) + { + ////WRITELOG("DdeAdvise:Transaction already exists") + pTrans += (USHORT)nTransId; + // ist es eine AdviseLoop ? + USHORT nTempType = pTrans->nType; + nTempType &= (~XTYPF_MASK); + if( nTempType == XTYP_ADVREQ ) + { + // Flags der laufenden Advise-Loop aktualisieren + ////WRITELOG("DdeAdvise:Adjusting Advise-Params") + pTrans->nType = XTYP_ADVREQ; + if( pInDDEData->fsStatus & DDE_FNODATA ) + pTrans->nType |= XTYPF_NODATA; + if( pInDDEData->fsStatus & DDE_FACKREQ ) + pTrans->nType |= XTYPF_ACKREQ; + pInDDEData->fsStatus |= DDE_FACK; + MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY); + DdeFreeStringHandle( hszItem ); + return (MRESULT)0; + } + else if( nTempType != XTYP_ADVSTART ) + { + ////WRITELOG("DdeAdvise:Not a advise transaction") + pInDDEData->fsStatus &= (~DDE_FACK); + MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY); + DdeFreeStringHandle( hszItem ); + return (MRESULT)0; + } + } + + if( !nTransId ) + { + ////WRITELOG("DdeAdvise:Creating Transaction") + ////WRITESTATUS("DdeAdvise:Creating Transaction") + nTransId = CreateTransaction( pData, hConv, hszItem, + pInDDEData->usFormat, XTYP_ADVREQ ); + ////WRITESTATUS("DdeAdvise:Created Transaction") + } + if( nTransId ) + { + pTrans = pTransTable; + pTrans += (USHORT)nTransId; + if( pInDDEData->fsStatus & DDE_FNODATA ) + pTrans->nType |= XTYPF_NODATA; + if( pInDDEData->fsStatus & DDE_FACKREQ ) + pTrans->nType |= XTYPF_ACKREQ; + } + else + { + ////WRITELOG("DdeAdvise:Cannot create Transaction") + pInDDEData->fsStatus &= (~DDE_FACK); + MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY); + DdeFreeStringHandle( hszItem ); + return (MRESULT)0; + } + + ////WRITELOG("DdeAdvise:Calling Server") + + if ( Callback( XTYP_ADVSTART, pInDDEData->usFormat, + hConv, pConv->hszTopic, hszItem, (HDDEDATA)0, 0, 0 ) ) + { + // + // ServerApp erlaubt AdviseLoop + // + ////WRITELOG("DdeAdvise:Advise loop established") + pInDDEData->fsStatus |= DDE_FACK; + MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY); + } + else + { + ////WRITELOG("DdeAdvise:Advise loop not established") + FreeTransaction( pData, nTransId ); + pInDDEData->fsStatus &= (~DDE_FACK); // DDE_FNOTPROCESSED; + MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY); + } + ////WRITESTATUS("DdeAdvise:End") + ////WRITELOG("DdeAdvise:End") + DdeFreeStringHandle( hszItem ); + return (MRESULT)0; +} + +MRESULT ImpDdeMgr::DdeData( ImpWndProcParams* pParams ) +{ + WRITELOG("DdeData:Received") + HSZ hszItem; + HCONV hConv = CheckIncoming(pParams, 0, hszItem); + HWND hWndThis = pParams->hWndReceiver; + HWND hWndClient = (HWND)pParams->nPar1; + DDESTRUCT* pInDDEData = (DDESTRUCT*)(pParams->nPar2); +#if 0 && defined( OV_DEBUG ) + { + String aStr("DdeData Address:"); + aStr += (ULONG)pInDDEData; + WRITELOG((char*)aStr.GetStr()) + } +#endif + + BOOL bSendAck; + if( pInDDEData && (pInDDEData->fsStatus & DDE_FACKREQ )) + { + WRITELOG("DdeData: Ackn requested") + bSendAck = TRUE; + } + else + { + WRITELOG("DdeData: Ackn not requested") + bSendAck = FALSE; + } + + ULONG nTransId = GetTransaction(pData,hConv,hszItem,pInDDEData->usFormat); + if( !nTransId ) + { + WRITELOG("DdeData:Transaction not found") + WRITEDATA(pInDDEData) + if( bSendAck ) + { + WRITELOG("DdeData: Posting Ackn") + pInDDEData->fsStatus &= (~DDE_FACK); // NOTPROCESSED; + MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY); + } + else + { + MyDosFreeMem( pInDDEData,"DdeData" ); + } + return (MRESULT)0; + } + +#if 0 && defined( OV_DEBUG ) + if( pInDDEData ) + { + WRITEDATA(pInDDEData) + } +#endif + + BOOL bThisIsSync = (BOOL)( bInSyncTrans && nTransId == nSyncTransId ); + + // pruefen, ob die Transaktion abgeschlossen ist. + Transaction* pTrans = pTransTable; + pTrans += (USHORT)nTransId; + + if( pTrans->nConvst == XST_WAITING_ACK ) + { + // dieser Fall kann eintreten, wenn ein Server innerhalb + // einer WM_DDE_ADVISE-Msg. oder bevor beim Client das + // Ack eintrifft, Advise-Daten sendet. + WRITELOG("DdeData:Ignoring unexpected data") + if( bSendAck ) + { + WRITELOG("DdeData: Posting Ackn") + pInDDEData->fsStatus &= (~DDE_FACK); // NOTPROCESSED; + MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY); + } + else + { + MyDosFreeMem( pInDDEData,"DdeData" ); + } + return (MRESULT)0; + } + + ImpHCONV* pConv = pConvTable; + pConv += (USHORT)hConv; + + USHORT nType = pTrans->nType; + nType &= (~XTYPF_MASK); + BOOL bNotAdviseLoop = (BOOL)(nType != (XTYP_ADVREQ & (~XTYPF_NOBLOCK))); + if( !bThisIsSync ) + { + // WRITELOG("DdeData:Is async transaction") + if( bNotAdviseLoop ) + { + // WRITELOG("DdeData:Transaction completed -> calling client") + Callback( XTYP_XACT_COMPLETE, pInDDEData->usFormat, hConv, + pConv->hszTopic, hszItem, pInDDEData, nTransId, 0 ); + // WRITELOG("DdeData:Freeing transaction") + FreeTransaction( pData, nTransId ); + } + else + { + WRITELOG("DdeData:Advise-Loop -> calling client") + HDDEDATA pToSend = pInDDEData; + if( pTrans->nType & XTYPF_NODATA ) + { + pToSend = 0; + // WRITELOG("DdeData:Is warm link") + } + Callback( XTYP_ADVDATA, pInDDEData->usFormat, hConv, + pConv->hszTopic, hszItem, pToSend, nTransId, 0 ); + } + if( bSendAck ) + { + WRITELOG("DdeData: Posting Ackn") + pInDDEData->fsStatus = DDE_FACK; + MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY); + } + else + MyDosFreeMem( pInDDEData,"DdeData" ); + } + else // synchrone Transaktion (Datenhandle nicht freigeben!) + { + // WRITELOG("DdeData:Is sync transaction") + hSyncResponseData = pInDDEData; + nSyncResponseMsg = WM_DDE_DATA; + if( bSendAck ) + { + pInDDEData->fsStatus |= DDE_FACK; + WRITELOG("DdeData: Posting Ackn") + MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData, + DDEPM_RETRY | DDEPM_NOFREE ); + } + } + + DdeFreeStringHandle( hszItem ); + // WRITELOG("DdeData:End") + return (MRESULT)0; +} + +MRESULT ImpDdeMgr::DdeExecute( ImpWndProcParams* pParams ) +{ + ////WRITELOG("DdeExecute:Received") + DDESTRUCT* pInDDEData = (DDESTRUCT*)(pParams->nPar2); + HSZ hszItem; + HCONV hConv = CheckIncoming(pParams, 0, hszItem); + BOOL bSuccess = FALSE; + ImpHCONV* pConv = pConvTable; + pConv += (USHORT)hConv; + if ( hConv && !(nTransactFilter & CBF_FAIL_EXECUTES) && pInDDEData ) + { + if ( Callback( XTYP_EXECUTE, pInDDEData->usFormat, hConv, + pConv->hszTopic, hszItem, pInDDEData, 0, 0 ) + == (DDESTRUCT*)DDE_FACK ) + bSuccess = TRUE; + } + else + { + ////WRITELOG("DdeExecute:Not processed") + } + if( pInDDEData ) + { + if( bSuccess ) + pInDDEData->fsStatus |= DDE_FACK; + else + pInDDEData->fsStatus &= (~DDE_FACK); + MyWinDdePostMsg( pConv->hWndPartner, pConv->hWndThis, WM_DDE_ACK, + pInDDEData, DDEPM_RETRY ); + } + DdeFreeStringHandle( hszItem ); + return (MRESULT)0; +} + +HCONV ImpDdeMgr::ConnectWithClient( HWND hWndClient, + HSZ hszPartner, HSZ hszService, HSZ hszTopic, BOOL bSameInst, + DDEINIT* pDDEData, CONVCONTEXT* pCC ) +{ + ////WRITELOG("ConnectWithClient:Start") + HWND hWndSrv = CreateConversationWnd(); + IncConversationWndRefCount( hWndSrv ); + HCONV hConv = CreateConvHandle( pData, pidThis, hWndSrv, hWndClient, + hszPartner, hszService, hszTopic ); + if(!hConv ) + return 0; + BOOL bFreeDdeData = FALSE; + if( !pDDEData ) + { + bFreeDdeData = TRUE; + pDDEData = CreateDDEInitData( hWndClient,hszService,hszTopic, pCC ); + PID pid; TID tid; + WinQueryWindowProcess( hWndClient, &pid, &tid ); + DosGiveSharedMem( pDDEData, pid, PAG_READ | PAG_WRITE); + } + HAB hAB = WinQueryAnchorBlock( hWndSrv ); + WinGetLastError( hAB ); // fehlercode zuruecksetzen + WinSendMsg(hWndClient,WM_DDE_INITIATEACK,(MPARAM)hWndSrv,(MPARAM)pDDEData); + if( WinGetLastError( hAB ) ) + { + // ////WRITELOG("DdeConnectWithClient:Client died") + if( bFreeDdeData ) + { + MyDosFreeMem( pDDEData,"ConnectWithClient" ); + } + FreeConvHandle( pData, hConv ); + return (HCONV)0; + } + + if( !(nTransactFilter & CBF_SKIP_CONNECT_CONFIRMS) ) + { + Callback( XTYP_CONNECT_CONFIRM, 0, hConv, hszTopic, hszService, + 0, 0, (ULONG)bSameInst ); + } + + if( bFreeDdeData ) + { + MyDosFreeMem( pDDEData,"ConnectWithClient" ); + } + // HCONV der PartnerApp suchen & bei uns eintragen + ImpHCONV* pConv = pConvTable; + pConv += (USHORT)hConv; + pConv->hConvPartner = GetConvHandle( pData, hWndClient, hWndSrv ); +#if 0 && defined(OV_DEBUG) + if( !pConv->hConvPartner ) + { + WRITELOG("DdeConnectWithClient:Partner not found") + } +#endif + pConv->nStatus = ST_CONNECTED; + //WRITESTATUS("Server:Connected with client") + //WRITELOG("ConnectWithClient:End") + return hConv; +} + +MRESULT ImpDdeMgr::DdeInitiate( ImpWndProcParams* pParams ) +{ + ////WRITELOG("DdeInitiate:Received") + HWND hWndClient = (HWND)(pParams->nPar1); +// BOOL bSameInst = IsSameInstance( hWndClient ); + BOOL bSameInst = (BOOL)(hWndClient==hWndServer); + DDEINIT* pDDEData = (DDEINIT*)pParams->nPar2; + + if ( ( nTransactFilter & (CBF_FAIL_CONNECTIONS | APPCMD_CLIENTONLY)) || + (( nTransactFilter & CBF_FAIL_SELFCONNECTIONS) && bSameInst ) + ) + { + MyDosFreeMem( pDDEData,"DdeInitiate" ); + return (MRESULT)FALSE; // narda + } + + HSZ hszService = (HSZ)0; + if( *(pDDEData->pszAppName) != '\0' ) + { + hszService = DdeCreateStringHandle( pDDEData->pszAppName, 850 ); + ////WRITELOG(pDDEData->pszAppName); + } + HSZ hszTopic = (HSZ)0; + if( *(pDDEData->pszTopic) != '\0' ) + { + hszTopic = DdeCreateStringHandle( pDDEData->pszTopic, 850 ); + ////WRITELOG(pDDEData->pszTopic); + } + HSZ hszPartner = GetAppName( hWndClient ); + + // nur weitermachen, wenn Service registriert oder + // Service-Name-Filtering ausgeschaltet. + if( !bServFilterOn || GetService(hszService) ) + { + // XTYP_CONNECT-Transaktionen erfolgen nur mit + // Services & Topics ungleich 0! + if( hszService && hszTopic ) + { + if( IsConvHandleAvailable(pData) && Callback( XTYP_CONNECT, + 0, 0, hszTopic,hszService, 0, 0, (ULONG)bSameInst)) + { + // App erlaubt Verbindung mit Client + ConnectWithClient( hWndClient, hszPartner, + hszService, hszTopic, bSameInst, pDDEData ); + } + } + else + { + // ** Wildcard-Connect ** + ////WRITELOG("DdeInitiate:Wildconnect") + // vom Server eine Liste aller Service/Topic-Paare anfordern + CONVCONTEXT* pCC=(CONVCONTEXT*)(pDDEData+pDDEData->offConvContext); + DDESTRUCT* hList = Callback( XTYP_WILDCONNECT, 0, (HCONV)0, + hszTopic,hszService, (HDDEDATA)0, (ULONG)pCC, (ULONG)bSameInst ); + if( hList ) + { + HSZPAIR* pPairs = (HSZPAIR*)((char*)hList+hList->offabData); + while( pPairs->hszSvc ) + { + ////WRITELOG("DdeInitiate:Wildconnect.Connecting") + ConnectWithClient( hWndClient, hszPartner, + pPairs->hszSvc, pPairs->hszTopic, bSameInst, 0, pCC); + // Stringhandles gehoeren der App! (nicht free-en) + pPairs++; + } + DdeFreeDataHandle( hList ); + } + } + } +#if 0 && defined(OV_DEBUG) + else + { + WRITELOG("DdeInitiate:Service filtered") + } +#endif + DdeFreeStringHandle( hszTopic ); + DdeFreeStringHandle( hszService ); + DdeFreeStringHandle( hszPartner ); + MyDosFreeMem( pDDEData,"DdeInitiate" ); + ////WRITELOG("DdeInitiate:End") + return (MRESULT)TRUE; +} + +MRESULT ImpDdeMgr::DdeInitiateAck( ImpWndProcParams* pParams ) +{ + ////WRITELOG("DdeInitiateAck:Received") + DDEINIT* pDDEData = (DDEINIT*)(pParams->nPar2); + + if( !bListConnect && hCurConv ) + { + ////WRITELOG("DdeInitiateAck:Already connected") + MyDosFreeMem( pDDEData,"DdeInitiateAck" ); + WinPostMsg( hWndServer, WM_DDE_TERMINATE, (MPARAM)hWndServer, 0 ); + return (MRESULT)FALSE; + } + + HWND hWndThis = pParams->hWndReceiver; + // Referenz-Count unseres Client-Windows inkrementieren + IncConversationWndRefCount( hWndThis ); + + HWND hWndSrv = (HWND)(pParams->nPar1); + HSZ hszService = DdeCreateStringHandle( pDDEData->pszAppName, 850 ); + HSZ hszTopic = DdeCreateStringHandle( pDDEData->pszTopic, 850 ); + HSZ hszPartnerApp = GetAppName( hWndSrv ); + + hCurConv = CreateConvHandle( pData, pidThis, hWndThis, hWndSrv, + hszPartnerApp, hszService, hszTopic, 0 ); + + ImpHCONV* pConv = pConvTable; + pConv += (USHORT)hCurConv; + + // HCONV der PartnerApp suchen & bei uns eintragen + pConv->hConvPartner = GetConvHandle( pData, hWndSrv, hWndThis ); + // nicht asserten, da ja non-ddeml-Partner moeglich + // DBG_ASSERT(pConv->hConvPartner,"DDE:Partner not found"); + pConv->nStatus = ST_CONNECTED | ST_CLIENT; + + if( bListConnect ) + { + ////WRITELOG("DdeInitiateAck:ListConnect/Connecting hConvs") + // Status setzen & verketten + pConv->hConvList = hCurListId; + pConv->nPrevHCONV = nPrevConv; + pConv->nStatus |= ST_INLIST; + if( nPrevConv ) + { + pConv = pConvTable; + pConv += nPrevConv; + pConv->nNextHCONV = (USHORT)hCurConv; + } + nPrevConv = (USHORT)hCurConv; + } + + DdeFreeStringHandle( hszService ); + DdeFreeStringHandle( hszTopic ); + DdeFreeStringHandle( hszPartnerApp ); + MyDosFreeMem( pDDEData,"DdeInitiateAck" ); + ////WRITESTATUS("After DdeInitiateAck") + ////WRITELOG("DdeInitiateAck:End") + return (MRESULT)TRUE; +} + +MRESULT ImpDdeMgr::DdePoke( ImpWndProcParams* pParams ) +{ + ////WRITELOG("DdePoke:Received") + HSZ hszItem = 0; + DDESTRUCT* pInDDEData = (DDESTRUCT*)(pParams->nPar2); + HCONV hConv = CheckIncoming( pParams, CBF_FAIL_REQUESTS, hszItem ); + BOOL bSuccess =FALSE; + ImpHCONV* pConv = pConvTable; + pConv += (USHORT)hConv; + if ( hConv && !(nTransactFilter & CBF_FAIL_POKES) && pInDDEData ) + { + if( Callback( XTYP_POKE, pInDDEData->usFormat, hConv, + pConv->hszTopic, hszItem, pInDDEData, 0, 0 ) + == (DDESTRUCT*)DDE_FACK ) + bSuccess = TRUE; + } +#if 0 && defined( OV_DEBUG ) + else + { + WRITELOG("DdePoke:Not processed") + } +#endif + if( pInDDEData ) + { + if( bSuccess ) + pInDDEData->fsStatus |= DDE_FACK; + else + pInDDEData->fsStatus &= (~DDE_FACK); + + MyWinDdePostMsg( pConv->hWndPartner, pConv->hWndThis, WM_DDE_ACK, + pInDDEData, DDEPM_RETRY ); + } + DdeFreeStringHandle( hszItem ); + return (MRESULT)0; +} + +MRESULT ImpDdeMgr::DdeRequest( ImpWndProcParams* pParams ) +{ + ////WRITELOG("DdeRequest:Received") + HSZ hszItem = 0; + DDESTRUCT* pInDDEData = (DDESTRUCT*)(pParams->nPar2); + if( pInDDEData ) + // ist fuer Requests nicht definiert + pInDDEData->fsStatus = 0; + HCONV hConv = CheckIncoming( pParams, CBF_FAIL_REQUESTS, hszItem ); + HWND hWndThis = pParams->hWndReceiver; + HWND hWndClient = (HWND)pParams->nPar1; + if( hConv ) + { + ImpHCONV* pConv = pConvTable; + pConv += (USHORT)hConv; + + DDESTRUCT* pOutDDEData = Callback( XTYP_REQUEST, pInDDEData->usFormat, + hConv, pConv->hszTopic, hszItem, (HDDEDATA)0, 0, 0 ); + + if ( !pOutDDEData ) + { + ////WRITELOG("DdeRequest:Not processed") + pInDDEData->fsStatus &= (~DDE_FACK); + MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY); + } + else + { + ////WRITELOG("DdeRequest:Success") + MyDosFreeMem( pInDDEData,"DdeRequest" ); + pOutDDEData->fsStatus |= DDE_FRESPONSE; + MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_DATA,pOutDDEData,DDEPM_RETRY); + } + } + else + { + pInDDEData->fsStatus &= (~DDE_FACK); + MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY); + } + + DdeFreeStringHandle( hszItem ); + ////WRITELOG("DdeRequest:End") + return (MRESULT)0; +} + + +MRESULT ImpDdeMgr::DdeUnadvise( ImpWndProcParams* pParams ) +{ + ////WRITELOG("DdeUnadvise:Received") + + HSZ hszItem; + HCONV hConv = CheckIncoming( pParams, 0, hszItem ); + DDESTRUCT* pInDDEData = (DDESTRUCT*)(pParams->nPar2); + HWND hWndThis = pParams->hWndReceiver; + HWND hWndClient = (HWND)pParams->nPar1; + USHORT nClosedTransactions = 0; + if( hConv ) + { + USHORT nFormat = pInDDEData->usFormat; + // alle Transaktionen des HCONVs loeschen ? + if( !hszItem ) + { + // App benachrichtigen & Transaktionen loeschen + nClosedTransactions = SendUnadvises( hConv, nFormat, TRUE ); + } + else + { + ULONG nTransId = GetTransaction(pData, hConv, hszItem, nFormat); + if( nTransId ) + { + ////WRITELOG("DdeUnadvise:Transaction found") + Transaction* pTrans = pTransTable; + pTrans += (USHORT)nTransId; + ImpHCONV* pConv = pConvTable; + pConv += (USHORT)hConv; + nClosedTransactions = 1; + if( !(nTransactFilter & CBF_FAIL_ADVISES) ) + Callback( XTYP_ADVSTOP, nFormat, hConv, + pConv->hszTopic, hszItem, 0, 0, 0 ); + if( !pConv->hConvPartner ) + FreeTransaction( pData, nTransId ); + } +#if defined(OV_DEBUG) + else + { + WRITELOG("DdeUnadvise:Transaction not found") + } +#endif + } + } +#if defined(OV_DEBUG) + else + { + WRITELOG("DdeUnadvise:Conversation not found") + } +#endif + + if( !nClosedTransactions ) + pInDDEData->fsStatus &= (~DDE_FACK); + else + pInDDEData->fsStatus |= DDE_FACK; + + MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY); + DdeFreeStringHandle( hszItem ); + return (MRESULT)0; +} + +BOOL ImpDdeMgr::WaitTransState( Transaction* pTrans, ULONG nTransId, + USHORT nNewState, ULONG nTimeout ) +{ + ////WRITELOG("WaitTransState:Start") + ImpHCONV* pConv = pConvTable; + pConv += pTrans->hConvOwner; + HAB hAB = WinQueryAnchorBlock( pConv->hWndThis ); + ULONG nTimerId = WinStartTimer( hAB, 0, 0, 50 ); + QMSG aQueueMsg; + +// while( WinGetMsg( hAB, &aQueueMsg, 0, 0, 0 ) && +// WinIsWindow( hAB, pConv->hWndPartner) && +// pTrans->nConvst != nNewState ) +// { +// WinDispatchMsg( hAB, &aQueueMsg ); +// } + + BOOL bContinue = TRUE; + while( bContinue ) + { + if( WinGetMsg( hAB, &aQueueMsg, 0, 0, 0 )) + { + WinDispatchMsg( hAB, &aQueueMsg ); + if( (!WinIsWindow( hAB, pConv->hWndPartner)) || + (pTrans->nConvst == nNewState) ) + { + bContinue = FALSE; + } + } + else + bContinue = FALSE; + } + + WinStopTimer( hAB, 0, nTimerId ); + ////WRITELOG("WaitTransState:End") + return TRUE; +} + + + + diff --git a/svl/source/svdde/ddeml2.cxx b/svl/source/svdde/ddeml2.cxx new file mode 100644 index 000000000000..979897136a46 --- /dev/null +++ b/svl/source/svdde/ddeml2.cxx @@ -0,0 +1,1014 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ddeml2.cxx,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#define INCL_DOS +#include + +#include "ddemlimp.hxx" +#define LOGFILE +#define STATUSFILE +#define DDEDATAFILE +#include "ddemldeb.hxx" + +#if defined (OS2) && defined (__BORLANDC__) +#pragma option -w-par +#endif + + +// ************************************************************************ +// Hilfsfunktionen Speicherverwaltung +// ************************************************************************ + +// +// AllocAtomName +// + +PSZ ImpDdeMgr::AllocAtomName( ATOM hString, ULONG& rBufLen ) +{ + HATOMTBL hAtomTable = WinQuerySystemAtomTable(); + ULONG nLen = WinQueryAtomLength( hAtomTable, hString ); + nLen++; + PSZ pBuf = 0; + if ( !MyDosAllocMem( (PPVOID)&pBuf, nLen, PAG_READ|PAG_WRITE|PAG_COMMIT | OBJ_ANY,"Atom" ) ) + { + WinQueryAtomName( hAtomTable, hString, pBuf, nLen ); + rBufLen = nLen; + } + return pBuf; +} + + +// +// MakeDDEObject +// + +PDDESTRUCT ImpDdeMgr::MakeDDEObject( HWND hwnd, ATOM hItemName, + USHORT fsStatus, USHORT usFormat, PVOID pabData, ULONG usDataLen ) +{ + PDDESTRUCT pddes = 0; + ULONG usItemLen; + PULONG pulSharedObj; + //WRITELOG("MakeDDEObject: Start") + + PSZ pItemName = 0; + if( hItemName != NULL ) + pItemName = AllocAtomName( hItemName, usItemLen ); + else + usItemLen = 1; + + ULONG nTotalSize = sizeof(DDESTRUCT) + usItemLen + usDataLen; + + if( !(MyDosAllocSharedMem((PPVOID)&pulSharedObj, NULL, + nTotalSize, + PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GETTABLE | OBJ_GIVEABLE | OBJ_ANY, + "MakeDDEObject"))) + { + pddes = (PDDESTRUCT) pulSharedObj; + // siehe "Glenn Puchtel, DDE for OS/2" p.60 + pddes->cbData = (ULONG)usDataLen; + pddes->fsStatus = fsStatus; + pddes->usFormat = usFormat; + pddes->offszItemName = sizeof( DDESTRUCT ); + if( (usDataLen) && (pabData != NULL ) ) + pddes->offabData = sizeof(DDESTRUCT) + usItemLen; + else + pddes->offabData = 0; + + if( pItemName != NULL ) + memcpy(DDES_PSZITEMNAME(pddes), pItemName, usItemLen ); + else + *(DDES_PSZITEMNAME(pddes)) = '\0'; + + if( pabData != NULL ) + memcpy( DDES_PABDATA(pddes), pabData, usDataLen ); + } + + if ( pItemName ) + { + MyDosFreeMem( pItemName,"MakeDDEObject" ); + } + return pddes; +} + +// +// AllocNamedSharedMem +// + +APIRET ImpDdeMgr::AllocNamedSharedMem( PPVOID ppBaseAddress, PSZ pName, + ULONG nElementSize, ULONG nElementCount ) +{ + ULONG nObjSize = (ULONG)(nElementSize * nElementCount ); + nObjSize += sizeof( ULONG ); // fuer ElementCount am Anfang des Blocks + + *ppBaseAddress = 0; + APIRET nRet = MyDosAllocSharedMem( ppBaseAddress, pName, nObjSize, + PAG_READ | PAG_WRITE | PAG_COMMIT | OBJ_ANY, + "AllocNamedSharedMem" ); + if ( !nRet ) + { + memset( *ppBaseAddress, 0, nObjSize ); + ULONG* pULONG = (ULONG*)*ppBaseAddress; + *pULONG = nObjSize; + } + return nRet; +} + +void ImpDdeMgr::CreateServerWnd() +{ + hWndServer = WinCreateWindow( HWND_DESKTOP, WC_FRAME, "DDEServer", 0, + 0,0,0,0, HWND_DESKTOP, HWND_BOTTOM, 0, 0, 0 ); + WinSetWindowULong( hWndServer, 0, (ULONG)this ); + WinSubclassWindow( hWndServer, ::ServerWndProc ); + TID tidDummy; + WinQueryWindowProcess( hWndServer, &pidThis, &tidDummy ); +} + +void ImpDdeMgr::DestroyServerWnd() +{ + WinDestroyWindow( hWndServer ); + hWndServer = NULLHANDLE; +} + +HWND ImpDdeMgr::CreateConversationWnd() +{ + HWND hWnd = WinCreateWindow( HWND_OBJECT, WC_FRAME, "DDEConvWnd", 0, + 0,0,0,0, HWND_DESKTOP, HWND_BOTTOM, 0, 0, 0 ); + if ( hWnd ) + { + ImpConvWndData* pWndData = new ImpConvWndData; + pWndData->pThis = this; + pWndData->nRefCount = 0; + WinSetWindowULong( hWnd, 0, (ULONG)pWndData ); + WinSubclassWindow( hWnd, ::ConvWndProc ); +#if 0 && defined( OV_DEBUG ) + String aStr("ConvWnd created:"); + aStr += (ULONG)hWnd; + WRITELOG((char*)aStr.GetStr()) +#endif + } + else + nLastErrInstance = DMLERR_SYS_ERROR; + + return hWnd; +} + +// static +void ImpDdeMgr::DestroyConversationWnd( HWND hWnd ) +{ + ImpConvWndData* pObj = (ImpConvWndData*)WinQueryWindowULong( hWnd, 0 ); + if( pObj ) + { + pObj->nRefCount--; + if( pObj->nRefCount == 0 + // auch Windows mit Refcount vonm loeschen, da dieser in initial + // auf 0 gesetzt wird + || pObj->nRefCount == (USHORT)-1 ) + { + delete pObj; + WinDestroyWindow( hWnd ); +#if 0 && defined( OV_DEBUG ) + String aStr("ConvWnd destroyed:"); + aStr += (ULONG)hWnd; + WRITELOG((char*)aStr.GetStr()) +#endif + } + else + { +#if 0 && defined( OV_DEBUG ) + String aStr("ConvWnd not destroyed (Refcount="); + aStr += pObj->nRefCount; + aStr += ") "; aStr += (ULONG)hWnd; + WRITELOG((char*)aStr.GetStr()) +#endif + } + } +#if defined( OV_DEBUG ) + else + { + WRITELOG("DestroyCnvWnd:Already destroyed/No win data/Partner died") + } +#endif +} + +// static +USHORT ImpDdeMgr::GetConversationWndRefCount( HWND hWnd ) +{ + ImpConvWndData* pObj = (ImpConvWndData*)WinQueryWindowULong( hWnd, 0 ); + DBG_ASSERT(pObj,"Dde:ConvWnd has no data"); + if( pObj ) + return pObj->nRefCount; + return 0; +} + +// static +USHORT ImpDdeMgr::IncConversationWndRefCount( HWND hWnd ) +{ +#if 0 && defined( OV_DEBUG ) + String aStr("IncConversationWndRefCount "); + aStr += (ULONG)hWnd; + WRITELOG((char*)aStr.GetStr()) +#endif + ImpConvWndData* pObj = (ImpConvWndData*)WinQueryWindowULong( hWnd, 0 ); + DBG_ASSERT(pObj,"Dde:ConvWnd has no data"); + if( pObj ) + { + pObj->nRefCount++; + return pObj->nRefCount; + } + return 0; +} + +ImpDdeMgrData* ImpDdeMgr::InitAll() +{ + ImpDdeMgrData* pBase = 0; + // nur dann neu anlegen, wenn die Tabelle nicht existiert + APIRET nRet=DosGetNamedSharedMem((PPVOID)&pBase,DDEMLDATA,PAG_READ| PAG_WRITE); + if ( nRet ) + { + if ( nRet == 2 ) // ERROR_FILE_NOT_FOUND ) + { + // DDECONVERSATIONCOUNT=4096 + USHORT nConvTransCount = 128; + PSZ pResult; + nRet = DosScanEnv( "SOMAXDDECONN", (const char**)&pResult ); + if( !nRet ) + { + int nTemp = 0; + nTemp = atoi( pResult ); + nTemp++; // der nullte Eintrag wird nicht benutzt + if( nTemp > 128 ) + nConvTransCount = (USHORT)nTemp; + } + ULONG nSize = sizeof(ImpDdeMgrData); + nSize += sizeof(ImpHCONV) * nConvTransCount; + nSize += sizeof(Transaction) * nConvTransCount; + nSize += sizeof(HWND) * DDEMLAPPCOUNT; + + nRet = ImpDdeMgr::AllocNamedSharedMem( (PPVOID)&pBase, + DDEMLDATA, nSize, 1 ); + if ( !nRet ) + { + pBase->nTotalSize = nSize; + ULONG nAppTable = (ULONG)&(pBase->aAppTable); + ULONG nCharBase = (ULONG)pBase; + pBase->nOffsAppTable = nAppTable - nCharBase; + pBase->nOffsConvTable = pBase->nOffsAppTable; + pBase->nOffsConvTable += sizeof(HWND) * DDEMLAPPCOUNT; + pBase->nOffsTransTable = pBase->nOffsConvTable; + pBase->nOffsTransTable += sizeof(ImpHCONV) * nConvTransCount; + + pBase->nMaxAppCount = DDEMLAPPCOUNT; + pBase->nMaxConvCount = nConvTransCount; + pBase->nMaxTransCount = nConvTransCount; + } + } + } + + if( pBase ) + { + pConvTable = ImpDdeMgr::GetConvTable( pBase ); + pTransTable = ImpDdeMgr::GetTransTable( pBase ); + pAppTable = ImpDdeMgr::GetAppTable( pBase ); + } + + memset( &aDefaultContext, 0, sizeof(CONVCONTEXT) ); + aDefaultContext.cb = sizeof(CONVCONTEXT); + aDefaultContext.idCountry = 49; // ?? + aDefaultContext.usCodepage = 850; // ?? + + return pBase; +} + +// static +HCONV ImpDdeMgr::CreateConvHandle( ImpDdeMgrData* pData, + PID pidOwner, + HWND hWndMe, HWND hWndPartner, + HSZ hszPartner, HSZ hszServiceReq, HSZ hszTopic, + HCONV hPrevHCONV ) +{ + DBG_ASSERT(pData,"DDE:Invalid data"); + if( !pData ) + return (HCONV)0; + + ImpHCONV* pPtr = ImpDdeMgr::GetConvTable( pData ); + USHORT nCount = pData->nMaxConvCount; + pPtr++; + nCount--; // ersten Handle (NULLHANDLE) ueberspringen + USHORT nIdx = 1; + DBG_ASSERT(pPtr,"No ConvTable"); + if( !pPtr ) + return (HCONV)0; + + while( nCount && pPtr->hWndThis != (HWND)NULL ) + { + nCount--; + pPtr++; + nIdx++; + } + if( !nCount ) + return (HCONV)0; + + DdeKeepStringHandle( hszPartner ); + DdeKeepStringHandle( hszServiceReq ); + DdeKeepStringHandle( hszTopic ); + pPtr->hszPartner = hszPartner; + pPtr->hszServiceReq = hszServiceReq; + pPtr->hszTopic = hszTopic; + + pPtr->hWndThis = hWndMe; + pPtr->hWndPartner = hWndPartner; + pPtr->pidOwner = pidOwner; + pPtr->hConvPartner = (HCONV)0; + pPtr->nPrevHCONV = (USHORT)hPrevHCONV; + pPtr->nNextHCONV = 0; + pPtr->nStatus = ST_CONNECTED; + + pData->nCurConvCount++; + + return (HCONV)nIdx; +} + +// static +void ImpDdeMgr::FreeConvHandle( ImpDdeMgrData* pBase, HCONV hConv, + BOOL bDestroyHWndThis ) +{ + DBG_ASSERT(pBase,"DDE:No data"); +#if 0 && defined( OV_DEBUG ) + String aStr("FreeConvHandle: Start "); + aStr += (ULONG)hConv; + aStr += " Destroy: "; aStr += (USHORT)bDestroyHWndThis; + WRITELOG((char*)aStr.GetStr()); + WRITESTATUS("FreeConvHandle: Start"); +#endif + if( !pBase ) + { + WRITELOG("FreeConvHandle: FAIL"); + return; + } + DBG_ASSERT(hConv&&hConvnMaxConvCount,"DDE:Invalid Conv-Handle"); + if( hConv && hConv < pBase->nMaxConvCount ) + { + ImpHCONV* pTable = ImpDdeMgr::GetConvTable( pBase ); + ImpHCONV* pPtr = pTable + (USHORT)hConv; + if( pPtr->nStatus & ST_INLIST ) + { + // Verkettung umsetzen + USHORT nPrev = pPtr->nPrevHCONV; + USHORT nNext = pPtr->nNextHCONV; + if( nPrev ) + { + pPtr = pTable + nPrev; + pPtr->nNextHCONV = nNext; + } + if( nNext ) + { + pPtr = pTable + nNext; + pPtr->nPrevHCONV = nPrev; + } + pPtr = pTable + (USHORT)hConv; + } + + DdeFreeStringHandle( pPtr->hszPartner ); + DdeFreeStringHandle( pPtr->hszServiceReq ); + DdeFreeStringHandle( pPtr->hszTopic ); + if( bDestroyHWndThis ) + DestroyConversationWnd( pPtr->hWndThis ); + memset( pPtr, 0, sizeof(ImpHCONV) ); + DBG_ASSERT(pBase->nCurConvCount,"Dde:Invalid Trans. count"); + pBase->nCurConvCount--; + } +#if defined(OV_DEBUG) + else + { + WRITELOG("FreeConvHandle: FAIL"); + } +#endif + //WRITELOG("FreeConvHandle: END"); + //WRITESTATUS("FreeConvHandle: End"); +} + +// static +HCONV ImpDdeMgr::IsConvHandleAvailable( ImpDdeMgrData* pBase ) +{ + DBG_ASSERT(pBase,"DDE:No data"); + if( !pBase ) + return 0; + + ImpHCONV* pPtr = ImpDdeMgr::GetConvTable( pBase ); + USHORT nCurPos = pBase->nMaxConvCount - 1; + pPtr += nCurPos; // von hinten aufrollen + while( nCurPos >= 1 ) + { + if( pPtr->hWndThis == 0 ) + return TRUE; + pPtr--; + nCurPos--; + } + return FALSE; +} + +// static +HCONV ImpDdeMgr::GetConvHandle( ImpDdeMgrData* pBase, HWND hWndThis, + HWND hWndPartner ) +{ + DBG_ASSERT(pBase,"DDE:No data"); + if( !pBase ) + return 0; + ImpHCONV* pPtr = ImpDdeMgr::GetConvTable( pBase ); + USHORT nCurPos = 1; + pPtr++; // ersten Handle ueberspringen + USHORT nCurConvCount = pBase->nCurConvCount; + while( nCurConvCount && nCurPos < pBase->nMaxConvCount ) + { + if( pPtr->hWndThis ) + { + if(pPtr->hWndThis == hWndThis && pPtr->hWndPartner == hWndPartner) + return (HCONV)nCurPos; + nCurConvCount--; + if( !nCurConvCount ) + return (HCONV)0; + } + nCurPos++; + pPtr++; + } + return (HCONV)0; +} + + + +// static +ULONG ImpDdeMgr::CreateTransaction( ImpDdeMgrData* pBase, HCONV hOwner, + HSZ hszItem, USHORT nFormat, USHORT nTransactionType ) +{ + DBG_ASSERT(pBase,"DDE:No Data"); + DBG_ASSERT(hOwner!=0,"DDE:No Owner"); + + if( pBase && hOwner ) + { + Transaction* pPtr = ImpDdeMgr::GetTransTable( pBase ); + DBG_ASSERT(pPtr->hConvOwner==0,"DDE:Data corrupted"); + USHORT nId = 1; + pPtr++; + while( nId < pBase->nMaxTransCount ) + { + if( pPtr->hConvOwner == (HCONV)0 ) + { + pPtr->hConvOwner = hOwner; + DdeKeepStringHandle( hszItem ); + pPtr->hszItem = hszItem; + pPtr->nType = nTransactionType; + pPtr->nConvst = XST_CONNECTED; + pPtr->nFormat = nFormat; + pBase->nCurTransCount++; + return (ULONG)nId; + } + nId++; + pPtr++; + } + } + return 0; +} + +// static +void ImpDdeMgr::FreeTransaction( ImpDdeMgrData* pBase, ULONG nTransId ) +{ + DBG_ASSERT(pBase,"DDE:No Data"); + if( !pBase ) + return; + + DBG_ASSERT(nTransIdnMaxTransCount,"DDE:Invalid TransactionId"); + if( nTransId >= pBase->nMaxTransCount ) + return; + + Transaction* pPtr = ImpDdeMgr::GetTransTable( pBase ); + pPtr += nTransId; + DBG_ASSERT(pPtr->hConvOwner!=0,"DDE:TransId has no owner"); + if( pPtr->hConvOwner ) + { + //WRITELOG("Freeing transaction"); + DdeFreeStringHandle( pPtr->hszItem ); + memset( pPtr, 0, sizeof(Transaction) ); + DBG_ASSERT(pBase->nCurTransCount,"Dde:Invalid Trans. count"); + pBase->nCurTransCount--; + } +} + +// static +ULONG ImpDdeMgr::GetTransaction( ImpDdeMgrData* pBase, + HCONV hOwner, HSZ hszItem, USHORT nFormat ) +{ + DBG_ASSERT(pBase,"DDE:No Data"); + if( !pBase || !hOwner ) + return 0; + + Transaction* pTrans = ImpDdeMgr::GetTransTable( pBase ); + DBG_ASSERT(pTrans,"DDE:No TransactionTable"); + if( !pTrans ) + return 0; + pTrans++; // NULLHANDLE ueberspringen + + ImpHCONV* pConv = ImpDdeMgr::GetConvTable( pBase ); + pConv += (USHORT)hOwner; + HCONV hConvPartner = pConv->hConvPartner; + + USHORT nCurTransCount = pBase->nCurTransCount; + for( USHORT nTrans=1; nTrans< pBase->nMaxTransCount; nTrans++, pTrans++ ) + { + if( pTrans->hConvOwner ) + { + if(( pTrans->hConvOwner == hOwner || + pTrans->hConvOwner == hConvPartner) && + pTrans->nFormat == nFormat && + pTrans->hszItem == hszItem ) + { + // gefunden! + return (ULONG)nTrans; + } + nCurTransCount--; + if( !nCurTransCount ) + return 0; + } + } + return 0; // narda +} + +// static +HSZ ImpDdeMgr::DdeCreateStringHandle( PSZ pszString, int iCodePage) +{ + if( !pszString || *pszString == '\0' ) + return (HSZ)0; + // Atom-Table beachtet Gross/Kleinschreibung, DDEML aber nicht + + // OV 12.4.96: Services,Topics,Items case-sensitiv!!! + // (Grosskundenanforderung (Reuter-DDE)) + //strlwr( pszString ); + //*pszString = (char)toupper(*pszString); + + HATOMTBL hAtomTable = WinQuerySystemAtomTable(); + ATOM aAtom = WinAddAtom( hAtomTable, pszString ); + return (HSZ)aAtom; +} + +// static +ULONG ImpDdeMgr::DdeQueryString( HSZ hszStr, PSZ pszStr, ULONG cchMax, int iCodePage) +{ + HATOMTBL hAtomTable = WinQuerySystemAtomTable(); + if ( !pszStr ) + return WinQueryAtomLength( hAtomTable, (ATOM)hszStr); + else + { + *pszStr = 0; + return WinQueryAtomName( hAtomTable, (ATOM)hszStr, pszStr, cchMax ); + } +} + +// static +BOOL ImpDdeMgr::DdeFreeStringHandle( HSZ hsz ) +{ + if( !hsz ) + return FALSE; + ATOM aResult = WinDeleteAtom( WinQuerySystemAtomTable(),(ATOM)hsz ); + return (BOOL)(aResult==0); +} + +// static +BOOL ImpDdeMgr::DdeKeepStringHandle( HSZ hsz ) +{ + if( !hsz ) + return TRUE; + HATOMTBL hAtomTable = WinQuerySystemAtomTable(); +#ifdef DBG_UTIL + ULONG nUsageCount=WinQueryAtomUsage(hAtomTable,(ATOM)hsz); +#endif + ULONG nAtom = 0xFFFF0000; + ULONG nPar = (ULONG)hsz; + nAtom |= nPar; + ATOM aAtom = WinAddAtom( hAtomTable, (PSZ)nAtom ); +#ifdef DBG_UTIL + if ( aAtom ) + DBG_ASSERT(WinQueryAtomUsage(hAtomTable,(ATOM)hsz)==nUsageCount+1,"Keep failed"); +#endif + return (BOOL)(aAtom!=0); +} + + +// static +int ImpDdeMgr::DdeCmpStringHandles(HSZ hsz1, HSZ hsz2) +{ + if ( hsz1 == hsz2 ) + return 0; + if ( hsz1 < hsz2 ) + return -1; + return 1; +} + +HDDEDATA ImpDdeMgr::DdeCreateDataHandle( void* pSrc, ULONG cb, + ULONG cbOff, HSZ hszItem, USHORT wFmt, USHORT afCmd) +{ + char* pData = (char*)pSrc; + pData += cbOff; + USHORT nStatus; + if( afCmd & HDATA_APPOWNED ) + nStatus = IMP_HDATAAPPOWNED; + else + nStatus = 0; + PDDESTRUCT hData=MakeDDEObject(0,(ATOM)hszItem,nStatus,wFmt,pData,cb); +// WRITEDATA(hData) + if ( !hData ) + ImpDdeMgr::nLastErrInstance = DMLERR_INVALIDPARAMETER; + return (HDDEDATA)hData; +} + +// static +BYTE* ImpDdeMgr::DdeAccessData(HDDEDATA hData, ULONG* pcbDataSize) +{ + BYTE* pRet = 0; + *pcbDataSize = 0; + if ( hData ) + { + pRet = (BYTE*)hData; + pRet += hData->offabData; + ULONG nLen = hData->cbData; + // nLen -= hData->offabData; + *pcbDataSize = nLen; + } + else + ImpDdeMgr::nLastErrInstance = DMLERR_INVALIDPARAMETER; + return pRet; +} + +// static +BOOL ImpDdeMgr::DdeUnaccessData(HDDEDATA hData) +{ + return TRUE; // nothing to do for us +} + +// static +BOOL ImpDdeMgr::DdeFreeDataHandle(HDDEDATA hData) +{ + DdeUnaccessData( hData ); + MyDosFreeMem( (PSZ)hData, "DdeFreeDataHandle" ); + return TRUE; +} + +// static +HDDEDATA ImpDdeMgr::DdeAddData(HDDEDATA hData,void* pSrc,ULONG cb,ULONG cbOff) +{ + return (HDDEDATA)0; +} + +// static +ULONG ImpDdeMgr::DdeGetData(HDDEDATA hData,void* pDst,ULONG cbMax,ULONG cbOff) +{ + return 0; +} + +BOOL ImpDdeMgr::DisconnectAll() +{ + //WRITESTATUS("Before DisconnectAll()") + USHORT nCurConvCount = pData->nCurConvCount; + if( !nCurConvCount ) + return TRUE; + + BOOL bRet = TRUE; + ImpHCONV* pPtr = pConvTable; + pPtr++; + + for( USHORT nPos=1; nPos < pData->nMaxConvCount; nPos++, pPtr++ ) + { + if( pPtr->hWndThis ) + { + if( !DdeDisconnect( (HCONV)nPos ) ) + bRet = FALSE; + nCurConvCount--; + if( !nCurConvCount ) + break; + } + } + //WRITESTATUS("After DisconnectAll()") + return bRet; +} + +// static +void ImpDdeMgr::FreeTransactions( ImpDdeMgrData* pData,HWND hWndThis, + HWND hWndPartner ) +{ + USHORT nCurTransCount = pData->nCurTransCount; + if( !nCurTransCount ) + return; + + Transaction* pTrans = GetTransTable( pData ); + ImpHCONV* pConvTable = GetConvTable( pData ); + pTrans++; + for( USHORT nPos=1; nPos < pData->nMaxTransCount; nPos++, pTrans++ ) + { + if( pTrans->hConvOwner ) + { + ImpHCONV* pConv = pConvTable + (USHORT)(pTrans->hConvOwner); + if((pConv->hWndThis==hWndThis&& pConv->hWndPartner==hWndPartner)|| + (pConv->hWndThis==hWndPartner && pConv->hWndPartner==hWndThis)) + { + FreeTransaction( pData, (ULONG)nPos ); + } + nCurTransCount--; + if( !nCurTransCount ) + return; + } + } +} + +// static +void ImpDdeMgr::FreeTransactions( ImpDdeMgrData* pData, HCONV hConvOwner ) +{ + USHORT nCurTransCount = pData->nCurTransCount; + if( !nCurTransCount ) + return; + + Transaction* pTrans = GetTransTable( pData ); +// ImpHCONV* pConvTable = GetConvTable( pData ); + pTrans++; + for( USHORT nPos=1; nPos < pData->nMaxTransCount; nPos++, pTrans++ ) + { + if( pTrans->hConvOwner == hConvOwner ) + { + FreeTransaction( pData, (ULONG)nPos ); + nCurTransCount--; + if( !nCurTransCount ) + return; + } + } +} + +// static +void ImpDdeMgr::FreeConversations( ImpDdeMgrData* pData, HWND hWndThis, + HWND hWndPartner ) +{ + USHORT nCurCount = pData->nCurConvCount; + if( !nCurCount ) + return; + + ImpHCONV* pPtr = GetConvTable( pData ); + pPtr++; + for( USHORT nPos=1; nPos < pData->nMaxConvCount; nPos++, pPtr++ ) + { + if( pPtr->hWndThis ) + { + if( hWndThis && pPtr->hWndPartner==hWndPartner ) + FreeConvHandle( pData, (HCONV)nPos ); + nCurCount--; + if( !nCurCount ) + return; + } + } +} + + +BOOL ImpDdeMgr::OwnsConversationHandles() +{ + //WRITESTATUS("OwnsConversationHandles()"); +#if 0 && defined( OV_DEBUG ) + String aStr("OwnsConversationHandles Server:"); + aStr += (ULONG)hWndServer; + WRITELOG((char*)aStr.GetStr()) +#endif + ImpHCONV* pPtr = GetConvTable( pData ); + for( USHORT nCur = 1; nCur < pData->nMaxConvCount; nCur++, pPtr++ ) + { + if( pPtr->hWndThis && pPtr->pidOwner == pidThis ) + { + //WRITELOG("OwnsConversationHandles: TRUE"); + return TRUE; + } + } + // WRITELOG("OwnsConversationHandles: FALSE"); + return FALSE; +} + + + +// ********************************************************************* +// ********************************************************************* +// ********************************************************************* + +USHORT DdeInitialize(ULONG* pidInst, PFNCALLBACK pfnCallback, + ULONG afCmd, ULONG ulRes) +{ + if( (*pidInst)!=0 ) + { + // Reinitialize wird noch nicht unterstuetzt + DBG_ASSERT(0,"DDEML:Reinitialize not supported"); + return DMLERR_INVALIDPARAMETER; + } + + ImpDdeMgr* pMgr = new ImpDdeMgr; + *pidInst = (ULONG)pMgr; + return pMgr->DdeInitialize( pfnCallback, afCmd ); +} + +BOOL DdeUninitialize(ULONG idInst) +{ + if( !idInst ) + return FALSE; + ImpDdeMgr* pMgr = (ImpDdeMgr*)idInst; + // nur loeschen, wenn wir nicht mehr benutzt werden! + if( !pMgr->OwnsConversationHandles() ) + { + WRITELOG("DdeUninitialize: TRUE"); + delete pMgr; + return TRUE; + } + WRITELOG("DdeUninitialize: FALSE"); + return FALSE; +} + + +HCONVLIST DdeConnectList(ULONG idInst, HSZ hszService, HSZ hszTopic, + HCONVLIST hConvList, CONVCONTEXT* pCC) +{ + if( !idInst ) + return 0; + return ((ImpDdeMgr*)idInst)->DdeConnectList(hszService,hszTopic, + hConvList, pCC ); +} + +HCONV DdeQueryNextServer(HCONVLIST hConvList, HCONV hConvPrev) +{ + return ImpDdeMgr::DdeQueryNextServer( hConvList, hConvPrev ); +} + +BOOL DdeDisconnectList(HCONVLIST hConvList) +{ + return ImpDdeMgr::DdeDisconnectList( hConvList ); +} + +HCONV DdeConnect(ULONG idInst, HSZ hszService, HSZ hszTopic, + CONVCONTEXT* pCC) +{ + if( !idInst ) + return 0; + return ((ImpDdeMgr*)idInst)->DdeConnect( hszService, hszTopic, pCC ); +} + +BOOL DdeDisconnect(HCONV hConv) +{ + return ImpDdeMgr::DdeDisconnect( hConv ); +} + +HCONV DdeReconnect(HCONV hConv) +{ + return ImpDdeMgr::DdeReconnect( hConv ); +} + + +USHORT DdeQueryConvInfo(HCONV hConv, ULONG idTransact, CONVINFO* pCI ) +{ + return ImpDdeMgr::DdeQueryConvInfo( hConv, idTransact, pCI ); +} + +BOOL DdeSetUserHandle(HCONV hConv, ULONG id, ULONG hUser) +{ + return ImpDdeMgr::DdeSetUserHandle( hConv, id, hUser ); +} + +BOOL DdeAbandonTransaction(ULONG idInst, HCONV hConv, ULONG idTransaction) +{ + if( !idInst ) + return FALSE; + return ((ImpDdeMgr*)idInst)->DdeAbandonTransaction(hConv,idTransaction); +} + +BOOL DdePostAdvise(ULONG idInst, HSZ hszTopic, HSZ hszItem) +{ + if( !idInst ) + return FALSE; + return ((ImpDdeMgr*)idInst)->DdePostAdvise( hszTopic, hszItem ); +} + +BOOL DdeEnableCallback(ULONG idInst, HCONV hConv, USHORT wCmd) +{ + if( !idInst ) + return FALSE; + return ((ImpDdeMgr*)idInst)->DdeEnableCallback( hConv, wCmd ); +} + +HDDEDATA DdeClientTransaction(void* pData, ULONG cbData, + HCONV hConv, HSZ hszItem, USHORT wFmt, USHORT wType, + ULONG dwTimeout, ULONG* pdwResult) +{ + return ImpDdeMgr::DdeClientTransaction( pData, cbData, + hConv, hszItem, wFmt, wType, dwTimeout, pdwResult ); +} + +HDDEDATA DdeCreateDataHandle(ULONG idInst, void* pSrc, ULONG cb, + ULONG cbOff, HSZ hszItem, USHORT wFmt, USHORT afCmd) +{ + if( !idInst ) + return 0; + return ((ImpDdeMgr*)idInst)->DdeCreateDataHandle( pSrc, cb, + cbOff, hszItem, wFmt, afCmd ); +} + +HDDEDATA DdeAddData(HDDEDATA hData, void* pSrc, ULONG cb, ULONG cbOff) +{ + return ImpDdeMgr::DdeAddData( hData, pSrc, cb, cbOff ); +} + +ULONG DdeGetData(HDDEDATA hData, void* pDst, ULONG cbMax, ULONG cbOff) +{ + return ImpDdeMgr::DdeGetData( hData, pDst, cbMax, cbOff ); +} + +BYTE* DdeAccessData(HDDEDATA hData, ULONG* pcbDataSize) +{ + return ImpDdeMgr::DdeAccessData( hData, pcbDataSize ); +} + +BOOL DdeUnaccessData(HDDEDATA hData) +{ + return ImpDdeMgr::DdeUnaccessData( hData ); +} + +BOOL DdeFreeDataHandle(HDDEDATA hData) +{ + return ImpDdeMgr::DdeFreeDataHandle( hData ); +} + +USHORT DdeGetLastError(ULONG idInst) +{ + if( !idInst ) + return DMLERR_DLL_NOT_INITIALIZED; + return ((ImpDdeMgr*)idInst)->DdeGetLastError(); +} + +HSZ DdeCreateStringHandle(ULONG idInst, PSZ pszString,int iCodePage ) +{ + if( !idInst ) + return 0; + return ((ImpDdeMgr*)idInst)->DdeCreateStringHandle(pszString,iCodePage); +} + +ULONG DdeQueryString( ULONG idInst, HSZ hsz, PSZ pBuf, + ULONG cchMax, int iCodePage ) +{ + if( !idInst ) + return 0; + return ((ImpDdeMgr*)idInst)->DdeQueryString( hsz,pBuf,cchMax,iCodePage); +} + +BOOL DdeFreeStringHandle( ULONG idInst, HSZ hsz) +{ + if( !idInst ) + return FALSE; + return ((ImpDdeMgr*)idInst)->DdeFreeStringHandle( hsz ); +} + +BOOL DdeKeepStringHandle( ULONG idInst, HSZ hsz ) +{ + if( !idInst ) + return FALSE; + return ((ImpDdeMgr*)idInst)->DdeKeepStringHandle( hsz ); +} + +int DdeCmpStringHandles(HSZ hsz1, HSZ hsz2) +{ + return ImpDdeMgr::DdeCmpStringHandles( hsz1, hsz2 ); +} + +HDDEDATA DdeNameService( ULONG idInst, HSZ hsz1, HSZ hszRes, USHORT afCmd ) +{ + if( !idInst ) + return 0; + return ((ImpDdeMgr*)idInst)->DdeNameService( hsz1, afCmd ); +} + + diff --git a/svl/source/svdde/ddemldeb.cxx b/svl/source/svdde/ddemldeb.cxx new file mode 100644 index 000000000000..bb53743a2915 --- /dev/null +++ b/svl/source/svdde/ddemldeb.cxx @@ -0,0 +1,283 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ddemldeb.cxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include "ddemlimp.hxx" + +#ifdef OV_DEBUG +#include +#endif + +#if defined(OV_DEBUG) + +void ImpAddHSZ( HSZ hszString, String& rStr ) +{ + char aBuf[ 128 ]; + ImpDdeMgr::DdeQueryString( hszString,aBuf,sizeof(aBuf),850); + rStr += " (\""; rStr += aBuf; rStr += "\","; + HATOMTBL hAtomTable = WinQuerySystemAtomTable(); + ULONG nRefCount = 0; + if( hszString ) + nRefCount = WinQueryAtomUsage(hAtomTable, (ATOM)hszString ); + rStr += nRefCount; rStr += ')'; +} + + +void ImpWriteDdeStatus(char* aFilename, char* pAppContext) +{ + char aBuf[ 128 ]; + USHORT nCtr; + HWND* pAppPtr; + ImpHCONV* pConvPtr; + Transaction* pTransPtr; + + ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData(); + if( !pData ) + return; + SvFileStream aStrm(aFilename, STREAM_READWRITE ); + String aLine; + aStrm.Seek( STREAM_SEEK_TO_END ); + aStrm << endl; + aStrm.WriteLine("********************** DDEML-Log ***********************"); + aStrm << endl; + if( pAppContext ) + { + aLine = Application::GetAppName(); + aLine += ':'; + aLine += "App-Context:"; aLine += pAppContext; + aStrm.WriteLine( aLine ); aStrm << endl; + } + aStrm.WriteLine("----------------- ImpDdeMgrData -------------------"); + aStrm << endl; + aLine= "TotalSize :"; aLine+= pData->nTotalSize; aStrm.WriteLine(aLine); + aLine= "nOffsAppTable :"; aLine+= pData->nOffsAppTable; aStrm.WriteLine(aLine); + aLine= "nOffsConvTable :"; aLine+= pData->nOffsConvTable; aStrm.WriteLine(aLine); + aLine= "nOffsTransTable:"; aLine+= pData->nOffsTransTable; aStrm.WriteLine(aLine); + aLine= "nMaxAppCount :"; aLine+= pData->nMaxAppCount; aStrm.WriteLine(aLine); + aLine= "nMaxConvCount :"; aLine+= pData->nMaxConvCount; aStrm.WriteLine(aLine); + aLine= "nMaxTransCount :"; aLine+= pData->nMaxTransCount; aStrm.WriteLine(aLine); + aLine= "nLastErr :"; aLine+= pData->nLastErr; aStrm.WriteLine(aLine); + aLine= "nCurConvCount :"; aLine+= pData->nCurConvCount; aStrm.WriteLine(aLine); + aLine= "nCurTransCount :"; aLine+= pData->nCurTransCount; aStrm.WriteLine(aLine); + aStrm << endl; + aStrm.WriteLine("---------- Registered DDEML-Applications -----------"); + aStrm << endl; + pAppPtr = ImpDdeMgr::GetAppTable( pData ); + for( nCtr = 0; nCtr < pData->nMaxAppCount; nCtr++, pAppPtr++ ) + { + if( *pAppPtr ) + { + aLine = "App."; aLine += nCtr; aLine += " HWND:"; + aLine += (ULONG)*pAppPtr; aStrm.WriteLine(aLine); + } + } + + aStrm << endl; + aStrm.WriteLine("-------------- Conversation handles ----------------"); + aStrm << endl; + + USHORT nCurCount = pData->nCurConvCount; + + if( nCurCount ) + { + pConvPtr = ImpDdeMgr::GetConvTable( pData ); + for( nCtr = 0; nCtr < pData->nMaxConvCount; nCtr++, pConvPtr++ ) + { + if( pConvPtr->hWndThis ) + { + aLine = "HCONV:"; aLine += nCtr; + aLine += " HCONVpartner: "; aLine += (USHORT)pConvPtr->hConvPartner; + if( !pConvPtr->hConvPartner ) aLine += "(Non-DDEML-App)"; + aLine += " hszPartner: "; aLine += (USHORT)pConvPtr->hszPartner; + ImpAddHSZ( pConvPtr->hszPartner, aLine ); + aStrm.WriteLine( aLine ); + + aLine = "hszService: "; aLine += (USHORT)pConvPtr->hszServiceReq; + ImpAddHSZ( pConvPtr->hszServiceReq, aLine ); + aLine += " hszTopic: "; aLine += (USHORT)pConvPtr->hszTopic; + ImpAddHSZ( pConvPtr->hszTopic, aLine ); + aStrm.WriteLine( aLine ); + + aLine= "Status: "; aLine+= pConvPtr->nStatus; + if( pConvPtr->nStatus & ST_CLIENT ) aLine += " (Client)"; + if( pConvPtr->nStatus & ST_INLIST ) aLine += " (Inlist)"; + aStrm.WriteLine(aLine); + + aLine = "pidOwner: "; aLine += (ULONG)pConvPtr->pidOwner; + aStrm.WriteLine( aLine ); + aLine = "hWndThis: "; aLine += (ULONG)pConvPtr->hWndThis; + aStrm.WriteLine( aLine ); + aLine = "hWndPartner: "; aLine += (ULONG)pConvPtr->hWndPartner; + aStrm.WriteLine( aLine ); + + aLine = "hConvList: "; aLine += (ULONG)pConvPtr->hConvList; + aLine += " Prev: "; aLine += pConvPtr->nPrevHCONV; + aLine += " Next: "; aLine += pConvPtr->nNextHCONV; + aStrm.WriteLine( aLine ); + aStrm.WriteLine("----------------------------------------------------"); + + nCurCount--; + if( !nCurCount ) + break; + } + } + } + + aStrm.WriteLine("----------------- Transaction Ids ------------------"); + + nCurCount = pData->nCurTransCount; + if( nCurCount ) + { + pTransPtr = ImpDdeMgr::GetTransTable( pData ); + for( nCtr = 0; nCtr < pData->nMaxTransCount; nCtr++, pTransPtr++ ) + { + + if( pTransPtr->hConvOwner ) + { + aLine = "TransactionId:"; aLine += nCtr; + aLine += " hConvOwner: "; aLine += (USHORT)pTransPtr->hConvOwner; + aStrm.WriteLine( aLine ); + aLine = "Item: "; aLine += (USHORT)pTransPtr->hszItem; + ImpAddHSZ( pTransPtr->hszItem, aLine ); + aLine += " Format: "; aLine += pTransPtr->nFormat; + aStrm.WriteLine( aLine ); + aLine = "TransactionType: "; aLine += pTransPtr->nType; + aLine += " Convst: "; aLine += pTransPtr->nConvst; + aLine += " LastErr: "; aLine += pTransPtr->nLastError; + aLine += " Userhandle: "; aLine += pTransPtr->nUser; + aStrm.WriteLine( aLine ); + aStrm.WriteLine("--------------------------------------------------"); + + nCurCount--; + if( !nCurCount ) + break; + } + } + } + aStrm << endl; + aStrm.WriteLine("******************* End of DDEML-Log *******************"); +} + +void ImpWriteDdeData(char* aFilename, DDESTRUCT* pData) +{ + char aBuf[ 128 ]; + USHORT nCtr; + SvFileStream aStrm(aFilename, STREAM_READWRITE ); + aStrm.Seek( STREAM_SEEK_TO_END ); + String aLine; + aStrm << endl; + aLine = "cbData:"; aLine += pData->cbData; aStrm.WriteLine( aLine ); + aLine = "fsStatus:"; aLine += pData->fsStatus; aStrm.WriteLine( aLine ); + aLine = "usFormat:"; aLine += pData->usFormat; aStrm.WriteLine( aLine ); + aLine = "ItemName:"; aLine += (char*)((char*)pData+pData->offszItemName); + aStrm.WriteLine( aLine ); + aLine = "offabData:"; aLine += pData->offabData; aStrm.WriteLine(aLine); + char* pBuf = (char*)pData+pData->offabData; + USHORT nLen = pData->cbData; // - pData->offabData; + while( nLen ) + { + aStrm << *pBuf; + nLen--; + pBuf++; + } + aStrm << endl; +} + +void ImpWriteLogFile(char* pFilename, char* pStr) +{ + SvFileStream aStrm(pFilename, STREAM_READWRITE ); + aStrm.Seek( STREAM_SEEK_TO_END ); + String aStr( Application::GetAppName() ); + aStr += ':'; aStr += pStr; + aStrm.WriteLine( (char*)aStr.GetStr() ); +} + +#else + +void ImpWriteDdeStatus(char*, char* ) {} +void ImpWriteDdeData(char*, DDESTRUCT*) {} +void ImpWriteLogFile(char*, char*) {} + +#endif + +APIRET MyDosAllocSharedMem(void** ppBaseAddress, char* pszName, unsigned long ulObjectSize, + unsigned long ulFlags, char* pContextStr ) +{ + APIRET nRet = DosAllocSharedMem(ppBaseAddress,pszName,ulObjectSize,ulFlags ); +#if 0 && defined(OV_DEBUG) && defined(LOGFILE) + String aStr("DosAllocSharedMem:"); + aStr += pContextStr; + aStr += ": "; + aStr += ulObjectSize; + aStr += " ("; + aStr += (ULONG)*((char**)ppBaseAddress); + aStr += ')'; + ImpWriteLogFile("\\ddeml.mem", (char*)aStr.GetStr() ); +#endif + return nRet; +} + +APIRET MyDosAllocMem(void** ppBaseAddress, unsigned long ulObjectSize, + unsigned long ulFlags, char* pContextStr ) +{ + APIRET nRet = DosAllocMem(ppBaseAddress, ulObjectSize,ulFlags ); +#if 0 && defined(OV_DEBUG) && defined(LOGFILE) + String aStr("DosAllocMem:"); + aStr += pContextStr; + aStr += ": "; + aStr += ulObjectSize; + aStr += " ("; + aStr += (ULONG)*((char**)ppBaseAddress); + aStr += ')'; + ImpWriteLogFile("\\ddeml.mem", (char*)aStr.GetStr() ); +#endif + return nRet; +} + + +APIRET MyDosFreeMem( void* pBaseAddress, char* pContextStr ) +{ + APIRET nRet = DosFreeMem( pBaseAddress ); +#if 0 && defined(OV_DEBUG) && defined(LOGFILE) + String aStr("DosFreeMem:"); + aStr += pContextStr; + aStr += ": "; + aStr += (ULONG)pBaseAddress; + ImpWriteLogFile("\\ddeml.mem", (char*)aStr.GetStr()); +#endif + return nRet; +} + + + + + diff --git a/svl/source/svdde/ddemldeb.hxx b/svl/source/svdde/ddemldeb.hxx new file mode 100644 index 000000000000..39d3d836882a --- /dev/null +++ b/svl/source/svdde/ddemldeb.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ddemldeb.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if defined(OV_DEBUG) + +void ImpWriteLogFile(char*,char*); +void ImpAddHSZ( HSZ, String& ); +void ImpWriteDdeStatus(char*, char* ); +void ImpWriteDdeData(char*, DDESTRUCT*); + +#ifdef LOGFILE +#define WRITELOG(aString) ImpWriteLogFile("\\ddeml.log",aString); +#else +#define WRITELOG(bla) +#endif +#ifdef STATUSFILE +#define WRITESTATUS(aContext) ImpWriteDdeStatus("\\ddeml.sts",aContext); +#else +#define WRITESTATUS(bla) +#endif +#ifdef DDEDATAFILE +#define WRITEDATA(data) ImpWriteDdeData("\\ddeml.dat",data); +#else +#define WRITEDATA(bla) +#endif + +#else + +#define WRITELOG(bla) +#define WRITESTATUS(bla) +#define WRITEDATA(bla) + +#endif + +APIRET MyDosAllocSharedMem(void** ppBaseAddress, char* pszName, unsigned long ulObjectSize, + unsigned long ulFlags, char* pContextStr ); + +APIRET MyDosAllocMem(void** ppBaseAddress, unsigned long ulObjectSize, + unsigned long ulFlags, char* pContextStr ); + +APIRET MyDosFreeMem( void* pBaseAddress, char* pContextStr ); + diff --git a/svl/source/svdde/ddemlimp.hxx b/svl/source/svdde/ddemlimp.hxx new file mode 100644 index 000000000000..47ad53d0b9fe --- /dev/null +++ b/svl/source/svdde/ddemlimp.hxx @@ -0,0 +1,436 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ddemlimp.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _DDEMLIMP_HXX +#define _DDEMLIMP_HXX + + +#include +#include +#include "ddemlos2.h" + +#define DDEMLSERVICETABLE_INISIZE 8 + +// Bezeichner der systemglobalen DDEML-Tabelle +#define DDEMLDATA "\\SHAREMEM\\OV_DDEML.DAT" + +// vorlaeufig konstante Tabellengroessen +#define CONVTABLECOUNT 2048 /* max count conversations */ +#define TRANSTABLECOUNT 2048 /* transactions */ +#define DDEMLAPPCOUNT 16 /* max count simultaniously running */ + /* ddeml (StarDivision) applications */ + +#define ST_TERMACKREC 0x8000 /* wird im Conversationhandle gesetzt, */ + /* wenn die Partner-App DDE_TERMINATE */ + /* bestaetigt hat */ + +#define XST_TIMEOUT 17 /* Trans. hat Timeout ueberschritten */ +#define XST_WAITING_ACK 18 /* Trans. wartet auf Acknowledge */ +#define XST_WAITING_ADVDATA 19 /* Trans. wartet auf Advise-Daten */ +#define XST_WAITING_REQDATA 20 /* Trans. wartet auf angeforderte Daten */ + + +/* User-Flags DDESTRUCT */ +#define IMP_HDATAAPPOWNED 0x8000 + +#define CONVLISTNAME "DdeConvListId" + +#define XTYPF_MASK (XTYPF_NOBLOCK | XTYPF_NODATA | XTYPF_ACKREQ) + +// +// DDEML-Messages; werden nur an registrierte DDEML-Apps gesendet +// + +// Msg: WM_DDEML_REGISTER +// Empfaenger: wird allen DDEML-Applikationen nach Registrierung +// eines neuen Services gesendet +// Params: nPar1: hszBaseServName +// nPar2: hszInstServName +#define WM_DDEML_REGISTER WM_USER+1 + +// Msg: WM_DDEML_UNREGISTER +// Empfaenger: wird allen DDEML-Applikationen nach Deregistrierung +// eines Services gesendet +// Params: nPar1: hszBaseServName +// nPar2: hszInstServName +#define WM_DDEML_UNREGISTER WM_USER+2 + +// +// +// + +struct ImpHCONV +{ + HCONV hConvPartner; + HSZ hszPartner; // Name of partner application + HSZ hszServiceReq; // Service name + HSZ hszTopic; // Topic name + USHORT nStatus; // ST_* of conversation + HCONVLIST hConvList; // ConvListId , wenn in ConvList + CONVCONTEXT aConvContext; // Conversation context + + // private + HWND hWndThis; // 0 == Handle not used + HWND hWndPartner; + PID pidOwner; // PID des DdeManagers, der + // den Conv-Handle erzeugt hat. + USHORT nPrevHCONV; // 0 == no previous hConv or not in list + USHORT nNextHCONV; // 0 == no next hconv or not in list +}; + +struct Transaction +{ + HSZ hszItem; // Item name + USHORT nFormat; // Data format + USHORT nType; // Transaction type (XTYP_*) + // XTYP_ADVREQ [|XTYPF_NODATA] == Advise-Loop + // [|XTYPF_ACKREQ] + // XTYP_EXECUTE == laufendes Execute + // XTYP_REQUEST + // XTYP_POKE + // XTYP_ADVSTOP + // XTYP_ADVSTART + USHORT nConvst; // Conversation state (XST_*) + // 0 == idle + // XST_REQSENT (fuer XTYP_ADVREQ) + // XST_TIMEOUT (fuer alle Typen!) + // XST_WAITING (alle ausser XTYP_ADVREQ) + USHORT nLastError; // last err in transaction + ULONG nUser; // Userhandle + // private + HCONV hConvOwner; // 0 == Transaction not used +}; + + +struct ImpWndProcParams +{ + HWND hWndReceiver; + MPARAM nPar1; + MPARAM nPar2; +}; + +struct ImpService +{ + HSZ hBaseServName; // Basis-Name des Service + HSZ hInstServName; // Basis-Name + DDEML-Server-HWND der App +}; + +class ImpDdeMgr; + +// Daten eines Conversation-Windows +struct ImpConvWndData +{ + ImpDdeMgr* pThis; + USHORT nRefCount; // Zahl Conversations auf diesem Window +}; + + +// systemglobale Daten der Library (liegen in named shared memory) +struct ImpDdeMgrData +{ + ULONG nTotalSize; + ULONG nOffsAppTable; + ULONG nOffsConvTable; + ULONG nOffsTransTable; + USHORT nMaxAppCount; + USHORT nMaxConvCount; + USHORT nMaxTransCount; + USHORT nLastErr; + USHORT nReserved; + USHORT nCurTransCount; + USHORT nCurConvCount; + HWND aAppTable[ 1 ]; // fuer Broadcast-Messages + ImpHCONV aConvTable[ 1 ]; + Transaction aTransTable[ 1 ]; +}; + + + +class ImpDdeMgr +{ + friend MRESULT EXPENTRY ConvWndProc(HWND hWnd,ULONG nMsg,MPARAM nPar1,MPARAM nPar2); + friend MRESULT EXPENTRY ServerWndProc(HWND hWnd,ULONG nMsg,MPARAM nPar1,MPARAM nPar2); + friend void ImpWriteDdeStatus(char*,char*); + friend void ImpAddHSZ( HSZ, String& ); + + static PSZ AllocAtomName( ATOM hString, ULONG& rBufLen ); + static PDDESTRUCT MakeDDEObject( HWND hwnd, ATOM hItemName, + USHORT fsStatus, USHORT usFormat, PVOID pabData, ULONG usDataLen ); + static APIRET AllocNamedSharedMem( PPVOID ppBaseAddress, PSZ pName, + ULONG nElementSize, ULONG nElementCount ); + + HWND hWndServer; + PID pidThis; + PFNCALLBACK pCallback; + ULONG nTransactFilter; + CONVCONTEXT aDefaultContext; + ImpDdeMgrData* pData; + ImpService* pServices; + USHORT nServiceCount; + + ImpHCONV* pConvTable; // liegt in pData (nicht deleten!) + Transaction* pTransTable; // liegt in pData (nicht deleten!) + HWND* pAppTable; // liegt in pData (nicht deleten!) + + static ImpHCONV* GetConvTable( ImpDdeMgrData* ); + static Transaction* GetTransTable( ImpDdeMgrData* ); + static HWND* GetAppTable( ImpDdeMgrData* ); + + + static HWND NextFrameWin( HENUM hEnum ); + void CreateServerWnd(); + void DestroyServerWnd(); + HWND CreateConversationWnd(); + // Fktn. duerfen nur fuer HCONVs aufgerufen werden, die + // in der eigenen Applikation erzeugt wurden + static void DestroyConversationWnd( HWND hWndConv ); + static USHORT GetConversationWndRefCount( HWND hWndConv ); + static USHORT IncConversationWndRefCount( HWND hWndConv ); + + MRESULT SrvWndProc(HWND hWnd,ULONG nMsg,MPARAM nPar1,MPARAM nPar2); + MRESULT ConvWndProc(HWND hWnd,ULONG nMsg,MPARAM nPar1,MPARAM nPar2); + void RegisterDDEMLApp(); + void UnregisterDDEMLApp(); + void CleanUp(); + ImpDdeMgrData* InitAll(); + static BOOL MyWinDdePostMsg( HWND, HWND, USHORT, PDDESTRUCT, ULONG ); + void MyInitiateDde( HWND hWndServer, HWND hWndClient, + HSZ hszService, HSZ hszTopic, CONVCONTEXT* pCC ); + DDEINIT* CreateDDEInitData( HWND hWndDest, HSZ hszService, + HSZ hszTopic, CONVCONTEXT* pCC ); + // wenn pDDEData==0, muss pCC gesetzt sein + HCONV ConnectWithClient( HWND hWndClient, HSZ hszPartner, + HSZ hszService, HSZ hszTopic, BOOL bSameInst, + DDEINIT* pDDEData, CONVCONTEXT* pCC = 0); + + HCONV CheckIncoming( ImpWndProcParams*, ULONG nTransMask, + HSZ& rhszItem ); + // fuer Serverbetrieb. Ruft Callback-Fkt fuer alle offenen Advises + // auf, deren Owner der uebergebene HCONV ist. + // bFreeTransactions==TRUE: loescht die Transaktionen + // gibt Anzahl der getrennten Transaktionen zurueck + USHORT SendUnadvises( HCONV hConv, + USHORT nFormat, // 0==alle + BOOL bFreeTransactions ); + + BOOL WaitTransState( + Transaction* pTrans, ULONG nTransId, + USHORT nNewState, + ULONG nTimeout ); + + // DDEML ruft Callback mit XTYP_CONNECT-Transaction nur auf, + // wenn die App den angeforderten Service registriert hat + // Standardeinstellung: TRUE + BOOL bServFilterOn; + + // Fehlercode muss noch systemglobal werden (Atom o. ae.) + static USHORT nLastErrInstance; // wenn 0, dann gilt globaler Fehlercode + + static ImpDdeMgrData* AccessMgrData(); + + static HCONV CreateConvHandle( ImpDdeMgrData* pBase, + PID pidOwner, + HWND hWndThis, HWND hWndPartner, + HSZ hszPartner, HSZ hszServiceReq, HSZ hszTopic, + HCONV hPrevHCONV = 0 ); + + static HCONV IsConvHandleAvailable( ImpDdeMgrData* pBase ); + static HCONV GetConvHandle( ImpDdeMgrData* pBase, + HWND hWndThis, HWND hWndPartner ); + static void FreeConvHandle( ImpDdeMgrData*, HCONV, + BOOL bDestroyHWndThis = TRUE ); + + static ULONG CreateTransaction( ImpDdeMgrData* pBase, + HCONV hOwner, HSZ hszItem, USHORT nFormat, + USHORT nTransactionType ); + static ULONG GetTransaction( ImpDdeMgrData* pBase, + HCONV hOwner, HSZ hszItem, USHORT nFormat ); + + static void FreeTransaction( ImpDdeMgrData*, ULONG nTransId ); + + BOOL DisconnectAll(); + // Transaktionen muessen _vor_ den Konversationen geloescht werden! + static void FreeTransactions( ImpDdeMgrData*, HWND hWndThis, + HWND hWndPartner ); + static void FreeTransactions( ImpDdeMgrData*, HCONV hConvOwner ); + + static void FreeConversations( ImpDdeMgrData*,HWND hWndThis, + HWND hWndPartner ); + + ImpService* GetService( HSZ hszService ); + ImpService* PutService( HSZ hszService ); + void BroadcastService( ImpService*, BOOL bRegistered ); + + // rh: Startposition(!) & gefundener Handle + static ImpHCONV* GetFirstServer( ImpDdeMgrData*, HCONVLIST, HCONV& rh); + static ImpHCONV* GetLastServer( ImpDdeMgrData*, HCONVLIST, HCONV& ); + static BOOL CheckConvListId( HCONVLIST hConvListId ); + + BOOL IsSameInstance( HWND hWnd ); + HSZ GetAppName( HWND hWnd ); + + + // Transactions + MRESULT DdeAck( ImpWndProcParams* pParams ); + MRESULT DdeAdvise( ImpWndProcParams* pParams ); + MRESULT DdeData( ImpWndProcParams* pParams ); + MRESULT DdeExecute( ImpWndProcParams* pParams ); + MRESULT DdeInitiate( ImpWndProcParams* pParams ); + MRESULT DdeInitiateAck( ImpWndProcParams* pParams ); + MRESULT DdePoke( ImpWndProcParams* pParams ); + MRESULT DdeRequest( ImpWndProcParams* pParams ); + MRESULT DdeTerminate( ImpWndProcParams* pParams ); + MRESULT DdeUnadvise( ImpWndProcParams* pParams ); + MRESULT DdeRegister( ImpWndProcParams* pParams ); + MRESULT DdeUnregister( ImpWndProcParams* pParams ); + MRESULT DdeTimeout( ImpWndProcParams* pParams ); + + HDDEDATA Callback( + USHORT nTransactionType, + USHORT nClipboardFormat, + HCONV hConversationHandle, + HSZ hsz1, + HSZ hsz2, + HDDEDATA hData, + ULONG nData1, + ULONG nData2 ); + + HCONV DdeConnectImp( HSZ hszService,HSZ hszTopic,CONVCONTEXT* pCC); + + // connection data + HCONV hCurConv; // wird im DdeInitiateAck gesetzt + HCONVLIST hCurListId; // fuer DdeConnectList + USHORT nPrevConv; // .... "" .... + BOOL bListConnect; + + // synchr. transaction data + BOOL bInSyncTrans; + ULONG nSyncTransId; + HDDEDATA hSyncResponseData; + ULONG nSyncResponseMsg; // WM_DDE_ACK, WM_DDE_DATA, WM_TIMER + // TRUE==nach Ende der synchronen Transaktion eine evtl. benutzte + // asynchrone Transaktion beenden (typisch synchroner Request auf + // Advise-Loop) + BOOL bSyncAbandonTrans; + +public: + ImpDdeMgr(); + ~ImpDdeMgr(); + + USHORT DdeInitialize( PFNCALLBACK pCallbackProc, ULONG nTransactionFilter ); + USHORT DdeGetLastError(); + + HCONV DdeConnect( HSZ hszService, HSZ hszTopic, CONVCONTEXT* ); + HCONVLIST DdeConnectList( HSZ hszService, HSZ hszTopic, + HCONVLIST hConvList, CONVCONTEXT* ); + static BOOL DdeDisconnect( HCONV hConv ); + static BOOL DdeDisconnectList( HCONVLIST hConvList ); + static HCONV DdeReconnect(HCONV hConv); + static HCONV DdeQueryNextServer(HCONVLIST hConvList, HCONV hConvPrev); + static USHORT DdeQueryConvInfo(HCONV hConv, ULONG idTrans,CONVINFO* pCI); + static BOOL DdeSetUserHandle(HCONV hConv, ULONG id, ULONG hUser); + BOOL DdeAbandonTransaction( HCONV hConv, ULONG idTransaction); + + BOOL DdePostAdvise( HSZ hszTopic, HSZ hszItem); + BOOL DdeEnableCallback( HCONV hConv, USHORT wCmd); + + HDDEDATA DdeNameService( HSZ hszService, USHORT afCmd); + + static HDDEDATA DdeClientTransaction(void* pData, ULONG cbData, + HCONV hConv, HSZ hszItem, USHORT wFmt, USHORT wType, + ULONG dwTimeout, ULONG* pdwResult); + + // Data handles + + HDDEDATA DdeCreateDataHandle( void* pSrc, ULONG cb, ULONG cbOff, + HSZ hszItem, USHORT wFmt, USHORT afCmd); + static BYTE* DdeAccessData(HDDEDATA hData, ULONG* pcbDataSize); + static BOOL DdeUnaccessData(HDDEDATA hData); + static BOOL DdeFreeDataHandle(HDDEDATA hData); + static HDDEDATA DdeAddData(HDDEDATA hData,void* pSrc,ULONG cb,ULONG cbOff); + static ULONG DdeGetData(HDDEDATA hData,void* pDst,ULONG cbMax,ULONG cbOff); + + // String handles + + static HSZ DdeCreateStringHandle( PSZ pStr, int iCodePage); + static ULONG DdeQueryString(HSZ hsz,PSZ pStr,ULONG cchMax,int iCPage); + static BOOL DdeFreeStringHandle( HSZ hsz ); + static BOOL DdeKeepStringHandle( HSZ hsz ); + static int DdeCmpStringHandles(HSZ hsz1, HSZ hsz2); + + // mit dieser Funktion kann geprueft werden, ob eine + // Applikation schon eine DDEML-Instanz angelegt hat. + // Die aktuelle Impl. unterstuetzt nur eine DDEML-Instanz + // pro Applikation (wg. synchroner Transaktionen) + static ImpDdeMgr* GetImpDdeMgrInstance( HWND hWnd ); + + // gibt TRUE zurueck, wenn mind. ein lebender HCONV + // von diesem DdeMgr erzeugt wurde + BOOL OwnsConversationHandles(); +}; + +// static +inline ImpHCONV* ImpDdeMgr::GetConvTable( ImpDdeMgrData* pData ) +{ + ImpHCONV* pRet; + if( pData ) + pRet = (ImpHCONV*)((ULONG)(pData) + pData->nOffsConvTable); + else + pRet = 0; + return pRet; +} + +// static +inline Transaction* ImpDdeMgr::GetTransTable( ImpDdeMgrData* pData ) +{ + Transaction* pRet; + if( pData ) + pRet = (Transaction*)((ULONG)(pData) + pData->nOffsTransTable); + else + pRet = 0; + return pRet; +} + +// static +inline HWND* ImpDdeMgr::GetAppTable( ImpDdeMgrData* pData ) +{ + HWND* pRet; + if( pData ) + pRet = (HWND*)((ULONG)(pData) + pData->nOffsAppTable); + else + pRet = 0; + return pRet; +} + + + + +#endif + diff --git a/svl/source/svdde/ddemlos2.h b/svl/source/svdde/ddemlos2.h new file mode 100644 index 000000000000..fe685e95fecf --- /dev/null +++ b/svl/source/svdde/ddemlos2.h @@ -0,0 +1,377 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ddemlos2.h,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _DDEML_H +#define _DDEML_H + +#define INCL_OS2 +#define INCL_WIN + +#include +#include +#include +#include + +typedef LHANDLE HSTR; + +#ifndef CALLBACK +#define CALLBACK +#endif + + +typedef ULONG HCONVLIST; +typedef ULONG HCONV; +typedef ATOM HSZ; +typedef DDESTRUCT* HDDEDATA; + +struct CONVINFO +{ + USHORT nSize; // sizeof(CONVINFO) + ULONG nUser; // Userhandle + HCONV hConvPartner; // + HSZ hszPartner; // Name der Partnerapp + HSZ hszServiceReq; // Name des angeforderten Services + HSZ hszTopic; // -- " -- Topics + HSZ hszItem; // -- " -- Items + USHORT nFormat; // Datenformat der akt. Transaktion + USHORT nType; // Typ der akt. Transaktion (XTYP_*) + USHORT nStatus; // ST_* der Konversation + USHORT nConvst; // XST_* der akt. Transaktion + USHORT nLastError; // letzter Fehler der Transaktion + HCONVLIST hConvList; // ConvListId , wenn in ConvList + CONVCONTEXT aConvCtxt; // conversation context +}; + +/* the following structure is for use with XTYP_WILDCONNECT processing. */ + +struct HSZPAIR +{ + HSZ hszSvc; + HSZ hszTopic; +}; +typedef HSZPAIR *PHSZPAIR; + +/***** conversation states (usState) *****/ + +#define XST_NULL 0 /* quiescent states */ +#define XST_INCOMPLETE 1 +#define XST_CONNECTED 2 +#define XST_INIT1 3 /* mid-initiation states */ +#define XST_INIT2 4 +#define XST_REQSENT 5 /* active conversation states */ +#define XST_DATARCVD 6 +#define XST_POKESENT 7 +#define XST_POKEACKRCVD 8 +#define XST_EXECSENT 9 +#define XST_EXECACKRCVD 10 +#define XST_ADVSENT 11 +#define XST_UNADVSENT 12 +#define XST_ADVACKRCVD 13 +#define XST_UNADVACKRCVD 14 +#define XST_ADVDATASENT 15 +#define XST_ADVDATAACKRCVD 16 + +/* used in LOWORD(dwData1) of XTYP_ADVREQ callbacks... */ +#define CADV_LATEACK 0xFFFF + +/***** conversation status bits (fsStatus) *****/ + +#define ST_CONNECTED 0x0001 +#define ST_ADVISE 0x0002 +#define ST_ISLOCAL 0x0004 +#define ST_BLOCKED 0x0008 +#define ST_CLIENT 0x0010 +#define ST_TERMINATED 0x0020 +#define ST_INLIST 0x0040 +#define ST_BLOCKNEXT 0x0080 +#define ST_ISSELF 0x0100 + + +/* DDE constants for wStatus field */ + +//#define DDE_FACK 0x8000 +//#define DDE_FBUSY 0x4000 +//#define DDE_FDEFERUPD 0x4000 +//#define DDE_FACKREQ 0x8000 +//#define DDE_FRELEASE 0x2000 +//#define DDE_FREQUESTED 0x1000 +//#define DDE_FACKRESERVED 0x3ff0 +//#define DDE_FADVRESERVED 0x3fff +//#define DDE_FDATRESERVED 0x4fff +//#define DDE_FPOKRESERVED 0xdfff +//#define DDE_FAPPSTATUS 0x00ff +#define DDE_FNOTPROCESSED 0x0000 + +/***** message filter hook types *****/ + +#define MSGF_DDEMGR 0x8001 + +/***** codepage constants ****/ + +#define CP_WINANSI 1004 /* default codepage for windows & old DDE convs. */ + +/***** transaction types *****/ + +#define XTYPF_NOBLOCK 0x0002 /* CBR_BLOCK will not work */ +#define XTYPF_NODATA 0x0004 /* DDE_FDEFERUPD */ +#define XTYPF_ACKREQ 0x0008 /* DDE_FACKREQ */ + +#define XCLASS_MASK 0xFC00 +#define XCLASS_BOOL 0x1000 +#define XCLASS_DATA 0x2000 +#define XCLASS_FLAGS 0x4000 +#define XCLASS_NOTIFICATION 0x8000 + +#define XTYP_ERROR (0x0000 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK ) +#define XTYP_ADVDATA (0x0010 | XCLASS_FLAGS ) +#define XTYP_ADVREQ (0x0020 | XCLASS_DATA | XTYPF_NOBLOCK ) +#define XTYP_ADVSTART (0x0030 | XCLASS_BOOL ) +#define XTYP_ADVSTOP (0x0040 | XCLASS_NOTIFICATION) +#define XTYP_EXECUTE (0x0050 | XCLASS_FLAGS ) +#define XTYP_CONNECT (0x0060 | XCLASS_BOOL | XTYPF_NOBLOCK) +#define XTYP_CONNECT_CONFIRM (0x0070 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK) +#define XTYP_XACT_COMPLETE (0x0080 | XCLASS_NOTIFICATION ) +#define XTYP_POKE (0x0090 | XCLASS_FLAGS ) +#define XTYP_REGISTER (0x00A0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK) +#define XTYP_REQUEST (0x00B0 | XCLASS_DATA ) +#define XTYP_DISCONNECT (0x00C0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK) +#define XTYP_UNREGISTER (0x00D0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK) +#define XTYP_WILDCONNECT (0x00E0 | XCLASS_DATA | XTYPF_NOBLOCK) + +#define XTYP_MASK 0x00F0 +#define XTYP_SHIFT 4 /* shift to turn XTYP_ into an index */ + +/***** Timeout constants *****/ + +#define TIMEOUT_ASYNC -1L + +/***** Transaction ID constants *****/ + +#define QID_SYNC -1L + +/****** public strings used in DDE ******/ + +#define SZDDESYS_TOPIC "System" +#define SZDDESYS_ITEM_TOPICS "Topics" +#define SZDDESYS_ITEM_SYSITEMS "SysItems" +#define SZDDESYS_ITEM_RTNMSG "ReturnMessage" +#define SZDDESYS_ITEM_STATUS "Status" +#define SZDDESYS_ITEM_FORMATS "Formats" +#define SZDDESYS_ITEM_HELP "Help" +#define SZDDE_ITEM_ITEMLIST "TopicItemList" + + +/****** API entry points ******/ + +typedef HDDEDATA CALLBACK FNCALLBACK(USHORT wType, USHORT wFmt, HCONV hConv, + HSZ hsz1, HSZ hsz2, HDDEDATA hData, ULONG dwData1, ULONG dwData2); +typedef FNCALLBACK* PFNCALLBACK; + +#define CBR_BLOCK 0xffffffffL + +/* DLL registration functions */ + +USHORT DdeInitialize(ULONG* pidInst, PFNCALLBACK pfnCallback, + ULONG afCmd, ULONG ulRes); + +/* + * Callback filter flags for use with standard apps. + */ + +#define CBF_FAIL_SELFCONNECTIONS 0x00001000 +#define CBF_FAIL_CONNECTIONS 0x00002000 +#define CBF_FAIL_ADVISES 0x00004000 +#define CBF_FAIL_EXECUTES 0x00008000 +#define CBF_FAIL_POKES 0x00010000 +#define CBF_FAIL_REQUESTS 0x00020000 +#define CBF_FAIL_ALLSVRXACTIONS 0x0003f000 + +#define CBF_SKIP_CONNECT_CONFIRMS 0x00040000 +#define CBF_SKIP_REGISTRATIONS 0x00080000 +#define CBF_SKIP_UNREGISTRATIONS 0x00100000 +#define CBF_SKIP_DISCONNECTS 0x00200000 +#define CBF_SKIP_ALLNOTIFICATIONS 0x003c0000 + +/* + * Application command flags + */ +#define APPCMD_CLIENTONLY 0x00000010L +#define APPCMD_FILTERINITS 0x00000020L +#define APPCMD_MASK 0x00000FF0L + +/* + * Application classification flags + */ +#define APPCLASS_STANDARD 0x00000000L +#define APPCLASS_MASK 0x0000000FL + + +BOOL DdeUninitialize(ULONG idInst); + +/* conversation enumeration functions */ + +HCONVLIST DdeConnectList(ULONG idInst, HSZ hszService, HSZ hszTopic, + HCONVLIST hConvList, CONVCONTEXT* pCC); +HCONV DdeQueryNextServer(HCONVLIST hConvList, HCONV hConvPrev); +BOOL DdeDisconnectList(HCONVLIST hConvList); + +/* conversation control functions */ + +HCONV DdeConnect(ULONG idInst, HSZ hszService, HSZ hszTopic, + CONVCONTEXT* pCC); +BOOL DdeDisconnect(HCONV hConv); +HCONV DdeReconnect(HCONV hConv); + +USHORT DdeQueryConvInfo(HCONV hConv, ULONG idTransaction, CONVINFO* pConvInfo); +BOOL DdeSetUserHandle(HCONV hConv, ULONG id, ULONG hUser); + +BOOL DdeAbandonTransaction(ULONG idInst, HCONV hConv, ULONG idTransaction); + + +/* app server interface functions */ + +BOOL DdePostAdvise(ULONG idInst, HSZ hszTopic, HSZ hszItem); +BOOL DdeEnableCallback(ULONG idInst, HCONV hConv, USHORT wCmd); + +#define EC_ENABLEALL 0 +#define EC_ENABLEONE ST_BLOCKNEXT +#define EC_DISABLE ST_BLOCKED +#define EC_QUERYWAITING 2 + +HDDEDATA DdeNameService(ULONG idInst, HSZ hsz1, HSZ hsz2, USHORT afCmd); + +#define DNS_REGISTER 0x0001 +#define DNS_UNREGISTER 0x0002 +#define DNS_FILTERON 0x0004 +#define DNS_FILTEROFF 0x0008 + +/* app client interface functions */ + +HDDEDATA DdeClientTransaction(void* pData, ULONG cbData, + HCONV hConv, HSZ hszItem, USHORT wFmt, USHORT wType, + ULONG dwTimeout, ULONG* pdwResult); + +/* data transfer functions */ + +HDDEDATA DdeCreateDataHandle(ULONG idInst, void* pSrc, ULONG cb, + ULONG cbOff, HSZ hszItem, USHORT wFmt, USHORT afCmd); +// HDDEDATA DdeAddData(HDDEDATA hData, void* pSrc, ULONG cb, ULONG cbOff); +ULONG DdeGetData(HDDEDATA hData, void* pDst, ULONG cbMax, ULONG cbOff); +BYTE* DdeAccessData(HDDEDATA hData, ULONG* pcbDataSize); +BOOL DdeUnaccessData(HDDEDATA hData); +BOOL DdeFreeDataHandle(HDDEDATA hData); + +#define HDATA_APPOWNED 0x0001 + +USHORT DdeGetLastError(ULONG idInst); + +#define DMLERR_NO_ERROR 0 /* must be 0 */ + +#define DMLERR_FIRST 0x4000 + +#define DMLERR_ADVACKTIMEOUT 0x4000 +#define DMLERR_BUSY 0x4001 +#define DMLERR_DATAACKTIMEOUT 0x4002 +#define DMLERR_DLL_NOT_INITIALIZED 0x4003 +#define DMLERR_DLL_USAGE 0x4004 +#define DMLERR_EXECACKTIMEOUT 0x4005 +#define DMLERR_INVALIDPARAMETER 0x4006 +#define DMLERR_LOW_MEMORY 0x4007 +#define DMLERR_MEMORY_ERROR 0x4008 +#define DMLERR_NOTPROCESSED 0x4009 +#define DMLERR_NO_CONV_ESTABLISHED 0x400a +#define DMLERR_POKEACKTIMEOUT 0x400b +#define DMLERR_POSTMSG_FAILED 0x400c +#define DMLERR_REENTRANCY 0x400d +#define DMLERR_SERVER_DIED 0x400e +#define DMLERR_SYS_ERROR 0x400f +#define DMLERR_UNADVACKTIMEOUT 0x4010 +#define DMLERR_UNFOUND_QUEUE_ID 0x4011 + +#define DMLERR_LAST 0x4011 + +HSZ DdeCreateStringHandle(ULONG idInst, PSZ pStr, int iCodePage); +ULONG DdeQueryString(ULONG idInst, HSZ hsz, PSZ pStr, ULONG cchMax, + int iCodePage); +BOOL DdeFreeStringHandle(ULONG idInst, HSZ hsz); +BOOL DdeKeepStringHandle(ULONG idInst, HSZ hsz); +int DdeCmpStringHandles(HSZ hsz1, HSZ hsz2); + + + +/* von OS/2 nicht unterstuetzte Win3.1 Clipboard-Formate */ + +#define CF_NOTSUPPORTED_BASE 0xff00 + +#ifndef CF_DIB +#define CF_DIB CF_NOTSUPPORTED_BASE+1 +#endif + +#ifndef CF_DIF +#define CF_DIF CF_NOTSUPPORTED_BASE+2 +#endif + +#ifndef CF_DSPMETAFILEPICT +#define CF_DSPMETAFILEPICT CF_NOTSUPPORTED_BASE+3 +#endif + +#ifndef CF_METAFILEPICT +#define CF_METAFILEPICT CF_NOTSUPPORTED_BASE+4 +#endif + +#ifndef CF_OEMTEXT +#define CF_OEMTEXT CF_NOTSUPPORTED_BASE+5 +#endif + +#ifndef CF_OWNERDISPLAY +#define CF_OWNERDISPLAY CF_NOTSUPPORTED_BASE+6 +#endif + +#ifndef CF_PENDATA +#define CF_PENDATA CF_NOTSUPPORTED_BASE+7 +#endif + +#ifndef CF_RIFF +#define CF_RIFF CF_NOTSUPPORTED_BASE+8 +#endif + +#ifndef CF_SYLK +#define CF_SYLK CF_NOTSUPPORTED_BASE+9 +#endif + +#ifndef CF_TIFF +#define CF_TIFF CF_NOTSUPPORTED_BASE+10 +#endif + +#ifndef CF_WAVE +#define CF_WAVE CF_NOTSUPPORTED_BASE+11 +#endif + + +#endif /* _DDEML_HXX */ diff --git a/svl/source/svdde/ddestrg.cxx b/svl/source/svdde/ddestrg.cxx new file mode 100644 index 000000000000..40af3b1cbc27 --- /dev/null +++ b/svl/source/svdde/ddestrg.cxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ddestrg.cxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#define UNICODE + +#include "ddeimp.hxx" +#include + +#if defined( WIN ) && defined( MSC ) +#pragma code_seg( "SVDDE_MISC_CODE" ) +#endif + +// --- DdeString::DdeString() -------------------------------------- + +DdeString::DdeString( DWORD hDdeInst, const sal_Unicode* p ) : + String( p ) +{ + hString = DdeCreateStringHandle( hDdeInst, (LPTSTR)p, CP_WINUNICODE ); + hInst = hDdeInst; +} + +// --- DdeString::DdeString() -------------------------------------- + +DdeString::DdeString( DWORD hDdeInst, const String& r) : + String( r ) +{ + hString = DdeCreateStringHandle( hDdeInst, (LPTSTR)r.GetBuffer(), CP_WINUNICODE ); + hInst = hDdeInst; +} + +// --- DdeString::~DdeString() ------------------------------------- + +DdeString::~DdeString() +{ + if ( hString ) + DdeFreeStringHandle( hInst, hString ); +} + +// --- DdeString::operator==() ------------------------------------- + +int DdeString::operator==( HSZ h ) +{ + return( !DdeCmpStringHandles( hString, h ) ); +} + +// --- DdeString::operator HSZ() ----------------------------------- + +DdeString::operator HSZ() +{ + return hString; +} diff --git a/svl/source/svdde/ddesvr.cxx b/svl/source/svdde/ddesvr.cxx new file mode 100644 index 000000000000..a2124548b4c8 --- /dev/null +++ b/svl/source/svdde/ddesvr.cxx @@ -0,0 +1,1107 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ddesvr.cxx,v $ + * $Revision: 1.11 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#define UNICODE +#include "ddeimp.hxx" +#include +#include +#include +#include + +//static long hCurConv = 0; +//static DWORD hDdeInst = NULL; +//static short nInstance = 0; +//static DdeServices* pServices; + +enum DdeItemType +{ + DDEITEM, + DDEGETPUTITEM +}; + +struct DdeItemImpData +{ + ULONG nHCnv; + USHORT nCnt; + + DdeItemImpData( ULONG nH ) : nHCnv( nH ), nCnt( 1 ) {} +}; + +SV_DECL_VARARR( DdeItemImp, DdeItemImpData, 1, 1 ) +SV_IMPL_VARARR( DdeItemImp, DdeItemImpData ) + +// --- DdeInternat::SvrCallback() ---------------------------------- + +#ifdef WNT +HDDEDATA CALLBACK DdeInternal::SvrCallback( + WORD nCode, WORD nCbType, HCONV hConv, HSZ hText1, HSZ hText2, + HDDEDATA hData, DWORD, DWORD ) +#else +#if defined ( MTW ) || ( defined ( GCC ) && defined ( OS2 )) || defined( ICC ) +HDDEDATA CALLBACK __EXPORT DdeInternal::SvrCallback( + WORD nCode, WORD nCbType, HCONV hConv, HSZ hText1, HSZ hText2, + HDDEDATA hData, DWORD, DWORD ) +#else +HDDEDATA CALLBACK _export DdeInternal::SvrCallback( + WORD nCode, WORD nCbType, HCONV hConv, HSZ hText1, HSZ hText2, + HDDEDATA hData, DWORD, DWORD ) +#endif +#endif +{ + DdeServices& rAll = DdeService::GetServices(); + DdeService* pService; + DdeTopic* pTopic; + DdeItem* pItem; + DdeData* pData; + Conversation* pC; + + DdeInstData* pInst = ImpGetInstData(); + DBG_ASSERT(pInst,"SVDDE:No instance data"); + + switch( nCode ) + { + case XTYP_WILDCONNECT: + { + int nTopics = 0; + +#if 1 + TCHAR chTopicBuf[250]; + if( hText1 ) + DdeQueryString( pInst->hDdeInstSvr, hText1, chTopicBuf, + sizeof(chTopicBuf)/sizeof(TCHAR), CP_WINUNICODE ); + + for( pService = rAll.First();pService;pService = rAll.Next() ) + { + if ( !hText2 || ( *pService->pName == hText2 ) ) + { + String sTopics( pService->Topics() ); + if( sTopics.Len() ) + { + if( hText1 ) + { + USHORT n = 0; + while( STRING_NOTFOUND != n ) + { + String s( sTopics.GetToken( 0, '\t', n )); + if( s == reinterpret_cast(chTopicBuf) ) + ++nTopics; + } + } + else + nTopics += sTopics.GetTokenCount( '\t' ); + } + } + } + +#else + for( pService = rAll.First();pService;pService = rAll.Next() ) + { + if ( !hText2 || ( *pService->pName == hText2 ) ) + { + for( pTopic = pService->aTopics.First(); pTopic; + pTopic = pService->aTopics.Next() ) + { + if ( !hText1 || (*pTopic->pName == hText1) ) + nTopics++; + } + } + } +#endif + if( !nTopics ) + return (HDDEDATA)NULL; + + HSZPAIR* pPairs = new HSZPAIR [nTopics + 1]; + if ( !pPairs ) + return (HDDEDATA)NULL; + + HSZPAIR* q = pPairs; + for( pService = rAll.First(); pService; pService = rAll.Next() ) + { + if ( !hText2 || (*pService->pName == hText2 ) ) + { +#if 0 + for ( pTopic = pService->aTopics.First(); pTopic; + pTopic = pService->aTopics.Next() ) + { + if ( !hText1 || (*pTopic->pName == hText1) ) + { + q->hszSvc = *pService->pName; + q->hszTopic = *pTopic->pName; + q++; + } + } +#else + String sTopics( pService->Topics() ); + USHORT n = 0; + while( STRING_NOTFOUND != n ) + { + String s( sTopics.GetToken( 0, '\t', n )); + s.EraseAllChars( '\n' ).EraseAllChars( '\r' ); + if( !hText1 || s == reinterpret_cast(chTopicBuf) ) + { + DdeString aDStr( pInst->hDdeInstSvr, s ); + pTopic = FindTopic( *pService, (HSZ)aDStr ); + if( pTopic ) + { + q->hszSvc = *pService->pName; + q->hszTopic = *pTopic->pName; + q++; + } + } + } + +#endif + } + } + + q->hszSvc = NULL; + q->hszTopic = NULL; + HDDEDATA h = DdeCreateDataHandle( + pInst->hDdeInstSvr, (LPBYTE) pPairs, + sizeof(HSZPAIR) * (nTopics+1), + 0, NULL, nCbType, 0); + delete pPairs; + return h; + } + + case XTYP_CONNECT: + pService = FindService( hText2 ); + if ( pService) + pTopic = FindTopic( *pService, hText1 ); + else + pTopic = NULL; + if ( pTopic ) + return (HDDEDATA)DDE_FACK; + else + return (HDDEDATA) NULL; + + case XTYP_CONNECT_CONFIRM: + pService = FindService( hText2 ); + if ( pService ) + { + pTopic = FindTopic( *pService, hText1 ); + if ( pTopic ) + { + pTopic->Connect( (long) hConv ); + pC = new Conversation; + pC->hConv = hConv; + pC->pTopic = pTopic; + pService->pConv->Insert( pC ); + } + } + return (HDDEDATA)NULL; + } + + for ( pService = rAll.First(); pService; pService = rAll.Next() ) + { + for( pC = pService->pConv->First(); pC; + pC = pService->pConv->Next() ) + { + if ( pC->hConv == hConv ) + goto found; + } + } + + return (HDDEDATA) DDE_FNOTPROCESSED; + +found: + if ( nCode == XTYP_DISCONNECT) + { + pC->pTopic->_Disconnect( (long) hConv ); + pService->pConv->Remove( pC ); + delete pC; + return (HDDEDATA)NULL; + } + + BOOL bExec = BOOL(nCode == XTYP_EXECUTE); + pTopic = pC->pTopic; + if ( pTopic && !bExec ) + pItem = FindItem( *pTopic, hText2 ); + else + pItem = NULL; + + if ( !bExec && !pService->HasCbFormat( nCbType ) ) + pItem = NULL; + if ( !pItem && !bExec ) + return (HDDEDATA)DDE_FNOTPROCESSED; + if ( pItem ) + pTopic->aItem = pItem->GetName(); + else + pTopic->aItem.Erase(); + + BOOL bRes = FALSE; + pInst->hCurConvSvr = (long)hConv; + switch( nCode ) + { + case XTYP_REQUEST: + case XTYP_ADVREQ: + { + String aRes; // darf erst am Ende freigegeben werden!! + if ( pTopic->IsSystemTopic() ) + { + if ( pTopic->aItem == reinterpret_cast(SZDDESYS_ITEM_TOPICS) ) + aRes = pService->Topics(); + else if ( pTopic->aItem == reinterpret_cast(SZDDESYS_ITEM_SYSITEMS) ) + aRes = pService->SysItems(); + else if ( pTopic->aItem == reinterpret_cast(SZDDESYS_ITEM_STATUS) ) + aRes = pService->Status(); + else if ( pTopic->aItem == reinterpret_cast(SZDDESYS_ITEM_FORMATS) ) + aRes = pService->Formats(); + else if ( pTopic->aItem == reinterpret_cast(SZDDESYS_ITEM_HELP) ) + aRes = pService->GetHelp(); + else + aRes = pService->SysTopicGet( pTopic->aItem ); + + if ( aRes.Len() ) + pData = new DdeData( aRes ); + else + pData = NULL; + } + else if( DDEGETPUTITEM == pItem->nType ) + pData = ((DdeGetPutItem*)pItem)->Get( + DdeData::GetInternalFormat( nCbType ) ); + else + pData = pTopic->Get( DdeData::GetInternalFormat( nCbType )); + + if ( pData ) + return DdeCreateDataHandle( pInst->hDdeInstSvr, + (LPBYTE)pData->pImp->pData, + pData->pImp->nData, + 0, hText2, + DdeData::GetExternalFormat( + pData->pImp->nFmt ), + 0 ); + } + break; + + case XTYP_POKE: + if ( !pTopic->IsSystemTopic() ) + { + DdeData d; + d.pImp->hData = hData; + d.pImp->nFmt = DdeData::GetInternalFormat( nCbType ); + d.Lock(); + if( DDEGETPUTITEM == pItem->nType ) + bRes = ((DdeGetPutItem*)pItem)->Put( &d ); + else + bRes = pTopic->Put( &d ); + } + pInst->hCurConvSvr = NULL; + if ( bRes ) + return (HDDEDATA)DDE_FACK; + else + return (HDDEDATA) DDE_FNOTPROCESSED; + + case XTYP_ADVSTART: + { + // wird das Item zum erstenmal ein HotLink ? + if( !pItem->pImpData && pTopic->StartAdviseLoop() ) + { + // dann wurde das Item ausgewechselt + pTopic->aItems.Remove( pItem ); + DdeItem* pTmp; + for( pTmp = pTopic->aItems.First(); pTmp; + pTmp = pTopic->aItems.Next() ) + if( *pTmp->pName == hText2 ) + { + // es wurde tatsaechlich ausgewechselt + delete pItem; + pItem = 0; + break; + } + if( pItem ) + // es wurde doch nicht ausgewechselt, also wieder rein + pTopic->aItems.Insert( pItem ); + else + pItem = pTmp; + } + pItem->IncMonitor( (long)hConv ); + pInst->hCurConvSvr = NULL; + } + return (HDDEDATA)TRUE; + + case XTYP_ADVSTOP: + pItem->DecMonitor( (long)hConv ); + if( !pItem->pImpData ) + pTopic->StopAdviseLoop(); + pInst->hCurConvSvr = NULL; + return (HDDEDATA)TRUE; + + case XTYP_EXECUTE: + { + DdeData aExec; + aExec.pImp->hData = hData; + aExec.pImp->nFmt = DdeData::GetInternalFormat( nCbType ); + aExec.Lock(); + String aName; + + aName = (const sal_Unicode *)aExec.pImp->pData; + + if( pTopic->IsSystemTopic() ) + bRes = pService->SysTopicExecute( &aName ); + else + bRes = pTopic->Execute( &aName ); + } + pInst->hCurConvSvr = NULL; + if ( bRes ) + return (HDDEDATA)DDE_FACK; + else + return (HDDEDATA)DDE_FNOTPROCESSED; + } + + return (HDDEDATA)NULL; +} + +// --- DdeInternat::FindService() ---------------------------------- + +DdeService* DdeInternal::FindService( HSZ hService ) +{ + DdeService* s; + DdeServices& rSvc = DdeService::GetServices(); + for ( s = rSvc.First(); s; s = rSvc.Next() ) + { + if ( *s->pName == hService ) + return s; + } + + return NULL; +} + +// --- DdeInternat::FindTopic() ------------------------------------ + +DdeTopic* DdeInternal::FindTopic( DdeService& rService, HSZ hTopic ) +{ + DdeTopic* s; + DdeTopics& rTopics = rService.aTopics; + int bWeiter = FALSE; + DdeInstData* pInst = ImpGetInstData(); + DBG_ASSERT(pInst,"SVDDE:No instance data"); + + do { // middle check loop + for ( s = rTopics.First(); s; s = rTopics.Next() ) + { + if ( *s->pName == hTopic ) + return s; + } + + bWeiter = !bWeiter; + if( !bWeiter ) + break; + + // dann befragen wir doch mal unsere Ableitung: + TCHAR chBuf[250]; + DdeQueryString(pInst->hDdeInstSvr,hTopic,chBuf,sizeof(chBuf)/sizeof(TCHAR),CP_WINUNICODE ); + bWeiter = rService.MakeTopic( reinterpret_cast(chBuf) ); + // dann muessen wir noch mal suchen + } while( bWeiter ); + + return 0; +} + +// --- DdeInternal::FindItem() ------------------------------------- + +DdeItem* DdeInternal::FindItem( DdeTopic& rTopic, HSZ hItem ) +{ + DdeItem* s; + DdeItems& rItems = rTopic.aItems; + DdeInstData* pInst = ImpGetInstData(); + DBG_ASSERT(pInst,"SVDDE:No instance data"); + int bWeiter = FALSE; + + do { // middle check loop + + for ( s = rItems.First(); s; s = rItems.Next() ) + if ( *s->pName == hItem ) + return s; + + bWeiter = !bWeiter; + if( !bWeiter ) + break; + + // dann befragen wir doch mal unsere Ableitung: + TCHAR chBuf[250]; + DdeQueryString(pInst->hDdeInstSvr,hItem,chBuf,sizeof(chBuf)/sizeof(TCHAR),CP_WINUNICODE ); + bWeiter = rTopic.MakeItem( reinterpret_cast(chBuf) ); + // dann muessen wir noch mal suchen + } while( bWeiter ); + + return 0; +} + +// --- DdeService::DdeService() ------------------------------------ + +DdeService::DdeService( const String& rService ) +{ + DdeInstData* pInst = ImpGetInstData(); + if( !pInst ) + pInst = ImpInitInstData(); + pInst->nRefCount++; + pInst->nInstanceSvr++; + + if ( !pInst->hDdeInstSvr ) + { + nStatus = sal::static_int_cast< short >( + DdeInitialize( &pInst->hDdeInstSvr, + (PFNCALLBACK)DdeInternal::SvrCallback, + APPCLASS_STANDARD | + CBF_SKIP_REGISTRATIONS | + CBF_SKIP_UNREGISTRATIONS, 0L ) ); + pInst->pServicesSvr = new DdeServices; + } + else + nStatus = DMLERR_NO_ERROR; + + pConv = new ConvList; + + if ( pInst->pServicesSvr ) + pInst->pServicesSvr->Insert( this ); + + pName = new DdeString( pInst->hDdeInstSvr, rService ); + if ( nStatus == DMLERR_NO_ERROR ) + if ( !DdeNameService( pInst->hDdeInstSvr, *pName, NULL, + DNS_REGISTER | DNS_FILTEROFF ) ) + nStatus = DMLERR_SYS_ERROR; + + AddFormat( FORMAT_STRING ); + pSysTopic = new DdeTopic( reinterpret_cast(SZDDESYS_TOPIC) ); + pSysTopic->AddItem( DdeItem( reinterpret_cast(SZDDESYS_ITEM_TOPICS) ) ); + pSysTopic->AddItem( DdeItem( reinterpret_cast(SZDDESYS_ITEM_SYSITEMS) ) ); + pSysTopic->AddItem( DdeItem( reinterpret_cast(SZDDESYS_ITEM_STATUS) ) ); + pSysTopic->AddItem( DdeItem( reinterpret_cast(SZDDESYS_ITEM_FORMATS) ) ); + pSysTopic->AddItem( DdeItem( reinterpret_cast(SZDDESYS_ITEM_HELP) ) ); + AddTopic( *pSysTopic ); +} + +// --- DdeService::~DdeService() ----------------------------------- + +DdeService::~DdeService() +{ + DdeInstData* pInst = ImpGetInstData(); + DBG_ASSERT(pInst,"SVDDE:No instance data"); + if ( pInst->pServicesSvr ) + pInst->pServicesSvr->Remove( this ); + + // MT: Im Auftrage des Herrn (AM) auskommentiert... + // Grund: + // Bei Client/Server werden die Server nicht beendet, wenn mehr + // als einer gestartet. + // Weil keine System-Messagequeue ?! + + delete pSysTopic; + delete pName; + + pInst->nInstanceSvr--; + pInst->nRefCount--; + if ( !pInst->nInstanceSvr && pInst->hDdeInstSvr ) + { + if( DdeUninitialize( pInst->hDdeInstSvr ) ) + { + pInst->hDdeInstSvr = NULL; + delete pInst->pServicesSvr; + pInst->pServicesSvr = NULL; + if( pInst->nRefCount == 0) + ImpDeinitInstData(); + } + } + delete pConv; +} + +// --- DdeService::GetName() --------------------------------------- + +const String& DdeService::GetName() const +{ + return *pName; +} + +// --- DdeService::GetServices() ----------------------------------- + +DdeServices& DdeService::GetServices() +{ + DdeInstData* pInst = ImpGetInstData(); + DBG_ASSERT(pInst,"SVDDE:No instance data"); + return *(pInst->pServicesSvr); +} + +// --- DdeService::AddTopic() -------------------------------------- + +void DdeService::AddTopic( const DdeTopic& rTopic ) +{ + RemoveTopic( rTopic ); + aTopics.Insert( (DdeTopic*) &rTopic ); +} + +// --- DdeService::RemoveTopic() ----------------------------------- + +void DdeService::RemoveTopic( const DdeTopic& rTopic ) +{ + DdeTopic* t; + for ( t = aTopics.First(); t; t = aTopics.Next() ) + { + if ( !DdeCmpStringHandles (*t->pName, *rTopic.pName ) ) + { + aTopics.Remove( t ); + // JP 27.07.95: und alle Conversions loeschen !!! + // (sonst wird auf geloeschten Topics gearbeitet!!) + for( ULONG n = pConv->Count(); n; ) + { + Conversation* pC = pConv->GetObject( --n ); + if( pC->pTopic == &rTopic ) + { + pConv->Remove( pC ); + delete pC; + } + } + break; + } + } +} + +// --- DdeService::HasCbFormat() ----------------------------------- + +BOOL DdeService::HasCbFormat( USHORT nFmt ) +{ + return BOOL( aFormats.GetPos( nFmt ) != LIST_ENTRY_NOTFOUND ); +} + +// --- DdeService::HasFormat() ------------------------------------- + +BOOL DdeService::HasFormat( ULONG nFmt ) +{ + return HasCbFormat( (USHORT)DdeData::GetExternalFormat( nFmt )); +} + +// --- DdeService::AddFormat() ------------------------------------- + +void DdeService::AddFormat( ULONG nFmt ) +{ + nFmt = DdeData::GetExternalFormat( nFmt ); + aFormats.Remove( nFmt ); + aFormats.Insert( nFmt ); +} + +// --- DdeService::RemoveFormat() ---------------------------------- + +void DdeService::RemoveFormat( ULONG nFmt ) +{ + aFormats.Remove( DdeData::GetExternalFormat( nFmt ) ); +} + +// --- DdeTopic::DdeTopic() ---------------------------------------- + +DdeTopic::DdeTopic( const String& rName ) +{ + DdeInstData* pInst = ImpGetInstData(); + DBG_ASSERT(pInst,"SVDDE:No instance data"); + pName = new DdeString( pInst->hDdeInstSvr, rName ); +} + +// --- DdeTopic::~DdeTopic() --------------------------------------- + +DdeTopic::~DdeTopic() +{ + DdeItem* t; + while( ( t = aItems.First() ) != NULL ) + { + aItems.Remove( t ); + t->pMyTopic = 0; + delete t; + } + delete pName; +} + +// --- DdeTopic::GetName() ----------------------------------------- + +const String& DdeTopic::GetName() const +{ + return *pName; +} + +// --- DdeTopic::IsSystemTopic() ----------------------------------- + +BOOL DdeTopic::IsSystemTopic() +{ + return BOOL (GetName() == reinterpret_cast(SZDDESYS_TOPIC)); +} + +// --- DdeTopic::AddItem() ----------------------------------------- + +DdeItem* DdeTopic::AddItem( const DdeItem& r ) +{ + DdeItem* s; + if( DDEGETPUTITEM == r.nType ) + s = new DdeGetPutItem( r ); + else + s = new DdeItem( r ); + if ( s ) + { + aItems.Insert( s ); + s->pMyTopic = this; + } + return s; +} + +// --- DdeTopic::InsertItem() ----------------------------------------- + +void DdeTopic::InsertItem( DdeItem* pNew ) +{ + if( pNew ) + { + aItems.Insert( pNew ); + pNew->pMyTopic = this; + } +} + +// --- DdeTopic::RemoveItem() -------------------------------------- + +void DdeTopic::RemoveItem( const DdeItem& r ) +{ + DdeItem* s; + for ( s = aItems.First(); s; s = aItems.Next() ) + { + if ( !DdeCmpStringHandles (*s->pName, *r.pName ) ) + break; + } + + if ( s ) + { + aItems.Remove( s ); + s->pMyTopic = 0; + delete s; + } +} + +// --- DdeTopic::NotifyClient() ------------------------------------ + +void DdeTopic::NotifyClient( const String& rItem ) +{ + DdeItem* pItem; + DdeInstData* pInst = ImpGetInstData(); + DBG_ASSERT(pInst,"SVDDE:No instance data"); + for ( pItem = aItems.First(); pItem; pItem = aItems.Next() ) + { + if ( pItem->GetName() == rItem ) + { + if ( pItem->pImpData ) + DdePostAdvise( pInst->hDdeInstSvr, *pName, *pItem->pName ); + } + break; + } +} + +// --- DdeTopic::Connect() ----------------------------------------- + +void __EXPORT DdeTopic::Connect( long nId ) +{ + aConnectLink.Call( (void*)nId ); +} + +// --- DdeTopic::Disconnect() -------------------------------------- + +void __EXPORT DdeTopic::Disconnect( long nId ) +{ + aDisconnectLink.Call( (void*)nId ); +} + +// --- DdeTopic::_Disconnect() -------------------------------------- + +void __EXPORT DdeTopic::_Disconnect( long nId ) +{ + for( DdeItem* pItem = aItems.First(); pItem; pItem = aItems.Next() ) + pItem->DecMonitor( nId ); + + Disconnect( nId ); +} + +// --- DdeTopic::Get() --------------------------------------------- + +DdeData* __EXPORT DdeTopic::Get( ULONG nFmt ) +{ + if ( aGetLink.IsSet() ) + return (DdeData*)aGetLink.Call( (void*)nFmt ); + else + return NULL; +} + +// --- DdeTopic::Put() --------------------------------------------- + +BOOL __EXPORT DdeTopic::Put( const DdeData* r ) +{ + if ( aPutLink.IsSet() ) + return (BOOL)aPutLink.Call( (void*) r ); + else + return FALSE; +} + +// --- DdeTopic::Execute() ----------------------------------------- + +BOOL __EXPORT DdeTopic::Execute( const String* r ) +{ + if ( aExecLink.IsSet() ) + return (BOOL)aExecLink.Call( (void*)r ); + else + return FALSE; +} + +// --- DdeTopic::GetConvId() --------------------------------------- + +long DdeTopic::GetConvId() +{ + DdeInstData* pInst = ImpGetInstData(); + DBG_ASSERT(pInst,"SVDDE:No instance data"); + return pInst->hCurConvSvr; +} + +// --- DdeTopic::StartAdviseLoop() --------------------------------- + +BOOL DdeTopic::StartAdviseLoop() +{ + return FALSE; +} + +// --- DdeTopic::StopAdviseLoop() ---------------------------------- + +BOOL DdeTopic::StopAdviseLoop() +{ + return FALSE; +} + +// --- DdeItem::DdeItem() ------------------------------------------ + +DdeItem::DdeItem( const sal_Unicode* p ) +{ + DdeInstData* pInst = ImpGetInstData(); + DBG_ASSERT(pInst,"SVDDE:No instance data"); + pName = new DdeString( pInst->hDdeInstSvr, p ); + nType = DDEITEM; + pMyTopic = 0; + pImpData = 0; +} + +// --- DdeItem::DdeItem() ------------------------------------------ + +DdeItem::DdeItem( const String& r) +{ + DdeInstData* pInst = ImpGetInstData(); + DBG_ASSERT(pInst,"SVDDE:No instance data"); + pName = new DdeString( pInst->hDdeInstSvr, r ); + nType = DDEITEM; + pMyTopic = 0; + pImpData = 0; +} + +// --- DdeItem::DdeItem() ------------------------------------------ + +DdeItem::DdeItem( const DdeItem& r) +{ + DdeInstData* pInst = ImpGetInstData(); + DBG_ASSERT(pInst,"SVDDE:No instance data"); + pName = new DdeString( pInst->hDdeInstSvr, *r.pName ); + nType = DDEITEM; + pMyTopic = 0; + pImpData = 0; +} + +// --- DdeItem::~DdeItem() ----------------------------------------- + +DdeItem::~DdeItem() +{ + if( pMyTopic ) + pMyTopic->aItems.Remove( this ); + delete pName; + delete pImpData; +} + +// --- DdeItem::GetName() ------------------------------------------ + +const String& DdeItem::GetName() const +{ + return *pName; +} + +// --- DdeItem::NotifyClient() ------------------------------------------ + +void DdeItem::NotifyClient() +{ + if( pMyTopic && pImpData ) + { + DdeInstData* pInst = ImpGetInstData(); + DBG_ASSERT(pInst,"SVDDE:No instance data"); + DdePostAdvise( pInst->hDdeInstSvr, *pMyTopic->pName, *pName ); + } +} + +// --- DdeItem::IncMonitor() ------------------------------------------ + +void DdeItem::IncMonitor( ULONG nHCnv ) +{ + if( !pImpData ) + { + pImpData = new DdeItemImp; + if( DDEGETPUTITEM == nType ) + ((DdeGetPutItem*)this)->AdviseLoop( TRUE ); + } + else + { + for( USHORT n = pImpData->Count(); n; ) + if( (*pImpData)[ --n ].nHCnv == nHCnv ) + { + ++(*pImpData)[ n ].nHCnv; + return ; + } + } + + pImpData->Insert( DdeItemImpData( nHCnv ), pImpData->Count() ); +} + +// --- DdeItem::DecMonitor() ------------------------------------------ + +void DdeItem::DecMonitor( ULONG nHCnv ) +{ + if( pImpData ) + { + DdeItemImpData* pData = (DdeItemImpData*)pImpData->GetData(); + for( USHORT n = pImpData->Count(); n; --n, ++pData ) + if( pData->nHCnv == nHCnv ) + { + if( !pData->nCnt || !--pData->nCnt ) + { + if( 1 < pImpData->Count() ) + pImpData->Remove( pImpData->Count() - n ); + else + { + delete pImpData, pImpData = 0; + if( DDEGETPUTITEM == nType ) + ((DdeGetPutItem*)this)->AdviseLoop( FALSE ); + } + } + return ; + } + } +} + +// --- DdeItem::GetLinks() ------------------------------------------ + +short DdeItem::GetLinks() +{ + short nCnt = 0; + if( pImpData ) + for( USHORT n = pImpData->Count(); n; ) + nCnt = nCnt + (*pImpData)[ --n ].nCnt; + return nCnt; +} + +// --- DdeGetPutItem::DdeGetPutItem() ------------------------------ + +DdeGetPutItem::DdeGetPutItem( const sal_Unicode* p ) + : DdeItem( p ) +{ + nType = DDEGETPUTITEM; +} + +// --- DdeGetPutItem::DdeGetPutItem() ------------------------------ + +DdeGetPutItem::DdeGetPutItem( const String& rStr ) + : DdeItem( rStr ) +{ + nType = DDEGETPUTITEM; +} + +// --- DdeGetPutItem::DdeGetPutItem() ------------------------------ + +DdeGetPutItem::DdeGetPutItem( const DdeItem& rItem ) + : DdeItem( rItem ) +{ + nType = DDEGETPUTITEM; +} + + +// --- DdeGetPutData::Get() ---------------------------------------- + +DdeData* DdeGetPutItem::Get( ULONG ) +{ + return 0; +} + +// --- DdeGetPutData::Put() ---------------------------------------- + +BOOL DdeGetPutItem::Put( const DdeData* ) +{ + return FALSE; +} + +// --- DdeGetPutData::AdviseLoop() --------------------------------- + +void DdeGetPutItem::AdviseLoop( BOOL ) +{ +} + + +// --- DdeService::SysItems() -------------------------------------- + +String DdeService::SysItems() +{ + String s; + DdeTopic* t; + for ( t = aTopics.First(); t; t = aTopics.Next() ) + { + if ( t->GetName() == reinterpret_cast(SZDDESYS_TOPIC) ) + { + short n = 0; + DdeItem* pi; + for ( pi = t->aItems.First(); pi; pi = t->aItems.Next(), n++ ) + { + if ( n ) + s += '\t'; + s += pi->GetName(); + } + s += String::CreateFromAscii("\r\n"); + } + } + + return s; +} + +// --- DdeService::Topics() ---------------------------------------- + +String DdeService::Topics() +{ + String s; + DdeTopic* t; + short n = 0; + + for ( t = aTopics.First(); t; t = aTopics.Next(), n++ ) + { + if ( n ) + s += '\t'; + s += t->GetName(); + } + s += String::CreateFromAscii("\r\n"); + + return s; +} + +// --- DdeService::Formats() --------------------------------------- + +String DdeService::Formats() +{ + String s; + long f; + TCHAR buf[128]; + LPCTSTR p; + short n = 0; + + for ( f = aFormats.First(); f; f = aFormats.Next(), n++ ) + { + if ( n ) + s += '\t'; + p = buf; + + switch( (USHORT)f ) + { + case CF_TEXT: + p = reinterpret_cast(String::CreateFromAscii("TEXT").GetBuffer()); + break; + case CF_BITMAP: + p = reinterpret_cast(String::CreateFromAscii("BITMAP").GetBuffer()); + break; +#ifdef OS2 + case CF_DSPTEXT: + p = String::CreateFromAscii("TEXT").GetBuffer(); + break; + case CF_DSPBITMAP: + p = String::CreateFromAscii("BITMAP").GetBuffer(); + break; + case CF_METAFILE: + p = String::CreateFromAscii("METAFILE").GetBuffer(); + break; + case CF_DSPMETAFILE: + p = String::CreateFromAscii("METAFILE").GetBuffer(); + break; + case CF_PALETTE: + p = String::CreateFromAscii("PALETTE").GetBuffer(); + break; + default: + p= String::CreateFromAscii("PRIVATE").GetBuffer(); +#else + default: + GetClipboardFormatName( (UINT)f, buf, sizeof(buf) / sizeof(TCHAR) ); +#endif + } + s += String( reinterpret_cast(p) ); + } + s += String::CreateFromAscii("\r\n"); + + return s; +} + +// --- DdeService::Status() ---------------------------------------- + +String DdeService::Status() +{ + return IsBusy() ? String::CreateFromAscii("Busy\r\n") : String::CreateFromAscii("Ready\r\n"); +} + +// --- DdeService::IsBusy() ---------------------------------------- + +BOOL __EXPORT DdeService::IsBusy() +{ + return FALSE; +} + +// --- DdeService::GetHelp() ---------------------------------------- + +String __EXPORT DdeService::GetHelp() +{ + return String(); +} + +BOOL DdeTopic::MakeItem( const String& ) +{ + return FALSE; +} + +BOOL DdeService::MakeTopic( const String& ) +{ + return FALSE; +} + +String DdeService::SysTopicGet( const String& ) +{ + return String(); +} + +BOOL DdeService::SysTopicExecute( const String* ) +{ + return FALSE; +} + diff --git a/svl/source/svdde/ddewrap.cxx b/svl/source/svdde/ddewrap.cxx new file mode 100644 index 000000000000..b0b023ad3a75 --- /dev/null +++ b/svl/source/svdde/ddewrap.cxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ddewrap.cxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#define _SVTOOLS_SVDDE_DDEWRAP_CXX_ + +#if defined _MSC_VER +#pragma warning(push, 1) +#endif +#include +#if defined _MSC_VER +#pragma warning(pop) +#endif +#include "ddewrap.hxx" + +//------------------------------------------------------------------------ + +HSZ WINAPI DdeCreateStringHandleW_9x( DWORD idInst, LPCWSTR pszString, int ) +{ + HSZ hszResult; + LPSTR pszANSIString; + int nSize; + + nSize = pszString ? WideCharToMultiByte( CP_ACP, 0, pszString, -1, NULL, 0, NULL, NULL ) : 0; + pszANSIString = nSize ? (LPSTR)HeapAlloc( GetProcessHeap(), 0, nSize * sizeof(CHAR) ) : NULL; + + if ( pszANSIString ) + WideCharToMultiByte( CP_ACP, 0, pszString, -1, pszANSIString, nSize, NULL, NULL ); + + hszResult = DdeCreateStringHandleA( idInst, pszANSIString, CP_WINANSI ); + + if ( pszANSIString ) + HeapFree( GetProcessHeap(), 0, pszANSIString ); + + return hszResult; +} + +//------------------------------------------------------------------------ + +DWORD WINAPI DdeQueryStringW_9x( DWORD idInst, HSZ hsz, LPWSTR pszString, DWORD cchMax, int ) +{ + DWORD dwResult; + LPSTR pszANSIString; + + pszANSIString = cchMax ? (LPSTR)HeapAlloc( GetProcessHeap(), 0, cchMax * sizeof(CHAR) ) : NULL; + + dwResult = DdeQueryStringA( idInst, hsz, pszANSIString, cchMax, CP_WINANSI ); + + if ( dwResult && pszANSIString ) + MultiByteToWideChar( CP_ACP, 0, pszANSIString, -1, pszString, cchMax ); + + if ( pszANSIString ) + HeapFree( GetProcessHeap(), 0, pszANSIString ); + + return dwResult; +} + +//------------------------------------------------------------------------ + +UINT WINAPI DdeInitializeW_9x( LPDWORD pidInst, PFNCALLBACK pfnCallback, DWORD afCmd, DWORD ulRes ) +{ + return DdeInitializeA( pidInst, pfnCallback, afCmd, ulRes ); +} + +//------------------------------------------------------------------------ + +#define DEFINE_WAPI_FUNC(func) \ +func##_PROC lpfn##func = (LONG)GetVersion() >= 0 ? func : func##_9x; + + +DEFINE_WAPI_FUNC( DdeCreateStringHandleW ); +DEFINE_WAPI_FUNC( DdeQueryStringW ); +DEFINE_WAPI_FUNC( DdeInitializeW ); + diff --git a/svl/source/svdde/ddewrap.hxx b/svl/source/svdde/ddewrap.hxx new file mode 100644 index 000000000000..77d012ccbba5 --- /dev/null +++ b/svl/source/svdde/ddewrap.hxx @@ -0,0 +1,24 @@ +#ifndef _SVTOOLS_SVDDE_DDEWRAP_HXX_ +#define _SVTOOLS_SVDDE_DDEWRAP_HXX_ + +#define DECLARE_WAPI_FUNC(func) \ + extern func##_PROC lpfn##func; + +typedef HSZ (WINAPI *DdeCreateStringHandleW_PROC)( DWORD idInst, LPCWSTR pszString, int iCodePage ); +typedef DWORD (WINAPI *DdeQueryStringW_PROC)( DWORD idInst, HSZ hsz, LPWSTR pszString, DWORD cchMax, int iCodePage ); +typedef UINT (WINAPI *DdeInitializeW_PROC)( LPDWORD pidInst, PFNCALLBACK pfnCallback, DWORD afCmd, DWORD ulRes ); + + +DECLARE_WAPI_FUNC( DdeCreateStringHandleW ); +DECLARE_WAPI_FUNC( DdeQueryStringW ); +DECLARE_WAPI_FUNC( DdeInitializeW ); + + +#ifndef _SVTOOLS_SVDDE_DDEWRAP_CXX_ +#define DdeCreateStringHandleW lpfnDdeCreateStringHandleW +#define DdeQueryStringW lpfnDdeQueryStringW +#define DdeInitializeW lpfnDdeInitializeW +#endif + + +#endif diff --git a/svl/source/svdde/makefile.mk b/svl/source/svdde/makefile.mk new file mode 100644 index 000000000000..f4c72aff2094 --- /dev/null +++ b/svl/source/svdde/makefile.mk @@ -0,0 +1,64 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.10 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + + +.IF "$(GUIBASE)"=="WIN" + +PRJ=..$/.. + +PRJNAME=svtools +TARGET=svdde + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/svt.pmk + +# --- Files -------------------------------------------------------- + + +SLOFILES= $(SLO)$/ddecli.obj \ + $(SLO)$/ddesvr.obj \ + $(SLO)$/ddedata.obj \ + $(SLO)$/ddestrg.obj \ + $(SLO)$/ddewrap.obj \ + $(SLO)$/ddeinf.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + +.ELSE +dummy: + @echo GUI == "$(GUI)" - nothing to do + +.ENDIF + diff --git a/svl/source/svsql/converter.cxx b/svl/source/svsql/converter.cxx new file mode 100644 index 000000000000..c87290265e90 --- /dev/null +++ b/svl/source/svsql/converter.cxx @@ -0,0 +1,45 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: converter.cxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include "converter.hxx" + +INT32 SvDbaseConverter::ConvertPrecisionToDbase(INT32 _nLen, INT32 _nScale) +{ + return _nScale ? _nLen +2 : _nLen +1; +} +//------------------------------------------------------------------------ +INT32 SvDbaseConverter::ConvertPrecisionToOdbc(INT32 _nLen, INT32 _nScale) +{ + return _nScale ? _nLen -2 : _nLen -1; +} + + diff --git a/svl/source/svsql/converter.hxx b/svl/source/svsql/converter.hxx new file mode 100644 index 000000000000..f6a5d67ca966 --- /dev/null +++ b/svl/source/svsql/converter.hxx @@ -0,0 +1,46 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: converter.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SV_CONVERTER_HXX_ +#define _SV_CONVERTER_HXX_ + +#include "svtools/svldllapi.h" +#include + +class SvDbaseConverter +{ +public: + SVL_DLLPUBLIC static INT32 ConvertPrecisionToDbase(INT32 _nLen, INT32 _nScale); + SVL_DLLPUBLIC static INT32 ConvertPrecisionToOdbc(INT32 _nLen, INT32 _nScale); +}; + +#endif //_CONVERTER_HXX_ + + + diff --git a/svl/source/svsql/makefile.mk b/svl/source/svsql/makefile.mk new file mode 100644 index 000000000000..55c400b83ef3 --- /dev/null +++ b/svl/source/svsql/makefile.mk @@ -0,0 +1,50 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.6 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=svtools +TARGET=svsql + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/svl.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/converter.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/svl/source/syslocale/makefile.mk b/svl/source/syslocale/makefile.mk new file mode 100644 index 000000000000..a393c174856f --- /dev/null +++ b/svl/source/syslocale/makefile.mk @@ -0,0 +1,48 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.5 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* +PRJ=..$/.. + +PRJNAME=svtools +TARGET=syslocale + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/svt.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/syslocale.obj + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/svl/source/syslocale/syslocale.cxx b/svl/source/syslocale/syslocale.cxx new file mode 100644 index 000000000000..9811d97fd964 --- /dev/null +++ b/svl/source/syslocale/syslocale.cxx @@ -0,0 +1,176 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: syslocale.cxx,v $ + * $Revision: 1.11 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#ifndef GCC +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +using namespace osl; +using namespace com::sun::star; + + +SvtSysLocale_Impl* SvtSysLocale::pImpl = NULL; +sal_Int32 SvtSysLocale::nRefCount = 0; + + +class SvtSysLocale_Impl : public SvtListener +{ + friend class SvtSysLocale; + + SvtSysLocaleOptions aSysLocaleOptions; + LocaleDataWrapper* pLocaleData; + CharClass* pCharClass; + +public: + SvtSysLocale_Impl(); + virtual ~SvtSysLocale_Impl(); + + virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint ); + + CharClass* GetCharClass(); + +}; + + +// ----------------------------------------------------------------------- + +SvtSysLocale_Impl::SvtSysLocale_Impl() : pCharClass(NULL) +{ + const lang::Locale& rLocale = Application::GetSettings().GetLocale(); + pLocaleData = new LocaleDataWrapper( + ::comphelper::getProcessServiceFactory(), rLocale ); + aSysLocaleOptions.AddListener( *this ); +} + + +SvtSysLocale_Impl::~SvtSysLocale_Impl() +{ + aSysLocaleOptions.RemoveListener( *this ); + delete pCharClass; + delete pLocaleData; +} + +CharClass* SvtSysLocale_Impl::GetCharClass() +{ + if ( !pCharClass ) + { + const lang::Locale& rLocale = Application::GetSettings().GetLocale(); + pCharClass = new CharClass(::comphelper::getProcessServiceFactory(), rLocale ); + } + return pCharClass; +} +void SvtSysLocale_Impl::Notify( SvtBroadcaster&, const SfxHint& rHint ) +{ + const SfxSimpleHint* p = PTR_CAST( SfxSimpleHint, &rHint ); + if( p && (p->GetId() & SYSLOCALEOPTIONS_HINT_LOCALE) ) + { + MutexGuard aGuard( SvtSysLocale::GetMutex() ); + const lang::Locale& rLocale = Application::GetSettings().GetLocale(); + pLocaleData->setLocale( rLocale ); + GetCharClass()->setLocale( rLocale ); + } +} + + +// ==================================================================== + +SvtSysLocale::SvtSysLocale() +{ + MutexGuard aGuard( GetMutex() ); + if ( !pImpl ) + pImpl = new SvtSysLocale_Impl; + ++nRefCount; +} + + +SvtSysLocale::~SvtSysLocale() +{ + MutexGuard aGuard( GetMutex() ); + if ( !--nRefCount ) + { + delete pImpl; + pImpl = NULL; + } +} + + +// static +Mutex& SvtSysLocale::GetMutex() +{ + static Mutex* pMutex = NULL; + if( !pMutex ) + { + MutexGuard aGuard( Mutex::getGlobalMutex() ); + if( !pMutex ) + { + // #i77768# Due to a static reference in the toolkit lib + // we need a mutex that lives longer than the svtools library. + // Otherwise the dtor would use a destructed mutex!! + pMutex = new Mutex; + } + } + return *pMutex; +} + + +const LocaleDataWrapper& SvtSysLocale::GetLocaleData() const +{ + return *(pImpl->pLocaleData); +} + + +const LocaleDataWrapper* SvtSysLocale::GetLocaleDataPtr() const +{ + return pImpl->pLocaleData; +} + + +const CharClass& SvtSysLocale::GetCharClass() const +{ + return *(pImpl->GetCharClass()); +} + + +const CharClass* SvtSysLocale::GetCharClassPtr() const +{ + return pImpl->GetCharClass(); +} diff --git a/svl/source/undo/makefile.mk b/svl/source/undo/makefile.mk new file mode 100644 index 000000000000..b277fa3c906f --- /dev/null +++ b/svl/source/undo/makefile.mk @@ -0,0 +1,51 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.5 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=svtools +TARGET=undo +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/svt.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/undo.obj + +# --- Tagets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx new file mode 100644 index 000000000000..2f733d4f03b3 --- /dev/null +++ b/svl/source/undo/undo.cxx @@ -0,0 +1,819 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: undo.cxx,v $ + * $Revision: 1.11 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include + +#include + +#include + +using ::com::sun::star::uno::Exception; + +// STATIC DATA ----------------------------------------------------------- + +DBG_NAME(SfxUndoAction) + +//======================================================================== + +TYPEINIT0(SfxUndoAction); +TYPEINIT0(SfxListUndoAction); +TYPEINIT0(SfxLinkUndoAction); +TYPEINIT0(SfxRepeatTarget); + +//------------------------------------------------------------------------ + +SfxRepeatTarget::~SfxRepeatTarget() +{ +} + +//------------------------------------------------------------------------ + +BOOL SfxUndoAction::IsLinked() +{ + return bLinked; +} + +//------------------------------------------------------------------------ + +void SfxUndoAction::SetLinked( BOOL bIsLinked ) +{ + bLinked = bIsLinked; +} + +//------------------------------------------------------------------------ + +SfxUndoAction::~SfxUndoAction() +{ + DBG_DTOR(SfxUndoAction, 0); + DBG_ASSERT( !IsLinked(), "Gelinkte Action geloescht" ); +} + + +SfxUndoAction::SfxUndoAction() +{ + DBG_CTOR(SfxUndoAction, 0); + SetLinked( FALSE ); +} + +//------------------------------------------------------------------------ + +BOOL SfxUndoAction::Merge( SfxUndoAction * ) +{ + DBG_CHKTHIS(SfxUndoAction, 0); + return FALSE; +} + +//------------------------------------------------------------------------ + +XubString SfxUndoAction::GetComment() const +{ + DBG_CHKTHIS(SfxUndoAction, 0); + return XubString(); +} + +//------------------------------------------------------------------------ + + +USHORT SfxUndoAction::GetId() const +{ + DBG_CHKTHIS(SfxUndoAction, 0); + return 0; +} + +//------------------------------------------------------------------------ + +XubString SfxUndoAction::GetRepeatComment(SfxRepeatTarget&) const +{ + DBG_CHKTHIS(SfxUndoAction, 0); + return GetComment(); +} + +//------------------------------------------------------------------------ + + +void SfxUndoAction::Undo() +{ + // die sind nur konzeptuell pure virtual + DBG_ERROR( "pure virtual function called: SfxUndoAction::Undo()" ); +} + +//------------------------------------------------------------------------ + +void SfxUndoAction::Redo() +{ + // die sind nur konzeptuell pure virtual + DBG_ERROR( "pure virtual function called: SfxUndoAction::Redo()" ); +} + +//------------------------------------------------------------------------ + +void SfxUndoAction::Repeat(SfxRepeatTarget&) +{ + // die sind nur konzeptuell pure virtual + DBG_ERROR( "pure virtual function called: SfxUndoAction::Repeat()" ); +} + +//------------------------------------------------------------------------ + + +BOOL SfxUndoAction::CanRepeat(SfxRepeatTarget&) const +{ + return TRUE; +} + +//======================================================================== + + +SfxUndoManager::SfxUndoManager( USHORT nMaxUndoActionCount ) + : pFatherUndoArray(0) + , mbUndoEnabled( true ) +{ + pUndoArray=new SfxUndoArray(nMaxUndoActionCount); + pActUndoArray=pUndoArray; + +} + +//------------------------------------------------------------------------ + + +SfxUndoManager::~SfxUndoManager() +{ + delete pUndoArray; +} + +//------------------------------------------------------------------------ + +void SfxUndoManager::EnableUndo( bool bEnable ) +{ + mbUndoEnabled = bEnable; +} + +//------------------------------------------------------------------------ + + +void SfxUndoManager::SetMaxUndoActionCount( USHORT nMaxUndoActionCount ) +{ + // Remove entries from the pActUndoArray when we have to reduce + // the number of entries due to a lower nMaxUndoActionCount. + // Both redo and undo action entries will be removed until we reached the + // new nMaxUndoActionCount. + + long nNumToDelete = pActUndoArray->aUndoActions.Count() - nMaxUndoActionCount; + if ( nNumToDelete > 0 ) + { + while ( nNumToDelete > 0 ) + { + USHORT nPos = pActUndoArray->aUndoActions.Count(); + if ( nPos > pActUndoArray->nCurUndoAction ) + { + if ( !pActUndoArray->aUndoActions[nPos-1]->IsLinked() ) + { + delete pActUndoArray->aUndoActions[nPos-1]; + pActUndoArray->aUndoActions.Remove( nPos-1 ); + --nNumToDelete; + } + } + + if ( nNumToDelete > 0 && pActUndoArray->nCurUndoAction > 0 ) + { + if ( !pActUndoArray->aUndoActions[0]->IsLinked() ) + { + delete pActUndoArray->aUndoActions[0]; + pActUndoArray->aUndoActions.Remove(0); + --pActUndoArray->nCurUndoAction; + --nNumToDelete; + } + } + + if ( nPos == pActUndoArray->aUndoActions.Count() ) + break; // Cannot delete more entries + } + } + + pActUndoArray->nMaxUndoActions = nMaxUndoActionCount; +} + +//------------------------------------------------------------------------ + +USHORT SfxUndoManager::GetMaxUndoActionCount() const +{ + return pActUndoArray->nMaxUndoActions; +} + +//------------------------------------------------------------------------ + +void SfxUndoManager::Clear() +{ + while ( pActUndoArray->aUndoActions.Count() ) + { + SfxUndoAction *pAction= + pActUndoArray->aUndoActions[pActUndoArray->aUndoActions.Count() - 1]; + pActUndoArray->aUndoActions.Remove( pActUndoArray->aUndoActions.Count() - 1 ); + delete pAction; + } + + pActUndoArray->nCurUndoAction = 0; +} + +//------------------------------------------------------------------------ + +void SfxUndoManager::ClearRedo() +{ + while ( pActUndoArray->aUndoActions.Count() > pActUndoArray->nCurUndoAction ) + { + SfxUndoAction *pAction= + pActUndoArray->aUndoActions[pActUndoArray->aUndoActions.Count() - 1]; + pActUndoArray->aUndoActions.Remove( pActUndoArray->aUndoActions.Count() - 1 ); + delete pAction; + } +} + +//------------------------------------------------------------------------ + +void SfxUndoManager::AddUndoAction( SfxUndoAction *pAction, BOOL bTryMerge ) +{ + if( mbUndoEnabled ) + { + // Redo-Actions loeschen + for ( USHORT nPos = pActUndoArray->aUndoActions.Count(); + nPos > pActUndoArray->nCurUndoAction; --nPos ) + delete pActUndoArray->aUndoActions[nPos-1]; + + pActUndoArray->aUndoActions.Remove( + pActUndoArray->nCurUndoAction, + pActUndoArray->aUndoActions.Count() - pActUndoArray->nCurUndoAction ); + + if ( pActUndoArray->nMaxUndoActions ) + { + SfxUndoAction *pTmpAction = pActUndoArray->nCurUndoAction ? + pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1] : 0; + + if ( !bTryMerge || !(pTmpAction && pTmpAction->Merge(pAction)) ) + { + // auf Max-Anzahl anpassen + if( pActUndoArray == pUndoArray ) + while( pActUndoArray->aUndoActions.Count() >= + pActUndoArray->nMaxUndoActions && + !pActUndoArray->aUndoActions[0]->IsLinked() ) + { + delete pActUndoArray->aUndoActions[0]; + pActUndoArray->aUndoActions.Remove(0); + --pActUndoArray->nCurUndoAction; + } + + // neue Action anh"angen + const SfxUndoAction* pTemp = pAction; + pActUndoArray->aUndoActions.Insert( + pTemp, pActUndoArray->nCurUndoAction++ ); + return; + } + } + } + delete pAction; +} + +//------------------------------------------------------------------------ + +USHORT SfxUndoManager::GetUndoActionCount() const +{ + return pActUndoArray->nCurUndoAction; +} + +//------------------------------------------------------------------------ + +XubString SfxUndoManager::GetUndoActionComment( USHORT nNo ) const +{ + DBG_ASSERT( nNo < pActUndoArray->nCurUndoAction, "svtools::SfxUndoManager::GetUndoActionComment(), illegal id!" ); + if( nNo < pActUndoArray->nCurUndoAction ) + { + return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1-nNo]->GetComment(); //! + } + else + { + XubString aEmpty; + return aEmpty; + } +} + +//------------------------------------------------------------------------ + +USHORT SfxUndoManager::GetUndoActionId( USHORT nNo ) const +{ + DBG_ASSERT( nNo < pActUndoArray->nCurUndoAction, "svtools::SfxUndoManager::GetUndoActionId(), illegal id!" ); + if( nNo < pActUndoArray->nCurUndoAction ) + { + return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1-nNo]->GetId(); //! + } + else + { + return 0; + } +} + +//------------------------------------------------------------------------ + +SfxUndoAction* SfxUndoManager::GetUndoAction( USHORT nNo ) const +{ + DBG_ASSERT( nNo < pActUndoArray->nCurUndoAction, "svtools::SfxUndoManager::GetUndoAction(), illegal id!" ); + if( nNo < pActUndoArray->nCurUndoAction ) + { + return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1-nNo]; //! + } + else + { + return 0; + } +} + +//------------------------------------------------------------------------ + +/** clears the redo stack and removes the top undo action */ +void SfxUndoManager::RemoveLastUndoAction() +{ + DBG_ASSERT( pActUndoArray->nCurUndoAction, "svtools::SfxUndoManager::RemoveLastUndoAction(), no action to remove?!" ); + if( pActUndoArray->nCurUndoAction ) + { + pActUndoArray->nCurUndoAction--; + + // delete redo-actions and top action + USHORT nPos; + for ( nPos = pActUndoArray->aUndoActions.Count(); nPos > pActUndoArray->nCurUndoAction; --nPos ) + delete pActUndoArray->aUndoActions[nPos-1]; + + pActUndoArray->aUndoActions.Remove( + pActUndoArray->nCurUndoAction, + pActUndoArray->aUndoActions.Count() - pActUndoArray->nCurUndoAction ); + } +} + +//------------------------------------------------------------------------ + +BOOL SfxUndoManager::Undo( USHORT ) +{ + bool bUndoWasEnabled = mbUndoEnabled; + mbUndoEnabled = false; + + BOOL bRet = FALSE; + + try + { + DBG_ASSERT( pActUndoArray == pUndoArray, "svtools::SfxUndoManager::Undo(), LeaveListAction() not yet called!" ); + if ( pActUndoArray->nCurUndoAction ) + { + Undo( *pActUndoArray->aUndoActions[ --pActUndoArray->nCurUndoAction ] ); + bRet = TRUE; + } + } + catch( Exception& e ) + { + mbUndoEnabled = bUndoWasEnabled; + throw e; + } + mbUndoEnabled = bUndoWasEnabled; + return bRet; +} + +//------------------------------------------------------------------------ + +void SfxUndoManager::Undo( SfxUndoAction &rAction ) +{ + bool bUndoWasEnabled = mbUndoEnabled; + mbUndoEnabled = false; + try + { + rAction.Undo(); + } + catch( Exception& e ) + { + mbUndoEnabled = bUndoWasEnabled; + throw e; + } + + mbUndoEnabled = bUndoWasEnabled; +} + +//------------------------------------------------------------------------ + +USHORT SfxUndoManager::GetRedoActionCount() const +{ + return pActUndoArray->aUndoActions.Count() - pActUndoArray->nCurUndoAction; //! +} + +//------------------------------------------------------------------------ + +XubString SfxUndoManager::GetRedoActionComment( USHORT nNo ) const +{ + return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction+nNo]->GetComment(); //! +} + +//------------------------------------------------------------------------ + +USHORT SfxUndoManager::GetRedoActionId( USHORT nNo ) const +{ + return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction+nNo]->GetId(); //! +} + +//------------------------------------------------------------------------ + +BOOL SfxUndoManager::Redo( USHORT ) +{ + bool bUndoWasEnabled = mbUndoEnabled; + mbUndoEnabled = false; + + BOOL bRet = FALSE; + + try + { + if ( pActUndoArray->aUndoActions.Count() > pActUndoArray->nCurUndoAction ) + { + Redo( *pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction++] ); + bRet = TRUE; + } + } + catch( Exception& e ) + { + mbUndoEnabled = bUndoWasEnabled; + throw e; + } + + mbUndoEnabled = bUndoWasEnabled; + return bRet; +} + +//------------------------------------------------------------------------ + +void SfxUndoManager::Redo( SfxUndoAction &rAction ) +{ + bool bUndoWasEnabled = mbUndoEnabled; + mbUndoEnabled = false; + + try + { + rAction.Redo(); + } + catch( Exception& e ) + { + mbUndoEnabled = bUndoWasEnabled; + throw e; + } + + mbUndoEnabled = bUndoWasEnabled; +} + +//------------------------------------------------------------------------ + +USHORT SfxUndoManager::GetRepeatActionCount() const +{ + return pActUndoArray->aUndoActions.Count(); +} + +//------------------------------------------------------------------------ + +XubString SfxUndoManager::GetRepeatActionComment( SfxRepeatTarget &rTarget, USHORT nNo ) const +{ + return pActUndoArray->aUndoActions[ pActUndoArray->aUndoActions.Count() - 1 - nNo ] + ->GetRepeatComment(rTarget); +} + +//------------------------------------------------------------------------ + +BOOL SfxUndoManager::Repeat( SfxRepeatTarget &rTarget, USHORT /*nFrom*/, USHORT /*nCount*/ ) +{ + if ( pActUndoArray->aUndoActions.Count() ) + { + Repeat( rTarget, *pActUndoArray->aUndoActions[ pActUndoArray->aUndoActions.Count() - 1 ] ); + return TRUE; + } + + return FALSE; +} + +//------------------------------------------------------------------------ + +void SfxUndoManager::Repeat( SfxRepeatTarget &rTarget, SfxUndoAction &rAction ) +{ + if ( rAction.CanRepeat(rTarget) ) + rAction.Repeat(rTarget); +} + +//------------------------------------------------------------------------ + +BOOL SfxUndoManager::CanRepeat( SfxRepeatTarget &rTarget, SfxUndoAction &rAction ) const +{ + return rAction.CanRepeat(rTarget); +} + +//------------------------------------------------------------------------ + +BOOL SfxUndoManager::CanRepeat( SfxRepeatTarget &rTarget, USHORT nNo ) const +{ + if ( pActUndoArray->aUndoActions.Count() > nNo ) + { + USHORT nActionNo = pActUndoArray->aUndoActions.Count() - 1 - nNo; + return pActUndoArray->aUndoActions[nActionNo]->CanRepeat(rTarget); + } + + return FALSE; +} + +//------------------------------------------------------------------------ + +void SfxUndoManager::EnterListAction( + const XubString& rComment, const XubString &rRepeatComment, USHORT nId ) + +/* [Beschreibung] + + Fuegt eine ListUndoAction ein und setzt dessen UndoArray als aktuelles. +*/ + +{ + if( !mbUndoEnabled ) + return; + + if ( !pUndoArray->nMaxUndoActions ) + return; + + pFatherUndoArray=pActUndoArray; + SfxListUndoAction *pAction=new SfxListUndoAction( + rComment, rRepeatComment, nId, pActUndoArray); + AddUndoAction( pAction ); + pActUndoArray=pAction; +} + +//------------------------------------------------------------------------ + +void SfxUndoManager::LeaveListAction() + +/* [Beschreibung] + + Verlaesst die aktuelle ListAction und geht eine Ebene nach oben. +*/ +{ + if ( !mbUndoEnabled ) + return; + + if ( !pUndoArray->nMaxUndoActions ) + return; + + if( pActUndoArray == pUndoArray ) + { + DBG_ERROR( "svtools::SfxUndoManager::LeaveListAction(), called without calling EnterListAction()!" ); + return; + } + + DBG_ASSERT(pActUndoArray->pFatherUndoArray,"svtools::SfxUndoManager::LeaveListAction(), no father undo array!?"); + + SfxUndoArray* pTmp=pActUndoArray; + pActUndoArray=pActUndoArray->pFatherUndoArray; + + // If no undo action where added, delete the undo list action + SfxUndoAction *pTmpAction= pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1]; + if(!pTmp->nCurUndoAction) + { + pActUndoArray->aUndoActions.Remove( --pActUndoArray->nCurUndoAction); + delete pTmpAction; + } + else + { + // if the undo array has no comment, try to get it from its children + SfxListUndoAction* pList = dynamic_cast< SfxListUndoAction * >( pTmpAction ); + if( pList && pList->GetComment().Len() == 0 ) + { + USHORT n; + for( n = 0; n < pList->aUndoActions.Count(); n++ ) + { + if( pList->aUndoActions[n]->GetComment().Len() ) + { + pList->SetComment( pList->aUndoActions[n]->GetComment() ); + break; + } + } + } + } +} + +//------------------------------------------------------------------------ + +USHORT SfxListUndoAction::GetId() const +{ + return nId; +} + +//------------------------------------------------------------------------ + +XubString SfxListUndoAction::GetComment() const +{ + return aComment; +} + +//------------------------------------------------------------------------ + +void SfxListUndoAction::SetComment( const UniString& rComment ) +{ + aComment = rComment; +} + +//------------------------------------------------------------------------ + +XubString SfxListUndoAction::GetRepeatComment(SfxRepeatTarget &) const +{ + return aRepeatComment; +} + + +//------------------------------------------------------------------------ + +SfxListUndoAction::SfxListUndoAction +( + const XubString &rComment, + const XubString rRepeatComment, + USHORT Id, + SfxUndoArray *pFather +) +: nId(Id), aComment(rComment), aRepeatComment(rRepeatComment) +{ + pFatherUndoArray = pFather; + nMaxUndoActions = USHRT_MAX; +} + +//------------------------------------------------------------------------ + +void SfxListUndoAction::Undo() +{ + for(INT16 i=nCurUndoAction-1;i>=0;i--) + aUndoActions[i]->Undo(); + nCurUndoAction=0; +} + +//------------------------------------------------------------------------ + +void SfxListUndoAction::Redo() +{ + for(USHORT i=nCurUndoAction;iRedo(); + nCurUndoAction = aUndoActions.Count(); +} + +//------------------------------------------------------------------------ + +void SfxListUndoAction::Repeat(SfxRepeatTarget&rTarget) +{ + for(USHORT i=0;iRepeat(rTarget); +} + +//------------------------------------------------------------------------ + +BOOL SfxListUndoAction::CanRepeat(SfxRepeatTarget&r) const +{ + for(USHORT i=0;iCanRepeat(r)) + return FALSE; + return TRUE; +} + +//------------------------------------------------------------------------ + +BOOL SfxListUndoAction::Merge( SfxUndoAction *pNextAction ) +{ + return aUndoActions.Count() && aUndoActions[aUndoActions.Count()-1]->Merge( pNextAction ); +} + +//------------------------------------------------------------------------ + +SfxLinkUndoAction::SfxLinkUndoAction(SfxUndoManager *pManager) +/* [Beschreibung] + + Richtet eine LinkAction ein, die auf einen weiteren UndoManager zeigt. + Holt sich als zugehoerige Action des weiteren UndoManagers dessen + aktuelle Action. +*/ + +{ + pUndoManager = pManager; + if ( pManager->GetMaxUndoActionCount() ) + { + USHORT nPos = pManager->GetUndoActionCount()-1; + pAction = pManager->pActUndoArray->aUndoActions[nPos]; + pAction->SetLinked(); + } + else + pAction = 0; +} + +//------------------------------------------------------------------------ + +void SfxLinkUndoAction::Undo() +{ + if ( pAction ) + pUndoManager->Undo(1); +} + +//------------------------------------------------------------------------ + +void SfxLinkUndoAction::Redo() +{ + if ( pAction ) + pUndoManager->Redo(1); +} + +//------------------------------------------------------------------------ + + +BOOL SfxLinkUndoAction::CanRepeat(SfxRepeatTarget& r) const +{ + return pAction && pUndoManager->CanRepeat(r,*pAction); +} + + +//------------------------------------------------------------------------ + + +void SfxLinkUndoAction::Repeat(SfxRepeatTarget&r) +{ + if ( pAction ) + pUndoManager->Repeat(r,*pAction); +} + + +//------------------------------------------------------------------------ + +XubString SfxLinkUndoAction::GetComment() const +{ + if ( pAction ) + return pAction->GetComment(); + else + return XubString(); +} + + +//------------------------------------------------------------------------ + +XubString SfxLinkUndoAction::GetRepeatComment(SfxRepeatTarget&r) const +{ + if ( pAction ) + return pAction->GetRepeatComment(r); + else + return XubString(); +} + +//------------------------------------------------------------------------ + +SfxLinkUndoAction::~SfxLinkUndoAction() +{ + if( pAction ) + pAction->SetLinked( FALSE ); +} + + +//------------------------------------------------------------------------ + +SfxUndoArray::~SfxUndoArray() +{ + while ( aUndoActions.Count() ) + { + SfxUndoAction *pAction = + aUndoActions[ aUndoActions.Count() - 1 ]; + aUndoActions.Remove( aUndoActions.Count() - 1 ); + delete pAction; + } +} + + +USHORT SfxLinkUndoAction::GetId() const +{ + return pAction ? pAction->GetId() : 0; +} + + + diff --git a/svl/source/uno/makefile.mk b/svl/source/uno/makefile.mk new file mode 100644 index 000000000000..51e55a1f9123 --- /dev/null +++ b/svl/source/uno/makefile.mk @@ -0,0 +1,64 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.21 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=svtools +TARGET=unoiface +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/svt.pmk + +# --- Files -------------------------------------------------------- + +SRS1NAME= uno +SRC1FILES= unoifac2.src + +SLOFILES= \ + $(SLO)$/unoiface.obj \ + $(SLO)$/unoevent.obj \ + $(SLO)$/unoimap.obj \ + $(SLO)$/toolboxcontroller.obj \ + $(SLO)$/framestatuslistener.obj \ + $(SLO)$/statusbarcontroller.obj \ + $(SLO)$/genericunodialog.obj \ + $(SLO)$/generictoolboxcontroller.obj \ + $(SLO)$/treecontrolpeer.obj \ + $(SLO)$/unocontroltablemodel.obj \ + $(SLO)$/registerservices.obj\ + $(SLO)$/contextmenuhelper.obj + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/svl/source/uno/registerservices.cxx b/svl/source/uno/registerservices.cxx new file mode 100644 index 000000000000..a3e9f39c2dba --- /dev/null +++ b/svl/source/uno/registerservices.cxx @@ -0,0 +1,135 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: registerservices.cxx,v $ + * $Revision: 1.21 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include "sal/types.h" +#include "rtl/ustring.hxx" +#include +#include +#include +#include + +namespace css = com::sun::star; +using css::uno::Reference; +using css::uno::Sequence; +using rtl::OUString; + +// ------------------------------------------------------------------------------------- + +#define DECLARE_CREATEINSTANCE( ImplName ) \ + Reference< css::uno::XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< css::lang::XMultiServiceFactory >& ); + +DECLARE_CREATEINSTANCE( SvNumberFormatterServiceObj ) +DECLARE_CREATEINSTANCE( SvNumberFormatsSupplierServiceObject ) + +// ------------------------------------------------------------------------------------- + +extern "C" +{ + +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( + const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( + void * /* _pServiceManager */, void * _pRegistryKey) +{ + if (_pRegistryKey) + { + Reference< css::registry::XRegistryKey > xRegistryKey ( + reinterpret_cast< css::registry::XRegistryKey* >(_pRegistryKey)); + Reference< css::registry::XRegistryKey > xNewKey; + + xNewKey = xRegistryKey->createKey ( + OUString::createFromAscii( + "/com.sun.star.uno.util.numbers.SvNumberFormatsSupplierServiceObject/UNO/SERVICES" ) ); + xNewKey->createKey ( + OUString::createFromAscii( "com.sun.star.util.NumberFormatsSupplier" ) ); + + xNewKey = xRegistryKey->createKey ( + OUString::createFromAscii( + "/com.sun.star.uno.util.numbers.SvNumberFormatterServiceObject/UNO/SERVICES" ) ); + xNewKey->createKey ( + OUString::createFromAscii( "com.sun.star.util.NumberFormatter" ) ); + + return sal_True; + } + return sal_False; +} + +SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory ( + const sal_Char * pImplementationName, void * _pServiceManager, void * /* _pRegistryKey*/) +{ + void * pResult = 0; + if ( _pServiceManager ) + { + Reference< css::lang::XSingleServiceFactory > xFactory; + if (rtl_str_compare( + pImplementationName, + "com.sun.star.uno.util.numbers.SvNumberFormatsSupplierServiceObject") == 0) + { + Sequence< OUString > aServiceNames(1); + aServiceNames.getArray()[0] = + OUString::createFromAscii( "com.sun.star.util.NumberFormatsSupplier" ); + + xFactory = ::cppu::createSingleFactory( + reinterpret_cast< css::lang::XMultiServiceFactory* >(_pServiceManager), + OUString::createFromAscii( pImplementationName ), + SvNumberFormatsSupplierServiceObject_CreateInstance, + aServiceNames); + } + else if (rtl_str_compare( + pImplementationName, + "com.sun.star.uno.util.numbers.SvNumberFormatterServiceObject") == 0) + { + Sequence< OUString > aServiceNames(1); + aServiceNames.getArray()[0] = + OUString::createFromAscii( "com.sun.star.util.NumberFormatter" ); + + xFactory = ::cppu::createSingleFactory( + reinterpret_cast< css::lang::XMultiServiceFactory* >(_pServiceManager), + OUString::createFromAscii( pImplementationName ), + SvNumberFormatterServiceObj_CreateInstance, + aServiceNames); + } + if ( xFactory.is() ) + { + xFactory->acquire(); + pResult = xFactory.get(); + } + } + return pResult; +} + +} // "C" + diff --git a/svl/uno/addrtempuno.cxx b/svl/uno/addrtempuno.cxx new file mode 100644 index 000000000000..b2aff7ae711d --- /dev/null +++ b/svl/uno/addrtempuno.cxx @@ -0,0 +1,248 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: addrtempuno.cxx,v $ + * $Revision: 1.8 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include "svtools/genericunodialog.hxx" +#ifndef _SVT_DOC_ADDRESSTEMPLATE_HXX_ +#include "addresstemplate.hxx" +#endif +#ifndef _CPPUHELPER_EXTRACT_HXX_ +#include +#endif +#include +#include +#include + +class SfxItemSet; +class SfxItemPool; +class SfxPoolItem; + +// ....................................................................... +namespace svt +{ +// ....................................................................... + +#define UNODIALOG_PROPERTY_ID_ALIASES 100 +#define UNODIALOG_PROPERTY_ALIASES "FieldMapping" + + using namespace com::sun::star::uno; + using namespace com::sun::star::lang; + using namespace com::sun::star::util; + using namespace com::sun::star::beans; + using namespace com::sun::star::sdbc; + + //========================================================================= + //= OAddressBookSourceDialogUno + //========================================================================= + typedef OGenericUnoDialog OAddressBookSourceDialogUnoBase; + class OAddressBookSourceDialogUno + :public OAddressBookSourceDialogUnoBase + ,public ::comphelper::OPropertyArrayUsageHelper< OAddressBookSourceDialogUno > + { + protected: + Sequence< AliasProgrammaticPair > m_aAliases; + Reference< XDataSource > m_xDataSource; + ::rtl::OUString m_sDataSourceName; + ::rtl::OUString m_sTable; + + protected: + OAddressBookSourceDialogUno(const Reference< XMultiServiceFactory >& _rxORB); + + public: + // XTypeProvider + virtual Sequence SAL_CALL getImplementationId( ) throw(RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(RuntimeException); + virtual ::comphelper::StringSequence SAL_CALL getSupportedServiceNames() throw(RuntimeException); + + // XServiceInfo - static methods + static Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( RuntimeException ); + static ::rtl::OUString getImplementationName_Static(void) throw( RuntimeException ); + static Reference< XInterface > + SAL_CALL Create(const Reference< com::sun::star::lang::XMultiServiceFactory >&); + + // XPropertySet + virtual Reference< XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(RuntimeException); + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + + protected: + // OGenericUnoDialog overridables + virtual Dialog* createDialog(Window* _pParent); + + virtual void implInitialize(const com::sun::star::uno::Any& _rValue); + + virtual void executedDialog(sal_Int16 _nExecutionResult); + }; + + + //========================================================================= + //= OAddressBookSourceDialogUno + //========================================================================= + Reference< XInterface > SAL_CALL OAddressBookSourceDialogUno_CreateInstance( const Reference< XMultiServiceFactory >& _rxFactory) + { + return OAddressBookSourceDialogUno::Create(_rxFactory); + } + + //------------------------------------------------------------------------- + OAddressBookSourceDialogUno::OAddressBookSourceDialogUno(const Reference< XMultiServiceFactory >& _rxORB) + :OGenericUnoDialog(_rxORB) + { + registerProperty(::rtl::OUString::createFromAscii(UNODIALOG_PROPERTY_ALIASES), UNODIALOG_PROPERTY_ID_ALIASES, PropertyAttribute::READONLY, + &m_aAliases, getCppuType(&m_aAliases)); + } + + //------------------------------------------------------------------------- + Sequence SAL_CALL OAddressBookSourceDialogUno::getImplementationId( ) throw(RuntimeException) + { + static ::cppu::OImplementationId aId; + return aId.getImplementationId(); + } + + //------------------------------------------------------------------------- + Reference< XInterface > SAL_CALL OAddressBookSourceDialogUno::Create(const Reference< XMultiServiceFactory >& _rxFactory) + { + return *(new OAddressBookSourceDialogUno(_rxFactory)); + } + + //------------------------------------------------------------------------- + ::rtl::OUString SAL_CALL OAddressBookSourceDialogUno::getImplementationName() throw(RuntimeException) + { + return getImplementationName_Static(); + } + + //------------------------------------------------------------------------- + ::rtl::OUString OAddressBookSourceDialogUno::getImplementationName_Static() throw(RuntimeException) + { + return ::rtl::OUString::createFromAscii("com.sun.star.comp.svtools.OAddressBookSourceDialogUno"); + } + + //------------------------------------------------------------------------- + ::comphelper::StringSequence SAL_CALL OAddressBookSourceDialogUno::getSupportedServiceNames() throw(RuntimeException) + { + return getSupportedServiceNames_Static(); + } + + //------------------------------------------------------------------------- + ::comphelper::StringSequence OAddressBookSourceDialogUno::getSupportedServiceNames_Static() throw(RuntimeException) + { + ::comphelper::StringSequence aSupported(1); + aSupported.getArray()[0] = ::rtl::OUString::createFromAscii("com.sun.star.ui.AddressBookSourceDialog"); + return aSupported; + } + + //------------------------------------------------------------------------- + Reference SAL_CALL OAddressBookSourceDialogUno::getPropertySetInfo() throw(RuntimeException) + { + Reference xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; + } + + //------------------------------------------------------------------------- + ::cppu::IPropertyArrayHelper& OAddressBookSourceDialogUno::getInfoHelper() + { + return *const_cast(this)->getArrayHelper(); + } + + //------------------------------------------------------------------------------ + ::cppu::IPropertyArrayHelper* OAddressBookSourceDialogUno::createArrayHelper( ) const + { + Sequence< Property > aProps; + describeProperties(aProps); + return new ::cppu::OPropertyArrayHelper(aProps); + } + + //------------------------------------------------------------------------------ + void OAddressBookSourceDialogUno::executedDialog(sal_Int16 _nExecutionResult) + { + OAddressBookSourceDialogUnoBase::executedDialog(_nExecutionResult); + + if ( _nExecutionResult ) + if ( m_pDialog ) + static_cast< AddressBookSourceDialog* >( m_pDialog )->getFieldMapping( m_aAliases ); + } + + //------------------------------------------------------------------------------ + void OAddressBookSourceDialogUno::implInitialize(const com::sun::star::uno::Any& _rValue) + { + PropertyValue aVal; + if (_rValue >>= aVal) + { + if (0 == aVal.Name.compareToAscii("DataSource")) + { +#if OSL_DEBUG_LEVEL > 0 + sal_Bool bSuccess = +#endif + aVal.Value >>= m_xDataSource; + OSL_ENSURE( bSuccess, "OAddressBookSourceDialogUno::implInitialize: invalid type for DataSource!" ); + return; + } + + if (0 == aVal.Name.compareToAscii("DataSourceName")) + { +#if OSL_DEBUG_LEVEL > 0 + sal_Bool bSuccess = +#endif + aVal.Value >>= m_sDataSourceName; + OSL_ENSURE( bSuccess, "OAddressBookSourceDialogUno::implInitialize: invalid type for DataSourceName!" ); + return; + } + + if (0 == aVal.Name.compareToAscii("Command")) + { +#if OSL_DEBUG_LEVEL > 0 + sal_Bool bSuccess = +#endif + aVal.Value >>= m_sTable; + OSL_ENSURE( bSuccess, "OAddressBookSourceDialogUno::implInitialize: invalid type for Command!" ); + return; + } + } + + OAddressBookSourceDialogUnoBase::implInitialize( _rValue ); + } + + //------------------------------------------------------------------------------ + Dialog* OAddressBookSourceDialogUno::createDialog(Window* _pParent) + { + if ( m_xDataSource.is() && m_sTable.getLength() ) + return new AddressBookSourceDialog(_pParent, m_aContext.getLegacyServiceFactory(), m_xDataSource, m_sDataSourceName, m_sTable, m_aAliases ); + else + return new AddressBookSourceDialog( _pParent, m_aContext.getLegacyServiceFactory() ); + } + +// ....................................................................... +} // namespace svt +// ....................................................................... + diff --git a/svl/uno/exports.map b/svl/uno/exports.map new file mode 100644 index 000000000000..f4ed78b9e970 --- /dev/null +++ b/svl/uno/exports.map @@ -0,0 +1,8 @@ +UDK_3_0_0 { + global: + component_getImplementationEnvironment; + component_writeInfo; + component_getFactory; + local: + *; +}; diff --git a/svl/uno/makefile.mk b/svl/uno/makefile.mk new file mode 100644 index 000000000000..8f61c7100508 --- /dev/null +++ b/svl/uno/makefile.mk @@ -0,0 +1,81 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.4 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=.. +PRJNAME=svtools +TARGET=svtmisc.uno +LIBTARGET=NO +ENABLE_EXCEPTIONS=TRUE +VISIBILITY_HIDDEN=TRUE + +# --- Settings ---------------------------------- + +.INCLUDE : settings.mk +DLLPRE= + +# --- Files ------------------------------------- + +SLOFILES= \ + $(SLO)$/addrtempuno.obj \ + $(SLO)$/miscservices.obj \ + $(SLO)$/pathservice.obj + +SHL1TARGET= $(TARGET) +SHL1IMPLIB= i$(TARGET) + +SHL1OBJS= \ + $(SLO)$/svtdata.obj \ + $(SLOFILES) + +SHL1LIBS= \ + $(SLB)$/filter.uno.lib + +SHL1STDLIBS=\ + $(SVTOOLLIB) \ + $(TKLIB) \ + $(VCLLIB) \ + $(SVLLIB) \ + $(UNOTOOLSLIB) \ + $(TOOLSLIB) \ + $(COMPHELPERLIB) \ + $(VOSLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(SALLIB) + +SHL1VERSIONMAP=exports.map +SHL1DEF= $(MISC)$/$(SHL1TARGET).def +DEF1NAME= $(SHL1TARGET) + +# --- Targets ---------------------------------- + +.INCLUDE : target.mk + diff --git a/svl/uno/miscservices.cxx b/svl/uno/miscservices.cxx new file mode 100644 index 000000000000..e5c5aac3c35d --- /dev/null +++ b/svl/uno/miscservices.cxx @@ -0,0 +1,160 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: miscservices.cxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include "sal/types.h" +#include "rtl/ustring.hxx" +#include +#include +#include +#include +#include + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::registry; +using namespace ::com::sun::star::lang; + +using rtl::OUString; + +// ------------------------------------------------------------------------------------- + +// for CreateInstance functions implemented elsewhere +#define DECLARE_CREATEINSTANCE( ImplName ) \ + Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& ); + +// for CreateInstance functions implemented elsewhere, while the function is within a namespace +#define DECLARE_CREATEINSTANCE_NAMESPACE( nmspe, ImplName ) \ + namespace nmspe { \ + Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& ); \ + } + +// ------------------------------------------------------------------------------------- + +DECLARE_CREATEINSTANCE_NAMESPACE( svt, OAddressBookSourceDialogUno ) +DECLARE_CREATEINSTANCE( SvFilterOptionsDialog ) +DECLARE_CREATEINSTANCE( PathService ) + +// ------------------------------------------------------------------------------------- + +extern "C" +{ + +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( + const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( + void * /* _pServiceManager */, void * _pRegistryKey ) +{ + if (_pRegistryKey) + { + Reference< XRegistryKey > xRegistryKey ( + reinterpret_cast< XRegistryKey* >( _pRegistryKey )); + Reference< XRegistryKey > xNewKey; + + xNewKey = xRegistryKey->createKey ( + OUString::createFromAscii( "/com.sun.star.comp.svtools.OAddressBookSourceDialogUno/UNO/SERVICES" ) ); + xNewKey->createKey( + OUString::createFromAscii( "com.sun.star.ui.AddressBookSourceDialog" ) ); + + xNewKey = xRegistryKey->createKey ( + OUString::createFromAscii( "/com.sun.star.svtools.SvFilterOptionsDialog/UNO/SERVICES" ) ); + xNewKey->createKey ( + OUString::createFromAscii( "com.sun.star.ui.dialogs.FilterOptionsDialog" ) ); + + xNewKey = xRegistryKey->createKey( + OUString::createFromAscii( "/com.sun.star.comp.svtools.PathService/UNO/SERVICES" ) ); + xNewKey->createKey ( + OUString::createFromAscii( "com.sun.star.config.SpecialConfigManager" ) ); + + return sal_True; + } + return sal_False; +} + +SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( + const sal_Char * pImplementationName, void * _pServiceManager, void * /* _pRegistryKey */) +{ + void * pResult = 0; + if ( _pServiceManager ) + { + Reference< XSingleServiceFactory > xFactory; + if (rtl_str_compare ( + pImplementationName, "com.sun.star.comp.svtools.OAddressBookSourceDialogUno") == 0) + { + Sequence< OUString > aServiceNames(1); + aServiceNames.getArray()[0] = + OUString::createFromAscii( "com.sun.star.ui.AddressBookSourceDialog" ); + + xFactory = ::cppu::createSingleFactory ( + reinterpret_cast< XMultiServiceFactory* >( _pServiceManager ), + OUString::createFromAscii( pImplementationName ), + svt::OAddressBookSourceDialogUno_CreateInstance, + aServiceNames); + } + else if (rtl_str_compare ( + pImplementationName, "com.sun.star.svtools.SvFilterOptionsDialog") == 0) + { + Sequence< OUString > aServiceNames(1); + aServiceNames.getArray()[0] = + OUString::createFromAscii( "com.sun.star.ui.dialogs.FilterOptionsDialog" ); + + xFactory = ::cppu::createSingleFactory ( + reinterpret_cast< XMultiServiceFactory* >( _pServiceManager ), + OUString::createFromAscii( pImplementationName ), + SvFilterOptionsDialog_CreateInstance, + aServiceNames); + } + else if (rtl_str_compare ( + pImplementationName, "com.sun.star.comp.svtools.PathService") == 0) + { + Sequence< OUString > aServiceNames(1); + aServiceNames.getArray()[0] = + OUString::createFromAscii( "com.sun.star.config.SpecialConfigManager" ); + xFactory = ::cppu::createSingleFactory ( + reinterpret_cast< XMultiServiceFactory* >( _pServiceManager ), + OUString::createFromAscii( pImplementationName ), + PathService_CreateInstance, + aServiceNames); + } + if ( xFactory.is() ) + { + xFactory->acquire(); + pResult = xFactory.get(); + } + } + return pResult; +} + +} // "C" + diff --git a/svl/uno/pathservice.cxx b/svl/uno/pathservice.cxx new file mode 100644 index 000000000000..152ff5f316ab --- /dev/null +++ b/svl/uno/pathservice.cxx @@ -0,0 +1,106 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: pathservice.cxx,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include +#include "sal/types.h" +#include "rtl/ustring.hxx" +#include +#include +#include + +namespace css = com::sun::star; +using rtl::OUString; + +// ----------------------------------------------------------------------- + +class PathService : public ::cppu::WeakImplHelper2< css::frame::XConfigManager, css::lang::XServiceInfo > +{ + SvtPathOptions m_aOptions; + +public: + PathService() + {} + + virtual OUString SAL_CALL getImplementationName() + throw(css::uno::RuntimeException) + { + return OUString::createFromAscii("com.sun.star.comp.svtools.PathService"); + } + + virtual sal_Bool SAL_CALL supportsService ( + const OUString & rName) + throw(css::uno::RuntimeException) + { + return (rName.compareToAscii("com.sun.star.config.SpecialConfigManager") == 0); + } + + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() + throw(css::uno::RuntimeException) + { + css::uno::Sequence< OUString > aRet(1); + aRet.getArray()[0] = OUString::createFromAscii("com.sun.star.config.SpecialConfigManager"); + return aRet; + } + + virtual OUString SAL_CALL substituteVariables ( + const OUString& sText) + throw(css::uno::RuntimeException) + { + return m_aOptions.SubstituteVariable( sText ); + } + + virtual void SAL_CALL addPropertyChangeListener ( + const OUString &, const css::uno::Reference< css::beans::XPropertyChangeListener > &) + throw(css::uno::RuntimeException) + {} + + virtual void SAL_CALL removePropertyChangeListener ( + const OUString &, const css::uno::Reference< css::beans::XPropertyChangeListener > &) + throw(css::uno::RuntimeException) + {} + + virtual void SAL_CALL flush() + throw(css::uno::RuntimeException) + {} +}; + +// ----------------------------------------------------------------------- + +css::uno::Reference< css::uno::XInterface > PathService_CreateInstance ( + const css::uno::Reference< css::lang::XMultiServiceFactory > &) +{ + return css::uno::Reference< css::uno::XInterface >( + static_cast< cppu::OWeakObject* >(new PathService())); +} + +// ----------------------------------------------------------------------- diff --git a/svl/unx/inc/convert.hxx b/svl/unx/inc/convert.hxx new file mode 100644 index 000000000000..e91ee4ed2791 --- /dev/null +++ b/svl/unx/inc/convert.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: convert.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONVERT_HXX +#define _CONVERT_HXX + +/* +#define _SWAPSHORT(x) ((((x) & 0xFF00)>>8) | (((x) & 0x00FF)<<8)) +#define _SWAPLONG(x) ((((x) & 0xFF000000)>>24) | (((x) & 0x00FF0000)>>8) | \ + (((x) & 0x0000FF00)<<8) | (((x) & 0x000000FF)<<24)) +*/ +class Convert +{ +public: + static void Swap( long & nValue ) + { nValue = SWAPLONG( nValue ); } + static void Swap( ULONG & nValue ) + { nValue = SWAPLONG( nValue ); } + static void Swap( short & nValue ) + { nValue = SWAPSHORT( nValue ); } + static void Swap( USHORT & nValue ) + { nValue = SWAPSHORT( nValue ); } + static void Swap( Point & aPtr ) + { Swap( aPtr.X() ); Swap( aPtr.Y() ); } + static void Swap( Size & aSize ) + { Swap( aSize.Width() ); Swap( aSize.Height() ); } + static void Swap( Rectangle & rRect ) + { Swap( rRect.Top() ); Swap( rRect.Bottom() ); + Swap( rRect.Left() ); Swap( rRect.Right() ); } +/* + static USHORT AnsiFloatSize() const { return 6; } + static float AnsiToFloat( void * pAnsiFloat ) + { return 0; } + static USHORT AnsiDoubleSize() const { return 12; } + static double AnsiToDouble( void * pAnsiDouble ) + { return 0; } +*/ +}; + +#endif // _CONVERT_HXX diff --git a/svl/unx/source/svdde/ddedummy.cxx b/svl/unx/source/svdde/ddedummy.cxx new file mode 100644 index 000000000000..6f627807bfd3 --- /dev/null +++ b/svl/unx/source/svdde/ddedummy.cxx @@ -0,0 +1,341 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: ddedummy.cxx,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include +#include + +DdeData::DdeData() +{ +} + +DdeData::DdeData( const String& ) +{ +} + +DdeData::DdeData( const DdeData& ) +{ +} + +DdeData::DdeData( const void*, long, ULONG) +{ +} + +DdeData::~DdeData( void ) +{ +} + +void DdeData::SetFormat( ULONG ) +{ +} + +ULONG DdeData::GetFormat() const +{ + return 0L; +} + +DdeData& DdeData::operator = ( const DdeData& ) +{ + return *this; +} + +DdeData::operator long() const +{ + return 0L; +} + +DdeData::operator const void*() const +{ + return NULL; +} + +long DdeConnection::GetError() +{ + return 0L; +} + +DdeConnection::DdeConnection( const String&, const String& ) +{ +} + +DdeConnection::~DdeConnection( void ) +{ +} + +const String& DdeConnection::GetServiceName() +{ + return String::EmptyString(); +} + +const String& DdeConnection::GetTopicName() +{ + return String::EmptyString(); +} + +DdeTransaction::DdeTransaction( DdeConnection& rConnection, const String&, long ) : + rDde( rConnection ) +{ +} + +DdeTransaction::DdeTransaction( const DdeTransaction& rTransaction ) : + rDde( rTransaction.rDde ) +{ +} + +void DdeTransaction::Execute(void) +{ +} + +void DdeTransaction::Done( BOOL ) +{ +} + +void DdeTransaction::Data( const DdeData* ) +{ +} + +DdeTransaction::~DdeTransaction(void) +{ +} + +DdeRequest::DdeRequest(DdeConnection& rConnection, const String& rString, long lLong ) : + DdeTransaction( rConnection, rString, lLong ) +{ +} + +DdeExecute::DdeExecute( DdeConnection& rConnection, const String& rString, long lLong ) : + DdeTransaction( rConnection, rString, lLong ) +{ +} + +DdePoke::DdePoke( DdeConnection& rConnection, const String& rString, const DdeData&, long lLong ) : + DdeTransaction( rConnection, rString, lLong ) +{ +} + + +DdeTopic::DdeTopic( const String& ) +{ +} + +DdeTopic::~DdeTopic() +{ +} + +void DdeTopic::Connect (long ) +{ +} + +void DdeTopic::Disconnect( long ) +{ +} + +void DdeTopic::InsertItem( DdeItem* ) +{ +} + +DdeItem* DdeTopic::AddItem( const DdeItem& rDdeItem ) +{ + return (DdeItem*) &rDdeItem; +} + +void DdeTopic::RemoveItem( const DdeItem& ) +{ +} + +DdeData* DdeTopic::Get( ULONG ) +{ + return NULL; +} + +BOOL DdeTopic::MakeItem( const String& ) +{ + return FALSE; +} + +BOOL DdeTopic::StartAdviseLoop() +{ + return FALSE; +} + +BOOL DdeTopic::StopAdviseLoop() +{ + return FALSE; +} + +BOOL DdeTopic::Execute( const String* ) +{ + return FALSE; +} + +BOOL DdeTopic::Put( const DdeData* ) +{ + return FALSE; +} + +const String& DdeTopic::GetName() const +{ + return String::EmptyString(); +} + +DdeService::DdeService( const String& ) +{ + nStatus = 0; +} + +String DdeService::Topics() { + return String(); +} + +String DdeService::Formats() { + return String(); +} + +String DdeService::SysItems() { + return String(); +} + +String DdeService::Status() { + return String(); +} + +String DdeService::SysTopicGet(const String& rString) { + return rString; +} + +BOOL DdeService::SysTopicExecute(const String*) { + return FALSE; +} + +DdeService::~DdeService() +{ +} + +BOOL DdeService::IsBusy() +{ + return FALSE; +} + +String DdeService::GetHelp() +{ + return String::EmptyString(); +} + +void DdeService::AddFormat( ULONG ) +{ +} + +void DdeService::AddTopic( const DdeTopic& ) +{ +} + +void DdeService::RemoveTopic( const DdeTopic& ) +{ +} + +BOOL DdeService::MakeTopic( const String& ) +{ + return FALSE; +} + +const String& DdeService::GetName() const +{ + return String::EmptyString(); +} + +namespace +{ + struct theDdeServices + : public rtl::Static< DdeServices, theDdeServices > {}; +} + +DdeServices& DdeService::GetServices() +{ + return theDdeServices::get(); +} + +DdeItem::DdeItem( const String& ) +{ +} + +DdeItem::DdeItem( const DdeItem& ) +{ +} + +DdeItem::~DdeItem() +{ +} + +void DdeItem::NotifyClient() +{ +} + +DdeGetPutItem::DdeGetPutItem( const String& rStr ) : +DdeItem( rStr ) +{ +} + +DdeGetPutItem::DdeGetPutItem( const DdeItem& rItem ) : +DdeItem( rItem ) +{ +} + +DdeData* DdeGetPutItem::Get( ULONG ) +{ + return NULL; +} + +BOOL DdeGetPutItem::Put( const DdeData* ) +{ + return FALSE; +} + +void DdeGetPutItem::AdviseLoop( BOOL ) +{ +} + +DdeLink::DdeLink( DdeConnection& rConnection, const String& rString, long l ) : +DdeTransaction( rConnection, rString, l ) +{ +} + +DdeLink::~DdeLink() +{ +} + +void DdeLink::Notify() +{ +} + +DdeHotLink::DdeHotLink( DdeConnection& rConnection, const String& rString, long l ) : +DdeLink( rConnection, rString, l ) +{ +} diff --git a/svl/unx/source/svdde/makefile.mk b/svl/unx/source/svdde/makefile.mk new file mode 100644 index 000000000000..d0203fd6378b --- /dev/null +++ b/svl/unx/source/svdde/makefile.mk @@ -0,0 +1,50 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.7 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=svtools +TARGET=svdde + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/svt.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/ddedummy.obj + +# --- Tagets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/svl/util/makefile.mk b/svl/util/makefile.mk new file mode 100644 index 000000000000..fac8f654bfbe --- /dev/null +++ b/svl/util/makefile.mk @@ -0,0 +1,274 @@ +#************************************************************************* +#* +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.67 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=.. + +PRJNAME=svtools +TARGET=svtool +RESTARGET=svt +RESTARGETPATCH=svp +RESTARGETSIMPLE=svs +GEN_HID=TRUE +GEN_HID_OTHER=TRUE +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +USE_LDUMP2=TRUE + +# --- general section ---------------------------------------------------- + +.IF "$(GUI)"!="UNX" +LIB3TARGET= $(LB)$/svtool.lib +LIB3FILES= $(LB)$/_svt.lib +.ENDIF + +.IF "$(GUI)"!="UNX" +LIB4TARGET= $(LB)$/isvl.lib +LIB4FILES= $(LB)$/_isvl.lib +.ENDIF + +LIB7TARGET= $(SLB)$/svt.lib +LIB7FILES= \ + $(SLB)$/misc.lib \ + $(SLB)$/items.lib \ + $(SLB)$/browse.lib \ + $(SLB)$/ctrl.lib \ + $(SLB)$/dialogs.lib \ + $(SLB)$/edit.lib \ + $(SLB)$/unoiface.lib \ + $(SLB)$/filter.lib \ + $(SLB)$/igif.lib \ + $(SLB)$/jpeg.lib \ + $(SLB)$/ixpm.lib \ + $(SLB)$/ixbm.lib \ + $(SLB)$/numbers.lib \ + $(SLB)$/numbers.uno.lib \ + $(SLB)$/wmf.lib \ + $(SLB)$/undo.lib \ + $(SLB)$/urlobj.lib \ + $(SLB)$/plugapp.lib \ + $(SLB)$/svcontnr.lib \ + $(SLB)$/syslocale.lib \ + $(SLB)$/svdde.lib \ + $(SLB)$/svhtml.lib \ + $(SLB)$/svrtf.lib \ + $(SLB)$/config.lib \ + $(SLB)$/table.lib \ + $(SLB)$/java.lib + +LIB8TARGET= $(SLB)$/svl.lib +LIB8FILES= \ + $(SLB)$/filerec.lib \ + $(SLB)$/filepicker.lib \ + $(SLB)$/items1.lib \ + $(SLB)$/misc1.lib \ + $(SLB)$/notify.lib \ + $(SLB)$/svarray.lib \ + $(SLB)$/svsql.lib + +# generation of resourcen-lib ---------------------------------------- + +RESLIB1NAME= $(RESTARGET) +RESLIB1IMAGES=$(PRJ)$/res +RESLIB1SRSFILES= \ + $(SRS)$/filter.srs \ + $(SRS)$/misc.srs \ + $(SRS)$/ctrl.srs \ + $(SRS)$/dialogs.srs \ + $(SRS)$/plugapp.srs \ + $(SRS)$/svcontnr.srs \ + $(SRS)$/uno.srs \ + $(SRS)$/browse.srs \ + $(SRS)$/javaerror.srs + +RESLIB2NAME= $(RESTARGETSIMPLE) +RESLIB2SRSFILES=\ + $(SRS)$/items1.srs \ + $(SRS)$/misc1.srs + + +RESLIB3NAME= $(RESTARGETPATCH) +RESLIB3SRSFILES= \ + $(SRS)$/patchjavaerror.srs + +# build the shared library -------------------------------------------------- + +SHL1TARGET= svt$(DLLPOSTFIX) +SHL1IMPLIB= _svt +SHL1USE_EXPORTS=name + +.IF "$(OS)"!="MACOSX" +# static libraries +SHL1STDLIBS+= $(JPEG3RDLIB) +.ENDIF + +# dynamic libraries +SHL1STDLIBS+= \ + $(TKLIB) \ + $(VCLLIB) \ + $(SVLLIB) \ + $(SOTLIB) \ + $(UNOTOOLSLIB) \ + $(TOOLSLIB) \ + $(I18NISOLANGLIB) \ + $(I18NUTILLIB) \ + $(UCBHELPERLIB) \ + $(COMPHELPERLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(VOSLIB) \ + $(SALLIB) \ + $(ICUUCLIB) \ + $(JVMFWKLIB) + +.IF "$(OS)"=="MACOSX" +# static libraries go at end +SHL1STDLIBS+= $(JPEG3RDLIB) +.ENDIF + +.IF "$(GUI)"=="WNT" +SHL1STDLIBS+= \ + $(UWINAPILIB) \ + $(ADVAPI32LIB) \ + $(GDI32LIB) \ + $(OLE32LIB) \ + $(UUIDLIB) \ + $(ADVAPI32LIB) \ + $(OLEAUT32LIB) +.ENDIF # WNT + +SHL1OBJS= \ + $(SLO)$/svtdata.obj + +SHL1LIBS= \ + $(SLB)$/svt.lib + +SHL1DEF= $(MISC)$/$(SHL1TARGET).def +SHL1DEPN=$(SHL2TARGETN) + +DEF1NAME= $(SHL1TARGET) +DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt +DEFLIB1NAME =svt +DEF1DES =SvTools + + +# --- svtools lite -------------------------------------------------- + +SHL2TARGET= svl$(DLLPOSTFIX) +SHL2IMPLIB= _isvl +SHL2USE_EXPORTS=name +#Do not link with VCL or any other library that links with VCL +SHL2STDLIBS= \ + $(UNOTOOLSLIB) \ + $(TOOLSLIB) \ + $(I18NISOLANGLIB) \ + $(UCBHELPERLIB) \ + $(COMPHELPERLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(VOSLIB) \ + $(VCLLIB) \ + $(SALLIB) + +.IF "$(GUI)"=="WNT" +SHL2STDLIBS+= \ + $(UWINAPILIB) \ + $(ADVAPI32LIB) \ + $(GDI32LIB) +.ENDIF # WNT + +SHL2LIBS= $(SLB)$/svl.lib + +SHL2DEF= $(MISC)$/$(SHL2TARGET).def + +DEF2NAME= $(SHL2TARGET) +DEF2DEPN= $(MISC)$/$(SHL2TARGET).flt $(SLB)$/svl.lib +DEFLIB2NAME=svl +DEF2DES =SvTools lite + +# --- g2g application -------------------------------------------------- + +APP2TARGET = g2g +APP2BASE = 0x10000000 +APP2DEPN = $(SHL1TARGETN) $(SHL2TARGETN) + +APP2OBJS = $(OBJ)$/g2g.obj + +.IF "$(GUI)"!="UNX" +APP2STDLIBS+= $(SVTOOLLIB) +.ELSE +APP2STDLIBS+= -lsvt$(DLLPOSTFIX) +APP2STDLIBS+= -lsvl$(DLLPOSTFIX) +.ENDIF + +APP2STDLIBS+= $(VCLLIB) \ + $(TOOLSLIB) \ + $(VOSLIB) \ + $(SALLIB) + +# --- Targets ------------------------------------------------------ + +.IF "$(GUI)"=="UNX" +SVTTARGETS= $(LB)$/lib$(SHL2TARGET)$(DLLPOST) $(LB)$/lib$(SHL1TARGET)$(DLLPOST) +.ELSE +SVTTARGETS= $(LB)$/isvl.lib \ + $(BIN)$/$(SHL2TARGET)$(DLLPOST) $(BIN)$/$(SHL1TARGET)$(DLLPOST) +.ENDIF + +# just a quick fix - has to be cleaned up some day... +.IF "$(L10N-framework)"=="" +ALL: $(SLB)$/svl.lib \ + $(SLB)$/svt.lib \ + $(MISC)$/$(SHL2TARGET).flt \ + $(MISC)$/$(SHL1TARGET).flt \ + $(MISC)$/$(SHL2TARGET).def \ + $(MISC)$/$(SHL1TARGET).def \ + $(SVTTARGETS) \ + ALLTAR +.ENDIF # "$(L10N-framework)"=="" + +.INCLUDE : target.mk + +# --- Svtools-Control-Filter-Datei --- + +$(MISC)$/$(SHL1TARGET).flt: svt.flt + @echo ------------------------------ + @echo Making: $@ + $(TYPE) svt.flt >$@ + +$(MISC)$/$(SHL2TARGET).flt: svl.flt + @echo ------------------------------ + @echo Making: $@ + $(TYPE) svl.flt >$@ + diff --git a/svl/util/svl.pmk b/svl/util/svl.pmk new file mode 100644 index 000000000000..aec76257e743 --- /dev/null +++ b/svl/util/svl.pmk @@ -0,0 +1,35 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: svl.pmk,v $ +# +# $Revision: 1.4 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +# define SVL_DLLIMPLEMENTATION (see @ svldllapi.h) +CDEFS += -DSVL_DLLIMPLEMENTATION + +VISIBILITY_HIDDEN=TRUE diff --git a/svtools/inc/PasswordHelper.hxx b/svtools/inc/PasswordHelper.hxx deleted file mode 100644 index 7139a3ebe361..000000000000 --- a/svtools/inc/PasswordHelper.hxx +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: PasswordHelper.hxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVTOOLS_PASSWORDHELPER_HXX -#define _SVTOOLS_PASSWORDHELPER_HXX - -#include "svtools/svldllapi.h" -#include "sal/types.h" -#include "com/sun/star/uno/Sequence.hxx" - -class String; - -class SvPasswordHelper -{ - static void GetHashPassword(com::sun::star::uno::Sequence & rPassHash, const sal_Char* pPass, sal_uInt32 nLen); - static void GetHashPasswordLittleEndian(com::sun::star::uno::Sequence& rPassHash, const String& sPass); - static void GetHashPasswordBigEndian(com::sun::star::uno::Sequence& rPassHash, const String& sPass); - -public: - SVL_DLLPUBLIC static void GetHashPassword(com::sun::star::uno::Sequence& rPassHash, const String& sPass); - /** - Use this method to compare a given string with another given Hash value. - This is necessary, because in older versions exists different hashs of the same string. They were endian dependent. - We need this to handle old files. This method will compare against big and little endian. See #101326# - */ - SVL_DLLPUBLIC static bool CompareHashPassword(const com::sun::star::uno::Sequence& rOldPassHash, const String& sNewPass); -}; - -#endif - diff --git a/svtools/inc/adrparse.hxx b/svtools/inc/adrparse.hxx deleted file mode 100644 index 439168441057..000000000000 --- a/svtools/inc/adrparse.hxx +++ /dev/null @@ -1,110 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: adrparse.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _ADRPARSE_HXX -#define _ADRPARSE_HXX - -#include "svtools/svldllapi.h" -#include -#include - -//============================================================================ -struct SvAddressEntry_Impl -{ - UniString m_aAddrSpec; - UniString m_aRealName; - - SvAddressEntry_Impl() {}; - SvAddressEntry_Impl(UniString const & rTheAddrSpec, - UniString const & rTheRealName): - m_aAddrSpec(rTheAddrSpec), m_aRealName(rTheRealName) {} -}; - -//============================================================================ -DECLARE_LIST(SvAddressList_Impl, SvAddressEntry_Impl *) - -//============================================================================ -class SVL_DLLPUBLIC SvAddressParser -{ - friend class SvAddressParser_Impl; - - SvAddressEntry_Impl m_aFirst; - SvAddressList_Impl m_aRest; - bool m_bHasFirst; - -public: - SvAddressParser(UniString const & rInput); - - ~SvAddressParser(); - - sal_Int32 Count() const { return m_bHasFirst ? m_aRest.Count() + 1 : 0; } - - inline UniString const & GetEmailAddress(sal_Int32 nIndex) const; - - inline UniString const &GetRealName(sal_Int32 nIndex) const; - - /** Create an RFC 822 (i.e., 'e-mail address'). - - @param rPhrase Either an empty string (the will have no - an will be of the form ), or some text that will - become the part of a form . Non - US-ASCII characters within the text are put into a - verbatim, so the result may actually not be a valid RFC 822 , - but a more human-readable representation. - - @param rAddrSpec A valid RFC 822 . (An RFC 822 - including a cannot be created by this method.) - - @param rMailbox If this method returns true, this parameter returns - the created RFC 822 (rather, a more human-readable - representation thereof). Otherwise, this parameter is not modified. - - @return True, if rAddrSpec is a valid RFC 822 . - */ - static bool createRFC822Mailbox(String const & rPhrase, - String const & rAddrSpec, - String & rMailbox); -}; - -inline UniString const & SvAddressParser::GetEmailAddress(sal_Int32 nIndex) - const -{ - return nIndex == 0 ? m_aFirst.m_aAddrSpec : - m_aRest.GetObject(nIndex - 1)->m_aAddrSpec; -} - -inline UniString const & SvAddressParser::GetRealName(sal_Int32 nIndex) const -{ - return nIndex == 0 ? m_aFirst.m_aRealName : - m_aRest.GetObject(nIndex - 1)->m_aRealName; -} - -#endif // _ADRPARSE_HXX - diff --git a/svtools/inc/broadcast.hxx b/svtools/inc/broadcast.hxx deleted file mode 100644 index e3e409c46e96..000000000000 --- a/svtools/inc/broadcast.hxx +++ /dev/null @@ -1,70 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: broadcast.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVT_BROADCAST_HXX -#define _SVT_BROADCAST_HXX - -#include "svtools/svldllapi.h" -#include - -class SvtListener; -class SfxHint; -class SvtListenerBase; - -//------------------------------------------------------------------------- - -class SVL_DLLPUBLIC SvtBroadcaster -{ -friend class SvtListener; -friend class SvtListenerBase; -friend class SvtListenerIter; - SvtListenerBase* pRoot; - - const SvtBroadcaster& operator=(const SvtBroadcaster &); // verboten - -protected: - void Forward( SvtBroadcaster& rBC, - const SfxHint& rHint ); - virtual void ListenersGone(); - -public: - TYPEINFO(); - - SvtBroadcaster(); - SvtBroadcaster( const SvtBroadcaster &rBC ); - virtual ~SvtBroadcaster(); - - void Broadcast( const SfxHint &rHint ); - - BOOL HasListeners() const { return 0 != pRoot; } -}; - - -#endif - diff --git a/svtools/inc/cntnrsrt.hxx b/svtools/inc/cntnrsrt.hxx deleted file mode 100644 index 13553f7f16fd..000000000000 --- a/svtools/inc/cntnrsrt.hxx +++ /dev/null @@ -1,177 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: cntnrsrt.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _CNTRSRT_HXX -#define _CNTRSRT_HXX - -#if 0 -*********************************************************************** -* -* Hier folgt die Beschreibung fuer die exportierten Makros: -* -* DECLARE_CONTAINER_SORT( ClassName, Type ) -* IMPL_CONTAINER_SORT( ClassName, Type, SortFunc ) -* -* Definiert eine von Container abgeleitete Klasse "ClassName", -* in der die Elemente des Typs "Type" sortiert enthalten sind. -* Dazu muss einer Funktion "SortFunc" definiert sein, die als -* Paramter zwei "const Type&" erwartet und 0 zurueckgibt, wenn -* beide gleich sind, -1 wenn der erste Paramter kleiner ist als -* der zweite und +1 wenn der erste Paramter groesser ist als -* der zweite. -* -* Die Zugriffs-Methoden entsprechen in etwa denen der Container- -* Klasse, mit Ausnahme von Insert, DeleteAndDestroy und Seek_Entry, -* der den SV-Pointer-Arrays entsprechen. -* -* DECLARE_CONTAINER_SORT_DEL( ClassName, Type ) -* IMPL_CONTAINER_SORT( ClassName, Type, SortFunc ) -* -* Wie DECLARE_CONTAINER_SORT, nur dass beim Aufruf des Destruktors -* alle im Conatiner vorhandenen Objekte geloescht werden. -* -#endif - -#include - -#define DECLARE_CONTAINER_SORT_COMMON( ClassName, Type ) \ - ClassName( const ClassName& ); \ - ClassName& operator =( const ClassName& ); \ -public: \ - using Container::Count; \ - \ - ClassName( USHORT InitSize, USHORT ReSize ) : \ - Container( CONTAINER_MAXBLOCKSIZE, InitSize, ReSize ) {} \ - \ - BOOL Insert( Type* pObj ); \ - \ - Type *Remove( ULONG nPos ) \ - { return (Type *)Container::Remove( nPos ); } \ - \ - Type *Remove( Type* pObj ); \ - \ - void DeleteAndDestroy( ULONG nPos ) \ - { \ - Type *pObj = Remove( nPos ); \ - if( pObj ) \ - delete pObj; \ - } \ - \ - void DeleteAndDestroy() \ - { while( Count() ) DeleteAndDestroy( 0 ); } \ - \ - Type* GetObject( ULONG nPos ) const \ - { return (Type *)Container::GetObject( nPos ); } \ - \ - Type* operator[]( ULONG nPos ) const \ - { return GetObject(nPos); } \ - \ - BOOL Seek_Entry( const Type *pObj, ULONG* pPos ) const; \ - \ - ULONG GetPos( const Type* pObj ) const; \ - - -#define DECLARE_CONTAINER_SORT( ClassName, Type ) \ -class ClassName : private Container \ -{ \ - DECLARE_CONTAINER_SORT_COMMON( ClassName, Type ) \ - ~ClassName() {} \ -}; \ - - -#define DECLARE_CONTAINER_SORT_DEL( ClassName, Type ) \ -class ClassName : private Container \ -{ \ - DECLARE_CONTAINER_SORT_COMMON( ClassName, Type ) \ - ~ClassName() { DeleteAndDestroy(); } \ -}; \ - - -#define IMPL_CONTAINER_SORT( ClassName, Type, SortFunc ) \ -BOOL ClassName::Insert( Type *pObj ) \ -{ \ - ULONG nPos; \ - BOOL bExist = Seek_Entry( pObj, &nPos ); \ - if( !bExist ) \ - Container::Insert( pObj, nPos ); \ - return !bExist; \ -} \ - \ -Type *ClassName::Remove( Type* pObj ) \ -{ \ - ULONG nPos; \ - if( Seek_Entry( pObj, &nPos ) ) \ - return Remove( nPos ); \ - else \ - return 0; \ -} \ - \ -ULONG ClassName::GetPos( const Type* pObj ) const \ -{ \ - ULONG nPos; \ - if( Seek_Entry( pObj, &nPos ) ) \ - return nPos; \ - else \ - return CONTAINER_ENTRY_NOTFOUND; \ -} \ - \ -BOOL ClassName::Seek_Entry( const Type* pObj, ULONG* pPos ) const \ -{ \ - register ULONG nO = Count(), \ - nM, \ - nU = 0; \ - if( nO > 0 ) \ - { \ - nO--; \ - while( nU <= nO ) \ - { \ - nM = nU + ( nO - nU ) / 2; \ - int nCmp = SortFunc( *GetObject(nM), *pObj ); \ - \ - if( 0 == nCmp ) \ - { \ - if( pPos ) *pPos = nM; \ - return TRUE; \ - } \ - else if( nCmp < 0 ) \ - nU = nM + 1; \ - else if( nM == 0 ) \ - { \ - if( pPos ) *pPos = nU; \ - return FALSE; \ - } \ - else \ - nO = nM - 1; \ - } \ - } \ - if( pPos ) *pPos = nU; \ - return FALSE; \ -} \ - -#endif diff --git a/svtools/inc/cntwids.hrc b/svtools/inc/cntwids.hrc deleted file mode 100644 index fcb9f855453b..000000000000 --- a/svtools/inc/cntwids.hrc +++ /dev/null @@ -1,509 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: cntwids.hrc,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _CNTWIDS_HRC -#define _CNTWIDS_HRC - -#ifndef OLD_CHAOS -#define TF_NEW_TABPAGES -#define CNT_COOL_ABO -#endif - -//========================================================================= -// ARGS, MSG, ALL, FOLDER, BOXALL, BOXEXT -//========================================================================= - -#define WID_CHAOS_START 500 - -//FUNC MSG -#define WID_MARK_THREAD_MARKED (499) -#define WID_MARK_THREAD_UNMARKED (498) - -// ARGS -#define WID_DUMMY_ARG1 (WID_CHAOS_START + 0) -#define WID_FACTORY_NO (WID_CHAOS_START + 1) -#define WID_FACTORY_NAME (WID_CHAOS_START + 2) -#define WID_NEWS_XREF (WID_CHAOS_START + 3) -#define WID_CREATION_FLAGS (WID_CHAOS_START + 4) -#define WID_FACTORY_HELP_ID (WID_CHAOS_START + 5) - -//FUNC MSG -#define WID_MSG_START (WID_CHAOS_START + 6) -#define WID_MAIL_REPLY (WID_CHAOS_START + 6) -#define WID_POST_REPLY (WID_CHAOS_START + 7) -#define WID_FORWARD (WID_CHAOS_START + 8) -#define WID_MARK_THREAD_READ (WID_CHAOS_START + 9) -#define WID_HIDE_THREAD (WID_CHAOS_START + 10) -#define WID_HIDE_AUTHOR (WID_CHAOS_START + 11) -#define WID_HIDE_SUBJECT (WID_CHAOS_START + 12) -#define WID_RESEND_MSG (WID_CHAOS_START + 13) -#define WID_MARK_THREAD_UNREAD (WID_CHAOS_START + 14) - -//PROP MSG -#define WID_PRIORITY (WID_CHAOS_START + 15) -#define WID_RULE_APPLIED (WID_CHAOS_START + 16) -#define WID_MSG_LOCK (WID_CHAOS_START + 17) -#define WID_SEEN_STATUS (WID_CHAOS_START + 18) -#define WID_REPLY_TO (WID_CHAOS_START + 19) -#define WID_IN_REPLY_TO (WID_CHAOS_START + 20) - -#define WID_MESSAGE_ID (WID_CHAOS_START + 21) -#define WID_BCC (WID_CHAOS_START + 22) -#define WID_CC (WID_CHAOS_START + 23) -#define WID_TO (WID_CHAOS_START + 24) -#define WID_FROM (WID_CHAOS_START + 25) -#define WID_TITLE (WID_CHAOS_START + 26) -#define WID_SUBJECT WID_TITLE // only here to prevent panic, should be removed -#define WID_MESSAGEBODY (WID_CHAOS_START + 27) - -#define WID_REFERENCES (WID_CHAOS_START + 28) -#define WID_NEWSGROUPS (WID_CHAOS_START + 29) -#define WID_NEWS_XREFLIST (WID_CHAOS_START + 30) - -#define WID_OUTMSGINTERNALSTATE (WID_CHAOS_START + 31) -#define WID_RECIPIENTLIST (WID_CHAOS_START + 32) -#define WID_MSG_END (WID_CHAOS_START + 32) - -//FUNC ALL -#define WID_ALL_START (WID_CHAOS_START + 33) -#define WID_DEFAULT (WID_CHAOS_START + 33) -#define WID_OPEN (WID_CHAOS_START + 34) -#define WID_DELETE (WID_CHAOS_START + 35) -#define WID_CUT (WID_CHAOS_START + 36) -#define WID_COPY (WID_CHAOS_START + 37) -#define WID_PASTE (WID_CHAOS_START + 38) -#define WID_RENAME (WID_CHAOS_START + 39) - -#define WID_HAS_DATA (WID_CHAOS_START + 40) -#define WID_GETDATA (WID_CHAOS_START + 41) -#define WID_PUTDATA (WID_CHAOS_START + 42) - -//PROP ALL -#define WID_INTERIM_URL (WID_CHAOS_START + 43) -#define WID_CONTENT_TYPE (WID_CHAOS_START + 44) - -#define WID_OWN_URL (WID_CHAOS_START + 45) -#define WID_REAL_URL (WID_CHAOS_START + 46) -#define WID_OBSOLETE_TITLE (WID_CHAOS_START + 47) -#define WID_FLAG_READONLY (WID_CHAOS_START + 48) - -#define WID_REFERED_URL (WID_CHAOS_START + 49) -#define WID_REFERER_COUNT (WID_CHAOS_START + 50) -#define WID_FLAG_IS_FOLDER (WID_CHAOS_START + 51) -#define WID_FLAG_HAS_FOLDER (WID_CHAOS_START + 52) -#define WID_FLAG_IS_MESSAGE (WID_CHAOS_START + 53) -#define WID_FLAG_IS_DOCUMENT (WID_FLAG_IS_MESSAGE) -#define WID_FLAG_HAS_MESSAGES (WID_CHAOS_START + 54) - -#define WID_DATE_CREATED (WID_CHAOS_START + 55) -#define WID_DATE_MODIFIED (WID_CHAOS_START + 56) -#define WID_VIEW_DESCRIPTION (WID_CHAOS_START + 57) -#define WID_IS_READ (WID_CHAOS_START + 58) -#define WID_IS_MARKED (WID_CHAOS_START + 59) -#define WID_ALL_END (WID_CHAOS_START + 59) - -//FUNC FOLDER -#define WID_FOLDER_START (WID_CHAOS_START + 60) -#define WID_SYNCHRONIZE (WID_CHAOS_START + 60) -#define WID_CREATE_NEW (WID_CHAOS_START + 61) -#define WID_INSERT (WID_CHAOS_START + 62) -#define WID_UPDATE (WID_CHAOS_START + 63) -#define WID_IMPORT (WID_CHAOS_START + 64) - -//PROP FOLDER VIEW -#define WID_DUMMY_PROPFOLDERVIEW1 (WID_CHAOS_START + 65) -#define WID_THREADING (WID_CHAOS_START + 66) -#define WID_MSG_COLUMN_INFO /* obsolete */ (WID_CHAOS_START + 67) -#define WID_FLD_COLUMN_INFO /* obsolete */ (WID_CHAOS_START + 68) -#define WID_FOLDERVIEW_MODE (WID_CHAOS_START + 69) -#define WID_MESSAGEVIEW_MODE (WID_CHAOS_START + 70) -#define WID_SENTMESSAGEVIEW_MODE (WID_CHAOS_START + 71) -#define WID_SORTING (WID_CHAOS_START + 72) -#define WID_THREADED (WID_CHAOS_START + 73) -#define WID_FILTERED (WID_CHAOS_START + 74) -#define WID_RULES (WID_CHAOS_START + 75) -#define WID_SUBSCRNEWSGROUPCOUNT (WID_CHAOS_START + 76) -#define WID_FLAG_SUBSCRIBED (WID_CHAOS_START + 77) -#define WID_FLAG_SUPPORTMODE (WID_CHAOS_START + 78) - -//PROP FOLDER DIR -#define WID_DUMMY_FOLDERDIR1 (WID_CHAOS_START + 79) -#define WID_TOTALCONTENTCOUNT (WID_CHAOS_START + 80) -#define WID_NEWSGROUPCOUNT /* ??? */ (WID_CHAOS_START + 81) -#define WID_ARTICLECOUNT /* ??? */ (WID_CHAOS_START + 82) -#define WID_KNOWN_RANGES (WID_CHAOS_START + 83) -#define WID_IMAPFOLDERINFO (WID_CHAOS_START + 84) - -//PROP FOLDER USER -#define WID_DUMMY_FOLDERUSER1 (WID_CHAOS_START + 85) -#define WID_SEENCONTENTCOUNT (WID_CHAOS_START + 86) -#define WID_UNREAD_ARTICLECOUNT (WID_SEENCONTENTCOUNT) -#define WID_SENTCONTENTCOUNT (WID_SEENCONTENTCOUNT) -#define WID_READ_RANGES (WID_CHAOS_START + 87) -#define WID_MARK_RANGES (WID_CHAOS_START + 88) -#define WID_FOLDER_END (WID_CHAOS_START + 88) - -//PROP BOXALL -#define WID_BOXALL_START (WID_CHAOS_START + 89) -// Used for d&d of View Storages... -#define WID_PREPARE_MOVE (WID_CHAOS_START + 89) -#define WID_OUTTRAY_WANTED (WID_CHAOS_START + 90) -#define WID_USERNAME (WID_CHAOS_START + 91) -#define WID_PASSWORD (WID_CHAOS_START + 92) -#define WID_SERVERNAME (WID_CHAOS_START + 93) -#define WID_SERVERPORT (WID_CHAOS_START + 94) -// obsolete -#define WID_MAILSEND_USERNAME (WID_CHAOS_START + 95) -#define WID_MAILSEND_PASSWORD (WID_CHAOS_START + 96) -#define WID_MAILSEND_SERVERNAME (WID_CHAOS_START + 97) -#define WID_NEWSSEND_USERNAME (WID_CHAOS_START + 98) -#define WID_NEWSSEND_PASSWORD (WID_CHAOS_START + 99) -#define WID_NEWSSEND_SERVERNAME (WID_CHAOS_START + 100) -// end obsolete -#define WID_SERVERBASE (WID_CHAOS_START + 101) -// not used -#define WID_SMTP_GATEWAY (WID_CHAOS_START + 102) - -// -> ..._DEFAULT -// obsolete -#define WID_FROM_DEFAULT (WID_CHAOS_START + 103) -// obsolete -#define WID_REPLY_TO_DEFAULT (WID_CHAOS_START + 104) - -#define WID_AUTOUPDATE_INTERVAL (WID_CHAOS_START + 105) -#define WID_UPDATE_ENABLED (WID_CHAOS_START + 106) -#define WID_BOXALL_END (WID_CHAOS_START + 106) - -//PROP BOX RNMGR -#define WID_BOXEXT_START (WID_CHAOS_START + 107) -#define WID_CONNECTION_MODE (WID_CHAOS_START + 107) -#define WID_NEWS_GROUPLIST (WID_CHAOS_START + 108) -#ifdef OLD_CHAOS -#define WID_BOX_CONNECTION_PROP (WID_CHAOS_START + 109) -#else -#define WID_MESSAGE_STOREMODE (WID_CHAOS_START + 109) -#endif -#define WID_DELETE_ON_SERVER (WID_CHAOS_START + 110) - -//PROP BOX USER - -//PROP BOX OUT DIR -#define WID_OUTMSGEXTERNALSTATE (WID_CHAOS_START + 111) - -//PROP RNM -#define WID_RNM_UPDATETIMER_LIST (WID_CHAOS_START + 112) -#define WID_BOXEXT_END (WID_CHAOS_START + 112) - -////////////////////////////////////////////////////////////////////////// -// MISC - Added after initial pool version -////////////////////////////////////////////////////////////////////////// - -// PROP BOX -#define WID_SERVER_RANGES (WID_CHAOS_START + 113) -#define WID_LAST_UPDATE (WID_CHAOS_START + 114) -#define WID_LAST_MSGID (WID_CHAOS_START + 115) -#define WID_LAST_UID (WID_CHAOS_START + 116) - -// FUNC ALL -#define WID_UNDELETE (WID_CHAOS_START + 117) -#define WID_CLOSE (WID_CHAOS_START + 118) -#define WID_REOPEN (WID_CHAOS_START + 119) - -// PROP RNM -#define WID_RNM_FILECONVERSION_LIST (WID_CHAOS_START + 120) - -// PROP FOLDER -#define WID_SHOW_MSGS_HAS_TIMELIMIT (WID_CHAOS_START + 121) -#define WID_SHOW_MSGS_TIMELIMIT (WID_CHAOS_START + 122) -#define WID_STORE_MSGS_HAS_TIMELIMIT (WID_CHAOS_START + 123) -#define WID_STORE_MSGS_TIMELIMIT (WID_CHAOS_START + 124) - -// PROP BOX -#define WID_MSG_COLUMN_WIDTHS /* obsolete */(WID_CHAOS_START + 125) - -#ifdef OLD_CHAOS - -#define WID_CHAOS_END (WID_CHAOS_START + 125) - -#else - -////////////////////////////////////////////////////////////////////////// -// WID's added after SO 4.0 release ( SUPD > 364 ) -////////////////////////////////////////////////////////////////////////// - -// PROP ALL -#define WID_PROPERTYLIST (WID_CHAOS_START + 126) - -// PROP BOXALL -#define WID_BOXALL_START2 (WID_CHAOS_START + 127) -#define WID_SEND_PUBLIC_PROT_ID (WID_CHAOS_START + 127) -#define WID_SEND_PRIVATE_PROT_ID (WID_CHAOS_START + 128) -#define WID_SEND_PUBLIC_OUTBOXPROPS (WID_CHAOS_START + 129) -#define WID_SEND_PRIVATE_OUTBOXPROPS (WID_CHAOS_START + 130) -#define WID_SEND_SERVERNAME (WID_CHAOS_START + 131) -#define WID_SEND_USERNAME (WID_CHAOS_START + 132) -#define WID_SEND_PASSWORD (WID_CHAOS_START + 133) -#define WID_SEND_REPLY_TO_DEFAULT (WID_CHAOS_START + 134) -#define WID_SEND_FROM_DEFAULT (WID_CHAOS_START + 135) -#define WID_VIM_POPATH (WID_CHAOS_START + 136) -#define WID_SEND_VIM_POPATH (WID_CHAOS_START + 137) -#define WID_PURGE (WID_CHAOS_START + 138) -#define WID_CLEAN_CACHE (WID_CHAOS_START + 139) -#define WID_SEARCH (WID_CHAOS_START + 140) -#define WID_JOURNAL (WID_CHAOS_START + 141) -#define WID_LOCALBASE (WID_CHAOS_START + 142) -#define WID_BOXALL_END2 (WID_CHAOS_START + 142) - -// PROP DOCUMENT -#define WID_DOCUMENT_HEADER (WID_CHAOS_START + 143) -#define WID_DOCUMENT_BODY (WID_CHAOS_START + 144) -#define WID_DOCUMENT_SIZE (WID_CHAOS_START + 145) - -// PROP ALL -#define WID_SIZE WID_DOCUMENT_SIZE - -// PROP PROJECT -#define WID_PRJ_MEDIUM (WID_CHAOS_START + 146) -#define WID_PRJ_FILENAMECONVENTION (WID_CHAOS_START + 147) - -// PROP FSYS -#define WID_FSYS_DISKSPACE_LEFT (WID_CHAOS_START + 148) -#define WID_TRANSFER (WID_CHAOS_START + 149) - -// PROP ALL -#define WID_KEYWORDS (WID_CHAOS_START + 150) -#define WID_IS_PROTECTED (WID_CHAOS_START + 151) - -// PROP SEARCH -#define WID_SEARCH_CRITERIA (WID_CHAOS_START + 152) -#define WID_SEARCH_LOCATIONS (WID_CHAOS_START + 153) -#define WID_SEARCH_RECURSIVE (WID_CHAOS_START + 154) -#define WID_SEARCH_FOLDER_VIEW (WID_CHAOS_START + 155) -#define WID_SEARCH_DOCUMENT_VIEW (WID_CHAOS_START + 156) - -// PROP Channel -#define WID_SCHEDULE_RANGE (WID_CHAOS_START + 157) -#define WID_ALLOWED_SCHEDULE_RANGE (WID_CHAOS_START + 158) -#define WID_TARGET_URL (WID_CHAOS_START + 159) -#define WID_FREQUENCY (WID_CHAOS_START + 160) - -// PROP HTTP -#define WID_HTTP_CONNECTION_LIMIT (WID_CHAOS_START + 161) -#define WID_HTTP_COOKIE_MANAGER (WID_CHAOS_START + 162) - -// PROP Channel -#define WID_COLUMN_NEXT_UPD (WID_CHAOS_START + 163) -#define WID_CRAWL_STATUS (WID_CHAOS_START + 164) -#define WID_CRAWL_LEVEL (WID_CHAOS_START + 165) -#define WID_CRAWL_MODE (WID_CHAOS_START + 166) -// WID_CRAWL_MAX_VOLUME shall be removed in the future! -// --> WID_SIZE_LIMIT -#define WID_CRAWL_MAX_VOLUME (WID_CHAOS_START + 167) -#define WID_CRAWL_IMAGE (WID_CHAOS_START + 168) -#define WID_CRAWL_LINK_OUT (WID_CHAOS_START + 169) -#define WID_NOTIFICATION_MODE (WID_CHAOS_START + 170) -#define WID_NOTIFICATION_ADDRESS (WID_CHAOS_START + 171) - -// PROP BOXALL -#define WID_ACCOUNT (WID_CHAOS_START + 172) - -// PROP FSYS -#define WID_FSYS_KIND (WID_CHAOS_START + 173) -#define WID_FSYS_FLAGS (WID_CHAOS_START + 174) - -// PROP FOLDER -#define WID_VIEWDATA /* obsolete */ (WID_CHAOS_START + 175) - -// PROP FSYS -#define WID_WHO_IS_MASTER (WID_CHAOS_START + 176) - -// FUNC HTTP -#define WID_HTTP_POST (WID_CHAOS_START + 177) - -// PROP ALL -#define WID_SUPPORTED_FUNCS (WID_CHAOS_START + 178) -#define WID_SIZE_LIMIT (WID_CHAOS_START + 179) - -// PROP FOLDER -#define WID_MARKED_DOCUMENT_COUNT (WID_CHAOS_START + 180) -#define WID_FOLDER_COUNT (WID_CHAOS_START + 181) - -// PROP FSYS -#define WID_FSYS_SHOW_HIDDEN (WID_CHAOS_START + 182) - -// TRASHCAN -#define WID_TRASHCAN_START (WID_CHAOS_START + 183) -#define WID_TRASHCAN_EMPTY_TRASH (WID_CHAOS_START + 183) -#define WID_TRASHCAN_FLAG_AUTODELETE (WID_CHAOS_START + 184) -#define WID_TRASHCAN_FLAG_CONFIRMEMPTY (WID_CHAOS_START + 185) -#define WID_TRASHCAN_DUMMY1 (WID_CHAOS_START + 186) -#define WID_TRASHCAN_DUMMY2 (WID_CHAOS_START + 187) -#define WID_TRASHCAN_END (WID_CHAOS_START + 187) - -// TRASH -#define WID_TRASH_START (WID_CHAOS_START + 188) -#define WID_TRASH_RESTORE (WID_CHAOS_START + 188) -#define WID_TRASH_ORIGIN (WID_CHAOS_START + 189) -#define WID_TRASH_DUMMY2 (WID_CHAOS_START + 190) -#define WID_TRASH_END (WID_CHAOS_START + 190) - -// PROP ALL -#define WID_TARGET_FRAMES (WID_CHAOS_START + 191) - -// FUNC FOLDER -#define WID_EXPORT (WID_CHAOS_START + 192) - -// COMPONENT -#define WID_COMPONENT_COMMAND (WID_CHAOS_START + 193) -#define WID_COMPONENT_MENU (WID_CHAOS_START + 194) - -// PROP Channel -#define WID_HREF (WID_CHAOS_START + 195) - -// PROP FOLDER (VIEW) -#define WID_VIEW_START (WID_CHAOS_START + 196) -#define WID_VIEW_COLS_BEAMER (WID_CHAOS_START + 196) -#define WID_VIEW_COLS_FILEDLG (WID_CHAOS_START + 197) -#define WID_VIEW_COLS_FLDWIN (WID_CHAOS_START + 198) -#define WID_VIEW_MODE_FLDWIN (WID_CHAOS_START + 199) -#define WID_VIEW_LAYOUT_FLDWIN (WID_CHAOS_START + 200) -#define WID_VIEW_ICON_POS_FLDWIN (WID_CHAOS_START + 201) -#define WID_VIEW_SORT_BEAMER (WID_CHAOS_START + 202) -#define WID_VIEW_SORT_FILEDLG (WID_CHAOS_START + 203) -#define WID_VIEW_SORT_FLDWIN_DETAILS (WID_CHAOS_START + 204) -#define WID_VIEW_SORT_FLDWIN_ICON (WID_CHAOS_START + 205) -#define WID_VIEW_WINDOW_POS_FLDWIN (WID_CHAOS_START + 206) -#define WID_VIEW_END (WID_CHAOS_START + 206) - -// PROP ALL -#define WID_IS_INVALID (WID_CHAOS_START + 207) - -// PROP Channel -#define WID_VIEW_TIPHELP (WID_CHAOS_START + 208) -#define WID_PUBLISHER_SCHEDULE (WID_CHAOS_START + 209) -#define WID_GETMODE (WID_CHAOS_START + 210) -#define WID_READ_OFFLINE (WID_CHAOS_START + 211) - -// PROP ALL -#define WID_ALL_START2 (WID_CHAOS_START + 212) -#define WID_REAL_NAME (WID_CHAOS_START + 212) -#define WID_FLAG_UPDATE_ON_OPEN (WID_CHAOS_START + 213) -#define WID_ACTION_LIST (WID_CHAOS_START + 214) -#define WID_EDIT_STRING (WID_CHAOS_START + 215) -#define WID_SET_AS_DEFAULT (WID_CHAOS_START + 216) -#define WID_ALL_END2 (WID_CHAOS_START + 216) - -// PROP FOLDER (VIEW) -#define WID_VIEW2_START (WID_CHAOS_START + 217) -#define WID_VIEW2_FLD_PIC (WID_CHAOS_START + 217) -#define WID_FLAG_EXPANDED (WID_CHAOS_START + 218) -#define WID_CHILD_DEFAULTS (WID_CHAOS_START + 219) -#define WID_VIEW2_END (WID_CHAOS_START + 219) - -// PROP HTTP -#define WID_HTTP_KEEP_EXPIRED (WID_CHAOS_START + 220) -#define WID_HTTP_VERIFY_MODE (WID_CHAOS_START + 221) -#define WID_HTTP_NOCACHE_LIST (WID_CHAOS_START + 222) -#define WID_HTTP_REFERER (WID_CHAOS_START + 223) - -// PROP FSYS -#define WID_FSYS_START (WID_CHAOS_START + 224) -#define WID_FSYS_VALUE_FOLDER (WID_CHAOS_START + 224) -#define WID_FSYS_SHOW_EXTENSION (WID_CHAOS_START + 225) -#define WID_VALUE_ADDED_MODE (WID_CHAOS_START + 226) -#define WID_FSYS_DUMMY3 (WID_CHAOS_START + 227) -#define WID_FSYS_DUMMY4 (WID_CHAOS_START + 228) -#define WID_FSYS_END (WID_CHAOS_START + 228) - -// FUNC HTTP -#define WID_HTTP_GET_COOKIE (WID_CHAOS_START + 229) -#define WID_HTTP_SET_COOKIE (WID_CHAOS_START + 230) - -// PROP HTTP -#define WID_HTTP_COOKIE (WID_CHAOS_START + 231) -#define WID_HTTP_DUMMY_1 (WID_CHAOS_START + 232) - -////////////////////////////////////////////////////////////////////////// -// WID's added after SO 5.0 release ( SUPD > 505 ) -////////////////////////////////////////////////////////////////////////// - -// PROP FOLDER -#define WID_FOLDER_START2 (WID_CHAOS_START + 233) -#define WID_USER_SORT_CRITERIUM (WID_CHAOS_START + 233) -#define WID_HEADER_CONFIG (WID_CHAOS_START + 234) -#define WID_GROUPVIEW_CONFIG (WID_CHAOS_START + 235) -#define WID_FLD_WEBVIEW_TEMPLATE (WID_CHAOS_START + 236) -// eigene Iconpositionen fuer den Explorer, da er noch -// keinen eigenen View-Storage hat -#define WID_VIEW_ICON_POS_GRPWIN (WID_CHAOS_START + 237) -#define WID_FOLDER_END2 (WID_CHAOS_START + 237) - -// PROP ALL -#define WID_SHOW_IN_EXPLORER (WID_CHAOS_START + 238) - -// PROP FOLDER (VIEW) -#define WID_VIEW3_START (WID_CHAOS_START + 239) -#define WID_FLD_FONT (WID_CHAOS_START + 239) -#define WID_FLD_WEBVIEW_USE_GLOBAL (WID_CHAOS_START + 240) -#define WID_VIEW3_DUMMY2 (WID_CHAOS_START + 241) -#define WID_VIEW3_DUMMY3 (WID_CHAOS_START + 242) -#define WID_VIEW3_END (WID_CHAOS_START + 242) - -// PROP FTP -#define WID_FTP_ACCOUNT (WID_CHAOS_START + 243) - -// PROP FOLDER -#define WID_STORE_MARKED (WID_CHAOS_START + 244) - -// REPLICATION ( Currently only here to have file compatibility between -// SO51 Client and SO51 Server, for which the functionality -// first shall be implemented ). -#define WID_REPLICATION_1 (WID_CHAOS_START + 245) -#define WID_REPLICATION_2 (WID_CHAOS_START + 246) -#define WID_REPLICATION_3 (WID_CHAOS_START + 247) -#define WID_REPLICATION_4 (WID_CHAOS_START + 248) -#define WID_REPLICATION_5 (WID_CHAOS_START + 249) - -// PROP SEARCH -#define WID_SEARCH_INDIRECTIONS (WID_CHAOS_START + 250) - -// PROP ALL -#define WID_SEND_FORMATS (WID_CHAOS_START + 251) -#define WID_SEND_COPY_TARGET (WID_CHAOS_START + 252) - -// FUNC ALL -#define WID_TRANSFER_RESULT (WID_CHAOS_START + 253) - -// END -#define WID_CHAOS_END (WID_CHAOS_START + 253) - -#endif /* OLD_CHAOS */ - -#endif /* !_CNTWIDS_HRC */ diff --git a/svtools/inc/filectrl.hrc b/svtools/inc/filectrl.hrc deleted file mode 100644 index 13fb89afd382..000000000000 --- a/svtools/inc/filectrl.hrc +++ /dev/null @@ -1,37 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: filectrl.hrc,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_FILECTRL_HRC -#define _SV_FILECTRL_HRC - -#define STR_FILECTRL_BUTTONTEXT 333 // ID-Range?! - -#endif - diff --git a/svtools/inc/filedlg2.hrc b/svtools/inc/filedlg2.hrc new file mode 100644 index 000000000000..a75e9047eafb --- /dev/null +++ b/svtools/inc/filedlg2.hrc @@ -0,0 +1,44 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: filedlg2.hrc,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define STR_FILEDLG_SELECT 1000 +#define STR_FILEDLG_CANTCHDIR 1001 +#define STR_FILEDLG_OPEN 1002 +#define STR_FILEDLG_FILE 1003 +#define STR_FILEDLG_DIR 1004 +#define STR_FILEDLG_TYPE 1005 +#define STR_FILEDLG_CANTOPENFILE 1006 +#define STR_FILEDLG_CANTOPENDIR 1007 +#define STR_FILEDLG_OVERWRITE 1008 +#define STR_FILEDLG_GOUP 1009 +#define STR_FILEDLG_SAVE 1010 +#define STR_FILEDLG_DRIVES 1011 +#define STR_FILEDLG_HOME 1012 +#define STR_FILEDLG_NEWDIR 1013 +#define STR_FILEDLG_ASKNEWDIR 1014 diff --git a/svtools/inc/filenotation.hxx b/svtools/inc/filenotation.hxx deleted file mode 100644 index 460d425d471a..000000000000 --- a/svtools/inc/filenotation.hxx +++ /dev/null @@ -1,74 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: filenotation.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SVTOOLS_FILENOTATION_HXX -#define SVTOOLS_FILENOTATION_HXX - -#include "svtools/svldllapi.h" -#include - -//......................................................................... -namespace svt -{ -//......................................................................... - - //===================================================================== - //= OFileNotation - //===================================================================== - class SVL_DLLPUBLIC OFileNotation - { - protected: - ::rtl::OUString m_sSystem; - ::rtl::OUString m_sFileURL; - - public: - enum NOTATION - { - N_SYSTEM, - N_URL - }; - - OFileNotation( const ::rtl::OUString& _rUrlOrPath ); - OFileNotation( const ::rtl::OUString& _rUrlOrPath, NOTATION _eInputNotation ); - - ::rtl::OUString get(NOTATION _eOutputNotation); - - private: - SVL_DLLPRIVATE void construct( const ::rtl::OUString& _rUrlOrPath ); - SVL_DLLPRIVATE bool implInitWithSystemNotation( const ::rtl::OUString& _rSystemPath ); - SVL_DLLPRIVATE bool implInitWithURLNotation( const ::rtl::OUString& _rURL ); - }; - -//......................................................................... -} // namespace svt -//......................................................................... - -#endif // SVTOOLS_FILENOTATION_HXX - diff --git a/svtools/inc/flbytes.hxx b/svtools/inc/flbytes.hxx deleted file mode 100644 index 86c19191de2a..000000000000 --- a/svtools/inc/flbytes.hxx +++ /dev/null @@ -1,174 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: flbytes.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _FLBYTES_HXX -#define _FLBYTES_HXX - -#include -#include - -//============================================================================ -class SvFillLockBytes : public SvLockBytes -{ - SvLockBytesRef xLockBytes; - ULONG nFilledSize; - BOOL bTerminated; - BOOL bSync; -public: - TYPEINFO(); - - SvFillLockBytes( SvLockBytes* pLockBytes ); - virtual ErrCode ReadAt( - ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pRead ) const; - virtual ErrCode WriteAt( - ULONG nPos, const void* pBuffer, ULONG nCount, ULONG* pWritten ); - virtual ErrCode Flush() const; - virtual ErrCode SetSize( ULONG nSize ); - virtual ErrCode LockRegion( ULONG nPos, ULONG nCount, LockType ); - virtual ErrCode UnlockRegion( ULONG nPos, ULONG nCount, LockType ); - virtual ErrCode Stat( SvLockBytesStat*, SvLockBytesStatFlag ) const; - ErrCode FillAppend( const void* pBuffer, ULONG nCount, ULONG *pWritten ); - ULONG Tell() const { return nFilledSize; } - void Seek( ULONG nPos ) { nFilledSize = nPos; } - - void Terminate(); -}; - -SV_DECL_IMPL_REF( SvFillLockBytes ) - -//============================================================================ -class SvSyncLockBytes: public SvOpenLockBytes -{ - SvAsyncLockBytesRef m_xAsyncLockBytes; - -public: - TYPEINFO(); - - /// Create a synchronous wrapper around existing asynchronous lock bytes. - /// - /// @param pTheAsyncLockBytes Must not be null. - inline SvSyncLockBytes(SvAsyncLockBytes * pTheAsyncLockBytes); - - /// Create a synchronous wrapper around an existing stream. - /// - /// @descr This is like first creating asynchronous lock bytes around the - /// stream and than creating a synchronous wrapper around the asynchronous - /// lock bytes. - /// - /// @param pStream Must not be null. - /// - /// @param bOwner True if these lock bytes own the stream (delete it on - /// destruction). - SvSyncLockBytes(SvStream * pStream, BOOL bOwner): - m_xAsyncLockBytes(new SvAsyncLockBytes(pStream, bOwner)) {} - - virtual const SvStream * GetStream() const - { return m_xAsyncLockBytes->GetStream(); } - - virtual void SetSynchronMode(BOOL bSync = TRUE) - { m_xAsyncLockBytes->SetSynchronMode(bSync); } - - virtual BOOL IsSynchronMode() const - { return m_xAsyncLockBytes->IsSynchronMode(); } - - virtual ErrCode ReadAt(ULONG nPos, void * pBuffer, ULONG nCount, - ULONG * pRead) const; - - virtual ErrCode WriteAt(ULONG nPos, const void * pBuffer, ULONG nCount, - ULONG * pWritten); - - virtual ErrCode Flush() const { return m_xAsyncLockBytes->Flush(); } - - virtual ErrCode SetSize(ULONG nSize) - { return m_xAsyncLockBytes->SetSize(nSize); } - - virtual ErrCode LockRegion(ULONG nPos, ULONG nCount, LockType eType) - { return m_xAsyncLockBytes->LockRegion(nPos, nCount, eType); } - - virtual ErrCode UnlockRegion(ULONG nPos, ULONG nCount, LockType eType) - { return m_xAsyncLockBytes->UnlockRegion(nPos, nCount, eType); } - - virtual ErrCode Stat(SvLockBytesStat * pStat, SvLockBytesStatFlag eFlag) - const - { return m_xAsyncLockBytes->Stat(pStat, eFlag); } - - virtual ErrCode FillAppend(const void * pBuffer, ULONG nCount, - ULONG * pWritten) - { return m_xAsyncLockBytes->FillAppend(pBuffer, nCount, pWritten); } - - virtual ULONG Tell() const { return m_xAsyncLockBytes->Tell(); } - - virtual ULONG Seek(ULONG nPos) - { return m_xAsyncLockBytes->Seek(nPos); } - - virtual void Terminate() { m_xAsyncLockBytes->Terminate(); } -}; - -inline SvSyncLockBytes::SvSyncLockBytes(SvAsyncLockBytes * - pTheAsyncLockBytes): - m_xAsyncLockBytes(pTheAsyncLockBytes) -{ - DBG_ASSERT(m_xAsyncLockBytes.Is(), - "SvSyncLockBytes::SvSyncLockBytes(): Null"); -} - -SV_DECL_IMPL_REF(SvSyncLockBytes); - -//============================================================================ -struct SvCompositeLockBytes_Impl; -class SvCompositeLockBytes : public SvLockBytes -{ - SvCompositeLockBytes_Impl* pImpl; -public: - TYPEINFO(); - - SvCompositeLockBytes( ); - ~SvCompositeLockBytes(); - - void Append( SvLockBytes* pLockBytes, ULONG nPos, ULONG nOffset ); - ULONG RelativeOffset( ULONG nPos ) const; - void SetIsPending( BOOL bSet ); - SvLockBytes* GetLastLockBytes() const; - - virtual ErrCode ReadAt( - ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pRead ) const; - virtual ErrCode WriteAt( - ULONG nPos, const void* pBuffer, ULONG nCount, ULONG* pWritten ); - virtual ErrCode Flush() const; - virtual ErrCode SetSize( ULONG nSize ); - virtual ErrCode LockRegion( ULONG nPos, ULONG nCount, LockType ); - virtual ErrCode UnlockRegion( ULONG nPos, ULONG nCount, LockType ); - virtual ErrCode Stat( SvLockBytesStat*, SvLockBytesStatFlag ) const; -}; - -SV_DECL_IMPL_REF( SvCompositeLockBytes ) - - -#endif diff --git a/svtools/inc/folderrestriction.hxx b/svtools/inc/folderrestriction.hxx deleted file mode 100644 index f7e683b31ad6..000000000000 --- a/svtools/inc/folderrestriction.hxx +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: folderrestriction.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SVTOOLS_FOLDER_RESTRICTION_HXX -#define SVTOOLS_FOLDER_RESTRICTION_HXX - -#include "svtools/svldllapi.h" -#include - -#ifndef INCLUDED_VECTOR -#include -#define INCLUDED_VECTOR -#endif - -//........................................................................ -namespace svt -{ -//........................................................................ - - /** retrieves a list of folders which's access is not restricted. - -

Note that this is not meant as security feature, but only as - method to restrict some UI presentation, such as browsing - in the file open dialog.

- */ - SVL_DLLPUBLIC void getUnrestrictedFolders( ::std::vector< String >& _rFolders ); - -//........................................................................ -} // namespace svt -//........................................................................ - -#endif // SVTOOLS_FOLDER_RESTRICTION_HXX diff --git a/svtools/inc/fstathelper.hxx b/svtools/inc/fstathelper.hxx deleted file mode 100644 index b9761d7131a0..000000000000 --- a/svtools/inc/fstathelper.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: fstathelper.hxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVTOOLS_FSTATHELPER_HXX -#define _SVTOOLS_FSTATHELPER_HXX - -#include "svtools/svldllapi.h" -#include - -class UniString; -class Date; -class Time; - -namespace FStatHelper { - -/** Return the modified time and date stamp for this URL. - - @param URL the asking URL - - @param pDate if unequal 0, the function set the date stamp - - @param pTime if unequal 0, the function set the time stamp - - @return it was be able to get the date/time stamp -*/ -SVL_DLLPUBLIC sal_Bool GetModifiedDateTimeOfFile( const UniString& rURL, - Date* pDate, Time* pTime ); - -/** Return if under the URL a document exist. This is only a wrapper for the - UCB.IsContent. -*/ -SVL_DLLPUBLIC sal_Bool IsDocument( const UniString& rURL ); - -/** Return if under the URL a folder exist. This is only a wrapper for the - UCB.isFolder. -*/ -SVL_DLLPUBLIC sal_Bool IsFolder( const UniString& rURL ); - -} - -#endif diff --git a/svtools/inc/gifread.hxx b/svtools/inc/gifread.hxx deleted file mode 100644 index 8a9d299930c9..000000000000 --- a/svtools/inc/gifread.hxx +++ /dev/null @@ -1,147 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: gifread.hxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _GIFREAD_HXX -#define _GIFREAD_HXX - -#ifndef _GRAPH_HXX -#include -#endif -#ifndef _BMPACC_HXX -#include -#endif - -#ifdef _GIFPRIVATE - -// --------- -// - Enums - -// --------- - -enum GIFAction -{ - GLOBAL_HEADER_READING, - MARKER_READING, - EXTENSION_READING, - LOCAL_HEADER_READING, - FIRST_BLOCK_READING, - NEXT_BLOCK_READING, - ABORT_READING, - END_READING -}; - -// ------------------------------------------------------------------------ - -enum ReadState -{ - GIFREAD_OK, - GIFREAD_ERROR, - GIFREAD_NEED_MORE -}; - -// ------------- -// - GIFReader - -// ------------- - -class GIFLZWDecompressor; - -class SvStream; - -class GIFReader : public GraphicReader -{ - Graphic aImGraphic; - Animation aAnimation; - Bitmap aBmp8; - Bitmap aBmp1; - BitmapPalette aGPalette; - BitmapPalette aLPalette; - SvStream& rIStm; - void* pCallerData; - HPBYTE pSrcBuf; - GIFLZWDecompressor* pDecomp; - BitmapWriteAccess* pAcc8; - BitmapWriteAccess* pAcc1; - long nYAcc; - long nLastPos; - sal_uInt32 nLogWidth100; - sal_uInt32 nLogHeight100; - USHORT nTimer; - USHORT nGlobalWidth; // maximale Bildbreite aus Header - USHORT nGlobalHeight; // maximale Bildhoehe aus Header - USHORT nImageWidth; // maximale Bildbreite aus Header - USHORT nImageHeight; // maximale Bildhoehe aus Header - USHORT nImagePosX; - USHORT nImagePosY; - USHORT nImageX; // maximale Bildbreite aus Header - USHORT nImageY; // maximale Bildhoehe aus Header - USHORT nLastImageY; - USHORT nLastInterCount; - USHORT nLoops; - GIFAction eActAction; - BOOL bStatus; - BOOL bGCTransparent; // Ob das Bild Transparent ist, wenn ja: - BOOL bInterlaced; - BOOL bOverreadBlock; - BOOL bImGraphicReady; - BOOL bGlobalPalette; - BYTE nBackgroundColor; // Hintergrundfarbe - BYTE nGCTransparentIndex; // Pixel von diesem Index sind durchsichtig - BYTE nGCDisposalMethod; // 'Disposal Method' (siehe GIF-Doku) - BYTE cTransIndex1; - BYTE cNonTransIndex1; - - void ReadPaletteEntries( BitmapPalette* pPal, ULONG nCount ); - void ClearImageExtensions(); - BOOL CreateBitmaps( long nWidth, long nHeight, BitmapPalette* pPal, BOOL bWatchForBackgroundColor ); - BOOL ReadGlobalHeader(); - BOOL ReadExtension(); - BOOL ReadLocalHeader(); - ULONG ReadNextBlock(); - void FillImages( HPBYTE pBytes, ULONG nCount ); - void CreateNewBitmaps(); - BOOL ProcessGIF(); - -public: - - ReadState ReadGIF( Graphic& rGraphic ); - const Graphic& GetIntermediateGraphic(); - - GIFReader( SvStream& rStm ); - virtual ~GIFReader(); -}; - -#endif // _GIFPRIVATE - -// ------------- -// - ImportGIF - -// ------------- - - BOOL ImportGIF( SvStream& rStream, Graphic& rGraphic ); - -#endif // _GIFREAD_HXX diff --git a/svtools/inc/gradwrap.hxx b/svtools/inc/gradwrap.hxx deleted file mode 100644 index 28c9d8db1fcd..000000000000 --- a/svtools/inc/gradwrap.hxx +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: gradwrap.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef _SVGEN_HXX -#include -#endif - - -/****************************************************************************** -|* -|* class GradientWrapper -|* -|* Ersterstellung: KA 24.11.95 -|* letzte Aenderung: KA 24.11.95 -|* -|* Zeck: dient beim MetaFile-Export dazu, die eigentliche Berechungs- -|* funktionalitaet zu kapseln. Das Schreiben der Records fuer -|* die unterschiedlichen File-Formate geschieht ueber LinkHandler. -|* -|* Klassen, die diesen Wrapper benutzen, muessen drei Linkhandler -|* zur Verfuegung stellen, die im Ctor uebergeben werden: -|* -|* 1. Linkhandler zum Schreiben eines Records fuer Polygonausgabe -|* 2. Linkhandler zum Schreiben eines Records fuer PolyPolygonausgabe -|* 3. Linkhandler zum Schreiben eines Records fuer Setzen der Brush -|* -\******************************************************************************/ - - -class GradientWrapper -{ - Link aDrawPolyRecordHdl; - Link aDrawPolyPolyRecordHdl; - Link aSetFillInBrushRecordHdl; - - GradientWrapper() {}; - - -public: - GradientWrapper(const Link& rDrawPolyRecordHdl, - const Link& rDrawPolyPolyRecordHdl, - const Link& rSetFillInBrushHdl); - ~GradientWrapper(); - - - void WriteLinearGradient(const Rectangle& rRect, - const Gradient& rGradient); - void WriteRadialGradient(const Rectangle& rRect, - const Gradient& rGradient); - void WriteRectGradient(const Rectangle& rRect, - const Gradient& rGradient); -}; diff --git a/svtools/inc/inetdef.hxx b/svtools/inc/inetdef.hxx deleted file mode 100644 index 6ea380529147..000000000000 --- a/svtools/inc/inetdef.hxx +++ /dev/null @@ -1,32 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: inetdef.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include - diff --git a/svtools/inc/inetmsg.hxx b/svtools/inc/inetmsg.hxx deleted file mode 100644 index f011102a79e2..000000000000 --- a/svtools/inc/inetmsg.hxx +++ /dev/null @@ -1,32 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: inetmsg.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include - diff --git a/svtools/inc/inetstrm.hxx b/svtools/inc/inetstrm.hxx deleted file mode 100644 index 46e15d5e4cf4..000000000000 --- a/svtools/inc/inetstrm.hxx +++ /dev/null @@ -1,32 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: inetstrm.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include - diff --git a/svtools/inc/iniadrtk.hxx b/svtools/inc/iniadrtk.hxx deleted file mode 100644 index 1e42abcc6261..000000000000 --- a/svtools/inc/iniadrtk.hxx +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: iniadrtk.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SVTOOLS_INIADRTK_HXX -#define SVTOOLS_INIADRTK_HXX - -class String; - -//============================================================================ -enum AddressToken -{ - ADDRESS_COMPANY, - ADDRESS_STREET, - ADDRESS_COUNTRY, - ADDRESS_PLZ, - ADDRESS_CITY, - ADDRESS_TITLE, - ADDRESS_POSITION, - ADDRESS_TEL_PRIVATE, - ADDRESS_TEL_COMPANY, - ADDRESS_FAX, - ADDRESS_EMAIL, - ADDRESS_STATE, - ADDRESS_FATHERSNAME, - ADDRESS_APARTMENT -}; - -//============================================================================ -class SfxIniManagerAddressEntry -{ -public: - static String get(const String & rAddress, AddressToken eToken); -}; - -#endif // SVTOOLS_INIADRTK_HXX - diff --git a/svtools/inc/inidef.hxx b/svtools/inc/inidef.hxx deleted file mode 100644 index c7744d8be2d0..000000000000 --- a/svtools/inc/inidef.hxx +++ /dev/null @@ -1,146 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: inidef.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SFXINIDEF_HXX -#define _SFXINIDEF_HXX - -#ifndef _INIMGR_HXX -#include -#endif - -class SfxIniEntry; -class SfxIniDefaulterList; -class SfxIniDefaultManager; - -#if _SOLAR__PRIVATE -#include - -class SfxIniDefaulter; -SV_DECL_PTRARR( SfxIniDefaulterList, SfxIniDefaulter*, 0, 2 ); -#endif - -//======================================================================== - -class SfxIniDefaulter - -/* [Beschreibung] - - Instanzen dieser Klasse k"onnen (f"ur die Laufzeit eines Moduls, z.B. - einer DLL-Nutzung oder einer Applikation) angelegt werden, um Defaults - f"ur eine Anzahl von ini-Eintr"agen zu liefern. Diese Defaults werden - erfragt, wenn ein einen Eintrag nicht in den ini-Files - finden kann. - - Defaults verschiedener -Instanzen d"urfen sich nicht - unterscheiden, da die Reihenfolge der Abarbeitung nicht definiert ist. - - Die Instanzen brauchen nicht zerst"ort zu werden, au\ser wenn der - dazugeh"orige Code entladen wird (load-on-demand DLLs). Sonst geschieht - dies automatisch beim Zerst"oren des . -*/ - -{ - SfxIniDefaultManager* _pManager; - -public: - SfxIniDefaulter( SfxIniDefaultManager *pManager ); - ~SfxIniDefaulter(); - - virtual BOOL QueryDefault( String &aValue, - const SfxIniEntry &rEntry ) = 0; -}; - -//======================================================================== - -class SfxIniDefaultManager - -/* [Beschreibung] - - Genau eine Instanz dieser Klasse mu\s in jeder Application-Subklasse, - die diesen Mechanismus nutzen m"ochte, in deren Ctor angelegt werden - und sollte in deren Dtor zerst"ort werden. -*/ - -{ - SfxIniDefaulterList* _pList; - -public: - SfxIniDefaultManager(); - ~SfxIniDefaultManager(); - -#if _SOLAR__PRIVATE - void Insert( SfxIniDefaulter *pDefaulter ) - { _pList->C40_INSERT( SfxIniDefaulter, pDefaulter, _pList->Count() ); } - void Remove( SfxIniDefaulter *pDefaulter ) - { _pList->Remove( _pList->C40_GETPOS( SfxIniDefaulter, pDefaulter ) ); } - BOOL QueryDefault( String &aValue, - const SfxIniEntry &rEntry ); -#endif -}; - -//======================================================================== - -class SfxIniEntry - -/* [Beschreibung] - - Instanzen dieser Klasse beschreiben einen Eintrag eines Ini-Files, - um mit der Klasse erfragt werden zu k"onnen, falls - der einen Eintrag nicht in den Ini-Files auffindet. -*/ - -{ -friend class SfxIniManager; - - const String& _aGroup; - const String& _aKey; - SfxIniGroup _eGroup; - SfxIniKey _eKey; - USHORT _nIndex; - -private: - SfxIniEntry( const String& aGroup, - const String& aKey, - SfxIniGroup eGroup, - SfxIniKey eKey, - USHORT nIndex ); - SfxIniEntry( const SfxIniEntry & ); // n.i. - SfxIniEntry& operator=( const SfxIniEntry & ); // n.i. - -public: - const String& GetGroupName() const { return _aGroup; } - SfxIniGroup GetGroup() const { return _eGroup; } - const String& GetKeyName() const { return _aKey; } - SfxIniKey GetKey() const { return _eKey; } - USHORT GetIndex() const { return _nIndex; } -}; - -#endif - diff --git a/svtools/inc/iniprop.hxx b/svtools/inc/iniprop.hxx deleted file mode 100644 index 8ba56baa287b..000000000000 --- a/svtools/inc/iniprop.hxx +++ /dev/null @@ -1,64 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: iniprop.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFXINIPROP_HXX -#define _SFXINIPROP_HXX - -#include -#include -#ifndef _APP_HXX -#include -#endif - -class SfxIniManager; - -//------------------------------------------------------------------------ - -class SfxAppIniManagerProperty: public ApplicationProperty - -// fuer Application::Property(), um von ueberall an den AppIniManger zu kommen - -{ - SfxIniManager* _pIniManager; - -public: - TYPEINFO(); - SfxAppIniManagerProperty() - : _pIniManager(0) - {} - ~SfxAppIniManagerProperty(); - - SfxIniManager* GetIniManager() const { return _pIniManager; } - void SetIniManager( SfxIniManager *pIniManager ) - { _pIniManager = pIniManager; } -}; - - -#endif - diff --git a/svtools/inc/instrm.hxx b/svtools/inc/instrm.hxx deleted file mode 100644 index 58a70fcc6917..000000000000 --- a/svtools/inc/instrm.hxx +++ /dev/null @@ -1,83 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: instrm.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SVTOOLS_INSTRM_HXX -#define SVTOOLS_INSTRM_HXX - -#include "svtools/svldllapi.h" -#include -#include - -namespace com { namespace sun { namespace star { namespace io { - class XInputStream; - class XSeekable; -} } } } - -class SvDataPipe_Impl; - -//============================================================================ -class SVL_DLLPUBLIC SvInputStream: public SvStream -{ - com::sun::star::uno::Reference< com::sun::star::io::XInputStream > - m_xStream; - com::sun::star::uno::Reference< com::sun::star::io::XSeekable > - m_xSeekable; - SvDataPipe_Impl * m_pPipe; - ULONG m_nSeekedFrom; - - SVL_DLLPRIVATE bool open(); - - SVL_DLLPRIVATE virtual ULONG GetData(void * pData, ULONG nSize); - - SVL_DLLPRIVATE virtual ULONG PutData(void const *, ULONG); - - SVL_DLLPRIVATE virtual ULONG SeekPos(ULONG nPos); - - SVL_DLLPRIVATE virtual void FlushData(); - - SVL_DLLPRIVATE virtual void SetSize(ULONG); - -public: - SvInputStream( - com::sun::star::uno::Reference< com::sun::star::io::XInputStream > - const & - rTheStream); - - virtual ~SvInputStream(); - - virtual USHORT IsA() const; - - virtual void AddMark(ULONG nPos); - - virtual void RemoveMark(ULONG nPos); -}; - -#endif // SVTOOLS_INSTRM_HXX - diff --git a/svtools/inc/iodlg.hrc b/svtools/inc/iodlg.hrc deleted file mode 100644 index 36e3092064cd..000000000000 --- a/svtools/inc/iodlg.hrc +++ /dev/null @@ -1,110 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: iodlg.hrc,v $ - * $Revision: 1.10 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVTOOLS_IODLGIMPL_HRC -#define _SVTOOLS_IODLGIMPL_HRC - -#ifndef _SVTOOLS_HRC -#include -#endif - -// ModalDialog DLG_SVT_EXPLORERFILE - -#define FT_EXPLORERFILE_CURRENTPATH 10 -#define BTN_EXPLORERFILE_NEWFOLDER 11 -#define BTN_EXPLORERFILE_LISTVIEW 12 -#define BTN_EXPLORERFILE_DETAILSVIEW 13 -#define BTN_EXPLORERFILE_UP 14 -#define BTN_EXPLORERFILE_STANDARD 15 -#define BTN_EXPLORERFILE_OPEN 16 -#define BTN_EXPLORERFILE_CANCEL 17 -#define BTN_EXPLORERFILE_HELP 18 - -#define IMG_FILEDLG_BTN_UP 10 -#define IMG_FILEDLG_BTN_STD 11 -#define IMG_FILEDLG_CREATEFOLDER 15 - -#define CTL_EXPLORERFILE_FILELIST 20 - -#define FT_EXPLORERFILE_FILENAME 30 -#define ED_EXPLORERFILE_FILENAME 31 -#define FT_EXPLORERFILE_SHARED_LISTBOX 32 -#define LB_EXPLORERFILE_SHARED_LISTBOX 33 -#define FT_EXPLORERFILE_FILETYPE 34 -#define LB_EXPLORERFILE_FILETYPE 35 - -#define CB_EXPLORERFILE_READONLY 40 -#define CB_EXPLORERFILE_PASSWORD 41 -#define CB_AUTO_EXTENSION 42 -#define CB_OPTIONS 43 - -// ----------------------------------------------- - -#define STR_EXPLORERFILE_OPEN 1 -#define STR_EXPLORERFILE_SAVE 2 -#define STR_EXPLORERFILE_BUTTONSAVE 3 -#define STR_PATHNAME 4 -#define STR_PATHSELECT 5 -#define STR_BUTTONSELECT 6 -#define STR_ACTUALVERSION 7 - -// DLG_SVT_QUERYFOLDERNAME ----------------------- - -#define FT_SVT_QUERYFOLDERNAME_DLG_NAME 10 -#define ED_SVT_QUERYFOLDERNAME_DLG_NAME 11 -#define FL_SVT_QUERYFOLDERNAME_DLG_NAME 12 -#define BT_SVT_QUERYFOLDERNAME_DLG_OK 13 -#define BT_SVT_QUERYFOLDERNAME_DLG_CANCEL 14 -#define BT_SVT_QUERYFOLDERNAME_DLG_HELP 15 - -// ----------------------------------------------- - -#define SID_SFX_START 5000 -#define SID_OPENURL (SID_SFX_START + 596) - -#define HID_FILEDLG_STANDARD (HID_SFX_START + 27) -#define HID_FILEDLG_MANAGER (HID_SFX_START + 28) -#define HID_FILEDLG_URL (HID_SFX_START + 29) -#define HID_FILEDLG_USE_PASSWD (HID_SFX_START + 31) -#define HID_FILEDLG_READ_ONLY (HID_SFX_START + 32) - -#define HID_FILEDLG_AUTOCOMPLETEBOX (HID_SFX_START + 218) -#define HID_FILEDLG_SAVE_BTN (HID_SFX_START + 219) -#define HID_FILEDLG_SAVE_FILENAME (HID_SFX_START + 220) -#define HID_FILEDLG_SAVE_FILETYPE (HID_SFX_START + 221) -#define HID_FILEDLG_INSERT_BTN (HID_SFX_START + 222) -#define HID_FILEDLG_PATH_BTN (HID_SFX_START + 223) -#define HID_FILEDLG_PATH_FILENAME (HID_SFX_START + 224) -#define HID_FILEDLG_FOLDER_BTN (HID_SFX_START + 225) -#define HID_FILEDLG_FOLDER_FILENAME (HID_SFX_START + 226) -#define HID_FILEDLG_SRCHFOLDER_BTN (HID_SFX_START + 227) - -#endif - diff --git a/svtools/inc/jpeg.hxx b/svtools/inc/jpeg.hxx deleted file mode 100644 index d8de26c31009..000000000000 --- a/svtools/inc/jpeg.hxx +++ /dev/null @@ -1,127 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: jpeg.hxx,v $ - * $Revision: 1.10 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _JPEG_HXX -#define _JPEG_HXX - -#ifndef _GRAPH_HXX -#include -#endif -#include -#include -#include -#include - -#ifdef _JPEGPRIVATE - -// -------- -// - Enum - -// -------- - -enum ReadState -{ - JPEGREAD_OK, - JPEGREAD_ERROR, - JPEGREAD_NEED_MORE -}; - -// -------------- -// - JPEGReader - -// -------------- - -class JPEGReader : public GraphicReader -{ - SvStream& rIStm; - Bitmap aBmp; - Bitmap aBmp1; - BitmapWriteAccess* pAcc; - BitmapWriteAccess* pAcc1; - void* pBuffer; - long nLastPos; - long nFormerPos; - long nLastLines; - sal_Bool bSetLogSize; - - Graphic CreateIntermediateGraphic( const Bitmap& rBitmap, long nLines ); - void FillBitmap(); - -public: - - void* CreateBitmap( void* JPEGCreateBitmapParam ); - -public: - - - - JPEGReader( SvStream& rStm, void* pCallData, sal_Bool bSetLogSize ); - virtual ~JPEGReader(); - - - ReadState Read( Graphic& rGraphic ); -}; - -// -------------- -// - JPEGWriter - -// -------------- - -class JPEGWriter -{ - SvStream& rOStm; - Bitmap aBmp; - BitmapReadAccess* pAcc; - BYTE* pBuffer; - BOOL bNative; - - sal_Bool bGreys; - sal_Int32 nQuality; - - com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator; - -public: - - void* GetScanline( long nY ); - - JPEGWriter( SvStream& rOStm, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData ); - ~JPEGWriter() {}; - - BOOL Write( const Graphic& rGraphic ); -}; - -#endif // _JPEGPRIVATE - -// --------------------- -// - Import/ExportJPEG - -// --------------------- - -BOOL ImportJPEG( SvStream& rStream, Graphic& rGraphic, void* pCallerData, sal_Int32 nImportFlags ); - -BOOL ExportJPEG( SvStream& rStream, const Graphic& rGraphic, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData ); - -#endif // _JPEG_HXX diff --git a/svtools/inc/listener.hxx b/svtools/inc/listener.hxx deleted file mode 100644 index 6d70f135eb92..000000000000 --- a/svtools/inc/listener.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: listener.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVT_LISTENER_HXX -#define _SVT_LISTENER_HXX - -#include "svtools/svldllapi.h" -#include - -class SvtBroadcaster; -class SfxHint; -class SvtListenerBase; - -//------------------------------------------------------------------------- - -class SVL_DLLPUBLIC SvtListener -{ - friend class SvtListenerBase; - SvtListenerBase *pBrdCastLst; - - const SvtListener& operator=(const SvtListener &); // n.i., ist verboten - -public: - TYPEINFO(); - - SvtListener(); - SvtListener( const SvtListener &rCopy ); - virtual ~SvtListener(); - - BOOL StartListening( SvtBroadcaster& rBroadcaster ); - BOOL EndListening( SvtBroadcaster& rBroadcaster ); - void EndListeningAll(); - BOOL IsListening( SvtBroadcaster& rBroadcaster ) const; - - BOOL HasBroadcaster() const { return 0 != pBrdCastLst; } - - virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint ); -}; - - -#endif - diff --git a/svtools/inc/listeneriter.hxx b/svtools/inc/listeneriter.hxx deleted file mode 100644 index e531ead6bf5d..000000000000 --- a/svtools/inc/listeneriter.hxx +++ /dev/null @@ -1,82 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: listeneriter.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVT_LISTENERITER_HXX -#define _SVT_LISTENERITER_HXX - -#include "svtools/svldllapi.h" -#include - -class SvtListener; -class SvtListenerBase; -class SvtBroadcaster; - -//------------------------------------------------------------------------- - -class SVL_DLLPUBLIC SvtListenerIter -{ - friend class SvtListenerBase; - - SvtBroadcaster& rRoot; - SvtListenerBase *pAkt, *pDelNext; - - // for the update of all iterator's, if a listener is added or removed - // at the same time. - static SvtListenerIter *pListenerIters; - SvtListenerIter *pNxtIter; - TypeId aSrchId; // fuer First/Next - suche diesen Type - - SVL_DLLPRIVATE static void RemoveListener( SvtListenerBase& rDel, - SvtListenerBase* pNext ); - -public: - SvtListenerIter( SvtBroadcaster& ); - ~SvtListenerIter(); - - const SvtBroadcaster& GetBroadcaster() const { return rRoot; } - SvtBroadcaster& GetBroadcaster() { return rRoot; } - - SvtListener* GoNext(); // to the next - SvtListener* GoPrev(); // to the previous - - SvtListener* GoStart(); // to the start of the list - SvtListener* GoEnd(); // to the end of the list - - SvtListener* GoRoot(); // to the root - SvtListener* GetCurr() const; // returns the current - - int IsChanged() const { return pDelNext != pAkt; } - - SvtListener* First( TypeId nType ); - SvtListener* Next(); -}; - - -#endif - diff --git a/svtools/inc/lngmisc.hxx b/svtools/inc/lngmisc.hxx deleted file mode 100644 index 6bfe7b1c737c..000000000000 --- a/svtools/inc/lngmisc.hxx +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: lngmisc.hxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVTOOLS_LNGMISC_HXX_ -#define _SVTOOLS_LNGMISC_HXX_ - -#include "svtools/svldllapi.h" -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////// - -#define SVT_SOFT_HYPHEN ((sal_Unicode) 0x00AD) -#define SVT_HARD_HYPHEN ((sal_Unicode) 0x2011) - -// the non-breaking space -#define SVT_HARD_SPACE ((sal_Unicode) 0x00A0) - -namespace linguistic -{ - -inline BOOL IsHyphen( sal_Unicode cChar ) -{ - return cChar == SVT_SOFT_HYPHEN || cChar == SVT_HARD_HYPHEN; -} - - -inline BOOL IsControlChar( sal_Unicode cChar ) -{ - return cChar < (sal_Unicode) ' '; -} - - -inline BOOL HasHyphens( const rtl::OUString &rTxt ) -{ - return rTxt.indexOf( SVT_SOFT_HYPHEN ) != -1 || - rTxt.indexOf( SVT_HARD_HYPHEN ) != -1; -} - -SVL_DLLPUBLIC INT32 GetNumControlChars( const rtl::OUString &rTxt ); -SVL_DLLPUBLIC BOOL RemoveHyphens( rtl::OUString &rTxt ); -SVL_DLLPUBLIC BOOL RemoveControlChars( rtl::OUString &rTxt ); - -SVL_DLLPUBLIC BOOL ReplaceControlChars( rtl::OUString &rTxt, sal_Char aRplcChar = ' ' ); - -} // namespace linguistic - -#endif diff --git a/svtools/inc/memberid.hrc b/svtools/inc/memberid.hrc deleted file mode 100644 index c917bd993e97..000000000000 --- a/svtools/inc/memberid.hrc +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: memberid.hrc,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _MEMBERID_HRC -#define _MEMBERID_HRC - -#define SFX_MEMBERID(nUserData) ( ( (nUserData) >> 20 ) & 0xFF ) -#define SFX_SLOTID(nUserData) ( (nUserData) & 0xFFFF ) - -#define MID_X 1 -#define MID_Y 2 -#define MID_RECT_LEFT 3 -#define MID_RECT_TOP 4 -#define MID_WIDTH 5 -#define MID_HEIGHT 6 -#define MID_RECT_RIGHT 7 - - -#endif - diff --git a/svtools/inc/misccfg.hxx b/svtools/inc/misccfg.hxx deleted file mode 100644 index 3f897e1cecc3..000000000000 --- a/svtools/inc/misccfg.hxx +++ /dev/null @@ -1,75 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: misccfg.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFX_MISCCFG_HXX -#define _SFX_MISCCFG_HXX - -#include "svtools/svtdllapi.h" -#include "tools/solar.h" -#include "unotools/configitem.hxx" - -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ - -class SVT_DLLPUBLIC SfxMiscCfg : public utl::ConfigItem -{ - BOOL bPaperSize; // printer warnings - BOOL bPaperOrientation; - BOOL bNotFound; - sal_Int32 nYear2000; // two digit year representation - - const com::sun::star::uno::Sequence& GetPropertyNames(); - void Load(); - -public: - SfxMiscCfg( ); - ~SfxMiscCfg( ); - - virtual void Notify( const com::sun::star::uno::Sequence& aPropertyNames); - virtual void Commit(); - - BOOL IsNotFoundWarning() const {return bNotFound;} - void SetNotFoundWarning( BOOL bSet); - - BOOL IsPaperSizeWarning() const {return bPaperSize;} - void SetPaperSizeWarning(BOOL bSet); - - BOOL IsPaperOrientationWarning() const {return bPaperOrientation;} - void SetPaperOrientationWarning( BOOL bSet); - - // 0 ... 99 - sal_Int32 GetYear2000() const { return nYear2000; } - void SetYear2000( sal_Int32 nSet ); - -}; - -#endif // _MISCCFG_HXX - - diff --git a/svtools/inc/msgrd.hxx b/svtools/inc/msgrd.hxx deleted file mode 100644 index 381ae71c7b83..000000000000 --- a/svtools/inc/msgrd.hxx +++ /dev/null @@ -1,40 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: msgrd.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _MSGRD_HXX -#define _MSGRD_HXX - - -BOOL ConvertMSGToGDIMetaFile( SvStream & rMSG, GDIMetaFile & rGDIMetaFile, - BOOL(*pCallback)(void *, USHORT), void * pCallerData, - ULONG nMinPercent, ULONG nMaxPercent); - - -#endif // _MSGRD_HXX diff --git a/svtools/inc/msgwr.hxx b/svtools/inc/msgwr.hxx deleted file mode 100644 index c347938fd34d..000000000000 --- a/svtools/inc/msgwr.hxx +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: msgwr.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _MSGWR_HXX -#define _MSGWR_HXX - - -BOOL ConvertGraphicToMSG(const Graphic & rGraphic, SvStream & rTargetStream, - BOOL(*pCallback)(void *, USHORT), void * pCallerData, - ULONG nMinPercent, ULONG nMaxPercent); - - -#endif // _MSGWR_HXX - diff --git a/svtools/inc/nfsymbol.hxx b/svtools/inc/nfsymbol.hxx deleted file mode 100644 index 46fe47599359..000000000000 --- a/svtools/inc/nfsymbol.hxx +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: nfsymbol.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_SVTOOLS_NFSYMBOL_HXX -#define INCLUDED_SVTOOLS_NFSYMBOL_HXX - -/* ATTENTION! If new types arrive that had its content previously handled as - * SYMBOLTYPE_STRING, they have to be added at several places in zforscan.cxx - * and/or zformat.cxx, and in xmloff/source/style/xmlnumfe.cxx. Mostly these - * are places where already NF_SYMBOLTYPE_STRING together with - * NF_SYMBOLTYPE_CURRENCY or NF_SYMBOLTYPE_DATESEP are used in the same case of - * a switch respectively an if-condition. - */ - -namespace svt { - -/// Number formatter's symbol types of a token, if not key words, which are >0 -enum NfSymbolType -{ - NF_SYMBOLTYPE_STRING = -1, // literal string in output - NF_SYMBOLTYPE_DEL = -2, // special character - NF_SYMBOLTYPE_BLANK = -3, // blank for '_' - NF_SYMBOLTYPE_STAR = -4, // *-character - NF_SYMBOLTYPE_DIGIT = -5, // digit place holder - NF_SYMBOLTYPE_DECSEP = -6, // decimal separator - NF_SYMBOLTYPE_THSEP = -7, // group AKA thousand separator - NF_SYMBOLTYPE_EXP = -8, // exponent E - NF_SYMBOLTYPE_FRAC = -9, // fraction / - NF_SYMBOLTYPE_EMPTY = -10, // deleted symbols - NF_SYMBOLTYPE_FRACBLANK = -11, // delimiter between integer and fraction - NF_SYMBOLTYPE_COMMENT = -12, // comment is following - NF_SYMBOLTYPE_CURRENCY = -13, // currency symbol - NF_SYMBOLTYPE_CURRDEL = -14, // currency symbol delimiter [$] - NF_SYMBOLTYPE_CURREXT = -15, // currency symbol extension -xxx - NF_SYMBOLTYPE_CALENDAR = -16, // calendar ID - NF_SYMBOLTYPE_CALDEL = -17, // calendar delimiter [~] - NF_SYMBOLTYPE_DATESEP = -18, // date separator - NF_SYMBOLTYPE_TIMESEP = -19, // time separator - NF_SYMBOLTYPE_TIME100SECSEP = -20, // time 100th seconds separator - NF_SYMBOLTYPE_PERCENT = -21 // percent % -}; - -} // namespace svt - -#endif // INCLUDED_SVTOOLS_NFSYMBOL_HXX diff --git a/svtools/inc/numuno.hxx b/svtools/inc/numuno.hxx deleted file mode 100644 index c31829dec020..000000000000 --- a/svtools/inc/numuno.hxx +++ /dev/null @@ -1,102 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: numuno.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _NUMUNO_HXX -#define _NUMUNO_HXX - -#include "svtools/svtdllapi.h" -#include -#include -#include - -class SvNumberFormatter; -class SvNumFmtSuppl_Impl; - -namespace comphelper -{ - class SharedMutex; -} - -//------------------------------------------------------------------ - -// SvNumberFormatterServiceObj must be registered as service somewhere - -com::sun::star::uno::Reference SAL_CALL - SvNumberFormatterServiceObj_NewInstance( - const com::sun::star::uno::Reference< - com::sun::star::lang::XMultiServiceFactory>& rSMgr ); - -//------------------------------------------------------------------ - -// SvNumberFormatsSupplierObj: aggregate to document, -// construct with SvNumberFormatter - -class SVT_DLLPUBLIC SvNumberFormatsSupplierObj : public cppu::WeakAggImplHelper2< - com::sun::star::util::XNumberFormatsSupplier, - com::sun::star::lang::XUnoTunnel> -{ -private: - SvNumFmtSuppl_Impl* pImpl; - -public: - SvNumberFormatsSupplierObj(); - SvNumberFormatsSupplierObj(SvNumberFormatter* pForm); - virtual ~SvNumberFormatsSupplierObj(); - - void SetNumberFormatter(SvNumberFormatter* pNew); - SvNumberFormatter* GetNumberFormatter() const; - - // ueberladen, um Attribute im Dokument anzupassen - virtual void NumberFormatDeleted(sal_uInt32 nKey); - // ueberladen, um evtl. neu zu formatieren - virtual void SettingsChanged(); - - // XNumberFormatsSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL - getNumberFormatSettings() - throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats > SAL_CALL - getNumberFormats() - throw(::com::sun::star::uno::RuntimeException); - - // XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< - sal_Int8 >& aIdentifier ) - throw(::com::sun::star::uno::RuntimeException); - - static const com::sun::star::uno::Sequence& getUnoTunnelId(); - static SvNumberFormatsSupplierObj* getImplementation( const com::sun::star::uno::Reference< - com::sun::star::util::XNumberFormatsSupplier> xObj ); - - ::comphelper::SharedMutex& getSharedMutex() const; -}; - -#endif // #ifndef _NUMUNO_HXX - - diff --git a/svtools/inc/outstrm.hxx b/svtools/inc/outstrm.hxx deleted file mode 100644 index e11c7ed1c1a9..000000000000 --- a/svtools/inc/outstrm.hxx +++ /dev/null @@ -1,69 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: outstrm.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SVTOOLS_OUTSTRM_HXX -#define SVTOOLS_OUTSTRM_HXX - -#include "svtools/svldllapi.h" -#include -#include - -namespace com { namespace sun { namespace star { namespace io { - class XOutputStream; -} } } } - -//============================================================================ -class SVL_DLLPUBLIC SvOutputStream: public SvStream -{ - com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > - m_xStream; - - SVL_DLLPRIVATE virtual ULONG GetData(void *, ULONG); - - SVL_DLLPRIVATE virtual ULONG PutData(void const * pData, ULONG nSize); - - SVL_DLLPRIVATE virtual ULONG SeekPos(ULONG); - - SVL_DLLPRIVATE virtual void FlushData(); - - SVL_DLLPRIVATE virtual void SetSize(ULONG); - -public: - SvOutputStream(com::sun::star::uno::Reference< - com::sun::star::io::XOutputStream > const & - rTheStream); - - virtual ~SvOutputStream(); - - virtual USHORT IsA() const; -}; - -#endif // SVTOOLS_OUTSTRM_HXX - diff --git a/svtools/inc/pickerhelper.hxx b/svtools/inc/pickerhelper.hxx deleted file mode 100644 index 4be84296c678..000000000000 --- a/svtools/inc/pickerhelper.hxx +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: pickerhelper.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _PICKERHELPER_HXX -#define _PICKERHELPER_HXX - -#include "svtools/svldllapi.h" -#include "sal/types.h" -#include "com/sun/star/uno/Reference.hxx" - -namespace com -{ - namespace sun - { - namespace star - { - namespace ui - { - namespace dialogs - { - class XFilePicker; - class XFolderPicker; - } - } - } - } -} - - -namespace svt -{ - - SVL_DLLPUBLIC void SetDialogHelpId( - ::com::sun::star::uno::Reference < ::com::sun::star::ui::dialogs::XFilePicker > _mxFileDlg, - sal_Int32 _nHelpId ); - - SVL_DLLPUBLIC void SetDialogHelpId( - ::com::sun::star::uno::Reference < ::com::sun::star::ui::dialogs::XFolderPicker > _mxFileDlg, - sal_Int32 _nHelpId ); - -} - -//----------------------------------------------------------------------------- - -#endif diff --git a/svtools/inc/pickerhistory.hxx b/svtools/inc/pickerhistory.hxx deleted file mode 100644 index f99ad5dcc0f1..000000000000 --- a/svtools/inc/pickerhistory.hxx +++ /dev/null @@ -1,54 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: pickerhistory.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SVTOOLS_PICKERHISTORY_HXX -#define SVTOOLS_PICKERHISTORY_HXX - -#include "svtools/svldllapi.h" -#include - -//......................................................................... -namespace svt -{ -//......................................................................... - - // -------------------------------------------------------------------- - SVL_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > - GetTopMostFolderPicker( ); - - SVL_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > - GetTopMostFilePicker( ); - -//......................................................................... -} // namespace svt -//......................................................................... - -#endif // SVTOOLS_PICKERHISTORY_HXX - diff --git a/svtools/inc/pickerhistoryaccess.hxx b/svtools/inc/pickerhistoryaccess.hxx deleted file mode 100644 index 983b0c416ef3..000000000000 --- a/svtools/inc/pickerhistoryaccess.hxx +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: pickerhistoryaccess.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SVTOOLS_PICKERHISTORYACCESS_HXX -#define SVTOOLS_PICKERHISTORYACCESS_HXX - -#include "svtools/svldllapi.h" - -#ifndef _COM_SUN_STAR_UNO_REFERENX_HXX_ -#include -#endif - -//......................................................................... -namespace svt -{ -//......................................................................... - - // -------------------------------------------------------------------- - SVL_DLLPUBLIC void addFolderPicker( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxPicker ); - - SVL_DLLPUBLIC void addFilePicker( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxPicker ); - -//......................................................................... -} // namespace svt -//......................................................................... - -#endif // SVTOOLS_PICKERHISTORYACCESS_HXX - diff --git a/svtools/inc/poolcach.hxx b/svtools/inc/poolcach.hxx deleted file mode 100644 index 20d9e4d19c43..000000000000 --- a/svtools/inc/poolcach.hxx +++ /dev/null @@ -1,61 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: poolcach.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFXPOOLCACH_HXX -#define _SFXPOOLCACH_HXX - -#include "svtools/svtdllapi.h" -#include - -class SfxItemModifyArr_Impl; -class SfxItemPool; -class SfxItemSet; -class SfxPoolItem; -class SfxSetItem; - -class SVT_DLLPUBLIC SfxItemPoolCache -{ - SfxItemPool *pPool; - SfxItemModifyArr_Impl *pCache; - const SfxItemSet *pSetToPut; - const SfxPoolItem *pItemToPut; - -public: - SfxItemPoolCache( SfxItemPool *pPool, - const SfxPoolItem *pPutItem ); - SfxItemPoolCache( SfxItemPool *pPool, - const SfxItemSet *pPutSet ); - ~SfxItemPoolCache(); - - const SfxSetItem& ApplyTo( const SfxSetItem& rSetItem, BOOL bNew = FALSE ); -}; - - -#endif - diff --git a/svtools/inc/propctrl.hxx b/svtools/inc/propctrl.hxx deleted file mode 100644 index b2698f6a1c8e..000000000000 --- a/svtools/inc/propctrl.hxx +++ /dev/null @@ -1,118 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: propctrl.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -/* -#include -#include -#include "sbx.hxx" -#include "sbxbase.hxx" -#include "sbxres.hxx" -#include - */ - - -#ifndef __PROPED_HXX__ -#include -#endif -#ifndef _UNO_HXX -#include -#endif -#ifndef _USR_SEQU_HXX -#include -#endif -#ifndef __TOOLSIDL_HXX__ -#include -#endif - -/* -class XPropertyEditor - : public XInterface -{ -public: - - virtual void setObject(const UsrAny& aToInspectObj) = 0; - - static Uik getSmartUik() { return(385); } -}; -*/ - -class PropertyEditorControler_Impl; -class SvPropertyBox; -class Window; - -class SimplePropertyEditor_Impl : - public XPropertyEditor, - public XPropertyEditorNavigation, - public UsrObject -{ - PropertyEditorControler_Impl* pActiveControler; - SvPropertyBox* mpPropBox; - UsrAny maStartUnoObj; - UsrAny maActiveUnoObj; - - // History der Objekte speichern - AnySequence maHistorySeq; - WSStringSequence maHistoryNames; - UINT32 mnHistoryCount; - INT32 mnActualHistoryLevel; - - // Einfache History via Dummy-Properties - BOOL bSimpleHistory; - - // Methode zum Anlegen/Aktivieren der Controller - void showObject( const UsrAny& aToShowObj ); - String getPath( void ); - -public: - // Provisorischer Ctor mit Parent-Window - SimplePropertyEditor_Impl( Window *pParent ); - ~SimplePropertyEditor_Impl(); - - // HACK fuer History-Test - void enableSimpleHistory( BOOL bHistory_ ) { bSimpleHistory = bHistory_; } - - SMART_UNO_DECLARATION(ImplIntrospection,UsrObject); - - // Methoden von XInterface - XInterface * queryInterface( Uik aUik ); - XIdlClassRef getIdlClass(); - - // Methoden von XPropertyEditor - virtual void setObject(const UsrAny& aToInspectObj, const XubString& aObjName); - - // Methoden von PropertyEditorNavigation - virtual void forward(void); - virtual void back(void); - -}; - - - - diff --git a/svtools/inc/property.hxx b/svtools/inc/property.hxx deleted file mode 100644 index cfdc62dd350c..000000000000 --- a/svtools/inc/property.hxx +++ /dev/null @@ -1,588 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: property.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SV_PROPERTY_HXX -#define SV_PROPERTY_HXX - -#ifndef _VIRDEV_HXX //autogen -#include -#endif -#ifndef SV_FIXED_HXX -#include -#endif -#ifndef SV_LSTBOX_HXX -#include -#endif -#ifndef SV_GROUP_HXX -#include -#endif -#ifndef SV_BUTTON_HXX -#include -#endif -#ifndef SV_MOREBTN_HXX -#include -#endif -#ifndef _DIALOG_HXX //autogen -#include -#endif -#include -#include -#include - -#define _SVSTDARR_USHORTS -#include -#include -#include -#include - -#ifndef _SVSTDARR_STRINGS -#define _SVSTDARR_STRINGS -#include -#endif -#include -#include - -//------------------------------------------------------------------------ - -//======================================================================== -enum eKindOfControl { KOC_UNDEFINED=0,KOC_LISTBOX=1, KOC_COMBOBOX=2, - KOC_EDIT=3,KOC_USERDEFINED=5}; - -class SvXPropertyCtrListener; - -class SvXPropertyControl : public Control -{ -public: - SvXPropertyControl( Window* pParent, WinBits nWinStyle = 0 ); - SvXPropertyControl( Window* pParent, const ResId& rResId ); - - virtual void SetSvXPropertyCtrListener(SvXPropertyCtrListener*)=0; - - virtual SvXPropertyCtrListener* GetSvXPropertyCtrListener()=0; - virtual void SetProperty(const String &rString)=0; - virtual String GetProperty()const=0; - virtual BOOL HasList()=0; - virtual void ClearList()=0; - virtual void InsertEntry( const String& rString, - USHORT nPos = LISTBOX_APPEND )=0; - - virtual void SetCtrSize(const Size& rSize)=0; - virtual void SetLocked(BOOL bLocked=TRUE)=0; - - virtual void SetMyName(const String &rString)=0; - virtual String GetMyName()const=0; - - virtual void SetMyData(void*)=0; - virtual void* GetMyData()=0; -}; - -class SvXPropertyCtrListener -{ - -public: - virtual void Modified (SvXPropertyControl *pSvXPCtr)=0; - virtual void GetFocus (SvXPropertyControl *pSvXPCtr)=0; - virtual void LoseFocus(SvXPropertyControl *pSvXPCtr)=0; - virtual void KeyInput (SvXPropertyControl *pSvXPCtr ,const KeyCode&)=0; -}; - - -class SvXPropertyEdit : public SvXPropertyControl -{ -private: - - String aName; - SvXPropertyCtrListener* pListener; - Edit aEdit; - void* pData; - - DECL_LINK(ModifiedHdl,Edit*); - DECL_LINK(GetFocusHdl,Edit*); - DECL_LINK(LoseFocusHdl,Edit*); - -public: - SvXPropertyEdit( Window* pParent, WinBits nWinStyle = 0 ); - SvXPropertyEdit( Window* pParent, const ResId& rResId ); - - virtual void SetSvXPropertyCtrListener(SvXPropertyCtrListener*); - - virtual SvXPropertyCtrListener* GetSvXPropertyCtrListener(); - - virtual void SetProperty(const String &rString); - virtual String GetProperty()const; - - virtual BOOL HasList(); - virtual void ClearList(); - virtual void InsertEntry( const String& rString, - USHORT nPos = LISTBOX_APPEND ); - - virtual void SetCtrSize(const Size& rSize); - virtual void SetLocked(BOOL bLocked=TRUE); - - virtual void SetMyName(const String &rString); - virtual String GetMyName()const; - - virtual void SetMyData(void*); - virtual void* GetMyData(); -}; - - -class SvXPropertyListBox : public SvXPropertyControl -{ -private: - - String aName; - SvXPropertyCtrListener* pListener; - ListBox aListBox; - void* pData; - - DECL_LINK(ModifiedHdl,ListBox*); - DECL_LINK(GetFocusHdl,ListBox*); - DECL_LINK(LoseFocusHdl,ListBox*); - - -public: - SvXPropertyListBox( Window* pParent, WinBits nWinStyle = 0 ); - SvXPropertyListBox( Window* pParent, const ResId& rResId ); - - virtual void SetSvXPropertyCtrListener(SvXPropertyCtrListener*); - - virtual SvXPropertyCtrListener* GetSvXPropertyCtrListener(); - - ListBox* GetListBox(); - - virtual void SetProperty(const String &rString); - virtual String GetProperty()const; - - virtual BOOL HasList(); - virtual void ClearList(); - virtual void InsertEntry( const String& rString, - USHORT nPos = LISTBOX_APPEND ); - - virtual void SetCtrSize(const Size& rSize); - virtual void SetLocked(BOOL bLocked=TRUE); - - virtual void SetMyName(const String &rString); - virtual String GetMyName()const; - - virtual void SetMyData(void*); - virtual void* GetMyData(); -}; - -class SvXPropertyComboBox : public SvXPropertyControl -{ -private: - - String aName; - SvXPropertyCtrListener* pListener; - ComboBox aComboBox; - void* pData; - - DECL_LINK(ModifiedHdl,ComboBox*); - DECL_LINK(GetFocusHdl,ComboBox*); - DECL_LINK(LoseFocusHdl,ComboBox*); - - -public: - SvXPropertyComboBox( Window* pParent, WinBits nWinStyle = 0 ); - SvXPropertyComboBox( Window* pParent, const ResId& rResId ); - - virtual void SetSvXPropertyCtrListener(SvXPropertyCtrListener*); - - virtual SvXPropertyCtrListener* GetSvXPropertyCtrListener(); - - ComboBox* GetComboBox(); - - virtual void SetProperty(const String &rString); - virtual String GetProperty()const; - - virtual BOOL HasList(); - virtual void ClearList(); - virtual void InsertEntry( const String& rString, - USHORT nPos = LISTBOX_APPEND ); - - virtual void SetCtrSize(const Size& rSize); - virtual void SetLocked(BOOL bLocked=TRUE); - - virtual void SetMyName(const String &rString); - virtual String GetMyName()const; - - virtual void SetMyData(void*); - virtual void* GetMyData(); -}; - - - -class SvPropertyLine : public Control -{ -private: - FixedText aName; - USHORT nNameWidth; - BOOL bNeedsRepaint; - SvXPropertyControl* pSvXPropertyControl; - - PushButton aXButton; - BOOL bIsLocked; - BOOL bHasXButton; - BOOL bIsHyperlink; - eKindOfControl eKindOfCtr; - -protected: - virtual void Resize(); - -public: - SvPropertyLine( Window* pParent, - WinBits nWinStyle = 0 ); - SvPropertyLine( Window* pParent, - const ResId& rResId ); - - BOOL NeedsRepaint(); - void SetNeedsRepaint(BOOL bFlag); - void SetSvXPropertyControl(SvXPropertyControl*); - SvXPropertyControl* GetSvXPropertyControl(); - - void SetKindOfControl(eKindOfControl); - eKindOfControl GetKindOfControl(); - - void SetName(const String& rString ); - String GetName() const; - void SetNameWidth(USHORT); - - void ShowXButton(); - void HideXButton(); - BOOL IsVisibleXButton(); - void ShowAsHyperLink(BOOL nFlag=TRUE); - BOOL IsShownAsHyperlink(); - - void Locked(BOOL nFlag=TRUE); - BOOL IsLineLocked(); - - void SetClickHdl(const Link&); - -}; - - -class SvPropertyData -{ -public: - eKindOfControl eKind; - String aName; - String aValue; - SvStrings theValues; // ??? - - BOOL bHasVisibleXButton; - BOOL bIsHyperLink; - BOOL bIsLocked; - void* pDataPtr; - SvXPropertyControl* pControl; -}; - -class SvPropertyDataObjectControl -{ -}; - -class SvPropertyDataControl -{ -public: - virtual void Modified( const String& aName, - const String& aVal, - void* pData)=0; - - virtual void Clicked( const String& aName, - const String& aVal, - void* pData)=0; - - virtual void Commit( const String& aName, - const String& aVal, - void* pData)=0; - - virtual void Select( const String& aName, - void* pData)=0; - - virtual void LinkClicked(const String& aName, - void* pData)=0; -}; - -class SvXPropEvListener: public SvXPropertyCtrListener -{ - Link aModifyLink; - Link aGetFocusLink; - Link aLoseFocusLink; - Link aKeyInputLink; - String aModifiedResult; - - SvXPropertyControl * pTheActiveControl; - KeyCode aKeyCode; - -public: - SvXPropEvListener(); - virtual ~SvXPropEvListener(); - - virtual void Modified (SvXPropertyControl *pSvXPCtr); - virtual void GetFocus (SvXPropertyControl *pSvXPCtr); - virtual void LoseFocus(SvXPropertyControl *pSvXPCtr); - virtual void KeyInput(SvXPropertyControl *pSvXPCtr ,const KeyCode&); - - SvXPropertyControl * GetPropertyControl(); - KeyCode GetKeyCode() const; - - void SetModifyHdl( const Link& rLink ) { aModifyLink = rLink; } - const Link& GetModifyHdl() const { return aModifyLink; } - - void SetGetFocusHdl( const Link& rLink ) { aGetFocusLink = rLink; } - const Link& GetGetFocusHdl() const { return aGetFocusLink; } - - void SetLoseFocusHdl( const Link& rLink ) { aLoseFocusLink = rLink; } - const Link& GetLoseFocusHdl() const { return aLoseFocusLink; } - - void SetKeyInputHdl( const Link& rLink ) { aKeyInputLink = rLink; } - const Link& GetKeyInputHdl() const { return aKeyInputLink; } - - -}; - -typedef SvPropertyLine * SvPropertyLinePtr; - -SV_DECL_PTRARR(SvPropLineArray,SvPropertyLinePtr,1,1) - -class SvListBoxForProperties: public Control -{ -private: - - SvXPropEvListener aListener; - Window aPlayGround; - ScrollBar aVScroll; - SvPropLineArray PLineArray; - SvPropertyDataControl* pPropDataControl; - USHORT nRowHeight; - BOOL bUpdate; - USHORT nTheNameSize; - long nYOffset; - - DECL_LINK( ScrollHdl,ScrollBar*); - DECL_LINK( ClickHdl ,PushButton*); - - DECL_LINK( ModifyHdl,SvXPropEvListener*); - DECL_LINK( GetFocusHdl,SvXPropEvListener*); - DECL_LINK(LoseFocusHdl,SvXPropEvListener*); - DECL_LINK( KeyInputHdl,SvXPropEvListener*); - -protected: - void UpdateAll(); - void UpdatePosNSize(); - void UpdatePlayGround(); - void UpdateVScroll(); - - void Resize(); - -public: - SvListBoxForProperties( Window* pParent, WinBits nWinStyle = 0 ); - SvListBoxForProperties( Window* pParent, const ResId& rResId ); - - ~SvListBoxForProperties(); - - virtual USHORT CalcVisibleLines(); - virtual void EnableUpdate(); - virtual void DisableUpdate(); - - virtual void SetController(SvPropertyDataControl *); - - virtual void Clear(); - - virtual USHORT InsertEntry( const SvPropertyData&, USHORT nPos = LISTBOX_APPEND ); - - virtual void ChangeEntry( const SvPropertyData&, USHORT nPos); - - virtual USHORT AppendEntry( const SvPropertyData&); - - virtual void SetPropertyValue( const String & rEntryName, const String & rValue ); - - virtual void SetFirstVisibleEntry(USHORT nPos); - virtual USHORT GetFirstVisibleEntry(); - - virtual void SetSelectedEntry(USHORT nPos); - virtual USHORT GetSelectedEntry(); -}; - -class SvTabPageForProperties: public TabPage -{ - -private: - - SvListBoxForProperties aLbProp; - -protected: - - virtual void Resize(); - -public: - SvTabPageForProperties(Window* pParent,WinBits nWinStyle = 0 ); - - SvListBoxForProperties* GetTheListBox(); -}; - - -class SvBasicPropertyDataControl: public SvPropertyDataControl -{ -private: - - BOOL bCorrectness; - String aEntryName; - String aEntryProperty; - String aCorrectProperty; - void* pTheData; - Link aModifyLink; - Link aClickedLink; - Link aCommitLink; - Link aSelectLink; - -public: - virtual ~SvBasicPropertyDataControl(); - - virtual void Modified( const String& aName, - const String& aVal, - void* pData); //User has modified Property - - virtual void Clicked( const String& aName, - const String& aVal, - void* pData); //Xtension-Button pressed - - virtual void Commit( const String& aName, - const String& aVal, - void* pData); //User accept changes - - virtual void Select( const String& aName, - void* pData); //User select new Row - - virtual void LinkClicked(const String& aName, - void* pData); - - virtual void SetIsCorrect(BOOL nFlag); - - //virtual String GetTheCorrectProperty()const; - virtual void SetTheCorrectProperty(const String& aName); - - String GetName() const; //Tell's the name of the Property - String GetProperty() const; //Tell's the content of the Property - void* GetData(); //Tell's the storage - - - void SetModifyHdl( const Link& rLink ) { aModifyLink = rLink; } - const Link& GetModifyHdl() const { return aModifyLink; } - - void SetClickedHdl( const Link& rLink ) { aClickedLink = rLink; } - const Link& GetClickedHdl() const { return aClickedLink; } - - void SetCommitHdl( const Link& rLink ) { aCommitLink = rLink; } - const Link& GetCommitHdl() const { return aCommitLink; } - - void SetSelectHdl( const Link& rLink ) { aSelectLink = rLink; } - const Link& GetSelectHdl() const { return aSelectLink; } - -}; - - -class SvPropertyBox: public Control -{ -private: - SvPropertyDataControl* pThePropDataCtr; - TabControl aTabControl; - -protected: - virtual void Resize(); - -public: - SvPropertyBox ( Window* pParent, WinBits nWinStyle = 0 ); - SvPropertyBox ( Window* pParent, const ResId& rResId ); - - ~SvPropertyBox(); - - virtual USHORT CalcVisibleLines(); - virtual void EnableUpdate(); // auch IDL? - virtual void DisableUpdate(); // auch IDL? - - // AB: Hier beginnt das 'offizielle' Interface, das in IDL uebernommen werden soll - virtual void SetController(SvPropertyDataControl *); - - virtual USHORT AppendPage( const String & r ); - virtual void SetPage( USHORT ); - virtual USHORT GetCurPage(); - virtual void ClearAll(); - virtual void ClearTable(); - - virtual void SetPropertyValue( const String & rEntryName, const String & rValue ); - - virtual USHORT InsertEntry( const SvPropertyData&, USHORT nPos = LISTBOX_APPEND ); - virtual void ChangeEntry( const SvPropertyData&, USHORT nPos); - virtual USHORT AppendEntry( const SvPropertyData&); - - virtual void SetFirstVisibleEntry(USHORT nPos); - virtual USHORT GetFirstVisibleEntry(); - - virtual void SetSelectedEntry(USHORT nPos); - virtual USHORT GetSelectedEntry(); -}; - - - -/* -class ScPropertyDlg : public ModalDialog -{ -private: - SvBasicPropertyDataControl aBaProDatCtr; - OKButton anOk; - CancelButton aCancel; - USHORT nCount; - USHORT nClickCount; - - SvPropertyData aProperty; - SvPropertyBox aPropListBox; - - ListBox aKindOfListBox; - FixedText aModAnswer; - FixedText aClickAnswer; - FixedText aCommitAnswer; - FixedText aSelectAnswer; - - DECL_LINK( ModifiedHdl, ListBox*); - - DECL_LINK( RowModifiedHdl, SvBasicPropertyDataControl*); - DECL_LINK( ClickHdl , SvBasicPropertyDataControl*); - DECL_LINK( SelectHdl , SvBasicPropertyDataControl*); - DECL_LINK( CommitHdl , SvBasicPropertyDataControl*); - -public: - ScPropertyDlg( Window* pParent); - ~ScPropertyDlg(); -}; -*/ -#endif // SC_AUTOFMT_HXX - - diff --git a/svtools/inc/reginfo.hxx b/svtools/inc/reginfo.hxx deleted file mode 100644 index bb3596797c6e..000000000000 --- a/svtools/inc/reginfo.hxx +++ /dev/null @@ -1,65 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: reginfo.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _REGINFO_HXX -#define _REGINFO_HXX - -struct RegInfo_Impl; - -#include - -class RegInfo -{ - - public: - - RegInfo(); - ~RegInfo(); - - const String& GetGroup() const { return aCurrentGroup; } - void SetAppGroup( const String& rGroup ); - void DeleteAppGroup( const String& rGroup ); - - String ReadKey( const String& rKey ) const; - String ReadKey( const String& rKey, const String& rDefault ) const; - void WriteKey( const String& rKey, const String& rValue ); - void DeleteKey( const String& rKey ); - String GetKeyName( USHORT nKey ) const; - String ReadKey( USHORT nKey ) const; - USHORT GetKeyCount() const; - - private: - - String aCurrentGroup; - RegInfo_Impl* pImp; - -}; - - -#endif diff --git a/svtools/inc/reqitem.hxx b/svtools/inc/reqitem.hxx deleted file mode 100644 index 32fdf4f066dc..000000000000 --- a/svtools/inc/reqitem.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: reqitem.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _REQITEM_HXX -#define _REQITEM_HXX - -#include -#include - -#if _SOLAR__PRIVATE -#include -#else -#include -#endif - -// ----------------------------------------------------------------------- - -class SfxRequestItem: public SfxSetItem - -/** [Description] - - Represents a function call with optional arguments. -*/ - -{ -public: - TYPEINFO(); - SfxRequestItem(); - SfxRequestItem( USHORT nWhich, SvStream & ); - SfxRequestItem( const SfxRequestItem& ); - ~SfxRequestItem(); - - virtual int operator==( const SfxPoolItem& ) const; - virtual - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT nItemVersion) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const; -}; - - -#endif - diff --git a/svtools/inc/rtfkeywd.hxx b/svtools/inc/rtfkeywd.hxx new file mode 100644 index 000000000000..f76399ffd824 --- /dev/null +++ b/svtools/inc/rtfkeywd.hxx @@ -0,0 +1,1144 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: rtfkeywd.hxx,v $ + * $Revision: 1.13.134.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _RTFKEYWD_HXX +#define _RTFKEYWD_HXX + +#include "sal/config.h" + +#define OOO_STRING_SVTOOLS_RTF_HEXCHAR "\\'" +#define OOO_STRING_SVTOOLS_RTF_IGNORE "\\*" +#define OOO_STRING_SVTOOLS_RTF_OPTHYPH "\\-" +#define OOO_STRING_SVTOOLS_RTF_SUBENTRY "\\:" +#define OOO_STRING_SVTOOLS_RTF_ABSH "\\absh" +#define OOO_STRING_SVTOOLS_RTF_ABSW "\\absw" +#define OOO_STRING_SVTOOLS_RTF_ALT "\\alt" +#define OOO_STRING_SVTOOLS_RTF_ANNOTATION "\\annotation" +#define OOO_STRING_SVTOOLS_RTF_ANSI "\\ansi" +#define OOO_STRING_SVTOOLS_RTF_ATNID "\\atnid" +#define OOO_STRING_SVTOOLS_RTF_AUTHOR "\\author" +#define OOO_STRING_SVTOOLS_RTF_B "\\b" +#define OOO_STRING_SVTOOLS_RTF_BGBDIAG "\\bgbdiag" +#define OOO_STRING_SVTOOLS_RTF_BGCROSS "\\bgcross" +#define OOO_STRING_SVTOOLS_RTF_BGDCROSS "\\bgdcross" +#define OOO_STRING_SVTOOLS_RTF_BGDKBDIAG "\\bgdkbdiag" +#define OOO_STRING_SVTOOLS_RTF_BGDKCROSS "\\bgdkcross" +#define OOO_STRING_SVTOOLS_RTF_BGDKDCROSS "\\bgdkdcross" +#define OOO_STRING_SVTOOLS_RTF_BGDKFDIAG "\\bgdkfdiag" +#define OOO_STRING_SVTOOLS_RTF_BGDKHORIZ "\\bgdkhoriz" +#define OOO_STRING_SVTOOLS_RTF_BGDKVERT "\\bgdkvert" +#define OOO_STRING_SVTOOLS_RTF_BGFDIAG "\\bgfdiag" +#define OOO_STRING_SVTOOLS_RTF_BGHORIZ "\\bghoriz" +#define OOO_STRING_SVTOOLS_RTF_BGVERT "\\bgvert" +#define OOO_STRING_SVTOOLS_RTF_BIN "\\bin" +#define OOO_STRING_SVTOOLS_RTF_BINFSXN "\\binfsxn" +#define OOO_STRING_SVTOOLS_RTF_BINSXN "\\binsxn" +#define OOO_STRING_SVTOOLS_RTF_BKMKCOLF "\\bkmkcolf" +#define OOO_STRING_SVTOOLS_RTF_BKMKCOLL "\\bkmkcoll" +#define OOO_STRING_SVTOOLS_RTF_BKMKEND "\\bkmkend" +#define OOO_STRING_SVTOOLS_RTF_BKMKSTART "\\bkmkstart" +#define OOO_STRING_SVTOOLS_RTF_BLUE "\\blue" +#define OOO_STRING_SVTOOLS_RTF_BOX "\\box" +#define OOO_STRING_SVTOOLS_RTF_BRDRB "\\brdrb" +#define OOO_STRING_SVTOOLS_RTF_BRDRBAR "\\brdrbar" +#define OOO_STRING_SVTOOLS_RTF_BRDRBTW "\\brdrbtw" +#define OOO_STRING_SVTOOLS_RTF_BRDRCF "\\brdrcf" +#define OOO_STRING_SVTOOLS_RTF_BRDRDB "\\brdrdb" +#define OOO_STRING_SVTOOLS_RTF_BRDRDOT "\\brdrdot" +#define OOO_STRING_SVTOOLS_RTF_BRDRHAIR "\\brdrhair" +#define OOO_STRING_SVTOOLS_RTF_BRDRL "\\brdrl" +#define OOO_STRING_SVTOOLS_RTF_BRDRR "\\brdrr" +#define OOO_STRING_SVTOOLS_RTF_BRDRS "\\brdrs" +#define OOO_STRING_SVTOOLS_RTF_BRDRSH "\\brdrsh" +#define OOO_STRING_SVTOOLS_RTF_BRDRT "\\brdrt" +#define OOO_STRING_SVTOOLS_RTF_BRDRTH "\\brdrth" +#define OOO_STRING_SVTOOLS_RTF_BRDRW "\\brdrw" +#define OOO_STRING_SVTOOLS_RTF_BRSP "\\brsp" +#define OOO_STRING_SVTOOLS_RTF_BULLET "\\bullet" +#define OOO_STRING_SVTOOLS_RTF_BUPTIM "\\buptim" +#define OOO_STRING_SVTOOLS_RTF_BXE "\\bxe" +#define OOO_STRING_SVTOOLS_RTF_CAPS "\\caps" +#define OOO_STRING_SVTOOLS_RTF_CB "\\cb" +#define OOO_STRING_SVTOOLS_RTF_CBPAT "\\cbpat" +#define OOO_STRING_SVTOOLS_RTF_CELL "\\cell" +#define OOO_STRING_SVTOOLS_RTF_CELLX "\\cellx" +#define OOO_STRING_SVTOOLS_RTF_CF "\\cf" +#define OOO_STRING_SVTOOLS_RTF_CFPAT "\\cfpat" +#define OOO_STRING_SVTOOLS_RTF_CHATN "\\chatn" +#define OOO_STRING_SVTOOLS_RTF_CHDATE "\\chdate" +#define OOO_STRING_SVTOOLS_RTF_CHDPA "\\chdpa" +#define OOO_STRING_SVTOOLS_RTF_CHDPL "\\chdpl" +#define OOO_STRING_SVTOOLS_RTF_CHFTN "\\chftn" +#define OOO_STRING_SVTOOLS_RTF_CHFTNSEP "\\chftnsep" +#define OOO_STRING_SVTOOLS_RTF_CHFTNSEPC "\\chftnsepc" +#define OOO_STRING_SVTOOLS_RTF_CHPGN "\\chpgn" +#define OOO_STRING_SVTOOLS_RTF_CHTIME "\\chtime" +#define OOO_STRING_SVTOOLS_RTF_CLBGBDIAG "\\clbgbdiag" +#define OOO_STRING_SVTOOLS_RTF_CLBGCROSS "\\clbgcross" +#define OOO_STRING_SVTOOLS_RTF_CLBGDCROSS "\\clbgdcross" +#define OOO_STRING_SVTOOLS_RTF_CLBGDKBDIAG "\\clbgdkbdiag" +#define OOO_STRING_SVTOOLS_RTF_CLBGDKCROSS "\\clbgdkcross" +#define OOO_STRING_SVTOOLS_RTF_CLBGDKDCROSS "\\clbgdkdcross" +#define OOO_STRING_SVTOOLS_RTF_CLBGDKFDIAG "\\clbgdkfdiag" +#define OOO_STRING_SVTOOLS_RTF_CLBGDKHOR "\\clbgdkhor" +#define OOO_STRING_SVTOOLS_RTF_CLBGDKVERT "\\clbgdkvert" +#define OOO_STRING_SVTOOLS_RTF_CLBGFDIAG "\\clbgfdiag" +#define OOO_STRING_SVTOOLS_RTF_CLBGHORIZ "\\clbghoriz" +#define OOO_STRING_SVTOOLS_RTF_CLBGVERT "\\clbgvert" +#define OOO_STRING_SVTOOLS_RTF_CLBRDRB "\\clbrdrb" +#define OOO_STRING_SVTOOLS_RTF_CLBRDRL "\\clbrdrl" +#define OOO_STRING_SVTOOLS_RTF_CLBRDRR "\\clbrdrr" +#define OOO_STRING_SVTOOLS_RTF_CLBRDRT "\\clbrdrt" +#define OOO_STRING_SVTOOLS_RTF_CLCBPAT "\\clcbpat" +#define OOO_STRING_SVTOOLS_RTF_CLCFPAT "\\clcfpat" +#define OOO_STRING_SVTOOLS_RTF_CLMGF "\\clmgf" +#define OOO_STRING_SVTOOLS_RTF_CLMRG "\\clmrg" +#define OOO_STRING_SVTOOLS_RTF_CLSHDNG "\\clshdng" +#define OOO_STRING_SVTOOLS_RTF_COLNO "\\colno" +#define OOO_STRING_SVTOOLS_RTF_COLORTBL "\\colortbl" +#define OOO_STRING_SVTOOLS_RTF_COLS "\\cols" +#define OOO_STRING_SVTOOLS_RTF_COLSR "\\colsr" +#define OOO_STRING_SVTOOLS_RTF_COLSX "\\colsx" +#define OOO_STRING_SVTOOLS_RTF_COLUMN "\\column" +#define OOO_STRING_SVTOOLS_RTF_COLW "\\colw" +#define OOO_STRING_SVTOOLS_RTF_COMMENT "\\comment" +#define OOO_STRING_SVTOOLS_RTF_CREATIM "\\creatim" +#define OOO_STRING_SVTOOLS_RTF_CTRL "\\ctrl" +#define OOO_STRING_SVTOOLS_RTF_DEFF "\\deff" +#define OOO_STRING_SVTOOLS_RTF_DEFFORMAT "\\defformat" +#define OOO_STRING_SVTOOLS_RTF_DEFLANG "\\deflang" +#define OOO_STRING_SVTOOLS_RTF_DEFTAB "\\deftab" +#define OOO_STRING_SVTOOLS_RTF_DELETED "\\deleted" +#define OOO_STRING_SVTOOLS_RTF_DFRMTXTX "\\dfrmtxtx" +#define OOO_STRING_SVTOOLS_RTF_DFRMTXTY "\\dfrmtxty" +#define OOO_STRING_SVTOOLS_RTF_DIBITMAP "\\dibitmap" +#define OOO_STRING_SVTOOLS_RTF_DN "\\dn" +#define OOO_STRING_SVTOOLS_RTF_DOCCOMM "\\doccomm" +#define OOO_STRING_SVTOOLS_RTF_DOCTEMP "\\doctemp" +#define OOO_STRING_SVTOOLS_RTF_DROPCAPLI "\\dropcapli" +#define OOO_STRING_SVTOOLS_RTF_DROPCAPT "\\dropcapt" +#define OOO_STRING_SVTOOLS_RTF_ABSNOOVRLP "\\absnoovrlp" +#define OOO_STRING_SVTOOLS_RTF_DXFRTEXT "\\dxfrtext" +#define OOO_STRING_SVTOOLS_RTF_DY "\\dy" +#define OOO_STRING_SVTOOLS_RTF_EDMINS "\\edmins" +#define OOO_STRING_SVTOOLS_RTF_EMDASH "\\emdash" +#define OOO_STRING_SVTOOLS_RTF_ENDASH "\\endash" +#define OOO_STRING_SVTOOLS_RTF_ENDDOC "\\enddoc" +#define OOO_STRING_SVTOOLS_RTF_ENDNHERE "\\endnhere" +#define OOO_STRING_SVTOOLS_RTF_ENDNOTES "\\endnotes" +#define OOO_STRING_SVTOOLS_RTF_EXPND "\\expnd" +#define OOO_STRING_SVTOOLS_RTF_EXPNDTW "\\expndtw" +#define OOO_STRING_SVTOOLS_RTF_F "\\f" +#define OOO_STRING_SVTOOLS_RTF_FACINGP "\\facingp" +#define OOO_STRING_SVTOOLS_RTF_FACPGSXN "\\facpgsxn" +#define OOO_STRING_SVTOOLS_RTF_FALT "\\falt" +#define OOO_STRING_SVTOOLS_RTF_FCHARSET "\\fcharset" +#define OOO_STRING_SVTOOLS_RTF_FDECOR "\\fdecor" +#define OOO_STRING_SVTOOLS_RTF_FI "\\fi" +#define OOO_STRING_SVTOOLS_RTF_FIELD "\\field" +#define OOO_STRING_SVTOOLS_RTF_FLDDIRTY "\\flddirty" +#define OOO_STRING_SVTOOLS_RTF_FLDEDIT "\\fldedit" +#define OOO_STRING_SVTOOLS_RTF_FLDINST "\\fldinst" +#define OOO_STRING_SVTOOLS_RTF_FLDLOCK "\\fldlock" +#define OOO_STRING_SVTOOLS_RTF_FLDPRIV "\\fldpriv" +#define OOO_STRING_SVTOOLS_RTF_FLDRSLT "\\fldrslt" +#define OOO_STRING_SVTOOLS_RTF_FMODERN "\\fmodern" +#define OOO_STRING_SVTOOLS_RTF_FN "\\fn" +#define OOO_STRING_SVTOOLS_RTF_FNIL "\\fnil" +#define OOO_STRING_SVTOOLS_RTF_FONTTBL "\\fonttbl" +#define OOO_STRING_SVTOOLS_RTF_FOOTER "\\footer" +#define OOO_STRING_SVTOOLS_RTF_FOOTERF "\\footerf" +#define OOO_STRING_SVTOOLS_RTF_FOOTERL "\\footerl" +#define OOO_STRING_SVTOOLS_RTF_FOOTERR "\\footerr" +#define OOO_STRING_SVTOOLS_RTF_FOOTERY "\\footery" +#define OOO_STRING_SVTOOLS_RTF_FOOTNOTE "\\footnote" +#define OOO_STRING_SVTOOLS_RTF_FPRQ "\\fprq" +#define OOO_STRING_SVTOOLS_RTF_FRACWIDTH "\\fracwidth" +#define OOO_STRING_SVTOOLS_RTF_FROMAN "\\froman" +#define OOO_STRING_SVTOOLS_RTF_FS "\\fs" +#define OOO_STRING_SVTOOLS_RTF_FSCRIPT "\\fscript" +#define OOO_STRING_SVTOOLS_RTF_FSWISS "\\fswiss" +#define OOO_STRING_SVTOOLS_RTF_FTECH "\\ftech" +#define OOO_STRING_SVTOOLS_RTF_FTNBJ "\\ftnbj" +#define OOO_STRING_SVTOOLS_RTF_FTNCN "\\ftncn" +#define OOO_STRING_SVTOOLS_RTF_FTNRESTART "\\ftnrestart" +#define OOO_STRING_SVTOOLS_RTF_FTNSEP "\\ftnsep" +#define OOO_STRING_SVTOOLS_RTF_FTNSEPC "\\ftnsepc" +#define OOO_STRING_SVTOOLS_RTF_FTNSTART "\\ftnstart" +#define OOO_STRING_SVTOOLS_RTF_FTNTJ "\\ftntj" +#define OOO_STRING_SVTOOLS_RTF_GREEN "\\green" +#define OOO_STRING_SVTOOLS_RTF_GUTTER "\\gutter" +#define OOO_STRING_SVTOOLS_RTF_GUTTERSXN "\\guttersxn" +#define OOO_STRING_SVTOOLS_RTF_HEADER "\\header" +#define OOO_STRING_SVTOOLS_RTF_HEADERF "\\headerf" +#define OOO_STRING_SVTOOLS_RTF_HEADERL "\\headerl" +#define OOO_STRING_SVTOOLS_RTF_HEADERR "\\headerr" +#define OOO_STRING_SVTOOLS_RTF_HEADERY "\\headery" +#define OOO_STRING_SVTOOLS_RTF_HR "\\hr" +#define OOO_STRING_SVTOOLS_RTF_HYPHHOTZ "\\hyphhotz" +#define OOO_STRING_SVTOOLS_RTF_I "\\i" +#define OOO_STRING_SVTOOLS_RTF_ID "\\id" +#define OOO_STRING_SVTOOLS_RTF_INFO "\\info" +#define OOO_STRING_SVTOOLS_RTF_INTBL "\\intbl" +#define OOO_STRING_SVTOOLS_RTF_IXE "\\ixe" +#define OOO_STRING_SVTOOLS_RTF_KEEP "\\keep" +#define OOO_STRING_SVTOOLS_RTF_KEEPN "\\keepn" +#define OOO_STRING_SVTOOLS_RTF_KERNING "\\kerning" +#define OOO_STRING_SVTOOLS_RTF_KEYCODE "\\keycode" +#define OOO_STRING_SVTOOLS_RTF_KEYWORDS "\\keywords" +#define OOO_STRING_SVTOOLS_RTF_LANDSCAPE "\\landscape" +#define OOO_STRING_SVTOOLS_RTF_LANG "\\lang" +#define OOO_STRING_SVTOOLS_RTF_LDBLQUOTE "\\ldblquote" +#define OOO_STRING_SVTOOLS_RTF_LEVEL "\\level" +#define OOO_STRING_SVTOOLS_RTF_LI "\\li" +#define OOO_STRING_SVTOOLS_RTF_LIN "\\lin" +#define OOO_STRING_SVTOOLS_RTF_LINE "\\line" +#define OOO_STRING_SVTOOLS_RTF_LINEBETCOL "\\linebetcol" +#define OOO_STRING_SVTOOLS_RTF_LINECONT "\\linecont" +#define OOO_STRING_SVTOOLS_RTF_LINEMOD "\\linemod" +#define OOO_STRING_SVTOOLS_RTF_LINEPPAGE "\\lineppage" +#define OOO_STRING_SVTOOLS_RTF_LINERESTART "\\linerestart" +#define OOO_STRING_SVTOOLS_RTF_LINESTART "\\linestart" +#define OOO_STRING_SVTOOLS_RTF_LINESTARTS "\\linestarts" +#define OOO_STRING_SVTOOLS_RTF_LINEX "\\linex" +#define OOO_STRING_SVTOOLS_RTF_LNDSCPSXN "\\lndscpsxn" +#define OOO_STRING_SVTOOLS_RTF_LQUOTE "\\lquote" +#define OOO_STRING_SVTOOLS_RTF_MAC "\\mac" +#define OOO_STRING_SVTOOLS_RTF_MACPICT "\\macpict" +#define OOO_STRING_SVTOOLS_RTF_MAKEBACKUP "\\makebackup" +#define OOO_STRING_SVTOOLS_RTF_MARGB "\\margb" +#define OOO_STRING_SVTOOLS_RTF_MARGBSXN "\\margbsxn" +#define OOO_STRING_SVTOOLS_RTF_MARGL "\\margl" +#define OOO_STRING_SVTOOLS_RTF_MARGLSXN "\\marglsxn" +#define OOO_STRING_SVTOOLS_RTF_MARGMIRROR "\\margmirror" +#define OOO_STRING_SVTOOLS_RTF_MARGR "\\margr" +#define OOO_STRING_SVTOOLS_RTF_MARGRSXN "\\margrsxn" +#define OOO_STRING_SVTOOLS_RTF_MARGT "\\margt" +#define OOO_STRING_SVTOOLS_RTF_MARGTSXN "\\margtsxn" +#define OOO_STRING_SVTOOLS_RTF_MIN "\\min" +#define OOO_STRING_SVTOOLS_RTF_MO "\\mo" +#define OOO_STRING_SVTOOLS_RTF_NEXTCSET "\\nextcset" +#define OOO_STRING_SVTOOLS_RTF_NEXTFILE "\\nextfile" +#define OOO_STRING_SVTOOLS_RTF_NOFCHARS "\\nofchars" +#define OOO_STRING_SVTOOLS_RTF_NOFPAGES "\\nofpages" +#define OOO_STRING_SVTOOLS_RTF_NOFWORDS "\\nofwords" +#define OOO_STRING_SVTOOLS_RTF_NOLINE "\\noline" +#define OOO_STRING_SVTOOLS_RTF_NOSUPERSUB "\\nosupersub" +#define OOO_STRING_SVTOOLS_RTF_NOWRAP "\\nowrap" +#define OOO_STRING_SVTOOLS_RTF_OPERATOR "\\operator" +#define OOO_STRING_SVTOOLS_RTF_OUTL "\\outl" +#define OOO_STRING_SVTOOLS_RTF_PAGE "\\page" +#define OOO_STRING_SVTOOLS_RTF_PAGEBB "\\pagebb" +#define OOO_STRING_SVTOOLS_RTF_PAPERH "\\paperh" +#define OOO_STRING_SVTOOLS_RTF_PAPERW "\\paperw" +#define OOO_STRING_SVTOOLS_RTF_PAR "\\par" +#define OOO_STRING_SVTOOLS_RTF_PARD "\\pard" +#define OOO_STRING_SVTOOLS_RTF_PC "\\pc" +#define OOO_STRING_SVTOOLS_RTF_PCA "\\pca" +#define OOO_STRING_SVTOOLS_RTF_PGHSXN "\\pghsxn" +#define OOO_STRING_SVTOOLS_RTF_PGNCONT "\\pgncont" +#define OOO_STRING_SVTOOLS_RTF_PGNDEC "\\pgndec" +#define OOO_STRING_SVTOOLS_RTF_PGNLCLTR "\\pgnlcltr" +#define OOO_STRING_SVTOOLS_RTF_PGNLCRM "\\pgnlcrm" +#define OOO_STRING_SVTOOLS_RTF_PGNRESTART "\\pgnrestart" +#define OOO_STRING_SVTOOLS_RTF_PGNSTART "\\pgnstart" +#define OOO_STRING_SVTOOLS_RTF_PGNSTARTS "\\pgnstarts" +#define OOO_STRING_SVTOOLS_RTF_PGNUCLTR "\\pgnucltr" +#define OOO_STRING_SVTOOLS_RTF_PGNUCRM "\\pgnucrm" +#define OOO_STRING_SVTOOLS_RTF_PGNX "\\pgnx" +#define OOO_STRING_SVTOOLS_RTF_PGNY "\\pgny" +#define OOO_STRING_SVTOOLS_RTF_PGWSXN "\\pgwsxn" +#define OOO_STRING_SVTOOLS_RTF_PHCOL "\\phcol" +#define OOO_STRING_SVTOOLS_RTF_PHMRG "\\phmrg" +#define OOO_STRING_SVTOOLS_RTF_PHPG "\\phpg" +#define OOO_STRING_SVTOOLS_RTF_PICCROPB "\\piccropb" +#define OOO_STRING_SVTOOLS_RTF_PICCROPL "\\piccropl" +#define OOO_STRING_SVTOOLS_RTF_PICCROPR "\\piccropr" +#define OOO_STRING_SVTOOLS_RTF_PICCROPT "\\piccropt" +#define OOO_STRING_SVTOOLS_RTF_PICH "\\pich" +#define OOO_STRING_SVTOOLS_RTF_PICHGOAL "\\pichgoal" +#define OOO_STRING_SVTOOLS_RTF_PICSCALED "\\picscaled" +#define OOO_STRING_SVTOOLS_RTF_PICSCALEX "\\picscalex" +#define OOO_STRING_SVTOOLS_RTF_PICSCALEY "\\picscaley" +#define OOO_STRING_SVTOOLS_RTF_PICT "\\pict" +#define OOO_STRING_SVTOOLS_RTF_PICW "\\picw" +#define OOO_STRING_SVTOOLS_RTF_PICWGOAL "\\picwgoal" +#define OOO_STRING_SVTOOLS_RTF_PLAIN "\\plain" +#define OOO_STRING_SVTOOLS_RTF_PMMETAFILE "\\pmmetafile" +#define OOO_STRING_SVTOOLS_RTF_POSNEGX "\\posnegx" +#define OOO_STRING_SVTOOLS_RTF_POSNEGY "\\posnegy" +#define OOO_STRING_SVTOOLS_RTF_POSX "\\posx" +#define OOO_STRING_SVTOOLS_RTF_POSXC "\\posxc" +#define OOO_STRING_SVTOOLS_RTF_POSXI "\\posxi" +#define OOO_STRING_SVTOOLS_RTF_POSXL "\\posxl" +#define OOO_STRING_SVTOOLS_RTF_POSXO "\\posxo" +#define OOO_STRING_SVTOOLS_RTF_POSXR "\\posxr" +#define OOO_STRING_SVTOOLS_RTF_POSY "\\posy" +#define OOO_STRING_SVTOOLS_RTF_POSYB "\\posyb" +#define OOO_STRING_SVTOOLS_RTF_POSYC "\\posyc" +#define OOO_STRING_SVTOOLS_RTF_POSYIL "\\posyil" +#define OOO_STRING_SVTOOLS_RTF_POSYT "\\posyt" +#define OOO_STRING_SVTOOLS_RTF_PRINTIM "\\printim" +#define OOO_STRING_SVTOOLS_RTF_PSOVER "\\psover" +#define OOO_STRING_SVTOOLS_RTF_PVMRG "\\pvmrg" +#define OOO_STRING_SVTOOLS_RTF_PVPARA "\\pvpara" +#define OOO_STRING_SVTOOLS_RTF_PVPG "\\pvpg" +#define OOO_STRING_SVTOOLS_RTF_QC "\\qc" +#define OOO_STRING_SVTOOLS_RTF_QJ "\\qj" +#define OOO_STRING_SVTOOLS_RTF_QL "\\ql" +#define OOO_STRING_SVTOOLS_RTF_QR "\\qr" +#define OOO_STRING_SVTOOLS_RTF_RDBLQUOTE "\\rdblquote" +#define OOO_STRING_SVTOOLS_RTF_RED "\\red" +#define OOO_STRING_SVTOOLS_RTF_REVBAR "\\revbar" +#define OOO_STRING_SVTOOLS_RTF_REVISED "\\revised" +#define OOO_STRING_SVTOOLS_RTF_REVISIONS "\\revisions" +#define OOO_STRING_SVTOOLS_RTF_REVPROP "\\revprop" +#define OOO_STRING_SVTOOLS_RTF_REVTIM "\\revtim" +#define OOO_STRING_SVTOOLS_RTF_RI "\\ri" +#define OOO_STRING_SVTOOLS_RTF_RIN "\\rin" +#define OOO_STRING_SVTOOLS_RTF_ROW "\\row" +#define OOO_STRING_SVTOOLS_RTF_RQUOTE "\\rquote" +#define OOO_STRING_SVTOOLS_RTF_RTF "\\rtf" +#define OOO_STRING_SVTOOLS_RTF_RXE "\\rxe" +#define OOO_STRING_SVTOOLS_RTF_S "\\s" +#define OOO_STRING_SVTOOLS_RTF_SA "\\sa" +#define OOO_STRING_SVTOOLS_RTF_SB "\\sb" +#define OOO_STRING_SVTOOLS_RTF_SBASEDON "\\sbasedon" +#define OOO_STRING_SVTOOLS_RTF_SBKCOL "\\sbkcol" +#define OOO_STRING_SVTOOLS_RTF_SBKEVEN "\\sbkeven" +#define OOO_STRING_SVTOOLS_RTF_SBKNONE "\\sbknone" +#define OOO_STRING_SVTOOLS_RTF_SBKODD "\\sbkodd" +#define OOO_STRING_SVTOOLS_RTF_SBKPAGE "\\sbkpage" +#define OOO_STRING_SVTOOLS_RTF_SBYS "\\sbys" +#define OOO_STRING_SVTOOLS_RTF_SCAPS "\\scaps" +#define OOO_STRING_SVTOOLS_RTF_SECT "\\sect" +#define OOO_STRING_SVTOOLS_RTF_SECTD "\\sectd" +#define OOO_STRING_SVTOOLS_RTF_SHAD "\\shad" +#define OOO_STRING_SVTOOLS_RTF_SHADING "\\shading" +#define OOO_STRING_SVTOOLS_RTF_SHIFT "\\shift" +#define OOO_STRING_SVTOOLS_RTF_SL "\\sl" +#define OOO_STRING_SVTOOLS_RTF_SNEXT "\\snext" +#define OOO_STRING_SVTOOLS_RTF_STRIKE "\\strike" +#define OOO_STRING_SVTOOLS_RTF_STYLESHEET "\\stylesheet" +#define OOO_STRING_SVTOOLS_RTF_SUB "\\sub" +#define OOO_STRING_SVTOOLS_RTF_SUBJECT "\\subject" +#define OOO_STRING_SVTOOLS_RTF_SUPER "\\super" +#define OOO_STRING_SVTOOLS_RTF_TAB "\\tab" +#define OOO_STRING_SVTOOLS_RTF_TB "\\tb" +#define OOO_STRING_SVTOOLS_RTF_TC "\\tc" +#define OOO_STRING_SVTOOLS_RTF_TCF "\\tcf" +#define OOO_STRING_SVTOOLS_RTF_TCL "\\tcl" +#define OOO_STRING_SVTOOLS_RTF_TEMPLATE "\\template" +#define OOO_STRING_SVTOOLS_RTF_TITLE "\\title" +#define OOO_STRING_SVTOOLS_RTF_TITLEPG "\\titlepg" +#define OOO_STRING_SVTOOLS_RTF_TLDOT "\\tldot" +#define OOO_STRING_SVTOOLS_RTF_TLEQ "\\tleq" +#define OOO_STRING_SVTOOLS_RTF_TLHYPH "\\tlhyph" +#define OOO_STRING_SVTOOLS_RTF_TLTH "\\tlth" +#define OOO_STRING_SVTOOLS_RTF_TLUL "\\tlul" +#define OOO_STRING_SVTOOLS_RTF_TQC "\\tqc" +#define OOO_STRING_SVTOOLS_RTF_TQDEC "\\tqdec" +#define OOO_STRING_SVTOOLS_RTF_TQR "\\tqr" +#define OOO_STRING_SVTOOLS_RTF_TQL "\\tql" +#define OOO_STRING_SVTOOLS_RTF_TRGAPH "\\trgaph" +#define OOO_STRING_SVTOOLS_RTF_TRLEFT "\\trleft" +#define OOO_STRING_SVTOOLS_RTF_TROWD "\\trowd" +#define OOO_STRING_SVTOOLS_RTF_TRQC "\\trqc" +#define OOO_STRING_SVTOOLS_RTF_TRQL "\\trql" +#define OOO_STRING_SVTOOLS_RTF_TRQR "\\trqr" +#define OOO_STRING_SVTOOLS_RTF_TRRH "\\trrh" +#define OOO_STRING_SVTOOLS_RTF_TX "\\tx" +#define OOO_STRING_SVTOOLS_RTF_TXE "\\txe" +#define OOO_STRING_SVTOOLS_RTF_UL "\\ul" +#define OOO_STRING_SVTOOLS_RTF_ULD "\\uld" +#define OOO_STRING_SVTOOLS_RTF_ULDB "\\uldb" +#define OOO_STRING_SVTOOLS_RTF_ULNONE "\\ulnone" +#define OOO_STRING_SVTOOLS_RTF_ULW "\\ulw" +#define OOO_STRING_SVTOOLS_RTF_UP "\\up" +#define OOO_STRING_SVTOOLS_RTF_V "\\v" +#define OOO_STRING_SVTOOLS_RTF_VERN "\\vern" +#define OOO_STRING_SVTOOLS_RTF_VERSION "\\version" +#define OOO_STRING_SVTOOLS_RTF_VERTALB "\\vertalb" +#define OOO_STRING_SVTOOLS_RTF_VERTALC "\\vertalc" +#define OOO_STRING_SVTOOLS_RTF_VERTALJ "\\vertalj" +#define OOO_STRING_SVTOOLS_RTF_VERTALT "\\vertalt" +#define OOO_STRING_SVTOOLS_RTF_WBITMAP "\\wbitmap" +#define OOO_STRING_SVTOOLS_RTF_WBMBITSPIXEL "\\wbmbitspixel" +#define OOO_STRING_SVTOOLS_RTF_WBMPLANES "\\wbmplanes" +#define OOO_STRING_SVTOOLS_RTF_WBMWIDTHBYTES "\\wbmwidthbytes" +#define OOO_STRING_SVTOOLS_RTF_WIDOWCTRL "\\widowctrl" +#define OOO_STRING_SVTOOLS_RTF_WMETAFILE "\\wmetafile" +#define OOO_STRING_SVTOOLS_RTF_XE "\\xe" +#define OOO_STRING_SVTOOLS_RTF_YR "\\yr" +#define OOO_STRING_SVTOOLS_RTF_NOBRKHYPH "\\_" +#define OOO_STRING_SVTOOLS_RTF_FORMULA "\\|" +#define OOO_STRING_SVTOOLS_RTF_NOBREAK "\\~" +#define OOO_STRING_SVTOOLS_RTF_AB "\\ab" +#define OOO_STRING_SVTOOLS_RTF_ACAPS "\\acaps" +#define OOO_STRING_SVTOOLS_RTF_ACF "\\acf" +#define OOO_STRING_SVTOOLS_RTF_ADDITIVE "\\additive" +#define OOO_STRING_SVTOOLS_RTF_ADN "\\adn" +#define OOO_STRING_SVTOOLS_RTF_AENDDOC "\\aenddoc" +#define OOO_STRING_SVTOOLS_RTF_AENDNOTES "\\aendnotes" +#define OOO_STRING_SVTOOLS_RTF_AEXPND "\\aexpnd" +#define OOO_STRING_SVTOOLS_RTF_AF "\\af" +#define OOO_STRING_SVTOOLS_RTF_AFS "\\afs" +#define OOO_STRING_SVTOOLS_RTF_AFTNBJ "\\aftnbj" +#define OOO_STRING_SVTOOLS_RTF_AFTNCN "\\aftncn" +#define OOO_STRING_SVTOOLS_RTF_AFTNNALC "\\aftnnalc" +#define OOO_STRING_SVTOOLS_RTF_AFTNNAR "\\aftnnar" +#define OOO_STRING_SVTOOLS_RTF_AFTNNAUC "\\aftnnauc" +#define OOO_STRING_SVTOOLS_RTF_AFTNNCHI "\\aftnnchi" +#define OOO_STRING_SVTOOLS_RTF_AFTNNRLC "\\aftnnrlc" +#define OOO_STRING_SVTOOLS_RTF_AFTNNRUC "\\aftnnruc" +#define OOO_STRING_SVTOOLS_RTF_AFTNRESTART "\\aftnrestart" +#define OOO_STRING_SVTOOLS_RTF_AFTNRSTCONT "\\aftnrstcont" +#define OOO_STRING_SVTOOLS_RTF_AFTNSEP "\\aftnsep" +#define OOO_STRING_SVTOOLS_RTF_AFTNSEPC "\\aftnsepc" +#define OOO_STRING_SVTOOLS_RTF_AFTNSTART "\\aftnstart" +#define OOO_STRING_SVTOOLS_RTF_AFTNTJ "\\aftntj" +#define OOO_STRING_SVTOOLS_RTF_AI "\\ai" +#define OOO_STRING_SVTOOLS_RTF_ALANG "\\alang" +#define OOO_STRING_SVTOOLS_RTF_ALLPROT "\\allprot" +#define OOO_STRING_SVTOOLS_RTF_ANNOTPROT "\\annotprot" +#define OOO_STRING_SVTOOLS_RTF_AOUTL "\\aoutl" +#define OOO_STRING_SVTOOLS_RTF_ASCAPS "\\ascaps" +#define OOO_STRING_SVTOOLS_RTF_ASHAD "\\ashad" +#define OOO_STRING_SVTOOLS_RTF_ASTRIKE "\\astrike" +#define OOO_STRING_SVTOOLS_RTF_ATNAUTHOR "\\atnauthor" +#define OOO_STRING_SVTOOLS_RTF_ATNICN "\\atnicn" +#define OOO_STRING_SVTOOLS_RTF_ATNREF "\\atnref" +#define OOO_STRING_SVTOOLS_RTF_ATNTIME "\\atntime" +#define OOO_STRING_SVTOOLS_RTF_ATRFEND "\\atrfend" +#define OOO_STRING_SVTOOLS_RTF_ATRFSTART "\\atrfstart" +#define OOO_STRING_SVTOOLS_RTF_AUL "\\aul" +#define OOO_STRING_SVTOOLS_RTF_AULD "\\auld" +#define OOO_STRING_SVTOOLS_RTF_AULDB "\\auldb" +#define OOO_STRING_SVTOOLS_RTF_AULNONE "\\aulnone" +#define OOO_STRING_SVTOOLS_RTF_AULW "\\aulw" +#define OOO_STRING_SVTOOLS_RTF_AUP "\\aup" +#define OOO_STRING_SVTOOLS_RTF_BKMKPUB "\\bkmkpub" +#define OOO_STRING_SVTOOLS_RTF_BRDRDASH "\\brdrdash" +#define OOO_STRING_SVTOOLS_RTF_BRKFRM "\\brkfrm" +#define OOO_STRING_SVTOOLS_RTF_CCHS "\\cchs" +#define OOO_STRING_SVTOOLS_RTF_CPG "\\cpg" +#define OOO_STRING_SVTOOLS_RTF_CS "\\cs" +#define OOO_STRING_SVTOOLS_RTF_CVMME "\\cvmme" +#define OOO_STRING_SVTOOLS_RTF_DATAFIELD "\\datafield" +#define OOO_STRING_SVTOOLS_RTF_DO "\\do" +#define OOO_STRING_SVTOOLS_RTF_DOBXCOLUMN "\\dobxcolumn" +#define OOO_STRING_SVTOOLS_RTF_DOBXMARGIN "\\dobxmargin" +#define OOO_STRING_SVTOOLS_RTF_DOBXPAGE "\\dobxpage" +#define OOO_STRING_SVTOOLS_RTF_DOBYMARGIN "\\dobymargin" +#define OOO_STRING_SVTOOLS_RTF_DOBYPAGE "\\dobypage" +#define OOO_STRING_SVTOOLS_RTF_DOBYPARA "\\dobypara" +#define OOO_STRING_SVTOOLS_RTF_DODHGT "\\dodhgt" +#define OOO_STRING_SVTOOLS_RTF_DOLOCK "\\dolock" +#define OOO_STRING_SVTOOLS_RTF_DPAENDHOL "\\dpaendhol" +#define OOO_STRING_SVTOOLS_RTF_DPAENDL "\\dpaendl" +#define OOO_STRING_SVTOOLS_RTF_DPAENDSOL "\\dpaendsol" +#define OOO_STRING_SVTOOLS_RTF_DPAENDW "\\dpaendw" +#define OOO_STRING_SVTOOLS_RTF_DPARC "\\dparc" +#define OOO_STRING_SVTOOLS_RTF_DPARCFLIPX "\\dparcflipx" +#define OOO_STRING_SVTOOLS_RTF_DPARCFLIPY "\\dparcflipy" +#define OOO_STRING_SVTOOLS_RTF_DPASTARTHOL "\\dpastarthol" +#define OOO_STRING_SVTOOLS_RTF_DPASTARTL "\\dpastartl" +#define OOO_STRING_SVTOOLS_RTF_DPASTARTSOL "\\dpastartsol" +#define OOO_STRING_SVTOOLS_RTF_DPASTARTW "\\dpastartw" +#define OOO_STRING_SVTOOLS_RTF_DPCALLOUT "\\dpcallout" +#define OOO_STRING_SVTOOLS_RTF_DPCOA "\\dpcoa" +#define OOO_STRING_SVTOOLS_RTF_DPCOACCENT "\\dpcoaccent" +#define OOO_STRING_SVTOOLS_RTF_DPCOBESTFIT "\\dpcobestfit" +#define OOO_STRING_SVTOOLS_RTF_DPCOBORDER "\\dpcoborder" +#define OOO_STRING_SVTOOLS_RTF_DPCODABS "\\dpcodabs" +#define OOO_STRING_SVTOOLS_RTF_DPCODBOTTOM "\\dpcodbottom" +#define OOO_STRING_SVTOOLS_RTF_DPCODCENTER "\\dpcodcenter" +#define OOO_STRING_SVTOOLS_RTF_DPCODTOP "\\dpcodtop" +#define OOO_STRING_SVTOOLS_RTF_DPCOLENGTH "\\dpcolength" +#define OOO_STRING_SVTOOLS_RTF_DPCOMINUSX "\\dpcominusx" +#define OOO_STRING_SVTOOLS_RTF_DPCOMINUSY "\\dpcominusy" +#define OOO_STRING_SVTOOLS_RTF_DPCOOFFSET "\\dpcooffset" +#define OOO_STRING_SVTOOLS_RTF_DPCOSMARTA "\\dpcosmarta" +#define OOO_STRING_SVTOOLS_RTF_DPCOTDOUBLE "\\dpcotdouble" +#define OOO_STRING_SVTOOLS_RTF_DPCOTRIGHT "\\dpcotright" +#define OOO_STRING_SVTOOLS_RTF_DPCOTSINGLE "\\dpcotsingle" +#define OOO_STRING_SVTOOLS_RTF_DPCOTTRIPLE "\\dpcottriple" +#define OOO_STRING_SVTOOLS_RTF_DPCOUNT "\\dpcount" +#define OOO_STRING_SVTOOLS_RTF_DPELLIPSE "\\dpellipse" +#define OOO_STRING_SVTOOLS_RTF_DPENDGROUP "\\dpendgroup" +#define OOO_STRING_SVTOOLS_RTF_DPFILLBGCB "\\dpfillbgcb" +#define OOO_STRING_SVTOOLS_RTF_DPFILLBGCG "\\dpfillbgcg" +#define OOO_STRING_SVTOOLS_RTF_DPFILLBGCR "\\dpfillbgcr" +#define OOO_STRING_SVTOOLS_RTF_DPFILLBGGRAY "\\dpfillbggray" +#define OOO_STRING_SVTOOLS_RTF_DPFILLBGPAL "\\dpfillbgpal" +#define OOO_STRING_SVTOOLS_RTF_DPFILLFGCB "\\dpfillfgcb" +#define OOO_STRING_SVTOOLS_RTF_DPFILLFGCG "\\dpfillfgcg" +#define OOO_STRING_SVTOOLS_RTF_DPFILLFGCR "\\dpfillfgcr" +#define OOO_STRING_SVTOOLS_RTF_DPFILLFGGRAY "\\dpfillfggray" +#define OOO_STRING_SVTOOLS_RTF_DPFILLFGPAL "\\dpfillfgpal" +#define OOO_STRING_SVTOOLS_RTF_DPFILLPAT "\\dpfillpat" +#define OOO_STRING_SVTOOLS_RTF_DPGROUP "\\dpgroup" +#define OOO_STRING_SVTOOLS_RTF_DPLINE "\\dpline" +#define OOO_STRING_SVTOOLS_RTF_DPLINECOB "\\dplinecob" +#define OOO_STRING_SVTOOLS_RTF_DPLINECOG "\\dplinecog" +#define OOO_STRING_SVTOOLS_RTF_DPLINECOR "\\dplinecor" +#define OOO_STRING_SVTOOLS_RTF_DPLINEDADO "\\dplinedado" +#define OOO_STRING_SVTOOLS_RTF_DPLINEDADODO "\\dplinedadodo" +#define OOO_STRING_SVTOOLS_RTF_DPLINEDASH "\\dplinedash" +#define OOO_STRING_SVTOOLS_RTF_DPLINEDOT "\\dplinedot" +#define OOO_STRING_SVTOOLS_RTF_DPLINEGRAY "\\dplinegray" +#define OOO_STRING_SVTOOLS_RTF_DPLINEHOLLOW "\\dplinehollow" +#define OOO_STRING_SVTOOLS_RTF_DPLINEPAL "\\dplinepal" +#define OOO_STRING_SVTOOLS_RTF_DPLINESOLID "\\dplinesolid" +#define OOO_STRING_SVTOOLS_RTF_DPLINEW "\\dplinew" +#define OOO_STRING_SVTOOLS_RTF_DPPOLYCOUNT "\\dppolycount" +#define OOO_STRING_SVTOOLS_RTF_DPPOLYGON "\\dppolygon" +#define OOO_STRING_SVTOOLS_RTF_DPPOLYLINE "\\dppolyline" +#define OOO_STRING_SVTOOLS_RTF_DPPTX "\\dpptx" +#define OOO_STRING_SVTOOLS_RTF_DPPTY "\\dppty" +#define OOO_STRING_SVTOOLS_RTF_DPRECT "\\dprect" +#define OOO_STRING_SVTOOLS_RTF_DPROUNDR "\\dproundr" +#define OOO_STRING_SVTOOLS_RTF_DPSHADOW "\\dpshadow" +#define OOO_STRING_SVTOOLS_RTF_DPSHADX "\\dpshadx" +#define OOO_STRING_SVTOOLS_RTF_DPSHADY "\\dpshady" +#define OOO_STRING_SVTOOLS_RTF_DPTXBX "\\dptxbx" +#define OOO_STRING_SVTOOLS_RTF_DPTXBXMAR "\\dptxbxmar" +#define OOO_STRING_SVTOOLS_RTF_DPTXBXTEXT "\\dptxbxtext" +#define OOO_STRING_SVTOOLS_RTF_DPX "\\dpx" +#define OOO_STRING_SVTOOLS_RTF_DPXSIZE "\\dpxsize" +#define OOO_STRING_SVTOOLS_RTF_DPY "\\dpy" +#define OOO_STRING_SVTOOLS_RTF_DPYSIZE "\\dpysize" +#define OOO_STRING_SVTOOLS_RTF_DS "\\ds" +#define OOO_STRING_SVTOOLS_RTF_EMSPACE "\\emspace" +#define OOO_STRING_SVTOOLS_RTF_ENSPACE "\\enspace" +#define OOO_STRING_SVTOOLS_RTF_FBIDI "\\fbidi" +#define OOO_STRING_SVTOOLS_RTF_FET "\\fet" +#define OOO_STRING_SVTOOLS_RTF_FID "\\fid" +#define OOO_STRING_SVTOOLS_RTF_FILE "\\file" +#define OOO_STRING_SVTOOLS_RTF_FILETBL "\\filetbl" +#define OOO_STRING_SVTOOLS_RTF_FLDALT "\\fldalt" +#define OOO_STRING_SVTOOLS_RTF_FNETWORK "\\fnetwork" +#define OOO_STRING_SVTOOLS_RTF_FONTEMB "\\fontemb" +#define OOO_STRING_SVTOOLS_RTF_FONTFILE "\\fontfile" +#define OOO_STRING_SVTOOLS_RTF_FORMDISP "\\formdisp" +#define OOO_STRING_SVTOOLS_RTF_FORMPROT "\\formprot" +#define OOO_STRING_SVTOOLS_RTF_FORMSHADE "\\formshade" +#define OOO_STRING_SVTOOLS_RTF_FOSNUM "\\fosnum" +#define OOO_STRING_SVTOOLS_RTF_FRELATIVE "\\frelative" +#define OOO_STRING_SVTOOLS_RTF_FTNALT "\\ftnalt" +#define OOO_STRING_SVTOOLS_RTF_FTNIL "\\ftnil" +#define OOO_STRING_SVTOOLS_RTF_FTNNALC "\\ftnnalc" +#define OOO_STRING_SVTOOLS_RTF_FTNNAR "\\ftnnar" +#define OOO_STRING_SVTOOLS_RTF_FTNNAUC "\\ftnnauc" +#define OOO_STRING_SVTOOLS_RTF_FTNNCHI "\\ftnnchi" +#define OOO_STRING_SVTOOLS_RTF_FTNNRLC "\\ftnnrlc" +#define OOO_STRING_SVTOOLS_RTF_FTNNRUC "\\ftnnruc" +#define OOO_STRING_SVTOOLS_RTF_FTNRSTCONT "\\ftnrstcont" +#define OOO_STRING_SVTOOLS_RTF_FTNRSTPG "\\ftnrstpg" +#define OOO_STRING_SVTOOLS_RTF_FTTRUETYPE "\\fttruetype" +#define OOO_STRING_SVTOOLS_RTF_FVALIDDOS "\\fvaliddos" +#define OOO_STRING_SVTOOLS_RTF_FVALIDHPFS "\\fvalidhpfs" +#define OOO_STRING_SVTOOLS_RTF_FVALIDMAC "\\fvalidmac" +#define OOO_STRING_SVTOOLS_RTF_FVALIDNTFS "\\fvalidntfs" +#define OOO_STRING_SVTOOLS_RTF_HYPHAUTO "\\hyphauto" +#define OOO_STRING_SVTOOLS_RTF_HYPHCAPS "\\hyphcaps" +#define OOO_STRING_SVTOOLS_RTF_HYPHCONSEC "\\hyphconsec" +#define OOO_STRING_SVTOOLS_RTF_HYPHPAR "\\hyphpar" +#define OOO_STRING_SVTOOLS_RTF_LINKSELF "\\linkself" +#define OOO_STRING_SVTOOLS_RTF_LINKSTYLES "\\linkstyles" +#define OOO_STRING_SVTOOLS_RTF_LTRCH "\\ltrch" +#define OOO_STRING_SVTOOLS_RTF_LTRDOC "\\ltrdoc" +#define OOO_STRING_SVTOOLS_RTF_LTRMARK "\\ltrmark" +#define OOO_STRING_SVTOOLS_RTF_LTRPAR "\\ltrpar" +#define OOO_STRING_SVTOOLS_RTF_LTRROW "\\ltrrow" +#define OOO_STRING_SVTOOLS_RTF_LTRSECT "\\ltrsect" +#define OOO_STRING_SVTOOLS_RTF_NOCOLBAL "\\nocolbal" +#define OOO_STRING_SVTOOLS_RTF_NOEXTRASPRL "\\noextrasprl" +#define OOO_STRING_SVTOOLS_RTF_NOTABIND "\\notabind" +#define OOO_STRING_SVTOOLS_RTF_NOWIDCTLPAR "\\nowidctlpar" +#define OOO_STRING_SVTOOLS_RTF_OBJALIAS "\\objalias" +#define OOO_STRING_SVTOOLS_RTF_OBJALIGN "\\objalign" +#define OOO_STRING_SVTOOLS_RTF_OBJAUTLINK "\\objautlink" +#define OOO_STRING_SVTOOLS_RTF_OBJCLASS "\\objclass" +#define OOO_STRING_SVTOOLS_RTF_OBJCROPB "\\objcropb" +#define OOO_STRING_SVTOOLS_RTF_OBJCROPL "\\objcropl" +#define OOO_STRING_SVTOOLS_RTF_OBJCROPR "\\objcropr" +#define OOO_STRING_SVTOOLS_RTF_OBJCROPT "\\objcropt" +#define OOO_STRING_SVTOOLS_RTF_OBJDATA "\\objdata" +#define OOO_STRING_SVTOOLS_RTF_OBJECT "\\object" +#define OOO_STRING_SVTOOLS_RTF_OBJEMB "\\objemb" +#define OOO_STRING_SVTOOLS_RTF_OBJH "\\objh" +#define OOO_STRING_SVTOOLS_RTF_OBJICEMB "\\objicemb" +#define OOO_STRING_SVTOOLS_RTF_OBJLINK "\\objlink" +#define OOO_STRING_SVTOOLS_RTF_OBJLOCK "\\objlock" +#define OOO_STRING_SVTOOLS_RTF_OBJNAME "\\objname" +#define OOO_STRING_SVTOOLS_RTF_OBJPUB "\\objpub" +#define OOO_STRING_SVTOOLS_RTF_OBJSCALEX "\\objscalex" +#define OOO_STRING_SVTOOLS_RTF_OBJSCALEY "\\objscaley" +#define OOO_STRING_SVTOOLS_RTF_OBJSECT "\\objsect" +#define OOO_STRING_SVTOOLS_RTF_OBJSETSIZE "\\objsetsize" +#define OOO_STRING_SVTOOLS_RTF_OBJSUB "\\objsub" +#define OOO_STRING_SVTOOLS_RTF_OBJTIME "\\objtime" +#define OOO_STRING_SVTOOLS_RTF_OBJTRANSY "\\objtransy" +#define OOO_STRING_SVTOOLS_RTF_OBJUPDATE "\\objupdate" +#define OOO_STRING_SVTOOLS_RTF_OBJW "\\objw" +#define OOO_STRING_SVTOOLS_RTF_OTBLRUL "\\otblrul" +#define OOO_STRING_SVTOOLS_RTF_PGNHN "\\pgnhn" +#define OOO_STRING_SVTOOLS_RTF_PGNHNSC "\\pgnhnsc" +#define OOO_STRING_SVTOOLS_RTF_PGNHNSH "\\pgnhnsh" +#define OOO_STRING_SVTOOLS_RTF_PGNHNSM "\\pgnhnsm" +#define OOO_STRING_SVTOOLS_RTF_PGNHNSN "\\pgnhnsn" +#define OOO_STRING_SVTOOLS_RTF_PGNHNSP "\\pgnhnsp" +#define OOO_STRING_SVTOOLS_RTF_PICBMP "\\picbmp" +#define OOO_STRING_SVTOOLS_RTF_PICBPP "\\picbpp" +#define OOO_STRING_SVTOOLS_RTF_PN "\\pn" +#define OOO_STRING_SVTOOLS_RTF_PNACROSS "\\pnacross" +#define OOO_STRING_SVTOOLS_RTF_PNB "\\pnb" +#define OOO_STRING_SVTOOLS_RTF_PNCAPS "\\pncaps" +#define OOO_STRING_SVTOOLS_RTF_PNCARD "\\pncard" +#define OOO_STRING_SVTOOLS_RTF_PNCF "\\pncf" +#define OOO_STRING_SVTOOLS_RTF_PNDEC "\\pndec" +#define OOO_STRING_SVTOOLS_RTF_PNF "\\pnf" +#define OOO_STRING_SVTOOLS_RTF_PNFS "\\pnfs" +#define OOO_STRING_SVTOOLS_RTF_PNHANG "\\pnhang" +#define OOO_STRING_SVTOOLS_RTF_PNI "\\pni" +#define OOO_STRING_SVTOOLS_RTF_PNINDENT "\\pnindent" +#define OOO_STRING_SVTOOLS_RTF_PNLCLTR "\\pnlcltr" +#define OOO_STRING_SVTOOLS_RTF_PNLCRM "\\pnlcrm" +#define OOO_STRING_SVTOOLS_RTF_PNLVL "\\pnlvl" +#define OOO_STRING_SVTOOLS_RTF_PNLVLBLT "\\pnlvlblt" +#define OOO_STRING_SVTOOLS_RTF_PNLVLBODY "\\pnlvlbody" +#define OOO_STRING_SVTOOLS_RTF_PNLVLCONT "\\pnlvlcont" +#define OOO_STRING_SVTOOLS_RTF_PNNUMONCE "\\pnnumonce" +#define OOO_STRING_SVTOOLS_RTF_PNORD "\\pnord" +#define OOO_STRING_SVTOOLS_RTF_PNORDT "\\pnordt" +#define OOO_STRING_SVTOOLS_RTF_PNPREV "\\pnprev" +#define OOO_STRING_SVTOOLS_RTF_PNQC "\\pnqc" +#define OOO_STRING_SVTOOLS_RTF_PNQL "\\pnql" +#define OOO_STRING_SVTOOLS_RTF_PNQR "\\pnqr" +#define OOO_STRING_SVTOOLS_RTF_PNRESTART "\\pnrestart" +#define OOO_STRING_SVTOOLS_RTF_PNSCAPS "\\pnscaps" +#define OOO_STRING_SVTOOLS_RTF_PNSECLVL "\\pnseclvl" +#define OOO_STRING_SVTOOLS_RTF_PNSP "\\pnsp" +#define OOO_STRING_SVTOOLS_RTF_PNSTART "\\pnstart" +#define OOO_STRING_SVTOOLS_RTF_PNSTRIKE "\\pnstrike" +#define OOO_STRING_SVTOOLS_RTF_PNTEXT "\\pntext" +#define OOO_STRING_SVTOOLS_RTF_PNTXTA "\\pntxta" +#define OOO_STRING_SVTOOLS_RTF_PNTXTB "\\pntxtb" +#define OOO_STRING_SVTOOLS_RTF_PNUCLTR "\\pnucltr" +#define OOO_STRING_SVTOOLS_RTF_PNUCRM "\\pnucrm" +#define OOO_STRING_SVTOOLS_RTF_PNUL "\\pnul" +#define OOO_STRING_SVTOOLS_RTF_PNULD "\\pnuld" +#define OOO_STRING_SVTOOLS_RTF_PNULDB "\\pnuldb" +#define OOO_STRING_SVTOOLS_RTF_PNULNONE "\\pnulnone" +#define OOO_STRING_SVTOOLS_RTF_PNULW "\\pnulw" +#define OOO_STRING_SVTOOLS_RTF_PRCOLBL "\\prcolbl" +#define OOO_STRING_SVTOOLS_RTF_PRINTDATA "\\printdata" +#define OOO_STRING_SVTOOLS_RTF_PSZ "\\psz" +#define OOO_STRING_SVTOOLS_RTF_PUBAUTO "\\pubauto" +#define OOO_STRING_SVTOOLS_RTF_RESULT "\\result" +#define OOO_STRING_SVTOOLS_RTF_REVAUTH "\\revauth" +#define OOO_STRING_SVTOOLS_RTF_REVDTTM "\\revdttm" +#define OOO_STRING_SVTOOLS_RTF_REVPROT "\\revprot" +#define OOO_STRING_SVTOOLS_RTF_REVTBL "\\revtbl" +#define OOO_STRING_SVTOOLS_RTF_RSLTBMP "\\rsltbmp" +#define OOO_STRING_SVTOOLS_RTF_RSLTMERGE "\\rsltmerge" +#define OOO_STRING_SVTOOLS_RTF_RSLTPICT "\\rsltpict" +#define OOO_STRING_SVTOOLS_RTF_RSLTRTF "\\rsltrtf" +#define OOO_STRING_SVTOOLS_RTF_RSLTTXT "\\rslttxt" +#define OOO_STRING_SVTOOLS_RTF_RTLCH "\\rtlch" +#define OOO_STRING_SVTOOLS_RTF_RTLDOC "\\rtldoc" +#define OOO_STRING_SVTOOLS_RTF_RTLMARK "\\rtlmark" +#define OOO_STRING_SVTOOLS_RTF_RTLPAR "\\rtlpar" +#define OOO_STRING_SVTOOLS_RTF_RTLROW "\\rtlrow" +#define OOO_STRING_SVTOOLS_RTF_RTLSECT "\\rtlsect" +#define OOO_STRING_SVTOOLS_RTF_SEC "\\sec" +#define OOO_STRING_SVTOOLS_RTF_SECTNUM "\\sectnum" +#define OOO_STRING_SVTOOLS_RTF_SECTUNLOCKED "\\sectunlocked" +#define OOO_STRING_SVTOOLS_RTF_SLMULT "\\slmult" +#define OOO_STRING_SVTOOLS_RTF_SOFTCOL "\\softcol" +#define OOO_STRING_SVTOOLS_RTF_SOFTLHEIGHT "\\softlheight" +#define OOO_STRING_SVTOOLS_RTF_SOFTLINE "\\softline" +#define OOO_STRING_SVTOOLS_RTF_SOFTPAGE "\\softpage" +#define OOO_STRING_SVTOOLS_RTF_SPRSSPBF "\\sprsspbf" +#define OOO_STRING_SVTOOLS_RTF_SPRSTSP "\\sprstsp" +#define OOO_STRING_SVTOOLS_RTF_SUBDOCUMENT "\\subdocument" +#define OOO_STRING_SVTOOLS_RTF_SWPBDR "\\swpbdr" +#define OOO_STRING_SVTOOLS_RTF_TCN "\\tcn" +#define OOO_STRING_SVTOOLS_RTF_TRANSMF "\\transmf" +#define OOO_STRING_SVTOOLS_RTF_TRBRDRB "\\trbrdrb" +#define OOO_STRING_SVTOOLS_RTF_TRBRDRH "\\trbrdrh" +#define OOO_STRING_SVTOOLS_RTF_TRBRDRL "\\trbrdrl" +#define OOO_STRING_SVTOOLS_RTF_TRBRDRR "\\trbrdrr" +#define OOO_STRING_SVTOOLS_RTF_TRBRDRT "\\trbrdrt" +#define OOO_STRING_SVTOOLS_RTF_TRBRDRV "\\trbrdrv" +#define OOO_STRING_SVTOOLS_RTF_TRHDR "\\trhdr" +#define OOO_STRING_SVTOOLS_RTF_TRKEEP "\\trkeep" +#define OOO_STRING_SVTOOLS_RTF_TRPADDB "\\trpaddb" +#define OOO_STRING_SVTOOLS_RTF_TRPADDL "\\trpaddl" +#define OOO_STRING_SVTOOLS_RTF_TRPADDR "\\trpaddr" +#define OOO_STRING_SVTOOLS_RTF_TRPADDT "\\trpaddt" +#define OOO_STRING_SVTOOLS_RTF_TRPADDFB "\\trpaddfb" +#define OOO_STRING_SVTOOLS_RTF_TRPADDFL "\\trpaddfl" +#define OOO_STRING_SVTOOLS_RTF_TRPADDFR "\\trpaddfr" +#define OOO_STRING_SVTOOLS_RTF_TRPADDFT "\\trpaddft" +#define OOO_STRING_SVTOOLS_RTF_WRAPTRSP "\\wraptrsp" +#define OOO_STRING_SVTOOLS_RTF_XEF "\\xef" +#define OOO_STRING_SVTOOLS_RTF_ZWJ "\\zwj" +#define OOO_STRING_SVTOOLS_RTF_ZWNJ "\\zwnj" + +// neue Tokens zur 1.5 +#define OOO_STRING_SVTOOLS_RTF_ABSLOCK "\\abslock" +#define OOO_STRING_SVTOOLS_RTF_ADJUSTRIGHT "\\adjustright" +#define OOO_STRING_SVTOOLS_RTF_AFTNNCHOSUNG "\\aftnnchosung" +#define OOO_STRING_SVTOOLS_RTF_AFTNNCNUM "\\aftnncnum" +#define OOO_STRING_SVTOOLS_RTF_AFTNNDBAR "\\aftnndbar" +#define OOO_STRING_SVTOOLS_RTF_AFTNNDBNUM "\\aftnndbnum" +#define OOO_STRING_SVTOOLS_RTF_AFTNNDBNUMD "\\aftnndbnumd" +#define OOO_STRING_SVTOOLS_RTF_AFTNNDBNUMK "\\aftnndbnumk" +#define OOO_STRING_SVTOOLS_RTF_AFTNNDBNUMT "\\aftnndbnumt" +#define OOO_STRING_SVTOOLS_RTF_AFTNNGANADA "\\aftnnganada" +#define OOO_STRING_SVTOOLS_RTF_AFTNNGBNUM "\\aftnngbnum" +#define OOO_STRING_SVTOOLS_RTF_AFTNNGBNUMD "\\aftnngbnumd" +#define OOO_STRING_SVTOOLS_RTF_AFTNNGBNUMK "\\aftnngbnumk" +#define OOO_STRING_SVTOOLS_RTF_AFTNNGBNUML "\\aftnngbnuml" +#define OOO_STRING_SVTOOLS_RTF_AFTNNZODIAC "\\aftnnzodiac" +#define OOO_STRING_SVTOOLS_RTF_AFTNNZODIACD "\\aftnnzodiacd" +#define OOO_STRING_SVTOOLS_RTF_AFTNNZODIACL "\\aftnnzodiacl" +#define OOO_STRING_SVTOOLS_RTF_ANIMTEXT "\\animtext" +#define OOO_STRING_SVTOOLS_RTF_ANSICPG "\\ansicpg" +#define OOO_STRING_SVTOOLS_RTF_BACKGROUND "\\background" +#define OOO_STRING_SVTOOLS_RTF_BDBFHDR "\\bdbfhdr" +#define OOO_STRING_SVTOOLS_RTF_BLIPTAG "\\bliptag" +#define OOO_STRING_SVTOOLS_RTF_BLIPUID "\\blipuid" +#define OOO_STRING_SVTOOLS_RTF_BLIPUPI "\\blipupi" +#define OOO_STRING_SVTOOLS_RTF_BRDRART "\\brdrart" +#define OOO_STRING_SVTOOLS_RTF_BRDRDASHD "\\brdrdashd" +#define OOO_STRING_SVTOOLS_RTF_BRDRDASHDD "\\brdrdashdd" +#define OOO_STRING_SVTOOLS_RTF_BRDRDASHDOTSTR "\\brdrdashdotstr" +#define OOO_STRING_SVTOOLS_RTF_BRDRDASHSM "\\brdrdashsm" +#define OOO_STRING_SVTOOLS_RTF_BRDREMBOSS "\\brdremboss" +#define OOO_STRING_SVTOOLS_RTF_BRDRENGRAVE "\\brdrengrave" +#define OOO_STRING_SVTOOLS_RTF_BRDRFRAME "\\brdrframe" +#define OOO_STRING_SVTOOLS_RTF_BRDRTHTNLG "\\brdrthtnlg" +#define OOO_STRING_SVTOOLS_RTF_BRDRTHTNMG "\\brdrthtnmg" +#define OOO_STRING_SVTOOLS_RTF_BRDRTHTNSG "\\brdrthtnsg" +#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHLG "\\brdrtnthlg" +#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHMG "\\brdrtnthmg" +#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHSG "\\brdrtnthsg" +#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHTNLG "\\brdrtnthtnlg" +#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHTNMG "\\brdrtnthtnmg" +#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHTNSG "\\brdrtnthtnsg" +#define OOO_STRING_SVTOOLS_RTF_BRDRTRIPLE "\\brdrtriple" +#define OOO_STRING_SVTOOLS_RTF_BRDRWAVY "\\brdrwavy" +#define OOO_STRING_SVTOOLS_RTF_BRDRWAVYDB "\\brdrwavydb" +#define OOO_STRING_SVTOOLS_RTF_CATEGORY "\\category" +#define OOO_STRING_SVTOOLS_RTF_CGRID "\\cgrid" +#define OOO_STRING_SVTOOLS_RTF_CHARSCALEX "\\charscalex" +#define OOO_STRING_SVTOOLS_RTF_CHBGBDIAG "\\chbgbdiag" +#define OOO_STRING_SVTOOLS_RTF_CHBGCROSS "\\chbgcross" +#define OOO_STRING_SVTOOLS_RTF_CHBGDCROSS "\\chbgdcross" +#define OOO_STRING_SVTOOLS_RTF_CHBGDKBDIAG "\\chbgdkbdiag" +#define OOO_STRING_SVTOOLS_RTF_CHBGDKCROSS "\\chbgdkcross" +#define OOO_STRING_SVTOOLS_RTF_CHBGDKDCROSS "\\chbgdkdcross" +#define OOO_STRING_SVTOOLS_RTF_CHBGDKFDIAG "\\chbgdkfdiag" +#define OOO_STRING_SVTOOLS_RTF_CHBGDKHORIZ "\\chbgdkhoriz" +#define OOO_STRING_SVTOOLS_RTF_CHBGDKVERT "\\chbgdkvert" +#define OOO_STRING_SVTOOLS_RTF_CHBGFDIAG "\\chbgfdiag" +#define OOO_STRING_SVTOOLS_RTF_CHBGHORIZ "\\chbghoriz" +#define OOO_STRING_SVTOOLS_RTF_CHBGVERT "\\chbgvert" +#define OOO_STRING_SVTOOLS_RTF_CHBRDR "\\chbrdr" +#define OOO_STRING_SVTOOLS_RTF_CHCBPAT "\\chcbpat" +#define OOO_STRING_SVTOOLS_RTF_CHCFPAT "\\chcfpat" +#define OOO_STRING_SVTOOLS_RTF_CHSHDNG "\\chshdng" +#define OOO_STRING_SVTOOLS_RTF_CLPADL "\\clpadl" +#define OOO_STRING_SVTOOLS_RTF_CLPADT "\\clpadt" +#define OOO_STRING_SVTOOLS_RTF_CLPADB "\\clpadb" +#define OOO_STRING_SVTOOLS_RTF_CLPADR "\\clpadr" +#define OOO_STRING_SVTOOLS_RTF_CLPADFL "\\clpadfl" +#define OOO_STRING_SVTOOLS_RTF_CLPADFT "\\clpadft" +#define OOO_STRING_SVTOOLS_RTF_CLPADFB "\\clpadfb" +#define OOO_STRING_SVTOOLS_RTF_CLPADFR "\\clpadfr" +#define OOO_STRING_SVTOOLS_RTF_CLTXLRTB "\\cltxlrtb" +#define OOO_STRING_SVTOOLS_RTF_CLTXTBRL "\\cltxtbrl" +#define OOO_STRING_SVTOOLS_RTF_CLVERTALB "\\clvertalb" +#define OOO_STRING_SVTOOLS_RTF_CLVERTALC "\\clvertalc" +#define OOO_STRING_SVTOOLS_RTF_CLVERTALT "\\clvertalt" +#define OOO_STRING_SVTOOLS_RTF_CLVMGF "\\clvmgf" +#define OOO_STRING_SVTOOLS_RTF_CLVMRG "\\clvmrg" +#define OOO_STRING_SVTOOLS_RTF_CLTXTBRLV "\\cltxtbrlv" +#define OOO_STRING_SVTOOLS_RTF_CLTXBTLR "\\cltxbtlr" +#define OOO_STRING_SVTOOLS_RTF_CLTXLRTBV "\\cltxlrtbv" +#define OOO_STRING_SVTOOLS_RTF_COMPANY "\\company" +#define OOO_STRING_SVTOOLS_RTF_CRAUTH "\\crauth" +#define OOO_STRING_SVTOOLS_RTF_CRDATE "\\crdate" +#define OOO_STRING_SVTOOLS_RTF_DATE "\\date" +#define OOO_STRING_SVTOOLS_RTF_DEFLANGFE "\\deflangfe" +#define OOO_STRING_SVTOOLS_RTF_DFRAUTH "\\dfrauth" +#define OOO_STRING_SVTOOLS_RTF_DFRDATE "\\dfrdate" +#define OOO_STRING_SVTOOLS_RTF_DFRSTART "\\dfrstart" +#define OOO_STRING_SVTOOLS_RTF_DFRSTOP "\\dfrstop" +#define OOO_STRING_SVTOOLS_RTF_DFRXST "\\dfrxst" +#define OOO_STRING_SVTOOLS_RTF_DGMARGIN "\\dgmargin" +#define OOO_STRING_SVTOOLS_RTF_DNTBLNSBDB "\\dntblnsbdb" +#define OOO_STRING_SVTOOLS_RTF_DOCTYPE "\\doctype" +#define OOO_STRING_SVTOOLS_RTF_DOCVAR "\\docvar" +#define OOO_STRING_SVTOOLS_RTF_DPCODESCENT "\\dpcodescent" +#define OOO_STRING_SVTOOLS_RTF_EMBO "\\embo" +#define OOO_STRING_SVTOOLS_RTF_EMFBLIP "\\emfblip" +#define OOO_STRING_SVTOOLS_RTF_EXPSHRTN "\\expshrtn" +#define OOO_STRING_SVTOOLS_RTF_FAAUTO "\\faauto" +#define OOO_STRING_SVTOOLS_RTF_FBIAS "\\fbias" +#define OOO_STRING_SVTOOLS_RTF_FFDEFRES "\\ffdefres" +#define OOO_STRING_SVTOOLS_RTF_FFDEFTEXT "\\ffdeftext" +#define OOO_STRING_SVTOOLS_RTF_FFENTRYMCR "\\ffentrymcr" +#define OOO_STRING_SVTOOLS_RTF_FFEXITMCR "\\ffexitmcr" +#define OOO_STRING_SVTOOLS_RTF_FFFORMAT "\\ffformat" +#define OOO_STRING_SVTOOLS_RTF_FFHASLISTBOX "\\ffhaslistbox" +#define OOO_STRING_SVTOOLS_RTF_FFHELPTEXT "\\ffhelptext" +#define OOO_STRING_SVTOOLS_RTF_FFHPS "\\ffhps" +#define OOO_STRING_SVTOOLS_RTF_FFL "\\ffl" +#define OOO_STRING_SVTOOLS_RTF_FFMAXLEN "\\ffmaxlen" +#define OOO_STRING_SVTOOLS_RTF_FFNAME "\\ffname" +#define OOO_STRING_SVTOOLS_RTF_FFOWNHELP "\\ffownhelp" +#define OOO_STRING_SVTOOLS_RTF_FFOWNSTAT "\\ffownstat" +#define OOO_STRING_SVTOOLS_RTF_FFPROT "\\ffprot" +#define OOO_STRING_SVTOOLS_RTF_FFRECALC "\\ffrecalc" +#define OOO_STRING_SVTOOLS_RTF_FFRES "\\ffres" +#define OOO_STRING_SVTOOLS_RTF_FFSIZE "\\ffsize" +#define OOO_STRING_SVTOOLS_RTF_FFSTATTEXT "\\ffstattext" +#define OOO_STRING_SVTOOLS_RTF_FFTYPE "\\fftype" +#define OOO_STRING_SVTOOLS_RTF_FFTYPETXT "\\fftypetxt" +#define OOO_STRING_SVTOOLS_RTF_FLDTYPE "\\fldtype" +#define OOO_STRING_SVTOOLS_RTF_FNAME "\\fname" +#define OOO_STRING_SVTOOLS_RTF_FORMFIELD "\\formfield" +#define OOO_STRING_SVTOOLS_RTF_FROMTEXT "\\fromtext" +#define OOO_STRING_SVTOOLS_RTF_FTNNCHOSUNG "\\ftnnchosung" +#define OOO_STRING_SVTOOLS_RTF_FTNNCNUM "\\ftnncnum" +#define OOO_STRING_SVTOOLS_RTF_FTNNDBAR "\\ftnndbar" +#define OOO_STRING_SVTOOLS_RTF_FTNNDBNUM "\\ftnndbnum" +#define OOO_STRING_SVTOOLS_RTF_FTNNDBNUMD "\\ftnndbnumd" +#define OOO_STRING_SVTOOLS_RTF_FTNNDBNUMK "\\ftnndbnumk" +#define OOO_STRING_SVTOOLS_RTF_FTNNDBNUMT "\\ftnndbnumt" +#define OOO_STRING_SVTOOLS_RTF_FTNNGANADA "\\ftnnganada" +#define OOO_STRING_SVTOOLS_RTF_FTNNGBNUM "\\ftnngbnum" +#define OOO_STRING_SVTOOLS_RTF_FTNNGBNUMD "\\ftnngbnumd" +#define OOO_STRING_SVTOOLS_RTF_FTNNGBNUMK "\\ftnngbnumk" +#define OOO_STRING_SVTOOLS_RTF_FTNNGBNUML "\\ftnngbnuml" +#define OOO_STRING_SVTOOLS_RTF_FTNNZODIAC "\\ftnnzodiac" +#define OOO_STRING_SVTOOLS_RTF_FTNNZODIACD "\\ftnnzodiacd" +#define OOO_STRING_SVTOOLS_RTF_FTNNZODIACL "\\ftnnzodiacl" +#define OOO_STRING_SVTOOLS_RTF_G "\\g" +#define OOO_STRING_SVTOOLS_RTF_GCW "\\gcw" +#define OOO_STRING_SVTOOLS_RTF_GRIDTBL "\\gridtbl" +#define OOO_STRING_SVTOOLS_RTF_HIGHLIGHT "\\highlight" +#define OOO_STRING_SVTOOLS_RTF_HLFR "\\hlfr" +#define OOO_STRING_SVTOOLS_RTF_HLINKBASE "\\hlinkbase" +#define OOO_STRING_SVTOOLS_RTF_HLLOC "\\hlloc" +#define OOO_STRING_SVTOOLS_RTF_HLSRC "\\hlsrc" +#define OOO_STRING_SVTOOLS_RTF_ILVL "\\ilvl" +#define OOO_STRING_SVTOOLS_RTF_IMPR "\\impr" +#define OOO_STRING_SVTOOLS_RTF_JPEGBLIP "\\jpegblip" +#define OOO_STRING_SVTOOLS_RTF_LEVELFOLLOW "\\levelfollow" +#define OOO_STRING_SVTOOLS_RTF_LEVELINDENT "\\levelindent" +#define OOO_STRING_SVTOOLS_RTF_LEVELJC "\\leveljc" +#define OOO_STRING_SVTOOLS_RTF_LEVELLEGAL "\\levellegal" +#define OOO_STRING_SVTOOLS_RTF_LEVELNFC "\\levelnfc" +#define OOO_STRING_SVTOOLS_RTF_LEVELNORESTART "\\levelnorestart" +#define OOO_STRING_SVTOOLS_RTF_LEVELNUMBERS "\\levelnumbers" +#define OOO_STRING_SVTOOLS_RTF_LEVELOLD "\\levelold" +#define OOO_STRING_SVTOOLS_RTF_LEVELPREV "\\levelprev" +#define OOO_STRING_SVTOOLS_RTF_LEVELPREVSPACE "\\levelprevspace" +#define OOO_STRING_SVTOOLS_RTF_LEVELSPACE "\\levelspace" +#define OOO_STRING_SVTOOLS_RTF_LEVELSTARTAT "\\levelstartat" +#define OOO_STRING_SVTOOLS_RTF_LEVELTEXT "\\leveltext" +#define OOO_STRING_SVTOOLS_RTF_LINKVAL "\\linkval" +#define OOO_STRING_SVTOOLS_RTF_LIST "\\list" +#define OOO_STRING_SVTOOLS_RTF_LISTID "\\listid" +#define OOO_STRING_SVTOOLS_RTF_LISTLEVEL "\\listlevel" +#define OOO_STRING_SVTOOLS_RTF_LISTNAME "\\listname" +#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDE "\\listoverride" +#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDECOUNT "\\listoverridecount" +#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDEFORMAT "\\listoverrideformat" +#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDESTART "\\listoverridestart" +#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDETABLE "\\listoverridetable" +#define OOO_STRING_SVTOOLS_RTF_LISTRESTARTHDN "\\listrestarthdn" +#define OOO_STRING_SVTOOLS_RTF_LISTSIMPLE "\\listsimple" +#define OOO_STRING_SVTOOLS_RTF_LISTTABLE "\\listtable" +#define OOO_STRING_SVTOOLS_RTF_LISTTEMPLATEID "\\listtemplateid" +#define OOO_STRING_SVTOOLS_RTF_LISTTEXT "\\listtext" +#define OOO_STRING_SVTOOLS_RTF_LS "\\ls" +#define OOO_STRING_SVTOOLS_RTF_LYTEXCTTP "\\lytexcttp" +#define OOO_STRING_SVTOOLS_RTF_LYTPRTMET "\\lytprtmet" +#define OOO_STRING_SVTOOLS_RTF_MANAGER "\\manager" +#define OOO_STRING_SVTOOLS_RTF_MSMCAP "\\msmcap" +#define OOO_STRING_SVTOOLS_RTF_NOFCHARSWS "\\nofcharsws" +#define OOO_STRING_SVTOOLS_RTF_NOLEAD "\\nolead" +#define OOO_STRING_SVTOOLS_RTF_NONSHPPICT "\\nonshppict" +#define OOO_STRING_SVTOOLS_RTF_NOSECTEXPAND "\\nosectexpand" +#define OOO_STRING_SVTOOLS_RTF_NOSNAPLINEGRID "\\nosnaplinegrid" +#define OOO_STRING_SVTOOLS_RTF_NOSPACEFORUL "\\nospaceforul" +#define OOO_STRING_SVTOOLS_RTF_NOULTRLSPC "\\noultrlspc" +#define OOO_STRING_SVTOOLS_RTF_NOXLATTOYEN "\\noxlattoyen" +#define OOO_STRING_SVTOOLS_RTF_OBJATTPH "\\objattph" +#define OOO_STRING_SVTOOLS_RTF_OBJHTML "\\objhtml" +#define OOO_STRING_SVTOOLS_RTF_OBJOCX "\\objocx" +#define OOO_STRING_SVTOOLS_RTF_OLDLINEWRAP "\\oldlinewrap" +#define OOO_STRING_SVTOOLS_RTF_OUTLINELEVEL "\\outlinelevel" +#define OOO_STRING_SVTOOLS_RTF_OVERLAY "\\overlay" +#define OOO_STRING_SVTOOLS_RTF_PANOSE "\\panose" +#define OOO_STRING_SVTOOLS_RTF_PGBRDRB "\\pgbrdrb" +#define OOO_STRING_SVTOOLS_RTF_PGBRDRFOOT "\\pgbrdrfoot" +#define OOO_STRING_SVTOOLS_RTF_PGBRDRHEAD "\\pgbrdrhead" +#define OOO_STRING_SVTOOLS_RTF_PGBRDRL "\\pgbrdrl" +#define OOO_STRING_SVTOOLS_RTF_PGBRDROPT "\\pgbrdropt" +#define OOO_STRING_SVTOOLS_RTF_PGBRDRR "\\pgbrdrr" +#define OOO_STRING_SVTOOLS_RTF_PGBRDRSNAP "\\pgbrdrsnap" +#define OOO_STRING_SVTOOLS_RTF_PGBRDRT "\\pgbrdrt" +#define OOO_STRING_SVTOOLS_RTF_PGNCHOSUNG "\\pgnchosung" +#define OOO_STRING_SVTOOLS_RTF_PGNCNUM "\\pgncnum" +#define OOO_STRING_SVTOOLS_RTF_PGNDBNUMK "\\pgndbnumk" +#define OOO_STRING_SVTOOLS_RTF_PGNDBNUMT "\\pgndbnumt" +#define OOO_STRING_SVTOOLS_RTF_PGNGANADA "\\pgnganada" +#define OOO_STRING_SVTOOLS_RTF_PGNGBNUM "\\pgngbnum" +#define OOO_STRING_SVTOOLS_RTF_PGNGBNUMD "\\pgngbnumd" +#define OOO_STRING_SVTOOLS_RTF_PGNGBNUMK "\\pgngbnumk" +#define OOO_STRING_SVTOOLS_RTF_PGNGBNUML "\\pgngbnuml" +#define OOO_STRING_SVTOOLS_RTF_PGNZODIAC "\\pgnzodiac" +#define OOO_STRING_SVTOOLS_RTF_PGNZODIACD "\\pgnzodiacd" +#define OOO_STRING_SVTOOLS_RTF_PGNZODIACL "\\pgnzodiacl" +#define OOO_STRING_SVTOOLS_RTF_PICPROP "\\picprop" +#define OOO_STRING_SVTOOLS_RTF_PNAIUEO "\\pnaiueo" +#define OOO_STRING_SVTOOLS_RTF_PNAIUEOD "\\pnaiueod" +#define OOO_STRING_SVTOOLS_RTF_PNCHOSUNG "\\pnchosung" +#define OOO_STRING_SVTOOLS_RTF_PNDBNUMD "\\pndbnumd" +#define OOO_STRING_SVTOOLS_RTF_PNDBNUMK "\\pndbnumk" +#define OOO_STRING_SVTOOLS_RTF_PNDBNUML "\\pndbnuml" +#define OOO_STRING_SVTOOLS_RTF_PNDBNUMT "\\pndbnumt" +#define OOO_STRING_SVTOOLS_RTF_PNGANADA "\\pnganada" +#define OOO_STRING_SVTOOLS_RTF_PNGBLIP "\\pngblip" +#define OOO_STRING_SVTOOLS_RTF_PNGBNUM "\\pngbnum" +#define OOO_STRING_SVTOOLS_RTF_PNGBNUMD "\\pngbnumd" +#define OOO_STRING_SVTOOLS_RTF_PNGBNUMK "\\pngbnumk" +#define OOO_STRING_SVTOOLS_RTF_PNGBNUML "\\pngbnuml" +#define OOO_STRING_SVTOOLS_RTF_PNRAUTH "\\pnrauth" +#define OOO_STRING_SVTOOLS_RTF_PNRDATE "\\pnrdate" +#define OOO_STRING_SVTOOLS_RTF_PNRNFC "\\pnrnfc" +#define OOO_STRING_SVTOOLS_RTF_PNRNOT "\\pnrnot" +#define OOO_STRING_SVTOOLS_RTF_PNRPNBR "\\pnrpnbr" +#define OOO_STRING_SVTOOLS_RTF_PNRRGB "\\pnrrgb" +#define OOO_STRING_SVTOOLS_RTF_PNRSTART "\\pnrstart" +#define OOO_STRING_SVTOOLS_RTF_PNRSTOP "\\pnrstop" +#define OOO_STRING_SVTOOLS_RTF_PNRXST "\\pnrxst" +#define OOO_STRING_SVTOOLS_RTF_PNZODIAC "\\pnzodiac" +#define OOO_STRING_SVTOOLS_RTF_PNZODIACD "\\pnzodiacd" +#define OOO_STRING_SVTOOLS_RTF_PNZODIACL "\\pnzodiacl" +#define OOO_STRING_SVTOOLS_RTF_LFOLEVEL "\\lfolevel" +#define OOO_STRING_SVTOOLS_RTF_POSYIN "\\posyin" +#define OOO_STRING_SVTOOLS_RTF_POSYOUT "\\posyout" +#define OOO_STRING_SVTOOLS_RTF_PRIVATE "\\private" +#define OOO_STRING_SVTOOLS_RTF_PROPNAME "\\propname" +#define OOO_STRING_SVTOOLS_RTF_PROPTYPE "\\proptype" +#define OOO_STRING_SVTOOLS_RTF_REVAUTHDEL "\\revauthdel" +#define OOO_STRING_SVTOOLS_RTF_REVDTTMDEL "\\revdttmdel" +#define OOO_STRING_SVTOOLS_RTF_SAUTOUPD "\\sautoupd" +#define OOO_STRING_SVTOOLS_RTF_SECTDEFAULTCL "\\sectdefaultcl" +#define OOO_STRING_SVTOOLS_RTF_SECTEXPAND "\\sectexpand" +#define OOO_STRING_SVTOOLS_RTF_SECTLINEGRID "\\sectlinegrid" +#define OOO_STRING_SVTOOLS_RTF_SECTSPECIFYCL "\\sectspecifycl" +#define OOO_STRING_SVTOOLS_RTF_SECTSPECIFYL "\\sectspecifyl" +#define OOO_STRING_SVTOOLS_RTF_SHIDDEN "\\shidden" +#define OOO_STRING_SVTOOLS_RTF_SHPBOTTOM "\\shpbottom" +#define OOO_STRING_SVTOOLS_RTF_SHPBXCOLUMN "\\shpbxcolumn" +#define OOO_STRING_SVTOOLS_RTF_SHPBXMARGIN "\\shpbxmargin" +#define OOO_STRING_SVTOOLS_RTF_SHPBXPAGE "\\shpbxpage" +#define OOO_STRING_SVTOOLS_RTF_SHPBYMARGIN "\\shpbymargin" +#define OOO_STRING_SVTOOLS_RTF_SHPBYPAGE "\\shpbypage" +#define OOO_STRING_SVTOOLS_RTF_SHPBYPARA "\\shpbypara" +#define OOO_STRING_SVTOOLS_RTF_SHPFBLWTXT "\\shpfblwtxt" +#define OOO_STRING_SVTOOLS_RTF_SHPFHDR "\\shpfhdr" +#define OOO_STRING_SVTOOLS_RTF_SHPGRP "\\shpgrp" +#define OOO_STRING_SVTOOLS_RTF_SHPLEFT "\\shpleft" +#define OOO_STRING_SVTOOLS_RTF_SHPLID "\\shplid" +#define OOO_STRING_SVTOOLS_RTF_SHPLOCKANCHOR "\\shplockanchor" +#define OOO_STRING_SVTOOLS_RTF_SHPPICT "\\shppict" +#define OOO_STRING_SVTOOLS_RTF_SHPRIGHT "\\shpright" +#define OOO_STRING_SVTOOLS_RTF_SHPRSLT "\\shprslt" +#define OOO_STRING_SVTOOLS_RTF_SHPTOP "\\shptop" +#define OOO_STRING_SVTOOLS_RTF_SHPTXT "\\shptxt" +#define OOO_STRING_SVTOOLS_RTF_SHPWRK "\\shpwrk" +#define OOO_STRING_SVTOOLS_RTF_SHPWR "\\shpwr" +#define OOO_STRING_SVTOOLS_RTF_SHPZ "\\shpz" +#define OOO_STRING_SVTOOLS_RTF_SPRSBSP "\\sprsbsp" +#define OOO_STRING_SVTOOLS_RTF_SPRSLNSP "\\sprslnsp" +#define OOO_STRING_SVTOOLS_RTF_SPRSTSM "\\sprstsm" +#define OOO_STRING_SVTOOLS_RTF_STATICVAL "\\staticval" +#define OOO_STRING_SVTOOLS_RTF_STEXTFLOW "\\stextflow" +#define OOO_STRING_SVTOOLS_RTF_STRIKED "\\striked" +#define OOO_STRING_SVTOOLS_RTF_SUBFONTBYSIZE "\\subfontbysize" +#define OOO_STRING_SVTOOLS_RTF_TCELLD "\\tcelld" +#define OOO_STRING_SVTOOLS_RTF_TIME "\\time" +#define OOO_STRING_SVTOOLS_RTF_TRUNCATEFONTHEIGHT "\\truncatefontheight" +#define OOO_STRING_SVTOOLS_RTF_UC "\\uc" +#define OOO_STRING_SVTOOLS_RTF_UD "\\ud" +#define OOO_STRING_SVTOOLS_RTF_ULDASH "\\uldash" +#define OOO_STRING_SVTOOLS_RTF_ULDASHD "\\uldashd" +#define OOO_STRING_SVTOOLS_RTF_ULDASHDD "\\uldashdd" +#define OOO_STRING_SVTOOLS_RTF_ULTH "\\ulth" +#define OOO_STRING_SVTOOLS_RTF_ULWAVE "\\ulwave" +#define OOO_STRING_SVTOOLS_RTF_ULC "\\ulc" +#define OOO_STRING_SVTOOLS_RTF_U "\\u" +#define OOO_STRING_SVTOOLS_RTF_UPR "\\upr" +#define OOO_STRING_SVTOOLS_RTF_USERPROPS "\\userprops" +#define OOO_STRING_SVTOOLS_RTF_VIEWKIND "\\viewkind" +#define OOO_STRING_SVTOOLS_RTF_VIEWSCALE "\\viewscale" +#define OOO_STRING_SVTOOLS_RTF_VIEWZK "\\viewzk" +#define OOO_STRING_SVTOOLS_RTF_WIDCTLPAR "\\widctlpar" +#define OOO_STRING_SVTOOLS_RTF_WINDOWCAPTION "\\windowcaption" +#define OOO_STRING_SVTOOLS_RTF_WPEQN "\\wpeqn" +#define OOO_STRING_SVTOOLS_RTF_WPJST "\\wpjst" +#define OOO_STRING_SVTOOLS_RTF_WPSP "\\wpsp" +#define OOO_STRING_SVTOOLS_RTF_YXE "\\yxe" +#define OOO_STRING_SVTOOLS_RTF_FRMTXLRTB "\\frmtxlrtb" +#define OOO_STRING_SVTOOLS_RTF_FRMTXTBRL "\\frmtxtbrl" +#define OOO_STRING_SVTOOLS_RTF_FRMTXBTLR "\\frmtxbtlr" +#define OOO_STRING_SVTOOLS_RTF_FRMTXLRTBV "\\frmtxlrtbv" +#define OOO_STRING_SVTOOLS_RTF_FRMTXTBRLV "\\frmtxtbrlv" + +// MS-2000 Tokens +#define OOO_STRING_SVTOOLS_RTF_ULTHD "\\ulthd" +#define OOO_STRING_SVTOOLS_RTF_ULTHDASH "\\ulthdash" +#define OOO_STRING_SVTOOLS_RTF_ULLDASH "\\ulldash" +#define OOO_STRING_SVTOOLS_RTF_ULTHLDASH "\\ulthldash" +#define OOO_STRING_SVTOOLS_RTF_ULTHDASHD "\\ulthdashd" +#define OOO_STRING_SVTOOLS_RTF_ULTHDASHDD "\\ulthdashdd" +#define OOO_STRING_SVTOOLS_RTF_ULHWAVE "\\ulhwave" +#define OOO_STRING_SVTOOLS_RTF_ULULDBWAVE "\\ululdbwave" +#define OOO_STRING_SVTOOLS_RTF_LOCH "\\loch" +#define OOO_STRING_SVTOOLS_RTF_HICH "\\hich" +#define OOO_STRING_SVTOOLS_RTF_DBCH "\\dbch" +#define OOO_STRING_SVTOOLS_RTF_LANGFE "\\langfe" +#define OOO_STRING_SVTOOLS_RTF_ADEFLANG "\\adeflang" +#define OOO_STRING_SVTOOLS_RTF_ADEFF "\\adeff" +#define OOO_STRING_SVTOOLS_RTF_ACCNONE "\\accnone" +#define OOO_STRING_SVTOOLS_RTF_ACCDOT "\\accdot" +#define OOO_STRING_SVTOOLS_RTF_ACCCOMMA "\\acccomma" +#define OOO_STRING_SVTOOLS_RTF_TWOINONE "\\twoinone" +#define OOO_STRING_SVTOOLS_RTF_HORZVERT "\\horzvert" +#define OOO_STRING_SVTOOLS_RTF_FAHANG "\\fahang" +#define OOO_STRING_SVTOOLS_RTF_FAVAR "\\favar" +#define OOO_STRING_SVTOOLS_RTF_FACENTER "\\facenter" +#define OOO_STRING_SVTOOLS_RTF_FAROMAN "\\faroman" +#define OOO_STRING_SVTOOLS_RTF_FAFIXED "\\fafixed" +#define OOO_STRING_SVTOOLS_RTF_NOCWRAP "\\nocwrap" +#define OOO_STRING_SVTOOLS_RTF_NOOVERFLOW "\\nooverflow" +#define OOO_STRING_SVTOOLS_RTF_ASPALPHA "\\aspalpha" + +// SWG spezifische Attribute +#define OOO_STRING_SVTOOLS_RTF_GRFALIGNV "\\grfalignv" +#define OOO_STRING_SVTOOLS_RTF_GRFALIGNH "\\grfalignh" +#define OOO_STRING_SVTOOLS_RTF_GRFMIRROR "\\grfmirror" +#define OOO_STRING_SVTOOLS_RTF_HEADERYB "\\headeryb" +#define OOO_STRING_SVTOOLS_RTF_HEADERXL "\\headerxl" +#define OOO_STRING_SVTOOLS_RTF_HEADERXR "\\headerxr" +#define OOO_STRING_SVTOOLS_RTF_FOOTERYT "\\footeryt" +#define OOO_STRING_SVTOOLS_RTF_FOOTERXL "\\footerxl" +#define OOO_STRING_SVTOOLS_RTF_FOOTERXR "\\footerxr" +#define OOO_STRING_SVTOOLS_RTF_HEADERYH "\\headeryh" +#define OOO_STRING_SVTOOLS_RTF_FOOTERYH "\\footeryh" +#define OOO_STRING_SVTOOLS_RTF_BALANCEDCOLUMN "\\swcolmnblnc" +#define OOO_STRING_SVTOOLS_RTF_UPDNPROP "\\updnprop" +#define OOO_STRING_SVTOOLS_RTF_PRTDATA "\\prtdata" +#define OOO_STRING_SVTOOLS_RTF_BKMKKEY "\\bkmkkey" + +// Attribute fuer die freifliegenden Rahmen +#define OOO_STRING_SVTOOLS_RTF_FLYPRINT "\\flyprint" +#define OOO_STRING_SVTOOLS_RTF_FLYOPAQUE "\\flyopaque" +#define OOO_STRING_SVTOOLS_RTF_FLYPRTCTD "\\flyprtctd" +#define OOO_STRING_SVTOOLS_RTF_FLYMAINCNT "\\flymaincnt" +#define OOO_STRING_SVTOOLS_RTF_FLYVERT "\\flyvert" +#define OOO_STRING_SVTOOLS_RTF_FLYHORZ "\\flyhorz" +#define OOO_STRING_SVTOOLS_RTF_DFRMTXTL "\\dfrmtxtl" +#define OOO_STRING_SVTOOLS_RTF_DFRMTXTR "\\dfrmtxtr" +#define OOO_STRING_SVTOOLS_RTF_DFRMTXTU "\\dfrmtxtu" +#define OOO_STRING_SVTOOLS_RTF_DFRMTXTW "\\dfrmtxtw" +#define OOO_STRING_SVTOOLS_RTF_FLYANCHOR "\\flyanchor" +#define OOO_STRING_SVTOOLS_RTF_FLYCNTNT "\\flycntnt" +#define OOO_STRING_SVTOOLS_RTF_FLYCOLUMN "\\flycolumn" +#define OOO_STRING_SVTOOLS_RTF_FLYPAGE "\\flypage" +#define OOO_STRING_SVTOOLS_RTF_FLYINPARA "\\flyinpara" +#define OOO_STRING_SVTOOLS_RTF_BRDBOX "\\brdbox" +#define OOO_STRING_SVTOOLS_RTF_BRDLNCOL "\\brdlncol" +#define OOO_STRING_SVTOOLS_RTF_BRDLNIN "\\brdlnin" +#define OOO_STRING_SVTOOLS_RTF_BRDLNOUT "\\brdlnout" +#define OOO_STRING_SVTOOLS_RTF_BRDLNDIST "\\brdlndist" +#define OOO_STRING_SVTOOLS_RTF_SHADOW "\\shadow" +#define OOO_STRING_SVTOOLS_RTF_SHDWDIST "\\shdwdist" +#define OOO_STRING_SVTOOLS_RTF_SHDWSTYLE "\\shdwstyle" +#define OOO_STRING_SVTOOLS_RTF_SHDWCOL "\\shdwcol" +#define OOO_STRING_SVTOOLS_RTF_SHDWFCOL "\\shdwfcol" +#define OOO_STRING_SVTOOLS_RTF_PGDSCTBL "\\pgdsctbl" +#define OOO_STRING_SVTOOLS_RTF_PGDSC "\\pgdsc" +#define OOO_STRING_SVTOOLS_RTF_PGDSCUSE "\\pgdscuse" +#define OOO_STRING_SVTOOLS_RTF_PGDSCNXT "\\pgdscnxt" +#define OOO_STRING_SVTOOLS_RTF_HYPHEN "\\hyphen" +#define OOO_STRING_SVTOOLS_RTF_HYPHLEAD "\\hyphlead" +#define OOO_STRING_SVTOOLS_RTF_HYPHTRAIL "\\hyphtrail" +#define OOO_STRING_SVTOOLS_RTF_HYPHMAX "\\hyphmax" +#define OOO_STRING_SVTOOLS_RTF_TLSWG "\\tlswg" +#define OOO_STRING_SVTOOLS_RTF_PGBRK "\\pgbrk" +#define OOO_STRING_SVTOOLS_RTF_PGDSCNO "\\pgdscno" +#define OOO_STRING_SVTOOLS_RTF_SOUTLVL "\\soutlvl" +#define OOO_STRING_SVTOOLS_RTF_SHP "\\shp" +#define OOO_STRING_SVTOOLS_RTF_SN "\\sn" +#define OOO_STRING_SVTOOLS_RTF_SV "\\sv" + +// Support for overline attributes +#define OOO_STRING_SVTOOLS_RTF_OL "\\ol" +#define OOO_STRING_SVTOOLS_RTF_OLD "\\old" +#define OOO_STRING_SVTOOLS_RTF_OLDB "\\oldb" +#define OOO_STRING_SVTOOLS_RTF_OLNONE "\\olnone" +#define OOO_STRING_SVTOOLS_RTF_OLW "\\olw" +#define OOO_STRING_SVTOOLS_RTF_OLDASH "\\oldash" +#define OOO_STRING_SVTOOLS_RTF_OLDASHD "\\oldashd" +#define OOO_STRING_SVTOOLS_RTF_OLDASHDD "\\oldashdd" +#define OOO_STRING_SVTOOLS_RTF_OLTH "\\olth" +#define OOO_STRING_SVTOOLS_RTF_OLWAVE "\\olwave" +#define OOO_STRING_SVTOOLS_RTF_OLC "\\olc" +#define OOO_STRING_SVTOOLS_RTF_OLTHD "\\olthd" +#define OOO_STRING_SVTOOLS_RTF_OLTHDASH "\\olthdash" +#define OOO_STRING_SVTOOLS_RTF_OLLDASH "\\olldash" +#define OOO_STRING_SVTOOLS_RTF_OLTHLDASH "\\olthldash" +#define OOO_STRING_SVTOOLS_RTF_OLTHDASHD "\\olthdashd" +#define OOO_STRING_SVTOOLS_RTF_OLTHDASHDD "\\olthdashdd" +#define OOO_STRING_SVTOOLS_RTF_OLHWAVE "\\olhwave" +#define OOO_STRING_SVTOOLS_RTF_OLOLDBWAVE "\\ololdbwave" + +#endif // _RTFKEYWD_HXX diff --git a/svtools/inc/rtfout.hxx b/svtools/inc/rtfout.hxx new file mode 100644 index 000000000000..ba20add1d968 --- /dev/null +++ b/svtools/inc/rtfout.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: rtfout.hxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _RTFOUT_HXX +#define _RTFOUT_HXX + +#include "svtools/svtdllapi.h" +#include + +#ifndef _RTL_TEXTENC_H_ +#include +#endif + +class String; +class SvStream; + +class SVT_DLLPUBLIC RTFOutFuncs +{ +public: +#if defined(MAC) || defined(UNX) + static const sal_Char sNewLine; // nur \012 oder \015 +#else + static const sal_Char __FAR_DATA sNewLine[]; // \015\012 +#endif + + static SvStream& Out_Char( SvStream&, sal_Unicode cChar, + int *pUCMode, + rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252, + BOOL bWriteHelpFile = FALSE ); + static SvStream& Out_String( SvStream&, const String&, + rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252, + BOOL bWriteHelpFile = FALSE ); + static SvStream& Out_Fontname( SvStream&, const String&, + rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252, + BOOL bWriteHelpFile = FALSE ); + + static SvStream& Out_Hex( SvStream&, ULONG nHex, BYTE nLen ); +}; + + +#endif + + diff --git a/svtools/inc/rtftoken.h b/svtools/inc/rtftoken.h new file mode 100644 index 000000000000..c7981361ffc9 --- /dev/null +++ b/svtools/inc/rtftoken.h @@ -0,0 +1,1276 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: rtftoken.h,v $ + * $Revision: 1.13.134.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ + +#ifndef _RTFTOKEN_H +#define _RTFTOKEN_H + +class String; + +// suche die TokenID zu dem Token +int GetRTFToken( const String& rSearch ); + +enum RTF_TOKEN_RANGES { + RTF_NOGROUP = 0x0100, + RTF_DOCFMT = 0x0200, + RTF_SECTFMT = 0x0300, + RTF_PARFMT = 0x0400, + RTF_TABSTOPDEF = 0x0500, + RTF_BRDRDEF = 0x0600, + RTF_CHRFMT = 0x0700, + RTF_SPECCHAR = 0x0800, + RTF_APOCTL = 0x0900, + RTF_SHADINGDEF = 0x0A00, + // free = 0x0B00, + RTF_DRAWOBJECTS = 0x0C00, + RTF_OBJECTS = 0x0D00, + RTF_NUMBULLETS = 0x0E00, + + // !!! kann hinein verodert werden (Border/Background) !!!! + RTF_TABLEDEF = 0x1000, + + // !!! kann hinein verodert werden (Border/Tab) !!!! + RTF_SWGDEFS = 0x4000 +}; + +enum RTF_TOKEN_IDS { + + RTF_TEXTTOKEN = RTF_NOGROUP, + RTF_SINGLECHAR, + RTF_UNKNOWNCONTROL, + RTF_UNKNOWNDATA, + + RTF_RTF, + RTF_ANSITYPE, + RTF_MACTYPE, + RTF_PCTYPE, + RTF_PCATYPE, + RTF_NEXTTYPE, + + RTF_STYLESHEET, + RTF_SBASEDON, + RTF_SNEXT, + RTF_SHIDDEN, + RTF_SAUTOUPD, + + RTF_KEYCODE, + RTF_FNKEY, + RTF_ALTKEY, + RTF_SHIFTKEY, + RTF_CTRLKEY, + + RTF_FONTTBL, + RTF_DEFF, + RTF_FNIL, + RTF_FROMAN, + RTF_FSWISS, + RTF_FMODERN, + RTF_FSCRIPT, + RTF_FDECOR, + RTF_FTECH, + + RTF_COLORTBL, + RTF_RED, + RTF_GREEN, + RTF_BLUE, + + RTF_INFO, + RTF_TITLE, + RTF_SUBJECT, + RTF_AUTHOR, + RTF_OPERATOR, + RTF_KEYWORDS, + RTF_COMMENT, + RTF_VERSION, + RTF_DOCCOMM, + RTF_VERN, + RTF_CREATIM, + RTF_REVTIM, + RTF_PRINTIM, + RTF_BUPTIM, + RTF_EDMINS, + RTF_NOFPAGES, + RTF_NOFWORDS, + RTF_NOFCHARS, + RTF_ID, + RTF_YR, + RTF_MO, + RTF_DY, + RTF_HR, + RTF_MIN, + RTF_USERPROPS, + RTF_CATEGORY, + RTF_COMPANY, + RTF_MANAGER, + RTF_PROPNAME, + RTF_LINKVAL, + RTF_NOFCHARSWS, + RTF_HLINKBASE, + RTF_STATICVAL, + RTF_PROPTYPE, + + RTF_ANNOTATION, + RTF_ATNID, + + RTF_FOOTNOTE, + + RTF_XE, + RTF_BXE, + RTF_IXE, + RTF_RXE, + RTF_TXE, + RTF_YXE, + + RTF_TC, + RTF_TCF, + RTF_TCL, + + RTF_BKMKSTART, + RTF_BKMKEND, + + RTF_PICT, // Bitmaps + RTF_PICW, + RTF_PICH, + RTF_WBMBITSPIXEL, + RTF_WBMPLANES, + RTF_WBMWIDTHBYTES, + RTF_PICWGOAL, + RTF_PICHGOAL, + RTF_BIN, + RTF_PICSCALEX, + RTF_PICSCALEY, + RTF_PICSCALED, + RTF_WBITMAP, + RTF_WMETAFILE, + RTF_MACPICT, + RTF_OSMETAFILE, + RTF_DIBITMAP, + RTF_PICCROPT, + RTF_PICCROPB, + RTF_PICCROPL, + RTF_PICCROPR, + RTF_PICDATA, + RTF_PICBMP, + RTF_PICBPP, + RTF_PICPROP, + RTF_SHPPICT, + RTF_EMFBLIP, + RTF_PNGBLIP, + RTF_JPEGBLIP, + RTF_NONSHPPICT, + RTF_BLIPTAG, + RTF_BLIPUID, + RTF_BLIPUPI, + + RTF_FIELD, // Felder + RTF_FLDDIRTY, + RTF_FLDEDIT, + RTF_FLDLOCK, + RTF_FLDPRIV, + RTF_FLDINST, + RTF_FLDRSLT, + RTF_FLDTYPE, + RTF_TIME, + RTF_DATE, + RTF_WPEQN, + + RTF_NOLINE, + RTF_REVISED, + + RTF_BKMKCOLF, + RTF_BKMKCOLL, + RTF_PSOVER, + RTF_DOCTEMP, + RTF_DELETED, + + RTF_FCHARSET, + RTF_FALT, + RTF_FPRQ, + RTF_PANOSE, + RTF_FNAME, + RTF_FBIAS, + + RTF_ADDITIVE, + RTF_BKMKPUB, + RTF_CPG, + RTF_DATAFIELD, + + RTF_FBIDI, + RTF_FID, + RTF_FILE, + RTF_FILETBL, + RTF_FNETWORK, + RTF_FONTEMB, + RTF_FONTFILE, + RTF_FOSNUM, + RTF_FRELATIVE, + RTF_FTNIL, + RTF_FTTRUETYPE, + RTF_FVALIDDOS, + RTF_FVALIDHPFS, + RTF_FVALIDMAC, + RTF_FVALIDNTFS, + RTF_LINKSELF, + RTF_PUBAUTO, + RTF_REVTBL, + RTF_RTLMARK, + RTF_SEC, + RTF_TCN, + RTF_XEF, + + RTF_UD, // Unicode + RTF_UPR, + RTF_U, + RTF_UC, + RTF_ANSICPG, + + RTF_FFEXITMCR, // Form Fields + RTF_FFENTRYMCR, + RTF_FFDEFTEXT, + RTF_FFFORMAT, + RTF_FFSTATTEXT, + RTF_FORMFIELD, + RTF_FFNAME, + RTF_FFHELPTEXT, + RTF_FFL, + RTF_FFOWNHELP, + RTF_FFOWNSTAT, + RTF_FFMAXLEN, + RTF_FFHASLISTBOX, + RTF_FFHPS, + RTF_FFPROT, + RTF_FFTYPE, + RTF_FFTYPETXT, + RTF_FFSIZE, + RTF_FFRECALC, + RTF_FFRES, + RTF_FFDEFRES, + + RTF_HIGHLIGHT, + +/* */ + + RTF_DEFTAB = RTF_DOCFMT, + RTF_HYPHHOTZ, + RTF_LINESTART, + RTF_FRACWIDTH, + RTF_NEXTFILE, + RTF_TEMPLATE, + RTF_MAKEBACKUP, + RTF_DEFFORMAT, + RTF_DEFLANG, + RTF_FTNSEP, + RTF_FTNSEPC, + RTF_FTNCN, + RTF_ENDNOTES, + RTF_ENDDOC, + RTF_FTNTJ, + RTF_FTNBJ, + RTF_FTNSTART, + RTF_FTNRESTART, + RTF_PAPERW, + RTF_PAPERH, + RTF_MARGL, + RTF_MARGR, + RTF_MARGT, + RTF_MARGB, + RTF_FACINGP, + RTF_GUTTER, + RTF_MARGMIRROR, + RTF_LANDSCAPE, + RTF_PGNSTART, + RTF_WIDOWCTRL, + RTF_REVISIONS, + RTF_REVPROP, + RTF_REVBAR, + + RTF_AENDDOC, + RTF_AENDNOTES, + RTF_AFTNBJ, + RTF_AFTNCN, + RTF_AFTNNALC, + RTF_AFTNNAR, + RTF_AFTNNAUC, + RTF_AFTNNCHI, + RTF_AFTNNRLC, + RTF_AFTNNRUC, + RTF_AFTNRESTART, + RTF_AFTNRSTCONT, + RTF_AFTNSEP, + RTF_AFTNSEPC, + RTF_AFTNSTART, + RTF_AFTNTJ, + RTF_ALLPROT, + RTF_ANNOTPROT, + RTF_ATNAUTHOR, + RTF_ATNICN, + RTF_ATNREF, + RTF_ATNTIME, + RTF_ATRFEND, + RTF_ATRFSTART, + RTF_BRKFRM, + RTF_CVMME, + RTF_FET, + RTF_FLDALT, + RTF_FORMDISP, + RTF_FORMPROT, + RTF_FORMSHADE, + RTF_FTNALT, + RTF_FTNNALC, + RTF_FTNNAR, + RTF_FTNNAUC, + RTF_FTNNCHI, + RTF_FTNNRLC, + RTF_FTNNRUC, + RTF_FTNRSTCONT, + RTF_FTNRSTPG, + RTF_HYPHAUTO, + RTF_HYPHCAPS, + RTF_HYPHCONSEC, + RTF_LINKSTYLES, + RTF_LTRDOC, + RTF_NOCOLBAL, + RTF_NOEXTRASPRL, + RTF_NOTABIND, + RTF_OTBLRUL, + RTF_PRCOLBL, + RTF_PRINTDATA, + RTF_PSZ, + RTF_REVPROT, + RTF_RTLDOC, + RTF_SPRSSPBF, + RTF_SPRSTSP, + RTF_SWPBDR, + RTF_TRANSMF, + RTF_WRAPTRSP, + + RTF_PRIVATE, + RTF_NOULTRLSPC, + RTF_MSMCAP, + RTF_NOLEAD, + RTF_NOSPACEFORUL, + RTF_LYTEXCTTP, + RTF_LYTPRTMET, + RTF_DNTBLNSBDB, + RTF_FROMTEXT, + RTF_EXPSHRTN, + RTF_PGBRDRT, + RTF_SPRSBSP, + RTF_PGBRDRR, + RTF_PGBRDRSNAP, + RTF_BDBFHDR, + RTF_SUBFONTBYSIZE, + RTF_TRUNCATEFONTHEIGHT, + RTF_SPRSLNSP, + RTF_SPRSTSM, + RTF_PGBRDRL, + RTF_WPJST, + RTF_PGBRDRB, + RTF_WPSP, + RTF_NOXLATTOYEN, + RTF_OLDLINEWRAP, + RTF_PGBRDRFOOT, + RTF_PGBRDRHEAD, + RTF_DEFLANGFE, + RTF_DOCTYPE, + RTF_PGBRDROPT, + RTF_VIEWKIND, + RTF_VIEWSCALE, + RTF_WINDOWCAPTION, + RTF_BRDRART, + RTF_VIEWZK, + RTF_DOCVAR, + + RTF_DGMARGIN, + RTF_AFTNNCHOSUNG, + RTF_AFTNNCNUM, + RTF_AFTNNDBAR, + RTF_AFTNNDBNUM, + RTF_AFTNNDBNUMD, + RTF_AFTNNDBNUMK, + RTF_AFTNNDBNUMT, + RTF_AFTNNGANADA, + RTF_AFTNNGBNUM, + RTF_AFTNNGBNUMD, + RTF_AFTNNGBNUMK, + RTF_AFTNNGBNUML, + RTF_AFTNNZODIAC, + RTF_AFTNNZODIACD, + RTF_AFTNNZODIACL, + RTF_FTNNCHOSUNG, + RTF_FTNNCNUM, + RTF_FTNNDBAR, + RTF_FTNNDBNUM, + RTF_FTNNDBNUMD, + RTF_FTNNDBNUMK, + RTF_FTNNDBNUMT, + RTF_FTNNGANADA, + RTF_FTNNGBNUM, + RTF_FTNNGBNUMD, + RTF_FTNNGBNUMK, + RTF_FTNNGBNUML, + RTF_FTNNZODIAC, + RTF_FTNNZODIACD, + RTF_FTNNZODIACL, + + RTF_ADEFLANG, + RTF_ADEFF, + +/* */ + + RTF_SECTD = RTF_SECTFMT, + RTF_ENDNHERE, + RTF_BINFSXN, + RTF_BINSXN, + RTF_SBKNONE, + RTF_SBKCOL, + RTF_SBKPAGE, + RTF_SBKEVEN, + RTF_SBKODD, + RTF_COLS, + RTF_COLSX, + RTF_COLNO, + RTF_COLSR, + RTF_COLW, + RTF_LINEBETCOL, + RTF_LINEMOD, + RTF_LINEX, + RTF_LINESTARTS, + RTF_LINERESTART, + RTF_LINEPAGE, + RTF_LINECONT, + RTF_PGWSXN, + RTF_PGHSXN, + RTF_MARGLSXN, + RTF_MARGRSXN, + RTF_MARGTSXN, + RTF_MARGBSXN, + RTF_GUTTERSXN, + RTF_LNDSCPSXN, + RTF_FACPGSXN, + RTF_TITLEPG, + RTF_HEADERY, + RTF_FOOTERY, + RTF_PGNSTARTS, + RTF_PGNCONT, + RTF_PGNRESTART, + RTF_PGNX, + RTF_PGNY, + RTF_PGNDEC, + RTF_PGNUCRM, + RTF_PGNLCRM, + RTF_PGNUCLTR, + RTF_PGNLCLTR, + RTF_VERTALT, + RTF_VERTALB, + RTF_VERTALC, + RTF_VERTALJ, + + RTF_FOOTER, + RTF_FOOTERL, + RTF_FOOTERR, + RTF_FOOTERF, + RTF_HEADER, + RTF_HEADERL, + RTF_HEADERR, + RTF_HEADERF, + RTF_DS, + RTF_LTRSECT, + RTF_PGNHN, + RTF_PGNHNSC, + RTF_PGNHNSH, + RTF_PGNHNSM, + RTF_PGNHNSN, + RTF_PGNHNSP, + RTF_RTLSECT, + RTF_SECTUNLOCKED, + RTF_STEXTFLOW, + RTF_PGNCHOSUNG, + RTF_PGNCNUM, + RTF_PGNDBNUMK, + RTF_PGNDBNUMT, + RTF_PGNGANADA, + RTF_PGNGBNUM, + RTF_PGNGBNUMD, + RTF_PGNGBNUMK, + RTF_PGNGBNUML, + RTF_PGNZODIAC, + RTF_PGNZODIACD, + RTF_PGNZODIACL, + RTF_SECTDEFAULTCL, + RTF_SECTEXPAND, + RTF_SECTLINEGRID, + RTF_SECTSPECIFYCL, + RTF_SECTSPECIFYL, + + // Swg-Header/Footer-Tokens + RTF_HEADER_YB = (RTF_SECTFMT|RTF_SWGDEFS), + RTF_HEADER_XL, + RTF_HEADER_XR, + RTF_FOOTER_YT, + RTF_FOOTER_XL, + RTF_FOOTER_XR, + RTF_HEADER_YH, + RTF_FOOTER_YH, + RTF_BALANCED_COLUMN, + + +/* */ + + RTF_PARD = RTF_PARFMT, + RTF_S, + RTF_INTBL, + RTF_KEEP, + RTF_KEEPN, + RTF_LEVEL, + RTF_PAGEBB, + RTF_SBYS, + RTF_QL, + RTF_QR, + RTF_QJ, + RTF_QC, + RTF_FI, + RTF_LI, + RTF_LIN, + RTF_RI, + RTF_RIN, + RTF_SB, + RTF_SA, + RTF_SL, + RTF_HYPHPAR, + RTF_LTRPAR, + RTF_NOWIDCTLPAR, + RTF_RTLPAR, + RTF_SLMULT, + RTF_SUBDOCUMENT, + + RTF_WIDCTLPAR, + + RTF_LISTTEXT, + RTF_POSYIN, + RTF_PNRNOT, + RTF_BRDRDASHDOTSTR, + RTF_POSYOUT, + RTF_BRDRDASHD, + RTF_BRDRDASHDD, + RTF_BRDRENGRAVE, + RTF_BRDRTHTNLG, + RTF_BRDREMBOSS, + RTF_BRDRTNTHTNLG, + RTF_BRDRDASHSM, + RTF_BRDRTHTNMG, + RTF_OVERLAY, + RTF_BRDRTNTHSG, + RTF_BRDRTNTHMG, + RTF_BRDRTHTNSG, + RTF_BRDRTNTHLG, + RTF_BRDRTRIPLE, + RTF_BRDRTNTHTNSG, + RTF_BRDRTNTHTNMG, + RTF_BRDRWAVYDB, + RTF_BRDRWAVY, + RTF_ILVL, + RTF_DFRSTOP, + RTF_DFRXST, + RTF_PNRAUTH, + RTF_DFRSTART, + RTF_OUTLINELEVEL, + RTF_DFRAUTH, + RTF_DFRDATE, + RTF_PNRRGB, + RTF_PNRPNBR, + RTF_PNRSTART, + RTF_PNRXST, + RTF_PNRSTOP, + RTF_PNRDATE, + RTF_PNRNFC, + RTF_NOSNAPLINEGRID, + RTF_FAAUTO, + RTF_FAHANG, + RTF_FAVAR, + RTF_FACENTER, + RTF_FAROMAN, + RTF_FAFIXED, + RTF_ADJUSTRIGHT, + RTF_LS, + RTF_NOCWRAP, + RTF_NOOVERFLOW, + RTF_ASPALPHA, + + +/* */ + + RTF_TX = RTF_TABSTOPDEF, + RTF_TB, + RTF_TQL, + RTF_TQR, + RTF_TQC, + RTF_TQDEC, + RTF_TLDOT, + RTF_TLHYPH, + RTF_TLUL, + RTF_TLTH, + RTF_TLEQ, + + // Swg-TabStop-Tokens + RTF_TLSWG = (RTF_TABSTOPDEF|RTF_SWGDEFS), + +/* */ + + RTF_BRDRT = RTF_BRDRDEF, + RTF_BRDRB, + RTF_BRDRL, + RTF_BRDRR, + RTF_BRDRBTW, + RTF_BRDRBAR, + RTF_BOX, + RTF_BRSP, + RTF_BRDRW, + RTF_BRDRCF, + RTF_BRDRS, + RTF_BRDRTH, + RTF_BRDRSH, + RTF_BRDRDB, + RTF_BRDRDOT, + RTF_BRDRHAIR, + RTF_BRDRDASH, + RTF_BRDRFRAME, + + // Swg-Border-Tokens + RTF_BRDBOX = (RTF_BRDRDEF|RTF_SWGDEFS), + RTF_BRDLINE_COL, + RTF_BRDLINE_IN, + RTF_BRDLINE_OUT, + RTF_BRDLINE_DIST, + +/* */ + + RTF_PLAIN = RTF_CHRFMT, + RTF_B, + RTF_CAPS, + RTF_DN, + RTF_SUB, + RTF_NOSUPERSUB, + RTF_EXPND, + RTF_EXPNDTW, + RTF_KERNING, + RTF_F, + RTF_FS, + RTF_I, + RTF_OUTL, + RTF_SCAPS, + RTF_SHAD, + RTF_STRIKE, + RTF_UL, + RTF_ULD, + RTF_ULDB, + RTF_ULNONE, + RTF_ULW, + RTF_OL, + RTF_OLD, + RTF_OLDB, + RTF_OLNONE, + RTF_OLW, + RTF_UP, + RTF_SUPER, + RTF_V, + RTF_CF, + RTF_CB, + RTF_LANG, + RTF_CCHS, + RTF_CS, + RTF_LTRCH, + RTF_REVAUTH, + RTF_REVDTTM, + RTF_RTLCH, + + RTF_CHBGFDIAG, + RTF_CHBGDKVERT, + RTF_CHBGDKHORIZ, + RTF_CHBRDR, + RTF_CHBGVERT, + RTF_CHBGHORIZ, + RTF_CHBGDKFDIAG, + RTF_CHBGDCROSS, + RTF_CHBGCROSS, + RTF_CHBGBDIAG, + RTF_CHBGDKDCROSS, + RTF_CHBGDKCROSS, + RTF_CHBGDKBDIAG, + RTF_ULDASHD, + RTF_ULDASH, + RTF_ULDASHDD, + RTF_ULWAVE, + RTF_ULC, + RTF_ULTH, + RTF_OLDASHD, + RTF_OLDASH, + RTF_OLDASHDD, + RTF_OLWAVE, + RTF_OLC, + RTF_OLTH, + RTF_EMBO, + RTF_IMPR, + RTF_STRIKED, + RTF_CRDATE, + RTF_CRAUTH, + RTF_CHARSCALEX, + RTF_CHCBPAT, + RTF_CHCFPAT, + RTF_CHSHDNG, + RTF_REVAUTHDEL, + RTF_REVDTTMDEL, + RTF_CGRID, + RTF_GCW, + RTF_NOSECTEXPAND, + RTF_GRIDTBL, + RTF_G, + RTF_ANIMTEXT, + RTF_ULTHD, + RTF_ULTHDASH, + RTF_ULLDASH, + RTF_ULTHLDASH, + RTF_ULTHDASHD, + RTF_ULTHDASHDD, + RTF_ULHWAVE, + RTF_ULULDBWAVE, + RTF_OLTHD, + RTF_OLTHDASH, + RTF_OLLDASH, + RTF_OLTHLDASH, + RTF_OLTHDASHD, + RTF_OLTHDASHDD, + RTF_OLHWAVE, + RTF_OLOLDBWAVE, + + // association control words + RTF_AB, + RTF_ACAPS, + RTF_ACF, + RTF_ADN, + RTF_AEXPND, + RTF_AF, + RTF_AFS, + RTF_AI, + RTF_ALANG, + RTF_AOUTL, + RTF_ASCAPS, + RTF_ASHAD, + RTF_ASTRIKE, + RTF_AUL, + RTF_AULD, + RTF_AULDB, + RTF_AULNONE, + RTF_AULW, + RTF_AUP, + + RTF_LOCH, + RTF_HICH, + RTF_DBCH, + RTF_LANGFE, + RTF_ACCNONE, + RTF_ACCDOT, + RTF_ACCCOMMA, + RTF_TWOINONE, + RTF_HORZVERT, + + // Swg-Border-Tokens + RTF_SWG_ESCPROP = (RTF_CHRFMT|RTF_SWGDEFS), + RTF_HYPHEN, + RTF_HYPHLEAD, + RTF_HYPHTRAIL, + RTF_HYPHMAX, + + +/* */ + + RTF_CHDATE = RTF_SPECCHAR, + RTF_CHDATEL, + RTF_CHDATEA, + RTF_CHTIME, + RTF_CHPGN, + RTF_CHFTN, + RTF_CHATN, + RTF_CHFTNSEP, + RTF_CHFTNSEPC, + RTF_CELL, + RTF_ROW, + RTF_PAR, + RTF_SECT, + RTF_PAGE, + RTF_COLUM, + RTF_LINE, + RTF_TAB, + RTF_EMDASH, + RTF_ENDASH, + RTF_BULLET, + RTF_LQUOTE, + RTF_RQUOTE, + RTF_LDBLQUOTE, + RTF_RDBLQUOTE, + RTF_FORMULA, + RTF_NONBREAKINGSPACE, + RTF_OPTIONALHYPHEN, + RTF_NONBREAKINGHYPHEN, + RTF_SUBENTRYINDEX, + RTF_IGNOREFLAG, + RTF_HEX, + RTF_EMSPACE, + RTF_ENSPACE, + RTF_LTRMARK, + RTF_SECTNUM, + RTF_SOFTCOL, + RTF_SOFTLHEIGHT, + RTF_SOFTLINE, + RTF_SOFTPAGE, + RTF_ZWJ, + RTF_ZWNJ, + +/* */ + + RTF_ABSW = RTF_APOCTL, + RTF_ABSH, + RTF_NOWRAP, + RTF_DXFRTEXT, + RTF_DFRMTXTX, + RTF_DFRMTXTY, + RTF_DROPCAPLI, + RTF_DROPCAPT, + RTF_ABSNOOVRLP, + RTF_PHMRG, + RTF_PHPG, + RTF_PHCOL, + RTF_POSX, + RTF_POSNEGX, + RTF_POSXC, + RTF_POSXI, + RTF_POSXO, + RTF_POSXL, + RTF_POSXR, + RTF_PVMRG, + RTF_PVPG, + RTF_PVPARA, + RTF_POSY, + RTF_POSNEGY, + RTF_POSYT, + RTF_POSYIL, + RTF_POSYB, + RTF_POSYC, + RTF_ABSLOCK, + RTF_FRMTXLRTB, + RTF_FRMTXTBRL, + RTF_FRMTXBTLR, + RTF_FRMTXLRTBV, + RTF_FRMTXTBRLV, + + // Swg-Frame-Tokens + RTF_FLYPRINT = (RTF_APOCTL|RTF_SWGDEFS), + RTF_FLYOPAQUE, + RTF_FLYPRTCTD, + RTF_FLYMAINCNT, + RTF_FLYVERT, + RTF_FLYHORZ, + RTF_FLYOUTLEFT, + RTF_FLYOUTRIGHT, + RTF_FLYOUTUPPER, + RTF_FLYOUTLOWER, + RTF_FLYANCHOR, + RTF_FLY_CNTNT, + RTF_FLY_COLUMN, + RTF_FLY_PAGE, + RTF_FLY_INPARA, + + +/* */ + + RTF_SHADING = RTF_SHADINGDEF, + RTF_CFPAT, + RTF_CBPAT, + RTF_BGHORIZ, + RTF_BGVERT, + RTF_BGFDIAG, + RTF_BGBDIAG, + RTF_BGCROSS, + RTF_BGDCROSS, + RTF_BGDKHORIZ, + RTF_BGDKVERT, + RTF_BGDKFDIAG, + RTF_BGDKBDIAG, + RTF_BGDKCROSS, + RTF_BGDKDCROSS, + +/* */ + + RTF_TROWD = RTF_TABLEDEF, + RTF_TRGAPH, + RTF_TRLEFT, + RTF_TRRH, + + RTF_TRQL, + RTF_TRQR, + RTF_TRQC, + + RTF_CLMGF, + RTF_CLMRG, + RTF_CELLX, + RTF_LTRROW, + RTF_RTLROW, + RTF_TRBRDRB, + RTF_TRBRDRH, + RTF_TRBRDRL, + RTF_TRBRDRR, + RTF_TRBRDRT, + RTF_TRBRDRV, + RTF_TRHDR, + RTF_TRKEEP, + RTF_TRPADDB, + RTF_TRPADDL, + RTF_TRPADDR, + RTF_TRPADDT, + RTF_TRPADDFB, + RTF_TRPADDFL, + RTF_TRPADDFR, + RTF_TRPADDFT, + RTF_TCELLD, + RTF_CLTXTBRL, + RTF_CLTXLRTB, + RTF_CLVERTALB, + RTF_CLVERTALT, + RTF_CLVERTALC, + RTF_CLVMGF, + RTF_CLVMRG, + RTF_CLTXTBRLV, + RTF_CLTXBTLR, + RTF_CLTXLRTBV, + RTF_CLPADL, + RTF_CLPADT, + RTF_CLPADB, + RTF_CLPADR, + RTF_CLPADFL, + RTF_CLPADFT, + RTF_CLPADFB, + RTF_CLPADFR, + + + RTF_CLBRDRT = (RTF_BRDRDEF|RTF_TABLEDEF), + RTF_CLBRDRL, + RTF_CLBRDRB, + RTF_CLBRDRR, + + RTF_CLCFPAT = (RTF_SHADINGDEF|RTF_TABLEDEF), + RTF_CLCBPAT, + RTF_CLSHDNG, + RTF_CLBGHORIZ, + RTF_CLBGVERT, + RTF_CLBGFDIAG, + RTF_CLBGBDIAG, + RTF_CLBGCROSS, + RTF_CLBGDCROSS, + RTF_CLBGDKHOR, + RTF_CLBGDKVERT, + RTF_CLBGDKFDIAG, + RTF_CLBGDKBDIAG, + RTF_CLBGDKCROSS, + RTF_CLBGDKDCROSS, + +/* */ + + +/* */ + + RTF_DO = RTF_DRAWOBJECTS, + RTF_DOBXCOLUMN, + RTF_DOBXMARGIN, + RTF_DOBXPAGE, + RTF_DOBYMARGIN, + RTF_DOBYPAGE, + RTF_DOBYPARA, + RTF_DODHGT, + RTF_DOLOCK, + RTF_DPAENDHOL, + RTF_DPAENDL, + RTF_DPAENDSOL, + RTF_DPAENDW, + RTF_DPARC, + RTF_DPARCFLIPX, + RTF_DPARCFLIPY, + RTF_DPASTARTHOL, + RTF_DPASTARTL, + RTF_DPASTARTSOL, + RTF_DPASTARTW, + RTF_DPCALLOUT, + RTF_DPCOA, + RTF_DPCOACCENT, + RTF_DPCOBESTFIT, + RTF_DPCOBORDER, + RTF_DPCODABS, + RTF_DPCODBOTTOM, + RTF_DPCODCENTER, + RTF_DPCODTOP, + RTF_DPCOLENGTH, + RTF_DPCOMINUSX, + RTF_DPCOMINUSY, + RTF_DPCOOFFSET, + RTF_DPCOSMARTA, + RTF_DPCOTDOUBLE, + RTF_DPCOTRIGHT, + RTF_DPCOTSINGLE, + RTF_DPCOTTRIPLE, + RTF_DPCOUNT, + RTF_DPELLIPSE, + RTF_DPENDGROUP, + RTF_DPFILLBGCB, + RTF_DPFILLBGCG, + RTF_DPFILLBGCR, + RTF_DPFILLBGGRAY, + RTF_DPFILLBGPAL, + RTF_DPFILLFGCB, + RTF_DPFILLFGCG, + RTF_DPFILLFGCR, + RTF_DPFILLFGGRAY, + RTF_DPFILLFGPAL, + RTF_DPFILLPAT, + RTF_DPGROUP, + RTF_DPLINE, + RTF_DPLINECOB, + RTF_DPLINECOG, + RTF_DPLINECOR, + RTF_DPLINEDADO, + RTF_DPLINEDADODO, + RTF_DPLINEDASH, + RTF_DPLINEDOT, + RTF_DPLINEGRAY, + RTF_DPLINEHOLLOW, + RTF_DPLINEPAL, + RTF_DPLINESOLID, + RTF_DPLINEW, + RTF_DPPOLYCOUNT, + RTF_DPPOLYGON, + RTF_DPPOLYLINE, + RTF_DPPTX, + RTF_DPPTY, + RTF_DPRECT, + RTF_DPROUNDR, + RTF_DPSHADOW, + RTF_DPSHADX, + RTF_DPSHADY, + RTF_DPTXBX, + RTF_DPTXBXMAR, + RTF_DPTXBXTEXT, + RTF_DPX, + RTF_DPXSIZE, + RTF_DPY, + RTF_DPYSIZE, + + RTF_DPCODESCENT, + RTF_BACKGROUND, + RTF_SHPBYPAGE, + RTF_SHPBYPARA, + RTF_SHPBYMARGIN, + RTF_SHPBXCOLUMN, + RTF_SHPBXMARGIN, + RTF_SHPBXPAGE, + RTF_SHPLOCKANCHOR, + RTF_SHPWR, + RTF_HLLOC, + RTF_HLSRC, + RTF_SHPWRK, + RTF_SHPTOP, + RTF_SHPRSLT, + RTF_HLFR, + RTF_SHPTXT, + RTF_SHPFHDR, + RTF_SHPGRP, + RTF_SHPRIGHT, + RTF_SHPFBLWTXT, + RTF_SHPZ, + RTF_SHPBOTTOM, + RTF_SHPLEFT, + RTF_SHPLID, + +/* */ + + RTF_OBJALIAS = RTF_OBJECTS, + RTF_OBJALIGN, + RTF_OBJAUTLINK, + RTF_OBJCLASS, + RTF_OBJCROPB, + RTF_OBJCROPL, + RTF_OBJCROPR, + RTF_OBJCROPT, + RTF_OBJDATA, + RTF_OBJECT, + RTF_OBJEMB, + RTF_OBJH, + RTF_OBJICEMB, + RTF_OBJLINK, + RTF_OBJLOCK, + RTF_OBJNAME, + RTF_OBJPUB, + RTF_OBJSCALEX, + RTF_OBJSCALEY, + RTF_OBJSECT, + RTF_OBJSETSIZE, + RTF_OBJSUB, + RTF_OBJTIME, + RTF_OBJTRANSY, + RTF_OBJUPDATE, + RTF_OBJW, + RTF_RESULT, + RTF_RSLTBMP, + RTF_RSLTMERGE, + RTF_RSLTPICT, + RTF_RSLTRTF, + RTF_RSLTTXT, + RTF_OBJOCX, + RTF_OBJHTML, + RTF_OBJATTPH, + +/* */ + + RTF_PN = RTF_NUMBULLETS, + RTF_PNACROSS, + RTF_PNB, + RTF_PNCAPS, + RTF_PNCARD, + RTF_PNCF, + RTF_PNDEC, + RTF_PNF, + RTF_PNFS, + RTF_PNHANG, + RTF_PNI, + RTF_PNINDENT, + RTF_PNLCLTR, + RTF_PNLCRM, + RTF_PNLVL, + RTF_PNLVLBLT, + RTF_PNLVLBODY, + RTF_PNLVLCONT, + RTF_PNNUMONCE, + RTF_PNORD, + RTF_PNORDT, + RTF_PNPREV, + RTF_PNQC, + RTF_PNQL, + RTF_PNQR, + RTF_PNRESTART, + RTF_PNSCAPS, + RTF_PNSECLVL, + RTF_PNSP, + RTF_PNSTART, + RTF_PNSTRIKE, + RTF_PNTEXT, + RTF_PNTXTA, + RTF_PNTXTB, + RTF_PNUCLTR, + RTF_PNUCRM, + RTF_PNUL, + RTF_PNULD, + RTF_PNULDB, + RTF_PNULNONE, + RTF_PNULW, + RTF_LIST, + RTF_LISTLEVEL, + RTF_LISTOVERRIDE, + RTF_LISTOVERRIDETABLE, + RTF_LISTTABLE, + RTF_LISTNAME, + RTF_LEVELNUMBERS, + RTF_LEVELNORESTART, + RTF_LEVELNFC, + RTF_LEVELOLD, + RTF_LISTOVERRIDECOUNT, + RTF_LISTTEMPLATEID, + RTF_LEVELINDENT, + RTF_LEVELFOLLOW, + RTF_LEVELLEGAL, + RTF_LEVELJC, + RTF_LISTOVERRIDESTART, + RTF_LISTID, + RTF_LISTRESTARTHDN, + RTF_LEVELTEXT, + RTF_LISTOVERRIDEFORMAT, + RTF_LEVELPREVSPACE, + RTF_LEVELPREV, + RTF_LEVELSPACE, + RTF_LISTSIMPLE, + RTF_LEVELSTARTAT, + RTF_PNAIUEO, + RTF_PNAIUEOD, + RTF_PNCHOSUNG, + RTF_PNDBNUMD, + RTF_PNDBNUMK, + RTF_PNDBNUML, + RTF_PNDBNUMT, + RTF_PNGANADA, + RTF_PNGBNUM, + RTF_PNGBNUMD, + RTF_PNGBNUMK, + RTF_PNGBNUML, + RTF_PNZODIAC, + RTF_PNZODIACD, + RTF_PNZODIACL, + RTF_LFOLEVEL, + +/* */ + + RTF_GRF_ALIGNV= RTF_SWGDEFS, + RTF_GRF_ALIGNH, + RTF_GRF_MIRROR, + RTF_SWG_PRTDATA, + RTF_BKMK_KEY, + RTF_SHADOW, + RTF_SHDW_DIST, + RTF_SHDW_STYLE, + RTF_SHDW_COL, + RTF_SHDW_FCOL, + RTF_PGDSCTBL, + RTF_PGDSC, + RTF_PGDSCUSE, + RTF_PGDSCNXT, + RTF_PGDSCNO, + RTF_PGBRK, + RTF_SOUTLVL, + +// shapes + RTF_SHP, RTF_SN, RTF_SV +/* + RTF_SHPLEFT, + RTF_SHPTOP, + RTF_SHPBOTTOM, + RTF_SHPRIGHT +*/ + +}; + +#endif // _RTFTOKEN_H + +/* vi:set tabstop=4 shiftwidth=4 expandtab: */ diff --git a/svtools/inc/sgfbram.hxx b/svtools/inc/sgfbram.hxx deleted file mode 100644 index ca7e90b59cd4..000000000000 --- a/svtools/inc/sgfbram.hxx +++ /dev/null @@ -1,160 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: sgfbram.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SGFBRAM_HXX -#define _SGFBRAM_HXX - -#include - -#define SgfBitImag0 1 /* Bitmap */ -#define SgfBitImag1 4 /* Bitmap */ -#define SgfBitImag2 5 /* Bitmap */ -#define SgfBitImgMo 6 /* Monochrome Bitmap */ -#define SgfSimpVect 2 /* Einfaches Vectorformat */ -#define SgfPostScrp 3 /* Postscript file */ -#define SgfStarDraw 7 /* StarDraw SGV-Datei */ -#define SgfDontKnow 255 /* Unbekannt oder kein SGF/SGV */ - -// Konstanten fr SgfHeader.SwGrCol -#define SgfBlckWhit 1 /* Schwarz/Wei Bild Ŀ SimpVector, */ -#define SgfGrayscal 2 /* Bild mit Graustufen StarDraw und */ -#define Sgf16Colors 3 /* Farbbild (16 Farben) Bit Image */ -#define SgfVectFarb 4 /* Farben fr Linien verwenden Ŀ */ -#define SgfVectGray 5 /* Graustufen fr Linien verwenden Nur fr */ -#define SgfVectWdth 6 /* Strichstrken fr Linien verwenden SimpVector */ - - -#define SgfHeaderSize 42 -class SgfHeader -{ -public: - UINT16 Magic; - UINT16 Version; - UINT16 Typ; - UINT16 Xsize; - UINT16 Ysize; - INT16 Xoffs; - INT16 Yoffs; - UINT16 Planes; // Layer - UINT16 SwGrCol; - char Autor[10]; - char Programm[10]; - UINT16 OfsLo,OfsHi; // DWord-Allignment ist notwendig (38 mod 4 =2) ! - - UINT32 GetOffset(); - friend SvStream& operator>>(SvStream& rIStream, SgfHeader& rHead); - BOOL ChkMagic(); -}; - -#define SgfEntrySize 22 -class SgfEntry -{ -public: - UINT16 Typ; - UINT16 iFrei; - UINT16 lFreiLo,lFreiHi; - char cFrei[10]; - UINT16 OfsLo,OfsHi; // DWord-Allignment ist notwendig (18 mod 4 =2) ! - - UINT32 GetOffset(); - friend SvStream& operator>>(SvStream& rIStream, SgfEntry& rEntr); -}; - -#define SgfVectorSize 10 -class SgfVector -{ -public: - UINT16 Flag; - INT16 x; - INT16 y; - UINT16 OfsLo,OfsHi; // DWord-Allignment ist notwendig (6 mod 4 =2) ! - - friend SvStream& operator>>(SvStream& rIStream, SgfVector& rEntr); -}; - -extern long SgfVectXofs; -extern long SgfVectYofs; -extern long SgfVectXmul; -extern long SgfVectYmul; -extern long SgfVectXdiv; -extern long SgfVectYdiv; -extern BOOL SgfVectScal; - -//////////////////////////////////////////////////////////////////////////////////////////////////// -// Windows BMP ///////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////// - -#define BmpFileHeaderSize 14 -class BmpFileHeader -{ -public: - UINT16 Typ; // = "BM" - UINT16 SizeLo,SizeHi; // Filesize in Bytes - UINT16 Reserve1; // Reserviert - UINT16 Reserve2; // Reserviert - UINT16 OfsLo,OfsHi; // Offset? - - void SetSize(UINT32 Size); - void SetOfs(UINT32 Size); - UINT32 GetOfs(); - friend SvStream& operator<<(SvStream& rOStream, BmpFileHeader& rHead); -}; - -#define BmpInfoHeaderSize 40 -class BmpInfoHeader -{ -public: - UINT32 Size; // Gre des BmpInfoHeaders - INT32 Width; // Breite in Pixel - INT32 Hight; // Hhe in Pixel - UINT16 Planes; // Anzahl der Planes (immer 1) - UINT16 PixBits; // Anzahl der Bit je Pixel (1,4,8,oder 24) - UINT32 Compress; // Datenkompression - UINT32 ImgSize; // Gre der Images in Bytes. Ohne Kompression ist auch 0 erlaubt. - INT32 xDpmm; // Dot per Meter (0 ist erlaubt) - INT32 yDpmm; // Dot per Meter (0 ist erlaubt) - UINT32 ColUsed; // Anzahl der verwendeten Farben (0=alle) - UINT32 ColMust; // Anzahl der wichtigen Farben (0=alle) - - friend SvStream& operator<<(SvStream& rOStream, BmpInfoHeader& rHead); -}; - -#define RGBQuadSize 4 -class RGBQuad { -private: - BYTE Red; - BYTE Grn; - BYTE Blu; - BYTE Fil; -public: - RGBQuad(BYTE R, BYTE G, BYTE B) { Red=R; Grn=G; Blu=B; Fil=0; } -}; - -#endif //_SGFBRAM_HXX diff --git a/svtools/inc/sgffilt.hxx b/svtools/inc/sgffilt.hxx deleted file mode 100644 index a93522fcf590..000000000000 --- a/svtools/inc/sgffilt.hxx +++ /dev/null @@ -1,49 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: sgffilt.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SGFFILT_HXX -#define _SGFFILT_HXX -#include - -BYTE CheckSgfTyp(SvStream& rInp, USHORT& nVersion); -BOOL SgfBMapFilter(SvStream& rInp, SvStream& rOut); -BOOL SgfVectFilter(SvStream& rInp, GDIMetaFile& rMtf); -BOOL SgfSDrwFilter(SvStream& rInp, GDIMetaFile& rMtf, INetURLObject aIniPath ); - -// Konstanten fr CheckSgfTyp() -#define SGF_BITIMAGE 1 /* Bitmap */ -#define SGF_SIMPVECT 2 /* Einfaches Vectorformat */ -#define SGF_POSTSCRP 3 /* Postscript file */ -#define SGF_STARDRAW 7 /* StarDraw SGV-Datei */ -#define SGF_DONTKNOW 255 /* Unbekannt oder kein SGF/SGV */ - -#define SGV_VERSION 3 /* SGV mit anderer Version wird abgewiesen */ - /* 3 entspricht StarDraw 2.00/2.01 Mrz'93 */ -#endif //_SGFFILT_HXX diff --git a/svtools/inc/sgvmain.hxx b/svtools/inc/sgvmain.hxx deleted file mode 100644 index 58e43e0a00b2..000000000000 --- a/svtools/inc/sgvmain.hxx +++ /dev/null @@ -1,356 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: sgvmain.hxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SGVMAIN_HXX -#define _SGVMAIN_HXX - -#include -#include -#include - - -#define UCHAR unsigned char - -struct PointType { - INT16 x; - INT16 y; -}; - -#define SgfDpmm 40 - -#define DtHdSize 256 -class DtHdType { -public: - BYTE Reserved[256]; - friend SvStream& operator>>(SvStream& rIStream, DtHdType& rDtHd); - friend void DtHdOverSeek(SvStream& rInp); -}; - - -struct Seitenformat { - PointType Size; // 0.00mm...819.175mm (Papiergr��e) - INT16 RandL; // links Rand auf - INT16 RandR; // rechts dem Papier - INT16 RandO; // oben Rand auf - INT16 RandU; // unten dem Papier - BYTE PColor; // Future Use - BYTE PIntens; // erst recht Future use -// BOOL BorderClip; // Objekte am Rand abschneiden (Schummel wg. Allignment unter NT) -}; - - -#define PageSize 146 -class PageType { -public: - UINT32 Next; // N�chste Seite - UINT32 nList; // Objektdaten, erster Record - UINT32 ListEnd; // Objektdaten, letzter Record - Seitenformat Paper; // Papierdaten - BOOL BorderClip; // Objekte am Rand abschneiden (Schummel wg. Allignment unter NT) - BYTE StdPg; // welche Standardseite einblenden ? - PointType U; // Nullpunkt - INT16 HlpLnH[20]; // Hilfslinien - INT16 HlpLnV[20]; - BYTE LnAnzH; - BYTE LnAnzV; - UCHAR PgName[32]; // Seitenname - friend SvStream& operator>>(SvStream& rIStream, PageType& rPage); -}; - - -enum ObjArtType {ObjStrk,ObjRect,ObjPoly,ObjCirc,ObjSpln, - ObjText,ObjGrup,ObjBmap,ObjVirt,ObjTxtX,ObjMaxi}; - -struct ObjLineType { - BYTE LFarbe; // [Index] - BYTE LBFarbe; // [Index] - BYTE LIntens; // [%] - BYTE LMuster; // [Index] inkl. Transparenz - INT16 LMSize; // [Koeffizient/100] - INT16 LDicke; // Strichst�rke -}; - -struct ObjAreaType { - BYTE FFarbe; // [Index] - BYTE FBFarbe; // [Index] - BYTE FIntens; // [%] - BYTE FDummy1; // - INT16 FDummy2; // - UINT16 FMuster; // [Index] inkl. Invers, Transparenz -}; - -#define ObjTextTypeSize 64 -class ObjTextType { -public: - ObjLineType L; // Text-Outline (future) - ObjAreaType F; // Text innen - UINT16 FontLo,FontHi;// z.B. 92500 (CG Times), zweigeteilt wegen DWordAllign in TextType. - UINT16 Grad; // 0.5..32767.5 Pt - bei 1000 Pt sollte aber schlu� sein - UINT16 Breite; // 1..65535% bitte nicht mehr als 500% - BYTE Justify; // 2 Bit Vert (Hi), 3 Bit Hor (Lo) - BYTE Kapit; // 1..255% - UINT16 Schnitt; // 8 Flags - UINT16 LnFeed; // 1..32767% vom max. Schriftgrad der Zeile - UINT16 Slant; // Kursivwinkel 0.00..89.99� default 15.00� doppelt Breit angesehen) - BYTE ZAbst; // Zeichenabstand 0..255% (0=auf der Stelle; 100=normal; 200=Zeichen wird als - INT8 ChrVPos; // Zeichen V-Position default 0= on Baseline, 10= 5Pt drunter (-64..63�) - ObjLineType ShdL; // Schatten-Outline (neu 2.0) - ObjAreaType ShdF; // Schatten-innen (neu 2.0) - PointType ShdVers; // Schattenversatz Max.300.00% - BOOL ShdAbs; // True-> Schattenversatz ist absolut statt relativ zum Schriftgrad - BOOL NoSpc; // True-> kein Zwischenraum (f�r BackArea) - ObjAreaType BackF; // Hintergrundfl�che - UINT32 GetFont(); - void SetFont(UINT32 FontID); -}; - -class Obj0Type { // SuperClass f�r Apple-VMT -public: - virtual void Draw(OutputDevice& rOut); - virtual ~Obj0Type() {} -}; - -#define ObjkSize 20 /* eigentlich 21. Wg. Allignment ist Flags jedoch verschoben worden*/ -class ObjkType: public Obj0Type { // Grundkomponenten aller Stardraw-Objekte -public: - UINT32 Last; - UINT32 Next; - UINT16 MemSize; // in Bytes - PointType ObjMin; // XY-Minimum des Objekts - PointType ObjMax; // XY-Maximum des Objekts - BYTE Art; - BYTE Layer; -// BYTE Flags; // (Schummel f�r Allignment unter NT) - friend SvStream& operator>>(SvStream& rIStream, ObjkType& rObjk); - friend BOOL ObjOverSeek(SvStream& rInp, ObjkType& rObjk); - virtual void Draw(OutputDevice& rOut); -}; - - -#define StrkSize 38 -class StrkType: public ObjkType { -public: - BYTE Flags; // (Schummel f�r Allignment unter NT) - BYTE LEnden; // Linienenden - ObjLineType L; - PointType Pos1; // Anfangspunkt - PointType Pos2; // Endpunkt - friend SvStream& operator>>(SvStream& rIStream, StrkType& rStrk); - virtual void Draw(OutputDevice& rOut); -}; - - -#define RectSize 52 -class RectType: public ObjkType { -public: - BYTE Flags; // (Schummel f�r Allignment unter NT) - BYTE Reserve; - ObjLineType L; - ObjAreaType F; - PointType Pos1; // LO-Ecke = Bezugspunkt - PointType Pos2; // R-Ecke - INT16 Radius; // Eckenradius - UINT16 DrehWink; // 315...<45 - UINT16 Slant; // >270...<90 - friend SvStream& operator>>(SvStream& rIStream, RectType& rRect); - virtual void Draw(OutputDevice& rOut); -}; - - -#define PolySize 44 -class PolyType: public ObjkType { // identisch mit Spline ! -public: - BYTE Flags; // (Schummel f�r Allignment unter NT) - BYTE LEnden; // nur f�r Polyline - ObjLineType L; - ObjAreaType F; // nicht f�r Polyline - BYTE nPoints; - BYTE Reserve; - UINT32 SD_EckP; // Zeiger auf die Eckpunkte (StarDraw) - PointType* EckP; // Zeiger auf die Eckpunkte (StarView (wird nicht von Disk gelesen!)) - friend SvStream& operator>>(SvStream& rIStream, PolyType& rPoly); - virtual void Draw(OutputDevice& rOut); -}; -#define PolyClosBit 0x01 // Unterarten von Poly: 0: PolyLine 1: Polygon - - -#define SplnSize 44 -class SplnType: public ObjkType { // identisch mit Poly ! -public: - BYTE Flags; // (Schummel f�r Allignment unter NT) - BYTE LEnden; // nur f�r nSpline - ObjLineType L; - ObjAreaType F; // nicht f�r nSpline - BYTE nPoints; - BYTE Reserve; - UINT32 SD_EckP; // Zeiger auf die Eckpunkte (StarDraw) - PointType* EckP; // Zeiger auf die Eckpunkte (StarView (wird nicht von Disk gelesen!)) - friend SvStream& operator>>(SvStream& rIStream, SplnType& rSpln); - virtual void Draw(OutputDevice& rOut); -}; -// Unterarten von Spline: siehe Poly - - -#define CircSize 52 -class CircType: public ObjkType { -public: - BYTE Flags; // (Schummel f�r Allignment unter NT) - BYTE LEnden; // nur Bogen (Kr & El) - ObjLineType L; - ObjAreaType F; // nicht f�r Bogen (Kr & El) - PointType Center; // Mittelpunkt - PointType Radius; // Radius - UINT16 DrehWink; // nur Ellipse - UINT16 StartWink; // � nicht f�r Vollkreis - UINT16 RelWink; // � und Vollellipse - friend SvStream& operator>>(SvStream& rIStream, CircType& rCirc); - virtual void Draw(OutputDevice& rOut); -}; -#define CircFull 0x00 /* Unterarten von Kreis: 0: Kreis */ -#define CircSect 0x01 /* 1: Kreissektor */ -#define CircAbsn 0x02 /* 2: Kreisabschnitt */ -#define CircArc 0x03 /* 3: Kreisbogen */ - - -#define TextSize 116 -class TextType: public ObjkType { -public: - BYTE Flags; // (Schummel f�r Allignment unter NT) - BYTE Reserve; // f�r Word Allign - ObjTextType T; // 64 Bytes << DWord-Allign bei FontID erforderlich - PointType Pos1; // Bezugspunkt (ObenLinks) - PointType Pos2; // (untenRechts) - INT16 TopOfs; // Von Oberkante bis Textbegin (future f�r vJustify) - UINT16 DrehWink; // 0...<360 - UINT16 BoxSlant; // >270...<90 (nur Box) - UINT16 BufSize; // Gr��e von Buf f�r Load, Save, Copy und so - UINT16 BufLo,BufHi;// (UCHAR*) Zeiger auf den Textbuffer << ShortArr, weil sonst DWord-Allign erforderlich - UINT16 ExtLo,ExtHi;// (Ptr) Text �ber mehrere Rahmen << ShortArr, weil sonst DWord-Allign erforderlich - PointType FitSize; // Ursprungsgr��e f�r Fit2Size - INT16 FitBreit; // Breite zum formatieren bei Fit2Size - UCHAR* Buffer; // Diese Variable wird nicht durch Lesen von Disk gef�llt, sondern explizit! - friend SvStream& operator>>(SvStream& rIStream, TextType& rText); - virtual void Draw(OutputDevice& rOut); -}; -#define TextOutlBit 0x01 /* 1=Sourcecode f�r Outliner (wird von DrawObjekt() ignoriert) */ -#define TextFitSBit 0x02 /* Bit1: 1=Text-FitToSize, auch Outliner (2.0) */ -#define TextFitZBit 0x08 /* Bit3: 1=Fit2Size Zeilenweise (2.0) */ -#define TextDrftBit 0x04 /* Bit2: 1=DraftDraw (2.0) */ -#define TextFitBits (TextFitSBit | TextFitZBit) - - -enum GrafStat {NoGraf,Pic,Pcx,Hpgl,Img,Msp,Tiff,Dxf,Lot,Usr,Sgf}; - -#define BmapSize 132 -class BmapType: public ObjkType { -public: - BYTE Flags; // (Schummel f�r Allignment unter NT) - BYTE Reserve; - ObjAreaType F; // Farbe und Muster der 1-Plane Bitmap - PointType Pos1; - PointType Pos2; - UINT16 DrehWink; // 315...<45 (Future) - UINT16 Slant; // >270...<90 (Future) - UCHAR Filename[80]; // Pfad - PointType PixSize; // Gr��e in Pixel (0 bei Vektor) - GrafStat Format; // siehe GpmDef.Pas - BYTE nPlanes; // Anzahl der Bitplanes (0 bei Vektor) - BOOL RawOut; // als Raw ausgeben ? - BOOL InvOut; // invertiert ausgeben ? - BOOL LightOut; // aufhellen? (SD20) - BYTE GrfFlg; // (SD20) 0=nSGF 1=Pcx 2=Hpgl 4=Raw $FF=Undef(f�r Fix in DrawBmp) - - INetURLObject aFltPath; // F�r GraphicFilter - friend SvStream& operator>>(SvStream& rIStream, BmapType& rBmap); - virtual void Draw(OutputDevice& rOut); - void SetPaths( const INetURLObject rFltPath ); -}; - - -#define GrupSize 48 -class GrupType: public ObjkType { -public: - BYTE Flags; // (Schummel f�r Allignment unter NT) - UCHAR Name[13]; // Name der Gruppe - UINT16 SbLo,SbHi; // (Ptr) Gruppenliste << ShortArr, weil sonst DWord Allign erforderlich - UINT16 UpLo,UpHi; // (Ptr) Vaterliste << ShortArr, weil sonst DWord Allign erforderlich - UINT16 ChartSize; // Speicherbedarf der Diagrammstruktur Struktur - UINT32 ChartPtr; // Diagrammstruktur - UINT32 GetSubPtr(); // hier nur zum Checken, ob Sublist evtl. leer ist. - friend SvStream& operator>>(SvStream& rIStream, GrupType& rGrup); -// virtual void Draw(OutputDevice& rOut); -}; - - -void SetLine(ObjLineType& rLine, OutputDevice& rOut); -void SetArea(ObjAreaType& rArea, OutputDevice& rOut); -Color Sgv2SvFarbe(BYTE nFrb1, BYTE nFrb2, BYTE nInts); -void RotatePoint(PointType& P, INT16 cx, INT16 cy, double sn, double cs); -void RotatePoint(Point& P, INT16 cx, INT16 cy, double sn, double cs); -INT16 iMulDiv(INT16 a, INT16 Mul, INT16 Div); -UINT16 MulDiv(UINT16 a, UINT16 Mul, UINT16 Div); - - -class SgfFontOne { -public: - SgfFontOne* Next; // Zeiger f�r Listenverkettung - UINT32 IFID; - BOOL Bold; - BOOL Ital; - BOOL Sans; - BOOL Serf; - BOOL Fixd; - FontFamily SVFamil; - CharSet SVChSet; - String SVFName; // z.B. "Times New Roman" = 15 Chars - USHORT SVWidth; // Durchschnittliche Zeichenbreite in % - SgfFontOne(); - void ReadOne( ByteString& ID, ByteString& Dsc); -}; - -class SgfFontLst { -public: - String FNam; // vollst�ndiger Filename des Inifiles - SgfFontOne* pList; // Listenanfang - SgfFontOne* Last; // Listenende - UINT32 LastID; // f�r schnelleren Zugriff bei Wiederholungen - SgfFontOne* LastLn; // f�r schnelleren Zugriff bei Wiederholungen - BOOL Tried; - SgfFontLst(); - ~SgfFontLst(); - void AssignFN(const String& rFName); - void ReadList(); - void RausList(); - SgfFontOne* GetFontDesc(UINT32 ID); -}; - -#endif //_SGVMAIN_HXX - - diff --git a/svtools/inc/sgvspln.hxx b/svtools/inc/sgvspln.hxx deleted file mode 100644 index 7e9976eaf25b..000000000000 --- a/svtools/inc/sgvspln.hxx +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: sgvspln.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SGVSPLN_HXX -#define _SGVSPLN_HXX - -/************************************************************************* -|* -|* CalcSpline() -|* -|* Beschreibung Berechnet die Koeffizienten eines parametrischen -|* natrlichen oder periodischen kubischen -|* Polynomsplines. Die Eckpunkte des bergebenen -|* Polygons werden als Sttzstellen angenommen. -|* n liefert die Anzahl der Teilpolynome. -|* Ist die Berechnung fehlerfrei verlaufen, so -|* liefert die Funktion TRUE. Nur in diesem Fall -|* ist Speicher fr die Koeffizientenarrays -|* allokiert, der dann spter vom Aufrufer mittels -|* delete freizugeben ist. -|* Ersterstellung JOE 17-08.93 -|* Letzte Aenderung JOE 17-08.93 -|* -*************************************************************************/ - -BOOL CalcSpline(Polygon& rPoly, BOOL Periodic, USHORT& n, - double*& ax, double*& ay, double*& bx, double*& by, - double*& cx, double*& cy, double*& dx, double*& dy, double*& T); - -/************************************************************************* -|* -|* Poly2Spline() -|* -|* Beschreibung Konvertiert einen parametrichen kubischen -|* Polynomspline Spline (natrlich oder periodisch) -|* in ein angenhertes Polygon. -|* Die Funktion liefert FALSE, wenn ein Fehler bei -|* der Koeffizientenberechnung aufgetreten ist oder -|* das Polygon zu gro wird (>PolyMax=16380). Im 1. -|* Fall hat das Polygon 0, im 2. Fall PolyMax Punkte. -|* Um Koordinatenberlufe zu vermeiden werden diese -|* auf +/-32000 begrenzt. -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* -*************************************************************************/ -BOOL Spline2Poly(Polygon& rSpln, BOOL Periodic, Polygon& rPoly); - -#endif //_SGVSPLN_HXX diff --git a/svtools/inc/strmadpt.hxx b/svtools/inc/strmadpt.hxx deleted file mode 100644 index 7a080c1c7bcc..000000000000 --- a/svtools/inc/strmadpt.hxx +++ /dev/null @@ -1,138 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: strmadpt.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SVTOOLS_STRMADPT_HXX -#define SVTOOLS_STRMADPT_HXX - -#include "svtools/svldllapi.h" -#include -#include -#include -#include -#include - -//============================================================================ -class SVL_DLLPUBLIC SvOutputStreamOpenLockBytes: public SvOpenLockBytes -{ - com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > - m_xOutputStream; - sal_uInt32 m_nPosition; - -public: - TYPEINFO(); - - SvOutputStreamOpenLockBytes( - const com::sun::star::uno::Reference< - com::sun::star::io::XOutputStream > & - rTheOutputStream): - m_xOutputStream(rTheOutputStream), m_nPosition(0) {} - - virtual ErrCode ReadAt(ULONG, void *, ULONG, ULONG *) const; - - virtual ErrCode WriteAt(ULONG nPos, const void * pBuffer, ULONG nCount, - ULONG * pWritten); - - virtual ErrCode Flush() const; - - virtual ErrCode SetSize(ULONG); - - virtual ErrCode Stat(SvLockBytesStat * pStat, SvLockBytesStatFlag) const; - - virtual ErrCode FillAppend(const void * pBuffer, ULONG nCount, - ULONG * pWritten); - - virtual ULONG Tell() const; - - virtual ULONG Seek(ULONG); - - virtual void Terminate(); -}; - -//============================================================================ -class SVL_DLLPUBLIC SvLockBytesInputStream: public cppu::OWeakObject, - public com::sun::star::io::XInputStream, - public com::sun::star::io::XSeekable -{ - SvLockBytesRef m_xLockBytes; - sal_Int64 m_nPosition; - bool m_bDone; - -public: - SvLockBytesInputStream(SvLockBytes * pTheLockBytes): - m_xLockBytes(pTheLockBytes), m_nPosition(0), m_bDone(false) {} - - virtual com::sun::star::uno::Any SAL_CALL - queryInterface(const com::sun::star::uno::Type & rType) - throw (com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL acquire() throw(); - - virtual void SAL_CALL release() throw(); - - virtual sal_Int32 SAL_CALL - readBytes(com::sun::star::uno::Sequence< sal_Int8 > & rData, - sal_Int32 nBytesToRead) - throw (com::sun::star::io::IOException, - com::sun::star::uno::RuntimeException); - - virtual sal_Int32 SAL_CALL - readSomeBytes(com::sun::star::uno::Sequence< sal_Int8 > & rData, - sal_Int32 nMaxBytesToRead) - throw (com::sun::star::io::IOException, - com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) - throw (com::sun::star::io::IOException, - com::sun::star::uno::RuntimeException); - - virtual sal_Int32 SAL_CALL available() - throw (com::sun::star::io::IOException, - com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL closeInput() - throw (com::sun::star::io::IOException, - com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL seek(sal_Int64 nLocation) - throw (com::sun::star::lang::IllegalArgumentException, - com::sun::star::io::IOException, - com::sun::star::uno::RuntimeException); - - virtual sal_Int64 SAL_CALL getPosition() - throw (com::sun::star::io::IOException, - com::sun::star::uno::RuntimeException); - - virtual sal_Int64 SAL_CALL getLength() - throw (com::sun::star::io::IOException, - com::sun::star::uno::RuntimeException); -}; - -#endif // SVTOOLS_STRMADPT_HXX - diff --git a/svtools/inc/stylepool.hxx b/svtools/inc/stylepool.hxx deleted file mode 100644 index 1b1f129d7f4c..000000000000 --- a/svtools/inc/stylepool.hxx +++ /dev/null @@ -1,103 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: stylepool.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_STYLEPOOL_HXX -#define INCLUDED_SVTOOLS_STYLEPOOL_HXX - -#include -#include -#include - -class StylePoolImpl; -class StylePoolIterImpl; -class IStylePoolIteratorAccess; - -class SVL_DLLPUBLIC StylePool -{ -private: - StylePoolImpl *pImpl; -public: - typedef boost::shared_ptr SfxItemSet_Pointer_t; - - // --> OD 2008-03-07 #i86923# - explicit StylePool( SfxItemSet* pIgnorableItems = 0 ); - // <-- - - /** Insert a SfxItemSet into the style pool. - - The pool makes a copy of the provided SfxItemSet. - - @param SfxItemSet - the SfxItemSet to insert - - @return a shared pointer to the SfxItemSet - */ - virtual SfxItemSet_Pointer_t insertItemSet( const SfxItemSet& rSet ); - - /** Create an iterator - - The iterator walks through the StylePool - OD 2008-03-07 #i86923# - introduce optional parameter to control, if unused SfxItemsSet are skipped or not - introduce optional parameter to control, if ignorable items are skipped or not - - @attention every change, e.g. destruction, of the StylePool could cause undefined effects. - - @param bSkipUnusedItemSets - input parameter - boolean, indicating if unused SfxItemSets are skipped or not - - @param bSkipIgnorableItems - input parameter - boolean, indicating if ignorable items are skipped or not - - @postcond the iterator "points before the first" SfxItemSet of the pool. - The first StylePoolIterator::getNext() call will deliver the first SfxItemSet. - */ - virtual IStylePoolIteratorAccess* createIterator( const bool bSkipUnusedItemSets = false, - const bool bSkipIgnorableItems = false ); - - /** Returns the number of styles - */ - virtual sal_Int32 getCount() const; - - virtual ~StylePool(); - - static ::rtl::OUString nameOf( SfxItemSet_Pointer_t pSet ); -}; - -class SVL_DLLPUBLIC IStylePoolIteratorAccess -{ -public: - /** Delivers a shared pointer to the next SfxItemSet of the pool - If there is no more SfxItemSet, the delivered share_pointer is empty. - */ - virtual StylePool::SfxItemSet_Pointer_t getNext() = 0; - virtual ::rtl::OUString getName() = 0; - virtual ~IStylePoolIteratorAccess() {}; -}; -#endif diff --git a/svtools/inc/svimpbox.hxx b/svtools/inc/svimpbox.hxx deleted file mode 100644 index 10463fc05906..000000000000 --- a/svtools/inc/svimpbox.hxx +++ /dev/null @@ -1,477 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: svimpbox.hxx,v $ - * $Revision: 1.22 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVIMPLBOX_HXX -#define _SVIMPLBOX_HXX - -#ifndef _SELENG_HXX -#include -#endif -#ifndef _SCRBAR_HXX -#include -#endif -#include -// #102891# ---------------- -#include -// #97680# ----------------- -#include -#include "svtaccessiblefactory.hxx" - -class SvTreeListBox; -class Point; -class DropEvent; -class SvLBoxTreeList; -class SvImpLBox; -class SvLBoxEntry; -class SvLBoxItem; -class SvLBoxTab; -class TabBar; - -class ImpLBSelEng : public FunctionSet -{ - SvImpLBox* pImp; - SelectionEngine* pSelEng; - SvTreeListBox* pView; - -public: - ImpLBSelEng( SvImpLBox* pImp, SelectionEngine* pSelEng, - SvTreeListBox* pView ); - virtual ~ImpLBSelEng(); - void BeginDrag(); - void CreateAnchor(); - void DestroyAnchor(); - BOOL SetCursorAtPoint( const Point& rPoint, - BOOL bDontSelectAtCursor=FALSE ); - BOOL IsSelectionAtPoint( const Point& rPoint ); - void DeselectAtPoint( const Point& rPoint ); - void DeselectAll(); -}; - -// Flags fuer nFlag -#define F_VER_SBARSIZE_WITH_HBAR 0x0001 -#define F_HOR_SBARSIZE_WITH_VBAR 0x0002 -#define F_IGNORE_NEXT_MOUSEMOVE 0x0004 // OS/2 only -#define F_IN_SCROLLING 0x0008 -#define F_DESEL_ALL 0x0010 -#define F_START_EDITTIMER 0x0020 // MAC only -#define F_IGNORE_SELECT 0x0040 -#define F_IN_RESIZE 0x0080 -#define F_REMOVED_ENTRY_INVISIBLE 0x0100 -#define F_REMOVED_RECALC_MOST_RIGHT 0x0200 -#define F_IGNORE_CHANGED_TABS 0x0400 -#define F_PAINTED 0x0800 -#define F_IN_PAINT 0x1000 -#define F_ENDSCROLL_SET_VIS_SIZE 0x2000 -#define F_FILLING 0x4000 - - -class SvImpLBox -{ -friend class ImpLBSelEng; -friend class SvTreeListBox; -private: - SvTreeListBox* pView; - SvLBoxTreeList* pTree; - SvLBoxEntry* pCursor; - SvLBoxEntry* pStartEntry; - SvLBoxEntry* pAnchor; - SvLBoxEntry* pMostRightEntry; - SvLBoxButton* pActiveButton; - SvLBoxEntry* pActiveEntry; - SvLBoxTab* pActiveTab; - TabBar* pTabBar; - - ScrollBar aVerSBar; - ScrollBar aHorSBar; - ScrollBarBox aScrBarBox; - - ::svt::AccessibleFactoryAccess - m_aFactoryAccess; - - static Image* s_pDefCollapsed; - static Image* s_pDefExpanded; - static Image* s_pDefCollapsedHC; - static Image* s_pDefExpandedHC; - static oslInterlockedCount s_nImageRefCount; /// When 0 all static images will be destroyed - - // Node Bitmaps - enum ImageType - { - itNodeExpanded = 0, // node is expanded ( usually a bitmap showing a minus ) - itNodeCollapsed, // node is collapsed ( usually a bitmap showing a plus ) - itNodeDontKnow, // don't know the node state - itEntryDefExpanded, // default for expanded entries - itEntryDefCollapsed, // default for collapsed entries - - IT_IMAGE_COUNT - }; - - // all our images - Image m_aNodeAndEntryImages[ IT_IMAGE_COUNT ]; - // plus the high contrast versions - Image m_aNodeAndEntryImages_HC[ IT_IMAGE_COUNT ]; - - // wg. kompat. hier - Size aOutputSize; - SelectionEngine aSelEng; - ImpLBSelEng aFctSet; - Timer aAsyncBeginDragTimer; - Point aAsyncBeginDragPos; - - long nYoffsNodeBmp; - long nNodeBmpTabDistance; // typisch kleiner 0 - long nNodeBmpWidth; - long nNextVerVisSize; - long nMostRight; - ULONG nVisibleCount; // Anzahl Zeilen im Control - ULONG nCurUserEvent; //-1 == kein Userevent amn Laufen - short nHorSBarHeight, nVerSBarWidth; - USHORT nFlags; - USHORT nCurTabPos; - - WinBits nWinBits; - ExtendedWinBits nExtendedWinBits; - BOOL bSimpleTravel : 1; // ist TRUE bei SINGLE_SELECTION - BOOL bUpdateMode : 1; - BOOL bInVScrollHdl : 1; - BOOL bAsyncBeginDrag : 1; - BOOL bSubLstOpRet : 1; // open/close sublist with return/enter, defaulted with FALSE - BOOL bSubLstOpLR : 1; // open/close sublist with cursor left/right, defaulted with FALSE - BOOL bContextMenuHandling : 1; - BOOL bIsCellFocusEnabled : 1; - - sal_Bool bAreChildrenTransient; - - Point aEditClickPos; - Timer aEditTimer; - - // #102891# ------------------- - IntlWrapper * pIntlWrapper; - - // #97680# -------------------- - std::vector< short > aContextBmpWidthVector; - - DECL_LINK( EditTimerCall, Timer * ); - - DECL_LINK( BeginDragHdl, void* ); - DECL_LINK( MyUserEvent,void*); - void StopUserEvent(); - - void InvalidateEntriesFrom( long nY ) const; - void InvalidateEntry( long nY ) const; - void ShowVerSBar(); - // setzt Thumb auf FirstEntryToDraw - void SyncVerThumb(); - BOOL IsLineVisible( long nY ) const; - long GetEntryLine( SvLBoxEntry* pEntry ) const; - void FillView(); - void CursorDown(); - void CursorUp(); - void KeyLeftRight( long nDiff ); - void PageDown( USHORT nDelta ); - void PageUp( USHORT nDelta ); - - void SetCursor( SvLBoxEntry* pEntry, BOOL bForceNoSelect = FALSE ); - - void DrawNet(); - - // ScrollBar-Handler - DECL_LINK( ScrollUpDownHdl, ScrollBar * ); - DECL_LINK( ScrollLeftRightHdl, ScrollBar * ); - DECL_LINK( EndScrollHdl, ScrollBar * ); - - void SetNodeBmpYOffset( const Image& ); - void SetNodeBmpTabDistance(); - - // Selection-Engine - SvLBoxEntry* MakePointVisible( const Point& rPoint, - BOOL bNotifyScroll=TRUE ); - - void SetAnchorSelection( SvLBoxEntry* pOld, - SvLBoxEntry* pNewCursor ); - void BeginDrag(); - BOOL ButtonDownCheckCtrl( const MouseEvent& rMEvt, - SvLBoxEntry* pEntry, long nY ); - BOOL MouseMoveCheckCtrl( const MouseEvent& rMEvt, - SvLBoxEntry* pEntry ); - BOOL ButtonUpCheckCtrl( const MouseEvent& rMEvt ); - BOOL ButtonDownCheckExpand( const MouseEvent&, - SvLBoxEntry*,long nY ); - - void PositionScrollBars( Size& rOSize, USHORT nMask ); - USHORT AdjustScrollBars( Size& rSize ); - - void BeginScroll(); - void EndScroll(); - BOOL InScroll() const { return (BOOL)(nFlags & F_IN_SCROLLING)!=0;} - Rectangle GetVisibleArea() const; - BOOL EntryReallyHit(SvLBoxEntry* pEntry,const Point& rPos,long nLine); - void InitScrollBarBox(); - SvLBoxTab* NextTab( SvLBoxTab* ); - - BOOL SetMostRight( SvLBoxEntry* pEntry ); - void FindMostRight( SvLBoxEntry* EntryToIgnore ); - void FindMostRight( SvLBoxEntry* pParent, SvLBoxEntry* EntryToIgnore ); - void FindMostRight_Impl( SvLBoxEntry* pParent,SvLBoxEntry* EntryToIgnore ); - void NotifyTabsChanged(); - - inline BOOL IsExpandable() const // if element at cursor can be expanded in general - { return pCursor->HasChilds() || pCursor->HasChildsOnDemand(); } - inline BOOL IsNowExpandable() const // if element at cursor can be expanded at this moment - { return IsExpandable() && !pView->IsExpanded( pCursor ); } - - static void implInitDefaultNodeImages(); - - // #102891# ------------------- - void UpdateIntlWrapper(); - - // #97680# -------------------- - short UpdateContextBmpWidthVector( SvLBoxEntry* pEntry, short nWidth ); - void UpdateContextBmpWidthMax( SvLBoxEntry* pEntry ); - void UpdateContextBmpWidthVectorFromMovedEntry( SvLBoxEntry* pEntry ); - - void CalcCellFocusRect( SvLBoxEntry* pEntry, Rectangle& rRect ); - - inline sal_Bool AreChildrenTransient() const { return bAreChildrenTransient; } - inline void SetChildrenNotTransient() { bAreChildrenTransient = sal_False; } - -public: - SvImpLBox( SvTreeListBox* pView, SvLBoxTreeList*, WinBits nWinStyle ); - ~SvImpLBox(); - - void Clear(); - void SetWindowBits( WinBits nWinStyle ); - void SetExtendedWindowBits( ExtendedWinBits _nBits ); - ExtendedWinBits GetExtendedWindowBits() const { return nExtendedWinBits; } - void SetModel( SvLBoxTreeList* pModel ) { pTree = pModel;} - - void EntryInserted( SvLBoxEntry*); - void RemovingEntry( SvLBoxEntry* pEntry ); - void EntryRemoved(); - void MovingEntry( SvLBoxEntry* pEntry ); - void EntryMoved( SvLBoxEntry* pEntry ); - void TreeInserted( SvLBoxEntry* pEntry ); - - void IndentChanged( short nIndentPixel ); - void EntryExpanded( SvLBoxEntry* pEntry ); - void EntryCollapsed( SvLBoxEntry* pEntry ); - void CollapsingEntry( SvLBoxEntry* pEntry ); - void EntrySelected( SvLBoxEntry*, BOOL bSelect ); - - void Paint( const Rectangle& rRect ); - void RepaintSelectionItems(); - void MouseButtonDown( const MouseEvent& ); - void MouseButtonUp( const MouseEvent& ); - void MouseMove( const MouseEvent&); - BOOL KeyInput( const KeyEvent& ); - void Resize(); - void GetFocus(); - void LoseFocus(); - void UpdateAll( - BOOL bInvalidateCompleteView= TRUE, - BOOL bUpdateVerSBar = TRUE ); - void SetEntryHeight( short nHeight ); - void PaintEntry( SvLBoxEntry* pEntry ); - void InvalidateEntry( SvLBoxEntry* ); - void RecalcFocusRect(); - - inline void SelectEntry( SvLBoxEntry* pEntry, BOOL bSelect ); - void SetDragDropMode( DragDropMode eDDMode ); - void SetSelectionMode( SelectionMode eSelMode ); - void SetAddMode( BOOL ) { aSelEng.AddAlways(FALSE); } - BOOL IsAddMode() const { return aSelEng.IsAlwaysAdding(); } - - SvLBoxEntry* GetCurrentEntry() const { return pCursor; } - BOOL IsEntryInView( SvLBoxEntry* ) const; - SvLBoxEntry* GetEntry( const Point& rPos ) const; - // gibt letzten Eintrag zurueck, falls Pos unter letztem Eintrag - SvLBoxEntry* GetClickedEntry( const Point& ) const; - SvLBoxEntry* GetCurEntry() const { return pCursor; } - void SetCurEntry( SvLBoxEntry* ); - Point GetEntryPosition( SvLBoxEntry* ) const; - void MakeVisible( SvLBoxEntry* pEntry, BOOL bMoveToTop=FALSE ); - - void PaintDDCursor( SvLBoxEntry* ); - - // Images - inline Image& implGetImageLocation( const ImageType _eType, BmpColorMode _eMode ); - inline Image& implGetImageLocationWithFallback( const ImageType _eType, BmpColorMode _eMode ) const; - - inline void SetExpandedNodeBmp( const Image& _rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL ); - inline void SetCollapsedNodeBmp( const Image& _rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL ); - inline void SetDontKnowNodeBmp( const Image& rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL ); - - inline const Image& GetExpandedNodeBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL ) const; - inline const Image& GetCollapsedNodeBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL ) const; - inline const Image& GetDontKnowNodeBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL ) const; - - inline void SetDefaultEntryExpBmp( const Image& _rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL ); - inline void SetDefaultEntryColBmp( const Image& _rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL ); - inline const Image& GetDefaultEntryExpBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL ); - inline const Image& GetDefaultEntryColBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL ); - - static const Image& GetDefaultExpandedNodeImage( BmpColorMode _eMode = BMP_COLOR_NORMAL ); - static const Image& GetDefaultCollapsedNodeImage( BmpColorMode _eMode = BMP_COLOR_NORMAL ); - - const Size& GetOutputSize() const { return aOutputSize;} - void KeyUp( BOOL bPageUp, BOOL bNotifyScroll = TRUE ); - void KeyDown( BOOL bPageDown, BOOL bNotifyScroll = TRUE ); - void Command( const CommandEvent& rCEvt ); - - void Invalidate(); - void DestroyAnchor() { pAnchor=0; aSelEng.Reset(); } - void SelAllDestrAnch( BOOL bSelect, - BOOL bDestroyAnchor = TRUE, - BOOL bSingleSelToo = FALSE ); - void ShowCursor( BOOL bShow ); - - BOOL RequestHelp( const HelpEvent& rHEvt ); - void EndSelection(); - BOOL IsNodeButton( const Point& rPosPixel, SvLBoxEntry* pEntry ) const; - void RepaintScrollBars(); - void EnableAsyncDrag( BOOL b) { bAsyncBeginDrag = b; } - void SetUpdateMode( BOOL ); - void SetUpdateModeFast( BOOL ); - BOOL GetUpdateMode() const { return bUpdateMode; } - Rectangle GetClipRegionRect() const; - BOOL HasHorScrollBar() const { return aHorSBar.IsVisible(); } - void ShowFocusRect( const SvLBoxEntry* pEntry ); - void SetTabBar( TabBar* pTabBar ); - void CancelPendingEdit(); - - void CallEventListeners( ULONG nEvent, void* pData = NULL ); - - /** Enables, that one cell of a tablistbox entry can be focused */ - inline BOOL IsCellFocusEnabled() const { return bIsCellFocusEnabled; } - inline void EnableCellFocus() { bIsCellFocusEnabled = TRUE; } - bool SetCurrentTabPos( USHORT _nNewPos ); - inline USHORT GetCurrentTabPos() const { return nCurTabPos; } - - bool IsSelectable( const SvLBoxEntry* pEntry ); -}; - -inline Image& SvImpLBox::implGetImageLocation( const ImageType _eType, BmpColorMode _eMode ) -{ - DBG_ASSERT( ( BMP_COLOR_HIGHCONTRAST == _eMode ) || ( BMP_COLOR_NORMAL == _eMode ), - "SvImpLBox::implGetImageLocation: invalid mode!" ); - DBG_ASSERT( ( _eType >= 0 ) && ( _eType < IT_IMAGE_COUNT ), - "SvImpLBox::implGetImageLocation: invalid image index (will crash)!" ); - - Image* _pSet = ( BMP_COLOR_HIGHCONTRAST == _eMode ) ? m_aNodeAndEntryImages_HC : m_aNodeAndEntryImages; - return *( _pSet + (sal_Int32)_eType ); -} - -inline Image& SvImpLBox::implGetImageLocationWithFallback( const ImageType _eType, BmpColorMode _eMode ) const -{ - Image& rImage = const_cast< SvImpLBox* >( this )->implGetImageLocation( _eType, _eMode ); - if ( !rImage ) - // fallback to normal images in case the one for the special mode has not been set - rImage = const_cast< SvImpLBox* >( this )->implGetImageLocation( _eType, BMP_COLOR_NORMAL ); - return rImage; -} - -inline void SvImpLBox::SetDontKnowNodeBmp( const Image& rImg, BmpColorMode _eMode ) -{ - implGetImageLocation( itNodeDontKnow, _eMode ) = rImg; -} - -inline void SvImpLBox::SetExpandedNodeBmp( const Image& rImg, BmpColorMode _eMode ) -{ - implGetImageLocation( itNodeExpanded, _eMode ) = rImg; - SetNodeBmpYOffset( rImg ); -} - -inline void SvImpLBox::SetCollapsedNodeBmp( const Image& rImg, BmpColorMode _eMode ) -{ - implGetImageLocation( itNodeCollapsed, _eMode ) = rImg; - SetNodeBmpYOffset( rImg ); -} - -inline const Image& SvImpLBox::GetDontKnowNodeBmp( BmpColorMode _eMode ) const -{ - return implGetImageLocationWithFallback( itNodeDontKnow, _eMode ); -} - -inline const Image& SvImpLBox::GetExpandedNodeBmp( BmpColorMode _eMode ) const -{ - return implGetImageLocationWithFallback( itNodeExpanded, _eMode ); -} - -inline const Image& SvImpLBox::GetCollapsedNodeBmp( BmpColorMode _eMode ) const -{ - return implGetImageLocationWithFallback( itNodeCollapsed, _eMode ); -} - -inline void SvImpLBox::SetDefaultEntryExpBmp( const Image& _rImg, BmpColorMode _eMode ) -{ - implGetImageLocation( itEntryDefExpanded, _eMode ) = _rImg; -} - -inline void SvImpLBox::SetDefaultEntryColBmp( const Image& _rImg, BmpColorMode _eMode ) -{ - implGetImageLocation( itEntryDefCollapsed, _eMode ) = _rImg; -} - -inline const Image& SvImpLBox::GetDefaultEntryExpBmp( BmpColorMode _eMode ) -{ - return implGetImageLocationWithFallback( itEntryDefExpanded, _eMode ); -} - -inline const Image& SvImpLBox::GetDefaultEntryColBmp( BmpColorMode _eMode ) -{ - return implGetImageLocationWithFallback( itEntryDefCollapsed, _eMode ); -} - -inline Point SvImpLBox::GetEntryPosition( SvLBoxEntry* pEntry ) const -{ - return Point( 0, GetEntryLine( pEntry ) ); -} - -inline void SvImpLBox::PaintEntry( SvLBoxEntry* pEntry ) -{ - long nY = GetEntryLine( pEntry ); - pView->PaintEntry( pEntry, nY ); -} - -inline BOOL SvImpLBox::IsLineVisible( long nY ) const -{ - BOOL bRet = TRUE; - if ( nY < 0 || nY >= aOutputSize.Height() ) - bRet = FALSE; - return bRet; -} - -inline void SvImpLBox::TreeInserted( SvLBoxEntry* pInsTree ) -{ - EntryInserted( pInsTree ); -} - -#endif // #ifndef _SVIMPLBOX_HXX - diff --git a/svtools/inc/svimpicn.hxx b/svtools/inc/svimpicn.hxx deleted file mode 100644 index 724a92543700..000000000000 --- a/svtools/inc/svimpicn.hxx +++ /dev/null @@ -1,324 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: svimpicn.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVIMPICN_HXX -#define _SVIMPICN_HXX - -#ifndef _VIRDEV_HXX -#include -#endif - -#ifndef _SCRBAR_HXX -#include -#endif -#include - -class SvLBoxEntry; -class SvLBoxTreeList; -class SvImpIconView; -class ImpIcnCursor; -class SvPtrarr; - -#define PAINTFLAG_HOR_CENTERED 0x0001 -#define PAINTFLAG_VER_CENTERED 0x0002 - -#define SELRECT_BORDER_OFFS -7 -// Flags -#define F_VER_SBARSIZE_WITH_HBAR 0x00000001 -#define F_HOR_SBARSIZE_WITH_VBAR 0x00000002 -#define F_IGNORE_NEXT_MOUSEMOVE 0x00000004 // OS/2 only -#define F_ENTRY_REMOVED 0x00000008 -// ist gesetzt, wenn nach Clear oder Ctor mind. einmal gepaintet wurde -#define F_PAINTED 0x00000010 -#define F_ADD_MODE 0x00000020 -#define F_MOVING_SIBLING 0x00000040 -#define F_SELRECT_VISIBLE 0x00000080 -#define F_CMD_ARRIVED 0x00000100 -#define F_DRAG_SOURCE 0x00000200 -#define F_GRIDMODE 0x00000400 -// beim Einfuegen eines Eintrags ergibt sich dessen Position -// durch simples Addieren auf die Position des zuletzt eingefuegten Eintrags -#define F_GRID_INSERT 0x00000800 -#define F_DOWN_CTRL 0x00001000 -#define F_DOWN_DESELECT 0x00002000 -// Hack fuer D&D: Hintergrund des Entries nicht painten -#define F_NO_EMPHASIS 0x00004000 -// Selektion per Gummiband -#define F_RUBBERING 0x00008000 -#define F_START_EDITTIMER_IN_MOUSEUP 0x00010000 - -class SvImpIconView -{ - friend class ImpIcnCursor; - ScrollBar aVerSBar; - ScrollBar aHorSBar; - Rectangle aCurSelectionRect; - SvPtrarr aSelectedRectList; - MouseEvent aMouseMoveEvent; - Timer aEditTimer; // fuer Inplace-Editieren - Timer aMouseMoveTimer; // generiert MouseMoves bei Gummibandselektion - // Boundrect des zuletzt eingefuegten Entries - Rectangle aPrevBoundRect; - Size aOutputSize; // Pixel - Size aVirtOutputSize; // expandiert automatisch - Point aDDLastEntryPos; - Point aDDLastRectPos; - - SvLBoxTreeList* pModel; - SvIconView* pView; - ImpIcnCursor* pImpCursor; - long nMaxVirtWidth; // max.breite aVirtOutputSize - SvPtrarr* pZOrderList; - long nGridDX, - nGridDY; - long nHorSBarHeight, - nVerSBarWidth; - WinBits nWinBits; - int nViewMode; - long nHorDist; - long nVerDist; - long nMaxBmpWidth; - long nMaxBmpHeight; - long nMaxTextWidth; - long nMaxBoundHeight; // Hoehe des hoechsten BoundRects - ULONG nFlags; - ULONG nCurUserEvent; - SvLBoxEntry* pCurParent; - SvLBoxEntry* pCursor; - SvLBoxEntry* pNextCursor; // wird in MovingEntry gesetzt und ist - // nur in EntryMoved gueltig! - SvLBoxEntry* pDDRefEntry; - VirtualDevice* pDDDev; - VirtualDevice* pDDBufDev; - VirtualDevice* pDDTempDev; - - SvIconViewTextMode eTextMode; - BOOL bMustRecalcBoundingRects; - - void CheckAllSizes(); - void CheckSizes( SvLBoxEntry* pEntry, - const SvIcnVwDataEntry* pViewData = 0 ); - void ShowCursor( BOOL bShow ); - - void SetNextEntryPos(const Point& rPos); - Point FindNextEntryPos( const Size& rBoundSize ); - void ImpArrange(); - void AdjustVirtSize( const Rectangle& ); - void ResetVirtSize(); - void CheckScrollBars(); - - DECL_LINK( ScrollUpDownHdl, ScrollBar * ); - DECL_LINK( ScrollLeftRightHdl, ScrollBar * ); - DECL_LINK( MouseMoveTimeoutHdl, Timer* ); - DECL_LINK( EditTimeoutHdl, Timer* ); - DECL_LINK( UserEventHdl, void* ); - void AdjustScrollBars(); - void PositionScrollBars( long nRealWidth, long nRealHeight ); - void CalcDocPos( Point& aMousePos ); - BOOL GetResizeRect( Rectangle& ); - void PaintResizeRect( const Rectangle& ); - SvLBoxEntry* GetNewCursor(); - void ToggleSelection( SvLBoxEntry* ); - void DeselectAllBut( SvLBoxEntry* ); - void Center( SvLBoxEntry* pEntry, SvIcnVwDataEntry* ) const; - void StopEditTimer() { aEditTimer.Stop(); } - void StartEditTimer() { aEditTimer.Start(); } - void ImpHideDDIcon(); - void ImpDrawXORRect( const Rectangle& rRect ); - void AddSelectedRect( const Rectangle&, short nOffset = SELRECT_BORDER_OFFS ); - void ClearSelectedRectList(); - Rectangle CalcMaxTextRect( const SvLBoxEntry* pEntry, - const SvIcnVwDataEntry* pViewData ) const; - - void ClipAtVirtOutRect( Rectangle& rRect ) const; - void AdjustAtGrid( const SvPtrarr& rRow, SvLBoxEntry* pStart=0 ); - Point AdjustAtGrid( - const Rectangle& rCenterRect, // "Schwerpunkt" des Objekts (typ. Bmp-Rect) - const Rectangle& rBoundRect ) const; - SvIconViewTextMode GetEntryTextModeSmart( const SvLBoxEntry* pEntry, - const SvIcnVwDataEntry* pViewData ) const; - - BOOL CheckVerScrollBar(); - BOOL CheckHorScrollBar(); - void CancelUserEvent(); - -public: - - SvImpIconView( SvIconView* pView, SvLBoxTreeList*, WinBits nWinStyle ); - ~SvImpIconView(); - - void Clear( BOOL bInCtor = FALSE ); - void SetWindowBits( WinBits nWinStyle ); - void SetModel( SvLBoxTreeList* pTree, SvLBoxEntry* pParent ) - { pModel = pTree; SetCurParent(pParent); } - void EntryInserted( SvLBoxEntry*); - void RemovingEntry( SvLBoxEntry* pEntry ); - void EntryRemoved(); - void MovingEntry( SvLBoxEntry* pEntry ); - void EntryMoved( SvLBoxEntry* pEntry ); - void TreeInserted( SvLBoxEntry* pEntry ); - void ChangedFont(); - void ModelHasEntryInvalidated( SvListEntry* ); - void EntryExpanded( SvLBoxEntry* pEntry ); - void EntryCollapsed( SvLBoxEntry* pEntry ); - void CollapsingEntry( SvLBoxEntry* pEntry ); - void EntrySelected( SvLBoxEntry*, BOOL bSelect ); - - void Paint( const Rectangle& rRect ); - void RepaintSelectionItems(); - void MouseButtonDown( const MouseEvent& ); - void MouseButtonUp( const MouseEvent& ); - void MouseMove( const MouseEvent&); - BOOL KeyInput( const KeyEvent& ); - void Resize(); - void GetFocus(); - void LoseFocus(); - void UpdateAll(); - void PaintEntry( SvLBoxEntry* pEntry, - SvIcnVwDataEntry* pViewData = 0 ); - void PaintEntry( SvLBoxEntry*, const Point&, - SvIcnVwDataEntry* pViewData = 0, OutputDevice* pOut = 0); - void SetEntryPosition( SvLBoxEntry* pEntry, const Point& rPos, - BOOL bAdjustRow = FALSE, - BOOL bCheckScrollBars = FALSE ); - void InvalidateEntry( SvLBoxEntry* ); - void ViewDataInitialized( SvLBoxEntry* pEntry ); - SvLBoxItem* GetItem( SvLBoxEntry*, const Point& rAbsPos ); - - void SetNoSelection(); - void SetDragDropMode( DragDropMode eDDMode ); - void SetSelectionMode( SelectionMode eSelMode ); - - void SttDrag( const Point& rPos ); - void EndDrag(); - - SvLBoxEntry* GetCurEntry() const { return pCursor; } - void SetCursor( SvLBoxEntry* ); - - BOOL IsEntryInView( SvLBoxEntry* ); - SvLBoxEntry* GetEntry( const Point& rDocPos ); - SvLBoxEntry* GetNextEntry( const Point& rDocPos, SvLBoxEntry* pCurEntry ); - SvLBoxEntry* GetPrevEntry( const Point& rDocPos, SvLBoxEntry* pCurEntry ); - - Point GetEntryPosition( SvLBoxEntry* ); - void MakeVisible( SvLBoxEntry* pEntry ); - - void Arrange(); - - void SetSpaceBetweenEntries( long nHor, long Ver ); - long GetHorSpaceBetweenEntries() const { return nHorDist; } - long GetVerSpaceBetweenEntries() const { return nVerDist; } - - Rectangle CalcFocusRect( SvLBoxEntry* ); - - Rectangle CalcBmpRect( SvLBoxEntry*, const Point* pPos = 0, - SvIcnVwDataEntry* pViewData=0 ); - Rectangle CalcTextRect( SvLBoxEntry*, SvLBoxString* pItem = 0, - const Point* pPos = 0, - BOOL bForInplaceEdit = FALSE, - SvIcnVwDataEntry* pViewData = 0 ); - - long CalcBoundingWidth( SvLBoxEntry*, const SvIcnVwDataEntry* pViewData = 0) const; - long CalcBoundingHeight( SvLBoxEntry*, const SvIcnVwDataEntry* pViewData= 0 ) const; - Size CalcBoundingSize( SvLBoxEntry*, - SvIcnVwDataEntry* pViewData = 0 ) const; - void FindBoundingRect( SvLBoxEntry* pEntry, - SvIcnVwDataEntry* pViewData = 0 ); - // berechnet alle BoundRects neu - void RecalcAllBoundingRects(); - // berechnet alle ungueltigen BoundRects neu - void RecalcAllBoundingRectsSmart(); - const Rectangle& GetBoundingRect( SvLBoxEntry*, - SvIcnVwDataEntry* pViewData=0); - void InvalidateBoundingRect( SvLBoxEntry* ); - void InvalidateBoundingRect( Rectangle& rRect ) { rRect.Right() = LONG_MAX; } - BOOL IsBoundingRectValid( const Rectangle& rRect ) const { return (BOOL)( rRect.Right() != LONG_MAX ); } - - void PaintEmphasis( const Rectangle&, BOOL bSelected, - BOOL bCursored, OutputDevice* pOut = 0 ); - void PaintItem( const Rectangle& rRect, SvLBoxItem* pItem, - SvLBoxEntry* pEntry, USHORT nPaintFlags, OutputDevice* pOut = 0 ); - // berechnet alle BoundingRects neu, wenn bMustRecalcBoundingRects == TRUE - void CheckBoundingRects() { if (bMustRecalcBoundingRects) RecalcAllBoundingRects(); } - // berechnet alle invalidierten BoundingRects neu - void UpdateBoundingRects(); - void ShowTargetEmphasis( SvLBoxEntry* pEntry, BOOL bShow ); - SvLBoxEntry* GetDropTarget( const Point& rPosPixel ); - BOOL NotifyMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, - SvLBoxEntry*& rpNewParent, ULONG& rNewChildPos ); - BOOL NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, - SvLBoxEntry*& rpNewParent, ULONG& rNewChildPos ); - - void WriteDragServerInfo( const Point&, SvLBoxDDInfo* ); - void ReadDragServerInfo( const Point&, SvLBoxDDInfo* ); - void ToTop( SvLBoxEntry* ); - - void SetCurParent( SvLBoxEntry* pNewParent ); - SvLBoxEntry* GetCurParent() const { return pCurParent; } - USHORT GetSelectionCount() const; - void SetGrid( long nDX, long nDY ); - void Scroll( long nDeltaX, long nDeltaY, BOOL bScrollBar = FALSE ); - const Size& GetItemSize( SvIconView* pView, SvLBoxEntry*, SvLBoxItem*, - const SvIcnVwDataEntry* pViewData = 0 ) const; - void PrepareCommandEvent( const Point& rPt ); - - void HideDDIcon(); - void ShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos ); - void HideShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos ); - - SvLBoxEntry* mpViewData; - - BOOL IsOver( SvPtrarr* pSelectedRectList, const Rectangle& rEntryBoundRect ) const; - void SelectRect( const Rectangle&, BOOL bAdd = TRUE, - SvPtrarr* pOtherRects = 0, - short nOffs = SELRECT_BORDER_OFFS ); - void DrawSelectionRect( const Rectangle& ); - void HideSelectionRect(); - void CalcScrollOffsets( const Point& rRefPosPixel, - long& rX, long& rY, BOOL bDragDrop = FALSE, - USHORT nBorderWidth = 10 ); - void EndTracking(); - BOOL IsTextHit( SvLBoxEntry* pEntry, const Point& rDocPos ); - void MakeVisible( const Rectangle& rDocPos,BOOL bInScrollBarEvent=FALSE); - void AdjustAtGrid( SvLBoxEntry* pStart = 0 ); - void SetTextMode( SvIconViewTextMode, SvLBoxEntry* pEntry = 0 ); - SvIconViewTextMode GetTextMode( const SvLBoxEntry* pEntry = 0, - const SvIcnVwDataEntry* pViewData = 0 ) const; - void ShowFocusRect( const SvLBoxEntry* pEntry ); -}; - -inline void SvImpIconView::MakeVisible( SvLBoxEntry* pEntry ) -{ - const Rectangle& rRect = GetBoundingRect( pEntry ); - MakeVisible( rRect ); -} - -#endif // #ifndef _SVIMPICN_HXX - - diff --git a/svtools/inc/svipcdef.h b/svtools/inc/svipcdef.h deleted file mode 100644 index ec944f92d0f0..000000000000 --- a/svtools/inc/svipcdef.h +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: svipcdef.h,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVIPCDEF_H -#define _SVIPCDEF_H - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined (WNT) || defined (WIN) -#define CDECL __cdecl -#elif defined CSET -#define CDECL _System -#else -#define CDECL -#endif - -#if defined WIN -#define _EXTLIBCALL_ _pascal -#else -#define _EXTLIBCALL_ CDECL -#endif - -typedef void (CDECL *IPCCallbackFunc)(void*); - -extern void _EXTLIBCALL_ IPCFreeMemory(void*); -extern short _EXTLIBCALL_ IPCGetStatus(void*); -extern short _EXTLIBCALL_ IPCInit(void); -extern void _EXTLIBCALL_ IPCDeInit(void); -extern void* _EXTLIBCALL_ IPCConnectServer(const char*, IPCCallbackFunc); -extern void _EXTLIBCALL_ IPCDisconnectServer(void *); -#ifdef WIN -extern long CDECL IPCCALLFUNCTION(void *,unsigned long,void *, - short,const char *, char, ...); -#else -extern long CDECL IPCCallFunction(void *,unsigned long,void *, - short,const char *, char, ...); -#endif -#ifdef __cplusplus -} -#endif - -#endif diff --git a/svtools/inc/svtool.h b/svtools/inc/svtool.h deleted file mode 100644 index d088daa44249..000000000000 --- a/svtools/inc/svtool.h +++ /dev/null @@ -1,40 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: svtool.h,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVTOOL_H -#define _SVTOOL_H - -#if defined( W30 ) && defined( _MSC_VER ) -#define SVEXPORT _export -#else -#define SVEXPORT -#endif - -#endif // _SVTOOL_H diff --git a/svtools/inc/svtools/aeitem.hxx b/svtools/inc/svtools/aeitem.hxx deleted file mode 100644 index 5cfd3d0fc15e..000000000000 --- a/svtools/inc/svtools/aeitem.hxx +++ /dev/null @@ -1,74 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: aeitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _AEITEM_HXX -#define _AEITEM_HXX - -#include "svtools/svtdllapi.h" -#include -#include - -class SfxAllEnumValueArr; -class SvUShorts; - -class SVT_DLLPUBLIC SfxAllEnumItem: public SfxEnumItem -{ - SfxAllEnumValueArr* pValues; - SvUShorts* pDisabledValues; - -protected: - USHORT _GetPosByValue( USHORT nValue ) const; - -public: - TYPEINFO(); - SfxAllEnumItem(); - SfxAllEnumItem( USHORT nWhich); - SfxAllEnumItem( USHORT nWhich, USHORT nVal ); - SfxAllEnumItem( USHORT nWhich, USHORT nVal, const XubString &rText ); - SfxAllEnumItem( USHORT nWhich, SvStream &rStream ); - SfxAllEnumItem( const SfxAllEnumItem & ); - ~SfxAllEnumItem(); - - void InsertValue( USHORT nValue ); - void InsertValue( USHORT nValue, const XubString &rText ); - void RemoveValue( USHORT nValue ); - void RemoveAllValues(); - - USHORT GetPosByValue( USHORT nValue ) const; - - virtual USHORT GetValueCount() const; - virtual USHORT GetValueByPos( USHORT nPos ) const; - virtual XubString GetValueTextByPos( USHORT nPos ) const; - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT nVersion) const; - virtual BOOL IsEnabled( USHORT ) const; - void DisableValue( USHORT ); -}; - -#endif diff --git a/svtools/inc/svtools/bintitem.hxx b/svtools/inc/svtools/bintitem.hxx deleted file mode 100644 index 83119d9f3b18..000000000000 --- a/svtools/inc/svtools/bintitem.hxx +++ /dev/null @@ -1,88 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: bintitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BINTITEM_HXX -#define _BINTITEM_HXX - -#include -#include -#include -#include - -#include - -class SfxArguments; -class SvStream; - -DBG_NAMEEX(SfxBigIntItem) - -class SfxBigIntItem: public SfxPoolItem -{ - BigInt aVal; - -public: - TYPEINFO(); - SfxBigIntItem(); - SfxBigIntItem(USHORT nWhich, const BigInt& rValue); - SfxBigIntItem(USHORT nWhich, SvStream &); - SfxBigIntItem(const SfxBigIntItem&); - ~SfxBigIntItem() { DBG_DTOR(SfxBigIntItem, 0); } - - virtual SfxItemPresentation GetPresentation( - SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper * = 0 ) const; - - virtual int operator==(const SfxPoolItem&) const; - using SfxPoolItem::Compare; - virtual int Compare(const SfxPoolItem &rWith) const; - virtual SfxPoolItem* Clone(SfxItemPool *pPool = 0) const; - virtual SfxPoolItem* Create(SvStream &, USHORT nVersion) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; - - virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; - - virtual SfxFieldUnit GetUnit() const; // FUNIT_NONE - - const BigInt& GetValue() const { return aVal; } - void SetValue(const BigInt& rNewVal) - { - DBG_ASSERT(GetRefCount() == 0, "SetValue() with pooled item"); - aVal = rNewVal; - } -}; - -#endif /* _BINTITEM_HXX */ - diff --git a/svtools/inc/svtools/brdcst.hxx b/svtools/inc/svtools/brdcst.hxx deleted file mode 100644 index 2f9270f3cd4b..000000000000 --- a/svtools/inc/svtools/brdcst.hxx +++ /dev/null @@ -1,78 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: brdcst.hxx,v $ - * $Revision: 1.3.60.2 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFXBRDCST_HXX -#define _SFXBRDCST_HXX - -#include "svtools/svldllapi.h" -#include -#include - -class SfxListener; -class SfxHint; - -#ifndef _SFX_BRDCST_CXX -typedef SvPtrarr SfxListenerArr_Impl; -#endif - -//------------------------------------------------------------------------- - -class SVL_DLLPUBLIC SfxBroadcaster -{ -friend class SfxListener; - - SfxListenerArr_Impl aListeners; - -private: - BOOL AddListener( SfxListener& rListener ); - void RemoveListener( SfxListener& rListener ); - const SfxBroadcaster& operator=(const SfxBroadcaster &); // verboten - -protected: - void Forward(SfxBroadcaster& rBC, const SfxHint& rHint); - virtual void ListenersGone(); - -public: - TYPEINFO(); - - SfxBroadcaster(); - SfxBroadcaster( const SfxBroadcaster &rBC ); - virtual ~SfxBroadcaster(); - - void Broadcast( const SfxHint &rHint ); - void BroadcastDelayed( const SfxHint& rHint ); - void BroadcastInIdle( const SfxHint& rHint ); - - BOOL HasListeners() const; - USHORT GetListenerCount() const { return aListeners.Count(); } - SfxListener* GetListener( USHORT nNo ) const - { return (SfxListener*) aListeners[nNo]; } -}; - -#endif diff --git a/svtools/inc/svtools/cancel.hxx b/svtools/inc/svtools/cancel.hxx deleted file mode 100644 index 5929fc4db47a..000000000000 --- a/svtools/inc/svtools/cancel.hxx +++ /dev/null @@ -1,145 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: cancel.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFXCANCEL_HXX -#define _SFXCANCEL_HXX - -#include "svtools/svldllapi.h" -#include -#include -#include -#include - -class SfxCancellable; - -#ifdef _SFX_CANCEL_CXX -#include - -SV_DECL_PTRARR( SfxCancellables_Impl, SfxCancellable*, 0, 4 ) - -#else - -typedef SvPtrarr SfxCancellables_Impl; - -#endif - -//------------------------------------------------------------------------- - -class SVL_DLLPUBLIC SfxCancelManager: public SfxBroadcaster -, public SvWeakBase - -/* [Beschreibung] - - An Instanzen dieser Klasse k"onnen nebenl"aufige Prozesse angemeldet - werden, um vom Benutzer abbrechbar zu sein. Werden abbrechbare - Prozesse (Instanzen von ) an- oder abgemeldet, wird - dies durch einen mit dem Flag SFX_HINT_CANCELLABLE - gebroadcastet. - - SfxCancelManager k"onnen hierarchisch angeordnet werden, so k"onnen - z.B. Dokument-lokale Prozesse getrennt gecancelt werden. - - [Beispiel] - - SfxCancelManager *pMgr = new SfxCancelManager; - StartListening( pMgr ); - pMailSystem->SetCancelManager( pMgr ) -*/ - -{ - SfxCancelManager* _pParent; - SfxCancellables_Impl _aJobs; - -public: - SfxCancelManager( SfxCancelManager *pParent = 0 ); - ~SfxCancelManager(); - - BOOL CanCancel() const; - void Cancel( BOOL bDeep ); - SfxCancelManager* GetParent() const { return _pParent; } - - void InsertCancellable( SfxCancellable *pJob ); - void RemoveCancellable( SfxCancellable *pJob ); - USHORT GetCancellableCount() const - { return _aJobs.Count(); } - SfxCancellable* GetCancellable( USHORT nPos ) const - { return (SfxCancellable*) _aJobs[nPos]; } -}; - -SV_DECL_WEAK( SfxCancelManager ) -//------------------------------------------------------------------------- - -class SVL_DLLPUBLIC SfxCancellable - -/* [Beschreibung] - - Instanzen dieser Klasse werden immer an einem Cancel-Manager angemeldet, - der dadurch dem Benutzer signalisieren kann, ob abbrechbare Prozesse - vorhanden sind und der die SfxCancellable-Instanzen auf 'abgebrochen' - setzen kann. - - Die im Ctor "ubergebene -Instanz mu\s die Instanz - dieser Klasse "uberleben! - - [Beispiel] - - { - SfxCancellable aCancel( pCancelMgr ); - while ( !aCancel && GetData() ) - Reschedule(); - } - -*/ - -{ - SfxCancelManager* _pMgr; - BOOL _bCancelled; - String _aTitle; - -public: - SfxCancellable( SfxCancelManager *pMgr, - const String &rTitle ) - : _pMgr( pMgr ), - _bCancelled( FALSE ), - _aTitle( rTitle ) - { pMgr->InsertCancellable( this ); } - - virtual ~SfxCancellable(); - - void SetManager( SfxCancelManager *pMgr ); - SfxCancelManager* GetManager() const { return _pMgr; } - - virtual void Cancel(); - BOOL IsCancelled() const { return _bCancelled; } - operator BOOL() const { return _bCancelled; } - const String& GetTitle() const { return _aTitle; } -}; - -#endif - diff --git a/svtools/inc/svtools/cenumitm.hxx b/svtools/inc/svtools/cenumitm.hxx deleted file mode 100644 index d65825849869..000000000000 --- a/svtools/inc/svtools/cenumitm.hxx +++ /dev/null @@ -1,180 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: cenumitm.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVTOOLS_CENUMITM_HXX -#define _SVTOOLS_CENUMITM_HXX - -#include "svtools/svldllapi.h" -#include -#include - -//============================================================================ -DBG_NAMEEX(SfxEnumItemInterface) - -class SVL_DLLPUBLIC SfxEnumItemInterface: public SfxPoolItem -{ -protected: - SfxEnumItemInterface(USHORT which): SfxPoolItem(which) {} - - SfxEnumItemInterface(const SfxEnumItemInterface & rItem): - SfxPoolItem(rItem) {} - -public: - TYPEINFO(); - - virtual int operator ==(const SfxPoolItem & rItem) const; - - virtual SfxItemPresentation GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, - XubString & rText, - const IntlWrapper * = 0) - const; - - virtual BOOL QueryValue(com::sun::star::uno::Any & rVal, BYTE = 0) const; - - virtual BOOL PutValue(const com::sun::star::uno::Any & rVal, BYTE = 0); - - virtual USHORT GetValueCount() const = 0; - - virtual XubString GetValueTextByPos(USHORT nPos) const; - - virtual USHORT GetValueByPos(USHORT nPos) const; - - /// Return the position of some value within this enumeration. - /// - /// @descr This method is implemented using GetValueCount() and - /// GetValueByPos(). Derived classes may replace this with a more - /// efficient implementation. - /// - /// @param nValue Some value. - /// - /// @return The position of nValue within this enumeration, or USHRT_MAX - /// if not included. - virtual USHORT GetPosByValue(USHORT nValue) const; - - virtual BOOL IsEnabled(USHORT nValue) const; - - virtual USHORT GetEnumValue() const = 0; - - virtual void SetEnumValue(USHORT nValue) = 0; - - virtual int HasBoolValue() const; - - virtual BOOL GetBoolValue() const; - - virtual void SetBoolValue(BOOL bValue); -}; - -//============================================================================ -DBG_NAMEEX(CntEnumItem) - -class SVL_DLLPUBLIC CntEnumItem: public SfxEnumItemInterface -{ - USHORT m_nValue; - -protected: - CntEnumItem(USHORT which = 0, USHORT nTheValue = 0): - SfxEnumItemInterface(which), m_nValue(nTheValue) {} - - CntEnumItem(USHORT which, SvStream & rStream); - - CntEnumItem(const CntEnumItem & rItem): - SfxEnumItemInterface(rItem), m_nValue(rItem.m_nValue) {} - -public: - TYPEINFO(); - - virtual SvStream & Store(SvStream & rStream, USHORT) const; - - virtual USHORT GetEnumValue() const; - - virtual void SetEnumValue(USHORT nTheValue); - - USHORT GetValue() const { return m_nValue; } - - inline void SetValue(USHORT nTheValue); -}; - -inline void CntEnumItem::SetValue(USHORT nTheValue) -{ - DBG_ASSERT(GetRefCount() == 0, "CntEnumItem::SetValue(): Pooled item"); - m_nValue = nTheValue; -} - -//============================================================================ -DBG_NAMEEX(CntBoolItem) - -class SVL_DLLPUBLIC CntBoolItem: public SfxPoolItem -{ - BOOL m_bValue; - -public: - TYPEINFO(); - - CntBoolItem(USHORT which = 0, BOOL bTheValue = FALSE): - SfxPoolItem(which), m_bValue(bTheValue) {} - - CntBoolItem(USHORT nWhich, SvStream & rStream); - - CntBoolItem(const CntBoolItem & rItem): - SfxPoolItem(rItem), m_bValue(rItem.m_bValue) {} - - virtual int operator ==(const SfxPoolItem & rItem) const; - - using SfxPoolItem::Compare; - virtual int Compare(const SfxPoolItem & rWith) const; - - virtual SfxItemPresentation GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, - UniString & rText, - const IntlWrapper * = 0) - const; - - virtual BOOL QueryValue(com::sun::star::uno::Any& rVal, BYTE = 0) const; - - virtual BOOL PutValue(const com::sun::star::uno::Any& rVal, BYTE = 0); - - virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const; - - virtual SvStream & Store(SvStream & rStream, USHORT) const; - - virtual SfxPoolItem * Clone(SfxItemPool * = 0) const; - - virtual USHORT GetValueCount() const; - - virtual UniString GetValueTextByVal(BOOL bTheValue) const; - - BOOL GetValue() const { return m_bValue; } - - void SetValue(BOOL bTheValue) { m_bValue = bTheValue; } -}; - -#endif // _SVTOOLS_CENUMITM_HXX - diff --git a/svtools/inc/svtools/cintitem.hxx b/svtools/inc/svtools/cintitem.hxx deleted file mode 100644 index a944e2139818..000000000000 --- a/svtools/inc/svtools/cintitem.hxx +++ /dev/null @@ -1,286 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: cintitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVTOOLS_CINTITEM_HXX -#define _SVTOOLS_CINTITEM_HXX - -#include "svtools/svldllapi.h" -#include -#include - -//============================================================================ -DBG_NAMEEX_VISIBILITY(CntByteItem, SVL_DLLPUBLIC) - -class SVL_DLLPUBLIC CntByteItem: public SfxPoolItem -{ - BYTE m_nValue; - -public: - TYPEINFO(); - - CntByteItem(USHORT which = 0, BYTE nTheValue = 0): - SfxPoolItem(which), m_nValue(nTheValue) { DBG_CTOR(CntByteItem, 0); } - - CntByteItem(USHORT which, SvStream & rStream); - - CntByteItem(const CntByteItem & rItem): - SfxPoolItem(rItem), m_nValue(rItem.m_nValue) - { DBG_CTOR(CntByteItem, 0); } - - virtual ~CntByteItem() { DBG_DTOR(CntByteItem, 0); } - - virtual int operator ==(const SfxPoolItem & rItem) const; - - using SfxPoolItem::Compare; - virtual int Compare(const SfxPoolItem & rWith) const; - - virtual SfxItemPresentation GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, - XubString & rText, - const IntlWrapper * = 0) - const; - - virtual BOOL QueryValue(com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0) const; - - virtual BOOL PutValue(const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0); - - virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const; - - virtual SvStream & Store(SvStream & rStream, USHORT) const; - - virtual SfxPoolItem * Clone(SfxItemPool * = 0) const; - - virtual BYTE GetMin() const; - - virtual BYTE GetMax() const; - - virtual SfxFieldUnit GetUnit() const; - - BYTE GetValue() const { return m_nValue; } - - inline void SetValue(BYTE nTheValue); -}; - -inline void CntByteItem::SetValue(BYTE nTheValue) -{ - DBG_ASSERT(GetRefCount() == 0, "CntByteItem::SetValue(): Pooled item"); - m_nValue = nTheValue; -} - -//============================================================================ -DBG_NAMEEX_VISIBILITY(CntUInt16Item, SVL_DLLPUBLIC) - -class SVL_DLLPUBLIC CntUInt16Item: public SfxPoolItem -{ - UINT16 m_nValue; - -public: - TYPEINFO(); - - CntUInt16Item(USHORT which = 0, UINT16 nTheValue = 0): - SfxPoolItem(which), m_nValue(nTheValue) - { DBG_CTOR(CntUInt16Item, 0); } - - CntUInt16Item(USHORT which, SvStream & rStream); - - CntUInt16Item(const CntUInt16Item & rItem): - SfxPoolItem(rItem), m_nValue(rItem.m_nValue) - { DBG_CTOR(CntUInt16Item, 0); } - - virtual ~CntUInt16Item() { DBG_DTOR(CntUInt16Item, 0); } - - virtual int operator ==(const SfxPoolItem & rItem) const; - - using SfxPoolItem::Compare; - virtual int Compare(const SfxPoolItem & rWith) const; - - virtual SfxItemPresentation GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, - XubString & rText, - const IntlWrapper * = 0) - const; - - virtual BOOL QueryValue(com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0) const; - - virtual BOOL PutValue(const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0); - - virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const; - - virtual SvStream & Store(SvStream & rStream, USHORT) const; - - virtual SfxPoolItem * Clone(SfxItemPool * = 0) const; - - virtual UINT16 GetMin() const; - - virtual UINT16 GetMax() const; - - virtual SfxFieldUnit GetUnit() const; - - INT16 GetValue() const { return m_nValue; } - - inline void SetValue(UINT16 nTheValue); -}; - -inline void CntUInt16Item::SetValue(UINT16 nTheValue) -{ - DBG_ASSERT(GetRefCount() == 0, "CntUInt16Item::SetValue(): Pooled item"); - m_nValue = nTheValue; -} - -//============================================================================ -DBG_NAMEEX_VISIBILITY(CntInt32Item, SVL_DLLPUBLIC) - -class SVL_DLLPUBLIC CntInt32Item: public SfxPoolItem -{ - INT32 m_nValue; - -public: - TYPEINFO(); - - CntInt32Item(USHORT which = 0, INT32 nTheValue = 0): - SfxPoolItem(which), m_nValue(nTheValue) - { DBG_CTOR(CntInt32Item, 0); } - - CntInt32Item(USHORT which, SvStream & rStream); - - CntInt32Item(const CntInt32Item & rItem): - SfxPoolItem(rItem), m_nValue(rItem.m_nValue) - { DBG_CTOR(CntInt32Item, 0); } - - virtual ~CntInt32Item() { DBG_DTOR(CntInt32Item, 0); } - - virtual int operator ==(const SfxPoolItem & rItem) const; - - using SfxPoolItem::Compare; - virtual int Compare(const SfxPoolItem & rWith) const; - - virtual SfxItemPresentation GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, - XubString & rText, - const IntlWrapper * = 0) - const; - - virtual BOOL QueryValue(com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0) const; - - virtual BOOL PutValue(const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0); - - virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const; - - virtual SvStream & Store(SvStream &, USHORT) const; - - virtual SfxPoolItem * Clone(SfxItemPool * = 0) const; - - virtual INT32 GetMin() const; - - virtual INT32 GetMax() const; - - virtual SfxFieldUnit GetUnit() const; - - INT32 GetValue() const { return m_nValue; } - - inline void SetValue(INT32 nTheValue); -}; - -inline void CntInt32Item::SetValue(INT32 nTheValue) -{ - DBG_ASSERT(GetRefCount() == 0, "CntInt32Item::SetValue(): Pooled item"); - m_nValue = nTheValue; -} - -//============================================================================ -DBG_NAMEEX_VISIBILITY(CntUInt32Item, SVL_DLLPUBLIC) - -class SVL_DLLPUBLIC CntUInt32Item: public SfxPoolItem -{ - UINT32 m_nValue; - -public: - TYPEINFO(); - - CntUInt32Item(USHORT which = 0, UINT32 nTheValue = 0): - SfxPoolItem(which), m_nValue(nTheValue) - { DBG_CTOR(CntUInt32Item, 0); } - - CntUInt32Item(USHORT nWhich, SvStream & rStream); - - CntUInt32Item(const CntUInt32Item & rItem): - SfxPoolItem(rItem), m_nValue(rItem.m_nValue) - { DBG_CTOR(CntUInt32Item, 0); } - - virtual ~CntUInt32Item() { DBG_DTOR(CntUInt32Item, 0); } - - virtual int operator ==(const SfxPoolItem & rItem) const; - - using SfxPoolItem::Compare; - virtual int Compare(const SfxPoolItem & rWith) const; - - virtual SfxItemPresentation GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, - XubString & rText, - const IntlWrapper * = 0) - const; - - virtual BOOL QueryValue(com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0) const; - - virtual BOOL PutValue(const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0); - - virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const; - - virtual SvStream & Store(SvStream & rStream, USHORT) const; - - virtual SfxPoolItem * Clone(SfxItemPool * = 0) const; - - virtual UINT32 GetMin() const; - - virtual UINT32 GetMax() const; - - virtual SfxFieldUnit GetUnit() const; - - UINT32 GetValue() const { return m_nValue; } - - inline void SetValue(UINT32 nTheValue); -}; - -inline void CntUInt32Item::SetValue(UINT32 nTheValue) -{ - DBG_ASSERT(GetRefCount() == 0, "CntUInt32Item::SetValue(): Pooled item"); - m_nValue = nTheValue; -} - -#endif // _SVTOOLS_CINTITEM_HXX - diff --git a/svtools/inc/svtools/cjkoptions.hxx b/svtools/inc/svtools/cjkoptions.hxx deleted file mode 100644 index 1573a029f29f..000000000000 --- a/svtools/inc/svtools/cjkoptions.hxx +++ /dev/null @@ -1,82 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: cjkoptions.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVTOOLS_CJKOPTIONS_HXX -#define _SVTOOLS_CJKOPTIONS_HXX - -#include "svtools/svtdllapi.h" -#include -#include - -class SvtCJKOptions_Impl; - -// class SvtCJKOptions -------------------------------------------------- - -class SVT_DLLPUBLIC SvtCJKOptions: public utl::detail::Options -{ -private: - SvtCJKOptions_Impl* pImp; - -public: - - enum EOption - { - E_CJKFONT, - E_VERTICALTEXT, - E_ASIANTYPOGRAPHY, - E_JAPANESEFIND, - E_RUBY, - E_CHANGECASEMAP, - E_DOUBLELINES, - E_EMPHASISMARKS, - E_VERTICALCALLOUT, - E_ALL // special one for IsAnyEnabled()/SetAll() functionality - }; - - // bDontLoad is for referencing purposes only - SvtCJKOptions(sal_Bool bDontLoad = sal_False); - virtual ~SvtCJKOptions(); - - sal_Bool IsCJKFontEnabled() const; - sal_Bool IsVerticalTextEnabled() const; - sal_Bool IsAsianTypographyEnabled() const; - sal_Bool IsJapaneseFindEnabled() const; - sal_Bool IsRubyEnabled() const; - sal_Bool IsChangeCaseMapEnabled() const; - sal_Bool IsDoubleLinesEnabled() const; - sal_Bool IsEmphasisMarksEnabled() const; - sal_Bool IsVerticalCallOutEnabled() const; - - void SetAll(sal_Bool bSet); - sal_Bool IsAnyEnabled() const; - sal_Bool IsReadOnly(EOption eOption) const; -}; - -#endif // _SVTOOLS_CJKOPTIONS_HXX - diff --git a/svtools/inc/svtools/cnclhint.hxx b/svtools/inc/svtools/cnclhint.hxx deleted file mode 100644 index 38781a6c2143..000000000000 --- a/svtools/inc/svtools/cnclhint.hxx +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: cnclhint.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFXCNCLHINT_HXX -#define _SFXCNCLHINT_HXX - -#include -#include -#include - -#define SFXCANCELHINT_REMOVED 1 - -class SfxCancelHint: public SfxHint -{ -private: - SfxCancellable* pCancellable; - USHORT nAction; -public: - TYPEINFO(); - SfxCancelHint( SfxCancellable*, USHORT nAction ); - USHORT GetAction() const { return nAction; } - const SfxCancellable& GetCancellable() const { return *pCancellable; } -}; - -#endif diff --git a/svtools/inc/svtools/cntwall.hxx b/svtools/inc/svtools/cntwall.hxx deleted file mode 100644 index 51b2982fe1dd..000000000000 --- a/svtools/inc/svtools/cntwall.hxx +++ /dev/null @@ -1,83 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: cntwall.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _CNTWALL_HXX -#define _CNTWALL_HXX - -#include "svtools/svldllapi.h" - -#ifndef SHL_HXX -#include -#endif -#include -#include -#include - -class SvStream; - -class SVL_DLLPUBLIC CntWallpaperItem : public SfxPoolItem -{ -private: - UniString _aURL; - Color _nColor; - USHORT _nStyle; - -public: - TYPEINFO(); - - CntWallpaperItem( USHORT nWhich ); - CntWallpaperItem( USHORT nWhich, SvStream& rStream, USHORT nVersion ); - CntWallpaperItem( const CntWallpaperItem& rCpy ); - ~CntWallpaperItem(); - - virtual USHORT GetVersion(USHORT) const; - - virtual int operator==( const SfxPoolItem& ) const; - virtual SfxPoolItem* Create( SvStream&, USHORT nItemVersion ) const; - virtual SvStream& Store( SvStream&, USHORT nItemVersion ) const; - virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; - - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; - virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); - - void SetBitmapURL( const UniString& rURL ) { _aURL = rURL; } - void SetColor( Color nColor ) { _nColor = nColor; } - void SetStyle( USHORT nStyle ) { _nStyle = nStyle; } - - const UniString& GetBitmapURL() const { return _aURL; } - Color GetColor() const { return _nColor; } - USHORT GetStyle() const { return _nStyle; } -}; - -//////////////////////////////////////////////////////////////////////////////// - -#endif // _CNTWALL_HXX - diff --git a/svtools/inc/svtools/cstitem.hxx b/svtools/inc/svtools/cstitem.hxx deleted file mode 100644 index 654ee9c15a75..000000000000 --- a/svtools/inc/svtools/cstitem.hxx +++ /dev/null @@ -1,94 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: cstitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _CSTITEM_HXX -#define _CSTITEM_HXX - -#include - -#include - -class SvStream; - -enum CrawlStatus -{ - CSTAT_NEVER_UPD = 0, /* noch nie ueberprueft */ - CSTAT_IN_UPD = 1, /* Ueberpruefung laeuft */ - CSTAT_UPD_NEWER = 2, /* wurde ueberprueft und ist neuer */ - CSTAT_UPD_NOT_NEWER = 3, /* wurde ueberprueft und ist nicht neuer */ - CSTAT_UPD_CANCEL = 4, /* Ueberpruefung vom Benutzer abgebrochen */ - CSTAT_ERR_GENERAL = 5, /* allgemeiner Fehler */ - CSTAT_ERR_NOTEXISTS = 6, /* Server existiert nicht */ - CSTAT_ERR_NOTREACHED = 7, /* Server nicht ereicht */ - CSTAT_UPD_IMMEDIATELY = 8, /* es wird gleich ueberprueftt */ - CSTAT_ERR_OFFLINE = 9 /* Ueberpruefung nicht m�glich, da Offline */ -}; - -DBG_NAMEEX(SfxCrawlStatusItem) - -// class SfxDateTimeRangeItem ------------------------------------------------- - -class SfxCrawlStatusItem : public SfxPoolItem -{ -private: - CrawlStatus eStatus; -public: - TYPEINFO(); - - SfxCrawlStatusItem( const SfxCrawlStatusItem& rCpy ); - SfxCrawlStatusItem( USHORT nWhich ); - SfxCrawlStatusItem( USHORT nWhich, CrawlStatus eStat ); - ~SfxCrawlStatusItem() { DBG_DTOR(SfxCrawlStatusItem, 0); } - - virtual int operator==( const SfxPoolItem& ) const; - using SfxPoolItem::Compare; - virtual int Compare( const SfxPoolItem &rWith ) const; - virtual SfxPoolItem* Create( SvStream&, USHORT nItemVersion ) const; - virtual SvStream& Store( SvStream&, USHORT nItemVersion ) const; - virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; - - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper * pIntlWrapper = 0 ) - const; - - CrawlStatus GetStatus() const { return eStatus; } - void SetStatus(CrawlStatus eNew) { eStatus = eNew; } - - virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; -}; - -#endif - diff --git a/svtools/inc/svtools/ctloptions.hxx b/svtools/inc/svtools/ctloptions.hxx deleted file mode 100644 index 4157d129cce1..000000000000 --- a/svtools/inc/svtools/ctloptions.hxx +++ /dev/null @@ -1,100 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ctloptions.hxx,v $ - * $Revision: 1.3.164.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVTOOLS_CTLOPTIONS_HXX -#define _SVTOOLS_CTLOPTIONS_HXX - -#include "svtools/svtdllapi.h" -#include -#include -#include -#include - -class SvtCTLOptions_Impl; - -// class SvtCTLOptions -------------------------------------------------------- - -class SVT_DLLPUBLIC SvtCTLOptions: - public utl::detail::Options, public SfxBroadcaster, public SfxListener -{ -private: - SvtCTLOptions_Impl* m_pImp; - -public: - - // bDontLoad is for referencing purposes only - SvtCTLOptions( sal_Bool bDontLoad = sal_False ); - virtual ~SvtCTLOptions(); - - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - - void SetCTLFontEnabled( sal_Bool _bEnabled ); - sal_Bool IsCTLFontEnabled() const; - - void SetCTLSequenceChecking( sal_Bool _bEnabled ); - sal_Bool IsCTLSequenceChecking() const; - - void SetCTLSequenceCheckingRestricted( sal_Bool _bEnable ); - sal_Bool IsCTLSequenceCheckingRestricted( void ) const; - - void SetCTLSequenceCheckingTypeAndReplace( sal_Bool _bEnable ); - sal_Bool IsCTLSequenceCheckingTypeAndReplace() const; - - enum CursorMovement - { - MOVEMENT_LOGICAL = 0, - MOVEMENT_VISUAL - }; - void SetCTLCursorMovement( CursorMovement _eMovement ); - CursorMovement GetCTLCursorMovement() const; - - enum TextNumerals - { - NUMERALS_ARABIC = 0, - NUMERALS_HINDI, - NUMERALS_SYSTEM, - NUMERALS_CONTEXT - }; - void SetCTLTextNumerals( TextNumerals _eNumerals ); - TextNumerals GetCTLTextNumerals() const; - - enum EOption - { - E_CTLFONT, - E_CTLSEQUENCECHECKING, - E_CTLCURSORMOVEMENT, - E_CTLTEXTNUMERALS, - E_CTLSEQUENCECHECKINGRESTRICTED, - E_CTLSEQUENCECHECKINGTYPEANDREPLACE - }; - sal_Bool IsReadOnly(EOption eOption) const; -}; - -#endif // _SVTOOLS_CTLOPTIONS_HXX - diff --git a/svtools/inc/svtools/ctypeitm.hxx b/svtools/inc/svtools/ctypeitm.hxx deleted file mode 100644 index 2592c6e0f388..000000000000 --- a/svtools/inc/svtools/ctypeitm.hxx +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ctypeitm.hxx,v $ - * $Revision: 1.3.136.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVTOOLS_CTYPEITM_HXX -#define _SVTOOLS_CTYPEITM_HXX - -#include -#include - -//========================================================================= - -class CntContentTypeItem : public CntUnencodedStringItem -{ -private: - INetContentType _eType; - XubString _aPresentation; - -public: - TYPEINFO(); - - CntContentTypeItem(); - CntContentTypeItem( USHORT nWhich, const XubString& rType ); - CntContentTypeItem( USHORT nWhich, const INetContentType eType ); - CntContentTypeItem( const CntContentTypeItem& rOrig ); - - virtual SfxPoolItem* Create( SvStream& rStream, - USHORT nItemVersion ) const; - virtual SvStream & Store(SvStream & rStream, USHORT) const; - - virtual int operator==( const SfxPoolItem& rOrig ) const; - - virtual USHORT GetVersion(USHORT) const; - - virtual SfxPoolItem* Clone( SfxItemPool *pPool = NULL ) const; - - void SetValue( const XubString& rNewVal ); - void SetPresentation( const XubString& rNewVal ); - - using SfxPoolItem::Compare; - virtual int Compare( const SfxPoolItem &rWith, const IntlWrapper& rIntlWrapper ) const; - - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper* pIntlWrapper = 0 ) const; - - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; - virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0); - - INetContentType GetEnumValue() const; - - void SetValue( const INetContentType eType ); -}; - -#endif /* !_SVTOOLS_CTYPEITM_HXX */ - diff --git a/svtools/inc/svtools/custritm.hxx b/svtools/inc/svtools/custritm.hxx deleted file mode 100644 index 83a88b1f240f..000000000000 --- a/svtools/inc/svtools/custritm.hxx +++ /dev/null @@ -1,95 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: custritm.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVTOOLS_CUSTRITM_HXX -#define _SVTOOLS_CUSTRITM_HXX - -#include "svtools/svldllapi.h" -#include -#include - -//============================================================================ -DBG_NAMEEX_VISIBILITY(CntUnencodedStringItem, SVL_DLLPUBLIC) - -class SVL_DLLPUBLIC CntUnencodedStringItem: public SfxPoolItem -{ - XubString m_aValue; - -public: - TYPEINFO(); - - CntUnencodedStringItem(USHORT which = 0): SfxPoolItem(which) - { DBG_CTOR(CntUnencodedStringItem, 0); } - - CntUnencodedStringItem(USHORT which, const XubString & rTheValue): - SfxPoolItem(which), m_aValue(rTheValue) - { DBG_CTOR(CntUnencodedStringItem, 0); } - - CntUnencodedStringItem(const CntUnencodedStringItem & rItem): - SfxPoolItem(rItem), m_aValue(rItem.m_aValue) - { DBG_CTOR(CntUnencodedStringItem, 0); } - - virtual ~CntUnencodedStringItem() { DBG_DTOR(CntUnencodedStringItem, 0); } - - virtual int operator ==(const SfxPoolItem & rItem) const; - - virtual int Compare(const SfxPoolItem & rWith) const; - - virtual int Compare(SfxPoolItem const & rWith, - IntlWrapper const & rIntlWrapper) const; - - virtual SfxItemPresentation GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, - XubString & rText, - const IntlWrapper * = 0) - const; - - virtual BOOL QueryValue(com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0) const; - - virtual BOOL PutValue(const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0); - - virtual SfxPoolItem * Clone(SfxItemPool * = 0) const; - - const XubString & GetValue() const { return m_aValue; } - - inline void SetValue(const XubString & rTheValue); -}; - -inline void CntUnencodedStringItem::SetValue(const XubString & rTheValue) -{ - DBG_ASSERT(GetRefCount() == 0, - "CntUnencodedStringItem::SetValue(): Pooled item"); - m_aValue = rTheValue; -} - -#endif // _SVTOOLS_CUSTRITM_HXX - diff --git a/svtools/inc/svtools/dateitem.hxx b/svtools/inc/svtools/dateitem.hxx deleted file mode 100644 index 073c1a6ef825..000000000000 --- a/svtools/inc/svtools/dateitem.hxx +++ /dev/null @@ -1,109 +0,0 @@ - /************************************************************************* - * - * 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 - * - * $RCSfile: dateitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _DATETIMEITEM_HXX -#define _DATETIMEITEM_HXX - -#include -#include - -#include - -class SvStream; - -DBG_NAMEEX(SfxDateTimeItem) - -// class SfxDateTimeItem ------------------------------------------------- - -class SfxDateTimeItem : public SfxPoolItem -{ -private: - DateTime aDateTime; - -public: - TYPEINFO(); - - SfxDateTimeItem( USHORT nWhich ); - SfxDateTimeItem( USHORT nWhich, - const DateTime& rDT ); - SfxDateTimeItem( const SfxDateTimeItem& rCpy ); - - ~SfxDateTimeItem() { - DBG_DTOR(SfxDateTimeItem, 0); } - - virtual int operator==( const SfxPoolItem& ) const; - using SfxPoolItem::Compare; - virtual int Compare( const SfxPoolItem &rWith ) const; - virtual SfxPoolItem* Create( SvStream&, USHORT nItemVersion ) const; - virtual SvStream& Store( SvStream&, USHORT nItemVersion ) const; - virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; - - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper * pIntlWrapper = 0 ) - const; - - const DateTime& GetDateTime() const { return aDateTime; } - void SetDateTime( const DateTime& rDT ) { - DBG_ASSERT( GetRefCount() == 0, - "SetDateTime() with pooled item" ); - aDateTime = rDT; } - - virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; -}; - -class SfxColumnDateTimeItem : public SfxDateTimeItem -{ -public: - TYPEINFO(); - - SfxColumnDateTimeItem( USHORT nWhich ); - SfxColumnDateTimeItem( USHORT nWhich, - const DateTime& rDT ); - SfxColumnDateTimeItem( const SfxDateTimeItem& rCpy ); - - ~SfxColumnDateTimeItem() {} - - virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; - - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper * pIntlWrapper = 0 ) - const; -}; - -#endif - diff --git a/svtools/inc/svtools/documentlockfile.hxx b/svtools/inc/svtools/documentlockfile.hxx deleted file mode 100644 index f2625f7955bb..000000000000 --- a/svtools/inc/svtools/documentlockfile.hxx +++ /dev/null @@ -1,75 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: documentlockfile.hxx,v $ - * - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVT_DOCUMENTLOCKFILE_HXX -#define _SVT_DOCUMENTLOCKFILE_HXX - -#include - -#include -#include -#include -#include -#include -#include - -#include - -namespace svt { - -class SVT_DLLPUBLIC DocumentLockFile : public LockFileCommon -{ - // the workaround for automated testing! - static sal_Bool m_bAllowInteraction; - - ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > OpenStream(); - - void WriteEntryToStream( ::com::sun::star::uno::Sequence< ::rtl::OUString > aEntry, ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xStream ); - -public: - DocumentLockFile( const ::rtl::OUString& aOrigURL, const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() ); - ~DocumentLockFile(); - - sal_Bool CreateOwnLockFile(); - ::com::sun::star::uno::Sequence< ::rtl::OUString > GetLockData(); - sal_Bool OverwriteOwnLockFile(); - void RemoveFile(); - - // the methods allow to control whether UI interaction regarding the locked document file is allowed - // this is a workaround for automated tests - static void AllowInteraction( sal_Bool bAllow ) { m_bAllowInteraction = bAllow; } - static sal_Bool IsInteractionAllowed() { return m_bAllowInteraction; } -}; - -} - -#endif - diff --git a/svtools/inc/svtools/dtritem.hxx b/svtools/inc/svtools/dtritem.hxx deleted file mode 100644 index 87666a306a43..000000000000 --- a/svtools/inc/svtools/dtritem.hxx +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: dtritem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _DTRITEM_HXX -#define _DTRITEM_HXX - -#include -#include - -#include - -class SvStream; - -DBG_NAMEEX(SfxDateTimeRangeItem) - -// class SfxDateTimeRangeItem ------------------------------------------------- - -class SfxDateTimeRangeItem : public SfxPoolItem -{ -private: - DateTime aStartDateTime; - DateTime aEndDateTime; - -public: - TYPEINFO(); - - SfxDateTimeRangeItem( const SfxDateTimeRangeItem& rCpy ); - SfxDateTimeRangeItem( USHORT nWhich ); - SfxDateTimeRangeItem( USHORT nWhich, const DateTime& rStartDT, - const DateTime& rEndDT ); - - ~SfxDateTimeRangeItem() - { DBG_DTOR(SfxDateTimeRangeItem, 0); } - - virtual int operator==( const SfxPoolItem& ) const; - using SfxPoolItem::Compare; - virtual int Compare( const SfxPoolItem &rWith ) const; - virtual SfxPoolItem* Create( SvStream&, USHORT nItemVersion ) const; - virtual SvStream& Store( SvStream&, USHORT nItemVersion ) const; - virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper * pIntlWrapper = 0 ) - const; - - virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; - - const DateTime& GetStartDateTime() const { return aStartDateTime; } - const DateTime& GetEndDateTime() const { return aEndDateTime; } - - void SetStartDateTime( const DateTime& rDT ) - { DBG_ASSERT( GetRefCount() == 0, "SetDateTime() with pooled item" ); - aStartDateTime = rDT; } - - void SetEndDateTime( const DateTime& rDT ) - { DBG_ASSERT( GetRefCount() == 0, "SetDateTime() with pooled item" ); - aEndDateTime = rDT; } -}; - -#endif - diff --git a/svtools/inc/svtools/eitem.hxx b/svtools/inc/svtools/eitem.hxx deleted file mode 100644 index f9e1927a881d..000000000000 --- a/svtools/inc/svtools/eitem.hxx +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: eitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SFXENUMITEM_HXX -#define _SFXENUMITEM_HXX - -#include "svtools/svtdllapi.h" -#include - -//============================================================================ -class SVT_DLLPUBLIC SfxEnumItem: public CntEnumItem -{ -protected: - SfxEnumItem(USHORT which = 0, USHORT nValue = 0): - CntEnumItem(which, nValue) {} - - SfxEnumItem(USHORT which, SvStream & rStream): - CntEnumItem(which, rStream) {} - -public: - TYPEINFO(); - -}; - -//============================================================================ -class SVT_DLLPUBLIC SfxBoolItem: public CntBoolItem -{ -public: - TYPEINFO(); - - SfxBoolItem(USHORT which = 0, BOOL bValue = FALSE): - CntBoolItem(which, bValue) {} - - SfxBoolItem(USHORT which, SvStream & rStream): - CntBoolItem(which, rStream) {} - - virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const - { return new SfxBoolItem(Which(), rStream); } - - virtual SfxPoolItem * Clone(SfxItemPool * = 0) const - { return new SfxBoolItem(*this); } -}; - -#endif // _SFXENUMITEM_HXX - diff --git a/svtools/inc/svtools/filerec.hxx b/svtools/inc/svtools/filerec.hxx deleted file mode 100644 index 77ba6c1b5c52..000000000000 --- a/svtools/inc/svtools/filerec.hxx +++ /dev/null @@ -1,1087 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: filerec.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SFXFILEREC_HXX -#define _SFXFILEREC_HXX - -//========================================================================= - -#include "svtools/svldllapi.h" -#include -#include -#include - -SV_DECL_VARARR( SfxUINT32s, UINT32, 8, 8 ) - -//------------------------------------------------------------------------ - -#define SFX_BOOL_DONTCARE BOOL(2) // Don't-Care-Wert f"ur BOOLs - -#define SFX_REC_PRETAG_EXT BYTE(0x00) // Pre-Tag f"ur Extended-Records -#define SFX_REC_PRETAG_EOR BYTE(0xFF) // Pre-Tag f"ur End-Of-Records - -#define SFX_REC_TYPE_NONE BYTE(0x00) // unbekannter Record-Typ -#define SFX_REC_TYPE_FIRST BYTE(0x01) -#define SFX_REC_TYPE_SINGLE BYTE(0x01) // Single-Content-Record -#define SFX_REC_TYPE_FIXSIZE BYTE(0x02) // Fix-Size-Multi-Content-Record -#define SFX_REC_TYPE_VARSIZE_RELOC BYTE(0x03) // variable Rec-Size -#define SFX_REC_TYPE_VARSIZE BYTE(0x04) // alt (nicht verschiebbar) -#define SFX_REC_TYPE_MIXTAGS_RELOC BYTE(0x07) // Mixed Tag Content-Record -#define SFX_REC_TYPE_MIXTAGS BYTE(0x08) // alt (nicht verschiebbar) -#define SFX_REC_TYPE_LAST BYTE(0x08) -#define SFX_REC_TYPE_MINI 0x100 // Mini-Record -#define SFX_REC_TYPE_DRAWENG 0x400 // Drawing-Engine-Record -#define SFX_REC_TYPE_EOR 0xF00 // End-Of-Records - -//------------------------------------------------------------------------ - -#define SFX_REC_HEADERSIZE_MINI 4 // Gr"o\se des Mini-Record-Headers -#define SFX_REC_HEADERSIZE_SINGLE 4 // zzgl. HEADERSIZE_MINI => 8 -#define SFX_REC_HEADERSIZE_MULTI 6 // zzgl. HEADERSIZE_SINGLE => 14 - -//------------------------------------------------------------------------ - -#ifndef DBG -#ifdef DBG_UTIL -#define DBG(x) x -#else -#define DBG(x) -#endif -#endif - -//------------------------------------------------------------------------ - -/* [Fileformat] - - Jeder Record beginnt mit einem Byte, dem sogenannten 'Pre-Tag'. - - Ist dieses 'Pre-Tag' == 0x00, dann handelt es sich um einen Extended- - Record, dessen Typ durch ein weiteres Byte an Position 5 n�her - beschrieben wird: - - 0x01: SfxSingleRecord - 0x02: SfxMultiFixRecord - 0x03+0x04: SfxMultiVarRecord - 0x07+0x08: SfxMultiMixRecord - (Alle weiteren Record-Typ-Kennungen sind reserviert.) - - I.d.R. werden File-Formate schon aus Performance-Gr"unden so aufgebaut, - da\s beim Lesen jeweils vorher schon feststeht, welcher Record-Typ - vorliegt. Diese Kennung dient daher hautps"achlich der "Uberpr"ufung - und File-Viewern, die das genaue File-Format (unterhalb der Records) - nicht kennen. - - Der 'SfxMiniRecordReader' verf"ugt dazu auch "uber eine statische - Methode 'ScanRecordType()', mit der festgestellt werden kann, welcher - Record-Typ in dem "ubergebenen Stream zu finden ist. - - Ein 'Pre-Tag' mit dem Wert 0xFF ist als Terminator reserviert. - Terminatoren werden verwendet, um das Suchen nach einem speziellen - Record zu terminieren, d.h. ist er bis dorthin nicht gefunden, wird - auch nicht weitergesucht. - - Bei allen anderen Werten des 'Pre-Tags' (also von 0x01 bis 0xFE) - handelt es sich um einen zum SW3 kompatbilen Record, der hier - 'SfxMiniRecord' genannt wird, er kann daher mit einem - gelesen werden. - - Beginnt ein Record mit 0x44 k"onnte es sich um einen Drawing-Engine- - Record handeln. Dies ist dann der Fall, wenn die folgenden drei Bytes - die Zeichenkette 'RMD' bzw. 'RVW' ergeben (zusammen mit 'D'==0x44 - ergibt dies die K"urzel f"ur 'DRaw-MoDel' bzw. 'DRaw-VieW'). Records - dieser Art k"onnen von den hier dargestellten Klassen weder gelesen, - noch in irgendeiner Weise interpretiert werden. Einzig die Methode - 'ScanRecordType()' kann sie erkennen - weitere Behandlung obliegt - jedoch der Anwendungsprogrammierung. - - Diese drei Bytes an den Positionen 2 bis 4 enthalten normalerweise - die Gr"o\se des Records ohne Pre-Tag und Gr"o\sen-Bytes selbst, - also die Restgr"o\se nach diesem 4-Byte-Header. - - Struktur des Mini-Records: - - 1 BYTE Pre-Tag - 3 BYTE OffsetToEndOfRec - OffsetToEndOfRec* 1 BYTE Content - - Bei den Extended-Reords folgt auf diesen 4-Byte-Header ein erweiterter - Header, der zun"achst den o.g. Record-Typ, dann eine Versions-Kennung - sowie ein Tag enth"alt, welches den Inhalt kennzeichnet. - - Struktur des Extended-Records: - - 1 BYTE Pre-Tag (==0x00) - 3 BYTE OffsetToEndOfRec - OffsetToEndOfRec* 1 BYTE Content - 1 BYTE Record-Type - 1 BYTE Version - 2 BYTE Tag - ContentSize* 1 BYTE Content - - (ContentSize = OffsetToEndOfRec - 8) - - [Anmerkung] - - Der Aufbau der Records wird wie folgt begr"undet: - - Der SW-Record-Typ war zuerst vorhanden, mu\ste also 1:1 "ubernommen - werden. Zum Gl"uck wurden einige Record-Tags nicht verwendet, (Z.B. - 0x00 und 0xFF). - => 1. Byte 0x00 kann als Kennung f"ur erweiterten Record verwendet werden - => 1. Byte 0xFF kann f"ur besondere Zwecke verwendet werden - - Egal welcher Record-Typ vorliegt, sollte eine Erkennung des Typs, ein - Auslesen des Headers und ein "uberpspringen des Records m"oglich sein, - ohne zu"uck-seeken zu m"ussen und ohne "uberfl"ussige Daten lesen zu - m"ussen. - => die Bytes 2-4 werden bei allen Records als Offset zum Ende des - Records interpretiert, so da\s die Gesamt-Recors-Size sich wie - folgt berechnet: sizeof(UINT32) + OffsetToEndOfRec - - Die Records sollten einfach zu parsen un einheitlich aufgebaut sein. - => Sie bauen aufeinander auf, so ist z.B. der SfxMiniRecord in jedem - anderen enthalten. - - Die Records sollten auch von denen der Drawing Enginge unterscheidbar - sein. Diese beginnen mit 'DRMD' und 'DRVW'. - => Mini-Records mit dem Pre-Tag 'D' d"urfen maximal 4MB gro\s sein, - um nicht in diesen Kennungs-Bereich zu reichen. - - [Erweiterungen] - - Es ist geplant das File-Format so zu erweitern, da\s das High-Nibble - des Record-Typs der erweiterten Records besondere Aufgaben "ubernehmen - soll. Zum Beispiel ist geplant, Record-Contents als 'nur aus Records - bestehend' zu kennzeichnen. Ein File-Viewer k"onnte sich dann automatisch - durch solche Strukturen 'hangeln', ohne Gefahr zu laufen, auf Daten - zu sto\sen, die sich zwar als Records interpretieren lassen, aber - tats"achlis als 'flache' Daten geschrieben wurden. Die m"ogliche - Erweiterung wird schon jetzt insofern vorbereitet, als da\s das - High-Nibble des Typs bei Vergleichen nicht ber"ucksichtigt wird. -*/ - -//------------------------------------------------------------------------ - -class SVL_DLLPUBLIC SfxMiniRecordWriter - -/* [Beschreibung] - - Mit Instanzen dieser Klasse kann ein einfacher Record in einen Stream - geschrieben werden, der sich durch ein BYTE-Tag identifiziert, sowie - seine eigene L"ange speichert und somit auch von "alteren Versionen - bzw. Readern, die diesen Record-Type (Tag) nicht kennen, "ubersprungen - werden kann. Es wird keine Version-Nummer gespeichert. - - Alternativ kann die Gr"o\se fest angegeben werden oder sie wird - automatisch aus der Differenz der Tell()-Angaben vor und nach dem - Streamen des Inhalts ermittelt. - - Um Auf- und Abw"artskompatiblit"at gew"ahrleisten zu k"onnen, m"ussen - neue Versionen die Daten der "alteren immer komplett enthalten, - es d"urfen allenfalls neue Daten hintenan geh"angt werden! - - [Fileformat] - - 1* BYTE Content-Tag (!= 0) - 1* 3-BYTE OffsetToEndOfRec in Bytes - SizeOfContent* BYTE Content - - [Beispiel] - - { - SfxMiniRecordWriter aRecord( pStream, MY_TAG_X ); - *aRecord << aMember1; - *aRecord << aMember2; - } -*/ - -{ -protected: - SvStream* _pStream; // , in dem der Record liegt - UINT32 _nStartPos; // Start-Position des Gesamt-Records im Stream - FASTBOOL _bHeaderOk; /* TRUE, wenn der Header schon geschrieben ist; - bei DBG_UTIL wird SFX_BOOL_DONTCARE ver- - wendet, um die Gr"o\se von Fix-Sized-Records - zu pr"ufen. */ - BYTE _nPreTag; // in den Header zu schreibendes 'Pre-Tag' - -public: - inline SfxMiniRecordWriter( SvStream *pStream, - BYTE nTag ); - inline SfxMiniRecordWriter( SvStream *pStream, BYTE nTag, - UINT32 nSize ); - - inline ~SfxMiniRecordWriter(); - - inline SvStream& operator*() const; - - inline void Reset(); - - UINT32 Close( FASTBOOL bSeekToEndOfRec = TRUE ); - -private: - // not implementend, not allowed - SfxMiniRecordWriter( const SfxMiniRecordWriter& ); - SfxMiniRecordWriter& operator=(const SfxMiniRecordWriter&); -}; - -//------------------------------------------------------------------------ - -class SVL_DLLPUBLIC SfxMiniRecordReader - -/* [Beschreibung] - - Mit Instanzen dieser Klasse kann ein einfacher Record aus einem Stream - gelesen werden, der mit der Klasse geschrieben wurde. - - Es ist auch m"oglich, den Record zu "uberspringen, ohne sein internes - Format zu kennen. - - [Beispiel] - - { - SfxMiniRecordReader aRecord( pStream ); - switch ( aRecord.GetTag() ) - { - case MY_TAG_X: - *aRecord >> aMember1; - *aRecord >> aMember2; - break; - - ... - } - } -*/ - -{ -protected: - SvStream* _pStream; // , aus dem gelesen wird - UINT32 _nEofRec; // Position direkt hinter dem Record - FASTBOOL _bSkipped; // TRUE: der Record wurde explizit geskippt - BYTE _nPreTag; // aus dem Header gelesenes Pre-Tag - - // Drei-Phasen-Ctor f"ur Subklassen - SfxMiniRecordReader() {} - void Construct_Impl( SvStream *pStream, BYTE nTag ) - { - _pStream = pStream; - _bSkipped = FALSE; - _nPreTag = nTag; - } - inline FASTBOOL SetHeader_Impl( UINT32 nHeader ); - - // als ung"ultig markieren und zur"uck-seeken - void SetInvalid_Impl( UINT32 nRecordStartPos ) - { - _nPreTag = SFX_REC_PRETAG_EOR; - _pStream->Seek( nRecordStartPos ); - } - -public: - static USHORT ScanRecordType( SvStream *pStream ); - - SfxMiniRecordReader( SvStream *pStream ); - SfxMiniRecordReader( SvStream *pStream, BYTE nTag ); - inline ~SfxMiniRecordReader(); - - inline BYTE GetTag() const; - inline FASTBOOL IsValid() const; - - inline SvStream& operator*() const; - - inline void Skip(); - -private: - // not implementend, not allowed - SfxMiniRecordReader( const SfxMiniRecordReader& ); - SfxMiniRecordReader& operator=(const SfxMiniRecordReader&); -}; - -//------------------------------------------------------------------------ - -class SVL_DLLPUBLIC SfxSingleRecordWriter: public SfxMiniRecordWriter - -/* [Beschreibung] - - Mit Instanzen dieser Klasse kann ein Record in einen Stream geschrieben - werden, dessen einziger Inhalt sich durch ein UINT16-Tag und eine - BYTE-Versions-Nummer identifiziert, sowie seine eigene L"ange speichert - und somit auch von "alteren Versionen bzw. Readern, die diesen - Record-Type (Tag) nicht kennen, "ubersprungen werden kann. - - Alternativ kann die Gr"o\se fest angegeben werden oder sie wird - automatisch aus der Differenz der Tell()-Angaben vor und nach dem - Streamen des Inhalts ermittelt. - - Um Auf- und Abw"artskompatiblit"at gew"ahrleisten zu k"onnen, m"ussen - neue Versionen die Daten der "alteren immer komplett enthalten, - es d"urfen allenfalls neue Daten hintenan geh"angt werden! - - [Fileformat] - - 1* BYTE Pre-Tag (!= 0) - 1* 3-BYTE OffsetToEndOfRec in Bytes - 1* BYTE Record-Type (==SFX_REC_TYPE_SINGLE) - 1* BYTE Content-Version - 1* USHORT Content-Tag - SizeOfContent* BYTE Content - - [Beispiel] - - { - SfxSingleRecordWriter aRecord( pStream, MY_TAG_X, MY_VERSION ); - *aRecord << aMember1; - *aRecord << aMember2; - } -*/ - -{ -protected: - SfxSingleRecordWriter( BYTE nRecordType, - SvStream *pStream, - UINT16 nTag, BYTE nCurVer ); - -public: - SfxSingleRecordWriter( SvStream *pStream, - UINT16 nTag, BYTE nCurVer ); - SfxSingleRecordWriter( SvStream *pStream, - UINT16 nTag, BYTE nCurVer, - UINT32 nSize ); - - inline void Reset(); - - UINT32 Close( FASTBOOL bSeekToEndOfRec = TRUE ); -}; - -//------------------------------------------------------------------------ - -class SVL_DLLPUBLIC SfxSingleRecordReader: public SfxMiniRecordReader - -/* [Beschreibung] - - Mit Instanzen dieser Klasse kann ein einfacher Record aus einem Stream - gelesen werden, der mit der Klasse geschrieben - wurde. - - Es ist auch m"oglich, den Record zu "uberspringen, ohne sein internes - Format zu kennen. - - [Beispiel] - - { - SfxSingleRecordReader aRecord( pStream ); - switch ( aRecord.GetTag() ) - { - case MY_TAG_X: - aRecord >> aMember1; - if ( aRecord.HasVersion(2) ) - *aRecord >> aMember2; - break; - - ... - } - } -*/ - -{ -protected: - UINT16 _nRecordTag; // Art des Gesamt-Inhalts - BYTE _nRecordVer; // Version des Gesamt-Inhalts - BYTE _nRecordType; // Record Type aus dem Header - - // Drei-Phasen-Ctor f"ur Subklassen - SfxSingleRecordReader() {} - void Construct_Impl( SvStream *pStream ) - { - SfxMiniRecordReader::Construct_Impl( - pStream, SFX_REC_PRETAG_EXT ); - } - FASTBOOL FindHeader_Impl( UINT16 nTypes, UINT16 nTag ); - FASTBOOL ReadHeader_Impl( USHORT nTypes ); - -public: - SfxSingleRecordReader( SvStream *pStream ); - SfxSingleRecordReader( SvStream *pStream, USHORT nTag ); - - inline UINT16 GetTag() const; - - inline BYTE GetVersion() const; - inline FASTBOOL HasVersion( USHORT nVersion ) const; -}; - -//------------------------------------------------------------------------ - -class SVL_DLLPUBLIC SfxMultiFixRecordWriter: public SfxSingleRecordWriter - -/* [Beschreibung] - - Mit Instanzen dieser Klasse kann ein Record in einen Stream geschrieben - werden, der seine eigene L"ange speichert und somit auch von "alteren - Versionen bzw. Readern, die diesen Record-Type (Tag) nicht kennen, - "ubersprungen werden kann. - - Er enth"alt mehrere Inhalte von demselben Typ (Tag) und derselben - Version, die einmalig (stellvertretend f"ur alle) im Header des Records - identifiziert werden. Alle Inhalte haben eine vorher bekannte und - identische L"ange. - - Um Auf- und Abw"artskompatiblit"at gew"ahrleisten zu k"onnen, m"ussen - neue Versionen die Daten der "alteren immer komplett enthalten, - es d"urfen allenfalls neue Daten hinten angeh"angt werden! Hier sind - damit selbstverst"andlich nur die Daten der einzelnen Inhalte gemeint, - die Anzahl der Inhalte ist selbstverst"andlich variabel und sollte - von lesenden Applikationen auch so behandelt werden. - - [Fileformat] - - 1* BYTE Pre-Tag (==0) - 1* 3-BYTE OffsetToEndOfRec in Bytes - 1* BYTE Record-Type (==SFX_REC_TYPE_FIXSIZE) - 1* BYTE Content-Version - 1* UINT16 Content-Tag - 1* UINT16 NumberOfContents - 1* UINT32 SizeOfEachContent - NumberOfContents* ( - SizeOfEachContent BYTE Content - ) - - [Beispiel] - - { - SfxMultiFixRecordWriter aRecord( pStream, MY_TAG_X, MY_VERSION ); - for ( USHORT n = 0; n < Count(); ++n ) - { - aRecord.NewContent(); - *aRecord << aMember1[n]; - *aRecord << aMember2[n]; - } - } -*/ - -{ -protected: - UINT32 _nContentStartPos; /* Startposition des jeweiligen - Contents - nur bei DBG_UTIL - und f"ur Subklassen */ - UINT32 _nContentSize; // Gr"o\se jedes Contents - UINT16 _nContentCount; // jeweilige Anzahl der Contents - - SfxMultiFixRecordWriter( BYTE nRecordType, - SvStream *pStream, - UINT16 nTag, BYTE nCurVer, - UINT32 nContentSize ); - -public: - SfxMultiFixRecordWriter( SvStream *pStream, - UINT16 nTag, BYTE nCurVer, - UINT32 nContentSize ); - inline ~SfxMultiFixRecordWriter(); - - inline void NewContent(); - - inline void Reset(); - - UINT32 Close( FASTBOOL bSeekToEndOfRec = TRUE ); -}; - -//------------------------------------------------------------------------ - -class SVL_DLLPUBLIC SfxMultiVarRecordWriter: public SfxMultiFixRecordWriter - -/* [Beschreibung] - - Mit Instanzen dieser Klasse kann ein Record in einen Stream geschrieben - werden, der seine eigene L"ange speichert und somit auch von "alteren - Versionen bzw. Readern, die diesen Record-Type (Tag) nicht kennen, - "ubersprungen werden kann. - - Er enth"alt mehrere Inhalte von demselben Typ (Tag) und derselben - Version, die einmalig (stellvertretend f"ur alle) im Header des Records - identifiziert werden. Die L"ange f"ur jeden einzelnen Inhalt wird - automatisch berechnet und gespeichert, so da\s auch einzelne Inhalte - "ubersprungen werden k"onnen, ohne sie interpretieren zu m"ussen. - - Um Auf- und Abw"artskompatiblit"at gew"ahrleisten zu k"onnen, m"ussen - neue Versionen die Daten der "alteren immer komplett enthalten, - es d"urfen allenfalls neue Daten hinten angeh"angt werden! - - [Fileformat] - - 1* BYTE Pre-Tag (==0) - 1* 3-BYTE OffsetToEndOfRec in Bytes - 1* BYTE Record-Type (==SFX_FILETYPE_TYPE_VARSIZE) - 1* BYTE Content-Version - 1* USHORT Content-Tag - 1* UINT16 NumberOfContents - 1* UINT32 OffsetToOfsTable - NumberOfContents* ( - ContentSize* BYTE Content - ) - NumberOfContents* UINT32 ContentOfs (je per <<8 verschoben) - - [Beispiel] - - { - SfxMultiVarRecordWriter aRecord( pStream, MY_TAG_X, MY_VERSION ); - for ( USHORT n = 0; n < Count(); ++n ) - { - aRecord.NewContent(); - *aRecord << aMember1[n]; - *aRecord << aMember2[n]; - } - } -*/ - -{ -protected: - SfxUINT32s _aContentOfs; - USHORT _nContentVer; // nur f"ur SfxMultiMixRecordWriter - - SfxMultiVarRecordWriter( BYTE nRecordType, - SvStream *pStream, - USHORT nRecordTag, - BYTE nRecordVer ); - - void FlushContent_Impl(); - -public: - SfxMultiVarRecordWriter( SvStream *pStream, - USHORT nRecordTag, - BYTE nRecordVer ); - virtual ~SfxMultiVarRecordWriter(); - - void NewContent(); - - virtual UINT32 Close( FASTBOOL bSeekToEndOfRec = TRUE ); -}; - -//------------------------------------------------------------------------ - -class SVL_DLLPUBLIC SfxMultiMixRecordWriter: public SfxMultiVarRecordWriter - -/* [Beschreibung] - - Mit Instanzen dieser Klasse kann ein Record in einen Stream geschrieben - werden, der seine eigene L"ange speichert und somit auch von "alteren - Versionen bzw. Readern, die diesen Record-Type (Tag) nicht kennen, - "ubersprungen werden kann. - - Er enth"alt mehrere Inhalte von demselben Typ (Tag) und derselben - Version, die einmalig (stellvertretend f"ur alle) im Header des Records - identifiziert werden. Alle Inhalte haben eine vorher bekannte und - identische L"ange. - - Um Auf- und Abw"artskompatiblit"at gew"ahrleisten zu k"onnen, m"ussen - neue Versionen die Daten der "alteren immer komplett enthalten, - es d"urfen allenfalls neue Daten hinten angeh"angt werden! - - [Fileformat] - - 1* BYTE Pre-Tag (==0) - 1* 3-BYTE OffsetToEndOfRec in Bytes - 1* BYTE Record-Type (==SFX_REC_TYPE_MIXTAGS) - 1* BYTE Content-Version - 1* USHORT Record-Tag - 1* UINT16 NumberOfContents - 1* UINT32 OffsetToOfsTable - NumberOfContents* ( - 1* USHORT Content-Tag - ContentSize* BYTE Content - ) - NumberOfContents* UINT32 ( ContentOfs << 8 + Version ) -*/ - -{ -public: - inline SfxMultiMixRecordWriter( SvStream *pStream, - USHORT nRecordTag, - BYTE nRecordVer ); - - void NewContent( USHORT nTag, BYTE nVersion ); - -// private: geht nicht, da einige Compiler dann auch vorherige privat machen - void NewContent() - { DBG_ERROR( "NewContent() only allowed with args" ); } -}; - -//------------------------------------------------------------------------ - -class SVL_DLLPUBLIC SfxMultiRecordReader: public SfxSingleRecordReader - -/* [Beschreibung] - - Mit Instanzen dieser Klasse kann ein aus mehreren Contents bestehender - Record aus einem Stream gelesen werden, der mit einer der Klassen - , oder - geschrieben wurde. - - Es ist auch m"oglich, den Record oder einzelne Contents zu "uberspringen, - ohne das jeweilis interne Format zu kennen. - - [Beispiel] - - { - SfxMultiRecordReader aRecord( pStream ); - for ( USHORT nRecNo = 0; aRecord.GetContent(); ++nRecNo ) - { - switch ( aRecord.GetTag() ) - { - case MY_TAG_X: - X *pObj = new X; - *aRecord >> pObj.>aMember1; - if ( aRecord.HasVersion(2) ) - *aRecord >> pObj->aMember2; - Append( pObj ); - break; - - ... - } - } - } -*/ - -{ - UINT32 _nStartPos; // Start-Position des Records - UINT32* _pContentOfs; // Offsets der Startpositionen - UINT32 _nContentSize; // Size jedes einzelnen / Tabellen-Pos - UINT16 _nContentCount; // Anzahl der Contents im Record - UINT16 _nContentNo; /* der Index des aktuellen Contents - enth"alt jeweils den Index des - Contents, der beim n"achsten - GetContent() geholt wird */ - UINT16 _nContentTag; // Art-Kennung des aktuellen Contents - BYTE _nContentVer; // Versions-Kennung des akt. Contents - - FASTBOOL ReadHeader_Impl(); - -public: - SfxMultiRecordReader( SvStream *pStream ); - SfxMultiRecordReader( SvStream *pStream, UINT16 nTag ); - ~SfxMultiRecordReader(); - - FASTBOOL GetContent(); - inline UINT16 GetContentTag(); - inline BYTE GetContentVersion() const; - inline FASTBOOL HasContentVersion( USHORT nVersion ) const; - - inline UINT32 ContentCount() const; -}; - -//========================================================================= - -inline SfxMiniRecordWriter::SfxMiniRecordWriter -( - SvStream* pStream, // Stream, in dem der Record angelegt wird - BYTE nTag // Record-Tag zwischen 0x01 und 0xFE -) - -/* [Beschreibung] - - Legt in 'pStream' einen 'SfxMiniRecord' an, dessen Content-Gr"o\se - nicht bekannt ist, sondern nach dam Streamen des Contents errechnet - werden soll. -*/ - -: _pStream( pStream ), - _nStartPos( pStream->Tell() ), - _bHeaderOk(FALSE), - _nPreTag( nTag ) -{ - DBG_ASSERT( _nPreTag != 0xFF, "invalid Tag" ); - DBG( DbgOutf( "SfxFileRec: writing record to %ul", pStream->Tell() ) ); - - pStream->SeekRel( + SFX_REC_HEADERSIZE_MINI ); -} - -//------------------------------------------------------------------------- - -inline SfxMiniRecordWriter::SfxMiniRecordWriter -( - SvStream* pStream, // Stream, in dem der Record angelegt wird - BYTE nTag, // Record-Tag zwischen 0x01 und 0xFE - UINT32 nSize // Gr"o\se der Daten in Bytes -) - -/* [Beschreibung] - - Legt in 'pStream' einen 'SfxMiniRecord' an, dessen Content-Gr"o\se - von vornherein bekannt ist. -*/ - -: _pStream( pStream ), - // _nTag( uninitialized ), - // _nStarPos( uninitialized ), - _bHeaderOk(SFX_BOOL_DONTCARE) -{ - DBG_ASSERT( nTag != 0 && nTag != 0xFF, "invalid Tag" ); - DBG(_nStartPos = pStream->Tell()); - DBG( DbgOutf( "SfxFileRec: writing record to %ul", _nStartPos ) ); - - *pStream << ( ( nTag << 24 ) | nSize ); -} - -//------------------------------------------------------------------------- - -inline SfxMiniRecordWriter::~SfxMiniRecordWriter() - -/* [Beschreibung] - - Der Dtor der Klasse schlie\st den Record - automatisch, falls nicht bereits - explizit gerufen wurde. -*/ - -{ - // wurde der Header noch nicht geschrieben oder mu\s er gepr"uft werden - if ( !_bHeaderOk DBG(||TRUE) ) - Close(); -} - -//------------------------------------------------------------------------- - -inline SvStream& SfxMiniRecordWriter::operator*() const - -/* [Beschreibung] - - Dieser Operator liefert den Stream, in dem der Record liegt. - Der Record darf noch nicht geschlossen worden sein. -*/ - -{ - DBG_ASSERT( !_bHeaderOk, "getting Stream of closed record" ); - return *_pStream; -} - -//------------------------------------------------------------------------- - -inline void SfxMiniRecordWriter::Reset() -{ - _pStream->Seek( _nStartPos + SFX_REC_HEADERSIZE_MINI ); - _bHeaderOk = FALSE; -} - -//========================================================================= - -inline SfxMiniRecordReader::~SfxMiniRecordReader() - -/* [Beschreibung] - - Der Dtor der Klasse positioniert den Stream - automatisch auf die Position direkt hinter dem Record, falls nicht - bereits explizit gerufen wurde. -*/ - -{ - // noch nicht explizit ans Ende gesprungen? - if ( !_bSkipped ) - Skip(); -} - -//------------------------------------------------------------------------- - -inline void SfxMiniRecordReader::Skip() - -/* [Beschreibung] - - Mit dieser Methode wird der Stream direkt hinter das Ende des Records - positioniert. -*/ - -{ - _pStream->Seek(_nEofRec); - _bSkipped = TRUE; -} - -//------------------------------------------------------------------------- - -inline BYTE SfxMiniRecordReader::GetTag() const - -/* [Beschreibung] - - Liefert des aus dem Header gelesene Pre-Tag des Records. Dieses kann - auch SFX_REC_PRETAG_EXT oder SFX_REC_PRETAG_EOR sein, im - letzteren Fall ist am Stream der Fehlercode ERRCODE_IO_WRONGFORMAT - gesetzt. SFX_REC_PRETAG_EXT ist g"ultig, da diese extended-Records - nur eine Erweiterung des SfxMiniRecord darstellen. -*/ - -{ - return _nPreTag; -} - -//------------------------------------------------------------------------- - -inline FASTBOOL SfxMiniRecordReader::IsValid() const - -/* [Beschreibung] - - Hiermit kann abgefragt werden, ob der Record erfolgreich aus dem - Stream konstruiert werden konnte, der Header also f"ur diesen Record-Typ - passend war. -*/ - -{ - return _nPreTag != SFX_REC_PRETAG_EOR; -} - -//------------------------------------------------------------------------- - -inline SvStream& SfxMiniRecordReader::operator*() const - -/* [Beschreibung] - - Dieser Operator liefert den Stream in dem der Record liegt. - Die aktuelle Position des Streams mu\s innerhalb des Records liegen. -*/ - -{ - DBG_ASSERT( _pStream->Tell() < _nEofRec, "read behind record" ); - return *_pStream; -} - -//========================================================================= - -inline UINT32 SfxSingleRecordWriter::Close( FASTBOOL bSeekToEndOfRec ) - -// siehe - -{ - UINT32 nRet = 0; - - // wurde der Header noch nicht geschrieben? - if ( !_bHeaderOk ) - { - // Basisklassen-Header schreiben - UINT32 nEndPos = SfxMiniRecordWriter::Close( bSeekToEndOfRec ); - - // ggf. ans Ende des eigenen Headers seeken oder hinter Rec bleiben - if ( !bSeekToEndOfRec ) - _pStream->SeekRel( SFX_REC_HEADERSIZE_SINGLE ); - nRet = nEndPos; - } -#ifdef DBG_UTIL - else - // Basisklassen-Header pr"ufen - SfxMiniRecordWriter::Close( bSeekToEndOfRec ); -#endif - - // Record war bereits geschlossen -// nRet = 0; - return nRet; -} - -//------------------------------------------------------------------------- - -inline void SfxSingleRecordWriter::Reset() -{ - _pStream->Seek( _nStartPos + SFX_REC_HEADERSIZE_MINI + - SFX_REC_HEADERSIZE_SINGLE ); - _bHeaderOk = FALSE; -} - -//========================================================================= - -inline UINT16 SfxSingleRecordReader::GetTag() const - -/* [Beschreibung] - - Liefert des aus dem Header gelesene Tag f"ur den Gesamt-Record. -*/ - -{ - return _nRecordTag; -} - -//------------------------------------------------------------------------- - -inline BYTE SfxSingleRecordReader::GetVersion() const - -/* [Beschreibung] - - Liefert die Version des aus dem Stream gelesenen Records. -*/ - -{ - return _nRecordVer; -} - -//------------------------------------------------------------------------- - -inline FASTBOOL SfxSingleRecordReader::HasVersion( USHORT nVersion ) const - -/* [Beschreibung] - - Stellt fest, ob der aus dem Stream gelese Record in der Version - 'nVersion' oder h"oher vorliegt. -*/ - -{ - return _nRecordVer >= nVersion; -} - -//========================================================================= - -inline SfxMultiFixRecordWriter::~SfxMultiFixRecordWriter() - -/* [Beschreibung] - - Der Dtor der Klasse schlie\st den Record - automatisch, falls nicht bereits - explizit gerufen wurde. -*/ - -{ - // wurde der Header noch nicht geschrieben oder mu\s er gepr"uft werden - if ( !_bHeaderOk ) - Close(); -} - -//------------------------------------------------------------------------- - -inline void SfxMultiFixRecordWriter::NewContent() - -/* [Beschreibung] - - Mit dieser Methode wird in den Record ein neuer Content eingef"ugt. - Jeder, auch der 1. Record mu\s durch Aufruf dieser Methode eingeleitet - werden. -*/ - -{ - #ifdef DBG_UTIL - ULONG nOldStartPos; - // Startposition des aktuellen Contents merken - Achtung Subklassen! - nOldStartPos = _nContentStartPos; - #endif - _nContentStartPos = _pStream->Tell(); - -#ifdef DBG_UTIL - // ist ein vorhergehender Content vorhanden? - if ( _nContentCount ) - { - // pr"ufen, ob der vorhergehende die Soll-Gr"o\se eingehalten hat - DBG_ASSERT( _nContentStartPos - nOldStartPos == _nContentSize, - "wrong content size detected" ); - } -#endif - - // Anzahl mitz"ahlen - ++_nContentCount; -} - -//========================================================================= - -inline SfxMultiMixRecordWriter::SfxMultiMixRecordWriter -( - SvStream* pStream, // Stream, in dem der Record angelegt wird - USHORT nRecordTag, // Gesamt-Record-Art-Kennung - BYTE nRecordVer // Gesamt-Record-Versions-Kennung -) - -/* [Beschreibung] - - Legt in 'pStream' einen 'SfxMultiMixRecord' an, f"ur dessen Contents - je eine separate Kennung f"ur Art (Tag) und Version gespeichert wird. - Die Gr"o\sen der einzelnen Contents werden automatisch ermittelt. -*/ - -: SfxMultiVarRecordWriter( SFX_REC_TYPE_MIXTAGS, - pStream, nRecordTag, nRecordVer ) -{ -} - -//========================================================================= - -inline void SfxMultiFixRecordWriter::Reset() -{ - _pStream->Seek( _nStartPos + SFX_REC_HEADERSIZE_MINI + - SFX_REC_HEADERSIZE_SINGLE + - SFX_REC_HEADERSIZE_MULTI ); - _bHeaderOk = FALSE; -} - -//========================================================================= - -inline UINT16 SfxMultiRecordReader::GetContentTag() - -/* [Beschreibung] - - Diese Methode liefert die Art-Kennung des zuletzt mit der Methode - ge"offneten Contents. -*/ - -{ - return _nContentTag; -} - -//------------------------------------------------------------------------- - -inline BYTE SfxMultiRecordReader::GetContentVersion() const - -/* [Beschreibung] - - Diese Methode liefert die Version-Kennung des zuletzt mit der Methode - ge"offneten Contents. -*/ - -{ - return _nContentVer; -} - -//------------------------------------------------------------------------- - -inline FASTBOOL SfxMultiRecordReader::HasContentVersion( USHORT nVersion ) const - -/* [Beschreibung] - - Diese Methode stellt fest, ob die Version 'nVersion' in der Version des - zuletzt mit der Methode ge"offneten - Contents enthalten ist. -*/ - -{ - return _nContentVer >= nVersion; -} - -//------------------------------------------------------------------------- - -inline UINT32 SfxMultiRecordReader::ContentCount() const - -/* [Beschreibung] - - Diese Methode liefert die Anzahl im Record befindlichen Contents. -*/ - -{ - return _nContentCount; -} - -#endif - diff --git a/svtools/inc/svtools/flagitem.hxx b/svtools/inc/svtools/flagitem.hxx deleted file mode 100644 index 5298bbd1678b..000000000000 --- a/svtools/inc/svtools/flagitem.hxx +++ /dev/null @@ -1,83 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: flagitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFXFLAGITEM_HXX -#define _SFXFLAGITEM_HXX - -#include "svtools/svtdllapi.h" -#include -#include -#include - -class SvStream; - -extern USHORT nSfxFlagVal[16]; - -// ----------------------------------------------------------------------- - -DBG_NAMEEX_VISIBILITY(SfxFlagItem, SVT_DLLPUBLIC) - -class SVT_DLLPUBLIC SfxFlagItem: public SfxPoolItem -{ - USHORT nVal; - -public: - TYPEINFO(); - - SfxFlagItem( USHORT nWhich = 0, USHORT nValue = 0 ); - SfxFlagItem( USHORT nWhich, SvStream & ); - SfxFlagItem( const SfxFlagItem& ); - - ~SfxFlagItem() { - DBG_DTOR(SfxFlagItem, 0); } - - virtual BYTE GetFlagCount() const; - virtual XubString GetFlagText( BYTE nFlag ) const; - - virtual int operator==( const SfxPoolItem& ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT nVersion) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; - - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper * = 0 ) const; - USHORT GetValue() const { return nVal; } - void SetValue( USHORT nNewVal ) { - DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); - nVal = nNewVal; - } - int GetFlag( BYTE nFlag ) const { - return ( (nVal & nSfxFlagVal[nFlag]) != 0 ); } - void SetFlag( BYTE nFlag, int bVal ); -}; - -#endif diff --git a/svtools/inc/svtools/frqitem.hxx b/svtools/inc/svtools/frqitem.hxx deleted file mode 100644 index 11b2d31a1123..000000000000 --- a/svtools/inc/svtools/frqitem.hxx +++ /dev/null @@ -1,178 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: frqitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _FRQITEM_HXX -#define _FRQITEM_HXX - -#include -#include -#include -#include - -#include - -class SvStream; - -DBG_NAMEEX(SfxFrequencyItem) - -// class SfxFrequencyItem ------------------------------------------------- - -/////////////////////////////////////////////////////////////////////////////// -/* -FRQ_DAILY - * jeden X'ten Tag - nInterval1 = 1 .. 999 - - * jeden Wochentag - nInterval1 = USHRT_MAX - -FRQ_WEEKLY - + wiederhole jede X'te Woche - nInterval1 = 1 .. 99 - - + an SU, MO, TU, WE, TH, FR, SA - nInterval2 = WD_SUNDAY | WD_MONDAY | WD_TUESDAY | WD_WEDNESDAY | - WD_THURSDAY | WD_FRIDAY | WD_SATURDAY - -FRQ_MONTHLY_DAILY - * jeden X'ten Tag von jedem X'ten Monat - nInterval1 = 1 .. 31 - nInterval2 = 1 .. 6 - -FRQ_MONTHLY_LOGIC - * jeden ersten, zweiten, dritten, vierten oder letzten Wochentag jeden X'ten Monats - nInterval1 = 0 .. 4 - nInterval2 = WD_SUNDAY | WD_MONDAY | WD_TUESDAY | WD_WEDNESDAY | - WD_THURSDAY | WD_FRIDAY | WD_SATURDAY - nInterval3 = 1 .. 6 - -=============================================================================== - -FRQ_TIME_AT - * Update um Uhrzeit - nTime1 = 00:00:00 - 24:00:00 - -FRQ_TIME_REPEAT - * Wiederhole alle X Stunden - nTInterval1 = 1 .. 8 - + zwischen Uhrzeit 1 und 2 - nTime1 = 00:00:00 - 24:00:00 - nTime2 = 00:00:00 - 24:00:00 - -*/ -/////////////////////////////////////////////////////////////////////////////// - -enum FrequencyMode -{ - FRQ_DAILY = 1, - FRQ_WEEKLY = 2, - FRQ_MONTHLY_DAILY = 3, - FRQ_MONTHLY_LOGIC = 4 -}; - -enum FrequencyTimeMode -{ - FRQ_TIME_AT = 1, - FRQ_TIME_REPEAT = 2, - FRQ_TIME_REPEAT_RANGE = 3 -}; - -#define WD_SUNDAY 0x0001 -#define WD_MONDAY 0x0002 -#define WD_TUESDAY 0x0004 -#define WD_WEDNESDAY 0x0008 -#define WD_THURSDAY 0x0010 -#define WD_FRIDAY 0x0020 -#define WD_SATURDAY 0x0040 - -class SfxFrequencyItem : public SfxPoolItem -{ -private: - FrequencyMode eFrqMode; - FrequencyTimeMode eFrqTimeMode; - - USHORT nDInterval1; - USHORT nDInterval2; - USHORT nDInterval3; - - USHORT nTInterval1; - Time aTime1; - Time aTime2; - - BOOL bMissingDate; - DateTime aMissingDate; - - Time _CalcTime( BOOL bForToday ) const; -public: - TYPEINFO(); - - SfxFrequencyItem( const SfxFrequencyItem& rCpy ); - SfxFrequencyItem( USHORT nWhich ); - SfxFrequencyItem( USHORT nWhich, FrequencyMode eMode, FrequencyTimeMode eTMode, - USHORT nDI1, USHORT nDI2, USHORT nDI3, USHORT nTI1, - const Time& rT1, const Time& rT2 ); - ~SfxFrequencyItem() { DBG_DTOR(SfxFrequencyItem, 0); } - - virtual int operator==( const SfxPoolItem& ) const; - using SfxPoolItem::Compare; - virtual int Compare( const SfxPoolItem &rWith ) const; - virtual SfxPoolItem* Create( SvStream&, USHORT nItemVersion ) const; - virtual SvStream& Store( SvStream&, USHORT nItemVersion ) const; - virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, XubString &rText, - const IntlWrapper * = 0 ) const; - - DateTime CalcNextTick( const DateTime& rNow, BOOL bFirst = FALSE ); - - BOOL HasMissingDate() const { return bMissingDate; } - DateTime GetMissingDate() const { return aMissingDate; } - - FrequencyMode GetFrequencyMode() const { return eFrqMode; } - FrequencyTimeMode GetFrequencyTimeMode() const { return eFrqTimeMode; } - USHORT GetDInterval_1() const { return nDInterval1; } - USHORT GetDInterval_2() const { return nDInterval2; } - USHORT GetDInterval_3() const { return nDInterval3; } - USHORT GetTInterval_1() const { return nTInterval1; } - const Time& GetTime_1() const { return aTime1; } - const Time& GetTime_2() const { return aTime2; } - - void SetFrequencyMode(FrequencyMode eNew) { eFrqMode = eNew; } - void SetFrequencyTimeMode(FrequencyTimeMode eNew){ eFrqTimeMode = eNew; } - void SetDInterval_1(USHORT nNew) { nDInterval1 = nNew; } - void SetDInterval_2(USHORT nNew) { nDInterval2 = nNew; } - void SetDInterval_3(USHORT nNew) { nDInterval3 = nNew; } - void SetTInterval_1(USHORT nNew) { nTInterval1 = nNew; } - void SetTime_1(const Time& rNew) { aTime1 = rNew; } - void SetTime_2(const Time& rNew) { aTime2 = rNew; } -}; - -#endif - diff --git a/svtools/inc/svtools/globalnameitem.hxx b/svtools/inc/svtools/globalnameitem.hxx deleted file mode 100644 index f19ea1dd8457..000000000000 --- a/svtools/inc/svtools/globalnameitem.hxx +++ /dev/null @@ -1,62 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: globalnameitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _GLOBALNAMEITEM_HXX -#define _GLOBALNAMEITEM_HXX - -#include "svtools/svtdllapi.h" -#include -#include -#include -#include - -// ----------------------------------------------------------------------- - -class SVT_DLLPUBLIC SfxGlobalNameItem: public SfxPoolItem -{ - SvGlobalName m_aName; - -public: - TYPEINFO(); - SfxGlobalNameItem(); - SfxGlobalNameItem( USHORT nWhich, const SvGlobalName& ); - ~SfxGlobalNameItem(); - - virtual int operator==( const SfxPoolItem& ) const; - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - SvGlobalName GetValue() const { return m_aName; } - - virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; -}; - -#endif - diff --git a/svtools/inc/svtools/hint.hxx b/svtools/inc/svtools/hint.hxx deleted file mode 100644 index 9417b2bc1702..000000000000 --- a/svtools/inc/svtools/hint.hxx +++ /dev/null @@ -1,75 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: hint.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFXHINT_HXX -#define _SFXHINT_HXX - -#include "svtools/svldllapi.h" -#include - -class SVL_DLLPUBLIC SfxHint -{ -public: - TYPEINFO(); - - virtual ~SfxHint(); -}; - -//-------------------------------------------------------------------- - -#define DECL_PTRHINT(Visibility, Name, Type) \ - class Visibility Name: public SfxHint \ - { \ - Type* pObj; \ - BOOL bIsOwner; \ - \ - public: \ - TYPEINFO(); \ - Name( Type* Object, BOOL bOwnedByHint = FALSE ); \ - ~Name(); \ - \ - Type* GetObject() const { return pObj; } \ - BOOL IsOwner() const { return bIsOwner; } \ - } - -#define IMPL_PTRHINT_AUTODELETE(Name, Type) \ - TYPEINIT1(Name, SfxHint); \ - Name::Name( Type* pObject, BOOL bOwnedByHint ) \ - { pObj = pObject; bIsOwner = bOwnedByHint; } \ - Name::~Name() { if ( bIsOwner ) delete pObj; } - -#define IMPL_PTRHINT(Name, Type) \ - TYPEINIT1(Name, SfxHint); \ - Name::Name( Type* pObject, BOOL bOwnedByHint ) \ - { pObj = pObject; bIsOwner = bOwnedByHint; } \ - Name::~Name() {} - - -#endif - diff --git a/svtools/inc/svtools/httpcook.hxx b/svtools/inc/svtools/httpcook.hxx deleted file mode 100644 index 354680a86f30..000000000000 --- a/svtools/inc/svtools/httpcook.hxx +++ /dev/null @@ -1,155 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: httpcook.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SVTOOLS_HTTPCOOK_HXX -#define SVTOOLS_HTTPCOOK_HXX - -#include -#include -#include -#include - -/*======================================================================= - * - *=====================================================================*/ -#define CNTHTTP_COOKIE_FLAG_SECURE 0x01 - -#define CNTHTTP_COOKIE_POLICY_INTERACTIVE 0x00 -#define CNTHTTP_COOKIE_POLICY_ACCEPTED 0x01 -#define CNTHTTP_COOKIE_POLICY_BANNED 0x02 - -#define CNTHTTP_COOKIE_DOMAIN_POLICY 0x10 - -#define CNTHTTP_COOKIE_DOMAIN_ACCEPTED \ - (CNTHTTP_COOKIE_DOMAIN_POLICY | CNTHTTP_COOKIE_POLICY_ACCEPTED) -#define CNTHTTP_COOKIE_DOMAIN_BANNED \ - (CNTHTTP_COOKIE_DOMAIN_POLICY | CNTHTTP_COOKIE_POLICY_BANNED) - -/*======================================================================= - * - * CntHTTPCookie. - * - *=====================================================================*/ -struct CntHTTPCookie -{ - String m_aName; - String m_aValue; - String m_aDomain; - String m_aPath; - DateTime m_aExpires; - USHORT m_nFlags; - USHORT m_nPolicy; - - CntHTTPCookie (void) - : m_aExpires (Date(0), Time(0)), - m_nFlags (0), - m_nPolicy (CNTHTTP_COOKIE_POLICY_INTERACTIVE) - {} - - BOOL replaces (const CntHTTPCookie& rOther) const - { - return ((m_aDomain == rOther.m_aDomain) && - (m_aPath == rOther.m_aPath ) && - (m_aName == rOther.m_aName ) ); - } - - BOOL operator== (const CntHTTPCookie& rOther) const - { - return ((m_aName == rOther.m_aName ) && - (m_aValue == rOther.m_aValue ) && - (m_aDomain == rOther.m_aDomain ) && - (m_aPath == rOther.m_aPath ) && - (m_aExpires == rOther.m_aExpires) && - (m_nFlags == rOther.m_nFlags ) && - (m_nPolicy == rOther.m_nPolicy ) ); - } - - void write (SvStream& rStrm) const - { - SfxPoolItem::writeUnicodeString(rStrm, m_aName); - SfxPoolItem::writeUnicodeString(rStrm, m_aValue); - SfxPoolItem::writeUnicodeString(rStrm, m_aDomain); - SfxPoolItem::writeUnicodeString(rStrm, m_aPath); - - rStrm << m_aExpires.GetDate(); - rStrm << m_aExpires.GetTime(); - - rStrm << m_nFlags; - rStrm << m_nPolicy; - } - - void read (SvStream& rStrm, bool bUnicode) - { - SfxPoolItem::readUnicodeString(rStrm, m_aName, bUnicode); - SfxPoolItem::readUnicodeString(rStrm, m_aValue, bUnicode); - SfxPoolItem::readUnicodeString(rStrm, m_aDomain, bUnicode); - SfxPoolItem::readUnicodeString(rStrm, m_aPath, bUnicode); - - sal_uInt32 nValue = 0; - rStrm >> nValue; - m_aExpires.SetDate (nValue); - rStrm >> nValue; - m_aExpires.SetTime (nValue); - - rStrm >> m_nFlags; - rStrm >> m_nPolicy; - } -}; - -/*======================================================================= - * - * CntHTTPCookieRequest. - * - *=====================================================================*/ -enum CntHTTPCookieRequestType -{ - CNTHTTP_COOKIE_REQUEST_RECV = 0, - CNTHTTP_COOKIE_REQUEST_SEND -}; - -struct CntHTTPCookieRequest -{ - const String& m_rURL; - List& m_rCookieList; - CntHTTPCookieRequestType m_eType; - USHORT m_nRet; - - CntHTTPCookieRequest ( - const String& rURL, - List& rCookieList, - CntHTTPCookieRequestType eType) - : m_rURL (rURL), - m_rCookieList (rCookieList), - m_eType(eType), - m_nRet (CNTHTTP_COOKIE_POLICY_BANNED) {} -}; - -#endif // SVTOOLS_HTTPCOOK_HXX - diff --git a/svtools/inc/svtools/ilstitem.hxx b/svtools/inc/svtools/ilstitem.hxx deleted file mode 100644 index 0bc76f1d0627..000000000000 --- a/svtools/inc/svtools/ilstitem.hxx +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ilstitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SFXILSTITEM_HXX -#define _SFXILSTITEM_HXX - -#include "svtools/svldllapi.h" -#include -#include - -class SvULongs; - -class SVL_DLLPUBLIC SfxIntegerListItem : public SfxPoolItem -{ - ::com::sun::star::uno::Sequence < sal_Int32 > m_aList; - -public: - TYPEINFO(); - - SfxIntegerListItem(); - SfxIntegerListItem( USHORT nWhich, const SvULongs& rList ); - SfxIntegerListItem( const SfxIntegerListItem& rItem ); - ~SfxIntegerListItem(); - - ::com::sun::star::uno::Sequence < sal_Int32 > GetSequence() - { return m_aList; } - ::com::sun::star::uno::Sequence < sal_Int32 > GetConstSequence() const - { return SAL_CONST_CAST(SfxIntegerListItem *, this)->GetSequence(); } - - void GetList( SvULongs& rList ) const; - - virtual int operator==( const SfxPoolItem& ) const; - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; -}; - -#endif // _SFXINTITEM_HXX - diff --git a/svtools/inc/svtools/imageitm.hxx b/svtools/inc/svtools/imageitm.hxx deleted file mode 100644 index e0151729c2e0..000000000000 --- a/svtools/inc/svtools/imageitm.hxx +++ /dev/null @@ -1,62 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: imageitm.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVT_IMAGEITM_HXX -#define _SVT_IMAGEITM_HXX - -#include "svtools/svtdllapi.h" -#include - -class String; - -struct SfxImageItem_Impl; -class SVT_DLLPUBLIC SfxImageItem : public SfxInt16Item -{ - SfxImageItem_Impl* pImp; -public: - TYPEINFO(); - SfxImageItem( USHORT nWhich = 0, UINT16 nImage = 0 ); - SfxImageItem( USHORT nWhich, const String& rURL ); - SfxImageItem( const SfxImageItem& ); - virtual ~SfxImageItem(); - - virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; - virtual int operator==( const SfxPoolItem& ) const; - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); - - void SetRotation( long nValue ); - long GetRotation() const; - void SetMirrored( BOOL bSet ); - BOOL IsMirrored() const; - String GetURL() const; -}; - -#endif // _SFX_IMAGEITM_HXX diff --git a/svtools/inc/svtools/inethist.hxx b/svtools/inc/svtools/inethist.hxx deleted file mode 100644 index ad64e1131bf3..000000000000 --- a/svtools/inc/svtools/inethist.hxx +++ /dev/null @@ -1,135 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: inethist.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _INETHIST_HXX -#define _INETHIST_HXX - -#include "svtools/svldllapi.h" -#include -#include -#include -#include -#include - -/*======================================================================== - * - * INetURLHistory interface. - * - *=======================================================================*/ -class INetURLHistory_Impl; -class INetURLHistory : public SfxBroadcaster -{ - struct StaticInstance - { - INetURLHistory * operator()(); - }; - friend INetURLHistory * StaticInstance::operator()(); - - /** Representation. - */ - INetURLHistory_Impl *m_pImpl; - - /** Construction/Destruction. - */ - INetURLHistory (void); - virtual ~INetURLHistory (void); - - /** Implementation. - */ - static void NormalizeUrl_Impl (INetURLObject &rUrl); - - SVL_DLLPUBLIC void PutUrl_Impl (const INetURLObject &rUrl); - SVL_DLLPUBLIC BOOL QueryUrl_Impl (const INetURLObject &rUrl); - - /** Not implemented. - */ - INetURLHistory (const INetURLHistory&); - INetURLHistory& operator= (const INetURLHistory&); - -public: - /** GetOrCreate. - */ - SVL_DLLPUBLIC static INetURLHistory* GetOrCreate (void); - - /** QueryProtocol. - */ - BOOL QueryProtocol (INetProtocol eProto) const - { - return ((eProto == INET_PROT_FILE ) || - (eProto == INET_PROT_FTP ) || - (eProto == INET_PROT_HTTP ) || - (eProto == INET_PROT_HTTPS) ); - } - - /** QueryUrl. - */ - BOOL QueryUrl (const INetURLObject &rUrl) - { - if (QueryProtocol (rUrl.GetProtocol())) - return QueryUrl_Impl (rUrl); - else - return FALSE; - } - - BOOL QueryUrl (const String &rUrl) - { - INetProtocol eProto = - INetURLObject::CompareProtocolScheme (rUrl); - if (QueryProtocol (eProto)) - return QueryUrl_Impl (INetURLObject (rUrl)); - else - return FALSE; - } - - /** PutUrl. - */ - void PutUrl (const INetURLObject &rUrl) - { - if (QueryProtocol (rUrl.GetProtocol())) - PutUrl_Impl (rUrl); - } - - void PutUrl (const String &rUrl) - { - INetProtocol eProto = - INetURLObject::CompareProtocolScheme (rUrl); - if (QueryProtocol (eProto)) - PutUrl_Impl (INetURLObject (rUrl)); - } -}; - -/*======================================================================== - * - * INetURLHistoryHint (broadcasted from PutUrl()). - * - *=======================================================================*/ -DECL_PTRHINT (SVL_DLLPUBLIC, INetURLHistoryHint, const INetURLObject); - -#endif /* _INETHIST_HXX */ - diff --git a/svtools/inc/svtools/inettype.hxx b/svtools/inc/svtools/inettype.hxx deleted file mode 100644 index 2d9f0ba8694c..000000000000 --- a/svtools/inc/svtools/inettype.hxx +++ /dev/null @@ -1,479 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: inettype.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _INETTYPE_HXX -#define _INETTYPE_HXX - -#include "svtools/svldllapi.h" -#include -#include - -//============================================================================ -/** Definitions for frequently used media type names. - */ -#define CONTENT_TYPE_STR_APP_OCTSTREAM "application/octet-stream" -#define CONTENT_TYPE_STR_APP_PDF "application/pdf" -#define CONTENT_TYPE_STR_APP_RTF "application/rtf" -#define CONTENT_TYPE_STR_APP_VND_CALC "application/vnd.stardivision.calc" -#define CONTENT_TYPE_STR_APP_VND_CHART "application/vnd.stardivision.chart" -#define CONTENT_TYPE_STR_APP_VND_DRAW "application/vnd.stardivision.draw" -#define CONTENT_TYPE_STR_APP_VND_IMAGE "application/vnd.stardivision.image" -#define CONTENT_TYPE_STR_APP_VND_IMPRESSPACKED \ - "application/vnd.stardivision.impress-packed" -#define CONTENT_TYPE_STR_APP_VND_IMPRESS \ - "application/vnd.stardivision.impress" -#define CONTENT_TYPE_STR_APP_VND_MAIL "application/vnd.stardivision.mail" -#define CONTENT_TYPE_STR_APP_VND_MATH "application/vnd.stardivision.math" -#define CONTENT_TYPE_STR_APP_VND_NEWS "application/vnd.stardivision.news" -#define CONTENT_TYPE_STR_APP_VND_OUTTRAY \ - "application/vnd.stardivision.outtray" -#define CONTENT_TYPE_STR_APP_VND_TEMPLATE \ - "application/vnd.stardivision.template" -#define CONTENT_TYPE_STR_APP_VND_WRITER_GLOBAL \ - "application/vnd.stardivision.writer-global" -#define CONTENT_TYPE_STR_APP_VND_WRITER_WEB \ - "application/vnd.stardivision.writer-web" -#define CONTENT_TYPE_STR_APP_VND_WRITER "application/vnd.stardivision.writer" -#define CONTENT_TYPE_STR_APP_FRAMESET "application/x-frameset" -#define CONTENT_TYPE_STR_APP_GALLERY_THEME "application/x-gallery-theme" -#define CONTENT_TYPE_STR_APP_GALLERY "application/x-gallery" -#define CONTENT_TYPE_STR_APP_JAR "application/x-jar" -#define CONTENT_TYPE_STR_APP_MACRO "application/x-macro" -#define CONTENT_TYPE_STR_APP_MSEXCEL_TEMPL "application/x-msexcel-template" -#define CONTENT_TYPE_STR_APP_MSEXCEL "application/x-msexcel" -#define CONTENT_TYPE_STR_APP_MSPPOINT_TEMPL "application/x-mspowerpoint-template" -#define CONTENT_TYPE_STR_APP_MSPPOINT "application/x-mspowerpoint" -#define CONTENT_TYPE_STR_APP_MSWORD_TEMPL "application/x-msword-template" -#define CONTENT_TYPE_STR_APP_MSWORD "application/x-msword" -#define CONTENT_TYPE_STR_APP_SCHEDULE_EVT "application/x-schedule-event" -#define CONTENT_TYPE_STR_APP_SCHEDULE_FEVT "application/x-schedule-form-event" -#define CONTENT_TYPE_STR_APP_SCHEDULE_FTASK "application/x-schedule-form-task" -#define CONTENT_TYPE_STR_APP_SCHEDULE_TASK "application/x-schedule-task" -#define CONTENT_TYPE_STR_APP_SCHEDULE_CMB "application/x-schedule" -#define CONTENT_TYPE_STR_APP_STARCALC "application/x-starcalc" -#define CONTENT_TYPE_STR_APP_STARCHART "application/x-starchart" -#define CONTENT_TYPE_STR_APP_STARDRAW "application/x-stardraw" -#define CONTENT_TYPE_STR_APP_STARHELP "application/x-starhelp" -#define CONTENT_TYPE_STR_APP_STARIMAGE "application/x-starimage" -#define CONTENT_TYPE_STR_APP_STARIMPRESS "application/x-starimpress" -#define CONTENT_TYPE_STR_APP_STARMAIL_SDM "application/x-starmail-sdm" -#define CONTENT_TYPE_STR_APP_STARMAIL_SMD "application/x-starmail-smd" -#define CONTENT_TYPE_STR_APP_STARMATH "application/x-starmath" -#define CONTENT_TYPE_STR_APP_STARWRITER_GLOB "application/x-starwriter-global" -#define CONTENT_TYPE_STR_APP_STARWRITER "application/x-starwriter" -#define CONTENT_TYPE_STR_APP_CDE_CALENDAR_APP "application/x-sun-ae-file" -#define CONTENT_TYPE_STR_APP_ZIP "application/x-zip-compressed" -#define CONTENT_TYPE_STR_AUDIO_AIFF "audio/aiff" -#define CONTENT_TYPE_STR_AUDIO_BASIC "audio/basic" -#define CONTENT_TYPE_STR_AUDIO_MIDI "audio/midi" -#define CONTENT_TYPE_STR_AUDIO_WAV "audio/wav" -#define CONTENT_TYPE_STR_X_CNT_DOCUMENT ".chaos/document" -#define CONTENT_TYPE_STR_X_CNT_FSYSBOX ".chaos/fsys-box" -#define CONTENT_TYPE_STR_X_CNT_CDROM_VOLUME ".chaos/fsys-cdrom-volume" -#define CONTENT_TYPE_STR_X_CNT_DISK_35 ".chaos/fsys-disk-35" -#define CONTENT_TYPE_STR_X_CNT_DISK_525 ".chaos/fsys-disk-525" -#define CONTENT_TYPE_STR_X_CNT_FSYSFILE ".chaos/fsys-file" -#define CONTENT_TYPE_STR_X_CNT_FIXED_VOLUME ".chaos/fsys-fixed-volume" -#define CONTENT_TYPE_STR_X_CNT_FSYSFOLDER ".chaos/fsys-folder" -#define CONTENT_TYPE_STR_X_CNT_RAM_VOLUME ".chaos/fsys-ram-volume" -#define CONTENT_TYPE_STR_X_CNT_REMOTE_VOLUME ".chaos/fsys-remote-volume" -#define CONTENT_TYPE_STR_X_CNT_REMOVEABLE_VOLUME \ - ".chaos/fsys-removeable-volume" -#define CONTENT_TYPE_STR_X_CNT_FSYSSPECIALFILE ".chaos/fsys-special-file" -#define CONTENT_TYPE_STR_X_CNT_FSYSSPECIALFOLDER ".chaos/fsys-special-folder" -#define CONTENT_TYPE_STR_X_CNT_TAPEDRIVE ".chaos/fsys-tapedrive" -#define CONTENT_TYPE_STR_X_CNT_FSYSURLFILE ".chaos/fsys-urlfile" -#define CONTENT_TYPE_STR_X_CNT_FTPBOX ".chaos/ftp-box" -#define CONTENT_TYPE_STR_X_CNT_FTPFILE ".chaos/ftp-file" -#define CONTENT_TYPE_STR_X_CNT_FTPFOLDER ".chaos/ftp-folder" -#define CONTENT_TYPE_STR_X_CNT_FTPLINK ".chaos/ftp-link" -#define CONTENT_TYPE_STR_X_CNT_HTTPBOX ".chaos/http-box" -#define CONTENT_TYPE_STR_X_CNT_HTTPFILE ".chaos/http-file" -#define CONTENT_TYPE_STR_X_CNT_IMAPBOX ".chaos/imap-box" -#define CONTENT_TYPE_STR_X_CNT_IMAPFOLDER ".chaos/imap-folder" -#define CONTENT_TYPE_STR_X_CNT_MESSAGE ".chaos/message" -#define CONTENT_TYPE_STR_X_CNT_NEWSBOX ".chaos/news-box" -#define CONTENT_TYPE_STR_X_CNT_NEWSGROUP ".chaos/news-group" -#define CONTENT_TYPE_STR_X_CNT_OUTBOX ".chaos/out-box" -#define CONTENT_TYPE_STR_X_CNT_POP3BOX ".chaos/pop3-box" -#define CONTENT_TYPE_STR_X_CNT_PUBLISHBOX ".chaos/publish-box" -#define CONTENT_TYPE_STR_X_CNT_SEARCHBOX ".chaos/search-box" -#define CONTENT_TYPE_STR_X_CNT_SEPARATOR ".chaos/separator" -#define CONTENT_TYPE_STR_X_CNT_BOOKMARK ".chaos/subscribe-bookmark" -#define CONTENT_TYPE_STR_X_CNT_SUBSCRIBEBOX ".chaos/subscribe-box" -#define CONTENT_TYPE_STR_X_CNT_CDFITEM ".chaos/subscribe-cdf-item" -#define CONTENT_TYPE_STR_X_CNT_CDFSUB ".chaos/subscribe-cdf-sub" -#define CONTENT_TYPE_STR_X_CNT_CDF ".chaos/subscribe-cdf" -#define CONTENT_TYPE_STR_X_CNT_STARCHANNEL ".chaos/subscribe-sdc" -#define CONTENT_TYPE_STR_X_CNT_TRASHBOX ".chaos/trash-box" -#define CONTENT_TYPE_STR_X_CNT_TRASH ".chaos/trash-item" -#define CONTENT_TYPE_STR_X_CNT_VIMBBOARDBOX ".chaos/vim-bboardbox" -#define CONTENT_TYPE_STR_X_CNT_VIMBBOARD ".chaos/vim-bboard" -#define CONTENT_TYPE_STR_X_CNT_VIMBOX ".chaos/vim-box" -#define CONTENT_TYPE_STR_X_CNT_VIMINBOX ".chaos/vim-inbox" -#define CONTENT_TYPE_STR_IMAGE_GENERIC "image/generic" -#define CONTENT_TYPE_STR_IMAGE_GIF "image/gif" -#define CONTENT_TYPE_STR_IMAGE_JPEG "image/jpeg" -#define CONTENT_TYPE_STR_IMAGE_PCX "image/pcx" -#define CONTENT_TYPE_STR_IMAGE_PNG "image/png" -#define CONTENT_TYPE_STR_IMAGE_TIFF "image/tiff" -#define CONTENT_TYPE_STR_IMAGE_BMP "image/x-MS-bmp" -#define CONTENT_TYPE_STR_INET_MSG_RFC822 "message/rfc822" -#define CONTENT_TYPE_STR_INET_MULTI_ALTERNATIVE "multipart/alternative" -#define CONTENT_TYPE_STR_INET_MULTI_DIGEST "multipart/digest" -#define CONTENT_TYPE_STR_INET_MULTI_MIXED "multipart/mixed" -#define CONTENT_TYPE_STR_INET_MULTI_PARALLEL "multipart/parallel" -#define CONTENT_TYPE_STR_INET_MULTI_RELATED "multipart/related" -#define CONTENT_TYPE_STR_TEXT_ICALENDAR "text/calendar" -#define CONTENT_TYPE_STR_TEXT_HTML "text/html" -#define CONTENT_TYPE_STR_TEXT_PLAIN "text/plain" -#define CONTENT_TYPE_STR_TEXT_XMLICALENDAR "text/x-icalxml" -#define CONTENT_TYPE_STR_TEXT_URL "text/x-url" -#define CONTENT_TYPE_STR_TEXT_VCALENDAR "text/x-vCalendar" -#define CONTENT_TYPE_STR_TEXT_VCARD "text/x-vCard" -#define CONTENT_TYPE_STR_VIDEO_VDO "video/vdo" -#define CONTENT_TYPE_STR_VIDEO_MSVIDEO "video/x-msvideo" -#define CONTENT_TYPE_STR_X_STARMAIL "x-starmail" -#define CONTENT_TYPE_STR_X_VRML "x-world/x-vrml" -#define CONTENT_TYPE_STR_APP_VND_SUN_XML_WRITER "application/vnd.sun.xml.writer" -#define CONTENT_TYPE_STR_APP_VND_SUN_XML_CALC "application/vnd.sun.xml.calc" -#define CONTENT_TYPE_STR_APP_VND_SUN_XML_IMPRESS "application/vnd.sun.xml.impress" -#define CONTENT_TYPE_STR_APP_VND_SUN_XML_DRAW "application/vnd.sun.xml.draw" -#define CONTENT_TYPE_STR_APP_VND_SUN_XML_CHART "application/vnd.sun.xml.chart" - -#define CONTENT_TYPE_STR_APP_VND_SUN_XML_MATH "application/vnd.sun.xml.math" -#define CONTENT_TYPE_STR_APP_VND_SUN_XML_WRITER_GLOBAL "application/vnd.sun.xml.writer-global" -#define CONTENT_TYPE_STR_APP_VND_SUN_XML_IMPRESSPACKED "application/vnd.sun.xml.impress-packed" - -//============================================================================ -/** Definitions for frequently used media type parameter names. - */ -#define INET_CONTENT_TYPE_PARAMETER_CHARSET "charset" - -//============================================================================ -/** Definitions for matching parts of URIs. - */ -#define INETTYPE_URL_PROT_COMPONENT ".component" -#define INETTYPE_URL_PROT_DATA "data" -#define INETTYPE_URL_PROT_FILE "file" -#define INETTYPE_URL_PROT_HTTP "http" -#define INETTYPE_URL_PROT_HTTPS "https" -#define INETTYPE_URL_PROT_MACRO "macro" -#define INETTYPE_URL_PROT_MAILTO "mailto" -#define INETTYPE_URL_PROT_PRIVATE "private" - -#define INETTYPE_URL_SUB_FACTORY "factory" -#define INETTYPE_URL_SUB_HELPID "helpid" - -#define INETTYPE_URL_SSUB_FRAMESET "frameset" -#define INETTYPE_URL_SSUB_SCALC "scalc" -#define INETTYPE_URL_SSUB_SCHART "schart" -#define INETTYPE_URL_SSUB_SDRAW "sdraw" -#define INETTYPE_URL_SSUB_SIMAGE "simage" -#define INETTYPE_URL_SSUB_SIMPRESS "simpress" -#define INETTYPE_URL_SSUB_SMATH "smath" -#define INETTYPE_URL_SSUB_SS "ss" -#define INETTYPE_URL_SSUB_SWRITER "swriter" - -#define INETTYPE_URL_SSSUB_GLOB "GlobalDocument" -#define INETTYPE_URL_SSSUB_WEB "web" - -#define INETTYPE_URL_SCHED_CMB "cmbview" -#define INETTYPE_URL_SCHED_FORM "formular" -#define INETTYPE_URL_SCHED_EVENT "type=event" -#define INETTYPE_URL_SCHED_TASK "type=task" - -//============================================================================ -enum INetContentType -{ - CONTENT_TYPE_UNKNOWN, - CONTENT_TYPE_APP_OCTSTREAM, - CONTENT_TYPE_APP_PDF, - CONTENT_TYPE_APP_RTF, - CONTENT_TYPE_APP_MSWORD, - CONTENT_TYPE_APP_MSWORD_TEMPL, - CONTENT_TYPE_APP_STARCALC, - CONTENT_TYPE_APP_STARCHART, - CONTENT_TYPE_APP_STARDRAW, - CONTENT_TYPE_APP_STARHELP, - CONTENT_TYPE_APP_STARIMAGE, - CONTENT_TYPE_APP_STARIMPRESS, - CONTENT_TYPE_APP_STARMATH, - CONTENT_TYPE_APP_STARWRITER, - CONTENT_TYPE_APP_ZIP, - CONTENT_TYPE_AUDIO_AIFF, - CONTENT_TYPE_AUDIO_BASIC, - CONTENT_TYPE_AUDIO_MIDI, - CONTENT_TYPE_AUDIO_WAV, - CONTENT_TYPE_IMAGE_GIF, - CONTENT_TYPE_IMAGE_JPEG, - CONTENT_TYPE_IMAGE_PCX, - CONTENT_TYPE_IMAGE_PNG, - CONTENT_TYPE_IMAGE_TIFF, - CONTENT_TYPE_IMAGE_BMP, - CONTENT_TYPE_TEXT_HTML, - CONTENT_TYPE_TEXT_PLAIN, - CONTENT_TYPE_TEXT_URL, - CONTENT_TYPE_TEXT_VCARD, - CONTENT_TYPE_VIDEO_VDO, - CONTENT_TYPE_VIDEO_MSVIDEO, - CONTENT_TYPE_X_CNT_MESSAGE, - CONTENT_TYPE_X_CNT_DOCUMENT, - CONTENT_TYPE_X_CNT_POP3BOX, - CONTENT_TYPE_X_CNT_IMAPBOX, - CONTENT_TYPE_X_CNT_IMAPFOLDER, - CONTENT_TYPE_X_CNT_VIMBOX, - CONTENT_TYPE_X_CNT_VIMINBOX, - CONTENT_TYPE_X_CNT_VIMBBOARDBOX, - CONTENT_TYPE_X_CNT_VIMBBOARD, - CONTENT_TYPE_X_CNT_NEWSBOX, - CONTENT_TYPE_X_CNT_NEWSGROUP, - CONTENT_TYPE_X_CNT_OUTBOX, - CONTENT_TYPE_X_CNT_FTPBOX, - CONTENT_TYPE_X_CNT_FTPFOLDER, - CONTENT_TYPE_X_CNT_FTPFILE, - CONTENT_TYPE_X_CNT_FTPLINK, - CONTENT_TYPE_X_CNT_HTTPBOX, - CONTENT_TYPE_X_CNT_FSYSBOX, - CONTENT_TYPE_X_CNT_FSYSFOLDER, - CONTENT_TYPE_X_CNT_FSYSFILE, - CONTENT_TYPE_X_CNT_FSYSURLFILE, - CONTENT_TYPE_X_CNT_PUBLISHBOX, - CONTENT_TYPE_X_CNT_SEARCHBOX, - CONTENT_TYPE_X_CNT_SUBSCRIBEBOX, - CONTENT_TYPE_X_CNT_BOOKMARK, - CONTENT_TYPE_X_CNT_CDF, - CONTENT_TYPE_X_CNT_CDFSUB, - CONTENT_TYPE_X_CNT_CDFITEM, - CONTENT_TYPE_X_CNT_TRASHBOX, - CONTENT_TYPE_X_CNT_TRASH, - CONTENT_TYPE_X_STARMAIL, - CONTENT_TYPE_X_VRML, - CONTENT_TYPE_X_CNT_REMOVEABLE_VOLUME, - CONTENT_TYPE_X_CNT_FIXED_VOLUME, - CONTENT_TYPE_X_CNT_REMOTE_VOLUME, - CONTENT_TYPE_X_CNT_RAM_VOLUME, - CONTENT_TYPE_X_CNT_CDROM_VOLUME, - CONTENT_TYPE_X_CNT_DISK_35, - CONTENT_TYPE_X_CNT_DISK_525, - CONTENT_TYPE_X_CNT_TAPEDRIVE, - CONTENT_TYPE_APP_GALLERY, - CONTENT_TYPE_APP_GALLERY_THEME, - CONTENT_TYPE_X_CNT_STARCHANNEL, - CONTENT_TYPE_X_CNT_SEPARATOR, - CONTENT_TYPE_APP_STARWRITER_GLOB, - CONTENT_TYPE_APP_STARMAIL_SDM, - CONTENT_TYPE_APP_STARMAIL_SMD, - CONTENT_TYPE_APP_VND_CALC, - CONTENT_TYPE_APP_VND_CHART, - CONTENT_TYPE_APP_VND_DRAW, - CONTENT_TYPE_APP_VND_IMAGE, - CONTENT_TYPE_APP_VND_IMPRESS, - CONTENT_TYPE_APP_VND_MAIL, - CONTENT_TYPE_APP_VND_MATH, - CONTENT_TYPE_APP_VND_WRITER, - CONTENT_TYPE_APP_VND_WRITER_GLOBAL, - CONTENT_TYPE_APP_VND_WRITER_WEB, - CONTENT_TYPE_APP_SCHEDULE, - CONTENT_TYPE_APP_SCHEDULE_EVT, - CONTENT_TYPE_APP_SCHEDULE_TASK, - CONTENT_TYPE_APP_SCHEDULE_FORM_EVT, - CONTENT_TYPE_APP_SCHEDULE_FORM_TASK, - CONTENT_TYPE_APP_FRAMESET, - CONTENT_TYPE_APP_MACRO, - CONTENT_TYPE_X_CNT_FSYSSPECIALFOLDER, - CONTENT_TYPE_X_CNT_FSYSSPECIALFILE, - CONTENT_TYPE_APP_VND_TEMPLATE, - CONTENT_TYPE_IMAGE_GENERIC, - CONTENT_TYPE_APP_VND_NEWS, - CONTENT_TYPE_APP_VND_OUTTRAY, - CONTENT_TYPE_X_CNT_HTTPFILE, - CONTENT_TYPE_APP_MSEXCEL, - CONTENT_TYPE_APP_MSEXCEL_TEMPL, - CONTENT_TYPE_APP_MSPPOINT, - CONTENT_TYPE_APP_MSPPOINT_TEMPL, - CONTENT_TYPE_TEXT_VCALENDAR, - CONTENT_TYPE_TEXT_ICALENDAR, - CONTENT_TYPE_TEXT_XMLICALENDAR, - CONTENT_TYPE_APP_CDE_CALENDAR_APP, - CONTENT_TYPE_INET_MESSAGE_RFC822, - CONTENT_TYPE_INET_MULTIPART_ALTERNATIVE, - CONTENT_TYPE_INET_MULTIPART_DIGEST, - CONTENT_TYPE_INET_MULTIPART_PARALLEL, - CONTENT_TYPE_INET_MULTIPART_RELATED, - CONTENT_TYPE_INET_MULTIPART_MIXED, - CONTENT_TYPE_APP_VND_IMPRESSPACKED, - CONTENT_TYPE_APP_JAR, - CONTENT_TYPE_APP_VND_SUN_XML_WRITER, - CONTENT_TYPE_APP_VND_SUN_XML_CALC, - CONTENT_TYPE_APP_VND_SUN_XML_IMPRESS, - CONTENT_TYPE_APP_VND_SUN_XML_DRAW, - CONTENT_TYPE_APP_VND_SUN_XML_CHART, - CONTENT_TYPE_APP_VND_SUN_XML_MATH, - CONTENT_TYPE_APP_VND_SUN_XML_WRITER_GLOBAL, - CONTENT_TYPE_APP_VND_SUN_XML_IMPRESSPACKED, - CONTENT_TYPE_LAST = CONTENT_TYPE_APP_VND_SUN_XML_IMPRESSPACKED -}; - -//============================================================================ -class SVL_DLLPUBLIC INetContentTypes -{ -public: - static void Uninitialize(); - - static INetContentType RegisterContentType(UniString const & rTypeName, - UniString const & - rPresentation, - UniString const * pExtension - = 0, - UniString const * - pSystemFileType = 0); - - static INetContentType GetContentType(UniString const & rTypeName); - - static UniString GetContentType(INetContentType eTypeID); - - static UniString GetPresentation(INetContentType eTypeID, - const ::com::sun::star::lang::Locale& aLocale); - - static UniString GetExtension(UniString const & rTypeName); - - static INetContentType GetContentType4Extension(UniString const & - rExtension); - - static INetContentType GetContentTypeFromURL(UniString const & rURL); - - static bool GetExtensionFromURL(UniString const & rURL, - UniString & rExtension); - - static INetContentType MapStringToContentType(UniString const & - rPresentation); - - /** Parse the body of an RFC 2045 Content-Type header field. - - @param rMediaType The body of the Content-Type header field. It must - be of the form - - token "/" token *(";" token "=" (token / quoted-string)) - - with intervening linear white space and comments (cf. RFCs 822, 2045). - The RFC 2231 extension are supported. The encoding of rMediaType - should be US-ASCII, but any values in the range 0x80--0xFF are - interpretet 'as appropriate.' - - @param rType Returns the type (the first of the above tokens), in US- - ASCII encoding and converted to lower case. - - @param rSubType Returns the sub type (the second of the above - tokens), in US-ASCII encoding and converted to lower case. - - @param rParameters If not null, returns the parameters as a list of - INetContentTypeParameters (the attributes are in US-ASCII encoding and - converted to lower case, the values are in Unicode encoding). If - null, only the syntax of the parameters is checked, but they are not - returned. - - @return True if the syntax of the field body is correct. If false is - returned, none of the output parameters will be modified! - */ - static bool parse(ByteString const & rMediaType, ByteString & rType, - ByteString & rSubType, - INetContentTypeParameterList * pParameters = 0); - - /** Parse the body of an RFC 2045 Content-Type header field. - - @param rMediaType The body of the Content-Type header field. It must - be of the form - - token "/" token *(";" token "=" (token / quoted-string)) - - with intervening linear white space and comments (cf. RFCs 822, 2045). - The RFC 2231 extension are supported. The encoding of rMediaType - should be US-ASCII, but any Unicode values in the range U+0080..U+FFFF - are interpretet 'as appropriate.' - - @param rType Returns the type (the first of the above tokens), in US- - ASCII encoding and converted to lower case. - - @param rSubType Returns the sub type (the second of the above - tokens), in US-ASCII encoding and converted to lower case. - - @param rParameters If not null, returns the parameters as a list of - INetContentTypeParameters (the attributes are in US-ASCII encoding and - converted to lower case, the values are in Unicode encoding). If - null, only the syntax of the parameters is checked, but they are not - returned. - - @return True if the syntax of the field body is correct. If false is - returned, none of the output parameters will be modified! - */ - static bool parse(UniString const & rMediaType, UniString & rType, - UniString & rSubType, - INetContentTypeParameterList * pParameters = 0); - - /** Append a parameter to the string representation of a MIME media type. - - @param rMediaType The string representation of a MIME media type. - - @param rAttribute The name of the parameter. Must be a valid RFC - 2045 token. - - @param rValue The value of the paramter. Must only consist of US- - ASCII characters. - - @return The string representation of rMediaType with the new - parameter appended. It is not checked whether a parameter with that - name already existed in rMediaType. - */ - static ByteString appendUSASCIIParameter(ByteString const & rMediaType, - ByteString const & rAttribute, - ByteString const & rValue); - - /** Append a parameter to the string representation of a MIME media type. - - @param rMediaType The string representation of a MIME media type. - - @param rAttribute The name of the parameter. Must be a valid RFC - 2045 token. - - @param rValue The value of the paramter. Must only consist of US- - ASCII characters. - - @return The string representation of rMediaType with the new - parameter appended. It is not checked whether a parameter with that - name already existed in rMediaType. - */ - static UniString appendUSASCIIParameter(UniString const & rMediaType, - UniString const & rAttribute, - UniString const & rValue); -}; - -#endif // _INETTYPE_HXX - diff --git a/svtools/inc/svtools/intitem.hxx b/svtools/inc/svtools/intitem.hxx deleted file mode 100644 index fe2a3543e630..000000000000 --- a/svtools/inc/svtools/intitem.hxx +++ /dev/null @@ -1,176 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: intitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SFXINTITEM_HXX -#define _SFXINTITEM_HXX - -#include "svtools/svtdllapi.h" -#include - -//============================================================================ -class SVT_DLLPUBLIC SfxByteItem: public CntByteItem -{ -public: - TYPEINFO(); - - SfxByteItem(USHORT which = 0, BYTE nValue = 0): - CntByteItem(which, nValue) {} - - SfxByteItem(USHORT which, SvStream & rStream): - CntByteItem(which, rStream) {} - - virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const; - - virtual SfxPoolItem * Clone(SfxItemPool * = 0) const - { return new SfxByteItem(*this); } -}; - -//============================================================================ -DBG_NAMEEX_VISIBILITY(SfxInt16Item, SVT_DLLPUBLIC) - -class SVT_DLLPUBLIC SfxInt16Item: public SfxPoolItem -{ - INT16 m_nValue; - -public: - TYPEINFO(); - - SfxInt16Item(USHORT which = 0, INT16 nTheValue = 0): - SfxPoolItem(which), m_nValue(nTheValue) - { DBG_CTOR(SfxInt16Item, 0); } - - SfxInt16Item(USHORT nWhich, SvStream & rStream); - - SfxInt16Item(const SfxInt16Item & rItem): - SfxPoolItem(rItem), m_nValue(rItem.m_nValue) - { DBG_CTOR(SfxInt16Item, 0); } - - virtual ~SfxInt16Item() { DBG_DTOR(SfxInt16Item, 0); } - - virtual int operator ==(const SfxPoolItem & rItem) const; - - using SfxPoolItem::Compare; - virtual int Compare(const SfxPoolItem & rWith) const; - - virtual SfxItemPresentation GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, - XubString & rText, - const IntlWrapper * = 0) - const; - - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; - - virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); - - virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const; - - virtual SvStream & Store(SvStream & rStream, USHORT) const; - - virtual SfxPoolItem * Clone(SfxItemPool * = 0) const; - - virtual INT16 GetMin() const; - - virtual INT16 GetMax() const; - - virtual SfxFieldUnit GetUnit() const; - - INT16 GetValue() const { return m_nValue; } - - inline void SetValue(INT16 nTheValue); -}; - -inline void SfxInt16Item::SetValue(INT16 nTheValue) -{ - DBG_ASSERT(GetRefCount() == 0, "SfxInt16Item::SetValue(); Pooled item"); - m_nValue = nTheValue; -} - -//============================================================================ -class SVT_DLLPUBLIC SfxUInt16Item: public CntUInt16Item -{ -public: - TYPEINFO(); - - SfxUInt16Item(USHORT which = 0, UINT16 nValue = 0): - CntUInt16Item(which, nValue) {} - - SfxUInt16Item(USHORT which, SvStream & rStream): - CntUInt16Item(which, rStream) {} - - virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const - { return new SfxUInt16Item(Which(), rStream); } - - virtual SfxPoolItem * Clone(SfxItemPool * = 0) const - { return new SfxUInt16Item(*this); } -}; - -//============================================================================ -class SVT_DLLPUBLIC SfxInt32Item: public CntInt32Item -{ -public: - TYPEINFO(); - - SfxInt32Item(USHORT which = 0, INT32 nValue = 0): - CntInt32Item(which, nValue) {} - - SfxInt32Item(USHORT which, SvStream & rStream): - CntInt32Item(which, rStream) {} - - virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const - { return new SfxInt32Item(Which(), rStream); } - - virtual SfxPoolItem * Clone(SfxItemPool * = 0) const - { return new SfxInt32Item(*this); } - -}; - -//============================================================================ -class SVT_DLLPUBLIC SfxUInt32Item: public CntUInt32Item -{ -public: - TYPEINFO(); - - SfxUInt32Item(USHORT which = 0, UINT32 nValue = 0): - CntUInt32Item(which, nValue) {} - - SfxUInt32Item(USHORT which, SvStream & rStream): - CntUInt32Item(which, rStream) {} - - virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const - { return new SfxUInt32Item(Which(), rStream); } - - virtual SfxPoolItem * Clone(SfxItemPool * = 0) const - { return new SfxUInt32Item(*this); } -}; - -#endif // _SFXINTITEM_HXX - diff --git a/svtools/inc/svtools/isethint.hxx b/svtools/inc/svtools/isethint.hxx deleted file mode 100644 index d30fc4a65b27..000000000000 --- a/svtools/inc/svtools/isethint.hxx +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: isethint.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFXISETHINT_HXX -#define _SFXISETHINT_HXX - -#include "svtools/svldllapi.h" - -#ifndef _HINT_HXX -#include -#endif - -class SfxItemSet; - -//-------------------------------------------------------------------- - -class SVL_DLLPUBLIC SfxItemSetHint: public SfxHint -{ - SfxItemSet* _pItemSet; - -public: - TYPEINFO(); - - SfxItemSetHint( SfxItemSet *pItemSet ); - SfxItemSetHint( const SfxItemSet &rItemSet ); - virtual ~SfxItemSetHint(); - - const SfxItemSet& GetItemSet() const { return *_pItemSet; } -}; - -#endif - diff --git a/svtools/inc/svtools/itemiter.hxx b/svtools/inc/svtools/itemiter.hxx deleted file mode 100644 index 6a9b5e212720..000000000000 --- a/svtools/inc/svtools/itemiter.hxx +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: itemiter.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFXITEMITER_HXX -#define _SFXITEMITER_HXX - -#include "svtools/svldllapi.h" -#include -#include - -class SfxPoolItem; -class SfxItemSet; -class SfxItemPool; - -class SVL_DLLPUBLIC SfxItemIter -{ - // Item-Feld - Start & Ende - const SfxItemSet& _rSet; - USHORT _nStt, _nEnd, _nAkt; - -public: - SfxItemIter( const SfxItemSet& rSet ); - ~SfxItemIter(); - - // falls es diese gibt, returne sie, sonst 0 - const SfxPoolItem* FirstItem() - { _nAkt = _nStt; - return _rSet._nCount ? *(_rSet._aItems+_nAkt) : 0; } - const SfxPoolItem* LastItem() - { _nAkt = _nEnd; - return _rSet._nCount ? *(_rSet._aItems+_nAkt) : 0; } - const SfxPoolItem* GetCurItem() - { return _rSet._nCount ? *(_rSet._aItems+_nAkt) : 0; } - const SfxPoolItem* NextItem(); - const SfxPoolItem* PrevItem(); - - BOOL IsAtStart() const { return _nAkt == _nStt; } - BOOL IsAtEnd() const { return _nAkt == _nEnd; } - - USHORT GetCurPos() const { return _nAkt; } - USHORT GetFirstPos() const { return _nStt; } - USHORT GetLastPos() const { return _nEnd; } -}; - -#endif diff --git a/svtools/inc/svtools/itempool.hxx b/svtools/inc/svtools/itempool.hxx deleted file mode 100644 index 81407cee2d0c..000000000000 --- a/svtools/inc/svtools/itempool.hxx +++ /dev/null @@ -1,306 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: itempool.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SFXITEMPOOL_HXX -#define _SFXITEMPOOL_HXX - -#include "svtools/svldllapi.h" - -#ifndef INCLUDED_LIMITS_H -#include -#define INCLUDED_LIMITS_H -#endif -#include -#include -#include -#include -#include - -class SvStream; -class SfxBroadcaster; -struct SfxItemPool_Impl; - -#define SFX_WHICH_MAX 4999 - -DBG_NAMEEX(SfxItemPool) - -//==================================================================== - -#define SFX_ITEM_POOLABLE 0x0001 -#define SFX_ITEM_NOT_POOLABLE 0x0002 - -#define SFX_ITEM_USERFLAG0 0x0100 -#define SFX_ITEM_USERFLAG1 0x0200 -#define SFX_ITEM_USERFLAG2 0x0400 -#define SFX_ITEM_USERFLAG3 0x0800 -#define SFX_ITEM_USERFLAG4 0x1000 -#define SFX_ITEM_USERFLAG5 0x2000 -#define SFX_ITEM_USERFLAG6 0x4000 -#define SFX_ITEM_USERFLAG7 0x8000 -#define SFX_ITEM_USERFLAG8 0x0010 -#define SFX_ITEM_USERFLAG9 0x0020 -#define SFX_ITEM_USERFLAGA 0x0040 -#define SFX_ITEM_USERFLAGB 0x0080 - -//==================================================================== - -struct SfxItemInfo -{ - USHORT _nSID; - USHORT _nFlags; -}; - -//==================================================================== - -class SfxStyleSheetIterator; -struct SfxPoolItemArray_Impl; -class SfxItemPool; - -class SVL_DLLPUBLIC SfxItemPoolUser -{ -public: - virtual void ObjectInDestruction(const SfxItemPool& rSfxItemPool) = 0; -}; - -typedef ::std::vector< SfxItemPoolUser* > SfxItemPoolUserVector; - -class SVL_DLLPUBLIC SfxItemPool - -/* [Beschreibung] - - Die von dieser Klasse abgeleiteten Klassen dienen der Bereitstellung von - Defaults von SfxPoolItems und halten konkrete (konstante) Instanzen, die - dann von mehreren Stellen (i.d.R. eines Dokuments) referenziert werden - k�nnen. - - Dadurch ist jeder Wert nur einmalig gespeichert, was zu wenig Konstruktor - und Destruktor-Aufrufen f�hrt, Vergleiche zwischen Items eines Dokuments - beschleunigt und ein einfaches Laden und Speichern von Attributen - bereitstellt. -*/ - -{ - SVL_DLLPRIVATE void readTheItems(SvStream & rStream, USHORT nCount, USHORT nVersion, - SfxPoolItem * pDefItem, SfxPoolItemArray_Impl ** pArr); - - UniString aName; - USHORT nStart, nEnd; - USHORT _nFileFormatVersion; -#ifdef TF_POOLABLE - const SfxItemInfo* pItemInfos; -#else - USHORT* pSlotIds; -#endif - SfxItemPool_Impl* pImp; - SfxPoolItem** ppStaticDefaults; - SfxPoolItem** ppPoolDefaults; - SfxItemPool* pSecondary; - SfxItemPool* pMaster; - USHORT* _pPoolRanges; - FASTBOOL bPersistentRefCounts; - -private: - // ObjectUser section - SfxItemPoolUserVector maSfxItemPoolUsers; - -public: - void AddSfxItemPoolUser(SfxItemPoolUser& rNewUser); - void RemoveSfxItemPoolUser(SfxItemPoolUser& rOldUser); - - //--------------------------------------------------------------------- -#ifndef _SFXITEMS_HXX - -friend class SfxPoolWhichMap; - -private: - inline USHORT GetIndex_Impl(USHORT nWhich) const; - inline USHORT GetSize_Impl() const { return nEnd - nStart + 1; } - - SVL_DLLPRIVATE SvStream& Load1_Impl( SvStream &rStream ); - SVL_DLLPRIVATE FASTBOOL IsItemFlag_Impl( USHORT nWhich, USHORT nFlag ) const; - -public: - // fuer dflt. SfxItemSet::CTOR, setze dflt. WhichRanges - void FillItemIdRanges_Impl( USHORT*& pWhichRanges ) const; - const USHORT* GetFrozenIdRanges() const - { return _pPoolRanges; } - FASTBOOL IsVer2_Impl() const; - -#endif - //--------------------------------------------------------------------- - -protected: - static inline void SetRefCount( SfxPoolItem& rItem, ULONG n ); - static inline ULONG AddRef( const SfxPoolItem& rItem, ULONG n = 1 ); - static inline ULONG ReleaseRef( const SfxPoolItem& rItem, ULONG n = 1); - -public: - SfxItemPool( const SfxItemPool &rPool, - BOOL bCloneStaticDefaults = FALSE ); - SfxItemPool( const UniString &rName, - USHORT nStart, USHORT nEnd, -#ifdef TF_POOLABLE - const SfxItemInfo *pItemInfos, -#endif - SfxPoolItem **pDefaults = 0, -#ifndef TF_POOLABLE - USHORT *pSlotIds = 0, -#endif - FASTBOOL bLoadRefCounts = TRUE ); -protected: - virtual ~SfxItemPool(); -public: - static void Free(SfxItemPool* pPool); - - SfxBroadcaster& BC(); - - void SetPoolDefaultItem( const SfxPoolItem& ); - const SfxPoolItem* GetPoolDefaultItem( USHORT nWhich ) const; - void ResetPoolDefaultItem( USHORT nWhich ); - - void SetDefaults( SfxPoolItem **pDefaults ); - void ReleaseDefaults( BOOL bDelete = FALSE ); - static void ReleaseDefaults( SfxPoolItem **pDefaults, USHORT nCount, BOOL bDelete = FALSE ); - - virtual SfxMapUnit GetMetric( USHORT nWhich ) const; - void SetDefaultMetric( SfxMapUnit eNewMetric ); - virtual SfxItemPresentation GetPresentation( const SfxPoolItem& rItem, - SfxItemPresentation ePresentation, - SfxMapUnit ePresentationMetric, - XubString& rText, - const IntlWrapper * pIntlWrapper - = 0 ) const; - virtual SfxItemPool* Clone() const; - UniString const & GetName() const { return aName; } - - virtual const SfxPoolItem& Put( const SfxPoolItem&, USHORT nWhich = 0 ); - virtual void Remove( const SfxPoolItem& ); - virtual const SfxPoolItem& GetDefaultItem( USHORT nWhich ) const; - - const SfxPoolItem* LoadItem( SvStream &rStream, - FASTBOOL bDirect = FALSE, - const SfxItemPool *pRefPool = 0 ); - FASTBOOL StoreItem( SvStream &rStream, - const SfxPoolItem &rItem, - FASTBOOL bDirect = FALSE ) const; - - USHORT GetSurrogate(const SfxPoolItem *) const; - const SfxPoolItem * GetItem(USHORT nWhich, USHORT nSurrogate) const; - USHORT GetItemCount(USHORT nWhich) const; - const SfxPoolItem* LoadSurrogate(SvStream& rStream, - USHORT &rWhich, USHORT nSlotId, - const SfxItemPool* pRefPool = 0 ); - FASTBOOL StoreSurrogate(SvStream& rStream, - const SfxPoolItem *pItem ) const; - - virtual SvStream & Load(SvStream &); - virtual SvStream & Store(SvStream &) const; - int HasPersistentRefCounts() const { - return bPersistentRefCounts; } - void LoadCompleted(); - - USHORT GetFirstWhich() const { return nStart; } - USHORT GetLastWhich() const { return nEnd; } - FASTBOOL IsInRange( USHORT nWhich ) const { - return nWhich >= nStart && - nWhich <= nEnd; } - FASTBOOL IsInVersionsRange( USHORT nWhich ) const; - FASTBOOL IsInStoringRange( USHORT nWhich ) const; - void SetStoringRange( USHORT nFrom, USHORT nTo ); - void SetSecondaryPool( SfxItemPool *pPool ); - SfxItemPool* GetSecondaryPool() const { - return pSecondary; } - SfxItemPool* GetMasterPool() const { - return pMaster; } - void FreezeIdRanges(); - - void Cleanup(); - void Delete(); - -#ifdef TF_POOLABLE - FASTBOOL IsItemFlag( USHORT nWhich, USHORT nFlag ) const; - FASTBOOL IsItemFlag( const SfxPoolItem &rItem, USHORT nFlag ) const - { return IsItemFlag( rItem.Which(), nFlag ); } - void SetItemInfos( const SfxItemInfo *pInfos ) - { pItemInfos = pInfos; } -#else - int HasMap() const { return 0 != pSlotIds; } - void SetMap( USHORT *pNewSlotIds ) - { pSlotIds = pNewSlotIds; } -#endif - USHORT GetWhich( USHORT nSlot, BOOL bDeep = TRUE ) const; - USHORT GetSlotId( USHORT nWhich, BOOL bDeep = TRUE ) const; - USHORT GetTrueWhich( USHORT nSlot, BOOL bDeep = TRUE ) const; - USHORT GetTrueSlotId( USHORT nWhich, BOOL bDeep = TRUE ) const; - - void SetVersionMap( USHORT nVer, - USHORT nOldStart, USHORT nOldEnd, - USHORT *pWhichIdTab ); - USHORT GetNewWhich( USHORT nOldWhich ) const; - USHORT GetVersion() const; - USHORT GetFileFormatVersion() const - { return _nFileFormatVersion; } - void SetFileFormatVersion( USHORT nFileFormatVersion ); - USHORT GetLoadingVersion() const; - FASTBOOL IsCurrentVersionLoading() const; - - static int IsWhich(USHORT nId) { - return nId && nId <= SFX_WHICH_MAX; } - static int IsSlot(USHORT nId) { - return nId && nId > SFX_WHICH_MAX; } - - static const SfxItemPool* GetStoringPool(); - static void SetStoringPool( const SfxItemPool * ); - -private: - const SfxItemPool& operator=(const SfxItemPool &); // n.i.!! -}; - -// --------------- Inline Implementierungen ------------------------------ - -// nur der Pool darf den Referenz-Zaehler manipulieren !!! -inline void SfxItemPool::SetRefCount( SfxPoolItem& rItem, ULONG n ) -{ - rItem.SetRefCount(n); -} - -// nur der Pool darf den Referenz-Zaehler manipulieren !!! -inline ULONG SfxItemPool::AddRef( const SfxPoolItem& rItem, ULONG n ) -{ - return rItem.AddRef(n); -} - -// nur der Pool darf den Referenz-Zaehler manipulieren !!! -inline ULONG SfxItemPool::ReleaseRef( const SfxPoolItem& rItem, ULONG n ) -{ - return rItem.ReleaseRef(n); -} - -#endif diff --git a/svtools/inc/svtools/itemprop.hxx b/svtools/inc/svtools/itemprop.hxx deleted file mode 100644 index feab0eab004b..000000000000 --- a/svtools/inc/svtools/itemprop.hxx +++ /dev/null @@ -1,222 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: itemprop.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFX_ITEMPROP_HXX -#define _SFX_ITEMPROP_HXX - -#include "svtools/svldllapi.h" -#include -#include -#include -#include -#include -#include -#include -#include -/* -----------------------------21.02.00 11:03-------------------------------- - UNO III - Implementation - ---------------------------------------------------------------------------*/ -#define MAP_CHAR_LEN(cchar) cchar, sizeof(cchar) - 1 - -struct SfxItemPropertyMapEntry -{ - const char* pName; - USHORT nNameLen; - USHORT nWID; - const com::sun::star::uno::Type* pType; - long nFlags; - BYTE nMemberId; - -}; - -struct SfxItemPropertySimpleEntry -{ - USHORT nWID; - const com::sun::star::uno::Type* pType; - long nFlags; - BYTE nMemberId; - - SfxItemPropertySimpleEntry() : - nWID( 0 ), - pType( 0 ), - nFlags( 0 ), - nMemberId( 0 ){} - - SfxItemPropertySimpleEntry(USHORT _nWID, const com::sun::star::uno::Type* _pType, - long _nFlags, BYTE _nMemberId) : - nWID( _nWID ), - pType( _pType ), - nFlags( _nFlags ), - nMemberId( _nMemberId ){} - - SfxItemPropertySimpleEntry( const SfxItemPropertyMapEntry* pMapEntry ) : - nWID( pMapEntry->nWID ), - pType( pMapEntry->pType ), - nFlags( pMapEntry->nFlags ), - nMemberId( pMapEntry->nMemberId ){} - -}; -struct SfxItemPropertyNamedEntry : public SfxItemPropertySimpleEntry -{ - ::rtl::OUString sName; - SfxItemPropertyNamedEntry( const String& rName, const SfxItemPropertySimpleEntry& rSimpleEntry) : - SfxItemPropertySimpleEntry( rSimpleEntry ), - sName( rName ){} - -}; -typedef std::vector< SfxItemPropertyNamedEntry > PropertyEntryVector_t; -class SfxItemPropertyMap_Impl; -class SVL_DLLPUBLIC SfxItemPropertyMap -{ - SfxItemPropertyMap_Impl* m_pImpl; -public: - SfxItemPropertyMap( const SfxItemPropertyMapEntry* pEntries ); - SfxItemPropertyMap( const SfxItemPropertyMap* pSource ); - ~SfxItemPropertyMap(); - - const SfxItemPropertySimpleEntry* getByName( const ::rtl::OUString &rName ) const; - com::sun::star::uno::Sequence< com::sun::star::beans::Property > getProperties() const; - com::sun::star::beans::Property getPropertyByName( const ::rtl::OUString rName ) const - throw( ::com::sun::star::beans::UnknownPropertyException ); - sal_Bool hasPropertyByName( const ::rtl::OUString& rName ) const; - - void mergeProperties( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& rPropSeq ); - PropertyEntryVector_t getPropertyEntries() const; - sal_uInt32 getSize() const; - -}; -/* -----------------------------21.02.00 11:19-------------------------------- - - ---------------------------------------------------------------------------*/ -class SVL_DLLPUBLIC SfxItemPropertySet -{ - SfxItemPropertyMap m_aMap; - mutable com::sun::star::uno::Reference m_xInfo; -protected: - virtual BOOL FillItem(SfxItemSet& rSet, USHORT nWhich, BOOL bGetProperty) const; - -public: - SfxItemPropertySet( const SfxItemPropertyMapEntry *pMap ) : - m_aMap(pMap) {} - virtual ~SfxItemPropertySet(); - - void getPropertyValue( const SfxItemPropertySimpleEntry& rEntry, - const SfxItemSet& rSet, - com::sun::star::uno::Any& rAny) const - throw(::com::sun::star::uno::RuntimeException); - void getPropertyValue( const ::rtl::OUString &rName, - const SfxItemSet& rSet, - com::sun::star::uno::Any& rAny) const - throw(::com::sun::star::uno::RuntimeException, - ::com::sun::star::beans::UnknownPropertyException); - com::sun::star::uno::Any - getPropertyValue( const ::rtl::OUString &rName, - const SfxItemSet& rSet ) const - throw(::com::sun::star::uno::RuntimeException, - ::com::sun::star::beans::UnknownPropertyException); - void setPropertyValue( const SfxItemPropertySimpleEntry& rEntry, - const com::sun::star::uno::Any& aVal, - SfxItemSet& rSet ) const - throw(::com::sun::star::uno::RuntimeException, - com::sun::star::lang::IllegalArgumentException); - void setPropertyValue( const ::rtl::OUString& rPropertyName, - const com::sun::star::uno::Any& aVal, - SfxItemSet& rSet ) const - throw(::com::sun::star::uno::RuntimeException, - com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::beans::UnknownPropertyException); - - com::sun::star::beans::PropertyState - getPropertyState(const ::rtl::OUString& rName, const SfxItemSet& rSet)const - throw(com::sun::star::beans::UnknownPropertyException); - com::sun::star::beans::PropertyState - getPropertyState(const SfxItemPropertySimpleEntry& rEntry, const SfxItemSet& rSet) const - throw(); - - com::sun::star::uno::Reference - getPropertySetInfo() const; - const SfxItemPropertyMap* - getPropertyMap() const {return &m_aMap;} - -}; -/* -----------------------------21.02.00 11:09-------------------------------- - - ---------------------------------------------------------------------------*/ -struct SfxItemPropertySetInfo_Impl; -class SVL_DLLPUBLIC SfxItemPropertySetInfo : public - cppu::WeakImplHelper1 -{ - SfxItemPropertySetInfo_Impl* m_pImpl; - -public: - SfxItemPropertySetInfo(const SfxItemPropertyMap *pMap ); - SfxItemPropertySetInfo(const SfxItemPropertyMapEntry *pEntries ); - virtual ~SfxItemPropertySetInfo(); - - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL - getProperties( ) - throw(::com::sun::star::uno::RuntimeException); - - virtual ::com::sun::star::beans::Property SAL_CALL - getPropertyByName( const ::rtl::OUString& aName ) - throw(::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::uno::RuntimeException); - - virtual sal_Bool SAL_CALL - hasPropertyByName( const ::rtl::OUString& Name ) - throw(::com::sun::star::uno::RuntimeException); - - const SfxItemPropertyMap* getMap() const; -}; -/* -----------------------------21.02.00 12:01-------------------------------- - - ---------------------------------------------------------------------------*/ -class SVL_DLLPUBLIC SfxExtItemPropertySetInfo: public cppu::WeakImplHelper1 -{ - SfxItemPropertyMap aExtMap; -public: - SfxExtItemPropertySetInfo( - const SfxItemPropertyMapEntry *pMap, - const com::sun::star::uno::Sequence& rPropSeq ); - virtual ~SfxExtItemPropertySetInfo(); - - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL - getProperties( ) - throw(::com::sun::star::uno::RuntimeException); - - virtual ::com::sun::star::beans::Property SAL_CALL - getPropertyByName( const ::rtl::OUString& aName ) - throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - - virtual sal_Bool SAL_CALL - hasPropertyByName( const ::rtl::OUString& Name ) - throw(::com::sun::star::uno::RuntimeException); -}; - -#endif diff --git a/svtools/inc/svtools/itemset.hxx b/svtools/inc/svtools/itemset.hxx deleted file mode 100644 index 4cc3edcf65c7..000000000000 --- a/svtools/inc/svtools/itemset.hxx +++ /dev/null @@ -1,216 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: itemset.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFXITEMSET_HXX -#define _SFXITEMSET_HXX - -#include "svtools/svldllapi.h" - -#if STLPORT_VERSION<321 -#include -#else -#include // std::va_list and friends -#endif -#include -#include -#include - -class SfxItemPool; -class SfxPoolItem; -class SvStream; - -typedef SfxPoolItem const** SfxItemArray; - -#define USHORT_ARG int - -#ifdef MI_HATS_REPARIERT -#ifndef DBG -#ifdef DBG_UTILx -#define DBG(s) s -#define _pChildCount(THIS) ( *(USHORT**)SfxPointerServer::GetServer()->GetPointer(THIS) ) -#define _pChildCountCtor ( (*(USHORT**)SfxPointerServer::GetServer()->CreatePointer(this)) = new USHORT ) -#define _pChildCountDtor ( SfxPointerServer::GetServer()->ReleasePointer(this) ) -#else -#define DBG(s) -#endif -#endif -#else -#ifdef DBG -#undef DBG -#endif -#define DBG(s) -#endif - -//======================================================================== - -#define SFX_ITEMSET_GET( rSet, pItem, ItemType, nSlotId, bDeep ) \ - const ItemType *pItem = (const ItemType*) \ - (rSet).GetItem( nSlotId, bDeep, TYPE(ItemType) ) - -//======================================================================== - -class SVL_DLLPUBLIC SfxItemSet -{ - friend class SfxItemIter; - - SfxItemPool* _pPool; // der verwendete Pool - const SfxItemSet* _pParent; // Ableitung - SfxItemArray _aItems; // Item-Feld - USHORT* _pWhichRanges; // Array von Which-Bereichen - USHORT _nCount; // Anzahl Items - - //--------------------------------------------------------------------- -#ifndef _SFXITEMS_HXX - -friend class SfxItemPoolCache; -friend class SfxAllItemSet; -friend const char *DbgCheckItemSet( const void* ); - -private: - SVL_DLLPRIVATE void InitRanges_Impl(const USHORT *nWhichPairTable); - SVL_DLLPRIVATE void InitRanges_Impl(va_list pWhich, USHORT n1, USHORT n2, USHORT n3); - SVL_DLLPRIVATE void InitRanges_Impl(USHORT nWh1, USHORT nWh2); - -public: - SfxItemArray GetItems_Impl() const { return _aItems; } - -#endif - //--------------------------------------------------------------------- - -private: - const SfxItemSet& operator=(const SfxItemSet &); // n.i.!! - -protected: - // Notification-Callback - virtual void Changed( const SfxPoolItem& rOld, const SfxPoolItem& rNew ); - - // direkte Put-Methode - int PutDirect(const SfxPoolItem &rItem); - -public: - SfxItemSet( const SfxItemSet& ); - - SfxItemSet( SfxItemPool&, BOOL bTotalPoolRanges = FALSE ); - SfxItemSet( SfxItemPool&, USHORT nWhich1, USHORT nWhich2 ); - SfxItemSet( SfxItemPool&, USHORT_ARG nWh1, USHORT_ARG nWh2, USHORT_ARG nNull, ... ); - SfxItemSet( SfxItemPool&, const USHORT* nWhichPairTable ); - virtual ~SfxItemSet(); - - virtual SfxItemSet * Clone(BOOL bItems = TRUE, SfxItemPool *pToPool = 0) const; - - // Items erfragen - USHORT Count() const { return _nCount; } - USHORT TotalCount() const; - - virtual const SfxPoolItem& Get( USHORT nWhich, BOOL bSrchInParent = TRUE ) const; - const SfxPoolItem* GetItem( USHORT nWhich, BOOL bSrchInParent = TRUE, - TypeId aItemType = 0 ) const; - - // Which-Wert des Items an der Position nPos erfragen - USHORT GetWhichByPos(USHORT nPos) const; - - // Item-Status erfragen - SfxItemState GetItemState( USHORT nWhich, - BOOL bSrchInParent = TRUE, - const SfxPoolItem **ppItem = 0 ) const; - - virtual void DisableItem(USHORT nWhich); - virtual void InvalidateItem( USHORT nWhich ); - virtual USHORT ClearItem( USHORT nWhich = 0); - virtual void ClearInvalidItems( BOOL bHardDefault = FALSE ); - void InvalidateAllItems(); HACK(via nWhich = 0) - - inline void SetParent( const SfxItemSet* pNew ); - - // Items hinzufuegen, loeschen etc. - virtual const SfxPoolItem* Put( const SfxPoolItem&, USHORT nWhich ); - const SfxPoolItem* Put( const SfxPoolItem& rItem ) - { return Put(rItem, rItem.Which()); } - virtual int Put( const SfxItemSet&, - BOOL bInvalidAsDefault = TRUE ); - void PutExtended( const SfxItemSet&, - SfxItemState eDontCareAs = SFX_ITEM_UNKNOWN, - SfxItemState eDefaultAs = SFX_ITEM_UNKNOWN ); - - virtual int Set( const SfxItemSet&, BOOL bDeep = TRUE ); - - virtual void Intersect( const SfxItemSet& rSet ); - virtual void MergeValues( const SfxItemSet& rSet, BOOL bOverwriteDefaults = FALSE ); - virtual void Differentiate( const SfxItemSet& rSet ); - virtual void MergeValue( const SfxPoolItem& rItem, BOOL bOverwriteDefaults = FALSE ); - - SfxItemPool* GetPool() const { return _pPool; } - const USHORT* GetRanges() const { return _pWhichRanges; } - void SetRanges( const USHORT *pRanges ); - void MergeRange( USHORT nFrom, USHORT nTo ); - const SfxItemSet* GetParent() const { return _pParent; } - - virtual SvStream & Load( SvStream &, FASTBOOL bDirect = FALSE, - const SfxItemPool *pRefPool = 0 ); - virtual SvStream & Store( SvStream &, FASTBOOL bDirect = FALSE ) const; - - virtual int operator==(const SfxItemSet &) const; -}; - -// --------------- Inline Implementierungen ------------------------ - -inline void SfxItemSet::SetParent( const SfxItemSet* pNew ) -{ - DBG( if (_pParent) --*_pChildCount(_pParent) ); - _pParent = pNew; - DBG( if (_pParent) ++*_pChildCount(_pParent) ); -} - -//======================================================================== - -class SVL_DLLPUBLIC SfxAllItemSet: public SfxItemSet - -/* versteht alle Ranges; werden durch das Putten der Items - automatisch angepasst -*/ - -{ - SfxVoidItem aDefault; - USHORT nFree; - -public: - SfxAllItemSet( SfxItemPool &rPool ); - SfxAllItemSet( const SfxItemSet & ); - SfxAllItemSet( const SfxAllItemSet & ); - - virtual SfxItemSet * Clone( BOOL bItems = TRUE, SfxItemPool *pToPool = 0 ) const; - virtual const SfxPoolItem* Put( const SfxPoolItem&, USHORT nWhich ); - const SfxPoolItem* Put( const SfxPoolItem& rItem ) - { return Put(rItem, rItem.Which()); } - virtual int Put( const SfxItemSet&, - BOOL bInvalidAsDefault = TRUE ); -}; - -#endif // #ifndef _SFXITEMSET_HXX - diff --git a/svtools/inc/svtools/languageoptions.hxx b/svtools/inc/svtools/languageoptions.hxx deleted file mode 100644 index ed247ac01fa3..000000000000 --- a/svtools/inc/svtools/languageoptions.hxx +++ /dev/null @@ -1,131 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: languageoptions.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVTOOLS_LANGUAGEOPTIONS_HXX -#define _SVTOOLS_LANGUAGEOPTIONS_HXX - -#include "svtools/svtdllapi.h" -#include -#include -#include -#include -#include - -// class SvtLanguageOptions ---------------------------------------------------- - -// these defines can be ored -#define SCRIPTTYPE_LATIN 0x01 -#define SCRIPTTYPE_ASIAN 0x02 -#define SCRIPTTYPE_COMPLEX 0x04 - -class SvtCJKOptions; -class SvtCTLOptions; - -class SVT_DLLPUBLIC SvtLanguageOptions : public SfxBroadcaster, public SfxListener -{ -private: - SvtCJKOptions* m_pCJKOptions; - SvtCTLOptions* m_pCTLOptions; - -public: - enum EOption - { - // cjk options - E_CJKFONT, - E_VERTICALTEXT, - E_ASIANTYPOGRAPHY, - E_JAPANESEFIND, - E_RUBY, - E_CHANGECASEMAP, - E_DOUBLELINES, - E_EMPHASISMARKS, - E_VERTICALCALLOUT, - E_ALLCJK, - // ctl options - E_CTLFONT, - E_CTLSEQUENCECHECKING, - E_CTLCURSORMOVEMENT, - E_CTLTEXTNUMERALS - }; - - // bDontLoad is for referencing purposes only - SvtLanguageOptions( sal_Bool _bDontLoad = sal_False ); - ~SvtLanguageOptions(); - - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - - // CJK options - sal_Bool IsCJKFontEnabled() const; - sal_Bool IsVerticalTextEnabled() const; - sal_Bool IsAsianTypographyEnabled() const; - sal_Bool IsJapaneseFindEnabled() const; - sal_Bool IsRubyEnabled() const; - sal_Bool IsChangeCaseMapEnabled() const; - sal_Bool IsDoubleLinesEnabled() const; - sal_Bool IsEmphasisMarksEnabled() const; - sal_Bool IsVerticalCallOutEnabled() const; - void SetAll( sal_Bool _bSet ); - sal_Bool IsAnyEnabled() const; - - // CTL options - void SetCTLFontEnabled( sal_Bool _bEnabled ); - sal_Bool IsCTLFontEnabled() const; - - void SetCTLSequenceChecking( sal_Bool _bEnabled ); - sal_Bool IsCTLSequenceChecking() const; - - void SetCTLSequenceCheckingRestricted( sal_Bool _bEnable ); - sal_Bool IsCTLSequenceCheckingRestricted( void ) const; - - void SetCTLSequenceCheckingTypeAndReplace( sal_Bool _bEnable ); - sal_Bool IsCTLSequenceCheckingTypeAndReplace() const; - - sal_Bool IsReadOnly(EOption eOption) const; - - // returns for a language the scripttype - static sal_uInt16 GetScriptTypeOfLanguage( sal_uInt16 nLang ); -}; -/** #i42730# Gives access to the Windows 16bit system locale - */ -class SVT_DLLPUBLIC SvtSystemLanguageOptions : public utl::ConfigItem -{ -private: - ::rtl::OUString m_sWin16SystemLocale; - -public: - SvtSystemLanguageOptions(); - ~SvtSystemLanguageOptions(); - - virtual void Commit(); - - LanguageType GetWin16SystemLanguage(); -}; - -#endif // _SVTOOLS_LANGUAGEOPTIONS_HXX - diff --git a/svtools/inc/svtools/lckbitem.hxx b/svtools/inc/svtools/lckbitem.hxx deleted file mode 100644 index b21e91a3fd46..000000000000 --- a/svtools/inc/svtools/lckbitem.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: lckbitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _LCKBITEM_HXX -#define _LCKBITEM_HXX - -#include "svtools/svldllapi.h" -#include -#include -#include -#include - -// ----------------------------------------------------------------------- - -class SVL_DLLPUBLIC SfxLockBytesItem : public SfxPoolItem -{ - SvLockBytesRef _xVal; - -public: - TYPEINFO(); - SfxLockBytesItem(); - SfxLockBytesItem( USHORT nWhich, - SvLockBytes *pLockBytes ); - SfxLockBytesItem( USHORT nWhich, SvStream & ); - SfxLockBytesItem( const SfxLockBytesItem& ); - ~SfxLockBytesItem(); - - virtual int operator==( const SfxPoolItem& ) const; - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT nItemVersion) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const; - - SvLockBytes* GetValue() const { return _xVal; } - - virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; -}; - -#endif - diff --git a/svtools/inc/svtools/lockfilecommon.hxx b/svtools/inc/svtools/lockfilecommon.hxx deleted file mode 100644 index c8bd6251f9cb..000000000000 --- a/svtools/inc/svtools/lockfilecommon.hxx +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: documentlockfile.hxx,v $ - * - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVT_LOCKFILECOMMON_HXX -#define _SVT_LOCKFILECOMMON_HXX - -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -#define LOCKFILE_OOOUSERNAME_ID 0 -#define LOCKFILE_SYSUSERNAME_ID 1 -#define LOCKFILE_LOCALHOST_ID 2 -#define LOCKFILE_EDITTIME_ID 3 -#define LOCKFILE_USERURL_ID 4 -#define LOCKFILE_ENTRYSIZE 5 - -namespace svt { - -// This is a general implementation that is used in document lock file implementation and in sharing control file implementation -class SVT_DLLPUBLIC LockFileCommon -{ -protected: - ::osl::Mutex m_aMutex; - - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; - ::rtl::OUString m_aURL; - - - INetURLObject ResolveLinks( const INetURLObject& aDocURL ); - -public: - LockFileCommon( const ::rtl::OUString& aOrigURL, const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory, const ::rtl::OUString& aPrefix ); - ~LockFileCommon(); - - static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > ParseList( const ::com::sun::star::uno::Sequence< sal_Int8 >& aBuffer ); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > ParseEntry( const ::com::sun::star::uno::Sequence< sal_Int8 >& aBuffer, sal_Int32& o_nCurPos ); - static ::rtl::OUString ParseName( const ::com::sun::star::uno::Sequence< sal_Int8 >& aBuffer, sal_Int32& o_nCurPos ); - static ::rtl::OUString EscapeCharacters( const ::rtl::OUString& aSource ); - static ::rtl::OUString GetOOOUserName(); - static ::rtl::OUString GetCurrentLocalTime(); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > GenerateOwnEntry(); -}; - -} - -#endif - diff --git a/svtools/inc/svtools/lstner.hxx b/svtools/inc/svtools/lstner.hxx deleted file mode 100644 index 99a6e10701f5..000000000000 --- a/svtools/inc/svtools/lstner.hxx +++ /dev/null @@ -1,81 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: lstner.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFXLSTNER_HXX -#define _SFXLSTNER_HXX - -#include "svtools/svldllapi.h" -#include -#include - -class SfxBroadcaster; -class SfxHint; - -#ifndef _SFX_LSTNER_CXX -typedef SvPtrarr SfxBroadcasterArr_Impl; -#endif - -#define SFX_NOTIFY( rBC, rBCT, rHint, rHintT ) \ - Notify( rBC, rHint ) - -//------------------------------------------------------------------------- - -class SVL_DLLPUBLIC SfxListener -{ - SfxBroadcasterArr_Impl aBCs; - -private: - const SfxListener& operator=(const SfxListener &); // n.i., ist verboten - -public: - TYPEINFO(); - - SfxListener(); - SfxListener( const SfxListener &rCopy ); - virtual ~SfxListener(); - - BOOL StartListening( SfxBroadcaster& rBroadcaster, BOOL bPreventDups = FALSE ); - BOOL EndListening( SfxBroadcaster& rBroadcaster, BOOL bAllDups = FALSE ); - void EndListening( USHORT nNo ); - void EndListeningAll(); - BOOL IsListening( SfxBroadcaster& rBroadcaster ) const; - - USHORT GetBroadcasterCount() const - { return aBCs.Count(); } - SfxBroadcaster* GetBroadcasterJOE( USHORT nNo ) const - { return (SfxBroadcaster*) aBCs.GetObject(nNo); } - - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - -#ifndef _NOTIFY_HXX - void RemoveBroadcaster_Impl( SfxBroadcaster& rBC ); -#endif -}; - -#endif diff --git a/svtools/inc/svtools/macitem.hxx b/svtools/inc/svtools/macitem.hxx deleted file mode 100644 index 2e43120f653d..000000000000 --- a/svtools/inc/svtools/macitem.hxx +++ /dev/null @@ -1,212 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: macitem.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFXMACITEM_HXX -#define _SFXMACITEM_HXX - -// class SvxMacroItem ---------------------------------------------------- - -#include "svtools/svtdllapi.h" -#include -#include -#include -#include - -#ifndef _TABLE_HXX -#include -#endif - -class SvStream; - -#define SVX_MACRO_LANGUAGE_JAVASCRIPT "JavaScript" -#define SVX_MACRO_LANGUAGE_STARBASIC "StarBasic" -#define SVX_MACRO_LANGUAGE_SF "Script" - -DBG_NAMEEX(SvxMacroItem) - -// ----------------------------------------------------------------------- - -//Ein Macro - -enum ScriptType -{ - STARBASIC, - JAVASCRIPT, - EXTENDED_STYPE -}; - -// Basisklasse fuer SjJSbxObject mit virtuellem Destruktor -class SjJSbxObjectBase -{ -public: - virtual ~SjJSbxObjectBase(); - virtual SjJSbxObjectBase* Clone( void ); - //virtual SjJSbxObjectBase& operator=( const SjJSbxObjectBase& rBase ); -}; - -class SjJSbxObject; - -class SVT_DLLPUBLIC SvxMacro -{ - String aMacName; - String aLibName; - // Fuer JavaScript muss ein Function-Objekt gehalten werden - SjJSbxObjectBase* pFunctionObject; - ScriptType eType; - -public: - - SvxMacro( const String &rMacName, const String &rLanguage); - - SvxMacro( const String &rMacName, const String &rLibName, - ScriptType eType); // = STARBASIC entfernt - - SvxMacro( SjJSbxObjectBase* _pFunctionObject, const String &rSource ); - ~SvxMacro(); // noetig fuer pFunctionObject - - const String &GetLibName() const { return aLibName; } - const String &GetMacName() const { return aMacName; } - String GetLanguage()const; - - ScriptType GetScriptType() const { return eType; } - - BOOL HasMacro() const { return aMacName.Len() ? TRUE : FALSE; } - -#ifdef SOLAR_JAVA - // JavaScript-Function-Objekt holen - // ACHTUNG: Implementation in SJ, Source/JScript/sjimpl.cxx - SjJSbxObjectBase* GetFunctionObject( SjJSbxObject* pParent ); -#endif - - SvxMacro& operator=( const SvxMacro& rBase ); -}; - -inline SvxMacro::SvxMacro( const String &rMacName, const String &rLibName, - ScriptType eTyp ) - : aMacName( rMacName ), aLibName( rLibName ), pFunctionObject(NULL), eType( eTyp ) -{} - -inline SvxMacro::SvxMacro( SjJSbxObjectBase* _pFunctionObject, const String &rSource ) - : aMacName( rSource ), pFunctionObject( _pFunctionObject ), eType( JAVASCRIPT ) -{} - -//Macro Table, zerstoert die Pointer im DTor! - -DECLARE_TABLE( _SvxMacroTableDtor, SvxMacro* ) - -#define SVX_MACROTBL_VERSION31 0 -#define SVX_MACROTBL_VERSION40 1 - -#define SVX_MACROTBL_AKTVERSION SVX_MACROTBL_VERSION40 - -class SVT_DLLPUBLIC SvxMacroTableDtor : public _SvxMacroTableDtor -{ -public: - inline SvxMacroTableDtor( const USHORT nInitSz = 0, const USHORT nReSz = 1 ); - inline SvxMacroTableDtor( const SvxMacroTableDtor &rCpy ) : _SvxMacroTableDtor() { *this = rCpy; } - inline ~SvxMacroTableDtor() { DelDtor(); } - SvxMacroTableDtor& operator=( const SvxMacroTableDtor &rCpy ); - - // loescht alle Eintraege - void DelDtor(); - - SvStream& Read( SvStream &, USHORT nVersion = SVX_MACROTBL_AKTVERSION ); - SvStream& Write( SvStream & ) const; - - USHORT GetVersion() const { return SVX_MACROTBL_AKTVERSION; } -}; - -inline SvxMacroTableDtor::SvxMacroTableDtor( const USHORT nInitSz, - const USHORT nReSz) - : _SvxMacroTableDtor( nInitSz, nReSz ) -{} - -/* -[Beschreibung] -Dieses Item beschreibt eine Makro-Tabelle. -*/ - -class SVT_DLLPUBLIC SvxMacroItem: public SfxPoolItem -{ -public: - TYPEINFO(); - - inline SvxMacroItem ( const USHORT nId /*= ITEMID_MACRO*/ ); - - // "pure virtual Methoden" vom SfxPoolItem - virtual int operator==( const SfxPoolItem& ) const; - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper * = 0 ) const; - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const; - virtual USHORT GetVersion( USHORT nFileFormatVersion ) const; - - inline const SvxMacroTableDtor& GetMacroTable() const { return aMacroTable;} - inline void SetMacroTable( const SvxMacroTableDtor& rTbl ) { aMacroTable = rTbl; } - - inline const SvxMacro& GetMacro( USHORT nEvent ) const; - inline BOOL HasMacro( USHORT nEvent ) const; - void SetMacro( USHORT nEvent, const SvxMacro& ); - inline BOOL DelMacro( USHORT nEvent ); - -private: - SvxMacroTableDtor aMacroTable; - - inline SvxMacroItem( const SvxMacroItem& ); - SvxMacroItem &operator=( const SvxMacroItem & ); -}; - -inline SvxMacroItem::SvxMacroItem( const USHORT nId ) - : SfxPoolItem( nId ) -{} -inline SvxMacroItem::SvxMacroItem( const SvxMacroItem &rCpy ) - : SfxPoolItem( rCpy ), - aMacroTable( rCpy.GetMacroTable() ) -{} - -inline BOOL SvxMacroItem::HasMacro( USHORT nEvent ) const -{ - return aMacroTable.IsKeyValid( nEvent ); -} -inline const SvxMacro& SvxMacroItem::GetMacro( USHORT nEvent ) const -{ - return *(aMacroTable.Get(nEvent)); -} -inline BOOL SvxMacroItem::DelMacro( USHORT nEvent ) -{ - SvxMacro *pMacro = aMacroTable.Remove( nEvent ); - delete pMacro; - return ( pMacro != 0 ); -} - -#endif diff --git a/svtools/inc/svtools/metitem.hxx b/svtools/inc/svtools/metitem.hxx deleted file mode 100644 index a37d119d57c1..000000000000 --- a/svtools/inc/svtools/metitem.hxx +++ /dev/null @@ -1,56 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: metitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFXMETRICITEM_HXX -#define _SFXMETRICITEM_HXX - -#include "svtools/svtdllapi.h" -#include - -DBG_NAMEEX_VISIBILITY(SfxMetricItem, SVT_DLLPUBLIC) - -// ----------------------------------------------------------------------- - -class SVT_DLLPUBLIC SfxMetricItem: public SfxInt32Item -{ -public: - TYPEINFO(); - SfxMetricItem( USHORT nWhich = 0, UINT32 nValue = 0 ); - SfxMetricItem( USHORT nWhich, SvStream & ); - SfxMetricItem( const SfxMetricItem& ); - ~SfxMetricItem() { - DBG_DTOR(SfxMetricItem, 0); } - - virtual int ScaleMetrics( long lMult, long lDiv ); - virtual int HasMetrics() const; - -}; - -#endif - diff --git a/svtools/inc/svtools/nfkeytab.hxx b/svtools/inc/svtools/nfkeytab.hxx deleted file mode 100644 index ba8c24f319f6..000000000000 --- a/svtools/inc/svtools/nfkeytab.hxx +++ /dev/null @@ -1,120 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: nfkeytab.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_SVTOOLS_NFKEYTAB_HXX -#define INCLUDED_SVTOOLS_NFKEYTAB_HXX - -#include - -//! For ImpSvNumberformatScan: first the short symbols, then the long symbols! -//! e.g. first TT then TTTT -//! The internal order is essentially for the format code string scanner! -//! New keywords MUST NOT be inserted, only the NF_KEY_UNUSEDn may be used, -//! NF_KEY_LASTKEYWORD must be adjusted accordingly. Otherwise old versions -//! will fail upon reading these entries. Nevertheless, old versions are NOT -//! able to display those new keywords => blank display. -// -// Note: 2005-09-02: the above applies to the binary file format. -// -// ER 15.12.99: This table is externally only to be used with method -// String SvNumberformat::GetMappedFormatstring( const NfKeywordTable&, const LocaleDataWrapper& ); -// and method -// void SvNumberFormatter::FillKeywordTable( NfKeywordTable&, LanguageType ); -enum NfKeywordIndex -{ - NF_KEY_NONE = 0, - NF_KEY_E, // exponential symbol - NF_KEY_AMPM, // AM/PM - NF_KEY_AP, // a/p - NF_KEY_MI, // minute (!) - NF_KEY_MMI, // minute 02 (!) - NF_KEY_M, // month (!) - NF_KEY_MM, // month 02 (!) - NF_KEY_MMM, // month short name - NF_KEY_MMMM, // month long name - NF_KEY_H, // hour - NF_KEY_HH, // hour 02 - NF_KEY_S, // second - NF_KEY_SS, // second 02 - NF_KEY_Q, // quarter - NF_KEY_QQ, // quarter 02 - NF_KEY_D, // day of month - NF_KEY_DD, // day of month 02 - NF_KEY_DDD, // day of week short - NF_KEY_DDDD, // day of week long - NF_KEY_YY, // year two digits - NF_KEY_YYYY, // year four digits - NF_KEY_NN, // day of week short - NF_KEY_NNNN, // day of week long with separator - NF_KEY_CCC, // currency bank symbol (old version) - NF_KEY_GENERAL, // General / Standard - NF_KEY_LASTOLDKEYWORD = NF_KEY_GENERAL, - NF_KEY_NNN, // day of week long without separator, as of version 6, 10.10.97 - NF_KEY_WW, // week of year, as of version 8, 19.06.98 - NF_KEY_MMMMM, // first letter of month name - NF_KEY_LASTKEYWORD = NF_KEY_MMMMM, - NF_KEY_UNUSED4, - NF_KEY_QUARTER, // was quarter word, not used anymore from SRC631 on (26.04.01) - NF_KEY_TRUE, // boolean true - NF_KEY_FALSE, // boolean false - NF_KEY_BOOLEAN, // boolean - NF_KEY_COLOR, // color - NF_KEY_FIRSTCOLOR, - NF_KEY_BLACK = NF_KEY_FIRSTCOLOR, // you do know colors, don't you? - NF_KEY_BLUE, - NF_KEY_GREEN, - NF_KEY_CYAN, - NF_KEY_RED, - NF_KEY_MAGENTA, - NF_KEY_BROWN, - NF_KEY_GREY, - NF_KEY_YELLOW, - NF_KEY_WHITE, - NF_KEY_LASTCOLOR = NF_KEY_WHITE, - NF_KEY_LASTKEYWORD_SO5 = NF_KEY_LASTCOLOR, - //! Keys from here on can't be saved in SO5 file format and MUST be - //! converted to string which means losing any information. - NF_KEY_AAA, // abbreviated day name from Japanese Xcl, same as DDD or NN English - NF_KEY_AAAA, // full day name from Japanese Xcl, same as DDDD or NNN English - NF_KEY_EC, // E non-gregorian calendar year without preceding 0 - NF_KEY_EEC, // EE non-gregorian calendar year with preceding 0 (two digit) - NF_KEY_G, // abbreviated era name, latin characters M T S or H for Gengou calendar - NF_KEY_GG, // abbreviated era name - NF_KEY_GGG, // full era name - NF_KEY_R, // acts as EE (Xcl) => GR==GEE, GGR==GGEE, GGGR==GGGEE - NF_KEY_RR, // acts as GGGEE (Xcl) - NF_KEY_THAI_T, // Thai T modifier, speciality of Thai Excel, only used with Thai locale and converted to [NatNum1] - NF_KEYWORD_ENTRIES_COUNT -}; - -typedef String NfKeywordTable [NF_KEYWORD_ENTRIES_COUNT]; - -#endif // INCLUDED_SVTOOLS_NFKEYTAB_HXX - diff --git a/svtools/inc/svtools/nfversi.hxx b/svtools/inc/svtools/nfversi.hxx deleted file mode 100644 index 23375369ddb3..000000000000 --- a/svtools/inc/svtools/nfversi.hxx +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: nfversi.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef NF_NFVERSI_HXX -#define NF_NFVERSI_HXX - -// file ID's - -#define SV_NUMBERFORMATTER_VERSION_SYSTORE 0x0004 -#define SV_NUMBERFORMATTER_VERSION_KEYWORDS 0x0005 -#define SV_NUMBERFORMATTER_VERSION_NEWSTANDARD 0x0006 -#define SV_NUMBERFORMATTER_VERSION_NF_TIME_HH_MMSS00 0x0007 -#define SV_NUMBERFORMATTER_VERSION_NF_DATE_WW 0x0008 -#define SV_NUMBERFORMATTER_VERSION_NEW_CURR 0x0009 -#define SV_NUMBERFORMATTER_VERSION_YEAR2000 0x000a -#define SV_NUMBERFORMATTER_VERSION_TWODIGITYEAR 0x000b -#define SV_NUMBERFORMATTER_VERSION_NF_DATETIME_SYS_DDMMYYYY_HHMMSS 0x000c -#define SV_NUMBERFORMATTER_VERSION_CALENDAR 0x000d -#define SV_NUMBERFORMATTER_VERSION_ADDITIONAL_I18N_FORMATS 0x000e - -#define SV_NUMBERFORMATTER_VERSION 0x000e - -// 1 bis 18.01.96 -// 2 ab 19.01.96, TT.MM.JJJJ dazu -// 3 ab 13.02.96 (nicht emergency) #.##0,00 CCC dazu -// 4 ab 30.07.97 364i speichern, was SYSTEM wirklich war (vorhandenes -// Dummy-Feld wird benutzt, keine File-Format Aenderung) -// 5 ab 07.08.97 nicht-deutsch ist nicht immer englisch -// aeltere nicht-deutsche benutzerdefinierte Formate onLoad -// konvertieren -// 6 ab 17.10.97 neu: Keyword NNN fuer langen Wochentag ohne Separator, -// wird in aelteren Versionen nicht ausgewertet! -// Neue Standard Datumformate, DIN etc. -// 7 ab 25.05.98 StandardFormat [HH]:MM:SS,00 (NF_TIME_HH_MMSS00) fuer -// automatische Eingabe-Erkennung von 100stel Sekunden mit Stunden -// 8 ab 19.06.98 StandardFormat WW (NF_DATE_WW) fuer Kalenderwoche -// 9 ab 17.12.98 neue Waehrungsformate [$DM-xxx] -// A ab 25.01.99 Year2000 speichern/laden -// B ab 12.02.99 Year2000 ist allgemeines TwoDigitYearStart -// C ??.??.?? date/time format of system variables -// D 23.11.00 new calendar -// E 19.01.01 additional formats provided by i18n - -#endif - diff --git a/svtools/inc/svtools/nranges.hxx b/svtools/inc/svtools/nranges.hxx deleted file mode 100644 index 6996669cdeb1..000000000000 --- a/svtools/inc/svtools/nranges.hxx +++ /dev/null @@ -1,97 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: nranges.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifdef MACOSX -// We need an empty block in here. Otherwise, if the #ifndef _SFXNRANGES_HXX -// line is the first line, the Mac OS X version of the gcc preprocessor will -// incorrectly optimize the inclusion process and will never include this file -// a second time -#endif - -#ifndef _SFXNRANGES_HXX - -#ifndef NUMTYPE - -#define NUMTYPE USHORT -#define SfxNumRanges SfxUShortRanges -#include - -#undef NUMTYPE -#define NUMTYPE ULONG -#define SfxNumRanges SfxULongRanges -#include - -#define _SFXNRANGES_HXX - -#else -#include - -//======================================================================== - -#define NUMTYPE_ARG int - -class SfxNumRanges -{ - NUMTYPE* _pRanges; // 0-terminated array of NUMTYPE-pairs - -public: - SfxNumRanges() : _pRanges( 0 ) {} - SfxNumRanges( const SfxNumRanges &rOrig ); - SfxNumRanges( NUMTYPE nWhich1, NUMTYPE nWhich2 ); - SfxNumRanges( NUMTYPE_ARG nWh1, NUMTYPE_ARG nWh2, NUMTYPE_ARG nNull, ... ); - SfxNumRanges( const NUMTYPE* nNumTable ); - ~SfxNumRanges() - { delete [] _pRanges; } - - BOOL operator == ( const SfxNumRanges & ) const; - BOOL operator != ( const SfxNumRanges & rRanges ) const - { return !( *this == rRanges ); } - - SfxNumRanges& operator = ( const SfxNumRanges & ); - - SfxNumRanges& operator += ( const SfxNumRanges & ); - SfxNumRanges& operator -= ( const SfxNumRanges & ); - SfxNumRanges& operator /= ( const SfxNumRanges & ); - - NUMTYPE Count() const; - BOOL IsEmpty() const - { return !_pRanges || 0 == *_pRanges; } - BOOL Contains( NUMTYPE n ) const; - BOOL Intersects( const SfxNumRanges & ) const; - - operator const NUMTYPE* () const - { return _pRanges; } -}; - -#undef NUMTYPE -#undef SfxNumRanges - -#endif - -#endif diff --git a/svtools/inc/svtools/ondemand.hxx b/svtools/inc/svtools/ondemand.hxx deleted file mode 100644 index e8361307eb9e..000000000000 --- a/svtools/inc/svtools/ondemand.hxx +++ /dev/null @@ -1,468 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ondemand.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_SVTOOLS_ONDEMAND_HXX -#define INCLUDED_SVTOOLS_ONDEMAND_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - On demand instanciation and initialization of several i18n wrappers, - helping the number formatter to not perform worse than it already does. - */ - -/** @short - Switch between LANGUAGE_SYSTEM and LANGUAGE_ENGLISH_US and any other - LocaleDataWrapper. - SvNumberformatter uses it upon switching locales. - - @descr - Avoids reloading and analysing of locale data again and again. - - @ATTENTION - If the default ctor is used the init() method MUST be called before - accessing any locale data. The passed parameters Locale and LanguageType - must match each other. - */ - -class OnDemandLocaleDataWrapper -{ - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr; - SvtSysLocale aSysLocale; - LanguageType eCurrentLanguage; - LanguageType eLastAnyLanguage; - const LocaleDataWrapper* pSystem; - const LocaleDataWrapper* pEnglish; - LocaleDataWrapper* pAny; - const LocaleDataWrapper* pCurrent; - bool bInitialized; - -public: - OnDemandLocaleDataWrapper() - : eLastAnyLanguage( LANGUAGE_DONTKNOW ) - , pEnglish(0) - , pAny(0) - , bInitialized(false) - { - pCurrent = pSystem = aSysLocale.GetLocaleDataPtr(); - eCurrentLanguage = LANGUAGE_SYSTEM; - } - OnDemandLocaleDataWrapper( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, - ::com::sun::star::lang::Locale& rLocale, - LanguageType eLang - ) - : pEnglish(0) - , pAny(0) - , pCurrent(0) - , bInitialized(false) - { - pSystem = aSysLocale.GetLocaleDataPtr(); - init( rxSMgr, rLocale, eLang ); - } - ~OnDemandLocaleDataWrapper() - { - delete pEnglish; - delete pAny; - } - - bool isInitialized() const { return bInitialized; } - - bool is() const { return pCurrent != NULL; } - - void init( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, - ::com::sun::star::lang::Locale& rLocale, - LanguageType eLang - ) - { - xSMgr = rxSMgr; - changeLocale( rLocale, eLang ); - bInitialized = true; - } - - void changeLocale( ::com::sun::star::lang::Locale& rLocale, LanguageType eLang ) - { - switch ( eLang ) - { - case LANGUAGE_SYSTEM : - pCurrent = pSystem; - break; - case LANGUAGE_ENGLISH_US : - if ( !pEnglish ) - pEnglish = new LocaleDataWrapper( xSMgr, rLocale ); - pCurrent = pEnglish; - break; - default: - if ( !pAny ) - { - pAny = new LocaleDataWrapper( xSMgr, rLocale ); - eLastAnyLanguage = eLang; - } - else if ( eLastAnyLanguage != eLang ) - { - pAny->setLocale( rLocale ); - eLastAnyLanguage = eLang; - } - pCurrent = pAny; - } - eCurrentLanguage = eLang; - } - - LanguageType getCurrentLanguage() const - { return eCurrentLanguage; } - - LocaleDataWrapper* getAnyLocale() - { - if ( !pAny ) - { - pAny = new LocaleDataWrapper( xSMgr, pCurrent->getLocale() ); - eLastAnyLanguage = eCurrentLanguage; - } - else if ( pCurrent != pAny ) - { - pAny->setLocale( pCurrent->getLocale() ); - eLastAnyLanguage = eCurrentLanguage; - } - return pAny; - } - - const LocaleDataWrapper* get() const { return pCurrent; } - const LocaleDataWrapper* operator->() const { return get(); } - const LocaleDataWrapper& operator*() const { return *get(); } -}; - -/** Load a calendar only if it's needed. - SvNumberformatter uses it upon switching locales. - @ATTENTION If the default ctor is used the init() method MUST be called - before accessing the calendar. - */ -class OnDemandCalendarWrapper -{ - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr; - ::com::sun::star::lang::Locale aLocale; - mutable CalendarWrapper* pPtr; - mutable bool bValid; - bool bInitialized; - -public: - OnDemandCalendarWrapper() - : pPtr(0) - , bValid(false) - , bInitialized(false) - {} - OnDemandCalendarWrapper( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, - ::com::sun::star::lang::Locale& rLocale - ) - : bValid(false) - , bInitialized(false) - { - init( rxSMgr, rLocale ); - } - ~OnDemandCalendarWrapper() - { - delete pPtr; - } - - bool isInitialized() const { return bInitialized; } - - bool is() const { return pPtr != NULL; } - - void init( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, - ::com::sun::star::lang::Locale& rLocale - ) - { - xSMgr = rxSMgr; - changeLocale( rLocale ); - if ( pPtr ) - { - delete pPtr; - pPtr = NULL; - } - bInitialized = true; - } - - void changeLocale( ::com::sun::star::lang::Locale& rLocale ) - { - bValid = false; - aLocale = rLocale; - } - - CalendarWrapper* get() const - { - if ( !bValid ) - { - if ( !pPtr ) - pPtr = new CalendarWrapper( xSMgr ); - pPtr->loadDefaultCalendar( aLocale ); - bValid = true; - } - return pPtr; - } - - CalendarWrapper* operator->() { return get(); } - CalendarWrapper& operator*() { return *get(); } -}; - -/** Load a collator only if it's needed. - SvNumberformatter uses it upon switching locales. - @ATTENTION If the default ctor is used the init() method MUST be called - before accessing the collator. - */ -class OnDemandCollatorWrapper -{ - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr; - ::com::sun::star::lang::Locale aLocale; - mutable CollatorWrapper* pPtr; - mutable bool bValid; - bool bInitialized; - -public: - OnDemandCollatorWrapper() - : pPtr(0) - , bValid(false) - , bInitialized(false) - {} - OnDemandCollatorWrapper( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, - ::com::sun::star::lang::Locale& rLocale - ) - : bValid(false) - , bInitialized(false) - { - init( rxSMgr, rLocale ); - } - ~OnDemandCollatorWrapper() - { - delete pPtr; - } - - bool isInitialized() const { return bInitialized; } - - bool is() const { return pPtr != NULL; } - - void init( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, - ::com::sun::star::lang::Locale& rLocale - ) - { - xSMgr = rxSMgr; - changeLocale( rLocale ); - if ( pPtr ) - { - delete pPtr; - pPtr = NULL; - } - bInitialized = true; - } - - void changeLocale( ::com::sun::star::lang::Locale& rLocale ) - { - bValid = false; - aLocale = rLocale; - } - - const CollatorWrapper* get() const - { - if ( !bValid ) - { - if ( !pPtr ) - pPtr = new CollatorWrapper( xSMgr ); - pPtr->loadDefaultCollator( aLocale, ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE ); - bValid = true; - } - return pPtr; - } - - const CollatorWrapper* operator->() const { return get(); } - const CollatorWrapper& operator*() const { return *get(); } -}; - -/** Load a transliteration only if it's needed. - SvNumberformatter uses it upon switching locales. - @ATTENTION If the default ctor is used the init() method MUST be called - before accessing the transliteration. - */ -class OnDemandTransliterationWrapper -{ - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr; - LanguageType eLanguage; - ::com::sun::star::i18n::TransliterationModules nType; - mutable ::utl::TransliterationWrapper* pPtr; - mutable bool bValid; - bool bInitialized; - -public: - OnDemandTransliterationWrapper() - : eLanguage( LANGUAGE_SYSTEM ) - , pPtr(0) - , bValid(false) - , bInitialized(false) - {} - OnDemandTransliterationWrapper( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, - LanguageType eLang, - ::com::sun::star::i18n::TransliterationModules nTypeP - ) - : bValid(false) - , bInitialized(false) - { - init( rxSMgr, eLang, nTypeP ); - } - ~OnDemandTransliterationWrapper() - { - delete pPtr; - } - - bool isInitialized() const { return bInitialized; } - - bool is() const { return pPtr != NULL; } - - void init( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, - LanguageType eLang, - ::com::sun::star::i18n::TransliterationModules nTypeP - ) - { - xSMgr = rxSMgr; - nType = nTypeP; - changeLocale( eLang ); - if ( pPtr ) - { - delete pPtr; - pPtr = NULL; - } - bInitialized = true; - } - - void changeLocale( LanguageType eLang ) - { - bValid = false; - eLanguage = eLang; - } - - const ::utl::TransliterationWrapper* get() const - { - if ( !bValid ) - { - if ( !pPtr ) - pPtr = new ::utl::TransliterationWrapper( xSMgr, nType ); - pPtr->loadModuleIfNeeded( eLanguage ); - bValid = true; - } - return pPtr; - } - - const ::utl::TransliterationWrapper* getForModule( const String& rModule, LanguageType eLang ) const - { - if ( !pPtr ) - pPtr = new ::utl::TransliterationWrapper( xSMgr, nType ); - pPtr->loadModuleByImplName( rModule, eLang ); - bValid = false; // reforce settings change in get() - return pPtr; - } - - const ::utl::TransliterationWrapper* operator->() const { return get(); } - const ::utl::TransliterationWrapper& operator*() const { return *get(); } -}; - -/** Load a native number service wrapper only if it's needed. - SvNumberformatter uses it. - - @ATTENTION - If the default ctor is used the init() method MUST be called - before accessing the native number supplier. - */ -class OnDemandNativeNumberWrapper -{ - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr; - mutable NativeNumberWrapper* pPtr; - bool bInitialized; - -public: - OnDemandNativeNumberWrapper() - : pPtr(0) - , bInitialized(false) - {} - OnDemandNativeNumberWrapper( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr - ) - : pPtr(0) - , bInitialized(false) - { - init( rxSMgr ); - } - ~OnDemandNativeNumberWrapper() - { - delete pPtr; - } - - bool isInitialized() const { return bInitialized; } - - void init( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr - ) - { - xSMgr = rxSMgr; - if ( pPtr ) - { - delete pPtr; - pPtr = NULL; - } - bInitialized = true; - } - - bool is() const { return pPtr != NULL; } - - NativeNumberWrapper* get() const - { - if ( !pPtr ) - pPtr = new NativeNumberWrapper( xSMgr ); - return pPtr; - } - - NativeNumberWrapper* operator->() { return get(); } - NativeNumberWrapper& operator*() { return *get(); } -}; - -#endif // INCLUDED_SVTOOLS_ONDEMAND_HXX - diff --git a/svtools/inc/svtools/ownlist.hxx b/svtools/inc/svtools/ownlist.hxx deleted file mode 100644 index 472f50e6ef60..000000000000 --- a/svtools/inc/svtools/ownlist.hxx +++ /dev/null @@ -1,102 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ownlist.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _OWNLIST_HXX -#define _OWNLIST_HXX - -#include "svtools/svtdllapi.h" -#include -#include -#include - -namespace com { namespace sun { namespace star { - namespace beans { - struct PropertyValue; - } -}}} - -//========================================================================= -class SvCommand -/* [Beschreibung] - - Enth"alt einen String, welcher das Kommando angibt und eine weiteren - String, der das Argument des Kommandos bildet. W"urde solch ein - Kommando "uber die Kommandozeile angegeben werden, s"ahe es wie folgt - aus: Kommando = Argument. -*/ -{ - String aCommand; - String aArgument; -public: - SvCommand() {} - SvCommand( const String & rCommand, const String & rArg ) - { - aCommand = rCommand; - aArgument = rArg; - } - const String & GetCommand() const { return aCommand; } - const String & GetArgument() const { return aArgument; } - - friend SvStream& operator >> ( SvStream& rStm, SvCommand & rThis ) - { - rStm.ReadByteString( rThis.aCommand, gsl_getSystemTextEncoding() ); - rStm.ReadByteString( rThis.aArgument, gsl_getSystemTextEncoding() ); - return rStm; - } - friend SvStream& operator << ( SvStream& rStm, const SvCommand & rThis ) - { - rStm.WriteByteString( rThis.aCommand, gsl_getSystemTextEncoding() ); - rStm.WriteByteString( rThis.aArgument, gsl_getSystemTextEncoding() ); - return rStm; - } -}; - -//========================================================================= -class SVT_DLLPUBLIC SvCommandList -/* [Beschreibung] - - Die Liste enth"alt Objekte vom Typ SvCommand. Wird ein Objekt - eingef"ugt, dann wird es kopiert und das neue Objekt wird - in die Liste gestellt. -*/ -{ - PRV_SV_DECL_OWNER_LIST(SvCommandList,SvCommand); - SvCommand & Append( const String & rCommand, const String & rArg ); - BOOL AppendCommands( const String & rCmd, USHORT * pEaten ); - String GetCommands() const; - - BOOL FillFromSequence( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& ); - void FillSequence( com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& ); - - SVT_DLLPUBLIC friend SvStream& operator >> ( SvStream& rStm, SvCommandList & ); - SVT_DLLPUBLIC friend SvStream& operator << ( SvStream&, const SvCommandList & ); -}; - -#endif // _OWNLIST_HXX diff --git a/svtools/inc/svtools/poolitem.hxx b/svtools/inc/svtools/poolitem.hxx deleted file mode 100644 index 7e0fea44b87a..000000000000 --- a/svtools/inc/svtools/poolitem.hxx +++ /dev/null @@ -1,491 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: poolitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFXPOOLITEM_HXX -#define _SFXPOOLITEM_HXX - -#include "svtools/svldllapi.h" -#include - -#define TF_POOLABLE -#include -#include -#include -#include -#include -#include -#include -#include - -typedef long SfxArgumentError; - -class SbxVariable; -class SbxObject; -class SvStream; -class Color; -class IntlWrapper; - -namespace com { namespace sun { namespace star { namespace uno { class Any; } } } } - -#define SFX_ITEMS_DIRECT 0xffff -#define SFX_ITEMS_NULL 0xfff0 // anstelle StoreSurrogate - -#define SFX_ITEMS_POOLDEFAULT 0xffff -#define SFX_ITEMS_STATICDEFAULT 0xfffe -#define SFX_ITEMS_DELETEONIDLE 0xfffd - -#define SFX_ITEMS_OLD_MAXREF 0xffef -#define SFX_ITEMS_MAXREF 0xfffffffe -#define SFX_ITEMS_SPECIAL 0xffffffff - -#define CONVERT_TWIPS 0x80 //Uno-Konvertierung fuer Massangaben (fuer MemberId) - -// ----------------------------------------------------------------------- - -// UNO3 shortcuts - -// warning, if there is no boolean inside the any this will always return the value false -inline sal_Bool Any2Bool( const ::com::sun::star::uno::Any&rValue ) -{ - sal_Bool nValue = sal_False; - if( rValue.hasValue() ) - { - if( rValue.getValueType() == ::getCppuBooleanType() ) - { - nValue = *(sal_Bool*)rValue.getValue(); - } - else - { - sal_Int32 nNum = 0; - if( rValue >>= nNum ) - nValue = nNum != 0; - } - } - - return nValue; -} - -inline ::com::sun::star::uno::Any Bool2Any( sal_Bool bValue ) -{ - return ::com::sun::star::uno::Any( &bValue, ::getCppuBooleanType() ); -} - -// ----------------------------------------------------------------------- - -//! Notloesung!!! -enum SfxFieldUnit -{ - SFX_FUNIT_NONE, SFX_FUNIT_MM, SFX_FUNIT_CM, SFX_FUNIT_M, SFX_FUNIT_KM, - SFX_FUNIT_TWIP, SFX_FUNIT_POINT, SFX_FUNIT_PICA, - SFX_FUNIT_INCH, SFX_FUNIT_FOOT, SFX_FUNIT_MILE, SFX_FUNIT_CUSTOM -}; - -enum SfxMapUnit -{ - SFX_MAPUNIT_100TH_MM, - SFX_MAPUNIT_10TH_MM, - SFX_MAPUNIT_MM, - SFX_MAPUNIT_CM, - SFX_MAPUNIT_1000TH_INCH, - SFX_MAPUNIT_100TH_INCH, - SFX_MAPUNIT_10TH_INCH, - SFX_MAPUNIT_INCH, - SFX_MAPUNIT_POINT, - SFX_MAPUNIT_TWIP, - SFX_MAPUNIT_PIXEL, - SFX_MAPUNIT_SYSFONT, - SFX_MAPUNIT_APPFONT, - SFX_MAPUNIT_RELATIVE, - SFX_MAPUNIT_ABSOLUTE -}; - -// ----------------------------------------------------------------------- - -enum SfxItemPresentation - -/* [Beschreibung] - - Die Werte dieses Enums bezeichnen den Grad der textuellen - Presentation eines Items nach Aufruf der virtuellen Methode - . -*/ - -{ - SFX_ITEM_PRESENTATION_NONE, - SFX_ITEM_PRESENTATION_NAMEONLY, - SFX_ITEM_PRESENTATION_NAMELESS, - SFX_ITEM_PRESENTATION_COMPLETE -}; - -// ----------------------------------------------------------------------- - -typedef USHORT SfxItemState; - -#define SFX_ITEM_UNKNOWN 0x0000 - -#define SFX_ITEM_DISABLED 0x0001 -#define SFX_ITEM_READONLY 0x0002 - -#define SFX_ITEM_DONTCARE 0x0010 -#define SFX_ITEM_DEFAULT 0x0020 -#define SFX_ITEM_SET 0x0030 - -// old stuff - dont use!!! -#define SFX_ITEM_AVAILABLE SFX_ITEM_DEFAULT -#define SFX_ITEM_OFF SFX_ITEM_DEFAULT -#define SFX_ITEM_ON SFX_ITEM_SET - -DBG_NAMEEX_VISIBILITY(SfxPoolItem, SVL_DLLPUBLIC) -DBG_NAMEEX(SfxVoidItem) -DBG_NAMEEX(SfxItemHandle) - -class SvXMLUnitConverter; -class SfxItemPool; -class SfxItemSet; - -class String; -namespace rtl -{ - class OUString; -} - -// ----------------------------------------------------------------------- - -class SVL_DLLPUBLIC SfxPoolItem -{ -friend class SfxItemPool; -friend class SfxItemDesruptor_Impl; -friend class SfxItemPoolCache; -friend class SfxItemSet; -friend class SfxVoidItem; - - ULONG nRefCount; // Referenzzaehler - USHORT nWhich; - USHORT nKind; - -private: - inline void SetRefCount( ULONG n ); - inline void SetKind( USHORT n ); -public: - inline ULONG AddRef( ULONG n = 1 ) const; -private: - inline ULONG ReleaseRef( ULONG n = 1 ) const; - SVL_DLLPRIVATE long Delete_Impl(void*); - -#if 0 - // @@@ virtual, but private, and dummy impl. @@@ - virtual void Store( SvStream & ) const; - virtual void GetVersion() const; -#endif - -protected: - SfxPoolItem( USHORT nWhich = 0 ); - SfxPoolItem( const SfxPoolItem& ); - -public: - TYPEINFO(); - virtual ~SfxPoolItem(); - - void SetWhich( USHORT nId ) { - DBG_CHKTHIS(SfxPoolItem, 0); - nWhich = nId; } - USHORT Which() const { - DBG_CHKTHIS(SfxPoolItem, 0); - return nWhich; } - virtual int operator==( const SfxPoolItem& ) const = 0; - int operator!=( const SfxPoolItem& rItem ) const - { return !(*this == rItem); } - virtual int Compare( const SfxPoolItem &rWith ) const; - virtual int Compare( const SfxPoolItem &rWith, const IntlWrapper& rIntlWrapper ) const; - - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePresentation, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresentationMetric, - XubString &rText, - const IntlWrapper * pIntlWrapper = 0 ) const; - - virtual USHORT GetVersion( USHORT nFileFormatVersion ) const; - virtual int ScaleMetrics( long lMult, long lDiv ); - virtual int HasMetrics() const; - - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; - virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); - - virtual SfxPoolItem* Create( SvStream &, USHORT nItemVersion ) const; - virtual SvStream& Store( SvStream &, USHORT nItemVersion ) const; - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const = 0; - - ULONG GetRefCount() const { return nRefCount; } - inline USHORT GetKind() const { return nKind; } - - /** Read in a Unicode string from a streamed byte string representation. - - @param rStream Some (input) stream. Its Stream/TargetCharSets must - be set to correct values! - - @param rString On success, returns the reconstructed Unicode string. - - @return True if the string was successfuly read and reconstructed. - */ - static bool readByteString(SvStream & rStream, UniString & rString); - - /** Write a byte string representation of a Unicode string into a stream. - - @param rStream Some (output) stream. Its Stream/TargetCharSets must - be set to correct values! - - @param rString Some Unicode string. - */ - static void writeByteString(SvStream & rStream, - UniString const & rString); - - /** Read in a Unicode string from either a streamed Unicode or byte string - representation. - - @param rStream Some (input) stream. If bUnicode is false, its - Stream/TargetCharSets must be set to correct values! - - @param rString On success, returns the reconstructed Unicode string. - - @param bUnicode Whether to read in a stream Unicode (true) or byte - string (false) representation. - - @return True if the string was successfuly read and reconstructed. - */ - static bool readUnicodeString(SvStream & rStream, UniString & rString, - bool bUnicode); - - /** Write a Unicode string representation of a Unicode string into a - stream. - - @param rStream Some (output) stream. - - @param rString Some Unicode string. - */ - static void writeUnicodeString(SvStream & rStream, - UniString const & rString); - -private: - SfxPoolItem& operator=( const SfxPoolItem& ); // n.i.!! -}; - -// ----------------------------------------------------------------------- - -inline void SfxPoolItem::SetRefCount( ULONG n ) -{ - DBG_CHKTHIS( SfxPoolItem, 0 ); - nRefCount = n; - nKind = 0; -} - -inline void SfxPoolItem::SetKind( USHORT n ) -{ - DBG_CHKTHIS( SfxPoolItem, 0 ); - nRefCount = SFX_ITEMS_SPECIAL; - nKind = n; -} - -inline ULONG SfxPoolItem::AddRef( ULONG n ) const -{ - DBG_CHKTHIS( SfxPoolItem, 0 ); - DBG_ASSERT( nRefCount <= SFX_ITEMS_MAXREF, "AddRef mit nicht-Pool-Item" ); - DBG_ASSERT( ULONG_MAX - nRefCount > n, "AddRef: Referenzzaehler ueberschlaegt sich" ); - return ( ((SfxPoolItem *)this)->nRefCount += n ); -} - -inline ULONG SfxPoolItem::ReleaseRef( ULONG n ) const -{ - DBG_CHKTHIS( SfxPoolItem, 0 ); - DBG_ASSERT( nRefCount <= SFX_ITEMS_MAXREF, "AddRef mit nicht-Pool-Item" ); - DBG_ASSERT( nRefCount >= n, "ReleaseRef: Referenzzaehler ueberschlaegt sich" ); - ((SfxPoolItem *)this)->nRefCount -= n; - return nRefCount; -} - -// ----------------------------------------------------------------------- - -inline int IsPoolDefaultItem(const SfxPoolItem *pItem ) -{ - return pItem && pItem->GetKind() == SFX_ITEMS_POOLDEFAULT; -} - -inline int IsStaticDefaultItem(const SfxPoolItem *pItem ) -{ - return pItem && pItem->GetKind() == SFX_ITEMS_STATICDEFAULT; -} - -inline int IsDefaultItem( const SfxPoolItem *pItem ) -{ - return pItem && pItem->GetKind() >= SFX_ITEMS_STATICDEFAULT; -} - -inline int IsPooledItem( const SfxPoolItem *pItem ) -{ - return pItem && pItem->GetRefCount() > 0 && pItem->GetRefCount() <= SFX_ITEMS_MAXREF; -} - -inline int IsInvalidItem(const SfxPoolItem *pItem) -{ - return pItem == (SfxPoolItem *)-1; -} - -// ----------------------------------------------------------------------- - -class SVL_DLLPUBLIC SfxVoidItem: public SfxPoolItem -{ - SfxVoidItem & operator=( const SfxVoidItem& ); // not implemented. -public: - TYPEINFO(); - SfxVoidItem( USHORT nWhich ); - SfxVoidItem( USHORT nWhich, SvStream & ); - SfxVoidItem( const SfxVoidItem& ); - ~SfxVoidItem(); - - virtual int operator==( const SfxPoolItem& ) const; - - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper * = 0 ) const; - - // von sich selbst eine Kopie erzeugen - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - void SetWhich(USHORT nWh) { nWhich = nWh; } -}; - -// ----------------------------------------------------------------------- - -class SVL_DLLPUBLIC SfxSetItem: public SfxPoolItem -{ - SfxItemSet *pSet; - - SfxSetItem & operator=( const SfxSetItem& ); // not implemented. - -public: - TYPEINFO(); - SfxSetItem( USHORT nWhich, SfxItemSet *pSet ); - SfxSetItem( USHORT nWhich, const SfxItemSet &rSet ); - SfxSetItem( const SfxSetItem&, SfxItemPool *pPool = 0 ); - ~SfxSetItem(); - - virtual int operator==( const SfxPoolItem& ) const; - - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper * = 0 ) const; - - // von sich selbst eine Kopie erzeugen - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const = 0; - virtual SfxPoolItem* Create(SvStream &, USHORT nVersion) const = 0; - virtual SvStream& Store(SvStream &, USHORT nVer) const; - - const SfxItemSet& GetItemSet() const - { return *pSet; } - SfxItemSet& GetItemSet() - { return *pSet; } -}; - -// ----------------------------------------------------------------------- - -#if 0 /* @@@ NOT USED @@@ */ -class SfxInvalidItem: public SfxPoolItem -{ -friend class SfxItemSet; - - const SfxPoolItem* pDefaultItem; - -private: - TYPEINFO(); - SfxInvalidItem( USHORT nWhich, const SfxPoolItem &rDefault ); - SfxInvalidItem( const SfxInvalidItem& ); - virtual ~SfxInvalidItem(); - -public: - virtual int operator==( const SfxPoolItem& ) const; - - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper * = 0 ) const; - const SfxPoolItem* GetDefaultItem() const { return pDefaultItem; } - - // von sich selbst eine Kopie erzeugen - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT nVersion) const; - virtual SvStream& Store(SvStream &, USHORT nVer ) const; -}; -#endif /* @@@ NOT USED @@@ */ - -// ----------------------------------------------------------------------- -// Handle Klasse fuer PoolItems - -class SVL_DLLPUBLIC SfxItemHandle -{ - USHORT *pRef; - SfxPoolItem *pItem; -public: - SfxItemHandle( SfxPoolItem& ); - SfxItemHandle( const SfxItemHandle& ); - ~SfxItemHandle(); - - const SfxItemHandle &operator=(const SfxItemHandle &); - const SfxPoolItem &GetItem() const { return *pItem; } -}; - -// ----------------------------------------------------------------------- - -DECL_PTRHINT(SVL_DLLPUBLIC, SfxPoolItemHint, SfxPoolItem); - -// ----------------------------------------------------------------------- - -#if 0 /* @@@ NOT USED @@@ */ -class SfxItemChangedHint: public SfxHint -{ - const SfxPoolItem& _rOld; - const SfxPoolItem& _rNew; - -public: - TYPEINFO(); \ - SfxItemChangedHint( const SfxPoolItem &rOld, - const SfxPoolItem &rNew ) - : _rOld( rOld ), - _rNew( rNew ) - {} - - const SfxPoolItem& GetOldItem() const { return _rOld; } - const SfxPoolItem& GetNewItem() const { return _rNew; } -}; - -#endif /* @@@ NOT USED @@@ */ - -#endif // #ifndef _SFXPOOLITEM_HXX diff --git a/svtools/inc/svtools/ptitem.hxx b/svtools/inc/svtools/ptitem.hxx deleted file mode 100644 index 923ab73da1d5..000000000000 --- a/svtools/inc/svtools/ptitem.hxx +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ptitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFXPTITEM_HXX -#define _SFXPTITEM_HXX - -#include "svtools/svtdllapi.h" -#include -#include - -class SvStream; - -DBG_NAMEEX_VISIBILITY(SfxPointItem, SVT_DLLPUBLIC) - -// ----------------------------------------------------------------------- - -class SVT_DLLPUBLIC SfxPointItem: public SfxPoolItem -{ - Point aVal; - -public: - TYPEINFO(); - SfxPointItem(); - SfxPointItem( USHORT nWhich, const Point& rVal ); - SfxPointItem( USHORT nWhich, SvStream & ); - SfxPointItem( const SfxPointItem& ); - ~SfxPointItem() { - DBG_DTOR(SfxPointItem, 0); } - - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper * = 0 ) const; - - virtual int operator==( const SfxPoolItem& ) const; - - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT nItemVersion) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; - - const Point& GetValue() const { return aVal; } - void SetValue( const Point& rNewVal ) { - DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); - aVal = rNewVal; - } - - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; - virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); -}; - -#endif diff --git a/svtools/inc/svtools/rectitem.hxx b/svtools/inc/svtools/rectitem.hxx deleted file mode 100644 index 39c85d9ab228..000000000000 --- a/svtools/inc/svtools/rectitem.hxx +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: rectitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFXRECTITEM_HXX -#define _SFXRECTITEM_HXX - -#include "svtools/svtdllapi.h" -#include -#include -#include - -class SvStream; - -DBG_NAMEEX_VISIBILITY(SfxRectangleItem, SVT_DLLPUBLIC) - -// ----------------------------------------------------------------------- - -class SVT_DLLPUBLIC SfxRectangleItem: public SfxPoolItem -{ - Rectangle aVal; - -public: - TYPEINFO(); - SfxRectangleItem(); - SfxRectangleItem( USHORT nWhich, const Rectangle& rVal ); - SfxRectangleItem( USHORT nWhich, SvStream & ); - SfxRectangleItem( const SfxRectangleItem& ); - ~SfxRectangleItem() { - DBG_DTOR(SfxRectangleItem, 0); } - - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper * = 0 ) const; - - virtual int operator==( const SfxPoolItem& ) const; - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT nItemVersion) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; - - const Rectangle& GetValue() const { return aVal; } - void SetValue( const Rectangle& rNewVal ) { - DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); - aVal = rNewVal; - } - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; - virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); -}; - -#endif - diff --git a/svtools/inc/svtools/restrictedpaths.hxx b/svtools/inc/svtools/restrictedpaths.hxx deleted file mode 100644 index 218e34cd4556..000000000000 --- a/svtools/inc/svtools/restrictedpaths.hxx +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: restrictedpaths.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SVTOOLS_RESTRICTEDPATHS_HXX -#define SVTOOLS_RESTRICTEDPATHS_HXX - -#include -#include -#include - -#include - -namespace svt -{ - class SVT_DLLPUBLIC RestrictedPaths : public IUrlFilter - { - private: - ::std::vector< String > m_aUnrestrictedURLs; - bool m_bFilterIsEnabled; - - public: - RestrictedPaths(); - virtual ~RestrictedPaths(); - - inline bool hasFilter() const { return !m_aUnrestrictedURLs.empty(); } - inline const ::std::vector< String >& getFilter() const { return m_aUnrestrictedURLs; } - - inline void enableFilter( bool _bEnable ) { m_bFilterIsEnabled = _bEnable; } - inline bool isFilterEnabled() const { return m_bFilterIsEnabled; } - - public: - /** checks URL access permissions - -

with the "restriction" feature we have in the file dialog, it's possible that - only certain URLs can be browsed. This method checks whether a given URL belongs - to this set of permitted URLs.

- -

If no "access restriction" is effective, this method always returns .

- */ - virtual bool isUrlAllowed( const String& _rURL ) const; - - /** checks URL access permissions - -

with the "restriction" feature we have in the file dialog, it's possible that - only certain URLs can be browsed. This method checks whether a given URL belongs - to this set of permitted URLs.

- -

Default behavior allows access to parent folder of a restricted folder (but not to its siblings). - If allowParents is set to parent folders will be treated as forbidden. - -

If no "access restriction" is effective, this method always returns .

- */ - bool isUrlAllowed( const String& _rURL, bool allowParents ) const; - }; - -} // namespace svt - -#endif // SVTOOLS_RESTRICTEDPATHS_HXX diff --git a/svtools/inc/svtools/rngitem.hxx b/svtools/inc/svtools/rngitem.hxx deleted file mode 100644 index 52831f93f71f..000000000000 --- a/svtools/inc/svtools/rngitem.hxx +++ /dev/null @@ -1,117 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: rngitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SFXRNGITEM_HXX - -#ifndef NUMTYPE - -#define NUMTYPE USHORT -#define SfxXRangeItem SfxRangeItem -#define SfxXRangesItem SfxUShortRangesItem -#include -#undef NUMTYPE -#undef SfxXRangeItem -#undef SfxXRangesItem - -#ifndef _SFXITEMS_HXX -#define NUMTYPE ULONG -#define SfxXRangeItem SfxULongRangeItem -#define SfxXRangesItem SfxULongRangesItem -#include -#undef NUMTYPE -#undef SfxXRangeItem -#undef SfxXRangesItem -#endif - -#define _SFXRNGITEM_HXX - -#else -#include "svtools/svtdllapi.h" -#include - -class SvStream; - -// ----------------------------------------------------------------------- - -class SVT_DLLPUBLIC SfxXRangeItem : public SfxPoolItem -{ -private: - NUMTYPE nFrom; - NUMTYPE nTo; -public: - TYPEINFO(); - SfxXRangeItem(); - SfxXRangeItem( USHORT nWID, NUMTYPE nFrom, NUMTYPE nTo ); - SfxXRangeItem( USHORT nWID, SvStream &rStream ); - SfxXRangeItem( const SfxXRangeItem& rItem ); - virtual int operator==( const SfxPoolItem& ) const; - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper * = 0 ) const; - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - inline NUMTYPE& From() { return nFrom; } - inline NUMTYPE From() const { return nFrom; } - inline NUMTYPE& To() { return nTo; } - inline NUMTYPE To() const { return nTo; } - inline BOOL HasRange() const { return nTo>nFrom; } - virtual SfxPoolItem* Create( SvStream &, USHORT nVersion ) const; - virtual SvStream& Store( SvStream &, USHORT nItemVersion ) const; -}; - -// ----------------------------------------------------------------------- - -class SVT_DLLPUBLIC SfxXRangesItem : public SfxPoolItem -{ -private: - NUMTYPE* _pRanges; - -public: - TYPEINFO(); - SfxXRangesItem(); - SfxXRangesItem( USHORT nWID, const NUMTYPE *pRanges ); - SfxXRangesItem( USHORT nWID, SvStream &rStream ); - SfxXRangesItem( const SfxXRangesItem& rItem ); - virtual ~SfxXRangesItem(); - virtual int operator==( const SfxPoolItem& ) const; - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper * = 0 ) const; - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - inline const NUMTYPE* GetRanges() const { return _pRanges; } - virtual SfxPoolItem* Create( SvStream &, USHORT nVersion ) const; - virtual SvStream& Store( SvStream &, USHORT nItemVersion ) const; -}; - -#endif -#endif diff --git a/svtools/inc/svtools/sfontitm.hxx b/svtools/inc/svtools/sfontitm.hxx deleted file mode 100644 index e1394dec91b3..000000000000 --- a/svtools/inc/svtools/sfontitm.hxx +++ /dev/null @@ -1,244 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: sfontitm.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SFONTITM_HXX -#define _SFONTITM_HXX - -#include -#include -#include -#include - -//============================================================================ -class SfxFontItem: public SfxPoolItem -{ - XubString m_aName; - XubString m_aStyleName; - Size m_aSize; - Color m_aColor; - Color m_aFillColor; - rtl_TextEncoding m_nCharSet; - LanguageType m_nLanguage; - sal_Int16 m_nFamily; - sal_Int16 m_nPitch; - sal_Int16 m_nWeight; - sal_Int16 m_nWidthType; - sal_Int16 m_nItalic; - sal_Int16 m_nUnderline; - sal_Int16 m_nStrikeout; - sal_Int16 m_nOrientation; - unsigned m_bWordLine: 1; - unsigned m_bOutline: 1; - unsigned m_bShadow: 1; - unsigned m_bKerning: 1; - unsigned m_bHasFont: 1; - unsigned m_bHasColor: 1; - unsigned m_bHasFillColor: 1; - -public: - TYPEINFO(); - - inline SfxFontItem(USHORT nWhich); - - virtual int operator ==(const SfxPoolItem & rItem) const; - - virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const; - - virtual SvStream & Store(SvStream & rStream, USHORT) const; - - virtual SfxPoolItem * Clone(SfxItemPool * = 0) const - { return new SfxFontItem(*this); } - - sal_Bool hasFont() const { return m_bHasFont; } - - sal_Bool hasColor() const { return m_bHasColor; } - - sal_Bool hasFillColor() const { return m_bHasFillColor; } - - const XubString & getName() const { return m_aName; } - - const XubString & getStyleName() const { return m_aStyleName; } - - const Size & getSize() const { return m_aSize; } - - const Color & getColor() const { return m_aColor; } - - const Color & getFillColor() const { return m_aFillColor; } - - rtl_TextEncoding getCharSet() const { return m_nCharSet; } - - LanguageType getLanguage() const { return m_nLanguage; } - - sal_Int16 getFamily() const { return m_nFamily; } - - sal_Int16 getPitch() const { return m_nPitch; } - - sal_Int16 getWeight() const { return m_nWeight; } - - sal_Int16 getWidthType() const { return m_nWidthType; } - - sal_Int16 getItalic() const { return m_nItalic; } - - sal_Int16 getUnderline() const { return m_nUnderline; } - - sal_Int16 getStrikeout() const { return m_nStrikeout; } - - sal_Int16 getOrientation() const { return m_nOrientation; } - - sal_Bool getWordLine() const { return m_bWordLine; } - - sal_Bool getOutline() const { return m_bOutline; } - - sal_Bool getShadow() const { return m_bShadow; } - - sal_Bool getKerning() const { return m_bKerning; } - - inline void setFont(sal_Int16 nTheFamily, const XubString & rTheName, - const XubString & rTheStyleName, sal_Int16 nThePitch, - rtl_TextEncoding nTheCharSet); - - inline void setWeight(sal_Int16 nTheWeight); - - inline void setItalic(sal_Int16 nTheItalic); - - inline void setHeight(sal_Int32 nHeight); - - inline void setColor(const Color & rTheColor); - - inline void setFillColor(const Color & rTheFillColor); - - inline void setUnderline(sal_Int16 nTheUnderline); - - inline void setStrikeout(sal_Int16 nTheStrikeout); - - inline void setOutline(sal_Bool bTheOutline); - - inline void setShadow(sal_Bool bTheShadow); - - inline void setLanguage(LanguageType nTheLanguage); -}; - -inline SfxFontItem::SfxFontItem(USHORT which): - SfxPoolItem(which), - m_nCharSet(RTL_TEXTENCODING_DONTKNOW), - m_nLanguage(LANGUAGE_DONTKNOW), - m_nFamily(0), // FAMILY_DONTKNOW - m_nPitch(0), // PITCH_DONTKNOW - m_nWeight(0), // WEIGHT_DONTKNOW - m_nWidthType(0), // WIDTH_DONTKNOW - m_nItalic(3), // ITALIC_DONTKNOW - m_nUnderline(4), // UNDERLINE_DONTKNOW - m_nStrikeout(3), // STRIKEOUT_DONTKNOW - m_nOrientation(0), - m_bWordLine(sal_False), - m_bOutline(sal_False), - m_bShadow(sal_False), - m_bKerning(sal_False), - m_bHasFont(sal_False), - m_bHasColor(sal_False), - m_bHasFillColor(sal_False) -{} - -inline void SfxFontItem::setFont(sal_Int16 nTheFamily, - const XubString & rTheName, - const XubString & rTheStyleName, - sal_Int16 nThePitch, - rtl_TextEncoding nTheCharSet) -{ - m_nFamily = nTheFamily; - m_aName = rTheName; - m_aStyleName = rTheStyleName; - m_nPitch = nThePitch; - m_nCharSet = nTheCharSet; - m_bHasFont = sal_True; -} - -inline void SfxFontItem::setWeight(sal_Int16 nTheWeight) -{ - m_nWeight = nTheWeight; - m_bHasFont = sal_True; -} - -inline void SfxFontItem::setItalic(sal_Int16 nTheItalic) -{ - m_nItalic = nTheItalic; - m_bHasFont = sal_True; -} - -inline void SfxFontItem::setHeight(sal_Int32 nHeight) -{ - m_aSize.setHeight(nHeight); - m_bHasFont = sal_True; -} - -inline void SfxFontItem::setColor(const Color & rTheColor) -{ - m_aColor = rTheColor; - m_bHasColor = sal_True; -} - -inline void SfxFontItem::setFillColor(const Color & rTheFillColor) -{ - m_aFillColor = rTheFillColor; - m_bHasFillColor = sal_True; -} - -inline void SfxFontItem::setUnderline(sal_Int16 nTheUnderline) -{ - m_nUnderline = nTheUnderline; - m_bHasFont = sal_True; -} - -inline void SfxFontItem::setStrikeout(sal_Int16 nTheStrikeout) -{ - m_nStrikeout = nTheStrikeout; - m_bHasFont = sal_True; -} - -inline void SfxFontItem::setOutline(sal_Bool bTheOutline) -{ - m_bOutline = bTheOutline; - m_bHasFont = sal_True; -} - -inline void SfxFontItem::setShadow(sal_Bool bTheShadow) -{ - m_bShadow = bTheShadow; - m_bHasFont = sal_True; -} - -inline void SfxFontItem::setLanguage(LanguageType nTheLanguage) -{ - m_nLanguage = nTheLanguage; - m_bHasFont = sal_True; -} - -#endif // _SFONTITM_HXX - diff --git a/svtools/inc/svtools/sharecontrolfile.hxx b/svtools/inc/svtools/sharecontrolfile.hxx deleted file mode 100644 index 8735f8c5ccf7..000000000000 --- a/svtools/inc/svtools/sharecontrolfile.hxx +++ /dev/null @@ -1,88 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: sharecontrolfile.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVT_SHARECONTROLFILE_HXX -#define _SVT_SHARECONTROLFILE_HXX - -#include - -#include -#include -#include -#include -#include -#include - -#include - -#define SHARED_OOOUSERNAME_ID LOCKFILE_OOOUSERNAME_ID -#define SHARED_SYSUSERNAME_ID LOCKFILE_SYSUSERNAME_ID -#define SHARED_LOCALHOST_ID LOCKFILE_LOCALHOST_ID -#define SHARED_EDITTIME_ID LOCKFILE_EDITTIME_ID -#define SHARED_USERURL_ID LOCKFILE_USERURL_ID -#define SHARED_ENTRYSIZE LOCKFILE_ENTRYSIZE - -namespace svt { - -class SVT_DLLPUBLIC ShareControlFile : public LockFileCommon -{ - ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xStream; - ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xInputStream; - ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > m_xOutputStream; - ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable > m_xSeekable; - ::com::sun::star::uno::Reference< ::com::sun::star::io::XTruncate > m_xTruncate; - - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > m_aUsersData; - - void OpenStream(); - void Close(); - sal_Bool IsValid() - { - return ( m_xFactory.is() && m_xStream.is() && m_xInputStream.is() && m_xOutputStream.is() && m_xSeekable.is() && m_xTruncate.is() ); - } - -public: - - // The constructor will throw exception in case the stream can not be opened - ShareControlFile( const ::rtl::OUString& aOrigURL, const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() ); - ~ShareControlFile(); - - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > GetUsersData(); - void SetUsersDataAndStore( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > >& aUserNames ); - ::com::sun::star::uno::Sequence< ::rtl::OUString > InsertOwnEntry(); - bool HasOwnEntry(); - void RemoveEntry( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aOptionalSpecification = ::com::sun::star::uno::Sequence< ::rtl::OUString >() ); - void RemoveFile(); -}; - -} - -#endif - diff --git a/svtools/inc/svtools/slstitm.hxx b/svtools/inc/svtools/slstitm.hxx deleted file mode 100644 index 742d437fb842..000000000000 --- a/svtools/inc/svtools/slstitm.hxx +++ /dev/null @@ -1,87 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: slstitm.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFXSLSTITM_HXX -#define _SFXSLSTITM_HXX - -#include "svtools/svldllapi.h" -#include -#include -#include -#include - -class SfxImpStringList; - -class SVL_DLLPUBLIC SfxStringListItem : public SfxPoolItem -{ -protected: - SfxImpStringList* pImp; - -public: - TYPEINFO(); - - SfxStringListItem(); - SfxStringListItem( USHORT nWhich, const List* pList=NULL ); - SfxStringListItem( USHORT nWhich, SvStream& rStream ); - SfxStringListItem( const SfxStringListItem& rItem ); - ~SfxStringListItem(); - - List * GetList(); - - const List * GetList() const - { return SAL_CONST_CAST(SfxStringListItem *, this)->GetList(); } - -#ifndef TF_POOLABLE - virtual int IsPoolable() const; -#endif - - // String-Separator: \n - virtual void SetString( const XubString& ); - virtual XubString GetString(); - - void SetStringList( const com::sun::star::uno::Sequence< rtl::OUString >& rList ); - void GetStringList( com::sun::star::uno::Sequence< rtl::OUString >& rList ) const; - - virtual int operator==( const SfxPoolItem& ) const; - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper * = 0 ) const; - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create( SvStream &, USHORT nVersion ) const; - virtual SvStream& Store( SvStream &, USHORT nItemVersion ) const; - void Sort( BOOL bAscending = TRUE, List* pParallelList = 0 ); - - virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; -}; -#endif diff --git a/svtools/inc/svtools/smplhint.hxx b/svtools/inc/svtools/smplhint.hxx deleted file mode 100644 index 9858fefd86f0..000000000000 --- a/svtools/inc/svtools/smplhint.hxx +++ /dev/null @@ -1,102 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: smplhint.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFXSMPLHINT_HXX -#define _SFXSMPLHINT_HXX - -#include "svtools/svldllapi.h" -#include -#include - -#define SFX_HINT_DYING 0x00000001 -#define SFX_HINT_NAMECHANGED 0x00000002 -#define SFX_HINT_TITLECHANGED 0x00000004 -#define SFX_HINT_DATACHANGED 0x00000008 -#define SFX_HINT_DOCCHANGED 0x00000010 -#define SFX_HINT_UPDATEDONE 0x00000020 -#define SFX_HINT_DEINITIALIZING 0x00000040 -#define SFX_HINT_MODECHANGED 0x00000080 -#define SFX_HINT_CANCELLABLE 0x00000100 -#define SFX_HINT_DATAAVAILABLE 0x00000200 -#define SFX_HINT_SAVECOMPLETED 0x00000400 -#define SFX_HINT_RELEASEREF 0x00000800 -#define SFX_HINT_COLORS_CHANGED 0x00001000 -#define SFX_HINT_CTL_SETTINGS_CHANGED 0x00002000 -#define SFX_HINT_ACCESSIBILITY_CHANGED 0x00004000 -#define SFX_HINT_VIEWCREATED 0x00008000 -#define SFX_HINT_USER00 0x00010000 -#define SFX_HINT_USER01 0x00020000 -#define SFX_HINT_USER02 0x00040000 -#define SFX_HINT_USER03 0x00080000 -#define SFX_HINT_USER04 0x00100000 -#define SFX_HINT_USER05 0x00200000 -#define SFX_HINT_USER06 0x00400000 -#define SFX_HINT_USER07 0x00800000 -#define SFX_HINT_USER08 0x01000000 -#define SFX_HINT_USER09 0x02000000 -#define SFX_HINT_USER10 0x04000000 -#define SFX_HINT_USER11 0x08000000 -#define SFX_HINT_USER12 0x10000000 -#define SFX_HINT_USER13 0x20000000 -#define SFX_HINT_UNDO_OPTIONS_CHANGED 0x40000000 -#define SFX_HINT_USER_OPTIONS_CHANGED 0x80000000 -#define SFX_HINT_ALL 0xFFFFFFFF - -class SVL_DLLPUBLIC SfxSimpleHint: public SfxHint -{ -private: - ULONG nId; -public: - TYPEINFO(); - SfxSimpleHint( ULONG nId ); - ULONG GetId() const { return nId; } -}; - -//-------------------------------------------------------------------- - -#define DECL_OBJHINT(Name, Type) \ - class Name: public SfxSimpleHint \ - { \ - Type aObj; \ - \ - public: \ - TYPEINFO(); \ - Name( USHORT nId, const Type& rObject ); \ - ~Name(); \ - const Type& GetObject() const { return aObj; } \ - } - -#define IMPL_OBJHINT(Name, Type) \ - TYPEINIT1(Name, SfxSimpleHint); \ - Name::Name( USHORT nID, const Type& rObject ): \ - SfxSimpleHint( nID ), aObj(rObject) \ - { } \ - Name::~Name() {} - -#endif diff --git a/svtools/inc/svtools/solar.hrc b/svtools/inc/svtools/solar.hrc deleted file mode 100644 index 348422ef6477..000000000000 --- a/svtools/inc/svtools/solar.hrc +++ /dev/null @@ -1,312 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: solar.hrc,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SOLAR_HRC -#define _SOLAR_HRC - -// defines ------------------------------------------------------------------ - -#define CREATERESMGR_NAME( Name ) #Name -#define CREATERESMGR( Name ) ResMgr::CreateResMgr( CREATERESMGR_NAME( Name ) ) - -#define RID_SFX_START 260 -#define RID_SFX_END 9999 - -#define RID_LIB_START 10000 -#define RID_LIB_END 19999 - -#define RID_SVX_START (RID_LIB_START) -#define RID_SVX_END (RID_LIB_START+499) - -#define RID_SBASIC_START (RID_LIB_START+500) -#define RID_SBASIC_END (RID_LIB_START+2999) - -#define RID_BASIC_START (RID_LIB_START+3000) -#define RID_BASIC_END (RID_LIB_START+4499) - -#define RID_UUI_START (RID_LIB_START+4500) -#define RID_UUI_END (RID_LIB_START+4599) - -#define RID_HELP_START (RID_LIB_START+4600) -#define RID_HELP_END (RID_LIB_START+4799) - -#define RID_MAIL_START (RID_LIB_START+4800) -#define RID_MAIL_END (RID_LIB_START+4849) - -#define RID_BASICIDE_START (RID_LIB_START+4850) -#define RID_BASICIDE_END (RID_LIB_START+4949) - -#define RID_SVXITEMS_START (RID_LIB_START+4950) -#define RID_SVXITEMS_END (RID_LIB_START+5599) - -#define RID_SBA_START (RID_LIB_START+5600) -#define RID_SBA_END (RID_LIB_START+5649) - -#define RID_ISETBRW_START (RID_LIB_START+5650) -#define RID_ISETBRW_END (RID_LIB_START+5699) - -#define RID_EXTENSIONS_START (RID_LIB_START+5700) -#define RID_EXTENSIONS_END (RID_LIB_START+5799) - -#define RID_EDIT_START (RID_LIB_START+5800) -#define RID_EDIT_END (RID_LIB_START+5899) - -#define RID_EDIT_START (RID_LIB_START+5800) -#define RID_EDIT_END (RID_LIB_START+5899) - -#define RID_OUTL_START (RID_LIB_START+5900) -#define RID_OUTL_END (RID_LIB_START+5919) - -#define RID_SVTOOLS_START (RID_LIB_START+5920) -#define RID_SVTOOLS_END (RID_LIB_START+5999) - -#define RID_INET_START (RID_LIB_START+6000) -#define RID_INET_END (RID_LIB_START+6059) - -#define RID_SO2_START (RID_LIB_START+6060) -#define RID_SO2_END (RID_LIB_START+6099) - -#define RID_GOODIES_START (RID_LIB_START+6100) -#define RID_GOODIES_END (RID_LIB_START+6149) - -#define RID_SJ_START (RID_LIB_START+6150) -#define RID_SJ_END (RID_LIB_START+6199) - -#define RID_SI_START (RID_LIB_START+6200) -#define RID_SI_END (RID_LIB_START+6399) - -#define RID_DLG_START (RID_LIB_START+6400) -#define RID_DLG_END (RID_LIB_START+6499) - -#define RID_OFA_START (RID_LIB_START+6500) -#define RID_OFA_END (RID_LIB_START+6999) - -#define RID_CHANNEL_START (RID_LIB_START+7000) -#define RID_CHANNEL_END (RID_LIB_START+7499) - -#define RID_CHAOS_START (RID_LIB_START+7500) -#define RID_CHAOS_END (RID_LIB_START+7999) - -#define RID_FORMS_START (RID_LIB_START+8000) -#define RID_FORMS_END (RID_LIB_START+8999) - -#define RID_FORMLAYER_START (RID_LIB_START+9000) -#define RID_FORMLAYER_END (RID_LIB_START+9199) - -#define RID_DBACCESS_START (RID_LIB_START+9200) -#define RID_DBACCESS_END (RID_LIB_START+9699) - -#define RID_MORE_EXTENSIONS_START (RID_LIB_START+9700) -#define RID_MORE_EXTENSIONS_END (RID_LIB_START+9999) - -#define RID_DB_EXTENSIONS_START (RID_LIB_START+10000) -#define RID_DB_EXTENSIONS_END (RID_LIB_START+10199) - -#define RID_FILTER_START (RID_LIB_START+10200) -#define RID_FILTER_END (RID_LIB_START+10299) - -#define RID_APP_START 20000 -#define RID_APP_END 31999 - -#define RID_SW_START (20000) -#define RID_SW_END (25999) - -#define RID_SC_START (26000) -#define RID_SC_END (26999) - -#define RID_SD_START (27000) -#define RID_SD_END (27999) - -#define RID_Sa_START (28000) -#define RID_Sa_END (28999) - -#define RID_Sb_START (29000) -#define RID_Sb_END (29999) - -#define RID_OBJ_START (30000) -#define RID_OBJ_END (32767) - -#define RID_SIM_START (RID_OBJ_START+ 0) -#define RID_SIM_END (RID_OBJ_START+ 255) - -#define RID_SMA_START (RID_OBJ_START+ 256) -#define RID_SMA_END (RID_OBJ_START+ 511) - -#define RID_SCH_START (RID_OBJ_START+ 512) -#define RID_SCH_END (RID_OBJ_START+ 767) - -#define RID_RPT_START (RID_OBJ_START+768) -#define RID_RPT_END (RID_OBJ_START+1000) - -#define RID_FORMULA_START (RID_OBJ_START+1001) -#define RID_FORMULA_END (RID_OBJ_START+1200) -// Help-Ids -------------------------------------------------------------- - -#define HID_OK_BUTTON 0 -#define HID_CANCEL_BUTTON 0 -#define HID_HELP_BUTTON 0 - -#define HID_START 32768 - -#define HID_SVTOOLS_START (HID_START+200) -#define HID_SVTOOLS_END (HID_START+299) - -#define HID_SFX_START (HID_START+300) -#define HID_SFX_END (HID_START+999) - -#define HID_LIB_START (HID_START+1000) -#define HID_LIB_END (HID_START+19999) - -#define HID_SVX_START (HID_LIB_START) -#define HID_SVX_END (HID_LIB_START+431) - -#define HID_WIZARD_START (HID_LIB_START+432) -#define HID_WIZARD_END (HID_LIB_START+999) -//please note: There is also HID_WIZARD2 below - -#define HID_EXTENSIONS_START (HID_LIB_START+1000) -#define HID_EXTENSIONS_END (HID_LIB_START+1099) - -#define HID_SO2_START (HID_LIB_START+1100) -#define HID_SO2_END (HID_LIB_START+1149) - -#define HID_MAIL_START (HID_LIB_START+1150) -#define HID_MAIL_END (HID_LIB_START+1199) - -#define HID_INET_START (HID_LIB_START+1200) -#define HID_INET_END (HID_LIB_START+1259) - -#define HID_OFA_START (HID_LIB_START+1260) -#define HID_OFA_END (HID_LIB_START+1399) - -#define HID_HELP_START (HID_LIB_START+2000) -#define HID_HELP_END (HID_LIB_START+2050) - -#define HID_CHAOS_START (HID_LIB_START+2051) -#define HID_CHAOS_END (HID_LIB_START+2069) - -#define HID_UUI_START (HID_LIB_START+2070) -#define HID_UUI_END (HID_LIB_START+2099) - -#define HID_GOODIES_START (HID_LIB_START+2100) -#define HID_GOODIES_END (HID_LIB_START+2199) - -#define HID_SCHEDULE_START (HID_LIB_START+2200) -#define HID_SCHEDULE_END (HID_LIB_START+3399) - -#define HID_CHANNEL_START (HID_LIB_START+3400) -#define HID_CHANNEL_END (HID_LIB_START+3499) - -#define HID_SBA_START (HID_LIB_START+ 3500) -#define HID_SBA_END (HID_LIB_START+ 3999) - -#define HID_FORMS_START (HID_LIB_START+4000) -#define HID_FORMS_END (HID_LIB_START+4999) - -#define HID_DBACCESS_START (HID_LIB_START+5000) -#define HID_DBACCESS_END (HID_LIB_START+5299) - -#define HID_PORTAL_START (HID_LIB_START+5300) -#define HID_PORTAL_END (HID_LIB_START+5599) - -#define HID_PORTAL_ADMIN_START (HID_LIB_START+5600) -#define HID_PORTAL_ADMIN_END (HID_LIB_START+5999) - -#define HID_SYNCACCESS_START (HID_LIB_START+6000) -#define HID_SYNCACCESS_END (HID_LIB_START+6099) - -#define HID_SVX_EXT0_START (HID_LIB_START+6100) -#define HID_SVX_EXT0_END (HID_LIB_START+6599) - -#define HID_FRAMEWORK_START (HID_LIB_START+6600) -#define HID_FRAMEWORK_END (HID_LIB_START+6999) - -#define HID_WIZARD2_START (HID_LIB_START+7000) -#define HID_WIZARD2_END (HID_LIB_START+8999) - -#define HID_DESKTOP_START (HID_LIB_START+9000) -#define HID_DESKTOP_END (HID_LIB_START+9299) - -#define HID_XMLSECURITY_START (HID_LIB_START+9300) -#define HID_XMLSECURITY_END (HID_LIB_START+9999) - -#define HID_APP_START (HID_START+20000) -#define HID_APP_END (HID_START+29999) - -#define HID_SW_START (HID_START+20000) -#define HID_SW_END (HID_START+24999) - -#define HID_SC_START (HID_START+25000) -#define HID_SC_END (HID_START+26999) - -#define HID_SD_START (HID_START+27000) -#define HID_SD_END (HID_START+27999) - -#define HID_Sa_START (HID_START+28000) -#define HID_Sa_END (HID_START+28999) - -#define HID_Sb_START (HID_START+29000) -#define HID_Sb_END (HID_START+29999) - -#define HID_OBJ_START (HID_START+30000) -#define HID_OBJ_END (HID_START+32767) - -#define HID_SIM_START (HID_OBJ_START+ 0) -#define HID_SIM_END (HID_OBJ_START+ 239) - -#define HID_AVMEDIA_START (HID_OBJ_START+ 240) -#define HID_AVMEDIA_END (HID_OBJ_START+ 255) - -#define HID_SMA_START (HID_OBJ_START+ 256) -#define HID_SMA_END (HID_OBJ_START+ 511) - -#define HID_SCH_START (HID_OBJ_START+ 512) -#define HID_SCH_END (HID_OBJ_START+ 767) - -#define HID_BASICIDE_START (HID_OBJ_START+ 768) -#define HID_BASICIDE_END (HID_OBJ_START+1023) - -#define HID_SMA2_START (HID_OBJ_START+1024) -#define HID_SMA2_END (HID_OBJ_START+1280) - -#define HID_FILTER_START (HID_OBJ_START+1281) -#define HID_FILTER_END (HID_OBJ_START+1580) - -#define HID_LICENSING_START (HID_OBJ_START+1581) -#define HID_LICENSING_END (HID_OBJ_START+1680) - -#define HID_RPT_START (HID_OBJ_START+1681) -#define HID_RPT_END (HID_OBJ_START+2080) - -#define HID_FORMULA_START (HID_OBJ_START+2081) -#define HID_FORMULA_END (HID_OBJ_START+2280) - -#endif - diff --git a/svtools/inc/svtools/stritem.hxx b/svtools/inc/svtools/stritem.hxx deleted file mode 100644 index a2430b142c1d..000000000000 --- a/svtools/inc/svtools/stritem.hxx +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: stritem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SFXSTRITEM_HXX -#define _SFXSTRITEM_HXX - -#include "svtools/svtdllapi.h" -#include - -//============================================================================ -class SVT_DLLPUBLIC SfxStringItem: public CntUnencodedStringItem -{ -public: - TYPEINFO(); - - SfxStringItem() {} - - SfxStringItem(USHORT which, const XubString & rValue): - CntUnencodedStringItem(which, rValue) {} - - SfxStringItem(USHORT nWhich, SvStream & rStream); - - virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const; - - virtual SvStream & Store(SvStream & rStream, USHORT) const; - - virtual SfxPoolItem * Clone(SfxItemPool * = 0) const; -}; - -#endif // _SFXSTRITEM_HXX - diff --git a/svtools/inc/svtools/style.hrc b/svtools/inc/svtools/style.hrc deleted file mode 100644 index ed4db1bf46d0..000000000000 --- a/svtools/inc/svtools/style.hrc +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: style.hrc,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SFX_STYLE_HRC -#define _SFX_STYLE_HRC - -#define SFXSTYLEBIT_AUTO 0x0000 // automatisch; Flags kommen von der Applikation -#define SFXSTYLEBIT_READONLY 0x2000 // benutzte Vorlage (als Suchmaske) -#define SFXSTYLEBIT_USED 0x4000 // benutzte Vorlage (als Suchmaske) -#define SFXSTYLEBIT_USERDEF 0x8000 // benutzerdefinierte Vorlage -#define SFXSTYLEBIT_ALL 0xFFFF // alle Vorlagen - -#endif - - diff --git a/svtools/inc/svtools/style.hxx b/svtools/inc/svtools/style.hxx deleted file mode 100644 index 17e4bf7b9c06..000000000000 --- a/svtools/inc/svtools/style.hxx +++ /dev/null @@ -1,400 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: style.hxx,v $ - * $Revision: 1.5.60.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SFXSTYLE_HXX -#define _SFXSTYLE_HXX - -#include -#include - -#include -#include -#include -#include -#include "svtools/svtdllapi.h" -#include -#include -#include -#include -#include -#include - -#ifndef _SFX_STYLE_HRC -#include -#endif - -class SfxItemSet; -class SfxItemPool; - -class SfxStyleSheetBasePool; -class SvStream; - -/* -Everyone changing instances of SfxStyleSheetBasePool or SfxStyleSheetBase -mußt broadcast this using broadcasten. -The class is used for this, it contains an Action-Id and a -pointer to the . The actions are: - -#define SFX_STYLESHEET_CREATED // style is created -#define SFX_STYLESHEET_MODIFIED // style is modified -#define SFX_STYLESHEET_CHANGED // style is replaced -#define SFX_STYLESHEET_ERASED // style is deleted - -The following methods already broadcast themself - -SfxStyleSheetHint(SFX_STYLESHEET_MODIFIED) from: - SfxStyleSheetBase::SetName( const String& rName ) - SfxStyleSheetBase::SetParent( const String& rName ) - SfxStyleSheetBase::SetFollow( const String& rName ) - -SfxSimpleHint(SFX_HINT_DYING) from: - SfxStyleSheetBasePool::~SfxStyleSheetBasePool() - -SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *p ) from: - SfxStyleSheetBasePool::Make( const String& rName, - SfxStyleFamily eFam, USHORT mask, USHORT nPos) - -SfxStyleSheetHint( SFX_STYLESHEET_CHANGED, *pNew ) from: - SfxStyleSheetBasePool::Add( SfxStyleSheetBase& rSheet ) - -SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *p ) from: - SfxStyleSheetBasePool::Erase( SfxStyleSheetBase* p ) - SfxStyleSheetBasePool::Clear() -*/ - -#define VIRTUAL510 virtual - -class SVT_DLLPUBLIC SfxStyleSheetBase : public comphelper::OWeakTypeObject -{ - friend class SfxStyleSheetBasePool; - -protected: - SfxStyleSheetBasePool& rPool; // zugehoeriger Pool - SfxStyleFamily nFamily; // Familie - - UniString aName, aParent, aFollow; - rtl::OUString maDisplayName; - String aHelpFile; // Name der Hilfedatei - SfxItemSet* pSet; // ItemSet - USHORT nMask; // Flags - - ULONG nHelpId; // Hilfe-ID - - BOOL bMySet; // TRUE: Set loeschen im dtor - - SfxStyleSheetBase(); // do not use! - SfxStyleSheetBase( const UniString&, SfxStyleSheetBasePool&, SfxStyleFamily eFam, USHORT mask ); - SfxStyleSheetBase( const SfxStyleSheetBase& ); - virtual ~SfxStyleSheetBase(); - virtual void Load( SvStream&, USHORT ); - virtual void Store( SvStream& ); - -public: - TYPEINFO(); - - // returns the internal name of this style - virtual const UniString& GetName() const; - - // sets the internal name of this style - virtual BOOL SetName( const UniString& ); - - /** returns the display name of this style, it is used at the user interface. - If the display name is empty, this method returns the internal name. */ - virtual rtl::OUString GetDisplayName() const; - - // sets the display name of this style - virtual void SetDisplayName( const rtl::OUString& ); - - virtual const UniString& GetParent() const; - virtual BOOL SetParent( const UniString& ); - virtual const UniString& GetFollow() const; - virtual BOOL SetFollow( const UniString& ); - virtual BOOL HasFollowSupport() const; // Default TRUE - virtual BOOL HasParentSupport() const; // Default TRUE - virtual BOOL HasClearParentSupport() const; // Default FALSE - virtual BOOL IsUsed() const; // Default TRUE - // Default aus dem Itemset; entweder dem uebergebenen - // oder aus dem per GetItemSet() zurueckgelieferten Set - virtual UniString GetDescription(); - virtual UniString GetDescription( SfxMapUnit eMetric ); - - SfxStyleSheetBasePool& GetPool() { return rPool; } - SfxStyleFamily GetFamily() const { return nFamily; } - USHORT GetMask() const { return nMask; } - void SetMask( USHORT mask) { nMask = mask; } - BOOL IsUserDefined() const - { return BOOL( ( nMask & SFXSTYLEBIT_USERDEF) != 0 ); } - - virtual ULONG GetHelpId( String& rFile ); - virtual void SetHelpId( const String& r, ULONG nId ); - - virtual SfxItemSet& GetItemSet(); - virtual USHORT GetVersion() const; -}; - -//========================================================================= - -typedef std::vector< rtl::Reference< SfxStyleSheetBase > > SfxStyles; - -//========================================================================= - -class SVT_DLLPUBLIC SfxStyleSheetIterator - -/* [Beschreibung] - - Klasse zum Iterieren und Suchen auf einem SfxStyleSheetBasePool. - -*/ - -{ -public: - SfxStyleSheetIterator(SfxStyleSheetBasePool *pBase, - SfxStyleFamily eFam, USHORT n=0xFFFF ); - virtual USHORT GetSearchMask() const; - virtual SfxStyleFamily GetSearchFamily() const; - virtual USHORT Count(); - virtual SfxStyleSheetBase *operator[](USHORT nIdx); - virtual SfxStyleSheetBase* First(); - virtual SfxStyleSheetBase* Next(); - virtual SfxStyleSheetBase* Find(const UniString& rStr); - virtual ~SfxStyleSheetIterator(); - -protected: - - SfxStyleSheetBasePool* pBasePool; - SfxStyleFamily nSearchFamily; - USHORT nMask; - BOOL SearchUsed() const { return bSearchUsed; } - -private: - USHORT GetPos(){return nAktPosition;} - SVT_DLLPRIVATE BOOL IsTrivialSearch(); - SVT_DLLPRIVATE BOOL DoesStyleMatch(SfxStyleSheetBase *pStyle); - - void* pImp; - SfxStyleSheetBase* pAktStyle; - USHORT nAktPosition; - BOOL bSearchUsed; - -friend class SfxStyleSheetBasePool; -}; - -//========================================================================= - -class SfxStyleSheetBasePool_Impl; - -class SVT_DLLPUBLIC SfxStyleSheetBasePool: public SfxBroadcaster, public comphelper::OWeakTypeObject -{ -friend class SfxStyleSheetIterator; -friend class SfxStyleSheetBase; - - SfxStyleSheetBasePool_Impl *pImp; - -private: - SVT_DLLPRIVATE BOOL Load1_Impl( SvStream& ); - SVT_DLLPRIVATE SfxStyleSheetIterator& GetIterator_Impl(); -protected: - String aAppName; - SfxItemPool& rPool; - SfxStyles aStyles; - SfxStyleFamily nSearchFamily; - USHORT nMask; - - SfxStyleSheetBase& Add( SfxStyleSheetBase& ); - void ChangeParent( const UniString&, const UniString&, BOOL bVirtual = TRUE ); - virtual SfxStyleSheetBase* Create( const UniString&, SfxStyleFamily, USHORT ); - virtual SfxStyleSheetBase* Create( const SfxStyleSheetBase& ); - - ~SfxStyleSheetBasePool(); - -public: - SfxStyleSheetBasePool( SfxItemPool& ); - SfxStyleSheetBasePool( const SfxStyleSheetBasePool& ); - - static String GetStreamName(); - - const String& GetAppName() const { return aAppName; } - - SfxItemPool& GetPool(); - const SfxItemPool& GetPool() const; - - virtual SfxStyleSheetIterator* CreateIterator(SfxStyleFamily, USHORT nMask); - virtual USHORT Count(); - virtual SfxStyleSheetBase* operator[](USHORT nIdx); - - virtual SfxStyleSheetBase& Make(const UniString&, - SfxStyleFamily eFam, - USHORT nMask = 0xffff , - USHORT nPos = 0xffff); - - virtual void Replace( - SfxStyleSheetBase& rSource, SfxStyleSheetBase& rTarget ); - - virtual void Remove( SfxStyleSheetBase* ); - virtual void Insert( SfxStyleSheetBase* ); - - virtual void Clear(); - - SfxStyleSheetBasePool& operator=( const SfxStyleSheetBasePool& ); - SfxStyleSheetBasePool& operator+=( const SfxStyleSheetBasePool& ); - - const SfxStyles& GetStyles(); - virtual SfxStyleSheetBase* First(); - virtual SfxStyleSheetBase* Next(); - virtual SfxStyleSheetBase* Find( const UniString&, SfxStyleFamily eFam, USHORT n=0xFFFF ); - - virtual BOOL SetParent(SfxStyleFamily eFam, - const UniString &rStyle, - const UniString &rParent); - - SfxStyleSheetBase* Find(const UniString& rStr) - { return Find(rStr, nSearchFamily, nMask); } - - void SetSearchMask(SfxStyleFamily eFam, USHORT n=0xFFFF ); - USHORT GetSearchMask() const; - SfxStyleFamily GetSearchFamily() const { return nSearchFamily; } - - BOOL Load( SvStream& ); - BOOL Store( SvStream&, BOOL bUsed = TRUE ); -}; - -//========================================================================= - -class SVT_DLLPUBLIC SfxStyleSheet: public SfxStyleSheetBase, - public SfxListener, public SfxBroadcaster -{ -public: - TYPEINFO(); - - SfxStyleSheet( const UniString&, const SfxStyleSheetBasePool&, SfxStyleFamily, USHORT ); - SfxStyleSheet( const SfxStyleSheet& ); - - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - virtual BOOL SetParent( const UniString& ); - -protected: - SfxStyleSheet(); // do not use! - virtual ~SfxStyleSheet(); -}; - -//========================================================================= - -class SVT_DLLPUBLIC SfxStyleSheetPool: public SfxStyleSheetBasePool -{ -protected: - using SfxStyleSheetBasePool::Create; - virtual SfxStyleSheetBase* Create(const UniString&, SfxStyleFamily, USHORT mask); - virtual SfxStyleSheetBase* Create(const SfxStyleSheet &); - -public: - SfxStyleSheetPool( SfxItemPool const& ); - -// virtual BOOL CopyTo(SfxStyleSheetPool &rDest, const String &rSourceName); -}; - -//========================================================================= - -#define SFX_STYLESHEET_CREATED 1 // neu -#define SFX_STYLESHEET_MODIFIED 2 // ver"andert -#define SFX_STYLESHEET_CHANGED 3 // gel"oscht und neu (ausgetauscht) -#define SFX_STYLESHEET_ERASED 4 // gel"oscht -#define SFX_STYLESHEET_INDESTRUCTION 5 // wird gerade entfernt - -#define SFX_STYLESHEETPOOL_CHANGES 1 // Aenderungen, die den Zustand - // des Pools anedern, aber nicht - // ueber die STYLESHEET Hints - // verschickt werden sollen. - -//======================================================================== - -class SVT_DLLPUBLIC SfxStyleSheetPoolHint : public SfxHint -{ - USHORT nHint; - -public: - TYPEINFO(); - - SfxStyleSheetPoolHint(USHORT nArgHint) : nHint(nArgHint){} - USHORT GetHint() const - { return nHint; } -}; - -//========================================================================= - -class SVT_DLLPUBLIC SfxStyleSheetHint: public SfxHint -{ - SfxStyleSheetBase* pStyleSh; - USHORT nHint; - -public: - TYPEINFO(); - - SfxStyleSheetHint( USHORT ); - SfxStyleSheetHint( USHORT, SfxStyleSheetBase& ); - SfxStyleSheetBase* GetStyleSheet() const - { return pStyleSh; } - USHORT GetHint() const - { return nHint; } -}; - -class SVT_DLLPUBLIC SfxStyleSheetHintExtended: public SfxStyleSheetHint -{ - String aName; - -public: - TYPEINFO(); - - SfxStyleSheetHintExtended( - USHORT, const String& rOld ); - SfxStyleSheetHintExtended( - USHORT, const String& rOld, - SfxStyleSheetBase& ); - const String& GetOldName() { return aName; } -}; - -class SVT_DLLPUBLIC SfxUnoStyleSheet : public ::cppu::ImplInheritanceHelper2< SfxStyleSheet, ::com::sun::star::style::XStyle, ::com::sun::star::lang::XUnoTunnel > -{ -public: - SfxUnoStyleSheet( const UniString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, USHORT _nMaske ); - SfxUnoStyleSheet( const SfxStyleSheet& _rSheet ); - - static SfxUnoStyleSheet* getUnoStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >& xStyle ); - - // XUnoTunnel - virtual ::sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aIdentifier ) throw (::com::sun::star::uno::RuntimeException); - -private: - SfxUnoStyleSheet(); // not implemented - - static const ::com::sun::star::uno::Sequence< ::sal_Int8 >& getIdentifier(); -}; - -#endif - diff --git a/svtools/inc/svtools/svarray.hxx b/svtools/inc/svtools/svarray.hxx deleted file mode 100644 index 3ab3676fa5e0..000000000000 --- a/svtools/inc/svtools/svarray.hxx +++ /dev/null @@ -1,1056 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: svarray.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVARRAY_HXX -#define _SVARRAY_HXX - -#if 0 -*********************************************************************** -* -* Hier folgt die Beschreibung fuer die exportierten Makros: -* -* SV_DECL_VARARR(nm, AE, IS, GS) -* SV_IMPL_VARARR( nm, AE ) -* definiere/implementiere ein Array das einfache Objecte -* enthaelt. (Sie werden im Speicher verschoben, koennen also -* z.B. keine String sein) -* -* SV_DECL_OBJARR(nm, AE, IS, GS) -* SV_IMPL_OBJARR( nm, AE ) -* definiere/implementiere ein Array das Objecte enthaelt. -* (Hier koennen es auch Strings sein) -* -* -* SV_DECL_PTRARR(nm, AE, IS, GS) -* SV_IMPL_PTRARR(nm, AE) -* definiere/implementiere ein Array das Pointer haelt. Diese -* werden von aussen angelegt und zerstoert. Das IMPL-Makro -* wird nur benoetigt, wenn die DeleteAndDestroy Methode genutzt -* wird, diese loescht dann die Pointer und ruft deren Destruktoren -* -* SV_DECL_PTRARR_DEL(nm, AE, IS, GS) -* SV_IMPL_PTRARR(nm, AE) -* definiere/implementiere ein Array das Pointer haelt. Diese -* werden von aussen angelegt und im Destructor zerstoert. -* -* -* SV_DECL_PTRARR_SORT(nm, AE, IS, GS) -* SV_IMPL_PTRARR_SORT( nm,AE ) -* defieniere/implementiere ein Sort-Array mit Pointern, das nach -* Pointern sortiert ist. Basiert auf einem PTRARR -* -* SV_DECL_PTRARR_SORT_DEL(nm, AE, IS, GS) -* SV_IMPL_PTRARR_SORT( nm,AE ) -* defieniere/implementiere ein Sort-Array mit Pointern, das nach -* Pointern sortiert ist. Basiert auf einem PTRARR_DEL -* -* SV_DECL_PTRARR_SORT(nm, AE, IS, GS) -* SV_IMPL_OP_PTRARR_SORT( nm,AE ) -* defieniere/implementiere ein Sort-Array mit Pointern, das nach -* Objecten sortiert ist. Basiert auf einem PTRARR. -* Sortierung mit Hilfe der Object-operatoren "<" und "==" -* -* SV_DECL_PTRARR_SORT_DEL(nm, AE, IS, GS) -* SV_IMPL_OP_PTRARR_SORT( nm,AE ) -* defieniere/implementiere ein Sort-Array mit Pointern, das nach -* Objecten sortiert ist. Basiert auf einem PTRARR_DEL. -* Sortierung mit Hilfe der Object-operatoren "<" und "==" -* -* SV_DECL_VARARR_SORT(nm, AE, IS, GS) -* SV_IMPL_VARARR_SORT( nm,AE ) -* defieniere/implementiere ein Sort-Array mit einfachen Objecten. -* Basiert auf einem VARARR. -* Sortierung mit Hilfe der Object-operatoren "<" und "==" -* -* JP 23.12.94 neu: -* SV_DECL_PTRARR_STACK(nm, AE, IS, GS) -* ein Stack mit einem PtrArray als Grundlage. -* -* JP 09.10.96: vordefinierte Arrays: -* VarArr: SvBools, SvULongs, SvUShorts, SvLongs, SvShorts -* PtrArr: SvStrings, SvStringsDtor -* SortArr: SvStringsSort, SvStringsSortDtor, -* SvStringsISort, SvStringsISortDtor -*********************************************************************** -#endif - -#include "svtools/svldllapi.h" - -#ifndef INCLUDED_STRING_H -#include // memmove() -#define INCLUDED_STRING_H -#endif - -#ifndef INCLUDED_LIMITS_H -#include // USHRT_MAX -#define INCLUDED_LIMITS_H -#endif -#include -#include - -class String; - -#ifndef CONCAT -#define CONCAT(x,y) x##y -#endif - -class DummyType; -inline void* operator new( size_t, DummyType* pPtr ) -{ - return pPtr; -} -inline void operator delete( void*, DummyType* ) {} - -#if defined(PRODUCT) - -#define _SVVARARR_DEF_GET_OP_INLINE( nm, ArrElem ) \ -ArrElem& operator[](USHORT nP) const { return *(pData+nP); }\ -\ -void Insert( const nm * pI, USHORT nP,\ - USHORT nS = 0, USHORT nE = USHRT_MAX )\ -{\ - if( USHRT_MAX == nE ) \ - nE = pI->nA; \ - if( nS < nE ) \ - Insert( (const ArrElem*)pI->pData+nS, (USHORT)nE-nS, nP );\ -} - -#define _SVVARARR_IMPL_GET_OP_INLINE( nm, ArrElem ) - -#else - -#define _SVVARARR_DEF_GET_OP_INLINE( nm,ArrElem )\ -ArrElem& operator[](USHORT nP) const;\ -void Insert( const nm *pI, USHORT nP,\ - USHORT nS = 0, USHORT nE = USHRT_MAX ); - -#define _SVVARARR_IMPL_GET_OP_INLINE( nm, ArrElem )\ -ArrElem& nm::operator[](USHORT nP) const\ -{\ - DBG_ASSERT( pData && nP < nA,"Op[]");\ - return *(pData+nP);\ -}\ -void nm::Insert( const nm *pI, USHORT nP, USHORT nStt, USHORT nE)\ -{\ - DBG_ASSERT(nP<=nA,"Ins,Ar[Start.End]");\ - if( USHRT_MAX == nE ) \ - nE = pI->nA; \ - if( nStt < nE ) \ - Insert( (const ArrElem*)pI->pData+nStt, (USHORT)nE-nStt, nP );\ -} - -#endif - -#define _SV_DECL_VARARR_GEN(nm, AE, IS, GS, AERef, vis )\ -typedef BOOL (*FnForEach_##nm)( const AERef, void* );\ -class vis nm\ -{\ -protected:\ - AE *pData;\ - USHORT nFree;\ - USHORT nA;\ -\ - void _resize(size_t n);\ -\ -public:\ - nm( USHORT= IS, BYTE= GS );\ - ~nm() { rtl_freeMemory( pData ); }\ -\ - _SVVARARR_DEF_GET_OP_INLINE(nm, AE )\ - AERef GetObject(USHORT nP) const { return (*this)[nP]; } \ -\ - void Insert( const AERef aE, USHORT nP );\ - void Insert( const AE *pE, USHORT nL, USHORT nP );\ - void Remove( USHORT nP, USHORT nL = 1 );\ - void Replace( const AERef aE, USHORT nP );\ - void Replace( const AE *pE, USHORT nL, USHORT nP );\ - USHORT Count() const { return nA; }\ - const AE* GetData() const { return (const AE*)pData; }\ -\ - void ForEach( CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ - {\ - _ForEach( 0, nA, fnForEach, pArgs );\ - }\ - void ForEach( USHORT nS, USHORT nE, \ - CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ - {\ - _ForEach( nS, nE, fnForEach, pArgs );\ - }\ -\ - void _ForEach( USHORT nStt, USHORT nE, \ - CONCAT( FnForEach_, nm ) fnCall, void* pArgs = 0 );\ -\ - -#define _SV_DECL_VARARR(nm, AE, IS, GS ) \ -_SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE & ) -#define _SV_DECL_VARARR_PLAIN(nm, AE, IS, GS ) \ -_SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE ) - -#define SV_DECL_VARARR_GEN(nm, AE, IS, GS, AERef, vis )\ -_SV_DECL_VARARR_GEN(nm, AE, IS, GS, AERef, vis )\ -private:\ -nm( const nm& );\ -nm& operator=( const nm& );\ -}; - -#define SV_DECL_VARARR(nm, AE, IS, GS ) \ -SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE &, ) -#define SV_DECL_VARARR_PLAIN(nm, AE, IS, GS ) \ -SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE, ) - -#define SV_DECL_VARARR_VISIBILITY(nm, AE, IS, GS, vis ) \ -SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE &, vis ) - -#define SV_DECL_VARARR_PLAIN_VISIBILITY(nm, AE, IS, GS, vis ) \ -SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE, vis ) - -#define SV_IMPL_VARARR_GEN( nm, AE, AERef )\ -nm::nm( USHORT nInit, BYTE )\ - : pData (0),\ - nFree (nInit),\ - nA (0)\ -{\ - if( nInit )\ - {\ - pData = (AE*)(rtl_allocateMemory(sizeof(AE) * nInit));\ - DBG_ASSERT( pData, "CTOR, allocate");\ - }\ -}\ -\ -void nm::_resize (size_t n)\ -{\ - USHORT nL = ((n < USHRT_MAX) ? USHORT(n) : USHRT_MAX);\ - AE* pE = (AE*)(rtl_reallocateMemory (pData, sizeof(AE) * nL));\ - if ((pE != 0) || (nL == 0))\ - {\ - pData = pE;\ - nFree = nL - nA;\ - }\ -}\ -\ -void nm::Insert( const AERef aE, USHORT nP )\ -{\ - DBG_ASSERT(nP <= nA && nA < USHRT_MAX, "Ins 1");\ - if (nFree < 1)\ - _resize (nA + ((nA > 1) ? nA : 1));\ - if( pData && nP < nA )\ - memmove( pData+nP+1, pData+nP, (nA-nP) * sizeof( AE ));\ - *(pData+nP) = (AE&)aE;\ - ++nA; --nFree;\ -}\ -\ -void nm::Insert( const AE* pE, USHORT nL, USHORT nP )\ -{\ - DBG_ASSERT(nP<=nA && ((long)nA+nL) nL) ? nA : nL));\ - if( pData && nP < nA )\ - memmove( pData+nP+nL, pData+nP, (nA-nP) * sizeof( AE ));\ - if( pE )\ - memcpy( pData+nP, pE, nL * sizeof( AE ));\ - nA = nA + nL; nFree = nFree - nL;\ -}\ -\ -void nm::Replace( const AERef aE, USHORT nP )\ -{\ - if( nP < nA )\ - *(pData+nP) = (AE&)aE;\ -}\ -\ -void nm::Replace( const AE *pE, USHORT nL, USHORT nP )\ -{\ - if( pE && nP < nA )\ - {\ - if( nP + nL < nA )\ - memcpy( pData + nP, pE, nL * sizeof( AE ));\ - else if( nP + nL < nA + nFree )\ - {\ - memcpy( pData + nP, pE, nL * sizeof( AE ));\ - nP = nP + (nL - nA); \ - nFree = nP;\ - }\ - else \ - {\ - USHORT nTmpLen = nA + nFree - nP; \ - memcpy( pData + nP, pE, nTmpLen * sizeof( AE ));\ - nA = nA + nFree; \ - nFree = 0; \ - Insert( pE + nTmpLen, nL - nTmpLen, nA );\ - }\ - }\ -}\ -\ -void nm::Remove( USHORT nP, USHORT nL )\ -{\ - if( !nL )\ - return;\ - DBG_ASSERT( nP < nA && nP + nL <= nA,"Del");\ - if( pData && nP+1 < nA )\ - memmove( pData+nP, pData+nP+nL, (nA-nP-nL) * sizeof( AE ));\ - nA = nA - nL; nFree = nFree + nL;\ - if (nFree > nA)\ - _resize (nA);\ -}\ -\ -void nm::_ForEach( USHORT nStt, USHORT nE, \ - CONCAT( FnForEach_, nm ) fnCall, void* pArgs )\ -{\ - if( nStt >= nE || nE > nA )\ - return;\ - for( ; nStt < nE && (*fnCall)( *(const AE*)(pData+nStt), pArgs ); nStt++)\ - ;\ -}\ -\ -_SVVARARR_IMPL_GET_OP_INLINE(nm, AE )\ - -#define SV_IMPL_VARARR( nm, AE ) \ -SV_IMPL_VARARR_GEN( nm, AE, AE & ) -#define SV_IMPL_VARARR_PLAIN( nm, AE ) \ -SV_IMPL_VARARR_GEN( nm, AE, AE ) - -#if defined(PRODUCT) - -#define _SVOBJARR_DEF_GET_OP_INLINE( nm,ArrElem )\ -ArrElem& operator[](USHORT nP) const { return *(pData+nP); }\ -\ -void Insert( const nm *pI, USHORT nP,\ - USHORT nS = 0, USHORT nE = USHRT_MAX )\ -{\ - if( USHRT_MAX == nE ) \ - nE = pI->nA; \ - if( nS < nE ) \ - Insert( (const ArrElem*)pI->pData+nS, (USHORT)nE-nS, nP );\ -} - -#define _SVOBJARR_IMPL_GET_OP_INLINE( nm, ArrElem ) - -#else - -#define _SVOBJARR_DEF_GET_OP_INLINE( nm,ArrElem ) \ -ArrElem& operator[](USHORT nP) const;\ -void Insert( const nm *pI, USHORT nP,\ - USHORT nS = 0, USHORT nE = USHRT_MAX ); - -#define _SVOBJARR_IMPL_GET_OP_INLINE( nm, ArrElem )\ -ArrElem& nm::operator[](USHORT nP) const\ -{\ - DBG_ASSERT( pData && nP < nA,"Op[]");\ - return *(pData+nP);\ -}\ -void nm::Insert( const nm *pI, USHORT nP, USHORT nStt, USHORT nE )\ -{\ - DBG_ASSERT( nP <= nA,"Ins,Ar[Start.End]");\ - if( USHRT_MAX == nE ) \ - nE = pI->nA; \ - if( nStt < nE ) \ - Insert( (const ArrElem*)pI->pData+nStt, (USHORT)nE-nStt, nP );\ -} - -#endif - -#define _SV_DECL_OBJARR(nm, AE, IS, GS)\ -typedef BOOL (*FnForEach_##nm)( const AE&, void* );\ -class nm\ -{\ -protected:\ - AE *pData;\ - USHORT nFree;\ - USHORT nA;\ -\ - void _resize(size_t n);\ - void _destroy();\ -\ -public:\ - nm( USHORT= IS, BYTE= GS );\ - ~nm() { _destroy(); }\ -\ - _SVOBJARR_DEF_GET_OP_INLINE(nm,AE)\ - AE& GetObject(USHORT nP) const { return (*this)[nP]; } \ -\ - void Insert( const AE &aE, USHORT nP );\ - void Insert( const AE *pE, USHORT nL, USHORT nP );\ - void Remove( USHORT nP, USHORT nL = 1 );\ - USHORT Count() const { return nA; }\ - const AE* GetData() const { return (const AE*)pData; }\ -\ - void ForEach( CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ - {\ - _ForEach( 0, nA, fnForEach, pArgs );\ - }\ - void ForEach( USHORT nS, USHORT nE, \ - CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ - {\ - _ForEach( nS, nE, fnForEach, pArgs );\ - }\ -\ - void _ForEach( USHORT nStt, USHORT nE, \ - CONCAT( FnForEach_, nm ) fnCall, void* pArgs = 0 );\ -\ - -#define SV_DECL_OBJARR(nm, AE, IS, GS)\ -_SV_DECL_OBJARR(nm, AE, IS, GS)\ -private:\ -nm( const nm& );\ -nm& operator=( const nm& );\ -}; - -#define SV_IMPL_OBJARR( nm, AE )\ -nm::nm( USHORT nInit, BYTE )\ - : pData (0),\ - nFree (nInit),\ - nA (0)\ -{\ - if( nInit )\ - {\ - pData = (AE*)(rtl_allocateMemory(sizeof(AE) * nInit));\ - DBG_ASSERT( pData, "CTOR, allocate");\ - }\ -}\ -\ -void nm::_destroy()\ -{\ - if(pData)\ - {\ - AE* pTmp=pData;\ - for(USHORT n=0; n < nA; n++,pTmp++ )\ - {\ - pTmp->~AE();\ - }\ - rtl_freeMemory(pData);\ - pData = 0;\ - }\ -}\ -\ -void nm::_resize (size_t n)\ -{\ - USHORT nL = ((n < USHRT_MAX) ? USHORT(n) : USHRT_MAX);\ - AE* pE = (AE*)(rtl_reallocateMemory (pData, sizeof(AE) * nL));\ - if ((pE != 0) || (nL == 0))\ - {\ - pData = pE;\ - nFree = nL - nA;\ - }\ -}\ -\ -void nm::Insert( const AE &aE, USHORT nP )\ -{\ - DBG_ASSERT( nP <= nA && nA < USHRT_MAX,"Ins 1");\ - if (nFree < 1)\ - _resize (nA + ((nA > 1) ? nA : 1));\ - if( pData && nP < nA )\ - memmove( pData+nP+1, pData+nP, (nA-nP) * sizeof( AE ));\ - AE* pTmp = pData+nP;\ - new( (DummyType*) pTmp ) AE( (AE&)aE );\ - ++nA; --nFree;\ -}\ -\ -void nm::Insert( const AE* pE, USHORT nL, USHORT nP )\ -{\ - DBG_ASSERT(nP<=nA && ((long)nA+nL) < USHRT_MAX, "Ins n");\ - if (nFree < nL)\ - _resize (nA + ((nA > nL) ? nA : nL));\ - if( pData && nP < nA )\ - memmove( pData+nP+nL, pData+nP, (nA-nP) * sizeof( AE ));\ - if( pE )\ - {\ - AE* pTmp = pData+nP;\ - for( USHORT n = 0; n < nL; n++, pTmp++, pE++)\ - {\ - new( (DummyType*) pTmp ) AE( (AE&)*pE );\ - }\ - }\ - nA = nA + nL; nFree = nFree - nL;\ -}\ -\ -void nm::Remove( USHORT nP, USHORT nL )\ -{\ - if( !nL )\ - return;\ - DBG_ASSERT( nP < nA && nP + nL <= nA,"Del");\ - AE* pTmp=pData+nP;\ - USHORT nCtr = nP;\ - for(USHORT n=0; n < nL; n++,pTmp++,nCtr++)\ - {\ - if( nCtr < nA )\ - pTmp->~AE();\ - }\ - if( pData && nP+1 < nA )\ - memmove( pData+nP, pData+nP+nL, (nA-nP-nL) * sizeof( AE ));\ - nA = nA - nL; nFree = nFree + nL;\ - if (nFree > nA) \ - _resize (nA);\ -}\ -\ -void nm::_ForEach( USHORT nStt, USHORT nE, \ - CONCAT( FnForEach_, nm ) fnCall, void* pArgs )\ -{\ - if( nStt >= nE || nE > nA )\ - return;\ - for( ; nStt < nE && (*fnCall)( *(pData+nStt), pArgs ); nStt++)\ - ;\ -}\ -\ -_SVOBJARR_IMPL_GET_OP_INLINE(nm, AE)\ - -#define _SV_DECL_PTRARR_DEF_GEN( nm, AE, IS, GS, AERef, vis )\ -_SV_DECL_VARARR_GEN( nm, AE, IS, GS, AERef, vis)\ -USHORT GetPos( const AERef aE ) const;\ -}; - -#define _SV_DECL_PTRARR_DEF( nm, AE, IS, GS, vis )\ -_SV_DECL_PTRARR_DEF_GEN( nm, AE, IS, GS, AE &, vis ) -#define _SV_DECL_PTRARR_DEF_PLAIN( nm, AE, IS, GS, vis )\ -_SV_DECL_PTRARR_DEF_GEN( nm, AE, IS, GS, AE, vis ) - -#define SV_DECL_PTRARR_GEN(nm, AE, IS, GS, Base, AERef, VPRef, vis )\ -typedef BOOL (*FnForEach_##nm)( const AERef, void* );\ -class vis nm: public Base \ -{\ -public:\ - nm( USHORT nIni=IS, BYTE nG=GS )\ - : Base(nIni,nG) {}\ - void Insert( const nm *pI, USHORT nP, \ - USHORT nS = 0, USHORT nE = USHRT_MAX ) {\ - Base::Insert((const Base*)pI, nP, nS, nE);\ - }\ - void Insert( const AERef aE, USHORT nP ) {\ - Base::Insert( (const VPRef )aE, nP );\ - }\ - void Insert( const AE *pE, USHORT nL, USHORT nP ) {\ - Base::Insert( (const VoidPtr*)pE, nL, nP );\ - }\ - void Replace( const AERef aE, USHORT nP ) {\ - Base::Replace( (const VPRef)aE, nP );\ - }\ - void Replace( const AE *pE, USHORT nL, USHORT nP ) {\ - Base::Replace( (const VoidPtr*)pE, nL, nP );\ - }\ - void Remove( USHORT nP, USHORT nL = 1) {\ - Base::Remove(nP,nL);\ - }\ - const AE* GetData() const {\ - return (const AE*)Base::GetData();\ - }\ - void ForEach( CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ - {\ - _ForEach( 0, nA, (FnForEach_##Base)fnForEach, pArgs );\ - }\ - void ForEach( USHORT nS, USHORT nE, \ - CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ - {\ - _ForEach( nS, nE, (FnForEach_##Base)fnForEach, pArgs );\ - }\ - AE operator[]( USHORT nP )const { \ - return (AE)Base::operator[](nP); }\ - AE GetObject(USHORT nP) const { \ - return (AE)Base::GetObject(nP); }\ - \ - USHORT GetPos( const AERef aE ) const { \ - return Base::GetPos((const VPRef)aE);\ - }\ - void DeleteAndDestroy( USHORT nP, USHORT nL=1 );\ -private:\ - nm( const nm& );\ - nm& operator=( const nm& );\ -}; - -#define SV_DECL_PTRARR(nm, AE, IS, GS )\ -SV_DECL_PTRARR_GEN(nm, AE, IS, GS, SvPtrarr, AE &, VoidPtr &, ) -#define SV_DECL_PTRARR_PLAIN(nm, AE, IS, GS )\ -SV_DECL_PTRARR_GEN(nm, AE, IS, GS, SvPtrarrPlain, AE, VoidPtr, ) - -#define SV_DECL_PTRARR_VISIBILITY(nm, AE, IS, GS, vis )\ -SV_DECL_PTRARR_GEN(nm, AE, IS, GS, SvPtrarr, AE &, VoidPtr &, vis ) -#define SV_DECL_PTRARR_PLAIN_VISIBILITY(nm, AE, IS, GS, vis )\ -SV_DECL_PTRARR_GEN(nm, AE, IS, GS, SvPtrarrPlain, AE, VoidPtr, vis ) - -#define SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, Base, AERef, VPRef, vis )\ -typedef BOOL (*FnForEach_##nm)( const AERef, void* );\ -class vis nm: public Base \ -{\ -public:\ - nm( USHORT nIni=IS, BYTE nG=GS )\ - : Base(nIni,nG) {}\ - ~nm() { DeleteAndDestroy( 0, Count() ); }\ - void Insert( const nm *pI, USHORT nP, \ - USHORT nS = 0, USHORT nE = USHRT_MAX ) {\ - Base::Insert((const Base*)pI, nP, nS, nE);\ - }\ - void Insert( const AERef aE, USHORT nP ) {\ - Base::Insert((const VPRef)aE, nP );\ - }\ - void Insert( const AE *pE, USHORT nL, USHORT nP ) {\ - Base::Insert( (const VoidPtr *)pE, nL, nP );\ - }\ - void Replace( const AERef aE, USHORT nP ) {\ - Base::Replace( (const VPRef)aE, nP );\ - }\ - void Replace( const AE *pE, USHORT nL, USHORT nP ) {\ - Base::Replace( (const VoidPtr*)pE, nL, nP );\ - }\ - void Remove( USHORT nP, USHORT nL = 1) {\ - Base::Remove(nP,nL);\ - }\ - const AE* GetData() const {\ - return (const AE*)Base::GetData();\ - }\ - void ForEach( CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ - {\ - _ForEach( 0, nA, (FnForEach_##Base)fnForEach, pArgs );\ - }\ - void ForEach( USHORT nS, USHORT nE, \ - CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ - {\ - _ForEach( nS, nE, (FnForEach_##Base)fnForEach, pArgs );\ - }\ - AE operator[]( USHORT nP )const { \ - return (AE)Base::operator[](nP); }\ - AE GetObject( USHORT nP )const { \ - return (AE)Base::GetObject(nP); }\ - \ - USHORT GetPos( const AERef aE ) const { \ - return Base::GetPos((const VPRef)aE);\ - } \ - void DeleteAndDestroy( USHORT nP, USHORT nL=1 );\ -private:\ - nm( const nm& );\ - nm& operator=( const nm& );\ -}; - -#define SV_DECL_PTRARR_DEL(nm, AE, IS, GS )\ -SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, SvPtrarr, AE &, VoidPtr &, ) -#define SV_DECL_PTRARR_DEL_PLAIN(nm, AE, IS, GS )\ -SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, SvPtrarrPlain, AE, VoidPtr, ) - -#define SV_DECL_PTRARR_DEL_VISIBILITY(nm, AE, IS, GS, vis )\ -SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, SvPtrarr, AE &, VoidPtr &, vis) -#define SV_DECL_PTRARR_DEL_PLAIN_VISIBILITY(nm, AE, IS, GS, vis )\ -SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, SvPtrarrPlain, AE, VoidPtr, vis) - -#define SV_IMPL_PTRARR_GEN(nm, AE, Base)\ -void nm::DeleteAndDestroy( USHORT nP, USHORT nL )\ -{ \ - if( nL ) {\ - DBG_ASSERT( nP < nA && nP + nL <= nA,"Del");\ - for( USHORT n=nP; n < nP + nL; n++ ) \ - delete *((AE*)pData+n); \ - Base::Remove( nP, nL ); \ - } \ -} - -#define SV_IMPL_PTRARR(nm, AE )\ -SV_IMPL_PTRARR_GEN(nm, AE, SvPtrarr ) -#define SV_IMPL_PTRARR_PLAIN(nm, AE )\ -SV_IMPL_PTRARR_GEN(nm, AE, SvPtrarrPlain ) - -typedef void* VoidPtr; -_SV_DECL_PTRARR_DEF( SvPtrarr, VoidPtr, 0, 1, SVL_DLLPUBLIC ) -_SV_DECL_PTRARR_DEF_PLAIN( SvPtrarrPlain, VoidPtr, 0, 1, SVL_DLLPUBLIC ) - -// SORTARR - Begin - -#ifdef __MWERKS__ -#define __MWERKS__PRIVATE public -#else -#define __MWERKS__PRIVATE private -#endif - -#define _SORT_CLASS_DEF(nm, AE, IS, GS, vis)\ -typedef BOOL (*FnForEach_##nm)( const AE&, void* );\ -class vis nm : __MWERKS__PRIVATE nm##_SAR \ -{\ -public:\ - nm(USHORT nSize = IS, BYTE nG = GS)\ - : nm##_SAR(nSize,nG) {}\ - void Insert( const nm *pI, USHORT nS=0, USHORT nE=USHRT_MAX );\ - BOOL Insert( const AE& aE );\ - BOOL Insert( const AE& aE, USHORT& rP );\ - void Insert( const AE *pE, USHORT nL );\ - void Remove( USHORT nP, USHORT nL = 1 );\ - void Remove( const AE& aE, USHORT nL = 1 );\ - USHORT Count() const { return nm##_SAR::Count(); }\ - const AE* GetData() const { return (const AE*)pData; }\ -\ -/* Das Ende stehe im DECL-Makro !!! */ - -#define _SV_SEEK_PTR(nm,AE)\ -BOOL nm::Seek_Entry( const AE aE, USHORT* pP ) const\ -{\ - register USHORT nO = nm##_SAR::Count(),\ - nM, \ - nU = 0;\ - if( nO > 0 )\ - {\ - nO--;\ - register long rCmp = (long)aE;\ - while( nU <= nO )\ - {\ - nM = nU + ( nO - nU ) / 2;\ - if( (long)*(pData + nM) == rCmp )\ - {\ - if( pP ) *pP = nM;\ - return TRUE;\ - }\ - else if( (long)*(pData+ nM) < (long)aE )\ - nU = nM + 1;\ - else if( nM == 0 )\ - {\ - if( pP ) *pP = nU;\ - return FALSE;\ - }\ - else\ - nO = nM - 1;\ - }\ - }\ - if( pP ) *pP = nU;\ - return FALSE;\ -} - -#define _SV_SEEK_PTR_TO_OBJECT( nm,AE )\ -BOOL nm::Seek_Entry( const AE aE, USHORT* pP ) const\ -{\ - register USHORT nO = nm##_SAR::Count(),\ - nM, \ - nU = 0;\ - if( nO > 0 )\ - {\ - nO--;\ - while( nU <= nO )\ - {\ - nM = nU + ( nO - nU ) / 2;\ - if( *(*((AE*)pData + nM)) == *(aE) )\ - {\ - if( pP ) *pP = nM;\ - return TRUE;\ - }\ - else if( *(*((AE*)pData + nM)) < *(aE) )\ - nU = nM + 1;\ - else if( nM == 0 )\ - {\ - if( pP ) *pP = nU;\ - return FALSE;\ - }\ - else\ - nO = nM - 1;\ - }\ - }\ - if( pP ) *pP = nU;\ - return FALSE;\ -} - -#define _SV_SEEK_OBJECT( nm,AE )\ -BOOL nm::Seek_Entry( const AE & aE, USHORT* pP ) const\ -{\ - register USHORT nO = nm##_SAR::Count(),\ - nM, \ - nU = 0;\ - if( nO > 0 )\ - {\ - nO--;\ - while( nU <= nO )\ - {\ - nM = nU + ( nO - nU ) / 2;\ - if( *(pData + nM) == aE )\ - {\ - if( pP ) *pP = nM;\ - return TRUE;\ - }\ - else if( *(pData + nM) < aE )\ - nU = nM + 1;\ - else if( nM == 0 )\ - {\ - if( pP ) *pP = nU;\ - return FALSE;\ - }\ - else\ - nO = nM - 1;\ - }\ - }\ - if( pP ) *pP = nU;\ - return FALSE;\ -} - -#define _SV_IMPL_SORTAR_ALG(nm, AE)\ -void nm::Insert( const nm * pI, USHORT nS, USHORT nE )\ -{\ - if( USHRT_MAX == nE )\ - nE = pI->Count();\ - USHORT nP;\ - const AE * pIArr = pI->GetData();\ - for( ; nS < nE; ++nS )\ - {\ - if( ! Seek_Entry( *(pIArr+nS), &nP) )\ - nm##_SAR::Insert( *(pIArr+nS), nP );\ - if( ++nP >= Count() )\ - {\ - nm##_SAR::Insert( pI, nP, nS+1, nE );\ - nS = nE;\ - }\ - }\ -}\ -\ -BOOL nm::Insert( const AE & aE )\ -{\ - USHORT nP;\ - BOOL bExist;\ - bExist = Seek_Entry( aE, &nP );\ - if( ! bExist )\ - nm##_SAR::Insert( aE, nP );\ - return !bExist;\ -}\ -BOOL nm::Insert( const AE & aE, USHORT& rP )\ -{\ - BOOL bExist;\ - bExist = Seek_Entry( aE, &rP );\ - if( ! bExist )\ - nm##_SAR::Insert( aE, rP );\ - return !bExist;\ -}\ -void nm::Insert( const AE* pE, USHORT nL)\ -{\ - USHORT nP;\ - for( USHORT n = 0; n < nL; ++n )\ - if( ! Seek_Entry( *(pE+n), &nP ))\ - nm##_SAR::Insert( *(pE+n), nP );\ -}\ -void nm::Remove( USHORT nP, USHORT nL )\ -{\ - if( nL )\ - nm##_SAR::Remove( nP, nL);\ -}\ -\ -void nm::Remove( const AE &aE, USHORT nL )\ -{\ - USHORT nP;\ - if( nL && Seek_Entry( aE, &nP ) ) \ - nm##_SAR::Remove( nP, nL);\ -}\ - -#if defined(TCPP) - -#define _SORTARR_BLC_CASTS(nm, AE )\ - BOOL Insert( AE &aE ) {\ - return Insert( (const AE&)aE );\ - }\ - USHORT GetPos( AE& aE ) const { \ - return SvPtrarr::GetPos((const VoidPtr&)aE);\ - }\ - void Remove( AE& aE, USHORT nL = 1 ) { \ - Remove( (const AE&) aE, nL );\ - } - -#else - -#define _SORTARR_BLC_CASTS(nm, AE )\ - USHORT GetPos( const AE& aE ) const { \ - return SvPtrarr::GetPos((const VoidPtr&)aE);\ - } - -#endif - -#define _SV_DECL_PTRARR_SORT_ALG(nm, AE, IS, GS, vis)\ -SV_DECL_PTRARR_VISIBILITY(nm##_SAR, AE, IS, GS, vis)\ -_SORT_CLASS_DEF(nm, AE, IS, GS, vis)\ - AE operator[](USHORT nP) const {\ - return nm##_SAR::operator[]( nP );\ - }\ - AE GetObject(USHORT nP) const {\ - return nm##_SAR::GetObject( nP );\ - }\ - BOOL Seek_Entry( const AE aE, USHORT* pP = 0 ) const;\ - void ForEach( CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ - {\ - _ForEach( 0, nA, (FnForEach_SvPtrarr)fnForEach, pArgs );\ - }\ - void ForEach( USHORT nS, USHORT nE, \ - CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ - {\ - _ForEach( nS, nE, (FnForEach_SvPtrarr)fnForEach, pArgs );\ - }\ - void DeleteAndDestroy( USHORT nP, USHORT nL=1 ); \ - _SORTARR_BLC_CASTS(nm, AE )\ -\ -/* Das Ende stehe im DECL-Makro !!! */ - -#define _SV_DECL_PTRARR_SORT(nm, AE, IS, GS, vis)\ -_SV_DECL_PTRARR_SORT_ALG(nm, AE, IS, GS, vis)\ -private:\ - nm( const nm& );\ - nm& operator=( const nm& );\ -}; - -#define SV_DECL_PTRARR_SORT(nm, AE, IS, GS)\ -_SV_DECL_PTRARR_SORT(nm, AE, IS, GS, ) - -#define SV_DECL_PTRARR_SORT_VISIBILITY(nm, AE, IS, GS, vis)\ -_SV_DECL_PTRARR_SORT(nm, AE, IS, GS, vis) - - -#define _SV_DECL_PTRARR_SORT_DEL(nm, AE, IS, GS, vis)\ -_SV_DECL_PTRARR_SORT_ALG(nm, AE, IS, GS, vis)\ - ~nm() { DeleteAndDestroy( 0, Count() ); }\ -private:\ - nm( const nm& );\ - nm& operator=( const nm& );\ -}; - -#define SV_DECL_PTRARR_SORT_DEL(nm, AE, IS, GS)\ -_SV_DECL_PTRARR_SORT_DEL(nm, AE, IS, GS, ) - -#define SV_DECL_PTRARR_SORT_DEL_VISIBILITY(nm, AE, IS, GS, vis)\ -_SV_DECL_PTRARR_SORT_DEL(nm, AE, IS, GS, vis) - -#define _SV_DECL_VARARR_SORT(nm, AE, IS, GS, vis)\ -SV_DECL_VARARR_VISIBILITY(nm##_SAR, AE, IS, GS, vis)\ -_SORT_CLASS_DEF(nm, AE, IS, GS, vis) \ - const AE& operator[](USHORT nP) const {\ - return nm##_SAR::operator[]( nP );\ - }\ - const AE& GetObject(USHORT nP) const {\ - return nm##_SAR::GetObject( nP );\ - }\ - BOOL Seek_Entry( const AE & aE, USHORT* pP = 0 ) const;\ - void ForEach( CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ - {\ - _ForEach( 0, nA, (FnForEach_##nm##_SAR)fnForEach, pArgs );\ - }\ - void ForEach( USHORT nS, USHORT nE, \ - CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ - {\ - _ForEach( nS, nE, (FnForEach_##nm##_SAR)fnForEach, pArgs );\ - }\ -private:\ - nm( const nm& );\ - nm& operator=( const nm& );\ -}; - -#define SV_DECL_VARARR_SORT(nm, AE, IS, GS)\ -_SV_DECL_VARARR_SORT(nm, AE, IS, GS,) - -#define SV_DECL_VARARR_SORT_VISIBILITY(nm, AE, IS, GS, vis)\ -_SV_DECL_VARARR_SORT(nm, AE, IS, GS, vis) - -#define SV_IMPL_PTRARR_SORT( nm,AE )\ -_SV_IMPL_SORTAR_ALG( nm,AE )\ - void nm::DeleteAndDestroy( USHORT nP, USHORT nL ) { \ - if( nL ) {\ - DBG_ASSERT( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" );\ - for( USHORT n=nP; n < nP + nL; n++ ) \ - delete *((AE*)pData+n); \ - SvPtrarr::Remove( nP, nL ); \ - } \ - } \ -_SV_SEEK_PTR( nm, AE ) - -#define SV_IMPL_OP_PTRARR_SORT( nm,AE )\ -_SV_IMPL_SORTAR_ALG( nm,AE )\ - void nm::DeleteAndDestroy( USHORT nP, USHORT nL ) { \ - if( nL ) {\ - DBG_ASSERT( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" );\ - for( USHORT n=nP; n < nP + nL; n++ ) \ - delete *((AE*)pData+n); \ - SvPtrarr::Remove( nP, nL ); \ - } \ - } \ -_SV_SEEK_PTR_TO_OBJECT( nm,AE ) - -#define SV_IMPL_VARARR_SORT( nm,AE )\ -SV_IMPL_VARARR(nm##_SAR, AE)\ -_SV_IMPL_SORTAR_ALG( nm,AE )\ -_SV_SEEK_OBJECT( nm,AE ) - -#define SV_DECL_PTRARR_STACK(nm, AE, IS, GS)\ -class nm: private SvPtrarr \ -{\ -public:\ - nm( USHORT nIni=IS, BYTE nG=GS )\ - : SvPtrarr(nIni,nG) {}\ - void Insert( const nm *pI, USHORT nP,\ - USHORT nS = 0, USHORT nE = USHRT_MAX ) {\ - SvPtrarr::Insert( pI, nP, nS, nE ); \ - }\ - void Remove( USHORT nP, USHORT nL = 1 ) {\ - SvPtrarr::Remove( nP, nL ); \ - }\ - void Push( const AE &aE ) {\ - SvPtrarr::Insert( (const VoidPtr &)aE, SvPtrarr::Count() );\ - }\ - USHORT Count() const { return SvPtrarr::Count(); }\ - AE operator[](USHORT nP) const {\ - return (AE)SvPtrarr::operator[]( nP );\ - }\ - AE GetObject(USHORT nP) const {\ - return (AE)SvPtrarr::GetObject( nP );\ - }\ - AE Pop(){\ - AE pRet = 0;\ - if( SvPtrarr::Count() ){\ - pRet = GetObject( SvPtrarr::Count()-1 );\ - SvPtrarr::Remove(Count()-1);\ - }\ - return pRet;\ - }\ - AE Top() const {\ - AE pRet = 0;\ - if( SvPtrarr::Count() )\ - pRet = GetObject( SvPtrarr::Count()-1 ); \ - return pRet;\ - }\ -}; - -#if defined (C40) || defined (C41) || defined (C42) || defined(C50) || defined(C52) -#define C40_INSERT( c, p, n) Insert( (c const *) p, n ) -#define C40_PUSH( c, p) Push( (c const *) p ) -#define C40_PTR_INSERT( c, p) Insert( (c const *) p ) -#define C40_REMOVE( c, p ) Remove( (c const *) p ) -#define C40_REPLACE( c, p, n) Replace( (c const *) p, n ) -#define C40_PTR_REPLACE( c, p) Replace( (c const *) p ) -#define C40_GETPOS( c, r) GetPos( (c const *)r ) -#else -#if defined WTC || defined IRIX || defined ICC || defined HPUX || (defined GCC && __GNUC__ >= 3) || (defined(WNT) && _MSC_VER >= 1400) -#define C40_INSERT( c, p, n ) Insert( (c const *&) p, n ) -#define C40_PUSH( c, p) Push( (c const *&) p ) -#define C40_PTR_INSERT( c, p ) Insert( (c const *&) p ) -#define C40_REMOVE( c, p ) Remove( (c const *&) p ) -#define C40_REPLACE( c, p, n ) Replace( (c const *&) p, n ) -#define C40_PTR_REPLACE( c, p ) Replace( (c const *&) p ) -#define C40_GETPOS( c, r) GetPos( (c const *&) r ) -#else -#define C40_INSERT( c, p, n ) Insert( p, n ) -#define C40_PUSH( c, p) Push( p ) -#define C40_PTR_INSERT( c, p ) Insert( p ) -#define C40_REMOVE( c, p) Remove( p ) -#define C40_REPLACE( c, p, n ) Replace( p, n ) -#define C40_PTR_REPLACE( c, p ) Replace( p ) -#define C40_GETPOS( c, r) GetPos( r ) -#endif -#endif - -#endif //_SVARRAY_HXX diff --git a/svtools/inc/svtools/svdde.hxx b/svtools/inc/svtools/svdde.hxx deleted file mode 100644 index 82681ed9d240..000000000000 --- a/svtools/inc/svtools/svdde.hxx +++ /dev/null @@ -1,483 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: svdde.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVDDE_HXX -#define _SVDDE_HXX - -#include "svtools/svtdllapi.h" -#include -#include -#include -#include - -class DdeString; -class DdeData; -class DdeConnection; -class DdeTransaction; -class DdeLink; -class DdeRequest; -class DdeWarmLink; -class DdeHotLink; -class DdePoke; -class DdeExecute; -class DdeItem; -class DdeTopic; -class DdeService; -class ConvList; -struct DdeDataImp; -struct DdeImp; -class DdeItemImp; - -#ifndef _SVDDE_NOLISTS -DECLARE_LIST( DdeConnections, DdeConnection* ) -DECLARE_LIST( DdeServices, DdeService* ) -DECLARE_LIST( DdeTopics, DdeTopic* ) -DECLARE_LIST( DdeItems, DdeItem* ) -#else -typedef List DdeConnections; -typedef List DdeServices; -typedef List DdeTopics; -typedef List DdeItems; -#endif - -//#if 0 // _SOLAR__PRIVATE -DECLARE_LIST( DdeTransactions, DdeTransaction* ) -DECLARE_LIST( DdeFormats, long ) -//#else -//typedef List DdeTransactions; -//typedef List DdeFormats; -//#endif - -#ifndef STRING_LIST -#define STRING_LIST -DECLARE_LIST( StringList, String * ) -#endif - -// ----------- -// - DdeData - -// ----------- - -class SVT_DLLPUBLIC DdeData -{ - friend class DdeInternal; - friend class DdeService; - friend class DdeConnection; - friend class DdeTransaction; - DdeDataImp* pImp; - -//#if 0 // _SOLAR__PRIVATE - SVT_DLLPRIVATE void Lock(); -//#endif - void SetFormat( ULONG nFmt ); - -public: - DdeData(); - DdeData( const void*, long, ULONG = FORMAT_STRING ); - DdeData( const String& ); - DdeData( const DdeData& ); - ~DdeData(); - - operator const void*() const; - operator long() const; - - ULONG GetFormat() const; - - DdeData& operator = ( const DdeData& ); - - static ULONG GetExternalFormat( ULONG nFmt ); - static ULONG GetInternalFormat( ULONG nFmt ); -}; -// ------------------ -// - DdeServiceList - -// ------------------ - -class DdeServiceList -{ - StringList aServices; - -public: - DdeServiceList( const String* = NULL ); - ~DdeServiceList(); - - StringList& GetServices() { return aServices; } - -private: - DdeServiceList( const DdeServiceList& ); - const DdeServiceList& operator= ( const DdeServiceList& ); -}; - -// ---------------- -// - DdeTopicList - -// ---------------- - -class DdeTopicList -{ - StringList aTopics; - -//#if 0 // _SOLAR__PRIVATE - DECL_LINK( Data, DdeData* ); -//#endif -public: - DdeTopicList( const String& ); - ~DdeTopicList(); - - StringList& GetTopics() { return aTopics; } -}; - -// ------------------ -// - DdeTransaction - -// ------------------ - -class SVT_DLLPUBLIC DdeTransaction -{ -public: - virtual void Data( const DdeData* ); - virtual void Done( BOOL bDataValid ); -protected: - DdeConnection& rDde; - DdeData aDdeData; - DdeString* pName; - short nType; - long nId; - long nTime; - Link aData; - Link aDone; - BOOL bBusy; - - DdeTransaction( DdeConnection&, const String&, long = 0 ); - -public: - virtual ~DdeTransaction(); - - BOOL IsBusy() { return bBusy; } - const String& GetName() const; - - void Execute(); - - void SetDataHdl( const Link& rLink ) { aData = rLink; } - const Link& GetDataHdl() const { return aData; } - - void SetDoneHdl( const Link& rLink ) { aDone = rLink; } - const Link& GetDoneHdl() const { return aDone; } - - void SetFormat( ULONG nFmt ) { aDdeData.SetFormat( nFmt ); } - ULONG GetFormat() const { return aDdeData.GetFormat(); } - - long GetError(); - -private: - friend class DdeInternal; - friend class DdeConnection; - - DdeTransaction( const DdeTransaction& ); - const DdeTransaction& operator= ( const DdeTransaction& ); - -}; - -// ----------- -// - DdeLink - -// ----------- - -class SVT_DLLPUBLIC DdeLink : public DdeTransaction -{ - Link aNotify; - -public: - DdeLink( DdeConnection&, const String&, long = 0 ); - virtual ~DdeLink(); - - void SetNotifyHdl( const Link& rLink ) { aNotify = rLink; } - const Link& GetNotifyHdl() const { return aNotify; } - virtual void Notify(); -}; - -// --------------- -// - DdeWarmLink - -// --------------- - -class SVT_DLLPUBLIC DdeWarmLink : public DdeLink -{ -public: - DdeWarmLink( DdeConnection&, const String&, long = 0 ); -}; - -// -------------- -// - DdeHotLink - -// -------------- - -class SVT_DLLPUBLIC DdeHotLink : public DdeLink -{ -public: - DdeHotLink( DdeConnection&, const String&, long = 0 ); -}; - -// -------------- -// - DdeRequest - -// -------------- - -class SVT_DLLPUBLIC DdeRequest : public DdeTransaction -{ -public: - DdeRequest( DdeConnection&, const String&, long = 0 ); -}; - -// ----------- -// - DdePoke - -// ----------- - -class SVT_DLLPUBLIC DdePoke : public DdeTransaction -{ -public: - DdePoke( DdeConnection&, const String&, const char*, long, - ULONG = FORMAT_STRING, long = 0 ); - DdePoke( DdeConnection&, const String&, const DdeData&, long = 0 ); - DdePoke( DdeConnection&, const String&, const String&, long = 0 ); -}; - -// -------------- -// - DdeExecute - -// -------------- - -class SVT_DLLPUBLIC DdeExecute : public DdeTransaction -{ -public: - DdeExecute( DdeConnection&, const String&, long = 0 ); -}; - -// ----------------- -// - DdeConnection - -// ----------------- - -class SVT_DLLPUBLIC DdeConnection -{ - friend class DdeInternal; - friend class DdeTransaction; - DdeTransactions aTransactions; - DdeString* pService; - DdeString* pTopic; - DdeImp* pImp; - -public: - DdeConnection( const String&, const String& ); - ~DdeConnection(); - - long GetError(); - long GetConvId(); - - static const DdeConnections& GetConnections(); - - BOOL IsConnected(); - - const String& GetServiceName(); - const String& GetTopicName(); - -private: - DdeConnection( const DdeConnection& ); - const DdeConnection& operator= ( const DdeConnection& ); -}; - -// ----------- -// - DdeItem - -// ----------- - -class SVT_DLLPUBLIC DdeItem -{ - friend class DdeInternal; - friend class DdeTopic; - DdeString* pName; - DdeTopic* pMyTopic; - DdeItemImp* pImpData; - - void IncMonitor( ULONG ); - void DecMonitor( ULONG ); - -protected: - BYTE nType; - -public: - DdeItem( const sal_Unicode* ); - DdeItem( const String& ); - DdeItem( const DdeItem& ); - virtual ~DdeItem(); - - const String& GetName() const; - short GetLinks(); - void NotifyClient(); -}; - -// ----------- -// - DdeItem - -// ----------- - -class SVT_DLLPUBLIC DdeGetPutItem : public DdeItem -{ -public: - DdeGetPutItem( const sal_Unicode* p ); - DdeGetPutItem( const String& rStr ); - DdeGetPutItem( const DdeItem& rItem ); - - virtual DdeData* Get( ULONG ); - virtual BOOL Put( const DdeData* ); - virtual void AdviseLoop( BOOL ); // AdviseLoop starten/stoppen -}; - -// ------------ -// - DdeTopic - -// ------------ - -class SVT_DLLPUBLIC DdeTopic -{ - SVT_DLLPRIVATE void _Disconnect( long ); - -public: - virtual void Connect( long ); - virtual void Disconnect( long ); - virtual DdeData* Get( ULONG ); - virtual BOOL Put( const DdeData* ); - virtual BOOL Execute( const String* ); - // evt. ein neues anlegen; return 0 -> es konnte nicht angelegt werden - virtual BOOL MakeItem( const String& rItem ); - - // es wird ein Warm-/Hot-Link eingerichtet. Return-Wert - // besagt ob es geklappt hat - virtual BOOL StartAdviseLoop(); - virtual BOOL StopAdviseLoop(); - -private: - friend class DdeInternal; - friend class DdeService; - friend class DdeItem; - -private: - DdeString* pName; - String aItem; - DdeItems aItems; - Link aConnectLink; - Link aDisconnectLink; - Link aGetLink; - Link aPutLink; - Link aExecLink; - -public: - DdeTopic( const String& ); - virtual ~DdeTopic(); - - const String& GetName() const; - long GetConvId(); - - void SetConnectHdl( const Link& rLink ) { aConnectLink = rLink; } - const Link& GetConnectHdl() const { return aConnectLink; } - void SetDisconnectHdl( const Link& rLink ) { aDisconnectLink = rLink; } - const Link& GetDisconnectHdl() const { return aDisconnectLink; } - void SetGetHdl( const Link& rLink ) { aGetLink = rLink; } - const Link& GetGetHdl() const { return aGetLink; } - void SetPutHdl( const Link& rLink ) { aPutLink = rLink; } - const Link& GetPutHdl() const { return aPutLink; } - void SetExecuteHdl( const Link& rLink ) { aExecLink = rLink; } - const Link& GetExecuteHdl() const { return aExecLink; } - - void NotifyClient( const String& ); - BOOL IsSystemTopic(); - - void InsertItem( DdeItem* ); // fuer eigene Ableitungen! - DdeItem* AddItem( const DdeItem& ); // werden kopiert ! - void RemoveItem( const DdeItem& ); - const String& GetCurItem() { return aItem; } - const DdeItems& GetItems() { return aItems; } - -private: - DdeTopic( const DdeTopic& ); - const DdeTopic& operator= ( const DdeTopic& ); -}; - -// -------------- -// - DdeService - -// -------------- - -class SVT_DLLPUBLIC DdeService -{ - friend class DdeInternal; - -public: - virtual BOOL IsBusy(); - virtual String GetHelp(); - // evt. ein neues anlegen; return 0 -> es konnte nicht angelegt werden - virtual BOOL MakeTopic( const String& rItem ); - -protected: - virtual String Topics(); - virtual String Formats(); - virtual String SysItems(); - virtual String Status(); - virtual String SysTopicGet( const String& ); - virtual BOOL SysTopicExecute( const String* ); - - const DdeTopic* GetSysTopic() const { return pSysTopic; } -private: - DdeTopics aTopics; - DdeFormats aFormats; - DdeTopic* pSysTopic; - DdeString* pName; - ConvList* pConv; - short nStatus; - - SVT_DLLPRIVATE BOOL HasCbFormat( USHORT ); - -public: - DdeService( const String& ); - virtual ~DdeService(); - - const String& GetName() const; - short GetError() { return nStatus; } - - static DdeServices& GetServices(); - DdeTopics& GetTopics() { return aTopics; } - - void AddTopic( const DdeTopic& ); - void RemoveTopic( const DdeTopic& ); - - void AddFormat( ULONG ); - void RemoveFormat( ULONG ); - BOOL HasFormat( ULONG ); - -private: - // DdeService( const DdeService& ); - //int operator= ( const DdeService& ); -}; - -// ------------------ -// - DdeTransaction - -// ------------------ - -inline long DdeTransaction::GetError() -{ - return rDde.GetError(); -} -#endif // _SVDDE_HXX diff --git a/svtools/inc/svtools/svldllapi.h b/svtools/inc/svtools/svldllapi.h deleted file mode 100644 index 29b2ae29100a..000000000000 --- a/svtools/inc/svtools/svldllapi.h +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: svldllapi.h,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_SVLDLLAPI_H -#define INCLUDED_SVLDLLAPI_H - -#include "sal/types.h" - -#if defined(SVL_DLLIMPLEMENTATION) -#define SVL_DLLPUBLIC SAL_DLLPUBLIC_EXPORT -#else -#define SVL_DLLPUBLIC SAL_DLLPUBLIC_IMPORT -#endif -#define SVL_DLLPRIVATE SAL_DLLPRIVATE - -#endif /* INCLUDED_SVLDLLAPI_H */ - diff --git a/svtools/inc/svtools/svstdarr.hxx b/svtools/inc/svtools/svstdarr.hxx deleted file mode 100644 index 050b228be4ab..000000000000 --- a/svtools/inc/svtools/svstdarr.hxx +++ /dev/null @@ -1,274 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: svstdarr.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#if 0 -*********************************************************************** -* -* Die vordefinierte Arrays werden ueber POSITIV-Defines aktiviert: -* (die defines setzen sich aus "_SVSTDARR_" und dem Namen des Array -* ohne "Sv" zusammen) -* -* VarArr: SvBools, SvULongs, SvUShorts, SvLongs, SvShorts -* PtrArr: SvStrings, SvStringsDtor -* SortArr: SvStringsSort, SvStringsSortDtor, -* SvStringsISort, SvStringsISortDtor, -* SvUShortsSort -*********************************************************************** -#endif - -#include "svtools/svldllapi.h" -#include - -//#ifdef _SVSTDARR_BOOLS -#ifndef _SVSTDARR_BOOLS_DECL -SV_DECL_VARARR_VISIBILITY( SvBools, BOOL, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_BOOLS_DECL -#endif -//#endif - -//#ifdef _SVSTDARR_BYTES -#ifndef _SVSTDARR_BYTES_DECL -SV_DECL_VARARR_VISIBILITY( SvBytes, BYTE, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_BYTES_DECL -#endif -//#endif - -//#ifdef _SVSTDARR_ULONGS -#ifndef _SVSTDARR_ULONGS_DECL -SV_DECL_VARARR_VISIBILITY( SvULongs, ULONG, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_ULONGS_DECL -#endif -//#endif - -//#ifdef _SVSTDARR_ULONGSSORT -#ifndef _SVSTDARR_ULONGSSORT_DECL -SV_DECL_VARARR_SORT_VISIBILITY( SvULongsSort, ULONG, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_ULONGSSORT_DECL -#endif -//#endif - -//#ifdef _SVSTDARR_USHORTS -#ifndef _SVSTDARR_USHORTS_DECL -SV_DECL_VARARR_VISIBILITY( SvUShorts, USHORT, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_USHORTS_DECL -#endif -//#endif - -//#ifdef _SVSTDARR_USHORTSSORT -#ifndef _SVSTDARR_USHORTSSORT_DECL - -typedef BOOL (*FnForEach_SvUShortsSort)( const USHORT&, void* ); -class SVL_DLLPUBLIC SvUShortsSort : __MWERKS__PRIVATE SvUShorts -{ -public: - SvUShortsSort(BYTE nSize = 1, BYTE nG = 1) - : SvUShorts(nSize,nG) {} - - void Insert( const SvUShortsSort *pI, USHORT nS=0, USHORT nE=USHRT_MAX ); - BOOL Insert( const USHORT aE ); - BOOL Insert( const USHORT aE, USHORT& rP ); - void Insert( const USHORT *pE, USHORT nL ); - // remove ab Pos - void RemoveAt( const USHORT nP, USHORT nL = 1 ); - // remove ab dem Eintrag - void Remove( const USHORT nP, USHORT nL = 1 ); - BOOL Seek_Entry( const USHORT aE, USHORT* pP = 0 ) const; - - USHORT Count() const { return SvUShorts::Count(); } - const USHORT* GetData() const { return (const USHORT*)pData; } - - const USHORT& operator[](USHORT nP) const { - return SvUShorts::operator[]( nP ); - } - const USHORT& GetObject(USHORT nP) const { - return SvUShorts::GetObject( nP ); - } - void ForEach( FnForEach_SvUShortsSort fnForEach, void* pArgs = 0 ) - { - _ForEach( 0, nA, (FnForEach_SvUShorts)fnForEach, pArgs ); - } - void ForEach( USHORT nS, USHORT nE, - FnForEach_SvUShortsSort fnForEach, void* pArgs = 0 ) - { - _ForEach( nS, nE, (FnForEach_SvUShorts)fnForEach, pArgs ); - } -private: - SvUShortsSort( const SvUShortsSort& ); - SvUShortsSort& operator=( const SvUShortsSort& ); -}; - -#define _SVSTDARR_USHORTSSORT_DECL -#endif -//#endif - -//#ifdef _SVSTDARR_LONGS -#ifndef _SVSTDARR_LONGS_DECL -SV_DECL_VARARR_VISIBILITY( SvLongs, long, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_LONGS_DECL -#endif -//#endif - -//#ifdef _SVSTDARR_LONGSSORT -#ifndef _SVSTDARR_LONGSSORT_DECL -SV_DECL_VARARR_SORT_VISIBILITY( SvLongsSort, long, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_LONGSSORT_DECL -#endif -//#endif - -//#ifdef _SVSTDARR_SHORTS -#ifndef _SVSTDARR_SHORTS_DECL -SV_DECL_VARARR_VISIBILITY( SvShorts, short, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_SHORTS_DECL -#endif -//#endif - -/* - form here all Arrays for Strings, ByteString and then - len of a string (xub_StrLen) -#if (defined(_SVSTDARR_STRINGS) && !defined(_SVSTDARR_STRINGS_DECL)) || \ - (defined(_SVSTDARR_STRINGSDTOR) && !defined(_SVSTDARR_STRINGSDTOR_DECL)) || \ - (defined(_SVSTDARR_STRINGSSORT) && !defined(_SVSTDARR_STRINGSSORT_DECL)) || \ - (defined(_SVSTDARR_STRINGSSORTDTOR) && !defined(_SVSTDARR_STRINGSSORTDTOR_DECL)) || \ - (defined(_SVSTDARR_STRINGSISORT) && !defined(_SVSTDARR_STRINGSISORT_DECL)) || \ - (defined(_SVSTDARR_STRINGSISORTDTOR) && !defined(_SVSTDARR_STRINGSISORTDTOR_DECL)) || \ - (defined(_SVSTDARR_BYTESTRINGS) && !defined(_SVSTDARR_BYTESTRINGS_DECL)) || \ - (defined(_SVSTDARR_BYTESTRINGSDTOR) && !defined(_SVSTDARR_BYTESTRINGSDTOR_DECL)) || \ - (defined(_SVSTDARR_BYTESTRINGSSORT) && !defined(_SVSTDARR_BYTESTRINGSSORT_DECL)) || \ - (defined(_SVSTDARR_BYTESTRINGSSORTDTOR) && !defined(_SVSTDARR_BYTESTRINGSSORTDTOR_DECL)) || \ - (defined(_SVSTDARR_BYTESTRINGSISORT) && !defined(_SVSTDARR_BYTESTRINGSISORT_DECL)) || \ - (defined(_SVSTDARR_BYTESTRINGSISORTDTOR) && !defined(_SVSTDARR_BYTESTRINGSISORTDTOR_DECL)) || \ - (defined(_SVSTDARR_XUB_STRLEN) && !defined(_SVSTDARR_XUB_STRLEN_DECL)) ||\ - (defined(_SVSTDARR_XUB_STRLENSORT) && !defined(_SVSTDARR_XUB_STRLENSORT_DECL)) -*/ -#include - -typedef String* StringPtr; -typedef ByteString* ByteStringPtr; - -//#endif - -//#ifdef _SVSTDARR_STRINGS -#ifndef _SVSTDARR_STRINGS_DECL -SV_DECL_PTRARR_VISIBILITY( SvStrings, StringPtr, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_STRINGS_DECL -#endif -//#endif - -//#ifdef _SVSTDARR_STRINGSDTOR -#ifndef _SVSTDARR_STRINGSDTOR_DECL -SV_DECL_PTRARR_DEL_VISIBILITY( SvStringsDtor, StringPtr, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_STRINGSDTOR_DECL -#endif -//#endif - -//#ifdef _SVSTDARR_STRINGSSORT -#ifndef _SVSTDARR_STRINGSSORT_DECL -SV_DECL_PTRARR_SORT_VISIBILITY( SvStringsSort, StringPtr, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_STRINGSSORT_DECL -#endif -//#endif - -//#ifdef _SVSTDARR_STRINGSSORTDTOR -#ifndef _SVSTDARR_STRINGSSORTDTOR_DECL -SV_DECL_PTRARR_SORT_DEL_VISIBILITY( SvStringsSortDtor, StringPtr, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_STRINGSSORTDTOR_DECL -#endif -//#endif - -//#ifdef _SVSTDARR_STRINGSISORT -#ifndef _SVSTDARR_STRINGSISORT_DECL -SV_DECL_PTRARR_SORT_VISIBILITY( SvStringsISort, StringPtr, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_STRINGSISORT_DECL -#endif -//#endif - -//#ifdef _SVSTDARR_STRINGSISORTDTOR -#ifndef _SVSTDARR_STRINGSISORTDTOR_DECL -SV_DECL_PTRARR_SORT_DEL_VISIBILITY( SvStringsISortDtor, StringPtr, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_STRINGSISORTDTOR_DECL -#endif -//#endif - -//#ifdef _SVSTDARR_BYTESTRINGS -#ifndef _SVSTDARR_BYTESTRINGS_DECL -SV_DECL_PTRARR_VISIBILITY( SvByteStrings, ByteStringPtr, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_BYTESTRINGS_DECL -#endif -//#endif - -//#ifdef _SVSTDARR_BYTESTRINGSDTOR -#ifndef _SVSTDARR_BYTESTRINGSDTOR_DECL -SV_DECL_PTRARR_DEL_VISIBILITY( SvByteStringsDtor, ByteStringPtr, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_BYTESTRINGSDTOR_DECL -#endif -//#endif - -//#ifdef _SVSTDARR_BYTESTRINGSSORT -#ifndef _SVSTDARR_BYTESTRINGSSORT_DECL -SV_DECL_PTRARR_SORT_VISIBILITY( SvByteStringsSort, ByteStringPtr, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_BYTESTRINGSSORT_DECL -#endif -//#endif - -//#ifdef _SVSTDARR_BYTESTRINGSSORTDTOR -#ifndef _SVSTDARR_BYTESTRINGSSORTDTOR_DECL -SV_DECL_PTRARR_SORT_DEL_VISIBILITY( SvByteStringsSortDtor, ByteStringPtr, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_BYTESTRINGSSORTDTOR_DECL -#endif -//#endif - -//#ifdef _SVSTDARR_BYTESTRINGSISORT -#ifndef _SVSTDARR_BYTESTRINGSISORT_DECL -SV_DECL_PTRARR_SORT_VISIBILITY( SvByteStringsISort, ByteStringPtr, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_BYTESTRINGSISORT_DECL -#endif -//#endif - -//#ifdef _SVSTDARR_BYTESTRINGSISORTDTOR -#ifndef _SVSTDARR_BYTESTRINGSISORTDTOR_DECL -SV_DECL_PTRARR_SORT_DEL_VISIBILITY( SvByteStringsISortDtor, ByteStringPtr, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_BYTESTRINGSISORTDTOR_DECL -#endif -//#endif - -//#ifdef _SVSTDARR_XUB_STRLEN -#ifndef _SVSTDARR_XUB_STRLEN_DECL -SV_DECL_VARARR_VISIBILITY( SvXub_StrLens, xub_StrLen, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_XUB_STRLEN_DECL -#endif -//#endif - -//#ifdef _SVSTDARR_XUB_STRLENSORT -#ifndef _SVSTDARR_XUB_STRLENSORT_DECL -SV_DECL_VARARR_SORT_VISIBILITY( SvXub_StrLensSort, xub_StrLen, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_XUB_STRLENSORT_DECL -#endif -//#endif - diff --git a/svtools/inc/svtools/svtools.hrc b/svtools/inc/svtools/svtools.hrc deleted file mode 100644 index 245d31a2dd21..000000000000 --- a/svtools/inc/svtools/svtools.hrc +++ /dev/null @@ -1,526 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: svtools.hrc,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVTOOLS_HRC -#define _SVTOOLS_HRC "$Revision: 1.0" - -#include - -#define RID_SVTOOLS_BITMAP_START (RID_SVTOOLS_START + 0) -#define RID_SVTOOLS_IMAGELIST_START (RID_SVTOOLS_START + 0) - -//............................................................................. -// various unsorted stuff - -#define DLG_EXPORT_PIX (RID_SVTOOLS_START+1) -#define DLG_EXPORT_VEC (RID_SVTOOLS_START+2) -#define DLG_TWAIN_SOURCE (RID_SVTOOLS_START+3) - -#define DLG_SVT_EXPLORERFILE (RID_SVTOOLS_START+4) -#define DLG_SVT_QUERYFOLDERNAME (RID_SVTOOLS_START+5) -#define DLG_SVT_QUERYDELETE (RID_SVTOOLS_START+6) - -#define EXPORT_DIALOG_TITLE (RID_SVTOOLS_START+4) -#define KEY_MODE (RID_SVTOOLS_START+5) -#define KEY_RES (RID_SVTOOLS_START+6) -#define KEY_SIZE (RID_SVTOOLS_START+7) - -#define KEY_COLORS (RID_SVTOOLS_START+9) -#define KEY_RLE_CODING (RID_SVTOOLS_START+10) - -#define STR_SVT_AUTOMATIC_COLOR (RID_SVTOOLS_START+16) - -#define STR_SVT_FILEVIEW_COLUMN_TITLE (RID_SVTOOLS_START + 20) -#define STR_SVT_FILEVIEW_COLUMN_SIZE (RID_SVTOOLS_START + 21) -#define STR_SVT_FILEVIEW_COLUMN_DATE (RID_SVTOOLS_START + 22) -#define STR_SVT_FOLDER (RID_SVTOOLS_START + 23) -#define STR_SVT_FILEVIEW_ERR_MAKEFOLDER (RID_SVTOOLS_START + 24) -#define STR_SVT_BYTES (RID_SVTOOLS_START + 25) -#define STR_SVT_KB (RID_SVTOOLS_START + 26) -#define STR_SVT_MB (RID_SVTOOLS_START + 27) -#define STR_SVT_GB (RID_SVTOOLS_START + 28) -#define STR_FILTERNAME_ALL (RID_SVTOOLS_START + 29) -#define STR_SVT_NEW_FOLDER (RID_SVTOOLS_START + 30) -#define STR_SVT_ALREADYEXISTOVERWRITE (RID_SVTOOLS_START + 31) -#define STR_SVT_FILEVIEW_COLUMN_TYPE (RID_SVTOOLS_START + 32) -#define RID_FILEVIEW_CONTEXTMENU (RID_SVTOOLS_START + 33) -#define RID_FILEOPEN_INVALIDFOLDER (RID_SVTOOLS_START + 34) -#define RID_FILEOPEN_NOTEXISTENTFILE (RID_SVTOOLS_START + 35) -#define STR_SVT_NOREMOVABLEDEVICE (RID_SVTOOLS_START + 36) - -// doc template dialog -#define DLG_DOCTEMPLATE (RID_SVTOOLS_START+50) -#define CTRL_FILEVIEW (RID_SVTOOLS_START+51) -#define STR_SVT_NEWDOC (RID_SVTOOLS_START+52) -#define STR_SVT_MYDOCS (RID_SVTOOLS_START+53) -#define STR_SVT_TEMPLATES (RID_SVTOOLS_START+54) -#define STR_SVT_SAMPLES (RID_SVTOOLS_START+55) -#define TB_SVT_FILEVIEW (RID_SVTOOLS_START+56) -#define TB_SVT_FRAMEWIN (RID_SVTOOLS_START+57) -#define STRARY_SVT_DOCINFO (RID_SVTOOLS_START+58) -#define STR_SVT_NEWDOC_HELP (RID_SVTOOLS_START+63) -#define STR_SVT_MYDOCS_HELP (RID_SVTOOLS_START+64) -#define STR_SVT_TEMPLATES_HELP (RID_SVTOOLS_START+65) -#define STR_SVT_SAMPLES_HELP (RID_SVTOOLS_START+66) - -#define STR_WARNING_ITEM (RID_SVTOOLS_START+90) -#define STR_CSTAT_NEVER_UPD (RID_SVTOOLS_START+91) -#define STR_CSTAT_IN_UPD (RID_SVTOOLS_START+92) -#define STR_CSTAT_UPD_NEWER (RID_SVTOOLS_START+93) -#define STR_CSTAT_UPD_NOT_NEWER (RID_SVTOOLS_START+94) -#define STR_CSTAT_UPD_CANCEL (RID_SVTOOLS_START+95) -#define STR_CSTAT_ERR_GENERAL (RID_SVTOOLS_START+96) -#define STR_CSTAT_ERR_NOTEXISTS (RID_SVTOOLS_START+97) -#define STR_CSTAT_ERR_NOTREACHED (RID_SVTOOLS_START+98) -#define STR_COLUM_DT_AUTO (RID_SVTOOLS_START+99) -#define STR_CSTAT_UPD_IMMEDIATELY (RID_SVTOOLS_START+100) -#define STR_CSTAT_ERR_OFFLINE (RID_SVTOOLS_START+101) - -#define CONFIG_BASIC_FORMAT_START (RID_SVTOOLS_START+102) -#define STR_BASICKEY_FORMAT_ON (RID_SVTOOLS_START+103) -#define STR_BASICKEY_FORMAT_OFF (RID_SVTOOLS_START+104) -#define STR_BASICKEY_FORMAT_YES (RID_SVTOOLS_START+105) -#define STR_BASICKEY_FORMAT_NO (RID_SVTOOLS_START+106) -#define STR_BASICKEY_FORMAT_TRUE (RID_SVTOOLS_START+107) -#define STR_BASICKEY_FORMAT_FALSE (RID_SVTOOLS_START+108) -#define CONFIG_BASIC_FORMAT_END (RID_SVTOOLS_START+109) - -#define STR_INVALIDTRYBUY (RID_SVTOOLS_START+120) -#define STR_OLDTRYBUY (RID_SVTOOLS_START+121) -#define STR_TRYBUY (RID_SVTOOLS_START+122) -#define STR_PVER_LANGUAGECODE (RID_SVTOOLS_START+124) -#define STR_PVER_LONG_LANGUAGECODE (RID_SVTOOLS_START+125) -#define STR_INVALIDPUFF (RID_SVTOOLS_START+126) -#define STR_LIMITEDPUFF (RID_SVTOOLS_START+127) -#define STR_OLDLIMITEDPUFF (RID_SVTOOLS_START+128) -#define RID_REGISTER_DIALOG (RID_SVTOOLS_START+129) -#define STR_BASICKEY_FORMAT_CURRENCY (RID_SVTOOLS_START+130) -#define STR_KEYERR_GENERAL_HELP (RID_SVTOOLS_START+131) -#define STR_KEYERR_INVALID_KEY (RID_SVTOOLS_START+132) -#define STR_KEYERR_INVALID_USERDATA (RID_SVTOOLS_START+133) -#define STR_KEYERR_INVALID_ADDRESSDATA (RID_SVTOOLS_START+134) -#define STR_KEYERR_INVALID_LICENSE (RID_SVTOOLS_START+135) -#define STR_KEYERR_INVALID_LANGUAGE (RID_SVTOOLS_START+136) -#define STR_KEYERR_INVALID_OS (RID_SVTOOLS_START+137) -#define STR_KEYERR_INVALID_NO_CNR (RID_SVTOOLS_START+138) -#define STR_KEYERR_INVALID_CNR (RID_SVTOOLS_START+139) -#define RID_LIMITED_DIALOG (RID_SVTOOLS_START+140) - -#define STR_SVT_MIMETYPE_START (RID_SVTOOLS_START+141) -#define STR_SVT_MIMETYPE_APP_OCTSTREAM (STR_SVT_MIMETYPE_START+0) -#define STR_SVT_MIMETYPE_APP_PDF (STR_SVT_MIMETYPE_START+1) -#define STR_SVT_MIMETYPE_APP_RTF (STR_SVT_MIMETYPE_START+2) -#define STR_SVT_MIMETYPE_APP_MSWORD (STR_SVT_MIMETYPE_START+3) -#define STR_SVT_MIMETYPE_APP_STARCALC (STR_SVT_MIMETYPE_START+4) -#define STR_SVT_MIMETYPE_APP_STARCHART (STR_SVT_MIMETYPE_START+5) -#define STR_SVT_MIMETYPE_APP_STARDRAW (STR_SVT_MIMETYPE_START+6) -#define STR_SVT_MIMETYPE_APP_STARIMAGE (STR_SVT_MIMETYPE_START+7) -#define STR_SVT_MIMETYPE_APP_STARMATH (STR_SVT_MIMETYPE_START+8) -#define STR_SVT_MIMETYPE_APP_STARWRITER (STR_SVT_MIMETYPE_START+9) -#define STR_SVT_MIMETYPE_APP_ZIP (STR_SVT_MIMETYPE_START+10) -#define STR_SVT_MIMETYPE_AUDIO_AIFF (STR_SVT_MIMETYPE_START+11) -#define STR_SVT_MIMETYPE_AUDIO_BASIC (STR_SVT_MIMETYPE_START+12) -#define STR_SVT_MIMETYPE_AUDIO_MIDI (STR_SVT_MIMETYPE_START+13) -#define STR_SVT_MIMETYPE_AUDIO_WAV (STR_SVT_MIMETYPE_START+14) -#define STR_SVT_MIMETYPE_IMAGE_GIF (STR_SVT_MIMETYPE_START+15) -#define STR_SVT_MIMETYPE_IMAGE_JPEG (STR_SVT_MIMETYPE_START+16) -#define STR_SVT_MIMETYPE_IMAGE_PCX (STR_SVT_MIMETYPE_START+17) -#define STR_SVT_MIMETYPE_IMAGE_BMP (STR_SVT_MIMETYPE_START+18) -#define STR_SVT_MIMETYPE_TEXT_HTML (STR_SVT_MIMETYPE_START+19) -#define STR_SVT_MIMETYPE_TEXT_PLAIN (STR_SVT_MIMETYPE_START+20) -#define STR_SVT_MIMETYPE_TEXT_URL (STR_SVT_MIMETYPE_START+21) -#define STR_SVT_MIMETYPE_TEXT_VCARD (STR_SVT_MIMETYPE_START+22) -#define STR_SVT_MIMETYPE_VIDEO_VDO (STR_SVT_MIMETYPE_START+23) -#define STR_SVT_MIMETYPE_VIDEO_MSVIDEO (STR_SVT_MIMETYPE_START+24) -#define STR_SVT_MIMETYPE_X_STARMAIL (STR_SVT_MIMETYPE_START+25) -#define STR_SVT_MIMETYPE_X_VRML (STR_SVT_MIMETYPE_START+26) -#define STR_SVT_MIMETYPE_APP_STARHELP (STR_SVT_MIMETYPE_START+27) -#define STR_SVT_MIMETYPE_APP_STARIMPRESS (STR_SVT_MIMETYPE_START+28) -#define STR_SVT_MIMETYPE_APP_SCHED_CMB (STR_SVT_MIMETYPE_START+29) -#define STR_SVT_MIMETYPE_APP_SCHED_EVT (STR_SVT_MIMETYPE_START+30) -#define STR_SVT_MIMETYPE_APP_SCHED_TASK (STR_SVT_MIMETYPE_START+31) -#define STR_SVT_MIMETYPE_APP_SCHED_TVIEW (STR_SVT_MIMETYPE_START+32) - -#define STR_SVT_MIMETYPE_CNT_MSG (STR_SVT_MIMETYPE_START+33) -#define STR_SVT_MIMETYPE_CNT_DOCUMENT (STR_SVT_MIMETYPE_START+34) -#define STR_SVT_MIMETYPE_CNT_POP3BOX (STR_SVT_MIMETYPE_START+35) -#define STR_SVT_MIMETYPE_CNT_IMAPBOX (STR_SVT_MIMETYPE_START+36) -#define STR_SVT_MIMETYPE_CNT_IMAPFLD (STR_SVT_MIMETYPE_START+37) -#define STR_SVT_MIMETYPE_CNT_VIMBOX (STR_SVT_MIMETYPE_START+38) -#define STR_SVT_MIMETYPE_CNT_VIMINBOX (STR_SVT_MIMETYPE_START+39) -#define STR_SVT_MIMETYPE_CNT_BBBOX (STR_SVT_MIMETYPE_START+40) -#define STR_SVT_MIMETYPE_CNT_VIM_BB (STR_SVT_MIMETYPE_START+41) -#define STR_SVT_MIMETYPE_CNT_NEWSBOX (STR_SVT_MIMETYPE_START+42) -#define STR_SVT_MIMETYPE_CNT_NEWSGRP (STR_SVT_MIMETYPE_START+43) -#define STR_SVT_MIMETYPE_CNT_OUTBOX (STR_SVT_MIMETYPE_START+44) -#define STR_SVT_MIMETYPE_CNT_FTPBOX (STR_SVT_MIMETYPE_START+45) -#define STR_SVT_MIMETYPE_CNT_FTPFLD (STR_SVT_MIMETYPE_START+46) -#define STR_SVT_MIMETYPE_CNT_FTPFILE (STR_SVT_MIMETYPE_START+47) -#define STR_SVT_MIMETYPE_CNT_FTPLINK (STR_SVT_MIMETYPE_START+48) -#define STR_SVT_MIMETYPE_CNT_HTTPBOX (STR_SVT_MIMETYPE_START+49) -#define STR_SVT_MIMETYPE_CNT_FSYSBOX (STR_SVT_MIMETYPE_START+50) -#define STR_SVT_MIMETYPE_CNT_FSYSFLD (STR_SVT_MIMETYPE_START+51) -#define STR_SVT_MIMETYPE_CNT_FSYSFILE (STR_SVT_MIMETYPE_START+52) -#define STR_SVT_MIMETYPE_CNT_FSYSURLFILE (STR_SVT_MIMETYPE_START+53) -#define STR_SVT_MIMETYPE_CNT_PUBLBOX (STR_SVT_MIMETYPE_START+54) -#define STR_SVT_MIMETYPE_CNT_SRCHBOX (STR_SVT_MIMETYPE_START+55) -#define STR_SVT_MIMETYPE_CNT_SUBSCRBOX (STR_SVT_MIMETYPE_START+56) -#define STR_SVT_MIMETYPE_CNT_BOOKMARK (STR_SVT_MIMETYPE_START+57) -#define STR_SVT_MIMETYPE_CNT_CDF (STR_SVT_MIMETYPE_START+58) -#define STR_SVT_MIMETYPE_CNT_CDFSUB (STR_SVT_MIMETYPE_START+59) -#define STR_SVT_MIMETYPE_CNT_CDFITEM (STR_SVT_MIMETYPE_START+60) -#define STR_SVT_MIMETYPE_CNT_STARCHANNEL (STR_SVT_MIMETYPE_START+61) -#define STR_SVT_MIMETYPE_CNT_TRASHBOX (STR_SVT_MIMETYPE_START+62) -#define STR_SVT_MIMETYPE_CNT_TRASH (STR_SVT_MIMETYPE_START+63) -#define STR_SVT_MIMETYPE_CNT_REMOV_VOL (STR_SVT_MIMETYPE_START+64) -#define STR_SVT_MIMETYPE_CNT_FIX_VOL (STR_SVT_MIMETYPE_START+65) -#define STR_SVT_MIMETYPE_CNT_REM_VOL (STR_SVT_MIMETYPE_START+66) -#define STR_SVT_MIMETYPE_CNT_RAM_VOL (STR_SVT_MIMETYPE_START+67) -#define STR_SVT_MIMETYPE_CNT_CDROM (STR_SVT_MIMETYPE_START+68) -#define STR_SVT_MIMETYPE_CNT_DISK_35 (STR_SVT_MIMETYPE_START+69) -#define STR_SVT_MIMETYPE_CNT_DISK_525 (STR_SVT_MIMETYPE_START+70) -#define STR_SVT_MIMETYPE_CNT_TAPEDRIVE (STR_SVT_MIMETYPE_START+71) -#define STR_SVT_MIMETYPE_APP_GAL (STR_SVT_MIMETYPE_START+72) -#define STR_SVT_MIMETYPE_APP_GAL_THEME (STR_SVT_MIMETYPE_START+73) -#define STR_SVT_MIMETYPE_CNT_SEPARATOR (STR_SVT_MIMETYPE_START+74) -#define STR_SVT_MIMETYPE_APP_STARW_GLOB (STR_SVT_MIMETYPE_START+75) -#define STR_SVT_MIMETYPE_APP_SDM (STR_SVT_MIMETYPE_START+76) -#define STR_SVT_MIMETYPE_APP_SMD (STR_SVT_MIMETYPE_START+77) -#define STR_SVT_MIMETYPE_APP_STARW_WEB (STR_SVT_MIMETYPE_START+78) -#define STR_SVT_MIMETYPE_SCHEDULE (STR_SVT_MIMETYPE_START+79) -#define STR_SVT_MIMETYPE_SCHEDULE_EVT (STR_SVT_MIMETYPE_START+80) -#define STR_SVT_MIMETYPE_SCHEDULE_TASK (STR_SVT_MIMETYPE_START+81) -#define STR_SVT_MIMETYPE_SCHEDULE_FEVT (STR_SVT_MIMETYPE_START+82) -#define STR_SVT_MIMETYPE_SCHEDULE_FTASK (STR_SVT_MIMETYPE_START+83) -#define STR_SVT_MIMETYPE_FRAMESET (STR_SVT_MIMETYPE_START+84) -#define STR_SVT_MIMETYPE_MACRO (STR_SVT_MIMETYPE_START+85) -#define STR_SVT_MIMETYPE_CNT_SFSYSFOLDER (STR_SVT_MIMETYPE_START+86) -#define STR_SVT_MIMETYPE_CNT_SFSYSFILE (STR_SVT_MIMETYPE_START+87) -#define STR_SVT_MIMETYPE_APP_TEMPLATE (STR_SVT_MIMETYPE_START+88) -#define STR_SVT_MIMETYPE_IMAGE_GENERIC (STR_SVT_MIMETYPE_START+89) -#define STR_SVT_MIMETYPE_APP_MSEXCEL (STR_SVT_MIMETYPE_START+90) -#define STR_SVT_MIMETYPE_APP_MSEXCEL_TEMPL (STR_SVT_MIMETYPE_START+91) -#define STR_SVT_MIMETYPE_APP_MSPPOINT (STR_SVT_MIMETYPE_START+92) -#define STR_SVT_MIMETYPE_TEXT_VCALENDAR (STR_SVT_MIMETYPE_START+93) -#define STR_SVT_MIMETYPE_TEXT_ICALENDAR (STR_SVT_MIMETYPE_START+94) -#define STR_SVT_MIMETYPE_TEXT_XMLICALENDAR (STR_SVT_MIMETYPE_START+95) -#define STR_SVT_MIMETYPE_TEXT_CDE_CALENDAR_APP (STR_SVT_MIMETYPE_START+96) -#define STR_SVT_MIMETYPE_INET_MSG_RFC822 (STR_SVT_MIMETYPE_START+97) -#define STR_SVT_MIMETYPE_INET_MULTI_ALTERNATIVE (STR_SVT_MIMETYPE_START+98) -#define STR_SVT_MIMETYPE_INET_MULTI_DIGEST (STR_SVT_MIMETYPE_START+99) -#define STR_SVT_MIMETYPE_INET_MULTI_PARALLEL (STR_SVT_MIMETYPE_START+100) -#define STR_SVT_MIMETYPE_INET_MULTI_RELATED (STR_SVT_MIMETYPE_START+101) -#define STR_SVT_MIMETYPE_INET_MULTI_MIXED (STR_SVT_MIMETYPE_START+102) -#define STR_SVT_MIMETYPE_APP_IMPRESSPACKED (STR_SVT_MIMETYPE_START+103) -#define STR_SVT_MIMETYPE_APP_JAR (STR_SVT_MIMETYPE_START+104) -#define STR_SVT_MIMETYPE_IMAGE_PNG (STR_SVT_MIMETYPE_START+105) -#define STR_SVT_MIMETYPE_IMAGE_TIFF (STR_SVT_MIMETYPE_START+106) - -#define STR_SVT_MIMETYPE_APP_SXCALC (STR_SVT_MIMETYPE_START+107) -#define STR_SVT_MIMETYPE_APP_SXCHART (STR_SVT_MIMETYPE_START+108) -#define STR_SVT_MIMETYPE_APP_SXDRAW (STR_SVT_MIMETYPE_START+109) -#define STR_SVT_MIMETYPE_APP_SXMATH (STR_SVT_MIMETYPE_START+110) -#define STR_SVT_MIMETYPE_APP_SXWRITER (STR_SVT_MIMETYPE_START+111) -#define STR_SVT_MIMETYPE_APP_SXIMPRESS (STR_SVT_MIMETYPE_START+112) -#define STR_SVT_MIMETYPE_APP_SXGLOBAL (STR_SVT_MIMETYPE_START+113) -#define STR_SVT_MIMETYPE_APP_SXIPACKED (STR_SVT_MIMETYPE_START+114) -#define STR_SVT_MIMETYPE_END (STR_SVT_MIMETYPE_APP_SXIPACKED) - -#define STR_SVT_PRNDLG_START (STR_SVT_MIMETYPE_END+1) -#define DLG_SVT_PRNDLG_PRNSETUPDLG (STR_SVT_PRNDLG_START+0) -#define DLG_SVT_PRNDLG_PRINTDLG (STR_SVT_PRNDLG_START+1) -#define STR_SVT_PRNDLG_READY (STR_SVT_PRNDLG_START+2) -#define STR_SVT_PRNDLG_PAUSED (STR_SVT_PRNDLG_START+3) -#define STR_SVT_PRNDLG_PENDING (STR_SVT_PRNDLG_START+4) -#define STR_SVT_PRNDLG_BUSY (STR_SVT_PRNDLG_START+5) -#define STR_SVT_PRNDLG_INITIALIZING (STR_SVT_PRNDLG_START+6) -#define STR_SVT_PRNDLG_WAITING (STR_SVT_PRNDLG_START+7) -#define STR_SVT_PRNDLG_WARMING_UP (STR_SVT_PRNDLG_START+8) -#define STR_SVT_PRNDLG_PROCESSING (STR_SVT_PRNDLG_START+9) -#define STR_SVT_PRNDLG_PRINTING (STR_SVT_PRNDLG_START+10) -#define STR_SVT_PRNDLG_OFFLINE (STR_SVT_PRNDLG_START+11) -#define STR_SVT_PRNDLG_ERROR (STR_SVT_PRNDLG_START+12) -#define STR_SVT_PRNDLG_SERVER_UNKNOWN (STR_SVT_PRNDLG_START+13) -#define STR_SVT_PRNDLG_PAPER_JAM (STR_SVT_PRNDLG_START+14) -#define STR_SVT_PRNDLG_PAPER_OUT (STR_SVT_PRNDLG_START+15) -#define STR_SVT_PRNDLG_MANUAL_FEED (STR_SVT_PRNDLG_START+16) -#define STR_SVT_PRNDLG_PAPER_PROBLEM (STR_SVT_PRNDLG_START+17) -#define STR_SVT_PRNDLG_IO_ACTIVE (STR_SVT_PRNDLG_START+18) -#define STR_SVT_PRNDLG_OUTPUT_BIN_FULL (STR_SVT_PRNDLG_START+19) -#define STR_SVT_PRNDLG_TONER_LOW (STR_SVT_PRNDLG_START+20) -#define STR_SVT_PRNDLG_NO_TONER (STR_SVT_PRNDLG_START+21) -#define STR_SVT_PRNDLG_PAGE_PUNT (STR_SVT_PRNDLG_START+22) -#define STR_SVT_PRNDLG_USER_INTERVENTION (STR_SVT_PRNDLG_START+23) -#define STR_SVT_PRNDLG_OUT_OF_MEMORY (STR_SVT_PRNDLG_START+24) -#define STR_SVT_PRNDLG_DOOR_OPEN (STR_SVT_PRNDLG_START+25) -#define STR_SVT_PRNDLG_POWER_SAVE (STR_SVT_PRNDLG_START+26) -#define STR_SVT_PRNDLG_DEFPRINTER (STR_SVT_PRNDLG_START+27) -#define STR_SVT_PRNDLG_JOBCOUNT (STR_SVT_PRNDLG_START+28) -#define STR_SVT_PRNDLG_END (RID_IMG_PRNDLG_NOCOLLATE_HC) - -#define STR_SVT_CALENDAR_START (STR_SVT_PRNDLG_END+1) -#define STR_SVT_CALENDAR_DAY (STR_SVT_CALENDAR_START+0) -#define STR_SVT_CALENDAR_WEEK (STR_SVT_CALENDAR_START+1) -#define STR_SVT_CALENDAR_TODAY (STR_SVT_CALENDAR_START+2) -#define STR_SVT_CALENDAR_NONE (STR_SVT_CALENDAR_START+3) -#define STR_SVT_CALENDAR_END (STR_SVT_CALENDAR_NONE) - -#define STR_SVT_PVER_START (STR_SVT_CALENDAR_END+1) -#define STR_SVT_PVER_INTERNAL (STR_SVT_PVER_START+0) -#define STR_SVT_PVER_PERSONAL_DELUXE (STR_SVT_PVER_START+1) -#define STR_SVT_PVER_PERSONAL (STR_SVT_PVER_START+2) -#define STR_SVT_PVER_PROFESSIONAL (STR_SVT_PVER_START+3) -#define STR_SVT_PVER_BUSINESS (STR_SVT_PVER_START+4) -#define STR_SVT_PVER_ENTERPRICE (STR_SVT_PVER_START+5) -#define STR_SVT_PVER_EDUCATION (STR_SVT_PVER_START+6) -#define STR_SVT_PVER_DEMO (STR_SVT_PVER_START+7) -#define STR_SVT_PVER_BETA (STR_SVT_PVER_START+8) -#define STR_SVT_PVER_OEM (STR_SVT_PVER_START+9) -#define STR_SVT_PVER_NOT_REGISTERED (STR_SVT_PVER_START+10) -#define STR_SVT_PVER_PILOT (STR_SVT_PVER_START+11) -#define STR_SVT_PVER_CAMPUS (STR_SVT_PVER_START+12) -#define STR_SVT_PVER_EVALUATION (STR_SVT_PVER_START+13) -#define STR_SVT_PVER_PARTNER (STR_SVT_PVER_START+14) -#define STR_SVT_PVER_SMALLBUSINESS (STR_SVT_PVER_START+15) -#define STR_SVT_PVER_OEM_PROFESSIONAL (STR_SVT_PVER_START+16) -#define STR_SVT_PVER_END (STR_SVT_PVER_OEM_PROFESSIONAL) - -#define STR_SVT_STYLE_START (STR_SVT_PVER_END+1) -#define STR_SVT_STYLE_LIGHT (STR_SVT_STYLE_START+0) -#define STR_SVT_STYLE_LIGHT_ITALIC (STR_SVT_STYLE_START+1) -#define STR_SVT_STYLE_NORMAL (STR_SVT_STYLE_START+2) -#define STR_SVT_STYLE_NORMAL_ITALIC (STR_SVT_STYLE_START+3) -#define STR_SVT_STYLE_BOLD (STR_SVT_STYLE_START+4) -#define STR_SVT_STYLE_BOLD_ITALIC (STR_SVT_STYLE_START+5) -#define STR_SVT_STYLE_BLACK (STR_SVT_STYLE_START+6) -#define STR_SVT_STYLE_BLACK_ITALIC (STR_SVT_STYLE_START+7) -#define STR_SVT_STYLE_END (STR_SVT_STYLE_BLACK_ITALIC) - -#define STR_SVT_FONTMAP_START (STR_SVT_STYLE_END+1) -#define STR_SVT_FONTMAP_BOTH (STR_SVT_FONTMAP_START+0) -#define STR_SVT_FONTMAP_PRINTERONLY (STR_SVT_FONTMAP_START+1) -#define STR_SVT_FONTMAP_SCREENONLY (STR_SVT_FONTMAP_START+2) -#define STR_SVT_FONTMAP_SIZENOTAVAILABLE (STR_SVT_FONTMAP_START+3) -#define STR_SVT_FONTMAP_STYLENOTAVAILABLE (STR_SVT_FONTMAP_START+4) -#define STR_SVT_FONTMAP_NOTAVAILABLE (STR_SVT_FONTMAP_START+5) -#define STR_SVT_FONTMAP_END (STR_SVT_FONTMAP_NOTAVAILABLE) - -#define STR_SVT_ERRORCONTEXT_START (STR_SVT_FONTMAP_END+1) -#define STR_ERR_HDLMESS (STR_SVT_ERRORCONTEXT_START+0) -#define RID_ERRHDL_CLASS (STR_SVT_ERRORCONTEXT_START+1) -#define RID_ERRCTX (STR_SVT_ERRORCONTEXT_START+2) -#define RID_ERRHDL (STR_SVT_ERRORCONTEXT_START+3) -#define STR_SVT_ERRORCONTEXT_END (RID_ERRHDL) - -#define STR_WIZARDDIALOG_START (STR_SVT_ERRORCONTEXT_END + 1) -#define STR_WIZDLG_FINISH (STR_WIZARDDIALOG_START + 0) -#define STR_WIZDLG_NEXT (STR_WIZARDDIALOG_START + 1) -#define STR_WIZDLG_PREVIOUS (STR_WIZARDDIALOG_START + 2) -#define STR_WIZDLG_ROADMAP_TITLE (STR_WIZARDDIALOG_START + 3) -#define STR_WIZARDDIALOG_END (STR_WIZDLG_ROADMAP_TITLE) - -#define STR_SVT_COLLATE_START (STR_WIZARDDIALOG_END+1) -#define STR_SVT_COLLATE_NORMAL (STR_SVT_COLLATE_START+0) -#define STR_SVT_COLLATE_DICTIONARY (STR_SVT_COLLATE_START+1) -#define STR_SVT_COLLATE_PINYIN (STR_SVT_COLLATE_START+2) -#define STR_SVT_COLLATE_STROKE (STR_SVT_COLLATE_START+3) -#define STR_SVT_COLLATE_RADICAL (STR_SVT_COLLATE_START+4) -#define STR_SVT_COLLATE_CHARSET (STR_SVT_COLLATE_START+5) -#define STR_SVT_COLLATE_ZHUYIN (STR_SVT_COLLATE_START+6) -#define STR_SVT_COLLATE_ALPHANUMERIC (STR_SVT_COLLATE_START+7) -#define STR_SVT_COLLATE_UNICODE (STR_SVT_COLLATE_START+8) -#define STR_SVT_COLLATE_PHONEBOOK (STR_SVT_COLLATE_START+9) -#define STR_SVT_COLLATE_PHONETIC_F (STR_SVT_COLLATE_START+10) -#define STR_SVT_COLLATE_PHONETIC_L (STR_SVT_COLLATE_START+11) -#define STR_SVT_COLLATE_END (STR_SVT_COLLATE_PHONETIC_L) - -#define STR_SVT_FILEPICKER_START (STR_SVT_COLLATE_END+1) -#define STR_SVT_FILEPICKER_AUTO_EXTENSION (STR_SVT_FILEPICKER_START+ 0) -#define STR_SVT_FILEPICKER_PASSWORD (STR_SVT_FILEPICKER_START+ 1) -#define STR_SVT_FILEPICKER_FILTER_OPTIONS (STR_SVT_FILEPICKER_START+ 2) -#define STR_SVT_FILEPICKER_READONLY (STR_SVT_FILEPICKER_START+ 3) -#define STR_SVT_FILEPICKER_INSERT_AS_LINK (STR_SVT_FILEPICKER_START+ 4) -#define STR_SVT_FILEPICKER_SHOW_PREVIEW (STR_SVT_FILEPICKER_START+ 5) -#define STR_SVT_FILEPICKER_PLAY (STR_SVT_FILEPICKER_START+ 6) -#define STR_SVT_FILEPICKER_VERSION (STR_SVT_FILEPICKER_START+ 7) -#define STR_SVT_FILEPICKER_TEMPLATES (STR_SVT_FILEPICKER_START+ 8) -#define STR_SVT_FILEPICKER_IMAGE_TEMPLATE (STR_SVT_FILEPICKER_START+ 9) -#define STR_SVT_FILEPICKER_SELECTION (STR_SVT_FILEPICKER_START+10) -#define STR_SVT_FILEPICKER_FILTER_TITLE (STR_SVT_FILEPICKER_START+11) -#define STR_SVT_FOLDERPICKER_DEFAULT_TITLE (STR_SVT_FILEPICKER_START+12) -#define STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION (STR_SVT_FILEPICKER_START+13) -#define STR_SVT_FILEPICKER_END (STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION) - -// String-Ids for accessibility -#define STR_SVT_ACC_BEGIN (STR_SVT_FILEPICKER_END+1) - // FREE - // FREE -#define STR_SVT_ACC_DESC_TABLISTBOX (STR_SVT_ACC_BEGIN+2) -#define STR_SVT_ACC_DESC_FILEVIEW (STR_SVT_ACC_BEGIN+3) -#define STR_SVT_ACC_DESC_FOLDER (STR_SVT_ACC_BEGIN+4) -#define STR_SVT_ACC_DESC_FILE (STR_SVT_ACC_BEGIN+5) -#define STR_SVT_ACC_EMPTY_FIELD (STR_SVT_ACC_BEGIN+6) -#define STR_SVT_ACC_END (STR_SVT_ACC_EMPTY_FIELD) - -#define STR_SVT_INDEXENTRY_START (STR_SVT_ACC_END + 1) -#define STR_SVT_INDEXENTRY_ALPHANUMERIC (STR_SVT_INDEXENTRY_START+0) -#define STR_SVT_INDEXENTRY_DICTIONARY (STR_SVT_INDEXENTRY_START+1) -#define STR_SVT_INDEXENTRY_PINYIN (STR_SVT_INDEXENTRY_START+2) -#define STR_SVT_INDEXENTRY_RADICAL (STR_SVT_INDEXENTRY_START+3) -#define STR_SVT_INDEXENTRY_STROKE (STR_SVT_INDEXENTRY_START+4) -#define STR_SVT_INDEXENTRY_ZHUYIN (STR_SVT_INDEXENTRY_START+5) -#define STR_SVT_INDEXENTRY_PHONETIC_FS (STR_SVT_INDEXENTRY_START+6) -#define STR_SVT_INDEXENTRY_PHONETIC_FC (STR_SVT_INDEXENTRY_START+7) -#define STR_SVT_INDEXENTRY_PHONETIC_LS (STR_SVT_INDEXENTRY_START+8) -#define STR_SVT_INDEXENTRY_PHONETIC_LC (STR_SVT_INDEXENTRY_START+9) -#define STR_SVT_INDEXENTRY_END (STR_SVT_INDEXENTRY_PHONETIC_LC) - -//String - Ids for Java errors, messages -//These strings come from project desktop -//There was no time for translation, therefore the defines needed to -//remain the same. -#define STR_SVT_JAVAERROR_START (STR_SVT_INDEXENTRY_END + 1) -#define STR_QUESTION_JAVADISABLED (STR_SVT_JAVAERROR_START+0) -#define STR_ERROR_JVMCREATIONFAILED (STR_SVT_JAVAERROR_START+1) -#define STR_WARNING_JAVANOTFOUND (STR_SVT_JAVAERROR_START+2) -#define STR_WARNING_INVALIDJAVASETTINGS (STR_SVT_JAVAERROR_START+3) -#define STR_ERROR_RESTARTREQUIRED (STR_SVT_JAVAERROR_START+4) -#define STR_SVT_JAVAERROR_END (STR_ERROR_RESTARTREQUIRED) - -// String array to match UI language names to LanguageType values and vice versa -#define STR_ARR_SVT_LANGUAGE_TABLE_START (STR_SVT_JAVAERROR_END + 1) -#define STR_ARR_SVT_LANGUAGE_TABLE (STR_ARR_SVT_LANGUAGE_TABLE_START + 0) -#define STR_ARR_SVT_LANGUAGE_TABLE_END (STR_ARR_SVT_LANGUAGE_TABLE) - -//............................................................................. -// dialogs - -#define DLG_EXPORT_JPG_START (RID_SVTOOLS_START+110) -#define DLG_EXPORT_JPG (RID_SVTOOLS_START+111) -#define DLG_EXPORT_JPG_END (RID_SVTOOLS_START+112) - -#define DLG_LOGIN (RID_SVTOOLS_START+113) -#define DLG_ADDRESSBOOKSOURCE (RID_SVTOOLS_START+114) - -#define DLG_REGISTRATION_REQUEST (RID_SVTOOLS_START+115) - -#define DLG_EXPORT_EPNG (RID_SVTOOLS_START+116) -//............................................................................. -// bitmaps - -#define BMP_DEMO_FINGER (RID_SVTOOLS_BITMAP_START + 0) -#define BMP_HELP_AGENT_IMAGE (RID_SVTOOLS_BITMAP_START + 1) -#define BMP_HELP_AGENT_CLOSER (RID_SVTOOLS_BITMAP_START + 2) -#define BMP_PLUGIN (RID_SVTOOLS_BITMAP_START + 3) - -//............................................................................. -// image lists - -#define RID_IMG_EXPANDER (RID_SVTOOLS_IMAGELIST_START + 0) -#define RID_SVTOOLS_IMAGELIST_BIG (RID_SVTOOLS_IMAGELIST_START + 1) -#define RID_SVTOOLS_IMAGELIST_SMALL (RID_SVTOOLS_IMAGELIST_START + 2) -#define RID_SVTOOLS_IMAGELIST_EDITBROWSEBOX (RID_SVTOOLS_IMAGELIST_START + 3) -#define RID_SVTOOLS_IMAGELIST_BIG_HIGHCONTRAST (RID_SVTOOLS_IMAGELIST_START + 4) -#define RID_SVTOOLS_IMAGELIST_SMALL_HIGHCONTRAST (RID_SVTOOLS_IMAGELIST_START + 5) -#define RID_SVTOOLS_IMAGELIST_EDITBWSEBOX_H (RID_SVTOOLS_IMAGELIST_START + 6) -#define RID_FILEPICKER_IMAGES (RID_SVTOOLS_IMAGELIST_START + 7) -#define RID_FILEPICKER_IMAGES_HC (RID_SVTOOLS_IMAGELIST_START + 8) - -//............................................................................. -// error boxes -#define ERRBOX_REG_NOSYSBROWSER ( RID_SVTOOLS_START + 0 ) -#define ERRBOX_CHECK_PLZ ( RID_SVTOOLS_START + 11 ) - -// Java message boxes -//These strings come from project desktop -//There was no time for translation, therefore the defines needed to -//remain the same. -#define QBX_JAVADISABLED (RID_SVTOOLS_START+20) -#define ERRORBOX_JVMCREATIONFAILED (RID_SVTOOLS_START+21) -#define WARNINGBOX_JAVANOTFOUND (RID_SVTOOLS_START+22) -#define WARNINGBOX_INVALIDJAVASETTINGS (RID_SVTOOLS_START+23) -#define ERRORBOX_RESTARTREQUIRED (RID_SVTOOLS_START+24) - -//............................................................................. -// images -#define RID_IMG_TREENODE_COLLAPSED (RID_SVTOOLS_START + 0) -#define RID_IMG_TREENODE_EXPANDED (RID_SVTOOLS_START + 1) -#define RID_IMG_TREENODE_COLLAPSED_HC (RID_SVTOOLS_START + 2) -#define RID_IMG_TREENODE_EXPANDED_HC (RID_SVTOOLS_START + 3) - -#define RID_IMG_PRINTERFONT (RID_SVTOOLS_START + 12) -#define RID_IMG_BITMAPFONT (RID_SVTOOLS_START + 13) -#define RID_IMG_SCALABLEFONT (RID_SVTOOLS_START + 14) -#define RID_IMG_PRINTERFONT_HC (RID_SVTOOLS_START + 15) -#define RID_IMG_BITMAPFONT_HC (RID_SVTOOLS_START + 16) -#define RID_IMG_SCALABLEFONT_HC (RID_SVTOOLS_START + 17) - -#define IMG_SVT_FOLDER (RID_SVTOOLS_START + 40) - -#define IMG_SVT_NEWDOC (RID_SVTOOLS_START + 52) -#define IMG_SVT_MYDOCS (RID_SVTOOLS_START + 53) -#define IMG_SVT_TEMPLATES (RID_SVTOOLS_START + 54) -#define IMG_SVT_SAMPLES (RID_SVTOOLS_START + 55) - -#define IMG_SVT_NEWDOC_HC (RID_SVTOOLS_START + 59) -#define IMG_SVT_MYDOCS_HC (RID_SVTOOLS_START + 60) -#define IMG_SVT_TEMPLATES_HC (RID_SVTOOLS_START + 61) -#define IMG_SVT_SAMPLES_HC (RID_SVTOOLS_START + 62) - -#define IMG_SVT_DOCTEMPLATE_BACK_SMALL (RID_SVTOOLS_START + 70) -#define IMG_SVT_DOCTEMPLATE_BACK_LARGE (RID_SVTOOLS_START + 71) -#define IMG_SVT_DOCTEMPLATE_PREV_SMALL (RID_SVTOOLS_START + 72) -#define IMG_SVT_DOCTEMPLATE_PREV_LARGE (RID_SVTOOLS_START + 73) -#define IMG_SVT_DOCTEMPLATE_PRINT_SMALL (RID_SVTOOLS_START + 74) -#define IMG_SVT_DOCTEMPLATE_PRINT_LARGE (RID_SVTOOLS_START + 75) -#define IMG_SVT_DOCTEMPLATE_DOCINFO_SMALL (RID_SVTOOLS_START + 76) -#define IMG_SVT_DOCTEMPLATE_DOCINFO_LARGE (RID_SVTOOLS_START + 77) -#define IMG_SVT_DOCTEMPLATE_PREVIEW_SMALL (RID_SVTOOLS_START + 78) -#define IMG_SVT_DOCTEMPLATE_PREVIEW_LARGE (RID_SVTOOLS_START + 79) - -#define IMG_SVT_DOCTEMPL_HC_BACK_SMALL (RID_SVTOOLS_START + 80) -#define IMG_SVT_DOCTEMPL_HC_BACK_LARGE (RID_SVTOOLS_START + 81) -#define IMG_SVT_DOCTEMPL_HC_PREV_SMALL (RID_SVTOOLS_START + 82) -#define IMG_SVT_DOCTEMPL_HC_PREV_LARGE (RID_SVTOOLS_START + 83) -#define IMG_SVT_DOCTEMPL_HC_PRINT_SMALL (RID_SVTOOLS_START + 84) -#define IMG_SVT_DOCTEMPL_HC_PRINT_LARGE (RID_SVTOOLS_START + 85) -#define IMG_SVT_DOCTEMPL_HC_DOCINFO_SMALL (RID_SVTOOLS_START + 86) -#define IMG_SVT_DOCTEMPL_HC_DOCINFO_LARGE (RID_SVTOOLS_START + 87) -#define IMG_SVT_DOCTEMPL_HC_PREVIEW_SMALL (RID_SVTOOLS_START + 88) -#define IMG_SVT_DOCTEMPL_HC_PREVIEW_LARGE (RID_SVTOOLS_START + 89) - -#define RID_IMG_PRNDLG_COLLATE (STR_SVT_PRNDLG_START + 29) -#define RID_IMG_PRNDLG_NOCOLLATE (STR_SVT_PRNDLG_START + 30) -#define RID_IMG_PRNDLG_COLLATE_HC (STR_SVT_PRNDLG_START + 31) -#define RID_IMG_PRNDLG_NOCOLLATE_HC (STR_SVT_PRNDLG_START + 32) - -#endif // #ifndef _SVTOOLS_HRC - -// ******************************************************************* EOF - diff --git a/svtools/inc/svtools/syslocale.hxx b/svtools/inc/svtools/syslocale.hxx deleted file mode 100644 index bd853d0d4eeb..000000000000 --- a/svtools/inc/svtools/syslocale.hxx +++ /dev/null @@ -1,78 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: syslocale.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_SVTOOLS_SYSLOCALE_HXX -#define INCLUDED_SVTOOLS_SYSLOCALE_HXX - -#include "svtools/svtdllapi.h" -#include -#include -#include - - -class SvtSysLocale_Impl; -namespace osl { class Mutex; } -class LocaleDataWrapper; - -/** - SvtSysLocale provides a refcounted single instance of an application wide - LocaleDataWrapper and CharClass which always - follow the locale as it is currently configured by the user. You may use - it anywhere to access the locale data elements like decimal separator and - simple date formatting and so on. Contructing and destructing a - SvtSysLocale is not expensive as long as there is at least one instance - left. - */ -class SVT_DLLPUBLIC SvtSysLocale -{ - friend class SvtSysLocale_Impl; // access to mutex - - static SvtSysLocale_Impl* pImpl; - static sal_Int32 nRefCount; - - SVT_DLLPRIVATE static ::osl::Mutex& GetMutex(); - -public: - SvtSysLocale(); - ~SvtSysLocale(); - - const LocaleDataWrapper& GetLocaleData() const; - const CharClass& GetCharClass() const; - - /** It is safe to store the pointers locally and use them AS LONG AS THE - INSTANCE OF SvtSysLocale LIVES! - It is a faster access but be sure what you do! - */ - const LocaleDataWrapper* GetLocaleDataPtr() const; - const CharClass* GetCharClassPtr() const; - -}; - -#endif // INCLUDED_SVTOOLS_SYSLOCALE_HXX diff --git a/svtools/inc/svtools/syslocaleoptions.hxx b/svtools/inc/svtools/syslocaleoptions.hxx deleted file mode 100644 index 8b03785d541e..000000000000 --- a/svtools/inc/svtools/syslocaleoptions.hxx +++ /dev/null @@ -1,164 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: syslocaleoptions.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX -#define INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX - -#include "svtools/svtdllapi.h" -#include -#include -#include -#include -#include -#include -#include - -// bits for broadcasting hints of changes in a SfxSimpleHint, may be combined -const ULONG SYSLOCALEOPTIONS_HINT_LOCALE = 0x00000001; -const ULONG SYSLOCALEOPTIONS_HINT_CURRENCY = 0x00000002; - -class SvtSysLocaleOptions_Impl; -class SvtListener; -namespace osl { class Mutex; } - -class SVT_DLLPUBLIC SvtSysLocaleOptions: public utl::detail::Options -{ - static SvtSysLocaleOptions_Impl* pOptions; - static sal_Int32 nRefCount; - - SVT_DLLPRIVATE static ::osl::Mutex& GetMutex(); - -public: - - enum EOption - { - E_LOCALE, - E_CURRENCY - }; - SvtSysLocaleOptions(); - virtual ~SvtSysLocaleOptions(); - - // ConfigItem methods - - sal_Bool IsModified(); - void Commit(); - - /** Add a listener to react on config changes - which are broadcasted in a SfxSimpleHint - @return - if added - if not added - */ - BOOL AddListener( SvtListener& ); - BOOL RemoveListener( SvtListener& ); - - /** Block broadcasts and accumulate hints. This may be useful if, for - example, the locale and currency are changed and the currency was - empty before, since changing the locale with an empty currency does - also broadcast a change hint for the currency which would result in - two currency changes broadcasted. - - @param bBlock - : broadcasts are blocked until reversed. - : broadcasts are not blocked anymore. Pending hints are - broadcasted if no other instance blocks the broadcast. - - @ATTENTION - All SvtSysLocaleOptions instances point to exactly one refcounted - internal representation instance and broadcast blocks are counted. - Thus if you issue a BlockBroadcasts(TRUE) you MUST issue a matching - BlockBroadcasts(FALSE) or otherwise pending hints would never be - broadcasted again. - */ - void BlockBroadcasts( BOOL bBlock ); - - // config value access methods - - /// The config string may be empty to denote the SYSTEM locale - const ::rtl::OUString& GetLocaleConfigString() const; - void SetLocaleConfigString( const ::rtl::OUString& rStr ); - - /// The config string may be empty to denote the default currency of the locale - const ::rtl::OUString& GetCurrencyConfigString() const; - void SetCurrencyConfigString( const ::rtl::OUString& rStr ); - // determine whether the decimal separator defined in the keyboard layout is used - // or the one approriate to the locale - sal_Bool IsDecimalSeparatorAsLocale() const; - void SetDecimalSeparatorAsLocale( sal_Bool bSet); - - // convenience methods - - /** Get the LanguageType of the current locale, may be LANGUAGE_SYSTEM if - LocaleConfigString is empty. If you need the real locale used in the - application, call Application::GetSettings().GetLanguage() instead */ - LanguageType GetLocaleLanguageType() const; - - /// Get currency abbreviation and locale from an USD-en-US or EUR-de-DE string - static void GetCurrencyAbbrevAndLanguage( - String& rAbbrev, - LanguageType& eLang, - const ::rtl::OUString& rConfigString ); - - /// Create an USD-en-US or EUR-de-DE string - static ::rtl::OUString CreateCurrencyConfigString( - const String& rAbbrev, - LanguageType eLang ); - - void GetCurrencyAbbrevAndLanguage( - String& rAbbrev, - LanguageType& eLang ) const - { - GetCurrencyAbbrevAndLanguage( rAbbrev, - eLang, GetCurrencyConfigString() ); - } - - void SetCurrencyAbbrevAndLanguage( - const String& rAbbrev, - LanguageType eLang ) - { - SetCurrencyConfigString( - CreateCurrencyConfigString( - rAbbrev, eLang ) ); - } - - /** Set a link to a method to be called whenever the default currency - changes. This can be only one method, and normally it is the static - link method which calls SvNumberFormatter::SetDefaultSystemCurrency(). - This is needed because the number formatter isn't part of the svl light - library, otherwise we could call SetDefaultSystemCurrency() directly. - */ - static void SetCurrencyChangeLink( const Link& rLink ); - static const Link& GetCurrencyChangeLink(); - - /** return the readonly state of the queried option. */ - sal_Bool IsReadOnly( EOption eOption ) const; -}; - -#endif // INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX diff --git a/svtools/inc/svtools/szitem.hxx b/svtools/inc/svtools/szitem.hxx deleted file mode 100644 index d3fb920aa012..000000000000 --- a/svtools/inc/svtools/szitem.hxx +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: szitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFXSZITEM_HXX -#define _SFXSZITEM_HXX - -#include - -#include - -class SfxArguments; -class SvStream; - -DBG_NAMEEX(SfxSizeItem) - -// ----------------------------------------------------------------------- - -class SfxSizeItem : public SfxPoolItem -{ -private: - Size aVal; - -public: - TYPEINFO(); - SfxSizeItem(); - SfxSizeItem( USHORT nWhich, const Size& rVal ); - SfxSizeItem( USHORT nWhich, SvStream & ); - SfxSizeItem( const SfxSizeItem& ); - ~SfxSizeItem() { DBG_DTOR(SfxSizeItem, 0); } - - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper * = 0 ) const; - - virtual int operator==( const SfxPoolItem& ) const; - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; - virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); - - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT nItemVersion) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; - - const Size& GetValue() const { return aVal; } - void SetValue( const Size& rNewVal ) { - DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); - aVal = rNewVal; } -}; - -#endif - diff --git a/svtools/inc/svtools/tfrmitem.hxx b/svtools/inc/svtools/tfrmitem.hxx deleted file mode 100644 index 93e245a731a2..000000000000 --- a/svtools/inc/svtools/tfrmitem.hxx +++ /dev/null @@ -1,90 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: tfrmitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _TFRMITEM_HXX -#define _TFRMITEM_HXX - -#include - -#include - -class SvStream; - -enum SfxOpenMode -{ - SfxOpenSelect = 0, // selected in view - SfxOpenOpen = 1, // doubleclicked or - SfxOpenAddTask = 2, // doubleclicked or with Ctrl-Modifier - SfxOpenDontKnow = 3, - SfxOpenReserved1 = 4, - SfxOpenReserved2 = 5, - SfxOpenModeLast = 5 -}; - -DBG_NAMEEX(SfxTargetFrameItem) - -// class SfxTargetFrameItem ------------------------------------------------- - -class SfxTargetFrameItem : public SfxPoolItem -{ -private: - String _aFrames[ (USHORT)SfxOpenModeLast+1 ]; -public: - TYPEINFO(); - - SfxTargetFrameItem( const SfxTargetFrameItem& rCpy ); - SfxTargetFrameItem( USHORT nWhich ); - SfxTargetFrameItem( - USHORT nWhich, - const String& rOpenSelectFrame, - const String& rOpenOpenFrame, - const String& rOpenAddTaskFrame ); - ~SfxTargetFrameItem(); - - virtual int operator==( const SfxPoolItem& ) const; - virtual SfxPoolItem* Create( SvStream&, USHORT nItemVersion ) const; - virtual SvStream& Store( SvStream&, USHORT nItemVersion ) const; - virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; - - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; - virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); - /* - Framebezeichner im Sfx: - _browser : Beamerview - _document : Desktopview - _blank : new task - "" : do nothing - */ - String GetTargetFrame( SfxOpenMode eMode ) const; -}; - -#endif - diff --git a/svtools/inc/svtools/tresitem.hxx b/svtools/inc/svtools/tresitem.hxx deleted file mode 100644 index 6282d3a7d4ff..000000000000 --- a/svtools/inc/svtools/tresitem.hxx +++ /dev/null @@ -1,65 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: tresitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SVTOOLS_TRESITEM_HXX -#define SVTOOLS_TRESITEM_HXX - -#include -#include - -//============================================================================ -class CntTransferResultItem: public SfxPoolItem -{ - com::sun::star::ucb::TransferResult m_aResult; - -public: - TYPEINFO(); - - CntTransferResultItem(USHORT which = 0): SfxPoolItem(which) {} - - CntTransferResultItem(USHORT which, - com::sun::star::ucb::TransferResult const & - rTheResult): - SfxPoolItem(which), m_aResult(rTheResult) {} - - virtual int operator ==(SfxPoolItem const & rItem) const; - - virtual BOOL QueryValue(com::sun::star::uno::Any & rVal, BYTE = 0) const; - - virtual BOOL PutValue(const com::sun::star::uno::Any & rVal, BYTE = 0); - - virtual SfxPoolItem * Clone(SfxItemPool * = 0) const; - - com::sun::star::ucb::TransferResult const & GetValue() const - { return m_aResult; } -}; - -#endif // SVTOOLS_TRESITEM_HXX - diff --git a/svtools/inc/svtools/undo.hxx b/svtools/inc/svtools/undo.hxx deleted file mode 100644 index 38cbfb227f1b..000000000000 --- a/svtools/inc/svtools/undo.hxx +++ /dev/null @@ -1,240 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: undo.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _UNDO_HXX -#define _UNDO_HXX - -#include "svtools/svtdllapi.h" -#include -#include -#include - -//==================================================================== - -class SVT_DLLPUBLIC SfxRepeatTarget -{ -public: - TYPEINFO(); - virtual ~SfxRepeatTarget() = 0; -}; - -//==================================================================== - -class SVT_DLLPUBLIC SfxUndoAction -{ - BOOL bLinked; -public: - TYPEINFO(); - SfxUndoAction(); - virtual ~SfxUndoAction(); - - virtual BOOL IsLinked(); - virtual void SetLinked( BOOL bIsLinked = TRUE ); - virtual void Undo(); - virtual void Redo(); - virtual void Repeat(SfxRepeatTarget&); - virtual BOOL CanRepeat(SfxRepeatTarget&) const; - - virtual BOOL Merge( SfxUndoAction *pNextAction ); - - virtual UniString GetComment() const; - virtual UniString GetRepeatComment(SfxRepeatTarget&) const; - virtual USHORT GetId() const; - -private: - SfxUndoAction& operator=( const SfxUndoAction& ); // n.i.!! -}; - -//======================================================================== - -SV_DECL_PTRARR( SfxUndoActions, SfxUndoAction*, 20, 8 ) - -//==================================================================== - -/** do not make use of this implementation details, unless you - really really have to! */ -struct SVT_DLLPUBLIC SfxUndoArray -{ - SfxUndoActions aUndoActions; - USHORT nMaxUndoActions; - USHORT nCurUndoAction; - SfxUndoArray *pFatherUndoArray; - SfxUndoArray(USHORT nMax=0): - nMaxUndoActions(nMax), nCurUndoAction(0), - pFatherUndoArray(0) {} - ~SfxUndoArray(); -}; - -//========================================================================= - -/** do not make use of this implementation details, unless you - really really have to! */ -class SVT_DLLPUBLIC SfxListUndoAction : public SfxUndoAction, public SfxUndoArray - -/* [Beschreibung] - - UndoAction zur Klammerung mehrerer Undos in einer UndoAction. - Diese Actions werden vom SfxUndoManager verwendet. Dort - wird mit < SfxUndoManager::EnterListAction > eine Klammerebene - geoeffnet und mit wieder - geschlossen. Redo und Undo auf SfxListUndoActions wirken - Elementweise. - -*/ -{ - public: - TYPEINFO(); - - SfxListUndoAction( const UniString &rComment, - const UniString rRepeatComment, USHORT Id, SfxUndoArray *pFather); - virtual void Undo(); - virtual void Redo(); - virtual void Repeat(SfxRepeatTarget&); - virtual BOOL CanRepeat(SfxRepeatTarget&) const; - - virtual BOOL Merge( SfxUndoAction *pNextAction ); - - virtual UniString GetComment() const; - virtual UniString GetRepeatComment(SfxRepeatTarget&) const; - virtual USHORT GetId() const; - - void SetComment( const UniString& rComment ); - - private: - - USHORT nId; - UniString aComment, aRepeatComment; - -}; - -//========================================================================= - -class SVT_DLLPUBLIC SfxUndoManager -{ - friend class SfxLinkUndoAction; - - SfxUndoArray *pUndoArray; - SfxUndoArray *pActUndoArray; - SfxUndoArray *pFatherUndoArray; - - bool mbUndoEnabled; -public: - SfxUndoManager( USHORT nMaxUndoActionCount = 20 ); - virtual ~SfxUndoManager(); - - virtual void SetMaxUndoActionCount( USHORT nMaxUndoActionCount ); - virtual USHORT GetMaxUndoActionCount() const; - virtual void Clear(); - - virtual void AddUndoAction( SfxUndoAction *pAction, BOOL bTryMerg=FALSE ); - - virtual USHORT GetUndoActionCount() const; - virtual USHORT GetUndoActionId(USHORT nNo=0) const; - virtual UniString GetUndoActionComment( USHORT nNo=0 ) const; - /** returns the nNo'th undo action from the top */ - SfxUndoAction* GetUndoAction( USHORT nNo=0 ) const; - - virtual BOOL Undo( USHORT nCount=1 ); - virtual void Undo( SfxUndoAction &rAction ); - - virtual USHORT GetRedoActionCount() const; - virtual USHORT GetRedoActionId(USHORT nNo=0) const; - virtual UniString GetRedoActionComment( USHORT nNo=0 ) const; - - virtual BOOL Redo( USHORT nCount=1 ); - virtual void Redo( SfxUndoAction &rAction ); - virtual void ClearRedo(); - - virtual USHORT GetRepeatActionCount() const; - virtual UniString GetRepeatActionComment( SfxRepeatTarget &rTarget, USHORT nNo = 0) const; - virtual BOOL Repeat( SfxRepeatTarget &rTarget, USHORT nFrom=0, USHORT nCount=1 ); - virtual void Repeat( SfxRepeatTarget &rTarget, SfxUndoAction &rAction ); - virtual BOOL CanRepeat( SfxRepeatTarget &rTarget, USHORT nNo = 0 ) const; - virtual BOOL CanRepeat( SfxRepeatTarget &rTarget, SfxUndoAction &rAction ) const; - - virtual void EnterListAction(const UniString &rComment, const UniString& rRepeatComment, USHORT nId=0); - virtual void LeaveListAction(); - - /** clears the redo stack and removes the top undo action */ - void RemoveLastUndoAction(); - - // enables (true) or disables (false) recording of undo actions - // If undo actions are added while undo is disabled, they are deleted. - // Disabling undo does not clear the current undo buffer! - void EnableUndo( bool bEnable ); - - // returns true if undo is currently enabled - // This returns false if undo was disabled using EnableUndo( false ) and - // also during the runtime of the Undo() and Redo() methods. - bool IsUndoEnabled() const { return mbUndoEnabled; } -}; - -//========================================================================= - -class SVT_DLLPUBLIC SfxLinkUndoAction : public SfxUndoAction - -/* [Beschreibung] - - Die SfxLinkUndoAction dient zur Verbindung zweier SfxUndoManager. Die - im ersten SfxUndoManager eingefuegten SfxUndoAction leiten ihr Undo und Redo - an den zweiten weiter, so dass ein Undo und Redo am ersten - SfxUndoManager wie eine am zweiten wirkt. - - Die SfxLinkUndoAction ist nach dem Einfuegen der SfxUndoAction am - zweiten SfxUndoManager einzufuegen. Waehrend der zweite SfxUndoManager - vom ersten ferngesteuert wird, duerfen an ihm weder Actions eingefuegt werden, - noch darf Undo/Redo aufgerufen werden. - -*/ - -{ -public: - TYPEINFO(); - SfxLinkUndoAction(SfxUndoManager *pManager); - ~SfxLinkUndoAction(); - - virtual void Undo(); - virtual void Redo(); - virtual BOOL CanRepeat(SfxRepeatTarget& r) const; - - virtual void Repeat(SfxRepeatTarget&r); - - virtual UniString GetComment() const; - virtual UniString GetRepeatComment(SfxRepeatTarget&r) const; - virtual USHORT GetId() const; - - SfxUndoAction* GetAction() const { return pAction; } - -protected: - SfxUndoManager *pUndoManager; - SfxUndoAction *pAction; - -}; - -#endif diff --git a/svtools/inc/svtools/urlfilter.hxx b/svtools/inc/svtools/urlfilter.hxx deleted file mode 100644 index 6370a75a1fd7..000000000000 --- a/svtools/inc/svtools/urlfilter.hxx +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: urlfilter.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SVTOOLS_URL_FILTER_HXX -#define SVTOOLS_URL_FILTER_HXX - -#include -#include -#include -#include -/** filters allowed URLs -*/ -class IUrlFilter -{ -public: - virtual bool isUrlAllowed( const String& _rURL ) const = 0; - -protected: - virtual inline ~IUrlFilter() = 0; -}; - -inline IUrlFilter::~IUrlFilter() {} - -struct FilterMatch : public ::std::unary_function< bool, WildCard > -{ -private: - const String& m_rCompareString; -public: - FilterMatch( const String& _rCompareString ) : m_rCompareString( _rCompareString ) { } - - bool operator()( const WildCard& _rMatcher ) - { - return _rMatcher.Matches( m_rCompareString ) ? true : false; - } - - static void createWildCardFilterList(const String& _rFilterList,::std::vector< WildCard >& _rFilters); -}; - -#endif // SVTOOLS_URL_FILTER_HXX diff --git a/svtools/inc/svtools/visitem.hxx b/svtools/inc/svtools/visitem.hxx deleted file mode 100644 index 9ace1212d967..000000000000 --- a/svtools/inc/svtools/visitem.hxx +++ /dev/null @@ -1,96 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: visitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SFXVISIBILITYITEM_HXX -#define _SFXVISIBILITYITEM_HXX - -#include "svtools/svldllapi.h" -#include -#include -#include - -//============================================================================ -DBG_NAMEEX_VISIBILITY(SfxVisibilityItem, SVL_DLLPUBLIC) - -class SVL_DLLPUBLIC SfxVisibilityItem: public SfxPoolItem -{ - ::com::sun::star::frame::status::Visibility m_nValue; - -public: - TYPEINFO(); - - SfxVisibilityItem(USHORT which = 0, sal_Bool bVisible = sal_True): - SfxPoolItem(which) - { - m_nValue.bVisible = bVisible; - DBG_CTOR(SfxVisibilityItem, 0); - } - - SfxVisibilityItem(USHORT which, SvStream & rStream); - - SfxVisibilityItem(const SfxVisibilityItem & rItem): - SfxPoolItem(rItem), m_nValue(rItem.m_nValue) - { DBG_CTOR(SfxVisibilityItem, 0); } - - virtual ~SfxVisibilityItem() { DBG_DTOR(SfxVisibilityItem, 0); } - - virtual int operator ==(const SfxPoolItem & rItem) const; - - using SfxPoolItem::Compare; - virtual int Compare(const SfxPoolItem & rWith) const; - - virtual SfxItemPresentation GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, - XubString & rText, - const IntlWrapper * = 0) - const; - - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; - - virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); - - virtual SfxPoolItem * Create(SvStream & rStream, USHORT) const; - - virtual SvStream & Store(SvStream & rStream, USHORT) const; - - virtual SfxPoolItem * Clone(SfxItemPool * = 0) const; - - virtual USHORT GetValueCount() const; - - virtual UniString GetValueTextByVal(BOOL bTheValue) const; - - BOOL GetValue() const { return m_nValue.bVisible; } - - void SetValue(BOOL bVisible) { m_nValue.bVisible = bVisible; } -}; - -#endif // _SFXVISIBILITYITEM_HXX diff --git a/svtools/inc/svtools/zforlist.hxx b/svtools/inc/svtools/zforlist.hxx deleted file mode 100644 index 22a258d32f88..000000000000 --- a/svtools/inc/svtools/zforlist.hxx +++ /dev/null @@ -1,1014 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: zforlist.hxx,v $ - * $Revision: 1.3.148.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _ZFORLIST_HXX -#define _ZFORLIST_HXX - -#include "svtools/svtdllapi.h" -#include -#ifndef _TABLE_HXX //autogen -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -class Date; -class SvStream; -class Color; -class SvUShorts; -class CharClass; -class CalendarWrapper; - -class ImpSvNumberformatScan; -class ImpSvNumberInputScan; -class SvNumberformat; - -namespace com { namespace sun { namespace star { - namespace lang { - class XMultiServiceFactory; - } -}}} - - -#define SV_COUNTRY_LANGUAGE_OFFSET 5000 // Max count of formats per country/language -#define SV_MAX_ANZ_STANDARD_FORMATE 100 // Max count of builtin default formats per CL - -// Format types -#ifndef NUMBERFORMAT_ALL -// also defined in com/sun/star/util/NumberFormat.hpp -//! => put in single .idl file and include here -#define NUMBERFORMAT_ALL 0x000 /// Just for Output of total list, not a real format type -#define NUMBERFORMAT_DEFINED 0x001 /// Format defined by user -#define NUMBERFORMAT_DATE 0x002 /// Number as date -#define NUMBERFORMAT_TIME 0x004 /// Number as time -#define NUMBERFORMAT_CURRENCY 0x008 /// Number as currency -#define NUMBERFORMAT_NUMBER 0x010 /// Any "normal" number format -#define NUMBERFORMAT_SCIENTIFIC 0x020 /// Number as scientific -#define NUMBERFORMAT_FRACTION 0x040 /// Number as fraction -#define NUMBERFORMAT_PERCENT 0x080 /// Number as percent -#define NUMBERFORMAT_TEXT 0x100 /// Text format -#define NUMBERFORMAT_DATETIME 0x006 /// Number as date and time -#define NUMBERFORMAT_LOGICAL 0x400 /// Number as boolean value -#define NUMBERFORMAT_UNDEFINED 0x800 /// Format undefined yet in analyzing -#endif -#define NUMBERFORMAT_ENTRY_NOT_FOUND (sal_uInt32)(0xffffffff) /// MAX_ULONG - - -/** enum values for SvNumberFormatter::GetFormatIndex - -

- Builtin standard formats, order should be also the arrangement in the - dialog list box representation.

- -

- Date specials:

    -
  • SYSTEM: As set in System Regional Settings. -
  • SYS: short/long defined, order and separators from System Regional Settings. -
  • DEF: short/long and order defined, separators from System Regional Settings. -
  • DIN: all settings hard coded as DIN (Deutsche Industrie Norm) and EN (European Norm) require. -
  • all other: hard coded -
- */ -enum NfIndexTableOffset -{ - NF_NUMERIC_START = 0, - - NF_NUMBER_START = NF_NUMERIC_START, - NF_NUMBER_STANDARD = NF_NUMBER_START, // Standard/General - NF_NUMBER_INT, // 0 - NF_NUMBER_DEC2, // 0.00 - NF_NUMBER_1000INT, // #,##0 - NF_NUMBER_1000DEC2, // #,##0.00 - NF_NUMBER_SYSTEM, // #,##0.00 or whatever is set in System Regional Settings - NF_NUMBER_END = NF_NUMBER_SYSTEM, - - NF_SCIENTIFIC_START, - NF_SCIENTIFIC_000E000 = NF_SCIENTIFIC_START, // 0.00E+000 - NF_SCIENTIFIC_000E00, // 0.00E+00 - NF_SCIENTIFIC_END = NF_SCIENTIFIC_000E00, - - NF_PERCENT_START, - NF_PERCENT_INT = NF_PERCENT_START, // 0% - NF_PERCENT_DEC2, // 0.00% - NF_PERCENT_END = NF_PERCENT_DEC2, - - NF_FRACTION_START, - NF_FRACTION_1 = NF_FRACTION_START, // # ?/? - NF_FRACTION_2, // # ??/?? - NF_FRACTION_END = NF_FRACTION_2, - - NF_NUMERIC_END = NF_FRACTION_END, - - NF_CURRENCY_START, - NF_CURRENCY_1000INT = NF_CURRENCY_START,// #,##0 DM - NF_CURRENCY_1000DEC2, // #,##0.00 DM - NF_CURRENCY_1000INT_RED, // #,##0 DM negative in red - NF_CURRENCY_1000DEC2_RED, // #,##0.00 DM negative in red - NF_CURRENCY_1000DEC2_CCC, // #,##0.00 DEM currency abbreviation - NF_CURRENCY_1000DEC2_DASHED, // #,##0.-- DM - NF_CURRENCY_END = NF_CURRENCY_1000DEC2_DASHED, - - NF_DATE_START, - NF_DATE_SYSTEM_SHORT = NF_DATE_START, // 08.10.97 - NF_DATE_SYSTEM_LONG, // Wednesday, 8. October 1997 - NF_DATE_SYS_DDMMYY, // 08.10.97 - NF_DATE_SYS_DDMMYYYY, // 08.10.1997 - NF_DATE_SYS_DMMMYY, // 8. Oct 97 - NF_DATE_SYS_DMMMYYYY, // 8. Oct 1997 - NF_DATE_DIN_DMMMYYYY, // 8. Oct. 1997 DIN - NF_DATE_SYS_DMMMMYYYY, // 8. October 1997 - NF_DATE_DIN_DMMMMYYYY, // 8. October 1997 DIN - NF_DATE_SYS_NNDMMMYY, // Wed, 8. Okt 97 - NF_DATE_DEF_NNDDMMMYY, // Wed 08.Okt 97 - NF_DATE_SYS_NNDMMMMYYYY, // Wed, 8. Oktober 1997 - NF_DATE_SYS_NNNNDMMMMYYYY, // Wednesday, 8. Oktober 1997 - NF_DATE_DIN_MMDD, // 10-08 DIN - NF_DATE_DIN_YYMMDD, // 97-10-08 DIN - NF_DATE_DIN_YYYYMMDD, // 1997-10-08 DIN - NF_DATE_SYS_MMYY, // 10.97 - NF_DATE_SYS_DDMMM, // 08.Oct - NF_DATE_MMMM, // October - NF_DATE_QQJJ, // 4. Quarter 97 - NF_DATE_WW, // week of year - NF_DATE_END = NF_DATE_WW, - - NF_TIME_START, - NF_TIME_HHMM = NF_TIME_START, // HH:MM - NF_TIME_HHMMSS, // HH:MM:SS - NF_TIME_HHMMAMPM, // HH:MM AM/PM - NF_TIME_HHMMSSAMPM, // HH:MM:SS AM/PM - NF_TIME_HH_MMSS, // [HH]:MM:SS - NF_TIME_MMSS00, // MM:SS,00 - NF_TIME_HH_MMSS00, // [HH]:MM:SS,00 - NF_TIME_END = NF_TIME_HH_MMSS00, - - NF_DATETIME_START, - NF_DATETIME_SYSTEM_SHORT_HHMM = NF_DATETIME_START, // 08.10.97 01:23 - NF_DATETIME_SYS_DDMMYYYY_HHMMSS, // 08.10.1997 01:23:45 - NF_DATETIME_END = NF_DATETIME_SYS_DDMMYYYY_HHMMSS, - - NF_BOOLEAN, // BOOLEAN - NF_TEXT, // @ - NF_INDEX_TABLE_ENTRIES -}; - - -// #45717# IsNumberFormat( "98-10-24", 30, x ), YMD Format set with DMY -// International settings doesn't recognize the string as a date. -/** enum values for SvNumberFormatter::SetEvalDateFormat - -

How ImpSvNumberInputScan::GetDateRef shall take the - DateFormat order (YMD,DMY,MDY) into account, if called from IsNumberFormat - with a date format to match against. - */ -enum NfEvalDateFormat -{ - /** DateFormat only from International, default. */ - NF_EVALDATEFORMAT_INTL, - - /** DateFormat only from date format passed to function (if any). - If no date format is passed then the DateFormat is taken from International. */ - NF_EVALDATEFORMAT_FORMAT, - - /** First try the DateFormat from International. If it doesn't match a - valid date try the DateFormat from the date format passed. */ - NF_EVALDATEFORMAT_INTL_FORMAT, - - /** First try the DateFormat from the date format passed. If it doesn't - match a valid date try the DateFormat from International. */ - NF_EVALDATEFORMAT_FORMAT_INTL -}; - - -//#if 0 // _SOLAR__PRIVATE -#define _ZFORLIST_DECLARE_TABLE -//#endif -#ifdef _ZFORLIST_DECLARE_TABLE -DECLARE_TABLE (SvNumberFormatTable, SvNumberformat*) -DECLARE_TABLE (SvNumberFormatterIndexTable, sal_uInt32*) -#else -typedef Table SvNumberFormatTable; -typedef Table SvNumberFormatterIndexTable; -#endif - -typedef ::std::map< sal_uInt32, sal_uInt32 > SvNumberFormatterMergeMap; - - -/** Language/country dependent currency entries - */ -class SVT_DLLPUBLIC NfCurrencyEntry -{ - String aSymbol; /// currency symbol - String aBankSymbol; /// currency abbreviation - LanguageType eLanguage; /// language/country value - USHORT nPositiveFormat; /// position of symbol - USHORT nNegativeFormat; /// position of symbol and type and position of negative sign - USHORT nDigits; /// count of decimal digits - sal_Unicode cZeroChar; /// which character is used for zeros as last decimal digits - - /// not implemented, prevent usage - NfCurrencyEntry( const NfCurrencyEntry& ); - /// not implemented, prevent usage - NfCurrencyEntry& operator=( const NfCurrencyEntry& ); - -private: - -//#if 0 // _SOLAR__PRIVATE - // nDecimalFormat := 0, 1, 2 - // #,##0 or #,##0.00 or #,##0.-- are assigned - SVT_DLLPRIVATE void Impl_BuildFormatStringNumChars( String&, - const LocaleDataWrapper&, USHORT nDecimalFormat ) const; -//#endif // __PRIVATE - -public: - - NfCurrencyEntry(); - NfCurrencyEntry( const LocaleDataWrapper& rLocaleData, - LanguageType eLang ); - NfCurrencyEntry( - const ::com::sun::star::i18n::Currency & rCurr, - const LocaleDataWrapper& rLocaleData, - LanguageType eLang ); - ~NfCurrencyEntry() {} - - /// Symbols and language identical - BOOL operator==( const NfCurrencyEntry& r ) const; - - /// Set this format to be the EURo entry, overwrite other settings - void SetEuro(); - BOOL IsEuro() const; - - /** Apply format information (nPositiveFormat, - nNegativeFormat, nDigits, cZeroChar) of another format. */ - void ApplyVariableInformation( const NfCurrencyEntry& ); - - const String& GetSymbol() const { return aSymbol; } - const String& GetBankSymbol() const { return aBankSymbol; } - LanguageType GetLanguage() const { return eLanguage; } - USHORT GetPositiveFormat() const { return nPositiveFormat; } - USHORT GetNegativeFormat() const { return nNegativeFormat; } - USHORT GetDigits() const { return nDigits; } - sal_Unicode GetZeroChar() const { return cZeroChar; } - - /** [$DM-407] (bBank==FALSE) or [$DEM] (bBank==TRUE) - is assigned to rStr, if bBank==FALSE and - bWithoutExtension==TRUE only [$DM] */ - void BuildSymbolString( String& rStr, BOOL bBank, - BOOL bWithoutExtension = FALSE ) const; - - /** #,##0.00 [$DM-407] is assigned to rStr, separators - from rLoc, incl. minus sign but without [RED] */ - void BuildPositiveFormatString( String& rStr, BOOL bBank, - const LocaleDataWrapper&, USHORT nDecimalFormat = 1 ) const; - void BuildNegativeFormatString( String& rStr, BOOL bBank, - const LocaleDataWrapper&, USHORT nDecimalFormat = 1 ) const; - - /** [$DM-407] (or [$DEM] if bBank==TRUE) - is appended/prepended to rStr, incl. minus sign */ - void CompletePositiveFormatString( String& rStr, BOOL bBank, - USHORT nPosiFormat ) const; - void CompleteNegativeFormatString( String& rStr, BOOL bBank, - USHORT nNegaFormat ) const; - - /// rSymStr is appended/prepended to rStr, incl. minus sign - static void CompletePositiveFormatString( String& rStr, - const String& rSymStr, USHORT nPosiFormat ); - static void CompleteNegativeFormatString( String& rStr, - const String& rSymStr, USHORT nNegaFormat ); - - /** Representation of a currency (symbol position and - negative sign) in other language settings */ - static USHORT GetEffectivePositiveFormat( USHORT nIntlFormat, - USHORT nCurrFormat, BOOL bBank ); - static USHORT GetEffectiveNegativeFormat( USHORT nIntlFormat, - USHORT nCurrFormat, BOOL bBank ); - - /// General Unicode Euro symbol - static inline sal_Unicode GetEuroSymbol() { return sal_Unicode(0x20AC); } - /** Platform and CharSet dependent Euro symbol, - needed for import/export */ - static sal_Char GetEuroSymbol( rtl_TextEncoding eTextEncoding ); -}; - -typedef NfCurrencyEntry* NfCurrencyEntryPtr; -SV_DECL_PTRARR_DEL( NfCurrencyTable, NfCurrencyEntryPtr, 128, 1 ) -typedef String* WSStringPtr; -SV_DECL_PTRARR_DEL_VISIBILITY( NfWSStringsDtor, WSStringPtr, 8, 1, SVT_DLLPUBLIC ) - - -class SvNumberFormatterRegistry_Impl; - -class SVT_DLLPUBLIC SvNumberFormatter -{ -public: - - /// Preferred ctor with service manager and language/country enum - SvNumberFormatter( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMgr, - LanguageType eLang - ); - - /// Depricated ctor without service manager - SvNumberFormatter( LanguageType eLang ); - - ~SvNumberFormatter(); - - /// Set CallBack to ColorTable - void SetColorLink( const Link& rColorTableCallBack ) { aColorLink = rColorTableCallBack; } - /// Do the CallBack to ColorTable - Color* GetUserDefColor(USHORT nIndex); - - /// Change language/country, also input and format scanner - void ChangeIntl( LanguageType eLnge ); - /// Change the reference null date - void ChangeNullDate(USHORT nDay, USHORT nMonth, USHORT nYear); - /// Change standard precision - void ChangeStandardPrec(short nPrec); - /// Set zero value suppression - void SetNoZero(BOOL bNZ) { bNoZero = bNZ; } - - /** The language with which the formatter was initialized (system setting), - NOT the current language after a ChangeIntl() */ - LanguageType GetLanguage() const { return IniLnge; } - - // Determine whether two format types are input compatible or not - BOOL IsCompatible(short eOldType, short eNewType); - - /** Get table of formats of a specific type of a locale. A format FIndex is - tested whether it has the type and locale requested, if it doesn't - match FIndex returns the default format for the type/locale. If no - specific format is to be selected FIndex may be initialized to 0. */ - SvNumberFormatTable& GetEntryTable(short eType, - sal_uInt32& FIndex, - LanguageType eLnge); - - /** Get table of formats of a specific type of a language/country. - FIndex returns the default format of that type. - If the language/country was never touched before new entries are generated */ - SvNumberFormatTable& ChangeCL(short eType, - sal_uInt32& FIndex, - LanguageType eLnge); - - /** Get table of formats of the same type as FIndex; eType and rLnge are - set accordingly. An unknown format is set to Standard/General */ - SvNumberFormatTable& GetFirstEntryTable(short& eType, - sal_uInt32& FIndex, - LanguageType& rLnge); - - /// Delete an entry including the format it is refering to - void DeleteEntry(sal_uInt32 nKey); - - /** Create new entry of a format code string for language/country. - @return - if string new and ok and inserted. - if string already exists or an unresolvable parse error - occured, in which case nCheckPos is the error position within rString. - If the error occurs at position 0 or rString is empty nCheckPos - will be 1, so an error in the string is always indicated by - nCheckPos not being zero. - The content of the rString variable can be changed and corrected - by the method. - nType contains the type of the format. - nKey contains the index key of the format. - */ - BOOL PutEntry( String& rString, xub_StrLen& nCheckPos, short& nType, sal_uInt32& nKey, - LanguageType eLnge = LANGUAGE_DONTKNOW ); - - /** Same as PutEntry but the format code string is - considered to be of language/country eLnge and is converted to - language/country eNewLnge */ - BOOL PutandConvertEntry( String& rString, xub_StrLen& nCheckPos, - short& nType, sal_uInt32& nKey, - LanguageType eLnge, LanguageType eNewLnge ); - - /** Same as PutandConvertEntry but the format code string - is considered to be of the System language/country eLnge and is - converted to another System language/country eNewLnge. In this case - the automatic currency is converted too. */ - BOOL PutandConvertEntrySystem( String& rString, xub_StrLen& nCheckPos, - short& nType, sal_uInt32& nKey, - LanguageType eLnge, LanguageType eNewLnge ); - - /** Similar to PutEntry and - PutandConvertEntry or - PutandConvertEntrySystem, the format code string - passed is considered to be of language/country eLnge. If - eLnge==LANGUAGE_SYSTEM the format code has to match eSysLnge, and if - eSysLnge is not the current application locale the format code is - converted to the current locale. Additionally, if the format code - represents an old "automatic" currency format, it is converted to the - new default currency format of the eLnge locale. The rString format - code passed as an argument may get adapted in case eLnge was used (or - is LANGUAGE_SYSTEM and eSysLnge is identical); in case it wasn't the - method works on a copy instead, otherwise the resulting string would - not match eSysLnge anymore. - -

This method was introduced to handle the legacy currency formats of - the "autotbl.fmt" file used by Calc and Writer and convert them to - fixed currency codes of the actual currency. Note that in the case of - legacy currency formats no special attribution is converted, only the - default currency format of the locale is chosen, and that new fixed - currency codes are of course not converted to other currencies. The - method may also be used as a general method taking, converting and - inserting almost arbitrary format codes. To insert or use, for example, - the default currency format code matching the current locale, the - method could be called with
- - - GetIndexPuttingAndConverting( "0 $", LANGUAGE_SYSTEM, LANGUAGE_ENGLISH_US, ...); - - - @return - The index key of the resulting number format. If the format code - was empty, could not be converted or has errors, the eLnge locale's - standard number format is chosen instead. The index key is - guaranteed to represent some valid number format. If - rNewInserted==FALSE and rCheckPos>0 the format code has errors - and/or could not be converted. - */ - sal_uInt32 GetIndexPuttingAndConverting( String & rString, LanguageType eLnge, - LanguageType eSysLnge, short & rType, - BOOL & rNewInserted, - xub_StrLen & rCheckPos ); - - /** Create a format code string using format nIndex as a template and - applying other settings (passed from the dialog) */ - void GenerateFormat( String& sString, sal_uInt32 nIndex, - LanguageType eLnge = LANGUAGE_DONTKNOW, - BOOL bThousand = FALSE, BOOL IsRed = FALSE, - USHORT nPrecision = 0, USHORT nAnzLeading = 1 ); - - /** Analyze an input string - @return - if input is a number or is matching a format F_Index - F_Index is set to a matching format if number, the value is - returned in fOutNumber - if input is not a number - */ - BOOL IsNumberFormat( const String& sString, sal_uInt32& F_Index, double& fOutNumber ); - - /// Format a number according to a format index, return string and color - void GetOutputString( const double& fOutNumber, sal_uInt32 nFIndex, - String& sOutString, Color** ppColor ); - - /** Format a string according to a format index, return string and color. - Formats only if the format code is of type text or the 4th subcode - of a format code is specified, otherwise sOutString will be == "" */ - void GetOutputString( String& sString, sal_uInt32 nFIndex, - String& sOutString, Color** ppColor ); - - /** Format a number according to the standard default format matching - the given format index */ - void GetInputLineString( const double& fOutNumber, - sal_uInt32 nFIndex, String& sOutString ); - - /** Format a number according to a format code string to be scanned. - @return - if format code contains an error - else, in which case the string and color are returned. - */ - BOOL GetPreviewString( const String& sFormatString, double fPreviewNumber, - String& sOutString, Color** ppColor, - LanguageType eLnge = LANGUAGE_DONTKNOW ); - - /** Same as GetPreviewString but the format code string - may be either language/country eLnge or en_US english US */ - BOOL GetPreviewStringGuess( const String& sFormatString, double fPreviewNumber, - String& sOutString, Color** ppColor, - LanguageType eLnge = LANGUAGE_DONTKNOW ); - - /** Test whether the format code string is already present in container - @return - NUMBERFORMAT_ENTRY_NOT_FOUND if not found, else the format index. - */ - sal_uInt32 TestNewString( const String& sFormatString, - LanguageType eLnge = LANGUAGE_DONTKNOW ); - - /// Whether format index nFIndex is of type text or not - BOOL IsTextFormat(sal_uInt32 nFIndex) const; - /// Whether the 4th string subcode of format index nFIndex is present - BOOL HasTextFormat(sal_uInt32 nFIndex) const; - - /// Load all formats from a stream - BOOL Load( SvStream& rStream ); - /// Save all formats to a stream - BOOL Save( SvStream& rStream ) const; - /// Reset of "Used" flags - void PrepareSave(); - - /// Flag format index as used - void SetFormatUsed(sal_uInt32 nFIndex); - - /// Get additional info of a format index, e.g. for dialog box - void GetFormatSpecialInfo(sal_uInt32 nFormat, BOOL& bThousand, BOOL& IsRed, - USHORT& nPrecision, USHORT& nAnzLeading); - - /// Count of decimals - USHORT GetFormatPrecision( sal_uInt32 nFormat ) const; - - /** Get additional info of a format code string, e.g. for dialog box. - Uses a temporary parse, if possible use only if format code is not - present in container yet, otherwise ineffective. - @return - 0 if format code string parsed without errors, otherwise error - position (like nCheckPos on PutEntry) - */ - sal_uInt32 GetFormatSpecialInfo( const String&, BOOL& bThousand, BOOL& IsRed, - USHORT& nPrecision, USHORT& nAnzLeading, - LanguageType eLnge = LANGUAGE_DONTKNOW ); - - /// Check if format code string may be deleted by user - BOOL IsUserDefined( const String& sStr, LanguageType eLnge = LANGUAGE_DONTKNOW ); - - /** Return the format index of the format code string for language/country, - or NUMBERFORMAT_ENTRY_NOT_FOUND */ - sal_uInt32 GetEntryKey( const String& sStr, LanguageType eLnge = LANGUAGE_DONTKNOW ); - - /// Return the format for a format index - const SvNumberformat* GetEntry(sal_uInt32 nKey) const - { return (SvNumberformat*) aFTable.Get(nKey); } - - /// Return the format index of the standard default number format for language/country - sal_uInt32 GetStandardIndex(LanguageType eLnge = LANGUAGE_DONTKNOW); - - /// Return the format index of the default format of a type for language/country - sal_uInt32 GetStandardFormat(short eType, LanguageType eLnge = LANGUAGE_DONTKNOW); - - /** Return the format index of the default format of a type for language/country. - Maybe not the default format but a special builtin format, e.g. for - NF_TIME_HH_MMSS00, if that format is passed in nFIndex. */ - sal_uInt32 GetStandardFormat( sal_uInt32 nFIndex, short eType, LanguageType eLnge ); - - /** Return the format index of the default format of a type for language/country. - Maybe not the default format but a special builtin format, e.g. for - NF_TIME_HH_MMSS00, or NF_TIME_HH_MMSS if fNumber >= 1.0 */ - sal_uInt32 GetStandardFormat( double fNumber, sal_uInt32 nFIndex, short eType, - LanguageType eLnge ); - - /// Whether nFIndex is a special builtin format - BOOL IsSpecialStandardFormat( sal_uInt32 nFIndex, LanguageType eLnge ); - - /// Return the reference date - Date* GetNullDate(); - /// Return the standard decimal precision - short GetStandardPrec(); - /// Return whether zero suppression is switched on - BOOL GetNoZero() { return bNoZero; } - /** Get the type of a format (or NUMBERFORMAT_UNDEFINED if no entry), - but with NUMBERFORMAT_DEFINED masked out */ - short GetType(sal_uInt32 nFIndex); - - /// As the name says - void ClearMergeTable(); - /// Merge in all new entries from rNewTable and return a table of resulting new format indices - SvNumberFormatterIndexTable* MergeFormatter(SvNumberFormatter& rNewTable); - - /// Whether a merge table is present or not - inline BOOL HasMergeFmtTbl() const; - /// Return the new format index for an old format index, if a merge table exists - inline sal_uInt32 GetMergeFmtIndex( sal_uInt32 nOldFmt ) const; - - /** Convert the ugly old tools' Table type bloated with new'ed sal_uInt32 - entries merge table to ::std::map with old index key and new index key. - @ATTENTION! Also clears the old table using ClearMergeTable() */ - SvNumberFormatterMergeMap ConvertMergeTableToMap(); - - /// Return the last used position ever of a language/country combination - USHORT GetLastInsertKey(sal_uInt32 CLOffset); - - /** Return the format index of a builtin format for a specific language/country. - If nFormat is not a builtin format nFormat is returned. */ - sal_uInt32 GetFormatForLanguageIfBuiltIn( sal_uInt32 nFormat, - LanguageType eLnge = LANGUAGE_DONTKNOW ); - - /** Return the format index for a builtin format of a specific language - @see NfIndexTableOffset - */ - sal_uInt32 GetFormatIndex( NfIndexTableOffset, LanguageType eLnge = LANGUAGE_DONTKNOW ); - - /** Return enum index of a format index of a builtin format, - NF_INDEX_TABLE_ENTRIES if it's not a builtin format. - @see NfIndexTableOffset - */ - NfIndexTableOffset GetIndexTableOffset( sal_uInt32 nFormat ) const; - - /** Set evaluation type and order of input date strings - @see NfEvalDateFormat - */ - void SetEvalDateFormat( NfEvalDateFormat eEDF ) { eEvalDateFormat = eEDF; } - NfEvalDateFormat GetEvalDateFormat() const { return eEvalDateFormat; } - - /** Set TwoDigitYearStart, how the input string scanner handles a two digit year. - Default from VCL: 1930, 30-99 19xx, 00-29 20xx - -

Historically (prior to src513e) it was a two digit number determing - until which number the string scanner recognizes a year to be 20xx, - default <= 29 is used by SFX/OfaMiscCfg. - The name Year2000 is kept although the actual functionality is now a - TwoDigitYearStart which might be in any century. - */ - void SetYear2000( USHORT nVal ); - USHORT GetYear2000() const; - static USHORT GetYear2000Default(); - - USHORT ExpandTwoDigitYear( USHORT nYear ) const; - inline static USHORT ExpandTwoDigitYear( USHORT nYear, USHORT nTwoDigitYearStart ); - - /// DEPRICATED: Return first character of the decimal separator of the current language/country - sal_Unicode GetDecSep() const { return GetNumDecimalSep().GetChar(0); } - /// Return the decimal separator of the current language/country - String GetDecimalSep() const { return GetNumDecimalSep(); } - - /// Return the decimal separator matching the locale of the given format - String GetFormatDecimalSep( sal_uInt32 nFormat ) const; - - /// Return a SvPtrArr with pointers to NfCurrencyEntry entries - static const NfCurrencyTable& GetTheCurrencyTable(); - - /** Searches, according to the default locale currency, an entry of the - CurrencyTable which is not the first (LANGUAGE_SYSTEM) entry. - @return - if not found - else pointer to NfCurrencyEntry - */ - static const NfCurrencyEntry* MatchSystemCurrency(); - - /** Return a NfCurrencyEntry matching a language/country. - If language/country is LANGUAGE_SYSTEM a MatchSystemCurrency - call is tried to get an entry. If that fails or the corresponding - language/country is not present the entry for LANGUAGE_SYSTEM is returned. - */ - static const NfCurrencyEntry& GetCurrencyEntry( LanguageType ); - - /** Return a NfCurrencyEntry pointer matching a language/country - and currency abbreviation (AKA banking symbol). - This method is meant for the configuration of the default currency. - @return - if not found - else pointer to NfCurrencyEntry - */ - static const NfCurrencyEntry* GetCurrencyEntry( const String& rAbbrev, - LanguageType eLang ); - - /** Return a NfCurrencyEntry pointer matching the symbol - combination of a LegacyOnly currency. Note that this means only that - the currency matching both symbols was once used in the Office, but is - not offered in dialogs anymore. It doesn't even mean that the currency - symbol combination is valid, since the reason for removing it may have - been just that. #i61657# - @return - A matching entry, or else . - */ - static const NfCurrencyEntry* GetLegacyOnlyCurrencyEntry( - const String& rSymbol, const String& rAbbrev ); - - /** Set the default system currency. The combination of abbreviation and - language must match an existent element of theCurrencyTable. If not, - the SYSTEM (current locale) entry becomes the default. - This method is meant for the configuration of the default currency. - */ - static void SetDefaultSystemCurrency( const String& rAbbrev, LanguageType eLang ); - - /** Get all standard formats for a specific currency, formats are - appended to the NfWSStringsDtor list. - @param bBank - : generate only format strings with currency abbreviation - : mixed format strings - @return - position of default format - */ - USHORT GetCurrencyFormatStrings( NfWSStringsDtor&, const NfCurrencyEntry&, - BOOL bBank ) const; - - /** Whether nFormat is of type NUMBERFORMAT_CURRENCY and the format code - contains a new SYMBOLTYPE_CURRENCY and if so which one [$xxx-nnn]. - If ppEntry is not NULL and exactly one entry is found, a [$xxx-nnn] is - returned, even if the format code only contains [$xxx] ! - */ - BOOL GetNewCurrencySymbolString( sal_uInt32 nFormat, String& rSymbol, - const NfCurrencyEntry** ppEntry = NULL, BOOL* pBank = NULL ) const; - - /** Look up the corresponding NfCurrencyEntry matching - rSymbol (may be CurrencySymbol or CurrencyAbbreviation) and possibly - a rExtension (being yyy of [$xxx-yyy]) or a given language/country - value. Tries to match a rSymbol with rExtension first, then with - eFormatLanguage, then rSymbol only. This is because a currency entry - might have been constructed using I18N locale data where a used locale - of a currrency format code must not necessarily match the locale of - the locale data itself, e.g. [$HK$-40C] (being "zh_HK" locale) in - zh_CN locale data. Here the rExtension would have the value 0x40c but - eFormatLanguage of the number format would have the value of zh_CN - locale, the value with which the corresponding CurrencyEntry is - constructed. - - @param bFoundBank - Only used for output. - If the return value is not this value is set to if - the matching entry was found by comparing rSymbol against the - CurrencyAbbreviation (AKA BankSymbol). - If the return value is the value of bFoundBank is undefined. - @param rSymbol - Currency symbol, preferably obtained of a format by a call to - SvNumberformat::GetNewCurrencySymbol() - @param rExtension - Currency extension, preferably obtained of a format by a call to - SvNumberformat::GetNewCurrencySymbol() - @param eFormatLanguage - The language/country value of the format of which rSymbol and - rExtension are obtained (SvNumberformat::GetLanguage()). - @param bOnlyStringLanguage - If only entries with language/country of rExtension are - checked, no match on eFormatLanguage. If rExtension is empty all - entries are checked. - @return - The matching entry if unique (in which case bFoundBank is set), - else . - */ - static const NfCurrencyEntry* GetCurrencyEntry( BOOL & bFoundBank, - const String& rSymbol, const String& rExtension, - LanguageType eFormatLanguage, BOOL bOnlyStringLanguage = FALSE ); - - /// Get compatibility ("automatic" old style) currency from I18N locale data - void GetCompatibilityCurrency( String& rSymbol, String& rAbbrev ) const; - - /// Fill rList with the language/country codes that have been allocated - void GetUsedLanguages( SvUShorts& rList ); - - /// Fill a NfKeywordIndex table with keywords of a language/country - void FillKeywordTable( NfKeywordTable& rKeywords, LanguageType eLang ); - - /** Return a keyword for a language/country and NfKeywordIndex - for XML import, to generate number format strings. */ - String GetKeyword( LanguageType eLnge, USHORT nIndex ); - - /** Return the GENERAL keyword in proper case ("General") for a - language/country, used in XML import */ - String GetStandardName( LanguageType eLnge ); - - /// Skip a NumberFormatter in stream, Chart needs this - static void SkipNumberFormatterInStream( SvStream& ); - - -private: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager; - ::com::sun::star::lang::Locale aLocale; - SvNumberFormatTable aFTable; // Table of format keys to format entries - Table aDefaultFormatKeys; // Table of default standard to format keys - SvNumberFormatTable* pFormatTable; // For the UI dialog - SvNumberFormatterIndexTable* pMergeTable; // List of indices for merging two formatters - CharClass* pCharClass; // CharacterClassification - OnDemandLocaleDataWrapper xLocaleData; // LocaleData switched between SYSTEM, ENGLISH and other - OnDemandTransliterationWrapper xTransliteration; // Transliteration loaded on demand - OnDemandCalendarWrapper xCalendar; // Calendar loaded on demand - OnDemandNativeNumberWrapper xNatNum; // Native number service loaded on demand - ImpSvNumberInputScan* pStringScanner; // Input string scanner - ImpSvNumberformatScan* pFormatScanner; // Format code string scanner - Link aColorLink; // User defined color table CallBack - sal_uInt32 MaxCLOffset; // Max language/country offset used - sal_uInt32 nDefaultSystemCurrencyFormat; // NewCurrency matching SYSTEM locale - LanguageType IniLnge; // Initialized setting language/country - LanguageType ActLnge; // Current setting language/country - NfEvalDateFormat eEvalDateFormat; // DateFormat evaluation - BOOL bNoZero; // Zero value suppression - - // cached locale data items needed almost any time - String aDecimalSep; - String aThousandSep; - String aDateSep; - -#ifdef _ZFORLIST_CXX // ----- private Methoden ----- - - SVT_DLLPRIVATE static BOOL bCurrencyTableInitialized; - SVT_DLLPRIVATE static USHORT nSystemCurrencyPosition; - SVT_DLLPRIVATE static SvNumberFormatterRegistry_Impl* pFormatterRegistry; - - // get the registry, create one if none exists - SVT_DLLPRIVATE static SvNumberFormatterRegistry_Impl& GetFormatterRegistry(); - - // called by ctors - SVT_DLLPRIVATE void ImpConstruct( LanguageType eLang ); - - // Changes initialized language/country, clears the entries and generates - // new ones, may ONLY be called by the binary file format load - SVT_DLLPRIVATE void ImpChangeSysCL( LanguageType eLnge, BOOL bLoadingSO5 ); - - // Generate builtin formats provided by i18n behind CLOffset, - // if bLoadingSO5==FALSE also generate additional i18n formats. - SVT_DLLPRIVATE void ImpGenerateFormats( sal_uInt32 CLOffset, BOOL bLoadingSO5 ); - - // Generate additional formats provided by i18n - SVT_DLLPRIVATE void ImpGenerateAdditionalFormats( - sal_uInt32 CLOffset, - NumberFormatCodeWrapper& rNumberFormatCode, - BOOL bAfterLoadingSO5 ); - - SVT_DLLPRIVATE SvNumberformat* ImpInsertFormat( - const ::com::sun::star::i18n::NumberFormatCode& rCode, - sal_uInt32 nPos, - BOOL bAfterLoadingSO5 = FALSE, - sal_Int16 nOrgIndex = 0 ); - // ImpInsertNewStandardFormat for new (since version ...) builtin formats - SVT_DLLPRIVATE SvNumberformat* ImpInsertNewStandardFormat( - const ::com::sun::star::i18n::NumberFormatCode& rCode, - sal_uInt32 nPos, - USHORT nVersion, - BOOL bAfterLoadingSO5 = FALSE, - sal_Int16 nOrgIndex = 0 ); - - // Return CLOffset or (MaxCLOffset + SV_COUNTRY_LANGUAGE_OFFSET) if new language/country - SVT_DLLPRIVATE sal_uInt32 ImpGetCLOffset(LanguageType eLnge) const; - - // Test whether format code already exists, then return index key, - // otherwise NUMBERFORMAT_ENTRY_NOT_FOUND - SVT_DLLPRIVATE sal_uInt32 ImpIsEntry( const String& rString, - sal_uInt32 CLOffset, - LanguageType eLnge ); - - // Create builtin formats for language/country if necessary, return CLOffset - SVT_DLLPRIVATE sal_uInt32 ImpGenerateCL( LanguageType eLnge, BOOL bLoadingSO5 = FALSE ); - - // Build negative currency format, old compatibility style - SVT_DLLPRIVATE void ImpGetNegCurrFormat( String& sNegStr, const String& rCurrSymbol ); - // Build positive currency format, old compatibility style - SVT_DLLPRIVATE void ImpGetPosCurrFormat( String& sPosStr, const String& rCurrSymbol ); - - // Create theCurrencyTable with all NfCurrencyEntry - SVT_DLLPRIVATE static void ImpInitCurrencyTable(); - - // Return the format index of the currency format of the system locale. - // Format is created if not already present. - SVT_DLLPRIVATE sal_uInt32 ImpGetDefaultSystemCurrencyFormat(); - - // Return the format index of the currency format of the current locale. - // Format is created if not already present. - SVT_DLLPRIVATE sal_uInt32 ImpGetDefaultCurrencyFormat(); - - // Return the default format for a given type and current locale. - // May ONLY be called from within GetStandardFormat(). - SVT_DLLPRIVATE sal_uInt32 ImpGetDefaultFormat( short nType ); - - // Return the index in a sequence of format codes matching an enum of - // NfIndexTableOffset. If not found 0 is returned. If the sequence doesn't - // contain any format code elements a default element is created and inserted. - SVT_DLLPRIVATE sal_Int32 ImpGetFormatCodeIndex( - ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode >& rSeq, - const NfIndexTableOffset nTabOff ); - - // Adjust a sequence of format codes to contain only one (THE) default - // instead of multiple defaults for short/medium/long types. - // If there is no medium but a short and a long default the long is taken. - // Return the default index in the sequence. - // Non-PRODUCT version may check locale data for matching defaults in one - // FormatElement group. - SVT_DLLPRIVATE sal_Int32 ImpAdjustFormatCodeDefault( - ::com::sun::star::i18n::NumberFormatCode * pFormatArr, - sal_Int32 nCount, BOOL bCheckCorrectness = TRUE - ); - - // used as a loop body inside of GetNewCurrencySymbolString() and GetCurrencyEntry() -#ifndef DBG_UTIL - inline -#endif - static BOOL ImpLookupCurrencyEntryLoopBody( - const NfCurrencyEntry*& pFoundEntry, BOOL& bFoundBank, - const NfCurrencyEntry* pData, USHORT nPos, const String& rSymbol ); - - // link to be set at SvtSysLocaleOptions::SetCurrencyChangeLink() - DECL_DLLPRIVATE_STATIC_LINK( SvNumberFormatter, CurrencyChangeLink, void* ); - -#endif // _ZFORLIST_CXX - -public: - - // own static mutex, may also be used by internal class SvNumberFormatterRegistry_Impl - static ::osl::Mutex& GetMutex(); - - // called by SvNumberFormatterRegistry_Impl::Notify if the default system currency changes - void ResetDefaultSystemCurrency(); - - // Replace the SYSTEM language/country format codes. Called upon change of - // the user configurable locale. - // Old compatibility codes are replaced, user defined are converted, and - // new format codes are appended. - void ReplaceSystemCL( LanguageType eOldLanguage ); - - inline ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory > - GetServiceManager() const { return xServiceManager; } - - - - //! The following method is not to be used from outside but must be - //! public for the InputScanner. - // return the current FormatScanner - inline const ImpSvNumberformatScan* GetFormatScanner() const { return pFormatScanner; } - - - - //! The following methods are not to be used from outside but must be - //! public for the InputScanner and FormatScanner. - - // return current (!) Locale - inline const ::com::sun::star::lang::Locale& GetLocale() const { return aLocale; } - - // return corresponding Transliteration wrapper - inline const ::utl::TransliterationWrapper* GetTransliteration() const - { return xTransliteration.get(); } - - // return corresponding Transliteration wrapper with loadModuleByImplName() - inline const ::utl::TransliterationWrapper* GetTransliterationForModule( - const String& rModule, LanguageType eLang ) const - { return xTransliteration.getForModule( rModule, eLang ); } - - // return the corresponding CharacterClassification wrapper - inline const CharClass* GetCharClass() const { return pCharClass; } - - // return the corresponding LocaleData wrapper - inline const LocaleDataWrapper* GetLocaleData() const { return xLocaleData.get(); } - - // return the corresponding Calendar wrapper - inline CalendarWrapper* GetCalendar() const { return xCalendar.get(); } - - // return the corresponding NativeNumberSupplier wrapper - inline const NativeNumberWrapper* GetNatNum() const { return xNatNum.get(); } - - // cached locale data items - - // return the corresponding decimal separator - inline const String& GetNumDecimalSep() const { return aDecimalSep; } - - // return the corresponding group (AKA thousand) separator - inline const String& GetNumThousandSep() const { return aThousandSep; } - - // return the corresponding date separator - inline const String& GetDateSep() const { return aDateSep; } - -}; - - -// --------------------------- inline -------------------------------------- - -inline sal_uInt32 SvNumberFormatter::GetMergeFmtIndex( sal_uInt32 nOldFmt ) const -{ - sal_uInt32* pU = (pMergeTable && pMergeTable->Count()) ? (sal_uInt32*)pMergeTable->Get( nOldFmt ) : 0; - return pU ? *pU : nOldFmt; -} - -inline BOOL SvNumberFormatter::HasMergeFmtTbl() const -{ - return pMergeTable && (0 != pMergeTable->Count()); -} - - -// static -inline USHORT SvNumberFormatter::ExpandTwoDigitYear( - USHORT nYear, USHORT nTwoDigitYearStart ) -{ - if ( nYear < 100 ) - { - if ( nYear < (nTwoDigitYearStart % 100) ) - return nYear + (((nTwoDigitYearStart / 100) + 1) * 100); - else - return nYear + ((nTwoDigitYearStart / 100) * 100); - } - return nYear; -} - - - -#endif // _ZFORLIST_HXX diff --git a/svtools/inc/svtools/zformat.hxx b/svtools/inc/svtools/zformat.hxx deleted file mode 100644 index ae7d961c0bc6..000000000000 --- a/svtools/inc/svtools/zformat.hxx +++ /dev/null @@ -1,589 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: zformat.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _ZFORMAT_HXX -#define _ZFORMAT_HXX - -#include "svtools/svtdllapi.h" -#include -#include -#include -#include -#include - -// We need ImpSvNumberformatScan for the private SvNumberformat definitions. -#ifdef _ZFORMAT_CXX -#include "zforscan.hxx" -#endif - -// If comment field is also in format code string, was used for SUPD versions 371-372 -#define NF_COMMENT_IN_FORMATSTRING 0 - -namespace utl { - class DigitGroupingIterator; -} - -class SvStream; -class Color; - -class ImpSvNumberformatScan; // format code string scanner -class ImpSvNumberInputScan; // input string scanner -class ImpSvNumMultipleWriteHeader; // compatible file format -class ImpSvNumMultipleReadHeader; // compatible file format -class SvNumberFormatter; - -enum SvNumberformatLimitOps -{ - NUMBERFORMAT_OP_NO = 0, // Undefined, no OP - NUMBERFORMAT_OP_EQ = 1, // Operator = - NUMBERFORMAT_OP_NE = 2, // Operator <> - NUMBERFORMAT_OP_LT = 3, // Operator < - NUMBERFORMAT_OP_LE = 4, // Operator <= - NUMBERFORMAT_OP_GT = 5, // Operator > - NUMBERFORMAT_OP_GE = 6 // Operator >= -}; - -// SYSTEM-german to SYSTEM-xxx and vice versa conversion hack onLoad -enum NfHackConversion -{ - NF_CONVERT_NONE, - NF_CONVERT_GERMAN_ENGLISH, - NF_CONVERT_ENGLISH_GERMAN -}; - -struct ImpSvNumberformatInfo // Struct for FormatInfo -{ - String* sStrArray; // Array of symbols - short* nTypeArray; // Array of infos - USHORT nThousand; // Count of group separator sequences - USHORT nCntPre; // Count of digits before decimal point - USHORT nCntPost; // Count of digits after decimal point - USHORT nCntExp; // Count of exponent digits, or AM/PM - short eScannedType; // Type determined by scan - BOOL bThousand; // Has group (AKA thousand) separator - - void Copy( const ImpSvNumberformatInfo& rNumFor, USHORT nAnz ); - void Load(SvStream& rStream, USHORT nAnz); - void Save(SvStream& rStream, USHORT nAnz) const; -}; - -// NativeNumber, represent numbers using CJK or other digits if nNum>0, -// eLang specifies the Locale to use. -class SvNumberNatNum -{ - LanguageType eLang; - BYTE nNum; - BOOL bDBNum :1; // DBNum, to be converted to NatNum - BOOL bDate :1; // Used in date? (needed for DBNum/NatNum mapping) - BOOL bSet :1; // If set, since NatNum0 is possible - -public: - - static BYTE MapDBNumToNatNum( BYTE nDBNum, LanguageType eLang, BOOL bDate ); - static BYTE MapNatNumToDBNum( BYTE nNatNum, LanguageType eLang, BOOL bDate ); - - SvNumberNatNum() : eLang( LANGUAGE_DONTKNOW ), nNum(0), - bDBNum(0), bDate(0), bSet(0) {} - BOOL IsComplete() const { return bSet && eLang != LANGUAGE_DONTKNOW; } - BYTE GetRawNum() const { return nNum; } - BYTE GetNatNum() const { return bDBNum ? MapDBNumToNatNum( nNum, eLang, bDate ) : nNum; } - BYTE GetDBNum() const { return bDBNum ? nNum : MapNatNumToDBNum( nNum, eLang, bDate ); } - LanguageType GetLang() const { return eLang; } - void SetLang( LanguageType e ) { eLang = e; } - void SetNum( BYTE nNumber, BOOL bDBNumber ) - { - nNum = nNumber; - bDBNum = bDBNumber; - bSet = TRUE; - } - BOOL IsSet() const { return bSet; } - void SetDate( BOOL bDateP ) { bDate = (bDateP != 0); } -}; - -class CharClass; - -class ImpSvNumFor // One of four subformats of the format code string -{ -public: - ImpSvNumFor(); // Ctor without filling the Info - ~ImpSvNumFor(); - - void Enlarge(USHORT nAnz); // Init of arrays to the right size - void Load( SvStream& rStream, ImpSvNumberformatScan& rSc, - String& rLoadedColorName); - void Save( SvStream& rStream ) const; - - // if pSc is set, it is used to get the Color pointer - void Copy( const ImpSvNumFor& rNumFor, ImpSvNumberformatScan* pSc ); - - // Access to Info; call Enlarge before! - ImpSvNumberformatInfo& Info() { return aI;} - const ImpSvNumberformatInfo& Info() const { return aI; } - - // Get count of substrings (symbols) - USHORT GetnAnz() const { return nAnzStrings;} - - Color* GetColor() const { return pColor; } - void SetColor( Color* pCol, String& rName ) - { pColor = pCol; sColorName = rName; } - const String& GetColorName() const { return sColorName; } - - // new SYMBOLTYPE_CURRENCY in subformat? - BOOL HasNewCurrency() const; - BOOL GetNewCurrencySymbol( String& rSymbol, String& rExtension ) const; - void SaveNewCurrencyMap( SvStream& rStream ) const; - void LoadNewCurrencyMap( SvStream& rStream ); - - // [NatNum1], [NatNum2], ... - void SetNatNumNum( BYTE nNum, BOOL bDBNum ) { aNatNum.SetNum( nNum, bDBNum ); } - void SetNatNumLang( LanguageType eLang ) { aNatNum.SetLang( eLang ); } - void SetNatNumDate( BOOL bDate ) { aNatNum.SetDate( bDate ); } - const SvNumberNatNum& GetNatNum() const { return aNatNum; } - -private: - ImpSvNumberformatInfo aI; // Hilfsstruct fuer die restlichen Infos - String sColorName; // color name - Color* pColor; // pointer to color of subformat - USHORT nAnzStrings; // count of symbols - SvNumberNatNum aNatNum; // DoubleByteNumber - -}; - -class SVT_DLLPUBLIC SvNumberformat -{ -public: - // Ctor for Load - SvNumberformat( ImpSvNumberformatScan& rSc, LanguageType eLge ); - - // Normal ctor - SvNumberformat( String& rString, - ImpSvNumberformatScan* pSc, - ImpSvNumberInputScan* pISc, - xub_StrLen& nCheckPos, - LanguageType& eLan, - BOOL bStand = FALSE ); - - // Copy ctor - SvNumberformat( SvNumberformat& rFormat ); - - // Copy ctor with exchange of format code string scanner (used in merge) - SvNumberformat( SvNumberformat& rFormat, ImpSvNumberformatScan& rSc ); - - ~SvNumberformat(); - - /// Get type of format, may include NUMBERFORMAT_DEFINED bit - short GetType() const - { return (nNewStandardDefined && - (nNewStandardDefined <= SV_NUMBERFORMATTER_VERSION)) ? - (eType & ~NUMBERFORMAT_DEFINED) : eType; } - - void SetType(const short eSetType) { eType = eSetType; } - // Standard means the I18N defined standard format of this type - void SetStandard() { bStandard = TRUE; } - BOOL IsStandard() const { return bStandard; } - - // For versions before version nVer it is UserDefined, for newer versions - // it is builtin. nVer of SV_NUMBERFORMATTER_VERSION_... - void SetNewStandardDefined( USHORT nVer ) - { nNewStandardDefined = nVer; eType |= NUMBERFORMAT_DEFINED; } - - USHORT GetNewStandardDefined() const { return nNewStandardDefined; } - BOOL IsAdditionalStandardDefined() const - { return nNewStandardDefined == SV_NUMBERFORMATTER_VERSION_ADDITIONAL_I18N_FORMATS; } - - LanguageType GetLanguage() const { return eLnge;} - - const String& GetFormatstring() const { return sFormatstring; } - - // Build a format string of application defined keywords - String GetMappedFormatstring( const NfKeywordTable& rKeywords, - const LocaleDataWrapper& rLoc, - BOOL bDontQuote = FALSE ) const; - - void SetUsed(const BOOL b) { bIsUsed = b; } - BOOL GetUsed() const { return bIsUsed; } - BOOL IsStarFormatSupported() const { return bStarFlag; } - void SetStarFormatSupport( BOOL b ) { bStarFlag = b; } - - NfHackConversion Load( SvStream& rStream, ImpSvNumMultipleReadHeader& rHdr, - SvNumberFormatter* pConverter, ImpSvNumberInputScan& rISc ); - void Save( SvStream& rStream, ImpSvNumMultipleWriteHeader& rHdr ) const; - - // Load a string which might contain an Euro symbol, - // in fact that could be any string used in number formats. - static void LoadString( SvStream& rStream, String& rStr ); - - BOOL GetOutputString( double fNumber, String& OutString, Color** ppColor ); - BOOL GetOutputString( String& sString, String& OutString, Color** ppColor ); - - // True if type text - BOOL IsTextFormat() const { return (eType & NUMBERFORMAT_TEXT) != 0; } - // True if 4th subformat present - BOOL HasTextFormat() const - { - return (NumFor[3].GetnAnz() > 0) || - (NumFor[3].Info().eScannedType == NUMBERFORMAT_TEXT); - } - - void GetFormatSpecialInfo(BOOL& bThousand, - BOOL& IsRed, - USHORT& nPrecision, - USHORT& nAnzLeading) const; - - /// Count of decimal precision - USHORT GetFormatPrecision() const { return NumFor[0].Info().nCntPost; } - - //! Read/write access on a special USHORT component, may only be used on the - //! standard format 0, 5000, ... and only by the number formatter! - USHORT GetLastInsertKey() const - { return NumFor[0].Info().nThousand; } - void SetLastInsertKey(USHORT nKey) - { NumFor[0].Info().nThousand = nKey; } - - //! Only onLoad: convert from stored to current system language/country - void ConvertLanguage( SvNumberFormatter& rConverter, - LanguageType eConvertFrom, LanguageType eConvertTo, BOOL bSystem = FALSE ); - - // Substring of a subformat code nNumFor (0..3) - // nPos == 0xFFFF => last substring - // bString==TRUE: first/last SYMBOLTYPE_STRING or SYMBOLTYPE_CURRENCY - const String* GetNumForString( USHORT nNumFor, USHORT nPos, - BOOL bString = FALSE ) const; - - // Subtype of a subformat code nNumFor (0..3) - // nPos == 0xFFFF => last substring - // bString==TRUE: first/last SYMBOLTYPE_STRING or SYMBOLTYPE_CURRENCY - short GetNumForType( USHORT nNumFor, USHORT nPos, BOOL bString = FALSE ) const; - - /** If the count of string elements (substrings, ignoring [modifiers] and - so on) in a subformat code nNumFor (0..3) is equal to the given number. - Used by ImpSvNumberInputScan::IsNumberFormatMain() to detect a matched - format. */ - BOOL IsNumForStringElementCountEqual( USHORT nNumFor, USHORT nAllCount, - USHORT nNumCount ) const - { - if ( nNumFor < 4 ) - { - // First try a simple approach. Note that this is called only - // if all MidStrings did match so far, to verify that all - // strings of the format were matched and not just the starting - // sequence, so we don't have to check if GetnAnz() includes - // [modifiers] or anything else if both counts are equal. - USHORT nCnt = NumFor[nNumFor].GetnAnz(); - if ( nAllCount == nCnt ) - return TRUE; - if ( nAllCount < nCnt ) // check ignoring [modifiers] and so on - return ImpGetNumForStringElementCount( nNumFor ) == - (nAllCount - nNumCount); - } - return FALSE; - } - - // Whether the second subformat code is really for negative numbers - // or another limit set. - BOOL IsNegativeRealNegative() const - { - return fLimit1 == 0.0 && fLimit2 == 0.0 && - ( (eOp1 == NUMBERFORMAT_OP_GE && eOp2 == NUMBERFORMAT_OP_NO) || - (eOp1 == NUMBERFORMAT_OP_GT && eOp2 == NUMBERFORMAT_OP_LT) || - (eOp1 == NUMBERFORMAT_OP_NO && eOp2 == NUMBERFORMAT_OP_NO) ); - } - - // Whether the negative format is without a sign or not - BOOL IsNegativeWithoutSign() const; - - // Whether a new SYMBOLTYPE_CURRENCY is contained in the format - BOOL HasNewCurrency() const; - - // Build string from NewCurrency for saving it SO50 compatible - void Build50Formatstring( String& rStr ) const; - - // strip [$-yyy] from all [$xxx-yyy] leaving only xxx's, - // if bQuoteSymbol==TRUE the xxx will become "xxx" - static String StripNewCurrencyDelimiters( const String& rStr, - BOOL bQuoteSymbol ); - - // If a new SYMBOLTYPE_CURRENCY is contained if the format is of type - // NUMBERFORMAT_CURRENCY, and if so the symbol xxx and the extension nnn - // of [$xxx-nnn] are returned - BOOL GetNewCurrencySymbol( String& rSymbol, String& rExtension ) const; - - static BOOL HasStringNegativeSign( const String& rStr ); - - /** - Whether a character at position nPos is somewhere between two matching - cQuote or not. - If nPos points to a cQuote, a TRUE is returned on an opening cQuote, - a FALSE is returned on a closing cQuote. - A cQuote between quotes may be escaped by a cEscIn, a cQuote outside of - quotes may be escaped by a cEscOut. - The default '\0' results in no escapement possible. - Defaults are set right according to the "unlogic" of the Numberformatter - */ - static BOOL IsInQuote( const String& rString, xub_StrLen nPos, - sal_Unicode cQuote = '"', - sal_Unicode cEscIn = '\0', sal_Unicode cEscOut = '\\' ); - - /** - Return the position of a matching closing cQuote if the character at - position nPos is between two matching cQuote, otherwise return - STRING_NOTFOUND. - If nPos points to an opening cQuote the position of the matching - closing cQuote is returned. - If nPos points to a closing cQuote nPos is returned. - If nPos points into a part which starts with an opening cQuote but has - no closing cQuote, rString.Len() is returned. - Uses IsInQuote internally, so you don't have to call - that prior to a call of this method. - */ - static xub_StrLen GetQuoteEnd( const String& rString, xub_StrLen nPos, - sal_Unicode cQuote = '"', - sal_Unicode cEscIn = '\0', sal_Unicode cEscOut = '\\' ); - - void SetComment( const String& rStr ) -#if NF_COMMENT_IN_FORMATSTRING - { SetComment( rStr, sFormatstring, sComment ); } -#else - { sComment = rStr; } -#endif - const String& GetComment() const { return sComment; } - - // Erase "{ "..." }" from format subcode string to get the pure comment (old version) - static void EraseCommentBraces( String& rStr ); - // Set comment rStr in format string rFormat and in rComment (old version) - static void SetComment( const String& rStr, String& rFormat, String& rComment ); - // Erase comment at end of rStr to get pure format code string (old version) - static void EraseComment( String& rStr ); - - /** Insert the number of blanks into the string that is needed to simulate - the width of character c for underscore formats */ - static xub_StrLen InsertBlanks( String& r, xub_StrLen nPos, sal_Unicode c ); - - /// One of YMD,DMY,MDY if date format - DateFormat GetDateOrder() const; - - /** A coded value of the exact YMD combination used, if date format. - For example: YYYY-MM-DD => ('Y' << 16) | ('M' << 8) | 'D' - or: MM/YY => ('M' << 8) | 'Y' */ - sal_uInt32 GetExactDateOrder() const; - - ImpSvNumberformatScan& ImpGetScan() const { return rScan; } - - // used in XML export - void GetConditions( SvNumberformatLimitOps& rOper1, double& rVal1, - SvNumberformatLimitOps& rOper2, double& rVal2 ) const; - Color* GetColor( USHORT nNumFor ) const; - void GetNumForInfo( USHORT nNumFor, short& rScannedType, - BOOL& bThousand, USHORT& nPrecision, USHORT& nAnzLeading ) const; - - // rAttr.Number not empty if NatNum attributes are to be stored - void GetNatNumXml( - ::com::sun::star::i18n::NativeNumberXmlAttributes& rAttr, - USHORT nNumFor ) const; - - /** @returns if E,EE,R,RR,AAA,AAAA in format code of subformat - nNumFor (0..3) and no preceding calendar was specified and the - currently loaded calendar is "gregorian". */ - BOOL IsOtherCalendar( USHORT nNumFor ) const - { - if ( nNumFor < 4 ) - return ImpIsOtherCalendar( NumFor[nNumFor] ); - return FALSE; - } - - /** Switches to the first non-"gregorian" calendar, but only if the current - calendar is "gregorian"; original calendar name and date/time returned, - but only if calendar switched and rOrgCalendar was empty. */ - void SwitchToOtherCalendar( String& rOrgCalendar, double& fOrgDateTime ) const; - - /** Switches to the "gregorian" calendar, but only if the current calendar - is non-"gregorian" and rOrgCalendar is not empty. Thus a preceding - ImpSwitchToOtherCalendar() call should have been placed prior to - calling this method. */ - void SwitchToGregorianCalendar( const String& rOrgCalendar, double fOrgDateTime ) const; - - /** Switches to the first specified calendar, if any, in subformat nNumFor - (0..3). Original calendar name and date/time returned, but only if - calendar switched and rOrgCalendar was empty. - - @return - if a calendar was specified and switched to, - else. - */ - BOOL SwitchToSpecifiedCalendar( String& rOrgCalendar, double& fOrgDateTime, - USHORT nNumFor ) const - { - if ( nNumFor < 4 ) - return ImpSwitchToSpecifiedCalendar( rOrgCalendar, - fOrgDateTime, NumFor[nNumFor] ); - return FALSE; - } - -private: - ImpSvNumFor NumFor[4]; // Array for the 4 subformats - String sFormatstring; // The format code string - String sComment; // Comment, since number formatter version 6 - double fLimit1; // Value for first condition - double fLimit2; // Value for second condition - ImpSvNumberformatScan& rScan; // Format code scanner - LanguageType eLnge; // Language/country of the format - SvNumberformatLimitOps eOp1; // Operator for first condition - SvNumberformatLimitOps eOp2; // Operator for second condition - USHORT nNewStandardDefined; // new builtin formats as of version 6 - short eType; // Type of format - BOOL bStarFlag; // Take *n format as ESC n - BOOL bStandard; // If this is a default standard format - BOOL bIsUsed; // Flag as used for storing - - SVT_DLLPRIVATE USHORT ImpGetNumForStringElementCount( USHORT nNumFor ) const; - - SVT_DLLPRIVATE BOOL ImpIsOtherCalendar( const ImpSvNumFor& rNumFor ) const; - - SVT_DLLPRIVATE BOOL ImpSwitchToSpecifiedCalendar( String& rOrgCalendar, - double& fOrgDateTime, const ImpSvNumFor& rNumFor ) const; - -#ifdef _ZFORMAT_CXX // ----- private implementation methods ----- - - const CharClass& rChrCls() const { return rScan.GetChrCls(); } - const LocaleDataWrapper& rLoc() const { return rScan.GetLoc(); } - CalendarWrapper& GetCal() const { return rScan.GetCal(); } - const SvNumberFormatter& GetFormatter() const { return *rScan.GetNumberformatter(); } - - // divide in substrings and color conditions - SVT_DLLPRIVATE short ImpNextSymbol( String& rString, - xub_StrLen& nPos, - String& sSymbol ); - - // read string until ']' and strip blanks (after condition) - SVT_DLLPRIVATE static xub_StrLen ImpGetNumber( String& rString, - xub_StrLen& nPos, - String& sSymbol ); - - // get xxx of "[$-xxx]" as LanguageType, starting at and advancing position nPos - SVT_DLLPRIVATE static LanguageType ImpGetLanguageType( const String& rString, xub_StrLen& nPos ); - - // standard number output - SVT_DLLPRIVATE void ImpGetOutputStandard( double& fNumber, String& OutString ); - // numbers in input line - SVT_DLLPRIVATE void ImpGetOutputInputLine( double fNumber, String& OutString ); - - // check subcondition - // OP undefined => -1 - // else 0 or 1 - SVT_DLLPRIVATE short ImpCheckCondition(double& fNumber, - double& fLimit, - SvNumberformatLimitOps eOp); - - SVT_DLLPRIVATE ULONG ImpGGT(ULONG x, ULONG y); - SVT_DLLPRIVATE ULONG ImpGGTRound(ULONG x, ULONG y); - - // Helper function for number strings - // append string symbols, insert leading 0 or ' ', or ... - SVT_DLLPRIVATE BOOL ImpNumberFill( String& sStr, - double& rNumber, - xub_StrLen& k, - USHORT& j, - USHORT nIx, - short eSymbolType ); - - // Helper function to fill in the integer part and the group (AKA thousand) separators - SVT_DLLPRIVATE BOOL ImpNumberFillWithThousands( String& sStr, - double& rNumber, - xub_StrLen k, - USHORT j, - USHORT nIx, - USHORT nDigCnt ); - // Hilfsfunktion zum Auffuellen der Vor- - // kommazahl auch mit Tausenderpunkt - - // Helper function to fill in the group (AKA thousand) separators - // or to skip additional digits - SVT_DLLPRIVATE void ImpDigitFill( String& sStr, - xub_StrLen nStart, - xub_StrLen& k, - USHORT nIx, - xub_StrLen & nDigitCount, - utl::DigitGroupingIterator & ); - - SVT_DLLPRIVATE BOOL ImpGetDateOutput( double fNumber, - USHORT nIx, - String& OutString ); - SVT_DLLPRIVATE BOOL ImpGetTimeOutput( double fNumber, - USHORT nIx, - String& OutString ); - SVT_DLLPRIVATE BOOL ImpGetDateTimeOutput( double fNumber, - USHORT nIx, - String& OutString ); - - // Switches to the "gregorian" calendar if the current calendar is - // non-"gregorian" and the era is a "Dummy" era of a calendar which doesn't - // know a "before" era (like zh_TW ROC or ja_JP Gengou). If switched and - // rOrgCalendar was "gregorian" the string is emptied. If rOrgCalendar was - // empty the previous calendar name and date/time are returned. - SVT_DLLPRIVATE BOOL ImpFallBackToGregorianCalendar( String& rOrgCalendar, double& fOrgDateTime ); - - // Append a "G" short era string of the given calendar. In the case of a - // Gengou calendar this is a one character abbreviation, for other - // calendars the XExtendedCalendar::getDisplayString() method is called. - SVT_DLLPRIVATE static void ImpAppendEraG( String& OutString, const CalendarWrapper& rCal, - sal_Int16 nNatNum ); - - SVT_DLLPRIVATE BOOL ImpGetNumberOutput( double fNumber, - USHORT nIx, - String& OutString ); - - SVT_DLLPRIVATE void ImpCopyNumberformat( const SvNumberformat& rFormat ); - - // normal digits or other digits, depending on ImpSvNumFor.aNatNum, - // [NatNum1], [NatNum2], ... - SVT_DLLPRIVATE String ImpGetNatNumString( const SvNumberNatNum& rNum, sal_Int32 nVal, - USHORT nMinDigits = 0 ) const; - - String ImpIntToString( USHORT nIx, sal_Int32 nVal, USHORT nMinDigits = 0 ) const - { - const SvNumberNatNum& rNum = NumFor[nIx].GetNatNum(); - if ( nMinDigits || rNum.IsComplete() ) - return ImpGetNatNumString( rNum, nVal, nMinDigits ); - return String::CreateFromInt32( nVal ); - } - - // transliterate according to NativeNumber - SVT_DLLPRIVATE void ImpTransliterateImpl( String& rStr, const SvNumberNatNum& rNum ) const; - - void ImpTransliterate( String& rStr, const SvNumberNatNum& rNum ) const - { - if ( rNum.IsComplete() ) - ImpTransliterateImpl( rStr, rNum ); - } - -#endif // _ZFORMAT_CXX - -}; - -#endif // _ZFORMAT_HXX diff --git a/svtools/inc/svtuno.hxx b/svtools/inc/svtuno.hxx deleted file mode 100644 index 378251488707..000000000000 --- a/svtools/inc/svtuno.hxx +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: svtuno.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVTOOLS_SVTUNO_HXX -#define _SVTOOLS_SVTUNO_HXX - -// Macro to define const unicode a'la "..." -// It's better then "OUString::createFromAscii(...)" !!! -#define DEFINE_CONST_UNICODE(CONSTASCII) UniString(RTL_CONSTASCII_USTRINGPARAM(CONSTASCII)) -#define DEFINE_CONST_OUSTRING(CONSTASCII) OUString(RTL_CONSTASCII_USTRINGPARAM(CONSTASCII)) - -// defines --------------------------------------------------------------- -#define UNOANY ::com::sun::star::uno::Any -#define UNOEXCEPTION ::com::sun::star::uno::Exception -#define UNOMUTEX ::osl::Mutex -#define UNOMUTEXGUARD ::osl::MutexGuard -#define UNOOIMPLEMENTATIONID ::cppu::OImplementationId -#define UNOOTYPECOLLECTION ::cppu::OTypeCollection -#define UNOOUSTRING ::rtl::OUString -#define UNOPROPERTYVALUE ::com::sun::star::beans::PropertyValue -#define UNOSTRINGPAIR ::com::sun::star::beans::StringPair -#define UNOREFERENCE ::com::sun::star::uno::Reference -#define UNORUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException -#define UNOINVALIDREGISTRYEXCEPTION ::com::sun::star::registry::InvalidRegistryException -#define UNOSEQUENCE ::com::sun::star::uno::Sequence -#define UNOTYPE ::com::sun::star::uno::Type -#define UNOURL ::com::sun::star::util::URL -#define UNOXINTERFACE ::com::sun::star::uno::XInterface -#define UNOXMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory -#define UNOXSINGLESERVICEFACTORY ::com::sun::star::lang::XSingleServiceFactory -#define UNOXTYPEPROVIDER ::com::sun::star::lang::XTypeProvider -#define UNOILLEGALARGUMENTEXCEPTION ::com::sun::star::lang::IllegalArgumentException - -// ----------------------------------------------------------------------- - -#endif diff --git a/svtools/inc/twain.hxx b/svtools/inc/twain.hxx deleted file mode 100644 index 786a8e65a624..000000000000 --- a/svtools/inc/twain.hxx +++ /dev/null @@ -1,99 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: twain.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _TWAIN_HXX -#define _TWAIN_HXX - -// please add new platforms if TWAIN is available -#if defined WIN || defined WNT || defined UNX -#define TWAIN_AVAILABLE 1 -#else -#undef TWAIN_AVAILABLE -#endif - -// include following only, if define is not set -#ifndef _TWAIN_HXX_CHECK - -#include - -// ----------- -// - Defines - -// ----------- - -#define TWAIN_ERR_NO_ERROR 0 -#define TWAIN_ERR_MODULE_NOT_LOADED 2 -#define TWAIN_ERR_DSMENTRY_NOT_FOUND 4 -#define TWAIN_ERR_SOURCE_MANAGER_NOT_OPENED 6 -#define TWAIN_ERR_SOURCE_SELECTION_DIALOG 8 - -// --------- -// - Twain - -// --------- - -struct TwainImp; -namespace com { namespace sun { namespace star { namespace lang { struct EventObject; } } } } - -class Twain -{ -friend class TwainEventListener; - -private: - - TwainImp* mpImp; - - Bitmap maBitmap; - Link maUpdateLink; - USHORT mnErrorCode; - BOOL mbScanning; - - Twain(); - Twain( const Twain& rTwain ); - const Twain& operator=( const Twain& rTwain ) { return *this; } - -protected: - - void Disposing( const com::sun::star::lang::EventObject& rEventObject ); - -public: - - Twain( const Link& rUpdateLink ); - ~Twain(); - - BOOL SelectSource(); - BOOL PerformTransfer(); - - Bitmap GetBitmap(); - - BOOL IsScanning() const { return mbScanning; } - USHORT GetErrorCode() const { return mnErrorCode; } -}; - -#endif // _TWAIN_HXX_CHECK -#endif // _TWAIN_HXX diff --git a/svtools/inc/urihelper.hxx b/svtools/inc/urihelper.hxx deleted file mode 100644 index 209f3f04e28a..000000000000 --- a/svtools/inc/urihelper.hxx +++ /dev/null @@ -1,238 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: urihelper.hxx,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SVTOOLS_URIHELPER_HXX -#define SVTOOLS_URIHELPER_HXX - -#include "svtools/svtdllapi.h" -#include "com/sun/star/uno/Reference.hxx" -#include -#include -#include -#include -#include - -namespace com { namespace sun { namespace star { - namespace uno { class XComponentContext; } - namespace uri { class XUriReference; } -} } } -namespace rtl { class OUString; } -class ByteString; -class CharClass; -class UniString; - -//============================================================================ -namespace URIHelper { - -/** - @ATT - Calling this function with defaulted arguments rMaybeFileHdl = Link() and - bCheckFileExists = true often leads to results that are not intended: - Whenever the given rTheBaseURIRef is a file URL, the given rTheRelURIRef is - relative, and rTheRelURIRef could also be smart-parsed as a non-file URL - (e.g., the relative URL "foo/bar" can be smart-parsed as "http://foo/bar"), - then SmartRel2Abs called with rMaybeFileHdl = Link() and bCheckFileExists = - true returns the non-file URL interpretation. To avoid this, either pass - some non-null rMaybeFileHdl if you want to check generated file URLs for - existence (see URIHelper::GetMaybeFileHdl), or use bCheckFileExists = false - if you want to generate file URLs without checking for their existence. -*/ -SVT_DLLPUBLIC UniString -SmartRel2Abs(INetURLObject const & rTheBaseURIRef, - ByteString const & rTheRelURIRef, - Link const & rMaybeFileHdl = Link(), - bool bCheckFileExists = true, - bool bIgnoreFragment = false, - INetURLObject::EncodeMechanism eEncodeMechanism - = INetURLObject::WAS_ENCODED, - INetURLObject::DecodeMechanism eDecodeMechanism - = INetURLObject::DECODE_TO_IURI, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8, - bool bRelativeNonURIs = false, - INetURLObject::FSysStyle eStyle = INetURLObject::FSYS_DETECT); - -/** - @ATT - Calling this function with defaulted arguments rMaybeFileHdl = Link() and - bCheckFileExists = true often leads to results that are not intended: - Whenever the given rTheBaseURIRef is a file URL, the given rTheRelURIRef is - relative, and rTheRelURIRef could also be smart-parsed as a non-file URL - (e.g., the relative URL "foo/bar" can be smart-parsed as "http://foo/bar"), - then SmartRel2Abs called with rMaybeFileHdl = Link() and bCheckFileExists = - true returns the non-file URL interpretation. To avoid this, either pass - some non-null rMaybeFileHdl if you want to check generated file URLs for - existence (see URIHelper::GetMaybeFileHdl), or use bCheckFileExists = false - if you want to generate file URLs without checking for their existence. -*/ -SVT_DLLPUBLIC UniString -SmartRel2Abs(INetURLObject const & rTheBaseURIRef, - UniString const & rTheRelURIRef, - Link const & rMaybeFileHdl = Link(), - bool bCheckFileExists = true, - bool bIgnoreFragment = false, - INetURLObject::EncodeMechanism eEncodeMechanism - = INetURLObject::WAS_ENCODED, - INetURLObject::DecodeMechanism eDecodeMechanism - = INetURLObject::DECODE_TO_IURI, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8, - bool bRelativeNonURIs = false, - INetURLObject::FSysStyle eStyle = INetURLObject::FSYS_DETECT); - -//============================================================================ -SVT_DLLPUBLIC void SetMaybeFileHdl(Link const & rTheMaybeFileHdl); - -//============================================================================ -SVT_DLLPUBLIC Link GetMaybeFileHdl(); - -/** - Converts a URI reference to a relative one, ignoring certain differences (for - example, treating file URLs for case-ignoring file systems - case-insensitively). - - @param context a component context; must not be null - - @param baseUriReference a base URI reference - - @param uriReference a URI reference - - @return a URI reference representing the given uriReference relative to the - given baseUriReference; if the given baseUriReference is not an absolute, - hierarchical URI reference, or the given uriReference is not a valid URI - reference, null is returned - - @exception std::bad_alloc if an out-of-memory condition occurs - - @exception com::sun::star::uno::RuntimeException if any error occurs - */ -SVT_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::uri::XUriReference > -normalizedMakeRelative( - com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > - const & context, - rtl::OUString const & baseUriReference, rtl::OUString const & uriReference); - -/** - A variant of normalizedMakeRelative with a simplified interface. - - Internally calls normalizedMakeRelative with the default component context. - - @param baseUriReference a base URI reference, passed to - normalizedMakeRelative - - @param uriReference a URI reference, passed to normalizedMakeRelative - - @return if the XUriReference returnd by normalizedMakeRelative is empty, - uriReference is returned unmodified; otherwise, the result of calling - XUriReference::getUriReference on the XUriReference returnd by - normalizedMakeRelative is returned - - @exception std::bad_alloc if an out-of-memory condition occurs - - @exception com::sun::star::uno::RuntimeException if any error occurs - - @deprecated - No code should rely on the default component context. -*/ -SVT_DLLPUBLIC rtl::OUString simpleNormalizedMakeRelative( - rtl::OUString const & baseUriReference, rtl::OUString const & uriReference); - -//============================================================================ -SVT_DLLPUBLIC UniString -FindFirstURLInText(UniString const & rText, - xub_StrLen & rBegin, - xub_StrLen & rEnd, - CharClass const & rCharClass, - INetURLObject::EncodeMechanism eMechanism - = INetURLObject::WAS_ENCODED, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8, - INetURLObject::FSysStyle eStyle - = INetURLObject::FSYS_DETECT); - -//============================================================================ -/** Remove any password component from both absolute and relative URLs. - - @ATT The current implementation will not remove a password from a - relative URL that has an authority component (e.g., the password is not - removed from the relative ftp URL ). But - since our functions to translate between absolute and relative URLs never - produce relative URLs with authority components, this is no real problem. - - @ATT For relative URLs (or anything not recognized as an absolute URI), - the current implementation will return the input unmodified, not applying - any translations implied by the encode/decode parameters. - - @param rURI An absolute or relative URI reference. - - @param eEncodeMechanism See the general discussion for INetURLObject set- - methods. - - @param eDecodeMechanism See the general discussion for INetURLObject get- - methods. - - @param eCharset See the general discussion for INetURLObject get- and - set-methods. - - @return The input URI with any password component removed. - */ -SVT_DLLPUBLIC UniString -removePassword(UniString const & rURI, - INetURLObject::EncodeMechanism eEncodeMechanism - = INetURLObject::WAS_ENCODED, - INetURLObject::DecodeMechanism eDecodeMechanism - = INetURLObject::DECODE_TO_IURI, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); - -//============================================================================ -/** Query the notational conventions used in the file system provided by some - file content provider. - - @param rFileUrl This file URL determines which file content provider is - used to query the desired information. (The UCB's usual mapping from URLs - to content providers is used.) - - @param bAddConvenienceStyles If true, the return value contains not only - the style bit corresponding to the queried content provider's conventions, - but may also contain additional style bits that make using this function - more convenient in certain situations. Currently, the effect is that - FSYS_UNX is extended with FSYS_VOS, and both FSYS_DOS and FSYS_MAC are - extended with FSYS_VOS and FSYS_UNX (i.e., the---unambiguous---detection - of VOS style and Unix style file system paths is always enabled); also, in - case the content provider's conventions cannot be determined, FSYS_DETECT - is returned instead of FSysStyle(0). - - @return The style bit corresponding to the queried content provider's - conventions, or FSysStyle(0) if these cannot be determined. - */ -SVT_DLLPUBLIC INetURLObject::FSysStyle queryFSysStyle(UniString const & rFileUrl, - bool bAddConvenienceStyles = true) - throw (com::sun::star::uno::RuntimeException); - -} - -#endif // SVTOOLS_URIHELPER_HXX diff --git a/svtools/inc/urlbmk.hxx b/svtools/inc/urlbmk.hxx deleted file mode 100644 index d3342b398878..000000000000 --- a/svtools/inc/urlbmk.hxx +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: urlbmk.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _URLBMK_HXX -#define _URLBMK_HXX - - -#include - -//========================================================================= - -class INetBookmark - -/* [Beschreibung] - - Diese Klasse stellt ein Bookmark dar, welches aus einer URL und - einem dazuge"horigen Beschreibungstext besteht. - - Es gibt ein eigenes Clipboardformat und Hilfsmethoden zum Kopieren - und Einf"ugen in und aus Clipboard und DragServer. -*/ - -{ - String aUrl; - String aDescr; - -protected: - - void SetURL( const String& rS ) { aUrl = rS; } - void SetDescription( const String& rS ) { aDescr = rS; } - -public: - INetBookmark( const String &rUrl, const String &rDescr ) - : aUrl( rUrl ), aDescr( rDescr ) - {} - INetBookmark() - {} - - const String& GetURL() const { return aUrl; } - const String& GetDescription() const { return aDescr; } -}; - - -#endif - diff --git a/svtools/inc/whiter.hxx b/svtools/inc/whiter.hxx deleted file mode 100644 index 87ed2cbc76f0..000000000000 --- a/svtools/inc/whiter.hxx +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: whiter.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFX_WHITER_HXX -#define _SFX_WHITER_HXX - -#include "svtools/svldllapi.h" - -#ifndef INCLUDED_LIMITS_H -#include -#define INCLUDED_LIMITS_H -#endif -#include - -class SfxItemSet; - - -// INCLUDE --------------------------------------------------------------- - -class SVL_DLLPUBLIC SfxWhichIter -{ - const USHORT *pRanges, *pStart; - USHORT nOfst, nFrom, nTo; - -public: - SfxWhichIter( const SfxItemSet& rSet, USHORT nFrom = 0, USHORT nTo = USHRT_MAX ); - ~SfxWhichIter(); - - USHORT GetCurWhich() const { return *pRanges + nOfst; } - USHORT NextWhich(); - USHORT PrevWhich(); - - USHORT FirstWhich(); - USHORT LastWhich(); -}; - -#endif diff --git a/svtools/inc/whmap.hxx b/svtools/inc/whmap.hxx deleted file mode 100644 index 9677bdf328ce..000000000000 --- a/svtools/inc/whmap.hxx +++ /dev/null @@ -1,61 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: whmap.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFX_WHMAP_HXX -#define _SFX_WHMAP_HXX - -#include - -struct SfxWhichMapEntry -{ - USHORT nWhichId; - USHORT nSlotId; -}; - -class SfxWhichMap -{ - const SfxWhichMapEntry *pMap; - -public: - inline SfxWhichMap( const SfxWhichMapEntry *pMappings = 0 ); - virtual ~SfxWhichMap(); - - int IsNull() const - { return 0 == pMap; } - virtual USHORT GetWhich(USHORT nSlot) const; - virtual USHORT GetSlot(USHORT nWhich) const; - virtual SfxWhichMap*Clone() const; -}; - -inline SfxWhichMap::SfxWhichMap( const SfxWhichMapEntry *pMappings ): - pMap( pMappings ) -{ -} - -#endif diff --git a/svtools/inc/xbmread.hxx b/svtools/inc/xbmread.hxx deleted file mode 100644 index c9623fbb2cda..000000000000 --- a/svtools/inc/xbmread.hxx +++ /dev/null @@ -1,100 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: xbmread.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _XBMREAD_HXX -#define _XBMREAD_HXX - -#ifndef _GRAPH_HXX -#include -#endif -#ifndef _BMPACC_HXX -#include -#endif - -#ifdef _XBMPRIVATE - -// --------- -// - Enums - -// --------- - -enum XBMFormat -{ - XBM10, - XBM11 -}; - -enum ReadState -{ - XBMREAD_OK, - XBMREAD_ERROR, - XBMREAD_NEED_MORE -}; - -// ------------- -// - XBMReader - -// ------------- - -class XBMReader : public GraphicReader -{ - SvStream& rIStm; - Bitmap aBmp1; - BitmapWriteAccess* pAcc1; - short* pHexTable; - BitmapColor aWhite; - BitmapColor aBlack; - long nLastPos; - long nWidth; - long nHeight; - BOOL bStatus; - - void InitTable(); - ByteString FindTokenLine( SvStream* pInStm, const char* pTok1, - const char* pTok2 = NULL, const char* pTok3 = NULL ); - long ParseDefine( const sal_Char* pDefine ); - BOOL ParseData( SvStream* pInStm, const ByteString& aLastLine, XBMFormat eFormat ); - - -public: - - XBMReader( SvStream& rStm ); - virtual ~XBMReader(); - - ReadState ReadXBM( Graphic& rGraphic ); -}; - -#endif // _XBMPRIVATE - -// ------------- -// - ImportXBM - -// ------------- - -BOOL ImportXBM( SvStream& rStream, Graphic& rGraphic ); - -#endif // _XBMREAD_HXX diff --git a/svtools/inc/xmlcnimp.hxx b/svtools/inc/xmlcnimp.hxx deleted file mode 100644 index 8fb212fe70bd..000000000000 --- a/svtools/inc/xmlcnimp.hxx +++ /dev/null @@ -1,143 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: xmlcnimp.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVTOOLS_XMLCNIMP_HXX -#define _SVTOOLS_XMLCNIMP_HXX - -#include -#include - -#ifndef _SVTOOLS_NMSPMAP_HXX -#include -#endif - -namespace rtl { class OUString; } - -typedef ::rtl::OUString *OUStringPtr; -SV_DECL_PTRARR_DEL( OUStringsDtor2_Impl, OUStringPtr, 5, 5 ) - -class SvXMLAttrContainerItem_Impl -{ - SvXMLNamespaceMap aNamespaceMap; - SvUShorts aPrefixPoss; - OUStringsDtor2_Impl aLNames; - OUStringsDtor2_Impl aValues; - - inline sal_uInt16 GetPrefixPos( sal_uInt16 i ) const; -public: - - SvXMLAttrContainerItem_Impl( const SvXMLAttrContainerItem_Impl& rImpl ); - SvXMLAttrContainerItem_Impl(); - - int operator ==( const SvXMLAttrContainerItem_Impl& rCmp ) const; - - BOOL AddAttr( const ::rtl::OUString& rLName, const ::rtl::OUString& rValue ); - BOOL AddAttr( const ::rtl::OUString& rPrefix, const ::rtl::OUString& rNamespace, - const ::rtl::OUString& rLName, const ::rtl::OUString& rValue ); - BOOL AddAttr( const ::rtl::OUString& rPrefix, - const ::rtl::OUString& rLName, - const ::rtl::OUString& rValue ); - - sal_uInt16 GetAttrCount() const { return aLNames.Count(); } - inline ::rtl::OUString GetAttrNamespace( sal_uInt16 i ) const; - inline ::rtl::OUString GetAttrPrefix( sal_uInt16 i ) const; - inline const ::rtl::OUString& GetAttrLName( sal_uInt16 i ) const; - inline const ::rtl::OUString& GetAttrValue( sal_uInt16 i ) const; - - sal_uInt16 GetFirstNamespaceIndex() const { return aNamespaceMap.GetFirstIndex(); } - sal_uInt16 GetNextNamespaceIndex( sal_uInt16 nIdx ) const { return aNamespaceMap.GetNextIndex( nIdx ); } - inline const ::rtl::OUString& GetNamespace( sal_uInt16 i ) const; - inline const ::rtl::OUString& GetPrefix( sal_uInt16 i ) const; - - BOOL SetAt( sal_uInt16 i, - const ::rtl::OUString& rLName, const ::rtl::OUString& rValue ); - BOOL SetAt( sal_uInt16 i, - const ::rtl::OUString& rPrefix, const ::rtl::OUString& rNamespace, - const ::rtl::OUString& rLName, const ::rtl::OUString& rValue ); - BOOL SetAt( sal_uInt16 i, - const ::rtl::OUString& rPrefix, - const ::rtl::OUString& rLName, - const ::rtl::OUString& rValue ); - - void Remove( sal_uInt16 i ); -}; - -inline sal_uInt16 SvXMLAttrContainerItem_Impl::GetPrefixPos( sal_uInt16 i ) const -{ -// DBG_ASSERT( i >= 0 && i < aPrefixPoss.Count(), -// "SvXMLAttrContainerItem_Impl::GetPrefixPos: illegal index" ); - return aPrefixPoss[i]; -} - -inline ::rtl::OUString SvXMLAttrContainerItem_Impl::GetAttrNamespace( sal_uInt16 i ) const -{ - ::rtl::OUString sRet; - sal_uInt16 nPos = GetPrefixPos( i ); - if( USHRT_MAX != nPos ) - sRet = aNamespaceMap.GetNameByIndex( nPos ); - return sRet; -} - -inline ::rtl::OUString SvXMLAttrContainerItem_Impl::GetAttrPrefix( sal_uInt16 i ) const -{ - ::rtl::OUString sRet; - sal_uInt16 nPos = GetPrefixPos( i ); - if( USHRT_MAX != nPos ) - sRet = aNamespaceMap.GetPrefixByIndex( nPos ); - return sRet; -} - -inline const ::rtl::OUString& SvXMLAttrContainerItem_Impl::GetAttrLName(sal_uInt16 i) const -{ - DBG_ASSERT( i >= 0 && i < aLNames.Count(), - "SvXMLAttrContainerItem_Impl::GetLName: illegal index" ); - return *aLNames[i]; -} - -inline const ::rtl::OUString& SvXMLAttrContainerItem_Impl::GetAttrValue(sal_uInt16 i) const -{ - DBG_ASSERT( i >= 0 && i < aValues.Count(), - "SvXMLAttrContainerItem_Impl::GetValue: illegal index" ); - return *aValues[i]; -} - -inline const ::rtl::OUString& SvXMLAttrContainerItem_Impl::GetNamespace( - sal_uInt16 i ) const -{ - return aNamespaceMap.GetNameByIndex( i ); -} - -inline const ::rtl::OUString& SvXMLAttrContainerItem_Impl::GetPrefix( sal_uInt16 i ) const -{ - return aNamespaceMap.GetPrefixByIndex( i ); -} - -#endif - diff --git a/svtools/inc/xmlement.hxx b/svtools/inc/xmlement.hxx deleted file mode 100644 index ed0e4dafc57a..000000000000 --- a/svtools/inc/xmlement.hxx +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: xmlement.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVTOOLS_XMLEMENT_HXX -#define _SVTOOLS_XMLEMENT_HXX - -#ifndef _SAL_TYPES_H -#include -#endif - -struct SvXMLEnumMapEntry -{ - const sal_Char *pName; - sal_uInt16 nValue; -}; - - -#endif // _SVTOOLS_XMLEMENT_HXX - diff --git a/svtools/inc/xpmread.hxx b/svtools/inc/xpmread.hxx deleted file mode 100644 index f1a76c9bc62f..000000000000 --- a/svtools/inc/xpmread.hxx +++ /dev/null @@ -1,134 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: xpmread.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _XPMREAD_HXX -#define _XPMREAD_HXX - -#ifndef _BITMAP_HXX -#include -#endif - -#ifdef _XPMPRIVATE - -#define XPMTEMPBUFSIZE 0x00008000 -#define XPMSTRINGBUF 0x00008000 - -#define XPMIDENTIFIER 0x00000001 // mnIdentifier includes on of the six phases -#define XPMDEFINITION 0x00000002 // the XPM format consists of -#define XPMVALUES 0x00000003 -#define XPMCOLORS 0x00000004 -#define XPMPIXELS 0x00000005 -#define XPMEXTENSIONS 0x00000006 -#define XPMENDEXT 0x00000007 - - -#define XPMREMARK 0x00000001 // defines used by mnStatus -#define XPMDOUBLE 0x00000002 -#define XPMSTRING 0x00000004 -#define XPMFINISHED 0x00000008 - -#define XPMCASESENSITIVE 0x00000001 -#define XPMCASENONSENSITIVE 0x00000002 - -// --------- -// - Enums - -// --------- - -enum ReadState -{ - XPMREAD_OK, - XPMREAD_ERROR, - XPMREAD_NEED_MORE -}; - -// ------------- -// - XPMReader - -// ------------- - -class BitmapWriteAccess; -class Graphic; - -class XPMReader : public GraphicReader -{ -private: - - SvStream& mrIStm; - Bitmap maBmp; - BitmapWriteAccess* mpAcc; - Bitmap maMaskBmp; - BitmapWriteAccess* mpMaskAcc; - long mnLastPos; - - ULONG mnWidth; - ULONG mnHeight; - ULONG mnColors; - ULONG mnCpp; // characters per pix - BOOL mbTransparent; - BOOL mbStatus; - ULONG mnStatus; - ULONG mnIdentifier; - BYTE mcThisByte; - BYTE mcLastByte; - ULONG mnTempAvail; - BYTE* mpTempBuf; - BYTE* mpTempPtr; - BYTE* mpFastColorTable; - BYTE* mpColMap; - ULONG mnStringSize; - BYTE* mpStringBuf; - ULONG mnParaSize; - BYTE* mpPara; - - BOOL ImplGetString( void ); - BOOL ImplGetColor( ULONG ); - BOOL ImplGetScanLine( ULONG ); - BOOL ImplGetColSub( BYTE* ); - BOOL ImplGetColKey( BYTE ); - void ImplGetRGBHex( BYTE*, ULONG ); - BOOL ImplGetPara( ULONG numb ); - BOOL ImplCompare( BYTE*, BYTE*, ULONG, ULONG nmode = XPMCASENONSENSITIVE ); - ULONG ImplGetULONG( ULONG nPara ); - -public: - XPMReader( SvStream& rStm ); - virtual ~XPMReader(); - - ReadState ReadXPM( Graphic& rGraphic ); -}; - -#endif // _XPMPRIVATE - -// ------------- -// - ImportXPM - -// ------------- - -BOOL ImportXPM( SvStream& rStream, Graphic& rGraphic ); - -#endif // _XPMREAD_HXX diff --git a/svtools/inc/zforfind.hxx b/svtools/inc/zforfind.hxx deleted file mode 100644 index 049925f2034f..000000000000 --- a/svtools/inc/zforfind.hxx +++ /dev/null @@ -1,291 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: zforfind.hxx,v $ - * $Revision: 1.13 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _ZFORFIND_HXX -#define _ZFORFIND_HXX - -#include - -class Date; -class SvNumberformat; -class SvNumberFormatter; - -#define SV_MAX_ANZ_INPUT_STRINGS 20 // max count of substrings in input scanner - -class ImpSvNumberInputScan -{ -public: - ImpSvNumberInputScan( SvNumberFormatter* pFormatter ); - ~ImpSvNumberInputScan(); - -/*!*/ void ChangeIntl(); // MUST be called if language changes - - /// set reference date for offset calculation - void ChangeNullDate( - const USHORT nDay, - const USHORT nMonth, - const USHORT nYear ); - - /// convert input string to number - BOOL IsNumberFormat( - const String& rString, /// input string - short& F_Type, /// format type (in + out) - double& fOutNumber, /// value determined (out) - const SvNumberformat* pFormat = NULL /// optional a number format to which compare against - ); - - /// after IsNumberFormat: get decimal position - short GetDecPos() const { return nDecPos; } - /// after IsNumberFormat: get count of numeric substrings in input string - USHORT GetAnzNums() const { return nAnzNums; } - - /// set threshold of two-digit year input - void SetYear2000( USHORT nVal ) { nYear2000 = nVal; } - /// get threshold of two-digit year input - USHORT GetYear2000() const { return nYear2000; } - -private: - SvNumberFormatter* pFormatter; - String* pUpperMonthText; // Array of month names, uppercase - String* pUpperAbbrevMonthText; // Array of month names, abbreviated, uppercase - String* pUpperDayText; // Array of day of week names, uppercase - String* pUpperAbbrevDayText; // Array of day of week names, abbreviated, uppercase - String aUpperCurrSymbol; // Currency symbol, uppercase - BOOL bTextInitialized; // Whether days and months are initialized - Date* pNullDate; // 30Dec1899 - // Variables for provisional results: - String sStrArray[SV_MAX_ANZ_INPUT_STRINGS]; // Array of scanned substrings - BOOL IsNum[SV_MAX_ANZ_INPUT_STRINGS]; // Whether a substring is numeric - USHORT nNums[SV_MAX_ANZ_INPUT_STRINGS]; // Sequence of offsets to numeric strings - USHORT nAnzStrings; // Total count of scanned substrings - USHORT nAnzNums; // Count of numeric substrings - BOOL bDecSepInDateSeps; // True <=> DecSep in {.,-,/,DateSep} - BYTE nMatchedAllStrings; // Scan...String() matched all substrings, - // bit mask of nMatched... constants - - static const BYTE nMatchedEndString; // 0x01 - static const BYTE nMatchedMidString; // 0x02 - static const BYTE nMatchedStartString; // 0x04 - static const BYTE nMatchedVirgin; // 0x08 - static const BYTE nMatchedUsedAsReturn; // 0x10 - - int nSign; // Sign of number - short nMonth; // Month (1..x) if date - // negative => short format - short nMonthPos; // 1 = front, 2 = middle - // 3 = end - USHORT nTimePos; // Index of first time separator (+1) - short nDecPos; // Index of substring containing "," (+1) - short nNegCheck; // '( )' for negative - short nESign; // Sign of exponent - short nAmPm; // +1 AM, -1 PM, 0 if none - short nLogical; // -1 => False, 1 => True - USHORT nThousand; // Count of group (AKA thousand) separators - USHORT nPosThousandString; // Position of concatenaded 000,000,000 string - short eScannedType; // Scanned type - short eSetType; // Preset Type - - USHORT nStringScanNumFor; // Fixed strings recognized in - // pFormat->NumFor[nNumForStringScan] - short nStringScanSign; // Sign resulting of FixString - USHORT nYear2000; // Two-digit threshold - // Year as 20xx - // default 18 - // number <= nYear2000 => 20xx - // number > nYear2000 => 19xx - USHORT nTimezonePos; // Index of timezone separator (+1) - BYTE nMayBeIso8601; // 0:=dontknowyet, 1:=yes, 2:=no - -#ifdef _ZFORFIND_CXX // methods private to implementation - void Reset(); // Reset all variables before start of analysis - - void InitText(); // Init of months and days of week - - // Convert string to double. - // Only simple unsigned floating point values without any error detection, - // decimal separator has to be '.' - // If bForceFraction==TRUE the string is taken to be the fractional part - // of 0.1234 without the leading 0. (thus being just "1234"). - double StringToDouble( - const String& rStr, - BOOL bForceFraction = FALSE ); - - BOOL NextNumberStringSymbol( // Next number/string symbol - const sal_Unicode*& pStr, - String& rSymbol ); - - BOOL SkipThousands( // Concatenate ,000,23 blocks - const sal_Unicode*& pStr, // in input to 000123 - String& rSymbol ); - - void NumberStringDivision( // Divide numbers/strings into - const String& rString ); // arrays and variables above. - // Leading blanks and blanks - // after numbers are thrown away - - - // optimized substring versions - - static inline BOOL StringContains( // Whether rString contains rWhat at nPos - const String& rWhat, - const String& rString, - xub_StrLen nPos ) - { // mostly used with one character - if ( rWhat.GetChar(0) != rString.GetChar(nPos) ) - return FALSE; - return StringContainsImpl( rWhat, rString, nPos ); - } - static inline BOOL StringPtrContains( // Whether pString contains rWhat at nPos - const String& rWhat, - const sal_Unicode* pString, - xub_StrLen nPos ) // nPos MUST be a valid offset from pString - { // mostly used with one character - if ( rWhat.GetChar(0) != *(pString+nPos) ) - return FALSE; - return StringPtrContainsImpl( rWhat, pString, nPos ); - } - static BOOL StringContainsImpl( //! DO NOT use directly - const String& rWhat, - const String& rString, - xub_StrLen nPos ); - static BOOL StringPtrContainsImpl( //! DO NOT use directly - const String& rWhat, - const sal_Unicode* pString, - xub_StrLen nPos ); - - - static inline BOOL SkipChar( // Skip a special character - sal_Unicode c, - const String& rString, - xub_StrLen& nPos ); - static inline void SkipBlanks( // Skip blank - const String& rString, - xub_StrLen& nPos ); - static inline BOOL SkipString( // Jump over rWhat in rString at nPos - const String& rWhat, - const String& rString, - xub_StrLen& nPos ); - - inline BOOL GetThousandSep( // Recognizes exactly ,111 as group separator - const String& rString, - xub_StrLen& nPos, - USHORT nStringPos ); - short GetLogical( // Get boolean value - const String& rString ); - short GetMonth( // Get month and advance string position - const String& rString, - xub_StrLen& nPos ); - int GetDayOfWeek( // Get day of week and advance string position - const String& rString, - xub_StrLen& nPos ); - BOOL GetCurrency( // Get currency symbol and advance string position - const String& rString, - xub_StrLen& nPos, - const SvNumberformat* pFormat = NULL ); // optional number format to match against - BOOL GetTimeAmPm( // Get symbol AM or PM and advance string position - const String& rString, - xub_StrLen& nPos ); - inline BOOL GetDecSep( // Get decimal separator and advance string position - const String& rString, - xub_StrLen& nPos ); - inline BOOL GetTime100SecSep( // Get hundredth seconds separator and advance string position - const String& rString, - xub_StrLen& nPos ); - int GetSign( // Get sign and advance string position - const String& rString, // Including special case '(' - xub_StrLen& nPos ); - short GetESign( // Get sign of exponent and advance string position - const String& rString, - xub_StrLen& nPos ); - - inline BOOL GetNextNumber( // Get next number as array offset - USHORT& i, - USHORT& j ); - - void GetTimeRef( // Converts time -> double (only decimals) - double& fOutNumber, // result as double - USHORT nIndex, // Index of hour in input - USHORT nAnz ); // Count of time substrings in input - USHORT ImplGetDay ( USHORT nIndex ); // Day input, 0 if no match - USHORT ImplGetMonth( USHORT nIndex ); // Month input, zero based return, NumberOfMonths if no match - USHORT ImplGetYear ( USHORT nIndex ); // Year input, 0 if no match - BOOL GetDateRef( // Conversion of date to number - double& fDays, // OUT: days diff to null date - USHORT& nCounter, // Count of date substrings - const SvNumberformat* pFormat = NULL ); // optional number format to match against - - BOOL ScanStartString( // Analyze start of string - const String& rString, - const SvNumberformat* pFormat = NULL ); - BOOL ScanMidString( // Analyze middle substring - const String& rString, - USHORT nStringPos, - const SvNumberformat* pFormat = NULL ); - BOOL ScanEndString( // Analyze end of string - const String& rString, - const SvNumberformat* pFormat = NULL ); - - // Whether input may be a ISO 8601 date format, yyyy-mm-dd... - // checks if at least 3 numbers and first number>31 - bool MayBeIso8601(); - - // Compare rString to substring of array indexed by nString - // nString == 0xFFFF => last substring - BOOL ScanStringNumFor( - const String& rString, - xub_StrLen nPos, - const SvNumberformat* pFormat, - USHORT nString, - BOOL bDontDetectNegation = FALSE ); - - // if nMatchedAllStrings set nMatchedUsedAsReturn and return TRUE, - // else do nothing and return FALSE - BOOL MatchedReturn(); - - //! Be sure that the string to be analyzed is already converted to upper - //! case and if it contained native humber digits that they are already - //! converted to ASCII. - BOOL IsNumberFormatMain( // Main anlyzing function - const String& rString, - double& fOutNumber, // return value if string is numeric - const SvNumberformat* pFormat = NULL // optional number format to match against - ); - - static inline BOOL MyIsdigit( sal_Unicode c ); - - // native number transliteration if necessary - void TransformInput( String& rString ); - -#endif // _ZFORFIND_CXX -}; - - - -#endif // _ZFORFIND_HXX diff --git a/svtools/qa/complex/ConfigItems/CheckConfigItems.java b/svtools/qa/complex/ConfigItems/CheckConfigItems.java deleted file mode 100644 index 97cc21fdec9f..000000000000 --- a/svtools/qa/complex/ConfigItems/CheckConfigItems.java +++ /dev/null @@ -1,186 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: CheckConfigItems.java,v $ - * - * $Revision: 1.1.4.2 $ - * - * last change: $Author: as $ $Date: 2008/03/19 11:09:22 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -package complex.ConfigItems; - -import com.sun.star.beans.*; -import com.sun.star.lang.*; -import com.sun.star.uno.*; -import com.sun.star.task.*; - -import complexlib.*; - -import java.lang.*; -import java.util.*; - -//----------------------------------------------- -/** @short todo document me - */ -public class CheckConfigItems extends ComplexTestCase -{ - //------------------------------------------- - // some const - - //------------------------------------------- - // member - - /** points to the global uno service manager. */ - private XMultiServiceFactory m_xSmgr = null; - - /** implements real config item tests in C++. */ - private XJob m_xTest = null; - - //------------------------------------------- - // test environment - - //------------------------------------------- - /** @short A function to tell the framework, - which test functions are available. - - @return All test methods. - @todo Think about selection of tests from outside ... - */ - public String[] getTestMethodNames() - { - return new String[] - { - "checkPicklist", - "checkURLHistory", - "checkHelpBookmarks", - "checkPrintOptions", - "checkAccessibilityOptions", - "checkUserOptions" - }; - } - - //------------------------------------------- - /** @short Create the environment for following tests. - - @descr Use either a component loader from desktop or - from frame - */ - public void before() - throws java.lang.Exception - { - // get uno service manager from global test environment - m_xSmgr = (XMultiServiceFactory)param.getMSF(); - - // TODO register helper service - - // create module manager - m_xTest = (XJob)UnoRuntime.queryInterface( - XJob.class, - m_xSmgr.createInstance("com.sun.star.comp.svtools.ConfigItemTest")); - } - - //------------------------------------------- - /** @short close the environment. - */ - public void after() - throws java.lang.Exception - { - // TODO deregister helper service - - m_xTest = null; - m_xSmgr = null; - } - - //------------------------------------------- - /** @todo document me - */ - public void checkPicklist() - throws java.lang.Exception - { - impl_triggerTest("checkPicklist"); - } - - //------------------------------------------- - /** @todo document me - */ - public void checkURLHistory() - throws java.lang.Exception - { - impl_triggerTest("checkURLHistory"); - } - - //------------------------------------------- - /** @todo document me - */ - public void checkHelpBookmarks() - throws java.lang.Exception - { - impl_triggerTest("checkHelpBookmarks"); - } - - //------------------------------------------- - /** @todo document me - */ - public void checkPrintOptions() - throws java.lang.Exception - { - impl_triggerTest("checkPrintOptions"); - } - - //------------------------------------------- - /** @todo document me - */ - public void checkAccessibilityOptions() - throws java.lang.Exception - { - impl_triggerTest("checkAccessibilityOptions"); - } - - //------------------------------------------- - /** @todo document me - */ - public void checkUserOptions() - throws java.lang.Exception - { - impl_triggerTest("checkUserOptions"); - } - - //------------------------------------------- - /** @todo document me - */ - private void impl_triggerTest(String sTest) - throws java.lang.Exception - { - NamedValue[] lArgs = new NamedValue[1]; - lArgs[0] = new NamedValue(); - lArgs[0].Name = "Test"; - lArgs[0].Value = sTest; - m_xTest.execute(lArgs); - } -} diff --git a/svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.cxx b/svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.cxx deleted file mode 100644 index d853bf926467..000000000000 --- a/svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.cxx +++ /dev/null @@ -1,400 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: AccessibilityOptTest.cxx,v $ - * - * $Revision: 1.1.4.2 $ - * - * last change: $Author: as $ $Date: 2008/03/19 11:09:23 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#include "AccessibilityOptTest.hxx" -#include "configitems/accessibilityoptions_const.hxx" - -#include -#include - -#include -#include - -namespace css = ::com::sun::star; - -AccessibilityOptTest::AccessibilityOptTest() -{ - m_xCfg = css::uno::Reference< css::container::XNameAccess >( - ::comphelper::ConfigurationHelper::openConfig( - ::utl::getProcessServiceFactory(), - s_sAccessibility, - ::comphelper::ConfigurationHelper::E_STANDARD), - css::uno::UNO_QUERY); -} - -AccessibilityOptTest::~AccessibilityOptTest() -{ - if (m_xCfg.is()) - m_xCfg.clear(); -} - -//============================================================================= -//test GetAutoDetectSystemHC() -void AccessibilityOptTest::impl_checkGetAutoDetectSystemHC() -{ - css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); - sal_Bool bAutoDetectSystemHC; - sal_Bool bAutoDetectSystemHC_; - - bAutoDetectSystemHC = aAccessibilityOpt.GetAutoDetectSystemHC(); - xSet->setPropertyValue( s_sAutoDetectSystemHC, css::uno::makeAny(bAutoDetectSystemHC ? sal_False:sal_True) ); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - bAutoDetectSystemHC_ = aAccessibilityOpt.GetAutoDetectSystemHC(); - - if ( bAutoDetectSystemHC_ == bAutoDetectSystemHC )//old config item will not throw error - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetAutoDetectSystemHC() error!")), 0); -} - -//============================================================================= -//test GetIsForPagePreviews() -void AccessibilityOptTest::impl_checkGetIsForPagePreviews() -{ - css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); - sal_Bool bIsForPagePreviews ; - sal_Bool bIsForPagePreviews_; - - bIsForPagePreviews = aAccessibilityOpt.GetIsForPagePreviews(); - xSet->setPropertyValue( s_sIsForPagePreviews, css::uno::makeAny(bIsForPagePreviews ? sal_False:sal_True) ); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - bIsForPagePreviews_ = aAccessibilityOpt.GetIsForPagePreviews(); - - if ( bIsForPagePreviews_ == bIsForPagePreviews )//old config item will not throw error - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsForPagePreviews() error!")), 0); -} - -//============================================================================= -//test impl_checkGetIsHelpTipsDisappear() -void AccessibilityOptTest::impl_checkGetIsHelpTipsDisappear() -{ - css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); - sal_Bool bIsHelpTipsDisappear ; - sal_Bool bIsHelpTipsDisappear_; - - bIsHelpTipsDisappear = aAccessibilityOpt.GetIsHelpTipsDisappear(); - xSet->setPropertyValue( s_sIsHelpTipsDisappear, css::uno::makeAny(bIsHelpTipsDisappear ? sal_False:sal_True) ); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - bIsHelpTipsDisappear_ = aAccessibilityOpt.GetIsHelpTipsDisappear(); - - if ( bIsHelpTipsDisappear_ == bIsHelpTipsDisappear )//old config item will not throw error - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsHelpTipsDisappear() error!")), 0); -} - -//============================================================================= -//test impl_checkGetIsAllowAnimatedGraphics() -void AccessibilityOptTest::impl_checkGetIsAllowAnimatedGraphics() -{ - css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); - sal_Bool bIsAllowAnimatedGraphics ; - sal_Bool bIsAllowAnimatedGraphics_; - - bIsAllowAnimatedGraphics = aAccessibilityOpt.GetIsAllowAnimatedGraphics(); - xSet->setPropertyValue( s_sIsAllowAnimatedGraphics, css::uno::makeAny(bIsAllowAnimatedGraphics ? sal_False:sal_True) ); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - bIsAllowAnimatedGraphics_ = aAccessibilityOpt.GetIsAllowAnimatedGraphics(); - - if ( bIsAllowAnimatedGraphics_ == bIsAllowAnimatedGraphics )//old config item will not throw error - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsAllowAnimatedGraphics() error!")), 0); -} - -//============================================================================= -//test impl_checkGetIsAllowAnimatedText() -void AccessibilityOptTest::impl_checkGetIsAllowAnimatedText() -{ - css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); - sal_Bool bIsAllowAnimatedText ; - sal_Bool bIsAllowAnimatedText_; - - bIsAllowAnimatedText = aAccessibilityOpt.GetIsAllowAnimatedText(); - xSet->setPropertyValue( s_sIsAllowAnimatedText, css::uno::makeAny(bIsAllowAnimatedText ? sal_False:sal_True) ); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - bIsAllowAnimatedText_ = aAccessibilityOpt.GetIsAllowAnimatedText(); - - if ( bIsAllowAnimatedText_ == bIsAllowAnimatedText )//old config item will not throw error - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsAllowAnimatedText() error!")), 0); -} - -//============================================================================= -//test impl_checkGetIsAutomaticFontColor() -void AccessibilityOptTest::impl_checkGetIsAutomaticFontColor() -{ - css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); - sal_Bool bIsAutomaticFontColor ; - sal_Bool bIsAutomaticFontColor_; - - bIsAutomaticFontColor = aAccessibilityOpt.GetIsAutomaticFontColor(); - xSet->setPropertyValue( s_sIsAutomaticFontColor, css::uno::makeAny(bIsAutomaticFontColor ? sal_False:sal_True) ); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - bIsAutomaticFontColor_ = aAccessibilityOpt.GetIsAutomaticFontColor(); - - if ( bIsAutomaticFontColor_ == bIsAutomaticFontColor )//old config item will not throw error - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsAutomaticFontColor() error!")), 0); -} - -//============================================================================= -//test impl_checkGetIsSystemFont() -void AccessibilityOptTest::impl_checkGetIsSystemFont() -{ - css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); - sal_Bool bIsSystemFont ; - sal_Bool bIsSystemFont_; - - bIsSystemFont = aAccessibilityOpt.GetIsSystemFont(); - xSet->setPropertyValue( s_sIsSystemFont, css::uno::makeAny(bIsSystemFont ? sal_False:sal_True) ); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - bIsSystemFont_ = aAccessibilityOpt.GetIsSystemFont(); - - if ( bIsSystemFont_ == bIsSystemFont )//old config item will not throw error - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsSystemFont() error!")), 0); -} - -//============================================================================= -//test impl_checkGetHelpTipSeconds() -void AccessibilityOptTest::impl_checkGetHelpTipSeconds() -{ - css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); - sal_Int16 nHelpTipSeconds ; - sal_Int16 nHelpTipSeconds_; - - nHelpTipSeconds = aAccessibilityOpt.GetHelpTipSeconds(); - xSet->setPropertyValue( s_sHelpTipSeconds, css::uno::makeAny(sal_Int16(nHelpTipSeconds+1)) ); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - nHelpTipSeconds_ = aAccessibilityOpt.GetHelpTipSeconds(); - - if ( nHelpTipSeconds_ == nHelpTipSeconds )//old config item will not throw error - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetHelpTipSeconds() error!")), 0); -} - -//============================================================================= -//test impl_checkIsSelectionInReadonly() -void AccessibilityOptTest::impl_checkIsSelectionInReadonly() -{ - css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); - sal_Bool bIsSelectionInReadonly ; - sal_Bool bIsSelectionInReadonly_; - - bIsSelectionInReadonly = aAccessibilityOpt.IsSelectionInReadonly(); - xSet->setPropertyValue( s_sIsSelectionInReadonly, css::uno::makeAny(bIsSelectionInReadonly ? sal_False:sal_True) ); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - bIsSelectionInReadonly_ = aAccessibilityOpt.IsSelectionInReadonly(); - - if ( bIsSelectionInReadonly_ == bIsSelectionInReadonly )//old config item will not throw error - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsSelectionInReadonly() error!")), 0); -} - -//============================================================================= -//test SetAutoDetectSystemHC() -void AccessibilityOptTest::impl_checkSetAutoDetectSystemHC() -{ - css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); - sal_Bool bAutoDetectSystemHC; - sal_Bool bAutoDetectSystemHC_; - - xSet->getPropertyValue(s_sAutoDetectSystemHC) >>= bAutoDetectSystemHC; - aAccessibilityOpt.SetAutoDetectSystemHC( bAutoDetectSystemHC ? sal_False:sal_True ); - xSet->getPropertyValue(s_sAutoDetectSystemHC) >>= bAutoDetectSystemHC_; - - if ( bAutoDetectSystemHC_ == bAutoDetectSystemHC )//old config item will throw error - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetAutoDetectSystemHC() error!")), 0); -} - -//============================================================================= -//test SetIsForPagePreviews() -void AccessibilityOptTest::impl_checkSetIsForPagePreviews() -{ - css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); - sal_Bool bIsForPagePreviews ; - sal_Bool bIsForPagePreviews_; - - xSet->getPropertyValue(s_sIsForPagePreviews) >>= bIsForPagePreviews; - aAccessibilityOpt.SetIsForPagePreviews( bIsForPagePreviews ? sal_False:sal_True ); - xSet->getPropertyValue(s_sIsForPagePreviews) >>= bIsForPagePreviews_; - - if ( bIsForPagePreviews_ == bIsForPagePreviews )//old config item will throw error - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsForPagePreviews() error!")), 0); -} - -//============================================================================= -//test impl_checkSetIsHelpTipsDisappear() -void AccessibilityOptTest::impl_checkSetIsHelpTipsDisappear() -{ - css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); - sal_Bool bIsHelpTipsDisappear ; - sal_Bool bIsHelpTipsDisappear_; - - xSet->getPropertyValue(s_sIsHelpTipsDisappear) >>= bIsHelpTipsDisappear; - aAccessibilityOpt.SetIsHelpTipsDisappear( bIsHelpTipsDisappear ? sal_False:sal_True ); - xSet->getPropertyValue(s_sIsHelpTipsDisappear) >>= bIsHelpTipsDisappear_; - - if ( bIsHelpTipsDisappear_ == bIsHelpTipsDisappear )//old config item will throw error - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsHelpTipsDisappear() error!")), 0); -} - -//============================================================================= -//test impl_checkSetIsAllowAnimatedGraphics() -void AccessibilityOptTest::impl_checkSetIsAllowAnimatedGraphics() -{ - css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); - sal_Bool bIsAllowAnimatedGraphics ; - sal_Bool bIsAllowAnimatedGraphics_; - - xSet->getPropertyValue(s_sIsAllowAnimatedGraphics) >>= bIsAllowAnimatedGraphics; - aAccessibilityOpt.SetIsAllowAnimatedGraphics( bIsAllowAnimatedGraphics ? sal_False:sal_True ); - xSet->getPropertyValue(s_sIsAllowAnimatedGraphics) >>= bIsAllowAnimatedGraphics_; - - if ( bIsAllowAnimatedGraphics_ == bIsAllowAnimatedGraphics )//old config item will throw error - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsAllowAnimatedGraphics() error!")), 0); -} - -//============================================================================= -//test impl_checkSetIsAllowAnimatedText() -void AccessibilityOptTest::impl_checkSetIsAllowAnimatedText() -{ - css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); - sal_Bool bIsAllowAnimatedText ; - sal_Bool bIsAllowAnimatedText_; - - xSet->getPropertyValue(s_sIsAllowAnimatedText) >>= bIsAllowAnimatedText; - aAccessibilityOpt.SetIsAllowAnimatedText( bIsAllowAnimatedText ? sal_False:sal_True ); - xSet->getPropertyValue(s_sIsAllowAnimatedText) >>= bIsAllowAnimatedText_; - - if ( bIsAllowAnimatedText_ == bIsAllowAnimatedText )//old config item will throw error - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsAllowAnimatedText() error!")), 0); -} - -//============================================================================= -//test impl_checkSetIsAutomaticFontColor() -void AccessibilityOptTest::impl_checkSetIsAutomaticFontColor() -{ - css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); - sal_Bool bIsAutomaticFontColor ; - sal_Bool bIsAutomaticFontColor_; - - xSet->getPropertyValue(s_sIsAutomaticFontColor) >>= bIsAutomaticFontColor; - aAccessibilityOpt.SetIsAutomaticFontColor( bIsAutomaticFontColor ? sal_False:sal_True ); - xSet->getPropertyValue(s_sIsAutomaticFontColor) >>= bIsAutomaticFontColor_; - - if ( bIsAutomaticFontColor_ == bIsAutomaticFontColor )//old config item will throw error - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsAutomaticFontColor() error!")), 0); -} - -//============================================================================= -//test impl_checkSetIsSystemFont() -void AccessibilityOptTest::impl_checkSetIsSystemFont() -{ - css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); - sal_Bool bIsSystemFont ; - sal_Bool bIsSystemFont_; - - xSet->getPropertyValue(s_sIsSystemFont) >>= bIsSystemFont; - aAccessibilityOpt.SetIsSystemFont( bIsSystemFont ? sal_False:sal_True ); - xSet->getPropertyValue(s_sIsSystemFont) >>= bIsSystemFont_; - - if ( bIsSystemFont_ == bIsSystemFont )//old config item will throw error - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsSystemFont() error!")), 0); -} - -//============================================================================= -//test impl_checkSetHelpTipSeconds() -void AccessibilityOptTest::impl_checkSetHelpTipSeconds() -{ - css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); - sal_Int16 nHelpTipSeconds ; - sal_Int16 nHelpTipSeconds_; - - xSet->getPropertyValue(s_sHelpTipSeconds) >>= nHelpTipSeconds; - aAccessibilityOpt.SetHelpTipSeconds( sal_Int16(nHelpTipSeconds+1) ); - xSet->getPropertyValue(s_sHelpTipSeconds) >>= nHelpTipSeconds_; - - if ( nHelpTipSeconds_ == nHelpTipSeconds )//old config item will throw error - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetHelpTipSeconds() error!")), 0); -} - -//============================================================================= -//test impl_checkSetSelectionInReadonly() -void AccessibilityOptTest::impl_checkSetSelectionInReadonly() -{ - css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); - sal_Bool bIsSelectionInReadonly ; - sal_Bool bIsSelectionInReadonly_; - - xSet->getPropertyValue(s_sIsSelectionInReadonly) >>= bIsSelectionInReadonly; - aAccessibilityOpt.SetSelectionInReadonly( bIsSelectionInReadonly ? sal_False:sal_True ); - xSet->getPropertyValue(s_sIsSelectionInReadonly) >>= bIsSelectionInReadonly_; - - if ( bIsSelectionInReadonly_ == bIsSelectionInReadonly )//old config item will throw error - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetSelectionInReadonly() error!")), 0); -} - -//============================================================================= -void AccessibilityOptTest::impl_checkAccessibilityOptions() -{ - impl_checkGetAutoDetectSystemHC(); - impl_checkGetIsForPagePreviews(); - impl_checkGetIsHelpTipsDisappear(); - impl_checkGetIsAllowAnimatedGraphics(); - impl_checkGetIsAllowAnimatedText(); - impl_checkGetIsAutomaticFontColor(); - impl_checkGetIsSystemFont(); - impl_checkGetHelpTipSeconds(); - impl_checkIsSelectionInReadonly(); - - impl_checkSetAutoDetectSystemHC(); - impl_checkSetIsForPagePreviews(); - impl_checkSetIsHelpTipsDisappear(); - impl_checkSetIsAllowAnimatedGraphics(); - impl_checkSetIsAllowAnimatedText(); - impl_checkSetIsAutomaticFontColor(); - impl_checkSetIsSystemFont(); - impl_checkSetHelpTipSeconds(); - impl_checkSetSelectionInReadonly(); -} diff --git a/svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx b/svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx deleted file mode 100644 index fc2f4681e4fe..000000000000 --- a/svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx +++ /dev/null @@ -1,78 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: AccessibilityOptTest.hxx,v $ - * - * $Revision: 1.1.4.2 $ - * - * last change: $Author: as $ $Date: 2008/03/19 11:09:23 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef SVTOOLS_ACCESSIBILITYOPTTEST_HXX -#define SVTOOLS_ACCESSIBILITYOPTTEST_HXX - -#include -#include - -namespace css = ::com::sun::star; - -class AccessibilityOptTest -{ -public: - AccessibilityOptTest(); - ~AccessibilityOptTest(); - - void impl_checkAccessibilityOptions(); - -private: - void impl_checkGetAutoDetectSystemHC(); - void impl_checkGetIsForPagePreviews(); - void impl_checkGetIsHelpTipsDisappear(); - void impl_checkGetIsAllowAnimatedGraphics(); - void impl_checkGetIsAllowAnimatedText(); - void impl_checkGetIsAutomaticFontColor(); - void impl_checkGetIsSystemFont(); - void impl_checkGetHelpTipSeconds(); - void impl_checkIsSelectionInReadonly(); - - void impl_checkSetAutoDetectSystemHC(); - void impl_checkSetIsForPagePreviews(); - void impl_checkSetIsHelpTipsDisappear(); - void impl_checkSetIsAllowAnimatedGraphics(); - void impl_checkSetIsAllowAnimatedText(); - void impl_checkSetIsAutomaticFontColor(); - void impl_checkSetIsSystemFont(); - void impl_checkSetHelpTipSeconds(); - void impl_checkSetSelectionInReadonly(); - -private: - css::uno::Reference< css::container::XNameAccess > m_xCfg; - SvtAccessibilityOptions aAccessibilityOpt; -}; - -#endif // #ifndef SVTOOLS_ACCESSIBILITYOPTTEST_HXX diff --git a/svtools/qa/complex/ConfigItems/helper/ConfigItemTest.cxx b/svtools/qa/complex/ConfigItems/helper/ConfigItemTest.cxx deleted file mode 100644 index b21d9d76755e..000000000000 --- a/svtools/qa/complex/ConfigItems/helper/ConfigItemTest.cxx +++ /dev/null @@ -1,253 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: ConfigItemTest.cxx,v $ - * - * $Revision: 1.1.4.2 $ - * - * last change: $Author: as $ $Date: 2008/03/19 11:09:23 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#include "HistoryOptTest.hxx" -#include "AccessibilityOptTest.hxx" -#include "PrintOptTest.hxx" -#include "UserOptTest.hxx" - -#include -#include -#include -#include - -#include -#include -#include -#include - -//============================================================================= -namespace css = ::com::sun::star; - -namespace svtools{ - -//============================================================================= -static const ::rtl::OUString PROP_TEST = ::rtl::OUString::createFromAscii("Test"); -static const ::rtl::OUString TEST_PICKLIST = ::rtl::OUString::createFromAscii("checkPicklist"); -static const ::rtl::OUString TEST_URLHISTORY = ::rtl::OUString::createFromAscii("checkURLHistory"); -static const ::rtl::OUString TEST_HELPBOOKMARKS = ::rtl::OUString::createFromAscii("checkHelpBookmarks"); -static const ::rtl::OUString TEST_ACCESSIBILITYOPTIONS = ::rtl::OUString::createFromAscii("checkAccessibilityOptions"); -static const ::rtl::OUString TEST_PRINTOPTIONS = ::rtl::OUString::createFromAscii("checkPrintOptions"); -static const ::rtl::OUString TEST_USEROPTIONS = ::rtl::OUString::createFromAscii("checkUserOptions"); - -//============================================================================= -class ConfigItemTest : public ::cppu::WeakImplHelper2< css::task::XJob , - css::lang::XServiceInfo > -{ - //------------------------------------------------------------------------- - // interface - public: - explicit ConfigItemTest(const css::uno::Reference< css::uno::XComponentContext >& xContext); - - // css::task::XJob - virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue >& lArguments) - throw (css::uno::RuntimeException , - css::lang::IllegalArgumentException, - css::uno::Exception ); - - // css::lang::XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() - throw (css::uno::RuntimeException); - - virtual ::sal_Bool SAL_CALL supportsService(const ::rtl::OUString& sServiceName) - throw (css::uno::RuntimeException); - - virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() - throw (css::uno::RuntimeException); - - //------------------------------------------------------------------------- - // internal - private: - ConfigItemTest(ConfigItemTest &); // not defined - virtual ~ConfigItemTest() {} - void operator=(ConfigItemTest &); // not defined - - //------------------------------------------------------------------------- - // helper for registration ! - public: - static ::rtl::OUString SAL_CALL st_getImplementationName(); - static css::uno::Sequence< ::rtl::OUString > SAL_CALL st_getSupportedServiceNames(); - static css::uno::Reference< css::uno::XInterface > SAL_CALL st_create(const css::uno::Reference< css::uno::XComponentContext >& XContext); - - //------------------------------------------------------------------------- - // member - private: - css::uno::Reference< css::uno::XComponentContext > m_xContext; -}; - -//============================================================================= -ConfigItemTest::ConfigItemTest(const css::uno::Reference< css::uno::XComponentContext >& xContext) - : m_xContext(xContext) -{} - -//============================================================================= -// css::task::XJob -css::uno::Any SAL_CALL ConfigItemTest::execute(const css::uno::Sequence< css::beans::NamedValue >& lArguments) - throw (css::uno::RuntimeException , - css::lang::IllegalArgumentException, - css::uno::Exception ) -{ - ::rtl::OUString sTest; - ::sal_Int32 i = 0; - ::sal_Int32 c = lArguments.getLength(); - for (i=0; i>= sTest; - } - - if (sTest.equals(TEST_PICKLIST)) - { - HistoryOptTest aOptTest; - aOptTest.checkPicklist(); - } - else if (sTest.equals(TEST_URLHISTORY)) - { - HistoryOptTest aOptTest; - aOptTest.checkURLHistory(); - } - else if (sTest.equals(TEST_HELPBOOKMARKS)) - { - HistoryOptTest aOptTest; - aOptTest.checkHelpBookmarks(); - } - else if (sTest.equals(TEST_ACCESSIBILITYOPTIONS)) - { - AccessibilityOptTest aOptTest; - aOptTest.impl_checkAccessibilityOptions(); - } - else if (sTest.equals(TEST_PRINTOPTIONS)) - { - PrintOptTest aOptTest; - aOptTest.impl_checkPrint(); - } - else if (sTest.equals(TEST_USEROPTIONS)) - { - UserOptTest aOptTest; - aOptTest.impl_checkUserData(); - } - - return css::uno::Any(); -} - -//============================================================================= -// com::sun::star::uno::XServiceInfo -::rtl::OUString SAL_CALL ConfigItemTest::getImplementationName() - throw (css::uno::RuntimeException) -{ - return ConfigItemTest::st_getImplementationName(); -} - -//============================================================================= -// com::sun::star::uno::XServiceInfo -::sal_Bool SAL_CALL ConfigItemTest::supportsService(const ::rtl::OUString& sServiceName) - throw (css::uno::RuntimeException) -{ - css::uno::Sequence< ::rtl::OUString > lServiceNames = ConfigItemTest::st_getSupportedServiceNames(); - for (::sal_Int32 i = 0; i < lServiceNames.getLength(); ++i) - { - if (lServiceNames[i].equals(sServiceName)) - return sal_True; - } - return sal_False; -} - -//============================================================================= -// com::sun::star::uno::XServiceInfo -css::uno::Sequence< ::rtl::OUString > SAL_CALL ConfigItemTest::getSupportedServiceNames() - throw (css::uno::RuntimeException) -{ - return ConfigItemTest::st_getSupportedServiceNames(); -} - -//============================================================================= -::rtl::OUString SAL_CALL ConfigItemTest::st_getImplementationName() -{ - return ::rtl::OUString::createFromAscii("com.sun.star.comp.svtools.ConfigItemTest"); -} - -//============================================================================= -css::uno::Sequence< ::rtl::OUString > SAL_CALL ConfigItemTest::st_getSupportedServiceNames() -{ - css::uno::Sequence< ::rtl::OUString > lServices(1); - lServices[0] = ::rtl::OUString::createFromAscii("com.sun.star.test.ConfigItems"); - return lServices; -} - -//============================================================================= -css::uno::Reference< css::uno::XInterface > SAL_CALL ConfigItemTest::st_create(const css::uno::Reference< css::uno::XComponentContext >& xContext) -{ - ConfigItemTest* pObject = new ConfigItemTest(xContext); - css::uno::Reference< css::uno::XInterface > xObject (static_cast< ::cppu::OWeakObject* >(pObject)); - return xObject; -} - -} // namespace svtools - -//============================================================================= -static ::cppu::ImplementationEntry const lRegEntries[] = -{ - { - &::svtools::ConfigItemTest::st_create, - &::svtools::ConfigItemTest::st_getImplementationName, - &::svtools::ConfigItemTest::st_getSupportedServiceNames, - &::cppu::createSingleComponentFactory, 0, 0 - }, - - { 0, 0, 0, 0, 0, 0 } -}; - -//============================================================================= -extern "C" void SAL_CALL component_getImplementationEnvironment(const char** pEnvTypeName, - uno_Environment** ) -{ - *pEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -//============================================================================= -extern "C" void * SAL_CALL component_getFactory(const char* sImplName , - void* pServiceManager, - void* pRegistryKey ) -{ - return ::cppu::component_getFactoryHelper(sImplName, pServiceManager, pRegistryKey, lRegEntries); -} - -//============================================================================= -extern "C" sal_Bool SAL_CALL component_writeInfo(void* pServiceManager, - void* pRegistryKey ) -{ - return ::cppu::component_writeInfoHelper(pServiceManager, pRegistryKey, lRegEntries); -} diff --git a/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.cxx b/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.cxx deleted file mode 100644 index 082328835fca..000000000000 --- a/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.cxx +++ /dev/null @@ -1,806 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: HistoryOptTest.cxx,v $ - * - * $Revision: 1.1.4.2 $ - * - * last change: $Author: as $ $Date: 2008/03/19 11:09:23 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#include "HistoryOptTest.hxx" -#include - -#include -#include -#include -#include -#include - -#include -#include -#include - -namespace css = ::com::sun::star; - -//============================================================================= -static const ::rtl::OUString MESSAGE_CLEAR_FAILED = ::rtl::OUString::createFromAscii("Clearing the list failed."); -static const ::rtl::OUString MESSAGE_SETSIZE_FAILED = ::rtl::OUString::createFromAscii("Setting a new size for a list failed."); -static const ::rtl::OUString MESSAGE_MISS_HISTORY = ::rtl::OUString::createFromAscii("Could not get config access to history list inside config."); -static const ::rtl::OUString MESSAGE_MISS_ITEMLIST = ::rtl::OUString::createFromAscii("Could not get config access to item list inside config."); -static const ::rtl::OUString MESSAGE_MISS_ORDERLIST = ::rtl::OUString::createFromAscii("Could not get config access to order list inside config."); -static const ::rtl::OUString MESSAGE_MISS_ITEM = ::rtl::OUString::createFromAscii("Could not locate item."); -static const ::rtl::OUString MESSAGE_UNEXPECTED_ITEM = ::rtl::OUString::createFromAscii("Found an unexpected item."); -static const ::rtl::OUString MESSAGE_WRONG_ORDER = ::rtl::OUString::createFromAscii("Wrong order in history list."); - -//============================================================================= -HistoryOptTest::HistoryOptTest() - : m_aConfigItem ( ) - , m_eList (ePICKLIST) - , m_xHistoriesXCU( ) - , m_xCommonXCU ( ) -{ -} - -//============================================================================= -HistoryOptTest::~HistoryOptTest() -{ - m_xHistoriesXCU.clear(); - m_xCommonXCU.clear(); -} - -//============================================================================= -void HistoryOptTest::checkPicklist() -{ - impl_testHistory(ePICKLIST, 4); -} - -//============================================================================= -void HistoryOptTest::checkURLHistory() -{ - impl_testHistory(eHISTORY, 10); -} - -//============================================================================= -void HistoryOptTest::checkHelpBookmarks() -{ - impl_testHistory(eHELPBOOKMARKS, 100); -} - -//============================================================================= -void HistoryOptTest::impl_testHistory(EHistoryType eHistory , - ::sal_Int32 nMaxItems) -{ - try - { - m_eList = eHistory; - ::sal_Int32 c = nMaxItems; - ::sal_Int32 i = 0; - - impl_clearList( ); - impl_setSize (c); - - // a) fill list completely and check if all items could be realy created. - // But dont check its order here! Because every new item will change that order. - for (i=0; i xList; - xList = impl_getItemList(); - nCount = xList->getElementNames().getLength(); - - if (nCount != 0) - throw css::uno::Exception(MESSAGE_CLEAR_FAILED, 0); - - xList = impl_getOrderList(); - nCount = xList->getElementNames().getLength(); - - if (nCount != 0) - throw css::uno::Exception(MESSAGE_CLEAR_FAILED, 0); -} - -//============================================================================= -void HistoryOptTest::impl_setSize(::sal_Int32 nSize) -{ - m_aConfigItem.SetSize (m_eList, nSize); - - // a) size info returned by GetSize() means "MaxSize" - // so it must match exactly ! - ::sal_Int32 nCheck = m_aConfigItem.GetSize(m_eList); - if (nCheck != nSize) - throw css::uno::Exception(MESSAGE_SETSIZE_FAILED, 0); - - // b) current size of used XCU lists reflects the current state of - // history list and not max size. So it can be less then size ! - css::uno::Reference< css::container::XNameAccess > xList; - xList = impl_getItemList(); - nCheck = xList->getElementNames().getLength(); - if (nCheck > nSize) - throw css::uno::Exception(MESSAGE_SETSIZE_FAILED, 0); - - xList = impl_getOrderList(); - nCheck = xList->getElementNames().getLength(); - if (nCheck > nSize) - throw css::uno::Exception(MESSAGE_SETSIZE_FAILED, 0); -} - -//============================================================================= -void HistoryOptTest::impl_appendItem(::sal_Int32 nItem) -{ - const ::rtl::OUString sURL = impl_createItemURL (nItem); - const ::rtl::OUString sTitle = impl_createItemTitle (nItem); - const ::rtl::OUString sPassword = impl_createItemPassword(nItem); - - m_aConfigItem.AppendItem(m_eList, sURL, ::rtl::OUString(), sTitle, sPassword); -} - -//============================================================================= -::rtl::OUString HistoryOptTest::impl_createItemURL(::sal_Int32 nItem) -{ - ::rtl::OUStringBuffer sURL(256); - sURL.appendAscii("file:///ooo_api_test/non_existing_test_url_"); - sURL.append ((::sal_Int32)nItem ); - sURL.appendAscii(".odt" ); - - return sURL.makeStringAndClear(); -} - -//============================================================================= -::rtl::OUString HistoryOptTest::impl_createItemTitle(::sal_Int32 nItem) -{ - ::rtl::OUStringBuffer sTitle(256); - sTitle.appendAscii("Non Existing Test Item Nr "); - sTitle.append ((::sal_Int32)nItem ); - - return sTitle.makeStringAndClear(); -} - -//============================================================================= -::rtl::OUString HistoryOptTest::impl_createItemPassword(::sal_Int32 nItem) -{ - ::rtl::OUStringBuffer sPassword(256); - sPassword.appendAscii("Password_" ); - sPassword.append ((::sal_Int32)nItem); - - return sPassword.makeStringAndClear(); -} - -//============================================================================= -::sal_Bool HistoryOptTest::impl_existsItem(::sal_Int32 nItem) -{ - const ::rtl::OUString sURL = impl_createItemURL(nItem); - const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > lItems = m_aConfigItem.GetList(m_eList); - const ::sal_Int32 c = lItems.getLength (); - ::sal_Int32 i = 0; - ::sal_Bool bFound = sal_False; - - for (i=0; i xItemList = impl_getItemList(); - css::uno::Reference< css::container::XNameAccess > xItem ; - xItemList->getByName(sURL) >>= xItem; - - bFound = xItem.is(); - } - catch(const css::container::NoSuchElementException&) - {} - - return bFound; -} - -//============================================================================= -::sal_Bool HistoryOptTest::impl_existsItemAtIndex(::sal_Int32 nItem , - ::sal_Int32 nIndex) -{ - const ::rtl::OUString sURL = impl_createItemURL(nItem); - const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > lItems = m_aConfigItem.GetList(m_eList); - const ::sal_Int32 c = lItems.getLength (); - ::sal_Bool bFound = sal_False; - - if (nIndex >= c) - return sal_False; - - const ::comphelper::SequenceAsHashMap aItem(lItems[nIndex]); - ::rtl::OUString sCheck = aItem.getUnpackedValueOrDefault(s_sURL, ::rtl::OUString()); - - bFound = sCheck.equals(sURL); - if ( ! bFound) - return sal_False; - bFound = sal_False; - - try - { - css::uno::Reference< css::container::XNameAccess > xItemList = impl_getItemList(); - css::uno::Reference< css::container::XNameAccess > xItem ; - xItemList->getByName(sURL) >>= xItem; - - bFound = xItem.is(); - } - catch(const css::container::NoSuchElementException&) - {} - - if ( ! bFound) - return sal_False; - bFound = sal_False; - - try - { - const ::rtl::OUString sOrder = ::rtl::OUString::valueOf(nIndex); - css::uno::Reference< css::container::XNameAccess > xOrderList = impl_getOrderList(); - css::uno::Reference< css::container::XNameAccess > xOrder ; - xOrderList->getByName(sOrder) >>= xOrder; - - if (xOrder.is()) - { - xOrder->getByName(s_sHistoryItemRef) >>= sCheck; - bFound = sCheck.equals(sURL); - } - } - catch(const css::container::NoSuchElementException&) - {} - - return bFound; -} - -//============================================================================= -css::uno::Reference< css::container::XNameAccess > HistoryOptTest::impl_getItemList() -{ - css::uno::Reference< css::container::XNameAccess > xHistory = impl_getNewHistory(); - css::uno::Reference< css::container::XNameAccess > xList ; - xHistory->getByName (s_sItemList) >>= xList; - - if ( ! xList.is()) - throw css::uno::Exception(MESSAGE_MISS_ITEMLIST, 0); - - return xList; -} - -//============================================================================= -css::uno::Reference< css::container::XNameAccess > HistoryOptTest::impl_getOrderList() -{ - css::uno::Reference< css::container::XNameAccess > xHistory = impl_getNewHistory(); - css::uno::Reference< css::container::XNameAccess > xList ; - xHistory->getByName (s_sOrderList) >>= xList; - - if ( ! xList.is()) - throw css::uno::Exception(MESSAGE_MISS_ORDERLIST, 0); - - return xList; -} - -//============================================================================= -css::uno::Reference< css::container::XNameAccess > HistoryOptTest::impl_getNewHistory() -{ - if ( ! m_xHistoriesXCU.is()) - { - m_xHistoriesXCU = css::uno::Reference< css::container::XNameAccess >( - ::comphelper::ConfigurationHelper::openConfig( - ::utl::getProcessServiceFactory(), - s_sHistories, - ::comphelper::ConfigurationHelper::E_STANDARD), - css::uno::UNO_QUERY_THROW); - } - - css::uno::Reference< css::container::XNameAccess > xHistory; - - switch (m_eList) - { - case ePICKLIST : - m_xHistoriesXCU->getByName(s_sPickList) >>= xHistory; - break; - - case eHISTORY : - m_xHistoriesXCU->getByName(s_sURLHistory) >>= xHistory; - break; - - case eHELPBOOKMARKS : - m_xHistoriesXCU->getByName(s_sHelpBookmarks) >>= xHistory; - break; - } - - if ( ! xHistory.is()) - throw css::uno::Exception(MESSAGE_MISS_HISTORY, 0); - - return xHistory; -} - -//============================================================================= -css::uno::Reference< css::container::XNameAccess > HistoryOptTest::impl_getOldHistory() -{ - if ( ! m_xCommonXCU.is()) - { - m_xCommonXCU = css::uno::Reference< css::container::XNameAccess >( - ::comphelper::ConfigurationHelper::openConfig( - ::utl::getProcessServiceFactory(), - s_sCommonHistory, - ::comphelper::ConfigurationHelper::E_STANDARD), - css::uno::UNO_QUERY_THROW); - } - - css::uno::Reference< css::container::XNameAccess > xHistory; - - switch (m_eList) - { - case ePICKLIST : - m_xCommonXCU->getByName(s_sPickList) >>= xHistory; - break; - - case eHISTORY : - m_xCommonXCU->getByName(s_sURLHistory) >>= xHistory; - break; - - case eHELPBOOKMARKS : - m_xCommonXCU->getByName(s_sHelpBookmarks) >>= xHistory; - break; - } - - if ( ! xHistory.is()) - throw css::uno::Exception(MESSAGE_MISS_HISTORY, 0); - - return xHistory; -} - -/* -//============================================================================= -// clear the list in XML directly when using the new Histories.xcs -void HistoryOptTest::impl_clearList(const ::rtl::OUString& sList) -{ - css::uno::Reference< css::container::XNameAccess > xListAccess; - css::uno::Reference< css::container::XNameContainer > xItemOrder; - css::uno::Reference< css::beans::XPropertySet > xFirstItem; - css::uno::Sequence< ::rtl::OUString > sFileList; - - if (sList.equalsAscii("PickList")) - m_xCfg->getByName(s_sPickList) >>= xListAccess; - - else if (sList.equalsAscii("URLHistory")) - m_xCfg->getByName(s_sURLHistory) >>= xListAccess; - - else if (sList.equalsAscii("HelpBookmarks")) - m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess; - - if (xListAccess.is()) - { - xListAccess->getByName(s_sItemList) >>= xItemOrder ; - sFileList = xItemOrder->getElementNames(); - for(sal_Int32 i=0; iremoveByName(sFileList[i]); - - xListAccess->getByName(s_sOrderList) >>= xItemOrder ; - sFileList = xItemOrder->getElementNames(); - for(sal_Int32 j=0; jremoveByName(sFileList[j]); - - xFirstItem = css::uno::Reference< css::beans::XPropertySet >(xListAccess, css::uno::UNO_QUERY); - xFirstItem->setPropertyValue( s_sFirstItem, css::uno::makeAny((sal_Int32)0) ); - - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } -} - -//============================================================================= -// use configuration API (not ConfigItem!) to verify the results within XML ! -sal_Bool HistoryOptTest::impl_isListEmpty(const ::rtl::OUString& sList) -{ - css::uno::Reference< css::container::XNameAccess > xListAccess; - css::uno::Reference< css::container::XNameAccess > xItemList; - css::uno::Reference< css::container::XNameAccess > xOrderList; - sal_Bool bRet = sal_True; - - if (sList.equalsAscii("PickList")) - m_xCfg->getByName(s_sPickList) >>= xListAccess; - - else if (sList.equalsAscii("URLHistory")) - m_xCfg->getByName(s_sURLHistory) >>= xListAccess; - - else if (sList.equalsAscii("HelpBookmarks")) - m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess; - - if (xListAccess.is()) - { - xListAccess->getByName(s_sItemList) >>= xItemList; - xListAccess->getByName(s_sOrderList) >>= xOrderList; - - css::uno::Sequence< ::rtl::OUString > sItemList = xItemList->getElementNames(); - css::uno::Sequence< ::rtl::OUString > sOrderList = xOrderList->getElementNames(); - if (sItemList.getLength()!=0 || sOrderList.getLength()!=0) - bRet = sal_False; - } - - return bRet; -} - -//============================================================================= -// append a item: use configuration API (not ConfigItem!) to verify the results within XML ! -void HistoryOptTest::impl_appendItem(const ::rtl::OUString& sList) -{//to do... -} - -//============================================================================= -// test SvtHistoryOptions::GetSize() -void HistoryOptTest::impl_checkGetSize(const ::rtl::OUString& sList) -{ - css::uno::Reference< css::beans::XPropertySet > xSet(m_xCommonXCU, css::uno::UNO_QUERY); - - sal_uInt32 nSize = 0; - sal_uInt32 nSize_ = 0; - - if (sList.equalsAscii("PickList")) - { - nSize = aHistoryOpt.GetSize(ePICKLIST); - - xSet->setPropertyValue(s_sPickListSize, css::uno::makeAny(nSize+1)); - ::comphelper::ConfigurationHelper::flush(m_xCommonXCU); - - nSize_ = aHistoryOpt.GetSize(ePICKLIST); - if (nSize_ == nSize) - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetSize(ePICKLIST) error!")), 0); - } - - else if (sList.equalsAscii("URLHistory")) - { - nSize = aHistoryOpt.GetSize(eHISTORY); - - xSet->setPropertyValue(s_sURLHistorySize, css::uno::makeAny(nSize+1)); - ::comphelper::ConfigurationHelper::flush(m_xCommonXCU); - - nSize_ = aHistoryOpt.GetSize(eHISTORY); - - if (nSize_ == nSize) - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetSize(eHISTORY) error!")), 0); - } - - else if (sList.equalsAscii("HelpBookmarks")) - { - nSize = aHistoryOpt.GetSize(eHELPBOOKMARKS); - - xSet->setPropertyValue(s_sHelpBookmarksSize, css::uno::makeAny(nSize+1)); - ::comphelper::ConfigurationHelper::flush(m_xCommonXCU); - - nSize_ = aHistoryOpt.GetSize(eHELPBOOKMARKS); - - if (nSize_ == nSize) - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetSize(eHELPBOOKMARKS) error!")), 0); - } -} - -//============================================================================= -// test SvtHistoryOptions::SetSize() -void HistoryOptTest::impl_checkSetSize(const ::rtl::OUString& sList) -{ - css::uno::Reference< css::beans::XPropertySet > xSet(m_xCommonXCU, css::uno::UNO_QUERY); - - sal_uInt32 nSize = 0; - sal_uInt32 nSize_ = 0; - - if (sList.equalsAscii("PickList")) - { - xSet->getPropertyValue(s_sPickListSize) >>= nSize; - aHistoryOpt.SetSize(ePICKLIST, (nSize+1)); - xSet->getPropertyValue(s_sPickListSize) >>= nSize_; - - if (nSize_ == nSize) //old config item will throw error - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetSize(ePICKLIST) error!")), 0); - } - - else if (sList.equalsAscii("URLHistory")) - { - xSet->getPropertyValue(s_sURLHistorySize) >>= nSize; - aHistoryOpt.SetSize(eHISTORY, (nSize+1)); - xSet->getPropertyValue(s_sURLHistorySize) >>= nSize_; - - if (nSize_ == nSize) //old config item will throw error - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetSize(eHISTORY) error!")), 0); - } - - else if (sList.equalsAscii("HelpBookmarks")) - { - xSet->getPropertyValue(s_sHelpBookmarksSize) >>= nSize; - aHistoryOpt.SetSize(eHELPBOOKMARKS, (nSize+1)); - xSet->getPropertyValue(s_sHelpBookmarksSize) >>= nSize_; - - if (nSize_ == nSize) //old config item will throw error - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetSize(eHELPBOOKMARKS) error!")), 0); - } -} - -//============================================================================= -// test SvtHistoryOptions::Clear() -void HistoryOptTest::impl_checkClear(const ::rtl::OUString& sList) -{ - if (sList.equalsAscii("PickList")) - { - aHistoryOpt.Clear(ePICKLIST); - if ( !impl_isListEmpty(s_sPickList) ) - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Clear(ePICKLIST) error!")), 0); - } - - else if (sList.equalsAscii("URLHistory")) - { - aHistoryOpt.Clear(eHISTORY); - if ( !impl_isListEmpty(s_sURLHistory) ) - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Clear(eHISTORY) error!")), 0); - } - - else if (sList.equalsAscii("HelpBookmarks")) - { - aHistoryOpt.Clear(eHELPBOOKMARKS); - if ( !impl_isListEmpty(s_sHelpBookmarks) ) - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Clear(eHELPBOOKMARKS) error!")), 0); - } -} - -//============================================================================= -// test SvtHistoryOptions::GetList() -void HistoryOptTest::impl_checkGetList(const ::rtl::OUString& sList) -{ - if (sList.equalsAscii("PickList")) - { - impl_clearList(s_sPickList); - aHistoryOpt.AppendItem( ePICKLIST , - ::rtl::OUString::createFromAscii("file:///c/test1"), - ::rtl::OUString::createFromAscii(""), - ::rtl::OUString::createFromAscii(""), - ::rtl::OUString::createFromAscii("") ); - css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aHistoryList = aHistoryOpt.GetList( ePICKLIST ); - - if ( aHistoryList.getLength()==0 ) - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetList(ePICKLIST) error!")), 0); - } - - else if (sList.equalsAscii("URLHistory")) - { - impl_clearList(s_sURLHistory); - aHistoryOpt.AppendItem( eHISTORY , - ::rtl::OUString::createFromAscii("file:///c/test1"), - ::rtl::OUString::createFromAscii(""), - ::rtl::OUString::createFromAscii(""), - ::rtl::OUString::createFromAscii("") ); - css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aHistoryList = aHistoryOpt.GetList( eHISTORY ); - - if ( aHistoryList.getLength()==0 ) - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetList(eHISTORY) error!")), 0); - } - - else if (sList.equalsAscii("HelpBookmarks")) - { - impl_clearList(s_sHelpBookmarks); - aHistoryOpt.AppendItem( eHELPBOOKMARKS , - ::rtl::OUString::createFromAscii("file:///c/test1"), - ::rtl::OUString::createFromAscii(""), - ::rtl::OUString::createFromAscii(""), - ::rtl::OUString::createFromAscii("") ); - css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aHistoryList = aHistoryOpt.GetList( eHELPBOOKMARKS ); - - if ( aHistoryList.getLength()==0 ) - throw css::uno::RuntimeException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetList(eHELPBOOKMARKS) error!")), 0); - } -} - -void HistoryOptTest::impl_checkAppendItem(const ::rtl::OUString& sList) -{ - if (sList.equalsAscii("PickList")) - { - impl_clearList(s_sPickList); - sal_Int32 nListSize = aHistoryOpt.GetSize(ePICKLIST); - - for (sal_Int32 i=0; i -#include - -namespace css = ::com::sun::star; - -class HistoryOptTest -{ - public: - - HistoryOptTest(); - virtual ~HistoryOptTest(); - - //--------------------------------------------------------------------- - /** unit test of picklist */ - void checkPicklist(); - - //--------------------------------------------------------------------- - /** unit test of URL list */ - void checkURLHistory(); - - //--------------------------------------------------------------------- - /** unit test of Help bookmarks */ - void checkHelpBookmarks(); - - private: - - //--------------------------------------------------------------------- - /** test every well known history list in the same way. - * Only the count of created and tested items can be defined from outside - * e.g. usefull for stress tests. - * - * @param eHistory - * specify the history list for testing. - * - * @param nMaxItems - * max count of new created and tested history items. - */ - void impl_testHistory(EHistoryType eHistory , - ::sal_Int32 nMaxItems); - - //--------------------------------------------------------------------- - /** try to clear the whole list and check the results. - * If list could not be cleared successfully an exception is thrown. - */ - void impl_clearList(); - - //--------------------------------------------------------------------- - /** define a new size for the current list and check the results. - * Note: The given size must match against the defined constraints. - * That must be checked before this method is called. - * - * @param nSize - * the new size. - */ - void impl_setSize(::sal_Int32 nSize); - - //--------------------------------------------------------------------- - /** create a new item (means it's properties using a special schema using the - * item id). - * - * Note: This method does not check if creation was successfully. - * Therefore exists more specialized method impl_existsItem() - * and impl_existsItemAtPosition(). - * - * @param nItem - * id of the item - */ - void impl_appendItem(::sal_Int32 nItem); - - //--------------------------------------------------------------------- - /** check if an entry for given item id realy exists (in memory and xcu file). - * - * @param nItem - * id of the item - * - * @return true if item exists - false otherwise. - */ - ::sal_Bool impl_existsItem(::sal_Int32 nItem); - - //--------------------------------------------------------------------- - /** check if an entry for given item id realy exists (in memory and xcu file). - * Further it checks if the requested item is placed at the also specified - * position inside history list. - * - * @param nItem - * id of the item - * - * @param nIndex - * expected position of item inside history list. - * - * @return true if item exists at right position - false otherwise. - */ - ::sal_Bool impl_existsItemAtIndex(::sal_Int32 nItem , - ::sal_Int32 nIndex); - - //--------------------------------------------------------------------- - /** create an URL suitable for the given item id. - * - * @param nItem - * id of the item - * - * @return the new created URL. - */ - ::rtl::OUString impl_createItemURL(::sal_Int32 nItem); - - //--------------------------------------------------------------------- - /** create a title suitable for the given item id. - * - * @param nItem - * id of the item - * - * @return the new created title. - */ - ::rtl::OUString impl_createItemTitle(::sal_Int32 nItem); - - //--------------------------------------------------------------------- - /** create a password suitable for the given item id. - * - * @param nItem - * id of the item - * - * @return the new created password. - */ - ::rtl::OUString impl_createItemPassword(::sal_Int32 nItem); - - //--------------------------------------------------------------------- - /** returns direct access to the item list inside histories.xcu - * suitable for the current defined list type (m_eList). - * - * @return reference to the item list configuration - */ - css::uno::Reference< css::container::XNameAccess > impl_getItemList(); - - //--------------------------------------------------------------------- - /** returns direct access to the order list inside histories.xcu - * suitable for the current defined list type (m_eList). - * - * @return reference to the order list configuration - */ - css::uno::Reference< css::container::XNameAccess > impl_getOrderList(); - - //--------------------------------------------------------------------- - /** returns direct access to the history list inside histories.xcu - * suitable for the current defined list type (m_eList). - * - * @return reference to the history list configuration - */ - css::uno::Reference< css::container::XNameAccess > impl_getNewHistory(); - - //--------------------------------------------------------------------- - /** returns direct access to the history config inside common.xcu - * suitable for the current defined list type (m_eList). - * - * @return reference to the history configuration - */ - css::uno::Reference< css::container::XNameAccess > impl_getOldHistory(); - - private: - - // the config item which should be tested here - SvtHistoryOptions m_aConfigItem; - - // defines the special list for testing (picklist, history or url list) - EHistoryType m_eList; - - // underlying configuration of the tested config items for cross over checks - css::uno::Reference< css::container::XNameAccess > m_xHistoriesXCU; - - // underlying configuration of the tested config items for cross over checks - css::uno::Reference< css::container::XNameAccess > m_xCommonXCU; -}; - -#endif // #ifndef SVTOOLS_HISTORYOPTTEST_HXX diff --git a/svtools/qa/complex/ConfigItems/helper/PrintOptTest.cxx b/svtools/qa/complex/ConfigItems/helper/PrintOptTest.cxx deleted file mode 100644 index 69504e4d5d7e..000000000000 --- a/svtools/qa/complex/ConfigItems/helper/PrintOptTest.cxx +++ /dev/null @@ -1,743 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: PrintOptTest.cxx,v $ - * - * $Revision: 1.1.4.2 $ - * - * last change: $Author: as $ $Date: 2008/03/19 11:09:24 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#include "PrintOptTest.hxx" - -#include - -#include -#include - -namespace css = ::com::sun::star; - -// using test only -#define ROOTNODE_PRINTOPTION rtl::OUString::createFromAscii("org.openoffice.Office.Common/Print/Option") -#define PROPERTYNAME_REDUCETRANSPARENCY rtl::OUString::createFromAscii("ReduceTransparency") -#define PROPERTYNAME_REDUCEDTRANSPARENCYMODE rtl::OUString::createFromAscii("ReducedTransparencyMode") -#define PROPERTYNAME_REDUCEGRADIENTS rtl::OUString::createFromAscii("ReduceGradients") -#define PROPERTYNAME_REDUCEDGRADIENTMODE rtl::OUString::createFromAscii("ReducedGradientMode") -#define PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT rtl::OUString::createFromAscii("ReducedGradientStepCount") -#define PROPERTYNAME_REDUCEBITMAPS rtl::OUString::createFromAscii("ReduceBitmaps") -#define PROPERTYNAME_REDUCEDBITMAPMODE rtl::OUString::createFromAscii("ReducedBitmapMode") -#define PROPERTYNAME_REDUCEDBITMAPRESOLUTION rtl::OUString::createFromAscii("ReducedBitmapResolution") -#define PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY rtl::OUString::createFromAscii("ReducedBitmapIncludesTransparency") -#define PROPERTYNAME_CONVERTTOGREYSCALES rtl::OUString::createFromAscii("ConvertToGreyscales") - -PrintOptTest::PrintOptTest() -{ - m_xCfg = css::uno::Reference< css::container::XNameAccess >( - ::comphelper::ConfigurationHelper::openConfig( - ::utl::getProcessServiceFactory(), - rtl::OUString::createFromAscii("org.openoffice.Office.Common/Print/Option"), - ::comphelper::ConfigurationHelper::E_STANDARD), - css::uno::UNO_QUERY); - - if (m_xCfg.is()) - { - //UniString sTmp = UniString("printer"); - //xub_StrLen nTokenCount = sTmp.GetTokenCount('/'); - //sTmp = sTmp.GetToken(nTokenCount - 1, '/'); - m_xCfg->getByName(rtl::OUString::createFromAscii("Printer")) >>= m_xNode; - } -} - -sal_Int16 PrintOptTest::impl_GetReducedTransparencyMode() const -{ - sal_Int16 nRet = 0; - if (m_xNode.is()) - { - css::uno::Reference< css::beans::XPropertySet > xSet(m_xNode, css::uno::UNO_QUERY); - if (xSet.is()) - xSet->getPropertyValue(PROPERTYNAME_REDUCEDTRANSPARENCYMODE) >>= nRet; - } - return nRet; -} -void PrintOptTest::impl_SetReducedTransparencyMode(sal_Int16 nMode ) -{ - if (m_xNode.is()) - { - css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); - if (xSet.is()) - { - sal_Int16 nUpdate; - xSet->getPropertyValue(PROPERTYNAME_REDUCEDTRANSPARENCYMODE) >>= nUpdate; - if (nUpdate != nMode) - { - xSet->setPropertyValue( PROPERTYNAME_REDUCEDTRANSPARENCYMODE, css::uno::makeAny(nMode)); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - } - } -} - -sal_Bool PrintOptTest::impl_IsReduceTransparency() const -{ - sal_Bool bRet = sal_False; - if (m_xNode.is()) - { - css::uno::Reference< css::beans::XPropertySet > xSet(m_xNode, css::uno::UNO_QUERY); - if (xSet.is()) - xSet->getPropertyValue(PROPERTYNAME_REDUCETRANSPARENCY) >>= bRet; - } - return bRet; -} -void PrintOptTest::impl_SetReduceTransparency(sal_Bool bState ) -{ - if (m_xNode.is()) - { - css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); - if (xSet.is()) - { - sal_Bool bUpdate; - xSet->getPropertyValue(PROPERTYNAME_REDUCETRANSPARENCY) >>= bUpdate; - if (bUpdate != bState) - { - xSet->setPropertyValue( PROPERTYNAME_REDUCETRANSPARENCY, css::uno::makeAny(bState)); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - } - } -} - -sal_Bool PrintOptTest::impl_IsReduceGradients() const -{ - sal_Bool bRet = sal_False; - if (m_xNode.is()) - { - css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); - if (xSet.is()) - { - xSet->getPropertyValue(PROPERTYNAME_REDUCEGRADIENTS) >>= bRet; - } - } - return bRet; -} - -void PrintOptTest::impl_SetReduceGradients(sal_Bool bState ) -{ - if (m_xNode.is()) - { - css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); - if (xSet.is()) - { - sal_Bool bUpdate; - xSet->getPropertyValue(PROPERTYNAME_REDUCEGRADIENTS) >>= bUpdate; - if (bUpdate != bState) - { - xSet->setPropertyValue( PROPERTYNAME_REDUCEGRADIENTS, css::uno::makeAny(bState)); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - } - } -} - -sal_Int16 PrintOptTest::impl_GetReducedGradientMode() const -{ - sal_Int16 nRet = 0; - if (m_xNode.is()) - { - css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); - if (xSet.is()) - { - xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTMODE) >>= nRet; - } - } - return nRet; -} - -void PrintOptTest::impl_SetReducedGradientMode(sal_Int16 nMode ) -{ - if (m_xNode.is()) - { - css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); - if (xSet.is()) - { - sal_Int16 nUpdate; - xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTMODE) >>= nUpdate; - if (nUpdate != nMode) - { - xSet->setPropertyValue( PROPERTYNAME_REDUCEDGRADIENTMODE, css::uno::makeAny(nMode)); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - } - } -} - -sal_Int16 PrintOptTest::impl_GetReducedGradientStepCount() const -{ - sal_Int16 nRet = 64; - if (m_xNode.is()) - { - css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); - if (xSet.is()) - { - xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT) >>= nRet; - } - } - return nRet; -} -void PrintOptTest::impl_SetReducedGradientStepCount(sal_Int16 nStepCount ) -{ - if (m_xNode.is()) - { - css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); - if (xSet.is()) - { - sal_Int16 nUpdate; - xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT) >>= nUpdate; - if (nUpdate != nStepCount) - { - xSet->setPropertyValue( PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT, css::uno::makeAny(nStepCount)); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - } - } -} - -sal_Bool PrintOptTest::impl_IsReduceBitmaps() const -{ - sal_Bool bRet = sal_False; - if (m_xNode.is()) - { - css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); - if (xSet.is()) - { - xSet->getPropertyValue(PROPERTYNAME_REDUCEBITMAPS) >>= bRet; - } - } - return bRet; -} - -void PrintOptTest::impl_SetReduceBitmaps(sal_Bool bState ) -{ - if (m_xNode.is()) - { - css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); - if (xSet.is()) - { - sal_Bool bUpdate; - xSet->getPropertyValue(PROPERTYNAME_REDUCEBITMAPS) >>= bUpdate; - if (bUpdate != bState) - { - xSet->setPropertyValue( PROPERTYNAME_REDUCEBITMAPS, css::uno::makeAny(bState)); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - } - } -} - -sal_Int16 PrintOptTest::impl_GetReducedBitmapMode() const -{ - sal_Int16 nRet = 1; - if (m_xNode.is()) - { - css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); - if (xSet.is()) - { - xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPMODE) >>= nRet; - } - } - return nRet; -} - -void PrintOptTest::impl_SetReducedBitmapMode(sal_Int16 nMode ) -{ - if (m_xNode.is()) - { - css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); - if (xSet.is()) - { - sal_Int16 nUpdate; - xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPMODE) >>= nUpdate; - if (nUpdate != nMode) - { - xSet->setPropertyValue( PROPERTYNAME_REDUCEDBITMAPMODE, css::uno::makeAny(nMode)); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - } - } -} - -sal_Int16 PrintOptTest::impl_GetReducedBitmapResolution() const -{ - sal_Int16 nRet = 3; - if (m_xNode.is()) - { - css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); - if (xSet.is()) - { - xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPRESOLUTION) >>= nRet; - } - } - return nRet; -} - -void PrintOptTest::impl_SetReducedBitmapResolution(sal_Int16 nResolution ) -{ - if (m_xNode.is()) - { - css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); - if (xSet.is()) - { - sal_Int16 nUpdate; - xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPRESOLUTION) >>= nUpdate; - if (nUpdate != nResolution) - { - xSet->setPropertyValue( PROPERTYNAME_REDUCEDBITMAPRESOLUTION, css::uno::makeAny(nResolution)); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - } - } -} - -sal_Bool PrintOptTest::impl_IsReducedBitmapIncludesTransparency() const -{ - sal_Bool bRet = sal_True; - if (m_xNode.is()) - { - css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); - if (xSet.is()) - { - xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY) >>= bRet; - } - } - return bRet; -} - -void PrintOptTest::impl_SetReducedBitmapIncludesTransparency(sal_Bool bState ) -{ - if (m_xNode.is()) - { - css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); - if (xSet.is()) - { - sal_Bool bUpdate; - xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY) >>= bUpdate; - if (bUpdate != bState) - { - xSet->setPropertyValue( PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY, css::uno::makeAny(bState)); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - } - } -} - -sal_Bool PrintOptTest::impl_IsConvertToGreyscales() const -{ - sal_Bool bRet = sal_False; - if (m_xNode.is()) - { - css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); - if (xSet.is()) - { - xSet->getPropertyValue(PROPERTYNAME_CONVERTTOGREYSCALES) >>= bRet; - } - } - return bRet; -} - -void PrintOptTest::impl_SetConvertToGreyscales(sal_Bool bState ) -{ - if (m_xNode.is()) - { - css::uno::Reference xSet(m_xNode, css::uno::UNO_QUERY); - if (xSet.is()) - { - sal_Bool bUpdate; - xSet->getPropertyValue(PROPERTYNAME_CONVERTTOGREYSCALES) >>= bUpdate; - if (bUpdate != bState) - { - xSet->setPropertyValue( PROPERTYNAME_CONVERTTOGREYSCALES, css::uno::makeAny(bState)); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - } - } - } -} - - -PrintOptTest::~PrintOptTest() -{ -} - -void PrintOptTest::impl_checkPrint() -{ - //test SetReduceTransparency() - sal_Bool bNewValue = sal_False; - sal_Bool bOldValue = sal_False; - bOldValue = PrintOptTest::impl_IsReduceTransparency(); - bNewValue = !bOldValue; - aPrintOpt.SetReduceTransparency(bNewValue) ; - bNewValue = impl_IsReduceTransparency(); - // if(bNewValue != bOldValue) // test the old source - if ( bNewValue == bOldValue ) // test the new source - { - throw css::uno::RuntimeException( - rtl::OUString::createFromAscii( - "null com.sun.star.configuration." - "the SetReduceTransparency() error!"), - 0); - } - - //test IsReduceTransparemcy() - bNewValue = bOldValue = sal_False; - bOldValue = impl_IsReduceTransparency(); - bNewValue = !bOldValue; - impl_SetReduceTransparency(bNewValue); - bNewValue = aPrintOpt.IsReduceTransparency(); - //if(bNewValue != bOldValue) // test the old source - if(bNewValue == bOldValue) // test the new source - { - throw css::uno::RuntimeException( - rtl::OUString::createFromAscii( - "null com.sun.star.configuration." - "the IsReduceTransparency() error!"), - 0); - } - - // test SetReducedTransparencyMode() - sal_Int16 nOldMode, nNewMode; - nOldMode = nNewMode = 0; - nOldMode = impl_GetReducedTransparencyMode(); - nNewMode = nOldMode + 1; - aPrintOpt.SetReducedTransparencyMode( nNewMode ); - nNewMode = impl_GetReducedTransparencyMode(); - //if(nNewMode != nOldMode) // test the old source - if ( nNewMode == nOldMode ) // test the new source - { - throw css::uno::RuntimeException( - rtl::OUString::createFromAscii( - "null com.sun.star.configuration." - "the SetReducedTransparencyMode() error!"), - 0); - } - - //test IsReducedTransparencyMode() - nOldMode = nNewMode = 0; - nOldMode = impl_GetReducedTransparencyMode(); - nNewMode = nOldMode + 1; - impl_SetReducedTransparencyMode(nNewMode); - nNewMode = aPrintOpt.GetReducedTransparencyMode(); - //if(nNewMode != nOldMode) // test the old source - if(nNewMode == nOldMode) // test the new source - { - throw css::uno::RuntimeException( - rtl::OUString::createFromAscii( - "null com.sun.star.configuration." - "the IsReducedTransparencyMode() error!" - "nOldMode's value is :"), - 0); - } - - // test the SetReduceGradients() - bNewValue = bOldValue = sal_False; - bOldValue = impl_IsReduceGradients(); - bNewValue = !bOldValue; - aPrintOpt.SetReduceGradients(bNewValue); - bNewValue = impl_IsReduceGradients(); - //if (bNewValue != bOldValue) //test the old source - if (bNewValue == bOldValue) //test the new source - { - throw css::uno::RuntimeException( - rtl::OUString::createFromAscii( - "null com.sun.star.configuration." - "the SetReduceGradients() error!"), - 0); - - } - - // test the IsReduceGradients() - bNewValue = bOldValue = sal_False; - bOldValue = impl_IsReduceGradients(); - bNewValue = !bOldValue; - this->impl_SetReduceGradients(bNewValue); - bNewValue = aPrintOpt.IsReduceGradients(); - // if (bNewValue != bOldValue) // test the old source - if (bNewValue == bOldValue) // test the new source - { - throw css::uno::RuntimeException( - rtl::OUString::createFromAscii( - "null com.sun.star.configuration." - "the IsReduceGradients() error!"), - 0); - - } - - //test SetRedecedGradientMode() - nOldMode = nNewMode = 0; - nOldMode = this->impl_GetReducedGradientMode(); - nNewMode = nOldMode + 1; - aPrintOpt.SetReducedGradientMode(nNewMode); - nNewMode = this->impl_GetReducedGradientMode(); - //if (nNewMode != nOldMode) // test the old source - if (nNewMode == nOldMode)// test the new source - { - throw css::uno::RuntimeException( - rtl::OUString::createFromAscii( - "null com.sun.star.configuration." - "the SetRedecedGradientMode() error!"), - 0); - } - - // test GetReducedGradientMode() - nOldMode = nNewMode = 0; - nOldMode = this->impl_GetReducedGradientMode(); - nNewMode = nOldMode + 1; - this->impl_SetReducedGradientMode(nNewMode); - nNewMode = aPrintOpt.GetReducedGradientMode(); - //if (nNewMode != nOldMode) // test the old source - if (nNewMode == nOldMode) // test the new source - { - throw css::uno::RuntimeException( - rtl::OUString::createFromAscii( - "null com.sun.star.configuration." - "the GetReducedGradientMode() error!"), - 0); - - } - - //test the SetReducedGradientStepCount() - sal_Int16 nNewStepCount; - sal_Int16 nOldStepCount; - nNewStepCount = nOldStepCount = 0; - nOldStepCount = this->impl_GetReducedGradientStepCount(); - nNewStepCount = nOldStepCount + 1; - aPrintOpt.SetReducedGradientStepCount(nNewStepCount); - nNewStepCount = this->impl_GetReducedGradientStepCount(); - // if (nNewStepCount != nOldStepCount) // test the old source - if (nNewStepCount == nOldStepCount) // test the new source - { - throw css::uno::RuntimeException( - rtl::OUString::createFromAscii( - "null com.sun.star.configuration." - "the SetReducedGradientStepCount() error!"), - 0); - - } - - // test the GetReduceGradientStepCount() - nNewStepCount = nOldStepCount = 0; - nOldStepCount = this->impl_GetReducedGradientStepCount(); - nNewStepCount = nOldStepCount + 1; - this->impl_SetReducedGradientStepCount(nNewStepCount); - nNewStepCount = aPrintOpt.GetReducedGradientStepCount(); - // if (nNewStepCount != nOldStepCount) //test the old source - if (nNewStepCount == nOldStepCount) //test the new source - { - throw css::uno::RuntimeException( - rtl::OUString::createFromAscii( - "null com.sun.star.configuration." - "the GetReduceGradientStepCount() error!"), - 0); - } - - // test the SetReduceBitmaps() - bNewValue = bOldValue = sal_False; - bOldValue = this->impl_IsReduceBitmaps(); - bNewValue = !bOldValue; - aPrintOpt.SetReduceBitmaps(bNewValue); - bNewValue = this->impl_IsReduceBitmaps(); - //if (bNewValue != bOldValue) // test the old source - if (bNewValue == bOldValue) // test the new source - { - throw css::uno::RuntimeException( - rtl::OUString::createFromAscii( - "null com.sun.star.configuration." - "the SetReduceBitmaps() error!"), - 0); - } - - // test the IsReduceBitmaps() - bNewValue = bOldValue = sal_False; - bOldValue = this->impl_IsReduceBitmaps(); - bNewValue = !bOldValue; - this->impl_SetReduceBitmaps(bNewValue); - bNewValue = aPrintOpt.IsReduceBitmaps(); - //if (bNewValue != bOldValue) // test the old source - if (bNewValue == bOldValue) // test the new source - { - throw css::uno::RuntimeException( - rtl::OUString::createFromAscii( - "null com.sun.star.configuration." - "the IsReduceBitmaps() error!"), - 0); - } - - // test the SetReduceBitmap() - nNewMode = nOldMode = 0; - nOldMode = impl_GetReducedBitmapMode(); - nNewMode = nOldMode + 1; - aPrintOpt.SetReducedBitmapMode(nNewMode); - nNewMode = impl_GetReducedBitmapMode(); - //if (nNewMode != nOldMode) // test the old source - if (nNewMode == nOldMode)// test the new source - { - throw css::uno::RuntimeException( - rtl::OUString::createFromAscii( - "null com.sun.star.configuration." - "the SetReduceBitmap() error!"), - 0); - } - - // test the SetReduceBitmapMode() - nNewMode = nOldMode = 0; - nOldMode = this->impl_GetReducedBitmapMode(); - nNewMode = nOldMode + 1; - aPrintOpt.SetReducedBitmapMode(nNewMode); - nNewMode = this->impl_GetReducedBitmapMode(); - //if (nNewMode != nOldMode) // test the old source - if (nNewMode == nOldMode) // test the new source - { - throw css::uno::RuntimeException( - rtl::OUString::createFromAscii( - "null com.sun.star.configuration." - "the SetReduceBitmapMode() error!"), - 0); - } - - // test the GetReduceBitmapMode() - nNewMode = nOldMode = 0; - nOldMode = this->impl_GetReducedBitmapMode(); - nNewMode = nOldMode + 1; - this->impl_SetReducedBitmapMode(nNewMode); - nNewMode = aPrintOpt.GetReducedBitmapMode(); - //if (nNewMode != nOldMode) // test the old source - if (nNewMode == nOldMode)// test the new source - { - throw css::uno::RuntimeException( - rtl::OUString::createFromAscii( - "null com.sun.star.configuration." - "the GetReduceBitmapMode() error!"), - 0); - - } - - // test the SetReducedBitmapResolution() - sal_Int16 nOldResolution ; - sal_Int16 nNewResolution ; - nNewResolution = nOldResolution = 0; - nOldResolution = impl_GetReducedBitmapResolution(); - nNewResolution = nOldResolution + 1; - aPrintOpt.SetReducedBitmapResolution(nNewResolution); - nNewResolution = impl_GetReducedBitmapResolution(); - //if (nNewResolution != nOldResolution) // test the old source - if (nNewResolution == nOldResolution)// test the new source - { - throw css::uno::RuntimeException( - rtl::OUString::createFromAscii( - "null com.sun.star.configuration." - "the SetReducedBitmapResolution() error!"), - 0); - } - - // test the GetReduceBitmapResolution() - nNewResolution = nOldResolution = 0; - nOldResolution = impl_GetReducedBitmapResolution(); - nNewResolution = nOldResolution + 1; - impl_SetReducedBitmapResolution(nNewResolution); - nNewResolution = impl_GetReducedBitmapResolution(); - //if (nNewResolution != nOldResolution) // test the old source - if (nNewResolution == nOldResolution) // test the new source - { - throw css::uno::RuntimeException( - rtl::OUString::createFromAscii( - "null com.sun.star.configuration." - "the GetReduceBitmapResolution() error!"), - 0); - } - - // test SetReducedBitmapIncludesTransparency() - bNewValue = bOldValue = sal_False; - bOldValue = impl_IsReducedBitmapIncludesTransparency(); - bNewValue = !bOldValue; - aPrintOpt.SetReducedBitmapIncludesTransparency(bNewValue); - bNewValue = impl_IsReducedBitmapIncludesTransparency(); - //if (bNewValue != bOldValue) // test the new source - if (bNewValue == bOldValue) // test the old source - { - throw css::uno::RuntimeException( - rtl::OUString::createFromAscii( - "null com.sun.star.configuration." - "the SetReducedBitmapIncludesTransparency() error!"), - 0); - } - - // test the IsReducedBitmapIncludesTransparency() - bNewValue = bOldValue = sal_False; - bOldValue = impl_IsReducedBitmapIncludesTransparency(); - bNewValue = !bOldValue; - impl_SetReducedBitmapIncludesTransparency(bNewValue); - bNewValue = aPrintOpt.IsReducedBitmapIncludesTransparency(); - //if (bNewValue != bOldValue) // test the old source - if (bNewValue == bOldValue) // test the new source - { - throw css::uno::RuntimeException( - rtl::OUString::createFromAscii( - "null com.sun.star.configuration." - "the IsReducedBitmapIncludesTransparency() error!"), - 0); - } - - // test the SetConvertToGreyscales() - bNewValue = bOldValue = sal_False; - bOldValue = this->impl_IsConvertToGreyscales(); - bNewValue = !bOldValue; - aPrintOpt.SetConvertToGreyscales(bNewValue); - bNewValue = this->impl_IsConvertToGreyscales(); - //if (bNewValue != bOldValue) // test the old source - if (bNewValue == bOldValue) // test the new source - { - throw css::uno::RuntimeException( - rtl::OUString::createFromAscii( - "null com.sun.star.configuration." - "the SetConvertToGreyscales() error!"), - 0); - } - - // test the IsConvertToGreyscales() - bNewValue = bOldValue = sal_False; - bOldValue = this->impl_IsConvertToGreyscales(); - bNewValue = !bOldValue; - impl_SetConvertToGreyscales(bNewValue); - bNewValue = aPrintOpt.IsConvertToGreyscales(); - //if (bNewValue != bOldValue) // test the old source - if (bNewValue == bOldValue) // test the new source - { - throw css::uno::RuntimeException( - rtl::OUString::createFromAscii( - "null com.sun.star.configuration." - "the IsConvertToGreyscales() error!"), - 0); - } -} diff --git a/svtools/qa/complex/ConfigItems/helper/PrintOptTest.hxx b/svtools/qa/complex/ConfigItems/helper/PrintOptTest.hxx deleted file mode 100644 index 14d4267b8878..000000000000 --- a/svtools/qa/complex/ConfigItems/helper/PrintOptTest.hxx +++ /dev/null @@ -1,92 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: PrintOptTest.hxx,v $ - * - * $Revision: 1.1.4.2 $ - * - * last change: $Author: as $ $Date: 2008/03/19 11:09:24 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef SVTOOLS_PRINTOPTTEST_HXX -#define SVTOOLS_PRINTOPTTEST_HXX - -#include -#include - -namespace css = ::com::sun::star; - -class PrintOptTest -{ -public: - - PrintOptTest(); - ~PrintOptTest(); - - void impl_checkPrint(); - -private: //members - - SvtPrinterOptions aPrintOpt; - css::uno::Reference< css::container::XNameAccess > m_xCfg; - css::uno::Reference< css::container::XNameAccess > m_xNode; - -private: // methods - sal_Bool impl_IsReduceTransparency() const ; - void impl_SetReduceTransparency( sal_Bool bState ) ; - - sal_Int16 impl_GetReducedTransparencyMode() const ; - void impl_SetReducedTransparencyMode( sal_Int16 nMode ) ; - - sal_Bool impl_IsReduceGradients() const ; - void impl_SetReduceGradients( sal_Bool bState ) ; - - sal_Int16 impl_GetReducedGradientMode() const ; - void impl_SetReducedGradientMode( sal_Int16 nMode ) ; - - sal_Int16 impl_GetReducedGradientStepCount() const ; - void impl_SetReducedGradientStepCount( sal_Int16 nStepCount ); - - sal_Bool impl_IsReduceBitmaps() const ; - void impl_SetReduceBitmaps( sal_Bool bState ) ; - - sal_Int16 impl_GetReducedBitmapMode() const ; - void impl_SetReducedBitmapMode( sal_Int16 nMode ) ; - - sal_Int16 impl_GetReducedBitmapResolution() const ; - void impl_SetReducedBitmapResolution( sal_Int16 nResolution ) ; - - sal_Bool impl_IsReducedBitmapIncludesTransparency() const ; - void impl_SetReducedBitmapIncludesTransparency( sal_Bool bState ) ; - - sal_Bool impl_IsConvertToGreyscales() const; - void impl_SetConvertToGreyscales( sal_Bool bState ) ; - -}; - -#endif // #ifndef SVTOOLS_PRINTOPTTEST_HXX diff --git a/svtools/qa/complex/ConfigItems/helper/UserOptTest.cxx b/svtools/qa/complex/ConfigItems/helper/UserOptTest.cxx deleted file mode 100644 index 14ee513ee0cb..000000000000 --- a/svtools/qa/complex/ConfigItems/helper/UserOptTest.cxx +++ /dev/null @@ -1,274 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: UserOptTest.cxx,v $ - * - * $Revision: 1.1.4.2 $ - * - * last change: $Author: as $ $Date: 2008/03/19 11:09:24 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#include "UserOptTest.hxx" - -namespace css = ::com::sun::star; - -//============================================================================= -static const ::rtl::OUString MESSAGE_SETCOMPANY_FAILED = ::rtl::OUString::createFromAscii("set company failed") ; -static const ::rtl::OUString MESSAGE_SETFIRSTNAME_FAILED = ::rtl::OUString::createFromAscii("set firstname failed") ; -static const ::rtl::OUString MESSAGE_SETLASTNAME_FAILED = ::rtl::OUString::createFromAscii("set lastname failed") ; -static const ::rtl::OUString MESSAGE_SETID_FAILED = ::rtl::OUString::createFromAscii("set ID failed") ; -static const ::rtl::OUString MESSAGE_SETSTREET_FAILED = ::rtl::OUString::createFromAscii("set street failed") ; -static const ::rtl::OUString MESSAGE_SETCITY_FAILED = ::rtl::OUString::createFromAscii("set city failed") ; -static const ::rtl::OUString MESSAGE_SETSTATE_FAILED = ::rtl::OUString::createFromAscii("set state failed") ; -static const ::rtl::OUString MESSAGE_SETZIP_FAILED = ::rtl::OUString::createFromAscii("set zip failed") ; -static const ::rtl::OUString MESSAGE_SETCOUNTRY_FAILED = ::rtl::OUString::createFromAscii("set country failed") ; -static const ::rtl::OUString MESSAGE_SETPOSITION_FAILED = ::rtl::OUString::createFromAscii("set position failed") ; -static const ::rtl::OUString MESSAGE_SETTITLE_FAILED = ::rtl::OUString::createFromAscii("set title failed") ; -static const ::rtl::OUString MESSAGE_SETTELEPHONEHOME_FAILED = ::rtl::OUString::createFromAscii("set telephonehome failed") ; -static const ::rtl::OUString MESSAGE_SETTELEPHONEWORK_FAILED = ::rtl::OUString::createFromAscii("set telephonework failed") ; -static const ::rtl::OUString MESSAGE_SETFAX_FAILED = ::rtl::OUString::createFromAscii("set fax failed") ; -static const ::rtl::OUString MESSAGE_SETEMAIL_FAILED = ::rtl::OUString::createFromAscii("set email failed") ; -static const ::rtl::OUString MESSAGE_SETCUSTOMERNUMBER_FAILED = ::rtl::OUString::createFromAscii("set customernumber failed"); -static const ::rtl::OUString MESSAGE_SETFATHERSNAME_FAILED = ::rtl::OUString::createFromAscii("set fathersname failed") ; -static const ::rtl::OUString MESSAGE_SETAPARTMENT_FAILED = ::rtl::OUString::createFromAscii("set apartment failed") ; - -//============================================================================= - - -UserOptTest::UserOptTest() - :m_aConfigItem() - ,m_xCfg() -{ -} - -UserOptTest::~UserOptTest() -{ -} - -void UserOptTest::impl_checkUserData() -{ - impl_checkSetCompany( ::rtl::OUString() ); - impl_checkSetFirstName( ::rtl::OUString() ); - impl_checkSetLastName( ::rtl::OUString() ); - impl_checkSetID( ::rtl::OUString() ); - impl_checkSetStreet( ::rtl::OUString() ); - impl_checkSetCity( ::rtl::OUString() ); - impl_checkSetState( ::rtl::OUString() ); - impl_checkSetZip( ::rtl::OUString() ); - impl_checkSetCountry( ::rtl::OUString() ); - impl_checkSetPosition( ::rtl::OUString() ); - impl_checkSetTitle( ::rtl::OUString() ); - impl_checkSetTelephoneHome( ::rtl::OUString() ); - impl_checkSetTelephoneWork( ::rtl::OUString() ); - impl_checkSetFax( ::rtl::OUString() ); - impl_checkSetEmail( ::rtl::OUString() ); - //impl_checkSetCustomerNumber( ::rtl::OUString() ); - impl_checkSetFathersName( ::rtl::OUString() ); - impl_checkSetApartment( ::rtl::OUString() ); - - impl_checkSetCompany( ::rtl::OUString::createFromAscii("RedFlag2000") ); - impl_checkSetFirstName( ::rtl::OUString::createFromAscii("Yan") ); - impl_checkSetLastName( ::rtl::OUString::createFromAscii("Wu") ); - impl_checkSetID( ::rtl::OUString::createFromAscii("wuy") ); - impl_checkSetStreet( ::rtl::OUString::createFromAscii("SouthFifthRing") ); - impl_checkSetCity( ::rtl::OUString::createFromAscii("Beijing") ); - impl_checkSetState( ::rtl::OUString::createFromAscii("Beijing") ); - impl_checkSetZip( ::rtl::OUString::createFromAscii("100176") ); - impl_checkSetCountry( ::rtl::OUString::createFromAscii("China") ); - impl_checkSetPosition( ::rtl::OUString::createFromAscii("Engineer") ); - impl_checkSetTitle( ::rtl::OUString::createFromAscii("Software Engineer") ); - impl_checkSetTelephoneHome( ::rtl::OUString::createFromAscii("010-51570010") ); - impl_checkSetTelephoneWork( ::rtl::OUString::createFromAscii("010-51570010") ); - impl_checkSetFax( ::rtl::OUString::createFromAscii("010-51570010") ); - impl_checkSetEmail( ::rtl::OUString::createFromAscii("wuy@redflag2000.cn") ); - //impl_checkSetCustomerNumber( ::rtl::OUString::createFromAscii("87654321") ); - impl_checkSetFathersName( ::rtl::OUString::createFromAscii("father") ); - impl_checkSetApartment( ::rtl::OUString::createFromAscii("apartment") ); -} - -void UserOptTest::impl_checkSetCompany( const ::rtl::OUString& sUserData ) -{ - m_aConfigItem.SetCompany( sUserData ); - - ::rtl::OUString sCheck = m_aConfigItem.GetCompany(); - if ( sCheck != sUserData ) - throw css::uno::Exception(MESSAGE_SETCOMPANY_FAILED, 0); -} - -void UserOptTest::impl_checkSetFirstName( const ::rtl::OUString& sUserData ) -{ - m_aConfigItem.SetFirstName( sUserData ); - - ::rtl::OUString sCheck = m_aConfigItem.GetFirstName(); - if ( sCheck != sUserData ) - throw css::uno::Exception(MESSAGE_SETFIRSTNAME_FAILED, 0); -} - -void UserOptTest::impl_checkSetLastName( const ::rtl::OUString& sUserData ) -{ - m_aConfigItem.SetLastName( sUserData ); - - ::rtl::OUString sCheck = m_aConfigItem.GetLastName(); - if ( sCheck != sUserData ) - throw css::uno::Exception(MESSAGE_SETLASTNAME_FAILED, 0); -} - -void UserOptTest::impl_checkSetID( const ::rtl::OUString& sUserData ) -{ - m_aConfigItem.SetID( sUserData ); - - ::rtl::OUString sCheck = m_aConfigItem.GetID(); - if ( sCheck != sUserData ) - throw css::uno::Exception(MESSAGE_SETID_FAILED, 0); -} - -void UserOptTest::impl_checkSetStreet( const ::rtl::OUString& sUserData ) -{ - m_aConfigItem.SetStreet( sUserData ); - - ::rtl::OUString sCheck = m_aConfigItem.GetStreet(); - if ( sCheck != sUserData ) - throw css::uno::Exception(MESSAGE_SETSTREET_FAILED, 0); -} - -void UserOptTest::impl_checkSetCity( const ::rtl::OUString& sUserData ) -{ - m_aConfigItem.SetCity( sUserData ); - - ::rtl::OUString sCheck = m_aConfigItem.GetCity(); - if ( sCheck != sUserData ) - throw css::uno::Exception(MESSAGE_SETCITY_FAILED, 0); -} - -void UserOptTest::impl_checkSetState( const ::rtl::OUString& sUserData ) -{ - m_aConfigItem.SetState( sUserData ); - - ::rtl::OUString sCheck = m_aConfigItem.GetState(); - if ( sCheck != sUserData ) - throw css::uno::Exception(MESSAGE_SETSTATE_FAILED, 0); -} - -void UserOptTest::impl_checkSetZip( const ::rtl::OUString& sUserData ) -{ - m_aConfigItem.SetZip( sUserData ); - - ::rtl::OUString sCheck = m_aConfigItem.GetZip(); - if ( sCheck != sUserData ) - throw css::uno::Exception(MESSAGE_SETZIP_FAILED, 0); -} - -void UserOptTest::impl_checkSetCountry( const ::rtl::OUString& sUserData ) -{ - m_aConfigItem.SetCountry( sUserData ); - - ::rtl::OUString sCheck = m_aConfigItem.GetCountry(); - if ( sCheck != sUserData ) - throw css::uno::Exception(MESSAGE_SETCOUNTRY_FAILED, 0); -} - -void UserOptTest::impl_checkSetPosition( const ::rtl::OUString& sUserData ) -{ - m_aConfigItem.SetPosition( sUserData ); - - ::rtl::OUString sCheck = m_aConfigItem.GetPosition(); - if ( sCheck != sUserData ) - throw css::uno::Exception(MESSAGE_SETPOSITION_FAILED, 0); -} - -void UserOptTest::impl_checkSetTitle( const ::rtl::OUString& sUserData ) -{ - m_aConfigItem.SetTitle( sUserData ); - - ::rtl::OUString sCheck = m_aConfigItem.GetTitle(); - if ( sCheck != sUserData ) - throw css::uno::Exception(MESSAGE_SETTITLE_FAILED, 0); -} - -void UserOptTest::impl_checkSetTelephoneHome( const ::rtl::OUString& sUserData ) -{ - m_aConfigItem.SetTelephoneHome( sUserData ); - - ::rtl::OUString sCheck = m_aConfigItem.GetTelephoneHome(); - if ( sCheck != sUserData ) - throw css::uno::Exception(MESSAGE_SETTELEPHONEHOME_FAILED, 0); -} - -void UserOptTest::impl_checkSetTelephoneWork( const ::rtl::OUString& sUserData ) -{ - m_aConfigItem.SetTelephoneWork( sUserData ); - - ::rtl::OUString sCheck = m_aConfigItem.GetTelephoneWork(); - if ( sCheck != sUserData ) - throw css::uno::Exception(MESSAGE_SETTELEPHONEWORK_FAILED, 0); -} - -void UserOptTest::impl_checkSetFax( const ::rtl::OUString& sUserData ) -{ - m_aConfigItem.SetFax( sUserData ); - - ::rtl::OUString sCheck = m_aConfigItem.GetFax(); - if ( sCheck != sUserData ) - throw css::uno::Exception(MESSAGE_SETFAX_FAILED, 0); -} - -void UserOptTest::impl_checkSetEmail( const ::rtl::OUString& sUserData ) -{ - m_aConfigItem.SetEmail( sUserData ); - - ::rtl::OUString sCheck = m_aConfigItem.GetEmail(); - if ( sCheck != sUserData ) - throw css::uno::Exception(MESSAGE_SETEMAIL_FAILED, 0); -} - -void UserOptTest::impl_checkSetCustomerNumber( const ::rtl::OUString& sUserData ) -{ - m_aConfigItem.SetCustomerNumber( sUserData ); - - ::rtl::OUString sCheck = m_aConfigItem.GetCustomerNumber(); - if ( sCheck != sUserData ) - throw css::uno::Exception(MESSAGE_SETCUSTOMERNUMBER_FAILED, 0); -} - -void UserOptTest::impl_checkSetFathersName( const ::rtl::OUString& sUserData ) -{ - m_aConfigItem.SetFathersName( sUserData ); - - ::rtl::OUString sCheck = m_aConfigItem.GetFathersName(); - if ( sCheck != sUserData ) - throw css::uno::Exception(MESSAGE_SETFATHERSNAME_FAILED, 0); -} - -void UserOptTest::impl_checkSetApartment( const ::rtl::OUString& sUserData ) -{ - m_aConfigItem.SetApartment( sUserData ); - - ::rtl::OUString sCheck = m_aConfigItem.GetApartment(); - if ( sCheck != sUserData ) - throw css::uno::Exception(MESSAGE_SETAPARTMENT_FAILED, 0); -} diff --git a/svtools/qa/complex/ConfigItems/helper/UserOptTest.hxx b/svtools/qa/complex/ConfigItems/helper/UserOptTest.hxx deleted file mode 100644 index 72ff71cafe2d..000000000000 --- a/svtools/qa/complex/ConfigItems/helper/UserOptTest.hxx +++ /dev/null @@ -1,78 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: UserOptTest.hxx,v $ - * - * $Revision: 1.1.4.2 $ - * - * last change: $Author: as $ $Date: 2008/03/19 11:09:25 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef SVTOOLS_USEROPTTEST_HXX -#define SVTOOLS_USEROPTTEST_HXX - -#include -#include - -namespace css = ::com::sun::star; - -class UserOptTest -{ -public: - UserOptTest(); - ~UserOptTest(); - - void impl_checkUserData(); - -private: - void impl_checkSetCompany( const ::rtl::OUString& sUserData ); - void impl_checkSetFirstName( const ::rtl::OUString& sUserData ); - void impl_checkSetLastName( const ::rtl::OUString& sUserData ); - void impl_checkSetID( const ::rtl::OUString& sUserData ); - void impl_checkSetStreet( const ::rtl::OUString& sUserData ); - void impl_checkSetCity( const ::rtl::OUString& sUserData ); - void impl_checkSetState( const ::rtl::OUString& sUserData ); - void impl_checkSetZip( const ::rtl::OUString& sUserData ); - void impl_checkSetCountry( const ::rtl::OUString& sUserData ); - void impl_checkSetPosition( const ::rtl::OUString& sUserData ); - void impl_checkSetTitle( const ::rtl::OUString& sUserData ); - void impl_checkSetTelephoneHome( const ::rtl::OUString& sUserData ); - void impl_checkSetTelephoneWork( const ::rtl::OUString& sUserData ); - void impl_checkSetFax( const ::rtl::OUString& sUserData ); - void impl_checkSetEmail( const ::rtl::OUString& sUserData ); - void impl_checkSetCustomerNumber( const ::rtl::OUString& sUserData ); - void impl_checkSetFathersName( const ::rtl::OUString& sUserData ); - void impl_checkSetApartment( const ::rtl::OUString& sUserData ); - -private: - SvtUserOptions m_aConfigItem; - - css::uno::Reference< css::container::XNameAccess > m_xCfg; -}; - -#endif // #ifndef SVTOOLS_USEROPTTEST_HXX diff --git a/svtools/qa/complex/ConfigItems/helper/exports.map b/svtools/qa/complex/ConfigItems/helper/exports.map deleted file mode 100644 index 85610ad80888..000000000000 --- a/svtools/qa/complex/ConfigItems/helper/exports.map +++ /dev/null @@ -1,10 +0,0 @@ -UDK_3_0_0 { - global: - GetVersionInfo; - component_getImplementationEnvironment; - component_getFactory; - component_writeInfo; - - local: - *; -}; diff --git a/svtools/qa/complex/ConfigItems/helper/makefile.mk b/svtools/qa/complex/ConfigItems/helper/makefile.mk deleted file mode 100644 index 6070d25b7bd4..000000000000 --- a/svtools/qa/complex/ConfigItems/helper/makefile.mk +++ /dev/null @@ -1,81 +0,0 @@ -#************************************************************************* -# -# OpenOffice.org - a multi-platform office productivity suite -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.1.4.2 $ -# -# last change: $Author: as $ $Date: 2008/03/19 11:09:25 $ -# -# The Contents of this file are made available subject to -# the terms of GNU Lesser General Public License Version 2.1. -# -# -# GNU Lesser General Public License Version 2.1 -# ============================================= -# Copyright 2005 by Sun Microsystems, Inc. -# 901 San Antonio Road, Palo Alto, CA 94303, USA -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License version 2.1, as published by the Free Software Foundation. -# -# This library 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 for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, -# MA 02111-1307 USA -# -#************************************************************************* -PRJ=..$/..$/..$/.. - -PRJNAME= svtools -TARGET= ConfigItemTest -USE_DEFFILE= TRUE -ENABLE_EXCEPTIONS= TRUE -NO_BSYMBOLIC= TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Generate ----------------------------------------------------- - -INCPOST += $(PRJ)$/source$/inc - -# --- light services library ---------------------------------------------------- - -SHL1TARGET= svt_$(TARGET) - -SHL1OBJS= \ - $(SLO)$/UserOptTest.obj \ - $(SLO)$/PrintOptTest.obj \ - $(SLO)$/AccessibilityOptTest.obj \ - $(SLO)$/HistoryOptTest.obj \ - $(SLO)$/ConfigItemTest.obj - -SHL1STDLIBS= \ - $(SVTOOLLIB) \ - $(SVLLIB) \ - $(UNOTOOLSLIB) \ - $(COMPHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) - -SHL1DEF= $(MISC)$/$(SHL1TARGET).def -#SHL1DEPN= $(SHL1IMPLIBN) $(SHL1TARGETN) - -DEF1NAME= $(SHL1TARGET) - -SHL1VERSIONMAP= exports.map - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - diff --git a/svtools/qa/complex/ConfigItems/makefile.mk b/svtools/qa/complex/ConfigItems/makefile.mk deleted file mode 100644 index f85c5b0a8e65..000000000000 --- a/svtools/qa/complex/ConfigItems/makefile.mk +++ /dev/null @@ -1,91 +0,0 @@ -#************************************************************************* -# -# OpenOffice.org - a multi-platform office productivity suite -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.1.4.2 $ -# -# last change: $Author: as $ $Date: 2008/03/19 11:09:22 $ -# -# The Contents of this file are made available subject to -# the terms of GNU Lesser General Public License Version 2.1. -# -# -# GNU Lesser General Public License Version 2.1 -# ============================================= -# Copyright 2005 by Sun Microsystems, Inc. -# 901 San Antonio Road, Palo Alto, CA 94303, USA -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License version 2.1, as published by the Free Software Foundation. -# -# This library 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 for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, -# MA 02111-1307 USA -# -#************************************************************************* -PRJ = ..$/..$/.. -TARGET = CheckConfigItems -PRJNAME = svtools -PACKAGE = complex$/ConfigItems - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk - - -#----- compile .java files ----------------------------------------- - -JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar jut.jar java_uno.jar \ - OOoRunner.jar - -JAVAFILES = CheckConfigItems.java - -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - -SUBDIRS = helper - -#----- make a jar from compiled files ------------------------------ - -MAXLINELENGTH = 100000 - -JARCLASSDIRS = $(PACKAGE) -JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE - -# --- Parameters for the test -------------------------------------- - -# start an office if the parameter is set for the makefile -.IF "$(OFFICE)" == "" -CT_APPEXECCOMMAND = -.ELSE -CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;" -.ENDIF - -# test base is java complex -CT_TESTBASE = -TestBase java_complex - -# test looks something like the.full.package.TestName -CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b) - -# start the runner application -CT_APP = org.openoffice.Runner - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - -RUN: run - -run: - java -cp $(CLASSPATH) $(CT_APP) $(CT_TESTBASE) $(CT_APPEXECCOMMAND) $(CT_TEST) - - - diff --git a/svtools/qa/complex/passwordcontainer/MasterPasswdHandler.java b/svtools/qa/complex/passwordcontainer/MasterPasswdHandler.java deleted file mode 100644 index bf6159ee38c5..000000000000 --- a/svtools/qa/complex/passwordcontainer/MasterPasswdHandler.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -/** - * - * @author zxf - */ - -package complex.passwordcontainer; - -import com.sun.star.lib.uno.helper.WeakBase; -import com.sun.star.task.XInteractionContinuation; -import com.sun.star.ucb.XInteractionSupplyAuthentication; -import com.sun.star.task.XInteractionRequest; -import com.sun.star.task.XInteractionHandler; -import com.sun.star.task.MasterPasswordRequest; -import com.sun.star.uno.UnoRuntime; - -public class MasterPasswdHandler extends WeakBase - implements XInteractionHandler { - XInteractionHandler m_xHandler; - - public MasterPasswdHandler( XInteractionHandler xHandler ) { - m_xHandler = xHandler; - } - - public void handle( XInteractionRequest xRequest ) { - try { - MasterPasswordRequest aMasterPasswordRequest; - if( xRequest.getRequest() instanceof MasterPasswordRequest ) { - aMasterPasswordRequest = (MasterPasswordRequest)xRequest.getRequest(); - if( aMasterPasswordRequest != null ) { - XInteractionContinuation xContinuations[] = xRequest.getContinuations(); - XInteractionSupplyAuthentication xAuthentication = null; - - for( int i = 0; i < xContinuations.length; ++i ) { - xAuthentication = (XInteractionSupplyAuthentication)UnoRuntime.queryInterface( XInteractionSupplyAuthentication.class, xContinuations[i]); - if( xAuthentication != null ) - break; - } - if( xAuthentication.canSetPassword() ) - xAuthentication.setPassword( "abcdefghijklmnopqrstuvwxyz123456" ); - xAuthentication.select(); - } - } else { - m_xHandler.handle( xRequest ); - } - } catch( Exception e ) { - System.out.println( "MasterPasswordHandler Error: " + e ); - } - } -} - - - - - - - diff --git a/svtools/qa/complex/passwordcontainer/PasswordContainerTest.java b/svtools/qa/complex/passwordcontainer/PasswordContainerTest.java deleted file mode 100644 index 5da0676f8bb9..000000000000 --- a/svtools/qa/complex/passwordcontainer/PasswordContainerTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: PasswordContainerTest.java,v $ - * - * $Revision: 1.2 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package complex.passwordcontainer; - -public interface PasswordContainerTest { - boolean test(); -} diff --git a/svtools/qa/complex/passwordcontainer/PasswordContainerUnitTest.java b/svtools/qa/complex/passwordcontainer/PasswordContainerUnitTest.java deleted file mode 100644 index aee1c9355a3f..000000000000 --- a/svtools/qa/complex/passwordcontainer/PasswordContainerUnitTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: PasswordContainerUnitTest.java,v $ - * - * $Revision: 1.2 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package complex.passwordcontainer; - -import complexlib.ComplexTestCase; -import com.sun.star.lang.XMultiServiceFactory; - -public class PasswordContainerUnitTest extends ComplexTestCase { - private XMultiServiceFactory m_xMSF = null; - - public String[] getTestMethodNames() { - return new String[] { - "ExecuteTest01", - "ExecuteTest02", - "ExecuteTest03"}; - } - public String getTestObjectName() { - return "PasswordContainerUnitTest"; - } - - public void before() { - try { - m_xMSF = (XMultiServiceFactory) param.getMSF(); - } catch (Exception e) { - failed ("Cannot create service factory!"); - } - if (m_xMSF == null) { - failed ("Cannot create service factory!"); - } - } - - public void after() { - m_xMSF = null; - } - - public void ExecuteTest01() { - PasswordContainerTest aTest = new Test01(m_xMSF, log); - assure("Test01 failed!", aTest.test()); - } - public void ExecuteTest02() { - PasswordContainerTest aTest = new Test02(m_xMSF, log); - assure("Test02 failed!", aTest.test()); - } - public void ExecuteTest03() { - PasswordContainerTest aTest = new Test03(m_xMSF, log); - assure("Test03 failed!", aTest.test()); - } -} diff --git a/svtools/qa/complex/passwordcontainer/Test01.java b/svtools/qa/complex/passwordcontainer/Test01.java deleted file mode 100644 index 6de96de05ec9..000000000000 --- a/svtools/qa/complex/passwordcontainer/Test01.java +++ /dev/null @@ -1,115 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: Test01.java,v $ - * - * $Revision: 1.2 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package complex.passwordcontainer; - -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.task.XInteractionHandler; -import com.sun.star.task.XPasswordContainer; -import com.sun.star.task.UrlRecord; -import com.sun.star.task.UserRecord; -import com.sun.star.task.XMasterPasswordHandling; - -import com.sun.star.uno.UnoRuntime; - -import share.LogWriter; - -public class Test01 implements PasswordContainerTest { - XMultiServiceFactory m_xMSF = null; - XPasswordContainer m_xPasswordContainer = null; - TestHelper m_aTestHelper = null; - - public Test01 ( XMultiServiceFactory xMSF, LogWriter aLogWriter ) - { - m_xMSF = xMSF; - m_aTestHelper = new TestHelper (aLogWriter, "Test01: "); - } - - public boolean test() { - final String sURL = "http://www.openoffice.org"; - final String sUserPre = "OOoUser"; - final String sPwdPre = "Password"; - final int iUserNum1 = 10; - final int iUserNum2 = 5; - - UserRecord aInputUserList1[] = new UserRecord[iUserNum1]; - for(int i = 0; i < iUserNum1; i++) { - String sTemp[] = {sPwdPre + "_1_" + i}; // currently one password for one user - aInputUserList1[i] = new UserRecord(sUserPre + "_1_" + i, sTemp); - } - UserRecord aInputUserList2[] = new UserRecord[iUserNum2]; - for(int i = 0; i < iUserNum2; i++) { - String sTemp[] = {sPwdPre + "_2_" + i}; - aInputUserList2[i] = new UserRecord(sUserPre + "_2_" + i, sTemp); - } - try { - Object oPasswordContainer = m_xMSF.createInstance( "com.sun.star.task.PasswordContainer" ); - XPasswordContainer xContainer = (XPasswordContainer)UnoRuntime.queryInterface(XPasswordContainer.class, oPasswordContainer); - Object oHandler = m_xMSF.createInstance( "com.sun.star.task.InteractionHandler" ); - XInteractionHandler xHandler = (XInteractionHandler)UnoRuntime.queryInterface(XInteractionHandler.class, oHandler); - MasterPasswdHandler aMHandler = new MasterPasswdHandler( xHandler ); - - // add a set of users and passwords for the same URL for runtime - for(int i = 0; i < iUserNum1; i++) { - xContainer.add(sURL, aInputUserList1[i].UserName, aInputUserList1[i].Passwords, aMHandler); - } - for (int i = 0; i < iUserNum2; i++) { - xContainer.add(sURL, aInputUserList2[i].UserName, aInputUserList2[i].Passwords, aMHandler); - } - - // remove some of the passwords - for (int i = 0; i < iUserNum1; i++) { - xContainer.remove(sURL, aInputUserList1[i].UserName); - } - - // get the result and check it with the expected one - UrlRecord aRecord = xContainer.find(sURL, aMHandler); - if(!aRecord.Url.equals(sURL)) { - m_aTestHelper.Error("URL mismatch. Got " + aRecord.Url + "; should be " + sURL); - return false; - } - if(!m_aTestHelper.sameLists(aRecord.UserList, aInputUserList2)) { - m_aTestHelper.Error("User list is not the expected"); - return false; - } - - // remove the runtime passwords - aRecord = xContainer.find(sURL, aMHandler); - for(int i = 0; i < aRecord.UserList.length; i++) { - xContainer.remove(sURL, aRecord.UserList[i].UserName); - } - } catch(Exception e) { - m_aTestHelper.Error("Exception: " + e); - return false; - } - return true; - } -} diff --git a/svtools/qa/complex/passwordcontainer/Test02.java b/svtools/qa/complex/passwordcontainer/Test02.java deleted file mode 100644 index 5d65d8090cf9..000000000000 --- a/svtools/qa/complex/passwordcontainer/Test02.java +++ /dev/null @@ -1,159 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: Test02.java,v $ - * - * $Revision: 1.2 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package complex.passwordcontainer; - -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.task.XPasswordContainer; -import com.sun.star.task.XMasterPasswordHandling; -import com.sun.star.task.XInteractionHandler; -import com.sun.star.task.UrlRecord; -import com.sun.star.task.UserRecord; - -import com.sun.star.uno.UnoRuntime; - -import share.LogWriter; - -public class Test02 implements PasswordContainerTest { - XMultiServiceFactory m_xMSF = null; - XPasswordContainer m_xPasswordContainer = null; - TestHelper m_aTestHelper = null; - - public Test02 ( XMultiServiceFactory xMSF, LogWriter aLogWriter ) - { - m_xMSF = xMSF; - m_aTestHelper = new TestHelper (aLogWriter, "Test02: "); - } - - public boolean test() { - final String sURL = "http://www.openoffice.org"; - final String sUserPre = "OOoUser"; - final String sPwdPre = "Password"; - final int iUserNum1 = 10; - final int iUserNum2 = 5; - - UserRecord aInputUserList1[] = new UserRecord[iUserNum1]; - for(int i = 0; i < iUserNum1; i++) { - String sTemp[] = {sPwdPre + "_1_" + i}; // currently one password for one user - aInputUserList1[i] = new UserRecord(sUserPre + "_1_" + i, sTemp); - } - UserRecord aInputUserList2[] = new UserRecord[iUserNum2]; - for(int i = 0; i < iUserNum2; i++) { - String sTemp[] = {sPwdPre + "_2_" + i}; - aInputUserList2[i] = new UserRecord(sUserPre + "_2_" + i, sTemp); - } - - try { - Object oPasswordContainer = m_xMSF.createInstance("com.sun.star.task.PasswordContainer"); - XPasswordContainer xContainer = (XPasswordContainer)UnoRuntime.queryInterface(XPasswordContainer.class, oPasswordContainer); - Object oHandler = m_xMSF.createInstance("com.sun.star.task.InteractionHandler"); - XInteractionHandler xHandler = (XInteractionHandler)UnoRuntime.queryInterface(XInteractionHandler.class, oHandler); - MasterPasswdHandler aMHandler = new MasterPasswdHandler(xHandler); - XMasterPasswordHandling xMHandling = (XMasterPasswordHandling)UnoRuntime.queryInterface(XMasterPasswordHandling.class, oPasswordContainer); - - // allow the storing of the passwords - xMHandling.allowPersistentStoring(true); - - // add a set of users and passwords for the same URL persistently - for(int i = 0; i < iUserNum1; ++i) { - xContainer.addPersistent(sURL, aInputUserList1[i].UserName, aInputUserList1[i].Passwords, aMHandler); - } - for(int i = 0; i < iUserNum2; ++i) { - xContainer.addPersistent(sURL, aInputUserList2[i].UserName, aInputUserList2[i].Passwords, aMHandler); - } - - // remove some of the passwords - for(int i = 0; i < iUserNum1; ++i) { - xContainer.remove(sURL, aInputUserList1[i].UserName); - } - - // get the result with find() and check it with the expected one - UrlRecord aRecord = xContainer.find(sURL, aMHandler); - if(!aRecord.Url.equals(sURL)) { - m_aTestHelper.Error("URL mismatch. Got " + aRecord.Url + "; should be " + sURL); - return false; - } - if(!m_aTestHelper.sameLists(aRecord.UserList, aInputUserList2)) { - m_aTestHelper.Error("User list is not the expected"); - return false; - } - - // get the result with getAllPersistent() and check - UrlRecord aRecords[] = xContainer.getAllPersistent(aMHandler); - if(!aRecords[0].Url.equals(sURL)) { - m_aTestHelper.Error("URL mismatch"); - return false; - } - if(!m_aTestHelper.sameLists(aRecords[0].UserList, aInputUserList2)) { - m_aTestHelper.Error("User list is not the expected"); - return false; - } - - // remove all the persistent passwords - xContainer.removeAllPersistent(); - - // remove the runtime passwords - for(int i = 0; i < aRecords[0].UserList.length; ++i) { - xContainer.remove(sURL, aRecords[0].UserList[i].UserName); - } - - // disallow the storing of the passwords - xMHandling.allowPersistentStoring(false); - } catch(Exception e) { - m_aTestHelper.Error("Exception: " + e); - return false; - } - return true; - } -} - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svtools/qa/complex/passwordcontainer/Test03.java b/svtools/qa/complex/passwordcontainer/Test03.java deleted file mode 100644 index 69de8b88578b..000000000000 --- a/svtools/qa/complex/passwordcontainer/Test03.java +++ /dev/null @@ -1,122 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: Test03.java,v $ - * - * $Revision: 1.2 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package complex.passwordcontainer; - -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.task.UrlRecord; -import com.sun.star.task.UserRecord; -import com.sun.star.task.XPasswordContainer; -import com.sun.star.task.XMasterPasswordHandling; -import com.sun.star.task.XInteractionHandler; - - -import com.sun.star.uno.UnoRuntime; -import share.LogWriter; - -public class Test03 implements PasswordContainerTest { - XMultiServiceFactory m_xMSF = null; - XPasswordContainer m_xPasswordContainer = null; - TestHelper m_aTestHelper = null; - - public Test03 ( XMultiServiceFactory xMSF, LogWriter aLogWriter ) - { - m_xMSF = xMSF; - m_aTestHelper = new TestHelper (aLogWriter, "Test03: "); - } - - public boolean test() { - final String sURL = "http://www.openoffice.org"; - final String sUserPre = "OOoUser"; - final String sPwdPre = "Password"; - final int iPersistentUserNum = 10; - final int iRuntimeUserNum = 5; - - UserRecord aInputUserList[] = new UserRecord[iPersistentUserNum+iRuntimeUserNum]; - for(int i = 0; i < iPersistentUserNum; i++) { - String sTemp[] = {sPwdPre + "_1_" + i}; // currently one password for one user - aInputUserList[i] = new UserRecord(sUserPre + "_1_" + i, sTemp); - } - for(int i = 0; i < iRuntimeUserNum; i++) { - String sTemp[] = {sPwdPre + "_2_" + i}; - aInputUserList[i+iPersistentUserNum] = new UserRecord(sUserPre + "_2_" + i, sTemp); - } - - try { - Object oPasswordContainer = m_xMSF.createInstance("com.sun.star.task.PasswordContainer"); - XPasswordContainer xContainer = (XPasswordContainer)UnoRuntime.queryInterface(XPasswordContainer.class, oPasswordContainer); - Object oHandler = m_xMSF.createInstance("com.sun.star.task.InteractionHandler"); - XInteractionHandler xHandler = (XInteractionHandler)UnoRuntime.queryInterface(XInteractionHandler.class, oHandler); - MasterPasswdHandler aMHandler = new MasterPasswdHandler(xHandler); - XMasterPasswordHandling xMHandling = (XMasterPasswordHandling)UnoRuntime.queryInterface(XMasterPasswordHandling.class, oPasswordContainer); - - // allow the storing of the passwords - xMHandling.allowPersistentStoring(true); - - // add a set of users and passwords for the same URL persistently - for(int i = 0; i < iPersistentUserNum; i++) { - xContainer.addPersistent(sURL, aInputUserList[i].UserName, aInputUserList[i].Passwords, aMHandler); - } - - // add a set of users and passwords for the same URL for runtime - for(int i = 0; i < iRuntimeUserNum; i++) { - xContainer.add(sURL, aInputUserList[i+iPersistentUserNum].UserName, aInputUserList[i+iPersistentUserNum].Passwords, aMHandler); - } - - // get the result for the URL and check that it contains persistent and runtime passwords - UrlRecord aRecord = xContainer.find(sURL, aMHandler); - if(!aRecord.Url.equals(sURL)) { - m_aTestHelper.Error("URL mismatch. Got " + aRecord.Url + "; should be " + sURL); - return false; - } - if(!m_aTestHelper.sameLists(aRecord.UserList, aInputUserList)) { - m_aTestHelper.Error("User list is not the expected"); - return false; - } - - // remove all the persistent passwords - xContainer.removeAllPersistent(); - - // remove the runtime passwords - aRecord = xContainer.find(sURL, aMHandler); - for(int i = 0; i < aRecord.UserList.length; i++) { - xContainer.remove(sURL, aRecord.UserList[i].UserName); - } - - // disallow the storing of the passwords - xMHandling.allowPersistentStoring(false); - }catch(Exception e){ - m_aTestHelper.Error("Exception: " + e); - return false; - } - return true; - } -} diff --git a/svtools/qa/complex/passwordcontainer/TestHelper.java b/svtools/qa/complex/passwordcontainer/TestHelper.java deleted file mode 100644 index 0f83a9ef9963..000000000000 --- a/svtools/qa/complex/passwordcontainer/TestHelper.java +++ /dev/null @@ -1,92 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: TestHelper.java,v $ - * - * $Revision: 1.2 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package complex.passwordcontainer; - -import com.sun.star.task.UserRecord; - -import share.LogWriter; - -public class TestHelper { - LogWriter m_aLogWriter; - String m_sTestPrefix; - - public TestHelper( LogWriter aLogWriter, String sTestPrefix ) { - m_aLogWriter = aLogWriter; - m_sTestPrefix = sTestPrefix; - } - - public void Error( String sError ) { - m_aLogWriter.println( m_sTestPrefix + "Error: " + sError ); - } - - public void Message( String sMessage ) { - m_aLogWriter.println( m_sTestPrefix + sMessage ); - } - - public boolean sameLists(UserRecord aUserList1[], UserRecord aUserList2[]) { - // only works when every name is unique within the list containing it - - if(aUserList1.length != aUserList2.length) { - Message("User list lengths: " + aUserList1.length + " <--> " + aUserList2.length + " respectively "); - return false; - } - - for(int i = 0; i < aUserList1.length; i++) { - int j; - for(j = 0; j < aUserList2.length; j++) { - if(!aUserList1[i].UserName.equals(aUserList2[j].UserName)) - continue; - if(aUserList1[i].Passwords[0].equals(aUserList2[j].Passwords[0])) { - break; - } - } - if(j == aUserList2.length) { - for(int k = 0; k < aUserList1.length; k++) { - Message(aUserList1[k].UserName + " <--> " + aUserList2[i].UserName); - } - return false; - } - } - return true; - } -} - - - - - - - - - - - diff --git a/svtools/qa/complex/passwordcontainer/makefile.mk b/svtools/qa/complex/passwordcontainer/makefile.mk deleted file mode 100644 index 4ce811bd3616..000000000000 --- a/svtools/qa/complex/passwordcontainer/makefile.mk +++ /dev/null @@ -1,91 +0,0 @@ -#************************************************************************* -# -# 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 -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.2.38.1 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ = ..$/..$/.. -TARGET = PasswordContainerUnitTest -PRJNAME = svtools -PACKAGE = complex$/passwordcontainer - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk - - -#----- compile .java files ----------------------------------------- - -JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar - -JAVAFILES =\ - PasswordContainerUnitTest.java\ - PasswordContainerTest.java\ - TestHelper.java\ - Test01.java\ - Test02.java\ - Test03.java\ - MasterPasswdHandler.java - -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - -#----- make a jar from compiled files ------------------------------ - -MAXLINELENGTH = 100000 - -JARCLASSDIRS = $(PACKAGE) -JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE - -# --- Parameters for the test -------------------------------------- - -# start an office if the parameter is set for the makefile -.IF "$(OFFICE)" == "" -CT_APPEXECCOMMAND = -.ELSE -CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;" -.ENDIF - -# test base is java complex -CT_TESTBASE = -TestBase java_complex - -# test looks something like the.full.package.TestName -CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b) - -# start the runner application -CT_APP = org.openoffice.Runner - -# --- Targets ------------------------------------------------------ - -.INCLUDE: target.mk - -RUN: run - -run: - +java -cp $(CLASSPATH) $(CT_APP) $(CT_TESTBASE) $(CT_APPEXECCOMMAND) $(CT_TEST) - - diff --git a/svtools/qa/export.map b/svtools/qa/export.map deleted file mode 100755 index 80373c145ac1..000000000000 --- a/svtools/qa/export.map +++ /dev/null @@ -1,38 +0,0 @@ -#************************************************************************* -# -# 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 -# -# $RCSfile: export.map,v $ -# -# $Revision: 1.4 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -UDK_3_0_0 { - global: - registerAllTestFunction; - - local: - *; -}; diff --git a/svtools/qa/makefile.mk b/svtools/qa/makefile.mk deleted file mode 100644 index c56dc2804a64..000000000000 --- a/svtools/qa/makefile.mk +++ /dev/null @@ -1,103 +0,0 @@ -#************************************************************************* -# -# 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 -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.5 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ = .. -PRJNAME = svtools -TARGET = qa - -ENABLE_EXCEPTIONS = true - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# BEGIN ---------------------------------------------------------------- -# auto generated Target:job by codegen.pl -SHL1OBJS= \ - $(SLO)$/test_URIHelper.obj - -SHL1TARGET= URIHelper -SHL1STDLIBS=\ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(SALLIB) \ - $(SVTOOLLIB) \ - $(TOOLSLIB) \ - $(UNOTOOLSLIB) \ - $(TESTSHL2LIB) \ - $(CPPUNITLIB) - -SHL1IMPLIB= i$(SHL1TARGET) -DEF1NAME =$(SHL1TARGET) -SHL1VERSIONMAP= export.map -# auto generated Target:job -# END ------------------------------------------------------------------ - -#------------------------------- All object files ------------------------------- -# do this here, so we get right dependencies -# SLOFILES=$(SHL1OBJS) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk -.INCLUDE : _cppunit.mk - -# LLA: old stuff -# USE_DEFFILE = true -# -# .INCLUDE: settings.mk -# -# .IF "$(OS)" == "WNT" -# REGEXP = "s/^[\#].*$$//" -# .ELSE # OS, WNT -# REGEXP = 's/^[\#].*$$//' -# .ENDIF # OS, WNT -# -# SHL1TARGET = URIHelper -# SHL1OBJS = \ -# $(SLO)$/test_URIHelper.obj -# SHL1STDLIBS = \ -# $(CPPULIB) \ -# $(CPPUHELPERLIB) \ -# $(SALLIB) \ -# $(SVTOOLLIB) \ -# $(TOOLSLIB) \ -# $(UNOTOOLSLIB) -# -# DEF1NAME = $(SHL1TARGET) -# DEF1EXPORTFILE = $(MISC)$/$(SHL1TARGET).dxp -# -# .INCLUDE: target.mk -# -# $(MISC)$/$(SHL1TARGET).dxp: sce$/$(SHL1TARGET).sce -# + $(TYPE) $< | sed $(REGEXP) > $@ -# + $(TYPE) $@ | sed "s/^/test_/" > $(MISC)$/$(SHL1TARGET).tst -# + $(TYPE) $(MISC)$/$(SHL1TARGET).tst | sed "/test_./ w $@" diff --git a/svtools/qa/test_URIHelper.cxx b/svtools/qa/test_URIHelper.cxx deleted file mode 100644 index a90fbe039b6d..000000000000 --- a/svtools/qa/test_URIHelper.cxx +++ /dev/null @@ -1,462 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: test_URIHelper.cxx,v $ - * $Revision: 1.11 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include "sal/config.h" - -#include - -#include "com/sun/star/lang/Locale.hpp" -#include "com/sun/star/lang/XComponent.hpp" -#include "com/sun/star/lang/XMultiComponentFactory.hpp" -#include "com/sun/star/lang/XMultiServiceFactory.hpp" -#include "com/sun/star/ucb/Command.hpp" -#include "com/sun/star/ucb/CommandAbortedException.hpp" -#include "com/sun/star/ucb/IllegalIdentifierException.hpp" -#include "com/sun/star/ucb/XCommandProcessor.hpp" -#include "com/sun/star/ucb/XContent.hpp" -#include "com/sun/star/ucb/XContentIdentifier.hpp" -#include "com/sun/star/ucb/XContentProvider.hpp" -#include "com/sun/star/ucb/XContentProviderManager.hpp" -#include "com/sun/star/uno/Any.hxx" -#include "com/sun/star/uno/Exception.hpp" -#include "com/sun/star/uno/Reference.hxx" -#include "com/sun/star/uno/RuntimeException.hpp" -#include "com/sun/star/uno/Sequence.hxx" -#include "com/sun/star/uno/XComponentContext.hpp" -#include "com/sun/star/uri/XUriReference.hpp" -#include "cppuhelper/bootstrap.hxx" -#include "cppuhelper/implbase1.hxx" -#include "cppuhelper/implbase2.hxx" -#include "testshl/simpleheader.hxx" -#include "osl/diagnose.h" -#include "rtl/strbuf.hxx" -#include "rtl/string.h" -#include "rtl/string.hxx" -#include "rtl/textenc.h" -#include "rtl/ustring.h" -#include "rtl/ustring.hxx" -#include "sal/types.h" -#include "tools/solar.h" -#include "unotools/charclass.hxx" - -#include "urihelper.hxx" - -// This test needs a UNO component context that supports various services (the -// UCB, an UriReferenceFactory, ...), so it is best executed within an OOo -// installation. - -namespace com { namespace sun { namespace star { namespace ucb { - class XCommandEnvironment; - class XContentEventListener; -} } } } - -namespace { - -namespace css = com::sun::star; - -// This class only implements that subset of functionality of a proper -// css::ucb::Content that is known to be needed here: -class Content: - public cppu::WeakImplHelper2< - css::ucb::XContent, css::ucb::XCommandProcessor > -{ -public: - explicit Content( - css::uno::Reference< css::ucb::XContentIdentifier > const & identifier); - - virtual css::uno::Reference< css::ucb::XContentIdentifier > SAL_CALL - getIdentifier() throw (css::uno::RuntimeException) { - return m_identifier; - } - - virtual rtl::OUString SAL_CALL getContentType() - throw (css::uno::RuntimeException) - { - return rtl::OUString(); - } - - virtual void SAL_CALL addContentEventListener( - css::uno::Reference< css::ucb::XContentEventListener > const &) - throw (css::uno::RuntimeException) - {} - - virtual void SAL_CALL removeContentEventListener( - css::uno::Reference< css::ucb::XContentEventListener > const &) - throw (css::uno::RuntimeException) - {} - - virtual sal_Int32 SAL_CALL createCommandIdentifier() - throw (css::uno::RuntimeException) - { - return 0; - } - - virtual css::uno::Any SAL_CALL execute( - css::ucb::Command const & command, sal_Int32 commandId, - css::uno::Reference< css::ucb::XCommandEnvironment > const &) - throw ( - css::uno::Exception, css::ucb::CommandAbortedException, - css::uno::RuntimeException); - - virtual void SAL_CALL abort(sal_Int32) throw (css::uno::RuntimeException) {} - -private: - static char const m_prefix[]; - - css::uno::Reference< css::ucb::XContentIdentifier > m_identifier; -}; - -char const Content::m_prefix[] = "test:"; - -Content::Content( - css::uno::Reference< css::ucb::XContentIdentifier > const & identifier): - m_identifier(identifier) -{ - OSL_ASSERT(m_identifier.is()); - rtl::OUString uri(m_identifier->getContentIdentifier()); - if (!uri.matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM(m_prefix)) - || uri.indexOf('#', RTL_CONSTASCII_LENGTH(m_prefix)) != -1) - { - throw css::ucb::IllegalIdentifierException(); - } -} - -css::uno::Any Content::execute( - css::ucb::Command const & command, sal_Int32, - css::uno::Reference< css::ucb::XCommandEnvironment > const &) - throw ( - css::uno::Exception, css::ucb::CommandAbortedException, - css::uno::RuntimeException) -{ - if (!command.Name.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM("getCasePreservingURL"))) - { - throw css::uno::RuntimeException(); - } - // If any non-empty segment starts with anything but '0', '1', or '2', fail; - // otherwise, if the last non-empty segment starts with '1', add a final - // slash, and if the last non-empty segment starts with '2', remove a final - // slash (if any); also, turn the given uri into all-lowercase: - rtl::OUString uri(m_identifier->getContentIdentifier()); - sal_Unicode c = '0'; - for (sal_Int32 i = RTL_CONSTASCII_LENGTH(m_prefix); i != -1;) { - rtl::OUString seg(uri.getToken(0, '/', i)); - if (seg.getLength() > 0) { - c = seg[0]; - if (c < '0' || c > '2') { - throw css::uno::Exception(); - } - } - } - switch (c) { - case '1': - uri += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); - break; - case '2': - if (uri.getLength() > 0 && uri[uri.getLength() - 1] == '/') { - uri = uri.copy(0, uri.getLength() -1); - } - break; - } - return css::uno::makeAny(uri.toAsciiLowerCase()); -} - -class Provider: public cppu::WeakImplHelper1< css::ucb::XContentProvider > { -public: - virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent( - css::uno::Reference< css::ucb::XContentIdentifier > const & identifier) - throw (css::ucb::IllegalIdentifierException, css::uno::RuntimeException) - { - return new Content(identifier); - } - - virtual sal_Int32 SAL_CALL compareContentIds( - css::uno::Reference< css::ucb::XContentIdentifier > const & id1, - css::uno::Reference< css::ucb::XContentIdentifier > const & id2) - throw (css::uno::RuntimeException) - { - OSL_ASSERT(id1.is() && id2.is()); - return - id1->getContentIdentifier().compareTo(id2->getContentIdentifier()); - } -}; - -class Test: public CppUnit::TestFixture { -public: - virtual void setUp(); - - void finish(); - - void testNormalizedMakeRelative(); - - void testFindFirstURLInText(); - - CPPUNIT_TEST_SUITE(Test); - CPPUNIT_TEST(testNormalizedMakeRelative); - CPPUNIT_TEST(testFindFirstURLInText); - CPPUNIT_TEST(finish); - CPPUNIT_TEST_SUITE_END(); - -private: - static css::uno::Reference< css::uno::XComponentContext > m_context; -}; - -void Test::setUp() { - // For whatever reason, on W32 it does not work to create/destroy a fresh - // component context for each test in Test::setUp/tearDown; therefore, a - // single component context is used for all tests and destroyed in the last - // pseudo-test "finish": - if (!m_context.is()) { - m_context = cppu::defaultBootstrap_InitialComponentContext(); - } -} - -void Test::finish() { - css::uno::Reference< css::lang::XComponent >( - m_context, css::uno::UNO_QUERY_THROW)->dispose(); -} - -void Test::testNormalizedMakeRelative() { - css::uno::Sequence< css::uno::Any > args(2); - args[0] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Local")); - args[1] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Office")); - css::uno::Reference< css::ucb::XContentProviderManager >( - (css::uno::Reference< css::lang::XMultiComponentFactory >( - m_context->getServiceManager(), css::uno::UNO_QUERY_THROW)-> - createInstanceWithArgumentsAndContext( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.ucb.UniversalContentBroker")), - args, m_context)), - css::uno::UNO_QUERY_THROW)->registerContentProvider( - new Provider, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("test")), - true); - struct Test { - char const * base; - char const * absolute; - char const * relative; - }; - static Test const tests[] = { - { "hierarchical:/", "mailto:def@a.b.c.", "mailto:def@a.b.c." }, - { "hierarchical:/", "a/b/c", "a/b/c" }, - { "hierarchical:/a", "hierarchical:/a/b/c?d#e", "/a/b/c?d#e" }, - { "hierarchical:/a/", "hierarchical:/a/b/c?d#e", "b/c?d#e" }, - { "test:/0/0/a", "test:/0/b", "../b" }, - { "test:/1/1/a", "test:/1/b", "../b" }, - { "test:/2/2//a", "test:/2/b", "../../b" }, - { "test:/0a/b", "test:/0A/c#f", "c#f" }, - { "file:///usr/bin/nonex1/nonex2", - "file:///usr/bin/nonex1/nonex3/nonex4", "nonex3/nonex4" }, - { "file:///usr/bin/nonex1/nonex2#fragmentA", - "file:///usr/bin/nonex1/nonex3/nonex4#fragmentB", - "nonex3/nonex4#fragmentB" }, - { "file:///usr/nonex1/nonex2", "file:///usr/nonex3", "../nonex3" }, - { "file:///c:/windows/nonex1", "file:///c:/nonex2", "../nonex2" }, -#if defined WNT - { "file:///c:/nonex1/nonex2", "file:///C:/nonex1/nonex3/nonex4", - "nonex3/nonex4" } -#endif - }; - for (std::size_t i = 0; i < sizeof tests / sizeof tests[0]; ++i) { - css::uno::Reference< css::uri::XUriReference > ref( - URIHelper::normalizedMakeRelative( - m_context, rtl::OUString::createFromAscii(tests[i].base), - rtl::OUString::createFromAscii(tests[i].absolute))); - bool ok = tests[i].relative == 0 - ? !ref.is() - : ref.is() && ref->getUriReference().equalsAscii(tests[i].relative); - rtl::OString msg; - if (!ok) { - rtl::OStringBuffer buf; - buf.append('<'); - buf.append(tests[i].base); - buf.append(RTL_CONSTASCII_STRINGPARAM(">, <")); - buf.append(tests[i].absolute); - buf.append(RTL_CONSTASCII_STRINGPARAM(">: ")); - if (ref.is()) { - buf.append('<'); - buf.append( - rtl::OUStringToOString( - ref->getUriReference(), RTL_TEXTENCODING_UTF8)); - buf.append('>'); - } else { - buf.append(RTL_CONSTASCII_STRINGPARAM("none")); - } - buf.append(RTL_CONSTASCII_STRINGPARAM(" instead of ")); - if (tests[i].relative == 0) { - buf.append(RTL_CONSTASCII_STRINGPARAM("none")); - } else { - buf.append('<'); - buf.append(tests[i].relative); - buf.append('>'); - } - msg = buf.makeStringAndClear(); - } - CPPUNIT_ASSERT_MESSAGE(msg.getStr(), ok); - } -} - -void Test::testFindFirstURLInText() { - struct Test { - char const * input; - char const * result; - xub_StrLen begin; - xub_StrLen end; - }; - static Test const tests[] = { - { "...ftp://bla.bla.bla/blubber/...", - "ftp://bla.bla.bla/blubber/", 3, 29 }, - { "..\\ftp://bla.bla.bla/blubber/...", 0, 0, 0 }, - { "..\\ftp:\\\\bla.bla.bla\\blubber/...", - "file://bla.bla.bla/blubber%2F", 7, 29 }, - { "http://sun.com", "http://sun.com/", 0, 14 }, - { "http://sun.com/", "http://sun.com/", 0, 15 }, - { "http://www.xerox.com@www.pcworld.com/go/3990332.htm", 0, 0, 0 }, - { "ftp://www.xerox.com@www.pcworld.com/go/3990332.htm", - "ftp://www.xerox.com@www.pcworld.com/go/3990332.htm", 0, 50 }, - { "Version.1.2.3", 0, 0, 0 }, - { "Version:1.2.3", 0, 0, 0 }, - { "a.b.c", 0, 0, 0 }, - { "file:///a|...", "file:///a:", 0, 10 }, - { "file:///a||...", "file:///a%7C%7C", 0, 11 }, - { "file:///a|/bc#...", "file:///a:/bc", 0, 13 }, - { "file:///a|/bc#de...", "file:///a:/bc#de", 0, 16 }, - { "abc.def.ghi,ftp.xxx.yyy/zzz...", "ftp://ftp.xxx.yyy/zzz", 12, 27 }, - { "abc.def.ghi,Ftp.xxx.yyy/zzz...", "ftp://Ftp.xxx.yyy/zzz", 12, 27 }, - { "abc.def.ghi,www.xxx.yyy...", "http://www.xxx.yyy/", 12, 23 }, - { "abc.def.ghi,wwww.xxx.yyy...", 0, 0, 0 }, - { "abc.def.ghi,wWW.xxx.yyy...", "http://wWW.xxx.yyy/", 12, 23 }, - { "Bla {mailto.me@abc.def.g.h.i}...", - "mailto:%7Bmailto.me@abc.def.g.h.i", 4, 28 }, - { "abc@def@ghi", 0, 0, 0 }, - { "lala@sun.com", "mailto:lala@sun.com", 0, 12 }, - { "1lala@sun.com", "mailto:1lala@sun.com", 0, 13 }, - { "aaa_bbb@xxx.yy", "mailto:aaa_bbb@xxx.yy", 0, 14 }, - { "{a:\\bla/bla/bla...}", "file:///a:/bla/bla/bla", 1, 15 }, - { "#b:/c/d#e#f#", "file:///b:/c/d", 1, 7 }, - { "a:/", "file:///a:/", 0, 3 }, - { ".component:", 0, 0, 0 }, - { ".uno:", 0, 0, 0 }, - { "cid:", 0, 0, 0 }, - { "data:", 0, 0, 0 }, - { "db:", 0, 0, 0 }, - { "file:", 0, 0, 0 }, - { "ftp:", 0, 0, 0 }, - { "http:", 0, 0, 0 }, - { "https:", 0, 0, 0 }, - { "imap:", 0, 0, 0 }, - { "javascript:", 0, 0, 0 }, - { "ldap:", 0, 0, 0 }, - { "macro:", 0, 0, 0 }, - { "mailto:", 0, 0, 0 }, - { "news:", 0, 0, 0 }, - { "out:", 0, 0, 0 }, - { "pop3:", 0, 0, 0 }, - { "private:", 0, 0, 0 }, - { "slot:", 0, 0, 0 }, - { "staroffice.component:", 0, 0, 0 }, - { "staroffice.db:", 0, 0, 0 }, - { "staroffice.factory:", 0, 0, 0 }, - { "staroffice.helpid:", 0, 0, 0 }, - { "staroffice.java:", 0, 0, 0 }, - { "staroffice.macro:", 0, 0, 0 }, - { "staroffice.out:", 0, 0, 0 }, - { "staroffice.pop3:", 0, 0, 0 }, - { "staroffice.private:", 0, 0, 0 }, - { "staroffice.searchfolder:", 0, 0, 0 }, - { "staroffice.slot:", 0, 0, 0 }, - { "staroffice.trashcan:", 0, 0, 0 }, - { "staroffice.uno:", 0, 0, 0 }, - { "staroffice.vim:", 0, 0, 0 }, - { "staroffice:", 0, 0, 0 }, - { "vim:", 0, 0, 0 }, - { "vnd.sun.star.cmd:", 0, 0, 0 }, - { "vnd.sun.star.help:", 0, 0, 0 }, - { "vnd.sun.star.hier:", 0, 0, 0 }, - { "vnd.sun.star.odma:", 0, 0, 0 }, - { "vnd.sun.star.pkg:", 0, 0, 0 }, - { "vnd.sun.star.script:", 0, 0, 0 }, - { "vnd.sun.star.webdav:", 0, 0, 0 }, - { "vnd.sun.star.wfs:", 0, 0, 0 }, - { "generic:path", 0, 0, 0 }, - { "wfs:", 0, 0, 0 } - }; - CharClass charClass( - css::uno::Reference< css::lang::XMultiServiceFactory >( - m_context->getServiceManager(), css::uno::UNO_QUERY_THROW), - com::sun::star::lang::Locale( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en")), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("US")), rtl::OUString())); - for (std::size_t i = 0; i < sizeof tests / sizeof tests[0]; ++i) { - rtl::OUString input(rtl::OUString::createFromAscii(tests[i].input)); - xub_StrLen begin = 0; - xub_StrLen end = static_cast< xub_StrLen >(input.getLength()); - rtl::OUString result( - URIHelper::FindFirstURLInText(input, begin, end, charClass)); - bool ok = tests[i].result == 0 - ? (result.getLength() == 0 && begin == input.getLength() - && end == input.getLength()) - : (result.equalsAscii(tests[i].result) && begin == tests[i].begin - && end == tests[i].end); - rtl::OString msg; - if (!ok) { - rtl::OStringBuffer buf; - buf.append('"'); - buf.append(tests[i].input); - buf.append(RTL_CONSTASCII_STRINGPARAM("\" -> ")); - buf.append(tests[i].result == 0 ? "none" : tests[i].result); - buf.append(RTL_CONSTASCII_STRINGPARAM(" (")); - buf.append(static_cast< sal_Int32 >(tests[i].begin)); - buf.append(RTL_CONSTASCII_STRINGPARAM(", ")); - buf.append(static_cast< sal_Int32 >(tests[i].end)); - buf.append(')'); - buf.append(RTL_CONSTASCII_STRINGPARAM(" != ")); - buf.append(rtl::OUStringToOString(result, RTL_TEXTENCODING_UTF8)); - buf.append(RTL_CONSTASCII_STRINGPARAM(" (")); - buf.append(static_cast< sal_Int32 >(begin)); - buf.append(RTL_CONSTASCII_STRINGPARAM(", ")); - buf.append(static_cast< sal_Int32 >(end)); - buf.append(')'); - msg = buf.makeStringAndClear(); - } - CPPUNIT_ASSERT_MESSAGE(msg.getStr(), ok); - } -} - -css::uno::Reference< css::uno::XComponentContext > Test::m_context; - -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests"); - -} - -NOADDITIONAL; diff --git a/svtools/source/config/cjkoptions.cxx b/svtools/source/config/cjkoptions.cxx deleted file mode 100644 index 66d70cd1e2a3..000000000000 --- a/svtools/source/config/cjkoptions.cxx +++ /dev/null @@ -1,510 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: cjkoptions.cxx,v $ - * $Revision: 1.22 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace ::com::sun::star::uno; -using namespace ::rtl; - -#define C2U(cChar) OUString::createFromAscii(cChar) -#define CFG_READONLY_DEFAULT sal_False -/* -----------------------------10.04.01 12:39-------------------------------- - - ---------------------------------------------------------------------------*/ -class SvtCJKOptions_Impl : public utl::ConfigItem -{ - sal_Bool bIsLoaded; - sal_Bool bCJKFont; - sal_Bool bVerticalText; - sal_Bool bAsianTypography; - sal_Bool bJapaneseFind; - sal_Bool bRuby; - sal_Bool bChangeCaseMap; - sal_Bool bDoubleLines; - sal_Bool bEmphasisMarks; - sal_Bool bVerticalCallOut; - - sal_Bool bROCJKFont; - sal_Bool bROVerticalText; - sal_Bool bROAsianTypography; - sal_Bool bROJapaneseFind; - sal_Bool bRORuby; - sal_Bool bROChangeCaseMap; - sal_Bool bRODoubleLines; - sal_Bool bROEmphasisMarks; - sal_Bool bROVerticalCallOut; - -public: - SvtCJKOptions_Impl(); - ~SvtCJKOptions_Impl(); - - virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames ); - virtual void Commit(); - void Load(); - - sal_Bool IsLoaded() { return bIsLoaded; } - - sal_Bool IsCJKFontEnabled() const { return bCJKFont; } - sal_Bool IsVerticalTextEnabled() const { return bVerticalText; } - sal_Bool IsAsianTypographyEnabled() const { return bAsianTypography; } - sal_Bool IsJapaneseFindEnabled() const { return bJapaneseFind; } - sal_Bool IsRubyEnabled() const { return bRuby; } - sal_Bool IsChangeCaseMapEnabled() const { return bChangeCaseMap; } - sal_Bool IsDoubleLinesEnabled() const { return bDoubleLines; } - sal_Bool IsEmphasisMarksEnabled() const { return bEmphasisMarks; } - sal_Bool IsVerticalCallOutEnabled() const { return bVerticalCallOut; } - - sal_Bool IsAnyEnabled() const { - return bCJKFont||bVerticalText||bAsianTypography||bJapaneseFind|| - bRuby||bChangeCaseMap||bDoubleLines||bEmphasisMarks||bVerticalCallOut; } - void SetAll(sal_Bool bSet); - sal_Bool IsReadOnly(SvtCJKOptions::EOption eOption) const; -}; -/*-- 10.04.01 12:41:57--------------------------------------------------- - - -----------------------------------------------------------------------*/ -namespace -{ - struct PropertyNames - : public rtl::Static< Sequence, PropertyNames > {}; -} - -SvtCJKOptions_Impl::SvtCJKOptions_Impl() : - utl::ConfigItem(C2U("Office.Common/I18N/CJK")), - bIsLoaded(sal_False), - bCJKFont(sal_True), - bVerticalText(sal_True), - bAsianTypography(sal_True), - bJapaneseFind(sal_True), - bRuby(sal_True), - bChangeCaseMap(sal_True), - bDoubleLines(sal_True), - bEmphasisMarks(sal_True), - bVerticalCallOut(sal_True), - bROCJKFont(CFG_READONLY_DEFAULT), - bROVerticalText(CFG_READONLY_DEFAULT), - bROAsianTypography(CFG_READONLY_DEFAULT), - bROJapaneseFind(CFG_READONLY_DEFAULT), - bRORuby(CFG_READONLY_DEFAULT), - bROChangeCaseMap(CFG_READONLY_DEFAULT), - bRODoubleLines(CFG_READONLY_DEFAULT), - bROEmphasisMarks(CFG_READONLY_DEFAULT), - bROVerticalCallOut(CFG_READONLY_DEFAULT) -{ -} -/*-- 10.04.01 12:41:57--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SvtCJKOptions_Impl::~SvtCJKOptions_Impl() -{ -} -/* -----------------------------20.04.01 14:34-------------------------------- - - ---------------------------------------------------------------------------*/ -void SvtCJKOptions_Impl::SetAll(sal_Bool bSet) -{ - if ( - !bROCJKFont && - !bROVerticalText && - !bROAsianTypography && - !bROJapaneseFind && - !bRORuby && - !bROChangeCaseMap && - !bRODoubleLines && - !bROEmphasisMarks && - !bROVerticalCallOut - ) - { - bCJKFont=bSet; - bVerticalText=bSet; - bAsianTypography=bSet; - bJapaneseFind=bSet; - bRuby=bSet; - bChangeCaseMap=bSet; - bDoubleLines=bSet; - bEmphasisMarks=bSet; - bVerticalCallOut=bSet; - - SetModified(); - Commit(); - } -} -/*-- 10.04.01 12:41:56--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SvtCJKOptions_Impl::Load() -{ - Sequence &rPropertyNames = PropertyNames::get(); - if(!rPropertyNames.getLength()) - { - rPropertyNames.realloc(9); - OUString* pNames = rPropertyNames.getArray(); - - pNames[0] = C2U("CJKFont"); - pNames[1] = C2U("VerticalText"); - pNames[2] = C2U("AsianTypography"); - pNames[3] = C2U("JapaneseFind"); - pNames[4] = C2U("Ruby"); - pNames[5] = C2U("ChangeCaseMap"); - pNames[6] = C2U("DoubleLines"); - pNames[7] = C2U("EmphasisMarks"); - pNames[8] = C2U("VerticalCallOut"); - - EnableNotification( rPropertyNames ); - } - Sequence< Any > aValues = GetProperties(rPropertyNames); - Sequence< sal_Bool > aROStates = GetReadOnlyStates(rPropertyNames); - const Any* pValues = aValues.getConstArray(); - const sal_Bool* pROStates = aROStates.getConstArray(); - DBG_ASSERT( aValues.getLength() == rPropertyNames.getLength(), "GetProperties failed" ); - DBG_ASSERT( aROStates.getLength() == rPropertyNames.getLength(), "GetReadOnlyStates failed" ); - if ( aValues.getLength() == rPropertyNames.getLength() && aROStates.getLength() == rPropertyNames.getLength() ) - { - for ( int nProp = 0; nProp < rPropertyNames.getLength(); nProp++ ) - { - if( pValues[nProp].hasValue() ) - { - sal_Bool bValue = *(sal_Bool*)pValues[nProp].getValue(); - switch ( nProp ) - { - case 0: { bCJKFont = bValue; bROCJKFont = pROStates[nProp]; } break; - case 1: { bVerticalText = bValue; bROVerticalText = pROStates[nProp]; } break; - case 2: { bAsianTypography = bValue; bROAsianTypography = pROStates[nProp]; } break; - case 3: { bJapaneseFind = bValue; bROJapaneseFind = pROStates[nProp]; } break; - case 4: { bRuby = bValue; bRORuby = pROStates[nProp]; } break; - case 5: { bChangeCaseMap = bValue; bROChangeCaseMap = pROStates[nProp]; } break; - case 6: { bDoubleLines = bValue; bRODoubleLines = pROStates[nProp]; } break; - case 7: { bEmphasisMarks = bValue; bROEmphasisMarks = pROStates[nProp]; } break; - case 8: { bVerticalCallOut = bValue; bROVerticalCallOut = pROStates[nProp]; } break; - } - } - } - } - - SvtSystemLanguageOptions aSystemLocaleSettings; - LanguageType eSystemLanguage = aSystemLocaleSettings.GetWin16SystemLanguage(); - sal_uInt16 nWinScript = SvtLanguageOptions::GetScriptTypeOfLanguage( eSystemLanguage ); - - sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage(LANGUAGE_SYSTEM); - if ( !bCJKFont && (( nScriptType & SCRIPTTYPE_ASIAN )|| - ((eSystemLanguage != LANGUAGE_SYSTEM) && ( nWinScript & SCRIPTTYPE_ASIAN )))) - { - SetAll(sal_True); - } - bIsLoaded = sal_True; -} -/*-- 10.04.01 12:41:57--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SvtCJKOptions_Impl::Notify( const Sequence< OUString >& ) -{ - Load(); -} -/*-- 10.04.01 12:41:57--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SvtCJKOptions_Impl::Commit() -{ - Sequence &rPropertyNames = PropertyNames::get(); - OUString* pOrgNames = rPropertyNames.getArray(); - sal_Int32 nOrgCount = rPropertyNames.getLength(); - - Sequence< OUString > aNames(nOrgCount); - Sequence< Any > aValues(nOrgCount); - - OUString* pNames = aNames.getArray(); - Any* pValues = aValues.getArray(); - sal_Int32 nRealCount = 0; - - const Type& rType = ::getBooleanCppuType(); - for(int nProp = 0; nProp < nOrgCount; nProp++) - { - switch(nProp) - { - case 0: - { - if (!bROCJKFont) - { - pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue(&bCJKFont, rType); - ++nRealCount; - } - } - break; - - case 1: - { - if (!bROVerticalText) - { - pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue(&bVerticalText, rType); - ++nRealCount; - } - } - break; - - case 2: - { - if (!bROAsianTypography) - { - pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue(&bAsianTypography, rType); - ++nRealCount; - } - } - break; - - case 3: - { - if (!bROJapaneseFind) - { - pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue(&bJapaneseFind, rType); - ++nRealCount; - } - } - break; - - case 4: - { - if (!bRORuby) - { - pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue(&bRuby, rType); - ++nRealCount; - } - } - break; - - case 5: - { - if (!bROChangeCaseMap) - { - pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue(&bChangeCaseMap, rType); - ++nRealCount; - } - } - break; - - case 6: - { - if (!bRODoubleLines) - { - pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue(&bDoubleLines, rType); - ++nRealCount; - } - } - break; - - case 7: - { - if (!bROEmphasisMarks) - { - pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue(&bEmphasisMarks, rType); - ++nRealCount; - } - } - break; - - case 8: - { - if (!bROVerticalCallOut) - { - pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue(&bVerticalCallOut, rType); - ++nRealCount; - } - } - break; - } - } - aNames.realloc(nRealCount); - aValues.realloc(nRealCount); - PutProperties(aNames, aValues); -} -/*-- 13.02.2003 12:12--------------------------------------------------- - - -----------------------------------------------------------------------*/ -sal_Bool SvtCJKOptions_Impl::IsReadOnly(SvtCJKOptions::EOption eOption) const -{ - sal_Bool bReadOnly = CFG_READONLY_DEFAULT; - switch(eOption) - { - case SvtCJKOptions::E_CJKFONT : bReadOnly = bROCJKFont; break; - case SvtCJKOptions::E_VERTICALTEXT : bReadOnly = bROVerticalText; break; - case SvtCJKOptions::E_ASIANTYPOGRAPHY : bReadOnly = bROAsianTypography; break; - case SvtCJKOptions::E_JAPANESEFIND : bReadOnly = bROJapaneseFind; break; - case SvtCJKOptions::E_RUBY : bReadOnly = bRORuby; break; - case SvtCJKOptions::E_CHANGECASEMAP : bReadOnly = bROChangeCaseMap; break; - case SvtCJKOptions::E_DOUBLELINES : bReadOnly = bRODoubleLines; break; - case SvtCJKOptions::E_EMPHASISMARKS : bReadOnly = bROEmphasisMarks; break; - case SvtCJKOptions::E_VERTICALCALLOUT : bReadOnly = bROVerticalCallOut; break; - case SvtCJKOptions::E_ALL : if (bROCJKFont || bROVerticalText || bROAsianTypography || bROJapaneseFind || bRORuby || bROChangeCaseMap || bRODoubleLines || bROEmphasisMarks || bROVerticalCallOut) - bReadOnly = sal_True; - break; - } - return bReadOnly; -} - -// global ---------------------------------------------------------------- - -static SvtCJKOptions_Impl* pCJKOptions = NULL; -static sal_Int32 nCJKRefCount = 0; -namespace { struct CJKMutex : public rtl::Static< ::osl::Mutex , CJKMutex >{}; } - - -// class SvtCJKOptions -------------------------------------------------- - -SvtCJKOptions::SvtCJKOptions(sal_Bool bDontLoad) -{ - // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( CJKMutex::get() ); - if ( !pCJKOptions ) - { - pCJKOptions = new SvtCJKOptions_Impl; - ItemHolder2::holdConfigItem(E_CJKOPTIONS); - } - if( !bDontLoad && !pCJKOptions->IsLoaded()) - pCJKOptions->Load(); - - ++nCJKRefCount; - pImp = pCJKOptions; -} - -// ----------------------------------------------------------------------- - -SvtCJKOptions::~SvtCJKOptions() -{ - // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( CJKMutex::get() ); - if ( !--nCJKRefCount ) - DELETEZ( pCJKOptions ); -} -// ----------------------------------------------------------------------- -sal_Bool SvtCJKOptions::IsCJKFontEnabled() const -{ - DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); - return pCJKOptions->IsCJKFontEnabled(); -} -// ----------------------------------------------------------------------- -sal_Bool SvtCJKOptions::IsVerticalTextEnabled() const -{ - DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); - return pCJKOptions->IsVerticalTextEnabled(); -} -// ----------------------------------------------------------------------- -sal_Bool SvtCJKOptions::IsAsianTypographyEnabled() const -{ - DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); - return pCJKOptions->IsAsianTypographyEnabled(); -} -// ----------------------------------------------------------------------- -sal_Bool SvtCJKOptions::IsJapaneseFindEnabled() const -{ - DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); - return pCJKOptions->IsJapaneseFindEnabled(); -} -// ----------------------------------------------------------------------- -sal_Bool SvtCJKOptions::IsRubyEnabled() const -{ - DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); - return pCJKOptions->IsRubyEnabled(); -} -// ----------------------------------------------------------------------- -sal_Bool SvtCJKOptions::IsChangeCaseMapEnabled() const -{ - DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); - return pCJKOptions->IsChangeCaseMapEnabled(); -} -// ----------------------------------------------------------------------- -sal_Bool SvtCJKOptions::IsDoubleLinesEnabled() const -{ - DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); - return pCJKOptions->IsDoubleLinesEnabled(); -} -// ----------------------------------------------------------------------- -sal_Bool SvtCJKOptions::IsEmphasisMarksEnabled() const -{ - DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); - return pCJKOptions->IsEmphasisMarksEnabled(); -} -// ----------------------------------------------------------------------- -sal_Bool SvtCJKOptions::IsVerticalCallOutEnabled() const -{ - DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); - return pCJKOptions->IsVerticalCallOutEnabled(); -} -/*-- 20.04.01 14:32:04--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SvtCJKOptions::SetAll(sal_Bool bSet) -{ - DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); - pCJKOptions->SetAll(bSet); -} -/*-- 20.04.01 14:32:06--------------------------------------------------- - - -----------------------------------------------------------------------*/ -sal_Bool SvtCJKOptions::IsAnyEnabled() const -{ - DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); - return pCJKOptions->IsAnyEnabled(); -} -/*-- 13.02.2003 12:11--------------------------------------------------- - - -----------------------------------------------------------------------*/ -sal_Bool SvtCJKOptions::IsReadOnly(EOption eOption) const -{ - DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); - return pCJKOptions->IsReadOnly(eOption); -} - diff --git a/svtools/source/config/ctloptions.cxx b/svtools/source/config/ctloptions.cxx deleted file mode 100644 index 5d2bf131add1..000000000000 --- a/svtools/source/config/ctloptions.cxx +++ /dev/null @@ -1,503 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ctloptions.cxx,v $ - * $Revision: 1.18.140.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; - -#define ASCII_STR(s) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(s) ) -#define CFG_READONLY_DEFAULT sal_False - -// SvtCJKOptions_Impl ---------------------------------------------------------- - -class SvtCTLOptions_Impl : public utl::ConfigItem, public SfxBroadcaster -{ -private: - sal_Bool m_bIsLoaded; - sal_Bool m_bCTLFontEnabled; - sal_Bool m_bCTLSequenceChecking; - sal_Bool m_bCTLRestricted; - sal_Bool m_bCTLTypeAndReplace; - SvtCTLOptions::CursorMovement m_eCTLCursorMovement; - SvtCTLOptions::TextNumerals m_eCTLTextNumerals; - - sal_Bool m_bROCTLFontEnabled; - sal_Bool m_bROCTLSequenceChecking; - sal_Bool m_bROCTLRestricted; - sal_Bool m_bROCTLTypeAndReplace; - sal_Bool m_bROCTLCursorMovement; - sal_Bool m_bROCTLTextNumerals; - -public: - SvtCTLOptions_Impl(); - ~SvtCTLOptions_Impl(); - - virtual void Notify( const Sequence< rtl::OUString >& _aPropertyNames ); - virtual void Commit(); - void Load(); - - sal_Bool IsLoaded() { return m_bIsLoaded; } - void SetCTLFontEnabled( sal_Bool _bEnabled ); - sal_Bool IsCTLFontEnabled() const { return m_bCTLFontEnabled; } - - void SetCTLSequenceChecking( sal_Bool _bEnabled ); - sal_Bool IsCTLSequenceChecking() const { return m_bCTLSequenceChecking;} - - void SetCTLSequenceCheckingRestricted( sal_Bool _bEnable ); - sal_Bool IsCTLSequenceCheckingRestricted( void ) const { return m_bCTLRestricted; } - - void SetCTLSequenceCheckingTypeAndReplace( sal_Bool _bEnable ); - sal_Bool IsCTLSequenceCheckingTypeAndReplace() const { return m_bCTLTypeAndReplace; } - - void SetCTLCursorMovement( SvtCTLOptions::CursorMovement _eMovement ); - SvtCTLOptions::CursorMovement - GetCTLCursorMovement() const { return m_eCTLCursorMovement; } - - void SetCTLTextNumerals( SvtCTLOptions::TextNumerals _eNumerals ); - SvtCTLOptions::TextNumerals - GetCTLTextNumerals() const { return m_eCTLTextNumerals; } - - sal_Bool IsReadOnly(SvtCTLOptions::EOption eOption) const; -}; -//------------------------------------------------------------------------------ -namespace -{ - struct PropertyNames - : public rtl::Static< Sequence< rtl::OUString >, PropertyNames > {}; -} -//------------------------------------------------------------------------------ -sal_Bool SvtCTLOptions_Impl::IsReadOnly(SvtCTLOptions::EOption eOption) const -{ - sal_Bool bReadOnly = CFG_READONLY_DEFAULT; - switch(eOption) - { - case SvtCTLOptions::E_CTLFONT : bReadOnly = m_bROCTLFontEnabled ; break; - case SvtCTLOptions::E_CTLSEQUENCECHECKING : bReadOnly = m_bROCTLSequenceChecking ; break; - case SvtCTLOptions::E_CTLCURSORMOVEMENT : bReadOnly = m_bROCTLCursorMovement ; break; - case SvtCTLOptions::E_CTLTEXTNUMERALS : bReadOnly = m_bROCTLTextNumerals ; break; - case SvtCTLOptions::E_CTLSEQUENCECHECKINGRESTRICTED: bReadOnly = m_bROCTLRestricted ; break; - case SvtCTLOptions::E_CTLSEQUENCECHECKINGTYPEANDREPLACE: bReadOnly = m_bROCTLTypeAndReplace; break; - default: DBG_ERROR( "SvtCTLOptions_Impl::IsReadOnly() - invalid option" ); - } - return bReadOnly; -} -//------------------------------------------------------------------------------ -SvtCTLOptions_Impl::SvtCTLOptions_Impl() : - - utl::ConfigItem( ASCII_STR("Office.Common/I18N/CTL") ), - - m_bIsLoaded ( sal_False ), - m_bCTLFontEnabled ( sal_False ), - m_bCTLSequenceChecking ( sal_False ), - m_bCTLRestricted ( sal_False ), - m_eCTLCursorMovement ( SvtCTLOptions::MOVEMENT_LOGICAL ), - m_eCTLTextNumerals ( SvtCTLOptions::NUMERALS_ARABIC ), - - m_bROCTLFontEnabled ( CFG_READONLY_DEFAULT ), - m_bROCTLSequenceChecking( CFG_READONLY_DEFAULT ), - m_bROCTLRestricted ( CFG_READONLY_DEFAULT ), - m_bROCTLCursorMovement ( CFG_READONLY_DEFAULT ), - m_bROCTLTextNumerals ( CFG_READONLY_DEFAULT ) -{ -} -//------------------------------------------------------------------------------ -SvtCTLOptions_Impl::~SvtCTLOptions_Impl() -{ - if ( IsModified() == sal_True ) - Commit(); -} -// ----------------------------------------------------------------------------- -void SvtCTLOptions_Impl::Notify( const Sequence< rtl::OUString >& ) -{ - Load(); - Broadcast(SfxSimpleHint(SFX_HINT_CTL_SETTINGS_CHANGED)); -} -// ----------------------------------------------------------------------------- -void SvtCTLOptions_Impl::Commit() -{ - Sequence< rtl::OUString > &rPropertyNames = PropertyNames::get(); - rtl::OUString* pOrgNames = rPropertyNames.getArray(); - sal_Int32 nOrgCount = rPropertyNames.getLength(); - - Sequence< rtl::OUString > aNames( nOrgCount ); - Sequence< Any > aValues( nOrgCount ); - - rtl::OUString* pNames = aNames.getArray(); - Any* pValues = aValues.getArray(); - sal_Int32 nRealCount = 0; - - const uno::Type& rType = ::getBooleanCppuType(); - - for ( int nProp = 0; nProp < nOrgCount; nProp++ ) - { - switch ( nProp ) - { - case 0: - { - if (!m_bROCTLFontEnabled) - { - pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue( &m_bCTLFontEnabled, rType ); - ++nRealCount; - } - } - break; - - case 1: - { - if (!m_bROCTLSequenceChecking) - { - pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue( &m_bCTLSequenceChecking, rType ); - ++nRealCount; - } - } - break; - - case 2: - { - if (!m_bROCTLCursorMovement) - { - pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount] <<= (sal_Int32)m_eCTLCursorMovement; - ++nRealCount; - } - } - break; - - case 3: - { - if (!m_bROCTLTextNumerals) - { - pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount] <<= (sal_Int32)m_eCTLTextNumerals; - ++nRealCount; - } - } - break; - - case 4: - { - if (!m_bROCTLRestricted) - { - pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue( &m_bCTLRestricted, rType ); - ++nRealCount; - } - } - break; - case 5: - { - if(!m_bROCTLTypeAndReplace) - { - pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount].setValue( &m_bCTLTypeAndReplace, rType ); - ++nRealCount; - } - } - break; - } - } - aNames.realloc(nRealCount); - aValues.realloc(nRealCount); - PutProperties( aNames, aValues ); - //broadcast changes - Broadcast(SfxSimpleHint(SFX_HINT_CTL_SETTINGS_CHANGED)); -} -// ----------------------------------------------------------------------------- -void SvtCTLOptions_Impl::Load() -{ - Sequence< rtl::OUString >& rPropertyNames = PropertyNames::get(); - if ( !rPropertyNames.getLength() ) - { - rPropertyNames.realloc(6); - rtl::OUString* pNames = rPropertyNames.getArray(); - pNames[0] = ASCII_STR("CTLFont"); - pNames[1] = ASCII_STR("CTLSequenceChecking"); - pNames[2] = ASCII_STR("CTLCursorMovement"); - pNames[3] = ASCII_STR("CTLTextNumerals"); - pNames[4] = ASCII_STR("CTLSequenceCheckingRestricted"); - pNames[5] = ASCII_STR("CTLSequenceCheckingTypeAndReplace"); - EnableNotification( rPropertyNames ); - } - Sequence< Any > aValues = GetProperties( rPropertyNames ); - Sequence< sal_Bool > aROStates = GetReadOnlyStates( rPropertyNames ); - const Any* pValues = aValues.getConstArray(); - const sal_Bool* pROStates = aROStates.getConstArray(); - DBG_ASSERT( aValues.getLength() == rPropertyNames.getLength(), "GetProperties failed" ); - DBG_ASSERT( aROStates.getLength() == rPropertyNames.getLength(), "GetReadOnlyStates failed" ); - if ( aValues.getLength() == rPropertyNames.getLength() && aROStates.getLength() == rPropertyNames.getLength() ) - { - sal_Bool bValue = sal_False; - sal_Int32 nValue = 0; - - for ( int nProp = 0; nProp < rPropertyNames.getLength(); nProp++ ) - { - if ( pValues[nProp].hasValue() ) - { - if ( pValues[nProp] >>= bValue ) - { - switch ( nProp ) - { - case 0: { m_bCTLFontEnabled = bValue; m_bROCTLFontEnabled = pROStates[nProp]; } break; - case 1: { m_bCTLSequenceChecking = bValue; m_bROCTLSequenceChecking = pROStates[nProp]; } break; - case 4: { m_bCTLRestricted = bValue; m_bROCTLRestricted = pROStates[nProp]; } break; - case 5: { m_bCTLTypeAndReplace = bValue; m_bROCTLTypeAndReplace = pROStates[nProp]; } break; - } - } - else if ( pValues[nProp] >>= nValue ) - { - switch ( nProp ) - { - case 2: { m_eCTLCursorMovement = (SvtCTLOptions::CursorMovement)nValue; m_bROCTLCursorMovement = pROStates[nProp]; } break; - case 3: { m_eCTLTextNumerals = (SvtCTLOptions::TextNumerals)nValue; m_bROCTLTextNumerals = pROStates[nProp]; } break; - } - } - } - } - } - sal_uInt16 nType = SvtLanguageOptions::GetScriptTypeOfLanguage(LANGUAGE_SYSTEM); - SvtSystemLanguageOptions aSystemLocaleSettings; - LanguageType eSystemLanguage = aSystemLocaleSettings.GetWin16SystemLanguage(); - sal_uInt16 nWinScript = SvtLanguageOptions::GetScriptTypeOfLanguage( eSystemLanguage ); - if( !m_bCTLFontEnabled && (( nType & SCRIPTTYPE_COMPLEX ) || - ((eSystemLanguage != LANGUAGE_SYSTEM) && ( nWinScript & SCRIPTTYPE_COMPLEX ))) ) - { - m_bCTLFontEnabled = sal_True; - sal_uInt16 nLanguage = Application::GetSettings().GetLanguage(); - //enable sequence checking for the appropriate languages - m_bCTLSequenceChecking = m_bCTLRestricted = m_bCTLTypeAndReplace = - (MsLangId::needsSequenceChecking( nLanguage) || - MsLangId::needsSequenceChecking( eSystemLanguage)); - Commit(); - } - m_bIsLoaded = sal_True; -} -//------------------------------------------------------------------------------ -void SvtCTLOptions_Impl::SetCTLFontEnabled( sal_Bool _bEnabled ) -{ - if(!m_bROCTLFontEnabled && m_bCTLFontEnabled != _bEnabled) - { - m_bCTLFontEnabled = _bEnabled; - SetModified(); - } -} -//------------------------------------------------------------------------------ -void SvtCTLOptions_Impl::SetCTLSequenceChecking( sal_Bool _bEnabled ) -{ - if(!m_bROCTLSequenceChecking && m_bCTLSequenceChecking != _bEnabled) - { - SetModified(); - m_bCTLSequenceChecking = _bEnabled; - } -} -//------------------------------------------------------------------------------ -void SvtCTLOptions_Impl::SetCTLSequenceCheckingRestricted( sal_Bool _bEnabled ) -{ - if(!m_bROCTLRestricted && m_bCTLRestricted != _bEnabled) - { - SetModified(); - m_bCTLRestricted = _bEnabled; - } -} -//------------------------------------------------------------------------------ -void SvtCTLOptions_Impl::SetCTLSequenceCheckingTypeAndReplace( sal_Bool _bEnabled ) -{ - if(!m_bROCTLTypeAndReplace && m_bCTLTypeAndReplace != _bEnabled) - { - SetModified(); - m_bCTLTypeAndReplace = _bEnabled; - } -} -//------------------------------------------------------------------------------ -void SvtCTLOptions_Impl::SetCTLCursorMovement( SvtCTLOptions::CursorMovement _eMovement ) -{ - if (!m_bROCTLCursorMovement && m_eCTLCursorMovement != _eMovement ) - { - SetModified(); - m_eCTLCursorMovement = _eMovement; - } -} -//------------------------------------------------------------------------------ -void SvtCTLOptions_Impl::SetCTLTextNumerals( SvtCTLOptions::TextNumerals _eNumerals ) -{ - if (!m_bROCTLTextNumerals && m_eCTLTextNumerals != _eNumerals ) - { - SetModified(); - m_eCTLTextNumerals = _eNumerals; - } -} -// global ---------------------------------------------------------------- - -static SvtCTLOptions_Impl* pCTLOptions = NULL; -static sal_Int32 nCTLRefCount = 0; -namespace { struct CTLMutex : public rtl::Static< osl::Mutex, CTLMutex > {}; } - -// class SvtCTLOptions -------------------------------------------------- - -SvtCTLOptions::SvtCTLOptions( sal_Bool bDontLoad ) -{ - // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( CTLMutex::get() ); - if ( !pCTLOptions ) - { - pCTLOptions = new SvtCTLOptions_Impl; - ItemHolder2::holdConfigItem(E_CTLOPTIONS); - } - if( !bDontLoad && !pCTLOptions->IsLoaded() ) - pCTLOptions->Load(); - - ++nCTLRefCount; - m_pImp = pCTLOptions; - StartListening( *m_pImp); -} - -// ----------------------------------------------------------------------- - -SvtCTLOptions::~SvtCTLOptions() -{ - // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( CTLMutex::get() ); - - if ( !--nCTLRefCount ) - DELETEZ( pCTLOptions ); -} -// ----------------------------------------------------------------------------- -void SvtCTLOptions::SetCTLFontEnabled( sal_Bool _bEnabled ) -{ - DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); - pCTLOptions->SetCTLFontEnabled( _bEnabled ); -} -// ----------------------------------------------------------------------------- -sal_Bool SvtCTLOptions::IsCTLFontEnabled() const -{ - DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); - return pCTLOptions->IsCTLFontEnabled(); -} -// ----------------------------------------------------------------------------- -void SvtCTLOptions::SetCTLSequenceChecking( sal_Bool _bEnabled ) -{ - DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); - pCTLOptions->SetCTLSequenceChecking(_bEnabled); -} -// ----------------------------------------------------------------------------- -sal_Bool SvtCTLOptions::IsCTLSequenceChecking() const -{ - DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); - return pCTLOptions->IsCTLSequenceChecking(); -} -// ----------------------------------------------------------------------------- -void SvtCTLOptions::SetCTLSequenceCheckingRestricted( sal_Bool _bEnable ) -{ - DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); - pCTLOptions->SetCTLSequenceCheckingRestricted(_bEnable); -} -// ----------------------------------------------------------------------------- -sal_Bool SvtCTLOptions::IsCTLSequenceCheckingRestricted( void ) const -{ - DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); - return pCTLOptions->IsCTLSequenceCheckingRestricted(); -} -// ----------------------------------------------------------------------------- -void SvtCTLOptions::SetCTLSequenceCheckingTypeAndReplace( sal_Bool _bEnable ) -{ - DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); - pCTLOptions->SetCTLSequenceCheckingTypeAndReplace(_bEnable); -} -// ----------------------------------------------------------------------------- -sal_Bool SvtCTLOptions::IsCTLSequenceCheckingTypeAndReplace() const -{ - DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); - return pCTLOptions->IsCTLSequenceCheckingTypeAndReplace(); -} -// ----------------------------------------------------------------------------- -void SvtCTLOptions::SetCTLCursorMovement( SvtCTLOptions::CursorMovement _eMovement ) -{ - DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); - pCTLOptions->SetCTLCursorMovement( _eMovement ); -} -// ----------------------------------------------------------------------------- -SvtCTLOptions::CursorMovement SvtCTLOptions::GetCTLCursorMovement() const -{ - DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); - return pCTLOptions->GetCTLCursorMovement(); -} -// ----------------------------------------------------------------------------- -void SvtCTLOptions::SetCTLTextNumerals( SvtCTLOptions::TextNumerals _eNumerals ) -{ - DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); - pCTLOptions->SetCTLTextNumerals( _eNumerals ); -} -// ----------------------------------------------------------------------------- -SvtCTLOptions::TextNumerals SvtCTLOptions::GetCTLTextNumerals() const -{ - DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); - return pCTLOptions->GetCTLTextNumerals(); -} -// ----------------------------------------------------------------------------- -sal_Bool SvtCTLOptions::IsReadOnly(EOption eOption) const -{ - DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); - return pCTLOptions->IsReadOnly(eOption); -} -/* -----------------30.04.2003 10:40----------------- - - --------------------------------------------------*/ -void SvtCTLOptions::Notify( SfxBroadcaster&, const SfxHint& rHint ) -{ - vos::OGuard aVclGuard( Application::GetSolarMutex() ); - Broadcast( rHint ); -} - -// ----------------------------------------------------------------------------- - diff --git a/svtools/source/config/languageoptions.cxx b/svtools/source/config/languageoptions.cxx deleted file mode 100644 index 0dffafee86d2..000000000000 --- a/svtools/source/config/languageoptions.cxx +++ /dev/null @@ -1,283 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: languageoptions.cxx,v $ - * $Revision: 1.21 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace ::com::sun::star; -// global ---------------------------------------------------------------------- - -namespace { struct ALMutex : public rtl::Static< ::osl::Mutex, ALMutex > {}; } - -// class SvtLanguageOptions ---------------------------------------------------- - -SvtLanguageOptions::SvtLanguageOptions( sal_Bool _bDontLoad ) -{ - // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( ALMutex::get() ); - - m_pCJKOptions = new SvtCJKOptions( _bDontLoad ); - m_pCTLOptions = new SvtCTLOptions( _bDontLoad ); - StartListening(*m_pCTLOptions); -} -//------------------------------------------------------------------------------ -SvtLanguageOptions::~SvtLanguageOptions() -{ - // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( ALMutex::get() ); - - delete m_pCJKOptions; - delete m_pCTLOptions; -} -//------------------------------------------------------------------------------ -// CJK options ----------------------------------------------------------------- -//------------------------------------------------------------------------------ -sal_Bool SvtLanguageOptions::IsCJKFontEnabled() const -{ - return m_pCJKOptions->IsCJKFontEnabled(); -} -//------------------------------------------------------------------------------ -sal_Bool SvtLanguageOptions::IsVerticalTextEnabled() const -{ - return m_pCJKOptions->IsVerticalTextEnabled(); -} -//------------------------------------------------------------------------------ -sal_Bool SvtLanguageOptions::IsAsianTypographyEnabled() const -{ - return m_pCJKOptions->IsAsianTypographyEnabled(); -} -//------------------------------------------------------------------------------ -sal_Bool SvtLanguageOptions::IsJapaneseFindEnabled() const -{ - return m_pCJKOptions->IsJapaneseFindEnabled(); -} -//------------------------------------------------------------------------------ -sal_Bool SvtLanguageOptions::IsRubyEnabled() const -{ - return m_pCJKOptions->IsRubyEnabled(); -} -//------------------------------------------------------------------------------ -sal_Bool SvtLanguageOptions::IsChangeCaseMapEnabled() const -{ - return m_pCJKOptions->IsChangeCaseMapEnabled(); -} -//------------------------------------------------------------------------------ -sal_Bool SvtLanguageOptions::IsDoubleLinesEnabled() const -{ - return m_pCJKOptions->IsDoubleLinesEnabled(); -} -//------------------------------------------------------------------------------ -sal_Bool SvtLanguageOptions::IsEmphasisMarksEnabled() const -{ - return m_pCJKOptions->IsEmphasisMarksEnabled(); -} -//------------------------------------------------------------------------------ -sal_Bool SvtLanguageOptions::IsVerticalCallOutEnabled() const -{ - return m_pCJKOptions->IsVerticalCallOutEnabled(); -} -//------------------------------------------------------------------------------ -void SvtLanguageOptions::SetAll( sal_Bool _bSet ) -{ - m_pCJKOptions->SetAll( _bSet ); -} -//------------------------------------------------------------------------------ -sal_Bool SvtLanguageOptions::IsAnyEnabled() const -{ - return m_pCJKOptions->IsAnyEnabled(); -} -//------------------------------------------------------------------------------ -// CTL options ----------------------------------------------------------------- -//------------------------------------------------------------------------------ -void SvtLanguageOptions::SetCTLFontEnabled( sal_Bool _bEnabled ) -{ - m_pCTLOptions->SetCTLFontEnabled( _bEnabled ); -} -//------------------------------------------------------------------------------ -sal_Bool SvtLanguageOptions::IsCTLFontEnabled() const -{ - return m_pCTLOptions->IsCTLFontEnabled(); -} -//------------------------------------------------------------------------------ -void SvtLanguageOptions::SetCTLSequenceChecking( sal_Bool _bEnabled ) -{ - m_pCTLOptions->SetCTLSequenceChecking( _bEnabled ); -} -//------------------------------------------------------------------------------ -sal_Bool SvtLanguageOptions::IsCTLSequenceChecking() const -{ - return m_pCTLOptions->IsCTLSequenceChecking(); -} -/*-- 26.09.2005 15:48:23--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SvtLanguageOptions::SetCTLSequenceCheckingRestricted( sal_Bool _bEnable ) -{ - m_pCTLOptions->SetCTLSequenceCheckingRestricted( _bEnable ); -} -/*-- 26.09.2005 15:48:23--------------------------------------------------- - - -----------------------------------------------------------------------*/ -sal_Bool SvtLanguageOptions::IsCTLSequenceCheckingRestricted( void ) const -{ - return m_pCTLOptions->IsCTLSequenceCheckingRestricted(); -} -/*-- 26.09.2005 15:48:23--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SvtLanguageOptions::SetCTLSequenceCheckingTypeAndReplace( sal_Bool _bEnable ) -{ - m_pCTLOptions->SetCTLSequenceCheckingTypeAndReplace( _bEnable ); -} -/*-- 26.09.2005 15:48:24--------------------------------------------------- - - -----------------------------------------------------------------------*/ -sal_Bool SvtLanguageOptions::IsCTLSequenceCheckingTypeAndReplace() const -{ - return m_pCTLOptions->IsCTLSequenceCheckingTypeAndReplace(); -} - -//------------------------------------------------------------------------------ -sal_Bool SvtLanguageOptions::IsReadOnly(SvtLanguageOptions::EOption eOption) const -{ - sal_Bool bReadOnly = sal_False; - switch(eOption) - { - // cjk options - case SvtLanguageOptions::E_CJKFONT : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_CJKFONT ); break; - case SvtLanguageOptions::E_VERTICALTEXT : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_VERTICALTEXT ); break; - case SvtLanguageOptions::E_ASIANTYPOGRAPHY : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_ASIANTYPOGRAPHY); break; - case SvtLanguageOptions::E_JAPANESEFIND : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_JAPANESEFIND ); break; - case SvtLanguageOptions::E_RUBY : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_RUBY ); break; - case SvtLanguageOptions::E_CHANGECASEMAP : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_CHANGECASEMAP ); break; - case SvtLanguageOptions::E_DOUBLELINES : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_DOUBLELINES ); break; - case SvtLanguageOptions::E_EMPHASISMARKS : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_EMPHASISMARKS ); break; - case SvtLanguageOptions::E_VERTICALCALLOUT : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_VERTICALCALLOUT); break; - case SvtLanguageOptions::E_ALLCJK : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_ALL ); break; - // ctl options - case SvtLanguageOptions::E_CTLFONT : bReadOnly = m_pCTLOptions->IsReadOnly(SvtCTLOptions::E_CTLFONT ); break; - case SvtLanguageOptions::E_CTLSEQUENCECHECKING : bReadOnly = m_pCTLOptions->IsReadOnly(SvtCTLOptions::E_CTLSEQUENCECHECKING); break; - case SvtLanguageOptions::E_CTLCURSORMOVEMENT : bReadOnly = m_pCTLOptions->IsReadOnly(SvtCTLOptions::E_CTLCURSORMOVEMENT ); break; - case SvtLanguageOptions::E_CTLTEXTNUMERALS : bReadOnly = m_pCTLOptions->IsReadOnly(SvtCTLOptions::E_CTLTEXTNUMERALS ); break; - } - return bReadOnly; -} -/* -----------------30.04.2003 11:03----------------- - - --------------------------------------------------*/ -void SvtLanguageOptions::Notify( SfxBroadcaster&, const SfxHint& rHint ) -{ - vos::OGuard aVclGuard( Application::GetSolarMutex() ); - Broadcast( rHint ); -} - -// ----------------------------------------------------------------------------- -// returns for a language the scripttype -sal_uInt16 SvtLanguageOptions::GetScriptTypeOfLanguage( sal_uInt16 nLang ) -{ - if( LANGUAGE_DONTKNOW == nLang ) - nLang = LANGUAGE_ENGLISH_US; - else if( LANGUAGE_SYSTEM == nLang ) - nLang = Application::GetSettings().GetLanguage(); - - sal_Int16 nScriptType = MsLangId::getScriptType( nLang ); - USHORT nScript; - switch (nScriptType) - { - case ::com::sun::star::i18n::ScriptType::ASIAN: - nScript = SCRIPTTYPE_ASIAN; - break; - case ::com::sun::star::i18n::ScriptType::COMPLEX: - nScript = SCRIPTTYPE_COMPLEX; - break; - default: - nScript = SCRIPTTYPE_LATIN; - } - return nScript; -} -// ----------------------------------------------------------------------------- - - -/*-- 27.10.2005 08:18:01--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SvtSystemLanguageOptions::SvtSystemLanguageOptions() : - utl::ConfigItem( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("System/L10N") )) -{ - uno::Sequence< rtl::OUString > aPropertyNames(1); - rtl::OUString* pNames = aPropertyNames.getArray(); - pNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SystemLocale")); - uno::Sequence< uno::Any > aValues = GetProperties( aPropertyNames ); - - if ( aValues.getLength() ) - { - aValues[0]>>= m_sWin16SystemLocale; - } -} -/*-- 27.10.2005 08:18:01--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SvtSystemLanguageOptions::~SvtSystemLanguageOptions() -{ -} -/*-- 27.10.2005 08:18:02--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SvtSystemLanguageOptions::Commit() -{ - //does nothing -} -/*-- 27.10.2005 08:36:14--------------------------------------------------- - - -----------------------------------------------------------------------*/ -LanguageType SvtSystemLanguageOptions::GetWin16SystemLanguage() -{ - if( m_sWin16SystemLocale.getLength() == 0 ) - return LANGUAGE_NONE; - return MsLangId::convertIsoStringToLanguage( m_sWin16SystemLocale ); -} - - diff --git a/svtools/source/config/misccfg.cxx b/svtools/source/config/misccfg.cxx deleted file mode 100644 index 06cc9b7446c0..000000000000 --- a/svtools/source/config/misccfg.cxx +++ /dev/null @@ -1,195 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: misccfg.cxx,v $ - * $Revision: 1.9 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION - -#include "misccfg.hxx" -#include -#include - -#include - - -#define DEFAULT_TAB 2000 - -#define DEF_INCH 2540L -#define DEF_RELTWIP 1440L - -using namespace rtl; -using namespace com::sun::star::uno; - -#define C2U(cChar) OUString::createFromAscii(cChar) -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ -SfxMiscCfg::SfxMiscCfg() : - ConfigItem(C2U("Office.Common") ), - bPaperSize(FALSE), - bPaperOrientation (FALSE), - bNotFound (FALSE), - nYear2000( SvNumberFormatter::GetYear2000Default() ) -{ - RTL_LOGFILE_CONTEXT(aLog, "svtools SfxMiscCfg::SfxMiscCfg()"); - - Load(); -} -/* -----------------------------02.03.01 15:31-------------------------------- - - ---------------------------------------------------------------------------*/ -SfxMiscCfg::~SfxMiscCfg() -{ -} -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ - -void SfxMiscCfg::SetNotFoundWarning( BOOL bSet) -{ - if(bNotFound != bSet) - SetModified(); - bNotFound = bSet; -} - -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ - -void SfxMiscCfg::SetPaperSizeWarning( BOOL bSet) -{ - if(bPaperSize != bSet) - SetModified(); - bPaperSize = bSet; -} - -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ -void SfxMiscCfg::SetPaperOrientationWarning( BOOL bSet) -{ - if(bPaperOrientation != bSet) - SetModified(); - bPaperOrientation = bSet; -} -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ - -void SfxMiscCfg::SetYear2000( sal_Int32 nSet ) -{ - if(nYear2000 != nSet) - SetModified(); - nYear2000 = nSet; -} -/* -----------------------------02.03.01 15:31-------------------------------- - - ---------------------------------------------------------------------------*/ -const Sequence& SfxMiscCfg::GetPropertyNames() -{ - static Sequence aNames; - if(!aNames.getLength()) - { - static const char* aPropNames[] = - { - "Print/Warning/PaperSize", // 0 - "Print/Warning/PaperOrientation", // 1 - "Print/Warning/NotFound", // 2 - "DateFormat/TwoDigitYear", // 3 - }; - const int nCount = 4; - aNames.realloc(nCount); - OUString* pNames = aNames.getArray(); - for(int i = 0; i < nCount; i++) - pNames[i] = OUString::createFromAscii(aPropNames[i]); - } - return aNames; -} -/* -----------------------------02.03.01 15:31-------------------------------- - - ---------------------------------------------------------------------------*/ -void SfxMiscCfg::Load() -{ - const Sequence& aNames = GetPropertyNames(); - Sequence aValues = GetProperties(aNames); - EnableNotification(aNames); - const Any* pValues = aValues.getConstArray(); - DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed"); - if(aValues.getLength() == aNames.getLength()) - { - for(int nProp = 0; nProp < aNames.getLength(); nProp++) - { - if(pValues[nProp].hasValue()) - { - switch(nProp) - { - case 0: bPaperSize = *(sal_Bool*)pValues[nProp].getValue(); break; //"Print/Warning/PaperSize", - case 1: bPaperOrientation = *(sal_Bool*)pValues[nProp].getValue(); break; //"Print/Warning/PaperOrientation", - case 2: bNotFound = *(sal_Bool*)pValues[nProp].getValue() ; break; //"Print/Warning/NotFound", - case 3: pValues[nProp] >>= nYear2000;break; //"DateFormat/TwoDigitYear", - } - } - } - } -} -/* -----------------------------02.03.01 15:31-------------------------------- - - ---------------------------------------------------------------------------*/ -void SfxMiscCfg::Notify( const com::sun::star::uno::Sequence& ) -{ - Load(); -} -/* -----------------------------02.03.01 15:31-------------------------------- - - ---------------------------------------------------------------------------*/ -void SfxMiscCfg::Commit() -{ - const Sequence& aNames = GetPropertyNames(); - Sequence aValues(aNames.getLength()); - Any* pValues = aValues.getArray(); - - const Type& rType = ::getBooleanCppuType(); - for(int nProp = 0; nProp < aNames.getLength(); nProp++) - { - switch(nProp) - { - case 0: pValues[nProp].setValue(&bPaperSize, rType);break; //"Print/Warning/PaperSize", - case 1: pValues[nProp].setValue(&bPaperOrientation, rType);break; //"Print/Warning/PaperOrientation", - case 2: pValues[nProp].setValue(&bNotFound, rType);break; //"Print/Warning/NotFound", - case 3: pValues[nProp] <<= nYear2000;break; //"DateFormat/TwoDigitYear", - } - } - PutProperties(aNames, aValues); -} - diff --git a/svtools/source/config/syslocaleoptions.cxx b/svtools/source/config/syslocaleoptions.cxx deleted file mode 100644 index a75c63e34af0..000000000000 --- a/svtools/source/config/syslocaleoptions.cxx +++ /dev/null @@ -1,637 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: syslocaleoptions.cxx,v $ - * $Revision: 1.23 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "itemholder2.hxx" - - -#define CFG_READONLY_DEFAULT sal_False - -using namespace osl; -using namespace utl; -using namespace rtl; -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; - - -SvtSysLocaleOptions_Impl* SvtSysLocaleOptions::pOptions = NULL; -sal_Int32 SvtSysLocaleOptions::nRefCount = 0; -namespace -{ - struct CurrencyChangeLink - : public rtl::Static {}; -} - -class SvtSysLocaleOptions_Impl : public utl::ConfigItem -{ - OUString m_aLocaleString; // en-US or de-DE or empty for SYSTEM - LanguageType m_eLocaleLanguageType; // same for convenience access - OUString m_aCurrencyString; // USD-en-US or EUR-de-DE - SvtBroadcaster m_aBroadcaster; - ULONG m_nBlockedHint; // pending hints - sal_Int32 m_nBroadcastBlocked; // broadcast only if this is 0 - sal_Bool m_bDecimalSeparator; //use decimal separator same as locale - - - sal_Bool m_bROLocale; - sal_Bool m_bROCurrency; - sal_Bool m_bRODecimalSeparator; - - static const Sequence< /* const */ OUString > GetPropertyNames(); - - void UpdateMiscSettings_Impl(); - ULONG ChangeLocaleSettings(); - void ChangeDefaultCurrency() const; - void Broadcast( ULONG nHint ); - -public: - SvtSysLocaleOptions_Impl(); - virtual ~SvtSysLocaleOptions_Impl(); - - virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); - virtual void Commit(); - - const OUString& GetLocaleString() const - { return m_aLocaleString; } - void SetLocaleString( const OUString& rStr ); - LanguageType GetLocaleLanguageType() const - { return m_eLocaleLanguageType; } - - const OUString& GetCurrencyString() const - { return m_aCurrencyString; } - void SetCurrencyString( const OUString& rStr ); - - sal_Bool IsDecimalSeparatorAsLocale() const { return m_bDecimalSeparator;} - void SetDecimalSeparatorAsLocale( sal_Bool bSet); - - SvtBroadcaster& GetBroadcaster() - { return m_aBroadcaster; } - void BlockBroadcasts( BOOL bBlock ); - sal_Bool IsReadOnly( SvtSysLocaleOptions::EOption eOption ) const; -}; - - -#define ROOTNODE_SYSLOCALE OUString(RTL_CONSTASCII_USTRINGPARAM("Setup/L10N")) - -#define PROPERTYNAME_LOCALE OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupSystemLocale")) -#define PROPERTYNAME_CURRENCY OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupCurrency")) -#define PROPERTYNAME_DECIMALSEPARATOR OUString(RTL_CONSTASCII_USTRINGPARAM("DecimalSeparatorAsLocale")) - -#define PROPERTYHANDLE_LOCALE 0 -#define PROPERTYHANDLE_CURRENCY 1 -#define PROPERTYHANDLE_DECIMALSEPARATOR 2 - -#define PROPERTYCOUNT 3 - -const Sequence< OUString > SvtSysLocaleOptions_Impl::GetPropertyNames() -{ - static const OUString pProperties[] = - { - PROPERTYNAME_LOCALE, - PROPERTYNAME_CURRENCY, - PROPERTYNAME_DECIMALSEPARATOR - }; - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); - return seqPropertyNames; -} - - -// ----------------------------------------------------------------------- - -SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl() - : ConfigItem( ROOTNODE_SYSLOCALE ) - , m_nBlockedHint( 0 ) - , m_nBroadcastBlocked( 0 ) - , m_bDecimalSeparator( sal_True ) - , m_bROLocale(CFG_READONLY_DEFAULT) - , m_bROCurrency(CFG_READONLY_DEFAULT) - , m_bRODecimalSeparator(sal_False) - -{ - if ( !IsValidConfigMgr() ) - ChangeLocaleSettings(); // assume SYSTEM defaults during Setup - else - { - const Sequence< OUString > aNames = GetPropertyNames(); - Sequence< Any > aValues = GetProperties( aNames ); - Sequence< sal_Bool > aROStates = GetReadOnlyStates( aNames ); - const Any* pValues = aValues.getConstArray(); - const sal_Bool* pROStates = aROStates.getConstArray(); - DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" ); - DBG_ASSERT( aROStates.getLength() == aNames.getLength(), "GetReadOnlyStates failed" ); - if ( aValues.getLength() == aNames.getLength() && aROStates.getLength() == aNames.getLength() ) - { - for ( sal_Int32 nProp = 0; nProp < aNames.getLength(); nProp++ ) - { - DBG_ASSERT( pValues[nProp].hasValue(), "property value missing" ); - if ( pValues[nProp].hasValue() ) - { - switch ( nProp ) - { - case PROPERTYHANDLE_LOCALE : - { - OUString aStr; - if ( pValues[nProp] >>= aStr ) - m_aLocaleString = aStr; - else - { - DBG_ERRORFILE( "Wrong property type!" ); - } - m_bROLocale = pROStates[nProp]; - } - break; - case PROPERTYHANDLE_CURRENCY : - { - OUString aStr; - if ( pValues[nProp] >>= aStr ) - m_aCurrencyString = aStr; - else - { - DBG_ERRORFILE( "Wrong property type!" ); - } - m_bROCurrency = pROStates[nProp]; - } - break; - case PROPERTYHANDLE_DECIMALSEPARATOR: - { - sal_Bool bValue = sal_Bool(); - if ( pValues[nProp] >>= bValue ) - m_bDecimalSeparator = bValue; - else - { - DBG_ERRORFILE( "Wrong property type!" ); - } - m_bRODecimalSeparator = pROStates[nProp]; - } - break; - default: - DBG_ERRORFILE( "Wrong property type!" ); - } - } - } - } - UpdateMiscSettings_Impl(); - ChangeLocaleSettings(); - EnableNotification( aNames ); - } -} - - -SvtSysLocaleOptions_Impl::~SvtSysLocaleOptions_Impl() -{ - if ( IsModified() ) - Commit(); -} - - -void SvtSysLocaleOptions_Impl::BlockBroadcasts( BOOL bBlock ) -{ - if ( bBlock ) - ++m_nBroadcastBlocked; - else if ( m_nBroadcastBlocked ) - { - if ( --m_nBroadcastBlocked == 0 ) - Broadcast( 0 ); - } -} - -sal_Bool SvtSysLocaleOptions_Impl::IsReadOnly( SvtSysLocaleOptions::EOption eOption ) const -{ - sal_Bool bReadOnly = CFG_READONLY_DEFAULT; - switch(eOption) - { - case SvtSysLocaleOptions::E_LOCALE : - { - bReadOnly = m_bROLocale; - break; - } - case SvtSysLocaleOptions::E_CURRENCY : - { - bReadOnly = m_bROCurrency; - break; - } - } - return bReadOnly; -} - - -void SvtSysLocaleOptions_Impl::Broadcast( ULONG nHint ) -{ - if ( m_nBroadcastBlocked ) - m_nBlockedHint |= nHint; - else - { - nHint |= m_nBlockedHint; - m_nBlockedHint = 0; - if ( nHint ) - { - if ( nHint & SYSLOCALEOPTIONS_HINT_CURRENCY ) - ChangeDefaultCurrency(); - SfxSimpleHint aHint( nHint ); - GetBroadcaster().Broadcast( aHint ); - } - } -} - - -void SvtSysLocaleOptions_Impl::Commit() -{ - const Sequence< OUString > aOrgNames = GetPropertyNames(); - sal_Int32 nOrgCount = aOrgNames.getLength(); - - Sequence< OUString > aNames( nOrgCount ); - Sequence< Any > aValues( nOrgCount ); - - OUString* pNames = aNames.getArray(); - Any* pValues = aValues.getArray(); - sal_Int32 nRealCount = 0; - - for ( sal_Int32 nProp = 0; nProp < nOrgCount; nProp++ ) - { - switch ( nProp ) - { - case PROPERTYHANDLE_LOCALE : - { - if (!m_bROLocale) - { - pNames[nRealCount] = aOrgNames[nProp]; - pValues[nRealCount] <<= m_aLocaleString; - ++nRealCount; - } - } - break; - case PROPERTYHANDLE_CURRENCY : - { - if (!m_bROLocale) - { - pNames[nRealCount] = aOrgNames[nProp]; - pValues[nRealCount] <<= m_aCurrencyString; - ++nRealCount; - } - } - break; - case PROPERTYHANDLE_DECIMALSEPARATOR: - if( !m_bRODecimalSeparator ) - { - pNames[nRealCount] = aOrgNames[nProp]; - pValues[nRealCount] <<= m_bDecimalSeparator; - ++nRealCount; - } - break; - default: - DBG_ERRORFILE( "invalid index to save a path" ); - } - } - aNames.realloc(nRealCount); - aValues.realloc(nRealCount); - PutProperties( aNames, aValues ); - ClearModified(); -} - - -void SvtSysLocaleOptions_Impl::SetLocaleString( const OUString& rStr ) -{ - if (!m_bROLocale && rStr != m_aLocaleString ) - { - m_aLocaleString = rStr; - SetModified(); - ULONG nHint = SYSLOCALEOPTIONS_HINT_LOCALE; - nHint |= ChangeLocaleSettings(); - Broadcast( nHint ); - } -} - - -ULONG SvtSysLocaleOptions_Impl::ChangeLocaleSettings() -{ - // An empty config value denotes SYSTEM locale - if ( m_aLocaleString.getLength() ) - m_eLocaleLanguageType = MsLangId::convertIsoStringToLanguage( m_aLocaleString ); - else - m_eLocaleLanguageType = LANGUAGE_SYSTEM; - ULONG nHint = 0; - // new locale and no fixed currency => locale default currency might change - if ( !m_aCurrencyString.getLength() ) - nHint |= SYSLOCALEOPTIONS_HINT_CURRENCY; - return nHint; -} - - -void SvtSysLocaleOptions_Impl::SetCurrencyString( const OUString& rStr ) -{ - if (!m_bROCurrency && rStr != m_aCurrencyString ) - { - m_aCurrencyString = rStr; - SetModified(); - Broadcast( SYSLOCALEOPTIONS_HINT_CURRENCY ); - } -} - -void SvtSysLocaleOptions_Impl::SetDecimalSeparatorAsLocale( sal_Bool bSet) -{ - if(bSet != m_bDecimalSeparator) - { - m_bDecimalSeparator = bSet; - SetModified(); - UpdateMiscSettings_Impl(); - } -} - - -void SvtSysLocaleOptions_Impl::ChangeDefaultCurrency() const -{ - const Link& rLink = SvtSysLocaleOptions::GetCurrencyChangeLink(); - if ( rLink.IsSet() ) - rLink.Call( NULL ); -} - - -void SvtSysLocaleOptions_Impl::Notify( const Sequence< rtl::OUString >& seqPropertyNames ) -{ - ULONG nHint = 0; - Sequence< Any > seqValues = GetProperties( seqPropertyNames ); - Sequence< sal_Bool > seqROStates = GetReadOnlyStates( seqPropertyNames ); - sal_Int32 nCount = seqPropertyNames.getLength(); - for( sal_Int32 nProp = 0; nProp < nCount; ++nProp ) - { - if( seqPropertyNames[nProp] == PROPERTYNAME_LOCALE ) - { - DBG_ASSERT( seqValues[nProp].getValueTypeClass() == TypeClass_STRING, "Locale property type" ); - seqValues[nProp] >>= m_aLocaleString; - m_bROLocale = seqROStates[nProp]; - nHint |= SYSLOCALEOPTIONS_HINT_LOCALE; - nHint |= ChangeLocaleSettings(); - } - else if( seqPropertyNames[nProp] == PROPERTYNAME_CURRENCY ) - { - DBG_ASSERT( seqValues[nProp].getValueTypeClass() == TypeClass_STRING, "Currency property type" ); - seqValues[nProp] >>= m_aCurrencyString; - m_bROCurrency = seqROStates[nProp]; - nHint |= SYSLOCALEOPTIONS_HINT_CURRENCY; - } - else if( seqPropertyNames[nProp] == PROPERTYNAME_DECIMALSEPARATOR ) - { - seqValues[nProp] >>= m_bDecimalSeparator; - m_bRODecimalSeparator = seqROStates[nProp]; - UpdateMiscSettings_Impl(); - } - } - if ( nHint ) - Broadcast( nHint ); -} -/* -----------------10.02.2004 15:25----------------- - - --------------------------------------------------*/ -void SvtSysLocaleOptions_Impl::UpdateMiscSettings_Impl() -{ - AllSettings aAllSettings( Application::GetSettings() ); - MiscSettings aMiscSettings = aAllSettings.GetMiscSettings(); - aMiscSettings.SetEnableLocalizedDecimalSep(m_bDecimalSeparator); - aAllSettings.SetMiscSettings( aMiscSettings ); - Application::SetSettings( aAllSettings ); -} - -// ==================================================================== - -SvtSysLocaleOptions::SvtSysLocaleOptions() -{ - MutexGuard aGuard( GetMutex() ); - if ( !pOptions ) - { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtSysLocaleOptions_Impl::ctor()"); - pOptions = new SvtSysLocaleOptions_Impl; - - ItemHolder2::holdConfigItem(E_SYSLOCALEOPTIONS); - } - ++nRefCount; -} - - -SvtSysLocaleOptions::~SvtSysLocaleOptions() -{ - MutexGuard aGuard( GetMutex() ); - if ( !--nRefCount ) - { - delete pOptions; - pOptions = NULL; - } -} - - -// static -Mutex& SvtSysLocaleOptions::GetMutex() -{ - static Mutex* pMutex = NULL; - if( !pMutex ) - { - MutexGuard aGuard( Mutex::getGlobalMutex() ); - if( !pMutex ) - { - // #i77768# Due to a static reference in the toolkit lib - // we need a mutex that lives longer than the svtools library. - // Otherwise the dtor would use a destructed mutex!! - pMutex = new Mutex; - } - } - return *pMutex; -} - - -sal_Bool SvtSysLocaleOptions::IsModified() -{ - MutexGuard aGuard( GetMutex() ); - return pOptions->IsModified(); -} - - -void SvtSysLocaleOptions::Commit() -{ - MutexGuard aGuard( GetMutex() ); - pOptions->Commit(); -} - - -BOOL SvtSysLocaleOptions::AddListener( SvtListener& rLst ) -{ - MutexGuard aGuard( GetMutex() ); - return rLst.StartListening( pOptions->GetBroadcaster() ); -} - - -BOOL SvtSysLocaleOptions::RemoveListener( SvtListener& rLst ) -{ - MutexGuard aGuard( GetMutex() ); - return rLst.EndListening( pOptions->GetBroadcaster() ); -} - - -void SvtSysLocaleOptions::BlockBroadcasts( BOOL bBlock ) -{ - MutexGuard aGuard( GetMutex() ); - pOptions->BlockBroadcasts( bBlock ); -} - - -const OUString& SvtSysLocaleOptions::GetLocaleConfigString() const -{ - MutexGuard aGuard( GetMutex() ); - return pOptions->GetLocaleString(); -} - - -void SvtSysLocaleOptions::SetLocaleConfigString( const OUString& rStr ) -{ - MutexGuard aGuard( GetMutex() ); - pOptions->SetLocaleString( rStr ); -} - - -const OUString& SvtSysLocaleOptions::GetCurrencyConfigString() const -{ - MutexGuard aGuard( GetMutex() ); - return pOptions->GetCurrencyString(); -} - - -void SvtSysLocaleOptions::SetCurrencyConfigString( const OUString& rStr ) -{ - MutexGuard aGuard( GetMutex() ); - pOptions->SetCurrencyString( rStr ); -} - - -LanguageType SvtSysLocaleOptions::GetLocaleLanguageType() const -{ - MutexGuard aGuard( GetMutex() ); - return pOptions->GetLocaleLanguageType(); -} - -/*-- 11.02.2004 13:31:41--------------------------------------------------- - - -----------------------------------------------------------------------*/ -sal_Bool SvtSysLocaleOptions::IsDecimalSeparatorAsLocale() const -{ - MutexGuard aGuard( GetMutex() ); - return pOptions->IsDecimalSeparatorAsLocale(); -} -/*-- 11.02.2004 13:31:41--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SvtSysLocaleOptions::SetDecimalSeparatorAsLocale( sal_Bool bSet) -{ - MutexGuard aGuard( GetMutex() ); - pOptions->SetDecimalSeparatorAsLocale(bSet); -} - - -sal_Bool SvtSysLocaleOptions::IsReadOnly( EOption eOption ) const -{ - MutexGuard aGuard( GetMutex() ); - return pOptions->IsReadOnly( eOption ); -} - -// static -void SvtSysLocaleOptions::GetCurrencyAbbrevAndLanguage( String& rAbbrev, - LanguageType& eLang, const ::rtl::OUString& rConfigString ) -{ - sal_Int32 nDelim = rConfigString.indexOf( '-' ); - if ( nDelim >= 0 ) - { - rAbbrev = rConfigString.copy( 0, nDelim ); - String aIsoStr( rConfigString.copy( nDelim+1 ) ); - eLang = MsLangId::convertIsoStringToLanguage( aIsoStr ); - } - else - { - rAbbrev = rConfigString; - eLang = (rAbbrev.Len() ? LANGUAGE_NONE : LANGUAGE_SYSTEM); - } -} - - -// static -::rtl::OUString SvtSysLocaleOptions::CreateCurrencyConfigString( - const String& rAbbrev, LanguageType eLang ) -{ - String aIsoStr( MsLangId::convertLanguageToIsoString( eLang ) ); - if ( aIsoStr.Len() ) - { - ::rtl::OUStringBuffer aStr( rAbbrev.Len() + 1 + aIsoStr.Len() ); - aStr.append( rAbbrev.GetBuffer(), rAbbrev.Len() ); - aStr.append( sal_Unicode('-') ); - aStr.append( aIsoStr.GetBuffer(), aIsoStr.Len() ); - return aStr.makeStringAndClear(); - } - else - return rAbbrev; -} - - -// static -void SvtSysLocaleOptions::SetCurrencyChangeLink( const Link& rLink ) -{ - MutexGuard aGuard( GetMutex() ); - DBG_ASSERT( !CurrencyChangeLink::get().IsSet(), "SvtSysLocaleOptions::SetCurrencyChangeLink: already set" ); - CurrencyChangeLink::get() = rLink; -} - - -// static -const Link& SvtSysLocaleOptions::GetCurrencyChangeLink() -{ - MutexGuard aGuard( GetMutex() ); - return CurrencyChangeLink::get(); -} - diff --git a/svtools/source/dialogs/filedlg2.hrc b/svtools/source/dialogs/filedlg2.hrc deleted file mode 100644 index a75e9047eafb..000000000000 --- a/svtools/source/dialogs/filedlg2.hrc +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: filedlg2.hrc,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define STR_FILEDLG_SELECT 1000 -#define STR_FILEDLG_CANTCHDIR 1001 -#define STR_FILEDLG_OPEN 1002 -#define STR_FILEDLG_FILE 1003 -#define STR_FILEDLG_DIR 1004 -#define STR_FILEDLG_TYPE 1005 -#define STR_FILEDLG_CANTOPENFILE 1006 -#define STR_FILEDLG_CANTOPENDIR 1007 -#define STR_FILEDLG_OVERWRITE 1008 -#define STR_FILEDLG_GOUP 1009 -#define STR_FILEDLG_SAVE 1010 -#define STR_FILEDLG_DRIVES 1011 -#define STR_FILEDLG_HOME 1012 -#define STR_FILEDLG_NEWDIR 1013 -#define STR_FILEDLG_ASKNEWDIR 1014 diff --git a/svtools/source/dialogs/propctrl.hxx b/svtools/source/dialogs/propctrl.hxx new file mode 100644 index 000000000000..b2698f6a1c8e --- /dev/null +++ b/svtools/source/dialogs/propctrl.hxx @@ -0,0 +1,118 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: propctrl.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +/* +#include +#include +#include "sbx.hxx" +#include "sbxbase.hxx" +#include "sbxres.hxx" +#include + */ + + +#ifndef __PROPED_HXX__ +#include +#endif +#ifndef _UNO_HXX +#include +#endif +#ifndef _USR_SEQU_HXX +#include +#endif +#ifndef __TOOLSIDL_HXX__ +#include +#endif + +/* +class XPropertyEditor + : public XInterface +{ +public: + + virtual void setObject(const UsrAny& aToInspectObj) = 0; + + static Uik getSmartUik() { return(385); } +}; +*/ + +class PropertyEditorControler_Impl; +class SvPropertyBox; +class Window; + +class SimplePropertyEditor_Impl : + public XPropertyEditor, + public XPropertyEditorNavigation, + public UsrObject +{ + PropertyEditorControler_Impl* pActiveControler; + SvPropertyBox* mpPropBox; + UsrAny maStartUnoObj; + UsrAny maActiveUnoObj; + + // History der Objekte speichern + AnySequence maHistorySeq; + WSStringSequence maHistoryNames; + UINT32 mnHistoryCount; + INT32 mnActualHistoryLevel; + + // Einfache History via Dummy-Properties + BOOL bSimpleHistory; + + // Methode zum Anlegen/Aktivieren der Controller + void showObject( const UsrAny& aToShowObj ); + String getPath( void ); + +public: + // Provisorischer Ctor mit Parent-Window + SimplePropertyEditor_Impl( Window *pParent ); + ~SimplePropertyEditor_Impl(); + + // HACK fuer History-Test + void enableSimpleHistory( BOOL bHistory_ ) { bSimpleHistory = bHistory_; } + + SMART_UNO_DECLARATION(ImplIntrospection,UsrObject); + + // Methoden von XInterface + XInterface * queryInterface( Uik aUik ); + XIdlClassRef getIdlClass(); + + // Methoden von XPropertyEditor + virtual void setObject(const UsrAny& aToInspectObj, const XubString& aObjName); + + // Methoden von PropertyEditorNavigation + virtual void forward(void); + virtual void back(void); + +}; + + + + diff --git a/svtools/source/filepicker/makefile.mk b/svtools/source/filepicker/makefile.mk deleted file mode 100644 index d00ac5170e1a..000000000000 --- a/svtools/source/filepicker/makefile.mk +++ /dev/null @@ -1,51 +0,0 @@ -#************************************************************************* -# -# 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 -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.12 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/.. - -PRJNAME=svtools -TARGET=filepicker -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svl.pmk - -# --- Files -------------------------------------------------------------- - -SLOFILES =\ - $(SLO)$/pickerhelper.obj \ - $(SLO)$/pickerhistory.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/svtools/source/filepicker/pickerhelper.cxx b/svtools/source/filepicker/pickerhelper.cxx deleted file mode 100644 index 0d8b2db9d8a0..000000000000 --- a/svtools/source/filepicker/pickerhelper.cxx +++ /dev/null @@ -1,102 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: pickerhelper.cxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include "pickerhelper.hxx" -#include "rtl/ustring.hxx" -#include "com/sun/star/ui/dialogs/XFilePicker.hpp" -#include "com/sun/star/ui/dialogs/XFolderPicker.hpp" -#include "com/sun/star/beans/XPropertySet.hpp" -#include "com/sun/star/beans/XPropertySetInfo.hpp" -#include "com/sun/star/uno/Any.hxx" -#include "tools/debug.hxx" - -namespace css = com::sun::star; - -using css::uno::Reference; -using rtl::OUString; - -namespace svt -{ - void SetDialogHelpId( - Reference < css::ui::dialogs::XFilePicker > _mxFileDlg, sal_Int32 _nHelpId ) - { - try - { - // does the dialog haver a help URL property? - Reference< css::beans::XPropertySet > xDialogProps( _mxFileDlg, css::uno::UNO_QUERY ); - Reference< css::beans::XPropertySetInfo > xInfo; - if( xDialogProps.is() ) - xInfo = xDialogProps->getPropertySetInfo( ); - - const OUString sHelpURLPropertyName( RTL_CONSTASCII_USTRINGPARAM( "HelpURL" ) ); - - if( xInfo.is() && xInfo->hasPropertyByName( sHelpURLPropertyName ) ) - { // yep - OUString sId( RTL_CONSTASCII_USTRINGPARAM( "HID:" ) ); - sId += OUString::valueOf( _nHelpId ); - xDialogProps->setPropertyValue( sHelpURLPropertyName, css::uno::makeAny( sId ) ); - } - } - catch( const css::uno::Exception& ) - { - DBG_ERROR( "svt::SetDialogHelpId(): caught an exception while setting the help id!" ); - } - } - - void SetDialogHelpId( - Reference< css::ui::dialogs::XFolderPicker > _mxFileDlg, sal_Int32 _nHelpId ) - { - try - { - // does the dialog haver a help URL property? - Reference< css::beans::XPropertySet > xDialogProps( _mxFileDlg, css::uno::UNO_QUERY ); - Reference< css::beans::XPropertySetInfo > xInfo; - if( xDialogProps.is() ) - xInfo = xDialogProps->getPropertySetInfo( ); - - const OUString sHelpURLPropertyName( RTL_CONSTASCII_USTRINGPARAM( "HelpURL" ) ); - - if( xInfo.is() && xInfo->hasPropertyByName( sHelpURLPropertyName ) ) - { // yep - OUString sId( RTL_CONSTASCII_USTRINGPARAM( "HID:" ) ); - sId += OUString::valueOf( _nHelpId ); - xDialogProps->setPropertyValue( sHelpURLPropertyName, css::uno::makeAny( sId ) ); - } - } - catch( const css::uno::Exception& ) - { - DBG_ERROR( "svt::SetDialogHelpId(): caught an exception while setting the help id!" ); - } - } -} - diff --git a/svtools/source/filepicker/pickerhistory.cxx b/svtools/source/filepicker/pickerhistory.cxx deleted file mode 100644 index 5bd584618f09..000000000000 --- a/svtools/source/filepicker/pickerhistory.cxx +++ /dev/null @@ -1,141 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: pickerhistory.cxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include "pickerhistory.hxx" -#include "pickerhistoryaccess.hxx" -#include -#include - -//......................................................................... -namespace svt -{ -//......................................................................... - using namespace ::com::sun::star::uno; - - namespace - { - typedef ::com::sun::star::uno::WeakReference< XInterface > InterfaceAdapter; - typedef ::std::vector< InterfaceAdapter > InterfaceArray; - - // ---------------------------------------------------------------- - InterfaceArray& getFolderPickerHistory() - { - static InterfaceArray s_aHistory; - return s_aHistory; - } - - // ---------------------------------------------------------------- - InterfaceArray& getFilePickerHistory() - { - static InterfaceArray s_aHistory; - return s_aHistory; - } - - // ---------------------------------------------------------------- - void implPushBackPicker( InterfaceArray& _rHistory, const Reference< XInterface >& _rxPicker ) - { - if ( !_rxPicker.is() ) - return; - - //============================================================= - // first, check which of the objects we hold in s_aHistory can be removed - { - InterfaceArray aCleanedHistory; - for ( InterfaceArray::const_iterator aLoop = _rHistory.begin(); - aLoop != _rHistory.end(); - ++aLoop - ) - { - Reference< XInterface > xCurrent( aLoop->get() ); - if ( xCurrent.is() ) - { - if ( aCleanedHistory.empty() ) - // make some room, assume that all interfaces (from here on) are valie - aCleanedHistory.reserve( _rHistory.size() - ( aLoop - _rHistory.begin() ) ); - aCleanedHistory.push_back( InterfaceAdapter( xCurrent ) ); - } - } - _rHistory.swap( aCleanedHistory ); - } - - //============================================================= - // then push_back the picker - _rHistory.push_back( InterfaceAdapter( _rxPicker ) ); - } - - //----------------------------------------------------------------- - Reference< XInterface > implGetTopMostPicker( const InterfaceArray& _rHistory ) - { - Reference< XInterface > xTopMostAlive; - - //============================================================= - // search the first picker which is still alive ... - for ( InterfaceArray::const_reverse_iterator aLoop = _rHistory.rbegin(); - ( aLoop != _rHistory.rend() ) && !xTopMostAlive.is(); - ++aLoop - ) - { - xTopMostAlive = aLoop->get(); - } - - return xTopMostAlive; - } - } - - //--------------------------------------------------------------------- - Reference< XInterface > GetTopMostFolderPicker( ) - { - return implGetTopMostPicker( getFolderPickerHistory() ); - } - - //--------------------------------------------------------------------- - Reference< XInterface > GetTopMostFilePicker( ) - { - return implGetTopMostPicker( getFilePickerHistory() ); - } - - //--------------------------------------------------------------------- - void addFolderPicker( const Reference< XInterface >& _rxPicker ) - { - implPushBackPicker( getFolderPickerHistory(), _rxPicker ); - } - - //--------------------------------------------------------------------- - void addFilePicker( const Reference< XInterface >& _rxPicker ) - { - implPushBackPicker( getFilePickerHistory(), _rxPicker ); - } - -//......................................................................... -} // namespace svt -//......................................................................... - diff --git a/svtools/source/filerec/filerec.cxx b/svtools/source/filerec/filerec.cxx deleted file mode 100644 index 262e5135572a..000000000000 --- a/svtools/source/filerec/filerec.cxx +++ /dev/null @@ -1,1019 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: filerec.cxx,v $ - * $Revision: 1.13 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -#include - -//======================================================================== - -SV_IMPL_VARARR( SfxUINT32s, UINT32 ); - -//======================================================================== - -/* Die folgenden Makros extrahieren Teilbereiche aus einem UINT32 Wert. - Diese UINT32-Werte werden anstelle der einzelnen Werte gestreamt, - um Calls zu sparen. -*/ - -#define SFX_REC_PRE(n) ( ((n) & 0x000000FF) ) -#define SFX_REC_OFS(n) ( ((n) & 0xFFFFFF00) >> 8 ) -#define SFX_REC_TYP(n) ( ((n) & 0x000000FF) ) -#define SFX_REC_VER(n) ( ((n) & 0x0000FF00) >> 8 ) -#define SFX_REC_TAG(n) ( ((n) & 0xFFFF0000) >> 16 ) - -#define SFX_REC_CONTENT_VER(n) ( ((n) & 0x000000FF) ) -#define SFX_REC_CONTENT_OFS(n) ( ((n) & 0xFFFFFF00) >> 8 ) - -//------------------------------------------------------------------------- - -/* Die folgenden Makros setzen Teilbereiche zu einem UINT32 Wert zusammen. - Diese UINT32-Werte werden anstelle der einzelnen Werte gestreamt, - um Calls zu sparen. -*/ - -#define SFX_REC_MINI_HEADER(nPreTag,nStartPos,nEndPos) \ - ( UINT32(nPreTag) | \ - UINT32(nEndPos-nStartPos-SFX_REC_HEADERSIZE_MINI) << 8 ) - -#define SFX_REC_HEADER(nRecType,nContentTag,nContentVer) \ - ( UINT32(nRecType) | \ - ( UINT32(nContentVer) << 8 ) | \ - ( UINT32(nContentTag) << 16 ) ) - -#define SFX_REC_CONTENT_HEADER(nContentVer,n1StStartPos,nCurStartPos) \ - ( UINT32(nContentVer) | \ - UINT32( nCurStartPos - n1StStartPos ) << 8 ) - -//========================================================================= - -UINT32 SfxMiniRecordWriter::Close -( - FASTBOOL bSeekToEndOfRec /* TRUE (default) - Der Stream wird an das Ende des Records - positioniert. - - FALSE - Der Stream wird an den Anfang des - Contents (also hinter den Header) - positioniert. - */ -) - -/* [Beschreibung] - - Diese Methode schlie\st den Record. Dabei wird haupts"achlich der - Header geschrieben. - - Wurde der Header bereits geschrieben, hat der Aufruf keine Wirkung. - - - [R"uckgabewert] - - UINT32 != 0 - Position im Stream, die direkt hinter dem Record liegt. - 'bSeekToEndOfRecord==TRUE' - => R"uckgabewert == aktuelle Stream-Position nach Aufruf - - == 0 - Der Header war bereits geschrieben worden. -*/ - -{ - // wurde der Header noch nicht geschrieben? - if ( !_bHeaderOk ) - { - // Header an den Anfang des Records schreiben - UINT32 nEndPos = _pStream->Tell(); - _pStream->Seek( _nStartPos ); - *_pStream << SFX_REC_MINI_HEADER( _nPreTag, _nStartPos, nEndPos ); - - // je nachdem ans Ende des Records seeken oder hinter Header bleiben - if ( bSeekToEndOfRec ) - _pStream->Seek( nEndPos ); - - // Header wurde JETZT geschrieben - _bHeaderOk = TRUE; - return nEndPos; - } -#ifdef DBG_UTIL - // mu\s Fix-Size-Record gepr"uft werden? - else if ( SFX_BOOL_DONTCARE == _bHeaderOk ) - { - // Header auslesen, um Soll-Gr"o\se zu bestimmen - UINT32 nEndPos = _pStream->Tell(); - _pStream->Seek( _nStartPos ); - UINT32 nHeader; - *_pStream >> nHeader; - _pStream->Seek( nEndPos ); - - // Soll-Gr"o\se mit Ist-Gr"o\se vergleichen - DBG_ASSERT( nEndPos - SFX_REC_OFS(nHeader) == _nStartPos + sizeof(UINT32), - "fixed record size incorrect" ); - DbgOutf( "SfxFileRec: written record until %ul", nEndPos ); - } -#endif - - // Record war bereits geschlossen - return 0; -} - -//========================================================================= - -USHORT SfxMiniRecordReader::ScanRecordType -( - SvStream* pStream /* an dessen aktueller Position - ein Record liegt, dessen Typ erkannt werden - soll. - */ -) - -/* [Beschreibung] - - Mit dieser statischen Methode kann ermittelt werden, ob sich an der - aktuellen Position in einem Stream ein Record befindet, und der Typ - des Records kann ermittelt werden. - - Die Position im Stream ist nach dem Aufruf aufver"andert. - - - [Anmerkung] - - Die Record-Typen k"onnen zwar (abgesehen vom Drawing-Enginge-Record) - untereinander eindeutig erkannt werden, es besteht jedoch die Gefahr - der Verwechslung von Records mit normalen Daten. File-Formate sollten - darauf R"ucksicht nehmen. Handelt es sich um keinen Record, wird - am wahrscheinlichsten SFX_REC_TYPE_MINI zur"uckgeliefert, da dieser - Typ sich aufgrund seines sparsam kurzen Headers durch die k"urzeste - Kennung auszeichnet. - - - [R"uckgabewert] - - USHORT SFX_REC_TYPE_EOR - An der aktuellen Position des Streams - steht eine End-Of-Records-Kennung. - - SFX_REC_TYPE_MINI - Es handelt sich um einen SW3 kompatiblen - Mini-Record, dessen einzige Kennung sein - 'Mini-Tag' ist. - - SFX_REC_TYPE_SINGLE - Es handelt sich um einen Extended-Record - mit einem einzigen Content, der durch eine - Version und ein Tag n"aher gekennzeichnet - ist. - - SFX_REC_TYPE_FIXSIZE - Es handelt sich um einen Extended-Record - mit mehreren Contents gleicher Gr"o\se, - die gemeinsam durch eine einzige Version - und ein einziges gemeinsames Tag n"aher - gekennzeichnet sind. - - SFX_REC_TYPE_VARSIZE - Es handelt sich um einen Extended-Record - mit mehreren Contents variabler Gr"o\se, - die gemeinsam durch eine einzige Version - und ein einziges gemeinsames Tag n"aher - gekennzeichnet sind. - - SFX_REC_TYPE_MIXTAGS - Es handelt sich um einen Extended-Record - mit mehreren Contents variabler Gr"o\se, - die jeweils durch ein eignes Tag und - eine eigene Versions-Nummer n"aher - gekennzeichnet sind. - - SFX_REC_TYPE_DRAWENG - Es handelt sich wahrscheinlich um einen - Drawing-Engine-Record. Dieser Record-Typ - kann von den Klassen dieser Gruppe nicht - interpretiert werden. -*/ - -{ - // die ersten 4 Bytes als Mini-Header lesen - sal_uInt32 nHeader; - *pStream >> nHeader; - - // k"onnte es sich um einen extended-Record handeln? - USHORT nPreTag = sal::static_int_cast< USHORT >(SFX_REC_PRE(nHeader)); - if ( SFX_REC_PRETAG_EXT == nPreTag ) - { - // die n"achsten 4 Bytes als extended-Header lesen - *pStream >> nHeader; - - // Stream-Position restaurieren - pStream->SeekRel(-8); - - // liegt eine g"ultige Record-Kennung vor? - USHORT nType = sal::static_int_cast< USHORT >(SFX_REC_TYP(nHeader)); - if ( nType >= SFX_REC_TYPE_FIRST && nType <= SFX_REC_TYPE_LAST ) - // entsprechenden extended-Record-Typ zur"uckliefern - return nType; - - // sonst ist der Record-Typ unbekannt - return SFX_REC_TYPE_NONE; - } - - // Stream-Position restaurieren - pStream->SeekRel(-4); - - // liegt eine End-Of-Record-Kennung vor? - if ( SFX_REC_PRETAG_EOR == nPreTag ) - return nPreTag; - - // liegt ein Drawin-Engine-Record vor? - if ( nHeader == UINT32(*"DRMD") || nHeader == UINT32(*"DRVW") ) - return SFX_REC_TYPE_DRAWENG; - - // alle anderen sind grunds"atzlich g"ultige Mini-Records - return SFX_REC_TYPE_MINI; -} - -//------------------------------------------------------------------------- - -FASTBOOL SfxMiniRecordReader::SetHeader_Impl( UINT32 nHeader ) - -/* [Beschreibung] - - Interne Methode zum nachtr"aglichen Verarbeiten eines extern gelesenen - Headers. Falls der Header eine End-Of-Records-Kennung darstellt, - wird am Stream ein Errorcode gesetzt und FALSE zur"uckgeliefert. Im - Fehlerfall wird der Stream jedoch nicht auf den Record-Anfang zur"uck- - gesetzt. -*/ - -{ - FASTBOOL bRet = TRUE; - - // Record-Ende und Pre-Tag aus dem Header ermitteln - _nEofRec = _pStream->Tell() + SFX_REC_OFS(nHeader); - _nPreTag = sal::static_int_cast< BYTE >(SFX_REC_PRE(nHeader)); - - // wenn End-Of-Record-Kennung, dann Fehler - if ( _nPreTag == SFX_REC_PRETAG_EOR ) - { - _pStream->SetError( ERRCODE_IO_WRONGFORMAT ); - bRet = FALSE; - } - return bRet; -} - -//------------------------------------------------------------------------- - -SfxMiniRecordReader::SfxMiniRecordReader -( - SvStream* pStream /* , an dessen aktueller - Position sich ein - befindet. - */ -) - -/* [Beschreibung] - - Dieser Ctor liest den Header eines ab der aktuellen - Position von 'pStream'. Da grunds"atzlich fast 4-Byte Kombination ein - g"ultiger SfxMiniRecord-Header ist, bleiben die einzig m"oglichen - Fehler der EOF-Status des Streams, und ein SFX_REC_PRETAG_EOR - als Pre-Tag. Ein entsprechender Error-Code (ERRCODE_IO_EOF bzw. - ERRCODE_IO_WRONGFORMAT) ist dann am Stream gesetzt, dessen Position - dann au\serdem unver"andert ist. -*/ - -: _pStream( pStream ), - _bSkipped( FALSE ) -{ - // Header einlesen - UINT32 nStartPos = pStream->Tell(); // um im Fehlerfall zur"uck zu-seeken - DBG( DbgOutf( "SfxFileRec: reading record at %ul", nStartPos ) ); - UINT32 nHeader; - *pStream >> nHeader; - - // Headerdaten extrahieren - SetHeader_Impl( nHeader ); - - // Fehlerbehandlung - if ( pStream->IsEof() ) - _nPreTag = SFX_REC_PRETAG_EOR; - else if ( _nPreTag == SFX_REC_PRETAG_EOR ) - pStream->SetError( ERRCODE_IO_WRONGFORMAT ); - if ( !IsValid() ) - pStream->Seek( nStartPos ); -} - -//------------------------------------------------------------------------- - -SfxMiniRecordReader::SfxMiniRecordReader -( - SvStream* pStream, /* , an dessen aktueller - Position sich ein - befindet. - */ - BYTE nTag // Pre-Tag des gew"unschten Records -) - -/* [Beschreibung] - - Dieser Ctor interpretiert 'pStream' ab der aktuellen Position als - eine l"uckenlose Folge von, von dieser Klassen-Gruppe interpretierbaren, - Records. Der in dieser Folge erste als interpretierbare - (also ggf. auch ein extended-Record) mit dem PreTag 'nTag' wird ge"offnet - und durch diese Instanz repr"asentiert. - - Wird das Ende des Streams oder die Kennung SFX_REC_PRETAG_EOR - erreicht, bevor ein Record mit dem ge"unschten Pre-Tag gefunden wird, - ist die erzeugte Instanz ung"ultig ('IsValid() == FALSE'). Ein ent- - sprechender Error-Code (ERRCODE_IO_EOF bzw. ERRCODE_IO_WRONGFORMAT) - ist dann am Stream gesetzt, dessen Position ist dann au\serdem unver- - "andert. - - Bei 'nTag==SFX_FILEREC_PRETAG_EOR' wird nicht versucht, einen Record - zu lesen, es wird sofort 'IsValid()' auf FALSE gesetzt und kein Error-Code - am Stream gesetzt. Dies ist dauzu gedacht, ohne 'new' und 'delete' - abw"rtskompatibel SfxMiniRecords einbauen zu k"onnen. Siehe dazu - . - - - [Anwendungsvorschlag] - - Wird dieser Ctor in einer bereits ausgelieferten Programmversion - verwendet, k"onnen in das File-Format jeweils davor kompatibel neue - Records mit einer anderen Kennung eingef"ugt werden. Diese werden - schlie\slich automatisch "uberlesen. Erkauft wird diese M"oglichkeit - allerdings mit etwas schlechterem Laufzeitverhalten im Vergleich mit - direktem 'drauf-los-lesen', der sich jedoch auf einen Vergleich zweier - Bytes reduziert, falls der gesuchte Record der erste in der Folge ist. -*/ - -: _pStream( pStream ), - _bSkipped( nTag == SFX_REC_PRETAG_EOR ) -{ - // ggf. ignorieren (s.o.) - if ( _bSkipped ) - { - _nPreTag = nTag; - return; - } - - // StartPos merken, um im Fehlerfall zur"uck-seeken zu k"onnen - UINT32 nStartPos = pStream->Tell(); - - // passenden Record suchen - while(TRUE) - { - // Header lesen - DBG( DbgOutf( "SfxFileRec: searching record at %ul", pStream->Tell() ) ); - UINT32 nHeader; - *pStream >> nHeader; - - // Headerdaten von Basisklasse extrahieren lassen - SetHeader_Impl( nHeader ); - - // ggf. Fehler behandeln - if ( pStream->IsEof() ) - _nPreTag = SFX_REC_PRETAG_EOR; - else if ( _nPreTag == SFX_REC_PRETAG_EOR ) - pStream->SetError( ERRCODE_IO_WRONGFORMAT ); - else - { - // wenn gefunden, dann Schleife abbrechen - if ( _nPreTag == nTag ) - break; - - // sonst skippen und weitersuchen - pStream->Seek( _nEofRec ); - continue; - } - - // Fehler => zur"uck-seeken - pStream->Seek( nStartPos ); - break; - } -} - -//========================================================================= - -SfxSingleRecordWriter::SfxSingleRecordWriter -( - BYTE nRecordType, // f"ur Subklassen - SvStream* pStream, // Stream, in dem der Record angelegt wird - UINT16 nContentTag, // Inhalts-Art-Kennung - BYTE nContentVer // Inhalts-Versions-Kennung -) - -/* [Beschreibung] - - Interner Ctor f"ur Subklassen. -*/ - -: SfxMiniRecordWriter( pStream, SFX_REC_PRETAG_EXT ) -{ - // Erweiterten Header hiner den des SfxMiniRec schreiben - *pStream << SFX_REC_HEADER(nRecordType, nContentTag, nContentVer); -} - -//------------------------------------------------------------------------- - -SfxSingleRecordWriter::SfxSingleRecordWriter -( - SvStream* pStream, // Stream, in dem der Record angelegt wird - UINT16 nContentTag, // Inhalts-Art-Kennung - BYTE nContentVer // Inhalts-Versions-Kennung -) - -/* [Beschreibung] - - Legt in 'pStream' einen 'SfxSingleRecord' an, dessen Content-Gr"o\se - nicht bekannt ist, sondern nach dam Streamen des Contents errechnet - werden soll. -*/ - -: SfxMiniRecordWriter( pStream, SFX_REC_PRETAG_EXT ) -{ - // Erweiterten Header hiner den des SfxMiniRec schreiben - *pStream << SFX_REC_HEADER( SFX_REC_TYPE_SINGLE, nContentTag, nContentVer); -} - -//------------------------------------------------------------------------- - -SfxSingleRecordWriter::SfxSingleRecordWriter -( - SvStream* pStream, // Stream, in dem der Record angelegt wird - UINT16 nContentTag, // Inhalts-Art-Kennung - BYTE nContentVer, // Inhalts-Versions-Kennung - UINT32 nContentSize // Gr"o\se des Inhalts in Bytes -) - -/* [Beschreibung] - - Legt in 'pStream' einen 'SfxSingleRecord' an, dessen Content-Gr"o\se - von vornherein bekannt ist. -*/ - -: SfxMiniRecordWriter( pStream, SFX_REC_PRETAG_EXT, - nContentSize + SFX_REC_HEADERSIZE_SINGLE ) -{ - // Erweiterten Header hinter den des SfxMiniRec schreiben - *pStream << SFX_REC_HEADER( SFX_REC_TYPE_SINGLE, nContentTag, nContentVer); -} - -//========================================================================= - -inline FASTBOOL SfxSingleRecordReader::ReadHeader_Impl( USHORT nTypes ) - -/* [Beschreibung] - - Interne Methode zum Einlesen eines SfxMultiRecord-Headers, nachdem - die Basisklasse bereits initialisiert und deren Header gelesen ist. - Ggf. ist ein Error-Code am Stream gesetzt, im Fehlerfall wird jedoch - nicht zur"uckge-seekt. -*/ - -{ - FASTBOOL bRet; - - // Basisklassen-Header einlesen - UINT32 nHeader=0; - *_pStream >> nHeader; - if ( !SetHeader_Impl( nHeader ) ) - bRet = FALSE; - else - { - // eigenen Header einlesen - *_pStream >> nHeader; - _nRecordVer = sal::static_int_cast< BYTE >(SFX_REC_VER(nHeader)); - _nRecordTag = sal::static_int_cast< UINT16 >(SFX_REC_TAG(nHeader)); - - // falscher Record-Typ? - _nRecordType = sal::static_int_cast< BYTE >(SFX_REC_TYP(nHeader)); - bRet = 0 != ( nTypes & _nRecordType); - } - return bRet; -} - -//------------------------------------------------------------------------- - -SfxSingleRecordReader::SfxSingleRecordReader( SvStream *pStream ) -: SfxMiniRecordReader() -{ - // Startposition merken, um im Fehlerfall zur"uck-seeken zu k"onnen - #ifdef DBG_UTIL - UINT32 nStartPos = pStream->Tell(); - DBG( DbgOutf( "SfxFileRec: reading record at %ul", nStartPos ) ); - #endif - - // Basisklasse initialisieren (nicht via Ctor, da der nur MiniRecs akzept.) - Construct_Impl( pStream ); - - // nur Header mit korrektem Record-Type akzeptieren - if ( !ReadHeader_Impl( SFX_REC_TYPE_SINGLE ) ) - { - // Error-Code setzen und zur"uck-seeken - pStream->SeekRel( - SFX_REC_HEADERSIZE_SINGLE ); - pStream->SetError( ERRCODE_IO_WRONGFORMAT ); - } -} - -//------------------------------------------------------------------------- - -SfxSingleRecordReader::SfxSingleRecordReader( SvStream *pStream, USHORT nTag ) -{ - // StartPos merken, um im Fehlerfall zur"uck-seeken zu k"onnen - UINT32 nStartPos = pStream->Tell(); - - // richtigen Record suchen, ggf. Error-Code setzen und zur"uck-seeken - Construct_Impl( pStream ); - if ( !FindHeader_Impl( SFX_REC_TYPE_SINGLE, nTag ) ) - { - // Error-Code setzen und zur"uck-seeken - pStream->Seek( nStartPos ); - pStream->SetError( ERRCODE_IO_WRONGFORMAT ); - } -} - -//------------------------------------------------------------------------- - -FASTBOOL SfxSingleRecordReader::FindHeader_Impl -( - UINT16 nTypes, // arithm. Veroderung erlaubter Record-Typen - UINT16 nTag // zu findende Record-Art-Kennung -) - -/* [Beschreibung] - - Interne Methode zum lesen des Headers des ersten Record, der einem - der Typen in 'nTypes' entspricht und mit der Art-Kennung 'nTag' - gekennzeichnet ist. - - Kann ein solcher Record nicht gefunden werden, wird am Stream ein - Errorcode gesetzt, zur"uck-geseekt und FALSE zur"uckgeliefert. -*/ - -{ - // StartPos merken, um im Fehlerfall zur"uck-seeken zu k"onnen - UINT32 nStartPos = _pStream->Tell(); - - // richtigen Record suchen - while ( !_pStream->IsEof() ) - { - // Header lesen - UINT32 nHeader; - DBG( DbgOutf( "SfxFileRec: searching record at %ul", _pStream->Tell() ) ); - *_pStream >> nHeader; - if ( !SetHeader_Impl( nHeader ) ) - // EOR => Such-Schleife abbreichen - break; - - // Extended Record gefunden? - if ( _nPreTag == SFX_REC_PRETAG_EXT ) - { - // Extended Header lesen - *_pStream >> nHeader; - _nRecordTag = sal::static_int_cast< UINT16 >(SFX_REC_TAG(nHeader)); - - // richtigen Record gefunden? - if ( _nRecordTag == nTag ) - { - // gefundener Record-Typ passend? - _nRecordType = sal::static_int_cast< BYTE >( - SFX_REC_TYP(nHeader)); - if ( nTypes & _nRecordType ) - // ==> gefunden - return TRUE; - - // error => Such-Schleife abbrechen - break; - } - } - - // sonst skippen - if ( !_pStream->IsEof() ) - _pStream->Seek( _nEofRec ); - } - - // Fehler setzen und zur"uck-seeken - _pStream->SetError( ERRCODE_IO_WRONGFORMAT ); - _pStream->Seek( nStartPos ); - return FALSE; -} - -//========================================================================= - -SfxMultiFixRecordWriter::SfxMultiFixRecordWriter -( - BYTE nRecordType, // Subklassen Record-Kennung - SvStream* pStream, // Stream, in dem der Record angelegt wird - UINT16 nContentTag, // Content-Art-Kennung - BYTE nContentVer, // Content-Versions-Kennung - UINT32 // Gr"o\se jedes einzelnen Contents in Bytes -) - -/* [Beschreibung] - - Interne Methode f"ur Subklassen. -*/ - -: SfxSingleRecordWriter( nRecordType, pStream, nContentTag, nContentVer ), - _nContentCount( 0 ) -{ - // Platz f"ur eigenen Header - pStream->SeekRel( + SFX_REC_HEADERSIZE_MULTI ); -} - -//------------------------------------------------------------------------ - -SfxMultiFixRecordWriter::SfxMultiFixRecordWriter -( - SvStream* pStream, // Stream, in dem der Record angelegt wird - UINT16 nContentTag, // Content-Art-Kennung - BYTE nContentVer, // Content-Versions-Kennung - UINT32 // Gr"o\se jedes einzelnen Contents in Bytes -) - -/* [Beschreibung] - - Legt in 'pStream' einen 'SfxMultiFixRecord' an, dessen Content-Gr"o\se - konstant und von vornherein bekannt ist. -*/ - -: SfxSingleRecordWriter( SFX_REC_TYPE_FIXSIZE, - pStream, nContentTag, nContentVer ), - _nContentCount( 0 ) -{ - // Platz f"ur eigenen Header - pStream->SeekRel( + SFX_REC_HEADERSIZE_MULTI ); -} - -//------------------------------------------------------------------------ - -UINT32 SfxMultiFixRecordWriter::Close( FASTBOOL bSeekToEndOfRec ) - -// siehe - -{ - // Header noch nicht geschrieben? - if ( !_bHeaderOk ) - { - // Position hinter Record merken, um sie restaurieren zu k"onnen - UINT32 nEndPos = SfxSingleRecordWriter::Close( FALSE ); - - // gegen"uber SfxSingleRecord erweiterten Header schreiben - *_pStream << _nContentCount; - *_pStream << _nContentSize; - - // je nachdem ans Ende des Records seeken oder hinter Header bleiben - if ( bSeekToEndOfRec ) - _pStream->Seek(nEndPos); - return nEndPos; - } - - // Record war bereits geschlossen - return 0; -} - -//========================================================================= - -SfxMultiVarRecordWriter::SfxMultiVarRecordWriter -( - BYTE nRecordType, // Record-Kennung der Subklasse - SvStream* pStream, // Stream, in dem der Record angelegt wird - UINT16 nRecordTag, // Gesamt-Art-Kennung - BYTE nRecordVer // Gesamt-Versions-Kennung -) - -/* [Beschreibung] - - Interner Ctor f"ur Subklassen. -*/ - -: SfxMultiFixRecordWriter( nRecordType, pStream, nRecordTag, nRecordVer, 0 ), - _nContentVer( 0 ) -{ -} - -//------------------------------------------------------------------------- - -SfxMultiVarRecordWriter::SfxMultiVarRecordWriter -( - SvStream* pStream, // Stream, in dem der Record angelegt wird - UINT16 nRecordTag, // Gesamt-Art-Kennung - BYTE nRecordVer // Gesamt-Versions-Kennung -) - -/* [Beschreibung] - - Legt in 'pStream' einen 'SfxMultiVarRecord' an, dessen Content-Gr"o\sen - weder bekannt sind noch identisch sein m"ussen, sondern jeweils nach dem - Streamen jedes einzelnen Contents errechnet werden sollen. - - - [Anmerkung] - - Diese Methode ist nicht inline, da f"ur die Initialisierung eines - -Members zu viel Code generiert werden w"urde. -*/ - -: SfxMultiFixRecordWriter( SFX_REC_TYPE_VARSIZE, - pStream, nRecordTag, nRecordVer, 0 ), - _nContentVer( 0 ) -{ -} - -//------------------------------------------------------------------------- - -SfxMultiVarRecordWriter::~SfxMultiVarRecordWriter() - -/* [Beschreibung] - - Der Dtor der Klasse schlie\st den Record - automatisch, falls nicht bereits - explizit gerufen wurde. -*/ - -{ - // wurde der Header noch nicht geschrieben oder mu\s er gepr"uft werden - if ( !_bHeaderOk ) - Close(); -} - -//------------------------------------------------------------------------- - -void SfxMultiVarRecordWriter::FlushContent_Impl() - -/* [Beschreibung] - - Interne Methode zum Abschlie\sen eines einzelnen Contents. -*/ - -{ - // Versions-Kennung und Positions-Offset des aktuellen Contents merken; - // das Positions-Offset ist relativ zur Startposition des ersten Contents - _aContentOfs.Insert( - SFX_REC_CONTENT_HEADER(_nContentVer,_nStartPos,_nContentStartPos), - _nContentCount-1 ); -} - -//------------------------------------------------------------------------- - -void SfxMultiVarRecordWriter::NewContent() - -// siehe - -{ - // schon ein Content geschrieben? - if ( _nContentCount ) - FlushContent_Impl(); - - // neuen Content beginnen - _nContentStartPos = _pStream->Tell(); - ++_nContentCount; -} - -//------------------------------------------------------------------------- - -UINT32 SfxMultiVarRecordWriter::Close( FASTBOOL bSeekToEndOfRec ) - -// siehe - -{ - // Header noch nicht geschrieben? - if ( !_bHeaderOk ) - { - // ggf. letzten Content abschlie\sen - if ( _nContentCount ) - FlushContent_Impl(); - - // Content-Offset-Tabelle schreiben - UINT32 nContentOfsPos = _pStream->Tell(); - //! darf man das so einr"ucken? - #if defined(OSL_LITENDIAN) - _pStream->Write( _aContentOfs.GetData(), - sizeof(UINT32)*_nContentCount ); - #else - for ( USHORT n = 0; n < _nContentCount; ++n ) - *_pStream << UINT32(_aContentOfs[n]); - #endif - - // SfxMultiFixRecordWriter::Close() "uberspringen! - UINT32 nEndPos = SfxSingleRecordWriter::Close( FALSE ); - - // eigenen Header schreiben - *_pStream << _nContentCount; - if ( SFX_REC_TYPE_VARSIZE_RELOC == _nPreTag || - SFX_REC_TYPE_MIXTAGS_RELOC == _nPreTag ) - *_pStream << static_cast(nContentOfsPos - ( _pStream->Tell() + sizeof(UINT32) )); - else - *_pStream << nContentOfsPos; - - // ans Ende des Records seeken bzw. am Ende des Headers bleiben - if ( bSeekToEndOfRec ) - _pStream->Seek(nEndPos); - return nEndPos; - } - - // Record war bereits vorher geschlossen - return 0; -} - -//========================================================================= - -void SfxMultiMixRecordWriter::NewContent -( - UINT16 nContentTag, // Kennung f"ur die Art des Contents - BYTE nContentVer // Kennung f"ur die Version des Contents -) - -/* [Beschreibung] - - Mit dieser Methode wird in den Record ein neuer Content eingef"ugt - und dessen Content-Tag sowie dessen Content-Version angegeben. Jeder, - auch der 1. Record mu\s durch Aufruf dieser Methode eingeleitet werden. -*/ - -{ - // ggf. vorherigen Record abschlie\sen - if ( _nContentCount ) - FlushContent_Impl(); - - // Tag vor den Content schreiben, Version und Startposition merken - _nContentStartPos = _pStream->Tell(); - ++_nContentCount; - *_pStream << nContentTag; - _nContentVer = nContentVer; -} - -//========================================================================= - -FASTBOOL SfxMultiRecordReader::ReadHeader_Impl() - -/* [Beschreibung] - - Interne Methode zum Einlesen eines SfxMultiRecord-Headers, nachdem - die Basisklasse bereits initialisiert und deren Header gelesen ist. - Ggf. ist ein Error-Code am Stream gesetzt, im Fehlerfall wird jedoch - nicht zur"uckge-seekt. -*/ - -{ - // eigenen Header lesen - *_pStream >> _nContentCount; - *_pStream >> _nContentSize; // Fix: jedes einzelnen, Var|Mix: Tabellen-Pos. - - // mu\s noch eine Tabelle mit Content-Offsets geladen werden? - if ( _nRecordType != SFX_REC_TYPE_FIXSIZE ) - { - // Tabelle aus dem Stream einlesen - UINT32 nContentPos = _pStream->Tell(); - if ( _nRecordType == SFX_REC_TYPE_VARSIZE_RELOC || - _nRecordType == SFX_REC_TYPE_MIXTAGS_RELOC ) - _pStream->SeekRel( + _nContentSize ); - else - _pStream->Seek( _nContentSize ); - _pContentOfs = new UINT32[_nContentCount]; - //! darf man jetzt so einr"ucken - #if defined(OSL_LITENDIAN) - _pStream->Read( _pContentOfs, sizeof(UINT32)*_nContentCount ); - #else - for ( USHORT n = 0; n < _nContentCount; ++n ) - *_pStream >> _pContentOfs[n]; - #endif - _pStream->Seek( nContentPos ); - } - - // Header konnte gelesen werden, wenn am Stream kein Error gesetzt ist - return !_pStream->GetError(); -} - -//------------------------------------------------------------------------- - -SfxMultiRecordReader::SfxMultiRecordReader( SvStream *pStream ) -: _pContentOfs( NULL ), _nContentNo(0) -{ - // Position im Stream merken, um im Fehlerfall zur"uck-seeken zu k"onnen - _nStartPos = pStream->Tell(); - - // Basisklasse konstruieren (normaler Ctor w"urde nur SingleRecs lesen) - SfxSingleRecordReader::Construct_Impl( pStream ); - - // Header der Basisklasse lesen - if ( !SfxSingleRecordReader::ReadHeader_Impl( SFX_REC_TYPE_FIXSIZE | - SFX_REC_TYPE_VARSIZE | SFX_REC_TYPE_VARSIZE_RELOC | - SFX_REC_TYPE_MIXTAGS | SFX_REC_TYPE_MIXTAGS_RELOC ) || - !ReadHeader_Impl() ) - // als ung"ultig markieren und zur"uck-seeken - SetInvalid_Impl( _nStartPos ); -} - -//------------------------------------------------------------------------- - -SfxMultiRecordReader::SfxMultiRecordReader( SvStream *pStream, UINT16 nTag ) -: _nContentNo(0) -{ - // Position im Stream merken, um im Fehlerfall zur"uck-seeken zu k"onnen - _nStartPos = pStream->Tell(); - - // passenden Record suchen und Basisklasse initialisieren - SfxSingleRecordReader::Construct_Impl( pStream ); - if ( SfxSingleRecordReader::FindHeader_Impl( SFX_REC_TYPE_FIXSIZE | - SFX_REC_TYPE_VARSIZE | SFX_REC_TYPE_VARSIZE_RELOC | - SFX_REC_TYPE_MIXTAGS | SFX_REC_TYPE_MIXTAGS_RELOC, - nTag ) ) - { - // eigenen Header dazu-lesen - if ( !ReadHeader_Impl() ) - // nicht lesbar => als ung"ultig markieren und zur"uck-seeken - SetInvalid_Impl( _nStartPos); - } -} - -//------------------------------------------------------------------------- - -SfxMultiRecordReader::~SfxMultiRecordReader() -{ - delete[] _pContentOfs; -} - -//------------------------------------------------------------------------- - -FASTBOOL SfxMultiRecordReader::GetContent() - -/* [Beschreibung] - - Positioniert den Stream an den Anfang des n"chsten bzw. beim 1. Aufruf - auf den Anfang des ersten Contents im Record und liest ggf. dessen - Header ein. - - Liegt laut Record-Header kein Content mehr vor, wird FALSE zur"uck- - gegeben. Trotz einem TRUE-Returnwert kann am Stream ein Fehlercode - gesetzt sein, z.B. falls er unvorhergesehenerweise (kaputtes File) - zuende ist. -*/ - -{ - // noch ein Content vorhanden? - if ( _nContentNo < _nContentCount ) - { - // den Stream an den Anfang des Contents positionieren - UINT32 nOffset = _nRecordType == SFX_REC_TYPE_FIXSIZE - ? _nContentNo * _nContentSize - : SFX_REC_CONTENT_OFS(_pContentOfs[_nContentNo]); - UINT32 nNewPos = _nStartPos + nOffset; - DBG_ASSERT( nNewPos >= _pStream->Tell(), "SfxMultiRecordReader::GetContent() - New position before current, to much data red!" ); - - // #99366#: correct stream pos in every case; - // the if clause was added by MT a long time ago, - // maybe to 'repair' other corrupt documents; but this - // gives errors when writing with 5.1 and reading with current - // versions, so we decided to remove the if clause (KA-05/17/2002) - // if ( nNewPos > _pStream->Tell() ) - _pStream->Seek( nNewPos ); - - // ggf. Content-Header lesen - if ( _nRecordType == SFX_REC_TYPE_MIXTAGS || - _nRecordType == SFX_REC_TYPE_MIXTAGS_RELOC ) - { - _nContentVer = sal::static_int_cast< BYTE >( - SFX_REC_CONTENT_VER(_pContentOfs[_nContentNo])); - *_pStream >> _nContentTag; - } - - // ContentNo weiterz"ahlen - ++_nContentNo; - return TRUE; - } - - return FALSE; -} - - diff --git a/svtools/source/filerec/makefile.mk b/svtools/source/filerec/makefile.mk deleted file mode 100644 index 33e4b4923183..000000000000 --- a/svtools/source/filerec/makefile.mk +++ /dev/null @@ -1,50 +0,0 @@ -#************************************************************************* -# -# 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 -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.6 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=svtools -TARGET=filerec - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svl.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/filerec.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/svtools/source/fsstor/exports.map b/svtools/source/fsstor/exports.map deleted file mode 100644 index f4ed78b9e970..000000000000 --- a/svtools/source/fsstor/exports.map +++ /dev/null @@ -1,8 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/svtools/source/fsstor/fsfactory.cxx b/svtools/source/fsstor/fsfactory.cxx deleted file mode 100644 index 33df962be846..000000000000 --- a/svtools/source/fsstor/fsfactory.cxx +++ /dev/null @@ -1,295 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: fsfactory.cxx,v $ - * $Revision: 1.10 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include "fsfactory.hxx" -#include "cppuhelper/factory.hxx" -#include -#include -#include -#include - - -#include -#include -#include - -#include -#include - -#include "fsstorage.hxx" - - -using namespace ::com::sun::star; - -//------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > SAL_CALL FSStorageFactory::impl_staticGetSupportedServiceNames() -{ - uno::Sequence< ::rtl::OUString > aRet(2); - aRet[0] = ::rtl::OUString::createFromAscii("com.sun.star.embed.FileSystemStorageFactory"); - aRet[1] = ::rtl::OUString::createFromAscii("com.sun.star.comp.embed.FileSystemStorageFactory"); - return aRet; -} - -//------------------------------------------------------------------------- -::rtl::OUString SAL_CALL FSStorageFactory::impl_staticGetImplementationName() -{ - return ::rtl::OUString::createFromAscii("com.sun.star.comp.embed.FileSystemStorageFactory"); -} - -//------------------------------------------------------------------------- -uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::impl_staticCreateSelfInstance( - const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) -{ - return uno::Reference< uno::XInterface >( *new FSStorageFactory( xServiceManager ) ); -} - -//------------------------------------------------------------------------- -uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::createInstance() - throw ( uno::Exception, - uno::RuntimeException ) -{ - ::rtl::OUString aTempURL; - - aTempURL = ::utl::TempFile( NULL, sal_True ).GetURL(); - - if ( !aTempURL.getLength() ) - throw uno::RuntimeException(); // TODO: can not create tempfile - - ::ucbhelper::Content aResultContent( - aTempURL, uno::Reference< ucb::XCommandEnvironment >() ); - - return uno::Reference< uno::XInterface >( - static_cast< OWeakObject* >( - new FSStorage( aResultContent, - embed::ElementModes::READWRITE, - uno::Sequence< beans::PropertyValue >(), - m_xFactory ) ), - uno::UNO_QUERY ); -} - -//------------------------------------------------------------------------- -uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::createInstanceWithArguments( - const uno::Sequence< uno::Any >& aArguments ) - throw ( uno::Exception, - uno::RuntimeException ) -{ - // The request for storage can be done with up to three arguments - - // The first argument specifies a source for the storage - // it must be URL. - // The second value is a mode the storage should be open in. - // And the third value is a media descriptor. - - sal_Int32 nArgNum = aArguments.getLength(); - OSL_ENSURE( nArgNum < 4, "Wrong parameter number" ); - - if ( !nArgNum ) - return createInstance(); - - // first try to retrieve storage open mode if any - // by default the storage will be open in readonly mode - sal_Int32 nStorageMode = embed::ElementModes::READ; - if ( nArgNum >= 2 ) - { - if( !( aArguments[1] >>= nStorageMode ) ) - { - OSL_ENSURE( sal_False, "Wrong second argument!\n" ); - throw uno::Exception(); // TODO: Illegal argument - } - // it's allways possible to read written storage in this implementation - nStorageMode |= embed::ElementModes::READ; - } - - // retrieve storage source URL - ::rtl::OUString aURL; - - if ( aArguments[0] >>= aURL ) - { - if ( !aURL.getLength() ) - { - OSL_ENSURE( sal_False, "Empty URL is provided!\n" ); - throw uno::Exception(); // TODO: illegal argument - } - } - else - { - OSL_ENSURE( sal_False, "Wrong first argument!\n" ); - throw uno::Exception(); // TODO: Illegal argument - } - - // retrieve mediadescriptor and set storage properties - uno::Sequence< beans::PropertyValue > aDescr; - uno::Sequence< beans::PropertyValue > aPropsToSet; - - if ( nArgNum >= 3 ) - { - if( aArguments[2] >>= aDescr ) - { - aPropsToSet.realloc(1); - aPropsToSet[0].Name = ::rtl::OUString::createFromAscii( "URL" ); - aPropsToSet[0].Value <<= aURL; - - for ( sal_Int32 nInd = 0, nNumArgs = 1; nInd < aDescr.getLength(); nInd++ ) - { - if ( aDescr[nInd].Name.equalsAscii( "InteractionHandler" ) ) - { - aPropsToSet.realloc( ++nNumArgs ); - aPropsToSet[nNumArgs-1].Name = aDescr[nInd].Name; - aPropsToSet[nNumArgs-1].Value = aDescr[nInd].Value; - break; - } - else - OSL_ENSURE( sal_False, "Unacceptable property, will be ignored!\n" ); - } - } - else - { - OSL_ENSURE( sal_False, "Wrong third argument!\n" ); - throw uno::Exception(); // TODO: Illegal argument - } - } - - // allow to use other ucp's - // if ( !isLocalNotFile_Impl( aURL ) ) - if ( aURL.equalsIgnoreAsciiCaseAsciiL( "vnd.sun.star.pkg", 16 ) - || aURL.equalsIgnoreAsciiCaseAsciiL( "vnd.sun.star.zip", 16 ) - || ::utl::UCBContentHelper::IsDocument( aURL ) ) - { - OSL_ENSURE( sal_False, "File system storages can be based only on file URLs!\n" ); // ??? - throw uno::Exception(); // TODO: illegal argument - } - - if ( ( nStorageMode & embed::ElementModes::WRITE ) && !( nStorageMode & embed::ElementModes::NOCREATE ) ) - FSStorage::MakeFolderNoUI( aURL, sal_False ); - else if ( !::utl::UCBContentHelper::IsFolder( aURL ) ) - throw io::IOException(); // there is no such folder - - ::ucbhelper::Content aResultContent( - aURL, uno::Reference< ucb::XCommandEnvironment >() ); - - // create storage based on source - return uno::Reference< uno::XInterface >( - static_cast< OWeakObject* >( new FSStorage( aResultContent, - nStorageMode, - aPropsToSet, - m_xFactory ) ), - uno::UNO_QUERY ); -} - -//------------------------------------------------------------------------- -::rtl::OUString SAL_CALL FSStorageFactory::getImplementationName() - throw ( uno::RuntimeException ) -{ - return impl_staticGetImplementationName(); -} - -//------------------------------------------------------------------------- -sal_Bool SAL_CALL FSStorageFactory::supportsService( const ::rtl::OUString& ServiceName ) - throw ( uno::RuntimeException ) -{ - uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames(); - - for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ ) - if ( ServiceName.compareTo( aSeq[nInd] ) == 0 ) - return sal_True; - - return sal_False; -} - -//------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > SAL_CALL FSStorageFactory::getSupportedServiceNames() - throw ( uno::RuntimeException ) -{ - return impl_staticGetSupportedServiceNames(); -} - -//------------------------------------------------------------------------- - -extern "C" -{ -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( - void * /* pServiceManager */, void * pRegistryKey) -{ - if (pRegistryKey) - { - uno::Reference< registry::XRegistryKey > xRegistryKey ( - reinterpret_cast< registry::XRegistryKey*>(pRegistryKey)); - - uno::Reference< registry::XRegistryKey > xNewKey; - xNewKey = xRegistryKey->createKey( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + - FSStorageFactory::impl_staticGetImplementationName() + - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES"))); - - const uno::Sequence< ::rtl::OUString > aServices ( - FSStorageFactory::impl_staticGetSupportedServiceNames()); - for( sal_Int32 i = 0; i < aServices.getLength(); i++ ) - xNewKey->createKey( aServices.getConstArray()[i] ); - - return sal_True; - } - return sal_False; -} - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( - const sal_Char * pImplementationName, void * pServiceManager, void * /* pRegistryKey */) -{ - void * pResult = 0; - if (pServiceManager) - { - uno::Reference< lang::XSingleServiceFactory > xFactory; - if (FSStorageFactory::impl_staticGetImplementationName().compareToAscii (pImplementationName) == 0) - { - xFactory = cppu::createOneInstanceFactory ( - reinterpret_cast< lang::XMultiServiceFactory* >(pServiceManager), - FSStorageFactory::impl_staticGetImplementationName(), - FSStorageFactory::impl_staticCreateSelfInstance, - FSStorageFactory::impl_staticGetSupportedServiceNames() ); - } - if (xFactory.is()) - { - xFactory->acquire(); - pResult = xFactory.get(); - } - } - return pResult; -} - -} // extern "C" - diff --git a/svtools/source/fsstor/fsstorage.cxx b/svtools/source/fsstor/fsstorage.cxx deleted file mode 100644 index cec018533a9a..000000000000 --- a/svtools/source/fsstor/fsstorage.cxx +++ /dev/null @@ -1,1617 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: fsstorage.cxx,v $ - * $Revision: 1.11 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -#include -#include -#include -#include -#include - -#ifndef _COM_SUN_STAR_UCB_INTERACTIVEIODEXCEPTION_HPP_ -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#ifndef _COMPHELPER_PROCESSFACTORY_HXX -#include -#endif -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "fsstorage.hxx" -#include "oinputstreamcontainer.hxx" -#include "ostreamcontainer.hxx" - -using namespace ::com::sun::star; - -//========================================================= - -// TODO: move to a standard helper -sal_Bool isLocalFile_Impl( ::rtl::OUString aURL ) -{ - ::rtl::OUString aSystemPath; - ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get(); - if ( !pBroker ) - throw uno::RuntimeException(); - - uno::Reference< ucb::XContentProviderManager > xManager = - pBroker->getContentProviderManagerInterface(); - try - { - aSystemPath = ::ucbhelper::getSystemPathFromFileURL( xManager, aURL ); - } - catch ( uno::Exception& ) - { - } - - return ( aSystemPath.getLength() != 0 ); -} - - -//========================================================= - -struct FSStorage_Impl -{ - ::rtl::OUString m_aURL; - - ::ucbhelper::Content* m_pContent; - sal_Int32 m_nMode; - - ::cppu::OInterfaceContainerHelper* m_pListenersContainer; // list of listeners - ::cppu::OTypeCollection* m_pTypeCollection; - - uno::Reference< lang::XMultiServiceFactory > m_xFactory; - - - FSStorage_Impl( const ::rtl::OUString& aURL, sal_Int32 nMode, uno::Reference< lang::XMultiServiceFactory > xFactory ) - : m_aURL( aURL ) - , m_pContent( NULL ) - , m_nMode( nMode ) - , m_pListenersContainer( NULL ) - , m_pTypeCollection( NULL ) - , m_xFactory( xFactory ) - { - OSL_ENSURE( m_aURL.getLength(), "The URL must not be empty" ); - } - - FSStorage_Impl( const ::ucbhelper::Content& aContent, sal_Int32 nMode, uno::Reference< lang::XMultiServiceFactory > xFactory ) - : m_aURL( aContent.getURL() ) - , m_pContent( new ::ucbhelper::Content( aContent ) ) - , m_nMode( nMode ) - , m_pListenersContainer( NULL ) - , m_pTypeCollection( NULL ) - , m_xFactory( xFactory ) - { - OSL_ENSURE( m_aURL.getLength(), "The URL must not be empty" ); - } - - ~FSStorage_Impl(); -}; - -//========================================================= - -FSStorage_Impl::~FSStorage_Impl() -{ - if ( m_pListenersContainer ) - delete m_pListenersContainer; - if ( m_pTypeCollection ) - delete m_pTypeCollection; - if ( m_pContent ) - delete m_pContent; -} - -//===================================================== -// FSStorage implementation -//===================================================== - -//----------------------------------------------- -FSStorage::FSStorage( const ::ucbhelper::Content& aContent, - sal_Int32 nMode, - uno::Sequence< beans::PropertyValue >, - uno::Reference< lang::XMultiServiceFactory > xFactory ) -: m_pImpl( new FSStorage_Impl( aContent, nMode, xFactory ) ) -{ - // TODO: use properties - if ( !xFactory.is() ) - throw uno::RuntimeException(); - - GetContent(); -} - -//----------------------------------------------- -FSStorage::~FSStorage() -{ - { - ::osl::MutexGuard aGuard( m_aMutex ); - m_refCount++; // to call dispose - try { - dispose(); - } - catch( uno::RuntimeException& ) - {} - } -} - -//----------------------------------------------- -sal_Bool FSStorage::MakeFolderNoUI( const String& rFolder, sal_Bool ) -{ - INetURLObject aURL( rFolder ); - ::rtl::OUString aTitle = aURL.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); - aURL.removeSegment(); - ::ucbhelper::Content aParent; - ::ucbhelper::Content aResultContent; - - if ( ::ucbhelper::Content::create( aURL.GetMainURL( INetURLObject::NO_DECODE ), - uno::Reference< ucb::XCommandEnvironment >(), - aParent ) ) - return ::utl::UCBContentHelper::MakeFolder( aParent, aTitle, aResultContent, sal_False ); - - return sal_False; -} - -//----------------------------------------------- -::ucbhelper::Content* FSStorage::GetContent() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !m_pImpl->m_pContent ) - { - uno::Reference< ucb::XCommandEnvironment > xDummyEnv; - - try - { - m_pImpl->m_pContent = new ::ucbhelper::Content( m_pImpl->m_aURL, xDummyEnv ); - } - catch( uno::Exception& ) - { - } - } - - return m_pImpl->m_pContent; -} - -//----------------------------------------------- -void FSStorage::CopyStreamToSubStream( const ::rtl::OUString& aSourceURL, - const uno::Reference< embed::XStorage >& xDest, - const ::rtl::OUString& aNewEntryName ) -{ - if ( !xDest.is() ) - throw uno::RuntimeException(); - - uno::Reference< ucb::XCommandEnvironment > xDummyEnv; - ::ucbhelper::Content aSourceContent( aSourceURL, xDummyEnv ); - uno::Reference< io::XInputStream > xSourceInput = aSourceContent.openStream(); - - if ( !xSourceInput.is() ) - throw io::IOException(); // TODO: error handling - - uno::Reference< io::XStream > xSubStream = xDest->openStreamElement( - aNewEntryName, - embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE ); - if ( !xSubStream.is() ) - throw uno::RuntimeException(); - - uno::Reference< io::XOutputStream > xDestOutput = xSubStream->getOutputStream(); - if ( !xDestOutput.is() ) - throw uno::RuntimeException(); - - ::comphelper::OStorageHelper::CopyInputToOutput( xSourceInput, xDestOutput ); - xDestOutput->closeOutput(); -} - -//----------------------------------------------- -void FSStorage::CopyContentToStorage_Impl( ::ucbhelper::Content* pContent, const uno::Reference< embed::XStorage >& xDest ) -{ - if ( !pContent ) - throw uno::RuntimeException(); - - // get list of contents of the Content - // create cursor for access to children - uno::Sequence< ::rtl::OUString > aProps( 2 ); - ::rtl::OUString* pProps = aProps.getArray(); - pProps[0] = ::rtl::OUString::createFromAscii( "TargetURL" ); - pProps[1] = ::rtl::OUString::createFromAscii( "IsFolder" ); - ::ucbhelper::ResultSetInclude eInclude = ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS; - - try - { - uno::Reference< sdbc::XResultSet > xResultSet = pContent->createCursor( aProps, eInclude ); - uno::Reference< ucb::XContentAccess > xContentAccess( xResultSet, uno::UNO_QUERY ); - uno::Reference< sdbc::XRow > xRow( xResultSet, uno::UNO_QUERY ); - if ( xResultSet.is() ) - { - // go through the list: insert files as streams, insert folders as substorages using recursion - while ( xResultSet->next() ) - { - ::rtl::OUString aSourceURL( xRow->getString( 1 ) ); - sal_Bool bIsFolder( xRow->getBoolean(2) ); - - // TODO/LATER: not sure whether the entry name must be encoded - ::rtl::OUString aNewEntryName( INetURLObject( aSourceURL ).getName( INetURLObject::LAST_SEGMENT, - true, - INetURLObject::NO_DECODE ) ); - if ( bIsFolder ) - { - uno::Reference< embed::XStorage > xSubStorage = xDest->openStorageElement( aNewEntryName, - embed::ElementModes::READWRITE ); - if ( !xSubStorage.is() ) - throw uno::RuntimeException(); - - uno::Reference< ucb::XCommandEnvironment > xDummyEnv; - ::ucbhelper::Content aSourceContent( aSourceURL, xDummyEnv ); - CopyContentToStorage_Impl( &aSourceContent, xSubStorage ); - } - else - { - CopyStreamToSubStream( aSourceURL, xDest, aNewEntryName ); - } - } - } - - uno::Reference< embed::XTransactedObject > xTransact( xDest, uno::UNO_QUERY ); - if ( xTransact.is() ) - xTransact->commit(); - } - catch( ucb::InteractiveIOException& r ) - { - if ( r.Code == ucb::IOErrorCode_NOT_EXISTING ) - OSL_ENSURE( sal_False, "The folder does not exist!\n" ); - else - throw; - } -} - -//____________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________ - -//----------------------------------------------- -uno::Any SAL_CALL FSStorage::queryInterface( const uno::Type& rType ) - throw( uno::RuntimeException ) -{ - uno::Any aReturn; - aReturn <<= ::cppu::queryInterface - ( rType - , static_cast ( this ) - , static_cast ( this ) - , static_cast ( this ) - , static_cast ( this ) - , static_cast ( this ) - , static_cast ( this ) - , static_cast ( this ) ); - - if ( aReturn.hasValue() == sal_True ) - return aReturn ; - - return OWeakObject::queryInterface( rType ); -} - -//----------------------------------------------- -void SAL_CALL FSStorage::acquire() throw() -{ - OWeakObject::acquire(); -} - -//----------------------------------------------- -void SAL_CALL FSStorage::release() throw() -{ - OWeakObject::release(); -} - -//____________________________________________________________________________________________________ -// XTypeProvider -//____________________________________________________________________________________________________ - -//----------------------------------------------- -uno::Sequence< uno::Type > SAL_CALL FSStorage::getTypes() - throw( uno::RuntimeException ) -{ - if ( m_pImpl->m_pTypeCollection == NULL ) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_pImpl->m_pTypeCollection == NULL ) - { - m_pImpl->m_pTypeCollection = new ::cppu::OTypeCollection - ( ::getCppuType( ( const uno::Reference< lang::XTypeProvider >* )NULL ) - , ::getCppuType( ( const uno::Reference< embed::XStorage >* )NULL ) - , ::getCppuType( ( const uno::Reference< embed::XHierarchicalStorageAccess >* )NULL ) - , ::getCppuType( ( const uno::Reference< beans::XPropertySet >* )NULL ) ); - } - } - - return m_pImpl->m_pTypeCollection->getTypes() ; -} - -//----------------------------------------------- -uno::Sequence< sal_Int8 > SAL_CALL FSStorage::getImplementationId() - throw( uno::RuntimeException ) -{ - static ::cppu::OImplementationId* pID = NULL ; - - if ( pID == NULL ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ) ; - - if ( pID == NULL ) - { - static ::cppu::OImplementationId aID( sal_False ) ; - pID = &aID ; - } - } - - return pID->getImplementationId() ; - -} - -//____________________________________________________________________________________________________ -// XStorage -//____________________________________________________________________________________________________ - -//----------------------------------------------- -void SAL_CALL FSStorage::copyToStorage( const uno::Reference< embed::XStorage >& xDest ) - throw ( embed::InvalidStorageException, - io::IOException, - lang::IllegalArgumentException, - embed::StorageWrappedTargetException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - if ( !xDest.is() || xDest == uno::Reference< uno::XInterface >( static_cast< OWeakObject*> ( this ), uno::UNO_QUERY ) ) - throw lang::IllegalArgumentException(); // TODO: - - if ( !GetContent() ) - throw io::IOException(); // TODO: error handling - - try - { - CopyContentToStorage_Impl( GetContent(), xDest ); - } - catch( embed::InvalidStorageException& ) - { - throw; - } - catch( lang::IllegalArgumentException& ) - { - throw; - } - catch( embed::StorageWrappedTargetException& ) - { - throw; - } - catch( io::IOException& ) - { - throw; - } - catch( uno::RuntimeException& ) - { - throw; - } - catch( uno::Exception& ) - { - uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy raw stream" ), - uno::Reference< io::XInputStream >(), - aCaught ); - } -} - -//----------------------------------------------- -uno::Reference< io::XStream > SAL_CALL FSStorage::openStreamElement( - const ::rtl::OUString& aStreamName, sal_Int32 nOpenMode ) - throw ( embed::InvalidStorageException, - lang::IllegalArgumentException, - packages::WrongPasswordException, - io::IOException, - embed::StorageWrappedTargetException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - if ( !GetContent() ) - throw io::IOException(); // TODO: error handling - - // TODO/LATER: may need possibility to create folder if it was removed, since the folder can not be locked - INetURLObject aFileURL( m_pImpl->m_aURL ); - aFileURL.Append( aStreamName ); - - if ( ::utl::UCBContentHelper::IsFolder( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) - throw io::IOException(); - - if ( ( nOpenMode & embed::ElementModes::NOCREATE ) - && !::utl::UCBContentHelper::IsDocument( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) - throw io::IOException(); // TODO: - - uno::Reference< ucb::XCommandEnvironment > xDummyEnv; // TODO: provide InteractionHandler if any - uno::Reference< io::XStream > xResult; - try - { - if ( nOpenMode & embed::ElementModes::WRITE ) - { - if ( isLocalFile_Impl( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) - { - uno::Reference< ucb::XSimpleFileAccess > xSimpleFileAccess( - m_pImpl->m_xFactory->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) ) ), - uno::UNO_QUERY_THROW ); - xResult = xSimpleFileAccess->openFileReadWrite( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ); - } - else - { - // TODO: test whether it really works for http and fwp - SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( aFileURL.GetMainURL( INetURLObject::NO_DECODE ), - STREAM_STD_WRITE ); - if ( pStream ) - { - if ( !pStream->GetError() ) - xResult = uno::Reference < io::XStream >( new ::utl::OStreamWrapper( *pStream ) ); - else - delete pStream; - } - } - - if ( !xResult.is() ) - throw io::IOException(); - - if ( ( nOpenMode & embed::ElementModes::TRUNCATE ) ) - { - uno::Reference< io::XTruncate > xTrunc( xResult->getOutputStream(), uno::UNO_QUERY_THROW ); - xTrunc->truncate(); - } - } - else - { - if ( ( nOpenMode & embed::ElementModes::TRUNCATE ) - || !::utl::UCBContentHelper::IsDocument( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) - throw io::IOException(); // TODO: access denied - - ::ucbhelper::Content aResultContent( aFileURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv ); - uno::Reference< io::XInputStream > xInStream = aResultContent.openStream(); - xResult = static_cast< io::XStream* >( new OFSInputStreamContainer( xInStream ) ); - } - } - catch( embed::InvalidStorageException& ) - { - throw; - } - catch( lang::IllegalArgumentException& ) - { - throw; - } - catch( packages::WrongPasswordException& ) - { - throw; - } - catch( embed::StorageWrappedTargetException& ) - { - throw; - } - catch( io::IOException& ) - { - throw; - } - catch( uno::RuntimeException& ) - { - throw; - } - catch( uno::Exception& ) - { - uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy raw stream" ), - uno::Reference< io::XInputStream >(), - aCaught ); - } - - return xResult; -} - -//----------------------------------------------- -uno::Reference< io::XStream > SAL_CALL FSStorage::openEncryptedStreamElement( - const ::rtl::OUString&, sal_Int32, const ::rtl::OUString& ) - throw ( embed::InvalidStorageException, - lang::IllegalArgumentException, - packages::NoEncryptionException, - packages::WrongPasswordException, - io::IOException, - embed::StorageWrappedTargetException, - uno::RuntimeException ) -{ - throw packages::NoEncryptionException(); -} - -//----------------------------------------------- -uno::Reference< embed::XStorage > SAL_CALL FSStorage::openStorageElement( - const ::rtl::OUString& aStorName, sal_Int32 nStorageMode ) - throw ( embed::InvalidStorageException, - lang::IllegalArgumentException, - io::IOException, - embed::StorageWrappedTargetException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - if ( !GetContent() ) - throw io::IOException(); // TODO: error handling - - if ( ( nStorageMode & embed::ElementModes::WRITE ) - && !( m_pImpl->m_nMode & embed::ElementModes::WRITE ) ) - throw io::IOException(); // TODO: error handling - - // TODO/LATER: may need possibility to create folder if it was removed, since the folder can not be locked - INetURLObject aFolderURL( m_pImpl->m_aURL ); - aFolderURL.Append( aStorName ); - - sal_Bool bFolderExists = ::utl::UCBContentHelper::IsFolder( aFolderURL.GetMainURL( INetURLObject::NO_DECODE ) ); - if ( !bFolderExists && ::utl::UCBContentHelper::IsDocument( aFolderURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) - throw io::IOException(); // TODO: - - if ( ( nStorageMode & embed::ElementModes::NOCREATE ) && !bFolderExists ) - throw io::IOException(); // TODO: - - uno::Reference< ucb::XCommandEnvironment > xDummyEnv; // TODO: provide InteractionHandler if any - uno::Reference< embed::XStorage > xResult; - try - { - if ( nStorageMode & embed::ElementModes::WRITE ) - { - if ( ( nStorageMode & embed::ElementModes::TRUNCATE ) && bFolderExists ) - { - ::utl::UCBContentHelper::Kill( aFolderURL.GetMainURL( INetURLObject::NO_DECODE ) ); - bFolderExists = - MakeFolderNoUI( aFolderURL.GetMainURL( INetURLObject::NO_DECODE ), sal_True ); // TODO: not atomar :( - } - else if ( !bFolderExists ) - { - bFolderExists = - MakeFolderNoUI( aFolderURL.GetMainURL( INetURLObject::NO_DECODE ), sal_True ); // TODO: not atomar :( - } - } - else if ( ( nStorageMode & embed::ElementModes::TRUNCATE ) ) - throw io::IOException(); // TODO: access denied - - if ( !bFolderExists ) - throw io::IOException(); // there is no such folder - - ::ucbhelper::Content aResultContent( aFolderURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv ); - xResult = uno::Reference< embed::XStorage >( - static_cast< OWeakObject* >( new FSStorage( aResultContent, - nStorageMode, - uno::Sequence< beans::PropertyValue >(), - m_pImpl->m_xFactory ) ), - uno::UNO_QUERY ); - } - catch( embed::InvalidStorageException& ) - { - throw; - } - catch( lang::IllegalArgumentException& ) - { - throw; - } - catch( embed::StorageWrappedTargetException& ) - { - throw; - } - catch( io::IOException& ) - { - throw; - } - catch( uno::RuntimeException& ) - { - throw; - } - catch( uno::Exception& ) - { - uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy raw stream" ), - uno::Reference< io::XInputStream >(), - aCaught ); - } - - return xResult; -} - -//----------------------------------------------- -uno::Reference< io::XStream > SAL_CALL FSStorage::cloneStreamElement( const ::rtl::OUString& aStreamName ) - throw ( embed::InvalidStorageException, - lang::IllegalArgumentException, - packages::WrongPasswordException, - io::IOException, - embed::StorageWrappedTargetException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - if ( !GetContent() ) - throw io::IOException(); // TODO: error handling - - // TODO/LATER: may need possibility to create folder if it was removed, since the folder can not be locked - INetURLObject aFileURL( m_pImpl->m_aURL ); - aFileURL.Append( aStreamName ); - - uno::Reference < io::XStream > xTempResult; - try - { - uno::Reference< ucb::XCommandEnvironment > xDummyEnv; - ::ucbhelper::Content aResultContent( aFileURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv ); - uno::Reference< io::XInputStream > xInStream = aResultContent.openStream(); - - xTempResult = uno::Reference < io::XStream >( - m_pImpl->m_xFactory->createInstance ( ::rtl::OUString::createFromAscii( "com.sun.star.io.TempFile" ) ), - uno::UNO_QUERY_THROW ); - uno::Reference < io::XOutputStream > xTempOut = xTempResult->getOutputStream(); - uno::Reference < io::XInputStream > xTempIn = xTempResult->getInputStream(); - - if ( !xTempOut.is() || !xTempIn.is() ) - throw io::IOException(); - - ::comphelper::OStorageHelper::CopyInputToOutput( xInStream, xTempOut ); - xTempOut->closeOutput(); - } - catch( embed::InvalidStorageException& ) - { - throw; - } - catch( lang::IllegalArgumentException& ) - { - throw; - } - catch( packages::WrongPasswordException& ) - { - throw; - } - catch( io::IOException& ) - { - throw; - } - catch( embed::StorageWrappedTargetException& ) - { - throw; - } - catch( uno::RuntimeException& ) - { - throw; - } - catch( uno::Exception& ) - { - uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy raw stream" ), - uno::Reference< io::XInputStream >(), - aCaught ); - } - - return xTempResult; -} - -//----------------------------------------------- -uno::Reference< io::XStream > SAL_CALL FSStorage::cloneEncryptedStreamElement( - const ::rtl::OUString&, - const ::rtl::OUString& ) - throw ( embed::InvalidStorageException, - lang::IllegalArgumentException, - packages::NoEncryptionException, - packages::WrongPasswordException, - io::IOException, - embed::StorageWrappedTargetException, - uno::RuntimeException ) -{ - throw packages::NoEncryptionException(); -} - -//----------------------------------------------- -void SAL_CALL FSStorage::copyLastCommitTo( - const uno::Reference< embed::XStorage >& xTargetStorage ) - throw ( embed::InvalidStorageException, - lang::IllegalArgumentException, - io::IOException, - embed::StorageWrappedTargetException, - uno::RuntimeException ) -{ - copyToStorage( xTargetStorage ); -} - -//----------------------------------------------- -void SAL_CALL FSStorage::copyStorageElementLastCommitTo( - const ::rtl::OUString& aStorName, - const uno::Reference< embed::XStorage >& xTargetStorage ) - throw ( embed::InvalidStorageException, - lang::IllegalArgumentException, - io::IOException, - embed::StorageWrappedTargetException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - uno::Reference< embed::XStorage > xSourceStor( openStorageElement( aStorName, embed::ElementModes::READ ), - uno::UNO_QUERY_THROW ); - xSourceStor->copyToStorage( xTargetStorage ); -} - -//----------------------------------------------- -sal_Bool SAL_CALL FSStorage::isStreamElement( const ::rtl::OUString& aElementName ) - throw ( embed::InvalidStorageException, - lang::IllegalArgumentException, - container::NoSuchElementException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - if ( !GetContent() ) - throw embed::InvalidStorageException(); // TODO: error handling - - INetURLObject aURL( m_pImpl->m_aURL ); - aURL.Append( aElementName ); - - return !::utl::UCBContentHelper::IsFolder( aURL.GetMainURL( INetURLObject::NO_DECODE ) ); -} - -//----------------------------------------------- -sal_Bool SAL_CALL FSStorage::isStorageElement( const ::rtl::OUString& aElementName ) - throw ( embed::InvalidStorageException, - lang::IllegalArgumentException, - container::NoSuchElementException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - if ( !GetContent() ) - throw embed::InvalidStorageException(); // TODO: error handling - - INetURLObject aURL( m_pImpl->m_aURL ); - aURL.Append( aElementName ); - - return ::utl::UCBContentHelper::IsFolder( aURL.GetMainURL( INetURLObject::NO_DECODE ) ); -} - -//----------------------------------------------- -void SAL_CALL FSStorage::removeElement( const ::rtl::OUString& aElementName ) - throw ( embed::InvalidStorageException, - lang::IllegalArgumentException, - container::NoSuchElementException, - io::IOException, - embed::StorageWrappedTargetException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - if ( !GetContent() ) - throw io::IOException(); // TODO: error handling - - INetURLObject aURL( m_pImpl->m_aURL ); - aURL.Append( aElementName ); - - if ( !::utl::UCBContentHelper::IsFolder( aURL.GetMainURL( INetURLObject::NO_DECODE ) ) - && !::utl::UCBContentHelper::IsDocument( aURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) - throw container::NoSuchElementException(); // TODO: - - ::utl::UCBContentHelper::Kill( aURL.GetMainURL( INetURLObject::NO_DECODE ) ); -} - -//----------------------------------------------- -void SAL_CALL FSStorage::renameElement( const ::rtl::OUString& aElementName, const ::rtl::OUString& aNewName ) - throw ( embed::InvalidStorageException, - lang::IllegalArgumentException, - container::NoSuchElementException, - container::ElementExistException, - io::IOException, - embed::StorageWrappedTargetException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - if ( !GetContent() ) - throw io::IOException(); // TODO: error handling - - INetURLObject aOldURL( m_pImpl->m_aURL ); - aOldURL.Append( aElementName ); - - INetURLObject aNewURL( m_pImpl->m_aURL ); - aNewURL.Append( aNewName ); - - if ( !::utl::UCBContentHelper::IsFolder( aOldURL.GetMainURL( INetURLObject::NO_DECODE ) ) - && !::utl::UCBContentHelper::IsDocument( aOldURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) - throw container::NoSuchElementException(); // TODO: - - if ( ::utl::UCBContentHelper::IsFolder( aNewURL.GetMainURL( INetURLObject::NO_DECODE ) ) - || ::utl::UCBContentHelper::IsDocument( aNewURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) - throw container::ElementExistException(); // TODO: - - try - { - uno::Reference< ucb::XCommandEnvironment > xDummyEnv; - ::ucbhelper::Content aSourceContent( aOldURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv ); - - if ( !GetContent()->transferContent( aSourceContent, - ::ucbhelper::InsertOperation_MOVE, - aNewName, - ucb::NameClash::ERROR ) ) - throw io::IOException(); // TODO: error handling - } - catch( embed::InvalidStorageException& ) - { - throw; - } - catch( lang::IllegalArgumentException& ) - { - throw; - } - catch( container::NoSuchElementException& ) - { - throw; - } - catch( container::ElementExistException& ) - { - throw; - } - catch( io::IOException& ) - { - throw; - } - catch( embed::StorageWrappedTargetException& ) - { - throw; - } - catch( uno::RuntimeException& ) - { - throw; - } - catch( uno::Exception& ) - { - uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy raw stream" ), - uno::Reference< io::XInputStream >(), - aCaught ); - } -} - -//----------------------------------------------- -void SAL_CALL FSStorage::copyElementTo( const ::rtl::OUString& aElementName, - const uno::Reference< embed::XStorage >& xDest, - const ::rtl::OUString& aNewName ) - throw ( embed::InvalidStorageException, - lang::IllegalArgumentException, - container::NoSuchElementException, - container::ElementExistException, - io::IOException, - embed::StorageWrappedTargetException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - if ( !xDest.is() ) - throw uno::RuntimeException(); - - if ( !GetContent() ) - throw io::IOException(); // TODO: error handling - - INetURLObject aOwnURL( m_pImpl->m_aURL ); - aOwnURL.Append( aElementName ); - - if ( xDest->hasByName( aNewName ) ) - throw container::ElementExistException(); // TODO: - - try - { - uno::Reference< ucb::XCommandEnvironment > xDummyEnv; - if ( ::utl::UCBContentHelper::IsFolder( aOwnURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) - { - ::ucbhelper::Content aSourceContent( aOwnURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv ); - uno::Reference< embed::XStorage > xDestSubStor( - xDest->openStorageElement( aNewName, embed::ElementModes::READWRITE ), - uno::UNO_QUERY_THROW ); - - CopyContentToStorage_Impl( &aSourceContent, xDestSubStor ); - } - else if ( ::utl::UCBContentHelper::IsDocument( aOwnURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) - { - CopyStreamToSubStream( aOwnURL.GetMainURL( INetURLObject::NO_DECODE ), xDest, aNewName ); - } - else - throw container::NoSuchElementException(); // TODO: - } - catch( embed::InvalidStorageException& ) - { - throw; - } - catch( lang::IllegalArgumentException& ) - { - throw; - } - catch( container::NoSuchElementException& ) - { - throw; - } - catch( container::ElementExistException& ) - { - throw; - } - catch( embed::StorageWrappedTargetException& ) - { - throw; - } - catch( io::IOException& ) - { - throw; - } - catch( uno::RuntimeException& ) - { - throw; - } - catch( uno::Exception& ) - { - uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy raw stream" ), - uno::Reference< io::XInputStream >(), - aCaught ); - } -} - -//----------------------------------------------- -void SAL_CALL FSStorage::moveElementTo( const ::rtl::OUString& aElementName, - const uno::Reference< embed::XStorage >& xDest, - const ::rtl::OUString& aNewName ) - throw ( embed::InvalidStorageException, - lang::IllegalArgumentException, - container::NoSuchElementException, - container::ElementExistException, - io::IOException, - embed::StorageWrappedTargetException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - copyElementTo( aElementName, xDest, aNewName ); - - INetURLObject aOwnURL( m_pImpl->m_aURL ); - aOwnURL.Append( aElementName ); - if ( !::utl::UCBContentHelper::Kill( aOwnURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) - throw io::IOException(); // TODO: error handling -} - -//____________________________________________________________________________________________________ -// XNameAccess -//____________________________________________________________________________________________________ - -//----------------------------------------------- -uno::Any SAL_CALL FSStorage::getByName( const ::rtl::OUString& aName ) - throw ( container::NoSuchElementException, - lang::WrappedTargetException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - if ( !GetContent() ) - throw io::IOException(); // TODO: error handling - - if ( !aName.getLength() ) - throw lang::IllegalArgumentException(); - - INetURLObject aURL( m_pImpl->m_aURL ); - aURL.Append( aName ); - - uno::Any aResult; - try - { - if ( ::utl::UCBContentHelper::IsFolder( aURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) - { - aResult <<= openStorageElement( aName, embed::ElementModes::READ ); - } - else if ( ::utl::UCBContentHelper::IsDocument( aURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) - { - aResult <<= openStreamElement( aName, embed::ElementModes::READ ); - } - else - throw container::NoSuchElementException(); // TODO: - } - catch( container::NoSuchElementException& ) - { - throw; - } - catch( lang::WrappedTargetException& ) - { - throw; - } - catch( uno::RuntimeException& ) - { - throw; - } - catch ( uno::Exception& ) - { - uno::Any aCaught( ::cppu::getCaughtException() ); - throw lang::WrappedTargetException( ::rtl::OUString::createFromAscii( "Can not open element!\n" ), - uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), - uno::UNO_QUERY ), - aCaught ); - } - - return aResult; -} - - -//----------------------------------------------- -uno::Sequence< ::rtl::OUString > SAL_CALL FSStorage::getElementNames() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - if ( !GetContent() ) - throw io::IOException(); // TODO: error handling - - uno::Sequence< ::rtl::OUString > aProps( 1 ); - ::rtl::OUString* pProps = aProps.getArray(); - pProps[0] = ::rtl::OUString::createFromAscii( "Title" ); - ::ucbhelper::ResultSetInclude eInclude = ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS; - - uno::Sequence< ::rtl::OUString > aResult; - sal_Int32 nSize = 0; - - try - { - uno::Reference< sdbc::XResultSet > xResultSet = GetContent()->createCursor( aProps, eInclude ); - uno::Reference< ucb::XContentAccess > xContentAccess( xResultSet, uno::UNO_QUERY ); - uno::Reference< sdbc::XRow > xRow( xResultSet, uno::UNO_QUERY ); - if ( xResultSet.is() ) - { - // go through the list - while ( xResultSet->next() ) - { - ::rtl::OUString aName( xRow->getString( 1 ) ); - aResult.realloc( ++nSize ); - aResult[nSize-1] = aName; - } - } - } - catch( ucb::InteractiveIOException& r ) - { - if ( r.Code == ucb::IOErrorCode_NOT_EXISTING ) - OSL_ENSURE( sal_False, "The folder does not exist!\n" ); - else - { - uno::Any aCaught( ::cppu::getCaughtException() ); - throw lang::WrappedTargetRuntimeException( ::rtl::OUString::createFromAscii( "Can not open storage!\n" ), - uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), - uno::UNO_QUERY ), - aCaught ); - } - } - catch( uno::RuntimeException& ) - { - throw; - } - catch ( uno::Exception& ) - { - uno::Any aCaught( ::cppu::getCaughtException() ); - throw lang::WrappedTargetRuntimeException( ::rtl::OUString::createFromAscii( "Can not open storage!\n" ), - uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), - uno::UNO_QUERY ), - aCaught ); - } - - return aResult; -} - - -//----------------------------------------------- -sal_Bool SAL_CALL FSStorage::hasByName( const ::rtl::OUString& aName ) - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - try - { - if ( !GetContent() ) - throw io::IOException(); // TODO: error handling - - if ( !aName.getLength() ) - throw lang::IllegalArgumentException(); - } - catch( uno::RuntimeException& ) - { - throw; - } - catch ( uno::Exception& ) - { - uno::Any aCaught( ::cppu::getCaughtException() ); - throw lang::WrappedTargetRuntimeException( ::rtl::OUString::createFromAscii( "Can not open storage!\n" ), - uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), - uno::UNO_QUERY ), - aCaught ); - } - - INetURLObject aURL( m_pImpl->m_aURL ); - aURL.Append( aName ); - - return ( ::utl::UCBContentHelper::IsFolder( aURL.GetMainURL( INetURLObject::NO_DECODE ) ) - || ::utl::UCBContentHelper::IsDocument( aURL.GetMainURL( INetURLObject::NO_DECODE ) ) ); -} - -//----------------------------------------------- -uno::Type SAL_CALL FSStorage::getElementType() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - // it is a multitype container - return uno::Type(); -} - -//----------------------------------------------- -sal_Bool SAL_CALL FSStorage::hasElements() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - if ( !GetContent() ) - throw io::IOException(); // TODO: error handling - - uno::Sequence< ::rtl::OUString > aProps( 1 ); - aProps[0] = ::rtl::OUString::createFromAscii( "TargetURL" ); - ::ucbhelper::ResultSetInclude eInclude = ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS; - - try - { - uno::Reference< sdbc::XResultSet > xResultSet = GetContent()->createCursor( aProps, eInclude ); - return ( xResultSet.is() && xResultSet->next() ); - } - catch( uno::Exception& ) - { - throw uno::RuntimeException(); - } -} - - -//____________________________________________________________________________________________________ -// XDisposable -//____________________________________________________________________________________________________ - -//----------------------------------------------- -void SAL_CALL FSStorage::dispose() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - if ( m_pImpl->m_pListenersContainer ) - { - lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >(this) ); - m_pImpl->m_pListenersContainer->disposeAndClear( aSource ); - } - - delete m_pImpl; - m_pImpl = NULL; -} - -//----------------------------------------------- -void SAL_CALL FSStorage::addEventListener( - const uno::Reference< lang::XEventListener >& xListener ) - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - if ( !m_pImpl->m_pListenersContainer ) - m_pImpl->m_pListenersContainer = new ::cppu::OInterfaceContainerHelper( m_aMutex ); - - m_pImpl->m_pListenersContainer->addInterface( xListener ); -} - -//----------------------------------------------- -void SAL_CALL FSStorage::removeEventListener( - const uno::Reference< lang::XEventListener >& xListener ) - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - if ( m_pImpl->m_pListenersContainer ) - m_pImpl->m_pListenersContainer->removeInterface( xListener ); -} - -//____________________________________________________________________________________________________ -// XPropertySet -//____________________________________________________________________________________________________ - -//----------------------------------------------- -uno::Reference< beans::XPropertySetInfo > SAL_CALL FSStorage::getPropertySetInfo() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - //TODO: - return uno::Reference< beans::XPropertySetInfo >(); -} - - -//----------------------------------------------- -void SAL_CALL FSStorage::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& ) - throw ( beans::UnknownPropertyException, - beans::PropertyVetoException, - lang::IllegalArgumentException, - lang::WrappedTargetException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - if ( aPropertyName.equalsAscii( "URL" ) || aPropertyName.equalsAscii( "OpenMode" ) ) - throw beans::PropertyVetoException(); // TODO - else - throw beans::UnknownPropertyException(); // TODO -} - - -//----------------------------------------------- -uno::Any SAL_CALL FSStorage::getPropertyValue( const ::rtl::OUString& aPropertyName ) - throw ( beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - if ( aPropertyName.equalsAscii( "URL" ) ) - return uno::makeAny( m_pImpl->m_aURL ); - else if ( aPropertyName.equalsAscii( "OpenMode" ) ) - return uno::makeAny( m_pImpl->m_nMode ); - - throw beans::UnknownPropertyException(); // TODO -} - - -//----------------------------------------------- -void SAL_CALL FSStorage::addPropertyChangeListener( - const ::rtl::OUString& /*aPropertyName*/, - const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ ) - throw ( beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - //TODO: -} - - -//----------------------------------------------- -void SAL_CALL FSStorage::removePropertyChangeListener( - const ::rtl::OUString& /*aPropertyName*/, - const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ ) - throw ( beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - //TODO: -} - - -//----------------------------------------------- -void SAL_CALL FSStorage::addVetoableChangeListener( - const ::rtl::OUString& /*PropertyName*/, - const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ ) - throw ( beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - //TODO: -} - - -//----------------------------------------------- -void SAL_CALL FSStorage::removeVetoableChangeListener( - const ::rtl::OUString& /*PropertyName*/, - const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ ) - throw ( beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - //TODO: -} - -//____________________________________________________________________________________________________ -// XHierarchicalStorageAccess -//____________________________________________________________________________________________________ -//----------------------------------------------- -uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openStreamElementByHierarchicalName( const ::rtl::OUString& sStreamPath, ::sal_Int32 nOpenMode ) - throw ( embed::InvalidStorageException, - lang::IllegalArgumentException, - packages::WrongPasswordException, - io::IOException, - embed::StorageWrappedTargetException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - if ( sStreamPath.toChar() == '/' ) - throw lang::IllegalArgumentException(); - - if ( !GetContent() ) - throw io::IOException(); // TODO: error handling - - INetURLObject aBaseURL( m_pImpl->m_aURL ); - if ( !aBaseURL.setFinalSlash() ) - throw uno::RuntimeException(); - - INetURLObject aFileURL = INetURLObject::GetAbsURL( - aBaseURL.GetMainURL( INetURLObject::NO_DECODE ), - sStreamPath ); - - if ( ::utl::UCBContentHelper::IsFolder( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) - throw io::IOException(); - - if ( ( nOpenMode & embed::ElementModes::NOCREATE ) - && !::utl::UCBContentHelper::IsDocument( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) - throw io::IOException(); // TODO: - - uno::Reference< ucb::XCommandEnvironment > xDummyEnv; // TODO: provide InteractionHandler if any - uno::Reference< io::XStream > xResult; - try - { - if ( nOpenMode & embed::ElementModes::WRITE ) - { - if ( isLocalFile_Impl( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) - { - uno::Reference< ucb::XSimpleFileAccess > xSimpleFileAccess( - m_pImpl->m_xFactory->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) ) ), - uno::UNO_QUERY_THROW ); - uno::Reference< io::XStream > xStream = - xSimpleFileAccess->openFileReadWrite( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ); - - xResult = static_cast< io::XStream* >( new OFSStreamContainer( xStream ) ); - } - else - { - // TODO: test whether it really works for http and fwp - SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( aFileURL.GetMainURL( INetURLObject::NO_DECODE ), - STREAM_STD_WRITE ); - if ( pStream ) - { - if ( !pStream->GetError() ) - { - uno::Reference< io::XStream > xStream = - uno::Reference < io::XStream >( new ::utl::OStreamWrapper( *pStream ) ); - xResult = static_cast< io::XStream* >( new OFSStreamContainer( xStream ) ); - } - else - delete pStream; - } - } - - if ( !xResult.is() ) - throw io::IOException(); - - if ( ( nOpenMode & embed::ElementModes::TRUNCATE ) ) - { - uno::Reference< io::XTruncate > xTrunc( xResult->getOutputStream(), uno::UNO_QUERY_THROW ); - xTrunc->truncate(); - } - } - else - { - if ( ( nOpenMode & embed::ElementModes::TRUNCATE ) - || !::utl::UCBContentHelper::IsDocument( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) - throw io::IOException(); // TODO: access denied - - ::ucbhelper::Content aResultContent( aFileURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv ); - uno::Reference< io::XInputStream > xInStream = aResultContent.openStream(); - xResult = static_cast< io::XStream* >( new OFSInputStreamContainer( xInStream ) ); - } - } - catch( embed::InvalidStorageException& ) - { - throw; - } - catch( lang::IllegalArgumentException& ) - { - throw; - } - catch( packages::WrongPasswordException& ) - { - throw; - } - catch( embed::StorageWrappedTargetException& ) - { - throw; - } - catch( io::IOException& ) - { - throw; - } - catch( uno::RuntimeException& ) - { - throw; - } - catch( uno::Exception& ) - { - uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy raw stream" ), - uno::Reference< io::XInputStream >(), - aCaught ); - } - - return uno::Reference< embed::XExtendedStorageStream >( xResult, uno::UNO_QUERY_THROW ); -} - -//----------------------------------------------- -uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openEncryptedStreamElementByHierarchicalName( const ::rtl::OUString& /*sStreamName*/, ::sal_Int32 /*nOpenMode*/, const ::rtl::OUString& /*sPassword*/ ) - throw ( embed::InvalidStorageException, - lang::IllegalArgumentException, - packages::NoEncryptionException, - packages::WrongPasswordException, - io::IOException, - embed::StorageWrappedTargetException, - uno::RuntimeException ) -{ - throw packages::NoEncryptionException(); -} - -//----------------------------------------------- -void SAL_CALL FSStorage::removeStreamElementByHierarchicalName( const ::rtl::OUString& sStreamPath ) - throw ( embed::InvalidStorageException, - lang::IllegalArgumentException, - container::NoSuchElementException, - io::IOException, - embed::StorageWrappedTargetException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !m_pImpl ) - throw lang::DisposedException(); - - if ( !GetContent() ) - throw io::IOException(); // TODO: error handling - - // TODO/LATER: may need possibility to create folder if it was removed, since the folder can not be locked - INetURLObject aBaseURL( m_pImpl->m_aURL ); - if ( !aBaseURL.setFinalSlash() ) - throw uno::RuntimeException(); - - INetURLObject aFileURL = INetURLObject::GetAbsURL( - aBaseURL.GetMainURL( INetURLObject::NO_DECODE ), - sStreamPath ); - - if ( !::utl::UCBContentHelper::IsDocument( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) - { - if ( ::utl::UCBContentHelper::IsFolder( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) - throw lang::IllegalArgumentException(); - else - throw container::NoSuchElementException(); // TODO: - } - - if ( !::utl::UCBContentHelper::Kill( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) - throw io::IOException(); // TODO: error handling -} - - diff --git a/svtools/source/fsstor/fsstorage.hxx b/svtools/source/fsstor/fsstorage.hxx deleted file mode 100644 index 670a6917dd40..000000000000 --- a/svtools/source/fsstor/fsstorage.hxx +++ /dev/null @@ -1,340 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: fsstorage.hxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __XSTORAGE_HXX_ -#define __XSTORAGE_HXX_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -struct FSStorage_Impl; -class FSStorage : public ::com::sun::star::lang::XTypeProvider - , public ::com::sun::star::embed::XStorage - , public ::com::sun::star::embed::XHierarchicalStorageAccess - , public ::com::sun::star::beans::XPropertySet - , public ::cppu::OWeakObject -{ - ::osl::Mutex m_aMutex; - FSStorage_Impl* m_pImpl; - -protected: - -public: - - FSStorage( const ::ucbhelper::Content& aContent, - sal_Int32 nMode, - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > xProperties, - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory ); - - virtual ~FSStorage(); - - ::ucbhelper::Content* GetContent(); - - void CopyStreamToSubStream( const ::rtl::OUString& aSourceURL, - const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest, - const ::rtl::OUString& aNewEntryName ); - - void CopyContentToStorage_Impl( ::ucbhelper::Content* pContent, - const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest ); - - static sal_Bool MakeFolderNoUI( const String& rFolder, sal_Bool bNewOnly ); - - //____________________________________________________________________________________________________ - // XInterface - //____________________________________________________________________________________________________ - - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType ) - throw( ::com::sun::star::uno::RuntimeException ); - - virtual void SAL_CALL acquire() throw(); - - virtual void SAL_CALL release() throw(); - - //____________________________________________________________________________________________________ - // XTypeProvider - //____________________________________________________________________________________________________ - - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() - throw( ::com::sun::star::uno::RuntimeException ); - - virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() - throw( ::com::sun::star::uno::RuntimeException ); - - //____________________________________________________________________________________________________ - // XStorage - //____________________________________________________________________________________________________ - - virtual void SAL_CALL copyToStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest ) - throw ( ::com::sun::star::embed::InvalidStorageException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::io::IOException, - ::com::sun::star::embed::StorageWrappedTargetException, - ::com::sun::star::uno::RuntimeException ); - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL openStreamElement( - const ::rtl::OUString& aStreamName, sal_Int32 nOpenMode ) - throw ( ::com::sun::star::embed::InvalidStorageException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::packages::WrongPasswordException, - ::com::sun::star::io::IOException, - ::com::sun::star::embed::StorageWrappedTargetException, - ::com::sun::star::uno::RuntimeException ); - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL openEncryptedStreamElement( - const ::rtl::OUString& aStreamName, sal_Int32 nOpenMode, const ::rtl::OUString& aPass ) - throw ( ::com::sun::star::embed::InvalidStorageException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::packages::NoEncryptionException, - ::com::sun::star::packages::WrongPasswordException, - ::com::sun::star::io::IOException, - ::com::sun::star::embed::StorageWrappedTargetException, - ::com::sun::star::uno::RuntimeException ); - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > SAL_CALL openStorageElement( - const ::rtl::OUString& aStorName, sal_Int32 nStorageMode ) - throw ( ::com::sun::star::embed::InvalidStorageException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::io::IOException, - ::com::sun::star::embed::StorageWrappedTargetException, - ::com::sun::star::uno::RuntimeException ); - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL cloneStreamElement( - const ::rtl::OUString& aStreamName ) - throw ( ::com::sun::star::embed::InvalidStorageException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::packages::WrongPasswordException, - ::com::sun::star::io::IOException, - ::com::sun::star::embed::StorageWrappedTargetException, - ::com::sun::star::uno::RuntimeException ); - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL cloneEncryptedStreamElement( - const ::rtl::OUString& aStreamName, const ::rtl::OUString& aPass ) - throw ( ::com::sun::star::embed::InvalidStorageException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::packages::NoEncryptionException, - ::com::sun::star::packages::WrongPasswordException, - ::com::sun::star::io::IOException, - ::com::sun::star::embed::StorageWrappedTargetException, - ::com::sun::star::uno::RuntimeException ); - - virtual void SAL_CALL copyLastCommitTo( - const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xTargetStorage ) - throw ( ::com::sun::star::embed::InvalidStorageException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::io::IOException, - ::com::sun::star::embed::StorageWrappedTargetException, - ::com::sun::star::uno::RuntimeException ); - - virtual void SAL_CALL copyStorageElementLastCommitTo( - const ::rtl::OUString& aStorName, - const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xTargetStorage ) - throw ( ::com::sun::star::embed::InvalidStorageException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::io::IOException, - ::com::sun::star::embed::StorageWrappedTargetException, - ::com::sun::star::uno::RuntimeException ); - - virtual sal_Bool SAL_CALL isStreamElement( const ::rtl::OUString& aElementName ) - throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::embed::InvalidStorageException, - ::com::sun::star::uno::RuntimeException ); - - virtual sal_Bool SAL_CALL isStorageElement( const ::rtl::OUString& aElementName ) - throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::embed::InvalidStorageException, - ::com::sun::star::uno::RuntimeException ); - - virtual void SAL_CALL removeElement( const ::rtl::OUString& aElementName ) - throw ( ::com::sun::star::embed::InvalidStorageException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::io::IOException, - ::com::sun::star::embed::StorageWrappedTargetException, - ::com::sun::star::uno::RuntimeException ); - - virtual void SAL_CALL renameElement( const ::rtl::OUString& rEleName, const ::rtl::OUString& rNewName ) - throw ( ::com::sun::star::embed::InvalidStorageException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::container::ElementExistException, - ::com::sun::star::io::IOException, - ::com::sun::star::embed::StorageWrappedTargetException, - ::com::sun::star::uno::RuntimeException ); - - virtual void SAL_CALL copyElementTo( const ::rtl::OUString& aElementName, - const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest, - const ::rtl::OUString& aNewName ) - throw ( ::com::sun::star::embed::InvalidStorageException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::container::ElementExistException, - ::com::sun::star::io::IOException, - ::com::sun::star::embed::StorageWrappedTargetException, - ::com::sun::star::uno::RuntimeException ); - - virtual void SAL_CALL moveElementTo( const ::rtl::OUString& aElementName, - const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest, - const ::rtl::OUString& rNewName ) - throw ( ::com::sun::star::embed::InvalidStorageException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::container::ElementExistException, - ::com::sun::star::io::IOException, - ::com::sun::star::embed::StorageWrappedTargetException, - ::com::sun::star::uno::RuntimeException ); - - //____________________________________________________________________________________________________ - // XNameAccess - //____________________________________________________________________________________________________ - - virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) - throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException ); - - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() - throw ( ::com::sun::star::uno::RuntimeException ); - - virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) - throw ( ::com::sun::star::uno::RuntimeException ); - - virtual ::com::sun::star::uno::Type SAL_CALL getElementType() - throw ( ::com::sun::star::uno::RuntimeException ); - - virtual sal_Bool SAL_CALL hasElements() - throw ( ::com::sun::star::uno::RuntimeException ); - - //____________________________________________________________________________________________________ - // XComponent - //____________________________________________________________________________________________________ - - virtual void SAL_CALL dispose() - throw ( ::com::sun::star::uno::RuntimeException ); - - virtual void SAL_CALL addEventListener( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) - throw ( ::com::sun::star::uno::RuntimeException ); - - virtual void SAL_CALL removeEventListener( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) - throw ( ::com::sun::star::uno::RuntimeException ); - - //____________________________________________________________________________________________________ - // XPropertySet - //____________________________________________________________________________________________________ - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() - throw ( ::com::sun::star::uno::RuntimeException ); - - virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) - throw ( ::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::beans::PropertyVetoException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException ); - - virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) - throw ( ::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException ); - - virtual void SAL_CALL addPropertyChangeListener( - const ::rtl::OUString& aPropertyName, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) - throw ( ::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException ); - - virtual void SAL_CALL removePropertyChangeListener( - const ::rtl::OUString& aPropertyName, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) - throw ( ::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException ); - - virtual void SAL_CALL addVetoableChangeListener( - const ::rtl::OUString& PropertyName, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) - throw ( ::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException ); - - virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) - throw ( ::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException ); - - //____________________________________________________________________________________________________ - // XHierarchicalStorageAccess - //____________________________________________________________________________________________________ - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XExtendedStorageStream > SAL_CALL openStreamElementByHierarchicalName( const ::rtl::OUString& sStreamPath, ::sal_Int32 nOpenMode ) - throw ( ::com::sun::star::embed::InvalidStorageException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::packages::WrongPasswordException, - ::com::sun::star::io::IOException, - ::com::sun::star::embed::StorageWrappedTargetException, - ::com::sun::star::uno::RuntimeException ); - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XExtendedStorageStream > SAL_CALL openEncryptedStreamElementByHierarchicalName( const ::rtl::OUString& sStreamName, ::sal_Int32 nOpenMode, const ::rtl::OUString& sPassword ) - throw ( ::com::sun::star::embed::InvalidStorageException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::packages::NoEncryptionException, - ::com::sun::star::packages::WrongPasswordException, - ::com::sun::star::io::IOException, - ::com::sun::star::embed::StorageWrappedTargetException, - ::com::sun::star::uno::RuntimeException ); - - virtual void SAL_CALL removeStreamElementByHierarchicalName( const ::rtl::OUString& sElementPath ) - throw ( ::com::sun::star::embed::InvalidStorageException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::io::IOException, - ::com::sun::star::embed::StorageWrappedTargetException, - ::com::sun::star::uno::RuntimeException ); -}; - -#endif - diff --git a/svtools/source/fsstor/makefile.mk b/svtools/source/fsstor/makefile.mk deleted file mode 100644 index f55f6747f9e1..000000000000 --- a/svtools/source/fsstor/makefile.mk +++ /dev/null @@ -1,70 +0,0 @@ -#************************************************************************* -# -# 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 -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.6 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. -PRJNAME=svtools -TARGET=fsstorage.uno -LIBTARGET=NO -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk -DLLPRE= - -# --- Files ------------------------------------- - -SLOFILES=\ - $(SLO)$/fsfactory.obj \ - $(SLO)$/fsstorage.obj \ - $(SLO)$/oinputstreamcontainer.obj \ - $(SLO)$/ostreamcontainer.obj - -SHL1TARGET= $(TARGET) -SHL1IMPLIB= i$(TARGET) -SHL1OBJS= $(SLOFILES) -SHL1STDLIBS=\ - $(UNOTOOLSLIB) \ - $(TOOLSLIB) \ - $(COMPHELPERLIB) \ - $(UCBHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) - -SHL1VERSIONMAP=exports.map -SHL1DEF= $(MISC)$/$(SHL1TARGET).def -DEF1NAME= $(SHL1TARGET) - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - diff --git a/svtools/source/fsstor/oinputstreamcontainer.cxx b/svtools/source/fsstor/oinputstreamcontainer.cxx deleted file mode 100644 index dc08a7a34602..000000000000 --- a/svtools/source/fsstor/oinputstreamcontainer.cxx +++ /dev/null @@ -1,350 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: oinputstreamcontainer.cxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include "oinputstreamcontainer.hxx" -#include - -using namespace ::com::sun::star; - -//----------------------------------------------- -OFSInputStreamContainer::OFSInputStreamContainer( const uno::Reference< io::XInputStream >& xStream ) -: m_xInputStream( xStream ) -, m_xSeekable( xStream, uno::UNO_QUERY ) -, m_bSeekable( sal_False ) -, m_bDisposed( sal_False ) -, m_pListenersContainer( NULL ) -{ - m_bSeekable = m_xSeekable.is(); -} - -//----------------------------------------------- -OFSInputStreamContainer::~OFSInputStreamContainer() -{ - if ( m_pListenersContainer ) - { - delete m_pListenersContainer; - m_pListenersContainer = NULL; - } -} - -//----------------------------------------------- -uno::Sequence< uno::Type > SAL_CALL OFSInputStreamContainer::getTypes() - throw ( uno::RuntimeException ) -{ - static ::cppu::OTypeCollection* pTypeCollection = NULL ; - - if ( pTypeCollection == NULL ) - { - ::osl::MutexGuard aGuard( m_aMutex ) ; - - if ( pTypeCollection == NULL ) - { - if ( m_bSeekable ) - { - static ::cppu::OTypeCollection aTypeCollection( - ::getCppuType(( const uno::Reference< io::XStream >* )NULL ), - ::getCppuType(( const uno::Reference< io::XInputStream >* )NULL ), - ::getCppuType(( const uno::Reference< io::XSeekable >* )NULL ) ); - - pTypeCollection = &aTypeCollection ; - } - else - { - static ::cppu::OTypeCollection aTypeCollection( - ::getCppuType(( const uno::Reference< io::XStream >* )NULL ), - ::getCppuType(( const uno::Reference< io::XInputStream >* )NULL ) ); - - pTypeCollection = &aTypeCollection ; - } - } - } - - return pTypeCollection->getTypes() ; - -} - -//----------------------------------------------- -uno::Any SAL_CALL OFSInputStreamContainer::queryInterface( const uno::Type& rType ) - throw( uno::RuntimeException ) -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - uno::Any aReturn; - if ( m_bSeekable ) - aReturn = uno::Any( ::cppu::queryInterface( rType, - static_cast< io::XStream* >( this ), - static_cast< io::XInputStream* >( this ), - static_cast< io::XSeekable* >( this ) ) ); - else - aReturn = uno::Any( ::cppu::queryInterface( rType, - static_cast< io::XStream* >( this ), - static_cast< io::XInputStream* >( this ) ) ); - - if ( aReturn.hasValue() == sal_True ) - return aReturn ; - - return ::cppu::OWeakObject::queryInterface( rType ) ; -} - -//----------------------------------------------- -void SAL_CALL OFSInputStreamContainer::acquire() - throw() -{ - ::cppu::OWeakObject::acquire(); -} - -//----------------------------------------------- -void SAL_CALL OFSInputStreamContainer::release() - throw() -{ - ::cppu::OWeakObject::release(); -} - -//----------------------------------------------- -sal_Int32 SAL_CALL OFSInputStreamContainer::readBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) - throw ( io::NotConnectedException, - io::BufferSizeExceededException, - io::IOException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xInputStream.is() ) - throw uno::RuntimeException(); - - return m_xInputStream->readBytes( aData, nBytesToRead ); -} - -//----------------------------------------------- -sal_Int32 SAL_CALL OFSInputStreamContainer::readSomeBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) - throw ( io::NotConnectedException, - io::BufferSizeExceededException, - io::IOException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xInputStream.is() ) - throw uno::RuntimeException(); - - return m_xInputStream->readSomeBytes( aData, nMaxBytesToRead ); -} - -//----------------------------------------------- -void SAL_CALL OFSInputStreamContainer::skipBytes( sal_Int32 nBytesToSkip ) - throw ( io::NotConnectedException, - io::BufferSizeExceededException, - io::IOException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xInputStream.is() ) - throw uno::RuntimeException(); - - m_xInputStream->skipBytes( nBytesToSkip ); -} - -//----------------------------------------------- -sal_Int32 SAL_CALL OFSInputStreamContainer::available( ) - throw ( io::NotConnectedException, - io::IOException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xInputStream.is() ) - throw uno::RuntimeException(); - - return m_xInputStream->available(); -} - -//----------------------------------------------- -void SAL_CALL OFSInputStreamContainer::closeInput( ) - throw ( io::NotConnectedException, - io::IOException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xInputStream.is() ) - throw uno::RuntimeException(); - - dispose(); -} - -//----------------------------------------------- -uno::Reference< io::XInputStream > SAL_CALL OFSInputStreamContainer::getInputStream() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xInputStream.is() ) - return uno::Reference< io::XInputStream >(); - - return uno::Reference< io::XInputStream >( static_cast< io::XInputStream* >( this ), uno::UNO_QUERY ); -} - -//----------------------------------------------- -uno::Reference< io::XOutputStream > SAL_CALL OFSInputStreamContainer::getOutputStream() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - return uno::Reference< io::XOutputStream >(); -} - -//----------------------------------------------- -void SAL_CALL OFSInputStreamContainer::seek( sal_Int64 location ) - throw ( lang::IllegalArgumentException, - io::IOException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xSeekable.is() ) - throw uno::RuntimeException(); - - m_xSeekable->seek( location ); -} - -//----------------------------------------------- -sal_Int64 SAL_CALL OFSInputStreamContainer::getPosition() - throw ( io::IOException, - uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xSeekable.is() ) - throw uno::RuntimeException(); - - return m_xSeekable->getPosition(); -} - -//----------------------------------------------- -sal_Int64 SAL_CALL OFSInputStreamContainer::getLength() - throw ( io::IOException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xSeekable.is() ) - throw uno::RuntimeException(); - - return m_xSeekable->getLength(); -} - -//----------------------------------------------- -void SAL_CALL OFSInputStreamContainer::dispose( ) - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xInputStream.is() ) - throw uno::RuntimeException(); - - m_xInputStream->closeInput(); - - if ( m_pListenersContainer ) - { - lang::EventObject aSource( static_cast< ::cppu::OWeakObject*>( this ) ); - m_pListenersContainer->disposeAndClear( aSource ); - } - - m_bDisposed = sal_True; -} - -//----------------------------------------------- -void SAL_CALL OFSInputStreamContainer::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_pListenersContainer ) - m_pListenersContainer = new ::cppu::OInterfaceContainerHelper( m_aMutex ); - - m_pListenersContainer->addInterface( xListener ); -} - -//----------------------------------------------- -void SAL_CALL OFSInputStreamContainer::removeEventListener( const uno::Reference< lang::XEventListener >& xListener ) - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( m_pListenersContainer ) - m_pListenersContainer->removeInterface( xListener ); -} - - - diff --git a/svtools/source/fsstor/oinputstreamcontainer.hxx b/svtools/source/fsstor/oinputstreamcontainer.hxx deleted file mode 100644 index 308f4283b430..000000000000 --- a/svtools/source/fsstor/oinputstreamcontainer.hxx +++ /dev/null @@ -1,99 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: oinputstreamcontainer.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _OINPUTSTREAMCONTAINER_HXX_ -#define _OINPUTSTREAMCONTAINER_HXX_ - -#include -#include -#include - - -#include -#include - -#include - -class OFSInputStreamContainer : public cppu::WeakImplHelper2 < ::com::sun::star::io::XInputStream - ,::com::sun::star::embed::XExtendedStorageStream > - , public ::com::sun::star::io::XSeekable -{ -protected: - ::osl::Mutex m_aMutex; - - ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream > m_xInputStream; - ::com::sun::star::uno::Reference < ::com::sun::star::io::XSeekable > m_xSeekable; - - sal_Bool m_bSeekable; - - sal_Bool m_bDisposed; - - ::cppu::OInterfaceContainerHelper* m_pListenersContainer; // list of listeners - -public: - OFSInputStreamContainer( const ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream >& xStream ); - - virtual ~OFSInputStreamContainer(); - - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType ) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL acquire() throw(); - virtual void SAL_CALL release() throw(); - - // XInputStream - virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) - throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) - throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) - throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL available( ) - throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL closeInput( ) - throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - - //XStream - virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > SAL_CALL getOutputStream( ) throw (::com::sun::star::uno::RuntimeException); - - //XSeekable - virtual void SAL_CALL seek( sal_Int64 location ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int64 SAL_CALL getPosition() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int64 SAL_CALL getLength() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - - //XComponent - virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); - -}; - -#endif - diff --git a/svtools/source/fsstor/ostreamcontainer.cxx b/svtools/source/fsstor/ostreamcontainer.cxx deleted file mode 100644 index d801f49532b2..000000000000 --- a/svtools/source/fsstor/ostreamcontainer.cxx +++ /dev/null @@ -1,570 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ostreamcontainer.cxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include "ostreamcontainer.hxx" - - -using namespace ::com::sun::star; - -//----------------------------------------------- -OFSStreamContainer::OFSStreamContainer( const uno::Reference < io::XStream >& xStream ) -: m_bDisposed( sal_False ) -, m_bInputClosed( sal_False ) -, m_bOutputClosed( sal_False ) -, m_pListenersContainer( NULL ) -, m_pTypeCollection( NULL ) -{ - try - { - m_xStream = xStream; - if ( !m_xStream.is() ) - throw uno::RuntimeException(); - - m_xSeekable = uno::Reference< io::XSeekable >( xStream, uno::UNO_QUERY ); - m_xInputStream = xStream->getInputStream(); - m_xOutputStream = xStream->getOutputStream(); - m_xTruncate = uno::Reference< io::XTruncate >( m_xOutputStream, uno::UNO_QUERY ); - m_xAsyncOutputMonitor = uno::Reference< io::XAsyncOutputMonitor >( m_xOutputStream, uno::UNO_QUERY ); - } - catch( uno::Exception& ) - { - m_xStream = uno::Reference< io::XStream >(); - m_xSeekable = uno::Reference< io::XSeekable >(); - m_xInputStream = uno::Reference< io::XInputStream >(); - m_xOutputStream = uno::Reference< io::XOutputStream >(); - m_xTruncate = uno::Reference< io::XTruncate >(); - m_xAsyncOutputMonitor = uno::Reference< io::XAsyncOutputMonitor >(); - } -} - -//----------------------------------------------- -OFSStreamContainer::~OFSStreamContainer() -{ - if ( m_pListenersContainer ) - { - delete m_pListenersContainer; - m_pListenersContainer = NULL; - } -} - -// XInterface -//----------------------------------------------- -uno::Any SAL_CALL OFSStreamContainer::queryInterface( const uno::Type& rType ) - throw( uno::RuntimeException ) -{ - uno::Any aReturn; - - aReturn <<= ::cppu::queryInterface - ( rType - , static_cast ( this ) - , static_cast ( this ) - , static_cast ( this ) - , static_cast ( this ) ); - - if ( aReturn.hasValue() == sal_True ) - return aReturn ; - - if ( m_xSeekable.is() ) - { - aReturn <<= ::cppu::queryInterface - ( rType - , static_cast ( this ) ); - - if ( aReturn.hasValue() == sal_True ) - return aReturn ; - } - - if ( m_xInputStream.is() ) - { - aReturn <<= ::cppu::queryInterface - ( rType - , static_cast ( this ) ); - - if ( aReturn.hasValue() == sal_True ) - return aReturn ; - } - if ( m_xOutputStream.is() ) - { - aReturn <<= ::cppu::queryInterface - ( rType - , static_cast ( this ) ); - - if ( aReturn.hasValue() == sal_True ) - return aReturn ; - } - if ( m_xTruncate.is() ) - { - aReturn <<= ::cppu::queryInterface - ( rType - , static_cast ( this ) ); - - if ( aReturn.hasValue() == sal_True ) - return aReturn ; - } - if ( m_xAsyncOutputMonitor.is() ) - { - aReturn <<= ::cppu::queryInterface - ( rType - , static_cast ( this ) ); - - if ( aReturn.hasValue() == sal_True ) - return aReturn ; - } - - return OWeakObject::queryInterface( rType ); -} - -//----------------------------------------------- -void SAL_CALL OFSStreamContainer::acquire() - throw() -{ - OWeakObject::acquire(); -} - -//----------------------------------------------- -void SAL_CALL OFSStreamContainer::release() - throw() -{ - OWeakObject::release(); -} - -// XTypeProvider -//----------------------------------------------- -uno::Sequence< uno::Type > SAL_CALL OFSStreamContainer::getTypes() - throw( uno::RuntimeException ) -{ - if ( m_pTypeCollection == NULL ) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_pTypeCollection == NULL ) - { - ::cppu::OTypeCollection aTypeCollection - ( ::getCppuType( ( const uno::Reference< lang::XTypeProvider >* )NULL ) - , ::getCppuType( ( const uno::Reference< embed::XExtendedStorageStream >* )NULL ) ); - - if ( m_xSeekable.is() ) - aTypeCollection = ::cppu::OTypeCollection - ( ::getCppuType( ( const uno::Reference< io::XSeekable >* )NULL ), - aTypeCollection.getTypes() ); - if ( m_xInputStream.is() ) - aTypeCollection = ::cppu::OTypeCollection - ( ::getCppuType( ( const uno::Reference< io::XInputStream >* )NULL ), - aTypeCollection.getTypes() ); - - if ( m_xOutputStream.is() ) - aTypeCollection = ::cppu::OTypeCollection - ( ::getCppuType( ( const uno::Reference< io::XOutputStream >* )NULL ), - aTypeCollection.getTypes() ); - if ( m_xTruncate.is() ) - aTypeCollection = ::cppu::OTypeCollection - ( ::getCppuType( ( const uno::Reference< io::XTruncate >* )NULL ), - aTypeCollection.getTypes() ); - if ( m_xAsyncOutputMonitor.is() ) - aTypeCollection = ::cppu::OTypeCollection - ( ::getCppuType( ( const uno::Reference< io::XAsyncOutputMonitor >* )NULL ), - aTypeCollection.getTypes() ); - - m_pTypeCollection = new ::cppu::OTypeCollection( aTypeCollection ); - } - } - return m_pTypeCollection->getTypes() ; -} - -//----------------------------------------------- -uno::Sequence< sal_Int8 > SAL_CALL OFSStreamContainer::getImplementationId() - throw( uno::RuntimeException ) -{ - static ::cppu::OImplementationId* pID = NULL ; - - if ( pID == NULL ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ) ; - - if ( pID == NULL ) - { - static ::cppu::OImplementationId aID( sal_False ) ; - pID = &aID ; - } - } - - return pID->getImplementationId() ; -} - -// XStream -//----------------------------------------------- -uno::Reference< io::XInputStream > SAL_CALL OFSStreamContainer::getInputStream() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xStream.is() ) - throw uno::RuntimeException(); - - if ( m_xInputStream.is() ) - return uno::Reference< io::XInputStream >( static_cast< io::XInputStream* >( this ) ); - - return uno::Reference< io::XInputStream >(); -} - -//----------------------------------------------- -uno::Reference< io::XOutputStream > SAL_CALL OFSStreamContainer::getOutputStream() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xStream.is() ) - throw uno::RuntimeException(); - - if ( m_xOutputStream.is() ) - return uno::Reference< io::XOutputStream >( static_cast< io::XOutputStream* >( this ) ); - - return uno::Reference< io::XOutputStream >(); -} - -// XComponent -//----------------------------------------------- -void SAL_CALL OFSStreamContainer::dispose() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xStream.is() ) - throw uno::RuntimeException(); - - if ( m_xInputStream.is() && !m_bInputClosed ) - { - m_xInputStream->closeInput(); - m_bInputClosed = sal_True; - } - - if ( m_xOutputStream.is() && !m_bOutputClosed ) - { - m_xOutputStream->closeOutput(); - m_bOutputClosed = sal_True; - } - - if ( m_pListenersContainer ) - { - lang::EventObject aSource( static_cast< ::cppu::OWeakObject*>( this ) ); - m_pListenersContainer->disposeAndClear( aSource ); - } - - m_bDisposed = sal_True; -} - -//----------------------------------------------- -void SAL_CALL OFSStreamContainer::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_pListenersContainer ) - m_pListenersContainer = new ::cppu::OInterfaceContainerHelper( m_aMutex ); - - m_pListenersContainer->addInterface( xListener ); -} - -//----------------------------------------------- -void SAL_CALL OFSStreamContainer::removeEventListener( const uno::Reference< lang::XEventListener >& xListener ) - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( m_pListenersContainer ) - m_pListenersContainer->removeInterface( xListener ); -} - - -// XSeekable -//----------------------------------------------- -void SAL_CALL OFSStreamContainer::seek( sal_Int64 location ) - throw ( lang::IllegalArgumentException, - io::IOException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xStream.is() || !m_xSeekable.is() ) - throw uno::RuntimeException(); - - m_xSeekable->seek( location ); -} - -//----------------------------------------------- -sal_Int64 SAL_CALL OFSStreamContainer::getPosition() - throw ( io::IOException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xStream.is() || !m_xSeekable.is() ) - throw uno::RuntimeException(); - - return m_xSeekable->getPosition(); -} - -//----------------------------------------------- -sal_Int64 SAL_CALL OFSStreamContainer::getLength() - throw ( io::IOException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xStream.is() || !m_xSeekable.is() ) - throw uno::RuntimeException(); - - return m_xSeekable->getLength(); -} - - -// XInputStream -//----------------------------------------------- -sal_Int32 SAL_CALL OFSStreamContainer::readBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) - throw( io::NotConnectedException, - io::BufferSizeExceededException, - io::IOException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xStream.is() || !m_xInputStream.is() ) - throw uno::RuntimeException(); - - return m_xInputStream->readBytes( aData, nBytesToRead ); -} - -//----------------------------------------------- -sal_Int32 SAL_CALL OFSStreamContainer::readSomeBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) - throw( io::NotConnectedException, - io::BufferSizeExceededException, - io::IOException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xStream.is() || !m_xInputStream.is() ) - throw uno::RuntimeException(); - - return m_xInputStream->readSomeBytes( aData, nMaxBytesToRead ); -} - -//----------------------------------------------- -void SAL_CALL OFSStreamContainer::skipBytes( sal_Int32 nBytesToSkip ) - throw( io::NotConnectedException, - io::BufferSizeExceededException, - io::IOException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xStream.is() || !m_xInputStream.is() ) - throw uno::RuntimeException(); - - m_xInputStream->skipBytes( nBytesToSkip ); -} - -//----------------------------------------------- -sal_Int32 SAL_CALL OFSStreamContainer::available() - throw( io::NotConnectedException, - io::IOException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xStream.is() || !m_xInputStream.is() ) - throw uno::RuntimeException(); - - return m_xInputStream->available(); -} - -//----------------------------------------------- -void SAL_CALL OFSStreamContainer::closeInput() - throw( io::NotConnectedException, - io::IOException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xStream.is() || !m_xInputStream.is() ) - throw uno::RuntimeException(); - - if ( m_xInputStream.is() ) - { - m_xInputStream->closeInput(); - m_bInputClosed = sal_True; - } - - if ( m_bOutputClosed ) - dispose(); -} - -// XOutputStream -//----------------------------------------------- -void SAL_CALL OFSStreamContainer::writeBytes( const uno::Sequence< sal_Int8 >& aData ) - throw ( io::NotConnectedException, - io::BufferSizeExceededException, - io::IOException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xStream.is() || !m_xOutputStream.is() ) - throw uno::RuntimeException(); - - return m_xOutputStream->writeBytes( aData ); -} - -//----------------------------------------------- -void SAL_CALL OFSStreamContainer::flush() - throw ( io::NotConnectedException, - io::BufferSizeExceededException, - io::IOException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xStream.is() || !m_xOutputStream.is() ) - throw uno::RuntimeException(); - - return m_xOutputStream->flush(); -} - -//----------------------------------------------- -void SAL_CALL OFSStreamContainer::closeOutput() - throw ( io::NotConnectedException, - io::BufferSizeExceededException, - io::IOException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xStream.is() || !m_xOutputStream.is() ) - throw uno::RuntimeException(); - - if ( m_xOutputStream.is() ) - { - m_xOutputStream->closeOutput(); - m_bOutputClosed = sal_True; - } - - if ( m_bInputClosed ) - dispose(); -} - - -// XTruncate -//----------------------------------------------- -void SAL_CALL OFSStreamContainer::truncate() - throw ( io::IOException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xStream.is() || !m_xTruncate.is() ) - throw uno::RuntimeException(); - - m_xTruncate->truncate(); -} - - -// XAsyncOutputMonitor -//----------------------------------------------- -void SAL_CALL OFSStreamContainer::waitForCompletion() - throw ( io::IOException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bDisposed ) - throw lang::DisposedException(); - - if ( !m_xStream.is() || !m_xAsyncOutputMonitor.is() ) - throw uno::RuntimeException(); - - m_xAsyncOutputMonitor->waitForCompletion(); -} - - - diff --git a/svtools/source/fsstor/ostreamcontainer.hxx b/svtools/source/fsstor/ostreamcontainer.hxx deleted file mode 100644 index 6198587c3d35..000000000000 --- a/svtools/source/fsstor/ostreamcontainer.hxx +++ /dev/null @@ -1,128 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ostreamcontainer.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _OSTREAMCONTAINER_HXX_ -#define _OSTREAMCONTAINER_HXX_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "com/sun/star/io/XAsyncOutputMonitor.hpp" -#include -#include -#include -#include - -class OFSStreamContainer : public cppu::OWeakObject, - public ::com::sun::star::lang::XTypeProvider, - public ::com::sun::star::embed::XExtendedStorageStream, - public ::com::sun::star::io::XSeekable, - public ::com::sun::star::io::XInputStream, - public ::com::sun::star::io::XOutputStream, - public ::com::sun::star::io::XTruncate, - public ::com::sun::star::io::XAsyncOutputMonitor -{ - ::osl::Mutex m_aMutex; - - ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xStream; - ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable > m_xSeekable; - ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xInputStream; - ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > m_xOutputStream; - ::com::sun::star::uno::Reference< ::com::sun::star::io::XTruncate > m_xTruncate; - ::com::sun::star::uno::Reference< ::com::sun::star::io::XAsyncOutputMonitor > m_xAsyncOutputMonitor; - - sal_Bool m_bDisposed; - sal_Bool m_bInputClosed; - sal_Bool m_bOutputClosed; - - ::cppu::OInterfaceContainerHelper* m_pListenersContainer; // list of listeners - ::cppu::OTypeCollection* m_pTypeCollection; - -public: - OFSStreamContainer( const ::com::sun::star::uno::Reference < ::com::sun::star::io::XStream >& xStream ); - virtual ~OFSStreamContainer(); - - // XInterface - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType ) - throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL acquire() throw(); - virtual void SAL_CALL release() throw(); - - // XTypeProvider - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() - throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() - throw( ::com::sun::star::uno::RuntimeException ); - - // XStream - virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > SAL_CALL getOutputStream( ) throw (::com::sun::star::uno::RuntimeException); - - // XComponent - virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); - - // XSeekable - virtual void SAL_CALL seek( sal_Int64 location ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int64 SAL_CALL getPosition() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int64 SAL_CALL getLength() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - - // XInputStream - virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) - throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) - throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL available( ) - throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL closeInput( ) - throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - - // XOutputStream - virtual void SAL_CALL writeBytes( const ::com::sun::star::uno::Sequence< sal_Int8 >& aData ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL flush( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL closeOutput( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - - // XTruncate - virtual void SAL_CALL truncate() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - - // XAsyncOutputMonitor - virtual void SAL_CALL waitForCompletion( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -}; - -#endif - diff --git a/svtools/source/hatchwindow/hatchwindowfactory.hxx b/svtools/source/hatchwindow/hatchwindowfactory.hxx new file mode 100644 index 000000000000..72eaa58bb16d --- /dev/null +++ b/svtools/source/hatchwindow/hatchwindowfactory.hxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: hatchwindowfactory.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XHATCHWINDOWFACTORY_HXX_ +#define _XHATCHWINDOWFACTORY_HXX_ + +#include +#include + + +#ifndef _CPPUHELPER_IMPLBASE5_HXX_ +#include +#endif + + +class OHatchWindowFactory : public ::cppu::WeakImplHelper2< + ::com::sun::star::embed::XHatchWindowFactory, + ::com::sun::star::lang::XServiceInfo > +{ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; + +public: + OHatchWindowFactory( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory ) + : m_xFactory( xFactory ) + { + OSL_ENSURE( xFactory.is(), "No service manager is provided!\n" ); + } + + static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL impl_staticGetSupportedServiceNames(); + + static ::rtl::OUString SAL_CALL impl_staticGetImplementationName(); + + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL + impl_staticCreateSelfInstance( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + + + // XHatchWindowFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XHatchWindow > SAL_CALL createHatchWindowInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent, const ::com::sun::star::awt::Rectangle& aBounds, const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + +}; + +#endif + diff --git a/svtools/source/inc/filectrl.hrc b/svtools/source/inc/filectrl.hrc new file mode 100644 index 000000000000..13fb89afd382 --- /dev/null +++ b/svtools/source/inc/filectrl.hrc @@ -0,0 +1,37 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: filectrl.hrc,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SV_FILECTRL_HRC +#define _SV_FILECTRL_HRC + +#define STR_FILECTRL_BUTTONTEXT 333 // ID-Range?! + +#endif + diff --git a/svtools/source/inc/fsfactory.hxx b/svtools/source/inc/fsfactory.hxx deleted file mode 100644 index 5954ecebabc2..000000000000 --- a/svtools/source/inc/fsfactory.hxx +++ /dev/null @@ -1,75 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: fsfactory.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __FSFACTORY_HXX_ -#define __FSACTORY_HXX_ - -#include -#include -#include - - -class FSStorage; - -class FSStorageFactory : public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XSingleServiceFactory, - ::com::sun::star::lang::XServiceInfo > -{ - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; - -public: - FSStorageFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory ) - : m_xFactory( xFactory ) - { - OSL_ENSURE( xFactory.is(), "No service manager is provided!\n" ); - } - - static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL - impl_staticGetSupportedServiceNames(); - - static ::rtl::OUString SAL_CALL impl_staticGetImplementationName(); - - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL - impl_staticCreateSelfInstance( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); - - - // XSingleServiceFactory - virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - -}; - -#endif - diff --git a/svtools/source/inc/gifread.hxx b/svtools/source/inc/gifread.hxx new file mode 100644 index 000000000000..8a9d299930c9 --- /dev/null +++ b/svtools/source/inc/gifread.hxx @@ -0,0 +1,147 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: gifread.hxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _GIFREAD_HXX +#define _GIFREAD_HXX + +#ifndef _GRAPH_HXX +#include +#endif +#ifndef _BMPACC_HXX +#include +#endif + +#ifdef _GIFPRIVATE + +// --------- +// - Enums - +// --------- + +enum GIFAction +{ + GLOBAL_HEADER_READING, + MARKER_READING, + EXTENSION_READING, + LOCAL_HEADER_READING, + FIRST_BLOCK_READING, + NEXT_BLOCK_READING, + ABORT_READING, + END_READING +}; + +// ------------------------------------------------------------------------ + +enum ReadState +{ + GIFREAD_OK, + GIFREAD_ERROR, + GIFREAD_NEED_MORE +}; + +// ------------- +// - GIFReader - +// ------------- + +class GIFLZWDecompressor; + +class SvStream; + +class GIFReader : public GraphicReader +{ + Graphic aImGraphic; + Animation aAnimation; + Bitmap aBmp8; + Bitmap aBmp1; + BitmapPalette aGPalette; + BitmapPalette aLPalette; + SvStream& rIStm; + void* pCallerData; + HPBYTE pSrcBuf; + GIFLZWDecompressor* pDecomp; + BitmapWriteAccess* pAcc8; + BitmapWriteAccess* pAcc1; + long nYAcc; + long nLastPos; + sal_uInt32 nLogWidth100; + sal_uInt32 nLogHeight100; + USHORT nTimer; + USHORT nGlobalWidth; // maximale Bildbreite aus Header + USHORT nGlobalHeight; // maximale Bildhoehe aus Header + USHORT nImageWidth; // maximale Bildbreite aus Header + USHORT nImageHeight; // maximale Bildhoehe aus Header + USHORT nImagePosX; + USHORT nImagePosY; + USHORT nImageX; // maximale Bildbreite aus Header + USHORT nImageY; // maximale Bildhoehe aus Header + USHORT nLastImageY; + USHORT nLastInterCount; + USHORT nLoops; + GIFAction eActAction; + BOOL bStatus; + BOOL bGCTransparent; // Ob das Bild Transparent ist, wenn ja: + BOOL bInterlaced; + BOOL bOverreadBlock; + BOOL bImGraphicReady; + BOOL bGlobalPalette; + BYTE nBackgroundColor; // Hintergrundfarbe + BYTE nGCTransparentIndex; // Pixel von diesem Index sind durchsichtig + BYTE nGCDisposalMethod; // 'Disposal Method' (siehe GIF-Doku) + BYTE cTransIndex1; + BYTE cNonTransIndex1; + + void ReadPaletteEntries( BitmapPalette* pPal, ULONG nCount ); + void ClearImageExtensions(); + BOOL CreateBitmaps( long nWidth, long nHeight, BitmapPalette* pPal, BOOL bWatchForBackgroundColor ); + BOOL ReadGlobalHeader(); + BOOL ReadExtension(); + BOOL ReadLocalHeader(); + ULONG ReadNextBlock(); + void FillImages( HPBYTE pBytes, ULONG nCount ); + void CreateNewBitmaps(); + BOOL ProcessGIF(); + +public: + + ReadState ReadGIF( Graphic& rGraphic ); + const Graphic& GetIntermediateGraphic(); + + GIFReader( SvStream& rStm ); + virtual ~GIFReader(); +}; + +#endif // _GIFPRIVATE + +// ------------- +// - ImportGIF - +// ------------- + + BOOL ImportGIF( SvStream& rStream, Graphic& rGraphic ); + +#endif // _GIFREAD_HXX diff --git a/svtools/source/inc/gradwrap.hxx b/svtools/source/inc/gradwrap.hxx new file mode 100644 index 000000000000..28c9d8db1fcd --- /dev/null +++ b/svtools/source/inc/gradwrap.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: gradwrap.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef _SVGEN_HXX +#include +#endif + + +/****************************************************************************** +|* +|* class GradientWrapper +|* +|* Ersterstellung: KA 24.11.95 +|* letzte Aenderung: KA 24.11.95 +|* +|* Zeck: dient beim MetaFile-Export dazu, die eigentliche Berechungs- +|* funktionalitaet zu kapseln. Das Schreiben der Records fuer +|* die unterschiedlichen File-Formate geschieht ueber LinkHandler. +|* +|* Klassen, die diesen Wrapper benutzen, muessen drei Linkhandler +|* zur Verfuegung stellen, die im Ctor uebergeben werden: +|* +|* 1. Linkhandler zum Schreiben eines Records fuer Polygonausgabe +|* 2. Linkhandler zum Schreiben eines Records fuer PolyPolygonausgabe +|* 3. Linkhandler zum Schreiben eines Records fuer Setzen der Brush +|* +\******************************************************************************/ + + +class GradientWrapper +{ + Link aDrawPolyRecordHdl; + Link aDrawPolyPolyRecordHdl; + Link aSetFillInBrushRecordHdl; + + GradientWrapper() {}; + + +public: + GradientWrapper(const Link& rDrawPolyRecordHdl, + const Link& rDrawPolyPolyRecordHdl, + const Link& rSetFillInBrushHdl); + ~GradientWrapper(); + + + void WriteLinearGradient(const Rectangle& rRect, + const Gradient& rGradient); + void WriteRadialGradient(const Rectangle& rRect, + const Gradient& rGradient); + void WriteRectGradient(const Rectangle& rRect, + const Gradient& rGradient); +}; diff --git a/svtools/source/inc/hatchwindowfactory.hxx b/svtools/source/inc/hatchwindowfactory.hxx deleted file mode 100644 index 72eaa58bb16d..000000000000 --- a/svtools/source/inc/hatchwindowfactory.hxx +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: hatchwindowfactory.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _XHATCHWINDOWFACTORY_HXX_ -#define _XHATCHWINDOWFACTORY_HXX_ - -#include -#include - - -#ifndef _CPPUHELPER_IMPLBASE5_HXX_ -#include -#endif - - -class OHatchWindowFactory : public ::cppu::WeakImplHelper2< - ::com::sun::star::embed::XHatchWindowFactory, - ::com::sun::star::lang::XServiceInfo > -{ - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; - -public: - OHatchWindowFactory( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory ) - : m_xFactory( xFactory ) - { - OSL_ENSURE( xFactory.is(), "No service manager is provided!\n" ); - } - - static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL impl_staticGetSupportedServiceNames(); - - static ::rtl::OUString SAL_CALL impl_staticGetImplementationName(); - - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL - impl_staticCreateSelfInstance( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); - - - // XHatchWindowFactory - virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XHatchWindow > SAL_CALL createHatchWindowInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent, const ::com::sun::star::awt::Rectangle& aBounds, const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - -}; - -#endif - diff --git a/svtools/source/inc/iodlg.hrc b/svtools/source/inc/iodlg.hrc new file mode 100644 index 000000000000..36e3092064cd --- /dev/null +++ b/svtools/source/inc/iodlg.hrc @@ -0,0 +1,110 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: iodlg.hrc,v $ + * $Revision: 1.10 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVTOOLS_IODLGIMPL_HRC +#define _SVTOOLS_IODLGIMPL_HRC + +#ifndef _SVTOOLS_HRC +#include +#endif + +// ModalDialog DLG_SVT_EXPLORERFILE + +#define FT_EXPLORERFILE_CURRENTPATH 10 +#define BTN_EXPLORERFILE_NEWFOLDER 11 +#define BTN_EXPLORERFILE_LISTVIEW 12 +#define BTN_EXPLORERFILE_DETAILSVIEW 13 +#define BTN_EXPLORERFILE_UP 14 +#define BTN_EXPLORERFILE_STANDARD 15 +#define BTN_EXPLORERFILE_OPEN 16 +#define BTN_EXPLORERFILE_CANCEL 17 +#define BTN_EXPLORERFILE_HELP 18 + +#define IMG_FILEDLG_BTN_UP 10 +#define IMG_FILEDLG_BTN_STD 11 +#define IMG_FILEDLG_CREATEFOLDER 15 + +#define CTL_EXPLORERFILE_FILELIST 20 + +#define FT_EXPLORERFILE_FILENAME 30 +#define ED_EXPLORERFILE_FILENAME 31 +#define FT_EXPLORERFILE_SHARED_LISTBOX 32 +#define LB_EXPLORERFILE_SHARED_LISTBOX 33 +#define FT_EXPLORERFILE_FILETYPE 34 +#define LB_EXPLORERFILE_FILETYPE 35 + +#define CB_EXPLORERFILE_READONLY 40 +#define CB_EXPLORERFILE_PASSWORD 41 +#define CB_AUTO_EXTENSION 42 +#define CB_OPTIONS 43 + +// ----------------------------------------------- + +#define STR_EXPLORERFILE_OPEN 1 +#define STR_EXPLORERFILE_SAVE 2 +#define STR_EXPLORERFILE_BUTTONSAVE 3 +#define STR_PATHNAME 4 +#define STR_PATHSELECT 5 +#define STR_BUTTONSELECT 6 +#define STR_ACTUALVERSION 7 + +// DLG_SVT_QUERYFOLDERNAME ----------------------- + +#define FT_SVT_QUERYFOLDERNAME_DLG_NAME 10 +#define ED_SVT_QUERYFOLDERNAME_DLG_NAME 11 +#define FL_SVT_QUERYFOLDERNAME_DLG_NAME 12 +#define BT_SVT_QUERYFOLDERNAME_DLG_OK 13 +#define BT_SVT_QUERYFOLDERNAME_DLG_CANCEL 14 +#define BT_SVT_QUERYFOLDERNAME_DLG_HELP 15 + +// ----------------------------------------------- + +#define SID_SFX_START 5000 +#define SID_OPENURL (SID_SFX_START + 596) + +#define HID_FILEDLG_STANDARD (HID_SFX_START + 27) +#define HID_FILEDLG_MANAGER (HID_SFX_START + 28) +#define HID_FILEDLG_URL (HID_SFX_START + 29) +#define HID_FILEDLG_USE_PASSWD (HID_SFX_START + 31) +#define HID_FILEDLG_READ_ONLY (HID_SFX_START + 32) + +#define HID_FILEDLG_AUTOCOMPLETEBOX (HID_SFX_START + 218) +#define HID_FILEDLG_SAVE_BTN (HID_SFX_START + 219) +#define HID_FILEDLG_SAVE_FILENAME (HID_SFX_START + 220) +#define HID_FILEDLG_SAVE_FILETYPE (HID_SFX_START + 221) +#define HID_FILEDLG_INSERT_BTN (HID_SFX_START + 222) +#define HID_FILEDLG_PATH_BTN (HID_SFX_START + 223) +#define HID_FILEDLG_PATH_FILENAME (HID_SFX_START + 224) +#define HID_FILEDLG_FOLDER_BTN (HID_SFX_START + 225) +#define HID_FILEDLG_FOLDER_FILENAME (HID_SFX_START + 226) +#define HID_FILEDLG_SRCHFOLDER_BTN (HID_SFX_START + 227) + +#endif + diff --git a/svtools/source/inc/jpeg.hxx b/svtools/source/inc/jpeg.hxx new file mode 100644 index 000000000000..d8de26c31009 --- /dev/null +++ b/svtools/source/inc/jpeg.hxx @@ -0,0 +1,127 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: jpeg.hxx,v $ + * $Revision: 1.10 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _JPEG_HXX +#define _JPEG_HXX + +#ifndef _GRAPH_HXX +#include +#endif +#include +#include +#include +#include + +#ifdef _JPEGPRIVATE + +// -------- +// - Enum - +// -------- + +enum ReadState +{ + JPEGREAD_OK, + JPEGREAD_ERROR, + JPEGREAD_NEED_MORE +}; + +// -------------- +// - JPEGReader - +// -------------- + +class JPEGReader : public GraphicReader +{ + SvStream& rIStm; + Bitmap aBmp; + Bitmap aBmp1; + BitmapWriteAccess* pAcc; + BitmapWriteAccess* pAcc1; + void* pBuffer; + long nLastPos; + long nFormerPos; + long nLastLines; + sal_Bool bSetLogSize; + + Graphic CreateIntermediateGraphic( const Bitmap& rBitmap, long nLines ); + void FillBitmap(); + +public: + + void* CreateBitmap( void* JPEGCreateBitmapParam ); + +public: + + + + JPEGReader( SvStream& rStm, void* pCallData, sal_Bool bSetLogSize ); + virtual ~JPEGReader(); + + + ReadState Read( Graphic& rGraphic ); +}; + +// -------------- +// - JPEGWriter - +// -------------- + +class JPEGWriter +{ + SvStream& rOStm; + Bitmap aBmp; + BitmapReadAccess* pAcc; + BYTE* pBuffer; + BOOL bNative; + + sal_Bool bGreys; + sal_Int32 nQuality; + + com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator; + +public: + + void* GetScanline( long nY ); + + JPEGWriter( SvStream& rOStm, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData ); + ~JPEGWriter() {}; + + BOOL Write( const Graphic& rGraphic ); +}; + +#endif // _JPEGPRIVATE + +// --------------------- +// - Import/ExportJPEG - +// --------------------- + +BOOL ImportJPEG( SvStream& rStream, Graphic& rGraphic, void* pCallerData, sal_Int32 nImportFlags ); + +BOOL ExportJPEG( SvStream& rStream, const Graphic& rGraphic, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData ); + +#endif // _JPEG_HXX diff --git a/svtools/source/inc/msgrd.hxx b/svtools/source/inc/msgrd.hxx new file mode 100644 index 000000000000..381ae71c7b83 --- /dev/null +++ b/svtools/source/inc/msgrd.hxx @@ -0,0 +1,40 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: msgrd.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _MSGRD_HXX +#define _MSGRD_HXX + + +BOOL ConvertMSGToGDIMetaFile( SvStream & rMSG, GDIMetaFile & rGDIMetaFile, + BOOL(*pCallback)(void *, USHORT), void * pCallerData, + ULONG nMinPercent, ULONG nMaxPercent); + + +#endif // _MSGRD_HXX diff --git a/svtools/source/inc/msgwr.hxx b/svtools/source/inc/msgwr.hxx new file mode 100644 index 000000000000..c347938fd34d --- /dev/null +++ b/svtools/source/inc/msgwr.hxx @@ -0,0 +1,41 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: msgwr.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _MSGWR_HXX +#define _MSGWR_HXX + + +BOOL ConvertGraphicToMSG(const Graphic & rGraphic, SvStream & rTargetStream, + BOOL(*pCallback)(void *, USHORT), void * pCallerData, + ULONG nMinPercent, ULONG nMaxPercent); + + +#endif // _MSGWR_HXX + diff --git a/svtools/source/inc/passwordcontainer.hxx b/svtools/source/inc/passwordcontainer.hxx deleted file mode 100644 index a067672f3cf6..000000000000 --- a/svtools/source/inc/passwordcontainer.hxx +++ /dev/null @@ -1,429 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: passwordcontainer.hxx,v $ - * $Revision: 1.11 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INCLUDED_COMPHELPER_PASSWORDCONTAINER_HXX -#define INCLUDED_COMPHELPER_PASSWORDCONTAINER_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include "syscreds.hxx" - -#define MEMORY_RECORD 0 -#define PERSISTENT_RECORD 1 - -//---------------------------------------------------------------------------------- - -class NamePassRecord -{ - ::rtl::OUString m_aName; - - // there are two lists of passwords, memory passwords and persistent passwords - sal_Bool m_bHasMemPass; - ::std::vector< ::rtl::OUString > m_aMemPass; - - // persistent passwords are encrypted in one string - sal_Bool m_bHasPersPass; - ::rtl::OUString m_aPersPass; - - void InitArrays( sal_Bool bHasMemoryList, const ::std::vector< ::rtl::OUString >& aMemoryList, - sal_Bool bHasPersistentList, const ::rtl::OUString& aPersistentList ) - { - m_bHasMemPass = bHasMemoryList; - if ( bHasMemoryList ) - m_aMemPass = aMemoryList; - - m_bHasPersPass = bHasPersistentList; - if ( bHasPersistentList ) - m_aPersPass = aPersistentList; - } - -public: - - NamePassRecord( const ::rtl::OUString& aName ) - : m_aName( aName ) - , m_bHasMemPass( sal_False ) - , m_bHasPersPass( sal_False ) - { - } - - NamePassRecord( const ::rtl::OUString& aName, const ::std::vector< ::rtl::OUString >& aMemoryList ) - : m_aName( aName ) - , m_bHasMemPass( sal_True ) - , m_aMemPass( aMemoryList ) - , m_bHasPersPass( sal_False ) - { - } - - NamePassRecord( const ::rtl::OUString& aName, const ::rtl::OUString& aPersistentList ) - : m_aName( aName ) - , m_bHasMemPass( sal_False ) - , m_bHasPersPass( sal_True ) - , m_aPersPass( aPersistentList ) - { - } - - NamePassRecord( const ::rtl::OUString& aName, - sal_Bool bHasMemoryList, const ::std::vector< ::rtl::OUString >& aMemoryList, - sal_Bool bHasPersistentList, const ::rtl::OUString aPersistentList ) - : m_aName( aName ) - , m_bHasMemPass( bHasMemoryList ) - , m_bHasPersPass( bHasPersistentList ) - { - InitArrays( bHasMemoryList, aMemoryList, bHasPersistentList, aPersistentList ); - } - - NamePassRecord( const NamePassRecord& aRecord ) - : m_aName( aRecord.m_aName ) - , m_bHasMemPass( sal_False ) - , m_bHasPersPass( sal_False ) - { - InitArrays( aRecord.m_bHasMemPass, aRecord.m_aMemPass, aRecord.m_bHasPersPass, aRecord.m_aPersPass ); - } - - NamePassRecord& operator=( const NamePassRecord& aRecord ) - { - m_aName = aRecord.m_aName; - - m_aMemPass.clear(); - m_aPersPass = ::rtl::OUString(); - InitArrays( aRecord.m_bHasMemPass, aRecord.m_aMemPass, aRecord.m_bHasPersPass, aRecord.m_aPersPass ); - - return *this; - } - - ::rtl::OUString GetUserName() const - { - return m_aName; - } - - sal_Bool HasPasswords( sal_Int8 nStatus ) const - { - if ( nStatus == MEMORY_RECORD ) - return m_bHasMemPass; - if ( nStatus == PERSISTENT_RECORD ) - return m_bHasPersPass; - - return sal_False; - } - - ::std::vector< ::rtl::OUString > GetMemPasswords() const - { - if ( m_bHasMemPass ) - return m_aMemPass; - - return ::std::vector< ::rtl::OUString >(); - } - - ::rtl::OUString GetPersPasswords() const - { - if ( m_bHasPersPass ) - return m_aPersPass; - - return ::rtl::OUString(); - } - - void SetMemPasswords( const ::std::vector< ::rtl::OUString >& aMemList ) - { - m_aMemPass = aMemList; - m_bHasMemPass = sal_True; - } - - void SetPersPasswords( const ::rtl::OUString& aPersList ) - { - m_aPersPass = aPersList; - m_bHasPersPass = sal_True; - } - - void RemovePasswords( sal_Int8 nStatus ) - { - if ( nStatus == MEMORY_RECORD ) - { - m_bHasMemPass = sal_False; - m_aMemPass.clear(); - } - else if ( nStatus == PERSISTENT_RECORD ) - { - m_bHasPersPass = sal_False; - m_aPersPass = ::rtl::OUString(); - } - } - -}; - -//---------------------------------------------------------------------------------- - -typedef ::std::pair< const ::rtl::OUString, ::std::list< NamePassRecord > > PairUrlRecord; -typedef ::std::map< ::rtl::OUString, ::std::list< NamePassRecord > > PassMap; - -//---------------------------------------------------------------------------------- - -class PasswordContainer; - -class StorageItem : public ::utl::ConfigItem { - PasswordContainer* mainCont; - sal_Bool hasEncoded; - ::rtl::OUString mEncoded; -public: - StorageItem( PasswordContainer* point, const ::rtl::OUString& path ) : - ConfigItem( path, CONFIG_MODE_IMMEDIATE_UPDATE ), - mainCont( point ), - hasEncoded( sal_False ) - { - ::com::sun::star::uno::Sequence< ::rtl::OUString > aNode( 1 ); - *aNode.getArray() = path; - *aNode.getArray() += ::rtl::OUString::createFromAscii( "/Store" ); - EnableNotification( aNode ); - } - - PassMap getInfo(); - void update( const ::rtl::OUString& url, const NamePassRecord& rec ); - void remove( const ::rtl::OUString& url, const ::rtl::OUString& rec ); - void clear(); - - sal_Bool getEncodedMP( ::rtl::OUString& aResult ); - void setEncodedMP( const ::rtl::OUString& aResult, sal_Bool bAcceptEnmpty = sal_False ); - void setUseStorage( sal_Bool bUse ); - sal_Bool useStorage(); - - virtual void Notify( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ); - virtual void Commit(); -}; - -//---------------------------------------------------------------------------------- - -enum PasswordState { - no_password, - entered, - cancelled -}; - -class PasswordContainer : public ::cppu::WeakImplHelper5< - ::com::sun::star::task::XPasswordContainer, - ::com::sun::star::task::XMasterPasswordHandling2, - ::com::sun::star::task::XUrlContainer, - ::com::sun::star::lang::XServiceInfo, - ::com::sun::star::lang::XEventListener > -{ -private: - PassMap m_aContainer; - StorageItem* m_pStorageFile; - ::osl::Mutex mMutex; - ::rtl::OUString m_aMasterPasswd; // master password is set when the string is not empty - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mComponent; - SysCredentialsConfig mUrlContainer; - - ::com::sun::star::uno::Sequence< ::com::sun::star::task::UserRecord > CopyToUserRecordSequence( - const ::std::list< NamePassRecord >& original, - const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) - throw(::com::sun::star::uno::RuntimeException); - - ::com::sun::star::task::UserRecord CopyToUserRecord( - const NamePassRecord& aRecord, - sal_Bool& io_bTryToDecode, - const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler ); - - ::com::sun::star::uno::Sequence< ::com::sun::star::task::UserRecord > FindUsr( - const ::std::list< NamePassRecord >& userlist, - const ::rtl::OUString& name, - const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) - throw(::com::sun::star::uno::RuntimeException); -bool createUrlRecord( - const PassMap::iterator & rIter, - bool bName, - const ::rtl::OUString & aName, - const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler, - ::com::sun::star::task::UrlRecord & rRec ) - throw( ::com::sun::star::uno::RuntimeException ); - -::com::sun::star::task::UrlRecord find( - const ::rtl::OUString& aURL, - const ::rtl::OUString& aName, - bool bName, // only needed to support empty user names - const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler ) throw(::com::sun::star::uno::RuntimeException); - - ::rtl::OUString GetDefaultMasterPassword(); - - ::rtl::OUString RequestPasswordFromUser( - ::com::sun::star::task::PasswordRequestMode aRMode, - const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ); - - ::rtl::OUString GetMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) - throw(::com::sun::star::uno::RuntimeException); - - void UpdateVector( const ::rtl::OUString& url, ::std::list< NamePassRecord >& toUpdate, NamePassRecord& rec, sal_Bool writeFile ) - throw(::com::sun::star::uno::RuntimeException); - - void PrivateAdd( const ::rtl::OUString& aUrl, - const ::rtl::OUString& aUserName, - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPasswords, - char aMode, - const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) - throw(::com::sun::star::uno::RuntimeException); - - ::std::vector< ::rtl::OUString > DecodePasswords( const ::rtl::OUString& aLine, const ::rtl::OUString& aMasterPassword ) - throw(::com::sun::star::uno::RuntimeException); - - ::rtl::OUString EncodePasswords( ::std::vector< ::rtl::OUString > lines, const ::rtl::OUString& aMasterPassword ) - throw(::com::sun::star::uno::RuntimeException); - -public: - PasswordContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); - ~PasswordContainer(); - - virtual void SAL_CALL add( const ::rtl::OUString& aUrl, - const ::rtl::OUString& aUserName, - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPasswords, - const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) - throw(::com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL addPersistent( const ::rtl::OUString& aUrl, - const ::rtl::OUString& aUserName, - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPasswords, - const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) - throw(::com::sun::star::uno::RuntimeException); - - virtual ::com::sun::star::task::UrlRecord SAL_CALL - find( const ::rtl::OUString& aUrl, - const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) - throw(::com::sun::star::uno::RuntimeException); - - virtual ::com::sun::star::task::UrlRecord SAL_CALL - findForName( const ::rtl::OUString& aUrl, - const ::rtl::OUString& aUserName, - const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) - throw(::com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL remove( const ::rtl::OUString& aUrl, - const ::rtl::OUString& aUserName ) - throw(::com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL removePersistent( const ::rtl::OUString& aUrl, - const ::rtl::OUString& aUserName ) - throw(::com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL removeAllPersistent() throw(::com::sun::star::uno::RuntimeException); - - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::task::UrlRecord > SAL_CALL - getAllPersistent( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) throw(::com::sun::star::uno::RuntimeException); - - - // provide factory - static ::rtl::OUString SAL_CALL impl_getStaticImplementationName( ) throw(::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL - impl_getStaticSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > SAL_CALL - impl_createFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ServiceManager ) throw(::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL - impl_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) throw( ::com::sun::star::uno::RuntimeException ); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); - - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL - getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); - - // XEventListener - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) - throw(::com::sun::star::uno::RuntimeException); - - // XMasterPasswordHandling - virtual ::sal_Bool SAL_CALL authorizateWithMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ) - throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL changeMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeMasterPassword() throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL hasMasterPassword( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL allowPersistentStoring( ::sal_Bool bAllow ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL isPersistentStoringAllowed( ) throw (::com::sun::star::uno::RuntimeException); - - // XMasterPasswordHandling2 - virtual ::sal_Bool SAL_CALL useDefaultMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL isDefaultMasterPasswordUsed( ) throw (::com::sun::star::uno::RuntimeException); - - // XUrlContainer - virtual void SAL_CALL addUrl( const ::rtl::OUString& Url, ::sal_Bool MakePersistent ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL findUrl( const ::rtl::OUString& Url ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeUrl( const ::rtl::OUString& Url ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getUrls( ::sal_Bool OnlyPersistent ) throw (::com::sun::star::uno::RuntimeException); - - void Notify(); -}; - -//---------------------------------------------------------------------------------- - -class MasterPasswordRequest_Impl : public ucbhelper::InteractionRequest -{ - ::rtl::Reference< ucbhelper::InteractionSupplyAuthentication > m_xAuthSupplier; - -public: - MasterPasswordRequest_Impl( ::com::sun::star::task::PasswordRequestMode Mode ); - - const ::rtl::Reference< ucbhelper::InteractionSupplyAuthentication > & - getAuthenticationSupplier() const { return m_xAuthSupplier; } - -}; - -//---------------------------------------------------------------------------------- - -class RW_SvMemoryStream : public SvMemoryStream { -public: - RW_SvMemoryStream( void* Buf, ULONG Size, StreamMode eMode ): - SvMemoryStream( Buf, Size, eMode){} - - RW_SvMemoryStream( ULONG InitSize=512, ULONG Resize=64 ): - SvMemoryStream( InitSize, Resize ){} - - ULONG getActualSize(){ return nEndOfData; } -}; - - - -#endif // #ifndef INCLUDED_COMPHELPER_PASSWORDCONTAINER_HXX - diff --git a/svtools/source/inc/poolio.hxx b/svtools/source/inc/poolio.hxx deleted file mode 100644 index fb30fc04832d..000000000000 --- a/svtools/source/inc/poolio.hxx +++ /dev/null @@ -1,204 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: poolio.hxx,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include - - -#ifndef DELETEZ -#define DELETEZ(pPtr) { delete pPtr; pPtr = 0; } -#endif - - -struct SfxPoolVersion_Impl -{ - USHORT _nVer; - USHORT _nStart, _nEnd; - USHORT* _pMap; - - SfxPoolVersion_Impl( USHORT nVer, USHORT nStart, USHORT nEnd, - USHORT *pMap ) - : _nVer( nVer ), - _nStart( nStart ), - _nEnd( nEnd ), - _pMap( pMap ) - {} - SfxPoolVersion_Impl( const SfxPoolVersion_Impl &rOrig ) - : _nVer( rOrig._nVer ), - _nStart( rOrig._nStart ), - _nEnd( rOrig._nEnd ), - _pMap( rOrig._pMap ) - {} -}; - -SV_DECL_PTRARR( SfxPoolItemArrayBase_Impl, SfxPoolItem*, 0, 5 ) -SV_DECL_PTRARR_DEL( SfxPoolVersionArr_Impl, SfxPoolVersion_Impl*, 0, 2 ) - -struct SfxPoolItemArray_Impl: public SfxPoolItemArrayBase_Impl -{ - USHORT nFirstFree; - - SfxPoolItemArray_Impl (USHORT nInitSize = 0) - : SfxPoolItemArrayBase_Impl( nInitSize ), - nFirstFree( 0 ) - {} -}; - -class SfxStyleSheetIterator; - -struct SfxItemPool_Impl -{ - SfxBroadcaster aBC; - SfxPoolItemArray_Impl** ppPoolItems; - SfxPoolVersionArr_Impl aVersions; - USHORT nVersion; - USHORT nLoadingVersion; - USHORT nInitRefCount; // 1, beim Laden ggf. 2 - USHORT nVerStart, nVerEnd; // WhichRange in Versions - USHORT nStoringStart, nStoringEnd; // zu speichernder Range - BYTE nMajorVer, nMinorVer; // Pool selbst - SfxMapUnit eDefMetric; - FASTBOOL bInSetItem; - FASTBOOL bStreaming; // in Load() bzw. Store() - - SfxItemPool_Impl( USHORT nStart, USHORT nEnd ) - : ppPoolItems (new SfxPoolItemArray_Impl*[ nEnd - nStart + 1]) - { - memset( ppPoolItems, 0, sizeof( SfxPoolItemArray_Impl* ) * ( nEnd - nStart + 1) ); - } - - ~SfxItemPool_Impl() - { - delete[] ppPoolItems; - } - - void DeleteItems() - { - delete[] ppPoolItems; ppPoolItems = 0; - } -}; - -// ----------------------------------------------------------------------- - -// IBM-C-Set mag keine doppelten Defines -#ifdef DBG -# undef DBG -#endif - -#if defined(DBG_UTIL) && defined(MSC) -#define SFX_TRACE(s,p) \ - { \ - ByteString aPtr(RTL_CONSTASCII_STRINGPARAM("0x0000:0x0000")); \ - _snprintf(const_cast< sal_Char *>(aPtr.GetBuffer()), aPtr.Len(), \ - "%lp", p ); \ - aPtr.Insert(s, 0); \ - DbgTrace( aPtr.GetBuffer() ); \ - } -#define DBG(x) x -#else -#define SFX_TRACE(s,p) -#define DBG(x) -#endif - -#define CHECK_FILEFORMAT( rStream, nTag ) \ - { USHORT nFileTag; \ - rStream >> nFileTag; \ - if ( nTag != nFileTag ) \ - { \ - DBG_ERROR( #nTag ); /*! s.u. */ \ - /*! error-code setzen und auswerten! */ \ - (rStream).SetError(SVSTREAM_FILEFORMAT_ERROR); \ - pImp->bStreaming = FALSE; \ - return rStream; \ - } \ - } - -#define CHECK_FILEFORMAT_RELEASE( rStream, nTag, pPointer ) \ - { USHORT nFileTag; \ - rStream >> nFileTag; \ - if ( nTag != nFileTag ) \ - { \ - DBG_ERROR( #nTag ); /*! s.u. */ \ - /*! error-code setzen und auswerten! */ \ - (rStream).SetError(SVSTREAM_FILEFORMAT_ERROR); \ - pImp->bStreaming = FALSE; \ - delete pPointer; \ - return rStream; \ - } \ - } - -#define CHECK_FILEFORMAT2( rStream, nTag1, nTag2 ) \ - { USHORT nFileTag; \ - rStream >> nFileTag; \ - if ( nTag1 != nFileTag && nTag2 != nFileTag ) \ - { \ - DBG_ERROR( #nTag1 ); /*! s.u. */ \ - /*! error-code setzen und auswerten! */ \ - (rStream).SetError(SVSTREAM_FILEFORMAT_ERROR); \ - pImp->bStreaming = FALSE; \ - return rStream; \ - } \ - } - -#define SFX_ITEMPOOL_VER_MAJOR BYTE(2) -#define SFX_ITEMPOOL_VER_MINOR BYTE(0) - -#define SFX_ITEMPOOL_TAG_STARTPOOL_4 USHORT(0x1111) -#define SFX_ITEMPOOL_TAG_STARTPOOL_5 USHORT(0xBBBB) -#define SFX_ITEMPOOL_TAG_ITEMPOOL USHORT(0xAAAA) -#define SFX_ITEMPOOL_TAG_ITEMS USHORT(0x2222) -#define SFX_ITEMPOOL_TAG_ITEM USHORT(0x7777) -#define SFX_ITEMPOOL_TAG_SIZES USHORT(0x3333) -#define SFX_ITEMPOOL_TAG_DEFAULTS USHORT(0x4444) -#define SFX_ITEMPOOL_TAG_VERSIONMAP USHORT(0x5555) -#define SFX_ITEMPOOL_TAG_HEADER USHORT(0x6666) -#define SFX_ITEMPOOL_TAG_ENDPOOL USHORT(0xEEEE) -#define SFX_ITEMPOOL_TAG_TRICK4OLD USHORT(0xFFFF) - -#define SFX_ITEMPOOL_REC BYTE(0x01) -#define SFX_ITEMPOOL_REC_HEADER BYTE(0x10) -#define SFX_ITEMPOOL_REC_VERSIONMAP USHORT(0x0020) -#define SFX_ITEMPOOL_REC_WHICHIDS USHORT(0x0030) -#define SFX_ITEMPOOL_REC_ITEMS USHORT(0x0040) -#define SFX_ITEMPOOL_REC_DEFAULTS USHORT(0x0050) - -#define SFX_ITEMSET_REC BYTE(0x02) - -#define SFX_STYLES_REC BYTE(0x03) -#define SFX_STYLES_REC_HEADER USHORT(0x0010) -#define SFX_STYLES_REC_STYLES USHORT(0x0020) - -//======================================================================== - -inline USHORT SfxItemPool::GetIndex_Impl(USHORT nWhich) const -{ - DBG_CHKTHIS(SfxItemPool, 0); - DBG_ASSERT(nWhich >= nStart && nWhich <= nEnd, "Which-Id nicht im Pool-Bereich"); - return nWhich - nStart; -} - diff --git a/svtools/source/inc/property.hxx b/svtools/source/inc/property.hxx new file mode 100644 index 000000000000..cfdc62dd350c --- /dev/null +++ b/svtools/source/inc/property.hxx @@ -0,0 +1,588 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: property.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SV_PROPERTY_HXX +#define SV_PROPERTY_HXX + +#ifndef _VIRDEV_HXX //autogen +#include +#endif +#ifndef SV_FIXED_HXX +#include +#endif +#ifndef SV_LSTBOX_HXX +#include +#endif +#ifndef SV_GROUP_HXX +#include +#endif +#ifndef SV_BUTTON_HXX +#include +#endif +#ifndef SV_MOREBTN_HXX +#include +#endif +#ifndef _DIALOG_HXX //autogen +#include +#endif +#include +#include +#include + +#define _SVSTDARR_USHORTS +#include +#include +#include +#include + +#ifndef _SVSTDARR_STRINGS +#define _SVSTDARR_STRINGS +#include +#endif +#include +#include + +//------------------------------------------------------------------------ + +//======================================================================== +enum eKindOfControl { KOC_UNDEFINED=0,KOC_LISTBOX=1, KOC_COMBOBOX=2, + KOC_EDIT=3,KOC_USERDEFINED=5}; + +class SvXPropertyCtrListener; + +class SvXPropertyControl : public Control +{ +public: + SvXPropertyControl( Window* pParent, WinBits nWinStyle = 0 ); + SvXPropertyControl( Window* pParent, const ResId& rResId ); + + virtual void SetSvXPropertyCtrListener(SvXPropertyCtrListener*)=0; + + virtual SvXPropertyCtrListener* GetSvXPropertyCtrListener()=0; + virtual void SetProperty(const String &rString)=0; + virtual String GetProperty()const=0; + virtual BOOL HasList()=0; + virtual void ClearList()=0; + virtual void InsertEntry( const String& rString, + USHORT nPos = LISTBOX_APPEND )=0; + + virtual void SetCtrSize(const Size& rSize)=0; + virtual void SetLocked(BOOL bLocked=TRUE)=0; + + virtual void SetMyName(const String &rString)=0; + virtual String GetMyName()const=0; + + virtual void SetMyData(void*)=0; + virtual void* GetMyData()=0; +}; + +class SvXPropertyCtrListener +{ + +public: + virtual void Modified (SvXPropertyControl *pSvXPCtr)=0; + virtual void GetFocus (SvXPropertyControl *pSvXPCtr)=0; + virtual void LoseFocus(SvXPropertyControl *pSvXPCtr)=0; + virtual void KeyInput (SvXPropertyControl *pSvXPCtr ,const KeyCode&)=0; +}; + + +class SvXPropertyEdit : public SvXPropertyControl +{ +private: + + String aName; + SvXPropertyCtrListener* pListener; + Edit aEdit; + void* pData; + + DECL_LINK(ModifiedHdl,Edit*); + DECL_LINK(GetFocusHdl,Edit*); + DECL_LINK(LoseFocusHdl,Edit*); + +public: + SvXPropertyEdit( Window* pParent, WinBits nWinStyle = 0 ); + SvXPropertyEdit( Window* pParent, const ResId& rResId ); + + virtual void SetSvXPropertyCtrListener(SvXPropertyCtrListener*); + + virtual SvXPropertyCtrListener* GetSvXPropertyCtrListener(); + + virtual void SetProperty(const String &rString); + virtual String GetProperty()const; + + virtual BOOL HasList(); + virtual void ClearList(); + virtual void InsertEntry( const String& rString, + USHORT nPos = LISTBOX_APPEND ); + + virtual void SetCtrSize(const Size& rSize); + virtual void SetLocked(BOOL bLocked=TRUE); + + virtual void SetMyName(const String &rString); + virtual String GetMyName()const; + + virtual void SetMyData(void*); + virtual void* GetMyData(); +}; + + +class SvXPropertyListBox : public SvXPropertyControl +{ +private: + + String aName; + SvXPropertyCtrListener* pListener; + ListBox aListBox; + void* pData; + + DECL_LINK(ModifiedHdl,ListBox*); + DECL_LINK(GetFocusHdl,ListBox*); + DECL_LINK(LoseFocusHdl,ListBox*); + + +public: + SvXPropertyListBox( Window* pParent, WinBits nWinStyle = 0 ); + SvXPropertyListBox( Window* pParent, const ResId& rResId ); + + virtual void SetSvXPropertyCtrListener(SvXPropertyCtrListener*); + + virtual SvXPropertyCtrListener* GetSvXPropertyCtrListener(); + + ListBox* GetListBox(); + + virtual void SetProperty(const String &rString); + virtual String GetProperty()const; + + virtual BOOL HasList(); + virtual void ClearList(); + virtual void InsertEntry( const String& rString, + USHORT nPos = LISTBOX_APPEND ); + + virtual void SetCtrSize(const Size& rSize); + virtual void SetLocked(BOOL bLocked=TRUE); + + virtual void SetMyName(const String &rString); + virtual String GetMyName()const; + + virtual void SetMyData(void*); + virtual void* GetMyData(); +}; + +class SvXPropertyComboBox : public SvXPropertyControl +{ +private: + + String aName; + SvXPropertyCtrListener* pListener; + ComboBox aComboBox; + void* pData; + + DECL_LINK(ModifiedHdl,ComboBox*); + DECL_LINK(GetFocusHdl,ComboBox*); + DECL_LINK(LoseFocusHdl,ComboBox*); + + +public: + SvXPropertyComboBox( Window* pParent, WinBits nWinStyle = 0 ); + SvXPropertyComboBox( Window* pParent, const ResId& rResId ); + + virtual void SetSvXPropertyCtrListener(SvXPropertyCtrListener*); + + virtual SvXPropertyCtrListener* GetSvXPropertyCtrListener(); + + ComboBox* GetComboBox(); + + virtual void SetProperty(const String &rString); + virtual String GetProperty()const; + + virtual BOOL HasList(); + virtual void ClearList(); + virtual void InsertEntry( const String& rString, + USHORT nPos = LISTBOX_APPEND ); + + virtual void SetCtrSize(const Size& rSize); + virtual void SetLocked(BOOL bLocked=TRUE); + + virtual void SetMyName(const String &rString); + virtual String GetMyName()const; + + virtual void SetMyData(void*); + virtual void* GetMyData(); +}; + + + +class SvPropertyLine : public Control +{ +private: + FixedText aName; + USHORT nNameWidth; + BOOL bNeedsRepaint; + SvXPropertyControl* pSvXPropertyControl; + + PushButton aXButton; + BOOL bIsLocked; + BOOL bHasXButton; + BOOL bIsHyperlink; + eKindOfControl eKindOfCtr; + +protected: + virtual void Resize(); + +public: + SvPropertyLine( Window* pParent, + WinBits nWinStyle = 0 ); + SvPropertyLine( Window* pParent, + const ResId& rResId ); + + BOOL NeedsRepaint(); + void SetNeedsRepaint(BOOL bFlag); + void SetSvXPropertyControl(SvXPropertyControl*); + SvXPropertyControl* GetSvXPropertyControl(); + + void SetKindOfControl(eKindOfControl); + eKindOfControl GetKindOfControl(); + + void SetName(const String& rString ); + String GetName() const; + void SetNameWidth(USHORT); + + void ShowXButton(); + void HideXButton(); + BOOL IsVisibleXButton(); + void ShowAsHyperLink(BOOL nFlag=TRUE); + BOOL IsShownAsHyperlink(); + + void Locked(BOOL nFlag=TRUE); + BOOL IsLineLocked(); + + void SetClickHdl(const Link&); + +}; + + +class SvPropertyData +{ +public: + eKindOfControl eKind; + String aName; + String aValue; + SvStrings theValues; // ??? + + BOOL bHasVisibleXButton; + BOOL bIsHyperLink; + BOOL bIsLocked; + void* pDataPtr; + SvXPropertyControl* pControl; +}; + +class SvPropertyDataObjectControl +{ +}; + +class SvPropertyDataControl +{ +public: + virtual void Modified( const String& aName, + const String& aVal, + void* pData)=0; + + virtual void Clicked( const String& aName, + const String& aVal, + void* pData)=0; + + virtual void Commit( const String& aName, + const String& aVal, + void* pData)=0; + + virtual void Select( const String& aName, + void* pData)=0; + + virtual void LinkClicked(const String& aName, + void* pData)=0; +}; + +class SvXPropEvListener: public SvXPropertyCtrListener +{ + Link aModifyLink; + Link aGetFocusLink; + Link aLoseFocusLink; + Link aKeyInputLink; + String aModifiedResult; + + SvXPropertyControl * pTheActiveControl; + KeyCode aKeyCode; + +public: + SvXPropEvListener(); + virtual ~SvXPropEvListener(); + + virtual void Modified (SvXPropertyControl *pSvXPCtr); + virtual void GetFocus (SvXPropertyControl *pSvXPCtr); + virtual void LoseFocus(SvXPropertyControl *pSvXPCtr); + virtual void KeyInput(SvXPropertyControl *pSvXPCtr ,const KeyCode&); + + SvXPropertyControl * GetPropertyControl(); + KeyCode GetKeyCode() const; + + void SetModifyHdl( const Link& rLink ) { aModifyLink = rLink; } + const Link& GetModifyHdl() const { return aModifyLink; } + + void SetGetFocusHdl( const Link& rLink ) { aGetFocusLink = rLink; } + const Link& GetGetFocusHdl() const { return aGetFocusLink; } + + void SetLoseFocusHdl( const Link& rLink ) { aLoseFocusLink = rLink; } + const Link& GetLoseFocusHdl() const { return aLoseFocusLink; } + + void SetKeyInputHdl( const Link& rLink ) { aKeyInputLink = rLink; } + const Link& GetKeyInputHdl() const { return aKeyInputLink; } + + +}; + +typedef SvPropertyLine * SvPropertyLinePtr; + +SV_DECL_PTRARR(SvPropLineArray,SvPropertyLinePtr,1,1) + +class SvListBoxForProperties: public Control +{ +private: + + SvXPropEvListener aListener; + Window aPlayGround; + ScrollBar aVScroll; + SvPropLineArray PLineArray; + SvPropertyDataControl* pPropDataControl; + USHORT nRowHeight; + BOOL bUpdate; + USHORT nTheNameSize; + long nYOffset; + + DECL_LINK( ScrollHdl,ScrollBar*); + DECL_LINK( ClickHdl ,PushButton*); + + DECL_LINK( ModifyHdl,SvXPropEvListener*); + DECL_LINK( GetFocusHdl,SvXPropEvListener*); + DECL_LINK(LoseFocusHdl,SvXPropEvListener*); + DECL_LINK( KeyInputHdl,SvXPropEvListener*); + +protected: + void UpdateAll(); + void UpdatePosNSize(); + void UpdatePlayGround(); + void UpdateVScroll(); + + void Resize(); + +public: + SvListBoxForProperties( Window* pParent, WinBits nWinStyle = 0 ); + SvListBoxForProperties( Window* pParent, const ResId& rResId ); + + ~SvListBoxForProperties(); + + virtual USHORT CalcVisibleLines(); + virtual void EnableUpdate(); + virtual void DisableUpdate(); + + virtual void SetController(SvPropertyDataControl *); + + virtual void Clear(); + + virtual USHORT InsertEntry( const SvPropertyData&, USHORT nPos = LISTBOX_APPEND ); + + virtual void ChangeEntry( const SvPropertyData&, USHORT nPos); + + virtual USHORT AppendEntry( const SvPropertyData&); + + virtual void SetPropertyValue( const String & rEntryName, const String & rValue ); + + virtual void SetFirstVisibleEntry(USHORT nPos); + virtual USHORT GetFirstVisibleEntry(); + + virtual void SetSelectedEntry(USHORT nPos); + virtual USHORT GetSelectedEntry(); +}; + +class SvTabPageForProperties: public TabPage +{ + +private: + + SvListBoxForProperties aLbProp; + +protected: + + virtual void Resize(); + +public: + SvTabPageForProperties(Window* pParent,WinBits nWinStyle = 0 ); + + SvListBoxForProperties* GetTheListBox(); +}; + + +class SvBasicPropertyDataControl: public SvPropertyDataControl +{ +private: + + BOOL bCorrectness; + String aEntryName; + String aEntryProperty; + String aCorrectProperty; + void* pTheData; + Link aModifyLink; + Link aClickedLink; + Link aCommitLink; + Link aSelectLink; + +public: + virtual ~SvBasicPropertyDataControl(); + + virtual void Modified( const String& aName, + const String& aVal, + void* pData); //User has modified Property + + virtual void Clicked( const String& aName, + const String& aVal, + void* pData); //Xtension-Button pressed + + virtual void Commit( const String& aName, + const String& aVal, + void* pData); //User accept changes + + virtual void Select( const String& aName, + void* pData); //User select new Row + + virtual void LinkClicked(const String& aName, + void* pData); + + virtual void SetIsCorrect(BOOL nFlag); + + //virtual String GetTheCorrectProperty()const; + virtual void SetTheCorrectProperty(const String& aName); + + String GetName() const; //Tell's the name of the Property + String GetProperty() const; //Tell's the content of the Property + void* GetData(); //Tell's the storage + + + void SetModifyHdl( const Link& rLink ) { aModifyLink = rLink; } + const Link& GetModifyHdl() const { return aModifyLink; } + + void SetClickedHdl( const Link& rLink ) { aClickedLink = rLink; } + const Link& GetClickedHdl() const { return aClickedLink; } + + void SetCommitHdl( const Link& rLink ) { aCommitLink = rLink; } + const Link& GetCommitHdl() const { return aCommitLink; } + + void SetSelectHdl( const Link& rLink ) { aSelectLink = rLink; } + const Link& GetSelectHdl() const { return aSelectLink; } + +}; + + +class SvPropertyBox: public Control +{ +private: + SvPropertyDataControl* pThePropDataCtr; + TabControl aTabControl; + +protected: + virtual void Resize(); + +public: + SvPropertyBox ( Window* pParent, WinBits nWinStyle = 0 ); + SvPropertyBox ( Window* pParent, const ResId& rResId ); + + ~SvPropertyBox(); + + virtual USHORT CalcVisibleLines(); + virtual void EnableUpdate(); // auch IDL? + virtual void DisableUpdate(); // auch IDL? + + // AB: Hier beginnt das 'offizielle' Interface, das in IDL uebernommen werden soll + virtual void SetController(SvPropertyDataControl *); + + virtual USHORT AppendPage( const String & r ); + virtual void SetPage( USHORT ); + virtual USHORT GetCurPage(); + virtual void ClearAll(); + virtual void ClearTable(); + + virtual void SetPropertyValue( const String & rEntryName, const String & rValue ); + + virtual USHORT InsertEntry( const SvPropertyData&, USHORT nPos = LISTBOX_APPEND ); + virtual void ChangeEntry( const SvPropertyData&, USHORT nPos); + virtual USHORT AppendEntry( const SvPropertyData&); + + virtual void SetFirstVisibleEntry(USHORT nPos); + virtual USHORT GetFirstVisibleEntry(); + + virtual void SetSelectedEntry(USHORT nPos); + virtual USHORT GetSelectedEntry(); +}; + + + +/* +class ScPropertyDlg : public ModalDialog +{ +private: + SvBasicPropertyDataControl aBaProDatCtr; + OKButton anOk; + CancelButton aCancel; + USHORT nCount; + USHORT nClickCount; + + SvPropertyData aProperty; + SvPropertyBox aPropListBox; + + ListBox aKindOfListBox; + FixedText aModAnswer; + FixedText aClickAnswer; + FixedText aCommitAnswer; + FixedText aSelectAnswer; + + DECL_LINK( ModifiedHdl, ListBox*); + + DECL_LINK( RowModifiedHdl, SvBasicPropertyDataControl*); + DECL_LINK( ClickHdl , SvBasicPropertyDataControl*); + DECL_LINK( SelectHdl , SvBasicPropertyDataControl*); + DECL_LINK( CommitHdl , SvBasicPropertyDataControl*); + +public: + ScPropertyDlg( Window* pParent); + ~ScPropertyDlg(); +}; +*/ +#endif // SC_AUTOFMT_HXX + + diff --git a/svtools/source/inc/sgfbram.hxx b/svtools/source/inc/sgfbram.hxx new file mode 100644 index 000000000000..ca7e90b59cd4 --- /dev/null +++ b/svtools/source/inc/sgfbram.hxx @@ -0,0 +1,160 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: sgfbram.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SGFBRAM_HXX +#define _SGFBRAM_HXX + +#include + +#define SgfBitImag0 1 /* Bitmap */ +#define SgfBitImag1 4 /* Bitmap */ +#define SgfBitImag2 5 /* Bitmap */ +#define SgfBitImgMo 6 /* Monochrome Bitmap */ +#define SgfSimpVect 2 /* Einfaches Vectorformat */ +#define SgfPostScrp 3 /* Postscript file */ +#define SgfStarDraw 7 /* StarDraw SGV-Datei */ +#define SgfDontKnow 255 /* Unbekannt oder kein SGF/SGV */ + +// Konstanten fr SgfHeader.SwGrCol +#define SgfBlckWhit 1 /* Schwarz/Wei Bild Ŀ SimpVector, */ +#define SgfGrayscal 2 /* Bild mit Graustufen StarDraw und */ +#define Sgf16Colors 3 /* Farbbild (16 Farben) Bit Image */ +#define SgfVectFarb 4 /* Farben fr Linien verwenden Ŀ */ +#define SgfVectGray 5 /* Graustufen fr Linien verwenden Nur fr */ +#define SgfVectWdth 6 /* Strichstrken fr Linien verwenden SimpVector */ + + +#define SgfHeaderSize 42 +class SgfHeader +{ +public: + UINT16 Magic; + UINT16 Version; + UINT16 Typ; + UINT16 Xsize; + UINT16 Ysize; + INT16 Xoffs; + INT16 Yoffs; + UINT16 Planes; // Layer + UINT16 SwGrCol; + char Autor[10]; + char Programm[10]; + UINT16 OfsLo,OfsHi; // DWord-Allignment ist notwendig (38 mod 4 =2) ! + + UINT32 GetOffset(); + friend SvStream& operator>>(SvStream& rIStream, SgfHeader& rHead); + BOOL ChkMagic(); +}; + +#define SgfEntrySize 22 +class SgfEntry +{ +public: + UINT16 Typ; + UINT16 iFrei; + UINT16 lFreiLo,lFreiHi; + char cFrei[10]; + UINT16 OfsLo,OfsHi; // DWord-Allignment ist notwendig (18 mod 4 =2) ! + + UINT32 GetOffset(); + friend SvStream& operator>>(SvStream& rIStream, SgfEntry& rEntr); +}; + +#define SgfVectorSize 10 +class SgfVector +{ +public: + UINT16 Flag; + INT16 x; + INT16 y; + UINT16 OfsLo,OfsHi; // DWord-Allignment ist notwendig (6 mod 4 =2) ! + + friend SvStream& operator>>(SvStream& rIStream, SgfVector& rEntr); +}; + +extern long SgfVectXofs; +extern long SgfVectYofs; +extern long SgfVectXmul; +extern long SgfVectYmul; +extern long SgfVectXdiv; +extern long SgfVectYdiv; +extern BOOL SgfVectScal; + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Windows BMP ///////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +#define BmpFileHeaderSize 14 +class BmpFileHeader +{ +public: + UINT16 Typ; // = "BM" + UINT16 SizeLo,SizeHi; // Filesize in Bytes + UINT16 Reserve1; // Reserviert + UINT16 Reserve2; // Reserviert + UINT16 OfsLo,OfsHi; // Offset? + + void SetSize(UINT32 Size); + void SetOfs(UINT32 Size); + UINT32 GetOfs(); + friend SvStream& operator<<(SvStream& rOStream, BmpFileHeader& rHead); +}; + +#define BmpInfoHeaderSize 40 +class BmpInfoHeader +{ +public: + UINT32 Size; // Gre des BmpInfoHeaders + INT32 Width; // Breite in Pixel + INT32 Hight; // Hhe in Pixel + UINT16 Planes; // Anzahl der Planes (immer 1) + UINT16 PixBits; // Anzahl der Bit je Pixel (1,4,8,oder 24) + UINT32 Compress; // Datenkompression + UINT32 ImgSize; // Gre der Images in Bytes. Ohne Kompression ist auch 0 erlaubt. + INT32 xDpmm; // Dot per Meter (0 ist erlaubt) + INT32 yDpmm; // Dot per Meter (0 ist erlaubt) + UINT32 ColUsed; // Anzahl der verwendeten Farben (0=alle) + UINT32 ColMust; // Anzahl der wichtigen Farben (0=alle) + + friend SvStream& operator<<(SvStream& rOStream, BmpInfoHeader& rHead); +}; + +#define RGBQuadSize 4 +class RGBQuad { +private: + BYTE Red; + BYTE Grn; + BYTE Blu; + BYTE Fil; +public: + RGBQuad(BYTE R, BYTE G, BYTE B) { Red=R; Grn=G; Blu=B; Fil=0; } +}; + +#endif //_SGFBRAM_HXX diff --git a/svtools/source/inc/sgffilt.hxx b/svtools/source/inc/sgffilt.hxx new file mode 100644 index 000000000000..a93522fcf590 --- /dev/null +++ b/svtools/source/inc/sgffilt.hxx @@ -0,0 +1,49 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: sgffilt.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SGFFILT_HXX +#define _SGFFILT_HXX +#include + +BYTE CheckSgfTyp(SvStream& rInp, USHORT& nVersion); +BOOL SgfBMapFilter(SvStream& rInp, SvStream& rOut); +BOOL SgfVectFilter(SvStream& rInp, GDIMetaFile& rMtf); +BOOL SgfSDrwFilter(SvStream& rInp, GDIMetaFile& rMtf, INetURLObject aIniPath ); + +// Konstanten fr CheckSgfTyp() +#define SGF_BITIMAGE 1 /* Bitmap */ +#define SGF_SIMPVECT 2 /* Einfaches Vectorformat */ +#define SGF_POSTSCRP 3 /* Postscript file */ +#define SGF_STARDRAW 7 /* StarDraw SGV-Datei */ +#define SGF_DONTKNOW 255 /* Unbekannt oder kein SGF/SGV */ + +#define SGV_VERSION 3 /* SGV mit anderer Version wird abgewiesen */ + /* 3 entspricht StarDraw 2.00/2.01 Mrz'93 */ +#endif //_SGFFILT_HXX diff --git a/svtools/source/inc/sgvmain.hxx b/svtools/source/inc/sgvmain.hxx new file mode 100644 index 000000000000..58e43e0a00b2 --- /dev/null +++ b/svtools/source/inc/sgvmain.hxx @@ -0,0 +1,356 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: sgvmain.hxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SGVMAIN_HXX +#define _SGVMAIN_HXX + +#include +#include +#include + + +#define UCHAR unsigned char + +struct PointType { + INT16 x; + INT16 y; +}; + +#define SgfDpmm 40 + +#define DtHdSize 256 +class DtHdType { +public: + BYTE Reserved[256]; + friend SvStream& operator>>(SvStream& rIStream, DtHdType& rDtHd); + friend void DtHdOverSeek(SvStream& rInp); +}; + + +struct Seitenformat { + PointType Size; // 0.00mm...819.175mm (Papiergr��e) + INT16 RandL; // links Rand auf + INT16 RandR; // rechts dem Papier + INT16 RandO; // oben Rand auf + INT16 RandU; // unten dem Papier + BYTE PColor; // Future Use + BYTE PIntens; // erst recht Future use +// BOOL BorderClip; // Objekte am Rand abschneiden (Schummel wg. Allignment unter NT) +}; + + +#define PageSize 146 +class PageType { +public: + UINT32 Next; // N�chste Seite + UINT32 nList; // Objektdaten, erster Record + UINT32 ListEnd; // Objektdaten, letzter Record + Seitenformat Paper; // Papierdaten + BOOL BorderClip; // Objekte am Rand abschneiden (Schummel wg. Allignment unter NT) + BYTE StdPg; // welche Standardseite einblenden ? + PointType U; // Nullpunkt + INT16 HlpLnH[20]; // Hilfslinien + INT16 HlpLnV[20]; + BYTE LnAnzH; + BYTE LnAnzV; + UCHAR PgName[32]; // Seitenname + friend SvStream& operator>>(SvStream& rIStream, PageType& rPage); +}; + + +enum ObjArtType {ObjStrk,ObjRect,ObjPoly,ObjCirc,ObjSpln, + ObjText,ObjGrup,ObjBmap,ObjVirt,ObjTxtX,ObjMaxi}; + +struct ObjLineType { + BYTE LFarbe; // [Index] + BYTE LBFarbe; // [Index] + BYTE LIntens; // [%] + BYTE LMuster; // [Index] inkl. Transparenz + INT16 LMSize; // [Koeffizient/100] + INT16 LDicke; // Strichst�rke +}; + +struct ObjAreaType { + BYTE FFarbe; // [Index] + BYTE FBFarbe; // [Index] + BYTE FIntens; // [%] + BYTE FDummy1; // + INT16 FDummy2; // + UINT16 FMuster; // [Index] inkl. Invers, Transparenz +}; + +#define ObjTextTypeSize 64 +class ObjTextType { +public: + ObjLineType L; // Text-Outline (future) + ObjAreaType F; // Text innen + UINT16 FontLo,FontHi;// z.B. 92500 (CG Times), zweigeteilt wegen DWordAllign in TextType. + UINT16 Grad; // 0.5..32767.5 Pt - bei 1000 Pt sollte aber schlu� sein + UINT16 Breite; // 1..65535% bitte nicht mehr als 500% + BYTE Justify; // 2 Bit Vert (Hi), 3 Bit Hor (Lo) + BYTE Kapit; // 1..255% + UINT16 Schnitt; // 8 Flags + UINT16 LnFeed; // 1..32767% vom max. Schriftgrad der Zeile + UINT16 Slant; // Kursivwinkel 0.00..89.99� default 15.00� doppelt Breit angesehen) + BYTE ZAbst; // Zeichenabstand 0..255% (0=auf der Stelle; 100=normal; 200=Zeichen wird als + INT8 ChrVPos; // Zeichen V-Position default 0= on Baseline, 10= 5Pt drunter (-64..63�) + ObjLineType ShdL; // Schatten-Outline (neu 2.0) + ObjAreaType ShdF; // Schatten-innen (neu 2.0) + PointType ShdVers; // Schattenversatz Max.300.00% + BOOL ShdAbs; // True-> Schattenversatz ist absolut statt relativ zum Schriftgrad + BOOL NoSpc; // True-> kein Zwischenraum (f�r BackArea) + ObjAreaType BackF; // Hintergrundfl�che + UINT32 GetFont(); + void SetFont(UINT32 FontID); +}; + +class Obj0Type { // SuperClass f�r Apple-VMT +public: + virtual void Draw(OutputDevice& rOut); + virtual ~Obj0Type() {} +}; + +#define ObjkSize 20 /* eigentlich 21. Wg. Allignment ist Flags jedoch verschoben worden*/ +class ObjkType: public Obj0Type { // Grundkomponenten aller Stardraw-Objekte +public: + UINT32 Last; + UINT32 Next; + UINT16 MemSize; // in Bytes + PointType ObjMin; // XY-Minimum des Objekts + PointType ObjMax; // XY-Maximum des Objekts + BYTE Art; + BYTE Layer; +// BYTE Flags; // (Schummel f�r Allignment unter NT) + friend SvStream& operator>>(SvStream& rIStream, ObjkType& rObjk); + friend BOOL ObjOverSeek(SvStream& rInp, ObjkType& rObjk); + virtual void Draw(OutputDevice& rOut); +}; + + +#define StrkSize 38 +class StrkType: public ObjkType { +public: + BYTE Flags; // (Schummel f�r Allignment unter NT) + BYTE LEnden; // Linienenden + ObjLineType L; + PointType Pos1; // Anfangspunkt + PointType Pos2; // Endpunkt + friend SvStream& operator>>(SvStream& rIStream, StrkType& rStrk); + virtual void Draw(OutputDevice& rOut); +}; + + +#define RectSize 52 +class RectType: public ObjkType { +public: + BYTE Flags; // (Schummel f�r Allignment unter NT) + BYTE Reserve; + ObjLineType L; + ObjAreaType F; + PointType Pos1; // LO-Ecke = Bezugspunkt + PointType Pos2; // R-Ecke + INT16 Radius; // Eckenradius + UINT16 DrehWink; // 315...<45 + UINT16 Slant; // >270...<90 + friend SvStream& operator>>(SvStream& rIStream, RectType& rRect); + virtual void Draw(OutputDevice& rOut); +}; + + +#define PolySize 44 +class PolyType: public ObjkType { // identisch mit Spline ! +public: + BYTE Flags; // (Schummel f�r Allignment unter NT) + BYTE LEnden; // nur f�r Polyline + ObjLineType L; + ObjAreaType F; // nicht f�r Polyline + BYTE nPoints; + BYTE Reserve; + UINT32 SD_EckP; // Zeiger auf die Eckpunkte (StarDraw) + PointType* EckP; // Zeiger auf die Eckpunkte (StarView (wird nicht von Disk gelesen!)) + friend SvStream& operator>>(SvStream& rIStream, PolyType& rPoly); + virtual void Draw(OutputDevice& rOut); +}; +#define PolyClosBit 0x01 // Unterarten von Poly: 0: PolyLine 1: Polygon + + +#define SplnSize 44 +class SplnType: public ObjkType { // identisch mit Poly ! +public: + BYTE Flags; // (Schummel f�r Allignment unter NT) + BYTE LEnden; // nur f�r nSpline + ObjLineType L; + ObjAreaType F; // nicht f�r nSpline + BYTE nPoints; + BYTE Reserve; + UINT32 SD_EckP; // Zeiger auf die Eckpunkte (StarDraw) + PointType* EckP; // Zeiger auf die Eckpunkte (StarView (wird nicht von Disk gelesen!)) + friend SvStream& operator>>(SvStream& rIStream, SplnType& rSpln); + virtual void Draw(OutputDevice& rOut); +}; +// Unterarten von Spline: siehe Poly + + +#define CircSize 52 +class CircType: public ObjkType { +public: + BYTE Flags; // (Schummel f�r Allignment unter NT) + BYTE LEnden; // nur Bogen (Kr & El) + ObjLineType L; + ObjAreaType F; // nicht f�r Bogen (Kr & El) + PointType Center; // Mittelpunkt + PointType Radius; // Radius + UINT16 DrehWink; // nur Ellipse + UINT16 StartWink; // � nicht f�r Vollkreis + UINT16 RelWink; // � und Vollellipse + friend SvStream& operator>>(SvStream& rIStream, CircType& rCirc); + virtual void Draw(OutputDevice& rOut); +}; +#define CircFull 0x00 /* Unterarten von Kreis: 0: Kreis */ +#define CircSect 0x01 /* 1: Kreissektor */ +#define CircAbsn 0x02 /* 2: Kreisabschnitt */ +#define CircArc 0x03 /* 3: Kreisbogen */ + + +#define TextSize 116 +class TextType: public ObjkType { +public: + BYTE Flags; // (Schummel f�r Allignment unter NT) + BYTE Reserve; // f�r Word Allign + ObjTextType T; // 64 Bytes << DWord-Allign bei FontID erforderlich + PointType Pos1; // Bezugspunkt (ObenLinks) + PointType Pos2; // (untenRechts) + INT16 TopOfs; // Von Oberkante bis Textbegin (future f�r vJustify) + UINT16 DrehWink; // 0...<360 + UINT16 BoxSlant; // >270...<90 (nur Box) + UINT16 BufSize; // Gr��e von Buf f�r Load, Save, Copy und so + UINT16 BufLo,BufHi;// (UCHAR*) Zeiger auf den Textbuffer << ShortArr, weil sonst DWord-Allign erforderlich + UINT16 ExtLo,ExtHi;// (Ptr) Text �ber mehrere Rahmen << ShortArr, weil sonst DWord-Allign erforderlich + PointType FitSize; // Ursprungsgr��e f�r Fit2Size + INT16 FitBreit; // Breite zum formatieren bei Fit2Size + UCHAR* Buffer; // Diese Variable wird nicht durch Lesen von Disk gef�llt, sondern explizit! + friend SvStream& operator>>(SvStream& rIStream, TextType& rText); + virtual void Draw(OutputDevice& rOut); +}; +#define TextOutlBit 0x01 /* 1=Sourcecode f�r Outliner (wird von DrawObjekt() ignoriert) */ +#define TextFitSBit 0x02 /* Bit1: 1=Text-FitToSize, auch Outliner (2.0) */ +#define TextFitZBit 0x08 /* Bit3: 1=Fit2Size Zeilenweise (2.0) */ +#define TextDrftBit 0x04 /* Bit2: 1=DraftDraw (2.0) */ +#define TextFitBits (TextFitSBit | TextFitZBit) + + +enum GrafStat {NoGraf,Pic,Pcx,Hpgl,Img,Msp,Tiff,Dxf,Lot,Usr,Sgf}; + +#define BmapSize 132 +class BmapType: public ObjkType { +public: + BYTE Flags; // (Schummel f�r Allignment unter NT) + BYTE Reserve; + ObjAreaType F; // Farbe und Muster der 1-Plane Bitmap + PointType Pos1; + PointType Pos2; + UINT16 DrehWink; // 315...<45 (Future) + UINT16 Slant; // >270...<90 (Future) + UCHAR Filename[80]; // Pfad + PointType PixSize; // Gr��e in Pixel (0 bei Vektor) + GrafStat Format; // siehe GpmDef.Pas + BYTE nPlanes; // Anzahl der Bitplanes (0 bei Vektor) + BOOL RawOut; // als Raw ausgeben ? + BOOL InvOut; // invertiert ausgeben ? + BOOL LightOut; // aufhellen? (SD20) + BYTE GrfFlg; // (SD20) 0=nSGF 1=Pcx 2=Hpgl 4=Raw $FF=Undef(f�r Fix in DrawBmp) + + INetURLObject aFltPath; // F�r GraphicFilter + friend SvStream& operator>>(SvStream& rIStream, BmapType& rBmap); + virtual void Draw(OutputDevice& rOut); + void SetPaths( const INetURLObject rFltPath ); +}; + + +#define GrupSize 48 +class GrupType: public ObjkType { +public: + BYTE Flags; // (Schummel f�r Allignment unter NT) + UCHAR Name[13]; // Name der Gruppe + UINT16 SbLo,SbHi; // (Ptr) Gruppenliste << ShortArr, weil sonst DWord Allign erforderlich + UINT16 UpLo,UpHi; // (Ptr) Vaterliste << ShortArr, weil sonst DWord Allign erforderlich + UINT16 ChartSize; // Speicherbedarf der Diagrammstruktur Struktur + UINT32 ChartPtr; // Diagrammstruktur + UINT32 GetSubPtr(); // hier nur zum Checken, ob Sublist evtl. leer ist. + friend SvStream& operator>>(SvStream& rIStream, GrupType& rGrup); +// virtual void Draw(OutputDevice& rOut); +}; + + +void SetLine(ObjLineType& rLine, OutputDevice& rOut); +void SetArea(ObjAreaType& rArea, OutputDevice& rOut); +Color Sgv2SvFarbe(BYTE nFrb1, BYTE nFrb2, BYTE nInts); +void RotatePoint(PointType& P, INT16 cx, INT16 cy, double sn, double cs); +void RotatePoint(Point& P, INT16 cx, INT16 cy, double sn, double cs); +INT16 iMulDiv(INT16 a, INT16 Mul, INT16 Div); +UINT16 MulDiv(UINT16 a, UINT16 Mul, UINT16 Div); + + +class SgfFontOne { +public: + SgfFontOne* Next; // Zeiger f�r Listenverkettung + UINT32 IFID; + BOOL Bold; + BOOL Ital; + BOOL Sans; + BOOL Serf; + BOOL Fixd; + FontFamily SVFamil; + CharSet SVChSet; + String SVFName; // z.B. "Times New Roman" = 15 Chars + USHORT SVWidth; // Durchschnittliche Zeichenbreite in % + SgfFontOne(); + void ReadOne( ByteString& ID, ByteString& Dsc); +}; + +class SgfFontLst { +public: + String FNam; // vollst�ndiger Filename des Inifiles + SgfFontOne* pList; // Listenanfang + SgfFontOne* Last; // Listenende + UINT32 LastID; // f�r schnelleren Zugriff bei Wiederholungen + SgfFontOne* LastLn; // f�r schnelleren Zugriff bei Wiederholungen + BOOL Tried; + SgfFontLst(); + ~SgfFontLst(); + void AssignFN(const String& rFName); + void ReadList(); + void RausList(); + SgfFontOne* GetFontDesc(UINT32 ID); +}; + +#endif //_SGVMAIN_HXX + + diff --git a/svtools/source/inc/sgvspln.hxx b/svtools/source/inc/sgvspln.hxx new file mode 100644 index 000000000000..7e9976eaf25b --- /dev/null +++ b/svtools/source/inc/sgvspln.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: sgvspln.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SGVSPLN_HXX +#define _SGVSPLN_HXX + +/************************************************************************* +|* +|* CalcSpline() +|* +|* Beschreibung Berechnet die Koeffizienten eines parametrischen +|* natrlichen oder periodischen kubischen +|* Polynomsplines. Die Eckpunkte des bergebenen +|* Polygons werden als Sttzstellen angenommen. +|* n liefert die Anzahl der Teilpolynome. +|* Ist die Berechnung fehlerfrei verlaufen, so +|* liefert die Funktion TRUE. Nur in diesem Fall +|* ist Speicher fr die Koeffizientenarrays +|* allokiert, der dann spter vom Aufrufer mittels +|* delete freizugeben ist. +|* Ersterstellung JOE 17-08.93 +|* Letzte Aenderung JOE 17-08.93 +|* +*************************************************************************/ + +BOOL CalcSpline(Polygon& rPoly, BOOL Periodic, USHORT& n, + double*& ax, double*& ay, double*& bx, double*& by, + double*& cx, double*& cy, double*& dx, double*& dy, double*& T); + +/************************************************************************* +|* +|* Poly2Spline() +|* +|* Beschreibung Konvertiert einen parametrichen kubischen +|* Polynomspline Spline (natrlich oder periodisch) +|* in ein angenhertes Polygon. +|* Die Funktion liefert FALSE, wenn ein Fehler bei +|* der Koeffizientenberechnung aufgetreten ist oder +|* das Polygon zu gro wird (>PolyMax=16380). Im 1. +|* Fall hat das Polygon 0, im 2. Fall PolyMax Punkte. +|* Um Koordinatenberlufe zu vermeiden werden diese +|* auf +/-32000 begrenzt. +|* Ersterstellung JOE 23.06.93 +|* Letzte Aenderung JOE 23.06.93 +|* +*************************************************************************/ +BOOL Spline2Poly(Polygon& rSpln, BOOL Periodic, Polygon& rPoly); + +#endif //_SGVSPLN_HXX diff --git a/svtools/source/inc/svimpbox.hxx b/svtools/source/inc/svimpbox.hxx new file mode 100644 index 000000000000..10463fc05906 --- /dev/null +++ b/svtools/source/inc/svimpbox.hxx @@ -0,0 +1,477 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: svimpbox.hxx,v $ + * $Revision: 1.22 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVIMPLBOX_HXX +#define _SVIMPLBOX_HXX + +#ifndef _SELENG_HXX +#include +#endif +#ifndef _SCRBAR_HXX +#include +#endif +#include +// #102891# ---------------- +#include +// #97680# ----------------- +#include +#include "svtaccessiblefactory.hxx" + +class SvTreeListBox; +class Point; +class DropEvent; +class SvLBoxTreeList; +class SvImpLBox; +class SvLBoxEntry; +class SvLBoxItem; +class SvLBoxTab; +class TabBar; + +class ImpLBSelEng : public FunctionSet +{ + SvImpLBox* pImp; + SelectionEngine* pSelEng; + SvTreeListBox* pView; + +public: + ImpLBSelEng( SvImpLBox* pImp, SelectionEngine* pSelEng, + SvTreeListBox* pView ); + virtual ~ImpLBSelEng(); + void BeginDrag(); + void CreateAnchor(); + void DestroyAnchor(); + BOOL SetCursorAtPoint( const Point& rPoint, + BOOL bDontSelectAtCursor=FALSE ); + BOOL IsSelectionAtPoint( const Point& rPoint ); + void DeselectAtPoint( const Point& rPoint ); + void DeselectAll(); +}; + +// Flags fuer nFlag +#define F_VER_SBARSIZE_WITH_HBAR 0x0001 +#define F_HOR_SBARSIZE_WITH_VBAR 0x0002 +#define F_IGNORE_NEXT_MOUSEMOVE 0x0004 // OS/2 only +#define F_IN_SCROLLING 0x0008 +#define F_DESEL_ALL 0x0010 +#define F_START_EDITTIMER 0x0020 // MAC only +#define F_IGNORE_SELECT 0x0040 +#define F_IN_RESIZE 0x0080 +#define F_REMOVED_ENTRY_INVISIBLE 0x0100 +#define F_REMOVED_RECALC_MOST_RIGHT 0x0200 +#define F_IGNORE_CHANGED_TABS 0x0400 +#define F_PAINTED 0x0800 +#define F_IN_PAINT 0x1000 +#define F_ENDSCROLL_SET_VIS_SIZE 0x2000 +#define F_FILLING 0x4000 + + +class SvImpLBox +{ +friend class ImpLBSelEng; +friend class SvTreeListBox; +private: + SvTreeListBox* pView; + SvLBoxTreeList* pTree; + SvLBoxEntry* pCursor; + SvLBoxEntry* pStartEntry; + SvLBoxEntry* pAnchor; + SvLBoxEntry* pMostRightEntry; + SvLBoxButton* pActiveButton; + SvLBoxEntry* pActiveEntry; + SvLBoxTab* pActiveTab; + TabBar* pTabBar; + + ScrollBar aVerSBar; + ScrollBar aHorSBar; + ScrollBarBox aScrBarBox; + + ::svt::AccessibleFactoryAccess + m_aFactoryAccess; + + static Image* s_pDefCollapsed; + static Image* s_pDefExpanded; + static Image* s_pDefCollapsedHC; + static Image* s_pDefExpandedHC; + static oslInterlockedCount s_nImageRefCount; /// When 0 all static images will be destroyed + + // Node Bitmaps + enum ImageType + { + itNodeExpanded = 0, // node is expanded ( usually a bitmap showing a minus ) + itNodeCollapsed, // node is collapsed ( usually a bitmap showing a plus ) + itNodeDontKnow, // don't know the node state + itEntryDefExpanded, // default for expanded entries + itEntryDefCollapsed, // default for collapsed entries + + IT_IMAGE_COUNT + }; + + // all our images + Image m_aNodeAndEntryImages[ IT_IMAGE_COUNT ]; + // plus the high contrast versions + Image m_aNodeAndEntryImages_HC[ IT_IMAGE_COUNT ]; + + // wg. kompat. hier + Size aOutputSize; + SelectionEngine aSelEng; + ImpLBSelEng aFctSet; + Timer aAsyncBeginDragTimer; + Point aAsyncBeginDragPos; + + long nYoffsNodeBmp; + long nNodeBmpTabDistance; // typisch kleiner 0 + long nNodeBmpWidth; + long nNextVerVisSize; + long nMostRight; + ULONG nVisibleCount; // Anzahl Zeilen im Control + ULONG nCurUserEvent; //-1 == kein Userevent amn Laufen + short nHorSBarHeight, nVerSBarWidth; + USHORT nFlags; + USHORT nCurTabPos; + + WinBits nWinBits; + ExtendedWinBits nExtendedWinBits; + BOOL bSimpleTravel : 1; // ist TRUE bei SINGLE_SELECTION + BOOL bUpdateMode : 1; + BOOL bInVScrollHdl : 1; + BOOL bAsyncBeginDrag : 1; + BOOL bSubLstOpRet : 1; // open/close sublist with return/enter, defaulted with FALSE + BOOL bSubLstOpLR : 1; // open/close sublist with cursor left/right, defaulted with FALSE + BOOL bContextMenuHandling : 1; + BOOL bIsCellFocusEnabled : 1; + + sal_Bool bAreChildrenTransient; + + Point aEditClickPos; + Timer aEditTimer; + + // #102891# ------------------- + IntlWrapper * pIntlWrapper; + + // #97680# -------------------- + std::vector< short > aContextBmpWidthVector; + + DECL_LINK( EditTimerCall, Timer * ); + + DECL_LINK( BeginDragHdl, void* ); + DECL_LINK( MyUserEvent,void*); + void StopUserEvent(); + + void InvalidateEntriesFrom( long nY ) const; + void InvalidateEntry( long nY ) const; + void ShowVerSBar(); + // setzt Thumb auf FirstEntryToDraw + void SyncVerThumb(); + BOOL IsLineVisible( long nY ) const; + long GetEntryLine( SvLBoxEntry* pEntry ) const; + void FillView(); + void CursorDown(); + void CursorUp(); + void KeyLeftRight( long nDiff ); + void PageDown( USHORT nDelta ); + void PageUp( USHORT nDelta ); + + void SetCursor( SvLBoxEntry* pEntry, BOOL bForceNoSelect = FALSE ); + + void DrawNet(); + + // ScrollBar-Handler + DECL_LINK( ScrollUpDownHdl, ScrollBar * ); + DECL_LINK( ScrollLeftRightHdl, ScrollBar * ); + DECL_LINK( EndScrollHdl, ScrollBar * ); + + void SetNodeBmpYOffset( const Image& ); + void SetNodeBmpTabDistance(); + + // Selection-Engine + SvLBoxEntry* MakePointVisible( const Point& rPoint, + BOOL bNotifyScroll=TRUE ); + + void SetAnchorSelection( SvLBoxEntry* pOld, + SvLBoxEntry* pNewCursor ); + void BeginDrag(); + BOOL ButtonDownCheckCtrl( const MouseEvent& rMEvt, + SvLBoxEntry* pEntry, long nY ); + BOOL MouseMoveCheckCtrl( const MouseEvent& rMEvt, + SvLBoxEntry* pEntry ); + BOOL ButtonUpCheckCtrl( const MouseEvent& rMEvt ); + BOOL ButtonDownCheckExpand( const MouseEvent&, + SvLBoxEntry*,long nY ); + + void PositionScrollBars( Size& rOSize, USHORT nMask ); + USHORT AdjustScrollBars( Size& rSize ); + + void BeginScroll(); + void EndScroll(); + BOOL InScroll() const { return (BOOL)(nFlags & F_IN_SCROLLING)!=0;} + Rectangle GetVisibleArea() const; + BOOL EntryReallyHit(SvLBoxEntry* pEntry,const Point& rPos,long nLine); + void InitScrollBarBox(); + SvLBoxTab* NextTab( SvLBoxTab* ); + + BOOL SetMostRight( SvLBoxEntry* pEntry ); + void FindMostRight( SvLBoxEntry* EntryToIgnore ); + void FindMostRight( SvLBoxEntry* pParent, SvLBoxEntry* EntryToIgnore ); + void FindMostRight_Impl( SvLBoxEntry* pParent,SvLBoxEntry* EntryToIgnore ); + void NotifyTabsChanged(); + + inline BOOL IsExpandable() const // if element at cursor can be expanded in general + { return pCursor->HasChilds() || pCursor->HasChildsOnDemand(); } + inline BOOL IsNowExpandable() const // if element at cursor can be expanded at this moment + { return IsExpandable() && !pView->IsExpanded( pCursor ); } + + static void implInitDefaultNodeImages(); + + // #102891# ------------------- + void UpdateIntlWrapper(); + + // #97680# -------------------- + short UpdateContextBmpWidthVector( SvLBoxEntry* pEntry, short nWidth ); + void UpdateContextBmpWidthMax( SvLBoxEntry* pEntry ); + void UpdateContextBmpWidthVectorFromMovedEntry( SvLBoxEntry* pEntry ); + + void CalcCellFocusRect( SvLBoxEntry* pEntry, Rectangle& rRect ); + + inline sal_Bool AreChildrenTransient() const { return bAreChildrenTransient; } + inline void SetChildrenNotTransient() { bAreChildrenTransient = sal_False; } + +public: + SvImpLBox( SvTreeListBox* pView, SvLBoxTreeList*, WinBits nWinStyle ); + ~SvImpLBox(); + + void Clear(); + void SetWindowBits( WinBits nWinStyle ); + void SetExtendedWindowBits( ExtendedWinBits _nBits ); + ExtendedWinBits GetExtendedWindowBits() const { return nExtendedWinBits; } + void SetModel( SvLBoxTreeList* pModel ) { pTree = pModel;} + + void EntryInserted( SvLBoxEntry*); + void RemovingEntry( SvLBoxEntry* pEntry ); + void EntryRemoved(); + void MovingEntry( SvLBoxEntry* pEntry ); + void EntryMoved( SvLBoxEntry* pEntry ); + void TreeInserted( SvLBoxEntry* pEntry ); + + void IndentChanged( short nIndentPixel ); + void EntryExpanded( SvLBoxEntry* pEntry ); + void EntryCollapsed( SvLBoxEntry* pEntry ); + void CollapsingEntry( SvLBoxEntry* pEntry ); + void EntrySelected( SvLBoxEntry*, BOOL bSelect ); + + void Paint( const Rectangle& rRect ); + void RepaintSelectionItems(); + void MouseButtonDown( const MouseEvent& ); + void MouseButtonUp( const MouseEvent& ); + void MouseMove( const MouseEvent&); + BOOL KeyInput( const KeyEvent& ); + void Resize(); + void GetFocus(); + void LoseFocus(); + void UpdateAll( + BOOL bInvalidateCompleteView= TRUE, + BOOL bUpdateVerSBar = TRUE ); + void SetEntryHeight( short nHeight ); + void PaintEntry( SvLBoxEntry* pEntry ); + void InvalidateEntry( SvLBoxEntry* ); + void RecalcFocusRect(); + + inline void SelectEntry( SvLBoxEntry* pEntry, BOOL bSelect ); + void SetDragDropMode( DragDropMode eDDMode ); + void SetSelectionMode( SelectionMode eSelMode ); + void SetAddMode( BOOL ) { aSelEng.AddAlways(FALSE); } + BOOL IsAddMode() const { return aSelEng.IsAlwaysAdding(); } + + SvLBoxEntry* GetCurrentEntry() const { return pCursor; } + BOOL IsEntryInView( SvLBoxEntry* ) const; + SvLBoxEntry* GetEntry( const Point& rPos ) const; + // gibt letzten Eintrag zurueck, falls Pos unter letztem Eintrag + SvLBoxEntry* GetClickedEntry( const Point& ) const; + SvLBoxEntry* GetCurEntry() const { return pCursor; } + void SetCurEntry( SvLBoxEntry* ); + Point GetEntryPosition( SvLBoxEntry* ) const; + void MakeVisible( SvLBoxEntry* pEntry, BOOL bMoveToTop=FALSE ); + + void PaintDDCursor( SvLBoxEntry* ); + + // Images + inline Image& implGetImageLocation( const ImageType _eType, BmpColorMode _eMode ); + inline Image& implGetImageLocationWithFallback( const ImageType _eType, BmpColorMode _eMode ) const; + + inline void SetExpandedNodeBmp( const Image& _rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL ); + inline void SetCollapsedNodeBmp( const Image& _rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL ); + inline void SetDontKnowNodeBmp( const Image& rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL ); + + inline const Image& GetExpandedNodeBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL ) const; + inline const Image& GetCollapsedNodeBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL ) const; + inline const Image& GetDontKnowNodeBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL ) const; + + inline void SetDefaultEntryExpBmp( const Image& _rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL ); + inline void SetDefaultEntryColBmp( const Image& _rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL ); + inline const Image& GetDefaultEntryExpBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL ); + inline const Image& GetDefaultEntryColBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL ); + + static const Image& GetDefaultExpandedNodeImage( BmpColorMode _eMode = BMP_COLOR_NORMAL ); + static const Image& GetDefaultCollapsedNodeImage( BmpColorMode _eMode = BMP_COLOR_NORMAL ); + + const Size& GetOutputSize() const { return aOutputSize;} + void KeyUp( BOOL bPageUp, BOOL bNotifyScroll = TRUE ); + void KeyDown( BOOL bPageDown, BOOL bNotifyScroll = TRUE ); + void Command( const CommandEvent& rCEvt ); + + void Invalidate(); + void DestroyAnchor() { pAnchor=0; aSelEng.Reset(); } + void SelAllDestrAnch( BOOL bSelect, + BOOL bDestroyAnchor = TRUE, + BOOL bSingleSelToo = FALSE ); + void ShowCursor( BOOL bShow ); + + BOOL RequestHelp( const HelpEvent& rHEvt ); + void EndSelection(); + BOOL IsNodeButton( const Point& rPosPixel, SvLBoxEntry* pEntry ) const; + void RepaintScrollBars(); + void EnableAsyncDrag( BOOL b) { bAsyncBeginDrag = b; } + void SetUpdateMode( BOOL ); + void SetUpdateModeFast( BOOL ); + BOOL GetUpdateMode() const { return bUpdateMode; } + Rectangle GetClipRegionRect() const; + BOOL HasHorScrollBar() const { return aHorSBar.IsVisible(); } + void ShowFocusRect( const SvLBoxEntry* pEntry ); + void SetTabBar( TabBar* pTabBar ); + void CancelPendingEdit(); + + void CallEventListeners( ULONG nEvent, void* pData = NULL ); + + /** Enables, that one cell of a tablistbox entry can be focused */ + inline BOOL IsCellFocusEnabled() const { return bIsCellFocusEnabled; } + inline void EnableCellFocus() { bIsCellFocusEnabled = TRUE; } + bool SetCurrentTabPos( USHORT _nNewPos ); + inline USHORT GetCurrentTabPos() const { return nCurTabPos; } + + bool IsSelectable( const SvLBoxEntry* pEntry ); +}; + +inline Image& SvImpLBox::implGetImageLocation( const ImageType _eType, BmpColorMode _eMode ) +{ + DBG_ASSERT( ( BMP_COLOR_HIGHCONTRAST == _eMode ) || ( BMP_COLOR_NORMAL == _eMode ), + "SvImpLBox::implGetImageLocation: invalid mode!" ); + DBG_ASSERT( ( _eType >= 0 ) && ( _eType < IT_IMAGE_COUNT ), + "SvImpLBox::implGetImageLocation: invalid image index (will crash)!" ); + + Image* _pSet = ( BMP_COLOR_HIGHCONTRAST == _eMode ) ? m_aNodeAndEntryImages_HC : m_aNodeAndEntryImages; + return *( _pSet + (sal_Int32)_eType ); +} + +inline Image& SvImpLBox::implGetImageLocationWithFallback( const ImageType _eType, BmpColorMode _eMode ) const +{ + Image& rImage = const_cast< SvImpLBox* >( this )->implGetImageLocation( _eType, _eMode ); + if ( !rImage ) + // fallback to normal images in case the one for the special mode has not been set + rImage = const_cast< SvImpLBox* >( this )->implGetImageLocation( _eType, BMP_COLOR_NORMAL ); + return rImage; +} + +inline void SvImpLBox::SetDontKnowNodeBmp( const Image& rImg, BmpColorMode _eMode ) +{ + implGetImageLocation( itNodeDontKnow, _eMode ) = rImg; +} + +inline void SvImpLBox::SetExpandedNodeBmp( const Image& rImg, BmpColorMode _eMode ) +{ + implGetImageLocation( itNodeExpanded, _eMode ) = rImg; + SetNodeBmpYOffset( rImg ); +} + +inline void SvImpLBox::SetCollapsedNodeBmp( const Image& rImg, BmpColorMode _eMode ) +{ + implGetImageLocation( itNodeCollapsed, _eMode ) = rImg; + SetNodeBmpYOffset( rImg ); +} + +inline const Image& SvImpLBox::GetDontKnowNodeBmp( BmpColorMode _eMode ) const +{ + return implGetImageLocationWithFallback( itNodeDontKnow, _eMode ); +} + +inline const Image& SvImpLBox::GetExpandedNodeBmp( BmpColorMode _eMode ) const +{ + return implGetImageLocationWithFallback( itNodeExpanded, _eMode ); +} + +inline const Image& SvImpLBox::GetCollapsedNodeBmp( BmpColorMode _eMode ) const +{ + return implGetImageLocationWithFallback( itNodeCollapsed, _eMode ); +} + +inline void SvImpLBox::SetDefaultEntryExpBmp( const Image& _rImg, BmpColorMode _eMode ) +{ + implGetImageLocation( itEntryDefExpanded, _eMode ) = _rImg; +} + +inline void SvImpLBox::SetDefaultEntryColBmp( const Image& _rImg, BmpColorMode _eMode ) +{ + implGetImageLocation( itEntryDefCollapsed, _eMode ) = _rImg; +} + +inline const Image& SvImpLBox::GetDefaultEntryExpBmp( BmpColorMode _eMode ) +{ + return implGetImageLocationWithFallback( itEntryDefExpanded, _eMode ); +} + +inline const Image& SvImpLBox::GetDefaultEntryColBmp( BmpColorMode _eMode ) +{ + return implGetImageLocationWithFallback( itEntryDefCollapsed, _eMode ); +} + +inline Point SvImpLBox::GetEntryPosition( SvLBoxEntry* pEntry ) const +{ + return Point( 0, GetEntryLine( pEntry ) ); +} + +inline void SvImpLBox::PaintEntry( SvLBoxEntry* pEntry ) +{ + long nY = GetEntryLine( pEntry ); + pView->PaintEntry( pEntry, nY ); +} + +inline BOOL SvImpLBox::IsLineVisible( long nY ) const +{ + BOOL bRet = TRUE; + if ( nY < 0 || nY >= aOutputSize.Height() ) + bRet = FALSE; + return bRet; +} + +inline void SvImpLBox::TreeInserted( SvLBoxEntry* pInsTree ) +{ + EntryInserted( pInsTree ); +} + +#endif // #ifndef _SVIMPLBOX_HXX + diff --git a/svtools/source/inc/svimpicn.hxx b/svtools/source/inc/svimpicn.hxx new file mode 100644 index 000000000000..724a92543700 --- /dev/null +++ b/svtools/source/inc/svimpicn.hxx @@ -0,0 +1,324 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: svimpicn.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVIMPICN_HXX +#define _SVIMPICN_HXX + +#ifndef _VIRDEV_HXX +#include +#endif + +#ifndef _SCRBAR_HXX +#include +#endif +#include + +class SvLBoxEntry; +class SvLBoxTreeList; +class SvImpIconView; +class ImpIcnCursor; +class SvPtrarr; + +#define PAINTFLAG_HOR_CENTERED 0x0001 +#define PAINTFLAG_VER_CENTERED 0x0002 + +#define SELRECT_BORDER_OFFS -7 +// Flags +#define F_VER_SBARSIZE_WITH_HBAR 0x00000001 +#define F_HOR_SBARSIZE_WITH_VBAR 0x00000002 +#define F_IGNORE_NEXT_MOUSEMOVE 0x00000004 // OS/2 only +#define F_ENTRY_REMOVED 0x00000008 +// ist gesetzt, wenn nach Clear oder Ctor mind. einmal gepaintet wurde +#define F_PAINTED 0x00000010 +#define F_ADD_MODE 0x00000020 +#define F_MOVING_SIBLING 0x00000040 +#define F_SELRECT_VISIBLE 0x00000080 +#define F_CMD_ARRIVED 0x00000100 +#define F_DRAG_SOURCE 0x00000200 +#define F_GRIDMODE 0x00000400 +// beim Einfuegen eines Eintrags ergibt sich dessen Position +// durch simples Addieren auf die Position des zuletzt eingefuegten Eintrags +#define F_GRID_INSERT 0x00000800 +#define F_DOWN_CTRL 0x00001000 +#define F_DOWN_DESELECT 0x00002000 +// Hack fuer D&D: Hintergrund des Entries nicht painten +#define F_NO_EMPHASIS 0x00004000 +// Selektion per Gummiband +#define F_RUBBERING 0x00008000 +#define F_START_EDITTIMER_IN_MOUSEUP 0x00010000 + +class SvImpIconView +{ + friend class ImpIcnCursor; + ScrollBar aVerSBar; + ScrollBar aHorSBar; + Rectangle aCurSelectionRect; + SvPtrarr aSelectedRectList; + MouseEvent aMouseMoveEvent; + Timer aEditTimer; // fuer Inplace-Editieren + Timer aMouseMoveTimer; // generiert MouseMoves bei Gummibandselektion + // Boundrect des zuletzt eingefuegten Entries + Rectangle aPrevBoundRect; + Size aOutputSize; // Pixel + Size aVirtOutputSize; // expandiert automatisch + Point aDDLastEntryPos; + Point aDDLastRectPos; + + SvLBoxTreeList* pModel; + SvIconView* pView; + ImpIcnCursor* pImpCursor; + long nMaxVirtWidth; // max.breite aVirtOutputSize + SvPtrarr* pZOrderList; + long nGridDX, + nGridDY; + long nHorSBarHeight, + nVerSBarWidth; + WinBits nWinBits; + int nViewMode; + long nHorDist; + long nVerDist; + long nMaxBmpWidth; + long nMaxBmpHeight; + long nMaxTextWidth; + long nMaxBoundHeight; // Hoehe des hoechsten BoundRects + ULONG nFlags; + ULONG nCurUserEvent; + SvLBoxEntry* pCurParent; + SvLBoxEntry* pCursor; + SvLBoxEntry* pNextCursor; // wird in MovingEntry gesetzt und ist + // nur in EntryMoved gueltig! + SvLBoxEntry* pDDRefEntry; + VirtualDevice* pDDDev; + VirtualDevice* pDDBufDev; + VirtualDevice* pDDTempDev; + + SvIconViewTextMode eTextMode; + BOOL bMustRecalcBoundingRects; + + void CheckAllSizes(); + void CheckSizes( SvLBoxEntry* pEntry, + const SvIcnVwDataEntry* pViewData = 0 ); + void ShowCursor( BOOL bShow ); + + void SetNextEntryPos(const Point& rPos); + Point FindNextEntryPos( const Size& rBoundSize ); + void ImpArrange(); + void AdjustVirtSize( const Rectangle& ); + void ResetVirtSize(); + void CheckScrollBars(); + + DECL_LINK( ScrollUpDownHdl, ScrollBar * ); + DECL_LINK( ScrollLeftRightHdl, ScrollBar * ); + DECL_LINK( MouseMoveTimeoutHdl, Timer* ); + DECL_LINK( EditTimeoutHdl, Timer* ); + DECL_LINK( UserEventHdl, void* ); + void AdjustScrollBars(); + void PositionScrollBars( long nRealWidth, long nRealHeight ); + void CalcDocPos( Point& aMousePos ); + BOOL GetResizeRect( Rectangle& ); + void PaintResizeRect( const Rectangle& ); + SvLBoxEntry* GetNewCursor(); + void ToggleSelection( SvLBoxEntry* ); + void DeselectAllBut( SvLBoxEntry* ); + void Center( SvLBoxEntry* pEntry, SvIcnVwDataEntry* ) const; + void StopEditTimer() { aEditTimer.Stop(); } + void StartEditTimer() { aEditTimer.Start(); } + void ImpHideDDIcon(); + void ImpDrawXORRect( const Rectangle& rRect ); + void AddSelectedRect( const Rectangle&, short nOffset = SELRECT_BORDER_OFFS ); + void ClearSelectedRectList(); + Rectangle CalcMaxTextRect( const SvLBoxEntry* pEntry, + const SvIcnVwDataEntry* pViewData ) const; + + void ClipAtVirtOutRect( Rectangle& rRect ) const; + void AdjustAtGrid( const SvPtrarr& rRow, SvLBoxEntry* pStart=0 ); + Point AdjustAtGrid( + const Rectangle& rCenterRect, // "Schwerpunkt" des Objekts (typ. Bmp-Rect) + const Rectangle& rBoundRect ) const; + SvIconViewTextMode GetEntryTextModeSmart( const SvLBoxEntry* pEntry, + const SvIcnVwDataEntry* pViewData ) const; + + BOOL CheckVerScrollBar(); + BOOL CheckHorScrollBar(); + void CancelUserEvent(); + +public: + + SvImpIconView( SvIconView* pView, SvLBoxTreeList*, WinBits nWinStyle ); + ~SvImpIconView(); + + void Clear( BOOL bInCtor = FALSE ); + void SetWindowBits( WinBits nWinStyle ); + void SetModel( SvLBoxTreeList* pTree, SvLBoxEntry* pParent ) + { pModel = pTree; SetCurParent(pParent); } + void EntryInserted( SvLBoxEntry*); + void RemovingEntry( SvLBoxEntry* pEntry ); + void EntryRemoved(); + void MovingEntry( SvLBoxEntry* pEntry ); + void EntryMoved( SvLBoxEntry* pEntry ); + void TreeInserted( SvLBoxEntry* pEntry ); + void ChangedFont(); + void ModelHasEntryInvalidated( SvListEntry* ); + void EntryExpanded( SvLBoxEntry* pEntry ); + void EntryCollapsed( SvLBoxEntry* pEntry ); + void CollapsingEntry( SvLBoxEntry* pEntry ); + void EntrySelected( SvLBoxEntry*, BOOL bSelect ); + + void Paint( const Rectangle& rRect ); + void RepaintSelectionItems(); + void MouseButtonDown( const MouseEvent& ); + void MouseButtonUp( const MouseEvent& ); + void MouseMove( const MouseEvent&); + BOOL KeyInput( const KeyEvent& ); + void Resize(); + void GetFocus(); + void LoseFocus(); + void UpdateAll(); + void PaintEntry( SvLBoxEntry* pEntry, + SvIcnVwDataEntry* pViewData = 0 ); + void PaintEntry( SvLBoxEntry*, const Point&, + SvIcnVwDataEntry* pViewData = 0, OutputDevice* pOut = 0); + void SetEntryPosition( SvLBoxEntry* pEntry, const Point& rPos, + BOOL bAdjustRow = FALSE, + BOOL bCheckScrollBars = FALSE ); + void InvalidateEntry( SvLBoxEntry* ); + void ViewDataInitialized( SvLBoxEntry* pEntry ); + SvLBoxItem* GetItem( SvLBoxEntry*, const Point& rAbsPos ); + + void SetNoSelection(); + void SetDragDropMode( DragDropMode eDDMode ); + void SetSelectionMode( SelectionMode eSelMode ); + + void SttDrag( const Point& rPos ); + void EndDrag(); + + SvLBoxEntry* GetCurEntry() const { return pCursor; } + void SetCursor( SvLBoxEntry* ); + + BOOL IsEntryInView( SvLBoxEntry* ); + SvLBoxEntry* GetEntry( const Point& rDocPos ); + SvLBoxEntry* GetNextEntry( const Point& rDocPos, SvLBoxEntry* pCurEntry ); + SvLBoxEntry* GetPrevEntry( const Point& rDocPos, SvLBoxEntry* pCurEntry ); + + Point GetEntryPosition( SvLBoxEntry* ); + void MakeVisible( SvLBoxEntry* pEntry ); + + void Arrange(); + + void SetSpaceBetweenEntries( long nHor, long Ver ); + long GetHorSpaceBetweenEntries() const { return nHorDist; } + long GetVerSpaceBetweenEntries() const { return nVerDist; } + + Rectangle CalcFocusRect( SvLBoxEntry* ); + + Rectangle CalcBmpRect( SvLBoxEntry*, const Point* pPos = 0, + SvIcnVwDataEntry* pViewData=0 ); + Rectangle CalcTextRect( SvLBoxEntry*, SvLBoxString* pItem = 0, + const Point* pPos = 0, + BOOL bForInplaceEdit = FALSE, + SvIcnVwDataEntry* pViewData = 0 ); + + long CalcBoundingWidth( SvLBoxEntry*, const SvIcnVwDataEntry* pViewData = 0) const; + long CalcBoundingHeight( SvLBoxEntry*, const SvIcnVwDataEntry* pViewData= 0 ) const; + Size CalcBoundingSize( SvLBoxEntry*, + SvIcnVwDataEntry* pViewData = 0 ) const; + void FindBoundingRect( SvLBoxEntry* pEntry, + SvIcnVwDataEntry* pViewData = 0 ); + // berechnet alle BoundRects neu + void RecalcAllBoundingRects(); + // berechnet alle ungueltigen BoundRects neu + void RecalcAllBoundingRectsSmart(); + const Rectangle& GetBoundingRect( SvLBoxEntry*, + SvIcnVwDataEntry* pViewData=0); + void InvalidateBoundingRect( SvLBoxEntry* ); + void InvalidateBoundingRect( Rectangle& rRect ) { rRect.Right() = LONG_MAX; } + BOOL IsBoundingRectValid( const Rectangle& rRect ) const { return (BOOL)( rRect.Right() != LONG_MAX ); } + + void PaintEmphasis( const Rectangle&, BOOL bSelected, + BOOL bCursored, OutputDevice* pOut = 0 ); + void PaintItem( const Rectangle& rRect, SvLBoxItem* pItem, + SvLBoxEntry* pEntry, USHORT nPaintFlags, OutputDevice* pOut = 0 ); + // berechnet alle BoundingRects neu, wenn bMustRecalcBoundingRects == TRUE + void CheckBoundingRects() { if (bMustRecalcBoundingRects) RecalcAllBoundingRects(); } + // berechnet alle invalidierten BoundingRects neu + void UpdateBoundingRects(); + void ShowTargetEmphasis( SvLBoxEntry* pEntry, BOOL bShow ); + SvLBoxEntry* GetDropTarget( const Point& rPosPixel ); + BOOL NotifyMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, + SvLBoxEntry*& rpNewParent, ULONG& rNewChildPos ); + BOOL NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, + SvLBoxEntry*& rpNewParent, ULONG& rNewChildPos ); + + void WriteDragServerInfo( const Point&, SvLBoxDDInfo* ); + void ReadDragServerInfo( const Point&, SvLBoxDDInfo* ); + void ToTop( SvLBoxEntry* ); + + void SetCurParent( SvLBoxEntry* pNewParent ); + SvLBoxEntry* GetCurParent() const { return pCurParent; } + USHORT GetSelectionCount() const; + void SetGrid( long nDX, long nDY ); + void Scroll( long nDeltaX, long nDeltaY, BOOL bScrollBar = FALSE ); + const Size& GetItemSize( SvIconView* pView, SvLBoxEntry*, SvLBoxItem*, + const SvIcnVwDataEntry* pViewData = 0 ) const; + void PrepareCommandEvent( const Point& rPt ); + + void HideDDIcon(); + void ShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos ); + void HideShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos ); + + SvLBoxEntry* mpViewData; + + BOOL IsOver( SvPtrarr* pSelectedRectList, const Rectangle& rEntryBoundRect ) const; + void SelectRect( const Rectangle&, BOOL bAdd = TRUE, + SvPtrarr* pOtherRects = 0, + short nOffs = SELRECT_BORDER_OFFS ); + void DrawSelectionRect( const Rectangle& ); + void HideSelectionRect(); + void CalcScrollOffsets( const Point& rRefPosPixel, + long& rX, long& rY, BOOL bDragDrop = FALSE, + USHORT nBorderWidth = 10 ); + void EndTracking(); + BOOL IsTextHit( SvLBoxEntry* pEntry, const Point& rDocPos ); + void MakeVisible( const Rectangle& rDocPos,BOOL bInScrollBarEvent=FALSE); + void AdjustAtGrid( SvLBoxEntry* pStart = 0 ); + void SetTextMode( SvIconViewTextMode, SvLBoxEntry* pEntry = 0 ); + SvIconViewTextMode GetTextMode( const SvLBoxEntry* pEntry = 0, + const SvIcnVwDataEntry* pViewData = 0 ) const; + void ShowFocusRect( const SvLBoxEntry* pEntry ); +}; + +inline void SvImpIconView::MakeVisible( SvLBoxEntry* pEntry ) +{ + const Rectangle& rRect = GetBoundingRect( pEntry ); + MakeVisible( rRect ); +} + +#endif // #ifndef _SVIMPICN_HXX + + diff --git a/svtools/source/inc/xbmread.hxx b/svtools/source/inc/xbmread.hxx new file mode 100644 index 000000000000..c9623fbb2cda --- /dev/null +++ b/svtools/source/inc/xbmread.hxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: xbmread.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XBMREAD_HXX +#define _XBMREAD_HXX + +#ifndef _GRAPH_HXX +#include +#endif +#ifndef _BMPACC_HXX +#include +#endif + +#ifdef _XBMPRIVATE + +// --------- +// - Enums - +// --------- + +enum XBMFormat +{ + XBM10, + XBM11 +}; + +enum ReadState +{ + XBMREAD_OK, + XBMREAD_ERROR, + XBMREAD_NEED_MORE +}; + +// ------------- +// - XBMReader - +// ------------- + +class XBMReader : public GraphicReader +{ + SvStream& rIStm; + Bitmap aBmp1; + BitmapWriteAccess* pAcc1; + short* pHexTable; + BitmapColor aWhite; + BitmapColor aBlack; + long nLastPos; + long nWidth; + long nHeight; + BOOL bStatus; + + void InitTable(); + ByteString FindTokenLine( SvStream* pInStm, const char* pTok1, + const char* pTok2 = NULL, const char* pTok3 = NULL ); + long ParseDefine( const sal_Char* pDefine ); + BOOL ParseData( SvStream* pInStm, const ByteString& aLastLine, XBMFormat eFormat ); + + +public: + + XBMReader( SvStream& rStm ); + virtual ~XBMReader(); + + ReadState ReadXBM( Graphic& rGraphic ); +}; + +#endif // _XBMPRIVATE + +// ------------- +// - ImportXBM - +// ------------- + +BOOL ImportXBM( SvStream& rStream, Graphic& rGraphic ); + +#endif // _XBMREAD_HXX diff --git a/svtools/source/inc/xpmread.hxx b/svtools/source/inc/xpmread.hxx new file mode 100644 index 000000000000..f1a76c9bc62f --- /dev/null +++ b/svtools/source/inc/xpmread.hxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: xpmread.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XPMREAD_HXX +#define _XPMREAD_HXX + +#ifndef _BITMAP_HXX +#include +#endif + +#ifdef _XPMPRIVATE + +#define XPMTEMPBUFSIZE 0x00008000 +#define XPMSTRINGBUF 0x00008000 + +#define XPMIDENTIFIER 0x00000001 // mnIdentifier includes on of the six phases +#define XPMDEFINITION 0x00000002 // the XPM format consists of +#define XPMVALUES 0x00000003 +#define XPMCOLORS 0x00000004 +#define XPMPIXELS 0x00000005 +#define XPMEXTENSIONS 0x00000006 +#define XPMENDEXT 0x00000007 + + +#define XPMREMARK 0x00000001 // defines used by mnStatus +#define XPMDOUBLE 0x00000002 +#define XPMSTRING 0x00000004 +#define XPMFINISHED 0x00000008 + +#define XPMCASESENSITIVE 0x00000001 +#define XPMCASENONSENSITIVE 0x00000002 + +// --------- +// - Enums - +// --------- + +enum ReadState +{ + XPMREAD_OK, + XPMREAD_ERROR, + XPMREAD_NEED_MORE +}; + +// ------------- +// - XPMReader - +// ------------- + +class BitmapWriteAccess; +class Graphic; + +class XPMReader : public GraphicReader +{ +private: + + SvStream& mrIStm; + Bitmap maBmp; + BitmapWriteAccess* mpAcc; + Bitmap maMaskBmp; + BitmapWriteAccess* mpMaskAcc; + long mnLastPos; + + ULONG mnWidth; + ULONG mnHeight; + ULONG mnColors; + ULONG mnCpp; // characters per pix + BOOL mbTransparent; + BOOL mbStatus; + ULONG mnStatus; + ULONG mnIdentifier; + BYTE mcThisByte; + BYTE mcLastByte; + ULONG mnTempAvail; + BYTE* mpTempBuf; + BYTE* mpTempPtr; + BYTE* mpFastColorTable; + BYTE* mpColMap; + ULONG mnStringSize; + BYTE* mpStringBuf; + ULONG mnParaSize; + BYTE* mpPara; + + BOOL ImplGetString( void ); + BOOL ImplGetColor( ULONG ); + BOOL ImplGetScanLine( ULONG ); + BOOL ImplGetColSub( BYTE* ); + BOOL ImplGetColKey( BYTE ); + void ImplGetRGBHex( BYTE*, ULONG ); + BOOL ImplGetPara( ULONG numb ); + BOOL ImplCompare( BYTE*, BYTE*, ULONG, ULONG nmode = XPMCASENONSENSITIVE ); + ULONG ImplGetULONG( ULONG nPara ); + +public: + XPMReader( SvStream& rStm ); + virtual ~XPMReader(); + + ReadState ReadXPM( Graphic& rGraphic ); +}; + +#endif // _XPMPRIVATE + +// ------------- +// - ImportXPM - +// ------------- + +BOOL ImportXPM( SvStream& rStream, Graphic& rGraphic ); + +#endif // _XPMREAD_HXX diff --git a/svtools/source/items/aeitem.cxx b/svtools/source/items/aeitem.cxx deleted file mode 100644 index 63fbd1db6227..000000000000 --- a/svtools/source/items/aeitem.cxx +++ /dev/null @@ -1,317 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: aeitem.cxx,v $ - * $Revision: 1.11 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -#include - -#define _SVSTDARR_USHORTS -#include -#include -#include - -// STATIC DATA ----------------------------------------------------------- - -DBG_NAME(SfxAllEnumItem) - -TYPEINIT1_AUTOFACTORY(SfxAllEnumItem, SfxEnumItem) - -// ----------------------------------------------------------------------- - -struct SfxAllEnumValue_Impl -{ - USHORT nValue; - XubString aText; -}; - -SV_DECL_PTRARR_DEL(SfxAllEnumValueArr, SfxAllEnumValue_Impl*, 0, 8) -SV_IMPL_PTRARR(SfxAllEnumValueArr, SfxAllEnumValue_Impl*) - -// ----------------------------------------------------------------------- - -SfxAllEnumItem::SfxAllEnumItem() : - SfxEnumItem(), - pValues( 0 ), - pDisabledValues( 0 ) -{ -} - -SfxAllEnumItem::SfxAllEnumItem( USHORT which, USHORT nVal, const XubString &rText ): - SfxEnumItem(which, nVal), - pValues( 0 ), - pDisabledValues( 0 ) -{ - DBG_CTOR(SfxAllEnumItem, 0); - InsertValue( nVal, rText ); -} - -// ----------------------------------------------------------------------- - -SfxAllEnumItem::SfxAllEnumItem(USHORT which, USHORT nVal): - SfxEnumItem(which, nVal), - pValues( 0 ), - pDisabledValues( 0 ) -{ - DBG_CTOR(SfxAllEnumItem, 0); - InsertValue( nVal ); -} - -// ----------------------------------------------------------------------- - -SfxAllEnumItem::SfxAllEnumItem( USHORT which, SvStream &rStream ): - SfxEnumItem(which, rStream), - pValues( 0 ), - pDisabledValues( 0 ) -{ - DBG_CTOR(SfxAllEnumItem, 0); - InsertValue( GetValue() ); -} - -// ----------------------------------------------------------------------- - - -SfxAllEnumItem::SfxAllEnumItem(USHORT which): - SfxEnumItem(which, 0), - pValues( 0 ), - pDisabledValues( 0 ) -{ - DBG_CTOR(SfxAllEnumItem, 0); -} - - -// ----------------------------------------------------------------------- - -SfxAllEnumItem::SfxAllEnumItem(const SfxAllEnumItem &rCopy): - SfxEnumItem(rCopy), - pValues(0), - pDisabledValues( 0 ) -{ - DBG_CTOR(SfxAllEnumItem, 0); - if ( !rCopy.pValues ) - return; - - pValues = new SfxAllEnumValueArr; - - for ( USHORT nPos = 0; nPos < rCopy.pValues->Count(); ++nPos ) - { - SfxAllEnumValue_Impl *pVal = new SfxAllEnumValue_Impl; - pVal->nValue = rCopy.pValues->GetObject(nPos)->nValue; - pVal->aText = rCopy.pValues->GetObject(nPos)->aText; - const SfxAllEnumValue_Impl *pTemp = pVal; - pValues->Insert( pTemp, nPos ); - } - - if( rCopy.pDisabledValues ) - { - pDisabledValues = new SvUShorts; - for ( USHORT nPos = 0; nPos < rCopy.pDisabledValues->Count(); ++nPos ) - { - pDisabledValues->Insert( rCopy.pDisabledValues->GetObject(nPos), - nPos ); - } - } -} - -// ----------------------------------------------------------------------- - -SfxAllEnumItem::~SfxAllEnumItem() -{ - DBG_DTOR(SfxAllEnumItem, 0); - delete pValues; - delete pDisabledValues; -} - -// ----------------------------------------------------------------------- - -USHORT SfxAllEnumItem::GetValueCount() const -{ - DBG_CHKTHIS(SfxAllEnumItem, 0); - return pValues ? pValues->Count() : 0; -} - -// ----------------------------------------------------------------------- - -XubString SfxAllEnumItem::GetValueTextByPos( USHORT nPos ) const -{ - DBG_CHKTHIS(SfxAllEnumItem, 0); - DBG_ASSERT( pValues && nPos < pValues->Count(), "enum overflow" ); - return pValues->GetObject(nPos)->aText; -} - -// ----------------------------------------------------------------------- - -USHORT SfxAllEnumItem::GetValueByPos( USHORT nPos ) const -{ - DBG_CHKTHIS(SfxAllEnumItem, 0); - DBG_ASSERT( pValues && nPos < pValues->Count(), "enum overflow" ); - return pValues->GetObject(nPos)->nValue; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxAllEnumItem::Clone( SfxItemPool * ) const -{ - DBG_CHKTHIS(SfxAllEnumItem, 0); - return new SfxAllEnumItem(*this); -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxAllEnumItem::Create( SvStream & rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxAllEnumItem, 0); - return new SfxAllEnumItem( Which(), rStream ); -} - - -// ----------------------------------------------------------------------- - -USHORT SfxAllEnumItem::_GetPosByValue( USHORT nVal ) const - -/* [Beschreibung] - - Im Ggs. zu liefert - diese interne Methode bei nicht vorhandenen Values die Position, - an der der Wert liegen w"urde. -*/ - -{ - DBG_CHKTHIS(SfxAllEnumItem, 0); - - if ( !pValues ) - return 0; - - //!O: binaere Suche oder SortArray verwenden - USHORT nPos; - for ( nPos = 0; nPos < pValues->Count(); ++nPos ) - if ( pValues->GetObject(nPos)->nValue >= nVal ) - return nPos; - return nPos; -} - -// ----------------------------------------------------------------------- - -USHORT SfxAllEnumItem::GetPosByValue( USHORT nValue ) const - -/* [Beschreibung] - - Liefert im Gegensatz zu - immer nValue zur"uck, solange nicht mindestens ein Wert mit einer der - Methoden eingef"ugt wurde. -*/ - -{ - DBG_CHKTHIS(SfxAllEnumItem, 0); - - if ( !pValues || !pValues->Count() ) - return nValue; - - return SfxEnumItem::GetPosByValue( nValue ); -} - -// ----------------------------------------------------------------------- - -void SfxAllEnumItem::InsertValue( USHORT nValue, const XubString &rValue ) -{ - DBG_CHKTHIS(SfxAllEnumItem, 0); - SfxAllEnumValue_Impl *pVal = new SfxAllEnumValue_Impl; - pVal->nValue = nValue; - pVal->aText = rValue; - const SfxAllEnumValue_Impl *pTemp = pVal; - if ( !pValues ) - pValues = new SfxAllEnumValueArr; - else if ( GetPosByValue( nValue ) != USHRT_MAX ) - // remove when exists - RemoveValue( nValue ); - // then insert - pValues->Insert( pTemp, _GetPosByValue(nValue) ); //! doppelte?! -} - -// ----------------------------------------------------------------------- - -void SfxAllEnumItem::InsertValue( USHORT nValue ) -{ - DBG_CHKTHIS(SfxAllEnumItem, 0); - SfxAllEnumValue_Impl *pVal = new SfxAllEnumValue_Impl; - pVal->nValue = nValue; - pVal->aText = XubString::CreateFromInt32( nValue ); - const SfxAllEnumValue_Impl *pTemp = pVal; - if ( !pValues ) - pValues = new SfxAllEnumValueArr; - - pValues->Insert( pTemp, _GetPosByValue(nValue) ); //! doppelte?! -} - -void SfxAllEnumItem::DisableValue( USHORT nValue ) -{ - DBG_CHKTHIS(SfxAllEnumItem, 0); - if ( !pDisabledValues ) - pDisabledValues = new SvUShorts; - - pDisabledValues->Insert( nValue, pDisabledValues->Count() ); -} - -BOOL SfxAllEnumItem::IsEnabled( USHORT nValue ) const -{ - if ( pDisabledValues ) - { - for ( USHORT i=0; iCount(); i++ ) - if ( (*pDisabledValues)[i] == nValue ) - return FALSE; - } - - return TRUE; -} - -// ----------------------------------------------------------------------- - -void SfxAllEnumItem::RemoveValue( USHORT nValue ) -{ - DBG_CHKTHIS(SfxAllEnumItem, 0); - USHORT nPos = GetPosByValue(nValue); - DBG_ASSERT( nPos != USHRT_MAX, "removing value not in enum" ); - pValues->Remove( nPos ); -} - -// ----------------------------------------------------------------------- - - -void SfxAllEnumItem::RemoveAllValues() -{ - DBG_CHKTHIS(SfxAllEnumItem, 0); - if ( pValues ) - pValues->DeleteAndDestroy( 0, pValues->Count() ); -} - - - diff --git a/svtools/source/items/eitem.cxx b/svtools/source/items/eitem.cxx deleted file mode 100644 index f7b95665391d..000000000000 --- a/svtools/source/items/eitem.cxx +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: eitem.cxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -//============================================================================ -// -// class SfxEnumItem -// -//============================================================================ - -TYPEINIT1(SfxEnumItem, CntEnumItem); - -//============================================================================ -// -// class SfxBoolItem -// -//============================================================================ - -TYPEINIT1_AUTOFACTORY(SfxBoolItem, CntBoolItem); - - diff --git a/svtools/source/items/flagitem.cxx b/svtools/source/items/flagitem.cxx deleted file mode 100644 index e59f981c5afa..000000000000 --- a/svtools/source/items/flagitem.cxx +++ /dev/null @@ -1,166 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: flagitem.cxx,v $ - * $Revision: 1.11 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include -#include -#include - -// STATIC DATA ----------------------------------------------------------- - -DBG_NAME(SfxFlagItem) - -USHORT nSfxFlagVal[16] = -{ - 0x0001, 0x0002, 0x0004, 0x0008, - 0x0010, 0x0020, 0x0040, 0x0080, - 0x0100, 0x0200, 0x0400, 0x0800, - 0x1000, 0x2000, 0x4000, 0x8000 -}; - - -// ----------------------------------------------------------------------- - -TYPEINIT1(SfxFlagItem, SfxPoolItem); - -// ----------------------------------------------------------------------- - -SfxFlagItem::SfxFlagItem( USHORT nW, USHORT nV ) : - SfxPoolItem( nW ), - nVal(nV) -{ - DBG_CTOR(SfxFlagItem, 0); -} - -// ----------------------------------------------------------------------- - -SfxFlagItem::SfxFlagItem( USHORT nW, SvStream &rStream) : - SfxPoolItem( nW ) -{ - DBG_CTOR(SfxFlagItem, 0); - rStream >> nVal; -} - -// ----------------------------------------------------------------------- - -SfxFlagItem::SfxFlagItem( const SfxFlagItem& rItem ) : - SfxPoolItem( rItem ), - nVal( rItem.nVal ) -{ - DBG_CTOR(SfxFlagItem, 0); -} - -// ----------------------------------------------------------------------- - -SvStream& SfxFlagItem::Store(SvStream &rStream, USHORT) const -{ - DBG_CHKTHIS(SfxFlagItem, 0); - rStream << nVal; - return rStream; -} - -// ----------------------------------------------------------------------- - -SfxItemPresentation SfxFlagItem::GetPresentation -( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * -) const -{ - DBG_CHKTHIS(SfxFlagItem, 0); - rText.Erase(); - for ( BYTE nFlag = 0; nFlag < GetFlagCount(); ++nFlag ) - rText += XubString::CreateFromInt32( GetFlag(nFlag) ); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -// ----------------------------------------------------------------------- - -XubString SfxFlagItem::GetFlagText( BYTE ) const -{ - DBG_CHKTHIS(SfxFlagItem, 0); - DBG_WARNING( "calling GetValueText(USHORT) on SfxFlagItem -- overload!" ); - return XubString(); -} - -// ----------------------------------------------------------------------- - -BYTE SfxFlagItem::GetFlagCount() const -{ - DBG_CHKTHIS(SfxFlagItem, 0); - DBG_WARNING( "calling GetValueText(USHORT) on SfxFlagItem -- overload!" ); - return 0; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxFlagItem::Create(SvStream &, USHORT) const -{ - DBG_CHKTHIS(SfxFlagItem, 0); - DBG_WARNING( "calling Create() on SfxFlagItem -- overload!" ); - return 0; -} - -// ----------------------------------------------------------------------- - -int SfxFlagItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS(SfxFlagItem, 0); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - return (((SfxFlagItem&)rItem).nVal == nVal); -} - -// ----------------------------------------------------------------------- - -void SfxFlagItem::SetFlag( BYTE nFlag, int bVal ) -{ - if ( bVal ) - nVal |= nSfxFlagVal[nFlag]; - else - nVal &= ~nSfxFlagVal[nFlag]; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxFlagItem::Clone(SfxItemPool *) const -{ - DBG_CHKTHIS(SfxFlagItem, 0); - return new SfxFlagItem( *this ); -} - - - - - diff --git a/svtools/source/items/globalnameitem.cxx b/svtools/source/items/globalnameitem.cxx deleted file mode 100644 index 6a8359fb39b8..000000000000 --- a/svtools/source/items/globalnameitem.cxx +++ /dev/null @@ -1,117 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: globalnameitem.cxx,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -#include -#include - -#include - -#include - -#include - -// STATIC DATA ----------------------------------------------------------- - - -// ----------------------------------------------------------------------- - -TYPEINIT1_AUTOFACTORY(SfxGlobalNameItem, SfxPoolItem); - -// ----------------------------------------------------------------------- - -SfxGlobalNameItem::SfxGlobalNameItem() -{ -} - -// ----------------------------------------------------------------------- - -SfxGlobalNameItem::SfxGlobalNameItem( USHORT nW, const SvGlobalName& rName ) -: SfxPoolItem( nW ), - m_aName( rName ) -{ -} - -// ----------------------------------------------------------------------- - -SfxGlobalNameItem::~SfxGlobalNameItem() -{ -} - -// ----------------------------------------------------------------------- - -int SfxGlobalNameItem::operator==( const SfxPoolItem& rItem ) const -{ - return ((SfxGlobalNameItem&)rItem).m_aName == m_aName; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxGlobalNameItem::Clone(SfxItemPool *) const -{ - return new SfxGlobalNameItem( *this ); -} - -//---------------------------------------------------------------------------- -// virtual -BOOL SfxGlobalNameItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE ) -{ - com::sun::star::uno::Reference < com::sun::star::script::XTypeConverter > xConverter - ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.script.Converter")), - com::sun::star::uno::UNO_QUERY ); - com::sun::star::uno::Sequence< sal_Int8 > aSeq; - com::sun::star::uno::Any aNew; - - try { aNew = xConverter->convertTo( rVal, ::getCppuType((const com::sun::star::uno::Sequence < sal_Int8 >*)0) ); } - catch (com::sun::star::uno::Exception&) {} - aNew >>= aSeq; - if ( aSeq.getLength() == 16 ) - { - m_aName.MakeFromMemory( (void*) aSeq.getConstArray() ); - return TRUE; - } - - DBG_ERROR( "SfxGlobalNameItem::PutValue - Wrong type!" ); - return FALSE; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL SfxGlobalNameItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE ) const -{ - com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 ); - void* pData = ( void* ) &m_aName.GetCLSID(); - memcpy( aSeq.getArray(), pData, 16 ); - rVal <<= aSeq; - return TRUE; -} - diff --git a/svtools/source/items/imageitm.cxx b/svtools/source/items/imageitm.cxx deleted file mode 100644 index cc4a2ebd4f3b..000000000000 --- a/svtools/source/items/imageitm.cxx +++ /dev/null @@ -1,148 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: imageitm.cxx,v $ - * $Revision: 1.9 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include -#include - -TYPEINIT1( SfxImageItem, SfxInt16Item ); - -struct SfxImageItem_Impl -{ - String aURL; - long nAngle; - BOOL bMirrored; - int operator == ( const SfxImageItem_Impl& rOther ) const - { return nAngle == rOther.nAngle && bMirrored == rOther.bMirrored; } -}; - -//--------------------------------------------------------- - -SfxImageItem::SfxImageItem( USHORT which, UINT16 nImage ) - : SfxInt16Item( which, nImage ) -{ - pImp = new SfxImageItem_Impl; - pImp->nAngle = 0; - pImp->bMirrored = FALSE; -} - -SfxImageItem::SfxImageItem( USHORT which, const String& rURL ) - : SfxInt16Item( which, 0 ) -{ - pImp = new SfxImageItem_Impl; - pImp->nAngle = 0; - pImp->bMirrored = FALSE; - pImp->aURL = rURL; -} - -SfxImageItem::SfxImageItem( const SfxImageItem& rItem ) - : SfxInt16Item( rItem ) -{ - pImp = new SfxImageItem_Impl( *(rItem.pImp) ); -} - -//--------------------------------------------------------- -SfxImageItem::~SfxImageItem() -{ - delete pImp; -} - -//--------------------------------------------------------- - -SfxPoolItem* SfxImageItem::Clone( SfxItemPool* ) const -{ - return new SfxImageItem( *this ); -} - -//--------------------------------------------------------- - -int SfxImageItem::operator==( const SfxPoolItem& rItem ) const -{ - return( ((SfxImageItem&) rItem).GetValue() == GetValue() && (*pImp == *(((SfxImageItem&)rItem).pImp) ) ); -} - -BOOL SfxImageItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE ) const -{ - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aSeq( 4 ); - aSeq[0] = ::com::sun::star::uno::makeAny( GetValue() ); - aSeq[1] = ::com::sun::star::uno::makeAny( pImp->nAngle ); - aSeq[2] = ::com::sun::star::uno::makeAny( pImp->bMirrored ); - aSeq[3] = ::com::sun::star::uno::makeAny( rtl::OUString( pImp->aURL )); - - rVal = ::com::sun::star::uno::makeAny( aSeq ); - return TRUE; -} - -BOOL SfxImageItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE ) -{ - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aSeq; - if (( rVal >>= aSeq ) && ( aSeq.getLength() == 4 )) - { - sal_Int16 nVal = sal_Int16(); - rtl::OUString aURL; - if ( aSeq[0] >>= nVal ) - SetValue( nVal ); - aSeq[1] >>= pImp->nAngle; - aSeq[2] >>= pImp->bMirrored; - if ( aSeq[3] >>= aURL ) - pImp->aURL = aURL; - return TRUE; - } - - return FALSE; -} - -void SfxImageItem::SetRotation( long nValue ) -{ - pImp->nAngle = nValue; -} - -long SfxImageItem::GetRotation() const -{ - return pImp->nAngle; -} - -void SfxImageItem::SetMirrored( BOOL bSet ) -{ - pImp->bMirrored = bSet; -} - -BOOL SfxImageItem::IsMirrored() const -{ - return pImp->bMirrored; -} - -String SfxImageItem::GetURL() const -{ - return pImp->aURL; -} - diff --git a/svtools/source/items/intitem.cxx b/svtools/source/items/intitem.cxx deleted file mode 100644 index b20f245f964b..000000000000 --- a/svtools/source/items/intitem.cxx +++ /dev/null @@ -1,261 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: intitem.cxx,v $ - * $Revision: 1.9 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include -#include -#include -#include -#include - -//============================================================================ -// -// class SfxByteItem -// -//============================================================================ - -TYPEINIT1_AUTOFACTORY(SfxByteItem, CntByteItem); - -//============================================================================ -// virtual -SfxPoolItem * SfxByteItem::Create(SvStream & rStream, USHORT) const -{ - short nValue = 0; - rStream >> nValue; - return new SfxByteItem(Which(), BYTE(nValue)); -} - -//============================================================================ -// -// class SfxInt16Item -// -//============================================================================ - -DBG_NAME(SfxInt16Item); - -//============================================================================ -TYPEINIT1_AUTOFACTORY(SfxInt16Item, SfxPoolItem); - -//============================================================================ -SfxInt16Item::SfxInt16Item(USHORT which, SvStream & rStream): - SfxPoolItem(which) -{ - DBG_CTOR(SfxInt16Item, 0); - short nTheValue = 0; - rStream >> nTheValue; - m_nValue = nTheValue; -} - -//============================================================================ -// virtual -int SfxInt16Item::operator ==(const SfxPoolItem & rItem) const -{ - DBG_CHKTHIS(SfxInt16Item, 0); - DBG_ASSERT(SfxPoolItem::operator ==(rItem), "unequal type"); - return m_nValue == SAL_STATIC_CAST(const SfxInt16Item *, &rItem)-> - m_nValue; -} - -//============================================================================ -// virtual -int SfxInt16Item::Compare(const SfxPoolItem & rWith) const -{ - DBG_CHKTHIS(SfxInt16Item, 0); - DBG_ASSERT(SfxPoolItem::operator ==(rWith), "unequal type"); - return SAL_STATIC_CAST(const SfxInt16Item *, &rWith)->m_nValue - < m_nValue ? - -1 : - SAL_STATIC_CAST(const SfxInt16Item *, &rWith)->m_nValue - == m_nValue ? - 0 : 1; -} - -//============================================================================ -// virtual -SfxItemPresentation SfxInt16Item::GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, - XubString & rText, - const IntlWrapper *) const -{ - DBG_CHKTHIS(SfxInt16Item, 0); - rText = UniString::CreateFromInt32(m_nValue); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - - -//============================================================================ -// virtual -BOOL SfxInt16Item::QueryValue(com::sun::star::uno::Any& rVal, BYTE) const -{ - sal_Int16 nValue = m_nValue; - rVal <<= nValue; - return TRUE; -} - -//============================================================================ -// virtual -BOOL SfxInt16Item::PutValue(const com::sun::star::uno::Any& rVal, BYTE ) -{ - sal_Int16 nValue = sal_Int16(); - if (rVal >>= nValue) - { - m_nValue = nValue; - return TRUE; - } - - DBG_ERROR( "SfxInt16Item::PutValue - Wrong type!" ); - return FALSE; -} - -//============================================================================ -// virtual -SfxPoolItem * SfxInt16Item::Create(SvStream & rStream, USHORT) const -{ - DBG_CHKTHIS(SfxInt16Item, 0); - return new SfxInt16Item(Which(), rStream); -} - -//============================================================================ -// virtual -SvStream & SfxInt16Item::Store(SvStream & rStream, USHORT) const -{ - DBG_CHKTHIS(SfxInt16Item, 0); - rStream << short(m_nValue); - return rStream; -} - -//============================================================================ -SfxPoolItem * SfxInt16Item::Clone(SfxItemPool *) const -{ - DBG_CHKTHIS(SfxInt16Item, 0); - return new SfxInt16Item(*this); -} - -//============================================================================ -INT16 SfxInt16Item::GetMin() const -{ - DBG_CHKTHIS(SfxInt16Item, 0); - return -32768; -} - -//============================================================================ -INT16 SfxInt16Item::GetMax() const -{ - DBG_CHKTHIS(SfxInt16Item, 0); - return 32767; -} - -//============================================================================ -SfxFieldUnit SfxInt16Item::GetUnit() const -{ - DBG_CHKTHIS(SfxInt16Item, 0); - return SFX_FUNIT_NONE; -} - -//============================================================================ -// -// class SfxUInt16Item -// -//============================================================================ - -TYPEINIT1_AUTOFACTORY(SfxUInt16Item, CntUInt16Item); - - -//============================================================================ -// -// class SfxInt32Item -// -//============================================================================ - -TYPEINIT1_AUTOFACTORY(SfxInt32Item, CntInt32Item); - - -//============================================================================ -// -// class SfxUInt32Item -// -//============================================================================ - -TYPEINIT1_AUTOFACTORY(SfxUInt32Item, CntUInt32Item); - - -//============================================================================ -// -// class SfxMetricItem -// -//============================================================================ - -DBG_NAME(SfxMetricItem); - -//============================================================================ -TYPEINIT1_AUTOFACTORY(SfxMetricItem, SfxInt32Item); - -//============================================================================ -SfxMetricItem::SfxMetricItem(USHORT which, UINT32 nValue): - SfxInt32Item(which, nValue) -{ - DBG_CTOR(SfxMetricItem, 0); -} - -//============================================================================ -SfxMetricItem::SfxMetricItem(USHORT which, SvStream & rStream): - SfxInt32Item(which, rStream) -{ - DBG_CTOR(SfxMetricItem, 0); -} - -//============================================================================ -SfxMetricItem::SfxMetricItem(const SfxMetricItem & rItem): - SfxInt32Item(rItem) -{ - DBG_CTOR(SfxMetricItem, 0); -} - -//============================================================================ -// virtual -int SfxMetricItem::ScaleMetrics(long nMult, long nDiv) -{ - BigInt aTheValue(GetValue()); - aTheValue *= nMult; - aTheValue += nDiv / 2; - aTheValue /= nDiv; - SetValue(aTheValue); - return 1; -} - -//============================================================================ -// virtual -int SfxMetricItem::HasMetrics() const -{ - return 1; -} - diff --git a/svtools/source/items/itemdel.cxx b/svtools/source/items/itemdel.cxx deleted file mode 100644 index 4028aa497c22..000000000000 --- a/svtools/source/items/itemdel.cxx +++ /dev/null @@ -1,138 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: itemdel.cxx,v $ - * $Revision: 1.9 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include "itemdel.hxx" -#include -#include -#include - -#include -#include -#include - -// STATIC DATA ----------------------------------------------------------- - -DBG_NAME(SfxItemDesruptor_Impl); - -// ----------------------------------------------------------------------- - -class SfxItemDesruptor_Impl -{ - SfxPoolItem *pItem; - Link aLink; - -private: - DECL_LINK( Delete, void * ); - SfxItemDesruptor_Impl( const SfxItemDesruptor_Impl& ); // n.i. - -public: - SfxItemDesruptor_Impl( SfxPoolItem *pItemToDesrupt ); - ~SfxItemDesruptor_Impl(); -}; - -SV_DECL_PTRARR( SfxItemDesruptorList_Impl, SfxItemDesruptor_Impl*, 4, 4 ) - -// ------------------------------------------------------------------------ -SfxItemDesruptor_Impl::SfxItemDesruptor_Impl( SfxPoolItem *pItemToDesrupt ): - pItem(pItemToDesrupt), - aLink( LINK(this, SfxItemDesruptor_Impl, Delete) ) -{ - DBG_CTOR(SfxItemDesruptor_Impl, 0); - - DBG_ASSERT( 0 == pItem->GetRefCount(), "desrupting pooled item" ); - pItem->SetKind( SFX_ITEMS_DELETEONIDLE ); - - // im Idle abarbeiten - GetpApp()->InsertIdleHdl( aLink, 1 ); - - // und in Liste eintragen (damit geflusht werden kann) - SfxItemDesruptorList_Impl* &rpList = ImpSvtData::GetSvtData().pItemDesruptList; - if ( !rpList ) - rpList = new SfxItemDesruptorList_Impl; - const SfxItemDesruptor_Impl *pThis = this; - rpList->Insert( pThis, rpList->Count() ); -} - -// ------------------------------------------------------------------------ -SfxItemDesruptor_Impl::~SfxItemDesruptor_Impl() -{ - DBG_DTOR(SfxItemDesruptor_Impl, 0); - - // aus Idle-Handler austragen - GetpApp()->RemoveIdleHdl( aLink ); - - // und aus Liste austragen - SfxItemDesruptorList_Impl* &rpList = ImpSvtData::GetSvtData().pItemDesruptList; - DBG_ASSERT( rpList, "no DesruptorList" ); - const SfxItemDesruptor_Impl *pThis = this; - if ( rpList ) HACK(warum?) - rpList->Remove( rpList->GetPos(pThis) ); - - // reset RefCount (was set to SFX_ITEMS_SPECIAL before!) - pItem->SetRefCount( 0 ); - //DBG_CHKOBJ( pItem, SfxPoolItem, 0 ); - delete pItem; -} - -// ------------------------------------------------------------------------ -IMPL_LINK( SfxItemDesruptor_Impl, Delete, void *, EMPTYARG ) -{ - {DBG_CHKTHIS(SfxItemDesruptor_Impl, 0);} - delete this; - return 0; -} - -// ------------------------------------------------------------------------ -SfxPoolItem* DeleteItemOnIdle( SfxPoolItem* pItem ) -{ - DBG_ASSERT( 0 == pItem->GetRefCount(), "deleting item in use" ); - new SfxItemDesruptor_Impl( pItem ); - return pItem; -} - -// ------------------------------------------------------------------------ -void DeleteOnIdleItems() -{ - SfxItemDesruptorList_Impl* &rpList - = ImpSvtData::GetSvtData().pItemDesruptList; - if ( rpList ) - { - USHORT n; - while ( 0 != ( n = rpList->Count() ) ) - // Remove ist implizit im Dtor - delete rpList->GetObject( n-1 ); - DELETEZ(rpList); - } -} - - diff --git a/svtools/source/items/macitem.cxx b/svtools/source/items/macitem.cxx deleted file mode 100644 index 480fb844ccc7..000000000000 --- a/svtools/source/items/macitem.cxx +++ /dev/null @@ -1,298 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: macitem.cxx,v $ - * $Revision: 1.11 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include - -#ifndef GCC -#endif - -#include - -// STATIC DATA ----------------------------------------------------------- - -DBG_NAME(SvxMacroItem); - -// ----------------------------------------------------------------------- - -TYPEINIT1_FACTORY(SvxMacroItem, SfxPoolItem, new SvxMacroItem(0)); - -// ----------------------------------------------------------------------- - - -SjJSbxObjectBase::~SjJSbxObjectBase() -{ -} - -SjJSbxObjectBase* SjJSbxObjectBase::Clone( void ) -{ - return NULL; -} - -SvxMacro::SvxMacro( const String &rMacName, const String &rLanguage) - : aMacName( rMacName ), aLibName( rLanguage), - pFunctionObject(NULL), eType( EXTENDED_STYPE) -{ - if (rLanguage.EqualsAscii(SVX_MACRO_LANGUAGE_STARBASIC)) - eType=STARBASIC; - else if (rLanguage.EqualsAscii(SVX_MACRO_LANGUAGE_JAVASCRIPT)) - eType=JAVASCRIPT; -} - - -SvxMacro::~SvxMacro() -{ - delete pFunctionObject; -} - -String SvxMacro::GetLanguage()const -{ - if(eType==STARBASIC) - { - return UniString::CreateFromAscii( - RTL_CONSTASCII_STRINGPARAM(SVX_MACRO_LANGUAGE_STARBASIC)); - } - else if(eType==JAVASCRIPT) - { - return UniString::CreateFromAscii( - RTL_CONSTASCII_STRINGPARAM(SVX_MACRO_LANGUAGE_JAVASCRIPT)); - } - else if(eType==EXTENDED_STYPE) - { - return UniString::CreateFromAscii( - RTL_CONSTASCII_STRINGPARAM(SVX_MACRO_LANGUAGE_SF)); - - } - return aLibName; -} - - - -SvxMacro& SvxMacro::operator=( const SvxMacro& rBase ) -{ - if( this != &rBase ) - { - aMacName = rBase.aMacName; - aLibName = rBase.aLibName; - delete pFunctionObject; - pFunctionObject = rBase.pFunctionObject ? rBase.pFunctionObject->Clone() : NULL; - eType = rBase.eType; - } - return *this; -} - - -SvxMacroTableDtor& SvxMacroTableDtor::operator=( const SvxMacroTableDtor& rTbl ) -{ - DelDtor(); - SvxMacro* pTmp = ((SvxMacroTableDtor&)rTbl).First(); - while( pTmp ) - { - SvxMacro *pNew = new SvxMacro( *pTmp ); - Insert( rTbl.GetCurKey(), pNew ); - pTmp = ((SvxMacroTableDtor&)rTbl).Next(); - } - return *this; -} - - -SvStream& SvxMacroTableDtor::Read( SvStream& rStrm, USHORT nVersion ) -{ - if( SVX_MACROTBL_VERSION40 <= nVersion ) - rStrm >> nVersion; - short nMacro; - rStrm >> nMacro; - - for( short i = 0; i < nMacro; ++i ) - { - USHORT nCurKey, eType = STARBASIC; - String aLibName, aMacName; - rStrm >> nCurKey; - SfxPoolItem::readByteString(rStrm, aLibName); - SfxPoolItem::readByteString(rStrm, aMacName); - - if( SVX_MACROTBL_VERSION40 <= nVersion ) - rStrm >> eType; - - SvxMacro* pNew = new SvxMacro( aMacName, aLibName, (ScriptType)eType ); - - SvxMacro *pOld = Get( nCurKey ); - if( pOld ) - { - delete pOld; - Replace( nCurKey, pNew ); - } - else - Insert( nCurKey, pNew ); - } - return rStrm; -} - - -SvStream& SvxMacroTableDtor::Write( SvStream& rStream ) const -{ - USHORT nVersion = SOFFICE_FILEFORMAT_31 == rStream.GetVersion() - ? SVX_MACROTBL_VERSION31 - : SVX_MACROTBL_AKTVERSION; - - if( SVX_MACROTBL_VERSION40 <= nVersion ) - rStream << nVersion; - - rStream << (USHORT)Count(); - - SvxMacro* pMac = ((SvxMacroTableDtor*)this)->First(); - while( pMac && rStream.GetError() == SVSTREAM_OK ) - { - rStream << (short)GetCurKey(); - SfxPoolItem::writeByteString(rStream, pMac->GetLibName()); - SfxPoolItem::writeByteString(rStream, pMac->GetMacName()); - - if( SVX_MACROTBL_VERSION40 <= nVersion ) - rStream << (USHORT)pMac->GetScriptType(); - pMac = ((SvxMacroTableDtor*)this)->Next(); - } - return rStream; -} - -// ----------------------------------------------------------------------- - -void SvxMacroTableDtor::DelDtor() -{ - SvxMacro* pTmp = First(); - while( pTmp ) - { - delete pTmp; - pTmp = Next(); - } - Clear(); -} - -// ----------------------------------------------------------------------- - -int SvxMacroItem::operator==( const SfxPoolItem& rAttr ) const -{ - DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); - - const SvxMacroTableDtor& rOwn = aMacroTable; - const SvxMacroTableDtor& rOther = ( (SvxMacroItem&) rAttr ).aMacroTable; - - // Anzahl unterschiedlich => auf jeden Fall ungleich - if ( rOwn.Count() != rOther.Count() ) - return FALSE; - - // einzeln verleichen; wegen Performance ist die Reihenfolge wichtig - for ( USHORT nNo = 0; nNo < rOwn.Count(); ++nNo ) - { - const SvxMacro *pOwnMac = rOwn.GetObject(nNo); - const SvxMacro *pOtherMac = rOther.GetObject(nNo); - if ( rOwn.GetKey(pOwnMac) != rOther.GetKey(pOtherMac) || - pOwnMac->GetLibName() != pOtherMac->GetLibName() || - pOwnMac->GetMacName() != pOtherMac->GetMacName() ) - return FALSE; - } - - return TRUE; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxMacroItem::Clone( SfxItemPool* ) const -{ - return new SvxMacroItem( *this ); -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxMacroItem::GetPresentation -( - SfxItemPresentation /*ePres*/, - SfxMapUnit /*eCoreUnit*/, - SfxMapUnit /*ePresUnit*/, - XubString& rText, - const IntlWrapper * -) const -{ -/*!!! - SvxMacroTableDtor& rTbl = (SvxMacroTableDtor&)GetMacroTable(); - SvxMacro* pMac = rTbl.First(); - - while ( pMac ) - { - rText += pMac->GetLibName(); - rText += cpDelim; - rText += pMac->GetMacName(); - pMac = rTbl.Next(); - if ( pMac ) - rText += cpDelim; - } -*/ - rText.Erase(); - return SFX_ITEM_PRESENTATION_NONE; -} - -// ----------------------------------------------------------------------- - -SvStream& SvxMacroItem::Store( SvStream& rStrm , USHORT ) const -{ - return aMacroTable.Write( rStrm ); -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SvxMacroItem::Create( SvStream& rStrm, USHORT nVersion ) const -{ - SvxMacroItem* pAttr = new SvxMacroItem( Which() ); - pAttr->aMacroTable.Read( rStrm, nVersion ); - return pAttr; -} - -// ----------------------------------------------------------------------- - -void SvxMacroItem::SetMacro( USHORT nEvent, const SvxMacro& rMacro ) -{ - SvxMacro *pMacro; - if ( 0 != (pMacro=aMacroTable.Get(nEvent)) ) - { - delete pMacro; - aMacroTable.Replace(nEvent, new SvxMacro( rMacro ) ); - } - else - aMacroTable.Insert(nEvent, new SvxMacro( rMacro ) ); -} - -// ----------------------------------------------------------------------- - -USHORT SvxMacroItem::GetVersion( USHORT nFileFormatVersion ) const -{ - return SOFFICE_FILEFORMAT_31 == nFileFormatVersion - ? 0 : aMacroTable.GetVersion(); -} - diff --git a/svtools/source/items/makefile.mk b/svtools/source/items/makefile.mk deleted file mode 100644 index 651e54bb7e23..000000000000 --- a/svtools/source/items/makefile.mk +++ /dev/null @@ -1,65 +0,0 @@ -#************************************************************************* -# -# 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 -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.13 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. -PRJNAME=svtools -TARGET=items -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES=\ - $(SLO)$/aeitem.obj \ - $(SLO)$/eitem.obj \ - $(SLO)$/flagitem.obj \ - $(SLO)$/globalnameitem.obj \ - $(SLO)$/imageitm.obj \ - $(SLO)$/intitem.obj \ - $(SLO)$/itemdel.obj \ - $(SLO)$/macitem.obj \ - $(SLO)$/poolcach.obj \ - $(SLO)$/ptitem.obj \ - $(SLO)$/rectitem.obj \ - $(SLO)$/rngitem.obj \ - $(SLO)$/stritem.obj \ - $(SLO)$/style.obj \ - $(SLO)$/szitem.obj \ - $(SLO)$/wallitem.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/svtools/source/items/poolcach.cxx b/svtools/source/items/poolcach.cxx deleted file mode 100644 index 2c758a7e25fa..000000000000 --- a/svtools/source/items/poolcach.cxx +++ /dev/null @@ -1,159 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: poolcach.cxx,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include - -#ifndef GCC -#endif - -#include -#include -#include "poolcach.hxx" - -// STATIC DATA ----------------------------------------------------------- - -DBG_NAME(SfxItemPoolCache) - - -//------------------------------------------------------------------------ - -struct SfxItemModifyImpl -{ - const SfxSetItem *pOrigItem; - SfxSetItem *pPoolItem; -}; - -SV_DECL_VARARR( SfxItemModifyArr_Impl, SfxItemModifyImpl, 8, 8 ) -SV_IMPL_VARARR( SfxItemModifyArr_Impl, SfxItemModifyImpl); - -//------------------------------------------------------------------------ - -SfxItemPoolCache::SfxItemPoolCache( SfxItemPool *pItemPool, - const SfxPoolItem *pPutItem ): - pPool(pItemPool), - pCache(new SfxItemModifyArr_Impl), - pSetToPut( 0 ), - pItemToPut( &pItemPool->Put(*pPutItem) ) -{ - DBG_CTOR(SfxItemPoolCache, 0); - DBG_ASSERT(pItemPool, "kein Pool angegeben"); -} - -//------------------------------------------------------------------------ - -SfxItemPoolCache::SfxItemPoolCache( SfxItemPool *pItemPool, - const SfxItemSet *pPutSet ): - pPool(pItemPool), - pCache(new SfxItemModifyArr_Impl), - pSetToPut( pPutSet ), - pItemToPut( 0 ) -{ - DBG_CTOR(SfxItemPoolCache, 0); - DBG_ASSERT(pItemPool, "kein Pool angegeben"); -} - -//------------------------------------------------------------------------ - -SfxItemPoolCache::~SfxItemPoolCache() -{ - DBG_DTOR(SfxItemPoolCache, 0); - for ( USHORT nPos = 0; nPos < pCache->Count(); ++nPos ) { - pPool->Remove( *(*pCache)[nPos].pPoolItem ); - pPool->Remove( *(*pCache)[nPos].pOrigItem ); - } - delete pCache; pCache = 0; - - if ( pItemToPut ) - pPool->Remove( *pItemToPut ); -} - -//------------------------------------------------------------------------ - -const SfxSetItem& SfxItemPoolCache::ApplyTo( const SfxSetItem &rOrigItem, BOOL bNew ) -{ - DBG_CHKTHIS(SfxItemPoolCache, 0); - DBG_ASSERT( pPool == rOrigItem.GetItemSet().GetPool(), "invalid Pool" ); - DBG_ASSERT( IsDefaultItem( &rOrigItem ) || IsPooledItem( &rOrigItem ), - "original not in pool" ); - - // Suchen, ob diese Transformations schon einmal vorkam - for ( USHORT nPos = 0; nPos < pCache->Count(); ++nPos ) - { - SfxItemModifyImpl &rMapEntry = (*pCache)[nPos]; - if ( rMapEntry.pOrigItem == &rOrigItem ) - { - // aendert sich ueberhaupt etwas? - if ( rMapEntry.pPoolItem != &rOrigItem ) - { - rMapEntry.pPoolItem->AddRef(2); // einen davon fuer den Cache - if ( bNew ) - pPool->Put( rOrigItem ); //! AddRef?? - } - return *rMapEntry.pPoolItem; - } - } - - // die neue Attributierung in einem neuen Set eintragen - SfxSetItem *pNewItem = (SfxSetItem *)rOrigItem.Clone(); - if ( pItemToPut ) - { - pNewItem->GetItemSet().PutDirect( *pItemToPut ); - DBG_ASSERT( &pNewItem->GetItemSet().Get( pItemToPut->Which() ) == pItemToPut, - "wrong item in temporary set" ); - } - else - pNewItem->GetItemSet().Put( *pSetToPut ); - const SfxSetItem* pNewPoolItem = (const SfxSetItem*) &pPool->Put( *pNewItem ); - DBG_ASSERT( pNewPoolItem != pNewItem, "Pool: rein == raus?" ); - delete pNewItem; - - // Refernzzaehler anpassen, je einen davon fuer den Cache - pNewPoolItem->AddRef( pNewPoolItem != &rOrigItem ? 2 : 1 ); - if ( bNew ) - pPool->Put( rOrigItem ); //! AddRef?? - - // die Transformation im Cache eintragen - SfxItemModifyImpl aModify; - aModify.pOrigItem = &rOrigItem; - aModify.pPoolItem = (SfxSetItem*) pNewPoolItem; - pCache->Insert( aModify, pCache->Count() ); - - DBG_ASSERT( !pItemToPut || - &pNewPoolItem->GetItemSet().Get( pItemToPut->Which() ) == pItemToPut, - "wrong item in resulting set" ); - - return *pNewPoolItem; -} - - - diff --git a/svtools/source/items/ptitem.cxx b/svtools/source/items/ptitem.cxx deleted file mode 100644 index ac1e94fd1727..000000000000 --- a/svtools/source/items/ptitem.cxx +++ /dev/null @@ -1,208 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ptitem.cxx,v $ - * $Revision: 1.12 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include -#include -#include -#include - -#include -#include "memberid.hrc" - -using namespace ::com::sun::star; -// STATIC DATA ----------------------------------------------------------- - -DBG_NAME(SfxPointItem) - -#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) -#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) - -// ----------------------------------------------------------------------- - -TYPEINIT1_AUTOFACTORY(SfxPointItem, SfxPoolItem); - -// ----------------------------------------------------------------------- - -SfxPointItem::SfxPointItem() -{ - DBG_CTOR(SfxPointItem, 0); -} - -// ----------------------------------------------------------------------- - -SfxPointItem::SfxPointItem( USHORT nW, const Point& rVal ) : - SfxPoolItem( nW ), - aVal( rVal ) -{ - DBG_CTOR(SfxPointItem, 0); -} - -// ----------------------------------------------------------------------- - -SfxPointItem::SfxPointItem( USHORT nW, SvStream &rStream ) : - SfxPoolItem( nW ) -{ - DBG_CTOR(SfxPointItem, 0); - rStream >> aVal; -} - -// ----------------------------------------------------------------------- - -SfxPointItem::SfxPointItem( const SfxPointItem& rItem ) : - SfxPoolItem( rItem ), - aVal( rItem.aVal ) -{ - DBG_CTOR(SfxPointItem, 0); -} - -// ----------------------------------------------------------------------- - -SfxItemPresentation SfxPointItem::GetPresentation -( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * -) const -{ - DBG_CHKTHIS(SfxPointItem, 0); - rText = UniString::CreateFromInt32(aVal.X()); - rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); - rText += UniString::CreateFromInt32(aVal.Y()); - rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -// ----------------------------------------------------------------------- - -int SfxPointItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS(SfxPointItem, 0); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - return ((SfxPointItem&)rItem).aVal == aVal; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxPointItem::Clone(SfxItemPool *) const -{ - DBG_CHKTHIS(SfxPointItem, 0); - return new SfxPointItem( *this ); -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxPointItem::Create(SvStream &rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxPointItem, 0); - Point aStr; - rStream >> aStr; - return new SfxPointItem(Which(), aStr); -} - -// ----------------------------------------------------------------------- - -SvStream& SfxPointItem::Store(SvStream &rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxPointItem, 0); - rStream << aVal; - return rStream; -} - -// ----------------------------------------------------------------------- - -BOOL SfxPointItem::QueryValue( uno::Any& rVal, - BYTE nMemberId ) const -{ - sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - awt::Point aTmp(aVal.X(), aVal.Y()); - if( bConvert ) - { - aTmp.X = TWIP_TO_MM100(aTmp.X); - aTmp.Y = TWIP_TO_MM100(aTmp.Y); - } - nMemberId &= ~CONVERT_TWIPS; - switch ( nMemberId ) - { - case 0: rVal <<= aTmp; break; - case MID_X: rVal <<= aTmp.X; break; - case MID_Y: rVal <<= aTmp.Y; break; - default: DBG_ERROR("Wrong MemberId!"); return FALSE; - } - - return TRUE; -} - -// ----------------------------------------------------------------------- - -BOOL SfxPointItem::PutValue( const uno::Any& rVal, - BYTE nMemberId ) -{ - sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - BOOL bRet = FALSE; - awt::Point aValue; - sal_Int32 nVal = 0; - if ( !nMemberId ) - { - bRet = ( rVal >>= aValue ); - if( bConvert ) - { - aValue.X = MM100_TO_TWIP(aValue.X); - aValue.Y = MM100_TO_TWIP(aValue.Y); - } - } - else - { - bRet = ( rVal >>= nVal ); - if( bConvert ) - nVal = MM100_TO_TWIP( nVal ); - } - - if ( bRet ) - { - switch ( nMemberId ) - { - case 0: aVal.setX( aValue.X ); aVal.setY( aValue.Y ); break; - case MID_X: aVal.setX( nVal ); break; - case MID_Y: aVal.setY( nVal ); break; - default: DBG_ERROR("Wrong MemberId!"); return FALSE; - } - } - - return bRet; -} - - - diff --git a/svtools/source/items/rectitem.cxx b/svtools/source/items/rectitem.cxx deleted file mode 100644 index f9faeeeaa824..000000000000 --- a/svtools/source/items/rectitem.cxx +++ /dev/null @@ -1,204 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: rectitem.cxx,v $ - * $Revision: 1.12 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include -#include -#include -#include - -#include -#include "memberid.hrc" - -// STATIC DATA ----------------------------------------------------------- - -DBG_NAME(SfxRectangleItem) - - -// ----------------------------------------------------------------------- - -TYPEINIT1_AUTOFACTORY(SfxRectangleItem, SfxPoolItem); - -// ----------------------------------------------------------------------- - -SfxRectangleItem::SfxRectangleItem() -{ - DBG_CTOR(SfxRectangleItem, 0); -} - -// ----------------------------------------------------------------------- - -SfxRectangleItem::SfxRectangleItem( USHORT nW, const Rectangle& rVal ) : - SfxPoolItem( nW ), - aVal( rVal ) -{ - DBG_CTOR(SfxRectangleItem, 0); -} - -// ----------------------------------------------------------------------- - -SfxRectangleItem::SfxRectangleItem( USHORT nW, SvStream &rStream ) : - SfxPoolItem( nW ) -{ - DBG_CTOR(SfxRectangleItem, 0); - rStream >> aVal; -} - -// ----------------------------------------------------------------------- - -SfxRectangleItem::SfxRectangleItem( const SfxRectangleItem& rItem ) : - SfxPoolItem( rItem ), - aVal( rItem.aVal ) -{ - DBG_CTOR(SfxRectangleItem, 0); -} - -// ----------------------------------------------------------------------- - -SfxItemPresentation SfxRectangleItem::GetPresentation -( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * -) const -{ - DBG_CHKTHIS(SfxRectangleItem, 0); - rText = UniString::CreateFromInt32(aVal.Top()); - rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); - rText += UniString::CreateFromInt32(aVal.Left()); - rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); - rText += UniString::CreateFromInt32(aVal.Bottom()); - rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); - rText += UniString::CreateFromInt32(aVal.Right()); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -// ----------------------------------------------------------------------- - -int SfxRectangleItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS(SfxRectangleItem, 0); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - return ((SfxRectangleItem&)rItem).aVal == aVal; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxRectangleItem::Clone(SfxItemPool *) const -{ - DBG_CHKTHIS(SfxRectangleItem, 0); - return new SfxRectangleItem( *this ); -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxRectangleItem::Create(SvStream &rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxRectangleItem, 0); - Rectangle aStr; - rStream >> aStr; - return new SfxRectangleItem(Which(), aStr); -} - -// ----------------------------------------------------------------------- - -SvStream& SfxRectangleItem::Store(SvStream &rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxRectangleItem, 0); - rStream << aVal; - return rStream; -} - - -// ----------------------------------------------------------------------- -BOOL SfxRectangleItem::QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId) const -{ - nMemberId &= ~CONVERT_TWIPS; - switch ( nMemberId ) - { - case 0: - { - rVal <<= com::sun::star::awt::Rectangle( aVal.getX(), - aVal.getY(), - aVal.getWidth(), - aVal.getHeight() ); - break; - } - case MID_RECT_LEFT: rVal <<= aVal.getX(); break; - case MID_RECT_RIGHT: rVal <<= aVal.getY(); break; - case MID_WIDTH: rVal <<= aVal.getWidth(); break; - case MID_HEIGHT: rVal <<= aVal.getHeight(); break; - default: DBG_ERROR("Wrong MemberID!"); return FALSE; - } - - return TRUE; -} - -// ----------------------------------------------------------------------- -BOOL SfxRectangleItem::PutValue( const com::sun::star::uno::Any& rVal, - BYTE nMemberId ) -{ - BOOL bRet = FALSE; - nMemberId &= ~CONVERT_TWIPS; - com::sun::star::awt::Rectangle aValue; - sal_Int32 nVal = 0; - if ( !nMemberId ) - bRet = (rVal >>= aValue); - else - bRet = (rVal >>= nVal); - - if ( bRet ) - { - switch ( nMemberId ) - { - case 0: - aVal.setX( aValue.X ); - aVal.setY( aValue.Y ); - aVal.setWidth( aValue.Width ); - aVal.setHeight( aValue.Height ); - break; - case MID_RECT_LEFT: aVal.setX( nVal ); break; - case MID_RECT_RIGHT: aVal.setY( nVal ); break; - case MID_WIDTH: aVal.setWidth( nVal ); break; - case MID_HEIGHT: aVal.setHeight( nVal ); break; - default: DBG_ERROR("Wrong MemberID!"); return FALSE; - } - } - - return bRet; -} - - - diff --git a/svtools/source/items/rngitem.cxx b/svtools/source/items/rngitem.cxx deleted file mode 100644 index 0c62de7229f4..000000000000 --- a/svtools/source/items/rngitem.cxx +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: rngitem.cxx,v $ - * $Revision: 1.12 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include - -#ifndef NUMTYPE - -#define NUMTYPE USHORT -#define SfxXRangeItem SfxRangeItem -#define SfxXRangesItem SfxUShortRangesItem -#include -#include "rngitem_inc.cxx" - -#define NUMTYPE sal_uInt32 -#define SfxXRangeItem SfxULongRangeItem -#define SfxXRangesItem SfxULongRangesItem -#include -#include "rngitem_inc.cxx" - -#else - -// We leave this condition just in case NUMTYPE has been defined externally to this -// file and we are supposed to define the SfxXRangeItem based on that. - -#include "rngitem_inc.cxx" - -#endif - diff --git a/svtools/source/items/rngitem_inc.cxx b/svtools/source/items/rngitem_inc.cxx deleted file mode 100755 index d8cc7ed185ae..000000000000 --- a/svtools/source/items/rngitem_inc.cxx +++ /dev/null @@ -1,243 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: rngitem_inc.cxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// This snippet of code is included by rngitem.cxx but not compiled directly. -// Ugly hack, probably due to lack of templates in the 20th century. - -static inline NUMTYPE Count_Impl(const NUMTYPE * pRanges) -{ - NUMTYPE nCount = 0; - for (; *pRanges; pRanges += 2) nCount += 2; - return nCount; -} - -// ----------------------------------------------------------------------- - -TYPEINIT1_AUTOFACTORY(SfxXRangeItem, SfxPoolItem); -TYPEINIT1_AUTOFACTORY(SfxXRangesItem, SfxPoolItem); - -NUMTYPE Count_Impl( const NUMTYPE *pRanges ); - -// ----------------------------------------------------------------------- - -SfxXRangeItem::SfxXRangeItem() -{ - nFrom = 0; - nTo = 0; -} - -// ----------------------------------------------------------------------- - -SfxXRangeItem::SfxXRangeItem( USHORT which, NUMTYPE from, NUMTYPE to ): - SfxPoolItem( which ), - nFrom( from ), - nTo( to ) -{ -} - - -// ----------------------------------------------------------------------- - -SfxXRangeItem::SfxXRangeItem( USHORT nW, SvStream &rStream ) : - SfxPoolItem( nW ) -{ - rStream >> nFrom; - rStream >> nTo; -} - -// ----------------------------------------------------------------------- - -SfxXRangeItem::SfxXRangeItem( const SfxXRangeItem& rItem ) : - SfxPoolItem( rItem ) -{ - nFrom = rItem.nFrom; - nTo = rItem.nTo; -} - -// ----------------------------------------------------------------------- - -SfxItemPresentation SfxXRangeItem::GetPresentation -( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * -) const -{ - rText = UniString::CreateFromInt64(nFrom); - rText += ':'; - rText += UniString::CreateFromInt64(nTo); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -// ----------------------------------------------------------------------- - -int SfxXRangeItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - SfxXRangeItem* pT = (SfxXRangeItem*)&rItem; - if( nFrom==pT->nFrom && nTo==pT->nTo ) - return 1; - return 0; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxXRangeItem::Clone(SfxItemPool *) const -{ - return new SfxXRangeItem( Which(), nFrom, nTo ); -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxXRangeItem::Create(SvStream &rStream, USHORT) const -{ - NUMTYPE nVon, nBis; - rStream >> nVon; - rStream >> nBis; - return new SfxXRangeItem( Which(), nVon, nBis ); -} - -// ----------------------------------------------------------------------- - -SvStream& SfxXRangeItem::Store(SvStream &rStream, USHORT) const -{ - rStream << nFrom; - rStream << nTo; - return rStream; -} - -//========================================================================= - -SfxXRangesItem::SfxXRangesItem() -: _pRanges(0) -{ -} - -//------------------------------------------------------------------------- - -SfxXRangesItem::SfxXRangesItem( USHORT nWID, const NUMTYPE *pRanges ) -: SfxPoolItem( nWID ) -{ - NUMTYPE nCount = Count_Impl(pRanges) + 1; - _pRanges = new NUMTYPE[nCount]; - memcpy( _pRanges, pRanges, sizeof(NUMTYPE) * nCount ); -} - -//------------------------------------------------------------------------- - -SfxXRangesItem::SfxXRangesItem( USHORT nWID, SvStream &rStream ) -: SfxPoolItem( nWID ) -{ - NUMTYPE nCount; - rStream >> nCount; - _pRanges = new NUMTYPE[nCount + 1]; - for ( NUMTYPE n = 0; n < nCount; ++n ) - rStream >> _pRanges[n]; - _pRanges[nCount] = 0; -} - -//------------------------------------------------------------------------- - -SfxXRangesItem::SfxXRangesItem( const SfxXRangesItem& rItem ) -: SfxPoolItem( rItem ) -{ - NUMTYPE nCount = Count_Impl(rItem._pRanges) + 1; - _pRanges = new NUMTYPE[nCount]; - memcpy( _pRanges, rItem._pRanges, sizeof(NUMTYPE) * nCount ); -} - -//------------------------------------------------------------------------- - -SfxXRangesItem::~SfxXRangesItem() -{ - delete _pRanges; -} - -//------------------------------------------------------------------------- - -int SfxXRangesItem::operator==( const SfxPoolItem &rItem ) const -{ - const SfxXRangesItem &rOther = (const SfxXRangesItem&) rItem; - if ( !_pRanges && !rOther._pRanges ) - return TRUE; - if ( _pRanges || rOther._pRanges ) - return FALSE; - - NUMTYPE n; - for ( n = 0; _pRanges[n] && rOther._pRanges[n]; ++n ) - if ( *_pRanges != rOther._pRanges[n] ) - return 0; - - return !_pRanges[n] && !rOther._pRanges[n]; -} - -//------------------------------------------------------------------------- - -SfxItemPresentation SfxXRangesItem::GetPresentation( SfxItemPresentation /*ePres*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresMetric*/, - XubString &/*rText*/, - const IntlWrapper * ) const -{ - HACK(n. i.) - return SFX_ITEM_PRESENTATION_NONE; -} - -//------------------------------------------------------------------------- - -SfxPoolItem* SfxXRangesItem::Clone( SfxItemPool * ) const -{ - return new SfxXRangesItem( *this ); -} - -//------------------------------------------------------------------------- - -SfxPoolItem* SfxXRangesItem::Create( SvStream &rStream, USHORT ) const -{ - return new SfxXRangesItem( Which(), rStream ); -} - -//------------------------------------------------------------------------- - -SvStream& SfxXRangesItem::Store( SvStream &rStream, USHORT ) const -{ - NUMTYPE nCount = Count_Impl( _pRanges ); - rStream >> nCount; - for ( NUMTYPE n = 0; _pRanges[n]; ++n ) - rStream >> _pRanges[n]; - return rStream; -} - - -#undef NUMTYPE -#undef SfxXRangeItem -#undef SfxXRangesItem diff --git a/svtools/source/items/stritem.cxx b/svtools/source/items/stritem.cxx deleted file mode 100644 index 37968dc3ee1d..000000000000 --- a/svtools/source/items/stritem.cxx +++ /dev/null @@ -1,75 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: stritem.cxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include - -//============================================================================ -// -// class SfxStringItem -// -//============================================================================ - -TYPEINIT1_AUTOFACTORY(SfxStringItem, CntUnencodedStringItem) - -//============================================================================ -// virtual -SfxStringItem::SfxStringItem(USHORT which, SvStream & rStream): - CntUnencodedStringItem(which) -{ - UniString aValue; - readByteString(rStream, aValue); - SetValue(aValue); -} - - -//============================================================================ -// virtual -SfxPoolItem * SfxStringItem::Create(SvStream & rStream, USHORT) const -{ - return new SfxStringItem(Which(), rStream); -} - -//============================================================================ -// virtual -SvStream & SfxStringItem::Store(SvStream & rStream, USHORT) const -{ - writeByteString(rStream, GetValue()); - return rStream; -} - -//============================================================================ -// virtual -SfxPoolItem * SfxStringItem::Clone(SfxItemPool *) const -{ - return new SfxStringItem(*this); -} - diff --git a/svtools/source/items/style.cxx b/svtools/source/items/style.cxx deleted file mode 100644 index ad11f1527ce7..000000000000 --- a/svtools/source/items/style.cxx +++ /dev/null @@ -1,1381 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: style.cxx,v $ - * $Revision: 1.19.60.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#ifndef GCC -#endif - -#define _SVSTDARR_STRINGS -#define _SVSTDARR_STRINGSSORTDTOR -#define _SVSTDARR_BYTESTRINGS -#define _SVSTDARR_BYTESTRINGSSORTDTOR - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#define STYLESTREAM "SfxStyleSheets" -#define STYLESTREAM_VERSION USHORT(50) - -#ifdef DBG_UTIL -class DbgStyleSheetReferences -{ -public: - DbgStyleSheetReferences() : mnStyles(0), mnPools(0) {} - ~DbgStyleSheetReferences() - { - OSL_TRACE("DbgStyleSheetReferences\nSfxStyleSheetBase left %ld\nSfxStyleSheetBasePool left %ld\n", mnStyles, mnPools ); - } - - sal_uInt32 mnStyles; - sal_uInt32 mnPools; -} -aDbgStyleSheetReferences; - -#endif - -TYPEINIT0(SfxStyleSheetBase) - -TYPEINIT3(SfxStyleSheet, SfxStyleSheetBase, SfxListener, SfxBroadcaster) - - -//========================================================================= - -TYPEINIT1(SfxStyleSheetHint, SfxHint); -TYPEINIT1(SfxStyleSheetHintExtended, SfxStyleSheetHint); -TYPEINIT1(SfxStyleSheetPoolHint, SfxHint); - -SfxStyleSheetHintExtended::SfxStyleSheetHintExtended -( - USHORT nAction, // SFX_STYLESHEET_... (s.o.) - const String& rOldName -) -: SfxStyleSheetHint( nAction ), - aName( rOldName ) -{} -SfxStyleSheetHintExtended::SfxStyleSheetHintExtended -( - USHORT nAction, // SFX_STYLESHEET_... (s.o.) - const String& rOldName, - SfxStyleSheetBase& rStyleSheet // geh"ort weiterhin dem Aufrufer -) -: SfxStyleSheetHint( nAction, rStyleSheet ), - aName( rOldName ) -{} - -//------------------------------------------------------------------------- - -SfxStyleSheetHint::SfxStyleSheetHint -( - USHORT nAction, // SFX_STYLESHEET_... (s.o.) - SfxStyleSheetBase& rStyleSheet // geh"ort weiterhin dem Aufrufer -) -: pStyleSh( &rStyleSheet ), - nHint( nAction ) -{} - -SfxStyleSheetHint::SfxStyleSheetHint -( - USHORT nAction // SFX_STYLESHEET_... (s.o.) -) -: pStyleSh( NULL ), - nHint( nAction ) -{} - -//========================================================================= - -class SfxStyleSheetBasePool_Impl -{ - public: - SfxStyles aStyles; - SfxStyleSheetIterator *pIter; - SfxStyleSheetBasePool_Impl() : pIter(0){} - ~SfxStyleSheetBasePool_Impl(){delete pIter;} -}; - - -//////////////////////////// SfxStyleSheetBase /////////////////////////////// - -// Konstruktoren - -SfxStyleSheetBase::SfxStyleSheetBase( const XubString& rName, SfxStyleSheetBasePool& r, SfxStyleFamily eFam, USHORT mask ) - : rPool( r ) - , nFamily( eFam ) - , aName( rName ) - , aParent() - , aFollow( rName ) - , pSet( NULL ) - , nMask(mask) - , nHelpId( 0 ) - , bMySet( FALSE ) -{ -#ifdef DBG_UTIL - aDbgStyleSheetReferences.mnStyles++; -#endif -} - -SfxStyleSheetBase::SfxStyleSheetBase( const SfxStyleSheetBase& r ) - : comphelper::OWeakTypeObject() - , rPool( r.rPool ) - , nFamily( r.nFamily ) - , aName( r.aName ) - , aParent( r.aParent ) - , aFollow( r.aFollow ) - , aHelpFile( r.aHelpFile ) - , nMask( r.nMask ) - , nHelpId( r.nHelpId ) - , bMySet( r.bMySet ) -{ -#ifdef DBG_UTIL - aDbgStyleSheetReferences.mnStyles++; -#endif - if( r.pSet ) - pSet = bMySet ? new SfxItemSet( *r.pSet ) : r.pSet; - else - pSet = NULL; -} - -static SfxStyleSheetBasePool& implGetStaticPool() -{ - static SfxStyleSheetBasePool* pSheetPool = 0; - static SfxItemPool* pBasePool = 0; - if( !pSheetPool ) - { - UniString aName; - pBasePool = new SfxItemPool( aName, 0, 0, 0 ); - pSheetPool = new SfxStyleSheetBasePool(*pBasePool); - } - return *pSheetPool; -} - -SfxStyleSheetBase::SfxStyleSheetBase() -: comphelper::OWeakTypeObject() -, rPool( implGetStaticPool() ) -{ -} - -SfxStyleSheetBase::~SfxStyleSheetBase() -{ -#ifdef DBG_UTIL - --aDbgStyleSheetReferences.mnStyles; -#endif - - if( bMySet ) - { - delete pSet; - pSet = 0; - } -} - -USHORT SfxStyleSheetBase::GetVersion() const -{ - return 0x0000; -} - -// Namen aendern - -const XubString& SfxStyleSheetBase::GetName() const -{ - return aName; -} - -BOOL SfxStyleSheetBase::SetName( const XubString& rName ) -{ - if(rName.Len() == 0) - return FALSE; - if( aName != rName ) - { - String aOldName = aName; - SfxStyleSheetBase *pOther = rPool.Find( rName, nFamily ) ; - if ( pOther && pOther != this ) - return FALSE; - - SfxStyleFamily eTmpFam=rPool.GetSearchFamily(); - USHORT nTmpMask=rPool.GetSearchMask(); - - rPool.SetSearchMask(nFamily); - - if ( aName.Len() ) - rPool.ChangeParent( aName, rName, FALSE ); - if ( aFollow.Equals( aName ) ) - aFollow = rName; - aName = rName; - rPool.SetSearchMask(eTmpFam, nTmpMask); - rPool.Broadcast( SfxStyleSheetHintExtended( - SFX_STYLESHEET_MODIFIED, aOldName, *this ) ); - } - return TRUE; -} - -rtl::OUString SfxStyleSheetBase::GetDisplayName() const -{ - if( maDisplayName.getLength() == 0 ) - { - return aName; - } - else - { - return maDisplayName; - } -} - -void SfxStyleSheetBase::SetDisplayName( const rtl::OUString& rDisplayName ) -{ - maDisplayName = rDisplayName; -} - -// Parent aendern - -const XubString& SfxStyleSheetBase::GetParent() const -{ - return aParent; -} - -BOOL SfxStyleSheetBase::SetParent( const XubString& rName ) -{ - if ( rName == aName ) - return FALSE; - - if( aParent != rName ) - { - SfxStyleSheetBase* pIter = rPool.Find(rName, nFamily); - if( rName.Len() && !pIter ) - { - DBG_ERROR( "StyleSheet-Parent nicht gefunden" ); - return FALSE; - } - // rekursive Verknuepfungen verhindern - if( aName.Len() ) - while(pIter) - { - if(pIter->GetName() == aName && aName != rName) - return FALSE; - pIter = rPool.Find(pIter->GetParent(), nFamily); - } - aParent = rName; - } - rPool.Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED, *this ) ); - return TRUE; -} - -// Follow aendern - -const XubString& SfxStyleSheetBase::GetFollow() const -{ - return aFollow; -} - -BOOL SfxStyleSheetBase::SetFollow( const XubString& rName ) -{ - if( aFollow != rName ) - { - if( !rPool.Find( rName, nFamily ) ) - { - DBG_ERROR( "StyleSheet-Follow nicht gefunden" ); - return FALSE; - } - aFollow = rName; - } - rPool.Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED, *this ) ); - return TRUE; -} - -// Itemset setzen. Die Dflt-Implementation legt ein neues Set an. - -SfxItemSet& SfxStyleSheetBase::GetItemSet() -{ - if( !pSet ) - { - pSet = new SfxItemSet( rPool.GetPool() ); - bMySet = TRUE; - } - return *pSet; -} - -// Hilfe-Datei und -ID setzen und abfragen - -ULONG SfxStyleSheetBase::GetHelpId( String& rFile ) -{ - rFile = aHelpFile; - return nHelpId; -} - -void SfxStyleSheetBase::SetHelpId( const String& rFile, ULONG nId ) -{ - aHelpFile = rFile; - nHelpId = nId; -} - -// Folgevorlage m"oglich? Default: Ja - -BOOL SfxStyleSheetBase::HasFollowSupport() const -{ - return TRUE; -} - -// Basisvorlage m"oglich? Default: Ja - -BOOL SfxStyleSheetBase::HasParentSupport() const -{ - return TRUE; -} - -// Basisvorlage uf NULL setzen m"oglich? Default: Nein - -BOOL SfxStyleSheetBase::HasClearParentSupport() const -{ - return FALSE; -} - -// Defaultmaessig sind alle StyleSheets Used - -BOOL SfxStyleSheetBase::IsUsed() const -{ - return TRUE; -} - -// eingestellte Attribute ausgeben - - -XubString SfxStyleSheetBase::GetDescription() -{ - return GetDescription( SFX_MAPUNIT_CM ); -} - -// eingestellte Attribute ausgeben - -XubString SfxStyleSheetBase::GetDescription( SfxMapUnit eMetric ) -{ - SfxItemIter aIter( GetItemSet() ); - XubString aDesc; - const SfxPoolItem* pItem = aIter.FirstItem(); - - IntlWrapper aIntlWrapper(comphelper::getProcessServiceFactory(), - Application::GetSettings().GetLanguage()); - while ( pItem ) - { - XubString aItemPresentation; - - if ( !IsInvalidItem( pItem ) && - rPool.GetPool().GetPresentation( - *pItem, SFX_ITEM_PRESENTATION_COMPLETE, - eMetric, aItemPresentation, &aIntlWrapper ) ) - { - if ( aDesc.Len() && aItemPresentation.Len() ) - aDesc.AppendAscii(RTL_CONSTASCII_STRINGPARAM(" + ")); - if ( aItemPresentation.Len() ) - aDesc += aItemPresentation; - } - pItem = aIter.NextItem(); - } - return aDesc; -} - -/////////////////////////// SfxStyleSheetIterator /////////////////////////////// - -SfxStyleFamily SfxStyleSheetIterator::GetSearchFamily() const -{ - return nSearchFamily; -} - -inline BOOL SfxStyleSheetIterator::IsTrivialSearch() -{ - return nMask == 0xFFFF && GetSearchFamily() == SFX_STYLE_FAMILY_ALL; -} - -BOOL SfxStyleSheetIterator::DoesStyleMatch(SfxStyleSheetBase *pStyle) -{ - return ((GetSearchFamily() == SFX_STYLE_FAMILY_ALL) || - ( pStyle->GetFamily() == GetSearchFamily() )) - && (( pStyle->GetMask() & ( GetSearchMask() & ~SFXSTYLEBIT_USED )) || - ( bSearchUsed ? pStyle->IsUsed() : FALSE ) || - GetSearchMask() == SFXSTYLEBIT_ALL ); -} - - -SfxStyleSheetIterator::SfxStyleSheetIterator(SfxStyleSheetBasePool *pBase, - SfxStyleFamily eFam, USHORT n) -{ - pBasePool=pBase; - nSearchFamily=eFam; - bSearchUsed=FALSE; - if((n != SFXSTYLEBIT_ALL ) && ((n & SFXSTYLEBIT_USED) == SFXSTYLEBIT_USED)) - { - bSearchUsed = TRUE; - n &= ~SFXSTYLEBIT_USED; - } - nMask=n; -} - -SfxStyleSheetIterator::~SfxStyleSheetIterator() -{ -} - - -USHORT SfxStyleSheetIterator::Count() -{ - USHORT n = 0; - if( IsTrivialSearch()) - n = (USHORT) pBasePool->aStyles.size(); - else - for(USHORT i=0; iaStyles.size(); i++) - { - SfxStyleSheetBase* pStyle = pBasePool->aStyles[i].get(); - if(DoesStyleMatch(pStyle)) - n++; - } - return n; -} - -SfxStyleSheetBase* SfxStyleSheetIterator::operator[](USHORT nIdx) -{ - if( IsTrivialSearch()) - return pBasePool->aStyles[nIdx].get(); - - USHORT z = 0; - for(USHORT n=0; naStyles.size(); n++) - { - SfxStyleSheetBase* pStyle = pBasePool->aStyles[n].get(); - if( DoesStyleMatch(pStyle)) - { - if(z == nIdx) - { - nAktPosition=n; - return pAktStyle=pStyle; - } - ++z; - } - } - DBG_ERROR("falscher Index"); - return 0; -} - -SfxStyleSheetBase* SfxStyleSheetIterator::First() -{ - INT32 nIdx = -1; - - if ( IsTrivialSearch() && pBasePool->aStyles.size() ) - nIdx = 0; - else - for( USHORT n = 0; n < pBasePool->aStyles.size(); n++ ) - { - SfxStyleSheetBase* pStyle = pBasePool->aStyles[n].get(); - - if ( DoesStyleMatch( pStyle ) ) - { - nIdx = n; - break; - } - } - - if ( nIdx != -1 ) - { - nAktPosition = (USHORT)nIdx; - return pAktStyle = pBasePool->aStyles[nIdx].get(); - } - return 0; -} - - -SfxStyleSheetBase* SfxStyleSheetIterator::Next() -{ - INT32 nIdx = -1; - - if ( IsTrivialSearch() && - (USHORT)pBasePool->aStyles.size() > nAktPosition + 1 ) - nIdx = nAktPosition + 1; - else - for( USHORT n = nAktPosition + 1; n < pBasePool->aStyles.size(); n++ ) - { - SfxStyleSheetBase* pStyle = pBasePool->aStyles[n].get(); - - if ( DoesStyleMatch( pStyle ) ) - { - nIdx = n; - break; - } - } - - if ( nIdx != -1 ) - { - nAktPosition = (USHORT)nIdx; - return pAktStyle = pBasePool->aStyles[nIdx].get(); - } - return 0; -} - - -SfxStyleSheetBase* SfxStyleSheetIterator::Find(const XubString& rStr) -{ - for ( USHORT n = 0; n < pBasePool->aStyles.size(); n++ ) - { - SfxStyleSheetBase* pStyle = pBasePool->aStyles[n].get(); - - // #98454# performance: in case of bSearchUsed==TRUE it may be - // significant to first compare the name and only if it matches to call - // the style sheet IsUsed() method in DoesStyleMatch(). - if ( pStyle->GetName().Equals( rStr ) && DoesStyleMatch( pStyle ) ) - { - nAktPosition = n; - return pAktStyle = pStyle; - } - } - return 0; -} - - -USHORT SfxStyleSheetIterator::GetSearchMask() const -{ - USHORT mask = nMask; - - if ( bSearchUsed ) - mask |= SFXSTYLEBIT_USED; - return mask; -} - -/////////////////////////// SfxStyleSheetBasePool /////////////////////////////// - -void SfxStyleSheetBasePool::Replace( - SfxStyleSheetBase& rSource, SfxStyleSheetBase& rTarget ) -{ - rTarget.SetFollow( rSource.GetFollow() ); - rTarget.SetParent( rSource.GetParent() ); - SfxItemSet& rSourceSet = rSource.GetItemSet(); - SfxItemSet& rTargetSet = rTarget.GetItemSet(); - rTargetSet.Intersect( rSourceSet ); - rTargetSet.Put( rSourceSet ); -} - -SfxStyleSheetIterator& SfxStyleSheetBasePool::GetIterator_Impl() -{ - SfxStyleSheetIterator*& rpIter = pImp->pIter; - if( !rpIter || (rpIter->GetSearchMask() != nMask) || (rpIter->GetSearchFamily() != nSearchFamily) ) - { - delete rpIter; - rpIter = CreateIterator( nSearchFamily, nMask ); - } - return *rpIter; -} - - -SfxStyleSheetBasePool::SfxStyleSheetBasePool( SfxItemPool& r ) - : aAppName(r.GetName()) - , rPool(r) - , nSearchFamily(SFX_STYLE_FAMILY_PARA) - , nMask(0xFFFF) -{ -#ifdef DBG_UTIL - aDbgStyleSheetReferences.mnPools++; -#endif - - pImp = new SfxStyleSheetBasePool_Impl; -} - -SfxStyleSheetBasePool::SfxStyleSheetBasePool( const SfxStyleSheetBasePool& r ) - : SfxBroadcaster( r ) - , comphelper::OWeakTypeObject() - , aAppName(r.aAppName) - , rPool(r.rPool) - , nSearchFamily(r.nSearchFamily) - , nMask( r.nMask ) -{ -#ifdef DBG_UTIL - aDbgStyleSheetReferences.mnPools++; -#endif - - pImp = new SfxStyleSheetBasePool_Impl; - *this += r; -} - -SfxStyleSheetBasePool::~SfxStyleSheetBasePool() -{ -#ifdef DBG_UTIL - aDbgStyleSheetReferences.mnPools--; -#endif - - Broadcast( SfxSimpleHint(SFX_HINT_DYING) ); - Clear(); - delete pImp; -} - -BOOL SfxStyleSheetBasePool::SetParent(SfxStyleFamily eFam, const XubString& rStyle, const XubString& rParent) -{ - SfxStyleSheetIterator aIter(this,eFam,SFXSTYLEBIT_ALL); - SfxStyleSheetBase *pStyle = - aIter.Find(rStyle); - DBG_ASSERT(pStyle, "Vorlage nicht gefunden. Writer mit Solar <2541??"); - if(pStyle) - return pStyle->SetParent(rParent); - else - return FALSE; -} - - -void SfxStyleSheetBasePool::SetSearchMask(SfxStyleFamily eFam, USHORT n) -{ - nSearchFamily = eFam; nMask = n; -} - -USHORT SfxStyleSheetBasePool::GetSearchMask() const -{ - return nMask; -} - - -// Der Name des Streams - -String SfxStyleSheetBasePool::GetStreamName() -{ - return String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(STYLESTREAM)); -} - -/////////////////////////////////// Factory //////////////////////////////// - - - -SfxStyleSheetIterator* SfxStyleSheetBasePool::CreateIterator -( - SfxStyleFamily eFam, - USHORT mask -) -{ - return new SfxStyleSheetIterator(this,eFam,mask); -} - - -SfxStyleSheetBase* SfxStyleSheetBasePool::Create -( - const XubString& rName, - SfxStyleFamily eFam, - USHORT mask -) -{ - return new SfxStyleSheetBase( rName, *this, eFam, mask ); -} - -SfxStyleSheetBase* SfxStyleSheetBasePool::Create( const SfxStyleSheetBase& r ) -{ - return new SfxStyleSheetBase( r ); -} - -SfxStyleSheetBase& SfxStyleSheetBasePool::Make( const XubString& rName, SfxStyleFamily eFam, USHORT mask, USHORT nPos) -{ - DBG_ASSERT( eFam != SFX_STYLE_FAMILY_ALL, "svtools::SfxStyleSheetBasePool::Make(), FamilyAll is not a allowed Familie" ); - - SfxStyleSheetIterator aIter(this, eFam, mask); - rtl::Reference< SfxStyleSheetBase > xStyle( aIter.Find( rName ) ); - DBG_ASSERT( !xStyle.is(), "svtools::SfxStyleSheetBasePool::Make(), StyleSheet already exists" ); - SfxStyleSheetIterator& rIter = GetIterator_Impl(); - - if( !xStyle.is() ) - { - xStyle = Create( rName, eFam, mask ); - if(0xffff == nPos || nPos == aStyles.size() || nPos == rIter.Count()) - { - aStyles.push_back( xStyle ); - } - else - { - rIter[nPos]; - aStyles.insert( aStyles.begin() + rIter.GetPos(), xStyle ); - } - Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *xStyle.get() ) ); - } - return *xStyle.get(); -} - -/////////////////////////////// Kopieren /////////////////////////////////// - -// Hilfsroutine: Falls eine Vorlage dieses Namens existiert, wird -// sie neu erzeugt. Alle Vorlagen, die diese Vorlage zum Parent haben, -// werden umgehaengt. - -SfxStyleSheetBase& SfxStyleSheetBasePool::Add( SfxStyleSheetBase& rSheet ) -{ - SfxStyleSheetIterator aIter(this, rSheet.GetFamily(), nMask); - SfxStyleSheetBase* pOld = aIter.Find( rSheet.GetName() ); - Remove( pOld ); - rtl::Reference< SfxStyleSheetBase > xNew( Create( rSheet ) ); - aStyles.push_back( xNew ); - Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CHANGED, *xNew.get() ) ); - return *xNew.get(); -} - -SfxStyleSheetBasePool& SfxStyleSheetBasePool::operator=( const SfxStyleSheetBasePool& r ) -{ - if( &r != this ) - { - Clear(); - *this += r; - } - return *this; -} - -SfxStyleSheetBasePool& SfxStyleSheetBasePool::operator+=( const SfxStyleSheetBasePool& r ) -{ - if( &r != this ) - { - SfxStyles::const_iterator aIter( r.aStyles.begin() ); - while( aIter != r.aStyles.end() ) - { - Add(*(*aIter++).get()); - } - } - return *this; -} - -//////////////////////////////// Suchen //////////////////////////////////// - -USHORT SfxStyleSheetBasePool::Count() -{ - return GetIterator_Impl().Count(); -} - -SfxStyleSheetBase *SfxStyleSheetBasePool::operator[](USHORT nIdx) -{ - return GetIterator_Impl()[nIdx]; -} - -SfxStyleSheetBase* SfxStyleSheetBasePool::Find(const XubString& rName, - SfxStyleFamily eFam, - USHORT mask) -{ - SfxStyleSheetIterator aIter(this,eFam,mask); - return aIter.Find(rName); -} - -const SfxStyles& SfxStyleSheetBasePool::GetStyles() -{ - return aStyles; -} - -SfxStyleSheetBase* SfxStyleSheetBasePool::First() -{ - return GetIterator_Impl().First(); -} - -SfxStyleSheetBase* SfxStyleSheetBasePool::Next() -{ - return GetIterator_Impl().Next(); -} - -//////////////////////////////// Loeschen ///////////////////////////////// - -void SfxStyleSheetBasePool::Remove( SfxStyleSheetBase* p ) -{ - if( p ) - { - SfxStyles::iterator aIter( std::find( aStyles.begin(), aStyles.end(), rtl::Reference< SfxStyleSheetBase >( p ) ) ); - if( aIter != aStyles.end() ) - { - // Alle Styles umsetzen, deren Parent dieser hier ist - ChangeParent( p->GetName(), p->GetParent() ); - aStyles.erase(aIter); - Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *p ) ); - } - } -} - -void SfxStyleSheetBasePool::Insert( SfxStyleSheetBase* p ) -{ - DBG_ASSERT( p, "svtools::SfxStyleSheetBasePool::Insert(), no stylesheet?" ); - - SfxStyleSheetIterator aIter(this, p->GetFamily(), p->GetMask()); - SfxStyleSheetBase* pOld = aIter.Find( p->GetName() ); - DBG_ASSERT( !pOld, "svtools::SfxStyleSheetBasePool::Insert(), StyleSheet already inserted" ); - if( p->GetParent().Len() ) - { - pOld = aIter.Find( p->GetParent() ); - DBG_ASSERT( pOld, "svtools::SfxStyleSheetBasePool::Insert(), Parent not found!" ); - } - aStyles.push_back( rtl::Reference< SfxStyleSheetBase >( p ) ); - Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *p ) ); -} - -void SfxStyleSheetBasePool::Clear() -{ - SfxStyles aClearStyles; - aClearStyles.swap( aStyles ); - - SfxStyles::iterator aIter( aClearStyles.begin() ); - while( aIter != aClearStyles.end() ) - { - Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *(*aIter++).get() ) ); - } -} - -/////////////////////////// Parents umsetzen //////////////////////////////// - -void SfxStyleSheetBasePool::ChangeParent(const XubString& rOld, - const XubString& rNew, - BOOL bVirtual) -{ - const USHORT nTmpMask = GetSearchMask(); - SetSearchMask(GetSearchFamily(), 0xffff); - for( SfxStyleSheetBase* p = First(); p; p = Next() ) - { - if( p->GetParent().Equals( rOld ) ) - { - if(bVirtual) - p->SetParent( rNew ); - else - p->aParent = rNew; - } - } - SetSearchMask(GetSearchFamily(), nTmpMask); -} - -/////////////////////////// Laden/Speichern ///////////////////////////////// - -void SfxStyleSheetBase::Load( SvStream&, USHORT ) -{ -} - -void SfxStyleSheetBase::Store( SvStream& ) -{ -} - - -BOOL SfxStyleSheetBasePool::Load( SvStream& rStream ) -{ - // alte Version? - if ( !rPool.IsVer2_Impl() ) - return Load1_Impl( rStream ); - - // gesamten StyleSheetPool in neuer Version aus einem MiniRecord lesen - SfxMiniRecordReader aPoolRec( &rStream, SFX_STYLES_REC ); - - // Header-Record lesen - short nCharSet = 0; - if ( !rStream.GetError() ) - { - SfxSingleRecordReader aHeaderRec( &rStream, SFX_STYLES_REC_HEADER ); - if ( !aHeaderRec.IsValid() ) - return FALSE; - - aAppName = rPool.GetName(); - rStream >> nCharSet; - } - - // Styles-Record lesen - if ( !rStream.GetError() ) - { - SfxMultiRecordReader aStylesRec( &rStream, SFX_STYLES_REC_STYLES ); - if ( !aStylesRec.IsValid() ) - return FALSE; - - rtl_TextEncoding eEnc = GetSOLoadTextEncoding( - (rtl_TextEncoding)nCharSet, - sal::static_int_cast< USHORT >(rStream.GetVersion()) ); - rtl_TextEncoding eOldEnc = rStream.GetStreamCharSet(); - rStream.SetStreamCharSet( eEnc ); - - USHORT nStyles; - for ( nStyles = 0; aStylesRec.GetContent(); nStyles++ ) - { - // kann nicht mehr weiterlesen? - if ( rStream.GetError() ) - break; - - // Globale Teile - XubString aName, aParent, aFollow; - String aHelpFile; - USHORT nFamily, nStyleMask,nCount; - sal_uInt32 nHelpId; - rStream.ReadByteString(aName, eEnc ); - rStream.ReadByteString(aParent, eEnc ); - rStream.ReadByteString(aFollow, eEnc ); - rStream >> nFamily >> nStyleMask; - SfxPoolItem::readByteString(rStream, aHelpFile); - rStream >> nHelpId; - - SfxStyleSheetBase& rSheet = Make( aName, (SfxStyleFamily)nFamily , nStyleMask); - rSheet.SetHelpId( aHelpFile, nHelpId ); - // Hier erst einmal Parent und Follow zwischenspeichern - rSheet.aParent = aParent; - rSheet.aFollow = aFollow; - UINT32 nPos = rStream.Tell(); - rStream >> nCount; - if(nCount) - { - rStream.Seek( nPos ); - // Das Laden des ItemSets bedient sich der Methode GetItemSet(), - // damit eigene ItemSets untergeschoben werden koennen - SfxItemSet& rSet = rSheet.GetItemSet(); - rSet.ClearItem(); - //! SfxItemSet aTmpSet( *pTmpPool ); - /*!aTmpSet*/ rSet.Load( rStream ); - //! rSet.Put( aTmpSet ); - } - // Lokale Teile - UINT32 nSize; - USHORT nVer; - rStream >> nVer >> nSize; - nPos = rStream.Tell() + nSize; - rSheet.Load( rStream, nVer ); - rStream.Seek( nPos ); - } - - // #72939# only loop through the styles that were really inserted - ULONG n = aStyles.size(); - - //! delete pTmpPool; - // Jetzt Parent und Follow setzen. Alle Sheets sind geladen. - // Mit Setxxx() noch einmal den String eintragen, da diese - // virtuellen Methoden evtl. ueberlagert sind. - for ( ULONG i = 0; i < n; i++ ) - { - SfxStyleSheetBase* p = aStyles[ i ].get(); - XubString aText = p->aParent; - p->aParent.Erase(); - p->SetParent( aText ); - aText = p->aFollow; - p->aFollow.Erase(); - p->SetFollow( aText ); - } - - rStream.SetStreamCharSet( eOldEnc ); - } - - // alles klar? - return BOOL( rStream.GetError() == SVSTREAM_OK ); -} - -BOOL SfxStyleSheetBasePool::Load1_Impl( SvStream& rStream ) -{ - aAppName = rPool.GetName(); - USHORT nVersion; - short nCharSet; - rStream >> nVersion; - - if(nVersion!=STYLESTREAM_VERSION) - nCharSet=nVersion; - else - rStream >> nCharSet; - - rtl_TextEncoding eEnc = GetSOLoadTextEncoding( - (rtl_TextEncoding)nCharSet, - sal::static_int_cast< USHORT >(rStream.GetVersion()) ); - rtl_TextEncoding eOldEnc = rStream.GetStreamCharSet(); - rStream.SetStreamCharSet( eEnc ); - - USHORT nStyles; - rStream >> nStyles; - USHORT i; - for ( i = 0; i < nStyles; i++ ) - { - // kann nicht mehr weiterlesen? - if ( rStream.GetError() ) - { - nStyles = i; - break; - } - - // Globale Teile - XubString aName, aParent, aFollow; - String aHelpFile; - USHORT nFamily, nStyleMask,nCount; - sal_uInt32 nHelpId; - rStream.ReadByteString(aName, eEnc ); - rStream.ReadByteString(aParent, eEnc ); - rStream.ReadByteString(aFollow, eEnc ); - rStream >> nFamily >> nStyleMask; - SfxPoolItem::readByteString(rStream, aHelpFile); - if(nVersion!=STYLESTREAM_VERSION) - { - USHORT nTmpHelpId; - rStream >> nTmpHelpId; - nHelpId=nTmpHelpId; - } - else - rStream >> nHelpId; - - SfxStyleSheetBase& rSheet = Make( aName, (SfxStyleFamily)nFamily , nStyleMask); - rSheet.SetHelpId( aHelpFile, nHelpId ); - // Hier erst einmal Parent und Follow zwischenspeichern - rSheet.aParent = aParent; - rSheet.aFollow = aFollow; - UINT32 nPos = rStream.Tell(); - rStream >> nCount; - if(nCount) { - rStream.Seek( nPos ); - // Das Laden des ItemSets bedient sich der Methode GetItemSet(), - // damit eigene ItemSets untergeschoben werden koennen - SfxItemSet& rSet = rSheet.GetItemSet(); - rSet.ClearItem(); -//! SfxItemSet aTmpSet( *pTmpPool ); - /*!aTmpSet*/ rSet.Load( rStream ); - //! rSet.Put( aTmpSet ); - } - // Lokale Teile - UINT32 nSize; - USHORT nVer; - rStream >> nVer >> nSize; - nPos = rStream.Tell() + nSize; - rSheet.Load( rStream, nVer ); - rStream.Seek( nPos ); - } - - //! delete pTmpPool; - // Jetzt Parent und Follow setzen. Alle Sheets sind geladen. - // Mit Setxxx() noch einmal den String eintragen, da diese - // virtuellen Methoden evtl. ueberlagert sind. - for ( i = 0; i < nStyles; i++ ) - { - SfxStyleSheetBase* p = aStyles[ i ].get(); - XubString aText = p->aParent; - p->aParent.Erase(); - p->SetParent( aText ); - aText = p->aFollow; - p->aFollow.Erase(); - p->SetFollow( aText ); - } - - rStream.SetStreamCharSet( eOldEnc ); - - return BOOL( rStream.GetError() == SVSTREAM_OK ); -} - -BOOL SfxStyleSheetBasePool::Store( SvStream& rStream, BOOL bUsed ) -{ - // den ganzen StyleSheet-Pool in einen Mini-Record - SfxMiniRecordWriter aPoolRec( &rStream, SFX_STYLES_REC ); - - // Erst einmal die Dummies rauszaehlen; die werden nicht gespeichert - USHORT nCount = 0; - for( SfxStyleSheetBase* p = First(); p; p = Next() ) - { - if(!bUsed || p->IsUsed()) - nCount++; - } - - // einen Header-Record vorweg - rtl_TextEncoding eEnc - = ::GetSOStoreTextEncoding( - rStream.GetStreamCharSet(), - sal::static_int_cast< USHORT >(rStream.GetVersion()) ); - rtl_TextEncoding eOldEnc = rStream.GetStreamCharSet(); - rStream.SetStreamCharSet( eEnc ); - - { - SfxSingleRecordWriter aHeaderRec( &rStream, - SFX_STYLES_REC_HEADER, - STYLESTREAM_VERSION ); - rStream << (short) eEnc; - } - - // die StyleSheets in einen MultiVarRecord - { - // Bug 79478: - // make a check loop, to be shure, that the converted names are also - // unique like the originals! In other cases we get a loop. - SvStringsSortDtor aSortOrigNames( 0, 128 ); - SvStrings aOrigNames( 0, 128 ); - SvByteStringsSortDtor aSortConvNames( 0, 128 ); - SvByteStrings aConvNames( 0, 128 ); - - { - - for( SfxStyleSheetBase* p = First(); p; p = Next() ) - { - if(!bUsed || p->IsUsed()) - { - USHORT nFamily = (USHORT)p->GetFamily(); - String* pName = new String( p->GetName() ); - ByteString* pConvName = new ByteString( *pName, eEnc ); - - pName->Insert( (sal_Unicode)nFamily, 0 ); - pConvName->Insert( " ", 0 ); - pConvName->SetChar( - 0, - sal::static_int_cast< char >(0xff & (nFamily >> 8)) ); - pConvName->SetChar( - 1, sal::static_int_cast< char >(0xff & nFamily) ); - - USHORT nInsPos, nAdd = aSortConvNames.Count(); - while( !aSortConvNames.Insert( pConvName, nInsPos ) ) - (pConvName->Append( '_' )).Append( - ByteString::CreateFromInt32( nAdd++ )); - aOrigNames.Insert( pName, nInsPos ); - } - } - - // now we have the list of the names, sorted by convertede names - // But now we need the sorted list of orignames. - { - USHORT nInsPos, nEnd = aOrigNames.Count(); - const ByteStringPtr* ppB = aSortConvNames.GetData(); - for( USHORT n = 0; n < nEnd; ++n, ++ppB ) - { - String* p = aOrigNames.GetObject( n ); - aSortOrigNames.Insert( p, nInsPos ); - aConvNames.Insert( *ppB, nInsPos ); - } - - } - } - - - ByteString sEmpty; - USHORT nFndPos; - String sNm; - SfxMultiVarRecordWriter aStylesRec( &rStream, SFX_STYLES_REC_STYLES, 0 ); - for( SfxStyleSheetBase* p = First(); p; p = Next() ) - { - if(!bUsed || p->IsUsed()) - { - aStylesRec.NewContent(); - - // Globale Teile speichern - String aHelpFile; - sal_uInt32 nHelpId = p->GetHelpId( aHelpFile ); - USHORT nFamily = sal::static_int_cast< USHORT >(p->GetFamily()); - String sFamily( (sal_Unicode)nFamily ); - - (sNm = sFamily) += p->GetName(); - if( aSortOrigNames.Seek_Entry( &sNm, &nFndPos )) - rStream.WriteByteString( aConvNames.GetObject( nFndPos )->Copy( 2 )); - else - rStream.WriteByteString( sEmpty ); - - (sNm = sFamily) += p->GetParent(); - if( aSortOrigNames.Seek_Entry( &sNm, &nFndPos )) - rStream.WriteByteString( aConvNames.GetObject( nFndPos )->Copy( 2 )); - else - rStream.WriteByteString( sEmpty ); - - (sNm = sFamily) += p->GetFollow(); - if( aSortOrigNames.Seek_Entry( &sNm, &nFndPos )) - rStream.WriteByteString( aConvNames.GetObject( nFndPos )->Copy( 2 )); - else - rStream.WriteByteString( sEmpty ); - - rStream << nFamily << p->GetMask(); - SfxPoolItem::writeByteString(rStream, aHelpFile); - rStream << nHelpId; - if(p->pSet) - p->pSet->Store( rStream ); - else - rStream << (USHORT)0; - - // Lokale Teile speichern - // Vor dem lokalen Teil wird die Laenge der lokalen Daten - // als UINT32 sowie die Versionsnummer gespeichert. - rStream << (USHORT) p->GetVersion(); - ULONG nPos1 = rStream.Tell(); - rStream << (UINT32) 0; - p->Store( rStream ); - ULONG nPos2 = rStream.Tell(); - rStream.Seek( nPos1 ); - rStream << (UINT32) ( nPos2 - nPos1 - sizeof( UINT32 ) ); - rStream.Seek( nPos2 ); - if( rStream.GetError() != SVSTREAM_OK ) - break; - } - } - } - - rStream.SetStreamCharSet( eOldEnc ); - - return BOOL( rStream.GetError() == SVSTREAM_OK ); -} - -SfxItemPool& SfxStyleSheetBasePool::GetPool() -{ - return rPool; -} - -const SfxItemPool& SfxStyleSheetBasePool::GetPool() const -{ - return rPool; -} - -/////////////////////// SfxStyleSheet ///////////////////////////////// - -SfxStyleSheet::SfxStyleSheet(const XubString &rName, - const SfxStyleSheetBasePool& r_Pool, - SfxStyleFamily eFam, - USHORT mask ): - SfxStyleSheetBase(rName, const_cast< SfxStyleSheetBasePool& >( r_Pool ), eFam, mask) -{} - -SfxStyleSheet::SfxStyleSheet(const SfxStyleSheet& rStyle) : - SfxStyleSheetBase(rStyle), - SfxListener( rStyle ), - SfxBroadcaster( rStyle ) -{} - -SfxStyleSheet::SfxStyleSheet() -{ -} - -SfxStyleSheet::~SfxStyleSheet() -{ - Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_INDESTRUCTION, *this ) ); -} - - -BOOL SfxStyleSheet::SetParent( const XubString& rName ) -{ - if(aParent == rName) - return TRUE; - const XubString aOldParent(aParent); - if(SfxStyleSheetBase::SetParent(rName)) { - // aus der Benachrichtigungskette des alten - // Parents gfs. austragen - if(aOldParent.Len()) { - SfxStyleSheet *pParent = (SfxStyleSheet *)rPool.Find(aOldParent, nFamily, 0xffff); - if(pParent) - EndListening(*pParent); - } - // in die Benachrichtigungskette des neuen - // Parents eintragen - if(aParent.Len()) { - SfxStyleSheet *pParent = (SfxStyleSheet *)rPool.Find(aParent, nFamily, 0xffff); - if(pParent) - StartListening(*pParent); - } - return TRUE; - } - return FALSE; -} - -// alle Zuhoerer benachtichtigen - -void SfxStyleSheet::Notify(SfxBroadcaster& rBC, const SfxHint& rHint ) -{ - Forward(rBC, rHint); -} - -//////////////////////// SfxStyleSheetPool /////////////////////////////// - -SfxStyleSheetPool::SfxStyleSheetPool( SfxItemPool const& rSet) -: SfxStyleSheetBasePool( const_cast< SfxItemPool& >( rSet ) ) -{ -} - -/////////////////////////////////// Factory //////////////////////////////// - -SfxStyleSheetBase* SfxStyleSheetPool::Create( const XubString& rName, - SfxStyleFamily eFam, USHORT mask ) -{ - return new SfxStyleSheet( rName, *this, eFam, mask ); -} - -SfxStyleSheetBase* SfxStyleSheetPool::Create( const SfxStyleSheet& r ) -{ - return new SfxStyleSheet( r ); -} -/* -BOOL SfxStyleSheetPool::CopyTo(SfxStyleSheetPool &, const String &) -{ - return FALSE; -} -*/ - -// -------------------------------------------------------------------- -// class SfxUnoStyleSheet -// -------------------------------------------------------------------- - -SfxUnoStyleSheet::SfxUnoStyleSheet( const UniString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, USHORT _nMaske ) -: ::cppu::ImplInheritanceHelper2< SfxStyleSheet, ::com::sun::star::style::XStyle, ::com::sun::star::lang::XUnoTunnel >( _rName, _rPool, _eFamily, _nMaske ) -{ -} - -// -------------------------------------------------------------------- -SfxUnoStyleSheet::SfxUnoStyleSheet( const SfxStyleSheet& _rSheet ) -: ::cppu::ImplInheritanceHelper2< SfxStyleSheet, ::com::sun::star::style::XStyle, ::com::sun::star::lang::XUnoTunnel >( _rSheet ) -{ -} - -// -------------------------------------------------------------------- - -SfxUnoStyleSheet* SfxUnoStyleSheet::getUnoStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >& xStyle ) -{ - SfxUnoStyleSheet* pRet = dynamic_cast< SfxUnoStyleSheet* >( xStyle.get() ); - if( !pRet ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUT( xStyle, ::com::sun::star::uno::UNO_QUERY ); - if( xUT.is() ) - pRet = reinterpret_cast(sal::static_int_cast(xUT->getSomething( SfxUnoStyleSheet::getIdentifier()))); - } - return pRet; -} - -// -------------------------------------------------------------------- -// XUnoTunnel -// -------------------------------------------------------------------- - -::sal_Int64 SAL_CALL SfxUnoStyleSheet::getSomething( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& rId ) throw (::com::sun::star::uno::RuntimeException) -{ - if( rId.getLength() == 16 && 0 == rtl_compareMemory( getIdentifier().getConstArray(), rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast(reinterpret_cast(this)); - } - else - { - return 0; - } -} - -// -------------------------------------------------------------------- - -const ::com::sun::star::uno::Sequence< ::sal_Int8 >& SfxUnoStyleSheet::getIdentifier() -{ - static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0; - if( !pSeq ) - { - ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); - if( !pSeq ) - { - static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 ); - rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); - pSeq = &aSeq; - } - } - return *pSeq; -} - -// -------------------------------------------------------------------- diff --git a/svtools/source/items/szitem.cxx b/svtools/source/items/szitem.cxx deleted file mode 100644 index ec3ff83dd2ec..000000000000 --- a/svtools/source/items/szitem.cxx +++ /dev/null @@ -1,214 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: szitem.cxx,v $ - * $Revision: 1.11 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include -#include -#include -#include -#include - -#include -#include "memberid.hrc" - -// STATIC DATA ----------------------------------------------------------- - -DBG_NAME(SfxSizeItem) - -// ----------------------------------------------------------------------- - -TYPEINIT1_AUTOFACTORY(SfxSizeItem, SfxPoolItem); - -// ----------------------------------------------------------------------- - -SfxSizeItem::SfxSizeItem() -{ - DBG_CTOR(SfxSizeItem, 0); -} - -// ----------------------------------------------------------------------- - -SfxSizeItem::SfxSizeItem( USHORT nW, const Size& rVal ) : - SfxPoolItem( nW ), - aVal( rVal ) -{ - DBG_CTOR(SfxSizeItem, 0); -} - -// ----------------------------------------------------------------------- - -SfxSizeItem::SfxSizeItem( USHORT nW, SvStream &rStream ) : - SfxPoolItem( nW ) -{ - DBG_CTOR(SfxSizeItem, 0); - rStream >> aVal; -} - -// ----------------------------------------------------------------------- - -SfxSizeItem::SfxSizeItem( const SfxSizeItem& rItem ) : - SfxPoolItem( rItem ), - aVal( rItem.aVal ) -{ - DBG_CTOR(SfxSizeItem, 0); -} - -// ----------------------------------------------------------------------- - -SfxItemPresentation SfxSizeItem::GetPresentation -( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * -) const -{ - DBG_CHKTHIS(SfxSizeItem, 0); - rText = UniString::CreateFromInt32(aVal.Width()); - rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); - rText += UniString::CreateFromInt32(aVal.Height()); - rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -// ----------------------------------------------------------------------- - -int SfxSizeItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS(SfxSizeItem, 0); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - return ((SfxSizeItem&)rItem).aVal == aVal; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxSizeItem::Clone(SfxItemPool *) const -{ - DBG_CHKTHIS(SfxSizeItem, 0); - return new SfxSizeItem( *this ); -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxSizeItem::Create(SvStream &rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxSizeItem, 0); - Size aStr; - rStream >> aStr; - return new SfxSizeItem(Which(), aStr); -} - -// ----------------------------------------------------------------------- - -SvStream& SfxSizeItem::Store(SvStream &rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxSizeItem, 0); - rStream << aVal; - return rStream; -} - -// ----------------------------------------------------------------------- -BOOL SfxSizeItem::QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId ) const -{ - sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - - Size aTmp(aVal); - if( bConvert ) - { - aTmp.Height() = ( aTmp.Height() * 127 + 36) / 72; - aTmp.Width() = ( aTmp.Width() * 127 + 36) / 72; - } - - switch ( nMemberId ) - { - case 0: - { - rVal <<= com::sun::star::awt::Size( aTmp.getWidth(), aTmp.getHeight() ); - break; - } - case MID_WIDTH: - rVal <<= aTmp.getWidth(); break; - case MID_HEIGHT: - rVal <<= aTmp.getHeight(); break; - default: DBG_ERROR("Wrong MemberId!"); return FALSE; - } - - return TRUE; -} - -// ----------------------------------------------------------------------- -BOOL SfxSizeItem::PutValue( const com::sun::star::uno::Any& rVal, - BYTE nMemberId ) -{ - sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); - nMemberId &= ~CONVERT_TWIPS; - - BOOL bRet = FALSE; - com::sun::star::awt::Size aValue; - sal_Int32 nVal = 0; - if ( !nMemberId ) - bRet = ( rVal >>= aValue ); - else - { - bRet = ( rVal >>= nVal ); - if ( nMemberId == MID_WIDTH ) - { - aValue.Width = nVal; - aValue.Height = aVal.Height(); - } - else - { - aValue.Height = nVal; - aValue.Width = aVal.Width(); - } - } - - if ( bRet ) - { - Size aTmp( aValue.Width, aValue.Height ); - if( bConvert ) - { - aTmp.Height() = ( aTmp.Height() * 72 + 63) / 127; - aTmp.Width() = ( aTmp.Width() * 72 + 63) / 127; - } - - aVal = aTmp; - } - - return bRet; -} - - - diff --git a/svtools/source/items/wallitem.cxx b/svtools/source/items/wallitem.cxx deleted file mode 100644 index 32797f69a48c..000000000000 --- a/svtools/source/items/wallitem.cxx +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: wallitem.cxx,v $ - * $Revision: 1.10 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "wallitem.hxx" -#include - -// ----------------------------------------------------------------------- - -//static -void SfxBrushItemLink::Set( SfxBrushItemLink* pLink ) -{ - SfxBrushItemLink** ppLink = (SfxBrushItemLink**)GetAppData(SHL_BRUSHITEM); - if( !*ppLink ) - *ppLink = pLink; - else - delete pLink; -} - diff --git a/svtools/source/items1/bintitem.cxx b/svtools/source/items1/bintitem.cxx deleted file mode 100644 index a3b6c1c2b54d..000000000000 --- a/svtools/source/items1/bintitem.cxx +++ /dev/null @@ -1,169 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: bintitem.cxx,v $ - * $Revision: 1.8 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -#include -#include -#include - -// STATIC DATA - -DBG_NAME(SfxBigIntItem) - -// RTTI -TYPEINIT1_AUTOFACTORY(SfxBigIntItem, SfxPoolItem); - -// SfxBigIntItem - -//============================================================================ -SfxBigIntItem::SfxBigIntItem() - : SfxPoolItem(0), - aVal(0) -{ - DBG_CTOR(SfxBigIntItem, 0); -} - -//============================================================================ -SfxBigIntItem::SfxBigIntItem(USHORT which, const BigInt& rValue) - : SfxPoolItem(which), - aVal(rValue) -{ - DBG_CTOR(SfxBigIntItem, 0); -} - -//============================================================================ -SfxBigIntItem::SfxBigIntItem(USHORT which, SvStream &rStream) - : SfxPoolItem(which) -{ - DBG_CTOR(SfxBigIntItem, 0); - ByteString sTmp; - rStream.ReadByteString(sTmp); - BigInt aTmp(sTmp); - aVal = aTmp; -} - -//============================================================================ -SfxBigIntItem::SfxBigIntItem(const SfxBigIntItem& rItem) - : SfxPoolItem(rItem), - aVal(rItem.aVal) -{ - DBG_CTOR(SfxBigIntItem, 0); -} - -//============================================================================ -SfxItemPresentation SfxBigIntItem::GetPresentation( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * ) const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - rText = aVal.GetString(); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -//============================================================================ -int SfxBigIntItem::operator==(const SfxPoolItem& rItem) const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - DBG_ASSERT(SfxPoolItem::operator==(rItem), "unequal type"); - return ((SfxBigIntItem&)rItem).aVal == aVal; -} - -//============================================================================ -int SfxBigIntItem::Compare(const SfxPoolItem& rItem) const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - DBG_ASSERT(SfxPoolItem::operator==(rItem), "unequal type"); - - if (((const SfxBigIntItem&)rItem ).aVal < aVal ) - return -1; - else if (((const SfxBigIntItem&)rItem ).aVal == aVal) - return 0; - else - return 1; -} - -//============================================================================ -SfxPoolItem* SfxBigIntItem::Clone(SfxItemPool *) const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - return new SfxBigIntItem(*this); -} - -//============================================================================ -SfxPoolItem* SfxBigIntItem::Create(SvStream &rStream, USHORT) const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - return new SfxBigIntItem(Which(), rStream); -} - -//============================================================================ -SvStream& SfxBigIntItem::Store(SvStream &rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - rStream.WriteByteString( aVal.GetByteString() ); - return rStream; -} - -//============================================================================ -SfxFieldUnit SfxBigIntItem::GetUnit() const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - return SFX_FUNIT_NONE; -} - -//============================================================================ -// virtual -BOOL SfxBigIntItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE ) -{ - double aValue = 0.0; - if ( rVal >>= aValue ) - { - SetValue( aValue ); - return TRUE; - } - - DBG_ERROR( "SfxBigIntItem::PutValue - Wrong type!" ); - return FALSE; -} - -//============================================================================ -// virtual -BOOL SfxBigIntItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE ) const -{ - double aValue = GetValue(); - rVal <<= aValue; - return TRUE; -} - diff --git a/svtools/source/items1/cenumitm.cxx b/svtools/source/items1/cenumitm.cxx deleted file mode 100644 index 1906e62a8cf8..000000000000 --- a/svtools/source/items1/cenumitm.cxx +++ /dev/null @@ -1,297 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: cenumitm.cxx,v $ - * $Revision: 1.9 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -#include -#include -#include - -#ifndef _CPPUHELPER_EXTRACT_HXX_ -#include -#endif - -//============================================================================ -// -// class SfxEnumItemInterface -// -//============================================================================ - -DBG_NAME(SfxEnumItemInterface) - -//============================================================================ -TYPEINIT1(SfxEnumItemInterface, SfxPoolItem) - -//============================================================================ -// virtual -int SfxEnumItemInterface::operator ==(const SfxPoolItem & rItem) const -{ - SFX_ASSERT(SfxPoolItem::operator ==(rItem), Which(), "unequal type"); - return GetEnumValue() - == static_cast< const SfxEnumItemInterface * >(&rItem)-> - GetEnumValue(); -} - -//============================================================================ -// virtual -SfxItemPresentation -SfxEnumItemInterface::GetPresentation(SfxItemPresentation, SfxMapUnit, - SfxMapUnit, XubString & rText, - const IntlWrapper *) const -{ - rText = XubString::CreateFromInt32(GetEnumValue()); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -//============================================================================ -// virtual -BOOL SfxEnumItemInterface::QueryValue(com::sun::star::uno::Any& rVal, BYTE) - const -{ - rVal <<= sal_Int32(GetEnumValue()); - return true; -} - -//============================================================================ -// virtual -BOOL SfxEnumItemInterface::PutValue(const com::sun::star::uno::Any& rVal, - BYTE) -{ - sal_Int32 nTheValue = 0; - - if ( ::cppu::enum2int( nTheValue, rVal ) ) - { - SetEnumValue(USHORT(nTheValue)); - return true; - } - DBG_ERROR("SfxEnumItemInterface::PutValue(): Wrong type"); - return false; -} - -//============================================================================ -XubString SfxEnumItemInterface::GetValueTextByPos(USHORT) const -{ - DBG_WARNING("SfxEnumItemInterface::GetValueTextByPos(): Pure virtual"); - return XubString(); -} - -//============================================================================ -// virtual -USHORT SfxEnumItemInterface::GetValueByPos(USHORT nPos) const -{ - return nPos; -} - -//============================================================================ -// virtual -USHORT SfxEnumItemInterface::GetPosByValue(USHORT nValue) const -{ - USHORT nCount = GetValueCount(); - for (USHORT i = 0; i < nCount; ++i) - if (GetValueByPos(i) == nValue) - return i; - return USHRT_MAX; -} - -BOOL SfxEnumItemInterface::IsEnabled(USHORT) const -{ - return TRUE; -} - -//============================================================================ -// virtual -int SfxEnumItemInterface::HasBoolValue() const -{ - return false; -} - -//============================================================================ -// virtual -BOOL SfxEnumItemInterface::GetBoolValue() const -{ - return false; -} - -//============================================================================ -// virtual -void SfxEnumItemInterface::SetBoolValue(BOOL) -{} - -//============================================================================ -// -// class CntEnumItem -// -//============================================================================ - -DBG_NAME(CntEnumItem) - -//============================================================================ -CntEnumItem::CntEnumItem(USHORT which, SvStream & rStream): - SfxEnumItemInterface(which) -{ - m_nValue = 0; - rStream >> m_nValue; -} - -//============================================================================ -TYPEINIT1(CntEnumItem, SfxEnumItemInterface) - -//============================================================================ -// virtual -SvStream & CntEnumItem::Store(SvStream & rStream, USHORT) const -{ - rStream << m_nValue; - return rStream; -} - -//============================================================================ -// virtual -USHORT CntEnumItem::GetEnumValue() const -{ - return GetValue(); -} - -//============================================================================ -// virtual -void CntEnumItem::SetEnumValue(USHORT nTheValue) -{ - SetValue(nTheValue); -} - -//============================================================================ -// -// class CntBoolItem -// -//============================================================================ - -DBG_NAME(CntBoolItem) - -//============================================================================ -TYPEINIT1_AUTOFACTORY(CntBoolItem, SfxPoolItem) - -//============================================================================ -CntBoolItem::CntBoolItem(USHORT which, SvStream & rStream): - SfxPoolItem(which) -{ - m_bValue = false; - rStream >> m_bValue; -} - -//============================================================================ -// virtual -int CntBoolItem::operator ==(const SfxPoolItem & rItem) const -{ - DBG_ASSERT(rItem.ISA(CntBoolItem), - "CntBoolItem::operator ==(): Bad type"); - return m_bValue == static_cast< CntBoolItem const * >(&rItem)->m_bValue; -} - -//============================================================================ -// virtual -int CntBoolItem::Compare(const SfxPoolItem & rWith) const -{ - DBG_ASSERT(rWith.ISA(CntBoolItem), "CntBoolItem::Compare(): Bad type"); - return m_bValue == static_cast< CntBoolItem const * >(&rWith)->m_bValue ? - 0 : m_bValue ? -1 : 1; -} - -//============================================================================ -// virtual -SfxItemPresentation CntBoolItem::GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, - UniString & rText, - const IntlWrapper *) const -{ - rText = GetValueTextByVal(m_bValue); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -//============================================================================ -// virtual -BOOL CntBoolItem::QueryValue(com::sun::star::uno::Any& rVal, BYTE) const -{ - rVal <<= sal_Bool(m_bValue); - return true; -} - -//============================================================================ -// virtual -BOOL CntBoolItem::PutValue(const com::sun::star::uno::Any& rVal, BYTE) -{ - sal_Bool bTheValue = sal_Bool(); - if (rVal >>= bTheValue) - { - m_bValue = bTheValue; - return true; - } - DBG_ERROR("CntBoolItem::PutValue(): Wrong type"); - return false; -} - -//============================================================================ -// virtual -SfxPoolItem * CntBoolItem::Create(SvStream & rStream, USHORT) const -{ - return new CntBoolItem(Which(), rStream); -} - -//============================================================================ -// virtual -SvStream & CntBoolItem::Store(SvStream & rStream, USHORT) const -{ - rStream << m_bValue; - return rStream; -} - -//============================================================================ -// virtual -SfxPoolItem * CntBoolItem::Clone(SfxItemPool *) const -{ - return new CntBoolItem(*this); -} - -//============================================================================ -// virtual -USHORT CntBoolItem::GetValueCount() const -{ - return 2; -} - -//============================================================================ -// virtual -UniString CntBoolItem::GetValueTextByVal(BOOL bTheValue) const -{ - return - bTheValue ? - UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("TRUE")) : - UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("FALSE")); -} - diff --git a/svtools/source/items1/cintitem.cxx b/svtools/source/items1/cintitem.cxx deleted file mode 100644 index 97cce9b75591..000000000000 --- a/svtools/source/items1/cintitem.cxx +++ /dev/null @@ -1,565 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: cintitem.cxx,v $ - * $Revision: 1.10 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -#include -#include - -//============================================================================ -// -// class CntByteItem -// -//============================================================================ - -DBG_NAME(CntByteItem) - -//============================================================================ -TYPEINIT1_AUTOFACTORY(CntByteItem, SfxPoolItem); - -//============================================================================ -CntByteItem::CntByteItem(USHORT which, SvStream & rStream): - SfxPoolItem(which) -{ - DBG_CTOR(CntByteItem, 0); - rStream >> m_nValue; -} - -//============================================================================ -// virtual -int CntByteItem::operator ==(const SfxPoolItem & rItem) const -{ - DBG_CHKTHIS(CntByteItem, 0); - DBG_ASSERT(rItem.ISA(CntByteItem), - "CntByteItem::operator ==(): Bad type"); - return m_nValue == SAL_STATIC_CAST(const CntByteItem *, &rItem)->m_nValue; -} - -//============================================================================ -// virtual -int CntByteItem::Compare(const SfxPoolItem & rWith) const -{ - DBG_CHKTHIS(CntByteItem, 0); - DBG_ASSERT(rWith.ISA(CntByteItem), "CntByteItem::Compare(): Bad type"); - return SAL_STATIC_CAST(const CntByteItem *, &rWith)->m_nValue < m_nValue ? - -1 : - SAL_STATIC_CAST(const CntByteItem *, &rWith)->m_nValue - == m_nValue ? - 0 : 1; -} - -//============================================================================ -// virtual -SfxItemPresentation CntByteItem::GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, - XubString & rText, - const IntlWrapper *) const -{ - DBG_CHKTHIS(CntByteItem, 0); - rText = XubString::CreateFromInt32(m_nValue); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -//============================================================================ -// virtual -BOOL CntByteItem::QueryValue(com::sun::star::uno::Any& rVal,BYTE) const -{ - sal_Int8 nValue = m_nValue; - rVal <<= nValue; - return TRUE; -} - -//============================================================================ -// virtual -BOOL CntByteItem::PutValue(const com::sun::star::uno::Any& rVal,BYTE) -{ - sal_Int8 nValue = sal_Int8(); - if (rVal >>= nValue) - { - m_nValue = nValue; - return TRUE; - } - - DBG_ERROR( "CntByteItem::PutValue - Wrong type!" ); - return FALSE; -} - -//============================================================================ -// virtual -SfxPoolItem * CntByteItem::Create(SvStream & rStream, USHORT) const -{ - DBG_CHKTHIS(CntByteItem, 0); - short nTheValue = 0; - rStream >> nTheValue; - return new CntByteItem(Which(), BYTE(nTheValue)); -} - -//============================================================================ -// virtual -SvStream & CntByteItem::Store(SvStream & rStream, USHORT) const -{ - DBG_CHKTHIS(CntByteItem, 0); - rStream << short(m_nValue); - return rStream; -} - -//============================================================================ -// virtual -SfxPoolItem * CntByteItem::Clone(SfxItemPool *) const -{ - DBG_CHKTHIS(CntByteItem, 0); - return new CntByteItem(*this); -} - -//============================================================================ -// virtual -BYTE CntByteItem::GetMin() const -{ - DBG_CHKTHIS(CntByteItem, 0); - return 0; -} - -//============================================================================ -// virtual -BYTE CntByteItem::GetMax() const -{ - DBG_CHKTHIS(CntByteItem, 0); - return 255; -} - -//============================================================================ -// virtual -SfxFieldUnit CntByteItem::GetUnit() const -{ - DBG_CHKTHIS(CntByteItem, 0); - return SFX_FUNIT_NONE; -} - -//============================================================================ -// -// class CntUInt16Item -// -//============================================================================ - -DBG_NAME(CntUInt16Item); - -//============================================================================ -TYPEINIT1_AUTOFACTORY(CntUInt16Item, SfxPoolItem); - -//============================================================================ -CntUInt16Item::CntUInt16Item(USHORT which, SvStream & rStream) : - SfxPoolItem(which) -{ - DBG_CTOR(CntUInt16Item, 0); - USHORT nTheValue = 0; - rStream >> nTheValue; - m_nValue = nTheValue; -} - -//============================================================================ -// virtual -int CntUInt16Item::operator ==(const SfxPoolItem & rItem) const -{ - DBG_CHKTHIS(CntUInt16Item, 0); - DBG_ASSERT(rItem.ISA(CntUInt16Item), - "CntUInt16Item::operator ==(): Bad type"); - return m_nValue == SAL_STATIC_CAST(const CntUInt16Item *, &rItem)-> - m_nValue; -} - -//============================================================================ -// virtual -int CntUInt16Item::Compare(const SfxPoolItem & rWith) const -{ - DBG_CHKTHIS(CntUInt16Item, 0); - DBG_ASSERT(rWith.ISA(CntUInt16Item), - "CntUInt16Item::Compare(): Bad type"); - return SAL_STATIC_CAST(const CntUInt16Item *, &rWith)->m_nValue - < m_nValue ? - -1 : - SAL_STATIC_CAST(const CntUInt16Item *, &rWith)->m_nValue - == m_nValue ? - 0 : 1; -} - -//============================================================================ -// virtual -SfxItemPresentation CntUInt16Item::GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, - XubString & rText, - const IntlWrapper *) - const -{ - DBG_CHKTHIS(CntUInt16Item, 0); - rText = XubString::CreateFromInt32(m_nValue); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -//============================================================================ -// virtual -BOOL CntUInt16Item::QueryValue(com::sun::star::uno::Any& rVal,BYTE) const -{ - sal_Int32 nValue = m_nValue; - rVal <<= nValue; - return TRUE; -} - -//============================================================================ -// virtual -BOOL CntUInt16Item::PutValue(const com::sun::star::uno::Any& rVal,BYTE) -{ - sal_Int32 nValue = 0; - if (rVal >>= nValue) - { - DBG_ASSERT( nValue <= USHRT_MAX, "Overflow in UInt16 value!"); - m_nValue = (sal_uInt16)nValue; - return TRUE; - } - - DBG_ERROR( "CntUInt16Item::PutValue - Wrong type!" ); - return FALSE; -} - -//============================================================================ -// virtual -SfxPoolItem * CntUInt16Item::Create(SvStream & rStream, USHORT) const -{ - DBG_CHKTHIS(CntUInt16Item, 0); - return new CntUInt16Item(Which(), rStream); -} - -//============================================================================ -// virtual -SvStream & CntUInt16Item::Store(SvStream &rStream, USHORT) const -{ - DBG_CHKTHIS(CntUInt16Item, 0); - rStream << USHORT(m_nValue); - return rStream; -} - -//============================================================================ -// virtual -SfxPoolItem * CntUInt16Item::Clone(SfxItemPool *) const -{ - DBG_CHKTHIS(CntUInt16Item, 0); - return new CntUInt16Item(*this); -} - -//============================================================================ -// virtual -UINT16 CntUInt16Item::GetMin() const -{ - DBG_CHKTHIS(CntUInt16Item, 0); - return 0; -} - -//============================================================================ -// virtual -UINT16 CntUInt16Item::GetMax() const -{ - DBG_CHKTHIS(CntUInt16Item, 0); - return 65535; -} - -//============================================================================ -// virtual -SfxFieldUnit CntUInt16Item::GetUnit() const -{ - DBG_CHKTHIS(CntUInt16Item, 0); - return SFX_FUNIT_NONE; -} - -//============================================================================ -// -// class CntInt32Item -// -//============================================================================ - -DBG_NAME(CntInt32Item); - -//============================================================================ -TYPEINIT1_AUTOFACTORY(CntInt32Item, SfxPoolItem); - -//============================================================================ -CntInt32Item::CntInt32Item(USHORT which, SvStream & rStream) : - SfxPoolItem(which) -{ - DBG_CTOR(CntInt32Item, 0); - long nTheValue = 0; - rStream >> nTheValue; - m_nValue = nTheValue; -} - -//============================================================================ -// virtual -int CntInt32Item::operator ==(const SfxPoolItem & rItem) const -{ - DBG_CHKTHIS(CntInt32Item, 0); - DBG_ASSERT(rItem.ISA(CntInt32Item), - "CntInt32Item::operator ==(): Bad type"); - return m_nValue == SAL_STATIC_CAST(const CntInt32Item *, &rItem)-> - m_nValue; -} - -//============================================================================ -// virtual -int CntInt32Item::Compare(const SfxPoolItem & rWith) const -{ - DBG_CHKTHIS(CntInt32Item, 0); - DBG_ASSERT(rWith.ISA(CntInt32Item), "CntInt32Item::Compare(): Bad type"); - return SAL_STATIC_CAST(const CntInt32Item *, &rWith)->m_nValue - < m_nValue ? - -1 : - SAL_STATIC_CAST(const CntInt32Item *, &rWith)->m_nValue - == m_nValue ? - 0 : 1; -} - -//============================================================================ -// virtual -SfxItemPresentation CntInt32Item::GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, - XubString & rText, - const IntlWrapper *) const -{ - DBG_CHKTHIS(CntInt32Item, 0); - rText = XubString::CreateFromInt32(m_nValue); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -//============================================================================ -// virtual -BOOL CntInt32Item::QueryValue(com::sun::star::uno::Any& rVal,BYTE) const -{ - sal_Int32 nValue = m_nValue; - rVal <<= nValue; - return TRUE; -} - -//============================================================================ -// virtual -BOOL CntInt32Item::PutValue(const com::sun::star::uno::Any& rVal,BYTE) -{ - sal_Int32 nValue = 0; - if (rVal >>= nValue) - { - m_nValue = nValue; - return TRUE; - } - - DBG_ERROR( "CntInt32Item::PutValue - Wrong type!" ); - return FALSE; -} - -//============================================================================ -// virtual -SfxPoolItem * CntInt32Item::Create(SvStream & rStream, USHORT) const -{ - DBG_CHKTHIS(CntInt32Item, 0); - return new CntInt32Item(Which(), rStream); -} - -//============================================================================ -// virtual -SvStream & CntInt32Item::Store(SvStream &rStream, USHORT) const -{ - DBG_CHKTHIS(CntInt32Item, 0); - rStream << long(m_nValue); - return rStream; -} - -//============================================================================ -// virtual -SfxPoolItem * CntInt32Item::Clone(SfxItemPool *) const -{ - DBG_CHKTHIS(CntInt32Item, 0); - return new CntInt32Item(*this); -} - -//============================================================================ -// virtual -INT32 CntInt32Item::GetMin() const -{ - DBG_CHKTHIS(CntInt32Item, 0); - return INT32(0x80000000); -} - -//============================================================================ -// virtual -INT32 CntInt32Item::GetMax() const -{ - DBG_CHKTHIS(CntInt32Item, 0); - return 0x7FFFFFFF; -} - -//============================================================================ -// virtual -SfxFieldUnit CntInt32Item::GetUnit() const -{ - DBG_CHKTHIS(CntInt32Item, 0); - return SFX_FUNIT_NONE; -} - -//============================================================================ -// -// class CntUInt32Item -// -//============================================================================ - -DBG_NAME(CntUInt32Item); - -//============================================================================ -TYPEINIT1_AUTOFACTORY(CntUInt32Item, SfxPoolItem); - -//============================================================================ -CntUInt32Item::CntUInt32Item(USHORT which, SvStream & rStream) : - SfxPoolItem(which) -{ - DBG_CTOR(CntUInt32Item, 0); - sal_uInt32 nTheValue = 0; - rStream >> nTheValue; - m_nValue = nTheValue; -} - -//============================================================================ -// virtual -int CntUInt32Item::operator ==(const SfxPoolItem & rItem) const -{ - DBG_CHKTHIS(CntUInt32Item, 0); - DBG_ASSERT(rItem.ISA(CntUInt32Item), - "CntUInt32Item::operator ==(): Bad type"); - return m_nValue == SAL_STATIC_CAST(const CntUInt32Item *, &rItem)-> - m_nValue; -} - -//============================================================================ -// virtual -int CntUInt32Item::Compare(const SfxPoolItem & rWith) const -{ - DBG_CHKTHIS(CntUInt32Item, 0); - DBG_ASSERT(rWith.ISA(CntUInt32Item), - "CntUInt32Item::operator ==(): Bad type"); - return SAL_STATIC_CAST(const CntUInt32Item *, &rWith)->m_nValue - < m_nValue ? - -1 : - SAL_STATIC_CAST(const CntUInt32Item *, &rWith)->m_nValue - == m_nValue ? - 0 : 1; -} - -//============================================================================ -// virtual -SfxItemPresentation CntUInt32Item::GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, - XubString & rText, - const IntlWrapper *) - const -{ - DBG_CHKTHIS(CntUInt32Item, 0); - rText = XubString::CreateFromInt64(m_nValue); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -//============================================================================ -// virtual -BOOL CntUInt32Item::QueryValue(com::sun::star::uno::Any& rVal,BYTE) const -{ - sal_Int32 nValue = m_nValue; - DBG_ASSERT( nValue>=0, "Overflow in UInt32 value!"); - rVal <<= nValue; - return TRUE; -} - -//============================================================================ -// virtual -BOOL CntUInt32Item::PutValue(const com::sun::star::uno::Any& rVal,BYTE) -{ - sal_Int32 nValue = 0; - if (rVal >>= nValue) - { - DBG_ASSERT( nValue>=0, "Overflow in UInt32 value!"); - m_nValue = nValue; - return TRUE; - } - - DBG_ERROR( "CntUInt32Item::PutValue - Wrong type!" ); - return FALSE; -} - -//============================================================================ -// virtual -SfxPoolItem * CntUInt32Item::Create(SvStream & rStream, USHORT) const -{ - DBG_CHKTHIS(CntUInt32Item, 0); - return new CntUInt32Item(Which(), rStream); -} - -//============================================================================ -// virtual -SvStream & CntUInt32Item::Store(SvStream &rStream, USHORT) const -{ - DBG_CHKTHIS(CntUInt32Item, 0); - rStream << static_cast(m_nValue); - return rStream; -} - -//============================================================================ -// virtual -SfxPoolItem * CntUInt32Item::Clone(SfxItemPool *) const -{ - DBG_CHKTHIS(CntUInt32Item, 0); - return new CntUInt32Item(*this); -} - -//============================================================================ -// virtual -UINT32 CntUInt32Item::GetMin() const -{ - DBG_CHKTHIS(CntUInt32Item, 0); - return 0; -} - -//============================================================================ -// virtual -UINT32 CntUInt32Item::GetMax() const -{ - DBG_CHKTHIS(CntUInt32Item, 0); - return 0xFFFFFFFF; -} - -//============================================================================ -// virtual -SfxFieldUnit CntUInt32Item::GetUnit() const -{ - DBG_CHKTHIS(CntUInt32Item, 0); - return SFX_FUNIT_NONE; -} - diff --git a/svtools/source/items1/cntwall.cxx b/svtools/source/items1/cntwall.cxx deleted file mode 100644 index 67e9387fbe26..000000000000 --- a/svtools/source/items1/cntwall.cxx +++ /dev/null @@ -1,170 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: cntwall.cxx,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include -#include -#include -#include - -#include - -#define CNTWALLPAPERITEM_STREAM_MAGIC ( (UINT32)0xfefefefe ) -#define CNTWALLPAPERITEM_STREAM_SEEKREL (-( (long)( sizeof( UINT32 ) ) ) ) - -TYPEINIT1( CntWallpaperItem, SfxPoolItem ); - -// ----------------------------------------------------------------------- -CntWallpaperItem::CntWallpaperItem( USHORT which ) - : SfxPoolItem( which ), _nColor( COL_TRANSPARENT ), _nStyle( 0 ) -{ -} - -// ----------------------------------------------------------------------- -CntWallpaperItem::CntWallpaperItem( USHORT which, SvStream& rStream, USHORT nVersion ) - : SfxPoolItem( which ), _nColor( COL_TRANSPARENT ), _nStyle( 0 ) -{ - UINT32 nMagic = 0; - rStream >> nMagic; - if ( nMagic == CNTWALLPAPERITEM_STREAM_MAGIC ) - { - // Okay, data were stored by CntWallpaperItem. - - readUnicodeString(rStream, _aURL, nVersion >= 1); - // !!! Color stream operators do not work - they discard any - // transparency info !!! - _nColor.Read( rStream, TRUE ); - rStream >> _nStyle; - } - else - { - rStream.SeekRel( CNTWALLPAPERITEM_STREAM_SEEKREL ); - - // Data were stored by SfxWallpaperItem ( SO < 6.0 ). The only - // thing we can do here is to get the URL and to position the stream. - - { - // "Read" Wallpaper member - The version compat object positions - // the stream after the wallpaper data in its dtor. We must use - // this trick here as no VCL must be used here ( No Wallpaper - // object allowed ). - VersionCompat aCompat( rStream, STREAM_READ ); - } - - // Read SfxWallpaperItem's string member _aURL. - readUnicodeString(rStream, _aURL, false); - - // "Read" SfxWallpaperItem's string member _aFilter. - ByteString aDummy; - rStream.ReadByteString(aDummy); - } -} - -// ----------------------------------------------------------------------- -CntWallpaperItem::CntWallpaperItem( const CntWallpaperItem& rItem ) : - SfxPoolItem( rItem ), - _aURL( rItem._aURL ), - _nColor( rItem._nColor ), - _nStyle( rItem._nStyle ) -{ -} - -// ----------------------------------------------------------------------- -CntWallpaperItem::~CntWallpaperItem() -{ -} - -// ----------------------------------------------------------------------- -int CntWallpaperItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - const CntWallpaperItem& rWallItem = (const CntWallpaperItem&)rItem; - - if( ( rWallItem._nStyle == _nStyle ) && - ( rWallItem._nColor == _nColor ) && - ( rWallItem._aURL == _aURL ) ) - return TRUE; - else - return FALSE; -} - -//============================================================================ -// virtual -USHORT CntWallpaperItem::GetVersion(USHORT) const -{ - return 1; // because it uses SfxPoolItem::read/writeUnicodeString() -} - -// ----------------------------------------------------------------------- -SfxPoolItem* CntWallpaperItem::Create( SvStream& rStream, USHORT nVersion) const -{ - return new CntWallpaperItem( Which(), rStream, nVersion ); -} - -// ----------------------------------------------------------------------- -SvStream& CntWallpaperItem::Store( SvStream& rStream, USHORT ) const -{ - rStream << CNTWALLPAPERITEM_STREAM_MAGIC; - writeUnicodeString(rStream, _aURL); - // !!! Color stream operators do not work - they discard any - // transparency info !!! - // ??? Why the hell Color::Write(...) isn't const ??? - SAL_CONST_CAST( CntWallpaperItem*, this )->_nColor.Write( rStream, TRUE ); - rStream << _nStyle; - - return rStream; -} - -// ----------------------------------------------------------------------- -SfxPoolItem* CntWallpaperItem::Clone( SfxItemPool* ) const -{ - return new CntWallpaperItem( *this ); -} - -//---------------------------------------------------------------------------- -// virtual -BOOL CntWallpaperItem::QueryValue( com::sun::star::uno::Any&,BYTE ) const -{ - DBG_ERROR("Not implemented!"); - return FALSE; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL CntWallpaperItem::PutValue( const com::sun::star::uno::Any&,BYTE ) -{ - DBG_ERROR("Not implemented!"); - return FALSE; -} - - diff --git a/svtools/source/items1/cstitem.cxx b/svtools/source/items1/cstitem.cxx deleted file mode 100644 index 9755f4bb9944..000000000000 --- a/svtools/source/items1/cstitem.cxx +++ /dev/null @@ -1,252 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: cstitem.cxx,v $ - * $Revision: 1.9 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include - -#include - -#include -#include -#include - -#include -#include - -#include -#include - -DBG_NAME( SfxCrawlStatusItem ) -TYPEINIT1( SfxCrawlStatusItem, SfxPoolItem ); - -// ----------------------------------------------------------------------- - -SfxCrawlStatusItem::SfxCrawlStatusItem( USHORT which ) : - SfxPoolItem( which ) -{ - DBG_CTOR( SfxCrawlStatusItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxCrawlStatusItem::SfxCrawlStatusItem( USHORT which, CrawlStatus eStat ) : - SfxPoolItem( which ), - eStatus( eStat ) -{ - DBG_CTOR( SfxCrawlStatusItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxCrawlStatusItem::SfxCrawlStatusItem( const SfxCrawlStatusItem& rItem ) : - SfxPoolItem( rItem ), - eStatus( rItem.eStatus ) -{ - DBG_CTOR( SfxCrawlStatusItem, 0 ); -} - -// ----------------------------------------------------------------------- - -int SfxCrawlStatusItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS( SfxCrawlStatusItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - return ((SfxCrawlStatusItem&)rItem).eStatus == eStatus; -} - -// ----------------------------------------------------------------------- - -int SfxCrawlStatusItem::Compare( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS( SfxCrawlStatusItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - if( ((const SfxCrawlStatusItem&)rItem).eStatus < eStatus ) - return -1; - else if( ((const SfxCrawlStatusItem&)rItem).eStatus == eStatus ) - return 0; - else - return 1; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxCrawlStatusItem::Create( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxCrawlStatusItem, 0); - - USHORT _eStatus; - rStream >> _eStatus; - - return new SfxCrawlStatusItem( Which(), (CrawlStatus)_eStatus ); -} - -// ----------------------------------------------------------------------- - -SvStream& SfxCrawlStatusItem::Store( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS( SfxCrawlStatusItem, 0 ); - - USHORT nStatus = (USHORT)eStatus; - rStream << (USHORT) nStatus; - - return rStream; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxCrawlStatusItem::Clone( SfxItemPool* ) const -{ - DBG_CHKTHIS( SfxCrawlStatusItem, 0 ); - return new SfxCrawlStatusItem( *this ); -} -// ----------------------------------------------------------------------- - -SfxItemPresentation SfxCrawlStatusItem::GetPresentation -( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * pIntlWrapper -) const -{ - DBG_CHKTHIS(SfxCrawlStatusItem, 0); - DBG_ASSERT(pIntlWrapper, - "SfxCrawlStatusItem::GetPresentation():" - " Using default IntlWrapper"); - - ::com::sun::star::lang::Locale aLocale; - - switch (eStatus) - { - case CSTAT_NEVER_UPD: - rText = String(SvtResId(STR_CSTAT_NEVER_UPD, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_IN_UPD: - rText = String(SvtResId(STR_CSTAT_IN_UPD, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_UPD_NEWER: - rText = String(SvtResId(STR_CSTAT_UPD_NEWER, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_UPD_NOT_NEWER: - rText = String(SvtResId(STR_CSTAT_UPD_NOT_NEWER, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_UPD_CANCEL: - rText = String(SvtResId(STR_CSTAT_UPD_CANCEL, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_ERR_GENERAL: - rText = String(SvtResId(STR_CSTAT_ERR_GENERAL, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_ERR_NOTEXISTS: - rText = String(SvtResId(STR_CSTAT_ERR_NOTEXISTS, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_ERR_NOTREACHED: - rText = String(SvtResId(STR_CSTAT_ERR_NOTREACHED, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_UPD_IMMEDIATELY: - rText = String(SvtResId(STR_CSTAT_UPD_IMMEDIATELY, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_ERR_OFFLINE: - rText = String(SvtResId(STR_CSTAT_ERR_OFFLINE, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - default: - rText.Erase(); - break; - } - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL SfxCrawlStatusItem::PutValue( const com::sun::star::uno::Any& rVal,BYTE ) -{ - sal_Int16 aValue = sal_Int16(); - if ( rVal >>= aValue ) - { - SetStatus( static_cast< CrawlStatus >( aValue ) ); - return TRUE; - } - - DBG_ERROR( "SfxCrawlStatusItem::PutValue - Wrong type!" ); - return FALSE; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL SfxCrawlStatusItem::QueryValue( com::sun::star::uno::Any& rVal,BYTE ) const -{ - sal_Int16 aValue = sal::static_int_cast< sal_Int16 >(GetStatus()); - rVal <<= aValue; - return TRUE; -} - diff --git a/svtools/source/items1/cstitem.src b/svtools/source/items1/cstitem.src deleted file mode 100644 index 8d6e2d0280c0..000000000000 --- a/svtools/source/items1/cstitem.src +++ /dev/null @@ -1,112 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: cstitem.src,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -String STR_CSTAT_NEVER_UPD -{ - Text [ en-US ] = "No update has occurred" ; -}; -String STR_CSTAT_IN_UPD -{ - Text [ en-US ] = "Updating in progress" ; -}; -String STR_CSTAT_UPD_NEWER -{ - Text [ en-US ] = "Changes discovered" ; -}; -String STR_CSTAT_UPD_NOT_NEWER -{ - Text [ en-US ] = "No changes discovered" ; -}; -String STR_CSTAT_UPD_CANCEL -{ - Text [ en-US ] = "Canceled by user" ; -}; -String STR_CSTAT_UPD_IMMEDIATELY -{ - Text [ en-US ] = "Updating immediately" ; -}; -String STR_CSTAT_ERR_OFFLINE -{ - Text [ en-US ] = "failed, you have not been online" ; -}; -String STR_CSTAT_ERR_GENERAL -{ - Text [ en-US ] = "General error" ; -}; -String STR_CSTAT_ERR_NOTEXISTS -{ - Text [ en-US ] = "Server does not exist" ; -}; -String STR_CSTAT_ERR_NOTREACHED -{ - Text [ en-US ] = "Server not available" ; -}; -String STR_COLUM_DT_AUTO -{ - Text [ en-US ] = "automatic" ; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svtools/source/items1/ctypeitm.cxx b/svtools/source/items1/ctypeitm.cxx deleted file mode 100644 index 552d4a6a9041..000000000000 --- a/svtools/source/items1/ctypeitm.cxx +++ /dev/null @@ -1,254 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ctypeitm.cxx,v $ - * $Revision: 1.7.136.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include - -#include -#include -#include - -//============================================================================ -// The following defines are copied from chaos/source/items/cstritem.cxx: -#define CNTSTRINGITEM_STREAM_MAGIC ( (UINT32)0xfefefefe ) -#define CNTSTRINGITEM_STREAM_SEEKREL (-( (long)( sizeof( UINT32 ) ) ) ) - -//============================================================================ -// -// class CntContentTypeItem Implementation. -// -//============================================================================ - -TYPEINIT1_AUTOFACTORY( CntContentTypeItem, CntUnencodedStringItem ); - -#define CONTENT_TYPE_NOT_INIT ( (INetContentType)-1 ) - -//---------------------------------------------------------------------------- -CntContentTypeItem::CntContentTypeItem() -: CntUnencodedStringItem(), - _eType( CONTENT_TYPE_NOT_INIT ) -{ -} - -//---------------------------------------------------------------------------- -CntContentTypeItem::CntContentTypeItem( USHORT which, const XubString& rType ) -: CntUnencodedStringItem( which, rType ), - _eType( CONTENT_TYPE_NOT_INIT ) -{ -} - -//---------------------------------------------------------------------------- -CntContentTypeItem::CntContentTypeItem( USHORT which, - const INetContentType eType ) -: CntUnencodedStringItem( which, INetContentTypes::GetContentType( eType ) ), - _eType( eType ) -{ -} - -//---------------------------------------------------------------------------- -CntContentTypeItem::CntContentTypeItem( const CntContentTypeItem& rOrig ) -: CntUnencodedStringItem( rOrig ), - _eType( rOrig._eType ), - _aPresentation( rOrig._aPresentation ) -{ -} - -//============================================================================ -// virtual -USHORT CntContentTypeItem::GetVersion(USHORT) const -{ - return 1; // because it uses SfxPoolItem::read/writeUnicodeString() -} - -//---------------------------------------------------------------------------- -// virtual -SfxPoolItem* CntContentTypeItem::Create( SvStream& rStream, - USHORT nItemVersion ) const -{ - // CntContentTypeItem used to be derived from CntStringItem, so take that - // into account: - UniString aValue; - readUnicodeString(rStream, aValue, nItemVersion >= 1); - UINT32 nMagic = 0; - rStream >> nMagic; - if (nMagic == CNTSTRINGITEM_STREAM_MAGIC) - { - BOOL bEncrypted = FALSE; - rStream >> bEncrypted; - DBG_ASSERT(!bEncrypted, - "CntContentTypeItem::Create() reads encrypted data"); - } - else - rStream.SeekRel(CNTSTRINGITEM_STREAM_SEEKREL); - - return new CntContentTypeItem(Which(), aValue); -} - -//---------------------------------------------------------------------------- -// virtual -SvStream & CntContentTypeItem::Store(SvStream & rStream, USHORT) const -{ - // CntContentTypeItem used to be derived from CntStringItem, so take that - // into account: - writeUnicodeString(rStream, GetValue()); - rStream << CNTSTRINGITEM_STREAM_MAGIC << BOOL(FALSE); - return rStream; -} - -//---------------------------------------------------------------------------- -// virtual -int CntContentTypeItem::operator==( const SfxPoolItem& rOrig ) const -{ - const CntContentTypeItem& rOther = (const CntContentTypeItem&)rOrig; - - if ( ( _eType != CONTENT_TYPE_NOT_INIT ) && - ( rOther._eType != CONTENT_TYPE_NOT_INIT ) ) - return _eType == rOther._eType; - else - return CntUnencodedStringItem::operator==( rOther ); -} - -//---------------------------------------------------------------------------- -// virtual -SfxPoolItem* CntContentTypeItem::Clone( SfxItemPool* /* pPool */ ) const -{ - return new CntContentTypeItem( *this ); -} - -//---------------------------------------------------------------------------- -void CntContentTypeItem::SetValue( const XubString& rNewVal ) -{ - // De-initialize enum type and presentation. - _eType = CONTENT_TYPE_NOT_INIT; - _aPresentation.Erase(); - - CntUnencodedStringItem::SetValue( rNewVal ); -} - -//---------------------------------------------------------------------------- -void CntContentTypeItem::SetPresentation( const XubString& rNewVal ) -{ - _aPresentation = rNewVal; -} - -//---------------------------------------------------------------------------- -int CntContentTypeItem::Compare( const SfxPoolItem &rWith, const IntlWrapper& rIntlWrapper ) const -{ - String aOwnText, aWithText; - GetPresentation( SFX_ITEM_PRESENTATION_NAMELESS, - SFX_MAPUNIT_APPFONT, SFX_MAPUNIT_APPFONT, aOwnText, &rIntlWrapper ); - rWith.GetPresentation( SFX_ITEM_PRESENTATION_NAMELESS, - SFX_MAPUNIT_APPFONT, SFX_MAPUNIT_APPFONT, aWithText, &rIntlWrapper ); - return rIntlWrapper.getCollator()->compareString( aOwnText, aWithText ); -} - -//---------------------------------------------------------------------------- -SfxItemPresentation CntContentTypeItem::GetPresentation( - SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString & rText, - const IntlWrapper * pIntlWrapper) const -{ - if (_aPresentation.Len() == 0) - { - DBG_ASSERT(pIntlWrapper, - "CntContentTypeItem::GetPresentation(): No IntlWrapper"); - if (pIntlWrapper) - SAL_CONST_CAST(CntContentTypeItem *, this)->_aPresentation - = INetContentTypes::GetPresentation(GetEnumValue(), - pIntlWrapper-> - getLocale()); - } - if (_aPresentation.Len() > 0) - { - rText = _aPresentation; - return SFX_ITEM_PRESENTATION_COMPLETE; - } - else - return CntUnencodedStringItem::GetPresentation(ePres, eCoreMetric, - ePresMetric, rText, - pIntlWrapper); -} - -//---------------------------------------------------------------------------- -INetContentType CntContentTypeItem::GetEnumValue() const -{ - if ( _eType == CONTENT_TYPE_NOT_INIT ) - { - // Not yet initialized... Get enum value for string content type. - - CntContentTypeItem* pVarThis = SAL_CONST_CAST( CntContentTypeItem*, this ); - - pVarThis->_eType = INetContentTypes::GetContentType( GetValue() ); - } - - return _eType; -} - -//---------------------------------------------------------------------------- -void CntContentTypeItem::SetValue( const INetContentType eType ) -{ - SetValue( INetContentTypes::GetContentType( eType ) ); - - // Note: SetValue( const String& ....) resets _eType. Set new enum value - // after(!) calling it. - _eType = eType; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL CntContentTypeItem::QueryValue( com::sun::star::uno::Any& rVal,BYTE ) const -{ - rVal <<= rtl::OUString(GetValue()); - return true; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL CntContentTypeItem::PutValue( const com::sun::star::uno::Any& rVal,BYTE ) -{ - rtl::OUString aValue; - if ( rVal >>= aValue ) - { - // SetValue with an empty string resets the item; so call that - // function when PutValue is called with an empty string - if (aValue.getLength() == 0) - SetValue(aValue); - else - SetValue( - INetContentTypes::RegisterContentType(aValue, UniString())); - return true; - } - - DBG_ERROR( "CntContentTypeItem::PutValue - Wrong type!" ); - return false; -} diff --git a/svtools/source/items1/custritm.cxx b/svtools/source/items1/custritm.cxx deleted file mode 100644 index 9f573beb56fd..000000000000 --- a/svtools/source/items1/custritm.cxx +++ /dev/null @@ -1,141 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: custritm.cxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include - -#include -#include -#include - -//============================================================================ -// -// class CntUnencodedStringItem -// -//============================================================================ - -DBG_NAME(CntUnencodedStringItem) - -//============================================================================ -TYPEINIT1_AUTOFACTORY(CntUnencodedStringItem, SfxPoolItem) - -//============================================================================ -// virtual -int CntUnencodedStringItem::operator ==(const SfxPoolItem & rItem) const -{ - DBG_CHKTHIS(CntUnencodedStringItem, 0); - DBG_ASSERT(rItem.ISA(CntUnencodedStringItem), - "CntUnencodedStringItem::operator ==(): Bad type"); - return m_aValue - == SAL_STATIC_CAST(const CntUnencodedStringItem *, &rItem)-> - m_aValue; -} - -//============================================================================ -// virtual -int CntUnencodedStringItem::Compare(SfxPoolItem const & rWith) const -{ - DBG_ERROR("CntUnencodedStringItem::Compare(): No international"); - DBG_CHKTHIS(CntUnencodedStringItem, 0); - DBG_ASSERT(rWith.ISA(CntUnencodedStringItem), - "CntUnencodedStringItem::Compare(): Bad type"); - switch (m_aValue.CompareTo(static_cast< CntUnencodedStringItem const * >( - &rWith)-> - m_aValue)) - { - case COMPARE_LESS: - return -1; - - case COMPARE_EQUAL: - return 0; - - default: // COMPARE_GREATER - return 1; - } -} - -//============================================================================ -// virtual -int CntUnencodedStringItem::Compare(SfxPoolItem const & rWith, - IntlWrapper const & rIntlWrapper) - const -{ - DBG_CHKTHIS(CntUnencodedStringItem, 0); - DBG_ASSERT(rWith.ISA(CntUnencodedStringItem), - "CntUnencodedStringItem::Compare(): Bad type"); - return rIntlWrapper.getCollator()->compareString( m_aValue, - static_cast< CntUnencodedStringItem const * >(&rWith)->m_aValue ); -} - -//============================================================================ -// virtual -SfxItemPresentation -CntUnencodedStringItem::GetPresentation(SfxItemPresentation, SfxMapUnit, - SfxMapUnit, XubString & rText, - const IntlWrapper *) const -{ - DBG_CHKTHIS(CntUnencodedStringItem, 0); - rText = m_aValue; - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -//============================================================================ -// virtual -BOOL CntUnencodedStringItem::QueryValue(com::sun::star::uno::Any& rVal, BYTE) - const -{ - rVal <<= rtl::OUString(m_aValue); - return true; -} - -//============================================================================ -// virtual -BOOL CntUnencodedStringItem::PutValue(const com::sun::star::uno::Any& rVal, - BYTE) -{ - rtl::OUString aTheValue; - if (rVal >>= aTheValue) - { - m_aValue = UniString(aTheValue); - return true; - } - DBG_ERROR("CntUnencodedStringItem::PutValue(): Wrong type"); - return false; -} - -//============================================================================ -// virtual -SfxPoolItem * CntUnencodedStringItem::Clone(SfxItemPool *) const -{ - DBG_CHKTHIS(CntUnencodedStringItem, 0); - return new CntUnencodedStringItem(*this); -} - diff --git a/svtools/source/items1/dateitem.cxx b/svtools/source/items1/dateitem.cxx deleted file mode 100644 index 4ba6e1d460f9..000000000000 --- a/svtools/source/items1/dateitem.cxx +++ /dev/null @@ -1,284 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: dateitem.cxx,v $ - * $Revision: 1.8 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -// include --------------------------------------------------------------- - -#define _DATETIMEITEM_CXX -#include - -#include -#include - - -#include -#include -#include -#include -#include -#include - - -#include - -#include -#include - -// STATIC DATA ----------------------------------------------------------- - -DBG_NAME(SfxDateTimeItem) - - -// ----------------------------------------------------------------------- - -TYPEINIT1(SfxDateTimeItem, SfxPoolItem); - -// ----------------------------------------------------------------------- - -SfxDateTimeItem::SfxDateTimeItem( USHORT which ) : - SfxPoolItem( which ) -{ - DBG_CTOR(SfxDateTimeItem, 0); -} - -// ----------------------------------------------------------------------- - -SfxDateTimeItem::SfxDateTimeItem( USHORT which, const DateTime& rDT ) : - SfxPoolItem( which ), - aDateTime( rDT ) - -{ - DBG_CTOR(SfxDateTimeItem, 0); -} - -// ----------------------------------------------------------------------- - -SfxDateTimeItem::SfxDateTimeItem( const SfxDateTimeItem& rItem ) : - SfxPoolItem( rItem ), - aDateTime( rItem.aDateTime ) -{ - DBG_CTOR(SfxDateTimeItem, 0); -} - -// ----------------------------------------------------------------------- - -int SfxDateTimeItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS(SfxDateTimeItem, 0); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - return ( ( (SfxDateTimeItem&)rItem ).aDateTime == aDateTime ); -} - -// ----------------------------------------------------------------------- - -int SfxDateTimeItem::Compare( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS(SfxDateTimeItem, 0); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - // da X.Compare( Y ) am String einem Compare( Y, X ) entspricht, - // vergleichen wir hier Y mit X - if ( ( (const SfxDateTimeItem&)rItem ).aDateTime < aDateTime ) - return -1; - else if ( ( (const SfxDateTimeItem&)rItem ).aDateTime == aDateTime ) - return 0; - else - return 1; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxDateTimeItem::Create( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxDateTimeItem, 0); - sal_uInt32 nDate = 0; - sal_Int32 nTime = 0; - rStream >> nDate; - rStream >> nTime; - DateTime aDT(nDate, nTime); - return new SfxDateTimeItem( Which(), aDT ); -} - -// ----------------------------------------------------------------------- - -SvStream& SfxDateTimeItem::Store( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxDateTimeItem, 0); - rStream << aDateTime.GetDate(); - rStream << aDateTime.GetTime(); - return rStream; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxDateTimeItem::Clone( SfxItemPool* ) const -{ - DBG_CHKTHIS(SfxDateTimeItem, 0); - return new SfxDateTimeItem( *this ); -} - -// ----------------------------------------------------------------------- - -SfxItemPresentation SfxDateTimeItem::GetPresentation -( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * pIntlWrapper -) const -{ - DBG_CHKTHIS(SfxDateTimeItem, 0); - if (aDateTime.IsValid()) - if (pIntlWrapper) - { - rText = pIntlWrapper->getLocaleData()->getDate(aDateTime); - rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); - rText += pIntlWrapper->getLocaleData()->getTime(aDateTime); - } - else - { - DBG_WARNING("SfxDateTimeItem::GetPresentation():" - " Using default en_US IntlWrapper"); - const IntlWrapper aIntlWrapper( - ::comphelper::getProcessServiceFactory(), LANGUAGE_ENGLISH_US ); - rText = aIntlWrapper.getLocaleData()->getDate(aDateTime); - rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); - rText += aIntlWrapper.getLocaleData()->getTime(aDateTime); - } - else - rText.Erase(); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL SfxDateTimeItem::PutValue( const com::sun::star::uno::Any& rVal, - BYTE nMemberId ) -{ - nMemberId &= ~CONVERT_TWIPS; - com::sun::star::util::DateTime aValue; - if ( rVal >>= aValue ) - { - aDateTime = DateTime( Date( aValue.Day, - aValue.Month, - aValue.Year ), - Time( aValue.Hours, - aValue.Minutes, - aValue.Seconds, - aValue.HundredthSeconds ) ); - return TRUE; - } - - DBG_ERROR( "SfxDateTimeItem::PutValue - Wrong type!" ); - return FALSE; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL SfxDateTimeItem::QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId ) const -{ - nMemberId &= ~CONVERT_TWIPS; - com::sun::star::util::DateTime aValue( aDateTime.Get100Sec(), - aDateTime.GetSec(), - aDateTime.GetMin(), - aDateTime.GetHour(), - aDateTime.GetDay(), - aDateTime.GetMonth(), - aDateTime.GetYear() ); - rVal <<= aValue; - return TRUE; -} - -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- - -TYPEINIT1(SfxColumnDateTimeItem, SfxDateTimeItem); - - -SfxColumnDateTimeItem::SfxColumnDateTimeItem( USHORT which ) : - SfxDateTimeItem( which ) -{} - -SfxColumnDateTimeItem::SfxColumnDateTimeItem( USHORT which, const DateTime& rDT ) : - SfxDateTimeItem( which, rDT ) -{} - -SfxColumnDateTimeItem::SfxColumnDateTimeItem( const SfxDateTimeItem& rCpy ) : - SfxDateTimeItem( rCpy ) -{} - -SfxPoolItem* SfxColumnDateTimeItem::Clone( SfxItemPool* ) const -{ - return new SfxColumnDateTimeItem( *this ); -} - -SfxItemPresentation SfxColumnDateTimeItem::GetPresentation -( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * pIntlWrapper -) const -{ - DBG_ASSERT(pIntlWrapper, - "SfxColumnDateTimeItem::GetPresentation():" - " Using default en_US IntlWrapper"); - - ::com::sun::star::lang::Locale aLocale; - if (GetDateTime() == DateTime(Date(1, 2, 3), Time(3, 2, 1))) - rText = String(SvtResId(STR_COLUM_DT_AUTO, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - else if (pIntlWrapper) - { - rText = pIntlWrapper->getLocaleData()->getDate(GetDateTime()); - rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); - rText += pIntlWrapper->getLocaleData()->getTime(GetDateTime()); - } - else - { - const IntlWrapper aIntlWrapper( - ::comphelper::getProcessServiceFactory(), LANGUAGE_ENGLISH_US ); - rText = aIntlWrapper.getLocaleData()->getDate(GetDateTime()); - rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); - rText += aIntlWrapper.getLocaleData()->getTime(GetDateTime()); - } - return SFX_ITEM_PRESENTATION_NAMELESS; -} - - - diff --git a/svtools/source/items1/dtritem.cxx b/svtools/source/items1/dtritem.cxx deleted file mode 100644 index fa3a36b762f5..000000000000 --- a/svtools/source/items1/dtritem.cxx +++ /dev/null @@ -1,244 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: dtritem.cxx,v $ - * $Revision: 1.8 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include - -#include - - -DBG_NAME( SfxDateTimeRangeItem ) -TYPEINIT1( SfxDateTimeRangeItem, SfxPoolItem ); - -// ----------------------------------------------------------------------- - -SfxDateTimeRangeItem::SfxDateTimeRangeItem( USHORT which ) : - SfxPoolItem( which ) -{ - DBG_CTOR( SfxDateTimeRangeItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxDateTimeRangeItem::SfxDateTimeRangeItem( USHORT which, const DateTime& rStartDT, - const DateTime& rEndDT ) : - SfxPoolItem( which ), - aStartDateTime( rStartDT ), - aEndDateTime( rEndDT ) -{ - DBG_CTOR( SfxDateTimeRangeItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxDateTimeRangeItem::SfxDateTimeRangeItem( const SfxDateTimeRangeItem& rItem ) : - SfxPoolItem( rItem ), - aStartDateTime( rItem.aStartDateTime ), - aEndDateTime( rItem.aEndDateTime ) -{ - DBG_CTOR( SfxDateTimeRangeItem, 0 ); -} - -// ----------------------------------------------------------------------- - -int SfxDateTimeRangeItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS( SfxDateTimeRangeItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - return ((SfxDateTimeRangeItem&)rItem ).aStartDateTime == aStartDateTime && - ((SfxDateTimeRangeItem&)rItem ).aEndDateTime == aEndDateTime; -} - -// ----------------------------------------------------------------------- - -int SfxDateTimeRangeItem::Compare( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS( SfxDateTimeRangeItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - double fThisRange = aEndDateTime - aStartDateTime; - double fRange = ((const SfxDateTimeRangeItem&)rItem).aEndDateTime - - ((const SfxDateTimeRangeItem&)rItem).aStartDateTime; - - if ( ::rtl::math::approxEqual( fRange, fThisRange ) ) - return 0; - else if ( fRange < fThisRange ) - return -1; - else - return 1; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxDateTimeRangeItem::Create( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxDateTimeRangeItem, 0); - - sal_uInt32 nStartDate, nEndDate; - sal_Int32 nStartTime, nEndTime; - - rStream >> nStartDate; - rStream >> nStartTime; - - rStream >> nEndDate; - rStream >> nEndTime; - - DateTime aStartDT, aEndDT; - - aStartDT.SetDate( nStartDate ); - aStartDT.SetTime( nStartTime ); - - aEndDT.SetDate( nEndDate ); - aEndDT.SetTime( nEndTime ); - - return new SfxDateTimeRangeItem( Which(), aStartDT, aEndDT ); -} - -// ----------------------------------------------------------------------- - -SvStream& SfxDateTimeRangeItem::Store( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS( SfxDateTimeRangeItem, 0 ); - - rStream << aStartDateTime.GetDate(); - rStream << aStartDateTime.GetTime(); - - rStream << aEndDateTime.GetDate(); - rStream << aEndDateTime.GetTime(); - - return rStream; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxDateTimeRangeItem::Clone( SfxItemPool* ) const -{ - DBG_CHKTHIS( SfxDateTimeRangeItem, 0 ); - - return new SfxDateTimeRangeItem( *this ); -} -// ----------------------------------------------------------------------- - -SfxItemPresentation SfxDateTimeRangeItem::GetPresentation -( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * pIntlWrapper -) const -{ - DBG_CHKTHIS(SfxDateTimeRangeItem, 0); - DateTime aRange(aEndDateTime - (const Time&)aStartDateTime); - if (pIntlWrapper) - { - rText = pIntlWrapper->getLocaleData()->getDate(aRange); - rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); - rText += pIntlWrapper->getLocaleData()->getTime(aRange); - } - else - { - DBG_WARNING("SfxDateTimeRangeItem::GetPresentation():" - " Using default en_US IntlWrapper"); - const IntlWrapper aIntlWrapper( - ::comphelper::getProcessServiceFactory(), LANGUAGE_ENGLISH_US ); - rText = aIntlWrapper.getLocaleData()->getDate(aRange); - rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); - rText += aIntlWrapper.getLocaleData()->getTime(aRange); - } - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL SfxDateTimeRangeItem::PutValue( const com::sun::star::uno::Any& rVal,BYTE ) -{ - com::sun::star::util::DateTimeRange aValue; - if ( rVal >>= aValue ) - { - aStartDateTime = DateTime( Date( aValue.StartDay, - aValue.StartMonth, - aValue.StartYear ), - Time( aValue.StartHours, - aValue.StartMinutes, - aValue.StartSeconds, - aValue.StartHundredthSeconds ) ); - aEndDateTime = DateTime( Date( aValue.EndDay, - aValue.EndMonth, - aValue.EndYear ), - Time( aValue.EndHours, - aValue.EndMinutes, - aValue.EndSeconds, - aValue.EndHundredthSeconds ) ); - return TRUE; - } - - DBG_ERROR( "SfxDateTimeRangeItem::PutValue - Wrong type!" ); - return FALSE; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL SfxDateTimeRangeItem::QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId ) const -{ - nMemberId &= ~CONVERT_TWIPS; - com::sun::star::util::DateTimeRange aValue( aStartDateTime.Get100Sec(), - aStartDateTime.GetSec(), - aStartDateTime.GetMin(), - aStartDateTime.GetHour(), - aStartDateTime.GetDay(), - aStartDateTime.GetMonth(), - aStartDateTime.GetYear(), - aEndDateTime.Get100Sec(), - aEndDateTime.GetSec(), - aEndDateTime.GetMin(), - aEndDateTime.GetHour(), - aEndDateTime.GetDay(), - aEndDateTime.GetMonth(), - aEndDateTime.GetYear() ); - rVal <<= aValue; - return TRUE; -} - - diff --git a/svtools/source/items1/frqitem.cxx b/svtools/source/items1/frqitem.cxx deleted file mode 100644 index 4068ef8f97f1..000000000000 --- a/svtools/source/items1/frqitem.cxx +++ /dev/null @@ -1,580 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: frqitem.cxx,v $ - * $Revision: 1.8.136.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -#include - -#include -#include -#include - -#include - -DBG_NAME( SfxFrequencyItem ) - -TYPEINIT1( SfxFrequencyItem, SfxPoolItem ); - -#define MAX_GOTO 32000 - -#define DECL_SAVE_GOTO() \ - ULONG nSafetyMeasures = 0; - -#define SAVE_GOTO(tag) \ - if(nSafetyMeasures < MAX_GOTO) \ - { nSafetyMeasures++; goto tag; } - -// ----------------------------------------------------------------------- - -SfxFrequencyItem::SfxFrequencyItem( USHORT which ) : - SfxPoolItem ( which ), - eFrqMode ( FRQ_DAILY ), - eFrqTimeMode ( FRQ_TIME_AT ), - nDInterval1 ( 1 ), - nDInterval2 ( 0 ), - nDInterval3 ( 0 ), - nTInterval1 ( 1 ), - aTime1 ( Time( 12, 0, 0 ) ), - aTime2 ( Time( 12, 0, 0 ) ), - bMissingDate ( FALSE ), - aMissingDate ( DateTime(0, 0) ) -{ - DBG_CTOR( SfxFrequencyItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxFrequencyItem::SfxFrequencyItem( USHORT which, FrequencyMode eMode, FrequencyTimeMode eTMode, - USHORT nDI1, USHORT nDI2, USHORT nDI3, USHORT nTI1, - const Time& rT1, const Time& rT2 ) : - SfxPoolItem ( which ), - eFrqMode ( eMode ), - eFrqTimeMode ( eTMode ), - nDInterval1 ( nDI1 ), - nDInterval2 ( nDI2 ), - nDInterval3 ( nDI3 ), - nTInterval1 ( nTI1 ), - aTime1 ( rT1 ), - aTime2 ( rT2 ), - bMissingDate ( FALSE ) -{ - DBG_CTOR( SfxFrequencyItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxFrequencyItem::SfxFrequencyItem( const SfxFrequencyItem& rItem ) : - SfxPoolItem ( rItem ), - eFrqMode ( rItem.eFrqMode ), - eFrqTimeMode ( rItem.eFrqTimeMode ), - nDInterval1 ( rItem.nDInterval1 ), - nDInterval2 ( rItem.nDInterval2 ), - nDInterval3 ( rItem.nDInterval3 ), - nTInterval1 ( rItem.nTInterval1 ), - aTime1 ( rItem.aTime1 ), - aTime2 ( rItem.aTime2 ), - bMissingDate ( rItem.bMissingDate ) -{ - DBG_CTOR( SfxFrequencyItem, 0 ); -} - -// ----------------------------------------------------------------------- - -int SfxFrequencyItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS( SfxFrequencyItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - return ((SfxFrequencyItem&)rItem ).eFrqMode == eFrqMode && - ((SfxFrequencyItem&)rItem ).eFrqTimeMode == eFrqTimeMode && - ((SfxFrequencyItem&)rItem ).nDInterval1 == nDInterval1 && - ((SfxFrequencyItem&)rItem ).nDInterval2 == nDInterval2 && - ((SfxFrequencyItem&)rItem ).nDInterval3 == nDInterval3 && - ((SfxFrequencyItem&)rItem ).nTInterval1 == nTInterval1 && - ((SfxFrequencyItem&)rItem ).aTime1 == aTime1 && - ((SfxFrequencyItem&)rItem ).aTime2 == aTime2; -} - -// ----------------------------------------------------------------------- - -int SfxFrequencyItem::Compare( const SfxPoolItem& -#ifdef DBG_UTIL -rItem -#endif -) const -{ - DBG_CHKTHIS( SfxFrequencyItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - -/* DateTime aThisRange( aEndDateTime - aStartDateTime ); - DateTime aRange(((const SfxFrequencyItem&)rItem).aEndDateTime - - ((const SfxFrequencyItem&)rItem).aStartDateTime ); - if( aRange < aThisRange ) - return -1; - else if( aRange == aThisRange ) - return 0; - else -*/ - return 1; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxFrequencyItem::Create( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxFrequencyItem, 0); - - USHORT _eFrqMode; - USHORT _eFrqTimeMode; - USHORT _nDInterval1; - USHORT _nDInterval2; - USHORT _nDInterval3; - USHORT _nTInterval1; - long _nTime1; - long _nTime2; - - rStream >> _eFrqMode; - rStream >> _eFrqTimeMode; - rStream >> _nDInterval1; - rStream >> _nDInterval2; - rStream >> _nDInterval3; - rStream >> _nTInterval1; - rStream >> _nTime1; - rStream >> _nTime2; - - return new SfxFrequencyItem( Which(), (FrequencyMode)_eFrqMode, - (FrequencyTimeMode) _eFrqTimeMode, _nDInterval1, _nDInterval2, _nDInterval3, - _nTInterval1, Time(_nTime1), Time(_nTime2) ); -} - -// ----------------------------------------------------------------------- - -SvStream& SfxFrequencyItem::Store( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS( SfxFrequencyItem, 0 ); - - USHORT nEMode = (USHORT)eFrqMode; - USHORT nETimeMode = (USHORT)eFrqTimeMode; - - rStream << (USHORT) nEMode; - rStream << (USHORT) nETimeMode; - - rStream << nDInterval1; - rStream << nDInterval2; - rStream << nDInterval3; - - rStream << nTInterval1; - rStream << aTime1.GetTime(); - rStream << aTime2.GetTime(); - - return rStream; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxFrequencyItem::Clone( SfxItemPool* ) const -{ - DBG_CHKTHIS( SfxFrequencyItem, 0 ); - return new SfxFrequencyItem( *this ); -} - -// ----------------------------------------------------------------------- - -SfxItemPresentation SfxFrequencyItem::GetPresentation -( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * -) const -{ - DBG_CHKTHIS(SfxFrequencyItem, 0); - rText.AssignAscii(RTL_CONSTASCII_STRINGPARAM("SNIY")); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -// ----------------------------------------------------------------------- - -Time SfxFrequencyItem::_CalcTime( BOOL bForToday ) const -{ - Time aNow; - Time aTime; - - DECL_SAVE_GOTO(); - - switch( eFrqTimeMode ) - { - ////////////////////////////////////////////////////////// - // FRQ_TIME_AT - // - // Update um Uhrzeit - // nTime1 = 00:00:00 - 24:00:00 - // - case FRQ_TIME_AT : - aTime = aTime1; - break; - - ////////////////////////////////////////////////////////// - // FRQ_TIME_REPEAT - // - // Wiederhole alle X Stunden - // nTInterval1 = 1 .. 8 - // - case FRQ_TIME_REPEAT : - aTime = Time( 0, 0 ); - if( bForToday ) - { - - RECALC_TIME_REPEAT: - if( aNow > aTime ) - { - aTime += Time( nTInterval1, 0 ); - SAVE_GOTO( RECALC_TIME_REPEAT ); - } - break; - } - break; - - ////////////////////////////////////////////////////////// - // FRQ_TIME_REPEAT_RANGE - // - // FRQ_TIME_REPEAT zwischen Uhrzeit 1 und 2 - // nTime1 = 00:00:00 - 24:00:00 - // nTime2 = 00:00:00 - 24:00:00 - // - case FRQ_TIME_REPEAT_RANGE : - aTime = aTime1; - if( bForToday ) - { - if( aNow > aTime2 ) - return aTime1; - - RECALC_TIME_REPEAT_RANGE: - if( aNow > aTime ) - { - aTime += Time( nTInterval1, 0 ); - if( aTime > aTime2 ) - return aTime1; - SAVE_GOTO( RECALC_TIME_REPEAT_RANGE ); - } - break; - } - break; - } - return aTime; -} - -DateTime SfxFrequencyItem::CalcNextTick( const DateTime& rBase, BOOL bFirst ) -{ - Date aDateToday; - Time aTimeToday; - Date aDateBase; - Time aTimeBase; - - if( bFirst ) - { - aDateBase = Date( 17, 2, 1969 ); - aTimeBase = Time( 8, 0, 0 ); - } - else - { - aDateBase = rBase.GetDate(); - aTimeBase = rBase.GetTime(); - } - - Time aNextTime( _CalcTime(FALSE) ); - Date aNextDate( aDateBase ); - bMissingDate = FALSE; - - DECL_SAVE_GOTO(); - - switch( eFrqMode ) - { - ////////////////////////////////////////////////////////// - // FRQ_DAILY - // - // jeden X'ten Tag - // nInterval1 = 1 .. 999 - // - // jeden Wochentag - // nInterval1 = USHRT_MAX - // - case FRQ_DAILY : - { - if( bFirst ) - { - aNextTime = _CalcTime( TRUE ); - if( aNextTime < aTimeToday ) - { - aNextTime = _CalcTime( FALSE ); - aNextDate = aDateToday + (USHORT) - ((nDInterval1 == USHRT_MAX)? 1 : nDInterval1); - } - else - aNextDate = aDateToday; - break; - } - - RECALC_FRQ_DAILY: - if( aNextDate < aDateToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - aNextDate += (USHORT)((nDInterval1 == USHRT_MAX)? 1 : nDInterval1); - SAVE_GOTO( RECALC_FRQ_DAILY ); - } - - if( aNextDate == aDateToday ) - { - aNextTime = _CalcTime( TRUE ); - if( aNextTime < aTimeToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - aNextDate += (USHORT)((nDInterval1 == USHRT_MAX)? 1 : nDInterval1); - aNextTime = _CalcTime( FALSE ); - } - } - else - aNextTime = _CalcTime( FALSE ); - } break; - - ////////////////////////////////////////////////////////// - // FRQ_WEEKLY - // wiederhole jede X'te Woche - // nInterval1 = 1 .. 99 - // - // an SU, MO, TU, WE, TH, FR, SA - // nInterval2 = WD_SUNDAY | WD_MONDAY | WD_TUESDAY | - // WD_WEDNESDAY | WD_THURSDAY | WD_FRIDAY | - // WD_SATURDAY - // - case FRQ_WEEKLY : - { - BOOL bInRecalc = FALSE; - - RECALC_FRQ_WEEKLY: - if( !bFirst || bInRecalc ) - aNextDate += (nDInterval1 - 1) * 7; - - aNextDate -= (USHORT) ((aNextDate.GetDayOfWeek() != SUNDAY) ? - aNextDate.GetDayOfWeek() + 1 : 0); - - if( nDInterval2 & WD_SUNDAY && (aNextDate >= aDateToday) ) - aNextDate += 0; - else if( nDInterval2 & WD_MONDAY && (aNextDate + 1 >= aDateToday) ) - aNextDate += 1; - else if( nDInterval2 & WD_TUESDAY && (aNextDate + 2 >= aDateToday) ) - aNextDate += 2; - else if( nDInterval2 & WD_WEDNESDAY && (aNextDate + 3 >= aDateToday) ) - aNextDate += 3; - else if( nDInterval2 & WD_THURSDAY && (aNextDate + 4 >= aDateToday) ) - aNextDate += 4; - else if( nDInterval2 & WD_FRIDAY && (aNextDate + 5 >= aDateToday) ) - aNextDate += 5; - else if( nDInterval2 & WD_SATURDAY && (aNextDate + 6 >= aDateToday) ) - aNextDate += 6; - - if( aNextDate < aDateToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - bInRecalc = TRUE; - aNextDate += 7; - SAVE_GOTO( RECALC_FRQ_WEEKLY ); - } - if( aNextDate == aDateToday ) - { - aNextTime = _CalcTime( TRUE ); - if( aNextTime < aTimeToday ) - { - bInRecalc = TRUE; - aNextDate += 7; - SAVE_GOTO( RECALC_FRQ_WEEKLY ); - } - } - else - aNextTime = _CalcTime( FALSE ); - } break; - - ////////////////////////////////////////////////////////// - // FRQ_MONTHLY_DAILY - // - // jeden X'ten Tag von jedem X'ten Monat - // nInterval1 = 1 .. 31 - // nInterval2 = 1 .. 6 - // - case FRQ_MONTHLY_DAILY : - { - BOOL bInRecalc = FALSE; - aNextDate.SetDay( nDInterval1 ); - - RECALC_FRQ_MONTHLY_DAILY: - if( nDInterval2 > 1 || bInRecalc ) - { - long nMonth = aNextDate.GetMonth() - 1; - nMonth += nDInterval2; - aNextDate.SetYear( - sal::static_int_cast< USHORT >( - aNextDate.GetYear() + nMonth / 12 ) ); - aNextDate.SetMonth( - sal::static_int_cast< USHORT >( ( nMonth % 12 ) + 1 ) ); - } - - if( aNextDate < aDateToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - bInRecalc = TRUE; - SAVE_GOTO( RECALC_FRQ_MONTHLY_DAILY ); - } - - if( aNextDate == aDateToday ) - { - aNextTime = _CalcTime( TRUE ); - if( aNextTime < aTimeToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - bInRecalc = TRUE; - SAVE_GOTO( RECALC_FRQ_MONTHLY_DAILY ); - } - } - else - aNextTime = _CalcTime( FALSE ); - } break; - - ////////////////////////////////////////////////////////// - // FRQ_MONTHLY_LOGIC - // - // jeden ersten, zweiten, dritten, vierten oder letzten - // Wochentag jeden X'ten Monats - // nInterval1 = 0 .. 4 - // nInterval2 = WD_SUNDAY | WD_MONDAY | WD_TUESDAY | - // WD_WEDNESDAY | WD_THURSDAY | WD_FRIDAY | - // WD_SATURDAY - // nInterval3 = 1 .. 6 - // - case FRQ_MONTHLY_LOGIC : - { - BOOL bInRecalc = FALSE; - - RECALC_FRQ_MONTHLY_LOGIC: - if( nDInterval3 > 1 || bInRecalc ) - { - long nMonth = aNextDate.GetMonth() - 1; - nMonth += nDInterval3; - aNextDate.SetYear( - sal::static_int_cast< USHORT >( - aNextDate.GetYear() + nMonth / 12 ) ); - aNextDate.SetMonth( - sal::static_int_cast< USHORT >( ( nMonth % 12 ) + 1 ) ); - } - - USHORT nDay; - if( nDInterval2 & WD_SUNDAY ) - nDay = 6; - else if( nDInterval2 & WD_MONDAY ) - nDay = 0; - else if( nDInterval2 & WD_TUESDAY ) - nDay = 1; - else if( nDInterval2 & WD_WEDNESDAY ) - nDay = 2; - else if( nDInterval2 & WD_THURSDAY ) - nDay = 3; - else if( nDInterval2 & WD_FRIDAY ) - nDay = 4; - else nDay = 5; - - if( nDInterval1 == 4 ) - { - DateTime aDT = aNextDate; - aDT.SetDay( 1 ); - aDT += (long)(aNextDate.GetDaysInMonth() - 1); - if( aDT.GetDayOfWeek() != nDay ) - for( aDT--; aDT.GetDayOfWeek() != nDay; aDT-- ) ; - aNextDate = aDT; - } - else - { - DateTime aDT = aNextDate; - aDT.SetDay( 1 ); - aDT += (long)(nDay - USHORT(aDT.GetDayOfWeek())); - if( aDT.GetMonth() != aNextDate.GetMonth() ) - aDT += 7L; - aDT += (long)(nDInterval1 * 7); - aNextDate = aDT; - } - - if( aNextDate < aDateToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - bInRecalc = TRUE; - SAVE_GOTO( RECALC_FRQ_MONTHLY_LOGIC ); - } - - if( aNextDate == aDateToday ) - { - aNextTime = _CalcTime( TRUE ); - if( aNextTime < aTimeToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - bInRecalc = TRUE; - SAVE_GOTO( RECALC_FRQ_MONTHLY_LOGIC ); - } - } - else - aNextTime = _CalcTime( FALSE ); - } break; - } - - return DateTime( aNextDate, aNextTime ); -} - diff --git a/svtools/source/items1/ilstitem.cxx b/svtools/source/items1/ilstitem.cxx deleted file mode 100644 index a26c054eeadb..000000000000 --- a/svtools/source/items1/ilstitem.cxx +++ /dev/null @@ -1,106 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ilstitem.cxx,v $ - * $Revision: 1.8 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -#include - -#include - -#include - -#define _SVSTDARR_ULONGS -#include - -TYPEINIT1_AUTOFACTORY(SfxIntegerListItem, SfxPoolItem); - -SfxIntegerListItem::SfxIntegerListItem() -{ -} - -SfxIntegerListItem::SfxIntegerListItem( USHORT which, const SvULongs& rList ) - : SfxPoolItem( which ) -{ - m_aList.realloc( rList.Count() ); - for ( USHORT n=0; n xConverter - ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.script.Converter")), - ::com::sun::star::uno::UNO_QUERY ); - ::com::sun::star::uno::Any aNew; - try { aNew = xConverter->convertTo( rVal, ::getCppuType((const ::com::sun::star::uno::Sequence < sal_Int32 >*)0) ); } - catch (::com::sun::star::uno::Exception&) - { - return FALSE; - } - - return ( aNew >>= m_aList ); -} - -BOOL SfxIntegerListItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE ) const -{ - rVal <<= m_aList; - return TRUE; -} - -void SfxIntegerListItem::GetList( SvULongs& rList ) const -{ - for ( sal_Int32 n=0; n(n) ); -} diff --git a/svtools/source/items1/itemiter.cxx b/svtools/source/items1/itemiter.cxx deleted file mode 100644 index 9a7fa4d72c88..000000000000 --- a/svtools/source/items1/itemiter.cxx +++ /dev/null @@ -1,122 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: itemiter.cxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#ifndef GCC -#endif - -#include -#include -#include - -// STATIC DATA ----------------------------------------------------------- - -DBG_NAME(SfxItemIter); - - -// -------------------------------------------------------------------------- - - -SfxItemIter::SfxItemIter( const SfxItemSet& rItemSet ) - : _rSet( rItemSet ) -{ - DBG_CTOR(SfxItemIter, 0); - DBG_ASSERTWARNING( _rSet.Count(), "es gibt gar keine Attribute" ); - - if ( !_rSet._nCount ) - { - _nStt = 1; - _nEnd = 0; - } - else - { - SfxItemArray ppFnd = _rSet._aItems; - - // suche das 1. gesetzte Item - for ( _nStt = 0; !*(ppFnd + _nStt ); ++_nStt ) - ; // empty loop - if ( 1 < _rSet.Count() ) - for( _nEnd = _rSet.TotalCount(); !*( ppFnd + --_nEnd); ) - ; // empty loop - else - _nEnd = _nStt; - } - - _nAkt = _nStt; -} - -// -------------------------------------------------------------------------- - - -SfxItemIter::~SfxItemIter() -{ - DBG_DTOR(SfxItemIter, 0); -} - -// -------------------------------------------------------------------------- - - -const SfxPoolItem* SfxItemIter::NextItem() -{ - DBG_CHKTHIS(SfxItemIter, 0); - SfxItemArray ppFnd = _rSet._aItems; - - if( _nAkt < _nEnd ) - { - do { - _nAkt++; - } while( _nAkt < _nEnd && !*(ppFnd + _nAkt ) ); - return *(ppFnd+_nAkt); - } - return 0; -} - -// -------------------------------------------------------------------------- - - -const SfxPoolItem* SfxItemIter::PrevItem() -{ - DBG_CHKTHIS(SfxItemIter, 0); - SfxItemArray ppFnd = _rSet._aItems; - - if ( _nAkt > _nStt ) - { - do { - --_nAkt; - } while( _nAkt && !*(ppFnd + _nAkt )); - return *(ppFnd+_nAkt); - } - return 0; -} - - - diff --git a/svtools/source/items1/itempool.cxx b/svtools/source/items1/itempool.cxx deleted file mode 100644 index 823658132fe0..000000000000 --- a/svtools/source/items1/itempool.cxx +++ /dev/null @@ -1,1176 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: itempool.cxx,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include -#include -#ifndef GCC -#endif - -#include -#include "whassert.hxx" -#include -#include -#include "poolio.hxx" -#include - -// STATIC DATA ----------------------------------------------------------- - - -//======================================================================== - -SV_IMPL_PTRARR( SfxPoolVersionArr_Impl, SfxPoolVersion_Impl* ); - -//======================================================================== - - -void SfxItemPool::AddSfxItemPoolUser(SfxItemPoolUser& rNewUser) -{ - maSfxItemPoolUsers.push_back(&rNewUser); -} - -void SfxItemPool::RemoveSfxItemPoolUser(SfxItemPoolUser& rOldUser) -{ - const SfxItemPoolUserVector::iterator aFindResult = ::std::find(maSfxItemPoolUsers.begin(), maSfxItemPoolUsers.end(), &rOldUser); - if(aFindResult != maSfxItemPoolUsers.end()) - { - maSfxItemPoolUsers.erase(aFindResult); - } -} - -const SfxPoolItem* SfxItemPool::GetPoolDefaultItem( USHORT nWhich ) const -{ - DBG_CHKTHIS(SfxItemPool, 0); - const SfxPoolItem* pRet; - if( IsInRange( nWhich ) ) - pRet = *(ppPoolDefaults + GetIndex_Impl( nWhich )); - else if( pSecondary ) - pRet = pSecondary->GetPoolDefaultItem( nWhich ); - else - { - SFX_ASSERT( 0, nWhich, "unknown Which-Id - cannot get pool default" ); - pRet = 0; - } - return pRet; -} - -// ----------------------------------------------------------------------- - -inline FASTBOOL SfxItemPool::IsItemFlag_Impl( USHORT nPos, USHORT nFlag ) const -{ - USHORT nItemFlag = pItemInfos[nPos]._nFlags; - return nFlag == (nItemFlag & nFlag); -} - -// ----------------------------------------------------------------------- - -FASTBOOL SfxItemPool::IsItemFlag( USHORT nWhich, USHORT nFlag ) const -{ - for ( const SfxItemPool *pPool = this; pPool; pPool = pPool->pSecondary ) - { - if ( pPool->IsInRange(nWhich) ) - return pPool->IsItemFlag_Impl( pPool->GetIndex_Impl(nWhich), nFlag); - } - DBG_ASSERT( !IsWhich(nWhich), "unknown which-id" ); - return FALSE; -} - -// ----------------------------------------------------------------------- - -SfxBroadcaster& SfxItemPool::BC() -{ - return pImp->aBC; -} - -// ----------------------------------------------------------------------- - - -SfxItemPool::SfxItemPool -( - UniString const & rName, /* Name des Pools zur Idetifikation - im File-Format */ - USHORT nStartWhich, /* erste Which-Id des Pools */ - USHORT nEndWhich, /* letzte Which-Id des Pools */ -#ifdef TF_POOLABLE - const SfxItemInfo* pInfos, /* SID-Map und Item-Flags */ -#endif - SfxPoolItem** pDefaults, /* Pointer auf statische Defaults, - wird direkt vom Pool referenziert, - jedoch kein Eigent"umer"ubergang */ -#ifndef TF_POOLABLE - USHORT* pSlotIdArray, /* Zuordnung von Slot-Ids zu Which-Ids */ -#endif - FASTBOOL bLoadRefCounts /* Ref-Counts mitladen oder auf 1 setzen */ -) - -/* [Beschreibung] - - Der im Normalfall verwendete Konstruktor der Klasse SfxItemPool. Es - wird eine SfxItemPool-Instanz initialisiert, die Items im b"undigen - Which-Bereich von 'nStartWhich' bis 'nEndWhich' verwalten kann. - - F"ur jede dieser Which-Ids mu\s ein statischer Default im Array 'pDefaults' - vorhanden sein, die dort beginnend mit einem mit der - Which-Id 'nStartWhich' nach Which-Ids sortiert aufeinanderfolgend - eingetragen sein m"ussen. - - 'pItemInfos' ist ein identisch angeordnetes Array von USHORTs, die - Slot-Ids darstellen und Flags. Die Slot-Ids k"onnen 0 sein, wenn die - betreffenden Items ausschlie\slich in der Core verwendet werden. - "Uber die Flags kann z.B. bestimmt werden, ob Value-Sharing - (SFX_ITEM_POOLABLE) stattfinden soll. - - [Anmerkung] - - Wenn der Pool s enthalten soll, k"onnen im Konstruktor noch - keine static-Defaults angegeben werden. Dies mu\s dann nachtr"aglich - mit geschehen. - - - [Querverweise] - - - - -*/ - -: aName(rName), - nStart(nStartWhich), - nEnd(nEndWhich), -#ifdef TF_POOLABLE - pItemInfos(pInfos), -#else - pSlotIds(pSlotIdArray), -#endif - pImp( new SfxItemPool_Impl( nStart, nEnd ) ), - ppStaticDefaults(0), - ppPoolDefaults(new SfxPoolItem* [ nEndWhich - nStartWhich + 1]), - pSecondary(0), - pMaster(this), - _pPoolRanges( 0 ), - bPersistentRefCounts(bLoadRefCounts), - maSfxItemPoolUsers() -{ - DBG_CTOR(SfxItemPool, 0); - DBG_ASSERT(nStart, "Start-Which-Id must be greater 0" ); - - pImp->eDefMetric = SFX_MAPUNIT_TWIP; - pImp->nVersion = 0; - pImp->bStreaming = FALSE; - pImp->nLoadingVersion = 0; - pImp->nInitRefCount = 1; - pImp->nVerStart = nStart; - pImp->nVerEnd = nEnd; - pImp->bInSetItem = FALSE; - pImp->nStoringStart = nStartWhich; - pImp->nStoringEnd = nEndWhich; - - memset( ppPoolDefaults, 0, sizeof( SfxPoolItem* ) * (nEnd - nStart + 1)); - - if ( pDefaults ) - SetDefaults(pDefaults); -} - -// ----------------------------------------------------------------------- - - -SfxItemPool::SfxItemPool -( - const SfxItemPool& rPool, // von dieser Instanz kopieren - BOOL bCloneStaticDefaults /* TRUE - statische Defaults kopieren - - FALSE - statische Defaults - "ubernehehmen */ -) - -/* [Beschreibung] - - Copy-Konstruktor der Klasse SfxItemPool. - - - [Querverweise] - - -*/ - -: aName(rPool.aName), - nStart(rPool.nStart), - nEnd(rPool.nEnd), -#ifdef TF_POOLABLE - pItemInfos(rPool.pItemInfos), -#else - pSlotIds(rPool.pSlotIds), -#endif - pImp( new SfxItemPool_Impl( nStart, nEnd ) ), - ppStaticDefaults(0), - ppPoolDefaults(new SfxPoolItem* [ nEnd - nStart + 1]), - pSecondary(0), - pMaster(this), - _pPoolRanges( 0 ), - bPersistentRefCounts(rPool.bPersistentRefCounts ), - maSfxItemPoolUsers() -{ - DBG_CTOR(SfxItemPool, 0); - pImp->eDefMetric = rPool.pImp->eDefMetric; - pImp->nVersion = rPool.pImp->nVersion; - pImp->bStreaming = FALSE; - pImp->nLoadingVersion = 0; - pImp->nInitRefCount = 1; - pImp->nVerStart = rPool.pImp->nVerStart; - pImp->nVerEnd = rPool.pImp->nVerEnd; - pImp->bInSetItem = FALSE; - pImp->nStoringStart = nStart; - pImp->nStoringEnd = nEnd; - - memset( ppPoolDefaults, 0, sizeof( SfxPoolItem* ) * (nEnd - nStart + 1)); - - // Static Defaults "ubernehmen - if ( bCloneStaticDefaults ) - { - SfxPoolItem **ppDefaults = new SfxPoolItem*[nEnd-nStart+1]; - for ( USHORT n = 0; n <= nEnd - nStart; ++n ) - { - (*( ppDefaults + n )) = (*( rPool.ppStaticDefaults + n ))->Clone(this); - (*( ppDefaults + n ))->SetKind( SFX_ITEMS_STATICDEFAULT ); - } - - SetDefaults( ppDefaults ); - } - else - SetDefaults( rPool.ppStaticDefaults ); - - // Pool Defaults kopieren - for ( USHORT n = 0; n <= nEnd - nStart; ++n ) - if ( (*( rPool.ppPoolDefaults + n )) ) - { - (*( ppPoolDefaults + n )) = (*( rPool.ppPoolDefaults + n ))->Clone(this); - (*( ppPoolDefaults + n ))->SetKind( SFX_ITEMS_POOLDEFAULT ); - } - - // Version-Map kopieren - USHORT nVerCount = rPool.pImp->aVersions.Count(); - for ( USHORT nVer = 0; nVer < nVerCount; ++nVer ) - { - const SfxPoolVersion_Impl *pOld = rPool.pImp->aVersions.GetObject(nVer); - const SfxPoolVersion_Impl *pNew = new SfxPoolVersion_Impl( *pOld ); - pImp->aVersions.Insert( pNew, nVer ); - } - - // Verkettung wiederherstellen - if ( rPool.pSecondary ) - SetSecondaryPool( rPool.pSecondary->Clone() ); -} - -// ----------------------------------------------------------------------- - -void SfxItemPool::SetDefaults( SfxPoolItem **pDefaults ) -{ - DBG_CHKTHIS(SfxItemPool, 0); - DBG_ASSERT( pDefaults, "erst wollen, dann nichts geben..." ); - DBG_ASSERT( !ppStaticDefaults, "habe schon defaults" ); - - ppStaticDefaults = pDefaults; - //! if ( (*ppStaticDefaults)->GetKind() != SFX_ITEMS_STATICDEFAULT ) - //! geht wohl nicht im Zshg mit SetItems, die hinten stehen - { - DBG_ASSERT( (*ppStaticDefaults)->GetRefCount() == 0 || - IsDefaultItem( (*ppStaticDefaults) ), - "das sind keine statics" ); - for ( USHORT n = 0; n <= nEnd - nStart; ++n ) - { - SFX_ASSERT( (*( ppStaticDefaults + n ))->Which() == n + nStart, - n + nStart, "static defaults not sorted" ); - (*( ppStaticDefaults + n ))->SetKind( SFX_ITEMS_STATICDEFAULT ); - DBG_ASSERT( !(pImp->ppPoolItems[n]), "defaults with setitems with items?!" ); - } - } -} - -// ----------------------------------------------------------------------- - -void SfxItemPool::ReleaseDefaults -( - BOOL bDelete /* TRUE - l"oscht sowohl das Array als auch die einzelnen - statischen Defaults - - FALSE - l"oscht weder das Array noch die einzelnen - statischen Defaults */ -) - -/* [Beschreibung] - - Gibt die statischen Defaults der betreffenden SfxItemPool-Instanz frei - und l"oscht ggf. die statischen Defaults. - - Nach Aufruf dieser Methode darf die SfxItemPool-Instanz nicht mehr - verwendet werden, einzig ist der Aufruf des Destruktors zu"lassig. -*/ - -{ - DBG_ASSERT( ppStaticDefaults, "keine Arme keine Kekse" ); - ReleaseDefaults( ppStaticDefaults, nEnd - nStart + 1, bDelete ); - - // KSO (22.10.98): ppStaticDefaults zeigt auf geloeschten Speicher, - // wenn bDelete == TRUE. - if ( bDelete ) - ppStaticDefaults = 0; -} - -// ----------------------------------------------------------------------- - -void SfxItemPool::ReleaseDefaults -( - SfxPoolItem** pDefaults, /* freizugebende statische Defaults */ - - USHORT nCount, /* Anzahl der statischen Defaults */ - - BOOL bDelete /* TRUE - l"oscht sowohl das Array als auch die - einzelnen statischen Defaults - - FALSE - l"oscht weder das Array noch die - einzelnen statischen Defaults */ -) - -/* [Beschreibung] - - Gibt die angegebenen statischen Defaults frei und l"oscht ggf. - die statischen Defaults. - - Diese Methode darf erst nach Zerst"orung aller SfxItemPool-Instanzen, - welche die angegebenen statischen Defaults 'pDefault' verwenden, - aufgerufen werden. -*/ - -{ - DBG_ASSERT( pDefaults, "erst wollen, dann nichts geben..." ); - - for ( USHORT n = 0; n < nCount; ++n ) - { - SFX_ASSERT( IsStaticDefaultItem( *(pDefaults+n) ), - n, "das ist kein static-default" ); - (*( pDefaults + n ))->SetRefCount( 0 ); - if ( bDelete ) - { delete *( pDefaults + n ); *(pDefaults + n) = 0; } - } - - if ( bDelete ) - { delete[] pDefaults; pDefaults = 0; } -} - -// ----------------------------------------------------------------------- - -SfxItemPool::~SfxItemPool() -{ - DBG_DTOR(SfxItemPool, 0); - DBG_ASSERT( pMaster == this, "destroying active Secondary-Pool" ); - - if ( pImp->ppPoolItems && ppPoolDefaults ) - Delete(); - delete[] _pPoolRanges; - delete pImp; -} - -void SfxItemPool::Free(SfxItemPool* pPool) -{ - if(pPool) - { - // tell all the registered SfxItemPoolUsers that the pool is in destruction - SfxItemPoolUserVector aListCopy(pPool->maSfxItemPoolUsers.begin(), pPool->maSfxItemPoolUsers.end()); - for(SfxItemPoolUserVector::iterator aIterator = aListCopy.begin(); aIterator != aListCopy.end(); aIterator++) - { - SfxItemPoolUser* pSfxItemPoolUser = *aIterator; - DBG_ASSERT(pSfxItemPoolUser, "corrupt SfxItemPoolUser list (!)"); - pSfxItemPoolUser->ObjectInDestruction(*pPool); - } - - // Clear the vector. This means that user do not need to call RemoveSfxItemPoolUser() - // when they get called from ObjectInDestruction(). - pPool->maSfxItemPoolUsers.clear(); - - // delete pool - delete pPool; - } -} - -// ----------------------------------------------------------------------- - - -void SfxItemPool::SetSecondaryPool( SfxItemPool *pPool ) -{ - // ggf. an abgeh"angten Pools den Master zur"ucksetzen - if ( pSecondary ) - { -#ifdef DBG_UTIL - HACK( "fuer Image, dort gibt es derzeit keine Statics - Bug" ) - if ( ppStaticDefaults ) - { - // Delete() ist noch nicht gelaufen? - if ( pImp->ppPoolItems && pSecondary->pImp->ppPoolItems ) - { - // hat der master SetItems? - BOOL bHasSetItems = FALSE; - for ( USHORT i = 0; !bHasSetItems && i < nEnd-nStart; ++i ) - bHasSetItems = ppStaticDefaults[i]->ISA(SfxSetItem); - - // abgehaengte Pools muessen leer sein - BOOL bOK = bHasSetItems; - for ( USHORT n = 0; - bOK && n <= pSecondary->nEnd - pSecondary->nStart; - ++n ) - { - SfxPoolItemArray_Impl** ppItemArr = - pSecondary->pImp->ppPoolItems + n; - if ( *ppItemArr ) - { - SfxPoolItem** ppHtArr = - (SfxPoolItem**)(*ppItemArr)->GetData(); - for( USHORT i = (*ppItemArr)->Count(); i; ++ppHtArr, --i ) - if ( !(*ppHtArr) ) - { - DBG_ERROR( "old secondary pool must be empty" ); - bOK = FALSE; - break; - } - } - } - } - } -#endif - - pSecondary->pMaster = pSecondary; - for ( SfxItemPool *p = pSecondary->pSecondary; p; p = p->pSecondary ) - p->pMaster = pSecondary; - } - - // ggf. den Master der neuen Secondary-Pools setzen - DBG_ASSERT( !pPool || pPool->pMaster == pPool, "Secondary tanzt auf zwei Hochzeiten " ); - SfxItemPool *pNewMaster = pMaster ? pMaster : this; - for ( SfxItemPool *p = pPool; p; p = p->pSecondary ) - p->pMaster = pNewMaster; - - // neuen Secondary-Pool merken - pSecondary = pPool; -} - -// ----------------------------------------------------------------------- - -SfxMapUnit SfxItemPool::GetMetric( USHORT ) const -{ - DBG_CHKTHIS(SfxItemPool, 0); - - return pImp->eDefMetric; -} - -// ----------------------------------------------------------------------- - -void SfxItemPool::SetDefaultMetric( SfxMapUnit eNewMetric ) -{ - DBG_CHKTHIS(SfxItemPool, 0); - - pImp->eDefMetric = eNewMetric; -} - -// ----------------------------------------------------------------------- - -SfxItemPresentation SfxItemPool::GetPresentation -( - const SfxPoolItem& rItem, /* IN: , dessen textuelle - Wert-Darstellung geliefert werden - soll */ - SfxItemPresentation ePresent, /* IN: gew"unschte Art der Darstellung; - siehe */ - SfxMapUnit eMetric, /* IN: gew"unschte Ma\seinheit der Darstellung */ - XubString& rText, /* OUT: textuelle Darstellung von 'rItem' */ - const IntlWrapper * pIntlWrapper -) const - -/* [Beschreibung] - - "Uber diese virtuelle Methode k"onnen textuelle Darstellungen der - von der jeweilige SfxItemPool-Subklasse verwalteten SfxPoolItems - angefordert werden. - - In Ableitungen sollte diese Methode "uberladen werden und auf - SfxPoolItems reagiert werden, die bei - keine vollst"andige Information liefern k"onnen. - - Die Basisklasse liefert die unver"anderte Presentation von 'rItem'. -*/ - -{ - DBG_CHKTHIS(SfxItemPool, 0); - return rItem.GetPresentation( - ePresent, GetMetric(rItem.Which()), eMetric, rText, pIntlWrapper ); -} - - -// ----------------------------------------------------------------------- - -SfxItemPool* SfxItemPool::Clone() const -{ - DBG_CHKTHIS(SfxItemPool, 0); - - SfxItemPool *pPool = new SfxItemPool( *this ); - return pPool; -} - -// ---------------------------------------------------------------------- - -void SfxItemPool::Delete() -{ - DBG_CHKTHIS(SfxItemPool, 0); - - // schon deleted? - if ( !pImp->ppPoolItems || !ppPoolDefaults ) - return; - - // z.B. laufenden Requests bescheidsagen - pImp->aBC.Broadcast( SfxSimpleHint( SFX_HINT_DYING ) ); - - //MA 16. Apr. 97: Zweimal durchlaufen, in der ersten Runde fuer die SetItems. - //Der Klarheit halber wird das jetzt in zwei besser lesbare Schleifen aufgeteilt. - - SfxPoolItemArray_Impl** ppItemArr = pImp->ppPoolItems; - SfxPoolItem** ppDefaultItem = ppPoolDefaults; - SfxPoolItem** ppStaticDefaultItem = ppStaticDefaults; - USHORT nArrCnt; - - //Erst die SetItems abraeumen - HACK( "fuer Image, dort gibt es derzeit keine Statics - Bug" ) - if ( ppStaticDefaults ) - { - for ( nArrCnt = GetSize_Impl(); - nArrCnt; - --nArrCnt, ++ppItemArr, ++ppDefaultItem, ++ppStaticDefaultItem ) - { - // KSO (22.10.98): *ppStaticDefaultItem kann im dtor einer - // von SfxItemPool abgeleiteten Klasse bereits geloescht worden - // sein! -> CHAOS Itempool - if ( *ppStaticDefaultItem && (*ppStaticDefaultItem)->ISA(SfxSetItem) ) - { - if ( *ppItemArr ) - { - SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData(); - for ( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr ) - if (*ppHtArr) - { -#ifdef DBG_UTIL - ReleaseRef( **ppHtArr, (*ppHtArr)->GetRefCount() ); -#endif - delete *ppHtArr; - } - DELETEZ( *ppItemArr ); - } - if ( *ppDefaultItem ) - { -#ifdef DBG_UTIL - SetRefCount( **ppDefaultItem, 0 ); -#endif - DELETEZ( *ppDefaultItem ); - } - } - } - } - - ppItemArr = pImp->ppPoolItems; - ppDefaultItem = ppPoolDefaults; - - //Jetzt die 'einfachen' Items - for ( nArrCnt = GetSize_Impl(); - nArrCnt; - --nArrCnt, ++ppItemArr, ++ppDefaultItem ) - { - if ( *ppItemArr ) - { - SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData(); - for ( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr ) - if (*ppHtArr) - { -#ifdef DBG_UTIL - ReleaseRef( **ppHtArr, (*ppHtArr)->GetRefCount() ); -#endif - delete *ppHtArr; - } - delete *ppItemArr; - } - if ( *ppDefaultItem ) - { -#ifdef DBG_UTIL - SetRefCount( **ppDefaultItem, 0 ); -#endif - delete *ppDefaultItem; - } - } - - pImp->DeleteItems(); - delete[] ppPoolDefaults; ppPoolDefaults = 0; -} - -// ---------------------------------------------------------------------- - -void SfxItemPool::Cleanup() -{ - DBG_CHKTHIS(SfxItemPool, 0); - - //MA 16. Apr. 97: siehe ::Delete() - - SfxPoolItemArray_Impl** ppItemArr = pImp->ppPoolItems; - SfxPoolItem** ppDefaultItem = ppPoolDefaults; - SfxPoolItem** ppStaticDefaultItem = ppStaticDefaults; - USHORT nArrCnt; - - HACK( "fuer Image, dort gibt es derzeit keine Statics - Bug" ) - if ( ppStaticDefaults ) //HACK fuer Image, dort gibt es keine Statics!! - { - for ( nArrCnt = GetSize_Impl(); - nArrCnt; - --nArrCnt, ++ppItemArr, ++ppDefaultItem, ++ppStaticDefaultItem ) - { - //Fuer jedes Item gibt es entweder ein Default oder ein static Default! - if ( *ppItemArr && - ((*ppDefaultItem && (*ppDefaultItem)->ISA(SfxSetItem)) || - (*ppStaticDefaultItem)->ISA(SfxSetItem)) ) - { - SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData(); - for ( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr ) - if ( *ppHtArr && !(*ppHtArr)->GetRefCount() ) - { - DELETEZ(*ppHtArr); - } - } - } - } - - ppItemArr = pImp->ppPoolItems; - - for ( nArrCnt = GetSize_Impl(); - nArrCnt; - --nArrCnt, ++ppItemArr ) - { - if ( *ppItemArr ) - { - SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData(); - for ( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr ) - if ( *ppHtArr && !(*ppHtArr)->GetRefCount() ) - DELETEZ( *ppHtArr ); - } - } -} - -// ---------------------------------------------------------------------- - -void SfxItemPool::SetPoolDefaultItem(const SfxPoolItem &rItem) -{ - DBG_CHKTHIS(SfxItemPool, 0); - if ( IsInRange(rItem.Which()) ) - { - SfxPoolItem **ppOldDefault = - ppPoolDefaults + GetIndex_Impl(rItem.Which()); - SfxPoolItem *pNewDefault = rItem.Clone(this); - pNewDefault->SetKind(SFX_ITEMS_POOLDEFAULT); - if ( *ppOldDefault ) - { - (*ppOldDefault)->SetRefCount(0); - DELETEZ( *ppOldDefault ); - } - *ppOldDefault = pNewDefault; - } - else if ( pSecondary ) - pSecondary->SetPoolDefaultItem(rItem); - else - { - SFX_ASSERT( 0, rItem.Which(), "unknown Which-Id - cannot set pool default" ); - } -} - -/* - * Resets the default of the given back to the static default. - * If a pool default exists it is removed. - */ -void SfxItemPool::ResetPoolDefaultItem( USHORT nWhichId ) -{ - DBG_CHKTHIS(SfxItemPool, 0); - if ( IsInRange(nWhichId) ) - { - SfxPoolItem **ppOldDefault = - ppPoolDefaults + GetIndex_Impl( nWhichId ); - if ( *ppOldDefault ) - { - (*ppOldDefault)->SetRefCount(0); - DELETEZ( *ppOldDefault ); - } - } - else if ( pSecondary ) - pSecondary->ResetPoolDefaultItem(nWhichId); - else - { - SFX_ASSERT( 0, nWhichId, "unknown Which-Id - cannot set pool default" ); - } -} - -// ----------------------------------------------------------------------- - -const SfxPoolItem& SfxItemPool::Put( const SfxPoolItem& rItem, USHORT nWhich ) -{ - DBG_ASSERT( !rItem.ISA(SfxSetItem) || - 0 != &((const SfxSetItem&)rItem).GetItemSet(), - "SetItem without ItemSet" ); - - DBG_CHKTHIS(SfxItemPool, 0); - if ( 0 == nWhich ) - nWhich = rItem.Which(); - - // richtigen Secondary-Pool finden - BOOL bSID = nWhich > SFX_WHICH_MAX; - if ( !bSID && !IsInRange(nWhich) ) - { - if ( pSecondary ) - return pSecondary->Put( rItem, nWhich ); - DBG_ERROR( "unknown Which-Id - cannot put item" ); - } - - // SID oder nicht poolable (neue Definition)? - USHORT nIndex = bSID ? USHRT_MAX : GetIndex_Impl(nWhich); - if ( USHRT_MAX == nIndex || - IsItemFlag_Impl( nIndex, SFX_ITEM_NOT_POOLABLE ) ) - { - SFX_ASSERT( USHRT_MAX != nIndex || rItem.Which() != nWhich || - !IsDefaultItem(&rItem) || rItem.GetKind() == SFX_ITEMS_DELETEONIDLE, - nWhich, "ein nicht Pool-Item ist Default?!" ); - SfxPoolItem *pPoolItem = rItem.Clone(pMaster); - pPoolItem->SetWhich(nWhich); - AddRef( *pPoolItem ); - return *pPoolItem; - } - - SFX_ASSERT( rItem.IsA(GetDefaultItem(nWhich).Type()), nWhich, - "SFxItemPool: wrong item type in Put" ); - - SfxPoolItemArray_Impl** ppItemArr = pImp->ppPoolItems + nIndex; - if( !*ppItemArr ) - *ppItemArr = new SfxPoolItemArray_Impl; - - SfxPoolItem **ppFree = 0; - SfxPoolItem** ppHtArray = (SfxPoolItem**)(*ppItemArr)->GetData(); - if ( IsItemFlag_Impl( nIndex, SFX_ITEM_POOLABLE ) ) - { - // wenn es ueberhaupt gepoolt ist, koennte es schon drin sein - if ( IsPooledItem(&rItem) ) - { - // 1. Schleife: teste ob der Pointer vorhanden ist. - for( USHORT n = (*ppItemArr)->Count(); n; ++ppHtArray, --n ) - if( &rItem == (*ppHtArray) ) - { - AddRef( **ppHtArray ); - return **ppHtArray; - } - } - - // 2. Schleife: dann muessen eben die Attribute verglichen werden - USHORT n; - for ( n = (*ppItemArr)->Count(), ppHtArray = (SfxPoolItem**)(*ppItemArr)->GetData(); - n; ++ppHtArray, --n ) - { - if ( *ppHtArray ) - { - if( **ppHtArray == rItem ) - { - AddRef( **ppHtArray ); - return **ppHtArray; - } - } - else - if ( !ppFree ) - ppFree = ppHtArray; - } - } - else - { - // freien Platz suchen - SfxPoolItem** ppHtArr; - USHORT n, nCount = (*ppItemArr)->Count(); - for ( n = (*ppItemArr)->nFirstFree, - ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData() + n; - n < nCount; - ++ppHtArr, ++n ) - if ( !*ppHtArr ) - { - ppFree = ppHtArr; - break; - } - - // naechstmoeglichen freien Platz merken - (*ppItemArr)->nFirstFree = n; - } - - // nicht vorhanden, also im PtrArray eintragen - SfxPoolItem* pNewItem = rItem.Clone(pMaster); - pNewItem->SetWhich(nWhich); -#ifdef DBG_UTIL - SFX_ASSERT( rItem.Type() == pNewItem->Type(), nWhich, "unequal types in Put(): no Clone()?" ) -#ifdef TF_POOLABLE - if ( !rItem.ISA(SfxSetItem) ) - { - SFX_ASSERT( !IsItemFlag(nWhich, SFX_ITEM_POOLABLE) || - rItem == *pNewItem, - nWhich, "unequal items in Put(): no operator==?" ); - SFX_ASSERT( !IsItemFlag(*pNewItem, SFX_ITEM_POOLABLE) || - *pNewItem == rItem, - nWhich, "unequal items in Put(): no operator==?" ); - } -#endif -#endif - AddRef( *pNewItem, pImp->nInitRefCount ); - const SfxPoolItem* pTemp = pNewItem; - if ( !ppFree ) - (*ppItemArr)->Insert( pTemp, (*ppItemArr)->Count() ); - else - { - DBG_ASSERT( *ppFree == 0, "using surrogate in use" ); - *ppFree = pNewItem; - } - return *pNewItem; -} - -// ----------------------------------------------------------------------- - -void SfxItemPool::Remove( const SfxPoolItem& rItem ) -{ - DBG_CHKTHIS(SfxItemPool, 0); - - DBG_ASSERT( !rItem.ISA(SfxSetItem) || - 0 != &((const SfxSetItem&)rItem).GetItemSet(), - "SetItem without ItemSet" ); - - SFX_ASSERT( !IsPoolDefaultItem(&rItem), rItem.Which(), - "wo kommt denn hier ein Pool-Default her" ); - - // richtigen Secondary-Pool finden - const USHORT nWhich = rItem.Which(); - BOOL bSID = nWhich > SFX_WHICH_MAX; - if ( !bSID && !IsInRange(nWhich) ) - { - if ( pSecondary ) - { - pSecondary->Remove( rItem ); - return; - } - DBG_ERROR( "unknown Which-Id - cannot remove item" ); - } - - // SID oder nicht poolable (neue Definition)? - USHORT nIndex = bSID ? USHRT_MAX : GetIndex_Impl(nWhich); - if ( bSID || IsItemFlag_Impl( nIndex, SFX_ITEM_NOT_POOLABLE ) ) - { - SFX_ASSERT( USHRT_MAX != nIndex || - !IsDefaultItem(&rItem), rItem.Which(), - "ein nicht Pool-Item ist Default?!" ); - if ( 0 == ReleaseRef(rItem) ) - { - SfxPoolItem *pItem = &(SfxPoolItem &)rItem; - delete pItem; - } - return; - } - - SFX_ASSERT( rItem.GetRefCount(), rItem.Which(), "RefCount == 0, Remove unmoeglich" ); - - // statische Defaults sind eben einfach da - if ( rItem.GetKind() == SFX_ITEMS_STATICDEFAULT && - &rItem == *( ppStaticDefaults + GetIndex_Impl(nWhich) ) ) - return; - - // Item im eigenen Pool suchen - SfxPoolItemArray_Impl** ppItemArr = (pImp->ppPoolItems + nIndex); - SFX_ASSERT( *ppItemArr, rItem.Which(), "removing Item not in Pool" ); - SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData(); - for( USHORT n = (*ppItemArr)->Count(); n; ++ppHtArr, --n ) - if( *ppHtArr == &rItem ) - { - if ( (*ppHtArr)->GetRefCount() ) //! - ReleaseRef( **ppHtArr ); - else - { - SFX_ASSERT( 0, rItem.Which(), "removing Item without ref" ); - SFX_TRACE( "to be removed, but not no refs: ", *ppHtArr ); - } - - // ggf. kleinstmoegliche freie Position merken - USHORT nPos = (*ppItemArr)->Count() - n; - if ( (*ppItemArr)->nFirstFree > nPos ) - (*ppItemArr)->nFirstFree = nPos; - - //! MI: Hack, solange wir das Problem mit dem Outliner haben - //! siehe anderes MI-REF - if ( 0 == (*ppHtArr)->GetRefCount() && nWhich < 4000 ) - DELETEZ(*ppHtArr); - return; - } - - // nicht vorhanden - SFX_ASSERT( 0, rItem.Which(), "removing Item not in Pool" ); - SFX_TRACE( "to be removed, but not in pool: ", &rItem ); -} - -// ----------------------------------------------------------------------- - -const SfxPoolItem& SfxItemPool::GetDefaultItem( USHORT nWhich ) const -{ - DBG_CHKTHIS(SfxItemPool, 0); - - if ( !IsInRange(nWhich) ) - { - if ( pSecondary ) - return pSecondary->GetDefaultItem( nWhich ); - SFX_ASSERT( 0, nWhich, "unknown which - dont ask me for defaults" ); - } - - DBG_ASSERT( ppStaticDefaults, "no defaults known - dont ask me for defaults" ); - USHORT nPos = GetIndex_Impl(nWhich); - SfxPoolItem *pDefault = *(ppPoolDefaults + nPos); - if ( pDefault ) - return *pDefault; - return **(ppStaticDefaults + nPos); -} - -// ----------------------------------------------------------------------- - - -void SfxItemPool::FreezeIdRanges() - -/* [Beschreibung] - - This method should be called at the master pool, when all secondary - pools are appended to it. - - It calculates the ranges of 'which-ids' for fast construction of - item-sets, which contains all 'which-ids'. -*/ - -{ - FillItemIdRanges_Impl( _pPoolRanges ); -} - - -// ----------------------------------------------------------------------- - -void SfxItemPool::FillItemIdRanges_Impl( USHORT*& pWhichRanges ) const -{ - DBG_CHKTHIS(SfxItemPool, 0); - DBG_ASSERT( !_pPoolRanges, "GetFrozenRanges() would be faster!" ); - - const SfxItemPool *pPool; - USHORT nLevel = 0; - for( pPool = this; pPool; pPool = pPool->pSecondary ) - ++nLevel; - - pWhichRanges = new USHORT[ 2*nLevel + 1 ]; - - nLevel = 0; - for( pPool = this; pPool; pPool = pPool->pSecondary ) - { - *(pWhichRanges+(nLevel++)) = pPool->nStart; - *(pWhichRanges+(nLevel++)) = pPool->nEnd; - *(pWhichRanges+nLevel) = 0; - } -} - -// ----------------------------------------------------------------------- - -const SfxPoolItem *SfxItemPool::GetItem(USHORT nWhich, USHORT nOfst) const -{ - DBG_CHKTHIS(SfxItemPool, 0); - - if ( !IsInRange(nWhich) ) - { - if ( pSecondary ) - return pSecondary->GetItem( nWhich, nOfst ); - SFX_ASSERT( 0, nWhich, "unknown Which-Id - cannot resolve surrogate" ); - return 0; - } - - // dflt-Attribut? - if ( nOfst == SFX_ITEMS_STATICDEFAULT ) - return *(ppStaticDefaults + GetIndex_Impl(nWhich)); - - SfxPoolItemArray_Impl* pItemArr = *(pImp->ppPoolItems + GetIndex_Impl(nWhich)); - if( pItemArr && nOfst < pItemArr->Count() ) - return (*pItemArr)[nOfst]; - - return 0; -} - -// ----------------------------------------------------------------------- - -USHORT SfxItemPool::GetItemCount(USHORT nWhich) const -{ - DBG_CHKTHIS(SfxItemPool, 0); - - if ( !IsInRange(nWhich) ) - { - if ( pSecondary ) - return pSecondary->GetItemCount( nWhich ); - SFX_ASSERT( 0, nWhich, "unknown Which-Id - cannot resolve surrogate" ); - return 0; - } - - SfxPoolItemArray_Impl* pItemArr = *(pImp->ppPoolItems + GetIndex_Impl(nWhich)); - if ( pItemArr ) - return pItemArr->Count(); - return 0; -} - -// ----------------------------------------------------------------------- - -USHORT SfxItemPool::GetWhich( USHORT nSlotId, BOOL bDeep ) const -{ - if ( !IsSlot(nSlotId) ) - return nSlotId; - -#ifdef TF_POOLABLE - USHORT nCount = nEnd - nStart + 1; - for ( USHORT nOfs = 0; nOfs < nCount; ++nOfs ) - if ( pItemInfos[nOfs]._nSID == nSlotId ) - return nOfs + nStart; -#else - if ( pSlotIds ) - { - USHORT nCount = nEnd - nStart + 1; - for ( USHORT nOfs = 0; nOfs < nCount; ++nOfs ) - if ( pSlotIds[nOfs] == nSlotId ) - return nOfs + nStart; - } -#endif - if ( pSecondary && bDeep ) - return pSecondary->GetWhich(nSlotId); - return nSlotId; -} - -// ----------------------------------------------------------------------- - -USHORT SfxItemPool::GetSlotId( USHORT nWhich, BOOL bDeep ) const -{ - if ( !IsWhich(nWhich) ) - return nWhich; - - if ( !IsInRange( nWhich ) ) - { - if ( pSecondary && bDeep ) - return pSecondary->GetSlotId(nWhich); - SFX_ASSERT( 0, nWhich, "unknown Which-Id - cannot get slot-id" ); - return 0; - } -#ifdef TF_POOLABLE - - USHORT nSID = pItemInfos[nWhich - nStart]._nSID; - return nSID ? nSID : nWhich; -#else - else if ( pSlotIds ) - return pSlotIds[nWhich - nStart]; - return nWhich; -#endif -} - -// ----------------------------------------------------------------------- - -USHORT SfxItemPool::GetTrueWhich( USHORT nSlotId, BOOL bDeep ) const -{ - if ( !IsSlot(nSlotId) ) - return 0; - -#ifdef TF_POOLABLE - USHORT nCount = nEnd - nStart + 1; - for ( USHORT nOfs = 0; nOfs < nCount; ++nOfs ) - if ( pItemInfos[nOfs]._nSID == nSlotId ) - return nOfs + nStart; -#else - if ( pSlotIds ) - { - USHORT nCount = nEnd - nStart + 1; - for ( USHORT nOfs = 0; nOfs < nCount; ++nOfs ) - if ( pSlotIds[nOfs] == nSlotId ) - return nOfs + nStart; - } -#endif - if ( pSecondary && bDeep ) - return pSecondary->GetTrueWhich(nSlotId); - return 0; -} - -// ----------------------------------------------------------------------- - -USHORT SfxItemPool::GetTrueSlotId( USHORT nWhich, BOOL bDeep ) const -{ - if ( !IsWhich(nWhich) ) - return 0; - - if ( !IsInRange( nWhich ) ) - { - if ( pSecondary && bDeep ) - return pSecondary->GetTrueSlotId(nWhich); - SFX_ASSERT( 0, nWhich, "unknown Which-Id - cannot get slot-id" ); - return 0; - } -#ifdef TF_POOLABLE - return pItemInfos[nWhich - nStart]._nSID; -#else - else if ( pSlotIds ) - return pSlotIds[nWhich - nStart]; - else - return 0; -#endif -} -// ----------------------------------------------------------------------- -void SfxItemPool::SetFileFormatVersion( USHORT nFileFormatVersion ) - -/* [Description] - - You must call this function to set the file format version after - concatenating your secondary-pools but before you store any - pool, itemset or item. Only set the version at the master pool, - never at any secondary pool. -*/ - -{ - DBG_ASSERT( this == pMaster, - "SfxItemPool::SetFileFormatVersion() but not a master pool" ); - for ( SfxItemPool *pPool = this; pPool; pPool = pPool->pSecondary ) - pPool->_nFileFormatVersion = nFileFormatVersion; -} - - diff --git a/svtools/source/items1/itemprop.cxx b/svtools/source/items1/itemprop.cxx deleted file mode 100644 index 354e0a1441ba..000000000000 --- a/svtools/source/items1/itemprop.cxx +++ /dev/null @@ -1,506 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: itemprop.cxx,v $ - * $Revision: 1.9 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include -#include -#include -#include -#include -/************************************************************************* - UNO III Implementation -*************************************************************************/ -using namespace com::sun::star; -using namespace com::sun::star::beans; -using namespace com::sun::star::lang; -using namespace com::sun::star::uno; -using namespace ::rtl; -/*-- 16.02.2009 10:03:55--------------------------------------------------- - - -----------------------------------------------------------------------*/ - -struct equalOUString -{ - bool operator()(const ::rtl::OUString& r1, const ::rtl::OUString& r2) const - { - return r1.equals( r2 ); - } -}; - -typedef ::std::hash_map< ::rtl::OUString, - SfxItemPropertySimpleEntry, - ::rtl::OUStringHash, - equalOUString > SfxItemPropertyHashMap_t; - -class SfxItemPropertyMap_Impl : public SfxItemPropertyHashMap_t -{ -public: - mutable uno::Sequence< beans::Property > m_aPropSeq; - - SfxItemPropertyMap_Impl(){} - SfxItemPropertyMap_Impl( const SfxItemPropertyMap_Impl* pSource ); -}; -SfxItemPropertyMap_Impl::SfxItemPropertyMap_Impl( const SfxItemPropertyMap_Impl* pSource ) -{ - this->SfxItemPropertyHashMap_t::operator=( *pSource ); - m_aPropSeq = pSource->m_aPropSeq; -} - -/*-- 16.02.2009 10:03:51--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SfxItemPropertyMap::SfxItemPropertyMap( const SfxItemPropertyMapEntry* pEntries ) : - m_pImpl( new SfxItemPropertyMap_Impl ) -{ - while( pEntries->pName ) - { - ::rtl::OUString sEntry(pEntries->pName, pEntries->nNameLen, RTL_TEXTENCODING_ASCII_US ); - (*m_pImpl) [ sEntry ] = pEntries; - ++pEntries; - } -} -/*-- 16.02.2009 12:46:41--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SfxItemPropertyMap::SfxItemPropertyMap( const SfxItemPropertyMap* pSource ) : - m_pImpl( new SfxItemPropertyMap_Impl( pSource->m_pImpl ) ) -{ -} -/*-- 16.02.2009 10:03:51--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SfxItemPropertyMap::~SfxItemPropertyMap() -{ - delete m_pImpl; -} -/*-- 16.02.2009 10:03:51--------------------------------------------------- - - -----------------------------------------------------------------------*/ -const SfxItemPropertySimpleEntry* SfxItemPropertyMap::getByName( const ::rtl::OUString &rName ) const -{ - SfxItemPropertyHashMap_t::const_iterator aIter = m_pImpl->find(rName); - if( aIter == m_pImpl->end() ) - return 0; - return &aIter->second; -} - -/*-- 16.02.2009 10:44:24--------------------------------------------------- - - -----------------------------------------------------------------------*/ -uno::Sequence SfxItemPropertyMap::getProperties() const -{ - if( !m_pImpl->m_aPropSeq.getLength() ) - { - m_pImpl->m_aPropSeq.realloc( m_pImpl->size() ); - beans::Property* pPropArray = m_pImpl->m_aPropSeq.getArray(); - sal_uInt32 n = 0; - SfxItemPropertyHashMap_t::const_iterator aIt = m_pImpl->begin(); - while( aIt != m_pImpl->end() ) - //for ( const SfxItemPropertyMap *pMap = _pMap; pMap->pName; ++pMap ) - { - const SfxItemPropertySimpleEntry* pEntry = &(*aIt).second; - pPropArray[n].Name = (*aIt).first; - pPropArray[n].Handle = pEntry->nWID; - if(pEntry->pType) - pPropArray[n].Type = *pEntry->pType; - pPropArray[n].Attributes = - sal::static_int_cast< sal_Int16 >(pEntry->nFlags); - n++; - ++aIt; - } - } - - return m_pImpl->m_aPropSeq; -} -/*-- 16.02.2009 11:04:31--------------------------------------------------- - - -----------------------------------------------------------------------*/ -beans::Property SfxItemPropertyMap::getPropertyByName( const ::rtl::OUString rName ) const - throw( beans::UnknownPropertyException ) -{ - SfxItemPropertyHashMap_t::const_iterator aIter = m_pImpl->find(rName); - if( aIter == m_pImpl->end() ) - throw UnknownPropertyException(); - const SfxItemPropertySimpleEntry* pEntry = &aIter->second; - beans::Property aProp; - aProp.Name = rName; - aProp.Handle = pEntry->nWID; - if(pEntry->pType) - aProp.Type = *pEntry->pType; - aProp.Attributes = sal::static_int_cast< sal_Int16 >(pEntry->nFlags); - return aProp; -} -/*-- 16.02.2009 11:09:16--------------------------------------------------- - - -----------------------------------------------------------------------*/ -sal_Bool SfxItemPropertyMap::hasPropertyByName( const ::rtl::OUString& rName ) const -{ - SfxItemPropertyHashMap_t::const_iterator aIter = m_pImpl->find(rName); - return aIter != m_pImpl->end(); -} -/*-- 16.02.2009 11:25:14--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SfxItemPropertyMap::mergeProperties( const uno::Sequence< beans::Property >& rPropSeq ) -{ - const beans::Property* pPropArray = rPropSeq.getConstArray(); - sal_uInt32 nElements = rPropSeq.getLength(); - for( sal_uInt32 nElement = 0; nElement < nElements; ++nElement ) - { - SfxItemPropertySimpleEntry aTemp( - sal::static_int_cast< sal_Int16 >( pPropArray[nElement].Handle ), //nWID - &pPropArray[nElement].Type, //pType - pPropArray[nElement].Attributes, //nFlags - 0 ); //nMemberId - (*m_pImpl)[pPropArray[nElement].Name] = aTemp; - } -} -/*-- 18.02.2009 12:04:42--------------------------------------------------- - - -----------------------------------------------------------------------*/ -PropertyEntryVector_t SfxItemPropertyMap::getPropertyEntries() const -{ - PropertyEntryVector_t aRet; - aRet.reserve(m_pImpl->size()); - - SfxItemPropertyHashMap_t::const_iterator aIt = m_pImpl->begin(); - while( aIt != m_pImpl->end() ) - { - const SfxItemPropertySimpleEntry* pEntry = &(*aIt).second; - aRet.push_back( SfxItemPropertyNamedEntry( (*aIt).first, * pEntry ) ); - ++aIt; - } - return aRet; -} -/*-- 18.02.2009 15:11:06--------------------------------------------------- - - -----------------------------------------------------------------------*/ -sal_uInt32 SfxItemPropertyMap::getSize() const -{ - return m_pImpl->size(); -} -/*-- 16.02.2009 13:44:54--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SfxItemPropertySet::~SfxItemPropertySet() -{ -} -/* -----------------------------21.02.00 11:26-------------------------------- - - ---------------------------------------------------------------------------*/ -BOOL SfxItemPropertySet::FillItem(SfxItemSet&, USHORT, BOOL) const -{ - return FALSE; -} -/* -----------------------------06.06.01 12:32-------------------------------- - - ---------------------------------------------------------------------------*/ -void SfxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry& rEntry, - const SfxItemSet& rSet, Any& rAny ) const - throw(RuntimeException) -{ - // get the SfxPoolItem - const SfxPoolItem* pItem = 0; - SfxItemState eState = rSet.GetItemState( rEntry.nWID, TRUE, &pItem ); - if(SFX_ITEM_SET != eState && SFX_WHICH_MAX > rEntry.nWID ) - pItem = &rSet.GetPool()->GetDefaultItem(rEntry.nWID); - // return item values as uno::Any - if(eState >= SFX_ITEM_DEFAULT && pItem) - { - pItem->QueryValue( rAny, rEntry.nMemberId ); - } - else - { - SfxItemSet aSet(*rSet.GetPool(), rEntry.nWID, rEntry.nWID); - if(FillItem(aSet, rEntry.nWID, TRUE)) - { - const SfxPoolItem& rItem = aSet.Get(rEntry.nWID); - rItem.QueryValue( rAny, rEntry.nMemberId ); - } - else if(0 == (rEntry.nFlags & PropertyAttribute::MAYBEVOID)) - throw RuntimeException(); - } - - - // convert general SfxEnumItem values to specific values - if( rEntry.pType && TypeClass_ENUM == rEntry.pType->getTypeClass() && - rAny.getValueTypeClass() == TypeClass_LONG ) - { - INT32 nTmp = *(INT32*)rAny.getValue(); - rAny.setValue( &nTmp, *rEntry.pType ); - } -} -/* -----------------------------06.06.01 12:32-------------------------------- - - ---------------------------------------------------------------------------*/ -void SfxItemPropertySet::getPropertyValue( const OUString &rName, - const SfxItemSet& rSet, Any& rAny ) const - throw(RuntimeException, UnknownPropertyException) -{ - // detect which-id - const SfxItemPropertySimpleEntry* pEntry = m_aMap.getByName( rName ); - if ( !pEntry ) - throw UnknownPropertyException(); - getPropertyValue( *pEntry,rSet, rAny ); -} -/* -----------------------------21.02.00 11:26-------------------------------- - - ---------------------------------------------------------------------------*/ -Any SfxItemPropertySet::getPropertyValue( const OUString &rName, - const SfxItemSet& rSet ) const - throw(RuntimeException, UnknownPropertyException) -{ - Any aVal; - getPropertyValue( rName,rSet, aVal ); - return aVal; -} -/* -----------------------------15.11.00 14:46-------------------------------- - - ---------------------------------------------------------------------------*/ -void SfxItemPropertySet::setPropertyValue( const SfxItemPropertySimpleEntry& rEntry, - const Any& aVal, - SfxItemSet& rSet ) const - throw(RuntimeException, - IllegalArgumentException) -{ - // get the SfxPoolItem - const SfxPoolItem* pItem = 0; - SfxPoolItem *pNewItem = 0; - SfxItemState eState = rSet.GetItemState( rEntry.nWID, TRUE, &pItem ); - if(SFX_ITEM_SET != eState && SFX_WHICH_MAX > rEntry.nWID ) - pItem = &rSet.GetPool()->GetDefaultItem(rEntry.nWID); - //maybe there's another way to find an Item - if(eState < SFX_ITEM_DEFAULT) - { - SfxItemSet aSet(*rSet.GetPool(), rEntry.nWID, rEntry.nWID); - if(FillItem(aSet, rEntry.nWID, FALSE)) - { - const SfxPoolItem &rItem = aSet.Get(rEntry.nWID); - pNewItem = rItem.Clone(); - } - } - if(!pNewItem && pItem) - { - pNewItem = pItem->Clone(); - } - if(pNewItem) - { - if( !pNewItem->PutValue( aVal, rEntry.nMemberId ) ) - { - DELETEZ(pNewItem); - throw IllegalArgumentException(); - } - // apply new item - rSet.Put( *pNewItem, rEntry.nWID ); - delete pNewItem; - } -} -/* -----------------------------21.02.00 11:26-------------------------------- - - ---------------------------------------------------------------------------*/ -void SfxItemPropertySet::setPropertyValue( const OUString &rName, - const Any& aVal, - SfxItemSet& rSet ) const - throw(RuntimeException, - IllegalArgumentException, - UnknownPropertyException) -{ - const SfxItemPropertySimpleEntry* pEntry = m_aMap.getByName( rName ); - if ( !pEntry ) - { - throw UnknownPropertyException(); - } - setPropertyValue(*pEntry, aVal, rSet); -} -/* -----------------------------21.02.00 11:26-------------------------------- - - ---------------------------------------------------------------------------*/ -PropertyState SfxItemPropertySet::getPropertyState(const SfxItemPropertySimpleEntry& rEntry, const SfxItemSet& rSet) const - throw() -{ - PropertyState eRet = PropertyState_DIRECT_VALUE; - USHORT nWhich = rEntry.nWID; - - // item state holen - SfxItemState eState = rSet.GetItemState( nWhich, FALSE ); - // item-Wert als UnoAny zurueckgeben - if(eState == SFX_ITEM_DEFAULT) - eRet = PropertyState_DEFAULT_VALUE; - else if(eState < SFX_ITEM_DEFAULT) - eRet = PropertyState_AMBIGUOUS_VALUE; - return eRet; -} -PropertyState SfxItemPropertySet::getPropertyState( - const OUString& rName, const SfxItemSet& rSet) const - throw(UnknownPropertyException) -{ - PropertyState eRet = PropertyState_DIRECT_VALUE; - - // which-id ermitteln - const SfxItemPropertySimpleEntry* pEntry = m_aMap.getByName( rName ); - if( !pEntry || !pEntry->nWID ) - { - throw UnknownPropertyException(); - } - USHORT nWhich = pEntry->nWID; - - // item holen - const SfxPoolItem* pItem = 0; - SfxItemState eState = rSet.GetItemState( nWhich, FALSE, &pItem ); - if(!pItem && nWhich != rSet.GetPool()->GetSlotId(nWhich)) - pItem = &rSet.GetPool()->GetDefaultItem(nWhich); - // item-Wert als UnoAny zurueckgeben - if(eState == SFX_ITEM_DEFAULT) - eRet = PropertyState_DEFAULT_VALUE; - else if(eState < SFX_ITEM_DEFAULT) - eRet = PropertyState_AMBIGUOUS_VALUE; - return eRet; -} -/* -----------------------------21.02.00 11:26-------------------------------- - - ---------------------------------------------------------------------------*/ -Reference - SfxItemPropertySet::getPropertySetInfo() const -{ - if( !m_xInfo.is() ) - m_xInfo = new SfxItemPropertySetInfo( &m_aMap ); - return m_xInfo; -} -/*-- 16.02.2009 13:49:25--------------------------------------------------- - - -----------------------------------------------------------------------*/ -struct SfxItemPropertySetInfo_Impl -{ - SfxItemPropertyMap* m_pOwnMap; -}; -/*-- 16.02.2009 13:49:24--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SfxItemPropertySetInfo::SfxItemPropertySetInfo(const SfxItemPropertyMap *pMap ) : - m_pImpl( new SfxItemPropertySetInfo_Impl ) -{ - m_pImpl->m_pOwnMap = new SfxItemPropertyMap( pMap ); -} -/*-- 16.02.2009 13:49:25--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SfxItemPropertySetInfo::SfxItemPropertySetInfo(const SfxItemPropertyMapEntry *pEntries ) : - m_pImpl( new SfxItemPropertySetInfo_Impl ) -{ - m_pImpl->m_pOwnMap = new SfxItemPropertyMap( pEntries ); -} -/* -----------------------------21.02.00 11:09-------------------------------- - - ---------------------------------------------------------------------------*/ -Sequence< Property > SAL_CALL - SfxItemPropertySetInfo::getProperties( ) - throw(RuntimeException) -{ - return m_pImpl->m_pOwnMap->getProperties(); -} -/*-- 16.02.2009 13:49:27--------------------------------------------------- - - -----------------------------------------------------------------------*/ -const SfxItemPropertyMap* SfxItemPropertySetInfo::getMap() const -{ - return m_pImpl->m_pOwnMap; -} - -/*-- 16.02.2009 12:43:36--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SfxItemPropertySetInfo::~SfxItemPropertySetInfo() -{ - delete m_pImpl->m_pOwnMap; - delete m_pImpl; -} -/* -----------------------------21.02.00 11:27-------------------------------- - - ---------------------------------------------------------------------------*/ -Property SAL_CALL - SfxItemPropertySetInfo::getPropertyByName( const ::rtl::OUString& rName ) - throw(UnknownPropertyException, RuntimeException) -{ - return m_pImpl->m_pOwnMap->getPropertyByName( rName ); -} -/* -----------------------------21.02.00 11:28-------------------------------- - - ---------------------------------------------------------------------------*/ -sal_Bool SAL_CALL - SfxItemPropertySetInfo::hasPropertyByName( const ::rtl::OUString& rName ) - throw(RuntimeException) -{ - return m_pImpl->m_pOwnMap->hasPropertyByName( rName ); -} -/* -----------------------------21.02.00 12:03-------------------------------- - - ---------------------------------------------------------------------------*/ -SfxExtItemPropertySetInfo::SfxExtItemPropertySetInfo( - const SfxItemPropertyMapEntry *pMap, - const Sequence& rPropSeq ) : - aExtMap( pMap ) -{ - aExtMap.mergeProperties( rPropSeq ); -} -/*-- 16.02.2009 12:06:49--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SfxExtItemPropertySetInfo::~SfxExtItemPropertySetInfo() -{ -} -/* -----------------------------21.02.00 12:03-------------------------------- - - ---------------------------------------------------------------------------*/ -Sequence< Property > SAL_CALL - SfxExtItemPropertySetInfo::getProperties( ) throw(RuntimeException) -{ - return aExtMap.getProperties(); -} -/* -----------------------------21.02.00 12:03-------------------------------- - - ---------------------------------------------------------------------------*/ -Property SAL_CALL - SfxExtItemPropertySetInfo::getPropertyByName( const OUString& rPropertyName ) - throw(UnknownPropertyException, RuntimeException) -{ - return aExtMap.getPropertyByName( rPropertyName ); -} -/* -----------------------------21.02.00 12:03-------------------------------- - - ---------------------------------------------------------------------------*/ -sal_Bool SAL_CALL - SfxExtItemPropertySetInfo::hasPropertyByName( const OUString& rPropertyName ) - throw(RuntimeException) -{ - return aExtMap.hasPropertyByName( rPropertyName ); -} - diff --git a/svtools/source/items1/itemset.cxx b/svtools/source/items1/itemset.cxx deleted file mode 100644 index fee00dca854a..000000000000 --- a/svtools/source/items1/itemset.cxx +++ /dev/null @@ -1,2128 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: itemset.cxx,v $ - * $Revision: 1.9 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include - -#if STLPORT_VERSION>=321 -#include -#endif - -#ifndef GCC -#endif - -#define _SVSTDARR_USHORTS -#define _SVSTDARR_ULONGS - -#include -#include -#include -#include -#include "whiter.hxx" -#include -#include "whassert.hxx" - -#include -#include - -// STATIC DATA ----------------------------------------------------------- - -static const USHORT nInitCount = 10; // einzelne USHORTs => 5 Paare ohne '0' -#ifdef DBG_UTIL -static ULONG nRangesCopyCount = 0; // wie oft wurden Ranges kopiert -#endif - -DBG_NAME(SfxItemSet) - -//======================================================================== - -#define NUMTYPE USHORT -#define SvNums SvUShorts -#define SfxNumRanges SfxUShortRanges -#include "nranges.cxx" -#undef NUMTYPE -#undef SvNums -#undef SfxNumRanges - -#define NUMTYPE ULONG -#define SvNums SvULongs -#define SfxNumRanges SfxULongRanges -#include "nranges.cxx" -#undef NUMTYPE -#undef SvNums -#undef SfxNumRanges - -//======================================================================== - -#ifdef DBG_UTIL - - -const sal_Char *DbgCheckItemSet( const void* pVoid ) -{ - const SfxItemSet *pSet = (const SfxItemSet*) pVoid; - SfxWhichIter aIter( *pSet ); - USHORT nCount = 0, n = 0; - for ( USHORT nWh = aIter.FirstWhich(); nWh; nWh = aIter.NextWhich(), ++n ) - { - const SfxPoolItem *pItem = pSet->_aItems[n]; - if ( pItem ) - { - ++nCount; - DBG_ASSERT( IsInvalidItem(pItem) || - pItem->Which() == 0 || pItem->Which() == nWh, - "SfxItemSet: invalid which-id" ); - DBG_ASSERT( IsInvalidItem(pItem) || !pItem->Which() || - !SfxItemPool::IsWhich(pItem->Which()) || - pSet->GetPool()->IsItemFlag(nWh, SFX_ITEM_NOT_POOLABLE) || - SFX_ITEMS_NULL != pSet->GetPool()->GetSurrogate(pItem), - "SfxItemSet: item in set which is not in pool" ); - } - - } - DBG_ASSERT( pSet->_nCount == nCount, "wrong SfxItemSet::nCount detected" ); - - return 0; -} - -#endif -// ----------------------------------------------------------------------- - -SfxItemSet::SfxItemSet -( - SfxItemPool& rPool, /* der Pool, in dem die SfxPoolItems, - welche in dieses SfxItemSet gelangen, - aufgenommen werden sollen */ - BOOL -#ifdef DBG_UTIL -#ifdef SFX_ITEMSET_NO_DEFAULT_CTOR - - bTotalRanges /* komplette Pool-Ranges uebernehmen, - muss auf TRUE gesetzt werden */ -#endif -#endif -) -/* [Beschreibung] - - Konstruktor fuer ein SfxItemSet mit genau den Which-Bereichen, welche - dem angegebenen bekannt sind. - - - [Anmerkung] - - F"ur Sfx-Programmierer ein derart konstruiertes SfxItemSet kann - keinerlei Items mit Slot-Ids als Which-Werte aufnehmen! -*/ - -: _pPool( &rPool ), - _pParent( 0 ), - _nCount( 0 ) -{ - DBG_CTOR(SfxItemSet, DbgCheckItemSet); - DBG_ASSERTWARNING( _pPool == _pPool->GetMasterPool(), "kein Master-Pool" ); - DBG( _pChildCountCtor; *_pChildCount(this) = 0 ); -// DBG_ASSERT( bTotalRanges || abs( &bTotalRanges - this ) < 1000, -// "please use suitable ranges" ); -#ifdef DBG_UTIL -#ifdef SFX_ITEMSET_NO_DEFAULT_CTOR - if ( !bTotalRanges ) - *(int*)0 = 0; // GPF -#endif -#endif - - _pWhichRanges = (USHORT*) _pPool->GetFrozenIdRanges(); - DBG_ASSERT( _pWhichRanges, "don't create ItemSets with full range before FreezeIdRanges()" ); - if ( !_pWhichRanges ) - _pPool->FillItemIdRanges_Impl( _pWhichRanges ); - - const USHORT nSize = TotalCount(); - _aItems = new const SfxPoolItem* [ nSize ]; - memset( (void*) _aItems, 0, nSize * sizeof( SfxPoolItem* ) ); -} - -// ----------------------------------------------------------------------- - -SfxItemSet::SfxItemSet( SfxItemPool& rPool, USHORT nWhich1, USHORT nWhich2 ): - _pPool( &rPool ), - _pParent( 0 ), - _nCount( 0 ) -{ - DBG_CTOR(SfxItemSet, DbgCheckItemSet); - DBG_ASSERT( nWhich1 <= nWhich2, "Ungueltiger Bereich" ); - DBG_ASSERTWARNING( _pPool == _pPool->GetMasterPool(), "kein Master-Pool" ); - DBG( _pChildCountCtor; *_pChildCount(this) = 0 ); - - InitRanges_Impl(nWhich1, nWhich2); -} - -// ----------------------------------------------------------------------- - -void SfxItemSet::InitRanges_Impl(USHORT nWh1, USHORT nWh2) -{ - DBG_CHKTHIS(SfxItemSet, 0); - _pWhichRanges = new USHORT[ 3 ]; - *(_pWhichRanges+0) = nWh1; - *(_pWhichRanges+1) = nWh2; - *(_pWhichRanges+2) = 0; - const USHORT nRg = nWh2 - nWh1 + 1; - _aItems = new const SfxPoolItem* [ nRg ]; - memset( (void*) _aItems, 0, nRg * sizeof( SfxPoolItem* ) ); -} - -// ----------------------------------------------------------------------- - -void SfxItemSet::InitRanges_Impl(va_list pArgs, USHORT nWh1, USHORT nWh2, USHORT nNull) -{ - DBG_CHKTHIS(SfxItemSet, 0); - - USHORT nSize = InitializeRanges_Impl( _pWhichRanges, pArgs, nWh1, nWh2, nNull ); - _aItems = new const SfxPoolItem* [ nSize ]; - memset( (void*) _aItems, 0, sizeof( SfxPoolItem* ) * nSize ); -} - -// ----------------------------------------------------------------------- - -SfxItemSet::SfxItemSet( SfxItemPool& rPool, - USHORT_ARG nWh1, USHORT_ARG nWh2, USHORT_ARG nNull, ... ): - _pPool( &rPool ), - _pParent( 0 ), - _pWhichRanges( 0 ), - _nCount( 0 ) -{ - DBG_CTOR(SfxItemSet, DbgCheckItemSet); - DBG_ASSERT( nWh1 <= nWh2, "Ungueltiger Bereich" ); - DBG_ASSERTWARNING( _pPool == _pPool->GetMasterPool(), "kein Master-Pool" ); - DBG( _pChildCountCtor; *_pChildCount(this) = 0 ); - - if(!nNull) - InitRanges_Impl( - sal::static_int_cast< USHORT >(nWh1), - sal::static_int_cast< USHORT >(nWh2)); - else { - va_list pArgs; - va_start( pArgs, nNull ); - InitRanges_Impl( - pArgs, sal::static_int_cast< USHORT >(nWh1), - sal::static_int_cast< USHORT >(nWh2), - sal::static_int_cast< USHORT >(nNull)); - } -} - -// ----------------------------------------------------------------------- - -void SfxItemSet::InitRanges_Impl(const USHORT *pWhichPairTable) -{ - DBG_CHKTHIS(SfxItemSet, 0); - DBG_TRACE1("SfxItemSet: Ranges-CopyCount==%ul", ++nRangesCopyCount); - - USHORT nCnt = 0; - const USHORT* pPtr = pWhichPairTable; - while( *pPtr ) - { - nCnt += ( *(pPtr+1) - *pPtr ) + 1; - pPtr += 2; - } - - _aItems = new const SfxPoolItem* [ nCnt ]; - memset( (void*) _aItems, 0, sizeof( SfxPoolItem* ) * nCnt ); - - std::ptrdiff_t cnt = pPtr - pWhichPairTable +1; - _pWhichRanges = new USHORT[ cnt ]; - memcpy( _pWhichRanges, pWhichPairTable, sizeof( USHORT ) * cnt ); -} - - -// ----------------------------------------------------------------------- - -SfxItemSet::SfxItemSet( SfxItemPool& rPool, const USHORT* pWhichPairTable ): - _pPool( &rPool ), - _pParent( 0 ), - _pWhichRanges(0), - _nCount( 0 ) -{ - DBG_CTOR(SfxItemSet, 0); - DBG_ASSERTWARNING( _pPool == _pPool->GetMasterPool(), "kein Master-Pool" ); - DBG( _pChildCountCtor; *_pChildCount(this) = 0 ); - - // pWhichPairTable == 0 ist f"ur das SfxAllEnumItemSet - if ( pWhichPairTable ) - InitRanges_Impl(pWhichPairTable); -} - -// ----------------------------------------------------------------------- - -SfxItemSet::SfxItemSet( const SfxItemSet& rASet ): - _pPool( rASet._pPool ), - _pParent( rASet._pParent ), - _nCount( rASet._nCount ) -{ - DBG_CTOR(SfxItemSet, DbgCheckItemSet); - DBG_ASSERTWARNING( _pPool == _pPool->GetMasterPool(), "kein Master-Pool" ); - DBG( _pChildCountCtor; *_pChildCount(this) = 0 ); - DBG( ++*_pChildCount(_pParent) ); - - // errechne die Anzahl von Attributen - USHORT nCnt = 0; - USHORT* pPtr = rASet._pWhichRanges; - while( *pPtr ) - { - nCnt += ( *(pPtr+1) - *pPtr ) + 1; - pPtr += 2; - } - - _aItems = new const SfxPoolItem* [ nCnt ]; - - // Attribute kopieren - SfxItemArray ppDst = _aItems, ppSrc = rASet._aItems; - for( USHORT n = nCnt; n; --n, ++ppDst, ++ppSrc ) - if ( 0 == *ppSrc || // aktueller Default? - IsInvalidItem(*ppSrc) || // Dont Care? - IsStaticDefaultItem(*ppSrc) ) // nicht zu poolende Defaults - // einfach Pointer kopieren - *ppDst = *ppSrc; - else if ( _pPool->IsItemFlag( **ppSrc, SFX_ITEM_POOLABLE ) ) - { - // einfach Pointer kopieren und Ref-Count erh"ohen - *ppDst = *ppSrc; - ( (SfxPoolItem*) (*ppDst) )->AddRef(); - } - else if ( !(*ppSrc)->Which() ) - *ppDst = (*ppSrc)->Clone(); - else - // !IsPoolable() => via Pool zuweisen - *ppDst = &_pPool->Put( **ppSrc ); - - // dann noch die Which Ranges kopieren - DBG_TRACE1("SfxItemSet: Ranges-CopyCount==%ul", ++nRangesCopyCount); - std::ptrdiff_t cnt = pPtr - rASet._pWhichRanges+1; - _pWhichRanges = new USHORT[ cnt ]; - memcpy( _pWhichRanges, rASet._pWhichRanges, sizeof( USHORT ) * cnt); -} - -// ----------------------------------------------------------------------- - -SfxItemSet::~SfxItemSet() -{ - DBG_DTOR(SfxItemSet, DbgCheckItemSet); -#ifdef DBG_UTIL - DBG( DBG_ASSERT( 0 == *_pChildCount(this), "SfxItemSet: deleting parent-itemset" ) ) -#endif - - USHORT nCount = TotalCount(); - if( Count() ) - { - SfxItemArray ppFnd = _aItems; - for( USHORT nCnt = nCount; nCnt; --nCnt, ++ppFnd ) - if( *ppFnd && !IsInvalidItem(*ppFnd) ) - { - if( !(*ppFnd)->Which() ) - delete (SfxPoolItem*) *ppFnd; - else { - // noch mehrer Referenzen vorhanden, also nur den - // ReferenzCounter manipulieren - if ( 1 < (*ppFnd)->GetRefCount() && !IsDefaultItem(*ppFnd) ) - (*ppFnd)->ReleaseRef(); - else - if ( !IsDefaultItem(*ppFnd) ) - // aus dem Pool loeschen - _pPool->Remove( **ppFnd ); - } - } - } - - // FIXME: could be delete[] (SfxPoolItem **)_aItems; - delete[] _aItems; - if ( _pWhichRanges != _pPool->GetFrozenIdRanges() ) - delete[] _pWhichRanges; - _pWhichRanges = 0; // for invariant-testing - - DBG( --*_pChildCount(_pParent) ); - DBG( delete _pChildCount(this); _pChildCountDtor ); -} - -// ----------------------------------------------------------------------- - -USHORT SfxItemSet::ClearItem( USHORT nWhich ) - -// einzelnes Item oder alle Items (nWhich==0) l"oschen - -{ - DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); - if( !Count() ) - return 0; - - USHORT nDel = 0; - SfxItemArray ppFnd = _aItems; - - if( nWhich ) - { - const USHORT* pPtr = _pWhichRanges; - while( *pPtr ) - { - // in diesem Bereich? - if( *pPtr <= nWhich && nWhich <= *(pPtr+1) ) - { - // "uberhaupt gesetzt? - ppFnd += nWhich - *pPtr; - if( *ppFnd ) - { - // wegen der Assertions ins Sub-Calls mu\s das hier sein - --_nCount; - const SfxPoolItem *pItemToClear = *ppFnd; - *ppFnd = 0; - - if ( !IsInvalidItem(pItemToClear) ) - { - if ( nWhich <= SFX_WHICH_MAX ) - { - const SfxPoolItem& rNew = _pParent - ? _pParent->Get( nWhich, TRUE ) - : _pPool->GetDefaultItem( nWhich ); - - Changed( *pItemToClear, rNew ); - } - if ( pItemToClear->Which() ) - _pPool->Remove( *pItemToClear ); - } - ++nDel; - } - - // gefunden => raus - break; - } - ppFnd += *(pPtr+1) - *pPtr + 1; - pPtr += 2; - } - } - else - { - nDel = _nCount; - - USHORT* pPtr = _pWhichRanges; - while( *pPtr ) - { - for( nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd ) - if( *ppFnd ) - { - // wegen der Assertions ins Sub-Calls mu\s das hier sein - --_nCount; - const SfxPoolItem *pItemToClear = *ppFnd; - *ppFnd = 0; - - if ( !IsInvalidItem(pItemToClear) ) - { - if ( nWhich <= SFX_WHICH_MAX ) - { - const SfxPoolItem& rNew = _pParent - ? _pParent->Get( nWhich, TRUE ) - : _pPool->GetDefaultItem( nWhich ); - - Changed( *pItemToClear, rNew ); - } - - // #i32448# - // Take care of disabled items, too. - if(!pItemToClear->nWhich) - { - // item is disabled, delete it - delete pItemToClear; - } - else - { - // remove item from pool - _pPool->Remove( *pItemToClear ); - } - } - } - pPtr += 2; - } - } - return nDel; -} - -// ----------------------------------------------------------------------- - -void SfxItemSet::ClearInvalidItems( BOOL bHardDefault ) -{ - DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); - USHORT* pPtr = _pWhichRanges; - SfxItemArray ppFnd = _aItems; - if ( bHardDefault ) - while( *pPtr ) - { - for ( USHORT nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd ) - if ( IsInvalidItem(*ppFnd) ) - *ppFnd = &_pPool->Put( _pPool->GetDefaultItem(nWhich) ); - pPtr += 2; - } - else - while( *pPtr ) - { - for( USHORT nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd ) - if( IsInvalidItem(*ppFnd) ) - { - *ppFnd = 0; - --_nCount; - } - pPtr += 2; - } -} - -//------------------------------------------------------------------------ - - -void SfxItemSet::InvalidateAllItems() -{ - DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); - DBG_ASSERT( !_nCount, "Es sind noch Items gesetzt" ); - - memset( (void*)_aItems, -1, ( _nCount = TotalCount() ) * sizeof( SfxPoolItem*) ); -} - -// ----------------------------------------------------------------------- - -SfxItemState SfxItemSet::GetItemState( USHORT nWhich, - BOOL bSrchInParent, - const SfxPoolItem **ppItem ) const -{ - DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); - // suche den Bereich in dem das Which steht: - const SfxItemSet* pAktSet = this; - SfxItemState eRet = SFX_ITEM_UNKNOWN; - do - { - SfxItemArray ppFnd = pAktSet->_aItems; - const USHORT* pPtr = pAktSet->_pWhichRanges; - if (pPtr) - { - while ( *pPtr ) - { - if ( *pPtr <= nWhich && nWhich <= *(pPtr+1) ) - { - // in diesem Bereich - ppFnd += nWhich - *pPtr; - if ( !*ppFnd ) - { - eRet = SFX_ITEM_DEFAULT; - if( !bSrchInParent ) - return eRet; // nicht vorhanden - break; // JP: in den Parents weitersuchen !!! - } - - if ( (SfxPoolItem*) -1 == *ppFnd ) - // Unterschiedlich vorhanden - return SFX_ITEM_DONTCARE; - - if ( (*ppFnd)->Type() == TYPE(SfxVoidItem) ) - return SFX_ITEM_DISABLED; - - if (ppItem) - { - #ifdef DBG_UTIL - const SfxPoolItem *pItem = *ppFnd; - DBG_ASSERT( !pItem->ISA(SfxSetItem) || - 0 != &((const SfxSetItem*)pItem)->GetItemSet(), - "SetItem without ItemSet" ); - #endif - *ppItem = *ppFnd; - } - return SFX_ITEM_SET; - } - ppFnd += *(pPtr+1) - *pPtr + 1; - pPtr += 2; - } - } - } while( bSrchInParent && 0 != ( pAktSet = pAktSet->_pParent )); - return eRet; -} - -// ----------------------------------------------------------------------- - -const SfxPoolItem* SfxItemSet::Put( const SfxPoolItem& rItem, USHORT nWhich ) -{ - DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); - DBG_ASSERT( !rItem.ISA(SfxSetItem) || - 0 != &((const SfxSetItem&)rItem).GetItemSet(), - "SetItem without ItemSet" ); - if ( !nWhich ) - return 0; //! nur wegen Outliner-Bug - SfxItemArray ppFnd = _aItems; - const USHORT* pPtr = _pWhichRanges; - while( *pPtr ) - { - if( *pPtr <= nWhich && nWhich <= *(pPtr+1) ) - { - // in diesem Bereich - ppFnd += nWhich - *pPtr; - if( *ppFnd ) // schon einer vorhanden - { - // selbes Item bereits vorhanden? - if ( *ppFnd == &rItem ) - return 0; - - // wird dontcare oder disabled mit was echtem ueberschrieben? - if ( rItem.Which() && ( IsInvalidItem(*ppFnd) || !(*ppFnd)->Which() ) ) - { - *ppFnd = &_pPool->Put( rItem, nWhich ); - return *ppFnd; - } - - // wird disabled? - if( !rItem.Which() ) - { - *ppFnd = rItem.Clone(_pPool); - return 0; - } - else - { - // selber Wert bereits vorhanden? - if ( rItem == **ppFnd ) - return 0; - - // den neuen eintragen, den alten austragen - const SfxPoolItem& rNew = _pPool->Put( rItem, nWhich ); - const SfxPoolItem* pOld = *ppFnd; - *ppFnd = &rNew; - if(nWhich <= SFX_WHICH_MAX) - Changed( *pOld, rNew ); - _pPool->Remove( *pOld ); - } - } - else - { - ++_nCount; - if( !rItem.Which() ) - *ppFnd = rItem.Clone(_pPool); - else { - const SfxPoolItem& rNew = _pPool->Put( rItem, nWhich ); - *ppFnd = &rNew; - if (nWhich <= SFX_WHICH_MAX ) - { - const SfxPoolItem& rOld = _pParent - ? _pParent->Get( nWhich, TRUE ) - : _pPool->GetDefaultItem( nWhich ); - Changed( rOld, rNew ); - } - } - } - SFX_ASSERT( !_pPool->IsItemFlag(nWhich, SFX_ITEM_POOLABLE) || - rItem.ISA(SfxSetItem) || **ppFnd == rItem, - nWhich, "putted Item unequal" ); - return *ppFnd; - } - ppFnd += *(pPtr+1) - *pPtr + 1; - pPtr += 2; - } - return 0; -} - -// ----------------------------------------------------------------------- - -int SfxItemSet::Put( const SfxItemSet& rSet, BOOL bInvalidAsDefault ) -{ - DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); - BOOL bRet = FALSE; - if( rSet.Count() ) - { - SfxItemArray ppFnd = rSet._aItems; - const USHORT* pPtr = rSet._pWhichRanges; - while ( *pPtr ) - { - for ( USHORT nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd ) - if( *ppFnd ) - { - if ( IsInvalidItem( *ppFnd ) ) - { - if ( bInvalidAsDefault ) - bRet |= 0 != ClearItem( nWhich ); - // gab GPF bei non.WIDs: - // bRet |= 0 != Put( rSet.GetPool()->GetDefaultItem(nWhich), nWhich ); - else - InvalidateItem( nWhich ); - } - else - bRet |= 0 != Put( **ppFnd, nWhich ); - } - pPtr += 2; - } - } - return bRet; -} - -// ----------------------------------------------------------------------- - -void SfxItemSet::PutExtended -( - const SfxItemSet& rSet, // Quelle der zu puttenden Items - SfxItemState eDontCareAs, // was mit DontCare-Items passiert - SfxItemState eDefaultAs // was mit Default-Items passiert -) - -/* [Beschreibung] - - Diese Methode "ubernimmt die Items aus 'rSet' in '*this'. Die - Which-Bereiche in '*this', die in 'rSet' nicht vorkommen bleiben unver- - "andert. Der Which-Bereich von '*this' bleibt auch unver"andert. - - In 'rSet' gesetzte Items werden auch in '*this*' gesetzt. Default- - (0 Pointer) und Invalid- (-1 Pointer) Items werden je nach Parameter - ('eDontCareAs' und 'eDefaultAs' behandelt: - - SFX_ITEM_SET: hart auf Default des Pools gesetzt - SFX_ITEM_DEFAULT: gel"oscht (0 Pointer) - SFX_ITEM_DONTCARE: invalidiert (-1 Pointer) - - Alle anderen Werte f"ur 'eDontCareAs' und 'eDefaultAs' sind ung"ultig. -*/ - -{ - DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); - - // don't "optimize" with "if( rSet.Count()" because of dont-care + defaults - SfxItemArray ppFnd = rSet._aItems; - const USHORT* pPtr = rSet._pWhichRanges; - while ( *pPtr ) - { - for ( USHORT nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd ) - if( *ppFnd ) - { - if ( IsInvalidItem( *ppFnd ) ) - { - // Item ist DontCare: - switch ( eDontCareAs ) - { - case SFX_ITEM_SET: - Put( rSet.GetPool()->GetDefaultItem(nWhich), nWhich ); - break; - - case SFX_ITEM_DEFAULT: - ClearItem( nWhich ); - break; - - case SFX_ITEM_DONTCARE: - InvalidateItem( nWhich ); - break; - - default: - DBG_ERROR( "invalid Argument for eDontCareAs" ); - } - } - else - // Item ist gesetzt: - Put( **ppFnd, nWhich ); - } - else - { - // Item ist Default: - switch ( eDefaultAs ) - { - case SFX_ITEM_SET: - Put( rSet.GetPool()->GetDefaultItem(nWhich), nWhich ); - break; - - case SFX_ITEM_DEFAULT: - ClearItem( nWhich ); - break; - - case SFX_ITEM_DONTCARE: - InvalidateItem( nWhich ); - break; - - default: - DBG_ERROR( "invalid Argument for eDefaultAs" ); - } - } - pPtr += 2; - } -} - -// ----------------------------------------------------------------------- - -void SfxItemSet::MergeRange( USHORT nFrom, USHORT nTo ) -/**

Description

- - Expands the ranges of settable items by 'nFrom' to 'nTo'. Keeps state of - items which are new ranges too. -*/ - -{ - // special case: exactly one USHORT which is already included? - if ( nFrom == nTo && SFX_ITEM_AVAILABLE <= GetItemState(nFrom, FALSE) ) - return; - - // merge new range - SfxUShortRanges aRanges( _pWhichRanges ); - aRanges += SfxUShortRanges( nFrom, nTo ); - SetRanges( aRanges ); -} - -// ----------------------------------------------------------------------- - -void SfxItemSet::SetRanges( const USHORT *pNewRanges ) - -/**

Description

- - Modifies the ranges of settable items. Keeps state of items which - are new ranges too. -*/ - -{ - // identische Ranges? - if ( _pWhichRanges == pNewRanges ) - return; - const USHORT* pOld = _pWhichRanges; - const USHORT* pNew = pNewRanges; - while ( *pOld == *pNew ) - { - if ( !*pOld && !*pNew ) - return; - ++pOld, ++pNew; - } - - // create new item-array (by iterating through all new ranges) - ULONG nSize = Capacity_Impl(pNewRanges); - SfxItemArray aNewItems = new const SfxPoolItem* [ nSize ]; - USHORT n = 0, nNewCount = 0; - if ( _nCount == 0 ) - memset( aNewItems, 0, nSize * sizeof( SfxPoolItem* ) ); - else - { - for ( const USHORT *pRange = pNewRanges; *pRange; pRange += 2 ) - { - // iterate through all ids in the range - for ( USHORT nWID = *pRange; nWID <= pRange[1]; ++nWID, ++n ) - { - // direct move of pointer (not via pool) - SfxItemState eState = GetItemState( nWID, FALSE, aNewItems+n ); - if ( SFX_ITEM_SET == eState ) - { - // increment new item count and possibly increment ref count - ++nNewCount; - aNewItems[n]->AddRef(); - } - else if ( SFX_ITEM_DISABLED == eState ) - { - // put "disabled" item - ++nNewCount; - aNewItems[n] = new SfxVoidItem(0); - } - else if ( SFX_ITEM_DONTCARE == eState ) - { - ++nNewCount; - aNewItems[n] = (SfxPoolItem*)-1; - } - else - { - // default - aNewItems[n] = 0; - } - } - } - // free old items - USHORT nOldTotalCount = TotalCount(); - for ( USHORT nItem = 0; nItem < nOldTotalCount; ++nItem ) - { - const SfxPoolItem *pItem = _aItems[nItem]; - if ( pItem && !IsInvalidItem(pItem) && pItem->Which() ) - _pPool->Remove(*pItem); - } - } - - // replace old items-array and ranges - delete[] _aItems; - _aItems = aNewItems; - _nCount = nNewCount; - - if( pNewRanges == GetPool()->GetFrozenIdRanges() ) - { - delete[] _pWhichRanges; - _pWhichRanges = ( USHORT* ) pNewRanges; - } - else - { - USHORT nCount = Count_Impl(pNewRanges) + 1; - if ( _pWhichRanges != _pPool->GetFrozenIdRanges() ) - delete[] _pWhichRanges; - _pWhichRanges = new USHORT[ nCount ]; - memcpy( _pWhichRanges, pNewRanges, sizeof( USHORT ) * nCount ); - } -} - -// ----------------------------------------------------------------------- - -int SfxItemSet::Set -( - const SfxItemSet& rSet, /* das SfxItemSet, dessen SfxPoolItems - "ubernommen werden sollen */ - - BOOL bDeep /* TRUE (default) - auch die SfxPoolItems aus den ggf. an - rSet vorhandenen Parents werden direkt - in das SfxItemSet "ubernommen - - FALSE - die SfxPoolItems aus den Parents von - rSet werden nicht ber"ucksichtigt */ -) - -/* [Beschreibung] - - Das SfxItemSet nimmt genau die SfxPoolItems an, die auch in - rSet gesetzt sind und im eigenen liegen. Alle - anderen werden entfernt. Der SfxItemPool wird dabei beibehalten, - so da"s die "ubernommenen SfxPoolItems dabei ggf. vom SfxItemPool - von rSet in den SfxItemPool von *this "ubernommen werden. - - SfxPoolItems, f"ur die in rSet IsInvalidItem() == TRUE gilt, - werden als Invalid-Item "ubernommen. - - - [R"uckgabewert] - - int TRUE - es wurden SfxPoolItems "ubernommen - - FALSE - es wurden keine SfxPoolItems "ubernommen, - da z.B. die Which-Bereiche der SfxItemSets - keine Schnittmenge haben oder in der - Schnittmenge keine SfxPoolItems in rSet - gesetzt sind - -*/ - -{ - DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); - int bRet = FALSE; - if ( _nCount ) - ClearItem(); - if ( bDeep ) - { - SfxWhichIter aIter(*this); - USHORT nWhich = aIter.FirstWhich(); - while ( nWhich ) - { - const SfxPoolItem* pItem; - if( SFX_ITEM_SET == rSet.GetItemState( nWhich, TRUE, &pItem ) ) - bRet |= 0 != Put( *pItem, pItem->Which() ); - nWhich = aIter.NextWhich(); - } - } - else - bRet = Put(rSet, FALSE); - - return bRet; -} - -//------------------------------------------------------------------------ - -const SfxPoolItem* SfxItemSet::GetItem -( - USHORT nId, // Slot-Id oder Which-Id des Items - BOOL bSrchInParent, // TRUE: auch in Parent-ItemSets suchen - TypeId aItemType // != 0 => RTTI Pruefung mit Assertion -) const - -/* [Beschreibung] - - Mit dieser Methode wird der Zugriff auf einzelne Items im - SfxItemSet wesentlich vereinfacht. Insbesondere wird die Typpr"ufung - (per Assertion) durchgef"uhrt, wodurch die Applikations-Sourcen - wesentlich "ubersichtlicher werden. In der PRODUCT-Version wird - eine 0 zur"uckgegeben, wenn das gefundene Item nicht von der - angegebenen Klasse ist. Ist kein Item mit der Id 'nWhich' in dem ItemSet, - so wird 0 zurueckgegeben. -*/ - -{ - // ggf. in Which-Id umrechnen - USHORT nWhich = GetPool()->GetWhich(nId); - - // ist das Item gesetzt oder bei bDeep==TRUE verf"ugbar? - const SfxPoolItem *pItem = 0; - SfxItemState eState = GetItemState( nWhich, bSrchInParent, &pItem ); - if ( bSrchInParent && SFX_ITEM_AVAILABLE == eState && - nWhich <= SFX_WHICH_MAX ) - pItem = &_pPool->GetDefaultItem(nWhich); - if ( pItem ) - { - // stimmt der Typ "uberein? - if ( !aItemType || pItem->IsA(aItemType) ) - return pItem; - - // sonst Fehler melden - DBG_ERROR( "invalid argument type" ); - } - - // kein Item gefunden oder falschen Typ gefunden - return 0; -} - - -//------------------------------------------------------------------------ - - -const SfxPoolItem& SfxItemSet::Get( USHORT nWhich, BOOL bSrchInParent) const -{ - DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); - // suche den Bereich in dem das Which steht: - const SfxItemSet* pAktSet = this; - do - { - if( pAktSet->Count() ) - { - SfxItemArray ppFnd = pAktSet->_aItems; - const USHORT* pPtr = pAktSet->_pWhichRanges; - while( *pPtr ) - { - if( *pPtr <= nWhich && nWhich <= *(pPtr+1) ) - { - // in diesem Bereich - ppFnd += nWhich - *pPtr; - if( *ppFnd ) - { - if( (SfxPoolItem*)-1 == *ppFnd ) { - //?MI: folgender code ist Doppelt (unten) - SFX_ASSERT(_pPool, nWhich, "kein Pool, aber Status uneindeutig"); - //!((SfxAllItemSet *)this)->aDefault.SetWhich(nWhich); - //!return aDefault; - return _pPool->GetDefaultItem( nWhich ); - } -#ifdef DBG_UTIL - const SfxPoolItem *pItem = *ppFnd; - DBG_ASSERT( !pItem->ISA(SfxSetItem) || - 0 != &((const SfxSetItem*)pItem)->GetItemSet(), - "SetItem without ItemSet" ); - if ( pItem->ISA(SfxVoidItem) || !pItem->Which() ) - DBG_WARNING( "SFX_WARNING: Getting disabled Item" ); -#endif - return **ppFnd; - } - break; // dann beim Parent suchen - } - ppFnd += *(pPtr+1) - *pPtr + 1; - pPtr += 2; - } - } -// bis zum Ende vom Such-Bereich: was nun ? zum Parent, oder Default ?? -// if( !*pPtr ) // bis zum Ende vom Such-Bereich ? -// break; - } while( bSrchInParent && 0 != ( pAktSet = pAktSet->_pParent )); - - // dann das Default vom Pool holen und returnen - SFX_ASSERT(_pPool, nWhich, "kein Pool, aber Status uneindeutig"); - const SfxPoolItem *pItem = &_pPool->GetDefaultItem( nWhich ); - DBG_ASSERT( !pItem->ISA(SfxSetItem) || - 0 != &((const SfxSetItem*)pItem)->GetItemSet(), - "SetItem without ItemSet" ); - return *pItem; -} - - // Notification-Callback -// ----------------------------------------------------------------------- - -void SfxItemSet::Changed( const SfxPoolItem&, const SfxPoolItem& ) -{ - DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); -} - -// ----------------------------------------------------------------------- - -USHORT SfxItemSet::TotalCount() const -{ - DBG_CHKTHIS(SfxItemSet, 0); // wird im Ctor benutzt bevor vollst. init. - USHORT nRet = 0; - USHORT* pPtr = _pWhichRanges; - while( *pPtr ) - { - nRet += ( *(pPtr+1) - *pPtr ) + 1; - pPtr += 2; - } - return nRet; -} -// ----------------------------------------------------------------------- - -// behalte nur die Items, die auch in rSet enthalten sein (Wert egal) - -void SfxItemSet::Intersect( const SfxItemSet& rSet ) -{ - DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); - DBG_ASSERT(_pPool, "nicht implementiert ohne Pool"); - if( !Count() ) // gar keine gesetzt ? - return; - - // loesche alle Items, die im rSet nicht mehr vorhanden sind - if( !rSet.Count() ) - { - ClearItem(); // alles loeschen - return; - } - - // teste mal, ob sich die Which-Bereiche unterscheiden. - BOOL bEqual = TRUE; - USHORT* pWh1 = _pWhichRanges; - USHORT* pWh2 = rSet._pWhichRanges; - USHORT nSize = 0; - - for( USHORT n = 0; *pWh1 && *pWh2; ++pWh1, ++pWh2, ++n ) - { - if( *pWh1 != *pWh2 ) - { - bEqual = FALSE; - break; - } - if( n & 1 ) - nSize += ( *(pWh1) - *(pWh1-1) ) + 1; - } - bEqual = *pWh1 == *pWh2; // auch die 0 abpruefen - - // sind die Bereiche identisch, ist es einfacher zu handhaben ! - if( bEqual ) - { - SfxItemArray ppFnd1 = _aItems; - SfxItemArray ppFnd2 = rSet._aItems; - - for( ; nSize; --nSize, ++ppFnd1, ++ppFnd2 ) - if( *ppFnd1 && !*ppFnd2 ) - { - // aus dem Pool loeschen - if( !IsInvalidItem( *ppFnd1 ) ) - { - USHORT nWhich = (*ppFnd1)->Which(); - if(nWhich <= SFX_WHICH_MAX) - { - const SfxPoolItem& rNew = _pParent - ? _pParent->Get( nWhich, TRUE ) - : _pPool->GetDefaultItem( nWhich ); - - Changed( **ppFnd1, rNew ); - } - _pPool->Remove( **ppFnd1 ); - } - *ppFnd1 = 0; - --_nCount; - } - } - else - { - SfxItemIter aIter( *this ); - const SfxPoolItem* pItem = aIter.GetCurItem(); - while( TRUE ) - { - USHORT nWhich = IsInvalidItem( pItem ) - ? GetWhichByPos( aIter.GetCurPos() ) - : pItem->Which(); - if( 0 == rSet.GetItemState( nWhich, FALSE ) ) - ClearItem( nWhich ); // loeschen - if( aIter.IsAtEnd() ) - break; - pItem = aIter.NextItem(); - } - } -} - -// ----------------------------------------------------------------------- - -void SfxItemSet::Differentiate( const SfxItemSet& rSet ) -{ - DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); - if( !Count() || !rSet.Count() ) // gar keine gesetzt ? - return; - - // teste mal, ob sich die Which-Bereiche unterscheiden. - BOOL bEqual = TRUE; - USHORT* pWh1 = _pWhichRanges; - USHORT* pWh2 = rSet._pWhichRanges; - USHORT nSize = 0; - - for( USHORT n = 0; *pWh1 && *pWh2; ++pWh1, ++pWh2, ++n ) - { - if( *pWh1 != *pWh2 ) - { - bEqual = FALSE; - break; - } - if( n & 1 ) - nSize += ( *(pWh1) - *(pWh1-1) ) + 1; - } - bEqual = *pWh1 == *pWh2; // auch die 0 abpruefen - - // sind die Bereiche identisch, ist es einfacher zu handhaben ! - if( bEqual ) - { - SfxItemArray ppFnd1 = _aItems; - SfxItemArray ppFnd2 = rSet._aItems; - - for( ; nSize; --nSize, ++ppFnd1, ++ppFnd2 ) - if( *ppFnd1 && *ppFnd2 ) - { - // aus dem Pool loeschen - if( !IsInvalidItem( *ppFnd1 ) ) - { - USHORT nWhich = (*ppFnd1)->Which(); - if(nWhich <= SFX_WHICH_MAX) - { - const SfxPoolItem& rNew = _pParent - ? _pParent->Get( nWhich, TRUE ) - : _pPool->GetDefaultItem( nWhich ); - - Changed( **ppFnd1, rNew ); - } - _pPool->Remove( **ppFnd1 ); - } - *ppFnd1 = 0; - --_nCount; - } - } - else - { - SfxItemIter aIter( *this ); - const SfxPoolItem* pItem = aIter.GetCurItem(); - while( TRUE ) - { - USHORT nWhich = IsInvalidItem( pItem ) - ? GetWhichByPos( aIter.GetCurPos() ) - : pItem->Which(); - if( SFX_ITEM_SET == rSet.GetItemState( nWhich, FALSE ) ) - ClearItem( nWhich ); // loeschen - if( aIter.IsAtEnd() ) - break; - pItem = aIter.NextItem(); - } - - } -} - -// ----------------------------------------------------------------------- -/* Entscheidungstabelle fuer MergeValue[s] - -Grundsaetze: - 1. Ist der Which-Wert im 1.Set "unknown", dann folgt niemals eine Aktion. - 2. Ist der Which-Wert im 2.Set "unknown", dann gilt er als "default". - 3. Es gelten fuer Vergleiche die Werte der "default"-Items. - -1.-Item 2.-Item Values bIgnoreDefs Remove Assign Add - -set set == FALSE - - - -default set == FALSE - - - -dontcare set == FALSE - - - -unknown set == FALSE - - - -set default == FALSE - - - -default default == FALSE - - - -dontcare default == FALSE - - - -unknown default == FALSE - - - -set dontcare == FALSE 1.-Item -1 - -default dontcare == FALSE - -1 - -dontcare dontcare == FALSE - - - -unknown dontcare == FALSE - - - -set unknown == FALSE 1.-Item -1 - -default unknown == FALSE - - - -dontcare unknown == FALSE - - - -unknown unknown == FALSE - - - - -set set != FALSE 1.-Item -1 - -default set != FALSE - -1 - -dontcare set != FALSE - - - -unknown set != FALSE - - - -set default != FALSE 1.-Item -1 - -default default != FALSE - - - -dontcare default != FALSE - - - -unknown default != FALSE - - - -set dontcare != FALSE 1.-Item -1 - -default dontcare != FALSE - -1 - -dontcare dontcare != FALSE - - - -unknown dontcare != FALSE - - - -set unknown != FALSE 1.-Item -1 - -default unknown != FALSE - - - -dontcare unknown != FALSE - - - -unknown unknown != FALSE - - - - -set set == TRUE - - - -default set == TRUE - 2.-Item 2.-Item -dontcare set == TRUE - - - -unknown set == TRUE - - - -set default == TRUE - - - -default default == TRUE - - - -dontcare default == TRUE - - - -unknown default == TRUE - - - -set dontcare == TRUE - - - -default dontcare == TRUE - -1 - -dontcare dontcare == TRUE - - - -unknown dontcare == TRUE - - - -set unknown == TRUE - - - -default unknown == TRUE - - - -dontcare unknown == TRUE - - - -unknown unknown == TRUE - - - - -set set != TRUE 1.-Item -1 - -default set != TRUE - 2.-Item 2.-Item -dontcare set != TRUE - - - -unknown set != TRUE - - - -set default != TRUE - - - -default default != TRUE - - - -dontcare default != TRUE - - - -unknown default != TRUE - - - -set dontcare != TRUE 1.-Item -1 - -default dontcare != TRUE - -1 - -dontcare dontcare != TRUE - - - -unknown dontcare != TRUE - - - -set unknown != TRUE - - - -default unknown != TRUE - - - -dontcare unknown != TRUE - - - -unknown unknown != TRUE - - - -*/ - - -static void MergeItem_Impl( SfxItemPool *_pPool, USHORT &rCount, - const SfxPoolItem **ppFnd1, const SfxPoolItem *pFnd2, - BOOL bIgnoreDefaults ) -{ - DBG_ASSERT( ppFnd1 != 0, "Merging to 0-Item" ); - - // 1. Item ist default? - if ( !*ppFnd1 ) - { - if ( IsInvalidItem(pFnd2) ) - // Entscheidungstabelle: default, dontcare, egal, egal - *ppFnd1 = (SfxPoolItem*) -1; - - else if ( pFnd2 && !bIgnoreDefaults && - _pPool->GetDefaultItem(pFnd2->Which()) != *pFnd2 ) - // Entscheidungstabelle: default, set, !=, FALSE - *ppFnd1 = (SfxPoolItem*) -1; - - else if ( pFnd2 && bIgnoreDefaults ) - // Entscheidungstabelle: default, set, egal, TRUE - *ppFnd1 = &_pPool->Put( *pFnd2 ); - - if ( *ppFnd1 ) - ++rCount; - } - - // 1. Item ist gesetzt? - else if ( !IsInvalidItem(*ppFnd1) ) - { - if ( !pFnd2 ) - { - // 2. Item ist default - if ( !bIgnoreDefaults && - **ppFnd1 != _pPool->GetDefaultItem((*ppFnd1)->Which()) ) - { - // Entscheidungstabelle: set, default, !=, FALSE - _pPool->Remove( **ppFnd1 ); - *ppFnd1 = (SfxPoolItem*) -1; - } - } - else if ( IsInvalidItem(pFnd2) ) - { - // 2. Item ist dontcare - if ( !bIgnoreDefaults || - **ppFnd1 != _pPool->GetDefaultItem( (*ppFnd1)->Which()) ) - { - // Entscheidungstabelle: set, dontcare, egal, FALSE - // oder: set, dontcare, !=, TRUE - _pPool->Remove( **ppFnd1 ); - *ppFnd1 = (SfxPoolItem*) -1; - } - } - else - { - // 2. Item ist gesetzt - if ( **ppFnd1 != *pFnd2 ) - { - // Entscheidungstabelle: set, set, !=, egal - _pPool->Remove( **ppFnd1 ); - *ppFnd1 = (SfxPoolItem*) -1; - } - } - } -} - -// ----------------------------------------------------------------------- - -void SfxItemSet::MergeValues( const SfxItemSet& rSet, BOOL bIgnoreDefaults ) -{ - // Achtung!!! Bei Aenderungen/Bugfixes immer obenstehende Tabelle pflegen! - DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); - DBG_ASSERT( GetPool() == rSet.GetPool(), "MergeValues mit verschiedenen Pools" ); - - // teste mal, ob sich die Which-Bereiche unterscheiden. - BOOL bEqual = TRUE; - USHORT* pWh1 = _pWhichRanges; - USHORT* pWh2 = rSet._pWhichRanges; - USHORT nSize = 0; - - for( USHORT n = 0; *pWh1 && *pWh2; ++pWh1, ++pWh2, ++n ) - { - if( *pWh1 != *pWh2 ) - { - bEqual = FALSE; - break; - } - if( n & 1 ) - nSize += ( *(pWh1) - *(pWh1-1) ) + 1; - } - bEqual = *pWh1 == *pWh2; // auch die 0 abpruefen - - // sind die Bereiche identisch, ist es effizieter zu handhaben ! - if( bEqual ) - { - SfxItemArray ppFnd1 = _aItems; - SfxItemArray ppFnd2 = rSet._aItems; - - for( ; nSize; --nSize, ++ppFnd1, ++ppFnd2 ) - MergeItem_Impl( _pPool, _nCount, ppFnd1, *ppFnd2, bIgnoreDefaults ); - } - else - { - SfxWhichIter aIter( rSet ); - register USHORT nWhich; - while( 0 != ( nWhich = aIter.NextWhich() ) ) - { - const SfxPoolItem* pItem = 0; - rSet.GetItemState( nWhich, TRUE, &pItem ); - if( !pItem ) - { - // nicht gesetzt, also default - if ( !bIgnoreDefaults ) - MergeValue( rSet.GetPool()->GetDefaultItem( nWhich ), bIgnoreDefaults ); - } - else if( IsInvalidItem( pItem ) ) - // dont care - InvalidateItem( nWhich ); - else - MergeValue( *pItem, bIgnoreDefaults ); - } - } -} - -// ----------------------------------------------------------------------- - -void SfxItemSet::MergeValue( const SfxPoolItem& rAttr, BOOL bIgnoreDefaults ) -{ - DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); - SfxItemArray ppFnd = _aItems; - const USHORT* pPtr = _pWhichRanges; - const USHORT nWhich = rAttr.Which(); - while( *pPtr ) - { - // in diesem Bereich? - if( *pPtr <= nWhich && nWhich <= *(pPtr+1) ) - { - ppFnd += nWhich - *pPtr; - MergeItem_Impl( _pPool, _nCount, ppFnd, &rAttr, bIgnoreDefaults ); - break; - } - ppFnd += *(pPtr+1) - *pPtr + 1; - pPtr += 2; - } -} - -// ----------------------------------------------------------------------- - -void SfxItemSet::InvalidateItem( USHORT nWhich ) -{ - DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); - SfxItemArray ppFnd = _aItems; - const USHORT* pPtr = _pWhichRanges; - while( *pPtr ) - { - if( *pPtr <= nWhich && nWhich <= *(pPtr+1) ) - { - // in diesem Bereich - ppFnd += nWhich - *pPtr; - - if( *ppFnd ) // bei mir gesetzt - { - if( (SfxPoolItem*)-1 != *ppFnd ) // noch nicht dontcare ! - { - _pPool->Remove( **ppFnd ); - *ppFnd = (SfxPoolItem*)-1; - } - } - else - { - *ppFnd = (SfxPoolItem*)-1; - ++_nCount; - } - break; - } - ppFnd += *(pPtr+1) - *pPtr + 1; - pPtr += 2; - } -} - -// ----------------------------------------------------------------------- - -USHORT SfxItemSet::GetWhichByPos( USHORT nPos ) const -{ - DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); - USHORT n = 0; - USHORT* pPtr = _pWhichRanges; - while( *pPtr ) - { - n = ( *(pPtr+1) - *pPtr ) + 1; - if( nPos < n ) - return *(pPtr)+nPos; - nPos = nPos - n; - pPtr += 2; - } - DBG_ASSERT( FALSE, "Hier sind wir falsch" ); - return 0; -} - -// ----------------------------------------------------------------------- - -SvStream &SfxItemSet::Store -( - SvStream& rStream, // Zielstream f"ur normale Items - FASTBOOL bDirect // TRUE: Items direkt speicher, FALSE: Surrogate -) const - -/* [Beschreibung] - - Speichert die -Instanz in den angegebenen Stream. Dabei - werden die Surrorage der gesetzten s bzw. ('bDirect==TRUE') - die gesetzten Items selbst wie folgt im Stream abgelegt: - - USHORT (Count) Anzahl der gesetzten Items - Count* _pPool->StoreItem() siehe - - - [Querverweise] - - -*/ - -{ - DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); - DBG_ASSERT( _pPool, "Kein Pool" ); - DBG_ASSERTWARNING( _pPool == _pPool->GetMasterPool(), "kein Master-Pool" ); - - // Position des Counts merken, um ggf. zu korrigieren - ULONG nCountPos = rStream.Tell(); - rStream << _nCount; - - // wenn nichts zu speichern ist, auch keinen ItemIter aufsetzen! - if ( _nCount ) - { - // mitz"ahlen wieviel Items tats"achlich gespeichert werden - USHORT nWrittenCount = 0; // Anzahl in 'rStream' gestreamter Items - - // "uber alle gesetzten Items iterieren - SfxItemIter aIter(*this); - for ( const SfxPoolItem *pItem = aIter.FirstItem(); - pItem; - pItem = aIter.NextItem() ) - { - // Item (ggf. als Surrogat) via Pool speichern lassen - DBG_ASSERT( !IsInvalidItem(pItem), "can't store invalid items" ); - if ( !IsInvalidItem(pItem) && - _pPool->StoreItem( rStream, *pItem, bDirect ) ) - // Item wurde in 'rStream' gestreamt - ++nWrittenCount; - }; - - // weniger geschrieben als enthalten (z.B. altes Format) - if ( nWrittenCount != _nCount ) - { - // tats"achlichen Count im Stream ablegen - ULONG nPos = rStream.Tell(); - rStream.Seek( nCountPos ); - rStream << nWrittenCount; - rStream.Seek( nPos ); - } - } - - return rStream; -} - -// ----------------------------------------------------------------------- - -SvStream &SfxItemSet::Load -( - SvStream& rStream, // Stream, aus dem geladen werden soll - - FASTBOOL bDirect, /* TRUE - Items werden direkt aus dem Stream - gelesen, nicht "uber Surrogate - - FALSE (default) - Items werden "uber Surrogate gelesen */ - - const SfxItemPool* pRefPool /* Pool, der die Surrogate aufl"osen kann - (z.B. zum Einf"ugen von Dokumenten) */ -) - -/* [Beschreibung] - - Diese Methode l"adt ein aus einem Stream. Falls der - ohne Ref-Counts geladen wurde, werden die geladenen - Item-Referenzen in den Items hochgez"ahlt, ansonsten wird vorausgesetzt, - da\s sie schon beim Laden des SfxItemPools ber"ucksichtigt waren. - - [Querverweise] - - -*/ - -{ - DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); - DBG_ASSERT( _pPool, "Kein Pool"); - DBG_ASSERTWARNING( _pPool == _pPool->GetMasterPool(), "Kein Master-Pool"); - - // kein Ref-Pool => Surrogate mit Pool des ItemSets aufl"osen - if ( !pRefPool ) - pRefPool = _pPool; - - // Anzahl der zu ladenden Items laden und dann ebensoviele Items - USHORT nCount = 0; - rStream >> nCount; - for ( USHORT i = 0; i < nCount; ++i ) - { - // Surrogat/Item laden und (Surrogat) aufl"osen lassen - const SfxPoolItem *pItem = - _pPool->LoadItem( rStream, bDirect, pRefPool ); - - // konnte ein Item geladen oder via Surrogat aufgel"ost werden? - if ( pItem ) - { - // Position f"ur Item-Pointer im Set suchen - USHORT nWhich = pItem->Which(); - SfxItemArray ppFnd = _aItems; - const USHORT* pPtr = _pWhichRanges; - while ( *pPtr ) - { - // in diesem Bereich? - if ( *pPtr <= nWhich && nWhich <= *(pPtr+1) ) - { - // Item-Pointer im Set merken - ppFnd += nWhich - *pPtr; - SFX_ASSERT( !*ppFnd, nWhich, "Item doppelt eingetragen"); - *ppFnd = pItem; - ++_nCount; - break; - } - - // im Range-Array und Item-Array zum n"achsten Which-Range - ppFnd += *(pPtr+1) - *pPtr + 1; - pPtr += 2; - } - } - } - - return rStream; -} - -// ----------------------------------------------------------------------- - -int SfxItemSet::operator==(const SfxItemSet &rCmp) const -{ - DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); - DBG_CHKOBJ(&rCmp, SfxItemSet, DbgCheckItemSet); - - // besonders schnell zu ermittelnde Werte muessen gleich sein - if ( _pParent != rCmp._pParent || - _pPool != rCmp._pPool || - Count() != rCmp.Count() ) - return FALSE; - - // Ranges durchzaehlen lassen dauert laenger, muss aber auch gleich sein - USHORT nCount1 = TotalCount(); - USHORT nCount2 = rCmp.TotalCount(); - if ( nCount1 != nCount2 ) - return FALSE; - - // sind die Ranges selbst ungleich? - for ( USHORT nRange = 0; _pWhichRanges[nRange]; nRange += 2 ) - if ( _pWhichRanges[nRange] != rCmp._pWhichRanges[nRange] || - _pWhichRanges[nRange+1] != rCmp._pWhichRanges[nRange+1] ) - { - // dann m"ussen wir die langsame Methode verwenden - SfxWhichIter aIter( *this ); - for ( USHORT nWh = aIter.FirstWhich(); - nWh; - nWh = aIter.NextWhich() ) - { - // wenn die Pointer von poolable Items ungleich sind, - // muessen die Items gleich sein - const SfxPoolItem *pItem1 = 0, *pItem2 = 0; - if ( GetItemState( nWh, FALSE, &pItem1 ) != - rCmp.GetItemState( nWh, FALSE, &pItem2 ) || - ( pItem1 != pItem2 && - ( !pItem1 || IsInvalidItem(pItem1) || - ( _pPool->IsItemFlag(*pItem1, SFX_ITEM_POOLABLE) && - *pItem1 != *pItem2 ) ) ) ) - return FALSE; - } - - return TRUE; - } - - // Pointer alle gleich? - if ( 0 == memcmp( _aItems, rCmp._aItems, nCount1 * sizeof(_aItems[0]) ) ) - return TRUE; - - // dann werden wir wohl alle einzeln vergleichen muessen - const SfxPoolItem **ppItem1 = (const SfxPoolItem**) _aItems; - const SfxPoolItem **ppItem2 = (const SfxPoolItem**) rCmp._aItems; - for ( USHORT nPos = 0; nPos < nCount1; ++nPos ) - { - // wenn die Pointer von poolable Items ungleich sind, - // muessen die Items gleich sein - if ( *ppItem1 != *ppItem2 && - ( ( !*ppItem1 || !*ppItem2 ) || - ( IsInvalidItem(*ppItem1) || IsInvalidItem(*ppItem2) ) || - ( _pPool->IsItemFlag(**ppItem1, SFX_ITEM_POOLABLE) ) || - **ppItem1 != **ppItem2 ) ) - return FALSE; - - ++ppItem1; - ++ppItem2; - } - - return TRUE; -} - -// ----------------------------------------------------------------------- - -SfxItemSet *SfxItemSet::Clone(BOOL bItems, SfxItemPool *pToPool ) const -{ - DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); - if ( pToPool && pToPool != _pPool ) - { - SfxItemSet *pNewSet = new SfxItemSet( *pToPool, _pWhichRanges ); - if ( bItems ) - { - SfxWhichIter aIter(*pNewSet); - USHORT nWhich = aIter.FirstWhich(); - while ( nWhich ) - { - const SfxPoolItem* pItem; - if ( SFX_ITEM_SET == GetItemState( nWhich, FALSE, &pItem ) ) - pNewSet->Put( *pItem, pItem->Which() ); - nWhich = aIter.NextWhich(); - } - } - return pNewSet; - } - else - return bItems - ? new SfxItemSet(*this) - : new SfxItemSet(*_pPool, _pWhichRanges); -} - -// ----------------------------------------------------------------------- - -int SfxItemSet::PutDirect(const SfxPoolItem &rItem) -{ - DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); - SfxItemArray ppFnd = _aItems; - const USHORT* pPtr = _pWhichRanges; - const USHORT nWhich = rItem.Which(); -#ifdef DBG_UTIL - IsPoolDefaultItem(&rItem) || _pPool->GetSurrogate(&rItem); - // nur Assertion in den callees provozieren -#endif - while( *pPtr ) - { - if( *pPtr <= nWhich && nWhich <= *(pPtr+1) ) - { - // in diesem Bereich - ppFnd += nWhich - *pPtr; - const SfxPoolItem* pOld = *ppFnd; - if( pOld ) // schon einer vorhanden - { - if( rItem == **ppFnd ) - return FALSE; // schon vorhanden ! - _pPool->Remove( *pOld ); - } - else - ++_nCount; - - // den neuen eintragen - if( IsPoolDefaultItem(&rItem) ) - *ppFnd = &_pPool->Put( rItem ); - else - { - *ppFnd = &rItem; - if( !IsStaticDefaultItem( &rItem ) ) - rItem.AddRef(); - } - - return TRUE; - } - ppFnd += *(pPtr+1) - *pPtr + 1; - pPtr += 2; - } - return FALSE; -} - -// ----------------------------------------------------------------------- - -SfxAllItemSet::SfxAllItemSet( SfxItemPool &rPool ) -: SfxItemSet(rPool, (const USHORT*) 0), - aDefault(0), - nFree(nInitCount) -{ - // initial keine Items - _aItems = 0; - - // nInitCount Paare an USHORTs fuer Ranges allozieren - _pWhichRanges = new USHORT[ nInitCount + 1 ]; - memset( _pWhichRanges, 0, ( nInitCount + 1 ) * sizeof(USHORT) ); -} - - -// ----------------------------------------------------------------------- - - -SfxAllItemSet::SfxAllItemSet(const SfxItemSet &rCopy) -: SfxItemSet(rCopy), - aDefault(0), - nFree(0) -{ -} - -// ----------------------------------------------------------------------- - - - -SfxAllItemSet::SfxAllItemSet(const SfxAllItemSet &rCopy) -: SfxItemSet(rCopy), - aDefault(0), - nFree(0) -/* [Anmerkung] - - Der mu\s sein, da sonst vom Compiler einer generiert wird, er nimmt - nicht den Ctor mit der 'const SfxItemSet&'! -*/ -{ -} - -// ----------------------------------------------------------------------- - -static USHORT *AddRanges_Impl( - USHORT *pUS, std::ptrdiff_t nOldSize, USHORT nIncr) - -/* Diese interne Funktion erzeugt ein neues Which-Range-Array, welches von - dem 'nOldSize'-USHORTs langen 'pUS' kopiert wird und hinten an Platz - f"ur 'nIncr' neue USHORTs hat. Das terminierende USHORT mit der '0' - wird weder in 'nOldSize' noch in 'nIncr' mitgez"ahlt, sondern implizit - hinzugerechnet. - - Das neue Which-Range-Array wird als Returnwert zur"uckgegeben, das alte - 'pUS' freigegeben. -*/ - -{ - // neues Which-Range-Array anlegen - USHORT *pNew = new USHORT[ nOldSize + nIncr + 1 ]; - - // die alten Ranges "ubernehmen - memcpy( pNew, pUS, nOldSize * sizeof(USHORT) ); - - // die neuen auf 0 initialisieren - memset( pNew + nOldSize, 0, ( nIncr + 1 ) * sizeof(USHORT) ); - - // das alte Array freigeben - delete[] pUS; - - return pNew; -} - -// ----------------------------------------------------------------------- - -static SfxItemArray AddItem_Impl(SfxItemArray pItems, USHORT nOldSize, USHORT nPos) - -/* Diese interne Funktion erzeugt ein neues ItemArray, welches von 'pItems' - kopiert wird, an der Position 'nPos' jedoch Platz f"ur einen neuen - ItemPointer hat. - - Das neue ItemArray wird als Returnwert zur"uckgegeben, das alte 'pItems' - wird freigegeben. -*/ - -{ - // neues ItemArray anlegen - SfxItemArray pNew = new const SfxPoolItem*[nOldSize+1]; - - // war schon vorher eins da? - if ( pItems ) - { - // alte Items vor nPos kopieren - if ( nPos ) - memcpy( (void*) pNew, pItems, nPos * sizeof(SfxPoolItem **) ); - - // alte Items hinter nPos kopieren - if ( nPos < nOldSize ) - memcpy( (void*) (pNew + nPos + 1), pItems + nPos, - (nOldSize-nPos) * sizeof(SfxPoolItem **) ); - } - - // neues Item initialisieren - *(pNew + nPos) = 0; - - // altes ItemArray freigeben - delete[] pItems; - - return pNew; -} - -// ----------------------------------------------------------------------- - -const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, USHORT nWhich ) - -// Putten mit automatischer Erweiterung der Whichs-Ids um die ID -// des Items. - -{ - USHORT nPos = 0; // Position f"ur 'rItem' in '_aItems' - const USHORT nItemCount = TotalCount(); - - // erstmal sehen, ob es schon einen passenden Bereich gibt - USHORT *pPtr = _pWhichRanges; - while ( *pPtr ) - { - // Which-Id liegt in diesem Bereich? - if( *pPtr <= nWhich && nWhich <= *(pPtr+1) ) - { - // Einfuegen - nPos += nWhich - *pPtr; - break; - } - - // Position des Items in _aItems mitf"uhren - nPos += *(pPtr+1) - *pPtr + 1; - - // zum n"achsten Bereich - pPtr += 2; - } - - // Which-Id noch nicht vorhanden? - if ( !*pPtr ) - { - // suchen, ob man sie irgendwo dranpacken kann - pPtr = _pWhichRanges; - nPos = 0; - while ( *pPtr ) - { - // Which-Id liegt exakt vor diesem Bereich? - if ( (nWhich+1) == *pPtr ) - { - // Bereich waechst nach unten - (*pPtr)--; - - // vor erstem Item dieses Bereichs Platz schaffen - _aItems = AddItem_Impl(_aItems, nItemCount, nPos); - break; - } - - // Which-Id liegt exakt hinter diesem Bereich? - else if ( (nWhich-1) == *(pPtr+1) ) - { - // Bereich waechst nach oben - (*(pPtr+1))++; - - // hinter letztem Item dieses Bereichs Platz schaffen - nPos += nWhich - *pPtr; - _aItems = AddItem_Impl(_aItems, nItemCount, nPos); - break; - } - - // Position des Items in _aItems mitf"uhren - nPos += *(pPtr+1) - *pPtr + 1; - - // zum n"achsten Bereich - pPtr += 2; - } - } - - // keinen erweiterbaren Bereich gefunden? - if ( !*pPtr ) - { - // kein Platz mehr in _pWhichRanges => erweitern - std::ptrdiff_t nSize = pPtr - _pWhichRanges; - if( !nFree ) - { - _pWhichRanges = AddRanges_Impl(_pWhichRanges, nSize, nInitCount); - nFree += nInitCount; - } - - // neuen Which-Range anh"angen - pPtr = _pWhichRanges + nSize; - *pPtr++ = nWhich; - *pPtr = nWhich; - nFree -= 2; - - // Itemarray vergroessern - nPos = nItemCount; - _aItems = AddItem_Impl(_aItems, nItemCount, nPos); - } - - // neues Item in Pool aufnehmen - const SfxPoolItem& rNew = _pPool->Put( rItem, nWhich ); - - // altes Item merken - BOOL bIncrementCount = FALSE; - const SfxPoolItem* pOld = *( _aItems + nPos ); - if ( reinterpret_cast< SfxPoolItem* >( -1 ) == pOld ) // state "dontcare" - pOld = NULL; - if ( !pOld ) - { - bIncrementCount = TRUE; - pOld = _pParent ? - &_pParent->Get( nWhich, TRUE ) - : nWhich <= SFX_WHICH_MAX ? &_pPool->GetDefaultItem( nWhich ) : 0; - } - - // neue Item in ItemSet aufnehmen - *(_aItems + nPos) = &rNew; - - // Changed Notification versenden - if ( pOld ) - { - Changed( *pOld, rNew ); - if ( !IsDefaultItem(pOld) ) - _pPool->Remove( *pOld ); - } - - if ( bIncrementCount ) - ++_nCount; - - return &rNew; -} - -// ----------------------------------------------------------------------- - - -/* Diese Methode wird forwarded, damit sie nicht durch die anderen - Put-Methoden dieser SubClass gehided wird. -*/ - -int SfxAllItemSet::Put( const SfxItemSet& rSet, BOOL bInvalidAsDefault ) -{ - //? pruefen, ob Which-Ranges erweitert werden - return SfxItemSet::Put( rSet, bInvalidAsDefault ); -} - -// ----------------------------------------------------------------------- -// Item disablen, wenn durch ein VoidItem mit dem Which-Wert 0 ausgedrueckt - -void SfxItemSet::DisableItem(USHORT nWhich) -{ - DBG_CHKTHIS(SfxItemSet, 0); - Put( SfxVoidItem(0), nWhich ); -} - -// ----------------------------------------------------------------------- - -#if 0 -BOOL SfxAllItemSet::Remove(USHORT nWhich) -{ - DBG_CHKTHIS(SfxAllItemSet, 0); - USHORT *pPtr = _pWhichRanges; - USHORT nPos = 0; - while( *pPtr ) - { - if( *pPtr <= nWhich && nWhich <= *(pPtr+1) ) - { - USHORT *pTmp = pPtr; - USHORT nLeft = 0; - USHORT nRest = 0; - while(*++pTmp){ - if( nLeft & 1 ) - nRest = *pTmp - *(pTmp-1) + 1; - ++nLeft; - } - - // in diesem Bereich - nPos += nWhich - *pPtr; - nRest -= nWhich - *pPtr; - // 3,3 - if(*pPtr == nWhich && *(pPtr+1) == nWhich) { - memmove(pPtr, pPtr + 2, nLeft * sizeof(USHORT)); - nFree += 2; - } - // Anfang - else if(*pPtr == nWhich) - (*pPtr)++; - // Ende - else if(*(pPtr+1) == nWhich) - (*(pPtr+1))--; - else { - if(nPos + nRest + 2 > nFree) { - USHORT nOf = pPtr - _pWhichRanges; - _pWhichRanges = IncrSize(_pWhichRanges, nPos + nRest, nInitCount); - nFree += nInitCount; - pPtr = _pWhichRanges + nOf; - } - memmove(pPtr +2, pPtr, (nLeft+2) * sizeof(USHORT)); - *++pPtr = nWhich-1; - *++pPtr = nWhich+1; - nFree -= 2; - } - SfxPoolItem* pItem = *( _aItems + nPos ); - if( pItem ) - { - if(_pPool) - _pPool->Remove(*pItem ); - else - delete pItem; - --_nCount; - } - memmove(_aItems + nPos +1, _aItems + nPos, - sizeof(SfxPoolItem *) * (nRest - 1)); - break; // dann beim Parent suchen - } - nPos += *(pPtr+1) - *pPtr + 1; - pPtr += 2; - } - return *pPtr? TRUE: FALSE; -} -#endif - -// ----------------------------------------------------------------------- - -SfxItemSet *SfxAllItemSet::Clone(BOOL bItems, SfxItemPool *pToPool ) const -{ - DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet); - if ( pToPool && pToPool != _pPool ) - { - SfxAllItemSet *pNewSet = new SfxAllItemSet( *pToPool ); - if ( bItems ) - pNewSet->Set( *this ); - return pNewSet; - } - else - return bItems ? new SfxAllItemSet(*this) : new SfxAllItemSet(*_pPool); -} - diff --git a/svtools/source/items1/lckbitem.cxx b/svtools/source/items1/lckbitem.cxx deleted file mode 100644 index c848e377b257..000000000000 --- a/svtools/source/items1/lckbitem.cxx +++ /dev/null @@ -1,194 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: lckbitem.cxx,v $ - * $Revision: 1.8 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#define _LCKBITEM_CXX -#include -#include -#include -#include -#include - -// STATIC DATA ----------------------------------------------------------- - - -// ----------------------------------------------------------------------- - -TYPEINIT1_AUTOFACTORY(SfxLockBytesItem, SfxPoolItem); - -// ----------------------------------------------------------------------- - -SfxLockBytesItem::SfxLockBytesItem() -{ -} - -// ----------------------------------------------------------------------- - -SfxLockBytesItem::SfxLockBytesItem( USHORT nW, SvLockBytes *pLockBytes ) -: SfxPoolItem( nW ), - _xVal( pLockBytes ) -{ -} - -// ----------------------------------------------------------------------- - -SfxLockBytesItem::SfxLockBytesItem( USHORT nW, SvStream &rStream ) -: SfxPoolItem( nW ) -{ - rStream.Seek( 0L ); - _xVal = new SvLockBytes( new SvCacheStream(), TRUE ); - - SvStream aLockBytesStream( _xVal ); - rStream >> aLockBytesStream; -} - -// ----------------------------------------------------------------------- - -SfxLockBytesItem::SfxLockBytesItem( const SfxLockBytesItem& rItem ) -: SfxPoolItem( rItem ), - _xVal( rItem._xVal ) -{ -} - -// ----------------------------------------------------------------------- - -SfxLockBytesItem::~SfxLockBytesItem() -{ -} - -// ----------------------------------------------------------------------- - -int SfxLockBytesItem::operator==( const SfxPoolItem& rItem ) const -{ - return ((SfxLockBytesItem&)rItem)._xVal == _xVal; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxLockBytesItem::Clone(SfxItemPool *) const -{ - return new SfxLockBytesItem( *this ); -} - -// ----------------------------------------------------------------------- - -#define MAX_BUF 32000 - -SfxPoolItem* SfxLockBytesItem::Create( SvStream &rStream, USHORT ) const -{ - sal_uInt32 nSize = 0; - ULONG nActRead = 0; - sal_Char cTmpBuf[MAX_BUF]; - SvMemoryStream aNewStream; - rStream >> nSize; - - do { - ULONG nToRead; - if( (nSize - nActRead) > MAX_BUF ) - nToRead = MAX_BUF; - else - nToRead = nSize - nActRead; - nActRead += rStream.Read( cTmpBuf, nToRead ); - aNewStream.Write( cTmpBuf, nToRead ); - } while( nSize > nActRead ); - - return new SfxLockBytesItem( Which(), aNewStream ); -} - -// ----------------------------------------------------------------------- - -SvStream& SfxLockBytesItem::Store(SvStream &rStream, USHORT ) const -{ - SvStream aLockBytesStream( _xVal ); - sal_uInt32 nSize = aLockBytesStream.Seek( STREAM_SEEK_TO_END ); - aLockBytesStream.Seek( 0L ); - - rStream << nSize; - rStream << aLockBytesStream; - - return rStream; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL SfxLockBytesItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE ) -{ - com::sun::star::uno::Sequence< sal_Int8 > aSeq; - if ( rVal >>= aSeq ) - { - if ( aSeq.getLength() ) - { - SvCacheStream* pStream = new SvCacheStream; - pStream->Write( (void*)aSeq.getConstArray(), aSeq.getLength() ); - pStream->Seek(0); - - _xVal = new SvLockBytes( pStream, TRUE ); - } - else - _xVal = NULL; - - return TRUE; - } - - DBG_ERROR( "SfxLockBytesItem::PutValue - Wrong type!" ); - return FALSE; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL SfxLockBytesItem::QueryValue( com::sun::star::uno::Any& rVal,BYTE ) const -{ - if ( _xVal.Is() ) - { - sal_uInt32 nLen; - SvLockBytesStat aStat; - - if ( _xVal->Stat( &aStat, SVSTATFLAG_DEFAULT ) == ERRCODE_NONE ) - nLen = aStat.nSize; - else - return FALSE; - - ULONG nRead = 0; - com::sun::star::uno::Sequence< sal_Int8 > aSeq( nLen ); - - _xVal->ReadAt( 0, aSeq.getArray(), nLen, &nRead ); - rVal <<= aSeq; - } - else - { - com::sun::star::uno::Sequence< sal_Int8 > aSeq( 0 ); - rVal <<= aSeq; - } - - return TRUE; -} - diff --git a/svtools/source/items1/makefile.mk b/svtools/source/items1/makefile.mk deleted file mode 100644 index 9a7d13ff7d0f..000000000000 --- a/svtools/source/items1/makefile.mk +++ /dev/null @@ -1,79 +0,0 @@ -#************************************************************************* -# -# 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 -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.5 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. -PRJNAME=svtools -TARGET=items1 -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svl.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES=\ - $(SLO)$/bintitem.obj \ - $(SLO)$/cenumitm.obj \ - $(SLO)$/cintitem.obj \ - $(SLO)$/cntwall.obj \ - $(SLO)$/cstitem.obj \ - $(SLO)$/ctypeitm.obj \ - $(SLO)$/custritm.obj \ - $(SLO)$/dateitem.obj \ - $(SLO)$/dtritem.obj \ - $(SLO)$/frqitem.obj \ - $(SLO)$/ilstitem.obj \ - $(SLO)$/itemiter.obj \ - $(SLO)$/itempool.obj \ - $(SLO)$/itemprop.obj \ - $(SLO)$/itemset.obj \ - $(SLO)$/lckbitem.obj \ - $(SLO)$/poolio.obj \ - $(SLO)$/stylepool.obj \ - $(SLO)$/poolitem.obj \ - $(SLO)$/sfontitm.obj \ - $(SLO)$/sitem.obj \ - $(SLO)$/slstitm.obj \ - $(SLO)$/tfrmitem.obj \ - $(SLO)$/tresitem.obj \ - $(SLO)$/whiter.obj \ - $(SLO)$/visitem.obj - -SRS1NAME=$(TARGET) -SRC1FILES=\ - cstitem.src - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/svtools/source/items1/nranges.cxx b/svtools/source/items1/nranges.cxx deleted file mode 100644 index e12c7428d513..000000000000 --- a/svtools/source/items1/nranges.cxx +++ /dev/null @@ -1,853 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: nranges.cxx,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -// compiled via include from itemset.cxx only! - -//======================================================================== - -#ifdef DBG_UTIL - -#define DBG_CHECK_RANGES(NUMTYPE, pArr) \ - for ( const NUMTYPE *pRange = pArr; *pRange; pRange += 2 ) \ - { \ - DBG_ASSERT( pRange[0] <= pRange[1], "ranges must be sorted" ); \ - DBG_ASSERT( !pRange[2] || ( pRange[2] - pRange[1] ) > 1, \ - "ranges must be sorted and discrete" ); \ - } - -#else - -#define DBG_CHECK_RANGES(NUMTYPE,pArr) - -#endif - -//============================================================================ -inline void Swap_Impl(const NUMTYPE *& rp1, const NUMTYPE *& rp2) -{ - const NUMTYPE * pTemp = rp1; - rp1 = rp2; - rp2 = pTemp; -} - -//======================================================================== - -NUMTYPE InitializeRanges_Impl( NUMTYPE *&rpRanges, va_list pArgs, - NUMTYPE nWh1, NUMTYPE nWh2, NUMTYPE nNull ) - -/**

Description

- - Creates an USHORT-ranges-array in 'rpRanges' using 'nWh1' and 'nWh2' as - first range, 'nNull' as terminator or start of 2nd range and 'pArgs' as - remaider. - - It returns the number of NUMTYPEs which are contained in the described - set of NUMTYPEs. -*/ - -{ - NUMTYPE nSize = 0, nIns = 0; - USHORT nCnt = 0; - SvNums aNumArr( 11, 8 ); - aNumArr.Insert( nWh1, nCnt++ ); - aNumArr.Insert( nWh2, nCnt++ ); - DBG_ASSERT( nWh1 <= nWh2, "Ungueltiger Bereich" ); - nSize += nWh2 - nWh1 + 1; - aNumArr.Insert( nNull, nCnt++ ); - while ( 0 != - ( nIns = - sal::static_int_cast< NUMTYPE >( - va_arg( pArgs, NUMTYPE_ARG ) ) ) ) - { - aNumArr.Insert( nIns, nCnt++ ); - if ( 0 == (nCnt & 1) ) // 4,6,8, usw. - { - DBG_ASSERT( aNumArr[ nCnt-2 ] <= nIns, "Ungueltiger Bereich" ); - nSize += nIns - aNumArr[ nCnt-2 ] + 1; - } - } - va_end( pArgs ); - - DBG_ASSERT( 0 == (nCnt & 1), "ungerade Anzahl von Which-Paaren!" ); - - // so, jetzt sind alle Bereiche vorhanden und - rpRanges = new NUMTYPE[ nCnt+1 ]; - memcpy( rpRanges, aNumArr.GetData(), sizeof(NUMTYPE) * nCnt ); - *(rpRanges+nCnt) = 0; - - return nSize; -} - -//------------------------------------------------------------------------ - -NUMTYPE Count_Impl( const NUMTYPE *pRanges ) - -/**

Description

- - Determines the number of NUMTYPEs in an 0-terminated array of pairs of - NUMTYPEs. The terminating 0 is not included in the count. -*/ - -{ - NUMTYPE nCount = 0; - while ( *pRanges ) - { - nCount += 2; - pRanges += 2; - } - return nCount; -} - -//------------------------------------------------------------------------ - -NUMTYPE Capacity_Impl( const NUMTYPE *pRanges ) - -/**

Description

- - Determines the total number of NUMTYPEs described in an 0-terminated - array of pairs of NUMTYPEs, each representing an range of NUMTYPEs. -*/ - -{ - NUMTYPE nCount = 0; - - if ( pRanges ) - { - while ( *pRanges ) - { - nCount += pRanges[1] - pRanges[0] + 1; - pRanges += 2; - } - } - return nCount; -} - -//------------------------------------------------------------------------ - -SfxNumRanges::SfxNumRanges( const SfxNumRanges &rOrig ) - -/**

Description

- - Copy-Ctor. -*/ - -{ - if ( rOrig._pRanges ) - { - NUMTYPE nCount = Count_Impl( rOrig._pRanges ) + 1; - _pRanges = new NUMTYPE[nCount]; - memcpy( _pRanges, rOrig._pRanges, sizeof(NUMTYPE) * nCount ); - } - else - _pRanges = 0; -} - -//------------------------------------------------------------------------ - -SfxNumRanges::SfxNumRanges( NUMTYPE nWhich1, NUMTYPE nWhich2 ) - -/**

Description

- - Constructs an SfxNumRanges-instance from one range of NUMTYPEs. - - precondition: - nWhich1 <= nWhich2 -*/ - -: _pRanges( new NUMTYPE[3] ) -{ - _pRanges[0] = nWhich1; - _pRanges[1] = nWhich2; - _pRanges[2] = 0; -} - -//------------------------------------------------------------------------ - -SfxNumRanges::SfxNumRanges( NUMTYPE_ARG nWh0, NUMTYPE_ARG nWh1, NUMTYPE_ARG nNull, ... ) - -/**

Description

- - Constructs an SfxNumRanges-instance from more than one sorted ranges of - NUMTYPEs terminated with one 0. - - precondition: for each n >= 0 && n < nArgs - nWh(2n) <= nWh(2n+1) && ( nWh(2n+2)-nWh(2n+1) ) > 1 -*/ - -{ - va_list pArgs; - va_start( pArgs, nNull ); - InitializeRanges_Impl( - _pRanges, pArgs, sal::static_int_cast< NUMTYPE >(nWh0), - sal::static_int_cast< NUMTYPE >(nWh1), - sal::static_int_cast< NUMTYPE >(nNull)); - DBG_CHECK_RANGES(NUMTYPE, _pRanges); -} - -//------------------------------------------------------------------------ - -SfxNumRanges::SfxNumRanges( const NUMTYPE* pArr ) - -/**

Description

- - Constcurts an SfxNumRanges-instance from an sorted ranges of NUMTYPEs, - terminates with on 0. - - precondition: for each n >= 0 && n < (sizeof(pArr)-1) - pArr[2n] <= pArr[2n+1] && ( pArr[2n+2]-pArr[2n+1] ) > 1 -*/ - -{ - DBG_CHECK_RANGES(NUMTYPE, pArr); - NUMTYPE nCount = Count_Impl(pArr) + 1; - _pRanges = new NUMTYPE[ nCount ]; - memcpy( _pRanges, pArr, sizeof(NUMTYPE) * nCount ); -} - -//------------------------------------------------------------------------ - -BOOL SfxNumRanges::operator==( const SfxNumRanges &rOther ) const -{ - // Object pointers equal? - if ( this == &rOther ) - return TRUE; - - // Ranges pointers equal? - if ( _pRanges == rOther._pRanges ) - return TRUE; - - // Counts equal? - NUMTYPE nCount = Count(); - if ( nCount != rOther.Count() ) - return FALSE; - - // Check arrays. - NUMTYPE n = 0; - while( _pRanges[ n ] != 0 ) - { - // Elements at current position equal? - if ( _pRanges[ n ] != rOther._pRanges[ n ] ) - return FALSE; - - ++n; - } - - return TRUE; -} - -//------------------------------------------------------------------------ - -SfxNumRanges& SfxNumRanges::operator = -( - const SfxNumRanges &rRanges -) - -/**

Description

- - Assigns ranges from 'rRanges' to '*this'. -*/ - -{ - // special case: assign itself - if ( &rRanges == this ) - return *this; - - delete[] _pRanges; - - // special case: 'rRanges' is empty - if ( rRanges.IsEmpty() ) - _pRanges = 0; - else - { - // copy ranges - NUMTYPE nCount = Count_Impl( rRanges._pRanges ) + 1; - _pRanges = new NUMTYPE[ nCount ]; - memcpy( _pRanges, rRanges._pRanges, sizeof(NUMTYPE) * nCount ); - } - return *this; -} - -//------------------------------------------------------------------------ - -SfxNumRanges& SfxNumRanges::operator += -( - const SfxNumRanges &rRanges -) - -/**

Description

- - Merges *this with 'rRanges'. - - for each NUMTYPE n: - this->Contains( n ) || rRanges.Contains( n ) => this'->Contains( n ) - !this->Contains( n ) && !rRanges.Contains( n ) => !this'->Contains( n ) -*/ - -{ - // special cases: one is empty - if ( rRanges.IsEmpty() ) - return *this; - if ( IsEmpty() ) - return *this = rRanges; - - // First, run thru _pRanges and rRanges._pRanges and determine the size of - // the new, merged ranges: - NUMTYPE nCount = 0; - const NUMTYPE * pRA = _pRanges; - const NUMTYPE * pRB = rRanges._pRanges; - - for (;;) - { - // The first pair of pRA has a lower lower bound than the first pair - // of pRB: - if (pRA[0] > pRB[0]) - Swap_Impl(pRA, pRB); - - // We are done with the merging if at least pRA is exhausted: - if (!pRA[0]) - break; - - for (;;) - { - // Skip those pairs in pRB that completely lie in the first pair - // of pRA: - while (pRB[1] <= pRA[1]) - { - pRB += 2; - - // Watch out for exhaustion of pRB: - if (!pRB[0]) - { - Swap_Impl(pRA, pRB); - goto count_rest; - } - } - - // If the next pair of pRA does not at least touch the current new - // pair, we are done with the current new pair: - if (pRB[0] > pRA[1] + 1) - break; - - // The next pair of pRB extends the current new pair; first, - // extend the current new pair (we are done if pRB is then - // exhausted); second, switch the roles of pRA and pRB in order to - // merge in those following pairs of the original pRA that will - // lie in the (now larger) current new pair or will even extend it - // further: - pRA += 2; - if (!pRA[0]) - goto count_rest; - Swap_Impl(pRA, pRB); - } - - // Done with the current new pair: - pRA += 2; - nCount += 2; - } - - // Only pRB has more pairs available, pRA is already exhausted: -count_rest: - for (; pRB[0]; pRB += 2) - nCount += 2; - - // Now, create new ranges of the correct size and, on a second run thru - // _pRanges and rRanges._pRanges, copy the merged pairs into the new - // ranges: - NUMTYPE * pNew = new NUMTYPE[nCount + 1]; - pRA = _pRanges; - pRB = rRanges._pRanges; - NUMTYPE * pRN = pNew; - - for (;;) - { - // The first pair of pRA has a lower lower bound than the first pair - // of pRB: - if (pRA[0] > pRB[0]) - Swap_Impl(pRA, pRB); - - // We are done with the merging if at least pRA is exhausted: - if (!pRA[0]) - break; - - // Lower bound of current new pair is already known: - *pRN++ = pRA[0]; - - for (;;) - { - // Skip those pairs in pRB that completely lie in the first pair - // of pRA: - while (pRB[1] <= pRA[1]) - { - pRB += 2; - - // Watch out for exhaustion of pRB: - if (!pRB[0]) - { - Swap_Impl(pRA, pRB); - ++pRB; - goto copy_rest; - } - } - - // If the next pair of pRA does not at least touch the current new - // pair, we are done with the current new pair: - if (pRB[0] > pRA[1] + 1) - break; - - // The next pair of pRB extends the current new pair; first, - // extend the current new pair (we are done if pRB is then - // exhausted); second, switch the roles of pRA and pRB in order to - // merge in those following pairs of the original pRA that will - // lie in the (now larger) current new pair or will even extend it - // further: - pRA += 2; - if (!pRA[0]) - { - ++pRB; - goto copy_rest; - } - Swap_Impl(pRA, pRB); - } - - // Done with the current new pair, now upper bound is also known: - *pRN++ = pRA[1]; - pRA += 2; - } - - // Only pRB has more pairs available (which are copied to the new ranges - // unchanged), pRA is already exhausted: -copy_rest: - for (; *pRB;) - *pRN++ = *pRB++; - *pRN = 0; - - delete[] _pRanges; - _pRanges = pNew; - - return *this; -} - -//------------------------------------------------------------------------ - -SfxNumRanges& SfxNumRanges::operator -= -( - const SfxNumRanges &rRanges -) - -/**

Description

- - Removes 'rRanges' from '*this'. - - for each NUMTYPE n: - this->Contains( n ) && rRanges.Contains( n ) => !this'->Contains( n ) - this->Contains( n ) && !rRanges.Contains( n ) => this'->Contains( n ) - !this->Contains( n ) => !this'->Contains( n ) -*/ - -{ - // special cases: one is empty - if ( rRanges.IsEmpty() || IsEmpty() ) - return *this; - - // differentiate 'rRanges' in a temporary copy of '*this' - // (size is computed for maximal possibly split-count plus terminating 0) - NUMTYPE nThisSize = Count_Impl(_pRanges); - NUMTYPE nTargetSize = 1 + ( nThisSize + Count_Impl(rRanges._pRanges) ); - NUMTYPE *pTarget = new NUMTYPE[ nTargetSize ]; - memset( pTarget, sizeof(NUMTYPE)*nTargetSize, 0 ); - memcpy( pTarget, _pRanges, sizeof(NUMTYPE)*nThisSize ); - - NUMTYPE nPos1 = 0, nPos2 = 0, nTargetPos = 0; - while( _pRanges[ nPos1 ] ) - { - NUMTYPE l1 = _pRanges[ nPos1 ]; // lower bound of interval 1 - NUMTYPE u1 = _pRanges[ nPos1+1 ]; // upper bound of interval 1 - NUMTYPE l2 = rRanges._pRanges[ nPos2 ]; // lower bound of interval 2 - NUMTYPE u2 = rRanges._pRanges[ nPos2+1 ]; // upper bound of interval 2 - - // boundary cases - // * subtrahend is empty -> copy the minuend - if( !l2 ) - { - pTarget[ nTargetPos ] = l1; - pTarget[ nTargetPos+1 ] = u1; - nTargetPos += 2; - nPos1 += 2; - continue; - } - // * next subtrahend interval is completely higher -> copy the minuend - if( u1 < l2 ) - { - pTarget[ nTargetPos ] = l1; - pTarget[ nTargetPos+1 ] = u1; - nTargetPos += 2; - nPos1 += 2; - continue; - } - - // * next subtrahend interval is completely lower -> try next - if( u2 < l1 ) - { - nPos2 += 2; - continue; - } - - // intersecting cases - // * subtrahend cuts out from the beginning of the minuend - if( l2 <= l1 && u2 <= u1 ) - { - // reduce minuend interval, try again (minuend might be affected by other subtrahend intervals) - _pRanges[ nPos1 ] = u2 + 1; - nPos2 += 2; // this cannot hurt any longer - continue; - } - - // * subtrahend cuts out from the end of the minuend - if( l1 <= l2 && u1 <= u2 ) - { - // copy remaining part of minuend (cannot be affected by other intervals) - if( l1 < l2 ) // anything left at all? - { - pTarget[ nTargetPos ] = l1; - pTarget[ nTargetPos+1 ] = l2 - 1; - nTargetPos += 2; - // do not increment nPos2, might affect next minuend interval, too - } - nPos1 += 2; // nothing left at all - continue; - } - - // * subtrahend completely deletes minuend (larger or same at both ends) - if( l1 >= l2 && u1 <= u2 ) - { - nPos1 += 2; // minuend deleted - // do not increment nPos2, might affect next minuend interval, too - continue; - } - - // * subtrahend divides minuend into two pieces - if( l1 <= l2 && u1 >= u2 ) // >= and <= since they may be something left only at one side - { - // left side - if( l1 < l2 ) // anything left at all - { - pTarget[ nTargetPos ] = l1; - pTarget[ nTargetPos+1 ] = l2 - 1; - nTargetPos += 2; - } - - // right side - if( u1 > u2 ) // anything left at all - { - // reduce minuend interval, try again (minuend might be affected by other subtrahend itnervals ) - _pRanges[ nPos1 ] = u2 + 1; - } - - // subtrahend is completely used - nPos2 += 2; - continue; - } - - // we should never be here - DBG_ERROR( "SfxNumRanges::operator-=: internal error" ); - } // while - - pTarget[ nTargetPos ] = 0; - - // assign the differentiated ranges - delete[] _pRanges; - - NUMTYPE nUShorts = Count_Impl(pTarget) + 1; - if ( 1 != nUShorts ) - { - _pRanges = new NUMTYPE[ nUShorts ]; - memcpy( _pRanges, pTarget, nUShorts * sizeof(NUMTYPE) ); - } - else - _pRanges = 0; - - delete [] pTarget; - return *this; - - /* untested code from MI commented out (MDA, 28.01.97) - do - { - // 1st range is smaller than 2nd range? - if ( pRange1[1] < pRange2[0] ) - // => keep 1st range - pRange1 += 2; - - // 2nd range is smaller than 1st range? - else if ( pRange2[1] < pRange1[0] ) - // => skip 2nd range - pRange2 += 2; - - // 2nd range totally overlaps the 1st range? - else if ( pRange2[0] <= pRange1[0] && pRange2[1] >= pRange1[1] ) - // => remove 1st range - memmove( pRange1, pRange1+2, sizeof(NUMTYPE) * (pEndOfTarget-pRange1+2) ); - - // 2nd range overlaps only the beginning of 1st range? - else if ( pRange2[0] <= pRange1[0] && pRange2[1] < pRange1[1] ) - { - // => cut the beginning of 1st range and goto next 2nd range - pRange1[0] = pRange2[1] + 1; - pRange2 += 2; - } - - // 2nd range overlaps only the end of 1st range? - else if ( pRange2[0] > pRange1[0] && pRange2[1] >= pRange1[0] ) - // => cut the beginning of 1st range - pRange1[0] = pRange2[1]+1; - - // 2nd range is a real subset of 1st range - else - { - // => split 1st range and goto next 2nd range - memmove( pRange1+3, pRange1+1, sizeof(NUMTYPE) * (pEndOfTarget-pRange1-1) ); - pRange1[1] = pRange2[0] - 1; - pRange1[2] = pRange2[1] + 1; - pRange1 += 2; - pRange2 += 2; - } - } - while ( *pRange1 && *pRange2 ); - - // assign the differentiated ranges - delete[] _pRanges; - NUMTYPE nUShorts = Count_Impl(pTarget) + 1; - if ( 1 != nUShorts ) - { - _pRanges = new NUMTYPE[ nUShorts ]; - memcpy( _pRanges, pTarget, nUShorts * sizeof(NUMTYPE) ); - _pRanges[ nUShorts-1 ] = 0; - } - else - _pRanges = 0; - return *this; - */ -} - -//------------------------------------------------------------------------ - -SfxNumRanges& SfxNumRanges::operator /= -( - const SfxNumRanges &rRanges -) - -/**

Description

- - Determines intersection of '*this' with 'rRanges'. - - for each NUMTYPE n: - this->Contains( n ) && rRanges.Contains( n ) => this'->Contains( n ) - !this->Contains( n ) => !this'->Contains( n ) - !rRanges.Contains( n ) => !this'->Contains( n ) -*/ - -{ - // boundary cases - // * first set is empty -> nothing to be done - // * second set is empty -> delete first set - if( rRanges.IsEmpty() ) - { - delete[] _pRanges; - - _pRanges = new NUMTYPE[1]; - _pRanges[0] = 0; - - return *this; - } - - // intersect 'rRanges' in a temporary copy of '*this' - // (size is computed for maximal possibly split-count plus terminating 0) - NUMTYPE nThisSize = Count_Impl(_pRanges); - NUMTYPE nTargetSize = 1 + ( nThisSize + Count_Impl(rRanges._pRanges) ); - NUMTYPE *pTarget = new NUMTYPE[ nTargetSize ]; - memset( pTarget, sizeof(NUMTYPE)*nTargetSize, 0 ); - memcpy( pTarget, _pRanges, sizeof(NUMTYPE)*nThisSize ); - - NUMTYPE nPos1 = 0, nPos2 = 0, nTargetPos = 0; - while( _pRanges[ nPos1 ] != 0 && rRanges._pRanges[ nPos2 ] != 0 ) - { - NUMTYPE l1 = _pRanges[ nPos1 ]; // lower bound of interval 1 - NUMTYPE u1 = _pRanges[ nPos1+1 ]; // upper bound of interval 1 - NUMTYPE l2 = rRanges._pRanges[ nPos2 ]; // lower bound of interval 2 - NUMTYPE u2 = rRanges._pRanges[ nPos2+1 ]; // upper bound of interval 2 - - if( u1 < l2 ) - { - // current interval in s1 is completely before ci in s2 - nPos1 += 2; - continue; - } - if( u2 < l1 ) - { - // ci in s2 is completely before ci in s1 - nPos2 += 2; - continue; - } - - // assert: there exists an intersection between ci1 and ci2 - - if( l1 <= l2 ) - { - // c1 "is more to the left" than c2 - - if( u1 <= u2 ) - { - pTarget[ nTargetPos ] = l2; - pTarget[ nTargetPos+1 ] = u1; - nTargetPos += 2; - nPos1 += 2; - continue; - } - else - { - pTarget[ nTargetPos ] = l2; - pTarget[ nTargetPos+1 ] = u2; - nTargetPos += 2; - nPos2 += 2; - } - } - else - { - // c2 "is more to the left" than c1" - - if( u1 > u2 ) - { - pTarget[ nTargetPos ] = l1; - pTarget[ nTargetPos+1 ] = u2; - nTargetPos += 2; - nPos2 += 2; - } - else - { - pTarget[ nTargetPos ] = l1; - pTarget[ nTargetPos+1 ] = u1; - nTargetPos += 2; - nPos1 += 2; - } - } - }; // while - pTarget[ nTargetPos ] = 0; - - // assign the intersected ranges - delete[] _pRanges; - - NUMTYPE nUShorts = Count_Impl(pTarget) + 1; - if ( 1 != nUShorts ) - { - _pRanges = new NUMTYPE[ nUShorts ]; - memcpy( _pRanges, pTarget, nUShorts * sizeof(NUMTYPE) ); - } - else - _pRanges = 0; - - delete [] pTarget; - return *this; -} - -//------------------------------------------------------------------------ - -BOOL SfxNumRanges::Intersects( const SfxNumRanges &rRanges ) const - -/**

Description

- - Determines if at least one range in 'rRanges' intersects with one - range in '*this'. - - TRUE, if there is at least one with: - this->Contains( n ) && rRanges.Contains( n ) -*/ - -{ - // special cases: one is empty - if ( rRanges.IsEmpty() || IsEmpty() ) - return FALSE; - - // find at least one intersecting range - const NUMTYPE *pRange1 = _pRanges; - const NUMTYPE *pRange2 = rRanges._pRanges; - - do - { - // 1st range is smaller than 2nd range? - if ( pRange1[1] < pRange2[0] ) - // => keep 1st range - pRange1 += 2; - - // 2nd range is smaller than 1st range? - else if ( pRange2[1] < pRange1[0] ) - // => skip 2nd range - pRange2 += 2; - - // the ranges are overlappung - else - return TRUE; - } - while ( *pRange2 ); - - // no intersection found - return FALSE; -} - -//------------------------------------------------------------------------ - -NUMTYPE SfxNumRanges::Count() const - -/**

Description

- - Determines the number of USHORTs in the set described by the ranges - of USHORTs in '*this'. -*/ - -{ - return Capacity_Impl( _pRanges ); -} - -//------------------------------------------------------------------------ - -BOOL SfxNumRanges::Contains( NUMTYPE n ) const - -/**

Description

- - Determines if '*this' contains 'n'. -*/ - -{ - for ( NUMTYPE *pRange = _pRanges; *pRange && *pRange <= n; pRange += 2 ) - if ( pRange[0] <= n && n <= pRange[1] ) - return TRUE; - return FALSE; - -} diff --git a/svtools/source/items1/poolio.cxx b/svtools/source/items1/poolio.cxx deleted file mode 100644 index f2eb94ef7f67..000000000000 --- a/svtools/source/items1/poolio.cxx +++ /dev/null @@ -1,1715 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: poolio.cxx,v $ - * $Revision: 1.11 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include -#include - -#ifndef GCC -#endif - -#include -#include -#include "whassert.hxx" -#include -#include -#include -#include "poolio.hxx" - -// STATIC DATA ----------------------------------------------------------- - -DBG_NAME(SfxItemPool); - -//======================================================================== - -void SfxItemPool::SetStoringPool( const SfxItemPool *pStoringPool ) - -/* [Beschreibung] - - Diese Methode setzt den , der gerade gespeichert wird. - Sie sollte nur in Notf"allen verwendet werden, um z.B. File-Format- - Kompatibilit"at zu gew"ahrleisten o."o. - z.B. in der "uberladung eines - zus"atzliche Daten aus dem dazuge"horigen - Pool mit zu besorgen. - - Sie wird von bedient, kann jedoch f"ur nicht - poolable Items auch direkt gerufen werden. Bitte m"oglichst nicht - f"ur jedes Item einzeln, da 2 Calls! -*/ - -{ - ImpSvtData::GetSvtData().pStoringPool = pStoringPool; -} - -//------------------------------------------------------------------------- - -const SfxItemPool* SfxItemPool::GetStoringPool() - -/* [Beschreibung] - - Diese Methode liefert den , der gerade gespeichert wird. - Sie sollte nur in Notf"allen verwendet werden, um z.B. File-Format- - Kompatibilit"at zu gew"ahrleisten o."o. - z.B. in der "uberladung eines - zus"atzliche Daten aus dem dazuge"horigen - Pool zu besorgen. -*/ - -{ - return ImpSvtData::GetSvtData().pStoringPool; -} - -//------------------------------------------------------------------------- - -SvStream &SfxItemPool::Store(SvStream &rStream) const - -/* [Beschreibung] - - Der SfxItemPool wird inklusive aller seiner Sekund"arpools mit - Pool-Defaults und gepoolten Items in dem angegebenen Stream gespeichert. - Die statischen Defaults werden nicht gespeichert. - - - [Fileformat] - - ;zun"achst ein Kompatiblit"ats-Header-Block - Start: 0x1111 SFX_ITEMPOOL_TAG_STARTPOOLS(_4/_5) - BYTE MAJOR_VER ;SfxItemPool-Version - BYTE MINOR_VER ;" - 0xFFFF SFX_ITEMPOOL_TAG_TRICK4OLD ;ex. GetVersion() - USHORT 0x0000 ;Pseudo-StyleSheetPool - USHORT 0x0000 ;Pseudo-StyleSheetPool - - ;den ganzen Pool in einen Record - record SfxMiniRecod(SFX_ITEMPOOL_REC) - - ;je ein Header vorweg - Header: record SfxMiniRecord(SFX_ITEMPOOL_REC_HEADER) - USHORT GetVersion() ;Which-Ranges etc. - String GetName() ;Pool-Name - - ;die Versions-Map, um WhichIds neuer File-Versionen mappen zu k"onnen - Versions: record SfxMultiRecord(SFX_ITEMPOOL_REC_VERSIONS, 0) - USHORT OldVersion - USHORT OldStartWhich - USHORT OldEndWhich - USHORT[] NewWhich (OldEndWhich-OldStartWhich+1) - - ;jetzt die gepoolten Items (zuerst nicht-SfxSetItems) - Items: record SfxMultiRecord(SFX_ITEMPOOL_REC_WHICHIDS, 0) - content SlotId, 0 - USHORT WhichId - USHORT pItem->GetVersion() - USHORT Array-Size - record SfxMultiRecord(SFX_, 0) - content Surrogate - USHORT RefCount - unknown pItem->Store() - - ;jetzt die gesetzten Pool-Defaults - Defaults: record SfxMultiRecord(SFX_ITEMPOOL_REC_DEFAULTS, 0) - content SlotId, 0 - USHORT WhichId - USHORT pPoolDef->GetVersion() - unknown pPoolDef->Store(); - - ;dahinter folgt ggf. der Secondary ohne Kompatiblit"ats-Header-Block -*/ - -{ - DBG_CHKTHIS(SfxItemPool, 0); - - // Store-Master finden - SfxItemPool *pStoreMaster = pMaster != this ? pMaster : 0; - while ( pStoreMaster && !pStoreMaster->pImp->bStreaming ) - pStoreMaster = pStoreMaster->pSecondary; - - // Alter-Header (Version des Pools an sich und Inhalts-Version 0xffff) - pImp->bStreaming = TRUE; - if ( !pStoreMaster ) - { - rStream << ( rStream.GetVersion() >= SOFFICE_FILEFORMAT_50 - ? SFX_ITEMPOOL_TAG_STARTPOOL_5 - : SFX_ITEMPOOL_TAG_STARTPOOL_4 ); - rStream << SFX_ITEMPOOL_VER_MAJOR << SFX_ITEMPOOL_VER_MINOR; - rStream << SFX_ITEMPOOL_TAG_TRICK4OLD; - - // SfxStyleSheet-Bug umgehen - rStream << UINT16(0); // Version - rStream << UINT16(0); // Count (2. Schleife f"allt sonst auf die Fresse) - } - - // jeder Pool ist als ganzes ein Record - SfxMiniRecordWriter aPoolRec( &rStream, SFX_ITEMPOOL_REC ); - ImpSvtData::GetSvtData().pStoringPool = this; - - // Einzel-Header (Version des Inhalts und Name) - { - SfxMiniRecordWriter aPoolHeaderRec( &rStream, SFX_ITEMPOOL_REC_HEADER); - rStream << pImp->nVersion; - SfxPoolItem::writeByteString(rStream, aName); - } - - // Version-Maps - { - SfxMultiVarRecordWriter aVerRec( &rStream, SFX_ITEMPOOL_REC_VERSIONMAP, 0 ); - for ( USHORT nVerNo = 0; nVerNo < pImp->aVersions.Count(); ++nVerNo ) - { - aVerRec.NewContent(); - SfxPoolVersion_Impl *pVer = pImp->aVersions[nVerNo]; - rStream << pVer->_nVer << pVer->_nStart << pVer->_nEnd; - USHORT nCount = pVer->_nEnd - pVer->_nStart + 1; - USHORT nNewWhich = 0; - for ( USHORT n = 0; n < nCount; ++n ) - { - nNewWhich = pVer->_pMap[n]; - rStream << nNewWhich; - } - - // Workaround gegen Bug in SetVersionMap der 312 - if ( SOFFICE_FILEFORMAT_31 == _nFileFormatVersion ) - rStream << USHORT(nNewWhich+1); - } - } - - // gepoolte Items - { - SfxMultiMixRecordWriter aWhichIdsRec( &rStream, SFX_ITEMPOOL_REC_WHICHIDS, 0 ); - - // erst Atomaren-Items und dann die Sets schreiben (wichtig beim Laden) - for ( pImp->bInSetItem = FALSE; pImp->bInSetItem <= TRUE && !rStream.GetError(); ++pImp->bInSetItem ) - { - SfxPoolItemArray_Impl **pArr = pImp->ppPoolItems; - SfxPoolItem **ppDefItem = ppStaticDefaults; - const USHORT nSize = GetSize_Impl(); - for ( USHORT i = 0; i < nSize && !rStream.GetError(); ++i, ++pArr, ++ppDefItem ) - { - // Version des Items feststellen - USHORT nItemVersion = (*ppDefItem)->GetVersion( _nFileFormatVersion ); - if ( USHRT_MAX == nItemVersion ) - // => kam in zu exportierender Version gar nicht vor - continue; - - // !poolable wird gar nicht im Pool gespeichert - // und itemsets/plain-items je nach Runde -#ifdef TF_POOLABLE - if ( *pArr && IsItemFlag(**ppDefItem, SFX_ITEM_POOLABLE) && -#else - if ( *pArr && (*ppDefItem)->IsPoolable() && -#endif - pImp->bInSetItem == (*ppDefItem)->ISA(SfxSetItem) ) - { - // eigene Kennung, globale Which-Id und Item-Version - USHORT nSlotId = GetSlotId( (*ppDefItem)->Which(), FALSE ); - aWhichIdsRec.NewContent(nSlotId, 0); - rStream << (*ppDefItem)->Which(); - rStream << nItemVersion; - const USHORT nCount = (*pArr)->Count(); - DBG_ASSERT(nCount, "ItemArr ist leer"); - rStream << nCount; - - // Items an sich schreiben - SfxMultiMixRecordWriter aItemsRec( &rStream, SFX_ITEMPOOL_REC_ITEMS, 0 ); - for ( USHORT j = 0; j < nCount; ++j ) - { - // Item selbst besorgen - const SfxPoolItem *pItem = (*pArr)->GetObject(j); - if ( pItem && pItem->GetRefCount() ) //! siehe anderes MI-REF - { - aItemsRec.NewContent(j, 'X' ); - - if ( pItem->GetRefCount() == SFX_ITEMS_SPECIAL ) - rStream << (USHORT) pItem->GetKind(); - else - { - rStream << (USHORT) pItem->GetRefCount(); - if( pItem->GetRefCount() > SFX_ITEMS_OLD_MAXREF ) - rStream.SetError( ERRCODE_IO_NOTSTORABLEINBINARYFORMAT ); - } - - if ( !rStream.GetError() ) - pItem->Store(rStream, nItemVersion); - else - break; -#ifdef DBG_UTIL_MI - if ( !pItem->ISA(SfxSetItem) ) - { - ULONG nMark = rStream.Tell(); - rStream.Seek( nItemStartPos + sizeof(USHORT) ); - SfxPoolItem *pClone = pItem->Create(rStream, nItemVersion ); - USHORT nWh = pItem->Which(); - SFX_ASSERT( rStream.Tell() == nMark, nWh,"asymmetric store/create" ); - SFX_ASSERT( *pClone == *pItem, nWh, "unequal after store/create" ); - delete pClone; - } -#endif - } - } - } - } - } - - pImp->bInSetItem = FALSE; - } - - // die gesetzten Defaults speichern (Pool-Defaults) - if ( !rStream.GetError() ) - { - SfxMultiMixRecordWriter aDefsRec( &rStream, SFX_ITEMPOOL_REC_DEFAULTS, 0 ); - USHORT nCount = GetSize_Impl(); - for ( USHORT n = 0; n < nCount; ++n ) - { - const SfxPoolItem* pDefaultItem = ppPoolDefaults[n]; - if ( pDefaultItem ) - { - // Version ermitteln - USHORT nItemVersion = pDefaultItem->GetVersion( _nFileFormatVersion ); - if ( USHRT_MAX == nItemVersion ) - // => gab es in der Version noch nicht - continue; - - // eigene Kennung, globale Kennung, Version - USHORT nSlotId = GetSlotId( pDefaultItem->Which(), FALSE ); - aDefsRec.NewContent( nSlotId, 0 ); - rStream << pDefaultItem->Which(); - rStream << nItemVersion; - - // Item an sich - pDefaultItem->Store( rStream, nItemVersion ); - } - } - } - - // weitere Pools rausschreiben - ImpSvtData::GetSvtData().pStoringPool = 0; - aPoolRec.Close(); - if ( !rStream.GetError() && pSecondary ) - pSecondary->Store( rStream ); - - pImp->bStreaming = FALSE; - return rStream; -} - -// ----------------------------------------------------------------------- - -void SfxItemPool::LoadCompleted() - -/* [Beschreibung] - - Wurde der SfxItemPool mit 'bRefCounts' == FALSE geladen, mu\s das - Laden der Dokumentinhalte mit einem Aufruf dieser Methode beendet - werden. Ansonsten hat der Aufruf dieser Methode keine Funktion. - - - [Anmerkung] - - Beim Laden ohne Ref-Counts werden diese tats"achlich auf 1 gesetzt, - damit nicht w"ahrend des Ladevorgangs SfxPoolItems gel"oscht werden, - die danach, aber auch noch beim Ladevorgang, ben"otigt werden. Diese - Methode setzt den Ref-Count wieder zur"uck und entfernt dabei - gleichzeitig alle nicht mehr ben"otigten Items. - - - [Querverweise] - - -*/ - -{ - // wurden keine Ref-Counts mitgeladen? - if ( pImp->nInitRefCount > 1 ) - { - - // "uber alle Which-Werte iterieren - SfxPoolItemArray_Impl** ppItemArr = pImp->ppPoolItems; - for( USHORT nArrCnt = GetSize_Impl(); nArrCnt; --nArrCnt, ++ppItemArr ) - { - // ist "uberhaupt ein Item mit dem Which-Wert da? - if ( *ppItemArr ) - { - // "uber alle Items mit dieser Which-Id iterieren - SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData(); - for( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr ) - if (*ppHtArr) - { - #ifdef DBG_UTIL - const SfxPoolItem &rItem = **ppHtArr; - DBG_ASSERT( !rItem.ISA(SfxSetItem) || - 0 != &((const SfxSetItem&)rItem).GetItemSet(), - "SetItem without ItemSet" ); - #endif - - if ( !ReleaseRef( **ppHtArr, 1 ) ) - DELETEZ( *ppHtArr ); - } - } - } - - // from now on normal initial ref count - pImp->nInitRefCount = 1; - } - - // notify secondary pool - if ( pSecondary ) - pSecondary->LoadCompleted(); -} - -//============================================================================ -// This had to be moved to a method of its own to keep Solaris GCC happy: -void SfxItemPool::readTheItems ( - SvStream & rStream, USHORT nItemCount, USHORT nVersion, - SfxPoolItem * pDefItem, SfxPoolItemArray_Impl ** ppArr) -{ - SfxMultiRecordReader aItemsRec( &rStream, SFX_ITEMPOOL_REC_ITEMS ); - - SfxPoolItemArray_Impl *pNewArr = new SfxPoolItemArray_Impl( nItemCount ); - SfxPoolItem *pItem = 0; - - USHORT n, nLastSurrogate = USHORT(-1); - while (aItemsRec.GetContent()) - { - // n"achstes Surrogat holen - USHORT nSurrogate = aItemsRec.GetContentTag(); - DBG_ASSERT( aItemsRec.GetContentVersion() == 'X', - "not an item content" ); - - // fehlende auff"ullen - for ( pItem = 0, n = nLastSurrogate+1; n < nSurrogate; ++n ) - pNewArr->C40_INSERT(SfxPoolItem, pItem, n); - nLastSurrogate = nSurrogate; - - // Ref-Count und Item laden - USHORT nRef; - rStream >> nRef; - - pItem = pDefItem->Create(rStream, nVersion); - pNewArr->C40_INSERT(SfxPoolItem, pItem, nSurrogate); - - if ( !bPersistentRefCounts ) - // bis festhalten - AddRef(*pItem, 1); - else - { - if ( nRef > SFX_ITEMS_OLD_MAXREF ) - pItem->SetKind( nRef ); - else - AddRef(*pItem, nRef); - } - } - - // fehlende auff"ullen - for ( pItem = 0, n = nLastSurrogate+1; n < nItemCount; ++n ) - pNewArr->C40_INSERT(SfxPoolItem, pItem, n); - - SfxPoolItemArray_Impl *pOldArr = *ppArr; - *ppArr = pNewArr; - - // die Items merken, die schon im Pool sind - int bEmpty = TRUE; - if ( 0 != pOldArr ) - for ( n = 0; bEmpty && n < pOldArr->Count(); ++n ) - bEmpty = pOldArr->GetObject(n) == 0; - DBG_ASSERTWARNING( bEmpty, "loading non-empty pool" ); - if ( !bEmpty ) - { - // f"ur alle alten suchen, ob ein gleiches neues existiert - for ( USHORT nOld = 0; nOld < pOldArr->Count(); ++nOld ) - { - SfxPoolItem *pOldItem = (*pOldArr)[nOld]; - if ( pOldItem ) - { - USHORT nFree = USHRT_MAX; - int bFound = FALSE; - USHORT nCount = (*ppArr)->Count(); - for ( USHORT nNew = nCount; !bFound && nNew--; ) - { - // geladenes Item - SfxPoolItem *&rpNewItem = - (SfxPoolItem*&)(*ppArr)->GetData()[nNew]; - - // surrogat unbenutzt? - if ( !rpNewItem ) - nFree = nNew; - - // gefunden? - else if ( *rpNewItem == *pOldItem ) - { - // wiederverwenden - AddRef( *pOldItem, rpNewItem->GetRefCount() ); - SetRefCount( *rpNewItem, 0 ); - delete rpNewItem; - rpNewItem = pOldItem; - bFound = TRUE; - } - } - - // vorhervorhandene, nicht geladene uebernehmen - if ( !bFound ) - { - if ( nFree != USHRT_MAX ) - (SfxPoolItem*&)(*ppArr)->GetData()[nFree] = pOldItem; - else - (*ppArr)->C40_INSERT( SfxPoolItem, pOldItem, nCount ); - } - } - } - } - delete pOldArr; -} - -// ----------------------------------------------------------------------- - -SvStream &SfxItemPool::Load(SvStream &rStream) -{ - DBG_CHKTHIS(SfxItemPool, 0); - DBG_ASSERT(ppStaticDefaults, "kein DefaultArray"); - - // protect items by increasing ref count - if ( !bPersistentRefCounts ) - { - - // "uber alle Which-Werte iterieren - SfxPoolItemArray_Impl** ppItemArr = pImp->ppPoolItems; - for( USHORT nArrCnt = GetSize_Impl(); nArrCnt; --nArrCnt, ++ppItemArr ) - { - // ist "uberhaupt ein Item mit dem Which-Wert da? - if ( *ppItemArr ) - { - // "uber alle Items mit dieser Which-Id iterieren - SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData(); - for( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr ) - if (*ppHtArr) - { - #ifdef DBG_UTIL - const SfxPoolItem &rItem = **ppHtArr; - DBG_ASSERT( !rItem.ISA(SfxSetItem) || - 0 != &((const SfxSetItem&)rItem).GetItemSet(), - "SetItem without ItemSet" ); - DBG_WARNING( "loading non-empty ItemPool" ); - #endif - - AddRef( **ppHtArr, 1 ); - } - } - } - - // during loading (until LoadCompleted()) protect all items - pImp->nInitRefCount = 2; - } - - // Load-Master finden - SfxItemPool *pLoadMaster = pMaster != this ? pMaster : 0; - while ( pLoadMaster && !pLoadMaster->pImp->bStreaming ) - pLoadMaster = pLoadMaster->pSecondary; - - // Gesamt Header einlesen - pImp->bStreaming = TRUE; - if ( !pLoadMaster ) - { - // Format-Version laden - CHECK_FILEFORMAT2( rStream, - SFX_ITEMPOOL_TAG_STARTPOOL_5, SFX_ITEMPOOL_TAG_STARTPOOL_4 ); - rStream >> pImp->nMajorVer >> pImp->nMinorVer; - - // Format-Version in Master-Pool "ubertragen - pMaster->pImp->nMajorVer = pImp->nMajorVer; - pMaster->pImp->nMinorVer = pImp->nMinorVer; - - // altes Format? - if ( pImp->nMajorVer < 2 ) - // pImp->bStreaming wird von Load1_Impl() zur"uckgesetzt - return Load1_Impl( rStream ); - - // zu neues Format? - if ( pImp->nMajorVer > SFX_ITEMPOOL_VER_MAJOR ) - { - rStream.SetError(SVSTREAM_FILEFORMAT_ERROR); - pImp->bStreaming = FALSE; - return rStream; - } - - // Version 1.2-Trick-Daten "uberspringen - CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_TRICK4OLD ); - rStream.SeekRel( 4 ); // Hack-Daten wegen SfxStyleSheetPool-Bug skippen - } - - // neues Record-orientiertes Format - SfxMiniRecordReader aPoolRec( &rStream, SFX_ITEMPOOL_REC ); - if ( rStream.GetError() ) - { - pImp->bStreaming = FALSE; - return rStream; - } - - // Einzel-Header - int bOwnPool = TRUE; - UniString aExternName; - { - // Header-Record suchen - SfxMiniRecordReader aPoolHeaderRec( &rStream, SFX_ITEMPOOL_REC_HEADER ); - if ( rStream.GetError() ) - { - pImp->bStreaming = FALSE; - return rStream; - } - - // Header-lesen - rStream >> pImp->nLoadingVersion; - SfxPoolItem::readByteString(rStream, aExternName); - bOwnPool = aExternName == aName; - - //! solange wir keine fremden Pools laden k"onnen - if ( !bOwnPool ) - { - rStream.SetError(SVSTREAM_FILEFORMAT_ERROR); - aPoolRec.Skip(); - pImp->bStreaming = FALSE; - return rStream; - } - } - - // Version-Maps - { - SfxMultiRecordReader aVerRec( &rStream, SFX_ITEMPOOL_REC_VERSIONMAP ); - if ( rStream.GetError() ) - { - pImp->bStreaming = FALSE; - return rStream; - } - - // Versions-Maps einlesen - USHORT nOwnVersion = pImp->nVersion; - for ( USHORT nVerNo = 0; aVerRec.GetContent(); ++nVerNo ) - { - // Header f"ur einzelne Version einlesen - USHORT nVersion, nHStart, nHEnd; - rStream >> nVersion >> nHStart >> nHEnd; - USHORT nCount = nHEnd - nHStart + 1; - - // Version neuer als bekannt? - if ( nVerNo >= pImp->aVersions.Count() ) - { - // neue Version hinzufuegen - USHORT *pMap = new USHORT[nCount]; - for ( USHORT n = 0; n < nCount; ++n ) - rStream >> pMap[n]; - SetVersionMap( nVersion, nHStart, nHEnd, pMap ); - } - } - pImp->nVersion = nOwnVersion; - } - - // Items laden - FASTBOOL bSecondaryLoaded = FALSE; - long nSecondaryEnd = 0; - { - SfxMultiRecordReader aWhichIdsRec( &rStream, SFX_ITEMPOOL_REC_WHICHIDS); - while ( aWhichIdsRec.GetContent() ) - { - // SlotId, Which-Id und Item-Version besorgen - USHORT nCount, nVersion, nWhich; - //!USHORT nSlotId = aWhichIdsRec.GetContentTag(); - rStream >> nWhich; - if ( pImp->nLoadingVersion != pImp->nVersion ) - // Which-Id aus File-Version in Pool-Version verschieben - nWhich = GetNewWhich( nWhich ); - - // unbekanntes Item aus neuerer Version - if ( !IsInRange(nWhich) ) - continue; - - rStream >> nVersion; - rStream >> nCount; - //!SFX_ASSERTWARNING( !nSlotId || !HasMap() || - //! ( nSlotId == GetSlotId( nWhich, FALSE ) ) || - //! !GetSlotId( nWhich, FALSE ), - //! nWhich, "Slot/Which mismatch" ); - - USHORT nIndex = GetIndex_Impl(nWhich); - SfxPoolItemArray_Impl **ppArr = pImp->ppPoolItems + nIndex; - - // SfxSetItems k"onnten Items aus Sekund"arpools beinhalten - SfxPoolItem *pDefItem = *(ppStaticDefaults + nIndex); - pImp->bInSetItem = pDefItem->ISA(SfxSetItem); - if ( !bSecondaryLoaded && pSecondary && pImp->bInSetItem ) - { - // an das Ende des eigenen Pools seeken - ULONG nLastPos = rStream.Tell(); - aPoolRec.Skip(); - - // Sekund"arpool einlesen - pSecondary->Load( rStream ); - bSecondaryLoaded = TRUE; - nSecondaryEnd = rStream.Tell(); - - // zur"uck zu unseren eigenen Items - rStream.Seek(nLastPos); - } - - // Items an sich lesen - readTheItems(rStream, nCount, nVersion, pDefItem, ppArr); - - pImp->bInSetItem = FALSE; - } - } - - // Pool-Defaults lesen - { - SfxMultiRecordReader aDefsRec( &rStream, SFX_ITEMPOOL_REC_DEFAULTS ); - - while ( aDefsRec.GetContent() ) - { - // SlotId, Which-Id und Item-Version besorgen - USHORT nVersion, nWhich; - //!USHORT nSlotId = aDefsRec.GetContentTag(); - rStream >> nWhich; - if ( pImp->nLoadingVersion != pImp->nVersion ) - // Which-Id aus File-Version in Pool-Version verschieben - nWhich = GetNewWhich( nWhich ); - - // unbekanntes Item aus neuerer Version - if ( !IsInRange(nWhich) ) - continue; - - rStream >> nVersion; - //!SFX_ASSERTWARNING( !HasMap() || ( nSlotId == GetSlotId( nWhich, FALSE ) ), - //! nWhich, "Slot/Which mismatch" ); - - // Pool-Default-Item selbst laden - SfxPoolItem *pItem = - ( *( ppStaticDefaults + GetIndex_Impl(nWhich) ) ) - ->Create( rStream, nVersion ); - pItem->SetKind( SFX_ITEMS_POOLDEFAULT ); - *( ppPoolDefaults + GetIndex_Impl(nWhich) ) = pItem; - } - } - - // ggf. Secondary-Pool laden - aPoolRec.Skip(); - if ( pSecondary ) - { - if ( !bSecondaryLoaded ) - pSecondary->Load( rStream ); - else - rStream.Seek( nSecondaryEnd ); - } - - // wenn nicht own-Pool, dann kein Name - if ( aExternName != aName ) - aName.Erase(); - - pImp->bStreaming = FALSE; - return rStream; -}; - -// ----------------------------------------------------------------------- - -SvStream &SfxItemPool::Load1_Impl(SvStream &rStream) -{ - // beim Master ist der Header schon von geladen worden - if ( !pImp->bStreaming ) - { - // Header des Secondary lesen - CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_STARTPOOL_4 ); - rStream >> pImp->nMajorVer >> pImp->nMinorVer; - } - sal_uInt32 nAttribSize; - int bOwnPool = TRUE; - UniString aExternName; - if ( pImp->nMajorVer > 1 || pImp->nMinorVer >= 2 ) - rStream >> pImp->nLoadingVersion; - SfxPoolItem::readByteString(rStream, aExternName); - bOwnPool = aExternName == aName; - pImp->bStreaming = TRUE; - - //! solange wir keine fremden laden k"onnen - if ( !bOwnPool ) - { - rStream.SetError(SVSTREAM_FILEFORMAT_ERROR); - pImp->bStreaming = FALSE; - return rStream; - } - - // Versionen bis 1.3 k"onnen noch keine Which-Verschiebungen lesen - if ( pImp->nMajorVer == 1 && pImp->nMinorVer <= 2 && - pImp->nVersion < pImp->nLoadingVersion ) - { - rStream.SetError(ERRCODE_IO_WRONGVERSION); - pImp->bStreaming = FALSE; - return rStream; - } - - // Size-Table liegt hinter den eigentlichen Attributen - rStream >> nAttribSize; - - // Size-Table einlesen - ULONG nStartPos = rStream.Tell(); - rStream.SeekRel( nAttribSize ); - CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_SIZES ); - sal_uInt32 nSizeTableLen; - rStream >> nSizeTableLen; - sal_Char *pBuf = new sal_Char[nSizeTableLen]; - rStream.Read( pBuf, nSizeTableLen ); - ULONG nEndOfSizes = rStream.Tell(); - SvMemoryStream aSizeTable( pBuf, nSizeTableLen, STREAM_READ ); - - // ab Version 1.3 steht in der Size-Table eine Versions-Map - if ( pImp->nMajorVer > 1 || pImp->nMinorVer >= 3 ) - { - // Version-Map finden (letztes ULONG der Size-Table gibt Pos an) - rStream.Seek( nEndOfSizes - sizeof(sal_uInt32) ); - sal_uInt32 nVersionMapPos; - rStream >> nVersionMapPos; - rStream.Seek( nVersionMapPos ); - - // Versions-Maps einlesen - CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_VERSIONMAP ); - USHORT nVerCount; - rStream >> nVerCount; - for ( USHORT nVerNo = 0; nVerNo < nVerCount; ++nVerNo ) - { - // Header f"ur einzelne Version einlesen - USHORT nVersion, nHStart, nHEnd; - rStream >> nVersion >> nHStart >> nHEnd; - USHORT nCount = nHEnd - nHStart + 1; - USHORT nBytes = (nCount)*sizeof(USHORT); - - // Version neuer als bekannt? - if ( nVerNo >= pImp->aVersions.Count() ) - { - // neue Version hinzufuegen - USHORT *pMap = new USHORT[nCount]; - for ( USHORT n = 0; n < nCount; ++n ) - rStream >> pMap[n]; - SetVersionMap( nVersion, nHStart, nHEnd, pMap ); - } - else - // Version schon bekannt => "uberspringen - rStream.SeekRel( nBytes ); - } - } - - // Items laden - rStream.Seek( nStartPos ); - CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_ITEMS ); - FASTBOOL bSecondaryLoaded = FALSE; - long nSecondaryEnd = 0; - USHORT nWhich, nSlot; - while ( rStream >> nWhich, nWhich ) - { - // ggf. Which-Id aus alter Version verschieben? - if ( pImp->nLoadingVersion != pImp->nVersion ) - nWhich = GetNewWhich( nWhich ); - - rStream >> nSlot; - USHORT nMappedWhich = GetWhich(nSlot, FALSE); - int bKnownItem = bOwnPool || IsWhich(nMappedWhich); - - USHORT nRef, nCount, nVersion; - sal_uInt32 nAttrSize; - rStream >> nVersion >> nCount; - - SfxPoolItemArray_Impl **ppArr = 0; - SfxPoolItemArray_Impl *pNewArr = 0; - SfxPoolItem *pDefItem = 0; - if ( bKnownItem ) - { - if ( !bOwnPool ) - nWhich = nMappedWhich; - - //!SFX_ASSERTWARNING( !nSlot || !HasMap() || - //! ( nSlot == GetSlotId( nWhich, FALSE ) ) || - //! !GetSlotId( nWhich, FALSE ), - //! nWhich, "Slot/Which mismatch" ); - - USHORT nIndex = GetIndex_Impl(nWhich); - ppArr = pImp->ppPoolItems + nIndex; - pNewArr = new SfxPoolItemArray_Impl( nCount ); - pDefItem = *(ppStaticDefaults + nIndex); - } - - // Position vor ersten Item merken - ULONG nLastPos = rStream.Tell(); - - // SfxSetItems k"onnten Items aus Sekund"arpools beinhalten - if ( !bSecondaryLoaded && pSecondary && pDefItem->ISA(SfxSetItem) ) - { - // an das Ende des eigenen Pools seeken - rStream.Seek(nEndOfSizes); - CHECK_FILEFORMAT_RELEASE( rStream, SFX_ITEMPOOL_TAG_ENDPOOL, pNewArr ); - CHECK_FILEFORMAT_RELEASE( rStream, SFX_ITEMPOOL_TAG_ENDPOOL, pNewArr ); - - // Sekund"arpool einlesen - pSecondary->Load1_Impl( rStream ); - bSecondaryLoaded = TRUE; - nSecondaryEnd = rStream.Tell(); - - // zur"uck zu unseren eigenen Items - rStream.Seek(nLastPos); - } - - // Items an sich lesen - for ( USHORT j = 0; j < nCount; ++j ) - { - ULONG nPos = nLastPos; - rStream >> nRef; - - if ( bKnownItem ) - { - SfxPoolItem *pItem = 0; - if ( nRef ) - { - pItem = pDefItem->Create(rStream, nVersion); - - if ( !bPersistentRefCounts ) - // bis festhalten - AddRef(*pItem, 1); - else - { - if ( nRef > SFX_ITEMS_OLD_MAXREF ) - pItem->SetKind( nRef ); - else - AddRef(*pItem, nRef); - } - } - - pNewArr->C40_INSERT( SfxPoolItem, pItem, j); - - // restliche gespeicherte Laenge skippen (neueres Format) - nLastPos = rStream.Tell(); - } - - aSizeTable >> nAttrSize; - SFX_ASSERT( !bKnownItem || ( nPos + nAttrSize) >= nLastPos, - nPos, - "too many bytes read - version mismatch?" ); - - if ( !bKnownItem || ( nLastPos < (nPos + nAttrSize) ) ) - { - nLastPos = nPos + nAttrSize; - rStream.Seek( nLastPos ); - } - } - - if ( bKnownItem ) - { - SfxPoolItemArray_Impl *pOldArr = *ppArr; - *ppArr = pNewArr; - - // die Items merken, die schon im Pool sind - int bEmpty = TRUE; - if ( 0 != pOldArr ) - for ( USHORT n = 0; bEmpty && n < pOldArr->Count(); ++n ) - bEmpty = pOldArr->GetObject(n) == 0; - DBG_ASSERTWARNING( bEmpty, "loading non-empty pool" ); - if ( !bEmpty ) - { - // f"ur alle alten suchen, ob ein gleiches neues existiert - for ( USHORT nOld = 0; nOld < pOldArr->Count(); ++nOld ) - { - SfxPoolItem *pOldItem = (*pOldArr)[nOld]; - if ( pOldItem ) - { - int bFound = FALSE; - for ( USHORT nNew = 0; - !bFound && nNew < (*ppArr)->Count(); - ++nNew ) - { - SfxPoolItem *&rpNewItem = - (SfxPoolItem*&)(*ppArr)->GetData()[nNew]; - - if ( rpNewItem && *rpNewItem == *pOldItem ) - { - AddRef( *pOldItem, rpNewItem->GetRefCount() ); - SetRefCount( *rpNewItem, 0 ); - delete rpNewItem; - rpNewItem = pOldItem; - bFound = TRUE; - SFX_TRACE( "reusing item", pOldItem ); - } - } - //! DBG_ASSERT( bFound, "old-item not found in file" ); - if ( !bFound ) - { - SFX_TRACE( "item not found: ", pOldItem ); - } - } - } - } - delete pOldArr; /* @@@ */ - } - } - - // Pool-Defaults lesen - if ( pImp->nMajorVer > 1 || pImp->nMinorVer > 0 ) - CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_DEFAULTS ); - - ULONG nLastPos = rStream.Tell(); - while ( rStream >> nWhich, nWhich ) - { - // ggf. Which-Id aus alter Version verschieben? - if ( pImp->nLoadingVersion != pImp->nVersion ) - nWhich = GetNewWhich( nWhich ); - - rStream >> nSlot; - USHORT nMappedWhich = GetWhich(nSlot, FALSE); - int bKnownItem = bOwnPool || IsWhich(nMappedWhich); - - ULONG nPos = nLastPos; - sal_uInt32 nSize; - USHORT nVersion; - rStream >> nVersion; - - if ( bKnownItem ) - { - if ( !bOwnPool ) - nWhich = nMappedWhich; - SfxPoolItem *pItem = - ( *( ppStaticDefaults + GetIndex_Impl(nWhich) ) ) - ->Create( rStream, nVersion ); - pItem->SetKind( SFX_ITEMS_POOLDEFAULT ); - *( ppPoolDefaults + GetIndex_Impl(nWhich) ) = pItem; - } - - nLastPos = rStream.Tell(); - aSizeTable >> nSize; - SFX_ASSERT( ( nPos + nSize) >= nLastPos, nPos, - "too many bytes read - version mismatch?" ); - if ( nLastPos < (nPos + nSize) ) - rStream.Seek( nPos + nSize ); - } - - delete[] pBuf; - rStream.Seek(nEndOfSizes); - CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_ENDPOOL ); - CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_ENDPOOL ); - - if ( pSecondary ) - { - if ( !bSecondaryLoaded ) - pSecondary->Load1_Impl( rStream ); - else - rStream.Seek( nSecondaryEnd ); - } - - if ( aExternName != aName ) - aName.Erase(); - - pImp->bStreaming = FALSE; - return rStream; -} - -// ----------------------------------------------------------------------- - -const SfxPoolItem* SfxItemPool::LoadSurrogate -( - SvStream& rStream, // vor einem Surrogat positionierter Stream - USHORT& rWhich, // Which-Id des zu ladenden s - USHORT nSlotId, // Slot-Id des zu ladenden s - const SfxItemPool* pRefPool // in dem das Surrogat gilt -) - -/* [Beschreibung] - - L"adt Surrogat aus 'rStream' und liefert das dadurch in 'rRefPool' - repr"asentierte SfxPoolItem zu"ruck. Ist das im Stream befindliche - Surrogat == SFX_ITEMS_DIRECT (!SFX_ITEM_POOLABLE) wird 0 zur"uckgegeben, - das Item ist direkt aus dem Stream zu laden. Bei 0xfff0 (SFX_ITEMS_NULL) - wird auch 0 zurueckgegeben und rWhich auf 0 gesetzt, das Item ist nicht - verfuegbar. - - Ansonsten wird ber"ucksichtigt, ob der betroffene Pool ohne Ref-Counts - geladen wird, ob aus einem neuen Pool nachgeladen wird (&rRefPool != this) - oder ob aus einem g"anzlich anders aufgebauten Pool geladen wird. - - Wird aus einem anders aufgebauten Pool geladen und die 'nSlotId' kann - nicht in eine Which-Id dieses Pools gemappt werden, wird ebenfalls 0 - zur"uckgeliefert. - - Preconditions: - Pool mu\s geladen sein - - LoadCompleted darf noch nicht gerufen worden sein - - 'rStream' steht genau an der Position, an der ein - Surrogat f"ur ein Item mit der SlotId 'nSlotId' und - der WhichId 'rWhichId' mit StoreSurrogate gepeichert - wurde - - Postconditions: - 'rStream' ist so positioniert, wie auch StoreSurrogate - sein speichern beendet hatte - - konnte ein Item geladen werden, befindet es sich - in diesem SfxItemPool - - 'rWhichId' enth"alt die ggf. gemappte Which-Id - Laufzeit: Tiefe des Ziel Sekund"arpools * 10 + 10 - - [Querverweise] - - -*/ - -{ - // erstmal das Surrogat lesen - USHORT nSurrogat; - rStream >> nSurrogat; - - // direkt gespeichertes Item? - if ( SFX_ITEMS_DIRECT == nSurrogat ) - return 0; - - // nicht vorhandenes Item? - if ( SFX_ITEMS_NULL == nSurrogat ) - { - rWhich = 0; - return 0; - } - - // Bei einem identisch aufgebauten Pool (im Stream) kann das Surrogat - // auf jeden Fall aufgel"ost werden. - if ( !pRefPool ) - pRefPool = this; - FASTBOOL bResolvable = pRefPool->GetName().Len() > 0; - if ( !bResolvable ) - { - // Bei einem anders aufgebauten Pool im Stream, mu\s die SlotId - // aus dem Stream in eine Which-Id gemappt werden k"onnen. - USHORT nMappedWhich = nSlotId ? GetWhich(nSlotId, TRUE) : 0; - if ( IsWhich(nMappedWhich) ) - { - // gemappte SlotId kann "ubernommen werden - rWhich = nMappedWhich; - bResolvable = TRUE; - } - } - - // kann Surrogat aufgel"ost werden? - const SfxPoolItem *pItem = 0; - if ( bResolvable ) - { - for ( SfxItemPool *pTarget = this; pTarget; pTarget = pTarget->pSecondary ) - { - // richtigen (Folge-) Pool gefunden? - if ( pTarget->IsInRange(rWhich) ) - { - // dflt-Attribut? - if ( SFX_ITEMS_STATICDEFAULT == nSurrogat ) - return *(pTarget->ppStaticDefaults + - pTarget->GetIndex_Impl(rWhich)); - - SfxPoolItemArray_Impl* pItemArr = *(pTarget->pImp->ppPoolItems + - pTarget->GetIndex_Impl(rWhich)); - pItem = pItemArr && nSurrogat < pItemArr->Count() - ? (*pItemArr)[nSurrogat] - : 0; - if ( !pItem ) - { - DBG_ERROR( "can't resolve surrogate" ); - rWhich = 0; // nur zur Sicherheit fuer richtige Stream-Pos - return 0; - } - - // Nachladen aus Ref-Pool? - if ( pRefPool != pMaster ) - return &pTarget->Put( *pItem ); - - // Referenzen sind NICHT schon mit Pool geladen worden? - if ( !pTarget->HasPersistentRefCounts() ) - AddRef( *pItem, 1 ); - else - return pItem; - - return pItem; - } - } - - SFX_ASSERT( FALSE, rWhich, "can't resolve Which-Id in LoadSurrogate" ); - } - - return 0; -} - -//------------------------------------------------------------------------- - - -FASTBOOL SfxItemPool::StoreSurrogate -( - SvStream& rStream, - const SfxPoolItem* pItem -) const - -/* [Beschreibung] - - Speichert ein Surrogat f"ur '*pItem' in 'rStream'. - - - [R"uckgabewert] - - FASTBOOL TRUE - es wurde ein echtes Surrogat gespeichert, auch - SFX_ITEMS_NULL bei 'pItem==0', - SFX_ITEMS_STATICDEFAULT und SFX_ITEMS_POOLDEFAULT - gelten als 'echte' Surrogate - - FALSE - es wurde ein Dummy-Surrogat (SFX_ITEMS_DIRECT) - gespeichert, das eigentliche Item mu\s direkt - hinterher selbst gespeichert werden -*/ - -{ - if ( pItem ) - { - FASTBOOL bRealSurrogate = IsItemFlag(*pItem, SFX_ITEM_POOLABLE); - rStream << ( bRealSurrogate - ? GetSurrogate( pItem ) - : (UINT16) SFX_ITEMS_DIRECT ); - return bRealSurrogate; - } - - rStream << (UINT16) SFX_ITEMS_NULL; - return TRUE; -} - -// ----------------------------------------------------------------------- - -USHORT SfxItemPool::GetSurrogate(const SfxPoolItem *pItem) const -{ - DBG_CHKTHIS(SfxItemPool, 0); - DBG_ASSERT( pItem, "no 0-Pointer Surrogate" ); - DBG_ASSERT( !IsInvalidItem(pItem), "no Invalid-Item Surrogate" ); - DBG_ASSERT( !IsPoolDefaultItem(pItem), "no Pool-Default-Item Surrogate" ); - - if ( !IsInRange(pItem->Which()) ) - { - if ( pSecondary ) - return pSecondary->GetSurrogate( pItem ); - SFX_ASSERT( 0, pItem->Which(), "unknown Which-Id - dont ask me for surrogates" ); - } - - // Pointer auf static- oder pool-dflt-Attribut? - if( IsStaticDefaultItem(pItem) || IsPoolDefaultItem(pItem) ) - return SFX_ITEMS_STATICDEFAULT; - - SfxPoolItemArray_Impl* pItemArr = *(pImp->ppPoolItems + GetIndex_Impl(pItem->Which())); - DBG_ASSERT(pItemArr, "ItemArr nicht vorhanden"); - const USHORT nCount = pItemArr->Count(); - for ( USHORT i = 0; i < nCount; ++i ) - { - const SfxPoolItem *p = (*pItemArr)[i]; - if ( p == pItem ) - return i; - } - SFX_ASSERT( 0, pItem->Which(), "Item nicht im Pool"); - return SFX_ITEMS_NULL; -} - -// ----------------------------------------------------------------------- - -FASTBOOL SfxItemPool::IsInStoringRange( USHORT nWhich ) const -{ - return nWhich >= pImp->nStoringStart && - nWhich <= pImp->nStoringEnd; -} - -//------------------------------------------------------------------------ - -void SfxItemPool::SetStoringRange( USHORT nFrom, USHORT nTo ) - -/* [Beschreibung] - - Mit dieser Methode kann der Which-Bereich eingeengt werden, der - von ItemSets dieses Pool (und dem Pool selbst) gespeichert wird. - Die Methode muss dazu vor gerufen werden - und die Werte muessen auch noch gesetzt sein, wenn das eigentliche - Dokument (also die ItemSets gespeicher werden). - - Ein Zuruecksetzen ist dann nicht noetig, wenn dieser Range vor - JEDEM Speichern richtig gesetzt wird, da er nur beim Speichern - beruecksichtigt wird. - - Dieses muss fuer das 3.1-Format gemacht werden, da dort eine - Bug in der Pool-Lade-Methode vorliegt. -*/ - -{ - pImp->nStoringStart = nFrom; - pImp->nStoringEnd = nTo; -} - -// ----------------------------------------------------------------------- - -void SfxItemPool::SetVersionMap -( - USHORT nVer, /* neue Versionsnummer */ - USHORT nOldStart, /* alte erste Which-Id */ - USHORT nOldEnd, /* alte letzte Which-Id */ - USHORT* pOldWhichIdTab /* Array mit genau dem Aufbau der Which-Ids - der vorhergehenden Version, in denen - die jeweils neue Which-Id steht. */ -) - -/* [Beschreibung] - - Mit dieser Methode k"onnen neue, inkompatible Which-Id-Folgen oder - Verteilungen realisiert werden. Pools, die noch mit alten Versionen - gespeichert wurden, werden dann "uber die angegebene Tabelle solange - gemappt, bis die aktuelle Version erreicht ist. Neuere Pools k"onnen - unter Verlust neuer Attribute geladen werden, da die Map mit dem Pool - gespeichert wird. - - Precondition: Pool darf noch nicht geladen sein - Postcondition: Which-Ids aus fr"uheren Versionen k"onnen bei Laden auf - Version 'nVer' gemappt werden - Laufzeit: 1.5 * new + 10 - - [Anmerkung] - - F"ur neue Which-Ranges (nStart,nEnd) m"ssen im Vergleich zur Vorg"anger- - Version (nOldStart,nOldEnd) immer gelten, da\s (nOldStart,nOldEnd) - vollst"andig in (nStart,nEnd) enthalten ist. Es ist also zul"assig, den - Which-Range in beide Richtungen zu erweitern, auch durch Einf"ugung - von Which-Ids, nicht aber ihn zu beschneiden. - - Diese Methode sollte nur im oder direkt nach Aufruf des Konstruktors - gerufen werden. - - Das Array mu\s statisch sein, da es nicht kopiert wird und au\serdem - im Copy-Ctor des SfxItemPool wiederverwendet wird. - - - [Beispiel] - - Urspr"unglich (Version 0) hatte der Pool folgende Which-Ids: - - 1:A, 2:B, 3:C, 4:D - - Nun soll eine neue Version (Version 1) zwei zus"atzliche Ids X und Y - zwischen B und C erhalten, also wie folgt aussehen: - - 1:A, 2:B, 3:X, 4:Y, 5:C, 6:D - - Dabei haben sich also die Ids 3 und 4 ge"andert. F"ur die neue Version - m"u\ste am Pool folgendes gesetzt werden: - - static USHORT nVersion1Map = { 1, 2, 5, 6 }; - pPool->SetVersionMap( 1, 1, 4, &nVersion1Map ); - - - [Querverweise] - - - - - -*/ - -{ - // neuen Map-Eintrag erzeugen und einf"ugen - const SfxPoolVersion_Impl *pVerMap = new SfxPoolVersion_Impl( - nVer, nOldStart, nOldEnd, pOldWhichIdTab ); - pImp->aVersions.Insert( pVerMap, pImp->aVersions.Count() ); - - DBG_ASSERT( nVer > pImp->nVersion, "Versions not sorted" ); - pImp->nVersion = nVer; - - // Versions-Range anpassen - for ( USHORT n = 0; n < nOldEnd-nOldStart+1; ++n ) - { - USHORT nWhich = pOldWhichIdTab[n]; - if ( nWhich < pImp->nVerStart ) - { - if ( !nWhich ) - nWhich = 0; - pImp->nVerStart = nWhich; - } - else if ( nWhich > pImp->nVerEnd ) - pImp->nVerEnd = nWhich; - } -} - -// ----------------------------------------------------------------------- - -USHORT SfxItemPool::GetNewWhich -( - USHORT nFileWhich // die aus dem Stream geladene Which-Id -) const - -/* [Beschreibung] - - Diese Methoden rechnet Which-Ids aus einem File-Format in die der - aktuellen Pool-Version um. Ist das File-Format "alter, werden die vom - Pool-Entwickler mit SetVersion() gesetzten Tabellen verwendet, - ist das File-Format neuer, dann die aus dem File geladenen Tabellen. - Im letzteren Fall kann ggf. nicht jede Which-Id gemappt werden, - so da\s 0 zur"uckgeliefert wird. - - Die Berechnung ist nur f"ur Which-Ids definiert, die in der betreffenden - File-Version unterst"utzt wurden. Dies ist per Assertion abgesichert. - - Precondition: Pool mu\s geladen sein - Postcondition: unver"andert - Laufzeit: linear(Anzahl der Sekund"arpools) + - linear(Differenz zwischen alter und neuer Version) - - - [Querverweise] - - - - - -*/ - -{ - // (Sekund"ar-) Pool bestimmen - if ( !IsInVersionsRange(nFileWhich) ) - { - if ( pSecondary ) - return pSecondary->GetNewWhich( nFileWhich ); - SFX_ASSERT( 0, nFileWhich, "unknown which in GetNewWhich()" ); - } - - // Version neuer/gleich/"alter? - short nDiff = (short)pImp->nLoadingVersion - (short)pImp->nVersion; - - // Which-Id einer neueren Version? - if ( nDiff > 0 ) - { - // von der Top-Version bis runter zur File-Version stufenweise mappen - for ( USHORT nMap = pImp->aVersions.Count(); nMap > 0; --nMap ) - { - SfxPoolVersion_Impl *pVerInfo = pImp->aVersions[nMap-1]; - if ( pVerInfo->_nVer > pImp->nVersion ) - { USHORT nOfs; - USHORT nCount = pVerInfo->_nEnd - pVerInfo->_nStart + 1; - for ( nOfs = 0; - nOfs <= nCount && - pVerInfo->_pMap[nOfs] != nFileWhich; - ++nOfs ) - continue; - - if ( pVerInfo->_pMap[nOfs] == nFileWhich ) - nFileWhich = pVerInfo->_nStart + nOfs; - else - return 0; - } - else - break; - } - } - - // Which-Id einer neueren Version? - else if ( nDiff < 0 ) - { - // von der File-Version bis zur aktuellen Version stufenweise mappen - for ( USHORT nMap = 0; nMap < pImp->aVersions.Count(); ++nMap ) - { - SfxPoolVersion_Impl *pVerInfo = pImp->aVersions[nMap]; - if ( pVerInfo->_nVer > pImp->nLoadingVersion ) - { - DBG_ASSERT( nFileWhich >= pVerInfo->_nStart && - nFileWhich <= pVerInfo->_nEnd, - "which-id unknown in version" ); - nFileWhich = pVerInfo->_pMap[nFileWhich - pVerInfo->_nStart]; - } - } - } - - // originale (nDiff==0) bzw. gemappte (nDiff!=0) Id zur"uckliefern - return nFileWhich; -} - -// ----------------------------------------------------------------------- - - -FASTBOOL SfxItemPool::IsInVersionsRange( USHORT nWhich ) const -{ - return nWhich >= pImp->nVerStart && nWhich <= pImp->nVerEnd; -} - -// ----------------------------------------------------------------------- - -FASTBOOL SfxItemPool::IsCurrentVersionLoading() const - -/* [Beschreibung] - - Mit dieser Methode kann festgestellt werden, ob die geladene Pool-Version - dem aktuellen Pool-Aufbau entspricht. - - Precondition: Pool mu\s geladen sein - Postcondition: unver"andert - Laufzeit: linear(Anzahl der Sekund"arpools) - - - [Querverweise] - - - - - -*/ - -{ - return ( pImp->nVersion == pImp->nLoadingVersion ) && - ( !pSecondary || pSecondary->IsCurrentVersionLoading() ); -} - -// ----------------------------------------------------------------------- - -USHORT SfxItemPool::GetVersion() const - -/* [Beschreibung] - - Diese Methode liefert die aktuelle Versionsnummer des SfxItemPool-Aufbaus - (also des Which-Bereichs). - - Precondition: keine - Postcondition: unver"andert - Laufzeit: 2 - - - [Anmerkung] - - Achtung: Es mu\s ggf. die Versionsnummer von Sekund"arpools - ber"ucksichtigt werden. - - - [Querverweise] - - - - - -*/ - -{ - return pImp->nVersion; -} - -// ----------------------------------------------------------------------- - -USHORT SfxItemPool::GetLoadingVersion() const - -/* [Beschreibung] - - Diese Methode liefert die Versionsnummer des SfxItemPool-Aufbaus - (also des Which-Bereichs), die bei Laden vorgefunden wurde. - - Precondition: Pool mu\s geladen sein - Postcondition: unver"andert - Laufzeit: 2 - - - [Anmerkung] - - Achtung: Es mu\s ggf. die Versionsnummer von Sekund"arpools - ber"ucksichtigt werden. - - - [Querverweise] - - - - - -*/ - -{ - return pImp->nLoadingVersion; -} - -//------------------------------------------------------------------------- - -FASTBOOL SfxItemPool::IsVer2_Impl() const -{ - return pMaster->pImp->nMajorVer >= 2; -} - -//------------------------------------------------------------------------- - - -FASTBOOL SfxItemPool::StoreItem( SvStream &rStream, const SfxPoolItem &rItem, - FASTBOOL bDirect ) const - -/* [Beschreibung] - - Speichert das 'rItem' in den 'rStream' - entweder als Surrogat ('bDirect == FALSE') oder direkt mit 'rItem.Store()'. - Nicht poolable Items werden immer direkt gespeichert. Items ohne Which-Id, - also SID-Items, werden nicht gespeichert, ebenso wenn Items, die in der - File-Format-Version noch nicht vorhanden waren (return FALSE). - - Das Item wird im Stream wie folgt abgelegt: - - USHORT rItem.Which() - USHORT GetSlotId( rItem.Which() ) bzw. 0 falls nicht verf"urbar - USHORT GetSurrogate( &rItem ) bzw. SFX_ITEM_DIRECT bei '!SFX_ITEM_POOLBLE' - - optional (falls 'bDirect == TRUE' oder '!rItem.IsPoolable()': - - USHORT rItem.GetVersion() - ULONG Size - Size rItem.Store() - - - [Querverweise] - - -*/ - -{ - DBG_ASSERT( !IsInvalidItem(&rItem), "cannot store invalid items" ); - - if ( IsSlot( rItem.Which() ) ) - return FALSE; - const SfxItemPool *pPool = this; - while ( !pPool->IsInStoringRange(rItem.Which()) ) - if ( 0 == ( pPool = pPool->pSecondary ) ) - return FALSE; - - DBG_ASSERT( !pImp->bInSetItem || !rItem.ISA(SfxSetItem), - "SetItem contains ItemSet with SetItem" ); - - USHORT nSlotId = pPool->GetSlotId( rItem.Which(), TRUE ); - USHORT nItemVersion = rItem.GetVersion(_nFileFormatVersion); - if ( USHRT_MAX == nItemVersion ) - return FALSE; - - rStream << rItem.Which() << nSlotId; - if ( bDirect || !pPool->StoreSurrogate( rStream, &rItem ) ) - { - rStream << nItemVersion; - rStream << (UINT32) 0L; // Platz fuer Laenge in Bytes - ULONG nIStart = rStream.Tell(); - rItem.Store(rStream, nItemVersion); - ULONG nIEnd = rStream.Tell(); - rStream.Seek( nIStart-4 ); - rStream << (INT32) ( nIEnd-nIStart ); - rStream.Seek( nIEnd ); - } - - return TRUE; -} - -//------------------------------------------------------------------------- - - -const SfxPoolItem* SfxItemPool::LoadItem( SvStream &rStream, FASTBOOL bDirect, - const SfxItemPool *pRefPool ) - -// pRefPool==-1 => nicht putten! - -{ - USHORT nWhich, nSlot; // nSurrogate; - rStream >> nWhich >> nSlot; - - BOOL bDontPut = (SfxItemPool*)-1 == pRefPool; - if ( bDontPut || !pRefPool ) - pRefPool = this; - - // richtigen Sekund"ar-Pool finden - while ( !pRefPool->IsInVersionsRange(nWhich) ) - { - if ( pRefPool->pSecondary ) - pRefPool = pRefPool->pSecondary; - else - { - // WID in der Version nicht vorhanden => ueberspringen - USHORT nSurro, nVersion, nLen; - rStream >> nSurro; - if ( SFX_ITEMS_DIRECT == nSurro ) - { - rStream >> nVersion >> nLen; - rStream.SeekRel( nLen ); - } - return 0; - } - } - - // wird eine andere Version geladen? - FASTBOOL bCurVersion = pRefPool->IsCurrentVersionLoading(); - if ( !bCurVersion ) - // Which-Id auf neue Version mappen - nWhich = pRefPool->GetNewWhich( nWhich ); - - DBG_ASSERT( !nWhich || !pImp->bInSetItem || - !pRefPool->ppStaticDefaults[pRefPool->GetIndex_Impl(nWhich)]->ISA(SfxSetItem), - "loading SetItem in ItemSet of SetItem" ); - - // soll "uber Surrogat geladen werden? - const SfxPoolItem *pItem = 0; - if ( !bDirect ) - { - // Which-Id in dieser Version bekannt? - if ( nWhich ) - // Surrogat laden, reagieren falls keins vorhanden - pItem = LoadSurrogate( rStream, nWhich, nSlot, pRefPool ); - else - // sonst "uberspringen - rStream.SeekRel( sizeof(USHORT) ); - } - - // wird direkt, also nicht "uber Surrogat geladen? - if ( bDirect || ( nWhich && !pItem ) ) - { - // bDirekt bzw. nicht IsPoolable() => Item direkt laden - USHORT nVersion; - sal_uInt32 nLen; - rStream >> nVersion >> nLen; - ULONG nIStart = rStream.Tell(); - - // Which-Id in dieser Version bekannt? - if ( nWhich ) - { - // Item direkt laden - SfxPoolItem *pNewItem = - pRefPool->GetDefaultItem(nWhich).Create(rStream, nVersion); - if ( bDontPut ) - pItem = pNewItem; - else - if ( pNewItem ) - { - pItem = &Put(*pNewItem); - delete pNewItem; - } - else - pItem = 0; - ULONG nIEnd = rStream.Tell(); - DBG_ASSERT( nIEnd <= (nIStart+nLen), "read past end of item" ); - if ( (nIStart+nLen) != nIEnd ) - rStream.Seek( nIStart+nLen ); - } - else - // Item "uberspringen - rStream.Seek( nIStart+nLen ); - } - - return pItem; -} - - diff --git a/svtools/source/items1/poolitem.cxx b/svtools/source/items1/poolitem.cxx deleted file mode 100644 index ef160b4a8b4c..000000000000 --- a/svtools/source/items1/poolitem.cxx +++ /dev/null @@ -1,527 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: poolitem.cxx,v $ - * $Revision: 1.8 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include -#include - -// STATIC DATA ----------------------------------------------------------- - -DBG_NAME(SfxPoolItem) -DBG_NAME(SfxVoidItem) -// @@@ DBG_NAME(SfxInvalidItem); -DBG_NAME(SfxItemHandle) - -BYTE nSfxFlag8Val[8] = -{ - 1, 2, 4, 8, 16, 32, 64, 128 -}; - -USHORT nSfxFlag16Val[16] = -{ - 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, - 1024, 2048, 4096, 8192, 16384, 32768 -}; - -ULONG nSfxFlag32Val[32] = -{ - 0x1L, 0x2L, 0x4L, 0x8L, - 0x10L, 0x20L, 0x40L, 0x80L, - 0x100L, 0x200L, 0x400L, 0x800L, - 0x1000L, 0x2000L, 0x40000L, 0x8000L, - 0x10000L, 0x20000L, 0x40000L, 0x80000L, - 0x100000L, 0x200000L, 0x400000L, 0x800000L, - 0x1000000L, 0x2000000L, 0x4000000L, 0x8000000L, - 0x10000000L, 0x20000000L, 0x40000000L, 0x80000000L -}; - -// RTTI ------------------------------------------------------------------ - -TYPEINIT0(SfxPoolItem); -TYPEINIT1(SfxVoidItem, SfxPoolItem); -// @@@ TYPEINIT1(SfxInvalidItem, SfxPoolItem); -TYPEINIT1(SfxSetItem, SfxPoolItem); -// @@@ TYPEINIT1(SfxItemChangedHint, SfxHint); - -// ------------------------------------------------------------------------ -#if OSL_DEBUG_LEVEL > 1 -static ULONG nItemCount = 0; - -const char* pw1 = "Wow! 10.000 items!"; -const char* pw2 = "Wow! 100.000 items!"; -const char* pw3 = "Wow! 1.000.000 items!"; -const char* pw4 = "Wow! 50.000.000 items!"; -const char* pw5 = "Wow! 10.000.000 items!"; -#endif - -IMPL_PTRHINT(SfxPoolItemHint,SfxPoolItem) - -// SfxPoolItem ----------------------------------------------------------- -SfxPoolItem::SfxPoolItem( USHORT nW ) - : nRefCount( 0 ), - nWhich( nW ) - , nKind( 0 ) -{ - DBG_CTOR(SfxPoolItem, 0); - DBG_ASSERT(nW <= SHRT_MAX, "Which Bereich ueberschritten"); -#if OSL_DEBUG_LEVEL > 1 - ++nItemCount; - if ( pw1 && nItemCount>=10000 ) - { - DBG_WARNING( pw1 ); - pw1 = NULL; - } - if ( pw2 && nItemCount>=100000 ) - { - DBG_WARNING( pw2 ); - pw2 = NULL; - } - if ( pw3 && nItemCount>=1000000 ) - { - DBG_WARNING( pw3 ); - pw3 = NULL; - } - if ( pw4 && nItemCount>=5000000 ) - { - DBG_WARNING( pw4 ); - pw4 = NULL; - } - if ( pw5 && nItemCount>=10000000 ) - { - DBG_WARNING( pw5 ); - pw5 = NULL; - } -#endif -} - -// ----------------------------------------------------------------------- -SfxPoolItem::SfxPoolItem( const SfxPoolItem& rCpy ) - : nRefCount( 0 ), // wird ja ein neues Object! - nWhich( rCpy.Which() ) // Funktion rufen wg. ChkThis() - , nKind( 0 ) -{ - DBG_CTOR(SfxPoolItem, 0); -#if OSL_DEBUG_LEVEL > 1 - ++nItemCount; - if ( pw1 && nItemCount>=10000 ) - { - DBG_WARNING( pw1 ); - pw1 = NULL; - } - if ( pw2 && nItemCount>=100000 ) - { - DBG_WARNING( pw2 ); - pw2 = NULL; - } - if ( pw3 && nItemCount>=1000000 ) - { - DBG_WARNING( pw3 ); - pw3 = NULL; - } - if ( pw4 && nItemCount>=5000000 ) - { - DBG_WARNING( pw4 ); - pw4 = NULL; - } - if ( pw5 && nItemCount>=10000000 ) - { - DBG_WARNING( pw5 ); - pw5 = NULL; - } -#endif -} - -// ------------------------------------------------------------------------ -SfxPoolItem::~SfxPoolItem() -{ - DBG_DTOR(SfxPoolItem, 0); - DBG_ASSERT(nRefCount == 0 || nRefCount > SFX_ITEMS_MAXREF, "destroying item in use" ); -#if OSL_DEBUG_LEVEL > 1 - --nItemCount; -#endif -} - -// ------------------------------------------------------------------------ -int SfxPoolItem::Compare( const SfxPoolItem& ) const -{ - return 0; -} - -// ------------------------------------------------------------------------ -int SfxPoolItem::Compare( const SfxPoolItem& rWith, const IntlWrapper& ) const -{ - return Compare( rWith ); -} - -// ------------------------------------------------------------------------ -int SfxPoolItem::operator==( const SfxPoolItem& rCmp ) const -{ - DBG_CHKTHIS(SfxPoolItem, 0); - return rCmp.Type() == Type(); -} - -// ----------------------------------------------------------------------- -#ifndef TF_POOLABLE - -int SfxPoolItem::IsPoolable() const -{ - DBG_CHKTHIS(SfxPoolItem, 0); - return TRUE; -} -#endif - -// ----------------------------------------------------------------------- -SfxPoolItem* SfxPoolItem::Create(SvStream &, USHORT) const -{ - DBG_CHKTHIS(SfxPoolItem, 0); - return Clone(0); -} - -// ----------------------------------------------------------------------- -USHORT SfxPoolItem::GetVersion( USHORT ) const -{ - DBG_CHKTHIS(SfxPoolItem, 0); - return 0; -} - -// ----------------------------------------------------------------------- -SvStream& SfxPoolItem::Store(SvStream &rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxPoolItem, 0); - return rStream; -} - -//============================================================================ -// static -bool SfxPoolItem::readByteString(SvStream & rStream, UniString & rString) -{ - rStream.ReadByteString(rString); - return rStream.GetError() == ERRCODE_NONE; -} - -//============================================================================ -// static -void SfxPoolItem::writeByteString(SvStream & rStream, - UniString const & rString) -{ - rStream.WriteByteString(rString); -} - -//============================================================================ -// static -bool SfxPoolItem::readUnicodeString(SvStream & rStream, UniString & rString, - bool bUnicode) -{ - rStream.ReadByteString(rString, - bUnicode ? RTL_TEXTENCODING_UCS2 : - rStream.GetStreamCharSet()); - return rStream.GetError() == ERRCODE_NONE; -} - -//============================================================================ -// static -void SfxPoolItem::writeUnicodeString(SvStream & rStream, - UniString const & rString) -{ - rStream.WriteByteString(rString, RTL_TEXTENCODING_UCS2); -} - -// ------------------------------------------------------------------------ -SfxItemPresentation SfxPoolItem::GetPresentation -( - SfxItemPresentation /*ePresentation*/, // IN: wie formatiert werden soll - SfxMapUnit /*eCoreMetric*/, // IN: Ma\seinheit des SfxPoolItems - SfxMapUnit /*ePresentationMetric*/, // IN: Wunsch-Ma\einheit der Darstellung - XubString& /*rText*/, // OUT: textuelle Darstellung - const IntlWrapper * -) const - -/* [Beschreibung] - - "Uber diese virtuelle Methode kann von den SfxPoolItem-Subklassen - eine textuelle Datstellung des Wertes erhalten werden. Sie sollte - von allen UI-relevanten SfxPoolItem-Subklassen "uberladen werden. - - Da die Ma\seinheit des Wertes im SfxItemPool nur "uber - erfragbar ist, und nicht etwa - in der SfxPoolItem-Instanz oder -Subklasse verf"ugbar ist, wird die - eigene Ma\seinheit als 'eCoreMetric' "ubergeben. - - Die darzustellende Ma\seinheit wird als 'ePresentationMetric' - "ubergeben. - - - [R"uckgabewert] - - SfxItemPresentation SFX_ITEM_PRESENTATION_NONE - es konnte keine Text-Darstellung erzeugt werden - - SFX_ITEM_PRESENTATION_NAMELESS - es konnte eine Text-Darstellung (ggf. mit - Ma\seinheit) erzeugt werden, die jedoch keine - semantische Bedeutung enth"alt - - SFX_ITEM_PRESENTATION_COMPLETE - es konnte eine komplette Text-Darstellung mit - semantischer Bedeutung (und ggf. Ma\seinheit) - erzeugt werden - - - [Beispiele] - - pSvxFontItem->GetPresentation( SFX_PRESENTATION_NAMELESS, ... ) - "12pt" mit return SFX_ITEM_PRESENTATION_NAMELESS - - pSvxColorItem->GetPresentation( SFX_PRESENTATION_COMPLETE, ... ) - "rot" mit return SFX_ITEM_PRESENTATION_NAMELESS - (das das SvxColorItem nicht wei\s, was f"ur eine Farbe es darstellt, - kann es keinen Namen angeben, was durch den Returnwert mitgeteilt wird. - - pSvxBorderItem->GetPresentation( SFX_PRESENTATION_COMPLETE, ... ) - "1cm oberer Rand, 2cm linker Rand, 0,2cm unterer Rand, ..." -*/ - -{ - return SFX_ITEM_PRESENTATION_NONE; -} - -// SfxVoidItem ------------------------------------------------------------ -SfxVoidItem::SfxVoidItem( USHORT which ): - SfxPoolItem(which) -{ - DBG_CTOR(SfxVoidItem, 0); -} - -// SfxVoidItem ------------------------------------------------------------ -SfxVoidItem::SfxVoidItem( const SfxVoidItem& rCopy): - SfxPoolItem(rCopy) -{ - DBG_CTOR(SfxVoidItem, 0); -} - -// ------------------------------------------------------------------------ -int SfxVoidItem::operator==( const SfxPoolItem& -#ifdef DBG_UTIL -rCmp -#endif -) const -{ - DBG_CHKTHIS(SfxVoidItem, 0); - DBG_ASSERT( SfxPoolItem::operator==( rCmp ), "unequal type" ); - return TRUE; -} - -// ------------------------------------------------------------------------ -SfxItemPresentation SfxVoidItem::GetPresentation -( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * -) const -{ - DBG_CHKTHIS(SfxVoidItem, 0); - rText.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Void")); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -// ------------------------------------------------------------------------ -SfxPoolItem* SfxVoidItem::Clone(SfxItemPool *) const -{ - DBG_CHKTHIS(SfxVoidItem, 0); - return new SfxVoidItem(*this); -} - -// SfxInvalidItem --------------------------------------------------------- -#if 0 /* @@@ NOT USED @@@ */ -SfxInvalidItem::SfxInvalidItem( USHORT nWhich, const SfxPoolItem &rDefault ): - SfxPoolItem(nWhich), - pDefaultItem(&rDefault) -{ - DBG_CTOR(SfxInvalidItem, 0); -} - -// ------------------------------------------------------------------------ -SfxInvalidItem::SfxInvalidItem( const SfxInvalidItem& rCopy): - SfxPoolItem(rCopy), - pDefaultItem(rCopy.pDefaultItem) -{ - DBG_CTOR(SfxInvalidItem, 0); - //! pDefaultItem->ReleaseRef? -} - -// ------------------------------------------------------------------------ -SfxInvalidItem::~SfxInvalidItem() -{ - DBG_DTOR(SfxInvalidItem, 0); -} - -// ------------------------------------------------------------------------ -int SfxInvalidItem::operator==( const SfxPoolItem& rCmp) const -{ - DBG_CHKTHIS(SfxInvalidItem, 0); - DBG_ASSERT( SfxPoolItem::operator==(rCmp), "unequal type" ); - return *pDefaultItem == *((SfxInvalidItem&)rCmp).pDefaultItem; -} - -// ------------------------------------------------------------------------ -SfxItemPresentation SfxInvalidItem::GetPresentation -( - SfxItemPresentation ePresentation, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresentationMetric, - XubString& rText, - const IntlWrapper * -) const -{ - DBG_CHKTHIS(SfxInvalidItem, 0); - rText.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Invalid")); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -// ------------------------------------------------------------------------ -SfxPoolItem* SfxInvalidItem::Clone(SfxItemPool *) const -{ - DBG_CHKTHIS(SfxInvalidItem, 0); - return new SfxInvalidItem(*this); -} - -// ------------------------------------------------------------------------ -SfxPoolItem* SfxInvalidItem::Create(SvStream &, USHORT nVersion) const -{ - DBG_CHKTHIS(SfxInvalidItem, 0); - DBG_ERROR("SfxInvalidItem::Create() ist sinnlos"); - return Clone(); -} - -// ------------------------------------------------------------------------ -SvStream& SfxInvalidItem::Store(SvStream &rStream, USHORT nItemVersion ) const -{ - DBG_CHKTHIS(SfxInvalidItem, 0); - DBG_ERROR("SfxInvalidItem::Store() ist sinnlos"); - return rStream; -} -#endif /* @@@ NOT USED @@@ */ - -// SfxItemHandle ---------------------------------------------------------- -SfxItemHandle::SfxItemHandle(SfxPoolItem &rItem): - pRef(new USHORT(1)), - pItem(rItem.Clone(0)) -{ - DBG_CTOR(SfxItemHandle, 0); -} - -// ------------------------------------------------------------------------ -SfxItemHandle::SfxItemHandle(const SfxItemHandle &rCopy): - pRef(rCopy.pRef), - pItem(rCopy.pItem) -{ - DBG_CTOR(SfxItemHandle, 0); - ++(*pRef); -} - -// ------------------------------------------------------------------------ -const SfxItemHandle &SfxItemHandle::operator=(const SfxItemHandle &rCopy) -{ - DBG_CHKTHIS(SfxItemHandle, 0); - if(&rCopy == this || pItem == rCopy.pItem) - return *this; - --(*pRef); - if(!(*pRef)) - { - delete pItem; - pItem = 0; - } - pRef = rCopy.pRef; - ++(*pRef); - pItem = rCopy.pItem; - return *this; -} - -// ------------------------------------------------------------------------ -SfxItemHandle::~SfxItemHandle() -{ - DBG_DTOR(SfxItemHandle, 0); - --(*pRef); - if(!(*pRef)) { - delete pRef; pRef = 0; - delete pItem; pItem = 0; - } -} - -// ------------------------------------------------------------------------ -int SfxPoolItem::ScaleMetrics( long /*lMult*/, long /*lDiv*/ ) -{ - return 0; -} - -// ------------------------------------------------------------------------ -int SfxPoolItem::HasMetrics() const -{ - return 0; -} - -// ----------------------------------------------------------------------- -#if 0 /* @@@ NOT USED @@@ */ -void SfxPoolItem::GetVersion() const -{ - DBG_ERROR( "dummy called" ); -} - -// ----------------------------------------------------------------------- -void SfxPoolItem::Store(SvStream &rStream) const -{ - DBG_ERROR( "dummy called" ); -} -#endif /* @@@ NOT USED @@@ */ - -// ----------------------------------------------------------------------- - -BOOL SfxPoolItem::QueryValue( com::sun::star::uno::Any&, BYTE ) const -{ - DBG_ERROR("There is no implementation for QueryValue for this item!"); - return FALSE; -} - -// ----------------------------------------------------------------------- - -BOOL SfxPoolItem::PutValue( const com::sun::star::uno::Any&, BYTE ) -{ - DBG_ERROR("There is no implementation for PutValue for this item!"); - return FALSE; -} - -SfxVoidItem::~SfxVoidItem() -{ - DBG_DTOR(SfxVoidItem, 0); -} diff --git a/svtools/source/items1/sfontitm.cxx b/svtools/source/items1/sfontitm.cxx deleted file mode 100644 index ee7119c95e1c..000000000000 --- a/svtools/source/items1/sfontitm.cxx +++ /dev/null @@ -1,142 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: sfontitm.cxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -#include -#include - -//============================================================================ -// -// class SfxFontItem -// -//============================================================================ - -TYPEINIT1(SfxFontItem, SfxPoolItem); - -//============================================================================ -// virtual -int SfxFontItem::operator ==(const SfxPoolItem & rItem) const -{ - const SfxFontItem * pFontItem = PTR_CAST(SfxFontItem, &rItem); - return pFontItem && m_bHasFont == pFontItem->m_bHasFont - && m_bHasColor == pFontItem->m_bHasColor - && m_bHasFillColor == pFontItem->m_bHasFillColor - && (!m_bHasColor || m_aColor == pFontItem->m_aColor) - && (!m_bHasFillColor || m_aFillColor == pFontItem->m_aFillColor) - && (!m_bHasFont || (m_bKerning == pFontItem->m_bKerning - && m_bShadow == pFontItem->m_bShadow - && m_bOutline == pFontItem->m_bOutline - && m_bWordLine == pFontItem->m_bWordLine - && m_nOrientation == pFontItem->m_nOrientation - && m_nStrikeout == pFontItem->m_nStrikeout - && m_nUnderline == pFontItem->m_nUnderline - && m_nItalic == pFontItem->m_nItalic - && m_nWidthType == pFontItem->m_nWidthType - && m_nWeight == pFontItem->m_nWeight - && m_nPitch == pFontItem->m_nPitch - && m_nFamily == pFontItem->m_nFamily - && m_nLanguage == pFontItem->m_nLanguage - && m_nCharSet == pFontItem->m_nCharSet - && m_aFillColor == pFontItem->m_aFillColor - && m_aColor == pFontItem->m_aColor - && m_aSize == pFontItem->m_aSize - && m_aStyleName == pFontItem->m_aStyleName - && m_aName == pFontItem->m_aName)); -} - -//============================================================================ -// virtual -SfxPoolItem * SfxFontItem::Create(SvStream & rStream, USHORT) const -{ - VersionCompat aItemCompat(rStream, STREAM_READ); - SfxFontItem * pItem = new SfxFontItem(Which()); - { - VersionCompat aFontCompat(rStream, STREAM_READ); - readByteString(rStream, pItem->m_aName); - readByteString(rStream, pItem->m_aStyleName); - rStream >> pItem->m_aSize; - sal_Int16 nCharSet = 0; - rStream >> nCharSet; - pItem->m_nCharSet = rtl_TextEncoding(nCharSet); - rStream >> pItem->m_nFamily >> pItem->m_nPitch >> pItem->m_nWeight - >> pItem->m_nUnderline >> pItem->m_nStrikeout - >> pItem->m_nItalic; - sal_Int16 nLanguage = 0; - rStream >> nLanguage; - pItem->m_nLanguage = LanguageType(nLanguage); - rStream >> pItem->m_nWidthType >> pItem->m_nOrientation; - sal_Int8 nWordLine = 0; - rStream >> nWordLine; - pItem->m_bWordLine = nWordLine != 0; - sal_Int8 nOutline = 0; - rStream >> nOutline; - pItem->m_bOutline = nOutline != 0; - sal_Int8 nShadow = 0; - rStream >> nShadow; - pItem->m_bShadow = nShadow != 0; - sal_Int8 nKerning = 0; - rStream >> nKerning; - pItem->m_bKerning = nKerning != 0; - } - pItem->m_aColor.Read(rStream, TRUE); - pItem->m_aFillColor.Read(rStream, TRUE); - sal_Int16 nFlags = 0; - rStream >> nFlags; - pItem->m_bHasFont = (nFlags & 4) != 0; - pItem->m_bHasColor = (nFlags & 1) != 0; - pItem->m_bHasFillColor = (nFlags & 2) != 0; - return pItem; -} - -//============================================================================ -// virtual -SvStream & SfxFontItem::Store(SvStream & rStream, USHORT) const -{ - VersionCompat aItemCompat(rStream, STREAM_WRITE, 1); - { - VersionCompat aFontCompat(rStream, STREAM_WRITE, 1); - writeByteString(rStream, m_aName); - writeByteString(rStream, m_aStyleName); - rStream << m_aSize << sal_Int16(m_nCharSet) - << m_nFamily << m_nPitch << m_nWeight << m_nUnderline - << m_nStrikeout << m_nItalic << sal_Int16(m_nLanguage) - << m_nWidthType << m_nOrientation << sal_Int8(m_bWordLine) - << sal_Int8(m_bOutline) << sal_Int8(m_bShadow) - << sal_Int8(m_bKerning); - } - SAL_CONST_CAST(Color &, m_aColor).Write(rStream, TRUE); - SAL_CONST_CAST(Color &, m_aFillColor).Write(rStream, TRUE); - rStream << sal_Int16(m_bHasFont << 2 | m_bHasColor - | m_bHasFillColor << 1); - return rStream; -} - diff --git a/svtools/source/items1/sitem.cxx b/svtools/source/items1/sitem.cxx deleted file mode 100644 index 2a917e93bb79..000000000000 --- a/svtools/source/items1/sitem.cxx +++ /dev/null @@ -1,116 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: sitem.cxx,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -// INCLUDE --------------------------------------------------------------- - -#ifndef GCC -#endif - -#include -#include - -#include -#include - - -// STATIC DATA ----------------------------------------------------------- - -DBG_NAME(SfxSetItem) - -// -------------------------------------------------------------------------- - -SfxSetItem::SfxSetItem( USHORT which, const SfxItemSet &rSet) : - SfxPoolItem(which), - pSet(rSet.Clone(TRUE)) -{ - DBG_CTOR(SfxSetItem, 0); -} - -// -------------------------------------------------------------------------- - -SfxSetItem::SfxSetItem( USHORT which, SfxItemSet *pS) : - SfxPoolItem(which), - pSet(pS) -{ - DBG_CTOR(SfxSetItem, 0); - DBG_ASSERT(pS, "SfxSetItem without set constructed" ); -} - -// -------------------------------------------------------------------------- - -SfxSetItem::SfxSetItem( const SfxSetItem& rCopy, SfxItemPool *pPool ) : - SfxPoolItem(rCopy.Which()), - pSet(rCopy.pSet->Clone(TRUE, pPool)) -{ - DBG_CTOR(SfxSetItem, 0); -} - -// -------------------------------------------------------------------------- - -SfxSetItem::~SfxSetItem() -{ - DBG_DTOR(SfxSetItem, 0); - delete pSet; pSet = 0; -} - -// -------------------------------------------------------------------------- - -int SfxSetItem::operator==( const SfxPoolItem& rCmp) const -{ - DBG_CHKTHIS(SfxSetItem, 0); - DBG_ASSERT( SfxPoolItem::operator==( rCmp ), "unequal type" ); - return *pSet == *(((const SfxSetItem &)rCmp).pSet); -} - -// -------------------------------------------------------------------------- - -SfxItemPresentation SfxSetItem::GetPresentation -( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& /*rText*/, - const IntlWrapper * -) const -{ - DBG_CHKTHIS(SfxSetItem, 0); - return SFX_ITEM_PRESENTATION_NONE; -} - -// -------------------------------------------------------------------------- - -SvStream& SfxSetItem::Store(SvStream& rStream, USHORT) const -{ - GetItemSet().Store(rStream); - return rStream; -} - diff --git a/svtools/source/items1/slstitm.cxx b/svtools/source/items1/slstitm.cxx deleted file mode 100644 index 87163d41e033..000000000000 --- a/svtools/source/items1/slstitm.cxx +++ /dev/null @@ -1,425 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: slstitm.cxx,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include -#include -#include -#include -#include - -// STATIC DATA ----------------------------------------------------------- - -DBG_NAME(SfxStringListItem) - -// ----------------------------------------------------------------------- - -TYPEINIT1_AUTOFACTORY(SfxStringListItem, SfxPoolItem); - -class SfxImpStringList -{ -public: - USHORT nRefCount; - List aList; - - SfxImpStringList() { nRefCount = 1; } - ~SfxImpStringList(); - void Sort( BOOL bAscending, List* ); -}; - -//------------------------------------------------------------------------ - -SfxImpStringList::~SfxImpStringList() -{ - DBG_ASSERT(nRefCount!=0xffff,"ImpList already deleted"); - String* pStr = (String*)aList.First(); - while( pStr ) - { - delete pStr; - pStr = (String*)aList.Next(); - } - nRefCount = 0xffff; -} - -//------------------------------------------------------------------------ - -void SfxImpStringList::Sort( BOOL bAscending, List* pParallelList ) -{ - DBG_ASSERT(!pParallelList || pParallelList->Count() >= aList.Count(),"Sort:ParallelList too small"); - ULONG nCount = aList.Count(); - if( nCount > 1 ) - { - nCount -= 2; - // Bubble Dir Einen - BOOL bSwapped = TRUE; - while( bSwapped ) - { - bSwapped = FALSE; - for( ULONG nCur = 0; nCur <= nCount; nCur++ ) - { - String* pStr1 = (String*)aList.GetObject( nCur ); - String* pStr2 = (String*)aList.GetObject( nCur+1 ); - // COMPARE_GREATER => pStr2 ist groesser als pStr1 - StringCompare eCompare = pStr1->CompareIgnoreCaseToAscii( *pStr2 ); //@@@ - BOOL bSwap = FALSE; - if( bAscending ) - { - if( eCompare == COMPARE_LESS ) - bSwap = TRUE; - } - else if( eCompare == COMPARE_GREATER ) - bSwap = TRUE; - - if( bSwap ) - { - bSwapped = TRUE; - aList.Replace( pStr1, nCur + 1 ); - aList.Replace( pStr2, nCur ); - if( pParallelList ) - { - void* p1 = pParallelList->GetObject( nCur ); - void* p2 = pParallelList->GetObject( nCur + 1 ); - pParallelList->Replace( p1, nCur + 1 ); - pParallelList->Replace( p2, nCur ); - } - } - } - } - } -} - -// class SfxStringListItem ----------------------------------------------- - -SfxStringListItem::SfxStringListItem() : - pImp(NULL) -{ -} - -//------------------------------------------------------------------------ - -SfxStringListItem::SfxStringListItem( USHORT which, const List* pList ) : - SfxPoolItem( which ), - pImp(NULL) -{ - // PB: das Putten einer leeren Liste funktionierte nicht, - // deshalb habe ich hier die Abfrage nach dem Count auskommentiert - if( pList /*!!! && pList->Count() */ ) - { - pImp = new SfxImpStringList; - - long i, nCount = pList->Count(); - String *pStr1, *pStr2; - for( i=0; i < nCount; i++ ) - { - pStr1 = (String*)pList->GetObject(i); - pStr2 = new String( *pStr1 ); - pImp->aList.Insert( pStr2, LIST_APPEND ); - } - } -} - -//------------------------------------------------------------------------ - -SfxStringListItem::SfxStringListItem( USHORT which, SvStream& rStream ) : - SfxPoolItem( which ), - pImp(NULL) -{ - long nEntryCount; - rStream >> nEntryCount; - - if( nEntryCount ) - pImp = new SfxImpStringList; - - long i; - String* pStr; - for( i=0; i < nEntryCount; i++ ) - { - pStr = new String; - readByteString(rStream, *pStr); - pImp->aList.Insert( pStr, LIST_APPEND ); - } -} - -//------------------------------------------------------------------------ - -SfxStringListItem::SfxStringListItem( const SfxStringListItem& rItem ) : - SfxPoolItem( rItem ), - pImp(NULL) -{ - pImp = rItem.pImp; - - if( pImp ) - { - DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid"); - pImp->nRefCount++; - } -} - -//------------------------------------------------------------------------ - -SfxStringListItem::~SfxStringListItem() -{ - if( pImp ) - { - DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid"); - if( pImp->nRefCount > 1 ) - pImp->nRefCount--; - else - delete pImp; - } -} - -//------------------------------------------------------------------------ - -List* SfxStringListItem::GetList() -{ - if( !pImp ) - pImp = new SfxImpStringList; - DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid"); - return &(pImp->aList); -} - -//------------------------------------------------------------------------ - -int SfxStringListItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - SfxStringListItem* pItem = (SfxStringListItem*)&rItem; - - if( pImp == pItem->pImp ) - return TRUE; - else - return FALSE; -} - -//------------------------------------------------------------------------ - -SfxItemPresentation SfxStringListItem::GetPresentation -( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * -) const -{ - rText.AssignAscii(RTL_CONSTASCII_STRINGPARAM("(List)")); - return SFX_ITEM_PRESENTATION_NONE; -} - -//------------------------------------------------------------------------ - -SfxPoolItem* SfxStringListItem::Clone( SfxItemPool *) const -{ - return new SfxStringListItem( *this ); - /* - if( pImp ) - return new SfxStringListItem( Which(), &(pImp->aList) ); - else - return new SfxStringListItem( Which(), NULL ); - */ - -} - -//------------------------------------------------------------------------ - -SfxPoolItem* SfxStringListItem::Create( SvStream & rStream, USHORT ) const -{ - return new SfxStringListItem( Which(), rStream ); -} - -//------------------------------------------------------------------------ - -SvStream& SfxStringListItem::Store( SvStream & rStream, USHORT ) const -{ - if( !pImp ) - { - rStream << 0L; - return rStream; - } - - DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid"); - - long nCount = pImp->aList.Count(); - rStream << nCount; - - long i; - String* pStr; - for( i=0; i < nCount; i++ ) - { - pStr = (String*)(pImp->aList.GetObject( i )); - writeByteString(rStream, *pStr); - } - - return rStream; -} - -//------------------------------------------------------------------------ - -void SfxStringListItem::SetString( const XubString& rStr ) -{ - DBG_ASSERT(GetRefCount()==0,"SetString:RefCount!=0"); - - if ( pImp && (pImp->nRefCount == 1) ) - delete pImp; - else - if( pImp ) - pImp->nRefCount--; - pImp = new SfxImpStringList; - - xub_StrLen nStart = 0; - xub_StrLen nDelimPos; - XubString aStr(rStr); - aStr.ConvertLineEnd(LINEEND_CR); - do - { - nDelimPos = aStr.Search( _CR, nStart ); - xub_StrLen nLen; - if ( nDelimPos == STRING_NOTFOUND ) - nLen = 0xffff; - else - nLen = nDelimPos - nStart; - - XubString* pStr = new XubString(aStr.Copy(nStart, nLen)); - // String gehoert der Liste - pImp->aList.Insert( pStr, LIST_APPEND ); - - nStart += nLen + 1 ; // delimiter ueberspringen - } while( nDelimPos != STRING_NOTFOUND ); - - // Kein Leerstring am Ende - if( pImp->aList.Last() && - !((XubString*)pImp->aList.Last())->Len() ) - delete (XubString*)pImp->aList.Remove( pImp->aList.Count()-1 ); -} - -//------------------------------------------------------------------------ - -XubString SfxStringListItem::GetString() -{ - XubString aStr; - if ( pImp ) - { - DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid"); - XubString* pStr = (XubString*)(pImp->aList.First()); - while( pStr ) - { - aStr += *pStr; - pStr = (XubString*)(pImp->aList.Next()); - if ( pStr ) - aStr += '\r'; - } - } - aStr.ConvertLineEnd(); - return aStr; -} - -//------------------------------------------------------------------------ - -#ifndef TF_POOLABLE - -int SfxStringListItem::IsPoolable() const -{ - return FALSE; -} - -#endif - -//------------------------------------------------------------------------ - -void SfxStringListItem::Sort( BOOL bAscending, List* pParallelList ) -{ - DBG_ASSERT(GetRefCount()==0,"Sort:RefCount!=0"); - if( pImp ) - pImp->Sort( bAscending, pParallelList ); -} - -//---------------------------------------------------------------------------- -void SfxStringListItem::SetStringList( const com::sun::star::uno::Sequence< rtl::OUString >& rList ) -{ - DBG_ASSERT(GetRefCount()==0,"SetString:RefCount!=0"); - - if ( pImp && (pImp->nRefCount == 1) ) - delete pImp; - else - if( pImp ) - pImp->nRefCount--; - pImp = new SfxImpStringList; - - for ( sal_Int32 n = 0; n < rList.getLength(); n++ ) - { - XubString* pStr = new XubString( rList[n] ); - // String gehoert der Liste - pImp->aList.Insert( pStr, LIST_APPEND ); - } -} - -//---------------------------------------------------------------------------- -void SfxStringListItem::GetStringList( com::sun::star::uno::Sequence< rtl::OUString >& rList ) const -{ - long nCount = pImp->aList.Count(); - - rList.realloc( nCount ); - for( long i=0; i < nCount; i++ ) - rList[i] = *(String*)(pImp->aList.GetObject( i )); -} - -//---------------------------------------------------------------------------- -// virtual -BOOL SfxStringListItem::PutValue( const com::sun::star::uno::Any& rVal,BYTE ) -{ - com::sun::star::uno::Sequence< rtl::OUString > aValue; - if ( rVal >>= aValue ) - { - SetStringList( aValue ); - return TRUE; - } - - DBG_ERROR( "SfxStringListItem::PutValue - Wrong type!" ); - return FALSE; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL SfxStringListItem::QueryValue( com::sun::star::uno::Any& rVal,BYTE ) const -{ - // GetString() is not const!!! - SfxStringListItem* pThis = const_cast< SfxStringListItem * >( this ); - - com::sun::star::uno::Sequence< rtl::OUString > aStringList; - pThis->GetStringList( aStringList ); - rVal = ::com::sun::star::uno::makeAny( aStringList ); - return TRUE; -} - - diff --git a/svtools/source/items1/stylepool.cxx b/svtools/source/items1/stylepool.cxx deleted file mode 100644 index 5f31500be73c..000000000000 --- a/svtools/source/items1/stylepool.cxx +++ /dev/null @@ -1,542 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: stylepool.cxx,v $ - * $Revision: 1.10.78.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifdef _MSC_VER -#pragma hdrstop -#endif - -#include -#include - -#include "stylepool.hxx" -#include -#include - - -using namespace boost; - -namespace { - // A "Node" represents a subset of inserted SfxItemSets - // The root node represents the empty set - // The other nodes contain a SfxPoolItem and represents an item set which contains their - // pool item and the pool items of their parents. - class Node - { - std::vector mChildren; // child nodes, create by findChildNode(..) - // container of shared pointers of inserted item sets; for non-poolable - // items more than one item set is needed - std::vector< StylePool::SfxItemSet_Pointer_t > maItemSet; - const SfxPoolItem *mpItem; // my pool item - Node *mpUpper; // if I'm a child node that's my parent node - // --> OD 2008-03-07 #i86923# - const bool mbIsItemIgnorable; - // <-- - public: - // --> OD 2008-03-07 #i86923# - Node() // root node Ctor - : mChildren(), - maItemSet(), - mpItem( 0 ), - mpUpper( 0 ), - mbIsItemIgnorable( false ) - {} - Node( const SfxPoolItem& rItem, Node* pParent, const bool bIgnorable ) // child node Ctor - : mChildren(), - maItemSet(), - mpItem( rItem.Clone() ), - mpUpper( pParent ), - mbIsItemIgnorable( bIgnorable ) - {} - // <-- - ~Node(); - // --> OD 2008-03-11 #i86923# - bool hasItemSet( const bool bCheckUsage ) const; - // <-- - // --> OD 2008-04-29 #i87808# -// const StylePool::SfxItemSet_Pointer_t getItemSet() const { return aItemSet[aItemSet.size()-1]; } - const StylePool::SfxItemSet_Pointer_t getItemSet() const - { - return maItemSet.back(); - } - const StylePool::SfxItemSet_Pointer_t getUsedOrLastAddedItemSet() const; - // <-- - void setItemSet( const SfxItemSet& rSet ){ maItemSet.push_back( StylePool::SfxItemSet_Pointer_t( rSet.Clone() ) ); } - // --> OD 2008-03-11 #i86923# - Node* findChildNode( const SfxPoolItem& rItem, - const bool bIsItemIgnorable = false ); - Node* nextItemSet( Node* pLast, - const bool bSkipUnusedItemSet, - const bool bSkipIgnorable ); - // <-- - const SfxPoolItem& getPoolItem() const { return *mpItem; } - // --> OD 2008-03-11 #i86923# - bool hasIgnorableChildren( const bool bCheckUsage ) const; - const StylePool::SfxItemSet_Pointer_t getItemSetOfIgnorableChild( - const bool bSkipUnusedItemSets ) const; - // <-- - }; - - // --> OD 2008-04-29 #i87808# - const StylePool::SfxItemSet_Pointer_t Node::getUsedOrLastAddedItemSet() const - { - std::vector< StylePool::SfxItemSet_Pointer_t >::const_reverse_iterator aIter; - - for ( aIter = maItemSet.rbegin(); aIter != maItemSet.rend(); ++aIter ) - { - if ( (*aIter).use_count() > 1 ) - { - return *aIter; - } - } - - return maItemSet.back(); - } - // <-- - - // --> OD 2008-05-06 #i86923# - bool Node::hasItemSet( const bool bCheckUsage ) const - { - bool bHasItemSet = false; - - if ( maItemSet.size() > 0 ) - { - if ( bCheckUsage ) - { - std::vector< StylePool::SfxItemSet_Pointer_t >::const_reverse_iterator aIter; - - for ( aIter = maItemSet.rbegin(); aIter != maItemSet.rend(); ++aIter ) - { - if ( (*aIter).use_count() > 1 ) - { - bHasItemSet = true; - break; - } - } - } - else - { - bHasItemSet = true; - } - } - return bHasItemSet; - } - // <-- - - // --> OD 2008-03-07 #i86923# - Node* Node::findChildNode( const SfxPoolItem& rItem, - const bool bIsItemIgnorable ) - // <-- - { - Node* pNextNode = this; - std::vector::iterator aIter = mChildren.begin(); - while( aIter != mChildren.end() ) - { - if( rItem.Which() == (*aIter)->getPoolItem().Which() && - rItem == (*aIter)->getPoolItem() ) - return *aIter; - ++aIter; - } - // --> OD 2008-03-07 #i86923# - pNextNode = new Node( rItem, pNextNode, bIsItemIgnorable ); - // <-- - mChildren.push_back( pNextNode ); - return pNextNode; - } - - /* Find the next node which has a SfxItemSet. - The input parameter pLast has a sophisticated meaning: - downstairs only: - pLast == 0 => scan your children and their children - but neither your parents neither your siblings - downstairs and upstairs: - pLast == this => scan your children, their children, - the children of your parent behind you, and so on - partial downstairs and upstairs - pLast != 0 && pLast != this => scan your children behind the given children, - the children of your parent behind you and so on. - - OD 2008-03-11 #i86923# - introduce parameters and - and its handling. - */ - Node* Node::nextItemSet( Node* pLast, - const bool bSkipUnusedItemSets, - const bool bSkipIgnorable ) - { - // Searching downstairs - std::vector::iterator aIter = mChildren.begin(); - // For pLast == 0 and pLast == this all children are of interest - // for another pLast the search starts behind pLast... - if( pLast && pLast != this ) - { - aIter = std::find( mChildren.begin(), mChildren.end(), pLast ); - if( aIter != mChildren.end() ) - ++aIter; - } - Node *pNext = 0; - while( aIter != mChildren.end() ) - { - // --> OD 2008-03-11 #i86923# - if ( bSkipIgnorable && (*aIter)->mbIsItemIgnorable ) - { - ++aIter; - continue; - } - // <-- - pNext = *aIter; - // --> OD 2008-03-11 #i86923# - if ( pNext->hasItemSet( bSkipUnusedItemSets ) ) - { - return pNext; - } - if ( bSkipIgnorable && - pNext->hasIgnorableChildren( bSkipUnusedItemSets ) ) - { - return pNext; - } - pNext = pNext->nextItemSet( 0, bSkipUnusedItemSets, bSkipIgnorable ); // 0 => downstairs only - // <-- - if( pNext ) - return pNext; - ++aIter; - } - // Searching upstairs - if( pLast && mpUpper ) - { - // --> OD 2008-03-11 #i86923# - pNext = mpUpper->nextItemSet( this, bSkipUnusedItemSets, bSkipIgnorable ); - // <-- - } - return pNext; - } - - // --> OD 2008-03-11 #i86923# - bool Node::hasIgnorableChildren( const bool bCheckUsage ) const - { - bool bHasIgnorableChildren( false ); - - std::vector::const_iterator aIter = mChildren.begin(); - while( aIter != mChildren.end() && !bHasIgnorableChildren ) - { - Node* pChild = *aIter; - if ( pChild->mbIsItemIgnorable ) - { - bHasIgnorableChildren = - !bCheckUsage || - ( pChild->hasItemSet( bCheckUsage /* == true */ ) || - pChild->hasIgnorableChildren( bCheckUsage /* == true */ ) ); - } - ++aIter; - } - - return bHasIgnorableChildren; - } - - const StylePool::SfxItemSet_Pointer_t Node::getItemSetOfIgnorableChild( - const bool bSkipUnusedItemSets ) const - { - DBG_ASSERT( hasIgnorableChildren( bSkipUnusedItemSets ), - " - node has no ignorable children" ); - - std::vector::const_iterator aIter = mChildren.begin(); - while( aIter != mChildren.end() ) - { - Node* pChild = *aIter; - if ( pChild->mbIsItemIgnorable ) - { - if ( pChild->hasItemSet( bSkipUnusedItemSets ) ) - { - return pChild->getUsedOrLastAddedItemSet(); - } - else - { - pChild = pChild->nextItemSet( 0, bSkipUnusedItemSets, false ); - if ( pChild ) - { - return pChild->getUsedOrLastAddedItemSet(); - } - } - } - ++aIter; - } - - StylePool::SfxItemSet_Pointer_t pReturn; - return pReturn; - } - // <-- - - Node::~Node() - { - std::vector::iterator aIter = mChildren.begin(); - while( aIter != mChildren.end() ) - { - delete *aIter; - ++aIter; - } - delete mpItem; - } - - class Iterator : public IStylePoolIteratorAccess - { - std::map< const SfxItemSet*, Node >& mrRoot; - std::map< const SfxItemSet*, Node >::iterator mpCurrNode; - Node* mpNode; - const bool mbSkipUnusedItemSets; - const bool mbSkipIgnorable; - public: - // --> OD 2008-03-07 #i86923# - Iterator( std::map< const SfxItemSet*, Node >& rR, - const bool bSkipUnusedItemSets, - const bool bSkipIgnorable ) - : mrRoot( rR ), - mpCurrNode( rR.begin() ), - mpNode(0), - mbSkipUnusedItemSets( bSkipUnusedItemSets ), - mbSkipIgnorable( bSkipIgnorable ) - {} - // <-- - virtual StylePool::SfxItemSet_Pointer_t getNext(); - virtual ::rtl::OUString getName(); - }; - - StylePool::SfxItemSet_Pointer_t Iterator::getNext() - { - StylePool::SfxItemSet_Pointer_t pReturn; - while( mpNode || mpCurrNode != mrRoot.end() ) - { - if( !mpNode ) - { - mpNode = &mpCurrNode->second; - ++mpCurrNode; - // --> OD 2008-03-11 #i86923# - if ( mpNode->hasItemSet( mbSkipUnusedItemSets ) ) - { - // --> OD 2008-04-30 #i87808# -// return pNode->getItemSet(); - return mpNode->getUsedOrLastAddedItemSet(); - // <-- - } - // <-- - } - // --> OD 2008-03-11 #i86923# - mpNode = mpNode->nextItemSet( mpNode, mbSkipUnusedItemSets, mbSkipIgnorable ); - if ( mpNode && mpNode->hasItemSet( mbSkipUnusedItemSets ) ) - { - // --> OD 2008-04-30 #i87808# -// return pNode->getItemSet(); - return mpNode->getUsedOrLastAddedItemSet(); - // <-- - } - if ( mbSkipIgnorable && - mpNode && mpNode->hasIgnorableChildren( mbSkipUnusedItemSets ) ) - { - return mpNode->getItemSetOfIgnorableChild( mbSkipUnusedItemSets ); - } - // <-- - } - return pReturn; - } - - ::rtl::OUString Iterator::getName() - { - ::rtl::OUString aString; - if( mpNode && mpNode->hasItemSet( false ) ) - { - // --> OD 2008-04-30 #i87808# -// aString = StylePool::nameOf( pNode->getItemSet() ); - aString = StylePool::nameOf( mpNode->getUsedOrLastAddedItemSet() ); - // <-- - } - return aString; - } - -} - -/* This static method creates a unique name from a shared pointer to a SfxItemSet - The name is the memory address of the SfxItemSet itself. */ - -::rtl::OUString StylePool::nameOf( SfxItemSet_Pointer_t pSet ) -{ - return ::rtl::OUString::valueOf( reinterpret_cast( pSet.get() ), 16 ); -} - -// class StylePoolImpl organized a tree-structure where every node represents a SfxItemSet. -// The insertItemSet method adds a SfxItemSet into the tree if necessary and returns a shared_ptr -// to a copy of the SfxItemSet. -// The aRoot-Node represents an empty SfxItemSet. - -class StylePoolImpl -{ -private: - std::map< const SfxItemSet*, Node > maRoot; - sal_Int32 mnCount; - // --> OD 2008-03-07 #i86923# - SfxItemSet* mpIgnorableItems; - // <-- -public: - // --> OD 2008-03-07 #i86923# - explicit StylePoolImpl( SfxItemSet* pIgnorableItems = 0 ) - : maRoot(), - mnCount(0), - mpIgnorableItems( pIgnorableItems != 0 - ? pIgnorableItems->Clone( FALSE ) - : 0 ) - { - DBG_ASSERT( !pIgnorableItems || !pIgnorableItems->Count(), - " - misusage: item set for ignorable item should be empty. Please correct usage." ); - DBG_ASSERT( !mpIgnorableItems || !mpIgnorableItems->Count(), - " - does not work as excepted - is not empty. Please inform OD." ); - } - - ~StylePoolImpl() - { - delete mpIgnorableItems; - } - // <-- - - StylePool::SfxItemSet_Pointer_t insertItemSet( const SfxItemSet& rSet ); - - // --> OD 2008-03-07 #i86923# - IStylePoolIteratorAccess* createIterator( bool bSkipUnusedItemSets = false, - bool bSkipIgnorableItems = false ); - // <-- - sal_Int32 getCount() const { return mnCount; } -}; - -StylePool::SfxItemSet_Pointer_t StylePoolImpl::insertItemSet( const SfxItemSet& rSet ) -{ - bool bNonPoolable = false; - Node* pCurNode = &maRoot[ rSet.GetParent() ]; - SfxItemIter aIter( rSet ); - const SfxPoolItem* pItem = aIter.GetCurItem(); - // Every SfxPoolItem in the SfxItemSet causes a step deeper into the tree, - // a complete empty SfxItemSet would stay at the root node. - // --> OD 2008-03-07 #i86923# - // insert ignorable items to the tree leaves. - std::auto_ptr pFoundIgnorableItems; - if ( mpIgnorableItems ) - { - pFoundIgnorableItems.reset( new SfxItemSet( *mpIgnorableItems ) ); - } - while( pItem ) - { - if( !rSet.GetPool()->IsItemFlag(pItem->Which(), SFX_ITEM_POOLABLE ) ) - bNonPoolable = true; - if ( !pFoundIgnorableItems.get() || - ( pFoundIgnorableItems.get() && - pFoundIgnorableItems->Put( *pItem ) == 0 ) ) - { - pCurNode = pCurNode->findChildNode( *pItem ); - } - pItem = aIter.NextItem(); - } - if ( pFoundIgnorableItems.get() && - pFoundIgnorableItems->Count() > 0 ) - { - SfxItemIter aIgnorableItemsIter( *pFoundIgnorableItems ); - pItem = aIgnorableItemsIter.GetCurItem(); - while( pItem ) - { - if( !rSet.GetPool()->IsItemFlag(pItem->Which(), SFX_ITEM_POOLABLE ) ) - bNonPoolable = true; - pCurNode = pCurNode->findChildNode( *pItem, true ); - pItem = aIgnorableItemsIter.NextItem(); - } - } - // <-- - // Every leaf node represents an inserted item set, but "non-leaf" nodes represents subsets - // of inserted itemsets. - // These nodes could have but does not need to have a shared_ptr to a item set. - if( !pCurNode->hasItemSet( false ) ) - { - pCurNode->setItemSet( rSet ); - bNonPoolable = false; // to avoid a double insertion - ++mnCount; - } - // If rSet contains at least one non poolable item, a new itemset has to be inserted - if( bNonPoolable ) - pCurNode->setItemSet( rSet ); -#ifdef DEBUG - { - sal_Int32 nCheck = -1; - sal_Int32 nNo = -1; - IStylePoolIteratorAccess* pIter = createIterator(); - StylePool::SfxItemSet_Pointer_t pTemp; - do - { - ++nCheck; - pTemp = pIter->getNext(); - if( pCurNode->hasItemSet( false ) && pTemp.get() == pCurNode->getItemSet().get() ) - { - ::rtl::OUString aStr = StylePool::nameOf( pTemp ); - nNo = nCheck; - } - } while( pTemp.get() ); - DBG_ASSERT( mnCount == nCheck, "Wrong counting"); - delete pIter; - } -#endif - return pCurNode->getItemSet(); -} - -// --> OD 2008-03-07 #i86923# -IStylePoolIteratorAccess* StylePoolImpl::createIterator( bool bSkipUnusedItemSets, - bool bSkipIgnorableItems ) -{ - return new Iterator( maRoot, bSkipUnusedItemSets, bSkipIgnorableItems ); -} -// <-- - -// Ctor, Dtor and redirected methods of class StylePool, nearly inline ;-) - -// --> OD 2008-03-07 #i86923# -StylePool::StylePool( SfxItemSet* pIgnorableItems ) - : pImpl( new StylePoolImpl( pIgnorableItems ) ) -{} -// <-- - -StylePool::SfxItemSet_Pointer_t StylePool::insertItemSet( const SfxItemSet& rSet ) -{ return pImpl->insertItemSet( rSet ); } - -// --> OD 2008-03-11 #i86923# -IStylePoolIteratorAccess* StylePool::createIterator( const bool bSkipUnusedItemSets, - const bool bSkipIgnorableItems ) -{ - return pImpl->createIterator( bSkipUnusedItemSets, bSkipIgnorableItems ); -} -// <-- - -sal_Int32 StylePool::getCount() const -{ return pImpl->getCount(); } - -StylePool::~StylePool() { delete pImpl; } - -// End of class StylePool - diff --git a/svtools/source/items1/tfrmitem.cxx b/svtools/source/items1/tfrmitem.cxx deleted file mode 100644 index a7019ff69947..000000000000 --- a/svtools/source/items1/tfrmitem.cxx +++ /dev/null @@ -1,184 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: tfrmitem.cxx,v $ - * $Revision: 1.8 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include - -#include -#include -#include - -#include - -DBG_NAME( SfxTargetFrameItem ) -TYPEINIT1( SfxTargetFrameItem, SfxPoolItem ); - -// ----------------------------------------------------------------------- - -SfxTargetFrameItem::SfxTargetFrameItem( USHORT which ) : - SfxPoolItem( which ) -{ - DBG_CTOR( SfxTargetFrameItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxTargetFrameItem::SfxTargetFrameItem( const SfxTargetFrameItem& rItem ) : - SfxPoolItem( rItem ) -{ - DBG_CTOR( SfxTargetFrameItem, 0 ); - for( USHORT nCur = 0; nCur <= (USHORT)SfxOpenModeLast; nCur++ ) - _aFrames[nCur] = rItem._aFrames[nCur]; -} - -// ----------------------------------------------------------------------- - -SfxTargetFrameItem::SfxTargetFrameItem( USHORT which, - const String& rOpenSelectFrame, const String& rOpenOpenFrame, - const String& rOpenAddTaskFrame ) : SfxPoolItem( which ) -{ - DBG_CTOR( SfxTargetFrameItem, 0 ); - _aFrames[ (USHORT)SfxOpenSelect ] = rOpenSelectFrame; - _aFrames[ (USHORT)SfxOpenOpen ] = rOpenOpenFrame; - _aFrames[ (USHORT)SfxOpenAddTask ] = rOpenAddTaskFrame; -} - -// ----------------------------------------------------------------------- - -SfxTargetFrameItem::~SfxTargetFrameItem() -{ - DBG_DTOR(SfxTargetFrameItem, 0); -} - -// ----------------------------------------------------------------------- - -String SfxTargetFrameItem::GetTargetFrame( SfxOpenMode eMode ) const -{ - DBG_CHKTHIS( SfxTargetFrameItem, 0 ); - if( eMode <= SfxOpenModeLast ) - return _aFrames[ (USHORT)eMode ]; - String aResult; - return aResult; -} - -// ----------------------------------------------------------------------- - -int SfxTargetFrameItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS( SfxTargetFrameItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - for( USHORT nCur = 0; nCur <= (USHORT)SfxOpenModeLast; nCur++ ) - { - if( _aFrames[nCur] != ((const SfxTargetFrameItem&)rItem)._aFrames[nCur] ) - return 0; - } - return 1; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxTargetFrameItem::Create( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxTargetFrameItem, 0); - SfxTargetFrameItem* pItem = new SfxTargetFrameItem( Which() ); - USHORT nCount = 0; - rStream >> nCount; - for(USHORT nCur=0; nCur<= (USHORT)SfxOpenModeLast && nCount; nCur++,nCount--) - { - readByteString(rStream, pItem->_aFrames[ nCur ]); - } - // die uebriggebliebenen ueberspringen - String aTemp; - while( nCount ) - { - readByteString(rStream, aTemp); - nCount--; - } - return pItem; -} - -// ----------------------------------------------------------------------- - -SvStream& SfxTargetFrameItem::Store( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS( SfxTargetFrameItem, 0 ); - USHORT nCount = (USHORT)(SfxOpenModeLast+1); - rStream << nCount; - for( USHORT nCur = 0; nCur <= (USHORT)SfxOpenModeLast; nCur++ ) - { - writeByteString(rStream, _aFrames[ nCur ]); - } - return rStream; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxTargetFrameItem::Clone( SfxItemPool* ) const -{ - DBG_CHKTHIS( SfxTargetFrameItem, 0 ); - return new SfxTargetFrameItem( *this ); -} - -// ----------------------------------------------------------------------- -// virtual -BOOL SfxTargetFrameItem::QueryValue( com::sun::star::uno::Any& rVal,BYTE ) const -{ - String aVal; - for ( int i = 0; i <= SfxOpenModeLast; i++ ) - { - aVal += _aFrames[ i ]; - aVal += ';' ; - } - - rVal <<= rtl::OUString( aVal ); - return TRUE; -} - -// ----------------------------------------------------------------------- -// virtual -BOOL SfxTargetFrameItem::PutValue( const com::sun::star::uno::Any& rVal,BYTE ) -{ - rtl::OUString aValue; - if ( rVal >>= aValue ) - { - const String aVal( aValue ); - - for ( USHORT i = 0; i <= SfxOpenModeLast; i++ ) - _aFrames[ i ] = aVal.GetToken( i ); - - return TRUE; - } - - DBG_ERROR( "SfxTargetFrameItem::PutValue - Wrong type!" ); - return FALSE; -} - diff --git a/svtools/source/items1/tresitem.cxx b/svtools/source/items1/tresitem.cxx deleted file mode 100644 index 6e70c82a4d03..000000000000 --- a/svtools/source/items1/tresitem.cxx +++ /dev/null @@ -1,78 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: tresitem.cxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include - -using namespace com::sun::star; - -//============================================================================ -// -// CntTransferResultItem -// -//============================================================================ - -TYPEINIT1_AUTOFACTORY(CntTransferResultItem, SfxPoolItem) - -//============================================================================ -// virtual -int CntTransferResultItem::operator ==(SfxPoolItem const & rItem) const -{ - if (CntTransferResultItem * pResultItem = PTR_CAST(CntTransferResultItem, - &rItem)) - return m_aResult.Source == pResultItem->m_aResult.Source - && m_aResult.Target == pResultItem->m_aResult.Target - && m_aResult.Result == pResultItem->m_aResult.Result; - return false; -} - -//============================================================================ -// virtual -BOOL CntTransferResultItem::QueryValue(uno::Any & rVal, BYTE) const -{ - rVal <<= m_aResult; - return true; -} - -//============================================================================ -// virtual -BOOL CntTransferResultItem::PutValue(uno::Any const & rVal, BYTE) -{ - return rVal >>= m_aResult; -} - -//============================================================================ -// virtual -SfxPoolItem * CntTransferResultItem::Clone(SfxItemPool *) const -{ - return new CntTransferResultItem(*this); -} - diff --git a/svtools/source/items1/visitem.cxx b/svtools/source/items1/visitem.cxx deleted file mode 100644 index 112b223a8be0..000000000000 --- a/svtools/source/items1/visitem.cxx +++ /dev/null @@ -1,148 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: visitem.cxx,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -#include -#include - -//============================================================================ -// -// class SfxVisibilityItem -// -//============================================================================ - -DBG_NAME(SfxVisibilityItem) - -//============================================================================ -TYPEINIT1_AUTOFACTORY(SfxVisibilityItem, SfxPoolItem); - -//============================================================================ -SfxVisibilityItem::SfxVisibilityItem(USHORT which, SvStream & rStream): - SfxPoolItem(which) -{ - DBG_CTOR(SfxVisibilityItem, 0); - sal_Bool bValue = 0; - rStream >> bValue; - m_nValue.bVisible = bValue; -} - -//============================================================================ -// virtual -int SfxVisibilityItem::operator ==(const SfxPoolItem & rItem) const -{ - DBG_CHKTHIS(SfxVisibilityItem, 0); - DBG_ASSERT(SfxPoolItem::operator ==(rItem), "unequal type"); - return m_nValue.bVisible == SAL_STATIC_CAST(const SfxVisibilityItem *, &rItem)-> - m_nValue.bVisible; -} - -//============================================================================ -// virtual -int SfxVisibilityItem::Compare(const SfxPoolItem & rWith) const -{ - DBG_ASSERT(rWith.ISA(SfxVisibilityItem), "SfxVisibilityItem::Compare(): Bad type"); - return m_nValue.bVisible == static_cast< SfxVisibilityItem const * >(&rWith)->m_nValue.bVisible ? - 0 : m_nValue.bVisible ? -1 : 1; -} - -//============================================================================ -// virtual -SfxItemPresentation SfxVisibilityItem::GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, - XubString & rText, - const IntlWrapper *) const -{ - rText = GetValueTextByVal(m_nValue.bVisible); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - - -//============================================================================ -// virtual -BOOL SfxVisibilityItem::QueryValue(com::sun::star::uno::Any& rVal,BYTE) const -{ - rVal <<= m_nValue; - return TRUE; -} - -//============================================================================ -// virtual -BOOL SfxVisibilityItem::PutValue(const com::sun::star::uno::Any& rVal,BYTE) -{ - if (rVal >>= m_nValue) - return TRUE; - - DBG_ERROR( "SfxInt16Item::PutValue - Wrong type!" ); - return FALSE; -} - -//============================================================================ -// virtual -SfxPoolItem * SfxVisibilityItem::Create(SvStream & rStream, USHORT) const -{ - DBG_CHKTHIS(SfxVisibilityItem, 0); - return new SfxVisibilityItem(Which(), rStream); -} - -//============================================================================ -// virtual -SvStream & SfxVisibilityItem::Store(SvStream & rStream, USHORT) const -{ - DBG_CHKTHIS(SfxVisibilityItem, 0); - rStream << m_nValue.bVisible; - return rStream; -} - -//============================================================================ -// virtual -SfxPoolItem * SfxVisibilityItem::Clone(SfxItemPool *) const -{ - DBG_CHKTHIS(SfxVisibilityItem, 0); - return new SfxVisibilityItem(*this); -} - -//============================================================================ -// virtual -USHORT SfxVisibilityItem::GetValueCount() const -{ - return 2; -} - -//============================================================================ -// virtual -UniString SfxVisibilityItem::GetValueTextByVal(BOOL bTheValue) const -{ - return - bTheValue ? - UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("TRUE")) : - UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("FALSE")); -} diff --git a/svtools/source/items1/whassert.hxx b/svtools/source/items1/whassert.hxx deleted file mode 100644 index fe9a834816c2..000000000000 --- a/svtools/source/items1/whassert.hxx +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: whassert.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFX_WHASSERT_HXX -#define _SFX_WHASSERT_HXX - -#include -#include - -//------------------------------------------------------------------------ - -#ifdef DBG_UTIL -#define SFX_ASSERT( bCondition, nId, sMessage ) \ -{ \ - if ( DbgIsAssert() ) \ - { \ - if ( !(bCondition) ) \ - { \ - ByteString aMsg( sMessage ); \ - aMsg.Append(RTL_CONSTASCII_STRINGPARAM("\nwith Id/Pos: ")); \ - aMsg += ByteString::CreateFromInt32( nId ); \ - DbgOut( aMsg.GetBuffer(), DBG_OUT_ERROR, __FILE__, __LINE__); \ - } \ - } \ -} -#else -#define SFX_ASSERT( bCondition, nId, sMessage ) -#endif - - -#endif diff --git a/svtools/source/items1/whiter.cxx b/svtools/source/items1/whiter.cxx deleted file mode 100644 index 461daf7ac012..000000000000 --- a/svtools/source/items1/whiter.cxx +++ /dev/null @@ -1,127 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: whiter.cxx,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -// INCLUDE --------------------------------------------------------------- -#ifndef GCC -#endif - -#include "whiter.hxx" -#include - -DBG_NAME(SfxWhichIter) - -// ----------------------------------------------------------------------- - -SfxWhichIter::SfxWhichIter( const SfxItemSet& rSet, USHORT nFromWh, USHORT nToWh ): - pRanges(rSet.GetRanges()), - pStart(rSet.GetRanges()), - nOfst(0), nFrom(nFromWh), nTo(nToWh) -{ - DBG_CTOR(SfxWhichIter, 0); - if ( nFrom > 0 ) - FirstWhich(); -} - -// ----------------------------------------------------------------------- - -SfxWhichIter::~SfxWhichIter() -{ - DBG_DTOR(SfxWhichIter, 0); -} - -// ----------------------------------------------------------------------- - -USHORT SfxWhichIter::NextWhich() -{ - DBG_CHKTHIS(SfxWhichIter, 0); - while ( 0 != *pRanges ) - { - const USHORT nLastWhich = *pRanges + nOfst; - ++nOfst; - if (*(pRanges+1) == nLastWhich) - { - pRanges += 2; - nOfst = 0; - } - USHORT nWhich = *pRanges + nOfst; - if ( 0 == nWhich || ( nWhich >= nFrom && nWhich <= nTo ) ) - return nWhich; - } - return 0; -} - -// ----------------------------------------------------------------------- - -USHORT SfxWhichIter::PrevWhich() -{ - DBG_CHKTHIS(SfxWhichIter, 0); - while ( pRanges != pStart || 0 != nOfst ) - { - if(nOfst) - --nOfst; - else { - pRanges -= 2; - nOfst = *(pRanges+1) - (*pRanges); - } - USHORT nWhich = *pRanges + nOfst; - if ( nWhich >= nFrom && nWhich <= nTo ) - return nWhich; - } - return 0; -} - -// ----------------------------------------------------------------------- - -USHORT SfxWhichIter::FirstWhich() -{ - DBG_CHKTHIS(SfxWhichIter, 0); - pRanges = pStart; - nOfst = 0; - if ( *pRanges >= nFrom && *pRanges <= nTo ) - return *pRanges; - return NextWhich(); -} - -// ----------------------------------------------------------------------- - -USHORT SfxWhichIter::LastWhich() -{ - DBG_CHKTHIS(SfxWhichIter, 0); - while(*pRanges) - ++pRanges; - nOfst = 0; - USHORT nWhich = *(pRanges-1); - if ( nWhich >= nFrom && nWhich <= nTo ) - return nWhich; - return PrevWhich(); -} - diff --git a/svtools/source/memtools/makefile.mk b/svtools/source/memtools/makefile.mk deleted file mode 100644 index 4592bceff8cc..000000000000 --- a/svtools/source/memtools/makefile.mk +++ /dev/null @@ -1,50 +0,0 @@ -#************************************************************************* -# -# 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 -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.5 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=svtools -TARGET=svarray - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svl.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES=\ - $(SLO)$/svarray.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/svtools/source/memtools/svarray.cxx b/svtools/source/memtools/svarray.cxx deleted file mode 100644 index fe682e5f535d..000000000000 --- a/svtools/source/memtools/svarray.cxx +++ /dev/null @@ -1,385 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: svarray.cxx,v $ - * $Revision: 1.8 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#define _SVARRAY_CXX - -#define _SVSTDARR_BOOLS -#define _SVSTDARR_BYTES -#define _SVSTDARR_ULONGS -#define _SVSTDARR_ULONGSSORT -#define _SVSTDARR_USHORTS -#define _SVSTDARR_LONGS -#define _SVSTDARR_LONGSSORT -#define _SVSTDARR_SHORTS -#define _SVSTDARR_STRINGS -#define _SVSTDARR_STRINGSDTOR -#define _SVSTDARR_STRINGSSORT -#define _SVSTDARR_STRINGSSORTDTOR -#define _SVSTDARR_STRINGSISORT -#define _SVSTDARR_STRINGSISORTDTOR -#define _SVSTDARR_USHORTSSORT - -#define _SVSTDARR_BYTESTRINGS -#define _SVSTDARR_BYTESTRINGSDTOR -#define _SVSTDARR_BYTESTRINGSSORT -#define _SVSTDARR_BYTESTRINGSSORTDTOR -#define _SVSTDARR_BYTESTRINGSISORT -#define _SVSTDARR_BYTESTRINGSISORTDTOR - -#define _SVSTDARR_XUB_STRLEN -#define _SVSTDARR_XUB_STRLENSORT - -#include -#include -#include - -SV_IMPL_VARARR(SvPtrarr,VoidPtr) -SV_IMPL_VARARR_PLAIN(SvPtrarrPlain,VoidPtr) - -USHORT SvPtrarr::GetPos( const VoidPtr& aElement ) const -{ USHORT n; - for( n=0; n < nA && *(GetData()+n) != aElement; ) n++; - return ( n >= nA ? USHRT_MAX : n ); -} - -USHORT SvPtrarrPlain::GetPos( const VoidPtr aElement ) const -{ USHORT n; - for( n=0; n < nA && *(GetData()+n) != aElement; ) n++; - return ( n >= nA ? USHRT_MAX : n ); -} - - -SV_IMPL_VARARR( SvBools, BOOL ) -SV_IMPL_VARARR( SvBytes, BYTE ) -SV_IMPL_VARARR( SvULongs, ULONG ) -SV_IMPL_VARARR( SvUShorts, USHORT ) -SV_IMPL_VARARR( SvLongs, long) -SV_IMPL_VARARR( SvShorts, short ) - -SV_IMPL_VARARR_SORT( SvULongsSort, ULONG ) -SV_IMPL_VARARR_SORT( SvLongsSort, long ) -SV_IMPL_VARARR_SORT( SvXub_StrLensSort, xub_StrLen ) - -SV_IMPL_VARARR( SvXub_StrLens, xub_StrLen ) - -SV_IMPL_PTRARR( SvStrings, StringPtr ) -SV_IMPL_PTRARR( SvStringsDtor, StringPtr ) -SV_IMPL_OP_PTRARR_SORT( SvStringsSort, StringPtr ) -SV_IMPL_OP_PTRARR_SORT( SvStringsSortDtor, StringPtr ) - -SV_IMPL_PTRARR( SvByteStrings, ByteStringPtr ) -SV_IMPL_PTRARR( SvByteStringsDtor, ByteStringPtr ) -SV_IMPL_OP_PTRARR_SORT( SvByteStringsSort, ByteStringPtr ) -SV_IMPL_OP_PTRARR_SORT( SvByteStringsSortDtor, ByteStringPtr ) - - - -// ---------------- strings ------------------------------------- - -// Array mit anderer Seek-Methode! -_SV_IMPL_SORTAR_ALG( SvStringsISort, StringPtr ) -void SvStringsISort::DeleteAndDestroy( USHORT nP, USHORT nL ) -{ - if( nL ) - { - DBG_ASSERT( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" ); - for( USHORT n=nP; n < nP + nL; n++ ) - delete *((StringPtr*)pData+n); - SvPtrarr::Remove( nP, nL ); - } -} -BOOL SvStringsISort::Seek_Entry( const StringPtr aE, USHORT* pP ) const -{ - register USHORT nO = SvStringsISort_SAR::Count(), - nM, - nU = 0; - if( nO > 0 ) - { - nO--; - while( nU <= nO ) - { - nM = nU + ( nO - nU ) / 2; - StringCompare eCmp = (*((StringPtr*)pData + nM))-> - CompareIgnoreCaseToAscii( *(aE) ); - if( COMPARE_EQUAL == eCmp ) - { - if( pP ) *pP = nM; - return TRUE; - } - else if( COMPARE_LESS == eCmp ) - nU = nM + 1; - else if( nM == 0 ) - { - if( pP ) *pP = nU; - return FALSE; - } - else - nO = nM - 1; - } - } - if( pP ) *pP = nU; - return FALSE; -} - -// ---------------- strings ------------------------------------- - -// Array mit anderer Seek-Methode! -_SV_IMPL_SORTAR_ALG( SvStringsISortDtor, StringPtr ) -void SvStringsISortDtor::DeleteAndDestroy( USHORT nP, USHORT nL ) -{ - if( nL ) - { - DBG_ASSERT( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" ); - for( USHORT n=nP; n < nP + nL; n++ ) - delete *((StringPtr*)pData+n); - SvPtrarr::Remove( nP, nL ); - } -} -BOOL SvStringsISortDtor::Seek_Entry( const StringPtr aE, USHORT* pP ) const -{ - register USHORT nO = SvStringsISortDtor_SAR::Count(), - nM, - nU = 0; - if( nO > 0 ) - { - nO--; - while( nU <= nO ) - { - nM = nU + ( nO - nU ) / 2; - StringCompare eCmp = (*((StringPtr*)pData + nM))-> - CompareIgnoreCaseToAscii( *(aE) ); - if( COMPARE_EQUAL == eCmp ) - { - if( pP ) *pP = nM; - return TRUE; - } - else if( COMPARE_LESS == eCmp ) - nU = nM + 1; - else if( nM == 0 ) - { - if( pP ) *pP = nU; - return FALSE; - } - else - nO = nM - 1; - } - } - if( pP ) *pP = nU; - return FALSE; -} - -// ---------------- Ushorts ------------------------------------- - -/* SortArray fuer UShorts */ -BOOL SvUShortsSort::Seek_Entry( const USHORT aE, USHORT* pP ) const -{ - register USHORT nO = SvUShorts::Count(), - nM, - nU = 0; - if( nO > 0 ) - { - nO--; - while( nU <= nO ) - { - nM = nU + ( nO - nU ) / 2; - if( *(pData + nM) == aE ) - { - if( pP ) *pP = nM; - return TRUE; - } - else if( *(pData + nM) < aE ) - nU = nM + 1; - else if( nM == 0 ) - { - if( pP ) *pP = nU; - return FALSE; - } - else - nO = nM - 1; - } - } - if( pP ) *pP = nU; - return FALSE; -} - -void SvUShortsSort::Insert( const SvUShortsSort * pI, USHORT nS, USHORT nE ) -{ - if( USHRT_MAX == nE ) - nE = pI->Count(); - USHORT nP; - const USHORT * pIArr = pI->GetData(); - for( ; nS < nE; ++nS ) - { - if( ! Seek_Entry( *(pIArr+nS), &nP) ) - SvUShorts::Insert( *(pIArr+nS), nP ); - if( ++nP >= Count() ) - { - SvUShorts::Insert( pI, nP, nS+1, nE ); - nS = nE; - } - } -} - -BOOL SvUShortsSort::Insert( const USHORT aE ) -{ - USHORT nP; - BOOL bExist = Seek_Entry( aE, &nP ); - if( !bExist ) - SvUShorts::Insert( aE, nP ); - return !bExist; -} - -BOOL SvUShortsSort::Insert( const USHORT aE, USHORT& rP ) -{ - BOOL bExist = Seek_Entry( aE, &rP ); - if( !bExist ) - SvUShorts::Insert( aE, rP ); - return !bExist; -} - -void SvUShortsSort::Insert( const USHORT* pE, USHORT nL) -{ - USHORT nP; - for( USHORT n = 0; n < nL; ++n ) - if( ! Seek_Entry( *(pE+n), &nP )) - SvUShorts::Insert( *(pE+n), nP ); -} - -// remove ab Pos -void SvUShortsSort::RemoveAt( const USHORT nP, USHORT nL ) -{ - if( nL ) - SvUShorts::Remove( nP, nL); -} - -// remove ab dem Eintrag -void SvUShortsSort::Remove( const USHORT aE, USHORT nL ) -{ - USHORT nP; - if( nL && Seek_Entry( aE, &nP ) ) - SvUShorts::Remove( nP, nL); -} - -// ---------------- bytestrings ------------------------------------- - -// Array mit anderer Seek-Methode! -_SV_IMPL_SORTAR_ALG( SvByteStringsISort, ByteStringPtr ) -void SvByteStringsISort::DeleteAndDestroy( USHORT nP, USHORT nL ) -{ - if( nL ) - { - DBG_ASSERT( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" ); - for( USHORT n=nP; n < nP + nL; n++ ) - delete *((ByteStringPtr*)pData+n); - SvPtrarr::Remove( nP, nL ); - } -} -BOOL SvByteStringsISort::Seek_Entry( const ByteStringPtr aE, USHORT* pP ) const -{ - register USHORT nO = SvByteStringsISort_SAR::Count(), - nM, - nU = 0; - if( nO > 0 ) - { - nO--; - while( nU <= nO ) - { - nM = nU + ( nO - nU ) / 2; - StringCompare eCmp = (*((ByteStringPtr*)pData + nM))-> - CompareIgnoreCaseToAscii( *(aE) ); - if( COMPARE_EQUAL == eCmp ) - { - if( pP ) *pP = nM; - return TRUE; - } - else if( COMPARE_LESS == eCmp ) - nU = nM + 1; - else if( nM == 0 ) - { - if( pP ) *pP = nU; - return FALSE; - } - else - nO = nM - 1; - } - } - if( pP ) *pP = nU; - return FALSE; -} - - -// Array mit anderer Seek-Methode! -_SV_IMPL_SORTAR_ALG( SvByteStringsISortDtor, ByteStringPtr ) -void SvByteStringsISortDtor::DeleteAndDestroy( USHORT nP, USHORT nL ) -{ - if( nL ) - { - DBG_ASSERT( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" ); - for( USHORT n=nP; n < nP + nL; n++ ) - delete *((ByteStringPtr*)pData+n); - SvPtrarr::Remove( nP, nL ); - } -} -BOOL SvByteStringsISortDtor::Seek_Entry( const ByteStringPtr aE, USHORT* pP ) const -{ - register USHORT nO = SvByteStringsISortDtor_SAR::Count(), - nM, - nU = 0; - if( nO > 0 ) - { - nO--; - while( nU <= nO ) - { - nM = nU + ( nO - nU ) / 2; - StringCompare eCmp = (*((ByteStringPtr*)pData + nM))-> - CompareIgnoreCaseToAscii( *(aE) ); - if( COMPARE_EQUAL == eCmp ) - { - if( pP ) *pP = nM; - return TRUE; - } - else if( COMPARE_LESS == eCmp ) - nU = nM + 1; - else if( nM == 0 ) - { - if( pP ) *pP = nU; - return FALSE; - } - else - nO = nM - 1; - } - } - if( pP ) *pP = nU; - return FALSE; -} - diff --git a/svtools/source/misc/config.src b/svtools/source/misc/config.src deleted file mode 100644 index e11aeb86f402..000000000000 --- a/svtools/source/misc/config.src +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: config.src,v $ - * $Revision: 1.29 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include - -String STR_WARNING_ITEM -{ - Text [ en-US ] = "Incorrect Version!" ; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svtools/source/misc/documentlockfile.cxx b/svtools/source/misc/documentlockfile.cxx deleted file mode 100644 index 1f54a6771f95..000000000000 --- a/svtools/source/misc/documentlockfile.cxx +++ /dev/null @@ -1,238 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: documentlockfile.cxx,v $ - * - * $Revision: 1.3.82.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include - -#include -#include - -#include - -#include - -#include - -using namespace ::com::sun::star; - -namespace svt { - -sal_Bool DocumentLockFile::m_bAllowInteraction = sal_True; - -// ---------------------------------------------------------------------- -DocumentLockFile::DocumentLockFile( const ::rtl::OUString& aOrigURL, const uno::Reference< lang::XMultiServiceFactory >& xFactory ) -: LockFileCommon( aOrigURL, xFactory, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".~lock." ) ) ) -{ -} - -// ---------------------------------------------------------------------- -DocumentLockFile::~DocumentLockFile() -{ -} - -// ---------------------------------------------------------------------- -void DocumentLockFile::WriteEntryToStream( uno::Sequence< ::rtl::OUString > aEntry, uno::Reference< io::XOutputStream > xOutput ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - ::rtl::OUStringBuffer aBuffer; - - for ( sal_Int32 nEntryInd = 0; nEntryInd < aEntry.getLength(); nEntryInd++ ) - { - aBuffer.append( EscapeCharacters( aEntry[nEntryInd] ) ); - if ( nEntryInd < aEntry.getLength() - 1 ) - aBuffer.append( (sal_Unicode)',' ); - else - aBuffer.append( (sal_Unicode)';' ); - } - - ::rtl::OString aStringData( ::rtl::OUStringToOString( aBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ) ); - uno::Sequence< sal_Int8 > aData( (sal_Int8*)aStringData.getStr(), aStringData.getLength() ); - xOutput->writeBytes( aData ); -} - -// ---------------------------------------------------------------------- -sal_Bool DocumentLockFile::CreateOwnLockFile() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - try - { - uno::Reference< io::XStream > xTempFile( - m_xFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.io.TempFile" ) ), - uno::UNO_QUERY_THROW ); - uno::Reference< io::XSeekable > xSeekable( xTempFile, uno::UNO_QUERY_THROW ); - - uno::Reference< io::XInputStream > xInput = xTempFile->getInputStream(); - uno::Reference< io::XOutputStream > xOutput = xTempFile->getOutputStream(); - - if ( !xInput.is() || !xOutput.is() ) - throw uno::RuntimeException(); - - uno::Sequence< ::rtl::OUString > aNewEntry = GenerateOwnEntry(); - WriteEntryToStream( aNewEntry, xOutput ); - xOutput->closeOutput(); - - xSeekable->seek( 0 ); - - uno::Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv; - ::ucbhelper::Content aTargetContent( m_aURL, xEnv ); - - ucb::InsertCommandArgument aInsertArg; - aInsertArg.Data = xInput; - aInsertArg.ReplaceExisting = sal_False; - uno::Any aCmdArg; - aCmdArg <<= aInsertArg; - aTargetContent.executeCommand( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ), aCmdArg ); - - // try to let the file be hidden if possible - try { - aTargetContent.setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsHidden" ) ), uno::makeAny( sal_True ) ); - } catch( uno::Exception& ) {} - } - catch( ucb::NameClashException& ) - { - return sal_False; - } - - return sal_True; -} - -// ---------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > DocumentLockFile::GetLockData() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - uno::Reference< io::XInputStream > xInput = OpenStream(); - if ( !xInput.is() ) - throw uno::RuntimeException(); - - const sal_Int32 nBufLen = 32000; - uno::Sequence< sal_Int8 > aBuffer( nBufLen ); - - sal_Int32 nRead = 0; - - nRead = xInput->readBytes( aBuffer, nBufLen ); - xInput->closeInput(); - - if ( nRead == nBufLen ) - throw io::WrongFormatException(); - - sal_Int32 nCurPos = 0; - return ParseEntry( aBuffer, nCurPos ); -} - -// ---------------------------------------------------------------------- -uno::Reference< io::XInputStream > DocumentLockFile::OpenStream() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); - uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSimpleFileAccess( - xFactory->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.ucb.SimpleFileAccess") ), - uno::UNO_QUERY_THROW ); - - // the file can be opened readonly, no locking will be done - return xSimpleFileAccess->openFileRead( m_aURL ); -} - -// ---------------------------------------------------------------------- -sal_Bool DocumentLockFile::OverwriteOwnLockFile() -{ - // allows to overwrite the lock file with the current data - try - { - uno::Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv; - ::ucbhelper::Content aTargetContent( m_aURL, xEnv ); - - uno::Sequence< ::rtl::OUString > aNewEntry = GenerateOwnEntry(); - - uno::Reference< io::XStream > xStream = aTargetContent.openWriteableStreamNoLock(); - uno::Reference< io::XOutputStream > xOutput = xStream->getOutputStream(); - uno::Reference< io::XTruncate > xTruncate( xOutput, uno::UNO_QUERY_THROW ); - - xTruncate->truncate(); - WriteEntryToStream( aNewEntry, xOutput ); - xOutput->closeOutput(); - } - catch( uno::Exception& ) - { - return sal_False; - } - - return sal_True; -} - -// ---------------------------------------------------------------------- -void DocumentLockFile::RemoveFile() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - // TODO/LATER: the removing is not atomar, is it possible in general to make it atomar? - uno::Sequence< ::rtl::OUString > aNewEntry = GenerateOwnEntry(); - uno::Sequence< ::rtl::OUString > aFileData = GetLockData(); - - if ( aFileData.getLength() < LOCKFILE_ENTRYSIZE ) - throw io::WrongFormatException(); - - if ( !aFileData[LOCKFILE_SYSUSERNAME_ID].equals( aNewEntry[LOCKFILE_SYSUSERNAME_ID] ) - || !aFileData[LOCKFILE_LOCALHOST_ID].equals( aNewEntry[LOCKFILE_LOCALHOST_ID] ) - || !aFileData[LOCKFILE_USERURL_ID].equals( aNewEntry[LOCKFILE_USERURL_ID] ) ) - throw io::IOException(); // not the owner, access denied - - uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); - uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSimpleFileAccess( - xFactory->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.ucb.SimpleFileAccess") ), - uno::UNO_QUERY_THROW ); - xSimpleFileAccess->kill( m_aURL ); -} - -} // namespace svt - diff --git a/svtools/source/misc/flbytes.cxx b/svtools/source/misc/flbytes.cxx deleted file mode 100644 index acf53d9b3e94..000000000000 --- a/svtools/source/misc/flbytes.cxx +++ /dev/null @@ -1,432 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: flbytes.cxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -#include - -#ifndef _SVSTDARR_ULONGS_DECL -#define _SVSTDARR_ULONGS -#include -#undef _SVSTDARR_ULONGS -#endif - -namespace unnamed_svtools_flbytes {} using namespace unnamed_svtools_flbytes; - // unnamed namespaces don't work well yet - -//============================================================================ -namespace unnamed_svtools_flbytes { - -inline ULONG MyMin( long a, long b ) -{ - return Max( long( Min( a , b ) ), 0L ); -} - -} - -//============================================================================ -// -// SvFillLockBytes -// -//============================================================================ - -TYPEINIT1(SvFillLockBytes, SvLockBytes); - -//============================================================================ -SvFillLockBytes::SvFillLockBytes( SvLockBytes* pLockBytes ) - : xLockBytes( pLockBytes ), - nFilledSize( 0 ), - bTerminated( FALSE ) -{ -} - -//============================================================================ -ErrCode SvFillLockBytes::ReadAt( ULONG nPos, void* pBuffer, ULONG nCount, - ULONG *pRead ) const -{ - if( bTerminated ) - return xLockBytes->ReadAt( nPos, pBuffer, nCount, pRead ); - else - { - ULONG nWanted = nPos + nCount; - if( IsSynchronMode() ) - { - while( nWanted > nFilledSize && !bTerminated ) - Application::Yield(); - return xLockBytes->ReadAt( nPos, pBuffer, nCount, pRead ); - } - else - { - ULONG nRead = MyMin( nCount, long( nFilledSize ) - nPos ); - ULONG nErr = xLockBytes->ReadAt( nPos, pBuffer, nRead, pRead ); - return ( !nCount || nRead == nCount || nErr ) ? - nErr : ERRCODE_IO_PENDING; - } - } -} - -//============================================================================ -ErrCode SvFillLockBytes::WriteAt( ULONG nPos, const void* pBuffer, - ULONG nCount, ULONG *pWritten ) -{ - if( bTerminated ) - return xLockBytes->WriteAt( nPos, pBuffer, nCount, pWritten ); - else - { - ULONG nWanted = nPos + nCount; - if( IsSynchronMode() ) - { - while( nWanted > nFilledSize && !bTerminated ) - Application::Yield(); - return xLockBytes->WriteAt( nPos, pBuffer, nCount, pWritten ); - } - else - { - ULONG nRead = MyMin( nCount, long( nFilledSize ) - nPos ); - ULONG nErr = xLockBytes->WriteAt( nPos, pBuffer, nRead, pWritten ); - return ( !nCount || nRead == nCount || nErr ) ? - nErr : ERRCODE_IO_PENDING; - } - } -} - -//============================================================================ -ErrCode SvFillLockBytes::Flush() const -{ - return xLockBytes->Flush( ); -} - -//============================================================================ -ErrCode SvFillLockBytes::SetSize( ULONG nSize ) -{ - return xLockBytes->SetSize( nSize ); -} - -//============================================================================ -ErrCode SvFillLockBytes::LockRegion( ULONG nPos, ULONG nCount, LockType eType) -{ - return xLockBytes->LockRegion( nPos, nCount, eType ); -} - -//============================================================================ -ErrCode SvFillLockBytes::UnlockRegion( - ULONG nPos, ULONG nCount, LockType eType) -{ - return xLockBytes->UnlockRegion( nPos, nCount, eType ); -} - -//============================================================================ -ErrCode SvFillLockBytes::Stat( - SvLockBytesStat* pStat, SvLockBytesStatFlag eFlag) const -{ - return xLockBytes->Stat( pStat, eFlag ); -} - -//============================================================================ -ErrCode SvFillLockBytes::FillAppend( const void* pBuffer, ULONG nCount, ULONG *pWritten ) -{ - ErrCode nRet = xLockBytes->WriteAt( - nFilledSize, pBuffer, nCount, pWritten ); - nFilledSize += *pWritten; - return nRet; -} - -//============================================================================ -void SvFillLockBytes::Terminate() -{ - bTerminated = TRUE; -} - -//============================================================================ -SV_DECL_IMPL_REF_LIST( SvLockBytes, SvLockBytes* ) - -//============================================================================ -// -// SvSyncLockBytes -// -//============================================================================ - -TYPEINIT1(SvSyncLockBytes, SvOpenLockBytes); - -//============================================================================ -// virtual -ErrCode SvSyncLockBytes::ReadAt(ULONG nPos, void * pBuffer, ULONG nCount, - ULONG * pRead) const -{ - for (ULONG nReadTotal = 0;;) - { - ULONG nReadCount = 0; - ErrCode nError = m_xAsyncLockBytes->ReadAt(nPos, pBuffer, nCount, - &nReadCount); - nReadTotal += nReadCount; - if (nError != ERRCODE_IO_PENDING || !IsSynchronMode()) - { - if (pRead) - *pRead = nReadTotal; - return nError; - } - nPos += nReadCount; - pBuffer = static_cast< sal_Char * >(pBuffer) + nReadCount; - nCount -= nReadCount; - Application::Yield(); - } -} - -//============================================================================ -// virtual -ErrCode SvSyncLockBytes::WriteAt(ULONG nPos, const void * pBuffer, - ULONG nCount, ULONG * pWritten) -{ - for (ULONG nWrittenTotal = 0;;) - { - ULONG nWrittenCount = 0; - ErrCode nError = m_xAsyncLockBytes->WriteAt(nPos, pBuffer, nCount, - &nWrittenCount); - nWrittenTotal += nWrittenCount; - if (nError != ERRCODE_IO_PENDING || !IsSynchronMode()) - { - if (pWritten) - *pWritten = nWrittenTotal; - return nError; - } - nPos += nWrittenCount; - pBuffer = static_cast< sal_Char const * >(pBuffer) + nWrittenCount; - nCount -= nWrittenCount; - Application::Yield(); - } -} - -//============================================================================ -// -// SvCompositeLockBytes -// -//============================================================================ - -struct SvCompositeLockBytes_Impl -{ - SvLockBytesMemberList aLockBytes; - SvULongs aPositions; - SvULongs aOffsets; - BOOL bPending; - ULONG RelativeOffset( ULONG nPos ) const; - ErrCode ReadWrite_Impl( - ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pProcessed, - BOOL bRead ); - SvCompositeLockBytes_Impl() : bPending( FALSE ){} -}; - -//============================================================================ -ULONG SvCompositeLockBytes_Impl::RelativeOffset( ULONG nPos ) const -{ - const SvULongs& rPositions = aPositions; - const SvULongs& rOffsets = aOffsets; - - USHORT nMinPos = 0; - USHORT nListCount = rPositions.Count(); - - // Erster Lockbytes, der bearbeitet werden muss - while( nMinPos + 1 < nListCount && rPositions[ nMinPos + 1 ] <= nPos ) - nMinPos ++; - ULONG nSectionStart = rPositions[ nMinPos ]; - if( nSectionStart > nPos ) - return ULONG_MAX; - return rOffsets[ nMinPos ] + nPos - nSectionStart; -} - -//============================================================================ -ErrCode SvCompositeLockBytes_Impl::ReadWrite_Impl( - ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pProcessed, - BOOL bRead ) -{ - ErrCode nErr = ERRCODE_NONE; - SvULongs& rPositions = aPositions; - SvULongs& rOffsets = aOffsets; - SvLockBytesMemberList& rLockBytes = aLockBytes; - - ULONG nBytes = nCount; - USHORT nListCount = rPositions.Count(); - USHORT nMinPos = 0; - - // Erster Lockbytes, der bearbeitet werden muss - while( nMinPos + 1 < nListCount && rPositions[ nMinPos + 1 ] <= nPos ) - nMinPos ++; - ULONG nSectionStart = rPositions[ nMinPos ]; - - if( nSectionStart > nPos ) - { - // Es wird aus fuehrendem Leerbereich gearbeitet - *pProcessed = 0; - return ERRCODE_IO_CANTREAD; - } - - ULONG nDone; - while( nMinPos < nListCount ) - { - ULONG nToProcess; - ULONG nSectionStop; - if( nMinPos + 1 < nListCount ) - { - nSectionStop = rPositions[ nMinPos + 1 ]; - nToProcess = MyMin( long( nSectionStop ) - nPos, nBytes ); - } - else - { - nToProcess = nBytes; - nSectionStop = 0; - } - ULONG nAbsPos = nPos - nSectionStart + rOffsets[ nMinPos ]; - SvLockBytes* pLB = rLockBytes.GetObject( nMinPos ); - if( bRead ) - nErr = pLB->ReadAt( nAbsPos, pBuffer, nToProcess, &nDone ); - else - nErr = pLB->WriteAt( nAbsPos, pBuffer, nToProcess, &nDone ); - nBytes -= nDone; - if( nErr || nDone < nToProcess || !nBytes ) - { - *pProcessed = nCount - nBytes; - // Wenn aus dem letzten LockBytes nichts mehr gelesen wurde und - // bPending gesetzt ist, Pending zurueck - if( !nDone && nMinPos == nListCount - 1 ) - return bPending ? ERRCODE_IO_PENDING : nErr; - else return nErr; - } - pBuffer = static_cast< sal_Char * >(pBuffer) + nDone; - nPos += nDone; - nSectionStart = nSectionStop; - nMinPos++; - } - return nErr; -} - -//============================================================================ -TYPEINIT1(SvCompositeLockBytes, SvLockBytes); - -//============================================================================ -SvCompositeLockBytes::SvCompositeLockBytes() - : pImpl( new SvCompositeLockBytes_Impl ) -{ -} - -//============================================================================ -SvCompositeLockBytes::~SvCompositeLockBytes() -{ - delete pImpl; -} - -//============================================================================ -void SvCompositeLockBytes::SetIsPending( BOOL bSet ) -{ - pImpl->bPending = bSet; -} - -//============================================================================ -ULONG SvCompositeLockBytes::RelativeOffset( ULONG nPos ) const -{ - return pImpl->RelativeOffset( nPos ); -} - -//============================================================================ -ErrCode SvCompositeLockBytes::ReadAt( - ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pRead ) const -{ - return pImpl->ReadWrite_Impl( nPos, pBuffer, nCount, pRead, TRUE ); -} - -//============================================================================ -ErrCode SvCompositeLockBytes::WriteAt( - ULONG nPos, const void* pBuffer, ULONG nCount, ULONG* pWritten ) -{ - return pImpl->ReadWrite_Impl( - nPos, const_cast< void * >(pBuffer), nCount, pWritten, FALSE ); -} - -//============================================================================ -ErrCode SvCompositeLockBytes::Flush() const -{ - SvLockBytesMemberList& rLockBytes = pImpl->aLockBytes; - ErrCode nErr = ERRCODE_NONE; - for( USHORT nCount = (USHORT)rLockBytes.Count(); !nErr && nCount--; ) - nErr = rLockBytes.GetObject( nCount )->Flush(); - return nErr; -} - -//============================================================================ -ErrCode SvCompositeLockBytes::SetSize( ULONG ) -{ - DBG_ERROR( "not implemented" ); - return ERRCODE_IO_NOTSUPPORTED; -} - -//============================================================================ -ErrCode SvCompositeLockBytes::LockRegion( ULONG, ULONG, LockType ) -{ - DBG_ERROR( "not implemented" ); - return ERRCODE_IO_NOTSUPPORTED; -} - -//============================================================================ -ErrCode SvCompositeLockBytes::UnlockRegion( - ULONG, ULONG, LockType ) -{ - DBG_ERROR( "not implemented" ); - return ERRCODE_IO_NOTSUPPORTED; -} - -//============================================================================ -ErrCode SvCompositeLockBytes::Stat( - SvLockBytesStat* pStat, SvLockBytesStatFlag eFlag) const -{ - USHORT nMax = pImpl->aPositions.Count() - 1; - - SvLockBytesStat aStat; - ErrCode nErr = pImpl->aLockBytes.GetObject( nMax )->Stat( &aStat, eFlag ); - pStat->nSize = pImpl->aPositions[ nMax ] + aStat.nSize; - - return nErr; -} - -//============================================================================ -void SvCompositeLockBytes::Append( - SvLockBytes* pLockBytes, ULONG nPos, ULONG nOffset ) -{ - USHORT nCount = pImpl->aOffsets.Count(); - pImpl->aLockBytes.Insert( pLockBytes, nCount ); - pImpl->aPositions.Insert( nPos, nCount ); - pImpl->aOffsets.Insert( nOffset, nCount ); -} - -//============================================================================ -SvLockBytes* SvCompositeLockBytes::GetLastLockBytes() const -{ - return pImpl->aLockBytes.Count() ? - pImpl->aLockBytes.GetObject( pImpl->aLockBytes.Count() - 1 ) : 0; -} - diff --git a/svtools/source/misc/inidef.cxx b/svtools/source/misc/inidef.cxx deleted file mode 100644 index bdecd1b833dd..000000000000 --- a/svtools/source/misc/inidef.cxx +++ /dev/null @@ -1,269 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: inidef.cxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - - -#include -#include "inetdef.hxx" -#include "inidef.hxx" - -//======================================================================== - -class SfxStdIniDef_Impl: public SfxIniDefaulter -{ -public: - SfxStdIniDef_Impl( SfxIniDefaultManager *pDefMgr ) - : SfxIniDefaulter( pDefMgr ) - {} - virtual BOOL QueryDefault( String &rValue, const SfxIniEntry &rEntry ); -}; - -//------------------------------------------------------------------------- - -BOOL SfxStdIniDef_Impl::QueryDefault( String &rValue, const SfxIniEntry &rEntry ) -{ - switch ( rEntry.GetKey() ) - { - case SFX_KEY_BROWSERRESTORE: - { - rValue = "1"; - return TRUE; - } - - case SFX_KEY_INET_HOME: - { - if ( System::GetLanguage() == LANGUAGE_GERMAN ) - rValue = "http://www.stardivision.de"; - else - rValue = "http://www.stardivision.com"; - return TRUE; - } - - case SFX_KEY_INET_MEMCACHE: - rValue = "4"; - return TRUE; - - case SFX_KEY_INET_DISKCACHE: - rValue = "2048"; - return TRUE; - - case SFX_KEY_INET_CACHEEXPIRATION: - rValue = "3"; - return TRUE; - - case SFX_KEY_INET_MAXHTTPCONS: - rValue = "4"; - return TRUE; - - case SFX_KEY_INET_MAXFTPCONS: - rValue = "2"; - return TRUE; - -// case SFX_KEY_INET_JAVAMINHEAP: -// rValue = "256"; -// return TRUE; - -// case SFX_KEY_INET_JAVAMAXHEAP: -// rValue = ""; -// return TRUE; - - case SFX_KEY_INET_USERAGENT: - rValue = INET_DEF_CALLERNAME; - return TRUE; - - case SFX_KEY_INET_EXE_JAVASCRIPT: -#ifdef SOLAR_JAVA - rValue = "0"; // noch "0", solange es noch soviel Bugs gibt -#else - rValue = "0"; // immer "0" -#endif - return TRUE; - - case SFX_KEY_INET_EXE_PLUGIN: - rValue = "1"; - return TRUE; - -/* case SFX_KEY_INET_JAVA_ENABLE: -#ifdef SOLAR_JAVA - rValue = "1"; -#else - rValue = "0"; -#endif - return TRUE; */ - -// case SFX_KEY_INET_NETACCESS: -// rValue = "2"; -// return TRUE; - - case SFX_KEY_INET_CHANNELS: - rValue = "1"; - return TRUE; - - case SFX_KEY_BASIC_ENABLE: - rValue = "1"; - return TRUE; - - case SFX_KEY_INET_COOKIES: - rValue = "1"; - return TRUE; - - case SFX_KEY_ICONGRID: - rValue = "100;70;0"; - return TRUE; - - case SFX_KEY_METAFILEPRINT: - rValue = "1"; - return TRUE; - } - - return SfxIniDefaulter::QueryDefault( rValue, rEntry ); -} - -//========================================================================= - -SfxIniDefaultManager::SfxIniDefaultManager() -: _pList( new SfxIniDefaulterList ) -{ - new SfxStdIniDef_Impl( this ); -} - -//------------------------------------------------------------------------- - -SfxIniDefaultManager::~SfxIniDefaultManager() -{ - if ( _pList ) - { - for ( USHORT n = _pList->Count(); n--; ) - delete _pList->GetObject(n); - delete _pList; - } -} - -//------------------------------------------------------------------------- - -BOOL SfxIniDefaultManager::QueryDefault -( - String& rValue, /* out: Default-Wert f"ur 'rEntry' - (Default ist Leerstring) */ - const SfxIniEntry& rEntry // in: Beschreibung des Eintrags -) - -/* [Beschreibung] - - "Uber diese interne Methode besorgt sich der den - Default f"ur einen in 'rEntry' beschriebenen Eintrag. -*/ - -{ - for ( USHORT n = _pList->Count(); n--; ) - if ( _pList->GetObject(n)->QueryDefault( rValue, rEntry ) ) - return TRUE; - return FALSE; -} - -//========================================================================= - -SfxIniDefaulter::SfxIniDefaulter( SfxIniDefaultManager *pManager ) - -/* [Beschreibung] - - Der Ctor dieser Klasse meldet die neue Instanz automatisch am - 'pManager' an. -*/ - -: _pManager( pManager ) - -{ - pManager->Insert( this ); -} - -//------------------------------------------------------------------------- - -SfxIniDefaulter::~SfxIniDefaulter() - -/* [Beschreibung] - - Der Dtor dieser Klasse meldet die neue Instanz automatisch am - ab, der im Ctor angegeben wurde. -*/ - -{ - _pManager->Remove( this ); -} - -//------------------------------------------------------------------------- - -BOOL SfxIniDefaulter::QueryDefault -( - String& rValue, /* out: Default-Wert f"ur 'rEntry' - (Default ist Leerstring) */ - const SfxIniEntry& rEntry // in: Beschreibung des Eintrags -) - -/* [Beschreibung] - - Diese virtuelle Methode mu\s "uberladen werden. Sie soll dann in - 'rValue' einen Default-Wert f"ur den in 'rEntry' beschriebenen - ini-Eintrag setzen, falls ihr dieser bekannt ist. - - - [Returnwert] - - TRUE In 'rValue' befindet sich der Default-Wert. - - FALSE F"ur diesen Eintrag ist kein Default-Wert bekannt. - -*/ - -{ - return FALSE; -}; - -//======================================================================== - -SfxIniEntry::SfxIniEntry -( - const String& aGroup, - const String& aKey, - SfxIniGroup eGroup, - SfxIniKey eKey, - USHORT nIndex -) -: _aGroup( aGroup ), - _aKey( aKey ), - _eGroup( eGroup ), - _eKey( eKey ), - _nIndex( nIndex ) -{ -} - - diff --git a/svtools/source/misc/iniman.src b/svtools/source/misc/iniman.src deleted file mode 100644 index afc129318653..000000000000 --- a/svtools/source/misc/iniman.src +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: iniman.src,v $ - * $Revision: 1.27 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include - -ErrorBox ERRBOX_CHECK_PLZ -{ - BUTTONS = WB_OK ; - Message [ en-US ] = "The ZIP code specified is invalid.\nA ZIP code should begin with a number (or in some cases a letter) and\ncan only contain numbers, letters, spaces and dashes."; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svtools/source/misc/iniprop.cxx b/svtools/source/misc/iniprop.cxx deleted file mode 100644 index 16e0e5bc48a7..000000000000 --- a/svtools/source/misc/iniprop.cxx +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: iniprop.cxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - - -#include "iniprop.hxx" - -//------------------------------------------------------------------------- - -TYPEINIT1(SfxAppIniManagerProperty, ApplicationProperty); - -//------------------------------------------------------------------------- - -SfxAppIniManagerProperty::~SfxAppIniManagerProperty() -{ -} - - diff --git a/svtools/source/misc/itemdel.cxx b/svtools/source/misc/itemdel.cxx new file mode 100644 index 000000000000..4028aa497c22 --- /dev/null +++ b/svtools/source/misc/itemdel.cxx @@ -0,0 +1,138 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: itemdel.cxx,v $ + * $Revision: 1.9 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include "itemdel.hxx" +#include +#include +#include + +#include +#include +#include + +// STATIC DATA ----------------------------------------------------------- + +DBG_NAME(SfxItemDesruptor_Impl); + +// ----------------------------------------------------------------------- + +class SfxItemDesruptor_Impl +{ + SfxPoolItem *pItem; + Link aLink; + +private: + DECL_LINK( Delete, void * ); + SfxItemDesruptor_Impl( const SfxItemDesruptor_Impl& ); // n.i. + +public: + SfxItemDesruptor_Impl( SfxPoolItem *pItemToDesrupt ); + ~SfxItemDesruptor_Impl(); +}; + +SV_DECL_PTRARR( SfxItemDesruptorList_Impl, SfxItemDesruptor_Impl*, 4, 4 ) + +// ------------------------------------------------------------------------ +SfxItemDesruptor_Impl::SfxItemDesruptor_Impl( SfxPoolItem *pItemToDesrupt ): + pItem(pItemToDesrupt), + aLink( LINK(this, SfxItemDesruptor_Impl, Delete) ) +{ + DBG_CTOR(SfxItemDesruptor_Impl, 0); + + DBG_ASSERT( 0 == pItem->GetRefCount(), "desrupting pooled item" ); + pItem->SetKind( SFX_ITEMS_DELETEONIDLE ); + + // im Idle abarbeiten + GetpApp()->InsertIdleHdl( aLink, 1 ); + + // und in Liste eintragen (damit geflusht werden kann) + SfxItemDesruptorList_Impl* &rpList = ImpSvtData::GetSvtData().pItemDesruptList; + if ( !rpList ) + rpList = new SfxItemDesruptorList_Impl; + const SfxItemDesruptor_Impl *pThis = this; + rpList->Insert( pThis, rpList->Count() ); +} + +// ------------------------------------------------------------------------ +SfxItemDesruptor_Impl::~SfxItemDesruptor_Impl() +{ + DBG_DTOR(SfxItemDesruptor_Impl, 0); + + // aus Idle-Handler austragen + GetpApp()->RemoveIdleHdl( aLink ); + + // und aus Liste austragen + SfxItemDesruptorList_Impl* &rpList = ImpSvtData::GetSvtData().pItemDesruptList; + DBG_ASSERT( rpList, "no DesruptorList" ); + const SfxItemDesruptor_Impl *pThis = this; + if ( rpList ) HACK(warum?) + rpList->Remove( rpList->GetPos(pThis) ); + + // reset RefCount (was set to SFX_ITEMS_SPECIAL before!) + pItem->SetRefCount( 0 ); + //DBG_CHKOBJ( pItem, SfxPoolItem, 0 ); + delete pItem; +} + +// ------------------------------------------------------------------------ +IMPL_LINK( SfxItemDesruptor_Impl, Delete, void *, EMPTYARG ) +{ + {DBG_CHKTHIS(SfxItemDesruptor_Impl, 0);} + delete this; + return 0; +} + +// ------------------------------------------------------------------------ +SfxPoolItem* DeleteItemOnIdle( SfxPoolItem* pItem ) +{ + DBG_ASSERT( 0 == pItem->GetRefCount(), "deleting item in use" ); + new SfxItemDesruptor_Impl( pItem ); + return pItem; +} + +// ------------------------------------------------------------------------ +void DeleteOnIdleItems() +{ + SfxItemDesruptorList_Impl* &rpList + = ImpSvtData::GetSvtData().pItemDesruptList; + if ( rpList ) + { + USHORT n; + while ( 0 != ( n = rpList->Count() ) ) + // Remove ist implizit im Dtor + delete rpList->GetObject( n-1 ); + DELETEZ(rpList); + } +} + + diff --git a/svtools/source/misc/lockfilecommon.cxx b/svtools/source/misc/lockfilecommon.cxx deleted file mode 100644 index ba4440c462a8..000000000000 --- a/svtools/source/misc/lockfilecommon.cxx +++ /dev/null @@ -1,276 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ,v $ - * - * $Revision: $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -#include -#include - -#include - -#include - -#include - -using namespace ::com::sun::star; - -namespace svt { - -// ---------------------------------------------------------------------- -LockFileCommon::LockFileCommon( const ::rtl::OUString& aOrigURL, const uno::Reference< lang::XMultiServiceFactory >& xFactory, const ::rtl::OUString& aPrefix ) -: m_xFactory( xFactory ) -{ - if ( !m_xFactory.is() ) - m_xFactory = ::comphelper::getProcessServiceFactory(); - - INetURLObject aDocURL = ResolveLinks( INetURLObject( aOrigURL ) ); - - ::rtl::OUString aShareURLString = aDocURL.GetPartBeforeLastName(); - aShareURLString += aPrefix; - aShareURLString += aDocURL.GetName(); - aShareURLString += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "#" ) ); - m_aURL = INetURLObject( aShareURLString ).GetMainURL( INetURLObject::NO_DECODE ); -} - -// ---------------------------------------------------------------------- -LockFileCommon::~LockFileCommon() -{ -} - -// ---------------------------------------------------------------------- -INetURLObject LockFileCommon::ResolveLinks( const INetURLObject& aDocURL ) -{ - if ( aDocURL.HasError() ) - throw lang::IllegalArgumentException(); - - ::rtl::OUString aURLToCheck = aDocURL.GetMainURL( INetURLObject::NO_DECODE ); - - sal_Bool bNeedsChecking = sal_True; - sal_Int32 nMaxLinkCount = 128; - sal_Int32 nCount = 0; - - while( bNeedsChecking ) - { - bNeedsChecking = sal_False; - - // do not allow too deep links - if ( nCount++ >= nMaxLinkCount ) - throw io::IOException(); - - // there is currently no UCB functionality to resolve the symbolic links; - // since the lock files are used only for local file systems the osl functionality is used directly - - ::osl::FileStatus aStatus( FileStatusMask_Type | FileStatusMask_LinkTargetURL ); - ::osl::DirectoryItem aItem; - if ( ::osl::FileBase::E_None == ::osl::DirectoryItem::get( aURLToCheck, aItem ) - && aItem.is() && ::osl::FileBase::E_None == aItem.getFileStatus( aStatus ) ) - { - if ( aStatus.isValid( FileStatusMask_Type ) - && aStatus.isValid( FileStatusMask_LinkTargetURL ) - && aStatus.getFileType() == ::osl::FileStatus::Link ) - { - aURLToCheck = aStatus.getLinkTargetURL(); - bNeedsChecking = sal_True; - } - } - } - - return INetURLObject( aURLToCheck ); -} - -// ---------------------------------------------------------------------- -uno::Sequence< uno::Sequence< ::rtl::OUString > > LockFileCommon::ParseList( const uno::Sequence< sal_Int8 >& aBuffer ) -{ - sal_Int32 nCurPos = 0; - sal_Int32 nCurEntry = 0; - uno::Sequence< uno::Sequence< ::rtl::OUString > > aResult( 10 ); - - while ( nCurPos < aBuffer.getLength() ) - { - if ( nCurEntry >= aResult.getLength() ) - aResult.realloc( nCurEntry + 10 ); - aResult[nCurEntry] = ParseEntry( aBuffer, nCurPos ); - nCurEntry++; - } - - aResult.realloc( nCurEntry ); - return aResult; -} - -// ---------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > LockFileCommon::ParseEntry( const uno::Sequence< sal_Int8 >& aBuffer, sal_Int32& io_nCurPos ) -{ - uno::Sequence< ::rtl::OUString > aResult( LOCKFILE_ENTRYSIZE ); - - for ( int nInd = 0; nInd < LOCKFILE_ENTRYSIZE; nInd++ ) - { - aResult[nInd] = ParseName( aBuffer, io_nCurPos ); - if ( io_nCurPos >= aBuffer.getLength() - || ( nInd < LOCKFILE_ENTRYSIZE - 1 && aBuffer[io_nCurPos++] != ',' ) - || ( nInd == LOCKFILE_ENTRYSIZE - 1 && aBuffer[io_nCurPos++] != ';' ) ) - throw io::WrongFormatException(); - } - - return aResult; -} - -// ---------------------------------------------------------------------- -::rtl::OUString LockFileCommon::ParseName( const uno::Sequence< sal_Int8 >& aBuffer, sal_Int32& io_nCurPos ) -{ - ::rtl::OStringBuffer aResult; - sal_Bool bHaveName = sal_False; - sal_Bool bEscape = sal_False; - - while( !bHaveName ) - { - if ( io_nCurPos >= aBuffer.getLength() ) - throw io::WrongFormatException(); - - if ( bEscape ) - { - if ( aBuffer[io_nCurPos] == ',' || aBuffer[io_nCurPos] == ';' || aBuffer[io_nCurPos] == '\\' ) - aResult.append( (sal_Char)aBuffer[io_nCurPos] ); - else - throw io::WrongFormatException(); - - bEscape = sal_False; - io_nCurPos++; - } - else if ( aBuffer[io_nCurPos] == ',' || aBuffer[io_nCurPos] == ';' ) - bHaveName = sal_True; - else - { - if ( aBuffer[io_nCurPos] == '\\' ) - bEscape = sal_True; - else - aResult.append( (sal_Char)aBuffer[io_nCurPos] ); - - io_nCurPos++; - } - } - - return ::rtl::OStringToOUString( aResult.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ); -} - -// ---------------------------------------------------------------------- -::rtl::OUString LockFileCommon::EscapeCharacters( const ::rtl::OUString& aSource ) -{ - ::rtl::OUStringBuffer aBuffer; - const sal_Unicode* pStr = aSource.getStr(); - for ( sal_Int32 nInd = 0; nInd < aSource.getLength() && pStr[nInd] != 0; nInd++ ) - { - if ( pStr[nInd] == '\\' || pStr[nInd] == ';' || pStr[nInd] == ',' ) - aBuffer.append( (sal_Unicode)'\\' ); - aBuffer.append( pStr[nInd] ); - } - - return aBuffer.makeStringAndClear(); -} - -// ---------------------------------------------------------------------- -::rtl::OUString LockFileCommon::GetOOOUserName() -{ - SvtUserOptions aUserOpt; - ::rtl::OUString aName = aUserOpt.GetFirstName(); - if ( aName.getLength() ) - aName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " ) ); - aName += aUserOpt.GetLastName(); - - return aName; -} - -// ---------------------------------------------------------------------- -::rtl::OUString LockFileCommon::GetCurrentLocalTime() -{ - ::rtl::OUString aTime; - - TimeValue aSysTime; - if ( osl_getSystemTime( &aSysTime ) ) - { - TimeValue aLocTime; - if ( osl_getLocalTimeFromSystemTime( &aSysTime, &aLocTime ) ) - { - oslDateTime aDateTime; - if ( osl_getDateTimeFromTimeValue( &aLocTime, &aDateTime ) ) - { - char pDateTime[20]; - sprintf( pDateTime, "%02d.%02d.%4d %02d:%02d", aDateTime.Day, aDateTime.Month, aDateTime.Year, aDateTime.Hours, aDateTime.Minutes ); - aTime = ::rtl::OUString::createFromAscii( pDateTime ); - } - } - } - - return aTime; -} - -// ---------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > LockFileCommon::GenerateOwnEntry() -{ - uno::Sequence< ::rtl::OUString > aResult( LOCKFILE_ENTRYSIZE ); - - aResult[LOCKFILE_OOOUSERNAME_ID] = GetOOOUserName(); - - ::osl::Security aSecurity; - aSecurity.getUserName( aResult[LOCKFILE_SYSUSERNAME_ID] ); - - aResult[LOCKFILE_LOCALHOST_ID] = ::osl::SocketAddr::getLocalHostname(); - - aResult[LOCKFILE_EDITTIME_ID] = GetCurrentLocalTime(); - - ::utl::Bootstrap::locateUserInstallation( aResult[LOCKFILE_USERURL_ID] ); - - - return aResult; -} - -} // namespace svt - diff --git a/svtools/source/misc/ownlist.cxx b/svtools/source/misc/ownlist.cxx deleted file mode 100644 index 346b4ff7251e..000000000000 --- a/svtools/source/misc/ownlist.cxx +++ /dev/null @@ -1,330 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ownlist.cxx,v $ - * $Revision: 1.6.136.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -#include -#include - -#include - -using namespace com::sun::star; - -//========================================================================= -//============== SvCommandList ============================================ -//========================================================================= -PRV_SV_IMPL_OWNER_LIST(SvCommandList,SvCommand) - - -static String parseString(const String & rCmd, USHORT * pIndex) -{ - String result; - - if(rCmd.GetChar( *pIndex ) == '\"') { - (*pIndex) ++; - - USHORT begin = *pIndex; - - while(*pIndex < rCmd.Len() && rCmd.GetChar((*pIndex) ++) != '\"') ; - - result = String(rCmd.Copy(begin, *pIndex - begin - 1)); - } - - return result; -} - -static String parseWord(const String & rCmd, USHORT * pIndex) -{ - USHORT begin = *pIndex; - - while(*pIndex < rCmd.Len() && !isspace(rCmd.GetChar(*pIndex)) && rCmd.GetChar(*pIndex) != '=') - (*pIndex) ++; - - return String(rCmd.Copy(begin, *pIndex - begin)); -} - -static void eatSpace(const String & rCmd, USHORT * pIndex) -{ - while(*pIndex < rCmd.Len() && isspace(rCmd.GetChar(*pIndex))) - (*pIndex) ++; -} - - -//========================================================================= -BOOL SvCommandList::AppendCommands -( - const String & rCmd, /* Dieser Text wird in Kommandos umgesetzt */ - USHORT * pEaten /* Anzahl der Zeichen, die gelesen wurden */ -) -/* [Beschreibung] - - Es wird eine Text geparsed und die einzelnen Kommandos werden an - die Liste angeh"angt. - - [R"uckgabewert] - - BOOL TRUE, der Text wurde korrekt geparsed. - FALSE, der Text wurde nicht korrekt geparsed. -*/ -{ - USHORT index = 0; - while(index < rCmd.Len()) - { - - eatSpace(rCmd, &index); - String name = (rCmd.GetChar(index) == '\"') ? parseString(rCmd, &index) : parseWord(rCmd, &index); - - eatSpace(rCmd, &index); - String value; - if(index < rCmd.Len() && rCmd.GetChar(index) == '=') - { - index ++; - - eatSpace(rCmd, &index); - value = (rCmd.GetChar(index) == '\"') ? parseString(rCmd, &index) : parseWord(rCmd, &index); - } - - SvCommand * pCmd = new SvCommand(name, value); - aTypes.Insert(pCmd, LIST_APPEND); - } - - *pEaten = index; - -// USHORT nPos = 0; -// while( nPos < rCmd.Len() ) -// { -// // ein Zeichen ? Dann faengt hier eine Option an -// if( isalpha( rCmd[nPos] ) ) -// { -// String aValue; -// USHORT nStt = nPos; -// register char c; - -// while( nPos < rCmd.Len() && -// ( isalnum(c=rCmd[nPos]) || '-'==c || '.'==c ) ) -// nPos++; - -// String aToken( rCmd.Copy( nStt, nPos-nStt ) ); - -// while( nPos < rCmd.Len() && -// ( !String::IsPrintable( (c=rCmd[nPos]), -// RTL_TEXTENCODING_MS_1252 ) || isspace(c) ) ) -// nPos++; - -// // hat die Option auch einen Wert? -// if( nPos!=rCmd.Len() && '='==c ) -// { -// nPos++; - -// while( nPos < rCmd.Len() && -// ( !String::IsPrintable( (c=rCmd[nPos]), -// RTL_TEXTENCODING_MS_1252 ) || isspace(c) ) ) -// nPos++; - -// if( nPos != rCmd.Len() ) -// { -// USHORT nLen = 0; -// nStt = nPos; -// if( '"' == c ) -// { -// nPos++; nStt++; -// while( nPos < rCmd.Len() && -// '"' != rCmd[nPos] ) -// nPos++, nLen++; -// if( nPos!=rCmd.Len() ) -// nPos++; -// } -// else -// // hier sind wir etwas laxer als der -// // Standard und erlauben alles druckbare -// while( nPos < rCmd.Len() && -// String::IsPrintable( (c=rCmd[nPos]), -// RTL_TEXTENCODING_MS_1252 ) && -// !isspace( c ) ) -// nPos++, nLen++; - -// if( nLen ) -// aValue = rCmd( nStt, nLen ); -// } -// } - -// SvCommand * pCmd = new SvCommand( aToken, aValue ); -// aTypes.Insert( pCmd, LIST_APPEND ); -// } -// else -// // white space un unerwartete Zeichen ignorieren wie -// nPos++; -// } -// *pEaten = nPos; - return TRUE; -} - -//========================================================================= -String SvCommandList::GetCommands() const -/* [Beschreibung] - - Die Kommandos in der Liste werden als Text hintereinander, durch ein - Leerzeichen getrennt geschrieben. Der Text muss nicht genauso - aussehen wie der in "ubergebene. - - [R"uckgabewert] - - String Die Kommandos werden zur"uckgegeben. -*/ -{ - String aRet; - for( ULONG i = 0; i < aTypes.Count(); i++ ) - { - if( i != 0 ) - aRet += ' '; - SvCommand * pCmd = (SvCommand *)aTypes.GetObject( i ); - aRet += pCmd->GetCommand(); - if( pCmd->GetArgument().Len() ) - { - aRet.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "=\"" ) ); - aRet += pCmd->GetArgument(); - aRet.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "\"" ) ); - } - } - return aRet; -} - -//========================================================================= -SvCommand & SvCommandList::Append -( - const String & rCommand, /* das Kommando */ - const String & rArg /* dasArgument des Kommandos */ -) -/* [Beschreibung] - - Es wird eine Objekt vom Typ SvCommand erzeugt und an die Liste - angeh"angt. - - [R"uckgabewert] - - SvCommand & Das erteugte Objekt wird zur"uckgegeben. -*/ -{ - SvCommand * pCmd = new SvCommand( rCommand, rArg ); - aTypes.Insert( pCmd, LIST_APPEND ); - return *pCmd; -} - -//========================================================================= -SvStream & operator >> -( - SvStream & rStm, /* Stream aus dem gelesen wird */ - SvCommandList & rThis /* Die zu f"ullende Liste */ -) -/* [Beschreibung] - - Die Liste mit ihren Elementen wird gelesen. Das Format ist: - 1. Anzahl der Elemente - 2. Alle Elemente - - [R"uckgabewert] - - SvStream & Der "ubergebene Stream. -*/ -{ - UINT32 nCount = 0; - rStm >> nCount; - if( !rStm.GetError() ) - { - while( nCount-- ) - { - SvCommand * pCmd = new SvCommand(); - rStm >> *pCmd; - rThis.aTypes.Insert( pCmd, LIST_APPEND ); - } - } - return rStm; -} - -//========================================================================= -SvStream & operator << -( - SvStream & rStm, /* Stream in den geschrieben wird */ - const SvCommandList & rThis /* Die zu schreibende Liste */ -) -/* [Beschreibung] - - Die Liste mit ihren Elementen wir geschrieben. Das Format ist: - 1. Anzahl der Elemente - 2. Alle Elemente - - [R"uckgabewert] - - SvStream & Der "ubergebene Stream. -*/ -{ - UINT32 nCount = rThis.aTypes.Count(); - rStm << nCount; - - for( UINT32 i = 0; i < nCount; i++ ) - { - SvCommand * pCmd = (SvCommand *)rThis.aTypes.GetObject( i ); - rStm << *pCmd; - } - return rStm; -} - -BOOL SvCommandList::FillFromSequence( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& aCommandSequence ) -{ - const sal_Int32 nCount = aCommandSequence.getLength(); - String aCommand, aArg; - ::rtl::OUString aApiArg; - for( sal_Int32 nIndex=0; nIndex>= aApiArg ) ) - return sal_False; - aArg = aApiArg; - Append( aCommand, aArg ); - } - - return TRUE; -} - -void SvCommandList::FillSequence( com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& aCommandSequence ) -{ - const sal_Int32 nCount = Count(); - aCommandSequence.realloc( nCount ); - for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ ) - { - const SvCommand& rCommand = (*this)[ nIndex ]; - aCommandSequence[nIndex].Name = rCommand.GetCommand(); - aCommandSequence[nIndex].Handle = -1; - aCommandSequence[nIndex].Value = uno::makeAny( ::rtl::OUString( rCommand.GetArgument() ) ); - aCommandSequence[nIndex].State = beans::PropertyState_DIRECT_VALUE; - } -} - diff --git a/svtools/source/misc/restrictedpaths.cxx b/svtools/source/misc/restrictedpaths.cxx deleted file mode 100644 index 354e32126680..000000000000 --- a/svtools/source/misc/restrictedpaths.cxx +++ /dev/null @@ -1,217 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: restrictedpaths.cxx,v $ - * $Revision: 1.8 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include - -#include -#include -#include -#include -#include - -namespace svt -{ - namespace - { - // ---------------------------------------------------------------- - /** retrieves the value of an environment variable - @return if and only if the retrieved string value is not empty - */ - bool lcl_getEnvironmentValue( const sal_Char* _pAsciiEnvName, ::rtl::OUString& _rValue ) - { - _rValue = ::rtl::OUString(); - ::rtl::OUString sEnvName = ::rtl::OUString::createFromAscii( _pAsciiEnvName ); - osl_getEnvironment( sEnvName.pData, &_rValue.pData ); - return _rValue.getLength() != 0; - } - - //----------------------------------------------------------------- - void lcl_convertStringListToUrls( const String& _rColonSeparatedList, ::std::vector< String >& _rTokens, bool _bFinalSlash ) - { - const sal_Unicode s_cSeparator = - #if defined(WNT) - ';' - #else - ':' - #endif - ; - xub_StrLen nTokens = _rColonSeparatedList.GetTokenCount( s_cSeparator ); - _rTokens.resize( 0 ); _rTokens.reserve( nTokens ); - for ( xub_StrLen i=0; i nLenChecked ) - { - if ( m_bAllowParent ) - { - if ( sApprovedURL.Search( m_sCheckURL ) == 0 ) - { - if ( ( m_sCheckURL.GetChar( nLenChecked - 1 ) == '/' ) - || ( sApprovedURL.GetChar( nLenChecked ) == '/' ) ) - return true; - } - } - else - { - // just a difference in final slash? - if ( ( nLenApproved == ( nLenChecked + 1 ) ) && - ( sApprovedURL.GetChar( nLenApproved - 1 ) == '/' ) ) - return true; - } - return false; - } - else if ( nLenApproved < nLenChecked ) - { - if ( m_sCheckURL.Search( sApprovedURL ) == 0 ) - { - if ( ( sApprovedURL.GetChar( nLenApproved - 1 ) == '/' ) - || ( m_sCheckURL.GetChar( nLenApproved ) == '/' ) ) - return true; - } - return false; - } - else - { - // strings have equal length - return ( sApprovedURL == m_sCheckURL ); - } - } - }; - - //===================================================================== - //= RestrictedPaths - //===================================================================== - //--------------------------------------------------------------------- - RestrictedPaths::RestrictedPaths() - :m_bFilterIsEnabled( true ) - { - ::rtl::OUString sRestrictedPathList; - if ( lcl_getEnvironmentValue( "RestrictedPath", sRestrictedPathList ) ) - // append a final slash. This ensures that when we later on check - // for unrestricted paths, we don't allow paths like "/home/user35" just because - // "/home/user3" is allowed - with the final slash, we make it "/home/user3/". - lcl_convertStringListToUrls( sRestrictedPathList, m_aUnrestrictedURLs, true ); - } - - RestrictedPaths::~RestrictedPaths() {} - - // -------------------------------------------------------------------- - bool RestrictedPaths::isUrlAllowed( const String& _rURL ) const - { - if ( m_aUnrestrictedURLs.empty() || !m_bFilterIsEnabled ) - return true; - - ::std::vector< String >::const_iterator aApprovedURL = ::std::find_if( - m_aUnrestrictedURLs.begin(), - m_aUnrestrictedURLs.end(), - CheckURLAllowed( _rURL, true ) - ); - - return ( aApprovedURL != m_aUnrestrictedURLs.end() ); - } - - // -------------------------------------------------------------------- - bool RestrictedPaths::isUrlAllowed( const String& _rURL, bool allowParents ) const - { - if ( m_aUnrestrictedURLs.empty() || !m_bFilterIsEnabled ) - return true; - - ::std::vector< String >::const_iterator aApprovedURL = ::std::find_if( - m_aUnrestrictedURLs.begin(), - m_aUnrestrictedURLs.end(), - CheckURLAllowed( _rURL, allowParents ) - ); - - return ( aApprovedURL != m_aUnrestrictedURLs.end() ); - } - -} // namespace svt diff --git a/svtools/source/misc/sharecontrolfile.cxx b/svtools/source/misc/sharecontrolfile.cxx deleted file mode 100644 index 32d7b1873f68..000000000000 --- a/svtools/source/misc/sharecontrolfile.cxx +++ /dev/null @@ -1,376 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: sharecontrolfile.cxx,v $ - * $Revision: 1.6.82.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include - -#include - -using namespace ::com::sun::star; - -namespace svt { - -// ---------------------------------------------------------------------- -ShareControlFile::ShareControlFile( const ::rtl::OUString& aOrigURL, const uno::Reference< lang::XMultiServiceFactory >& xFactory ) -: LockFileCommon( aOrigURL, xFactory, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".~sharing." ) ) ) -{ - OpenStream(); - - if ( !IsValid() ) - throw io::NotConnectedException(); -} - -// ---------------------------------------------------------------------- -ShareControlFile::~ShareControlFile() -{ - try - { - Close(); - } - catch( uno::Exception& ) - {} -} - -// ---------------------------------------------------------------------- -void ShareControlFile::OpenStream() -{ - // if it is called outside of constructor the mutex must be locked already - - if ( !m_xStream.is() && m_aURL.getLength() ) - { - uno::Reference< ucb::XCommandEnvironment > xDummyEnv; - ::ucbhelper::Content aContent = ::ucbhelper::Content( m_aURL, xDummyEnv ); - - uno::Reference< ucb::XContentIdentifier > xContId( aContent.get().is() ? aContent.get()->getIdentifier() : 0 ); - if ( !xContId.is() || !xContId->getContentProviderScheme().equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "file" ) ) ) ) - throw io::IOException(); // the implementation supports only local files for now - - uno::Reference< io::XStream > xStream; - - // Currently the locking of the original document is intended to be used. - // That means that the shared file should be accessed only when the original document is locked and only by user who has locked the document. - // TODO/LATER: should the own file locking be used? - - try - { - xStream = aContent.openWriteableStreamNoLock(); - } - catch ( ucb::InteractiveIOException const & e ) - { - if ( e.Code == ucb::IOErrorCode_NOT_EXISTING ) - { - // Create file... - SvMemoryStream aStream(0,0); - uno::Reference< io::XInputStream > xInput( new ::utl::OInputStreamWrapper( aStream ) ); - ucb::InsertCommandArgument aInsertArg; - aInsertArg.Data = xInput; - aInsertArg.ReplaceExisting = sal_False; - aContent.executeCommand( rtl::OUString::createFromAscii( "insert" ), uno::makeAny( aInsertArg ) ); - - // try to let the file be hidden if possible - try { - aContent.setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsHidden" ) ), uno::makeAny( sal_True ) ); - } catch( uno::Exception& ) {} - - // Try to open one more time - xStream = aContent.openWriteableStreamNoLock(); - } - else - throw; - } - - m_xSeekable.set( xStream, uno::UNO_QUERY_THROW ); - m_xInputStream.set( xStream->getInputStream(), uno::UNO_QUERY_THROW ); - m_xOutputStream.set( xStream->getOutputStream(), uno::UNO_QUERY_THROW ); - m_xTruncate.set( m_xOutputStream, uno::UNO_QUERY_THROW ); - m_xStream = xStream; - } -} - -// ---------------------------------------------------------------------- -void ShareControlFile::Close() -{ - // if it is called outside of destructor the mutex must be locked - - if ( m_xStream.is() ) - { - try - { - if ( m_xInputStream.is() ) - m_xInputStream->closeInput(); - if ( m_xOutputStream.is() ) - m_xOutputStream->closeOutput(); - } - catch( uno::Exception& ) - {} - - m_xStream = uno::Reference< io::XStream >(); - m_xInputStream = uno::Reference< io::XInputStream >(); - m_xOutputStream = uno::Reference< io::XOutputStream >(); - m_xSeekable = uno::Reference< io::XSeekable >(); - m_xTruncate = uno::Reference< io::XTruncate >(); - m_aUsersData.realloc( 0 ); - } -} - -// ---------------------------------------------------------------------- -uno::Sequence< uno::Sequence< ::rtl::OUString > > ShareControlFile::GetUsersData() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !IsValid() ) - throw io::NotConnectedException(); - - if ( !m_aUsersData.getLength() ) - { - sal_Int64 nLength = m_xSeekable->getLength(); - if ( nLength > SAL_MAX_INT32 ) - throw uno::RuntimeException(); - - uno::Sequence< sal_Int8 > aBuffer( (sal_Int32)nLength ); - m_xSeekable->seek( 0 ); - - sal_Int32 nRead = m_xInputStream->readBytes( aBuffer, (sal_Int32)nLength ); - nLength -= nRead; - while ( nLength > 0 ) - { - uno::Sequence< sal_Int8 > aTmpBuf( (sal_Int32)nLength ); - nRead = m_xInputStream->readBytes( aTmpBuf, (sal_Int32)nLength ); - if ( nRead > nLength ) - throw uno::RuntimeException(); - - for ( sal_Int32 nInd = 0; nInd < nRead; nInd++ ) - aBuffer[aBuffer.getLength() - (sal_Int32)nLength + nInd] = aTmpBuf[nInd]; - nLength -= nRead; - } - - m_aUsersData = ParseList( aBuffer ); - } - - return m_aUsersData; -} - -// ---------------------------------------------------------------------- -void ShareControlFile::SetUsersDataAndStore( const uno::Sequence< uno::Sequence< ::rtl::OUString > >& aUsersData ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !IsValid() ) - throw io::NotConnectedException(); - - if ( !m_xTruncate.is() || !m_xOutputStream.is() || !m_xSeekable.is() ) - throw uno::RuntimeException(); - - m_xTruncate->truncate(); - m_xSeekable->seek( 0 ); - - ::rtl::OUStringBuffer aBuffer; - for ( sal_Int32 nInd = 0; nInd < aUsersData.getLength(); nInd++ ) - { - if ( aUsersData[nInd].getLength() != SHARED_ENTRYSIZE ) - throw lang::IllegalArgumentException(); - - for ( sal_Int32 nEntryInd = 0; nEntryInd < SHARED_ENTRYSIZE; nEntryInd++ ) - { - aBuffer.append( EscapeCharacters( aUsersData[nInd][nEntryInd] ) ); - if ( nEntryInd < SHARED_ENTRYSIZE - 1 ) - aBuffer.append( (sal_Unicode)',' ); - else - aBuffer.append( (sal_Unicode)';' ); - } - } - - ::rtl::OString aStringData( ::rtl::OUStringToOString( aBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ) ); - uno::Sequence< sal_Int8 > aData( (sal_Int8*)aStringData.getStr(), aStringData.getLength() ); - m_xOutputStream->writeBytes( aData ); - m_aUsersData = aUsersData; -} - -// ---------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > ShareControlFile::InsertOwnEntry() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !IsValid() ) - throw io::NotConnectedException(); - - GetUsersData(); - uno::Sequence< ::uno::Sequence< ::rtl::OUString > > aNewData( m_aUsersData.getLength() + 1 ); - uno::Sequence< ::rtl::OUString > aNewEntry = GenerateOwnEntry(); - - sal_Bool bExists = sal_False; - sal_Int32 nNewInd = 0; - for ( sal_Int32 nInd = 0; nInd < m_aUsersData.getLength(); nInd++ ) - { - if ( m_aUsersData[nInd].getLength() == SHARED_ENTRYSIZE ) - { - if ( m_aUsersData[nInd][SHARED_LOCALHOST_ID] == aNewEntry[SHARED_LOCALHOST_ID] - && m_aUsersData[nInd][SHARED_SYSUSERNAME_ID] == aNewEntry[SHARED_SYSUSERNAME_ID] - && m_aUsersData[nInd][SHARED_USERURL_ID] == aNewEntry[SHARED_USERURL_ID] ) - { - if ( !bExists ) - { - aNewData[nNewInd] = aNewEntry; - bExists = sal_True; - } - } - else - { - aNewData[nNewInd] = m_aUsersData[nInd]; - } - - nNewInd++; - } - } - - if ( !bExists ) - aNewData[nNewInd++] = aNewEntry; - - aNewData.realloc( nNewInd ); - SetUsersDataAndStore( aNewData ); - - return aNewEntry; -} - -// ---------------------------------------------------------------------- -bool ShareControlFile::HasOwnEntry() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !IsValid() ) - { - throw io::NotConnectedException(); - } - - GetUsersData(); - uno::Sequence< ::rtl::OUString > aEntry = GenerateOwnEntry(); - - for ( sal_Int32 nInd = 0; nInd < m_aUsersData.getLength(); ++nInd ) - { - if ( m_aUsersData[nInd].getLength() == SHARED_ENTRYSIZE && - m_aUsersData[nInd][SHARED_LOCALHOST_ID] == aEntry[SHARED_LOCALHOST_ID] && - m_aUsersData[nInd][SHARED_SYSUSERNAME_ID] == aEntry[SHARED_SYSUSERNAME_ID] && - m_aUsersData[nInd][SHARED_USERURL_ID] == aEntry[SHARED_USERURL_ID] ) - { - return true; - } - } - - return false; -} - -// ---------------------------------------------------------------------- -void ShareControlFile::RemoveEntry( const uno::Sequence< ::rtl::OUString >& aArgEntry ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !IsValid() ) - throw io::NotConnectedException(); - - GetUsersData(); - - uno::Sequence< ::rtl::OUString > aEntry = aArgEntry; - if ( aEntry.getLength() != SHARED_ENTRYSIZE ) - aEntry = GenerateOwnEntry(); - - uno::Sequence< ::uno::Sequence< ::rtl::OUString > > aNewData( m_aUsersData.getLength() + 1 ); - - sal_Int32 nNewInd = 0; - for ( sal_Int32 nInd = 0; nInd < m_aUsersData.getLength(); nInd++ ) - { - if ( m_aUsersData[nInd].getLength() == SHARED_ENTRYSIZE ) - { - if ( m_aUsersData[nInd][SHARED_LOCALHOST_ID] != aEntry[SHARED_LOCALHOST_ID] - || m_aUsersData[nInd][SHARED_SYSUSERNAME_ID] != aEntry[SHARED_SYSUSERNAME_ID] - || m_aUsersData[nInd][SHARED_USERURL_ID] != aEntry[SHARED_USERURL_ID] ) - { - aNewData[nNewInd] = m_aUsersData[nInd]; - nNewInd++; - } - } - } - - aNewData.realloc( nNewInd ); - SetUsersDataAndStore( aNewData ); - - if ( !nNewInd ) - { - // try to remove the file if it is empty - RemoveFile(); - } -} - -// ---------------------------------------------------------------------- -void ShareControlFile::RemoveFile() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !IsValid() ) - throw io::NotConnectedException(); - - Close(); - - uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); - uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSimpleFileAccess( - xFactory->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.ucb.SimpleFileAccess") ), - uno::UNO_QUERY_THROW ); - xSimpleFileAccess->kill( m_aURL ); -} - -} // namespace svt - diff --git a/svtools/source/misc/svtdata.cxx b/svtools/source/misc/svtdata.cxx new file mode 100644 index 000000000000..51247a628c0e --- /dev/null +++ b/svtools/source/misc/svtdata.cxx @@ -0,0 +1,113 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: svtdata.cxx,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include +#include +#include +#include +#include + +namespace unnamed_svtools_svtdata {} +using namespace unnamed_svtools_svtdata; + // unnamed namespaces don't work well yet + +//============================================================================ +namespace unnamed_svtools_svtdata { + +typedef std::map< rtl::OUString, SimpleResMgr * > SimpleResMgrMap; + +} + +//============================================================================ +// +// ImpSvtData +// +//============================================================================ + +ImpSvtData::~ImpSvtData() +{ + delete pResMgr; + for (SimpleResMgrMap::iterator t + = static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs)->begin(); + t != static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs)->end(); ++t) + delete t->second; + delete static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs); +} + +//============================================================================ +ResMgr * ImpSvtData::GetResMgr(const ::com::sun::star::lang::Locale aLocale) +{ + if (!pResMgr) + { + pResMgr = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(svt), aLocale ); + } + return pResMgr; +} + +//============================================================================ +SimpleResMgr* ImpSvtData::GetSimpleRM(const ::com::sun::star::lang::Locale& rLocale) +{ + if (!m_pThreadsafeRMs) + m_pThreadsafeRMs = new SimpleResMgrMap; + rtl::OUString aISOcode = rLocale.Language; + aISOcode += rtl::OStringToOUString("-", RTL_TEXTENCODING_UTF8); + aISOcode += rLocale.Country; + + SimpleResMgr *& rResMgr + = (*static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs))[aISOcode]; + if (!rResMgr) + { + rResMgr = new SimpleResMgr(CREATEVERSIONRESMGR_NAME(svs), rLocale ); + } + return rResMgr; +} + +ResMgr * ImpSvtData::GetPatchResMgr(const ::com::sun::star::lang::Locale& aLocale) +{ + if (!pPatchResMgr) + { + pPatchResMgr = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(svp), aLocale); + } + return pPatchResMgr; +} + +//============================================================================ +// static +ImpSvtData & ImpSvtData::GetSvtData() +{ + void ** pAppData = GetAppData(SHL_SVT); + if (!*pAppData) + *pAppData= new ImpSvtData; + return *static_cast(*pAppData); +} + diff --git a/svtools/source/misc/urihelper.cxx b/svtools/source/misc/urihelper.cxx deleted file mode 100644 index 1ddb4c6dd6f9..000000000000 --- a/svtools/source/misc/urihelper.cxx +++ /dev/null @@ -1,952 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: urihelper.cxx,v $ - * $Revision: 1.22.136.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -#include -#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" -#include "com/sun/star/lang/XMultiComponentFactory.hpp" -#include "com/sun/star/ucb/Command.hpp" -#include -#include "com/sun/star/ucb/IllegalIdentifierException.hpp" -#include "com/sun/star/ucb/UnsupportedCommandException.hpp" -#include "com/sun/star/ucb/XCommandEnvironment.hpp" -#include "com/sun/star/ucb/XCommandProcessor.hpp" -#include "com/sun/star/ucb/XContent.hpp" -#include "com/sun/star/ucb/XContentIdentifierFactory.hpp" -#include "com/sun/star/ucb/XContentProvider.hpp" -#include -#include "com/sun/star/uno/Any.hxx" -#include "com/sun/star/uno/Exception.hpp" -#include "com/sun/star/uno/Reference.hxx" -#include "com/sun/star/uno/RuntimeException.hpp" -#include "com/sun/star/uno/Sequence.hxx" -#include "com/sun/star/uno/XComponentContext.hpp" -#include "com/sun/star/uno/XInterface.hpp" -#include "com/sun/star/uri/UriReferenceFactory.hpp" -#include "com/sun/star/uri/XUriReference.hpp" -#include "com/sun/star/uri/XUriReferenceFactory.hpp" -#include "cppuhelper/exc_hlp.hxx" -#include "comphelper/processfactory.hxx" -#include "osl/diagnose.h" -#include "rtl/ustrbuf.hxx" -#include "rtl/ustring.h" -#include "rtl/ustring.hxx" -#include "sal/types.h" -#include -#include -#include -#include -#include "rtl/instance.hxx" - -namespace unnamed_svtools_urihelper {} -using namespace unnamed_svtools_urihelper; - // unnamed namespaces don't work well yet... - -namespace css = com::sun::star; -using namespace com::sun::star; - -//============================================================================ -// -// SmartRel2Abs -// -//============================================================================ - -namespace unnamed_svtools_urihelper { - -inline UniString toUniString(ByteString const & rString) -{ - return UniString(rString, RTL_TEXTENCODING_ISO_8859_1); -} - -inline UniString toUniString(UniString const & rString) -{ - return rString; -} - -template< typename Str > -inline UniString SmartRel2Abs_Impl(INetURLObject const & rTheBaseURIRef, - Str const & rTheRelURIRef, - Link const & rMaybeFileHdl, - bool bCheckFileExists, - bool bIgnoreFragment, - INetURLObject::EncodeMechanism - eEncodeMechanism, - INetURLObject::DecodeMechanism - eDecodeMechanism, - rtl_TextEncoding eCharset, - bool bRelativeNonURIs, - INetURLObject::FSysStyle eStyle) -{ - // Backwards compatibility: - if (rTheRelURIRef.Len() != 0 && rTheRelURIRef.GetChar(0) == '#') - return toUniString(rTheRelURIRef); - - INetURLObject aAbsURIRef; - if (rTheBaseURIRef.HasError()) - aAbsURIRef. - SetSmartURL(rTheRelURIRef, eEncodeMechanism, eCharset, eStyle); - else - { - bool bWasAbsolute; - aAbsURIRef = rTheBaseURIRef.smartRel2Abs(rTheRelURIRef, - bWasAbsolute, - bIgnoreFragment, - eEncodeMechanism, - eCharset, - bRelativeNonURIs, - eStyle); - if (bCheckFileExists - && !bWasAbsolute - && (aAbsURIRef.GetProtocol() == INET_PROT_FILE - || aAbsURIRef.GetProtocol() == INET_PROT_VND_SUN_STAR_WFS)) - { - INetURLObject aNonFileURIRef; - aNonFileURIRef.SetSmartURL(rTheRelURIRef, - eEncodeMechanism, - eCharset, - eStyle); - if (!aNonFileURIRef.HasError() - && aNonFileURIRef.GetProtocol() != INET_PROT_FILE) - { - bool bMaybeFile = false; - if (rMaybeFileHdl.IsSet()) - { - UniString aFilePath(toUniString(rTheRelURIRef)); - bMaybeFile = rMaybeFileHdl.Call(&aFilePath) != 0; - } - if (!bMaybeFile) - aAbsURIRef = aNonFileURIRef; - } - } - } - return aAbsURIRef.GetMainURL(eDecodeMechanism, eCharset); -} - -} - -UniString -URIHelper::SmartRel2Abs(INetURLObject const & rTheBaseURIRef, - ByteString const & rTheRelURIRef, - Link const & rMaybeFileHdl, - bool bCheckFileExists, - bool bIgnoreFragment, - INetURLObject::EncodeMechanism eEncodeMechanism, - INetURLObject::DecodeMechanism eDecodeMechanism, - rtl_TextEncoding eCharset, - bool bRelativeNonURIs, - INetURLObject::FSysStyle eStyle) -{ - return SmartRel2Abs_Impl(rTheBaseURIRef, rTheRelURIRef, rMaybeFileHdl, - bCheckFileExists, bIgnoreFragment, - eEncodeMechanism, eDecodeMechanism, eCharset, - bRelativeNonURIs, eStyle); -} - -UniString -URIHelper::SmartRel2Abs(INetURLObject const & rTheBaseURIRef, - UniString const & rTheRelURIRef, - Link const & rMaybeFileHdl, - bool bCheckFileExists, - bool bIgnoreFragment, - INetURLObject::EncodeMechanism eEncodeMechanism, - INetURLObject::DecodeMechanism eDecodeMechanism, - rtl_TextEncoding eCharset, - bool bRelativeNonURIs, - INetURLObject::FSysStyle eStyle) -{ - return SmartRel2Abs_Impl(rTheBaseURIRef, rTheRelURIRef, rMaybeFileHdl, - bCheckFileExists, bIgnoreFragment, - eEncodeMechanism, eDecodeMechanism, eCharset, - bRelativeNonURIs, eStyle); -} - -//============================================================================ -// -// SetMaybeFileHdl -// -//============================================================================ - -namespace { struct MaybeFileHdl : public rtl::Static< Link, MaybeFileHdl > {}; } - -void URIHelper::SetMaybeFileHdl(Link const & rTheMaybeFileHdl) -{ - MaybeFileHdl::get() = rTheMaybeFileHdl; -} - -//============================================================================ -// -// GetMaybeFileHdl -// -//============================================================================ - -Link URIHelper::GetMaybeFileHdl() -{ - return MaybeFileHdl::get(); -} - -namespace { - -bool isAbsoluteHierarchicalUriReference( - css::uno::Reference< css::uri::XUriReference > const & uriReference) -{ - return uriReference.is() && uriReference->isAbsolute() - && uriReference->isHierarchical() && !uriReference->hasRelativePath(); -} - -// To improve performance, assume that if for any prefix URL of a given -// hierarchical URL either a UCB content cannot be created, or the UCB content -// does not support the getCasePreservingURL command, then this will hold for -// any other prefix URL of the given URL, too: -enum Result { Success, GeneralFailure, SpecificFailure }; - -Result normalizePrefix( - css::uno::Reference< css::ucb::XContentProvider > const & broker, - rtl::OUString const & uri, rtl::OUString * normalized) -{ - OSL_ASSERT(broker.is() && normalized != 0); - css::uno::Reference< css::ucb::XContent > content; - try { - content = broker->queryContent( - css::uno::Reference< css::ucb::XContentIdentifierFactory >( - broker, css::uno::UNO_QUERY_THROW)->createContentIdentifier( - uri)); - } catch (css::ucb::IllegalIdentifierException &) {} - if (!content.is()) { - return GeneralFailure; - } - try { - #if OSL_DEBUG_LEVEL > 0 - bool ok = - #endif - (css::uno::Reference< css::ucb::XCommandProcessor >( - content, css::uno::UNO_QUERY_THROW)->execute( - css::ucb::Command( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "getCasePreservingURL")), - -1, css::uno::Any()), - 0, - css::uno::Reference< css::ucb::XCommandEnvironment >()) - >>= *normalized); - OSL_ASSERT(ok); - } catch (css::uno::RuntimeException &) { - throw; - } catch (css::ucb::UnsupportedCommandException &) { - return GeneralFailure; - } catch (css::uno::Exception &) { - return SpecificFailure; - } - return Success; -} - -rtl::OUString normalize( - css::uno::Reference< css::ucb::XContentProvider > const & broker, - css::uno::Reference< css::uri::XUriReferenceFactory > const & uriFactory, - rtl::OUString const & uriReference) -{ - // normalizePrefix can potentially fail (a typically example being a file - // URL that denotes a non-existing resource); in such a case, try to - // normalize as long a prefix of the given URL as possible (i.e., normalize - // all the existing directories within the path): - rtl::OUString normalized; - sal_Int32 n = uriReference.indexOf('#'); - normalized = n == -1 ? uriReference : uriReference.copy(0, n); - switch (normalizePrefix(broker, normalized, &normalized)) { - case Success: - return n == -1 ? normalized : normalized + uriReference.copy(n); - case GeneralFailure: - return uriReference; - case SpecificFailure: - default: - break; - } - css::uno::Reference< css::uri::XUriReference > ref( - uriFactory->parse(uriReference)); - if (!isAbsoluteHierarchicalUriReference(ref)) { - return uriReference; - } - sal_Int32 count = ref->getPathSegmentCount(); - if (count < 2) { - return uriReference; - } - rtl::OUStringBuffer head(ref->getScheme()); - head.append(static_cast< sal_Unicode >(':')); - if (ref->hasAuthority()) { - head.appendAscii(RTL_CONSTASCII_STRINGPARAM("//")); - head.append(ref->getAuthority()); - } - for (sal_Int32 i = count - 1; i > 0; --i) { - rtl::OUStringBuffer buf(head); - for (sal_Int32 j = 0; j < i; ++j) { - buf.append(static_cast< sal_Unicode >('/')); - buf.append(ref->getPathSegment(j)); - } - normalized = buf.makeStringAndClear(); - if (normalizePrefix(broker, normalized, &normalized) != SpecificFailure) - { - buf.append(normalized); - css::uno::Reference< css::uri::XUriReference > preRef( - uriFactory->parse(normalized)); - if (!isAbsoluteHierarchicalUriReference(preRef)) { - // This could only happen if something is inconsistent: - break; - } - sal_Int32 preCount = preRef->getPathSegmentCount(); - // normalizePrefix may have added or removed a final slash: - if (preCount != i) { - if (preCount == i - 1) { - buf.append(static_cast< sal_Unicode >('/')); - } else if (preCount - 1 == i && buf.getLength() > 0 - && buf.charAt(buf.getLength() - 1) == '/') - { - buf.setLength(buf.getLength() - 1); - } else { - // This could only happen if something is inconsistent: - break; - } - } - for (sal_Int32 j = i; j < count; ++j) { - buf.append(static_cast< sal_Unicode >('/')); - buf.append(ref->getPathSegment(j)); - } - if (ref->hasQuery()) { - buf.append(static_cast< sal_Unicode >('?')); - buf.append(ref->getQuery()); - } - if (ref->hasFragment()) { - buf.append(static_cast< sal_Unicode >('#')); - buf.append(ref->getFragment()); - } - return buf.makeStringAndClear(); - } - } - return uriReference; -} - -} - -css::uno::Reference< css::uri::XUriReference > -URIHelper::normalizedMakeRelative( - css::uno::Reference< css::uno::XComponentContext > const & context, - rtl::OUString const & baseUriReference, rtl::OUString const & uriReference) -{ - OSL_ASSERT(context.is()); - css::uno::Reference< css::lang::XMultiComponentFactory > componentFactory( - context->getServiceManager()); - if (!componentFactory.is()) { - throw css::uno::RuntimeException( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "component context has no service manager")), - css::uno::Reference< css::uno::XInterface >()); - } - css::uno::Sequence< css::uno::Any > args(2); - args[0] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Local")); - args[1] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Office")); - css::uno::Reference< css::ucb::XContentProvider > broker; - try { - broker = css::uno::Reference< css::ucb::XContentProvider >( - componentFactory->createInstanceWithArgumentsAndContext( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.ucb.UniversalContentBroker")), - args, context), - css::uno::UNO_QUERY_THROW); - } catch (css::uno::RuntimeException &) { - throw; - } catch (css::uno::Exception &) { - css::uno::Any exception(cppu::getCaughtException()); - throw css::lang::WrappedTargetRuntimeException( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "creating com.sun.star.ucb.UniversalContentBroker failed")), - css::uno::Reference< css::uno::XInterface >(), - exception); - } - css::uno::Reference< css::uri::XUriReferenceFactory > uriFactory( - css::uri::UriReferenceFactory::create(context)); - return uriFactory->makeRelative( - uriFactory->parse(normalize(broker, uriFactory, baseUriReference)), - uriFactory->parse(normalize(broker, uriFactory, uriReference)), true, - true, false); -} - -rtl::OUString URIHelper::simpleNormalizedMakeRelative( - rtl::OUString const & baseUriReference, rtl::OUString const & uriReference) -{ - com::sun::star::uno::Reference< com::sun::star::uri::XUriReference > rel( - URIHelper::normalizedMakeRelative( - com::sun::star::uno::Reference< - com::sun::star::uno::XComponentContext >( - (com::sun::star::uno::Reference< - com::sun::star::beans::XPropertySet >( - comphelper::getProcessServiceFactory(), - com::sun::star::uno::UNO_QUERY_THROW)-> - getPropertyValue( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("DefaultContext")))), - com::sun::star::uno::UNO_QUERY_THROW), - baseUriReference, uriReference)); - return rel.is() ? rel->getUriReference() : uriReference; -} - -//============================================================================ -// -// FindFirstURLInText -// -//============================================================================ - -namespace unnamed_svtools_urihelper { - -inline xub_StrLen nextChar(UniString const & rStr, xub_StrLen nPos) -{ - return INetMIME::isHighSurrogate(rStr.GetChar(nPos)) - && rStr.Len() - nPos >= 2 - && INetMIME::isLowSurrogate(rStr.GetChar(nPos + 1)) ? - nPos + 2 : nPos + 1; -} - -bool isBoundary1(CharClass const & rCharClass, UniString const & rStr, - xub_StrLen nPos, xub_StrLen nEnd) -{ - if (nPos == nEnd) - return true; - if (rCharClass.isLetterNumeric(rStr, nPos)) - return false; - switch (rStr.GetChar(nPos)) - { - case '$': - case '%': - case '&': - case '-': - case '/': - case '@': - case '\\': - return false; - default: - return true; - } -} - -bool isBoundary2(CharClass const & rCharClass, UniString const & rStr, - xub_StrLen nPos, xub_StrLen nEnd) -{ - if (nPos == nEnd) - return true; - if (rCharClass.isLetterNumeric(rStr, nPos)) - return false; - switch (rStr.GetChar(nPos)) - { - case '!': - case '#': - case '$': - case '%': - case '&': - case '\'': - case '*': - case '+': - case '-': - case '/': - case '=': - case '?': - case '@': - case '^': - case '_': - case '`': - case '{': - case '|': - case '}': - case '~': - return false; - default: - return true; - } -} - -bool checkWChar(CharClass const & rCharClass, UniString const & rStr, - xub_StrLen * pPos, xub_StrLen * pEnd, bool bBackslash = false, - bool bPipe = false) -{ - sal_Unicode c = rStr.GetChar(*pPos); - if (INetMIME::isUSASCII(c)) - { - static sal_uInt8 const aMap[128] - = { 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 4, 4, 4, 1, // !"#$%&' - 1, 1, 1, 1, 1, 4, 1, 4, // ()*+,-./ - 4, 4, 4, 4, 4, 4, 4, 4, // 01234567 - 4, 4, 1, 1, 0, 1, 0, 1, // 89:;<=>? - 4, 4, 4, 4, 4, 4, 4, 4, // @ABCDEFG - 4, 4, 4, 4, 4, 4, 4, 4, // HIJKLMNO - 4, 4, 4, 4, 4, 4, 4, 4, // PQRSTUVW - 4, 4, 4, 1, 2, 1, 0, 1, // XYZ[\]^_ - 0, 4, 4, 4, 4, 4, 4, 4, // `abcdefg - 4, 4, 4, 4, 4, 4, 4, 4, // hijklmno - 4, 4, 4, 4, 4, 4, 4, 4, // pqrstuvw - 4, 4, 4, 0, 3, 0, 1, 0 }; // xyz{|}~ - switch (aMap[c]) - { - default: // not uric - return false; - - case 1: // uric - ++(*pPos); - return true; - - case 2: // "\" - if (bBackslash) - { - *pEnd = ++(*pPos); - return true; - } - else - return false; - - case 3: // "|" - if (bPipe) - { - *pEnd = ++(*pPos); - return true; - } - else - return false; - - case 4: // alpha, digit, "$", "%", "&", "-", "/", "@" (see - // isBoundary1) - *pEnd = ++(*pPos); - return true; - } - } - else if (rCharClass.isLetterNumeric(rStr, *pPos)) - { - *pEnd = *pPos = nextChar(rStr, *pPos); - return true; - } - else - return false; -} - -sal_uInt32 scanDomain(UniString const & rStr, xub_StrLen * pPos, - xub_StrLen nEnd) -{ - sal_Unicode const * pBuffer = rStr.GetBuffer(); - sal_Unicode const * p = pBuffer + *pPos; - sal_uInt32 nLabels = INetURLObject::scanDomain(p, pBuffer + nEnd, false); - *pPos = sal::static_int_cast< xub_StrLen >(p - pBuffer); - return nLabels; -} - -} - -UniString -URIHelper::FindFirstURLInText(UniString const & rText, - xub_StrLen & rBegin, - xub_StrLen & rEnd, - CharClass const & rCharClass, - INetURLObject::EncodeMechanism eMechanism, - rtl_TextEncoding eCharset, - INetURLObject::FSysStyle eStyle) -{ - if (!(rBegin <= rEnd && rEnd <= rText.Len())) - return UniString(); - - // Search for the first substring of [rBegin..rEnd[ that matches any of the - // following productions (for which the appropriate style bit is set in - // eStyle, if applicable). - // - // 1st Production (known scheme): - // \B1 ":" 1*wchar ["#" 1*wchar] - // \B1 - // - // 2nd Production (file): - // \B1 "FILE:" 1*(wchar / "\" / "|") ["#" 1*wchar] \B1 - // - // 3rd Production (ftp): - // \B1 "FTP" 2*("." label) ["/" *wchar] ["#" 1*wchar] \B1 - // - // 4th Production (http): - // \B1 "WWW" 2*("." label) ["/" *wchar] ["#" 1*wchar] \B1 - // - // 5th Production (mailto): - // \B2 local-part "@" domain \B1 - // - // 6th Production (UNC file): - // \B1 "\\" domain "\" *(wchar / "\") \B1 - // - // 7th Production (DOS file): - // \B1 ALPHA ":\" *(wchar / "\") \B1 - // - // 8th Production (Unix-like DOS file): - // \B1 ALPHA ":/" *(wchar / "\") \B1 - // - // The productions use the following auxiliary rules. - // - // local-part = atom *("." atom) - // atom = 1*(alphanum / "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" - // / "-" / "/" / "=" / "?" / "^" / "_" / "`" / "{" / "|" / "}" - // / "~") - // domain = label *("." label) - // label = alphanum [*(alphanum / "-") alphanum] - // alphanum = ALPHA / DIGIT - // wchar = - // - // "\B1" (boundary 1) stands for the beginning or end of the block of text, - // or a character that is neither (a) a letter or digit (according to - // rCharClass), nor (b) any of "$", "%", "&", "-", "/", "@", or "\". - // (FIXME: What was the rationale for this set of punctuation characters?) - // - // "\B2" (boundary 2) stands for the beginning or end of the block of text, - // or a character that is neither (a) a letter or digit (according to - // rCharClass), nor (b) any of "!", "#", "$", "%", "&", "'", "*", "+", "-", - // "/", "=", "?", "@", "^", "_", "`", "{", "|", "}", or "~" (i.e., an RFC - // 822 character, or "@" from \B1's set above). - // - // Productions 1--4, and 6--8 try to find a maximum-length match, but they - // stop at the first character that is a "\B1" character which is - // only followed by "\B1" characters (taking "\" and "|" characters into - // account appropriately). Production 5 simply tries to find a maximum- - // length match. - // - // Productions 1--4 use the given eMechanism and eCharset. Productions 5--9 - // use ENCODE_ALL. - // - // Productions 6--9 are only applicable if the FSYS_DOS bit is set in - // eStyle. - - bool bBoundary1 = true; - bool bBoundary2 = true; - for (xub_StrLen nPos = rBegin; nPos != rEnd; nPos = nextChar(rText, nPos)) - { - sal_Unicode c = rText.GetChar(nPos); - if (bBoundary1) - { - if (INetMIME::isAlpha(c)) - { - xub_StrLen i = nPos; - INetProtocol eScheme - = INetURLObject::CompareProtocolScheme(UniString(rText, i, - rEnd)); - if (eScheme == INET_PROT_FILE) // 2nd - { - while (rText.GetChar(i++) != ':') ; - xub_StrLen nPrefixEnd = i; - xub_StrLen nUriEnd = i; - while (i != rEnd - && checkWChar(rCharClass, rText, &i, &nUriEnd, true, - true)) ; - if (i != nPrefixEnd && rText.GetChar(i) == '#') - { - ++i; - while (i != rEnd - && checkWChar(rCharClass, rText, &i, &nUriEnd)) ; - } - if (nUriEnd != nPrefixEnd - && isBoundary1(rCharClass, rText, nUriEnd, rEnd)) - { - INetURLObject aUri(UniString(rText, nPos, - nUriEnd - nPos), - INET_PROT_FILE, eMechanism, eCharset, - eStyle); - if (!aUri.HasError()) - { - rBegin = nPos; - rEnd = nUriEnd; - return - aUri.GetMainURL(INetURLObject::DECODE_TO_IURI); - } - } - } - else if (eScheme != INET_PROT_NOT_VALID) // 1st - { - while (rText.GetChar(i++) != ':') ; - xub_StrLen nPrefixEnd = i; - xub_StrLen nUriEnd = i; - while (i != rEnd - && checkWChar(rCharClass, rText, &i, &nUriEnd)) ; - if (i != nPrefixEnd && rText.GetChar(i) == '#') - { - ++i; - while (i != rEnd - && checkWChar(rCharClass, rText, &i, &nUriEnd)) ; - } - if (nUriEnd != nPrefixEnd - && (isBoundary1(rCharClass, rText, nUriEnd, rEnd) - || rText.GetChar(nUriEnd) == '\\')) - { - INetURLObject aUri(UniString(rText, nPos, - nUriEnd - nPos), - INET_PROT_HTTP, eMechanism, - eCharset); - if (!aUri.HasError()) - { - rBegin = nPos; - rEnd = nUriEnd; - return - aUri.GetMainURL(INetURLObject::DECODE_TO_IURI); - } - } - } - - // 3rd, 4th: - i = nPos; - sal_uInt32 nLabels = scanDomain(rText, &i, rEnd); - if (nLabels >= 3 - && rText.GetChar(nPos + 3) == '.' - && (((rText.GetChar(nPos) == 'w' - || rText.GetChar(nPos) == 'W') - && (rText.GetChar(nPos + 1) == 'w' - || rText.GetChar(nPos + 1) == 'W') - && (rText.GetChar(nPos + 2) == 'w' - || rText.GetChar(nPos + 2) == 'W')) - || ((rText.GetChar(nPos) == 'f' - || rText.GetChar(nPos) == 'F') - && (rText.GetChar(nPos + 1) == 't' - || rText.GetChar(nPos + 1) == 'T') - && (rText.GetChar(nPos + 2) == 'p' - || rText.GetChar(nPos + 2) == 'P')))) - // (note that rText.GetChar(nPos + 3) is guaranteed to be - // valid) - { - xub_StrLen nUriEnd = i; - if (i != rEnd && rText.GetChar(i) == '/') - { - nUriEnd = ++i; - while (i != rEnd - && checkWChar(rCharClass, rText, &i, &nUriEnd)) ; - } - if (i != rEnd && rText.GetChar(i) == '#') - { - ++i; - while (i != rEnd - && checkWChar(rCharClass, rText, &i, &nUriEnd)) ; - } - if (isBoundary1(rCharClass, rText, nUriEnd, rEnd) - || rText.GetChar(nUriEnd) == '\\') - { - INetURLObject aUri(UniString(rText, nPos, - nUriEnd - nPos), - INET_PROT_HTTP, eMechanism, - eCharset); - if (!aUri.HasError()) - { - rBegin = nPos; - rEnd = nUriEnd; - return - aUri.GetMainURL(INetURLObject::DECODE_TO_IURI); - } - } - } - - if ((eStyle & INetURLObject::FSYS_DOS) != 0 && rEnd - nPos >= 3 - && rText.GetChar(nPos + 1) == ':' - && (rText.GetChar(nPos + 2) == '/' - || rText.GetChar(nPos + 2) == '\\')) // 7th, 8th - { - i = nPos + 3; - xub_StrLen nUriEnd = i; - while (i != rEnd - && checkWChar(rCharClass, rText, &i, &nUriEnd)) ; - if (isBoundary1(rCharClass, rText, nUriEnd, rEnd)) - { - INetURLObject aUri(UniString(rText, nPos, - nUriEnd - nPos), - INET_PROT_FILE, - INetURLObject::ENCODE_ALL, - RTL_TEXTENCODING_UTF8, - INetURLObject::FSYS_DOS); - if (!aUri.HasError()) - { - rBegin = nPos; - rEnd = nUriEnd; - return - aUri.GetMainURL(INetURLObject::DECODE_TO_IURI); - } - } - } - } - else if ((eStyle & INetURLObject::FSYS_DOS) != 0 && rEnd - nPos >= 2 - && rText.GetChar(nPos) == '\\' - && rText.GetChar(nPos + 1) == '\\') // 6th - { - xub_StrLen i = nPos + 2; - sal_uInt32 nLabels = scanDomain(rText, &i, rEnd); - if (nLabels >= 1 && i != rEnd && rText.GetChar(i) == '\\') - { - xub_StrLen nUriEnd = ++i; - while (i != rEnd - && checkWChar(rCharClass, rText, &i, &nUriEnd, - true)) ; - if (isBoundary1(rCharClass, rText, nUriEnd, rEnd)) - { - INetURLObject aUri(UniString(rText, nPos, - nUriEnd - nPos), - INET_PROT_FILE, - INetURLObject::ENCODE_ALL, - RTL_TEXTENCODING_UTF8, - INetURLObject::FSYS_DOS); - if (!aUri.HasError()) - { - rBegin = nPos; - rEnd = nUriEnd; - return - aUri.GetMainURL(INetURLObject::DECODE_TO_IURI); - } - } - } - } - } - if (bBoundary2 && INetMIME::isAtomChar(c)) // 5th - { - bool bDot = false; - for (xub_StrLen i = nPos + 1; i != rEnd; ++i) - { - sal_Unicode c2 = rText.GetChar(i); - if (INetMIME::isAtomChar(c2)) - bDot = false; - else if (bDot) - break; - else if (c2 == '.') - bDot = true; - else - { - if (c2 == '@') - { - ++i; - sal_uInt32 nLabels = scanDomain(rText, &i, rEnd); - if (nLabels >= 1 - && isBoundary1(rCharClass, rText, i, rEnd)) - { - INetURLObject aUri(UniString(rText, nPos, i - nPos), - INET_PROT_MAILTO, - INetURLObject::ENCODE_ALL); - if (!aUri.HasError()) - { - rBegin = nPos; - rEnd = i; - return aUri.GetMainURL( - INetURLObject::DECODE_TO_IURI); - } - } - } - break; - } - } - } - bBoundary1 = isBoundary1(rCharClass, rText, nPos, rEnd); - bBoundary2 = isBoundary2(rCharClass, rText, nPos, rEnd); - } - rBegin = rEnd; - return UniString(); -} - -//============================================================================ -// -// removePassword -// -//============================================================================ - -UniString -URIHelper::removePassword(UniString const & rURI, - INetURLObject::EncodeMechanism eEncodeMechanism, - INetURLObject::DecodeMechanism eDecodeMechanism, - rtl_TextEncoding eCharset) -{ - INetURLObject aObj(rURI, eEncodeMechanism, eCharset); - return aObj.HasError() ? - rURI : - String(aObj.GetURLNoPass(eDecodeMechanism, eCharset)); -} - -//============================================================================ -// -// queryFSysStyle -// -//============================================================================ - -INetURLObject::FSysStyle URIHelper::queryFSysStyle(UniString const & rFileUrl, - bool bAddConvenienceStyles) - throw (uno::RuntimeException) -{ - ::ucbhelper::ContentBroker const * pBroker = ::ucbhelper::ContentBroker::get(); - uno::Reference< ucb::XContentProviderManager > xManager; - if (pBroker) - xManager = pBroker->getContentProviderManagerInterface(); - uno::Reference< beans::XPropertySet > xProperties; - if (xManager.is()) - xProperties - = uno::Reference< beans::XPropertySet >( - xManager->queryContentProvider(rFileUrl), uno::UNO_QUERY); - sal_Int32 nNotation = ucb::FileSystemNotation::UNKNOWN_NOTATION; - if (xProperties.is()) - try - { - xProperties->getPropertyValue(rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "FileSystemNotation"))) - >>= nNotation; - } - catch (beans::UnknownPropertyException const &) {} - catch (lang::WrappedTargetException const &) {} - - // The following code depends on the fact that the - // com::sun::star::ucb::FileSystemNotation constants range from UNKNOWN to - // MAC, without any holes. The table below has two entries per notation, - // the first is used if bAddConvenienceStyles == false, while the second - // is used if bAddConvenienceStyles == true: - static INetURLObject::FSysStyle const aMap[][2] - = { { INetURLObject::FSysStyle(0), - INetURLObject::FSYS_DETECT }, - // UNKNOWN - { INetURLObject::FSYS_UNX, - INetURLObject::FSysStyle(INetURLObject::FSYS_VOS - | INetURLObject::FSYS_UNX) }, - // UNIX - { INetURLObject::FSYS_DOS, - INetURLObject::FSysStyle(INetURLObject::FSYS_VOS - | INetURLObject::FSYS_UNX - | INetURLObject::FSYS_DOS) }, - // DOS - { INetURLObject::FSYS_MAC, - INetURLObject::FSysStyle(INetURLObject::FSYS_VOS - | INetURLObject::FSYS_UNX - | INetURLObject::FSYS_MAC) } }; - return aMap[nNotation < ucb::FileSystemNotation::UNKNOWN_NOTATION - || nNotation > ucb::FileSystemNotation::MAC_NOTATION ? - 0 : - nNotation - - ucb::FileSystemNotation::UNKNOWN_NOTATION] - [bAddConvenienceStyles]; -} diff --git a/svtools/source/misc/vcldata.cxx b/svtools/source/misc/vcldata.cxx deleted file mode 100644 index 28b2e833e974..000000000000 --- a/svtools/source/misc/vcldata.cxx +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: vcldata.cxx,v $ - * $Revision: 1.10 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -#include -#include - -//============================================================================ -// -// class ImpSvtData -// -//============================================================================ - -ResMgr * ImpSvtData::GetResMgr() -{ - return GetResMgr(Application::GetSettings().GetUILocale()); -} - -ResMgr * ImpSvtData::GetPatchResMgr() -{ - return GetPatchResMgr(Application::GetSettings().GetUILocale()); -} - -SvpResId::SvpResId( USHORT nId ) : - ResId( nId, *ImpSvtData::GetSvtData().GetPatchResMgr() ) -{ -} - diff --git a/svtools/source/misc/wallitem.cxx b/svtools/source/misc/wallitem.cxx new file mode 100644 index 000000000000..32797f69a48c --- /dev/null +++ b/svtools/source/misc/wallitem.cxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: wallitem.cxx,v $ + * $Revision: 1.10 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "wallitem.hxx" +#include + +// ----------------------------------------------------------------------- + +//static +void SfxBrushItemLink::Set( SfxBrushItemLink* pLink ) +{ + SfxBrushItemLink** ppLink = (SfxBrushItemLink**)GetAppData(SHL_BRUSHITEM); + if( !*ppLink ) + *ppLink = pLink; + else + delete pLink; +} + diff --git a/svtools/source/misc1/PasswordHelper.cxx b/svtools/source/misc1/PasswordHelper.cxx deleted file mode 100644 index 53c447bde830..000000000000 --- a/svtools/source/misc1/PasswordHelper.cxx +++ /dev/null @@ -1,109 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: PasswordHelper.cxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - - -#ifndef GCC -#endif -#include "PasswordHelper.hxx" -#include -#include - -using namespace com::sun::star; - -void SvPasswordHelper::GetHashPassword(uno::Sequence& rPassHash, const sal_Char* pPass, sal_uInt32 nLen) -{ - rPassHash.realloc(RTL_DIGEST_LENGTH_SHA1); - - rtlDigestError aError = rtl_digest_SHA1 (pPass, nLen, reinterpret_cast(rPassHash.getArray()), rPassHash.getLength()); - if (aError != rtl_Digest_E_None) - { - rPassHash.realloc(0); - } -} - -void SvPasswordHelper::GetHashPasswordLittleEndian(uno::Sequence& rPassHash, const String& sPass) -{ - xub_StrLen nSize(sPass.Len()); - sal_Char* pCharBuffer = new sal_Char[nSize * sizeof(sal_Unicode)]; - - for (xub_StrLen i = 0; i < nSize; ++i) - { - sal_Unicode ch(sPass.GetChar(i)); - pCharBuffer[2 * i] = static_cast< sal_Char >(ch & 0xFF); - pCharBuffer[2 * i + 1] = static_cast< sal_Char >(ch >> 8); - } - - GetHashPassword(rPassHash, pCharBuffer, nSize * sizeof(sal_Unicode)); - - delete[] pCharBuffer; -} - -void SvPasswordHelper::GetHashPasswordBigEndian(uno::Sequence& rPassHash, const String& sPass) -{ - xub_StrLen nSize(sPass.Len()); - sal_Char* pCharBuffer = new sal_Char[nSize * sizeof(sal_Unicode)]; - - for (xub_StrLen i = 0; i < nSize; ++i) - { - sal_Unicode ch(sPass.GetChar(i)); - pCharBuffer[2 * i] = static_cast< sal_Char >(ch >> 8); - pCharBuffer[2 * i + 1] = static_cast< sal_Char >(ch & 0xFF); - } - - GetHashPassword(rPassHash, pCharBuffer, nSize * sizeof(sal_Unicode)); - - delete[] pCharBuffer; -} - -void SvPasswordHelper::GetHashPassword(uno::Sequence& rPassHash, const String& sPass) -{ - GetHashPasswordLittleEndian(rPassHash, sPass); -} - -bool SvPasswordHelper::CompareHashPassword(const uno::Sequence& rOldPassHash, const String& sNewPass) -{ - bool bResult = false; - - uno::Sequence aNewPass(RTL_DIGEST_LENGTH_SHA1); - GetHashPasswordLittleEndian(aNewPass, sNewPass); - if (aNewPass == rOldPassHash) - bResult = true; - else - { - GetHashPasswordBigEndian(aNewPass, sNewPass); - bResult = (aNewPass == rOldPassHash); - } - - return bResult; -} - diff --git a/svtools/source/misc1/adrparse.cxx b/svtools/source/misc1/adrparse.cxx deleted file mode 100644 index 37c25d6c669f..000000000000 --- a/svtools/source/misc1/adrparse.cxx +++ /dev/null @@ -1,921 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: adrparse.cxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -#include - -namespace unnamed_svtools_adrparse {} -using namespace unnamed_svtools_adrparse; - // unnamed namespaces don't work well yet - -//============================================================================ -namespace unnamed_svtools_adrparse { - -enum ElementType { ELEMENT_START, ELEMENT_DELIM, ELEMENT_ITEM, ELEMENT_END }; - -//============================================================================ -struct ParsedAddrSpec -{ - sal_Unicode const * m_pBegin; - sal_Unicode const * m_pEnd; - ElementType m_eLastElem; - bool m_bAtFound; - bool m_bReparse; - - ParsedAddrSpec() { reset(); } - - bool isPoorlyValid() const { return m_eLastElem >= ELEMENT_ITEM; } - - bool isValid() const { return isPoorlyValid() && m_bAtFound; } - - inline void reset(); - - inline void finish(); -}; - -inline void ParsedAddrSpec::reset() -{ - m_pBegin = 0; - m_pEnd = 0; - m_eLastElem = ELEMENT_START; - m_bAtFound = false; - m_bReparse = false; -} - -inline void ParsedAddrSpec::finish() -{ - if (isPoorlyValid()) - m_eLastElem = ELEMENT_END; - else - reset(); -} - -} - -//============================================================================ -class SvAddressParser_Impl -{ - enum State { BEFORE_COLON, BEFORE_LESS, AFTER_LESS, AFTER_GREATER }; - - enum TokenType { TOKEN_QUOTED = 0x80000000, TOKEN_DOMAIN, TOKEN_COMMENT, - TOKEN_ATOM }; - - sal_Unicode const * m_pInputPos; - sal_Unicode const * m_pInputEnd; - sal_uInt32 m_nCurToken; - sal_Unicode const * m_pCurTokenBegin; - sal_Unicode const * m_pCurTokenEnd; - sal_Unicode const * m_pCurTokenContentBegin; - sal_Unicode const * m_pCurTokenContentEnd; - bool m_bCurTokenReparse; - ParsedAddrSpec m_aOuterAddrSpec; - ParsedAddrSpec m_aInnerAddrSpec; - ParsedAddrSpec * m_pAddrSpec; - sal_Unicode const * m_pRealNameBegin; - sal_Unicode const * m_pRealNameEnd; - sal_Unicode const * m_pRealNameContentBegin; - sal_Unicode const * m_pRealNameContentEnd; - bool m_bRealNameReparse; - bool m_bRealNameFinished; - sal_Unicode const * m_pFirstCommentBegin; - sal_Unicode const * m_pFirstCommentEnd; - bool m_bFirstCommentReparse; - State m_eState; - TokenType m_eType; - - inline void resetRealNameAndFirstComment(); - - inline void reset(); - - inline void addTokenToAddrSpec(ElementType eTokenElem); - - inline void addTokenToRealName(); - - bool readToken(); - - static UniString reparse(sal_Unicode const * pBegin, - sal_Unicode const * pEnd, bool bAddrSpec); - - static UniString reparseComment(sal_Unicode const * pBegin, - sal_Unicode const * pEnd); - -public: - SvAddressParser_Impl(SvAddressParser * pParser, UniString const & rInput); -}; - -inline void SvAddressParser_Impl::resetRealNameAndFirstComment() -{ - m_pRealNameBegin = 0; - m_pRealNameEnd = 0; - m_pRealNameContentBegin = 0; - m_pRealNameContentEnd = 0; - m_bRealNameReparse = false; - m_bRealNameFinished = false; - m_pFirstCommentBegin = 0; - m_pFirstCommentEnd = 0; - m_bFirstCommentReparse = false; -} - -inline void SvAddressParser_Impl::reset() -{ - m_aOuterAddrSpec.reset(); - m_aInnerAddrSpec.reset(); - m_pAddrSpec = &m_aOuterAddrSpec; - resetRealNameAndFirstComment(); - m_eState = BEFORE_COLON; - m_eType = TOKEN_ATOM; -} - -inline void SvAddressParser_Impl::addTokenToAddrSpec(ElementType eTokenElem) -{ - if (!m_pAddrSpec->m_pBegin) - m_pAddrSpec->m_pBegin = m_pCurTokenBegin; - else if (m_pAddrSpec->m_pEnd < m_pCurTokenBegin) - m_pAddrSpec->m_bReparse = true; - m_pAddrSpec->m_pEnd = m_pCurTokenEnd; - m_pAddrSpec->m_eLastElem = eTokenElem; -} - -inline void SvAddressParser_Impl::addTokenToRealName() -{ - if (!m_bRealNameFinished && m_eState != AFTER_LESS) - { - if (!m_pRealNameBegin) - m_pRealNameBegin = m_pRealNameContentBegin = m_pCurTokenBegin; - else if (m_pRealNameEnd < m_pCurTokenBegin - 1 - || (m_pRealNameEnd == m_pCurTokenBegin - 1 - && *m_pRealNameEnd != ' ')) - m_bRealNameReparse = true; - m_pRealNameEnd = m_pRealNameContentEnd = m_pCurTokenEnd; - } -} - -//============================================================================ -// -// SvAddressParser_Impl -// -//============================================================================ - -bool SvAddressParser_Impl::readToken() -{ - m_nCurToken = m_eType; - m_bCurTokenReparse = false; - switch (m_eType) - { - case TOKEN_QUOTED: - { - m_pCurTokenBegin = m_pInputPos - 1; - m_pCurTokenContentBegin = m_pInputPos; - bool bEscaped = false; - for (;;) - { - if (m_pInputPos >= m_pInputEnd) - return false; - sal_Unicode cChar = *m_pInputPos++; - if (bEscaped) - { - m_bCurTokenReparse = true; - bEscaped = false; - } - else if (cChar == '"') - { - m_pCurTokenEnd = m_pInputPos; - m_pCurTokenContentEnd = m_pInputPos - 1; - return true; - } - else if (cChar == '\\') - bEscaped = true; - } - } - - case TOKEN_DOMAIN: - { - m_pCurTokenBegin = m_pInputPos - 1; - m_pCurTokenContentBegin = m_pInputPos; - bool bEscaped = false; - for (;;) - { - if (m_pInputPos >= m_pInputEnd) - return false; - sal_Unicode cChar = *m_pInputPos++; - if (bEscaped) - bEscaped = false; - else if (cChar == ']') - { - m_pCurTokenEnd = m_pInputPos; - return true; - } - else if (cChar == '\\') - bEscaped = true; - } - } - - case TOKEN_COMMENT: - { - m_pCurTokenBegin = m_pInputPos - 1; - m_pCurTokenContentBegin = 0; - m_pCurTokenContentEnd = 0; - bool bEscaped = false; - xub_StrLen nLevel = 0; - for (;;) - { - if (m_pInputPos >= m_pInputEnd) - return false; - sal_Unicode cChar = *m_pInputPos++; - if (bEscaped) - { - m_bCurTokenReparse = true; - m_pCurTokenContentEnd = m_pInputPos; - bEscaped = false; - } - else if (cChar == '(') - { - if (!m_pCurTokenContentBegin) - m_pCurTokenContentBegin = m_pInputPos - 1; - m_pCurTokenContentEnd = m_pInputPos; - ++nLevel; - } - else if (cChar == ')') - if (nLevel) - { - m_pCurTokenContentEnd = m_pInputPos; - --nLevel; - } - else - return true; - else if (cChar == '\\') - { - if (!m_pCurTokenContentBegin) - m_pCurTokenContentBegin = m_pInputPos - 1; - bEscaped = true; - } - else if (cChar > ' ' && cChar != 0x7F) // DEL - { - if (!m_pCurTokenContentBegin) - m_pCurTokenContentBegin = m_pInputPos - 1; - m_pCurTokenContentEnd = m_pInputPos; - } - } - } - - default: - { - sal_Unicode cChar; - for (;;) - { - if (m_pInputPos >= m_pInputEnd) - return false; - cChar = *m_pInputPos++; - if (cChar > ' ' && cChar != 0x7F) // DEL - break; - } - m_pCurTokenBegin = m_pInputPos - 1; - if (cChar == '"' || cChar == '(' || cChar == ')' || cChar == ',' - || cChar == '.' || cChar == ':' || cChar == ';' - || cChar == '<' || cChar == '>' || cChar == '@' - || cChar == '[' || cChar == '\\' || cChar == ']') - { - m_nCurToken = cChar; - m_pCurTokenEnd = m_pInputPos; - return true; - } - else - for (;;) - { - if (m_pInputPos >= m_pInputEnd) - { - m_pCurTokenEnd = m_pInputPos; - return true; - } - cChar = *m_pInputPos++; - if (cChar <= ' ' || cChar == '"' || cChar == '(' - || cChar == ')' || cChar == ',' || cChar == '.' - || cChar == ':' || cChar == ';' || cChar == '<' - || cChar == '>' || cChar == '@' || cChar == '[' - || cChar == '\\' || cChar == ']' - || cChar == 0x7F) // DEL - { - m_pCurTokenEnd = --m_pInputPos; - return true; - } - } - } - } -} - -//============================================================================ -// static -UniString SvAddressParser_Impl::reparse(sal_Unicode const * pBegin, - sal_Unicode const * pEnd, - bool bAddrSpec) -{ - UniString aResult; - TokenType eMode = TOKEN_ATOM; - bool bEscaped = false; - bool bEndsWithSpace = false; - xub_StrLen nLevel = 0; - while (pBegin < pEnd) - { - sal_Unicode cChar = *pBegin++; - switch (eMode) - { - case TOKEN_QUOTED: - if (bEscaped) - { - aResult += cChar; - bEscaped = false; - } - else if (cChar == '"') - { - if (bAddrSpec) - aResult += cChar; - eMode = TOKEN_ATOM; - } - else if (cChar == '\\') - { - if (bAddrSpec) - aResult += cChar; - bEscaped = true; - } - else - aResult += cChar; - break; - - case TOKEN_DOMAIN: - if (bEscaped) - { - aResult += cChar; - bEscaped = false; - } - else if (cChar == ']') - { - aResult += cChar; - eMode = TOKEN_ATOM; - } - else if (cChar == '\\') - { - if (bAddrSpec) - aResult += cChar; - bEscaped = true; - } - else - aResult += cChar; - break; - - case TOKEN_COMMENT: - if (bEscaped) - bEscaped = false; - else if (cChar == '(') - ++nLevel; - else if (cChar == ')') - if (nLevel) - --nLevel; - else - eMode = TOKEN_ATOM; - else if (cChar == '\\') - bEscaped = true; - break; - - case TOKEN_ATOM: - if (cChar <= ' ' || cChar == 0x7F) // DEL - { - if (!bAddrSpec && !bEndsWithSpace) - { - aResult += ' '; - bEndsWithSpace = true; - } - } - else if (cChar == '(') - { - if (!bAddrSpec && !bEndsWithSpace) - { - aResult += ' '; - bEndsWithSpace = true; - } - eMode = TOKEN_COMMENT; - } - else - { - bEndsWithSpace = false; - if (cChar == '"') - { - if (bAddrSpec) - aResult += cChar; - eMode = TOKEN_QUOTED; - } - else if (cChar == '[') - { - aResult += cChar; - eMode = TOKEN_QUOTED; - } - else - aResult += cChar; - } - break; - } - } - return aResult; -} - -//============================================================================ -// static -UniString SvAddressParser_Impl::reparseComment(sal_Unicode const * pBegin, - sal_Unicode const * pEnd) -{ - UniString aResult; - while (pBegin < pEnd) - { - sal_Unicode cChar = *pBegin++; - if (cChar == '\\') - cChar = *pBegin++; - aResult += cChar; - } - return aResult; -} - -//============================================================================ -SvAddressParser_Impl::SvAddressParser_Impl(SvAddressParser * pParser, - UniString const & rInput) -{ - m_pInputPos = rInput.GetBuffer(); - m_pInputEnd = m_pInputPos + rInput.Len(); - - reset(); - bool bDone = false; - for (;;) - { - if (!readToken()) - { - m_bRealNameFinished = true; - if (m_eState == AFTER_LESS) - m_nCurToken = '>'; - else - { - m_nCurToken = ','; - bDone = true; - } - } - switch (m_nCurToken) - { - case TOKEN_QUOTED: - if (m_pAddrSpec->m_eLastElem != ELEMENT_END) - { - if (m_pAddrSpec->m_bAtFound - || m_pAddrSpec->m_eLastElem <= ELEMENT_DELIM) - m_pAddrSpec->reset(); - addTokenToAddrSpec(ELEMENT_ITEM); - } - if (!m_bRealNameFinished && m_eState != AFTER_LESS) - { - if (m_bCurTokenReparse) - { - if (!m_pRealNameBegin) - m_pRealNameBegin = m_pCurTokenBegin; - m_pRealNameEnd = m_pCurTokenEnd; - m_bRealNameReparse = true; - } - else if (m_bRealNameReparse) - m_pRealNameEnd = m_pCurTokenEnd; - else if (!m_pRealNameBegin) - { - m_pRealNameBegin = m_pCurTokenBegin; - m_pRealNameContentBegin = m_pCurTokenContentBegin; - m_pRealNameEnd = m_pRealNameContentEnd - = m_pCurTokenContentEnd; - } - else - { - m_pRealNameEnd = m_pCurTokenEnd; - m_bRealNameReparse = true; - } - } - m_eType = TOKEN_ATOM; - break; - - case TOKEN_DOMAIN: - if (m_pAddrSpec->m_eLastElem != ELEMENT_END) - { - if (m_pAddrSpec->m_bAtFound - && m_pAddrSpec->m_eLastElem == ELEMENT_DELIM) - addTokenToAddrSpec(ELEMENT_ITEM); - else - m_pAddrSpec->reset(); - } - addTokenToRealName(); - m_eType = TOKEN_ATOM; - break; - - case TOKEN_COMMENT: - if (!m_bRealNameFinished && m_eState != AFTER_LESS - && !m_pFirstCommentBegin && m_pCurTokenContentBegin) - { - m_pFirstCommentBegin = m_pCurTokenContentBegin; - m_pFirstCommentEnd = m_pCurTokenContentEnd; - m_bFirstCommentReparse = m_bCurTokenReparse; - } - m_eType = TOKEN_ATOM; - break; - - case TOKEN_ATOM: - if (m_pAddrSpec->m_eLastElem != ELEMENT_END) - { - if (m_pAddrSpec->m_eLastElem != ELEMENT_DELIM) - m_pAddrSpec->reset(); - addTokenToAddrSpec(ELEMENT_ITEM); - } - addTokenToRealName(); - break; - - case '(': - m_eType = TOKEN_COMMENT; - break; - - case ')': - case '\\': - case ']': - m_pAddrSpec->finish(); - addTokenToRealName(); - break; - - case '<': - switch (m_eState) - { - case BEFORE_COLON: - case BEFORE_LESS: - m_aOuterAddrSpec.finish(); - if (m_pRealNameBegin) - m_bRealNameFinished = true; - m_pAddrSpec = &m_aInnerAddrSpec; - m_eState = AFTER_LESS; - break; - - case AFTER_LESS: - m_aInnerAddrSpec.finish(); - break; - - case AFTER_GREATER: - m_aOuterAddrSpec.finish(); - addTokenToRealName(); - break; - } - break; - - case '>': - if (m_eState == AFTER_LESS) - { - m_aInnerAddrSpec.finish(); - if (m_aInnerAddrSpec.isValid()) - m_aOuterAddrSpec.m_eLastElem = ELEMENT_END; - m_pAddrSpec = &m_aOuterAddrSpec; - m_eState = AFTER_GREATER; - } - else - { - m_aOuterAddrSpec.finish(); - addTokenToRealName(); - } - break; - - case '@': - if (m_pAddrSpec->m_eLastElem != ELEMENT_END) - { - if (!m_pAddrSpec->m_bAtFound - && m_pAddrSpec->m_eLastElem == ELEMENT_ITEM) - { - addTokenToAddrSpec(ELEMENT_DELIM); - m_pAddrSpec->m_bAtFound = true; - } - else - m_pAddrSpec->reset(); - } - addTokenToRealName(); - break; - - case ',': - case ';': - if (m_eState == AFTER_LESS) - if (m_nCurToken == ',') - { - if (m_aInnerAddrSpec.m_eLastElem - != ELEMENT_END) - m_aInnerAddrSpec.reset(); - } - else - m_aInnerAddrSpec.finish(); - else - { - m_pAddrSpec = m_aInnerAddrSpec.isValid() - || (!m_aOuterAddrSpec.isValid() - && m_aInnerAddrSpec.isPoorlyValid()) ? - &m_aInnerAddrSpec : - m_aOuterAddrSpec.isPoorlyValid() ? - &m_aOuterAddrSpec : 0; - if (m_pAddrSpec) - { - UniString aTheAddrSpec; - if (m_pAddrSpec->m_bReparse) - aTheAddrSpec = reparse(m_pAddrSpec->m_pBegin, - m_pAddrSpec->m_pEnd, true); - else - { - xub_StrLen nLen = - sal::static_int_cast< xub_StrLen >( - m_pAddrSpec->m_pEnd - - m_pAddrSpec->m_pBegin); - if (nLen == rInput.Len()) - aTheAddrSpec = rInput; - else - aTheAddrSpec - = rInput.Copy( - sal::static_int_cast< xub_StrLen >( - m_pAddrSpec->m_pBegin - - rInput.GetBuffer()), - nLen); - } - UniString aTheRealName; - if (!m_pRealNameBegin - || (m_pAddrSpec == &m_aOuterAddrSpec - && m_pRealNameBegin - == m_aOuterAddrSpec.m_pBegin - && m_pRealNameEnd == m_aOuterAddrSpec.m_pEnd - && m_pFirstCommentBegin)) - if (!m_pFirstCommentBegin) - aTheRealName = aTheAddrSpec; - else if (m_bFirstCommentReparse) - aTheRealName - = reparseComment(m_pFirstCommentBegin, - m_pFirstCommentEnd); - else - aTheRealName - = rInput.Copy( - sal::static_int_cast< xub_StrLen >( - m_pFirstCommentBegin - - rInput.GetBuffer()), - sal::static_int_cast< xub_StrLen >( - m_pFirstCommentEnd - - m_pFirstCommentBegin)); - else if (m_bRealNameReparse) - aTheRealName = reparse(m_pRealNameBegin, - m_pRealNameEnd, false); - else - { - xub_StrLen nLen = - sal::static_int_cast< xub_StrLen >( - m_pRealNameContentEnd - - m_pRealNameContentBegin); - if (nLen == rInput.Len()) - aTheRealName = rInput; - else - aTheRealName - = rInput.Copy( - sal::static_int_cast< xub_StrLen >( - m_pRealNameContentBegin - - rInput.GetBuffer()), - nLen); - } - if (pParser->m_bHasFirst) - pParser->m_aRest.Insert(new SvAddressEntry_Impl( - aTheAddrSpec, - aTheRealName), - LIST_APPEND); - else - { - pParser->m_bHasFirst = true; - pParser->m_aFirst.m_aAddrSpec = aTheAddrSpec; - pParser->m_aFirst.m_aRealName = aTheRealName; - } - } - if (bDone) - return; - reset(); - } - break; - - case ':': - switch (m_eState) - { - case BEFORE_COLON: - m_aOuterAddrSpec.reset(); - resetRealNameAndFirstComment(); - m_eState = BEFORE_LESS; - break; - - case BEFORE_LESS: - case AFTER_GREATER: - m_aOuterAddrSpec.finish(); - addTokenToRealName(); - break; - - case AFTER_LESS: - m_aInnerAddrSpec.reset(); - break; - } - break; - - case '"': - m_eType = TOKEN_QUOTED; - break; - - case '.': - if (m_pAddrSpec->m_eLastElem != ELEMENT_END) - { - if (m_pAddrSpec->m_eLastElem != ELEMENT_DELIM) - addTokenToAddrSpec(ELEMENT_DELIM); - else - m_pAddrSpec->reset(); - } - addTokenToRealName(); - break; - - case '[': - m_eType = TOKEN_DOMAIN; - break; - } - } -} - -//============================================================================ -// -// SvAddressParser -// -//============================================================================ - -SvAddressParser::SvAddressParser(UniString const & rInput): m_bHasFirst(false) -{ - SvAddressParser_Impl(this, rInput); -} - -//============================================================================ -SvAddressParser::~SvAddressParser() -{ - for (ULONG i = m_aRest.Count(); i != 0;) - delete m_aRest.Remove(--i); -} - -//============================================================================ -// static -bool SvAddressParser::createRFC822Mailbox(String const & rPhrase, - String const & rAddrSpec, - String & rMailbox) -{ - String aTheAddrSpec; - sal_Unicode const * p = rAddrSpec.GetBuffer(); - sal_Unicode const * pEnd = p + rAddrSpec.Len(); - {for (bool bSegment = false;;) - { - p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); - if (p == pEnd) - return false; - if (bSegment) - { - sal_Unicode c = *p++; - if (c == '@') - break; - else if (c != '.') - return false; - aTheAddrSpec += '.'; - p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); - if (p == pEnd) - return false; - } - else - bSegment = true; - if (*p == '"') - { - aTheAddrSpec += *p++; - for (;;) - { - if (INetMIME::startsWithLineFolding(p, pEnd)) - p += 2; - if (p == pEnd) - return false; - if (*p == '"') - break; - if (*p == '\x0D' || (*p == '\\' && ++p == pEnd) - || !INetMIME::isUSASCII(*p)) - return false; - if (INetMIME::needsQuotedStringEscape(*p)) - aTheAddrSpec += '\\'; - aTheAddrSpec += *p++; - } - aTheAddrSpec += *p++; - } - else if (INetMIME::isAtomChar(*p)) - while (p != pEnd && INetMIME::isAtomChar(*p)) - aTheAddrSpec += *p++; - else - return false; - }} - aTheAddrSpec += '@'; - {for (bool bSegment = false;;) - { - p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); - if (p == pEnd) - { - if (bSegment) - break; - else - return false; - } - if (bSegment) - { - if (*p++ != '.') - return false; - aTheAddrSpec += '.'; - p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); - if (p == pEnd) - return false; - } - else - bSegment = true; - if (*p == '[') - { - aTheAddrSpec += *p++; - for (;;) - { - if (INetMIME::startsWithLineFolding(p, pEnd)) - p += 2; - if (p == pEnd) - return false; - if (*p == ']') - break; - if (*p == '\x0D' || *p == '[' || (*p == '\\' && ++p == pEnd) - || !INetMIME::isUSASCII(*p)) - return false; - if (*p >= '[' && *p <= ']') - aTheAddrSpec += '\\'; - aTheAddrSpec += *p++; - } - aTheAddrSpec += *p++; - } - else if (INetMIME::isAtomChar(*p)) - while (p != pEnd && INetMIME::isAtomChar(*p)) - aTheAddrSpec += *p++; - else - return false; - }} - - if (rPhrase.Len() == 0) - rMailbox = aTheAddrSpec; - else - { - bool bQuotedString = false; - p = rPhrase.GetBuffer(); - pEnd = p + rPhrase.Len(); - for (;p != pEnd; ++p) - if (!(INetMIME::isAtomChar(*p))) - { - bQuotedString = true; - break; - } - String aTheMailbox; - if (bQuotedString) - { - aTheMailbox = '"'; - for (p = rPhrase.GetBuffer(); p != pEnd; ++p) - { - if (INetMIME::needsQuotedStringEscape(*p)) - aTheMailbox += '\\'; - aTheMailbox += *p; - } - aTheMailbox += '"'; - } - else - aTheMailbox = rPhrase; - aTheMailbox.AppendAscii(RTL_CONSTASCII_STRINGPARAM(" <")); - aTheMailbox += aTheAddrSpec; - aTheMailbox += '>'; - rMailbox = aTheMailbox; - } - return true; -} - diff --git a/svtools/source/misc1/filenotation.cxx b/svtools/source/misc1/filenotation.cxx deleted file mode 100644 index f5e5ae934e3d..000000000000 --- a/svtools/source/misc1/filenotation.cxx +++ /dev/null @@ -1,147 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: filenotation.cxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include "filenotation.hxx" -#include -#include -#include - -//......................................................................... -namespace svt -{ -//......................................................................... - - //===================================================================== - //= OFileNotation - //===================================================================== - //--------------------------------------------------------------------- - OFileNotation::OFileNotation( const ::rtl::OUString& _rUrlOrPath ) - { - construct( _rUrlOrPath ); - } - - //--------------------------------------------------------------------- - OFileNotation::OFileNotation( const ::rtl::OUString& _rUrlOrPath, NOTATION _eInputNotation ) - { - if ( _eInputNotation == N_URL ) - { - INetURLObject aParser( _rUrlOrPath ); - if ( aParser.GetProtocol() == INET_PROT_FILE ) - implInitWithURLNotation( _rUrlOrPath ); - else - m_sSystem = m_sFileURL = _rUrlOrPath; - } - else - implInitWithSystemNotation( _rUrlOrPath ); - } - - //--------------------------------------------------------------------- - bool OFileNotation::implInitWithSystemNotation( const ::rtl::OUString& _rSystemPath ) - { - bool bSuccess = false; - - m_sSystem = _rSystemPath; - if ( ( osl_File_E_None != osl_getFileURLFromSystemPath( m_sSystem.pData, &m_sFileURL.pData ) ) - && ( 0 == m_sFileURL.getLength() ) - ) - { - if ( _rSystemPath.getLength() ) - { - INetURLObject aSmartParser; - aSmartParser.SetSmartProtocol( INET_PROT_FILE ); - if ( aSmartParser.SetSmartURL( _rSystemPath ) ) - { - m_sFileURL = aSmartParser.GetMainURL( INetURLObject::NO_DECODE ); - osl_getSystemPathFromFileURL( m_sFileURL.pData, &m_sSystem.pData ); - bSuccess = true; - } - } - } - else - bSuccess = true; - return bSuccess; - } - - //--------------------------------------------------------------------- - bool OFileNotation::implInitWithURLNotation( const ::rtl::OUString& _rURL ) - { - m_sFileURL = _rURL; - osl_getSystemPathFromFileURL( _rURL.pData, &m_sSystem.pData ); - return true; - } - - //--------------------------------------------------------------------- - void OFileNotation::construct( const ::rtl::OUString& _rUrlOrPath ) - { - bool bSuccess = false; - // URL notation? - INetURLObject aParser( _rUrlOrPath ); - switch ( aParser.GetProtocol() ) - { - case INET_PROT_FILE: - // file URL - bSuccess = implInitWithURLNotation( _rUrlOrPath ); - break; - - case INET_PROT_NOT_VALID: - // assume system notation - bSuccess = implInitWithSystemNotation( _rUrlOrPath ); - break; - - default: - // it's a known scheme, but no file-URL -> assume that bothe the URL representation and the - // system representation are the URL itself - m_sSystem = m_sFileURL = _rUrlOrPath; - bSuccess = true; - break; - } - - OSL_ENSURE( bSuccess, "OFileNotation::OFileNotation: could not detect the format!" ); - } - - //--------------------------------------------------------------------- - ::rtl::OUString OFileNotation::get(NOTATION _eOutputNotation) - { - switch (_eOutputNotation) - { - case N_SYSTEM: return m_sSystem; - case N_URL: return m_sFileURL; - } - - OSL_ENSURE(sal_False, "OFileNotation::get: inavlid enum value!"); - return ::rtl::OUString(); - } - -//......................................................................... -} // namespace svt -//......................................................................... - diff --git a/svtools/source/misc1/folderrestriction.cxx b/svtools/source/misc1/folderrestriction.cxx deleted file mode 100644 index 7f95bdaaa0bc..000000000000 --- a/svtools/source/misc1/folderrestriction.cxx +++ /dev/null @@ -1,109 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: folderrestriction.cxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include "folderrestriction.hxx" -#include "osl/process.h" -#include "tools/urlobj.hxx" -#include "unotools/localfilehelper.hxx" - -//----------------------------------------------------------------------------- - -static void convertStringListToUrls ( - const String& _rColonSeparatedList, ::std::vector< String >& _rTokens, bool _bFinalSlash ) -{ - const sal_Unicode s_cSeparator = -#if defined(WNT) - ';' -#else - ':' -#endif - ; - xub_StrLen nTokens = _rColonSeparatedList.GetTokenCount( s_cSeparator ); - _rTokens.resize( 0 ); _rTokens.reserve( nTokens ); - for ( xub_StrLen i=0; i if and only if the retrieved string value is not empty -*/ -static bool getEnvironmentValue( const sal_Char* _pAsciiEnvName, ::rtl::OUString& _rValue ) -{ - _rValue = ::rtl::OUString(); - ::rtl::OUString sEnvName = ::rtl::OUString::createFromAscii( _pAsciiEnvName ); - osl_getEnvironment( sEnvName.pData, &_rValue.pData ); - return _rValue.getLength() != 0; -} - -//----------------------------------------------------------------------------- - -namespace svt -{ - - void getUnrestrictedFolders( ::std::vector< String >& _rFolders ) - { - _rFolders.resize( 0 ); - ::rtl::OUString sRestrictedPathList; - if ( getEnvironmentValue( "RestrictedPath", sRestrictedPathList ) ) - { - // append a final slash. This ensures that when we later on check - // for unrestricted paths, we don't allow paths like "/home/user35" just because - // "/home/user3" is allowed - with the final slash, we make it "/home/user3/". - convertStringListToUrls( sRestrictedPathList, _rFolders, true ); - } - } - -} // namespace svt - diff --git a/svtools/source/misc1/fstathelper.cxx b/svtools/source/misc1/fstathelper.cxx deleted file mode 100644 index 82480fc83473..000000000000 --- a/svtools/source/misc1/fstathelper.cxx +++ /dev/null @@ -1,103 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: fstathelper.cxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -#include -#include -#include -#include - -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::ucb; -using namespace ::rtl; - -sal_Bool FStatHelper::GetModifiedDateTimeOfFile( const UniString& rURL, - Date* pDate, Time* pTime ) -{ - sal_Bool bRet = FALSE; - try - { - ::ucbhelper::Content aTestContent( rURL, - uno::Reference< XCommandEnvironment > ()); - uno::Any aAny = aTestContent.getPropertyValue( - OUString::createFromAscii( "DateModified" ) ); - if( aAny.hasValue() ) - { - bRet = sal_True; - const util::DateTime* pDT = (util::DateTime*)aAny.getValue(); - if( pDate ) - *pDate = Date( pDT->Day, pDT->Month, pDT->Year ); - if( pTime ) - *pTime = Time( pDT->Hours, pDT->Minutes, - pDT->Seconds, pDT->HundredthSeconds ); - } - } - catch(...) - { - } - - return bRet; -} - -sal_Bool FStatHelper::IsDocument( const UniString& rURL ) -{ - BOOL bExist = FALSE; - try - { - ::ucbhelper::Content aTestContent( rURL, - uno::Reference< XCommandEnvironment > ()); - bExist = aTestContent.isDocument(); - } - catch(...) - { - } - return bExist; -} - -sal_Bool FStatHelper::IsFolder( const UniString& rURL ) -{ - BOOL bExist = FALSE; - try - { - ::ucbhelper::Content aTestContent( rURL, - uno::Reference< XCommandEnvironment > ()); - bExist = aTestContent.isFolder(); - } - catch(...) - { - } - return bExist; -} - diff --git a/svtools/source/misc1/inethist.cxx b/svtools/source/misc1/inethist.cxx deleted file mode 100644 index 5a1a3719d7ca..000000000000 --- a/svtools/source/misc1/inethist.cxx +++ /dev/null @@ -1,545 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: inethist.cxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include - -#ifndef INCLUDED_ALGORITHM -#include -#define INCLUDED_ALGORITHM -#endif -#include "rtl/instance.hxx" -#include "rtl/crc.h" -#include "rtl/memory.h" -#include -#include -#include -#include - -/*======================================================================== - * - * INetURLHistory internals. - * - *======================================================================*/ -#define INETHIST_DEF_FTP_PORT 21 -#define INETHIST_DEF_HTTP_PORT 80 -#define INETHIST_DEF_HTTPS_PORT 443 - -#define INETHIST_SIZE_LIMIT 1024 -#define INETHIST_MAGIC_HEAD 0x484D4849UL - -/* - * INetURLHistoryHint implementation. - */ -IMPL_PTRHINT (INetURLHistoryHint, const INetURLObject); - -/*======================================================================== - * - * INetURLHistory_Impl interface. - * - *======================================================================*/ -class INetURLHistory_Impl -{ - /** head_entry. - */ - struct head_entry - { - /** Representation. - */ - UINT32 m_nMagic; - UINT16 m_nNext; - UINT16 m_nMBZ; - - /** Initialization. - */ - void initialize (void) - { - m_nMagic = INETHIST_MAGIC_HEAD; - m_nNext = 0; - m_nMBZ = 0; - } - }; - - /** hash_entry. - */ - struct hash_entry - { - /** Representation. - */ - UINT32 m_nHash; - UINT16 m_nLru; - UINT16 m_nMBZ; - - /** Initialization. - */ - void initialize (UINT16 nLru, UINT32 nHash = 0) - { - m_nHash = nHash; - m_nLru = nLru; - m_nMBZ = 0; - } - - /** Comparison. - */ - BOOL operator== (const hash_entry &rOther) const - { - return (m_nHash == rOther.m_nHash); - } - BOOL operator< (const hash_entry &rOther) const - { - return (m_nHash < rOther.m_nHash); - } - - BOOL operator== (UINT32 nHash) const - { - return (m_nHash == nHash); - } - BOOL operator< (UINT32 nHash) const - { - return (m_nHash < nHash); - } - }; - - /** lru_entry. - */ - struct lru_entry - { - /** Representation. - */ - UINT32 m_nHash; - UINT16 m_nNext; - UINT16 m_nPrev; - - /** Initialization. - */ - void initialize (UINT16 nThis, UINT32 nHash = 0) - { - m_nHash = nHash; - m_nNext = nThis; - m_nPrev = nThis; - } - }; - - /** Representation. - */ - head_entry m_aHead; - hash_entry m_pHash[INETHIST_SIZE_LIMIT]; - lru_entry m_pList[INETHIST_SIZE_LIMIT]; - - /** Initialization. - */ - void initialize (void); - - void downheap (hash_entry a[], UINT16 n, UINT16 k); - void heapsort (hash_entry a[], UINT16 n); - - /** capacity. - */ - UINT16 capacity (void) const - { - return (UINT16)(INETHIST_SIZE_LIMIT); - } - - /** crc32. - */ - UINT32 crc32 (UniString const & rData) const - { - return rtl_crc32 (0, rData.GetBuffer(), rData.Len() * sizeof(sal_Unicode)); - } - - /** find. - */ - UINT16 find (UINT32 nHash) const; - - /** move. - */ - void move (UINT16 nSI, UINT16 nDI); - - /** backlink. - */ - void backlink (UINT16 nThis, UINT16 nTail) - { - register lru_entry &rThis = m_pList[nThis]; - register lru_entry &rTail = m_pList[nTail]; - - rTail.m_nNext = nThis; - rTail.m_nPrev = rThis.m_nPrev; - rThis.m_nPrev = nTail; - m_pList[rTail.m_nPrev].m_nNext = nTail; - } - - /** unlink. - */ - void unlink (UINT16 nThis) - { - register lru_entry &rThis = m_pList[nThis]; - - m_pList[rThis.m_nPrev].m_nNext = rThis.m_nNext; - m_pList[rThis.m_nNext].m_nPrev = rThis.m_nPrev; - rThis.m_nNext = nThis; - rThis.m_nPrev = nThis; - } - - /** Not implemented. - */ - INetURLHistory_Impl (const INetURLHistory_Impl&); - INetURLHistory_Impl& operator= (const INetURLHistory_Impl&); - -public: - INetURLHistory_Impl (void); - ~INetURLHistory_Impl (void); - - /** putUrl/queryUrl. - */ - void putUrl (const String &rUrl); - BOOL queryUrl (const String &rUrl); -}; - -/*======================================================================== - * - * INetURLHistory_Impl implementation. - * - *======================================================================*/ -/* - * INetURLHistory_Impl. - */ -INetURLHistory_Impl::INetURLHistory_Impl (void) -{ - initialize(); -} - -/* - * ~INetURLHistory_Impl. - */ -INetURLHistory_Impl::~INetURLHistory_Impl (void) -{ -} - -/* - * initialize. - */ -void INetURLHistory_Impl::initialize (void) -{ - m_aHead.initialize(); - - USHORT i, n = capacity(); - for (i = 0; i < n; i++) - m_pHash[i].initialize(i); - for (i = 0; i < n; i++) - m_pList[i].initialize(i); - for (i = 1; i < n; i++) - backlink (m_aHead.m_nNext, i); -} - -/* - * downheap. - */ -void INetURLHistory_Impl::downheap (hash_entry a[], UINT16 n, UINT16 k) -{ - hash_entry h = a[k]; - while (k < n / 2) - { - UINT16 i = k + k + 1; - if (((i + 1) < n) && (a[i] < a[i + 1])) i++; - if (!(h < a[i])) break; - a[k] = a[i]; - k = i; - } - a[k] = h; -} - -/* - * heapsort. - */ -void INetURLHistory_Impl::heapsort (hash_entry a[], UINT16 n) -{ - hash_entry h; - - for (UINT16 k = (n - 1) / 2 + 1; k > 0; k--) - downheap (a, n, k - 1); - - while (n > 0) - { - h = a[0 ]; - a[0 ] = a[n - 1]; - a[n - 1] = h; - downheap (a, --n, 0); - } -} - -/* - * find. - */ -UINT16 INetURLHistory_Impl::find (UINT32 nHash) const -{ - UINT16 l = 0; - UINT16 r = capacity() - 1; - UINT16 c = capacity(); - - while ((l < r) && (r < c)) - { - UINT16 m = (l + r) / 2; - if (m_pHash[m] == nHash) - return m; - - if (m_pHash[m] < nHash) - l = m + 1; - else - r = m - 1; - } - return l; -} - -/* - * move. - */ -void INetURLHistory_Impl::move (UINT16 nSI, UINT16 nDI) -{ - hash_entry e = m_pHash[nSI]; - if (nSI < nDI) - { - // shift left. - rtl_moveMemory ( - &m_pHash[nSI ], - &m_pHash[nSI + 1], - (nDI - nSI) * sizeof(hash_entry)); - } - if (nSI > nDI) - { - // shift right. - rtl_moveMemory ( - &m_pHash[nDI + 1], - &m_pHash[nDI ], - (nSI - nDI) * sizeof(hash_entry)); - } - m_pHash[nDI] = e; -} - -/* - * putUrl. - */ -void INetURLHistory_Impl::putUrl (const String &rUrl) -{ - UINT32 h = crc32 (rUrl); - UINT16 k = find (h); - if ((k < capacity()) && (m_pHash[k] == h)) - { - // Cache hit. - UINT16 nMRU = m_pHash[k].m_nLru; - if (nMRU != m_aHead.m_nNext) - { - // Update LRU chain. - unlink (nMRU); - backlink (m_aHead.m_nNext, nMRU); - - // Rotate LRU chain. - m_aHead.m_nNext = m_pList[m_aHead.m_nNext].m_nPrev; - } - } - else - { - // Cache miss. Obtain least recently used. - UINT16 nLRU = m_pList[m_aHead.m_nNext].m_nPrev; - - UINT16 nSI = find (m_pList[nLRU].m_nHash); - if (!(nLRU == m_pHash[nSI].m_nLru)) - { - // Update LRU chain. - nLRU = m_pHash[nSI].m_nLru; - unlink (nLRU); - backlink (m_aHead.m_nNext, nLRU); - } - - // Rotate LRU chain. - m_aHead.m_nNext = m_pList[m_aHead.m_nNext].m_nPrev; - - // Check source and destination. - UINT16 nDI = std::min (k, UINT16(capacity() - 1)); - if (nSI < nDI) - { - if (!(m_pHash[nDI] < h)) - nDI -= 1; - } - if (nDI < nSI) - { - if (m_pHash[nDI] < h) - nDI += 1; - } - - // Assign data. - m_pList[m_aHead.m_nNext].m_nHash = m_pHash[nSI].m_nHash = h; - move (nSI, nDI); - } -} - -/* - * queryUrl. - */ -BOOL INetURLHistory_Impl::queryUrl (const String &rUrl) -{ - UINT32 h = crc32 (rUrl); - UINT16 k = find (h); - if ((k < capacity()) && (m_pHash[k] == h)) - { - // Cache hit. - return TRUE; - } - else - { - // Cache miss. - return FALSE; - } -} - -/*======================================================================== - * - * INetURLHistory::StaticInstance implementation. - * - *======================================================================*/ -INetURLHistory * INetURLHistory::StaticInstance::operator ()() -{ - static INetURLHistory g_aInstance; - return &g_aInstance; -} - -/*======================================================================== - * - * INetURLHistory implementation. - * - *======================================================================*/ -/* - * INetURLHistory. - */ -INetURLHistory::INetURLHistory() : m_pImpl (new INetURLHistory_Impl()) -{ -} - -/* - * ~INetURLHistory. - */ -INetURLHistory::~INetURLHistory() -{ - DELETEZ (m_pImpl); -} - -/* - * GetOrCreate. - */ -INetURLHistory* INetURLHistory::GetOrCreate() -{ - return rtl_Instance< - INetURLHistory, StaticInstance, - osl::MutexGuard, osl::GetGlobalMutex >::create ( - StaticInstance(), osl::GetGlobalMutex()); -} - -/* - * NormalizeUrl_Impl. - */ -void INetURLHistory::NormalizeUrl_Impl (INetURLObject &rUrl) -{ - switch (rUrl.GetProtocol()) - { - case INET_PROT_FILE: - if (!rUrl.IsCaseSensitive()) - { - String aPath (rUrl.GetURLPath(INetURLObject::NO_DECODE)); - aPath.ToLowerAscii(); - rUrl.SetURLPath (aPath, INetURLObject::NOT_CANONIC); - } - break; - - case INET_PROT_FTP: - if (!rUrl.HasPort()) - rUrl.SetPort (INETHIST_DEF_FTP_PORT); - break; - - case INET_PROT_HTTP: - if (!rUrl.HasPort()) - rUrl.SetPort (INETHIST_DEF_HTTP_PORT); - if (!rUrl.HasURLPath()) - rUrl.SetURLPath ("/"); - break; - - case INET_PROT_HTTPS: - if (!rUrl.HasPort()) - rUrl.SetPort (INETHIST_DEF_HTTPS_PORT); - if (!rUrl.HasURLPath()) - rUrl.SetURLPath ("/"); - break; - - default: - break; - } -} - -/* - * PutUrl_Impl. - */ -void INetURLHistory::PutUrl_Impl (const INetURLObject &rUrl) -{ - DBG_ASSERT (m_pImpl, "PutUrl_Impl(): no Implementation"); - if (m_pImpl) - { - INetURLObject aHistUrl (rUrl); - NormalizeUrl_Impl (aHistUrl); - - m_pImpl->putUrl (aHistUrl.GetMainURL(INetURLObject::NO_DECODE)); - Broadcast (INetURLHistoryHint (&rUrl)); - - if (aHistUrl.HasMark()) - { - aHistUrl.SetURL (aHistUrl.GetURLNoMark(INetURLObject::NO_DECODE), - INetURLObject::NOT_CANONIC); - - m_pImpl->putUrl (aHistUrl.GetMainURL(INetURLObject::NO_DECODE)); - Broadcast (INetURLHistoryHint (&aHistUrl)); - } - } -} - -/* - * QueryUrl_Impl. - */ -BOOL INetURLHistory::QueryUrl_Impl (const INetURLObject &rUrl) -{ - DBG_ASSERT (m_pImpl, "QueryUrl_Impl(): no Implementation"); - if (m_pImpl) - { - INetURLObject aHistUrl (rUrl); - NormalizeUrl_Impl (aHistUrl); - - return m_pImpl->queryUrl (aHistUrl.GetMainURL(INetURLObject::NO_DECODE)); - } - return FALSE; -} - - diff --git a/svtools/source/misc1/inettype.cxx b/svtools/source/misc1/inettype.cxx deleted file mode 100644 index ce62d7f3b2fc..000000000000 --- a/svtools/source/misc1/inettype.cxx +++ /dev/null @@ -1,1348 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: inettype.cxx,v $ - * $Revision: 1.9 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -#include -#include -#include -#ifndef _SVTOOLS_HRC -#include -#endif - -#ifndef _SVSTDARR_STRINGSSORT_DECL -#define _SVSTDARR_STRINGSSORT -#include -#undef _SVSTDARR_STRINGSSORT -#endif - -namespace unnamed_svtools_inettype {} -using namespace unnamed_svtools_inettype; - // unnamed namespaces don't work well yet - -//============================================================================ -namespace unnamed_svtools_inettype { - -//============================================================================ -struct MediaTypeEntry -{ - sal_Char const * m_pTypeName; - INetContentType m_eTypeID; - sal_Char const * m_pExtension; -}; - -//============================================================================ -struct TypeIDMapEntry -{ - UniString m_aTypeName; - UniString m_aPresentation; - UniString m_aSystemFileType; -}; - -//============================================================================ -struct TypeNameMapEntry: public UniString -{ - UniString m_aExtension; - INetContentType m_eTypeID; - - TypeNameMapEntry(const UniString & rType): - UniString(rType), m_eTypeID(CONTENT_TYPE_UNKNOWN) {} -}; - -//============================================================================ -struct ExtensionMapEntry: public UniString -{ - INetContentType m_eTypeID; - - ExtensionMapEntry(const UniString & rExt): - UniString(rExt), m_eTypeID(CONTENT_TYPE_UNKNOWN) {} -}; - -//============================================================================ -class Registration -{ - static Registration * m_pRegistration; - - Table m_aTypeIDMap; // map TypeID to TypeName, Presentation - SvStringsSort m_aTypeNameMap; // map TypeName to TypeID, Extension - SvStringsSort m_aExtensionMap; // map Extension to TypeID - sal_uInt32 m_nNextDynamicID; - -public: - Registration(): m_nNextDynamicID(CONTENT_TYPE_LAST + 1) {} - - ~Registration(); - - static inline void deinitialize(); - - static inline TypeIDMapEntry * getEntry(INetContentType eTypeID); - - static TypeNameMapEntry * getExtensionEntry(UniString const & rTypeName); - - static INetContentType RegisterContentType(UniString const & rTypeName, - UniString const & - rPresentation, - UniString const * pExtension, - UniString const * - pSystemFileType); - - static INetContentType GetContentType(UniString const & rTypeName); - - static UniString GetContentType(INetContentType eTypeID); - - static UniString GetPresentation(INetContentType eTypeID); - - static UniString GetExtension(const UniString & rTypeName); - - static INetContentType GetContentType4Extension(UniString const & - rExtension); - -}; - -// static -inline void Registration::deinitialize() -{ - delete m_pRegistration; - m_pRegistration = 0; -} - -// static -inline TypeIDMapEntry * Registration::getEntry(INetContentType eTypeID) -{ - return - m_pRegistration ? - static_cast< TypeIDMapEntry * >(m_pRegistration-> - m_aTypeIDMap.Get(eTypeID)) : - 0; -} - -//============================================================================ -MediaTypeEntry const * seekEntry(UniString const & rTypeName, - MediaTypeEntry const * pMap, sal_Size nSize); - -//============================================================================ -/** A mapping from type names to type ids and extensions. Sorted by type - name. - */ -MediaTypeEntry const aStaticTypeNameMap[CONTENT_TYPE_LAST + 1] - = { { " ", CONTENT_TYPE_UNKNOWN, "" }, - { CONTENT_TYPE_STR_X_CNT_DOCUMENT, CONTENT_TYPE_X_CNT_DOCUMENT, - "tmp" }, - { CONTENT_TYPE_STR_X_CNT_FSYSBOX, CONTENT_TYPE_X_CNT_FSYSBOX, "tmp" }, - { CONTENT_TYPE_STR_X_CNT_CDROM_VOLUME, - CONTENT_TYPE_X_CNT_CDROM_VOLUME, "tmp" }, - { CONTENT_TYPE_STR_X_CNT_DISK_35, CONTENT_TYPE_X_CNT_DISK_35, "tmp" }, - { CONTENT_TYPE_STR_X_CNT_DISK_525, CONTENT_TYPE_X_CNT_DISK_525, - "tmp" }, - { CONTENT_TYPE_STR_X_CNT_FSYSFILE, CONTENT_TYPE_X_CNT_FSYSFILE, - "tmp" }, - { CONTENT_TYPE_STR_X_CNT_FIXED_VOLUME, - CONTENT_TYPE_X_CNT_FIXED_VOLUME, "tmp" }, - { CONTENT_TYPE_STR_X_CNT_FSYSFOLDER, CONTENT_TYPE_X_CNT_FSYSFOLDER, - "tmp" }, - { CONTENT_TYPE_STR_X_CNT_RAM_VOLUME, CONTENT_TYPE_X_CNT_RAM_VOLUME, - "tmp" }, - { CONTENT_TYPE_STR_X_CNT_REMOTE_VOLUME, - CONTENT_TYPE_X_CNT_REMOTE_VOLUME, "tmp" }, - { CONTENT_TYPE_STR_X_CNT_REMOVEABLE_VOLUME, - CONTENT_TYPE_X_CNT_REMOVEABLE_VOLUME, "tmp" }, - { CONTENT_TYPE_STR_X_CNT_FSYSSPECIALFILE, - CONTENT_TYPE_X_CNT_FSYSSPECIALFILE, "tmp" }, - { CONTENT_TYPE_STR_X_CNT_FSYSSPECIALFOLDER, - CONTENT_TYPE_X_CNT_FSYSSPECIALFOLDER, "tmp" }, - { CONTENT_TYPE_STR_X_CNT_TAPEDRIVE, CONTENT_TYPE_X_CNT_TAPEDRIVE, - "tmp" }, - { CONTENT_TYPE_STR_X_CNT_FSYSURLFILE, CONTENT_TYPE_X_CNT_FSYSURLFILE, - "tmp" }, - { CONTENT_TYPE_STR_X_CNT_FTPBOX, CONTENT_TYPE_X_CNT_FTPBOX, "tmp" }, - { CONTENT_TYPE_STR_X_CNT_FTPFILE, CONTENT_TYPE_X_CNT_FTPFILE, "tmp" }, - { CONTENT_TYPE_STR_X_CNT_FTPFOLDER, CONTENT_TYPE_X_CNT_FTPFOLDER, - "tmp" }, - { CONTENT_TYPE_STR_X_CNT_FTPLINK, CONTENT_TYPE_X_CNT_FTPLINK, "tmp" }, - { CONTENT_TYPE_STR_X_CNT_HTTPBOX, CONTENT_TYPE_X_CNT_HTTPBOX, "tmp" }, - { CONTENT_TYPE_STR_X_CNT_HTTPFILE, CONTENT_TYPE_X_CNT_HTTPFILE, - "tmp" }, - { CONTENT_TYPE_STR_X_CNT_IMAPBOX, CONTENT_TYPE_X_CNT_IMAPBOX, "tmp" }, - { CONTENT_TYPE_STR_X_CNT_IMAPFOLDER, CONTENT_TYPE_X_CNT_IMAPFOLDER, - "tmp" }, - { CONTENT_TYPE_STR_X_CNT_MESSAGE, CONTENT_TYPE_X_CNT_MESSAGE, "tmp" }, - { CONTENT_TYPE_STR_X_CNT_NEWSBOX, CONTENT_TYPE_X_CNT_NEWSBOX, "tmp" }, - { CONTENT_TYPE_STR_X_CNT_NEWSGROUP, CONTENT_TYPE_X_CNT_NEWSGROUP, - "tmp" }, - { CONTENT_TYPE_STR_X_CNT_OUTBOX, CONTENT_TYPE_X_CNT_OUTBOX, "tmp" }, - { CONTENT_TYPE_STR_X_CNT_POP3BOX, CONTENT_TYPE_X_CNT_POP3BOX, "tmp" }, - { CONTENT_TYPE_STR_X_CNT_PUBLISHBOX, CONTENT_TYPE_X_CNT_PUBLISHBOX, - "tmp" }, - { CONTENT_TYPE_STR_X_CNT_SEARCHBOX, CONTENT_TYPE_X_CNT_SEARCHBOX, - "tmp" }, - { CONTENT_TYPE_STR_X_CNT_SEPARATOR, CONTENT_TYPE_X_CNT_SEPARATOR, - "tmp" }, - { CONTENT_TYPE_STR_X_CNT_BOOKMARK, CONTENT_TYPE_X_CNT_BOOKMARK, - "tmp" }, - { CONTENT_TYPE_STR_X_CNT_SUBSCRIBEBOX, - CONTENT_TYPE_X_CNT_SUBSCRIBEBOX, "tmp" }, - { CONTENT_TYPE_STR_X_CNT_CDF, CONTENT_TYPE_X_CNT_CDF, "tmp" }, - { CONTENT_TYPE_STR_X_CNT_CDFITEM, CONTENT_TYPE_X_CNT_CDFITEM, "tmp" }, - { CONTENT_TYPE_STR_X_CNT_CDFSUB, CONTENT_TYPE_X_CNT_CDFSUB, "tmp" }, - { CONTENT_TYPE_STR_X_CNT_STARCHANNEL, CONTENT_TYPE_X_CNT_STARCHANNEL, - "tmp" }, - { CONTENT_TYPE_STR_X_CNT_TRASHBOX, CONTENT_TYPE_X_CNT_TRASHBOX, - "tmp" }, - { CONTENT_TYPE_STR_X_CNT_TRASH, CONTENT_TYPE_X_CNT_TRASH, "tmp" }, - { CONTENT_TYPE_STR_X_CNT_VIMBBOARD, CONTENT_TYPE_X_CNT_VIMBBOARD, - "tmp" }, - { CONTENT_TYPE_STR_X_CNT_VIMBBOARDBOX, - CONTENT_TYPE_X_CNT_VIMBBOARDBOX, "tmp" }, - { CONTENT_TYPE_STR_X_CNT_VIMBOX, CONTENT_TYPE_X_CNT_VIMBOX, "tmp" }, - { CONTENT_TYPE_STR_X_CNT_VIMINBOX, CONTENT_TYPE_X_CNT_VIMINBOX, - "tmp" }, - { CONTENT_TYPE_STR_APP_OCTSTREAM, CONTENT_TYPE_APP_OCTSTREAM, "tmp" }, - { CONTENT_TYPE_STR_APP_PDF, CONTENT_TYPE_APP_PDF, "pdf" }, - { CONTENT_TYPE_STR_APP_RTF, CONTENT_TYPE_APP_RTF, "rtf" }, - { CONTENT_TYPE_STR_APP_VND_CALC, CONTENT_TYPE_APP_VND_CALC, "sdc" }, - { CONTENT_TYPE_STR_APP_VND_CHART, CONTENT_TYPE_APP_VND_CHART, "sds" }, - { CONTENT_TYPE_STR_APP_VND_DRAW, CONTENT_TYPE_APP_VND_DRAW, "sda" }, - { CONTENT_TYPE_STR_APP_VND_IMAGE, CONTENT_TYPE_APP_VND_IMAGE, "sim" }, - { CONTENT_TYPE_STR_APP_VND_IMPRESS, CONTENT_TYPE_APP_VND_IMPRESS, - "sdd" }, - { CONTENT_TYPE_STR_APP_VND_IMPRESSPACKED, - CONTENT_TYPE_APP_VND_IMPRESSPACKED, "sdp" }, - { CONTENT_TYPE_STR_APP_VND_MAIL, CONTENT_TYPE_APP_VND_MAIL, "sdm" }, - { CONTENT_TYPE_STR_APP_VND_MATH, CONTENT_TYPE_APP_VND_MATH, "smf" }, - { CONTENT_TYPE_STR_APP_VND_NEWS, CONTENT_TYPE_APP_VND_NEWS, "sdm" }, - { CONTENT_TYPE_STR_APP_VND_OUTTRAY, CONTENT_TYPE_APP_VND_OUTTRAY, - "sdm" }, - { CONTENT_TYPE_STR_APP_VND_TEMPLATE, CONTENT_TYPE_APP_VND_TEMPLATE, - "vor" }, - { CONTENT_TYPE_STR_APP_VND_WRITER, CONTENT_TYPE_APP_VND_WRITER, - "sdw" }, - { CONTENT_TYPE_STR_APP_VND_WRITER_GLOBAL, - CONTENT_TYPE_APP_VND_WRITER_GLOBAL, "sgl" }, - { CONTENT_TYPE_STR_APP_VND_WRITER_WEB, - CONTENT_TYPE_APP_VND_WRITER_WEB, "htm" }, - { CONTENT_TYPE_STR_APP_VND_SUN_XML_CALC, CONTENT_TYPE_APP_VND_SUN_XML_CALC, "sxc" }, - { CONTENT_TYPE_STR_APP_VND_SUN_XML_CHART, CONTENT_TYPE_APP_VND_SUN_XML_CHART, "sxs" }, - { CONTENT_TYPE_STR_APP_VND_SUN_XML_DRAW, CONTENT_TYPE_APP_VND_SUN_XML_DRAW, "sxd" }, - { CONTENT_TYPE_STR_APP_VND_SUN_XML_IMPRESS, CONTENT_TYPE_APP_VND_SUN_XML_IMPRESS, "sxi" }, - { CONTENT_TYPE_STR_APP_VND_SUN_XML_IMPRESSPACKED, CONTENT_TYPE_APP_VND_SUN_XML_IMPRESSPACKED, "sxp" }, - { CONTENT_TYPE_STR_APP_VND_SUN_XML_MATH, CONTENT_TYPE_APP_VND_SUN_XML_MATH, "sxm" }, - { CONTENT_TYPE_STR_APP_VND_SUN_XML_WRITER, CONTENT_TYPE_APP_VND_SUN_XML_WRITER, "sxw" }, - { CONTENT_TYPE_STR_APP_VND_SUN_XML_WRITER_GLOBAL, CONTENT_TYPE_APP_VND_SUN_XML_WRITER_GLOBAL, "sxg" }, - { CONTENT_TYPE_STR_APP_FRAMESET, CONTENT_TYPE_APP_FRAMESET, "sfs" }, - { CONTENT_TYPE_STR_APP_GALLERY, CONTENT_TYPE_APP_GALLERY, "gal" }, - { CONTENT_TYPE_STR_APP_GALLERY_THEME, CONTENT_TYPE_APP_GALLERY_THEME, - "thm" }, - { CONTENT_TYPE_STR_APP_JAR, CONTENT_TYPE_APP_JAR, "jar" }, - { CONTENT_TYPE_STR_APP_MACRO, CONTENT_TYPE_APP_MACRO, "tmp" }, - { CONTENT_TYPE_STR_APP_MSEXCEL, CONTENT_TYPE_APP_MSEXCEL, "xls" }, - { CONTENT_TYPE_STR_APP_MSEXCEL_TEMPL, CONTENT_TYPE_APP_MSEXCEL_TEMPL, - "xlt" }, - { CONTENT_TYPE_STR_APP_MSPPOINT, CONTENT_TYPE_APP_MSPPOINT, "ppt" }, - { CONTENT_TYPE_STR_APP_MSPPOINT_TEMPL, - CONTENT_TYPE_APP_MSPPOINT_TEMPL, "pot" }, - { CONTENT_TYPE_STR_APP_MSWORD, CONTENT_TYPE_APP_MSWORD, "doc" }, - { CONTENT_TYPE_STR_APP_MSWORD_TEMPL, CONTENT_TYPE_APP_MSWORD_TEMPL, - "dot" }, - { CONTENT_TYPE_STR_APP_SCHEDULE_CMB, CONTENT_TYPE_APP_SCHEDULE, - "tmp" }, - { CONTENT_TYPE_STR_APP_SCHEDULE_EVT, CONTENT_TYPE_APP_SCHEDULE_EVT, - "tmp" }, - { CONTENT_TYPE_STR_APP_SCHEDULE_FEVT, - CONTENT_TYPE_APP_SCHEDULE_FORM_EVT, "tmp" }, - { CONTENT_TYPE_STR_APP_SCHEDULE_FTASK, - CONTENT_TYPE_APP_SCHEDULE_FORM_TASK, "tmp" }, - { CONTENT_TYPE_STR_APP_SCHEDULE_TASK, CONTENT_TYPE_APP_SCHEDULE_TASK, - "tmp" }, - { CONTENT_TYPE_STR_APP_STARCALC, CONTENT_TYPE_APP_STARCALC, "sdc" }, - { CONTENT_TYPE_STR_APP_STARCHART, CONTENT_TYPE_APP_STARCHART, "sds" }, - { CONTENT_TYPE_STR_APP_STARDRAW, CONTENT_TYPE_APP_STARDRAW, "sda" }, - { CONTENT_TYPE_STR_APP_STARHELP, CONTENT_TYPE_APP_STARHELP, "svh" }, - { CONTENT_TYPE_STR_APP_STARIMAGE, CONTENT_TYPE_APP_STARIMAGE, "sim" }, - { CONTENT_TYPE_STR_APP_STARIMPRESS, CONTENT_TYPE_APP_STARIMPRESS, - "sdd" }, - { CONTENT_TYPE_STR_APP_STARMAIL_SDM, CONTENT_TYPE_APP_STARMAIL_SDM, - "sdm" }, - { CONTENT_TYPE_STR_APP_STARMAIL_SMD, CONTENT_TYPE_APP_STARMAIL_SMD, - "smd" }, - { CONTENT_TYPE_STR_APP_STARMATH, CONTENT_TYPE_APP_STARMATH, "smf" }, - { CONTENT_TYPE_STR_APP_STARWRITER, CONTENT_TYPE_APP_STARWRITER, - "sdw" }, - { CONTENT_TYPE_STR_APP_STARWRITER_GLOB, - CONTENT_TYPE_APP_STARWRITER_GLOB, "sgl" }, - { CONTENT_TYPE_STR_APP_CDE_CALENDAR_APP, - CONTENT_TYPE_APP_CDE_CALENDAR_APP, "appt" }, - { CONTENT_TYPE_STR_APP_ZIP, CONTENT_TYPE_APP_ZIP, "zip" }, - { CONTENT_TYPE_STR_AUDIO_AIFF, CONTENT_TYPE_AUDIO_AIFF, "aif" }, - { CONTENT_TYPE_STR_AUDIO_BASIC, CONTENT_TYPE_AUDIO_BASIC, "au" }, - { CONTENT_TYPE_STR_AUDIO_MIDI, CONTENT_TYPE_AUDIO_MIDI, "mid" }, - { CONTENT_TYPE_STR_AUDIO_WAV, CONTENT_TYPE_AUDIO_WAV, "wav" }, - { CONTENT_TYPE_STR_IMAGE_GENERIC, CONTENT_TYPE_IMAGE_GENERIC, "tmp" }, - { CONTENT_TYPE_STR_IMAGE_GIF, CONTENT_TYPE_IMAGE_GIF, "gif" }, - { CONTENT_TYPE_STR_IMAGE_JPEG, CONTENT_TYPE_IMAGE_JPEG, "jpg" }, - { CONTENT_TYPE_STR_IMAGE_PCX, CONTENT_TYPE_IMAGE_PCX, "pcx" }, - { CONTENT_TYPE_STR_IMAGE_PNG, CONTENT_TYPE_IMAGE_PNG, "png" }, - { CONTENT_TYPE_STR_IMAGE_TIFF, CONTENT_TYPE_IMAGE_TIFF, "tif" }, - { CONTENT_TYPE_STR_IMAGE_BMP, CONTENT_TYPE_IMAGE_BMP, "bmp" }, - { CONTENT_TYPE_STR_INET_MSG_RFC822, CONTENT_TYPE_INET_MESSAGE_RFC822, - "tmp" }, - { CONTENT_TYPE_STR_INET_MULTI_ALTERNATIVE, - CONTENT_TYPE_INET_MULTIPART_ALTERNATIVE, "tmp" }, - { CONTENT_TYPE_STR_INET_MULTI_DIGEST, - CONTENT_TYPE_INET_MULTIPART_DIGEST, "tmp" }, - { CONTENT_TYPE_STR_INET_MULTI_MIXED, - CONTENT_TYPE_INET_MULTIPART_MIXED, "tmp" }, - { CONTENT_TYPE_STR_INET_MULTI_PARALLEL, - CONTENT_TYPE_INET_MULTIPART_PARALLEL, "tmp" }, - { CONTENT_TYPE_STR_INET_MULTI_RELATED, - CONTENT_TYPE_INET_MULTIPART_RELATED, "tmp" }, - { CONTENT_TYPE_STR_TEXT_ICALENDAR, CONTENT_TYPE_TEXT_ICALENDAR, - "ics" }, - { CONTENT_TYPE_STR_TEXT_HTML, CONTENT_TYPE_TEXT_HTML, "htm" }, - { CONTENT_TYPE_STR_TEXT_PLAIN, CONTENT_TYPE_TEXT_PLAIN, "txt" }, - { CONTENT_TYPE_STR_TEXT_XMLICALENDAR, CONTENT_TYPE_TEXT_XMLICALENDAR, - "xcs" }, - { CONTENT_TYPE_STR_TEXT_URL, CONTENT_TYPE_TEXT_URL, "url" }, - { CONTENT_TYPE_STR_TEXT_VCALENDAR, CONTENT_TYPE_TEXT_VCALENDAR, - "vcs" }, - { CONTENT_TYPE_STR_TEXT_VCARD, CONTENT_TYPE_TEXT_VCARD, "vcf" }, - { CONTENT_TYPE_STR_VIDEO_VDO, CONTENT_TYPE_VIDEO_VDO, "vdo" }, - { CONTENT_TYPE_STR_VIDEO_MSVIDEO, CONTENT_TYPE_VIDEO_MSVIDEO, "avi" }, - { CONTENT_TYPE_STR_X_STARMAIL, CONTENT_TYPE_X_STARMAIL, "smd" }, - { CONTENT_TYPE_STR_X_VRML, CONTENT_TYPE_X_VRML, "wrl" } -}; - -//============================================================================ -/** A mapping from type IDs to presentation resource IDs. Sorted by type ID. - */ -USHORT const aStaticResourceIDMap[CONTENT_TYPE_LAST + 1] - = { STR_SVT_MIMETYPE_APP_OCTSTREAM, // CONTENT_TYPE_UNKNOWN - STR_SVT_MIMETYPE_APP_OCTSTREAM, // CONTENT_TYPE_APP_OCTSTREAM - STR_SVT_MIMETYPE_APP_PDF, // CONTENT_TYPE_APP_PDF - STR_SVT_MIMETYPE_APP_RTF, // CONTENT_TYPE_APP_RTF - STR_SVT_MIMETYPE_APP_MSWORD, // CONTENT_TYPE_APP_MSWORD - STR_SVT_MIMETYPE_APP_MSWORD, // CONTENT_TYPE_APP_MSWORD_TEMPL //@todo new presentation string? - STR_SVT_MIMETYPE_APP_STARCALC, // CONTENT_TYPE_APP_STARCALC - STR_SVT_MIMETYPE_APP_STARCHART, // CONTENT_TYPE_APP_STARCHART - STR_SVT_MIMETYPE_APP_STARDRAW, // CONTENT_TYPE_APP_STARDRAW - STR_SVT_MIMETYPE_APP_STARHELP, // CONTENT_TYPE_APP_STARHELP - STR_SVT_MIMETYPE_APP_STARIMAGE, // CONTENT_TYPE_APP_STARIMAGE - STR_SVT_MIMETYPE_APP_STARIMPRESS, // CONTENT_TYPE_APP_STARIMPRESS - STR_SVT_MIMETYPE_APP_STARMATH, // CONTENT_TYPE_APP_STARMATH - STR_SVT_MIMETYPE_APP_STARWRITER, // CONTENT_TYPE_APP_STARWRITER - STR_SVT_MIMETYPE_APP_ZIP, // CONTENT_TYPE_APP_ZIP - STR_SVT_MIMETYPE_AUDIO_AIFF, // CONTENT_TYPE_AUDIO_AIFF - STR_SVT_MIMETYPE_AUDIO_BASIC, // CONTENT_TYPE_AUDIO_BASIC - STR_SVT_MIMETYPE_AUDIO_MIDI, // CONTENT_TYPE_AUDIO_MIDI - STR_SVT_MIMETYPE_AUDIO_WAV, // CONTENT_TYPE_AUDIO_WAV - STR_SVT_MIMETYPE_IMAGE_GIF, // CONTENT_TYPE_IMAGE_GIF - STR_SVT_MIMETYPE_IMAGE_JPEG, // CONTENT_TYPE_IMAGE_JPEG - STR_SVT_MIMETYPE_IMAGE_PCX, // CONTENT_TYPE_IMAGE_PCX - STR_SVT_MIMETYPE_IMAGE_PNG, // CONTENT_TYPE_IMAGE_PNG - STR_SVT_MIMETYPE_IMAGE_TIFF, // CONTENT_TYPE_IMAGE_TIFF - STR_SVT_MIMETYPE_IMAGE_BMP, // CONTENT_TYPE_IMAGE_BMP - STR_SVT_MIMETYPE_TEXT_HTML, // CONTENT_TYPE_TEXT_HTML - STR_SVT_MIMETYPE_TEXT_PLAIN, // CONTENT_TYPE_TEXT_PLAIN - STR_SVT_MIMETYPE_TEXT_URL, // CONTENT_TYPE_TEXT_URL - STR_SVT_MIMETYPE_TEXT_VCARD, // CONTENT_TYPE_TEXT_VCARD - STR_SVT_MIMETYPE_VIDEO_VDO, // CONTENT_TYPE_VIDEO_VDO - STR_SVT_MIMETYPE_VIDEO_MSVIDEO, // CONTENT_TYPE_VIDEO_MSVIDEO - STR_SVT_MIMETYPE_CNT_MSG, // CONTENT_TYPE_X_CNT_MESSAGE - STR_SVT_MIMETYPE_CNT_DOCUMENT, // CONTENT_TYPE_X_CNT_DOCUMENT - STR_SVT_MIMETYPE_CNT_POP3BOX, // CONTENT_TYPE_X_CNT_POP3BOX - STR_SVT_MIMETYPE_CNT_IMAPBOX, // CONTENT_TYPE_X_CNT_IMAPBOX - STR_SVT_MIMETYPE_CNT_IMAPFLD, // CONTENT_TYPE_X_CNT_IMAPFOLDER - STR_SVT_MIMETYPE_CNT_VIMBOX, // CONTENT_TYPE_X_CNT_VIMBOX - STR_SVT_MIMETYPE_CNT_VIMINBOX, // CONTENT_TYPE_X_CNT_VIMINBOX - STR_SVT_MIMETYPE_CNT_BBBOX, // CONTENT_TYPE_X_CNT_VIMBBOARDBOX - STR_SVT_MIMETYPE_CNT_VIM_BB, // CONTENT_TYPE_X_CNT_VIMBBOARD - STR_SVT_MIMETYPE_CNT_NEWSBOX, // CONTENT_TYPE_X_CNT_NEWSBOX - STR_SVT_MIMETYPE_CNT_NEWSGRP, // CONTENT_TYPE_X_CNT_NEWSGROUP - STR_SVT_MIMETYPE_CNT_OUTBOX, // CONTENT_TYPE_X_CNT_OUTBOX - STR_SVT_MIMETYPE_CNT_FTPBOX, // CONTENT_TYPE_X_CNT_FTPBOX - STR_SVT_MIMETYPE_CNT_FTPFLD, // CONTENT_TYPE_X_CNT_FTPFOLDER - STR_SVT_MIMETYPE_CNT_FTPFILE, // CONTENT_TYPE_X_CNT_FTPFILE - STR_SVT_MIMETYPE_CNT_FTPLINK, // CONTENT_TYPE_X_CNT_FTPLINK - STR_SVT_MIMETYPE_CNT_HTTPBOX, // CONTENT_TYPE_X_CNT_HTTPBOX - STR_SVT_MIMETYPE_CNT_FSYSBOX, // CONTENT_TYPE_X_CNT_FSYSBOX - STR_SVT_MIMETYPE_CNT_FSYSFLD, // CONTENT_TYPE_X_CNT_FSYSFOLDER - STR_SVT_MIMETYPE_CNT_FSYSFILE, // CONTENT_TYPE_X_CNT_FSYSFILE - STR_SVT_MIMETYPE_CNT_FSYSURLFILE, // CONTENT_TYPE_X_CNT_FSYSURLFILE - STR_SVT_MIMETYPE_CNT_PUBLBOX, // CONTENT_TYPE_X_CNT_PUBLISHBOX - STR_SVT_MIMETYPE_CNT_SRCHBOX, // CONTENT_TYPE_X_CNT_SEARCHBOX - STR_SVT_MIMETYPE_CNT_SUBSCRBOX, // CONTENT_TYPE_X_CNT_SUBSCRIBEBOX - STR_SVT_MIMETYPE_CNT_BOOKMARK, // CONTENT_TYPE_X_CNT_BOOKMARK - STR_SVT_MIMETYPE_CNT_CDF, // CONTENT_TYPE_X_CNT_CDF - STR_SVT_MIMETYPE_CNT_CDFSUB, // CONTENT_TYPE_X_CNT_CDFSUB - STR_SVT_MIMETYPE_CNT_CDFITEM, // CONTENT_TYPE_X_CNT_CDFITEM - STR_SVT_MIMETYPE_CNT_TRASHBOX, // CONTENT_TYPE_X_CNT_TRASHBOX - STR_SVT_MIMETYPE_CNT_TRASH, // CONTENT_TYPE_X_CNT_TRASH - STR_SVT_MIMETYPE_X_STARMAIL, // CONTENT_TYPE_X_STARMAIL - STR_SVT_MIMETYPE_X_VRML, // CONTENT_TYPE_X_VRML - STR_SVT_MIMETYPE_CNT_REMOV_VOL, - // CONTENT_TYPE_X_CNT_REMOVEABLE_VOLUME - STR_SVT_MIMETYPE_CNT_FIX_VOL, // CONTENT_TYPE_X_CNT_FIXED_VOLUME - STR_SVT_MIMETYPE_CNT_REM_VOL, // CONTENT_TYPE_X_CNT_REMOTE_VOLUME - STR_SVT_MIMETYPE_CNT_RAM_VOL, // CONTENT_TYPE_X_CNT_RAM_VOLUME - STR_SVT_MIMETYPE_CNT_CDROM, // CONTENT_TYPE_X_CNT_CDROM_VOLUME - STR_SVT_MIMETYPE_CNT_DISK_35, // CONTENT_TYPE_X_CNT_DISK_35 - STR_SVT_MIMETYPE_CNT_DISK_525, // CONTENT_TYPE_X_CNT_DISK_525 - STR_SVT_MIMETYPE_CNT_TAPEDRIVE, // CONTENT_TYPE_X_CNT_TAPEDRIVE - STR_SVT_MIMETYPE_APP_GAL, // CONTENT_TYPE_APP_GALLERY - STR_SVT_MIMETYPE_APP_GAL_THEME, // CONTENT_TYPE_APP_GALLERY_THEME - STR_SVT_MIMETYPE_CNT_STARCHANNEL, // CONTENT_TYPE_X_CNT_STARCHANNEL - STR_SVT_MIMETYPE_CNT_SEPARATOR, // CONTENT_TYPE_X_CNT_SEPARATOR - STR_SVT_MIMETYPE_APP_STARW_GLOB, // CONTENT_TYPE_APP_STARWRITER_GLOB - STR_SVT_MIMETYPE_APP_SDM, // CONTENT_TYPE_APP_STARMAIL_SDM - STR_SVT_MIMETYPE_APP_SMD, // CONTENT_TYPE_APP_STARMAIL_SMD - STR_SVT_MIMETYPE_APP_STARCALC, // CONTENT_TYPE_APP_VND_CALC - STR_SVT_MIMETYPE_APP_STARCHART, // CONTENT_TYPE_APP_VND_CHART - STR_SVT_MIMETYPE_APP_STARDRAW, // CONTENT_TYPE_APP_VND_DRAW - STR_SVT_MIMETYPE_APP_STARIMAGE, // CONTENT_TYPE_APP_VND_IMAGE - STR_SVT_MIMETYPE_APP_STARIMPRESS, // CONTENT_TYPE_APP_VND_IMPRESS - STR_SVT_MIMETYPE_X_STARMAIL, // CONTENT_TYPE_APP_VND_MAIL - STR_SVT_MIMETYPE_APP_STARMATH, // CONTENT_TYPE_APP_VND_MATH - STR_SVT_MIMETYPE_APP_STARWRITER, // CONTENT_TYPE_APP_VND_WRITER - STR_SVT_MIMETYPE_APP_STARW_GLOB, // CONTENT_TYPE_APP_VND_WRITER_GLOBAL - STR_SVT_MIMETYPE_APP_STARW_WEB, // CONTENT_TYPE_APP_VND_WRITER_WEB - STR_SVT_MIMETYPE_SCHEDULE, // CONTENT_TYPE_APP_SCHEDULE - STR_SVT_MIMETYPE_SCHEDULE_EVT, // CONTENT_TYPE_APP_SCHEDULE_EVT - STR_SVT_MIMETYPE_SCHEDULE_TASK, // CONTENT_TYPE_APP_SCHEDULE_TASK - STR_SVT_MIMETYPE_SCHEDULE_FEVT, // CONTENT_TYPE_APP_SCHEDULE_FORM_EVT - STR_SVT_MIMETYPE_SCHEDULE_FTASK, - // CONTENT_TYPE_APP_SCHEDULE_FORM_TASK - STR_SVT_MIMETYPE_FRAMESET, // CONTENT_TYPE_APP_FRAMESET - STR_SVT_MIMETYPE_MACRO, // CONTENT_TYPE_APP_MACRO - STR_SVT_MIMETYPE_CNT_SFSYSFOLDER, - // CONTENT_TYPE_X_CNT_FSYSSPECIALFOLDER - STR_SVT_MIMETYPE_CNT_SFSYSFILE, // CONTENT_TYPE_X_CNT_FSYSSPECIALFILE - STR_SVT_MIMETYPE_APP_TEMPLATE, // CONTENT_TYPE_APP_VND_TEMPLATE - STR_SVT_MIMETYPE_IMAGE_GENERIC, // CONTENT_TYPE_IMAGE_GENERIC - STR_SVT_MIMETYPE_X_STARMAIL, // CONTENT_TYPE_APP_VND_NEWS - STR_SVT_MIMETYPE_X_STARMAIL, // CONTENT_TYPE_APP_VND_OUTTRAY - STR_SVT_MIMETYPE_TEXT_HTML, // CONTENT_TYPE_X_CNT_HTTPFILE - STR_SVT_MIMETYPE_APP_MSEXCEL, // CONTENT_TYPE_APP_MSEXCEL - STR_SVT_MIMETYPE_APP_MSEXCEL_TEMPL, // CONTENT_TYPE_APP_MSEXCEL_TEMPL - STR_SVT_MIMETYPE_APP_MSPPOINT, // CONTENT_TYPE_APP_MSPPOINT - STR_SVT_MIMETYPE_APP_MSPPOINT, // CONTENT_TYPE_APP_MSPPOINT_TEMPL //@todo new presentation string? - STR_SVT_MIMETYPE_TEXT_VCALENDAR, // CONTENT_TYPE_TEXT_VCALENDAR - STR_SVT_MIMETYPE_TEXT_ICALENDAR, // CONTENT_TYPE_TEXT_ICALENDAR - STR_SVT_MIMETYPE_TEXT_XMLICALENDAR, // CONTENT_TYPE_TEXT_XMLICALENDAR - STR_SVT_MIMETYPE_TEXT_CDE_CALENDAR_APP, - // CONTENT_TYPE_APP_CDE_CALENDAR_APP - STR_SVT_MIMETYPE_INET_MSG_RFC822, // CONTENT_TYPE_INET_MESSAGE_RFC822 - STR_SVT_MIMETYPE_INET_MULTI_ALTERNATIVE, - // CONTENT_TYPE_INET_MULTIPART_ALTERNATIVE - STR_SVT_MIMETYPE_INET_MULTI_DIGEST, - // CONTENT_TYPE_INET_MULTIPART_DIGEST - STR_SVT_MIMETYPE_INET_MULTI_PARALLEL, - // CONTENT_TYPE_INET_MULTIPART_PARALLEL - STR_SVT_MIMETYPE_INET_MULTI_RELATED, - // CONTENT_TYPE_INET_MULTIPART_RELATED - STR_SVT_MIMETYPE_INET_MULTI_MIXED, - // CONTENT_TYPE_INET_MULTIPART_MIXED - STR_SVT_MIMETYPE_APP_IMPRESSPACKED, - // CONTENT_TYPE_APP_VND_IMPRESSPACKED - STR_SVT_MIMETYPE_APP_JAR, // CONTENT_TYPE_APP_JAR - STR_SVT_MIMETYPE_APP_SXWRITER, // CONTENT_TYPE_APP_VND_SUN_XML_WRITER - STR_SVT_MIMETYPE_APP_SXCALC, // CONTENT_TYPE_APP_VND_SUN_XML_CALC - STR_SVT_MIMETYPE_APP_SXIMPRESS, // CONTENT_TYPE_APP_VND_SUN_XML_IMPRESS - STR_SVT_MIMETYPE_APP_SXDRAW, // CONTENT_TYPE_APP_VND_SUN_XML_DRAW - STR_SVT_MIMETYPE_APP_SXCHART, // CONTENT_TYPE_APP_VND_SUN_XML_CHART - STR_SVT_MIMETYPE_APP_SXMATH, // CONTENT_TYPE_APP_VND_SUN_XML_MATH - STR_SVT_MIMETYPE_APP_SXGLOBAL, // CONTENT_TYPE_APP_VND_SUN_XML_WRITER_GLOBAL - STR_SVT_MIMETYPE_APP_SXIPACKED, // CONTENT_TYPE_APP_VND_SUN_XML_IMPRESSPACKED - }; - -//============================================================================ -/** A mapping from extensions to type IDs. Sorted by extension. - */ -MediaTypeEntry const aStaticExtensionMap[] - = { { "aif", CONTENT_TYPE_AUDIO_AIFF, "" }, - { "aiff", CONTENT_TYPE_AUDIO_AIFF, "" }, - { "appt", CONTENT_TYPE_APP_CDE_CALENDAR_APP, "" }, - { "au", CONTENT_TYPE_AUDIO_BASIC, "" }, - { "avi", CONTENT_TYPE_VIDEO_MSVIDEO, "" }, - { "bmp", CONTENT_TYPE_IMAGE_BMP, "" }, - { "cgm", CONTENT_TYPE_IMAGE_GENERIC, "" }, - { "doc", CONTENT_TYPE_APP_MSWORD, "" }, - { "dot", CONTENT_TYPE_APP_MSWORD_TEMPL, "" }, - { "dxf", CONTENT_TYPE_IMAGE_GENERIC, "" }, - { "eps", CONTENT_TYPE_IMAGE_GENERIC, "" }, - { "gal", CONTENT_TYPE_APP_GALLERY, "" }, - { "gif", CONTENT_TYPE_IMAGE_GIF, "" }, - { "htm", CONTENT_TYPE_TEXT_HTML, "" }, - { "html", CONTENT_TYPE_TEXT_HTML, "" }, - { "ics", CONTENT_TYPE_TEXT_ICALENDAR, "" }, - { "jar", CONTENT_TYPE_APP_JAR, "" }, - { "jpeg", CONTENT_TYPE_IMAGE_JPEG, "" }, - { "jpg", CONTENT_TYPE_IMAGE_JPEG, "" }, - { "met", CONTENT_TYPE_IMAGE_GENERIC, "" }, - { "mid", CONTENT_TYPE_AUDIO_MIDI, "" }, - { "midi", CONTENT_TYPE_AUDIO_MIDI, "" }, - { "pbm", CONTENT_TYPE_IMAGE_GENERIC, "" }, - { "pcd", CONTENT_TYPE_IMAGE_GENERIC, "" }, - { "pct", CONTENT_TYPE_IMAGE_GENERIC, "" }, - { "pcx", CONTENT_TYPE_IMAGE_PCX, "" }, - { "pdf", CONTENT_TYPE_APP_PDF, "" }, - { "pgm", CONTENT_TYPE_IMAGE_GENERIC, "" }, - { "png", CONTENT_TYPE_IMAGE_PNG, "" }, - { "pot", CONTENT_TYPE_APP_MSPPOINT_TEMPL, "" }, - { "ppm", CONTENT_TYPE_IMAGE_GENERIC, "" }, - { "ppt", CONTENT_TYPE_APP_MSPPOINT, "" }, - { "psd", CONTENT_TYPE_IMAGE_GENERIC, "" }, - { "ras", CONTENT_TYPE_IMAGE_GENERIC, "" }, - { "rtf", CONTENT_TYPE_APP_RTF, "" }, - { "sda", CONTENT_TYPE_APP_VND_DRAW, "" }, - { "sdc", CONTENT_TYPE_APP_VND_CALC, "" }, - { "sdd", CONTENT_TYPE_APP_VND_IMPRESS, "" }, - { "sdm", CONTENT_TYPE_APP_VND_MAIL, "" }, - { "sdp", CONTENT_TYPE_APP_VND_IMPRESSPACKED, "" }, - { "sds", CONTENT_TYPE_APP_VND_CHART, "" }, - { "sdw", CONTENT_TYPE_APP_VND_WRITER, "" }, - { "sd~", CONTENT_TYPE_X_STARMAIL, "" }, - { "sfs", CONTENT_TYPE_APP_FRAMESET , "" }, - { "sgl", CONTENT_TYPE_APP_VND_WRITER_GLOBAL , "" }, - { "sim", CONTENT_TYPE_APP_VND_IMAGE, "" }, - { "smd", CONTENT_TYPE_APP_STARMAIL_SMD, "" }, //CONTENT_TYPE_X_STARMAIL - { "smf", CONTENT_TYPE_APP_VND_MATH, "" }, - { "svh", CONTENT_TYPE_APP_STARHELP, "" }, - { "svm", CONTENT_TYPE_IMAGE_GENERIC, "" }, - { "sxc", CONTENT_TYPE_APP_VND_SUN_XML_CALC, "" }, - { "sxd", CONTENT_TYPE_APP_VND_SUN_XML_DRAW, "" }, - { "sxg", CONTENT_TYPE_APP_VND_SUN_XML_WRITER_GLOBAL, "" }, - { "sxi", CONTENT_TYPE_APP_VND_SUN_XML_IMPRESS, "" }, - { "sxm", CONTENT_TYPE_APP_VND_SUN_XML_MATH, "" }, - { "sxp", CONTENT_TYPE_APP_VND_SUN_XML_IMPRESSPACKED, "" }, - { "sxs", CONTENT_TYPE_APP_VND_SUN_XML_CHART, "" }, - { "sxw", CONTENT_TYPE_APP_VND_SUN_XML_WRITER, "" }, - { "tga", CONTENT_TYPE_IMAGE_GENERIC, "" }, - { "thm", CONTENT_TYPE_APP_GALLERY_THEME, "" }, - { "tif", CONTENT_TYPE_IMAGE_TIFF, "" }, - { "tiff", CONTENT_TYPE_IMAGE_TIFF, "" }, - { "txt", CONTENT_TYPE_TEXT_PLAIN, "" }, - { "url", CONTENT_TYPE_TEXT_URL, "" }, - { "vcf", CONTENT_TYPE_TEXT_VCARD, "" }, - { "vcs", CONTENT_TYPE_TEXT_VCALENDAR, "" }, - { "vdo", CONTENT_TYPE_VIDEO_VDO, "" }, - { "vor", CONTENT_TYPE_APP_VND_TEMPLATE, "" }, - { "wav", CONTENT_TYPE_AUDIO_WAV, "" }, - { "wmf", CONTENT_TYPE_IMAGE_GENERIC, "" }, - { "wrl", CONTENT_TYPE_X_VRML, "" }, - { "xbm", CONTENT_TYPE_IMAGE_GENERIC, "" }, - { "xcs", CONTENT_TYPE_TEXT_XMLICALENDAR, "" }, - { "xls", CONTENT_TYPE_APP_MSEXCEL, "" }, - { "xlt", CONTENT_TYPE_APP_MSEXCEL_TEMPL, "" }, - { "xlw", CONTENT_TYPE_APP_MSEXCEL, "" }, - { "xpm", CONTENT_TYPE_IMAGE_GENERIC, "" }, - { "zip", CONTENT_TYPE_APP_ZIP, "" } }; - -//============================================================================ -/** A mapping from presentations to type IDs. Sorted by presentations. - */ -MediaTypeEntry const aStaticPresentationMap[] - = { { "Binary Data", CONTENT_TYPE_APP_OCTSTREAM, "" }, - { "Bitmap", CONTENT_TYPE_IMAGE_BMP, "" }, - { "DOS Command File", CONTENT_TYPE_APP_OCTSTREAM, "" }, - { "Digital Video", CONTENT_TYPE_VIDEO_MSVIDEO, "" }, - { "Executable", CONTENT_TYPE_APP_OCTSTREAM, "" }, - { "Grafik", CONTENT_TYPE_IMAGE_GENERIC, "" }, - { "HTM", CONTENT_TYPE_TEXT_HTML, "" }, - { "HTML", CONTENT_TYPE_TEXT_HTML, "" }, - { "Hypertext", CONTENT_TYPE_TEXT_HTML, "" }, - { "Icon", CONTENT_TYPE_IMAGE_GENERIC, "" }, - { "Image File", CONTENT_TYPE_IMAGE_GENERIC, "" }, - { "MIDI", CONTENT_TYPE_AUDIO_MIDI, "" }, - { "Master Document", CONTENT_TYPE_APP_VND_WRITER_GLOBAL, "" }, - { "Plain Text", CONTENT_TYPE_TEXT_PLAIN, "" }, - { "StarCalc", CONTENT_TYPE_APP_VND_CALC, "" }, - { "StarCalc 3.0", CONTENT_TYPE_APP_VND_CALC, "" }, - { "StarCalc 4.0", CONTENT_TYPE_APP_VND_CALC, "" }, - { "StarCalc 5.0", CONTENT_TYPE_APP_VND_CALC, "" }, - { "StarCalc Datei", CONTENT_TYPE_APP_VND_CALC, "" }, - { "StarCalc Document", CONTENT_TYPE_APP_VND_CALC, "" }, - { "StarCalc File", CONTENT_TYPE_APP_VND_CALC, "" }, - { "StarChart 3.0", CONTENT_TYPE_APP_VND_CHART, "" }, - { "StarChart 4.0", CONTENT_TYPE_APP_VND_CHART, "" }, - { "StarChart 5.0", CONTENT_TYPE_APP_VND_CHART, "" }, - { "StarChart Document", CONTENT_TYPE_APP_VND_CHART, "" }, - { "StarDraw 3.0", CONTENT_TYPE_APP_VND_DRAW, "" }, - { "StarDraw 5.0", CONTENT_TYPE_APP_VND_DRAW, "" }, - { "StarDraw", CONTENT_TYPE_APP_VND_DRAW, "" }, - { "StarDraw Document", CONTENT_TYPE_APP_VND_DRAW, "" }, - { "StarImpress 4.0", CONTENT_TYPE_APP_VND_IMPRESS, "" }, - { "StarImpress 5.0 (packed)", CONTENT_TYPE_APP_VND_IMPRESSPACKED, "" }, - { "StarImpress 5.0", CONTENT_TYPE_APP_VND_IMPRESS, "" }, - { "StarImpress Document", CONTENT_TYPE_APP_VND_IMPRESS, "" }, - { "StarMath 3.0", CONTENT_TYPE_APP_VND_MATH, "" }, - { "StarMath 4.0", CONTENT_TYPE_APP_VND_MATH, "" }, - { "StarMath 5.0", CONTENT_TYPE_APP_VND_MATH, "" }, - { "StarMath Document", CONTENT_TYPE_APP_VND_MATH, "" }, - { "StarMessage5", CONTENT_TYPE_APP_VND_MAIL, "" }, - { "StarOffice XML (Calc)", CONTENT_TYPE_APP_VND_SUN_XML_CALC, "" }, - { "StarOffice XML (Impress)", CONTENT_TYPE_APP_VND_SUN_XML_IMPRESS, "" }, - { "StarOffice XML (Draw)", CONTENT_TYPE_APP_VND_SUN_XML_DRAW, "" }, - { "StarOffice XML (Chart)", CONTENT_TYPE_APP_VND_SUN_XML_CHART, "" }, - { "StarOffice XML (Writer)", CONTENT_TYPE_APP_VND_SUN_XML_WRITER, "" }, - { "StarWriter", CONTENT_TYPE_APP_VND_WRITER, "" }, - { "StarWriter 3.0", CONTENT_TYPE_APP_VND_WRITER, "" }, - { "StarWriter 4.0", CONTENT_TYPE_APP_VND_WRITER, "" }, - { "StarWriter 5.0", CONTENT_TYPE_APP_VND_WRITER, "" }, - { "StarWriter Document", CONTENT_TYPE_APP_VND_WRITER, "" }, - { "StarWriter/Global 5.0", CONTENT_TYPE_APP_VND_WRITER_GLOBAL, "" }, - { "StarWriter/Global Document", CONTENT_TYPE_APP_VND_WRITER_GLOBAL, "" }, - { "StarWriter/Web 5.0", CONTENT_TYPE_APP_VND_WRITER_WEB, "" }, - { "StarWriterGlobal Document", CONTENT_TYPE_APP_VND_WRITER_GLOBAL, "" }, - { "StarWriterHtml Document", CONTENT_TYPE_APP_VND_WRITER_WEB, "" }, - { "UniformResourceLocator", CONTENT_TYPE_TEXT_URL, "" }, - { "text/html", CONTENT_TYPE_TEXT_HTML, "" } }; - -} - -//============================================================================ -// -// Registration -// -//============================================================================ - -// static -Registration * Registration::m_pRegistration = 0; - -//============================================================================ -Registration::~Registration() -{ - {for (ULONG i = 0; i < m_aTypeIDMap.Count(); ++i) - delete static_cast< TypeIDMapEntry * >(m_aTypeIDMap.GetObject(i)); - } - m_aTypeIDMap.Clear(); - {for (USHORT i = 0; i < m_aTypeNameMap.Count(); ++i) - delete static_cast< TypeNameMapEntry * >(m_aTypeNameMap.GetObject(i)); - } - m_aTypeNameMap.Remove(USHORT(0), m_aTypeNameMap.Count()); - {for (USHORT i = 0; i < m_aExtensionMap.Count(); ++i) - delete - static_cast< ExtensionMapEntry * >(m_aExtensionMap.GetObject(i)); - } - m_aExtensionMap.Remove(USHORT(0), m_aExtensionMap.Count()); -} - -//============================================================================ -// static -TypeNameMapEntry * Registration::getExtensionEntry(UniString const & - rTypeName) -{ - if (m_pRegistration) - { - UniString aTheTypeName = rTypeName; - aTheTypeName.ToLowerAscii(); - USHORT nPos; - if (m_pRegistration->m_aTypeNameMap.Seek_Entry(&aTheTypeName, &nPos)) - return static_cast< TypeNameMapEntry * >(m_pRegistration-> - m_aTypeNameMap. - GetObject(nPos)); - } - return 0; -} - -//============================================================================ -// static -INetContentType Registration::RegisterContentType(UniString const & rTypeName, - UniString const & - rPresentation, - UniString const * - pExtension, - UniString const * - pSystemFileType) -{ - if (!m_pRegistration) - m_pRegistration = new Registration; - - DBG_ASSERT(GetContentType(rTypeName) == CONTENT_TYPE_UNKNOWN, - "Registration::RegisterContentType(): Already registered"); - - INetContentType eTypeID - = INetContentType(m_pRegistration->m_nNextDynamicID++); - UniString aTheTypeName = rTypeName; - aTheTypeName.ToLowerAscii(); - - TypeIDMapEntry * pTypeIDMapEntry = new TypeIDMapEntry; - pTypeIDMapEntry->m_aTypeName = aTheTypeName; - pTypeIDMapEntry->m_aPresentation = rPresentation; - if (pSystemFileType) - pTypeIDMapEntry->m_aSystemFileType = *pSystemFileType; - m_pRegistration->m_aTypeIDMap.Insert(eTypeID, pTypeIDMapEntry); - - TypeNameMapEntry * pTypeNameMapEntry = new TypeNameMapEntry(aTheTypeName); - if (pExtension) - pTypeNameMapEntry->m_aExtension = *pExtension; - pTypeNameMapEntry->m_eTypeID = eTypeID; - m_pRegistration->m_aTypeNameMap.Insert(pTypeNameMapEntry); - - if (pExtension) - { - ExtensionMapEntry * pExtensionMapEntry - = new ExtensionMapEntry(*pExtension); - pExtensionMapEntry->m_eTypeID = eTypeID; - m_pRegistration->m_aExtensionMap.Insert(pExtensionMapEntry); - } - - return eTypeID; -} - -//============================================================================ -// static -INetContentType Registration::GetContentType(UniString const & rTypeName) -{ - if (!m_pRegistration) - m_pRegistration = new Registration; - - UniString aTheTypeName = rTypeName; - aTheTypeName.ToLowerAscii(); - USHORT nPos; - return m_pRegistration->m_aTypeNameMap.Seek_Entry(&aTheTypeName, &nPos) ? - static_cast< TypeNameMapEntry * >(m_pRegistration-> - m_aTypeNameMap. - GetObject(nPos))-> - m_eTypeID : - CONTENT_TYPE_UNKNOWN; -} - -//============================================================================ -// static -UniString Registration::GetContentType(INetContentType eTypeID) -{ - if (!m_pRegistration) - m_pRegistration = new Registration; - - TypeIDMapEntry * pEntry - = static_cast< TypeIDMapEntry * >(m_pRegistration-> - m_aTypeIDMap.Get(eTypeID)); - return pEntry ? pEntry->m_aTypeName : UniString(); -} - -//============================================================================ -// static -UniString Registration::GetPresentation(INetContentType eTypeID) -{ - if (!m_pRegistration) - m_pRegistration = new Registration; - - TypeIDMapEntry * pEntry - = static_cast< TypeIDMapEntry * >(m_pRegistration-> - m_aTypeIDMap.Get(eTypeID)); - return pEntry ? pEntry->m_aPresentation : UniString(); -} - -//============================================================================ -// static -UniString Registration::GetExtension(UniString const & rTypeName) -{ - if (!m_pRegistration) - m_pRegistration = new Registration; - - UniString aTheTypeName = rTypeName; - aTheTypeName.ToLowerAscii(); - USHORT nPos; - return m_pRegistration->m_aTypeNameMap.Seek_Entry(&aTheTypeName, &nPos) ? - static_cast< TypeNameMapEntry * >(m_pRegistration-> - m_aTypeNameMap. - GetObject(nPos))-> - m_aExtension : - UniString(); -} - -//============================================================================ -// static -INetContentType Registration::GetContentType4Extension(UniString const & - rExtension) -{ - if (!m_pRegistration) - m_pRegistration = new Registration; - - USHORT nPos; - return m_pRegistration-> - m_aExtensionMap. - Seek_Entry(const_cast< UniString * >(&rExtension), - &nPos) ? - static_cast< ExtensionMapEntry * >(m_pRegistration-> - m_aExtensionMap. - GetObject(nPos))-> - m_eTypeID : - CONTENT_TYPE_UNKNOWN; -} - -//============================================================================ -// -// seekEntry -// -//============================================================================ - -namespace unnamed_svtools_inettype { - -MediaTypeEntry const * seekEntry(UniString const & rTypeName, - MediaTypeEntry const * pMap, sal_Size nSize) -{ -#if defined DBG_UTIL || defined INETTYPE_DEBUG - static bool bChecked = false; - if (!bChecked) - { - for (sal_Size i = 0; i < nSize - 1; ++i) - DBG_ASSERT(pMap[i].m_pTypeName < pMap[i + 1].m_pTypeName, - "seekEntry(): Bad map"); - bChecked = true; - } -#endif // DBG_UTIL, INETTYPE_DEBUG - - sal_Size nLow = 0; - sal_Size nHigh = nSize; - while (nLow != nHigh) - { - sal_Size nMiddle = (nLow + nHigh) / 2; - MediaTypeEntry const * pEntry = pMap + nMiddle; - switch (rTypeName.CompareIgnoreCaseToAscii(pEntry->m_pTypeName)) - { - case COMPARE_LESS: - nHigh = nMiddle; - break; - - case COMPARE_EQUAL: - return pEntry; - - case COMPARE_GREATER: - nLow = nMiddle + 1; - break; - } - } - return 0; -} - -} - -//============================================================================ -// -// INetContentTypes -// -//============================================================================ - -//static -void INetContentTypes::Uninitialize() -{ - Registration::deinitialize(); -} - -//============================================================================ -//static -INetContentType INetContentTypes::RegisterContentType(UniString const & - rTypeName, - UniString const & - rPresentation, - UniString const * - pExtension, - UniString const * - pSystemFileType) -{ - INetContentType eTypeID = GetContentType(rTypeName); - if (eTypeID == CONTENT_TYPE_UNKNOWN) - eTypeID = Registration::RegisterContentType(rTypeName, rPresentation, - pExtension, - pSystemFileType); - else if (eTypeID > CONTENT_TYPE_LAST) - { - TypeIDMapEntry * pTypeEntry = Registration::getEntry(eTypeID); - if (pTypeEntry) - { - if (rPresentation.Len() != 0) - pTypeEntry->m_aPresentation = rPresentation; - if (pSystemFileType) - pTypeEntry->m_aSystemFileType = *pSystemFileType; - } - if (pExtension) - { - TypeNameMapEntry * pEntry - = Registration::getExtensionEntry(rTypeName); - if (pEntry) - pEntry->m_aExtension = *pExtension; - } - } - return eTypeID; -} - -//============================================================================ -// static -INetContentType INetContentTypes::GetContentType(UniString const & rTypeName) -{ - UniString aType; - UniString aSubType; - if (parse(rTypeName, aType, aSubType)) - { - aType += '/'; - aType += aSubType; - MediaTypeEntry const * pEntry = seekEntry(aType, aStaticTypeNameMap, - CONTENT_TYPE_LAST + 1); - return pEntry ? pEntry->m_eTypeID : - Registration::GetContentType(aType); - } - else - return - rTypeName.EqualsIgnoreCaseAscii(CONTENT_TYPE_STR_X_STARMAIL) ? - CONTENT_TYPE_X_STARMAIL : CONTENT_TYPE_UNKNOWN; - // the content type "x-starmail" has no sub type -} - -//============================================================================ -//static -UniString INetContentTypes::GetContentType(INetContentType eTypeID) -{ - static sal_Char const * aMap[CONTENT_TYPE_LAST + 1]; - static bool bInitialized = false; - if (!bInitialized) - { - for (sal_Size i = 0; i <= CONTENT_TYPE_LAST; ++i) - aMap[aStaticTypeNameMap[i].m_eTypeID] - = aStaticTypeNameMap[i].m_pTypeName; - aMap[CONTENT_TYPE_UNKNOWN] = CONTENT_TYPE_STR_APP_OCTSTREAM; - aMap[CONTENT_TYPE_TEXT_PLAIN] = CONTENT_TYPE_STR_TEXT_PLAIN - "; charset=iso-8859-1"; - bInitialized = true; - } - - UniString aTypeName = eTypeID <= CONTENT_TYPE_LAST ? - UniString::CreateFromAscii(aMap[eTypeID]) : - Registration::GetContentType(eTypeID); - if (aTypeName.Len() == 0) - { - DBG_ERROR("INetContentTypes::GetContentType(): Bad ID"); - return - UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM( - CONTENT_TYPE_STR_APP_OCTSTREAM)); - } - return aTypeName; -} - -//============================================================================ -//static -UniString INetContentTypes::GetPresentation(INetContentType eTypeID, - const ::com::sun::star::lang::Locale& aLocale) -{ - USHORT nResID = USHORT(); - if (eTypeID <= CONTENT_TYPE_LAST) - nResID = aStaticResourceIDMap[eTypeID]; - else - { - UniString aPresentation = Registration::GetPresentation(eTypeID); - if (aPresentation.Len() == 0) - nResID = STR_SVT_MIMETYPE_APP_OCTSTREAM; - else - return aPresentation; - } - return SvtSimpleResId(nResID, aLocale); -} - -//============================================================================ -//static -UniString INetContentTypes::GetExtension(UniString const & rTypeName) -{ - MediaTypeEntry const * pEntry = seekEntry(rTypeName, aStaticTypeNameMap, - CONTENT_TYPE_LAST + 1); - if (pEntry) - return UniString::CreateFromAscii(pEntry->m_pExtension); - - UniString aExtension = Registration::GetExtension(rTypeName); - if (aExtension.Len() != 0) - return aExtension; - // special handling of text types, which come in uncounted variations: - return rTypeName.EqualsIgnoreCaseAscii("text", 0, - RTL_CONSTASCII_LENGTH("text")) ? - UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("txt")) : - UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("tmp")); -} - -//============================================================================ -//static -INetContentType INetContentTypes::GetContentType4Extension(UniString const & - rExtension) -{ - MediaTypeEntry const * pEntry = seekEntry(rExtension, aStaticExtensionMap, - sizeof aStaticExtensionMap - / sizeof (MediaTypeEntry)); - if (pEntry) - return pEntry->m_eTypeID; - INetContentType eTypeID - = Registration::GetContentType4Extension(rExtension); - return eTypeID == CONTENT_TYPE_UNKNOWN ? CONTENT_TYPE_APP_OCTSTREAM : - eTypeID; -} - -//============================================================================ -//static -INetContentType INetContentTypes::GetContentTypeFromURL(UniString const & - rURL) -{ - INetContentType eTypeID = CONTENT_TYPE_UNKNOWN; - UniString aToken = rURL.GetToken(0, ':'); - if (aToken.Len() != 0) - { - if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_FILE)) - if (rURL.GetChar(rURL.Len() - 1) == '/') // folder - if (rURL.Len() > RTL_CONSTASCII_LENGTH("file:///")) - if (WildCard(UniString(RTL_CONSTASCII_USTRINGPARAM( - "*/{*}/"))). - Matches(rURL)) // special folder - eTypeID = CONTENT_TYPE_X_CNT_FSYSSPECIALFOLDER; - else - // drive? -> "file:///?|/" - if (rURL.Len() == 11 - && rURL.GetChar(rURL.Len() - 2) == '|') - { - // Drives need further processing, because of - // dynamic type according to underlying volume, - // which cannot be determined here. - } - else // normal folder - eTypeID = CONTENT_TYPE_X_CNT_FSYSFOLDER; - else // file system root - eTypeID = CONTENT_TYPE_X_CNT_FSYSBOX; - else // file - { - //@@@ - } - else if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_HTTP) - || aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_HTTPS)) - eTypeID = CONTENT_TYPE_TEXT_HTML; - else if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_PRIVATE)) - { - UniString aSecondPart = rURL.GetToken(1, ':'); - aToken = aSecondPart.GetToken(0, '/'); - if (aToken.EqualsAscii(INETTYPE_URL_SUB_FACTORY)) - { - aToken = aSecondPart.GetToken(1, '/'); - if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SWRITER)) - { - aToken = aSecondPart.GetToken(2, '/'); - eTypeID = aToken.EqualsAscii(INETTYPE_URL_SSSUB_WEB) ? - CONTENT_TYPE_APP_VND_WRITER_WEB : - aToken.EqualsAscii(INETTYPE_URL_SSSUB_GLOB) ? - CONTENT_TYPE_APP_VND_WRITER_GLOBAL : - CONTENT_TYPE_APP_VND_WRITER; - } - else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SCALC)) - eTypeID = CONTENT_TYPE_APP_VND_CALC; - else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SDRAW)) - eTypeID = CONTENT_TYPE_APP_VND_DRAW; - else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SIMPRESS)) - eTypeID = CONTENT_TYPE_APP_VND_IMPRESS; - else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SCHART)) - eTypeID = CONTENT_TYPE_APP_VND_CHART; - else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SIMAGE)) - eTypeID = CONTENT_TYPE_APP_VND_IMAGE; - else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SMATH)) - eTypeID = CONTENT_TYPE_APP_VND_MATH; - else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_FRAMESET)) - eTypeID = CONTENT_TYPE_APP_FRAMESET; - } - else if (aToken.EqualsAscii(INETTYPE_URL_SUB_HELPID)) - eTypeID = CONTENT_TYPE_APP_STARHELP; - } - else if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_COMPONENT)) - { - aToken = rURL.GetToken(1, ':'); // aToken now equals ss / * - aToken = aToken.GetToken(0, '/'); - if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SS)) - eTypeID = rURL.SearchAscii(INETTYPE_URL_SCHED_CMB) - == STRING_NOTFOUND - && rURL.SearchAscii(INETTYPE_URL_SCHED_FORM) - == STRING_NOTFOUND ? - CONTENT_TYPE_APP_SCHEDULE : - rURL.SearchAscii(INETTYPE_URL_SCHED_TASK) - == STRING_NOTFOUND ? - CONTENT_TYPE_APP_SCHEDULE_EVT : - CONTENT_TYPE_APP_SCHEDULE_TASK; - } - else if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_MAILTO)) - eTypeID = CONTENT_TYPE_APP_VND_OUTTRAY; - else if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_MACRO)) - eTypeID = CONTENT_TYPE_APP_MACRO; - else if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_DATA)) - { - UniString aSecondPart = rURL.GetToken(1, ':'); - aToken = aSecondPart.GetToken(0, ','); - eTypeID = GetContentType(aToken); - } - } - if (eTypeID == CONTENT_TYPE_UNKNOWN) - { - UniString aExtension; - if (GetExtensionFromURL(rURL, aExtension)) - eTypeID = GetContentType4Extension(aExtension); - } - return eTypeID; -} - -//============================================================================ -//static -bool INetContentTypes::GetExtensionFromURL(UniString const & rURL, - UniString & rExtension) -{ - xub_StrLen nSlashPos = 0; - xub_StrLen i = 0; - while (i != STRING_NOTFOUND) - { - nSlashPos = i; - i = rURL.Search('/', i + 1); - } - if (nSlashPos != 0) - { - xub_StrLen nLastDotPos = i = rURL.Search('.', nSlashPos); - while (i != STRING_NOTFOUND) - { - nLastDotPos = i; - i = rURL.Search('.', i + 1); - } - if (nLastDotPos != STRING_NOTFOUND) - rExtension = rURL.Copy(nLastDotPos + 1); - return true; - } - return false; -} - -//============================================================================ -//static -INetContentType INetContentTypes::MapStringToContentType(UniString const & - rPresentation) -{ - MediaTypeEntry const * pEntry = seekEntry(rPresentation, - aStaticPresentationMap, - sizeof aStaticPresentationMap - / sizeof (MediaTypeEntry)); - return pEntry ? pEntry->m_eTypeID : CONTENT_TYPE_UNKNOWN; -} - -//============================================================================ -// static -bool INetContentTypes::parse(ByteString const & rMediaType, - ByteString & rType, ByteString & rSubType, - INetContentTypeParameterList * pParameters) -{ - sal_Char const * p = rMediaType.GetBuffer(); - sal_Char const * pEnd = p + rMediaType.Len(); - - p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); - sal_Char const * pToken = p; - bool bDowncase = false; - while (p != pEnd && INetMIME::isTokenChar(*p)) - { - bDowncase = bDowncase || INetMIME::isUpperCase(*p); - ++p; - } - if (p == pToken) - return false; - rType = ByteString(pToken, sal::static_int_cast< xub_StrLen >(p - pToken)); - if (bDowncase) - rType.ToLowerAscii(); - - p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); - if (p == pEnd || *p++ != '/') - return false; - - p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); - pToken = p; - bDowncase = false; - while (p != pEnd && INetMIME::isTokenChar(*p)) - { - bDowncase = bDowncase || INetMIME::isUpperCase(*p); - ++p; - } - if (p == pToken) - return false; - rSubType = ByteString( - pToken, sal::static_int_cast< xub_StrLen >(p - pToken)); - if (bDowncase) - rSubType.ToLowerAscii(); - - return INetMIME::scanParameters(p, pEnd, pParameters) == pEnd; -} - -//============================================================================ -// static -bool INetContentTypes::parse(UniString const & rMediaType, - UniString & rType, UniString & rSubType, - INetContentTypeParameterList * pParameters) -{ - sal_Unicode const * p = rMediaType.GetBuffer(); - sal_Unicode const * pEnd = p + rMediaType.Len(); - - p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); - sal_Unicode const * pToken = p; - bool bDowncase = false; - while (p != pEnd && INetMIME::isTokenChar(*p)) - { - bDowncase = bDowncase || INetMIME::isUpperCase(*p); - ++p; - } - if (p == pToken) - return false; - rType = UniString(pToken, sal::static_int_cast< xub_StrLen >(p - pToken)); - if (bDowncase) - rType.ToLowerAscii(); - - p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); - if (p == pEnd || *p++ != '/') - return false; - - p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); - pToken = p; - bDowncase = false; - while (p != pEnd && INetMIME::isTokenChar(*p)) - { - bDowncase = bDowncase || INetMIME::isUpperCase(*p); - ++p; - } - if (p == pToken) - return false; - rSubType = UniString( - pToken, sal::static_int_cast< xub_StrLen >(p - pToken)); - if (bDowncase) - rSubType.ToLowerAscii(); - - return INetMIME::scanParameters(p, pEnd, pParameters) == pEnd; -} - -//============================================================================ -// static -ByteString INetContentTypes::appendUSASCIIParameter(ByteString const & - rMediaType, - ByteString const & - rAttribute, - ByteString const & rValue) -{ - ByteString aResult = rMediaType; - aResult.Append(RTL_CONSTASCII_STRINGPARAM("; ")); - aResult += rAttribute; - aResult += '='; - bool bQuote = false; - for (xub_StrLen i = 0; i < rValue.Len(); ++i) - { - // When the value contains any ' characters, use a quoted string - // instead of a token, in order to avoid confusion with RFC 2231 - // extensions: - sal_uInt32 nChar = sal_uChar(rValue.GetChar(i)); - DBG_ASSERT(INetMIME::isUSASCII(nChar), - "INetContentTypes::appendUSASCIIParameter(): Bad value"); - if (!INetMIME::isTokenChar(nChar) || nChar == '\'') - { - bQuote = true; - break; - } - } - if (bQuote) - { - aResult += '"'; - for (xub_StrLen i = 0; i < rValue.Len(); ++i) - { - // Escape LF as well as CR to avoid confusion with line folding: - sal_uInt32 nChar = sal_uChar(rValue.GetChar(i)); - DBG_ASSERT(INetMIME::isUSASCII(nChar), - "INetContentTypes::appendUSASCIIParameter():" - " Bad value"); - switch (nChar) - { - case 0x0A: // LF - case 0x0D: // CR - case '"': - case '\\': - aResult += '\\'; - default: - aResult += static_cast< char >(nChar); - break; - } - } - aResult += '"'; - } - else - aResult += rValue; - return aResult; -} - -//============================================================================ -// static -UniString INetContentTypes::appendUSASCIIParameter(UniString const & - rMediaType, - UniString const & - rAttribute, - UniString const & rValue) -{ - UniString aResult = rMediaType; - aResult.AppendAscii(RTL_CONSTASCII_STRINGPARAM("; ")); - aResult += rAttribute; - aResult += '='; - bool bQuote = false; - for (xub_StrLen i = 0; i < rValue.Len(); ++i) - { - // When the value contains any ' characters, use a quoted string - // instead of a token, in order to avoid confusion with RFC 2231 - // extensions: - sal_uInt32 nChar = rValue.GetChar(i); - DBG_ASSERT(INetMIME::isUSASCII(nChar), - "INetContentTypes::appendUSASCIIParameter(): Bad value"); - if (!INetMIME::isTokenChar(nChar) || nChar == '\'') - { - bQuote = true; - break; - } - } - if (bQuote) - { - aResult += '"'; - for (xub_StrLen i = 0; i < rValue.Len(); ++i) - { - // Escape LF as well as CR to avoid confusion with line folding: - sal_uInt32 nChar = rValue.GetChar(i); - DBG_ASSERT(INetMIME::isUSASCII(nChar), - "INetContentTypes::appendUSASCIIParameter():" - " Bad value"); - switch (nChar) - { - case 0x0A: // LF - case 0x0D: // CR - case '"': - case '\\': - aResult += '\\'; - default: - aResult += sal_Unicode(nChar); - break; - } - } - aResult += '"'; - } - else - aResult += rValue; - return aResult; -} - diff --git a/svtools/source/misc1/iniadrtk.cxx b/svtools/source/misc1/iniadrtk.cxx deleted file mode 100644 index 8d4c929fc988..000000000000 --- a/svtools/source/misc1/iniadrtk.cxx +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: iniadrtk.cxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -#include - -//============================================================================ -// -// class SfxIniManagerAddressEntry -// -//============================================================================ - -// static -String SfxIniManagerAddressEntry::get(const String & rAddress, - AddressToken eToken) -{ - String aToken; - USHORT i = 0, nTxt = 0; - - while ( i < rAddress.Len() ) - { - while ( i < rAddress.Len() && rAddress.GetChar(i) != '#' ) - { - if ( rAddress.GetChar(i) == '\\' ) - i++; - aToken += rAddress.GetChar(i++); - } - - // rAddress[i] == '#' oder am Ende, also eine Position weiter gehen - i++; - - if ( eToken == (AddressToken)nTxt ) - break; - else if ( i >= rAddress.Len() ) - { - aToken.Erase(); - break; - } - else - { - aToken.Erase(); - nTxt++; - } - } - return aToken; -} - diff --git a/svtools/source/misc1/lngmisc.cxx b/svtools/source/misc1/lngmisc.cxx deleted file mode 100644 index e00540af1ab1..000000000000 --- a/svtools/source/misc1/lngmisc.cxx +++ /dev/null @@ -1,141 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: lngmisc.cxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -#include -#include -#include -#include -#include - - -using namespace rtl; - -namespace linguistic -{ - -/////////////////////////////////////////////////////////////////////////// - -INT32 GetNumControlChars( const OUString &rTxt ) -{ - INT32 nCnt = 0; - INT32 nLen = rTxt.getLength(); - for (INT32 i = 0; i < nLen; ++i) - { - if (IsControlChar( rTxt[i] )) - ++nCnt; - } - return nCnt; -} - - -BOOL RemoveHyphens( OUString &rTxt ) -{ - BOOL bModified = FALSE; - if (HasHyphens( rTxt )) - { - String aTmp( rTxt ); - aTmp.EraseAllChars( SVT_SOFT_HYPHEN ); - aTmp.EraseAllChars( SVT_HARD_HYPHEN ); - rTxt = aTmp; - bModified = TRUE; - } - return bModified; -} - - -BOOL RemoveControlChars( OUString &rTxt ) -{ - BOOL bModified = FALSE; - INT32 nCtrlChars = GetNumControlChars( rTxt ); - if (nCtrlChars) - { - INT32 nLen = rTxt.getLength(); - INT32 nSize = nLen - nCtrlChars; - OUStringBuffer aBuf( nSize ); - aBuf.setLength( nSize ); - INT32 nCnt = 0; - for (INT32 i = 0; i < nLen; ++i) - { - sal_Unicode cChar = rTxt[i]; - if (!IsControlChar( cChar )) - { - DBG_ASSERT( nCnt < nSize, "index out of range" ); - aBuf.setCharAt( nCnt++, cChar ); - } - } - DBG_ASSERT( nCnt == nSize, "wrong size" ); - rTxt = aBuf.makeStringAndClear(); - bModified = TRUE; - } - return bModified; -} - - -// non breaking field character -#define CH_TXTATR_INWORD ((sal_Char) 0x02) - -BOOL ReplaceControlChars( rtl::OUString &rTxt, sal_Char /*aRplcChar*/ ) -{ - // the resulting string looks like this: - // 1. non breaking field characters get removed - // 2. remaining control characters will be replaced by ' ' - - BOOL bModified = FALSE; - INT32 nCtrlChars = GetNumControlChars( rTxt ); - if (nCtrlChars) - { - INT32 nLen = rTxt.getLength(); - OUStringBuffer aBuf( nLen ); - INT32 nCnt = 0; - for (INT32 i = 0; i < nLen; ++i) - { - sal_Unicode cChar = rTxt[i]; - if (CH_TXTATR_INWORD != cChar) - { - if (IsControlChar( cChar )) - cChar = ' '; - DBG_ASSERT( nCnt < nLen, "index out of range" ); - aBuf.setCharAt( nCnt++, cChar ); - } - } - aBuf.setLength( nCnt ); - rTxt = aBuf.makeStringAndClear(); - bModified = TRUE; - } - return bModified; -} - -/////////////////////////////////////////////////////////////////////////// - -} // namespace linguistic - diff --git a/svtools/source/misc1/makefile.mk b/svtools/source/misc1/makefile.mk deleted file mode 100644 index dd143ea4e972..000000000000 --- a/svtools/source/misc1/makefile.mk +++ /dev/null @@ -1,69 +0,0 @@ -#************************************************************************* -# -# 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 -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.6 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. -PRJNAME=svtools -TARGET=misc1 - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svl.pmk - -# --- Files -------------------------------------------------------- - -EXCEPTIONSFILES=\ - $(SLO)$/fstathelper.obj \ - $(SLO)$/folderrestriction.obj \ - $(SLO)$/strmadpt.obj \ - $(SLO)$/svtdata.obj - -SLOFILES=\ - $(EXCEPTIONSFILES) \ - $(SLO)$/adrparse.obj \ - $(SLO)$/filenotation.obj \ - $(SLO)$/inethist.obj \ - $(SLO)$/inettype.obj \ - $(SLO)$/iniadrtk.obj \ - $(SLO)$/lngmisc.obj \ - $(SLO)$/PasswordHelper.obj - -SRS1NAME=$(TARGET) -SRC1FILES=\ - mediatyp.src - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - - - - diff --git a/svtools/source/misc1/mediatyp.src b/svtools/source/misc1/mediatyp.src deleted file mode 100644 index c7acdf8efc45..000000000000 --- a/svtools/source/misc1/mediatyp.src +++ /dev/null @@ -1,610 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: mediatyp.src,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -//============================================================================ -// -// Internet Media Type Presentations -// -// $Author: rt $ $Date: 2008-04-10 21:44:39 $ $Revision: 1.7 $ -//============================================================================ - -#ifndef _SVTOOLS_HRC -#include -#endif - -String STR_SVT_MIMETYPE_APP_OCTSTREAM -{ - Text [ en-US ] = "Binary file" ; -}; - -String STR_SVT_MIMETYPE_APP_PDF -{ - Text [ en-US ] = "PDF file" ; -}; - -String STR_SVT_MIMETYPE_APP_RTF -{ - Text [ en-US ] = "RTF File" ; -}; - -String STR_SVT_MIMETYPE_APP_MSWORD -{ - Text [ en-US ] = "MS-Word document" ; -}; - -String STR_SVT_MIMETYPE_APP_STARCALC -{ - Text [ en-US ] = "%PRODUCTNAME Spreadsheet" ; -}; - -String STR_SVT_MIMETYPE_APP_STARCHART -{ - Text [ en-US ] = "%PRODUCTNAME Chart" ; -}; - -String STR_SVT_MIMETYPE_APP_STARDRAW -{ - Text [ en-US ] = "%PRODUCTNAME Drawing" ; -}; - -String STR_SVT_MIMETYPE_APP_STARIMAGE -{ - Text [ en-US ] = "%PRODUCTNAME Image" ; -}; - -String STR_SVT_MIMETYPE_APP_STARMATH -{ - Text [ en-US ] = "%PRODUCTNAME Formula" ; -}; - -String STR_SVT_MIMETYPE_APP_STARWRITER -{ - Text [ en-US ] = "%PRODUCTNAME Text" ; -}; - -String STR_SVT_MIMETYPE_APP_ZIP -{ - Text [ en-US ] = "ZIP file" ; -}; - -String STR_SVT_MIMETYPE_APP_JAR -{ - Text [ en-US ] = "JAR file" ; -}; - -String STR_SVT_MIMETYPE_AUDIO_AIFF -{ - Text [ en-US ] = "Audio file" ; -}; - -String STR_SVT_MIMETYPE_AUDIO_BASIC -{ - Text [ en-US ] = "Audio file" ; -}; - -String STR_SVT_MIMETYPE_AUDIO_MIDI -{ - Text [ en-US ] = "Audio file" ; -}; - -String STR_SVT_MIMETYPE_AUDIO_WAV -{ - Text [ en-US ] = "Audio file" ; -}; - -String STR_SVT_MIMETYPE_IMAGE_GIF -{ - Text [ en-US ] = "Graphics" ; -}; - -String STR_SVT_MIMETYPE_IMAGE_JPEG -{ - Text [ en-US ] = "Graphics" ; -}; - -String STR_SVT_MIMETYPE_IMAGE_PCX -{ - Text [ en-US ] = "Graphics" ; -}; - -String STR_SVT_MIMETYPE_IMAGE_BMP -{ - Text [ en-US ] = "Bitmap" ; -}; - -String STR_SVT_MIMETYPE_TEXT_HTML -{ - Text [ en-US ] = "HTML document" ; -}; - -String STR_SVT_MIMETYPE_TEXT_PLAIN -{ - Text [ en-US ] = "Text file" ; -}; - -String STR_SVT_MIMETYPE_TEXT_URL -{ - Text [ en-US ] = "Bookmark" ; -}; - -String STR_SVT_MIMETYPE_TEXT_VCARD -{ - Text [ en-US ] = "vCard file" ; -}; - -String STR_SVT_MIMETYPE_VIDEO_VDO -{ - Text [ en-US ] = "Video file" ; -}; - -String STR_SVT_MIMETYPE_VIDEO_MSVIDEO -{ - Text [ en-US ] = "Video file" ; -}; - -String STR_SVT_MIMETYPE_X_STARMAIL -{ - Text [ en-US ] = "Message" ; -}; - -String STR_SVT_MIMETYPE_X_VRML -{ - Text [ en-US ] = "VRML file" ; -}; - -String STR_SVT_MIMETYPE_APP_STARIMPRESS -{ - Text [ en-US ] = "%PRODUCTNAME Presentation" ; -}; - -String STR_SVT_MIMETYPE_APP_IMPRESSPACKED -{ - Text [ en-US ] = "%PRODUCTNAME Presentation (packed)"; -}; - -String STR_SVT_MIMETYPE_APP_STARHELP -{ - Text [ en-US ] = "%PRODUCTNAME Help" ; -}; - - -String STR_SVT_MIMETYPE_CNT_MSG -{ - Text [ en-US ] = "Message" ; -}; - -String STR_SVT_MIMETYPE_CNT_DOCUMENT -{ - Text [ en-US ] = "Document" ; -}; - -String STR_SVT_MIMETYPE_CNT_POP3BOX -{ - Text [ en-US ] = "POP3 Account" ; -}; - -String STR_SVT_MIMETYPE_CNT_IMAPBOX -{ - Text [ en-US ] = "IMAP Account" ; -}; - -String STR_SVT_MIMETYPE_CNT_IMAPFLD -{ - Text [ en-US ] = "Folder" ; -}; - -String STR_SVT_MIMETYPE_CNT_VIMBOX -{ - Text [ en-US ] = "VIM Account" ; -}; - -String STR_SVT_MIMETYPE_CNT_VIMINBOX -{ - Text [ en-US ] = "Inbox" ; -}; - -String STR_SVT_MIMETYPE_CNT_BBBOX -{ - Text [ en-US ] = "Newsgroups" ; -}; - -String STR_SVT_MIMETYPE_CNT_VIM_BB -{ - Text [ en-US ] = "Newsgroup" ; -}; - -String STR_SVT_MIMETYPE_CNT_NEWSBOX -{ - Text [ en-US ] = "News" ; -}; - -String STR_SVT_MIMETYPE_CNT_NEWSGRP -{ - Text [ en-US ] = "Group" ; -}; - -String STR_SVT_MIMETYPE_CNT_OUTBOX -{ - Text [ en-US ] = "Outbox" ; -}; - -String STR_SVT_MIMETYPE_CNT_FTPBOX -{ - Text [ en-US ] = "FTP Account" ; -}; - -String STR_SVT_MIMETYPE_CNT_FTPFLD -{ - Text [ en-US ] = "FTP Folder" ; -}; - -String STR_SVT_MIMETYPE_CNT_FTPFILE -{ - Text [ en-US ] = "FTP File" ; -}; - -String STR_SVT_MIMETYPE_CNT_FTPLINK -{ - Text [ en-US ] = "FTP Link" ; -}; - -String STR_SVT_MIMETYPE_CNT_HTTPBOX -{ - Text [ en-US ] = "HTTP" ; -}; - -String STR_SVT_MIMETYPE_CNT_FSYSBOX -{ - Text [ en-US ] = "Workplace" ; -}; - -String STR_SVT_MIMETYPE_CNT_FSYSFLD -{ - Text [ en-US ] = "Folder" ; -}; - -String STR_SVT_MIMETYPE_CNT_FSYSFILE -{ - Text [ en-US ] = "File" ; -}; - -String STR_SVT_MIMETYPE_CNT_FSYSURLFILE -{ - Text [ en-US ] = "Link" ; -}; - -String STR_SVT_MIMETYPE_CNT_PUBLBOX -{ - Text [ en-US ] = "Project" ; -}; - -String STR_SVT_MIMETYPE_CNT_SRCHBOX -{ - Text [ en-US ] = "Find" ; -}; - -String STR_SVT_MIMETYPE_CNT_SUBSCRBOX -{ - Text [ en-US ] = "Subscriptions" ; -}; - -String STR_SVT_MIMETYPE_CNT_BOOKMARK -{ - Text [ en-US ] = "Bookmark subscription" ; -}; - -String STR_SVT_MIMETYPE_CNT_CDF -{ - Text [ en-US ] = "Channel subscription" ; -}; - -String STR_SVT_MIMETYPE_CNT_CDFSUB -{ - Text [ en-US ] = "Channel subscription" ; -}; - -String STR_SVT_MIMETYPE_CNT_CDFITEM -{ - Text [ en-US ] = "Channel subscription" ; -}; - -String STR_SVT_MIMETYPE_CNT_STARCHANNEL -{ - Text [ en-US ] = "StarChannel" ; -}; - -String STR_SVT_MIMETYPE_CNT_TRASHBOX -{ - Text [ en-US ] = "Recycle Bin" ; -}; - -String STR_SVT_MIMETYPE_CNT_TRASH -{ - Text [ en-US ] = "Deleted Object" ; -}; - -String STR_SVT_MIMETYPE_CNT_REMOV_VOL -{ - Text [ en-US ] = "Local drive" ; -}; - -String STR_SVT_MIMETYPE_CNT_FIX_VOL -{ - Text [ en-US ] = "Local drive" ; -}; - -String STR_SVT_MIMETYPE_CNT_REM_VOL -{ - Text [ en-US ] = "Network connection" ; -}; - -String STR_SVT_MIMETYPE_CNT_RAM_VOL -{ - Text [ en-US ] = "RAM Disk" ; -}; - -String STR_SVT_MIMETYPE_CNT_CDROM -{ - Text [ en-US ] = "CD-ROM drive" ; -}; - -String STR_SVT_MIMETYPE_CNT_DISK_35 -{ - Text [ en-US ] = "3.5'' Disk" ; -}; - -String STR_SVT_MIMETYPE_CNT_DISK_525 -{ - Text [ en-US ] = "5.25'' Disk" ; -}; - -String STR_SVT_MIMETYPE_CNT_TAPEDRIVE -{ - Text [ en-US ] = "Tape drive" ; -}; - -String STR_SVT_MIMETYPE_APP_GAL -{ - Text [ en-US ] = "Gallery"; -}; - -String STR_SVT_MIMETYPE_APP_GAL_THEME -{ - Text [ en-US ] = "Gallery theme" ; -}; - -String STR_SVT_MIMETYPE_CNT_SEPARATOR -{ - Text = "CntMenuView-Separator" ; -}; - -String STR_SVT_MIMETYPE_APP_STARW_GLOB -{ - Text [ en-US ] = "%PRODUCTNAME Master Document" ; -}; - -String STR_SVT_MIMETYPE_APP_SDM -{ - Text [ en-US ] = "Message" ; -}; - -String STR_SVT_MIMETYPE_APP_SMD -{ - Text [ en-US ] = "Message" ; -}; - -String STR_SVT_MIMETYPE_APP_STARW_WEB -{ - Text [ en-US ] = "%PRODUCTNAME Writer/Web" ; -}; - -String STR_SVT_MIMETYPE_SCHEDULE -{ - Text [ en-US ] = "Tasks & Events" ; -}; - -String STR_SVT_MIMETYPE_SCHEDULE_EVT -{ - Text [ en-US ] = "%PRODUCTNAME Events View" ; -}; - -String STR_SVT_MIMETYPE_SCHEDULE_TASK -{ - Text [ en-US ] = "%PRODUCTNAME Task View" ; -}; - -String STR_SVT_MIMETYPE_SCHEDULE_FEVT -{ - Text [ en-US ] = "%PRODUCTNAME Event" ; -}; - -String STR_SVT_MIMETYPE_SCHEDULE_FTASK -{ - Text [ en-US ] = "%PRODUCTNAME Task" ; -}; - -String STR_SVT_MIMETYPE_FRAMESET -{ - Text [ en-US ] = "Frameset Document" ; -}; - -String STR_SVT_MIMETYPE_MACRO -{ - Text [ en-US ] = "Macro file" ; -}; - -String STR_SVT_MIMETYPE_CNT_SFSYSFOLDER -{ - Text [ en-US ] = "System folder" ; -}; - -String STR_SVT_MIMETYPE_CNT_SFSYSFILE -{ - Text [ en-US ] = "System object" ; -}; - -String STR_SVT_MIMETYPE_APP_TEMPLATE -{ - Text [ en-US ] = "%PRODUCTNAME Template"; -}; - -String STR_SVT_MIMETYPE_IMAGE_GENERIC -{ - Text [ en-US ] = "Graphics"; -}; - -String STR_SVT_MIMETYPE_APP_MSEXCEL -{ - Text [ en-US ] = "MS Excel document" ; -}; - -String STR_SVT_MIMETYPE_APP_MSEXCEL_TEMPL -{ - Text [ en-US ] = "MS Excel Template" ; -}; - -String STR_SVT_MIMETYPE_APP_MSPPOINT -{ - Text [ en-US ] = "MS PowerPoint document" ; -}; - -String STR_SVT_MIMETYPE_TEXT_VCALENDAR -{ - Text [ en-US ] = "vCalendar-file" ; -}; - -String STR_SVT_MIMETYPE_TEXT_ICALENDAR -{ - Text [ en-US ] = "iCalendar-File"; -}; - -String STR_SVT_MIMETYPE_TEXT_XMLICALENDAR -{ - Text [ en-US ] = "XML-iCalendar-File"; -}; - -String STR_SVT_MIMETYPE_TEXT_CDE_CALENDAR_APP -{ - Text [ en-US ] = "CDE-Calendar-File"; -}; - -String STR_SVT_MIMETYPE_INET_MSG_RFC822 -{ - Text [ en-US ] = "message/rfc822" ; -}; - -String STR_SVT_MIMETYPE_INET_MULTI_ALTERNATIVE -{ - Text [ en-US ] = "multipart/alternative" ; -}; - -String STR_SVT_MIMETYPE_INET_MULTI_DIGEST -{ - Text [ en-US ] = "multipart/digest" ; -}; - -String STR_SVT_MIMETYPE_INET_MULTI_PARALLEL -{ - Text [ en-US ] = "multipart/parallel" ; -}; - -String STR_SVT_MIMETYPE_INET_MULTI_RELATED -{ - Text [ en-US ] = "multipart/related" ; -}; - -String STR_SVT_MIMETYPE_INET_MULTI_MIXED -{ - Text [ en-US ] = "multipart/mixed" ; -}; - -String STR_SVT_MIMETYPE_APP_SXCALC -{ - Text [ en-US ] = "%PRODUCTNAME %PRODUCTXMLFILEFORMATVERSION Spreadsheet" ; -}; - -String STR_SVT_MIMETYPE_APP_SXCHART -{ - Text [ en-US ] = "%PRODUCTNAME %PRODUCTXMLFILEFORMATVERSION Chart" ; -}; - -String STR_SVT_MIMETYPE_APP_SXDRAW -{ - Text [ en-US ] = "%PRODUCTNAME %PRODUCTXMLFILEFORMATVERSION Drawing" ; -}; - -String STR_SVT_MIMETYPE_APP_SXMATH -{ - Text [ en-US ] = "%PRODUCTNAME %PRODUCTXMLFILEFORMATVERSION Formula" ; -}; - -String STR_SVT_MIMETYPE_APP_SXWRITER -{ - Text [ en-US ] = "%PRODUCTNAME %PRODUCTXMLFILEFORMATVERSION Text Document" ; -}; - -String STR_SVT_MIMETYPE_APP_SXIMPRESS -{ - Text [ en-US ] = "%PRODUCTNAME %PRODUCTXMLFILEFORMATVERSION Presentation" ; -}; - -String STR_SVT_MIMETYPE_APP_SXGLOBAL -{ - Text [ en-US ] = "%PRODUCTNAME %PRODUCTXMLFILEFORMATVERSION Master Document" ; -}; - -String STR_SVT_MIMETYPE_APP_SXIPACKED -{ - Text [ en-US ] = "%PRODUCTNAME %PRODUCTXMLFILEFORMATVERSION Presentation (packed)" ; -}; - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svtools/source/misc1/strmadpt.cxx b/svtools/source/misc1/strmadpt.cxx deleted file mode 100644 index 4c4835609b7b..000000000000 --- a/svtools/source/misc1/strmadpt.cxx +++ /dev/null @@ -1,1048 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: strmadpt.cxx,v $ - * $Revision: 1.5.136.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include // needed under Solaris when including ... - -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace com::sun::star; - -//============================================================================ -class SvDataPipe_Impl -{ -public: - enum SeekResult { SEEK_BEFORE_MARKED, SEEK_OK, SEEK_PAST_END }; - -private: - struct Page - { - Page * m_pPrev; - Page * m_pNext; - sal_Int8 * m_pStart; - sal_Int8 * m_pRead; - sal_Int8 * m_pEnd; - sal_uInt32 m_nOffset; - sal_Int8 m_aBuffer[1]; - }; - - std::multiset< sal_uInt32 > m_aMarks; - Page * m_pFirstPage; - Page * m_pReadPage; - Page * m_pWritePage; - sal_Int8 * m_pReadBuffer; - sal_uInt32 m_nReadBufferSize; - sal_uInt32 m_nReadBufferFilled; - sal_uInt32 m_nPageSize; - sal_uInt32 m_nMinPages; - sal_uInt32 m_nMaxPages; - sal_uInt32 m_nPages; - bool m_bEOF; - - bool remove(Page * pPage); - -public: - inline SvDataPipe_Impl(sal_uInt32 nThePageSize = 1000, - sal_uInt32 nTheMinPages = 100, - sal_uInt32 nTheMaxPages - = std::numeric_limits< sal_uInt32 >::max()); - - ~SvDataPipe_Impl(); - - inline void setReadBuffer(sal_Int8 * pBuffer, sal_uInt32 nSize); - - sal_uInt32 read(); - - void clearReadBuffer() { m_pReadBuffer = 0; } - - sal_uInt32 write(sal_Int8 const * pBuffer, sal_uInt32 nSize); - - void setEOF() { m_bEOF = true; } - - inline bool isEOF() const; - - bool addMark(sal_uInt32 nPosition); - - bool removeMark(sal_uInt32 nPosition); - - inline sal_uInt32 getReadPosition() const; - - SeekResult setReadPosition(sal_uInt32 nPosition); -}; - -SvDataPipe_Impl::SvDataPipe_Impl(sal_uInt32 nThePageSize, - sal_uInt32 nTheMinPages, - sal_uInt32 nTheMaxPages): - m_pFirstPage(0), - m_pReadPage(0), - m_pWritePage(0), - m_pReadBuffer(0), - m_nPageSize(std::min< sal_uInt32 >( - std::max< sal_uInt32 >(nThePageSize, sal_uInt32(1)), - sal_uInt32(std::numeric_limits< sal_uInt32 >::max() - - sizeof (Page) + 1))), - m_nMinPages(std::max< sal_uInt32 >(nTheMinPages, sal_uInt32(1))), - m_nMaxPages(std::max< sal_uInt32 >(nTheMaxPages, sal_uInt32(1))), - m_nPages(0), - m_bEOF(false) -{} - -inline void SvDataPipe_Impl::setReadBuffer(sal_Int8 * pBuffer, - sal_uInt32 nSize) -{ - m_pReadBuffer = pBuffer; - m_nReadBufferSize = nSize; - m_nReadBufferFilled = 0; -} - -inline bool SvDataPipe_Impl::isEOF() const -{ - return m_bEOF && m_pReadPage == m_pWritePage - && (!m_pReadPage || m_pReadPage->m_pRead == m_pReadPage->m_pEnd); -} - -inline sal_uInt32 SvDataPipe_Impl::getReadPosition() const -{ - return m_pReadPage == 0 ? 0 : - m_pReadPage->m_nOffset - + (m_pReadPage->m_pRead - - m_pReadPage->m_aBuffer); -} - -//============================================================================ -// -// SvOutputStreamOpenLockBytes -// -//============================================================================ - -TYPEINIT1(SvOutputStreamOpenLockBytes, SvOpenLockBytes) - -//============================================================================ -// virtual -ErrCode SvOutputStreamOpenLockBytes::ReadAt(ULONG, void *, ULONG, ULONG *) - const -{ - return ERRCODE_IO_CANTREAD; -} - -//============================================================================ -// virtual -ErrCode SvOutputStreamOpenLockBytes::WriteAt(ULONG nPos, void const * pBuffer, - ULONG nCount, ULONG * pWritten) -{ - if (nPos != m_nPosition) - return ERRCODE_IO_CANTWRITE; - return FillAppend(pBuffer, nCount, pWritten); -} - -//============================================================================ -// virtual -ErrCode SvOutputStreamOpenLockBytes::Flush() const -{ - if (!m_xOutputStream.is()) - return ERRCODE_IO_CANTWRITE; - try - { - m_xOutputStream->flush(); - } - catch (io::IOException) - { - return ERRCODE_IO_CANTWRITE; - } - return ERRCODE_NONE; -} - -//============================================================================ -// virtual -ErrCode SvOutputStreamOpenLockBytes::SetSize(ULONG) -{ - return ERRCODE_IO_NOTSUPPORTED; -} - -//============================================================================ -// virtual -ErrCode SvOutputStreamOpenLockBytes::Stat(SvLockBytesStat * pStat, - SvLockBytesStatFlag) const -{ - if (pStat) - pStat->nSize = m_nPosition; - return ERRCODE_NONE; -} - -//============================================================================ -// virtual -ErrCode SvOutputStreamOpenLockBytes::FillAppend(void const * pBuffer, - ULONG nCount, - ULONG * pWritten) -{ - if (!m_xOutputStream.is()) - return ERRCODE_IO_CANTWRITE; - if (nCount > 0 - && nCount > std::numeric_limits< ULONG >::max() - m_nPosition) - { - nCount = std::numeric_limits< ULONG >::max() - m_nPosition; - if (nCount == 0) - return ERRCODE_IO_CANTWRITE; - } - try - { - m_xOutputStream-> - writeBytes(uno::Sequence< sal_Int8 >( - static_cast< sal_Int8 const * >(pBuffer), nCount)); - } - catch (io::IOException) - { - return ERRCODE_IO_CANTWRITE; - } - m_nPosition += nCount; - if (pWritten) - *pWritten = nCount; - return ERRCODE_NONE; -} - -//============================================================================ -// virtual -ULONG SvOutputStreamOpenLockBytes::Tell() const -{ - return m_nPosition; -} - -//============================================================================ -// virtual -ULONG SvOutputStreamOpenLockBytes::Seek(ULONG) -{ - return m_nPosition; -} - -//============================================================================ -// virtual -void SvOutputStreamOpenLockBytes::Terminate() -{ - if (m_xOutputStream.is()) - try - { - m_xOutputStream->closeOutput(); - } - catch (io::IOException) {} -} - -//============================================================================ -// -// SvLockBytesInputStream -// -//============================================================================ - -// virtual -uno::Any SAL_CALL SvLockBytesInputStream::queryInterface(uno::Type const & - rType) - throw (uno::RuntimeException) -{ - uno::Any - aReturn(cppu::queryInterface(rType, - static_cast< io::XInputStream * >(this), - static_cast< io::XSeekable * >(this))); - return aReturn.hasValue() ? aReturn : OWeakObject::queryInterface(rType); -} - -//============================================================================ -// virtual -void SAL_CALL SvLockBytesInputStream::acquire() throw () -{ - OWeakObject::acquire(); -} - -//============================================================================ -// virtual -void SAL_CALL SvLockBytesInputStream::release() throw () -{ - OWeakObject::release(); -} - -//============================================================================ -// virtual -sal_Int32 SAL_CALL -SvLockBytesInputStream::readBytes(uno::Sequence< sal_Int8 > & rData, - sal_Int32 nBytesToRead) - throw (io::IOException, uno::RuntimeException) -{ - OSL_ASSERT(m_nPosition >= 0); - if (!m_xLockBytes.Is()) - throw io::NotConnectedException(); - if ( - nBytesToRead < 0 || - ( - static_cast(m_nPosition) > SAL_MAX_SIZE && - nBytesToRead > 0 - ) - ) - { - throw io::IOException(); - } - rData.realloc(nBytesToRead); - sal_Int32 nSize = 0; - while (nSize < nBytesToRead) - { - sal_Size nCount; - ErrCode nError = m_xLockBytes->ReadAt(static_cast( - m_nPosition), - rData.getArray() + nSize, - nBytesToRead - nSize, &nCount); - if (nError != ERRCODE_NONE && nError != ERRCODE_IO_PENDING) - throw io::IOException(); - m_nPosition += nCount; - nSize += nCount; - if (nError == ERRCODE_NONE && nCount == 0) - break; - } - rData.realloc(nSize); - return nSize; -} - -//============================================================================ -// virtual -sal_Int32 SAL_CALL -SvLockBytesInputStream::readSomeBytes(uno::Sequence< sal_Int8 > & rData, - sal_Int32 nMaxBytesToRead) - throw (io::IOException, uno::RuntimeException) -{ - OSL_ASSERT(m_nPosition >= 0); - if (!m_xLockBytes.Is()) - throw io::NotConnectedException(); - if (static_cast(m_nPosition) > SAL_MAX_SIZE - && nMaxBytesToRead > 0) - throw io::IOException(); - rData.realloc(nMaxBytesToRead); - sal_Size nCount = 0; - if (nMaxBytesToRead > 0) - { - ErrCode nError; - do - { - nError = m_xLockBytes->ReadAt(static_cast(m_nPosition), - rData.getArray(), - nMaxBytesToRead < 0 ? - 0 : nMaxBytesToRead, - &nCount); - if (nError != ERRCODE_NONE && nError != ERRCODE_IO_PENDING) - throw io::IOException(); - m_nPosition += nCount; - } - while (nCount == 0 && nError == ERRCODE_IO_PENDING); - } - rData.realloc(sal_Int32(nCount)); - return sal_Int32(nCount); -} - -//============================================================================ -// virtual -void SAL_CALL SvLockBytesInputStream::skipBytes(sal_Int32 nBytesToSkip) - throw (io::IOException, uno::RuntimeException) -{ - if (!m_xLockBytes.Is()) - throw io::NotConnectedException(); - if (nBytesToSkip < 0) - throw io::IOException(); - if (nBytesToSkip > SAL_MAX_INT64 - m_nPosition) - throw io::BufferSizeExceededException(); - m_nPosition += nBytesToSkip; -} - -//============================================================================ -// virtual -sal_Int32 SAL_CALL SvLockBytesInputStream::available() - throw (io::IOException, uno::RuntimeException) -{ - OSL_ASSERT(m_nPosition >= 0); - if (!m_xLockBytes.Is()) - throw io::NotConnectedException(); - SvLockBytesStat aStat; - if (m_xLockBytes->Stat(&aStat, SVSTATFLAG_DEFAULT) != ERRCODE_NONE) - throw io::IOException(); - return aStat.nSize <= static_cast(m_nPosition) ? - 0 : - static_cast(aStat.nSize - m_nPosition) <= - static_cast(SAL_MAX_INT32) ? - static_cast(aStat.nSize - m_nPosition) : - SAL_MAX_INT32; -} - -//============================================================================ -// virtual -void SAL_CALL SvLockBytesInputStream::closeInput() - throw (io::IOException, uno::RuntimeException) -{ - if (!m_xLockBytes.Is()) - throw io::NotConnectedException(); - m_xLockBytes = 0; -} - -//============================================================================ -// virtual -void SAL_CALL SvLockBytesInputStream::seek(sal_Int64 nLocation) - throw (lang::IllegalArgumentException, io::IOException, - uno::RuntimeException) -{ - if (nLocation < 0) - throw lang::IllegalArgumentException(); - if (!m_xLockBytes.Is()) - throw io::NotConnectedException(); - m_nPosition = nLocation; -} - -//============================================================================ -// virtual -sal_Int64 SAL_CALL SvLockBytesInputStream::getPosition() - throw (io::IOException, uno::RuntimeException) -{ - if (!m_xLockBytes.Is()) - throw io::NotConnectedException(); - return m_nPosition; -} - -//============================================================================ -// virtual -sal_Int64 SAL_CALL SvLockBytesInputStream::getLength() - throw (io::IOException, uno::RuntimeException) -{ - if (!m_xLockBytes.Is()) - throw io::NotConnectedException(); - SvLockBytesStat aStat; - if (m_xLockBytes->Stat(&aStat, SVSTATFLAG_DEFAULT) != ERRCODE_NONE) - throw io::IOException(); -#if SAL_TYPES_SIZEOFPOINTER > 4 // avoid warnings if sal_Size < sal_Int64 - if (aStat.nSize > static_cast(SAL_MAX_INT64)) - throw io::IOException(); -#endif - return aStat.nSize; -} - -//============================================================================ -// -// SvInputStream -// -//============================================================================ - -bool SvInputStream::open() -{ - if (GetError() != ERRCODE_NONE) - return false; - if (!(m_xSeekable.is() || m_pPipe)) - { - if (!m_xStream.is()) - { - SetError(ERRCODE_IO_INVALIDDEVICE); - return false; - } - m_xSeekable - = uno::Reference< io::XSeekable >(m_xStream, uno::UNO_QUERY); - if (!m_xSeekable.is()) - m_pPipe = new SvDataPipe_Impl; - } - return true; -} - -//============================================================================ -// virtual -ULONG SvInputStream::GetData(void * pData, ULONG nSize) -{ - if (!open()) - { - SetError(ERRCODE_IO_CANTREAD); - return 0; - } - sal_uInt32 nRead = 0; - if (m_xSeekable.is()) - { - if (m_nSeekedFrom != STREAM_SEEK_TO_END) - { - try - { - m_xSeekable->seek(m_nSeekedFrom); - } - catch (io::IOException) - { - SetError(ERRCODE_IO_CANTREAD); - return 0; - } - m_nSeekedFrom = STREAM_SEEK_TO_END; - } - for (;;) - { - sal_Int32 nRemain - = sal_Int32( - std::min(ULONG(nSize - nRead), - ULONG(std::numeric_limits< sal_Int32 >::max()))); - if (nRemain == 0) - break; - uno::Sequence< sal_Int8 > aBuffer; - sal_Int32 nCount; - try - { - nCount = m_xStream->readBytes(aBuffer, nRemain); - } - catch (io::IOException) - { - SetError(ERRCODE_IO_CANTREAD); - return nRead; - } - rtl_copyMemory(static_cast< sal_Int8 * >(pData) + nRead, - aBuffer.getConstArray(), sal_uInt32(nCount)); - nRead += nCount; - if (nCount < nRemain) - break; - } - } - else - { - if (m_nSeekedFrom != STREAM_SEEK_TO_END) - { - SetError(ERRCODE_IO_CANTREAD); - return 0; - } - m_pPipe->setReadBuffer(static_cast< sal_Int8 * >(pData), nSize); - nRead = m_pPipe->read(); - if (nRead < nSize && !m_pPipe->isEOF()) - for (;;) - { - sal_Int32 nRemain - = sal_Int32( - std::min( - ULONG(nSize - nRead), - ULONG(std::numeric_limits< sal_Int32 >::max()))); - if (nRemain == 0) - break; - uno::Sequence< sal_Int8 > aBuffer; - sal_Int32 nCount; - try - { - nCount = m_xStream->readBytes(aBuffer, nRemain); - } - catch (io::IOException) - { - SetError(ERRCODE_IO_CANTREAD); - break; - } - m_pPipe->write(aBuffer.getConstArray(), sal_uInt32(nCount)); - nRead += m_pPipe->read(); - if (nCount < nRemain) - { - m_xStream->closeInput(); - m_pPipe->setEOF(); - break; - } - } - m_pPipe->clearReadBuffer(); - } - return nRead; -} - -//============================================================================ -// virtual -ULONG SvInputStream::PutData(void const *, ULONG) -{ - SetError(ERRCODE_IO_NOTSUPPORTED); - return 0; -} - -//============================================================================ -// virtual -void SvInputStream::FlushData() -{} - -//============================================================================ -// virtual -ULONG SvInputStream::SeekPos(ULONG nPos) -{ - if (open()) - { - if (nPos == STREAM_SEEK_TO_END) - { - if (m_nSeekedFrom == STREAM_SEEK_TO_END) - { - if (m_xSeekable.is()) - try - { - sal_Int64 nLength = m_xSeekable->getLength(); - OSL_ASSERT(nLength >= 0); - if (static_cast(nLength) - < STREAM_SEEK_TO_END) - { - m_nSeekedFrom = Tell(); - return ULONG(nLength); - } - } - catch (io::IOException) {} - else - return Tell(); //@@@ - } - else - return Tell(); - } - else if (nPos == m_nSeekedFrom) - { - m_nSeekedFrom = STREAM_SEEK_TO_END; - return nPos; - } - else if (m_xSeekable.is()) - try - { - m_xSeekable->seek(nPos); - m_nSeekedFrom = STREAM_SEEK_TO_END; - return nPos; - } - catch (io::IOException) {} - else if (m_pPipe->setReadPosition(nPos) == SvDataPipe_Impl::SEEK_OK) - { - m_nSeekedFrom = STREAM_SEEK_TO_END; - return nPos; - } - } - SetError(ERRCODE_IO_CANTSEEK); - return Tell(); -} - -//============================================================================ -// virtual -void SvInputStream::SetSize(ULONG) -{ - SetError(ERRCODE_IO_NOTSUPPORTED); -} - -//============================================================================ -SvInputStream::SvInputStream( - com::sun::star::uno::Reference< com::sun::star::io::XInputStream > - const & - rTheStream): - m_xStream(rTheStream), - m_pPipe(0), - m_nSeekedFrom(STREAM_SEEK_TO_END) -{ - SetBufferSize(0); -} - -//============================================================================ -// virtual -SvInputStream::~SvInputStream() -{ - if (m_xStream.is()) - try - { - m_xStream->closeInput(); - } - catch (io::IOException) {} - delete m_pPipe; -} - -//============================================================================ -// virtual -USHORT SvInputStream::IsA() const -{ - return 0; -} - -//============================================================================ -// virtual -void SvInputStream::AddMark(ULONG nPos) -{ - if (open() && m_pPipe) - m_pPipe->addMark(nPos); -} - -//============================================================================ -// virtual -void SvInputStream::RemoveMark(ULONG nPos) -{ - if (open() && m_pPipe) - m_pPipe->removeMark(nPos); -} - -//============================================================================ -// -// SvOutputStream -// -//============================================================================ - -// virtual -ULONG SvOutputStream::GetData(void *, ULONG) -{ - SetError(ERRCODE_IO_NOTSUPPORTED); - return 0; -} - -//============================================================================ -// virtual -ULONG SvOutputStream::PutData(void const * pData, ULONG nSize) -{ - if (!m_xStream.is()) - { - SetError(ERRCODE_IO_CANTWRITE); - return 0; - } - ULONG nWritten = 0; - for (;;) - { - sal_Int32 nRemain - = sal_Int32( - std::min(ULONG(nSize - nWritten), - ULONG(std::numeric_limits< sal_Int32 >::max()))); - if (nRemain == 0) - break; - try - { - m_xStream->writeBytes(uno::Sequence< sal_Int8 >( - static_cast(pData) - + nWritten, - nRemain)); - } - catch (io::IOException) - { - SetError(ERRCODE_IO_CANTWRITE); - break; - } - nWritten += nRemain; - } - return nWritten; -} - -//============================================================================ -// virtual -ULONG SvOutputStream::SeekPos(ULONG) -{ - SetError(ERRCODE_IO_NOTSUPPORTED); - return 0; -} - -//============================================================================ -// virtual -void SvOutputStream::FlushData() -{ - if (!m_xStream.is()) - { - SetError(ERRCODE_IO_INVALIDDEVICE); - return; - } - try - { - m_xStream->flush(); - } - catch (io::IOException) {} -} - -//============================================================================ -// virtual -void SvOutputStream::SetSize(ULONG) -{ - SetError(ERRCODE_IO_NOTSUPPORTED); -} - -//============================================================================ -SvOutputStream::SvOutputStream(uno::Reference< io::XOutputStream > const & - rTheStream): - m_xStream(rTheStream) -{ - SetBufferSize(0); -} - -//============================================================================ -// virtual -SvOutputStream::~SvOutputStream() -{ - if (m_xStream.is()) - try - { - m_xStream->closeOutput(); - } - catch (io::IOException) {} -} - -//============================================================================ -// virtual -USHORT SvOutputStream::IsA() const -{ - return 0; -} - -//============================================================================ -// -// SvDataPipe_Impl -// -//============================================================================ - -bool SvDataPipe_Impl::remove(Page * pPage) -{ - if ( - pPage != m_pFirstPage || - m_pReadPage == m_pFirstPage || - ( - !m_aMarks.empty() && - *m_aMarks.begin() < m_pFirstPage->m_nOffset + m_nPageSize - ) - ) - { - return false; - } - - m_pFirstPage = m_pFirstPage->m_pNext; - - if (m_nPages <= m_nMinPages) - return true; - - pPage->m_pPrev->m_pNext = pPage->m_pNext; - pPage->m_pNext->m_pPrev = pPage->m_pPrev; - rtl_freeMemory(pPage); - --m_nPages; - - return true; -} - -//============================================================================ -SvDataPipe_Impl::~SvDataPipe_Impl() -{ - if (m_pFirstPage != 0) - for (Page * pPage = m_pFirstPage;;) - { - Page * pNext = pPage->m_pNext; - rtl_freeMemory(pPage); - if (pNext == m_pFirstPage) - break; - pPage = pNext; - } -} - -//============================================================================ -sal_uInt32 SvDataPipe_Impl::read() -{ - if (m_pReadBuffer == 0 || m_nReadBufferSize == 0 || m_pReadPage == 0) - return 0; - - sal_uInt32 nSize = m_nReadBufferSize; - sal_uInt32 nRemain = m_nReadBufferSize - m_nReadBufferFilled; - - m_pReadBuffer += m_nReadBufferFilled; - m_nReadBufferSize -= m_nReadBufferFilled; - m_nReadBufferFilled = 0; - - while (nRemain > 0) - { - sal_uInt32 nBlock = std::min(sal_uInt32(m_pReadPage->m_pEnd - - m_pReadPage->m_pRead), - nRemain); - rtl_copyMemory(m_pReadBuffer, m_pReadPage->m_pRead, nBlock); - m_pReadPage->m_pRead += nBlock; - m_pReadBuffer += nBlock; - m_nReadBufferSize -= nBlock; - m_nReadBufferFilled = 0; - nRemain -= nBlock; - - if (m_pReadPage == m_pWritePage) - break; - - if (m_pReadPage->m_pRead == m_pReadPage->m_pEnd) - { - Page * pRemove = m_pReadPage; - m_pReadPage = pRemove->m_pNext; - remove(pRemove); - } - } - - return nSize - nRemain; -} - -//============================================================================ -sal_uInt32 SvDataPipe_Impl::write(sal_Int8 const * pBuffer, sal_uInt32 nSize) -{ - if (nSize == 0) - return 0; - - if (m_pWritePage == 0) - { - m_pFirstPage - = static_cast< Page * >(rtl_allocateMemory(sizeof (Page) - + m_nPageSize - - 1)); - m_pFirstPage->m_pPrev = m_pFirstPage; - m_pFirstPage->m_pNext = m_pFirstPage; - m_pFirstPage->m_pStart = m_pFirstPage->m_aBuffer; - m_pFirstPage->m_pRead = m_pFirstPage->m_aBuffer; - m_pFirstPage->m_pEnd = m_pFirstPage->m_aBuffer; - m_pFirstPage->m_nOffset = 0; - m_pReadPage = m_pFirstPage; - m_pWritePage = m_pFirstPage; - ++m_nPages; - } - - sal_uInt32 nRemain = nSize; - - if (m_pReadBuffer != 0 && m_pReadPage == m_pWritePage - && m_pReadPage->m_pRead == m_pWritePage->m_pEnd) - { - sal_uInt32 nBlock = std::min(nRemain, - sal_uInt32(m_nReadBufferSize - - m_nReadBufferFilled)); - sal_uInt32 nPosition = m_pWritePage->m_nOffset - + (m_pWritePage->m_pEnd - - m_pWritePage->m_aBuffer); - if (!m_aMarks.empty()) - nBlock = *m_aMarks.begin() > nPosition ? - std::min(nBlock, sal_uInt32(*m_aMarks.begin() - - nPosition)) : - 0; - - if (nBlock > 0) - { - rtl_copyMemory(m_pReadBuffer + m_nReadBufferFilled, pBuffer, - nBlock); - m_nReadBufferFilled += nBlock; - nRemain -= nBlock; - - nPosition += nBlock; - m_pWritePage->m_nOffset = (nPosition / m_nPageSize) * m_nPageSize; - m_pWritePage->m_pStart = m_pWritePage->m_aBuffer - + nPosition % m_nPageSize; - m_pWritePage->m_pRead = m_pWritePage->m_pStart; - m_pWritePage->m_pEnd = m_pWritePage->m_pStart; - } - } - - if (nRemain > 0) - for (;;) - { - sal_uInt32 nBlock - = std::min(sal_uInt32(m_pWritePage->m_aBuffer + m_nPageSize - - m_pWritePage->m_pEnd), - nRemain); - rtl_copyMemory(m_pWritePage->m_pEnd, pBuffer, nBlock); - m_pWritePage->m_pEnd += nBlock; - pBuffer += nBlock; - nRemain -= nBlock; - - if (nRemain == 0) - break; - - if (m_pWritePage->m_pNext == m_pFirstPage) - { - if (m_nPages == m_nMaxPages) - break; - - Page * pNew - = static_cast< Page * >(rtl_allocateMemory( - sizeof (Page) + m_nPageSize - - 1)); - pNew->m_pPrev = m_pWritePage; - pNew->m_pNext = m_pWritePage->m_pNext; - - m_pWritePage->m_pNext->m_pPrev = pNew; - m_pWritePage->m_pNext = pNew; - ++m_nPages; - } - - m_pWritePage->m_pNext->m_nOffset = m_pWritePage->m_nOffset - + m_nPageSize; - m_pWritePage = m_pWritePage->m_pNext; - m_pWritePage->m_pStart = m_pWritePage->m_aBuffer; - m_pWritePage->m_pRead = m_pWritePage->m_aBuffer; - m_pWritePage->m_pEnd = m_pWritePage->m_aBuffer; - } - - return nSize - nRemain; -} - -//============================================================================ -bool SvDataPipe_Impl::addMark(sal_uInt32 nPosition) -{ - if (m_pFirstPage != 0 && m_pFirstPage->m_nOffset > nPosition) - return false; - m_aMarks.insert(nPosition); - return true; -} - -//============================================================================ -bool SvDataPipe_Impl::removeMark(sal_uInt32 nPosition) -{ - std::multiset< sal_uInt32 >::iterator t = m_aMarks.find(nPosition); - if (t == m_aMarks.end()) - return false; - m_aMarks.erase(t); - while (remove(m_pFirstPage)) ; - return true; -} - -//============================================================================ -SvDataPipe_Impl::SeekResult SvDataPipe_Impl::setReadPosition(sal_uInt32 - nPosition) -{ - if (m_pFirstPage == 0) - return nPosition == 0 ? SEEK_OK : SEEK_PAST_END; - - if (nPosition - <= m_pReadPage->m_nOffset - + (m_pReadPage->m_pRead - m_pReadPage->m_aBuffer)) - { - if (nPosition - < m_pFirstPage->m_nOffset - + (m_pFirstPage->m_pStart - m_pFirstPage->m_aBuffer)) - return SEEK_BEFORE_MARKED; - - while (nPosition < m_pReadPage->m_nOffset) - { - m_pReadPage->m_pRead = m_pReadPage->m_pStart; - m_pReadPage = m_pReadPage->m_pPrev; - } - } - else - { - if (nPosition - > m_pWritePage->m_nOffset - + (m_pWritePage->m_pEnd - m_pWritePage->m_aBuffer)) - return SEEK_PAST_END; - - while (m_pReadPage != m_pWritePage - && nPosition >= m_pReadPage->m_nOffset + m_nPageSize) - { - Page * pRemove = m_pReadPage; - m_pReadPage = pRemove->m_pNext; - remove(pRemove); - } - } - - m_pReadPage->m_pRead = m_pReadPage->m_aBuffer - + (nPosition - m_pReadPage->m_nOffset); - return SEEK_OK; -} - diff --git a/svtools/source/misc1/svtdata.cxx b/svtools/source/misc1/svtdata.cxx deleted file mode 100644 index 51247a628c0e..000000000000 --- a/svtools/source/misc1/svtdata.cxx +++ /dev/null @@ -1,113 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: svtdata.cxx,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include -#include -#include -#include -#include - -namespace unnamed_svtools_svtdata {} -using namespace unnamed_svtools_svtdata; - // unnamed namespaces don't work well yet - -//============================================================================ -namespace unnamed_svtools_svtdata { - -typedef std::map< rtl::OUString, SimpleResMgr * > SimpleResMgrMap; - -} - -//============================================================================ -// -// ImpSvtData -// -//============================================================================ - -ImpSvtData::~ImpSvtData() -{ - delete pResMgr; - for (SimpleResMgrMap::iterator t - = static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs)->begin(); - t != static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs)->end(); ++t) - delete t->second; - delete static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs); -} - -//============================================================================ -ResMgr * ImpSvtData::GetResMgr(const ::com::sun::star::lang::Locale aLocale) -{ - if (!pResMgr) - { - pResMgr = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(svt), aLocale ); - } - return pResMgr; -} - -//============================================================================ -SimpleResMgr* ImpSvtData::GetSimpleRM(const ::com::sun::star::lang::Locale& rLocale) -{ - if (!m_pThreadsafeRMs) - m_pThreadsafeRMs = new SimpleResMgrMap; - rtl::OUString aISOcode = rLocale.Language; - aISOcode += rtl::OStringToOUString("-", RTL_TEXTENCODING_UTF8); - aISOcode += rLocale.Country; - - SimpleResMgr *& rResMgr - = (*static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs))[aISOcode]; - if (!rResMgr) - { - rResMgr = new SimpleResMgr(CREATEVERSIONRESMGR_NAME(svs), rLocale ); - } - return rResMgr; -} - -ResMgr * ImpSvtData::GetPatchResMgr(const ::com::sun::star::lang::Locale& aLocale) -{ - if (!pPatchResMgr) - { - pPatchResMgr = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(svp), aLocale); - } - return pPatchResMgr; -} - -//============================================================================ -// static -ImpSvtData & ImpSvtData::GetSvtData() -{ - void ** pAppData = GetAppData(SHL_SVT); - if (!*pAppData) - *pAppData= new ImpSvtData; - return *static_cast(*pAppData); -} - diff --git a/svtools/source/notify/brdcst.cxx b/svtools/source/notify/brdcst.cxx deleted file mode 100644 index 3a698c725c5c..000000000000 --- a/svtools/source/notify/brdcst.cxx +++ /dev/null @@ -1,212 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: brdcst.cxx,v $ - * $Revision: 1.8.60.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#ifndef GCC -#endif -#include - -#include -#include -#include - -SV_DECL_PTRARR( SfxListenerArr_Impl, SfxListener*, 0, 2 ) - -#define _SFX_BRDCST_CXX -#include - -//==================================================================== -DBG_NAME(SfxBroadcaster) -TYPEINIT0(SfxBroadcaster); - -//==================================================================== - -//==================================================================== -// broadcast immediately - - -void SfxBroadcaster::Broadcast( const SfxHint &rHint ) -{ - DBG_CHKTHIS(SfxBroadcaster, 0); - - // is anybody to notify? - if ( aListeners.Count() /*! || aGlobListeners.Count() */ ) - { - // notify all registered listeners exactly once - for ( USHORT n = 0; n < aListeners.Count(); ++n ) - { - SfxListener* pListener = aListeners[n]; - if ( pListener ) - pListener->Notify( *this, rHint ); - } - } -} - -//-------------------------------------------------------------------- - -// broadcast after a timeout - - -void SfxBroadcaster::BroadcastDelayed( const SfxHint& rHint ) -{ - DBG_WARNING( "not implemented" ); - Broadcast(rHint); -} -//-------------------------------------------------------------------- - -// broadcast in idle-handler - -void SfxBroadcaster::BroadcastInIdle( const SfxHint& rHint ) -{ - DBG_WARNING( "not implemented" ); - Broadcast(rHint); -} -//-------------------------------------------------------------------- - -// unregister all listeners - -SfxBroadcaster::~SfxBroadcaster() -{ - DBG_DTOR(SfxBroadcaster, 0); - - Broadcast( SfxSimpleHint(SFX_HINT_DYING) ); - - // remove all still registered listeners - for ( USHORT nPos = 0; nPos < aListeners.Count(); ++nPos ) - { - SfxListener *pListener = aListeners[nPos]; - if ( pListener ) - pListener->RemoveBroadcaster_Impl(*this); - } -} - -//-------------------------------------------------------------------- - -// simple ctor of class SfxBroadcaster - -SfxBroadcaster::SfxBroadcaster() -{ - DBG_CTOR(SfxBroadcaster, 0); -} - -//-------------------------------------------------------------------- - -// copy ctor of class SfxBroadcaster - - -SfxBroadcaster::SfxBroadcaster( const SfxBroadcaster &rBC ) -{ - DBG_CTOR(SfxBroadcaster, 0); - - for ( USHORT n = 0; n < rBC.aListeners.Count(); ++n ) - { - SfxListener *pListener = rBC.aListeners[n]; - if ( pListener ) - pListener->StartListening( *this ); - } -} - -//-------------------------------------------------------------------- - -// add a new SfxListener to the list - -BOOL SfxBroadcaster::AddListener( SfxListener& rListener ) -{ - DBG_CHKTHIS(SfxBroadcaster, 0); - const SfxListener *pListener = &rListener; - const SfxListener *pNull = 0; - USHORT nFreePos = aListeners.GetPos( pNull ); - if ( nFreePos < aListeners.Count() ) - aListeners.GetData()[nFreePos] = pListener; - else if ( aListeners.Count() < (USHRT_MAX-1) ) - aListeners.Insert( pListener, aListeners.Count() ); - else - { - DBG_ERROR( "array overflow" ); - return FALSE; - } - - DBG_ASSERT( USHRT_MAX != aListeners.GetPos(pListener), - "AddListener failed" ); - return TRUE; -} - -//-------------------------------------------------------------------- - -// called, if no more listeners exists - -void SfxBroadcaster::ListenersGone() -{ - DBG_CHKTHIS(SfxBroadcaster,0); -} - -//-------------------------------------------------------------------- - -// forward a notification to all registered listeners - -void SfxBroadcaster::Forward(SfxBroadcaster& rBC, const SfxHint& rHint) -{ - const USHORT nCount = aListeners.Count(); - for ( USHORT i = 0; i < nCount; ++i ) - { - SfxListener *pListener = aListeners[i]; - if ( pListener ) - pListener->Notify( rBC, rHint ); - } -} - -//-------------------------------------------------------------------- - -// remove one SfxListener from the list - -void SfxBroadcaster::RemoveListener( SfxListener& rListener ) -{ - {DBG_CHKTHIS(SfxBroadcaster, 0);} - const SfxListener *pListener = &rListener; - USHORT nPos = aListeners.GetPos(pListener); - DBG_ASSERT( nPos != USHRT_MAX, "RemoveListener: Listener unknown" ); - aListeners.GetData()[nPos] = 0; - if ( !HasListeners() ) - ListenersGone(); -} - -//-------------------------------------------------------------------- - -BOOL SfxBroadcaster::HasListeners() const -{ - for ( USHORT n = 0; n < aListeners.Count(); ++n ) - if ( aListeners.GetObject(n) != 0 ) - return TRUE; - return FALSE; -} - -//-------------------------------------------------------------------- diff --git a/svtools/source/notify/broadcast.cxx b/svtools/source/notify/broadcast.cxx deleted file mode 100644 index e363f545c719..000000000000 --- a/svtools/source/notify/broadcast.cxx +++ /dev/null @@ -1,151 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: broadcast.cxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#ifndef GCC -#endif -#include - -#include "listener.hxx" -#include "listeneriter.hxx" -#include "broadcast.hxx" -#include - - -//==================================================================== -TYPEINIT0(SvtBroadcaster); - -//==================================================================== - -// simple ctor of class SvtBroadcaster - -SvtBroadcaster::SvtBroadcaster() - : pRoot( 0 ) -{ -} - -//-------------------------------------------------------------------- - -// copy ctor of class SvtBroadcaster - -SvtBroadcaster::SvtBroadcaster( const SvtBroadcaster &rBC ) - : pRoot( 0 ) -{ - SvtListenerIter aIter( (SvtBroadcaster&)rBC ); - SvtListener* pLast = aIter.GoStart(); - if( pLast ) - do { - pLast->StartListening( *this ); - } while( 0 != ( pLast = aIter.GoNext() )); -} - -//-------------------------------------------------------------------- - -// unregister all listeners - -SvtBroadcaster::~SvtBroadcaster() -{ - Broadcast( SfxSimpleHint(SFX_HINT_DYING) ); - - SvtListenerIter aIter( *this ); - SvtListener* pLast = aIter.GoStart(); - if( pLast ) - do { - pLast->EndListening( *this ); - if( !HasListeners() ) // all gone ?? - break; - } while( 0 != ( pLast = aIter.GoNext() )); -} - -//-------------------------------------------------------------------- - -// broadcast immedeately - -void SvtBroadcaster::Broadcast( const SfxHint &rHint ) -{ - // is anybody to notify? - if( HasListeners() /* && !IsModifyLocked()*/ ) - { -// LockModify(); -// bInModify = TRUE; - - SvtListenerIter aIter( *this ); - SvtListener* pLast = aIter.GoStart(); - if( pLast ) - do { - pLast->Notify( *this, rHint ); - if( !HasListeners() ) // all gone ?? - break; - } while( 0 != ( pLast = aIter.GoNext() )); - -// bInModify = FALSE; -// UnlockModify(); - } -} - -//-------------------------------------------------------------------- - - -// called, if no more listeners exists - -void SvtBroadcaster::ListenersGone() -{ -} - -//-------------------------------------------------------------------- - -// forward a notification to all registered listeners - -void SvtBroadcaster::Forward( SvtBroadcaster& rBC, const SfxHint& rHint ) -{ - // is anybody to notify? - if( rBC.HasListeners() /* && !IsModifyLocked()*/ ) - { -// LockModify(); -// bInModify = TRUE; - - SvtListenerIter aIter( rBC ); - SvtListener* pLast = aIter.GoStart(); - if( pLast ) - do { - pLast->Notify( rBC, rHint ); - if( !rBC.HasListeners() ) // all gone ?? - break; - } while( 0 != ( pLast = aIter.GoNext() )); - -// bInModify = FALSE; -// UnlockModify(); - } -} - - - diff --git a/svtools/source/notify/cancel.cxx b/svtools/source/notify/cancel.cxx deleted file mode 100644 index 32a76a7df9c1..000000000000 --- a/svtools/source/notify/cancel.cxx +++ /dev/null @@ -1,204 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: cancel.cxx,v $ - * $Revision: 1.9 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#define _SFX_CANCEL_CXX -#include - -#include -#include - -#include -#include -#include - -namespace { struct lclMutex : public rtl::Static< ::vos::OMutex, lclMutex >{}; } - -//========================================================================= - -SfxCancelManager::SfxCancelManager( SfxCancelManager *pParent ) -: _pParent( pParent ) -{ -} - -//------------------------------------------------------------------------- - -SfxCancelManager::~SfxCancelManager() -{ - DBG_ASSERT( _pParent || !_aJobs.Count(), "deleting SfxCancelManager in use" ); - for ( USHORT n = _aJobs.Count(); n--; ) - _aJobs.GetObject(n)->SetManager( _pParent ); -} - -//------------------------------------------------------------------------- - -BOOL SfxCancelManager::CanCancel() const - -/* [Beschreibung] - - Liefert TRUE wenn an diesem CancelManager oder an einem Parent - ein Job l"auft. -*/ - -{ - ::vos::OGuard aGuard( lclMutex::get() ); - return _aJobs.Count() > 0 || ( _pParent && _pParent->CanCancel() ); -} - -//------------------------------------------------------------------------- - -void SfxCancelManager::Cancel( BOOL bDeep ) - -/* [Beschreibung] - - Diese Methode markiert alle angemeldeten -Instanzen - als suspendiert. -*/ - -{ - ::vos::OGuard aGuard( lclMutex::get() ); - SfxCancelManagerWeak xWeak( this ); - for ( USHORT n = _aJobs.Count(); n-- && xWeak.Is(); ) - if ( n < _aJobs.Count() ) - _aJobs.GetObject(n)->Cancel(); - if ( xWeak.Is() && _pParent ) - _pParent->Cancel( bDeep ); -} - -//------------------------------------------------------------------------- - -void SfxCancelManager::InsertCancellable( SfxCancellable *pJob ) - -/* [Beschreibung] - - Diese interne Methode tr"agt 'pJob' in die Liste der unterbrechbaren - Jobs ein und Broadcastet dies. Jeder darf nur - maximal einmal angemeldet sein, dies geschiet in seinem Ctor. -*/ - -{ -#ifdef GPF_ON_EMPTY_TITLE - if ( !pJob->GetTitle() ) - { - DBG_ERROR( "SfxCancellable: empty titles not allowed (Vermummungsverbot)" ) - *(int*)0 = 0; - } -#endif - - ::vos::OClearableGuard aGuard( lclMutex::get() ); - _aJobs.C40_INSERT( SfxCancellable, pJob, _aJobs.Count() ); - - aGuard.clear(); - Broadcast( SfxSimpleHint( SFX_HINT_CANCELLABLE ) ); -} - -//------------------------------------------------------------------------- - - -void SfxCancelManager::RemoveCancellable( SfxCancellable *pJob ) - -/* [Beschreibung] - - Diese interne Methode tr"agt 'pJob' aus die Liste der unterbrechbaren - Jobs aus und Broadcastet dies. Dieser Aufruf mu\s paarig nach einem - erfolgen und wird im Dtor des - ausgel"ost. -*/ - -{ - ::vos::OClearableGuard aGuard( lclMutex::get() ); - const SfxCancellable *pTmp = pJob; - USHORT nPos = _aJobs.GetPos( pTmp ); - if ( nPos != 0xFFFF ) - { - _aJobs.Remove( nPos , 1 ); - aGuard.clear(); - Broadcast( SfxSimpleHint( SFX_HINT_CANCELLABLE ) ); - Broadcast( SfxCancelHint( pJob, SFXCANCELHINT_REMOVED ) ); - } -} - -//------------------------------------------------------------------------- - -SfxCancellable::~SfxCancellable() -{ - SfxCancelManager* pMgr = _pMgr; - if ( pMgr ) - pMgr->RemoveCancellable( this ); -} - -//------------------------------------------------------------------------- - -void SfxCancellable::Cancel() - -/* [Description] - - This virtual function is called when the user hits the cancel-button. - If you overload it, you can stop your activities. Please always call - 'SfxCancellable::Cancel()'. -*/ - -{ -#ifdef GFP_ON_NO_CANCEL - if ( _bCancelled < 5 ) - ++_bCancelled; - else - { - delete this; - } -#else - _bCancelled = TRUE; -#endif -} - -//------------------------------------------------------------------------- - -void SfxCancellable::SetManager( SfxCancelManager *pMgr ) -{ - SfxCancelManager* pTmp = _pMgr; - if ( pTmp ) - pTmp->RemoveCancellable( this ); - _pMgr = pMgr; - if ( pMgr ) - pMgr->InsertCancellable( this ); -} - -//------------------------------------------------------------------------- - -TYPEINIT1(SfxCancelHint, SfxHint); - -SfxCancelHint::SfxCancelHint( SfxCancellable* pJob, USHORT _nAction ) -{ - pCancellable = pJob; - nAction = _nAction; -} - - diff --git a/svtools/source/notify/hint.cxx b/svtools/source/notify/hint.cxx deleted file mode 100644 index 9ae3bf8f8b21..000000000000 --- a/svtools/source/notify/hint.cxx +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: hint.cxx,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -#include - -//==================================================================== - -TYPEINIT0(SfxHint); - -//==================================================================== -// virtual dtor for the typical base-class Hint - -SfxHint::~SfxHint() -{ -} - - - diff --git a/svtools/source/notify/isethint.cxx b/svtools/source/notify/isethint.cxx deleted file mode 100644 index 67d484219ac6..000000000000 --- a/svtools/source/notify/isethint.cxx +++ /dev/null @@ -1,78 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: isethint.cxx,v $ - * $Revision: 1.9 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#ifndef GCC -#endif - -#include -#include - -//==================================================================== - -TYPEINIT1(SfxItemSetHint, SfxHint); - -//==================================================================== - -SfxItemSetHint::SfxItemSetHint( SfxItemSet *pItemSet ) - -/* [Beschreibung] - - Dieser Ctor "ubernimmt das als Parameter "ubergeben , - das im Dtor gel"oscht wird. -*/ - -: _pItemSet( pItemSet ) -{ -} - -//-------------------------------------------------------------------- - -SfxItemSetHint::SfxItemSetHint( const SfxItemSet &rItemSet ) - -/* [Beschreibung] - - Dieser Ctor kopiert das als Parameter "ubergeben . -*/ - -: _pItemSet( rItemSet.Clone() ) -{ -} - -//-------------------------------------------------------------------- - -SfxItemSetHint::~SfxItemSetHint() -{ - delete _pItemSet; -} - -//-------------------------------------------------------------------- diff --git a/svtools/source/notify/listener.cxx b/svtools/source/notify/listener.cxx deleted file mode 100644 index 0ce072b44dfb..000000000000 --- a/svtools/source/notify/listener.cxx +++ /dev/null @@ -1,169 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: listener.cxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -#ifndef DEBUG_HXX -#include -#endif - -#include "broadcast.hxx" -#include "listener.hxx" -#include "listenerbase.hxx" -#include "listeneriter.hxx" - - -//==================================================================== -TYPEINIT0(SvtListener); - -//==================================================================== -// simple ctor of class SvtListener - -SvtListener::SvtListener() - : pBrdCastLst( 0 ) -{ -} -//-------------------------------------------------------------------- - -// copy ctor of class SvtListener - -SvtListener::SvtListener( const SvtListener &rListener ) - : pBrdCastLst( 0 ) -{ - SvtListenerBase* pLst = rListener.pBrdCastLst; - while( pLst ) - { - new SvtListenerBase( *this, *pLst->GetBroadcaster() ); - pLst = pLst->GetNext(); - } -} -//-------------------------------------------------------------------- - -// unregisteres the SvtListener from its SvtBroadcasters - -SvtListener::~SvtListener() -{ - EndListeningAll(); -} - -//-------------------------------------------------------------------- - -// registeres at a specific SvtBroadcaster - -BOOL SvtListener::StartListening( SvtBroadcaster& rBroadcaster ) -{ - const SvtListenerBase* pLst = pBrdCastLst; - while( pLst ) - { - if( &rBroadcaster == pLst->GetBroadcaster() ) - { - // double, than return - return FALSE; - } - pLst = pLst->GetNext(); - } - new SvtListenerBase( *this, rBroadcaster ); - return TRUE; -} - -//-------------------------------------------------------------------- - -// unregisteres at a specific SvtBroadcaster - -BOOL SvtListener::EndListening( SvtBroadcaster& rBroadcaster ) -{ - SvtListenerBase *pLst = pBrdCastLst, *pPrev = pLst; - while( pLst ) - { - if( &rBroadcaster == pLst->GetBroadcaster() ) - { - if( pBrdCastLst == pLst ) - pBrdCastLst = pLst->GetNext(); - else - pPrev->SetNext( pLst->GetNext() ); - - delete pLst; - return TRUE; - } - pPrev = pLst; - pLst = pLst->GetNext(); - } - return FALSE; -} - -//-------------------------------------------------------------------- - -// unregisteres all Broadcasters - -void SvtListener::EndListeningAll() -{ - SvtListenerBase *pLst = pBrdCastLst; - while( pLst ) - { - SvtListenerBase *pDel = pLst; - pLst = pLst->GetNext(); - - delete pDel; - } - pBrdCastLst = 0; -} - -//-------------------------------------------------------------------- - -BOOL SvtListener::IsListening( SvtBroadcaster& rBroadcaster ) const -{ - const SvtListenerBase *pLst = pBrdCastLst; - while( pLst ) - { - if( &rBroadcaster == pLst->GetBroadcaster() ) - break; - pLst = pLst->GetNext(); - } - return 0 != pLst; -} - -//-------------------------------------------------------------------- - -// base implementation of notification handler - -void SvtListener::Notify( SvtBroadcaster& -#ifdef DBG_UTIL -rBC -#endif -, const SfxHint& ) -{ - DBG_ASSERT( IsListening( rBC ), - "notification from unregistered broadcaster" ); -} - - diff --git a/svtools/source/notify/listenerbase.cxx b/svtools/source/notify/listenerbase.cxx deleted file mode 100644 index 25f1f1da1901..000000000000 --- a/svtools/source/notify/listenerbase.cxx +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: listenerbase.cxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -#ifndef DEBUG_HXX -#include -#endif - -#include "listenerbase.hxx" -#include "listeneriter.hxx" -#include "listener.hxx" -#include "broadcast.hxx" - - -SvtListenerBase::SvtListenerBase( SvtListener& rLst, - SvtBroadcaster& rBroadcaster ) - : pLeft( 0 ), pRight( 0 ), - pBroadcaster( &rBroadcaster ), pListener( &rLst ) -{ - pNext = rLst.pBrdCastLst; - rLst.pBrdCastLst = this; - - if( pBroadcaster->pRoot ) - { - // set ever behind the root - pRight = pBroadcaster->pRoot->pRight; - pBroadcaster->pRoot->pRight = this; - this->pLeft = pBroadcaster->pRoot; - if( pRight ) - pRight->pLeft = this; - } - else - pBroadcaster->pRoot = this; -} - -SvtListenerBase::~SvtListenerBase() -{ - SvtListenerBase *pR = pRight, *pL = pLeft; - if( pBroadcaster->pRoot ) - pBroadcaster->pRoot = pL ? pL : pR; - - if( pL ) - pL->pRight = pR; - if( pR ) - pR->pLeft = pL; - - SvtListenerIter::RemoveListener( *this, pR ); - - if( !pBroadcaster->pRoot ) - pBroadcaster->ListenersGone(); -} - - diff --git a/svtools/source/notify/listenerbase.hxx b/svtools/source/notify/listenerbase.hxx deleted file mode 100644 index e73f9dfc37c5..000000000000 --- a/svtools/source/notify/listenerbase.hxx +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: listenerbase.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVT_LISTENERBASE_HXX -#define _SVT_LISTENERBASE_HXX - -class SvtBroadcaster; -class SvtListener; - -class SvtListenerBase -{ - SvtListenerBase *pNext; - SvtListenerBase *pLeft, *pRight; - SvtBroadcaster *pBroadcaster; - SvtListener *pListener; - -public: - - SvtListenerBase( SvtListener& rLst, SvtBroadcaster& rBroadcaster ); - ~SvtListenerBase(); - - SvtListenerBase* GetNext() const { return pNext; } - void SetNext( SvtListenerBase* p ) { pNext = p; } - - SvtBroadcaster* GetBroadcaster() const { return pBroadcaster; } - SvtListener* GetListener() const { return pListener; } - - SvtListenerBase* GetLeft() const { return pLeft; } - SvtListenerBase* GetRight() const { return pRight; } -}; - - -#endif - diff --git a/svtools/source/notify/listeneriter.cxx b/svtools/source/notify/listeneriter.cxx deleted file mode 100644 index 08fcb5b7e9ac..000000000000 --- a/svtools/source/notify/listeneriter.cxx +++ /dev/null @@ -1,195 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: listeneriter.cxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif -#include - -#include "listenerbase.hxx" -#include "listeneriter.hxx" -#include "broadcast.hxx" -#include "listener.hxx" - -SvtListenerIter* SvtListenerIter::pListenerIters = 0; - -SvtListenerIter::SvtListenerIter( SvtBroadcaster& rBrdcst ) - : rRoot( rBrdcst ) -{ - // hinten einketten! - pNxtIter = 0; - if( pListenerIters ) - { - SvtListenerIter* pTmp = pListenerIters; - while( pTmp->pNxtIter ) - pTmp = pTmp->pNxtIter; - pTmp->pNxtIter = this; - } - else - pListenerIters = this; - - pAkt = rRoot.pRoot; - pDelNext = pAkt; -} - - - -SvtListenerIter::~SvtListenerIter() -{ - if( pListenerIters ) - { - if( pListenerIters == this ) - pListenerIters = pNxtIter; - else - { - SvtListenerIter* pTmp = pListenerIters; - while( pTmp->pNxtIter != this ) - if( 0 == ( pTmp = pTmp->pNxtIter ) ) - return ; - pTmp->pNxtIter = pNxtIter; - } - } -} - -void SvtListenerIter::RemoveListener( SvtListenerBase& rDel, - SvtListenerBase* pNext ) -{ - // Update the ListenerIter - SvtListenerIter* pTmp = pListenerIters; - while( pTmp ) - { - if( pTmp->pAkt == &rDel || pTmp->pDelNext == &rDel ) - pTmp->pDelNext = pNext; - pTmp = pTmp->pNxtIter; - } -} - -SvtListener* SvtListenerIter::GoNext() -{ - if( pDelNext == pAkt ) - { - pAkt = pAkt->GetRight(); - pDelNext = pAkt; - } - else - pAkt = pDelNext; - return pAkt ? pAkt->GetListener() : 0; -} - - -SvtListener* SvtListenerIter::GoPrev() -{ - if( pDelNext == pAkt ) - pAkt = pAkt->GetLeft(); - else - pAkt = pDelNext->GetLeft(); - pDelNext = pAkt; - return pAkt ? pAkt->GetListener() : 0; -} - - -SvtListener* SvtListenerIter::GoStart() // zum Anfang des Baums -{ - pAkt = rRoot.pRoot; - if( pAkt ) - while( pAkt->GetLeft() ) - pAkt = pAkt->GetLeft(); - pDelNext = pAkt; - return pAkt ? pAkt->GetListener() : 0; -} - - -SvtListener* SvtListenerIter::GoEnd() // zum End des Baums -{ - pAkt = pDelNext; - if( !pAkt ) - pAkt = rRoot.pRoot; - if( pAkt ) - while( pAkt->GetRight() ) - pAkt = pAkt->GetRight(); - pDelNext = pAkt; - return pAkt ? pAkt->GetListener() : 0; -} - - - -SvtListener* SvtListenerIter::First( TypeId nType ) -{ - aSrchId = nType; - GoStart(); - if( pAkt ) - do { - if( pAkt->GetListener()->IsA( aSrchId ) ) - break; - - if( pDelNext == pAkt ) - { - pAkt = pAkt->GetRight(); - pDelNext = pAkt; - } - else - pAkt = pDelNext; - - } while( pAkt ); - return pAkt ? pAkt->GetListener() : 0; -} - - -SvtListener* SvtListenerIter::Next() -{ - do { - // erstmal zum naechsten - if( pDelNext == pAkt ) - { - pAkt = pAkt->GetRight(); - pDelNext = pAkt; - } - else - pAkt = pDelNext; - - if( pAkt && pAkt->GetListener()->IsA( aSrchId ) ) - break; - } while( pAkt ); - return pAkt ? pAkt->GetListener() : 0; -} - - -SvtListener* SvtListenerIter::GoRoot() // wieder ab Root anfangen -{ - pDelNext = pAkt = rRoot.pRoot; - return pAkt ? pAkt->GetListener() : 0; -} - -SvtListener* SvtListenerIter::GetCurr() const // returns the current -{ - return pDelNext ? pDelNext->GetListener() : 0; -} - diff --git a/svtools/source/notify/lstner.cxx b/svtools/source/notify/lstner.cxx deleted file mode 100644 index d7345d7ed3db..000000000000 --- a/svtools/source/notify/lstner.cxx +++ /dev/null @@ -1,196 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: lstner.cxx,v $ - * $Revision: 1.8.60.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -#ifndef DEBUG_HXX -#include -#endif - -#include -#include - -SV_DECL_PTRARR( SfxBroadcasterArr_Impl, SfxBroadcaster*, 0, 2 ) - -#define _SFX_LSTNER_CXX -#include - -//==================================================================== -DBG_NAME(SfxListener) -TYPEINIT0(SfxListener); - -//==================================================================== -// simple ctor of class SfxListener - -SfxListener::SfxListener() -{ - DBG_CTOR(SfxListener, 0); -} -//-------------------------------------------------------------------- - -// copy ctor of class SfxListener - -SfxListener::SfxListener( const SfxListener &rListener ) -{ - DBG_CTOR(SfxListener, 0); - - for ( USHORT n = 0; n < rListener.aBCs.Count(); ++n ) - StartListening( *rListener.aBCs[n] ); -} -//-------------------------------------------------------------------- - -// unregisteres the SfxListener from its SfxBroadcasters - -SfxListener::~SfxListener() -{ - DBG_DTOR(SfxListener, 0); - - // unregister at all remainding broadcasters - for ( USHORT nPos = 0; nPos < aBCs.Count(); ++nPos ) - { - SfxBroadcaster *pBC = aBCs[nPos]; - pBC->RemoveListener(*this); - } -} - -//-------------------------------------------------------------------- - -// unregisteres at a specific SfxBroadcaster - -void SfxListener::RemoveBroadcaster_Impl( SfxBroadcaster& rBC ) -{ - DBG_CHKTHIS(SfxListener, 0); - - const SfxBroadcaster *pBC = &rBC; - aBCs.Remove( aBCs.GetPos(pBC), 1 ); -} - -//-------------------------------------------------------------------- - -// registeres at a specific SfxBroadcaster - -BOOL SfxListener::StartListening( SfxBroadcaster& rBroadcaster, BOOL bPreventDups ) -{ - DBG_CHKTHIS(SfxListener, 0); - - if ( !bPreventDups || !IsListening( rBroadcaster ) ) - { - if ( rBroadcaster.AddListener(*this) ) - { - const SfxBroadcaster *pBC = &rBroadcaster; - aBCs.Insert( pBC, aBCs.Count() ); - - DBG_ASSERT( IsListening(rBroadcaster), "StartListening failed" ); - return TRUE; - } - - } - return FALSE; -} - -//-------------------------------------------------------------------- - -// unregisteres at a specific SfxBroadcaster - -BOOL SfxListener::EndListening( SfxBroadcaster& rBroadcaster, BOOL bAllDups ) -{ - DBG_CHKTHIS(SfxListener, 0); - - if ( !IsListening( rBroadcaster ) ) - return FALSE; - - do - { - rBroadcaster.RemoveListener(*this); - const SfxBroadcaster *pBC = &rBroadcaster; - aBCs.Remove( aBCs.GetPos(pBC), 1 ); - } - while ( bAllDups && IsListening( rBroadcaster ) ); - return TRUE; -} - -//-------------------------------------------------------------------- - -// unregisteres at a specific SfxBroadcaster by index - -void SfxListener::EndListening( USHORT nNo ) -{ - DBG_CHKTHIS(SfxListener, 0); - - SfxBroadcaster *pBC = aBCs.GetObject(nNo); - pBC->RemoveListener(*this); - aBCs.Remove( nNo, 1 ); -} - -//-------------------------------------------------------------------- - -// unregisteres all Broadcasters - -void SfxListener::EndListeningAll() -{ - DBG_CHKTHIS(SfxListener, 0); - - // MI: bei Optimierung beachten: Seiteneffekte von RemoveListener beachten! - while ( aBCs.Count() ) - { - SfxBroadcaster *pBC = aBCs.GetObject(0); - pBC->RemoveListener(*this); - aBCs.Remove( 0, 1 ); - } -} - -//-------------------------------------------------------------------- - -BOOL SfxListener::IsListening( SfxBroadcaster& rBroadcaster ) const -{ - const SfxBroadcaster *pBC = &rBroadcaster; - return USHRT_MAX != aBCs.GetPos( pBC ); -} - -//-------------------------------------------------------------------- - -// base implementation of notification handler - -#ifdef DBG_UTIL -void SfxListener::Notify( SfxBroadcaster& rBC, const SfxHint& ) -#else -void SfxListener::Notify( SfxBroadcaster&, const SfxHint& ) -#endif -{ - #ifdef DBG_UTIL - const SfxBroadcaster *pBC = &rBC; - DBG_ASSERT( USHRT_MAX != aBCs.GetPos(pBC), - "notification from unregistered broadcaster" ); - #endif -} - diff --git a/svtools/source/notify/makefile.mk b/svtools/source/notify/makefile.mk deleted file mode 100644 index 8e4c4b211258..000000000000 --- a/svtools/source/notify/makefile.mk +++ /dev/null @@ -1,67 +0,0 @@ -#************************************************************************* -# -# 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 -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.6 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=svtools -TARGET=notify - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svl.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/smplhint.obj \ - $(SLO)$/hint.obj \ - $(SLO)$/lstner.obj \ - $(SLO)$/isethint.obj \ - $(SLO)$/cancel.obj \ - $(SLO)$/brdcst.obj \ - $(SLO)$/listener.obj \ - $(SLO)$/listenerbase.obj \ - $(SLO)$/listeneriter.obj \ - $(SLO)$/broadcast.obj - -HXX1TARGET= notify -HXX1EXT= hxx -HXX1FILES= $(INC)$/hint.hxx \ - $(INC)$/smplhint.hxx \ - $(INC)$/lstner.hxx \ - $(INC)$/brdcst.hxx -HXX1EXCL= -E:*include* - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/svtools/source/notify/smplhint.cxx b/svtools/source/notify/smplhint.cxx deleted file mode 100644 index 6fddffc23e56..000000000000 --- a/svtools/source/notify/smplhint.cxx +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: smplhint.cxx,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -#include - -//==================================================================== - -TYPEINIT1(SfxSimpleHint, SfxHint); - -//==================================================================== -// creates a SimpleHint with the type nId - -SfxSimpleHint::SfxSimpleHint( ULONG nIdP ) -{ - nId = nIdP; -} - - diff --git a/svtools/source/numbers/makefile.mk b/svtools/source/numbers/makefile.mk deleted file mode 100644 index 46cd3985df1a..000000000000 --- a/svtools/source/numbers/makefile.mk +++ /dev/null @@ -1,78 +0,0 @@ -#************************************************************************* -# -# 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 -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.12.148.1 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=svtools -TARGET=numbers -LIBTARGET=NO - -PROJECTPCH= -PROJECTPCHSOURCE= - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk - -# --- Files -------------------------------------------------------- - -EXCEPTIONSFILES= \ - $(SLO)$/numuno.obj \ - $(SLO)$/numfmuno.obj \ - $(SLO)$/supservs.obj \ - $(SLO)$/zforlist.obj - -SLOFILES = \ - $(EXCEPTIONSFILES) \ - $(SLO)$/zforfind.obj \ - $(SLO)$/zformat.obj \ - $(SLO)$/zforscan.obj \ - $(SLO)$/numhead.obj - -LIB1TARGET= $(SLB)$/$(TARGET).uno.lib -LIB1OBJFILES= \ - $(SLO)$/numfmuno.obj \ - $(SLO)$/supservs.obj - -LIB2TARGET= $(SLB)$/$(TARGET).lib -LIB2OBJFILES= \ - $(SLO)$/zforfind.obj \ - $(SLO)$/zforlist.obj \ - $(SLO)$/zformat.obj \ - $(SLO)$/zforscan.obj \ - $(SLO)$/numuno.obj \ - $(SLO)$/numhead.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/svtools/source/numbers/nbdll.cxx b/svtools/source/numbers/nbdll.cxx deleted file mode 100644 index d7cf20f6059f..000000000000 --- a/svtools/source/numbers/nbdll.cxx +++ /dev/null @@ -1,82 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: nbdll.cxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#ifdef WIN -#include - -#ifndef _SYSDEP_HXX -#include -#endif - -// Statische DLL-Verwaltungs-Variablen -static HINSTANCE hDLLInst = 0; // HANDLE der DLL - - -/*************************************************************************** -|* -|* LibMain() -|* -|* Beschreibung Initialisierungsfunktion der DLL -|* Ersterstellung TH 05.05.93 -|* Letzte Aenderung TH 05.05.93 -|* -***************************************************************************/ - -extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) -{ -#ifndef WNT - if ( nHeap ) - UnlockData( 0 ); -#endif - - hDLLInst = hDLL; - - return TRUE; -} - -/*************************************************************************** -|* -|* WEP() -|* -|* Beschreibung DLL-Deinitialisierung -|* Ersterstellung TH 05.05.93 -|* Letzte Aenderung TH 05.05.93 -|* -***************************************************************************/ - -extern "C" int CALLBACK WEP( int ) -{ - return 1; -} - -#endif diff --git a/svtools/source/numbers/numfmuno.cxx b/svtools/source/numbers/numfmuno.cxx deleted file mode 100644 index d65a2fd696ce..000000000000 --- a/svtools/source/numbers/numfmuno.cxx +++ /dev/null @@ -1,1144 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: numfmuno.cxx,v $ - * $Revision: 1.15 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "numfmuno.hxx" -#include "numuno.hxx" -#include -#include -#include - -using namespace com::sun::star; - -//------------------------------------------------------------------------ - -#define SERVICENAME_NUMBERFORMATTER "com.sun.star.util.NumberFormatter" -#define SERVICENAME_NUMBERSETTINGS "com.sun.star.util.NumberFormatSettings" -#define SERVICENAME_NUMBERFORMATS "com.sun.star.util.NumberFormats" -#define SERVICENAME_NUMBERFORMAT "com.sun.star.util.NumberFormatProperties" - -//------------------------------------------------------------------------ - -#define PROPERTYNAME_FMTSTR "FormatString" -#define PROPERTYNAME_LOCALE "Locale" -#define PROPERTYNAME_TYPE "Type" -#define PROPERTYNAME_COMMENT "Comment" -#define PROPERTYNAME_CURREXT "CurrencyExtension" -#define PROPERTYNAME_CURRSYM "CurrencySymbol" -#define PROPERTYNAME_CURRABB "CurrencyAbbreviation" -#define PROPERTYNAME_DECIMALS "Decimals" -#define PROPERTYNAME_LEADING "LeadingZeros" -#define PROPERTYNAME_NEGRED "NegativeRed" -#define PROPERTYNAME_STDFORM "StandardFormat" -#define PROPERTYNAME_THOUS "ThousandsSeparator" -#define PROPERTYNAME_USERDEF "UserDefined" - -#define PROPERTYNAME_NOZERO "NoZero" -#define PROPERTYNAME_NULLDATE "NullDate" -#define PROPERTYNAME_STDDEC "StandardDecimals" -#define PROPERTYNAME_TWODIGIT "TwoDigitDateStart" - -//------------------------------------------------------------------------ - -// alles ohne Which-ID, Map nur fuer PropertySetInfo - -const SfxItemPropertyMapEntry* lcl_GetNumberFormatPropertyMap() -{ - static SfxItemPropertyMapEntry aNumberFormatPropertyMap_Impl[] = - { - {MAP_CHAR_LEN(PROPERTYNAME_FMTSTR), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, - {MAP_CHAR_LEN(PROPERTYNAME_LOCALE), 0, &getCppuType((lang::Locale*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, - {MAP_CHAR_LEN(PROPERTYNAME_TYPE), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, - {MAP_CHAR_LEN(PROPERTYNAME_COMMENT), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, - {MAP_CHAR_LEN(PROPERTYNAME_CURREXT), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, - {MAP_CHAR_LEN(PROPERTYNAME_CURRSYM), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, - {MAP_CHAR_LEN(PROPERTYNAME_DECIMALS), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, - {MAP_CHAR_LEN(PROPERTYNAME_LEADING), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, - {MAP_CHAR_LEN(PROPERTYNAME_NEGRED), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, - {MAP_CHAR_LEN(PROPERTYNAME_STDFORM), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, - {MAP_CHAR_LEN(PROPERTYNAME_THOUS), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, - {MAP_CHAR_LEN(PROPERTYNAME_USERDEF), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, - {MAP_CHAR_LEN(PROPERTYNAME_CURRABB), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0}, - {0,0,0,0,0,0} - }; - return aNumberFormatPropertyMap_Impl; -} - -const SfxItemPropertyMapEntry* lcl_GetNumberSettingsPropertyMap() -{ - static SfxItemPropertyMapEntry aNumberSettingsPropertyMap_Impl[] = - { - {MAP_CHAR_LEN(PROPERTYNAME_NOZERO), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND, 0}, - {MAP_CHAR_LEN(PROPERTYNAME_NULLDATE), 0, &getCppuType((util::Date*)0), beans::PropertyAttribute::BOUND, 0}, - {MAP_CHAR_LEN(PROPERTYNAME_STDDEC), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND, 0}, - {MAP_CHAR_LEN(PROPERTYNAME_TWODIGIT), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND, 0}, - {0,0,0,0,0,0} - }; - return aNumberSettingsPropertyMap_Impl; -} - -//---------------------------------------------------------------------------------------- - -LanguageType lcl_GetLanguage( const lang::Locale& rLocale ) -{ - // empty language -> LANGUAGE_SYSTEM - if ( rLocale.Language.getLength() == 0 ) - return LANGUAGE_SYSTEM; - - LanguageType eRet = MsLangId::convertLocaleToLanguage( rLocale ); - if ( eRet == LANGUAGE_NONE ) - eRet = LANGUAGE_SYSTEM; //! or throw an exception? - - return eRet; -} - -//---------------------------------------------------------------------------------------- - -SvNumberFormatterServiceObj::SvNumberFormatterServiceObj() - :m_aMutex() -{ -} - -SvNumberFormatterServiceObj::~SvNumberFormatterServiceObj() -{ -} - -com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvNumberFormatterServiceObj_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ) -{ - return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new SvNumberFormatterServiceObj ); -} - -// XNumberFormatter - -void SAL_CALL SvNumberFormatterServiceObj::attachNumberFormatsSupplier( - const uno::Reference& _xSupplier ) - throw(uno::RuntimeException) -{ - ::rtl::Reference< SvNumberFormatsSupplierObj > xAutoReleaseOld; - - // SYNCHRONIZED -> - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - - SvNumberFormatsSupplierObj* pNew = SvNumberFormatsSupplierObj::getImplementation( _xSupplier ); - if (!pNew) - throw uno::RuntimeException(); // wrong object - - xAutoReleaseOld = xSupplier; - - xSupplier = pNew; - m_aMutex = xSupplier->getSharedMutex(); - } - // <- SYNCHRONIZED -} - -uno::Reference SAL_CALL - SvNumberFormatterServiceObj::getNumberFormatsSupplier() - throw(uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - return xSupplier.get(); -} - -sal_Int32 SAL_CALL SvNumberFormatterServiceObj::detectNumberFormat( - sal_Int32 nKey, const rtl::OUString& aString ) - throw(util::NotNumericException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - INT32 nRet = 0; - SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; - if (pFormatter) - { - String aTemp = aString; - sal_uInt32 nUKey = nKey; - double fValue = 0.0; - if ( pFormatter->IsNumberFormat(aTemp, nUKey, fValue) ) - nRet = nUKey; - else - throw util::NotNumericException(); - } - else - throw uno::RuntimeException(); - - return nRet; -} - -double SAL_CALL SvNumberFormatterServiceObj::convertStringToNumber( - sal_Int32 nKey, const rtl::OUString& aString ) - throw(util::NotNumericException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - double fRet = 0.0; - SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; - if (pFormatter) - { - String aTemp = aString; - sal_uInt32 nUKey = nKey; - double fValue = 0.0; - if ( pFormatter->IsNumberFormat(aTemp, nUKey, fValue) ) - fRet = fValue; - else - throw util::NotNumericException(); - } - else - throw uno::RuntimeException(); - - return fRet; -} - -rtl::OUString SAL_CALL SvNumberFormatterServiceObj::convertNumberToString( - sal_Int32 nKey, double fValue ) throw(uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - String aRet; - SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; - if (pFormatter) - { - Color* pColor = NULL; - pFormatter->GetOutputString(fValue, nKey, aRet, &pColor); - } - else - throw uno::RuntimeException(); - - return aRet; -} - -util::Color SAL_CALL SvNumberFormatterServiceObj::queryColorForNumber( sal_Int32 nKey, - double fValue, util::Color aDefaultColor ) - throw(uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - util::Color nRet = aDefaultColor; // color = INT32 - SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; - if (pFormatter) - { - String aStr; - Color* pColor = NULL; - pFormatter->GetOutputString(fValue, nKey, aStr, &pColor); - if (pColor) - nRet = pColor->GetColor(); - // sonst Default behalten - } - else - throw uno::RuntimeException(); - - return nRet; -} - -rtl::OUString SAL_CALL SvNumberFormatterServiceObj::formatString( sal_Int32 nKey, - const rtl::OUString& aString ) throw(uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - String aRet; - SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; - if (pFormatter) - { - String aTemp = aString; - Color* pColor = NULL; - pFormatter->GetOutputString(aTemp, nKey, aRet, &pColor); - } - else - throw uno::RuntimeException(); - - return aRet; -} - -util::Color SAL_CALL SvNumberFormatterServiceObj::queryColorForString( sal_Int32 nKey, - const rtl::OUString& aString,util::Color aDefaultColor ) - throw(uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - util::Color nRet = aDefaultColor; // color = INT32 - SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; - if (pFormatter) - { - String aTemp = aString; - String aStr; - Color* pColor = NULL; - pFormatter->GetOutputString(aTemp, nKey, aStr, &pColor); - if (pColor) - nRet = pColor->GetColor(); - // sonst Default behalten - } - else - throw uno::RuntimeException(); - - return nRet; -} - -rtl::OUString SAL_CALL SvNumberFormatterServiceObj::getInputString( sal_Int32 nKey, double fValue ) - throw(uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - String aRet; - SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; - if (pFormatter) - pFormatter->GetInputLineString(fValue, nKey, aRet); - else - throw uno::RuntimeException(); - - return aRet; -} - -// XNumberFormatPreviewer - -rtl::OUString SAL_CALL SvNumberFormatterServiceObj::convertNumberToPreviewString( - const rtl::OUString& aFormat, double fValue, - const lang::Locale& nLocale, sal_Bool bAllowEnglish ) - throw(util::MalformedNumberFormatException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - String aRet; - SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; - if (pFormatter) - { - String aOutString; - String aFormString = aFormat; - LanguageType eLang = lcl_GetLanguage( nLocale ); - Color* pColor = NULL; - - BOOL bOk; - if ( bAllowEnglish ) - bOk = pFormatter->GetPreviewStringGuess( - aFormString, fValue, aOutString, &pColor, eLang ); - else - bOk = pFormatter->GetPreviewString( - aFormString, fValue, aOutString, &pColor, eLang ); - - if (bOk) - aRet = aOutString; - else - throw util::MalformedNumberFormatException(); - } - else - throw uno::RuntimeException(); - - return aRet; -} - -util::Color SAL_CALL SvNumberFormatterServiceObj::queryPreviewColorForNumber( - const rtl::OUString& aFormat, double fValue, - const lang::Locale& nLocale, sal_Bool bAllowEnglish, - util::Color aDefaultColor ) - throw(util::MalformedNumberFormatException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - util::Color nRet = aDefaultColor; // color = INT32 - SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; - if (pFormatter) - { - String aOutString; - String aFormString = aFormat; - LanguageType eLang = lcl_GetLanguage( nLocale ); - Color* pColor = NULL; - - BOOL bOk; - if ( bAllowEnglish ) - bOk = pFormatter->GetPreviewStringGuess( - aFormString, fValue, aOutString, &pColor, eLang ); - else - bOk = pFormatter->GetPreviewString( - aFormString, fValue, aOutString, &pColor, eLang ); - - if (bOk) - { - if (pColor) - nRet = pColor->GetColor(); - // sonst Default behalten - } - else - throw util::MalformedNumberFormatException(); - } - else - throw uno::RuntimeException(); - - return nRet; -} - -// XServiceInfo - -rtl::OUString SAL_CALL SvNumberFormatterServiceObj::getImplementationName() - throw(uno::RuntimeException) -{ - return rtl::OUString::createFromAscii("com.sun.star.uno.util.numbers.SvNumberFormatterServiceObject"); -} - -sal_Bool SAL_CALL SvNumberFormatterServiceObj::supportsService( const rtl::OUString& ServiceName ) - throw(uno::RuntimeException) -{ - return ( ServiceName.compareToAscii(SERVICENAME_NUMBERFORMATTER) == 0 ); -} - -uno::Sequence SAL_CALL SvNumberFormatterServiceObj::getSupportedServiceNames() - throw(uno::RuntimeException) -{ - uno::Sequence aRet(1); - rtl::OUString* pArray = aRet.getArray(); - pArray[0] = rtl::OUString::createFromAscii(SERVICENAME_NUMBERFORMATTER); - return aRet; -} - -//------------------------------------------------------------------------ - -SvNumberFormatsObj::SvNumberFormatsObj( SvNumberFormatsSupplierObj& _rParent, ::comphelper::SharedMutex& _rMutex ) - :rSupplier( _rParent ) - ,m_aMutex( _rMutex ) -{ - rSupplier.acquire(); -} - -SvNumberFormatsObj::~SvNumberFormatsObj() -{ - rSupplier.release(); -} - -// XNumberFormats - -uno::Reference SAL_CALL SvNumberFormatsObj::getByKey( sal_Int32 nKey ) - throw(uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); - const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : NULL; - if (pFormat) - return new SvNumberFormatObj( rSupplier, nKey, m_aMutex ); - else - throw uno::RuntimeException(); -} - -uno::Sequence SAL_CALL SvNumberFormatsObj::queryKeys( sal_Int16 nType, - const lang::Locale& nLocale, sal_Bool bCreate ) - throw(uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); - if ( pFormatter ) - { - sal_uInt32 nIndex = 0; - LanguageType eLang = lcl_GetLanguage( nLocale ); - SvNumberFormatTable& rTable = bCreate ? - pFormatter->ChangeCL( nType, nIndex, eLang ) : - pFormatter->GetEntryTable( nType, nIndex, eLang ); - sal_uInt32 nCount = rTable.Count(); - uno::Sequence aSeq(nCount); - sal_Int32* pAry = aSeq.getArray(); - for (sal_uInt32 i=0; iGetEntryKey( aFormat, eLang ); - } - else - throw uno::RuntimeException(); - - return nRet; -} - -sal_Int32 SAL_CALL SvNumberFormatsObj::addNew( const rtl::OUString& aFormat, - const lang::Locale& nLocale ) - throw(util::MalformedNumberFormatException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - INT32 nRet = 0; - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); - if (pFormatter) - { - String aFormStr = aFormat; - LanguageType eLang = lcl_GetLanguage( nLocale ); - sal_uInt32 nKey = 0; - xub_StrLen nCheckPos = 0; - short nType = 0; - BOOL bOk = pFormatter->PutEntry( aFormStr, nCheckPos, nType, nKey, eLang ); - if (bOk) - nRet = nKey; - else if (nCheckPos) - { - throw util::MalformedNumberFormatException(); // ungueltiges Format - } - else - throw uno::RuntimeException(); // anderer Fehler (z.B. schon vorhanden) - } - else - throw uno::RuntimeException(); - - return nRet; -} - -sal_Int32 SAL_CALL SvNumberFormatsObj::addNewConverted( const rtl::OUString& aFormat, - const lang::Locale& nLocale, const lang::Locale& nNewLocale ) - throw(util::MalformedNumberFormatException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - INT32 nRet = 0; - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); - if (pFormatter) - { - String aFormStr = aFormat; - LanguageType eLang = lcl_GetLanguage( nLocale ); - LanguageType eNewLang = lcl_GetLanguage( nNewLocale ); - sal_uInt32 nKey = 0; - xub_StrLen nCheckPos = 0; - short nType = 0; - BOOL bOk = pFormatter->PutandConvertEntry( aFormStr, nCheckPos, nType, nKey, eLang, eNewLang ); - if (bOk || nKey > 0) - nRet = nKey; - else if (nCheckPos) - { - throw util::MalformedNumberFormatException(); // ungueltiges Format - } - else - throw uno::RuntimeException(); // anderer Fehler (z.B. schon vorhanden) - } - else - throw uno::RuntimeException(); - - return nRet; -} - -void SAL_CALL SvNumberFormatsObj::removeByKey( sal_Int32 nKey ) throw(uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); - - if (pFormatter) - { - pFormatter->DeleteEntry(nKey); - rSupplier.NumberFormatDeleted(nKey); // Benachrichtigung fuers Dokument - } -} - -rtl::OUString SAL_CALL SvNumberFormatsObj::generateFormat( sal_Int32 nBaseKey, - const lang::Locale& nLocale, sal_Bool bThousands, - sal_Bool bRed, sal_Int16 nDecimals, sal_Int16 nLeading ) - throw(uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - String aRet; - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); - if (pFormatter) - { - LanguageType eLang = lcl_GetLanguage( nLocale ); - pFormatter->GenerateFormat( aRet, nBaseKey, eLang, bThousands, bRed, nDecimals, nLeading ); - } - else - throw uno::RuntimeException(); - - return aRet; -} - -// XNumberFormatTypes - -sal_Int32 SAL_CALL SvNumberFormatsObj::getStandardIndex( const lang::Locale& nLocale ) - throw(uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - INT32 nRet = 0; - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); - if (pFormatter) - { - LanguageType eLang = lcl_GetLanguage( nLocale ); - nRet = pFormatter->GetStandardIndex(eLang); - } - else - throw uno::RuntimeException(); - - return nRet; -} - -sal_Int32 SAL_CALL SvNumberFormatsObj::getStandardFormat( sal_Int16 nType, const lang::Locale& nLocale ) - throw(uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - INT32 nRet = 0; - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); - if (pFormatter) - { - LanguageType eLang = lcl_GetLanguage( nLocale ); - // mask out "defined" bit, so type from an existing number format - // can directly be used for getStandardFormat - nType &= ~NUMBERFORMAT_DEFINED; - nRet = pFormatter->GetStandardFormat(nType, eLang); - } - else - throw uno::RuntimeException(); - - return nRet; -} - -sal_Int32 SAL_CALL SvNumberFormatsObj::getFormatIndex( sal_Int16 nIndex, const lang::Locale& nLocale ) - throw(uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - INT32 nRet = 0; - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); - if (pFormatter) - { - LanguageType eLang = lcl_GetLanguage( nLocale ); - nRet = pFormatter->GetFormatIndex( (NfIndexTableOffset)nIndex, eLang ); - } - else - throw uno::RuntimeException(); - - return nRet; -} - -sal_Bool SAL_CALL SvNumberFormatsObj::isTypeCompatible( sal_Int16 nOldType, sal_Int16 nNewType ) - throw(uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - BOOL bRet = FALSE; - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); - if (pFormatter) - bRet = pFormatter->IsCompatible( nOldType, nNewType ); - else - throw uno::RuntimeException(); - - return bRet; -} - -sal_Int32 SAL_CALL SvNumberFormatsObj::getFormatForLocale( sal_Int32 nKey, const lang::Locale& nLocale ) - throw(uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - INT32 nRet = 0; - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); - if (pFormatter) - { - LanguageType eLang = lcl_GetLanguage( nLocale ); - nRet = pFormatter->GetFormatForLanguageIfBuiltIn(nKey, eLang); - } - else - throw uno::RuntimeException(); - - return nRet; -} - -// XServiceInfo - -rtl::OUString SAL_CALL SvNumberFormatsObj::getImplementationName() - throw(uno::RuntimeException) -{ - return rtl::OUString::createFromAscii("SvNumberFormatsObj"); -} - -sal_Bool SAL_CALL SvNumberFormatsObj::supportsService( const rtl::OUString& ServiceName ) - throw(uno::RuntimeException) -{ - return ( ServiceName.compareToAscii(SERVICENAME_NUMBERFORMATS) == 0 ); -} - -uno::Sequence SAL_CALL SvNumberFormatsObj::getSupportedServiceNames() - throw(uno::RuntimeException) -{ - uno::Sequence aRet(1); - rtl::OUString* pArray = aRet.getArray(); - pArray[0] = rtl::OUString::createFromAscii(SERVICENAME_NUMBERFORMATS); - return aRet; -} - -//------------------------------------------------------------------------ - -SvNumberFormatObj::SvNumberFormatObj( SvNumberFormatsSupplierObj& rParent, ULONG nK, const ::comphelper::SharedMutex& _rMutex ) - :rSupplier( rParent ) - ,nKey( nK ) - ,m_aMutex( _rMutex ) -{ - rSupplier.acquire(); -} - -SvNumberFormatObj::~SvNumberFormatObj() -{ - rSupplier.release(); -} - -// XPropertySet - -uno::Reference SAL_CALL SvNumberFormatObj::getPropertySetInfo() - throw(uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - static uno::Reference aRef = - new SfxItemPropertySetInfo( lcl_GetNumberFormatPropertyMap() ); - return aRef; -} - -void SAL_CALL SvNumberFormatObj::setPropertyValue( const rtl::OUString&, - const uno::Any& ) - throw(beans::UnknownPropertyException, beans::PropertyVetoException, - lang::IllegalArgumentException, lang::WrappedTargetException, - uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); // everything is read-only -} - -uno::Any SAL_CALL SvNumberFormatObj::getPropertyValue( const rtl::OUString& aPropertyName ) - throw(beans::UnknownPropertyException, lang::WrappedTargetException, - uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - uno::Any aRet; - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); - const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : NULL; - if (pFormat) - { - BOOL bThousand, bRed; - USHORT nDecimals, nLeading; - - String aString = aPropertyName; - if (aString.EqualsAscii( PROPERTYNAME_FMTSTR )) - { - aRet <<= rtl::OUString( pFormat->GetFormatstring() ); - } - else if (aString.EqualsAscii( PROPERTYNAME_LOCALE )) - { - lang::Locale aLocale( MsLangId::convertLanguageToLocale( - pFormat->GetLanguage())); - aRet <<= aLocale; - } - else if (aString.EqualsAscii( PROPERTYNAME_TYPE )) - { - aRet <<= (sal_Int16)( pFormat->GetType() ); - } - else if (aString.EqualsAscii( PROPERTYNAME_COMMENT )) - { - aRet <<= rtl::OUString( pFormat->GetComment() ); - } - else if (aString.EqualsAscii( PROPERTYNAME_STDFORM )) - { - //! SvNumberformat Member bStandard rausreichen? - BOOL bStandard = ( ( nKey % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 ); - aRet.setValue( &bStandard, getBooleanCppuType() ); - } - else if (aString.EqualsAscii( PROPERTYNAME_USERDEF )) - { - BOOL bUserDef = ( ( pFormat->GetType() & NUMBERFORMAT_DEFINED ) != 0 ); - aRet.setValue( &bUserDef, getBooleanCppuType() ); - } - else if (aString.EqualsAscii( PROPERTYNAME_DECIMALS )) - { - pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading ); - aRet <<= (sal_Int16)( nDecimals ); - } - else if (aString.EqualsAscii( PROPERTYNAME_LEADING )) - { - pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading ); - aRet <<= (sal_Int16)( nLeading ); - } - else if (aString.EqualsAscii( PROPERTYNAME_NEGRED )) - { - pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading ); - aRet.setValue( &bRed, getBooleanCppuType() ); - } - else if (aString.EqualsAscii( PROPERTYNAME_THOUS )) - { - pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading ); - aRet.setValue( &bThousand, getBooleanCppuType() ); - } - else if (aString.EqualsAscii( PROPERTYNAME_CURRSYM )) - { - String aSymbol, aExt; - pFormat->GetNewCurrencySymbol( aSymbol, aExt ); - aRet <<= rtl::OUString( aSymbol ); - } - else if (aString.EqualsAscii( PROPERTYNAME_CURREXT )) - { - String aSymbol, aExt; - pFormat->GetNewCurrencySymbol( aSymbol, aExt ); - aRet <<= rtl::OUString( aExt ); - } - else if (aString.EqualsAscii( PROPERTYNAME_CURRABB )) - { - String aSymbol, aExt; - BOOL bBank = FALSE; - pFormat->GetNewCurrencySymbol( aSymbol, aExt ); - const NfCurrencyEntry* pCurr = pFormatter->GetCurrencyEntry( bBank, - aSymbol, aExt, pFormat->GetLanguage() ); - if ( pCurr ) - aRet <<= rtl::OUString( pCurr->GetBankSymbol() ); - else - aRet <<= rtl::OUString(); - } - else - throw beans::UnknownPropertyException(); - } - else - throw uno::RuntimeException(); - - return aRet; -} - -void SAL_CALL SvNumberFormatObj::addPropertyChangeListener( const rtl::OUString&, - const uno::Reference&) - throw(beans::UnknownPropertyException, - lang::WrappedTargetException, uno::RuntimeException) -{ - DBG_ERROR("not implemented"); -} - -void SAL_CALL SvNumberFormatObj::removePropertyChangeListener( const rtl::OUString&, - const uno::Reference&) - throw(beans::UnknownPropertyException, - lang::WrappedTargetException, uno::RuntimeException) -{ - DBG_ERROR("not implemented"); -} - -void SAL_CALL SvNumberFormatObj::addVetoableChangeListener( const rtl::OUString&, - const uno::Reference&) - throw(beans::UnknownPropertyException, - lang::WrappedTargetException, uno::RuntimeException) -{ - DBG_ERROR("not implemented"); -} - -void SAL_CALL SvNumberFormatObj::removeVetoableChangeListener( const rtl::OUString&, - const uno::Reference&) - throw(beans::UnknownPropertyException, - lang::WrappedTargetException, uno::RuntimeException) -{ - DBG_ERROR("not implemented"); -} - -// XPropertyAccess - -uno::Sequence SAL_CALL SvNumberFormatObj::getPropertyValues() - throw(uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); - const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : NULL; - if (pFormat) - { - String aSymbol, aExt, aAbb; - BOOL bBank = FALSE; - pFormat->GetNewCurrencySymbol( aSymbol, aExt ); - const NfCurrencyEntry* pCurr = pFormatter->GetCurrencyEntry( bBank, - aSymbol, aExt, pFormat->GetLanguage() ); - if ( pCurr ) - aAbb = pCurr->GetBankSymbol(); - - String aFmtStr = pFormat->GetFormatstring(); - String aComment = pFormat->GetComment(); - BOOL bStandard = ( ( nKey % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 ); - //! SvNumberformat Member bStandard rausreichen? - BOOL bUserDef = ( ( pFormat->GetType() & NUMBERFORMAT_DEFINED ) != 0 ); - BOOL bThousand, bRed; - USHORT nDecimals, nLeading; - pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading ); - lang::Locale aLocale( MsLangId::convertLanguageToLocale( - pFormat->GetLanguage())); - - uno::Sequence aSeq(13); - beans::PropertyValue* pArray = aSeq.getArray(); - - pArray[0].Name = rtl::OUString::createFromAscii( PROPERTYNAME_FMTSTR ); - pArray[0].Value <<= rtl::OUString( aFmtStr ); - pArray[1].Name = rtl::OUString::createFromAscii( PROPERTYNAME_LOCALE ); - pArray[1].Value <<= aLocale; - pArray[2].Name = rtl::OUString::createFromAscii( PROPERTYNAME_TYPE ); - pArray[2].Value <<= (sal_Int16)( pFormat->GetType() ); - pArray[3].Name = rtl::OUString::createFromAscii( PROPERTYNAME_COMMENT ); - pArray[3].Value <<= rtl::OUString( aComment ); - pArray[4].Name = rtl::OUString::createFromAscii( PROPERTYNAME_STDFORM ); - pArray[4].Value.setValue( &bStandard, getBooleanCppuType() ); - pArray[5].Name = rtl::OUString::createFromAscii( PROPERTYNAME_USERDEF ); - pArray[5].Value.setValue( &bUserDef, getBooleanCppuType() ); - pArray[6].Name = rtl::OUString::createFromAscii( PROPERTYNAME_DECIMALS ); - pArray[6].Value <<= (sal_Int16)( nDecimals ); - pArray[7].Name = rtl::OUString::createFromAscii( PROPERTYNAME_LEADING ); - pArray[7].Value <<= (sal_Int16)( nLeading ); - pArray[8].Name = rtl::OUString::createFromAscii( PROPERTYNAME_NEGRED ); - pArray[8].Value.setValue( &bRed, getBooleanCppuType() ); - pArray[9].Name = rtl::OUString::createFromAscii( PROPERTYNAME_THOUS ); - pArray[9].Value.setValue( &bThousand, getBooleanCppuType() ); - pArray[10].Name = rtl::OUString::createFromAscii( PROPERTYNAME_CURRSYM ); - pArray[10].Value <<= rtl::OUString( aSymbol ); - pArray[11].Name = rtl::OUString::createFromAscii( PROPERTYNAME_CURREXT ); - pArray[11].Value <<= rtl::OUString( aExt ); - pArray[12].Name = rtl::OUString::createFromAscii( PROPERTYNAME_CURRABB ); - pArray[12].Value <<= rtl::OUString( aAbb ); - - return aSeq; - } - else - throw uno::RuntimeException(); -} - -void SAL_CALL SvNumberFormatObj::setPropertyValues( const uno::Sequence& ) - throw(beans::UnknownPropertyException, beans::PropertyVetoException, - lang::IllegalArgumentException, lang::WrappedTargetException, - uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); // everything is read-only -} - -// XServiceInfo - -rtl::OUString SAL_CALL SvNumberFormatObj::getImplementationName() - throw(uno::RuntimeException) -{ - return rtl::OUString::createFromAscii("SvNumberFormatObj"); -} - -sal_Bool SAL_CALL SvNumberFormatObj::supportsService( const rtl::OUString& ServiceName ) - throw(uno::RuntimeException) -{ - return ( ServiceName.compareToAscii(SERVICENAME_NUMBERFORMAT) == 0 ); -} - -uno::Sequence SAL_CALL SvNumberFormatObj::getSupportedServiceNames() - throw(uno::RuntimeException) -{ - uno::Sequence aRet(1); - rtl::OUString* pArray = aRet.getArray(); - pArray[0] = rtl::OUString::createFromAscii(SERVICENAME_NUMBERFORMAT); - return aRet; -} - -//------------------------------------------------------------------------ - -SvNumberFormatSettingsObj::SvNumberFormatSettingsObj( SvNumberFormatsSupplierObj& rParent, const ::comphelper::SharedMutex& _rMutex ) - :rSupplier( rParent ) - ,m_aMutex( _rMutex ) -{ - rSupplier.acquire(); -} - -SvNumberFormatSettingsObj::~SvNumberFormatSettingsObj() -{ - rSupplier.release(); -} - -// XPropertySet - -uno::Reference SAL_CALL SvNumberFormatSettingsObj::getPropertySetInfo() - throw(uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - static uno::Reference aRef = - new SfxItemPropertySetInfo( lcl_GetNumberSettingsPropertyMap() ); - return aRef; -} - -void SAL_CALL SvNumberFormatSettingsObj::setPropertyValue( const rtl::OUString& aPropertyName, - const uno::Any& aValue ) - throw(beans::UnknownPropertyException, beans::PropertyVetoException, - lang::IllegalArgumentException, lang::WrappedTargetException, - uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); - if (pFormatter) - { - String aString = aPropertyName; - if (aString.EqualsAscii( PROPERTYNAME_NOZERO )) - { - // operator >>= shouldn't be used for bool (?) - if ( aValue.getValueTypeClass() == uno::TypeClass_BOOLEAN ) - pFormatter->SetNoZero( *(sal_Bool*)aValue.getValue() ); - } - else if (aString.EqualsAscii( PROPERTYNAME_NULLDATE )) - { - util::Date aDate; - if ( aValue >>= aDate ) - pFormatter->ChangeNullDate( aDate.Day, aDate.Month, aDate.Year ); - } - else if (aString.EqualsAscii( PROPERTYNAME_STDDEC )) - { - sal_Int16 nInt16 = sal_Int16(); - if ( aValue >>= nInt16 ) - pFormatter->ChangeStandardPrec( nInt16 ); - } - else if (aString.EqualsAscii( PROPERTYNAME_TWODIGIT )) - { - sal_Int16 nInt16 = sal_Int16(); - if ( aValue >>= nInt16 ) - pFormatter->SetYear2000( nInt16 ); - } - else - throw beans::UnknownPropertyException(); - - rSupplier.SettingsChanged(); - } - else - throw uno::RuntimeException(); -} - -uno::Any SAL_CALL SvNumberFormatSettingsObj::getPropertyValue( const rtl::OUString& aPropertyName ) - throw(beans::UnknownPropertyException, lang::WrappedTargetException, - uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - uno::Any aRet; - SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); - if (pFormatter) - { - String aString = aPropertyName; - if (aString.EqualsAscii( PROPERTYNAME_NOZERO )) - { - BOOL bNoZero = pFormatter->GetNoZero(); - aRet.setValue( &bNoZero, getBooleanCppuType() ); - } - else if (aString.EqualsAscii( PROPERTYNAME_NULLDATE )) - { - Date* pDate = pFormatter->GetNullDate(); - if (pDate) - { - util::Date aUnoDate( pDate->GetDay(), pDate->GetMonth(), pDate->GetYear() ); - aRet <<= aUnoDate; - } - } - else if (aString.EqualsAscii( PROPERTYNAME_STDDEC )) - aRet <<= (sal_Int16)( pFormatter->GetStandardPrec() ); - else if (aString.EqualsAscii( PROPERTYNAME_TWODIGIT )) - aRet <<= (sal_Int16)( pFormatter->GetYear2000() ); - else - throw beans::UnknownPropertyException(); - } - else - throw uno::RuntimeException(); - - return aRet; -} - -void SAL_CALL SvNumberFormatSettingsObj::addPropertyChangeListener( const rtl::OUString&, - const uno::Reference&) - throw(beans::UnknownPropertyException, - lang::WrappedTargetException, uno::RuntimeException) -{ - DBG_ERROR("not implemented"); -} - -void SAL_CALL SvNumberFormatSettingsObj::removePropertyChangeListener( const rtl::OUString&, - const uno::Reference&) - throw(beans::UnknownPropertyException, - lang::WrappedTargetException, uno::RuntimeException) -{ - DBG_ERROR("not implemented"); -} - -void SAL_CALL SvNumberFormatSettingsObj::addVetoableChangeListener( const rtl::OUString&, - const uno::Reference&) - throw(beans::UnknownPropertyException, - lang::WrappedTargetException, uno::RuntimeException) -{ - DBG_ERROR("not implemented"); -} - -void SAL_CALL SvNumberFormatSettingsObj::removeVetoableChangeListener( const rtl::OUString&, - const uno::Reference&) - throw(beans::UnknownPropertyException, - lang::WrappedTargetException, uno::RuntimeException) -{ - DBG_ERROR("not implemented"); -} - -// XServiceInfo - -rtl::OUString SAL_CALL SvNumberFormatSettingsObj::getImplementationName() - throw(uno::RuntimeException) -{ - return rtl::OUString::createFromAscii("SvNumberFormatSettingsObj"); -} - -sal_Bool SAL_CALL SvNumberFormatSettingsObj::supportsService( const rtl::OUString& ServiceName ) - throw(uno::RuntimeException) -{ - return ( ServiceName.compareToAscii(SERVICENAME_NUMBERSETTINGS) == 0 ); -} - -uno::Sequence SAL_CALL SvNumberFormatSettingsObj::getSupportedServiceNames() - throw(uno::RuntimeException) -{ - uno::Sequence aRet(1); - rtl::OUString* pArray = aRet.getArray(); - pArray[0] = rtl::OUString::createFromAscii(SERVICENAME_NUMBERSETTINGS); - return aRet; -} - - diff --git a/svtools/source/numbers/numfmuno.hxx b/svtools/source/numbers/numfmuno.hxx deleted file mode 100644 index 4148069fb37e..000000000000 --- a/svtools/source/numbers/numfmuno.hxx +++ /dev/null @@ -1,324 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: numfmuno.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _NUMFMUNO_HXX -#define _NUMFMUNO_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class SvNumberformat; -class SvNumberFormatter; -class SvNumberFormatsSupplierObj; - - -// SvNumberFormatterServiceObj wird global als Service angemeldet - -class SvNumberFormatterServiceObj : public cppu::WeakImplHelper3< - com::sun::star::util::XNumberFormatter, - com::sun::star::util::XNumberFormatPreviewer, - com::sun::star::lang::XServiceInfo> -{ -private: - ::rtl::Reference< SvNumberFormatsSupplierObj > xSupplier; - mutable ::comphelper::SharedMutex m_aMutex; - -public: - SvNumberFormatterServiceObj(); - virtual ~SvNumberFormatterServiceObj(); - - // XNumberFormatter - virtual void SAL_CALL attachNumberFormatsSupplier( - const ::com::sun::star::uno::Reference< - ::com::sun::star::util::XNumberFormatsSupplier >& xSupplier ) - throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > - SAL_CALL getNumberFormatsSupplier() - throw(::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL detectNumberFormat( sal_Int32 nKey, const ::rtl::OUString& aString ) - throw(::com::sun::star::util::NotNumericException, - ::com::sun::star::uno::RuntimeException); - virtual double SAL_CALL convertStringToNumber( sal_Int32 nKey, const ::rtl::OUString& aString ) - throw(::com::sun::star::util::NotNumericException, - ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL convertNumberToString( sal_Int32 nKey, double fValue ) - throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::util::Color SAL_CALL queryColorForNumber( sal_Int32 nKey, - double fValue, ::com::sun::star::util::Color aDefaultColor ) - throw(::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL formatString( sal_Int32 nKey, const ::rtl::OUString& aString ) - throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::util::Color SAL_CALL queryColorForString( sal_Int32 nKey, - const ::rtl::OUString& aString, - ::com::sun::star::util::Color aDefaultColor ) - throw(::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getInputString( sal_Int32 nKey, double fValue ) - throw(::com::sun::star::uno::RuntimeException); - - // XNumberFormatPreviewer - virtual ::rtl::OUString SAL_CALL convertNumberToPreviewString( - const ::rtl::OUString& aFormat, double fValue, - const ::com::sun::star::lang::Locale& nLocale, sal_Bool bAllowEnglish ) - throw(::com::sun::star::util::MalformedNumberFormatException, - ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::util::Color SAL_CALL queryPreviewColorForNumber( - const ::rtl::OUString& aFormat, double fValue, - const ::com::sun::star::lang::Locale& nLocale, sal_Bool bAllowEnglish, - ::com::sun::star::util::Color aDefaultColor ) - throw(::com::sun::star::util::MalformedNumberFormatException, - ::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) - throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) - throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() - throw(::com::sun::star::uno::RuntimeException); -}; - - -class SvNumberFormatsObj : public cppu::WeakImplHelper3< - com::sun::star::util::XNumberFormats, - com::sun::star::util::XNumberFormatTypes, - com::sun::star::lang::XServiceInfo> -{ -private: - SvNumberFormatsSupplierObj& rSupplier; - mutable ::comphelper::SharedMutex m_aMutex; - -public: - SvNumberFormatsObj(SvNumberFormatsSupplierObj& pParent, ::comphelper::SharedMutex& _rMutex); - virtual ~SvNumberFormatsObj(); - - - // XNumberFormats - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL - getByKey( sal_Int32 nKey ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL queryKeys( sal_Int16 nType, - const ::com::sun::star::lang::Locale& nLocale, sal_Bool bCreate ) - throw(::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL queryKey( const ::rtl::OUString& aFormat, - const ::com::sun::star::lang::Locale& nLocale, sal_Bool bScan ) - throw(::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL addNew( const ::rtl::OUString& aFormat, - const ::com::sun::star::lang::Locale& nLocale ) - throw(::com::sun::star::util::MalformedNumberFormatException, - ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL addNewConverted( const ::rtl::OUString& aFormat, - const ::com::sun::star::lang::Locale& nLocale, - const ::com::sun::star::lang::Locale& nNewLocale ) - throw(::com::sun::star::util::MalformedNumberFormatException, - ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeByKey( sal_Int32 nKey ) throw(::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL generateFormat( sal_Int32 nBaseKey, - const ::com::sun::star::lang::Locale& nLocale, sal_Bool bThousands, - sal_Bool bRed, sal_Int16 nDecimals, sal_Int16 nLeading ) - throw(::com::sun::star::uno::RuntimeException); - - // XNumberFormatTypes - virtual sal_Int32 SAL_CALL getStandardIndex( const ::com::sun::star::lang::Locale& nLocale ) - throw(::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getStandardFormat( sal_Int16 nType, - const ::com::sun::star::lang::Locale& nLocale ) - throw(::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getFormatIndex( sal_Int16 nIndex, - const ::com::sun::star::lang::Locale& nLocale ) - throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isTypeCompatible( sal_Int16 nOldType, sal_Int16 nNewType ) - throw(::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getFormatForLocale( sal_Int32 nKey, - const ::com::sun::star::lang::Locale& nLocale ) - throw(::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) - throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) - throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() - throw(::com::sun::star::uno::RuntimeException); - -private: - SvNumberFormatsObj(); // never implemented -}; - - -class SvNumberFormatObj : public cppu::WeakImplHelper3< - com::sun::star::beans::XPropertySet, - com::sun::star::beans::XPropertyAccess, - com::sun::star::lang::XServiceInfo> -{ -private: - SvNumberFormatsSupplierObj& rSupplier; - ULONG nKey; - mutable ::comphelper::SharedMutex m_aMutex; - -public: - SvNumberFormatObj( SvNumberFormatsSupplierObj& rParent, ULONG nK, const ::comphelper::SharedMutex& _rMutex ); - virtual ~SvNumberFormatObj(); - - // XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > - SAL_CALL getPropertySetInfo( ) - throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, - const ::com::sun::star::uno::Any& aValue ) - throw(::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::beans::PropertyVetoException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( - const ::rtl::OUString& PropertyName ) - throw(::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, - const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertyChangeListener >& xListener ) - throw(::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, - const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertyChangeListener >& aListener ) - throw(::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, - const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XVetoableChangeListener >& aListener ) - throw(::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, - const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XVetoableChangeListener >& aListener ) - throw(::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException); - - // XPropertyAccess - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL - getPropertyValues() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< - ::com::sun::star::beans::PropertyValue >& aProps ) - throw(::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::beans::PropertyVetoException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) - throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) - throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() - throw(::com::sun::star::uno::RuntimeException); -}; - - -class SvNumberFormatSettingsObj : public cppu::WeakImplHelper2< - com::sun::star::beans::XPropertySet, - com::sun::star::lang::XServiceInfo> -{ -private: - SvNumberFormatsSupplierObj& rSupplier; - mutable ::comphelper::SharedMutex m_aMutex; - -public: - SvNumberFormatSettingsObj( SvNumberFormatsSupplierObj& rParent, const ::comphelper::SharedMutex& _rMutex); - virtual ~SvNumberFormatSettingsObj(); - - - // XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > - SAL_CALL getPropertySetInfo( ) - throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, - const ::com::sun::star::uno::Any& aValue ) - throw(::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::beans::PropertyVetoException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( - const ::rtl::OUString& PropertyName ) - throw(::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, - const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertyChangeListener >& xListener ) - throw(::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, - const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertyChangeListener >& aListener ) - throw(::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, - const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XVetoableChangeListener >& aListener ) - throw(::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, - const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XVetoableChangeListener >& aListener ) - throw(::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) - throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) - throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() - throw(::com::sun::star::uno::RuntimeException); -}; - - - -#endif - diff --git a/svtools/source/numbers/numhead.cxx b/svtools/source/numbers/numhead.cxx deleted file mode 100644 index 7e79aad624f3..000000000000 --- a/svtools/source/numbers/numhead.cxx +++ /dev/null @@ -1,252 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: numhead.cxx,v $ - * $Revision: 1.9 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif -#include - -#include "numhead.hxx" - -// ID's fuer Dateien: -#define SV_NUMID_SIZES 0x4200 - -// STATIC DATA ----------------------------------------------------------- - -//SEG_EOFGLOBALS() - -// ======================================================================= -/* wird fuer SvNumberformatter nicht gebraucht -//#pragma SEG_FUNCDEF(numhead_01) - -SvNumReadHeader::SvNumReadHeader(SvStream& rNewStream) : - rStream( rNewStream ) -{ - ULONG nDataSize; - rStream >> nDataSize; - nDataEnd = rStream.Tell() + nDataSize; -} - -//#pragma SEG_FUNCDEF(numhead_02) - -SvNumReadHeader::~SvNumReadHeader() -{ - ULONG nReadEnd = rStream.Tell(); - DBG_ASSERT( nReadEnd <= nDataEnd, "zuviele Bytes gelesen" ); - if ( nReadEnd != nDataEnd ) - rStream.Seek(nDataEnd); // Rest ueberspringen -} - -//#pragma SEG_FUNCDEF(numhead_03) - -ULONG SvNumReadHeader::BytesLeft() const -{ - ULONG nReadEnd = rStream.Tell(); - if (nReadEnd <= nDataEnd) - return nDataEnd-nReadEnd; - - DBG_ERROR("Fehler bei SvNumReadHeader::BytesLeft"); - return 0; -} - -// ----------------------------------------------------------------------- - -//#pragma SEG_FUNCDEF(numhead_04) - -SvNumWriteHeader::SvNumWriteHeader(SvStream& rNewStream, ULONG nDefault) : - rStream( rNewStream ) -{ - nDataSize = nDefault; - rStream << nDataSize; - nDataPos = rStream.Tell(); -} - -//#pragma SEG_FUNCDEF(numhead_05) - -SvNumWriteHeader::~SvNumWriteHeader() -{ - ULONG nPos = rStream.Tell(); - - if ( nPos - nDataPos != nDataSize ) // Default getroffen? - { - nDataSize = nPos - nDataPos; - rStream.Seek(nDataPos - sizeof(sal_uInt32)); - rStream << nDataSize; // Groesse am Anfang eintragen - rStream.Seek(nPos); - } -} -*/ - -// ======================================================================= - -//#pragma SEG_FUNCDEF(numhead_06) - -//! mit Skip() synchron -ImpSvNumMultipleReadHeader::ImpSvNumMultipleReadHeader(SvStream& rNewStream) : - rStream( rNewStream ) -{ - sal_uInt32 nDataSize; - rStream >> nDataSize; - ULONG nDataPos = rStream.Tell(); - nEntryEnd = nDataPos; - - rStream.SeekRel(nDataSize); - USHORT nID; - rStream >> nID; - if (nID != SV_NUMID_SIZES) - { - DBG_ERROR("SV_NUMID_SIZES nicht gefunden"); - } - sal_uInt32 nSizeTableLen; - rStream >> nSizeTableLen; - pBuf = new char[nSizeTableLen]; - rStream.Read( pBuf, nSizeTableLen ); - pMemStream = new SvMemoryStream( pBuf, nSizeTableLen, STREAM_READ ); - - nEndPos = rStream.Tell(); - rStream.Seek( nDataPos ); -} - -//#pragma SEG_FUNCDEF(numhead_07) - -ImpSvNumMultipleReadHeader::~ImpSvNumMultipleReadHeader() -{ - DBG_ASSERT( pMemStream->Tell() == pMemStream->GetSize(), - "Sizes nicht vollstaendig gelesen" ); - delete pMemStream; - delete [] pBuf; - - rStream.Seek(nEndPos); -} - -//! mit ctor synchron -// static -void ImpSvNumMultipleReadHeader::Skip( SvStream& rStream ) -{ - sal_uInt32 nDataSize; - rStream >> nDataSize; - rStream.SeekRel( nDataSize ); - USHORT nID; - rStream >> nID; - if ( nID != SV_NUMID_SIZES ) - { - DBG_ERROR("SV_NUMID_SIZES nicht gefunden"); - } - sal_uInt32 nSizeTableLen; - rStream >> nSizeTableLen; - rStream.SeekRel( nSizeTableLen ); -} - -//#pragma SEG_FUNCDEF(numhead_08) - -void ImpSvNumMultipleReadHeader::EndEntry() -{ - ULONG nPos = rStream.Tell(); - DBG_ASSERT( nPos <= nEntryEnd, "zuviel gelesen" ); - if ( nPos != nEntryEnd ) - rStream.Seek( nEntryEnd ); // Rest ueberspringen -} - -//#pragma SEG_FUNCDEF(numhead_0d) - -void ImpSvNumMultipleReadHeader::StartEntry() -{ - ULONG nPos = rStream.Tell(); - sal_uInt32 nEntrySize; - (*pMemStream) >> nEntrySize; - - nEntryEnd = nPos + nEntrySize; -} - -//#pragma SEG_FUNCDEF(numhead_09) - -ULONG ImpSvNumMultipleReadHeader::BytesLeft() const -{ - ULONG nReadEnd = rStream.Tell(); - if (nReadEnd <= nEntryEnd) - return nEntryEnd-nReadEnd; - - DBG_ERROR("Fehler bei ImpSvNumMultipleReadHeader::BytesLeft"); - return 0; -} - -// ----------------------------------------------------------------------- - -//#pragma SEG_FUNCDEF(numhead_0a) - -ImpSvNumMultipleWriteHeader::ImpSvNumMultipleWriteHeader(SvStream& rNewStream, - ULONG nDefault) : - rStream( rNewStream ), - aMemStream( 4096, 4096 ) -{ - nDataSize = nDefault; - rStream << nDataSize; - - nDataPos = rStream.Tell(); - nEntryStart = nDataPos; -} - -//#pragma SEG_FUNCDEF(numhead_0b) - -ImpSvNumMultipleWriteHeader::~ImpSvNumMultipleWriteHeader() -{ - ULONG nDataEnd = rStream.Tell(); - - rStream << (USHORT) SV_NUMID_SIZES; - rStream << static_cast(aMemStream.Tell()); - rStream.Write( aMemStream.GetData(), aMemStream.Tell() ); - - if ( nDataEnd - nDataPos != nDataSize ) // Default getroffen? - { - nDataSize = nDataEnd - nDataPos; - ULONG nPos = rStream.Tell(); - rStream.Seek(nDataPos-sizeof(sal_uInt32)); - rStream << nDataSize; // Groesse am Anfang eintragen - rStream.Seek(nPos); - } -} - -//#pragma SEG_FUNCDEF(numhead_0c) - -void ImpSvNumMultipleWriteHeader::EndEntry() -{ - ULONG nPos = rStream.Tell(); - aMemStream << static_cast(nPos - nEntryStart); -} - -//#pragma SEG_FUNCDEF(numhead_0e) - -void ImpSvNumMultipleWriteHeader::StartEntry() -{ - ULONG nPos = rStream.Tell(); - nEntryStart = nPos; -} - diff --git a/svtools/source/numbers/numhead.hxx b/svtools/source/numbers/numhead.hxx deleted file mode 100644 index de23b3cbccf4..000000000000 --- a/svtools/source/numbers/numhead.hxx +++ /dev/null @@ -1,109 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: numhead.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef NF_NUMHEAD_HXX -#define NF_NUMHEAD_HXX - -#include - -// ----------------------------------------------------------------------- - - // "Automatischer" Record-Header mit Groessenangabe - -/* wird fuer SvNumberFormatter nicht gebraucht -class SvNumReadHeader -{ -private: - SvStream& rStream; - ULONG nDataEnd; - -public: - SvNumReadHeader(SvStream& rNewStream); - ~SvNumReadHeader(); - - ULONG BytesLeft() const; -}; - -class SvNumWriteHeader -{ -private: - SvStream& rStream; - ULONG nDataPos; - ULONG nDataSize; - -public: - SvNumWriteHeader(SvStream& rNewStream, ULONG nDefault = 0); - ~SvNumWriteHeader(); -}; - -*/ - - // Header mit Groessenangaben fuer mehrere Objekte - -class ImpSvNumMultipleReadHeader -{ -private: - SvStream& rStream; - char* pBuf; - SvMemoryStream* pMemStream; - ULONG nEndPos; - ULONG nEntryEnd; - -public: - ImpSvNumMultipleReadHeader(SvStream& rNewStream); - ~ImpSvNumMultipleReadHeader(); - - void StartEntry(); - void EndEntry(); - ULONG BytesLeft() const; - - static void Skip( SvStream& ); // komplett ueberspringen -}; - -class ImpSvNumMultipleWriteHeader -{ -private: - SvStream& rStream; - SvMemoryStream aMemStream; - ULONG nDataPos; - sal_uInt32 nDataSize; - ULONG nEntryStart; - -public: - ImpSvNumMultipleWriteHeader(SvStream& rNewStream, ULONG nDefault = 0); - ~ImpSvNumMultipleWriteHeader(); - - void StartEntry(); - void EndEntry(); -}; - -#endif - - diff --git a/svtools/source/numbers/numuno.cxx b/svtools/source/numbers/numuno.cxx deleted file mode 100644 index f91bf82b4e60..000000000000 --- a/svtools/source/numbers/numuno.cxx +++ /dev/null @@ -1,171 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: numuno.cxx,v $ - * $Revision: 1.9 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -#define _ZFORLIST_DECLARE_TABLE - -#include -#include -#include -#include -#include -#include - -#include "numuno.hxx" -#include "numfmuno.hxx" -#include - -using namespace com::sun::star; - -//------------------------------------------------------------------------ - -class SvNumFmtSuppl_Impl -{ -public: - SvNumberFormatter* pFormatter; - mutable ::comphelper::SharedMutex aMutex; - - SvNumFmtSuppl_Impl(SvNumberFormatter* p) : - pFormatter(p) {} -}; - -//------------------------------------------------------------------------ - -// Default-ctor fuer getReflection -SvNumberFormatsSupplierObj::SvNumberFormatsSupplierObj() -{ - pImpl = new SvNumFmtSuppl_Impl(NULL); -} - -SvNumberFormatsSupplierObj::SvNumberFormatsSupplierObj(SvNumberFormatter* pForm) -{ - pImpl = new SvNumFmtSuppl_Impl(pForm); -} - -SvNumberFormatsSupplierObj::~SvNumberFormatsSupplierObj() -{ - delete pImpl; -} - -::comphelper::SharedMutex& SvNumberFormatsSupplierObj::getSharedMutex() const -{ - return pImpl->aMutex; -} - -SvNumberFormatter* SvNumberFormatsSupplierObj::GetNumberFormatter() const -{ - return pImpl->pFormatter; -} - -void SvNumberFormatsSupplierObj::SetNumberFormatter(SvNumberFormatter* pNew) -{ - // der alte Numberformatter ist ungueltig geworden, nicht mehr darauf zugreifen! - pImpl->pFormatter = pNew; -} - -void SvNumberFormatsSupplierObj::NumberFormatDeleted(sal_uInt32) -{ - // Basis-Implementierung tut nix... -} - -void SvNumberFormatsSupplierObj::SettingsChanged() -{ - // Basis-Implementierung tut nix... -} - -// XNumberFormatsSupplier - -uno::Reference SAL_CALL SvNumberFormatsSupplierObj::getNumberFormatSettings() - throw(uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( pImpl->aMutex ); - - return new SvNumberFormatSettingsObj( *this, pImpl->aMutex ); -} - -uno::Reference SAL_CALL SvNumberFormatsSupplierObj::getNumberFormats() - throw(uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( pImpl->aMutex ); - - return new SvNumberFormatsObj( *this, pImpl->aMutex ); -} - -// XUnoTunnel - -sal_Int64 SAL_CALL SvNumberFormatsSupplierObj::getSomething( - const uno::Sequence& rId ) throw(uno::RuntimeException) -{ - if ( rId.getLength() == 16 && - 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast(reinterpret_cast(this)); - } - return 0; -} - -// static -const uno::Sequence& SvNumberFormatsSupplierObj::getUnoTunnelId() -{ - static uno::Sequence * pSeq = 0; - if( !pSeq ) - { - osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); - if( !pSeq ) - { - static uno::Sequence< sal_Int8 > aSeq( 16 ); - rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); - pSeq = &aSeq; - } - } - return *pSeq; -} - -// static -SvNumberFormatsSupplierObj* SvNumberFormatsSupplierObj::getImplementation( - const uno::Reference xObj ) -{ - SvNumberFormatsSupplierObj* pRet = NULL; - uno::Reference xUT( xObj, uno::UNO_QUERY ); - if (xUT.is()) - pRet = reinterpret_cast(sal::static_int_cast(xUT->getSomething( getUnoTunnelId() ))); - return pRet; -} - - -//------------------------------------------------------------------------ - - - diff --git a/svtools/source/numbers/supservs.cxx b/svtools/source/numbers/supservs.cxx deleted file mode 100644 index 1035cd056406..000000000000 --- a/svtools/source/numbers/supservs.cxx +++ /dev/null @@ -1,233 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: supservs.cxx,v $ - * $Revision: 1.10 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include "supservs.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include "instrm.hxx" - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::util; -using namespace ::vos; -using namespace ::utl; - -#define PERSISTENT_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.util.NumberFormatsSupplier"); - -//------------------------------------------------------------------------- -Reference< XInterface > SAL_CALL SvNumberFormatsSupplierServiceObject_CreateInstance(const Reference< XMultiServiceFactory >& _rxFactory) -{ - return static_cast< ::cppu::OWeakObject* >(new SvNumberFormatsSupplierServiceObject(_rxFactory)); -} - -//------------------------------------------------------------------------- -SvNumberFormatsSupplierServiceObject::SvNumberFormatsSupplierServiceObject(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB) - :m_pOwnFormatter(NULL) - ,m_xORB(_rxORB) -{ -} - -//------------------------------------------------------------------------- -SvNumberFormatsSupplierServiceObject::~SvNumberFormatsSupplierServiceObject() -{ - if (m_pOwnFormatter) - { - delete m_pOwnFormatter; - m_pOwnFormatter = NULL; - } -} - -//------------------------------------------------------------------------- -Any SAL_CALL SvNumberFormatsSupplierServiceObject::queryAggregation( const Type& _rType ) throw (RuntimeException) -{ - Any aReturn = ::cppu::queryInterface(_rType, - static_cast< XInitialization* >(this), - static_cast< XPersistObject* >(this), - static_cast< XServiceInfo* >(this) - ); - - if (!aReturn.hasValue()) - aReturn = SvNumberFormatsSupplierObj::queryAggregation(_rType); - - return aReturn; -} - -//------------------------------------------------------------------------- -void SAL_CALL SvNumberFormatsSupplierServiceObject::initialize( const Sequence< Any >& _rArguments ) throw(Exception, RuntimeException) -{ - ::osl::MutexGuard aGuard( getSharedMutex() ); - - DBG_ASSERT(m_pOwnFormatter == NULL, - "SvNumberFormatsSupplierServiceObject::initialize : already initialized !"); - // maybe you already called a method which needed the formatter - // you should use XMultiServiceFactory::createInstanceWithArguments to avoid that - if (m_pOwnFormatter) - { // !!! this is only a emergency handling, normally this should not occur !!! - delete m_pOwnFormatter; - m_pOwnFormatter = NULL; - SetNumberFormatter(m_pOwnFormatter); - } - - Type aExpectedArgType = ::getCppuType(static_cast(NULL)); - LanguageType eNewFormatterLanguage = LANGUAGE_ENGLISH_US; - // the default - - const Any* pArgs = _rArguments.getConstArray(); - for (sal_Int32 i=0; i<_rArguments.getLength(); ++i, ++pArgs) - { - if (pArgs->getValueType().equals(aExpectedArgType)) - { - Locale aLocale; - *pArgs >>= aLocale; - eNewFormatterLanguage = MsLangId::convertLocaleToLanguage( aLocale); - } -#ifdef DBG_UTIL - else - { - DBG_ERROR("SvNumberFormatsSupplierServiceObject::initialize : unknown argument !"); - } -#endif - } - - m_pOwnFormatter = new SvNumberFormatter(m_xORB, eNewFormatterLanguage); - m_pOwnFormatter->SetEvalDateFormat( NF_EVALDATEFORMAT_FORMAT_INTL ); - SetNumberFormatter(m_pOwnFormatter); -} - -//------------------------------------------------------------------------- -::rtl::OUString SAL_CALL SvNumberFormatsSupplierServiceObject::getImplementationName( ) throw(RuntimeException) -{ - return ::rtl::OUString::createFromAscii("com.sun.star.uno.util.numbers.SvNumberFormatsSupplierServiceObject"); -} - -//------------------------------------------------------------------------- -sal_Bool SAL_CALL SvNumberFormatsSupplierServiceObject::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) -{ - Sequence< ::rtl::OUString > aServices = getSupportedServiceNames(); - const ::rtl::OUString* pServices = aServices.getConstArray(); - for (sal_Int32 i=0; iequals(_rServiceName)) - return sal_True; - - return sal_False; -} - -//------------------------------------------------------------------------- -Sequence< ::rtl::OUString > SAL_CALL SvNumberFormatsSupplierServiceObject::getSupportedServiceNames( ) throw(RuntimeException) -{ - Sequence< ::rtl::OUString > aSupported(1); - aSupported.getArray()[0] = PERSISTENT_SERVICE_NAME; - return aSupported; -} - -//------------------------------------------------------------------------- -::rtl::OUString SAL_CALL SvNumberFormatsSupplierServiceObject::getServiceName( ) throw(RuntimeException) -{ - return PERSISTENT_SERVICE_NAME; -} - -//------------------------------------------------------------------------- -void SAL_CALL SvNumberFormatsSupplierServiceObject::write( const Reference< XObjectOutputStream >& _rxOutStream ) throw(IOException, RuntimeException) -{ - ::osl::MutexGuard aGuard( getSharedMutex() ); - implEnsureFormatter(); - - Reference< XOutputStream > xStream(_rxOutStream.get()); - SvLockBytesRef aLockBytes = new SvOutputStreamOpenLockBytes(xStream); - SvStream aSvOutputSteam(aLockBytes); - - m_pOwnFormatter->Save(aSvOutputSteam); -} - -//------------------------------------------------------------------------- -void SAL_CALL SvNumberFormatsSupplierServiceObject::read( const Reference< XObjectInputStream >& _rxInStream ) throw(IOException, RuntimeException) -{ - ::osl::MutexGuard aGuard( getSharedMutex() ); - implEnsureFormatter(); - - Reference< XInputStream > xStream(_rxInStream.get()); - SvInputStream aSvInputSteam(xStream); - - m_pOwnFormatter->Load(aSvInputSteam); -} - -//------------------------------------------------------------------------- -Reference< XPropertySet > SAL_CALL SvNumberFormatsSupplierServiceObject::getNumberFormatSettings() throw(RuntimeException) -{ - ::osl::MutexGuard aGuard( getSharedMutex() ); - implEnsureFormatter(); - return SvNumberFormatsSupplierObj::getNumberFormatSettings(); -} - -//------------------------------------------------------------------------- -Reference< XNumberFormats > SAL_CALL SvNumberFormatsSupplierServiceObject::getNumberFormats() throw(RuntimeException) -{ - ::osl::MutexGuard aGuard( getSharedMutex() ); - implEnsureFormatter(); - return SvNumberFormatsSupplierObj::getNumberFormats(); -} - -//------------------------------------------------------------------------- -sal_Int64 SAL_CALL SvNumberFormatsSupplierServiceObject::getSomething( const Sequence< sal_Int8 >& aIdentifier ) throw (RuntimeException) -{ - sal_Int64 nReturn = SvNumberFormatsSupplierObj::getSomething( aIdentifier ); - if ( nReturn ) - // if somebody accesses internals then we should have the formatter - implEnsureFormatter(); - return nReturn; -} - -//------------------------------------------------------------------------- -void SvNumberFormatsSupplierServiceObject::implEnsureFormatter() -{ - if (!m_pOwnFormatter) - { - // get the office's UI locale - SvtSysLocale aSysLocale; - Locale aOfficeLocale = aSysLocale.GetLocaleData().getLocale(); - - // initi with this locale - Sequence< Any > aFakedInitProps( 1 ); - aFakedInitProps[0] <<= aOfficeLocale; - - initialize( aFakedInitProps ); - } -} - diff --git a/svtools/source/numbers/supservs.hxx b/svtools/source/numbers/supservs.hxx deleted file mode 100644 index df48d6567ecc..000000000000 --- a/svtools/source/numbers/supservs.hxx +++ /dev/null @@ -1,105 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: supservs.hxx,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVTOOLS_NUMBERS_SUPPLIERSERVICE_HXX_ -#define _SVTOOLS_NUMBERS_SUPPLIERSERVICE_HXX_ - -#include "numuno.hxx" -#include -#include -#include -#include - -//========================================================================= -//= SvNumberFormatsSupplierServiceObject - a number formats supplier which -//= - can be instantiated as an service -//= - supports the ::com::sun::star::io::XPersistObject interface -//= - works with it's own SvNumberFormatter instance -//= - can be initialized (::com::sun::star::lang::XInitialization) -//= with a specific language (i.e. ::com::sun::star::lang::Locale) -//========================================================================= -class SvNumberFormatsSupplierServiceObject - :protected SvNumberFormatsSupplierObj - ,public ::com::sun::star::lang::XInitialization - ,public ::com::sun::star::io::XPersistObject - ,public ::com::sun::star::lang::XServiceInfo -{ // don't want the Set-/GetNumberFormatter to be accessable from outside - - friend ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > - SAL_CALL SvNumberFormatsSupplierServiceObject_CreateInstance( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&); - -protected: - SvNumberFormatter* m_pOwnFormatter; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; - -public: - SvNumberFormatsSupplierServiceObject(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); - ~SvNumberFormatsSupplierServiceObject(); - - // XInterface - virtual void SAL_CALL acquire() throw() { SvNumberFormatsSupplierObj::acquire(); } - virtual void SAL_CALL release() throw() { SvNumberFormatsSupplierObj::release(); } - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException) - { return SvNumberFormatsSupplierObj::queryInterface(_rType); } - - // XAggregation - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException); - - // XInitialization - virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); - - // XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName( ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - - // XNumberFormatsSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL - getNumberFormatSettings() throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats > SAL_CALL - getNumberFormats() throw(::com::sun::star::uno::RuntimeException); - - // XUnoTunnler - virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw (::com::sun::star::uno::RuntimeException); - -protected: - void implEnsureFormatter(); -}; - - -#endif // _SVTOOLS_NUMBERS_SUPPLIERSERVICE_HXX_ - diff --git a/svtools/source/numbers/zforfind.cxx b/svtools/source/numbers/zforfind.cxx deleted file mode 100644 index aa7d75a098b7..000000000000 --- a/svtools/source/numbers/zforfind.cxx +++ /dev/null @@ -1,2819 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: zforfind.cxx,v $ - * $Revision: 1.51.96.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include // NUMBERFORMAT_XXX -#include "zforscan.hxx" -#include - -#define _ZFORFIND_CXX -#include "zforfind.hxx" -#undef _ZFORFIND_CXX - - -#ifndef DBG_UTIL -#define NF_TEST_CALENDAR 0 -#else -#define NF_TEST_CALENDAR 0 -#endif -#if NF_TEST_CALENDAR -#include -#include -#endif - - -const BYTE ImpSvNumberInputScan::nMatchedEndString = 0x01; -const BYTE ImpSvNumberInputScan::nMatchedMidString = 0x02; -const BYTE ImpSvNumberInputScan::nMatchedStartString = 0x04; -const BYTE ImpSvNumberInputScan::nMatchedVirgin = 0x08; -const BYTE ImpSvNumberInputScan::nMatchedUsedAsReturn = 0x10; - -/* It is not clear how we want timezones to be handled. Convert them to local - * time isn't wanted, as it isn't done in any other place and timezone - * information isn't stored anywhere. Ignoring them and pretending local time - * may be wrong too and might not be what the user expects. Keep the input as - * string so that no information is lost. - * Anyway, defining NF_RECOGNIZE_ISO8601_TIMEZONES to 1 would be the way how it - * would work, together with the nTimezonePos handling in GetTimeRef(). */ -#define NF_RECOGNIZE_ISO8601_TIMEZONES 0 - -//--------------------------------------------------------------------------- -// Konstruktor - -ImpSvNumberInputScan::ImpSvNumberInputScan( SvNumberFormatter* pFormatterP ) - : - pUpperMonthText( NULL ), - pUpperAbbrevMonthText( NULL ), - pUpperDayText( NULL ), - pUpperAbbrevDayText( NULL ) -{ - pFormatter = pFormatterP; - pNullDate = new Date(30,12,1899); - nYear2000 = SvNumberFormatter::GetYear2000Default(); - Reset(); - ChangeIntl(); -} - - -//--------------------------------------------------------------------------- -// Destruktor - -ImpSvNumberInputScan::~ImpSvNumberInputScan() -{ - Reset(); - delete pNullDate; - delete [] pUpperMonthText; - delete [] pUpperAbbrevMonthText; - delete [] pUpperDayText; - delete [] pUpperAbbrevDayText; -} - - -//--------------------------------------------------------------------------- -// Reset - -void ImpSvNumberInputScan::Reset() -{ -#if 0 -// ER 16.06.97 18:56 Vorbelegung erfolgt jetzt in NumberStringDivision, -// wozu immer alles loeschen wenn einiges wieder benutzt oder gar nicht -// gebraucht wird.. - for (USHORT i = 0; i < SV_MAX_ANZ_INPUT_STRINGS; i++) - { - sStrArray[i].Erase(); - nNums[i] = SV_MAX_ANZ_INPUT_STRINGS-1; - IsNum[i] = FALSE; - } -#endif - nMonth = 0; - nMonthPos = 0; - nTimePos = 0; - nSign = 0; - nESign = 0; - nDecPos = 0; - nNegCheck = 0; - nAnzStrings = 0; - nAnzNums = 0; - nThousand = 0; - eScannedType = NUMBERFORMAT_UNDEFINED; - nAmPm = 0; - nPosThousandString = 0; - nLogical = 0; - nStringScanNumFor = 0; - nStringScanSign = 0; - nMatchedAllStrings = nMatchedVirgin; - nMayBeIso8601 = 0; - nTimezonePos = 0; -} - - -//--------------------------------------------------------------------------- -// -// static -inline BOOL ImpSvNumberInputScan::MyIsdigit( sal_Unicode c ) -{ - // If the input string wouldn't be converted using TransformInput() we'd - // to use something similar to the following and to adapt many places. -#if 0 - // use faster isdigit() if possible - if ( c < 128 ) - return isdigit( (unsigned char) c ) != 0; - if ( c < 256 ) - return FALSE; - String aTmp( c ); - return pFormatter->GetCharClass()->isDigit( aTmp, 0 ); -#else - return c < 128 && isdigit( (unsigned char) c ); -#endif -} - - -//--------------------------------------------------------------------------- -// -void ImpSvNumberInputScan::TransformInput( String& rStr ) -{ - xub_StrLen nPos, nLen; - for ( nPos = 0, nLen = rStr.Len(); nPos < nLen; ++nPos ) - { - if ( 256 <= rStr.GetChar( nPos ) && - pFormatter->GetCharClass()->isDigit( rStr, nPos ) ) - break; - } - if ( nPos < nLen ) - rStr = pFormatter->GetNatNum()->getNativeNumberString( rStr, - pFormatter->GetLocale(), 0 ); -} - - -//--------------------------------------------------------------------------- -// StringToDouble -// -// Only simple unsigned floating point values without any error detection, -// decimal separator has to be '.' - -double ImpSvNumberInputScan::StringToDouble( const String& rStr, BOOL bForceFraction ) -{ - double fNum = 0.0; - double fFrac = 0.0; - int nExp = 0; - xub_StrLen nPos = 0; - xub_StrLen nLen = rStr.Len(); - BOOL bPreSep = !bForceFraction; - - while (nPos < nLen) - { - if (rStr.GetChar(nPos) == '.') - bPreSep = FALSE; - else if (bPreSep) - fNum = fNum * 10.0 + (double) (rStr.GetChar(nPos) - '0'); - else - { - fFrac = fFrac * 10.0 + (double) (rStr.GetChar(nPos) - '0'); - --nExp; - } - nPos++; - } - if ( fFrac ) - return fNum + ::rtl::math::pow10Exp( fFrac, nExp ); - return fNum; -} - - -//--------------------------------------------------------------------------- -// NextNumberStringSymbol -// -// Zerlegt die Eingabe in Zahlen und Strings fuer die weitere -// Verarbeitung (Turing-Maschine). -//--------------------------------------------------------------------------- -// Ausgangs Zustand = GetChar -//---------------+-------------------+-----------------------+--------------- -// Alter Zustand | gelesenes Zeichen | Aktion | Neuer Zustand -//---------------+-------------------+-----------------------+--------------- -// GetChar | Ziffer | Symbol=Zeichen | GetValue -// | Sonst | Symbol=Zeichen | GetString -//---------------|-------------------+-----------------------+--------------- -// GetValue | Ziffer | Symbol=Symbol+Zeichen | GetValue -// | Sonst | Dec(CharPos) | Stop -//---------------+-------------------+-----------------------+--------------- -// GetString | Ziffer | Dec(CharPos) | Stop -// | Sonst | Symbol=Symbol+Zeichen | GetString -//---------------+-------------------+-----------------------+--------------- - -enum ScanState // States der Turing-Maschine -{ - SsStop = 0, - SsStart = 1, - SsGetValue = 2, - SsGetString = 3 -}; - -BOOL ImpSvNumberInputScan::NextNumberStringSymbol( - const sal_Unicode*& pStr, - String& rSymbol ) -{ - BOOL isNumber = FALSE; - sal_Unicode cToken; - ScanState eState = SsStart; - register const sal_Unicode* pHere = pStr; - register xub_StrLen nChars = 0; - - while ( ((cToken = *pHere) != 0) && eState != SsStop) - { - pHere++; - switch (eState) - { - case SsStart: - if ( MyIsdigit( cToken ) ) - { - eState = SsGetValue; - isNumber = TRUE; - } - else - eState = SsGetString; - nChars++; - break; - case SsGetValue: - if ( MyIsdigit( cToken ) ) - nChars++; - else - { - eState = SsStop; - pHere--; - } - break; - case SsGetString: - if ( !MyIsdigit( cToken ) ) - nChars++; - else - { - eState = SsStop; - pHere--; - } - break; - default: - break; - } // switch - } // while - - if ( nChars ) - rSymbol.Assign( pStr, nChars ); - else - rSymbol.Erase(); - - pStr = pHere; - - return isNumber; -} - - -//--------------------------------------------------------------------------- -// SkipThousands - -// FIXME: should be grouping; it is only used though in case nAnzStrings is -// near SV_MAX_ANZ_INPUT_STRINGS, in NumberStringDivision(). - -BOOL ImpSvNumberInputScan::SkipThousands( - const sal_Unicode*& pStr, - String& rSymbol ) -{ - BOOL res = FALSE; - sal_Unicode cToken; - const String& rThSep = pFormatter->GetNumThousandSep(); - register const sal_Unicode* pHere = pStr; - ScanState eState = SsStart; - xub_StrLen nCounter = 0; // counts 3 digits - - while ( ((cToken = *pHere) != 0) && eState != SsStop) - { - pHere++; - switch (eState) - { - case SsStart: - if ( StringPtrContains( rThSep, pHere-1, 0 ) ) - { - nCounter = 0; - eState = SsGetValue; - pHere += rThSep.Len()-1; - } - else - { - eState = SsStop; - pHere--; - } - break; - case SsGetValue: - if ( MyIsdigit( cToken ) ) - { - rSymbol += cToken; - nCounter++; - if (nCounter == 3) - { - eState = SsStart; - res = TRUE; // .000 combination found - } - } - else - { - eState = SsStop; - pHere--; - } - break; - default: - break; - } // switch - } // while - - if (eState == SsGetValue) // break witth less than 3 digits - { - if ( nCounter ) - rSymbol.Erase( rSymbol.Len() - nCounter, nCounter ); - pHere -= nCounter + rThSep.Len(); // put back ThSep also - } - pStr = pHere; - - return res; -} - - -//--------------------------------------------------------------------------- -// NumberStringDivision - -void ImpSvNumberInputScan::NumberStringDivision( const String& rString ) -{ - const sal_Unicode* pStr = rString.GetBuffer(); - const sal_Unicode* const pEnd = pStr + rString.Len(); - while ( pStr < pEnd && nAnzStrings < SV_MAX_ANZ_INPUT_STRINGS ) - { - if ( NextNumberStringSymbol( pStr, sStrArray[nAnzStrings] ) ) - { // Zahl - IsNum[nAnzStrings] = TRUE; - nNums[nAnzNums] = nAnzStrings; - nAnzNums++; - if (nAnzStrings >= SV_MAX_ANZ_INPUT_STRINGS - 7 && - nPosThousandString == 0) // nur einmal - if ( SkipThousands( pStr, sStrArray[nAnzStrings] ) ) - nPosThousandString = nAnzStrings; - } - else - { - IsNum[nAnzStrings] = FALSE; - } - nAnzStrings++; - } -} - - -//--------------------------------------------------------------------------- -// Whether rString contains rWhat at nPos - -BOOL ImpSvNumberInputScan::StringContainsImpl( const String& rWhat, - const String& rString, xub_StrLen nPos ) -{ - if ( nPos + rWhat.Len() <= rString.Len() ) - return StringPtrContainsImpl( rWhat, rString.GetBuffer(), nPos ); - return FALSE; -} - - -//--------------------------------------------------------------------------- -// Whether pString contains rWhat at nPos - -BOOL ImpSvNumberInputScan::StringPtrContainsImpl( const String& rWhat, - const sal_Unicode* pString, xub_StrLen nPos ) -{ - if ( rWhat.Len() == 0 ) - return FALSE; - register const sal_Unicode* pWhat = rWhat.GetBuffer(); - register const sal_Unicode* const pEnd = pWhat + rWhat.Len(); - register const sal_Unicode* pStr = pString + nPos; - while ( pWhat < pEnd ) - { - if ( *pWhat != *pStr ) - return FALSE; - pWhat++; - pStr++; - } - return TRUE; -} - - -//--------------------------------------------------------------------------- -// SkipChar -// -// ueberspringt genau das angegebene Zeichen - -inline BOOL ImpSvNumberInputScan::SkipChar( sal_Unicode c, const String& rString, - xub_StrLen& nPos ) -{ - if ((nPos < rString.Len()) && (rString.GetChar(nPos) == c)) - { - nPos++; - return TRUE; - } - return FALSE; -} - - -//--------------------------------------------------------------------------- -// SkipBlanks -// -// Ueberspringt Leerzeichen - -inline void ImpSvNumberInputScan::SkipBlanks( const String& rString, - xub_StrLen& nPos ) -{ - if ( nPos < rString.Len() ) - { - register const sal_Unicode* p = rString.GetBuffer() + nPos; - while ( *p == ' ' ) - { - nPos++; - p++; - } - } -} - - -//--------------------------------------------------------------------------- -// SkipString -// -// jump over rWhat in rString at nPos - -inline BOOL ImpSvNumberInputScan::SkipString( const String& rWhat, - const String& rString, xub_StrLen& nPos ) -{ - if ( StringContains( rWhat, rString, nPos ) ) - { - nPos = nPos + rWhat.Len(); - return TRUE; - } - return FALSE; -} - - -//--------------------------------------------------------------------------- -// GetThousandSep -// -// recognizes exactly ,111 in {3} and {3,2} or ,11 in {3,2} grouping - -inline BOOL ImpSvNumberInputScan::GetThousandSep( - const String& rString, - xub_StrLen& nPos, - USHORT nStringPos ) -{ - const String& rSep = pFormatter->GetNumThousandSep(); - // Is it an ordinary space instead of a non-breaking space? - bool bSpaceBreak = rSep.GetChar(0) == 0xa0 && rString.GetChar(0) == 0x20 && - rSep.Len() == 1 && rString.Len() == 1; - if (!( (rString == rSep || bSpaceBreak) // nothing else - && nStringPos < nAnzStrings - 1 // safety first! - && IsNum[nStringPos+1] )) // number follows - return FALSE; // no? => out - - utl::DigitGroupingIterator aGrouping( - pFormatter->GetLocaleData()->getDigitGrouping()); - // Match ,### in {3} or ,## in {3,2} - /* FIXME: this could be refined to match ,## in {3,2} only if ,##,## or - * ,##,### and to match ,### in {3,2} only if it's the last. However, - * currently there is no track kept where group separators occur. In {3,2} - * #,###,### and #,##,## would be valid input, which maybe isn't even bad - * for #,###,###. Other combinations such as #,###,## maybe not. */ - xub_StrLen nLen = sStrArray[nStringPos+1].Len(); - if (nLen == aGrouping.get() // with 3 (or so) digits - || nLen == aGrouping.advance().get() // or with 2 (or 3 or so) digits - || nPosThousandString == nStringPos+1 // or concatenated - ) - { - nPos = nPos + rSep.Len(); - return TRUE; - } - return FALSE; -} - - -//--------------------------------------------------------------------------- -// GetLogical -// -// Conversion of text to logial value -// "TRUE" => 1: -// "FALSE"=> -1: -// else => 0: - -short ImpSvNumberInputScan::GetLogical( const String& rString ) -{ - short res; - - const ImpSvNumberformatScan* pFS = pFormatter->GetFormatScanner(); - if ( rString == pFS->GetTrueString() ) - res = 1; - else if ( rString == pFS->GetFalseString() ) - res = -1; - else - res = 0; - - return res; -} - - -//--------------------------------------------------------------------------- -// GetMonth -// -// Converts a string containing a month name (JAN, January) at nPos into the -// month number (negative if abbreviated), returns 0 if nothing found - -short ImpSvNumberInputScan::GetMonth( const String& rString, xub_StrLen& nPos ) -{ - // #102136# The correct English form of month September abbreviated is - // SEPT, but almost every data contains SEP instead. - static const String aSeptCorrect( RTL_CONSTASCII_USTRINGPARAM( "SEPT" ) ); - static const String aSepShortened( RTL_CONSTASCII_USTRINGPARAM( "SEP" ) ); - - short res = 0; // no month found - - if (rString.Len() > nPos) // only if needed - { - if ( !bTextInitialized ) - InitText(); - sal_Int16 nMonths = pFormatter->GetCalendar()->getNumberOfMonthsInYear(); - for ( sal_Int16 i = 0; i < nMonths; i++ ) - { - if ( StringContains( pUpperMonthText[i], rString, nPos ) ) - { // full names first - nPos = nPos + pUpperMonthText[i].Len(); - res = i+1; - break; // for - } - else if ( StringContains( pUpperAbbrevMonthText[i], rString, nPos ) ) - { // abbreviated - nPos = nPos + pUpperAbbrevMonthText[i].Len(); - res = sal::static_int_cast< short >(-(i+1)); // negative - break; // for - } - else if ( i == 8 && pUpperAbbrevMonthText[i] == aSeptCorrect && - StringContains( aSepShortened, rString, nPos ) ) - { // #102136# SEPT/SEP - nPos = nPos + aSepShortened.Len(); - res = sal::static_int_cast< short >(-(i+1)); // negative - break; // for - } - } - } - - return res; -} - - -//--------------------------------------------------------------------------- -// GetDayOfWeek -// -// Converts a string containing a DayOfWeek name (Mon, Monday) at nPos into the -// DayOfWeek number + 1 (negative if abbreviated), returns 0 if nothing found - -int ImpSvNumberInputScan::GetDayOfWeek( const String& rString, xub_StrLen& nPos ) -{ - int res = 0; // no day found - - if (rString.Len() > nPos) // only if needed - { - if ( !bTextInitialized ) - InitText(); - sal_Int16 nDays = pFormatter->GetCalendar()->getNumberOfDaysInWeek(); - for ( sal_Int16 i = 0; i < nDays; i++ ) - { - if ( StringContains( pUpperDayText[i], rString, nPos ) ) - { // full names first - nPos = nPos + pUpperDayText[i].Len(); - res = i + 1; - break; // for - } - if ( StringContains( pUpperAbbrevDayText[i], rString, nPos ) ) - { // abbreviated - nPos = nPos + pUpperAbbrevDayText[i].Len(); - res = -(i + 1); // negative - break; // for - } - } - } - - return res; -} - - -//--------------------------------------------------------------------------- -// GetCurrency -// -// Lesen eines Waehrungssysmbols -// '$' => TRUE -// sonst => FALSE - -BOOL ImpSvNumberInputScan::GetCurrency( const String& rString, xub_StrLen& nPos, - const SvNumberformat* pFormat ) -{ - if ( rString.Len() > nPos ) - { - if ( !aUpperCurrSymbol.Len() ) - { // if no format specified the currency of the initialized formatter - LanguageType eLang = (pFormat ? pFormat->GetLanguage() : - pFormatter->GetLanguage()); - aUpperCurrSymbol = pFormatter->GetCharClass()->upper( - SvNumberFormatter::GetCurrencyEntry( eLang ).GetSymbol() ); - } - if ( StringContains( aUpperCurrSymbol, rString, nPos ) ) - { - nPos = nPos + aUpperCurrSymbol.Len(); - return TRUE; - } - if ( pFormat ) - { - String aSymbol, aExtension; - if ( pFormat->GetNewCurrencySymbol( aSymbol, aExtension ) ) - { - if ( aSymbol.Len() <= rString.Len() - nPos ) - { - pFormatter->GetCharClass()->toUpper( aSymbol ); - if ( StringContains( aSymbol, rString, nPos ) ) - { - nPos = nPos + aSymbol.Len(); - return TRUE; - } - } - } - } - } - - return FALSE; -} - - -//--------------------------------------------------------------------------- -// GetTimeAmPm -// -// Lesen des Zeitsymbols (AM od. PM) f. kurze Zeitangabe -// -// Rueckgabe: -// "AM" od. "PM" => TRUE -// sonst => FALSE -// -// nAmPos: -// "AM" => 1 -// "PM" => -1 -// sonst => 0 - -BOOL ImpSvNumberInputScan::GetTimeAmPm( const String& rString, xub_StrLen& nPos ) -{ - - if ( rString.Len() > nPos ) - { - const CharClass* pChr = pFormatter->GetCharClass(); - const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData(); - if ( StringContains( pChr->upper( pLoc->getTimeAM() ), rString, nPos ) ) - { - nAmPm = 1; - nPos = nPos + pLoc->getTimeAM().Len(); - return TRUE; - } - else if ( StringContains( pChr->upper( pLoc->getTimePM() ), rString, nPos ) ) - { - nAmPm = -1; - nPos = nPos + pLoc->getTimePM().Len(); - return TRUE; - } - } - - return FALSE; -} - - -//--------------------------------------------------------------------------- -// GetDecSep -// -// Lesen eines Dezimaltrenners (',') -// ',' => TRUE -// sonst => FALSE - -inline BOOL ImpSvNumberInputScan::GetDecSep( const String& rString, xub_StrLen& nPos ) -{ - if ( rString.Len() > nPos ) - { - const String& rSep = pFormatter->GetNumDecimalSep(); - if ( rString.Equals( rSep, nPos, rSep.Len() ) ) - { - nPos = nPos + rSep.Len(); - return TRUE; - } - } - return FALSE; -} - - -//--------------------------------------------------------------------------- -// read a hundredth seconds separator - -inline BOOL ImpSvNumberInputScan::GetTime100SecSep( const String& rString, xub_StrLen& nPos ) -{ - if ( rString.Len() > nPos ) - { - const String& rSep = pFormatter->GetLocaleData()->getTime100SecSep(); - if ( rString.Equals( rSep, nPos, rSep.Len() ) ) - { - nPos = nPos + rSep.Len(); - return TRUE; - } - } - return FALSE; -} - - -//--------------------------------------------------------------------------- -// GetSign -// -// Lesen eines Vorzeichens, auch Klammer !?! -// '+' => 1 -// '-' => -1 -// '(' => -1, nNegCheck = 1 -// sonst => 0 - -int ImpSvNumberInputScan::GetSign( const String& rString, xub_StrLen& nPos ) -{ - if (rString.Len() > nPos) - switch (rString.GetChar(nPos)) - { - case '+': - nPos++; - return 1; - case '(': // '(' aehnlich wie '-' ?!? - nNegCheck = 1; - //! fallthru - case '-': - nPos++; - return -1; - default: - break; - } - - return 0; -} - - -//--------------------------------------------------------------------------- -// GetESign -// -// Lesen eines Vorzeichens, gedacht fuer Exponent ?!? -// '+' => 1 -// '-' => -1 -// sonst => 0 - -short ImpSvNumberInputScan::GetESign( const String& rString, xub_StrLen& nPos ) -{ - if (rString.Len() > nPos) - switch (rString.GetChar(nPos)) - { - case '+': - nPos++; - return 1; - case '-': - nPos++; - return -1; - default: - break; - } - - return 0; -} - - -//--------------------------------------------------------------------------- -// GetNextNumber -// -// i counts string portions, j counts numbers thereof. -// It should had been called SkipNumber instead. - -inline BOOL ImpSvNumberInputScan::GetNextNumber( USHORT& i, USHORT& j ) -{ - if ( i < nAnzStrings && IsNum[i] ) - { - j++; - i++; - return TRUE; - } - return FALSE; -} - - -//--------------------------------------------------------------------------- -// GetTimeRef - -void ImpSvNumberInputScan::GetTimeRef( - double& fOutNumber, - USHORT nIndex, // j-value of the first numeric time part of input, default 0 - USHORT nAnz ) // count of numeric time parts -{ - USHORT nHour; - USHORT nMinute = 0; - USHORT nSecond = 0; - double fSecond100 = 0.0; - USHORT nStartIndex = nIndex; - - if (nTimezonePos) - { - // find first timezone number index and adjust count - for (USHORT j=0; jGetCalendar()->getNumberOfMonthsInYear(); - - if (sStrArray[nNums[nIndex]].Len() <= 2) - { - USHORT nNum = (USHORT) sStrArray[nNums[nIndex]].ToInt32(); - if ( 0 < nNum && nNum <= nRes ) - nRes = nNum - 1; // zero based for CalendarFieldIndex::MONTH - } - - return nRes; -} - - -//--------------------------------------------------------------------------- -// ImplGetYear -// -// 30 -> 1930, 29 -> 2029, oder 56 -> 1756, 55 -> 1855, ... - -USHORT ImpSvNumberInputScan::ImplGetYear( USHORT nIndex ) -{ - USHORT nYear = 0; - - if (sStrArray[nNums[nIndex]].Len() <= 4) - { - nYear = (USHORT) sStrArray[nNums[nIndex]].ToInt32(); - nYear = SvNumberFormatter::ExpandTwoDigitYear( nYear, nYear2000 ); - } - - return nYear; -} - -//--------------------------------------------------------------------------- - -bool ImpSvNumberInputScan::MayBeIso8601() -{ - if (nMayBeIso8601 == 0) - { - if (nAnzNums >= 3 && nNums[0] < nAnzStrings && - sStrArray[nNums[0]].ToInt32() > 31) - nMayBeIso8601 = 1; - else - nMayBeIso8601 = 2; - } - return nMayBeIso8601 == 1; -} - -//--------------------------------------------------------------------------- -// GetDateRef - -BOOL ImpSvNumberInputScan::GetDateRef( double& fDays, USHORT& nCounter, - const SvNumberformat* pFormat ) -{ - using namespace ::com::sun::star::i18n; - NfEvalDateFormat eEDF; - int nFormatOrder; - if ( pFormat && ((pFormat->GetType() & NUMBERFORMAT_DATE) == NUMBERFORMAT_DATE) ) - { - eEDF = pFormatter->GetEvalDateFormat(); - switch ( eEDF ) - { - case NF_EVALDATEFORMAT_INTL : - case NF_EVALDATEFORMAT_FORMAT : - nFormatOrder = 1; // only one loop - break; - default: - nFormatOrder = 2; - if ( nMatchedAllStrings ) - eEDF = NF_EVALDATEFORMAT_FORMAT_INTL; - // we have a complete match, use it - } - } - else - { - eEDF = NF_EVALDATEFORMAT_INTL; - nFormatOrder = 1; - } - BOOL res = TRUE; - - const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData(); - CalendarWrapper* pCal = pFormatter->GetCalendar(); - for ( int nTryOrder = 1; nTryOrder <= nFormatOrder; nTryOrder++ ) - { - pCal->setGregorianDateTime( Date() ); // today - String aOrgCalendar; // empty => not changed yet - DateFormat DateFmt; - BOOL bFormatTurn; - switch ( eEDF ) - { - case NF_EVALDATEFORMAT_INTL : - bFormatTurn = FALSE; - DateFmt = pLoc->getDateFormat(); - break; - case NF_EVALDATEFORMAT_FORMAT : - bFormatTurn = TRUE; - DateFmt = pFormat->GetDateOrder(); - break; - case NF_EVALDATEFORMAT_INTL_FORMAT : - if ( nTryOrder == 1 ) - { - bFormatTurn = FALSE; - DateFmt = pLoc->getDateFormat(); - } - else - { - bFormatTurn = TRUE; - DateFmt = pFormat->GetDateOrder(); - } - break; - case NF_EVALDATEFORMAT_FORMAT_INTL : - if ( nTryOrder == 2 ) - { - bFormatTurn = FALSE; - DateFmt = pLoc->getDateFormat(); - } - else - { - bFormatTurn = TRUE; - DateFmt = pFormat->GetDateOrder(); - } - break; - default: - DBG_ERROR( "ImpSvNumberInputScan::GetDateRef: unknown NfEvalDateFormat" ); - DateFmt = YMD; - bFormatTurn = FALSE; - } - if ( bFormatTurn ) - { -#if 0 -/* TODO: -We are currently not able to fully support a switch to another calendar during -input for the following reasons: -1. We do have a problem if both (locale's default and format's) calendars - define the same YMD order and use the same date separator, there is no way - to distinguish between them if the input results in valid calendar input for - both calendars. How to solve? Would NfEvalDateFormat be sufficient? Should - it always be set to NF_EVALDATEFORMAT_FORMAT_INTL and thus the format's - calendar be preferred? This could be confusing if a Calc cell was formatted - different to the locale's default and has no content yet, then the user has - no clue about the format or calendar being set. -2. In Calc cell edit mode a date is always displayed and edited using the - default edit format of the default calendar (normally being Gregorian). If - input was ambiguous due to issue #1 we'd need a mechanism to tell that a - date was edited and not newly entered. Not feasible. Otherwise we'd need a - mechanism to use a specific edit format with a specific calendar according - to the format set. -3. For some calendars like Japanese Gengou we'd need era input, which isn't - implemented at all. Though this is a rare and special case, forcing a - calendar dependent edit format as suggested in item #2 might require era - input, if it shouldn't result in a fallback to Gregorian calendar. -4. Last and least: the GetMonth() method currently only matches month names of - the default calendar. Alternating month names of the actual format's - calendar would have to be implemented. No problem. - -*/ - if ( pFormat->IsOtherCalendar( nStringScanNumFor ) ) - pFormat->SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); - else - pFormat->SwitchToSpecifiedCalendar( aOrgCalendar, fOrgDateTime, - nStringScanNumFor ); -#endif - } - - res = TRUE; - nCounter = 0; - // For incomplete dates, always assume first day of month if not specified. - pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, 1 ); - - switch (nAnzNums) // count of numbers in string - { - case 0: // none - if (nMonthPos) // only month (Jan) - pCal->setValue( CalendarFieldIndex::MONTH, Abs(nMonth)-1 ); - else - res = FALSE; - break; - - case 1: // only one number - nCounter = 1; - switch (nMonthPos) // where is the month - { - case 0: // not found => only day entered - pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) ); - break; - case 1: // month at the beginning (Jan 01) - pCal->setValue( CalendarFieldIndex::MONTH, Abs(nMonth)-1 ); - switch (DateFmt) - { - case MDY: - case YMD: - pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) ); - break; - case DMY: - pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) ); - break; - default: - res = FALSE; - break; - } - break; - case 3: // month at the end (10 Jan) - pCal->setValue( CalendarFieldIndex::MONTH, Abs(nMonth)-1 ); - switch (DateFmt) - { - case DMY: - pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) ); - break; - case YMD: - pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) ); - break; - default: - res = FALSE; - break; - } - break; - default: - res = FALSE; - break; - } // switch (nMonthPos) - break; - - case 2: // 2 numbers - nCounter = 2; - switch (nMonthPos) // where is the month - { - case 0: // not found - { - bool bHadExact; - sal_uInt32 nExactDateOrder = (bFormatTurn ? pFormat->GetExactDateOrder() : 0); - if ( 0xff < nExactDateOrder && nExactDateOrder <= 0xffff ) - { // formatted as date and exactly 2 parts - bHadExact = true; - switch ( (nExactDateOrder >> 8) & 0xff ) - { - case 'Y': - pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) ); - break; - case 'M': - pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(0) ); - break; - case 'D': - pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) ); - break; - default: - bHadExact = false; - } - switch ( nExactDateOrder & 0xff ) - { - case 'Y': - pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) ); - break; - case 'M': - pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(1) ); - break; - case 'D': - pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) ); - break; - default: - bHadExact = false; - } - } - else - bHadExact = false; - if ( !bHadExact || !pCal->isValid() ) - { - if ( !bHadExact && nExactDateOrder ) - pCal->setGregorianDateTime( Date() ); // reset today - switch (DateFmt) - { - case MDY: - // M D - pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) ); - pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(0) ); - if ( !pCal->isValid() ) // 2nd try - { // M Y - pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, 1 ); - pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(0) ); - pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) ); - } - break; - case DMY: - // D M - pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) ); - pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(1) ); - if ( !pCal->isValid() ) // 2nd try - { // M Y - pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, 1 ); - pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(0) ); - pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) ); - } - break; - case YMD: - // M D - pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) ); - pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(0) ); - if ( !pCal->isValid() ) // 2nd try - { // Y M - pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, 1 ); - pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(1) ); - pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) ); - } - break; - default: - res = FALSE; - break; - } - } - } - break; - case 1: // month at the beginning (Jan 01 01) - { - // The input is valid as MDY in almost any - // constellation, there is no date order (M)YD except if - // set in a format applied. - pCal->setValue( CalendarFieldIndex::MONTH, Abs(nMonth)-1 ); - sal_uInt32 nExactDateOrder = (bFormatTurn ? pFormat->GetExactDateOrder() : 0); - if ((((nExactDateOrder >> 8) & 0xff) == 'Y') && ((nExactDateOrder & 0xff) == 'D')) - { - pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) ); - pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) ); - } - else - { - pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) ); - pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) ); - } - } - break; - case 2: // month in the middle (10 Jan 94) - pCal->setValue( CalendarFieldIndex::MONTH, Abs(nMonth)-1 ); - switch (DateFmt) - { - case MDY: // yes, "10-Jan-94" is valid - case DMY: - pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) ); - pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) ); - break; - case YMD: - pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) ); - pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) ); - break; - default: - res = FALSE; - break; - } - break; - default: // else, e.g. month at the end (94 10 Jan) - res = FALSE; - break; - } // switch (nMonthPos) - break; - - default: // more than two numbers (31.12.94 8:23) (31.12. 8:23) - switch (nMonthPos) // where is the month - { - case 0: // not found - { - nCounter = 3; - if ( nTimePos > 1 ) - { // find first time number index (should only be 3 or 2 anyway) - for ( USHORT j = 0; j < nAnzNums; j++ ) - { - if ( nNums[j] == nTimePos - 2 ) - { - nCounter = j; - break; // for - } - } - } - // ISO 8601 yyyy-mm-dd forced recognition - DateFormat eDF = (MayBeIso8601() ? YMD : DateFmt); - switch (eDF) - { - case MDY: - pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) ); - pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(0) ); - if ( nCounter > 2 ) - pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(2) ); - break; - case DMY: - pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) ); - pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(1) ); - if ( nCounter > 2 ) - pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(2) ); - break; - case YMD: - if ( nCounter > 2 ) - pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(2) ); - pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(1) ); - pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) ); - break; - default: - res = FALSE; - break; - } - } - break; - case 1: // month at the beginning (Jan 01 01 8:23) - nCounter = 2; - switch (DateFmt) - { - case MDY: - pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) ); - pCal->setValue( CalendarFieldIndex::MONTH, Abs(nMonth)-1 ); - pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) ); - break; - default: - res = FALSE; - break; - } - break; - case 2: // month in the middle (10 Jan 94 8:23) - nCounter = 2; - pCal->setValue( CalendarFieldIndex::MONTH, Abs(nMonth)-1 ); - switch (DateFmt) - { - case DMY: - pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) ); - pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) ); - break; - case YMD: - pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) ); - pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) ); - break; - default: - res = FALSE; - break; - } - break; - default: // else, e.g. month at the end (94 10 Jan 8:23) - nCounter = 2; - res = FALSE; - break; - } // switch (nMonthPos) - break; - } // switch (nAnzNums) - - if ( res && pCal->isValid() ) - { - double fDiff = DateTime(*pNullDate) - pCal->getEpochStart(); - fDays = ::rtl::math::approxFloor( pCal->getLocalDateTime() ); - fDays -= fDiff; - nTryOrder = nFormatOrder; // break for - } - else - res = FALSE; - - if ( aOrgCalendar.Len() ) - pCal->loadCalendar( aOrgCalendar, pLoc->getLocale() ); // restore calendar - -#if NF_TEST_CALENDAR -{ - using namespace ::com::sun::star; - struct entry { const char* lan; const char* cou; const char* cal; }; - const entry cals[] = { - { "en", "US", "gregorian" }, - { "ar", "TN", "hijri" }, - { "he", "IL", "jewish" }, - { "ja", "JP", "gengou" }, - { "ko", "KR", "hanja_yoil" }, - { "th", "TH", "buddhist" }, - { "zh", "TW", "ROC" }, - {0,0,0} - }; - lang::Locale aLocale; - sal_Bool bValid; - sal_Int16 nDay, nMyMonth, nYear, nHour, nMinute, nSecond; - sal_Int16 nDaySet, nMonthSet, nYearSet, nHourSet, nMinuteSet, nSecondSet; - sal_Int16 nZO, nDST1, nDST2, nDST, nZOmillis, nDST1millis, nDST2millis, nDSTmillis; - sal_Int32 nZoneInMillis, nDST1InMillis, nDST2InMillis; - uno::Reference< lang::XMultiServiceFactory > xSMgr = - ::comphelper::getProcessServiceFactory(); - uno::Reference< ::com::sun::star::i18n::XExtendedCalendar > xCal( - xSMgr->createInstance( ::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.i18n.LocaleCalendar" ) ) ), - uno::UNO_QUERY ); - for ( const entry* p = cals; p->lan; ++p ) - { - aLocale.Language = ::rtl::OUString::createFromAscii( p->lan ); - aLocale.Country = ::rtl::OUString::createFromAscii( p->cou ); - xCal->loadCalendar( ::rtl::OUString::createFromAscii( p->cal ), - aLocale ); - double nDateTime = 0.0; // 1-Jan-1970 00:00:00 - nZO = xCal->getValue( i18n::CalendarFieldIndex::ZONE_OFFSET ); - nZOmillis = xCal->getValue( i18n::CalendarFieldIndex::ZONE_OFFSET_SECOND_MILLIS ); - nZoneInMillis = static_cast(nZO) * 60000 + - (nZO < 0 ? -1 : 1) * static_cast(nZOmillis); - nDST1 = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET ); - nDST1millis = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET_SECOND_MILLIS ); - nDST1InMillis = static_cast(nDST1) * 60000 + - (nDST1 < 0 ? -1 : 1) * static_cast(nDST1millis); - nDateTime -= (double)(nZoneInMillis + nDST1InMillis) / 1000.0 / 60.0 / 60.0 / 24.0; - xCal->setDateTime( nDateTime ); - nDST2 = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET ); - nDST2millis = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET_SECOND_MILLIS ); - nDST2InMillis = static_cast(nDST2) * 60000 + - (nDST2 < 0 ? -1 : 1) * static_cast(nDST2millis); - if ( nDST1InMillis != nDST2InMillis ) - { - nDateTime = 0.0 - (double)(nZoneInMillis + nDST2InMillis) / 1000.0 / 60.0 / 60.0 / 24.0; - xCal->setDateTime( nDateTime ); - } - nDaySet = xCal->getValue( i18n::CalendarFieldIndex::DAY_OF_MONTH ); - nMonthSet = xCal->getValue( i18n::CalendarFieldIndex::MONTH ); - nYearSet = xCal->getValue( i18n::CalendarFieldIndex::YEAR ); - nHourSet = xCal->getValue( i18n::CalendarFieldIndex::HOUR ); - nMinuteSet = xCal->getValue( i18n::CalendarFieldIndex::MINUTE ); - nSecondSet = xCal->getValue( i18n::CalendarFieldIndex::SECOND ); - nZO = xCal->getValue( i18n::CalendarFieldIndex::ZONE_OFFSET ); - nZOmillis = xCal->getValue( i18n::CalendarFieldIndex::ZONE_OFFSET_SECOND_MILLIS ); - nDST = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET ); - nDSTmillis = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET_SECOND_MILLIS ); - xCal->setValue( i18n::CalendarFieldIndex::DAY_OF_MONTH, nDaySet ); - xCal->setValue( i18n::CalendarFieldIndex::MONTH, nMonthSet ); - xCal->setValue( i18n::CalendarFieldIndex::YEAR, nYearSet ); - xCal->setValue( i18n::CalendarFieldIndex::HOUR, nHourSet ); - xCal->setValue( i18n::CalendarFieldIndex::MINUTE, nMinuteSet ); - xCal->setValue( i18n::CalendarFieldIndex::SECOND, nSecondSet ); - bValid = xCal->isValid(); - nDay = xCal->getValue( i18n::CalendarFieldIndex::DAY_OF_MONTH ); - nMyMonth= xCal->getValue( i18n::CalendarFieldIndex::MONTH ); - nYear = xCal->getValue( i18n::CalendarFieldIndex::YEAR ); - nHour = xCal->getValue( i18n::CalendarFieldIndex::HOUR ); - nMinute = xCal->getValue( i18n::CalendarFieldIndex::MINUTE ); - nSecond = xCal->getValue( i18n::CalendarFieldIndex::SECOND ); - bValid = bValid && nDay == nDaySet && nMyMonth == nMonthSet && nYear == - nYearSet && nHour == nHourSet && nMinute == nMinuteSet && nSecond - == nSecondSet; - } -} -#endif // NF_TEST_CALENDAR - - } - - return res; -} - - -//--------------------------------------------------------------------------- -// ScanStartString -// -// ersten String analysieren -// Alles weg => TRUE -// sonst => FALSE - -BOOL ImpSvNumberInputScan::ScanStartString( const String& rString, - const SvNumberformat* pFormat ) -{ - xub_StrLen nPos = 0; - int nDayOfWeek; - - // First of all, eat leading blanks - SkipBlanks(rString, nPos); - - // Yes, nMatchedAllStrings should know about the sign position - nSign = GetSign(rString, nPos); - if ( nSign ) // sign? - SkipBlanks(rString, nPos); - - // #102371# match against format string only if start string is not a sign character - if ( nMatchedAllStrings && !(nSign && rString.Len() == 1) ) - { // Match against format in any case, so later on for a "x1-2-3" input - // we may distinguish between a xy-m-d (or similar) date and a x0-0-0 - // format. No sign detection here! - if ( ScanStringNumFor( rString, nPos, pFormat, 0, TRUE ) ) - nMatchedAllStrings |= nMatchedStartString; - else - nMatchedAllStrings = 0; - } - - if ( GetDecSep(rString, nPos) ) // decimal separator in start string - { - nDecPos = 1; - SkipBlanks(rString, nPos); - } - else if ( GetCurrency(rString, nPos, pFormat) ) // currency (DM 1)? - { - eScannedType = NUMBERFORMAT_CURRENCY; // !!! it IS currency !!! - SkipBlanks(rString, nPos); - if (nSign == 0) // no sign yet - { - nSign = GetSign(rString, nPos); - if ( nSign ) // DM -1 - SkipBlanks(rString, nPos); - } - } - else - { - nMonth = GetMonth(rString, nPos); - if ( nMonth ) // month (Jan 1)? - { - eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date !!! - nMonthPos = 1; // month at the beginning - if ( nMonth < 0 ) - SkipChar( '.', rString, nPos ); // abbreviated - SkipBlanks(rString, nPos); - } - else - { - nDayOfWeek = GetDayOfWeek( rString, nPos ); - if ( nDayOfWeek ) - { // day of week is just parsed away - eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date !!! - if ( nPos < rString.Len() ) - { - if ( nDayOfWeek < 0 ) - { // abbreviated - if ( rString.GetChar( nPos ) == '.' ) - ++nPos; - } - else - { // full long name - SkipBlanks(rString, nPos); - SkipString( pFormatter->GetLocaleData()->getLongDateDayOfWeekSep(), rString, nPos ); - } - SkipBlanks(rString, nPos); - nMonth = GetMonth(rString, nPos); - if ( nMonth ) // month (Jan 1)? - { - nMonthPos = 1; // month a the beginning - if ( nMonth < 0 ) - SkipChar( '.', rString, nPos ); // abbreviated - SkipBlanks(rString, nPos); - } - } - } - } - } - - if (nPos < rString.Len()) // not everything consumed - { - // Does input StartString equal StartString of format? - // This time with sign detection! - if ( !ScanStringNumFor( rString, nPos, pFormat, 0 ) ) - return MatchedReturn(); - } - - return TRUE; -} - - -//--------------------------------------------------------------------------- -// ScanMidString -// -// String in der Mitte analysieren -// Alles weg => TRUE -// sonst => FALSE - -BOOL ImpSvNumberInputScan::ScanMidString( const String& rString, - USHORT nStringPos, const SvNumberformat* pFormat ) -{ - xub_StrLen nPos = 0; - short eOldScannedType = eScannedType; - - if ( nMatchedAllStrings ) - { // Match against format in any case, so later on for a "1-2-3-4" input - // we may distinguish between a y-m-d (or similar) date and a 0-0-0-0 - // format. - if ( ScanStringNumFor( rString, 0, pFormat, nStringPos ) ) - nMatchedAllStrings |= nMatchedMidString; - else - nMatchedAllStrings = 0; - } - - SkipBlanks(rString, nPos); - if (GetDecSep(rString, nPos)) // decimal separator? - { - if (nDecPos == 1 || nDecPos == 3) // .12.4 or 1.E2.1 - return MatchedReturn(); - else if (nDecPos == 2) // . dup: 12.4. - { - if (bDecSepInDateSeps) // . also date separator - { - if ( eScannedType != NUMBERFORMAT_UNDEFINED && - eScannedType != NUMBERFORMAT_DATE && - eScannedType != NUMBERFORMAT_DATETIME) // already another type - return MatchedReturn(); - if (eScannedType == NUMBERFORMAT_UNDEFINED) - eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date - SkipBlanks(rString, nPos); - } - else - return MatchedReturn(); - } - else - { - nDecPos = 2; // . in mid string - SkipBlanks(rString, nPos); - } - } - else if ( ((eScannedType & NUMBERFORMAT_TIME) == NUMBERFORMAT_TIME) - && GetTime100SecSep( rString, nPos ) ) - { // hundredth seconds separator - if ( nDecPos ) - return MatchedReturn(); - nDecPos = 2; // . in mid string - SkipBlanks(rString, nPos); - } - - if (SkipChar('/', rString, nPos)) // fraction? - { - if ( eScannedType != NUMBERFORMAT_UNDEFINED // already another type - && eScannedType != NUMBERFORMAT_DATE) // except date - return MatchedReturn(); // => jan/31/1994 - else if ( eScannedType != NUMBERFORMAT_DATE // analyzed date until now - && ( eSetType == NUMBERFORMAT_FRACTION // and preset was fraction - || (nAnzNums == 3 // or 3 numbers - && nStringPos > 2) ) ) // and what ??? - { - SkipBlanks(rString, nPos); - eScannedType = NUMBERFORMAT_FRACTION; // !!! it IS a fraction - } - else - nPos--; // put '/' back - } - - if (GetThousandSep(rString, nPos, nStringPos)) // 1,000 - { - if ( eScannedType != NUMBERFORMAT_UNDEFINED // already another type - && eScannedType != NUMBERFORMAT_CURRENCY) // except currency - return MatchedReturn(); - nThousand++; - } - - const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData(); - const String& rDate = pFormatter->GetDateSep(); - const String& rTime = pLoc->getTimeSep(); - sal_Unicode cTime = rTime.GetChar(0); - SkipBlanks(rString, nPos); - if ( SkipString(rDate, rString, nPos) // 10., 10-, 10/ - || ((cTime != '.') && SkipChar('.', rString, nPos)) // TRICKY: - || ((cTime != '/') && SkipChar('/', rString, nPos)) // short boolean - || ((cTime != '-') && SkipChar('-', rString, nPos)) ) // evaluation! - { - if ( eScannedType != NUMBERFORMAT_UNDEFINED // already another type - && eScannedType != NUMBERFORMAT_DATE) // except date - return MatchedReturn(); - SkipBlanks(rString, nPos); - eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date - short nTmpMonth = GetMonth(rString, nPos); // 10. Jan 94 - if (nMonth && nTmpMonth) // month dup - return MatchedReturn(); - if (nTmpMonth) - { - nMonth = nTmpMonth; - nMonthPos = 2; // month in the middle - if ( nMonth < 0 && SkipChar( '.', rString, nPos ) ) - ; // short month may be abbreviated Jan. - else if ( SkipChar( '-', rString, nPos ) ) - ; // #79632# recognize 17-Jan-2001 to be a date - // #99065# short and long month name - else - SkipString( pLoc->getLongDateMonthSep(), rString, nPos ); - SkipBlanks(rString, nPos); - } - } - - short nTempMonth = GetMonth(rString, nPos); // month in the middle (10 Jan 94) - if (nTempMonth) - { - if (nMonth != 0) // month dup - return MatchedReturn(); - if ( eScannedType != NUMBERFORMAT_UNDEFINED // already another type - && eScannedType != NUMBERFORMAT_DATE) // except date - return MatchedReturn(); - eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date - nMonth = nTempMonth; - nMonthPos = 2; // month in the middle - if ( nMonth < 0 ) - SkipChar( '.', rString, nPos ); // abbreviated - SkipString( pLoc->getLongDateMonthSep(), rString, nPos ); - SkipBlanks(rString, nPos); - } - - if ( SkipChar('E', rString, nPos) // 10E, 10e, 10,Ee - || SkipChar('e', rString, nPos) ) - { - if (eScannedType != NUMBERFORMAT_UNDEFINED) // already another type - return MatchedReturn(); - else - { - SkipBlanks(rString, nPos); - eScannedType = NUMBERFORMAT_SCIENTIFIC; // !!! it IS scientific - if ( nThousand+2 == nAnzNums // special case 1.E2 - && nDecPos == 2 ) - nDecPos = 3; // 1,100.E2 1,100,100.E3 - } - nESign = GetESign(rString, nPos); // signed exponent? - SkipBlanks(rString, nPos); - } - - if ( SkipString(rTime, rString, nPos) ) // time separator? - { - if (nDecPos) // already . => maybe error - { - if (bDecSepInDateSeps) // . also date sep - { - if ( eScannedType != NUMBERFORMAT_DATE && // already another type than date - eScannedType != NUMBERFORMAT_DATETIME) // or date time - return MatchedReturn(); - if (eScannedType == NUMBERFORMAT_DATE) - nDecPos = 0; // reset for time transition - } - else - return MatchedReturn(); - } - if ( ( eScannedType == NUMBERFORMAT_DATE // already date type - || eScannedType == NUMBERFORMAT_DATETIME) // or date time - && nAnzNums > 3) // and more than 3 numbers? (31.Dez.94 8:23) - { - SkipBlanks(rString, nPos); - eScannedType = NUMBERFORMAT_DATETIME; // !!! it IS date with time - } - else if ( eScannedType != NUMBERFORMAT_UNDEFINED // already another type - && eScannedType != NUMBERFORMAT_TIME) // except time - return MatchedReturn(); - else - { - SkipBlanks(rString, nPos); - eScannedType = NUMBERFORMAT_TIME; // !!! it IS a time - } - if ( !nTimePos ) - nTimePos = nStringPos + 1; - } - - if (nPos < rString.Len()) - { - switch (eScannedType) - { - case NUMBERFORMAT_DATE: - if (nMonthPos == 1 && pLoc->getLongDateFormat() == MDY) - { - // #68232# recognize long date separators like ", " in "September 5, 1999" - if (SkipString( pLoc->getLongDateDaySep(), rString, nPos )) - SkipBlanks( rString, nPos ); - } - else if (nStringPos == 5 && nPos == 0 && rString.Len() == 1 && - rString.GetChar(0) == 'T' && MayBeIso8601()) - { - // ISO 8601 combined date and time, yyyy-mm-ddThh:mm - ++nPos; - } - break; -#if NF_RECOGNIZE_ISO8601_TIMEZONES - case NUMBERFORMAT_DATETIME: - if (nPos == 0 && rString.Len() == 1 && nStringPos >= 9 && - MayBeIso8601()) - { - // ISO 8601 timezone offset - switch (rString.GetChar(0)) - { - case '+': - case '-': - if (nStringPos == nAnzStrings-2 || - nStringPos == nAnzStrings-4) - { - ++nPos; // yyyy-mm-ddThh:mm[:ss]+xx[[:]yy] - // nTimezonePos needed for GetTimeRef() - if (!nTimezonePos) - nTimezonePos = nStringPos + 1; - } - break; - case ':': - if (nTimezonePos && nStringPos >= 11 && - nStringPos == nAnzStrings-2) - ++nPos; // yyyy-mm-ddThh:mm[:ss]+xx:yy - break; - } - } - break; -#endif - } - } - - if (nPos < rString.Len()) // not everything consumed? - { - if ( nMatchedAllStrings & ~nMatchedVirgin ) - eScannedType = eOldScannedType; - else - return FALSE; - } - - return TRUE; -} - - -//--------------------------------------------------------------------------- -// ScanEndString -// -// Schlussteil analysieren -// Alles weg => TRUE -// sonst => FALSE - -BOOL ImpSvNumberInputScan::ScanEndString( const String& rString, - const SvNumberformat* pFormat ) -{ - xub_StrLen nPos = 0; - - if ( nMatchedAllStrings ) - { // Match against format in any case, so later on for a "1-2-3-4" input - // we may distinguish between a y-m-d (or similar) date and a 0-0-0-0 - // format. - if ( ScanStringNumFor( rString, 0, pFormat, 0xFFFF ) ) - nMatchedAllStrings |= nMatchedEndString; - else - nMatchedAllStrings = 0; - } - - SkipBlanks(rString, nPos); - if (GetDecSep(rString, nPos)) // decimal separator? - { - if (nDecPos == 1 || nDecPos == 3) // .12.4 or 12.E4. - return MatchedReturn(); - else if (nDecPos == 2) // . dup: 12.4. - { - if (bDecSepInDateSeps) // . also date sep - { - if ( eScannedType != NUMBERFORMAT_UNDEFINED && - eScannedType != NUMBERFORMAT_DATE && - eScannedType != NUMBERFORMAT_DATETIME) // already another type - return MatchedReturn(); - if (eScannedType == NUMBERFORMAT_UNDEFINED) - eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date - SkipBlanks(rString, nPos); - } - else - return MatchedReturn(); - } - else - { - nDecPos = 3; // . in end string - SkipBlanks(rString, nPos); - } - } - - if ( nSign == 0 // conflict - not signed - && eScannedType != NUMBERFORMAT_DATE) // and not date -//!? catch time too? - { // not signed yet - nSign = GetSign(rString, nPos); // 1- DM - if (nNegCheck) // '(' as sign - return MatchedReturn(); - } - - SkipBlanks(rString, nPos); - if (nNegCheck && SkipChar(')', rString, nPos)) // skip ')' if appropriate - { - nNegCheck = 0; - SkipBlanks(rString, nPos); - } - - if ( GetCurrency(rString, nPos, pFormat) ) // currency symbol? - { - if (eScannedType != NUMBERFORMAT_UNDEFINED) // currency dup - return MatchedReturn(); - else - { - SkipBlanks(rString, nPos); - eScannedType = NUMBERFORMAT_CURRENCY; - } // behind currency a '-' is allowed - if (nSign == 0) // not signed yet - { - nSign = GetSign(rString, nPos); // DM - - SkipBlanks(rString, nPos); - if (nNegCheck) // 3 DM ( - return MatchedReturn(); - } - if ( nNegCheck && eScannedType == NUMBERFORMAT_CURRENCY - && SkipChar(')', rString, nPos) ) - { - nNegCheck = 0; // ')' skipped - SkipBlanks(rString, nPos); // only if currency - } - } - - if ( SkipChar('%', rString, nPos) ) // 1 % - { - if (eScannedType != NUMBERFORMAT_UNDEFINED) // already another type - return MatchedReturn(); - SkipBlanks(rString, nPos); - eScannedType = NUMBERFORMAT_PERCENT; - } - - const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData(); - const String& rDate = pFormatter->GetDateSep(); - const String& rTime = pLoc->getTimeSep(); - if ( SkipString(rTime, rString, nPos) ) // 10: - { - if (nDecPos) // already , => error - return MatchedReturn(); - if (eScannedType == NUMBERFORMAT_DATE && nAnzNums > 2) // 31.Dez.94 8: - { - SkipBlanks(rString, nPos); - eScannedType = NUMBERFORMAT_DATETIME; - } - else if (eScannedType != NUMBERFORMAT_UNDEFINED && - eScannedType != NUMBERFORMAT_TIME) // already another type - return MatchedReturn(); - else - { - SkipBlanks(rString, nPos); - eScannedType = NUMBERFORMAT_TIME; - } - if ( !nTimePos ) - nTimePos = nAnzStrings; - } - - sal_Unicode cTime = rTime.GetChar(0); - if ( SkipString(rDate, rString, nPos) // 10., 10-, 10/ - || ((cTime != '.') && SkipChar('.', rString, nPos)) // TRICKY: - || ((cTime != '/') && SkipChar('/', rString, nPos)) // short boolean - || ((cTime != '-') && SkipChar('-', rString, nPos)) ) // evaluation! - { - if (eScannedType != NUMBERFORMAT_UNDEFINED && - eScannedType != NUMBERFORMAT_DATE) // already another type - return MatchedReturn(); - else - { - SkipBlanks(rString, nPos); - eScannedType = NUMBERFORMAT_DATE; - } - short nTmpMonth = GetMonth(rString, nPos); // 10. Jan - if (nMonth && nTmpMonth) // month dup - return MatchedReturn(); - if (nTmpMonth) - { - nMonth = nTmpMonth; - nMonthPos = 3; // month at end - if ( nMonth < 0 ) - SkipChar( '.', rString, nPos ); // abbreviated - SkipBlanks(rString, nPos); - } - } - - short nTempMonth = GetMonth(rString, nPos); // 10 Jan - if (nTempMonth) - { - if (nMonth) // month dup - return MatchedReturn(); - if (eScannedType != NUMBERFORMAT_UNDEFINED && - eScannedType != NUMBERFORMAT_DATE) // already another type - return MatchedReturn(); - eScannedType = NUMBERFORMAT_DATE; - nMonth = nTempMonth; - nMonthPos = 3; // month at end - if ( nMonth < 0 ) - SkipChar( '.', rString, nPos ); // abbreviated - SkipBlanks(rString, nPos); - } - - xub_StrLen nOrigPos = nPos; - if (GetTimeAmPm(rString, nPos)) - { - if (eScannedType != NUMBERFORMAT_UNDEFINED && - eScannedType != NUMBERFORMAT_TIME && - eScannedType != NUMBERFORMAT_DATETIME) // already another type - return MatchedReturn(); - else - { - // If not already scanned as time, 6.78am does not result in 6 - // seconds and 78 hundredths in the morning. Keep as suffix. - if (eScannedType != NUMBERFORMAT_TIME && nDecPos == 2 && nAnzNums == 2) - nPos = nOrigPos; // rewind am/pm - else - { - SkipBlanks(rString, nPos); - if ( eScannedType != NUMBERFORMAT_DATETIME ) - eScannedType = NUMBERFORMAT_TIME; - } - } - } - - if ( nNegCheck && SkipChar(')', rString, nPos) ) - { - if (eScannedType == NUMBERFORMAT_CURRENCY) // only if currency - { - nNegCheck = 0; // skip ')' - SkipBlanks(rString, nPos); - } - else - return MatchedReturn(); - } - - if ( nPos < rString.Len() && - (eScannedType == NUMBERFORMAT_DATE - || eScannedType == NUMBERFORMAT_DATETIME) ) - { // day of week is just parsed away - xub_StrLen nOldPos = nPos; - const String& rSep = pFormatter->GetLocaleData()->getLongDateDayOfWeekSep(); - if ( StringContains( rSep, rString, nPos ) ) - { - nPos = nPos + rSep.Len(); - SkipBlanks(rString, nPos); - } - int nDayOfWeek = GetDayOfWeek( rString, nPos ); - if ( nDayOfWeek ) - { - if ( nPos < rString.Len() ) - { - if ( nDayOfWeek < 0 ) - { // short - if ( rString.GetChar( nPos ) == '.' ) - ++nPos; - } - SkipBlanks(rString, nPos); - } - } - else - nPos = nOldPos; - } - -#if NF_RECOGNIZE_ISO8601_TIMEZONES - if (nPos == 0 && eScannedType == NUMBERFORMAT_DATETIME && - rString.Len() == 1 && rString.GetChar(0) == 'Z' && MayBeIso8601()) - { - // ISO 8601 timezone UTC yyyy-mm-ddThh:mmZ - ++nPos; - } -#endif - - if (nPos < rString.Len()) // everything consumed? - { - // does input EndString equal EndString in Format? - if ( !ScanStringNumFor( rString, nPos, pFormat, 0xFFFF ) ) - return FALSE; - } - - return TRUE; -} - - -BOOL ImpSvNumberInputScan::ScanStringNumFor( - const String& rString, // String to scan - xub_StrLen nPos, // Position until which was consumed - const SvNumberformat* pFormat, // The format to match - USHORT nString, // Substring of format, 0xFFFF => last - BOOL bDontDetectNegation // Suppress sign detection - ) -{ - if ( !pFormat ) - return FALSE; - const ::utl::TransliterationWrapper* pTransliteration = pFormatter->GetTransliteration(); - const String* pStr; - String aString( rString ); - BOOL bFound = FALSE; - BOOL bFirst = TRUE; - BOOL bContinue = TRUE; - USHORT nSub; - do - { - // Don't try "lower" subformats ff the very first match was the second - // or third subformat. - nSub = nStringScanNumFor; - do - { // Step through subformats, first positive, then negative, then - // other, but not the last (text) subformat. - pStr = pFormat->GetNumForString( nSub, nString, TRUE ); - if ( pStr && pTransliteration->isEqual( aString, *pStr ) ) - { - bFound = TRUE; - bContinue = FALSE; - } - else if ( nSub < 2 ) - ++nSub; - else - bContinue = FALSE; - } while ( bContinue ); - if ( !bFound && bFirst && nPos ) - { // try remaining substring - bFirst = FALSE; - aString.Erase( 0, nPos ); - bContinue = TRUE; - } - } while ( bContinue ); - - if ( !bFound ) - { - if ( !bDontDetectNegation && (nString == 0) && !bFirst && (nSign < 0) - && pFormat->IsNegativeRealNegative() ) - { // simply negated twice? --1 - aString.EraseAllChars( ' ' ); - if ( (aString.Len() == 1) && (aString.GetChar(0) == '-') ) - { - bFound = TRUE; - nStringScanSign = -1; - nSub = 0; //! not 1 - } - } - if ( !bFound ) - return FALSE; - } - else if ( !bDontDetectNegation && (nSub == 1) && - pFormat->IsNegativeRealNegative() ) - { // negative - if ( nStringScanSign < 0 ) - { - if ( (nSign < 0) && (nStringScanNumFor != 1) ) - nStringScanSign = 1; // triple negated --1 yyy - } - else if ( nStringScanSign == 0 ) - { - if ( nSign < 0 ) - { // nSign and nStringScanSign will be combined later, - // flip sign if doubly negated - if ( (nString == 0) && !bFirst - && SvNumberformat::HasStringNegativeSign( aString ) ) - nStringScanSign = -1; // direct double negation - else if ( pFormat->IsNegativeWithoutSign() ) - nStringScanSign = -1; // indirect double negation - } - else - nStringScanSign = -1; - } - else // > 0 - nStringScanSign = -1; - } - nStringScanNumFor = nSub; - return TRUE; -} - - -//--------------------------------------------------------------------------- -// IsNumberFormatMain -// -// Recognizes types of number, exponential, fraction, percent, currency, date, time. -// Else text => return FALSE - -BOOL ImpSvNumberInputScan::IsNumberFormatMain( - const String& rString, // string to be analyzed - double& , // OUT: result as number, if possible - const SvNumberformat* pFormat ) // maybe number format set to match against -{ - Reset(); - NumberStringDivision( rString ); // breakdown into strings and numbers - if (nAnzStrings >= SV_MAX_ANZ_INPUT_STRINGS) // too many elements - return FALSE; // Njet, Nope, ... - - if (nAnzNums == 0) // no number in input - { - if ( nAnzStrings > 0 ) - { - // Here we may change the original, we don't need it anymore. - // This saves copies and ToUpper() in GetLogical() and is faster. - String& rStrArray = sStrArray[0]; - rStrArray.EraseTrailingChars( ' ' ); - rStrArray.EraseLeadingChars( ' ' ); - nLogical = GetLogical( rStrArray ); - if ( nLogical ) - { - eScannedType = NUMBERFORMAT_LOGICAL; // !!! it's a BOOLEAN - nMatchedAllStrings &= ~nMatchedVirgin; - return TRUE; - } - else - return FALSE; // simple text - } - else - return FALSE; // simple text - } - - USHORT i = 0; // mark any symbol - USHORT j = 0; // mark only numbers - - switch ( nAnzNums ) - { - case 1 : // Exactly 1 number in input - { // nAnzStrings >= 1 - if (GetNextNumber(i,j)) // i=1,0 - { // Number at start - if (eSetType == NUMBERFORMAT_FRACTION) // Fraction 1 = 1/1 - { - if (i >= nAnzStrings || // no end string nor decimal separator - sStrArray[i] == pFormatter->GetNumDecimalSep()) - { - eScannedType = NUMBERFORMAT_FRACTION; - nMatchedAllStrings &= ~nMatchedVirgin; - return TRUE; - } - } - } - else - { // Analyze start string - if (!ScanStartString( sStrArray[i], pFormat )) // i=0 - return FALSE; // already an error - i++; // next symbol, i=1 - } - GetNextNumber(i,j); // i=1,2 - if (eSetType == NUMBERFORMAT_FRACTION) // Fraction -1 = -1/1 - { - if (nSign && !nNegCheck && // Sign +, - - eScannedType == NUMBERFORMAT_UNDEFINED && // not date or currency - nDecPos == 0 && // no previous decimal separator - (i >= nAnzStrings || // no end string nor decimal separator - sStrArray[i] == pFormatter->GetNumDecimalSep()) - ) - { - eScannedType = NUMBERFORMAT_FRACTION; - nMatchedAllStrings &= ~nMatchedVirgin; - return TRUE; - } - } - if (i < nAnzStrings && !ScanEndString( sStrArray[i], pFormat )) - return FALSE; - } - break; - case 2 : // Exactly 2 numbers in input - { // nAnzStrings >= 3 - if (!GetNextNumber(i,j)) // i=1,0 - { // Analyze start string - if (!ScanStartString( sStrArray[i], pFormat )) - return FALSE; // already an error - i++; // i=1 - } - GetNextNumber(i,j); // i=1,2 - if ( !ScanMidString( sStrArray[i], i, pFormat ) ) - return FALSE; - i++; // next symbol, i=2,3 - GetNextNumber(i,j); // i=3,4 - if (i < nAnzStrings && !ScanEndString( sStrArray[i], pFormat )) - return FALSE; - if (eSetType == NUMBERFORMAT_FRACTION) // -1,200. as fraction - { - if (!nNegCheck && // no sign '(' - eScannedType == NUMBERFORMAT_UNDEFINED && - (nDecPos == 0 || nDecPos == 3) // no decimal separator or at end - ) - { - eScannedType = NUMBERFORMAT_FRACTION; - nMatchedAllStrings &= ~nMatchedVirgin; - return TRUE; - } - } - } - break; - case 3 : // Exactly 3 numbers in input - { // nAnzStrings >= 5 - if (!GetNextNumber(i,j)) // i=1,0 - { // Analyze start string - if (!ScanStartString( sStrArray[i], pFormat )) - return FALSE; // already an error - i++; // i=1 - if (nDecPos == 1) // decimal separator at start => error - return FALSE; - } - GetNextNumber(i,j); // i=1,2 - if ( !ScanMidString( sStrArray[i], i, pFormat ) ) - return FALSE; - i++; // i=2,3 - if (eScannedType == NUMBERFORMAT_SCIENTIFIC) // E only at end - return FALSE; - GetNextNumber(i,j); // i=3,4 - if ( !ScanMidString( sStrArray[i], i, pFormat ) ) - return FALSE; - i++; // i=4,5 - GetNextNumber(i,j); // i=5,6 - if (i < nAnzStrings && !ScanEndString( sStrArray[i], pFormat )) - return FALSE; - if (eSetType == NUMBERFORMAT_FRACTION) // -1,200,100. as fraction - { - if (!nNegCheck && // no sign '(' - eScannedType == NUMBERFORMAT_UNDEFINED && - (nDecPos == 0 || nDecPos == 3) // no decimal separator or at end - ) - { - eScannedType = NUMBERFORMAT_FRACTION; - nMatchedAllStrings &= ~nMatchedVirgin; - return TRUE; - } - } - if ( eScannedType == NUMBERFORMAT_FRACTION && nDecPos ) - return FALSE; // #36857# not a real fraction - } - break; - default: // More than 3 numbers in input - { // nAnzStrings >= 7 - if (!GetNextNumber(i,j)) // i=1,0 - { // Analyze startstring - if (!ScanStartString( sStrArray[i], pFormat )) - return FALSE; // already an error - i++; // i=1 - if (nDecPos == 1) // decimal separator at start => error - return FALSE; - } - GetNextNumber(i,j); // i=1,2 - if ( !ScanMidString( sStrArray[i], i, pFormat ) ) - return FALSE; - i++; // i=2,3 - USHORT nThOld = 10; // just not 0 or 1 - while (nThOld != nThousand && j < nAnzNums-1) - // Execute at least one time - // but leave one number. - { // Loop over group separators - nThOld = nThousand; - if (eScannedType == NUMBERFORMAT_SCIENTIFIC) // E only at end - return FALSE; - GetNextNumber(i,j); - if ( i < nAnzStrings && !ScanMidString( sStrArray[i], i, pFormat ) ) - return FALSE; - i++; - } - if (eScannedType == NUMBERFORMAT_DATE || // long date or - eScannedType == NUMBERFORMAT_TIME || // long time or - eScannedType == NUMBERFORMAT_UNDEFINED) // long number - { - for (USHORT k = j; k < nAnzNums-1; k++) - { - if (eScannedType == NUMBERFORMAT_SCIENTIFIC) // E only at endd - return FALSE; - GetNextNumber(i,j); - if ( i < nAnzStrings && !ScanMidString( sStrArray[i], i, pFormat ) ) - return FALSE; - i++; - } - } - GetNextNumber(i,j); - if (i < nAnzStrings && !ScanEndString( sStrArray[i], pFormat )) - return FALSE; - if (eSetType == NUMBERFORMAT_FRACTION) // -1,200,100. as fraction - { - if (!nNegCheck && // no sign '(' - eScannedType == NUMBERFORMAT_UNDEFINED && - (nDecPos == 0 || nDecPos == 3) // no decimal separator or at end - ) - { - eScannedType = NUMBERFORMAT_FRACTION; - nMatchedAllStrings &= ~nMatchedVirgin; - return TRUE; - } - } - if ( eScannedType == NUMBERFORMAT_FRACTION && nDecPos ) - return FALSE; // #36857# not a real fraction - } - } - - if (eScannedType == NUMBERFORMAT_UNDEFINED) - { - nMatchedAllStrings &= ~nMatchedVirgin; - // did match including nMatchedUsedAsReturn - BOOL bDidMatch = (nMatchedAllStrings != 0); - if ( nMatchedAllStrings ) - { - BOOL bMatch = (pFormat ? pFormat->IsNumForStringElementCountEqual( - nStringScanNumFor, nAnzStrings, nAnzNums ) : FALSE); - if ( !bMatch ) - nMatchedAllStrings = 0; - } - if ( nMatchedAllStrings ) - eScannedType = eSetType; - else if ( bDidMatch ) - return FALSE; - else - eScannedType = NUMBERFORMAT_NUMBER; - // everything else should have been recognized by now - } - else if ( eScannedType == NUMBERFORMAT_DATE ) - { // the very relaxed date input checks may interfere with a preset format - nMatchedAllStrings &= ~nMatchedVirgin; - BOOL bWasReturn = ((nMatchedAllStrings & nMatchedUsedAsReturn) != 0); - if ( nMatchedAllStrings ) - { - BOOL bMatch = (pFormat ? pFormat->IsNumForStringElementCountEqual( - nStringScanNumFor, nAnzStrings, nAnzNums ) : FALSE); - if ( !bMatch ) - nMatchedAllStrings = 0; - } - if ( nMatchedAllStrings ) - eScannedType = eSetType; - else if ( bWasReturn ) - return FALSE; - } - else - nMatchedAllStrings = 0; // reset flag to no substrings matched - - return TRUE; -} - - -//--------------------------------------------------------------------------- -// return TRUE or FALSE depending on the nMatched... state and remember usage -BOOL ImpSvNumberInputScan::MatchedReturn() -{ - if ( nMatchedAllStrings & ~nMatchedVirgin ) - { - nMatchedAllStrings |= nMatchedUsedAsReturn; - return TRUE; - } - return FALSE; -} - - -//--------------------------------------------------------------------------- -// Initialize uppercase months and weekdays - -void ImpSvNumberInputScan::InitText() -{ - sal_Int32 j, nElems; - const CharClass* pChrCls = pFormatter->GetCharClass(); - const CalendarWrapper* pCal = pFormatter->GetCalendar(); - delete [] pUpperMonthText; - delete [] pUpperAbbrevMonthText; - ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > xElems - = pCal->getMonths(); - nElems = xElems.getLength(); - pUpperMonthText = new String[nElems]; - pUpperAbbrevMonthText = new String[nElems]; - for ( j=0; jupper( xElems[j].FullName ); - pUpperAbbrevMonthText[j] = pChrCls->upper( xElems[j].AbbrevName ); - } - delete [] pUpperDayText; - delete [] pUpperAbbrevDayText; - xElems = pCal->getDays(); - nElems = xElems.getLength(); - pUpperDayText = new String[nElems]; - pUpperAbbrevDayText = new String[nElems]; - for ( j=0; jupper( xElems[j].FullName ); - pUpperAbbrevDayText[j] = pChrCls->upper( xElems[j].AbbrevName ); - } - bTextInitialized = TRUE; -} - - -//=========================================================================== -// P U B L I C - -//--------------------------------------------------------------------------- -// ChangeIntl -// -// MUST be called if International/Locale is changed - -void ImpSvNumberInputScan::ChangeIntl() -{ - sal_Unicode cDecSep = pFormatter->GetNumDecimalSep().GetChar(0); - bDecSepInDateSeps = ( cDecSep == '-' || - cDecSep == '/' || - cDecSep == '.' || - cDecSep == pFormatter->GetDateSep().GetChar(0) ); - bTextInitialized = FALSE; - aUpperCurrSymbol.Erase(); -} - - -//--------------------------------------------------------------------------- -// ChangeNullDate - -void ImpSvNumberInputScan::ChangeNullDate( - const USHORT Day, - const USHORT Month, - const USHORT Year ) -{ - if ( pNullDate ) - *pNullDate = Date(Day, Month, Year); - else - pNullDate = new Date(Day, Month, Year); -} - - -//--------------------------------------------------------------------------- -// IsNumberFormat -// -// => does rString represent a number (also date, time et al) - -BOOL ImpSvNumberInputScan::IsNumberFormat( - const String& rString, // string to be analyzed - short& F_Type, // IN: old type, OUT: new type - double& fOutNumber, // OUT: number if convertable - const SvNumberformat* pFormat ) // maybe a number format to match against -{ - String sResString; - String aString; - BOOL res; // return value - eSetType = F_Type; // old type set - - if ( !rString.Len() ) - res = FALSE; - else if (rString.Len() > 308) // arbitrary - res = FALSE; - else - { - // NoMoreUpperNeeded, all comparisons on UpperCase - aString = pFormatter->GetCharClass()->upper( rString ); - // convert native number to ASCII if necessary - TransformInput( aString ); - res = IsNumberFormatMain( aString, fOutNumber, pFormat ); - } - - if (res) - { - if ( nNegCheck // ')' not found for '(' - || (nSign && (eScannedType == NUMBERFORMAT_DATE - || eScannedType == NUMBERFORMAT_DATETIME)) - ) // signed date/datetime - res = FALSE; - else - { // check count of partial number strings - switch (eScannedType) - { - case NUMBERFORMAT_PERCENT: - case NUMBERFORMAT_CURRENCY: - case NUMBERFORMAT_NUMBER: - if (nDecPos == 1) // .05 - { - // matched MidStrings function like group separators - if ( nMatchedAllStrings ) - nThousand = nAnzNums - 1; - else if ( nAnzNums != 1 ) - res = FALSE; - } - else if (nDecPos == 2) // 1.05 - { - // matched MidStrings function like group separators - if ( nMatchedAllStrings ) - nThousand = nAnzNums - 1; - else if ( nAnzNums != nThousand+2 ) - res = FALSE; - } - else // 1,100 or 1,100. - { - // matched MidStrings function like group separators - if ( nMatchedAllStrings ) - nThousand = nAnzNums - 1; - else if ( nAnzNums != nThousand+1 ) - res = FALSE; - } - break; - - case NUMBERFORMAT_SCIENTIFIC: // 1.0e-2 - if (nDecPos == 1) // .05 - { - if (nAnzNums != 2) - res = FALSE; - } - else if (nDecPos == 2) // 1.05 - { - if (nAnzNums != nThousand+3) - res = FALSE; - } - else // 1,100 or 1,100. - { - if (nAnzNums != nThousand+2) - res = FALSE; - } - break; - - case NUMBERFORMAT_DATE: - if (nMonth) - { // month name and numbers - if (nAnzNums > 2) - res = FALSE; - } - else - { - if (nAnzNums > 3) - res = FALSE; - } - break; - - case NUMBERFORMAT_TIME: - if (nDecPos) - { // hundredth seconds included - if (nAnzNums > 4) - res = FALSE; - } - else - { - if (nAnzNums > 3) - res = FALSE; - } - break; - - case NUMBERFORMAT_DATETIME: - if (nMonth) - { // month name and numbers - if (nDecPos) - { // hundredth seconds included - if (nAnzNums > 6) - res = FALSE; - } - else - { - if (nAnzNums > 5) - res = FALSE; - } - } - else - { - if (nDecPos) - { // hundredth seconds included - if (nAnzNums > 7) - res = FALSE; - } - else - { - if (nAnzNums > 6) - res = FALSE; - } - } - break; - - default: - break; - } // switch - } // else - } // if (res) - - if (res) - { // we finally have a number - switch (eScannedType) - { - case NUMBERFORMAT_LOGICAL: - if (nLogical == 1) - fOutNumber = 1.0; // True - else if (nLogical == -1) - fOutNumber = 0.0; // False - else - res = FALSE; // Oops - break; - - case NUMBERFORMAT_PERCENT: - case NUMBERFORMAT_CURRENCY: - case NUMBERFORMAT_NUMBER: - case NUMBERFORMAT_SCIENTIFIC: - case NUMBERFORMAT_DEFINED: // if no category detected handle as number - { - if ( nDecPos == 1 ) // . at start - sResString.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "0." ) ); - else - sResString.Erase(); - USHORT k; - for ( k = 0; k <= nThousand; k++) - sResString += sStrArray[nNums[k]]; // integer part - if ( nDecPos == 2 && k < nAnzNums ) // . somewhere - { - sResString += '.'; - USHORT nStop = (eScannedType == NUMBERFORMAT_SCIENTIFIC ? - nAnzNums-1 : nAnzNums); - for ( ; k < nStop; k++) - sResString += sStrArray[nNums[k]]; // fractional part - } - - if (eScannedType != NUMBERFORMAT_SCIENTIFIC) - fOutNumber = StringToDouble(sResString); - else - { // append exponent - sResString += 'E'; - if ( nESign == -1 ) - sResString += '-'; - sResString += sStrArray[nNums[nAnzNums-1]]; - rtl_math_ConversionStatus eStatus; - fOutNumber = ::rtl::math::stringToDouble( - sResString, '.', ',', &eStatus, NULL ); - if ( eStatus == rtl_math_ConversionStatus_OutOfRange ) - { - F_Type = NUMBERFORMAT_TEXT; // overflow/underflow -> Text - if (nESign == -1) - fOutNumber = 0.0; - else - fOutNumber = DBL_MAX; -/*!*/ return TRUE; - } - } - - if ( nStringScanSign ) - { - if ( nSign ) - nSign *= nStringScanSign; - else - nSign = nStringScanSign; - } - if ( nSign < 0 ) - fOutNumber = -fOutNumber; - - if (eScannedType == NUMBERFORMAT_PERCENT) - fOutNumber/= 100.0; - } - break; - - case NUMBERFORMAT_FRACTION: - if (nAnzNums == 1) - fOutNumber = StringToDouble(sStrArray[nNums[0]]); - else if (nAnzNums == 2) - { - if (nThousand == 1) - { - sResString = sStrArray[nNums[0]]; - sResString += sStrArray[nNums[1]]; // integer part - fOutNumber = StringToDouble(sResString); - } - else - { - double fZaehler = StringToDouble(sStrArray[nNums[0]]); - double fNenner = StringToDouble(sStrArray[nNums[1]]); - if (fNenner != 0.0) - fOutNumber = fZaehler/fNenner; - else - res = FALSE; - } - } - else // nAnzNums > 2 - { - USHORT k = 1; - sResString = sStrArray[nNums[0]]; - if (nThousand > 0) - for (k = 1; k <= nThousand; k++) - sResString += sStrArray[nNums[k]]; - fOutNumber = StringToDouble(sResString); - - if (k == nAnzNums-2) - { - double fZaehler = StringToDouble(sStrArray[nNums[k]]); - double fNenner = StringToDouble(sStrArray[nNums[k+1]]); - if (fNenner != 0.0) - fOutNumber += fZaehler/fNenner; - else - res = FALSE; - } - } - - if ( nStringScanSign ) - { - if ( nSign ) - nSign *= nStringScanSign; - else - nSign = nStringScanSign; - } - if ( nSign < 0 ) - fOutNumber = -fOutNumber; - break; - - case NUMBERFORMAT_TIME: - GetTimeRef(fOutNumber, 0, nAnzNums); - if ( nSign < 0 ) - fOutNumber = -fOutNumber; - break; - - case NUMBERFORMAT_DATE: - { - USHORT nCounter = 0; // dummy here - res = GetDateRef( fOutNumber, nCounter, pFormat ); - } - break; - - case NUMBERFORMAT_DATETIME: - { - USHORT nCounter = 0; // needed here - res = GetDateRef( fOutNumber, nCounter, pFormat ); - if ( res ) - { - double fTime; - GetTimeRef( fTime, nCounter, nAnzNums - nCounter ); - fOutNumber += fTime; - } - } - break; - - default: - DBG_ERRORFILE( "Some number recognized but what's it?" ); - fOutNumber = 0.0; - break; - } - } - - if (res) // overflow/underflow -> Text - { - if (fOutNumber < -DBL_MAX) // -1.7E308 - { - F_Type = NUMBERFORMAT_TEXT; - fOutNumber = -DBL_MAX; - return TRUE; - } - else if (fOutNumber > DBL_MAX) // 1.7E308 - { - F_Type = NUMBERFORMAT_TEXT; - fOutNumber = DBL_MAX; - return TRUE; - } - } - - if (res == FALSE) - { - eScannedType = NUMBERFORMAT_TEXT; - fOutNumber = 0.0; - } - - F_Type = eScannedType; - return res; -} - - - diff --git a/svtools/source/numbers/zforlist.cxx b/svtools/source/numbers/zforlist.cxx deleted file mode 100644 index fcae93964e72..000000000000 --- a/svtools/source/numbers/zforlist.cxx +++ /dev/null @@ -1,4362 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: zforlist.cxx,v $ - * $Revision: 1.72.60.2 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -// #include -#include -#ifndef _SOUND_HXX //autogen -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define _SVSTDARR_USHORTS -#include - -#define _ZFORLIST_CXX -#include -#include -#undef _ZFORLIST_CXX - -#include "zforscan.hxx" -#include "zforfind.hxx" -#include -#include "numhead.hxx" - -#include -#include "listener.hxx" -#include -#include -#include -#include - -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::i18n; -using namespace ::com::sun::star::lang; - - -// Constants for type offsets per Country/Language (CL) -#define ZF_STANDARD 0 -#define ZF_STANDARD_PERCENT 10 -#define ZF_STANDARD_CURRENCY 20 -#define ZF_STANDARD_DATE 30 -#define ZF_STANDARD_TIME 40 -#define ZF_STANDARD_DATETIME 50 -#define ZF_STANDARD_SCIENTIFIC 60 -#define ZF_STANDARD_FRACTION 70 -#define ZF_STANDARD_NEWEXTENDED 75 -#define ZF_STANDARD_NEWEXTENDEDMAX SV_MAX_ANZ_STANDARD_FORMATE-2 // 98 -#define ZF_STANDARD_LOGICAL SV_MAX_ANZ_STANDARD_FORMATE-1 // 99 -#define ZF_STANDARD_TEXT SV_MAX_ANZ_STANDARD_FORMATE // 100 - -/* Locale that is set if an unknown locale (from another system) is loaded of - * legacy documents. Can not be SYSTEM because else, for example, a German "DM" - * (old currency) is recognized as a date (#53155#). */ -#define UNKNOWN_SUBSTITUTE LANGUAGE_ENGLISH_US - -static BOOL bIndexTableInitialized = FALSE; -static sal_uInt32 __FAR_DATA theIndexTable[NF_INDEX_TABLE_ENTRIES]; - - -// ==================================================================== - -/** - instead of every number formatter being a listener we have a registry which - also handles one instance of the SysLocale options - */ - -class SvNumberFormatterRegistry_Impl : public SvtListener -{ - List aFormatters; - SvtSysLocaleOptions aSysLocaleOptions; - LanguageType eSysLanguage; - -public: - SvNumberFormatterRegistry_Impl(); - virtual ~SvNumberFormatterRegistry_Impl(); - - void Insert( SvNumberFormatter* pThis ) - { aFormatters.Insert( pThis, LIST_APPEND ); } - SvNumberFormatter* Remove( SvNumberFormatter* pThis ) - { return (SvNumberFormatter*)aFormatters.Remove( pThis ); } - sal_uInt32 Count() - { return aFormatters.Count(); } - - virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint ); - -}; - - -SvNumberFormatterRegistry_Impl::SvNumberFormatterRegistry_Impl() -{ - eSysLanguage = MsLangId::getRealLanguage( LANGUAGE_SYSTEM ); - aSysLocaleOptions.AddListener( *this ); -} - - -SvNumberFormatterRegistry_Impl::~SvNumberFormatterRegistry_Impl() -{ - aSysLocaleOptions.RemoveListener( *this ); -} - - -void SvNumberFormatterRegistry_Impl::Notify( SvtBroadcaster&, const SfxHint& rHint ) -{ - const SfxSimpleHint* pHint = PTR_CAST( SfxSimpleHint, &rHint ); - if( pHint ) - { - if ( pHint->GetId() & SYSLOCALEOPTIONS_HINT_LOCALE ) - { - ::osl::MutexGuard aGuard( SvNumberFormatter::GetMutex() ); - for ( SvNumberFormatter* p = (SvNumberFormatter*)aFormatters.First(); - p; p = (SvNumberFormatter*)aFormatters.Next() ) - { - p->ReplaceSystemCL( eSysLanguage ); - } - eSysLanguage = MsLangId::getRealLanguage( LANGUAGE_SYSTEM ); - } - if ( pHint->GetId() & SYSLOCALEOPTIONS_HINT_CURRENCY ) - { - ::osl::MutexGuard aGuard( SvNumberFormatter::GetMutex() ); - for ( SvNumberFormatter* p = (SvNumberFormatter*)aFormatters.First(); - p; p = (SvNumberFormatter*)aFormatters.Next() ) - { - p->ResetDefaultSystemCurrency(); - } - } - } -} - - -// ==================================================================== - -SvNumberFormatterRegistry_Impl* SvNumberFormatter::pFormatterRegistry = NULL; -BOOL SvNumberFormatter::bCurrencyTableInitialized = FALSE; -namespace -{ - struct theCurrencyTable : - public rtl::Static< NfCurrencyTable, theCurrencyTable > {}; - - struct theLegacyOnlyCurrencyTable : - public rtl::Static< NfCurrencyTable, theLegacyOnlyCurrencyTable > {}; -} -USHORT SvNumberFormatter::nSystemCurrencyPosition = 0; -SV_IMPL_PTRARR( NfCurrencyTable, NfCurrencyEntry* ); -SV_IMPL_PTRARR( NfWSStringsDtor, String* ); - -// ob das BankSymbol immer am Ende ist (1 $;-1 $) oder sprachabhaengig -#define NF_BANKSYMBOL_FIX_POSITION 1 - - -/***********************Funktionen SvNumberFormatter**************************/ - -SvNumberFormatter::SvNumberFormatter( - const Reference< XMultiServiceFactory >& xSMgr, - LanguageType eLang ) - : - xServiceManager( xSMgr ) -{ - ImpConstruct( eLang ); -} - - -SvNumberFormatter::SvNumberFormatter( LanguageType eLang ) -{ - ImpConstruct( eLang ); -} - - -SvNumberFormatter::~SvNumberFormatter() -{ - { - ::osl::MutexGuard aGuard( GetMutex() ); - pFormatterRegistry->Remove( this ); - if ( !pFormatterRegistry->Count() ) - { - delete pFormatterRegistry; - pFormatterRegistry = NULL; - } - } - - SvNumberformat* pEntry = aFTable.First(); - while (pEntry) - { - delete pEntry; - pEntry = aFTable.Next(); - } - delete pFormatTable; - delete pCharClass; - delete pStringScanner; - delete pFormatScanner; - ClearMergeTable(); - delete pMergeTable; -} - - -void SvNumberFormatter::ImpConstruct( LanguageType eLang ) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aTimeLog, "svtools", "er93726", "SvNumberFormatter::ImpConstruct" ); - - if ( eLang == LANGUAGE_DONTKNOW ) - eLang = UNKNOWN_SUBSTITUTE; - IniLnge = eLang; - ActLnge = eLang; - eEvalDateFormat = NF_EVALDATEFORMAT_INTL; - nDefaultSystemCurrencyFormat = NUMBERFORMAT_ENTRY_NOT_FOUND; - - aLocale = MsLangId::convertLanguageToLocale( eLang ); - pCharClass = new CharClass( xServiceManager, aLocale ); - xLocaleData.init( xServiceManager, aLocale, eLang ); - xCalendar.init( xServiceManager, aLocale ); - xTransliteration.init( xServiceManager, eLang, - ::com::sun::star::i18n::TransliterationModules_IGNORE_CASE ); - xNatNum.init( xServiceManager ); - - // cached locale data items - const LocaleDataWrapper* pLoc = GetLocaleData(); - aDecimalSep = pLoc->getNumDecimalSep(); - aThousandSep = pLoc->getNumThousandSep(); - aDateSep = pLoc->getDateSep(); - - pStringScanner = new ImpSvNumberInputScan( this ); - pFormatScanner = new ImpSvNumberformatScan( this ); - pFormatTable = NULL; - MaxCLOffset = 0; - ImpGenerateFormats( 0, FALSE ); // 0 .. 999 for initialized language formats - pMergeTable = NULL; - bNoZero = FALSE; - - ::osl::MutexGuard aGuard( GetMutex() ); - GetFormatterRegistry().Insert( this ); -} - - -void SvNumberFormatter::ChangeIntl(LanguageType eLnge) -{ - if (ActLnge != eLnge) - { - ActLnge = eLnge; - - aLocale = MsLangId::convertLanguageToLocale( eLnge ); - pCharClass->setLocale( aLocale ); - xLocaleData.changeLocale( aLocale, eLnge ); - xCalendar.changeLocale( aLocale ); - xTransliteration.changeLocale( eLnge ); - - // cached locale data items, initialize BEFORE calling ChangeIntl below - const LocaleDataWrapper* pLoc = GetLocaleData(); - aDecimalSep = pLoc->getNumDecimalSep(); - aThousandSep = pLoc->getNumThousandSep(); - aDateSep = pLoc->getDateSep(); - - pFormatScanner->ChangeIntl(); - pStringScanner->ChangeIntl(); - } -} - - -// static -::osl::Mutex& SvNumberFormatter::GetMutex() -{ - static ::osl::Mutex* pMutex = NULL; - if( !pMutex ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( !pMutex ) - { - // #i77768# Due to a static reference in the toolkit lib - // we need a mutex that lives longer than the svtools library. - // Otherwise the dtor would use a destructed mutex!! - pMutex = new ::osl::Mutex; - } - } - return *pMutex; -} - - -// static -SvNumberFormatterRegistry_Impl& SvNumberFormatter::GetFormatterRegistry() -{ - ::osl::MutexGuard aGuard( GetMutex() ); - if ( !pFormatterRegistry ) - pFormatterRegistry = new SvNumberFormatterRegistry_Impl; - return *pFormatterRegistry; -} - - -Color* SvNumberFormatter::GetUserDefColor(USHORT nIndex) -{ - if( aColorLink.IsSet() ) - return (Color*) ( aColorLink.Call( (void*) &nIndex )); - else - return NULL; -} - -void SvNumberFormatter::ChangeNullDate(USHORT nDay, - USHORT nMonth, - USHORT nYear) -{ - pFormatScanner->ChangeNullDate(nDay, nMonth, nYear); - pStringScanner->ChangeNullDate(nDay, nMonth, nYear); -} - -Date* SvNumberFormatter::GetNullDate() -{ - return pFormatScanner->GetNullDate(); -} - -void SvNumberFormatter::ChangeStandardPrec(short nPrec) -{ - pFormatScanner->ChangeStandardPrec(nPrec); -} - -short SvNumberFormatter::GetStandardPrec() -{ - return pFormatScanner->GetStandardPrec(); -} - -void SvNumberFormatter::ImpChangeSysCL( LanguageType eLnge, BOOL bLoadingSO5 ) -{ - if (eLnge == LANGUAGE_DONTKNOW) - eLnge = UNKNOWN_SUBSTITUTE; - if (eLnge != IniLnge) - { - IniLnge = eLnge; - ChangeIntl(eLnge); - SvNumberformat* pEntry = aFTable.First(); - while (pEntry) // delete old formats - { - pEntry = (SvNumberformat*) aFTable.Remove(aFTable.GetCurKey()); - delete pEntry; - pEntry = (SvNumberformat*) aFTable.First(); - } - ImpGenerateFormats( 0, bLoadingSO5 ); // new standard formats - } - else if ( bLoadingSO5 ) - { // delete additional standard formats - sal_uInt32 nKey; - aFTable.Seek( SV_MAX_ANZ_STANDARD_FORMATE + 1 ); - while ( (nKey = aFTable.GetCurKey()) > SV_MAX_ANZ_STANDARD_FORMATE && - nKey < SV_COUNTRY_LANGUAGE_OFFSET ) - { - SvNumberformat* pEntry = (SvNumberformat*) aFTable.Remove( nKey ); - delete pEntry; - } - } -} - - -void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage ) -{ - sal_uInt32 nCLOffset = ImpGetCLOffset( LANGUAGE_SYSTEM ); - if ( nCLOffset > MaxCLOffset ) - return ; // no SYSTEM entries to replace - - const sal_uInt32 nMaxBuiltin = nCLOffset + SV_MAX_ANZ_STANDARD_FORMATE; - const sal_uInt32 nNextCL = nCLOffset + SV_COUNTRY_LANGUAGE_OFFSET; - sal_uInt32 nKey; - - // remove old builtin formats - aFTable.Seek( nCLOffset ); - while ( (nKey = aFTable.GetCurKey()) >= nCLOffset && nKey <= nMaxBuiltin && aFTable.Count() ) - { - SvNumberformat* pEntry = (SvNumberformat*) aFTable.Remove( nKey ); - delete pEntry; - } - - // move additional and user defined to temporary table - Table aOldTable; - while ( (nKey = aFTable.GetCurKey()) >= nCLOffset && nKey < nNextCL && aFTable.Count() ) - { - SvNumberformat* pEntry = (SvNumberformat*) aFTable.Remove( nKey ); - aOldTable.Insert( nKey, pEntry ); - } - - // generate new old builtin formats - // reset ActLnge otherwise ChangeIntl() wouldn't switch if already LANGUAGE_SYSTEM - ActLnge = LANGUAGE_DONTKNOW; - ChangeIntl( LANGUAGE_SYSTEM ); - ImpGenerateFormats( nCLOffset, TRUE ); - - // convert additional and user defined from old system to new system - SvNumberformat* pStdFormat = (SvNumberformat*) aFTable.Get( nCLOffset + ZF_STANDARD ); - sal_uInt32 nLastKey = nMaxBuiltin; - pFormatScanner->SetConvertMode( eOldLanguage, LANGUAGE_SYSTEM, TRUE ); - aOldTable.First(); - while ( aOldTable.Count() ) - { - nKey = aOldTable.GetCurKey(); - if ( nLastKey < nKey ) - nLastKey = nKey; - SvNumberformat* pOldEntry = (SvNumberformat*) aOldTable.Remove( nKey ); - String aString( pOldEntry->GetFormatstring() ); - xub_StrLen nCheckPos = STRING_NOTFOUND; - - // Same as PutEntry() but assures key position even if format code is - // a duplicate. Also won't mix up any LastInsertKey. - ChangeIntl( eOldLanguage ); - LanguageType eLge = eOldLanguage; // ConvertMode changes this - BOOL bCheck = FALSE; - SvNumberformat* pNewEntry = new SvNumberformat( aString, pFormatScanner, - pStringScanner, nCheckPos, eLge ); - if ( nCheckPos != 0 ) - delete pNewEntry; - else - { - short eCheckType = pNewEntry->GetType(); - if ( eCheckType != NUMBERFORMAT_UNDEFINED ) - pNewEntry->SetType( eCheckType | NUMBERFORMAT_DEFINED ); - else - pNewEntry->SetType( NUMBERFORMAT_DEFINED ); - - if ( !aFTable.Insert( nKey, pNewEntry ) ) - delete pNewEntry; - else - bCheck = TRUE; - } - DBG_ASSERT( bCheck, "SvNumberFormatter::ReplaceSystemCL: couldn't convert" ); - - delete pOldEntry; - } - pFormatScanner->SetConvertMode(FALSE); - pStdFormat->SetLastInsertKey( USHORT(nLastKey - nCLOffset) ); - - // append new system additional formats - NumberFormatCodeWrapper aNumberFormatCode( xServiceManager, GetLocale() ); - ImpGenerateAdditionalFormats( nCLOffset, aNumberFormatCode, TRUE ); -} - - -BOOL SvNumberFormatter::IsTextFormat(sal_uInt32 F_Index) const -{ - SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(F_Index); - if (!pFormat) - return FALSE; - else - return pFormat->IsTextFormat(); -} - -BOOL SvNumberFormatter::HasTextFormat(sal_uInt32 F_Index) const -{ - SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(F_Index); - if (!pFormat) - return FALSE; - else - return pFormat->HasTextFormat(); -} - -BOOL SvNumberFormatter::PutEntry(String& rString, - xub_StrLen& nCheckPos, - short& nType, - sal_uInt32& nKey, // Formatnummer - LanguageType eLnge) -{ - nKey = 0; - if (rString.Len() == 0) // keinen Leerstring - { - nCheckPos = 1; // -> Fehler - return FALSE; - } - if (eLnge == LANGUAGE_DONTKNOW) - eLnge = IniLnge; - - ChangeIntl(eLnge); // ggfs. austauschen - LanguageType eLge = eLnge; // Umgehung const fuer ConvertMode - BOOL bCheck = FALSE; - SvNumberformat* p_Entry = new SvNumberformat(rString, - pFormatScanner, - pStringScanner, - nCheckPos, - eLge); - if (nCheckPos == 0) // Format ok - { // Typvergleich: - short eCheckType = p_Entry->GetType(); - if ( eCheckType != NUMBERFORMAT_UNDEFINED) - { - p_Entry->SetType(eCheckType | NUMBERFORMAT_DEFINED); - nType = eCheckType; - } - else - { - p_Entry->SetType(NUMBERFORMAT_DEFINED); - nType = NUMBERFORMAT_DEFINED; - } - sal_uInt32 CLOffset = ImpGenerateCL(eLge); // ggfs. neu Standard- - // formate anlegen - nKey = ImpIsEntry(p_Entry->GetFormatstring(),CLOffset, eLge); - if (nKey != NUMBERFORMAT_ENTRY_NOT_FOUND) // schon vorhanden - delete p_Entry; - else - { - SvNumberformat* pStdFormat = - (SvNumberformat*) aFTable.Get(CLOffset + ZF_STANDARD); - sal_uInt32 nPos = CLOffset + pStdFormat->GetLastInsertKey(); - if (nPos - CLOffset >= SV_COUNTRY_LANGUAGE_OFFSET) - { - Sound::Beep(); - DBG_ERROR("SvNumberFormatter:: Zu viele Formate pro CL"); - delete p_Entry; - } - else if (!aFTable.Insert(nPos+1,p_Entry)) - delete p_Entry; - else - { - bCheck = TRUE; - nKey = nPos+1; - pStdFormat->SetLastInsertKey((USHORT) (nKey-CLOffset)); - } - } - } - else - delete p_Entry; - return bCheck; -} - -BOOL SvNumberFormatter::PutandConvertEntry(String& rString, - xub_StrLen& nCheckPos, - short& nType, - sal_uInt32& nKey, - LanguageType eLnge, - LanguageType eNewLnge) -{ - BOOL bRes; - if (eNewLnge == LANGUAGE_DONTKNOW) - eNewLnge = IniLnge; - - pFormatScanner->SetConvertMode(eLnge, eNewLnge); - bRes = PutEntry(rString, nCheckPos, nType, nKey, eLnge); - pFormatScanner->SetConvertMode(FALSE); - return bRes; -} - - -BOOL SvNumberFormatter::PutandConvertEntrySystem(String& rString, - xub_StrLen& nCheckPos, - short& nType, - sal_uInt32& nKey, - LanguageType eLnge, - LanguageType eNewLnge) -{ - BOOL bRes; - if (eNewLnge == LANGUAGE_DONTKNOW) - eNewLnge = IniLnge; - - pFormatScanner->SetConvertMode(eLnge, eNewLnge, TRUE); - bRes = PutEntry(rString, nCheckPos, nType, nKey, eLnge); - pFormatScanner->SetConvertMode(FALSE); - return bRes; -} - - -sal_uInt32 SvNumberFormatter::GetIndexPuttingAndConverting( String & rString, - LanguageType eLnge, LanguageType eSysLnge, short & rType, - BOOL & rNewInserted, xub_StrLen & rCheckPos ) -{ - sal_uInt32 nKey = NUMBERFORMAT_ENTRY_NOT_FOUND; - rNewInserted = FALSE; - rCheckPos = 0; - - // #62389# empty format string (of Writer) => General standard format - if (!rString.Len()) - ; // nothing - else if (eLnge == LANGUAGE_SYSTEM && eSysLnge != - Application::GetSettings().GetLanguage()) - { - sal_uInt32 nOrig = GetEntryKey( rString, eSysLnge ); - if (nOrig == NUMBERFORMAT_ENTRY_NOT_FOUND) - nKey = nOrig; // none avaliable, maybe user-defined - else - nKey = GetFormatForLanguageIfBuiltIn( nOrig, - Application::GetSettings().GetLanguage()); - if (nKey == nOrig) - { - // Not a builtin format, convert. - // The format code string may get modified and adapted to the real - // language and wouldn't match eSysLnge anymore, do that on a copy. - String aTmp( rString); - rNewInserted = PutandConvertEntrySystem( aTmp, rCheckPos, rType, - nKey, eLnge, Application::GetSettings().GetLanguage()); - if (rCheckPos > 0) - { - DBG_ERRORFILE("SvNumberFormatter::GetIndexPuttingAndConverting: bad format code string for current locale"); - nKey = NUMBERFORMAT_ENTRY_NOT_FOUND; - } - } - } - else - { - nKey = GetEntryKey( rString, eLnge); - if (nKey == NUMBERFORMAT_ENTRY_NOT_FOUND) - { - rNewInserted = PutEntry( rString, rCheckPos, rType, nKey, eLnge); - if (rCheckPos > 0) - { - DBG_ERRORFILE("SvNumberFormatter::GetIndexPuttingAndConverting: bad format code string for specified locale"); - nKey = NUMBERFORMAT_ENTRY_NOT_FOUND; - } - } - } - if (nKey == NUMBERFORMAT_ENTRY_NOT_FOUND) - nKey = GetStandardIndex( eLnge); - rType = GetType( nKey); - // Convert any (!) old "automatic" currency format to new fixed currency - // default format. - if ((rType & NUMBERFORMAT_CURRENCY) != 0) - { - const SvNumberformat* pFormat = GetEntry( nKey); - if (!pFormat->HasNewCurrency()) - { - if (rNewInserted) - { - DeleteEntry( nKey); // don't leave trails of rubbish - rNewInserted = FALSE; - } - nKey = GetStandardFormat( NUMBERFORMAT_CURRENCY, eLnge); - } - } - return nKey; -} - - -void SvNumberFormatter::DeleteEntry(sal_uInt32 nKey) -{ - SvNumberformat* pEntry = aFTable.Remove(nKey); - delete pEntry; -} - -void SvNumberFormatter::PrepareSave() -{ - SvNumberformat* pFormat = aFTable.First(); - while (pFormat) - { - pFormat->SetUsed(FALSE); - pFormat = aFTable.Next(); - } -} - -void SvNumberFormatter::SetFormatUsed(sal_uInt32 nFIndex) -{ - SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nFIndex); - if (pFormat) - pFormat->SetUsed(TRUE); -} - -BOOL SvNumberFormatter::Load( SvStream& rStream ) -{ - LanguageType eSysLang = Application::GetSettings().GetLanguage(); - SvNumberFormatter* pConverter = NULL; - - ImpSvNumMultipleReadHeader aHdr( rStream ); - USHORT nVersion; - rStream >> nVersion; - SvNumberformat* pEntry; - sal_uInt32 nPos; - LanguageType eSaveSysLang, eLoadSysLang; - USHORT nSysOnStore, eLge, eDummy; // Dummy fuer kompatibles Format - rStream >> nSysOnStore >> eLge; // Systemeinstellung aus - // Dokument - eSaveSysLang = (nVersion < SV_NUMBERFORMATTER_VERSION_SYSTORE ? - LANGUAGE_SYSTEM : (LanguageType) nSysOnStore); - LanguageType eLnge = (LanguageType) eLge; - ImpChangeSysCL( eLnge, TRUE ); - - rStream >> nPos; - while (nPos != NUMBERFORMAT_ENTRY_NOT_FOUND) - { - rStream >> eDummy >> eLge; - eLnge = (LanguageType) eLge; - ImpGenerateCL( eLnge, TRUE ); // ggfs. neue Standardformate anlegen - - sal_uInt32 nOffset = nPos % SV_COUNTRY_LANGUAGE_OFFSET; // relativIndex - BOOL bUserDefined = (nOffset > SV_MAX_ANZ_STANDARD_FORMATE); - //! HACK! ER 29.07.97 15:15 - // SaveLang wurde bei SYSTEM nicht gespeichert sondern war auch SYSTEM, - // erst ab 364i Unterscheidung moeglich - BOOL bConversionHack; - if ( eLnge == LANGUAGE_SYSTEM ) - { - if ( nVersion < SV_NUMBERFORMATTER_VERSION_SYSTORE ) - { - bConversionHack = bUserDefined; - eLoadSysLang = eSaveSysLang; - } - else - { - bConversionHack = FALSE; - eLoadSysLang = eSysLang; - } - } - else - { - bConversionHack = FALSE; - eLoadSysLang = eSaveSysLang; - } - - pEntry = new SvNumberformat(*pFormatScanner, eLnge); - if ( bConversionHack ) - { // SYSTEM - // nVersion < SV_NUMBERFORMATTER_VERSION_SYSTORE - // nVersion < SV_NUMBERFORMATTER_VERSION_KEYWORDS - if ( !pConverter ) - pConverter = new SvNumberFormatter( xServiceManager, eSysLang ); - NfHackConversion eHackConversion = pEntry->Load( - rStream, aHdr, pConverter, *pStringScanner ); - switch ( eHackConversion ) - { - case NF_CONVERT_GERMAN_ENGLISH : - pEntry->ConvertLanguage( *pConverter, - LANGUAGE_ENGLISH_US, eSysLang, TRUE ); - break; - case NF_CONVERT_ENGLISH_GERMAN : - switch ( eSysLang ) - { - case LANGUAGE_GERMAN: - case LANGUAGE_GERMAN_SWISS: - case LANGUAGE_GERMAN_AUSTRIAN: - case LANGUAGE_GERMAN_LUXEMBOURG: - case LANGUAGE_GERMAN_LIECHTENSTEIN: - // alles beim alten - break; - default: - pEntry->ConvertLanguage( *pConverter, - LANGUAGE_GERMAN, eSysLang, TRUE ); - } - break; - case NF_CONVERT_NONE : - break; // -Wall not handled. - } - - } - else - { - pEntry->Load( rStream, aHdr, NULL, *pStringScanner ); - if ( !bUserDefined ) - bUserDefined = (pEntry->GetNewStandardDefined() > SV_NUMBERFORMATTER_VERSION); - if ( bUserDefined ) - { - if ( eSaveSysLang != eLoadSysLang ) - { // SYSTEM verschieden - if ( !pConverter ) - pConverter = new SvNumberFormatter( xServiceManager, eSysLang ); - if ( nVersion < SV_NUMBERFORMATTER_VERSION_KEYWORDS ) - { - switch ( eSaveSysLang ) - { - case LANGUAGE_GERMAN: - case LANGUAGE_GERMAN_SWISS: - case LANGUAGE_GERMAN_AUSTRIAN: - case LANGUAGE_GERMAN_LUXEMBOURG: - case LANGUAGE_GERMAN_LIECHTENSTEIN: - // alles beim alten - pEntry->ConvertLanguage( *pConverter, - eSaveSysLang, eLoadSysLang, TRUE ); - break; - default: - // alte english nach neuem anderen - pEntry->ConvertLanguage( *pConverter, - LANGUAGE_ENGLISH_US, eLoadSysLang, TRUE ); - } - } - else - pEntry->ConvertLanguage( *pConverter, - eSaveSysLang, eLoadSysLang, TRUE ); - } - else - { // nicht SYSTEM oder gleiches SYSTEM - if ( nVersion < SV_NUMBERFORMATTER_VERSION_KEYWORDS ) - { - LanguageType eLoadLang; - BOOL bSystem; - if ( eLnge == LANGUAGE_SYSTEM ) - { - eLoadLang = eSysLang; - bSystem = TRUE; - } - else - { - eLoadLang = eLnge; - bSystem = FALSE; - } - switch ( eLoadLang ) - { - case LANGUAGE_GERMAN: - case LANGUAGE_GERMAN_SWISS: - case LANGUAGE_GERMAN_AUSTRIAN: - case LANGUAGE_GERMAN_LUXEMBOURG: - case LANGUAGE_GERMAN_LIECHTENSTEIN: - // alles beim alten - break; - default: - // alte english nach neuem anderen - if ( !pConverter ) - pConverter = new SvNumberFormatter( xServiceManager, eSysLang ); - pEntry->ConvertLanguage( *pConverter, - LANGUAGE_ENGLISH_US, eLoadLang, bSystem ); - } - } - } - } - } - if ( nOffset == 0 ) // StandardFormat - { - SvNumberformat* pEnt = aFTable.Get(nPos); - if (pEnt) - pEnt->SetLastInsertKey(pEntry->GetLastInsertKey()); - } - if (!aFTable.Insert(nPos, pEntry)) - delete pEntry; - rStream >> nPos; - } - - // ab SV_NUMBERFORMATTER_VERSION_YEAR2000 - if ( nVersion >= SV_NUMBERFORMATTER_VERSION_YEAR2000 ) - { - aHdr.StartEntry(); - if ( aHdr.BytesLeft() >= sizeof(UINT16) ) - { - UINT16 nY2k; - rStream >> nY2k; - if ( nVersion < SV_NUMBERFORMATTER_VERSION_TWODIGITYEAR && nY2k < 100 ) - nY2k += 1901; // war vor src513e: 29, jetzt: 1930 - SetYear2000( nY2k ); - } - aHdr.EndEntry(); - } - - if ( pConverter ) - delete pConverter; - - // generate additional i18n standard formats for all used locales - LanguageType eOldLanguage = ActLnge; - NumberFormatCodeWrapper aNumberFormatCode( xServiceManager, GetLocale() ); - SvUShorts aList; - GetUsedLanguages( aList ); - USHORT nCount = aList.Count(); - for ( USHORT j=0; jFirst(); - while (pEntry) - { - // Gespeichert werden alle markierten, benutzerdefinierten Formate und - // jeweils das Standardformat zu allen angewaehlten CL-Kombinationen - // sowie NewStandardDefined - if ( pEntry->GetUsed() || (pEntry->GetType() & NUMBERFORMAT_DEFINED) || - pEntry->GetNewStandardDefined() || - (pTable->GetCurKey() % SV_COUNTRY_LANGUAGE_OFFSET == 0) ) - { - rStream << static_cast(pTable->GetCurKey()) - << (USHORT) LANGUAGE_SYSTEM - << (USHORT) pEntry->GetLanguage(); - pEntry->Save(rStream, aHdr); - } - pEntry = (SvNumberformat*) pTable->Next(); - } - rStream << NUMBERFORMAT_ENTRY_NOT_FOUND; // EndeKennung - - // ab SV_NUMBERFORMATTER_VERSION_YEAR2000 - aHdr.StartEntry(); - rStream << (UINT16) GetYear2000(); - aHdr.EndEntry(); - - if (rStream.GetError()) - return FALSE; - else - return TRUE; -} - -// static -void SvNumberFormatter::SkipNumberFormatterInStream( SvStream& rStream ) -{ - ImpSvNumMultipleReadHeader::Skip( rStream ); -} - -void SvNumberFormatter::GetUsedLanguages( SvUShorts& rList ) -{ - rList.Remove( 0, rList.Count() ); - - sal_uInt32 nOffset = 0; - while (nOffset <= MaxCLOffset) - { - SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nOffset); - if (pFormat) - rList.Insert( pFormat->GetLanguage(), rList.Count() ); - nOffset += SV_COUNTRY_LANGUAGE_OFFSET; - } -} - - -void SvNumberFormatter::FillKeywordTable( NfKeywordTable& rKeywords, - LanguageType eLang ) -{ - ChangeIntl( eLang ); - const String* pTable = pFormatScanner->GetKeywords(); - for ( USHORT i = 0; i < NF_KEYWORD_ENTRIES_COUNT; ++i ) - { - rKeywords[i] = pTable[i]; - } -} - - -String SvNumberFormatter::GetKeyword( LanguageType eLnge, USHORT nIndex ) -{ - ChangeIntl(eLnge); - const String* pTable = pFormatScanner->GetKeywords(); - if ( pTable && nIndex < NF_KEYWORD_ENTRIES_COUNT ) - return pTable[nIndex]; - - DBG_ERROR("GetKeyword: invalid index"); - return String(); -} - - -String SvNumberFormatter::GetStandardName( LanguageType eLnge ) -{ - ChangeIntl( eLnge ); - return pFormatScanner->GetStandardName(); -} - - -sal_uInt32 SvNumberFormatter::ImpGetCLOffset(LanguageType eLnge) const -{ - SvNumberformat* pFormat; - sal_uInt32 nOffset = 0; - while (nOffset <= MaxCLOffset) - { - pFormat = (SvNumberformat*) aFTable.Get(nOffset); - if (pFormat && pFormat->GetLanguage() == eLnge) - return nOffset; - nOffset += SV_COUNTRY_LANGUAGE_OFFSET; - } - return nOffset; -} - -sal_uInt32 SvNumberFormatter::ImpIsEntry(const String& rString, - sal_uInt32 nCLOffset, - LanguageType eLnge) -{ -#ifndef NF_COMMENT_IN_FORMATSTRING -#error NF_COMMENT_IN_FORMATSTRING not defined (zformat.hxx) -#endif -#if NF_COMMENT_IN_FORMATSTRING - String aStr( rString ); - SvNumberformat::EraseComment( aStr ); -#endif - sal_uInt32 res = NUMBERFORMAT_ENTRY_NOT_FOUND; - SvNumberformat* pEntry; - pEntry = (SvNumberformat*) aFTable.Seek(nCLOffset); - while ( res == NUMBERFORMAT_ENTRY_NOT_FOUND && - pEntry && pEntry->GetLanguage() == eLnge ) - { -#if NF_COMMENT_IN_FORMATSTRING - if ( pEntry->GetComment().Len() ) - { - String aFormat( pEntry->GetFormatstring() ); - SvNumberformat::EraseComment( aFormat ); - if ( aStr == aFormat ) - res = aFTable.GetCurKey(); - else - pEntry = (SvNumberformat*) aFTable.Next(); - } - else - { - if ( aStr == pEntry->GetFormatstring() ) - res = aFTable.GetCurKey(); - else - pEntry = (SvNumberformat*) aFTable.Next(); - } -#else - if ( rString == pEntry->GetFormatstring() ) - res = aFTable.GetCurKey(); - else - pEntry = (SvNumberformat*) aFTable.Next(); -#endif - } - return res; -} - - -SvNumberFormatTable& SvNumberFormatter::GetFirstEntryTable( - short& eType, - sal_uInt32& FIndex, - LanguageType& rLnge) -{ - short eTypetmp = eType; - if (eType == NUMBERFORMAT_ALL) // Leere Zelle oder don't care - rLnge = IniLnge; - else - { - SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(FIndex); - if (!pFormat) - { -// DBG_ERROR("SvNumberFormatter:: Unbekanntes altes Zahlformat (1)"); - rLnge = IniLnge; - eType = NUMBERFORMAT_ALL; - eTypetmp = eType; - } - else - { - rLnge = pFormat->GetLanguage(); - eType = pFormat->GetType()&~NUMBERFORMAT_DEFINED; - if (eType == 0) - { - eType = NUMBERFORMAT_DEFINED; - eTypetmp = eType; - } - else if (eType == NUMBERFORMAT_DATETIME) - { - eTypetmp = eType; - eType = NUMBERFORMAT_DATE; - } - else - eTypetmp = eType; - } - } - ChangeIntl(rLnge); - return GetEntryTable(eTypetmp, FIndex, rLnge); -} - -sal_uInt32 SvNumberFormatter::ImpGenerateCL( LanguageType eLnge, BOOL bLoadingSO5 ) -{ - ChangeIntl(eLnge); - sal_uInt32 CLOffset = ImpGetCLOffset(ActLnge); - if (CLOffset > MaxCLOffset) - { // new CL combination - if (LocaleDataWrapper::areChecksEnabled()) - { - Locale aLoadedLocale = xLocaleData->getLoadedLocale(); - if ( aLoadedLocale.Language != aLocale.Language || - aLoadedLocale.Country != aLocale.Country ) - { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( - "SvNumerFormatter::ImpGenerateCL: locales don't match:")); - LocaleDataWrapper::outputCheckMessage( - xLocaleData->appendLocaleInfo( aMsg )); - } - // test XML locale data FormatElement entries - { - uno::Sequence< i18n::FormatElement > xSeq = - xLocaleData->getAllFormats(); - // A test for completeness of formatindex="0" ... - // formatindex="47" is not needed here since it is done in - // ImpGenerateFormats(). - - // Test for dupes of formatindex="..." - for ( sal_Int32 j = 0; j < xSeq.getLength(); j++ ) - { - sal_Int16 nIdx = xSeq[j].formatIndex; - String aDupes; - for ( sal_Int32 i = 0; i < xSeq.getLength(); i++ ) - { - if ( i != j && xSeq[i].formatIndex == nIdx ) - { - aDupes += String::CreateFromInt32( i ); - aDupes += '('; - aDupes += String( xSeq[i].formatKey ); - aDupes += ')'; - aDupes += ' '; - } - } - if ( aDupes.Len() ) - { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( - "XML locale data FormatElement formatindex dupe: ")); - aMsg += String::CreateFromInt32( nIdx ); - aMsg.AppendAscii( RTL_CONSTASCII_STRINGPARAM( - "\nFormatElements: ")); - aMsg += String::CreateFromInt32( j ); - aMsg += '('; - aMsg += String( xSeq[j].formatKey ); - aMsg += ')'; - aMsg += ' '; - aMsg += aDupes; - LocaleDataWrapper::outputCheckMessage( - xLocaleData->appendLocaleInfo( aMsg )); - } - } - } - } - - MaxCLOffset += SV_COUNTRY_LANGUAGE_OFFSET; - ImpGenerateFormats( MaxCLOffset, bLoadingSO5 ); - CLOffset = MaxCLOffset; - } - return CLOffset; -} - -SvNumberFormatTable& SvNumberFormatter::ChangeCL(short eType, - sal_uInt32& FIndex, - LanguageType eLnge) -{ - ImpGenerateCL(eLnge); - return GetEntryTable(eType, FIndex, ActLnge); -} - -SvNumberFormatTable& SvNumberFormatter::GetEntryTable( - short eType, - sal_uInt32& FIndex, - LanguageType eLnge) -{ - if ( pFormatTable ) - pFormatTable->Clear(); - else - pFormatTable = new SvNumberFormatTable; - ChangeIntl(eLnge); - sal_uInt32 CLOffset = ImpGetCLOffset(ActLnge); - - // Might generate and insert a default format for the given type - // (e.g. currency) => has to be done before collecting formats. - sal_uInt32 nDefaultIndex = GetStandardFormat( eType, ActLnge ); - - SvNumberformat* pEntry; - pEntry = (SvNumberformat*) aFTable.Seek(CLOffset); - - if (eType == NUMBERFORMAT_ALL) - { - while (pEntry && pEntry->GetLanguage() == ActLnge) - { // copy all entries to output table - pFormatTable->Insert( aFTable.GetCurKey(), pEntry ); - pEntry = (SvNumberformat*) aFTable.Next(); - } - } - else - { - while (pEntry && pEntry->GetLanguage() == ActLnge) - { // copy entries of queried type to output table - if ((pEntry->GetType()) & eType) - pFormatTable->Insert(aFTable.GetCurKey(),pEntry); - pEntry = (SvNumberformat*) aFTable.Next(); - } - } - if ( pFormatTable->Count() > 0 ) - { // select default if queried format doesn't exist or queried type or - // language differ from existing format - pEntry = aFTable.Get(FIndex); - if ( !pEntry || !(pEntry->GetType() & eType) || pEntry->GetLanguage() != ActLnge ) - FIndex = nDefaultIndex; - } - return *pFormatTable; -} - -BOOL SvNumberFormatter::IsNumberFormat(const String& sString, - sal_uInt32& F_Index, - double& fOutNumber) -{ - short FType; - const SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(F_Index); - if (!pFormat) - { -// DBG_ERROR("SvNumberFormatter:: Unbekanntes altes Zahlformat (2)"); - ChangeIntl(IniLnge); - FType = NUMBERFORMAT_NUMBER; - } - else - { - FType = pFormat->GetType() &~NUMBERFORMAT_DEFINED; - if (FType == 0) - FType = NUMBERFORMAT_DEFINED; - ChangeIntl(pFormat->GetLanguage()); - } - BOOL res; - short RType = FType; - // Ergebnistyp - // ohne def-Kennung - if (RType == NUMBERFORMAT_TEXT) // Zahlzelle ->Stringz. - res = FALSE; - else - res = pStringScanner->IsNumberFormat(sString, RType, fOutNumber, pFormat); - - if (res && !IsCompatible(FType, RType)) // unpassender Typ - { - switch ( RType ) - { - case NUMBERFORMAT_TIME : - { - if ( pStringScanner->GetDecPos() ) - { // 100stel Sekunden - if ( pStringScanner->GetAnzNums() > 3 || fOutNumber < 0.0 ) - F_Index = GetFormatIndex( NF_TIME_HH_MMSS00, ActLnge ); - else - F_Index = GetFormatIndex( NF_TIME_MMSS00, ActLnge ); - } - else if ( fOutNumber >= 1.0 || fOutNumber < 0.0 ) - F_Index = GetFormatIndex( NF_TIME_HH_MMSS, ActLnge ); - else - F_Index = GetStandardFormat( RType, ActLnge ); - } - break; - default: - F_Index = GetStandardFormat( RType, ActLnge ); - } - } - return res; -} - -BOOL SvNumberFormatter::IsCompatible(short eOldType, - short eNewType) -{ - if (eOldType == eNewType) - return TRUE; - else if (eOldType == NUMBERFORMAT_DEFINED) - return TRUE; - else - { - switch (eNewType) - { - case NUMBERFORMAT_NUMBER: - { - switch (eOldType) - { - case NUMBERFORMAT_PERCENT: - case NUMBERFORMAT_CURRENCY: - case NUMBERFORMAT_SCIENTIFIC: - case NUMBERFORMAT_FRACTION: -// case NUMBERFORMAT_LOGICAL: - case NUMBERFORMAT_DEFINED: - return TRUE; - default: - return FALSE; - } - } - break; - case NUMBERFORMAT_DATE: - { - switch (eOldType) - { - case NUMBERFORMAT_DATETIME: - return TRUE; - default: - return FALSE; - } - } - break; - case NUMBERFORMAT_TIME: - { - switch (eOldType) - { - case NUMBERFORMAT_DATETIME: - return TRUE; - default: - return FALSE; - } - } - break; - case NUMBERFORMAT_DATETIME: - { - switch (eOldType) - { - case NUMBERFORMAT_TIME: - case NUMBERFORMAT_DATE: - return TRUE; - default: - return FALSE; - } - } - break; - default: - return FALSE; - } - return FALSE; - } -} - - -sal_uInt32 SvNumberFormatter::ImpGetDefaultFormat( short nType ) -{ - sal_uInt32 CLOffset = ImpGetCLOffset( ActLnge ); - sal_uInt32 nSearch; - switch( nType ) - { - case NUMBERFORMAT_DATE : - nSearch = CLOffset + ZF_STANDARD_DATE; - break; - case NUMBERFORMAT_TIME : - nSearch = CLOffset + ZF_STANDARD_TIME; - break; - case NUMBERFORMAT_DATETIME : - nSearch = CLOffset + ZF_STANDARD_DATETIME; - break; - case NUMBERFORMAT_PERCENT : - nSearch = CLOffset + ZF_STANDARD_PERCENT; - break; - case NUMBERFORMAT_SCIENTIFIC: - nSearch = CLOffset + ZF_STANDARD_SCIENTIFIC; - break; - default: - nSearch = CLOffset + ZF_STANDARD; - } - sal_uInt32 nDefaultFormat = (sal_uInt32)(sal_uIntPtr) aDefaultFormatKeys.Get( nSearch ); - if ( !nDefaultFormat ) - nDefaultFormat = NUMBERFORMAT_ENTRY_NOT_FOUND; - if ( nDefaultFormat == NUMBERFORMAT_ENTRY_NOT_FOUND ) - { // look for a defined standard - sal_uInt32 nStopKey = CLOffset + SV_COUNTRY_LANGUAGE_OFFSET; - sal_uInt32 nKey; - aFTable.Seek( CLOffset ); - while ( (nKey = aFTable.GetCurKey()) >= CLOffset && nKey < nStopKey ) - { - const SvNumberformat* pEntry = - (const SvNumberformat*) aFTable.GetCurObject(); - if ( pEntry->IsStandard() && ((pEntry->GetType() & - ~NUMBERFORMAT_DEFINED) == nType) ) - { - nDefaultFormat = nKey; - break; // while - } - aFTable.Next(); - } - - if ( nDefaultFormat == NUMBERFORMAT_ENTRY_NOT_FOUND ) - { // none found, use old fixed standards - switch( nType ) - { - case NUMBERFORMAT_DATE : - nDefaultFormat = CLOffset + ZF_STANDARD_DATE; - break; - case NUMBERFORMAT_TIME : - nDefaultFormat = CLOffset + ZF_STANDARD_TIME+1; - break; - case NUMBERFORMAT_DATETIME : - nDefaultFormat = CLOffset + ZF_STANDARD_DATETIME; - break; - case NUMBERFORMAT_PERCENT : - nDefaultFormat = CLOffset + ZF_STANDARD_PERCENT+1; - break; - case NUMBERFORMAT_SCIENTIFIC: - nDefaultFormat = CLOffset + ZF_STANDARD_SCIENTIFIC; - break; - default: - nDefaultFormat = CLOffset + ZF_STANDARD; - } - } - aDefaultFormatKeys.Insert( nSearch, (void*) nDefaultFormat ); - } - return nDefaultFormat; -} - - -sal_uInt32 SvNumberFormatter::GetStandardFormat( short eType, LanguageType eLnge ) -{ - sal_uInt32 CLOffset = ImpGenerateCL(eLnge); - switch(eType) - { - case NUMBERFORMAT_CURRENCY : - { - if ( eLnge == LANGUAGE_SYSTEM ) - return ImpGetDefaultSystemCurrencyFormat(); - else - return ImpGetDefaultCurrencyFormat(); - } - case NUMBERFORMAT_DATE : - case NUMBERFORMAT_TIME : - case NUMBERFORMAT_DATETIME : - case NUMBERFORMAT_PERCENT : - case NUMBERFORMAT_SCIENTIFIC: - return ImpGetDefaultFormat( eType ); - - case NUMBERFORMAT_FRACTION : return CLOffset + ZF_STANDARD_FRACTION; - case NUMBERFORMAT_LOGICAL : return CLOffset + ZF_STANDARD_LOGICAL; - case NUMBERFORMAT_TEXT : return CLOffset + ZF_STANDARD_TEXT; - case NUMBERFORMAT_ALL : - case NUMBERFORMAT_DEFINED : - case NUMBERFORMAT_NUMBER : - case NUMBERFORMAT_UNDEFINED : - default : return CLOffset + ZF_STANDARD; - } -} - -BOOL SvNumberFormatter::IsSpecialStandardFormat( sal_uInt32 nFIndex, - LanguageType eLnge ) -{ - return - nFIndex == GetFormatIndex( NF_TIME_MMSS00, eLnge ) || - nFIndex == GetFormatIndex( NF_TIME_HH_MMSS00, eLnge ) || - nFIndex == GetFormatIndex( NF_TIME_HH_MMSS, eLnge ) - ; -} - -sal_uInt32 SvNumberFormatter::GetStandardFormat( sal_uInt32 nFIndex, short eType, - LanguageType eLnge ) -{ - if ( IsSpecialStandardFormat( nFIndex, eLnge ) ) - return nFIndex; - else - return GetStandardFormat( eType, eLnge ); -} - -sal_uInt32 SvNumberFormatter::GetStandardFormat( double fNumber, sal_uInt32 nFIndex, - short eType, LanguageType eLnge ) -{ - if ( IsSpecialStandardFormat( nFIndex, eLnge ) ) - return nFIndex; - - switch( eType ) - { - case NUMBERFORMAT_TIME : - { - BOOL bSign; - if ( fNumber < 0.0 ) - { - bSign = TRUE; - fNumber = -fNumber; - } - else - bSign = FALSE; - double fSeconds = fNumber * 86400; - if ( floor( fSeconds + 0.5 ) * 100 != floor( fSeconds * 100 + 0.5 ) ) - { // mit 100stel Sekunden - if ( bSign || fSeconds >= 3600 ) - return GetFormatIndex( NF_TIME_HH_MMSS00, eLnge ); - else - return GetFormatIndex( NF_TIME_MMSS00, eLnge ); - } - else - { - if ( bSign || fNumber >= 1.0 ) - return GetFormatIndex( NF_TIME_HH_MMSS, eLnge ); - else - return GetStandardFormat( eType, eLnge ); - } - } - default: - return GetStandardFormat( eType, eLnge ); - } -} - -void SvNumberFormatter::GetInputLineString(const double& fOutNumber, - sal_uInt32 nFIndex, - String& sOutString) -{ - SvNumberformat* pFormat; - short nOldPrec; - Color* pColor; - pFormat = (SvNumberformat*) aFTable.Get(nFIndex); - if (!pFormat) - pFormat = aFTable.Get(ZF_STANDARD); - LanguageType eLang = pFormat->GetLanguage(); - ChangeIntl( eLang ); - short eType = pFormat->GetType() & ~NUMBERFORMAT_DEFINED; - if (eType == 0) - eType = NUMBERFORMAT_DEFINED; - nOldPrec = -1; - if (eType == NUMBERFORMAT_NUMBER || eType == NUMBERFORMAT_PERCENT - || eType == NUMBERFORMAT_CURRENCY - || eType == NUMBERFORMAT_SCIENTIFIC - || eType == NUMBERFORMAT_FRACTION) - { - if (eType != NUMBERFORMAT_PERCENT) // spaeter Sonderbehandlung % - eType = NUMBERFORMAT_NUMBER; - nOldPrec = pFormatScanner->GetStandardPrec(); - ChangeStandardPrec(300); // Merkwert - } - sal_uInt32 nKey = nFIndex; - switch ( eType ) - { // #61619# immer vierstelliges Jahr editieren - case NUMBERFORMAT_DATE : - nKey = GetFormatIndex( NF_DATE_SYS_DDMMYYYY, eLang ); - break; - case NUMBERFORMAT_DATETIME : - nKey = GetFormatIndex( NF_DATETIME_SYS_DDMMYYYY_HHMMSS, eLang ); - break; - default: - nKey = GetStandardFormat( fOutNumber, nFIndex, eType, eLang ); - } - if ( nKey != nFIndex ) - pFormat = (SvNumberformat*) aFTable.Get( nKey ); - if (pFormat) - { - if ( eType == NUMBERFORMAT_TIME && pFormat->GetFormatPrecision() ) - { - nOldPrec = pFormatScanner->GetStandardPrec(); - ChangeStandardPrec(300); // Merkwert - } - pFormat->GetOutputString(fOutNumber, sOutString, &pColor); - } - if (nOldPrec != -1) - ChangeStandardPrec(nOldPrec); -} - -void SvNumberFormatter::GetOutputString(const double& fOutNumber, - sal_uInt32 nFIndex, - String& sOutString, - Color** ppColor) -{ - if (bNoZero && fOutNumber == 0.0) - { - sOutString.Erase(); - return; - } - SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nFIndex); - if (!pFormat) - pFormat = aFTable.Get(ZF_STANDARD); - ChangeIntl(pFormat->GetLanguage()); - pFormat->GetOutputString(fOutNumber, sOutString, ppColor); -} - -void SvNumberFormatter::GetOutputString(String& sString, - sal_uInt32 nFIndex, - String& sOutString, - Color** ppColor) -{ - SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nFIndex); - if (!pFormat) - pFormat = aFTable.Get(ZF_STANDARD_TEXT); - if (!pFormat->IsTextFormat() && !pFormat->HasTextFormat()) - { - *ppColor = NULL; - sOutString = sString; - } - else - { - ChangeIntl(pFormat->GetLanguage()); - pFormat->GetOutputString(sString, sOutString, ppColor); - } -} - -BOOL SvNumberFormatter::GetPreviewString(const String& sFormatString, - double fPreviewNumber, - String& sOutString, - Color** ppColor, - LanguageType eLnge) -{ - if (sFormatString.Len() == 0) // keinen Leerstring - return FALSE; - - xub_StrLen nCheckPos = STRING_NOTFOUND; - sal_uInt32 nKey; - if (eLnge == LANGUAGE_DONTKNOW) - eLnge = IniLnge; - ChangeIntl(eLnge); // ggfs. austauschen - eLnge = ActLnge; - String sTmpString = sFormatString; - SvNumberformat* p_Entry = new SvNumberformat(sTmpString, - pFormatScanner, - pStringScanner, - nCheckPos, - eLnge); - if (nCheckPos == 0) // String ok - { - sal_uInt32 CLOffset = ImpGenerateCL(eLnge); // ggfs. neu Standard- - // formate anlegen - nKey = ImpIsEntry(p_Entry->GetFormatstring(),CLOffset, eLnge); - if (nKey != NUMBERFORMAT_ENTRY_NOT_FOUND) // schon vorhanden - GetOutputString(fPreviewNumber,nKey,sOutString,ppColor); - else - p_Entry->GetOutputString(fPreviewNumber,sOutString, ppColor); - delete p_Entry; - return TRUE; - } - else - { - delete p_Entry; - return FALSE; - } -} - -BOOL SvNumberFormatter::GetPreviewStringGuess( const String& sFormatString, - double fPreviewNumber, - String& sOutString, - Color** ppColor, - LanguageType eLnge ) -{ - if (sFormatString.Len() == 0) // keinen Leerstring - return FALSE; - - if (eLnge == LANGUAGE_DONTKNOW) - eLnge = IniLnge; - - ChangeIntl( eLnge ); - eLnge = ActLnge; - BOOL bEnglish = (eLnge == LANGUAGE_ENGLISH_US); - - String aFormatStringUpper( pCharClass->upper( sFormatString ) ); - sal_uInt32 nCLOffset = ImpGenerateCL( eLnge ); - sal_uInt32 nKey = ImpIsEntry( aFormatStringUpper, nCLOffset, eLnge ); - if ( nKey != NUMBERFORMAT_ENTRY_NOT_FOUND ) - { // Zielformat vorhanden - GetOutputString( fPreviewNumber, nKey, sOutString, ppColor ); - return TRUE; - } - - SvNumberformat *pEntry = NULL; - xub_StrLen nCheckPos = STRING_NOTFOUND; - String sTmpString; - - if ( bEnglish ) - { - sTmpString = sFormatString; - pEntry = new SvNumberformat( sTmpString, pFormatScanner, - pStringScanner, nCheckPos, eLnge ); - } - else - { - nCLOffset = ImpGenerateCL( LANGUAGE_ENGLISH_US ); - nKey = ImpIsEntry( aFormatStringUpper, nCLOffset, LANGUAGE_ENGLISH_US ); - BOOL bEnglishFormat = (nKey != NUMBERFORMAT_ENTRY_NOT_FOUND); - - // try english --> other bzw. english nach other konvertieren - LanguageType eFormatLang = LANGUAGE_ENGLISH_US; - pFormatScanner->SetConvertMode( LANGUAGE_ENGLISH_US, eLnge ); - sTmpString = sFormatString; - pEntry = new SvNumberformat( sTmpString, pFormatScanner, - pStringScanner, nCheckPos, eFormatLang ); - pFormatScanner->SetConvertMode( FALSE ); - ChangeIntl( eLnge ); - - if ( !bEnglishFormat ) - { - if ( nCheckPos > 0 || xTransliteration->isEqual( sFormatString, - pEntry->GetFormatstring() ) ) - { // other Format - delete pEntry; - sTmpString = sFormatString; - pEntry = new SvNumberformat( sTmpString, pFormatScanner, - pStringScanner, nCheckPos, eLnge ); - } - else - { // verify english - xub_StrLen nCheckPos2 = STRING_NOTFOUND; - // try other --> english - eFormatLang = eLnge; - pFormatScanner->SetConvertMode( eLnge, LANGUAGE_ENGLISH_US ); - sTmpString = sFormatString; - SvNumberformat* pEntry2 = new SvNumberformat( sTmpString, pFormatScanner, - pStringScanner, nCheckPos2, eFormatLang ); - pFormatScanner->SetConvertMode( FALSE ); - ChangeIntl( eLnge ); - if ( nCheckPos2 == 0 && !xTransliteration->isEqual( sFormatString, - pEntry2->GetFormatstring() ) ) - { // other Format - delete pEntry; - sTmpString = sFormatString; - pEntry = new SvNumberformat( sTmpString, pFormatScanner, - pStringScanner, nCheckPos, eLnge ); - } - delete pEntry2; - } - } - } - - if (nCheckPos == 0) // String ok - { - ImpGenerateCL( eLnge ); // ggfs. neu Standardformate anlegen - pEntry->GetOutputString( fPreviewNumber, sOutString, ppColor ); - delete pEntry; - return TRUE; - } - delete pEntry; - return FALSE; -} - -sal_uInt32 SvNumberFormatter::TestNewString(const String& sFormatString, - LanguageType eLnge) -{ - if (sFormatString.Len() == 0) // keinen Leerstring - return NUMBERFORMAT_ENTRY_NOT_FOUND; - - xub_StrLen nCheckPos = STRING_NOTFOUND; - if (eLnge == LANGUAGE_DONTKNOW) - eLnge = IniLnge; - ChangeIntl(eLnge); // ggfs. austauschen - eLnge = ActLnge; - sal_uInt32 nRes; - String sTmpString = sFormatString; - SvNumberformat* pEntry = new SvNumberformat(sTmpString, - pFormatScanner, - pStringScanner, - nCheckPos, - eLnge); - if (nCheckPos == 0) // String ok - { - sal_uInt32 CLOffset = ImpGenerateCL(eLnge); // ggfs. neu Standard- - // formate anlegen - nRes = ImpIsEntry(pEntry->GetFormatstring(),CLOffset, eLnge); - // schon vorhanden ? - } - else - nRes = NUMBERFORMAT_ENTRY_NOT_FOUND; - delete pEntry; - return nRes; -} - -SvNumberformat* SvNumberFormatter::ImpInsertFormat( - const ::com::sun::star::i18n::NumberFormatCode& rCode, - sal_uInt32 nPos, BOOL bAfterLoadingSO5, sal_Int16 nOrgIndex ) -{ - String aCodeStr( rCode.Code ); - if ( rCode.Index < NF_INDEX_TABLE_ENTRIES && - rCode.Usage == ::com::sun::star::i18n::KNumberFormatUsage::CURRENCY && - rCode.Index != NF_CURRENCY_1000DEC2_CCC ) - { // strip surrounding [$...] on automatic currency - if ( aCodeStr.SearchAscii( "[$" ) != STRING_NOTFOUND ) - aCodeStr = SvNumberformat::StripNewCurrencyDelimiters( aCodeStr, FALSE ); - else - { - if (LocaleDataWrapper::areChecksEnabled() && - rCode.Index != NF_CURRENCY_1000DEC2_CCC ) - { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( - "SvNumberFormatter::ImpInsertFormat: no [$...] on currency format code, index ")); - aMsg += String::CreateFromInt32( rCode.Index ); - aMsg.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ":\n")); - aMsg += String( rCode.Code ); - LocaleDataWrapper::outputCheckMessage( - xLocaleData->appendLocaleInfo( aMsg)); - } - } - } - xub_StrLen nCheckPos = 0; - SvNumberformat* pFormat = new SvNumberformat(aCodeStr, - pFormatScanner, - pStringScanner, - nCheckPos, - ActLnge); - if ( !pFormat || nCheckPos > 0 ) - { - if (LocaleDataWrapper::areChecksEnabled()) - { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( - "SvNumberFormatter::ImpInsertFormat: bad format code, index ")); - aMsg += String::CreateFromInt32( rCode.Index ); - aMsg += '\n'; - aMsg += String( rCode.Code ); - LocaleDataWrapper::outputCheckMessage( - xLocaleData->appendLocaleInfo( aMsg)); - } - delete pFormat; - return NULL; - } - if ( rCode.Index >= NF_INDEX_TABLE_ENTRIES ) - { - sal_uInt32 nCLOffset = nPos - (nPos % SV_COUNTRY_LANGUAGE_OFFSET); - sal_uInt32 nKey = ImpIsEntry( aCodeStr, nCLOffset, ActLnge ); - if ( nKey != NUMBERFORMAT_ENTRY_NOT_FOUND ) - { - if (LocaleDataWrapper::areChecksEnabled()) - { - switch ( nOrgIndex ) - { - // These may be dupes of integer versions for locales where - // currencies have no decimals like Italian Lira. - case NF_CURRENCY_1000DEC2 : // NF_CURRENCY_1000INT - case NF_CURRENCY_1000DEC2_RED : // NF_CURRENCY_1000INT_RED - case NF_CURRENCY_1000DEC2_DASHED : // NF_CURRENCY_1000INT_RED - break; - default: - if ( !bAfterLoadingSO5 ) - { // If bAfterLoadingSO5 there will definitely be some dupes, - // don't cry. But we need this test for verification of locale - // data if not loading old SO5 documents. - String aMsg( RTL_CONSTASCII_USTRINGPARAM( - "SvNumberFormatter::ImpInsertFormat: dup format code, index ")); - aMsg += String::CreateFromInt32( rCode.Index ); - aMsg += '\n'; - aMsg += String( rCode.Code ); - LocaleDataWrapper::outputCheckMessage( - xLocaleData->appendLocaleInfo( aMsg)); - } - } - } - delete pFormat; - return NULL; - } - else if ( nPos - nCLOffset >= SV_COUNTRY_LANGUAGE_OFFSET ) - { - if (LocaleDataWrapper::areChecksEnabled()) - { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( - "SvNumberFormatter::ImpInsertFormat: too many format codes, index ")); - aMsg += String::CreateFromInt32( rCode.Index ); - aMsg += '\n'; - aMsg += String( rCode.Code ); - LocaleDataWrapper::outputCheckMessage( - xLocaleData->appendLocaleInfo( aMsg)); - } - delete pFormat; - return NULL; - } - } - if ( !aFTable.Insert( nPos, pFormat ) ) - { - if (LocaleDataWrapper::areChecksEnabled()) - { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( - "ImpInsertFormat: can't insert number format key pos: ")); - aMsg += String::CreateFromInt32( nPos ); - aMsg.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", code index ")); - aMsg += String::CreateFromInt32( rCode.Index ); - aMsg += '\n'; - aMsg += String( rCode.Code ); - LocaleDataWrapper::outputCheckMessage( - xLocaleData->appendLocaleInfo( aMsg)); - } - delete pFormat; - return NULL; - } - if ( rCode.Default ) - pFormat->SetStandard(); - if ( rCode.DefaultName.getLength() ) - pFormat->SetComment( rCode.DefaultName ); - return pFormat; -} - -SvNumberformat* SvNumberFormatter::ImpInsertNewStandardFormat( - const ::com::sun::star::i18n::NumberFormatCode& rCode, - sal_uInt32 nPos, USHORT nVersion, BOOL bAfterLoadingSO5, - sal_Int16 nOrgIndex ) -{ - SvNumberformat* pNewFormat = ImpInsertFormat( rCode, nPos, - bAfterLoadingSO5, nOrgIndex ); - if (pNewFormat) - pNewFormat->SetNewStandardDefined( nVersion ); - // so that it gets saved, displayed properly, and converted by old versions - return pNewFormat; -} - -void SvNumberFormatter::GetFormatSpecialInfo(sal_uInt32 nFormat, - BOOL& bThousand, - BOOL& IsRed, - USHORT& nPrecision, - USHORT& nAnzLeading) - -{ - const SvNumberformat* pFormat = aFTable.Get(nFormat); - if (pFormat) - pFormat->GetFormatSpecialInfo(bThousand, IsRed, - nPrecision, nAnzLeading); - else - { - bThousand = FALSE; - IsRed = FALSE; - nPrecision = pFormatScanner->GetStandardPrec(); - nAnzLeading = 0; - } -} - -USHORT SvNumberFormatter::GetFormatPrecision( sal_uInt32 nFormat ) const -{ - const SvNumberformat* pFormat = aFTable.Get( nFormat ); - if ( pFormat ) - return pFormat->GetFormatPrecision(); - else - return pFormatScanner->GetStandardPrec(); -} - - -String SvNumberFormatter::GetFormatDecimalSep( sal_uInt32 nFormat ) const -{ - const SvNumberformat* pFormat = aFTable.Get( nFormat ); - if ( !pFormat || pFormat->GetLanguage() == ActLnge ) - return GetNumDecimalSep(); - - String aRet; - LanguageType eSaveLang = xLocaleData.getCurrentLanguage(); - if ( pFormat->GetLanguage() == eSaveLang ) - aRet = xLocaleData->getNumDecimalSep(); - else - { - ::com::sun::star::lang::Locale aSaveLocale( xLocaleData->getLocale() ); - ::com::sun::star::lang::Locale aTmpLocale(MsLangId::convertLanguageToLocale(pFormat->GetLanguage())); - ((SvNumberFormatter*)this)->xLocaleData.changeLocale(aTmpLocale, pFormat->GetLanguage() ); - aRet = xLocaleData->getNumDecimalSep(); - ((SvNumberFormatter*)this)->xLocaleData.changeLocale( aSaveLocale, eSaveLang ); - } - return aRet; -} - - -sal_uInt32 SvNumberFormatter::GetFormatSpecialInfo( const String& rFormatString, - BOOL& bThousand, BOOL& IsRed, USHORT& nPrecision, - USHORT& nAnzLeading, LanguageType eLnge ) - -{ - xub_StrLen nCheckPos = 0; - if (eLnge == LANGUAGE_DONTKNOW) - eLnge = IniLnge; - ChangeIntl(eLnge); // ggfs. austauschen - eLnge = ActLnge; - String aTmpStr( rFormatString ); - SvNumberformat* pFormat = new SvNumberformat( aTmpStr, - pFormatScanner, pStringScanner, nCheckPos, eLnge ); - if ( nCheckPos == 0 ) - pFormat->GetFormatSpecialInfo( bThousand, IsRed, nPrecision, nAnzLeading ); - else - { - bThousand = FALSE; - IsRed = FALSE; - nPrecision = pFormatScanner->GetStandardPrec(); - nAnzLeading = 0; - } - delete pFormat; - return nCheckPos; -} - - -inline sal_uInt32 SetIndexTable( NfIndexTableOffset nTabOff, sal_uInt32 nIndOff ) -{ - if ( !bIndexTableInitialized ) - { - DBG_ASSERT( theIndexTable[nTabOff] == NUMBERFORMAT_ENTRY_NOT_FOUND, - "SetIndexTable: theIndexTable[nTabOff] already occupied" ); - theIndexTable[nTabOff] = nIndOff; - } - return nIndOff; -} - - -sal_Int32 SvNumberFormatter::ImpGetFormatCodeIndex( - ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode >& rSeq, - const NfIndexTableOffset nTabOff ) -{ - const sal_Int32 nLen = rSeq.getLength(); - for ( sal_Int32 j=0; jappendLocaleInfo( - aMsg)); - } - if ( nLen ) - { - sal_Int32 j; - // look for a preset default - for ( j=0; jappendLocaleInfo( aUMsg)); - aMsg.Erase(); - } - } - if ( nShort != -1 && nShortDef == -1 ) - aMsg += "no short type default "; - if ( nMedium != -1 && nMediumDef == -1 ) - aMsg += "no medium type default "; - if ( nLong != -1 && nLongDef == -1 ) - aMsg += "no long type default "; - if ( aMsg.Len() ) - { - aMsg.Insert( "SvNumberFormatter::ImpAdjustFormatCodeDefault: ", 0 ); - aMsg += "\nXML locale data FormatElement group of: "; - String aUMsg( aMsg, RTL_TEXTENCODING_ASCII_US); - aUMsg += String( pFormatArr[0].NameID ); - LocaleDataWrapper::outputCheckMessage( - xLocaleData->appendLocaleInfo( aUMsg)); - aMsg.Erase(); - } - } - // find the default (medium preferred, then long) and reset all other defaults - sal_Int32 nElem, nDef, nMedium; - nDef = nMedium = -1; - for ( nElem = 0; nElem < nCnt; nElem++ ) - { - if ( pFormatArr[nElem].Default ) - { - switch ( pFormatArr[nElem].Type ) - { - case i18n::KNumberFormatType::MEDIUM : - nDef = nMedium = nElem; - break; - case i18n::KNumberFormatType::LONG : - if ( nMedium == -1 ) - nDef = nElem; - // fallthru - default: - if ( nDef == -1 ) - nDef = nElem; - pFormatArr[nElem].Default = sal_False; - } - } - } - if ( nDef == -1 ) - nDef = 0; - pFormatArr[nDef].Default = sal_True; - return nDef; -} - - -void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, BOOL bLoadingSO5 ) -{ - using namespace ::com::sun::star; - - if ( !bIndexTableInitialized ) - { - for ( USHORT j=0; jGetConvertMode(); - if (bOldConvertMode) - pFormatScanner->SetConvertMode(FALSE); // switch off for this function - - NumberFormatCodeWrapper aNumberFormatCode( xServiceManager, GetLocale() ); - - xub_StrLen nCheckPos = 0; - SvNumberformat* pNewFormat = NULL; - String aFormatCode; - sal_Int32 nIdx; - sal_Bool bDefault; - - // Counter for additional builtin formats not fitting into the first 10 - // of a category (TLOT:=The Legacy Of Templin), altogether about 20 formats. - // Has to be incremented on each ImpInsertNewStandardformat, new formats - // must be appended, not inserted! - USHORT nNewExtended = ZF_STANDARD_NEWEXTENDED; - - // Number - uno::Sequence< i18n::NumberFormatCode > aFormatSeq - = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::FIXED_NUMBER ); - ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() ); - - // General - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_STANDARD ); - SvNumberformat* pStdFormat = ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_NUMBER_STANDARD, ZF_STANDARD )); - if (pStdFormat) - { - // This is _the_ standard format. - if (LocaleDataWrapper::areChecksEnabled() && - pStdFormat->GetType() != NUMBERFORMAT_NUMBER) - { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( - "SvNumberFormatter::ImpGenerateFormats: General format not NUMBER")); - LocaleDataWrapper::outputCheckMessage( - xLocaleData->appendLocaleInfo( aMsg)); - } - pStdFormat->SetType( NUMBERFORMAT_NUMBER ); - pStdFormat->SetStandard(); - pStdFormat->SetLastInsertKey( SV_MAX_ANZ_STANDARD_FORMATE ); - } - else - { - if (LocaleDataWrapper::areChecksEnabled()) - { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( - "SvNumberFormatter::ImpGenerateFormats: General format not insertable, nothing will work")); - LocaleDataWrapper::outputCheckMessage( - xLocaleData->appendLocaleInfo( aMsg)); - } - } - - // Boolean - aFormatCode = pFormatScanner->GetBooleanString(); - pNewFormat = new SvNumberformat( aFormatCode, - pFormatScanner, pStringScanner, nCheckPos, ActLnge ); - pNewFormat->SetType(NUMBERFORMAT_LOGICAL); - pNewFormat->SetStandard(); - if ( !aFTable.Insert( - CLOffset + SetIndexTable( NF_BOOLEAN, ZF_STANDARD_LOGICAL ), - pNewFormat)) - delete pNewFormat; - - // Text - aFormatCode = '@'; - pNewFormat = new SvNumberformat( aFormatCode, - pFormatScanner, pStringScanner, nCheckPos, ActLnge ); - pNewFormat->SetType(NUMBERFORMAT_TEXT); - pNewFormat->SetStandard(); - if ( !aFTable.Insert( - CLOffset + SetIndexTable( NF_TEXT, ZF_STANDARD_TEXT ), - pNewFormat)) - delete pNewFormat; - - - - // 0 - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_INT ); - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_NUMBER_INT, ZF_STANDARD+1 )); - - // 0.00 - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_DEC2 ); - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_NUMBER_DEC2, ZF_STANDARD+2 )); - - // #,##0 - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_1000INT ); - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_NUMBER_1000INT, ZF_STANDARD+3 )); - - // #,##0.00 - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_1000DEC2 ); - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_NUMBER_1000DEC2, ZF_STANDARD+4 )); - - // #.##0,00 System country/language dependent since number formatter version 6 - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_SYSTEM ); - ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_NUMBER_SYSTEM, ZF_STANDARD+5 ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); - - - // Percent number - aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::PERCENT_NUMBER ); - ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() ); - - // 0% - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_PERCENT_INT ); - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_PERCENT_INT, ZF_STANDARD_PERCENT )); - - // 0.00% - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_PERCENT_DEC2 ); - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_PERCENT_DEC2, ZF_STANDARD_PERCENT+1 )); - - - - // Currency. NO default standard option! Default is determined of locale - // data default currency and format is generated if needed. - aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::CURRENCY ); - if (LocaleDataWrapper::areChecksEnabled()) - { - // though no default desired here, test for correctness of locale data - ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() ); - } - - // #,##0 - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_CURRENCY_1000INT ); - bDefault = aFormatSeq[nIdx].Default; - aFormatSeq[nIdx].Default = sal_False; - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_CURRENCY_1000INT, ZF_STANDARD_CURRENCY )); - aFormatSeq[nIdx].Default = bDefault; - - // #,##0.00 - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_CURRENCY_1000DEC2 ); - bDefault = aFormatSeq[nIdx].Default; - aFormatSeq[nIdx].Default = sal_False; - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_CURRENCY_1000DEC2, ZF_STANDARD_CURRENCY+1 )); - aFormatSeq[nIdx].Default = bDefault; - - // #,##0 negative red - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_CURRENCY_1000INT_RED ); - bDefault = aFormatSeq[nIdx].Default; - aFormatSeq[nIdx].Default = sal_False; - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_CURRENCY_1000INT_RED, ZF_STANDARD_CURRENCY+2 )); - aFormatSeq[nIdx].Default = bDefault; - - // #,##0.00 negative red - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_CURRENCY_1000DEC2_RED ); - bDefault = aFormatSeq[nIdx].Default; - aFormatSeq[nIdx].Default = sal_False; - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_CURRENCY_1000DEC2_RED, ZF_STANDARD_CURRENCY+3 )); - aFormatSeq[nIdx].Default = bDefault; - - // #,##0.00 USD since number formatter version 3 - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_CURRENCY_1000DEC2_CCC ); - bDefault = aFormatSeq[nIdx].Default; - aFormatSeq[nIdx].Default = sal_False; - pNewFormat = ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_CURRENCY_1000DEC2_CCC, ZF_STANDARD_CURRENCY+4 )); - if ( pNewFormat ) - pNewFormat->SetUsed(TRUE); // must be saved for older versions - aFormatSeq[nIdx].Default = bDefault; - - // #.##0,-- since number formatter version 6 - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_CURRENCY_1000DEC2_DASHED ); - bDefault = aFormatSeq[nIdx].Default; - aFormatSeq[nIdx].Default = sal_False; - ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_CURRENCY_1000DEC2_DASHED, ZF_STANDARD_CURRENCY+5 ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); - aFormatSeq[nIdx].Default = bDefault; - - - - // Date - aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::DATE ); - ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() ); - - // DD.MM.YY System - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYSTEM_SHORT ); - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_SYSTEM_SHORT, ZF_STANDARD_DATE )); - - // NN DD.MMM YY - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DEF_NNDDMMMYY ); - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_DEF_NNDDMMMYY, ZF_STANDARD_DATE+1 )); - - // DD.MM.YY def/System - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_MMYY ); - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_SYS_MMYY, ZF_STANDARD_DATE+2 )); - - // DD MMM - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_DDMMM ); - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_SYS_DDMMM, ZF_STANDARD_DATE+3 )); - - // MMMM - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_MMMM ); - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_MMMM, ZF_STANDARD_DATE+4 )); - - // QQ YY - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_QQJJ ); - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_QQJJ, ZF_STANDARD_DATE+5 )); - - // DD.MM.YYYY since number formatter version 2, was DD.MM.[YY]YY - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_DDMMYYYY ); - pNewFormat = ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_SYS_DDMMYYYY, ZF_STANDARD_DATE+6 )); - if ( pNewFormat ) - pNewFormat->SetUsed(TRUE); // must be saved for older versions - - // DD.MM.YY def/System, since number formatter version 6 - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_DDMMYY ); - ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_SYS_DDMMYY, ZF_STANDARD_DATE+7 ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); - - // NNN, D. MMMM YYYY System - // Long day of week: "NNNN" instead of "NNN," because of compatibility - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYSTEM_LONG ); - ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_SYSTEM_LONG, ZF_STANDARD_DATE+8 ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); - - // Hard coded but system (regional settings) delimiters dependent long date formats - // since numberformatter version 6 - - // D. MMM YY def/System - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_DMMMYY ); - ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_SYS_DMMMYY, ZF_STANDARD_DATE+9 ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); - - //! Unfortunally TLOT intended only 10 builtin formats per category, more - //! would overwrite the next category (ZF_STANDARD_TIME) :-(( - //! Therefore they are inserted with nNewExtended++ (which is also limited) - - // D. MMM YYYY def/System - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_DMMMYYYY ); - ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_SYS_DMMMYYYY, nNewExtended++ ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); - - // D. MMMM YYYY def/System - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_DMMMMYYYY ); - ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_SYS_DMMMMYYYY, nNewExtended++ ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); - - // NN, D. MMM YY def/System - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_NNDMMMYY ); - ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_SYS_NNDMMMYY, nNewExtended++ ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); - - // NN, D. MMMM YYYY def/System - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_NNDMMMMYYYY ); - ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_SYS_NNDMMMMYYYY, nNewExtended++ ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); - - // NNN, D. MMMM YYYY def/System - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_NNNNDMMMMYYYY ); - ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_SYS_NNNNDMMMMYYYY, nNewExtended++ ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); - - // Hard coded DIN (Deutsche Industrie Norm) and EN (European Norm) date formats - - // D. MMM. YYYY DIN/EN - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DIN_DMMMYYYY ); - ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_DIN_DMMMYYYY, nNewExtended++ ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); - - // D. MMMM YYYY DIN/EN - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DIN_DMMMMYYYY ); - ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_DIN_DMMMMYYYY, nNewExtended++ ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); - - // MM-DD DIN/EN - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DIN_MMDD ); - ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_DIN_MMDD, nNewExtended++ ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); - - // YY-MM-DD DIN/EN - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DIN_YYMMDD ); - ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_DIN_YYMMDD, nNewExtended++ ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); - - // YYYY-MM-DD DIN/EN - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DIN_YYYYMMDD ); - ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATE_DIN_YYYYMMDD, nNewExtended++ ), - SV_NUMBERFORMATTER_VERSION_NEWSTANDARD ); - - - - // Time - aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::TIME ); - ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() ); - - // HH:MM - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_HHMM ); - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_TIME_HHMM, ZF_STANDARD_TIME )); - - // HH:MM:SS - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_HHMMSS ); - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_TIME_HHMMSS, ZF_STANDARD_TIME+1 )); - - // HH:MM AM/PM - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_HHMMAMPM ); - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_TIME_HHMMAMPM, ZF_STANDARD_TIME+2 )); - - // HH:MM:SS AM/PM - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_HHMMSSAMPM ); - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_TIME_HHMMSSAMPM, ZF_STANDARD_TIME+3 )); - - // [HH]:MM:SS - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_HH_MMSS ); - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_TIME_HH_MMSS, ZF_STANDARD_TIME+4 )); - - // MM:SS,00 - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_MMSS00 ); - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_TIME_MMSS00, ZF_STANDARD_TIME+5 )); - - // [HH]:MM:SS,00 - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_HH_MMSS00 ); - ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_TIME_HH_MMSS00, ZF_STANDARD_TIME+6 ), - SV_NUMBERFORMATTER_VERSION_NF_TIME_HH_MMSS00 ); - - - - // DateTime - aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::DATE_TIME ); - ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() ); - - // DD.MM.YY HH:MM System - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATETIME_SYSTEM_SHORT_HHMM ); - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATETIME_SYSTEM_SHORT_HHMM, ZF_STANDARD_DATETIME )); - - // DD.MM.YYYY HH:MM:SS System - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATETIME_SYS_DDMMYYYY_HHMMSS ); - ImpInsertNewStandardFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_DATETIME_SYS_DDMMYYYY_HHMMSS, ZF_STANDARD_DATETIME+1 ), - SV_NUMBERFORMATTER_VERSION_NF_DATETIME_SYS_DDMMYYYY_HHMMSS ); - - - - // Scientific number - aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::SCIENTIFIC_NUMBER ); - ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() ); - - // 0.00E+000 - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_SCIENTIFIC_000E000 ); - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_SCIENTIFIC_000E000, ZF_STANDARD_SCIENTIFIC )); - - // 0.00E+00 - nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_SCIENTIFIC_000E00 ); - ImpInsertFormat( aFormatSeq[nIdx], - CLOffset + SetIndexTable( NF_SCIENTIFIC_000E00, ZF_STANDARD_SCIENTIFIC+1 )); - - - - // Fraction number (no default option) - i18n::NumberFormatCode aSingleFormatCode; - - // # ?/? - aSingleFormatCode.Code = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "# ?/?" ) ); - String s25( RTL_CONSTASCII_USTRINGPARAM( "# ?/?" ) ); // # ?/? - ImpInsertFormat( aSingleFormatCode, - CLOffset + SetIndexTable( NF_FRACTION_1, ZF_STANDARD_FRACTION )); - - // # ??/?? - //! "??/" would be interpreted by the compiler as a trigraph for '\' - aSingleFormatCode.Code = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "# ?\?/?\?" ) ); - ImpInsertFormat( aSingleFormatCode, - CLOffset + SetIndexTable( NF_FRACTION_2, ZF_STANDARD_FRACTION+1 )); - - // Week of year must be appended here because of nNewExtended - const String* pKeyword = pFormatScanner->GetKeywords(); - aSingleFormatCode.Code = pKeyword[NF_KEY_WW]; - ImpInsertNewStandardFormat( aSingleFormatCode, - CLOffset + SetIndexTable( NF_DATE_WW, nNewExtended++ ), - SV_NUMBERFORMATTER_VERSION_NF_DATE_WW ); - - - - bIndexTableInitialized = TRUE; - DBG_ASSERT( nNewExtended <= ZF_STANDARD_NEWEXTENDEDMAX, - "ImpGenerateFormats: overflow of nNewExtended standard formats" ); - - // Now all additional format codes provided by I18N, but only if not - // loading from old SO5 file format, then they are appended last. - if ( !bLoadingSO5 ) - ImpGenerateAdditionalFormats( CLOffset, aNumberFormatCode, FALSE ); - - if (bOldConvertMode) - pFormatScanner->SetConvertMode(TRUE); -} - - -void SvNumberFormatter::ImpGenerateAdditionalFormats( sal_uInt32 CLOffset, - NumberFormatCodeWrapper& rNumberFormatCode, BOOL bAfterLoadingSO5 ) -{ - using namespace ::com::sun::star; - - SvNumberformat* pStdFormat = - (SvNumberformat*) aFTable.Get( CLOffset + ZF_STANDARD ); - if ( !pStdFormat ) - { - DBG_ERRORFILE( "ImpGenerateAdditionalFormats: no GENERAL format" ); - return ; - } - sal_uInt32 nPos = CLOffset + pStdFormat->GetLastInsertKey(); - rNumberFormatCode.setLocale( GetLocale() ); - sal_Int32 j; - - // All currencies, this time with [$...] which was stripped in - // ImpGenerateFormats for old "automatic" currency formats. - uno::Sequence< i18n::NumberFormatCode > aFormatSeq = - rNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::CURRENCY ); - i18n::NumberFormatCode * pFormatArr = aFormatSeq.getArray(); - sal_Int32 nCodes = aFormatSeq.getLength(); - ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), nCodes ); - for ( j = 0; j < nCodes; j++ ) - { - if ( nPos - CLOffset >= SV_COUNTRY_LANGUAGE_OFFSET ) - { - DBG_ERRORFILE( "ImpGenerateAdditionalFormats: too many formats" ); - break; // for - } - if ( pFormatArr[j].Index < NF_INDEX_TABLE_ENTRIES && - pFormatArr[j].Index != NF_CURRENCY_1000DEC2_CCC ) - { // Insert only if not already inserted, but internal index must be - // above so ImpInsertFormat can distinguish it. - sal_Int16 nOrgIndex = pFormatArr[j].Index; - pFormatArr[j].Index = sal::static_int_cast< sal_Int16 >( - pFormatArr[j].Index + nCodes + NF_INDEX_TABLE_ENTRIES); - //! no default on currency - sal_Bool bDefault = aFormatSeq[j].Default; - aFormatSeq[j].Default = sal_False; - if ( ImpInsertNewStandardFormat( pFormatArr[j], nPos+1, - SV_NUMBERFORMATTER_VERSION_ADDITIONAL_I18N_FORMATS, - bAfterLoadingSO5, nOrgIndex ) ) - nPos++; - pFormatArr[j].Index = nOrgIndex; - aFormatSeq[j].Default = bDefault; - } - } - - // all additional format codes provided by I18N that are not old standard index - aFormatSeq = rNumberFormatCode.getAllFormatCodes(); - nCodes = aFormatSeq.getLength(); - if ( nCodes ) - { - pFormatArr = aFormatSeq.getArray(); - // don't check ALL - sal_Int32 nDef = ImpAdjustFormatCodeDefault( pFormatArr, nCodes, FALSE); - // don't have any defaults here - pFormatArr[nDef].Default = sal_False; - for ( j = 0; j < nCodes; j++ ) - { - if ( nPos - CLOffset >= SV_COUNTRY_LANGUAGE_OFFSET ) - { - DBG_ERRORFILE( "ImpGenerateAdditionalFormats: too many formats" ); - break; // for - } - if ( pFormatArr[j].Index >= NF_INDEX_TABLE_ENTRIES ) - if ( ImpInsertNewStandardFormat( pFormatArr[j], nPos+1, - SV_NUMBERFORMATTER_VERSION_ADDITIONAL_I18N_FORMATS, - bAfterLoadingSO5 ) ) - nPos++; - } - } - - pStdFormat->SetLastInsertKey( (USHORT)(nPos - CLOffset) ); -} - - -void SvNumberFormatter::ImpGetPosCurrFormat( String& sPosStr, const String& rCurrSymbol ) -{ - NfCurrencyEntry::CompletePositiveFormatString( sPosStr, - rCurrSymbol, xLocaleData->getCurrPositiveFormat() ); -} - -void SvNumberFormatter::ImpGetNegCurrFormat( String& sNegStr, const String& rCurrSymbol ) -{ - NfCurrencyEntry::CompleteNegativeFormatString( sNegStr, - rCurrSymbol, xLocaleData->getCurrNegativeFormat() ); -} - -void SvNumberFormatter::GenerateFormat(String& sString, - sal_uInt32 nIndex, - LanguageType eLnge, - BOOL bThousand, - BOOL IsRed, - USHORT nPrecision, - USHORT nAnzLeading) -{ - if (eLnge == LANGUAGE_DONTKNOW) - eLnge = IniLnge; - short eType = GetType(nIndex); - USHORT i; - ImpGenerateCL(eLnge); // ggfs. neu Standard- - // formate anlegen - sString.Erase(); - - utl::DigitGroupingIterator aGrouping( xLocaleData->getDigitGrouping()); - const xub_StrLen nDigitsInFirstGroup = static_cast(aGrouping.get()); - const String& rThSep = GetNumThousandSep(); - if (nAnzLeading == 0) - { - if (!bThousand) - sString += '#'; - else - { - sString += '#'; - sString += rThSep; - sString.Expand( sString.Len() + nDigitsInFirstGroup, '#' ); - } - } - else - { - for (i = 0; i < nAnzLeading; i++) - { - if (bThousand && i > 0 && i == aGrouping.getPos()) - { - sString.Insert( rThSep, 0 ); - aGrouping.advance(); - } - sString.Insert('0',0); - } - if (bThousand && nAnzLeading < nDigitsInFirstGroup + 1) - { - for (i = nAnzLeading; i < nDigitsInFirstGroup + 1; i++) - { - if (bThousand && i % nDigitsInFirstGroup == 0) - sString.Insert( rThSep, 0 ); - sString.Insert('#',0); - } - } - } - if (nPrecision > 0) - { - sString += GetNumDecimalSep(); - sString.Expand( sString.Len() + nPrecision, '0' ); - } - if (eType == NUMBERFORMAT_PERCENT) - sString += '%'; - else if (eType == NUMBERFORMAT_CURRENCY) - { - String sNegStr = sString; - String aCurr; - const NfCurrencyEntry* pEntry; - BOOL bBank; - if ( GetNewCurrencySymbolString( nIndex, aCurr, &pEntry, &bBank ) ) - { - if ( pEntry ) - { - USHORT nPosiForm = NfCurrencyEntry::GetEffectivePositiveFormat( - xLocaleData->getCurrPositiveFormat(), - pEntry->GetPositiveFormat(), bBank ); - USHORT nNegaForm = NfCurrencyEntry::GetEffectiveNegativeFormat( - xLocaleData->getCurrNegativeFormat(), - pEntry->GetNegativeFormat(), bBank ); - pEntry->CompletePositiveFormatString( sString, bBank, - nPosiForm ); - pEntry->CompleteNegativeFormatString( sNegStr, bBank, - nNegaForm ); - } - else - { // assume currency abbreviation (AKA banking symbol), not symbol - USHORT nPosiForm = NfCurrencyEntry::GetEffectivePositiveFormat( - xLocaleData->getCurrPositiveFormat(), - xLocaleData->getCurrPositiveFormat(), TRUE ); - USHORT nNegaForm = NfCurrencyEntry::GetEffectiveNegativeFormat( - xLocaleData->getCurrNegativeFormat(), - xLocaleData->getCurrNegativeFormat(), TRUE ); - NfCurrencyEntry::CompletePositiveFormatString( sString, aCurr, - nPosiForm ); - NfCurrencyEntry::CompleteNegativeFormatString( sNegStr, aCurr, - nNegaForm ); - } - } - else - { // "automatic" old style - String aSymbol, aAbbrev; - GetCompatibilityCurrency( aSymbol, aAbbrev ); - ImpGetPosCurrFormat( sString, aSymbol ); - ImpGetNegCurrFormat( sNegStr, aSymbol ); - } - if (IsRed) - { - sString += ';'; - sString += '['; - sString += pFormatScanner->GetRedString(); - sString += ']'; - } - else - sString += ';'; - sString += sNegStr; - } - if (IsRed && eType != NUMBERFORMAT_CURRENCY) - { - String sTmpStr = sString; - sTmpStr += ';'; - sTmpStr += '['; - sTmpStr += pFormatScanner->GetRedString(); - sTmpStr += ']'; - sTmpStr += '-'; - sTmpStr +=sString; - sString = sTmpStr; - } -} - -BOOL SvNumberFormatter::IsUserDefined(const String& sStr, - LanguageType eLnge) -{ - if (eLnge == LANGUAGE_DONTKNOW) - eLnge = IniLnge; - sal_uInt32 CLOffset = ImpGenerateCL(eLnge); // ggfs. neu Standard- - // formate anlegen - eLnge = ActLnge; - sal_uInt32 nKey = ImpIsEntry(sStr, CLOffset, eLnge); - if (nKey == NUMBERFORMAT_ENTRY_NOT_FOUND) - return TRUE; - SvNumberformat* pEntry = aFTable.Get(nKey); - if ( pEntry && ((pEntry->GetType() & NUMBERFORMAT_DEFINED) != 0) ) - return TRUE; - return FALSE; -} - -sal_uInt32 SvNumberFormatter::GetEntryKey(const String& sStr, - LanguageType eLnge) -{ - if (eLnge == LANGUAGE_DONTKNOW) - eLnge = IniLnge; - sal_uInt32 CLOffset = ImpGenerateCL(eLnge); // ggfs. neu Standard- - // formate anlegen - return ImpIsEntry(sStr, CLOffset, eLnge); -} - -sal_uInt32 SvNumberFormatter::GetStandardIndex(LanguageType eLnge) -{ - if (eLnge == LANGUAGE_DONTKNOW) - eLnge = IniLnge; - return GetStandardFormat(NUMBERFORMAT_NUMBER, eLnge); -} - -short SvNumberFormatter::GetType(sal_uInt32 nFIndex) -{ - short eType; - SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nFIndex); - if (!pFormat) - eType = NUMBERFORMAT_UNDEFINED; - else - { - eType = pFormat->GetType() &~NUMBERFORMAT_DEFINED; - if (eType == 0) - eType = NUMBERFORMAT_DEFINED; - } - return eType; -} - -void SvNumberFormatter::ClearMergeTable() -{ - if ( pMergeTable ) - { - sal_uInt32* pIndex = (sal_uInt32*) pMergeTable->First(); - while (pIndex) - { - delete pIndex; - pIndex = pMergeTable->Next(); - } - pMergeTable->Clear(); - } -} - -SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter& rTable) -{ - if ( pMergeTable ) - ClearMergeTable(); - else - pMergeTable = new SvNumberFormatterIndexTable; - sal_uInt32 nCLOffset = 0; - sal_uInt32 nOldKey, nOffset, nNewKey; - sal_uInt32* pNewIndex; - SvNumberformat* pNewEntry; - SvNumberformat* pFormat = rTable.aFTable.First(); - while (pFormat) - { - nOldKey = rTable.aFTable.GetCurKey(); - nOffset = nOldKey % SV_COUNTRY_LANGUAGE_OFFSET; // relativIndex - if (nOffset == 0) // 1. Format von CL - nCLOffset = ImpGenerateCL(pFormat->GetLanguage()); - - if (nOffset <= SV_MAX_ANZ_STANDARD_FORMATE) // Std.form. - { - nNewKey = nCLOffset + nOffset; - if (!aFTable.Get(nNewKey)) // noch nicht da - { -// pNewEntry = new SvNumberformat(*pFormat); // Copy reicht nicht !!! - pNewEntry = new SvNumberformat( *pFormat, *pFormatScanner ); - if (!aFTable.Insert(nNewKey, pNewEntry)) - delete pNewEntry; - } - if (nNewKey != nOldKey) // neuer Index - { - pNewIndex = new sal_uInt32(nNewKey); - if (!pMergeTable->Insert(nOldKey,pNewIndex)) - delete pNewIndex; - } - } - else // benutzerdef. - { -// pNewEntry = new SvNumberformat(*pFormat); // Copy reicht nicht !!! - pNewEntry = new SvNumberformat( *pFormat, *pFormatScanner ); - nNewKey = ImpIsEntry(pNewEntry->GetFormatstring(), - nCLOffset, - pFormat->GetLanguage()); - if (nNewKey != NUMBERFORMAT_ENTRY_NOT_FOUND) // schon vorhanden - delete pNewEntry; - else - { - SvNumberformat* pStdFormat = - (SvNumberformat*) aFTable.Get(nCLOffset + ZF_STANDARD); - sal_uInt32 nPos = nCLOffset + pStdFormat->GetLastInsertKey(); - nNewKey = nPos+1; - if (nPos - nCLOffset >= SV_COUNTRY_LANGUAGE_OFFSET) - { - Sound::Beep(); - DBG_ERROR( - "SvNumberFormatter:: Zu viele Formate pro CL"); - delete pNewEntry; - } - else if (!aFTable.Insert(nNewKey, pNewEntry)) - delete pNewEntry; - else - pStdFormat->SetLastInsertKey((USHORT) (nNewKey - nCLOffset)); - } - if (nNewKey != nOldKey) // neuer Index - { - pNewIndex = new sal_uInt32(nNewKey); - if (!pMergeTable->Insert(nOldKey,pNewIndex)) - delete pNewIndex; - } - } - pFormat = rTable.aFTable.Next(); - } - return pMergeTable; -} - - -SvNumberFormatterMergeMap SvNumberFormatter::ConvertMergeTableToMap() -{ - if (!HasMergeFmtTbl()) - return SvNumberFormatterMergeMap(); - - SvNumberFormatterMergeMap aMap; - for (sal_uInt32* pIndex = pMergeTable->First(); pIndex; pIndex = pMergeTable->Next()) - { - sal_uInt32 nOldKey = pMergeTable->GetCurKey(); - aMap.insert( SvNumberFormatterMergeMap::value_type( nOldKey, *pIndex)); - } - ClearMergeTable(); - return aMap; -} - - -sal_uInt32 SvNumberFormatter::GetFormatForLanguageIfBuiltIn( sal_uInt32 nFormat, - LanguageType eLnge ) -{ - if ( eLnge == LANGUAGE_DONTKNOW ) - eLnge = IniLnge; - if ( nFormat < SV_COUNTRY_LANGUAGE_OFFSET && eLnge == IniLnge ) - return nFormat; // es bleibt wie es ist - sal_uInt32 nOffset = nFormat % SV_COUNTRY_LANGUAGE_OFFSET; // relativIndex - if ( nOffset > SV_MAX_ANZ_STANDARD_FORMATE ) - return nFormat; // kein eingebautes Format - sal_uInt32 nCLOffset = ImpGenerateCL(eLnge); // ggbf. generieren - return nCLOffset + nOffset; -} - - -sal_uInt32 SvNumberFormatter::GetFormatIndex( NfIndexTableOffset nTabOff, - LanguageType eLnge ) -{ - if ( nTabOff >= NF_INDEX_TABLE_ENTRIES - || theIndexTable[nTabOff] == NUMBERFORMAT_ENTRY_NOT_FOUND ) - return NUMBERFORMAT_ENTRY_NOT_FOUND; - if ( eLnge == LANGUAGE_DONTKNOW ) - eLnge = IniLnge; - sal_uInt32 nCLOffset = ImpGenerateCL(eLnge); // ggbf. generieren - return nCLOffset + theIndexTable[nTabOff]; -} - - -NfIndexTableOffset SvNumberFormatter::GetIndexTableOffset( sal_uInt32 nFormat ) const -{ - sal_uInt32 nOffset = nFormat % SV_COUNTRY_LANGUAGE_OFFSET; // relativIndex - if ( nOffset > SV_MAX_ANZ_STANDARD_FORMATE ) - return NF_INDEX_TABLE_ENTRIES; // kein eingebautes Format - for ( USHORT j = 0; j < NF_INDEX_TABLE_ENTRIES; j++ ) - { - if ( theIndexTable[j] == nOffset ) - return (NfIndexTableOffset) j; - } - return NF_INDEX_TABLE_ENTRIES; // bad luck -} - - -void SvNumberFormatter::SetYear2000( USHORT nVal ) -{ - pStringScanner->SetYear2000( nVal ); -} - - -USHORT SvNumberFormatter::GetYear2000() const -{ - return pStringScanner->GetYear2000(); -} - - -USHORT SvNumberFormatter::ExpandTwoDigitYear( USHORT nYear ) const -{ - if ( nYear < 100 ) - return SvNumberFormatter::ExpandTwoDigitYear( nYear, - pStringScanner->GetYear2000() ); - return nYear; -} - - -// static -USHORT SvNumberFormatter::GetYear2000Default() -{ - return Application::GetSettings().GetMiscSettings().GetTwoDigitYearStart(); -} - - -// static -const NfCurrencyTable& SvNumberFormatter::GetTheCurrencyTable() -{ - ::osl::MutexGuard aGuard( GetMutex() ); - while ( !bCurrencyTableInitialized ) - ImpInitCurrencyTable(); - return theCurrencyTable::get(); -} - - -// static -const NfCurrencyEntry* SvNumberFormatter::MatchSystemCurrency() -{ - // MUST call GetTheCurrencyTable() before accessing nSystemCurrencyPosition - const NfCurrencyTable& rTable = GetTheCurrencyTable(); - return nSystemCurrencyPosition ? rTable[nSystemCurrencyPosition] : NULL; -} - - -// static -const NfCurrencyEntry& SvNumberFormatter::GetCurrencyEntry( LanguageType eLang ) -{ - if ( eLang == LANGUAGE_SYSTEM ) - { - const NfCurrencyEntry* pCurr = MatchSystemCurrency(); - return pCurr ? *pCurr : *(GetTheCurrencyTable()[0]); - } - else - { - eLang = MsLangId::getRealLanguage( eLang ); - const NfCurrencyTable& rTable = GetTheCurrencyTable(); - USHORT nCount = rTable.Count(); - const NfCurrencyEntryPtr* ppData = rTable.GetData(); - for ( USHORT j = 0; j < nCount; j++, ppData++ ) - { - if ( (*ppData)->GetLanguage() == eLang ) - return **ppData; - } - return *(rTable[0]); - } -} - - -// static -const NfCurrencyEntry* SvNumberFormatter::GetCurrencyEntry( - const String& rAbbrev, LanguageType eLang ) -{ - eLang = MsLangId::getRealLanguage( eLang ); - const NfCurrencyTable& rTable = GetTheCurrencyTable(); - USHORT nCount = rTable.Count(); - const NfCurrencyEntryPtr* ppData = rTable.GetData(); - for ( USHORT j = 0; j < nCount; j++, ppData++ ) - { - if ( (*ppData)->GetLanguage() == eLang && - (*ppData)->GetBankSymbol() == rAbbrev ) - return *ppData; - } - return NULL; -} - - -// static -const NfCurrencyEntry* SvNumberFormatter::GetLegacyOnlyCurrencyEntry( - const String& rSymbol, const String& rAbbrev ) -{ - if (!bCurrencyTableInitialized) - GetTheCurrencyTable(); // just for initialization - const NfCurrencyTable& rTable = theLegacyOnlyCurrencyTable::get(); - USHORT nCount = rTable.Count(); - const NfCurrencyEntryPtr* ppData = rTable.GetData(); - for ( USHORT j = 0; j < nCount; j++, ppData++ ) - { - if ( (*ppData)->GetSymbol() == rSymbol && - (*ppData)->GetBankSymbol() == rAbbrev ) - return *ppData; - } - return NULL; -} - - -// static -IMPL_STATIC_LINK_NOINSTANCE( SvNumberFormatter, CurrencyChangeLink, void*, EMPTYARG ) -{ - ::osl::MutexGuard aGuard( GetMutex() ); - String aAbbrev; - LanguageType eLang = LANGUAGE_SYSTEM; - SvtSysLocaleOptions().GetCurrencyAbbrevAndLanguage( aAbbrev, eLang ); - SetDefaultSystemCurrency( aAbbrev, eLang ); - return 0; -} - - -// static -void SvNumberFormatter::SetDefaultSystemCurrency( const String& rAbbrev, LanguageType eLang ) -{ - ::osl::MutexGuard aGuard( GetMutex() ); - if ( eLang == LANGUAGE_SYSTEM ) - eLang = Application::GetSettings().GetLanguage(); - const NfCurrencyTable& rTable = GetTheCurrencyTable(); - USHORT nCount = rTable.Count(); - const NfCurrencyEntryPtr* ppData = rTable.GetData(); - if ( rAbbrev.Len() ) - { - for ( USHORT j = 0; j < nCount; j++, ppData++ ) - { - if ( (*ppData)->GetLanguage() == eLang && (*ppData)->GetBankSymbol() == rAbbrev ) - { - nSystemCurrencyPosition = j; - return ; - } - } - } - else - { - for ( USHORT j = 0; j < nCount; j++, ppData++ ) - { - if ( (*ppData)->GetLanguage() == eLang ) - { - nSystemCurrencyPosition = j; - return ; - } - } - } - nSystemCurrencyPosition = 0; // not found => simple SYSTEM -} - - -void SvNumberFormatter::ResetDefaultSystemCurrency() -{ - nDefaultSystemCurrencyFormat = NUMBERFORMAT_ENTRY_NOT_FOUND; -} - - -sal_uInt32 SvNumberFormatter::ImpGetDefaultSystemCurrencyFormat() -{ - if ( nDefaultSystemCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND ) - { - xub_StrLen nCheck; - short nType; - NfWSStringsDtor aCurrList; - USHORT nDefault = GetCurrencyFormatStrings( aCurrList, - GetCurrencyEntry( LANGUAGE_SYSTEM ), FALSE ); - DBG_ASSERT( aCurrList.Count(), "where is the NewCurrency System standard format?!?" ); - // if already loaded or user defined nDefaultSystemCurrencyFormat - // will be set to the right value - PutEntry( *aCurrList.GetObject( nDefault ), nCheck, nType, - nDefaultSystemCurrencyFormat, LANGUAGE_SYSTEM ); - DBG_ASSERT( nCheck == 0, "NewCurrency CheckError" ); - DBG_ASSERT( nDefaultSystemCurrencyFormat != NUMBERFORMAT_ENTRY_NOT_FOUND, - "nDefaultSystemCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND" ); - } - return nDefaultSystemCurrencyFormat; -} - - -sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat() -{ - sal_uInt32 CLOffset = ImpGetCLOffset( ActLnge ); - sal_uInt32 nDefaultCurrencyFormat = - (sal_uInt32)(sal_uIntPtr) aDefaultFormatKeys.Get( CLOffset + ZF_STANDARD_CURRENCY ); - if ( !nDefaultCurrencyFormat ) - nDefaultCurrencyFormat = NUMBERFORMAT_ENTRY_NOT_FOUND; - if ( nDefaultCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND ) - { - // look for a defined standard - sal_uInt32 nStopKey = CLOffset + SV_COUNTRY_LANGUAGE_OFFSET; - sal_uInt32 nKey; - aFTable.Seek( CLOffset ); - while ( (nKey = aFTable.GetCurKey()) >= CLOffset && nKey < nStopKey ) - { - const SvNumberformat* pEntry = - (const SvNumberformat*) aFTable.GetCurObject(); - if ( pEntry->IsStandard() && (pEntry->GetType() & NUMBERFORMAT_CURRENCY) ) - { - nDefaultCurrencyFormat = nKey; - break; // while - } - aFTable.Next(); - } - - if ( nDefaultCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND ) - { // none found, create one - xub_StrLen nCheck; - short nType; - NfWSStringsDtor aCurrList; - USHORT nDefault = GetCurrencyFormatStrings( aCurrList, - GetCurrencyEntry( ActLnge ), FALSE ); - DBG_ASSERT( aCurrList.Count(), "where is the NewCurrency standard format?" ); - if ( aCurrList.Count() ) - { - // if already loaded or user defined nDefaultSystemCurrencyFormat - // will be set to the right value - PutEntry( *aCurrList.GetObject( nDefault ), nCheck, nType, - nDefaultCurrencyFormat, ActLnge ); - DBG_ASSERT( nCheck == 0, "NewCurrency CheckError" ); - DBG_ASSERT( nDefaultCurrencyFormat != NUMBERFORMAT_ENTRY_NOT_FOUND, - "nDefaultCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND" ); - } - // old automatic currency format as a last resort - if ( nDefaultCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND ) - nDefaultCurrencyFormat = CLOffset + ZF_STANDARD_CURRENCY+3; - else - { // mark as standard so that it is found next time - SvNumberformat* pEntry = aFTable.Get( nDefaultCurrencyFormat ); - if ( pEntry ) - pEntry->SetStandard(); - } - } - aDefaultFormatKeys.Insert( CLOffset + ZF_STANDARD_CURRENCY, - (void*) nDefaultCurrencyFormat ); - } - return nDefaultCurrencyFormat; -} - - -// static -// try to make it inline if possible since this a loop body -// TRUE: continue; FALSE: break loop, if pFoundEntry==NULL dupe found -#ifndef DBG_UTIL -inline -#endif - BOOL SvNumberFormatter::ImpLookupCurrencyEntryLoopBody( - const NfCurrencyEntry*& pFoundEntry, BOOL& bFoundBank, - const NfCurrencyEntry* pData, USHORT nPos, const String& rSymbol ) -{ - BOOL bFound; - if ( pData->GetSymbol() == rSymbol ) - { - bFound = TRUE; - bFoundBank = FALSE; - } - else if ( pData->GetBankSymbol() == rSymbol ) - { - bFound = TRUE; - bFoundBank = TRUE; - } - else - bFound = FALSE; - if ( bFound ) - { - if ( pFoundEntry && pFoundEntry != pData ) - { - pFoundEntry = NULL; - return FALSE; // break loop, not unique - } - if ( nPos == 0 ) - { // first entry is SYSTEM - pFoundEntry = MatchSystemCurrency(); - if ( pFoundEntry ) - return FALSE; // break loop - // even if there are more matching entries - // this one is propably the one we are looking for - else - pFoundEntry = pData; - } - else - pFoundEntry = pData; - } - return TRUE; -} - - -BOOL SvNumberFormatter::GetNewCurrencySymbolString( sal_uInt32 nFormat, - String& rStr, const NfCurrencyEntry** ppEntry /* = NULL */, - BOOL* pBank /* = NULL */ ) const -{ - rStr.Erase(); - if ( ppEntry ) - *ppEntry = NULL; - if ( pBank ) - *pBank = FALSE; - SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get( nFormat ); - if ( pFormat ) - { - String aSymbol, aExtension; - if ( pFormat->GetNewCurrencySymbol( aSymbol, aExtension ) ) - { - if ( ppEntry ) - { - BOOL bFoundBank = FALSE; - // we definiteley need an entry matching the format code string - const NfCurrencyEntry* pFoundEntry = GetCurrencyEntry( - bFoundBank, aSymbol, aExtension, pFormat->GetLanguage(), - TRUE ); - if ( pFoundEntry ) - { - *ppEntry = pFoundEntry; - if ( pBank ) - *pBank = bFoundBank; - pFoundEntry->BuildSymbolString( rStr, bFoundBank ); - } - } - if ( !rStr.Len() ) - { // analog zu BuildSymbolString - rStr = '['; - rStr += '$'; - if ( aSymbol.Search( '-' ) != STRING_NOTFOUND || - aSymbol.Search( ']' ) != STRING_NOTFOUND ) - { - rStr += '"'; - rStr += aSymbol; - rStr += '"'; - } - else - rStr += aSymbol; - if ( aExtension.Len() ) - rStr += aExtension; - rStr += ']'; - } - return TRUE; - } - } - return FALSE; -} - - -// static -const NfCurrencyEntry* SvNumberFormatter::GetCurrencyEntry( BOOL & bFoundBank, - const String& rSymbol, const String& rExtension, - LanguageType eFormatLanguage, BOOL bOnlyStringLanguage ) -{ - xub_StrLen nExtLen = rExtension.Len(); - LanguageType eExtLang; - if ( nExtLen ) - { - sal_Int32 nExtLang = ::rtl::OUString( rExtension ).toInt32( 16 ); - if ( !nExtLang ) - eExtLang = LANGUAGE_DONTKNOW; - else - eExtLang = (LanguageType) ((nExtLang < 0) ? - -nExtLang : nExtLang); - } - else - eExtLang = LANGUAGE_DONTKNOW; - const NfCurrencyEntry* pFoundEntry = NULL; - const NfCurrencyTable& rTable = GetTheCurrencyTable(); - USHORT nCount = rTable.Count(); - BOOL bCont = TRUE; - - // first try with given extension language/country - if ( nExtLen ) - { - const NfCurrencyEntryPtr* ppData = rTable.GetData(); - for ( USHORT j = 0; j < nCount && bCont; j++, ppData++ ) - { - LanguageType eLang = (*ppData)->GetLanguage(); - if ( eLang == eExtLang || - ((eExtLang == LANGUAGE_DONTKNOW) && - (eLang == LANGUAGE_SYSTEM)) - ) - { - bCont = ImpLookupCurrencyEntryLoopBody( pFoundEntry, bFoundBank, - *ppData, j, rSymbol ); - } - } - } - - // ok? - if ( pFoundEntry || !bCont || (bOnlyStringLanguage && nExtLen) ) - return pFoundEntry; - - if ( !bOnlyStringLanguage ) - { - // now try the language/country of the number format - const NfCurrencyEntryPtr* ppData = rTable.GetData(); - for ( USHORT j = 0; j < nCount && bCont; j++, ppData++ ) - { - LanguageType eLang = (*ppData)->GetLanguage(); - if ( eLang == eFormatLanguage || - ((eFormatLanguage == LANGUAGE_DONTKNOW) && - (eLang == LANGUAGE_SYSTEM)) - ) - { - bCont = ImpLookupCurrencyEntryLoopBody( pFoundEntry, bFoundBank, - *ppData, j, rSymbol ); - } - } - - // ok? - if ( pFoundEntry || !bCont ) - return pFoundEntry; - } - - // then try without language/country if no extension specified - if ( !nExtLen ) - { - const NfCurrencyEntryPtr* ppData = rTable.GetData(); - for ( USHORT j = 0; j < nCount && bCont; j++, ppData++ ) - { - bCont = ImpLookupCurrencyEntryLoopBody( pFoundEntry, bFoundBank, - *ppData, j, rSymbol ); - } - } - - return pFoundEntry; -} - - -void SvNumberFormatter::GetCompatibilityCurrency( String& rSymbol, String& rAbbrev ) const -{ - ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Currency2 > - xCurrencies = xLocaleData->getAllCurrencies(); - sal_Int32 nCurrencies = xCurrencies.getLength(); - sal_Int32 j; - for ( j=0; j < nCurrencies; ++j ) - { - if ( xCurrencies[j].UsedInCompatibleFormatCodes ) - { - rSymbol = xCurrencies[j].Symbol; - rAbbrev = xCurrencies[j].BankSymbol; - break; - } - } - if ( j >= nCurrencies ) - { - if (LocaleDataWrapper::areChecksEnabled()) - { - String aMsg( RTL_CONSTASCII_USTRINGPARAM( - "GetCompatibilityCurrency: none?")); - LocaleDataWrapper::outputCheckMessage( - xLocaleData->appendLocaleInfo( aMsg)); - } - rSymbol = xLocaleData->getCurrSymbol(); - rAbbrev = xLocaleData->getCurrBankSymbol(); - } -} - - -void lcl_CheckCurrencySymbolPosition( const NfCurrencyEntry& rCurr ) -{ - short nPos = -1; // -1:=unknown, 0:=vorne, 1:=hinten - short nNeg = -1; - switch ( rCurr.GetPositiveFormat() ) - { - case 0: // $1 - nPos = 0; - break; - case 1: // 1$ - nPos = 1; - break; - case 2: // $ 1 - nPos = 0; - break; - case 3: // 1 $ - nPos = 1; - break; - default: - LocaleDataWrapper::outputCheckMessage( - "lcl_CheckCurrencySymbolPosition: unknown PositiveFormat"); - break; - } - switch ( rCurr.GetNegativeFormat() ) - { - case 0: // ($1) - nNeg = 0; - break; - case 1: // -$1 - nNeg = 0; - break; - case 2: // $-1 - nNeg = 0; - break; - case 3: // $1- - nNeg = 0; - break; - case 4: // (1$) - nNeg = 1; - break; - case 5: // -1$ - nNeg = 1; - break; - case 6: // 1-$ - nNeg = 1; - break; - case 7: // 1$- - nNeg = 1; - break; - case 8: // -1 $ - nNeg = 1; - break; - case 9: // -$ 1 - nNeg = 0; - break; - case 10: // 1 $- - nNeg = 1; - break; - case 11: // $ -1 - nNeg = 0; - break; - case 12 : // $ 1- - nNeg = 0; - break; - case 13 : // 1- $ - nNeg = 1; - break; - case 14 : // ($ 1) - nNeg = 0; - break; - case 15 : // (1 $) - nNeg = 1; - break; - default: - LocaleDataWrapper::outputCheckMessage( - "lcl_CheckCurrencySymbolPosition: unknown NegativeFormat"); - break; - } - if ( nPos >= 0 && nNeg >= 0 && nPos != nNeg ) - { - ByteString aStr( "positions of currency symbols differ\nLanguage: " ); - aStr += ByteString::CreateFromInt32( rCurr.GetLanguage() ); - aStr += " <"; - aStr += ByteString( rCurr.GetSymbol(), RTL_TEXTENCODING_UTF8 ); - aStr += "> positive: "; - aStr += ByteString::CreateFromInt32( rCurr.GetPositiveFormat() ); - aStr += ( nPos ? " (postfix)" : " (prefix)" ); - aStr += ", negative: "; - aStr += ByteString::CreateFromInt32( rCurr.GetNegativeFormat() ); - aStr += ( nNeg ? " (postfix)" : " (prefix)" ); -#if 0 -// seems that there really are some currencies which differ, e.g. YugoDinar - DBG_ERRORFILE( aStr.GetBuffer() ); -#endif - } -} - - -// static -void SvNumberFormatter::ImpInitCurrencyTable() -{ - // racing condition possible: - // ::osl::MutexGuard aGuard( GetMutex() ); - // while ( !bCurrencyTableInitialized ) - // ImpInitCurrencyTable(); - static BOOL bInitializing = FALSE; - if ( bCurrencyTableInitialized || bInitializing ) - return ; - bInitializing = TRUE; - - RTL_LOGFILE_CONTEXT_AUTHOR( aTimeLog, "svtools", "er93726", "SvNumberFormatter::ImpInitCurrencyTable" ); - - LanguageType eSysLang = Application::GetSettings().GetLanguage(); - LocaleDataWrapper* pLocaleData = new LocaleDataWrapper( - ::comphelper::getProcessServiceFactory(), - MsLangId::convertLanguageToLocale( eSysLang ) ); - // get user configured currency - String aConfiguredCurrencyAbbrev; - LanguageType eConfiguredCurrencyLanguage = LANGUAGE_SYSTEM; - SvtSysLocaleOptions().GetCurrencyAbbrevAndLanguage( - aConfiguredCurrencyAbbrev, eConfiguredCurrencyLanguage ); - USHORT nSecondarySystemCurrencyPosition = 0; - USHORT nMatchingSystemCurrencyPosition = 0; - NfCurrencyEntryPtr pEntry; - - // first entry is SYSTEM - pEntry = new NfCurrencyEntry( *pLocaleData, LANGUAGE_SYSTEM ); - theCurrencyTable::get().Insert( pEntry, 0 ); - USHORT nCurrencyPos = 1; - - ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > xLoc = - LocaleDataWrapper::getInstalledLocaleNames(); - sal_Int32 nLocaleCount = xLoc.getLength(); - RTL_LOGFILE_CONTEXT_TRACE1( aTimeLog, "number of locales: %ld", nLocaleCount ); - Locale const * const pLocales = xLoc.getConstArray(); - NfCurrencyTable &rCurrencyTable = theCurrencyTable::get(); - NfCurrencyTable &rLegacyOnlyCurrencyTable = theLegacyOnlyCurrencyTable::get(); - USHORT nLegacyOnlyCurrencyPos = 0; - for ( sal_Int32 nLocale = 0; nLocale < nLocaleCount; nLocale++ ) - { - LanguageType eLang = MsLangId::convertLocaleToLanguage( - pLocales[nLocale]); -#if OSL_DEBUG_LEVEL > 1 - LanguageType eReal = MsLangId::getRealLanguage( eLang ); - if ( eReal != eLang ) { - BOOL bBreak; - bBreak = TRUE; - } -#endif - pLocaleData->setLocale( pLocales[nLocale] ); - Sequence< Currency2 > aCurrSeq = pLocaleData->getAllCurrencies(); - sal_Int32 nCurrencyCount = aCurrSeq.getLength(); - Currency2 const * const pCurrencies = aCurrSeq.getConstArray(); - - // one default currency for each locale, insert first so it is found first - sal_Int32 nDefault; - for ( nDefault = 0; nDefault < nCurrencyCount; nDefault++ ) - { - if ( pCurrencies[nDefault].Default ) - break; - } - if ( nDefault < nCurrencyCount ) - pEntry = new NfCurrencyEntry( pCurrencies[nDefault], *pLocaleData, eLang ); - else - pEntry = new NfCurrencyEntry( *pLocaleData, eLang ); // first or ShellsAndPebbles - - if (LocaleDataWrapper::areChecksEnabled()) - lcl_CheckCurrencySymbolPosition( *pEntry ); - - rCurrencyTable.Insert( pEntry, nCurrencyPos++ ); - if ( !nSystemCurrencyPosition && (aConfiguredCurrencyAbbrev.Len() ? - pEntry->GetBankSymbol() == aConfiguredCurrencyAbbrev && - pEntry->GetLanguage() == eConfiguredCurrencyLanguage : FALSE) ) - nSystemCurrencyPosition = nCurrencyPos-1; - if ( !nMatchingSystemCurrencyPosition && - pEntry->GetLanguage() == eSysLang ) - nMatchingSystemCurrencyPosition = nCurrencyPos-1; - - // all remaining currencies for each locale - if ( nCurrencyCount > 1 ) - { - sal_Int32 nCurrency; - for ( nCurrency = 0; nCurrency < nCurrencyCount; nCurrency++ ) - { - if (pCurrencies[nCurrency].LegacyOnly) - { - pEntry = new NfCurrencyEntry( pCurrencies[nCurrency], *pLocaleData, eLang ); - rLegacyOnlyCurrencyTable.Insert( pEntry, nLegacyOnlyCurrencyPos++ ); - } - else if ( nCurrency != nDefault ) - { - pEntry = new NfCurrencyEntry( pCurrencies[nCurrency], *pLocaleData, eLang ); - // no dupes - BOOL bInsert = TRUE; - NfCurrencyEntry const * const * pData = rCurrencyTable.GetData(); - USHORT n = rCurrencyTable.Count(); - pData++; // skip first SYSTEM entry - for ( USHORT j=1; jGetBankSymbol() == aConfiguredCurrencyAbbrev : - pEntry->GetLanguage() == eConfiguredCurrencyLanguage) ) - nSecondarySystemCurrencyPosition = nCurrencyPos-1; - if ( !nMatchingSystemCurrencyPosition && - pEntry->GetLanguage() == eSysLang ) - nMatchingSystemCurrencyPosition = nCurrencyPos-1; - } - } - } - } - } - if ( !nSystemCurrencyPosition ) - nSystemCurrencyPosition = nSecondarySystemCurrencyPosition; - if ((aConfiguredCurrencyAbbrev.Len() && !nSystemCurrencyPosition) && - LocaleDataWrapper::areChecksEnabled()) - LocaleDataWrapper::outputCheckMessage( - "SvNumberFormatter::ImpInitCurrencyTable: configured currency not in I18N locale data."); - // match SYSTEM if no configured currency found - if ( !nSystemCurrencyPosition ) - nSystemCurrencyPosition = nMatchingSystemCurrencyPosition; - if ((!aConfiguredCurrencyAbbrev.Len() && !nSystemCurrencyPosition) && - LocaleDataWrapper::areChecksEnabled()) - LocaleDataWrapper::outputCheckMessage( - "SvNumberFormatter::ImpInitCurrencyTable: system currency not in I18N locale data."); - delete pLocaleData; - SvtSysLocaleOptions::SetCurrencyChangeLink( - STATIC_LINK( NULL, SvNumberFormatter, CurrencyChangeLink ) ); - bInitializing = FALSE; - bCurrencyTableInitialized = TRUE; -} - - -USHORT SvNumberFormatter::GetCurrencyFormatStrings( NfWSStringsDtor& rStrArr, - const NfCurrencyEntry& rCurr, BOOL bBank ) const -{ - USHORT nDefault = 0; - if ( bBank ) - { // nur Bankensymbole - String aPositiveBank, aNegativeBank; - rCurr.BuildPositiveFormatString( aPositiveBank, TRUE, *xLocaleData, 1 ); - rCurr.BuildNegativeFormatString( aNegativeBank, TRUE, *xLocaleData, 1 ); - - WSStringPtr pFormat1 = new String( aPositiveBank ); - *pFormat1 += ';'; - WSStringPtr pFormat2 = new String( *pFormat1 ); - - String aRed( '[' ); - aRed += pFormatScanner->GetRedString(); - aRed += ']'; - - *pFormat2 += aRed; - - *pFormat1 += aNegativeBank; - *pFormat2 += aNegativeBank; - - rStrArr.Insert( pFormat1, rStrArr.Count() ); - rStrArr.Insert( pFormat2, rStrArr.Count() ); - nDefault = rStrArr.Count() - 1; - } - else - { // gemischte Formate wie in SvNumberFormatter::ImpGenerateFormats - // aber keine doppelten, wenn keine Nachkommastellen in Waehrung - String aPositive, aNegative, aPositiveNoDec, aNegativeNoDec, - aPositiveDashed, aNegativeDashed; - WSStringPtr pFormat1, pFormat2, pFormat3, pFormat4, pFormat5; - - String aRed( '[' ); - aRed += pFormatScanner->GetRedString(); - aRed += ']'; - - rCurr.BuildPositiveFormatString( aPositive, FALSE, *xLocaleData, 1 ); - rCurr.BuildNegativeFormatString( aNegative, FALSE, *xLocaleData, 1 ); - if ( rCurr.GetDigits() ) - { - rCurr.BuildPositiveFormatString( aPositiveNoDec, FALSE, *xLocaleData, 0 ); - rCurr.BuildNegativeFormatString( aNegativeNoDec, FALSE, *xLocaleData, 0 ); - rCurr.BuildPositiveFormatString( aPositiveDashed, FALSE, *xLocaleData, 2 ); - rCurr.BuildNegativeFormatString( aNegativeDashed, FALSE, *xLocaleData, 2 ); - - pFormat1 = new String( aPositiveNoDec ); - *pFormat1 += ';'; - pFormat3 = new String( *pFormat1 ); - pFormat5 = new String( aPositiveDashed ); - *pFormat5 += ';'; - - *pFormat1 += aNegativeNoDec; - - *pFormat3 += aRed; - *pFormat5 += aRed; - - *pFormat3 += aNegativeNoDec; - *pFormat5 += aNegativeDashed; - } - else - { - pFormat1 = NULL; - pFormat3 = NULL; - pFormat5 = NULL; - } - - pFormat2 = new String( aPositive ); - *pFormat2 += ';'; - pFormat4 = new String( *pFormat2 ); - - *pFormat2 += aNegative; - - *pFormat4 += aRed; - *pFormat4 += aNegative; - - if ( pFormat1 ) - rStrArr.Insert( pFormat1, rStrArr.Count() ); - rStrArr.Insert( pFormat2, rStrArr.Count() ); - if ( pFormat3 ) - rStrArr.Insert( pFormat3, rStrArr.Count() ); - rStrArr.Insert( pFormat4, rStrArr.Count() ); - nDefault = rStrArr.Count() - 1; - if ( pFormat5 ) - rStrArr.Insert( pFormat5, rStrArr.Count() ); - } - return nDefault; -} - - -//--- NfCurrencyEntry ---------------------------------------------------- - -NfCurrencyEntry::NfCurrencyEntry() - : eLanguage( LANGUAGE_DONTKNOW ), - nPositiveFormat(3), - nNegativeFormat(8), - nDigits(2), - cZeroChar('0') -{ -} - - -NfCurrencyEntry::NfCurrencyEntry( const LocaleDataWrapper& rLocaleData, LanguageType eLang ) -{ - aSymbol = rLocaleData.getCurrSymbol(); - aBankSymbol = rLocaleData.getCurrBankSymbol(); - eLanguage = eLang; - nPositiveFormat = rLocaleData.getCurrPositiveFormat(); - nNegativeFormat = rLocaleData.getCurrNegativeFormat(); - nDigits = rLocaleData.getCurrDigits(); - cZeroChar = rLocaleData.getCurrZeroChar(); -} - - -NfCurrencyEntry::NfCurrencyEntry( const ::com::sun::star::i18n::Currency & rCurr, - const LocaleDataWrapper& rLocaleData, LanguageType eLang ) -{ - aSymbol = rCurr.Symbol; - aBankSymbol = rCurr.BankSymbol; - eLanguage = eLang; - nPositiveFormat = rLocaleData.getCurrPositiveFormat(); - nNegativeFormat = rLocaleData.getCurrNegativeFormat(); - nDigits = rCurr.DecimalPlaces; - cZeroChar = rLocaleData.getCurrZeroChar(); -} - - -BOOL NfCurrencyEntry::operator==( const NfCurrencyEntry& r ) const -{ - return aSymbol == r.aSymbol - && aBankSymbol == r.aBankSymbol - && eLanguage == r.eLanguage - ; -} - - -void NfCurrencyEntry::SetEuro() -{ - aSymbol = NfCurrencyEntry::GetEuroSymbol(); - aBankSymbol.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "EUR" ) ); - eLanguage = LANGUAGE_DONTKNOW; - nPositiveFormat = 3; - nNegativeFormat = 8; - nDigits = 2; - cZeroChar = '0'; -} - - -BOOL NfCurrencyEntry::IsEuro() const -{ - if ( aBankSymbol.EqualsAscii( "EUR" ) ) - return TRUE; - String aEuro( NfCurrencyEntry::GetEuroSymbol() ); - return aSymbol == aEuro; -} - - -void NfCurrencyEntry::ApplyVariableInformation( const NfCurrencyEntry& r ) -{ - nPositiveFormat = r.nPositiveFormat; - nNegativeFormat = r.nNegativeFormat; - cZeroChar = r.cZeroChar; -} - - -void NfCurrencyEntry::BuildSymbolString( String& rStr, BOOL bBank, - BOOL bWithoutExtension ) const -{ - rStr = '['; - rStr += '$'; - if ( bBank ) - rStr += aBankSymbol; - else - { - if ( aSymbol.Search( '-' ) != STRING_NOTFOUND || aSymbol.Search( ']' ) != STRING_NOTFOUND ) - { - rStr += '"'; - rStr += aSymbol; - rStr += '"'; - } - else - rStr += aSymbol; - if ( !bWithoutExtension && eLanguage != LANGUAGE_DONTKNOW && eLanguage != LANGUAGE_SYSTEM ) - { - rStr += '-'; - rStr += String::CreateFromInt32( sal_Int32( eLanguage ), 16 ).ToUpperAscii(); - } - } - rStr += ']'; -} - - -void NfCurrencyEntry::Impl_BuildFormatStringNumChars( String& rStr, - const LocaleDataWrapper& rLoc, USHORT nDecimalFormat ) const -{ - rStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "###0" ) ); - rStr.Insert( rLoc.getNumThousandSep(), 1 ); - if ( nDecimalFormat && nDigits ) - { - rStr += rLoc.getNumDecimalSep(); - rStr.Expand( rStr.Len() + nDigits, (nDecimalFormat == 2 ? '-' : cZeroChar) ); - } -} - - -void NfCurrencyEntry::BuildPositiveFormatString( String& rStr, BOOL bBank, - const LocaleDataWrapper& rLoc, USHORT nDecimalFormat ) const -{ - Impl_BuildFormatStringNumChars( rStr, rLoc, nDecimalFormat ); - USHORT nPosiForm = NfCurrencyEntry::GetEffectivePositiveFormat( - rLoc.getCurrPositiveFormat(), nPositiveFormat, bBank ); - CompletePositiveFormatString( rStr, bBank, nPosiForm ); -} - - -void NfCurrencyEntry::BuildNegativeFormatString( String& rStr, BOOL bBank, - const LocaleDataWrapper& rLoc, USHORT nDecimalFormat ) const -{ - Impl_BuildFormatStringNumChars( rStr, rLoc, nDecimalFormat ); - USHORT nNegaForm = NfCurrencyEntry::GetEffectiveNegativeFormat( - rLoc.getCurrNegativeFormat(), nNegativeFormat, bBank ); - CompleteNegativeFormatString( rStr, bBank, nNegaForm ); -} - - -void NfCurrencyEntry::CompletePositiveFormatString( String& rStr, BOOL bBank, - USHORT nPosiForm ) const -{ - String aSymStr; - BuildSymbolString( aSymStr, bBank ); - NfCurrencyEntry::CompletePositiveFormatString( rStr, aSymStr, nPosiForm ); -} - - -void NfCurrencyEntry::CompleteNegativeFormatString( String& rStr, BOOL bBank, - USHORT nNegaForm ) const -{ - String aSymStr; - BuildSymbolString( aSymStr, bBank ); - NfCurrencyEntry::CompleteNegativeFormatString( rStr, aSymStr, nNegaForm ); -} - - -// static -void NfCurrencyEntry::CompletePositiveFormatString( String& rStr, - const String& rSymStr, USHORT nPositiveFormat ) -{ - switch( nPositiveFormat ) - { - case 0: // $1 - rStr.Insert( rSymStr , 0 ); - break; - case 1: // 1$ - rStr += rSymStr; - break; - case 2: // $ 1 - { - rStr.Insert( ' ', 0 ); - rStr.Insert( rSymStr, 0 ); - } - break; - case 3: // 1 $ - { - rStr += ' '; - rStr += rSymStr; - } - break; - default: - DBG_ERROR("NfCurrencyEntry::CompletePositiveFormatString: unknown option"); - break; - } -} - - -// static -void NfCurrencyEntry::CompleteNegativeFormatString( String& rStr, - const String& rSymStr, USHORT nNegativeFormat ) -{ - switch( nNegativeFormat ) - { - case 0: // ($1) - { - rStr.Insert( rSymStr, 0); - rStr.Insert('(',0); - rStr += ')'; - } - break; - case 1: // -$1 - { - rStr.Insert( rSymStr, 0); - rStr.Insert('-',0); - } - break; - case 2: // $-1 - { - rStr.Insert('-',0); - rStr.Insert( rSymStr, 0); - } - break; - case 3: // $1- - { - rStr.Insert( rSymStr, 0); - rStr += '-'; - } - break; - case 4: // (1$) - { - rStr.Insert('(',0); - rStr += rSymStr; - rStr += ')'; - } - break; - case 5: // -1$ - { - rStr += rSymStr; - rStr.Insert('-',0); - } - break; - case 6: // 1-$ - { - rStr += '-'; - rStr += rSymStr; - } - break; - case 7: // 1$- - { - rStr += rSymStr; - rStr += '-'; - } - break; - case 8: // -1 $ - { - rStr += ' '; - rStr += rSymStr; - rStr.Insert('-',0); - } - break; - case 9: // -$ 1 - { - rStr.Insert(' ',0); - rStr.Insert( rSymStr, 0); - rStr.Insert('-',0); - } - break; - case 10: // 1 $- - { - rStr += ' '; - rStr += rSymStr; - rStr += '-'; - } - break; - case 11: // $ -1 - { - String aTmp( rSymStr ); - aTmp += ' '; - aTmp += '-'; - rStr.Insert( aTmp, 0 ); - } - break; - case 12 : // $ 1- - { - rStr.Insert(' ', 0); - rStr.Insert( rSymStr, 0); - rStr += '-'; - } - break; - case 13 : // 1- $ - { - rStr += '-'; - rStr += ' '; - rStr += rSymStr; - } - break; - case 14 : // ($ 1) - { - rStr.Insert(' ',0); - rStr.Insert( rSymStr, 0); - rStr.Insert('(',0); - rStr += ')'; - } - break; - case 15 : // (1 $) - { - rStr.Insert('(',0); - rStr += ' '; - rStr += rSymStr; - rStr += ')'; - } - break; - default: - DBG_ERROR("NfCurrencyEntry::CompleteNegativeFormatString: unknown option"); - break; - } -} - - -// static -USHORT NfCurrencyEntry::GetEffectivePositiveFormat( USHORT -#if ! NF_BANKSYMBOL_FIX_POSITION - nIntlFormat -#endif - , USHORT nCurrFormat, BOOL bBank ) -{ - if ( bBank ) - { -#if NF_BANKSYMBOL_FIX_POSITION - return 3; -#else - switch ( nIntlFormat ) - { - case 0: // $1 - nIntlFormat = 2; // $ 1 - break; - case 1: // 1$ - nIntlFormat = 3; // 1 $ - break; - case 2: // $ 1 - break; - case 3: // 1 $ - break; - default: - DBG_ERROR("NfCurrencyEntry::GetEffectivePositiveFormat: unknown option"); - break; - } - return nIntlFormat; -#endif - } - else - return nCurrFormat; -} - - -// nur aufrufen, wenn nCurrFormat wirklich mit Klammern ist -USHORT lcl_MergeNegativeParenthesisFormat( USHORT nIntlFormat, USHORT nCurrFormat ) -{ - short nSign = 0; // -1:=Klammer 0:=links, 1:=mitte, 2:=rechts - switch ( nIntlFormat ) - { - case 0: // ($1) - case 4: // (1$) - case 14 : // ($ 1) - case 15 : // (1 $) - return nCurrFormat; - case 1: // -$1 - case 5: // -1$ - case 8: // -1 $ - case 9: // -$ 1 - nSign = 0; - break; - case 2: // $-1 - case 6: // 1-$ - case 11 : // $ -1 - case 13 : // 1- $ - nSign = 1; - break; - case 3: // $1- - case 7: // 1$- - case 10: // 1 $- - case 12 : // $ 1- - nSign = 2; - break; - default: - DBG_ERROR("lcl_MergeNegativeParenthesisFormat: unknown option"); - break; - } - - switch ( nCurrFormat ) - { - case 0: // ($1) - switch ( nSign ) - { - case 0: - return 1; // -$1 - case 1: - return 2; // $-1 - case 2: - return 3; // $1- - } - break; - case 4: // (1$) - switch ( nSign ) - { - case 0: - return 5; // -1$ - case 1: - return 6; // 1-$ - case 2: - return 7; // 1$- - } - break; - case 14 : // ($ 1) - switch ( nSign ) - { - case 0: - return 9; // -$ 1 - case 1: - return 11; // $ -1 - case 2: - return 12; // $ 1- - } - break; - case 15 : // (1 $) - switch ( nSign ) - { - case 0: - return 8; // -1 $ - case 1: - return 13; // 1- $ - case 2: - return 10; // 1 $- - } - break; - } - return nCurrFormat; -} - - -// static -USHORT NfCurrencyEntry::GetEffectiveNegativeFormat( USHORT nIntlFormat, - USHORT nCurrFormat, BOOL bBank ) -{ - if ( bBank ) - { -#if NF_BANKSYMBOL_FIX_POSITION - return 8; -#else - switch ( nIntlFormat ) - { - case 0: // ($1) -// nIntlFormat = 14; // ($ 1) - nIntlFormat = 9; // -$ 1 - break; - case 1: // -$1 - nIntlFormat = 9; // -$ 1 - break; - case 2: // $-1 - nIntlFormat = 11; // $ -1 - break; - case 3: // $1- - nIntlFormat = 12; // $ 1- - break; - case 4: // (1$) -// nIntlFormat = 15; // (1 $) - nIntlFormat = 8; // -1 $ - break; - case 5: // -1$ - nIntlFormat = 8; // -1 $ - break; - case 6: // 1-$ - nIntlFormat = 13; // 1- $ - break; - case 7: // 1$- - nIntlFormat = 10; // 1 $- - break; - case 8: // -1 $ - break; - case 9: // -$ 1 - break; - case 10: // 1 $- - break; - case 11: // $ -1 - break; - case 12 : // $ 1- - break; - case 13 : // 1- $ - break; - case 14 : // ($ 1) -// nIntlFormat = 14; // ($ 1) - nIntlFormat = 9; // -$ 1 - break; - case 15 : // (1 $) -// nIntlFormat = 15; // (1 $) - nIntlFormat = 8; // -1 $ - break; - default: - DBG_ERROR("NfCurrencyEntry::GetEffectiveNegativeFormat: unknown option"); - break; - } -#endif - } - else if ( nIntlFormat != nCurrFormat ) - { - switch ( nCurrFormat ) - { - case 0: // ($1) - nIntlFormat = lcl_MergeNegativeParenthesisFormat( - nIntlFormat, nCurrFormat ); - break; - case 1: // -$1 - nIntlFormat = nCurrFormat; - break; - case 2: // $-1 - nIntlFormat = nCurrFormat; - break; - case 3: // $1- - nIntlFormat = nCurrFormat; - break; - case 4: // (1$) - nIntlFormat = lcl_MergeNegativeParenthesisFormat( - nIntlFormat, nCurrFormat ); - break; - case 5: // -1$ - nIntlFormat = nCurrFormat; - break; - case 6: // 1-$ - nIntlFormat = nCurrFormat; - break; - case 7: // 1$- - nIntlFormat = nCurrFormat; - break; - case 8: // -1 $ - nIntlFormat = nCurrFormat; - break; - case 9: // -$ 1 - nIntlFormat = nCurrFormat; - break; - case 10: // 1 $- - nIntlFormat = nCurrFormat; - break; - case 11: // $ -1 - nIntlFormat = nCurrFormat; - break; - case 12 : // $ 1- - nIntlFormat = nCurrFormat; - break; - case 13 : // 1- $ - nIntlFormat = nCurrFormat; - break; - case 14 : // ($ 1) - nIntlFormat = lcl_MergeNegativeParenthesisFormat( - nIntlFormat, nCurrFormat ); - break; - case 15 : // (1 $) - nIntlFormat = lcl_MergeNegativeParenthesisFormat( - nIntlFormat, nCurrFormat ); - break; - default: - DBG_ERROR("NfCurrencyEntry::GetEffectiveNegativeFormat: unknown option"); - break; - } - } - return nIntlFormat; -} - - -// we only support default encodings here -// static -sal_Char NfCurrencyEntry::GetEuroSymbol( rtl_TextEncoding eTextEncoding ) -{ - switch ( eTextEncoding ) - { - case RTL_TEXTENCODING_MS_1252 : // WNT Ansi - case RTL_TEXTENCODING_ISO_8859_1 : // UNX for use with TrueType fonts - return '\x80'; - case RTL_TEXTENCODING_ISO_8859_15 : // UNX real - return '\xA4'; - case RTL_TEXTENCODING_IBM_850 : // OS2 - return '\xD5'; - case RTL_TEXTENCODING_APPLE_ROMAN : // MAC - return '\xDB'; - default: // default system -#if WNT - return '\x80'; -#elif OS2 - return '\xD5'; -#elif UNX -// return '\xA4'; // #56121# 0xA4 waere korrekt fuer iso-8859-15 - return '\x80'; // aber Windoze-Code fuer die konvertierten TrueType-Fonts -#else -#error EuroSymbol is what? - return '\x80'; -#endif - } - return '\x80'; -} - - - diff --git a/svtools/source/numbers/zformat.cxx b/svtools/source/numbers/zformat.cxx deleted file mode 100644 index 0afbf3b4a3f5..000000000000 --- a/svtools/source/numbers/zformat.cxx +++ /dev/null @@ -1,4480 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: zformat.cxx,v $ - * $Revision: 1.78.138.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -#include -#include -// #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define _ZFORMAT_CXX -#include -#include "zforscan.hxx" - -#include "zforfind.hxx" -#include -#include "numhead.hxx" -#include -#include "nfsymbol.hxx" -using namespace svt; - -namespace { -struct Gregorian - : public rtl::StaticWithInit { - const ::rtl::OUString operator () () { - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("gregorian")); - } -}; -} - -const double _D_MAX_U_LONG_ = (double) 0xffffffff; // 4294967295.0 -const double _D_MAX_LONG_ = (double) 0x7fffffff; // 2147483647.0 -const USHORT _MAX_FRACTION_PREC = 3; -const double D_EPS = 1.0E-2; - -const double _D_MAX_D_BY_100 = 1.7E306; -const double _D_MIN_M_BY_1000 = 2.3E-305; - -static BYTE cCharWidths[ 128-32 ] = { - 1,1,1,2,2,3,2,1,1,1,1,2,1,1,1,1, - 2,2,2,2,2,2,2,2,2,2,1,1,2,2,2,2, - 3,2,2,2,2,2,2,3,2,1,2,2,2,3,3,3, - 2,3,2,2,2,2,2,3,2,2,2,1,1,1,2,2, - 1,2,2,2,2,2,1,2,2,1,1,2,1,3,2,2, - 2,2,1,2,1,2,2,2,2,2,2,1,1,1,2,1 -}; - -// static -xub_StrLen SvNumberformat::InsertBlanks( String& r, xub_StrLen nPos, sal_Unicode c ) -{ - if( c >= 32 ) - { - USHORT n = 2; // Default fuer Zeichen > 128 (HACK!) - if( c <= 127 ) - n = cCharWidths[ c - 32 ]; - while( n-- ) - r.Insert( ' ', nPos++ ); - } - return nPos; -} - -static long GetPrecExp( double fAbsVal ) -{ - DBG_ASSERT( fAbsVal > 0.0, "GetPrecExp: fAbsVal <= 0.0" ); - if ( fAbsVal < 1e-7 || fAbsVal > 1e7 ) - { // die Schere, ob's schneller ist oder nicht, liegt zwischen 1e6 und 1e7 - return (long) floor( log10( fAbsVal ) ) + 1; - } - else - { - long nPrecExp = 1; - while( fAbsVal < 1 ) - { - fAbsVal *= 10; - nPrecExp--; - } - while( fAbsVal >= 10 ) - { - fAbsVal /= 10; - nPrecExp++; - } - return nPrecExp; - } -} - -const USHORT nNewCurrencyVersionId = 0x434E; // "NC" -const sal_Unicode cNewCurrencyMagic = 0x01; // Magic for format code in comment -const USHORT nNewStandardFlagVersionId = 0x4653; // "SF" - -/***********************Funktion SvNumberformatInfo******************************/ - -void ImpSvNumberformatInfo::Copy( const ImpSvNumberformatInfo& rNumFor, USHORT nAnz ) -{ - for (USHORT i = 0; i < nAnz; i++) - { - sStrArray[i] = rNumFor.sStrArray[i]; - nTypeArray[i] = rNumFor.nTypeArray[i]; - } - eScannedType = rNumFor.eScannedType; - bThousand = rNumFor.bThousand; - nThousand = rNumFor.nThousand; - nCntPre = rNumFor.nCntPre; - nCntPost = rNumFor.nCntPost; - nCntExp = rNumFor.nCntExp; -} - -void ImpSvNumberformatInfo::Save(SvStream& rStream, USHORT nAnz) const -{ - for (USHORT i = 0; i < nAnz; i++) - { - rStream.WriteByteString( sStrArray[i], rStream.GetStreamCharSet() ); - short nType = nTypeArray[i]; - switch ( nType ) - { // der Krampf fuer Versionen vor SV_NUMBERFORMATTER_VERSION_NEW_CURR - case NF_SYMBOLTYPE_CURRENCY : - rStream << short( NF_SYMBOLTYPE_STRING ); - break; - case NF_SYMBOLTYPE_CURRDEL : - case NF_SYMBOLTYPE_CURREXT : - rStream << short(0); // werden ignoriert (hoffentlich..) - break; - default: - if ( nType > NF_KEY_LASTKEYWORD_SO5 ) - rStream << short( NF_SYMBOLTYPE_STRING ); // all new keywords are string - else - rStream << nType; - } - - } - rStream << eScannedType << bThousand << nThousand - << nCntPre << nCntPost << nCntExp; -} - -void ImpSvNumberformatInfo::Load(SvStream& rStream, USHORT nAnz) -{ - for (USHORT i = 0; i < nAnz; i++) - { - SvNumberformat::LoadString( rStream, sStrArray[i] ); - rStream >> nTypeArray[i]; - } - rStream >> eScannedType >> bThousand >> nThousand - >> nCntPre >> nCntPost >> nCntExp; -} - - -//============================================================================ - -// static -BYTE SvNumberNatNum::MapDBNumToNatNum( BYTE nDBNum, LanguageType eLang, BOOL bDate ) -{ - BYTE nNatNum = 0; - eLang = MsLangId::getRealLanguage( eLang ); // resolve SYSTEM etc. - eLang &= 0x03FF; // 10 bit primary language - if ( bDate ) - { - if ( nDBNum == 4 && eLang == LANGUAGE_KOREAN ) - nNatNum = 9; - else if ( nDBNum <= 3 ) - nNatNum = nDBNum; // known to be good for: zh,ja,ko / 1,2,3 - } - else - { - switch ( nDBNum ) - { - case 1: - switch ( eLang ) - { - case (LANGUAGE_CHINESE & 0x03FF) : nNatNum = 4; break; - case (LANGUAGE_JAPANESE & 0x03FF) : nNatNum = 1; break; - case (LANGUAGE_KOREAN & 0x03FF) : nNatNum = 1; break; - } - break; - case 2: - switch ( eLang ) - { - case (LANGUAGE_CHINESE & 0x03FF) : nNatNum = 5; break; - case (LANGUAGE_JAPANESE & 0x03FF) : nNatNum = 4; break; - case (LANGUAGE_KOREAN & 0x03FF) : nNatNum = 2; break; - } - break; - case 3: - switch ( eLang ) - { - case (LANGUAGE_CHINESE & 0x03FF) : nNatNum = 6; break; - case (LANGUAGE_JAPANESE & 0x03FF) : nNatNum = 5; break; - case (LANGUAGE_KOREAN & 0x03FF) : nNatNum = 3; break; - } - break; - case 4: - switch ( eLang ) - { - case (LANGUAGE_JAPANESE & 0x03FF) : nNatNum = 7; break; - case (LANGUAGE_KOREAN & 0x03FF) : nNatNum = 9; break; - } - break; - } - } - return nNatNum; -} - - -// static -BYTE SvNumberNatNum::MapNatNumToDBNum( BYTE nNatNum, LanguageType eLang, BOOL bDate ) -{ - BYTE nDBNum = 0; - eLang = MsLangId::getRealLanguage( eLang ); // resolve SYSTEM etc. - eLang &= 0x03FF; // 10 bit primary language - if ( bDate ) - { - if ( nNatNum == 9 && eLang == LANGUAGE_KOREAN ) - nDBNum = 4; - else if ( nNatNum <= 3 ) - nDBNum = nNatNum; // known to be good for: zh,ja,ko / 1,2,3 - } - else - { - switch ( nNatNum ) - { - case 1: - switch ( eLang ) - { - case (LANGUAGE_JAPANESE & 0x03FF) : nDBNum = 1; break; - case (LANGUAGE_KOREAN & 0x03FF) : nDBNum = 1; break; - } - break; - case 2: - switch ( eLang ) - { - case (LANGUAGE_KOREAN & 0x03FF) : nDBNum = 2; break; - } - break; - case 3: - switch ( eLang ) - { - case (LANGUAGE_KOREAN & 0x03FF) : nDBNum = 3; break; - } - break; - case 4: - switch ( eLang ) - { - case (LANGUAGE_CHINESE & 0x03FF) : nDBNum = 1; break; - case (LANGUAGE_JAPANESE & 0x03FF) : nDBNum = 2; break; - } - break; - case 5: - switch ( eLang ) - { - case (LANGUAGE_CHINESE & 0x03FF) : nDBNum = 2; break; - case (LANGUAGE_JAPANESE & 0x03FF) : nDBNum = 3; break; - } - break; - case 6: - switch ( eLang ) - { - case (LANGUAGE_CHINESE & 0x03FF) : nDBNum = 3; break; - } - break; - case 7: - switch ( eLang ) - { - case (LANGUAGE_JAPANESE & 0x03FF) : nDBNum = 4; break; - } - break; - case 8: - break; - case 9: - switch ( eLang ) - { - case (LANGUAGE_KOREAN & 0x03FF) : nDBNum = 4; break; - } - break; - case 10: - break; - case 11: - break; - } - } - return nDBNum; -} - -/***********************Funktionen SvNumFor******************************/ - -ImpSvNumFor::ImpSvNumFor() -{ - nAnzStrings = 0; - aI.nTypeArray = NULL; - aI.sStrArray = NULL; - aI.eScannedType = NUMBERFORMAT_UNDEFINED; - aI.bThousand = FALSE; - aI.nThousand = 0; - aI.nCntPre = 0; - aI.nCntPost = 0; - aI.nCntExp = 0; - pColor = NULL; -} - -ImpSvNumFor::~ImpSvNumFor() -{ - for (USHORT i = 0; i < nAnzStrings; i++) - aI.sStrArray[i].Erase(); - delete [] aI.sStrArray; - delete [] aI.nTypeArray; -} - -void ImpSvNumFor::Enlarge(USHORT nAnz) -{ - if ( nAnzStrings != nAnz ) - { - if ( aI.nTypeArray ) - delete [] aI.nTypeArray; - if ( aI.sStrArray ) - delete [] aI.sStrArray; - nAnzStrings = nAnz; - if ( nAnz ) - { - aI.nTypeArray = new short[nAnz]; - aI.sStrArray = new String[nAnz]; - } - else - { - aI.nTypeArray = NULL; - aI.sStrArray = NULL; - } - } -} - -void ImpSvNumFor::Copy( const ImpSvNumFor& rNumFor, ImpSvNumberformatScan* pSc ) -{ - Enlarge( rNumFor.nAnzStrings ); - aI.Copy( rNumFor.aI, nAnzStrings ); - sColorName = rNumFor.sColorName; - if ( pSc ) - pColor = pSc->GetColor( sColorName ); // #121103# don't copy pointer between documents - else - pColor = rNumFor.pColor; - aNatNum = rNumFor.aNatNum; -} - -void ImpSvNumFor::Save(SvStream& rStream) const -{ - rStream << nAnzStrings; - aI.Save(rStream, nAnzStrings); - rStream.WriteByteString( sColorName, rStream.GetStreamCharSet() ); -} - -void ImpSvNumFor::Load(SvStream& rStream, ImpSvNumberformatScan& rSc, - String& rLoadedColorName ) -{ - USHORT nAnz; - rStream >> nAnz; //! noch nicht direkt nAnzStrings wg. Enlarge - Enlarge( nAnz ); - aI.Load( rStream, nAnz ); - rStream.ReadByteString( sColorName, rStream.GetStreamCharSet() ); - rLoadedColorName = sColorName; - pColor = rSc.GetColor(sColorName); -} - - -BOOL ImpSvNumFor::HasNewCurrency() const -{ - for ( USHORT j=0; j> nCnt; - for ( USHORT j=0; j> nPos >> nType; - if ( nPos < nAnzStrings ) - aI.nTypeArray[nPos] = nType; - } -} - - -/***********************Funktionen SvNumberformat************************/ - -enum BracketFormatSymbolType -{ - BRACKET_SYMBOLTYPE_FORMAT = -1, // subformat string - BRACKET_SYMBOLTYPE_COLOR = -2, // color - BRACKET_SYMBOLTYPE_ERROR = -3, // error - BRACKET_SYMBOLTYPE_DBNUM1 = -4, // DoubleByteNumber, represent numbers - BRACKET_SYMBOLTYPE_DBNUM2 = -5, // using CJK characters, Excel compatible. - BRACKET_SYMBOLTYPE_DBNUM3 = -6, - BRACKET_SYMBOLTYPE_DBNUM4 = -7, - BRACKET_SYMBOLTYPE_DBNUM5 = -8, - BRACKET_SYMBOLTYPE_DBNUM6 = -9, - BRACKET_SYMBOLTYPE_DBNUM7 = -10, - BRACKET_SYMBOLTYPE_DBNUM8 = -11, - BRACKET_SYMBOLTYPE_DBNUM9 = -12, - BRACKET_SYMBOLTYPE_LOCALE = -13, - BRACKET_SYMBOLTYPE_NATNUM0 = -14, // Our NativeNumber support, ASCII - BRACKET_SYMBOLTYPE_NATNUM1 = -15, // Our NativeNumber support, represent - BRACKET_SYMBOLTYPE_NATNUM2 = -16, // numbers using CJK, CTL, ... - BRACKET_SYMBOLTYPE_NATNUM3 = -17, - BRACKET_SYMBOLTYPE_NATNUM4 = -18, - BRACKET_SYMBOLTYPE_NATNUM5 = -19, - BRACKET_SYMBOLTYPE_NATNUM6 = -20, - BRACKET_SYMBOLTYPE_NATNUM7 = -21, - BRACKET_SYMBOLTYPE_NATNUM8 = -22, - BRACKET_SYMBOLTYPE_NATNUM9 = -23, - BRACKET_SYMBOLTYPE_NATNUM10 = -24, - BRACKET_SYMBOLTYPE_NATNUM11 = -25, - BRACKET_SYMBOLTYPE_NATNUM12 = -26, - BRACKET_SYMBOLTYPE_NATNUM13 = -27, - BRACKET_SYMBOLTYPE_NATNUM14 = -28, - BRACKET_SYMBOLTYPE_NATNUM15 = -29, - BRACKET_SYMBOLTYPE_NATNUM16 = -30, - BRACKET_SYMBOLTYPE_NATNUM17 = -31, - BRACKET_SYMBOLTYPE_NATNUM18 = -32, - BRACKET_SYMBOLTYPE_NATNUM19 = -33 -}; - -SvNumberformat::SvNumberformat( ImpSvNumberformatScan& rSc, LanguageType eLge ) - : - rScan(rSc), - eLnge(eLge), - nNewStandardDefined(0), - bStarFlag( FALSE ) -{ -} - -void SvNumberformat::ImpCopyNumberformat( const SvNumberformat& rFormat ) -{ - sFormatstring = rFormat.sFormatstring; - eType = rFormat.eType; - eLnge = rFormat.eLnge; - fLimit1 = rFormat.fLimit1; - fLimit2 = rFormat.fLimit2; - eOp1 = rFormat.eOp1; - eOp2 = rFormat.eOp2; - bStandard = rFormat.bStandard; - bIsUsed = rFormat.bIsUsed; - sComment = rFormat.sComment; - nNewStandardDefined = rFormat.nNewStandardDefined; - - // #121103# when copying between documents, get color pointers from own scanner - ImpSvNumberformatScan* pColorSc = ( &rScan != &rFormat.rScan ) ? &rScan : NULL; - - for (USHORT i = 0; i < 4; i++) - NumFor[i].Copy(rFormat.NumFor[i], pColorSc); -} - -SvNumberformat::SvNumberformat( SvNumberformat& rFormat ) - : rScan(rFormat.rScan), bStarFlag( rFormat.bStarFlag ) -{ - ImpCopyNumberformat( rFormat ); -} - -SvNumberformat::SvNumberformat( SvNumberformat& rFormat, ImpSvNumberformatScan& rSc ) - : rScan(rSc), bStarFlag( rFormat.bStarFlag ) -{ - ImpCopyNumberformat( rFormat ); -} - - -BOOL lcl_SvNumberformat_IsBracketedPrefix( short nSymbolType ) -{ - if ( nSymbolType > 0 ) - return TRUE; // conditions - switch ( nSymbolType ) - { - case BRACKET_SYMBOLTYPE_COLOR : - case BRACKET_SYMBOLTYPE_DBNUM1 : - case BRACKET_SYMBOLTYPE_DBNUM2 : - case BRACKET_SYMBOLTYPE_DBNUM3 : - case BRACKET_SYMBOLTYPE_DBNUM4 : - case BRACKET_SYMBOLTYPE_DBNUM5 : - case BRACKET_SYMBOLTYPE_DBNUM6 : - case BRACKET_SYMBOLTYPE_DBNUM7 : - case BRACKET_SYMBOLTYPE_DBNUM8 : - case BRACKET_SYMBOLTYPE_DBNUM9 : - case BRACKET_SYMBOLTYPE_LOCALE : - case BRACKET_SYMBOLTYPE_NATNUM0 : - case BRACKET_SYMBOLTYPE_NATNUM1 : - case BRACKET_SYMBOLTYPE_NATNUM2 : - case BRACKET_SYMBOLTYPE_NATNUM3 : - case BRACKET_SYMBOLTYPE_NATNUM4 : - case BRACKET_SYMBOLTYPE_NATNUM5 : - case BRACKET_SYMBOLTYPE_NATNUM6 : - case BRACKET_SYMBOLTYPE_NATNUM7 : - case BRACKET_SYMBOLTYPE_NATNUM8 : - case BRACKET_SYMBOLTYPE_NATNUM9 : - case BRACKET_SYMBOLTYPE_NATNUM10 : - case BRACKET_SYMBOLTYPE_NATNUM11 : - case BRACKET_SYMBOLTYPE_NATNUM12 : - case BRACKET_SYMBOLTYPE_NATNUM13 : - case BRACKET_SYMBOLTYPE_NATNUM14 : - case BRACKET_SYMBOLTYPE_NATNUM15 : - case BRACKET_SYMBOLTYPE_NATNUM16 : - case BRACKET_SYMBOLTYPE_NATNUM17 : - case BRACKET_SYMBOLTYPE_NATNUM18 : - case BRACKET_SYMBOLTYPE_NATNUM19 : - return TRUE; - } - return FALSE; -} - - -SvNumberformat::SvNumberformat(String& rString, - ImpSvNumberformatScan* pSc, - ImpSvNumberInputScan* pISc, - xub_StrLen& nCheckPos, - LanguageType& eLan, - BOOL bStan) - : - rScan(*pSc), - nNewStandardDefined(0), - bStarFlag( FALSE ) -{ - // If the group (AKA thousand) separator is a Non-Breaking Space (French) - // replace all occurences by a simple space. - // The tokens will be changed to the LocaleData separator again later on. - const sal_Unicode cNBSp = 0xA0; - const String& rThSep = GetFormatter().GetNumThousandSep(); - if ( rThSep.GetChar(0) == cNBSp && rThSep.Len() == 1 ) - { - xub_StrLen nIndex = 0; - do - nIndex = rString.SearchAndReplace( cNBSp, ' ', nIndex ); - while ( nIndex != STRING_NOTFOUND ); - } - - if (rScan.GetConvertMode()) - { - eLnge = rScan.GetNewLnge(); - eLan = eLnge; // Wechsel auch zurueckgeben - } - else - eLnge = eLan; - bStandard = bStan; - bIsUsed = FALSE; - fLimit1 = 0.0; - fLimit2 = 0.0; - eOp1 = NUMBERFORMAT_OP_NO; - eOp2 = NUMBERFORMAT_OP_NO; - eType = NUMBERFORMAT_DEFINED; - - BOOL bCancel = FALSE; - BOOL bCondition = FALSE; - short eSymbolType; - xub_StrLen nPos = 0; - xub_StrLen nPosOld; - nCheckPos = 0; - String aComment; - - // Split into 4 sub formats - USHORT nIndex; - for ( nIndex = 0; nIndex < 4 && !bCancel; nIndex++ ) - { - // Original language/country may have to be reestablished - if (rScan.GetConvertMode()) - (rScan.GetNumberformatter())->ChangeIntl(rScan.GetTmpLnge()); - - String sStr; - nPosOld = nPos; // Start position of substring - // first get bracketed prefixes; e.g. conditions, color - do - { - eSymbolType = ImpNextSymbol(rString, nPos, sStr); - if (eSymbolType > 0) // condition - { - if ( nIndex == 0 && !bCondition ) - { - bCondition = TRUE; - eOp1 = (SvNumberformatLimitOps) eSymbolType; - } - else if ( nIndex == 1 && bCondition ) - eOp2 = (SvNumberformatLimitOps) eSymbolType; - else // error - { - bCancel = TRUE; // break for - nCheckPos = nPosOld; - } - if (!bCancel) - { - double fNumber; - xub_StrLen nAnzChars = ImpGetNumber(rString, nPos, sStr); - if (nAnzChars > 0) - { - short F_Type; - if (!pISc->IsNumberFormat(sStr,F_Type,fNumber) || - ( F_Type != NUMBERFORMAT_NUMBER && - F_Type != NUMBERFORMAT_SCIENTIFIC) ) - { - fNumber = 0.0; - nPos = nPos - nAnzChars; - rString.Erase(nPos, nAnzChars); - rString.Insert('0',nPos); - nPos++; - } - } - else - { - fNumber = 0.0; - rString.Insert('0',nPos++); - } - if (nIndex == 0) - fLimit1 = fNumber; - else - fLimit2 = fNumber; - if ( rString.GetChar(nPos) == ']' ) - nPos++; - else - { - bCancel = TRUE; // break for - nCheckPos = nPos; - } - } - nPosOld = nPos; // position before string - } - else if ( lcl_SvNumberformat_IsBracketedPrefix( eSymbolType ) ) - { - switch ( eSymbolType ) - { - case BRACKET_SYMBOLTYPE_COLOR : - { - if ( NumFor[nIndex].GetColor() != NULL ) - { // error, more than one color - bCancel = TRUE; // break for - nCheckPos = nPosOld; - } - else - { - Color* pColor = pSc->GetColor( sStr); - NumFor[nIndex].SetColor( pColor, sStr); - if (pColor == NULL) - { // error - bCancel = TRUE; // break for - nCheckPos = nPosOld; - } - } - } - break; - case BRACKET_SYMBOLTYPE_NATNUM0 : - case BRACKET_SYMBOLTYPE_NATNUM1 : - case BRACKET_SYMBOLTYPE_NATNUM2 : - case BRACKET_SYMBOLTYPE_NATNUM3 : - case BRACKET_SYMBOLTYPE_NATNUM4 : - case BRACKET_SYMBOLTYPE_NATNUM5 : - case BRACKET_SYMBOLTYPE_NATNUM6 : - case BRACKET_SYMBOLTYPE_NATNUM7 : - case BRACKET_SYMBOLTYPE_NATNUM8 : - case BRACKET_SYMBOLTYPE_NATNUM9 : - case BRACKET_SYMBOLTYPE_NATNUM10 : - case BRACKET_SYMBOLTYPE_NATNUM11 : - case BRACKET_SYMBOLTYPE_NATNUM12 : - case BRACKET_SYMBOLTYPE_NATNUM13 : - case BRACKET_SYMBOLTYPE_NATNUM14 : - case BRACKET_SYMBOLTYPE_NATNUM15 : - case BRACKET_SYMBOLTYPE_NATNUM16 : - case BRACKET_SYMBOLTYPE_NATNUM17 : - case BRACKET_SYMBOLTYPE_NATNUM18 : - case BRACKET_SYMBOLTYPE_NATNUM19 : - { - if ( NumFor[nIndex].GetNatNum().IsSet() ) - { - bCancel = TRUE; // break for - nCheckPos = nPosOld; - } - else - { - sStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "NatNum" ) ); - //! eSymbolType is negative - BYTE nNum = sal::static_int_cast< BYTE >(0 - (eSymbolType - BRACKET_SYMBOLTYPE_NATNUM0)); - sStr += String::CreateFromInt32( nNum ); - NumFor[nIndex].SetNatNumNum( nNum, FALSE ); - } - } - break; - case BRACKET_SYMBOLTYPE_DBNUM1 : - case BRACKET_SYMBOLTYPE_DBNUM2 : - case BRACKET_SYMBOLTYPE_DBNUM3 : - case BRACKET_SYMBOLTYPE_DBNUM4 : - case BRACKET_SYMBOLTYPE_DBNUM5 : - case BRACKET_SYMBOLTYPE_DBNUM6 : - case BRACKET_SYMBOLTYPE_DBNUM7 : - case BRACKET_SYMBOLTYPE_DBNUM8 : - case BRACKET_SYMBOLTYPE_DBNUM9 : - { - if ( NumFor[nIndex].GetNatNum().IsSet() ) - { - bCancel = TRUE; // break for - nCheckPos = nPosOld; - } - else - { - sStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "DBNum" ) ); - //! eSymbolType is negative - BYTE nNum = sal::static_int_cast< BYTE >(1 - (eSymbolType - BRACKET_SYMBOLTYPE_DBNUM1)); - sStr += static_cast< sal_Unicode >('0' + nNum); - NumFor[nIndex].SetNatNumNum( nNum, TRUE ); - } - } - break; - case BRACKET_SYMBOLTYPE_LOCALE : - { - if ( NumFor[nIndex].GetNatNum().GetLang() != LANGUAGE_DONTKNOW ) - { - bCancel = TRUE; // break for - nCheckPos = nPosOld; - } - else - { - xub_StrLen nTmp = 2; - LanguageType eLang = ImpGetLanguageType( sStr, nTmp ); - if ( eLang == LANGUAGE_DONTKNOW ) - { - bCancel = TRUE; // break for - nCheckPos = nPosOld; - } - else - { - sStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "$-" ) ); - sStr += String::CreateFromInt32( sal_Int32( eLang ), 16 ).ToUpperAscii(); - NumFor[nIndex].SetNatNumLang( eLang ); - } - } - } - break; - } - if ( !bCancel ) - { - rString.Erase(nPosOld,nPos-nPosOld); - rString.Insert(sStr,nPosOld); - nPos = nPosOld + sStr.Len(); - rString.Insert(']', nPos); - rString.Insert('[', nPosOld); - nPos += 2; - nPosOld = nPos; // position before string - } - } - } while ( !bCancel && lcl_SvNumberformat_IsBracketedPrefix( eSymbolType ) ); - - // The remaining format code string - if ( !bCancel ) - { - if (eSymbolType == BRACKET_SYMBOLTYPE_FORMAT) - { - if (nIndex == 1 && eOp1 == NUMBERFORMAT_OP_NO) - eOp1 = NUMBERFORMAT_OP_GT; // undefined condition, default: > 0 - else if (nIndex == 2 && eOp2 == NUMBERFORMAT_OP_NO) - eOp2 = NUMBERFORMAT_OP_LT; // undefined condition, default: < 0 - if (sStr.Len() == 0) - { // empty sub format - } - else - { - xub_StrLen nStrPos = pSc->ScanFormat( sStr, aComment ); - USHORT nAnz = pSc->GetAnzResStrings(); - if (nAnz == 0) // error - nStrPos = 1; - if (nStrPos == 0) // ok - { - // e.g. Thai T speciality - if (pSc->GetNatNumModifier() && !NumFor[nIndex].GetNatNum().IsSet()) - { - String aNat( RTL_CONSTASCII_USTRINGPARAM( "[NatNum")); - aNat += String::CreateFromInt32( pSc->GetNatNumModifier()); - aNat += ']'; - sStr.Insert( aNat, 0); - NumFor[nIndex].SetNatNumNum( pSc->GetNatNumModifier(), FALSE ); - } - // #i53826# #i42727# For the Thai T speciality we need - // to freeze the locale and immunize it against - // conversions during exports, just in case we want to - // save to Xcl. This disables the feature of being able - // to convert a NatNum to another locale. You can't - // have both. - // FIXME: implement a specialized export conversion - // that works on tokens (have to tokenize all first) - // and doesn't use the format string and - // PutandConvertEntry() to LANGUAGE_ENGLISH_US in - // sc/source/filter/excel/xestyle.cxx - // XclExpNumFmtBuffer::WriteFormatRecord(). - LanguageType eLanguage; - if (NumFor[nIndex].GetNatNum().GetNatNum() == 1 && - ((eLanguage = - MsLangId::getRealLanguage( eLan)) - == LANGUAGE_THAI) && - NumFor[nIndex].GetNatNum().GetLang() == - LANGUAGE_DONTKNOW) - { - String aLID( RTL_CONSTASCII_USTRINGPARAM( "[$-")); - aLID += String::CreateFromInt32( sal_Int32( - eLanguage), 16 ).ToUpperAscii(); - aLID += ']'; - sStr.Insert( aLID, 0); - NumFor[nIndex].SetNatNumLang( eLanguage); - } - rString.Erase(nPosOld,nPos-nPosOld); - rString.Insert(sStr,nPosOld); - nPos = nPosOld + sStr.Len(); - if (nPos < rString.Len()) - { - rString.Insert(';',nPos); - nPos++; - } - NumFor[nIndex].Enlarge(nAnz); - pSc->CopyInfo(&(NumFor[nIndex].Info()), nAnz); - // type check - if (nIndex == 0) - eType = (short) NumFor[nIndex].Info().eScannedType; - else if (nIndex == 3) - { // #77026# Everything recognized IS text - NumFor[nIndex].Info().eScannedType = NUMBERFORMAT_TEXT; - } - else if ( (short) NumFor[nIndex].Info().eScannedType != - eType) - eType = NUMBERFORMAT_DEFINED; - } - else - { - nCheckPos = nPosOld + nStrPos; // error in string - bCancel = TRUE; // break for - } - } - } - else if (eSymbolType == BRACKET_SYMBOLTYPE_ERROR) // error - { - nCheckPos = nPosOld; - bCancel = TRUE; - } - else if ( lcl_SvNumberformat_IsBracketedPrefix( eSymbolType ) ) - { - nCheckPos = nPosOld+1; // error, prefix in string - bCancel = TRUE; // break for - } - } - if ( bCancel && !nCheckPos ) - nCheckPos = 1; // nCheckPos is used as an error condition - if ( !bCancel ) - { - if ( NumFor[nIndex].GetNatNum().IsSet() && - NumFor[nIndex].GetNatNum().GetLang() == LANGUAGE_DONTKNOW ) - NumFor[nIndex].SetNatNumLang( eLan ); - } - if (rString.Len() == nPos) - { - if ( nIndex == 2 && eSymbolType == BRACKET_SYMBOLTYPE_FORMAT && - rString.GetChar(nPos-1) == ';' ) - { // #83510# A 4th subformat explicitly specified to be empty - // hides any text. Need the type here for HasTextFormat() - NumFor[3].Info().eScannedType = NUMBERFORMAT_TEXT; - } - bCancel = TRUE; - } - if ( NumFor[nIndex].GetNatNum().IsSet() ) - NumFor[nIndex].SetNatNumDate( - (NumFor[nIndex].Info().eScannedType & NUMBERFORMAT_DATE) != 0 ); - } - - if ( bCondition && !nCheckPos ) - { - if ( nIndex == 1 && NumFor[0].GetnAnz() == 0 && - rString.GetChar(rString.Len()-1) != ';' ) - { // No format code => GENERAL but not if specified empty - String aAdd( pSc->GetStandardName() ); - String aTmp; - if ( !pSc->ScanFormat( aAdd, aTmp ) ) - { - USHORT nAnz = pSc->GetAnzResStrings(); - if ( nAnz ) - { - NumFor[0].Enlarge(nAnz); - pSc->CopyInfo( &(NumFor[0].Info()), nAnz ); - rString += aAdd; - } - } - } - else if ( nIndex == 1 && NumFor[nIndex].GetnAnz() == 0 && - rString.GetChar(rString.Len()-1) != ';' && - (NumFor[0].GetnAnz() > 1 || (NumFor[0].GetnAnz() == 1 && - NumFor[0].Info().nTypeArray[0] != NF_KEY_GENERAL)) ) - { // No trailing second subformat => GENERAL but not if specified empty - // and not if first subformat is GENERAL - String aAdd( pSc->GetStandardName() ); - String aTmp; - if ( !pSc->ScanFormat( aAdd, aTmp ) ) - { - USHORT nAnz = pSc->GetAnzResStrings(); - if ( nAnz ) - { - NumFor[nIndex].Enlarge(nAnz); - pSc->CopyInfo( &(NumFor[nIndex].Info()), nAnz ); - rString += ';'; - rString += aAdd; - } - } - } - else if ( nIndex == 2 && NumFor[nIndex].GetnAnz() == 0 && - rString.GetChar(rString.Len()-1) != ';' && - eOp2 != NUMBERFORMAT_OP_NO ) - { // No trailing third subformat => GENERAL but not if specified empty - String aAdd( pSc->GetStandardName() ); - String aTmp; - if ( !pSc->ScanFormat( aAdd, aTmp ) ) - { - USHORT nAnz = pSc->GetAnzResStrings(); - if ( nAnz ) - { - NumFor[nIndex].Enlarge(nAnz); - pSc->CopyInfo( &(NumFor[nIndex].Info()), nAnz ); - rString += ';'; - rString += aAdd; - } - } - } - } - sFormatstring = rString; - if ( aComment.Len() ) - { - SetComment( aComment ); // setzt sComment und sFormatstring - rString = sFormatstring; // geaenderten sFormatstring uebernehmen - } - if (NumFor[2].GetnAnz() == 0 && // kein 3. Teilstring - eOp1 == NUMBERFORMAT_OP_GT && eOp2 == NUMBERFORMAT_OP_NO && - fLimit1 == 0.0 && fLimit2 == 0.0) - eOp1 = NUMBERFORMAT_OP_GE; // 0 zum ersten Format dazu - -} - -SvNumberformat::~SvNumberformat() -{ -} - -//--------------------------------------------------------------------------- -// Next_Symbol -//--------------------------------------------------------------------------- -// Zerlegt die Eingabe in Symbole fuer die weitere -// Verarbeitung (Turing-Maschine). -//--------------------------------------------------------------------------- -// Ausgangs Zustand = SsStart -//---------------+-------------------+-----------------------+--------------- -// Alter Zustand | gelesenes Zeichen | Aktion | Neuer Zustand -//---------------+-------------------+-----------------------+--------------- -// SsStart | ; | Pos-- | SsGetString -// | [ | Symbol += Zeichen | SsGetBracketed -// | ] | Fehler | SsStop -// | BLANK | | -// | Sonst | Symbol += Zeichen | SsGetString -//---------------+-------------------+-----------------------+--------------- -// SsGetString | ; | | SsStop -// | Sonst | Symbol+=Zeichen | -//---------------+-------------------+-----------------------+--------------- -// SsGetBracketed| <, > = | del [ | -// | | Symbol += Zeichen | SsGetCon -// | BLANK | | -// | h, H, m, M, s, S | Symbol += Zeichen | SsGetTime -// | sonst | del [ | -// | | Symbol += Zeichen | SsGetPrefix -//---------------+-------------------+-----------------------+--------------- -// SsGetTime | ] | Symbol += Zeichen | SsGetString -// | h, H, m, M, s, S | Symbol += Zeichen, * | SsGetString -// | sonst | del [; Symbol+=Zeichen| SsGetPrefix -//---------------+-------------------+-----------------------+--------------- -// SsGetPrefix | ] | | SsStop -// | sonst | Symbol += Zeichen | -//---------------+-------------------+-----------------------+--------------- -// SsGetCon | >, = | Symbol+=Zeichen | -// | ] | | SsStop -// | sonst | Fehler | SsStop -//---------------+-------------------+-----------------------+--------------- -// * : Sonderbedingung - -enum ScanState -{ - SsStop, - SsStart, - SsGetCon, // condition - SsGetString, // format string - SsGetPrefix, // color or NatNumN - SsGetTime, // [HH] for time - SsGetBracketed // any [...] not decided yet -}; - - -// read a string until ']' and delete spaces in input -// static -xub_StrLen SvNumberformat::ImpGetNumber(String& rString, - xub_StrLen& nPos, - String& sSymbol) -{ - xub_StrLen nStartPos = nPos; - sal_Unicode cToken; - xub_StrLen nLen = rString.Len(); - sSymbol.Erase(); - while ( nPos < nLen && ((cToken = rString.GetChar(nPos)) != ']') ) - { - if (cToken == ' ') - { // delete spaces - rString.Erase(nPos,1); - nLen--; - } - else - { - nPos++; - sSymbol += cToken; - } - } - return nPos - nStartPos; -} - - -// static -LanguageType SvNumberformat::ImpGetLanguageType( const String& rString, - xub_StrLen& nPos ) -{ - sal_Int32 nNum = 0; - sal_Unicode cToken = 0; - xub_StrLen nLen = rString.Len(); - while ( nPos < nLen && ((cToken = rString.GetChar(nPos)) != ']') ) - { - if ( '0' <= cToken && cToken <= '9' ) - { - nNum *= 16; - nNum += cToken - '0'; - } - else if ( 'a' <= cToken && cToken <= 'f' ) - { - nNum *= 16; - nNum += cToken - 'a' + 10; - } - else if ( 'A' <= cToken && cToken <= 'F' ) - { - nNum *= 16; - nNum += cToken - 'A' + 10; - } - else - return LANGUAGE_DONTKNOW; - ++nPos; - } - return (nNum && (cToken == ']' || nPos == nLen)) ? (LanguageType)nNum : - LANGUAGE_DONTKNOW; -} - - -short SvNumberformat::ImpNextSymbol(String& rString, - xub_StrLen& nPos, - String& sSymbol) -{ - short eSymbolType = BRACKET_SYMBOLTYPE_FORMAT; - sal_Unicode cToken; - sal_Unicode cLetter = ' '; // Zwischenergebnis - xub_StrLen nLen = rString.Len(); - ScanState eState = SsStart; - sSymbol.Erase(); - const String* pKeywords = rScan.GetKeywords(); - while (nPos < nLen && eState != SsStop) - { - cToken = rString.GetChar(nPos); - nPos++; - switch (eState) - { - case SsStart: - { - if (cToken == '[') - { - eState = SsGetBracketed; - sSymbol += cToken; - } - else if (cToken == ';') - { - eState = SsGetString; - nPos--; - eSymbolType = BRACKET_SYMBOLTYPE_FORMAT; - } - else if (cToken == ']') - { - eState = SsStop; - eSymbolType = BRACKET_SYMBOLTYPE_ERROR; - } - else if (cToken == ' ') // Skip Blanks - { - rString.Erase(nPos-1,1); - nPos--; - nLen--; - } - else - { - sSymbol += cToken; - eState = SsGetString; - eSymbolType = BRACKET_SYMBOLTYPE_FORMAT; - } - } - break; - case SsGetBracketed: - { - switch (cToken) - { - case '<': - case '>': - case '=': - { - sSymbol.EraseAllChars('['); - sSymbol += cToken; - cLetter = cToken; - eState = SsGetCon; - switch (cToken) - { - case '<': eSymbolType = NUMBERFORMAT_OP_LT; break; - case '>': eSymbolType = NUMBERFORMAT_OP_GT; break; - case '=': eSymbolType = NUMBERFORMAT_OP_EQ; break; - default: break; - } - } - break; - case ' ': - { - rString.Erase(nPos-1,1); - nPos--; - nLen--; - } - break; - case '$' : - { - if ( rString.GetChar(nPos) == '-' ) - { // [$-xxx] locale - sSymbol.EraseAllChars('['); - eSymbolType = BRACKET_SYMBOLTYPE_LOCALE; - eState = SsGetPrefix; - } - else - { // currency as of SV_NUMBERFORMATTER_VERSION_NEW_CURR - eSymbolType = BRACKET_SYMBOLTYPE_FORMAT; - eState = SsGetString; - } - sSymbol += cToken; - } - break; - case '~' : - { // calendarID as of SV_NUMBERFORMATTER_VERSION_CALENDAR - eSymbolType = BRACKET_SYMBOLTYPE_FORMAT; - sSymbol += cToken; - eState = SsGetString; - } - break; - default: - { - static const String aNatNum( RTL_CONSTASCII_USTRINGPARAM( "NATNUM" ) ); - static const String aDBNum( RTL_CONSTASCII_USTRINGPARAM( "DBNUM" ) ); - String aUpperNatNum( rChrCls().toUpper( rString, nPos-1, aNatNum.Len() ) ); - String aUpperDBNum( rChrCls().toUpper( rString, nPos-1, aDBNum.Len() ) ); - sal_Unicode cUpper = aUpperNatNum.GetChar(0); - sal_Int32 nNatNumNum = rString.Copy( nPos-1+aNatNum.Len() ).ToInt32(); - sal_Unicode cDBNum = rString.GetChar( nPos-1+aDBNum.Len() ); - if ( aUpperNatNum == aNatNum && 0 <= nNatNumNum && nNatNumNum <= 19 ) - { - sSymbol.EraseAllChars('['); - sSymbol += rString.Copy( --nPos, aNatNum.Len()+1 ); - nPos += aNatNum.Len()+1; - //! SymbolType is negative - eSymbolType = (short) (BRACKET_SYMBOLTYPE_NATNUM0 - nNatNumNum); - eState = SsGetPrefix; - } - else if ( aUpperDBNum == aDBNum && '1' <= cDBNum && cDBNum <= '9' ) - { - sSymbol.EraseAllChars('['); - sSymbol += rString.Copy( --nPos, aDBNum.Len()+1 ); - nPos += aDBNum.Len()+1; - //! SymbolType is negative - eSymbolType = sal::static_int_cast< short >( - BRACKET_SYMBOLTYPE_DBNUM1 - (cDBNum - '1')); - eState = SsGetPrefix; - } - else if (cUpper == pKeywords[NF_KEY_H].GetChar(0) || // H - cUpper == pKeywords[NF_KEY_MI].GetChar(0) || // M - cUpper == pKeywords[NF_KEY_S].GetChar(0) ) // S - { - sSymbol += cToken; - eState = SsGetTime; - cLetter = cToken; - } - else - { - sSymbol.EraseAllChars('['); - sSymbol += cToken; - eSymbolType = BRACKET_SYMBOLTYPE_COLOR; - eState = SsGetPrefix; - } - } - break; - } - } - break; - case SsGetString: - { - if (cToken == ';') - eState = SsStop; - else - sSymbol += cToken; - } - break; - case SsGetTime: - { - if (cToken == ']') - { - sSymbol += cToken; - eState = SsGetString; - eSymbolType = BRACKET_SYMBOLTYPE_FORMAT; - } - else - { - sal_Unicode cUpper = rChrCls().toUpper( rString, nPos-1, 1 ).GetChar(0); - if (cUpper == pKeywords[NF_KEY_H].GetChar(0) || // H - cUpper == pKeywords[NF_KEY_MI].GetChar(0) || // M - cUpper == pKeywords[NF_KEY_S].GetChar(0) ) // S - { - if (cLetter == cToken) - { - sSymbol += cToken; - cLetter = ' '; - } - else - { - sSymbol.EraseAllChars('['); - sSymbol += cToken; - eState = SsGetPrefix; - } - } - else - { - sSymbol.EraseAllChars('['); - sSymbol += cToken; - eSymbolType = BRACKET_SYMBOLTYPE_COLOR; - eState = SsGetPrefix; - } - } - } - break; - case SsGetCon: - { - switch (cToken) - { - case '<': - { - eState = SsStop; - eSymbolType = BRACKET_SYMBOLTYPE_ERROR; - } - break; - case '>': - { - if (cLetter == '<') - { - sSymbol += cToken; - cLetter = ' '; - eState = SsStop; - eSymbolType = NUMBERFORMAT_OP_NE; - } - else - { - eState = SsStop; - eSymbolType = BRACKET_SYMBOLTYPE_ERROR; - } - } - break; - case '=': - { - if (cLetter == '<') - { - sSymbol += cToken; - cLetter = ' '; - eSymbolType = NUMBERFORMAT_OP_LE; - } - else if (cLetter == '>') - { - sSymbol += cToken; - cLetter = ' '; - eSymbolType = NUMBERFORMAT_OP_GE; - } - else - { - eState = SsStop; - eSymbolType = BRACKET_SYMBOLTYPE_ERROR; - } - } - break; - case ' ': - { - rString.Erase(nPos-1,1); - nPos--; - nLen--; - } - break; - default: - { - eState = SsStop; - nPos--; - } - break; - } - } - break; - case SsGetPrefix: - { - if (cToken == ']') - eState = SsStop; - else - sSymbol += cToken; - } - break; - default: - break; - } // of switch - } // of while - - return eSymbolType; -} - -NfHackConversion SvNumberformat::Load( SvStream& rStream, - ImpSvNumMultipleReadHeader& rHdr, SvNumberFormatter* pHackConverter, - ImpSvNumberInputScan& rISc ) -{ - rHdr.StartEntry(); - USHORT nOp1, nOp2; - SvNumberformat::LoadString( rStream, sFormatstring ); - rStream >> eType >> fLimit1 >> fLimit2 - >> nOp1 >> nOp2 >> bStandard >> bIsUsed; - NfHackConversion eHackConversion = NF_CONVERT_NONE; - BOOL bOldConvert = FALSE; - LanguageType eOldTmpLang = 0; - LanguageType eOldNewLang = 0; - if ( pHackConverter ) - { // werden nur hierbei gebraucht - bOldConvert = rScan.GetConvertMode(); - eOldTmpLang = rScan.GetTmpLnge(); - eOldNewLang = rScan.GetNewLnge(); - } - String aLoadedColorName; - for (USHORT i = 0; i < 4; i++) - { - NumFor[i].Load( rStream, rScan, aLoadedColorName ); - if ( pHackConverter && eHackConversion == NF_CONVERT_NONE ) - { - //! HACK! ER 29.07.97 13:52 - // leider wurde nicht gespeichert, was SYSTEM on Save wirklich war :-/ - // aber immerhin wird manchmal fuer einen Entry FARBE oder COLOR gespeichert.. - // System-German FARBE nach System-xxx COLOR umsetzen und vice versa, - //! geht davon aus, dass onSave nur GERMAN und ENGLISH KeyWords in - //! ImpSvNumberformatScan existierten - if ( aLoadedColorName.Len() && !NumFor[i].GetColor() - && aLoadedColorName != rScan.GetColorString() ) - { - if ( rScan.GetColorString().EqualsAscii( "FARBE" ) ) - { // English -> German - eHackConversion = NF_CONVERT_ENGLISH_GERMAN; - rScan.GetNumberformatter()->ChangeIntl( LANGUAGE_ENGLISH_US ); - rScan.SetConvertMode( LANGUAGE_ENGLISH_US, LANGUAGE_GERMAN ); - } - else - { // German -> English - eHackConversion = NF_CONVERT_GERMAN_ENGLISH; - rScan.GetNumberformatter()->ChangeIntl( LANGUAGE_GERMAN ); - rScan.SetConvertMode( LANGUAGE_GERMAN, LANGUAGE_ENGLISH_US ); - } - String aColorName = NumFor[i].GetColorName(); - const Color* pColor = rScan.GetColor( aColorName ); - if ( !pColor && aLoadedColorName == aColorName ) - eHackConversion = NF_CONVERT_NONE; - rScan.GetNumberformatter()->ChangeIntl( LANGUAGE_SYSTEM ); - rScan.SetConvertMode( eOldTmpLang, eOldNewLang ); - rScan.SetConvertMode( bOldConvert ); - } - } - } - eOp1 = (SvNumberformatLimitOps) nOp1; - eOp2 = (SvNumberformatLimitOps) nOp2; - String aComment; // wird nach dem NewCurrency-Geraffel richtig gesetzt - if ( rHdr.BytesLeft() ) - { // ab SV_NUMBERFORMATTER_VERSION_NEWSTANDARD - SvNumberformat::LoadString( rStream, aComment ); - rStream >> nNewStandardDefined; - } - - xub_StrLen nNewCurrencyEnd = STRING_NOTFOUND; - BOOL bNewCurrencyComment = ( aComment.GetChar(0) == cNewCurrencyMagic && - (nNewCurrencyEnd = aComment.Search( cNewCurrencyMagic, 1 )) != STRING_NOTFOUND ); - BOOL bNewCurrencyLoaded = FALSE; - BOOL bNewCurrency = FALSE; - - BOOL bGoOn = TRUE; - while ( rHdr.BytesLeft() && bGoOn ) - { // as of SV_NUMBERFORMATTER_VERSION_NEW_CURR - USHORT nId; - rStream >> nId; - switch ( nId ) - { - case nNewCurrencyVersionId : - { - bNewCurrencyLoaded = TRUE; - rStream >> bNewCurrency; - if ( bNewCurrency ) - { - for ( USHORT j=0; j<4; j++ ) - { - NumFor[j].LoadNewCurrencyMap( rStream ); - } - } - } - break; - case nNewStandardFlagVersionId : - rStream >> bStandard; // the real standard flag - break; - default: - DBG_ERRORFILE( "SvNumberformat::Load: unknown header bytes left nId" ); - bGoOn = FALSE; // stop reading unknown stream left over of newer versions - // Would be nice to have multiple read/write headers instead - // but old versions wouldn't know it, TLOT. - } - } - rHdr.EndEntry(); - - if ( bNewCurrencyLoaded ) - { - if ( bNewCurrency && bNewCurrencyComment ) - { // original Formatstring und Kommentar wiederherstellen - sFormatstring = aComment.Copy( 1, nNewCurrencyEnd-1 ); - aComment.Erase( 0, nNewCurrencyEnd+1 ); - } - } - else if ( bNewCurrencyComment ) - { // neu, aber mit Version vor SV_NUMBERFORMATTER_VERSION_NEW_CURR gespeichert - // original Formatstring und Kommentar wiederherstellen - sFormatstring = aComment.Copy( 1, nNewCurrencyEnd-1 ); - aComment.Erase( 0, nNewCurrencyEnd+1 ); - // Zustaende merken - short nDefined = ( eType & NUMBERFORMAT_DEFINED ); - USHORT nNewStandard = nNewStandardDefined; - // neu parsen etc. - String aStr( sFormatstring ); - xub_StrLen nCheckPos = 0; - SvNumberformat* pFormat = new SvNumberformat( aStr, &rScan, &rISc, - nCheckPos, eLnge, bStandard ); - DBG_ASSERT( !nCheckPos, "SvNumberformat::Load: NewCurrencyRescan nCheckPos" ); - ImpCopyNumberformat( *pFormat ); - delete pFormat; - // Zustaende wiederherstellen - eType |= nDefined; - if ( nNewStandard ) - SetNewStandardDefined( nNewStandard ); - } - SetComment( aComment ); - - if ( eHackConversion != NF_CONVERT_NONE ) - { //! und weiter mit dem HACK! - switch ( eHackConversion ) - { - case NF_CONVERT_ENGLISH_GERMAN : - ConvertLanguage( *pHackConverter, - LANGUAGE_ENGLISH_US, LANGUAGE_GERMAN, TRUE ); - break; - case NF_CONVERT_GERMAN_ENGLISH : - ConvertLanguage( *pHackConverter, - LANGUAGE_GERMAN, LANGUAGE_ENGLISH_US, TRUE ); - break; - default: - DBG_ERRORFILE( "SvNumberformat::Load: eHackConversion unknown" ); - } - } - return eHackConversion; -} - -void SvNumberformat::ConvertLanguage( SvNumberFormatter& rConverter, - LanguageType eConvertFrom, LanguageType eConvertTo, BOOL bSystem ) -{ - xub_StrLen nCheckPos; - sal_uInt32 nKey; - short nType = eType; - String aFormatString( sFormatstring ); - if ( bSystem ) - rConverter.PutandConvertEntrySystem( aFormatString, nCheckPos, nType, - nKey, eConvertFrom, eConvertTo ); - else - rConverter.PutandConvertEntry( aFormatString, nCheckPos, nType, - nKey, eConvertFrom, eConvertTo ); - const SvNumberformat* pFormat = rConverter.GetEntry( nKey ); - DBG_ASSERT( pFormat, "SvNumberformat::ConvertLanguage: Conversion ohne Format" ); - if ( pFormat ) - { - ImpCopyNumberformat( *pFormat ); - // aus Formatter/Scanner uebernommene Werte zuruecksetzen - if ( bSystem ) - eLnge = LANGUAGE_SYSTEM; - // pColor zeigt noch auf Tabelle in temporaerem Formatter/Scanner - for ( USHORT i = 0; i < 4; i++ ) - { - String aColorName = NumFor[i].GetColorName(); - Color* pColor = rScan.GetColor( aColorName ); - NumFor[i].SetColor( pColor, aColorName ); - } - } -} - - -// static -void SvNumberformat::LoadString( SvStream& rStream, String& rStr ) -{ - CharSet eStream = rStream.GetStreamCharSet(); - ByteString aStr; - rStream.ReadByteString( aStr ); - sal_Char cStream = NfCurrencyEntry::GetEuroSymbol( eStream ); - if ( aStr.Search( cStream ) == STRING_NOTFOUND ) - { // simple conversion to unicode - rStr = UniString( aStr, eStream ); - } - else - { - sal_Unicode cTarget = NfCurrencyEntry::GetEuroSymbol(); - register const sal_Char* p = aStr.GetBuffer(); - register const sal_Char* const pEnd = p + aStr.Len(); - register sal_Unicode* pUni = rStr.AllocBuffer( aStr.Len() ); - while ( p < pEnd ) - { - if ( *p == cStream ) - *pUni = cTarget; - else - *pUni = ByteString::ConvertToUnicode( *p, eStream ); - p++; - pUni++; - } - *pUni = 0; - } -} - - -void SvNumberformat::Save( SvStream& rStream, ImpSvNumMultipleWriteHeader& rHdr ) const -{ - String aFormatstring( sFormatstring ); - String aComment( sComment ); -#if NF_COMMENT_IN_FORMATSTRING - // der Kommentar im Formatstring wird nicht gespeichert, um in alten Versionen - // nicht ins schleudern zu kommen und spaeter getrennte Verarbeitung - // (z.B. im Dialog) zu ermoeglichen - SetComment( "", aFormatstring, aComment ); -#endif - - BOOL bNewCurrency = HasNewCurrency(); - if ( bNewCurrency ) - { // SV_NUMBERFORMATTER_VERSION_NEW_CURR im Kommentar speichern - aComment.Insert( cNewCurrencyMagic, 0 ); - aComment.Insert( cNewCurrencyMagic, 0 ); - aComment.Insert( aFormatstring, 1 ); - Build50Formatstring( aFormatstring ); // alten Formatstring generieren - } - - // old SO5 versions do behave strange (no output) if standard flag is set - // on formats not prepared for it (not having the following exact types) - BOOL bOldStandard = bStandard; - if ( bOldStandard ) - { - switch ( eType ) - { - case NUMBERFORMAT_NUMBER : - case NUMBERFORMAT_DATE : - case NUMBERFORMAT_TIME : - case NUMBERFORMAT_DATETIME : - case NUMBERFORMAT_PERCENT : - case NUMBERFORMAT_SCIENTIFIC : - // ok to save - break; - default: - bOldStandard = FALSE; - } - } - - rHdr.StartEntry(); - rStream.WriteByteString( aFormatstring, rStream.GetStreamCharSet() ); - rStream << eType << fLimit1 << fLimit2 << (USHORT) eOp1 << (USHORT) eOp2 - << bOldStandard << bIsUsed; - for (USHORT i = 0; i < 4; i++) - NumFor[i].Save(rStream); - // ab SV_NUMBERFORMATTER_VERSION_NEWSTANDARD - rStream.WriteByteString( aComment, rStream.GetStreamCharSet() ); - rStream << nNewStandardDefined; - // ab SV_NUMBERFORMATTER_VERSION_NEW_CURR - rStream << nNewCurrencyVersionId; - rStream << bNewCurrency; - if ( bNewCurrency ) - { - for ( USHORT j=0; j<4; j++ ) - { - NumFor[j].SaveNewCurrencyMap( rStream ); - } - } - - // the real standard flag to load with versions >638 if different - if ( bStandard != bOldStandard ) - { - rStream << nNewStandardFlagVersionId; - rStream << bStandard; - } - - rHdr.EndEntry(); -} - - -BOOL SvNumberformat::HasNewCurrency() const -{ - for ( USHORT j=0; j<4; j++ ) - { - if ( NumFor[j].HasNewCurrency() ) - return TRUE; - } - return FALSE; -} - - -BOOL SvNumberformat::GetNewCurrencySymbol( String& rSymbol, - String& rExtension ) const -{ - for ( USHORT j=0; j<4; j++ ) - { - if ( NumFor[j].GetNewCurrencySymbol( rSymbol, rExtension ) ) - return TRUE; - } - rSymbol.Erase(); - rExtension.Erase(); - return FALSE; -} - - -// static -String SvNumberformat::StripNewCurrencyDelimiters( const String& rStr, - BOOL bQuoteSymbol ) -{ - String aTmp; - xub_StrLen nStartPos, nPos, nLen; - nLen = rStr.Len(); - nStartPos = 0; - while ( (nPos = rStr.SearchAscii( "[$", nStartPos )) != STRING_NOTFOUND ) - { - xub_StrLen nEnd; - if ( (nEnd = GetQuoteEnd( rStr, nPos )) < nLen ) - { - aTmp += rStr.Copy( nStartPos, ++nEnd - nStartPos ); - nStartPos = nEnd; - } - else - { - aTmp += rStr.Copy( nStartPos, nPos - nStartPos ); - nStartPos = nPos + 2; - xub_StrLen nDash; - nEnd = nStartPos - 1; - do - { - nDash = rStr.Search( '-', ++nEnd ); - } while ( (nEnd = GetQuoteEnd( rStr, nDash )) < nLen ); - xub_StrLen nClose; - nEnd = nStartPos - 1; - do - { - nClose = rStr.Search( ']', ++nEnd ); - } while ( (nEnd = GetQuoteEnd( rStr, nClose )) < nLen ); - nPos = ( nDash < nClose ? nDash : nClose ); - if ( !bQuoteSymbol || rStr.GetChar( nStartPos ) == '"' ) - aTmp += rStr.Copy( nStartPos, nPos - nStartPos ); - else - { - aTmp += '"'; - aTmp += rStr.Copy( nStartPos, nPos - nStartPos ); - aTmp += '"'; - } - nStartPos = nClose + 1; - } - } - if ( nLen > nStartPos ) - aTmp += rStr.Copy( nStartPos, nLen - nStartPos ); - return aTmp; -} - - -void SvNumberformat::Build50Formatstring( String& rStr ) const -{ - rStr = StripNewCurrencyDelimiters( sFormatstring, TRUE ); -} - - -void SvNumberformat::ImpGetOutputStandard(double& fNumber, String& OutString) -{ - USHORT nStandardPrec = rScan.GetStandardPrec(); - if ( fabs(fNumber) > 1.0E15 ) // #58531# war E16 - OutString = ::rtl::math::doubleToUString( fNumber, - rtl_math_StringFormat_E, nStandardPrec /*2*/, - GetFormatter().GetNumDecimalSep().GetChar(0)); - else - { -#if 0 -{ - // debugger test case for ANSI standard correctness - ::rtl::OUString aTest; - // expect 0.00123 OK - aTest = ::rtl::math::doubleToUString( 0.001234567, - rtl_math_StringFormat_G, 3, '.', sal_True ); - // expect 123 OK - aTest = ::rtl::math::doubleToUString( 123.4567, - rtl_math_StringFormat_G, 3, '.', sal_True ); - // expect 123.5 OK - aTest = ::rtl::math::doubleToUString( 123.4567, - rtl_math_StringFormat_G, 4, '.', sal_True ); - // expect 1e+03 (as 999.6 rounded to 3 significant digits results in - // 1000 with an exponent equal to significant digits) - // Currently (24-Jan-2003) we do fail in this case and output 1000 - // instead, negligible. - aTest = ::rtl::math::doubleToUString( 999.6, - rtl_math_StringFormat_G, 3, '.', sal_True ); - // expect what? result is 1.2e+004 - aTest = ::rtl::math::doubleToUString( 12345.6789, - rtl_math_StringFormat_G, -3, '.', sal_True ); -} -#endif - - OutString = ::rtl::math::doubleToUString( fNumber, - rtl_math_StringFormat_F, nStandardPrec /*2*/, - GetFormatter().GetNumDecimalSep().GetChar(0), sal_True ); - if (OutString.GetChar(0) == '-' && - OutString.GetTokenCount('0') == OutString.Len()) - OutString.EraseLeadingChars('-'); // nicht -0 - } - ImpTransliterate( OutString, NumFor[0].GetNatNum() ); - return; -} - -void SvNumberformat::ImpGetOutputInputLine(double fNumber, String& OutString) -{ - BOOL bModified = FALSE; - if ( (eType & NUMBERFORMAT_PERCENT) && (fabs(fNumber) < _D_MAX_D_BY_100)) - { - if (fNumber == 0.0) - { - OutString.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "0%" ) ); - return; - } - fNumber *= 100; - bModified = TRUE; - } - - if (fNumber == 0.0) - { - OutString = '0'; - return; - } - - OutString = ::rtl::math::doubleToUString( fNumber, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - GetFormatter().GetNumDecimalSep().GetChar(0), sal_True ); - - if ( eType & NUMBERFORMAT_PERCENT && bModified) - OutString += '%'; - return; -} - -short SvNumberformat::ImpCheckCondition(double& fNumber, - double& fLimit, - SvNumberformatLimitOps eOp) -{ - switch(eOp) - { - case NUMBERFORMAT_OP_NO: return -1; - case NUMBERFORMAT_OP_EQ: return (short) (fNumber == fLimit); - case NUMBERFORMAT_OP_NE: return (short) (fNumber != fLimit); - case NUMBERFORMAT_OP_LT: return (short) (fNumber < fLimit); - case NUMBERFORMAT_OP_LE: return (short) (fNumber <= fLimit); - case NUMBERFORMAT_OP_GT: return (short) (fNumber > fLimit); - case NUMBERFORMAT_OP_GE: return (short) (fNumber >= fLimit); - default: return -1; - } -} - -BOOL SvNumberformat::GetOutputString(String& sString, - String& OutString, - Color** ppColor) -{ - OutString.Erase(); - USHORT nIx; - if (eType & NUMBERFORMAT_TEXT) - nIx = 0; - else if (NumFor[3].GetnAnz() > 0) - nIx = 3; - else - { - *ppColor = NULL; // no change of color - return FALSE; - } - *ppColor = NumFor[nIx].GetColor(); - const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info(); - if (rInfo.eScannedType == NUMBERFORMAT_TEXT) - { - BOOL bRes = FALSE; - const USHORT nAnz = NumFor[nIx].GetnAnz(); - for (USHORT i = 0; i < nAnz; i++) - { - switch (rInfo.nTypeArray[i]) - { - case NF_SYMBOLTYPE_STAR: - if( bStarFlag ) - { - OutString += (sal_Unicode) 0x1B; - OutString += rInfo.sStrArray[i].GetChar(1); - bRes = TRUE; - } - break; - case NF_SYMBOLTYPE_BLANK: - InsertBlanks( OutString, OutString.Len(), - rInfo.sStrArray[i].GetChar(1) ); - break; - case NF_KEY_GENERAL : // #77026# "General" is the same as "@" - case NF_SYMBOLTYPE_DEL : - OutString += sString; - break; - default: - OutString += rInfo.sStrArray[i]; - } - } - return bRes; - } - return FALSE; -} -/* -void SvNumberformat::GetNextFareyNumber(ULONG nPrec, ULONG x0, ULONG x1, - ULONG y0, ULONG y1, - ULONG& x2,ULONG& y2) -{ - x2 = ((y0+nPrec)/y1)*x1 - x0; - y2 = ((y0+nPrec)/y1)*y1 - y0; -} -*/ -ULONG SvNumberformat::ImpGGT(ULONG x, ULONG y) -{ - if (y == 0) - return x; - else - { - ULONG z = x%y; - while (z) - { - x = y; - y = z; - z = x%y; - } - return y; - } -} - -ULONG SvNumberformat::ImpGGTRound(ULONG x, ULONG y) -{ - if (y == 0) - return x; - else - { - ULONG z = x%y; - while ((double)z/(double)y > D_EPS) - { - x = y; - y = z; - z = x%y; - } - return y; - } -} - -BOOL SvNumberformat::GetOutputString(double fNumber, - String& OutString, - Color** ppColor) -{ - BOOL bRes = FALSE; - OutString.Erase(); // alles loeschen - *ppColor = NULL; // keine Farbaenderung - if (eType & NUMBERFORMAT_LOGICAL) - { - if (fNumber) - OutString = rScan.GetTrueString(); - else - OutString = rScan.GetFalseString(); - return FALSE; - } - if (eType & NUMBERFORMAT_TEXT && bStandard) - { - ImpGetOutputStandard(fNumber, OutString); - return FALSE; - } - BOOL bHadStandard = FALSE; - if (bStandard) // einzelne Standardformate - { - if (rScan.GetStandardPrec() == 300) // alle Zahlformate InputLine - { - ImpGetOutputInputLine(fNumber, OutString); - return FALSE; - } - switch (eType) - { - case NUMBERFORMAT_NUMBER: // Standardzahlformat - ImpGetOutputStandard(fNumber, OutString); - bHadStandard = TRUE; - break; - case NUMBERFORMAT_DATE: - bRes |= ImpGetDateOutput(fNumber, 0, OutString); - bHadStandard = TRUE; - break; - case NUMBERFORMAT_TIME: - bRes |= ImpGetTimeOutput(fNumber, 0, OutString); - bHadStandard = TRUE; - break; - case NUMBERFORMAT_DATETIME: - bRes |= ImpGetDateTimeOutput(fNumber, 0, OutString); - bHadStandard = TRUE; - break; - } - } - if ( !bHadStandard ) - { - USHORT nIx; // Index des Teilformats - short nCheck = ImpCheckCondition(fNumber, fLimit1, eOp1); - if (nCheck == -1 || nCheck == 1) // nur 1 String oder True - nIx = 0; - else - { - nCheck = ImpCheckCondition(fNumber, fLimit2, eOp2); - if (nCheck == -1 || nCheck == 1) - nIx = 1; - else - nIx = 2; - } - if (nIx == 1 && fNumber < 0.0 && // negatives Format - IsNegativeRealNegative() ) // ohne Vorzeichen - fNumber = -fNumber; // Vorzeichen eliminieren - *ppColor = NumFor[nIx].GetColor(); - const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info(); - const USHORT nAnz = NumFor[nIx].GetnAnz(); - if (nAnz == 0 && rInfo.eScannedType == NUMBERFORMAT_UNDEFINED) - return FALSE; // leer => nichts - else if (nAnz == 0) // sonst Standard-Format - { - ImpGetOutputStandard(fNumber, OutString); - return FALSE; - } - switch (rInfo.eScannedType) - { - case NUMBERFORMAT_TEXT: - case NUMBERFORMAT_DEFINED: - { - for (USHORT i = 0; i < nAnz; i++) - { - switch (rInfo.nTypeArray[i]) - { - case NF_SYMBOLTYPE_STAR: - if( bStarFlag ) - { - OutString += (sal_Unicode) 0x1B; - OutString += rInfo.sStrArray[i].GetChar(1); - bRes = TRUE; - } - break; - case NF_SYMBOLTYPE_BLANK: - InsertBlanks( OutString, OutString.Len(), - rInfo.sStrArray[i].GetChar(1) ); - break; - case NF_SYMBOLTYPE_STRING: - case NF_SYMBOLTYPE_CURRENCY: - OutString += rInfo.sStrArray[i]; - break; - case NF_SYMBOLTYPE_THSEP: - if (rInfo.nThousand == 0) - OutString += rInfo.sStrArray[i]; - break; - default: - break; - } - } - } - break; - case NUMBERFORMAT_DATE: - bRes |= ImpGetDateOutput(fNumber, nIx, OutString); - break; - case NUMBERFORMAT_TIME: - bRes |= ImpGetTimeOutput(fNumber, nIx, OutString); - break; - case NUMBERFORMAT_DATETIME: - bRes |= ImpGetDateTimeOutput(fNumber, nIx, OutString); - break; - case NUMBERFORMAT_NUMBER: - case NUMBERFORMAT_PERCENT: - case NUMBERFORMAT_CURRENCY: - bRes |= ImpGetNumberOutput(fNumber, nIx, OutString); - break; - case NUMBERFORMAT_FRACTION: - { - String sStr, sFrac, sDiv; // Strings, Wert fuer - ULONG nFrac, nDiv; // Vorkommaanteil - // Zaehler und Nenner - BOOL bSign = FALSE; - if (fNumber < 0) - { - if (nIx == 0) // nicht in hinteren - bSign = TRUE; // Formaten - fNumber = -fNumber; - } - double fNum = floor(fNumber); // Vorkommateil - fNumber -= fNum; // Nachkommateil - if (fNum > _D_MAX_U_LONG_ || rInfo.nCntExp > 9) - // zu gross - { - OutString = rScan.GetErrorString(); - return FALSE; - } - if (rInfo.nCntExp == 0) - { - DBG_ERROR("SvNumberformat:: Bruch, nCntExp == 0"); - return FALSE; - } - ULONG nBasis = ((ULONG)floor( // 9, 99, 999 ,... - pow(10.0,rInfo.nCntExp))) - 1; - ULONG x0, y0, x1, y1; - - if (rInfo.nCntExp <= _MAX_FRACTION_PREC) - { - BOOL bUpperHalf; - if (fNumber > 0.5) - { - bUpperHalf = TRUE; - fNumber -= (fNumber - 0.5) * 2.0; - } - else - bUpperHalf = FALSE; - // Einstieg in Farey-Serie - // finden: - x0 = (ULONG) floor(fNumber*nBasis); // z.B. 2/9 <= x < 3/9 - if (x0 == 0) // => x0 = 2 - { - y0 = 1; - x1 = 1; - y1 = nBasis; - } - else if (x0 == (nBasis-1)/2) // (b-1)/2, 1/2 - { // geht (nBasis ungerade) - y0 = nBasis; - x1 = 1; - y1 = 2; - } - else if (x0 == 1) - { - y0 = nBasis; // 1/n; 1/(n-1) - x1 = 1; - y1 = nBasis - 1; - } - else - { - y0 = nBasis; // z.B. 2/9 2/8 - x1 = x0; - y1 = nBasis - 1; - double fUg = (double) x0 / (double) y0; - double fOg = (double) x1 / (double) y1; - ULONG nGgt = ImpGGT(y0, x0); // x0/y0 kuerzen - x0 /= nGgt; - y0 /= nGgt; // Einschachteln: - ULONG x2 = 0; - ULONG y2 = 0; - BOOL bStop = FALSE; - while (!bStop) - { -#ifdef GCC - // #i21648# GCC over-optimizes something resulting - // in wrong fTest values throughout the loops. - volatile -#endif - double fTest = (double)x1/(double)y1; - while (!bStop) - { - while (fTest > fOg) - { - x1--; - fTest = (double)x1/(double)y1; - } - while (fTest < fUg && y1 > 1) - { - y1--; - fTest = (double)x1/(double)y1; - } - if (fTest <= fOg) - { - fOg = fTest; - bStop = TRUE; - } - else if (y1 == 1) - bStop = TRUE; - } // of while - nGgt = ImpGGT(y1, x1); // x1/y1 kuerzen - x2 = x1 / nGgt; - y2 = y1 / nGgt; - if (x2*y0 - x0*y2 == 1 || y1 <= 1) // Test, ob x2/y2 - bStop = TRUE; // naechste Farey-Zahl - else - { - y1--; - bStop = FALSE; - } - } // of while - x1 = x2; - y1 = y2; - } // of else - double fup, flow; - flow = (double)x0/(double)y0; - fup = (double)x1/(double)y1; - while (fNumber > fup) - { - ULONG x2 = ((y0+nBasis)/y1)*x1 - x0; // naechste Farey-Zahl - ULONG y2 = ((y0+nBasis)/y1)*y1 - y0; -// GetNextFareyNumber(nBasis, x0, x1, y0, y1, x2, y2); - x0 = x1; - y0 = y1; - x1 = x2; - y1 = y2; - flow = fup; - fup = (double)x1/(double)y1; - } - if (fNumber - flow < fup - fNumber) - { - nFrac = x0; - nDiv = y0; - } - else - { - nFrac = x1; - nDiv = y1; - } - if (bUpperHalf) // Original restaur. - { - if (nFrac == 0 && nDiv == 1) // 1/1 - fNum += 1.0; - else - nFrac = nDiv - nFrac; - } - } - else // grosse Nenner - { // 0,1234->123/1000 - ULONG nGgt; -/* - nDiv = nBasis+1; - nFrac = ((ULONG)floor(0.5 + fNumber * - pow(10.0,rInfo.nCntExp))); -*/ - nDiv = 10000000; - nFrac = ((ULONG)floor(0.5 + fNumber * 10000000.0)); - nGgt = ImpGGT(nDiv, nFrac); - if (nGgt > 1) - { - nDiv /= nGgt; - nFrac /= nGgt; - } - if (nDiv > nBasis) - { - nGgt = ImpGGTRound(nDiv, nFrac); - if (nGgt > 1) - { - nDiv /= nGgt; - nFrac /= nGgt; - } - } - if (nDiv > nBasis) - { - nDiv = nBasis; - nFrac = ((ULONG)floor(0.5 + fNumber * - pow(10.0,rInfo.nCntExp))); - nGgt = ImpGGTRound(nDiv, nFrac); - if (nGgt > 1) - { - nDiv /= nGgt; - nFrac /= nGgt; - } - } - } - - if (rInfo.nCntPre == 0) // unechter Bruch - { - double fNum1 = fNum * (double)nDiv + (double)nFrac; - if (fNum1 > _D_MAX_U_LONG_) - { - OutString = rScan.GetErrorString(); - return FALSE; - } - nFrac = (ULONG) floor(fNum1); - sStr.Erase(); - } - else if (fNum == 0.0 && nFrac != 0) - sStr.Erase(); - else - { - char aBuf[100]; - sprintf( aBuf, "%.f", fNum ); // simple rounded integer (#100211# - checked) - sStr.AssignAscii( aBuf ); - ImpTransliterate( sStr, NumFor[nIx].GetNatNum() ); - } - if (rInfo.nCntPre > 0 && nFrac == 0) - { - sFrac.Erase(); - sDiv.Erase(); - } - else - { - sFrac = ImpIntToString( nIx, nFrac ); - sDiv = ImpIntToString( nIx, nDiv ); - } - - USHORT j = nAnz-1; // letztes Symbol->rueckw. - xub_StrLen k; // Nenner: - bRes |= ImpNumberFill(sDiv, fNumber, k, j, nIx, NF_SYMBOLTYPE_FRAC); - BOOL bCont = TRUE; - if (rInfo.nTypeArray[j] == NF_SYMBOLTYPE_FRAC) - { - if (rInfo.nCntPre > 0 && nFrac == 0) - sDiv.Insert(' ',0); - else - sDiv.Insert( rInfo.sStrArray[j].GetChar(0), 0 ); - if ( j ) - j--; - else - bCont = FALSE; - } - // weiter Zaehler: - if ( !bCont ) - sFrac.Erase(); - else - { - bRes |= ImpNumberFill(sFrac, fNumber, k, j, nIx, NF_SYMBOLTYPE_FRACBLANK); - if (rInfo.nTypeArray[j] == NF_SYMBOLTYPE_FRACBLANK) - { - sFrac.Insert(rInfo.sStrArray[j],0); - if ( j ) - j--; - else - bCont = FALSE; - } - } - // weiter Hauptzahl - if ( !bCont ) - sStr.Erase(); - else - { - k = sStr.Len(); // hinter letzter Ziffer - bRes |= ImpNumberFillWithThousands(sStr, fNumber, k, j, nIx, - rInfo.nCntPre); - } - if (bSign && !(nFrac == 0 && fNum == 0.0)) - OutString.Insert('-',0); // nicht -0 - OutString += sStr; - OutString += sFrac; - OutString += sDiv; - } - break; - case NUMBERFORMAT_SCIENTIFIC: - { - BOOL bSign = FALSE; - if (fNumber < 0) - { - if (nIx == 0) // nicht in hinteren - bSign = TRUE; // Formaten - fNumber = -fNumber; - } - String sStr( ::rtl::math::doubleToUString( fNumber, - rtl_math_StringFormat_E, - rInfo.nCntPre + rInfo.nCntPost - 1, '.' )); - - String ExpStr; - short nExpSign = 1; - xub_StrLen nExPos = sStr.Search('E'); - if ( nExPos != STRING_NOTFOUND ) - { - // split into mantisse and exponent and get rid of "E+" or "E-" - xub_StrLen nExpStart = nExPos + 1; - switch ( sStr.GetChar( nExpStart ) ) - { - case '-' : - nExpSign = -1; - // fallthru - case '+' : - ++nExpStart; - break; - } - ExpStr = sStr.Copy( nExpStart ); // part following the "E+" - sStr.Erase( nExPos ); - sStr.EraseAllChars('.'); // cut any decimal delimiter - if ( rInfo.nCntPre != 1 ) // rescale Exp - { - sal_Int32 nExp = ExpStr.ToInt32() * nExpSign; - nExp -= sal_Int32(rInfo.nCntPre)-1; - if ( nExp < 0 ) - { - nExpSign = -1; - nExp = -nExp; - } - else - nExpSign = 1; - ExpStr = String::CreateFromInt32( nExp ); - } - } - USHORT j = nAnz-1; // last symbol - xub_StrLen k; // position in ExpStr - bRes |= ImpNumberFill(ExpStr, fNumber, k, j, nIx, NF_SYMBOLTYPE_EXP); - - xub_StrLen nZeros = 0; // erase leading zeros - while (nZeros < k && ExpStr.GetChar(nZeros) == '0') - ++nZeros; - if (nZeros) - ExpStr.Erase( 0, nZeros); - - BOOL bCont = TRUE; - if (rInfo.nTypeArray[j] == NF_SYMBOLTYPE_EXP) - { - const String& rStr = rInfo.sStrArray[j]; - if (nExpSign == -1) - ExpStr.Insert('-',0); - else if (rStr.Len() > 1 && rStr.GetChar(1) == '+') - ExpStr.Insert('+',0); - ExpStr.Insert(rStr.GetChar(0),0); - if ( j ) - j--; - else - bCont = FALSE; - } - // weiter Hauptzahl: - if ( !bCont ) - sStr.Erase(); - else - { - k = sStr.Len(); // hinter letzter Ziffer - bRes |= ImpNumberFillWithThousands(sStr,fNumber, k,j,nIx, - rInfo.nCntPre + - rInfo.nCntPost); - } - if (bSign) - sStr.Insert('-',0); - OutString = sStr; - OutString += ExpStr; - } - break; - } - } - return bRes; -} - -BOOL SvNumberformat::ImpGetTimeOutput(double fNumber, - USHORT nIx, - String& OutString) -{ - using namespace ::com::sun::star::i18n; - BOOL bCalendarSet = FALSE; - double fNumberOrig = fNumber; - BOOL bRes = FALSE; - BOOL bSign = FALSE; - if (fNumber < 0.0) - { - fNumber = -fNumber; - if (nIx == 0) - bSign = TRUE; - } - const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info(); - if (rInfo.bThousand) // []-Format - { - if (fNumber > 1.0E10) // zu gross - { - OutString = rScan.GetErrorString(); - return FALSE; - } - } - else - fNumber -= floor(fNumber); // sonst Datum abtrennen - BOOL bInputLine; - xub_StrLen nCntPost; - if ( rScan.GetStandardPrec() == 300 && - 0 < rInfo.nCntPost && rInfo.nCntPost < 7 ) - { // round at 7 decimals (+5 of 86400 == 12 significant digits) - bInputLine = TRUE; - nCntPost = 7; - } - else - { - bInputLine = FALSE; - nCntPost = xub_StrLen(rInfo.nCntPost); - } - if (bSign && !rInfo.bThousand) // kein []-Format - fNumber = 1.0 - fNumber; // "Kehrwert" - double fTime = fNumber * 86400.0; - fTime = ::rtl::math::round( fTime, int(nCntPost) ); - if (bSign && fTime == 0.0) - bSign = FALSE; // nicht -00:00:00 - - if( floor( fTime ) > _D_MAX_U_LONG_ ) - { - OutString = rScan.GetErrorString(); - return FALSE; - } - ULONG nSeconds = (ULONG)floor( fTime ); - - String sSecStr( ::rtl::math::doubleToUString( fTime-nSeconds, - rtl_math_StringFormat_F, int(nCntPost), '.')); - sSecStr.EraseLeadingChars('0'); - sSecStr.EraseLeadingChars('.'); - if ( bInputLine ) - { - sSecStr.EraseTrailingChars('0'); - if ( sSecStr.Len() < xub_StrLen(rInfo.nCntPost) ) - sSecStr.Expand( xub_StrLen(rInfo.nCntPost), '0' ); - ImpTransliterate( sSecStr, NumFor[nIx].GetNatNum() ); - nCntPost = sSecStr.Len(); - } - else - ImpTransliterate( sSecStr, NumFor[nIx].GetNatNum() ); - - xub_StrLen nSecPos = 0; // Zum Ziffernweisen - // abarbeiten - ULONG nHour, nMin, nSec; - if (!rInfo.bThousand) // kein [] Format - { - nHour = (nSeconds/3600) % 24; - nMin = (nSeconds%3600) / 60; - nSec = nSeconds%60; - } - else if (rInfo.nThousand == 3) // [ss] - { - nHour = 0; - nMin = 0; - nSec = nSeconds; - } - else if (rInfo.nThousand == 2) // [mm]:ss - { - nHour = 0; - nMin = nSeconds / 60; - nSec = nSeconds % 60; - } - else if (rInfo.nThousand == 1) // [hh]:mm:ss - { - nHour = nSeconds / 3600; - nMin = (nSeconds%3600) / 60; - nSec = nSeconds%60; - } - else { - // TODO What should these be set to? - nHour = 0; - nMin = 0; - nSec = 0; - } - - sal_Unicode cAmPm = ' '; // a oder p - if (rInfo.nCntExp) // AM/PM - { - if (nHour == 0) - { - nHour = 12; - cAmPm = 'a'; - } - else if (nHour < 12) - cAmPm = 'a'; - else - { - cAmPm = 'p'; - if (nHour > 12) - nHour -= 12; - } - } - const USHORT nAnz = NumFor[nIx].GetnAnz(); - for (USHORT i = 0; i < nAnz; i++) - { - switch (rInfo.nTypeArray[i]) - { - case NF_SYMBOLTYPE_STAR: - if( bStarFlag ) - { - OutString += (sal_Unicode) 0x1B; - OutString += rInfo.sStrArray[i].GetChar(1); - bRes = TRUE; - } - break; - case NF_SYMBOLTYPE_BLANK: - InsertBlanks( OutString, OutString.Len(), - rInfo.sStrArray[i].GetChar(1) ); - break; - case NF_SYMBOLTYPE_STRING: - case NF_SYMBOLTYPE_CURRENCY: - case NF_SYMBOLTYPE_DATESEP: - case NF_SYMBOLTYPE_TIMESEP: - case NF_SYMBOLTYPE_TIME100SECSEP: - OutString += rInfo.sStrArray[i]; - break; - case NF_SYMBOLTYPE_DIGIT: - { - xub_StrLen nLen = ( bInputLine && i > 0 && - (rInfo.nTypeArray[i-1] == NF_SYMBOLTYPE_STRING || - rInfo.nTypeArray[i-1] == NF_SYMBOLTYPE_TIME100SECSEP) ? - nCntPost : rInfo.sStrArray[i].Len() ); - for (xub_StrLen j = 0; j < nLen && nSecPos < nCntPost; j++) - { - OutString += sSecStr.GetChar(nSecPos); - nSecPos++; - } - } - break; - case NF_KEY_AMPM: // AM/PM - { - if ( !bCalendarSet ) - { - double fDiff = DateTime(*(rScan.GetNullDate())) - GetCal().getEpochStart(); - fDiff += fNumberOrig; - GetCal().setLocalDateTime( fDiff ); - bCalendarSet = TRUE; - } - if (cAmPm == 'a') - OutString += GetCal().getDisplayName( - CalendarDisplayIndex::AM_PM, AmPmValue::AM, 0 ); - else - OutString += GetCal().getDisplayName( - CalendarDisplayIndex::AM_PM, AmPmValue::PM, 0 ); - } - break; - case NF_KEY_AP: // A/P - { - if (cAmPm == 'a') - OutString += 'a'; - else - OutString += 'p'; - } - break; - case NF_KEY_MI: // M - OutString += ImpIntToString( nIx, nMin ); - break; - case NF_KEY_MMI: // MM - OutString += ImpIntToString( nIx, nMin, 2 ); - break; - case NF_KEY_H: // H - OutString += ImpIntToString( nIx, nHour ); - break; - case NF_KEY_HH: // HH - OutString += ImpIntToString( nIx, nHour, 2 ); - break; - case NF_KEY_S: // S - OutString += ImpIntToString( nIx, nSec ); - break; - case NF_KEY_SS: // SS - OutString += ImpIntToString( nIx, nSec, 2 ); - break; - default: - break; - } - } - if (bSign && rInfo.bThousand) - OutString.Insert('-',0); - return bRes; -} - - -BOOL SvNumberformat::ImpIsOtherCalendar( const ImpSvNumFor& rNumFor ) const -{ - if ( GetCal().getUniqueID() != Gregorian::get() ) - return FALSE; - const ImpSvNumberformatInfo& rInfo = rNumFor.Info(); - const USHORT nAnz = rNumFor.GetnAnz(); - USHORT i; - for ( i = 0; i < nAnz; i++ ) - { - switch ( rInfo.nTypeArray[i] ) - { - case NF_SYMBOLTYPE_CALENDAR : - return FALSE; - case NF_KEY_EC : - case NF_KEY_EEC : - case NF_KEY_R : - case NF_KEY_RR : - case NF_KEY_AAA : - case NF_KEY_AAAA : - return TRUE; - } - } - return FALSE; -} - - -void SvNumberformat::SwitchToOtherCalendar( String& rOrgCalendar, - double& fOrgDateTime ) const -{ - CalendarWrapper& rCal = GetCal(); - const rtl::OUString &rGregorian = Gregorian::get(); - if ( rCal.getUniqueID() == rGregorian ) - { - using namespace ::com::sun::star::i18n; - ::com::sun::star::uno::Sequence< ::rtl::OUString > xCals - = rCal.getAllCalendars( rLoc().getLocale() ); - sal_Int32 nCnt = xCals.getLength(); - if ( nCnt > 1 ) - { - for ( sal_Int32 j=0; j < nCnt; j++ ) - { - if ( xCals[j] != rGregorian ) - { - if ( !rOrgCalendar.Len() ) - { - rOrgCalendar = rCal.getUniqueID(); - fOrgDateTime = rCal.getDateTime(); - } - rCal.loadCalendar( xCals[j], rLoc().getLocale() ); - rCal.setDateTime( fOrgDateTime ); - break; // for - } - } - } - } -} - - -void SvNumberformat::SwitchToGregorianCalendar( const String& rOrgCalendar, - double fOrgDateTime ) const -{ - CalendarWrapper& rCal = GetCal(); - const rtl::OUString &rGregorian = Gregorian::get(); - if ( rOrgCalendar.Len() && rCal.getUniqueID() != rGregorian ) - { - rCal.loadCalendar( rGregorian, rLoc().getLocale() ); - rCal.setDateTime( fOrgDateTime ); - } -} - - -BOOL SvNumberformat::ImpFallBackToGregorianCalendar( String& rOrgCalendar, double& fOrgDateTime ) -{ - using namespace ::com::sun::star::i18n; - CalendarWrapper& rCal = GetCal(); - const rtl::OUString &rGregorian = Gregorian::get(); - if ( rCal.getUniqueID() != rGregorian ) - { - sal_Int16 nVal = rCal.getValue( CalendarFieldIndex::ERA ); - if ( nVal == 0 && rCal.getLoadedCalendar().Eras[0].ID.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM( "Dummy" ) ) ) - { - if ( !rOrgCalendar.Len() ) - { - rOrgCalendar = rCal.getUniqueID(); - fOrgDateTime = rCal.getDateTime(); - } - else if ( rOrgCalendar == String(rGregorian) ) - rOrgCalendar.Erase(); - rCal.loadCalendar( rGregorian, rLoc().getLocale() ); - rCal.setDateTime( fOrgDateTime ); - return TRUE; - } - } - return FALSE; -} - - -BOOL SvNumberformat::ImpSwitchToSpecifiedCalendar( String& rOrgCalendar, - double& fOrgDateTime, const ImpSvNumFor& rNumFor ) const -{ - const ImpSvNumberformatInfo& rInfo = rNumFor.Info(); - const USHORT nAnz = rNumFor.GetnAnz(); - for ( USHORT i = 0; i < nAnz; i++ ) - { - if ( rInfo.nTypeArray[i] == NF_SYMBOLTYPE_CALENDAR ) - { - CalendarWrapper& rCal = GetCal(); - if ( !rOrgCalendar.Len() ) - { - rOrgCalendar = rCal.getUniqueID(); - fOrgDateTime = rCal.getDateTime(); - } - rCal.loadCalendar( rInfo.sStrArray[i], rLoc().getLocale() ); - rCal.setDateTime( fOrgDateTime ); - return TRUE; - } - } - return FALSE; -} - - -// static -void SvNumberformat::ImpAppendEraG( String& OutString, - const CalendarWrapper& rCal, sal_Int16 nNatNum ) -{ - using namespace ::com::sun::star::i18n; - if ( rCal.getUniqueID().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "gengou" ) ) ) - { - sal_Unicode cEra; - sal_Int16 nVal = rCal.getValue( CalendarFieldIndex::ERA ); - switch ( nVal ) - { - case 1 : cEra = 'M'; break; - case 2 : cEra = 'T'; break; - case 3 : cEra = 'S'; break; - case 4 : cEra = 'H'; break; - default: - cEra = '?'; - } - OutString += cEra; - } - else - OutString += rCal.getDisplayString( CalendarDisplayCode::SHORT_ERA, nNatNum ); -} - - -BOOL SvNumberformat::ImpGetDateOutput(double fNumber, - USHORT nIx, - String& OutString) -{ - using namespace ::com::sun::star::i18n; - BOOL bRes = FALSE; - CalendarWrapper& rCal = GetCal(); - double fDiff = DateTime(*(rScan.GetNullDate())) - rCal.getEpochStart(); - fNumber += fDiff; - rCal.setLocalDateTime( fNumber ); - String aOrgCalendar; // empty => not changed yet - double fOrgDateTime; - BOOL bOtherCalendar = ImpIsOtherCalendar( NumFor[nIx] ); - if ( bOtherCalendar ) - SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); - if ( ImpFallBackToGregorianCalendar( aOrgCalendar, fOrgDateTime ) ) - bOtherCalendar = FALSE; - const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info(); - const USHORT nAnz = NumFor[nIx].GetnAnz(); - sal_Int16 nNatNum = NumFor[nIx].GetNatNum().GetNatNum(); - for (USHORT i = 0; i < nAnz; i++) - { - switch (rInfo.nTypeArray[i]) - { - case NF_SYMBOLTYPE_CALENDAR : - if ( !aOrgCalendar.Len() ) - { - aOrgCalendar = rCal.getUniqueID(); - fOrgDateTime = rCal.getDateTime(); - } - rCal.loadCalendar( rInfo.sStrArray[i], rLoc().getLocale() ); - rCal.setDateTime( fOrgDateTime ); - ImpFallBackToGregorianCalendar( aOrgCalendar, fOrgDateTime ); - break; - case NF_SYMBOLTYPE_STAR: - if( bStarFlag ) - { - OutString += (sal_Unicode) 0x1B; - OutString += rInfo.sStrArray[i].GetChar(1); - bRes = TRUE; - } - break; - case NF_SYMBOLTYPE_BLANK: - InsertBlanks( OutString, OutString.Len(), - rInfo.sStrArray[i].GetChar(1) ); - break; - case NF_SYMBOLTYPE_STRING: - case NF_SYMBOLTYPE_CURRENCY: - case NF_SYMBOLTYPE_DATESEP: - case NF_SYMBOLTYPE_TIMESEP: - case NF_SYMBOLTYPE_TIME100SECSEP: - OutString += rInfo.sStrArray[i]; - break; - case NF_KEY_M: // M - OutString += rCal.getDisplayString( - CalendarDisplayCode::SHORT_MONTH, nNatNum ); - break; - case NF_KEY_MM: // MM - OutString += rCal.getDisplayString( - CalendarDisplayCode::LONG_MONTH, nNatNum ); - break; - case NF_KEY_MMM: // MMM - OutString += rCal.getDisplayString( - CalendarDisplayCode::SHORT_MONTH_NAME, nNatNum ); - break; - case NF_KEY_MMMM: // MMMM - OutString += rCal.getDisplayString( - CalendarDisplayCode::LONG_MONTH_NAME, nNatNum ); - break; - case NF_KEY_MMMMM: // MMMMM - OutString += rCal.getDisplayString( - CalendarDisplayCode::LONG_MONTH_NAME, nNatNum ).GetChar(0); - break; - case NF_KEY_Q: // Q - OutString += rCal.getDisplayString( - CalendarDisplayCode::SHORT_QUARTER, nNatNum ); - break; - case NF_KEY_QQ: // QQ - OutString += rCal.getDisplayString( - CalendarDisplayCode::LONG_QUARTER, nNatNum ); - break; - case NF_KEY_D: // D - OutString += rCal.getDisplayString( - CalendarDisplayCode::SHORT_DAY, nNatNum ); - break; - case NF_KEY_DD: // DD - OutString += rCal.getDisplayString( - CalendarDisplayCode::LONG_DAY, nNatNum ); - break; - case NF_KEY_DDD: // DDD - { - if ( bOtherCalendar ) - SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime ); - OutString += rCal.getDisplayString( - CalendarDisplayCode::SHORT_DAY_NAME, nNatNum ); - if ( bOtherCalendar ) - SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); - } - break; - case NF_KEY_DDDD: // DDDD - { - if ( bOtherCalendar ) - SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime ); - OutString += rCal.getDisplayString( - CalendarDisplayCode::LONG_DAY_NAME, nNatNum ); - if ( bOtherCalendar ) - SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); - } - break; - case NF_KEY_YY: // YY - { - if ( bOtherCalendar ) - SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime ); - OutString += rCal.getDisplayString( - CalendarDisplayCode::SHORT_YEAR, nNatNum ); - if ( bOtherCalendar ) - SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); - } - break; - case NF_KEY_YYYY: // YYYY - { - if ( bOtherCalendar ) - SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime ); - OutString += rCal.getDisplayString( - CalendarDisplayCode::LONG_YEAR, nNatNum ); - if ( bOtherCalendar ) - SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); - } - break; - case NF_KEY_EC: // E - OutString += rCal.getDisplayString( - CalendarDisplayCode::SHORT_YEAR, nNatNum ); - break; - case NF_KEY_EEC: // EE - case NF_KEY_R: // R - OutString += rCal.getDisplayString( - CalendarDisplayCode::LONG_YEAR, nNatNum ); - break; - case NF_KEY_NN: // NN - case NF_KEY_AAA: // AAA - OutString += rCal.getDisplayString( - CalendarDisplayCode::SHORT_DAY_NAME, nNatNum ); - break; - case NF_KEY_NNN: // NNN - case NF_KEY_AAAA: // AAAA - OutString += rCal.getDisplayString( - CalendarDisplayCode::LONG_DAY_NAME, nNatNum ); - break; - case NF_KEY_NNNN: // NNNN - { - OutString += rCal.getDisplayString( - CalendarDisplayCode::LONG_DAY_NAME, nNatNum ); - OutString += rLoc().getLongDateDayOfWeekSep(); - } - break; - case NF_KEY_WW : // WW - { - sal_Int16 nVal = rCal.getValue( CalendarFieldIndex::WEEK_OF_YEAR ); - OutString += ImpIntToString( nIx, nVal ); - } - break; - case NF_KEY_G: // G - ImpAppendEraG( OutString, rCal, nNatNum ); - break; - case NF_KEY_GG: // GG - OutString += rCal.getDisplayString( - CalendarDisplayCode::SHORT_ERA, nNatNum ); - break; - case NF_KEY_GGG: // GGG - OutString += rCal.getDisplayString( - CalendarDisplayCode::LONG_ERA, nNatNum ); - break; - case NF_KEY_RR: // RR => GGGEE - OutString += rCal.getDisplayString( - CalendarDisplayCode::LONG_YEAR_AND_ERA, nNatNum ); - break; - } - } - if ( aOrgCalendar.Len() ) - rCal.loadCalendar( aOrgCalendar, rLoc().getLocale() ); // restore calendar - return bRes; -} - -BOOL SvNumberformat::ImpGetDateTimeOutput(double fNumber, - USHORT nIx, - String& OutString) -{ - using namespace ::com::sun::star::i18n; - BOOL bRes = FALSE; - - CalendarWrapper& rCal = GetCal(); - double fDiff = DateTime(*(rScan.GetNullDate())) - rCal.getEpochStart(); - fNumber += fDiff; - - const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info(); - BOOL bInputLine; - xub_StrLen nCntPost; - if ( rScan.GetStandardPrec() == 300 && - 0 < rInfo.nCntPost && rInfo.nCntPost < 7 ) - { // round at 7 decimals (+5 of 86400 == 12 significant digits) - bInputLine = TRUE; - nCntPost = 7; - } - else - { - bInputLine = FALSE; - nCntPost = xub_StrLen(rInfo.nCntPost); - } - double fTime = (fNumber - floor( fNumber )) * 86400.0; - fTime = ::rtl::math::round( fTime, int(nCntPost) ); - if (fTime >= 86400.0) - { - // result of fNumber==x.999999999... rounded up, use correct date/time - fTime -= 86400.0; - fNumber = floor( fNumber + 0.5) + fTime; - } - rCal.setLocalDateTime( fNumber ); - - String aOrgCalendar; // empty => not changed yet - double fOrgDateTime; - BOOL bOtherCalendar = ImpIsOtherCalendar( NumFor[nIx] ); - if ( bOtherCalendar ) - SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); - if ( ImpFallBackToGregorianCalendar( aOrgCalendar, fOrgDateTime ) ) - bOtherCalendar = FALSE; - sal_Int16 nNatNum = NumFor[nIx].GetNatNum().GetNatNum(); - - ULONG nSeconds = (ULONG)floor( fTime ); - String sSecStr( ::rtl::math::doubleToUString( fTime-nSeconds, - rtl_math_StringFormat_F, int(nCntPost), '.')); - sSecStr.EraseLeadingChars('0'); - sSecStr.EraseLeadingChars('.'); - if ( bInputLine ) - { - sSecStr.EraseTrailingChars('0'); - if ( sSecStr.Len() < xub_StrLen(rInfo.nCntPost) ) - sSecStr.Expand( xub_StrLen(rInfo.nCntPost), '0' ); - ImpTransliterate( sSecStr, NumFor[nIx].GetNatNum() ); - nCntPost = sSecStr.Len(); - } - else - ImpTransliterate( sSecStr, NumFor[nIx].GetNatNum() ); - - xub_StrLen nSecPos = 0; // Zum Ziffernweisen - // abarbeiten - ULONG nHour, nMin, nSec; - if (!rInfo.bThousand) // [] Format - { - nHour = (nSeconds/3600) % 24; - nMin = (nSeconds%3600) / 60; - nSec = nSeconds%60; - } - else if (rInfo.nThousand == 3) // [ss] - { - nHour = 0; - nMin = 0; - nSec = nSeconds; - } - else if (rInfo.nThousand == 2) // [mm]:ss - { - nHour = 0; - nMin = nSeconds / 60; - nSec = nSeconds % 60; - } - else if (rInfo.nThousand == 1) // [hh]:mm:ss - { - nHour = nSeconds / 3600; - nMin = (nSeconds%3600) / 60; - nSec = nSeconds%60; - } - else { - nHour = 0; // TODO What should these values be? - nMin = 0; - nSec = 0; - } - sal_Unicode cAmPm = ' '; // a oder p - if (rInfo.nCntExp) // AM/PM - { - if (nHour == 0) - { - nHour = 12; - cAmPm = 'a'; - } - else if (nHour < 12) - cAmPm = 'a'; - else - { - cAmPm = 'p'; - if (nHour > 12) - nHour -= 12; - } - } - const USHORT nAnz = NumFor[nIx].GetnAnz(); - for (USHORT i = 0; i < nAnz; i++) - { - switch (rInfo.nTypeArray[i]) - { - case NF_SYMBOLTYPE_CALENDAR : - if ( !aOrgCalendar.Len() ) - { - aOrgCalendar = rCal.getUniqueID(); - fOrgDateTime = rCal.getDateTime(); - } - rCal.loadCalendar( rInfo.sStrArray[i], rLoc().getLocale() ); - rCal.setDateTime( fOrgDateTime ); - ImpFallBackToGregorianCalendar( aOrgCalendar, fOrgDateTime ); - break; - case NF_SYMBOLTYPE_STAR: - if( bStarFlag ) - { - OutString += (sal_Unicode) 0x1B; - OutString += rInfo.sStrArray[i].GetChar(1); - bRes = TRUE; - } - break; - case NF_SYMBOLTYPE_BLANK: - InsertBlanks( OutString, OutString.Len(), - rInfo.sStrArray[i].GetChar(1) ); - break; - case NF_SYMBOLTYPE_STRING: - case NF_SYMBOLTYPE_CURRENCY: - case NF_SYMBOLTYPE_DATESEP: - case NF_SYMBOLTYPE_TIMESEP: - case NF_SYMBOLTYPE_TIME100SECSEP: - OutString += rInfo.sStrArray[i]; - break; - case NF_SYMBOLTYPE_DIGIT: - { - xub_StrLen nLen = ( bInputLine && i > 0 && - (rInfo.nTypeArray[i-1] == NF_SYMBOLTYPE_STRING || - rInfo.nTypeArray[i-1] == NF_SYMBOLTYPE_TIME100SECSEP) ? - nCntPost : rInfo.sStrArray[i].Len() ); - for (xub_StrLen j = 0; j < nLen && nSecPos < nCntPost; j++) - { - OutString += sSecStr.GetChar(nSecPos); - nSecPos++; - } - } - break; - case NF_KEY_AMPM: // AM/PM - { - if (cAmPm == 'a') - OutString += rCal.getDisplayName( CalendarDisplayIndex::AM_PM, - AmPmValue::AM, 0 ); - else - OutString += rCal.getDisplayName( CalendarDisplayIndex::AM_PM, - AmPmValue::PM, 0 ); - } - break; - case NF_KEY_AP: // A/P - { - if (cAmPm == 'a') - OutString += 'a'; - else - OutString += 'p'; - } - break; - case NF_KEY_MI: // M - OutString += ImpIntToString( nIx, nMin ); - break; - case NF_KEY_MMI: // MM - OutString += ImpIntToString( nIx, nMin, 2 ); - break; - case NF_KEY_H: // H - OutString += ImpIntToString( nIx, nHour ); - break; - case NF_KEY_HH: // HH - OutString += ImpIntToString( nIx, nHour, 2 ); - break; - case NF_KEY_S: // S - OutString += ImpIntToString( nIx, nSec ); - break; - case NF_KEY_SS: // SS - OutString += ImpIntToString( nIx, nSec, 2 ); - break; - case NF_KEY_M: // M - OutString += rCal.getDisplayString( - CalendarDisplayCode::SHORT_MONTH, nNatNum ); - break; - case NF_KEY_MM: // MM - OutString += rCal.getDisplayString( - CalendarDisplayCode::LONG_MONTH, nNatNum ); - break; - case NF_KEY_MMM: // MMM - OutString += rCal.getDisplayString( - CalendarDisplayCode::SHORT_MONTH_NAME, nNatNum ); - break; - case NF_KEY_MMMM: // MMMM - OutString += rCal.getDisplayString( - CalendarDisplayCode::LONG_MONTH_NAME, nNatNum ); - break; - case NF_KEY_MMMMM: // MMMMM - OutString += rCal.getDisplayString( - CalendarDisplayCode::LONG_MONTH_NAME, nNatNum ).GetChar(0); - break; - case NF_KEY_Q: // Q - OutString += rCal.getDisplayString( - CalendarDisplayCode::SHORT_QUARTER, nNatNum ); - break; - case NF_KEY_QQ: // QQ - OutString += rCal.getDisplayString( - CalendarDisplayCode::LONG_QUARTER, nNatNum ); - break; - case NF_KEY_D: // D - OutString += rCal.getDisplayString( - CalendarDisplayCode::SHORT_DAY, nNatNum ); - break; - case NF_KEY_DD: // DD - OutString += rCal.getDisplayString( - CalendarDisplayCode::LONG_DAY, nNatNum ); - break; - case NF_KEY_DDD: // DDD - { - if ( bOtherCalendar ) - SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime ); - OutString += rCal.getDisplayString( - CalendarDisplayCode::SHORT_DAY_NAME, nNatNum ); - if ( bOtherCalendar ) - SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); - } - break; - case NF_KEY_DDDD: // DDDD - { - if ( bOtherCalendar ) - SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime ); - OutString += rCal.getDisplayString( - CalendarDisplayCode::LONG_DAY_NAME, nNatNum ); - if ( bOtherCalendar ) - SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); - } - break; - case NF_KEY_YY: // YY - { - if ( bOtherCalendar ) - SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime ); - OutString += rCal.getDisplayString( - CalendarDisplayCode::SHORT_YEAR, nNatNum ); - if ( bOtherCalendar ) - SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); - } - break; - case NF_KEY_YYYY: // YYYY - { - if ( bOtherCalendar ) - SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime ); - OutString += rCal.getDisplayString( - CalendarDisplayCode::LONG_YEAR, nNatNum ); - if ( bOtherCalendar ) - SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime ); - } - break; - case NF_KEY_EC: // E - OutString += rCal.getDisplayString( - CalendarDisplayCode::SHORT_YEAR, nNatNum ); - break; - case NF_KEY_EEC: // EE - case NF_KEY_R: // R - OutString += rCal.getDisplayString( - CalendarDisplayCode::LONG_YEAR, nNatNum ); - break; - case NF_KEY_NN: // NN - case NF_KEY_AAA: // AAA - OutString += rCal.getDisplayString( - CalendarDisplayCode::SHORT_DAY_NAME, nNatNum ); - break; - case NF_KEY_NNN: // NNN - case NF_KEY_AAAA: // AAAA - OutString += rCal.getDisplayString( - CalendarDisplayCode::LONG_DAY_NAME, nNatNum ); - break; - case NF_KEY_NNNN: // NNNN - { - OutString += rCal.getDisplayString( - CalendarDisplayCode::LONG_DAY_NAME, nNatNum ); - OutString += rLoc().getLongDateDayOfWeekSep(); - } - break; - case NF_KEY_WW : // WW - { - sal_Int16 nVal = rCal.getValue( CalendarFieldIndex::WEEK_OF_YEAR ); - OutString += ImpIntToString( nIx, nVal ); - } - break; - case NF_KEY_G: // G - ImpAppendEraG( OutString, rCal, nNatNum ); - break; - case NF_KEY_GG: // GG - OutString += rCal.getDisplayString( - CalendarDisplayCode::SHORT_ERA, nNatNum ); - break; - case NF_KEY_GGG: // GGG - OutString += rCal.getDisplayString( - CalendarDisplayCode::LONG_ERA, nNatNum ); - break; - case NF_KEY_RR: // RR => GGGEE - OutString += rCal.getDisplayString( - CalendarDisplayCode::LONG_YEAR_AND_ERA, nNatNum ); - break; - } - } - if ( aOrgCalendar.Len() ) - rCal.loadCalendar( aOrgCalendar, rLoc().getLocale() ); // restore calendar - return bRes; -} - -BOOL SvNumberformat::ImpGetNumberOutput(double fNumber, - USHORT nIx, - String& OutString) -{ - BOOL bRes = FALSE; - BOOL bSign; - if (fNumber < 0.0) - { - if (nIx == 0) // nicht in hinteren - bSign = TRUE; // Formaten - else - bSign = FALSE; - fNumber = -fNumber; - } - else - { - bSign = FALSE; - if ( ::rtl::math::isSignBitSet( fNumber ) ) - fNumber = -fNumber; // yes, -0.0 is possible, eliminate '-' - } - const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info(); - if (rInfo.eScannedType == NUMBERFORMAT_PERCENT) - { - if (fNumber < _D_MAX_D_BY_100) - fNumber *= 100.0; - else - { - OutString = rScan.GetErrorString(); - return FALSE; - } - } - USHORT i, j; - xub_StrLen k; - String sStr; - long nPrecExp; - BOOL bInteger = FALSE; - if ( rInfo.nThousand != FLAG_STANDARD_IN_FORMAT ) - { // special formatting only if no GENERAL keyword in format code - const USHORT nThousand = rInfo.nThousand; - for (i = 0; i < nThousand; i++) - { - if (fNumber > _D_MIN_M_BY_1000) - fNumber /= 1000.0; - else - fNumber = 0.0; - } - if (fNumber > 0.0) - nPrecExp = GetPrecExp( fNumber ); - else - nPrecExp = 0; - if (rInfo.nCntPost) // NachkommaStellen - { - if (rInfo.nCntPost + nPrecExp > 15 && nPrecExp < 15) - { - sStr = ::rtl::math::doubleToUString( fNumber, - rtl_math_StringFormat_F, 15-nPrecExp, '.'); - for (long l = 15-nPrecExp; l < (long) rInfo.nCntPost; l++) - sStr += '0'; - } - else - sStr = ::rtl::math::doubleToUString( fNumber, - rtl_math_StringFormat_F, rInfo.nCntPost, '.' ); - sStr.EraseLeadingChars('0'); // fuehrende Nullen weg - } - else if (fNumber == 0.0) // Null - { - // nothing to be done here, keep empty string sStr, - // ImpNumberFillWithThousands does the rest - } - else // Integer - { - sStr = ::rtl::math::doubleToUString( fNumber, - rtl_math_StringFormat_F, 0, '.'); - sStr.EraseLeadingChars('0'); // fuehrende Nullen weg - } - xub_StrLen nPoint = sStr.Search( '.' ); - if ( nPoint != STRING_NOTFOUND ) - { - register const sal_Unicode* p = sStr.GetBuffer() + nPoint; - while ( *++p == '0' ) - ; - if ( !*p ) - bInteger = TRUE; - sStr.Erase( nPoint, 1 ); // . herausnehmen - } - if (bSign && - (sStr.Len() == 0 || sStr.GetTokenCount('0') == sStr.Len()+1)) // nur 00000 - bSign = FALSE; // nicht -0.00 - } // End of != FLAG_STANDARD_IN_FORMAT - - // von hinten nach vorn - // editieren: - k = sStr.Len(); // hinter letzter Ziffer - j = NumFor[nIx].GetnAnz()-1; // letztes Symbol - // Nachkommastellen: - if (rInfo.nCntPost > 0) - { - BOOL bTrailing = TRUE; // ob Endnullen? - BOOL bFilled = FALSE; // ob aufgefuellt wurde ? - short nType; - while (j > 0 && // rueckwaerts - (nType = rInfo.nTypeArray[j]) != NF_SYMBOLTYPE_DECSEP) - { - switch ( nType ) - { - case NF_SYMBOLTYPE_STAR: - if( bStarFlag ) - { - sStr.Insert( (sal_Unicode) 0x1B, k /*++*/ ); - sStr.Insert(rInfo.sStrArray[j].GetChar(1),k); - bRes = TRUE; - } - break; - case NF_SYMBOLTYPE_BLANK: - /*k = */ InsertBlanks( sStr,k,rInfo.sStrArray[j].GetChar(1) ); - break; - case NF_SYMBOLTYPE_STRING: - case NF_SYMBOLTYPE_CURRENCY: - case NF_SYMBOLTYPE_PERCENT: - sStr.Insert(rInfo.sStrArray[j],k); - break; - case NF_SYMBOLTYPE_THSEP: - if (rInfo.nThousand == 0) - sStr.Insert(rInfo.sStrArray[j],k); - break; - case NF_SYMBOLTYPE_DIGIT: - { - const String& rStr = rInfo.sStrArray[j]; - const sal_Unicode* p1 = rStr.GetBuffer(); - register const sal_Unicode* p = p1 + rStr.Len(); - while ( p1 < p-- ) - { - const sal_Unicode c = *p; - k--; - if ( sStr.GetChar(k) != '0' ) - bTrailing = FALSE; - if (bTrailing) - { - if ( c == '0' ) - bFilled = TRUE; - else if ( c == '-' ) - { - if ( bInteger ) - sStr.SetChar( k, '-' ); - bFilled = TRUE; - } - else if ( c == '?' ) - { - sStr.SetChar( k, ' ' ); - bFilled = TRUE; - } - else if ( !bFilled ) // # - sStr.Erase(k,1); - } - } // of for - } // of case digi - break; - case NF_KEY_CCC: // CCC-Waehrung - sStr.Insert(rScan.GetCurAbbrev(), k); - break; - case NF_KEY_GENERAL: // Standard im String - { - String sNum; - ImpGetOutputStandard(fNumber, sNum); - sNum.EraseLeadingChars('-'); - sStr.Insert(sNum, k); - } - break; - default: - break; - } // of switch - j--; - } // of while - } // of Nachkomma - - bRes |= ImpNumberFillWithThousands(sStr, fNumber, k, j, nIx, // ggfs Auffuellen mit . - rInfo.nCntPre); - if ( rInfo.nCntPost > 0 ) - { - const String& rDecSep = GetFormatter().GetNumDecimalSep(); - xub_StrLen nLen = rDecSep.Len(); - if ( sStr.Len() > nLen && sStr.Equals( rDecSep, sStr.Len() - nLen, nLen ) ) - sStr.Erase( sStr.Len() - nLen ); // no decimals => strip DecSep - } - if (bSign) - sStr.Insert('-',0); - ImpTransliterate( sStr, NumFor[nIx].GetNatNum() ); - OutString = sStr; - return bRes; -} - -BOOL SvNumberformat::ImpNumberFillWithThousands( - String& sStr, // number string - double& rNumber, // number - xub_StrLen k, // position within string - USHORT j, // symbol index within format code - USHORT nIx, // subformat index - USHORT nDigCnt) // count of integer digits in format -{ - BOOL bRes = FALSE; - xub_StrLen nLeadingStringChars = 0; // inserted StringChars before number - xub_StrLen nDigitCount = 0; // count of integer digits from the right - BOOL bStop = FALSE; - const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info(); - // no normal thousands separators if number divided by thousands - BOOL bDoThousands = (rInfo.nThousand == 0); - utl::DigitGroupingIterator aGrouping( - GetFormatter().GetLocaleData()->getDigitGrouping()); - while (!bStop) // backwards - { - if (j == 0) - bStop = TRUE; - switch (rInfo.nTypeArray[j]) - { - case NF_SYMBOLTYPE_DECSEP: - aGrouping.reset(); - // fall thru - case NF_SYMBOLTYPE_STRING: - case NF_SYMBOLTYPE_CURRENCY: - case NF_SYMBOLTYPE_PERCENT: - sStr.Insert(rInfo.sStrArray[j],k); - if ( k == 0 ) - nLeadingStringChars = - nLeadingStringChars + rInfo.sStrArray[j].Len(); - break; - case NF_SYMBOLTYPE_STAR: - if( bStarFlag ) - { - sStr.Insert( (sal_Unicode) 0x1B, k/*++*/ ); - sStr.Insert(rInfo.sStrArray[j].GetChar(1),k); - bRes = TRUE; - } - break; - case NF_SYMBOLTYPE_BLANK: - /*k = */ InsertBlanks( sStr,k,rInfo.sStrArray[j].GetChar(1) ); - break; - case NF_SYMBOLTYPE_THSEP: - { - // #i7284# #102685# Insert separator also if number is divided - // by thousands and the separator is specified somewhere in - // between and not only at the end. - // #i12596# But do not insert if it's a parenthesized negative - // format like (#,) - // In fact, do not insert if divided and regex [0#,],[^0#] and - // no other digit symbol follows (which was already detected - // during scan of format code, otherwise there would be no - // division), else do insert. Same in ImpNumberFill() below. - if ( !bDoThousands && j < NumFor[nIx].GetnAnz()-1 ) - bDoThousands = ((j == 0) || - (rInfo.nTypeArray[j-1] != NF_SYMBOLTYPE_DIGIT && - rInfo.nTypeArray[j-1] != NF_SYMBOLTYPE_THSEP) || - (rInfo.nTypeArray[j+1] == NF_SYMBOLTYPE_DIGIT)); - if ( bDoThousands ) - { - if (k > 0) - sStr.Insert(rInfo.sStrArray[j],k); - else if (nDigitCount < nDigCnt) - { - // Leading '#' displays nothing (e.g. no leading - // separator for numbers <1000 with #,##0 format). - // Leading '?' displays blank. - // Everything else, including nothing, displays the - // separator. - sal_Unicode cLeader = 0; - if (j > 0 && rInfo.nTypeArray[j-1] == NF_SYMBOLTYPE_DIGIT) - { - const String& rStr = rInfo.sStrArray[j-1]; - xub_StrLen nLen = rStr.Len(); - if (nLen) - cLeader = rStr.GetChar(nLen-1); - } - switch (cLeader) - { - case '#': - ; // nothing - break; - case '?': - // erAck: 2008-04-03T16:24+0200 - // Actually this currently isn't executed - // because the format scanner in the context of - // "?," doesn't generate a group separator but - // a literal ',' character instead that is - // inserted unconditionally. Should be changed - // on some occasion. - sStr.Insert(' ',k); - break; - default: - sStr.Insert(rInfo.sStrArray[j],k); - } - } - aGrouping.advance(); - } - } - break; - case NF_SYMBOLTYPE_DIGIT: - { - const String& rStr = rInfo.sStrArray[j]; - const sal_Unicode* p1 = rStr.GetBuffer(); - register const sal_Unicode* p = p1 + rStr.Len(); - while ( p1 < p-- ) - { - nDigitCount++; - if (k > 0) - k--; - else - { - switch (*p) - { - case '0': - sStr.Insert('0',0); - break; - case '?': - sStr.Insert(' ',0); - break; - } - } - if (nDigitCount == nDigCnt && k > 0) - { // more digits than specified - ImpDigitFill(sStr, 0, k, nIx, nDigitCount, aGrouping); - } - } - } - break; - case NF_KEY_CCC: // CCC currency - sStr.Insert(rScan.GetCurAbbrev(), k); - break; - case NF_KEY_GENERAL: // "General" in string - { - String sNum; - ImpGetOutputStandard(rNumber, sNum); - sNum.EraseLeadingChars('-'); - sStr.Insert(sNum, k); - } - break; - - default: - break; - } // switch - j--; // next format code string - } // while - k = k + nLeadingStringChars; // MSC converts += to int and then warns, so ... - if (k > nLeadingStringChars) - ImpDigitFill(sStr, nLeadingStringChars, k, nIx, nDigitCount, aGrouping); - return bRes; -} - -void SvNumberformat::ImpDigitFill( - String& sStr, // number string - xub_StrLen nStart, // start of digits - xub_StrLen& k, // position within string - USHORT nIx, // subformat index - xub_StrLen & nDigitCount, // count of integer digits from the right so far - utl::DigitGroupingIterator & rGrouping ) // current grouping -{ - if (NumFor[nIx].Info().bThousand) // only if grouping - { // fill in separators - const String& rThousandSep = GetFormatter().GetNumThousandSep(); - while (k > nStart) - { - if (nDigitCount == rGrouping.getPos()) - { - sStr.Insert( rThousandSep, k ); - rGrouping.advance(); - } - nDigitCount++; - k--; - } - } - else // simply skip - k = nStart; -} - -BOOL SvNumberformat::ImpNumberFill( String& sStr, // number string - double& rNumber, // number for "General" format - xub_StrLen& k, // position within string - USHORT& j, // symbol index within format code - USHORT nIx, // subformat index - short eSymbolType ) // type of stop condition -{ - BOOL bRes = FALSE; - k = sStr.Len(); // behind last digit - const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info(); - // no normal thousands separators if number divided by thousands - BOOL bDoThousands = (rInfo.nThousand == 0); - short nType; - while (j > 0 && (nType = rInfo.nTypeArray[j]) != eSymbolType ) - { // rueckwaerts: - switch ( nType ) - { - case NF_SYMBOLTYPE_STAR: - if( bStarFlag ) - { - sStr.Insert( sal_Unicode(0x1B), k++ ); - sStr.Insert(rInfo.sStrArray[j].GetChar(1),k); - bRes = TRUE; - } - break; - case NF_SYMBOLTYPE_BLANK: - k = InsertBlanks( sStr,k,rInfo.sStrArray[j].GetChar(1) ); - break; - case NF_SYMBOLTYPE_THSEP: - { - // Same as in ImpNumberFillWithThousands() above, do not insert - // if divided and regex [0#,],[^0#] and no other digit symbol - // follows (which was already detected during scan of format - // code, otherwise there would be no division), else do insert. - if ( !bDoThousands && j < NumFor[nIx].GetnAnz()-1 ) - bDoThousands = ((j == 0) || - (rInfo.nTypeArray[j-1] != NF_SYMBOLTYPE_DIGIT && - rInfo.nTypeArray[j-1] != NF_SYMBOLTYPE_THSEP) || - (rInfo.nTypeArray[j+1] == NF_SYMBOLTYPE_DIGIT)); - if ( bDoThousands && k > 0 ) - { - sStr.Insert(rInfo.sStrArray[j],k); - } - } - break; - case NF_SYMBOLTYPE_DIGIT: - { - const String& rStr = rInfo.sStrArray[j]; - const sal_Unicode* p1 = rStr.GetBuffer(); - register const sal_Unicode* p = p1 + rStr.Len(); - while ( p1 < p-- ) - { - if (k > 0) - k--; - else - { - switch (*p) - { - case '0': - sStr.Insert('0',0); - break; - case '?': - sStr.Insert(' ',0); - break; - } - } - } - } - break; - case NF_KEY_CCC: // CCC-Waehrung - sStr.Insert(rScan.GetCurAbbrev(), k); - break; - case NF_KEY_GENERAL: // Standard im String - { - String sNum; - ImpGetOutputStandard(rNumber, sNum); - sNum.EraseLeadingChars('-'); // Vorzeichen weg!! - sStr.Insert(sNum, k); - } - break; - - default: - sStr.Insert(rInfo.sStrArray[j],k); - break; - } // of switch - j--; // naechster String - } // of while - return bRes; -} - -void SvNumberformat::GetFormatSpecialInfo(BOOL& bThousand, - BOOL& IsRed, - USHORT& nPrecision, - USHORT& nAnzLeading) const -{ - // as before: take info from nNumFor=0 for whole format (for dialog etc.) - - short nDummyType; - GetNumForInfo( 0, nDummyType, bThousand, nPrecision, nAnzLeading ); - - // "negative in red" is only useful for the whole format - - const Color* pColor = NumFor[1].GetColor(); - if (fLimit1 == 0.0 && fLimit2 == 0.0 && pColor - && (*pColor == rScan.GetRedColor())) - IsRed = TRUE; - else - IsRed = FALSE; -} - -void SvNumberformat::GetNumForInfo( USHORT nNumFor, short& rScannedType, - BOOL& bThousand, USHORT& nPrecision, USHORT& nAnzLeading ) const -{ - // take info from a specified sub-format (for XML export) - - if ( nNumFor > 3 ) - return; // invalid - - const ImpSvNumberformatInfo& rInfo = NumFor[nNumFor].Info(); - rScannedType = rInfo.eScannedType; - bThousand = rInfo.bThousand; - nPrecision = rInfo.nCntPost; - if (bStandard && rInfo.eScannedType == NUMBERFORMAT_NUMBER) - // StandardFormat - nAnzLeading = 1; - else - { - nAnzLeading = 0; - BOOL bStop = FALSE; - USHORT i = 0; - const USHORT nAnz = NumFor[nNumFor].GetnAnz(); - while (!bStop && i < nAnz) - { - short nType = rInfo.nTypeArray[i]; - if ( nType == NF_SYMBOLTYPE_DIGIT) - { - register const sal_Unicode* p = rInfo.sStrArray[i].GetBuffer(); - while ( *p == '#' ) - p++; - while ( *p++ == '0' ) - nAnzLeading++; - } - else if (nType == NF_SYMBOLTYPE_DECSEP || nType == NF_SYMBOLTYPE_EXP) - bStop = TRUE; - i++; - } - } -} - -const String* SvNumberformat::GetNumForString( USHORT nNumFor, USHORT nPos, - BOOL bString /* = FALSE */ ) const -{ - if ( nNumFor > 3 ) - return NULL; - USHORT nAnz = NumFor[nNumFor].GetnAnz(); - if ( !nAnz ) - return NULL; - if ( nPos == 0xFFFF ) - { - nPos = nAnz - 1; - if ( bString ) - { // rueckwaerts - short* pType = NumFor[nNumFor].Info().nTypeArray + nPos; - while ( nPos > 0 && (*pType != NF_SYMBOLTYPE_STRING) && - (*pType != NF_SYMBOLTYPE_CURRENCY) ) - { - pType--; - nPos--; - } - if ( (*pType != NF_SYMBOLTYPE_STRING) && (*pType != NF_SYMBOLTYPE_CURRENCY) ) - return NULL; - } - } - else if ( nPos > nAnz - 1 ) - return NULL; - else if ( bString ) - { // vorwaerts - short* pType = NumFor[nNumFor].Info().nTypeArray + nPos; - while ( nPos < nAnz && (*pType != NF_SYMBOLTYPE_STRING) && - (*pType != NF_SYMBOLTYPE_CURRENCY) ) - { - pType++; - nPos++; - } - if ( nPos >= nAnz || ((*pType != NF_SYMBOLTYPE_STRING) && - (*pType != NF_SYMBOLTYPE_CURRENCY)) ) - return NULL; - } - return &NumFor[nNumFor].Info().sStrArray[nPos]; -} - - -short SvNumberformat::GetNumForType( USHORT nNumFor, USHORT nPos, - BOOL bString /* = FALSE */ ) const -{ - if ( nNumFor > 3 ) - return 0; - USHORT nAnz = NumFor[nNumFor].GetnAnz(); - if ( !nAnz ) - return 0; - if ( nPos == 0xFFFF ) - { - nPos = nAnz - 1; - if ( bString ) - { // rueckwaerts - short* pType = NumFor[nNumFor].Info().nTypeArray + nPos; - while ( nPos > 0 && (*pType != NF_SYMBOLTYPE_STRING) && - (*pType != NF_SYMBOLTYPE_CURRENCY) ) - { - pType--; - nPos--; - } - if ( (*pType != NF_SYMBOLTYPE_STRING) && (*pType != NF_SYMBOLTYPE_CURRENCY) ) - return 0; - } - } - else if ( nPos > nAnz - 1 ) - return 0; - else if ( bString ) - { // vorwaerts - short* pType = NumFor[nNumFor].Info().nTypeArray + nPos; - while ( nPos < nAnz && (*pType != NF_SYMBOLTYPE_STRING) && - (*pType != NF_SYMBOLTYPE_CURRENCY) ) - { - pType++; - nPos++; - } - if ( (*pType != NF_SYMBOLTYPE_STRING) && (*pType != NF_SYMBOLTYPE_CURRENCY) ) - return 0; - } - return NumFor[nNumFor].Info().nTypeArray[nPos]; -} - - -BOOL SvNumberformat::IsNegativeWithoutSign() const -{ - if ( IsNegativeRealNegative() ) - { - const String* pStr = GetNumForString( 1, 0, TRUE ); - if ( pStr ) - return !HasStringNegativeSign( *pStr ); - } - return FALSE; -} - - -DateFormat SvNumberformat::GetDateOrder() const -{ - if ( (eType & NUMBERFORMAT_DATE) == NUMBERFORMAT_DATE ) - { - short const * const pType = NumFor[0].Info().nTypeArray; - USHORT nAnz = NumFor[0].GetnAnz(); - for ( USHORT j=0; j 3 ) - return NULL; - - return NumFor[nNumFor].GetColor(); -} - - -void lcl_SvNumberformat_AddLimitStringImpl( String& rStr, - SvNumberformatLimitOps eOp, double fLimit, const String& rDecSep ) -{ - if ( eOp != NUMBERFORMAT_OP_NO ) - { - switch ( eOp ) - { - case NUMBERFORMAT_OP_EQ : - rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "[=" ) ); - break; - case NUMBERFORMAT_OP_NE : - rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "[<>" ) ); - break; - case NUMBERFORMAT_OP_LT : - rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "[<" ) ); - break; - case NUMBERFORMAT_OP_LE : - rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "[<=" ) ); - break; - case NUMBERFORMAT_OP_GT : - rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "[>" ) ); - break; - case NUMBERFORMAT_OP_GE : - rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "[>=" ) ); - break; - default: - OSL_ASSERT( "unsupported number format" ); - break; - } - rStr += String( ::rtl::math::doubleToUString( fLimit, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - rDecSep.GetChar(0), sal_True)); - rStr += ']'; - } -} - - -String SvNumberformat::GetMappedFormatstring( - const NfKeywordTable& rKeywords, const LocaleDataWrapper& rLocWrp, - BOOL bDontQuote ) const -{ - String aStr; - BOOL bDefault[4]; - // 1 subformat matches all if no condition specified, - bDefault[0] = ( NumFor[1].GetnAnz() == 0 && eOp1 == NUMBERFORMAT_OP_NO ); - // with 2 subformats [>=0];[<0] is implied if no condition specified - bDefault[1] = ( !bDefault[0] && NumFor[2].GetnAnz() == 0 && - eOp1 == NUMBERFORMAT_OP_GE && fLimit1 == 0.0 && - eOp2 == NUMBERFORMAT_OP_NO && fLimit2 == 0.0 ); - // with 3 or more subformats [>0];[<0];[=0] is implied if no condition specified, - // note that subformats may be empty (;;;) and NumFor[2].GetnAnz()>0 is not checked. - bDefault[2] = ( !bDefault[0] && !bDefault[1] && - eOp1 == NUMBERFORMAT_OP_GT && fLimit1 == 0.0 && - eOp2 == NUMBERFORMAT_OP_LT && fLimit2 == 0.0 ); - BOOL bDefaults = bDefault[0] || bDefault[1] || bDefault[2]; - // from now on bDefault[] values are used to append empty subformats at the end - bDefault[3] = FALSE; - if ( !bDefaults ) - { // conditions specified - if ( eOp1 != NUMBERFORMAT_OP_NO && eOp2 == NUMBERFORMAT_OP_NO ) - bDefault[0] = bDefault[1] = TRUE; // [];x - else if ( eOp1 != NUMBERFORMAT_OP_NO && eOp2 != NUMBERFORMAT_OP_NO && - NumFor[2].GetnAnz() == 0 ) - bDefault[0] = bDefault[1] = bDefault[2] = bDefault[3] = TRUE; // [];[];; - // nothing to do if conditions specified for every subformat - } - else if ( bDefault[0] ) - bDefault[0] = FALSE; // a single unconditional subformat is never delimited - else - { - if ( bDefault[2] && NumFor[2].GetnAnz() == 0 && NumFor[1].GetnAnz() > 0 ) - bDefault[3] = TRUE; // special cases x;x;; and ;x;; - for ( int i=0; i<3 && !bDefault[i]; ++i ) - bDefault[i] = TRUE; - } - int nSem = 0; // needed ';' delimiters - int nSub = 0; // subformats delimited so far - for ( int n=0; n<4; n++ ) - { - if ( n > 0 ) - nSem++; - - String aPrefix; - - if ( !bDefaults ) - { - switch ( n ) - { - case 0 : - lcl_SvNumberformat_AddLimitStringImpl( aPrefix, eOp1, - fLimit1, rLocWrp.getNumDecimalSep() ); - break; - case 1 : - lcl_SvNumberformat_AddLimitStringImpl( aPrefix, eOp2, - fLimit2, rLocWrp.getNumDecimalSep() ); - break; - } - } - - const String& rColorName = NumFor[n].GetColorName(); - if ( rColorName.Len() ) - { - const String* pKey = rScan.GetKeywords() + NF_KEY_FIRSTCOLOR; - for ( int j=NF_KEY_FIRSTCOLOR; j<=NF_KEY_LASTCOLOR; j++, pKey++ ) - { - if ( *pKey == rColorName ) - { - aPrefix += '['; - aPrefix += rKeywords[j]; - aPrefix += ']'; - break; // for - } - } - } - - const SvNumberNatNum& rNum = NumFor[n].GetNatNum(); - // The Thai T NatNum modifier during Xcl export. - if (rNum.IsSet() && rNum.GetNatNum() == 1 && - rKeywords[NF_KEY_THAI_T].EqualsAscii( "T") && - MsLangId::getRealLanguage( rNum.GetLang()) == - LANGUAGE_THAI) - { - aPrefix += 't'; // must be lowercase, otherwise taken as literal - } - - USHORT nAnz = NumFor[n].GetnAnz(); - if ( nSem && (nAnz || aPrefix.Len()) ) - { - for ( ; nSem; --nSem ) - aStr += ';'; - for ( ; nSub <= n; ++nSub ) - bDefault[nSub] = FALSE; - } - - if ( aPrefix.Len() ) - aStr += aPrefix; - - if ( nAnz ) - { - const short* pType = NumFor[n].Info().nTypeArray; - const String* pStr = NumFor[n].Info().sStrArray; - for ( USHORT j=0; j= nMinDigits ) - aStr = aValStr; - else - { - aStr.Fill( nMinDigits - aValStr.Len(), '0' ); - aStr += aValStr; - } - } - } - else - aStr = String::CreateFromInt32( nVal ); - ImpTransliterate( aStr, rNum ); - return aStr; -} - - -void SvNumberformat::ImpTransliterateImpl( String& rStr, - const SvNumberNatNum& rNum ) const -{ - com::sun::star::lang::Locale aLocale( - MsLangId::convertLanguageToLocale( rNum.GetLang() ) ); - rStr = GetFormatter().GetNatNum()->getNativeNumberString( rStr, - aLocale, rNum.GetNatNum() ); -} - - -void SvNumberformat::GetNatNumXml( - com::sun::star::i18n::NativeNumberXmlAttributes& rAttr, - USHORT nNumFor ) const -{ - if ( nNumFor <= 3 ) - { - const SvNumberNatNum& rNum = NumFor[nNumFor].GetNatNum(); - if ( rNum.IsSet() ) - { - com::sun::star::lang::Locale aLocale( - MsLangId::convertLanguageToLocale( rNum.GetLang() ) ); - rAttr = GetFormatter().GetNatNum()->convertToXmlAttributes( - aLocale, rNum.GetNatNum() ); - } - else - rAttr = com::sun::star::i18n::NativeNumberXmlAttributes(); - } - else - rAttr = com::sun::star::i18n::NativeNumberXmlAttributes(); -} - -// static -BOOL SvNumberformat::HasStringNegativeSign( const String& rStr ) -{ - // fuer Sign muss '-' am Anfang oder am Ende des TeilStrings sein (Blanks ignored) - xub_StrLen nLen = rStr.Len(); - if ( !nLen ) - return FALSE; - const sal_Unicode* const pBeg = rStr.GetBuffer(); - const sal_Unicode* const pEnd = pBeg + nLen; - register const sal_Unicode* p = pBeg; - do - { // Anfang - if ( *p == '-' ) - return TRUE; - } while ( *p == ' ' && ++p < pEnd ); - p = pEnd - 1; - do - { // Ende - if ( *p == '-' ) - return TRUE; - } while ( *p == ' ' && pBeg < --p ); - return FALSE; -} - - -// static -void SvNumberformat::SetComment( const String& rStr, String& rFormat, - String& rComment ) -{ - if ( rComment.Len() ) - { // alten Kommentar aus Formatstring loeschen - //! nicht per EraseComment, der Kommentar muss matchen - String aTmp( '{' ); - aTmp += ' '; - aTmp += rComment; - aTmp += ' '; - aTmp += '}'; - xub_StrLen nCom = 0; - do - { - nCom = rFormat.Search( aTmp, nCom ); - } while ( (nCom != STRING_NOTFOUND) && (nCom + aTmp.Len() != rFormat.Len()) ); - if ( nCom != STRING_NOTFOUND ) - rFormat.Erase( nCom ); - } - if ( rStr.Len() ) - { // neuen Kommentar setzen - rFormat += '{'; - rFormat += ' '; - rFormat += rStr; - rFormat += ' '; - rFormat += '}'; - rComment = rStr; - } -} - - -// static -void SvNumberformat::EraseCommentBraces( String& rStr ) -{ - xub_StrLen nLen = rStr.Len(); - if ( nLen && rStr.GetChar(0) == '{' ) - { - rStr.Erase( 0, 1 ); - --nLen; - } - if ( nLen && rStr.GetChar(0) == ' ' ) - { - rStr.Erase( 0, 1 ); - --nLen; - } - if ( nLen && rStr.GetChar( nLen-1 ) == '}' ) - rStr.Erase( --nLen, 1 ); - if ( nLen && rStr.GetChar( nLen-1 ) == ' ' ) - rStr.Erase( --nLen, 1 ); -} - - -// static -void SvNumberformat::EraseComment( String& rStr ) -{ - register const sal_Unicode* p = rStr.GetBuffer(); - BOOL bInString = FALSE; - BOOL bEscaped = FALSE; - BOOL bFound = FALSE; - xub_StrLen nPos = 0; - while ( !bFound && *p ) - { - switch ( *p ) - { - case '\\' : - bEscaped = !bEscaped; - break; - case '\"' : - if ( !bEscaped ) - bInString = !bInString; - break; - case '{' : - if ( !bEscaped && !bInString ) - { - bFound = TRUE; - nPos = sal::static_int_cast< xub_StrLen >( - p - rStr.GetBuffer()); - } - break; - } - if ( bEscaped && *p != '\\' ) - bEscaped = FALSE; - ++p; - } - if ( bFound ) - rStr.Erase( nPos ); -} - - -// static -BOOL SvNumberformat::IsInQuote( const String& rStr, xub_StrLen nPos, - sal_Unicode cQuote, sal_Unicode cEscIn, sal_Unicode cEscOut ) -{ - xub_StrLen nLen = rStr.Len(); - if ( nPos >= nLen ) - return FALSE; - register const sal_Unicode* p0 = rStr.GetBuffer(); - register const sal_Unicode* p = p0; - register const sal_Unicode* p1 = p0 + nPos; - BOOL bQuoted = FALSE; - while ( p <= p1 ) - { - if ( *p == cQuote ) - { - if ( p == p0 ) - bQuoted = TRUE; - else if ( bQuoted ) - { - if ( *(p-1) != cEscIn ) - bQuoted = FALSE; - } - else - { - if ( *(p-1) != cEscOut ) - bQuoted = TRUE; - } - } - p++; - } - return bQuoted; -} - - -// static -xub_StrLen SvNumberformat::GetQuoteEnd( const String& rStr, xub_StrLen nPos, - sal_Unicode cQuote, sal_Unicode cEscIn, sal_Unicode cEscOut ) -{ - xub_StrLen nLen = rStr.Len(); - if ( nPos >= nLen ) - return STRING_NOTFOUND; - if ( !IsInQuote( rStr, nPos, cQuote, cEscIn, cEscOut ) ) - { - if ( rStr.GetChar( nPos ) == cQuote ) - return nPos; // schliessendes cQuote - return STRING_NOTFOUND; - } - register const sal_Unicode* p0 = rStr.GetBuffer(); - register const sal_Unicode* p = p0 + nPos; - register const sal_Unicode* p1 = p0 + nLen; - while ( p < p1 ) - { - if ( *p == cQuote && p > p0 && *(p-1) != cEscIn ) - return sal::static_int_cast< xub_StrLen >(p - p0); - p++; - } - return nLen; // String Ende -} - - -USHORT SvNumberformat::ImpGetNumForStringElementCount( USHORT nNumFor ) const -{ - USHORT nCnt = 0; - USHORT nAnz = NumFor[nNumFor].GetnAnz(); - short const * const pType = NumFor[nNumFor].Info().nTypeArray; - for ( USHORT j=0; j - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#define _ZFORSCAN_CXX -#include "zforscan.hxx" -#undef _ZFORSCAN_CXX -#include "nfsymbol.hxx" -using namespace svt; - -const sal_Unicode cNonBreakingSpace = 0xA0; - -namespace -{ - struct ImplEnglishColors - { - const String* operator()() - { - static const String aEnglishColors[NF_MAX_DEFAULT_COLORS] = - { - String( RTL_CONSTASCII_USTRINGPARAM( "BLACK" ) ), - String( RTL_CONSTASCII_USTRINGPARAM( "BLUE" ) ), - String( RTL_CONSTASCII_USTRINGPARAM( "GREEN" ) ), - String( RTL_CONSTASCII_USTRINGPARAM( "CYAN" ) ), - String( RTL_CONSTASCII_USTRINGPARAM( "RED" ) ), - String( RTL_CONSTASCII_USTRINGPARAM( "MAGENTA" ) ), - String( RTL_CONSTASCII_USTRINGPARAM( "BROWN" ) ), - String( RTL_CONSTASCII_USTRINGPARAM( "GREY" ) ), - String( RTL_CONSTASCII_USTRINGPARAM( "YELLOW" ) ), - String( RTL_CONSTASCII_USTRINGPARAM( "WHITE" ) ) - }; - return &aEnglishColors[0]; - } - }; - - struct theEnglishColors - : public rtl::StaticAggregate< const String, ImplEnglishColors> {}; - -} - -ImpSvNumberformatScan::ImpSvNumberformatScan( SvNumberFormatter* pFormatterP ) -{ - pFormatter = pFormatterP; - bConvertMode = FALSE; - //! All keywords MUST be UPPERCASE! - sKeyword[NF_KEY_E].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "E" ) ); // Exponent - sKeyword[NF_KEY_AMPM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "AM/PM" ) ); // AM/PM - sKeyword[NF_KEY_AP].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "A/P" ) ); // AM/PM short - sKeyword[NF_KEY_MI].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "M" ) ); // Minute - sKeyword[NF_KEY_MMI].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MM" ) ); // Minute 02 - sKeyword[NF_KEY_S].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "S" ) ); // Second - sKeyword[NF_KEY_SS].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "SS" ) ); // Second 02 - sKeyword[NF_KEY_Q].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Q" ) ); // Quarter short 'Q' - sKeyword[NF_KEY_QQ].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "QQ" ) ); // Quarter long - sKeyword[NF_KEY_NN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "NN" ) ); // Day of week short - sKeyword[NF_KEY_NNN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "NNN" ) ); // Day of week long - sKeyword[NF_KEY_NNNN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "NNNN" ) ); // Day of week long incl. separator - sKeyword[NF_KEY_WW].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "WW" ) ); // Week of year - sKeyword[NF_KEY_CCC].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "CCC" ) ); // Currency abbreviation - bKeywordsNeedInit = TRUE; // locale dependent keywords - bCompatCurNeedInit = TRUE; // locale dependent compatibility currency strings - - StandardColor[0] = Color(COL_BLACK); - StandardColor[1] = Color(COL_LIGHTBLUE); - StandardColor[2] = Color(COL_LIGHTGREEN); - StandardColor[3] = Color(COL_LIGHTCYAN); - StandardColor[4] = Color(COL_LIGHTRED); - StandardColor[5] = Color(COL_LIGHTMAGENTA); - StandardColor[6] = Color(COL_BROWN); - StandardColor[7] = Color(COL_GRAY); - StandardColor[8] = Color(COL_YELLOW); - StandardColor[9] = Color(COL_WHITE); - - pNullDate = new Date(30,12,1899); - nStandardPrec = 2; - - sErrStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "###" ) ); - Reset(); -} - -ImpSvNumberformatScan::~ImpSvNumberformatScan() -{ - delete pNullDate; - Reset(); -} - - -void ImpSvNumberformatScan::ChangeIntl() -{ - bKeywordsNeedInit = TRUE; - bCompatCurNeedInit = TRUE; - // may be initialized by InitSpecialKeyword() - sKeyword[NF_KEY_TRUE].Erase(); - sKeyword[NF_KEY_FALSE].Erase(); -} - - -void ImpSvNumberformatScan::InitSpecialKeyword( NfKeywordIndex eIdx ) const -{ - switch ( eIdx ) - { - case NF_KEY_TRUE : - ((ImpSvNumberformatScan*)this)->sKeyword[NF_KEY_TRUE] = - pFormatter->GetCharClass()->upper( - pFormatter->GetLocaleData()->getTrueWord() ); - if ( !sKeyword[NF_KEY_TRUE].Len() ) - { - DBG_ERRORFILE( "InitSpecialKeyword: TRUE_WORD?" ); - ((ImpSvNumberformatScan*)this)->sKeyword[NF_KEY_TRUE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "TRUE" ) ); - } - break; - case NF_KEY_FALSE : - ((ImpSvNumberformatScan*)this)->sKeyword[NF_KEY_FALSE] = - pFormatter->GetCharClass()->upper( - pFormatter->GetLocaleData()->getFalseWord() ); - if ( !sKeyword[NF_KEY_FALSE].Len() ) - { - DBG_ERRORFILE( "InitSpecialKeyword: FALSE_WORD?" ); - ((ImpSvNumberformatScan*)this)->sKeyword[NF_KEY_FALSE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "FALSE" ) ); - } - break; - default: - DBG_ERRORFILE( "InitSpecialKeyword: unknown request" ); - } -} - - -void ImpSvNumberformatScan::InitCompatCur() const -{ - ImpSvNumberformatScan* pThis = (ImpSvNumberformatScan*)this; - // currency symbol for old style ("automatic") compatibility format codes - pFormatter->GetCompatibilityCurrency( pThis->sCurSymbol, pThis->sCurAbbrev ); - // currency symbol upper case - pThis->sCurString = pFormatter->GetCharClass()->upper( sCurSymbol ); - bCompatCurNeedInit = FALSE; -} - - -void ImpSvNumberformatScan::InitKeywords() const -{ - if ( !bKeywordsNeedInit ) - return ; - ((ImpSvNumberformatScan*)this)->SetDependentKeywords(); - bKeywordsNeedInit = FALSE; -} - - -/** Extract the name of General, Standard, Whatever, ignoring leading modifiers - such as [NatNum1]. */ -static String lcl_extractStandardGeneralName( const ::rtl::OUString & rCode ) -{ - String aStr; - const sal_Unicode* p = rCode.getStr(); - const sal_Unicode* const pStop = p + rCode.getLength(); - const sal_Unicode* pBeg = p; // name begins here - bool bMod = false; - bool bDone = false; - while (p < pStop && !bDone) - { - switch (*p) - { - case '[': - bMod = true; - break; - case ']': - if (bMod) - { - bMod = false; - pBeg = p+1; - } - // else: would be a locale data error, easily to be spotted in - // UI dialog - break; - case ';': - if (!bMod) - { - bDone = true; - --p; // put back, increment by one follows - } - break; - } - ++p; - if (bMod) - pBeg = p; - } - if (pBeg < p) - aStr = rCode.copy( pBeg - rCode.getStr(), p - pBeg); - return aStr; -} - - -void ImpSvNumberformatScan::SetDependentKeywords() -{ - using namespace ::com::sun::star; - using namespace ::com::sun::star::uno; - - const CharClass* pCharClass = pFormatter->GetCharClass(); - const LocaleDataWrapper* pLocaleData = pFormatter->GetLocaleData(); - // #80023# be sure to generate keywords for the loaded Locale, not for the - // requested Locale, otherwise number format codes might not match - lang::Locale aLoadedLocale = pLocaleData->getLoadedLocale(); - LanguageType eLang = MsLangId::convertLocaleToLanguage( aLoadedLocale ); - NumberFormatCodeWrapper aNumberFormatCode( pFormatter->GetServiceManager(), aLoadedLocale ); - - i18n::NumberFormatCode aFormat = aNumberFormatCode.getFormatCode( NF_NUMBER_STANDARD ); - sNameStandardFormat = lcl_extractStandardGeneralName( aFormat.Code); - sKeyword[NF_KEY_GENERAL] = pCharClass->upper( sNameStandardFormat ); - - // preset new calendar keywords - sKeyword[NF_KEY_AAA].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "AAA" ) ); - sKeyword[NF_KEY_AAAA].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "AAAA" ) ); - sKeyword[NF_KEY_EC].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "E" ) ); - sKeyword[NF_KEY_EEC].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "EE" ) ); - sKeyword[NF_KEY_G].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "G" ) ); - sKeyword[NF_KEY_GG].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GG" ) ); - sKeyword[NF_KEY_GGG].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GGG" ) ); - sKeyword[NF_KEY_R].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "R" ) ); - sKeyword[NF_KEY_RR].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "RR" ) ); - - // Thai T NatNum special. Other locale's small letter 't' results in upper - // case comparison not matching but length does in conversion mode. Ugly. - if (eLang == LANGUAGE_THAI) - sKeyword[NF_KEY_THAI_T].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "T")); - else - sKeyword[NF_KEY_THAI_T].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "t")); - - switch ( eLang ) - { - case LANGUAGE_GERMAN: - case LANGUAGE_GERMAN_SWISS: - case LANGUAGE_GERMAN_AUSTRIAN: - case LANGUAGE_GERMAN_LUXEMBOURG: - case LANGUAGE_GERMAN_LIECHTENSTEIN: - { - //! all capital letters - sKeyword[NF_KEY_M].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "M" ) ); // month 1 - sKeyword[NF_KEY_MM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MM" ) ); // month 01 - sKeyword[NF_KEY_MMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MMM" ) ); // month Jan - sKeyword[NF_KEY_MMMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MMMM" ) ); // month Januar - sKeyword[NF_KEY_MMMMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MMMMM" ) );// month J - sKeyword[NF_KEY_H].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "H" ) ); // hour 2 - sKeyword[NF_KEY_HH].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "HH" ) ); // hour 02 - sKeyword[NF_KEY_D].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "T" ) ); - sKeyword[NF_KEY_DD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "TT" ) ); - sKeyword[NF_KEY_DDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "TTT" ) ); - sKeyword[NF_KEY_DDDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "TTTT" ) ); - sKeyword[NF_KEY_YY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJ" ) ); - sKeyword[NF_KEY_YYYY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJJJ" ) ); - sKeyword[NF_KEY_BOOLEAN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "LOGISCH" ) ); - sKeyword[NF_KEY_COLOR].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "FARBE" ) ); - sKeyword[NF_KEY_BLACK].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "SCHWARZ" ) ); - sKeyword[NF_KEY_BLUE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "BLAU" ) ); - sKeyword[NF_KEY_GREEN] = UniString( "GR" "\xDC" "N", RTL_TEXTENCODING_ISO_8859_1 ); - sKeyword[NF_KEY_CYAN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "CYAN" ) ); - sKeyword[NF_KEY_RED].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "ROT" ) ); - sKeyword[NF_KEY_MAGENTA].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MAGENTA" ) ); - sKeyword[NF_KEY_BROWN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "BRAUN" ) ); - sKeyword[NF_KEY_GREY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GRAU" ) ); - sKeyword[NF_KEY_YELLOW].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GELB" ) ); - sKeyword[NF_KEY_WHITE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "WEISS" ) ); - } - break; - default: - { - // day - switch ( eLang ) - { - case LANGUAGE_ITALIAN : - case LANGUAGE_ITALIAN_SWISS : - sKeyword[NF_KEY_D].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "G" ) ); - sKeyword[NF_KEY_DD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GG" ) ); - sKeyword[NF_KEY_DDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GGG" ) ); - sKeyword[NF_KEY_DDDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GGGG" ) ); - // must exchange the era code, same as Xcl - sKeyword[NF_KEY_G].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "X" ) ); - sKeyword[NF_KEY_GG].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "XX" ) ); - sKeyword[NF_KEY_GGG].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "XXX" ) ); - break; - case LANGUAGE_FRENCH : - case LANGUAGE_FRENCH_BELGIAN : - case LANGUAGE_FRENCH_CANADIAN : - case LANGUAGE_FRENCH_SWISS : - case LANGUAGE_FRENCH_LUXEMBOURG : - case LANGUAGE_FRENCH_MONACO : - sKeyword[NF_KEY_D].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "J" ) ); - sKeyword[NF_KEY_DD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJ" ) ); - sKeyword[NF_KEY_DDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJJ" ) ); - sKeyword[NF_KEY_DDDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJJJ" ) ); - break; - case LANGUAGE_FINNISH : - sKeyword[NF_KEY_D].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "P" ) ); - sKeyword[NF_KEY_DD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "PP" ) ); - sKeyword[NF_KEY_DDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "PPP" ) ); - sKeyword[NF_KEY_DDDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "PPPP" ) ); - break; - default: - sKeyword[NF_KEY_D].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "D" ) ); - sKeyword[NF_KEY_DD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "DD" ) ); - sKeyword[NF_KEY_DDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "DDD" ) ); - sKeyword[NF_KEY_DDDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "DDDD" ) ); - } - // month - switch ( eLang ) - { - case LANGUAGE_FINNISH : - sKeyword[NF_KEY_M].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "K" ) ); - sKeyword[NF_KEY_MM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "KK" ) ); - sKeyword[NF_KEY_MMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "KKK" ) ); - sKeyword[NF_KEY_MMMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "KKKK" ) ); - sKeyword[NF_KEY_MMMMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "KKKKK" ) ); - break; - default: - sKeyword[NF_KEY_M].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "M" ) ); - sKeyword[NF_KEY_MM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MM" ) ); - sKeyword[NF_KEY_MMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MMM" ) ); - sKeyword[NF_KEY_MMMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MMMM" ) ); - sKeyword[NF_KEY_MMMMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MMMMM" ) ); - } - // year - switch ( eLang ) - { - case LANGUAGE_ITALIAN : - case LANGUAGE_ITALIAN_SWISS : - case LANGUAGE_FRENCH : - case LANGUAGE_FRENCH_BELGIAN : - case LANGUAGE_FRENCH_CANADIAN : - case LANGUAGE_FRENCH_SWISS : - case LANGUAGE_FRENCH_LUXEMBOURG : - case LANGUAGE_FRENCH_MONACO : - case LANGUAGE_PORTUGUESE : - case LANGUAGE_PORTUGUESE_BRAZILIAN : - case LANGUAGE_SPANISH_MODERN : - case LANGUAGE_SPANISH_DATED : - case LANGUAGE_SPANISH_MEXICAN : - case LANGUAGE_SPANISH_GUATEMALA : - case LANGUAGE_SPANISH_COSTARICA : - case LANGUAGE_SPANISH_PANAMA : - case LANGUAGE_SPANISH_DOMINICAN_REPUBLIC : - case LANGUAGE_SPANISH_VENEZUELA : - case LANGUAGE_SPANISH_COLOMBIA : - case LANGUAGE_SPANISH_PERU : - case LANGUAGE_SPANISH_ARGENTINA : - case LANGUAGE_SPANISH_ECUADOR : - case LANGUAGE_SPANISH_CHILE : - case LANGUAGE_SPANISH_URUGUAY : - case LANGUAGE_SPANISH_PARAGUAY : - case LANGUAGE_SPANISH_BOLIVIA : - case LANGUAGE_SPANISH_EL_SALVADOR : - case LANGUAGE_SPANISH_HONDURAS : - case LANGUAGE_SPANISH_NICARAGUA : - case LANGUAGE_SPANISH_PUERTO_RICO : - sKeyword[NF_KEY_YY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "AA" ) ); - sKeyword[NF_KEY_YYYY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "AAAA" ) ); - // must exchange the day of week name code, same as Xcl - sKeyword[NF_KEY_AAA].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "OOO" ) ); - sKeyword[NF_KEY_AAAA].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "OOOO" ) ); - break; - case LANGUAGE_DUTCH : - case LANGUAGE_DUTCH_BELGIAN : - sKeyword[NF_KEY_YY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJ" ) ); - sKeyword[NF_KEY_YYYY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJJJ" ) ); - break; - case LANGUAGE_FINNISH : - sKeyword[NF_KEY_YY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "VV" ) ); - sKeyword[NF_KEY_YYYY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "VVVV" ) ); - break; - default: - sKeyword[NF_KEY_YY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "YY" ) ); - sKeyword[NF_KEY_YYYY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "YYYY" ) ); - } - // hour - switch ( eLang ) - { - case LANGUAGE_DUTCH : - case LANGUAGE_DUTCH_BELGIAN : - sKeyword[NF_KEY_H].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "U" ) ); - sKeyword[NF_KEY_HH].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "UU" ) ); - break; - case LANGUAGE_FINNISH : - case LANGUAGE_SWEDISH : - case LANGUAGE_SWEDISH_FINLAND : - case LANGUAGE_DANISH : - case LANGUAGE_NORWEGIAN : - case LANGUAGE_NORWEGIAN_BOKMAL : - case LANGUAGE_NORWEGIAN_NYNORSK : - sKeyword[NF_KEY_H].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "T" ) ); - sKeyword[NF_KEY_HH].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "TT" ) ); - break; - default: - sKeyword[NF_KEY_H].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "H" ) ); - sKeyword[NF_KEY_HH].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "HH" ) ); - } - // boolean - sKeyword[NF_KEY_BOOLEAN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "BOOLEAN" ) ); - // colours - sKeyword[NF_KEY_COLOR].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "COLOR" ) ); - sKeyword[NF_KEY_BLACK].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "BLACK" ) ); - sKeyword[NF_KEY_BLUE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "BLUE" ) ); - sKeyword[NF_KEY_GREEN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GREEN" ) ); - sKeyword[NF_KEY_CYAN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "CYAN" ) ); - sKeyword[NF_KEY_RED].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "RED" ) ); - sKeyword[NF_KEY_MAGENTA].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MAGENTA" ) ); - sKeyword[NF_KEY_BROWN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "BROWN" ) ); - sKeyword[NF_KEY_GREY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GREY" ) ); - sKeyword[NF_KEY_YELLOW].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "YELLOW" ) ); - sKeyword[NF_KEY_WHITE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "WHITE" ) ); - } - break; - } - - // boolean keyords - InitSpecialKeyword( NF_KEY_TRUE ); - InitSpecialKeyword( NF_KEY_FALSE ); - - // compatibility currency strings - InitCompatCur(); -} - - -void ImpSvNumberformatScan::ChangeNullDate(USHORT nDay, USHORT nMonth, USHORT nYear) -{ - if ( pNullDate ) - *pNullDate = Date(nDay, nMonth, nYear); - else - pNullDate = new Date(nDay, nMonth, nYear); -} - -void ImpSvNumberformatScan::ChangeStandardPrec(short nPrec) -{ - nStandardPrec = nPrec; -} - -Color* ImpSvNumberformatScan::GetColor(String& sStr) -{ - String sString = pFormatter->GetCharClass()->upper(sStr); - const String* pKeyword = GetKeywords(); - size_t i = 0; - while (i < NF_MAX_DEFAULT_COLORS && - sString != pKeyword[NF_KEY_FIRSTCOLOR+i] ) - i++; - if ( i >= NF_MAX_DEFAULT_COLORS ) - { - const String* pEnglishColors = theEnglishColors::get(); - size_t j = 0; - while ( j < NF_MAX_DEFAULT_COLORS && - sString != pEnglishColors[j] ) - ++j; - if ( j < NF_MAX_DEFAULT_COLORS ) - i = j; - } - - Color* pResult = NULL; - if (i >= NF_MAX_DEFAULT_COLORS) - { - const String& rColorWord = pKeyword[NF_KEY_COLOR]; - xub_StrLen nPos = sString.Match(rColorWord); - if (nPos > 0) - { - sStr.Erase(0, nPos); - sStr.EraseLeadingChars(); - sStr.EraseTrailingChars(); - if (bConvertMode) - { - pFormatter->ChangeIntl(eNewLnge); - sStr.Insert( GetKeywords()[NF_KEY_COLOR], 0 ); // Color -> FARBE - pFormatter->ChangeIntl(eTmpLnge); - } - else - sStr.Insert(rColorWord,0); - sString.Erase(0, nPos); - sString.EraseLeadingChars(); - sString.EraseTrailingChars(); - - if ( CharClass::isAsciiNumeric( sString ) ) - { - long nIndex = sString.ToInt32(); - if (nIndex > 0 && nIndex <= 64) - pResult = pFormatter->GetUserDefColor((USHORT)nIndex-1); - } - } - } - else - { - sStr.Erase(); - if (bConvertMode) - { - pFormatter->ChangeIntl(eNewLnge); - sStr = GetKeywords()[NF_KEY_FIRSTCOLOR+i]; // red -> rot - pFormatter->ChangeIntl(eTmpLnge); - } - else - sStr = pKeyword[NF_KEY_FIRSTCOLOR+i]; - - pResult = &(StandardColor[i]); - } - return pResult; -} - - -short ImpSvNumberformatScan::GetKeyWord( const String& sSymbol, xub_StrLen nPos ) -{ - String sString = pFormatter->GetCharClass()->toUpper( sSymbol, nPos, sSymbol.Len() - nPos ); - const String* pKeyword = GetKeywords(); - // #77026# for the Xcl perverts: the GENERAL keyword is recognized anywhere - if ( sString.Search( pKeyword[NF_KEY_GENERAL] ) == 0 ) - return NF_KEY_GENERAL; - //! MUST be a reverse search to find longer strings first - short i = NF_KEYWORD_ENTRIES_COUNT-1; - BOOL bFound = FALSE; - for ( ; i > NF_KEY_LASTKEYWORD_SO5; --i ) - { - bFound = sString.Search(pKeyword[i]) == 0; - if ( bFound ) - { - break; - } - } - // new keywords take precedence over old keywords - if ( !bFound ) - { // skip the gap of colors et al between new and old keywords and search on - i = NF_KEY_LASTKEYWORD; - while ( i > 0 && sString.Search(pKeyword[i]) != 0 ) - i--; - if ( i > NF_KEY_LASTOLDKEYWORD && sString != pKeyword[i] ) - { // found something, but maybe it's something else? - // e.g. new NNN is found in NNNN, for NNNN we must search on - short j = i - 1; - while ( j > 0 && sString.Search(pKeyword[j]) != 0 ) - j--; - if ( j && pKeyword[j].Len() > pKeyword[i].Len() ) - return j; - } - } - // The Thai T NatNum modifier during Xcl import. - if (i == 0 && bConvertMode && sString.GetChar(0) == 'T' && eTmpLnge == - LANGUAGE_ENGLISH_US && MsLangId::getRealLanguage( eNewLnge) == - LANGUAGE_THAI) - i = NF_KEY_THAI_T; - return i; // 0 => not found -} - -//--------------------------------------------------------------------------- -// Next_Symbol -//--------------------------------------------------------------------------- -// Zerlegt die Eingabe in Symbole fuer die weitere -// Verarbeitung (Turing-Maschine). -//--------------------------------------------------------------------------- -// Ausgangs Zustand = SsStart -//---------------+-------------------+-----------------------+--------------- -// Alter Zustand | gelesenes Zeichen | Aktion | Neuer Zustand -//---------------+-------------------+-----------------------+--------------- -// SsStart | Buchstabe | Symbol=Zeichen | SsGetWord -// | " | Typ = String | SsGetString -// | \ | Typ = String | SsGetChar -// | * | Typ = Star | SsGetStar -// | _ | Typ = Blank | SsGetBlank -// | @ # 0 ? / . , % [ | Symbol = Zeichen; | -// | ] ' Blank | Typ = Steuerzeichen | SsStop -// | $ - + ( ) : | Typ = String; | -// | | | Typ = Comment | SsStop -// | Sonst | Symbol = Zeichen | SsStop -//---------------|-------------------+-----------------------+--------------- -// SsGetChar | Sonst | Symbol=Zeichen | SsStop -//---------------+-------------------+-----------------------+--------------- -// GetString | " | | SsStop -// | Sonst | Symbol+=Zeichen | GetString -//---------------+-------------------+-----------------------+--------------- -// SsGetWord | Buchstabe | Symbol += Zeichen | -// | + - (E+ E-)| Symbol += Zeichen | SsStop -// | / (AM/PM)| Symbol += Zeichen | -// | Sonst | Pos--, if Key Typ=Word| SsStop -//---------------+-------------------+-----------------------+--------------- -// SsGetStar | Sonst | Symbol+=Zeichen | SsStop -// | | markiere Sonderfall * | -//---------------+-------------------+-----------------------+--------------- -// SsGetBlank | Sonst | Symbol+=Zeichen | SsStop -// | | markiere Sonderfall _ | -//---------------+-------------------+-----------------------+--------------- -// Wurde im State SsGetWord ein Schluesselwort erkannt (auch als -// Anfangsteilwort des Symbols) -// so werden die restlichen Buchstaben zurueckgeschrieben !! - -enum ScanState -{ - SsStop = 0, - SsStart = 1, - SsGetChar = 2, - SsGetString = 3, - SsGetWord = 4, - SsGetStar = 5, - SsGetBlank = 6 -}; - -short ImpSvNumberformatScan::Next_Symbol( const String& rStr, - xub_StrLen& nPos, String& sSymbol ) -{ - if ( bKeywordsNeedInit ) - InitKeywords(); - const CharClass* pChrCls = pFormatter->GetCharClass(); - const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData(); - const xub_StrLen nStart = nPos; - short eType = 0; - ScanState eState = SsStart; - sSymbol.Erase(); - while ( nPos < rStr.Len() && eState != SsStop ) - { - sal_Unicode cToken = rStr.GetChar( nPos++ ); - switch (eState) - { - case SsStart: - { - // Fetch any currency longer than one character and don't get - // confused later on by "E/" or other combinations of letters - // and meaningful symbols. Necessary for old automatic currency. - // #96158# But don't do it if we're starting a "[...]" section, - // for example a "[$...]" new currency symbol to not parse away - // "$U" (symbol) of "[$UYU]" (abbreviation). - if ( nCurrPos != STRING_NOTFOUND && sCurString.Len() > 1 && - nPos-1 + sCurString.Len() <= rStr.Len() && - !(nPos > 1 && rStr.GetChar( nPos-2 ) == '[') ) - { - String aTest( rStr.Copy( nPos-1, sCurString.Len() ) ); - pChrCls->toUpper( aTest ); - if ( aTest == sCurString ) - { - sSymbol = rStr.Copy( --nPos, sCurString.Len() ); - nPos = nPos + sSymbol.Len(); - eState = SsStop; - eType = NF_SYMBOLTYPE_STRING; - return eType; - } - } - switch (cToken) - { - case '#': - case '0': - case '?': - case '%': - case '@': - case '[': - case ']': - case ',': - case '.': - case '/': - case '\'': - case ' ': - case ':': - case '-': - { - eType = NF_SYMBOLTYPE_DEL; - sSymbol += cToken; - eState = SsStop; - } - break; - case '*': - { - eType = NF_SYMBOLTYPE_STAR; - sSymbol += cToken; - eState = SsGetStar; - } - break; - case '_': - { - eType = NF_SYMBOLTYPE_BLANK; - sSymbol += cToken; - eState = SsGetBlank; - } - break; -#if NF_COMMENT_IN_FORMATSTRING - case '{': - eType = NF_SYMBOLTYPE_COMMENT; - eState = SsStop; - sSymbol.Append( rStr.GetBuffer() + (nPos-1), rStr.Len() - (nPos-1) ); - nPos = rStr.Len(); - break; -#endif - case '"': - eType = NF_SYMBOLTYPE_STRING; - eState = SsGetString; - sSymbol += cToken; - break; - case '\\': - eType = NF_SYMBOLTYPE_STRING; - eState = SsGetChar; - sSymbol += cToken; - break; - case '$': - case '+': - case '(': - case ')': - eType = NF_SYMBOLTYPE_STRING; - eState = SsStop; - sSymbol += cToken; - break; - default : - { - if (StringEqualsChar( pFormatter->GetNumDecimalSep(), cToken) || - StringEqualsChar( pFormatter->GetNumThousandSep(), cToken) || - StringEqualsChar( pFormatter->GetDateSep(), cToken) || - StringEqualsChar( pLoc->getTimeSep(), cToken) || - StringEqualsChar( pLoc->getTime100SecSep(), cToken)) - { - // Another separator than pre-known ASCII - eType = NF_SYMBOLTYPE_DEL; - sSymbol += cToken; - eState = SsStop; - } - else if ( pChrCls->isLetter( rStr, nPos-1 ) ) - { - short nTmpType = GetKeyWord( rStr, nPos-1 ); - if ( nTmpType ) - { - BOOL bCurrency = FALSE; - // "Automatic" currency may start with keyword, - // like "R" (Rand) and 'R' (era) - if ( nCurrPos != STRING_NOTFOUND && - nPos-1 + sCurString.Len() <= rStr.Len() && - sCurString.Search( sKeyword[nTmpType] ) == 0 ) - { - String aTest( rStr.Copy( nPos-1, sCurString.Len() ) ); - pChrCls->toUpper( aTest ); - if ( aTest == sCurString ) - bCurrency = TRUE; - } - if ( bCurrency ) - { - eState = SsGetWord; - sSymbol += cToken; - } - else - { - eType = nTmpType; - xub_StrLen nLen = sKeyword[eType].Len(); - sSymbol = rStr.Copy( nPos-1, nLen ); - if ( eType == NF_KEY_E || IsAmbiguousE( eType ) ) - { - sal_Unicode cNext = rStr.GetChar(nPos); - switch ( cNext ) - { - case '+' : - case '-' : // E+ E- combine to one symbol - sSymbol += cNext; - eType = NF_KEY_E; - nPos++; - break; - case '0' : - case '#' : // scientific E without sign - eType = NF_KEY_E; - break; - } - } - nPos--; - nPos = nPos + nLen; - eState = SsStop; - } - } - else - { - eState = SsGetWord; - sSymbol += cToken; - } - } - else - { - eType = NF_SYMBOLTYPE_STRING; - eState = SsStop; - sSymbol += cToken; - } - } - break; - } - } - break; - case SsGetChar: - { - sSymbol += cToken; - eState = SsStop; - } - break; - case SsGetString: - { - if (cToken == '"') - eState = SsStop; - sSymbol += cToken; - } - break; - case SsGetWord: - { - if ( pChrCls->isLetter( rStr, nPos-1 ) ) - { - short nTmpType = GetKeyWord( rStr, nPos-1 ); - if ( nTmpType ) - { // beginning of keyword, stop scan and put back - eType = NF_SYMBOLTYPE_STRING; - eState = SsStop; - nPos--; - } - else - sSymbol += cToken; - } - else - { - BOOL bDontStop = FALSE; - switch (cToken) - { - case '/': // AM/PM, A/P - { - sal_Unicode cNext = rStr.GetChar(nPos); - if ( cNext == 'P' || cNext == 'p' ) - { - xub_StrLen nLen = sSymbol.Len(); - if ( 1 <= nLen - && (sSymbol.GetChar(0) == 'A' || sSymbol.GetChar(0) == 'a') - && (nLen == 1 || (nLen == 2 - && (sSymbol.GetChar(1) == 'M' || sSymbol.GetChar(1) == 'm') - && (rStr.GetChar(nPos+1) == 'M' || rStr.GetChar(nPos+1) == 'm'))) ) - { - sSymbol += cToken; - bDontStop = TRUE; - } - } - } - break; - } - // anything not recognized will stop the scan - if ( eState != SsStop && !bDontStop ) - { - eState = SsStop; - nPos--; - eType = NF_SYMBOLTYPE_STRING; - } - } - } - break; - case SsGetStar: - { - eState = SsStop; - sSymbol += cToken; - nRepPos = (nPos - nStart) - 1; // everytime > 0!! - } - break; - case SsGetBlank: - { - eState = SsStop; - sSymbol += cToken; - } - break; - default: - break; - } // of switch - } // of while - if (eState == SsGetWord) - eType = NF_SYMBOLTYPE_STRING; - return eType; -} - -xub_StrLen ImpSvNumberformatScan::Symbol_Division(const String& rString) -{ - nCurrPos = STRING_NOTFOUND; - // Ist Waehrung im Spiel? - String sString = pFormatter->GetCharClass()->upper(rString); - xub_StrLen nCPos = 0; - while (nCPos != STRING_NOTFOUND) - { - nCPos = sString.Search(GetCurString(),nCPos); - if (nCPos != STRING_NOTFOUND) - { - // in Quotes? - xub_StrLen nQ = SvNumberformat::GetQuoteEnd( sString, nCPos ); - if ( nQ == STRING_NOTFOUND ) - { - sal_Unicode c; - if ( nCPos == 0 || - ((c = sString.GetChar(xub_StrLen(nCPos-1))) != '"' - && c != '\\') ) // dm kann durch "dm - { // \d geschuetzt werden - nCurrPos = nCPos; - nCPos = STRING_NOTFOUND; // Abbruch - } - else - nCPos++; // weitersuchen - } - else - nCPos = nQ + 1; // weitersuchen - } - } - nAnzStrings = 0; - BOOL bStar = FALSE; // wird bei '*'Detektion gesetzt - Reset(); - - xub_StrLen nPos = 0; - const xub_StrLen nLen = rString.Len(); - while (nPos < nLen && nAnzStrings < NF_MAX_FORMAT_SYMBOLS) - { - nTypeArray[nAnzStrings] = Next_Symbol(rString, nPos, sStrArray[nAnzStrings]); - if (nTypeArray[nAnzStrings] == NF_SYMBOLTYPE_STAR) - { // Ueberwachung des '*' - if (bStar) - return nPos; // Fehler: doppelter '*' - else - bStar = TRUE; - } - nAnzStrings++; - } - - return 0; // 0 => ok -} - -void ImpSvNumberformatScan::SkipStrings(USHORT& i, xub_StrLen& nPos) -{ - while (i < nAnzStrings && ( nTypeArray[i] == NF_SYMBOLTYPE_STRING - || nTypeArray[i] == NF_SYMBOLTYPE_BLANK - || nTypeArray[i] == NF_SYMBOLTYPE_STAR) ) - { - nPos = nPos + sStrArray[i].Len(); - i++; - } -} - - -USHORT ImpSvNumberformatScan::PreviousKeyword(USHORT i) -{ - short res = 0; - if (i > 0 && i < nAnzStrings) - { - i--; - while (i > 0 && nTypeArray[i] <= 0) - i--; - if (nTypeArray[i] > 0) - res = nTypeArray[i]; - } - return res; -} - -USHORT ImpSvNumberformatScan::NextKeyword(USHORT i) -{ - short res = 0; - if (i < nAnzStrings-1) - { - i++; - while (i < nAnzStrings-1 && nTypeArray[i] <= 0) - i++; - if (nTypeArray[i] > 0) - res = nTypeArray[i]; - } - return res; -} - -short ImpSvNumberformatScan::PreviousType( USHORT i ) -{ - if ( i > 0 && i < nAnzStrings ) - { - do - { - i--; - } while ( i > 0 && nTypeArray[i] == NF_SYMBOLTYPE_EMPTY ); - return nTypeArray[i]; - } - return 0; -} - -sal_Unicode ImpSvNumberformatScan::PreviousChar(USHORT i) -{ - sal_Unicode res = ' '; - if (i > 0 && i < nAnzStrings) - { - i--; - while (i > 0 && ( nTypeArray[i] == NF_SYMBOLTYPE_EMPTY - || nTypeArray[i] == NF_SYMBOLTYPE_STRING - || nTypeArray[i] == NF_SYMBOLTYPE_STAR - || nTypeArray[i] == NF_SYMBOLTYPE_BLANK ) ) - i--; - if (sStrArray[i].Len() > 0) - res = sStrArray[i].GetChar(xub_StrLen(sStrArray[i].Len()-1)); - } - return res; -} - -sal_Unicode ImpSvNumberformatScan::NextChar(USHORT i) -{ - sal_Unicode res = ' '; - if (i < nAnzStrings-1) - { - i++; - while (i < nAnzStrings-1 && - ( nTypeArray[i] == NF_SYMBOLTYPE_EMPTY - || nTypeArray[i] == NF_SYMBOLTYPE_STRING - || nTypeArray[i] == NF_SYMBOLTYPE_STAR - || nTypeArray[i] == NF_SYMBOLTYPE_BLANK)) - i++; - if (sStrArray[i].Len() > 0) - res = sStrArray[i].GetChar(0); - } - return res; -} - -BOOL ImpSvNumberformatScan::IsLastBlankBeforeFrac(USHORT i) -{ - BOOL res = TRUE; - if (i < nAnzStrings-1) - { - BOOL bStop = FALSE; - i++; - while (i < nAnzStrings-1 && !bStop) - { - i++; - if ( nTypeArray[i] == NF_SYMBOLTYPE_DEL && - sStrArray[i].GetChar(0) == '/') - bStop = TRUE; - else if ( nTypeArray[i] == NF_SYMBOLTYPE_DEL && - sStrArray[i].GetChar(0) == ' ') - res = FALSE; - } - if (!bStop) // kein '/' - res = FALSE; - } - else - res = FALSE; // kein '/' mehr - - return res; -} - -void ImpSvNumberformatScan::Reset() -{ - nAnzStrings = 0; - nAnzResStrings = 0; -#if 0 -// ER 20.06.97 14:05 nicht noetig, wenn nAnzStrings beachtet wird - for (size_t i = 0; i < NF_MAX_FORMAT_SYMBOLS; i++) - { - sStrArray[i].Erase(); - nTypeArray[i] = 0; - } -#endif - eScannedType = NUMBERFORMAT_UNDEFINED; - nRepPos = 0; - bExp = FALSE; - bThousand = FALSE; - nThousand = 0; - bDecSep = FALSE; - nDecPos = -1; - nExpPos = (USHORT) -1; - nBlankPos = (USHORT) -1; - nCntPre = 0; - nCntPost = 0; - nCntExp = 0; - bFrac = FALSE; - bBlank = FALSE; - nNatNumModifier = 0; -} - - -BOOL ImpSvNumberformatScan::Is100SecZero( USHORT i, BOOL bHadDecSep ) -{ - USHORT nIndexPre = PreviousKeyword( i ); - return (nIndexPre == NF_KEY_S || nIndexPre == NF_KEY_SS) - && (bHadDecSep // S, SS ',' - || (i>0 && nTypeArray[i-1] == NF_SYMBOLTYPE_STRING)); - // SS"any"00 take "any" as a valid decimal separator -} - - -xub_StrLen ImpSvNumberformatScan::ScanType(const String&) -{ - const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData(); - - xub_StrLen nPos = 0; - USHORT i = 0; - short eNewType; - BOOL bMatchBracket = FALSE; - bool bHaveGeneral = false; // if General/Standard encountered - - SkipStrings(i, nPos); - while (i < nAnzStrings) - { - if (nTypeArray[i] > 0) - { // keyword - switch (nTypeArray[i]) - { - case NF_KEY_E: // E - eNewType = NUMBERFORMAT_SCIENTIFIC; - break; - case NF_KEY_AMPM: // AM,A,PM,P - case NF_KEY_AP: - case NF_KEY_H: // H - case NF_KEY_HH: // HH - case NF_KEY_S: // S - case NF_KEY_SS: // SS - eNewType = NUMBERFORMAT_TIME; - break; - case NF_KEY_M: // M - case NF_KEY_MM: // MM - { // minute or month - USHORT nIndexPre = PreviousKeyword(i); - USHORT nIndexNex = NextKeyword(i); - sal_Unicode cChar = PreviousChar(i); - if (nIndexPre == NF_KEY_H || // H - nIndexPre == NF_KEY_HH || // HH - nIndexNex == NF_KEY_S || // S - nIndexNex == NF_KEY_SS || // SS - cChar == '[' ) // [M - { - eNewType = NUMBERFORMAT_TIME; - nTypeArray[i] -= 2; // 6 -> 4, 7 -> 5 - } - else - eNewType = NUMBERFORMAT_DATE; - } - break; - case NF_KEY_MMM: // MMM - case NF_KEY_MMMM: // MMMM - case NF_KEY_MMMMM: // MMMMM - case NF_KEY_Q: // Q - case NF_KEY_QQ: // QQ - case NF_KEY_D: // D - case NF_KEY_DD: // DD - case NF_KEY_DDD: // DDD - case NF_KEY_DDDD: // DDDD - case NF_KEY_YY: // YY - case NF_KEY_YYYY: // YYYY - case NF_KEY_NN: // NN - case NF_KEY_NNN: // NNN - case NF_KEY_NNNN: // NNNN - case NF_KEY_WW : // WW - case NF_KEY_AAA : // AAA - case NF_KEY_AAAA : // AAAA - case NF_KEY_EC : // E - case NF_KEY_EEC : // EE - case NF_KEY_G : // G - case NF_KEY_GG : // GG - case NF_KEY_GGG : // GGG - case NF_KEY_R : // R - case NF_KEY_RR : // RR - eNewType = NUMBERFORMAT_DATE; - break; - case NF_KEY_CCC: // CCC - eNewType = NUMBERFORMAT_CURRENCY; - break; - case NF_KEY_GENERAL: // Standard - eNewType = NUMBERFORMAT_NUMBER; - bHaveGeneral = true; - break; - default: - eNewType = NUMBERFORMAT_UNDEFINED; - break; - } - } - else - { // control character - switch ( sStrArray[i].GetChar(0) ) - { - case '#': - case '?': - eNewType = NUMBERFORMAT_NUMBER; - break; - case '0': - { - if ( (eScannedType & NUMBERFORMAT_TIME) == NUMBERFORMAT_TIME ) - { - if ( Is100SecZero( i, bDecSep ) ) - { - bDecSep = TRUE; // subsequent 0's - eNewType = NUMBERFORMAT_TIME; - } - else - return nPos; // Error - } - else - eNewType = NUMBERFORMAT_NUMBER; - } - break; - case '%': - eNewType = NUMBERFORMAT_PERCENT; - break; - case '/': - eNewType = NUMBERFORMAT_FRACTION; - break; - case '[': - { - if ( i < nAnzStrings-1 && - nTypeArray[i+1] == NF_SYMBOLTYPE_STRING && - sStrArray[i+1].GetChar(0) == '$' ) - { // as of SV_NUMBERFORMATTER_VERSION_NEW_CURR - eNewType = NUMBERFORMAT_CURRENCY; - bMatchBracket = TRUE; - } - else if ( i < nAnzStrings-1 && - nTypeArray[i+1] == NF_SYMBOLTYPE_STRING && - sStrArray[i+1].GetChar(0) == '~' ) - { // as of SV_NUMBERFORMATTER_VERSION_CALENDAR - eNewType = NUMBERFORMAT_DATE; - bMatchBracket = TRUE; - } - else - { - USHORT nIndexNex = NextKeyword(i); - if (nIndexNex == NF_KEY_H || // H - nIndexNex == NF_KEY_HH || // HH - nIndexNex == NF_KEY_M || // M - nIndexNex == NF_KEY_MM || // MM - nIndexNex == NF_KEY_S || // S - nIndexNex == NF_KEY_SS ) // SS - eNewType = NUMBERFORMAT_TIME; - else - return nPos; // Error - } - } - break; - case '@': - eNewType = NUMBERFORMAT_TEXT; - break; - default: - if ( sStrArray[i] == pLoc->getTime100SecSep() ) - bDecSep = TRUE; // for SS,0 - eNewType = NUMBERFORMAT_UNDEFINED; - break; - } - } - if (eScannedType == NUMBERFORMAT_UNDEFINED) - eScannedType = eNewType; - else if (eScannedType == NUMBERFORMAT_TEXT || eNewType == NUMBERFORMAT_TEXT) - eScannedType = NUMBERFORMAT_TEXT; // Text bleibt immer Text - else if (eNewType == NUMBERFORMAT_UNDEFINED) - { // bleibt wie bisher - } - else if (eScannedType != eNewType) - { - switch (eScannedType) - { - case NUMBERFORMAT_DATE: - { - switch (eNewType) - { - case NUMBERFORMAT_TIME: - eScannedType = NUMBERFORMAT_DATETIME; - break; - case NUMBERFORMAT_FRACTION: // DD/MM - break; - default: - { - if (nCurrPos != STRING_NOTFOUND) - eScannedType = NUMBERFORMAT_UNDEFINED; - else if ( sStrArray[i] != pFormatter->GetDateSep() ) - return nPos; - } - } - } - break; - case NUMBERFORMAT_TIME: - { - switch (eNewType) - { - case NUMBERFORMAT_DATE: - eScannedType = NUMBERFORMAT_DATETIME; - break; - case NUMBERFORMAT_FRACTION: // MM/SS - break; - default: - { - if (nCurrPos != STRING_NOTFOUND) - eScannedType = NUMBERFORMAT_UNDEFINED; - else if ( sStrArray[i] != pLoc->getTimeSep() ) - return nPos; - } - } - } - break; - case NUMBERFORMAT_DATETIME: - { - switch (eNewType) - { - case NUMBERFORMAT_TIME: - case NUMBERFORMAT_DATE: - break; - case NUMBERFORMAT_FRACTION: // DD/MM - break; - default: - { - if (nCurrPos != STRING_NOTFOUND) - eScannedType = NUMBERFORMAT_UNDEFINED; - else if ( sStrArray[i] != pFormatter->GetDateSep() - && sStrArray[i] != pLoc->getTimeSep() ) - return nPos; - } - } - } - break; - case NUMBERFORMAT_PERCENT: - { - switch (eNewType) - { - case NUMBERFORMAT_NUMBER: // nur Zahl nach Prozent - break; - default: - return nPos; - } - } - break; - case NUMBERFORMAT_SCIENTIFIC: - { - switch (eNewType) - { - case NUMBERFORMAT_NUMBER: // nur Zahl nach E - break; - default: - return nPos; - } - } - break; - case NUMBERFORMAT_NUMBER: - { - switch (eNewType) - { - case NUMBERFORMAT_SCIENTIFIC: - case NUMBERFORMAT_PERCENT: - case NUMBERFORMAT_FRACTION: - case NUMBERFORMAT_CURRENCY: - eScannedType = eNewType; - break; - default: - if (nCurrPos != STRING_NOTFOUND) - eScannedType = NUMBERFORMAT_UNDEFINED; - else - return nPos; - } - } - break; - case NUMBERFORMAT_FRACTION: - { - switch (eNewType) - { - case NUMBERFORMAT_NUMBER: // nur Zahl nach Bruch - break; - default: - return nPos; - } - } - break; - default: - break; - } - } - nPos = nPos + sStrArray[i].Len(); // Korrekturposition - i++; - if ( bMatchBracket ) - { // no type detection inside of matching brackets if [$...], [~...] - while ( bMatchBracket && i < nAnzStrings ) - { - if ( nTypeArray[i] == NF_SYMBOLTYPE_DEL - && sStrArray[i].GetChar(0) == ']' ) - bMatchBracket = FALSE; - else - nTypeArray[i] = NF_SYMBOLTYPE_STRING; - nPos = nPos + sStrArray[i].Len(); - i++; - } - if ( bMatchBracket ) - return nPos; // missing closing bracket at end of code - } - SkipStrings(i, nPos); - } - - if ((eScannedType == NUMBERFORMAT_NUMBER || eScannedType == NUMBERFORMAT_UNDEFINED) - && nCurrPos != STRING_NOTFOUND && !bHaveGeneral) - eScannedType = NUMBERFORMAT_CURRENCY; // old "automatic" currency - if (eScannedType == NUMBERFORMAT_UNDEFINED) - eScannedType = NUMBERFORMAT_DEFINED; - return 0; // Alles ok -} - - -bool ImpSvNumberformatScan::InsertSymbol( USHORT & nPos, svt::NfSymbolType eType, const String& rStr ) -{ - if (nAnzStrings >= NF_MAX_FORMAT_SYMBOLS || nPos > nAnzStrings) - return false; - ++nAnzResStrings; - if (nPos > 0 && nTypeArray[nPos-1] == NF_SYMBOLTYPE_EMPTY) - --nPos; // reuse position - else - { - ++nAnzStrings; - for (size_t i = nAnzStrings; i > nPos; --i) - { - nTypeArray[i] = nTypeArray[i-1]; - sStrArray[i] = sStrArray[i-1]; - } - } - nTypeArray[nPos] = static_cast(eType); - sStrArray[nPos] = rStr; - return true; -} - - -int ImpSvNumberformatScan::FinalScanGetCalendar( xub_StrLen& nPos, USHORT& i, - USHORT& rAnzResStrings ) -{ - if ( sStrArray[i].GetChar(0) == '[' && - i < nAnzStrings-1 && - nTypeArray[i+1] == NF_SYMBOLTYPE_STRING && - sStrArray[i+1].GetChar(0) == '~' ) - { // [~calendarID] - // as of SV_NUMBERFORMATTER_VERSION_CALENDAR - nPos = nPos + sStrArray[i].Len(); // [ - nTypeArray[i] = NF_SYMBOLTYPE_CALDEL; - nPos = nPos + sStrArray[++i].Len(); // ~ - sStrArray[i-1] += sStrArray[i]; // [~ - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - rAnzResStrings--; - if ( ++i >= nAnzStrings ) - return -1; // error - nPos = nPos + sStrArray[i].Len(); // calendarID - String& rStr = sStrArray[i]; - nTypeArray[i] = NF_SYMBOLTYPE_CALENDAR; // convert - i++; - while ( i < nAnzStrings && - sStrArray[i].GetChar(0) != ']' ) - { - nPos = nPos + sStrArray[i].Len(); - rStr += sStrArray[i]; - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - rAnzResStrings--; - i++; - } - if ( rStr.Len() && i < nAnzStrings && - sStrArray[i].GetChar(0) == ']' ) - { - nTypeArray[i] = NF_SYMBOLTYPE_CALDEL; - nPos = nPos + sStrArray[i].Len(); - i++; - } - else - return -1; // error - return 1; - } - return 0; -} - -xub_StrLen ImpSvNumberformatScan::FinalScan( String& rString, String& rComment ) -{ - const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData(); - - // save values for convert mode - String sOldDecSep = pFormatter->GetNumDecimalSep(); - String sOldThousandSep = pFormatter->GetNumThousandSep(); - String sOldDateSep = pFormatter->GetDateSep(); - String sOldTimeSep = pLoc->getTimeSep(); - String sOldTime100SecSep= pLoc->getTime100SecSep(); - String sOldCurSymbol = GetCurSymbol(); - String sOldCurString = GetCurString(); - sal_Unicode cOldKeyH = sKeyword[NF_KEY_H].GetChar(0); - sal_Unicode cOldKeyMI = sKeyword[NF_KEY_MI].GetChar(0); - sal_Unicode cOldKeyS = sKeyword[NF_KEY_S].GetChar(0); - - // If the group separator is a Non-Breaking Space (French) continue with a - // normal space instead so queries on space work correctly. - // The format string is adjusted to allow both. - // For output of the format code string the LocaleData characters are used. - if ( sOldThousandSep.GetChar(0) == cNonBreakingSpace && sOldThousandSep.Len() == 1 ) - sOldThousandSep = ' '; - - // change locale data et al - if (bConvertMode) - { - pFormatter->ChangeIntl(eNewLnge); - //! pointer may have changed - pLoc = pFormatter->GetLocaleData(); - //! init new keywords - InitKeywords(); - } - const CharClass* pChrCls = pFormatter->GetCharClass(); - - xub_StrLen nPos = 0; // error correction position - USHORT i = 0; // symbol loop counter - USHORT nCounter = 0; // counts digits - nAnzResStrings = nAnzStrings; // counts remaining symbols - bDecSep = FALSE; // reset in case already used in TypeCheck - bool bThaiT = false; // Thai T NatNum modifier present - - switch (eScannedType) - { - case NUMBERFORMAT_TEXT: - case NUMBERFORMAT_DEFINED: - { - while (i < nAnzStrings) - { - switch (nTypeArray[i]) - { - case NF_SYMBOLTYPE_BLANK: - case NF_SYMBOLTYPE_STAR: - break; - case NF_SYMBOLTYPE_COMMENT: - { - String& rStr = sStrArray[i]; - nPos = nPos + rStr.Len(); - SvNumberformat::EraseCommentBraces( rStr ); - rComment += rStr; - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - } - break; - case NF_KEY_GENERAL : // #77026# "General" is the same as "@" - break; - default: - { - if ( nTypeArray[i] != NF_SYMBOLTYPE_DEL || - sStrArray[i].GetChar(0) != '@' ) - nTypeArray[i] = NF_SYMBOLTYPE_STRING; - } - break; - } - nPos = nPos + sStrArray[i].Len(); - i++; - } // of while - } - break; - case NUMBERFORMAT_NUMBER: - case NUMBERFORMAT_PERCENT: - case NUMBERFORMAT_CURRENCY: - case NUMBERFORMAT_SCIENTIFIC: - case NUMBERFORMAT_FRACTION: - { - sal_Unicode cThousandFill = ' '; - while (i < nAnzStrings) - { - if (eScannedType == NUMBERFORMAT_FRACTION && // special case - nTypeArray[i] == NF_SYMBOLTYPE_DEL && // # ### #/# - StringEqualsChar( sOldThousandSep, ' ' ) && // e.g. France or Sweden - StringEqualsChar( sStrArray[i], ' ' ) && - !bFrac && - IsLastBlankBeforeFrac(i) ) - { - nTypeArray[i] = NF_SYMBOLTYPE_STRING; // del->string - } // kein Taus.p. - - - if (nTypeArray[i] == NF_SYMBOLTYPE_BLANK || - nTypeArray[i] == NF_SYMBOLTYPE_STAR || - nTypeArray[i] == NF_KEY_CCC || // CCC - nTypeArray[i] == NF_KEY_GENERAL ) // Standard - { - if (nTypeArray[i] == NF_KEY_GENERAL) - { - nThousand = FLAG_STANDARD_IN_FORMAT; - if ( bConvertMode ) - sStrArray[i] = sNameStandardFormat; - } - nPos = nPos + sStrArray[i].Len(); - i++; - } - else if (nTypeArray[i] == NF_SYMBOLTYPE_STRING || // Strings oder - nTypeArray[i] > 0) // Keywords - { - if (eScannedType == NUMBERFORMAT_SCIENTIFIC && - nTypeArray[i] == NF_KEY_E) // E+ - { - if (bExp) // doppelt - return nPos; - bExp = TRUE; - nExpPos = i; - if (bDecSep) - nCntPost = nCounter; - else - nCntPre = nCounter; - nCounter = 0; - nTypeArray[i] = NF_SYMBOLTYPE_EXP; - } - else if (eScannedType == NUMBERFORMAT_FRACTION && - sStrArray[i].GetChar(0) == ' ') - { - if (!bBlank && !bFrac) // nicht doppelt oder hinter / - { - if (bDecSep && nCounter > 0) // Nachkommastellen - return nPos; // Fehler - bBlank = TRUE; - nBlankPos = i; - nCntPre = nCounter; - nCounter = 0; - } - nTypeArray[i] = NF_SYMBOLTYPE_FRACBLANK; - } - else if (nTypeArray[i] == NF_KEY_THAI_T) - { - bThaiT = true; - sStrArray[i] = sKeyword[nTypeArray[i]]; - } - else - nTypeArray[i] = NF_SYMBOLTYPE_STRING; - nPos = nPos + sStrArray[i].Len(); - i++; - } - else if (nTypeArray[i] == NF_SYMBOLTYPE_DEL) - { - sal_Unicode cHere = sStrArray[i].GetChar(0); - // Handle not pre-known separators in switch. - sal_Unicode cSimplified; - if (StringEqualsChar( pFormatter->GetNumThousandSep(), cHere)) - cSimplified = ','; - else if (StringEqualsChar( pFormatter->GetNumDecimalSep(), cHere)) - cSimplified = '.'; - else - cSimplified = cHere; - switch ( cSimplified ) - { - case '#': - case '0': - case '?': - { - if (nThousand > 0) // #... # - return nPos; // Fehler - else if (bFrac && cHere == '0') - return nPos; // 0 im Nenner - nTypeArray[i] = NF_SYMBOLTYPE_DIGIT; - String& rStr = sStrArray[i]; - nPos = nPos + rStr.Len(); - i++; - nCounter++; - while (i < nAnzStrings && - (sStrArray[i].GetChar(0) == '#' || - sStrArray[i].GetChar(0) == '0' || - sStrArray[i].GetChar(0) == '?') - ) - { - nTypeArray[i] = NF_SYMBOLTYPE_DIGIT; - nPos = nPos + sStrArray[i].Len(); - nCounter++; - i++; - } - } - break; - case '-': - { - if ( bDecSep && nDecPos+1 == i && - nTypeArray[nDecPos] == NF_SYMBOLTYPE_DECSEP ) - { // "0.--" - nTypeArray[i] = NF_SYMBOLTYPE_DIGIT; - String& rStr = sStrArray[i]; - nPos = nPos + rStr.Len(); - i++; - nCounter++; - while (i < nAnzStrings && - (sStrArray[i].GetChar(0) == '-') ) - { - // If more than two dashes are present in - // currency formats the last dash will be - // interpreted literally as a minus sign. - // Has to be this ugly. Period. - if ( eScannedType == NUMBERFORMAT_CURRENCY - && rStr.Len() >= 2 && - (i == nAnzStrings-1 || - sStrArray[i+1].GetChar(0) != '-') ) - break; - rStr += sStrArray[i]; - nPos = nPos + sStrArray[i].Len(); - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - nCounter++; - i++; - } - } - else - { - nTypeArray[i] = NF_SYMBOLTYPE_STRING; - nPos = nPos + sStrArray[i].Len(); - i++; - } - } - break; - case '.': - case ',': - case '\'': - case ' ': - { - sal_Unicode cSep = cHere; // remember - if ( StringEqualsChar( sOldThousandSep, cSep ) ) - { - // previous char with skip empty - sal_Unicode cPre = PreviousChar(i); - sal_Unicode cNext; - if (bExp || bBlank || bFrac) - { // after E, / or ' ' - if ( !StringEqualsChar( sOldThousandSep, ' ' ) ) - { - nPos = nPos + sStrArray[i].Len(); - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - i++; // eat it - } - else - nTypeArray[i] = NF_SYMBOLTYPE_STRING; - } - else if (i > 0 && i < nAnzStrings-1 && - (cPre == '#' || cPre == '0') && - ((cNext = NextChar(i)) == '#' || cNext == '0') - ) // #,# - { - nPos = nPos + sStrArray[i].Len(); - if (!bThousand) // only once - { - bThousand = TRUE; - cThousandFill = sStrArray[i+1].GetChar(0); - } - // Eat it, will be reinserted at proper - // grouping positions further down. - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - i++; - } - else if (i > 0 && (cPre == '#' || cPre == '0') - && PreviousType(i) == NF_SYMBOLTYPE_DIGIT - && nThousand < FLAG_STANDARD_IN_FORMAT ) - { // #,,,, - if ( StringEqualsChar( sOldThousandSep, ' ' ) ) - { // strange, those French.. - BOOL bFirst = TRUE; - String& rStr = sStrArray[i]; - // set a hard Non-Breaking Space or ConvertMode - const String& rSepF = pFormatter->GetNumThousandSep(); - while ( i < nAnzStrings - && sStrArray[i] == sOldThousandSep - && StringEqualsChar( sOldThousandSep, NextChar(i) ) ) - { // last was a space or another space - // is following => separator - nPos = nPos + sStrArray[i].Len(); - if ( bFirst ) - { - bFirst = FALSE; - rStr = rSepF; - nTypeArray[i] = NF_SYMBOLTYPE_THSEP; - } - else - { - rStr += rSepF; - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - } - nThousand++; - i++; - } - if ( i < nAnzStrings-1 - && sStrArray[i] == sOldThousandSep ) - { // something following last space - // => space if currency contained, - // else separator - nPos = nPos + sStrArray[i].Len(); - if ( (nPos <= nCurrPos && - nCurrPos < nPos + sStrArray[i+1].Len()) - || nTypeArray[i+1] == NF_KEY_CCC - || (i < nAnzStrings-2 && - sStrArray[i+1].GetChar(0) == '[' && - sStrArray[i+2].GetChar(0) == '$') ) - { - nTypeArray[i] = NF_SYMBOLTYPE_STRING; - } - else - { - if ( bFirst ) - { - bFirst = FALSE; - rStr = rSepF; - nTypeArray[i] = NF_SYMBOLTYPE_THSEP; - } - else - { - rStr += rSepF; - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - } - nThousand++; - } - i++; - } - } - else - { - do - { - nThousand++; - nTypeArray[i] = NF_SYMBOLTYPE_THSEP; - nPos = nPos + sStrArray[i].Len(); - sStrArray[i] = pFormatter->GetNumThousandSep(); - i++; - } while (i < nAnzStrings && - sStrArray[i] == sOldThousandSep); - } - } - else // any grsep - { - nTypeArray[i] = NF_SYMBOLTYPE_STRING; - String& rStr = sStrArray[i]; - nPos = nPos + rStr.Len(); - i++; - while ( i < nAnzStrings && - sStrArray[i] == sOldThousandSep ) - { - rStr += sStrArray[i]; - nPos = nPos + sStrArray[i].Len(); - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - i++; - } - } - } - else if ( StringEqualsChar( sOldDecSep, cSep ) ) - { - if (bBlank || bFrac) // . behind / or ' ' - return nPos; // error - else if (bExp) // behind E - { - nPos = nPos + sStrArray[i].Len(); - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - i++; // eat it - } - else if (bDecSep) // any . - { - nTypeArray[i] = NF_SYMBOLTYPE_STRING; - String& rStr = sStrArray[i]; - nPos = nPos + rStr.Len(); - i++; - while ( i < nAnzStrings && - sStrArray[i] == sOldDecSep ) - { - rStr += sStrArray[i]; - nPos = nPos + sStrArray[i].Len(); - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - i++; - } - } - else - { - nPos = nPos + sStrArray[i].Len(); - nTypeArray[i] = NF_SYMBOLTYPE_DECSEP; - sStrArray[i] = pFormatter->GetNumDecimalSep(); - bDecSep = TRUE; - nDecPos = i; - nCntPre = nCounter; - nCounter = 0; - - i++; - } - } // of else = DecSep - else // . without meaning - { - if (cSep == ' ' && - eScannedType == NUMBERFORMAT_FRACTION && - StringEqualsChar( sStrArray[i], ' ' ) ) - { - if (!bBlank && !bFrac) // no dups - { // or behind / - if (bDecSep && nCounter > 0)// dec. - return nPos; // error - bBlank = TRUE; - nBlankPos = i; - nCntPre = nCounter; - nCounter = 0; - } - nTypeArray[i] = NF_SYMBOLTYPE_STRING; - nPos = nPos + sStrArray[i].Len(); - } - else - { - nTypeArray[i] = NF_SYMBOLTYPE_STRING; - String& rStr = sStrArray[i]; - nPos = nPos + rStr.Len(); - i++; - while (i < nAnzStrings && - StringEqualsChar( sStrArray[i], cSep ) ) - { - rStr += sStrArray[i]; - nPos = nPos + sStrArray[i].Len(); - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - i++; - } - } - } - } - break; - case '/': - { - if (eScannedType == NUMBERFORMAT_FRACTION) - { - if ( i == 0 || - (nTypeArray[i-1] != NF_SYMBOLTYPE_DIGIT && - nTypeArray[i-1] != NF_SYMBOLTYPE_EMPTY) ) - return nPos ? nPos : 1; // /? not allowed - else if (!bFrac || (bDecSep && nCounter > 0)) - { - bFrac = TRUE; - nCntPost = nCounter; - nCounter = 0; - nTypeArray[i] = NF_SYMBOLTYPE_FRAC; - nPos = nPos + sStrArray[i].Len(); - i++; - } - else // / doppelt od. , imZaehl - return nPos; // Fehler - } - else - { - nTypeArray[i] = NF_SYMBOLTYPE_STRING; - nPos = nPos + sStrArray[i].Len(); - i++; - } - } - break; - case '[' : - { - if ( eScannedType == NUMBERFORMAT_CURRENCY && - i < nAnzStrings-1 && - nTypeArray[i+1] == NF_SYMBOLTYPE_STRING && - sStrArray[i+1].GetChar(0) == '$' ) - { // [$DM-xxx] - // ab SV_NUMBERFORMATTER_VERSION_NEW_CURR - nPos = nPos + sStrArray[i].Len(); // [ - nTypeArray[i] = NF_SYMBOLTYPE_CURRDEL; - nPos = nPos + sStrArray[++i].Len(); // $ - sStrArray[i-1] += sStrArray[i]; // [$ - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - if ( ++i >= nAnzStrings ) - return nPos; // Fehler - nPos = nPos + sStrArray[i].Len(); // DM - String& rStr = sStrArray[i]; - String* pStr = &sStrArray[i]; - nTypeArray[i] = NF_SYMBOLTYPE_CURRENCY; // wandeln - BOOL bHadDash = FALSE; - i++; - while ( i < nAnzStrings && - sStrArray[i].GetChar(0) != ']' ) - { - nPos = nPos + sStrArray[i].Len(); - if ( bHadDash ) - { - *pStr += sStrArray[i]; - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - } - else - { - if ( sStrArray[i].GetChar(0) == '-' ) - { - bHadDash = TRUE; - pStr = &sStrArray[i]; - nTypeArray[i] = NF_SYMBOLTYPE_CURREXT; - } - else - { - *pStr += sStrArray[i]; - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - } - } - i++; - } - if ( rStr.Len() && i < nAnzStrings && - sStrArray[i].GetChar(0) == ']' ) - { - nTypeArray[i] = NF_SYMBOLTYPE_CURRDEL; - nPos = nPos + sStrArray[i].Len(); - i++; - } - else - return nPos; // Fehler - } - else - { - nTypeArray[i] = NF_SYMBOLTYPE_STRING; - nPos = nPos + sStrArray[i].Len(); - i++; - } - } - break; - default: // andere Dels - { - if (eScannedType == NUMBERFORMAT_PERCENT && - cHere == '%') - nTypeArray[i] = NF_SYMBOLTYPE_PERCENT; - else - nTypeArray[i] = NF_SYMBOLTYPE_STRING; - nPos = nPos + sStrArray[i].Len(); - i++; - } - break; - } // of switch (Del) - } // of else Del - else if ( nTypeArray[i] == NF_SYMBOLTYPE_COMMENT ) - { - String& rStr = sStrArray[i]; - nPos = nPos + rStr.Len(); - SvNumberformat::EraseCommentBraces( rStr ); - rComment += rStr; - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - i++; - } - else - { - DBG_ERRORFILE( "unknown NF_SYMBOLTYPE_..." ); - nPos = nPos + sStrArray[i].Len(); - i++; - } - } // of while - if (eScannedType == NUMBERFORMAT_FRACTION) - { - if (bFrac) - nCntExp = nCounter; - else if (bBlank) - nCntPost = nCounter; - else - nCntPre = nCounter; - } - else - { - if (bExp) - nCntExp = nCounter; - else if (bDecSep) - nCntPost = nCounter; - else - nCntPre = nCounter; - } - if (bThousand) // Expansion of grouping separators - { - USHORT nMaxPos; - if (bFrac) - { - if (bBlank) - nMaxPos = nBlankPos; - else - nMaxPos = 0; // no grouping - } - else if (bDecSep) // decimal separator present - nMaxPos = nDecPos; - else if (bExp) // 'E' exponent present - nMaxPos = nExpPos; - else // up to end - nMaxPos = i; - // Insert separators at proper positions. - xub_StrLen nCount = 0; - utl::DigitGroupingIterator aGrouping( pLoc->getDigitGrouping()); - size_t nFirstDigitSymbol = nMaxPos; - size_t nFirstGroupingSymbol = nMaxPos; - i = nMaxPos; - while (i-- > 0) - { - if (nTypeArray[i] == NF_SYMBOLTYPE_DIGIT) - { - nFirstDigitSymbol = i; - nCount = nCount + sStrArray[i].Len(); // MSC converts += to int and then warns, so ... - // Insert separator only if not leftmost symbol. - if (i > 0 && nCount >= aGrouping.getPos()) - { - DBG_ASSERT( sStrArray[i].Len() == 1, - "ImpSvNumberformatScan::FinalScan: combined digits in group separator insertion"); - if (!InsertSymbol( i, NF_SYMBOLTYPE_THSEP, - pFormatter->GetNumThousandSep())) - // nPos isn't correct here, but signals error - return nPos; - // i may have been decremented by 1 - nFirstDigitSymbol = i + 1; - nFirstGroupingSymbol = i; - aGrouping.advance(); - } - } - } - // Generated something like "string",000; remove separator again. - if (nFirstGroupingSymbol < nFirstDigitSymbol) - { - nTypeArray[nFirstGroupingSymbol] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - } - } - // Combine digits into groups to save memory (Info will be copied - // later, taking only non-empty symbols). - for (i = 0; i < nAnzStrings; ++i) - { - if (nTypeArray[i] == NF_SYMBOLTYPE_DIGIT) - { - String& rStr = sStrArray[i]; - while (++i < nAnzStrings && - nTypeArray[i] == NF_SYMBOLTYPE_DIGIT) - { - rStr += sStrArray[i]; - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - } - } - } - } - break; // of NUMBERFORMAT_NUMBER - case NUMBERFORMAT_DATE: - { - while (i < nAnzStrings) - { - switch (nTypeArray[i]) - { - case NF_SYMBOLTYPE_BLANK: - case NF_SYMBOLTYPE_STAR: - case NF_SYMBOLTYPE_STRING: - nPos = nPos + sStrArray[i].Len(); - i++; - break; - case NF_SYMBOLTYPE_COMMENT: - { - String& rStr = sStrArray[i]; - nPos = nPos + rStr.Len(); - SvNumberformat::EraseCommentBraces( rStr ); - rComment += rStr; - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - i++; - } - break; - case NF_SYMBOLTYPE_DEL: - { - int nCalRet; - if (sStrArray[i] == sOldDateSep) - { - nTypeArray[i] = NF_SYMBOLTYPE_DATESEP; - nPos = nPos + sStrArray[i].Len(); - if (bConvertMode) - sStrArray[i] = pFormatter->GetDateSep(); - i++; - } - else if ( (nCalRet = FinalScanGetCalendar( nPos, i, nAnzResStrings )) != 0 ) - { - if ( nCalRet < 0 ) - return nPos; // error - } - else - { - nTypeArray[i] = NF_SYMBOLTYPE_STRING; - nPos = nPos + sStrArray[i].Len(); - i++; - } - } - break; - case NF_KEY_THAI_T : - bThaiT = true; - // fall thru - case NF_KEY_M: // M - case NF_KEY_MM: // MM - case NF_KEY_MMM: // MMM - case NF_KEY_MMMM: // MMMM - case NF_KEY_MMMMM: // MMMMM - case NF_KEY_Q: // Q - case NF_KEY_QQ: // QQ - case NF_KEY_D: // D - case NF_KEY_DD: // DD - case NF_KEY_DDD: // DDD - case NF_KEY_DDDD: // DDDD - case NF_KEY_YY: // YY - case NF_KEY_YYYY: // YYYY - case NF_KEY_NN: // NN - case NF_KEY_NNN: // NNN - case NF_KEY_NNNN: // NNNN - case NF_KEY_WW : // WW - case NF_KEY_AAA : // AAA - case NF_KEY_AAAA : // AAAA - case NF_KEY_EC : // E - case NF_KEY_EEC : // EE - case NF_KEY_G : // G - case NF_KEY_GG : // GG - case NF_KEY_GGG : // GGG - case NF_KEY_R : // R - case NF_KEY_RR : // RR - sStrArray[i] = sKeyword[nTypeArray[i]]; // tTtT -> TTTT - nPos = nPos + sStrArray[i].Len(); - i++; - break; - default: // andere Keywords - nTypeArray[i] = NF_SYMBOLTYPE_STRING; - nPos = nPos + sStrArray[i].Len(); - i++; - break; - } - } // of while - } - break; // of NUMBERFORMAT_DATE - case NUMBERFORMAT_TIME: - { - while (i < nAnzStrings) - { - switch (nTypeArray[i]) - { - case NF_SYMBOLTYPE_BLANK: - case NF_SYMBOLTYPE_STAR: - { - nPos = nPos + sStrArray[i].Len(); - i++; - } - break; - case NF_SYMBOLTYPE_DEL: - { - switch( sStrArray[i].GetChar(0) ) - { - case '0': - { - if ( Is100SecZero( i, bDecSep ) ) - { - bDecSep = TRUE; - nTypeArray[i] = NF_SYMBOLTYPE_DIGIT; - String& rStr = sStrArray[i]; - i++; - nPos = nPos + sStrArray[i].Len(); - nCounter++; - while (i < nAnzStrings && - sStrArray[i].GetChar(0) == '0') - { - rStr += sStrArray[i]; - nPos = nPos + sStrArray[i].Len(); - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - nCounter++; - i++; - } - } - else - return nPos; - } - break; - case '#': - case '?': - return nPos; - case '[': - { - if (bThousand) // doppelt - return nPos; - bThousand = TRUE; // bei Time frei - sal_Unicode cChar = pChrCls->upper( NextChar(i) ).GetChar(0); - if ( cChar == cOldKeyH ) - nThousand = 1; // H - else if ( cChar == cOldKeyMI ) - nThousand = 2; // M - else if ( cChar == cOldKeyS ) - nThousand = 3; // S - else - return nPos; - nPos = nPos + sStrArray[i].Len(); - i++; - } - break; - case ']': - { - if (!bThousand) // kein [ vorher - return nPos; - nPos = nPos + sStrArray[i].Len(); - i++; - } - break; - default: - { - nPos = nPos + sStrArray[i].Len(); - if ( sStrArray[i] == sOldTimeSep ) - { - nTypeArray[i] = NF_SYMBOLTYPE_TIMESEP; - if ( bConvertMode ) - sStrArray[i] = pLoc->getTimeSep(); - } - else if ( sStrArray[i] == sOldTime100SecSep ) - { - bDecSep = TRUE; - nTypeArray[i] = NF_SYMBOLTYPE_TIME100SECSEP; - if ( bConvertMode ) - sStrArray[i] = pLoc->getTime100SecSep(); - } - else - nTypeArray[i] = NF_SYMBOLTYPE_STRING; - i++; - } - break; - } - } - break; - case NF_SYMBOLTYPE_STRING: - { - nPos = nPos + sStrArray[i].Len(); - i++; - } - break; - case NF_SYMBOLTYPE_COMMENT: - { - String& rStr = sStrArray[i]; - nPos = nPos + rStr.Len(); - SvNumberformat::EraseCommentBraces( rStr ); - rComment += rStr; - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - i++; - } - break; - case NF_KEY_AMPM: // AM/PM - case NF_KEY_AP: // A/P - { - bExp = TRUE; // missbraucht fuer A/P - sStrArray[i] = sKeyword[nTypeArray[i]]; // tTtT -> TTTT - nPos = nPos + sStrArray[i].Len(); - i++; - } - break; - case NF_KEY_THAI_T : - bThaiT = true; - // fall thru - case NF_KEY_MI: // M - case NF_KEY_MMI: // MM - case NF_KEY_H: // H - case NF_KEY_HH: // HH - case NF_KEY_S: // S - case NF_KEY_SS: // SS - { - sStrArray[i] = sKeyword[nTypeArray[i]]; // tTtT -> TTTT - nPos = nPos + sStrArray[i].Len(); - i++; - } - break; - default: // andere Keywords - { - nTypeArray[i] = NF_SYMBOLTYPE_STRING; - nPos = nPos + sStrArray[i].Len(); - i++; - } - break; - } - } // of while - nCntPost = nCounter; // Zaehler der Nullen - if (bExp) - nCntExp = 1; // merkt AM/PM - } - break; // of NUMBERFORMAT_TIME - case NUMBERFORMAT_DATETIME: - { - BOOL bTimePart = FALSE; - while (i < nAnzStrings) - { - switch (nTypeArray[i]) - { - case NF_SYMBOLTYPE_BLANK: - case NF_SYMBOLTYPE_STAR: - case NF_SYMBOLTYPE_STRING: - nPos = nPos + sStrArray[i].Len(); - i++; - break; - case NF_SYMBOLTYPE_COMMENT: - { - String& rStr = sStrArray[i]; - nPos = nPos + rStr.Len(); - SvNumberformat::EraseCommentBraces( rStr ); - rComment += rStr; - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - i++; - } - break; - case NF_SYMBOLTYPE_DEL: - { - int nCalRet; - if ( (nCalRet = FinalScanGetCalendar( nPos, i, nAnzResStrings )) != 0 ) - { - if ( nCalRet < 0 ) - return nPos; // error - } - else - { - switch( sStrArray[i].GetChar(0) ) - { - case '0': - { - if ( bTimePart && Is100SecZero( i, bDecSep ) ) - { - bDecSep = TRUE; - nTypeArray[i] = NF_SYMBOLTYPE_DIGIT; - String& rStr = sStrArray[i]; - i++; - nPos = nPos + sStrArray[i].Len(); - nCounter++; - while (i < nAnzStrings && - sStrArray[i].GetChar(0) == '0') - { - rStr += sStrArray[i]; - nPos = nPos + sStrArray[i].Len(); - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - nCounter++; - i++; - } - } - else - return nPos; - } - break; - case '#': - case '?': - return nPos; - default: - { - nPos = nPos + sStrArray[i].Len(); - if (bTimePart) - { - if ( sStrArray[i] == sOldTimeSep ) - { - nTypeArray[i] = NF_SYMBOLTYPE_TIMESEP; - if ( bConvertMode ) - sStrArray[i] = pLoc->getTimeSep(); - } - else if ( sStrArray[i] == sOldTime100SecSep ) - { - bDecSep = TRUE; - nTypeArray[i] = NF_SYMBOLTYPE_TIME100SECSEP; - if ( bConvertMode ) - sStrArray[i] = pLoc->getTime100SecSep(); - } - else - nTypeArray[i] = NF_SYMBOLTYPE_STRING; - } - else - { - if ( sStrArray[i] == sOldDateSep ) - { - nTypeArray[i] = NF_SYMBOLTYPE_DATESEP; - if (bConvertMode) - sStrArray[i] = pFormatter->GetDateSep(); - } - else - nTypeArray[i] = NF_SYMBOLTYPE_STRING; - } - i++; - } - } - } - } - break; - case NF_KEY_AMPM: // AM/PM - case NF_KEY_AP: // A/P - { - bTimePart = TRUE; - bExp = TRUE; // missbraucht fuer A/P - sStrArray[i] = sKeyword[nTypeArray[i]]; // tTtT -> TTTT - nPos = nPos + sStrArray[i].Len(); - i++; - } - break; - case NF_KEY_MI: // M - case NF_KEY_MMI: // MM - case NF_KEY_H: // H - case NF_KEY_HH: // HH - case NF_KEY_S: // S - case NF_KEY_SS: // SS - bTimePart = TRUE; - sStrArray[i] = sKeyword[nTypeArray[i]]; // tTtT -> TTTT - nPos = nPos + sStrArray[i].Len(); - i++; - break; - case NF_KEY_M: // M - case NF_KEY_MM: // MM - case NF_KEY_MMM: // MMM - case NF_KEY_MMMM: // MMMM - case NF_KEY_MMMMM: // MMMMM - case NF_KEY_Q: // Q - case NF_KEY_QQ: // QQ - case NF_KEY_D: // D - case NF_KEY_DD: // DD - case NF_KEY_DDD: // DDD - case NF_KEY_DDDD: // DDDD - case NF_KEY_YY: // YY - case NF_KEY_YYYY: // YYYY - case NF_KEY_NN: // NN - case NF_KEY_NNN: // NNN - case NF_KEY_NNNN: // NNNN - case NF_KEY_WW : // WW - case NF_KEY_AAA : // AAA - case NF_KEY_AAAA : // AAAA - case NF_KEY_EC : // E - case NF_KEY_EEC : // EE - case NF_KEY_G : // G - case NF_KEY_GG : // GG - case NF_KEY_GGG : // GGG - case NF_KEY_R : // R - case NF_KEY_RR : // RR - bTimePart = FALSE; - sStrArray[i] = sKeyword[nTypeArray[i]]; // tTtT -> TTTT - nPos = nPos + sStrArray[i].Len(); - i++; - break; - case NF_KEY_THAI_T : - bThaiT = true; - sStrArray[i] = sKeyword[nTypeArray[i]]; - nPos = nPos + sStrArray[i].Len(); - i++; - break; - default: // andere Keywords - nTypeArray[i] = NF_SYMBOLTYPE_STRING; - nPos = nPos + sStrArray[i].Len(); - i++; - break; - } - } // of while - nCntPost = nCounter; // decimals (100th seconds) - if (bExp) - nCntExp = 1; // merkt AM/PM - } - break; // of NUMBERFORMAT_DATETIME - default: - break; - } - if (eScannedType == NUMBERFORMAT_SCIENTIFIC && - (nCntPre + nCntPost == 0 || nCntExp == 0)) - return nPos; - else if (eScannedType == NUMBERFORMAT_FRACTION && (nCntExp > 8 || nCntExp == 0)) - return nPos; - - if (bThaiT && !GetNatNumModifier()) - SetNatNumModifier(1); - - if ( bConvertMode ) - { // strings containing keywords of the target locale must be quoted, so - // the user sees the difference and is able to edit the format string - for ( i=0; i < nAnzStrings; i++ ) - { - if ( nTypeArray[i] == NF_SYMBOLTYPE_STRING && - sStrArray[i].GetChar(0) != '\"' ) - { - if ( bConvertSystemToSystem && eScannedType == NUMBERFORMAT_CURRENCY ) - { // don't stringize automatic currency, will be converted - if ( sStrArray[i] == sOldCurSymbol ) - continue; // for - // DM might be splitted into D and M - if ( sStrArray[i].Len() < sOldCurSymbol.Len() && - pChrCls->toUpper( sStrArray[i], 0, 1 ).GetChar(0) == - sOldCurString.GetChar(0) ) - { - String aTmp( sStrArray[i] ); - USHORT j = i + 1; - while ( aTmp.Len() < sOldCurSymbol.Len() && - j < nAnzStrings && - nTypeArray[j] == NF_SYMBOLTYPE_STRING ) - { - aTmp += sStrArray[j++]; - } - if ( pChrCls->upper( aTmp ) == sOldCurString ) - { - sStrArray[i++] = aTmp; - for ( ; iGetNumThousandSep(), - c) || StringEqualsChar( - pFormatter->GetNumDecimalSep(), - c) || (c == ' ' && - StringEqualsChar( - pFormatter->GetNumThousandSep(), - cNonBreakingSpace)))) - rString += sStrArray[i]; - else if ((eScannedType & NUMBERFORMAT_DATE) && - StringEqualsChar( - pFormatter->GetDateSep(), c)) - rString += sStrArray[i]; - else if ((eScannedType & NUMBERFORMAT_TIME) && - (StringEqualsChar( pLoc->getTimeSep(), - c) || - StringEqualsChar( - pLoc->getTime100SecSep(), c))) - rString += sStrArray[i]; - else if (eScannedType & NUMBERFORMAT_FRACTION) - rString += sStrArray[i]; - else - rString += c; - break; - default: - rString += sStrArray[i]; - } - } - else - rString += sStrArray[i]; - if ( RemoveQuotes( sStrArray[i] ) > 0 ) - { // update currency up to quoted string - if ( eScannedType == NUMBERFORMAT_CURRENCY ) - { // dM -> DM or DM -> $ in old automatic - // currency formats, oh my ..., why did we ever - // introduce them? - String aTmp( pChrCls->toUpper( - sStrArray[iPos], nArrPos, - sStrArray[iPos].Len()-nArrPos ) ); - xub_StrLen nCPos = aTmp.Search( sOldCurString ); - if ( nCPos != STRING_NOTFOUND ) - { - const String& rCur = - bConvertMode && bConvertSystemToSystem ? - GetCurSymbol() : sOldCurSymbol; - sStrArray[iPos].Replace( nArrPos+nCPos, - sOldCurString.Len(), rCur ); - rString.Replace( nStringPos+nCPos, - sOldCurString.Len(), rCur ); - } - nStringPos = rString.Len(); - if ( iPos == i ) - nArrPos = sStrArray[iPos].Len(); - else - nArrPos = sStrArray[iPos].Len() + sStrArray[i].Len(); - } - } - if ( iPos != i ) - { - sStrArray[iPos] += sStrArray[i]; - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - } - i++; - } while ( i < nAnzStrings && nTypeArray[i] == NF_SYMBOLTYPE_STRING ); - if ( i < nAnzStrings ) - i--; // enter switch on next symbol again - if ( eScannedType == NUMBERFORMAT_CURRENCY && nStringPos < rString.Len() ) - { // same as above, since last RemoveQuotes - String aTmp( pChrCls->toUpper( - sStrArray[iPos], nArrPos, - sStrArray[iPos].Len()-nArrPos ) ); - xub_StrLen nCPos = aTmp.Search( sOldCurString ); - if ( nCPos != STRING_NOTFOUND ) - { - const String& rCur = - bConvertMode && bConvertSystemToSystem ? - GetCurSymbol() : sOldCurSymbol; - sStrArray[iPos].Replace( nArrPos+nCPos, - sOldCurString.Len(), rCur ); - rString.Replace( nStringPos+nCPos, - sOldCurString.Len(), rCur ); - } - } - } - break; - case NF_SYMBOLTYPE_CURRENCY : - { - rString += sStrArray[i]; - RemoveQuotes( sStrArray[i] ); - } - break; - case NF_KEY_THAI_T: - if (bThaiT && GetNatNumModifier() == 1) - { // Remove T from format code, will be replaced with a [NatNum1] prefix. - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - } - else - rString += sStrArray[i]; - break; - case NF_SYMBOLTYPE_EMPTY : - // nothing - break; - default: - rString += sStrArray[i]; - } - i++; - } - return 0; -} - - -xub_StrLen ImpSvNumberformatScan::RemoveQuotes( String& rStr ) -{ - if ( rStr.Len() > 1 ) - { - sal_Unicode c = rStr.GetChar(0); - xub_StrLen n; - if ( c == '"' && rStr.GetChar( (n = xub_StrLen(rStr.Len()-1)) ) == '"' ) - { - rStr.Erase(n,1); - rStr.Erase(0,1); - return 2; - } - else if ( c == '\\' ) - { - rStr.Erase(0,1); - return 1; - } - } - return 0; -} - - -xub_StrLen ImpSvNumberformatScan::ScanFormat( String& rString, String& rComment ) -{ - xub_StrLen res = Symbol_Division(rString); //lexikalische Analyse - if (!res) - res = ScanType(rString); // Erkennung des Formattyps - if (!res) - res = FinalScan( rString, rComment ); // Typabhaengige Endanalyse - return res; // res = Kontrollposition - // res = 0 => Format ok -} - -void ImpSvNumberformatScan::CopyInfo(ImpSvNumberformatInfo* pInfo, USHORT nAnz) -{ - size_t i,j; - j = 0; - i = 0; - while (i < nAnz && j < NF_MAX_FORMAT_SYMBOLS) - { - if (nTypeArray[j] != NF_SYMBOLTYPE_EMPTY) - { - pInfo->sStrArray[i] = sStrArray[j]; - pInfo->nTypeArray[i] = nTypeArray[j]; - i++; - } - j++; - } - pInfo->eScannedType = eScannedType; - pInfo->bThousand = bThousand; - pInfo->nThousand = nThousand; - pInfo->nCntPre = nCntPre; - pInfo->nCntPost = nCntPost; - pInfo->nCntExp = nCntExp; -} - - diff --git a/svtools/source/numbers/zforscan.hxx b/svtools/source/numbers/zforscan.hxx deleted file mode 100644 index bc19ac5b633f..000000000000 --- a/svtools/source/numbers/zforscan.hxx +++ /dev/null @@ -1,278 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: zforscan.hxx,v $ - * $Revision: 1.24.136.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _ZFORSCAN_HXX -#define _ZFORSCAN_HXX - -#include -#include -#include -#include -#include -#include "nfsymbol.hxx" - -class SvNumberFormatter; -struct ImpSvNumberformatInfo; - - -const size_t NF_MAX_FORMAT_SYMBOLS = 100; -const size_t NF_MAX_DEFAULT_COLORS = 10; - -// Hack: nThousand==1000 => "Default" occurs in format string -const USHORT FLAG_STANDARD_IN_FORMAT = 1000; - -class ImpSvNumberformatScan -{ -public: - - ImpSvNumberformatScan( SvNumberFormatter* pFormatter ); - ~ImpSvNumberformatScan(); - void ChangeIntl(); // tauscht Keywords aus - - void ChangeNullDate(USHORT nDay, USHORT nMonth, USHORT nYear); - // tauscht Referenzdatum aus - void ChangeStandardPrec(short nPrec); // tauscht Standardprecision aus - - xub_StrLen ScanFormat( String& rString, String& rComment ); // Aufruf der Scan-Analyse - - void CopyInfo(ImpSvNumberformatInfo* pInfo, - USHORT nAnz); // Kopiert die FormatInfo - USHORT GetAnzResStrings() const { return nAnzResStrings; } - - const CharClass& GetChrCls() const { return *pFormatter->GetCharClass(); } - const LocaleDataWrapper& GetLoc() const { return *pFormatter->GetLocaleData(); } - CalendarWrapper& GetCal() const { return *pFormatter->GetCalendar(); } - - const String* GetKeywords() const - { - if ( bKeywordsNeedInit ) - InitKeywords(); - return sKeyword; - } - // Keywords used in output like TRUE and FALSE - const String& GetSpecialKeyword( NfKeywordIndex eIdx ) const - { - if ( !sKeyword[eIdx].Len() ) - InitSpecialKeyword( eIdx ); - return sKeyword[eIdx]; - } - const String& GetTrueString() const { return GetSpecialKeyword( NF_KEY_TRUE ); } - const String& GetFalseString() const { return GetSpecialKeyword( NF_KEY_FALSE ); } - const String& GetColorString() const { return GetKeywords()[NF_KEY_COLOR]; } - const String& GetRedString() const { return GetKeywords()[NF_KEY_RED]; } - const String& GetBooleanString() const { return GetKeywords()[NF_KEY_BOOLEAN]; } - const String& GetErrorString() const { return sErrStr; } - - Date* GetNullDate() const { return pNullDate; } - const String& GetStandardName() const - { - if ( bKeywordsNeedInit ) - InitKeywords(); - return sNameStandardFormat; - } - short GetStandardPrec() const { return nStandardPrec; } - const Color& GetRedColor() const { return StandardColor[4]; } - Color* GetColor(String& sStr); // Setzt Hauptfarben oder - // definierte Farben - - // the compatibility currency symbol for old automatic currency formats - const String& GetCurSymbol() const - { - if ( bCompatCurNeedInit ) - InitCompatCur(); - return sCurSymbol; - } - - // the compatibility currency abbreviation for CCC format code - const String& GetCurAbbrev() const - { - if ( bCompatCurNeedInit ) - InitCompatCur(); - return sCurAbbrev; - } - - // the compatibility currency symbol upper case for old automatic currency formats - const String& GetCurString() const - { - if ( bCompatCurNeedInit ) - InitCompatCur(); - return sCurString; - } - - void SetConvertMode(LanguageType eTmpLge, LanguageType eNewLge, - BOOL bSystemToSystem = FALSE ) - { - bConvertMode = TRUE; - eNewLnge = eNewLge; - eTmpLnge = eTmpLge; - bConvertSystemToSystem = bSystemToSystem; - } - void SetConvertMode(BOOL bMode) { bConvertMode = bMode; } - // Veraendert nur die Bool-Variable - // (zum temporaeren Unterbrechen des - // Convert-Modus) - BOOL GetConvertMode() const { return bConvertMode; } - LanguageType GetNewLnge() const { return eNewLnge; } - // Lesezugriff auf ConvertMode - // und Konvertierungsland/Spr. - LanguageType GetTmpLnge() const { return eTmpLnge; } - // Lesezugriff auf - // und Ausgangsland/Spr. - - /// get Thai T speciality - BYTE GetNatNumModifier() const { return nNatNumModifier; } - /// set Thai T speciality - void SetNatNumModifier( BYTE n ) { nNatNumModifier = n; } - - SvNumberFormatter* GetNumberformatter() { return pFormatter; } - // Zugriff auf Formatierer - // (fuer zformat.cxx) - - -private: // ---- privater Teil - NfKeywordTable sKeyword; // Schluesselworte der Syntax - Color StandardColor[NF_MAX_DEFAULT_COLORS]; - // Array der Standardfarben - Date* pNullDate; // 30Dec1899 - String sNameStandardFormat; // "Standard" - short nStandardPrec; // default Precision fuer Standardformat (2) - SvNumberFormatter* pFormatter; // Pointer auf die Formatliste - - String sStrArray[NF_MAX_FORMAT_SYMBOLS]; // Array der Symbole - short nTypeArray[NF_MAX_FORMAT_SYMBOLS]; // Array der Infos - // externe Infos: - USHORT nAnzResStrings; // Anzahl der Ergebnissymbole -#if !(defined SOLARIS && defined X86) - short eScannedType; // Typ gemaess Scan -#else - int eScannedType; // wg. Optimierung -#endif - BOOL bThousand; // Mit Tausenderpunkt - USHORT nThousand; // Zaehlt ....-Folgen - USHORT nCntPre; // Zaehlt Vorkommastellen - USHORT nCntPost; // Zaehlt Nachkommastellen - USHORT nCntExp; // Zaehlt Exp.Stellen, AM/PM - // interne Infos: - USHORT nAnzStrings; // Anzahl der Symbole - USHORT nRepPos; // Position eines '*' - USHORT nExpPos; // interne Position des E - USHORT nBlankPos; // interne Position des Blank - short nDecPos; // interne Pos. des , - BOOL bExp; // wird bei Lesen des E gesetzt - BOOL bFrac; // wird bei Lesen des / gesetzt - BOOL bBlank; // wird bei ' '(Fraction) ges. - BOOL bDecSep; // Wird beim ersten , gesetzt - mutable BOOL bKeywordsNeedInit; // Locale dependent keywords need to be initialized - mutable BOOL bCompatCurNeedInit; // Locale dependent compatibility currency need to be initialized - String sCurSymbol; // Currency symbol for compatibility format codes - String sCurString; // Currency symbol in upper case - String sCurAbbrev; // Currency abbreviation - String sErrStr; // String fuer Fehlerausgaben - - BOOL bConvertMode; // Wird im Convert-Mode gesetzt - // Land/Sprache, in die der - LanguageType eNewLnge; // gescannte String konvertiert - // wird (fuer Excel Filter) - // Land/Sprache, aus der der - LanguageType eTmpLnge; // gescannte String konvertiert - // wird (fuer Excel Filter) - BOOL bConvertSystemToSystem; // Whether the conversion is - // from one system locale to - // another system locale (in - // this case the automatic - // currency symbol is converted - // too). - - xub_StrLen nCurrPos; // Position des Waehrungssymbols - - BYTE nNatNumModifier; // Thai T speciality - - void InitKeywords() const; - void InitSpecialKeyword( NfKeywordIndex eIdx ) const; - void InitCompatCur() const; - -#ifdef _ZFORSCAN_CXX // ----- private Methoden ----- - void SetDependentKeywords(); - // Setzt die Sprachabh. Keyw. - void SkipStrings(USHORT& i,xub_StrLen& nPos);// Ueberspringt StringSymbole - USHORT PreviousKeyword(USHORT i); // Gibt Index des vorangeh. - // Schluesselworts oder 0 - USHORT NextKeyword(USHORT i); // Gibt Index des naechsten - // Schluesselworts oder 0 - sal_Unicode PreviousChar(USHORT i); // Gibt letzten Buchstaben - // vor der Position, - // skipt EMPTY, STRING, STAR, BLANK - sal_Unicode NextChar(USHORT i); // Gibt ersten Buchst. danach - short PreviousType( USHORT i ); // Gibt Typ vor Position, - // skipt EMPTY - BOOL IsLastBlankBeforeFrac(USHORT i); // True <=> es kommt kein ' ' - // mehr bis zum '/' - void Reset(); // Reset aller Variablen - // vor Analysestart - short GetKeyWord( const String& sSymbol, // determine keyword at nPos - xub_StrLen nPos ); // return 0 <=> not found - - inline BOOL IsAmbiguousE( short nKey ) // whether nKey is ambiguous E of NF_KEY_E/NF_KEY_EC - { - return (nKey == NF_KEY_EC || nKey == NF_KEY_E) && - (GetKeywords()[NF_KEY_EC] == GetKeywords()[NF_KEY_E]); - } - - // if 0 at strArray[i] is of S,00 or SS,00 or SS"any"00 in ScanType() or FinalScan() - BOOL Is100SecZero( USHORT i, BOOL bHadDecSep ); - - short Next_Symbol(const String& rStr, - xub_StrLen& nPos, - String& sSymbol); // Naechstes Symbol - xub_StrLen Symbol_Division(const String& rString);// lexikalische Voranalyse - xub_StrLen ScanType(const String& rString); // Analyse des Formattyps - xub_StrLen FinalScan( String& rString, String& rComment ); // Endanalyse mit Vorgabe - // des Typs - // -1:= error, return nPos in FinalScan; 0:= no calendar, 1:= calendar found - int FinalScanGetCalendar( xub_StrLen& nPos, USHORT& i, USHORT& nAnzResStrings ); - - /** Insert symbol into nTypeArray and sStrArray, e.g. grouping separator. - If at nPos-1 a symbol type NF_SYMBOLTYPE_EMPTY is present, that is - reused instead of shifting all one up and nPos is decremented! */ - bool InsertSymbol( USHORT & nPos, svt::NfSymbolType eType, const String& rStr ); - - static inline BOOL StringEqualsChar( const String& rStr, sal_Unicode ch ) - { return rStr.GetChar(0) == ch && rStr.Len() == 1; } - // Yes, for efficiency get the character first and then compare length - // because in most places where this is used the string is one char. - - // remove "..." and \... quotes from rStr, return how many chars removed - static xub_StrLen RemoveQuotes( String& rStr ); - -#endif //_ZFORSCAN_CXX -}; - - - -#endif // _ZFORSCAN_HXX diff --git a/svtools/source/passwordcontainer/exports.map b/svtools/source/passwordcontainer/exports.map deleted file mode 100644 index f4ed78b9e970..000000000000 --- a/svtools/source/passwordcontainer/exports.map +++ /dev/null @@ -1,8 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/svtools/source/passwordcontainer/makefile.mk b/svtools/source/passwordcontainer/makefile.mk deleted file mode 100644 index 31e1336ad966..000000000000 --- a/svtools/source/passwordcontainer/makefile.mk +++ /dev/null @@ -1,66 +0,0 @@ -#************************************************************************* -# -# 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 -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.6 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. -PRJNAME=svtools -TARGET=passwordcontainer.uno -LIBTARGET=NO -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk -DLLPRE= - -# --- Files ------------------------------------- - -SLOFILES= \ - $(SLO)$/passwordcontainer.obj\ - $(SLO)$/syscreds.obj - -SHL1TARGET= $(TARGET) -SHL1IMPLIB= i$(TARGET) -SHL1OBJS= $(SLOFILES) -SHL1STDLIBS=\ - $(UNOTOOLSLIB) \ - $(UCBHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) - -SHL1VERSIONMAP=exports.map -SHL1DEF= $(MISC)$/$(SHL1TARGET).def -DEF1NAME= $(SHL1TARGET) - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - diff --git a/svtools/source/passwordcontainer/passwordcontainer.cxx b/svtools/source/passwordcontainer/passwordcontainer.cxx deleted file mode 100644 index 5f9ce207ff6b..000000000000 --- a/svtools/source/passwordcontainer/passwordcontainer.cxx +++ /dev/null @@ -1,1595 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: passwordcontainer.cxx,v $ - * $Revision: 1.17 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include "passwordcontainer.hxx" - -#include -#include "cppuhelper/factory.hxx" -#include -#include -#include -#include - -#include -#include -#include - -#ifndef _TOOLS_INETSTRM_HXX -// @@@ #include -#endif - -using namespace std; -using namespace osl; -using namespace utl; -using namespace com::sun::star; -using namespace com::sun::star::uno; -using namespace com::sun::star::registry; -using namespace com::sun::star::lang; -using namespace com::sun::star::task; -using namespace com::sun::star::ucb; - -//------------------------------------------------------------------------- -//------------------------------------------------------------------------- - -static ::rtl::OUString createIndex( vector< ::rtl::OUString > lines ) -{ - ::rtl::OString aResult; - const sal_Char* pLine; - - for( unsigned int i = 0; i < lines.size(); i++ ) - { - if( i ) - aResult += ::rtl::OString( "__" ); - ::rtl::OString line = ::rtl::OUStringToOString( lines[i], RTL_TEXTENCODING_UTF8 ); - pLine = line.getStr(); - - while( *pLine ) - { - if( ( *pLine >= 'A' && *pLine <= 'Z' ) - || ( *pLine >= 'a' && *pLine <= 'z' ) - || ( *pLine >= '0' && *pLine <= '9' ) ) - { - aResult += ::rtl::OString::valueOf( *pLine ); - } - else - { - aResult += ::rtl::OString("_"); - aResult += ::rtl::OString::valueOf( (sal_Int32) *pLine, 16 ); - } - - pLine++; - } - } - - return ::rtl::OUString::createFromAscii( aResult.getStr() ); -} - -//------------------------------------------------------------------------- - -static vector< ::rtl::OUString > getInfoFromInd( ::rtl::OUString aInd ) -{ - vector< ::rtl::OUString > aResult; - sal_Bool aStart = sal_True; - - ::rtl::OString line = ::rtl::OUStringToOString( aInd, RTL_TEXTENCODING_ASCII_US ); - const sal_Char* pLine = line.getStr(); - do - { - ::rtl::OUString newItem; - if( !aStart ) - pLine += 2; - else - aStart = sal_False; - - while( *pLine && !( pLine[0] == '_' && pLine[1] == '_' )) - if( *pLine != '_' ) - { - newItem += ::rtl::OUString::valueOf( (sal_Unicode) *pLine ); - pLine++; - } - else - { - ::rtl::OUString aNum; - for( int i = 1; i < 3; i++ ) - { - if( !pLine[i] - || ( ( pLine[i] < '0' || pLine[i] > '9' ) - && ( pLine[i] < 'a' || pLine[i] > 'f' ) - && ( pLine[i] < 'A' || pLine[i] > 'F' ) ) ) - { - OSL_ENSURE( sal_False, "Wrong index syntax!\n" ); - return aResult; - } - - aNum += ::rtl::OUString::valueOf( (sal_Unicode) pLine[i] ); - } - - newItem += ::rtl::OUString::valueOf( (sal_Unicode) aNum.toInt32( 16 ) ); - pLine += 3; - } - - aResult.push_back( newItem ); - } while( pLine[0] == '_' && pLine[1] == '_' ); - - if( *pLine ) - OSL_ENSURE( sal_False, "Wrong index syntax!\n" ); - - return aResult; -} - -//------------------------------------------------------------------------- - -static sal_Bool shorterUrl( ::rtl::OUString& aURL ) -{ - sal_Int32 aInd = aURL.lastIndexOf( sal_Unicode( '/' ) ); - - if( aInd > 0 ) - { - sal_Int32 aPrevInd = aURL.lastIndexOf( sal_Unicode( '/' ), aInd ); - if ( aURL.indexOf( ::rtl::OUString::createFromAscii( "://" ) ) - != aPrevInd - 2 || - aInd != aURL.getLength() - 1 ) - { - aURL = aURL.copy( 0, aInd ); - return sal_True; - } - } - - return sal_False; -} - -//------------------------------------------------------------------------- - -static ::rtl::OUString getAsciiLine( const ::rtl::ByteSequence& buf ) -{ - ::rtl::OUString aResult; - - ::rtl::ByteSequence outbuf( buf.getLength()*2+1 ); - - for( int ind = 0; ind < buf.getLength(); ind++ ) - { - outbuf[ind*2] = ( ((sal_uInt8)buf[ind]) >> 4 ) + 'a'; - outbuf[ind*2+1] = ( ((sal_uInt8)buf[ind]) & 0x0f ) + 'a'; - } - outbuf[buf.getLength()*2] = '\0'; - - aResult = ::rtl::OUString::createFromAscii( (sal_Char*)outbuf.getArray() ); - - return aResult; -} - -//------------------------------------------------------------------------- - -static ::rtl::ByteSequence getBufFromAsciiLine( ::rtl::OUString line ) -{ - OSL_ENSURE( line.getLength() % 2 == 0, "Wrong syntax!\n" ); - ::rtl::OString tmpLine = ::rtl::OUStringToOString( line, RTL_TEXTENCODING_ASCII_US ); - ::rtl::ByteSequence aResult(line.getLength()/2); - - for( int ind = 0; ind < tmpLine.getLength()/2; ind++ ) - { - aResult[ind] = ( (sal_uInt8)( tmpLine.getStr()[ind*2] - 'a' ) << 4 ) | (sal_uInt8)( tmpLine.getStr()[ind*2+1] - 'a' ); - } - - return aResult; -} - -//------------------------------------------------------------------------- - -static Sequence< ::rtl::OUString > copyVectorToSequence( const vector< ::rtl::OUString >& original ) -{ - Sequence< ::rtl::OUString > newOne ( original.size() ); - for( unsigned int i = 0; i < original.size() ; i++ ) - newOne[i] = original[i]; - - return newOne; -} - -static vector< ::rtl::OUString > copySequenceToVector( const Sequence< ::rtl::OUString >& original ) -{ - vector< ::rtl::OUString > newOne ( original.getLength() ); - for( int i = 0; i < original.getLength() ; i++ ) - newOne[i] = original[i]; - - return newOne; -} - -//------------------------------------------------------------------------- -//------------------------------------------------------------------------- - -PassMap StorageItem::getInfo() -{ - PassMap aResult; - - Sequence< ::rtl::OUString > aNodeNames = ConfigItem::GetNodeNames( ::rtl::OUString::createFromAscii("Store") ); - sal_Int32 aNodeCount = aNodeNames.getLength(); - Sequence< ::rtl::OUString > aPropNames( aNodeCount ); - sal_Int32 aNodeInd; - - for( aNodeInd = 0; aNodeInd < aNodeCount; ++aNodeInd ) - { - aPropNames[aNodeInd] = ::rtl::OUString::createFromAscii( "Store/Passwordstorage['" ); - aPropNames[aNodeInd] += aNodeNames[aNodeInd]; - aPropNames[aNodeInd] += ::rtl::OUString::createFromAscii( "']/Password" ); - } - - Sequence< Any > aPropertyValues = ConfigItem::GetProperties( aPropNames ); - - if( aPropertyValues.getLength() != aNodeNames.getLength() ) - { - OSL_ENSURE( aPropertyValues.getLength() == aNodeNames.getLength(), "Problems during reading\n" ); - return aResult; - } - - for( aNodeInd = 0; aNodeInd < aNodeCount; ++aNodeInd ) - { - vector< ::rtl::OUString > aUrlUsr = getInfoFromInd( aNodeNames[aNodeInd] ); - - if( aUrlUsr.size() == 2 ) - { - ::rtl::OUString aUrl = aUrlUsr[0]; - ::rtl::OUString aName = aUrlUsr[1]; - - ::rtl::OUString aEPasswd; - aPropertyValues[aNodeInd] >>= aEPasswd; - - PassMap::iterator aIter = aResult.find( aUrl ); - if( aIter != aResult.end() ) - aIter->second.push_back( NamePassRecord( aName, aEPasswd ) ); - else - { - NamePassRecord aNewRecord( aName, aEPasswd ); - list< NamePassRecord > listToAdd( 1, aNewRecord ); - - aResult.insert( PairUrlRecord( aUrl, listToAdd ) ); - } - } - else - OSL_ENSURE( sal_False, "Wrong index sintax!\n" ); - } - - return aResult; -} - -//------------------------------------------------------------------------- - -void StorageItem::setUseStorage( sal_Bool bUse ) -{ - Sequence< ::rtl::OUString > sendNames(1); - Sequence< uno::Any > sendVals(1); - - sendNames[0] = ::rtl::OUString::createFromAscii( "UseStorage" ); - - sendVals[0] <<= bUse; - - ConfigItem::SetModified(); - ConfigItem::PutProperties( sendNames, sendVals ); -} - -//------------------------------------------------------------------------- - -sal_Bool StorageItem::useStorage() -{ - Sequence< ::rtl::OUString > aNodeNames( 1 ); - aNodeNames[0] = ::rtl::OUString::createFromAscii( "UseStorage" ); - - Sequence< Any > aPropertyValues = ConfigItem::GetProperties( aNodeNames ); - - if( aPropertyValues.getLength() != aNodeNames.getLength() ) - { - OSL_ENSURE( aPropertyValues.getLength() == aNodeNames.getLength(), "Problems during reading\n" ); - return sal_False; - } - - sal_Bool aResult = false; - aPropertyValues[0] >>= aResult; - - return aResult; -} - -//------------------------------------------------------------------------- - -sal_Bool StorageItem::getEncodedMP( ::rtl::OUString& aResult ) -{ - if( hasEncoded ) - { - aResult = mEncoded; - return sal_True; - } - - Sequence< ::rtl::OUString > aNodeNames( 2 ); - aNodeNames[0] = ::rtl::OUString::createFromAscii( "HasMaster" ); - aNodeNames[1] = ::rtl::OUString::createFromAscii( "Master" ); - - Sequence< Any > aPropertyValues = ConfigItem::GetProperties( aNodeNames ); - - if( aPropertyValues.getLength() != aNodeNames.getLength() ) - { - OSL_ENSURE( aPropertyValues.getLength() == aNodeNames.getLength(), "Problems during reading\n" ); - return sal_False; - } - - aPropertyValues[0] >>= hasEncoded; - aPropertyValues[1] >>= mEncoded; - - aResult = mEncoded; - - return hasEncoded; -} - -//------------------------------------------------------------------------- - -void StorageItem::setEncodedMP( const ::rtl::OUString& aEncoded, sal_Bool bAcceptEmpty ) -{ - Sequence< ::rtl::OUString > sendNames(2); - Sequence< uno::Any > sendVals(2); - - sendNames[0] = ::rtl::OUString::createFromAscii( "HasMaster" ); - sendNames[1] = ::rtl::OUString::createFromAscii( "Master" ); - - sal_Bool bHasMaster = ( aEncoded.getLength() > 0 || bAcceptEmpty ); - sendVals[0] <<= bHasMaster; - sendVals[1] <<= aEncoded; - - ConfigItem::SetModified(); - ConfigItem::PutProperties( sendNames, sendVals ); - - hasEncoded = bHasMaster; - mEncoded = aEncoded; -} - -//------------------------------------------------------------------------- - -void StorageItem::remove( const ::rtl::OUString& aURL, const ::rtl::OUString& aName ) -{ - vector < ::rtl::OUString > forIndex; - forIndex.push_back( aURL ); - forIndex.push_back( aName ); - - Sequence< ::rtl::OUString > sendSeq(1); - - sendSeq[0] = createIndex( forIndex ); - // sendSeq[0] = ::rtl::OUString::createFromAscii( "Store/Passwordstorage['" ); - // sendSeq[0] += createIndex( forIndex ); - // sendSeq[0] += ::rtl::OUString::createFromAscii( "']" ); - - ConfigItem::ClearNodeElements( ::rtl::OUString::createFromAscii( "Store" ), sendSeq ); -} - -//------------------------------------------------------------------------- - -void StorageItem::clear() -{ - Sequence< ::rtl::OUString > sendSeq(1); - - ConfigItem::ClearNodeSet( ::rtl::OUString::createFromAscii( "Store" ) ); -} - -//------------------------------------------------------------------------- - -void StorageItem::update( const ::rtl::OUString& aURL, const NamePassRecord& aRecord ) -{ - if ( !aRecord.HasPasswords( PERSISTENT_RECORD ) ) - { - OSL_ASSERT( "Unexpected storing of a record!" ); - return; - } - - vector < ::rtl::OUString > forIndex; - forIndex.push_back( aURL ); - forIndex.push_back( aRecord.GetUserName() ); - - Sequence< beans::PropertyValue > sendSeq(1); - - sendSeq[0].Name = ::rtl::OUString::createFromAscii( "Store/Passwordstorage['" ); - sendSeq[0].Name += createIndex( forIndex ); - sendSeq[0].Name += ::rtl::OUString::createFromAscii( "']/Password" ); - - sendSeq[0].Value <<= aRecord.GetPersPasswords(); - - ConfigItem::SetModified(); - ConfigItem::SetSetProperties( ::rtl::OUString::createFromAscii( "Store" ), sendSeq ); -} - -//------------------------------------------------------------------------- - -void StorageItem::Notify( const Sequence< ::rtl::OUString >& ) -{ - // this feature still should not be used - if( mainCont ) - mainCont->Notify(); -} - -//------------------------------------------------------------------------- - -void StorageItem::Commit() -{ - // Do nothing, we stored everything we want already -} - -//------------------------------------------------------------------------- -//------------------------------------------------------------------------- - -PasswordContainer::PasswordContainer( const Reference& xServiceFactory ): - m_pStorageFile( NULL ) -{ - // m_pStorageFile->Notify() can be called - ::osl::MutexGuard aGuard( mMutex ); - - mComponent = Reference< XComponent >( xServiceFactory, UNO_QUERY ); - mComponent->addEventListener( this ); - - m_pStorageFile = new StorageItem( this, ::rtl::OUString::createFromAscii( "Office.Common/Passwords" ) ); - if( m_pStorageFile ) - if( m_pStorageFile->useStorage() ) - m_aContainer = m_pStorageFile->getInfo(); -} - -//------------------------------------------------------------------------- - -PasswordContainer::~PasswordContainer() -{ - ::osl::MutexGuard aGuard( mMutex ); - - if( m_pStorageFile ) - { - delete m_pStorageFile; - m_pStorageFile = NULL; - } - - if( mComponent.is() ) - { - mComponent->removeEventListener(this); - mComponent = Reference< XComponent >(); - } -} - -//------------------------------------------------------------------------- - -void SAL_CALL PasswordContainer::disposing( const EventObject& ) throw(RuntimeException) -{ - ::osl::MutexGuard aGuard( mMutex ); - - if( m_pStorageFile ) - { - delete m_pStorageFile; - m_pStorageFile = NULL; - } - - if( mComponent.is() ) - { - //mComponent->removeEventListener(this); - mComponent = Reference< XComponent >(); - } -} - -//------------------------------------------------------------------------- - -vector< ::rtl::OUString > PasswordContainer::DecodePasswords( const ::rtl::OUString& aLine, const ::rtl::OUString& aMasterPasswd ) throw(RuntimeException) -{ - if( aMasterPasswd.getLength() ) - { - rtlCipher aDecoder = rtl_cipher_create (rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeStream ); - OSL_ENSURE( aDecoder, "Can't create decoder\n" ); - - if( aDecoder ) - { - OSL_ENSURE( aMasterPasswd.getLength() == RTL_DIGEST_LENGTH_MD5 * 2, "Wrong master password format!\n" ); - - unsigned char code[RTL_DIGEST_LENGTH_MD5]; - for( int ind = 0; ind < RTL_DIGEST_LENGTH_MD5; ind++ ) - code[ ind ] = (char)(aMasterPasswd.copy( ind*2, 2 ).toInt32(16)); - - rtlCipherError result = rtl_cipher_init ( - aDecoder, rtl_Cipher_DirectionDecode, - code, RTL_DIGEST_LENGTH_MD5, NULL, 0 ); - - if( result == rtl_Cipher_E_None ) - { - ::rtl::ByteSequence aSeq = getBufFromAsciiLine( aLine ); - - ::rtl::ByteSequence resSeq( aSeq.getLength() ); - - result = rtl_cipher_decode ( aDecoder, (sal_uInt8*)aSeq.getArray(), aSeq.getLength(), - (sal_uInt8*)resSeq.getArray(), resSeq.getLength() ); - - ::rtl::OUString aPasswd( ( sal_Char* )resSeq.getArray(), resSeq.getLength(), RTL_TEXTENCODING_UTF8 ); - - rtl_cipher_destroy (aDecoder); - - return getInfoFromInd( aPasswd ); - } - - rtl_cipher_destroy (aDecoder); - } - } - else - { - OSL_ENSURE( sal_False, "No master password provided!\n" ); - // throw special exception - } - - // problems with decoding - OSL_ENSURE( sal_False, "Problem with decoding\n" ); - throw RuntimeException( ::rtl::OUString::createFromAscii( "Can't decode!" ), Reference< XInterface >() ); -} - - -//------------------------------------------------------------------------- - -::rtl::OUString PasswordContainer::EncodePasswords( vector< ::rtl::OUString > lines, const ::rtl::OUString& aMasterPasswd ) throw(RuntimeException) -{ - if( aMasterPasswd.getLength() ) - { - ::rtl::OString aSeq = ::rtl::OUStringToOString( createIndex( lines ), RTL_TEXTENCODING_UTF8 ); - - rtlCipher aEncoder = rtl_cipher_create (rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeStream ); - OSL_ENSURE( aEncoder, "Can't create encoder\n" ); - - if( aEncoder ) - { - OSL_ENSURE( aMasterPasswd.getLength() == RTL_DIGEST_LENGTH_MD5 * 2, "Wrong master password format!\n" ); - - unsigned char code[RTL_DIGEST_LENGTH_MD5]; - for( int ind = 0; ind < RTL_DIGEST_LENGTH_MD5; ind++ ) - code[ ind ] = (char)(aMasterPasswd.copy( ind*2, 2 ).toInt32(16)); - - rtlCipherError result = rtl_cipher_init ( - aEncoder, rtl_Cipher_DirectionEncode, - code, RTL_DIGEST_LENGTH_MD5, NULL, 0 ); - - if( result == rtl_Cipher_E_None ) - { - ::rtl::ByteSequence resSeq(aSeq.getLength()+1); - - result = rtl_cipher_encode ( aEncoder, (sal_uInt8*)aSeq.getStr(), aSeq.getLength()+1, - (sal_uInt8*)resSeq.getArray(), resSeq.getLength() ); - -/* - //test - rtlCipherError result = rtl_cipher_init ( - aEncoder, rtl_Cipher_DirectionDecode, - code, RTL_DIGEST_LENGTH_MD5, NULL, 0 ); - - - if( result == rtl_Cipher_E_None ) - { - ::rtl::OUString testOU = getAsciiLine( resSeq ); - ::rtl::ByteSequence aSeq1 = getBufFromAsciiLine( testOU ); - - ::rtl::ByteSequence resSeq1( aSeq1.getLength() ); - - if( resSeq.getLength() == aSeq1.getLength() ) - { - for( int ind = 0; ind < aSeq1.getLength(); ind++ ) - if( resSeq[ind] != aSeq1[ind] ) - testOU = ::rtl::OUString(); - } - - result = rtl_cipher_decode ( aEncoder, (sal_uInt8*)aSeq1.getArray(), aSeq1.getLength(), - (sal_uInt8*)resSeq1.getArray(), resSeq1.getLength() ); - - ::rtl::OUString aPasswd( ( sal_Char* )resSeq1.getArray(), resSeq1.getLength(), RTL_TEXTENCODING_UTF8 ); - } -*/ - - rtl_cipher_destroy (aEncoder); - - if( result == rtl_Cipher_E_None ) - return getAsciiLine( resSeq ); - - } - - rtl_cipher_destroy (aEncoder); - } - } - else - { - OSL_ENSURE( sal_False, "No master password provided!\n" ); - // throw special exception - } - - // problems with encoding - OSL_ENSURE( sal_False, "Problem with encoding\n" ); - throw RuntimeException( ::rtl::OUString::createFromAscii( "Can't encode!" ), Reference< XInterface >() ); -} - -//------------------------------------------------------------------------- - -void PasswordContainer::UpdateVector( const ::rtl::OUString& aURL, list< NamePassRecord >& toUpdate, NamePassRecord& aRecord, sal_Bool writeFile ) throw(RuntimeException) -{ - for( list< NamePassRecord >::iterator aNPIter = toUpdate.begin(); aNPIter != toUpdate.end(); aNPIter++ ) - if( aNPIter->GetUserName().equals( aRecord.GetUserName() ) ) - { - if( aRecord.HasPasswords( MEMORY_RECORD ) ) - aNPIter->SetMemPasswords( aRecord.GetMemPasswords() ); - - if( aRecord.HasPasswords( PERSISTENT_RECORD ) ) - { - aNPIter->SetPersPasswords( aRecord.GetPersPasswords() ); - - if( writeFile ) - { - // the password must be already encoded - m_pStorageFile->update( aURL, aRecord ); // change existing ( aURL, aName ) record in the configfile - } - } - - return; - } - - - if( aRecord.HasPasswords( PERSISTENT_RECORD ) && writeFile ) - { - // the password must be already encoded - m_pStorageFile->update( aURL, aRecord ); // add new aName to the existing url - } - - toUpdate.insert( toUpdate.begin(), aRecord ); -} - -//------------------------------------------------------------------------- - -UserRecord PasswordContainer::CopyToUserRecord( const NamePassRecord& aRecord, sal_Bool& io_bTryToDecode, const Reference< XInteractionHandler >& aHandler ) -{ - ::std::vector< ::rtl::OUString > aPasswords; - if( aRecord.HasPasswords( MEMORY_RECORD ) ) - aPasswords = aRecord.GetMemPasswords(); - - if( io_bTryToDecode && aRecord.HasPasswords( PERSISTENT_RECORD ) ) - { - try - { - ::std::vector< ::rtl::OUString > aDecodedPasswords = DecodePasswords( aRecord.GetPersPasswords(), GetMasterPassword( aHandler ) ); - aPasswords.insert( aPasswords.end(), aDecodedPasswords.begin(), aDecodedPasswords.end() ); - } - catch( NoMasterException& ) - { - // if master password could not be detected the entry will be just ignored - io_bTryToDecode = sal_False; - } - } - - return UserRecord( aRecord.GetUserName(), copyVectorToSequence( aPasswords ) ); -} - -//------------------------------------------------------------------------- - -Sequence< UserRecord > PasswordContainer::CopyToUserRecordSequence( const list< NamePassRecord >& original, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) -{ - Sequence< UserRecord > aResult( original.size() ); - sal_uInt32 nInd = 0; - sal_Bool bTryToDecode = sal_True; - - for( list< NamePassRecord >::const_iterator aNPIter = original.begin(); - aNPIter != original.end(); - aNPIter++, nInd++ ) - { - aResult[nInd] = CopyToUserRecord( *aNPIter, bTryToDecode, aHandler ); - } - - return aResult; -} - -//------------------------------------------------------------------------- - -void SAL_CALL PasswordContainer::add( const ::rtl::OUString& Url, const ::rtl::OUString& UserName, const Sequence< ::rtl::OUString >& Passwords, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) -{ - ::osl::MutexGuard aGuard( mMutex ); - - PrivateAdd( Url, UserName, Passwords, MEMORY_RECORD, aHandler ); -} - -//------------------------------------------------------------------------- - -void SAL_CALL PasswordContainer::addPersistent( const ::rtl::OUString& Url, const ::rtl::OUString& UserName, const Sequence< ::rtl::OUString >& Passwords, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) -{ - ::osl::MutexGuard aGuard( mMutex ); - - PrivateAdd( Url, UserName, Passwords, PERSISTENT_RECORD, aHandler ); -} - -//------------------------------------------------------------------------- - -void PasswordContainer::PrivateAdd( const ::rtl::OUString& Url, const ::rtl::OUString& UserName, const Sequence< ::rtl::OUString >& Passwords, char Mode, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) -{ - NamePassRecord aRecord( UserName ); - ::std::vector< ::rtl::OUString > aStorePass = copySequenceToVector( Passwords ); - - if( Mode == PERSISTENT_RECORD ) - aRecord.SetPersPasswords( EncodePasswords( aStorePass, GetMasterPassword( aHandler ) ) ); - else if( Mode == MEMORY_RECORD ) - aRecord.SetMemPasswords( aStorePass ); - else - { - OSL_ASSERT( "Unexpected persistence status!" ); - return; - } - - if( !m_aContainer.empty() ) - { - PassMap::iterator aIter = m_aContainer.find( Url ); - - if( aIter != m_aContainer.end() ) - { - UpdateVector( aIter->first, aIter->second, aRecord, sal_True ); - return; - } - } - - list< NamePassRecord > listToAdd( 1, aRecord ); - m_aContainer.insert( PairUrlRecord( Url, listToAdd ) ); - - if( Mode == PERSISTENT_RECORD && m_pStorageFile && m_pStorageFile->useStorage() ) - m_pStorageFile->update( Url, aRecord ); - -} - -//------------------------------------------------------------------------- - - -UrlRecord SAL_CALL PasswordContainer::find( const ::rtl::OUString& aURL, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) -{ - return find( aURL, rtl::OUString(), false, aHandler ); -} - -//------------------------------------------------------------------------- - -UrlRecord SAL_CALL PasswordContainer::findForName( const ::rtl::OUString& aURL, const ::rtl::OUString& aName, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) -{ - return find( aURL, aName, true, aHandler ); -} - -//------------------------------------------------------------------------- - -Sequence< UserRecord > PasswordContainer::FindUsr( const list< NamePassRecord >& userlist, const ::rtl::OUString& aName, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) -{ - sal_uInt32 nInd = 0; - for( list< NamePassRecord >::const_iterator aNPIter = userlist.begin(); - aNPIter != userlist.end(); - aNPIter++, nInd++ ) - { - if( aNPIter->GetUserName().equals( aName ) ) - { - Sequence< UserRecord > aResult(1); - sal_Bool bTryToDecode = sal_True; - aResult[0] = CopyToUserRecord( *aNPIter, bTryToDecode, aHandler ); - - return aResult; - } - } - - return Sequence< UserRecord >(); -} - -//------------------------------------------------------------------------- - -bool PasswordContainer::createUrlRecord( - const PassMap::iterator & rIter, - bool bName, - const ::rtl::OUString & aName, - const Reference< XInteractionHandler >& aHandler, - UrlRecord & rRec ) - throw( RuntimeException ) -{ - if ( bName ) - { - Sequence< UserRecord > aUsrRec - = FindUsr( rIter->second, aName, aHandler ); - if( aUsrRec.getLength() ) - { - rRec = UrlRecord( rIter->first, aUsrRec ); - return true; - } - } - else - { - rRec = UrlRecord( - rIter->first, - CopyToUserRecordSequence( rIter->second, aHandler ) ); - return true; - } - return false; -} - -//------------------------------------------------------------------------- - -UrlRecord PasswordContainer::find( - const ::rtl::OUString& aURL, - const ::rtl::OUString& aName, - bool bName, // only needed to support empty user names - const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) -{ - ::osl::MutexGuard aGuard( mMutex ); - - if( !m_aContainer.empty() && aURL.getLength() ) - { - ::rtl::OUString aUrl( aURL ); - - // each iteration remove last '/...' section from the aUrl - // while it's possible, up to the most left '://' - do - { - // first look for /somename and then look for /somename/... - PassMap::iterator aIter = m_aContainer.find( aUrl ); - if( aIter != m_aContainer.end() ) - { - UrlRecord aRec; - if ( createUrlRecord( aIter, bName, aName, aHandler, aRec ) ) - return aRec; - } - else - { - ::rtl::OUString tmpUrl( aUrl ); - if ( tmpUrl.getStr()[tmpUrl.getLength() - 1] != (sal_Unicode)'/' ) - tmpUrl += ::rtl::OUString::createFromAscii( "/" ); - - aIter = m_aContainer.lower_bound( tmpUrl ); - if( aIter != m_aContainer.end() && aIter->first.match( tmpUrl ) ) - { - UrlRecord aRec; - if ( createUrlRecord( aIter, bName, aName, aHandler, aRec ) ) - return aRec; - } - } - } - while( shorterUrl( aUrl ) && aUrl.getLength() ); - } - - return UrlRecord(); -} - -//------------------------------------------------------------------------- -::rtl::OUString PasswordContainer::GetDefaultMasterPassword() -{ - ::rtl::OUString aResult; - for ( sal_Int32 nInd = 0; nInd < RTL_DIGEST_LENGTH_MD5; nInd++ ) - aResult += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "aa" ) ); - - return aResult; -} - -//------------------------------------------------------------------------- -::rtl::OUString PasswordContainer::RequestPasswordFromUser( PasswordRequestMode aRMode, const uno::Reference< task::XInteractionHandler >& xHandler ) -{ - // empty string means that the call was cancelled or just failed - ::rtl::OUString aResult; - - if ( xHandler.is() ) - { - ::rtl::Reference< MasterPasswordRequest_Impl > xRequest = new MasterPasswordRequest_Impl( aRMode ); - - xHandler->handle( xRequest.get() ); - - ::rtl::Reference< ucbhelper::InteractionContinuation > xSelection = xRequest->getSelection(); - - if ( xSelection.is() ) - { - Reference< XInteractionAbort > xAbort( xSelection.get(), UNO_QUERY ); - if ( !xAbort.is() ) - { - const ::rtl::Reference< ucbhelper::InteractionSupplyAuthentication > & xSupp - = xRequest->getAuthenticationSupplier(); - - aResult = xSupp->getPassword(); - } - } - } - - return aResult; -} - -//------------------------------------------------------------------------- - -::rtl::OUString PasswordContainer::GetMasterPassword( const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException) -{ - PasswordRequestMode aRMode = PasswordRequestMode_PASSWORD_ENTER; - if( !m_pStorageFile || !m_pStorageFile->useStorage() ) - throw NoMasterException( ::rtl::OUString::createFromAscii( "Password storing is not active!" ), Reference< XInterface >(), aRMode ); - - if( !m_aMasterPasswd.getLength() && aHandler.is() ) - { - ::rtl::OUString aEncodedMP; - sal_Bool bAskAgain = sal_False; - sal_Bool bDefaultPassword = sal_False; - - if( !m_pStorageFile->getEncodedMP( aEncodedMP ) ) - aRMode = PasswordRequestMode_PASSWORD_CREATE; - else if ( !aEncodedMP.getLength() ) - { - m_aMasterPasswd = GetDefaultMasterPassword(); - bDefaultPassword = sal_True; - } - - if ( !bDefaultPassword ) - { - do { - bAskAgain = sal_False; - - ::rtl::OUString aPass = RequestPasswordFromUser( aRMode, aHandler ); - if ( aPass.getLength() ) - { - if( aRMode == PasswordRequestMode_PASSWORD_CREATE ) - { - m_aMasterPasswd = aPass; - vector< ::rtl::OUString > aMaster( 1, m_aMasterPasswd ); - - m_pStorageFile->setEncodedMP( EncodePasswords( aMaster, m_aMasterPasswd ) ); - } - else - { - vector< ::rtl::OUString > aRM( DecodePasswords( aEncodedMP, aPass ) ); - if( !aRM.size() || !aPass.equals( aRM[0] ) ) - { - bAskAgain = sal_True; - aRMode = PasswordRequestMode_PASSWORD_REENTER; - } - else - m_aMasterPasswd = aPass; - } - } - - } while( bAskAgain ); - } - } - - if ( !m_aMasterPasswd.getLength() ) - throw NoMasterException( ::rtl::OUString::createFromAscii( "No master password!" ), Reference< XInterface >(), aRMode ); - - return m_aMasterPasswd; -} - -//------------------------------------------------------------------------- - -void SAL_CALL PasswordContainer::remove( const ::rtl::OUString& aURL, const ::rtl::OUString& aName ) throw(RuntimeException) -{ - ::osl::MutexGuard aGuard( mMutex ); - - ::rtl::OUString aUrl( aURL ); - if( !m_aContainer.empty() ) - { - PassMap::iterator aIter = m_aContainer.find( aUrl ); - - if( aIter == m_aContainer.end() ) - { - sal_Int32 aInd = aUrl.lastIndexOf( sal_Unicode( '/' ) ); - if( aInd > 0 && aUrl.getLength()-1 == aInd ) - aUrl = aUrl.copy( 0, aUrl.getLength() - 1 ); - else - aUrl += ::rtl::OUString::createFromAscii( "/" ); - - aIter = m_aContainer.find( aUrl ); - } - - if( aIter != m_aContainer.end() ) - { - for( list< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); aNPIter++ ) - if( aNPIter->GetUserName().equals( aName ) ) - { - if( aNPIter->HasPasswords( PERSISTENT_RECORD ) && m_pStorageFile ) - m_pStorageFile->remove( aURL, aName ); // remove record ( aURL, aName ) - - // the iterator will not be used any more so it can be removed directly - aIter->second.erase( aNPIter ); - - if( aIter->second.begin() == aIter->second.end() ) - m_aContainer.erase( aIter ); - - return; - } - } - } -} - -//------------------------------------------------------------------------- - -void SAL_CALL PasswordContainer::removePersistent( const ::rtl::OUString& aURL, const ::rtl::OUString& aName ) throw(RuntimeException) -{ - ::osl::MutexGuard aGuard( mMutex ); - - ::rtl::OUString aUrl( aURL ); - if( !m_aContainer.empty() ) - { - PassMap::iterator aIter = m_aContainer.find( aUrl ); - - if( aIter == m_aContainer.end() ) - { - sal_Int32 aInd = aUrl.lastIndexOf( sal_Unicode( '/' ) ); - if( aInd > 0 && aUrl.getLength()-1 == aInd ) - aUrl = aUrl.copy( 0, aUrl.getLength() - 1 ); - else - aUrl += ::rtl::OUString::createFromAscii( "/" ); - - aIter = m_aContainer.find( aUrl ); - } - - if( aIter != m_aContainer.end() ) - { - for( list< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); aNPIter++ ) - if( aNPIter->GetUserName().equals( aName ) ) - { - if( aNPIter->HasPasswords( PERSISTENT_RECORD ) ) - { - // TODO/LATER: should the password be converted to MemoryPassword? - aNPIter->RemovePasswords( PERSISTENT_RECORD ); - - if ( m_pStorageFile ) - m_pStorageFile->remove( aURL, aName ); // remove record ( aURL, aName ) - } - - if( !aNPIter->HasPasswords( MEMORY_RECORD ) ) - aIter->second.erase( aNPIter ); - - if( aIter->second.begin() == aIter->second.end() ) - m_aContainer.erase( aIter ); - - return; - } - } - } -} -//------------------------------------------------------------------------- - -void SAL_CALL PasswordContainer::removeAllPersistent() throw(RuntimeException) -{ - ::osl::MutexGuard aGuard( mMutex ); - - if( m_pStorageFile ) - m_pStorageFile->clear(); - - for( PassMap::iterator aIter = m_aContainer.begin(); aIter != m_aContainer.end(); ) - { - for( list< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); ) - { - if( aNPIter->HasPasswords( PERSISTENT_RECORD ) ) - { - // TODO/LATER: should the password be converted to MemoryPassword? - aNPIter->RemovePasswords( PERSISTENT_RECORD ); - - if ( m_pStorageFile ) - m_pStorageFile->remove( aIter->first, aNPIter->GetUserName() ); // remove record ( aURL, aName ) - } - - if( !aNPIter->HasPasswords( MEMORY_RECORD ) ) - { - list< NamePassRecord >::iterator aIterToDelete( aNPIter ); - aNPIter++; - aIter->second.erase( aIterToDelete ); - } - else - aNPIter++; - } - - if( aIter->second.begin() == aIter->second.end() ) - { - PassMap::iterator aIterToDelete( aIter ); - aIter++; - m_aContainer.erase( aIterToDelete ); - } - else - aIter++; - } -} -//------------------------------------------------------------------------- - -Sequence< UrlRecord > SAL_CALL PasswordContainer::getAllPersistent( const Reference< XInteractionHandler >& xHandler ) throw(RuntimeException) -{ - Sequence< UrlRecord > aResult; - - ::osl::MutexGuard aGuard( mMutex ); - for( PassMap::iterator aIter = m_aContainer.begin(); aIter != m_aContainer.end(); aIter++ ) - { - Sequence< UserRecord > aUsers; - for( list< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); aNPIter++ ) - if( aNPIter->HasPasswords( PERSISTENT_RECORD ) ) - { - sal_Int32 oldLen = aUsers.getLength(); - aUsers.realloc( oldLen + 1 ); - aUsers[ oldLen ] = UserRecord( aNPIter->GetUserName(), copyVectorToSequence( DecodePasswords( aNPIter->GetPersPasswords(), GetMasterPassword( xHandler ) ) ) ); - } - - if( aUsers.getLength() ) - { - sal_Int32 oldLen = aResult.getLength(); - aResult.realloc( oldLen + 1 ); - aResult[ oldLen ] = UrlRecord( aIter->first, aUsers ); - } - } - - return aResult; -} - -//------------------------------------------------------------------------- -sal_Bool SAL_CALL PasswordContainer::authorizateWithMasterPassword( const uno::Reference< task::XInteractionHandler >& xHandler ) - throw (uno::RuntimeException) -{ - sal_Bool bResult = sal_False; - ::rtl::OUString aEncodedMP; - uno::Reference< task::XInteractionHandler > xTmpHandler = xHandler; - ::osl::MutexGuard aGuard( mMutex ); - - // the method should fail if there is no master password - if( m_pStorageFile && m_pStorageFile->useStorage() && m_pStorageFile->getEncodedMP( aEncodedMP ) ) - { - if ( !aEncodedMP.getLength() ) - { - // this is a default master password - // no UI is necessary - bResult = sal_True; - } - else - { - if ( !xTmpHandler.is() ) - { - uno::Reference< lang::XMultiServiceFactory > xFactory( mComponent, uno::UNO_QUERY_THROW ); - xTmpHandler.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ), uno::UNO_QUERY_THROW ); - } - - if ( m_aMasterPasswd.getLength() ) - { - // there is a password, it should be just rechecked - PasswordRequestMode aRMode = PasswordRequestMode_PASSWORD_ENTER; - ::rtl::OUString aPass; - - do { - aPass = RequestPasswordFromUser( aRMode, xTmpHandler ); - bResult = ( aPass.getLength() && aPass.equals( m_aMasterPasswd ) ); - aRMode = PasswordRequestMode_PASSWORD_REENTER; // further questions with error notification - } while( !bResult && aPass.getLength() ); - } - else - { - try - { - // ask for the password, if user provide no correct password an exception will be thrown - bResult = ( GetMasterPassword( xTmpHandler ).getLength() > 0 ); - } - catch( uno::Exception& ) - {} - } - } - } - - return bResult; -} - -//------------------------------------------------------------------------- -sal_Bool SAL_CALL PasswordContainer::changeMasterPassword( const uno::Reference< task::XInteractionHandler >& xHandler ) - throw (uno::RuntimeException) -{ - sal_Bool bResult = sal_False; - uno::Reference< task::XInteractionHandler > xTmpHandler = xHandler; - ::osl::MutexGuard aGuard( mMutex ); - - if ( m_pStorageFile && m_pStorageFile->useStorage() ) - { - if ( !xTmpHandler.is() ) - { - uno::Reference< lang::XMultiServiceFactory > xFactory( mComponent, uno::UNO_QUERY_THROW ); - xTmpHandler.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ), uno::UNO_QUERY_THROW ); - } - - sal_Bool bCanChangePassword = sal_True; - // if there is already a stored master password it should be entered by the user before the change happen - ::rtl::OUString aEncodedMP; - if( m_aMasterPasswd.getLength() || m_pStorageFile->getEncodedMP( aEncodedMP ) ) - bCanChangePassword = authorizateWithMasterPassword( xTmpHandler ); - - if ( bCanChangePassword ) - { - // ask for the new password, but do not set it - PasswordRequestMode aRMode = PasswordRequestMode_PASSWORD_CREATE; - ::rtl::OUString aPass = RequestPasswordFromUser( aRMode, xTmpHandler ); - - if ( aPass.getLength() ) - { - // get all the persistent entries if it is possible - Sequence< UrlRecord > aPersistent = getAllPersistent( uno::Reference< task::XInteractionHandler >() ); - - // remove the master password and the entries persistence - removeMasterPassword(); - - // store the new master password - m_aMasterPasswd = aPass; - vector< ::rtl::OUString > aMaster( 1, m_aMasterPasswd ); - m_pStorageFile->setEncodedMP( EncodePasswords( aMaster, m_aMasterPasswd ) ); - - // store all the entries with the new password - for ( int nURLInd = 0; nURLInd < aPersistent.getLength(); nURLInd++ ) - for ( int nNameInd = 0; nNameInd< aPersistent[nURLInd].UserList.getLength(); nNameInd++ ) - addPersistent( aPersistent[nURLInd].Url, - aPersistent[nURLInd].UserList[nNameInd].UserName, - aPersistent[nURLInd].UserList[nNameInd].Passwords, - uno::Reference< task::XInteractionHandler >() ); - - bResult = sal_True; - } - } - } - - return bResult; -} - -//------------------------------------------------------------------------- -void SAL_CALL PasswordContainer::removeMasterPassword() - throw (uno::RuntimeException) -{ - // remove all the stored passwords and the master password - removeAllPersistent(); - - ::osl::MutexGuard aGuard( mMutex ); - if ( m_pStorageFile ) - { - m_aMasterPasswd = ::rtl::OUString(); - m_pStorageFile->setEncodedMP( ::rtl::OUString() ); // let the master password be removed from configuration - } -} - -//------------------------------------------------------------------------- -::sal_Bool SAL_CALL PasswordContainer::hasMasterPassword( ) - throw (::com::sun::star::uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( mMutex ); - - if ( !m_pStorageFile ) - throw uno::RuntimeException(); - - ::rtl::OUString aEncodedMP; - return ( m_pStorageFile->useStorage() && m_pStorageFile->getEncodedMP( aEncodedMP ) ); -} - -//------------------------------------------------------------------------- -::sal_Bool SAL_CALL PasswordContainer::allowPersistentStoring( ::sal_Bool bAllow ) - throw (::com::sun::star::uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( mMutex ); - - if ( !m_pStorageFile ) - throw uno::RuntimeException(); - - if ( !bAllow ) - removeMasterPassword(); - - if ( m_pStorageFile->useStorage() == bAllow ) - return bAllow; - - m_pStorageFile->setUseStorage( bAllow ); - return !bAllow; -} - -//------------------------------------------------------------------------- -::sal_Bool SAL_CALL PasswordContainer::isPersistentStoringAllowed() - throw (::com::sun::star::uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( mMutex ); - - if ( !m_pStorageFile ) - throw uno::RuntimeException(); - - return m_pStorageFile->useStorage(); -} - -//------------------------------------------------------------------------- -::sal_Bool SAL_CALL PasswordContainer::useDefaultMasterPassword( const uno::Reference< task::XInteractionHandler >& xHandler ) - throw ( uno::RuntimeException ) -{ - sal_Bool bResult = sal_False; - uno::Reference< task::XInteractionHandler > xTmpHandler = xHandler; - ::osl::MutexGuard aGuard( mMutex ); - - if ( m_pStorageFile && m_pStorageFile->useStorage() ) - { - if ( !xTmpHandler.is() ) - { - uno::Reference< lang::XMultiServiceFactory > xFactory( mComponent, uno::UNO_QUERY_THROW ); - xTmpHandler.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ), uno::UNO_QUERY_THROW ); - } - - sal_Bool bCanChangePassword = sal_True; - // if there is already a stored nondefault master password it should be entered by the user before the change happen - ::rtl::OUString aEncodedMP; - if( m_pStorageFile->getEncodedMP( aEncodedMP ) && aEncodedMP.getLength() ) - bCanChangePassword = authorizateWithMasterPassword( xTmpHandler ); - - if ( bCanChangePassword ) - { - // generate the default password - ::rtl::OUString aPass = GetDefaultMasterPassword(); - if ( aPass.getLength() ) - { - // get all the persistent entries if it is possible - Sequence< UrlRecord > aPersistent = getAllPersistent( uno::Reference< task::XInteractionHandler >() ); - - // remove the master password and the entries persistence - removeMasterPassword(); - - // store the empty string to flag the default master password - m_aMasterPasswd = aPass; - m_pStorageFile->setEncodedMP( ::rtl::OUString(), sal_True ); - - // store all the entries with the new password - for ( int nURLInd = 0; nURLInd < aPersistent.getLength(); nURLInd++ ) - for ( int nNameInd = 0; nNameInd< aPersistent[nURLInd].UserList.getLength(); nNameInd++ ) - addPersistent( aPersistent[nURLInd].Url, - aPersistent[nURLInd].UserList[nNameInd].UserName, - aPersistent[nURLInd].UserList[nNameInd].Passwords, - uno::Reference< task::XInteractionHandler >() ); - - bResult = sal_True; - } - } - } - - return bResult; - -} - -//------------------------------------------------------------------------- -::sal_Bool SAL_CALL PasswordContainer::isDefaultMasterPasswordUsed() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( mMutex ); - - if ( !m_pStorageFile ) - throw uno::RuntimeException(); - - ::rtl::OUString aEncodedMP; - return ( m_pStorageFile->useStorage() && m_pStorageFile->getEncodedMP( aEncodedMP ) && !aEncodedMP.getLength() ); -} - - -//------------------------------------------------------------------------- -void SAL_CALL PasswordContainer::addUrl( const ::rtl::OUString& Url, ::sal_Bool MakePersistent ) - throw (uno::RuntimeException) -{ - mUrlContainer.add( Url, MakePersistent ); -} - -//------------------------------------------------------------------------- -::rtl::OUString SAL_CALL PasswordContainer::findUrl( const ::rtl::OUString& Url ) - throw (uno::RuntimeException) -{ - return mUrlContainer.find( Url ); -} - -//------------------------------------------------------------------------- -void SAL_CALL PasswordContainer::removeUrl( const ::rtl::OUString& Url ) - throw (uno::RuntimeException) -{ - mUrlContainer.remove( Url ); -} - -//------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > SAL_CALL PasswordContainer::getUrls( ::sal_Bool OnlyPersistent ) - throw (uno::RuntimeException) -{ - return mUrlContainer.list( OnlyPersistent ); -} - -//------------------------------------------------------------------------- - -void PasswordContainer::Notify() -{ - ::osl::MutexGuard aGuard( mMutex ); - - PassMap::iterator aIter; - - // remove the cached persistent values in the memory - for( aIter = m_aContainer.begin(); aIter != m_aContainer.end(); aIter++ ) - { - for( list< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); ) - { - if( aNPIter->HasPasswords( PERSISTENT_RECORD ) ) - { - aNPIter->RemovePasswords( PERSISTENT_RECORD ); - - if ( m_pStorageFile ) - m_pStorageFile->remove( aIter->first, aNPIter->GetUserName() ); // remove record ( aURL, aName ) - } - - if( !aNPIter->HasPasswords( MEMORY_RECORD ) ) - { - list< NamePassRecord >::iterator aIterToDelete( aNPIter ); - aNPIter++; - aIter->second.erase( aIterToDelete ); - } - else - aNPIter++; - } - } - - PassMap addon; - if( m_pStorageFile ) - addon = m_pStorageFile->getInfo(); - - for( aIter = addon.begin(); aIter != addon.end(); aIter++ ) - { - PassMap::iterator aSearchIter = m_aContainer.find( aIter->first ); - if( aSearchIter != m_aContainer.end() ) - for( list< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); aNPIter++ ) - UpdateVector( aSearchIter->first, aSearchIter->second, *aNPIter, sal_False ); - else - m_aContainer.insert( PairUrlRecord( aIter->first, aIter->second ) ); - } -} - -//------------------------------------------------------------------------- - -::rtl::OUString SAL_CALL PasswordContainer::getImplementationName( ) throw(uno::RuntimeException) -{ - return impl_getStaticImplementationName(); -} - -//------------------------------------------------------------------------- - -sal_Bool SAL_CALL PasswordContainer::supportsService( const ::rtl::OUString& ServiceName ) throw(uno::RuntimeException) -{ - if ( ServiceName.compareToAscii("com.sun.star.task.PasswordContainer") == 0 ) - return sal_True; - else - return sal_False; -} - -//------------------------------------------------------------------------- - -Sequence< ::rtl::OUString > SAL_CALL PasswordContainer::getSupportedServiceNames( ) throw(uno::RuntimeException) -{ - return impl_getStaticSupportedServiceNames(); -} - -//------------------------------------------------------------------------- - -Sequence< ::rtl::OUString > SAL_CALL PasswordContainer::impl_getStaticSupportedServiceNames( ) throw(uno::RuntimeException) -{ - Sequence< ::rtl::OUString > aRet(1); - *aRet.getArray() = ::rtl::OUString::createFromAscii("com.sun.star.task.PasswordContainer"); - return aRet; -} - -//------------------------------------------------------------------------- - -::rtl::OUString SAL_CALL PasswordContainer::impl_getStaticImplementationName() throw(uno::RuntimeException) -{ - return ::rtl::OUString::createFromAscii("stardiv.svtools.PasswordContainer"); -} - -//------------------------------------------------------------------------- - -Reference< XInterface > SAL_CALL PasswordContainer::impl_createInstance( const Reference< XMultiServiceFactory >& xServiceManager ) throw( RuntimeException ) -{ - return Reference< XInterface >( *new PasswordContainer( xServiceManager ) ); -} - -//------------------------------------------------------------------------- - -Reference< XSingleServiceFactory > SAL_CALL PasswordContainer::impl_createFactory( const Reference< XMultiServiceFactory >& ServiceManager ) throw(RuntimeException) -{ - Reference< XSingleServiceFactory > xReturn( ::cppu::createOneInstanceFactory( ServiceManager, - PasswordContainer::impl_getStaticImplementationName(), - PasswordContainer::impl_createInstance, - PasswordContainer::impl_getStaticSupportedServiceNames())); - return xReturn ; - -} - -//------------------------------------------------------------------------- -//------------------------------------------------------------------------- - -MasterPasswordRequest_Impl::MasterPasswordRequest_Impl( PasswordRequestMode Mode ) -{ - MasterPasswordRequest aRequest; - - aRequest.Classification = InteractionClassification_ERROR; - aRequest.Mode = Mode; - - setRequest( makeAny( aRequest ) ); - - // Fill continuations... - Sequence< RememberAuthentication > aRememberModes( 1 ); - aRememberModes[ 0 ] = RememberAuthentication_NO; - - m_xAuthSupplier - = new ::ucbhelper::InteractionSupplyAuthentication( - this, - sal_False, // bCanSetRealm - sal_False, // bCanSetUserName - sal_True, // bCanSetPassword - sal_False, // bCanSetAccount - aRememberModes, // rRememberPasswordModes - RememberAuthentication_NO, // eDefaultRememberPasswordMode - aRememberModes, // rRememberAccountModes - RememberAuthentication_NO, // eDefaultRememberAccountMode - sal_False, // bCanUseSystemCredentials - sal_False // bDefaultUseSystemCredentials - ); - - Sequence< - Reference< XInteractionContinuation > > aContinuations( 3 ); - aContinuations[ 0 ] = new ::ucbhelper::InteractionAbort( this ); - aContinuations[ 1 ] = new ::ucbhelper::InteractionRetry( this ); - aContinuations[ 2 ] = m_xAuthSupplier.get(); - - setContinuations( aContinuations ); -} - -//------------------------------------------------------------------------- -//------------------------------------------------------------------------- - -extern "C" -{ -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( - void * /* pServiceManager */, void * pRegistryKey) -{ - if (pRegistryKey) - { - Reference< XRegistryKey > xRegistryKey ( - reinterpret_cast< XRegistryKey* >( pRegistryKey )); - Reference< XRegistryKey > xNewKey; - - xNewKey = xRegistryKey->createKey( - ::rtl::OUString::createFromAscii( "/stardiv.svtools.PasswordContainer/UNO/SERVICES" )); - xNewKey->createKey( ::rtl::OUString::createFromAscii("com.sun.star.task.PasswordContainer")); - - return sal_True; - } - return sal_False; -} - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( - const sal_Char * pImplementationName, void * pServiceManager, void * /* pRegistryKey */) -{ - void * pResult = 0; - if (pServiceManager) - { - Reference< XSingleServiceFactory > xFactory; - if (PasswordContainer::impl_getStaticImplementationName().compareToAscii (pImplementationName) == 0) - { - xFactory = PasswordContainer::impl_createFactory ( - reinterpret_cast< XMultiServiceFactory* >(pServiceManager)); - } - if (xFactory.is()) - { - xFactory->acquire(); - pResult = xFactory.get(); - } - } - return pResult; -} - -} // extern "C" diff --git a/svtools/source/passwordcontainer/syscreds.cxx b/svtools/source/passwordcontainer/syscreds.cxx deleted file mode 100644 index b8c223040e6d..000000000000 --- a/svtools/source/passwordcontainer/syscreds.cxx +++ /dev/null @@ -1,298 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: $ - * $Revision: $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "syscreds.hxx" -#include "com/sun/star/beans/PropertyValue.hpp" - -using namespace com::sun::star; - -SysCredentialsConfigItem::SysCredentialsConfigItem( - SysCredentialsConfig * pOwner ) -: utl::ConfigItem( rtl::OUString::createFromAscii( "Office.Common/Passwords" ), - CONFIG_MODE_IMMEDIATE_UPDATE ), - m_bInited( false ), - m_pOwner( pOwner ) -{ - uno::Sequence< ::rtl::OUString > aNode( 1 ); - aNode[ 0 ] = rtl::OUString::createFromAscii( - "Office.Common/Passwords/AuthenticateUsingSystemCredentials" ); - EnableNotification( aNode ); -} - -//virtual -void SysCredentialsConfigItem::Notify( - const uno::Sequence< rtl::OUString > & /*seqPropertyNames*/ ) -{ - { - ::osl::MutexGuard aGuard( m_aMutex ); - m_bInited = false; - // rebuild m_seqURLs - getSystemCredentialsURLs(); - } - m_pOwner->persistentConfigChanged(); -} - -uno::Sequence< rtl::OUString > -SysCredentialsConfigItem::getSystemCredentialsURLs() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !m_bInited ) - { - // read config item - uno::Sequence< ::rtl::OUString > aPropNames( 1 ); - aPropNames[ 0 ] = rtl::OUString::createFromAscii( - "AuthenticateUsingSystemCredentials" ); - uno::Sequence< uno::Any > aAnyValues( - utl::ConfigItem::GetProperties( aPropNames ) ); - - OSL_ENSURE( - aAnyValues.getLength() == 1, - "SysCredentialsConfigItem::getSystemCredentialsURLs: " - "Error reading config item!" ); - - uno::Sequence< rtl::OUString > aValues; - if ( ( aAnyValues[ 0 ] >>= aValues ) || - ( !aAnyValues[ 0 ].hasValue() ) ) - { - m_seqURLs = aValues; - m_bInited = true; - } - } - return m_seqURLs; -} - -void SysCredentialsConfigItem::setSystemCredentialsURLs( - const uno::Sequence< rtl::OUString > & seqURLList ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - // write config item. - uno::Sequence< rtl::OUString > aPropNames( 1 ); - uno::Sequence< uno::Any > aPropValues( 1 ); - aPropNames[ 0 ] - = ::rtl::OUString::createFromAscii( - "AuthenticateUsingSystemCredentials" ); - aPropValues[ 0 ] <<= seqURLList; - - utl::ConfigItem::SetModified(); - utl::ConfigItem::PutProperties( aPropNames, aPropValues ); - - m_seqURLs = seqURLList; - m_bInited = true; -} - -//============================================================================ - -namespace -{ - // TODO: This code is actually copied from svtools/source/passwordcontainer.cxx - bool removeLastSegment( ::rtl::OUString & aURL ) - { - sal_Int32 aInd = aURL.lastIndexOf( sal_Unicode( '/' ) ); - - if( aInd > 0 ) - { - sal_Int32 aPrevInd = aURL.lastIndexOf( sal_Unicode( '/' ), aInd ); - if ( aURL.indexOf( ::rtl::OUString::createFromAscii( "://" ) ) - != aPrevInd - 2 || - aInd != aURL.getLength() - 1 ) - { - aURL = aURL.copy( 0, aInd ); - return true; - } - } - - return false; - } - - bool findURL( StringSet const & rContainer, rtl::OUString const & aURL, rtl::OUString & aResult ) - { - // TODO: This code is actually copied from svtools/source/passwordcontainer.cxx - if( !rContainer.empty() && aURL.getLength() ) - { - ::rtl::OUString aUrl( aURL ); - - // each iteration remove last '/...' section from the aUrl - // while it's possible, up to the most left '://' - do - { - // first look for /somename and then look for /somename/... - StringSet::const_iterator aIter = rContainer.find( aUrl ); - if( aIter != rContainer.end() ) - { - aResult = *aIter; - return true; - } - else - { - ::rtl::OUString tmpUrl( aUrl ); - if ( tmpUrl.getStr()[tmpUrl.getLength() - 1] != (sal_Unicode)'/' ) - tmpUrl += ::rtl::OUString::createFromAscii( "/" ); - - aIter = rContainer.lower_bound( tmpUrl ); - if( aIter != rContainer.end() && aIter->match( tmpUrl ) ) - { - aResult = *aIter; - return true; - } - } - } - while( removeLastSegment( aUrl ) && aUrl.getLength() ); - } - aResult = rtl::OUString(); - return false; - } - -} // namespace - -SysCredentialsConfig::SysCredentialsConfig() -: m_aConfigItem( this ), - m_bCfgInited( false ) -{ -} - -void SysCredentialsConfig::initCfg() -{ - osl::MutexGuard aGuard( m_aMutex ); - if ( !m_bCfgInited ) - { - uno::Sequence< rtl::OUString > aURLs( - m_aConfigItem.getSystemCredentialsURLs() ); - for ( sal_Int32 n = 0; n < aURLs.getLength(); ++n ) - m_aCfgContainer.insert( aURLs[ n ] ); - - m_bCfgInited = true; - } -} - -void SysCredentialsConfig::writeCfg() -{ - osl::MutexGuard aGuard( m_aMutex ); - - OSL_ENSURE( m_bCfgInited, "SysCredentialsConfig::writeCfg : not initialized!" ); - - uno::Sequence< rtl::OUString > aURLs( m_aCfgContainer.size() ); - StringSet::const_iterator it = m_aCfgContainer.begin(); - const StringSet::const_iterator end = m_aCfgContainer.end(); - sal_Int32 n = 0; - - while ( it != end ) - { - aURLs[ n ] = *it; - ++it; - ++n; - } - - m_aConfigItem.setSystemCredentialsURLs( aURLs ); -} - -rtl::OUString SysCredentialsConfig::find( rtl::OUString const & aURL ) -{ - osl::MutexGuard aGuard( m_aMutex ); - rtl::OUString aResult; - if ( findURL( m_aMemContainer, aURL, aResult ) ) - return aResult; - - initCfg(); - if ( findURL( m_aCfgContainer, aURL, aResult ) ) - return aResult; - - return rtl::OUString(); -} - -void SysCredentialsConfig::add( rtl::OUString const & rURL, bool bPersistent ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( bPersistent ) - { - m_aMemContainer.erase( rURL ); - - initCfg(); - m_aCfgContainer.insert( rURL ); - writeCfg(); - } - else - { - initCfg(); - if ( m_aCfgContainer.erase( rURL ) > 0 ) - writeCfg(); - - m_aMemContainer.insert( rURL ); - } -} - -void SysCredentialsConfig::remove( rtl::OUString const & rURL ) -{ - m_aMemContainer.erase( rURL ); - - initCfg(); - if ( m_aCfgContainer.erase( rURL ) > 0 ) - writeCfg(); -} - -uno::Sequence< rtl::OUString > SysCredentialsConfig::list( bool bOnlyPersistent ) -{ - initCfg(); - sal_Int32 nCount = m_aCfgContainer.size() - + ( bOnlyPersistent ? 0 : m_aMemContainer.size() ); - uno::Sequence< rtl::OUString > aResult( nCount ); - - StringSet::const_iterator it = m_aCfgContainer.begin(); - StringSet::const_iterator end = m_aCfgContainer.end(); - sal_Int32 n = 0; - - while ( it != end ) - { - aResult[ n ] = *it; - ++it; - ++n; - } - - if ( !bOnlyPersistent ) - { - it = m_aMemContainer.begin(); - end = m_aMemContainer.end(); - - while ( it != end ) - { - aResult[ n ] = *it; - ++it; - ++n; - } - } - return aResult; -} - -void SysCredentialsConfig::persistentConfigChanged() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - m_bCfgInited = false; // re-init on demand. -} diff --git a/svtools/source/passwordcontainer/syscreds.hxx b/svtools/source/passwordcontainer/syscreds.hxx deleted file mode 100644 index b037e17c348e..000000000000 --- a/svtools/source/passwordcontainer/syscreds.hxx +++ /dev/null @@ -1,95 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: $ - * $Revision: $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_SVTOOLS_SYSCREDS_HXX -#define INCLUDED_SVTOOLS_SYSCREDS_HXX - -#include -#include -#include "osl/mutex.hxx" -#include "rtl/ustring.hxx" -#include "com/sun/star/uno/Sequence.hxx" -#include "unotools/configitem.hxx" - -class SysCredentialsConfig; - -class SysCredentialsConfigItem : public utl::ConfigItem -{ - public: - SysCredentialsConfigItem( SysCredentialsConfig * pOwner ); - //virtual ~SysCredentialsConfigItem(); - - virtual void Notify( - const com::sun::star::uno::Sequence< rtl::OUString > & - seqPropertyNames ); - //virtual void Commit(); - - com::sun::star::uno::Sequence< rtl::OUString > - getSystemCredentialsURLs(); - - void setSystemCredentialsURLs( - const com::sun::star::uno::Sequence< rtl::OUString > & - seqURLList ); - - //bool isSystemCredentialsURL( const rtl::OUString & rURL ) const; - -private: - ::osl::Mutex m_aMutex; - bool m_bInited; - com::sun::star::uno::Sequence< rtl::OUString > m_seqURLs; - SysCredentialsConfig * m_pOwner; -}; - -typedef std::set< rtl::OUString > StringSet; - -class SysCredentialsConfig -{ - public: - SysCredentialsConfig(); - - rtl::OUString find( rtl::OUString const & rURL ); - void add( rtl::OUString const & rURL, bool bPersistent ); - void remove( rtl::OUString const & rURL ); - com::sun::star::uno::Sequence< rtl::OUString > list( bool bOnlyPersistent ); - - void persistentConfigChanged(); - - private: - void initCfg(); - void writeCfg(); - - ::osl::Mutex m_aMutex; - StringSet m_aMemContainer; - StringSet m_aCfgContainer; - SysCredentialsConfigItem m_aConfigItem; - bool m_bCfgInited; -}; - -#endif // INCLUDED_SVTOOLS_SYSCREDS_HXX diff --git a/svtools/source/svdde/ddecli.cxx b/svtools/source/svdde/ddecli.cxx deleted file mode 100644 index e31e53d07522..000000000000 --- a/svtools/source/svdde/ddecli.cxx +++ /dev/null @@ -1,474 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ddecli.cxx,v $ - * $Revision: 1.9 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#define UNICODE -#include // memset -#include "ddeimp.hxx" -#include - -#include -#include -#include -#include - -// static DWORD hDdeInst = NULL; -// static short nInstance = 0; - -// DdeConnections* DdeConnection::pConnections = NULL; - -DdeInstData* ImpInitInstData() -{ - DdeInstData* pData = new DdeInstData; - memset( pData,0,sizeof(DdeInstData) ); - DdeInstData** ppInst = (DdeInstData**)GetAppData( SHL_SVDDE ); - *ppInst = pData; - return pData; -} - -void ImpDeinitInstData() -{ - DdeInstData** ppInst = (DdeInstData**)GetAppData( SHL_SVDDE ); - delete (*ppInst); - *ppInst = 0; -} - - -struct DdeImp -{ - HCONV hConv; - long nStatus; -}; - -// --- DdeInternat::CliCallback() ---------------------------------- - -HDDEDATA CALLBACK DdeInternal::CliCallback( - WORD nCode, WORD nCbType, HCONV hConv, HSZ, HSZ hText2, - HDDEDATA hData, DWORD nInfo1, DWORD ) -{ - HDDEDATA nRet = DDE_FNOTPROCESSED; - DdeConnections& rAll = (DdeConnections&)DdeConnection::GetConnections(); - DdeConnection* self = 0; - - DdeInstData* pInst = ImpGetInstData(); - DBG_ASSERT(pInst,"SVDDE:No instance data"); - - for ( self = rAll.First(); self; self = rAll.Next() ) - if ( self->pImp->hConv == hConv ) - break; - - if( self ) - { - DdeTransaction* t; - BOOL bFound = FALSE; - for( t = self->aTransactions.First(); t; t = self->aTransactions.Next() ) - { - switch( nCode ) - { - case XTYP_XACT_COMPLETE: - if( (DWORD)t->nId == nInfo1 ) - { - nCode = t->nType & (XCLASS_MASK | XTYP_MASK); - t->bBusy = FALSE; - t->Done( 0 != hData ); - bFound = TRUE; - } - break; - - case XTYP_DISCONNECT: - self->pImp->hConv = DdeReconnect( hConv ); - self->pImp->nStatus = self->pImp->hConv - ? DMLERR_NO_ERROR - : DdeGetLastError( pInst->hDdeInstCli ); - t = 0; - nRet = 0; - bFound = TRUE; - break; - - case XTYP_ADVDATA: - bFound = BOOL( *t->pName == hText2 ); - break; - } - if( bFound ) - break; - } - - if( t ) - { - switch( nCode ) - { - case XTYP_ADVDATA: - if( !hData ) - { - ((DdeLink*) t)->Notify(); - nRet = (HDDEDATA)DDE_FACK; - break; - } - // kein break; - - case XTYP_REQUEST: - if( !hData && XTYP_REQUEST == nCode ) - { - - } - - DdeData d; - d.pImp->hData = hData; - d.pImp->nFmt = DdeData::GetInternalFormat( nCbType ); - d.Lock(); - t->Data( &d ); - nRet = (HDDEDATA)DDE_FACK; - break; - } - } - } - return nRet; -} - -// --- DdeConnection::DdeConnection() ------------------------------ - -DdeConnection::DdeConnection( const String& rService, const String& rTopic ) -{ - pImp = new DdeImp; - pImp->nStatus = DMLERR_NO_ERROR; - pImp->hConv = NULL; - - DdeInstData* pInst = ImpGetInstData(); - if( !pInst ) - pInst = ImpInitInstData(); - pInst->nRefCount++; - pInst->nInstanceCli++; - if ( !pInst->hDdeInstCli ) - { - pImp->nStatus = DdeInitialize( &pInst->hDdeInstCli, - (PFNCALLBACK)DdeInternal::CliCallback, - APPCLASS_STANDARD | APPCMD_CLIENTONLY | - CBF_FAIL_ALLSVRXACTIONS | - CBF_SKIP_REGISTRATIONS | - CBF_SKIP_UNREGISTRATIONS, 0L ); - pInst->pConnections = new DdeConnections; - } - - pService = new DdeString( pInst->hDdeInstCli, rService ); - pTopic = new DdeString( pInst->hDdeInstCli, rTopic ); - - if ( pImp->nStatus == DMLERR_NO_ERROR ) - { - pImp->hConv = DdeConnect( pInst->hDdeInstCli,*pService,*pTopic, NULL); - if( !pImp->hConv ) - pImp->nStatus = DdeGetLastError( pInst->hDdeInstCli ); - } - - if ( pInst->pConnections ) - pInst->pConnections->Insert( this ); -} - -// --- DdeConnection::~DdeConnection() ----------------------------- - -DdeConnection::~DdeConnection() -{ - if ( pImp->hConv ) - DdeDisconnect( pImp->hConv ); - - delete pService; - delete pTopic; - - DdeInstData* pInst = ImpGetInstData(); - DBG_ASSERT(pInst,"SVDDE:No instance data"); - if ( pInst->pConnections ) - pInst->pConnections->Remove( this ); - - pInst->nInstanceCli--; - pInst->nRefCount--; - if ( !pInst->nInstanceCli && pInst->hDdeInstCli ) - { - if( DdeUninitialize( pInst->hDdeInstCli ) ) - { - pInst->hDdeInstCli = NULL; - delete pInst->pConnections; - pInst->pConnections = NULL; - if( pInst->nRefCount == 0 ) - ImpDeinitInstData(); - } - } - delete pImp; -} - -// --- DdeConnection::IsConnected() -------------------------------- - -BOOL DdeConnection::IsConnected() -{ - CONVINFO c; -#ifdef OS2 - c.nSize = sizeof( c ); -#else - c.cb = sizeof( c ); -#endif - if ( DdeQueryConvInfo( pImp->hConv, QID_SYNC, &c ) ) - return TRUE; - else - { - DdeInstData* pInst = ImpGetInstData(); - pImp->hConv = DdeReconnect( pImp->hConv ); - pImp->nStatus = pImp->hConv ? DMLERR_NO_ERROR : DdeGetLastError( pInst->hDdeInstCli ); - return BOOL( pImp->nStatus == DMLERR_NO_ERROR ); - } -} - -// --- DdeConnection::GetServiceName() ----------------------------- - -const String& DdeConnection::GetServiceName() -{ - return (const String&)*pService; -} - -// --- DdeConnection::GetTopicName() ------------------------------- - -const String& DdeConnection::GetTopicName() -{ - return (const String&)*pTopic; -} - -// --- DdeConnection::GetConvId() ---------------------------------- - -long DdeConnection::GetConvId() -{ - return (long)pImp->hConv; -} - -const DdeConnections& DdeConnection::GetConnections() -{ - DdeInstData* pInst = ImpGetInstData(); - DBG_ASSERT(pInst,"SVDDE:No instance data"); - return *(pInst->pConnections); -} - -// --- DdeTransaction::DdeTransaction() ---------------------------- - -DdeTransaction::DdeTransaction( DdeConnection& d, const String& rItemName, - long n ) : - rDde( d ) -{ - DdeInstData* pInst = ImpGetInstData(); - pName = new DdeString( pInst->hDdeInstCli, rItemName ); - nTime = n; - nId = 0; - nType = 0; - bBusy = FALSE; - - rDde.aTransactions.Insert( this ); -} - -// --- DdeTransaction::~DdeTransaction() --------------------------- - -DdeTransaction::~DdeTransaction() -{ - if ( nId && rDde.pImp->hConv ) - { - DdeInstData* pInst = ImpGetInstData(); - DdeAbandonTransaction( pInst->hDdeInstCli, rDde.pImp->hConv, nId ); - } - - delete pName; - rDde.aTransactions.Remove( this ); -} - -// --- DdeTransaction::Execute() ----------------------------------- - -void DdeTransaction::Execute() -{ - HSZ hItem = *pName; - void* pData = (void*)(const void *)aDdeData; - DWORD nData = (DWORD)(long)aDdeData; - ULONG nIntFmt = aDdeData.pImp->nFmt; - UINT nExtFmt = DdeData::GetExternalFormat( nIntFmt ); - DdeInstData* pInst = ImpGetInstData(); - - if ( nType == XTYP_EXECUTE ) - hItem = NULL; - if ( nType != XTYP_EXECUTE && nType != XTYP_POKE ) - { - pData = NULL; - nData = 0L; - } - if ( nTime ) - { - HDDEDATA hData = DdeClientTransaction( (unsigned char*)pData, - nData, rDde.pImp->hConv, - hItem, nExtFmt, (UINT)nType, - (DWORD)nTime, (DWORD FAR*)NULL ); - - rDde.pImp->nStatus = DdeGetLastError( pInst->hDdeInstCli ); - if( hData && nType == XTYP_REQUEST ) - { - { - DdeData d; - d.pImp->hData = hData; - d.pImp->nFmt = nIntFmt; - d.Lock(); - Data( &d ); - } - DdeFreeDataHandle( hData ); - } - } - else - { - if ( nId && rDde.pImp->hConv ) - DdeAbandonTransaction( pInst->hDdeInstCli, rDde.pImp->hConv, nId); - nId = 0; - bBusy = TRUE; - HDDEDATA hRet = DdeClientTransaction( (unsigned char*)pData, nData, - rDde.pImp->hConv, hItem, nExtFmt, - (UINT)nType, TIMEOUT_ASYNC, - (DWORD FAR *) ((long*) &nId) ); - rDde.pImp->nStatus = hRet ? DMLERR_NO_ERROR - : DdeGetLastError( pInst->hDdeInstCli ); - } -} - -// --- DdeTransaction::GetName() ----------------------------------- - -const String& DdeTransaction::GetName() const -{ - return *pName; -} - -// --- DdeTransaction::Data() -------------------------------------- - - -void __EXPORT DdeTransaction::Data( const DdeData* p ) -{ - Application::GetSolarMutex().acquire(); - aData.Call( (void*)p ); - Application::GetSolarMutex().release(); -} - -// --- DdeTransaction::Done() -------------------------------------- - -void __EXPORT DdeTransaction::Done( BOOL bDataValid ) -{ - aDone.Call( (void*)bDataValid ); -} - -// --- DdeLink::DdeLink() ------------------------------------------ - -DdeLink::DdeLink( DdeConnection& d, const String& aItemName, long n ) : - DdeTransaction (d, aItemName, n) -{ -} - -// --- DdeLink::~DdeLink() ----------------------------------------- - -DdeLink::~DdeLink() -{ - nType = (USHORT)XTYP_ADVSTOP; - nTime = 0; -} - -// --- DdeLink::Notify() ----------------------------------------- - -void __EXPORT DdeLink::Notify() -{ - aNotify.Call( NULL ); -} - -// --- DdeRequest::DdeRequest() ------------------------------------ - -DdeRequest::DdeRequest( DdeConnection& d, const String& i, long n ) : - DdeTransaction( d, i, n ) -{ - nType = XTYP_REQUEST; -} - -// --- DdeWarmLink::DdeWarmLink() ---------------------------------- - -DdeWarmLink::DdeWarmLink( DdeConnection& d, const String& i, long n ) : - DdeLink( d, i, n ) -{ - nType = XTYP_ADVSTART | XTYPF_NODATA; -} - -// --- DdeHotLink::DdeHotLink() ------------------------------------ - -DdeHotLink::DdeHotLink( DdeConnection& d, const String& i, long n ) : - DdeLink( d, i, n ) -{ - nType = XTYP_ADVSTART; -} - -// --- DdePoke::DdePoke() ------------------------------------------ - -DdePoke::DdePoke( DdeConnection& d, const String& i, const char* p, - long l, ULONG f, long n ) : - DdeTransaction( d, i, n ) -{ - aDdeData = DdeData( p, l, f ); - nType = XTYP_POKE; -} - -// --- DdePoke::DdePoke() ------------------------------------------ - -DdePoke::DdePoke( DdeConnection& d, const String& i, const String& rData, - long n ) : - DdeTransaction( d, i, n ) -{ -// ByteString aByteStr( rData, osl_getThreadTextEncoding() ); - aDdeData = DdeData( (void*) rData.GetBuffer(), sizeof(sal_Unicode) * (rData.Len()), CF_TEXT ); - nType = XTYP_POKE; -} - -// --- DdePoke::DdePoke() ------------------------------------------ - -DdePoke::DdePoke( DdeConnection& d, const String& i, const DdeData& rData, - long n ) : - DdeTransaction( d, i, n ) -{ - aDdeData = rData; - nType = XTYP_POKE; -} - -// --- DdeExecute::DdeExecute() ------------------------------------ - -DdeExecute::DdeExecute( DdeConnection& d, const String& rData, long n ) : - DdeTransaction( d, String(), n ) -{ -// ByteString aByteStr( rData, osl_getThreadTextEncoding() ); - aDdeData = DdeData( (void*)rData.GetBuffer(), sizeof(sal_Unicode) * (rData.Len() + 1), CF_TEXT ); - nType = XTYP_EXECUTE; -} - -// --- DdeConnection::GetError() ----------------------------------- - -long DdeConnection::GetError() -{ - return pImp->nStatus; -} diff --git a/svtools/source/svdde/ddedata.cxx b/svtools/source/svdde/ddedata.cxx deleted file mode 100644 index 9167c8585b08..000000000000 --- a/svtools/source/svdde/ddedata.cxx +++ /dev/null @@ -1,233 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ddedata.cxx,v $ - * $Revision: 1.8 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -// ACHTUNG: es wird angenommen, dass StarView-Clipboard-Foamatnummern -// und Windows-Formatnummern identisch sind! Ist dies einmal nicht der -// Fall, muessen die Routinen hier angepasst werden. Die Implementation -// verwendet die hier defineirten Konversionen. - -#define UNICODE - -#include -#include "ddeimp.hxx" -#include - -#include - -#if defined( WIN ) && defined( MSC ) -#pragma code_seg( "SVDDE_MISC_CODE" ) -#endif - -// --- DdeData::DdeData() ------------------------------------------ - -DdeData::DdeData() -{ - pImp = new DdeDataImp; - pImp->hData = NULL; - pImp->nData = 0; - pImp->pData = NULL; - pImp->nFmt = CF_TEXT; -} - -// --- DdeData::DdeData() ------------------------------------------ - -DdeData::DdeData( const void* p, long n, ULONG f ) -{ - pImp = new DdeDataImp; - pImp->hData = NULL; - pImp->pData = (LPBYTE)p; - pImp->nData = n; - pImp->nFmt = f; -} - -// --- DdeData::DdeData() ------------------------------------------ - -DdeData::DdeData( const String& s ) -{ - pImp = new DdeDataImp; - pImp->hData = NULL; - pImp->pData = (LPBYTE)s.GetBuffer(); - pImp->nData = s.Len()+1; - pImp->nFmt = CF_TEXT; -} - -// --- DdeData::DdeData() ------------------------------------------ - -DdeData::DdeData( const DdeData& rData ) -{ - pImp = new DdeDataImp; - pImp->hData = rData.pImp->hData; - pImp->nData = rData.pImp->nData; - pImp->pData = rData.pImp->pData; - pImp->nFmt = rData.pImp->nFmt; - Lock(); -} - -// --- DdeData::~DdeData() ----------------------------------------- - -DdeData::~DdeData() -{ - if ( pImp && pImp->hData ) - DdeUnaccessData( pImp->hData ); - delete pImp; -} - -// --- DdeData::Lock() --------------------------------------------- - -void DdeData::Lock() -{ - if ( pImp->hData ) - pImp->pData = DdeAccessData( pImp->hData, (LPDWORD) &pImp->nData ); -} - -// --- DdeData::GetFormat() ---------------------------------------- - -ULONG DdeData::GetFormat() const -{ - return pImp->nFmt; -} - -void DdeData::SetFormat( ULONG nFmt ) -{ - pImp->nFmt = nFmt; -} - -// --- DdeData::operator const char*() ----------------------------- - -DdeData::operator const void*() const -{ - return pImp->pData; -} - -// --- DdeData::operator long() ------------------------------------ - -DdeData::operator long() const -{ - return pImp->nData; -} - -// --- DdeData::operator =() --------------------------------------- - -DdeData& DdeData::operator = ( const DdeData& rData ) -{ - if ( &rData != this ) - { - DdeData tmp( rData ); - delete pImp; - pImp = tmp.pImp; - tmp.pImp = NULL; - } - - return *this; -} - -ULONG DdeData::GetExternalFormat( ULONG nFmt ) -{ - switch( nFmt ) - { - case FORMAT_STRING: - nFmt = CF_TEXT; - break; - case FORMAT_BITMAP: - nFmt = CF_BITMAP; - break; - case FORMAT_GDIMETAFILE: - nFmt = CF_METAFILEPICT; - break; - - default: - { -#if defined(WNT) || defined(WIN) || defined( PM2 ) - String aName( SotExchange::GetFormatName( nFmt ) ); - -#if defined(WNT) || defined(WIN) - - if( aName.Len() ) - nFmt = RegisterClipboardFormat( reinterpret_cast(aName.GetBuffer()) ); -#endif -#if defined( PM2 ) - - if( aName.Len() ) - { - HATOMTBL hSysTable = WinQuerySystemAtomTable(); - nFmt = (ULONG)WinAddAtom( hSysTable, (PSZ)aName.GetBuffer() ); - } -#endif -#endif - } - } - return nFmt; -} - -ULONG DdeData::GetInternalFormat( ULONG nFmt ) -{ - switch( nFmt ) - { - case CF_TEXT: - nFmt = FORMAT_STRING; - break; - - case CF_BITMAP: - nFmt = FORMAT_BITMAP; - break; - - case CF_METAFILEPICT: - nFmt = FORMAT_GDIMETAFILE; - break; - - default: -#if defined(WIN) || defined(WNT) - if( nFmt >= CF_MAX ) - { - TCHAR szName[ 256 ]; - - if( GetClipboardFormatName( nFmt, szName, sizeof(szName) ) ) - nFmt = SotExchange::RegisterFormatName( String(reinterpret_cast(szName)) ); - } -#endif -#if defined(PM2) - if( nFmt > CF_PALETTE ) - { - char szName[ 256 ]; - - HATOMTBL hSysTable = WinQuerySystemAtomTable(); - WinQueryAtomName( hSysTable, (ATOM)nFmt, (PSZ)szName, - sizeof( szName ) ); - nFmt = SotExchange::RegisterFormatName( String( szName ) ); - } -#endif - break; - } - return nFmt; -} - diff --git a/svtools/source/svdde/ddedll.cxx b/svtools/source/svdde/ddedll.cxx deleted file mode 100644 index 696d7b2851d2..000000000000 --- a/svtools/source/svdde/ddedll.cxx +++ /dev/null @@ -1,67 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ddedll.cxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifdef WIN - - -#include // included svwin.h - -// Statische DLL-Verwaltungs-Variablen -static HINSTANCE hDLLInst = 0; // HANDLE der DLL - -/*************************************************************************** -|* LibMain() -|* Beschreibung Initialisierungsfunktion der DLL -***************************************************************************/ -extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) -{ -#ifndef WNT - if ( nHeap ) - UnlockData( 0 ); -#endif - - hDLLInst = hDLL; - - return TRUE; -} - -/*************************************************************************** -|* WEP() -|* Beschreibung DLL-Deinitialisierung -***************************************************************************/ -extern "C" int CALLBACK WEP( int ) -{ - return 1; -} - -#endif - diff --git a/svtools/source/svdde/ddeimp.hxx b/svtools/source/svdde/ddeimp.hxx deleted file mode 100644 index dcdf5b3be33c..000000000000 --- a/svtools/source/svdde/ddeimp.hxx +++ /dev/null @@ -1,180 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ddeimp.hxx,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _DDEIMP_HXX -#define _DDEIMP_HXX - -#ifdef OS2 - -#include "ddemlos2.h" - -#define WORD USHORT -#define DWORD ULONG -#define LPBYTE BYTE* -#define LPWORD USHORT* -#define LPDWORD ULONG* -#define LPCTSTR PCSZ - -#else - -#include -#include -#include -#include "ddewrap.hxx" - -/* -extern "C" -{ -#define BOOL WIN_BOOL -#define BYTE WIN_BYTE -#undef BOOL -#undef BYTE -}; -*/ - -#endif -#include -#include -#include - -class DdeService; -class DdeTopic; -class DdeItem; -class DdeTopics; -class DdeItems; - -// ---------------- -// - Conversation - -// ---------------- - -struct Conversation -{ - HCONV hConv; - DdeTopic* pTopic; -}; - -DECLARE_LIST( ConvList, Conversation* ); - -// --------------- -// - DdeInternal - -// --------------- - -class DdeInternal -{ -public: -#ifdef WNT - static HDDEDATA CALLBACK CliCallback - ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); - static HDDEDATA CALLBACK SvrCallback - ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); - static HDDEDATA CALLBACK InfCallback - ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); -#else -#if defined ( MTW ) || ( defined ( GCC ) && defined ( OS2 )) || defined( ICC ) - static HDDEDATA CALLBACK __EXPORT CliCallback - ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); - static HDDEDATA CALLBACK __EXPORT SvrCallback - ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); - static HDDEDATA CALLBACK __EXPORT InfCallback - ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); -#else - static HDDEDATA CALLBACK _export CliCallback - ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); - static HDDEDATA CALLBACK _export SvrCallback - ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); - static HDDEDATA CALLBACK _export InfCallback - ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ); -#endif -#endif - static DdeService* FindService( HSZ ); - static DdeTopic* FindTopic( DdeService&, HSZ ); - static DdeItem* FindItem( DdeTopic&, HSZ ); -}; - -// ------------- -// - DdeString - -// ------------- - -class DdeString : public String -{ -protected: - HSZ hString; - DWORD hInst; - -public: - DdeString( DWORD, const sal_Unicode* ); - DdeString( DWORD, const String& ); - ~DdeString(); - - int operator==( HSZ ); - operator HSZ(); -}; - -// -------------- -// - DdeDataImp - -// -------------- - -struct DdeDataImp -{ - HDDEDATA hData; - LPBYTE pData; - long nData; - ULONG nFmt; -}; - -class DdeConnections; -class DdeServices; - -struct DdeInstData -{ - USHORT nRefCount; - DdeConnections* pConnections; - // Server - long hCurConvSvr; - ULONG hDdeInstSvr; - short nInstanceSvr; - DdeServices* pServicesSvr; - // Client - ULONG hDdeInstCli; - short nInstanceCli; -}; - -#ifndef SHL_SVDDE -#define SHL_SVDDE SHL_SHL2 -#endif - -inline DdeInstData* ImpGetInstData() -{ - return (DdeInstData*)(*GetAppData( SHL_SVDDE )); -} -DdeInstData* ImpInitInstData(); -void ImpDeinitInstData(); - -#endif // _DDEIMP_HXX diff --git a/svtools/source/svdde/ddeinf.cxx b/svtools/source/svdde/ddeinf.cxx deleted file mode 100644 index 7c2fb82789e6..000000000000 --- a/svtools/source/svdde/ddeinf.cxx +++ /dev/null @@ -1,193 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ddeinf.cxx,v $ - * $Revision: 1.8 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#define UNICODE - -#include -#include "ddeimp.hxx" -#include - -// --- DdeInternal::InfCallback() ---------------------------------- - -#ifdef WNT -HDDEDATA CALLBACK DdeInternal::InfCallback( - WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ) -#else -#if defined ( MTW ) || ( defined ( GCC ) && defined ( OS2 )) || defined( ICC ) -HDDEDATA CALLBACK __EXPORT DdeInternal::InfCallback( - WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ) -#else -HDDEDATA CALLBACK _export DdeInternal::InfCallback( - WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD ) -#endif -#endif -{ - return (HDDEDATA)DDE_FNOTPROCESSED; -} - -// --- DdeServiceList::DdeServiceList() ---------------------------- - -DdeServiceList::DdeServiceList( const String* pTopic ) -{ - DWORD hDdeInst = NULL; - HCONVLIST hConvList = NULL; - HCONV hConv = NULL; - UINT nStatus = DMLERR_NO_ERROR; - HSZ hTopic = NULL; - -#ifndef OS2 // YD FIXME - - nStatus = DdeInitialize( &hDdeInst, (PFNCALLBACK) DdeInternal::InfCallback, - APPCLASS_STANDARD | APPCMD_CLIENTONLY | - CBF_FAIL_ALLSVRXACTIONS | - CBF_SKIP_ALLNOTIFICATIONS, 0L ); - - if ( nStatus == DMLERR_NO_ERROR ) - { - if ( pTopic ) - { - LPCTSTR p = reinterpret_cast(pTopic->GetBuffer()); -#ifdef __MINGW32__ - hTopic = DdeCreateStringHandle( hDdeInst, const_cast(p), CP_WINUNICODE ); -#else - hTopic = DdeCreateStringHandle( hDdeInst, p, CP_WINUNICODE ); -#endif - } - - hConvList = DdeConnectList( hDdeInst, NULL, hTopic, NULL, NULL ); - nStatus = DdeGetLastError( hDdeInst ); - } - - if ( nStatus == DMLERR_NO_ERROR ) - { - while ( ( hConv = DdeQueryNextServer( hConvList, hConv ) ) != NULL) - { - CONVINFO aInf; - TCHAR buf[256], *p; - HSZ h; -#ifdef OS2 - aInf.nSize = sizeof( aInf ); -#else - aInf.cb = sizeof( aInf ); -#endif - if( DdeQueryConvInfo( hConv, QID_SYNC, &aInf)) - { - h = aInf.hszServiceReq; - if ( !h ) -#ifndef OS2 - h = aInf.hszSvcPartner; -#else - h = aInf.hszPartner; -#endif - DdeQueryString( hDdeInst, h, buf, sizeof(buf) / sizeof(TCHAR), CP_WINUNICODE ); - p = buf + lstrlen( buf ); - *p++ = '|'; *p = 0; - DdeQueryString( hDdeInst, aInf.hszTopic, p, sizeof(buf)/sizeof(TCHAR)-lstrlen( buf ), - CP_WINUNICODE ); - aServices.Insert( new String( reinterpret_cast(buf) ) ); - } - } - DdeDisconnectList( hConvList ); - } - - if ( hTopic) - DdeFreeStringHandle( hDdeInst, hTopic ); - if ( hDdeInst ) - DdeUninitialize( hDdeInst ); - -#endif - -} - -// --- DdeServiceList::~DdeServiceList() --------------------------- - -DdeServiceList::~DdeServiceList() -{ - String* s; - while ( ( s = aServices.First() ) != NULL ) - { - aServices.Remove( s ); - delete s; - } -} - -// --- DdeTopicList::DdeTopicList() -------------------------------- - -DdeTopicList::DdeTopicList( const String& rService ) -{ - DdeConnection aSys( rService, String( reinterpret_cast(SZDDESYS_TOPIC) ) ); - - if ( !aSys.GetError() ) - { - DdeRequest aReq( aSys, String( reinterpret_cast(SZDDESYS_ITEM_TOPICS) ), 500 ); - aReq.SetDataHdl( LINK( this, DdeTopicList, Data ) ); - aReq.Execute(); - } -} - -// --- DdeTopicList::~DdeTopicList() ------------------------------- - -DdeTopicList::~DdeTopicList() -{ - String* s; - while ( ( s = aTopics.First() ) != NULL ) - { - aTopics.Remove( s ); - delete s; - } -} - -// --- DdeTopicList::Data() -------------------------------------------- - -IMPL_LINK( DdeTopicList, Data, DdeData*, pData ) -{ - char* p = (char*) (const void *) *pData; - char* q = p; - short i; - char buf[256]; - - while ( *p && *p != '\r' && *p != '\n' ) - { - q = buf; i = 0; - while ( i < 255 && *p && *p != '\r' && *p != '\n' && *p != '\t' ) - *q++ = *p++, i++; - *q = 0; - while ( *p && *p != '\r' && *p != '\n' && *p != '\t' ) - p++; - aTopics.Insert( new String( String::CreateFromAscii(buf) ) ); - if ( *p == '\t' ) - p++; - } - return 0; -} - diff --git a/svtools/source/svdde/ddeml1.cxx b/svtools/source/svdde/ddeml1.cxx deleted file mode 100644 index 6cc09b612ecf..000000000000 --- a/svtools/source/svdde/ddeml1.cxx +++ /dev/null @@ -1,2661 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ddeml1.cxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -/* - ToDo / Bugs: - - - DdeInitiate: Eigener Thread? - - Timeout bei Disconnects (IBM:nicht auf Ack warten!) - - Konzept Errorhandling (globale/lokale Fehler) - - Bedeutung/Anwendung Conversation-Contexte - - Bei Zugriffen auf ConversationHandles WindowHandles checken - - Namen der Partner-App ermitteln - - Codepage-Geraffel -*/ -#define INCL_DOSPROCESS - -#include "ddemlimp.hxx" - -#define LOGFILE -#define STATUSFILE -#define DDEDATAFILE -#include "ddemldeb.hxx" - - -#if defined (OS2) && defined (__BORLANDC__) -#pragma option -w-par -#endif - -// static -inline BOOL ImpDdeMgr::MyWinDdePostMsg( HWND hWndTo, HWND hWndFrom, - USHORT nMsg, PDDESTRUCT pData, ULONG nFlags ) -{ - BOOL bSuccess = WinDdePostMsg( hWndTo,hWndFrom,nMsg,pData,nFlags); - if( !bSuccess ) - { - WRITELOG("WinDdePostMsg:Failed!") - if ( !(nFlags & DDEPM_NOFREE) ) - { - MyDosFreeMem( pData,"MyWinDdePostMsg" ); - } - } - return bSuccess; -} - - -// ********************************************************************* -// ImpDdeMgr -// ********************************************************************* - -USHORT ImpDdeMgr::nLastErrInstance = 0; - -// -// Conversation-WndProc -// Steuert Transaktionen eines Conversationhandles -// -MRESULT EXPENTRY ConvWndProc(HWND hWnd,ULONG nMsg,MPARAM nPar1,MPARAM nPar2) -{ -#if defined(DBG_UTIL) && defined(OV_DEBUG) - if( nMsg >= WM_DDE_FIRST && nMsg <= WM_DDE_LAST) - { - ////WRITELOG("::ConvWndProc:DDE-Msg received") - } -#endif - ImpConvWndData* pObj = (ImpConvWndData*)WinQueryWindowULong( hWnd, 0 ); - return pObj->pThis->ConvWndProc( hWnd, nMsg, nPar1, nPar2 ); -} - -// -// Server-WndProc -// DDE-Server-Window der App -// -MRESULT EXPENTRY ServerWndProc(HWND hWnd,ULONG nMsg,MPARAM nPar1,MPARAM nPar2) -{ -#if defined(DBG_UTIL) && defined(OV_DEBUG) - if( nMsg >= WM_DDE_FIRST && nMsg <= WM_DDE_LAST) - { - ////WRITELOG("::ServerWndProc:DDE-Msg received") - } -#endif - ImpDdeMgr* pObj = (ImpDdeMgr*)WinQueryWindowULong( hWnd, 0 ); - return pObj->SrvWndProc( hWnd, nMsg, nPar1, nPar2 ); -} - - -inline HDDEDATA ImpDdeMgr::Callback( USHORT nTransactionType, - USHORT nClipboardFormat, HCONV hConversationHandle, HSZ hsz1, - HSZ hsz2, HDDEDATA hData, ULONG nData1, ULONG nData2 ) -{ - HDDEDATA hRet = (HDDEDATA)0; - if( pCallback ) - hRet = (*pCallback)(nTransactionType, nClipboardFormat, - hConversationHandle, hsz1, hsz2, hData, nData1, nData2); - return hRet; -} - - - -ImpDdeMgr::ImpDdeMgr() -{ - nLastErrInstance = DMLERR_NO_ERROR; - pCallback = 0; - nTransactFilter = 0; - nServiceCount = 0; - pServices = 0; - pAppTable = 0; - pConvTable = 0; - pTransTable = 0; - bServFilterOn = TRUE; - bInSyncTrans = FALSE; - - CreateServerWnd(); - pData = InitAll(); - if ( !pData ) - nLastErrInstance = DMLERR_MEMORY_ERROR; - else - RegisterDDEMLApp(); -} - -ImpDdeMgr::~ImpDdeMgr() -{ - CleanUp(); - DestroyServerWnd(); -// Named Shared Mem vom BS loeschen lassen, da nicht bekannt ist, -// wieviele DDEML-Instanzen die App erzeugt hat, und OS/2 -// keinen App-Referenzzaehler fuer shared mem fuehrt. -// if ( pData ) -// DosFreeMem( pData ); -} - - -BOOL ImpDdeMgr::IsSameInstance( HWND hWnd ) -{ - TID tid; PID pid; - WinQueryWindowProcess( hWnd, &pid, &tid ); - return (BOOL)(pid == pidThis); -} - -HSZ ImpDdeMgr::GetAppName( HWND hWnd ) -{ - return 0; -} - -// static -ImpDdeMgr* ImpDdeMgr::GetImpDdeMgrInstance( HWND hWnd ) -{ - ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData(); - if( !pData ) - return 0; - - ImpDdeMgr* pResult = 0; - TID tid; PID pidApp; - WinQueryWindowProcess( hWnd, &pidApp, &tid ); - HWND* pApp = ImpDdeMgr::GetAppTable( pData ); - USHORT nCurApp = 0; - while( nCurApp < pData->nMaxAppCount ) - { - HWND hCurWin = *pApp; - if( hCurWin ) - { - PID pidCurApp; - WinQueryWindowProcess( hCurWin, &pidCurApp, &tid ); - if( pidCurApp == pidApp ) - { - pResult = (ImpDdeMgr*)WinQueryWindowULong( hCurWin, 0 ); - break; - } - } - pApp++; - nCurApp++; - } - return pResult; -} - - - - - -void ImpDdeMgr::CleanUp() -{ - DisconnectAll(); - ImpService* pPtr = pServices; - if( pPtr ) - { - for( USHORT nIdx = 0; nIdx < nServiceCount; nIdx++, pPtr++ ) - { - HSZ hStr = pPtr->hBaseServName; - if( hStr ) - DdeFreeStringHandle( hStr ); - hStr = pPtr->hInstServName; - if( hStr ) - DdeFreeStringHandle( hStr ); - } - nServiceCount = 0; - delete pServices; - pServices = 0; - } - bServFilterOn = TRUE; // default setting DDEML - UnregisterDDEMLApp(); -} - -void ImpDdeMgr::RegisterDDEMLApp() -{ - HWND* pPtr = pAppTable; - HWND hCur; - USHORT nPos = 0; - while( nPos < pData->nMaxAppCount ) - { - hCur = *pPtr; - if (hCur == (HWND)0 ) - { - // in Tabelle stellen - *pPtr = hWndServer; - break; - } - nPos++; - pPtr++; - } -} - -void ImpDdeMgr::UnregisterDDEMLApp() -{ - HWND* pPtr = pAppTable; - USHORT nPos = 0; - while( nPos < pData->nMaxAppCount ) - { - if (*pPtr == hWndServer ) - { - *pPtr = 0; - break; - } - nPos++; - pPtr++; - } -} - -// static -ImpDdeMgrData* ImpDdeMgr::AccessMgrData() -{ - ImpDdeMgrData* pData = 0; - APIRET nRet = DosGetNamedSharedMem((PPVOID)&pData,DDEMLDATA,PAG_READ|PAG_WRITE); - DBG_ASSERT(!nRet,"DDE:AccessMgrData failed"); - return pData; -} - -USHORT ImpDdeMgr::DdeGetLastError() -{ - USHORT nErr; - if ( !pData ) - nErr = DMLERR_DLL_NOT_INITIALIZED; - else if ( nLastErrInstance ) - nErr = nLastErrInstance; - else - nErr = pData->nLastErr; - - nLastErrInstance = 0; - pData->nLastErr = 0; - return nErr; -} - - - -USHORT ImpDdeMgr::DdeInitialize( PFNCALLBACK pCallbackProc, ULONG nTransactionFilter ) -{ - if ( !nLastErrInstance ) - { - if ( !pCallbackProc ) - { - nLastErrInstance = DMLERR_INVALIDPARAMETER; - return nLastErrInstance; - } - pCallback = pCallbackProc; - nTransactFilter = nTransactionFilter; - nTransactFilter |= CBF_FAIL_SELFCONNECTIONS; - } - return nLastErrInstance; -} - - -// static -HWND ImpDdeMgr::NextFrameWin( HENUM hEnum ) -{ - char aBuf[ 10 ]; - - HWND hWnd = WinGetNextWindow( hEnum ); - while( hWnd ) - { - WinQueryClassName( hWnd, sizeof(aBuf)-1, (PCH)aBuf ); - // Frame-Window ? - if( !strcmp( aBuf, "#1" ) ) // #define WC_FRAME ((PSZ)0xffff0001L) - break; - hWnd = WinGetNextWindow( hEnum ); - } - return hWnd; -} - - -HCONV ImpDdeMgr::DdeConnectImp( HSZ hszService,HSZ hszTopic,CONVCONTEXT* pCC) -{ - hCurConv = 0; - if( !pCC ) - pCC = &aDefaultContext; - - ULONG nBufLen; - PSZ pService = AllocAtomName( (ATOM)hszService, nBufLen ); - PSZ pTopic = AllocAtomName( (ATOM)hszTopic, nBufLen ); -#if 0 && defined(OV_DEBUG) - String aStr("DdeConnectImp Service:"); - aStr += pService; - aStr += " Topic:"; - aStr += pTopic; - WRITELOG((char*)(const char*)aStr) -#endif - -#if defined(OV_DEBUG) - if( !strcmp(pService,"oliver voeltz") ) - { - WRITESTATUS("Table of connections"); - MyDosFreeMem( pTopic,"DdeConnectImp" ); - MyDosFreeMem( pService,"DdeConnectImp" ); - return 0; - } -#endif - -#if 0 - // original pm-fkt benutzen - HWND hWndCurClient = CreateConversationWnd(); - WinDdeInitiate( hWndCurClient, pService, pTopic, pCC ); - if( GetConversationWndRefCount(hWndCurClient) == 0) - DestroyConversationWnd( hWndCurClient ); -#else - // eigener Verbindungsaufbau - HENUM hEnum = WinBeginEnumWindows( HWND_DESKTOP ); - HWND hWndCurSrv = NextFrameWin( hEnum ); - HWND hWndCurClient = CreateConversationWnd(); - while( hWndCurSrv && !hCurConv ) - { - if( hWndCurSrv != hWndServer || - ((nTransactFilter & CBF_FAIL_SELFCONNECTIONS)==0 )) - { - // pro DDE-Server ein Conversation-Window erzeugen - if( GetConversationWndRefCount(hWndCurClient) >= 2) - { - DestroyConversationWnd( hWndCurClient ); - hWndCurClient = CreateConversationWnd(); - } - MyInitiateDde(hWndCurSrv,hWndCurClient,hszService,hszTopic,pCC); - if( !bListConnect && hCurConv ) - break; - } - hWndCurSrv = NextFrameWin( hEnum ); - } - - if( GetConversationWndRefCount(hWndCurClient) == 0) - DestroyConversationWnd( hWndCurClient ); - WinEndEnumWindows( hEnum ); -#endif - - if( !hCurConv ) - nLastErrInstance = DMLERR_NO_CONV_ESTABLISHED; - -#if 0 && defined(OV_DEBUG) - String aCStr( "DdeConnectImp:End "); - if( nLastErrInstance != DMLERR_NO_CONV_ESTABLISHED ) - aCStr += "(Success)"; - else - aCStr += "(Failed)"; - WRITELOG((char*)aCStr.GetStr()) -#endif - - MyDosFreeMem( pTopic,"DdeConnectImp" ); - MyDosFreeMem( pService,"DdeConnectImp" ); - return hCurConv; -} - -HCONV ImpDdeMgr::DdeConnect( HSZ hszService, HSZ hszTopic, CONVCONTEXT* pCC) -{ - ////WRITELOG("DdeConnect:Start") - bListConnect = FALSE; - HCONV hResult = DdeConnectImp( hszService, hszTopic, pCC ); - ////WRITELOG("DdeConnect:End") - ////WRITESTATUS("DdeConnect:End") - return hResult; -} - - -HCONVLIST ImpDdeMgr::DdeConnectList( HSZ hszService, HSZ hszTopic, - HCONVLIST hConvList, CONVCONTEXT* pCC ) -{ - nPrevConv = 0; - ////WRITESTATUS("Before DdeConnectList") - if( hConvList ) - { - HCONV hLastConvInList; - - hCurListId = hConvList; - ImpHCONV* pConv = pConvTable; - pConv += (USHORT)hConvList; - if( (USHORT)hConvList >= pData->nMaxConvCount ||pConv->hWndThis==0 ) - { - nLastErrInstance = DMLERR_INVALIDPARAMETER; - return 0; - } - GetLastServer(pData, hConvList, hLastConvInList); - nPrevConv = (USHORT)hLastConvInList; - } - else - hCurListId = (HCONVLIST)WinCreateWindow( HWND_OBJECT, WC_FRAME, - CONVLISTNAME, 0,0,0,0,0, HWND_DESKTOP, HWND_BOTTOM, 0,0,0); - - bListConnect = TRUE; - DdeConnectImp( hszService, hszTopic, pCC ); -#if 0 && defined(OV_DEBUG) - WRITELOG("DdeConnectList:ConnectionList:") - HCONV hDebug = 0; - do - { - hDebug = DdeQueryNextServer( hCurListId, hDebug); - String aStr( (ULONG)hDebug ); - WRITELOG((char*)(const char*)aStr) - } while( hDebug ); -#endif - ////WRITESTATUS("After DdeConnectList") - return (HCONVLIST)hCurListId; -} - -DDEINIT* ImpDdeMgr::CreateDDEInitData( HWND hWndDestination, HSZ hszService, - HSZ hszTopic, CONVCONTEXT* pCC ) -{ - ULONG nLen1 = 0, nLen2 = 0; - HATOMTBL hAtomTable = WinQuerySystemAtomTable(); - - if( hszService ) - nLen1 = WinQueryAtomLength( hAtomTable, hszService ); - if( hszTopic ) - nLen2 = WinQueryAtomLength( hAtomTable, hszTopic ); - nLen1++; nLen2++; - - DDEINIT* pBuf = 0; - - ULONG nLen = sizeof(DDEINIT) + nLen1+ nLen2 + sizeof(CONVCONTEXT); - if( !(MyDosAllocSharedMem((PPVOID)&pBuf, NULL, nLen, - PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GIVEABLE | OBJ_ANY, - "CreateDDEInitData"))) - { - memset( pBuf, 0, nLen ); - - /* - PID pid; TID tid; - WinQueryWindowProcess( hWndDestination, &pid, &tid ); - APIRET nRet = DosGiveSharedMem( pBuf, pid, PAG_READ | PAG_WRITE ); - */ - - pBuf->cb = nLen; - pBuf->offConvContext = sizeof( DDEINIT ); - char* pBase = (char*)pBuf; - pBase += sizeof(DDEINIT); - if( pCC ) - memcpy( pBase, pCC, sizeof(CONVCONTEXT) ); - pBase += sizeof(CONVCONTEXT); - pBuf->pszAppName = pBase; - if( hszService ) - WinQueryAtomName( hAtomTable, hszService, pBase, nLen1 ); - pBase += nLen1; - pBuf->pszTopic = pBase; - if( hszTopic ) - WinQueryAtomName( hAtomTable, hszTopic, pBase, nLen2 ); - } - return pBuf; -} - - - -void ImpDdeMgr::MyInitiateDde( HWND hWndSrv, HWND hWndClient, - HSZ hszService, HSZ hszTopic, CONVCONTEXT* pCC ) -{ - DDEINIT* pBuf = CreateDDEInitData( hWndSrv, hszService, hszTopic, pCC ); - if( pBuf ) - { - PID pid; TID tid; - WinQueryWindowProcess( hWndSrv, &pid, &tid ); - APIRET nRet = DosGiveSharedMem( pBuf, pid, PAG_READ | PAG_WRITE ); - WinSendMsg( hWndSrv,WM_DDE_INITIATE,(MPARAM)hWndClient,(MPARAM)pBuf); - MyDosFreeMem( pBuf,"MyInitiateDde" ); - } -} - -// static -ImpHCONV* ImpDdeMgr::GetFirstServer(ImpDdeMgrData* pData, HCONVLIST hConvList, - HCONV& rhConv ) -{ - ImpHCONV* pPtr = GetConvTable( pData ); - HCONV hConv; - if( !rhConv ) - { - pPtr++; - hConv = 1; - } - else - { - // Startposition - pPtr += (USHORT)rhConv; - hConv = rhConv; - pPtr++; hConv++; // auf den naechsten - } - while( hConv < pData->nMaxConvCount ) - { - if( pPtr->hConvList == hConvList ) - { - rhConv = hConv; - return pPtr; - } - pPtr++; - hConv++; - } - rhConv = 0; - return 0; -} - -// static -ImpHCONV* ImpDdeMgr::GetLastServer(ImpDdeMgrData* pData, HCONVLIST hConvList, - HCONV& rhConv ) -{ - ImpHCONV* pPtr = GetConvTable( pData ); - pPtr += pData->nMaxConvCount; - pPtr--; - HCONV hConv = pData->nMaxConvCount; - hConv--; - while( hConv > 0 ) - { - if( pPtr->hConvList == hConvList ) - { - rhConv = hConv; - return pPtr; - } - pPtr--; - hConv--; - } - rhConv = 0; - return 0; -} - -// static -BOOL ImpDdeMgr::CheckConvListId( HCONVLIST hConvListId ) -{ - HAB hAB = WinQueryAnchorBlock( (HWND)hConvListId ); - if( hAB ) - return WinIsWindow( hAB, (HWND)hConvListId ); - return FALSE; - /* - HAB hAB = WinQueryAnchorBlock( (HWND)hConvListId ); - if( hAB ) - { - char aBuf[ 16 ]; - WinQueryWindowText( (HWND)hConvListId, sizeof(aBuf), aBuf ); - if( strcmp(aBuf, CONVLISTNAME ) == 0 ) - return TRUE; - } - return FALSE; - */ -} - -// static -HCONV ImpDdeMgr::DdeQueryNextServer(HCONVLIST hConvList, HCONV hConvPrev) -{ - if( !CheckConvListId( hConvList ) ) - return (HCONV)0; - ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData(); - GetFirstServer( pData, hConvList, hConvPrev ); - return hConvPrev; -} - -// static - -// Idee: DisconnectAll uebergibt das ServerWindow. Zu jedem HCONV -// wird das Creator-Server-Wnd gespeichert. Disconnect braucht -// dann nur noch die Window-Handles zu vergleichen -BOOL ImpDdeMgr::DdeDisconnect( HCONV hConv ) -{ - WRITELOG("DdeDisconnect:Start") - ////WRITESTATUS("DdeDisconnect:Start") - - ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData(); - if ( !pData ) - { - ImpDdeMgr::nLastErrInstance = DMLERR_DLL_NOT_INITIALIZED; - return FALSE; - } - ImpHCONV* pConv = GetConvTable(pData) + (USHORT)hConv; - - if( (USHORT)hConv >= pData->nMaxConvCount || pConv->hWndThis==0 ) - { - nLastErrInstance = DMLERR_NO_CONV_ESTABLISHED; - return FALSE; - } - - PID pidApp; TID tid; - HWND hWndDummy = WinCreateWindow( HWND_OBJECT, WC_FRAME, - "Bla", 0, 0,0,0,0, HWND_DESKTOP, HWND_BOTTOM, 0, 0, 0 ); - WinQueryWindowProcess( hWndDummy, &pidApp, &tid ); - WinDestroyWindow( hWndDummy ); - PID pidThis; PID pidPartner; - - HWND hWndThis = pConv->hWndThis; - HWND hWndPartner = pConv->hWndPartner; - - WinQueryWindowProcess( hWndThis, &pidThis, &tid ); - WinQueryWindowProcess( hWndPartner, &pidPartner, &tid ); - if( pidApp != pidThis && pidApp != pidPartner ) - return TRUE; // gehoert nicht der App -> ueberspringen - - HCONV hConvPartner = pConv->hConvPartner; - - // die App benachrichtigen, dass alle offenen Advise-Loops - // beendet werden, egal ob sie vom Server oder Client - // initiiert wurden. Die Dinger aber nicht loeschen, da sie evtl. - // noch vom Partner gebraucht werden. - ImpConvWndData* pObj = - (ImpConvWndData*)WinQueryWindowULong( pConv->hWndThis, 0 ); - ImpDdeMgr* pThis = pObj->pThis; - pThis->SendUnadvises( hConv, 0, FALSE ); // alle Formate & NICHT loeschen - pThis->SendUnadvises( hConvPartner, 0, FALSE ); // alle Formate & NICHT loeschen - - pConv->nStatus |= ST_TERMINATED; - - HAB hAB = WinQueryAnchorBlock( pConv->hWndThis ); - // um die MessageQueue inne Gaenge zu halten - ULONG nTimerId = WinStartTimer( hAB, 0, 0, 50 ); - - /* - Die Partner-App muss ein DDE_TERMINATE posten, auf das - wir warten muessen, um alle Messages zu bearbeiten, die - _vor_ dem DdeDisconnect von der Partner-App gepostet - wurden. - */ - WRITELOG("DdeDisconnect:Waiting for acknowledge...") - WinDdePostMsg( hWndPartner, hWndThis, WM_DDE_TERMINATE, - (PDDESTRUCT)0,DDEPM_RETRY); - - QMSG aQueueMsg; - BOOL bContinue = TRUE; - while( bContinue ) - { - if( WinGetMsg( hAB, &aQueueMsg, 0, 0, 0 )) - { - WinDispatchMsg( hAB, &aQueueMsg ); - if( (!WinIsWindow( hAB, hWndPartner)) || - (pConv->nStatus & ST_TERMACKREC) ) - { - bContinue = FALSE; - if( pConv->nStatus & ST_TERMACKREC ) - { - WRITELOG("DdeDisconnect: TermAck received") - } - else - { - WRITELOG("DdeDisconnect: Partner died") - } - } - } - else - bContinue = FALSE; - } - - WinStopTimer( hAB, 0, nTimerId ); - - // WRITELOG("DdeDisconnect:Freeing data") - // Transaktionstabelle aufraeumen - FreeTransactions( pData, hConv ); - if( hConvPartner ) - FreeTransactions( pData, hConvPartner ); - - FreeConvHandle( pData, hConv ); - - WRITELOG("DdeDisconnect:End") - //WRITESTATUS("DdeDisconnect:End") - return TRUE; -} - -// static -BOOL ImpDdeMgr::DdeDisconnectList( HCONVLIST hConvList ) -{ - if( !CheckConvListId( hConvList ) ) - { - ImpDdeMgr::nLastErrInstance = DMLERR_INVALIDPARAMETER; - return FALSE; - } - - ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData(); - if ( !pData ) - { - ImpDdeMgr::nLastErrInstance = DMLERR_DLL_NOT_INITIALIZED; - return FALSE; - } - HCONV hConv = 0; - GetFirstServer( pData, hConvList, hConv ); - while( hConv ) - { - DdeDisconnect( hConv ); - GetFirstServer( pData, hConvList, hConv ); - } - WinDestroyWindow( (HWND)hConvList ); - return TRUE; -} - - - -// static -HCONV ImpDdeMgr::DdeReconnect(HCONV hConv) -{ - ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData(); - if ( !pData ) - { - ImpDdeMgr::nLastErrInstance = DMLERR_DLL_NOT_INITIALIZED; - return 0; - } - return 0; -} - -// static -USHORT ImpDdeMgr::DdeQueryConvInfo(HCONV hConv, ULONG nTransId, CONVINFO* pCI) -{ - if( !pCI || pCI->nSize == 0) - return 0; - ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData(); - if ( !pData ) - { - ImpDdeMgr::nLastErrInstance = DMLERR_DLL_NOT_INITIALIZED; - return 0; - } - Transaction* pTrans; - if( nTransId != QID_SYNC ) - { - pTrans = ImpDdeMgr::GetTransTable( pData ); - pTrans += nTransId; - if( nTransId >= pData->nMaxTransCount || pTrans->hConvOwner == 0 ) - { - ImpDdeMgr::nLastErrInstance = DMLERR_UNFOUND_QUEUE_ID; - return 0; - } - } - else - pTrans = 0; - - ImpHCONV* pConv = ImpDdeMgr::GetConvTable( pData ); - pConv += (ULONG)hConv; - if( hConv >= pData->nMaxConvCount || pConv->hWndThis == 0 ) - { - ImpDdeMgr::nLastErrInstance = DMLERR_NO_CONV_ESTABLISHED; - return 0; - } - - USHORT nSize = pCI->nSize; - if( nSize > sizeof(CONVINFO) ) - nSize = sizeof(CONVINFO); - CONVINFO aTempInfo; - memset( &aTempInfo, 0, sizeof(CONVINFO) ); - aTempInfo.nSize = pCI->nSize; - aTempInfo.hConvPartner = pConv->hConvPartner; - aTempInfo.hszPartner = pConv->hszPartner; - aTempInfo.hszServiceReq = pConv->hszServiceReq; - aTempInfo.hszTopic = pConv->hszTopic; - aTempInfo.nStatus = pConv->nStatus; - aTempInfo.hConvList = pConv->hConvList; - aTempInfo.aConvCtxt = pConv->aConvContext; - if( pTrans ) - { - aTempInfo.nUser = pTrans->nUser; - aTempInfo.hszItem = pTrans->hszItem; - aTempInfo.nFormat = pTrans->nFormat; - aTempInfo.nType = pTrans->nType; - aTempInfo.nConvst = pTrans->nConvst; - aTempInfo.nLastError= pTrans->nLastError; - } - memcpy( pCI, &aTempInfo, nSize ); - - return nSize; -} - -// static -BOOL ImpDdeMgr::DdeSetUserHandle(HCONV hConv, ULONG nTransId, ULONG hUser) -{ - ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData(); - if ( !pData ) - { - ImpDdeMgr::nLastErrInstance = DMLERR_DLL_NOT_INITIALIZED; - return FALSE; - } - Transaction* pTrans = GetTransTable( pData ); - pTrans += nTransId; - if( !nTransId || !hConv || nTransId >= pData->nMaxTransCount || - pTrans->hConvOwner != hConv ) - { - ImpDdeMgr::nLastErrInstance = DMLERR_INVALIDPARAMETER; - return FALSE; - } - if( !pTrans->hConvOwner) - { - ImpDdeMgr::nLastErrInstance = DMLERR_UNFOUND_QUEUE_ID; - return FALSE; - } - pTrans->nUser = hUser; - return TRUE; -} - -BOOL ImpDdeMgr::DdeAbandonTransaction( HCONV hConv, ULONG nTransId ) -{ - ////WRITELOG("DdeAbandonTransaction:Start") - if( !pData ) - { - nLastErrInstance = DMLERR_DLL_NOT_INITIALIZED; - return FALSE; - } - ImpHCONV* pConv = pConvTable; - pConv += (USHORT)hConv; - if( nTransId < 1 || nTransId >= pData->nMaxTransCount || - hConv < 1 || hConv >= pData->nMaxConvCount || !pConv->hWndThis) - { - nLastErrInstance = DMLERR_INVALIDPARAMETER; - return FALSE; - } - if( !hConv ) - { - DBG_ASSERT(0,"DdeAbandonTransaction:NULL-hConv not supported"); - nLastErrInstance = DMLERR_INVALIDPARAMETER; - return FALSE; - } - Transaction* pTrans = pTransTable; - pTrans += (USHORT)nTransId; - if( pTrans->hConvOwner != hConv ) - { - nLastErrInstance = DMLERR_UNFOUND_QUEUE_ID; - return FALSE; - } - - if( bInSyncTrans && nTransId == nSyncTransId ) - { - bSyncAbandonTrans = TRUE; - return TRUE; - } - USHORT nTempType = pTrans->nType; - nTempType &= (~XTYPF_MASK); - if( nTempType == (XTYP_ADVREQ & ~(XTYPF_NOBLOCK))) - { - ////WRITELOG("DdeAbandTrans:Advise Loop") - -// ---------------------------------------------------------------------- -// Der von der Deutschen Bank eingesetzte DDE-Server -// "Invision V2.71 Build 36 Mar 12 1999 V4.8.2" hat einen Bug, der -// dazu fuehrt, dass auf per WM_DDE_TERMINATE geschlossene Verbindungen -// nicht mit einem WM_DDE_TERMINATE geantwortet wird, wenn der -// entsprechende Link vorher per WM_DDE_UNADVISE beendet wurde. Dieser -// Bug tritt ab zwei parallel laufenden Links auf. Auf Wunsch der DB -// wurde das folgende Workaround eingebaut. -// ---------------------------------------------------------------------- -#define DEUTSCHE_BANK -#ifndef DEUTSCHE_BANK - -// Acknowledge ist beim Unadvise nicht ueblich -//#define SO_DDE_ABANDON_TRANSACTION_WAIT_ACK -#ifdef SO_DDE_ABANDON_TRANSACTION_WAIT_ACK - DDESTRUCT* pOutDDEData = MakeDDEObject( pConv->hWndPartner, - pTrans->hszItem, DDE_FACKREQ, 0 /*pTrans->nFormat*/, 0, 0); -#else - DDESTRUCT* pOutDDEData = MakeDDEObject( pConv->hWndPartner, - pTrans->hszItem, 0, 0 /*pTrans->nFormat*/, 0, 0); -#endif - WRITELOG("DdeAbandTrans:Waiting for acknowledge...") - pTrans->nConvst = XST_UNADVSENT; - if ( !MyWinDdePostMsg( pConv->hWndPartner, pConv->hWndThis, - WM_DDE_UNADVISE, pOutDDEData, DDEPM_RETRY ) ) - { - WRITELOG("DdeAbandTrans:PostMsg Failed") - return FALSE; - } -#ifdef SO_DDE_ABANDON_TRANSACTION_WAIT_ACK - WaitTransState( pTrans, nTransId, XST_UNADVACKRCVD, 0 ); -#else - pTrans->nConvst = XST_UNADVACKRCVD; -#endif - -#endif // DEUTSCHE_BANK - - WRITELOG("DdeAbandTrans:Ack received->Freeing transaction") - FreeTransaction( pData, nTransId ); - } - WRITELOG("DdeAbandonTransaction:End") - return TRUE; -} - -// wird von einem Server aufgerufen, wenn sich die Daten des -// Topic/Item-Paars geaendert haben. Diese Funktion fordert -// dann den Server auf, die Daten zu rendern (bei Hotlinks) und -// benachrichtigt die Clients -BOOL ImpDdeMgr::DdePostAdvise( HSZ hszTopic, HSZ hszItem) -{ - ////WRITELOG("DdePostAdvise:Start") - ////WRITESTATUS("DdePostAdvise:Start") - -#if 0 && defined( OV_DEBUG ) - String aDebStr("DdePostAdvise:Item "); - aDebStr += (ULONG)hszItem; - WRITELOG((char*)(const char*)aDebStr) -#endif - - Transaction* pTrans = pTransTable; - pTrans++; - USHORT nCurTrans = 1; - USHORT nUsedTransactions = pData->nCurTransCount; - while( nUsedTransactions && nCurTrans < pData->nMaxTransCount ) - { - HCONV hOwner = pTrans->hConvOwner; - if( hOwner ) - { - nUsedTransactions--; - USHORT nTempType = pTrans->nType; - nTempType &= (~XTYPF_MASK); - if( nTempType == (XTYP_ADVREQ & (~XTYPF_NOBLOCK) ) ) - { - ImpHCONV* pConv = pConvTable; - pConv += (USHORT)hOwner; - if(hszItem == pTrans->hszItem && pConv->hszTopic == hszTopic) - { - if( pConv->hConvPartner ) - { - // Transaktionen werden immer vom Client erzeugt - // -> auf Server-HCONV umschalten - hOwner = pConv->hConvPartner; - pConv = pConvTable; - pConv += (USHORT)hOwner; - } - HWND hWndClient = pConv->hWndPartner; - HWND hWndServer = pConv->hWndThis; -#if 0 && defined( OV_DEBUG ) - String aDebStr("DdePostAdvise: Server:"); - aDebStr += (ULONG)hWndServer; - aDebStr += " Client:"; - aDebStr += (ULONG)hWndClient; - WRITELOG((char*)(const char*)aDebStr) -#endif - DDESTRUCT* pOutDDEData; - if ( pTrans->nType & XTYPF_NODATA ) - { - // Warm link - ////WRITELOG("DdePostAdvise:Warm link found") - pOutDDEData = MakeDDEObject( hWndClient, hszItem, - DDE_FNODATA, pTrans->nFormat, 0, 0 ); - } - else - { - // Hot link - ////WRITELOG("DdePostAdvise:Hot link found") - pOutDDEData = Callback( XTYP_ADVREQ, - pTrans->nFormat, hOwner, hszTopic, - hszItem, (HDDEDATA)0, 1, 0 ); - } - if( pOutDDEData ) - { - // todo: FACK_REQ in Out-Data setzen, wenn pTrans->nType & XTYPF_ACKREQ - ////WRITELOG("DdePostAdvise:Sending data/notification") - BOOL bSuccess = MyWinDdePostMsg( hWndClient, - hWndServer,WM_DDE_DATA, pOutDDEData, DDEPM_RETRY); - if( bSuccess ) - { - // auf Acknowledge des Partners warten ? - if( pTrans->nType & XTYPF_ACKREQ ) - { - pTrans->nConvst = XST_ADVDATASENT; - // Impl. ist falsch! => korrekt: XST_ADVDATAACKRCVD - WaitTransState(pTrans, nCurTrans, - XST_UNADVACKRCVD, 0); - } - } - else - { - ////WRITELOG("DdePostAdvise:PostMsg failed") - nLastErrInstance = DMLERR_POSTMSG_FAILED; - } - } - else - { - ////WRITELOG("DdePostAdvise:No data to send") - } - } - } - } - nCurTrans++; - pTrans++; - } - ////WRITELOG("DdePostAdvise:End") - return TRUE; -} - -BOOL ImpDdeMgr::DdeEnableCallback( HCONV hConv, USHORT wCmd) -{ - return FALSE; -} - -// Rueckgabe: 0==Service nicht registriert; sonst Pointer auf Service-Eintrag -ImpService* ImpDdeMgr::GetService( HSZ hszService ) -{ - ImpService* pPtr = pServices; - if( !pPtr || !hszService ) - return 0; - for( ULONG nIdx = 0; nIdx < nServiceCount; nIdx++, pPtr++ ) - { - if(( hszService == pPtr->hBaseServName ) || - ( hszService == pPtr->hInstServName ) ) - return pPtr; - } - return 0; -} - - -// legt Service in Service-Tabelle ab. Tabelle wird ggf. expandiert -ImpService* ImpDdeMgr::PutService( HSZ hszService ) -{ - if( !pServices ) - { - DBG_ASSERT(nServiceCount==0,"DDE:Bad ServiceCount"); - pServices = new ImpService[ DDEMLSERVICETABLE_INISIZE ]; - memset( pServices, 0, DDEMLSERVICETABLE_INISIZE* sizeof(ImpService)); - nServiceCount = DDEMLSERVICETABLE_INISIZE; - } - ImpService* pPtr = pServices; - USHORT nCurPos = 0; - while( pPtr ) - { - if( pPtr->hBaseServName == 0 ) - break; - nCurPos++; - if( nCurPos < nServiceCount ) - pPtr++; - else - pPtr = 0; - } - if( !pPtr ) - { - // Tabelle vergroessern - pPtr = new ImpService[ nServiceCount + DDEMLSERVICETABLE_INISIZE ]; - memset( pPtr, 0, DDEMLSERVICETABLE_INISIZE* sizeof(ImpService)); - memcpy( pPtr, pServices, nServiceCount * sizeof(ImpService) ); -#ifdef DBG_UTIL - memset( pServices, 0, nServiceCount * sizeof(ImpService) ); -#endif - delete pServices; - pServices = pPtr; - pPtr += nServiceCount; // zeigt auf erste neue Position - nServiceCount += DDEMLSERVICETABLE_INISIZE; - } - DBG_ASSERT(pPtr->hBaseServName==0,"DDE:Service not empty"); - DBG_ASSERT(pPtr->hInstServName==0,"DDE:Service not empty"); - - DdeKeepStringHandle( hszService ); - - USHORT nStrLen = (USHORT)DdeQueryString( hszService, 0, 0, 0); - char* pBuf = new char[ nStrLen + 1 ]; - DdeQueryString(hszService, pBuf, nStrLen, 850 /* CodePage*/ ); - pBuf[ nStrLen ] = 0; - String aStr( (ULONG)hWndServer ); - aStr += pBuf; - HSZ hszInstServ = DdeCreateStringHandle( (PSZ)(const char*)pBuf, 850 ); - delete pBuf; - - pPtr->hBaseServName = hszService; - pPtr->hInstServName = hszInstServ; - return pPtr; -} - -void ImpDdeMgr::BroadcastService( ImpService* pService, BOOL bRegistered ) -{ - DBG_ASSERT(pService,"DDE:No Service"); - if( !pService ) - return; - MPARAM aMp1 = (MPARAM)(pService->hBaseServName); - MPARAM aMp2 = (MPARAM)(pService->hInstServName); - ULONG nMsg; - if( bRegistered ) - nMsg = WM_DDEML_REGISTER; - else - nMsg = WM_DDEML_UNREGISTER; - - HWND* pPtr = pAppTable; - for( USHORT nPos = 0; nPos < pData->nMaxAppCount; nPos++, pPtr++ ) - { - HWND hWndCurWin = *pPtr; - if ( hWndCurWin && hWndCurWin != hWndServer ) - WinSendMsg( hWndCurWin, nMsg, aMp1, aMp2 ); - } -} - -HDDEDATA ImpDdeMgr::DdeNameService( HSZ hszService, USHORT afCmd ) -{ - HDDEDATA hRet = (HDDEDATA)1; - - if( afCmd & DNS_FILTERON ) - bServFilterOn = TRUE; - else if( afCmd & DNS_FILTEROFF ) - bServFilterOn = FALSE; - ImpService* pService = GetService( hszService ); - BOOL bRegister = (BOOL)(afCmd & DNS_REGISTER); - if( bRegister ) - { - if( !pService ) - { - pService = PutService( hszService ); - BroadcastService( pService, TRUE ); - } - } - else - { - if( pService ) - { - BroadcastService( pService, FALSE ); - DdeFreeStringHandle( pService->hBaseServName ); - pService->hBaseServName = 0; - DdeFreeStringHandle( pService->hInstServName ); - pService->hInstServName = 0; - } - hRet = (HDDEDATA)0; // Service nicht gefunden - } - return hRet; -} - - -// static -HDDEDATA ImpDdeMgr::DdeClientTransaction(void* pDdeData, ULONG cbData, - HCONV hConv, HSZ hszItem, USHORT nFormat, USHORT nType, - ULONG nTimeout, ULONG* pResult) -{ - //WRITELOG("DdeClientTransaction:Start") - -#if 0 && defined(OV_DEBUG) - if( nType == XTYP_REQUEST ) - { - WRITELOG("Start XTYP_REQUEST"); - WinMessageBox(HWND_DESKTOP,HWND_DESKTOP, - "Start XTYP_REQUEST","DdeClientTransaction", - HWND_DESKTOP,MB_OK); - } -#endif - - if( pResult ) - *pResult = 0; - - ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData(); - if ( !pData ) - { - ImpDdeMgr::nLastErrInstance = DMLERR_DLL_NOT_INITIALIZED; - return (HDDEDATA)0; - } - - BOOL bIsDdeHandle = (BOOL)(pDdeData && cbData==0xffffffff); - BOOL bAppOwnsHandle = (BOOL)( bIsDdeHandle && - (((DDESTRUCT*)pDdeData)->fsStatus & IMP_HDATAAPPOWNED) ); - - BOOL bNoData = (BOOL)(nType & XTYPF_NODATA)!=0; - BOOL bAckReq = (BOOL)(nType & XTYPF_ACKREQ)!=0; - USHORT nTypeFlags = nType & XTYPF_MASK; - nType &= (~XTYPF_MASK); - - BOOL bSync = (BOOL)( nTimeout != TIMEOUT_ASYNC ) != 0; - if( nType == XTYP_ADVSTART ) - bSync = TRUE; - - // Mapping transaction -> OS/2-Message - USHORT nTimeoutErr, nMsg; - switch ( nType ) - { - case XTYP_ADVSTART: - nMsg = WM_DDE_ADVISE; - nTimeoutErr = DMLERR_ADVACKTIMEOUT; -{ - nTimeout = 60000; -#if 0 && defined(OV_DEBUG) - char aBuf[ 128 ]; - ImpDdeMgr::DdeQueryString( hszItem,aBuf,127,850); - String aXXStr("Establishing hotlink "); - aXXStr += aBuf; - WRITELOG((char*)aXXStr.GetStr()); -#endif - -} - break; - - case XTYP_ADVSTOP: - nMsg = WM_DDE_UNADVISE; - nTimeoutErr = DMLERR_UNADVACKTIMEOUT; - break; - - case XTYP_REQUEST: - nMsg = WM_DDE_REQUEST; - nTimeoutErr = DMLERR_DATAACKTIMEOUT; - break; - - case XTYP_POKE: - nMsg = WM_DDE_POKE; - nTimeoutErr = DMLERR_POKEACKTIMEOUT; - break; - - case XTYP_EXECUTE: - nMsg = WM_DDE_EXECUTE; - nTimeoutErr = DMLERR_EXECACKTIMEOUT; - break; - - default: - nMsg = 0; - } - if(!hConv || (USHORT)hConv>= pData->nMaxConvCount || !nType || !nMsg || - (nType != XTYP_EXECUTE && (!hszItem || !nFormat)) ) - { - WRITELOG("DdeClientTransaction:Invalid parameter") - ImpDdeMgr::nLastErrInstance = DMLERR_INVALIDPARAMETER; - if( bIsDdeHandle && !bAppOwnsHandle ) - DdeFreeDataHandle( (HDDEDATA)pDdeData ); - return (HDDEDATA)0; - } - - // ueber den Conversation handle das ImpDdeMgr-Objekt holen - ImpHCONV* pConv = GetConvTable( pData ); - pConv += (USHORT)hConv; - ImpConvWndData* pObj = - (ImpConvWndData*)WinQueryWindowULong( pConv->hWndThis, 0 ); - ImpDdeMgr* pThis = pObj->pThis; - - if( bSync && pThis->bInSyncTrans ) - { - WRITELOG("DdeClientTransaction:Already in sync. transaction") - ImpDdeMgr::nLastErrInstance = DMLERR_REENTRANCY; - if( bIsDdeHandle && !bAppOwnsHandle ) - DdeFreeDataHandle( (HDDEDATA)pDdeData ); - return (HDDEDATA)0; - } - - Transaction* pTrans; - - BOOL bReqOnAdvLoop = FALSE; - ULONG nTransId = GetTransaction( pData, hConv, hszItem, nFormat ); - if( nTransId ) - { - // WRITELOG("DdeClientTransaction:Transaction found") - pTrans = GetTransTable( pData ); - pTrans += (USHORT)nTransId; - USHORT nTransType = pTrans->nType; - nTransType &= (~XTYPF_MASK); - if( (nType != XTYP_REQUEST && nTransType == nType) || - // wird Advise-Loop schon zum requesten missbraucht ? - (nType == XTYP_REQUEST && - nTransType == XTYP_ADVREQ && - pTrans->nConvst == XST_WAITING_REQDATA)) - { - // dieser Kanal ist dicht! - WRITELOG("DdeClientTransaction:Transaction already used") - ImpDdeMgr::nLastErrInstance = DMLERR_REENTRANCY; - if( bIsDdeHandle && !bAppOwnsHandle ) - DdeFreeDataHandle( (HDDEDATA)pDdeData ); - return (HDDEDATA)0; - } - else if( nTransType == XTYP_ADVREQ ) - { - switch( nType ) - { - case XTYP_ADVSTOP: - //WRITELOG("DdeClientTransaction:Stopping advise trans") - pTrans->nType = XTYP_ADVSTOP; - break; - - case XTYP_ADVSTART: - //WRITELOG("DdeClientTransaction:Adj. Advise-Params") - pTrans->nType = XTYP_ADVREQ; - if( bNoData ) - pTrans->nType |= XTYPF_NODATA; - if( bAckReq ) - pTrans->nType |= XTYPF_ACKREQ; - if( pResult ) - *pResult = nTransId; - return (HDDEDATA)TRUE; - - case XTYP_REQUEST: - // WRITELOG("DdeClientTransaction:Using adv trans for req") - // nConvst wird unten auf XST_WAITING_REQDATA gesetzt - bReqOnAdvLoop = TRUE; - break; - - default: - WRITELOG("DdeClientTransaction:Invalid parameter") - ImpDdeMgr::nLastErrInstance = DMLERR_INVALIDPARAMETER; - if( bIsDdeHandle && !bAppOwnsHandle ) - DdeFreeDataHandle( (HDDEDATA)pDdeData ); - return (HDDEDATA)FALSE; - } - } - } - else - { - // WRITELOG("DdeClientTransaction:Creating transaction") - nTransId = CreateTransaction(pData, hConv, hszItem, nFormat, nType); - } - - pTrans = GetTransTable( pData ); - pTrans += (USHORT)nTransId; - pTrans->nConvst = XST_WAITING_ACK; - if( nType == XTYP_REQUEST ) - pTrans->nConvst = XST_WAITING_REQDATA; - - HWND hWndServer = pConv->hWndPartner; - HWND hWndClient = pConv->hWndThis; - - HDDEDATA pOutDDEData; - if( bIsDdeHandle ) - { - if( bAppOwnsHandle ) - { - // wir muessen leider leider duplizieren, da uns OS/2 - // keine Chance laesst, diesen Status im Datenobjekt - // zu versenken. - ////WRITELOG("DdeClientTransaction:Copying handle") - HDDEDATA pNew; - HDDEDATA pData = (HDDEDATA)pDdeData; - if( !(MyDosAllocSharedMem((PPVOID)&pNew, NULL, pData->cbData, - PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GIVEABLE | OBJ_ANY, - "MakeDDEObject"))) - { - memcpy( pNew, pData, pData->cbData ); - pOutDDEData = pNew; - } - else - { - WRITELOG("DdeClientTransaction:No Memory") - ImpDdeMgr::nLastErrInstance = DMLERR_LOW_MEMORY; - return (HDDEDATA)0; - } - } - else - pOutDDEData = (HDDEDATA)pDdeData; - } - else - pOutDDEData=MakeDDEObject(hWndServer,hszItem,0,nFormat,pDdeData,cbData); - - pOutDDEData->fsStatus |= nTypeFlags; - - HDDEDATA pDDEInData = 0; - if( bSync ) - { - if( nType != XTYP_REQUEST ) - pOutDDEData->fsStatus |= DDE_FACKREQ; - - // WRITELOG("DdeClientTransaction:Starting sync. trans.") - pThis->hSyncResponseData = (HDDEDATA)0; - pThis->nSyncResponseMsg = 0; - pThis->bInSyncTrans = TRUE; - pThis->nSyncTransId = nTransId; - pThis->bSyncAbandonTrans = FALSE; - - if ( !MyWinDdePostMsg( hWndServer, hWndClient, nMsg, pOutDDEData, - DDEPM_RETRY) ) - { - WRITELOG("DdeClientTransaction:PostMsg failed") - nLastErrInstance = DMLERR_POSTMSG_FAILED; - if( !bReqOnAdvLoop ) - FreeTransaction( pData, nTransId ); - else - { - DBG_ASSERT(pTrans->nType==XTYP_ADVREQ,"DDE:Error!") - pTrans->nConvst = 0; - } - return FALSE; - } - HAB hAB = WinQueryAnchorBlock( hWndClient ); - ULONG nDummyTimer = WinStartTimer( hAB, 0, 0, 50 ); - ULONG nTimeoutId = TID_USERMAX - nTransId; - WinStartTimer( hAB, hWndClient, nTimeoutId, nTimeout ); - QMSG aQueueMsg; - BOOL bLoop = TRUE; - while( bLoop ) - { - if( pThis->nSyncResponseMsg ) - bLoop = FALSE; - else - { - if( WinGetMsg(hAB,&aQueueMsg,0,0,0 )) - { - WinDispatchMsg( hAB, &aQueueMsg ); - } - else - bLoop = FALSE; - } - } - - WinStopTimer( hAB, hWndClient, nTimeoutId ); - WinStopTimer( hAB, 0, nDummyTimer ); - - // - // Der Speicherblock pOutDDEData muss vom Server geloescht worden sein! - // Ueberlegen: Nochmal loeschen, falls Server buggy ist, ansonsten - // platzt uns bald der Adressraum! - // - if( !pThis->nSyncResponseMsg ) - { - // unsere App wurde beendet - ////WRITELOG("DdeClientTransaction:App terminated") - return 0; - } - pDDEInData = pThis->hSyncResponseData; - nMsg = pThis->nSyncResponseMsg; - pThis->hSyncResponseData= 0; - pThis->nSyncResponseMsg = 0; - pThis->bInSyncTrans = FALSE; - pThis->nSyncTransId = 0; - if( !pDDEInData && nMsg != WM_TIMER ) - { - DBG_ASSERT(0,"Dde:No data!"); - WRITELOG("DdeClientTransaction: No Data!") - return (HDDEDATA)0; - } - switch( nMsg ) - { - case WM_TIMER: - WRITELOG("DdeClientTransaction:Timeout!") - nLastErrInstance = nTimeoutErr; - if( bReqOnAdvLoop ) - // auf normalen Loop-Betrieb zurueckschalten - pTrans->nConvst = XST_WAITING_ADVDATA; - break; - - case WM_DDE_ACK: - { - // WRITELOG("DdeClientTransaction:Ack received") - BOOL bPositive = (BOOL)(pDDEInData->fsStatus & DDE_FACK); - MyDosFreeMem( pDDEInData,"DdeClientTransaction" ); - pDDEInData = (HDDEDATA)bPositive; - if( nType == XTYP_ADVSTART && pDDEInData ) - { - -#if 0 && defined(OV_DEBUG) - char aBuf[ 128 ]; - ImpDdeMgr::DdeQueryString( pTrans->hszItem,aBuf,128,850); - String aXXStr("Hotlink "); -#endif - - if( bPositive ) - { - pTrans->nType = XTYP_ADVREQ; - // Hot/Warmlink, Ack - pTrans->nType |= nTypeFlags; - // XST_WAITING_ACK ==> XST_WAITING_ADVDATA - pTrans->nConvst = XST_WAITING_ADVDATA; - -#if 0 && defined(OV_DEBUG) - aXXStr += "established "; - aXXStr += aBuf; -#endif - - } - -#if 0 && defined(OV_DEBUG) - else - { - aXXStr += "failed "; - aXXStr += aBuf; - } - WRITELOG((char*)aXXStr.GetStr()); -#endif - - } - } - break; - - case WM_DDE_DATA: - // WRITELOG("DdeClientTransaction:Data received") - // WRITEDATA(pDDEInData) - if( bReqOnAdvLoop ) - { - DBG_ASSERT(pTrans->nConvst==XST_WAITING_REQDATA,"DDE:Bad state"); - DBG_ASSERT(pTrans->nType==XTYP_ADVREQ,"DDE:Bad state"); - // auf Loop-Betrieb umschalten - pTrans->nConvst = XST_WAITING_ADVDATA; - } - break; - - default: - WRITELOG("DdeClientTransaction:Unexpected msg") - MyDosFreeMem( pDDEInData,"DdeClientTransaction" ); - pDDEInData = 0; - } - pThis->bSyncAbandonTrans = FALSE; - pThis->bInSyncTrans = FALSE; - if( pThis->bSyncAbandonTrans && bReqOnAdvLoop ) - pThis->DdeAbandonTransaction( hConv, nTransId ); - } - else - { - // WRITELOG("DdeClientTransaction:Starting async. trans.") - pDDEInData = (HDDEDATA)MyWinDdePostMsg( hWndServer, hWndClient, nMsg, - pOutDDEData, DDEPM_RETRY); - if( !pDDEInData ) - { - WRITELOG("DdeClientTransaction:PostMsg failed") - nLastErrInstance = DMLERR_POSTMSG_FAILED; - if( !bReqOnAdvLoop ) - FreeTransaction( pData, nTransId ); - else - { - DBG_ASSERT(pTrans->nType==XTYP_ADVREQ,"DDE:Error!") - pTrans->nConvst = 0; - } - } - else - { - // WRITELOG("DdeClientTransaction:Async trans. success") - if( pResult ) - *pResult = nTransId; - } - } -#if 0 && defined( OV_DEBUG ) - if( nType == XTYP_REQUEST ) - { - WRITELOG("End XTYP_REQUEST"); - WinMessageBox(HWND_DESKTOP,HWND_DESKTOP, - "End XTYP_REQUEST","DdeClientTransaction", - HWND_DESKTOP,MB_OK); - } -#endif - //WRITELOG("DdeClientTransaction:End") - //WRITESTATUS("DdeClientTransaction:End") - return pDDEInData; -} - -MRESULT ImpDdeMgr::DdeRegister( ImpWndProcParams* pParams ) -{ - MRESULT nRet = (MRESULT)0; - if ( !(nTransactFilter & CBF_SKIP_REGISTRATIONS) ) - { - HSZ hSBaseName = (HSZ)pParams->nPar1; - HSZ hIBaseName = (HSZ)pParams->nPar2; - nRet=(MRESULT)Callback(XTYP_REGISTER,0,0,hSBaseName,hIBaseName,0,0,0); - } - return nRet; -} - -MRESULT ImpDdeMgr::DdeUnregister( ImpWndProcParams* pParams ) -{ - MRESULT nRet = (MRESULT)0; - if ( !(nTransactFilter & CBF_SKIP_UNREGISTRATIONS) ) - { - HSZ hSBaseName = (HSZ)pParams->nPar1; - HSZ hIBaseName = (HSZ)pParams->nPar2; - nRet=(MRESULT)Callback(XTYP_UNREGISTER,0,0,hSBaseName,hIBaseName,0,0,0); - } - return nRet; -} - -MRESULT ImpDdeMgr::DdeTimeout( ImpWndProcParams* pParams ) -{ - ////WRITELOG("DdeTimeout:Received") - if( nSyncResponseMsg ) - { - ////WRITELOG("DdeTimeout:Trans already processed->ignoring timeout") - return (MRESULT)1; - } - ULONG nTimerId = (ULONG)pParams->nPar1; - ULONG nTransId = TID_USERMAX - nTimerId; - Transaction* pTrans = pTransTable; - pTrans += (USHORT)nTransId; - if( nTransId < 1 || nTransId >= pData->nMaxTransCount || - pTrans->hConvOwner == 0 ) - { - DBG_ASSERT(0,"DdeTimeout:Invalid TransactionId"); - return (MRESULT)1; - } - if( bInSyncTrans && nTransId == nSyncTransId ) - { - USHORT nTempType = pTrans->nType; - nTempType &= (~XTYPF_MASK); - // advise-loops koennen nur innerhalb synchroner - // requests timeouts bekommen. die transaktion wird - // in diesem fall nicht geloescht. - if( nTempType != (XTYP_ADVREQ & (~XTYPF_NOBLOCK) )) - { - ////WRITELOG("DdeTimeout:Freeing transaction") - FreeTransaction( pData, nTransId ); - } - nSyncResponseMsg = WM_TIMER; -#if 0 && defined( OV_DEBUG ) - String aMsg("DdeTimeout:Transaction="); - aMsg += nTransId; - WRITELOG((char*)(const char*)aMsg) -#endif - } - else - { - ////WRITELOG("DdeTimeout:Async transaction timed out") - pTrans->nConvst = XST_TIMEOUT; - } - return (MRESULT)1; -} - - - -MRESULT ImpDdeMgr::DdeTerminate( ImpWndProcParams* pParams ) -{ - WRITELOG("DdeTerminate:Received") - HWND hWndThis = pParams->hWndReceiver; - HWND hWndPartner = (HWND)(pParams->nPar1); - - HCONV hConv = GetConvHandle( pData, hWndThis, hWndPartner ); -#if 0 && defined( OV_DEBUG ) - String strDebug("DdeTerminate:ConvHandle="); - strDebug += (USHORT)hConv; - WRITELOG((char*)(const char*)strDebug) -#endif - ImpHCONV* pConv = pConvTable + (USHORT)hConv; - if( hConv ) - { - // warten wir auf ein DDE_TERMINATE Acknowledge ? - if( pConv->nStatus & ST_TERMINATED ) - { - ////WRITELOG("DdeTerminate:TERMINATE-Ack received") - pConv->nStatus |= ST_TERMACKREC; - return (MRESULT)0; // DdeDisconnect raeumt jetzt auf - } - - // sind wir Server?, wenn ja: die App benachrichtigen, - // dass die Advise loops gestoppt wurden und die - // Transaktionen loeschen - - // OV 26.07.96: Die das TERMINATE empfangende App muss - // die Transaction-Tabelle abraeumen, egal ob Server oder Client!! - // Es muessen alle Trans geloescht werden, die als Owner den - // Client oder den Server haben! - // if( !(pConv->nStatus & ST_CLIENT ) ) - SendUnadvises( hConv, 0, FALSE ); // alle Formate & nicht loeschen - SendUnadvises( pConv->hConvPartner, 0, FALSE ); - - // wir werden von draussen gekillt - if ( !(nTransactFilter & CBF_SKIP_DISCONNECTS) ) - { - Callback( XTYP_DISCONNECT, 0, hConv, 0, 0, 0, - 0, (ULONG)IsSameInstance(hWndPartner)); - } - - // kann unsere Partner-App DDEML ? - if( !(pConv->hConvPartner) ) - { - // nein, deshalb Transaktionstabelle selbst loeschen - ////WRITELOG("DdeTerminate:Freeing transactions") - FreeTransactions( pData, hConv ); - } - } - else - nLastErrInstance = DMLERR_NO_CONV_ESTABLISHED; - -#if 0 && defined(OV_DEBUG) - if( !WinIsWindow(0,hWndPartner)) - { - WRITELOG("DdeTerminate:hWndPartner not valid") - } - if(!WinIsWindow(0,hWndThis)) - { - WRITELOG("DdeTerminate:hWndThis not valid") - } -#endif - - if( hConv ) - { - // hWndThis nicht loeschen, da wir den Handle noch fuer - // das Acknowledge brauchen - ////WRITELOG("DdeTerminate:Freeing conversation") - FreeConvHandle( pData, hConv, FALSE ); - } - - ////WRITELOG("DdeTerminate:Acknowledging DDE_TERMINATE") - -#ifdef OV_DEBUG - DBG_ASSERT(WinIsWindow( 0, hWndThis ),"hWndThis not valid"); -#endif - - if( !WinDdePostMsg( hWndPartner, hWndThis, WM_DDE_TERMINATE, 0, DDEPM_RETRY )) - { - ////WRITELOG("DdeTerminate:Acknowledging DDE_TERMINATE failed") - } - // jetzt hWndThis loeschen - DestroyConversationWnd( hWndThis ); - - return (MRESULT)0; -} - - -/* - Zuordnung des Conversationhandles: - - Verbindungsaufbau: - Client: DdeInitiate( HWNDClient ) - Server: Post( WM_DDE_INITIATEACK( HWNDServer )) - Client: CreateConvHandle( HWNDClient, HWNDServer ) - - Datenaustausch: - Server: Post(WM_DDE_ACK( HWNDSender )) - Client: GetConvHandle( HWNDClient, HWNDSender ) -*/ - -MRESULT ImpDdeMgr::ConvWndProc( HWND hWnd,ULONG nMsg,MPARAM nPar1,MPARAM nPar2 ) -{ - ImpWndProcParams aParams; - - MRESULT nRet = (MRESULT)0; - aParams.hWndReceiver= hWnd; - aParams.nPar1 = nPar1; - aParams.nPar2 = nPar2; - - switch( nMsg ) - { - -#ifdef DBG_UTIL - case WM_DDE_INITIATE : - DBG_ASSERT(0,"dde:unexpected msg"); - nRet = (MRESULT)TRUE; - break; -#endif - - case WM_DDE_INITIATEACK : nRet = DdeInitiateAck(&aParams); break; - case WM_DDE_ACK : nRet = DdeAck( &aParams ); break; - case WM_DDE_ADVISE : nRet = DdeAdvise( &aParams ); break; - case WM_DDE_DATA : nRet = DdeData( &aParams ); break; - case WM_DDE_EXECUTE : nRet = DdeExecute( &aParams ); break; - case WM_DDE_POKE : nRet = DdePoke( &aParams ); break; - case WM_DDE_REQUEST : nRet = DdeRequest( &aParams ); break; - case WM_DDE_TERMINATE : nRet = DdeTerminate( &aParams ); break; - case WM_DDE_UNADVISE : nRet = DdeUnadvise( &aParams ); break; - case WM_TIMER : nRet = DdeTimeout( &aParams ); break; - } - return nRet; -} - -MRESULT ImpDdeMgr::SrvWndProc( HWND hWnd,ULONG nMsg,MPARAM nPar1,MPARAM nPar2 ) -{ - MRESULT nRet = (MRESULT)0; - - ImpWndProcParams aParams; - aParams.hWndReceiver= hWnd; - aParams.nPar1 = nPar1; - aParams.nPar2 = nPar2; - - switch( nMsg ) - { -#ifdef DBG_UTIL - case WM_DDE_ACK : - case WM_DDE_ADVISE : - case WM_DDE_EXECUTE : - case WM_DDE_POKE : - case WM_DDE_REQUEST : - case WM_DDE_UNADVISE : - case WM_DDE_DATA : - case WM_DDE_INITIATEACK : - DBG_ASSERT(0,"dde:unexpected msg"); - nRet = (MRESULT)TRUE; - break; -#endif - - case WM_DDE_TERMINATE : - break; // DDE_INITIATE wurde im DDE_INITIATEACK terminiert - - // ein Client will was von uns - case WM_DDE_INITIATE : - nRet = DdeInitiate( &aParams ); - break; - - // eine ddeml-faehige App. hat einen Service (typ. AppName) [de]reg. - case WM_DDEML_REGISTER : - nRet = DdeRegister( &aParams ); - break; - - case WM_DDEML_UNREGISTER : - nRet = DdeUnregister( &aParams ); - break; - }; - return nRet; -} - - -MRESULT ImpDdeMgr::DdeAck( ImpWndProcParams* pParams ) -{ - //WRITELOG("DdeAck:Start") - HSZ hszItem; - DDESTRUCT* pInDDEData = (DDESTRUCT*)(pParams->nPar2); - if( pInDDEData ) - { - BOOL bPositive = (BOOL)(pInDDEData->fsStatus & DDE_FACK ) != 0; - BOOL bBusy = bPositive ? FALSE : (BOOL)(pInDDEData->fsStatus & DDE_FBUSY ) != 0; - BOOL bNotProcessed = (BOOL)(pInDDEData->fsStatus & DDE_NOTPROCESSED ) != 0; -#if 0 && defined( OV_DEBUG ) - String aDebStr("DdeAck:Received "); - if( bPositive ) - aDebStr += "(positive)"; - else - aDebStr += "(negative)"; - if( bBusy ) - aDebStr += "(busy)"; - if( bNotProcessed ) - aDebStr += "(not processed)"; - WRITELOG((char*)(const char*)aDebStr) -#endif - // ein DDE_ACK niemals bestaetigen (um endlosschleifen zu vermeiden) - pInDDEData->fsStatus &= (~DDE_FACKREQ); - } - else - { - //WRITELOG("DdeAck:Received (no data!)") - return (MRESULT)0; - } - - HCONV hConv = CheckIncoming(pParams, 0, hszItem); -#ifdef OV_DEBUG - if( !hConv ) - { - WRITELOG("DdeAck:HCONV not found") - } -#endif - ULONG nTransId=GetTransaction(pData,hConv,hszItem,pInDDEData->usFormat); - if( !nTransId ) - { - WRITELOG("DdeAck:Transaction not found") - MyDosFreeMem( pInDDEData,"DdeAck" ); - return (MRESULT)0; - } - - BOOL bThisIsSync = (BOOL)( bInSyncTrans && nTransId == nSyncTransId ); -#if 0 && defined( OV_DEBUG ) - if( bThisIsSync) - WRITELOG("DdeAck: sync transaction") - else - WRITELOG("DdeAck: async transaction") -#endif - // pruefen, ob die Transaktion abgeschlossen ist. - Transaction* pTrans = pTransTable; - pTrans += (USHORT)nTransId; - ImpHCONV* pConv = pConvTable; - pConv += (USHORT)hConv; - - if( pTrans->nConvst == XST_UNADVSENT ) - { - //WRITELOG("DdeAck:Unadvise-Ack received") - pTrans->nConvst = XST_UNADVACKRCVD; - MyDosFreeMem( pInDDEData,"DdeAck" ); - DdeFreeStringHandle( hszItem ); - return (MRESULT)0; - } - if( pTrans->nConvst == XST_ADVDATASENT ) - { - //WRITELOG("DdeAck:AdvData-Ack received") - pTrans->nConvst = XST_ADVDATAACKRCVD; - MyDosFreeMem( pInDDEData,"DdeAck" ); - DdeFreeStringHandle( hszItem ); - return (MRESULT)0; - } - - USHORT nType = pTrans->nType; - nType &= (~XTYPF_MASK); - // beginn einer advise-loop oder request auf advise-loop ? - // wenn ja: transaktion nicht loeschen - BOOL bFinished = (BOOL)(nType != XTYP_ADVSTART && - nType != (XTYP_ADVREQ & (~XTYPF_NOBLOCK)) ); - if( bFinished ) - { - if( !bThisIsSync ) - { - ////WRITELOG("DdeAck:Transaction completed") - Callback( XTYP_XACT_COMPLETE, pInDDEData->usFormat, hConv, - pConv->hszTopic, hszItem, (HDDEDATA)0, nTransId, 0 ); - } - ////WRITELOG("DdeAck:Freeing transaction") - FreeTransaction( pData, nTransId ); - } - - if( bThisIsSync ) - { - hSyncResponseData = pInDDEData; - nSyncResponseMsg = WM_DDE_ACK; - } - else - { - MyDosFreeMem( pInDDEData,"DdeAck" ); - } - - DdeFreeStringHandle( hszItem ); - - return (MRESULT)0; -} - - -USHORT ImpDdeMgr::SendUnadvises(HCONV hConvServer,USHORT nFormat,BOOL bFree) -{ - USHORT nTransFound = 0; - BOOL bCallApp = (BOOL)(!(nTransactFilter & CBF_FAIL_ADVISES)); -#if 0 && defined( OV_DEBUG ) - String aStr("Unadvising transactions for HCONV="); - aStr += (ULONG)hConvServer; - aStr += " CallApp:"; aStr += (USHORT)bCallApp; - WRITELOG((char*)aStr.GetStr()) -#endif - - - // wenn wir weder loeschen noch die App benachrichtigen sollen, - // koennen wir gleich wieder returnen - if( !hConvServer || ( !bFree && !bCallApp ) ) - return 0; - - ImpHCONV* pConvSrv = pConvTable; - pConvSrv += (USHORT)hConvServer; - HSZ hszTopic = pConvSrv->hszTopic; - - Transaction* pTrans = pTransTable; - pTrans++; - USHORT nCurTransId = 1; - USHORT nCurTransactions = pData->nCurTransCount; - while( nCurTransactions && nCurTransId < pData->nMaxTransCount ) - { - if( pTrans->hConvOwner ) - nCurTransactions--; - if( pTrans->hConvOwner == hConvServer && - (pTrans->nType & XTYP_ADVREQ) ) - { - if( !nFormat || (nFormat == pTrans->nFormat) ) - { - nTransFound++; - if( bCallApp ) - { - //WRITELOG("SendUnadvises:Notifying App") - Callback( XTYP_ADVSTOP, pTrans->nFormat, hConvServer, - hszTopic, pTrans->hszItem, 0,0,0 ); - } - if( bFree ) - FreeTransaction( pData, (ULONG)nCurTransId ); - } - } - nCurTransId++; - pTrans++; - } - return nTransFound; -} - - - -HCONV ImpDdeMgr::CheckIncoming( ImpWndProcParams* pParams, ULONG nTransMask, - HSZ& rhszItem ) -{ -// ////WRITELOG("CheckIncoming") - rhszItem = 0; - DDESTRUCT* pInDDEData = (DDESTRUCT*)(pParams->nPar2); - if( !pInDDEData ) - { - // ////WRITELOG("CheckIncoming:PDDESTRUCT==0") - return (HCONV)0; - } - - HWND hWndThis = pParams->hWndReceiver; - HWND hWndClient = (HWND)pParams->nPar1; - - BOOL bReject = (BOOL)(nTransactFilter & nTransMask); - HCONV hConv; - if( !bReject ) - hConv = GetConvHandle( pData, hWndThis, hWndClient ); - if ( bReject || !hConv ) - return (HCONV)0; - - rhszItem = DdeCreateStringHandle( - ((char*)(pInDDEData)+pInDDEData->offszItemName), 850 ); - - // ////WRITELOG("CheckIncoming:OK"); - return hConv; -} - - -MRESULT ImpDdeMgr::DdeAdvise( ImpWndProcParams* pParams ) -{ - ////WRITELOG("DdeAdvise:Received") - HSZ hszItem; - HCONV hConv = CheckIncoming(pParams, CBF_FAIL_ADVISES, hszItem); - DDESTRUCT* pInDDEData = (DDESTRUCT*)(pParams->nPar2); - HWND hWndThis = pParams->hWndReceiver; - HWND hWndClient = (HWND)pParams->nPar1; - if( !hConv ) - { - ////WRITELOG("DdeAdvise:Conversation not found") - pInDDEData->fsStatus &= (~DDE_FACK); - MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY); - DdeFreeStringHandle( hszItem ); - return (MRESULT)0; - } - - Transaction* pTrans = pTransTable; - ImpHCONV* pConv = pConvTable; - pConv += (USHORT)hConv; - - // existiert schon ein Link auf Topic/Item/Format-Vektor ? - - ULONG nTransId=GetTransaction(pData,hConv,hszItem,pInDDEData->usFormat); - if( nTransId ) - { - ////WRITELOG("DdeAdvise:Transaction already exists") - pTrans += (USHORT)nTransId; - // ist es eine AdviseLoop ? - USHORT nTempType = pTrans->nType; - nTempType &= (~XTYPF_MASK); - if( nTempType == XTYP_ADVREQ ) - { - // Flags der laufenden Advise-Loop aktualisieren - ////WRITELOG("DdeAdvise:Adjusting Advise-Params") - pTrans->nType = XTYP_ADVREQ; - if( pInDDEData->fsStatus & DDE_FNODATA ) - pTrans->nType |= XTYPF_NODATA; - if( pInDDEData->fsStatus & DDE_FACKREQ ) - pTrans->nType |= XTYPF_ACKREQ; - pInDDEData->fsStatus |= DDE_FACK; - MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY); - DdeFreeStringHandle( hszItem ); - return (MRESULT)0; - } - else if( nTempType != XTYP_ADVSTART ) - { - ////WRITELOG("DdeAdvise:Not a advise transaction") - pInDDEData->fsStatus &= (~DDE_FACK); - MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY); - DdeFreeStringHandle( hszItem ); - return (MRESULT)0; - } - } - - if( !nTransId ) - { - ////WRITELOG("DdeAdvise:Creating Transaction") - ////WRITESTATUS("DdeAdvise:Creating Transaction") - nTransId = CreateTransaction( pData, hConv, hszItem, - pInDDEData->usFormat, XTYP_ADVREQ ); - ////WRITESTATUS("DdeAdvise:Created Transaction") - } - if( nTransId ) - { - pTrans = pTransTable; - pTrans += (USHORT)nTransId; - if( pInDDEData->fsStatus & DDE_FNODATA ) - pTrans->nType |= XTYPF_NODATA; - if( pInDDEData->fsStatus & DDE_FACKREQ ) - pTrans->nType |= XTYPF_ACKREQ; - } - else - { - ////WRITELOG("DdeAdvise:Cannot create Transaction") - pInDDEData->fsStatus &= (~DDE_FACK); - MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY); - DdeFreeStringHandle( hszItem ); - return (MRESULT)0; - } - - ////WRITELOG("DdeAdvise:Calling Server") - - if ( Callback( XTYP_ADVSTART, pInDDEData->usFormat, - hConv, pConv->hszTopic, hszItem, (HDDEDATA)0, 0, 0 ) ) - { - // - // ServerApp erlaubt AdviseLoop - // - ////WRITELOG("DdeAdvise:Advise loop established") - pInDDEData->fsStatus |= DDE_FACK; - MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY); - } - else - { - ////WRITELOG("DdeAdvise:Advise loop not established") - FreeTransaction( pData, nTransId ); - pInDDEData->fsStatus &= (~DDE_FACK); // DDE_FNOTPROCESSED; - MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY); - } - ////WRITESTATUS("DdeAdvise:End") - ////WRITELOG("DdeAdvise:End") - DdeFreeStringHandle( hszItem ); - return (MRESULT)0; -} - -MRESULT ImpDdeMgr::DdeData( ImpWndProcParams* pParams ) -{ - WRITELOG("DdeData:Received") - HSZ hszItem; - HCONV hConv = CheckIncoming(pParams, 0, hszItem); - HWND hWndThis = pParams->hWndReceiver; - HWND hWndClient = (HWND)pParams->nPar1; - DDESTRUCT* pInDDEData = (DDESTRUCT*)(pParams->nPar2); -#if 0 && defined( OV_DEBUG ) - { - String aStr("DdeData Address:"); - aStr += (ULONG)pInDDEData; - WRITELOG((char*)aStr.GetStr()) - } -#endif - - BOOL bSendAck; - if( pInDDEData && (pInDDEData->fsStatus & DDE_FACKREQ )) - { - WRITELOG("DdeData: Ackn requested") - bSendAck = TRUE; - } - else - { - WRITELOG("DdeData: Ackn not requested") - bSendAck = FALSE; - } - - ULONG nTransId = GetTransaction(pData,hConv,hszItem,pInDDEData->usFormat); - if( !nTransId ) - { - WRITELOG("DdeData:Transaction not found") - WRITEDATA(pInDDEData) - if( bSendAck ) - { - WRITELOG("DdeData: Posting Ackn") - pInDDEData->fsStatus &= (~DDE_FACK); // NOTPROCESSED; - MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY); - } - else - { - MyDosFreeMem( pInDDEData,"DdeData" ); - } - return (MRESULT)0; - } - -#if 0 && defined( OV_DEBUG ) - if( pInDDEData ) - { - WRITEDATA(pInDDEData) - } -#endif - - BOOL bThisIsSync = (BOOL)( bInSyncTrans && nTransId == nSyncTransId ); - - // pruefen, ob die Transaktion abgeschlossen ist. - Transaction* pTrans = pTransTable; - pTrans += (USHORT)nTransId; - - if( pTrans->nConvst == XST_WAITING_ACK ) - { - // dieser Fall kann eintreten, wenn ein Server innerhalb - // einer WM_DDE_ADVISE-Msg. oder bevor beim Client das - // Ack eintrifft, Advise-Daten sendet. - WRITELOG("DdeData:Ignoring unexpected data") - if( bSendAck ) - { - WRITELOG("DdeData: Posting Ackn") - pInDDEData->fsStatus &= (~DDE_FACK); // NOTPROCESSED; - MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY); - } - else - { - MyDosFreeMem( pInDDEData,"DdeData" ); - } - return (MRESULT)0; - } - - ImpHCONV* pConv = pConvTable; - pConv += (USHORT)hConv; - - USHORT nType = pTrans->nType; - nType &= (~XTYPF_MASK); - BOOL bNotAdviseLoop = (BOOL)(nType != (XTYP_ADVREQ & (~XTYPF_NOBLOCK))); - if( !bThisIsSync ) - { - // WRITELOG("DdeData:Is async transaction") - if( bNotAdviseLoop ) - { - // WRITELOG("DdeData:Transaction completed -> calling client") - Callback( XTYP_XACT_COMPLETE, pInDDEData->usFormat, hConv, - pConv->hszTopic, hszItem, pInDDEData, nTransId, 0 ); - // WRITELOG("DdeData:Freeing transaction") - FreeTransaction( pData, nTransId ); - } - else - { - WRITELOG("DdeData:Advise-Loop -> calling client") - HDDEDATA pToSend = pInDDEData; - if( pTrans->nType & XTYPF_NODATA ) - { - pToSend = 0; - // WRITELOG("DdeData:Is warm link") - } - Callback( XTYP_ADVDATA, pInDDEData->usFormat, hConv, - pConv->hszTopic, hszItem, pToSend, nTransId, 0 ); - } - if( bSendAck ) - { - WRITELOG("DdeData: Posting Ackn") - pInDDEData->fsStatus = DDE_FACK; - MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY); - } - else - MyDosFreeMem( pInDDEData,"DdeData" ); - } - else // synchrone Transaktion (Datenhandle nicht freigeben!) - { - // WRITELOG("DdeData:Is sync transaction") - hSyncResponseData = pInDDEData; - nSyncResponseMsg = WM_DDE_DATA; - if( bSendAck ) - { - pInDDEData->fsStatus |= DDE_FACK; - WRITELOG("DdeData: Posting Ackn") - MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData, - DDEPM_RETRY | DDEPM_NOFREE ); - } - } - - DdeFreeStringHandle( hszItem ); - // WRITELOG("DdeData:End") - return (MRESULT)0; -} - -MRESULT ImpDdeMgr::DdeExecute( ImpWndProcParams* pParams ) -{ - ////WRITELOG("DdeExecute:Received") - DDESTRUCT* pInDDEData = (DDESTRUCT*)(pParams->nPar2); - HSZ hszItem; - HCONV hConv = CheckIncoming(pParams, 0, hszItem); - BOOL bSuccess = FALSE; - ImpHCONV* pConv = pConvTable; - pConv += (USHORT)hConv; - if ( hConv && !(nTransactFilter & CBF_FAIL_EXECUTES) && pInDDEData ) - { - if ( Callback( XTYP_EXECUTE, pInDDEData->usFormat, hConv, - pConv->hszTopic, hszItem, pInDDEData, 0, 0 ) - == (DDESTRUCT*)DDE_FACK ) - bSuccess = TRUE; - } - else - { - ////WRITELOG("DdeExecute:Not processed") - } - if( pInDDEData ) - { - if( bSuccess ) - pInDDEData->fsStatus |= DDE_FACK; - else - pInDDEData->fsStatus &= (~DDE_FACK); - MyWinDdePostMsg( pConv->hWndPartner, pConv->hWndThis, WM_DDE_ACK, - pInDDEData, DDEPM_RETRY ); - } - DdeFreeStringHandle( hszItem ); - return (MRESULT)0; -} - -HCONV ImpDdeMgr::ConnectWithClient( HWND hWndClient, - HSZ hszPartner, HSZ hszService, HSZ hszTopic, BOOL bSameInst, - DDEINIT* pDDEData, CONVCONTEXT* pCC ) -{ - ////WRITELOG("ConnectWithClient:Start") - HWND hWndSrv = CreateConversationWnd(); - IncConversationWndRefCount( hWndSrv ); - HCONV hConv = CreateConvHandle( pData, pidThis, hWndSrv, hWndClient, - hszPartner, hszService, hszTopic ); - if(!hConv ) - return 0; - BOOL bFreeDdeData = FALSE; - if( !pDDEData ) - { - bFreeDdeData = TRUE; - pDDEData = CreateDDEInitData( hWndClient,hszService,hszTopic, pCC ); - PID pid; TID tid; - WinQueryWindowProcess( hWndClient, &pid, &tid ); - DosGiveSharedMem( pDDEData, pid, PAG_READ | PAG_WRITE); - } - HAB hAB = WinQueryAnchorBlock( hWndSrv ); - WinGetLastError( hAB ); // fehlercode zuruecksetzen - WinSendMsg(hWndClient,WM_DDE_INITIATEACK,(MPARAM)hWndSrv,(MPARAM)pDDEData); - if( WinGetLastError( hAB ) ) - { - // ////WRITELOG("DdeConnectWithClient:Client died") - if( bFreeDdeData ) - { - MyDosFreeMem( pDDEData,"ConnectWithClient" ); - } - FreeConvHandle( pData, hConv ); - return (HCONV)0; - } - - if( !(nTransactFilter & CBF_SKIP_CONNECT_CONFIRMS) ) - { - Callback( XTYP_CONNECT_CONFIRM, 0, hConv, hszTopic, hszService, - 0, 0, (ULONG)bSameInst ); - } - - if( bFreeDdeData ) - { - MyDosFreeMem( pDDEData,"ConnectWithClient" ); - } - // HCONV der PartnerApp suchen & bei uns eintragen - ImpHCONV* pConv = pConvTable; - pConv += (USHORT)hConv; - pConv->hConvPartner = GetConvHandle( pData, hWndClient, hWndSrv ); -#if 0 && defined(OV_DEBUG) - if( !pConv->hConvPartner ) - { - WRITELOG("DdeConnectWithClient:Partner not found") - } -#endif - pConv->nStatus = ST_CONNECTED; - //WRITESTATUS("Server:Connected with client") - //WRITELOG("ConnectWithClient:End") - return hConv; -} - -MRESULT ImpDdeMgr::DdeInitiate( ImpWndProcParams* pParams ) -{ - ////WRITELOG("DdeInitiate:Received") - HWND hWndClient = (HWND)(pParams->nPar1); -// BOOL bSameInst = IsSameInstance( hWndClient ); - BOOL bSameInst = (BOOL)(hWndClient==hWndServer); - DDEINIT* pDDEData = (DDEINIT*)pParams->nPar2; - - if ( ( nTransactFilter & (CBF_FAIL_CONNECTIONS | APPCMD_CLIENTONLY)) || - (( nTransactFilter & CBF_FAIL_SELFCONNECTIONS) && bSameInst ) - ) - { - MyDosFreeMem( pDDEData,"DdeInitiate" ); - return (MRESULT)FALSE; // narda - } - - HSZ hszService = (HSZ)0; - if( *(pDDEData->pszAppName) != '\0' ) - { - hszService = DdeCreateStringHandle( pDDEData->pszAppName, 850 ); - ////WRITELOG(pDDEData->pszAppName); - } - HSZ hszTopic = (HSZ)0; - if( *(pDDEData->pszTopic) != '\0' ) - { - hszTopic = DdeCreateStringHandle( pDDEData->pszTopic, 850 ); - ////WRITELOG(pDDEData->pszTopic); - } - HSZ hszPartner = GetAppName( hWndClient ); - - // nur weitermachen, wenn Service registriert oder - // Service-Name-Filtering ausgeschaltet. - if( !bServFilterOn || GetService(hszService) ) - { - // XTYP_CONNECT-Transaktionen erfolgen nur mit - // Services & Topics ungleich 0! - if( hszService && hszTopic ) - { - if( IsConvHandleAvailable(pData) && Callback( XTYP_CONNECT, - 0, 0, hszTopic,hszService, 0, 0, (ULONG)bSameInst)) - { - // App erlaubt Verbindung mit Client - ConnectWithClient( hWndClient, hszPartner, - hszService, hszTopic, bSameInst, pDDEData ); - } - } - else - { - // ** Wildcard-Connect ** - ////WRITELOG("DdeInitiate:Wildconnect") - // vom Server eine Liste aller Service/Topic-Paare anfordern - CONVCONTEXT* pCC=(CONVCONTEXT*)(pDDEData+pDDEData->offConvContext); - DDESTRUCT* hList = Callback( XTYP_WILDCONNECT, 0, (HCONV)0, - hszTopic,hszService, (HDDEDATA)0, (ULONG)pCC, (ULONG)bSameInst ); - if( hList ) - { - HSZPAIR* pPairs = (HSZPAIR*)((char*)hList+hList->offabData); - while( pPairs->hszSvc ) - { - ////WRITELOG("DdeInitiate:Wildconnect.Connecting") - ConnectWithClient( hWndClient, hszPartner, - pPairs->hszSvc, pPairs->hszTopic, bSameInst, 0, pCC); - // Stringhandles gehoeren der App! (nicht free-en) - pPairs++; - } - DdeFreeDataHandle( hList ); - } - } - } -#if 0 && defined(OV_DEBUG) - else - { - WRITELOG("DdeInitiate:Service filtered") - } -#endif - DdeFreeStringHandle( hszTopic ); - DdeFreeStringHandle( hszService ); - DdeFreeStringHandle( hszPartner ); - MyDosFreeMem( pDDEData,"DdeInitiate" ); - ////WRITELOG("DdeInitiate:End") - return (MRESULT)TRUE; -} - -MRESULT ImpDdeMgr::DdeInitiateAck( ImpWndProcParams* pParams ) -{ - ////WRITELOG("DdeInitiateAck:Received") - DDEINIT* pDDEData = (DDEINIT*)(pParams->nPar2); - - if( !bListConnect && hCurConv ) - { - ////WRITELOG("DdeInitiateAck:Already connected") - MyDosFreeMem( pDDEData,"DdeInitiateAck" ); - WinPostMsg( hWndServer, WM_DDE_TERMINATE, (MPARAM)hWndServer, 0 ); - return (MRESULT)FALSE; - } - - HWND hWndThis = pParams->hWndReceiver; - // Referenz-Count unseres Client-Windows inkrementieren - IncConversationWndRefCount( hWndThis ); - - HWND hWndSrv = (HWND)(pParams->nPar1); - HSZ hszService = DdeCreateStringHandle( pDDEData->pszAppName, 850 ); - HSZ hszTopic = DdeCreateStringHandle( pDDEData->pszTopic, 850 ); - HSZ hszPartnerApp = GetAppName( hWndSrv ); - - hCurConv = CreateConvHandle( pData, pidThis, hWndThis, hWndSrv, - hszPartnerApp, hszService, hszTopic, 0 ); - - ImpHCONV* pConv = pConvTable; - pConv += (USHORT)hCurConv; - - // HCONV der PartnerApp suchen & bei uns eintragen - pConv->hConvPartner = GetConvHandle( pData, hWndSrv, hWndThis ); - // nicht asserten, da ja non-ddeml-Partner moeglich - // DBG_ASSERT(pConv->hConvPartner,"DDE:Partner not found"); - pConv->nStatus = ST_CONNECTED | ST_CLIENT; - - if( bListConnect ) - { - ////WRITELOG("DdeInitiateAck:ListConnect/Connecting hConvs") - // Status setzen & verketten - pConv->hConvList = hCurListId; - pConv->nPrevHCONV = nPrevConv; - pConv->nStatus |= ST_INLIST; - if( nPrevConv ) - { - pConv = pConvTable; - pConv += nPrevConv; - pConv->nNextHCONV = (USHORT)hCurConv; - } - nPrevConv = (USHORT)hCurConv; - } - - DdeFreeStringHandle( hszService ); - DdeFreeStringHandle( hszTopic ); - DdeFreeStringHandle( hszPartnerApp ); - MyDosFreeMem( pDDEData,"DdeInitiateAck" ); - ////WRITESTATUS("After DdeInitiateAck") - ////WRITELOG("DdeInitiateAck:End") - return (MRESULT)TRUE; -} - -MRESULT ImpDdeMgr::DdePoke( ImpWndProcParams* pParams ) -{ - ////WRITELOG("DdePoke:Received") - HSZ hszItem = 0; - DDESTRUCT* pInDDEData = (DDESTRUCT*)(pParams->nPar2); - HCONV hConv = CheckIncoming( pParams, CBF_FAIL_REQUESTS, hszItem ); - BOOL bSuccess =FALSE; - ImpHCONV* pConv = pConvTable; - pConv += (USHORT)hConv; - if ( hConv && !(nTransactFilter & CBF_FAIL_POKES) && pInDDEData ) - { - if( Callback( XTYP_POKE, pInDDEData->usFormat, hConv, - pConv->hszTopic, hszItem, pInDDEData, 0, 0 ) - == (DDESTRUCT*)DDE_FACK ) - bSuccess = TRUE; - } -#if 0 && defined( OV_DEBUG ) - else - { - WRITELOG("DdePoke:Not processed") - } -#endif - if( pInDDEData ) - { - if( bSuccess ) - pInDDEData->fsStatus |= DDE_FACK; - else - pInDDEData->fsStatus &= (~DDE_FACK); - - MyWinDdePostMsg( pConv->hWndPartner, pConv->hWndThis, WM_DDE_ACK, - pInDDEData, DDEPM_RETRY ); - } - DdeFreeStringHandle( hszItem ); - return (MRESULT)0; -} - -MRESULT ImpDdeMgr::DdeRequest( ImpWndProcParams* pParams ) -{ - ////WRITELOG("DdeRequest:Received") - HSZ hszItem = 0; - DDESTRUCT* pInDDEData = (DDESTRUCT*)(pParams->nPar2); - if( pInDDEData ) - // ist fuer Requests nicht definiert - pInDDEData->fsStatus = 0; - HCONV hConv = CheckIncoming( pParams, CBF_FAIL_REQUESTS, hszItem ); - HWND hWndThis = pParams->hWndReceiver; - HWND hWndClient = (HWND)pParams->nPar1; - if( hConv ) - { - ImpHCONV* pConv = pConvTable; - pConv += (USHORT)hConv; - - DDESTRUCT* pOutDDEData = Callback( XTYP_REQUEST, pInDDEData->usFormat, - hConv, pConv->hszTopic, hszItem, (HDDEDATA)0, 0, 0 ); - - if ( !pOutDDEData ) - { - ////WRITELOG("DdeRequest:Not processed") - pInDDEData->fsStatus &= (~DDE_FACK); - MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY); - } - else - { - ////WRITELOG("DdeRequest:Success") - MyDosFreeMem( pInDDEData,"DdeRequest" ); - pOutDDEData->fsStatus |= DDE_FRESPONSE; - MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_DATA,pOutDDEData,DDEPM_RETRY); - } - } - else - { - pInDDEData->fsStatus &= (~DDE_FACK); - MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY); - } - - DdeFreeStringHandle( hszItem ); - ////WRITELOG("DdeRequest:End") - return (MRESULT)0; -} - - -MRESULT ImpDdeMgr::DdeUnadvise( ImpWndProcParams* pParams ) -{ - ////WRITELOG("DdeUnadvise:Received") - - HSZ hszItem; - HCONV hConv = CheckIncoming( pParams, 0, hszItem ); - DDESTRUCT* pInDDEData = (DDESTRUCT*)(pParams->nPar2); - HWND hWndThis = pParams->hWndReceiver; - HWND hWndClient = (HWND)pParams->nPar1; - USHORT nClosedTransactions = 0; - if( hConv ) - { - USHORT nFormat = pInDDEData->usFormat; - // alle Transaktionen des HCONVs loeschen ? - if( !hszItem ) - { - // App benachrichtigen & Transaktionen loeschen - nClosedTransactions = SendUnadvises( hConv, nFormat, TRUE ); - } - else - { - ULONG nTransId = GetTransaction(pData, hConv, hszItem, nFormat); - if( nTransId ) - { - ////WRITELOG("DdeUnadvise:Transaction found") - Transaction* pTrans = pTransTable; - pTrans += (USHORT)nTransId; - ImpHCONV* pConv = pConvTable; - pConv += (USHORT)hConv; - nClosedTransactions = 1; - if( !(nTransactFilter & CBF_FAIL_ADVISES) ) - Callback( XTYP_ADVSTOP, nFormat, hConv, - pConv->hszTopic, hszItem, 0, 0, 0 ); - if( !pConv->hConvPartner ) - FreeTransaction( pData, nTransId ); - } -#if defined(OV_DEBUG) - else - { - WRITELOG("DdeUnadvise:Transaction not found") - } -#endif - } - } -#if defined(OV_DEBUG) - else - { - WRITELOG("DdeUnadvise:Conversation not found") - } -#endif - - if( !nClosedTransactions ) - pInDDEData->fsStatus &= (~DDE_FACK); - else - pInDDEData->fsStatus |= DDE_FACK; - - MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY); - DdeFreeStringHandle( hszItem ); - return (MRESULT)0; -} - -BOOL ImpDdeMgr::WaitTransState( Transaction* pTrans, ULONG nTransId, - USHORT nNewState, ULONG nTimeout ) -{ - ////WRITELOG("WaitTransState:Start") - ImpHCONV* pConv = pConvTable; - pConv += pTrans->hConvOwner; - HAB hAB = WinQueryAnchorBlock( pConv->hWndThis ); - ULONG nTimerId = WinStartTimer( hAB, 0, 0, 50 ); - QMSG aQueueMsg; - -// while( WinGetMsg( hAB, &aQueueMsg, 0, 0, 0 ) && -// WinIsWindow( hAB, pConv->hWndPartner) && -// pTrans->nConvst != nNewState ) -// { -// WinDispatchMsg( hAB, &aQueueMsg ); -// } - - BOOL bContinue = TRUE; - while( bContinue ) - { - if( WinGetMsg( hAB, &aQueueMsg, 0, 0, 0 )) - { - WinDispatchMsg( hAB, &aQueueMsg ); - if( (!WinIsWindow( hAB, pConv->hWndPartner)) || - (pTrans->nConvst == nNewState) ) - { - bContinue = FALSE; - } - } - else - bContinue = FALSE; - } - - WinStopTimer( hAB, 0, nTimerId ); - ////WRITELOG("WaitTransState:End") - return TRUE; -} - - - - diff --git a/svtools/source/svdde/ddeml2.cxx b/svtools/source/svdde/ddeml2.cxx deleted file mode 100644 index 979897136a46..000000000000 --- a/svtools/source/svdde/ddeml2.cxx +++ /dev/null @@ -1,1014 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ddeml2.cxx,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#define INCL_DOS -#include - -#include "ddemlimp.hxx" -#define LOGFILE -#define STATUSFILE -#define DDEDATAFILE -#include "ddemldeb.hxx" - -#if defined (OS2) && defined (__BORLANDC__) -#pragma option -w-par -#endif - - -// ************************************************************************ -// Hilfsfunktionen Speicherverwaltung -// ************************************************************************ - -// -// AllocAtomName -// - -PSZ ImpDdeMgr::AllocAtomName( ATOM hString, ULONG& rBufLen ) -{ - HATOMTBL hAtomTable = WinQuerySystemAtomTable(); - ULONG nLen = WinQueryAtomLength( hAtomTable, hString ); - nLen++; - PSZ pBuf = 0; - if ( !MyDosAllocMem( (PPVOID)&pBuf, nLen, PAG_READ|PAG_WRITE|PAG_COMMIT | OBJ_ANY,"Atom" ) ) - { - WinQueryAtomName( hAtomTable, hString, pBuf, nLen ); - rBufLen = nLen; - } - return pBuf; -} - - -// -// MakeDDEObject -// - -PDDESTRUCT ImpDdeMgr::MakeDDEObject( HWND hwnd, ATOM hItemName, - USHORT fsStatus, USHORT usFormat, PVOID pabData, ULONG usDataLen ) -{ - PDDESTRUCT pddes = 0; - ULONG usItemLen; - PULONG pulSharedObj; - //WRITELOG("MakeDDEObject: Start") - - PSZ pItemName = 0; - if( hItemName != NULL ) - pItemName = AllocAtomName( hItemName, usItemLen ); - else - usItemLen = 1; - - ULONG nTotalSize = sizeof(DDESTRUCT) + usItemLen + usDataLen; - - if( !(MyDosAllocSharedMem((PPVOID)&pulSharedObj, NULL, - nTotalSize, - PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GETTABLE | OBJ_GIVEABLE | OBJ_ANY, - "MakeDDEObject"))) - { - pddes = (PDDESTRUCT) pulSharedObj; - // siehe "Glenn Puchtel, DDE for OS/2" p.60 - pddes->cbData = (ULONG)usDataLen; - pddes->fsStatus = fsStatus; - pddes->usFormat = usFormat; - pddes->offszItemName = sizeof( DDESTRUCT ); - if( (usDataLen) && (pabData != NULL ) ) - pddes->offabData = sizeof(DDESTRUCT) + usItemLen; - else - pddes->offabData = 0; - - if( pItemName != NULL ) - memcpy(DDES_PSZITEMNAME(pddes), pItemName, usItemLen ); - else - *(DDES_PSZITEMNAME(pddes)) = '\0'; - - if( pabData != NULL ) - memcpy( DDES_PABDATA(pddes), pabData, usDataLen ); - } - - if ( pItemName ) - { - MyDosFreeMem( pItemName,"MakeDDEObject" ); - } - return pddes; -} - -// -// AllocNamedSharedMem -// - -APIRET ImpDdeMgr::AllocNamedSharedMem( PPVOID ppBaseAddress, PSZ pName, - ULONG nElementSize, ULONG nElementCount ) -{ - ULONG nObjSize = (ULONG)(nElementSize * nElementCount ); - nObjSize += sizeof( ULONG ); // fuer ElementCount am Anfang des Blocks - - *ppBaseAddress = 0; - APIRET nRet = MyDosAllocSharedMem( ppBaseAddress, pName, nObjSize, - PAG_READ | PAG_WRITE | PAG_COMMIT | OBJ_ANY, - "AllocNamedSharedMem" ); - if ( !nRet ) - { - memset( *ppBaseAddress, 0, nObjSize ); - ULONG* pULONG = (ULONG*)*ppBaseAddress; - *pULONG = nObjSize; - } - return nRet; -} - -void ImpDdeMgr::CreateServerWnd() -{ - hWndServer = WinCreateWindow( HWND_DESKTOP, WC_FRAME, "DDEServer", 0, - 0,0,0,0, HWND_DESKTOP, HWND_BOTTOM, 0, 0, 0 ); - WinSetWindowULong( hWndServer, 0, (ULONG)this ); - WinSubclassWindow( hWndServer, ::ServerWndProc ); - TID tidDummy; - WinQueryWindowProcess( hWndServer, &pidThis, &tidDummy ); -} - -void ImpDdeMgr::DestroyServerWnd() -{ - WinDestroyWindow( hWndServer ); - hWndServer = NULLHANDLE; -} - -HWND ImpDdeMgr::CreateConversationWnd() -{ - HWND hWnd = WinCreateWindow( HWND_OBJECT, WC_FRAME, "DDEConvWnd", 0, - 0,0,0,0, HWND_DESKTOP, HWND_BOTTOM, 0, 0, 0 ); - if ( hWnd ) - { - ImpConvWndData* pWndData = new ImpConvWndData; - pWndData->pThis = this; - pWndData->nRefCount = 0; - WinSetWindowULong( hWnd, 0, (ULONG)pWndData ); - WinSubclassWindow( hWnd, ::ConvWndProc ); -#if 0 && defined( OV_DEBUG ) - String aStr("ConvWnd created:"); - aStr += (ULONG)hWnd; - WRITELOG((char*)aStr.GetStr()) -#endif - } - else - nLastErrInstance = DMLERR_SYS_ERROR; - - return hWnd; -} - -// static -void ImpDdeMgr::DestroyConversationWnd( HWND hWnd ) -{ - ImpConvWndData* pObj = (ImpConvWndData*)WinQueryWindowULong( hWnd, 0 ); - if( pObj ) - { - pObj->nRefCount--; - if( pObj->nRefCount == 0 - // auch Windows mit Refcount vonm loeschen, da dieser in initial - // auf 0 gesetzt wird - || pObj->nRefCount == (USHORT)-1 ) - { - delete pObj; - WinDestroyWindow( hWnd ); -#if 0 && defined( OV_DEBUG ) - String aStr("ConvWnd destroyed:"); - aStr += (ULONG)hWnd; - WRITELOG((char*)aStr.GetStr()) -#endif - } - else - { -#if 0 && defined( OV_DEBUG ) - String aStr("ConvWnd not destroyed (Refcount="); - aStr += pObj->nRefCount; - aStr += ") "; aStr += (ULONG)hWnd; - WRITELOG((char*)aStr.GetStr()) -#endif - } - } -#if defined( OV_DEBUG ) - else - { - WRITELOG("DestroyCnvWnd:Already destroyed/No win data/Partner died") - } -#endif -} - -// static -USHORT ImpDdeMgr::GetConversationWndRefCount( HWND hWnd ) -{ - ImpConvWndData* pObj = (ImpConvWndData*)WinQueryWindowULong( hWnd, 0 ); - DBG_ASSERT(pObj,"Dde:ConvWnd has no data"); - if( pObj ) - return pObj->nRefCount; - return 0; -} - -// static -USHORT ImpDdeMgr::IncConversationWndRefCount( HWND hWnd ) -{ -#if 0 && defined( OV_DEBUG ) - String aStr("IncConversationWndRefCount "); - aStr += (ULONG)hWnd; - WRITELOG((char*)aStr.GetStr()) -#endif - ImpConvWndData* pObj = (ImpConvWndData*)WinQueryWindowULong( hWnd, 0 ); - DBG_ASSERT(pObj,"Dde:ConvWnd has no data"); - if( pObj ) - { - pObj->nRefCount++; - return pObj->nRefCount; - } - return 0; -} - -ImpDdeMgrData* ImpDdeMgr::InitAll() -{ - ImpDdeMgrData* pBase = 0; - // nur dann neu anlegen, wenn die Tabelle nicht existiert - APIRET nRet=DosGetNamedSharedMem((PPVOID)&pBase,DDEMLDATA,PAG_READ| PAG_WRITE); - if ( nRet ) - { - if ( nRet == 2 ) // ERROR_FILE_NOT_FOUND ) - { - // DDECONVERSATIONCOUNT=4096 - USHORT nConvTransCount = 128; - PSZ pResult; - nRet = DosScanEnv( "SOMAXDDECONN", (const char**)&pResult ); - if( !nRet ) - { - int nTemp = 0; - nTemp = atoi( pResult ); - nTemp++; // der nullte Eintrag wird nicht benutzt - if( nTemp > 128 ) - nConvTransCount = (USHORT)nTemp; - } - ULONG nSize = sizeof(ImpDdeMgrData); - nSize += sizeof(ImpHCONV) * nConvTransCount; - nSize += sizeof(Transaction) * nConvTransCount; - nSize += sizeof(HWND) * DDEMLAPPCOUNT; - - nRet = ImpDdeMgr::AllocNamedSharedMem( (PPVOID)&pBase, - DDEMLDATA, nSize, 1 ); - if ( !nRet ) - { - pBase->nTotalSize = nSize; - ULONG nAppTable = (ULONG)&(pBase->aAppTable); - ULONG nCharBase = (ULONG)pBase; - pBase->nOffsAppTable = nAppTable - nCharBase; - pBase->nOffsConvTable = pBase->nOffsAppTable; - pBase->nOffsConvTable += sizeof(HWND) * DDEMLAPPCOUNT; - pBase->nOffsTransTable = pBase->nOffsConvTable; - pBase->nOffsTransTable += sizeof(ImpHCONV) * nConvTransCount; - - pBase->nMaxAppCount = DDEMLAPPCOUNT; - pBase->nMaxConvCount = nConvTransCount; - pBase->nMaxTransCount = nConvTransCount; - } - } - } - - if( pBase ) - { - pConvTable = ImpDdeMgr::GetConvTable( pBase ); - pTransTable = ImpDdeMgr::GetTransTable( pBase ); - pAppTable = ImpDdeMgr::GetAppTable( pBase ); - } - - memset( &aDefaultContext, 0, sizeof(CONVCONTEXT) ); - aDefaultContext.cb = sizeof(CONVCONTEXT); - aDefaultContext.idCountry = 49; // ?? - aDefaultContext.usCodepage = 850; // ?? - - return pBase; -} - -// static -HCONV ImpDdeMgr::CreateConvHandle( ImpDdeMgrData* pData, - PID pidOwner, - HWND hWndMe, HWND hWndPartner, - HSZ hszPartner, HSZ hszServiceReq, HSZ hszTopic, - HCONV hPrevHCONV ) -{ - DBG_ASSERT(pData,"DDE:Invalid data"); - if( !pData ) - return (HCONV)0; - - ImpHCONV* pPtr = ImpDdeMgr::GetConvTable( pData ); - USHORT nCount = pData->nMaxConvCount; - pPtr++; - nCount--; // ersten Handle (NULLHANDLE) ueberspringen - USHORT nIdx = 1; - DBG_ASSERT(pPtr,"No ConvTable"); - if( !pPtr ) - return (HCONV)0; - - while( nCount && pPtr->hWndThis != (HWND)NULL ) - { - nCount--; - pPtr++; - nIdx++; - } - if( !nCount ) - return (HCONV)0; - - DdeKeepStringHandle( hszPartner ); - DdeKeepStringHandle( hszServiceReq ); - DdeKeepStringHandle( hszTopic ); - pPtr->hszPartner = hszPartner; - pPtr->hszServiceReq = hszServiceReq; - pPtr->hszTopic = hszTopic; - - pPtr->hWndThis = hWndMe; - pPtr->hWndPartner = hWndPartner; - pPtr->pidOwner = pidOwner; - pPtr->hConvPartner = (HCONV)0; - pPtr->nPrevHCONV = (USHORT)hPrevHCONV; - pPtr->nNextHCONV = 0; - pPtr->nStatus = ST_CONNECTED; - - pData->nCurConvCount++; - - return (HCONV)nIdx; -} - -// static -void ImpDdeMgr::FreeConvHandle( ImpDdeMgrData* pBase, HCONV hConv, - BOOL bDestroyHWndThis ) -{ - DBG_ASSERT(pBase,"DDE:No data"); -#if 0 && defined( OV_DEBUG ) - String aStr("FreeConvHandle: Start "); - aStr += (ULONG)hConv; - aStr += " Destroy: "; aStr += (USHORT)bDestroyHWndThis; - WRITELOG((char*)aStr.GetStr()); - WRITESTATUS("FreeConvHandle: Start"); -#endif - if( !pBase ) - { - WRITELOG("FreeConvHandle: FAIL"); - return; - } - DBG_ASSERT(hConv&&hConvnMaxConvCount,"DDE:Invalid Conv-Handle"); - if( hConv && hConv < pBase->nMaxConvCount ) - { - ImpHCONV* pTable = ImpDdeMgr::GetConvTable( pBase ); - ImpHCONV* pPtr = pTable + (USHORT)hConv; - if( pPtr->nStatus & ST_INLIST ) - { - // Verkettung umsetzen - USHORT nPrev = pPtr->nPrevHCONV; - USHORT nNext = pPtr->nNextHCONV; - if( nPrev ) - { - pPtr = pTable + nPrev; - pPtr->nNextHCONV = nNext; - } - if( nNext ) - { - pPtr = pTable + nNext; - pPtr->nPrevHCONV = nPrev; - } - pPtr = pTable + (USHORT)hConv; - } - - DdeFreeStringHandle( pPtr->hszPartner ); - DdeFreeStringHandle( pPtr->hszServiceReq ); - DdeFreeStringHandle( pPtr->hszTopic ); - if( bDestroyHWndThis ) - DestroyConversationWnd( pPtr->hWndThis ); - memset( pPtr, 0, sizeof(ImpHCONV) ); - DBG_ASSERT(pBase->nCurConvCount,"Dde:Invalid Trans. count"); - pBase->nCurConvCount--; - } -#if defined(OV_DEBUG) - else - { - WRITELOG("FreeConvHandle: FAIL"); - } -#endif - //WRITELOG("FreeConvHandle: END"); - //WRITESTATUS("FreeConvHandle: End"); -} - -// static -HCONV ImpDdeMgr::IsConvHandleAvailable( ImpDdeMgrData* pBase ) -{ - DBG_ASSERT(pBase,"DDE:No data"); - if( !pBase ) - return 0; - - ImpHCONV* pPtr = ImpDdeMgr::GetConvTable( pBase ); - USHORT nCurPos = pBase->nMaxConvCount - 1; - pPtr += nCurPos; // von hinten aufrollen - while( nCurPos >= 1 ) - { - if( pPtr->hWndThis == 0 ) - return TRUE; - pPtr--; - nCurPos--; - } - return FALSE; -} - -// static -HCONV ImpDdeMgr::GetConvHandle( ImpDdeMgrData* pBase, HWND hWndThis, - HWND hWndPartner ) -{ - DBG_ASSERT(pBase,"DDE:No data"); - if( !pBase ) - return 0; - ImpHCONV* pPtr = ImpDdeMgr::GetConvTable( pBase ); - USHORT nCurPos = 1; - pPtr++; // ersten Handle ueberspringen - USHORT nCurConvCount = pBase->nCurConvCount; - while( nCurConvCount && nCurPos < pBase->nMaxConvCount ) - { - if( pPtr->hWndThis ) - { - if(pPtr->hWndThis == hWndThis && pPtr->hWndPartner == hWndPartner) - return (HCONV)nCurPos; - nCurConvCount--; - if( !nCurConvCount ) - return (HCONV)0; - } - nCurPos++; - pPtr++; - } - return (HCONV)0; -} - - - -// static -ULONG ImpDdeMgr::CreateTransaction( ImpDdeMgrData* pBase, HCONV hOwner, - HSZ hszItem, USHORT nFormat, USHORT nTransactionType ) -{ - DBG_ASSERT(pBase,"DDE:No Data"); - DBG_ASSERT(hOwner!=0,"DDE:No Owner"); - - if( pBase && hOwner ) - { - Transaction* pPtr = ImpDdeMgr::GetTransTable( pBase ); - DBG_ASSERT(pPtr->hConvOwner==0,"DDE:Data corrupted"); - USHORT nId = 1; - pPtr++; - while( nId < pBase->nMaxTransCount ) - { - if( pPtr->hConvOwner == (HCONV)0 ) - { - pPtr->hConvOwner = hOwner; - DdeKeepStringHandle( hszItem ); - pPtr->hszItem = hszItem; - pPtr->nType = nTransactionType; - pPtr->nConvst = XST_CONNECTED; - pPtr->nFormat = nFormat; - pBase->nCurTransCount++; - return (ULONG)nId; - } - nId++; - pPtr++; - } - } - return 0; -} - -// static -void ImpDdeMgr::FreeTransaction( ImpDdeMgrData* pBase, ULONG nTransId ) -{ - DBG_ASSERT(pBase,"DDE:No Data"); - if( !pBase ) - return; - - DBG_ASSERT(nTransIdnMaxTransCount,"DDE:Invalid TransactionId"); - if( nTransId >= pBase->nMaxTransCount ) - return; - - Transaction* pPtr = ImpDdeMgr::GetTransTable( pBase ); - pPtr += nTransId; - DBG_ASSERT(pPtr->hConvOwner!=0,"DDE:TransId has no owner"); - if( pPtr->hConvOwner ) - { - //WRITELOG("Freeing transaction"); - DdeFreeStringHandle( pPtr->hszItem ); - memset( pPtr, 0, sizeof(Transaction) ); - DBG_ASSERT(pBase->nCurTransCount,"Dde:Invalid Trans. count"); - pBase->nCurTransCount--; - } -} - -// static -ULONG ImpDdeMgr::GetTransaction( ImpDdeMgrData* pBase, - HCONV hOwner, HSZ hszItem, USHORT nFormat ) -{ - DBG_ASSERT(pBase,"DDE:No Data"); - if( !pBase || !hOwner ) - return 0; - - Transaction* pTrans = ImpDdeMgr::GetTransTable( pBase ); - DBG_ASSERT(pTrans,"DDE:No TransactionTable"); - if( !pTrans ) - return 0; - pTrans++; // NULLHANDLE ueberspringen - - ImpHCONV* pConv = ImpDdeMgr::GetConvTable( pBase ); - pConv += (USHORT)hOwner; - HCONV hConvPartner = pConv->hConvPartner; - - USHORT nCurTransCount = pBase->nCurTransCount; - for( USHORT nTrans=1; nTrans< pBase->nMaxTransCount; nTrans++, pTrans++ ) - { - if( pTrans->hConvOwner ) - { - if(( pTrans->hConvOwner == hOwner || - pTrans->hConvOwner == hConvPartner) && - pTrans->nFormat == nFormat && - pTrans->hszItem == hszItem ) - { - // gefunden! - return (ULONG)nTrans; - } - nCurTransCount--; - if( !nCurTransCount ) - return 0; - } - } - return 0; // narda -} - -// static -HSZ ImpDdeMgr::DdeCreateStringHandle( PSZ pszString, int iCodePage) -{ - if( !pszString || *pszString == '\0' ) - return (HSZ)0; - // Atom-Table beachtet Gross/Kleinschreibung, DDEML aber nicht - - // OV 12.4.96: Services,Topics,Items case-sensitiv!!! - // (Grosskundenanforderung (Reuter-DDE)) - //strlwr( pszString ); - //*pszString = (char)toupper(*pszString); - - HATOMTBL hAtomTable = WinQuerySystemAtomTable(); - ATOM aAtom = WinAddAtom( hAtomTable, pszString ); - return (HSZ)aAtom; -} - -// static -ULONG ImpDdeMgr::DdeQueryString( HSZ hszStr, PSZ pszStr, ULONG cchMax, int iCodePage) -{ - HATOMTBL hAtomTable = WinQuerySystemAtomTable(); - if ( !pszStr ) - return WinQueryAtomLength( hAtomTable, (ATOM)hszStr); - else - { - *pszStr = 0; - return WinQueryAtomName( hAtomTable, (ATOM)hszStr, pszStr, cchMax ); - } -} - -// static -BOOL ImpDdeMgr::DdeFreeStringHandle( HSZ hsz ) -{ - if( !hsz ) - return FALSE; - ATOM aResult = WinDeleteAtom( WinQuerySystemAtomTable(),(ATOM)hsz ); - return (BOOL)(aResult==0); -} - -// static -BOOL ImpDdeMgr::DdeKeepStringHandle( HSZ hsz ) -{ - if( !hsz ) - return TRUE; - HATOMTBL hAtomTable = WinQuerySystemAtomTable(); -#ifdef DBG_UTIL - ULONG nUsageCount=WinQueryAtomUsage(hAtomTable,(ATOM)hsz); -#endif - ULONG nAtom = 0xFFFF0000; - ULONG nPar = (ULONG)hsz; - nAtom |= nPar; - ATOM aAtom = WinAddAtom( hAtomTable, (PSZ)nAtom ); -#ifdef DBG_UTIL - if ( aAtom ) - DBG_ASSERT(WinQueryAtomUsage(hAtomTable,(ATOM)hsz)==nUsageCount+1,"Keep failed"); -#endif - return (BOOL)(aAtom!=0); -} - - -// static -int ImpDdeMgr::DdeCmpStringHandles(HSZ hsz1, HSZ hsz2) -{ - if ( hsz1 == hsz2 ) - return 0; - if ( hsz1 < hsz2 ) - return -1; - return 1; -} - -HDDEDATA ImpDdeMgr::DdeCreateDataHandle( void* pSrc, ULONG cb, - ULONG cbOff, HSZ hszItem, USHORT wFmt, USHORT afCmd) -{ - char* pData = (char*)pSrc; - pData += cbOff; - USHORT nStatus; - if( afCmd & HDATA_APPOWNED ) - nStatus = IMP_HDATAAPPOWNED; - else - nStatus = 0; - PDDESTRUCT hData=MakeDDEObject(0,(ATOM)hszItem,nStatus,wFmt,pData,cb); -// WRITEDATA(hData) - if ( !hData ) - ImpDdeMgr::nLastErrInstance = DMLERR_INVALIDPARAMETER; - return (HDDEDATA)hData; -} - -// static -BYTE* ImpDdeMgr::DdeAccessData(HDDEDATA hData, ULONG* pcbDataSize) -{ - BYTE* pRet = 0; - *pcbDataSize = 0; - if ( hData ) - { - pRet = (BYTE*)hData; - pRet += hData->offabData; - ULONG nLen = hData->cbData; - // nLen -= hData->offabData; - *pcbDataSize = nLen; - } - else - ImpDdeMgr::nLastErrInstance = DMLERR_INVALIDPARAMETER; - return pRet; -} - -// static -BOOL ImpDdeMgr::DdeUnaccessData(HDDEDATA hData) -{ - return TRUE; // nothing to do for us -} - -// static -BOOL ImpDdeMgr::DdeFreeDataHandle(HDDEDATA hData) -{ - DdeUnaccessData( hData ); - MyDosFreeMem( (PSZ)hData, "DdeFreeDataHandle" ); - return TRUE; -} - -// static -HDDEDATA ImpDdeMgr::DdeAddData(HDDEDATA hData,void* pSrc,ULONG cb,ULONG cbOff) -{ - return (HDDEDATA)0; -} - -// static -ULONG ImpDdeMgr::DdeGetData(HDDEDATA hData,void* pDst,ULONG cbMax,ULONG cbOff) -{ - return 0; -} - -BOOL ImpDdeMgr::DisconnectAll() -{ - //WRITESTATUS("Before DisconnectAll()") - USHORT nCurConvCount = pData->nCurConvCount; - if( !nCurConvCount ) - return TRUE; - - BOOL bRet = TRUE; - ImpHCONV* pPtr = pConvTable; - pPtr++; - - for( USHORT nPos=1; nPos < pData->nMaxConvCount; nPos++, pPtr++ ) - { - if( pPtr->hWndThis ) - { - if( !DdeDisconnect( (HCONV)nPos ) ) - bRet = FALSE; - nCurConvCount--; - if( !nCurConvCount ) - break; - } - } - //WRITESTATUS("After DisconnectAll()") - return bRet; -} - -// static -void ImpDdeMgr::FreeTransactions( ImpDdeMgrData* pData,HWND hWndThis, - HWND hWndPartner ) -{ - USHORT nCurTransCount = pData->nCurTransCount; - if( !nCurTransCount ) - return; - - Transaction* pTrans = GetTransTable( pData ); - ImpHCONV* pConvTable = GetConvTable( pData ); - pTrans++; - for( USHORT nPos=1; nPos < pData->nMaxTransCount; nPos++, pTrans++ ) - { - if( pTrans->hConvOwner ) - { - ImpHCONV* pConv = pConvTable + (USHORT)(pTrans->hConvOwner); - if((pConv->hWndThis==hWndThis&& pConv->hWndPartner==hWndPartner)|| - (pConv->hWndThis==hWndPartner && pConv->hWndPartner==hWndThis)) - { - FreeTransaction( pData, (ULONG)nPos ); - } - nCurTransCount--; - if( !nCurTransCount ) - return; - } - } -} - -// static -void ImpDdeMgr::FreeTransactions( ImpDdeMgrData* pData, HCONV hConvOwner ) -{ - USHORT nCurTransCount = pData->nCurTransCount; - if( !nCurTransCount ) - return; - - Transaction* pTrans = GetTransTable( pData ); -// ImpHCONV* pConvTable = GetConvTable( pData ); - pTrans++; - for( USHORT nPos=1; nPos < pData->nMaxTransCount; nPos++, pTrans++ ) - { - if( pTrans->hConvOwner == hConvOwner ) - { - FreeTransaction( pData, (ULONG)nPos ); - nCurTransCount--; - if( !nCurTransCount ) - return; - } - } -} - -// static -void ImpDdeMgr::FreeConversations( ImpDdeMgrData* pData, HWND hWndThis, - HWND hWndPartner ) -{ - USHORT nCurCount = pData->nCurConvCount; - if( !nCurCount ) - return; - - ImpHCONV* pPtr = GetConvTable( pData ); - pPtr++; - for( USHORT nPos=1; nPos < pData->nMaxConvCount; nPos++, pPtr++ ) - { - if( pPtr->hWndThis ) - { - if( hWndThis && pPtr->hWndPartner==hWndPartner ) - FreeConvHandle( pData, (HCONV)nPos ); - nCurCount--; - if( !nCurCount ) - return; - } - } -} - - -BOOL ImpDdeMgr::OwnsConversationHandles() -{ - //WRITESTATUS("OwnsConversationHandles()"); -#if 0 && defined( OV_DEBUG ) - String aStr("OwnsConversationHandles Server:"); - aStr += (ULONG)hWndServer; - WRITELOG((char*)aStr.GetStr()) -#endif - ImpHCONV* pPtr = GetConvTable( pData ); - for( USHORT nCur = 1; nCur < pData->nMaxConvCount; nCur++, pPtr++ ) - { - if( pPtr->hWndThis && pPtr->pidOwner == pidThis ) - { - //WRITELOG("OwnsConversationHandles: TRUE"); - return TRUE; - } - } - // WRITELOG("OwnsConversationHandles: FALSE"); - return FALSE; -} - - - -// ********************************************************************* -// ********************************************************************* -// ********************************************************************* - -USHORT DdeInitialize(ULONG* pidInst, PFNCALLBACK pfnCallback, - ULONG afCmd, ULONG ulRes) -{ - if( (*pidInst)!=0 ) - { - // Reinitialize wird noch nicht unterstuetzt - DBG_ASSERT(0,"DDEML:Reinitialize not supported"); - return DMLERR_INVALIDPARAMETER; - } - - ImpDdeMgr* pMgr = new ImpDdeMgr; - *pidInst = (ULONG)pMgr; - return pMgr->DdeInitialize( pfnCallback, afCmd ); -} - -BOOL DdeUninitialize(ULONG idInst) -{ - if( !idInst ) - return FALSE; - ImpDdeMgr* pMgr = (ImpDdeMgr*)idInst; - // nur loeschen, wenn wir nicht mehr benutzt werden! - if( !pMgr->OwnsConversationHandles() ) - { - WRITELOG("DdeUninitialize: TRUE"); - delete pMgr; - return TRUE; - } - WRITELOG("DdeUninitialize: FALSE"); - return FALSE; -} - - -HCONVLIST DdeConnectList(ULONG idInst, HSZ hszService, HSZ hszTopic, - HCONVLIST hConvList, CONVCONTEXT* pCC) -{ - if( !idInst ) - return 0; - return ((ImpDdeMgr*)idInst)->DdeConnectList(hszService,hszTopic, - hConvList, pCC ); -} - -HCONV DdeQueryNextServer(HCONVLIST hConvList, HCONV hConvPrev) -{ - return ImpDdeMgr::DdeQueryNextServer( hConvList, hConvPrev ); -} - -BOOL DdeDisconnectList(HCONVLIST hConvList) -{ - return ImpDdeMgr::DdeDisconnectList( hConvList ); -} - -HCONV DdeConnect(ULONG idInst, HSZ hszService, HSZ hszTopic, - CONVCONTEXT* pCC) -{ - if( !idInst ) - return 0; - return ((ImpDdeMgr*)idInst)->DdeConnect( hszService, hszTopic, pCC ); -} - -BOOL DdeDisconnect(HCONV hConv) -{ - return ImpDdeMgr::DdeDisconnect( hConv ); -} - -HCONV DdeReconnect(HCONV hConv) -{ - return ImpDdeMgr::DdeReconnect( hConv ); -} - - -USHORT DdeQueryConvInfo(HCONV hConv, ULONG idTransact, CONVINFO* pCI ) -{ - return ImpDdeMgr::DdeQueryConvInfo( hConv, idTransact, pCI ); -} - -BOOL DdeSetUserHandle(HCONV hConv, ULONG id, ULONG hUser) -{ - return ImpDdeMgr::DdeSetUserHandle( hConv, id, hUser ); -} - -BOOL DdeAbandonTransaction(ULONG idInst, HCONV hConv, ULONG idTransaction) -{ - if( !idInst ) - return FALSE; - return ((ImpDdeMgr*)idInst)->DdeAbandonTransaction(hConv,idTransaction); -} - -BOOL DdePostAdvise(ULONG idInst, HSZ hszTopic, HSZ hszItem) -{ - if( !idInst ) - return FALSE; - return ((ImpDdeMgr*)idInst)->DdePostAdvise( hszTopic, hszItem ); -} - -BOOL DdeEnableCallback(ULONG idInst, HCONV hConv, USHORT wCmd) -{ - if( !idInst ) - return FALSE; - return ((ImpDdeMgr*)idInst)->DdeEnableCallback( hConv, wCmd ); -} - -HDDEDATA DdeClientTransaction(void* pData, ULONG cbData, - HCONV hConv, HSZ hszItem, USHORT wFmt, USHORT wType, - ULONG dwTimeout, ULONG* pdwResult) -{ - return ImpDdeMgr::DdeClientTransaction( pData, cbData, - hConv, hszItem, wFmt, wType, dwTimeout, pdwResult ); -} - -HDDEDATA DdeCreateDataHandle(ULONG idInst, void* pSrc, ULONG cb, - ULONG cbOff, HSZ hszItem, USHORT wFmt, USHORT afCmd) -{ - if( !idInst ) - return 0; - return ((ImpDdeMgr*)idInst)->DdeCreateDataHandle( pSrc, cb, - cbOff, hszItem, wFmt, afCmd ); -} - -HDDEDATA DdeAddData(HDDEDATA hData, void* pSrc, ULONG cb, ULONG cbOff) -{ - return ImpDdeMgr::DdeAddData( hData, pSrc, cb, cbOff ); -} - -ULONG DdeGetData(HDDEDATA hData, void* pDst, ULONG cbMax, ULONG cbOff) -{ - return ImpDdeMgr::DdeGetData( hData, pDst, cbMax, cbOff ); -} - -BYTE* DdeAccessData(HDDEDATA hData, ULONG* pcbDataSize) -{ - return ImpDdeMgr::DdeAccessData( hData, pcbDataSize ); -} - -BOOL DdeUnaccessData(HDDEDATA hData) -{ - return ImpDdeMgr::DdeUnaccessData( hData ); -} - -BOOL DdeFreeDataHandle(HDDEDATA hData) -{ - return ImpDdeMgr::DdeFreeDataHandle( hData ); -} - -USHORT DdeGetLastError(ULONG idInst) -{ - if( !idInst ) - return DMLERR_DLL_NOT_INITIALIZED; - return ((ImpDdeMgr*)idInst)->DdeGetLastError(); -} - -HSZ DdeCreateStringHandle(ULONG idInst, PSZ pszString,int iCodePage ) -{ - if( !idInst ) - return 0; - return ((ImpDdeMgr*)idInst)->DdeCreateStringHandle(pszString,iCodePage); -} - -ULONG DdeQueryString( ULONG idInst, HSZ hsz, PSZ pBuf, - ULONG cchMax, int iCodePage ) -{ - if( !idInst ) - return 0; - return ((ImpDdeMgr*)idInst)->DdeQueryString( hsz,pBuf,cchMax,iCodePage); -} - -BOOL DdeFreeStringHandle( ULONG idInst, HSZ hsz) -{ - if( !idInst ) - return FALSE; - return ((ImpDdeMgr*)idInst)->DdeFreeStringHandle( hsz ); -} - -BOOL DdeKeepStringHandle( ULONG idInst, HSZ hsz ) -{ - if( !idInst ) - return FALSE; - return ((ImpDdeMgr*)idInst)->DdeKeepStringHandle( hsz ); -} - -int DdeCmpStringHandles(HSZ hsz1, HSZ hsz2) -{ - return ImpDdeMgr::DdeCmpStringHandles( hsz1, hsz2 ); -} - -HDDEDATA DdeNameService( ULONG idInst, HSZ hsz1, HSZ hszRes, USHORT afCmd ) -{ - if( !idInst ) - return 0; - return ((ImpDdeMgr*)idInst)->DdeNameService( hsz1, afCmd ); -} - - diff --git a/svtools/source/svdde/ddemldeb.cxx b/svtools/source/svdde/ddemldeb.cxx deleted file mode 100644 index bb53743a2915..000000000000 --- a/svtools/source/svdde/ddemldeb.cxx +++ /dev/null @@ -1,283 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ddemldeb.cxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include "ddemlimp.hxx" - -#ifdef OV_DEBUG -#include -#endif - -#if defined(OV_DEBUG) - -void ImpAddHSZ( HSZ hszString, String& rStr ) -{ - char aBuf[ 128 ]; - ImpDdeMgr::DdeQueryString( hszString,aBuf,sizeof(aBuf),850); - rStr += " (\""; rStr += aBuf; rStr += "\","; - HATOMTBL hAtomTable = WinQuerySystemAtomTable(); - ULONG nRefCount = 0; - if( hszString ) - nRefCount = WinQueryAtomUsage(hAtomTable, (ATOM)hszString ); - rStr += nRefCount; rStr += ')'; -} - - -void ImpWriteDdeStatus(char* aFilename, char* pAppContext) -{ - char aBuf[ 128 ]; - USHORT nCtr; - HWND* pAppPtr; - ImpHCONV* pConvPtr; - Transaction* pTransPtr; - - ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData(); - if( !pData ) - return; - SvFileStream aStrm(aFilename, STREAM_READWRITE ); - String aLine; - aStrm.Seek( STREAM_SEEK_TO_END ); - aStrm << endl; - aStrm.WriteLine("********************** DDEML-Log ***********************"); - aStrm << endl; - if( pAppContext ) - { - aLine = Application::GetAppName(); - aLine += ':'; - aLine += "App-Context:"; aLine += pAppContext; - aStrm.WriteLine( aLine ); aStrm << endl; - } - aStrm.WriteLine("----------------- ImpDdeMgrData -------------------"); - aStrm << endl; - aLine= "TotalSize :"; aLine+= pData->nTotalSize; aStrm.WriteLine(aLine); - aLine= "nOffsAppTable :"; aLine+= pData->nOffsAppTable; aStrm.WriteLine(aLine); - aLine= "nOffsConvTable :"; aLine+= pData->nOffsConvTable; aStrm.WriteLine(aLine); - aLine= "nOffsTransTable:"; aLine+= pData->nOffsTransTable; aStrm.WriteLine(aLine); - aLine= "nMaxAppCount :"; aLine+= pData->nMaxAppCount; aStrm.WriteLine(aLine); - aLine= "nMaxConvCount :"; aLine+= pData->nMaxConvCount; aStrm.WriteLine(aLine); - aLine= "nMaxTransCount :"; aLine+= pData->nMaxTransCount; aStrm.WriteLine(aLine); - aLine= "nLastErr :"; aLine+= pData->nLastErr; aStrm.WriteLine(aLine); - aLine= "nCurConvCount :"; aLine+= pData->nCurConvCount; aStrm.WriteLine(aLine); - aLine= "nCurTransCount :"; aLine+= pData->nCurTransCount; aStrm.WriteLine(aLine); - aStrm << endl; - aStrm.WriteLine("---------- Registered DDEML-Applications -----------"); - aStrm << endl; - pAppPtr = ImpDdeMgr::GetAppTable( pData ); - for( nCtr = 0; nCtr < pData->nMaxAppCount; nCtr++, pAppPtr++ ) - { - if( *pAppPtr ) - { - aLine = "App."; aLine += nCtr; aLine += " HWND:"; - aLine += (ULONG)*pAppPtr; aStrm.WriteLine(aLine); - } - } - - aStrm << endl; - aStrm.WriteLine("-------------- Conversation handles ----------------"); - aStrm << endl; - - USHORT nCurCount = pData->nCurConvCount; - - if( nCurCount ) - { - pConvPtr = ImpDdeMgr::GetConvTable( pData ); - for( nCtr = 0; nCtr < pData->nMaxConvCount; nCtr++, pConvPtr++ ) - { - if( pConvPtr->hWndThis ) - { - aLine = "HCONV:"; aLine += nCtr; - aLine += " HCONVpartner: "; aLine += (USHORT)pConvPtr->hConvPartner; - if( !pConvPtr->hConvPartner ) aLine += "(Non-DDEML-App)"; - aLine += " hszPartner: "; aLine += (USHORT)pConvPtr->hszPartner; - ImpAddHSZ( pConvPtr->hszPartner, aLine ); - aStrm.WriteLine( aLine ); - - aLine = "hszService: "; aLine += (USHORT)pConvPtr->hszServiceReq; - ImpAddHSZ( pConvPtr->hszServiceReq, aLine ); - aLine += " hszTopic: "; aLine += (USHORT)pConvPtr->hszTopic; - ImpAddHSZ( pConvPtr->hszTopic, aLine ); - aStrm.WriteLine( aLine ); - - aLine= "Status: "; aLine+= pConvPtr->nStatus; - if( pConvPtr->nStatus & ST_CLIENT ) aLine += " (Client)"; - if( pConvPtr->nStatus & ST_INLIST ) aLine += " (Inlist)"; - aStrm.WriteLine(aLine); - - aLine = "pidOwner: "; aLine += (ULONG)pConvPtr->pidOwner; - aStrm.WriteLine( aLine ); - aLine = "hWndThis: "; aLine += (ULONG)pConvPtr->hWndThis; - aStrm.WriteLine( aLine ); - aLine = "hWndPartner: "; aLine += (ULONG)pConvPtr->hWndPartner; - aStrm.WriteLine( aLine ); - - aLine = "hConvList: "; aLine += (ULONG)pConvPtr->hConvList; - aLine += " Prev: "; aLine += pConvPtr->nPrevHCONV; - aLine += " Next: "; aLine += pConvPtr->nNextHCONV; - aStrm.WriteLine( aLine ); - aStrm.WriteLine("----------------------------------------------------"); - - nCurCount--; - if( !nCurCount ) - break; - } - } - } - - aStrm.WriteLine("----------------- Transaction Ids ------------------"); - - nCurCount = pData->nCurTransCount; - if( nCurCount ) - { - pTransPtr = ImpDdeMgr::GetTransTable( pData ); - for( nCtr = 0; nCtr < pData->nMaxTransCount; nCtr++, pTransPtr++ ) - { - - if( pTransPtr->hConvOwner ) - { - aLine = "TransactionId:"; aLine += nCtr; - aLine += " hConvOwner: "; aLine += (USHORT)pTransPtr->hConvOwner; - aStrm.WriteLine( aLine ); - aLine = "Item: "; aLine += (USHORT)pTransPtr->hszItem; - ImpAddHSZ( pTransPtr->hszItem, aLine ); - aLine += " Format: "; aLine += pTransPtr->nFormat; - aStrm.WriteLine( aLine ); - aLine = "TransactionType: "; aLine += pTransPtr->nType; - aLine += " Convst: "; aLine += pTransPtr->nConvst; - aLine += " LastErr: "; aLine += pTransPtr->nLastError; - aLine += " Userhandle: "; aLine += pTransPtr->nUser; - aStrm.WriteLine( aLine ); - aStrm.WriteLine("--------------------------------------------------"); - - nCurCount--; - if( !nCurCount ) - break; - } - } - } - aStrm << endl; - aStrm.WriteLine("******************* End of DDEML-Log *******************"); -} - -void ImpWriteDdeData(char* aFilename, DDESTRUCT* pData) -{ - char aBuf[ 128 ]; - USHORT nCtr; - SvFileStream aStrm(aFilename, STREAM_READWRITE ); - aStrm.Seek( STREAM_SEEK_TO_END ); - String aLine; - aStrm << endl; - aLine = "cbData:"; aLine += pData->cbData; aStrm.WriteLine( aLine ); - aLine = "fsStatus:"; aLine += pData->fsStatus; aStrm.WriteLine( aLine ); - aLine = "usFormat:"; aLine += pData->usFormat; aStrm.WriteLine( aLine ); - aLine = "ItemName:"; aLine += (char*)((char*)pData+pData->offszItemName); - aStrm.WriteLine( aLine ); - aLine = "offabData:"; aLine += pData->offabData; aStrm.WriteLine(aLine); - char* pBuf = (char*)pData+pData->offabData; - USHORT nLen = pData->cbData; // - pData->offabData; - while( nLen ) - { - aStrm << *pBuf; - nLen--; - pBuf++; - } - aStrm << endl; -} - -void ImpWriteLogFile(char* pFilename, char* pStr) -{ - SvFileStream aStrm(pFilename, STREAM_READWRITE ); - aStrm.Seek( STREAM_SEEK_TO_END ); - String aStr( Application::GetAppName() ); - aStr += ':'; aStr += pStr; - aStrm.WriteLine( (char*)aStr.GetStr() ); -} - -#else - -void ImpWriteDdeStatus(char*, char* ) {} -void ImpWriteDdeData(char*, DDESTRUCT*) {} -void ImpWriteLogFile(char*, char*) {} - -#endif - -APIRET MyDosAllocSharedMem(void** ppBaseAddress, char* pszName, unsigned long ulObjectSize, - unsigned long ulFlags, char* pContextStr ) -{ - APIRET nRet = DosAllocSharedMem(ppBaseAddress,pszName,ulObjectSize,ulFlags ); -#if 0 && defined(OV_DEBUG) && defined(LOGFILE) - String aStr("DosAllocSharedMem:"); - aStr += pContextStr; - aStr += ": "; - aStr += ulObjectSize; - aStr += " ("; - aStr += (ULONG)*((char**)ppBaseAddress); - aStr += ')'; - ImpWriteLogFile("\\ddeml.mem", (char*)aStr.GetStr() ); -#endif - return nRet; -} - -APIRET MyDosAllocMem(void** ppBaseAddress, unsigned long ulObjectSize, - unsigned long ulFlags, char* pContextStr ) -{ - APIRET nRet = DosAllocMem(ppBaseAddress, ulObjectSize,ulFlags ); -#if 0 && defined(OV_DEBUG) && defined(LOGFILE) - String aStr("DosAllocMem:"); - aStr += pContextStr; - aStr += ": "; - aStr += ulObjectSize; - aStr += " ("; - aStr += (ULONG)*((char**)ppBaseAddress); - aStr += ')'; - ImpWriteLogFile("\\ddeml.mem", (char*)aStr.GetStr() ); -#endif - return nRet; -} - - -APIRET MyDosFreeMem( void* pBaseAddress, char* pContextStr ) -{ - APIRET nRet = DosFreeMem( pBaseAddress ); -#if 0 && defined(OV_DEBUG) && defined(LOGFILE) - String aStr("DosFreeMem:"); - aStr += pContextStr; - aStr += ": "; - aStr += (ULONG)pBaseAddress; - ImpWriteLogFile("\\ddeml.mem", (char*)aStr.GetStr()); -#endif - return nRet; -} - - - - - diff --git a/svtools/source/svdde/ddemldeb.hxx b/svtools/source/svdde/ddemldeb.hxx deleted file mode 100644 index 39d3d836882a..000000000000 --- a/svtools/source/svdde/ddemldeb.hxx +++ /dev/null @@ -1,69 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ddemldeb.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#if defined(OV_DEBUG) - -void ImpWriteLogFile(char*,char*); -void ImpAddHSZ( HSZ, String& ); -void ImpWriteDdeStatus(char*, char* ); -void ImpWriteDdeData(char*, DDESTRUCT*); - -#ifdef LOGFILE -#define WRITELOG(aString) ImpWriteLogFile("\\ddeml.log",aString); -#else -#define WRITELOG(bla) -#endif -#ifdef STATUSFILE -#define WRITESTATUS(aContext) ImpWriteDdeStatus("\\ddeml.sts",aContext); -#else -#define WRITESTATUS(bla) -#endif -#ifdef DDEDATAFILE -#define WRITEDATA(data) ImpWriteDdeData("\\ddeml.dat",data); -#else -#define WRITEDATA(bla) -#endif - -#else - -#define WRITELOG(bla) -#define WRITESTATUS(bla) -#define WRITEDATA(bla) - -#endif - -APIRET MyDosAllocSharedMem(void** ppBaseAddress, char* pszName, unsigned long ulObjectSize, - unsigned long ulFlags, char* pContextStr ); - -APIRET MyDosAllocMem(void** ppBaseAddress, unsigned long ulObjectSize, - unsigned long ulFlags, char* pContextStr ); - -APIRET MyDosFreeMem( void* pBaseAddress, char* pContextStr ); - diff --git a/svtools/source/svdde/ddemlimp.hxx b/svtools/source/svdde/ddemlimp.hxx deleted file mode 100644 index 47ad53d0b9fe..000000000000 --- a/svtools/source/svdde/ddemlimp.hxx +++ /dev/null @@ -1,436 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ddemlimp.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _DDEMLIMP_HXX -#define _DDEMLIMP_HXX - - -#include -#include -#include "ddemlos2.h" - -#define DDEMLSERVICETABLE_INISIZE 8 - -// Bezeichner der systemglobalen DDEML-Tabelle -#define DDEMLDATA "\\SHAREMEM\\OV_DDEML.DAT" - -// vorlaeufig konstante Tabellengroessen -#define CONVTABLECOUNT 2048 /* max count conversations */ -#define TRANSTABLECOUNT 2048 /* transactions */ -#define DDEMLAPPCOUNT 16 /* max count simultaniously running */ - /* ddeml (StarDivision) applications */ - -#define ST_TERMACKREC 0x8000 /* wird im Conversationhandle gesetzt, */ - /* wenn die Partner-App DDE_TERMINATE */ - /* bestaetigt hat */ - -#define XST_TIMEOUT 17 /* Trans. hat Timeout ueberschritten */ -#define XST_WAITING_ACK 18 /* Trans. wartet auf Acknowledge */ -#define XST_WAITING_ADVDATA 19 /* Trans. wartet auf Advise-Daten */ -#define XST_WAITING_REQDATA 20 /* Trans. wartet auf angeforderte Daten */ - - -/* User-Flags DDESTRUCT */ -#define IMP_HDATAAPPOWNED 0x8000 - -#define CONVLISTNAME "DdeConvListId" - -#define XTYPF_MASK (XTYPF_NOBLOCK | XTYPF_NODATA | XTYPF_ACKREQ) - -// -// DDEML-Messages; werden nur an registrierte DDEML-Apps gesendet -// - -// Msg: WM_DDEML_REGISTER -// Empfaenger: wird allen DDEML-Applikationen nach Registrierung -// eines neuen Services gesendet -// Params: nPar1: hszBaseServName -// nPar2: hszInstServName -#define WM_DDEML_REGISTER WM_USER+1 - -// Msg: WM_DDEML_UNREGISTER -// Empfaenger: wird allen DDEML-Applikationen nach Deregistrierung -// eines Services gesendet -// Params: nPar1: hszBaseServName -// nPar2: hszInstServName -#define WM_DDEML_UNREGISTER WM_USER+2 - -// -// -// - -struct ImpHCONV -{ - HCONV hConvPartner; - HSZ hszPartner; // Name of partner application - HSZ hszServiceReq; // Service name - HSZ hszTopic; // Topic name - USHORT nStatus; // ST_* of conversation - HCONVLIST hConvList; // ConvListId , wenn in ConvList - CONVCONTEXT aConvContext; // Conversation context - - // private - HWND hWndThis; // 0 == Handle not used - HWND hWndPartner; - PID pidOwner; // PID des DdeManagers, der - // den Conv-Handle erzeugt hat. - USHORT nPrevHCONV; // 0 == no previous hConv or not in list - USHORT nNextHCONV; // 0 == no next hconv or not in list -}; - -struct Transaction -{ - HSZ hszItem; // Item name - USHORT nFormat; // Data format - USHORT nType; // Transaction type (XTYP_*) - // XTYP_ADVREQ [|XTYPF_NODATA] == Advise-Loop - // [|XTYPF_ACKREQ] - // XTYP_EXECUTE == laufendes Execute - // XTYP_REQUEST - // XTYP_POKE - // XTYP_ADVSTOP - // XTYP_ADVSTART - USHORT nConvst; // Conversation state (XST_*) - // 0 == idle - // XST_REQSENT (fuer XTYP_ADVREQ) - // XST_TIMEOUT (fuer alle Typen!) - // XST_WAITING (alle ausser XTYP_ADVREQ) - USHORT nLastError; // last err in transaction - ULONG nUser; // Userhandle - // private - HCONV hConvOwner; // 0 == Transaction not used -}; - - -struct ImpWndProcParams -{ - HWND hWndReceiver; - MPARAM nPar1; - MPARAM nPar2; -}; - -struct ImpService -{ - HSZ hBaseServName; // Basis-Name des Service - HSZ hInstServName; // Basis-Name + DDEML-Server-HWND der App -}; - -class ImpDdeMgr; - -// Daten eines Conversation-Windows -struct ImpConvWndData -{ - ImpDdeMgr* pThis; - USHORT nRefCount; // Zahl Conversations auf diesem Window -}; - - -// systemglobale Daten der Library (liegen in named shared memory) -struct ImpDdeMgrData -{ - ULONG nTotalSize; - ULONG nOffsAppTable; - ULONG nOffsConvTable; - ULONG nOffsTransTable; - USHORT nMaxAppCount; - USHORT nMaxConvCount; - USHORT nMaxTransCount; - USHORT nLastErr; - USHORT nReserved; - USHORT nCurTransCount; - USHORT nCurConvCount; - HWND aAppTable[ 1 ]; // fuer Broadcast-Messages - ImpHCONV aConvTable[ 1 ]; - Transaction aTransTable[ 1 ]; -}; - - - -class ImpDdeMgr -{ - friend MRESULT EXPENTRY ConvWndProc(HWND hWnd,ULONG nMsg,MPARAM nPar1,MPARAM nPar2); - friend MRESULT EXPENTRY ServerWndProc(HWND hWnd,ULONG nMsg,MPARAM nPar1,MPARAM nPar2); - friend void ImpWriteDdeStatus(char*,char*); - friend void ImpAddHSZ( HSZ, String& ); - - static PSZ AllocAtomName( ATOM hString, ULONG& rBufLen ); - static PDDESTRUCT MakeDDEObject( HWND hwnd, ATOM hItemName, - USHORT fsStatus, USHORT usFormat, PVOID pabData, ULONG usDataLen ); - static APIRET AllocNamedSharedMem( PPVOID ppBaseAddress, PSZ pName, - ULONG nElementSize, ULONG nElementCount ); - - HWND hWndServer; - PID pidThis; - PFNCALLBACK pCallback; - ULONG nTransactFilter; - CONVCONTEXT aDefaultContext; - ImpDdeMgrData* pData; - ImpService* pServices; - USHORT nServiceCount; - - ImpHCONV* pConvTable; // liegt in pData (nicht deleten!) - Transaction* pTransTable; // liegt in pData (nicht deleten!) - HWND* pAppTable; // liegt in pData (nicht deleten!) - - static ImpHCONV* GetConvTable( ImpDdeMgrData* ); - static Transaction* GetTransTable( ImpDdeMgrData* ); - static HWND* GetAppTable( ImpDdeMgrData* ); - - - static HWND NextFrameWin( HENUM hEnum ); - void CreateServerWnd(); - void DestroyServerWnd(); - HWND CreateConversationWnd(); - // Fktn. duerfen nur fuer HCONVs aufgerufen werden, die - // in der eigenen Applikation erzeugt wurden - static void DestroyConversationWnd( HWND hWndConv ); - static USHORT GetConversationWndRefCount( HWND hWndConv ); - static USHORT IncConversationWndRefCount( HWND hWndConv ); - - MRESULT SrvWndProc(HWND hWnd,ULONG nMsg,MPARAM nPar1,MPARAM nPar2); - MRESULT ConvWndProc(HWND hWnd,ULONG nMsg,MPARAM nPar1,MPARAM nPar2); - void RegisterDDEMLApp(); - void UnregisterDDEMLApp(); - void CleanUp(); - ImpDdeMgrData* InitAll(); - static BOOL MyWinDdePostMsg( HWND, HWND, USHORT, PDDESTRUCT, ULONG ); - void MyInitiateDde( HWND hWndServer, HWND hWndClient, - HSZ hszService, HSZ hszTopic, CONVCONTEXT* pCC ); - DDEINIT* CreateDDEInitData( HWND hWndDest, HSZ hszService, - HSZ hszTopic, CONVCONTEXT* pCC ); - // wenn pDDEData==0, muss pCC gesetzt sein - HCONV ConnectWithClient( HWND hWndClient, HSZ hszPartner, - HSZ hszService, HSZ hszTopic, BOOL bSameInst, - DDEINIT* pDDEData, CONVCONTEXT* pCC = 0); - - HCONV CheckIncoming( ImpWndProcParams*, ULONG nTransMask, - HSZ& rhszItem ); - // fuer Serverbetrieb. Ruft Callback-Fkt fuer alle offenen Advises - // auf, deren Owner der uebergebene HCONV ist. - // bFreeTransactions==TRUE: loescht die Transaktionen - // gibt Anzahl der getrennten Transaktionen zurueck - USHORT SendUnadvises( HCONV hConv, - USHORT nFormat, // 0==alle - BOOL bFreeTransactions ); - - BOOL WaitTransState( - Transaction* pTrans, ULONG nTransId, - USHORT nNewState, - ULONG nTimeout ); - - // DDEML ruft Callback mit XTYP_CONNECT-Transaction nur auf, - // wenn die App den angeforderten Service registriert hat - // Standardeinstellung: TRUE - BOOL bServFilterOn; - - // Fehlercode muss noch systemglobal werden (Atom o. ae.) - static USHORT nLastErrInstance; // wenn 0, dann gilt globaler Fehlercode - - static ImpDdeMgrData* AccessMgrData(); - - static HCONV CreateConvHandle( ImpDdeMgrData* pBase, - PID pidOwner, - HWND hWndThis, HWND hWndPartner, - HSZ hszPartner, HSZ hszServiceReq, HSZ hszTopic, - HCONV hPrevHCONV = 0 ); - - static HCONV IsConvHandleAvailable( ImpDdeMgrData* pBase ); - static HCONV GetConvHandle( ImpDdeMgrData* pBase, - HWND hWndThis, HWND hWndPartner ); - static void FreeConvHandle( ImpDdeMgrData*, HCONV, - BOOL bDestroyHWndThis = TRUE ); - - static ULONG CreateTransaction( ImpDdeMgrData* pBase, - HCONV hOwner, HSZ hszItem, USHORT nFormat, - USHORT nTransactionType ); - static ULONG GetTransaction( ImpDdeMgrData* pBase, - HCONV hOwner, HSZ hszItem, USHORT nFormat ); - - static void FreeTransaction( ImpDdeMgrData*, ULONG nTransId ); - - BOOL DisconnectAll(); - // Transaktionen muessen _vor_ den Konversationen geloescht werden! - static void FreeTransactions( ImpDdeMgrData*, HWND hWndThis, - HWND hWndPartner ); - static void FreeTransactions( ImpDdeMgrData*, HCONV hConvOwner ); - - static void FreeConversations( ImpDdeMgrData*,HWND hWndThis, - HWND hWndPartner ); - - ImpService* GetService( HSZ hszService ); - ImpService* PutService( HSZ hszService ); - void BroadcastService( ImpService*, BOOL bRegistered ); - - // rh: Startposition(!) & gefundener Handle - static ImpHCONV* GetFirstServer( ImpDdeMgrData*, HCONVLIST, HCONV& rh); - static ImpHCONV* GetLastServer( ImpDdeMgrData*, HCONVLIST, HCONV& ); - static BOOL CheckConvListId( HCONVLIST hConvListId ); - - BOOL IsSameInstance( HWND hWnd ); - HSZ GetAppName( HWND hWnd ); - - - // Transactions - MRESULT DdeAck( ImpWndProcParams* pParams ); - MRESULT DdeAdvise( ImpWndProcParams* pParams ); - MRESULT DdeData( ImpWndProcParams* pParams ); - MRESULT DdeExecute( ImpWndProcParams* pParams ); - MRESULT DdeInitiate( ImpWndProcParams* pParams ); - MRESULT DdeInitiateAck( ImpWndProcParams* pParams ); - MRESULT DdePoke( ImpWndProcParams* pParams ); - MRESULT DdeRequest( ImpWndProcParams* pParams ); - MRESULT DdeTerminate( ImpWndProcParams* pParams ); - MRESULT DdeUnadvise( ImpWndProcParams* pParams ); - MRESULT DdeRegister( ImpWndProcParams* pParams ); - MRESULT DdeUnregister( ImpWndProcParams* pParams ); - MRESULT DdeTimeout( ImpWndProcParams* pParams ); - - HDDEDATA Callback( - USHORT nTransactionType, - USHORT nClipboardFormat, - HCONV hConversationHandle, - HSZ hsz1, - HSZ hsz2, - HDDEDATA hData, - ULONG nData1, - ULONG nData2 ); - - HCONV DdeConnectImp( HSZ hszService,HSZ hszTopic,CONVCONTEXT* pCC); - - // connection data - HCONV hCurConv; // wird im DdeInitiateAck gesetzt - HCONVLIST hCurListId; // fuer DdeConnectList - USHORT nPrevConv; // .... "" .... - BOOL bListConnect; - - // synchr. transaction data - BOOL bInSyncTrans; - ULONG nSyncTransId; - HDDEDATA hSyncResponseData; - ULONG nSyncResponseMsg; // WM_DDE_ACK, WM_DDE_DATA, WM_TIMER - // TRUE==nach Ende der synchronen Transaktion eine evtl. benutzte - // asynchrone Transaktion beenden (typisch synchroner Request auf - // Advise-Loop) - BOOL bSyncAbandonTrans; - -public: - ImpDdeMgr(); - ~ImpDdeMgr(); - - USHORT DdeInitialize( PFNCALLBACK pCallbackProc, ULONG nTransactionFilter ); - USHORT DdeGetLastError(); - - HCONV DdeConnect( HSZ hszService, HSZ hszTopic, CONVCONTEXT* ); - HCONVLIST DdeConnectList( HSZ hszService, HSZ hszTopic, - HCONVLIST hConvList, CONVCONTEXT* ); - static BOOL DdeDisconnect( HCONV hConv ); - static BOOL DdeDisconnectList( HCONVLIST hConvList ); - static HCONV DdeReconnect(HCONV hConv); - static HCONV DdeQueryNextServer(HCONVLIST hConvList, HCONV hConvPrev); - static USHORT DdeQueryConvInfo(HCONV hConv, ULONG idTrans,CONVINFO* pCI); - static BOOL DdeSetUserHandle(HCONV hConv, ULONG id, ULONG hUser); - BOOL DdeAbandonTransaction( HCONV hConv, ULONG idTransaction); - - BOOL DdePostAdvise( HSZ hszTopic, HSZ hszItem); - BOOL DdeEnableCallback( HCONV hConv, USHORT wCmd); - - HDDEDATA DdeNameService( HSZ hszService, USHORT afCmd); - - static HDDEDATA DdeClientTransaction(void* pData, ULONG cbData, - HCONV hConv, HSZ hszItem, USHORT wFmt, USHORT wType, - ULONG dwTimeout, ULONG* pdwResult); - - // Data handles - - HDDEDATA DdeCreateDataHandle( void* pSrc, ULONG cb, ULONG cbOff, - HSZ hszItem, USHORT wFmt, USHORT afCmd); - static BYTE* DdeAccessData(HDDEDATA hData, ULONG* pcbDataSize); - static BOOL DdeUnaccessData(HDDEDATA hData); - static BOOL DdeFreeDataHandle(HDDEDATA hData); - static HDDEDATA DdeAddData(HDDEDATA hData,void* pSrc,ULONG cb,ULONG cbOff); - static ULONG DdeGetData(HDDEDATA hData,void* pDst,ULONG cbMax,ULONG cbOff); - - // String handles - - static HSZ DdeCreateStringHandle( PSZ pStr, int iCodePage); - static ULONG DdeQueryString(HSZ hsz,PSZ pStr,ULONG cchMax,int iCPage); - static BOOL DdeFreeStringHandle( HSZ hsz ); - static BOOL DdeKeepStringHandle( HSZ hsz ); - static int DdeCmpStringHandles(HSZ hsz1, HSZ hsz2); - - // mit dieser Funktion kann geprueft werden, ob eine - // Applikation schon eine DDEML-Instanz angelegt hat. - // Die aktuelle Impl. unterstuetzt nur eine DDEML-Instanz - // pro Applikation (wg. synchroner Transaktionen) - static ImpDdeMgr* GetImpDdeMgrInstance( HWND hWnd ); - - // gibt TRUE zurueck, wenn mind. ein lebender HCONV - // von diesem DdeMgr erzeugt wurde - BOOL OwnsConversationHandles(); -}; - -// static -inline ImpHCONV* ImpDdeMgr::GetConvTable( ImpDdeMgrData* pData ) -{ - ImpHCONV* pRet; - if( pData ) - pRet = (ImpHCONV*)((ULONG)(pData) + pData->nOffsConvTable); - else - pRet = 0; - return pRet; -} - -// static -inline Transaction* ImpDdeMgr::GetTransTable( ImpDdeMgrData* pData ) -{ - Transaction* pRet; - if( pData ) - pRet = (Transaction*)((ULONG)(pData) + pData->nOffsTransTable); - else - pRet = 0; - return pRet; -} - -// static -inline HWND* ImpDdeMgr::GetAppTable( ImpDdeMgrData* pData ) -{ - HWND* pRet; - if( pData ) - pRet = (HWND*)((ULONG)(pData) + pData->nOffsAppTable); - else - pRet = 0; - return pRet; -} - - - - -#endif - diff --git a/svtools/source/svdde/ddemlos2.h b/svtools/source/svdde/ddemlos2.h deleted file mode 100644 index fe685e95fecf..000000000000 --- a/svtools/source/svdde/ddemlos2.h +++ /dev/null @@ -1,377 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ddemlos2.h,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _DDEML_H -#define _DDEML_H - -#define INCL_OS2 -#define INCL_WIN - -#include -#include -#include -#include - -typedef LHANDLE HSTR; - -#ifndef CALLBACK -#define CALLBACK -#endif - - -typedef ULONG HCONVLIST; -typedef ULONG HCONV; -typedef ATOM HSZ; -typedef DDESTRUCT* HDDEDATA; - -struct CONVINFO -{ - USHORT nSize; // sizeof(CONVINFO) - ULONG nUser; // Userhandle - HCONV hConvPartner; // - HSZ hszPartner; // Name der Partnerapp - HSZ hszServiceReq; // Name des angeforderten Services - HSZ hszTopic; // -- " -- Topics - HSZ hszItem; // -- " -- Items - USHORT nFormat; // Datenformat der akt. Transaktion - USHORT nType; // Typ der akt. Transaktion (XTYP_*) - USHORT nStatus; // ST_* der Konversation - USHORT nConvst; // XST_* der akt. Transaktion - USHORT nLastError; // letzter Fehler der Transaktion - HCONVLIST hConvList; // ConvListId , wenn in ConvList - CONVCONTEXT aConvCtxt; // conversation context -}; - -/* the following structure is for use with XTYP_WILDCONNECT processing. */ - -struct HSZPAIR -{ - HSZ hszSvc; - HSZ hszTopic; -}; -typedef HSZPAIR *PHSZPAIR; - -/***** conversation states (usState) *****/ - -#define XST_NULL 0 /* quiescent states */ -#define XST_INCOMPLETE 1 -#define XST_CONNECTED 2 -#define XST_INIT1 3 /* mid-initiation states */ -#define XST_INIT2 4 -#define XST_REQSENT 5 /* active conversation states */ -#define XST_DATARCVD 6 -#define XST_POKESENT 7 -#define XST_POKEACKRCVD 8 -#define XST_EXECSENT 9 -#define XST_EXECACKRCVD 10 -#define XST_ADVSENT 11 -#define XST_UNADVSENT 12 -#define XST_ADVACKRCVD 13 -#define XST_UNADVACKRCVD 14 -#define XST_ADVDATASENT 15 -#define XST_ADVDATAACKRCVD 16 - -/* used in LOWORD(dwData1) of XTYP_ADVREQ callbacks... */ -#define CADV_LATEACK 0xFFFF - -/***** conversation status bits (fsStatus) *****/ - -#define ST_CONNECTED 0x0001 -#define ST_ADVISE 0x0002 -#define ST_ISLOCAL 0x0004 -#define ST_BLOCKED 0x0008 -#define ST_CLIENT 0x0010 -#define ST_TERMINATED 0x0020 -#define ST_INLIST 0x0040 -#define ST_BLOCKNEXT 0x0080 -#define ST_ISSELF 0x0100 - - -/* DDE constants for wStatus field */ - -//#define DDE_FACK 0x8000 -//#define DDE_FBUSY 0x4000 -//#define DDE_FDEFERUPD 0x4000 -//#define DDE_FACKREQ 0x8000 -//#define DDE_FRELEASE 0x2000 -//#define DDE_FREQUESTED 0x1000 -//#define DDE_FACKRESERVED 0x3ff0 -//#define DDE_FADVRESERVED 0x3fff -//#define DDE_FDATRESERVED 0x4fff -//#define DDE_FPOKRESERVED 0xdfff -//#define DDE_FAPPSTATUS 0x00ff -#define DDE_FNOTPROCESSED 0x0000 - -/***** message filter hook types *****/ - -#define MSGF_DDEMGR 0x8001 - -/***** codepage constants ****/ - -#define CP_WINANSI 1004 /* default codepage for windows & old DDE convs. */ - -/***** transaction types *****/ - -#define XTYPF_NOBLOCK 0x0002 /* CBR_BLOCK will not work */ -#define XTYPF_NODATA 0x0004 /* DDE_FDEFERUPD */ -#define XTYPF_ACKREQ 0x0008 /* DDE_FACKREQ */ - -#define XCLASS_MASK 0xFC00 -#define XCLASS_BOOL 0x1000 -#define XCLASS_DATA 0x2000 -#define XCLASS_FLAGS 0x4000 -#define XCLASS_NOTIFICATION 0x8000 - -#define XTYP_ERROR (0x0000 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK ) -#define XTYP_ADVDATA (0x0010 | XCLASS_FLAGS ) -#define XTYP_ADVREQ (0x0020 | XCLASS_DATA | XTYPF_NOBLOCK ) -#define XTYP_ADVSTART (0x0030 | XCLASS_BOOL ) -#define XTYP_ADVSTOP (0x0040 | XCLASS_NOTIFICATION) -#define XTYP_EXECUTE (0x0050 | XCLASS_FLAGS ) -#define XTYP_CONNECT (0x0060 | XCLASS_BOOL | XTYPF_NOBLOCK) -#define XTYP_CONNECT_CONFIRM (0x0070 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK) -#define XTYP_XACT_COMPLETE (0x0080 | XCLASS_NOTIFICATION ) -#define XTYP_POKE (0x0090 | XCLASS_FLAGS ) -#define XTYP_REGISTER (0x00A0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK) -#define XTYP_REQUEST (0x00B0 | XCLASS_DATA ) -#define XTYP_DISCONNECT (0x00C0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK) -#define XTYP_UNREGISTER (0x00D0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK) -#define XTYP_WILDCONNECT (0x00E0 | XCLASS_DATA | XTYPF_NOBLOCK) - -#define XTYP_MASK 0x00F0 -#define XTYP_SHIFT 4 /* shift to turn XTYP_ into an index */ - -/***** Timeout constants *****/ - -#define TIMEOUT_ASYNC -1L - -/***** Transaction ID constants *****/ - -#define QID_SYNC -1L - -/****** public strings used in DDE ******/ - -#define SZDDESYS_TOPIC "System" -#define SZDDESYS_ITEM_TOPICS "Topics" -#define SZDDESYS_ITEM_SYSITEMS "SysItems" -#define SZDDESYS_ITEM_RTNMSG "ReturnMessage" -#define SZDDESYS_ITEM_STATUS "Status" -#define SZDDESYS_ITEM_FORMATS "Formats" -#define SZDDESYS_ITEM_HELP "Help" -#define SZDDE_ITEM_ITEMLIST "TopicItemList" - - -/****** API entry points ******/ - -typedef HDDEDATA CALLBACK FNCALLBACK(USHORT wType, USHORT wFmt, HCONV hConv, - HSZ hsz1, HSZ hsz2, HDDEDATA hData, ULONG dwData1, ULONG dwData2); -typedef FNCALLBACK* PFNCALLBACK; - -#define CBR_BLOCK 0xffffffffL - -/* DLL registration functions */ - -USHORT DdeInitialize(ULONG* pidInst, PFNCALLBACK pfnCallback, - ULONG afCmd, ULONG ulRes); - -/* - * Callback filter flags for use with standard apps. - */ - -#define CBF_FAIL_SELFCONNECTIONS 0x00001000 -#define CBF_FAIL_CONNECTIONS 0x00002000 -#define CBF_FAIL_ADVISES 0x00004000 -#define CBF_FAIL_EXECUTES 0x00008000 -#define CBF_FAIL_POKES 0x00010000 -#define CBF_FAIL_REQUESTS 0x00020000 -#define CBF_FAIL_ALLSVRXACTIONS 0x0003f000 - -#define CBF_SKIP_CONNECT_CONFIRMS 0x00040000 -#define CBF_SKIP_REGISTRATIONS 0x00080000 -#define CBF_SKIP_UNREGISTRATIONS 0x00100000 -#define CBF_SKIP_DISCONNECTS 0x00200000 -#define CBF_SKIP_ALLNOTIFICATIONS 0x003c0000 - -/* - * Application command flags - */ -#define APPCMD_CLIENTONLY 0x00000010L -#define APPCMD_FILTERINITS 0x00000020L -#define APPCMD_MASK 0x00000FF0L - -/* - * Application classification flags - */ -#define APPCLASS_STANDARD 0x00000000L -#define APPCLASS_MASK 0x0000000FL - - -BOOL DdeUninitialize(ULONG idInst); - -/* conversation enumeration functions */ - -HCONVLIST DdeConnectList(ULONG idInst, HSZ hszService, HSZ hszTopic, - HCONVLIST hConvList, CONVCONTEXT* pCC); -HCONV DdeQueryNextServer(HCONVLIST hConvList, HCONV hConvPrev); -BOOL DdeDisconnectList(HCONVLIST hConvList); - -/* conversation control functions */ - -HCONV DdeConnect(ULONG idInst, HSZ hszService, HSZ hszTopic, - CONVCONTEXT* pCC); -BOOL DdeDisconnect(HCONV hConv); -HCONV DdeReconnect(HCONV hConv); - -USHORT DdeQueryConvInfo(HCONV hConv, ULONG idTransaction, CONVINFO* pConvInfo); -BOOL DdeSetUserHandle(HCONV hConv, ULONG id, ULONG hUser); - -BOOL DdeAbandonTransaction(ULONG idInst, HCONV hConv, ULONG idTransaction); - - -/* app server interface functions */ - -BOOL DdePostAdvise(ULONG idInst, HSZ hszTopic, HSZ hszItem); -BOOL DdeEnableCallback(ULONG idInst, HCONV hConv, USHORT wCmd); - -#define EC_ENABLEALL 0 -#define EC_ENABLEONE ST_BLOCKNEXT -#define EC_DISABLE ST_BLOCKED -#define EC_QUERYWAITING 2 - -HDDEDATA DdeNameService(ULONG idInst, HSZ hsz1, HSZ hsz2, USHORT afCmd); - -#define DNS_REGISTER 0x0001 -#define DNS_UNREGISTER 0x0002 -#define DNS_FILTERON 0x0004 -#define DNS_FILTEROFF 0x0008 - -/* app client interface functions */ - -HDDEDATA DdeClientTransaction(void* pData, ULONG cbData, - HCONV hConv, HSZ hszItem, USHORT wFmt, USHORT wType, - ULONG dwTimeout, ULONG* pdwResult); - -/* data transfer functions */ - -HDDEDATA DdeCreateDataHandle(ULONG idInst, void* pSrc, ULONG cb, - ULONG cbOff, HSZ hszItem, USHORT wFmt, USHORT afCmd); -// HDDEDATA DdeAddData(HDDEDATA hData, void* pSrc, ULONG cb, ULONG cbOff); -ULONG DdeGetData(HDDEDATA hData, void* pDst, ULONG cbMax, ULONG cbOff); -BYTE* DdeAccessData(HDDEDATA hData, ULONG* pcbDataSize); -BOOL DdeUnaccessData(HDDEDATA hData); -BOOL DdeFreeDataHandle(HDDEDATA hData); - -#define HDATA_APPOWNED 0x0001 - -USHORT DdeGetLastError(ULONG idInst); - -#define DMLERR_NO_ERROR 0 /* must be 0 */ - -#define DMLERR_FIRST 0x4000 - -#define DMLERR_ADVACKTIMEOUT 0x4000 -#define DMLERR_BUSY 0x4001 -#define DMLERR_DATAACKTIMEOUT 0x4002 -#define DMLERR_DLL_NOT_INITIALIZED 0x4003 -#define DMLERR_DLL_USAGE 0x4004 -#define DMLERR_EXECACKTIMEOUT 0x4005 -#define DMLERR_INVALIDPARAMETER 0x4006 -#define DMLERR_LOW_MEMORY 0x4007 -#define DMLERR_MEMORY_ERROR 0x4008 -#define DMLERR_NOTPROCESSED 0x4009 -#define DMLERR_NO_CONV_ESTABLISHED 0x400a -#define DMLERR_POKEACKTIMEOUT 0x400b -#define DMLERR_POSTMSG_FAILED 0x400c -#define DMLERR_REENTRANCY 0x400d -#define DMLERR_SERVER_DIED 0x400e -#define DMLERR_SYS_ERROR 0x400f -#define DMLERR_UNADVACKTIMEOUT 0x4010 -#define DMLERR_UNFOUND_QUEUE_ID 0x4011 - -#define DMLERR_LAST 0x4011 - -HSZ DdeCreateStringHandle(ULONG idInst, PSZ pStr, int iCodePage); -ULONG DdeQueryString(ULONG idInst, HSZ hsz, PSZ pStr, ULONG cchMax, - int iCodePage); -BOOL DdeFreeStringHandle(ULONG idInst, HSZ hsz); -BOOL DdeKeepStringHandle(ULONG idInst, HSZ hsz); -int DdeCmpStringHandles(HSZ hsz1, HSZ hsz2); - - - -/* von OS/2 nicht unterstuetzte Win3.1 Clipboard-Formate */ - -#define CF_NOTSUPPORTED_BASE 0xff00 - -#ifndef CF_DIB -#define CF_DIB CF_NOTSUPPORTED_BASE+1 -#endif - -#ifndef CF_DIF -#define CF_DIF CF_NOTSUPPORTED_BASE+2 -#endif - -#ifndef CF_DSPMETAFILEPICT -#define CF_DSPMETAFILEPICT CF_NOTSUPPORTED_BASE+3 -#endif - -#ifndef CF_METAFILEPICT -#define CF_METAFILEPICT CF_NOTSUPPORTED_BASE+4 -#endif - -#ifndef CF_OEMTEXT -#define CF_OEMTEXT CF_NOTSUPPORTED_BASE+5 -#endif - -#ifndef CF_OWNERDISPLAY -#define CF_OWNERDISPLAY CF_NOTSUPPORTED_BASE+6 -#endif - -#ifndef CF_PENDATA -#define CF_PENDATA CF_NOTSUPPORTED_BASE+7 -#endif - -#ifndef CF_RIFF -#define CF_RIFF CF_NOTSUPPORTED_BASE+8 -#endif - -#ifndef CF_SYLK -#define CF_SYLK CF_NOTSUPPORTED_BASE+9 -#endif - -#ifndef CF_TIFF -#define CF_TIFF CF_NOTSUPPORTED_BASE+10 -#endif - -#ifndef CF_WAVE -#define CF_WAVE CF_NOTSUPPORTED_BASE+11 -#endif - - -#endif /* _DDEML_HXX */ diff --git a/svtools/source/svdde/ddestrg.cxx b/svtools/source/svdde/ddestrg.cxx deleted file mode 100644 index 40af3b1cbc27..000000000000 --- a/svtools/source/svdde/ddestrg.cxx +++ /dev/null @@ -1,81 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ddestrg.cxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#define UNICODE - -#include "ddeimp.hxx" -#include - -#if defined( WIN ) && defined( MSC ) -#pragma code_seg( "SVDDE_MISC_CODE" ) -#endif - -// --- DdeString::DdeString() -------------------------------------- - -DdeString::DdeString( DWORD hDdeInst, const sal_Unicode* p ) : - String( p ) -{ - hString = DdeCreateStringHandle( hDdeInst, (LPTSTR)p, CP_WINUNICODE ); - hInst = hDdeInst; -} - -// --- DdeString::DdeString() -------------------------------------- - -DdeString::DdeString( DWORD hDdeInst, const String& r) : - String( r ) -{ - hString = DdeCreateStringHandle( hDdeInst, (LPTSTR)r.GetBuffer(), CP_WINUNICODE ); - hInst = hDdeInst; -} - -// --- DdeString::~DdeString() ------------------------------------- - -DdeString::~DdeString() -{ - if ( hString ) - DdeFreeStringHandle( hInst, hString ); -} - -// --- DdeString::operator==() ------------------------------------- - -int DdeString::operator==( HSZ h ) -{ - return( !DdeCmpStringHandles( hString, h ) ); -} - -// --- DdeString::operator HSZ() ----------------------------------- - -DdeString::operator HSZ() -{ - return hString; -} diff --git a/svtools/source/svdde/ddesvr.cxx b/svtools/source/svdde/ddesvr.cxx deleted file mode 100644 index a2124548b4c8..000000000000 --- a/svtools/source/svdde/ddesvr.cxx +++ /dev/null @@ -1,1107 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ddesvr.cxx,v $ - * $Revision: 1.11 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#define UNICODE -#include "ddeimp.hxx" -#include -#include -#include -#include - -//static long hCurConv = 0; -//static DWORD hDdeInst = NULL; -//static short nInstance = 0; -//static DdeServices* pServices; - -enum DdeItemType -{ - DDEITEM, - DDEGETPUTITEM -}; - -struct DdeItemImpData -{ - ULONG nHCnv; - USHORT nCnt; - - DdeItemImpData( ULONG nH ) : nHCnv( nH ), nCnt( 1 ) {} -}; - -SV_DECL_VARARR( DdeItemImp, DdeItemImpData, 1, 1 ) -SV_IMPL_VARARR( DdeItemImp, DdeItemImpData ) - -// --- DdeInternat::SvrCallback() ---------------------------------- - -#ifdef WNT -HDDEDATA CALLBACK DdeInternal::SvrCallback( - WORD nCode, WORD nCbType, HCONV hConv, HSZ hText1, HSZ hText2, - HDDEDATA hData, DWORD, DWORD ) -#else -#if defined ( MTW ) || ( defined ( GCC ) && defined ( OS2 )) || defined( ICC ) -HDDEDATA CALLBACK __EXPORT DdeInternal::SvrCallback( - WORD nCode, WORD nCbType, HCONV hConv, HSZ hText1, HSZ hText2, - HDDEDATA hData, DWORD, DWORD ) -#else -HDDEDATA CALLBACK _export DdeInternal::SvrCallback( - WORD nCode, WORD nCbType, HCONV hConv, HSZ hText1, HSZ hText2, - HDDEDATA hData, DWORD, DWORD ) -#endif -#endif -{ - DdeServices& rAll = DdeService::GetServices(); - DdeService* pService; - DdeTopic* pTopic; - DdeItem* pItem; - DdeData* pData; - Conversation* pC; - - DdeInstData* pInst = ImpGetInstData(); - DBG_ASSERT(pInst,"SVDDE:No instance data"); - - switch( nCode ) - { - case XTYP_WILDCONNECT: - { - int nTopics = 0; - -#if 1 - TCHAR chTopicBuf[250]; - if( hText1 ) - DdeQueryString( pInst->hDdeInstSvr, hText1, chTopicBuf, - sizeof(chTopicBuf)/sizeof(TCHAR), CP_WINUNICODE ); - - for( pService = rAll.First();pService;pService = rAll.Next() ) - { - if ( !hText2 || ( *pService->pName == hText2 ) ) - { - String sTopics( pService->Topics() ); - if( sTopics.Len() ) - { - if( hText1 ) - { - USHORT n = 0; - while( STRING_NOTFOUND != n ) - { - String s( sTopics.GetToken( 0, '\t', n )); - if( s == reinterpret_cast(chTopicBuf) ) - ++nTopics; - } - } - else - nTopics += sTopics.GetTokenCount( '\t' ); - } - } - } - -#else - for( pService = rAll.First();pService;pService = rAll.Next() ) - { - if ( !hText2 || ( *pService->pName == hText2 ) ) - { - for( pTopic = pService->aTopics.First(); pTopic; - pTopic = pService->aTopics.Next() ) - { - if ( !hText1 || (*pTopic->pName == hText1) ) - nTopics++; - } - } - } -#endif - if( !nTopics ) - return (HDDEDATA)NULL; - - HSZPAIR* pPairs = new HSZPAIR [nTopics + 1]; - if ( !pPairs ) - return (HDDEDATA)NULL; - - HSZPAIR* q = pPairs; - for( pService = rAll.First(); pService; pService = rAll.Next() ) - { - if ( !hText2 || (*pService->pName == hText2 ) ) - { -#if 0 - for ( pTopic = pService->aTopics.First(); pTopic; - pTopic = pService->aTopics.Next() ) - { - if ( !hText1 || (*pTopic->pName == hText1) ) - { - q->hszSvc = *pService->pName; - q->hszTopic = *pTopic->pName; - q++; - } - } -#else - String sTopics( pService->Topics() ); - USHORT n = 0; - while( STRING_NOTFOUND != n ) - { - String s( sTopics.GetToken( 0, '\t', n )); - s.EraseAllChars( '\n' ).EraseAllChars( '\r' ); - if( !hText1 || s == reinterpret_cast(chTopicBuf) ) - { - DdeString aDStr( pInst->hDdeInstSvr, s ); - pTopic = FindTopic( *pService, (HSZ)aDStr ); - if( pTopic ) - { - q->hszSvc = *pService->pName; - q->hszTopic = *pTopic->pName; - q++; - } - } - } - -#endif - } - } - - q->hszSvc = NULL; - q->hszTopic = NULL; - HDDEDATA h = DdeCreateDataHandle( - pInst->hDdeInstSvr, (LPBYTE) pPairs, - sizeof(HSZPAIR) * (nTopics+1), - 0, NULL, nCbType, 0); - delete pPairs; - return h; - } - - case XTYP_CONNECT: - pService = FindService( hText2 ); - if ( pService) - pTopic = FindTopic( *pService, hText1 ); - else - pTopic = NULL; - if ( pTopic ) - return (HDDEDATA)DDE_FACK; - else - return (HDDEDATA) NULL; - - case XTYP_CONNECT_CONFIRM: - pService = FindService( hText2 ); - if ( pService ) - { - pTopic = FindTopic( *pService, hText1 ); - if ( pTopic ) - { - pTopic->Connect( (long) hConv ); - pC = new Conversation; - pC->hConv = hConv; - pC->pTopic = pTopic; - pService->pConv->Insert( pC ); - } - } - return (HDDEDATA)NULL; - } - - for ( pService = rAll.First(); pService; pService = rAll.Next() ) - { - for( pC = pService->pConv->First(); pC; - pC = pService->pConv->Next() ) - { - if ( pC->hConv == hConv ) - goto found; - } - } - - return (HDDEDATA) DDE_FNOTPROCESSED; - -found: - if ( nCode == XTYP_DISCONNECT) - { - pC->pTopic->_Disconnect( (long) hConv ); - pService->pConv->Remove( pC ); - delete pC; - return (HDDEDATA)NULL; - } - - BOOL bExec = BOOL(nCode == XTYP_EXECUTE); - pTopic = pC->pTopic; - if ( pTopic && !bExec ) - pItem = FindItem( *pTopic, hText2 ); - else - pItem = NULL; - - if ( !bExec && !pService->HasCbFormat( nCbType ) ) - pItem = NULL; - if ( !pItem && !bExec ) - return (HDDEDATA)DDE_FNOTPROCESSED; - if ( pItem ) - pTopic->aItem = pItem->GetName(); - else - pTopic->aItem.Erase(); - - BOOL bRes = FALSE; - pInst->hCurConvSvr = (long)hConv; - switch( nCode ) - { - case XTYP_REQUEST: - case XTYP_ADVREQ: - { - String aRes; // darf erst am Ende freigegeben werden!! - if ( pTopic->IsSystemTopic() ) - { - if ( pTopic->aItem == reinterpret_cast(SZDDESYS_ITEM_TOPICS) ) - aRes = pService->Topics(); - else if ( pTopic->aItem == reinterpret_cast(SZDDESYS_ITEM_SYSITEMS) ) - aRes = pService->SysItems(); - else if ( pTopic->aItem == reinterpret_cast(SZDDESYS_ITEM_STATUS) ) - aRes = pService->Status(); - else if ( pTopic->aItem == reinterpret_cast(SZDDESYS_ITEM_FORMATS) ) - aRes = pService->Formats(); - else if ( pTopic->aItem == reinterpret_cast(SZDDESYS_ITEM_HELP) ) - aRes = pService->GetHelp(); - else - aRes = pService->SysTopicGet( pTopic->aItem ); - - if ( aRes.Len() ) - pData = new DdeData( aRes ); - else - pData = NULL; - } - else if( DDEGETPUTITEM == pItem->nType ) - pData = ((DdeGetPutItem*)pItem)->Get( - DdeData::GetInternalFormat( nCbType ) ); - else - pData = pTopic->Get( DdeData::GetInternalFormat( nCbType )); - - if ( pData ) - return DdeCreateDataHandle( pInst->hDdeInstSvr, - (LPBYTE)pData->pImp->pData, - pData->pImp->nData, - 0, hText2, - DdeData::GetExternalFormat( - pData->pImp->nFmt ), - 0 ); - } - break; - - case XTYP_POKE: - if ( !pTopic->IsSystemTopic() ) - { - DdeData d; - d.pImp->hData = hData; - d.pImp->nFmt = DdeData::GetInternalFormat( nCbType ); - d.Lock(); - if( DDEGETPUTITEM == pItem->nType ) - bRes = ((DdeGetPutItem*)pItem)->Put( &d ); - else - bRes = pTopic->Put( &d ); - } - pInst->hCurConvSvr = NULL; - if ( bRes ) - return (HDDEDATA)DDE_FACK; - else - return (HDDEDATA) DDE_FNOTPROCESSED; - - case XTYP_ADVSTART: - { - // wird das Item zum erstenmal ein HotLink ? - if( !pItem->pImpData && pTopic->StartAdviseLoop() ) - { - // dann wurde das Item ausgewechselt - pTopic->aItems.Remove( pItem ); - DdeItem* pTmp; - for( pTmp = pTopic->aItems.First(); pTmp; - pTmp = pTopic->aItems.Next() ) - if( *pTmp->pName == hText2 ) - { - // es wurde tatsaechlich ausgewechselt - delete pItem; - pItem = 0; - break; - } - if( pItem ) - // es wurde doch nicht ausgewechselt, also wieder rein - pTopic->aItems.Insert( pItem ); - else - pItem = pTmp; - } - pItem->IncMonitor( (long)hConv ); - pInst->hCurConvSvr = NULL; - } - return (HDDEDATA)TRUE; - - case XTYP_ADVSTOP: - pItem->DecMonitor( (long)hConv ); - if( !pItem->pImpData ) - pTopic->StopAdviseLoop(); - pInst->hCurConvSvr = NULL; - return (HDDEDATA)TRUE; - - case XTYP_EXECUTE: - { - DdeData aExec; - aExec.pImp->hData = hData; - aExec.pImp->nFmt = DdeData::GetInternalFormat( nCbType ); - aExec.Lock(); - String aName; - - aName = (const sal_Unicode *)aExec.pImp->pData; - - if( pTopic->IsSystemTopic() ) - bRes = pService->SysTopicExecute( &aName ); - else - bRes = pTopic->Execute( &aName ); - } - pInst->hCurConvSvr = NULL; - if ( bRes ) - return (HDDEDATA)DDE_FACK; - else - return (HDDEDATA)DDE_FNOTPROCESSED; - } - - return (HDDEDATA)NULL; -} - -// --- DdeInternat::FindService() ---------------------------------- - -DdeService* DdeInternal::FindService( HSZ hService ) -{ - DdeService* s; - DdeServices& rSvc = DdeService::GetServices(); - for ( s = rSvc.First(); s; s = rSvc.Next() ) - { - if ( *s->pName == hService ) - return s; - } - - return NULL; -} - -// --- DdeInternat::FindTopic() ------------------------------------ - -DdeTopic* DdeInternal::FindTopic( DdeService& rService, HSZ hTopic ) -{ - DdeTopic* s; - DdeTopics& rTopics = rService.aTopics; - int bWeiter = FALSE; - DdeInstData* pInst = ImpGetInstData(); - DBG_ASSERT(pInst,"SVDDE:No instance data"); - - do { // middle check loop - for ( s = rTopics.First(); s; s = rTopics.Next() ) - { - if ( *s->pName == hTopic ) - return s; - } - - bWeiter = !bWeiter; - if( !bWeiter ) - break; - - // dann befragen wir doch mal unsere Ableitung: - TCHAR chBuf[250]; - DdeQueryString(pInst->hDdeInstSvr,hTopic,chBuf,sizeof(chBuf)/sizeof(TCHAR),CP_WINUNICODE ); - bWeiter = rService.MakeTopic( reinterpret_cast(chBuf) ); - // dann muessen wir noch mal suchen - } while( bWeiter ); - - return 0; -} - -// --- DdeInternal::FindItem() ------------------------------------- - -DdeItem* DdeInternal::FindItem( DdeTopic& rTopic, HSZ hItem ) -{ - DdeItem* s; - DdeItems& rItems = rTopic.aItems; - DdeInstData* pInst = ImpGetInstData(); - DBG_ASSERT(pInst,"SVDDE:No instance data"); - int bWeiter = FALSE; - - do { // middle check loop - - for ( s = rItems.First(); s; s = rItems.Next() ) - if ( *s->pName == hItem ) - return s; - - bWeiter = !bWeiter; - if( !bWeiter ) - break; - - // dann befragen wir doch mal unsere Ableitung: - TCHAR chBuf[250]; - DdeQueryString(pInst->hDdeInstSvr,hItem,chBuf,sizeof(chBuf)/sizeof(TCHAR),CP_WINUNICODE ); - bWeiter = rTopic.MakeItem( reinterpret_cast(chBuf) ); - // dann muessen wir noch mal suchen - } while( bWeiter ); - - return 0; -} - -// --- DdeService::DdeService() ------------------------------------ - -DdeService::DdeService( const String& rService ) -{ - DdeInstData* pInst = ImpGetInstData(); - if( !pInst ) - pInst = ImpInitInstData(); - pInst->nRefCount++; - pInst->nInstanceSvr++; - - if ( !pInst->hDdeInstSvr ) - { - nStatus = sal::static_int_cast< short >( - DdeInitialize( &pInst->hDdeInstSvr, - (PFNCALLBACK)DdeInternal::SvrCallback, - APPCLASS_STANDARD | - CBF_SKIP_REGISTRATIONS | - CBF_SKIP_UNREGISTRATIONS, 0L ) ); - pInst->pServicesSvr = new DdeServices; - } - else - nStatus = DMLERR_NO_ERROR; - - pConv = new ConvList; - - if ( pInst->pServicesSvr ) - pInst->pServicesSvr->Insert( this ); - - pName = new DdeString( pInst->hDdeInstSvr, rService ); - if ( nStatus == DMLERR_NO_ERROR ) - if ( !DdeNameService( pInst->hDdeInstSvr, *pName, NULL, - DNS_REGISTER | DNS_FILTEROFF ) ) - nStatus = DMLERR_SYS_ERROR; - - AddFormat( FORMAT_STRING ); - pSysTopic = new DdeTopic( reinterpret_cast(SZDDESYS_TOPIC) ); - pSysTopic->AddItem( DdeItem( reinterpret_cast(SZDDESYS_ITEM_TOPICS) ) ); - pSysTopic->AddItem( DdeItem( reinterpret_cast(SZDDESYS_ITEM_SYSITEMS) ) ); - pSysTopic->AddItem( DdeItem( reinterpret_cast(SZDDESYS_ITEM_STATUS) ) ); - pSysTopic->AddItem( DdeItem( reinterpret_cast(SZDDESYS_ITEM_FORMATS) ) ); - pSysTopic->AddItem( DdeItem( reinterpret_cast(SZDDESYS_ITEM_HELP) ) ); - AddTopic( *pSysTopic ); -} - -// --- DdeService::~DdeService() ----------------------------------- - -DdeService::~DdeService() -{ - DdeInstData* pInst = ImpGetInstData(); - DBG_ASSERT(pInst,"SVDDE:No instance data"); - if ( pInst->pServicesSvr ) - pInst->pServicesSvr->Remove( this ); - - // MT: Im Auftrage des Herrn (AM) auskommentiert... - // Grund: - // Bei Client/Server werden die Server nicht beendet, wenn mehr - // als einer gestartet. - // Weil keine System-Messagequeue ?! - - delete pSysTopic; - delete pName; - - pInst->nInstanceSvr--; - pInst->nRefCount--; - if ( !pInst->nInstanceSvr && pInst->hDdeInstSvr ) - { - if( DdeUninitialize( pInst->hDdeInstSvr ) ) - { - pInst->hDdeInstSvr = NULL; - delete pInst->pServicesSvr; - pInst->pServicesSvr = NULL; - if( pInst->nRefCount == 0) - ImpDeinitInstData(); - } - } - delete pConv; -} - -// --- DdeService::GetName() --------------------------------------- - -const String& DdeService::GetName() const -{ - return *pName; -} - -// --- DdeService::GetServices() ----------------------------------- - -DdeServices& DdeService::GetServices() -{ - DdeInstData* pInst = ImpGetInstData(); - DBG_ASSERT(pInst,"SVDDE:No instance data"); - return *(pInst->pServicesSvr); -} - -// --- DdeService::AddTopic() -------------------------------------- - -void DdeService::AddTopic( const DdeTopic& rTopic ) -{ - RemoveTopic( rTopic ); - aTopics.Insert( (DdeTopic*) &rTopic ); -} - -// --- DdeService::RemoveTopic() ----------------------------------- - -void DdeService::RemoveTopic( const DdeTopic& rTopic ) -{ - DdeTopic* t; - for ( t = aTopics.First(); t; t = aTopics.Next() ) - { - if ( !DdeCmpStringHandles (*t->pName, *rTopic.pName ) ) - { - aTopics.Remove( t ); - // JP 27.07.95: und alle Conversions loeschen !!! - // (sonst wird auf geloeschten Topics gearbeitet!!) - for( ULONG n = pConv->Count(); n; ) - { - Conversation* pC = pConv->GetObject( --n ); - if( pC->pTopic == &rTopic ) - { - pConv->Remove( pC ); - delete pC; - } - } - break; - } - } -} - -// --- DdeService::HasCbFormat() ----------------------------------- - -BOOL DdeService::HasCbFormat( USHORT nFmt ) -{ - return BOOL( aFormats.GetPos( nFmt ) != LIST_ENTRY_NOTFOUND ); -} - -// --- DdeService::HasFormat() ------------------------------------- - -BOOL DdeService::HasFormat( ULONG nFmt ) -{ - return HasCbFormat( (USHORT)DdeData::GetExternalFormat( nFmt )); -} - -// --- DdeService::AddFormat() ------------------------------------- - -void DdeService::AddFormat( ULONG nFmt ) -{ - nFmt = DdeData::GetExternalFormat( nFmt ); - aFormats.Remove( nFmt ); - aFormats.Insert( nFmt ); -} - -// --- DdeService::RemoveFormat() ---------------------------------- - -void DdeService::RemoveFormat( ULONG nFmt ) -{ - aFormats.Remove( DdeData::GetExternalFormat( nFmt ) ); -} - -// --- DdeTopic::DdeTopic() ---------------------------------------- - -DdeTopic::DdeTopic( const String& rName ) -{ - DdeInstData* pInst = ImpGetInstData(); - DBG_ASSERT(pInst,"SVDDE:No instance data"); - pName = new DdeString( pInst->hDdeInstSvr, rName ); -} - -// --- DdeTopic::~DdeTopic() --------------------------------------- - -DdeTopic::~DdeTopic() -{ - DdeItem* t; - while( ( t = aItems.First() ) != NULL ) - { - aItems.Remove( t ); - t->pMyTopic = 0; - delete t; - } - delete pName; -} - -// --- DdeTopic::GetName() ----------------------------------------- - -const String& DdeTopic::GetName() const -{ - return *pName; -} - -// --- DdeTopic::IsSystemTopic() ----------------------------------- - -BOOL DdeTopic::IsSystemTopic() -{ - return BOOL (GetName() == reinterpret_cast(SZDDESYS_TOPIC)); -} - -// --- DdeTopic::AddItem() ----------------------------------------- - -DdeItem* DdeTopic::AddItem( const DdeItem& r ) -{ - DdeItem* s; - if( DDEGETPUTITEM == r.nType ) - s = new DdeGetPutItem( r ); - else - s = new DdeItem( r ); - if ( s ) - { - aItems.Insert( s ); - s->pMyTopic = this; - } - return s; -} - -// --- DdeTopic::InsertItem() ----------------------------------------- - -void DdeTopic::InsertItem( DdeItem* pNew ) -{ - if( pNew ) - { - aItems.Insert( pNew ); - pNew->pMyTopic = this; - } -} - -// --- DdeTopic::RemoveItem() -------------------------------------- - -void DdeTopic::RemoveItem( const DdeItem& r ) -{ - DdeItem* s; - for ( s = aItems.First(); s; s = aItems.Next() ) - { - if ( !DdeCmpStringHandles (*s->pName, *r.pName ) ) - break; - } - - if ( s ) - { - aItems.Remove( s ); - s->pMyTopic = 0; - delete s; - } -} - -// --- DdeTopic::NotifyClient() ------------------------------------ - -void DdeTopic::NotifyClient( const String& rItem ) -{ - DdeItem* pItem; - DdeInstData* pInst = ImpGetInstData(); - DBG_ASSERT(pInst,"SVDDE:No instance data"); - for ( pItem = aItems.First(); pItem; pItem = aItems.Next() ) - { - if ( pItem->GetName() == rItem ) - { - if ( pItem->pImpData ) - DdePostAdvise( pInst->hDdeInstSvr, *pName, *pItem->pName ); - } - break; - } -} - -// --- DdeTopic::Connect() ----------------------------------------- - -void __EXPORT DdeTopic::Connect( long nId ) -{ - aConnectLink.Call( (void*)nId ); -} - -// --- DdeTopic::Disconnect() -------------------------------------- - -void __EXPORT DdeTopic::Disconnect( long nId ) -{ - aDisconnectLink.Call( (void*)nId ); -} - -// --- DdeTopic::_Disconnect() -------------------------------------- - -void __EXPORT DdeTopic::_Disconnect( long nId ) -{ - for( DdeItem* pItem = aItems.First(); pItem; pItem = aItems.Next() ) - pItem->DecMonitor( nId ); - - Disconnect( nId ); -} - -// --- DdeTopic::Get() --------------------------------------------- - -DdeData* __EXPORT DdeTopic::Get( ULONG nFmt ) -{ - if ( aGetLink.IsSet() ) - return (DdeData*)aGetLink.Call( (void*)nFmt ); - else - return NULL; -} - -// --- DdeTopic::Put() --------------------------------------------- - -BOOL __EXPORT DdeTopic::Put( const DdeData* r ) -{ - if ( aPutLink.IsSet() ) - return (BOOL)aPutLink.Call( (void*) r ); - else - return FALSE; -} - -// --- DdeTopic::Execute() ----------------------------------------- - -BOOL __EXPORT DdeTopic::Execute( const String* r ) -{ - if ( aExecLink.IsSet() ) - return (BOOL)aExecLink.Call( (void*)r ); - else - return FALSE; -} - -// --- DdeTopic::GetConvId() --------------------------------------- - -long DdeTopic::GetConvId() -{ - DdeInstData* pInst = ImpGetInstData(); - DBG_ASSERT(pInst,"SVDDE:No instance data"); - return pInst->hCurConvSvr; -} - -// --- DdeTopic::StartAdviseLoop() --------------------------------- - -BOOL DdeTopic::StartAdviseLoop() -{ - return FALSE; -} - -// --- DdeTopic::StopAdviseLoop() ---------------------------------- - -BOOL DdeTopic::StopAdviseLoop() -{ - return FALSE; -} - -// --- DdeItem::DdeItem() ------------------------------------------ - -DdeItem::DdeItem( const sal_Unicode* p ) -{ - DdeInstData* pInst = ImpGetInstData(); - DBG_ASSERT(pInst,"SVDDE:No instance data"); - pName = new DdeString( pInst->hDdeInstSvr, p ); - nType = DDEITEM; - pMyTopic = 0; - pImpData = 0; -} - -// --- DdeItem::DdeItem() ------------------------------------------ - -DdeItem::DdeItem( const String& r) -{ - DdeInstData* pInst = ImpGetInstData(); - DBG_ASSERT(pInst,"SVDDE:No instance data"); - pName = new DdeString( pInst->hDdeInstSvr, r ); - nType = DDEITEM; - pMyTopic = 0; - pImpData = 0; -} - -// --- DdeItem::DdeItem() ------------------------------------------ - -DdeItem::DdeItem( const DdeItem& r) -{ - DdeInstData* pInst = ImpGetInstData(); - DBG_ASSERT(pInst,"SVDDE:No instance data"); - pName = new DdeString( pInst->hDdeInstSvr, *r.pName ); - nType = DDEITEM; - pMyTopic = 0; - pImpData = 0; -} - -// --- DdeItem::~DdeItem() ----------------------------------------- - -DdeItem::~DdeItem() -{ - if( pMyTopic ) - pMyTopic->aItems.Remove( this ); - delete pName; - delete pImpData; -} - -// --- DdeItem::GetName() ------------------------------------------ - -const String& DdeItem::GetName() const -{ - return *pName; -} - -// --- DdeItem::NotifyClient() ------------------------------------------ - -void DdeItem::NotifyClient() -{ - if( pMyTopic && pImpData ) - { - DdeInstData* pInst = ImpGetInstData(); - DBG_ASSERT(pInst,"SVDDE:No instance data"); - DdePostAdvise( pInst->hDdeInstSvr, *pMyTopic->pName, *pName ); - } -} - -// --- DdeItem::IncMonitor() ------------------------------------------ - -void DdeItem::IncMonitor( ULONG nHCnv ) -{ - if( !pImpData ) - { - pImpData = new DdeItemImp; - if( DDEGETPUTITEM == nType ) - ((DdeGetPutItem*)this)->AdviseLoop( TRUE ); - } - else - { - for( USHORT n = pImpData->Count(); n; ) - if( (*pImpData)[ --n ].nHCnv == nHCnv ) - { - ++(*pImpData)[ n ].nHCnv; - return ; - } - } - - pImpData->Insert( DdeItemImpData( nHCnv ), pImpData->Count() ); -} - -// --- DdeItem::DecMonitor() ------------------------------------------ - -void DdeItem::DecMonitor( ULONG nHCnv ) -{ - if( pImpData ) - { - DdeItemImpData* pData = (DdeItemImpData*)pImpData->GetData(); - for( USHORT n = pImpData->Count(); n; --n, ++pData ) - if( pData->nHCnv == nHCnv ) - { - if( !pData->nCnt || !--pData->nCnt ) - { - if( 1 < pImpData->Count() ) - pImpData->Remove( pImpData->Count() - n ); - else - { - delete pImpData, pImpData = 0; - if( DDEGETPUTITEM == nType ) - ((DdeGetPutItem*)this)->AdviseLoop( FALSE ); - } - } - return ; - } - } -} - -// --- DdeItem::GetLinks() ------------------------------------------ - -short DdeItem::GetLinks() -{ - short nCnt = 0; - if( pImpData ) - for( USHORT n = pImpData->Count(); n; ) - nCnt = nCnt + (*pImpData)[ --n ].nCnt; - return nCnt; -} - -// --- DdeGetPutItem::DdeGetPutItem() ------------------------------ - -DdeGetPutItem::DdeGetPutItem( const sal_Unicode* p ) - : DdeItem( p ) -{ - nType = DDEGETPUTITEM; -} - -// --- DdeGetPutItem::DdeGetPutItem() ------------------------------ - -DdeGetPutItem::DdeGetPutItem( const String& rStr ) - : DdeItem( rStr ) -{ - nType = DDEGETPUTITEM; -} - -// --- DdeGetPutItem::DdeGetPutItem() ------------------------------ - -DdeGetPutItem::DdeGetPutItem( const DdeItem& rItem ) - : DdeItem( rItem ) -{ - nType = DDEGETPUTITEM; -} - - -// --- DdeGetPutData::Get() ---------------------------------------- - -DdeData* DdeGetPutItem::Get( ULONG ) -{ - return 0; -} - -// --- DdeGetPutData::Put() ---------------------------------------- - -BOOL DdeGetPutItem::Put( const DdeData* ) -{ - return FALSE; -} - -// --- DdeGetPutData::AdviseLoop() --------------------------------- - -void DdeGetPutItem::AdviseLoop( BOOL ) -{ -} - - -// --- DdeService::SysItems() -------------------------------------- - -String DdeService::SysItems() -{ - String s; - DdeTopic* t; - for ( t = aTopics.First(); t; t = aTopics.Next() ) - { - if ( t->GetName() == reinterpret_cast(SZDDESYS_TOPIC) ) - { - short n = 0; - DdeItem* pi; - for ( pi = t->aItems.First(); pi; pi = t->aItems.Next(), n++ ) - { - if ( n ) - s += '\t'; - s += pi->GetName(); - } - s += String::CreateFromAscii("\r\n"); - } - } - - return s; -} - -// --- DdeService::Topics() ---------------------------------------- - -String DdeService::Topics() -{ - String s; - DdeTopic* t; - short n = 0; - - for ( t = aTopics.First(); t; t = aTopics.Next(), n++ ) - { - if ( n ) - s += '\t'; - s += t->GetName(); - } - s += String::CreateFromAscii("\r\n"); - - return s; -} - -// --- DdeService::Formats() --------------------------------------- - -String DdeService::Formats() -{ - String s; - long f; - TCHAR buf[128]; - LPCTSTR p; - short n = 0; - - for ( f = aFormats.First(); f; f = aFormats.Next(), n++ ) - { - if ( n ) - s += '\t'; - p = buf; - - switch( (USHORT)f ) - { - case CF_TEXT: - p = reinterpret_cast(String::CreateFromAscii("TEXT").GetBuffer()); - break; - case CF_BITMAP: - p = reinterpret_cast(String::CreateFromAscii("BITMAP").GetBuffer()); - break; -#ifdef OS2 - case CF_DSPTEXT: - p = String::CreateFromAscii("TEXT").GetBuffer(); - break; - case CF_DSPBITMAP: - p = String::CreateFromAscii("BITMAP").GetBuffer(); - break; - case CF_METAFILE: - p = String::CreateFromAscii("METAFILE").GetBuffer(); - break; - case CF_DSPMETAFILE: - p = String::CreateFromAscii("METAFILE").GetBuffer(); - break; - case CF_PALETTE: - p = String::CreateFromAscii("PALETTE").GetBuffer(); - break; - default: - p= String::CreateFromAscii("PRIVATE").GetBuffer(); -#else - default: - GetClipboardFormatName( (UINT)f, buf, sizeof(buf) / sizeof(TCHAR) ); -#endif - } - s += String( reinterpret_cast(p) ); - } - s += String::CreateFromAscii("\r\n"); - - return s; -} - -// --- DdeService::Status() ---------------------------------------- - -String DdeService::Status() -{ - return IsBusy() ? String::CreateFromAscii("Busy\r\n") : String::CreateFromAscii("Ready\r\n"); -} - -// --- DdeService::IsBusy() ---------------------------------------- - -BOOL __EXPORT DdeService::IsBusy() -{ - return FALSE; -} - -// --- DdeService::GetHelp() ---------------------------------------- - -String __EXPORT DdeService::GetHelp() -{ - return String(); -} - -BOOL DdeTopic::MakeItem( const String& ) -{ - return FALSE; -} - -BOOL DdeService::MakeTopic( const String& ) -{ - return FALSE; -} - -String DdeService::SysTopicGet( const String& ) -{ - return String(); -} - -BOOL DdeService::SysTopicExecute( const String* ) -{ - return FALSE; -} - diff --git a/svtools/source/svdde/ddewrap.cxx b/svtools/source/svdde/ddewrap.cxx deleted file mode 100644 index b0b023ad3a75..000000000000 --- a/svtools/source/svdde/ddewrap.cxx +++ /dev/null @@ -1,103 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ddewrap.cxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#define _SVTOOLS_SVDDE_DDEWRAP_CXX_ - -#if defined _MSC_VER -#pragma warning(push, 1) -#endif -#include -#if defined _MSC_VER -#pragma warning(pop) -#endif -#include "ddewrap.hxx" - -//------------------------------------------------------------------------ - -HSZ WINAPI DdeCreateStringHandleW_9x( DWORD idInst, LPCWSTR pszString, int ) -{ - HSZ hszResult; - LPSTR pszANSIString; - int nSize; - - nSize = pszString ? WideCharToMultiByte( CP_ACP, 0, pszString, -1, NULL, 0, NULL, NULL ) : 0; - pszANSIString = nSize ? (LPSTR)HeapAlloc( GetProcessHeap(), 0, nSize * sizeof(CHAR) ) : NULL; - - if ( pszANSIString ) - WideCharToMultiByte( CP_ACP, 0, pszString, -1, pszANSIString, nSize, NULL, NULL ); - - hszResult = DdeCreateStringHandleA( idInst, pszANSIString, CP_WINANSI ); - - if ( pszANSIString ) - HeapFree( GetProcessHeap(), 0, pszANSIString ); - - return hszResult; -} - -//------------------------------------------------------------------------ - -DWORD WINAPI DdeQueryStringW_9x( DWORD idInst, HSZ hsz, LPWSTR pszString, DWORD cchMax, int ) -{ - DWORD dwResult; - LPSTR pszANSIString; - - pszANSIString = cchMax ? (LPSTR)HeapAlloc( GetProcessHeap(), 0, cchMax * sizeof(CHAR) ) : NULL; - - dwResult = DdeQueryStringA( idInst, hsz, pszANSIString, cchMax, CP_WINANSI ); - - if ( dwResult && pszANSIString ) - MultiByteToWideChar( CP_ACP, 0, pszANSIString, -1, pszString, cchMax ); - - if ( pszANSIString ) - HeapFree( GetProcessHeap(), 0, pszANSIString ); - - return dwResult; -} - -//------------------------------------------------------------------------ - -UINT WINAPI DdeInitializeW_9x( LPDWORD pidInst, PFNCALLBACK pfnCallback, DWORD afCmd, DWORD ulRes ) -{ - return DdeInitializeA( pidInst, pfnCallback, afCmd, ulRes ); -} - -//------------------------------------------------------------------------ - -#define DEFINE_WAPI_FUNC(func) \ -func##_PROC lpfn##func = (LONG)GetVersion() >= 0 ? func : func##_9x; - - -DEFINE_WAPI_FUNC( DdeCreateStringHandleW ); -DEFINE_WAPI_FUNC( DdeQueryStringW ); -DEFINE_WAPI_FUNC( DdeInitializeW ); - diff --git a/svtools/source/svdde/ddewrap.hxx b/svtools/source/svdde/ddewrap.hxx deleted file mode 100644 index 77d012ccbba5..000000000000 --- a/svtools/source/svdde/ddewrap.hxx +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef _SVTOOLS_SVDDE_DDEWRAP_HXX_ -#define _SVTOOLS_SVDDE_DDEWRAP_HXX_ - -#define DECLARE_WAPI_FUNC(func) \ - extern func##_PROC lpfn##func; - -typedef HSZ (WINAPI *DdeCreateStringHandleW_PROC)( DWORD idInst, LPCWSTR pszString, int iCodePage ); -typedef DWORD (WINAPI *DdeQueryStringW_PROC)( DWORD idInst, HSZ hsz, LPWSTR pszString, DWORD cchMax, int iCodePage ); -typedef UINT (WINAPI *DdeInitializeW_PROC)( LPDWORD pidInst, PFNCALLBACK pfnCallback, DWORD afCmd, DWORD ulRes ); - - -DECLARE_WAPI_FUNC( DdeCreateStringHandleW ); -DECLARE_WAPI_FUNC( DdeQueryStringW ); -DECLARE_WAPI_FUNC( DdeInitializeW ); - - -#ifndef _SVTOOLS_SVDDE_DDEWRAP_CXX_ -#define DdeCreateStringHandleW lpfnDdeCreateStringHandleW -#define DdeQueryStringW lpfnDdeQueryStringW -#define DdeInitializeW lpfnDdeInitializeW -#endif - - -#endif diff --git a/svtools/source/svdde/makefile.mk b/svtools/source/svdde/makefile.mk deleted file mode 100644 index f4c72aff2094..000000000000 --- a/svtools/source/svdde/makefile.mk +++ /dev/null @@ -1,64 +0,0 @@ -#************************************************************************* -# -# 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 -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.10 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - - -.IF "$(GUIBASE)"=="WIN" - -PRJ=..$/.. - -PRJNAME=svtools -TARGET=svdde - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk - -# --- Files -------------------------------------------------------- - - -SLOFILES= $(SLO)$/ddecli.obj \ - $(SLO)$/ddesvr.obj \ - $(SLO)$/ddedata.obj \ - $(SLO)$/ddestrg.obj \ - $(SLO)$/ddewrap.obj \ - $(SLO)$/ddeinf.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - -.ELSE -dummy: - @echo GUI == "$(GUI)" - nothing to do - -.ENDIF - diff --git a/svtools/source/svrtf/rtfkeywd.hxx b/svtools/source/svrtf/rtfkeywd.hxx deleted file mode 100644 index f76399ffd824..000000000000 --- a/svtools/source/svrtf/rtfkeywd.hxx +++ /dev/null @@ -1,1144 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: rtfkeywd.hxx,v $ - * $Revision: 1.13.134.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _RTFKEYWD_HXX -#define _RTFKEYWD_HXX - -#include "sal/config.h" - -#define OOO_STRING_SVTOOLS_RTF_HEXCHAR "\\'" -#define OOO_STRING_SVTOOLS_RTF_IGNORE "\\*" -#define OOO_STRING_SVTOOLS_RTF_OPTHYPH "\\-" -#define OOO_STRING_SVTOOLS_RTF_SUBENTRY "\\:" -#define OOO_STRING_SVTOOLS_RTF_ABSH "\\absh" -#define OOO_STRING_SVTOOLS_RTF_ABSW "\\absw" -#define OOO_STRING_SVTOOLS_RTF_ALT "\\alt" -#define OOO_STRING_SVTOOLS_RTF_ANNOTATION "\\annotation" -#define OOO_STRING_SVTOOLS_RTF_ANSI "\\ansi" -#define OOO_STRING_SVTOOLS_RTF_ATNID "\\atnid" -#define OOO_STRING_SVTOOLS_RTF_AUTHOR "\\author" -#define OOO_STRING_SVTOOLS_RTF_B "\\b" -#define OOO_STRING_SVTOOLS_RTF_BGBDIAG "\\bgbdiag" -#define OOO_STRING_SVTOOLS_RTF_BGCROSS "\\bgcross" -#define OOO_STRING_SVTOOLS_RTF_BGDCROSS "\\bgdcross" -#define OOO_STRING_SVTOOLS_RTF_BGDKBDIAG "\\bgdkbdiag" -#define OOO_STRING_SVTOOLS_RTF_BGDKCROSS "\\bgdkcross" -#define OOO_STRING_SVTOOLS_RTF_BGDKDCROSS "\\bgdkdcross" -#define OOO_STRING_SVTOOLS_RTF_BGDKFDIAG "\\bgdkfdiag" -#define OOO_STRING_SVTOOLS_RTF_BGDKHORIZ "\\bgdkhoriz" -#define OOO_STRING_SVTOOLS_RTF_BGDKVERT "\\bgdkvert" -#define OOO_STRING_SVTOOLS_RTF_BGFDIAG "\\bgfdiag" -#define OOO_STRING_SVTOOLS_RTF_BGHORIZ "\\bghoriz" -#define OOO_STRING_SVTOOLS_RTF_BGVERT "\\bgvert" -#define OOO_STRING_SVTOOLS_RTF_BIN "\\bin" -#define OOO_STRING_SVTOOLS_RTF_BINFSXN "\\binfsxn" -#define OOO_STRING_SVTOOLS_RTF_BINSXN "\\binsxn" -#define OOO_STRING_SVTOOLS_RTF_BKMKCOLF "\\bkmkcolf" -#define OOO_STRING_SVTOOLS_RTF_BKMKCOLL "\\bkmkcoll" -#define OOO_STRING_SVTOOLS_RTF_BKMKEND "\\bkmkend" -#define OOO_STRING_SVTOOLS_RTF_BKMKSTART "\\bkmkstart" -#define OOO_STRING_SVTOOLS_RTF_BLUE "\\blue" -#define OOO_STRING_SVTOOLS_RTF_BOX "\\box" -#define OOO_STRING_SVTOOLS_RTF_BRDRB "\\brdrb" -#define OOO_STRING_SVTOOLS_RTF_BRDRBAR "\\brdrbar" -#define OOO_STRING_SVTOOLS_RTF_BRDRBTW "\\brdrbtw" -#define OOO_STRING_SVTOOLS_RTF_BRDRCF "\\brdrcf" -#define OOO_STRING_SVTOOLS_RTF_BRDRDB "\\brdrdb" -#define OOO_STRING_SVTOOLS_RTF_BRDRDOT "\\brdrdot" -#define OOO_STRING_SVTOOLS_RTF_BRDRHAIR "\\brdrhair" -#define OOO_STRING_SVTOOLS_RTF_BRDRL "\\brdrl" -#define OOO_STRING_SVTOOLS_RTF_BRDRR "\\brdrr" -#define OOO_STRING_SVTOOLS_RTF_BRDRS "\\brdrs" -#define OOO_STRING_SVTOOLS_RTF_BRDRSH "\\brdrsh" -#define OOO_STRING_SVTOOLS_RTF_BRDRT "\\brdrt" -#define OOO_STRING_SVTOOLS_RTF_BRDRTH "\\brdrth" -#define OOO_STRING_SVTOOLS_RTF_BRDRW "\\brdrw" -#define OOO_STRING_SVTOOLS_RTF_BRSP "\\brsp" -#define OOO_STRING_SVTOOLS_RTF_BULLET "\\bullet" -#define OOO_STRING_SVTOOLS_RTF_BUPTIM "\\buptim" -#define OOO_STRING_SVTOOLS_RTF_BXE "\\bxe" -#define OOO_STRING_SVTOOLS_RTF_CAPS "\\caps" -#define OOO_STRING_SVTOOLS_RTF_CB "\\cb" -#define OOO_STRING_SVTOOLS_RTF_CBPAT "\\cbpat" -#define OOO_STRING_SVTOOLS_RTF_CELL "\\cell" -#define OOO_STRING_SVTOOLS_RTF_CELLX "\\cellx" -#define OOO_STRING_SVTOOLS_RTF_CF "\\cf" -#define OOO_STRING_SVTOOLS_RTF_CFPAT "\\cfpat" -#define OOO_STRING_SVTOOLS_RTF_CHATN "\\chatn" -#define OOO_STRING_SVTOOLS_RTF_CHDATE "\\chdate" -#define OOO_STRING_SVTOOLS_RTF_CHDPA "\\chdpa" -#define OOO_STRING_SVTOOLS_RTF_CHDPL "\\chdpl" -#define OOO_STRING_SVTOOLS_RTF_CHFTN "\\chftn" -#define OOO_STRING_SVTOOLS_RTF_CHFTNSEP "\\chftnsep" -#define OOO_STRING_SVTOOLS_RTF_CHFTNSEPC "\\chftnsepc" -#define OOO_STRING_SVTOOLS_RTF_CHPGN "\\chpgn" -#define OOO_STRING_SVTOOLS_RTF_CHTIME "\\chtime" -#define OOO_STRING_SVTOOLS_RTF_CLBGBDIAG "\\clbgbdiag" -#define OOO_STRING_SVTOOLS_RTF_CLBGCROSS "\\clbgcross" -#define OOO_STRING_SVTOOLS_RTF_CLBGDCROSS "\\clbgdcross" -#define OOO_STRING_SVTOOLS_RTF_CLBGDKBDIAG "\\clbgdkbdiag" -#define OOO_STRING_SVTOOLS_RTF_CLBGDKCROSS "\\clbgdkcross" -#define OOO_STRING_SVTOOLS_RTF_CLBGDKDCROSS "\\clbgdkdcross" -#define OOO_STRING_SVTOOLS_RTF_CLBGDKFDIAG "\\clbgdkfdiag" -#define OOO_STRING_SVTOOLS_RTF_CLBGDKHOR "\\clbgdkhor" -#define OOO_STRING_SVTOOLS_RTF_CLBGDKVERT "\\clbgdkvert" -#define OOO_STRING_SVTOOLS_RTF_CLBGFDIAG "\\clbgfdiag" -#define OOO_STRING_SVTOOLS_RTF_CLBGHORIZ "\\clbghoriz" -#define OOO_STRING_SVTOOLS_RTF_CLBGVERT "\\clbgvert" -#define OOO_STRING_SVTOOLS_RTF_CLBRDRB "\\clbrdrb" -#define OOO_STRING_SVTOOLS_RTF_CLBRDRL "\\clbrdrl" -#define OOO_STRING_SVTOOLS_RTF_CLBRDRR "\\clbrdrr" -#define OOO_STRING_SVTOOLS_RTF_CLBRDRT "\\clbrdrt" -#define OOO_STRING_SVTOOLS_RTF_CLCBPAT "\\clcbpat" -#define OOO_STRING_SVTOOLS_RTF_CLCFPAT "\\clcfpat" -#define OOO_STRING_SVTOOLS_RTF_CLMGF "\\clmgf" -#define OOO_STRING_SVTOOLS_RTF_CLMRG "\\clmrg" -#define OOO_STRING_SVTOOLS_RTF_CLSHDNG "\\clshdng" -#define OOO_STRING_SVTOOLS_RTF_COLNO "\\colno" -#define OOO_STRING_SVTOOLS_RTF_COLORTBL "\\colortbl" -#define OOO_STRING_SVTOOLS_RTF_COLS "\\cols" -#define OOO_STRING_SVTOOLS_RTF_COLSR "\\colsr" -#define OOO_STRING_SVTOOLS_RTF_COLSX "\\colsx" -#define OOO_STRING_SVTOOLS_RTF_COLUMN "\\column" -#define OOO_STRING_SVTOOLS_RTF_COLW "\\colw" -#define OOO_STRING_SVTOOLS_RTF_COMMENT "\\comment" -#define OOO_STRING_SVTOOLS_RTF_CREATIM "\\creatim" -#define OOO_STRING_SVTOOLS_RTF_CTRL "\\ctrl" -#define OOO_STRING_SVTOOLS_RTF_DEFF "\\deff" -#define OOO_STRING_SVTOOLS_RTF_DEFFORMAT "\\defformat" -#define OOO_STRING_SVTOOLS_RTF_DEFLANG "\\deflang" -#define OOO_STRING_SVTOOLS_RTF_DEFTAB "\\deftab" -#define OOO_STRING_SVTOOLS_RTF_DELETED "\\deleted" -#define OOO_STRING_SVTOOLS_RTF_DFRMTXTX "\\dfrmtxtx" -#define OOO_STRING_SVTOOLS_RTF_DFRMTXTY "\\dfrmtxty" -#define OOO_STRING_SVTOOLS_RTF_DIBITMAP "\\dibitmap" -#define OOO_STRING_SVTOOLS_RTF_DN "\\dn" -#define OOO_STRING_SVTOOLS_RTF_DOCCOMM "\\doccomm" -#define OOO_STRING_SVTOOLS_RTF_DOCTEMP "\\doctemp" -#define OOO_STRING_SVTOOLS_RTF_DROPCAPLI "\\dropcapli" -#define OOO_STRING_SVTOOLS_RTF_DROPCAPT "\\dropcapt" -#define OOO_STRING_SVTOOLS_RTF_ABSNOOVRLP "\\absnoovrlp" -#define OOO_STRING_SVTOOLS_RTF_DXFRTEXT "\\dxfrtext" -#define OOO_STRING_SVTOOLS_RTF_DY "\\dy" -#define OOO_STRING_SVTOOLS_RTF_EDMINS "\\edmins" -#define OOO_STRING_SVTOOLS_RTF_EMDASH "\\emdash" -#define OOO_STRING_SVTOOLS_RTF_ENDASH "\\endash" -#define OOO_STRING_SVTOOLS_RTF_ENDDOC "\\enddoc" -#define OOO_STRING_SVTOOLS_RTF_ENDNHERE "\\endnhere" -#define OOO_STRING_SVTOOLS_RTF_ENDNOTES "\\endnotes" -#define OOO_STRING_SVTOOLS_RTF_EXPND "\\expnd" -#define OOO_STRING_SVTOOLS_RTF_EXPNDTW "\\expndtw" -#define OOO_STRING_SVTOOLS_RTF_F "\\f" -#define OOO_STRING_SVTOOLS_RTF_FACINGP "\\facingp" -#define OOO_STRING_SVTOOLS_RTF_FACPGSXN "\\facpgsxn" -#define OOO_STRING_SVTOOLS_RTF_FALT "\\falt" -#define OOO_STRING_SVTOOLS_RTF_FCHARSET "\\fcharset" -#define OOO_STRING_SVTOOLS_RTF_FDECOR "\\fdecor" -#define OOO_STRING_SVTOOLS_RTF_FI "\\fi" -#define OOO_STRING_SVTOOLS_RTF_FIELD "\\field" -#define OOO_STRING_SVTOOLS_RTF_FLDDIRTY "\\flddirty" -#define OOO_STRING_SVTOOLS_RTF_FLDEDIT "\\fldedit" -#define OOO_STRING_SVTOOLS_RTF_FLDINST "\\fldinst" -#define OOO_STRING_SVTOOLS_RTF_FLDLOCK "\\fldlock" -#define OOO_STRING_SVTOOLS_RTF_FLDPRIV "\\fldpriv" -#define OOO_STRING_SVTOOLS_RTF_FLDRSLT "\\fldrslt" -#define OOO_STRING_SVTOOLS_RTF_FMODERN "\\fmodern" -#define OOO_STRING_SVTOOLS_RTF_FN "\\fn" -#define OOO_STRING_SVTOOLS_RTF_FNIL "\\fnil" -#define OOO_STRING_SVTOOLS_RTF_FONTTBL "\\fonttbl" -#define OOO_STRING_SVTOOLS_RTF_FOOTER "\\footer" -#define OOO_STRING_SVTOOLS_RTF_FOOTERF "\\footerf" -#define OOO_STRING_SVTOOLS_RTF_FOOTERL "\\footerl" -#define OOO_STRING_SVTOOLS_RTF_FOOTERR "\\footerr" -#define OOO_STRING_SVTOOLS_RTF_FOOTERY "\\footery" -#define OOO_STRING_SVTOOLS_RTF_FOOTNOTE "\\footnote" -#define OOO_STRING_SVTOOLS_RTF_FPRQ "\\fprq" -#define OOO_STRING_SVTOOLS_RTF_FRACWIDTH "\\fracwidth" -#define OOO_STRING_SVTOOLS_RTF_FROMAN "\\froman" -#define OOO_STRING_SVTOOLS_RTF_FS "\\fs" -#define OOO_STRING_SVTOOLS_RTF_FSCRIPT "\\fscript" -#define OOO_STRING_SVTOOLS_RTF_FSWISS "\\fswiss" -#define OOO_STRING_SVTOOLS_RTF_FTECH "\\ftech" -#define OOO_STRING_SVTOOLS_RTF_FTNBJ "\\ftnbj" -#define OOO_STRING_SVTOOLS_RTF_FTNCN "\\ftncn" -#define OOO_STRING_SVTOOLS_RTF_FTNRESTART "\\ftnrestart" -#define OOO_STRING_SVTOOLS_RTF_FTNSEP "\\ftnsep" -#define OOO_STRING_SVTOOLS_RTF_FTNSEPC "\\ftnsepc" -#define OOO_STRING_SVTOOLS_RTF_FTNSTART "\\ftnstart" -#define OOO_STRING_SVTOOLS_RTF_FTNTJ "\\ftntj" -#define OOO_STRING_SVTOOLS_RTF_GREEN "\\green" -#define OOO_STRING_SVTOOLS_RTF_GUTTER "\\gutter" -#define OOO_STRING_SVTOOLS_RTF_GUTTERSXN "\\guttersxn" -#define OOO_STRING_SVTOOLS_RTF_HEADER "\\header" -#define OOO_STRING_SVTOOLS_RTF_HEADERF "\\headerf" -#define OOO_STRING_SVTOOLS_RTF_HEADERL "\\headerl" -#define OOO_STRING_SVTOOLS_RTF_HEADERR "\\headerr" -#define OOO_STRING_SVTOOLS_RTF_HEADERY "\\headery" -#define OOO_STRING_SVTOOLS_RTF_HR "\\hr" -#define OOO_STRING_SVTOOLS_RTF_HYPHHOTZ "\\hyphhotz" -#define OOO_STRING_SVTOOLS_RTF_I "\\i" -#define OOO_STRING_SVTOOLS_RTF_ID "\\id" -#define OOO_STRING_SVTOOLS_RTF_INFO "\\info" -#define OOO_STRING_SVTOOLS_RTF_INTBL "\\intbl" -#define OOO_STRING_SVTOOLS_RTF_IXE "\\ixe" -#define OOO_STRING_SVTOOLS_RTF_KEEP "\\keep" -#define OOO_STRING_SVTOOLS_RTF_KEEPN "\\keepn" -#define OOO_STRING_SVTOOLS_RTF_KERNING "\\kerning" -#define OOO_STRING_SVTOOLS_RTF_KEYCODE "\\keycode" -#define OOO_STRING_SVTOOLS_RTF_KEYWORDS "\\keywords" -#define OOO_STRING_SVTOOLS_RTF_LANDSCAPE "\\landscape" -#define OOO_STRING_SVTOOLS_RTF_LANG "\\lang" -#define OOO_STRING_SVTOOLS_RTF_LDBLQUOTE "\\ldblquote" -#define OOO_STRING_SVTOOLS_RTF_LEVEL "\\level" -#define OOO_STRING_SVTOOLS_RTF_LI "\\li" -#define OOO_STRING_SVTOOLS_RTF_LIN "\\lin" -#define OOO_STRING_SVTOOLS_RTF_LINE "\\line" -#define OOO_STRING_SVTOOLS_RTF_LINEBETCOL "\\linebetcol" -#define OOO_STRING_SVTOOLS_RTF_LINECONT "\\linecont" -#define OOO_STRING_SVTOOLS_RTF_LINEMOD "\\linemod" -#define OOO_STRING_SVTOOLS_RTF_LINEPPAGE "\\lineppage" -#define OOO_STRING_SVTOOLS_RTF_LINERESTART "\\linerestart" -#define OOO_STRING_SVTOOLS_RTF_LINESTART "\\linestart" -#define OOO_STRING_SVTOOLS_RTF_LINESTARTS "\\linestarts" -#define OOO_STRING_SVTOOLS_RTF_LINEX "\\linex" -#define OOO_STRING_SVTOOLS_RTF_LNDSCPSXN "\\lndscpsxn" -#define OOO_STRING_SVTOOLS_RTF_LQUOTE "\\lquote" -#define OOO_STRING_SVTOOLS_RTF_MAC "\\mac" -#define OOO_STRING_SVTOOLS_RTF_MACPICT "\\macpict" -#define OOO_STRING_SVTOOLS_RTF_MAKEBACKUP "\\makebackup" -#define OOO_STRING_SVTOOLS_RTF_MARGB "\\margb" -#define OOO_STRING_SVTOOLS_RTF_MARGBSXN "\\margbsxn" -#define OOO_STRING_SVTOOLS_RTF_MARGL "\\margl" -#define OOO_STRING_SVTOOLS_RTF_MARGLSXN "\\marglsxn" -#define OOO_STRING_SVTOOLS_RTF_MARGMIRROR "\\margmirror" -#define OOO_STRING_SVTOOLS_RTF_MARGR "\\margr" -#define OOO_STRING_SVTOOLS_RTF_MARGRSXN "\\margrsxn" -#define OOO_STRING_SVTOOLS_RTF_MARGT "\\margt" -#define OOO_STRING_SVTOOLS_RTF_MARGTSXN "\\margtsxn" -#define OOO_STRING_SVTOOLS_RTF_MIN "\\min" -#define OOO_STRING_SVTOOLS_RTF_MO "\\mo" -#define OOO_STRING_SVTOOLS_RTF_NEXTCSET "\\nextcset" -#define OOO_STRING_SVTOOLS_RTF_NEXTFILE "\\nextfile" -#define OOO_STRING_SVTOOLS_RTF_NOFCHARS "\\nofchars" -#define OOO_STRING_SVTOOLS_RTF_NOFPAGES "\\nofpages" -#define OOO_STRING_SVTOOLS_RTF_NOFWORDS "\\nofwords" -#define OOO_STRING_SVTOOLS_RTF_NOLINE "\\noline" -#define OOO_STRING_SVTOOLS_RTF_NOSUPERSUB "\\nosupersub" -#define OOO_STRING_SVTOOLS_RTF_NOWRAP "\\nowrap" -#define OOO_STRING_SVTOOLS_RTF_OPERATOR "\\operator" -#define OOO_STRING_SVTOOLS_RTF_OUTL "\\outl" -#define OOO_STRING_SVTOOLS_RTF_PAGE "\\page" -#define OOO_STRING_SVTOOLS_RTF_PAGEBB "\\pagebb" -#define OOO_STRING_SVTOOLS_RTF_PAPERH "\\paperh" -#define OOO_STRING_SVTOOLS_RTF_PAPERW "\\paperw" -#define OOO_STRING_SVTOOLS_RTF_PAR "\\par" -#define OOO_STRING_SVTOOLS_RTF_PARD "\\pard" -#define OOO_STRING_SVTOOLS_RTF_PC "\\pc" -#define OOO_STRING_SVTOOLS_RTF_PCA "\\pca" -#define OOO_STRING_SVTOOLS_RTF_PGHSXN "\\pghsxn" -#define OOO_STRING_SVTOOLS_RTF_PGNCONT "\\pgncont" -#define OOO_STRING_SVTOOLS_RTF_PGNDEC "\\pgndec" -#define OOO_STRING_SVTOOLS_RTF_PGNLCLTR "\\pgnlcltr" -#define OOO_STRING_SVTOOLS_RTF_PGNLCRM "\\pgnlcrm" -#define OOO_STRING_SVTOOLS_RTF_PGNRESTART "\\pgnrestart" -#define OOO_STRING_SVTOOLS_RTF_PGNSTART "\\pgnstart" -#define OOO_STRING_SVTOOLS_RTF_PGNSTARTS "\\pgnstarts" -#define OOO_STRING_SVTOOLS_RTF_PGNUCLTR "\\pgnucltr" -#define OOO_STRING_SVTOOLS_RTF_PGNUCRM "\\pgnucrm" -#define OOO_STRING_SVTOOLS_RTF_PGNX "\\pgnx" -#define OOO_STRING_SVTOOLS_RTF_PGNY "\\pgny" -#define OOO_STRING_SVTOOLS_RTF_PGWSXN "\\pgwsxn" -#define OOO_STRING_SVTOOLS_RTF_PHCOL "\\phcol" -#define OOO_STRING_SVTOOLS_RTF_PHMRG "\\phmrg" -#define OOO_STRING_SVTOOLS_RTF_PHPG "\\phpg" -#define OOO_STRING_SVTOOLS_RTF_PICCROPB "\\piccropb" -#define OOO_STRING_SVTOOLS_RTF_PICCROPL "\\piccropl" -#define OOO_STRING_SVTOOLS_RTF_PICCROPR "\\piccropr" -#define OOO_STRING_SVTOOLS_RTF_PICCROPT "\\piccropt" -#define OOO_STRING_SVTOOLS_RTF_PICH "\\pich" -#define OOO_STRING_SVTOOLS_RTF_PICHGOAL "\\pichgoal" -#define OOO_STRING_SVTOOLS_RTF_PICSCALED "\\picscaled" -#define OOO_STRING_SVTOOLS_RTF_PICSCALEX "\\picscalex" -#define OOO_STRING_SVTOOLS_RTF_PICSCALEY "\\picscaley" -#define OOO_STRING_SVTOOLS_RTF_PICT "\\pict" -#define OOO_STRING_SVTOOLS_RTF_PICW "\\picw" -#define OOO_STRING_SVTOOLS_RTF_PICWGOAL "\\picwgoal" -#define OOO_STRING_SVTOOLS_RTF_PLAIN "\\plain" -#define OOO_STRING_SVTOOLS_RTF_PMMETAFILE "\\pmmetafile" -#define OOO_STRING_SVTOOLS_RTF_POSNEGX "\\posnegx" -#define OOO_STRING_SVTOOLS_RTF_POSNEGY "\\posnegy" -#define OOO_STRING_SVTOOLS_RTF_POSX "\\posx" -#define OOO_STRING_SVTOOLS_RTF_POSXC "\\posxc" -#define OOO_STRING_SVTOOLS_RTF_POSXI "\\posxi" -#define OOO_STRING_SVTOOLS_RTF_POSXL "\\posxl" -#define OOO_STRING_SVTOOLS_RTF_POSXO "\\posxo" -#define OOO_STRING_SVTOOLS_RTF_POSXR "\\posxr" -#define OOO_STRING_SVTOOLS_RTF_POSY "\\posy" -#define OOO_STRING_SVTOOLS_RTF_POSYB "\\posyb" -#define OOO_STRING_SVTOOLS_RTF_POSYC "\\posyc" -#define OOO_STRING_SVTOOLS_RTF_POSYIL "\\posyil" -#define OOO_STRING_SVTOOLS_RTF_POSYT "\\posyt" -#define OOO_STRING_SVTOOLS_RTF_PRINTIM "\\printim" -#define OOO_STRING_SVTOOLS_RTF_PSOVER "\\psover" -#define OOO_STRING_SVTOOLS_RTF_PVMRG "\\pvmrg" -#define OOO_STRING_SVTOOLS_RTF_PVPARA "\\pvpara" -#define OOO_STRING_SVTOOLS_RTF_PVPG "\\pvpg" -#define OOO_STRING_SVTOOLS_RTF_QC "\\qc" -#define OOO_STRING_SVTOOLS_RTF_QJ "\\qj" -#define OOO_STRING_SVTOOLS_RTF_QL "\\ql" -#define OOO_STRING_SVTOOLS_RTF_QR "\\qr" -#define OOO_STRING_SVTOOLS_RTF_RDBLQUOTE "\\rdblquote" -#define OOO_STRING_SVTOOLS_RTF_RED "\\red" -#define OOO_STRING_SVTOOLS_RTF_REVBAR "\\revbar" -#define OOO_STRING_SVTOOLS_RTF_REVISED "\\revised" -#define OOO_STRING_SVTOOLS_RTF_REVISIONS "\\revisions" -#define OOO_STRING_SVTOOLS_RTF_REVPROP "\\revprop" -#define OOO_STRING_SVTOOLS_RTF_REVTIM "\\revtim" -#define OOO_STRING_SVTOOLS_RTF_RI "\\ri" -#define OOO_STRING_SVTOOLS_RTF_RIN "\\rin" -#define OOO_STRING_SVTOOLS_RTF_ROW "\\row" -#define OOO_STRING_SVTOOLS_RTF_RQUOTE "\\rquote" -#define OOO_STRING_SVTOOLS_RTF_RTF "\\rtf" -#define OOO_STRING_SVTOOLS_RTF_RXE "\\rxe" -#define OOO_STRING_SVTOOLS_RTF_S "\\s" -#define OOO_STRING_SVTOOLS_RTF_SA "\\sa" -#define OOO_STRING_SVTOOLS_RTF_SB "\\sb" -#define OOO_STRING_SVTOOLS_RTF_SBASEDON "\\sbasedon" -#define OOO_STRING_SVTOOLS_RTF_SBKCOL "\\sbkcol" -#define OOO_STRING_SVTOOLS_RTF_SBKEVEN "\\sbkeven" -#define OOO_STRING_SVTOOLS_RTF_SBKNONE "\\sbknone" -#define OOO_STRING_SVTOOLS_RTF_SBKODD "\\sbkodd" -#define OOO_STRING_SVTOOLS_RTF_SBKPAGE "\\sbkpage" -#define OOO_STRING_SVTOOLS_RTF_SBYS "\\sbys" -#define OOO_STRING_SVTOOLS_RTF_SCAPS "\\scaps" -#define OOO_STRING_SVTOOLS_RTF_SECT "\\sect" -#define OOO_STRING_SVTOOLS_RTF_SECTD "\\sectd" -#define OOO_STRING_SVTOOLS_RTF_SHAD "\\shad" -#define OOO_STRING_SVTOOLS_RTF_SHADING "\\shading" -#define OOO_STRING_SVTOOLS_RTF_SHIFT "\\shift" -#define OOO_STRING_SVTOOLS_RTF_SL "\\sl" -#define OOO_STRING_SVTOOLS_RTF_SNEXT "\\snext" -#define OOO_STRING_SVTOOLS_RTF_STRIKE "\\strike" -#define OOO_STRING_SVTOOLS_RTF_STYLESHEET "\\stylesheet" -#define OOO_STRING_SVTOOLS_RTF_SUB "\\sub" -#define OOO_STRING_SVTOOLS_RTF_SUBJECT "\\subject" -#define OOO_STRING_SVTOOLS_RTF_SUPER "\\super" -#define OOO_STRING_SVTOOLS_RTF_TAB "\\tab" -#define OOO_STRING_SVTOOLS_RTF_TB "\\tb" -#define OOO_STRING_SVTOOLS_RTF_TC "\\tc" -#define OOO_STRING_SVTOOLS_RTF_TCF "\\tcf" -#define OOO_STRING_SVTOOLS_RTF_TCL "\\tcl" -#define OOO_STRING_SVTOOLS_RTF_TEMPLATE "\\template" -#define OOO_STRING_SVTOOLS_RTF_TITLE "\\title" -#define OOO_STRING_SVTOOLS_RTF_TITLEPG "\\titlepg" -#define OOO_STRING_SVTOOLS_RTF_TLDOT "\\tldot" -#define OOO_STRING_SVTOOLS_RTF_TLEQ "\\tleq" -#define OOO_STRING_SVTOOLS_RTF_TLHYPH "\\tlhyph" -#define OOO_STRING_SVTOOLS_RTF_TLTH "\\tlth" -#define OOO_STRING_SVTOOLS_RTF_TLUL "\\tlul" -#define OOO_STRING_SVTOOLS_RTF_TQC "\\tqc" -#define OOO_STRING_SVTOOLS_RTF_TQDEC "\\tqdec" -#define OOO_STRING_SVTOOLS_RTF_TQR "\\tqr" -#define OOO_STRING_SVTOOLS_RTF_TQL "\\tql" -#define OOO_STRING_SVTOOLS_RTF_TRGAPH "\\trgaph" -#define OOO_STRING_SVTOOLS_RTF_TRLEFT "\\trleft" -#define OOO_STRING_SVTOOLS_RTF_TROWD "\\trowd" -#define OOO_STRING_SVTOOLS_RTF_TRQC "\\trqc" -#define OOO_STRING_SVTOOLS_RTF_TRQL "\\trql" -#define OOO_STRING_SVTOOLS_RTF_TRQR "\\trqr" -#define OOO_STRING_SVTOOLS_RTF_TRRH "\\trrh" -#define OOO_STRING_SVTOOLS_RTF_TX "\\tx" -#define OOO_STRING_SVTOOLS_RTF_TXE "\\txe" -#define OOO_STRING_SVTOOLS_RTF_UL "\\ul" -#define OOO_STRING_SVTOOLS_RTF_ULD "\\uld" -#define OOO_STRING_SVTOOLS_RTF_ULDB "\\uldb" -#define OOO_STRING_SVTOOLS_RTF_ULNONE "\\ulnone" -#define OOO_STRING_SVTOOLS_RTF_ULW "\\ulw" -#define OOO_STRING_SVTOOLS_RTF_UP "\\up" -#define OOO_STRING_SVTOOLS_RTF_V "\\v" -#define OOO_STRING_SVTOOLS_RTF_VERN "\\vern" -#define OOO_STRING_SVTOOLS_RTF_VERSION "\\version" -#define OOO_STRING_SVTOOLS_RTF_VERTALB "\\vertalb" -#define OOO_STRING_SVTOOLS_RTF_VERTALC "\\vertalc" -#define OOO_STRING_SVTOOLS_RTF_VERTALJ "\\vertalj" -#define OOO_STRING_SVTOOLS_RTF_VERTALT "\\vertalt" -#define OOO_STRING_SVTOOLS_RTF_WBITMAP "\\wbitmap" -#define OOO_STRING_SVTOOLS_RTF_WBMBITSPIXEL "\\wbmbitspixel" -#define OOO_STRING_SVTOOLS_RTF_WBMPLANES "\\wbmplanes" -#define OOO_STRING_SVTOOLS_RTF_WBMWIDTHBYTES "\\wbmwidthbytes" -#define OOO_STRING_SVTOOLS_RTF_WIDOWCTRL "\\widowctrl" -#define OOO_STRING_SVTOOLS_RTF_WMETAFILE "\\wmetafile" -#define OOO_STRING_SVTOOLS_RTF_XE "\\xe" -#define OOO_STRING_SVTOOLS_RTF_YR "\\yr" -#define OOO_STRING_SVTOOLS_RTF_NOBRKHYPH "\\_" -#define OOO_STRING_SVTOOLS_RTF_FORMULA "\\|" -#define OOO_STRING_SVTOOLS_RTF_NOBREAK "\\~" -#define OOO_STRING_SVTOOLS_RTF_AB "\\ab" -#define OOO_STRING_SVTOOLS_RTF_ACAPS "\\acaps" -#define OOO_STRING_SVTOOLS_RTF_ACF "\\acf" -#define OOO_STRING_SVTOOLS_RTF_ADDITIVE "\\additive" -#define OOO_STRING_SVTOOLS_RTF_ADN "\\adn" -#define OOO_STRING_SVTOOLS_RTF_AENDDOC "\\aenddoc" -#define OOO_STRING_SVTOOLS_RTF_AENDNOTES "\\aendnotes" -#define OOO_STRING_SVTOOLS_RTF_AEXPND "\\aexpnd" -#define OOO_STRING_SVTOOLS_RTF_AF "\\af" -#define OOO_STRING_SVTOOLS_RTF_AFS "\\afs" -#define OOO_STRING_SVTOOLS_RTF_AFTNBJ "\\aftnbj" -#define OOO_STRING_SVTOOLS_RTF_AFTNCN "\\aftncn" -#define OOO_STRING_SVTOOLS_RTF_AFTNNALC "\\aftnnalc" -#define OOO_STRING_SVTOOLS_RTF_AFTNNAR "\\aftnnar" -#define OOO_STRING_SVTOOLS_RTF_AFTNNAUC "\\aftnnauc" -#define OOO_STRING_SVTOOLS_RTF_AFTNNCHI "\\aftnnchi" -#define OOO_STRING_SVTOOLS_RTF_AFTNNRLC "\\aftnnrlc" -#define OOO_STRING_SVTOOLS_RTF_AFTNNRUC "\\aftnnruc" -#define OOO_STRING_SVTOOLS_RTF_AFTNRESTART "\\aftnrestart" -#define OOO_STRING_SVTOOLS_RTF_AFTNRSTCONT "\\aftnrstcont" -#define OOO_STRING_SVTOOLS_RTF_AFTNSEP "\\aftnsep" -#define OOO_STRING_SVTOOLS_RTF_AFTNSEPC "\\aftnsepc" -#define OOO_STRING_SVTOOLS_RTF_AFTNSTART "\\aftnstart" -#define OOO_STRING_SVTOOLS_RTF_AFTNTJ "\\aftntj" -#define OOO_STRING_SVTOOLS_RTF_AI "\\ai" -#define OOO_STRING_SVTOOLS_RTF_ALANG "\\alang" -#define OOO_STRING_SVTOOLS_RTF_ALLPROT "\\allprot" -#define OOO_STRING_SVTOOLS_RTF_ANNOTPROT "\\annotprot" -#define OOO_STRING_SVTOOLS_RTF_AOUTL "\\aoutl" -#define OOO_STRING_SVTOOLS_RTF_ASCAPS "\\ascaps" -#define OOO_STRING_SVTOOLS_RTF_ASHAD "\\ashad" -#define OOO_STRING_SVTOOLS_RTF_ASTRIKE "\\astrike" -#define OOO_STRING_SVTOOLS_RTF_ATNAUTHOR "\\atnauthor" -#define OOO_STRING_SVTOOLS_RTF_ATNICN "\\atnicn" -#define OOO_STRING_SVTOOLS_RTF_ATNREF "\\atnref" -#define OOO_STRING_SVTOOLS_RTF_ATNTIME "\\atntime" -#define OOO_STRING_SVTOOLS_RTF_ATRFEND "\\atrfend" -#define OOO_STRING_SVTOOLS_RTF_ATRFSTART "\\atrfstart" -#define OOO_STRING_SVTOOLS_RTF_AUL "\\aul" -#define OOO_STRING_SVTOOLS_RTF_AULD "\\auld" -#define OOO_STRING_SVTOOLS_RTF_AULDB "\\auldb" -#define OOO_STRING_SVTOOLS_RTF_AULNONE "\\aulnone" -#define OOO_STRING_SVTOOLS_RTF_AULW "\\aulw" -#define OOO_STRING_SVTOOLS_RTF_AUP "\\aup" -#define OOO_STRING_SVTOOLS_RTF_BKMKPUB "\\bkmkpub" -#define OOO_STRING_SVTOOLS_RTF_BRDRDASH "\\brdrdash" -#define OOO_STRING_SVTOOLS_RTF_BRKFRM "\\brkfrm" -#define OOO_STRING_SVTOOLS_RTF_CCHS "\\cchs" -#define OOO_STRING_SVTOOLS_RTF_CPG "\\cpg" -#define OOO_STRING_SVTOOLS_RTF_CS "\\cs" -#define OOO_STRING_SVTOOLS_RTF_CVMME "\\cvmme" -#define OOO_STRING_SVTOOLS_RTF_DATAFIELD "\\datafield" -#define OOO_STRING_SVTOOLS_RTF_DO "\\do" -#define OOO_STRING_SVTOOLS_RTF_DOBXCOLUMN "\\dobxcolumn" -#define OOO_STRING_SVTOOLS_RTF_DOBXMARGIN "\\dobxmargin" -#define OOO_STRING_SVTOOLS_RTF_DOBXPAGE "\\dobxpage" -#define OOO_STRING_SVTOOLS_RTF_DOBYMARGIN "\\dobymargin" -#define OOO_STRING_SVTOOLS_RTF_DOBYPAGE "\\dobypage" -#define OOO_STRING_SVTOOLS_RTF_DOBYPARA "\\dobypara" -#define OOO_STRING_SVTOOLS_RTF_DODHGT "\\dodhgt" -#define OOO_STRING_SVTOOLS_RTF_DOLOCK "\\dolock" -#define OOO_STRING_SVTOOLS_RTF_DPAENDHOL "\\dpaendhol" -#define OOO_STRING_SVTOOLS_RTF_DPAENDL "\\dpaendl" -#define OOO_STRING_SVTOOLS_RTF_DPAENDSOL "\\dpaendsol" -#define OOO_STRING_SVTOOLS_RTF_DPAENDW "\\dpaendw" -#define OOO_STRING_SVTOOLS_RTF_DPARC "\\dparc" -#define OOO_STRING_SVTOOLS_RTF_DPARCFLIPX "\\dparcflipx" -#define OOO_STRING_SVTOOLS_RTF_DPARCFLIPY "\\dparcflipy" -#define OOO_STRING_SVTOOLS_RTF_DPASTARTHOL "\\dpastarthol" -#define OOO_STRING_SVTOOLS_RTF_DPASTARTL "\\dpastartl" -#define OOO_STRING_SVTOOLS_RTF_DPASTARTSOL "\\dpastartsol" -#define OOO_STRING_SVTOOLS_RTF_DPASTARTW "\\dpastartw" -#define OOO_STRING_SVTOOLS_RTF_DPCALLOUT "\\dpcallout" -#define OOO_STRING_SVTOOLS_RTF_DPCOA "\\dpcoa" -#define OOO_STRING_SVTOOLS_RTF_DPCOACCENT "\\dpcoaccent" -#define OOO_STRING_SVTOOLS_RTF_DPCOBESTFIT "\\dpcobestfit" -#define OOO_STRING_SVTOOLS_RTF_DPCOBORDER "\\dpcoborder" -#define OOO_STRING_SVTOOLS_RTF_DPCODABS "\\dpcodabs" -#define OOO_STRING_SVTOOLS_RTF_DPCODBOTTOM "\\dpcodbottom" -#define OOO_STRING_SVTOOLS_RTF_DPCODCENTER "\\dpcodcenter" -#define OOO_STRING_SVTOOLS_RTF_DPCODTOP "\\dpcodtop" -#define OOO_STRING_SVTOOLS_RTF_DPCOLENGTH "\\dpcolength" -#define OOO_STRING_SVTOOLS_RTF_DPCOMINUSX "\\dpcominusx" -#define OOO_STRING_SVTOOLS_RTF_DPCOMINUSY "\\dpcominusy" -#define OOO_STRING_SVTOOLS_RTF_DPCOOFFSET "\\dpcooffset" -#define OOO_STRING_SVTOOLS_RTF_DPCOSMARTA "\\dpcosmarta" -#define OOO_STRING_SVTOOLS_RTF_DPCOTDOUBLE "\\dpcotdouble" -#define OOO_STRING_SVTOOLS_RTF_DPCOTRIGHT "\\dpcotright" -#define OOO_STRING_SVTOOLS_RTF_DPCOTSINGLE "\\dpcotsingle" -#define OOO_STRING_SVTOOLS_RTF_DPCOTTRIPLE "\\dpcottriple" -#define OOO_STRING_SVTOOLS_RTF_DPCOUNT "\\dpcount" -#define OOO_STRING_SVTOOLS_RTF_DPELLIPSE "\\dpellipse" -#define OOO_STRING_SVTOOLS_RTF_DPENDGROUP "\\dpendgroup" -#define OOO_STRING_SVTOOLS_RTF_DPFILLBGCB "\\dpfillbgcb" -#define OOO_STRING_SVTOOLS_RTF_DPFILLBGCG "\\dpfillbgcg" -#define OOO_STRING_SVTOOLS_RTF_DPFILLBGCR "\\dpfillbgcr" -#define OOO_STRING_SVTOOLS_RTF_DPFILLBGGRAY "\\dpfillbggray" -#define OOO_STRING_SVTOOLS_RTF_DPFILLBGPAL "\\dpfillbgpal" -#define OOO_STRING_SVTOOLS_RTF_DPFILLFGCB "\\dpfillfgcb" -#define OOO_STRING_SVTOOLS_RTF_DPFILLFGCG "\\dpfillfgcg" -#define OOO_STRING_SVTOOLS_RTF_DPFILLFGCR "\\dpfillfgcr" -#define OOO_STRING_SVTOOLS_RTF_DPFILLFGGRAY "\\dpfillfggray" -#define OOO_STRING_SVTOOLS_RTF_DPFILLFGPAL "\\dpfillfgpal" -#define OOO_STRING_SVTOOLS_RTF_DPFILLPAT "\\dpfillpat" -#define OOO_STRING_SVTOOLS_RTF_DPGROUP "\\dpgroup" -#define OOO_STRING_SVTOOLS_RTF_DPLINE "\\dpline" -#define OOO_STRING_SVTOOLS_RTF_DPLINECOB "\\dplinecob" -#define OOO_STRING_SVTOOLS_RTF_DPLINECOG "\\dplinecog" -#define OOO_STRING_SVTOOLS_RTF_DPLINECOR "\\dplinecor" -#define OOO_STRING_SVTOOLS_RTF_DPLINEDADO "\\dplinedado" -#define OOO_STRING_SVTOOLS_RTF_DPLINEDADODO "\\dplinedadodo" -#define OOO_STRING_SVTOOLS_RTF_DPLINEDASH "\\dplinedash" -#define OOO_STRING_SVTOOLS_RTF_DPLINEDOT "\\dplinedot" -#define OOO_STRING_SVTOOLS_RTF_DPLINEGRAY "\\dplinegray" -#define OOO_STRING_SVTOOLS_RTF_DPLINEHOLLOW "\\dplinehollow" -#define OOO_STRING_SVTOOLS_RTF_DPLINEPAL "\\dplinepal" -#define OOO_STRING_SVTOOLS_RTF_DPLINESOLID "\\dplinesolid" -#define OOO_STRING_SVTOOLS_RTF_DPLINEW "\\dplinew" -#define OOO_STRING_SVTOOLS_RTF_DPPOLYCOUNT "\\dppolycount" -#define OOO_STRING_SVTOOLS_RTF_DPPOLYGON "\\dppolygon" -#define OOO_STRING_SVTOOLS_RTF_DPPOLYLINE "\\dppolyline" -#define OOO_STRING_SVTOOLS_RTF_DPPTX "\\dpptx" -#define OOO_STRING_SVTOOLS_RTF_DPPTY "\\dppty" -#define OOO_STRING_SVTOOLS_RTF_DPRECT "\\dprect" -#define OOO_STRING_SVTOOLS_RTF_DPROUNDR "\\dproundr" -#define OOO_STRING_SVTOOLS_RTF_DPSHADOW "\\dpshadow" -#define OOO_STRING_SVTOOLS_RTF_DPSHADX "\\dpshadx" -#define OOO_STRING_SVTOOLS_RTF_DPSHADY "\\dpshady" -#define OOO_STRING_SVTOOLS_RTF_DPTXBX "\\dptxbx" -#define OOO_STRING_SVTOOLS_RTF_DPTXBXMAR "\\dptxbxmar" -#define OOO_STRING_SVTOOLS_RTF_DPTXBXTEXT "\\dptxbxtext" -#define OOO_STRING_SVTOOLS_RTF_DPX "\\dpx" -#define OOO_STRING_SVTOOLS_RTF_DPXSIZE "\\dpxsize" -#define OOO_STRING_SVTOOLS_RTF_DPY "\\dpy" -#define OOO_STRING_SVTOOLS_RTF_DPYSIZE "\\dpysize" -#define OOO_STRING_SVTOOLS_RTF_DS "\\ds" -#define OOO_STRING_SVTOOLS_RTF_EMSPACE "\\emspace" -#define OOO_STRING_SVTOOLS_RTF_ENSPACE "\\enspace" -#define OOO_STRING_SVTOOLS_RTF_FBIDI "\\fbidi" -#define OOO_STRING_SVTOOLS_RTF_FET "\\fet" -#define OOO_STRING_SVTOOLS_RTF_FID "\\fid" -#define OOO_STRING_SVTOOLS_RTF_FILE "\\file" -#define OOO_STRING_SVTOOLS_RTF_FILETBL "\\filetbl" -#define OOO_STRING_SVTOOLS_RTF_FLDALT "\\fldalt" -#define OOO_STRING_SVTOOLS_RTF_FNETWORK "\\fnetwork" -#define OOO_STRING_SVTOOLS_RTF_FONTEMB "\\fontemb" -#define OOO_STRING_SVTOOLS_RTF_FONTFILE "\\fontfile" -#define OOO_STRING_SVTOOLS_RTF_FORMDISP "\\formdisp" -#define OOO_STRING_SVTOOLS_RTF_FORMPROT "\\formprot" -#define OOO_STRING_SVTOOLS_RTF_FORMSHADE "\\formshade" -#define OOO_STRING_SVTOOLS_RTF_FOSNUM "\\fosnum" -#define OOO_STRING_SVTOOLS_RTF_FRELATIVE "\\frelative" -#define OOO_STRING_SVTOOLS_RTF_FTNALT "\\ftnalt" -#define OOO_STRING_SVTOOLS_RTF_FTNIL "\\ftnil" -#define OOO_STRING_SVTOOLS_RTF_FTNNALC "\\ftnnalc" -#define OOO_STRING_SVTOOLS_RTF_FTNNAR "\\ftnnar" -#define OOO_STRING_SVTOOLS_RTF_FTNNAUC "\\ftnnauc" -#define OOO_STRING_SVTOOLS_RTF_FTNNCHI "\\ftnnchi" -#define OOO_STRING_SVTOOLS_RTF_FTNNRLC "\\ftnnrlc" -#define OOO_STRING_SVTOOLS_RTF_FTNNRUC "\\ftnnruc" -#define OOO_STRING_SVTOOLS_RTF_FTNRSTCONT "\\ftnrstcont" -#define OOO_STRING_SVTOOLS_RTF_FTNRSTPG "\\ftnrstpg" -#define OOO_STRING_SVTOOLS_RTF_FTTRUETYPE "\\fttruetype" -#define OOO_STRING_SVTOOLS_RTF_FVALIDDOS "\\fvaliddos" -#define OOO_STRING_SVTOOLS_RTF_FVALIDHPFS "\\fvalidhpfs" -#define OOO_STRING_SVTOOLS_RTF_FVALIDMAC "\\fvalidmac" -#define OOO_STRING_SVTOOLS_RTF_FVALIDNTFS "\\fvalidntfs" -#define OOO_STRING_SVTOOLS_RTF_HYPHAUTO "\\hyphauto" -#define OOO_STRING_SVTOOLS_RTF_HYPHCAPS "\\hyphcaps" -#define OOO_STRING_SVTOOLS_RTF_HYPHCONSEC "\\hyphconsec" -#define OOO_STRING_SVTOOLS_RTF_HYPHPAR "\\hyphpar" -#define OOO_STRING_SVTOOLS_RTF_LINKSELF "\\linkself" -#define OOO_STRING_SVTOOLS_RTF_LINKSTYLES "\\linkstyles" -#define OOO_STRING_SVTOOLS_RTF_LTRCH "\\ltrch" -#define OOO_STRING_SVTOOLS_RTF_LTRDOC "\\ltrdoc" -#define OOO_STRING_SVTOOLS_RTF_LTRMARK "\\ltrmark" -#define OOO_STRING_SVTOOLS_RTF_LTRPAR "\\ltrpar" -#define OOO_STRING_SVTOOLS_RTF_LTRROW "\\ltrrow" -#define OOO_STRING_SVTOOLS_RTF_LTRSECT "\\ltrsect" -#define OOO_STRING_SVTOOLS_RTF_NOCOLBAL "\\nocolbal" -#define OOO_STRING_SVTOOLS_RTF_NOEXTRASPRL "\\noextrasprl" -#define OOO_STRING_SVTOOLS_RTF_NOTABIND "\\notabind" -#define OOO_STRING_SVTOOLS_RTF_NOWIDCTLPAR "\\nowidctlpar" -#define OOO_STRING_SVTOOLS_RTF_OBJALIAS "\\objalias" -#define OOO_STRING_SVTOOLS_RTF_OBJALIGN "\\objalign" -#define OOO_STRING_SVTOOLS_RTF_OBJAUTLINK "\\objautlink" -#define OOO_STRING_SVTOOLS_RTF_OBJCLASS "\\objclass" -#define OOO_STRING_SVTOOLS_RTF_OBJCROPB "\\objcropb" -#define OOO_STRING_SVTOOLS_RTF_OBJCROPL "\\objcropl" -#define OOO_STRING_SVTOOLS_RTF_OBJCROPR "\\objcropr" -#define OOO_STRING_SVTOOLS_RTF_OBJCROPT "\\objcropt" -#define OOO_STRING_SVTOOLS_RTF_OBJDATA "\\objdata" -#define OOO_STRING_SVTOOLS_RTF_OBJECT "\\object" -#define OOO_STRING_SVTOOLS_RTF_OBJEMB "\\objemb" -#define OOO_STRING_SVTOOLS_RTF_OBJH "\\objh" -#define OOO_STRING_SVTOOLS_RTF_OBJICEMB "\\objicemb" -#define OOO_STRING_SVTOOLS_RTF_OBJLINK "\\objlink" -#define OOO_STRING_SVTOOLS_RTF_OBJLOCK "\\objlock" -#define OOO_STRING_SVTOOLS_RTF_OBJNAME "\\objname" -#define OOO_STRING_SVTOOLS_RTF_OBJPUB "\\objpub" -#define OOO_STRING_SVTOOLS_RTF_OBJSCALEX "\\objscalex" -#define OOO_STRING_SVTOOLS_RTF_OBJSCALEY "\\objscaley" -#define OOO_STRING_SVTOOLS_RTF_OBJSECT "\\objsect" -#define OOO_STRING_SVTOOLS_RTF_OBJSETSIZE "\\objsetsize" -#define OOO_STRING_SVTOOLS_RTF_OBJSUB "\\objsub" -#define OOO_STRING_SVTOOLS_RTF_OBJTIME "\\objtime" -#define OOO_STRING_SVTOOLS_RTF_OBJTRANSY "\\objtransy" -#define OOO_STRING_SVTOOLS_RTF_OBJUPDATE "\\objupdate" -#define OOO_STRING_SVTOOLS_RTF_OBJW "\\objw" -#define OOO_STRING_SVTOOLS_RTF_OTBLRUL "\\otblrul" -#define OOO_STRING_SVTOOLS_RTF_PGNHN "\\pgnhn" -#define OOO_STRING_SVTOOLS_RTF_PGNHNSC "\\pgnhnsc" -#define OOO_STRING_SVTOOLS_RTF_PGNHNSH "\\pgnhnsh" -#define OOO_STRING_SVTOOLS_RTF_PGNHNSM "\\pgnhnsm" -#define OOO_STRING_SVTOOLS_RTF_PGNHNSN "\\pgnhnsn" -#define OOO_STRING_SVTOOLS_RTF_PGNHNSP "\\pgnhnsp" -#define OOO_STRING_SVTOOLS_RTF_PICBMP "\\picbmp" -#define OOO_STRING_SVTOOLS_RTF_PICBPP "\\picbpp" -#define OOO_STRING_SVTOOLS_RTF_PN "\\pn" -#define OOO_STRING_SVTOOLS_RTF_PNACROSS "\\pnacross" -#define OOO_STRING_SVTOOLS_RTF_PNB "\\pnb" -#define OOO_STRING_SVTOOLS_RTF_PNCAPS "\\pncaps" -#define OOO_STRING_SVTOOLS_RTF_PNCARD "\\pncard" -#define OOO_STRING_SVTOOLS_RTF_PNCF "\\pncf" -#define OOO_STRING_SVTOOLS_RTF_PNDEC "\\pndec" -#define OOO_STRING_SVTOOLS_RTF_PNF "\\pnf" -#define OOO_STRING_SVTOOLS_RTF_PNFS "\\pnfs" -#define OOO_STRING_SVTOOLS_RTF_PNHANG "\\pnhang" -#define OOO_STRING_SVTOOLS_RTF_PNI "\\pni" -#define OOO_STRING_SVTOOLS_RTF_PNINDENT "\\pnindent" -#define OOO_STRING_SVTOOLS_RTF_PNLCLTR "\\pnlcltr" -#define OOO_STRING_SVTOOLS_RTF_PNLCRM "\\pnlcrm" -#define OOO_STRING_SVTOOLS_RTF_PNLVL "\\pnlvl" -#define OOO_STRING_SVTOOLS_RTF_PNLVLBLT "\\pnlvlblt" -#define OOO_STRING_SVTOOLS_RTF_PNLVLBODY "\\pnlvlbody" -#define OOO_STRING_SVTOOLS_RTF_PNLVLCONT "\\pnlvlcont" -#define OOO_STRING_SVTOOLS_RTF_PNNUMONCE "\\pnnumonce" -#define OOO_STRING_SVTOOLS_RTF_PNORD "\\pnord" -#define OOO_STRING_SVTOOLS_RTF_PNORDT "\\pnordt" -#define OOO_STRING_SVTOOLS_RTF_PNPREV "\\pnprev" -#define OOO_STRING_SVTOOLS_RTF_PNQC "\\pnqc" -#define OOO_STRING_SVTOOLS_RTF_PNQL "\\pnql" -#define OOO_STRING_SVTOOLS_RTF_PNQR "\\pnqr" -#define OOO_STRING_SVTOOLS_RTF_PNRESTART "\\pnrestart" -#define OOO_STRING_SVTOOLS_RTF_PNSCAPS "\\pnscaps" -#define OOO_STRING_SVTOOLS_RTF_PNSECLVL "\\pnseclvl" -#define OOO_STRING_SVTOOLS_RTF_PNSP "\\pnsp" -#define OOO_STRING_SVTOOLS_RTF_PNSTART "\\pnstart" -#define OOO_STRING_SVTOOLS_RTF_PNSTRIKE "\\pnstrike" -#define OOO_STRING_SVTOOLS_RTF_PNTEXT "\\pntext" -#define OOO_STRING_SVTOOLS_RTF_PNTXTA "\\pntxta" -#define OOO_STRING_SVTOOLS_RTF_PNTXTB "\\pntxtb" -#define OOO_STRING_SVTOOLS_RTF_PNUCLTR "\\pnucltr" -#define OOO_STRING_SVTOOLS_RTF_PNUCRM "\\pnucrm" -#define OOO_STRING_SVTOOLS_RTF_PNUL "\\pnul" -#define OOO_STRING_SVTOOLS_RTF_PNULD "\\pnuld" -#define OOO_STRING_SVTOOLS_RTF_PNULDB "\\pnuldb" -#define OOO_STRING_SVTOOLS_RTF_PNULNONE "\\pnulnone" -#define OOO_STRING_SVTOOLS_RTF_PNULW "\\pnulw" -#define OOO_STRING_SVTOOLS_RTF_PRCOLBL "\\prcolbl" -#define OOO_STRING_SVTOOLS_RTF_PRINTDATA "\\printdata" -#define OOO_STRING_SVTOOLS_RTF_PSZ "\\psz" -#define OOO_STRING_SVTOOLS_RTF_PUBAUTO "\\pubauto" -#define OOO_STRING_SVTOOLS_RTF_RESULT "\\result" -#define OOO_STRING_SVTOOLS_RTF_REVAUTH "\\revauth" -#define OOO_STRING_SVTOOLS_RTF_REVDTTM "\\revdttm" -#define OOO_STRING_SVTOOLS_RTF_REVPROT "\\revprot" -#define OOO_STRING_SVTOOLS_RTF_REVTBL "\\revtbl" -#define OOO_STRING_SVTOOLS_RTF_RSLTBMP "\\rsltbmp" -#define OOO_STRING_SVTOOLS_RTF_RSLTMERGE "\\rsltmerge" -#define OOO_STRING_SVTOOLS_RTF_RSLTPICT "\\rsltpict" -#define OOO_STRING_SVTOOLS_RTF_RSLTRTF "\\rsltrtf" -#define OOO_STRING_SVTOOLS_RTF_RSLTTXT "\\rslttxt" -#define OOO_STRING_SVTOOLS_RTF_RTLCH "\\rtlch" -#define OOO_STRING_SVTOOLS_RTF_RTLDOC "\\rtldoc" -#define OOO_STRING_SVTOOLS_RTF_RTLMARK "\\rtlmark" -#define OOO_STRING_SVTOOLS_RTF_RTLPAR "\\rtlpar" -#define OOO_STRING_SVTOOLS_RTF_RTLROW "\\rtlrow" -#define OOO_STRING_SVTOOLS_RTF_RTLSECT "\\rtlsect" -#define OOO_STRING_SVTOOLS_RTF_SEC "\\sec" -#define OOO_STRING_SVTOOLS_RTF_SECTNUM "\\sectnum" -#define OOO_STRING_SVTOOLS_RTF_SECTUNLOCKED "\\sectunlocked" -#define OOO_STRING_SVTOOLS_RTF_SLMULT "\\slmult" -#define OOO_STRING_SVTOOLS_RTF_SOFTCOL "\\softcol" -#define OOO_STRING_SVTOOLS_RTF_SOFTLHEIGHT "\\softlheight" -#define OOO_STRING_SVTOOLS_RTF_SOFTLINE "\\softline" -#define OOO_STRING_SVTOOLS_RTF_SOFTPAGE "\\softpage" -#define OOO_STRING_SVTOOLS_RTF_SPRSSPBF "\\sprsspbf" -#define OOO_STRING_SVTOOLS_RTF_SPRSTSP "\\sprstsp" -#define OOO_STRING_SVTOOLS_RTF_SUBDOCUMENT "\\subdocument" -#define OOO_STRING_SVTOOLS_RTF_SWPBDR "\\swpbdr" -#define OOO_STRING_SVTOOLS_RTF_TCN "\\tcn" -#define OOO_STRING_SVTOOLS_RTF_TRANSMF "\\transmf" -#define OOO_STRING_SVTOOLS_RTF_TRBRDRB "\\trbrdrb" -#define OOO_STRING_SVTOOLS_RTF_TRBRDRH "\\trbrdrh" -#define OOO_STRING_SVTOOLS_RTF_TRBRDRL "\\trbrdrl" -#define OOO_STRING_SVTOOLS_RTF_TRBRDRR "\\trbrdrr" -#define OOO_STRING_SVTOOLS_RTF_TRBRDRT "\\trbrdrt" -#define OOO_STRING_SVTOOLS_RTF_TRBRDRV "\\trbrdrv" -#define OOO_STRING_SVTOOLS_RTF_TRHDR "\\trhdr" -#define OOO_STRING_SVTOOLS_RTF_TRKEEP "\\trkeep" -#define OOO_STRING_SVTOOLS_RTF_TRPADDB "\\trpaddb" -#define OOO_STRING_SVTOOLS_RTF_TRPADDL "\\trpaddl" -#define OOO_STRING_SVTOOLS_RTF_TRPADDR "\\trpaddr" -#define OOO_STRING_SVTOOLS_RTF_TRPADDT "\\trpaddt" -#define OOO_STRING_SVTOOLS_RTF_TRPADDFB "\\trpaddfb" -#define OOO_STRING_SVTOOLS_RTF_TRPADDFL "\\trpaddfl" -#define OOO_STRING_SVTOOLS_RTF_TRPADDFR "\\trpaddfr" -#define OOO_STRING_SVTOOLS_RTF_TRPADDFT "\\trpaddft" -#define OOO_STRING_SVTOOLS_RTF_WRAPTRSP "\\wraptrsp" -#define OOO_STRING_SVTOOLS_RTF_XEF "\\xef" -#define OOO_STRING_SVTOOLS_RTF_ZWJ "\\zwj" -#define OOO_STRING_SVTOOLS_RTF_ZWNJ "\\zwnj" - -// neue Tokens zur 1.5 -#define OOO_STRING_SVTOOLS_RTF_ABSLOCK "\\abslock" -#define OOO_STRING_SVTOOLS_RTF_ADJUSTRIGHT "\\adjustright" -#define OOO_STRING_SVTOOLS_RTF_AFTNNCHOSUNG "\\aftnnchosung" -#define OOO_STRING_SVTOOLS_RTF_AFTNNCNUM "\\aftnncnum" -#define OOO_STRING_SVTOOLS_RTF_AFTNNDBAR "\\aftnndbar" -#define OOO_STRING_SVTOOLS_RTF_AFTNNDBNUM "\\aftnndbnum" -#define OOO_STRING_SVTOOLS_RTF_AFTNNDBNUMD "\\aftnndbnumd" -#define OOO_STRING_SVTOOLS_RTF_AFTNNDBNUMK "\\aftnndbnumk" -#define OOO_STRING_SVTOOLS_RTF_AFTNNDBNUMT "\\aftnndbnumt" -#define OOO_STRING_SVTOOLS_RTF_AFTNNGANADA "\\aftnnganada" -#define OOO_STRING_SVTOOLS_RTF_AFTNNGBNUM "\\aftnngbnum" -#define OOO_STRING_SVTOOLS_RTF_AFTNNGBNUMD "\\aftnngbnumd" -#define OOO_STRING_SVTOOLS_RTF_AFTNNGBNUMK "\\aftnngbnumk" -#define OOO_STRING_SVTOOLS_RTF_AFTNNGBNUML "\\aftnngbnuml" -#define OOO_STRING_SVTOOLS_RTF_AFTNNZODIAC "\\aftnnzodiac" -#define OOO_STRING_SVTOOLS_RTF_AFTNNZODIACD "\\aftnnzodiacd" -#define OOO_STRING_SVTOOLS_RTF_AFTNNZODIACL "\\aftnnzodiacl" -#define OOO_STRING_SVTOOLS_RTF_ANIMTEXT "\\animtext" -#define OOO_STRING_SVTOOLS_RTF_ANSICPG "\\ansicpg" -#define OOO_STRING_SVTOOLS_RTF_BACKGROUND "\\background" -#define OOO_STRING_SVTOOLS_RTF_BDBFHDR "\\bdbfhdr" -#define OOO_STRING_SVTOOLS_RTF_BLIPTAG "\\bliptag" -#define OOO_STRING_SVTOOLS_RTF_BLIPUID "\\blipuid" -#define OOO_STRING_SVTOOLS_RTF_BLIPUPI "\\blipupi" -#define OOO_STRING_SVTOOLS_RTF_BRDRART "\\brdrart" -#define OOO_STRING_SVTOOLS_RTF_BRDRDASHD "\\brdrdashd" -#define OOO_STRING_SVTOOLS_RTF_BRDRDASHDD "\\brdrdashdd" -#define OOO_STRING_SVTOOLS_RTF_BRDRDASHDOTSTR "\\brdrdashdotstr" -#define OOO_STRING_SVTOOLS_RTF_BRDRDASHSM "\\brdrdashsm" -#define OOO_STRING_SVTOOLS_RTF_BRDREMBOSS "\\brdremboss" -#define OOO_STRING_SVTOOLS_RTF_BRDRENGRAVE "\\brdrengrave" -#define OOO_STRING_SVTOOLS_RTF_BRDRFRAME "\\brdrframe" -#define OOO_STRING_SVTOOLS_RTF_BRDRTHTNLG "\\brdrthtnlg" -#define OOO_STRING_SVTOOLS_RTF_BRDRTHTNMG "\\brdrthtnmg" -#define OOO_STRING_SVTOOLS_RTF_BRDRTHTNSG "\\brdrthtnsg" -#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHLG "\\brdrtnthlg" -#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHMG "\\brdrtnthmg" -#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHSG "\\brdrtnthsg" -#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHTNLG "\\brdrtnthtnlg" -#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHTNMG "\\brdrtnthtnmg" -#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHTNSG "\\brdrtnthtnsg" -#define OOO_STRING_SVTOOLS_RTF_BRDRTRIPLE "\\brdrtriple" -#define OOO_STRING_SVTOOLS_RTF_BRDRWAVY "\\brdrwavy" -#define OOO_STRING_SVTOOLS_RTF_BRDRWAVYDB "\\brdrwavydb" -#define OOO_STRING_SVTOOLS_RTF_CATEGORY "\\category" -#define OOO_STRING_SVTOOLS_RTF_CGRID "\\cgrid" -#define OOO_STRING_SVTOOLS_RTF_CHARSCALEX "\\charscalex" -#define OOO_STRING_SVTOOLS_RTF_CHBGBDIAG "\\chbgbdiag" -#define OOO_STRING_SVTOOLS_RTF_CHBGCROSS "\\chbgcross" -#define OOO_STRING_SVTOOLS_RTF_CHBGDCROSS "\\chbgdcross" -#define OOO_STRING_SVTOOLS_RTF_CHBGDKBDIAG "\\chbgdkbdiag" -#define OOO_STRING_SVTOOLS_RTF_CHBGDKCROSS "\\chbgdkcross" -#define OOO_STRING_SVTOOLS_RTF_CHBGDKDCROSS "\\chbgdkdcross" -#define OOO_STRING_SVTOOLS_RTF_CHBGDKFDIAG "\\chbgdkfdiag" -#define OOO_STRING_SVTOOLS_RTF_CHBGDKHORIZ "\\chbgdkhoriz" -#define OOO_STRING_SVTOOLS_RTF_CHBGDKVERT "\\chbgdkvert" -#define OOO_STRING_SVTOOLS_RTF_CHBGFDIAG "\\chbgfdiag" -#define OOO_STRING_SVTOOLS_RTF_CHBGHORIZ "\\chbghoriz" -#define OOO_STRING_SVTOOLS_RTF_CHBGVERT "\\chbgvert" -#define OOO_STRING_SVTOOLS_RTF_CHBRDR "\\chbrdr" -#define OOO_STRING_SVTOOLS_RTF_CHCBPAT "\\chcbpat" -#define OOO_STRING_SVTOOLS_RTF_CHCFPAT "\\chcfpat" -#define OOO_STRING_SVTOOLS_RTF_CHSHDNG "\\chshdng" -#define OOO_STRING_SVTOOLS_RTF_CLPADL "\\clpadl" -#define OOO_STRING_SVTOOLS_RTF_CLPADT "\\clpadt" -#define OOO_STRING_SVTOOLS_RTF_CLPADB "\\clpadb" -#define OOO_STRING_SVTOOLS_RTF_CLPADR "\\clpadr" -#define OOO_STRING_SVTOOLS_RTF_CLPADFL "\\clpadfl" -#define OOO_STRING_SVTOOLS_RTF_CLPADFT "\\clpadft" -#define OOO_STRING_SVTOOLS_RTF_CLPADFB "\\clpadfb" -#define OOO_STRING_SVTOOLS_RTF_CLPADFR "\\clpadfr" -#define OOO_STRING_SVTOOLS_RTF_CLTXLRTB "\\cltxlrtb" -#define OOO_STRING_SVTOOLS_RTF_CLTXTBRL "\\cltxtbrl" -#define OOO_STRING_SVTOOLS_RTF_CLVERTALB "\\clvertalb" -#define OOO_STRING_SVTOOLS_RTF_CLVERTALC "\\clvertalc" -#define OOO_STRING_SVTOOLS_RTF_CLVERTALT "\\clvertalt" -#define OOO_STRING_SVTOOLS_RTF_CLVMGF "\\clvmgf" -#define OOO_STRING_SVTOOLS_RTF_CLVMRG "\\clvmrg" -#define OOO_STRING_SVTOOLS_RTF_CLTXTBRLV "\\cltxtbrlv" -#define OOO_STRING_SVTOOLS_RTF_CLTXBTLR "\\cltxbtlr" -#define OOO_STRING_SVTOOLS_RTF_CLTXLRTBV "\\cltxlrtbv" -#define OOO_STRING_SVTOOLS_RTF_COMPANY "\\company" -#define OOO_STRING_SVTOOLS_RTF_CRAUTH "\\crauth" -#define OOO_STRING_SVTOOLS_RTF_CRDATE "\\crdate" -#define OOO_STRING_SVTOOLS_RTF_DATE "\\date" -#define OOO_STRING_SVTOOLS_RTF_DEFLANGFE "\\deflangfe" -#define OOO_STRING_SVTOOLS_RTF_DFRAUTH "\\dfrauth" -#define OOO_STRING_SVTOOLS_RTF_DFRDATE "\\dfrdate" -#define OOO_STRING_SVTOOLS_RTF_DFRSTART "\\dfrstart" -#define OOO_STRING_SVTOOLS_RTF_DFRSTOP "\\dfrstop" -#define OOO_STRING_SVTOOLS_RTF_DFRXST "\\dfrxst" -#define OOO_STRING_SVTOOLS_RTF_DGMARGIN "\\dgmargin" -#define OOO_STRING_SVTOOLS_RTF_DNTBLNSBDB "\\dntblnsbdb" -#define OOO_STRING_SVTOOLS_RTF_DOCTYPE "\\doctype" -#define OOO_STRING_SVTOOLS_RTF_DOCVAR "\\docvar" -#define OOO_STRING_SVTOOLS_RTF_DPCODESCENT "\\dpcodescent" -#define OOO_STRING_SVTOOLS_RTF_EMBO "\\embo" -#define OOO_STRING_SVTOOLS_RTF_EMFBLIP "\\emfblip" -#define OOO_STRING_SVTOOLS_RTF_EXPSHRTN "\\expshrtn" -#define OOO_STRING_SVTOOLS_RTF_FAAUTO "\\faauto" -#define OOO_STRING_SVTOOLS_RTF_FBIAS "\\fbias" -#define OOO_STRING_SVTOOLS_RTF_FFDEFRES "\\ffdefres" -#define OOO_STRING_SVTOOLS_RTF_FFDEFTEXT "\\ffdeftext" -#define OOO_STRING_SVTOOLS_RTF_FFENTRYMCR "\\ffentrymcr" -#define OOO_STRING_SVTOOLS_RTF_FFEXITMCR "\\ffexitmcr" -#define OOO_STRING_SVTOOLS_RTF_FFFORMAT "\\ffformat" -#define OOO_STRING_SVTOOLS_RTF_FFHASLISTBOX "\\ffhaslistbox" -#define OOO_STRING_SVTOOLS_RTF_FFHELPTEXT "\\ffhelptext" -#define OOO_STRING_SVTOOLS_RTF_FFHPS "\\ffhps" -#define OOO_STRING_SVTOOLS_RTF_FFL "\\ffl" -#define OOO_STRING_SVTOOLS_RTF_FFMAXLEN "\\ffmaxlen" -#define OOO_STRING_SVTOOLS_RTF_FFNAME "\\ffname" -#define OOO_STRING_SVTOOLS_RTF_FFOWNHELP "\\ffownhelp" -#define OOO_STRING_SVTOOLS_RTF_FFOWNSTAT "\\ffownstat" -#define OOO_STRING_SVTOOLS_RTF_FFPROT "\\ffprot" -#define OOO_STRING_SVTOOLS_RTF_FFRECALC "\\ffrecalc" -#define OOO_STRING_SVTOOLS_RTF_FFRES "\\ffres" -#define OOO_STRING_SVTOOLS_RTF_FFSIZE "\\ffsize" -#define OOO_STRING_SVTOOLS_RTF_FFSTATTEXT "\\ffstattext" -#define OOO_STRING_SVTOOLS_RTF_FFTYPE "\\fftype" -#define OOO_STRING_SVTOOLS_RTF_FFTYPETXT "\\fftypetxt" -#define OOO_STRING_SVTOOLS_RTF_FLDTYPE "\\fldtype" -#define OOO_STRING_SVTOOLS_RTF_FNAME "\\fname" -#define OOO_STRING_SVTOOLS_RTF_FORMFIELD "\\formfield" -#define OOO_STRING_SVTOOLS_RTF_FROMTEXT "\\fromtext" -#define OOO_STRING_SVTOOLS_RTF_FTNNCHOSUNG "\\ftnnchosung" -#define OOO_STRING_SVTOOLS_RTF_FTNNCNUM "\\ftnncnum" -#define OOO_STRING_SVTOOLS_RTF_FTNNDBAR "\\ftnndbar" -#define OOO_STRING_SVTOOLS_RTF_FTNNDBNUM "\\ftnndbnum" -#define OOO_STRING_SVTOOLS_RTF_FTNNDBNUMD "\\ftnndbnumd" -#define OOO_STRING_SVTOOLS_RTF_FTNNDBNUMK "\\ftnndbnumk" -#define OOO_STRING_SVTOOLS_RTF_FTNNDBNUMT "\\ftnndbnumt" -#define OOO_STRING_SVTOOLS_RTF_FTNNGANADA "\\ftnnganada" -#define OOO_STRING_SVTOOLS_RTF_FTNNGBNUM "\\ftnngbnum" -#define OOO_STRING_SVTOOLS_RTF_FTNNGBNUMD "\\ftnngbnumd" -#define OOO_STRING_SVTOOLS_RTF_FTNNGBNUMK "\\ftnngbnumk" -#define OOO_STRING_SVTOOLS_RTF_FTNNGBNUML "\\ftnngbnuml" -#define OOO_STRING_SVTOOLS_RTF_FTNNZODIAC "\\ftnnzodiac" -#define OOO_STRING_SVTOOLS_RTF_FTNNZODIACD "\\ftnnzodiacd" -#define OOO_STRING_SVTOOLS_RTF_FTNNZODIACL "\\ftnnzodiacl" -#define OOO_STRING_SVTOOLS_RTF_G "\\g" -#define OOO_STRING_SVTOOLS_RTF_GCW "\\gcw" -#define OOO_STRING_SVTOOLS_RTF_GRIDTBL "\\gridtbl" -#define OOO_STRING_SVTOOLS_RTF_HIGHLIGHT "\\highlight" -#define OOO_STRING_SVTOOLS_RTF_HLFR "\\hlfr" -#define OOO_STRING_SVTOOLS_RTF_HLINKBASE "\\hlinkbase" -#define OOO_STRING_SVTOOLS_RTF_HLLOC "\\hlloc" -#define OOO_STRING_SVTOOLS_RTF_HLSRC "\\hlsrc" -#define OOO_STRING_SVTOOLS_RTF_ILVL "\\ilvl" -#define OOO_STRING_SVTOOLS_RTF_IMPR "\\impr" -#define OOO_STRING_SVTOOLS_RTF_JPEGBLIP "\\jpegblip" -#define OOO_STRING_SVTOOLS_RTF_LEVELFOLLOW "\\levelfollow" -#define OOO_STRING_SVTOOLS_RTF_LEVELINDENT "\\levelindent" -#define OOO_STRING_SVTOOLS_RTF_LEVELJC "\\leveljc" -#define OOO_STRING_SVTOOLS_RTF_LEVELLEGAL "\\levellegal" -#define OOO_STRING_SVTOOLS_RTF_LEVELNFC "\\levelnfc" -#define OOO_STRING_SVTOOLS_RTF_LEVELNORESTART "\\levelnorestart" -#define OOO_STRING_SVTOOLS_RTF_LEVELNUMBERS "\\levelnumbers" -#define OOO_STRING_SVTOOLS_RTF_LEVELOLD "\\levelold" -#define OOO_STRING_SVTOOLS_RTF_LEVELPREV "\\levelprev" -#define OOO_STRING_SVTOOLS_RTF_LEVELPREVSPACE "\\levelprevspace" -#define OOO_STRING_SVTOOLS_RTF_LEVELSPACE "\\levelspace" -#define OOO_STRING_SVTOOLS_RTF_LEVELSTARTAT "\\levelstartat" -#define OOO_STRING_SVTOOLS_RTF_LEVELTEXT "\\leveltext" -#define OOO_STRING_SVTOOLS_RTF_LINKVAL "\\linkval" -#define OOO_STRING_SVTOOLS_RTF_LIST "\\list" -#define OOO_STRING_SVTOOLS_RTF_LISTID "\\listid" -#define OOO_STRING_SVTOOLS_RTF_LISTLEVEL "\\listlevel" -#define OOO_STRING_SVTOOLS_RTF_LISTNAME "\\listname" -#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDE "\\listoverride" -#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDECOUNT "\\listoverridecount" -#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDEFORMAT "\\listoverrideformat" -#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDESTART "\\listoverridestart" -#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDETABLE "\\listoverridetable" -#define OOO_STRING_SVTOOLS_RTF_LISTRESTARTHDN "\\listrestarthdn" -#define OOO_STRING_SVTOOLS_RTF_LISTSIMPLE "\\listsimple" -#define OOO_STRING_SVTOOLS_RTF_LISTTABLE "\\listtable" -#define OOO_STRING_SVTOOLS_RTF_LISTTEMPLATEID "\\listtemplateid" -#define OOO_STRING_SVTOOLS_RTF_LISTTEXT "\\listtext" -#define OOO_STRING_SVTOOLS_RTF_LS "\\ls" -#define OOO_STRING_SVTOOLS_RTF_LYTEXCTTP "\\lytexcttp" -#define OOO_STRING_SVTOOLS_RTF_LYTPRTMET "\\lytprtmet" -#define OOO_STRING_SVTOOLS_RTF_MANAGER "\\manager" -#define OOO_STRING_SVTOOLS_RTF_MSMCAP "\\msmcap" -#define OOO_STRING_SVTOOLS_RTF_NOFCHARSWS "\\nofcharsws" -#define OOO_STRING_SVTOOLS_RTF_NOLEAD "\\nolead" -#define OOO_STRING_SVTOOLS_RTF_NONSHPPICT "\\nonshppict" -#define OOO_STRING_SVTOOLS_RTF_NOSECTEXPAND "\\nosectexpand" -#define OOO_STRING_SVTOOLS_RTF_NOSNAPLINEGRID "\\nosnaplinegrid" -#define OOO_STRING_SVTOOLS_RTF_NOSPACEFORUL "\\nospaceforul" -#define OOO_STRING_SVTOOLS_RTF_NOULTRLSPC "\\noultrlspc" -#define OOO_STRING_SVTOOLS_RTF_NOXLATTOYEN "\\noxlattoyen" -#define OOO_STRING_SVTOOLS_RTF_OBJATTPH "\\objattph" -#define OOO_STRING_SVTOOLS_RTF_OBJHTML "\\objhtml" -#define OOO_STRING_SVTOOLS_RTF_OBJOCX "\\objocx" -#define OOO_STRING_SVTOOLS_RTF_OLDLINEWRAP "\\oldlinewrap" -#define OOO_STRING_SVTOOLS_RTF_OUTLINELEVEL "\\outlinelevel" -#define OOO_STRING_SVTOOLS_RTF_OVERLAY "\\overlay" -#define OOO_STRING_SVTOOLS_RTF_PANOSE "\\panose" -#define OOO_STRING_SVTOOLS_RTF_PGBRDRB "\\pgbrdrb" -#define OOO_STRING_SVTOOLS_RTF_PGBRDRFOOT "\\pgbrdrfoot" -#define OOO_STRING_SVTOOLS_RTF_PGBRDRHEAD "\\pgbrdrhead" -#define OOO_STRING_SVTOOLS_RTF_PGBRDRL "\\pgbrdrl" -#define OOO_STRING_SVTOOLS_RTF_PGBRDROPT "\\pgbrdropt" -#define OOO_STRING_SVTOOLS_RTF_PGBRDRR "\\pgbrdrr" -#define OOO_STRING_SVTOOLS_RTF_PGBRDRSNAP "\\pgbrdrsnap" -#define OOO_STRING_SVTOOLS_RTF_PGBRDRT "\\pgbrdrt" -#define OOO_STRING_SVTOOLS_RTF_PGNCHOSUNG "\\pgnchosung" -#define OOO_STRING_SVTOOLS_RTF_PGNCNUM "\\pgncnum" -#define OOO_STRING_SVTOOLS_RTF_PGNDBNUMK "\\pgndbnumk" -#define OOO_STRING_SVTOOLS_RTF_PGNDBNUMT "\\pgndbnumt" -#define OOO_STRING_SVTOOLS_RTF_PGNGANADA "\\pgnganada" -#define OOO_STRING_SVTOOLS_RTF_PGNGBNUM "\\pgngbnum" -#define OOO_STRING_SVTOOLS_RTF_PGNGBNUMD "\\pgngbnumd" -#define OOO_STRING_SVTOOLS_RTF_PGNGBNUMK "\\pgngbnumk" -#define OOO_STRING_SVTOOLS_RTF_PGNGBNUML "\\pgngbnuml" -#define OOO_STRING_SVTOOLS_RTF_PGNZODIAC "\\pgnzodiac" -#define OOO_STRING_SVTOOLS_RTF_PGNZODIACD "\\pgnzodiacd" -#define OOO_STRING_SVTOOLS_RTF_PGNZODIACL "\\pgnzodiacl" -#define OOO_STRING_SVTOOLS_RTF_PICPROP "\\picprop" -#define OOO_STRING_SVTOOLS_RTF_PNAIUEO "\\pnaiueo" -#define OOO_STRING_SVTOOLS_RTF_PNAIUEOD "\\pnaiueod" -#define OOO_STRING_SVTOOLS_RTF_PNCHOSUNG "\\pnchosung" -#define OOO_STRING_SVTOOLS_RTF_PNDBNUMD "\\pndbnumd" -#define OOO_STRING_SVTOOLS_RTF_PNDBNUMK "\\pndbnumk" -#define OOO_STRING_SVTOOLS_RTF_PNDBNUML "\\pndbnuml" -#define OOO_STRING_SVTOOLS_RTF_PNDBNUMT "\\pndbnumt" -#define OOO_STRING_SVTOOLS_RTF_PNGANADA "\\pnganada" -#define OOO_STRING_SVTOOLS_RTF_PNGBLIP "\\pngblip" -#define OOO_STRING_SVTOOLS_RTF_PNGBNUM "\\pngbnum" -#define OOO_STRING_SVTOOLS_RTF_PNGBNUMD "\\pngbnumd" -#define OOO_STRING_SVTOOLS_RTF_PNGBNUMK "\\pngbnumk" -#define OOO_STRING_SVTOOLS_RTF_PNGBNUML "\\pngbnuml" -#define OOO_STRING_SVTOOLS_RTF_PNRAUTH "\\pnrauth" -#define OOO_STRING_SVTOOLS_RTF_PNRDATE "\\pnrdate" -#define OOO_STRING_SVTOOLS_RTF_PNRNFC "\\pnrnfc" -#define OOO_STRING_SVTOOLS_RTF_PNRNOT "\\pnrnot" -#define OOO_STRING_SVTOOLS_RTF_PNRPNBR "\\pnrpnbr" -#define OOO_STRING_SVTOOLS_RTF_PNRRGB "\\pnrrgb" -#define OOO_STRING_SVTOOLS_RTF_PNRSTART "\\pnrstart" -#define OOO_STRING_SVTOOLS_RTF_PNRSTOP "\\pnrstop" -#define OOO_STRING_SVTOOLS_RTF_PNRXST "\\pnrxst" -#define OOO_STRING_SVTOOLS_RTF_PNZODIAC "\\pnzodiac" -#define OOO_STRING_SVTOOLS_RTF_PNZODIACD "\\pnzodiacd" -#define OOO_STRING_SVTOOLS_RTF_PNZODIACL "\\pnzodiacl" -#define OOO_STRING_SVTOOLS_RTF_LFOLEVEL "\\lfolevel" -#define OOO_STRING_SVTOOLS_RTF_POSYIN "\\posyin" -#define OOO_STRING_SVTOOLS_RTF_POSYOUT "\\posyout" -#define OOO_STRING_SVTOOLS_RTF_PRIVATE "\\private" -#define OOO_STRING_SVTOOLS_RTF_PROPNAME "\\propname" -#define OOO_STRING_SVTOOLS_RTF_PROPTYPE "\\proptype" -#define OOO_STRING_SVTOOLS_RTF_REVAUTHDEL "\\revauthdel" -#define OOO_STRING_SVTOOLS_RTF_REVDTTMDEL "\\revdttmdel" -#define OOO_STRING_SVTOOLS_RTF_SAUTOUPD "\\sautoupd" -#define OOO_STRING_SVTOOLS_RTF_SECTDEFAULTCL "\\sectdefaultcl" -#define OOO_STRING_SVTOOLS_RTF_SECTEXPAND "\\sectexpand" -#define OOO_STRING_SVTOOLS_RTF_SECTLINEGRID "\\sectlinegrid" -#define OOO_STRING_SVTOOLS_RTF_SECTSPECIFYCL "\\sectspecifycl" -#define OOO_STRING_SVTOOLS_RTF_SECTSPECIFYL "\\sectspecifyl" -#define OOO_STRING_SVTOOLS_RTF_SHIDDEN "\\shidden" -#define OOO_STRING_SVTOOLS_RTF_SHPBOTTOM "\\shpbottom" -#define OOO_STRING_SVTOOLS_RTF_SHPBXCOLUMN "\\shpbxcolumn" -#define OOO_STRING_SVTOOLS_RTF_SHPBXMARGIN "\\shpbxmargin" -#define OOO_STRING_SVTOOLS_RTF_SHPBXPAGE "\\shpbxpage" -#define OOO_STRING_SVTOOLS_RTF_SHPBYMARGIN "\\shpbymargin" -#define OOO_STRING_SVTOOLS_RTF_SHPBYPAGE "\\shpbypage" -#define OOO_STRING_SVTOOLS_RTF_SHPBYPARA "\\shpbypara" -#define OOO_STRING_SVTOOLS_RTF_SHPFBLWTXT "\\shpfblwtxt" -#define OOO_STRING_SVTOOLS_RTF_SHPFHDR "\\shpfhdr" -#define OOO_STRING_SVTOOLS_RTF_SHPGRP "\\shpgrp" -#define OOO_STRING_SVTOOLS_RTF_SHPLEFT "\\shpleft" -#define OOO_STRING_SVTOOLS_RTF_SHPLID "\\shplid" -#define OOO_STRING_SVTOOLS_RTF_SHPLOCKANCHOR "\\shplockanchor" -#define OOO_STRING_SVTOOLS_RTF_SHPPICT "\\shppict" -#define OOO_STRING_SVTOOLS_RTF_SHPRIGHT "\\shpright" -#define OOO_STRING_SVTOOLS_RTF_SHPRSLT "\\shprslt" -#define OOO_STRING_SVTOOLS_RTF_SHPTOP "\\shptop" -#define OOO_STRING_SVTOOLS_RTF_SHPTXT "\\shptxt" -#define OOO_STRING_SVTOOLS_RTF_SHPWRK "\\shpwrk" -#define OOO_STRING_SVTOOLS_RTF_SHPWR "\\shpwr" -#define OOO_STRING_SVTOOLS_RTF_SHPZ "\\shpz" -#define OOO_STRING_SVTOOLS_RTF_SPRSBSP "\\sprsbsp" -#define OOO_STRING_SVTOOLS_RTF_SPRSLNSP "\\sprslnsp" -#define OOO_STRING_SVTOOLS_RTF_SPRSTSM "\\sprstsm" -#define OOO_STRING_SVTOOLS_RTF_STATICVAL "\\staticval" -#define OOO_STRING_SVTOOLS_RTF_STEXTFLOW "\\stextflow" -#define OOO_STRING_SVTOOLS_RTF_STRIKED "\\striked" -#define OOO_STRING_SVTOOLS_RTF_SUBFONTBYSIZE "\\subfontbysize" -#define OOO_STRING_SVTOOLS_RTF_TCELLD "\\tcelld" -#define OOO_STRING_SVTOOLS_RTF_TIME "\\time" -#define OOO_STRING_SVTOOLS_RTF_TRUNCATEFONTHEIGHT "\\truncatefontheight" -#define OOO_STRING_SVTOOLS_RTF_UC "\\uc" -#define OOO_STRING_SVTOOLS_RTF_UD "\\ud" -#define OOO_STRING_SVTOOLS_RTF_ULDASH "\\uldash" -#define OOO_STRING_SVTOOLS_RTF_ULDASHD "\\uldashd" -#define OOO_STRING_SVTOOLS_RTF_ULDASHDD "\\uldashdd" -#define OOO_STRING_SVTOOLS_RTF_ULTH "\\ulth" -#define OOO_STRING_SVTOOLS_RTF_ULWAVE "\\ulwave" -#define OOO_STRING_SVTOOLS_RTF_ULC "\\ulc" -#define OOO_STRING_SVTOOLS_RTF_U "\\u" -#define OOO_STRING_SVTOOLS_RTF_UPR "\\upr" -#define OOO_STRING_SVTOOLS_RTF_USERPROPS "\\userprops" -#define OOO_STRING_SVTOOLS_RTF_VIEWKIND "\\viewkind" -#define OOO_STRING_SVTOOLS_RTF_VIEWSCALE "\\viewscale" -#define OOO_STRING_SVTOOLS_RTF_VIEWZK "\\viewzk" -#define OOO_STRING_SVTOOLS_RTF_WIDCTLPAR "\\widctlpar" -#define OOO_STRING_SVTOOLS_RTF_WINDOWCAPTION "\\windowcaption" -#define OOO_STRING_SVTOOLS_RTF_WPEQN "\\wpeqn" -#define OOO_STRING_SVTOOLS_RTF_WPJST "\\wpjst" -#define OOO_STRING_SVTOOLS_RTF_WPSP "\\wpsp" -#define OOO_STRING_SVTOOLS_RTF_YXE "\\yxe" -#define OOO_STRING_SVTOOLS_RTF_FRMTXLRTB "\\frmtxlrtb" -#define OOO_STRING_SVTOOLS_RTF_FRMTXTBRL "\\frmtxtbrl" -#define OOO_STRING_SVTOOLS_RTF_FRMTXBTLR "\\frmtxbtlr" -#define OOO_STRING_SVTOOLS_RTF_FRMTXLRTBV "\\frmtxlrtbv" -#define OOO_STRING_SVTOOLS_RTF_FRMTXTBRLV "\\frmtxtbrlv" - -// MS-2000 Tokens -#define OOO_STRING_SVTOOLS_RTF_ULTHD "\\ulthd" -#define OOO_STRING_SVTOOLS_RTF_ULTHDASH "\\ulthdash" -#define OOO_STRING_SVTOOLS_RTF_ULLDASH "\\ulldash" -#define OOO_STRING_SVTOOLS_RTF_ULTHLDASH "\\ulthldash" -#define OOO_STRING_SVTOOLS_RTF_ULTHDASHD "\\ulthdashd" -#define OOO_STRING_SVTOOLS_RTF_ULTHDASHDD "\\ulthdashdd" -#define OOO_STRING_SVTOOLS_RTF_ULHWAVE "\\ulhwave" -#define OOO_STRING_SVTOOLS_RTF_ULULDBWAVE "\\ululdbwave" -#define OOO_STRING_SVTOOLS_RTF_LOCH "\\loch" -#define OOO_STRING_SVTOOLS_RTF_HICH "\\hich" -#define OOO_STRING_SVTOOLS_RTF_DBCH "\\dbch" -#define OOO_STRING_SVTOOLS_RTF_LANGFE "\\langfe" -#define OOO_STRING_SVTOOLS_RTF_ADEFLANG "\\adeflang" -#define OOO_STRING_SVTOOLS_RTF_ADEFF "\\adeff" -#define OOO_STRING_SVTOOLS_RTF_ACCNONE "\\accnone" -#define OOO_STRING_SVTOOLS_RTF_ACCDOT "\\accdot" -#define OOO_STRING_SVTOOLS_RTF_ACCCOMMA "\\acccomma" -#define OOO_STRING_SVTOOLS_RTF_TWOINONE "\\twoinone" -#define OOO_STRING_SVTOOLS_RTF_HORZVERT "\\horzvert" -#define OOO_STRING_SVTOOLS_RTF_FAHANG "\\fahang" -#define OOO_STRING_SVTOOLS_RTF_FAVAR "\\favar" -#define OOO_STRING_SVTOOLS_RTF_FACENTER "\\facenter" -#define OOO_STRING_SVTOOLS_RTF_FAROMAN "\\faroman" -#define OOO_STRING_SVTOOLS_RTF_FAFIXED "\\fafixed" -#define OOO_STRING_SVTOOLS_RTF_NOCWRAP "\\nocwrap" -#define OOO_STRING_SVTOOLS_RTF_NOOVERFLOW "\\nooverflow" -#define OOO_STRING_SVTOOLS_RTF_ASPALPHA "\\aspalpha" - -// SWG spezifische Attribute -#define OOO_STRING_SVTOOLS_RTF_GRFALIGNV "\\grfalignv" -#define OOO_STRING_SVTOOLS_RTF_GRFALIGNH "\\grfalignh" -#define OOO_STRING_SVTOOLS_RTF_GRFMIRROR "\\grfmirror" -#define OOO_STRING_SVTOOLS_RTF_HEADERYB "\\headeryb" -#define OOO_STRING_SVTOOLS_RTF_HEADERXL "\\headerxl" -#define OOO_STRING_SVTOOLS_RTF_HEADERXR "\\headerxr" -#define OOO_STRING_SVTOOLS_RTF_FOOTERYT "\\footeryt" -#define OOO_STRING_SVTOOLS_RTF_FOOTERXL "\\footerxl" -#define OOO_STRING_SVTOOLS_RTF_FOOTERXR "\\footerxr" -#define OOO_STRING_SVTOOLS_RTF_HEADERYH "\\headeryh" -#define OOO_STRING_SVTOOLS_RTF_FOOTERYH "\\footeryh" -#define OOO_STRING_SVTOOLS_RTF_BALANCEDCOLUMN "\\swcolmnblnc" -#define OOO_STRING_SVTOOLS_RTF_UPDNPROP "\\updnprop" -#define OOO_STRING_SVTOOLS_RTF_PRTDATA "\\prtdata" -#define OOO_STRING_SVTOOLS_RTF_BKMKKEY "\\bkmkkey" - -// Attribute fuer die freifliegenden Rahmen -#define OOO_STRING_SVTOOLS_RTF_FLYPRINT "\\flyprint" -#define OOO_STRING_SVTOOLS_RTF_FLYOPAQUE "\\flyopaque" -#define OOO_STRING_SVTOOLS_RTF_FLYPRTCTD "\\flyprtctd" -#define OOO_STRING_SVTOOLS_RTF_FLYMAINCNT "\\flymaincnt" -#define OOO_STRING_SVTOOLS_RTF_FLYVERT "\\flyvert" -#define OOO_STRING_SVTOOLS_RTF_FLYHORZ "\\flyhorz" -#define OOO_STRING_SVTOOLS_RTF_DFRMTXTL "\\dfrmtxtl" -#define OOO_STRING_SVTOOLS_RTF_DFRMTXTR "\\dfrmtxtr" -#define OOO_STRING_SVTOOLS_RTF_DFRMTXTU "\\dfrmtxtu" -#define OOO_STRING_SVTOOLS_RTF_DFRMTXTW "\\dfrmtxtw" -#define OOO_STRING_SVTOOLS_RTF_FLYANCHOR "\\flyanchor" -#define OOO_STRING_SVTOOLS_RTF_FLYCNTNT "\\flycntnt" -#define OOO_STRING_SVTOOLS_RTF_FLYCOLUMN "\\flycolumn" -#define OOO_STRING_SVTOOLS_RTF_FLYPAGE "\\flypage" -#define OOO_STRING_SVTOOLS_RTF_FLYINPARA "\\flyinpara" -#define OOO_STRING_SVTOOLS_RTF_BRDBOX "\\brdbox" -#define OOO_STRING_SVTOOLS_RTF_BRDLNCOL "\\brdlncol" -#define OOO_STRING_SVTOOLS_RTF_BRDLNIN "\\brdlnin" -#define OOO_STRING_SVTOOLS_RTF_BRDLNOUT "\\brdlnout" -#define OOO_STRING_SVTOOLS_RTF_BRDLNDIST "\\brdlndist" -#define OOO_STRING_SVTOOLS_RTF_SHADOW "\\shadow" -#define OOO_STRING_SVTOOLS_RTF_SHDWDIST "\\shdwdist" -#define OOO_STRING_SVTOOLS_RTF_SHDWSTYLE "\\shdwstyle" -#define OOO_STRING_SVTOOLS_RTF_SHDWCOL "\\shdwcol" -#define OOO_STRING_SVTOOLS_RTF_SHDWFCOL "\\shdwfcol" -#define OOO_STRING_SVTOOLS_RTF_PGDSCTBL "\\pgdsctbl" -#define OOO_STRING_SVTOOLS_RTF_PGDSC "\\pgdsc" -#define OOO_STRING_SVTOOLS_RTF_PGDSCUSE "\\pgdscuse" -#define OOO_STRING_SVTOOLS_RTF_PGDSCNXT "\\pgdscnxt" -#define OOO_STRING_SVTOOLS_RTF_HYPHEN "\\hyphen" -#define OOO_STRING_SVTOOLS_RTF_HYPHLEAD "\\hyphlead" -#define OOO_STRING_SVTOOLS_RTF_HYPHTRAIL "\\hyphtrail" -#define OOO_STRING_SVTOOLS_RTF_HYPHMAX "\\hyphmax" -#define OOO_STRING_SVTOOLS_RTF_TLSWG "\\tlswg" -#define OOO_STRING_SVTOOLS_RTF_PGBRK "\\pgbrk" -#define OOO_STRING_SVTOOLS_RTF_PGDSCNO "\\pgdscno" -#define OOO_STRING_SVTOOLS_RTF_SOUTLVL "\\soutlvl" -#define OOO_STRING_SVTOOLS_RTF_SHP "\\shp" -#define OOO_STRING_SVTOOLS_RTF_SN "\\sn" -#define OOO_STRING_SVTOOLS_RTF_SV "\\sv" - -// Support for overline attributes -#define OOO_STRING_SVTOOLS_RTF_OL "\\ol" -#define OOO_STRING_SVTOOLS_RTF_OLD "\\old" -#define OOO_STRING_SVTOOLS_RTF_OLDB "\\oldb" -#define OOO_STRING_SVTOOLS_RTF_OLNONE "\\olnone" -#define OOO_STRING_SVTOOLS_RTF_OLW "\\olw" -#define OOO_STRING_SVTOOLS_RTF_OLDASH "\\oldash" -#define OOO_STRING_SVTOOLS_RTF_OLDASHD "\\oldashd" -#define OOO_STRING_SVTOOLS_RTF_OLDASHDD "\\oldashdd" -#define OOO_STRING_SVTOOLS_RTF_OLTH "\\olth" -#define OOO_STRING_SVTOOLS_RTF_OLWAVE "\\olwave" -#define OOO_STRING_SVTOOLS_RTF_OLC "\\olc" -#define OOO_STRING_SVTOOLS_RTF_OLTHD "\\olthd" -#define OOO_STRING_SVTOOLS_RTF_OLTHDASH "\\olthdash" -#define OOO_STRING_SVTOOLS_RTF_OLLDASH "\\olldash" -#define OOO_STRING_SVTOOLS_RTF_OLTHLDASH "\\olthldash" -#define OOO_STRING_SVTOOLS_RTF_OLTHDASHD "\\olthdashd" -#define OOO_STRING_SVTOOLS_RTF_OLTHDASHDD "\\olthdashdd" -#define OOO_STRING_SVTOOLS_RTF_OLHWAVE "\\olhwave" -#define OOO_STRING_SVTOOLS_RTF_OLOLDBWAVE "\\ololdbwave" - -#endif // _RTFKEYWD_HXX diff --git a/svtools/source/svrtf/rtfout.hxx b/svtools/source/svrtf/rtfout.hxx deleted file mode 100644 index ba20add1d968..000000000000 --- a/svtools/source/svrtf/rtfout.hxx +++ /dev/null @@ -1,70 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: rtfout.hxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _RTFOUT_HXX -#define _RTFOUT_HXX - -#include "svtools/svtdllapi.h" -#include - -#ifndef _RTL_TEXTENC_H_ -#include -#endif - -class String; -class SvStream; - -class SVT_DLLPUBLIC RTFOutFuncs -{ -public: -#if defined(MAC) || defined(UNX) - static const sal_Char sNewLine; // nur \012 oder \015 -#else - static const sal_Char __FAR_DATA sNewLine[]; // \015\012 -#endif - - static SvStream& Out_Char( SvStream&, sal_Unicode cChar, - int *pUCMode, - rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252, - BOOL bWriteHelpFile = FALSE ); - static SvStream& Out_String( SvStream&, const String&, - rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252, - BOOL bWriteHelpFile = FALSE ); - static SvStream& Out_Fontname( SvStream&, const String&, - rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252, - BOOL bWriteHelpFile = FALSE ); - - static SvStream& Out_Hex( SvStream&, ULONG nHex, BYTE nLen ); -}; - - -#endif - - diff --git a/svtools/source/svrtf/rtftoken.h b/svtools/source/svrtf/rtftoken.h deleted file mode 100644 index c7981361ffc9..000000000000 --- a/svtools/source/svrtf/rtftoken.h +++ /dev/null @@ -1,1276 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: rtftoken.h,v $ - * $Revision: 1.13.134.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ - -#ifndef _RTFTOKEN_H -#define _RTFTOKEN_H - -class String; - -// suche die TokenID zu dem Token -int GetRTFToken( const String& rSearch ); - -enum RTF_TOKEN_RANGES { - RTF_NOGROUP = 0x0100, - RTF_DOCFMT = 0x0200, - RTF_SECTFMT = 0x0300, - RTF_PARFMT = 0x0400, - RTF_TABSTOPDEF = 0x0500, - RTF_BRDRDEF = 0x0600, - RTF_CHRFMT = 0x0700, - RTF_SPECCHAR = 0x0800, - RTF_APOCTL = 0x0900, - RTF_SHADINGDEF = 0x0A00, - // free = 0x0B00, - RTF_DRAWOBJECTS = 0x0C00, - RTF_OBJECTS = 0x0D00, - RTF_NUMBULLETS = 0x0E00, - - // !!! kann hinein verodert werden (Border/Background) !!!! - RTF_TABLEDEF = 0x1000, - - // !!! kann hinein verodert werden (Border/Tab) !!!! - RTF_SWGDEFS = 0x4000 -}; - -enum RTF_TOKEN_IDS { - - RTF_TEXTTOKEN = RTF_NOGROUP, - RTF_SINGLECHAR, - RTF_UNKNOWNCONTROL, - RTF_UNKNOWNDATA, - - RTF_RTF, - RTF_ANSITYPE, - RTF_MACTYPE, - RTF_PCTYPE, - RTF_PCATYPE, - RTF_NEXTTYPE, - - RTF_STYLESHEET, - RTF_SBASEDON, - RTF_SNEXT, - RTF_SHIDDEN, - RTF_SAUTOUPD, - - RTF_KEYCODE, - RTF_FNKEY, - RTF_ALTKEY, - RTF_SHIFTKEY, - RTF_CTRLKEY, - - RTF_FONTTBL, - RTF_DEFF, - RTF_FNIL, - RTF_FROMAN, - RTF_FSWISS, - RTF_FMODERN, - RTF_FSCRIPT, - RTF_FDECOR, - RTF_FTECH, - - RTF_COLORTBL, - RTF_RED, - RTF_GREEN, - RTF_BLUE, - - RTF_INFO, - RTF_TITLE, - RTF_SUBJECT, - RTF_AUTHOR, - RTF_OPERATOR, - RTF_KEYWORDS, - RTF_COMMENT, - RTF_VERSION, - RTF_DOCCOMM, - RTF_VERN, - RTF_CREATIM, - RTF_REVTIM, - RTF_PRINTIM, - RTF_BUPTIM, - RTF_EDMINS, - RTF_NOFPAGES, - RTF_NOFWORDS, - RTF_NOFCHARS, - RTF_ID, - RTF_YR, - RTF_MO, - RTF_DY, - RTF_HR, - RTF_MIN, - RTF_USERPROPS, - RTF_CATEGORY, - RTF_COMPANY, - RTF_MANAGER, - RTF_PROPNAME, - RTF_LINKVAL, - RTF_NOFCHARSWS, - RTF_HLINKBASE, - RTF_STATICVAL, - RTF_PROPTYPE, - - RTF_ANNOTATION, - RTF_ATNID, - - RTF_FOOTNOTE, - - RTF_XE, - RTF_BXE, - RTF_IXE, - RTF_RXE, - RTF_TXE, - RTF_YXE, - - RTF_TC, - RTF_TCF, - RTF_TCL, - - RTF_BKMKSTART, - RTF_BKMKEND, - - RTF_PICT, // Bitmaps - RTF_PICW, - RTF_PICH, - RTF_WBMBITSPIXEL, - RTF_WBMPLANES, - RTF_WBMWIDTHBYTES, - RTF_PICWGOAL, - RTF_PICHGOAL, - RTF_BIN, - RTF_PICSCALEX, - RTF_PICSCALEY, - RTF_PICSCALED, - RTF_WBITMAP, - RTF_WMETAFILE, - RTF_MACPICT, - RTF_OSMETAFILE, - RTF_DIBITMAP, - RTF_PICCROPT, - RTF_PICCROPB, - RTF_PICCROPL, - RTF_PICCROPR, - RTF_PICDATA, - RTF_PICBMP, - RTF_PICBPP, - RTF_PICPROP, - RTF_SHPPICT, - RTF_EMFBLIP, - RTF_PNGBLIP, - RTF_JPEGBLIP, - RTF_NONSHPPICT, - RTF_BLIPTAG, - RTF_BLIPUID, - RTF_BLIPUPI, - - RTF_FIELD, // Felder - RTF_FLDDIRTY, - RTF_FLDEDIT, - RTF_FLDLOCK, - RTF_FLDPRIV, - RTF_FLDINST, - RTF_FLDRSLT, - RTF_FLDTYPE, - RTF_TIME, - RTF_DATE, - RTF_WPEQN, - - RTF_NOLINE, - RTF_REVISED, - - RTF_BKMKCOLF, - RTF_BKMKCOLL, - RTF_PSOVER, - RTF_DOCTEMP, - RTF_DELETED, - - RTF_FCHARSET, - RTF_FALT, - RTF_FPRQ, - RTF_PANOSE, - RTF_FNAME, - RTF_FBIAS, - - RTF_ADDITIVE, - RTF_BKMKPUB, - RTF_CPG, - RTF_DATAFIELD, - - RTF_FBIDI, - RTF_FID, - RTF_FILE, - RTF_FILETBL, - RTF_FNETWORK, - RTF_FONTEMB, - RTF_FONTFILE, - RTF_FOSNUM, - RTF_FRELATIVE, - RTF_FTNIL, - RTF_FTTRUETYPE, - RTF_FVALIDDOS, - RTF_FVALIDHPFS, - RTF_FVALIDMAC, - RTF_FVALIDNTFS, - RTF_LINKSELF, - RTF_PUBAUTO, - RTF_REVTBL, - RTF_RTLMARK, - RTF_SEC, - RTF_TCN, - RTF_XEF, - - RTF_UD, // Unicode - RTF_UPR, - RTF_U, - RTF_UC, - RTF_ANSICPG, - - RTF_FFEXITMCR, // Form Fields - RTF_FFENTRYMCR, - RTF_FFDEFTEXT, - RTF_FFFORMAT, - RTF_FFSTATTEXT, - RTF_FORMFIELD, - RTF_FFNAME, - RTF_FFHELPTEXT, - RTF_FFL, - RTF_FFOWNHELP, - RTF_FFOWNSTAT, - RTF_FFMAXLEN, - RTF_FFHASLISTBOX, - RTF_FFHPS, - RTF_FFPROT, - RTF_FFTYPE, - RTF_FFTYPETXT, - RTF_FFSIZE, - RTF_FFRECALC, - RTF_FFRES, - RTF_FFDEFRES, - - RTF_HIGHLIGHT, - -/* */ - - RTF_DEFTAB = RTF_DOCFMT, - RTF_HYPHHOTZ, - RTF_LINESTART, - RTF_FRACWIDTH, - RTF_NEXTFILE, - RTF_TEMPLATE, - RTF_MAKEBACKUP, - RTF_DEFFORMAT, - RTF_DEFLANG, - RTF_FTNSEP, - RTF_FTNSEPC, - RTF_FTNCN, - RTF_ENDNOTES, - RTF_ENDDOC, - RTF_FTNTJ, - RTF_FTNBJ, - RTF_FTNSTART, - RTF_FTNRESTART, - RTF_PAPERW, - RTF_PAPERH, - RTF_MARGL, - RTF_MARGR, - RTF_MARGT, - RTF_MARGB, - RTF_FACINGP, - RTF_GUTTER, - RTF_MARGMIRROR, - RTF_LANDSCAPE, - RTF_PGNSTART, - RTF_WIDOWCTRL, - RTF_REVISIONS, - RTF_REVPROP, - RTF_REVBAR, - - RTF_AENDDOC, - RTF_AENDNOTES, - RTF_AFTNBJ, - RTF_AFTNCN, - RTF_AFTNNALC, - RTF_AFTNNAR, - RTF_AFTNNAUC, - RTF_AFTNNCHI, - RTF_AFTNNRLC, - RTF_AFTNNRUC, - RTF_AFTNRESTART, - RTF_AFTNRSTCONT, - RTF_AFTNSEP, - RTF_AFTNSEPC, - RTF_AFTNSTART, - RTF_AFTNTJ, - RTF_ALLPROT, - RTF_ANNOTPROT, - RTF_ATNAUTHOR, - RTF_ATNICN, - RTF_ATNREF, - RTF_ATNTIME, - RTF_ATRFEND, - RTF_ATRFSTART, - RTF_BRKFRM, - RTF_CVMME, - RTF_FET, - RTF_FLDALT, - RTF_FORMDISP, - RTF_FORMPROT, - RTF_FORMSHADE, - RTF_FTNALT, - RTF_FTNNALC, - RTF_FTNNAR, - RTF_FTNNAUC, - RTF_FTNNCHI, - RTF_FTNNRLC, - RTF_FTNNRUC, - RTF_FTNRSTCONT, - RTF_FTNRSTPG, - RTF_HYPHAUTO, - RTF_HYPHCAPS, - RTF_HYPHCONSEC, - RTF_LINKSTYLES, - RTF_LTRDOC, - RTF_NOCOLBAL, - RTF_NOEXTRASPRL, - RTF_NOTABIND, - RTF_OTBLRUL, - RTF_PRCOLBL, - RTF_PRINTDATA, - RTF_PSZ, - RTF_REVPROT, - RTF_RTLDOC, - RTF_SPRSSPBF, - RTF_SPRSTSP, - RTF_SWPBDR, - RTF_TRANSMF, - RTF_WRAPTRSP, - - RTF_PRIVATE, - RTF_NOULTRLSPC, - RTF_MSMCAP, - RTF_NOLEAD, - RTF_NOSPACEFORUL, - RTF_LYTEXCTTP, - RTF_LYTPRTMET, - RTF_DNTBLNSBDB, - RTF_FROMTEXT, - RTF_EXPSHRTN, - RTF_PGBRDRT, - RTF_SPRSBSP, - RTF_PGBRDRR, - RTF_PGBRDRSNAP, - RTF_BDBFHDR, - RTF_SUBFONTBYSIZE, - RTF_TRUNCATEFONTHEIGHT, - RTF_SPRSLNSP, - RTF_SPRSTSM, - RTF_PGBRDRL, - RTF_WPJST, - RTF_PGBRDRB, - RTF_WPSP, - RTF_NOXLATTOYEN, - RTF_OLDLINEWRAP, - RTF_PGBRDRFOOT, - RTF_PGBRDRHEAD, - RTF_DEFLANGFE, - RTF_DOCTYPE, - RTF_PGBRDROPT, - RTF_VIEWKIND, - RTF_VIEWSCALE, - RTF_WINDOWCAPTION, - RTF_BRDRART, - RTF_VIEWZK, - RTF_DOCVAR, - - RTF_DGMARGIN, - RTF_AFTNNCHOSUNG, - RTF_AFTNNCNUM, - RTF_AFTNNDBAR, - RTF_AFTNNDBNUM, - RTF_AFTNNDBNUMD, - RTF_AFTNNDBNUMK, - RTF_AFTNNDBNUMT, - RTF_AFTNNGANADA, - RTF_AFTNNGBNUM, - RTF_AFTNNGBNUMD, - RTF_AFTNNGBNUMK, - RTF_AFTNNGBNUML, - RTF_AFTNNZODIAC, - RTF_AFTNNZODIACD, - RTF_AFTNNZODIACL, - RTF_FTNNCHOSUNG, - RTF_FTNNCNUM, - RTF_FTNNDBAR, - RTF_FTNNDBNUM, - RTF_FTNNDBNUMD, - RTF_FTNNDBNUMK, - RTF_FTNNDBNUMT, - RTF_FTNNGANADA, - RTF_FTNNGBNUM, - RTF_FTNNGBNUMD, - RTF_FTNNGBNUMK, - RTF_FTNNGBNUML, - RTF_FTNNZODIAC, - RTF_FTNNZODIACD, - RTF_FTNNZODIACL, - - RTF_ADEFLANG, - RTF_ADEFF, - -/* */ - - RTF_SECTD = RTF_SECTFMT, - RTF_ENDNHERE, - RTF_BINFSXN, - RTF_BINSXN, - RTF_SBKNONE, - RTF_SBKCOL, - RTF_SBKPAGE, - RTF_SBKEVEN, - RTF_SBKODD, - RTF_COLS, - RTF_COLSX, - RTF_COLNO, - RTF_COLSR, - RTF_COLW, - RTF_LINEBETCOL, - RTF_LINEMOD, - RTF_LINEX, - RTF_LINESTARTS, - RTF_LINERESTART, - RTF_LINEPAGE, - RTF_LINECONT, - RTF_PGWSXN, - RTF_PGHSXN, - RTF_MARGLSXN, - RTF_MARGRSXN, - RTF_MARGTSXN, - RTF_MARGBSXN, - RTF_GUTTERSXN, - RTF_LNDSCPSXN, - RTF_FACPGSXN, - RTF_TITLEPG, - RTF_HEADERY, - RTF_FOOTERY, - RTF_PGNSTARTS, - RTF_PGNCONT, - RTF_PGNRESTART, - RTF_PGNX, - RTF_PGNY, - RTF_PGNDEC, - RTF_PGNUCRM, - RTF_PGNLCRM, - RTF_PGNUCLTR, - RTF_PGNLCLTR, - RTF_VERTALT, - RTF_VERTALB, - RTF_VERTALC, - RTF_VERTALJ, - - RTF_FOOTER, - RTF_FOOTERL, - RTF_FOOTERR, - RTF_FOOTERF, - RTF_HEADER, - RTF_HEADERL, - RTF_HEADERR, - RTF_HEADERF, - RTF_DS, - RTF_LTRSECT, - RTF_PGNHN, - RTF_PGNHNSC, - RTF_PGNHNSH, - RTF_PGNHNSM, - RTF_PGNHNSN, - RTF_PGNHNSP, - RTF_RTLSECT, - RTF_SECTUNLOCKED, - RTF_STEXTFLOW, - RTF_PGNCHOSUNG, - RTF_PGNCNUM, - RTF_PGNDBNUMK, - RTF_PGNDBNUMT, - RTF_PGNGANADA, - RTF_PGNGBNUM, - RTF_PGNGBNUMD, - RTF_PGNGBNUMK, - RTF_PGNGBNUML, - RTF_PGNZODIAC, - RTF_PGNZODIACD, - RTF_PGNZODIACL, - RTF_SECTDEFAULTCL, - RTF_SECTEXPAND, - RTF_SECTLINEGRID, - RTF_SECTSPECIFYCL, - RTF_SECTSPECIFYL, - - // Swg-Header/Footer-Tokens - RTF_HEADER_YB = (RTF_SECTFMT|RTF_SWGDEFS), - RTF_HEADER_XL, - RTF_HEADER_XR, - RTF_FOOTER_YT, - RTF_FOOTER_XL, - RTF_FOOTER_XR, - RTF_HEADER_YH, - RTF_FOOTER_YH, - RTF_BALANCED_COLUMN, - - -/* */ - - RTF_PARD = RTF_PARFMT, - RTF_S, - RTF_INTBL, - RTF_KEEP, - RTF_KEEPN, - RTF_LEVEL, - RTF_PAGEBB, - RTF_SBYS, - RTF_QL, - RTF_QR, - RTF_QJ, - RTF_QC, - RTF_FI, - RTF_LI, - RTF_LIN, - RTF_RI, - RTF_RIN, - RTF_SB, - RTF_SA, - RTF_SL, - RTF_HYPHPAR, - RTF_LTRPAR, - RTF_NOWIDCTLPAR, - RTF_RTLPAR, - RTF_SLMULT, - RTF_SUBDOCUMENT, - - RTF_WIDCTLPAR, - - RTF_LISTTEXT, - RTF_POSYIN, - RTF_PNRNOT, - RTF_BRDRDASHDOTSTR, - RTF_POSYOUT, - RTF_BRDRDASHD, - RTF_BRDRDASHDD, - RTF_BRDRENGRAVE, - RTF_BRDRTHTNLG, - RTF_BRDREMBOSS, - RTF_BRDRTNTHTNLG, - RTF_BRDRDASHSM, - RTF_BRDRTHTNMG, - RTF_OVERLAY, - RTF_BRDRTNTHSG, - RTF_BRDRTNTHMG, - RTF_BRDRTHTNSG, - RTF_BRDRTNTHLG, - RTF_BRDRTRIPLE, - RTF_BRDRTNTHTNSG, - RTF_BRDRTNTHTNMG, - RTF_BRDRWAVYDB, - RTF_BRDRWAVY, - RTF_ILVL, - RTF_DFRSTOP, - RTF_DFRXST, - RTF_PNRAUTH, - RTF_DFRSTART, - RTF_OUTLINELEVEL, - RTF_DFRAUTH, - RTF_DFRDATE, - RTF_PNRRGB, - RTF_PNRPNBR, - RTF_PNRSTART, - RTF_PNRXST, - RTF_PNRSTOP, - RTF_PNRDATE, - RTF_PNRNFC, - RTF_NOSNAPLINEGRID, - RTF_FAAUTO, - RTF_FAHANG, - RTF_FAVAR, - RTF_FACENTER, - RTF_FAROMAN, - RTF_FAFIXED, - RTF_ADJUSTRIGHT, - RTF_LS, - RTF_NOCWRAP, - RTF_NOOVERFLOW, - RTF_ASPALPHA, - - -/* */ - - RTF_TX = RTF_TABSTOPDEF, - RTF_TB, - RTF_TQL, - RTF_TQR, - RTF_TQC, - RTF_TQDEC, - RTF_TLDOT, - RTF_TLHYPH, - RTF_TLUL, - RTF_TLTH, - RTF_TLEQ, - - // Swg-TabStop-Tokens - RTF_TLSWG = (RTF_TABSTOPDEF|RTF_SWGDEFS), - -/* */ - - RTF_BRDRT = RTF_BRDRDEF, - RTF_BRDRB, - RTF_BRDRL, - RTF_BRDRR, - RTF_BRDRBTW, - RTF_BRDRBAR, - RTF_BOX, - RTF_BRSP, - RTF_BRDRW, - RTF_BRDRCF, - RTF_BRDRS, - RTF_BRDRTH, - RTF_BRDRSH, - RTF_BRDRDB, - RTF_BRDRDOT, - RTF_BRDRHAIR, - RTF_BRDRDASH, - RTF_BRDRFRAME, - - // Swg-Border-Tokens - RTF_BRDBOX = (RTF_BRDRDEF|RTF_SWGDEFS), - RTF_BRDLINE_COL, - RTF_BRDLINE_IN, - RTF_BRDLINE_OUT, - RTF_BRDLINE_DIST, - -/* */ - - RTF_PLAIN = RTF_CHRFMT, - RTF_B, - RTF_CAPS, - RTF_DN, - RTF_SUB, - RTF_NOSUPERSUB, - RTF_EXPND, - RTF_EXPNDTW, - RTF_KERNING, - RTF_F, - RTF_FS, - RTF_I, - RTF_OUTL, - RTF_SCAPS, - RTF_SHAD, - RTF_STRIKE, - RTF_UL, - RTF_ULD, - RTF_ULDB, - RTF_ULNONE, - RTF_ULW, - RTF_OL, - RTF_OLD, - RTF_OLDB, - RTF_OLNONE, - RTF_OLW, - RTF_UP, - RTF_SUPER, - RTF_V, - RTF_CF, - RTF_CB, - RTF_LANG, - RTF_CCHS, - RTF_CS, - RTF_LTRCH, - RTF_REVAUTH, - RTF_REVDTTM, - RTF_RTLCH, - - RTF_CHBGFDIAG, - RTF_CHBGDKVERT, - RTF_CHBGDKHORIZ, - RTF_CHBRDR, - RTF_CHBGVERT, - RTF_CHBGHORIZ, - RTF_CHBGDKFDIAG, - RTF_CHBGDCROSS, - RTF_CHBGCROSS, - RTF_CHBGBDIAG, - RTF_CHBGDKDCROSS, - RTF_CHBGDKCROSS, - RTF_CHBGDKBDIAG, - RTF_ULDASHD, - RTF_ULDASH, - RTF_ULDASHDD, - RTF_ULWAVE, - RTF_ULC, - RTF_ULTH, - RTF_OLDASHD, - RTF_OLDASH, - RTF_OLDASHDD, - RTF_OLWAVE, - RTF_OLC, - RTF_OLTH, - RTF_EMBO, - RTF_IMPR, - RTF_STRIKED, - RTF_CRDATE, - RTF_CRAUTH, - RTF_CHARSCALEX, - RTF_CHCBPAT, - RTF_CHCFPAT, - RTF_CHSHDNG, - RTF_REVAUTHDEL, - RTF_REVDTTMDEL, - RTF_CGRID, - RTF_GCW, - RTF_NOSECTEXPAND, - RTF_GRIDTBL, - RTF_G, - RTF_ANIMTEXT, - RTF_ULTHD, - RTF_ULTHDASH, - RTF_ULLDASH, - RTF_ULTHLDASH, - RTF_ULTHDASHD, - RTF_ULTHDASHDD, - RTF_ULHWAVE, - RTF_ULULDBWAVE, - RTF_OLTHD, - RTF_OLTHDASH, - RTF_OLLDASH, - RTF_OLTHLDASH, - RTF_OLTHDASHD, - RTF_OLTHDASHDD, - RTF_OLHWAVE, - RTF_OLOLDBWAVE, - - // association control words - RTF_AB, - RTF_ACAPS, - RTF_ACF, - RTF_ADN, - RTF_AEXPND, - RTF_AF, - RTF_AFS, - RTF_AI, - RTF_ALANG, - RTF_AOUTL, - RTF_ASCAPS, - RTF_ASHAD, - RTF_ASTRIKE, - RTF_AUL, - RTF_AULD, - RTF_AULDB, - RTF_AULNONE, - RTF_AULW, - RTF_AUP, - - RTF_LOCH, - RTF_HICH, - RTF_DBCH, - RTF_LANGFE, - RTF_ACCNONE, - RTF_ACCDOT, - RTF_ACCCOMMA, - RTF_TWOINONE, - RTF_HORZVERT, - - // Swg-Border-Tokens - RTF_SWG_ESCPROP = (RTF_CHRFMT|RTF_SWGDEFS), - RTF_HYPHEN, - RTF_HYPHLEAD, - RTF_HYPHTRAIL, - RTF_HYPHMAX, - - -/* */ - - RTF_CHDATE = RTF_SPECCHAR, - RTF_CHDATEL, - RTF_CHDATEA, - RTF_CHTIME, - RTF_CHPGN, - RTF_CHFTN, - RTF_CHATN, - RTF_CHFTNSEP, - RTF_CHFTNSEPC, - RTF_CELL, - RTF_ROW, - RTF_PAR, - RTF_SECT, - RTF_PAGE, - RTF_COLUM, - RTF_LINE, - RTF_TAB, - RTF_EMDASH, - RTF_ENDASH, - RTF_BULLET, - RTF_LQUOTE, - RTF_RQUOTE, - RTF_LDBLQUOTE, - RTF_RDBLQUOTE, - RTF_FORMULA, - RTF_NONBREAKINGSPACE, - RTF_OPTIONALHYPHEN, - RTF_NONBREAKINGHYPHEN, - RTF_SUBENTRYINDEX, - RTF_IGNOREFLAG, - RTF_HEX, - RTF_EMSPACE, - RTF_ENSPACE, - RTF_LTRMARK, - RTF_SECTNUM, - RTF_SOFTCOL, - RTF_SOFTLHEIGHT, - RTF_SOFTLINE, - RTF_SOFTPAGE, - RTF_ZWJ, - RTF_ZWNJ, - -/* */ - - RTF_ABSW = RTF_APOCTL, - RTF_ABSH, - RTF_NOWRAP, - RTF_DXFRTEXT, - RTF_DFRMTXTX, - RTF_DFRMTXTY, - RTF_DROPCAPLI, - RTF_DROPCAPT, - RTF_ABSNOOVRLP, - RTF_PHMRG, - RTF_PHPG, - RTF_PHCOL, - RTF_POSX, - RTF_POSNEGX, - RTF_POSXC, - RTF_POSXI, - RTF_POSXO, - RTF_POSXL, - RTF_POSXR, - RTF_PVMRG, - RTF_PVPG, - RTF_PVPARA, - RTF_POSY, - RTF_POSNEGY, - RTF_POSYT, - RTF_POSYIL, - RTF_POSYB, - RTF_POSYC, - RTF_ABSLOCK, - RTF_FRMTXLRTB, - RTF_FRMTXTBRL, - RTF_FRMTXBTLR, - RTF_FRMTXLRTBV, - RTF_FRMTXTBRLV, - - // Swg-Frame-Tokens - RTF_FLYPRINT = (RTF_APOCTL|RTF_SWGDEFS), - RTF_FLYOPAQUE, - RTF_FLYPRTCTD, - RTF_FLYMAINCNT, - RTF_FLYVERT, - RTF_FLYHORZ, - RTF_FLYOUTLEFT, - RTF_FLYOUTRIGHT, - RTF_FLYOUTUPPER, - RTF_FLYOUTLOWER, - RTF_FLYANCHOR, - RTF_FLY_CNTNT, - RTF_FLY_COLUMN, - RTF_FLY_PAGE, - RTF_FLY_INPARA, - - -/* */ - - RTF_SHADING = RTF_SHADINGDEF, - RTF_CFPAT, - RTF_CBPAT, - RTF_BGHORIZ, - RTF_BGVERT, - RTF_BGFDIAG, - RTF_BGBDIAG, - RTF_BGCROSS, - RTF_BGDCROSS, - RTF_BGDKHORIZ, - RTF_BGDKVERT, - RTF_BGDKFDIAG, - RTF_BGDKBDIAG, - RTF_BGDKCROSS, - RTF_BGDKDCROSS, - -/* */ - - RTF_TROWD = RTF_TABLEDEF, - RTF_TRGAPH, - RTF_TRLEFT, - RTF_TRRH, - - RTF_TRQL, - RTF_TRQR, - RTF_TRQC, - - RTF_CLMGF, - RTF_CLMRG, - RTF_CELLX, - RTF_LTRROW, - RTF_RTLROW, - RTF_TRBRDRB, - RTF_TRBRDRH, - RTF_TRBRDRL, - RTF_TRBRDRR, - RTF_TRBRDRT, - RTF_TRBRDRV, - RTF_TRHDR, - RTF_TRKEEP, - RTF_TRPADDB, - RTF_TRPADDL, - RTF_TRPADDR, - RTF_TRPADDT, - RTF_TRPADDFB, - RTF_TRPADDFL, - RTF_TRPADDFR, - RTF_TRPADDFT, - RTF_TCELLD, - RTF_CLTXTBRL, - RTF_CLTXLRTB, - RTF_CLVERTALB, - RTF_CLVERTALT, - RTF_CLVERTALC, - RTF_CLVMGF, - RTF_CLVMRG, - RTF_CLTXTBRLV, - RTF_CLTXBTLR, - RTF_CLTXLRTBV, - RTF_CLPADL, - RTF_CLPADT, - RTF_CLPADB, - RTF_CLPADR, - RTF_CLPADFL, - RTF_CLPADFT, - RTF_CLPADFB, - RTF_CLPADFR, - - - RTF_CLBRDRT = (RTF_BRDRDEF|RTF_TABLEDEF), - RTF_CLBRDRL, - RTF_CLBRDRB, - RTF_CLBRDRR, - - RTF_CLCFPAT = (RTF_SHADINGDEF|RTF_TABLEDEF), - RTF_CLCBPAT, - RTF_CLSHDNG, - RTF_CLBGHORIZ, - RTF_CLBGVERT, - RTF_CLBGFDIAG, - RTF_CLBGBDIAG, - RTF_CLBGCROSS, - RTF_CLBGDCROSS, - RTF_CLBGDKHOR, - RTF_CLBGDKVERT, - RTF_CLBGDKFDIAG, - RTF_CLBGDKBDIAG, - RTF_CLBGDKCROSS, - RTF_CLBGDKDCROSS, - -/* */ - - -/* */ - - RTF_DO = RTF_DRAWOBJECTS, - RTF_DOBXCOLUMN, - RTF_DOBXMARGIN, - RTF_DOBXPAGE, - RTF_DOBYMARGIN, - RTF_DOBYPAGE, - RTF_DOBYPARA, - RTF_DODHGT, - RTF_DOLOCK, - RTF_DPAENDHOL, - RTF_DPAENDL, - RTF_DPAENDSOL, - RTF_DPAENDW, - RTF_DPARC, - RTF_DPARCFLIPX, - RTF_DPARCFLIPY, - RTF_DPASTARTHOL, - RTF_DPASTARTL, - RTF_DPASTARTSOL, - RTF_DPASTARTW, - RTF_DPCALLOUT, - RTF_DPCOA, - RTF_DPCOACCENT, - RTF_DPCOBESTFIT, - RTF_DPCOBORDER, - RTF_DPCODABS, - RTF_DPCODBOTTOM, - RTF_DPCODCENTER, - RTF_DPCODTOP, - RTF_DPCOLENGTH, - RTF_DPCOMINUSX, - RTF_DPCOMINUSY, - RTF_DPCOOFFSET, - RTF_DPCOSMARTA, - RTF_DPCOTDOUBLE, - RTF_DPCOTRIGHT, - RTF_DPCOTSINGLE, - RTF_DPCOTTRIPLE, - RTF_DPCOUNT, - RTF_DPELLIPSE, - RTF_DPENDGROUP, - RTF_DPFILLBGCB, - RTF_DPFILLBGCG, - RTF_DPFILLBGCR, - RTF_DPFILLBGGRAY, - RTF_DPFILLBGPAL, - RTF_DPFILLFGCB, - RTF_DPFILLFGCG, - RTF_DPFILLFGCR, - RTF_DPFILLFGGRAY, - RTF_DPFILLFGPAL, - RTF_DPFILLPAT, - RTF_DPGROUP, - RTF_DPLINE, - RTF_DPLINECOB, - RTF_DPLINECOG, - RTF_DPLINECOR, - RTF_DPLINEDADO, - RTF_DPLINEDADODO, - RTF_DPLINEDASH, - RTF_DPLINEDOT, - RTF_DPLINEGRAY, - RTF_DPLINEHOLLOW, - RTF_DPLINEPAL, - RTF_DPLINESOLID, - RTF_DPLINEW, - RTF_DPPOLYCOUNT, - RTF_DPPOLYGON, - RTF_DPPOLYLINE, - RTF_DPPTX, - RTF_DPPTY, - RTF_DPRECT, - RTF_DPROUNDR, - RTF_DPSHADOW, - RTF_DPSHADX, - RTF_DPSHADY, - RTF_DPTXBX, - RTF_DPTXBXMAR, - RTF_DPTXBXTEXT, - RTF_DPX, - RTF_DPXSIZE, - RTF_DPY, - RTF_DPYSIZE, - - RTF_DPCODESCENT, - RTF_BACKGROUND, - RTF_SHPBYPAGE, - RTF_SHPBYPARA, - RTF_SHPBYMARGIN, - RTF_SHPBXCOLUMN, - RTF_SHPBXMARGIN, - RTF_SHPBXPAGE, - RTF_SHPLOCKANCHOR, - RTF_SHPWR, - RTF_HLLOC, - RTF_HLSRC, - RTF_SHPWRK, - RTF_SHPTOP, - RTF_SHPRSLT, - RTF_HLFR, - RTF_SHPTXT, - RTF_SHPFHDR, - RTF_SHPGRP, - RTF_SHPRIGHT, - RTF_SHPFBLWTXT, - RTF_SHPZ, - RTF_SHPBOTTOM, - RTF_SHPLEFT, - RTF_SHPLID, - -/* */ - - RTF_OBJALIAS = RTF_OBJECTS, - RTF_OBJALIGN, - RTF_OBJAUTLINK, - RTF_OBJCLASS, - RTF_OBJCROPB, - RTF_OBJCROPL, - RTF_OBJCROPR, - RTF_OBJCROPT, - RTF_OBJDATA, - RTF_OBJECT, - RTF_OBJEMB, - RTF_OBJH, - RTF_OBJICEMB, - RTF_OBJLINK, - RTF_OBJLOCK, - RTF_OBJNAME, - RTF_OBJPUB, - RTF_OBJSCALEX, - RTF_OBJSCALEY, - RTF_OBJSECT, - RTF_OBJSETSIZE, - RTF_OBJSUB, - RTF_OBJTIME, - RTF_OBJTRANSY, - RTF_OBJUPDATE, - RTF_OBJW, - RTF_RESULT, - RTF_RSLTBMP, - RTF_RSLTMERGE, - RTF_RSLTPICT, - RTF_RSLTRTF, - RTF_RSLTTXT, - RTF_OBJOCX, - RTF_OBJHTML, - RTF_OBJATTPH, - -/* */ - - RTF_PN = RTF_NUMBULLETS, - RTF_PNACROSS, - RTF_PNB, - RTF_PNCAPS, - RTF_PNCARD, - RTF_PNCF, - RTF_PNDEC, - RTF_PNF, - RTF_PNFS, - RTF_PNHANG, - RTF_PNI, - RTF_PNINDENT, - RTF_PNLCLTR, - RTF_PNLCRM, - RTF_PNLVL, - RTF_PNLVLBLT, - RTF_PNLVLBODY, - RTF_PNLVLCONT, - RTF_PNNUMONCE, - RTF_PNORD, - RTF_PNORDT, - RTF_PNPREV, - RTF_PNQC, - RTF_PNQL, - RTF_PNQR, - RTF_PNRESTART, - RTF_PNSCAPS, - RTF_PNSECLVL, - RTF_PNSP, - RTF_PNSTART, - RTF_PNSTRIKE, - RTF_PNTEXT, - RTF_PNTXTA, - RTF_PNTXTB, - RTF_PNUCLTR, - RTF_PNUCRM, - RTF_PNUL, - RTF_PNULD, - RTF_PNULDB, - RTF_PNULNONE, - RTF_PNULW, - RTF_LIST, - RTF_LISTLEVEL, - RTF_LISTOVERRIDE, - RTF_LISTOVERRIDETABLE, - RTF_LISTTABLE, - RTF_LISTNAME, - RTF_LEVELNUMBERS, - RTF_LEVELNORESTART, - RTF_LEVELNFC, - RTF_LEVELOLD, - RTF_LISTOVERRIDECOUNT, - RTF_LISTTEMPLATEID, - RTF_LEVELINDENT, - RTF_LEVELFOLLOW, - RTF_LEVELLEGAL, - RTF_LEVELJC, - RTF_LISTOVERRIDESTART, - RTF_LISTID, - RTF_LISTRESTARTHDN, - RTF_LEVELTEXT, - RTF_LISTOVERRIDEFORMAT, - RTF_LEVELPREVSPACE, - RTF_LEVELPREV, - RTF_LEVELSPACE, - RTF_LISTSIMPLE, - RTF_LEVELSTARTAT, - RTF_PNAIUEO, - RTF_PNAIUEOD, - RTF_PNCHOSUNG, - RTF_PNDBNUMD, - RTF_PNDBNUMK, - RTF_PNDBNUML, - RTF_PNDBNUMT, - RTF_PNGANADA, - RTF_PNGBNUM, - RTF_PNGBNUMD, - RTF_PNGBNUMK, - RTF_PNGBNUML, - RTF_PNZODIAC, - RTF_PNZODIACD, - RTF_PNZODIACL, - RTF_LFOLEVEL, - -/* */ - - RTF_GRF_ALIGNV= RTF_SWGDEFS, - RTF_GRF_ALIGNH, - RTF_GRF_MIRROR, - RTF_SWG_PRTDATA, - RTF_BKMK_KEY, - RTF_SHADOW, - RTF_SHDW_DIST, - RTF_SHDW_STYLE, - RTF_SHDW_COL, - RTF_SHDW_FCOL, - RTF_PGDSCTBL, - RTF_PGDSC, - RTF_PGDSCUSE, - RTF_PGDSCNXT, - RTF_PGDSCNO, - RTF_PGBRK, - RTF_SOUTLVL, - -// shapes - RTF_SHP, RTF_SN, RTF_SV -/* - RTF_SHPLEFT, - RTF_SHPTOP, - RTF_SHPBOTTOM, - RTF_SHPRIGHT -*/ - -}; - -#endif // _RTFTOKEN_H - -/* vi:set tabstop=4 shiftwidth=4 expandtab: */ diff --git a/svtools/source/svsql/converter.cxx b/svtools/source/svsql/converter.cxx deleted file mode 100644 index c87290265e90..000000000000 --- a/svtools/source/svsql/converter.cxx +++ /dev/null @@ -1,45 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: converter.cxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include "converter.hxx" - -INT32 SvDbaseConverter::ConvertPrecisionToDbase(INT32 _nLen, INT32 _nScale) -{ - return _nScale ? _nLen +2 : _nLen +1; -} -//------------------------------------------------------------------------ -INT32 SvDbaseConverter::ConvertPrecisionToOdbc(INT32 _nLen, INT32 _nScale) -{ - return _nScale ? _nLen -2 : _nLen -1; -} - - diff --git a/svtools/source/svsql/converter.hxx b/svtools/source/svsql/converter.hxx deleted file mode 100644 index f6a5d67ca966..000000000000 --- a/svtools/source/svsql/converter.hxx +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: converter.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SV_CONVERTER_HXX_ -#define _SV_CONVERTER_HXX_ - -#include "svtools/svldllapi.h" -#include - -class SvDbaseConverter -{ -public: - SVL_DLLPUBLIC static INT32 ConvertPrecisionToDbase(INT32 _nLen, INT32 _nScale); - SVL_DLLPUBLIC static INT32 ConvertPrecisionToOdbc(INT32 _nLen, INT32 _nScale); -}; - -#endif //_CONVERTER_HXX_ - - - diff --git a/svtools/source/svsql/makefile.mk b/svtools/source/svsql/makefile.mk deleted file mode 100644 index 55c400b83ef3..000000000000 --- a/svtools/source/svsql/makefile.mk +++ /dev/null @@ -1,50 +0,0 @@ -#************************************************************************* -# -# 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 -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.6 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=svtools -TARGET=svsql - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svl.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/converter.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/svtools/source/syslocale/makefile.mk b/svtools/source/syslocale/makefile.mk deleted file mode 100644 index a393c174856f..000000000000 --- a/svtools/source/syslocale/makefile.mk +++ /dev/null @@ -1,48 +0,0 @@ -#************************************************************************* -# -# 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 -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.5 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/.. - -PRJNAME=svtools -TARGET=syslocale - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/syslocale.obj - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/svtools/source/syslocale/syslocale.cxx b/svtools/source/syslocale/syslocale.cxx deleted file mode 100644 index 9811d97fd964..000000000000 --- a/svtools/source/syslocale/syslocale.cxx +++ /dev/null @@ -1,176 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: syslocale.cxx,v $ - * $Revision: 1.11 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -using namespace osl; -using namespace com::sun::star; - - -SvtSysLocale_Impl* SvtSysLocale::pImpl = NULL; -sal_Int32 SvtSysLocale::nRefCount = 0; - - -class SvtSysLocale_Impl : public SvtListener -{ - friend class SvtSysLocale; - - SvtSysLocaleOptions aSysLocaleOptions; - LocaleDataWrapper* pLocaleData; - CharClass* pCharClass; - -public: - SvtSysLocale_Impl(); - virtual ~SvtSysLocale_Impl(); - - virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint ); - - CharClass* GetCharClass(); - -}; - - -// ----------------------------------------------------------------------- - -SvtSysLocale_Impl::SvtSysLocale_Impl() : pCharClass(NULL) -{ - const lang::Locale& rLocale = Application::GetSettings().GetLocale(); - pLocaleData = new LocaleDataWrapper( - ::comphelper::getProcessServiceFactory(), rLocale ); - aSysLocaleOptions.AddListener( *this ); -} - - -SvtSysLocale_Impl::~SvtSysLocale_Impl() -{ - aSysLocaleOptions.RemoveListener( *this ); - delete pCharClass; - delete pLocaleData; -} - -CharClass* SvtSysLocale_Impl::GetCharClass() -{ - if ( !pCharClass ) - { - const lang::Locale& rLocale = Application::GetSettings().GetLocale(); - pCharClass = new CharClass(::comphelper::getProcessServiceFactory(), rLocale ); - } - return pCharClass; -} -void SvtSysLocale_Impl::Notify( SvtBroadcaster&, const SfxHint& rHint ) -{ - const SfxSimpleHint* p = PTR_CAST( SfxSimpleHint, &rHint ); - if( p && (p->GetId() & SYSLOCALEOPTIONS_HINT_LOCALE) ) - { - MutexGuard aGuard( SvtSysLocale::GetMutex() ); - const lang::Locale& rLocale = Application::GetSettings().GetLocale(); - pLocaleData->setLocale( rLocale ); - GetCharClass()->setLocale( rLocale ); - } -} - - -// ==================================================================== - -SvtSysLocale::SvtSysLocale() -{ - MutexGuard aGuard( GetMutex() ); - if ( !pImpl ) - pImpl = new SvtSysLocale_Impl; - ++nRefCount; -} - - -SvtSysLocale::~SvtSysLocale() -{ - MutexGuard aGuard( GetMutex() ); - if ( !--nRefCount ) - { - delete pImpl; - pImpl = NULL; - } -} - - -// static -Mutex& SvtSysLocale::GetMutex() -{ - static Mutex* pMutex = NULL; - if( !pMutex ) - { - MutexGuard aGuard( Mutex::getGlobalMutex() ); - if( !pMutex ) - { - // #i77768# Due to a static reference in the toolkit lib - // we need a mutex that lives longer than the svtools library. - // Otherwise the dtor would use a destructed mutex!! - pMutex = new Mutex; - } - } - return *pMutex; -} - - -const LocaleDataWrapper& SvtSysLocale::GetLocaleData() const -{ - return *(pImpl->pLocaleData); -} - - -const LocaleDataWrapper* SvtSysLocale::GetLocaleDataPtr() const -{ - return pImpl->pLocaleData; -} - - -const CharClass& SvtSysLocale::GetCharClass() const -{ - return *(pImpl->GetCharClass()); -} - - -const CharClass* SvtSysLocale::GetCharClassPtr() const -{ - return pImpl->GetCharClass(); -} diff --git a/svtools/source/undo/makefile.mk b/svtools/source/undo/makefile.mk deleted file mode 100644 index b277fa3c906f..000000000000 --- a/svtools/source/undo/makefile.mk +++ /dev/null @@ -1,51 +0,0 @@ -#************************************************************************* -# -# 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 -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.5 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=svtools -TARGET=undo -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/undo.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/svtools/source/undo/undo.cxx b/svtools/source/undo/undo.cxx deleted file mode 100644 index 2f733d4f03b3..000000000000 --- a/svtools/source/undo/undo.cxx +++ /dev/null @@ -1,819 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: undo.cxx,v $ - * $Revision: 1.11 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include - -#include - -#include - -using ::com::sun::star::uno::Exception; - -// STATIC DATA ----------------------------------------------------------- - -DBG_NAME(SfxUndoAction) - -//======================================================================== - -TYPEINIT0(SfxUndoAction); -TYPEINIT0(SfxListUndoAction); -TYPEINIT0(SfxLinkUndoAction); -TYPEINIT0(SfxRepeatTarget); - -//------------------------------------------------------------------------ - -SfxRepeatTarget::~SfxRepeatTarget() -{ -} - -//------------------------------------------------------------------------ - -BOOL SfxUndoAction::IsLinked() -{ - return bLinked; -} - -//------------------------------------------------------------------------ - -void SfxUndoAction::SetLinked( BOOL bIsLinked ) -{ - bLinked = bIsLinked; -} - -//------------------------------------------------------------------------ - -SfxUndoAction::~SfxUndoAction() -{ - DBG_DTOR(SfxUndoAction, 0); - DBG_ASSERT( !IsLinked(), "Gelinkte Action geloescht" ); -} - - -SfxUndoAction::SfxUndoAction() -{ - DBG_CTOR(SfxUndoAction, 0); - SetLinked( FALSE ); -} - -//------------------------------------------------------------------------ - -BOOL SfxUndoAction::Merge( SfxUndoAction * ) -{ - DBG_CHKTHIS(SfxUndoAction, 0); - return FALSE; -} - -//------------------------------------------------------------------------ - -XubString SfxUndoAction::GetComment() const -{ - DBG_CHKTHIS(SfxUndoAction, 0); - return XubString(); -} - -//------------------------------------------------------------------------ - - -USHORT SfxUndoAction::GetId() const -{ - DBG_CHKTHIS(SfxUndoAction, 0); - return 0; -} - -//------------------------------------------------------------------------ - -XubString SfxUndoAction::GetRepeatComment(SfxRepeatTarget&) const -{ - DBG_CHKTHIS(SfxUndoAction, 0); - return GetComment(); -} - -//------------------------------------------------------------------------ - - -void SfxUndoAction::Undo() -{ - // die sind nur konzeptuell pure virtual - DBG_ERROR( "pure virtual function called: SfxUndoAction::Undo()" ); -} - -//------------------------------------------------------------------------ - -void SfxUndoAction::Redo() -{ - // die sind nur konzeptuell pure virtual - DBG_ERROR( "pure virtual function called: SfxUndoAction::Redo()" ); -} - -//------------------------------------------------------------------------ - -void SfxUndoAction::Repeat(SfxRepeatTarget&) -{ - // die sind nur konzeptuell pure virtual - DBG_ERROR( "pure virtual function called: SfxUndoAction::Repeat()" ); -} - -//------------------------------------------------------------------------ - - -BOOL SfxUndoAction::CanRepeat(SfxRepeatTarget&) const -{ - return TRUE; -} - -//======================================================================== - - -SfxUndoManager::SfxUndoManager( USHORT nMaxUndoActionCount ) - : pFatherUndoArray(0) - , mbUndoEnabled( true ) -{ - pUndoArray=new SfxUndoArray(nMaxUndoActionCount); - pActUndoArray=pUndoArray; - -} - -//------------------------------------------------------------------------ - - -SfxUndoManager::~SfxUndoManager() -{ - delete pUndoArray; -} - -//------------------------------------------------------------------------ - -void SfxUndoManager::EnableUndo( bool bEnable ) -{ - mbUndoEnabled = bEnable; -} - -//------------------------------------------------------------------------ - - -void SfxUndoManager::SetMaxUndoActionCount( USHORT nMaxUndoActionCount ) -{ - // Remove entries from the pActUndoArray when we have to reduce - // the number of entries due to a lower nMaxUndoActionCount. - // Both redo and undo action entries will be removed until we reached the - // new nMaxUndoActionCount. - - long nNumToDelete = pActUndoArray->aUndoActions.Count() - nMaxUndoActionCount; - if ( nNumToDelete > 0 ) - { - while ( nNumToDelete > 0 ) - { - USHORT nPos = pActUndoArray->aUndoActions.Count(); - if ( nPos > pActUndoArray->nCurUndoAction ) - { - if ( !pActUndoArray->aUndoActions[nPos-1]->IsLinked() ) - { - delete pActUndoArray->aUndoActions[nPos-1]; - pActUndoArray->aUndoActions.Remove( nPos-1 ); - --nNumToDelete; - } - } - - if ( nNumToDelete > 0 && pActUndoArray->nCurUndoAction > 0 ) - { - if ( !pActUndoArray->aUndoActions[0]->IsLinked() ) - { - delete pActUndoArray->aUndoActions[0]; - pActUndoArray->aUndoActions.Remove(0); - --pActUndoArray->nCurUndoAction; - --nNumToDelete; - } - } - - if ( nPos == pActUndoArray->aUndoActions.Count() ) - break; // Cannot delete more entries - } - } - - pActUndoArray->nMaxUndoActions = nMaxUndoActionCount; -} - -//------------------------------------------------------------------------ - -USHORT SfxUndoManager::GetMaxUndoActionCount() const -{ - return pActUndoArray->nMaxUndoActions; -} - -//------------------------------------------------------------------------ - -void SfxUndoManager::Clear() -{ - while ( pActUndoArray->aUndoActions.Count() ) - { - SfxUndoAction *pAction= - pActUndoArray->aUndoActions[pActUndoArray->aUndoActions.Count() - 1]; - pActUndoArray->aUndoActions.Remove( pActUndoArray->aUndoActions.Count() - 1 ); - delete pAction; - } - - pActUndoArray->nCurUndoAction = 0; -} - -//------------------------------------------------------------------------ - -void SfxUndoManager::ClearRedo() -{ - while ( pActUndoArray->aUndoActions.Count() > pActUndoArray->nCurUndoAction ) - { - SfxUndoAction *pAction= - pActUndoArray->aUndoActions[pActUndoArray->aUndoActions.Count() - 1]; - pActUndoArray->aUndoActions.Remove( pActUndoArray->aUndoActions.Count() - 1 ); - delete pAction; - } -} - -//------------------------------------------------------------------------ - -void SfxUndoManager::AddUndoAction( SfxUndoAction *pAction, BOOL bTryMerge ) -{ - if( mbUndoEnabled ) - { - // Redo-Actions loeschen - for ( USHORT nPos = pActUndoArray->aUndoActions.Count(); - nPos > pActUndoArray->nCurUndoAction; --nPos ) - delete pActUndoArray->aUndoActions[nPos-1]; - - pActUndoArray->aUndoActions.Remove( - pActUndoArray->nCurUndoAction, - pActUndoArray->aUndoActions.Count() - pActUndoArray->nCurUndoAction ); - - if ( pActUndoArray->nMaxUndoActions ) - { - SfxUndoAction *pTmpAction = pActUndoArray->nCurUndoAction ? - pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1] : 0; - - if ( !bTryMerge || !(pTmpAction && pTmpAction->Merge(pAction)) ) - { - // auf Max-Anzahl anpassen - if( pActUndoArray == pUndoArray ) - while( pActUndoArray->aUndoActions.Count() >= - pActUndoArray->nMaxUndoActions && - !pActUndoArray->aUndoActions[0]->IsLinked() ) - { - delete pActUndoArray->aUndoActions[0]; - pActUndoArray->aUndoActions.Remove(0); - --pActUndoArray->nCurUndoAction; - } - - // neue Action anh"angen - const SfxUndoAction* pTemp = pAction; - pActUndoArray->aUndoActions.Insert( - pTemp, pActUndoArray->nCurUndoAction++ ); - return; - } - } - } - delete pAction; -} - -//------------------------------------------------------------------------ - -USHORT SfxUndoManager::GetUndoActionCount() const -{ - return pActUndoArray->nCurUndoAction; -} - -//------------------------------------------------------------------------ - -XubString SfxUndoManager::GetUndoActionComment( USHORT nNo ) const -{ - DBG_ASSERT( nNo < pActUndoArray->nCurUndoAction, "svtools::SfxUndoManager::GetUndoActionComment(), illegal id!" ); - if( nNo < pActUndoArray->nCurUndoAction ) - { - return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1-nNo]->GetComment(); //! - } - else - { - XubString aEmpty; - return aEmpty; - } -} - -//------------------------------------------------------------------------ - -USHORT SfxUndoManager::GetUndoActionId( USHORT nNo ) const -{ - DBG_ASSERT( nNo < pActUndoArray->nCurUndoAction, "svtools::SfxUndoManager::GetUndoActionId(), illegal id!" ); - if( nNo < pActUndoArray->nCurUndoAction ) - { - return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1-nNo]->GetId(); //! - } - else - { - return 0; - } -} - -//------------------------------------------------------------------------ - -SfxUndoAction* SfxUndoManager::GetUndoAction( USHORT nNo ) const -{ - DBG_ASSERT( nNo < pActUndoArray->nCurUndoAction, "svtools::SfxUndoManager::GetUndoAction(), illegal id!" ); - if( nNo < pActUndoArray->nCurUndoAction ) - { - return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1-nNo]; //! - } - else - { - return 0; - } -} - -//------------------------------------------------------------------------ - -/** clears the redo stack and removes the top undo action */ -void SfxUndoManager::RemoveLastUndoAction() -{ - DBG_ASSERT( pActUndoArray->nCurUndoAction, "svtools::SfxUndoManager::RemoveLastUndoAction(), no action to remove?!" ); - if( pActUndoArray->nCurUndoAction ) - { - pActUndoArray->nCurUndoAction--; - - // delete redo-actions and top action - USHORT nPos; - for ( nPos = pActUndoArray->aUndoActions.Count(); nPos > pActUndoArray->nCurUndoAction; --nPos ) - delete pActUndoArray->aUndoActions[nPos-1]; - - pActUndoArray->aUndoActions.Remove( - pActUndoArray->nCurUndoAction, - pActUndoArray->aUndoActions.Count() - pActUndoArray->nCurUndoAction ); - } -} - -//------------------------------------------------------------------------ - -BOOL SfxUndoManager::Undo( USHORT ) -{ - bool bUndoWasEnabled = mbUndoEnabled; - mbUndoEnabled = false; - - BOOL bRet = FALSE; - - try - { - DBG_ASSERT( pActUndoArray == pUndoArray, "svtools::SfxUndoManager::Undo(), LeaveListAction() not yet called!" ); - if ( pActUndoArray->nCurUndoAction ) - { - Undo( *pActUndoArray->aUndoActions[ --pActUndoArray->nCurUndoAction ] ); - bRet = TRUE; - } - } - catch( Exception& e ) - { - mbUndoEnabled = bUndoWasEnabled; - throw e; - } - mbUndoEnabled = bUndoWasEnabled; - return bRet; -} - -//------------------------------------------------------------------------ - -void SfxUndoManager::Undo( SfxUndoAction &rAction ) -{ - bool bUndoWasEnabled = mbUndoEnabled; - mbUndoEnabled = false; - try - { - rAction.Undo(); - } - catch( Exception& e ) - { - mbUndoEnabled = bUndoWasEnabled; - throw e; - } - - mbUndoEnabled = bUndoWasEnabled; -} - -//------------------------------------------------------------------------ - -USHORT SfxUndoManager::GetRedoActionCount() const -{ - return pActUndoArray->aUndoActions.Count() - pActUndoArray->nCurUndoAction; //! -} - -//------------------------------------------------------------------------ - -XubString SfxUndoManager::GetRedoActionComment( USHORT nNo ) const -{ - return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction+nNo]->GetComment(); //! -} - -//------------------------------------------------------------------------ - -USHORT SfxUndoManager::GetRedoActionId( USHORT nNo ) const -{ - return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction+nNo]->GetId(); //! -} - -//------------------------------------------------------------------------ - -BOOL SfxUndoManager::Redo( USHORT ) -{ - bool bUndoWasEnabled = mbUndoEnabled; - mbUndoEnabled = false; - - BOOL bRet = FALSE; - - try - { - if ( pActUndoArray->aUndoActions.Count() > pActUndoArray->nCurUndoAction ) - { - Redo( *pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction++] ); - bRet = TRUE; - } - } - catch( Exception& e ) - { - mbUndoEnabled = bUndoWasEnabled; - throw e; - } - - mbUndoEnabled = bUndoWasEnabled; - return bRet; -} - -//------------------------------------------------------------------------ - -void SfxUndoManager::Redo( SfxUndoAction &rAction ) -{ - bool bUndoWasEnabled = mbUndoEnabled; - mbUndoEnabled = false; - - try - { - rAction.Redo(); - } - catch( Exception& e ) - { - mbUndoEnabled = bUndoWasEnabled; - throw e; - } - - mbUndoEnabled = bUndoWasEnabled; -} - -//------------------------------------------------------------------------ - -USHORT SfxUndoManager::GetRepeatActionCount() const -{ - return pActUndoArray->aUndoActions.Count(); -} - -//------------------------------------------------------------------------ - -XubString SfxUndoManager::GetRepeatActionComment( SfxRepeatTarget &rTarget, USHORT nNo ) const -{ - return pActUndoArray->aUndoActions[ pActUndoArray->aUndoActions.Count() - 1 - nNo ] - ->GetRepeatComment(rTarget); -} - -//------------------------------------------------------------------------ - -BOOL SfxUndoManager::Repeat( SfxRepeatTarget &rTarget, USHORT /*nFrom*/, USHORT /*nCount*/ ) -{ - if ( pActUndoArray->aUndoActions.Count() ) - { - Repeat( rTarget, *pActUndoArray->aUndoActions[ pActUndoArray->aUndoActions.Count() - 1 ] ); - return TRUE; - } - - return FALSE; -} - -//------------------------------------------------------------------------ - -void SfxUndoManager::Repeat( SfxRepeatTarget &rTarget, SfxUndoAction &rAction ) -{ - if ( rAction.CanRepeat(rTarget) ) - rAction.Repeat(rTarget); -} - -//------------------------------------------------------------------------ - -BOOL SfxUndoManager::CanRepeat( SfxRepeatTarget &rTarget, SfxUndoAction &rAction ) const -{ - return rAction.CanRepeat(rTarget); -} - -//------------------------------------------------------------------------ - -BOOL SfxUndoManager::CanRepeat( SfxRepeatTarget &rTarget, USHORT nNo ) const -{ - if ( pActUndoArray->aUndoActions.Count() > nNo ) - { - USHORT nActionNo = pActUndoArray->aUndoActions.Count() - 1 - nNo; - return pActUndoArray->aUndoActions[nActionNo]->CanRepeat(rTarget); - } - - return FALSE; -} - -//------------------------------------------------------------------------ - -void SfxUndoManager::EnterListAction( - const XubString& rComment, const XubString &rRepeatComment, USHORT nId ) - -/* [Beschreibung] - - Fuegt eine ListUndoAction ein und setzt dessen UndoArray als aktuelles. -*/ - -{ - if( !mbUndoEnabled ) - return; - - if ( !pUndoArray->nMaxUndoActions ) - return; - - pFatherUndoArray=pActUndoArray; - SfxListUndoAction *pAction=new SfxListUndoAction( - rComment, rRepeatComment, nId, pActUndoArray); - AddUndoAction( pAction ); - pActUndoArray=pAction; -} - -//------------------------------------------------------------------------ - -void SfxUndoManager::LeaveListAction() - -/* [Beschreibung] - - Verlaesst die aktuelle ListAction und geht eine Ebene nach oben. -*/ -{ - if ( !mbUndoEnabled ) - return; - - if ( !pUndoArray->nMaxUndoActions ) - return; - - if( pActUndoArray == pUndoArray ) - { - DBG_ERROR( "svtools::SfxUndoManager::LeaveListAction(), called without calling EnterListAction()!" ); - return; - } - - DBG_ASSERT(pActUndoArray->pFatherUndoArray,"svtools::SfxUndoManager::LeaveListAction(), no father undo array!?"); - - SfxUndoArray* pTmp=pActUndoArray; - pActUndoArray=pActUndoArray->pFatherUndoArray; - - // If no undo action where added, delete the undo list action - SfxUndoAction *pTmpAction= pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1]; - if(!pTmp->nCurUndoAction) - { - pActUndoArray->aUndoActions.Remove( --pActUndoArray->nCurUndoAction); - delete pTmpAction; - } - else - { - // if the undo array has no comment, try to get it from its children - SfxListUndoAction* pList = dynamic_cast< SfxListUndoAction * >( pTmpAction ); - if( pList && pList->GetComment().Len() == 0 ) - { - USHORT n; - for( n = 0; n < pList->aUndoActions.Count(); n++ ) - { - if( pList->aUndoActions[n]->GetComment().Len() ) - { - pList->SetComment( pList->aUndoActions[n]->GetComment() ); - break; - } - } - } - } -} - -//------------------------------------------------------------------------ - -USHORT SfxListUndoAction::GetId() const -{ - return nId; -} - -//------------------------------------------------------------------------ - -XubString SfxListUndoAction::GetComment() const -{ - return aComment; -} - -//------------------------------------------------------------------------ - -void SfxListUndoAction::SetComment( const UniString& rComment ) -{ - aComment = rComment; -} - -//------------------------------------------------------------------------ - -XubString SfxListUndoAction::GetRepeatComment(SfxRepeatTarget &) const -{ - return aRepeatComment; -} - - -//------------------------------------------------------------------------ - -SfxListUndoAction::SfxListUndoAction -( - const XubString &rComment, - const XubString rRepeatComment, - USHORT Id, - SfxUndoArray *pFather -) -: nId(Id), aComment(rComment), aRepeatComment(rRepeatComment) -{ - pFatherUndoArray = pFather; - nMaxUndoActions = USHRT_MAX; -} - -//------------------------------------------------------------------------ - -void SfxListUndoAction::Undo() -{ - for(INT16 i=nCurUndoAction-1;i>=0;i--) - aUndoActions[i]->Undo(); - nCurUndoAction=0; -} - -//------------------------------------------------------------------------ - -void SfxListUndoAction::Redo() -{ - for(USHORT i=nCurUndoAction;iRedo(); - nCurUndoAction = aUndoActions.Count(); -} - -//------------------------------------------------------------------------ - -void SfxListUndoAction::Repeat(SfxRepeatTarget&rTarget) -{ - for(USHORT i=0;iRepeat(rTarget); -} - -//------------------------------------------------------------------------ - -BOOL SfxListUndoAction::CanRepeat(SfxRepeatTarget&r) const -{ - for(USHORT i=0;iCanRepeat(r)) - return FALSE; - return TRUE; -} - -//------------------------------------------------------------------------ - -BOOL SfxListUndoAction::Merge( SfxUndoAction *pNextAction ) -{ - return aUndoActions.Count() && aUndoActions[aUndoActions.Count()-1]->Merge( pNextAction ); -} - -//------------------------------------------------------------------------ - -SfxLinkUndoAction::SfxLinkUndoAction(SfxUndoManager *pManager) -/* [Beschreibung] - - Richtet eine LinkAction ein, die auf einen weiteren UndoManager zeigt. - Holt sich als zugehoerige Action des weiteren UndoManagers dessen - aktuelle Action. -*/ - -{ - pUndoManager = pManager; - if ( pManager->GetMaxUndoActionCount() ) - { - USHORT nPos = pManager->GetUndoActionCount()-1; - pAction = pManager->pActUndoArray->aUndoActions[nPos]; - pAction->SetLinked(); - } - else - pAction = 0; -} - -//------------------------------------------------------------------------ - -void SfxLinkUndoAction::Undo() -{ - if ( pAction ) - pUndoManager->Undo(1); -} - -//------------------------------------------------------------------------ - -void SfxLinkUndoAction::Redo() -{ - if ( pAction ) - pUndoManager->Redo(1); -} - -//------------------------------------------------------------------------ - - -BOOL SfxLinkUndoAction::CanRepeat(SfxRepeatTarget& r) const -{ - return pAction && pUndoManager->CanRepeat(r,*pAction); -} - - -//------------------------------------------------------------------------ - - -void SfxLinkUndoAction::Repeat(SfxRepeatTarget&r) -{ - if ( pAction ) - pUndoManager->Repeat(r,*pAction); -} - - -//------------------------------------------------------------------------ - -XubString SfxLinkUndoAction::GetComment() const -{ - if ( pAction ) - return pAction->GetComment(); - else - return XubString(); -} - - -//------------------------------------------------------------------------ - -XubString SfxLinkUndoAction::GetRepeatComment(SfxRepeatTarget&r) const -{ - if ( pAction ) - return pAction->GetRepeatComment(r); - else - return XubString(); -} - -//------------------------------------------------------------------------ - -SfxLinkUndoAction::~SfxLinkUndoAction() -{ - if( pAction ) - pAction->SetLinked( FALSE ); -} - - -//------------------------------------------------------------------------ - -SfxUndoArray::~SfxUndoArray() -{ - while ( aUndoActions.Count() ) - { - SfxUndoAction *pAction = - aUndoActions[ aUndoActions.Count() - 1 ]; - aUndoActions.Remove( aUndoActions.Count() - 1 ); - delete pAction; - } -} - - -USHORT SfxLinkUndoAction::GetId() const -{ - return pAction ? pAction->GetId() : 0; -} - - - diff --git a/svtools/source/uno/registerservices.cxx b/svtools/source/uno/registerservices.cxx deleted file mode 100644 index a3e9f39c2dba..000000000000 --- a/svtools/source/uno/registerservices.cxx +++ /dev/null @@ -1,135 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: registerservices.cxx,v $ - * $Revision: 1.21 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include "sal/types.h" -#include "rtl/ustring.hxx" -#include -#include -#include -#include - -namespace css = com::sun::star; -using css::uno::Reference; -using css::uno::Sequence; -using rtl::OUString; - -// ------------------------------------------------------------------------------------- - -#define DECLARE_CREATEINSTANCE( ImplName ) \ - Reference< css::uno::XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< css::lang::XMultiServiceFactory >& ); - -DECLARE_CREATEINSTANCE( SvNumberFormatterServiceObj ) -DECLARE_CREATEINSTANCE( SvNumberFormatsSupplierServiceObject ) - -// ------------------------------------------------------------------------------------- - -extern "C" -{ - -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( - void * /* _pServiceManager */, void * _pRegistryKey) -{ - if (_pRegistryKey) - { - Reference< css::registry::XRegistryKey > xRegistryKey ( - reinterpret_cast< css::registry::XRegistryKey* >(_pRegistryKey)); - Reference< css::registry::XRegistryKey > xNewKey; - - xNewKey = xRegistryKey->createKey ( - OUString::createFromAscii( - "/com.sun.star.uno.util.numbers.SvNumberFormatsSupplierServiceObject/UNO/SERVICES" ) ); - xNewKey->createKey ( - OUString::createFromAscii( "com.sun.star.util.NumberFormatsSupplier" ) ); - - xNewKey = xRegistryKey->createKey ( - OUString::createFromAscii( - "/com.sun.star.uno.util.numbers.SvNumberFormatterServiceObject/UNO/SERVICES" ) ); - xNewKey->createKey ( - OUString::createFromAscii( "com.sun.star.util.NumberFormatter" ) ); - - return sal_True; - } - return sal_False; -} - -SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory ( - const sal_Char * pImplementationName, void * _pServiceManager, void * /* _pRegistryKey*/) -{ - void * pResult = 0; - if ( _pServiceManager ) - { - Reference< css::lang::XSingleServiceFactory > xFactory; - if (rtl_str_compare( - pImplementationName, - "com.sun.star.uno.util.numbers.SvNumberFormatsSupplierServiceObject") == 0) - { - Sequence< OUString > aServiceNames(1); - aServiceNames.getArray()[0] = - OUString::createFromAscii( "com.sun.star.util.NumberFormatsSupplier" ); - - xFactory = ::cppu::createSingleFactory( - reinterpret_cast< css::lang::XMultiServiceFactory* >(_pServiceManager), - OUString::createFromAscii( pImplementationName ), - SvNumberFormatsSupplierServiceObject_CreateInstance, - aServiceNames); - } - else if (rtl_str_compare( - pImplementationName, - "com.sun.star.uno.util.numbers.SvNumberFormatterServiceObject") == 0) - { - Sequence< OUString > aServiceNames(1); - aServiceNames.getArray()[0] = - OUString::createFromAscii( "com.sun.star.util.NumberFormatter" ); - - xFactory = ::cppu::createSingleFactory( - reinterpret_cast< css::lang::XMultiServiceFactory* >(_pServiceManager), - OUString::createFromAscii( pImplementationName ), - SvNumberFormatterServiceObj_CreateInstance, - aServiceNames); - } - if ( xFactory.is() ) - { - xFactory->acquire(); - pResult = xFactory.get(); - } - } - return pResult; -} - -} // "C" - diff --git a/svtools/uno/addrtempuno.cxx b/svtools/uno/addrtempuno.cxx deleted file mode 100644 index b2aff7ae711d..000000000000 --- a/svtools/uno/addrtempuno.cxx +++ /dev/null @@ -1,248 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: addrtempuno.cxx,v $ - * $Revision: 1.8 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include "svtools/genericunodialog.hxx" -#ifndef _SVT_DOC_ADDRESSTEMPLATE_HXX_ -#include "addresstemplate.hxx" -#endif -#ifndef _CPPUHELPER_EXTRACT_HXX_ -#include -#endif -#include -#include -#include - -class SfxItemSet; -class SfxItemPool; -class SfxPoolItem; - -// ....................................................................... -namespace svt -{ -// ....................................................................... - -#define UNODIALOG_PROPERTY_ID_ALIASES 100 -#define UNODIALOG_PROPERTY_ALIASES "FieldMapping" - - using namespace com::sun::star::uno; - using namespace com::sun::star::lang; - using namespace com::sun::star::util; - using namespace com::sun::star::beans; - using namespace com::sun::star::sdbc; - - //========================================================================= - //= OAddressBookSourceDialogUno - //========================================================================= - typedef OGenericUnoDialog OAddressBookSourceDialogUnoBase; - class OAddressBookSourceDialogUno - :public OAddressBookSourceDialogUnoBase - ,public ::comphelper::OPropertyArrayUsageHelper< OAddressBookSourceDialogUno > - { - protected: - Sequence< AliasProgrammaticPair > m_aAliases; - Reference< XDataSource > m_xDataSource; - ::rtl::OUString m_sDataSourceName; - ::rtl::OUString m_sTable; - - protected: - OAddressBookSourceDialogUno(const Reference< XMultiServiceFactory >& _rxORB); - - public: - // XTypeProvider - virtual Sequence SAL_CALL getImplementationId( ) throw(RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw(RuntimeException); - virtual ::comphelper::StringSequence SAL_CALL getSupportedServiceNames() throw(RuntimeException); - - // XServiceInfo - static methods - static Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( RuntimeException ); - static ::rtl::OUString getImplementationName_Static(void) throw( RuntimeException ); - static Reference< XInterface > - SAL_CALL Create(const Reference< com::sun::star::lang::XMultiServiceFactory >&); - - // XPropertySet - virtual Reference< XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(RuntimeException); - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; - - protected: - // OGenericUnoDialog overridables - virtual Dialog* createDialog(Window* _pParent); - - virtual void implInitialize(const com::sun::star::uno::Any& _rValue); - - virtual void executedDialog(sal_Int16 _nExecutionResult); - }; - - - //========================================================================= - //= OAddressBookSourceDialogUno - //========================================================================= - Reference< XInterface > SAL_CALL OAddressBookSourceDialogUno_CreateInstance( const Reference< XMultiServiceFactory >& _rxFactory) - { - return OAddressBookSourceDialogUno::Create(_rxFactory); - } - - //------------------------------------------------------------------------- - OAddressBookSourceDialogUno::OAddressBookSourceDialogUno(const Reference< XMultiServiceFactory >& _rxORB) - :OGenericUnoDialog(_rxORB) - { - registerProperty(::rtl::OUString::createFromAscii(UNODIALOG_PROPERTY_ALIASES), UNODIALOG_PROPERTY_ID_ALIASES, PropertyAttribute::READONLY, - &m_aAliases, getCppuType(&m_aAliases)); - } - - //------------------------------------------------------------------------- - Sequence SAL_CALL OAddressBookSourceDialogUno::getImplementationId( ) throw(RuntimeException) - { - static ::cppu::OImplementationId aId; - return aId.getImplementationId(); - } - - //------------------------------------------------------------------------- - Reference< XInterface > SAL_CALL OAddressBookSourceDialogUno::Create(const Reference< XMultiServiceFactory >& _rxFactory) - { - return *(new OAddressBookSourceDialogUno(_rxFactory)); - } - - //------------------------------------------------------------------------- - ::rtl::OUString SAL_CALL OAddressBookSourceDialogUno::getImplementationName() throw(RuntimeException) - { - return getImplementationName_Static(); - } - - //------------------------------------------------------------------------- - ::rtl::OUString OAddressBookSourceDialogUno::getImplementationName_Static() throw(RuntimeException) - { - return ::rtl::OUString::createFromAscii("com.sun.star.comp.svtools.OAddressBookSourceDialogUno"); - } - - //------------------------------------------------------------------------- - ::comphelper::StringSequence SAL_CALL OAddressBookSourceDialogUno::getSupportedServiceNames() throw(RuntimeException) - { - return getSupportedServiceNames_Static(); - } - - //------------------------------------------------------------------------- - ::comphelper::StringSequence OAddressBookSourceDialogUno::getSupportedServiceNames_Static() throw(RuntimeException) - { - ::comphelper::StringSequence aSupported(1); - aSupported.getArray()[0] = ::rtl::OUString::createFromAscii("com.sun.star.ui.AddressBookSourceDialog"); - return aSupported; - } - - //------------------------------------------------------------------------- - Reference SAL_CALL OAddressBookSourceDialogUno::getPropertySetInfo() throw(RuntimeException) - { - Reference xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; - } - - //------------------------------------------------------------------------- - ::cppu::IPropertyArrayHelper& OAddressBookSourceDialogUno::getInfoHelper() - { - return *const_cast(this)->getArrayHelper(); - } - - //------------------------------------------------------------------------------ - ::cppu::IPropertyArrayHelper* OAddressBookSourceDialogUno::createArrayHelper( ) const - { - Sequence< Property > aProps; - describeProperties(aProps); - return new ::cppu::OPropertyArrayHelper(aProps); - } - - //------------------------------------------------------------------------------ - void OAddressBookSourceDialogUno::executedDialog(sal_Int16 _nExecutionResult) - { - OAddressBookSourceDialogUnoBase::executedDialog(_nExecutionResult); - - if ( _nExecutionResult ) - if ( m_pDialog ) - static_cast< AddressBookSourceDialog* >( m_pDialog )->getFieldMapping( m_aAliases ); - } - - //------------------------------------------------------------------------------ - void OAddressBookSourceDialogUno::implInitialize(const com::sun::star::uno::Any& _rValue) - { - PropertyValue aVal; - if (_rValue >>= aVal) - { - if (0 == aVal.Name.compareToAscii("DataSource")) - { -#if OSL_DEBUG_LEVEL > 0 - sal_Bool bSuccess = -#endif - aVal.Value >>= m_xDataSource; - OSL_ENSURE( bSuccess, "OAddressBookSourceDialogUno::implInitialize: invalid type for DataSource!" ); - return; - } - - if (0 == aVal.Name.compareToAscii("DataSourceName")) - { -#if OSL_DEBUG_LEVEL > 0 - sal_Bool bSuccess = -#endif - aVal.Value >>= m_sDataSourceName; - OSL_ENSURE( bSuccess, "OAddressBookSourceDialogUno::implInitialize: invalid type for DataSourceName!" ); - return; - } - - if (0 == aVal.Name.compareToAscii("Command")) - { -#if OSL_DEBUG_LEVEL > 0 - sal_Bool bSuccess = -#endif - aVal.Value >>= m_sTable; - OSL_ENSURE( bSuccess, "OAddressBookSourceDialogUno::implInitialize: invalid type for Command!" ); - return; - } - } - - OAddressBookSourceDialogUnoBase::implInitialize( _rValue ); - } - - //------------------------------------------------------------------------------ - Dialog* OAddressBookSourceDialogUno::createDialog(Window* _pParent) - { - if ( m_xDataSource.is() && m_sTable.getLength() ) - return new AddressBookSourceDialog(_pParent, m_aContext.getLegacyServiceFactory(), m_xDataSource, m_sDataSourceName, m_sTable, m_aAliases ); - else - return new AddressBookSourceDialog( _pParent, m_aContext.getLegacyServiceFactory() ); - } - -// ....................................................................... -} // namespace svt -// ....................................................................... - diff --git a/svtools/uno/exports.map b/svtools/uno/exports.map deleted file mode 100644 index f4ed78b9e970..000000000000 --- a/svtools/uno/exports.map +++ /dev/null @@ -1,8 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/svtools/uno/makefile.mk b/svtools/uno/makefile.mk deleted file mode 100644 index 8f61c7100508..000000000000 --- a/svtools/uno/makefile.mk +++ /dev/null @@ -1,81 +0,0 @@ -#************************************************************************* -# -# 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 -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.4 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=.. -PRJNAME=svtools -TARGET=svtmisc.uno -LIBTARGET=NO -ENABLE_EXCEPTIONS=TRUE -VISIBILITY_HIDDEN=TRUE - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk -DLLPRE= - -# --- Files ------------------------------------- - -SLOFILES= \ - $(SLO)$/addrtempuno.obj \ - $(SLO)$/miscservices.obj \ - $(SLO)$/pathservice.obj - -SHL1TARGET= $(TARGET) -SHL1IMPLIB= i$(TARGET) - -SHL1OBJS= \ - $(SLO)$/svtdata.obj \ - $(SLOFILES) - -SHL1LIBS= \ - $(SLB)$/filter.uno.lib - -SHL1STDLIBS=\ - $(SVTOOLLIB) \ - $(TKLIB) \ - $(VCLLIB) \ - $(SVLLIB) \ - $(UNOTOOLSLIB) \ - $(TOOLSLIB) \ - $(COMPHELPERLIB) \ - $(VOSLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) - -SHL1VERSIONMAP=exports.map -SHL1DEF= $(MISC)$/$(SHL1TARGET).def -DEF1NAME= $(SHL1TARGET) - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - diff --git a/svtools/uno/miscservices.cxx b/svtools/uno/miscservices.cxx deleted file mode 100644 index e5c5aac3c35d..000000000000 --- a/svtools/uno/miscservices.cxx +++ /dev/null @@ -1,160 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: miscservices.cxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include "sal/types.h" -#include "rtl/ustring.hxx" -#include -#include -#include -#include -#include - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::registry; -using namespace ::com::sun::star::lang; - -using rtl::OUString; - -// ------------------------------------------------------------------------------------- - -// for CreateInstance functions implemented elsewhere -#define DECLARE_CREATEINSTANCE( ImplName ) \ - Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& ); - -// for CreateInstance functions implemented elsewhere, while the function is within a namespace -#define DECLARE_CREATEINSTANCE_NAMESPACE( nmspe, ImplName ) \ - namespace nmspe { \ - Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& ); \ - } - -// ------------------------------------------------------------------------------------- - -DECLARE_CREATEINSTANCE_NAMESPACE( svt, OAddressBookSourceDialogUno ) -DECLARE_CREATEINSTANCE( SvFilterOptionsDialog ) -DECLARE_CREATEINSTANCE( PathService ) - -// ------------------------------------------------------------------------------------- - -extern "C" -{ - -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( - void * /* _pServiceManager */, void * _pRegistryKey ) -{ - if (_pRegistryKey) - { - Reference< XRegistryKey > xRegistryKey ( - reinterpret_cast< XRegistryKey* >( _pRegistryKey )); - Reference< XRegistryKey > xNewKey; - - xNewKey = xRegistryKey->createKey ( - OUString::createFromAscii( "/com.sun.star.comp.svtools.OAddressBookSourceDialogUno/UNO/SERVICES" ) ); - xNewKey->createKey( - OUString::createFromAscii( "com.sun.star.ui.AddressBookSourceDialog" ) ); - - xNewKey = xRegistryKey->createKey ( - OUString::createFromAscii( "/com.sun.star.svtools.SvFilterOptionsDialog/UNO/SERVICES" ) ); - xNewKey->createKey ( - OUString::createFromAscii( "com.sun.star.ui.dialogs.FilterOptionsDialog" ) ); - - xNewKey = xRegistryKey->createKey( - OUString::createFromAscii( "/com.sun.star.comp.svtools.PathService/UNO/SERVICES" ) ); - xNewKey->createKey ( - OUString::createFromAscii( "com.sun.star.config.SpecialConfigManager" ) ); - - return sal_True; - } - return sal_False; -} - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( - const sal_Char * pImplementationName, void * _pServiceManager, void * /* _pRegistryKey */) -{ - void * pResult = 0; - if ( _pServiceManager ) - { - Reference< XSingleServiceFactory > xFactory; - if (rtl_str_compare ( - pImplementationName, "com.sun.star.comp.svtools.OAddressBookSourceDialogUno") == 0) - { - Sequence< OUString > aServiceNames(1); - aServiceNames.getArray()[0] = - OUString::createFromAscii( "com.sun.star.ui.AddressBookSourceDialog" ); - - xFactory = ::cppu::createSingleFactory ( - reinterpret_cast< XMultiServiceFactory* >( _pServiceManager ), - OUString::createFromAscii( pImplementationName ), - svt::OAddressBookSourceDialogUno_CreateInstance, - aServiceNames); - } - else if (rtl_str_compare ( - pImplementationName, "com.sun.star.svtools.SvFilterOptionsDialog") == 0) - { - Sequence< OUString > aServiceNames(1); - aServiceNames.getArray()[0] = - OUString::createFromAscii( "com.sun.star.ui.dialogs.FilterOptionsDialog" ); - - xFactory = ::cppu::createSingleFactory ( - reinterpret_cast< XMultiServiceFactory* >( _pServiceManager ), - OUString::createFromAscii( pImplementationName ), - SvFilterOptionsDialog_CreateInstance, - aServiceNames); - } - else if (rtl_str_compare ( - pImplementationName, "com.sun.star.comp.svtools.PathService") == 0) - { - Sequence< OUString > aServiceNames(1); - aServiceNames.getArray()[0] = - OUString::createFromAscii( "com.sun.star.config.SpecialConfigManager" ); - xFactory = ::cppu::createSingleFactory ( - reinterpret_cast< XMultiServiceFactory* >( _pServiceManager ), - OUString::createFromAscii( pImplementationName ), - PathService_CreateInstance, - aServiceNames); - } - if ( xFactory.is() ) - { - xFactory->acquire(); - pResult = xFactory.get(); - } - } - return pResult; -} - -} // "C" - diff --git a/svtools/uno/pathservice.cxx b/svtools/uno/pathservice.cxx deleted file mode 100644 index 152ff5f316ab..000000000000 --- a/svtools/uno/pathservice.cxx +++ /dev/null @@ -1,106 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: pathservice.cxx,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include -#include "sal/types.h" -#include "rtl/ustring.hxx" -#include -#include -#include - -namespace css = com::sun::star; -using rtl::OUString; - -// ----------------------------------------------------------------------- - -class PathService : public ::cppu::WeakImplHelper2< css::frame::XConfigManager, css::lang::XServiceInfo > -{ - SvtPathOptions m_aOptions; - -public: - PathService() - {} - - virtual OUString SAL_CALL getImplementationName() - throw(css::uno::RuntimeException) - { - return OUString::createFromAscii("com.sun.star.comp.svtools.PathService"); - } - - virtual sal_Bool SAL_CALL supportsService ( - const OUString & rName) - throw(css::uno::RuntimeException) - { - return (rName.compareToAscii("com.sun.star.config.SpecialConfigManager") == 0); - } - - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() - throw(css::uno::RuntimeException) - { - css::uno::Sequence< OUString > aRet(1); - aRet.getArray()[0] = OUString::createFromAscii("com.sun.star.config.SpecialConfigManager"); - return aRet; - } - - virtual OUString SAL_CALL substituteVariables ( - const OUString& sText) - throw(css::uno::RuntimeException) - { - return m_aOptions.SubstituteVariable( sText ); - } - - virtual void SAL_CALL addPropertyChangeListener ( - const OUString &, const css::uno::Reference< css::beans::XPropertyChangeListener > &) - throw(css::uno::RuntimeException) - {} - - virtual void SAL_CALL removePropertyChangeListener ( - const OUString &, const css::uno::Reference< css::beans::XPropertyChangeListener > &) - throw(css::uno::RuntimeException) - {} - - virtual void SAL_CALL flush() - throw(css::uno::RuntimeException) - {} -}; - -// ----------------------------------------------------------------------- - -css::uno::Reference< css::uno::XInterface > PathService_CreateInstance ( - const css::uno::Reference< css::lang::XMultiServiceFactory > &) -{ - return css::uno::Reference< css::uno::XInterface >( - static_cast< cppu::OWeakObject* >(new PathService())); -} - -// ----------------------------------------------------------------------- diff --git a/svtools/unx/inc/convert.hxx b/svtools/unx/inc/convert.hxx deleted file mode 100644 index e91ee4ed2791..000000000000 --- a/svtools/unx/inc/convert.hxx +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: convert.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _CONVERT_HXX -#define _CONVERT_HXX - -/* -#define _SWAPSHORT(x) ((((x) & 0xFF00)>>8) | (((x) & 0x00FF)<<8)) -#define _SWAPLONG(x) ((((x) & 0xFF000000)>>24) | (((x) & 0x00FF0000)>>8) | \ - (((x) & 0x0000FF00)<<8) | (((x) & 0x000000FF)<<24)) -*/ -class Convert -{ -public: - static void Swap( long & nValue ) - { nValue = SWAPLONG( nValue ); } - static void Swap( ULONG & nValue ) - { nValue = SWAPLONG( nValue ); } - static void Swap( short & nValue ) - { nValue = SWAPSHORT( nValue ); } - static void Swap( USHORT & nValue ) - { nValue = SWAPSHORT( nValue ); } - static void Swap( Point & aPtr ) - { Swap( aPtr.X() ); Swap( aPtr.Y() ); } - static void Swap( Size & aSize ) - { Swap( aSize.Width() ); Swap( aSize.Height() ); } - static void Swap( Rectangle & rRect ) - { Swap( rRect.Top() ); Swap( rRect.Bottom() ); - Swap( rRect.Left() ); Swap( rRect.Right() ); } -/* - static USHORT AnsiFloatSize() const { return 6; } - static float AnsiToFloat( void * pAnsiFloat ) - { return 0; } - static USHORT AnsiDoubleSize() const { return 12; } - static double AnsiToDouble( void * pAnsiDouble ) - { return 0; } -*/ -}; - -#endif // _CONVERT_HXX diff --git a/svtools/unx/source/svdde/ddedummy.cxx b/svtools/unx/source/svdde/ddedummy.cxx deleted file mode 100644 index 6f627807bfd3..000000000000 --- a/svtools/unx/source/svdde/ddedummy.cxx +++ /dev/null @@ -1,341 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: ddedummy.cxx,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include -#include - -DdeData::DdeData() -{ -} - -DdeData::DdeData( const String& ) -{ -} - -DdeData::DdeData( const DdeData& ) -{ -} - -DdeData::DdeData( const void*, long, ULONG) -{ -} - -DdeData::~DdeData( void ) -{ -} - -void DdeData::SetFormat( ULONG ) -{ -} - -ULONG DdeData::GetFormat() const -{ - return 0L; -} - -DdeData& DdeData::operator = ( const DdeData& ) -{ - return *this; -} - -DdeData::operator long() const -{ - return 0L; -} - -DdeData::operator const void*() const -{ - return NULL; -} - -long DdeConnection::GetError() -{ - return 0L; -} - -DdeConnection::DdeConnection( const String&, const String& ) -{ -} - -DdeConnection::~DdeConnection( void ) -{ -} - -const String& DdeConnection::GetServiceName() -{ - return String::EmptyString(); -} - -const String& DdeConnection::GetTopicName() -{ - return String::EmptyString(); -} - -DdeTransaction::DdeTransaction( DdeConnection& rConnection, const String&, long ) : - rDde( rConnection ) -{ -} - -DdeTransaction::DdeTransaction( const DdeTransaction& rTransaction ) : - rDde( rTransaction.rDde ) -{ -} - -void DdeTransaction::Execute(void) -{ -} - -void DdeTransaction::Done( BOOL ) -{ -} - -void DdeTransaction::Data( const DdeData* ) -{ -} - -DdeTransaction::~DdeTransaction(void) -{ -} - -DdeRequest::DdeRequest(DdeConnection& rConnection, const String& rString, long lLong ) : - DdeTransaction( rConnection, rString, lLong ) -{ -} - -DdeExecute::DdeExecute( DdeConnection& rConnection, const String& rString, long lLong ) : - DdeTransaction( rConnection, rString, lLong ) -{ -} - -DdePoke::DdePoke( DdeConnection& rConnection, const String& rString, const DdeData&, long lLong ) : - DdeTransaction( rConnection, rString, lLong ) -{ -} - - -DdeTopic::DdeTopic( const String& ) -{ -} - -DdeTopic::~DdeTopic() -{ -} - -void DdeTopic::Connect (long ) -{ -} - -void DdeTopic::Disconnect( long ) -{ -} - -void DdeTopic::InsertItem( DdeItem* ) -{ -} - -DdeItem* DdeTopic::AddItem( const DdeItem& rDdeItem ) -{ - return (DdeItem*) &rDdeItem; -} - -void DdeTopic::RemoveItem( const DdeItem& ) -{ -} - -DdeData* DdeTopic::Get( ULONG ) -{ - return NULL; -} - -BOOL DdeTopic::MakeItem( const String& ) -{ - return FALSE; -} - -BOOL DdeTopic::StartAdviseLoop() -{ - return FALSE; -} - -BOOL DdeTopic::StopAdviseLoop() -{ - return FALSE; -} - -BOOL DdeTopic::Execute( const String* ) -{ - return FALSE; -} - -BOOL DdeTopic::Put( const DdeData* ) -{ - return FALSE; -} - -const String& DdeTopic::GetName() const -{ - return String::EmptyString(); -} - -DdeService::DdeService( const String& ) -{ - nStatus = 0; -} - -String DdeService::Topics() { - return String(); -} - -String DdeService::Formats() { - return String(); -} - -String DdeService::SysItems() { - return String(); -} - -String DdeService::Status() { - return String(); -} - -String DdeService::SysTopicGet(const String& rString) { - return rString; -} - -BOOL DdeService::SysTopicExecute(const String*) { - return FALSE; -} - -DdeService::~DdeService() -{ -} - -BOOL DdeService::IsBusy() -{ - return FALSE; -} - -String DdeService::GetHelp() -{ - return String::EmptyString(); -} - -void DdeService::AddFormat( ULONG ) -{ -} - -void DdeService::AddTopic( const DdeTopic& ) -{ -} - -void DdeService::RemoveTopic( const DdeTopic& ) -{ -} - -BOOL DdeService::MakeTopic( const String& ) -{ - return FALSE; -} - -const String& DdeService::GetName() const -{ - return String::EmptyString(); -} - -namespace -{ - struct theDdeServices - : public rtl::Static< DdeServices, theDdeServices > {}; -} - -DdeServices& DdeService::GetServices() -{ - return theDdeServices::get(); -} - -DdeItem::DdeItem( const String& ) -{ -} - -DdeItem::DdeItem( const DdeItem& ) -{ -} - -DdeItem::~DdeItem() -{ -} - -void DdeItem::NotifyClient() -{ -} - -DdeGetPutItem::DdeGetPutItem( const String& rStr ) : -DdeItem( rStr ) -{ -} - -DdeGetPutItem::DdeGetPutItem( const DdeItem& rItem ) : -DdeItem( rItem ) -{ -} - -DdeData* DdeGetPutItem::Get( ULONG ) -{ - return NULL; -} - -BOOL DdeGetPutItem::Put( const DdeData* ) -{ - return FALSE; -} - -void DdeGetPutItem::AdviseLoop( BOOL ) -{ -} - -DdeLink::DdeLink( DdeConnection& rConnection, const String& rString, long l ) : -DdeTransaction( rConnection, rString, l ) -{ -} - -DdeLink::~DdeLink() -{ -} - -void DdeLink::Notify() -{ -} - -DdeHotLink::DdeHotLink( DdeConnection& rConnection, const String& rString, long l ) : -DdeLink( rConnection, rString, l ) -{ -} diff --git a/svtools/unx/source/svdde/makefile.mk b/svtools/unx/source/svdde/makefile.mk deleted file mode 100644 index d0203fd6378b..000000000000 --- a/svtools/unx/source/svdde/makefile.mk +++ /dev/null @@ -1,50 +0,0 @@ -#************************************************************************* -# -# 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 -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.7 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=svtools -TARGET=svdde - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/ddedummy.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/svtools/util/svl.flt b/svtools/util/svl.flt deleted file mode 100644 index be7de3bce8c5..000000000000 --- a/svtools/util/svl.flt +++ /dev/null @@ -1,85 +0,0 @@ -AUTO_CODE -BrowserDataWin -BrowserColumn -ButtonFrame -CreateLoader -DdeString -DlgSource -DlgExport -EditWindow -FileEntry -GIFLZWDecompressor -GIFReader -PNGReader -ImpDetect -ImpDraw -ImpGet -ImpPut -ImpSvNum -JPEGReader -WMFReader -EnhWMFReader -WMFWriter -LinkStub -MultiTextLineInfo -Regexpr -RemoteControlServer -RemoteControlService -RetStream -SCmdStream -SbxArrayRef -SbxBasicFormater -SbxRes -SbxVariableRef -SfxListUndoAction -SfxPointerEntry -SfxUINT32s -SfxULongRangeItem -SfxULongRanges -SfxULongRangesItem -SgfFontLst -SgfFontOne -StatementCommand -StatementControl -StatementFlow -StatementList -StatementSlot -SVDDE_MISC_CODE -SvInterfaceClient -SvImp -SvStringLockBytes -svtools -SVTOOLS_FILTER -SVTOOLS_CODE -SVTOOLS_FILTER4 -SVTOOLS_FILTER_CODE -ValueSetItem -WMFRecord -WriteRecord -XPMReader -XBMReader -_grow -_ImplINetHistoryLoadTimer -_ImplINetHistoryStoreTimer -sRTF_ -sHTML_ -SdbSqlScanner -Sdbyy_scan -SqlInternalNode -unnamed -WEP -LIBMAIN -LibMain -??_7 -??_8 -??_C -??_E -??_F -??_G -??_H -??_I -0Imp -Impl@@ -Imp@@ -__CT -_STL diff --git a/svtools/util/svl.pmk b/svtools/util/svl.pmk deleted file mode 100644 index aec76257e743..000000000000 --- a/svtools/util/svl.pmk +++ /dev/null @@ -1,35 +0,0 @@ -#************************************************************************* -# -# 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 -# -# $RCSfile: svl.pmk,v $ -# -# $Revision: 1.4 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -# define SVL_DLLIMPLEMENTATION (see @ svldllapi.h) -CDEFS += -DSVL_DLLIMPLEMENTATION - -VISIBILITY_HIDDEN=TRUE diff --git a/svtools/util/svt.flt b/svtools/util/svt.flt deleted file mode 100644 index f021d41b1dca..000000000000 --- a/svtools/util/svt.flt +++ /dev/null @@ -1,81 +0,0 @@ -AUTO_CODE -BrowserDataWin -BrowserColumn -ButtonFrame -CreateLoader -DdeString -DlgSource -DlgExport -EditWindow -FileEntry -GIFLZWDecompressor -GIFReader -PNGReader -ImpDetect -ImpDraw -ImpGet -ImpPut -ImpSv -JPEGReader -WMFReader -EnhWMFReader -WMFWriter -LinkStub -MultiTextLineInfo -Regexpr -RemoteControlServer -RemoteControlService -RetStream -SCmdStream -SbxArrayRef -SbxBasicFormater -SbxRes -SbxVariableRef -SfxListUndoAction -SfxPointerEntry -SfxUINT32s -SfxULongRangeItem -SfxULongRanges -SfxULongRangesItem -SgfFontLst -SgfFontOne -StatementCommand -StatementControl -StatementFlow -StatementList -StatementSlot -SVDDE_MISC_CODE -SvInterfaceClient -SvImp -SvStringLockBytes -SVTOOLS_FILTER -SVTOOLS_CODE -SVTOOLS_FILTER4 -SVTOOLS_FILTER_CODE -ValueSetItem -WMFRecord -WriteRecord -XPMReader -XBMReader -_grow -_ImplINetHistoryLoadTimer -_ImplINetHistoryStoreTimer -sRTF_ -sHTML_ -unnamed -svtools\ -WEP -LIBMAIN -LibMain -??_7 -??_8 -??_C -??_E -??_F -??_G -??_H -??_I -0Imp -Impl@@ -Imp@@ -__CT diff --git a/svtools/win/res/makefile.mk b/svtools/win/res/makefile.mk deleted file mode 100644 index 3c33d006edf9..000000000000 --- a/svtools/win/res/makefile.mk +++ /dev/null @@ -1,30 +0,0 @@ -#************************************************************************* -# -# 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 -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.3 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -- cgit From ebd43b03d516d0d2ee06d9f00cfc884aa81e5631 Mon Sep 17 00:00:00 2001 From: os Date: Thu, 8 Oct 2009 16:15:40 +0200 Subject: #i105687# enable number format for custom date/datetime/time data --- tools/inc/tools/date.hxx | 3 +++ tools/source/datetime/tdate.cxx | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/inc/tools/date.hxx b/tools/inc/tools/date.hxx index 87602e27d874..e14be54b7df1 100644 --- a/tools/inc/tools/date.hxx +++ b/tools/inc/tools/date.hxx @@ -115,6 +115,9 @@ public: TOOLS_DLLPUBLIC friend Date operator +( const Date& rDate, long nDays ); TOOLS_DLLPUBLIC friend Date operator -( const Date& rDate, long nDays ); TOOLS_DLLPUBLIC friend long operator -( const Date& rDate1, const Date& rDate2 ); + + static long DateToDays( USHORT nDay, USHORT nMonth, USHORT nYear ); + }; #endif // _DATE_HXX diff --git a/tools/source/datetime/tdate.cxx b/tools/source/datetime/tdate.cxx index 7f204d5e46da..5f0d7f3ebe1d 100644 --- a/tools/source/datetime/tdate.cxx +++ b/tools/source/datetime/tdate.cxx @@ -88,7 +88,7 @@ inline USHORT DaysInMonth( USHORT nMonth, USHORT nYear ) // ----------------------------------------------------------------------- -static long DateToDays( USHORT nDay, USHORT nMonth, USHORT nYear ) +long Date::DateToDays( USHORT nDay, USHORT nMonth, USHORT nYear ) { long nDays; @@ -489,9 +489,9 @@ Date operator -( const Date& rDate, long nDays ) long operator -( const Date& rDate1, const Date& rDate2 ) { - ULONG nTempDays1 = DateToDays( rDate1.GetDay(), rDate1.GetMonth(), + ULONG nTempDays1 = Date::DateToDays( rDate1.GetDay(), rDate1.GetMonth(), rDate1.GetYear() ); - ULONG nTempDays2 = DateToDays( rDate2.GetDay(), rDate2.GetMonth(), + ULONG nTempDays2 = Date::DateToDays( rDate2.GetDay(), rDate2.GetMonth(), rDate2.GetYear() ); return nTempDays1 - nTempDays2; } -- cgit From cf2b56f39d57c62b17c444025f8dfe14e6149cba Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Thu, 8 Oct 2009 16:48:26 +0200 Subject: #i103496#: make svl buildable --- svl/inc/converter.hxx | 46 +++ svl/inc/makefile.mk | 4 +- svl/inc/misccfg.hxx | 4 +- svl/inc/numuno.hxx | 4 +- svl/inc/pch/precompiled_svl.cxx | 32 ++ svl/inc/pch/precompiled_svl.hxx | 435 ++++++++++++++++++++ svl/inc/pch/precompiled_svtools.cxx | 32 -- svl/inc/pch/precompiled_svtools.hxx | 440 --------------------- svl/inc/poolcach.hxx | 4 +- svl/inc/svl/aeitem.hxx | 4 +- svl/inc/svl/cjkoptions.hxx | 4 +- svl/inc/svl/ctloptions.hxx | 4 +- svl/inc/svl/documentlockfile.hxx | 4 +- svl/inc/svl/eitem.hxx | 6 +- svl/inc/svl/flagitem.hxx | 6 +- svl/inc/svl/globalnameitem.hxx | 4 +- svl/inc/svl/imageitm.hxx | 4 +- svl/inc/svl/intitem.hxx | 14 +- svl/inc/svl/languageoptions.hxx | 6 +- svl/inc/svl/lockfilecommon.hxx | 4 +- svl/inc/svl/macitem.hxx | 8 +- svl/inc/svl/metitem.hxx | 6 +- svl/inc/svl/ownlist.hxx | 8 +- svl/inc/svl/ptitem.hxx | 6 +- svl/inc/svl/rectitem.hxx | 6 +- svl/inc/svl/restrictedpaths.hxx | 4 +- svl/inc/svl/rngitem.hxx | 6 +- svl/inc/svl/sharecontrolfile.hxx | 4 +- svl/inc/svl/stritem.hxx | 4 +- svl/inc/svl/style.hxx | 28 +- svl/inc/svl/svdde.hxx | 34 +- svl/inc/svl/svldata.hxx | 62 +-- svl/inc/svl/syslocale.hxx | 6 +- svl/inc/svl/syslocaleoptions.hxx | 6 +- svl/inc/svl/undo.hxx | 14 +- svl/inc/svl/zforlist.hxx | 52 +-- svl/inc/svl/zformat.hxx | 50 +-- svl/inc/urihelper.hxx | 20 +- svl/prj/build.lst | 78 ++-- svl/prj/d.lst | 123 +----- svl/qa/complex/ConfigItems/helper/makefile.mk | 4 +- svl/qa/complex/ConfigItems/makefile.mk | 2 +- svl/qa/complex/passwordcontainer/makefile.mk | 2 +- svl/qa/makefile.mk | 4 +- svl/qa/test_URIHelper.cxx | 2 +- svl/source/config/cjkoptions.cxx | 7 +- svl/source/config/ctloptions.cxx | 7 +- svl/source/config/itemholder2.cxx | 54 +-- svl/source/config/languageoptions.cxx | 7 +- svl/source/config/makefile.mk | 16 +- svl/source/config/misccfg.cxx | 7 +- svl/source/config/syslocaleoptions.cxx | 7 +- svl/source/filepicker/makefile.mk | 2 +- svl/source/filepicker/pickerhelper.cxx | 2 +- svl/source/filepicker/pickerhistory.cxx | 2 +- svl/source/filerec/filerec.cxx | 2 +- svl/source/filerec/makefile.mk | 2 +- svl/source/fsstor/fsfactory.cxx | 2 +- svl/source/fsstor/fsstorage.cxx | 2 +- svl/source/fsstor/makefile.mk | 2 +- svl/source/fsstor/oinputstreamcontainer.cxx | 2 +- svl/source/fsstor/ostreamcontainer.cxx | 2 +- svl/source/items/aeitem.cxx | 2 +- svl/source/items/bintitem.cxx | 2 +- svl/source/items/cenumitm.cxx | 2 +- svl/source/items/cintitem.cxx | 2 +- svl/source/items/cntwall.cxx | 2 +- svl/source/items/cstitem.cxx | 24 +- svl/source/items/ctypeitm.cxx | 2 +- svl/source/items/custritm.cxx | 2 +- svl/source/items/dateitem.cxx | 6 +- svl/source/items/dtritem.cxx | 2 +- svl/source/items/eitem.cxx | 2 +- svl/source/items/flagitem.cxx | 2 +- svl/source/items/frqitem.cxx | 2 +- svl/source/items/globalnameitem.cxx | 2 +- svl/source/items/ilstitem.cxx | 2 +- svl/source/items/imageitm.cxx | 2 +- svl/source/items/intitem.cxx | 2 +- svl/source/items/itemiter.cxx | 2 +- svl/source/items/itempool.cxx | 2 +- svl/source/items/itemprop.cxx | 2 +- svl/source/items/itemset.cxx | 2 +- svl/source/items/lckbitem.cxx | 2 +- svl/source/items/macitem.cxx | 2 +- svl/source/items/makefile.mk | 38 +- svl/source/items/nranges.cxx | 2 +- svl/source/items/poolcach.cxx | 2 +- svl/source/items/poolio.cxx | 12 +- svl/source/items/poolitem.cxx | 2 +- svl/source/items/ptitem.cxx | 2 +- svl/source/items/rectitem.cxx | 2 +- svl/source/items/rngitem.cxx | 2 +- svl/source/items/sfontitm.cxx | 2 +- svl/source/items/sitem.cxx | 2 +- svl/source/items/slstitm.cxx | 2 +- svl/source/items/stritem.cxx | 2 +- svl/source/items/style.cxx | 2 +- svl/source/items/szitem.cxx | 2 +- svl/source/items/tfrmitem.cxx | 2 +- svl/source/items/tresitem.cxx | 2 +- svl/source/items/visitem.cxx | 2 +- svl/source/items/whiter.cxx | 2 +- svl/source/memtools/makefile.mk | 2 +- svl/source/memtools/svarray.cxx | 2 +- svl/source/misc/PasswordHelper.cxx | 2 +- svl/source/misc/adrparse.cxx | 2 +- svl/source/misc/documentlockfile.cxx | 2 +- svl/source/misc/filenotation.cxx | 2 +- svl/source/misc/flbytes.cxx | 2 +- svl/source/misc/folderrestriction.cxx | 2 +- svl/source/misc/fstathelper.cxx | 2 +- svl/source/misc/inethist.cxx | 2 +- svl/source/misc/inettype.cxx | 4 +- svl/source/misc/lngmisc.cxx | 2 +- svl/source/misc/lockfilecommon.cxx | 2 +- svl/source/misc/makefile.mk | 75 ++++ svl/source/misc/ownlist.cxx | 2 +- svl/source/misc/restrictedpaths.cxx | 2 +- svl/source/misc/sharecontrolfile.cxx | 2 +- svl/source/misc/strmadpt.cxx | 2 +- svl/source/misc/svldata.cxx | 49 +-- svl/source/misc/urihelper.cxx | 2 +- svl/source/notify/brdcst.cxx | 2 +- svl/source/notify/broadcast.cxx | 2 +- svl/source/notify/cancel.cxx | 2 +- svl/source/notify/hint.cxx | 2 +- svl/source/notify/isethint.cxx | 2 +- svl/source/notify/listener.cxx | 2 +- svl/source/notify/listenerbase.cxx | 2 +- svl/source/notify/listeneriter.cxx | 2 +- svl/source/notify/lstner.cxx | 2 +- svl/source/notify/makefile.mk | 2 +- svl/source/notify/smplhint.cxx | 2 +- svl/source/numbers/makefile.mk | 4 +- svl/source/numbers/nbdll.cxx | 2 +- svl/source/numbers/numfmuno.cxx | 2 +- svl/source/numbers/numhead.cxx | 2 +- svl/source/numbers/numuno.cxx | 2 +- svl/source/numbers/supservs.cxx | 2 +- svl/source/numbers/zforfind.cxx | 2 +- svl/source/numbers/zforlist.cxx | 2 +- svl/source/numbers/zformat.cxx | 2 +- svl/source/numbers/zforscan.cxx | 2 +- svl/source/passwordcontainer/makefile.mk | 2 +- svl/source/passwordcontainer/passwordcontainer.cxx | 2 +- svl/source/svdde/ddecli.cxx | 2 +- svl/source/svdde/ddedata.cxx | 2 +- svl/source/svdde/ddedll.cxx | 2 +- svl/source/svdde/ddeinf.cxx | 2 +- svl/source/svdde/ddeml1.cxx | 2 +- svl/source/svdde/ddeml2.cxx | 2 +- svl/source/svdde/ddemldeb.cxx | 2 +- svl/source/svdde/ddestrg.cxx | 2 +- svl/source/svdde/ddesvr.cxx | 2 +- svl/source/svdde/ddewrap.cxx | 2 +- svl/source/svdde/makefile.mk | 4 +- svl/source/svsql/converter.cxx | 2 +- svl/source/svsql/converter.hxx | 46 --- svl/source/svsql/makefile.mk | 2 +- svl/source/syslocale/makefile.mk | 4 +- svl/source/syslocale/syslocale.cxx | 2 +- svl/source/undo/makefile.mk | 4 +- svl/source/undo/undo.cxx | 2 +- svl/source/uno/makefile.mk | 19 +- svl/source/uno/pathservice.cxx | 106 +++++ svl/source/uno/registerservices.cxx | 20 +- svl/uno/addrtempuno.cxx | 248 ------------ svl/uno/exports.map | 8 - svl/uno/makefile.mk | 81 ---- svl/uno/miscservices.cxx | 160 -------- svl/uno/pathservice.cxx | 106 ----- svl/unx/source/svdde/ddedummy.cxx | 2 +- svl/unx/source/svdde/makefile.mk | 4 +- svl/util/makefile.mk | 204 ++-------- svtools/source/uno/addrtempuno.cxx | 248 ++++++++++++ svtools/source/uno/makefile.mk | 17 +- svtools/source/uno/miscservices.cxx | 143 +++++++ 178 files changed, 1551 insertions(+), 1990 deletions(-) create mode 100644 svl/inc/converter.hxx create mode 100644 svl/inc/pch/precompiled_svl.cxx create mode 100644 svl/inc/pch/precompiled_svl.hxx delete mode 100644 svl/inc/pch/precompiled_svtools.cxx delete mode 100644 svl/inc/pch/precompiled_svtools.hxx create mode 100644 svl/source/misc/makefile.mk delete mode 100644 svl/source/svsql/converter.hxx create mode 100644 svl/source/uno/pathservice.cxx delete mode 100644 svl/uno/addrtempuno.cxx delete mode 100644 svl/uno/exports.map delete mode 100644 svl/uno/makefile.mk delete mode 100644 svl/uno/miscservices.cxx delete mode 100644 svl/uno/pathservice.cxx create mode 100644 svtools/source/uno/addrtempuno.cxx create mode 100644 svtools/source/uno/miscservices.cxx diff --git a/svl/inc/converter.hxx b/svl/inc/converter.hxx new file mode 100644 index 000000000000..f6a5d67ca966 --- /dev/null +++ b/svl/inc/converter.hxx @@ -0,0 +1,46 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: converter.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SV_CONVERTER_HXX_ +#define _SV_CONVERTER_HXX_ + +#include "svtools/svldllapi.h" +#include + +class SvDbaseConverter +{ +public: + SVL_DLLPUBLIC static INT32 ConvertPrecisionToDbase(INT32 _nLen, INT32 _nScale); + SVL_DLLPUBLIC static INT32 ConvertPrecisionToOdbc(INT32 _nLen, INT32 _nScale); +}; + +#endif //_CONVERTER_HXX_ + + + diff --git a/svl/inc/makefile.mk b/svl/inc/makefile.mk index a9974d75065c..9368bce7cde1 100644 --- a/svl/inc/makefile.mk +++ b/svl/inc/makefile.mk @@ -30,13 +30,13 @@ #************************************************************************* PRJ=.. -PRJNAME=svtools +PRJNAME=svl TARGET=inc # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk +.INCLUDE : $(PRJ)$/util$/svl.pmk # --- Files -------------------------------------------------------- # --- Targets ------------------------------------------------------- diff --git a/svl/inc/misccfg.hxx b/svl/inc/misccfg.hxx index 3f897e1cecc3..9689b04cef89 100644 --- a/svl/inc/misccfg.hxx +++ b/svl/inc/misccfg.hxx @@ -30,7 +30,7 @@ #ifndef _SFX_MISCCFG_HXX #define _SFX_MISCCFG_HXX -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include "tools/solar.h" #include "unotools/configitem.hxx" @@ -38,7 +38,7 @@ Beschreibung: --------------------------------------------------------------------*/ -class SVT_DLLPUBLIC SfxMiscCfg : public utl::ConfigItem +class SVL_DLLPUBLIC SfxMiscCfg : public utl::ConfigItem { BOOL bPaperSize; // printer warnings BOOL bPaperOrientation; diff --git a/svl/inc/numuno.hxx b/svl/inc/numuno.hxx index c31829dec020..d6f5621246fd 100644 --- a/svl/inc/numuno.hxx +++ b/svl/inc/numuno.hxx @@ -30,7 +30,7 @@ #ifndef _NUMUNO_HXX #define _NUMUNO_HXX -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include #include #include @@ -57,7 +57,7 @@ com::sun::star::uno::Reference SAL_CALL // SvNumberFormatsSupplierObj: aggregate to document, // construct with SvNumberFormatter -class SVT_DLLPUBLIC SvNumberFormatsSupplierObj : public cppu::WeakAggImplHelper2< +class SVL_DLLPUBLIC SvNumberFormatsSupplierObj : public cppu::WeakAggImplHelper2< com::sun::star::util::XNumberFormatsSupplier, com::sun::star::lang::XUnoTunnel> { diff --git a/svl/inc/pch/precompiled_svl.cxx b/svl/inc/pch/precompiled_svl.cxx new file mode 100644 index 000000000000..da41b68a5eae --- /dev/null +++ b/svl/inc/pch/precompiled_svl.cxx @@ -0,0 +1,32 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: precompiled_svtools.cxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_svl.hxx" + diff --git a/svl/inc/pch/precompiled_svl.hxx b/svl/inc/pch/precompiled_svl.hxx new file mode 100644 index 000000000000..b41e2ca89fc6 --- /dev/null +++ b/svl/inc/pch/precompiled_svl.hxx @@ -0,0 +1,435 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: precompiled_svtools.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): Generated on 2006-09-01 17:50:05.076676 + +#ifdef PRECOMPILED_HEADERS + +//---MARKER--- +#include "sal/config.h" +#include "sal/types.h" + +#include "com/sun/star/accessibility/AccessibleEventId.hpp" +#include "com/sun/star/accessibility/AccessibleRelationType.hpp" +#include "com/sun/star/accessibility/AccessibleRole.hpp" +#include "com/sun/star/accessibility/AccessibleStateType.hpp" +#include "com/sun/star/accessibility/AccessibleTextType.hpp" +#include "com/sun/star/accessibility/XAccessible.hpp" +#include "com/sun/star/accessibility/XAccessibleContext.hpp" +#include "com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "com/sun/star/awt/FontWeight.hpp" +#include "com/sun/star/beans/XPropertySet.hpp" +#include "com/sun/star/beans/XPropertySetInfo.hpp" +#include "com/sun/star/io/XAsyncOutputMonitor.hpp" +#include "com/sun/star/lang/EventObject.hpp" +#include "com/sun/star/lang/Locale.hpp" +#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" +#include "com/sun/star/lang/XComponent.hpp" +#include "com/sun/star/lang/XMultiComponentFactory.hpp" +#include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "com/sun/star/ucb/Command.hpp" +#include "com/sun/star/ucb/CommandAbortedException.hpp" +#include "com/sun/star/ucb/IllegalIdentifierException.hpp" +#include "com/sun/star/ucb/UnsupportedCommandException.hpp" +#include "com/sun/star/ucb/XCommandEnvironment.hpp" +#include "com/sun/star/ucb/XCommandProcessor.hpp" +#include "com/sun/star/ucb/XContent.hpp" +#include "com/sun/star/ucb/XContentIdentifier.hpp" +#include "com/sun/star/ucb/XContentIdentifierFactory.hpp" +#include "com/sun/star/ucb/XContentProvider.hpp" +#include "com/sun/star/ucb/XContentProviderManager.hpp" +#include "com/sun/star/ui/dialogs/XFilePicker.hpp" +#include "com/sun/star/ui/dialogs/XFolderPicker.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uri/XUriReference.hpp" +#include "com/sun/star/uri/XUriReferenceFactory.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + + +#include +#include + +#include "comphelper/processfactory.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cppuhelper/bootstrap.hxx" +#include "cppuhelper/exc_hlp.hxx" +#include "cppuhelper/factory.hxx" +#include "cppuhelper/interfacecontainer.hxx" +#include "cppuhelper/weakref.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "rtl/crc.h" +#include "rtl/memory.h" +#include "rtl/strbuf.hxx" +#include "rtl/string.h" +#include "rtl/string.hxx" +#include "rtl/textenc.h" +#include "rtl/ustrbuf.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "unotools/configitem.hxx" +#include "unotools/configmgr.hxx" + +#include + +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +//---MARKER--- + +#endif + diff --git a/svl/inc/pch/precompiled_svtools.cxx b/svl/inc/pch/precompiled_svtools.cxx deleted file mode 100644 index 2346d52b68af..000000000000 --- a/svl/inc/pch/precompiled_svtools.cxx +++ /dev/null @@ -1,32 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: precompiled_svtools.cxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "precompiled_svtools.hxx" - diff --git a/svl/inc/pch/precompiled_svtools.hxx b/svl/inc/pch/precompiled_svtools.hxx deleted file mode 100644 index cab81cac04ec..000000000000 --- a/svl/inc/pch/precompiled_svtools.hxx +++ /dev/null @@ -1,440 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: precompiled_svtools.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): Generated on 2006-09-01 17:50:05.076676 - -#ifdef PRECOMPILED_HEADERS - -//---MARKER--- -#include "sal/config.h" -#include "sal/types.h" - -#include "com/sun/star/accessibility/AccessibleEventId.hpp" -#include "com/sun/star/accessibility/AccessibleRelationType.hpp" -#include "com/sun/star/accessibility/AccessibleRole.hpp" -#include "com/sun/star/accessibility/AccessibleStateType.hpp" -#include "com/sun/star/accessibility/AccessibleTextType.hpp" -#include "com/sun/star/accessibility/XAccessible.hpp" -#include "com/sun/star/accessibility/XAccessibleContext.hpp" -#include "com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "com/sun/star/awt/FontWeight.hpp" -#include "com/sun/star/beans/XPropertySet.hpp" -#include "com/sun/star/beans/XPropertySetInfo.hpp" -#include "com/sun/star/io/XAsyncOutputMonitor.hpp" -#include "com/sun/star/lang/EventObject.hpp" -#include "com/sun/star/lang/Locale.hpp" -#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" -#include "com/sun/star/lang/XComponent.hpp" -#include "com/sun/star/lang/XMultiComponentFactory.hpp" -#include "com/sun/star/lang/XMultiServiceFactory.hpp" -#include "com/sun/star/ucb/Command.hpp" -#include "com/sun/star/ucb/CommandAbortedException.hpp" -#include "com/sun/star/ucb/IllegalIdentifierException.hpp" -#include "com/sun/star/ucb/UnsupportedCommandException.hpp" -#include "com/sun/star/ucb/XCommandEnvironment.hpp" -#include "com/sun/star/ucb/XCommandProcessor.hpp" -#include "com/sun/star/ucb/XContent.hpp" -#include "com/sun/star/ucb/XContentIdentifier.hpp" -#include "com/sun/star/ucb/XContentIdentifierFactory.hpp" -#include "com/sun/star/ucb/XContentProvider.hpp" -#include "com/sun/star/ucb/XContentProviderManager.hpp" -#include "com/sun/star/ui/dialogs/XFilePicker.hpp" -#include "com/sun/star/ui/dialogs/XFolderPicker.hpp" -#include "com/sun/star/uno/Exception.hpp" -#include "com/sun/star/uno/RuntimeException.hpp" -#include "com/sun/star/uno/XComponentContext.hpp" -#include "com/sun/star/uno/XInterface.hpp" -#include "com/sun/star/uri/XUriReference.hpp" -#include "com/sun/star/uri/XUriReferenceFactory.hpp" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include - -#include "comphelper/processfactory.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "cppuhelper/bootstrap.hxx" -#include "cppuhelper/exc_hlp.hxx" -#include "cppuhelper/factory.hxx" -#include "cppuhelper/interfacecontainer.hxx" -#include "cppuhelper/weakref.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "rtl/crc.h" -#include "rtl/memory.h" -#include "rtl/strbuf.hxx" -#include "rtl/string.h" -#include "rtl/string.hxx" -#include "rtl/textenc.h" -#include "rtl/ustrbuf.hxx" -#include "rtl/ustring.h" -#include "rtl/ustring.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "unotools/configitem.hxx" -#include "unotools/configmgr.hxx" - -#include - -#include - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -//---MARKER--- - -#endif - diff --git a/svl/inc/poolcach.hxx b/svl/inc/poolcach.hxx index 20d9e4d19c43..8e7cf3ddbfa7 100644 --- a/svl/inc/poolcach.hxx +++ b/svl/inc/poolcach.hxx @@ -30,7 +30,7 @@ #ifndef _SFXPOOLCACH_HXX #define _SFXPOOLCACH_HXX -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include class SfxItemModifyArr_Impl; @@ -39,7 +39,7 @@ class SfxItemSet; class SfxPoolItem; class SfxSetItem; -class SVT_DLLPUBLIC SfxItemPoolCache +class SVL_DLLPUBLIC SfxItemPoolCache { SfxItemPool *pPool; SfxItemModifyArr_Impl *pCache; diff --git a/svl/inc/svl/aeitem.hxx b/svl/inc/svl/aeitem.hxx index 5cfd3d0fc15e..e10b3f7a8e70 100644 --- a/svl/inc/svl/aeitem.hxx +++ b/svl/inc/svl/aeitem.hxx @@ -30,14 +30,14 @@ #ifndef _AEITEM_HXX #define _AEITEM_HXX -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include #include class SfxAllEnumValueArr; class SvUShorts; -class SVT_DLLPUBLIC SfxAllEnumItem: public SfxEnumItem +class SVL_DLLPUBLIC SfxAllEnumItem: public SfxEnumItem { SfxAllEnumValueArr* pValues; SvUShorts* pDisabledValues; diff --git a/svl/inc/svl/cjkoptions.hxx b/svl/inc/svl/cjkoptions.hxx index 1573a029f29f..03a4e0216e82 100644 --- a/svl/inc/svl/cjkoptions.hxx +++ b/svl/inc/svl/cjkoptions.hxx @@ -30,7 +30,7 @@ #ifndef _SVTOOLS_CJKOPTIONS_HXX #define _SVTOOLS_CJKOPTIONS_HXX -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include #include @@ -38,7 +38,7 @@ class SvtCJKOptions_Impl; // class SvtCJKOptions -------------------------------------------------- -class SVT_DLLPUBLIC SvtCJKOptions: public utl::detail::Options +class SVL_DLLPUBLIC SvtCJKOptions: public utl::detail::Options { private: SvtCJKOptions_Impl* pImp; diff --git a/svl/inc/svl/ctloptions.hxx b/svl/inc/svl/ctloptions.hxx index 4157d129cce1..fae5e13dfbb8 100644 --- a/svl/inc/svl/ctloptions.hxx +++ b/svl/inc/svl/ctloptions.hxx @@ -30,7 +30,7 @@ #ifndef _SVTOOLS_CTLOPTIONS_HXX #define _SVTOOLS_CTLOPTIONS_HXX -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include #include #include @@ -40,7 +40,7 @@ class SvtCTLOptions_Impl; // class SvtCTLOptions -------------------------------------------------------- -class SVT_DLLPUBLIC SvtCTLOptions: +class SVL_DLLPUBLIC SvtCTLOptions: public utl::detail::Options, public SfxBroadcaster, public SfxListener { private: diff --git a/svl/inc/svl/documentlockfile.hxx b/svl/inc/svl/documentlockfile.hxx index f2625f7955bb..91074908cf8a 100644 --- a/svl/inc/svl/documentlockfile.hxx +++ b/svl/inc/svl/documentlockfile.hxx @@ -32,7 +32,7 @@ #ifndef _SVT_DOCUMENTLOCKFILE_HXX #define _SVT_DOCUMENTLOCKFILE_HXX -#include +#include #include #include @@ -45,7 +45,7 @@ namespace svt { -class SVT_DLLPUBLIC DocumentLockFile : public LockFileCommon +class SVL_DLLPUBLIC DocumentLockFile : public LockFileCommon { // the workaround for automated testing! static sal_Bool m_bAllowInteraction; diff --git a/svl/inc/svl/eitem.hxx b/svl/inc/svl/eitem.hxx index f9e1927a881d..1a9aa8fd63a0 100644 --- a/svl/inc/svl/eitem.hxx +++ b/svl/inc/svl/eitem.hxx @@ -31,11 +31,11 @@ #ifndef _SFXENUMITEM_HXX #define _SFXENUMITEM_HXX -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include //============================================================================ -class SVT_DLLPUBLIC SfxEnumItem: public CntEnumItem +class SVL_DLLPUBLIC SfxEnumItem: public CntEnumItem { protected: SfxEnumItem(USHORT which = 0, USHORT nValue = 0): @@ -50,7 +50,7 @@ public: }; //============================================================================ -class SVT_DLLPUBLIC SfxBoolItem: public CntBoolItem +class SVL_DLLPUBLIC SfxBoolItem: public CntBoolItem { public: TYPEINFO(); diff --git a/svl/inc/svl/flagitem.hxx b/svl/inc/svl/flagitem.hxx index 5298bbd1678b..1ea04db955c5 100644 --- a/svl/inc/svl/flagitem.hxx +++ b/svl/inc/svl/flagitem.hxx @@ -30,7 +30,7 @@ #ifndef _SFXFLAGITEM_HXX #define _SFXFLAGITEM_HXX -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include #include #include @@ -41,9 +41,9 @@ extern USHORT nSfxFlagVal[16]; // ----------------------------------------------------------------------- -DBG_NAMEEX_VISIBILITY(SfxFlagItem, SVT_DLLPUBLIC) +DBG_NAMEEX_VISIBILITY(SfxFlagItem, SVL_DLLPUBLIC) -class SVT_DLLPUBLIC SfxFlagItem: public SfxPoolItem +class SVL_DLLPUBLIC SfxFlagItem: public SfxPoolItem { USHORT nVal; diff --git a/svl/inc/svl/globalnameitem.hxx b/svl/inc/svl/globalnameitem.hxx index f19ea1dd8457..7e01d3487d95 100644 --- a/svl/inc/svl/globalnameitem.hxx +++ b/svl/inc/svl/globalnameitem.hxx @@ -30,7 +30,7 @@ #ifndef _GLOBALNAMEITEM_HXX #define _GLOBALNAMEITEM_HXX -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include #include #include @@ -38,7 +38,7 @@ // ----------------------------------------------------------------------- -class SVT_DLLPUBLIC SfxGlobalNameItem: public SfxPoolItem +class SVL_DLLPUBLIC SfxGlobalNameItem: public SfxPoolItem { SvGlobalName m_aName; diff --git a/svl/inc/svl/imageitm.hxx b/svl/inc/svl/imageitm.hxx index e0151729c2e0..ec5552e3d217 100644 --- a/svl/inc/svl/imageitm.hxx +++ b/svl/inc/svl/imageitm.hxx @@ -31,13 +31,13 @@ #ifndef _SVT_IMAGEITM_HXX #define _SVT_IMAGEITM_HXX -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include class String; struct SfxImageItem_Impl; -class SVT_DLLPUBLIC SfxImageItem : public SfxInt16Item +class SVL_DLLPUBLIC SfxImageItem : public SfxInt16Item { SfxImageItem_Impl* pImp; public: diff --git a/svl/inc/svl/intitem.hxx b/svl/inc/svl/intitem.hxx index fe2a3543e630..d54267eb4de1 100644 --- a/svl/inc/svl/intitem.hxx +++ b/svl/inc/svl/intitem.hxx @@ -31,11 +31,11 @@ #ifndef _SFXINTITEM_HXX #define _SFXINTITEM_HXX -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include //============================================================================ -class SVT_DLLPUBLIC SfxByteItem: public CntByteItem +class SVL_DLLPUBLIC SfxByteItem: public CntByteItem { public: TYPEINFO(); @@ -53,9 +53,9 @@ public: }; //============================================================================ -DBG_NAMEEX_VISIBILITY(SfxInt16Item, SVT_DLLPUBLIC) +DBG_NAMEEX_VISIBILITY(SfxInt16Item, SVL_DLLPUBLIC) -class SVT_DLLPUBLIC SfxInt16Item: public SfxPoolItem +class SVL_DLLPUBLIC SfxInt16Item: public SfxPoolItem { INT16 m_nValue; @@ -115,7 +115,7 @@ inline void SfxInt16Item::SetValue(INT16 nTheValue) } //============================================================================ -class SVT_DLLPUBLIC SfxUInt16Item: public CntUInt16Item +class SVL_DLLPUBLIC SfxUInt16Item: public CntUInt16Item { public: TYPEINFO(); @@ -134,7 +134,7 @@ public: }; //============================================================================ -class SVT_DLLPUBLIC SfxInt32Item: public CntInt32Item +class SVL_DLLPUBLIC SfxInt32Item: public CntInt32Item { public: TYPEINFO(); @@ -154,7 +154,7 @@ public: }; //============================================================================ -class SVT_DLLPUBLIC SfxUInt32Item: public CntUInt32Item +class SVL_DLLPUBLIC SfxUInt32Item: public CntUInt32Item { public: TYPEINFO(); diff --git a/svl/inc/svl/languageoptions.hxx b/svl/inc/svl/languageoptions.hxx index ed247ac01fa3..52ec53089b8a 100644 --- a/svl/inc/svl/languageoptions.hxx +++ b/svl/inc/svl/languageoptions.hxx @@ -30,7 +30,7 @@ #ifndef _SVTOOLS_LANGUAGEOPTIONS_HXX #define _SVTOOLS_LANGUAGEOPTIONS_HXX -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include #include #include @@ -47,7 +47,7 @@ class SvtCJKOptions; class SvtCTLOptions; -class SVT_DLLPUBLIC SvtLanguageOptions : public SfxBroadcaster, public SfxListener +class SVL_DLLPUBLIC SvtLanguageOptions : public SfxBroadcaster, public SfxListener { private: SvtCJKOptions* m_pCJKOptions; @@ -113,7 +113,7 @@ public: }; /** #i42730# Gives access to the Windows 16bit system locale */ -class SVT_DLLPUBLIC SvtSystemLanguageOptions : public utl::ConfigItem +class SVL_DLLPUBLIC SvtSystemLanguageOptions : public utl::ConfigItem { private: ::rtl::OUString m_sWin16SystemLocale; diff --git a/svl/inc/svl/lockfilecommon.hxx b/svl/inc/svl/lockfilecommon.hxx index c8bd6251f9cb..7d97d6c952cd 100644 --- a/svl/inc/svl/lockfilecommon.hxx +++ b/svl/inc/svl/lockfilecommon.hxx @@ -32,7 +32,7 @@ #ifndef _SVT_LOCKFILECOMMON_HXX #define _SVT_LOCKFILECOMMON_HXX -#include +#include #include #include @@ -54,7 +54,7 @@ namespace svt { // This is a general implementation that is used in document lock file implementation and in sharing control file implementation -class SVT_DLLPUBLIC LockFileCommon +class SVL_DLLPUBLIC LockFileCommon { protected: ::osl::Mutex m_aMutex; diff --git a/svl/inc/svl/macitem.hxx b/svl/inc/svl/macitem.hxx index 2e43120f653d..f1790bf5f294 100644 --- a/svl/inc/svl/macitem.hxx +++ b/svl/inc/svl/macitem.hxx @@ -32,7 +32,7 @@ // class SvxMacroItem ---------------------------------------------------- -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include #include #include @@ -72,7 +72,7 @@ public: class SjJSbxObject; -class SVT_DLLPUBLIC SvxMacro +class SVL_DLLPUBLIC SvxMacro { String aMacName; String aLibName; @@ -125,7 +125,7 @@ DECLARE_TABLE( _SvxMacroTableDtor, SvxMacro* ) #define SVX_MACROTBL_AKTVERSION SVX_MACROTBL_VERSION40 -class SVT_DLLPUBLIC SvxMacroTableDtor : public _SvxMacroTableDtor +class SVL_DLLPUBLIC SvxMacroTableDtor : public _SvxMacroTableDtor { public: inline SvxMacroTableDtor( const USHORT nInitSz = 0, const USHORT nReSz = 1 ); @@ -152,7 +152,7 @@ inline SvxMacroTableDtor::SvxMacroTableDtor( const USHORT nInitSz, Dieses Item beschreibt eine Makro-Tabelle. */ -class SVT_DLLPUBLIC SvxMacroItem: public SfxPoolItem +class SVL_DLLPUBLIC SvxMacroItem: public SfxPoolItem { public: TYPEINFO(); diff --git a/svl/inc/svl/metitem.hxx b/svl/inc/svl/metitem.hxx index a37d119d57c1..0289d5cb8e00 100644 --- a/svl/inc/svl/metitem.hxx +++ b/svl/inc/svl/metitem.hxx @@ -30,14 +30,14 @@ #ifndef _SFXMETRICITEM_HXX #define _SFXMETRICITEM_HXX -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include -DBG_NAMEEX_VISIBILITY(SfxMetricItem, SVT_DLLPUBLIC) +DBG_NAMEEX_VISIBILITY(SfxMetricItem, SVL_DLLPUBLIC) // ----------------------------------------------------------------------- -class SVT_DLLPUBLIC SfxMetricItem: public SfxInt32Item +class SVL_DLLPUBLIC SfxMetricItem: public SfxInt32Item { public: TYPEINFO(); diff --git a/svl/inc/svl/ownlist.hxx b/svl/inc/svl/ownlist.hxx index 472f50e6ef60..397e4f532521 100644 --- a/svl/inc/svl/ownlist.hxx +++ b/svl/inc/svl/ownlist.hxx @@ -31,7 +31,7 @@ #ifndef _OWNLIST_HXX #define _OWNLIST_HXX -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include #include #include @@ -79,7 +79,7 @@ public: }; //========================================================================= -class SVT_DLLPUBLIC SvCommandList +class SVL_DLLPUBLIC SvCommandList /* [Beschreibung] Die Liste enth"alt Objekte vom Typ SvCommand. Wird ein Objekt @@ -95,8 +95,8 @@ class SVT_DLLPUBLIC SvCommandList BOOL FillFromSequence( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& ); void FillSequence( com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& ); - SVT_DLLPUBLIC friend SvStream& operator >> ( SvStream& rStm, SvCommandList & ); - SVT_DLLPUBLIC friend SvStream& operator << ( SvStream&, const SvCommandList & ); + SVL_DLLPUBLIC friend SvStream& operator >> ( SvStream& rStm, SvCommandList & ); + SVL_DLLPUBLIC friend SvStream& operator << ( SvStream&, const SvCommandList & ); }; #endif // _OWNLIST_HXX diff --git a/svl/inc/svl/ptitem.hxx b/svl/inc/svl/ptitem.hxx index 923ab73da1d5..5ce99c09b98f 100644 --- a/svl/inc/svl/ptitem.hxx +++ b/svl/inc/svl/ptitem.hxx @@ -30,17 +30,17 @@ #ifndef _SFXPTITEM_HXX #define _SFXPTITEM_HXX -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include #include class SvStream; -DBG_NAMEEX_VISIBILITY(SfxPointItem, SVT_DLLPUBLIC) +DBG_NAMEEX_VISIBILITY(SfxPointItem, SVL_DLLPUBLIC) // ----------------------------------------------------------------------- -class SVT_DLLPUBLIC SfxPointItem: public SfxPoolItem +class SVL_DLLPUBLIC SfxPointItem: public SfxPoolItem { Point aVal; diff --git a/svl/inc/svl/rectitem.hxx b/svl/inc/svl/rectitem.hxx index 39c85d9ab228..b71705fc2047 100644 --- a/svl/inc/svl/rectitem.hxx +++ b/svl/inc/svl/rectitem.hxx @@ -30,18 +30,18 @@ #ifndef _SFXRECTITEM_HXX #define _SFXRECTITEM_HXX -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include #include #include class SvStream; -DBG_NAMEEX_VISIBILITY(SfxRectangleItem, SVT_DLLPUBLIC) +DBG_NAMEEX_VISIBILITY(SfxRectangleItem, SVL_DLLPUBLIC) // ----------------------------------------------------------------------- -class SVT_DLLPUBLIC SfxRectangleItem: public SfxPoolItem +class SVL_DLLPUBLIC SfxRectangleItem: public SfxPoolItem { Rectangle aVal; diff --git a/svl/inc/svl/restrictedpaths.hxx b/svl/inc/svl/restrictedpaths.hxx index 218e34cd4556..057c83cac7d1 100644 --- a/svl/inc/svl/restrictedpaths.hxx +++ b/svl/inc/svl/restrictedpaths.hxx @@ -32,14 +32,14 @@ #define SVTOOLS_RESTRICTEDPATHS_HXX #include -#include +#include #include #include namespace svt { - class SVT_DLLPUBLIC RestrictedPaths : public IUrlFilter + class SVL_DLLPUBLIC RestrictedPaths : public IUrlFilter { private: ::std::vector< String > m_aUnrestrictedURLs; diff --git a/svl/inc/svl/rngitem.hxx b/svl/inc/svl/rngitem.hxx index 52831f93f71f..92ab50b751e6 100644 --- a/svl/inc/svl/rngitem.hxx +++ b/svl/inc/svl/rngitem.hxx @@ -53,14 +53,14 @@ #define _SFXRNGITEM_HXX #else -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include class SvStream; // ----------------------------------------------------------------------- -class SVT_DLLPUBLIC SfxXRangeItem : public SfxPoolItem +class SVL_DLLPUBLIC SfxXRangeItem : public SfxPoolItem { private: NUMTYPE nFrom; @@ -89,7 +89,7 @@ public: // ----------------------------------------------------------------------- -class SVT_DLLPUBLIC SfxXRangesItem : public SfxPoolItem +class SVL_DLLPUBLIC SfxXRangesItem : public SfxPoolItem { private: NUMTYPE* _pRanges; diff --git a/svl/inc/svl/sharecontrolfile.hxx b/svl/inc/svl/sharecontrolfile.hxx index 8735f8c5ccf7..a926e6124e8c 100644 --- a/svl/inc/svl/sharecontrolfile.hxx +++ b/svl/inc/svl/sharecontrolfile.hxx @@ -31,7 +31,7 @@ #ifndef _SVT_SHARECONTROLFILE_HXX #define _SVT_SHARECONTROLFILE_HXX -#include +#include #include #include @@ -51,7 +51,7 @@ namespace svt { -class SVT_DLLPUBLIC ShareControlFile : public LockFileCommon +class SVL_DLLPUBLIC ShareControlFile : public LockFileCommon { ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xStream; ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xInputStream; diff --git a/svl/inc/svl/stritem.hxx b/svl/inc/svl/stritem.hxx index a2430b142c1d..84a0be6b9fd1 100644 --- a/svl/inc/svl/stritem.hxx +++ b/svl/inc/svl/stritem.hxx @@ -31,11 +31,11 @@ #ifndef _SFXSTRITEM_HXX #define _SFXSTRITEM_HXX -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include //============================================================================ -class SVT_DLLPUBLIC SfxStringItem: public CntUnencodedStringItem +class SVL_DLLPUBLIC SfxStringItem: public CntUnencodedStringItem { public: TYPEINFO(); diff --git a/svl/inc/svl/style.hxx b/svl/inc/svl/style.hxx index 17e4bf7b9c06..f560c10e8901 100644 --- a/svl/inc/svl/style.hxx +++ b/svl/inc/svl/style.hxx @@ -38,7 +38,7 @@ #include #include #include -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include #include #include @@ -91,7 +91,7 @@ SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *p ) from: #define VIRTUAL510 virtual -class SVT_DLLPUBLIC SfxStyleSheetBase : public comphelper::OWeakTypeObject +class SVL_DLLPUBLIC SfxStyleSheetBase : public comphelper::OWeakTypeObject { friend class SfxStyleSheetBasePool; @@ -165,7 +165,7 @@ typedef std::vector< rtl::Reference< SfxStyleSheetBase > > SfxStyles; //========================================================================= -class SVT_DLLPUBLIC SfxStyleSheetIterator +class SVL_DLLPUBLIC SfxStyleSheetIterator /* [Beschreibung] @@ -195,8 +195,8 @@ protected: private: USHORT GetPos(){return nAktPosition;} - SVT_DLLPRIVATE BOOL IsTrivialSearch(); - SVT_DLLPRIVATE BOOL DoesStyleMatch(SfxStyleSheetBase *pStyle); + SVL_DLLPRIVATE BOOL IsTrivialSearch(); + SVL_DLLPRIVATE BOOL DoesStyleMatch(SfxStyleSheetBase *pStyle); void* pImp; SfxStyleSheetBase* pAktStyle; @@ -210,7 +210,7 @@ friend class SfxStyleSheetBasePool; class SfxStyleSheetBasePool_Impl; -class SVT_DLLPUBLIC SfxStyleSheetBasePool: public SfxBroadcaster, public comphelper::OWeakTypeObject +class SVL_DLLPUBLIC SfxStyleSheetBasePool: public SfxBroadcaster, public comphelper::OWeakTypeObject { friend class SfxStyleSheetIterator; friend class SfxStyleSheetBase; @@ -218,8 +218,8 @@ friend class SfxStyleSheetBase; SfxStyleSheetBasePool_Impl *pImp; private: - SVT_DLLPRIVATE BOOL Load1_Impl( SvStream& ); - SVT_DLLPRIVATE SfxStyleSheetIterator& GetIterator_Impl(); + SVL_DLLPRIVATE BOOL Load1_Impl( SvStream& ); + SVL_DLLPRIVATE SfxStyleSheetIterator& GetIterator_Impl(); protected: String aAppName; SfxItemPool& rPool; @@ -287,7 +287,7 @@ public: //========================================================================= -class SVT_DLLPUBLIC SfxStyleSheet: public SfxStyleSheetBase, +class SVL_DLLPUBLIC SfxStyleSheet: public SfxStyleSheetBase, public SfxListener, public SfxBroadcaster { public: @@ -306,7 +306,7 @@ protected: //========================================================================= -class SVT_DLLPUBLIC SfxStyleSheetPool: public SfxStyleSheetBasePool +class SVL_DLLPUBLIC SfxStyleSheetPool: public SfxStyleSheetBasePool { protected: using SfxStyleSheetBasePool::Create; @@ -334,7 +334,7 @@ public: //======================================================================== -class SVT_DLLPUBLIC SfxStyleSheetPoolHint : public SfxHint +class SVL_DLLPUBLIC SfxStyleSheetPoolHint : public SfxHint { USHORT nHint; @@ -348,7 +348,7 @@ public: //========================================================================= -class SVT_DLLPUBLIC SfxStyleSheetHint: public SfxHint +class SVL_DLLPUBLIC SfxStyleSheetHint: public SfxHint { SfxStyleSheetBase* pStyleSh; USHORT nHint; @@ -364,7 +364,7 @@ public: { return nHint; } }; -class SVT_DLLPUBLIC SfxStyleSheetHintExtended: public SfxStyleSheetHint +class SVL_DLLPUBLIC SfxStyleSheetHintExtended: public SfxStyleSheetHint { String aName; @@ -379,7 +379,7 @@ public: const String& GetOldName() { return aName; } }; -class SVT_DLLPUBLIC SfxUnoStyleSheet : public ::cppu::ImplInheritanceHelper2< SfxStyleSheet, ::com::sun::star::style::XStyle, ::com::sun::star::lang::XUnoTunnel > +class SVL_DLLPUBLIC SfxUnoStyleSheet : public ::cppu::ImplInheritanceHelper2< SfxStyleSheet, ::com::sun::star::style::XStyle, ::com::sun::star::lang::XUnoTunnel > { public: SfxUnoStyleSheet( const UniString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, USHORT _nMaske ); diff --git a/svl/inc/svl/svdde.hxx b/svl/inc/svl/svdde.hxx index 82681ed9d240..4e0063e2477b 100644 --- a/svl/inc/svl/svdde.hxx +++ b/svl/inc/svl/svdde.hxx @@ -31,7 +31,7 @@ #ifndef _SVDDE_HXX #define _SVDDE_HXX -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include #include #include @@ -84,7 +84,7 @@ DECLARE_LIST( StringList, String * ) // - DdeData - // ----------- -class SVT_DLLPUBLIC DdeData +class SVL_DLLPUBLIC DdeData { friend class DdeInternal; friend class DdeService; @@ -93,7 +93,7 @@ class SVT_DLLPUBLIC DdeData DdeDataImp* pImp; //#if 0 // _SOLAR__PRIVATE - SVT_DLLPRIVATE void Lock(); + SVL_DLLPRIVATE void Lock(); //#endif void SetFormat( ULONG nFmt ); @@ -155,7 +155,7 @@ public: // - DdeTransaction - // ------------------ -class SVT_DLLPUBLIC DdeTransaction +class SVL_DLLPUBLIC DdeTransaction { public: virtual void Data( const DdeData* ); @@ -205,7 +205,7 @@ private: // - DdeLink - // ----------- -class SVT_DLLPUBLIC DdeLink : public DdeTransaction +class SVL_DLLPUBLIC DdeLink : public DdeTransaction { Link aNotify; @@ -222,7 +222,7 @@ public: // - DdeWarmLink - // --------------- -class SVT_DLLPUBLIC DdeWarmLink : public DdeLink +class SVL_DLLPUBLIC DdeWarmLink : public DdeLink { public: DdeWarmLink( DdeConnection&, const String&, long = 0 ); @@ -232,7 +232,7 @@ public: // - DdeHotLink - // -------------- -class SVT_DLLPUBLIC DdeHotLink : public DdeLink +class SVL_DLLPUBLIC DdeHotLink : public DdeLink { public: DdeHotLink( DdeConnection&, const String&, long = 0 ); @@ -242,7 +242,7 @@ public: // - DdeRequest - // -------------- -class SVT_DLLPUBLIC DdeRequest : public DdeTransaction +class SVL_DLLPUBLIC DdeRequest : public DdeTransaction { public: DdeRequest( DdeConnection&, const String&, long = 0 ); @@ -252,7 +252,7 @@ public: // - DdePoke - // ----------- -class SVT_DLLPUBLIC DdePoke : public DdeTransaction +class SVL_DLLPUBLIC DdePoke : public DdeTransaction { public: DdePoke( DdeConnection&, const String&, const char*, long, @@ -265,7 +265,7 @@ public: // - DdeExecute - // -------------- -class SVT_DLLPUBLIC DdeExecute : public DdeTransaction +class SVL_DLLPUBLIC DdeExecute : public DdeTransaction { public: DdeExecute( DdeConnection&, const String&, long = 0 ); @@ -275,7 +275,7 @@ public: // - DdeConnection - // ----------------- -class SVT_DLLPUBLIC DdeConnection +class SVL_DLLPUBLIC DdeConnection { friend class DdeInternal; friend class DdeTransaction; @@ -307,7 +307,7 @@ private: // - DdeItem - // ----------- -class SVT_DLLPUBLIC DdeItem +class SVL_DLLPUBLIC DdeItem { friend class DdeInternal; friend class DdeTopic; @@ -336,7 +336,7 @@ public: // - DdeItem - // ----------- -class SVT_DLLPUBLIC DdeGetPutItem : public DdeItem +class SVL_DLLPUBLIC DdeGetPutItem : public DdeItem { public: DdeGetPutItem( const sal_Unicode* p ); @@ -352,9 +352,9 @@ public: // - DdeTopic - // ------------ -class SVT_DLLPUBLIC DdeTopic +class SVL_DLLPUBLIC DdeTopic { - SVT_DLLPRIVATE void _Disconnect( long ); + SVL_DLLPRIVATE void _Disconnect( long ); public: virtual void Connect( long ); @@ -421,7 +421,7 @@ private: // - DdeService - // -------------- -class SVT_DLLPUBLIC DdeService +class SVL_DLLPUBLIC DdeService { friend class DdeInternal; @@ -448,7 +448,7 @@ private: ConvList* pConv; short nStatus; - SVT_DLLPRIVATE BOOL HasCbFormat( USHORT ); + SVL_DLLPRIVATE BOOL HasCbFormat( USHORT ); public: DdeService( const String& ); diff --git a/svl/inc/svl/svldata.hxx b/svl/inc/svl/svldata.hxx index c929faad3d13..468e6025cb5a 100644 --- a/svl/inc/svl/svldata.hxx +++ b/svl/inc/svl/svldata.hxx @@ -6,7 +6,7 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svtdata.hxx,v $ + * $RCSfile: svldata.hxx,v $ * $Revision: 1.4 $ * * This file is part of OpenOffice.org. @@ -28,28 +28,18 @@ * ************************************************************************/ -#ifndef _SVTOOLS_SVTDATA_HXX -#define _SVTOOLS_SVTDATA_HXX +#ifndef _SVL_SVLDATA_HXX +#define _SVL_SVLDATA_HXX -#include #include -class ResMgr; -class SfxItemDesruptorList_Impl; class SfxItemPool; -class Twain; //============================================================================ -class ImpSvtData +class ImpSvlData { public: - Twain * pTwain; const SfxItemPool * pStoringPool; - SfxItemDesruptorList_Impl * pItemDesruptList; - - ResMgr * pResMgr; - ResMgr * pPatchResMgr; - void* m_pThreadsafeRMs; // one SimpleResMgr for each language for which a resource was requested // (When using the 'non-simple' resmgr, the first request for any language wins, any @@ -57,47 +47,15 @@ public: // For the simple resmgr we have a mgr for each language ever requested). private: - ImpSvtData(): - pTwain(0), pStoringPool(0), pItemDesruptList(0), pResMgr(0), - pPatchResMgr(NULL), m_pThreadsafeRMs(NULL) + ImpSvlData(): + pStoringPool(0), m_pThreadsafeRMs(NULL) {} - ~ImpSvtData(); + ~ImpSvlData(); public: - ResMgr * GetResMgr(const ::com::sun::star::lang::Locale aLocale); - ResMgr * GetResMgr(); // VCL dependant, only available in SVT, not in SVL! - - ResMgr * GetPatchResMgr(); - ResMgr * GetPatchResMgr(const ::com::sun::star::lang::Locale& aLocale); - - SimpleResMgr * GetSimpleRM(const ::com::sun::star::lang::Locale& rLocale); - - static ImpSvtData & GetSvtData(); -}; - -//============================================================================ - -class SvpResId: public ResId -{ -public: - SvpResId( USHORT nId, const ::com::sun::star::lang::Locale aLocale ): - ResId( nId, *ImpSvtData::GetSvtData().GetResMgr( aLocale ) ) {} - - // VCL dependant, only available in SVT, not in SVL! - SvpResId( USHORT nId ); -}; - - -class SvtResId: public ResId -{ -public: - SvtResId(USHORT nId, const ::com::sun::star::lang::Locale aLocale): - ResId(nId, *ImpSvtData::GetSvtData().GetResMgr(aLocale)) {} - - SvtResId(USHORT nId): ResId(nId, *ImpSvtData::GetSvtData().GetResMgr()) {} - // VCL dependant, only available in SVT, not in SVL! + static ImpSvlData & GetSvlData(); }; //============================================================================ @@ -106,12 +64,12 @@ class SvtSimpleResId String m_sValue; public: - SvtSimpleResId(USHORT nId, const ::com::sun::star::lang::Locale aLocale) : m_sValue(ImpSvtData::GetSvtData().GetSimpleRM(aLocale)->ReadString(nId)) { }; + SvtSimpleResId(USHORT nId, const ::com::sun::star::lang::Locale aLocale) : m_sValue(ImpSvlData::GetSvlData().GetSimpleRM(aLocale)->ReadString(nId)) { }; operator String () const { return m_sValue; } }; -#endif // _SVTOOLS_SVTDATA_HXX +#endif // _SVL_SVLDATA_HXX diff --git a/svl/inc/svl/syslocale.hxx b/svl/inc/svl/syslocale.hxx index bd853d0d4eeb..de5962fa0d1a 100644 --- a/svl/inc/svl/syslocale.hxx +++ b/svl/inc/svl/syslocale.hxx @@ -31,7 +31,7 @@ #ifndef INCLUDED_SVTOOLS_SYSLOCALE_HXX #define INCLUDED_SVTOOLS_SYSLOCALE_HXX -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include #include #include @@ -50,14 +50,14 @@ class LocaleDataWrapper; SvtSysLocale is not expensive as long as there is at least one instance left. */ -class SVT_DLLPUBLIC SvtSysLocale +class SVL_DLLPUBLIC SvtSysLocale { friend class SvtSysLocale_Impl; // access to mutex static SvtSysLocale_Impl* pImpl; static sal_Int32 nRefCount; - SVT_DLLPRIVATE static ::osl::Mutex& GetMutex(); + SVL_DLLPRIVATE static ::osl::Mutex& GetMutex(); public: SvtSysLocale(); diff --git a/svl/inc/svl/syslocaleoptions.hxx b/svl/inc/svl/syslocaleoptions.hxx index 8b03785d541e..a5884c7bbcaa 100644 --- a/svl/inc/svl/syslocaleoptions.hxx +++ b/svl/inc/svl/syslocaleoptions.hxx @@ -31,7 +31,7 @@ #ifndef INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX #define INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include #include #include @@ -48,12 +48,12 @@ class SvtSysLocaleOptions_Impl; class SvtListener; namespace osl { class Mutex; } -class SVT_DLLPUBLIC SvtSysLocaleOptions: public utl::detail::Options +class SVL_DLLPUBLIC SvtSysLocaleOptions: public utl::detail::Options { static SvtSysLocaleOptions_Impl* pOptions; static sal_Int32 nRefCount; - SVT_DLLPRIVATE static ::osl::Mutex& GetMutex(); + SVL_DLLPRIVATE static ::osl::Mutex& GetMutex(); public: diff --git a/svl/inc/svl/undo.hxx b/svl/inc/svl/undo.hxx index 38cbfb227f1b..5bd48342f530 100644 --- a/svl/inc/svl/undo.hxx +++ b/svl/inc/svl/undo.hxx @@ -30,14 +30,14 @@ #ifndef _UNDO_HXX #define _UNDO_HXX -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include #include #include //==================================================================== -class SVT_DLLPUBLIC SfxRepeatTarget +class SVL_DLLPUBLIC SfxRepeatTarget { public: TYPEINFO(); @@ -46,7 +46,7 @@ public: //==================================================================== -class SVT_DLLPUBLIC SfxUndoAction +class SVL_DLLPUBLIC SfxUndoAction { BOOL bLinked; public: @@ -79,7 +79,7 @@ SV_DECL_PTRARR( SfxUndoActions, SfxUndoAction*, 20, 8 ) /** do not make use of this implementation details, unless you really really have to! */ -struct SVT_DLLPUBLIC SfxUndoArray +struct SVL_DLLPUBLIC SfxUndoArray { SfxUndoActions aUndoActions; USHORT nMaxUndoActions; @@ -95,7 +95,7 @@ struct SVT_DLLPUBLIC SfxUndoArray /** do not make use of this implementation details, unless you really really have to! */ -class SVT_DLLPUBLIC SfxListUndoAction : public SfxUndoAction, public SfxUndoArray +class SVL_DLLPUBLIC SfxListUndoAction : public SfxUndoAction, public SfxUndoArray /* [Beschreibung] @@ -135,7 +135,7 @@ class SVT_DLLPUBLIC SfxListUndoAction : public SfxUndoAction, public SfxUndoArra //========================================================================= -class SVT_DLLPUBLIC SfxUndoManager +class SVL_DLLPUBLIC SfxUndoManager { friend class SfxLinkUndoAction; @@ -197,7 +197,7 @@ public: //========================================================================= -class SVT_DLLPUBLIC SfxLinkUndoAction : public SfxUndoAction +class SVL_DLLPUBLIC SfxLinkUndoAction : public SfxUndoAction /* [Beschreibung] diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx index 22a258d32f88..5862a1312039 100644 --- a/svl/inc/svl/zforlist.hxx +++ b/svl/inc/svl/zforlist.hxx @@ -30,7 +30,7 @@ #ifndef _ZFORLIST_HXX #define _ZFORLIST_HXX -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include #ifndef _TABLE_HXX //autogen #include @@ -231,7 +231,7 @@ typedef ::std::map< sal_uInt32, sal_uInt32 > SvNumberFormatterMergeMap; /** Language/country dependent currency entries */ -class SVT_DLLPUBLIC NfCurrencyEntry +class SVL_DLLPUBLIC NfCurrencyEntry { String aSymbol; /// currency symbol String aBankSymbol; /// currency abbreviation @@ -251,7 +251,7 @@ private: //#if 0 // _SOLAR__PRIVATE // nDecimalFormat := 0, 1, 2 // #,##0 or #,##0.00 or #,##0.-- are assigned - SVT_DLLPRIVATE void Impl_BuildFormatStringNumChars( String&, + SVL_DLLPRIVATE void Impl_BuildFormatStringNumChars( String&, const LocaleDataWrapper&, USHORT nDecimalFormat ) const; //#endif // __PRIVATE @@ -328,12 +328,12 @@ public: typedef NfCurrencyEntry* NfCurrencyEntryPtr; SV_DECL_PTRARR_DEL( NfCurrencyTable, NfCurrencyEntryPtr, 128, 1 ) typedef String* WSStringPtr; -SV_DECL_PTRARR_DEL_VISIBILITY( NfWSStringsDtor, WSStringPtr, 8, 1, SVT_DLLPUBLIC ) +SV_DECL_PTRARR_DEL_VISIBILITY( NfWSStringsDtor, WSStringPtr, 8, 1, SVL_DLLPUBLIC ) class SvNumberFormatterRegistry_Impl; -class SVT_DLLPUBLIC SvNumberFormatter +class SVL_DLLPUBLIC SvNumberFormatter { public: @@ -813,37 +813,37 @@ private: #ifdef _ZFORLIST_CXX // ----- private Methoden ----- - SVT_DLLPRIVATE static BOOL bCurrencyTableInitialized; - SVT_DLLPRIVATE static USHORT nSystemCurrencyPosition; - SVT_DLLPRIVATE static SvNumberFormatterRegistry_Impl* pFormatterRegistry; + SVL_DLLPRIVATE static BOOL bCurrencyTableInitialized; + SVL_DLLPRIVATE static USHORT nSystemCurrencyPosition; + SVL_DLLPRIVATE static SvNumberFormatterRegistry_Impl* pFormatterRegistry; // get the registry, create one if none exists - SVT_DLLPRIVATE static SvNumberFormatterRegistry_Impl& GetFormatterRegistry(); + SVL_DLLPRIVATE static SvNumberFormatterRegistry_Impl& GetFormatterRegistry(); // called by ctors - SVT_DLLPRIVATE void ImpConstruct( LanguageType eLang ); + SVL_DLLPRIVATE void ImpConstruct( LanguageType eLang ); // Changes initialized language/country, clears the entries and generates // new ones, may ONLY be called by the binary file format load - SVT_DLLPRIVATE void ImpChangeSysCL( LanguageType eLnge, BOOL bLoadingSO5 ); + SVL_DLLPRIVATE void ImpChangeSysCL( LanguageType eLnge, BOOL bLoadingSO5 ); // Generate builtin formats provided by i18n behind CLOffset, // if bLoadingSO5==FALSE also generate additional i18n formats. - SVT_DLLPRIVATE void ImpGenerateFormats( sal_uInt32 CLOffset, BOOL bLoadingSO5 ); + SVL_DLLPRIVATE void ImpGenerateFormats( sal_uInt32 CLOffset, BOOL bLoadingSO5 ); // Generate additional formats provided by i18n - SVT_DLLPRIVATE void ImpGenerateAdditionalFormats( + SVL_DLLPRIVATE void ImpGenerateAdditionalFormats( sal_uInt32 CLOffset, NumberFormatCodeWrapper& rNumberFormatCode, BOOL bAfterLoadingSO5 ); - SVT_DLLPRIVATE SvNumberformat* ImpInsertFormat( + SVL_DLLPRIVATE SvNumberformat* ImpInsertFormat( const ::com::sun::star::i18n::NumberFormatCode& rCode, sal_uInt32 nPos, BOOL bAfterLoadingSO5 = FALSE, sal_Int16 nOrgIndex = 0 ); // ImpInsertNewStandardFormat for new (since version ...) builtin formats - SVT_DLLPRIVATE SvNumberformat* ImpInsertNewStandardFormat( + SVL_DLLPRIVATE SvNumberformat* ImpInsertNewStandardFormat( const ::com::sun::star::i18n::NumberFormatCode& rCode, sal_uInt32 nPos, USHORT nVersion, @@ -851,41 +851,41 @@ private: sal_Int16 nOrgIndex = 0 ); // Return CLOffset or (MaxCLOffset + SV_COUNTRY_LANGUAGE_OFFSET) if new language/country - SVT_DLLPRIVATE sal_uInt32 ImpGetCLOffset(LanguageType eLnge) const; + SVL_DLLPRIVATE sal_uInt32 ImpGetCLOffset(LanguageType eLnge) const; // Test whether format code already exists, then return index key, // otherwise NUMBERFORMAT_ENTRY_NOT_FOUND - SVT_DLLPRIVATE sal_uInt32 ImpIsEntry( const String& rString, + SVL_DLLPRIVATE sal_uInt32 ImpIsEntry( const String& rString, sal_uInt32 CLOffset, LanguageType eLnge ); // Create builtin formats for language/country if necessary, return CLOffset - SVT_DLLPRIVATE sal_uInt32 ImpGenerateCL( LanguageType eLnge, BOOL bLoadingSO5 = FALSE ); + SVL_DLLPRIVATE sal_uInt32 ImpGenerateCL( LanguageType eLnge, BOOL bLoadingSO5 = FALSE ); // Build negative currency format, old compatibility style - SVT_DLLPRIVATE void ImpGetNegCurrFormat( String& sNegStr, const String& rCurrSymbol ); + SVL_DLLPRIVATE void ImpGetNegCurrFormat( String& sNegStr, const String& rCurrSymbol ); // Build positive currency format, old compatibility style - SVT_DLLPRIVATE void ImpGetPosCurrFormat( String& sPosStr, const String& rCurrSymbol ); + SVL_DLLPRIVATE void ImpGetPosCurrFormat( String& sPosStr, const String& rCurrSymbol ); // Create theCurrencyTable with all NfCurrencyEntry - SVT_DLLPRIVATE static void ImpInitCurrencyTable(); + SVL_DLLPRIVATE static void ImpInitCurrencyTable(); // Return the format index of the currency format of the system locale. // Format is created if not already present. - SVT_DLLPRIVATE sal_uInt32 ImpGetDefaultSystemCurrencyFormat(); + SVL_DLLPRIVATE sal_uInt32 ImpGetDefaultSystemCurrencyFormat(); // Return the format index of the currency format of the current locale. // Format is created if not already present. - SVT_DLLPRIVATE sal_uInt32 ImpGetDefaultCurrencyFormat(); + SVL_DLLPRIVATE sal_uInt32 ImpGetDefaultCurrencyFormat(); // Return the default format for a given type and current locale. // May ONLY be called from within GetStandardFormat(). - SVT_DLLPRIVATE sal_uInt32 ImpGetDefaultFormat( short nType ); + SVL_DLLPRIVATE sal_uInt32 ImpGetDefaultFormat( short nType ); // Return the index in a sequence of format codes matching an enum of // NfIndexTableOffset. If not found 0 is returned. If the sequence doesn't // contain any format code elements a default element is created and inserted. - SVT_DLLPRIVATE sal_Int32 ImpGetFormatCodeIndex( + SVL_DLLPRIVATE sal_Int32 ImpGetFormatCodeIndex( ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode >& rSeq, const NfIndexTableOffset nTabOff ); @@ -895,7 +895,7 @@ private: // Return the default index in the sequence. // Non-PRODUCT version may check locale data for matching defaults in one // FormatElement group. - SVT_DLLPRIVATE sal_Int32 ImpAdjustFormatCodeDefault( + SVL_DLLPRIVATE sal_Int32 ImpAdjustFormatCodeDefault( ::com::sun::star::i18n::NumberFormatCode * pFormatArr, sal_Int32 nCount, BOOL bCheckCorrectness = TRUE ); diff --git a/svl/inc/svl/zformat.hxx b/svl/inc/svl/zformat.hxx index ae7d961c0bc6..208c876bfbfc 100644 --- a/svl/inc/svl/zformat.hxx +++ b/svl/inc/svl/zformat.hxx @@ -30,7 +30,7 @@ #ifndef _ZFORMAT_HXX #define _ZFORMAT_HXX -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include #include #include @@ -175,7 +175,7 @@ private: }; -class SVT_DLLPUBLIC SvNumberformat +class SVL_DLLPUBLIC SvNumberformat { public: // Ctor for Load @@ -461,11 +461,11 @@ private: BOOL bStandard; // If this is a default standard format BOOL bIsUsed; // Flag as used for storing - SVT_DLLPRIVATE USHORT ImpGetNumForStringElementCount( USHORT nNumFor ) const; + SVL_DLLPRIVATE USHORT ImpGetNumForStringElementCount( USHORT nNumFor ) const; - SVT_DLLPRIVATE BOOL ImpIsOtherCalendar( const ImpSvNumFor& rNumFor ) const; + SVL_DLLPRIVATE BOOL ImpIsOtherCalendar( const ImpSvNumFor& rNumFor ) const; - SVT_DLLPRIVATE BOOL ImpSwitchToSpecifiedCalendar( String& rOrgCalendar, + SVL_DLLPRIVATE BOOL ImpSwitchToSpecifiedCalendar( String& rOrgCalendar, double& fOrgDateTime, const ImpSvNumFor& rNumFor ) const; #ifdef _ZFORMAT_CXX // ----- private implementation methods ----- @@ -476,36 +476,36 @@ private: const SvNumberFormatter& GetFormatter() const { return *rScan.GetNumberformatter(); } // divide in substrings and color conditions - SVT_DLLPRIVATE short ImpNextSymbol( String& rString, + SVL_DLLPRIVATE short ImpNextSymbol( String& rString, xub_StrLen& nPos, String& sSymbol ); // read string until ']' and strip blanks (after condition) - SVT_DLLPRIVATE static xub_StrLen ImpGetNumber( String& rString, + SVL_DLLPRIVATE static xub_StrLen ImpGetNumber( String& rString, xub_StrLen& nPos, String& sSymbol ); // get xxx of "[$-xxx]" as LanguageType, starting at and advancing position nPos - SVT_DLLPRIVATE static LanguageType ImpGetLanguageType( const String& rString, xub_StrLen& nPos ); + SVL_DLLPRIVATE static LanguageType ImpGetLanguageType( const String& rString, xub_StrLen& nPos ); // standard number output - SVT_DLLPRIVATE void ImpGetOutputStandard( double& fNumber, String& OutString ); + SVL_DLLPRIVATE void ImpGetOutputStandard( double& fNumber, String& OutString ); // numbers in input line - SVT_DLLPRIVATE void ImpGetOutputInputLine( double fNumber, String& OutString ); + SVL_DLLPRIVATE void ImpGetOutputInputLine( double fNumber, String& OutString ); // check subcondition // OP undefined => -1 // else 0 or 1 - SVT_DLLPRIVATE short ImpCheckCondition(double& fNumber, + SVL_DLLPRIVATE short ImpCheckCondition(double& fNumber, double& fLimit, SvNumberformatLimitOps eOp); - SVT_DLLPRIVATE ULONG ImpGGT(ULONG x, ULONG y); - SVT_DLLPRIVATE ULONG ImpGGTRound(ULONG x, ULONG y); + SVL_DLLPRIVATE ULONG ImpGGT(ULONG x, ULONG y); + SVL_DLLPRIVATE ULONG ImpGGTRound(ULONG x, ULONG y); // Helper function for number strings // append string symbols, insert leading 0 or ' ', or ... - SVT_DLLPRIVATE BOOL ImpNumberFill( String& sStr, + SVL_DLLPRIVATE BOOL ImpNumberFill( String& sStr, double& rNumber, xub_StrLen& k, USHORT& j, @@ -513,7 +513,7 @@ private: short eSymbolType ); // Helper function to fill in the integer part and the group (AKA thousand) separators - SVT_DLLPRIVATE BOOL ImpNumberFillWithThousands( String& sStr, + SVL_DLLPRIVATE BOOL ImpNumberFillWithThousands( String& sStr, double& rNumber, xub_StrLen k, USHORT j, @@ -524,20 +524,20 @@ private: // Helper function to fill in the group (AKA thousand) separators // or to skip additional digits - SVT_DLLPRIVATE void ImpDigitFill( String& sStr, + SVL_DLLPRIVATE void ImpDigitFill( String& sStr, xub_StrLen nStart, xub_StrLen& k, USHORT nIx, xub_StrLen & nDigitCount, utl::DigitGroupingIterator & ); - SVT_DLLPRIVATE BOOL ImpGetDateOutput( double fNumber, + SVL_DLLPRIVATE BOOL ImpGetDateOutput( double fNumber, USHORT nIx, String& OutString ); - SVT_DLLPRIVATE BOOL ImpGetTimeOutput( double fNumber, + SVL_DLLPRIVATE BOOL ImpGetTimeOutput( double fNumber, USHORT nIx, String& OutString ); - SVT_DLLPRIVATE BOOL ImpGetDateTimeOutput( double fNumber, + SVL_DLLPRIVATE BOOL ImpGetDateTimeOutput( double fNumber, USHORT nIx, String& OutString ); @@ -546,23 +546,23 @@ private: // know a "before" era (like zh_TW ROC or ja_JP Gengou). If switched and // rOrgCalendar was "gregorian" the string is emptied. If rOrgCalendar was // empty the previous calendar name and date/time are returned. - SVT_DLLPRIVATE BOOL ImpFallBackToGregorianCalendar( String& rOrgCalendar, double& fOrgDateTime ); + SVL_DLLPRIVATE BOOL ImpFallBackToGregorianCalendar( String& rOrgCalendar, double& fOrgDateTime ); // Append a "G" short era string of the given calendar. In the case of a // Gengou calendar this is a one character abbreviation, for other // calendars the XExtendedCalendar::getDisplayString() method is called. - SVT_DLLPRIVATE static void ImpAppendEraG( String& OutString, const CalendarWrapper& rCal, + SVL_DLLPRIVATE static void ImpAppendEraG( String& OutString, const CalendarWrapper& rCal, sal_Int16 nNatNum ); - SVT_DLLPRIVATE BOOL ImpGetNumberOutput( double fNumber, + SVL_DLLPRIVATE BOOL ImpGetNumberOutput( double fNumber, USHORT nIx, String& OutString ); - SVT_DLLPRIVATE void ImpCopyNumberformat( const SvNumberformat& rFormat ); + SVL_DLLPRIVATE void ImpCopyNumberformat( const SvNumberformat& rFormat ); // normal digits or other digits, depending on ImpSvNumFor.aNatNum, // [NatNum1], [NatNum2], ... - SVT_DLLPRIVATE String ImpGetNatNumString( const SvNumberNatNum& rNum, sal_Int32 nVal, + SVL_DLLPRIVATE String ImpGetNatNumString( const SvNumberNatNum& rNum, sal_Int32 nVal, USHORT nMinDigits = 0 ) const; String ImpIntToString( USHORT nIx, sal_Int32 nVal, USHORT nMinDigits = 0 ) const @@ -574,7 +574,7 @@ private: } // transliterate according to NativeNumber - SVT_DLLPRIVATE void ImpTransliterateImpl( String& rStr, const SvNumberNatNum& rNum ) const; + SVL_DLLPRIVATE void ImpTransliterateImpl( String& rStr, const SvNumberNatNum& rNum ) const; void ImpTransliterate( String& rStr, const SvNumberNatNum& rNum ) const { diff --git a/svl/inc/urihelper.hxx b/svl/inc/urihelper.hxx index 209f3f04e28a..e68e8f0ee54f 100644 --- a/svl/inc/urihelper.hxx +++ b/svl/inc/urihelper.hxx @@ -31,7 +31,7 @@ #ifndef SVTOOLS_URIHELPER_HXX #define SVTOOLS_URIHELPER_HXX -#include "svtools/svtdllapi.h" +#include "svtools/svldllapi.h" #include "com/sun/star/uno/Reference.hxx" #include #include @@ -64,7 +64,7 @@ namespace URIHelper { existence (see URIHelper::GetMaybeFileHdl), or use bCheckFileExists = false if you want to generate file URLs without checking for their existence. */ -SVT_DLLPUBLIC UniString +SVL_DLLPUBLIC UniString SmartRel2Abs(INetURLObject const & rTheBaseURIRef, ByteString const & rTheRelURIRef, Link const & rMaybeFileHdl = Link(), @@ -91,7 +91,7 @@ SmartRel2Abs(INetURLObject const & rTheBaseURIRef, existence (see URIHelper::GetMaybeFileHdl), or use bCheckFileExists = false if you want to generate file URLs without checking for their existence. */ -SVT_DLLPUBLIC UniString +SVL_DLLPUBLIC UniString SmartRel2Abs(INetURLObject const & rTheBaseURIRef, UniString const & rTheRelURIRef, Link const & rMaybeFileHdl = Link(), @@ -106,10 +106,10 @@ SmartRel2Abs(INetURLObject const & rTheBaseURIRef, INetURLObject::FSysStyle eStyle = INetURLObject::FSYS_DETECT); //============================================================================ -SVT_DLLPUBLIC void SetMaybeFileHdl(Link const & rTheMaybeFileHdl); +SVL_DLLPUBLIC void SetMaybeFileHdl(Link const & rTheMaybeFileHdl); //============================================================================ -SVT_DLLPUBLIC Link GetMaybeFileHdl(); +SVL_DLLPUBLIC Link GetMaybeFileHdl(); /** Converts a URI reference to a relative one, ignoring certain differences (for @@ -131,7 +131,7 @@ SVT_DLLPUBLIC Link GetMaybeFileHdl(); @exception com::sun::star::uno::RuntimeException if any error occurs */ -SVT_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::uri::XUriReference > +SVL_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::uri::XUriReference > normalizedMakeRelative( com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & context, @@ -159,11 +159,11 @@ normalizedMakeRelative( @deprecated No code should rely on the default component context. */ -SVT_DLLPUBLIC rtl::OUString simpleNormalizedMakeRelative( +SVL_DLLPUBLIC rtl::OUString simpleNormalizedMakeRelative( rtl::OUString const & baseUriReference, rtl::OUString const & uriReference); //============================================================================ -SVT_DLLPUBLIC UniString +SVL_DLLPUBLIC UniString FindFirstURLInText(UniString const & rText, xub_StrLen & rBegin, xub_StrLen & rEnd, @@ -200,7 +200,7 @@ FindFirstURLInText(UniString const & rText, @return The input URI with any password component removed. */ -SVT_DLLPUBLIC UniString +SVL_DLLPUBLIC UniString removePassword(UniString const & rURI, INetURLObject::EncodeMechanism eEncodeMechanism = INetURLObject::WAS_ENCODED, @@ -229,7 +229,7 @@ removePassword(UniString const & rURI, @return The style bit corresponding to the queried content provider's conventions, or FSysStyle(0) if these cannot be determined. */ -SVT_DLLPUBLIC INetURLObject::FSysStyle queryFSysStyle(UniString const & rFileUrl, +SVL_DLLPUBLIC INetURLObject::FSysStyle queryFSysStyle(UniString const & rFileUrl, bool bAddConvenienceStyles = true) throw (com::sun::star::uno::RuntimeException); diff --git a/svl/prj/build.lst b/svl/prj/build.lst index a60199740561..52bc7f82b3cd 100644 --- a/svl/prj/build.lst +++ b/svl/prj/build.lst @@ -1,55 +1,23 @@ -st svtools : l10n offuh toolkit ucbhelper unotools JPEG:jpeg cppu cppuhelper comphelper sal sot jvmfwk NULL -st svtools usr1 - all st_mkout NULL -st svtools\inc nmake - all st_inc NULL -st svtools\inc\sane get - all st_incsa NULL -st svtools\prj get - all st_prj NULL -st svtools\res get - all st_res NULL -st svtools\win\inc get - all st_winc NULL -st svtools\win\res get - all st_wres NULL -st svtools\os2\inc get - all st_oinc NULL -st svtools\mac\inc get - all st_minc NULL -st svtools\unx\inc get - all st_uinc NULL -st svtools\bmpmaker nmake - all st_bmp st_inc NULL -st svtools\source\memtools nmake - all st_mem st_inc NULL -st svtools\source\numbers nmake - all st_num st_inc NULL -st svtools\source\notify nmake - all st_not st_inc NULL -st svtools\source\config nmake - all st_conf st_inc NULL -st svtools\unx\source\svdde nmake - u st_usdde st_inc NULL -st svtools\unx\source\svdde nmake - p st_psdde st_inc NULL -st svtools\mac\source\svdde nmake - m st_msdde st_inc NULL -st svtools\mac\source\misc nmake - m st_msc st_inc NULL -st svtools\source\control nmake - all st_ctl st_inc NULL -st svtools\source\filerec nmake - all st_file st_inc NULL -st svtools\source\filter.vcl\filter nmake - all st_vfilt st_inc NULL -st svtools\source\filter.vcl\wmf nmake - all st_vwmf st_inc NULL -st svtools\source\filter.vcl\igif nmake - all st_vigif st_inc NULL -st svtools\source\filter.vcl\jpeg nmake - all st_vjpeg st_inc NULL -st svtools\source\filter.vcl\ixbm nmake - all st_vixbm st_inc NULL -st svtools\source\filter.vcl\ixpm nmake - all st_vixpm st_inc NULL -st svtools\source\brwbox nmake - all st__brw st_bmp st_inc NULL -st svtools\source\urlobj nmake - all st__url st_inc NULL -st svtools\source\misc nmake - all st__misc st_bmp st_inc NULL -st svtools\source\misc1 nmake - all st__misc1 st_inc NULL -st svtools\source\contnr nmake - all st__ctr st_inc NULL -st svtools\source\svdde nmake - all st__dde st_inc NULL -st svtools\source\items nmake - all st__item st_inc NULL -st svtools\source\items1 nmake - all st__item1 st_inc NULL -st svtools\source\undo nmake - all st_undo st_inc NULL -st svtools\source\plugapp nmake - all st_papp st_inc NULL -st svtools\source\dialogs nmake - all st_dial st_inc NULL -st svtools\source\edit nmake - all st_edit st_inc NULL -st svtools\source\table nmake - all st_table st_inc NULL -st svtools\source\uno nmake - all st_uno st_inc NULL -st svtools\source\svrtf nmake - all st_rtf st_inc NULL -st svtools\source\svsql nmake - all st_sql st_inc NULL -st svtools\source\svhtml nmake - all st_html st_inc NULL -st svtools\source\syslocale nmake - all st_sysloc st_inc NULL -st svtools\source\filepicker nmake - all st_filepick st_inc NULL -st svtools\util nmake - all st_util st__brw st__ctr st__dde st__item st__item1 st__misc st__misc1 st__url st_ctl st_dial st_edit st_file st_html st_papp st_rtf st_sql st_usdde.u st_psdde.p st_msdde.m st_msc.m st_undo st_table st_uno st_vfilt st_vigif st_vixbm st_vixpm st_vjpeg st_vwmf st_sysloc st_filepick st_not st_conf st_mem st_num st_svtjava NULL -st svtools\source\fsstor nmake - all st_fsstor st_inc NULL -st svtools\source\hatchwindow nmake - all st_hatchwin st_inc NULL -st svtools\source\passwordcontainer nmake - all st_passcont st_inc NULL -st svtools\source\productregistration nmake - all st_prodreg st_util st_inc NULL -st svtools\uno nmake - all st_svtuno st_util st_inc NULL -st svtools\source\java nmake - all st_svtjava st_inc NULL -st svtools\workben\unodialog nmake - all st_workben_udlg st_util NULL +sl svl : l10n offuh ucbhelper unotools cppu cppuhelper comphelper sal sot NULL +sl svl usr1 - all sl_mkout NULL +sl svl\inc nmake - all sl_inc NULL +sl svl\unx\source\svdde nmake - u sl_usdde sl_inc NULL +sl svl\unx\source\svdde nmake - p sl_psdde sl_inc NULL +sl svl\source\config nmake - all sl_conf sl_inc NULL +sl svl\source\filepicker nmake - all sl_filepick sl_inc NULL +sl svl\source\filerec nmake - all sl_file sl_inc NULL +sl svl\source\items nmake - all sl__item sl_inc NULL +sl svl\source\memtools nmake - all sl_mem sl_inc NULL +sl svl\source\misc nmake - all sl__misc sl_inc NULL +sl svl\source\notify nmake - all sl_not sl_inc NULL +sl svl\source\numbers nmake - all sl_num sl_inc NULL +sl svl\source\svdde nmake - all sl__dde sl_inc NULL +sl svl\source\svsql nmake - all sl_sql sl_inc NULL +sl svl\source\syslocale nmake - all sl_sysloc sl_inc NULL +sl svl\source\undo nmake - all sl_undo sl_inc NULL +sl svl\source\uno nmake - all sl_uno sl_inc NULL +sl svl\util nmake - all sl_util sl_usdde.u sl_psdde.p sl_conf sl_filepick sl_file sl__item sl_mem sl__misc sl_not sl_num sl__dde sl_sql sl_sysloc sl_undo sl_uno NULL +sl svl\source\fsstor nmake - all sl_fsstor sl_inc NULL +sl svl\source\passwordcontainer nmake - all sl_passcont sl_inc NULL + + diff --git a/svl/prj/d.lst b/svl/prj/d.lst index a3a7679f8aea..e32ffa624397 100644 --- a/svl/prj/d.lst +++ b/svl/prj/d.lst @@ -3,129 +3,18 @@ mkdir: %COMMON_DEST%\res%_EXT% mkdir: %_DEST%\inc%_EXT%\svtools ..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid -..\%__SRC%\srs\ehdl.srs %_DEST%\res%_EXT%\svtools.srs -..\%COMMON_OUTDIR%\srs\ehdl_srs.hid %COMMON_DEST%\res%_EXT%\svtools_srs.hid ..\%__SRC%\lib\isvl.lib %_DEST%\lib%_EXT%\isvl.lib -..\%__SRC%\lib\svtool.lib %_DEST%\lib%_EXT%\svtool.lib -..\%__SRC%\slb\svt.lib %_DEST%\lib%_EXT%\xsvtool.lib -..\%__SRC%\bin\dllver.exe %_DEST%\bin%_EXT%\dllver.exe -..\%__SRC%\bin\dllver %_DEST%\bin%_EXT%\dllver ..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\* ..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\* -..\%__SRC%\bin\bmp.* %_DEST%\bin%_EXT%\bmp.* -..\%__SRC%\bin\bmpsum.* %_DEST%\bin%_EXT%\bmpsum.* -..\%__SRC%\bin\bmpgui.* %_DEST%\bin%_EXT%\bmpgui.* -..\%__SRC%\bin\g2g.* %_DEST%\bin%_EXT%\g2g.* -..\%__SRC%\bin\bmp %_DEST%\bin%_EXT%\bmp -..\%__SRC%\bin\bmpsum %_DEST%\bin%_EXT%\bmpsum -..\%__SRC%\bin\bmpgui %_DEST%\bin%_EXT%\bmpgui -..\%__SRC%\bin\g2g %_DEST%\bin%_EXT%\g2g -..\%__SRC%\res\bmp.* %_DEST%\bin%_EXT%\bmp.* -..\%__SRC%\res\bmpgui.* %_DEST%\bin%_EXT%\bmpgui.* ..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\* ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\* -..\inc\svtools\*.hxx %_DEST%\inc%_EXT%\svtools\*.hxx -..\inc\svtools\*.h %_DEST%\inc%_EXT%\svtools\*.h -..\inc\svtools\*.hrc %_DEST%\inc%_EXT%\svtools\*.hrc - -..\inc\imagemgr.hxx %_DEST%\inc%_EXT%\svtools\imagemgr.hxx -..\inc\imagemgr.hrc %_DEST%\inc%_EXT%\svtools\imagemgr.hrc -..\inc\testtool.hxx %_DEST%\inc%_EXT%\svtools\testtool.hxx -..\inc\flbytes.hxx %_DEST%\inc%_EXT%\svtools\flbytes.hxx -..\inc\adrparse.hxx %_DEST%\inc%_EXT%\svtools\adrparse.hxx -..\inc\broadcast.hxx %_DEST%\inc%_EXT%\svtools\broadcast.hxx -..\inc\calendar.hxx %_DEST%\inc%_EXT%\svtools\calendar.hxx -..\inc\cntnrsrt.hxx %_DEST%\inc%_EXT%\svtools\cntnrsrt.hxx -..\inc\ctrlbox.hxx %_DEST%\inc%_EXT%\svtools\ctrlbox.hxx -..\inc\ctrltool.hxx %_DEST%\inc%_EXT%\svtools\ctrltool.hxx -..\inc\collatorres.hxx %_DEST%\inc%_EXT%\svtools\collatorres.hxx -..\inc\indexentryres.hxx %_DEST%\inc%_EXT%\svtools\indexentryres.hxx -..\inc\cntwids.hrc %_DEST%\inc%_EXT%\svtools\cntwids.hrc -..\inc\itemdel.hxx %_DEST%\inc%_EXT%\svtools\itemdel.hxx -..\inc\wallitem.hxx %_DEST%\inc%_EXT%\svtools\wallitem.hxx -..\inc\stylepool.hxx %_DEST%\inc%_EXT%\svtools\stylepool.hxx -..\inc\dialogcontrolling.hxx %_DEST%\inc%_EXT%\svtools\dialogcontrolling.hxx -..\inc\filedlg.hxx %_DEST%\inc%_EXT%\svtools\filedlg.hxx -..\inc\fltdefs.hxx %_DEST%\inc%_EXT%\svtools\fltdefs.hxx -..\inc\imgdef.hxx %_DEST%\inc%_EXT%\svtools\imgdef.hxx -..\inc\inetdef.hxx %_DEST%\inc%_EXT%\svtools\inetdef.hxx -..\inc\inetmsg.hxx %_DEST%\inc%_EXT%\svtools\inetmsg.hxx -..\inc\inetstrm.hxx %_DEST%\inc%_EXT%\svtools\inetstrm.hxx -..\inc\listener.hxx %_DEST%\inc%_EXT%\svtools\listener.hxx -..\inc\listeneriter.hxx %_DEST%\inc%_EXT%\svtools\listeneriter.hxx -..\inc\memberid.hrc %_DEST%\inc%_EXT%\svtools\memberid.hrc -..\inc\prgsbar.hxx %_DEST%\inc%_EXT%\svtools\prgsbar.hxx -..\inc\poolcach.hxx %_DEST%\inc%_EXT%\svtools\poolcach.hxx -..\inc\ruler.hxx %_DEST%\inc%_EXT%\svtools\ruler.hxx -..\inc\scrwin.hxx %_DEST%\inc%_EXT%\svtools\scrwin.hxx -..\inc\scriptedtext.hxx %_DEST%\inc%_EXT%\svtools\scriptedtext.hxx -..\inc\tabbar.hxx %_DEST%\inc%_EXT%\svtools\tabbar.hxx -..\inc\taskbar.hxx %_DEST%\inc%_EXT%\svtools\taskbar.hxx -..\inc\whiter.hxx %_DEST%\inc%_EXT%\svtools\whiter.hxx -..\inc\stdmenu.hxx %_DEST%\inc%_EXT%\svtools\stdmenu.hxx -..\inc\tooltiplbox.hxx %_DEST%\inc%_EXT%\svtools\tooltiplbox.hxx -..\inc\txtattr.hxx %_DEST%\inc%_EXT%\svtools\txtattr.hxx -..\inc\sychconv.hxx %_DEST%\inc%_EXT%\svtools\sychconv.hxx -..\inc\cliplistener.hxx %_DEST%\inc%_EXT%\svtools\cliplistener.hxx -..\inc\txtcmp.hxx %_DEST%\inc%_EXT%\svtools\txtcmp.hxx -..\inc\urlbmk.hxx %_DEST%\inc%_EXT%\svtools\urlbmk.hxx -..\inc\inetimg.hxx %_DEST%\inc%_EXT%\svtools\inetimg.hxx -..\inc\nfsymbol.hxx %_DEST%\inc%_EXT%\svtools\nfsymbol.hxx -..\inc\numuno.hxx %_DEST%\inc%_EXT%\svtools\numuno.hxx -..\inc\imageresourceaccess.hxx %_DEST%\inc%_EXT%\svtools\imageresourceaccess.hxx -..\inc\addresstemplate.hxx %_DEST%\inc%_EXT%\svtools\addresstemplate.hxx -..\inc\templatefoldercache.hxx %_DEST%\inc%_EXT%\svtools\templatefoldercache.hxx -..\inc\folderrestriction.hxx %_DEST%\inc%_EXT%\svtools\folderrestriction.hxx -..\inc\filenotation.hxx %_DEST%\inc%_EXT%\svtools\filenotation.hxx -..\inc\framestatuslistener.hxx %_DEST%\inc%_EXT%\svtools\framestatuslistener.hxx -..\inc\statusbarcontroller.hxx %_DEST%\inc%_EXT%\svtools\statusbarcontroller.hxx -..\inc\htmltokn.h %_DEST%\inc%_EXT%\svtools\htmltokn.h -..\inc\htmlkywd.hxx %_DEST%\inc%_EXT%\svtools\htmlkywd.hxx -..\source\svrtf\rtfout.hxx %_DEST%\inc%_EXT%\svtools\rtfout.hxx -..\source\svrtf\rtftoken.h %_DEST%\inc%_EXT%\svtools\rtftoken.h -..\source\svrtf\rtfkeywd.hxx %_DEST%\inc%_EXT%\svtools\rtfkeywd.hxx -..\inc\strmadpt.hxx %_DEST%\inc%_EXT%\svtools\strmadpt.hxx -..\inc\instrm.hxx %_DEST%\inc%_EXT%\svtools\instrm.hxx -..\inc\outstrm.hxx %_DEST%\inc%_EXT%\svtools\outstrm.hxx -..\inc\sectctr.hxx %_DEST%\inc%_EXT%\svtools\sectctr.hxx -..\inc\privsplt.hxx %_DEST%\inc%_EXT%\svtools\privsplt.hxx -..\inc\expander.hxx %_DEST%\inc%_EXT%\svtools\expander.hxx -..\source\svsql\converter.hxx %_DEST%\inc%_EXT%\svtools\converter.hxx -..\inc\filectrl.hxx %_DEST%\inc%_EXT%\svtools\filectrl.hxx -..\inc\sfxecode.hxx %_DEST%\inc%_EXT%\svtools\sfxecode.hxx -..\source\dialogs\filedlg2.hrc %_DEST%\inc%_EXT%\svtools\filedlg2.hrc -..\inc\xmlement.hxx %_DEST%\inc%_EXT%\svtools\xmlement.hxx -..\inc\urihelper.hxx %_DEST%\inc%_EXT%\svtools\urihelper.hxx -..\inc\reginfo.hxx %_DEST%\inc%_EXT%\svtools\reginfo.hxx -..\inc\fstathelper.hxx %_DEST%\inc%_EXT%\svtools\fstathelper.hxx -..\inc\localresaccess.hxx %_DEST%\inc%_EXT%\svtools\localresaccess.hxx -..\inc\roadmap.hxx %_DEST%\inc%_EXT%\svtools\roadmap.hxx -..\inc\helpagentwindow.hxx %_DEST%\inc%_EXT%\svtools\helpagentwindow.hxx -..\inc\pickerhistory.hxx %_DEST%\inc%_EXT%\svtools\pickerhistory.hxx -..\inc\pickerhistoryaccess.hxx %_DEST%\inc%_EXT%\svtools\pickerhistoryaccess.hxx -..\inc\pickerhelper.hxx %_DEST%\inc%_EXT%\svtools\pickerhelper.hxx -..\inc\lngmisc.hxx %_DEST%\inc%_EXT%\svtools\lngmisc.hxx -..\inc\PasswordHelper.hxx %_DEST%\inc%_EXT%\svtools\PasswordHelper.hxx -..\inc\unoimap.hxx %_DEST%\inc%_EXT%\svtools\unoimap.hxx -..\inc\unoevent.hxx %_DEST%\inc%_EXT%\svtools\unoevent.hxx -..\inc\ivctrl.hxx %_DEST%\inc%_EXT%\svtools\ivctrl.hxx -..\inc\fileview.hxx %_DEST%\inc%_EXT%\svtools\fileview.hxx -..\inc\templdlg.hxx %_DEST%\inc%_EXT%\svtools\templdlg.hxx -..\inc\asynclink.hxx %_DEST%\inc%_EXT%\svtools\asynclink.hxx -..\inc\controldims.hrc %_DEST%\inc%_EXT%\svtools\controldims.hrc -..\inc\soerr.hxx %_DEST%\inc%_EXT%\svtools\soerr.hxx -..\inc\sores.hxx %_DEST%\inc%_EXT%\svtools\sores.hxx -..\inc\textwindowaccessibility.hxx %_DEST%\inc%_EXT%\svtools\textwindowaccessibility.hxx -..\inc\fontsubstconfig.hxx %_DEST%\inc%_EXT%\svtools\fontsubstconfig.hxx -..\inc\apearcfg.hxx %_DEST%\inc%_EXT%\svtools\apearcfg.hxx -..\inc\misccfg.hxx %_DEST%\inc%_EXT%\svtools\misccfg.hxx -..\inc\acceleratorexecute.hxx %_DEST%\inc%_EXT%\svtools\acceleratorexecute.hxx -..\inc\QueryFolderName.hxx %_DEST%\inc%_EXT%\svtools\QueryFolderName.hxx -..\inc\DocumentInfoPreview.hxx %_DEST%\inc%_EXT%\svtools\DocumentInfoPreview.hxx -..\inc\dialogclosedlistener.hxx %_DEST%\inc%_EXT%\svtools\dialogclosedlistener.hxx -..\inc\contextmenuhelper.hxx %_DEST%\inc%_EXT%\svtools\contextmenuhelper.hxx -..\inc\extcolorcfg.hxx %_DEST%\inc%_EXT%\svtools\extcolorcfg.hxx +..\inc\svl\*.hrc %_DEST%\inc%_EXT%\svtools\*.hrc +..\inc\svl\*.hxx %_DEST%\inc%_EXT%\svtools\*.hxx +..\inc\svl\*.h %_DEST%\inc%_EXT%\svtools\*.h +..\inc\*.hrc %_DEST%\inc%_EXT%\svtools\*.hrc +..\inc\*.hxx %_DEST%\inc%_EXT%\svtools\*.hxx +..\inc\*.h %_DEST%\inc%_EXT%\svtools\*.h dos: sh -c "if test %OS% = MACOSX; then macosx-create-bundle %_DEST%\bin%_EXT%\bmp=%__PRJROOT%\%__SRC%\bin%_EXT%; fi" diff --git a/svl/qa/complex/ConfigItems/helper/makefile.mk b/svl/qa/complex/ConfigItems/helper/makefile.mk index 6070d25b7bd4..d41fe6c129c6 100644 --- a/svl/qa/complex/ConfigItems/helper/makefile.mk +++ b/svl/qa/complex/ConfigItems/helper/makefile.mk @@ -34,7 +34,7 @@ #************************************************************************* PRJ=..$/..$/..$/.. -PRJNAME= svtools +PRJNAME= svl TARGET= ConfigItemTest USE_DEFFILE= TRUE ENABLE_EXCEPTIONS= TRUE @@ -60,7 +60,7 @@ SHL1OBJS= \ $(SLO)$/ConfigItemTest.obj SHL1STDLIBS= \ - $(SVTOOLLIB) \ + $(SVLIB) \ $(SVLLIB) \ $(UNOTOOLSLIB) \ $(COMPHELPERLIB) \ diff --git a/svl/qa/complex/ConfigItems/makefile.mk b/svl/qa/complex/ConfigItems/makefile.mk index f85c5b0a8e65..1291184346bc 100644 --- a/svl/qa/complex/ConfigItems/makefile.mk +++ b/svl/qa/complex/ConfigItems/makefile.mk @@ -34,7 +34,7 @@ #************************************************************************* PRJ = ..$/..$/.. TARGET = CheckConfigItems -PRJNAME = svtools +PRJNAME = svl PACKAGE = complex$/ConfigItems # --- Settings ----------------------------------------------------- diff --git a/svl/qa/complex/passwordcontainer/makefile.mk b/svl/qa/complex/passwordcontainer/makefile.mk index 4ce811bd3616..c3ff7538af0f 100644 --- a/svl/qa/complex/passwordcontainer/makefile.mk +++ b/svl/qa/complex/passwordcontainer/makefile.mk @@ -31,7 +31,7 @@ PRJ = ..$/..$/.. TARGET = PasswordContainerUnitTest -PRJNAME = svtools +PRJNAME=svl PACKAGE = complex$/passwordcontainer # --- Settings ----------------------------------------------------- diff --git a/svl/qa/makefile.mk b/svl/qa/makefile.mk index c56dc2804a64..439277ea62b0 100644 --- a/svl/qa/makefile.mk +++ b/svl/qa/makefile.mk @@ -30,7 +30,7 @@ #************************************************************************* PRJ = .. -PRJNAME = svtools +PRJNAME=svl TARGET = qa ENABLE_EXCEPTIONS = true @@ -49,7 +49,7 @@ SHL1STDLIBS=\ $(CPPULIB) \ $(CPPUHELPERLIB) \ $(SALLIB) \ - $(SVTOOLLIB) \ + $(SVLLIB) \ $(TOOLSLIB) \ $(UNOTOOLSLIB) \ $(TESTSHL2LIB) \ diff --git a/svl/qa/test_URIHelper.cxx b/svl/qa/test_URIHelper.cxx index a90fbe039b6d..3cf6d30d1813 100644 --- a/svl/qa/test_URIHelper.cxx +++ b/svl/qa/test_URIHelper.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "sal/config.h" diff --git a/svl/source/config/cjkoptions.cxx b/svl/source/config/cjkoptions.cxx index 66d70cd1e2a3..8483614d63dd 100644 --- a/svl/source/config/cjkoptions.cxx +++ b/svl/source/config/cjkoptions.cxx @@ -29,12 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION +#include "precompiled_svl.hxx" #include diff --git a/svl/source/config/ctloptions.cxx b/svl/source/config/ctloptions.cxx index 5d2bf131add1..3174577ea64f 100644 --- a/svl/source/config/ctloptions.cxx +++ b/svl/source/config/ctloptions.cxx @@ -29,12 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION +#include "precompiled_svl.hxx" #include diff --git a/svl/source/config/itemholder2.cxx b/svl/source/config/itemholder2.cxx index d0e5b30007f9..3796d9b45d75 100644 --- a/svl/source/config/itemholder2.cxx +++ b/svl/source/config/itemholder2.cxx @@ -29,12 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION +#include "precompiled_svl.hxx" #include "itemholder2.hxx" @@ -43,21 +38,12 @@ #include #include -#include -#include #include -#include -#include #include -#include -#include #include -#include -#include +#include #include #include -#include - #include @@ -169,34 +155,14 @@ void ItemHolder2::impl_newItem(TItemInfo& rItem) { switch(rItem.eItem) { - case E_ACCESSIBILITYOPTIONS : - rItem.pItem = new SvtAccessibilityOptions(); - break; - - case E_APEARCFG : -// no ref count rItem.pItem = new SvtTabAppearanceCfg(); - break; - case E_CJKOPTIONS : rItem.pItem = new SvtCJKOptions(); break; - case E_COLORCFG : - rItem.pItem = new ::svtools::ColorConfig(); - break; - case E_CTLOPTIONS : rItem.pItem = new SvtCTLOptions(); break; - case E_FONTSUBSTCONFIG : -// no ref count rItem.pItem = new SvtFontSubstConfig(); - break; - - case E_HELPOPTIONS : - rItem.pItem = new SvtHelpOptions(); - break; - case E_LANGUAGEOPTIONS : // capsulate CTL and CJL options ! rItem.pItem = new SvtLanguageOptions(); break; @@ -205,26 +171,10 @@ void ItemHolder2::impl_newItem(TItemInfo& rItem) // no ref count rItem.pItem = new SfxMiscCfg(); break; - case E_MENUOPTIONS : - rItem.pItem = new SvtMenuOptions(); - break; - - case E_PRINTOPTIONS : - rItem.pItem = new SvtPrinterOptions(); - break; - - case E_PRINTFILEOPTIONS : - rItem.pItem = new SvtPrintFileOptions(); - break; - case E_SYSLOCALEOPTIONS : rItem.pItem = new SvtSysLocaleOptions(); break; - case E_MISCOPTIONS : - rItem.pItem = new SvtMiscOptions(); - break; - default: OSL_ASSERT(false); break; diff --git a/svl/source/config/languageoptions.cxx b/svl/source/config/languageoptions.cxx index 0dffafee86d2..57beb23053b2 100644 --- a/svl/source/config/languageoptions.cxx +++ b/svl/source/config/languageoptions.cxx @@ -29,12 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION +#include "precompiled_svl.hxx" #include #include diff --git a/svl/source/config/makefile.mk b/svl/source/config/makefile.mk index d3f2615776da..e9beacce6a8e 100644 --- a/svl/source/config/makefile.mk +++ b/svl/source/config/makefile.mk @@ -30,7 +30,7 @@ #************************************************************************* PRJ=..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=config ENABLE_EXCEPTIONS := TRUE @@ -43,21 +43,11 @@ ENABLE_EXCEPTIONS := TRUE # --- Files -------------------------------------------------------- SLOFILES= \ - $(SLO)$/accessibilityoptions.obj \ - $(SLO)$/apearcfg.obj \ $(SLO)$/cjkoptions.obj \ - $(SLO)$/colorcfg.obj \ $(SLO)$/ctloptions.obj \ - $(SLO)$/extcolorcfg.obj \ - $(SLO)$/fontsubstconfig.obj \ - $(SLO)$/helpopt.obj \ - $(SLO)$/itemholder2.obj \ + $(SLO)$/itemholder2.obj \ $(SLO)$/languageoptions.obj \ - $(SLO)$/menuoptions.obj \ - $(SLO)$/misccfg.obj \ - $(SLO)$/miscopt.obj \ - $(SLO)$/optionsdrawinglayer.obj \ - $(SLO)$/printoptions.obj \ + $(SLO)$/misccfg.obj \ $(SLO)$/syslocaleoptions.obj # --- Targets ------------------------------------------------------ diff --git a/svl/source/config/misccfg.cxx b/svl/source/config/misccfg.cxx index 06cc9b7446c0..fd531b16a4f5 100644 --- a/svl/source/config/misccfg.cxx +++ b/svl/source/config/misccfg.cxx @@ -29,12 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION +#include "precompiled_svl.hxx" #include "misccfg.hxx" #include diff --git a/svl/source/config/syslocaleoptions.cxx b/svl/source/config/syslocaleoptions.cxx index a75c63e34af0..48b3981067df 100644 --- a/svl/source/config/syslocaleoptions.cxx +++ b/svl/source/config/syslocaleoptions.cxx @@ -29,12 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION +#include "precompiled_svl.hxx" #include #include diff --git a/svl/source/filepicker/makefile.mk b/svl/source/filepicker/makefile.mk index d00ac5170e1a..644c70af0b1a 100644 --- a/svl/source/filepicker/makefile.mk +++ b/svl/source/filepicker/makefile.mk @@ -30,7 +30,7 @@ #************************************************************************* PRJ=..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=filepicker ENABLE_EXCEPTIONS=TRUE diff --git a/svl/source/filepicker/pickerhelper.cxx b/svl/source/filepicker/pickerhelper.cxx index 0d8b2db9d8a0..cda263338d5d 100644 --- a/svl/source/filepicker/pickerhelper.cxx +++ b/svl/source/filepicker/pickerhelper.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "pickerhelper.hxx" #include "rtl/ustring.hxx" diff --git a/svl/source/filepicker/pickerhistory.cxx b/svl/source/filepicker/pickerhistory.cxx index 5bd584618f09..5cc12779f0b5 100644 --- a/svl/source/filepicker/pickerhistory.cxx +++ b/svl/source/filepicker/pickerhistory.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "pickerhistory.hxx" #include "pickerhistoryaccess.hxx" #include diff --git a/svl/source/filerec/filerec.cxx b/svl/source/filerec/filerec.cxx index 262e5135572a..5bb1a95c9a02 100644 --- a/svl/source/filerec/filerec.cxx +++ b/svl/source/filerec/filerec.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include diff --git a/svl/source/filerec/makefile.mk b/svl/source/filerec/makefile.mk index 33e4b4923183..c590e38a7ea1 100644 --- a/svl/source/filerec/makefile.mk +++ b/svl/source/filerec/makefile.mk @@ -31,7 +31,7 @@ PRJ=..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=filerec # --- Settings ----------------------------------------------------- diff --git a/svl/source/fsstor/fsfactory.cxx b/svl/source/fsstor/fsfactory.cxx index 33df962be846..e47593ba8f8b 100644 --- a/svl/source/fsstor/fsfactory.cxx +++ b/svl/source/fsstor/fsfactory.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "fsfactory.hxx" #include "cppuhelper/factory.hxx" diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx index cec018533a9a..bae02feae1dd 100644 --- a/svl/source/fsstor/fsstorage.cxx +++ b/svl/source/fsstor/fsstorage.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include #include diff --git a/svl/source/fsstor/makefile.mk b/svl/source/fsstor/makefile.mk index f55f6747f9e1..7f46009750fd 100644 --- a/svl/source/fsstor/makefile.mk +++ b/svl/source/fsstor/makefile.mk @@ -30,7 +30,7 @@ #************************************************************************* PRJ=..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=fsstorage.uno LIBTARGET=NO ENABLE_EXCEPTIONS=TRUE diff --git a/svl/source/fsstor/oinputstreamcontainer.cxx b/svl/source/fsstor/oinputstreamcontainer.cxx index dc08a7a34602..53be03699ba0 100644 --- a/svl/source/fsstor/oinputstreamcontainer.cxx +++ b/svl/source/fsstor/oinputstreamcontainer.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "oinputstreamcontainer.hxx" #include diff --git a/svl/source/fsstor/ostreamcontainer.cxx b/svl/source/fsstor/ostreamcontainer.cxx index d801f49532b2..dac7c9c31375 100644 --- a/svl/source/fsstor/ostreamcontainer.cxx +++ b/svl/source/fsstor/ostreamcontainer.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "ostreamcontainer.hxx" diff --git a/svl/source/items/aeitem.cxx b/svl/source/items/aeitem.cxx index 63fbd1db6227..54ce914d09fe 100644 --- a/svl/source/items/aeitem.cxx +++ b/svl/source/items/aeitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif diff --git a/svl/source/items/bintitem.cxx b/svl/source/items/bintitem.cxx index a3b6c1c2b54d..1ee0ebe224e1 100644 --- a/svl/source/items/bintitem.cxx +++ b/svl/source/items/bintitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include #include diff --git a/svl/source/items/cenumitm.cxx b/svl/source/items/cenumitm.cxx index 1906e62a8cf8..65cc4a78be54 100644 --- a/svl/source/items/cenumitm.cxx +++ b/svl/source/items/cenumitm.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include #include diff --git a/svl/source/items/cintitem.cxx b/svl/source/items/cintitem.cxx index 97cce9b75591..a20c947b56de 100644 --- a/svl/source/items/cintitem.cxx +++ b/svl/source/items/cintitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include #include diff --git a/svl/source/items/cntwall.cxx b/svl/source/items/cntwall.cxx index 67e9387fbe26..5d4941981ec4 100644 --- a/svl/source/items/cntwall.cxx +++ b/svl/source/items/cntwall.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include diff --git a/svl/source/items/cstitem.cxx b/svl/source/items/cstitem.cxx index 9755f4bb9944..eb9092828060 100644 --- a/svl/source/items/cstitem.cxx +++ b/svl/source/items/cstitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include @@ -150,70 +150,70 @@ SfxItemPresentation SfxCrawlStatusItem::GetPresentation switch (eStatus) { case CSTAT_NEVER_UPD: - rText = String(SvtResId(STR_CSTAT_NEVER_UPD, + rText = String(SvtSimpleResId(STR_CSTAT_NEVER_UPD, pIntlWrapper ? pIntlWrapper->getLocale() : aLocale)); break; case CSTAT_IN_UPD: - rText = String(SvtResId(STR_CSTAT_IN_UPD, + rText = String(SvtSimpleResId(STR_CSTAT_IN_UPD, pIntlWrapper ? pIntlWrapper->getLocale() : aLocale)); break; case CSTAT_UPD_NEWER: - rText = String(SvtResId(STR_CSTAT_UPD_NEWER, + rText = String(SvtSimpleResId(STR_CSTAT_UPD_NEWER, pIntlWrapper ? pIntlWrapper->getLocale() : aLocale)); break; case CSTAT_UPD_NOT_NEWER: - rText = String(SvtResId(STR_CSTAT_UPD_NOT_NEWER, + rText = String(SvtSimpleResId(STR_CSTAT_UPD_NOT_NEWER, pIntlWrapper ? pIntlWrapper->getLocale() : aLocale)); break; case CSTAT_UPD_CANCEL: - rText = String(SvtResId(STR_CSTAT_UPD_CANCEL, + rText = String(SvtSimpleResId(STR_CSTAT_UPD_CANCEL, pIntlWrapper ? pIntlWrapper->getLocale() : aLocale)); break; case CSTAT_ERR_GENERAL: - rText = String(SvtResId(STR_CSTAT_ERR_GENERAL, + rText = String(SvtSimpleResId(STR_CSTAT_ERR_GENERAL, pIntlWrapper ? pIntlWrapper->getLocale() : aLocale)); break; case CSTAT_ERR_NOTEXISTS: - rText = String(SvtResId(STR_CSTAT_ERR_NOTEXISTS, + rText = String(SvtSimpleResId(STR_CSTAT_ERR_NOTEXISTS, pIntlWrapper ? pIntlWrapper->getLocale() : aLocale)); break; case CSTAT_ERR_NOTREACHED: - rText = String(SvtResId(STR_CSTAT_ERR_NOTREACHED, + rText = String(SvtSimpleResId(STR_CSTAT_ERR_NOTREACHED, pIntlWrapper ? pIntlWrapper->getLocale() : aLocale)); break; case CSTAT_UPD_IMMEDIATELY: - rText = String(SvtResId(STR_CSTAT_UPD_IMMEDIATELY, + rText = String(SvtSimpleResId(STR_CSTAT_UPD_IMMEDIATELY, pIntlWrapper ? pIntlWrapper->getLocale() : aLocale)); break; case CSTAT_ERR_OFFLINE: - rText = String(SvtResId(STR_CSTAT_ERR_OFFLINE, + rText = String(SvtSimpleResId(STR_CSTAT_ERR_OFFLINE, pIntlWrapper ? pIntlWrapper->getLocale() : aLocale)); diff --git a/svl/source/items/ctypeitm.cxx b/svl/source/items/ctypeitm.cxx index 552d4a6a9041..a5c12d49dda5 100644 --- a/svl/source/items/ctypeitm.cxx +++ b/svl/source/items/ctypeitm.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include diff --git a/svl/source/items/custritm.cxx b/svl/source/items/custritm.cxx index 9f573beb56fd..5e2be8469922 100644 --- a/svl/source/items/custritm.cxx +++ b/svl/source/items/custritm.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include diff --git a/svl/source/items/dateitem.cxx b/svl/source/items/dateitem.cxx index 4ba6e1d460f9..5ce66349c0a3 100644 --- a/svl/source/items/dateitem.cxx +++ b/svl/source/items/dateitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" // include --------------------------------------------------------------- @@ -50,7 +50,7 @@ #include -#include +#include #include // STATIC DATA ----------------------------------------------------------- @@ -259,7 +259,7 @@ SfxItemPresentation SfxColumnDateTimeItem::GetPresentation ::com::sun::star::lang::Locale aLocale; if (GetDateTime() == DateTime(Date(1, 2, 3), Time(3, 2, 1))) - rText = String(SvtResId(STR_COLUM_DT_AUTO, + rText = String(SvtSimpleResId(STR_COLUM_DT_AUTO, pIntlWrapper ? pIntlWrapper->getLocale() : aLocale)); diff --git a/svl/source/items/dtritem.cxx b/svl/source/items/dtritem.cxx index fa3a36b762f5..5159631f713a 100644 --- a/svl/source/items/dtritem.cxx +++ b/svl/source/items/dtritem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include diff --git a/svl/source/items/eitem.cxx b/svl/source/items/eitem.cxx index f7b95665391d..1dc137f32467 100644 --- a/svl/source/items/eitem.cxx +++ b/svl/source/items/eitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include //============================================================================ // diff --git a/svl/source/items/flagitem.cxx b/svl/source/items/flagitem.cxx index e59f981c5afa..e2e0bd55f919 100644 --- a/svl/source/items/flagitem.cxx +++ b/svl/source/items/flagitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include diff --git a/svl/source/items/frqitem.cxx b/svl/source/items/frqitem.cxx index 4068ef8f97f1..b7d47e4e3ac9 100644 --- a/svl/source/items/frqitem.cxx +++ b/svl/source/items/frqitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif diff --git a/svl/source/items/globalnameitem.cxx b/svl/source/items/globalnameitem.cxx index 6a8359fb39b8..e8beb9a62b9e 100644 --- a/svl/source/items/globalnameitem.cxx +++ b/svl/source/items/globalnameitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include #include diff --git a/svl/source/items/ilstitem.cxx b/svl/source/items/ilstitem.cxx index a26c054eeadb..3d600632118f 100644 --- a/svl/source/items/ilstitem.cxx +++ b/svl/source/items/ilstitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include diff --git a/svl/source/items/imageitm.cxx b/svl/source/items/imageitm.cxx index cc4a2ebd4f3b..276e7445ae3f 100644 --- a/svl/source/items/imageitm.cxx +++ b/svl/source/items/imageitm.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include diff --git a/svl/source/items/intitem.cxx b/svl/source/items/intitem.cxx index b20f245f964b..245e9734aa89 100644 --- a/svl/source/items/intitem.cxx +++ b/svl/source/items/intitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include diff --git a/svl/source/items/itemiter.cxx b/svl/source/items/itemiter.cxx index 9a7fa4d72c88..3bd616054149 100644 --- a/svl/source/items/itemiter.cxx +++ b/svl/source/items/itemiter.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx index 823658132fe0..50f5c1fee817 100644 --- a/svl/source/items/itempool.cxx +++ b/svl/source/items/itempool.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include diff --git a/svl/source/items/itemprop.cxx b/svl/source/items/itemprop.cxx index 354e0a1441ba..cf2677dd988c 100644 --- a/svl/source/items/itemprop.cxx +++ b/svl/source/items/itemprop.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx index fee00dca854a..05873c0d5b41 100644 --- a/svl/source/items/itemset.cxx +++ b/svl/source/items/itemset.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include diff --git a/svl/source/items/lckbitem.cxx b/svl/source/items/lckbitem.cxx index c848e377b257..695a80ecf0a4 100644 --- a/svl/source/items/lckbitem.cxx +++ b/svl/source/items/lckbitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #define _LCKBITEM_CXX #include diff --git a/svl/source/items/macitem.cxx b/svl/source/items/macitem.cxx index 480fb844ccc7..4837f9cb88e0 100644 --- a/svl/source/items/macitem.cxx +++ b/svl/source/items/macitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #ifndef GCC diff --git a/svl/source/items/makefile.mk b/svl/source/items/makefile.mk index 651e54bb7e23..ea376eeb08ee 100644 --- a/svl/source/items/makefile.mk +++ b/svl/source/items/makefile.mk @@ -30,14 +30,14 @@ #************************************************************************* PRJ=..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=items ENABLE_EXCEPTIONS=TRUE # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk +.INCLUDE : $(PRJ)$/util$/svl.pmk # --- Files -------------------------------------------------------- @@ -48,7 +48,6 @@ SLOFILES=\ $(SLO)$/globalnameitem.obj \ $(SLO)$/imageitm.obj \ $(SLO)$/intitem.obj \ - $(SLO)$/itemdel.obj \ $(SLO)$/macitem.obj \ $(SLO)$/poolcach.obj \ $(SLO)$/ptitem.obj \ @@ -56,8 +55,37 @@ SLOFILES=\ $(SLO)$/rngitem.obj \ $(SLO)$/stritem.obj \ $(SLO)$/style.obj \ - $(SLO)$/szitem.obj \ - $(SLO)$/wallitem.obj + $(SLO)$/szitem.obj \ + $(SLO)$/bintitem.obj \ + $(SLO)$/cenumitm.obj \ + $(SLO)$/cintitem.obj \ + $(SLO)$/cntwall.obj \ + $(SLO)$/cstitem.obj \ + $(SLO)$/ctypeitm.obj \ + $(SLO)$/custritm.obj \ + $(SLO)$/dateitem.obj \ + $(SLO)$/dtritem.obj \ + $(SLO)$/frqitem.obj \ + $(SLO)$/ilstitem.obj \ + $(SLO)$/itemiter.obj \ + $(SLO)$/itempool.obj \ + $(SLO)$/itemprop.obj \ + $(SLO)$/itemset.obj \ + $(SLO)$/lckbitem.obj \ + $(SLO)$/poolio.obj \ + $(SLO)$/stylepool.obj \ + $(SLO)$/poolitem.obj \ + $(SLO)$/sfontitm.obj \ + $(SLO)$/sitem.obj \ + $(SLO)$/slstitm.obj \ + $(SLO)$/tfrmitem.obj \ + $(SLO)$/tresitem.obj \ + $(SLO)$/whiter.obj \ + $(SLO)$/visitem.obj + +SRS1NAME=$(TARGET) +SRC1FILES=\ + cstitem.src # --- Targets ------------------------------------------------------- diff --git a/svl/source/items/nranges.cxx b/svl/source/items/nranges.cxx index e12c7428d513..789da8dc5ff9 100644 --- a/svl/source/items/nranges.cxx +++ b/svl/source/items/nranges.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" // compiled via include from itemset.cxx only! diff --git a/svl/source/items/poolcach.cxx b/svl/source/items/poolcach.cxx index 2c758a7e25fa..634b1cae1c14 100644 --- a/svl/source/items/poolcach.cxx +++ b/svl/source/items/poolcach.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx index f2eb94ef7f67..bee7bc04ae23 100644 --- a/svl/source/items/poolio.cxx +++ b/svl/source/items/poolio.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include @@ -42,7 +42,7 @@ #include "whassert.hxx" #include #include -#include +#include #include "poolio.hxx" // STATIC DATA ----------------------------------------------------------- @@ -67,7 +67,7 @@ void SfxItemPool::SetStoringPool( const SfxItemPool *pStoringPool ) */ { - ImpSvtData::GetSvtData().pStoringPool = pStoringPool; + ImpSvlData::GetSvlData().pStoringPool = pStoringPool; } //------------------------------------------------------------------------- @@ -84,7 +84,7 @@ const SfxItemPool* SfxItemPool::GetStoringPool() */ { - return ImpSvtData::GetSvtData().pStoringPool; + return ImpSvlData::GetSvlData().pStoringPool; } //------------------------------------------------------------------------- @@ -169,7 +169,7 @@ SvStream &SfxItemPool::Store(SvStream &rStream) const // jeder Pool ist als ganzes ein Record SfxMiniRecordWriter aPoolRec( &rStream, SFX_ITEMPOOL_REC ); - ImpSvtData::GetSvtData().pStoringPool = this; + ImpSvlData::GetSvlData().pStoringPool = this; // Einzel-Header (Version des Inhalts und Name) { @@ -309,7 +309,7 @@ SvStream &SfxItemPool::Store(SvStream &rStream) const } // weitere Pools rausschreiben - ImpSvtData::GetSvtData().pStoringPool = 0; + ImpSvlData::GetSvlData().pStoringPool = 0; aPoolRec.Close(); if ( !rStream.GetError() && pSecondary ) pSecondary->Store( rStream ); diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx index ef160b4a8b4c..8946175a0dd2 100644 --- a/svl/source/items/poolitem.cxx +++ b/svl/source/items/poolitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include diff --git a/svl/source/items/ptitem.cxx b/svl/source/items/ptitem.cxx index ac1e94fd1727..5d8497dd0ada 100644 --- a/svl/source/items/ptitem.cxx +++ b/svl/source/items/ptitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include diff --git a/svl/source/items/rectitem.cxx b/svl/source/items/rectitem.cxx index f9faeeeaa824..e88d2886b7c0 100644 --- a/svl/source/items/rectitem.cxx +++ b/svl/source/items/rectitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include diff --git a/svl/source/items/rngitem.cxx b/svl/source/items/rngitem.cxx index 0c62de7229f4..17ff38a01382 100644 --- a/svl/source/items/rngitem.cxx +++ b/svl/source/items/rngitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #ifndef NUMTYPE diff --git a/svl/source/items/sfontitm.cxx b/svl/source/items/sfontitm.cxx index ee7119c95e1c..6413cbc8d1cc 100644 --- a/svl/source/items/sfontitm.cxx +++ b/svl/source/items/sfontitm.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include #include diff --git a/svl/source/items/sitem.cxx b/svl/source/items/sitem.cxx index 2a917e93bb79..04ae8becfde0 100644 --- a/svl/source/items/sitem.cxx +++ b/svl/source/items/sitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" // INCLUDE --------------------------------------------------------------- #ifndef GCC diff --git a/svl/source/items/slstitm.cxx b/svl/source/items/slstitm.cxx index 87163d41e033..12b2aa2dbd4b 100644 --- a/svl/source/items/slstitm.cxx +++ b/svl/source/items/slstitm.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include diff --git a/svl/source/items/stritem.cxx b/svl/source/items/stritem.cxx index 37968dc3ee1d..4b24b5712fe1 100644 --- a/svl/source/items/stritem.cxx +++ b/svl/source/items/stritem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include //============================================================================ diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index ad11f1527ce7..68bae3f8142e 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif diff --git a/svl/source/items/szitem.cxx b/svl/source/items/szitem.cxx index ec3ff83dd2ec..de18e13b04d7 100644 --- a/svl/source/items/szitem.cxx +++ b/svl/source/items/szitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include diff --git a/svl/source/items/tfrmitem.cxx b/svl/source/items/tfrmitem.cxx index a7019ff69947..d4909aca049c 100644 --- a/svl/source/items/tfrmitem.cxx +++ b/svl/source/items/tfrmitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include diff --git a/svl/source/items/tresitem.cxx b/svl/source/items/tresitem.cxx index 6e70c82a4d03..4ad6fa3c1b77 100644 --- a/svl/source/items/tresitem.cxx +++ b/svl/source/items/tresitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include using namespace com::sun::star; diff --git a/svl/source/items/visitem.cxx b/svl/source/items/visitem.cxx index 112b223a8be0..a4f10b98303c 100644 --- a/svl/source/items/visitem.cxx +++ b/svl/source/items/visitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include #include diff --git a/svl/source/items/whiter.cxx b/svl/source/items/whiter.cxx index 461daf7ac012..4b582900d152 100644 --- a/svl/source/items/whiter.cxx +++ b/svl/source/items/whiter.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" // INCLUDE --------------------------------------------------------------- #ifndef GCC #endif diff --git a/svl/source/memtools/makefile.mk b/svl/source/memtools/makefile.mk index 4592bceff8cc..8f59391a25ee 100644 --- a/svl/source/memtools/makefile.mk +++ b/svl/source/memtools/makefile.mk @@ -31,7 +31,7 @@ PRJ=..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=svarray # --- Settings ----------------------------------------------------- diff --git a/svl/source/memtools/svarray.cxx b/svl/source/memtools/svarray.cxx index fe682e5f535d..40a77aefd711 100644 --- a/svl/source/memtools/svarray.cxx +++ b/svl/source/memtools/svarray.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #define _SVARRAY_CXX diff --git a/svl/source/misc/PasswordHelper.cxx b/svl/source/misc/PasswordHelper.cxx index 53c447bde830..a1125306eb7b 100644 --- a/svl/source/misc/PasswordHelper.cxx +++ b/svl/source/misc/PasswordHelper.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC diff --git a/svl/source/misc/adrparse.cxx b/svl/source/misc/adrparse.cxx index 37c25d6c669f..2dcece9e2671 100644 --- a/svl/source/misc/adrparse.cxx +++ b/svl/source/misc/adrparse.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include diff --git a/svl/source/misc/documentlockfile.cxx b/svl/source/misc/documentlockfile.cxx index 1f54a6771f95..3de51f2fc8c6 100644 --- a/svl/source/misc/documentlockfile.cxx +++ b/svl/source/misc/documentlockfile.cxx @@ -30,7 +30,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include diff --git a/svl/source/misc/filenotation.cxx b/svl/source/misc/filenotation.cxx index f5e5ae934e3d..d50645c97439 100644 --- a/svl/source/misc/filenotation.cxx +++ b/svl/source/misc/filenotation.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "filenotation.hxx" #include #include diff --git a/svl/source/misc/flbytes.cxx b/svl/source/misc/flbytes.cxx index acf53d9b3e94..ce414be8e838 100644 --- a/svl/source/misc/flbytes.cxx +++ b/svl/source/misc/flbytes.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include diff --git a/svl/source/misc/folderrestriction.cxx b/svl/source/misc/folderrestriction.cxx index 7f95bdaaa0bc..9ec7ead0a4be 100644 --- a/svl/source/misc/folderrestriction.cxx +++ b/svl/source/misc/folderrestriction.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "folderrestriction.hxx" #include "osl/process.h" diff --git a/svl/source/misc/fstathelper.cxx b/svl/source/misc/fstathelper.cxx index 82480fc83473..43619e879a91 100644 --- a/svl/source/misc/fstathelper.cxx +++ b/svl/source/misc/fstathelper.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include #include diff --git a/svl/source/misc/inethist.cxx b/svl/source/misc/inethist.cxx index 5a1a3719d7ca..5dfc2744f67a 100644 --- a/svl/source/misc/inethist.cxx +++ b/svl/source/misc/inethist.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #ifndef INCLUDED_ALGORITHM diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx index ce62d7f3b2fc..f0e62b798cff 100644 --- a/svl/source/misc/inettype.cxx +++ b/svl/source/misc/inettype.cxx @@ -29,11 +29,11 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include #include -#include +#include #ifndef _SVTOOLS_HRC #include #endif diff --git a/svl/source/misc/lngmisc.cxx b/svl/source/misc/lngmisc.cxx index e00540af1ab1..df7c28d22b1d 100644 --- a/svl/source/misc/lngmisc.cxx +++ b/svl/source/misc/lngmisc.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include #include diff --git a/svl/source/misc/lockfilecommon.cxx b/svl/source/misc/lockfilecommon.cxx index ba4440c462a8..8d0bc0f26415 100644 --- a/svl/source/misc/lockfilecommon.cxx +++ b/svl/source/misc/lockfilecommon.cxx @@ -30,7 +30,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include diff --git a/svl/source/misc/makefile.mk b/svl/source/misc/makefile.mk new file mode 100644 index 000000000000..93ebc7f9470c --- /dev/null +++ b/svl/source/misc/makefile.mk @@ -0,0 +1,75 @@ +#************************************************************************* +# +# 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 +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.6 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. +PRJNAME=svl +TARGET=misc + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/svl.pmk + +# --- Files -------------------------------------------------------- + +EXCEPTIONSFILES=\ + $(SLO)$/documentlockfile.obj \ + $(SLO)$/flbytes.obj \ + $(SLO)$/folderrestriction.obj \ + $(SLO)$/fstathelper.obj \ + $(SLO)$/lockfilecommon.obj \ + $(SLO)$/ownlist.obj \ + $(SLO)$/restrictedpaths.obj \ + $(SLO)$/sharecontrolfile.obj \ + $(SLO)$/strmadpt.obj \ + $(SLO)$/svldata.obj \ + $(SLO)$/urihelper.obj + +SLOFILES=\ + $(EXCEPTIONSFILES) \ + $(SLO)$/adrparse.obj \ + $(SLO)$/filenotation.obj \ + $(SLO)$/inethist.obj \ + $(SLO)$/inettype.obj \ + $(SLO)$/lngmisc.obj \ + $(SLO)$/PasswordHelper.obj + +SRS1NAME=$(TARGET) +SRC1FILES=\ + mediatyp.src + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + + + + diff --git a/svl/source/misc/ownlist.cxx b/svl/source/misc/ownlist.cxx index 346b4ff7251e..e642f00ba826 100644 --- a/svl/source/misc/ownlist.cxx +++ b/svl/source/misc/ownlist.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include #include diff --git a/svl/source/misc/restrictedpaths.cxx b/svl/source/misc/restrictedpaths.cxx index 354e32126680..286b046a5067 100644 --- a/svl/source/misc/restrictedpaths.cxx +++ b/svl/source/misc/restrictedpaths.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include diff --git a/svl/source/misc/sharecontrolfile.cxx b/svl/source/misc/sharecontrolfile.cxx index 32d7b1873f68..2a151b24fd26 100644 --- a/svl/source/misc/sharecontrolfile.cxx +++ b/svl/source/misc/sharecontrolfile.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include diff --git a/svl/source/misc/strmadpt.cxx b/svl/source/misc/strmadpt.cxx index 4c4835609b7b..9803f2bcc32f 100644 --- a/svl/source/misc/strmadpt.cxx +++ b/svl/source/misc/strmadpt.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include // needed under Solaris when including ... diff --git a/svl/source/misc/svldata.cxx b/svl/source/misc/svldata.cxx index 51247a628c0e..d791e9d9a560 100644 --- a/svl/source/misc/svldata.cxx +++ b/svl/source/misc/svldata.cxx @@ -6,7 +6,7 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svtdata.cxx,v $ + * $RCSfile: svldata.cxx,v $ * $Revision: 1.7 $ * * This file is part of OpenOffice.org. @@ -29,20 +29,20 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include #include #include -#include +#include -namespace unnamed_svtools_svtdata {} -using namespace unnamed_svtools_svtdata; +namespace unnamed_svl_svldata {} +using namespace unnamed_svl_svldata; // unnamed namespaces don't work well yet //============================================================================ -namespace unnamed_svtools_svtdata { +namespace unnamed_svl_svldata { typedef std::map< rtl::OUString, SimpleResMgr * > SimpleResMgrMap; @@ -50,13 +50,14 @@ typedef std::map< rtl::OUString, SimpleResMgr * > SimpleResMgrMap; //============================================================================ // -// ImpSvtData +// ImpSvlData // //============================================================================ -ImpSvtData::~ImpSvtData() +static ImpSvlData* pSvlData = 0; + +ImpSvlData::~ImpSvlData() { - delete pResMgr; for (SimpleResMgrMap::iterator t = static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs)->begin(); t != static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs)->end(); ++t) @@ -65,17 +66,7 @@ ImpSvtData::~ImpSvtData() } //============================================================================ -ResMgr * ImpSvtData::GetResMgr(const ::com::sun::star::lang::Locale aLocale) -{ - if (!pResMgr) - { - pResMgr = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(svt), aLocale ); - } - return pResMgr; -} - -//============================================================================ -SimpleResMgr* ImpSvtData::GetSimpleRM(const ::com::sun::star::lang::Locale& rLocale) +SimpleResMgr* ImpSvlData::GetSimpleRM(const ::com::sun::star::lang::Locale& rLocale) { if (!m_pThreadsafeRMs) m_pThreadsafeRMs = new SimpleResMgrMap; @@ -92,22 +83,12 @@ SimpleResMgr* ImpSvtData::GetSimpleRM(const ::com::sun::star::lang::Locale& rLoc return rResMgr; } -ResMgr * ImpSvtData::GetPatchResMgr(const ::com::sun::star::lang::Locale& aLocale) -{ - if (!pPatchResMgr) - { - pPatchResMgr = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(svp), aLocale); - } - return pPatchResMgr; -} - //============================================================================ // static -ImpSvtData & ImpSvtData::GetSvtData() +ImpSvlData & ImpSvlData::GetSvlData() { - void ** pAppData = GetAppData(SHL_SVT); - if (!*pAppData) - *pAppData= new ImpSvtData; - return *static_cast(*pAppData); + if (!pSvlData) + pSvlData= new ImpSvlData; + return *pSvlData; } diff --git a/svl/source/misc/urihelper.cxx b/svl/source/misc/urihelper.cxx index 1ddb4c6dd6f9..58e21f425bf6 100644 --- a/svl/source/misc/urihelper.cxx +++ b/svl/source/misc/urihelper.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include #include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" diff --git a/svl/source/notify/brdcst.cxx b/svl/source/notify/brdcst.cxx index 3a698c725c5c..928ec79fe328 100644 --- a/svl/source/notify/brdcst.cxx +++ b/svl/source/notify/brdcst.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif diff --git a/svl/source/notify/broadcast.cxx b/svl/source/notify/broadcast.cxx index e363f545c719..62c00ff8c414 100644 --- a/svl/source/notify/broadcast.cxx +++ b/svl/source/notify/broadcast.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif diff --git a/svl/source/notify/cancel.cxx b/svl/source/notify/cancel.cxx index 32a76a7df9c1..12969a4f8e6a 100644 --- a/svl/source/notify/cancel.cxx +++ b/svl/source/notify/cancel.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #define _SFX_CANCEL_CXX #include diff --git a/svl/source/notify/hint.cxx b/svl/source/notify/hint.cxx index 9ae3bf8f8b21..8f48ba28f895 100644 --- a/svl/source/notify/hint.cxx +++ b/svl/source/notify/hint.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif diff --git a/svl/source/notify/isethint.cxx b/svl/source/notify/isethint.cxx index 67d484219ac6..77c630cd2148 100644 --- a/svl/source/notify/isethint.cxx +++ b/svl/source/notify/isethint.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif diff --git a/svl/source/notify/listener.cxx b/svl/source/notify/listener.cxx index 0ce072b44dfb..7d9a223e1a73 100644 --- a/svl/source/notify/listener.cxx +++ b/svl/source/notify/listener.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif diff --git a/svl/source/notify/listenerbase.cxx b/svl/source/notify/listenerbase.cxx index 25f1f1da1901..bb1569c128c5 100644 --- a/svl/source/notify/listenerbase.cxx +++ b/svl/source/notify/listenerbase.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif diff --git a/svl/source/notify/listeneriter.cxx b/svl/source/notify/listeneriter.cxx index 08fcb5b7e9ac..1f92eadfedbc 100644 --- a/svl/source/notify/listeneriter.cxx +++ b/svl/source/notify/listeneriter.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif #include diff --git a/svl/source/notify/lstner.cxx b/svl/source/notify/lstner.cxx index d7345d7ed3db..87afd96365cc 100644 --- a/svl/source/notify/lstner.cxx +++ b/svl/source/notify/lstner.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif diff --git a/svl/source/notify/makefile.mk b/svl/source/notify/makefile.mk index 8e4c4b211258..0d26860d02b5 100644 --- a/svl/source/notify/makefile.mk +++ b/svl/source/notify/makefile.mk @@ -31,7 +31,7 @@ PRJ=..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=notify # --- Settings ----------------------------------------------------- diff --git a/svl/source/notify/smplhint.cxx b/svl/source/notify/smplhint.cxx index 6fddffc23e56..bd9933d2dece 100644 --- a/svl/source/notify/smplhint.cxx +++ b/svl/source/notify/smplhint.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif diff --git a/svl/source/numbers/makefile.mk b/svl/source/numbers/makefile.mk index 46cd3985df1a..db4b30070ce8 100644 --- a/svl/source/numbers/makefile.mk +++ b/svl/source/numbers/makefile.mk @@ -31,7 +31,7 @@ PRJ=..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=numbers LIBTARGET=NO @@ -41,7 +41,7 @@ PROJECTPCHSOURCE= # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk +.INCLUDE : $(PRJ)$/util$/svl.pmk # --- Files -------------------------------------------------------- diff --git a/svl/source/numbers/nbdll.cxx b/svl/source/numbers/nbdll.cxx index d7cf20f6059f..2bc5121e18fd 100644 --- a/svl/source/numbers/nbdll.cxx +++ b/svl/source/numbers/nbdll.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifdef WIN #include diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx index d65a2fd696ce..598680c4da75 100644 --- a/svl/source/numbers/numfmuno.cxx +++ b/svl/source/numbers/numfmuno.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif diff --git a/svl/source/numbers/numhead.cxx b/svl/source/numbers/numhead.cxx index 7e79aad624f3..99ff33433de3 100644 --- a/svl/source/numbers/numhead.cxx +++ b/svl/source/numbers/numhead.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif #include diff --git a/svl/source/numbers/numuno.cxx b/svl/source/numbers/numuno.cxx index f91bf82b4e60..a66a48f0a3f5 100644 --- a/svl/source/numbers/numuno.cxx +++ b/svl/source/numbers/numuno.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif diff --git a/svl/source/numbers/supservs.cxx b/svl/source/numbers/supservs.cxx index 1035cd056406..67b9170d59fc 100644 --- a/svl/source/numbers/supservs.cxx +++ b/svl/source/numbers/supservs.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "supservs.hxx" #include #include diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index aa7d75a098b7..b5719f7ac868 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index fcae93964e72..885a6df53533 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 0afbf3b4a3f5..7c7cf6bcc524 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include #include diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx index 77b33226559c..9eb939403afd 100644 --- a/svl/source/numbers/zforscan.cxx +++ b/svl/source/numbers/zforscan.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif diff --git a/svl/source/passwordcontainer/makefile.mk b/svl/source/passwordcontainer/makefile.mk index 31e1336ad966..3c74246ee3ed 100644 --- a/svl/source/passwordcontainer/makefile.mk +++ b/svl/source/passwordcontainer/makefile.mk @@ -30,7 +30,7 @@ #************************************************************************* PRJ=..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=passwordcontainer.uno LIBTARGET=NO ENABLE_EXCEPTIONS=TRUE diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index 5f9ce207ff6b..d5f3c62173e4 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "passwordcontainer.hxx" diff --git a/svl/source/svdde/ddecli.cxx b/svl/source/svdde/ddecli.cxx index e31e53d07522..8f6f72c655df 100644 --- a/svl/source/svdde/ddecli.cxx +++ b/svl/source/svdde/ddecli.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #define UNICODE #include // memset diff --git a/svl/source/svdde/ddedata.cxx b/svl/source/svdde/ddedata.cxx index 9167c8585b08..765c5feff0ba 100644 --- a/svl/source/svdde/ddedata.cxx +++ b/svl/source/svdde/ddedata.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" // ACHTUNG: es wird angenommen, dass StarView-Clipboard-Foamatnummern // und Windows-Formatnummern identisch sind! Ist dies einmal nicht der diff --git a/svl/source/svdde/ddedll.cxx b/svl/source/svdde/ddedll.cxx index 696d7b2851d2..b27272a2a910 100644 --- a/svl/source/svdde/ddedll.cxx +++ b/svl/source/svdde/ddedll.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifdef WIN diff --git a/svl/source/svdde/ddeinf.cxx b/svl/source/svdde/ddeinf.cxx index 7c2fb82789e6..923f1a725046 100644 --- a/svl/source/svdde/ddeinf.cxx +++ b/svl/source/svdde/ddeinf.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #define UNICODE diff --git a/svl/source/svdde/ddeml1.cxx b/svl/source/svdde/ddeml1.cxx index 6cc09b612ecf..bb9c428178b2 100644 --- a/svl/source/svdde/ddeml1.cxx +++ b/svl/source/svdde/ddeml1.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" /* ToDo / Bugs: diff --git a/svl/source/svdde/ddeml2.cxx b/svl/source/svdde/ddeml2.cxx index 979897136a46..e0cdee2d52d1 100644 --- a/svl/source/svdde/ddeml2.cxx +++ b/svl/source/svdde/ddeml2.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #define INCL_DOS #include diff --git a/svl/source/svdde/ddemldeb.cxx b/svl/source/svdde/ddemldeb.cxx index bb53743a2915..18da7c07fd3c 100644 --- a/svl/source/svdde/ddemldeb.cxx +++ b/svl/source/svdde/ddemldeb.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "ddemlimp.hxx" diff --git a/svl/source/svdde/ddestrg.cxx b/svl/source/svdde/ddestrg.cxx index 40af3b1cbc27..27e36162a187 100644 --- a/svl/source/svdde/ddestrg.cxx +++ b/svl/source/svdde/ddestrg.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #define UNICODE diff --git a/svl/source/svdde/ddesvr.cxx b/svl/source/svdde/ddesvr.cxx index a2124548b4c8..45461cf0006c 100644 --- a/svl/source/svdde/ddesvr.cxx +++ b/svl/source/svdde/ddesvr.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #define UNICODE #include "ddeimp.hxx" diff --git a/svl/source/svdde/ddewrap.cxx b/svl/source/svdde/ddewrap.cxx index b0b023ad3a75..650ec5b1b31f 100644 --- a/svl/source/svdde/ddewrap.cxx +++ b/svl/source/svdde/ddewrap.cxx @@ -30,7 +30,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #define _SVTOOLS_SVDDE_DDEWRAP_CXX_ #if defined _MSC_VER diff --git a/svl/source/svdde/makefile.mk b/svl/source/svdde/makefile.mk index f4c72aff2094..321a4b5ced03 100644 --- a/svl/source/svdde/makefile.mk +++ b/svl/source/svdde/makefile.mk @@ -34,13 +34,13 @@ PRJ=..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=svdde # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk +.INCLUDE : $(PRJ)$/util$/svl.pmk # --- Files -------------------------------------------------------- diff --git a/svl/source/svsql/converter.cxx b/svl/source/svsql/converter.cxx index c87290265e90..826b64adc48d 100644 --- a/svl/source/svsql/converter.cxx +++ b/svl/source/svsql/converter.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "converter.hxx" INT32 SvDbaseConverter::ConvertPrecisionToDbase(INT32 _nLen, INT32 _nScale) diff --git a/svl/source/svsql/converter.hxx b/svl/source/svsql/converter.hxx deleted file mode 100644 index f6a5d67ca966..000000000000 --- a/svl/source/svsql/converter.hxx +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: converter.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SV_CONVERTER_HXX_ -#define _SV_CONVERTER_HXX_ - -#include "svtools/svldllapi.h" -#include - -class SvDbaseConverter -{ -public: - SVL_DLLPUBLIC static INT32 ConvertPrecisionToDbase(INT32 _nLen, INT32 _nScale); - SVL_DLLPUBLIC static INT32 ConvertPrecisionToOdbc(INT32 _nLen, INT32 _nScale); -}; - -#endif //_CONVERTER_HXX_ - - - diff --git a/svl/source/svsql/makefile.mk b/svl/source/svsql/makefile.mk index 55c400b83ef3..ae3abf24db24 100644 --- a/svl/source/svsql/makefile.mk +++ b/svl/source/svsql/makefile.mk @@ -31,7 +31,7 @@ PRJ=..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=svsql # --- Settings ----------------------------------------------------- diff --git a/svl/source/syslocale/makefile.mk b/svl/source/syslocale/makefile.mk index a393c174856f..1bb619a69ec3 100644 --- a/svl/source/syslocale/makefile.mk +++ b/svl/source/syslocale/makefile.mk @@ -30,13 +30,13 @@ #************************************************************************* PRJ=..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=syslocale # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk +.INCLUDE : $(PRJ)$/util$/svl.pmk # --- Files -------------------------------------------------------- diff --git a/svl/source/syslocale/syslocale.cxx b/svl/source/syslocale/syslocale.cxx index 9811d97fd964..97db482f4409 100644 --- a/svl/source/syslocale/syslocale.cxx +++ b/svl/source/syslocale/syslocale.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif diff --git a/svl/source/undo/makefile.mk b/svl/source/undo/makefile.mk index b277fa3c906f..7c51df3f17fc 100644 --- a/svl/source/undo/makefile.mk +++ b/svl/source/undo/makefile.mk @@ -31,14 +31,14 @@ PRJ=..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=undo ENABLE_EXCEPTIONS=TRUE # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk +.INCLUDE : $(PRJ)$/util$/svl.pmk # --- Files -------------------------------------------------------- diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx index 2f733d4f03b3..49999834a8ff 100644 --- a/svl/source/undo/undo.cxx +++ b/svl/source/undo/undo.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include diff --git a/svl/source/uno/makefile.mk b/svl/source/uno/makefile.mk index 51e55a1f9123..af26b20cd8df 100644 --- a/svl/source/uno/makefile.mk +++ b/svl/source/uno/makefile.mk @@ -31,33 +31,20 @@ PRJ=..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=unoiface ENABLE_EXCEPTIONS=TRUE # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk +.INCLUDE : $(PRJ)$/util$/svl.pmk # --- Files -------------------------------------------------------- -SRS1NAME= uno -SRC1FILES= unoifac2.src - SLOFILES= \ - $(SLO)$/unoiface.obj \ - $(SLO)$/unoevent.obj \ - $(SLO)$/unoimap.obj \ - $(SLO)$/toolboxcontroller.obj \ - $(SLO)$/framestatuslistener.obj \ - $(SLO)$/statusbarcontroller.obj \ - $(SLO)$/genericunodialog.obj \ - $(SLO)$/generictoolboxcontroller.obj \ - $(SLO)$/treecontrolpeer.obj \ - $(SLO)$/unocontroltablemodel.obj \ $(SLO)$/registerservices.obj\ - $(SLO)$/contextmenuhelper.obj + $(SLO)$/pathservice.obj # --- Targets ------------------------------------------------------ diff --git a/svl/source/uno/pathservice.cxx b/svl/source/uno/pathservice.cxx new file mode 100644 index 000000000000..e54a96bf30ce --- /dev/null +++ b/svl/source/uno/pathservice.cxx @@ -0,0 +1,106 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: pathservice.cxx,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svl.hxx" + +#include +#include "sal/types.h" +#include "rtl/ustring.hxx" +#include +#include +#include + +namespace css = com::sun::star; +using rtl::OUString; + +// ----------------------------------------------------------------------- + +class PathService : public ::cppu::WeakImplHelper2< css::frame::XConfigManager, css::lang::XServiceInfo > +{ + SvtPathOptions m_aOptions; + +public: + PathService() + {} + + virtual OUString SAL_CALL getImplementationName() + throw(css::uno::RuntimeException) + { + return OUString::createFromAscii("com.sun.star.comp.svtools.PathService"); + } + + virtual sal_Bool SAL_CALL supportsService ( + const OUString & rName) + throw(css::uno::RuntimeException) + { + return (rName.compareToAscii("com.sun.star.config.SpecialConfigManager") == 0); + } + + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() + throw(css::uno::RuntimeException) + { + css::uno::Sequence< OUString > aRet(1); + aRet.getArray()[0] = OUString::createFromAscii("com.sun.star.config.SpecialConfigManager"); + return aRet; + } + + virtual OUString SAL_CALL substituteVariables ( + const OUString& sText) + throw(css::uno::RuntimeException) + { + return m_aOptions.SubstituteVariable( sText ); + } + + virtual void SAL_CALL addPropertyChangeListener ( + const OUString &, const css::uno::Reference< css::beans::XPropertyChangeListener > &) + throw(css::uno::RuntimeException) + {} + + virtual void SAL_CALL removePropertyChangeListener ( + const OUString &, const css::uno::Reference< css::beans::XPropertyChangeListener > &) + throw(css::uno::RuntimeException) + {} + + virtual void SAL_CALL flush() + throw(css::uno::RuntimeException) + {} +}; + +// ----------------------------------------------------------------------- + +css::uno::Reference< css::uno::XInterface > PathService_CreateInstance ( + const css::uno::Reference< css::lang::XMultiServiceFactory > &) +{ + return css::uno::Reference< css::uno::XInterface >( + static_cast< cppu::OWeakObject* >(new PathService())); +} + +// ----------------------------------------------------------------------- diff --git a/svl/source/uno/registerservices.cxx b/svl/source/uno/registerservices.cxx index a3e9f39c2dba..1f761123ae56 100644 --- a/svl/source/uno/registerservices.cxx +++ b/svl/source/uno/registerservices.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "sal/types.h" #include "rtl/ustring.hxx" #include @@ -49,6 +49,7 @@ using rtl::OUString; DECLARE_CREATEINSTANCE( SvNumberFormatterServiceObj ) DECLARE_CREATEINSTANCE( SvNumberFormatsSupplierServiceObject ) +DECLARE_CREATEINSTANCE( PathService ) // ------------------------------------------------------------------------------------- @@ -82,6 +83,11 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( xNewKey->createKey ( OUString::createFromAscii( "com.sun.star.util.NumberFormatter" ) ); + xNewKey = xRegistryKey->createKey( + OUString::createFromAscii( "/com.sun.star.comp.svtools.PathService/UNO/SERVICES" ) ); + xNewKey->createKey ( + OUString::createFromAscii( "com.sun.star.config.SpecialConfigManager" ) ); + return sal_True; } return sal_False; @@ -122,6 +128,18 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory ( SvNumberFormatterServiceObj_CreateInstance, aServiceNames); } + else if (rtl_str_compare ( + pImplementationName, "com.sun.star.comp.svtools.PathService") == 0) + { + Sequence< OUString > aServiceNames(1); + aServiceNames.getArray()[0] = + OUString::createFromAscii( "com.sun.star.config.SpecialConfigManager" ); + xFactory = ::cppu::createSingleFactory ( + reinterpret_cast< css::lang::XMultiServiceFactory* >( _pServiceManager ), + OUString::createFromAscii( pImplementationName ), + PathService_CreateInstance, + aServiceNames); + } if ( xFactory.is() ) { xFactory->acquire(); diff --git a/svl/uno/addrtempuno.cxx b/svl/uno/addrtempuno.cxx deleted file mode 100644 index b2aff7ae711d..000000000000 --- a/svl/uno/addrtempuno.cxx +++ /dev/null @@ -1,248 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: addrtempuno.cxx,v $ - * $Revision: 1.8 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include "svtools/genericunodialog.hxx" -#ifndef _SVT_DOC_ADDRESSTEMPLATE_HXX_ -#include "addresstemplate.hxx" -#endif -#ifndef _CPPUHELPER_EXTRACT_HXX_ -#include -#endif -#include -#include -#include - -class SfxItemSet; -class SfxItemPool; -class SfxPoolItem; - -// ....................................................................... -namespace svt -{ -// ....................................................................... - -#define UNODIALOG_PROPERTY_ID_ALIASES 100 -#define UNODIALOG_PROPERTY_ALIASES "FieldMapping" - - using namespace com::sun::star::uno; - using namespace com::sun::star::lang; - using namespace com::sun::star::util; - using namespace com::sun::star::beans; - using namespace com::sun::star::sdbc; - - //========================================================================= - //= OAddressBookSourceDialogUno - //========================================================================= - typedef OGenericUnoDialog OAddressBookSourceDialogUnoBase; - class OAddressBookSourceDialogUno - :public OAddressBookSourceDialogUnoBase - ,public ::comphelper::OPropertyArrayUsageHelper< OAddressBookSourceDialogUno > - { - protected: - Sequence< AliasProgrammaticPair > m_aAliases; - Reference< XDataSource > m_xDataSource; - ::rtl::OUString m_sDataSourceName; - ::rtl::OUString m_sTable; - - protected: - OAddressBookSourceDialogUno(const Reference< XMultiServiceFactory >& _rxORB); - - public: - // XTypeProvider - virtual Sequence SAL_CALL getImplementationId( ) throw(RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw(RuntimeException); - virtual ::comphelper::StringSequence SAL_CALL getSupportedServiceNames() throw(RuntimeException); - - // XServiceInfo - static methods - static Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( RuntimeException ); - static ::rtl::OUString getImplementationName_Static(void) throw( RuntimeException ); - static Reference< XInterface > - SAL_CALL Create(const Reference< com::sun::star::lang::XMultiServiceFactory >&); - - // XPropertySet - virtual Reference< XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(RuntimeException); - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; - - protected: - // OGenericUnoDialog overridables - virtual Dialog* createDialog(Window* _pParent); - - virtual void implInitialize(const com::sun::star::uno::Any& _rValue); - - virtual void executedDialog(sal_Int16 _nExecutionResult); - }; - - - //========================================================================= - //= OAddressBookSourceDialogUno - //========================================================================= - Reference< XInterface > SAL_CALL OAddressBookSourceDialogUno_CreateInstance( const Reference< XMultiServiceFactory >& _rxFactory) - { - return OAddressBookSourceDialogUno::Create(_rxFactory); - } - - //------------------------------------------------------------------------- - OAddressBookSourceDialogUno::OAddressBookSourceDialogUno(const Reference< XMultiServiceFactory >& _rxORB) - :OGenericUnoDialog(_rxORB) - { - registerProperty(::rtl::OUString::createFromAscii(UNODIALOG_PROPERTY_ALIASES), UNODIALOG_PROPERTY_ID_ALIASES, PropertyAttribute::READONLY, - &m_aAliases, getCppuType(&m_aAliases)); - } - - //------------------------------------------------------------------------- - Sequence SAL_CALL OAddressBookSourceDialogUno::getImplementationId( ) throw(RuntimeException) - { - static ::cppu::OImplementationId aId; - return aId.getImplementationId(); - } - - //------------------------------------------------------------------------- - Reference< XInterface > SAL_CALL OAddressBookSourceDialogUno::Create(const Reference< XMultiServiceFactory >& _rxFactory) - { - return *(new OAddressBookSourceDialogUno(_rxFactory)); - } - - //------------------------------------------------------------------------- - ::rtl::OUString SAL_CALL OAddressBookSourceDialogUno::getImplementationName() throw(RuntimeException) - { - return getImplementationName_Static(); - } - - //------------------------------------------------------------------------- - ::rtl::OUString OAddressBookSourceDialogUno::getImplementationName_Static() throw(RuntimeException) - { - return ::rtl::OUString::createFromAscii("com.sun.star.comp.svtools.OAddressBookSourceDialogUno"); - } - - //------------------------------------------------------------------------- - ::comphelper::StringSequence SAL_CALL OAddressBookSourceDialogUno::getSupportedServiceNames() throw(RuntimeException) - { - return getSupportedServiceNames_Static(); - } - - //------------------------------------------------------------------------- - ::comphelper::StringSequence OAddressBookSourceDialogUno::getSupportedServiceNames_Static() throw(RuntimeException) - { - ::comphelper::StringSequence aSupported(1); - aSupported.getArray()[0] = ::rtl::OUString::createFromAscii("com.sun.star.ui.AddressBookSourceDialog"); - return aSupported; - } - - //------------------------------------------------------------------------- - Reference SAL_CALL OAddressBookSourceDialogUno::getPropertySetInfo() throw(RuntimeException) - { - Reference xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; - } - - //------------------------------------------------------------------------- - ::cppu::IPropertyArrayHelper& OAddressBookSourceDialogUno::getInfoHelper() - { - return *const_cast(this)->getArrayHelper(); - } - - //------------------------------------------------------------------------------ - ::cppu::IPropertyArrayHelper* OAddressBookSourceDialogUno::createArrayHelper( ) const - { - Sequence< Property > aProps; - describeProperties(aProps); - return new ::cppu::OPropertyArrayHelper(aProps); - } - - //------------------------------------------------------------------------------ - void OAddressBookSourceDialogUno::executedDialog(sal_Int16 _nExecutionResult) - { - OAddressBookSourceDialogUnoBase::executedDialog(_nExecutionResult); - - if ( _nExecutionResult ) - if ( m_pDialog ) - static_cast< AddressBookSourceDialog* >( m_pDialog )->getFieldMapping( m_aAliases ); - } - - //------------------------------------------------------------------------------ - void OAddressBookSourceDialogUno::implInitialize(const com::sun::star::uno::Any& _rValue) - { - PropertyValue aVal; - if (_rValue >>= aVal) - { - if (0 == aVal.Name.compareToAscii("DataSource")) - { -#if OSL_DEBUG_LEVEL > 0 - sal_Bool bSuccess = -#endif - aVal.Value >>= m_xDataSource; - OSL_ENSURE( bSuccess, "OAddressBookSourceDialogUno::implInitialize: invalid type for DataSource!" ); - return; - } - - if (0 == aVal.Name.compareToAscii("DataSourceName")) - { -#if OSL_DEBUG_LEVEL > 0 - sal_Bool bSuccess = -#endif - aVal.Value >>= m_sDataSourceName; - OSL_ENSURE( bSuccess, "OAddressBookSourceDialogUno::implInitialize: invalid type for DataSourceName!" ); - return; - } - - if (0 == aVal.Name.compareToAscii("Command")) - { -#if OSL_DEBUG_LEVEL > 0 - sal_Bool bSuccess = -#endif - aVal.Value >>= m_sTable; - OSL_ENSURE( bSuccess, "OAddressBookSourceDialogUno::implInitialize: invalid type for Command!" ); - return; - } - } - - OAddressBookSourceDialogUnoBase::implInitialize( _rValue ); - } - - //------------------------------------------------------------------------------ - Dialog* OAddressBookSourceDialogUno::createDialog(Window* _pParent) - { - if ( m_xDataSource.is() && m_sTable.getLength() ) - return new AddressBookSourceDialog(_pParent, m_aContext.getLegacyServiceFactory(), m_xDataSource, m_sDataSourceName, m_sTable, m_aAliases ); - else - return new AddressBookSourceDialog( _pParent, m_aContext.getLegacyServiceFactory() ); - } - -// ....................................................................... -} // namespace svt -// ....................................................................... - diff --git a/svl/uno/exports.map b/svl/uno/exports.map deleted file mode 100644 index f4ed78b9e970..000000000000 --- a/svl/uno/exports.map +++ /dev/null @@ -1,8 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/svl/uno/makefile.mk b/svl/uno/makefile.mk deleted file mode 100644 index 8f61c7100508..000000000000 --- a/svl/uno/makefile.mk +++ /dev/null @@ -1,81 +0,0 @@ -#************************************************************************* -# -# 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 -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.4 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=.. -PRJNAME=svtools -TARGET=svtmisc.uno -LIBTARGET=NO -ENABLE_EXCEPTIONS=TRUE -VISIBILITY_HIDDEN=TRUE - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk -DLLPRE= - -# --- Files ------------------------------------- - -SLOFILES= \ - $(SLO)$/addrtempuno.obj \ - $(SLO)$/miscservices.obj \ - $(SLO)$/pathservice.obj - -SHL1TARGET= $(TARGET) -SHL1IMPLIB= i$(TARGET) - -SHL1OBJS= \ - $(SLO)$/svtdata.obj \ - $(SLOFILES) - -SHL1LIBS= \ - $(SLB)$/filter.uno.lib - -SHL1STDLIBS=\ - $(SVTOOLLIB) \ - $(TKLIB) \ - $(VCLLIB) \ - $(SVLLIB) \ - $(UNOTOOLSLIB) \ - $(TOOLSLIB) \ - $(COMPHELPERLIB) \ - $(VOSLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) - -SHL1VERSIONMAP=exports.map -SHL1DEF= $(MISC)$/$(SHL1TARGET).def -DEF1NAME= $(SHL1TARGET) - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - diff --git a/svl/uno/miscservices.cxx b/svl/uno/miscservices.cxx deleted file mode 100644 index e5c5aac3c35d..000000000000 --- a/svl/uno/miscservices.cxx +++ /dev/null @@ -1,160 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: miscservices.cxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include "sal/types.h" -#include "rtl/ustring.hxx" -#include -#include -#include -#include -#include - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::registry; -using namespace ::com::sun::star::lang; - -using rtl::OUString; - -// ------------------------------------------------------------------------------------- - -// for CreateInstance functions implemented elsewhere -#define DECLARE_CREATEINSTANCE( ImplName ) \ - Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& ); - -// for CreateInstance functions implemented elsewhere, while the function is within a namespace -#define DECLARE_CREATEINSTANCE_NAMESPACE( nmspe, ImplName ) \ - namespace nmspe { \ - Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& ); \ - } - -// ------------------------------------------------------------------------------------- - -DECLARE_CREATEINSTANCE_NAMESPACE( svt, OAddressBookSourceDialogUno ) -DECLARE_CREATEINSTANCE( SvFilterOptionsDialog ) -DECLARE_CREATEINSTANCE( PathService ) - -// ------------------------------------------------------------------------------------- - -extern "C" -{ - -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( - void * /* _pServiceManager */, void * _pRegistryKey ) -{ - if (_pRegistryKey) - { - Reference< XRegistryKey > xRegistryKey ( - reinterpret_cast< XRegistryKey* >( _pRegistryKey )); - Reference< XRegistryKey > xNewKey; - - xNewKey = xRegistryKey->createKey ( - OUString::createFromAscii( "/com.sun.star.comp.svtools.OAddressBookSourceDialogUno/UNO/SERVICES" ) ); - xNewKey->createKey( - OUString::createFromAscii( "com.sun.star.ui.AddressBookSourceDialog" ) ); - - xNewKey = xRegistryKey->createKey ( - OUString::createFromAscii( "/com.sun.star.svtools.SvFilterOptionsDialog/UNO/SERVICES" ) ); - xNewKey->createKey ( - OUString::createFromAscii( "com.sun.star.ui.dialogs.FilterOptionsDialog" ) ); - - xNewKey = xRegistryKey->createKey( - OUString::createFromAscii( "/com.sun.star.comp.svtools.PathService/UNO/SERVICES" ) ); - xNewKey->createKey ( - OUString::createFromAscii( "com.sun.star.config.SpecialConfigManager" ) ); - - return sal_True; - } - return sal_False; -} - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( - const sal_Char * pImplementationName, void * _pServiceManager, void * /* _pRegistryKey */) -{ - void * pResult = 0; - if ( _pServiceManager ) - { - Reference< XSingleServiceFactory > xFactory; - if (rtl_str_compare ( - pImplementationName, "com.sun.star.comp.svtools.OAddressBookSourceDialogUno") == 0) - { - Sequence< OUString > aServiceNames(1); - aServiceNames.getArray()[0] = - OUString::createFromAscii( "com.sun.star.ui.AddressBookSourceDialog" ); - - xFactory = ::cppu::createSingleFactory ( - reinterpret_cast< XMultiServiceFactory* >( _pServiceManager ), - OUString::createFromAscii( pImplementationName ), - svt::OAddressBookSourceDialogUno_CreateInstance, - aServiceNames); - } - else if (rtl_str_compare ( - pImplementationName, "com.sun.star.svtools.SvFilterOptionsDialog") == 0) - { - Sequence< OUString > aServiceNames(1); - aServiceNames.getArray()[0] = - OUString::createFromAscii( "com.sun.star.ui.dialogs.FilterOptionsDialog" ); - - xFactory = ::cppu::createSingleFactory ( - reinterpret_cast< XMultiServiceFactory* >( _pServiceManager ), - OUString::createFromAscii( pImplementationName ), - SvFilterOptionsDialog_CreateInstance, - aServiceNames); - } - else if (rtl_str_compare ( - pImplementationName, "com.sun.star.comp.svtools.PathService") == 0) - { - Sequence< OUString > aServiceNames(1); - aServiceNames.getArray()[0] = - OUString::createFromAscii( "com.sun.star.config.SpecialConfigManager" ); - xFactory = ::cppu::createSingleFactory ( - reinterpret_cast< XMultiServiceFactory* >( _pServiceManager ), - OUString::createFromAscii( pImplementationName ), - PathService_CreateInstance, - aServiceNames); - } - if ( xFactory.is() ) - { - xFactory->acquire(); - pResult = xFactory.get(); - } - } - return pResult; -} - -} // "C" - diff --git a/svl/uno/pathservice.cxx b/svl/uno/pathservice.cxx deleted file mode 100644 index 152ff5f316ab..000000000000 --- a/svl/uno/pathservice.cxx +++ /dev/null @@ -1,106 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: pathservice.cxx,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include -#include "sal/types.h" -#include "rtl/ustring.hxx" -#include -#include -#include - -namespace css = com::sun::star; -using rtl::OUString; - -// ----------------------------------------------------------------------- - -class PathService : public ::cppu::WeakImplHelper2< css::frame::XConfigManager, css::lang::XServiceInfo > -{ - SvtPathOptions m_aOptions; - -public: - PathService() - {} - - virtual OUString SAL_CALL getImplementationName() - throw(css::uno::RuntimeException) - { - return OUString::createFromAscii("com.sun.star.comp.svtools.PathService"); - } - - virtual sal_Bool SAL_CALL supportsService ( - const OUString & rName) - throw(css::uno::RuntimeException) - { - return (rName.compareToAscii("com.sun.star.config.SpecialConfigManager") == 0); - } - - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() - throw(css::uno::RuntimeException) - { - css::uno::Sequence< OUString > aRet(1); - aRet.getArray()[0] = OUString::createFromAscii("com.sun.star.config.SpecialConfigManager"); - return aRet; - } - - virtual OUString SAL_CALL substituteVariables ( - const OUString& sText) - throw(css::uno::RuntimeException) - { - return m_aOptions.SubstituteVariable( sText ); - } - - virtual void SAL_CALL addPropertyChangeListener ( - const OUString &, const css::uno::Reference< css::beans::XPropertyChangeListener > &) - throw(css::uno::RuntimeException) - {} - - virtual void SAL_CALL removePropertyChangeListener ( - const OUString &, const css::uno::Reference< css::beans::XPropertyChangeListener > &) - throw(css::uno::RuntimeException) - {} - - virtual void SAL_CALL flush() - throw(css::uno::RuntimeException) - {} -}; - -// ----------------------------------------------------------------------- - -css::uno::Reference< css::uno::XInterface > PathService_CreateInstance ( - const css::uno::Reference< css::lang::XMultiServiceFactory > &) -{ - return css::uno::Reference< css::uno::XInterface >( - static_cast< cppu::OWeakObject* >(new PathService())); -} - -// ----------------------------------------------------------------------- diff --git a/svl/unx/source/svdde/ddedummy.cxx b/svl/unx/source/svdde/ddedummy.cxx index 6f627807bfd3..aa1ccad80630 100644 --- a/svl/unx/source/svdde/ddedummy.cxx +++ b/svl/unx/source/svdde/ddedummy.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include #include diff --git a/svl/unx/source/svdde/makefile.mk b/svl/unx/source/svdde/makefile.mk index d0203fd6378b..c6e89eaf2630 100644 --- a/svl/unx/source/svdde/makefile.mk +++ b/svl/unx/source/svdde/makefile.mk @@ -31,13 +31,13 @@ PRJ=..$/..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=svdde # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk +.INCLUDE : $(PRJ)$/util$/svl.pmk # --- Files -------------------------------------------------------- diff --git a/svl/util/makefile.mk b/svl/util/makefile.mk index fac8f654bfbe..56f3d0bfed15 100644 --- a/svl/util/makefile.mk +++ b/svl/util/makefile.mk @@ -31,10 +31,8 @@ PRJ=.. -PRJNAME=svtools -TARGET=svtool -RESTARGET=svt -RESTARGETPATCH=svp +PRJNAME=svl +TARGET=svl RESTARGETSIMPLE=svs GEN_HID=TRUE GEN_HID_OTHER=TRUE @@ -44,152 +42,43 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk -USE_LDUMP2=TRUE - # --- general section ---------------------------------------------------- .IF "$(GUI)"!="UNX" -LIB3TARGET= $(LB)$/svtool.lib -LIB3FILES= $(LB)$/_svt.lib -.ENDIF - -.IF "$(GUI)"!="UNX" -LIB4TARGET= $(LB)$/isvl.lib -LIB4FILES= $(LB)$/_isvl.lib +LIB1TARGET= $(LB)$/isvl.lib +LIB1FILES= $(LB)$/_isvl.lib .ENDIF -LIB7TARGET= $(SLB)$/svt.lib -LIB7FILES= \ - $(SLB)$/misc.lib \ - $(SLB)$/items.lib \ - $(SLB)$/browse.lib \ - $(SLB)$/ctrl.lib \ - $(SLB)$/dialogs.lib \ - $(SLB)$/edit.lib \ - $(SLB)$/unoiface.lib \ - $(SLB)$/filter.lib \ - $(SLB)$/igif.lib \ - $(SLB)$/jpeg.lib \ - $(SLB)$/ixpm.lib \ - $(SLB)$/ixbm.lib \ - $(SLB)$/numbers.lib \ - $(SLB)$/numbers.uno.lib \ - $(SLB)$/wmf.lib \ - $(SLB)$/undo.lib \ - $(SLB)$/urlobj.lib \ - $(SLB)$/plugapp.lib \ - $(SLB)$/svcontnr.lib \ +LIB1TARGET= $(SLB)$/svl.lib +LIB1FILES= \ + $(SLB)$/config.lib \ $(SLB)$/syslocale.lib \ $(SLB)$/svdde.lib \ - $(SLB)$/svhtml.lib \ - $(SLB)$/svrtf.lib \ - $(SLB)$/config.lib \ - $(SLB)$/table.lib \ - $(SLB)$/java.lib - -LIB8TARGET= $(SLB)$/svl.lib -LIB8FILES= \ + $(SLB)$/undo.lib \ + $(SLB)$/numbers.lib \ + $(SLB)$/numbers.uno.lib \ $(SLB)$/filerec.lib \ $(SLB)$/filepicker.lib \ - $(SLB)$/items1.lib \ - $(SLB)$/misc1.lib \ + $(SLB)$/items.lib \ + $(SLB)$/misc.lib \ $(SLB)$/notify.lib \ $(SLB)$/svarray.lib \ $(SLB)$/svsql.lib # generation of resourcen-lib ---------------------------------------- -RESLIB1NAME= $(RESTARGET) -RESLIB1IMAGES=$(PRJ)$/res -RESLIB1SRSFILES= \ - $(SRS)$/filter.srs \ - $(SRS)$/misc.srs \ - $(SRS)$/ctrl.srs \ - $(SRS)$/dialogs.srs \ - $(SRS)$/plugapp.srs \ - $(SRS)$/svcontnr.srs \ - $(SRS)$/uno.srs \ - $(SRS)$/browse.srs \ - $(SRS)$/javaerror.srs - -RESLIB2NAME= $(RESTARGETSIMPLE) -RESLIB2SRSFILES=\ - $(SRS)$/items1.srs \ - $(SRS)$/misc1.srs - - -RESLIB3NAME= $(RESTARGETPATCH) -RESLIB3SRSFILES= \ - $(SRS)$/patchjavaerror.srs +RESLIB1NAME= $(RESTARGETSIMPLE) +RESLIB1SRSFILES=\ + $(SRS)$/items.srs \ + $(SRS)$/misc.srs # build the shared library -------------------------------------------------- -SHL1TARGET= svt$(DLLPOSTFIX) -SHL1IMPLIB= _svt +SHL1TARGET= svl$(DLLPOSTFIX) +SHL1IMPLIB= _isvl SHL1USE_EXPORTS=name - -.IF "$(OS)"!="MACOSX" -# static libraries -SHL1STDLIBS+= $(JPEG3RDLIB) -.ENDIF - -# dynamic libraries -SHL1STDLIBS+= \ - $(TKLIB) \ - $(VCLLIB) \ - $(SVLLIB) \ - $(SOTLIB) \ - $(UNOTOOLSLIB) \ - $(TOOLSLIB) \ - $(I18NISOLANGLIB) \ - $(I18NUTILLIB) \ - $(UCBHELPERLIB) \ - $(COMPHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(VOSLIB) \ - $(SALLIB) \ - $(ICUUCLIB) \ - $(JVMFWKLIB) - -.IF "$(OS)"=="MACOSX" -# static libraries go at end -SHL1STDLIBS+= $(JPEG3RDLIB) -.ENDIF - -.IF "$(GUI)"=="WNT" -SHL1STDLIBS+= \ - $(UWINAPILIB) \ - $(ADVAPI32LIB) \ - $(GDI32LIB) \ - $(OLE32LIB) \ - $(UUIDLIB) \ - $(ADVAPI32LIB) \ - $(OLEAUT32LIB) -.ENDIF # WNT - -SHL1OBJS= \ - $(SLO)$/svtdata.obj - -SHL1LIBS= \ - $(SLB)$/svt.lib - -SHL1DEF= $(MISC)$/$(SHL1TARGET).def -SHL1DEPN=$(SHL2TARGETN) - -DEF1NAME= $(SHL1TARGET) -DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt -DEFLIB1NAME =svt -DEF1DES =SvTools - - -# --- svtools lite -------------------------------------------------- - -SHL2TARGET= svl$(DLLPOSTFIX) -SHL2IMPLIB= _isvl -SHL2USE_EXPORTS=name #Do not link with VCL or any other library that links with VCL -SHL2STDLIBS= \ +SHL1STDLIBS= \ $(UNOTOOLSLIB) \ $(TOOLSLIB) \ $(I18NISOLANGLIB) \ @@ -202,57 +91,32 @@ SHL2STDLIBS= \ $(SALLIB) .IF "$(GUI)"=="WNT" -SHL2STDLIBS+= \ +SHL1STDLIBS+= \ $(UWINAPILIB) \ $(ADVAPI32LIB) \ $(GDI32LIB) .ENDIF # WNT -SHL2LIBS= $(SLB)$/svl.lib - -SHL2DEF= $(MISC)$/$(SHL2TARGET).def - -DEF2NAME= $(SHL2TARGET) -DEF2DEPN= $(MISC)$/$(SHL2TARGET).flt $(SLB)$/svl.lib -DEFLIB2NAME=svl -DEF2DES =SvTools lite +SHL1LIBS= $(SLB)$/svl.lib -# --- g2g application -------------------------------------------------- - -APP2TARGET = g2g -APP2BASE = 0x10000000 -APP2DEPN = $(SHL1TARGETN) $(SHL2TARGETN) - -APP2OBJS = $(OBJ)$/g2g.obj - -.IF "$(GUI)"!="UNX" -APP2STDLIBS+= $(SVTOOLLIB) -.ELSE -APP2STDLIBS+= -lsvt$(DLLPOSTFIX) -APP2STDLIBS+= -lsvl$(DLLPOSTFIX) -.ENDIF +SHL1DEF= $(MISC)$/$(SHL1TARGET).def -APP2STDLIBS+= $(VCLLIB) \ - $(TOOLSLIB) \ - $(VOSLIB) \ - $(SALLIB) +DEF1NAME= $(SHL1TARGET) +DEF1DEPN= $(SLB)$/svl.lib +DEFLIB1NAME=svl +DEF1DES =SvTools lite # --- Targets ------------------------------------------------------ .IF "$(GUI)"=="UNX" -SVTTARGETS= $(LB)$/lib$(SHL2TARGET)$(DLLPOST) $(LB)$/lib$(SHL1TARGET)$(DLLPOST) +SVTTARGETS= $(LB)$/lib$(SHL1TARGET)$(DLLPOST) .ELSE -SVTTARGETS= $(LB)$/isvl.lib \ - $(BIN)$/$(SHL2TARGET)$(DLLPOST) $(BIN)$/$(SHL1TARGET)$(DLLPOST) +SVTTARGETS= $(LB)$/isvl.lib .ENDIF # just a quick fix - has to be cleaned up some day... .IF "$(L10N-framework)"=="" ALL: $(SLB)$/svl.lib \ - $(SLB)$/svt.lib \ - $(MISC)$/$(SHL2TARGET).flt \ - $(MISC)$/$(SHL1TARGET).flt \ - $(MISC)$/$(SHL2TARGET).def \ $(MISC)$/$(SHL1TARGET).def \ $(SVTTARGETS) \ ALLTAR @@ -260,15 +124,3 @@ ALL: $(SLB)$/svl.lib \ .INCLUDE : target.mk -# --- Svtools-Control-Filter-Datei --- - -$(MISC)$/$(SHL1TARGET).flt: svt.flt - @echo ------------------------------ - @echo Making: $@ - $(TYPE) svt.flt >$@ - -$(MISC)$/$(SHL2TARGET).flt: svl.flt - @echo ------------------------------ - @echo Making: $@ - $(TYPE) svl.flt >$@ - diff --git a/svtools/source/uno/addrtempuno.cxx b/svtools/source/uno/addrtempuno.cxx new file mode 100644 index 000000000000..b2aff7ae711d --- /dev/null +++ b/svtools/source/uno/addrtempuno.cxx @@ -0,0 +1,248 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: addrtempuno.cxx,v $ + * $Revision: 1.8 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include "svtools/genericunodialog.hxx" +#ifndef _SVT_DOC_ADDRESSTEMPLATE_HXX_ +#include "addresstemplate.hxx" +#endif +#ifndef _CPPUHELPER_EXTRACT_HXX_ +#include +#endif +#include +#include +#include + +class SfxItemSet; +class SfxItemPool; +class SfxPoolItem; + +// ....................................................................... +namespace svt +{ +// ....................................................................... + +#define UNODIALOG_PROPERTY_ID_ALIASES 100 +#define UNODIALOG_PROPERTY_ALIASES "FieldMapping" + + using namespace com::sun::star::uno; + using namespace com::sun::star::lang; + using namespace com::sun::star::util; + using namespace com::sun::star::beans; + using namespace com::sun::star::sdbc; + + //========================================================================= + //= OAddressBookSourceDialogUno + //========================================================================= + typedef OGenericUnoDialog OAddressBookSourceDialogUnoBase; + class OAddressBookSourceDialogUno + :public OAddressBookSourceDialogUnoBase + ,public ::comphelper::OPropertyArrayUsageHelper< OAddressBookSourceDialogUno > + { + protected: + Sequence< AliasProgrammaticPair > m_aAliases; + Reference< XDataSource > m_xDataSource; + ::rtl::OUString m_sDataSourceName; + ::rtl::OUString m_sTable; + + protected: + OAddressBookSourceDialogUno(const Reference< XMultiServiceFactory >& _rxORB); + + public: + // XTypeProvider + virtual Sequence SAL_CALL getImplementationId( ) throw(RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(RuntimeException); + virtual ::comphelper::StringSequence SAL_CALL getSupportedServiceNames() throw(RuntimeException); + + // XServiceInfo - static methods + static Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( RuntimeException ); + static ::rtl::OUString getImplementationName_Static(void) throw( RuntimeException ); + static Reference< XInterface > + SAL_CALL Create(const Reference< com::sun::star::lang::XMultiServiceFactory >&); + + // XPropertySet + virtual Reference< XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(RuntimeException); + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + + protected: + // OGenericUnoDialog overridables + virtual Dialog* createDialog(Window* _pParent); + + virtual void implInitialize(const com::sun::star::uno::Any& _rValue); + + virtual void executedDialog(sal_Int16 _nExecutionResult); + }; + + + //========================================================================= + //= OAddressBookSourceDialogUno + //========================================================================= + Reference< XInterface > SAL_CALL OAddressBookSourceDialogUno_CreateInstance( const Reference< XMultiServiceFactory >& _rxFactory) + { + return OAddressBookSourceDialogUno::Create(_rxFactory); + } + + //------------------------------------------------------------------------- + OAddressBookSourceDialogUno::OAddressBookSourceDialogUno(const Reference< XMultiServiceFactory >& _rxORB) + :OGenericUnoDialog(_rxORB) + { + registerProperty(::rtl::OUString::createFromAscii(UNODIALOG_PROPERTY_ALIASES), UNODIALOG_PROPERTY_ID_ALIASES, PropertyAttribute::READONLY, + &m_aAliases, getCppuType(&m_aAliases)); + } + + //------------------------------------------------------------------------- + Sequence SAL_CALL OAddressBookSourceDialogUno::getImplementationId( ) throw(RuntimeException) + { + static ::cppu::OImplementationId aId; + return aId.getImplementationId(); + } + + //------------------------------------------------------------------------- + Reference< XInterface > SAL_CALL OAddressBookSourceDialogUno::Create(const Reference< XMultiServiceFactory >& _rxFactory) + { + return *(new OAddressBookSourceDialogUno(_rxFactory)); + } + + //------------------------------------------------------------------------- + ::rtl::OUString SAL_CALL OAddressBookSourceDialogUno::getImplementationName() throw(RuntimeException) + { + return getImplementationName_Static(); + } + + //------------------------------------------------------------------------- + ::rtl::OUString OAddressBookSourceDialogUno::getImplementationName_Static() throw(RuntimeException) + { + return ::rtl::OUString::createFromAscii("com.sun.star.comp.svtools.OAddressBookSourceDialogUno"); + } + + //------------------------------------------------------------------------- + ::comphelper::StringSequence SAL_CALL OAddressBookSourceDialogUno::getSupportedServiceNames() throw(RuntimeException) + { + return getSupportedServiceNames_Static(); + } + + //------------------------------------------------------------------------- + ::comphelper::StringSequence OAddressBookSourceDialogUno::getSupportedServiceNames_Static() throw(RuntimeException) + { + ::comphelper::StringSequence aSupported(1); + aSupported.getArray()[0] = ::rtl::OUString::createFromAscii("com.sun.star.ui.AddressBookSourceDialog"); + return aSupported; + } + + //------------------------------------------------------------------------- + Reference SAL_CALL OAddressBookSourceDialogUno::getPropertySetInfo() throw(RuntimeException) + { + Reference xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; + } + + //------------------------------------------------------------------------- + ::cppu::IPropertyArrayHelper& OAddressBookSourceDialogUno::getInfoHelper() + { + return *const_cast(this)->getArrayHelper(); + } + + //------------------------------------------------------------------------------ + ::cppu::IPropertyArrayHelper* OAddressBookSourceDialogUno::createArrayHelper( ) const + { + Sequence< Property > aProps; + describeProperties(aProps); + return new ::cppu::OPropertyArrayHelper(aProps); + } + + //------------------------------------------------------------------------------ + void OAddressBookSourceDialogUno::executedDialog(sal_Int16 _nExecutionResult) + { + OAddressBookSourceDialogUnoBase::executedDialog(_nExecutionResult); + + if ( _nExecutionResult ) + if ( m_pDialog ) + static_cast< AddressBookSourceDialog* >( m_pDialog )->getFieldMapping( m_aAliases ); + } + + //------------------------------------------------------------------------------ + void OAddressBookSourceDialogUno::implInitialize(const com::sun::star::uno::Any& _rValue) + { + PropertyValue aVal; + if (_rValue >>= aVal) + { + if (0 == aVal.Name.compareToAscii("DataSource")) + { +#if OSL_DEBUG_LEVEL > 0 + sal_Bool bSuccess = +#endif + aVal.Value >>= m_xDataSource; + OSL_ENSURE( bSuccess, "OAddressBookSourceDialogUno::implInitialize: invalid type for DataSource!" ); + return; + } + + if (0 == aVal.Name.compareToAscii("DataSourceName")) + { +#if OSL_DEBUG_LEVEL > 0 + sal_Bool bSuccess = +#endif + aVal.Value >>= m_sDataSourceName; + OSL_ENSURE( bSuccess, "OAddressBookSourceDialogUno::implInitialize: invalid type for DataSourceName!" ); + return; + } + + if (0 == aVal.Name.compareToAscii("Command")) + { +#if OSL_DEBUG_LEVEL > 0 + sal_Bool bSuccess = +#endif + aVal.Value >>= m_sTable; + OSL_ENSURE( bSuccess, "OAddressBookSourceDialogUno::implInitialize: invalid type for Command!" ); + return; + } + } + + OAddressBookSourceDialogUnoBase::implInitialize( _rValue ); + } + + //------------------------------------------------------------------------------ + Dialog* OAddressBookSourceDialogUno::createDialog(Window* _pParent) + { + if ( m_xDataSource.is() && m_sTable.getLength() ) + return new AddressBookSourceDialog(_pParent, m_aContext.getLegacyServiceFactory(), m_xDataSource, m_sDataSourceName, m_sTable, m_aAliases ); + else + return new AddressBookSourceDialog( _pParent, m_aContext.getLegacyServiceFactory() ); + } + +// ....................................................................... +} // namespace svt +// ....................................................................... + diff --git a/svtools/source/uno/makefile.mk b/svtools/source/uno/makefile.mk index 51e55a1f9123..47eaf4f25749 100644 --- a/svtools/source/uno/makefile.mk +++ b/svtools/source/uno/makefile.mk @@ -46,18 +46,19 @@ SRS1NAME= uno SRC1FILES= unoifac2.src SLOFILES= \ - $(SLO)$/unoiface.obj \ - $(SLO)$/unoevent.obj \ - $(SLO)$/unoimap.obj \ - $(SLO)$/toolboxcontroller.obj \ + $(SLO)$/adrtempuno.obj \ + $(SLO)$/contextmenuhelper.obj \ $(SLO)$/framestatuslistener.obj \ - $(SLO)$/statusbarcontroller.obj \ - $(SLO)$/genericunodialog.obj \ $(SLO)$/generictoolboxcontroller.obj \ + $(SLO)$/genericunodialog.obj \ + $(SLO)$/miscservices.obj\ + $(SLO)$/statusbarcontroller.obj \ + $(SLO)$/toolboxcontroller.obj \ $(SLO)$/treecontrolpeer.obj \ $(SLO)$/unocontroltablemodel.obj \ - $(SLO)$/registerservices.obj\ - $(SLO)$/contextmenuhelper.obj + $(SLO)$/unoevent.obj \ + $(SLO)$/unoiface.obj \ + $(SLO)$/unoimap.obj # --- Targets ------------------------------------------------------ diff --git a/svtools/source/uno/miscservices.cxx b/svtools/source/uno/miscservices.cxx new file mode 100644 index 000000000000..0f7b79720179 --- /dev/null +++ b/svtools/source/uno/miscservices.cxx @@ -0,0 +1,143 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: miscservices.cxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include "sal/types.h" +#include "rtl/ustring.hxx" +#include +#include +#include +#include +#include + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::registry; +using namespace ::com::sun::star::lang; + +using rtl::OUString; + +// ------------------------------------------------------------------------------------- + +// for CreateInstance functions implemented elsewhere +#define DECLARE_CREATEINSTANCE( ImplName ) \ + Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& ); + +// for CreateInstance functions implemented elsewhere, while the function is within a namespace +#define DECLARE_CREATEINSTANCE_NAMESPACE( nmspe, ImplName ) \ + namespace nmspe { \ + Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& ); \ + } + +// ------------------------------------------------------------------------------------- + +DECLARE_CREATEINSTANCE_NAMESPACE( svt, OAddressBookSourceDialogUno ) +DECLARE_CREATEINSTANCE( SvFilterOptionsDialog ) +DECLARE_CREATEINSTANCE( PathService ) + +// ------------------------------------------------------------------------------------- + +extern "C" +{ + +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( + const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( + void * /* _pServiceManager */, void * _pRegistryKey ) +{ + if (_pRegistryKey) + { + Reference< XRegistryKey > xRegistryKey ( + reinterpret_cast< XRegistryKey* >( _pRegistryKey )); + Reference< XRegistryKey > xNewKey; + + xNewKey = xRegistryKey->createKey ( + OUString::createFromAscii( "/com.sun.star.comp.svtools.OAddressBookSourceDialogUno/UNO/SERVICES" ) ); + xNewKey->createKey( + OUString::createFromAscii( "com.sun.star.ui.AddressBookSourceDialog" ) ); + + xNewKey = xRegistryKey->createKey ( + OUString::createFromAscii( "/com.sun.star.svtools.SvFilterOptionsDialog/UNO/SERVICES" ) ); + xNewKey->createKey ( + OUString::createFromAscii( "com.sun.star.ui.dialogs.FilterOptionsDialog" ) ); + + return sal_True; + } + return sal_False; +} + +SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( + const sal_Char * pImplementationName, void * _pServiceManager, void * /* _pRegistryKey */) +{ + void * pResult = 0; + if ( _pServiceManager ) + { + Reference< XSingleServiceFactory > xFactory; + if (rtl_str_compare ( + pImplementationName, "com.sun.star.comp.svtools.OAddressBookSourceDialogUno") == 0) + { + Sequence< OUString > aServiceNames(1); + aServiceNames.getArray()[0] = + OUString::createFromAscii( "com.sun.star.ui.AddressBookSourceDialog" ); + + xFactory = ::cppu::createSingleFactory ( + reinterpret_cast< XMultiServiceFactory* >( _pServiceManager ), + OUString::createFromAscii( pImplementationName ), + svt::OAddressBookSourceDialogUno_CreateInstance, + aServiceNames); + } + else if (rtl_str_compare ( + pImplementationName, "com.sun.star.svtools.SvFilterOptionsDialog") == 0) + { + Sequence< OUString > aServiceNames(1); + aServiceNames.getArray()[0] = + OUString::createFromAscii( "com.sun.star.ui.dialogs.FilterOptionsDialog" ); + + xFactory = ::cppu::createSingleFactory ( + reinterpret_cast< XMultiServiceFactory* >( _pServiceManager ), + OUString::createFromAscii( pImplementationName ), + SvFilterOptionsDialog_CreateInstance, + aServiceNames); + } + if ( xFactory.is() ) + { + xFactory->acquire(); + pResult = xFactory.get(); + } + } + return pResult; +} + +} // "C" + -- cgit From 80a5eff607808252c7fa7024793d445191d928a5 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Thu, 8 Oct 2009 16:59:48 +0200 Subject: #i103496#: make svl buildable with internal inc/svl directory --- svl/inc/PasswordHelper.hxx | 2 +- svl/inc/adrparse.hxx | 2 +- svl/inc/broadcast.hxx | 2 +- svl/inc/converter.hxx | 2 +- svl/inc/filenotation.hxx | 2 +- svl/inc/folderrestriction.hxx | 2 +- svl/inc/fstathelper.hxx | 2 +- svl/inc/instrm.hxx | 2 +- svl/inc/listener.hxx | 2 +- svl/inc/listeneriter.hxx | 2 +- svl/inc/lngmisc.hxx | 2 +- svl/inc/misccfg.hxx | 2 +- svl/inc/numuno.hxx | 2 +- svl/inc/outstrm.hxx | 2 +- svl/inc/pch/precompiled_svl.cxx | 2 +- svl/inc/pch/precompiled_svl.hxx | 2 +- svl/inc/pickerhelper.hxx | 2 +- svl/inc/pickerhistory.hxx | 2 +- svl/inc/pickerhistoryaccess.hxx | 2 +- svl/inc/poolcach.hxx | 2 +- svl/inc/strmadpt.hxx | 2 +- svl/inc/stylepool.hxx | 2 +- svl/inc/svl/aeitem.hxx | 6 ++--- svl/inc/svl/bintitem.hxx | 2 +- svl/inc/svl/brdcst.hxx | 4 ++-- svl/inc/svl/cancel.hxx | 8 +++---- svl/inc/svl/cenumitm.hxx | 4 ++-- svl/inc/svl/cintitem.hxx | 4 ++-- svl/inc/svl/cjkoptions.hxx | 2 +- svl/inc/svl/cnclhint.hxx | 4 ++-- svl/inc/svl/cntwall.hxx | 4 ++-- svl/inc/svl/cstitem.hxx | 2 +- svl/inc/svl/ctloptions.hxx | 6 ++--- svl/inc/svl/ctypeitm.hxx | 4 ++-- svl/inc/svl/custritm.hxx | 4 ++-- svl/inc/svl/dateitem.hxx | 2 +- svl/inc/svl/documentlockfile.hxx | 4 ++-- svl/inc/svl/dtritem.hxx | 2 +- svl/inc/svl/eitem.hxx | 4 ++-- svl/inc/svl/filerec.hxx | 4 ++-- svl/inc/svl/flagitem.hxx | 4 ++-- svl/inc/svl/frqitem.hxx | 2 +- svl/inc/svl/globalnameitem.hxx | 4 ++-- svl/inc/svl/hint.hxx | 2 +- svl/inc/svl/httpcook.hxx | 2 +- svl/inc/svl/ilstitem.hxx | 4 ++-- svl/inc/svl/imageitm.hxx | 4 ++-- svl/inc/svl/inethist.hxx | 6 ++--- svl/inc/svl/inettype.hxx | 2 +- svl/inc/svl/intitem.hxx | 4 ++-- svl/inc/svl/isethint.hxx | 4 ++-- svl/inc/svl/itemiter.hxx | 4 ++-- svl/inc/svl/itempool.hxx | 6 ++--- svl/inc/svl/itemprop.hxx | 4 ++-- svl/inc/svl/itemset.hxx | 4 ++-- svl/inc/svl/languageoptions.hxx | 6 ++--- svl/inc/svl/lckbitem.hxx | 4 ++-- svl/inc/svl/lockfilecommon.hxx | 2 +- svl/inc/svl/lstner.hxx | 4 ++-- svl/inc/svl/macitem.hxx | 4 ++-- svl/inc/svl/metitem.hxx | 4 ++-- svl/inc/svl/nranges.hxx | 4 ++-- svl/inc/svl/ondemand.hxx | 2 +- svl/inc/svl/ownlist.hxx | 2 +- svl/inc/svl/poolitem.hxx | 6 ++--- svl/inc/svl/ptitem.hxx | 4 ++-- svl/inc/svl/rectitem.hxx | 4 ++-- svl/inc/svl/restrictedpaths.hxx | 4 ++-- svl/inc/svl/rngitem.hxx | 8 +++---- svl/inc/svl/sfontitm.hxx | 2 +- svl/inc/svl/sharecontrolfile.hxx | 4 ++-- svl/inc/svl/slstitm.hxx | 4 ++-- svl/inc/svl/smplhint.hxx | 4 ++-- svl/inc/svl/stritem.hxx | 4 ++-- svl/inc/svl/style.hxx | 12 +++++----- svl/inc/svl/svarray.hxx | 2 +- svl/inc/svl/svdde.hxx | 2 +- svl/inc/svl/svstdarr.hxx | 4 ++-- svl/inc/svl/svtools.hrc | 2 +- svl/inc/svl/syslocale.hxx | 2 +- svl/inc/svl/syslocaleoptions.hxx | 2 +- svl/inc/svl/szitem.hxx | 2 +- svl/inc/svl/tfrmitem.hxx | 2 +- svl/inc/svl/tresitem.hxx | 2 +- svl/inc/svl/undo.hxx | 4 ++-- svl/inc/svl/visitem.hxx | 4 ++-- svl/inc/svl/zforlist.hxx | 8 +++---- svl/inc/svl/zformat.hxx | 8 +++---- svl/inc/urihelper.hxx | 2 +- svl/inc/whiter.hxx | 2 +- svl/qa/complex/ConfigItems/CheckConfigItems.java | 2 +- .../ConfigItems/helper/AccessibilityOptTest.hxx | 2 +- .../complex/ConfigItems/helper/ConfigItemTest.cxx | 12 +++++----- svl/qa/complex/ConfigItems/helper/PrintOptTest.hxx | 2 +- svl/source/config/cjkoptions.cxx | 4 ++-- svl/source/config/ctloptions.cxx | 6 ++--- svl/source/config/itemholder2.cxx | 10 ++++----- svl/source/config/languageoptions.cxx | 6 ++--- svl/source/config/misccfg.cxx | 4 ++-- svl/source/config/syslocaleoptions.cxx | 8 +++---- svl/source/filerec/filerec.cxx | 2 +- svl/source/inc/poolio.hxx | 2 +- svl/source/items/aeitem.cxx | 6 ++--- svl/source/items/bintitem.cxx | 2 +- svl/source/items/cenumitm.cxx | 2 +- svl/source/items/cintitem.cxx | 2 +- svl/source/items/cntwall.cxx | 2 +- svl/source/items/cstitem.cxx | 6 ++--- svl/source/items/cstitem.src | 2 +- svl/source/items/ctypeitm.cxx | 2 +- svl/source/items/custritm.cxx | 2 +- svl/source/items/dateitem.cxx | 6 ++--- svl/source/items/dtritem.cxx | 2 +- svl/source/items/eitem.cxx | 2 +- svl/source/items/flagitem.cxx | 4 ++-- svl/source/items/frqitem.cxx | 2 +- svl/source/items/globalnameitem.cxx | 2 +- svl/source/items/ilstitem.cxx | 4 ++-- svl/source/items/imageitm.cxx | 2 +- svl/source/items/intitem.cxx | 4 ++-- svl/source/items/itemiter.cxx | 6 ++--- svl/source/items/itempool.cxx | 6 ++--- svl/source/items/itemprop.cxx | 6 ++--- svl/source/items/itemset.cxx | 10 ++++----- svl/source/items/lckbitem.cxx | 4 ++-- svl/source/items/macitem.cxx | 2 +- svl/source/items/poolcach.cxx | 4 ++-- svl/source/items/poolio.cxx | 8 +++---- svl/source/items/poolitem.cxx | 2 +- svl/source/items/ptitem.cxx | 4 ++-- svl/source/items/rectitem.cxx | 4 ++-- svl/source/items/rngitem.cxx | 4 ++-- svl/source/items/sfontitm.cxx | 2 +- svl/source/items/sitem.cxx | 4 ++-- svl/source/items/slstitm.cxx | 4 ++-- svl/source/items/stritem.cxx | 2 +- svl/source/items/style.cxx | 26 +++++++++++----------- svl/source/items/stylepool.cxx | 4 ++-- svl/source/items/szitem.cxx | 4 ++-- svl/source/items/tfrmitem.cxx | 2 +- svl/source/items/tresitem.cxx | 2 +- svl/source/items/visitem.cxx | 2 +- svl/source/items/whiter.cxx | 2 +- svl/source/memtools/svarray.cxx | 2 +- svl/source/misc/adrparse.cxx | 6 ++--- svl/source/misc/documentlockfile.cxx | 2 +- svl/source/misc/flbytes.cxx | 6 ++--- svl/source/misc/inethist.cxx | 2 +- svl/source/misc/inettype.cxx | 16 ++++++------- svl/source/misc/lockfilecommon.cxx | 2 +- svl/source/misc/mediatyp.src | 2 +- svl/source/misc/ownlist.cxx | 2 +- svl/source/misc/restrictedpaths.cxx | 4 ++-- svl/source/misc/sharecontrolfile.cxx | 2 +- svl/source/misc/svldata.cxx | 2 +- svl/source/misc/urihelper.cxx | 8 +++---- svl/source/notify/brdcst.cxx | 8 +++---- svl/source/notify/broadcast.cxx | 2 +- svl/source/notify/cancel.cxx | 6 ++--- svl/source/notify/hint.cxx | 2 +- svl/source/notify/isethint.cxx | 4 ++-- svl/source/notify/lstner.cxx | 6 ++--- svl/source/notify/smplhint.cxx | 2 +- svl/source/numbers/numfmuno.cxx | 6 ++--- svl/source/numbers/numuno.cxx | 2 +- svl/source/numbers/supservs.hxx | 2 +- svl/source/numbers/zforfind.cxx | 4 ++-- svl/source/numbers/zforlist.cxx | 16 ++++++------- svl/source/numbers/zformat.cxx | 4 ++-- svl/source/numbers/zforscan.cxx | 4 ++-- svl/source/numbers/zforscan.hxx | 2 +- svl/source/passwordcontainer/passwordcontainer.cxx | 4 ++-- svl/source/passwordcontainer/syscreds.cxx | 4 ++-- svl/source/svdde/ddecli.cxx | 2 +- svl/source/svdde/ddedata.cxx | 2 +- svl/source/svdde/ddeinf.cxx | 2 +- svl/source/svdde/ddestrg.cxx | 2 +- svl/source/svdde/ddesvr.cxx | 4 ++-- svl/source/syslocale/syslocale.cxx | 8 +++---- svl/source/undo/undo.cxx | 16 ++++++------- svl/source/uno/pathservice.cxx | 2 +- svl/source/uno/registerservices.cxx | 4 ++-- svl/unx/source/svdde/ddedummy.cxx | 2 +- 183 files changed, 356 insertions(+), 356 deletions(-) diff --git a/svl/inc/PasswordHelper.hxx b/svl/inc/PasswordHelper.hxx index 7139a3ebe361..c915ebe3854a 100644 --- a/svl/inc/PasswordHelper.hxx +++ b/svl/inc/PasswordHelper.hxx @@ -31,7 +31,7 @@ #ifndef _SVTOOLS_PASSWORDHELPER_HXX #define _SVTOOLS_PASSWORDHELPER_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include "sal/types.h" #include "com/sun/star/uno/Sequence.hxx" diff --git a/svl/inc/adrparse.hxx b/svl/inc/adrparse.hxx index 439168441057..a317e27b2779 100644 --- a/svl/inc/adrparse.hxx +++ b/svl/inc/adrparse.hxx @@ -31,7 +31,7 @@ #ifndef _ADRPARSE_HXX #define _ADRPARSE_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #include diff --git a/svl/inc/broadcast.hxx b/svl/inc/broadcast.hxx index e3e409c46e96..e80a2e446ebf 100644 --- a/svl/inc/broadcast.hxx +++ b/svl/inc/broadcast.hxx @@ -30,7 +30,7 @@ #ifndef _SVT_BROADCAST_HXX #define _SVT_BROADCAST_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include class SvtListener; diff --git a/svl/inc/converter.hxx b/svl/inc/converter.hxx index f6a5d67ca966..d012a56e7416 100644 --- a/svl/inc/converter.hxx +++ b/svl/inc/converter.hxx @@ -30,7 +30,7 @@ #ifndef _SV_CONVERTER_HXX_ #define _SV_CONVERTER_HXX_ -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include class SvDbaseConverter diff --git a/svl/inc/filenotation.hxx b/svl/inc/filenotation.hxx index 460d425d471a..c74c6c39c803 100644 --- a/svl/inc/filenotation.hxx +++ b/svl/inc/filenotation.hxx @@ -31,7 +31,7 @@ #ifndef SVTOOLS_FILENOTATION_HXX #define SVTOOLS_FILENOTATION_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include //......................................................................... diff --git a/svl/inc/folderrestriction.hxx b/svl/inc/folderrestriction.hxx index f7e683b31ad6..82fb4e1efef5 100644 --- a/svl/inc/folderrestriction.hxx +++ b/svl/inc/folderrestriction.hxx @@ -31,7 +31,7 @@ #ifndef SVTOOLS_FOLDER_RESTRICTION_HXX #define SVTOOLS_FOLDER_RESTRICTION_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #ifndef INCLUDED_VECTOR diff --git a/svl/inc/fstathelper.hxx b/svl/inc/fstathelper.hxx index b9761d7131a0..1e613782b4e6 100644 --- a/svl/inc/fstathelper.hxx +++ b/svl/inc/fstathelper.hxx @@ -31,7 +31,7 @@ #ifndef _SVTOOLS_FSTATHELPER_HXX #define _SVTOOLS_FSTATHELPER_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include class UniString; diff --git a/svl/inc/instrm.hxx b/svl/inc/instrm.hxx index 58a70fcc6917..add43d4cc380 100644 --- a/svl/inc/instrm.hxx +++ b/svl/inc/instrm.hxx @@ -31,7 +31,7 @@ #ifndef SVTOOLS_INSTRM_HXX #define SVTOOLS_INSTRM_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #include diff --git a/svl/inc/listener.hxx b/svl/inc/listener.hxx index 6d70f135eb92..a121197b1dd0 100644 --- a/svl/inc/listener.hxx +++ b/svl/inc/listener.hxx @@ -30,7 +30,7 @@ #ifndef _SVT_LISTENER_HXX #define _SVT_LISTENER_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include class SvtBroadcaster; diff --git a/svl/inc/listeneriter.hxx b/svl/inc/listeneriter.hxx index e531ead6bf5d..a2ac5693f741 100644 --- a/svl/inc/listeneriter.hxx +++ b/svl/inc/listeneriter.hxx @@ -30,7 +30,7 @@ #ifndef _SVT_LISTENERITER_HXX #define _SVT_LISTENERITER_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include class SvtListener; diff --git a/svl/inc/lngmisc.hxx b/svl/inc/lngmisc.hxx index 6bfe7b1c737c..55322246f773 100644 --- a/svl/inc/lngmisc.hxx +++ b/svl/inc/lngmisc.hxx @@ -31,7 +31,7 @@ #ifndef _SVTOOLS_LNGMISC_HXX_ #define _SVTOOLS_LNGMISC_HXX_ -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #include #include diff --git a/svl/inc/misccfg.hxx b/svl/inc/misccfg.hxx index 9689b04cef89..7b89361b7390 100644 --- a/svl/inc/misccfg.hxx +++ b/svl/inc/misccfg.hxx @@ -30,7 +30,7 @@ #ifndef _SFX_MISCCFG_HXX #define _SFX_MISCCFG_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include "tools/solar.h" #include "unotools/configitem.hxx" diff --git a/svl/inc/numuno.hxx b/svl/inc/numuno.hxx index d6f5621246fd..d243c49a3113 100644 --- a/svl/inc/numuno.hxx +++ b/svl/inc/numuno.hxx @@ -30,7 +30,7 @@ #ifndef _NUMUNO_HXX #define _NUMUNO_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #include #include diff --git a/svl/inc/outstrm.hxx b/svl/inc/outstrm.hxx index e11c7ed1c1a9..c01d8f460c58 100644 --- a/svl/inc/outstrm.hxx +++ b/svl/inc/outstrm.hxx @@ -31,7 +31,7 @@ #ifndef SVTOOLS_OUTSTRM_HXX #define SVTOOLS_OUTSTRM_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #include diff --git a/svl/inc/pch/precompiled_svl.cxx b/svl/inc/pch/precompiled_svl.cxx index da41b68a5eae..27b37170856c 100644 --- a/svl/inc/pch/precompiled_svl.cxx +++ b/svl/inc/pch/precompiled_svl.cxx @@ -6,7 +6,7 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: precompiled_svtools.cxx,v $ + * $RCSfile: precompiled_svl.cxx,v $ * $Revision: 1.3 $ * * This file is part of OpenOffice.org. diff --git a/svl/inc/pch/precompiled_svl.hxx b/svl/inc/pch/precompiled_svl.hxx index b41e2ca89fc6..3a813a2db2dd 100644 --- a/svl/inc/pch/precompiled_svl.hxx +++ b/svl/inc/pch/precompiled_svl.hxx @@ -6,7 +6,7 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: precompiled_svtools.hxx,v $ + * $RCSfile: precompiled_svl.hxx,v $ * $Revision: 1.4 $ * * This file is part of OpenOffice.org. diff --git a/svl/inc/pickerhelper.hxx b/svl/inc/pickerhelper.hxx index 4be84296c678..e8ef23e145d4 100644 --- a/svl/inc/pickerhelper.hxx +++ b/svl/inc/pickerhelper.hxx @@ -31,7 +31,7 @@ #ifndef _PICKERHELPER_HXX #define _PICKERHELPER_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include "sal/types.h" #include "com/sun/star/uno/Reference.hxx" diff --git a/svl/inc/pickerhistory.hxx b/svl/inc/pickerhistory.hxx index f99ad5dcc0f1..e67729a1bbd8 100644 --- a/svl/inc/pickerhistory.hxx +++ b/svl/inc/pickerhistory.hxx @@ -31,7 +31,7 @@ #ifndef SVTOOLS_PICKERHISTORY_HXX #define SVTOOLS_PICKERHISTORY_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include //......................................................................... diff --git a/svl/inc/pickerhistoryaccess.hxx b/svl/inc/pickerhistoryaccess.hxx index 983b0c416ef3..210fd9b92139 100644 --- a/svl/inc/pickerhistoryaccess.hxx +++ b/svl/inc/pickerhistoryaccess.hxx @@ -31,7 +31,7 @@ #ifndef SVTOOLS_PICKERHISTORYACCESS_HXX #define SVTOOLS_PICKERHISTORYACCESS_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #ifndef _COM_SUN_STAR_UNO_REFERENX_HXX_ #include diff --git a/svl/inc/poolcach.hxx b/svl/inc/poolcach.hxx index 8e7cf3ddbfa7..21cfec4662a0 100644 --- a/svl/inc/poolcach.hxx +++ b/svl/inc/poolcach.hxx @@ -30,7 +30,7 @@ #ifndef _SFXPOOLCACH_HXX #define _SFXPOOLCACH_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include class SfxItemModifyArr_Impl; diff --git a/svl/inc/strmadpt.hxx b/svl/inc/strmadpt.hxx index 7a080c1c7bcc..2fd190f9adef 100644 --- a/svl/inc/strmadpt.hxx +++ b/svl/inc/strmadpt.hxx @@ -31,7 +31,7 @@ #ifndef SVTOOLS_STRMADPT_HXX #define SVTOOLS_STRMADPT_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #include #include diff --git a/svl/inc/stylepool.hxx b/svl/inc/stylepool.hxx index 1b1f129d7f4c..d69bb928e432 100644 --- a/svl/inc/stylepool.hxx +++ b/svl/inc/stylepool.hxx @@ -32,7 +32,7 @@ #include #include -#include +#include class StylePoolImpl; class StylePoolIterImpl; diff --git a/svl/inc/svl/aeitem.hxx b/svl/inc/svl/aeitem.hxx index e10b3f7a8e70..446d9b8aeeb7 100644 --- a/svl/inc/svl/aeitem.hxx +++ b/svl/inc/svl/aeitem.hxx @@ -30,9 +30,9 @@ #ifndef _AEITEM_HXX #define _AEITEM_HXX -#include "svtools/svldllapi.h" -#include -#include +#include "svl/svldllapi.h" +#include +#include class SfxAllEnumValueArr; class SvUShorts; diff --git a/svl/inc/svl/bintitem.hxx b/svl/inc/svl/bintitem.hxx index 83119d9f3b18..4c969c0a29c7 100644 --- a/svl/inc/svl/bintitem.hxx +++ b/svl/inc/svl/bintitem.hxx @@ -36,7 +36,7 @@ #include #include -#include +#include class SfxArguments; class SvStream; diff --git a/svl/inc/svl/brdcst.hxx b/svl/inc/svl/brdcst.hxx index 2f9270f3cd4b..cfa45d5aa89a 100644 --- a/svl/inc/svl/brdcst.hxx +++ b/svl/inc/svl/brdcst.hxx @@ -30,9 +30,9 @@ #ifndef _SFXBRDCST_HXX #define _SFXBRDCST_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include -#include +#include class SfxListener; class SfxHint; diff --git a/svl/inc/svl/cancel.hxx b/svl/inc/svl/cancel.hxx index 5929fc4db47a..2808b77d3139 100644 --- a/svl/inc/svl/cancel.hxx +++ b/svl/inc/svl/cancel.hxx @@ -30,16 +30,16 @@ #ifndef _SFXCANCEL_HXX #define _SFXCANCEL_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #include -#include -#include +#include +#include class SfxCancellable; #ifdef _SFX_CANCEL_CXX -#include +#include SV_DECL_PTRARR( SfxCancellables_Impl, SfxCancellable*, 0, 4 ) diff --git a/svl/inc/svl/cenumitm.hxx b/svl/inc/svl/cenumitm.hxx index d65825849869..3d354899cd9d 100644 --- a/svl/inc/svl/cenumitm.hxx +++ b/svl/inc/svl/cenumitm.hxx @@ -31,9 +31,9 @@ #ifndef _SVTOOLS_CENUMITM_HXX #define _SVTOOLS_CENUMITM_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include -#include +#include //============================================================================ DBG_NAMEEX(SfxEnumItemInterface) diff --git a/svl/inc/svl/cintitem.hxx b/svl/inc/svl/cintitem.hxx index a944e2139818..72421f93e0cb 100644 --- a/svl/inc/svl/cintitem.hxx +++ b/svl/inc/svl/cintitem.hxx @@ -31,9 +31,9 @@ #ifndef _SVTOOLS_CINTITEM_HXX #define _SVTOOLS_CINTITEM_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include -#include +#include //============================================================================ DBG_NAMEEX_VISIBILITY(CntByteItem, SVL_DLLPUBLIC) diff --git a/svl/inc/svl/cjkoptions.hxx b/svl/inc/svl/cjkoptions.hxx index 03a4e0216e82..720ead5422f0 100644 --- a/svl/inc/svl/cjkoptions.hxx +++ b/svl/inc/svl/cjkoptions.hxx @@ -30,7 +30,7 @@ #ifndef _SVTOOLS_CJKOPTIONS_HXX #define _SVTOOLS_CJKOPTIONS_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #include diff --git a/svl/inc/svl/cnclhint.hxx b/svl/inc/svl/cnclhint.hxx index 38781a6c2143..a2ce75ac1a4b 100644 --- a/svl/inc/svl/cnclhint.hxx +++ b/svl/inc/svl/cnclhint.hxx @@ -30,8 +30,8 @@ #ifndef _SFXCNCLHINT_HXX #define _SFXCNCLHINT_HXX -#include -#include +#include +#include #include #define SFXCANCELHINT_REMOVED 1 diff --git a/svl/inc/svl/cntwall.hxx b/svl/inc/svl/cntwall.hxx index 51b2982fe1dd..dca27f2284e6 100644 --- a/svl/inc/svl/cntwall.hxx +++ b/svl/inc/svl/cntwall.hxx @@ -30,14 +30,14 @@ #ifndef _CNTWALL_HXX #define _CNTWALL_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #ifndef SHL_HXX #include #endif #include #include -#include +#include class SvStream; diff --git a/svl/inc/svl/cstitem.hxx b/svl/inc/svl/cstitem.hxx index 654ee9c15a75..001731d68b41 100644 --- a/svl/inc/svl/cstitem.hxx +++ b/svl/inc/svl/cstitem.hxx @@ -33,7 +33,7 @@ #include -#include +#include class SvStream; diff --git a/svl/inc/svl/ctloptions.hxx b/svl/inc/svl/ctloptions.hxx index fae5e13dfbb8..10fc4bb98446 100644 --- a/svl/inc/svl/ctloptions.hxx +++ b/svl/inc/svl/ctloptions.hxx @@ -30,10 +30,10 @@ #ifndef _SVTOOLS_CTLOPTIONS_HXX #define _SVTOOLS_CTLOPTIONS_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include -#include -#include +#include +#include #include class SvtCTLOptions_Impl; diff --git a/svl/inc/svl/ctypeitm.hxx b/svl/inc/svl/ctypeitm.hxx index 2592c6e0f388..808596397aa0 100644 --- a/svl/inc/svl/ctypeitm.hxx +++ b/svl/inc/svl/ctypeitm.hxx @@ -30,8 +30,8 @@ #ifndef _SVTOOLS_CTYPEITM_HXX #define _SVTOOLS_CTYPEITM_HXX -#include -#include +#include +#include //========================================================================= diff --git a/svl/inc/svl/custritm.hxx b/svl/inc/svl/custritm.hxx index 83a88b1f240f..8a3344f6dc0b 100644 --- a/svl/inc/svl/custritm.hxx +++ b/svl/inc/svl/custritm.hxx @@ -31,9 +31,9 @@ #ifndef _SVTOOLS_CUSTRITM_HXX #define _SVTOOLS_CUSTRITM_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include -#include +#include //============================================================================ DBG_NAMEEX_VISIBILITY(CntUnencodedStringItem, SVL_DLLPUBLIC) diff --git a/svl/inc/svl/dateitem.hxx b/svl/inc/svl/dateitem.hxx index 073c1a6ef825..c66c9a84285d 100644 --- a/svl/inc/svl/dateitem.hxx +++ b/svl/inc/svl/dateitem.hxx @@ -33,7 +33,7 @@ #include #include -#include +#include class SvStream; diff --git a/svl/inc/svl/documentlockfile.hxx b/svl/inc/svl/documentlockfile.hxx index 91074908cf8a..c62f81bc77ef 100644 --- a/svl/inc/svl/documentlockfile.hxx +++ b/svl/inc/svl/documentlockfile.hxx @@ -32,7 +32,7 @@ #ifndef _SVT_DOCUMENTLOCKFILE_HXX #define _SVT_DOCUMENTLOCKFILE_HXX -#include +#include #include #include @@ -41,7 +41,7 @@ #include #include -#include +#include namespace svt { diff --git a/svl/inc/svl/dtritem.hxx b/svl/inc/svl/dtritem.hxx index 87666a306a43..406cc5ee6af1 100644 --- a/svl/inc/svl/dtritem.hxx +++ b/svl/inc/svl/dtritem.hxx @@ -34,7 +34,7 @@ #include #include -#include +#include class SvStream; diff --git a/svl/inc/svl/eitem.hxx b/svl/inc/svl/eitem.hxx index 1a9aa8fd63a0..55ed3c47ee33 100644 --- a/svl/inc/svl/eitem.hxx +++ b/svl/inc/svl/eitem.hxx @@ -31,8 +31,8 @@ #ifndef _SFXENUMITEM_HXX #define _SFXENUMITEM_HXX -#include "svtools/svldllapi.h" -#include +#include "svl/svldllapi.h" +#include //============================================================================ class SVL_DLLPUBLIC SfxEnumItem: public CntEnumItem diff --git a/svl/inc/svl/filerec.hxx b/svl/inc/svl/filerec.hxx index 77ba6c1b5c52..d28bb3033b56 100644 --- a/svl/inc/svl/filerec.hxx +++ b/svl/inc/svl/filerec.hxx @@ -33,10 +33,10 @@ //========================================================================= -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #include -#include +#include SV_DECL_VARARR( SfxUINT32s, UINT32, 8, 8 ) diff --git a/svl/inc/svl/flagitem.hxx b/svl/inc/svl/flagitem.hxx index 1ea04db955c5..fa056bb00488 100644 --- a/svl/inc/svl/flagitem.hxx +++ b/svl/inc/svl/flagitem.hxx @@ -30,10 +30,10 @@ #ifndef _SFXFLAGITEM_HXX #define _SFXFLAGITEM_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #include -#include +#include class SvStream; diff --git a/svl/inc/svl/frqitem.hxx b/svl/inc/svl/frqitem.hxx index 11b2d31a1123..8d11c20610e2 100644 --- a/svl/inc/svl/frqitem.hxx +++ b/svl/inc/svl/frqitem.hxx @@ -36,7 +36,7 @@ #include #include -#include +#include class SvStream; diff --git a/svl/inc/svl/globalnameitem.hxx b/svl/inc/svl/globalnameitem.hxx index 7e01d3487d95..4422220fe640 100644 --- a/svl/inc/svl/globalnameitem.hxx +++ b/svl/inc/svl/globalnameitem.hxx @@ -30,11 +30,11 @@ #ifndef _GLOBALNAMEITEM_HXX #define _GLOBALNAMEITEM_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #include #include -#include +#include // ----------------------------------------------------------------------- diff --git a/svl/inc/svl/hint.hxx b/svl/inc/svl/hint.hxx index 9417b2bc1702..e2d43ea602ca 100644 --- a/svl/inc/svl/hint.hxx +++ b/svl/inc/svl/hint.hxx @@ -30,7 +30,7 @@ #ifndef _SFXHINT_HXX #define _SFXHINT_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include class SVL_DLLPUBLIC SfxHint diff --git a/svl/inc/svl/httpcook.hxx b/svl/inc/svl/httpcook.hxx index 354680a86f30..09769396eb11 100644 --- a/svl/inc/svl/httpcook.hxx +++ b/svl/inc/svl/httpcook.hxx @@ -34,7 +34,7 @@ #include #include #include -#include +#include /*======================================================================= * diff --git a/svl/inc/svl/ilstitem.hxx b/svl/inc/svl/ilstitem.hxx index 0bc76f1d0627..c581f938197f 100644 --- a/svl/inc/svl/ilstitem.hxx +++ b/svl/inc/svl/ilstitem.hxx @@ -31,8 +31,8 @@ #ifndef _SFXILSTITEM_HXX #define _SFXILSTITEM_HXX -#include "svtools/svldllapi.h" -#include +#include "svl/svldllapi.h" +#include #include class SvULongs; diff --git a/svl/inc/svl/imageitm.hxx b/svl/inc/svl/imageitm.hxx index ec5552e3d217..bfd888bdd944 100644 --- a/svl/inc/svl/imageitm.hxx +++ b/svl/inc/svl/imageitm.hxx @@ -31,8 +31,8 @@ #ifndef _SVT_IMAGEITM_HXX #define _SVT_IMAGEITM_HXX -#include "svtools/svldllapi.h" -#include +#include "svl/svldllapi.h" +#include class String; diff --git a/svl/inc/svl/inethist.hxx b/svl/inc/svl/inethist.hxx index ad64e1131bf3..7d4577897faf 100644 --- a/svl/inc/svl/inethist.hxx +++ b/svl/inc/svl/inethist.hxx @@ -30,12 +30,12 @@ #ifndef _INETHIST_HXX #define _INETHIST_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #include #include -#include -#include +#include +#include /*======================================================================== * diff --git a/svl/inc/svl/inettype.hxx b/svl/inc/svl/inettype.hxx index 2d9f0ba8694c..5f3bfbaab225 100644 --- a/svl/inc/svl/inettype.hxx +++ b/svl/inc/svl/inettype.hxx @@ -31,7 +31,7 @@ #ifndef _INETTYPE_HXX #define _INETTYPE_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #include diff --git a/svl/inc/svl/intitem.hxx b/svl/inc/svl/intitem.hxx index d54267eb4de1..7bfa3433c6b6 100644 --- a/svl/inc/svl/intitem.hxx +++ b/svl/inc/svl/intitem.hxx @@ -31,8 +31,8 @@ #ifndef _SFXINTITEM_HXX #define _SFXINTITEM_HXX -#include "svtools/svldllapi.h" -#include +#include "svl/svldllapi.h" +#include //============================================================================ class SVL_DLLPUBLIC SfxByteItem: public CntByteItem diff --git a/svl/inc/svl/isethint.hxx b/svl/inc/svl/isethint.hxx index d30fc4a65b27..d08819723f43 100644 --- a/svl/inc/svl/isethint.hxx +++ b/svl/inc/svl/isethint.hxx @@ -30,10 +30,10 @@ #ifndef _SFXISETHINT_HXX #define _SFXISETHINT_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #ifndef _HINT_HXX -#include +#include #endif class SfxItemSet; diff --git a/svl/inc/svl/itemiter.hxx b/svl/inc/svl/itemiter.hxx index 6a9b5e212720..50bbe7902e83 100644 --- a/svl/inc/svl/itemiter.hxx +++ b/svl/inc/svl/itemiter.hxx @@ -30,9 +30,9 @@ #ifndef _SFXITEMITER_HXX #define _SFXITEMITER_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include -#include +#include class SfxPoolItem; class SfxItemSet; diff --git a/svl/inc/svl/itempool.hxx b/svl/inc/svl/itempool.hxx index 81407cee2d0c..d99f29626d38 100644 --- a/svl/inc/svl/itempool.hxx +++ b/svl/inc/svl/itempool.hxx @@ -31,7 +31,7 @@ #ifndef _SFXITEMPOOL_HXX #define _SFXITEMPOOL_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #ifndef INCLUDED_LIMITS_H #include @@ -39,8 +39,8 @@ #endif #include #include -#include -#include +#include +#include #include class SvStream; diff --git a/svl/inc/svl/itemprop.hxx b/svl/inc/svl/itemprop.hxx index feab0eab004b..873c34785d5f 100644 --- a/svl/inc/svl/itemprop.hxx +++ b/svl/inc/svl/itemprop.hxx @@ -30,10 +30,10 @@ #ifndef _SFX_ITEMPROP_HXX #define _SFX_ITEMPROP_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #include -#include +#include #include #include #include diff --git a/svl/inc/svl/itemset.hxx b/svl/inc/svl/itemset.hxx index 4cc3edcf65c7..a09cfbc2bbb2 100644 --- a/svl/inc/svl/itemset.hxx +++ b/svl/inc/svl/itemset.hxx @@ -30,14 +30,14 @@ #ifndef _SFXITEMSET_HXX #define _SFXITEMSET_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #if STLPORT_VERSION<321 #include #else #include // std::va_list and friends #endif -#include +#include #include #include diff --git a/svl/inc/svl/languageoptions.hxx b/svl/inc/svl/languageoptions.hxx index 52ec53089b8a..77682ce69765 100644 --- a/svl/inc/svl/languageoptions.hxx +++ b/svl/inc/svl/languageoptions.hxx @@ -30,10 +30,10 @@ #ifndef _SVTOOLS_LANGUAGEOPTIONS_HXX #define _SVTOOLS_LANGUAGEOPTIONS_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include -#include -#include +#include +#include #include #include diff --git a/svl/inc/svl/lckbitem.hxx b/svl/inc/svl/lckbitem.hxx index b21e91a3fd46..77cb63414f4e 100644 --- a/svl/inc/svl/lckbitem.hxx +++ b/svl/inc/svl/lckbitem.hxx @@ -30,11 +30,11 @@ #ifndef _LCKBITEM_HXX #define _LCKBITEM_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #include #include -#include +#include // ----------------------------------------------------------------------- diff --git a/svl/inc/svl/lockfilecommon.hxx b/svl/inc/svl/lockfilecommon.hxx index 7d97d6c952cd..c1e18aac7e14 100644 --- a/svl/inc/svl/lockfilecommon.hxx +++ b/svl/inc/svl/lockfilecommon.hxx @@ -32,7 +32,7 @@ #ifndef _SVT_LOCKFILECOMMON_HXX #define _SVT_LOCKFILECOMMON_HXX -#include +#include #include #include diff --git a/svl/inc/svl/lstner.hxx b/svl/inc/svl/lstner.hxx index 99a6e10701f5..c9993834b42a 100644 --- a/svl/inc/svl/lstner.hxx +++ b/svl/inc/svl/lstner.hxx @@ -30,9 +30,9 @@ #ifndef _SFXLSTNER_HXX #define _SFXLSTNER_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include -#include +#include class SfxBroadcaster; class SfxHint; diff --git a/svl/inc/svl/macitem.hxx b/svl/inc/svl/macitem.hxx index f1790bf5f294..747b9ec0bf17 100644 --- a/svl/inc/svl/macitem.hxx +++ b/svl/inc/svl/macitem.hxx @@ -32,8 +32,8 @@ // class SvxMacroItem ---------------------------------------------------- -#include "svtools/svldllapi.h" -#include +#include "svl/svldllapi.h" +#include #include #include #include diff --git a/svl/inc/svl/metitem.hxx b/svl/inc/svl/metitem.hxx index 0289d5cb8e00..5a1e6627542f 100644 --- a/svl/inc/svl/metitem.hxx +++ b/svl/inc/svl/metitem.hxx @@ -30,8 +30,8 @@ #ifndef _SFXMETRICITEM_HXX #define _SFXMETRICITEM_HXX -#include "svtools/svldllapi.h" -#include +#include "svl/svldllapi.h" +#include DBG_NAMEEX_VISIBILITY(SfxMetricItem, SVL_DLLPUBLIC) diff --git a/svl/inc/svl/nranges.hxx b/svl/inc/svl/nranges.hxx index 6996669cdeb1..e527a456a014 100644 --- a/svl/inc/svl/nranges.hxx +++ b/svl/inc/svl/nranges.hxx @@ -40,12 +40,12 @@ #define NUMTYPE USHORT #define SfxNumRanges SfxUShortRanges -#include +#include #undef NUMTYPE #define NUMTYPE ULONG #define SfxNumRanges SfxULongRanges -#include +#include #define _SFXNRANGES_HXX diff --git a/svl/inc/svl/ondemand.hxx b/svl/inc/svl/ondemand.hxx index e8361307eb9e..76fd9efe3672 100644 --- a/svl/inc/svl/ondemand.hxx +++ b/svl/inc/svl/ondemand.hxx @@ -31,7 +31,7 @@ #ifndef INCLUDED_SVTOOLS_ONDEMAND_HXX #define INCLUDED_SVTOOLS_ONDEMAND_HXX -#include +#include #include #include #include diff --git a/svl/inc/svl/ownlist.hxx b/svl/inc/svl/ownlist.hxx index 397e4f532521..21e9ffa74210 100644 --- a/svl/inc/svl/ownlist.hxx +++ b/svl/inc/svl/ownlist.hxx @@ -31,7 +31,7 @@ #ifndef _OWNLIST_HXX #define _OWNLIST_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #include #include diff --git a/svl/inc/svl/poolitem.hxx b/svl/inc/svl/poolitem.hxx index 7e0fea44b87a..1d0a2e982fae 100644 --- a/svl/inc/svl/poolitem.hxx +++ b/svl/inc/svl/poolitem.hxx @@ -30,7 +30,7 @@ #ifndef _SFXPOOLITEM_HXX #define _SFXPOOLITEM_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #define TF_POOLABLE @@ -40,8 +40,8 @@ #include #include #include -#include -#include +#include +#include typedef long SfxArgumentError; diff --git a/svl/inc/svl/ptitem.hxx b/svl/inc/svl/ptitem.hxx index 5ce99c09b98f..b0deff81e884 100644 --- a/svl/inc/svl/ptitem.hxx +++ b/svl/inc/svl/ptitem.hxx @@ -30,8 +30,8 @@ #ifndef _SFXPTITEM_HXX #define _SFXPTITEM_HXX -#include "svtools/svldllapi.h" -#include +#include "svl/svldllapi.h" +#include #include class SvStream; diff --git a/svl/inc/svl/rectitem.hxx b/svl/inc/svl/rectitem.hxx index b71705fc2047..1f944bab4102 100644 --- a/svl/inc/svl/rectitem.hxx +++ b/svl/inc/svl/rectitem.hxx @@ -30,10 +30,10 @@ #ifndef _SFXRECTITEM_HXX #define _SFXRECTITEM_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #include -#include +#include class SvStream; diff --git a/svl/inc/svl/restrictedpaths.hxx b/svl/inc/svl/restrictedpaths.hxx index 057c83cac7d1..a3ced1b93019 100644 --- a/svl/inc/svl/restrictedpaths.hxx +++ b/svl/inc/svl/restrictedpaths.hxx @@ -31,8 +31,8 @@ #ifndef SVTOOLS_RESTRICTEDPATHS_HXX #define SVTOOLS_RESTRICTEDPATHS_HXX -#include -#include +#include +#include #include #include diff --git a/svl/inc/svl/rngitem.hxx b/svl/inc/svl/rngitem.hxx index 92ab50b751e6..d55ba25a06c2 100644 --- a/svl/inc/svl/rngitem.hxx +++ b/svl/inc/svl/rngitem.hxx @@ -35,7 +35,7 @@ #define NUMTYPE USHORT #define SfxXRangeItem SfxRangeItem #define SfxXRangesItem SfxUShortRangesItem -#include +#include #undef NUMTYPE #undef SfxXRangeItem #undef SfxXRangesItem @@ -44,7 +44,7 @@ #define NUMTYPE ULONG #define SfxXRangeItem SfxULongRangeItem #define SfxXRangesItem SfxULongRangesItem -#include +#include #undef NUMTYPE #undef SfxXRangeItem #undef SfxXRangesItem @@ -53,8 +53,8 @@ #define _SFXRNGITEM_HXX #else -#include "svtools/svldllapi.h" -#include +#include "svl/svldllapi.h" +#include class SvStream; diff --git a/svl/inc/svl/sfontitm.hxx b/svl/inc/svl/sfontitm.hxx index e1394dec91b3..a12466519d1b 100644 --- a/svl/inc/svl/sfontitm.hxx +++ b/svl/inc/svl/sfontitm.hxx @@ -34,7 +34,7 @@ #include #include #include -#include +#include //============================================================================ class SfxFontItem: public SfxPoolItem diff --git a/svl/inc/svl/sharecontrolfile.hxx b/svl/inc/svl/sharecontrolfile.hxx index a926e6124e8c..1febb4e77583 100644 --- a/svl/inc/svl/sharecontrolfile.hxx +++ b/svl/inc/svl/sharecontrolfile.hxx @@ -31,7 +31,7 @@ #ifndef _SVT_SHARECONTROLFILE_HXX #define _SVT_SHARECONTROLFILE_HXX -#include +#include #include #include @@ -40,7 +40,7 @@ #include #include -#include +#include #define SHARED_OOOUSERNAME_ID LOCKFILE_OOOUSERNAME_ID #define SHARED_SYSUSERNAME_ID LOCKFILE_SYSUSERNAME_ID diff --git a/svl/inc/svl/slstitm.hxx b/svl/inc/svl/slstitm.hxx index 742d437fb842..9b1c0050cf6b 100644 --- a/svl/inc/svl/slstitm.hxx +++ b/svl/inc/svl/slstitm.hxx @@ -30,10 +30,10 @@ #ifndef _SFXSLSTITM_HXX #define _SFXSLSTITM_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #include -#include +#include #include class SfxImpStringList; diff --git a/svl/inc/svl/smplhint.hxx b/svl/inc/svl/smplhint.hxx index 9858fefd86f0..089a86dae3f2 100644 --- a/svl/inc/svl/smplhint.hxx +++ b/svl/inc/svl/smplhint.hxx @@ -30,8 +30,8 @@ #ifndef _SFXSMPLHINT_HXX #define _SFXSMPLHINT_HXX -#include "svtools/svldllapi.h" -#include +#include "svl/svldllapi.h" +#include #include #define SFX_HINT_DYING 0x00000001 diff --git a/svl/inc/svl/stritem.hxx b/svl/inc/svl/stritem.hxx index 84a0be6b9fd1..21ee9fadd1ec 100644 --- a/svl/inc/svl/stritem.hxx +++ b/svl/inc/svl/stritem.hxx @@ -31,8 +31,8 @@ #ifndef _SFXSTRITEM_HXX #define _SFXSTRITEM_HXX -#include "svtools/svldllapi.h" -#include +#include "svl/svldllapi.h" +#include //============================================================================ class SVL_DLLPUBLIC SfxStringItem: public CntUnencodedStringItem diff --git a/svl/inc/svl/style.hxx b/svl/inc/svl/style.hxx index f560c10e8901..66c130d346dd 100644 --- a/svl/inc/svl/style.hxx +++ b/svl/inc/svl/style.hxx @@ -38,16 +38,16 @@ #include #include #include -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #include -#include -#include -#include -#include +#include +#include +#include +#include #ifndef _SFX_STYLE_HRC -#include +#include #endif class SfxItemSet; diff --git a/svl/inc/svl/svarray.hxx b/svl/inc/svl/svarray.hxx index 3ab3676fa5e0..d2479cd5364f 100644 --- a/svl/inc/svl/svarray.hxx +++ b/svl/inc/svl/svarray.hxx @@ -101,7 +101,7 @@ *********************************************************************** #endif -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #ifndef INCLUDED_STRING_H #include // memmove() diff --git a/svl/inc/svl/svdde.hxx b/svl/inc/svl/svdde.hxx index 4e0063e2477b..96a1ffa6bf22 100644 --- a/svl/inc/svl/svdde.hxx +++ b/svl/inc/svl/svdde.hxx @@ -31,7 +31,7 @@ #ifndef _SVDDE_HXX #define _SVDDE_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #include #include diff --git a/svl/inc/svl/svstdarr.hxx b/svl/inc/svl/svstdarr.hxx index 050b228be4ab..869c70e1cac6 100644 --- a/svl/inc/svl/svstdarr.hxx +++ b/svl/inc/svl/svstdarr.hxx @@ -43,8 +43,8 @@ *********************************************************************** #endif -#include "svtools/svldllapi.h" -#include +#include "svl/svldllapi.h" +#include //#ifdef _SVSTDARR_BOOLS #ifndef _SVSTDARR_BOOLS_DECL diff --git a/svl/inc/svl/svtools.hrc b/svl/inc/svl/svtools.hrc index 245d31a2dd21..2bccf2ee74c4 100644 --- a/svl/inc/svl/svtools.hrc +++ b/svl/inc/svl/svtools.hrc @@ -30,7 +30,7 @@ #ifndef _SVTOOLS_HRC #define _SVTOOLS_HRC "$Revision: 1.0" -#include +#include #define RID_SVTOOLS_BITMAP_START (RID_SVTOOLS_START + 0) #define RID_SVTOOLS_IMAGELIST_START (RID_SVTOOLS_START + 0) diff --git a/svl/inc/svl/syslocale.hxx b/svl/inc/svl/syslocale.hxx index de5962fa0d1a..e655f2eb3006 100644 --- a/svl/inc/svl/syslocale.hxx +++ b/svl/inc/svl/syslocale.hxx @@ -31,7 +31,7 @@ #ifndef INCLUDED_SVTOOLS_SYSLOCALE_HXX #define INCLUDED_SVTOOLS_SYSLOCALE_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #include #include diff --git a/svl/inc/svl/syslocaleoptions.hxx b/svl/inc/svl/syslocaleoptions.hxx index a5884c7bbcaa..4570f7453ec0 100644 --- a/svl/inc/svl/syslocaleoptions.hxx +++ b/svl/inc/svl/syslocaleoptions.hxx @@ -31,7 +31,7 @@ #ifndef INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX #define INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #include #include diff --git a/svl/inc/svl/szitem.hxx b/svl/inc/svl/szitem.hxx index d3fb920aa012..c4b52d4939c0 100644 --- a/svl/inc/svl/szitem.hxx +++ b/svl/inc/svl/szitem.hxx @@ -32,7 +32,7 @@ #include -#include +#include class SfxArguments; class SvStream; diff --git a/svl/inc/svl/tfrmitem.hxx b/svl/inc/svl/tfrmitem.hxx index 93e245a731a2..82f08eccdf24 100644 --- a/svl/inc/svl/tfrmitem.hxx +++ b/svl/inc/svl/tfrmitem.hxx @@ -32,7 +32,7 @@ #include -#include +#include class SvStream; diff --git a/svl/inc/svl/tresitem.hxx b/svl/inc/svl/tresitem.hxx index 6282d3a7d4ff..c0254a1bf1fc 100644 --- a/svl/inc/svl/tresitem.hxx +++ b/svl/inc/svl/tresitem.hxx @@ -32,7 +32,7 @@ #define SVTOOLS_TRESITEM_HXX #include -#include +#include //============================================================================ class CntTransferResultItem: public SfxPoolItem diff --git a/svl/inc/svl/undo.hxx b/svl/inc/svl/undo.hxx index 5bd48342f530..354de8b451c7 100644 --- a/svl/inc/svl/undo.hxx +++ b/svl/inc/svl/undo.hxx @@ -30,10 +30,10 @@ #ifndef _UNDO_HXX #define _UNDO_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #include -#include +#include //==================================================================== diff --git a/svl/inc/svl/visitem.hxx b/svl/inc/svl/visitem.hxx index 9ace1212d967..1a3918526def 100644 --- a/svl/inc/svl/visitem.hxx +++ b/svl/inc/svl/visitem.hxx @@ -31,9 +31,9 @@ #ifndef _SFXVISIBILITYITEM_HXX #define _SFXVISIBILITYITEM_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include -#include +#include #include //============================================================================ diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx index 5862a1312039..4e653caf0238 100644 --- a/svl/inc/svl/zforlist.hxx +++ b/svl/inc/svl/zforlist.hxx @@ -30,20 +30,20 @@ #ifndef _ZFORLIST_HXX #define _ZFORLIST_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #ifndef _TABLE_HXX //autogen #include #endif #include -#include +#include #include #include #include #include -#include +#include #include -#include +#include #include diff --git a/svl/inc/svl/zformat.hxx b/svl/inc/svl/zformat.hxx index 208c876bfbfc..991460015e6d 100644 --- a/svl/inc/svl/zformat.hxx +++ b/svl/inc/svl/zformat.hxx @@ -30,12 +30,12 @@ #ifndef _ZFORMAT_HXX #define _ZFORMAT_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include #include -#include -#include -#include +#include +#include +#include // We need ImpSvNumberformatScan for the private SvNumberformat definitions. #ifdef _ZFORMAT_CXX diff --git a/svl/inc/urihelper.hxx b/svl/inc/urihelper.hxx index e68e8f0ee54f..8be500e438ce 100644 --- a/svl/inc/urihelper.hxx +++ b/svl/inc/urihelper.hxx @@ -31,7 +31,7 @@ #ifndef SVTOOLS_URIHELPER_HXX #define SVTOOLS_URIHELPER_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include "com/sun/star/uno/Reference.hxx" #include #include diff --git a/svl/inc/whiter.hxx b/svl/inc/whiter.hxx index 87ed2cbc76f0..d2bd7c88d521 100644 --- a/svl/inc/whiter.hxx +++ b/svl/inc/whiter.hxx @@ -30,7 +30,7 @@ #ifndef _SFX_WHITER_HXX #define _SFX_WHITER_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #ifndef INCLUDED_LIMITS_H #include diff --git a/svl/qa/complex/ConfigItems/CheckConfigItems.java b/svl/qa/complex/ConfigItems/CheckConfigItems.java index 97cc21fdec9f..6f4d0ba3d945 100644 --- a/svl/qa/complex/ConfigItems/CheckConfigItems.java +++ b/svl/qa/complex/ConfigItems/CheckConfigItems.java @@ -102,7 +102,7 @@ public class CheckConfigItems extends ComplexTestCase // create module manager m_xTest = (XJob)UnoRuntime.queryInterface( XJob.class, - m_xSmgr.createInstance("com.sun.star.comp.svtools.ConfigItemTest")); + m_xSmgr.createInstance("com.sun.star.comp.svl.ConfigItemTest")); } //------------------------------------------- diff --git a/svl/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx b/svl/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx index fc2f4681e4fe..58bb58f8c215 100644 --- a/svl/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx +++ b/svl/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx @@ -37,7 +37,7 @@ #define SVTOOLS_ACCESSIBILITYOPTTEST_HXX #include -#include +#include namespace css = ::com::sun::star; diff --git a/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx b/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx index b21d9d76755e..ad9dda313a5c 100644 --- a/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx +++ b/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx @@ -51,7 +51,7 @@ //============================================================================= namespace css = ::com::sun::star; -namespace svtools{ +namespace svl{ //============================================================================= static const ::rtl::OUString PROP_TEST = ::rtl::OUString::createFromAscii("Test"); @@ -196,7 +196,7 @@ css::uno::Sequence< ::rtl::OUString > SAL_CALL ConfigItemTest::getSupportedServi //============================================================================= ::rtl::OUString SAL_CALL ConfigItemTest::st_getImplementationName() { - return ::rtl::OUString::createFromAscii("com.sun.star.comp.svtools.ConfigItemTest"); + return ::rtl::OUString::createFromAscii("com.sun.star.comp.svl.ConfigItemTest"); } //============================================================================= @@ -215,15 +215,15 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL ConfigItemTest::st_create(c return xObject; } -} // namespace svtools +} // namespace svl //============================================================================= static ::cppu::ImplementationEntry const lRegEntries[] = { { - &::svtools::ConfigItemTest::st_create, - &::svtools::ConfigItemTest::st_getImplementationName, - &::svtools::ConfigItemTest::st_getSupportedServiceNames, + &::svl::ConfigItemTest::st_create, + &::svl::ConfigItemTest::st_getImplementationName, + &::svl::ConfigItemTest::st_getSupportedServiceNames, &::cppu::createSingleComponentFactory, 0, 0 }, diff --git a/svl/qa/complex/ConfigItems/helper/PrintOptTest.hxx b/svl/qa/complex/ConfigItems/helper/PrintOptTest.hxx index 14d4267b8878..79505a4e6faf 100644 --- a/svl/qa/complex/ConfigItems/helper/PrintOptTest.hxx +++ b/svl/qa/complex/ConfigItems/helper/PrintOptTest.hxx @@ -37,7 +37,7 @@ #define SVTOOLS_PRINTOPTTEST_HXX #include -#include +#include namespace css = ::com::sun::star; diff --git a/svl/source/config/cjkoptions.cxx b/svl/source/config/cjkoptions.cxx index 8483614d63dd..7ce2a45ce7a0 100644 --- a/svl/source/config/cjkoptions.cxx +++ b/svl/source/config/cjkoptions.cxx @@ -31,9 +31,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svl.hxx" -#include +#include -#include +#include #include #include #include diff --git a/svl/source/config/ctloptions.cxx b/svl/source/config/ctloptions.cxx index 3174577ea64f..f2f82425e7de 100644 --- a/svl/source/config/ctloptions.cxx +++ b/svl/source/config/ctloptions.cxx @@ -31,9 +31,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svl.hxx" -#include +#include -#include +#include #include #include #include @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include diff --git a/svl/source/config/itemholder2.cxx b/svl/source/config/itemholder2.cxx index 3796d9b45d75..f8fc8a8427e7 100644 --- a/svl/source/config/itemholder2.cxx +++ b/svl/source/config/itemholder2.cxx @@ -38,11 +38,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include diff --git a/svl/source/config/languageoptions.cxx b/svl/source/config/languageoptions.cxx index 57beb23053b2..fa01996b6a82 100644 --- a/svl/source/config/languageoptions.cxx +++ b/svl/source/config/languageoptions.cxx @@ -31,9 +31,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svl.hxx" -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/svl/source/config/misccfg.cxx b/svl/source/config/misccfg.cxx index fd531b16a4f5..b7a9f230c849 100644 --- a/svl/source/config/misccfg.cxx +++ b/svl/source/config/misccfg.cxx @@ -32,7 +32,7 @@ #include "precompiled_svl.hxx" #include "misccfg.hxx" -#include +#include #include #include @@ -57,7 +57,7 @@ SfxMiscCfg::SfxMiscCfg() : bNotFound (FALSE), nYear2000( SvNumberFormatter::GetYear2000Default() ) { - RTL_LOGFILE_CONTEXT(aLog, "svtools SfxMiscCfg::SfxMiscCfg()"); + RTL_LOGFILE_CONTEXT(aLog, "svl SfxMiscCfg::SfxMiscCfg()"); Load(); } diff --git a/svl/source/config/syslocaleoptions.cxx b/svl/source/config/syslocaleoptions.cxx index 48b3981067df..dc6f7d630d40 100644 --- a/svl/source/config/syslocaleoptions.cxx +++ b/svl/source/config/syslocaleoptions.cxx @@ -31,10 +31,10 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svl.hxx" -#include +#include #include #include -#include +#include #include #include #include @@ -445,7 +445,7 @@ SvtSysLocaleOptions::SvtSysLocaleOptions() MutexGuard aGuard( GetMutex() ); if ( !pOptions ) { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtSysLocaleOptions_Impl::ctor()"); + RTL_LOGFILE_CONTEXT(aLog, "svl ( ??? ) ::SvtSysLocaleOptions_Impl::ctor()"); pOptions = new SvtSysLocaleOptions_Impl; ItemHolder2::holdConfigItem(E_SYSLOCALEOPTIONS); @@ -475,7 +475,7 @@ Mutex& SvtSysLocaleOptions::GetMutex() if( !pMutex ) { // #i77768# Due to a static reference in the toolkit lib - // we need a mutex that lives longer than the svtools library. + // we need a mutex that lives longer than the svl library. // Otherwise the dtor would use a destructed mutex!! pMutex = new Mutex; } diff --git a/svl/source/filerec/filerec.cxx b/svl/source/filerec/filerec.cxx index 5bb1a95c9a02..ac35a748eef7 100644 --- a/svl/source/filerec/filerec.cxx +++ b/svl/source/filerec/filerec.cxx @@ -30,7 +30,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svl.hxx" -#include +#include #include //======================================================================== diff --git a/svl/source/inc/poolio.hxx b/svl/source/inc/poolio.hxx index fb30fc04832d..0018b403796f 100644 --- a/svl/source/inc/poolio.hxx +++ b/svl/source/inc/poolio.hxx @@ -27,7 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include +#include #ifndef DELETEZ diff --git a/svl/source/items/aeitem.cxx b/svl/source/items/aeitem.cxx index 54ce914d09fe..55dc818d0160 100644 --- a/svl/source/items/aeitem.cxx +++ b/svl/source/items/aeitem.cxx @@ -36,9 +36,9 @@ #include #define _SVSTDARR_USHORTS -#include -#include -#include +#include +#include +#include // STATIC DATA ----------------------------------------------------------- diff --git a/svl/source/items/bintitem.cxx b/svl/source/items/bintitem.cxx index 1ee0ebe224e1..5236f36504f8 100644 --- a/svl/source/items/bintitem.cxx +++ b/svl/source/items/bintitem.cxx @@ -33,7 +33,7 @@ #include #include #include -#include +#include // STATIC DATA diff --git a/svl/source/items/cenumitm.cxx b/svl/source/items/cenumitm.cxx index 65cc4a78be54..3c2f7764a351 100644 --- a/svl/source/items/cenumitm.cxx +++ b/svl/source/items/cenumitm.cxx @@ -32,7 +32,7 @@ #include "precompiled_svl.hxx" #include #include -#include +#include #include #ifndef _CPPUHELPER_EXTRACT_HXX_ diff --git a/svl/source/items/cintitem.cxx b/svl/source/items/cintitem.cxx index a20c947b56de..9d9d58421fc4 100644 --- a/svl/source/items/cintitem.cxx +++ b/svl/source/items/cintitem.cxx @@ -32,7 +32,7 @@ #include "precompiled_svl.hxx" #include #include -#include +#include //============================================================================ // diff --git a/svl/source/items/cntwall.cxx b/svl/source/items/cntwall.cxx index 5d4941981ec4..824ad6b2b5b0 100644 --- a/svl/source/items/cntwall.cxx +++ b/svl/source/items/cntwall.cxx @@ -36,7 +36,7 @@ #include #include -#include +#include #define CNTWALLPAPERITEM_STREAM_MAGIC ( (UINT32)0xfefefefe ) #define CNTWALLPAPERITEM_STREAM_SEEKREL (-( (long)( sizeof( UINT32 ) ) ) ) diff --git a/svl/source/items/cstitem.cxx b/svl/source/items/cstitem.cxx index eb9092828060..af2bfbc18fb9 100644 --- a/svl/source/items/cstitem.cxx +++ b/svl/source/items/cstitem.cxx @@ -38,10 +38,10 @@ #include #include -#include -#include +#include +#include -#include +#include #include DBG_NAME( SfxCrawlStatusItem ) diff --git a/svl/source/items/cstitem.src b/svl/source/items/cstitem.src index 8d6e2d0280c0..b25b980e39cf 100644 --- a/svl/source/items/cstitem.src +++ b/svl/source/items/cstitem.src @@ -28,7 +28,7 @@ * ************************************************************************/ -#include +#include String STR_CSTAT_NEVER_UPD { Text [ en-US ] = "No update has occurred" ; diff --git a/svl/source/items/ctypeitm.cxx b/svl/source/items/ctypeitm.cxx index a5c12d49dda5..69302ebdb868 100644 --- a/svl/source/items/ctypeitm.cxx +++ b/svl/source/items/ctypeitm.cxx @@ -34,7 +34,7 @@ #include #include -#include +#include //============================================================================ // The following defines are copied from chaos/source/items/cstritem.cxx: diff --git a/svl/source/items/custritm.cxx b/svl/source/items/custritm.cxx index 5e2be8469922..8687aafbae49 100644 --- a/svl/source/items/custritm.cxx +++ b/svl/source/items/custritm.cxx @@ -34,7 +34,7 @@ #include #include -#include +#include //============================================================================ // diff --git a/svl/source/items/dateitem.cxx b/svl/source/items/dateitem.cxx index 5ce66349c0a3..7f901dac9cd8 100644 --- a/svl/source/items/dateitem.cxx +++ b/svl/source/items/dateitem.cxx @@ -34,7 +34,7 @@ // include --------------------------------------------------------------- #define _DATETIMEITEM_CXX -#include +#include #include #include @@ -50,8 +50,8 @@ #include -#include -#include +#include +#include // STATIC DATA ----------------------------------------------------------- diff --git a/svl/source/items/dtritem.cxx b/svl/source/items/dtritem.cxx index 5159631f713a..32a7fdc1c60d 100644 --- a/svl/source/items/dtritem.cxx +++ b/svl/source/items/dtritem.cxx @@ -43,7 +43,7 @@ #include -#include +#include DBG_NAME( SfxDateTimeRangeItem ) diff --git a/svl/source/items/eitem.cxx b/svl/source/items/eitem.cxx index 1dc137f32467..16d5aae5a16f 100644 --- a/svl/source/items/eitem.cxx +++ b/svl/source/items/eitem.cxx @@ -30,7 +30,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svl.hxx" -#include +#include //============================================================================ // // class SfxEnumItem diff --git a/svl/source/items/flagitem.cxx b/svl/source/items/flagitem.cxx index e2e0bd55f919..537632db04ff 100644 --- a/svl/source/items/flagitem.cxx +++ b/svl/source/items/flagitem.cxx @@ -31,8 +31,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svl.hxx" -#include -#include +#include +#include #include // STATIC DATA ----------------------------------------------------------- diff --git a/svl/source/items/frqitem.cxx b/svl/source/items/frqitem.cxx index b7d47e4e3ac9..cfa1db17ef65 100644 --- a/svl/source/items/frqitem.cxx +++ b/svl/source/items/frqitem.cxx @@ -39,7 +39,7 @@ #include #include -#include +#include DBG_NAME( SfxFrequencyItem ) diff --git a/svl/source/items/globalnameitem.cxx b/svl/source/items/globalnameitem.cxx index e8beb9a62b9e..1b676a95bf71 100644 --- a/svl/source/items/globalnameitem.cxx +++ b/svl/source/items/globalnameitem.cxx @@ -38,7 +38,7 @@ #include -#include +#include // STATIC DATA ----------------------------------------------------------- diff --git a/svl/source/items/ilstitem.cxx b/svl/source/items/ilstitem.cxx index 3d600632118f..4d2cb0a3b5b9 100644 --- a/svl/source/items/ilstitem.cxx +++ b/svl/source/items/ilstitem.cxx @@ -35,10 +35,10 @@ #include -#include +#include #define _SVSTDARR_ULONGS -#include +#include TYPEINIT1_AUTOFACTORY(SfxIntegerListItem, SfxPoolItem); diff --git a/svl/source/items/imageitm.cxx b/svl/source/items/imageitm.cxx index 276e7445ae3f..dec2626472cc 100644 --- a/svl/source/items/imageitm.cxx +++ b/svl/source/items/imageitm.cxx @@ -31,7 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svl.hxx" -#include +#include #include TYPEINIT1( SfxImageItem, SfxInt16Item ); diff --git a/svl/source/items/intitem.cxx b/svl/source/items/intitem.cxx index 245e9734aa89..1133cdf553d1 100644 --- a/svl/source/items/intitem.cxx +++ b/svl/source/items/intitem.cxx @@ -31,11 +31,11 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svl.hxx" -#include +#include #include #include #include -#include +#include //============================================================================ // diff --git a/svl/source/items/itemiter.cxx b/svl/source/items/itemiter.cxx index 3bd616054149..c8c6eea67c82 100644 --- a/svl/source/items/itemiter.cxx +++ b/svl/source/items/itemiter.cxx @@ -34,9 +34,9 @@ #ifndef GCC #endif -#include -#include -#include +#include +#include +#include // STATIC DATA ----------------------------------------------------------- diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx index 50f5c1fee817..5f34560e8471 100644 --- a/svl/source/items/itempool.cxx +++ b/svl/source/items/itempool.cxx @@ -36,10 +36,10 @@ #ifndef GCC #endif -#include +#include #include "whassert.hxx" -#include -#include +#include +#include #include "poolio.hxx" #include diff --git a/svl/source/items/itemprop.cxx b/svl/source/items/itemprop.cxx index cf2677dd988c..cd50c1c51794 100644 --- a/svl/source/items/itemprop.cxx +++ b/svl/source/items/itemprop.cxx @@ -31,9 +31,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svl.hxx" -#include -#include -#include +#include +#include +#include #include #include /************************************************************************* diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx index 05873c0d5b41..45516660ee21 100644 --- a/svl/source/items/itemset.cxx +++ b/svl/source/items/itemset.cxx @@ -43,12 +43,12 @@ #define _SVSTDARR_USHORTS #define _SVSTDARR_ULONGS -#include -#include -#include -#include +#include +#include +#include +#include #include "whiter.hxx" -#include +#include #include "whassert.hxx" #include diff --git a/svl/source/items/lckbitem.cxx b/svl/source/items/lckbitem.cxx index 695a80ecf0a4..04e2edb70026 100644 --- a/svl/source/items/lckbitem.cxx +++ b/svl/source/items/lckbitem.cxx @@ -32,8 +32,8 @@ #include "precompiled_svl.hxx" #define _LCKBITEM_CXX -#include -#include +#include +#include #include #include #include diff --git a/svl/source/items/macitem.cxx b/svl/source/items/macitem.cxx index 4837f9cb88e0..511ca2bba57c 100644 --- a/svl/source/items/macitem.cxx +++ b/svl/source/items/macitem.cxx @@ -35,7 +35,7 @@ #ifndef GCC #endif -#include +#include // STATIC DATA ----------------------------------------------------------- diff --git a/svl/source/items/poolcach.cxx b/svl/source/items/poolcach.cxx index 634b1cae1c14..e64325213ff4 100644 --- a/svl/source/items/poolcach.cxx +++ b/svl/source/items/poolcach.cxx @@ -36,8 +36,8 @@ #ifndef GCC #endif -#include -#include +#include +#include #include "poolcach.hxx" // STATIC DATA ----------------------------------------------------------- diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx index bee7bc04ae23..4383ac99d2ed 100644 --- a/svl/source/items/poolio.cxx +++ b/svl/source/items/poolio.cxx @@ -38,11 +38,11 @@ #endif #include -#include +#include #include "whassert.hxx" -#include -#include -#include +#include +#include +#include #include "poolio.hxx" // STATIC DATA ----------------------------------------------------------- diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx index 8946175a0dd2..4957c5c16945 100644 --- a/svl/source/items/poolitem.cxx +++ b/svl/source/items/poolitem.cxx @@ -31,7 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svl.hxx" -#include +#include #include // STATIC DATA ----------------------------------------------------------- diff --git a/svl/source/items/ptitem.cxx b/svl/source/items/ptitem.cxx index 5d8497dd0ada..30fef0227397 100644 --- a/svl/source/items/ptitem.cxx +++ b/svl/source/items/ptitem.cxx @@ -31,12 +31,12 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svl.hxx" -#include +#include #include #include #include -#include +#include #include "memberid.hrc" using namespace ::com::sun::star; diff --git a/svl/source/items/rectitem.cxx b/svl/source/items/rectitem.cxx index e88d2886b7c0..26c4876d8c2c 100644 --- a/svl/source/items/rectitem.cxx +++ b/svl/source/items/rectitem.cxx @@ -31,12 +31,12 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svl.hxx" -#include +#include #include #include #include -#include +#include #include "memberid.hrc" // STATIC DATA ----------------------------------------------------------- diff --git a/svl/source/items/rngitem.cxx b/svl/source/items/rngitem.cxx index 17ff38a01382..b6340d662112 100644 --- a/svl/source/items/rngitem.cxx +++ b/svl/source/items/rngitem.cxx @@ -37,13 +37,13 @@ #define NUMTYPE USHORT #define SfxXRangeItem SfxRangeItem #define SfxXRangesItem SfxUShortRangesItem -#include +#include #include "rngitem_inc.cxx" #define NUMTYPE sal_uInt32 #define SfxXRangeItem SfxULongRangeItem #define SfxXRangesItem SfxULongRangesItem -#include +#include #include "rngitem_inc.cxx" #else diff --git a/svl/source/items/sfontitm.cxx b/svl/source/items/sfontitm.cxx index 6413cbc8d1cc..9ec06bc5a105 100644 --- a/svl/source/items/sfontitm.cxx +++ b/svl/source/items/sfontitm.cxx @@ -32,7 +32,7 @@ #include "precompiled_svl.hxx" #include #include -#include +#include //============================================================================ // diff --git a/svl/source/items/sitem.cxx b/svl/source/items/sitem.cxx index 04ae8becfde0..52f0931c9eae 100644 --- a/svl/source/items/sitem.cxx +++ b/svl/source/items/sitem.cxx @@ -38,8 +38,8 @@ #include #include -#include -#include +#include +#include // STATIC DATA ----------------------------------------------------------- diff --git a/svl/source/items/slstitm.cxx b/svl/source/items/slstitm.cxx index 12b2aa2dbd4b..d0dd801bb6f9 100644 --- a/svl/source/items/slstitm.cxx +++ b/svl/source/items/slstitm.cxx @@ -31,8 +31,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svl.hxx" -#include -#include +#include +#include #include #include #include diff --git a/svl/source/items/stritem.cxx b/svl/source/items/stritem.cxx index 4b24b5712fe1..5f6b692106a3 100644 --- a/svl/source/items/stritem.cxx +++ b/svl/source/items/stritem.cxx @@ -30,7 +30,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svl.hxx" -#include +#include //============================================================================ // diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index 68bae3f8142e..7ed44f7a9694 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -43,15 +43,15 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -702,11 +702,11 @@ SfxStyleSheetBase* SfxStyleSheetBasePool::Create( const SfxStyleSheetBase& r ) SfxStyleSheetBase& SfxStyleSheetBasePool::Make( const XubString& rName, SfxStyleFamily eFam, USHORT mask, USHORT nPos) { - DBG_ASSERT( eFam != SFX_STYLE_FAMILY_ALL, "svtools::SfxStyleSheetBasePool::Make(), FamilyAll is not a allowed Familie" ); + DBG_ASSERT( eFam != SFX_STYLE_FAMILY_ALL, "svl::SfxStyleSheetBasePool::Make(), FamilyAll is not a allowed Familie" ); SfxStyleSheetIterator aIter(this, eFam, mask); rtl::Reference< SfxStyleSheetBase > xStyle( aIter.Find( rName ) ); - DBG_ASSERT( !xStyle.is(), "svtools::SfxStyleSheetBasePool::Make(), StyleSheet already exists" ); + DBG_ASSERT( !xStyle.is(), "svl::SfxStyleSheetBasePool::Make(), StyleSheet already exists" ); SfxStyleSheetIterator& rIter = GetIterator_Impl(); if( !xStyle.is() ) @@ -820,15 +820,15 @@ void SfxStyleSheetBasePool::Remove( SfxStyleSheetBase* p ) void SfxStyleSheetBasePool::Insert( SfxStyleSheetBase* p ) { - DBG_ASSERT( p, "svtools::SfxStyleSheetBasePool::Insert(), no stylesheet?" ); + DBG_ASSERT( p, "svl::SfxStyleSheetBasePool::Insert(), no stylesheet?" ); SfxStyleSheetIterator aIter(this, p->GetFamily(), p->GetMask()); SfxStyleSheetBase* pOld = aIter.Find( p->GetName() ); - DBG_ASSERT( !pOld, "svtools::SfxStyleSheetBasePool::Insert(), StyleSheet already inserted" ); + DBG_ASSERT( !pOld, "svl::SfxStyleSheetBasePool::Insert(), StyleSheet already inserted" ); if( p->GetParent().Len() ) { pOld = aIter.Find( p->GetParent() ); - DBG_ASSERT( pOld, "svtools::SfxStyleSheetBasePool::Insert(), Parent not found!" ); + DBG_ASSERT( pOld, "svl::SfxStyleSheetBasePool::Insert(), Parent not found!" ); } aStyles.push_back( rtl::Reference< SfxStyleSheetBase >( p ) ); Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *p ) ); diff --git a/svl/source/items/stylepool.cxx b/svl/source/items/stylepool.cxx index 5f31500be73c..57ba991afcb4 100644 --- a/svl/source/items/stylepool.cxx +++ b/svl/source/items/stylepool.cxx @@ -36,8 +36,8 @@ #include #include "stylepool.hxx" -#include -#include +#include +#include using namespace boost; diff --git a/svl/source/items/szitem.cxx b/svl/source/items/szitem.cxx index de18e13b04d7..a7667a25a97c 100644 --- a/svl/source/items/szitem.cxx +++ b/svl/source/items/szitem.cxx @@ -31,13 +31,13 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svl.hxx" -#include +#include #include #include #include #include -#include +#include #include "memberid.hrc" // STATIC DATA ----------------------------------------------------------- diff --git a/svl/source/items/tfrmitem.cxx b/svl/source/items/tfrmitem.cxx index d4909aca049c..636b3e9eb0a1 100644 --- a/svl/source/items/tfrmitem.cxx +++ b/svl/source/items/tfrmitem.cxx @@ -36,7 +36,7 @@ #include #include -#include +#include DBG_NAME( SfxTargetFrameItem ) TYPEINIT1( SfxTargetFrameItem, SfxPoolItem ); diff --git a/svl/source/items/tresitem.cxx b/svl/source/items/tresitem.cxx index 4ad6fa3c1b77..3fdf3f750180 100644 --- a/svl/source/items/tresitem.cxx +++ b/svl/source/items/tresitem.cxx @@ -30,7 +30,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svl.hxx" -#include +#include using namespace com::sun::star; diff --git a/svl/source/items/visitem.cxx b/svl/source/items/visitem.cxx index a4f10b98303c..e4ff302541fe 100644 --- a/svl/source/items/visitem.cxx +++ b/svl/source/items/visitem.cxx @@ -30,7 +30,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svl.hxx" -#include +#include #include #include diff --git a/svl/source/items/whiter.cxx b/svl/source/items/whiter.cxx index 4b582900d152..b5e53e0bc278 100644 --- a/svl/source/items/whiter.cxx +++ b/svl/source/items/whiter.cxx @@ -35,7 +35,7 @@ #endif #include "whiter.hxx" -#include +#include DBG_NAME(SfxWhichIter) diff --git a/svl/source/memtools/svarray.cxx b/svl/source/memtools/svarray.cxx index 40a77aefd711..e2fa809c1b52 100644 --- a/svl/source/memtools/svarray.cxx +++ b/svl/source/memtools/svarray.cxx @@ -59,7 +59,7 @@ #define _SVSTDARR_XUB_STRLEN #define _SVSTDARR_XUB_STRLENSORT -#include +#include #include #include diff --git a/svl/source/misc/adrparse.cxx b/svl/source/misc/adrparse.cxx index 2dcece9e2671..b45650846df5 100644 --- a/svl/source/misc/adrparse.cxx +++ b/svl/source/misc/adrparse.cxx @@ -33,12 +33,12 @@ #include #include -namespace unnamed_svtools_adrparse {} -using namespace unnamed_svtools_adrparse; +namespace unnamed_svl_adrparse {} +using namespace unnamed_svl_adrparse; // unnamed namespaces don't work well yet //============================================================================ -namespace unnamed_svtools_adrparse { +namespace unnamed_svl_adrparse { enum ElementType { ELEMENT_START, ELEMENT_DELIM, ELEMENT_ITEM, ELEMENT_END }; diff --git a/svl/source/misc/documentlockfile.cxx b/svl/source/misc/documentlockfile.cxx index 3de51f2fc8c6..b0c4148749e7 100644 --- a/svl/source/misc/documentlockfile.cxx +++ b/svl/source/misc/documentlockfile.cxx @@ -58,7 +58,7 @@ #include -#include +#include using namespace ::com::sun::star; diff --git a/svl/source/misc/flbytes.cxx b/svl/source/misc/flbytes.cxx index ce414be8e838..b8a124f8ec3b 100644 --- a/svl/source/misc/flbytes.cxx +++ b/svl/source/misc/flbytes.cxx @@ -35,15 +35,15 @@ #ifndef _SVSTDARR_ULONGS_DECL #define _SVSTDARR_ULONGS -#include +#include #undef _SVSTDARR_ULONGS #endif -namespace unnamed_svtools_flbytes {} using namespace unnamed_svtools_flbytes; +namespace unnamed_svl_flbytes {} using namespace unnamed_svl_flbytes; // unnamed namespaces don't work well yet //============================================================================ -namespace unnamed_svtools_flbytes { +namespace unnamed_svl_flbytes { inline ULONG MyMin( long a, long b ) { diff --git a/svl/source/misc/inethist.cxx b/svl/source/misc/inethist.cxx index 5dfc2744f67a..290312c0efd8 100644 --- a/svl/source/misc/inethist.cxx +++ b/svl/source/misc/inethist.cxx @@ -30,7 +30,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svl.hxx" -#include +#include #ifndef INCLUDED_ALGORITHM #include diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx index f0e62b798cff..47183be1d7b2 100644 --- a/svl/source/misc/inettype.cxx +++ b/svl/source/misc/inettype.cxx @@ -32,24 +32,24 @@ #include "precompiled_svl.hxx" #include #include -#include -#include +#include +#include #ifndef _SVTOOLS_HRC -#include +#include #endif #ifndef _SVSTDARR_STRINGSSORT_DECL #define _SVSTDARR_STRINGSSORT -#include +#include #undef _SVSTDARR_STRINGSSORT #endif -namespace unnamed_svtools_inettype {} -using namespace unnamed_svtools_inettype; +namespace unnamed_svl_inettype {} +using namespace unnamed_svl_inettype; // unnamed namespaces don't work well yet //============================================================================ -namespace unnamed_svtools_inettype { +namespace unnamed_svl_inettype { //============================================================================ struct MediaTypeEntry @@ -804,7 +804,7 @@ INetContentType Registration::GetContentType4Extension(UniString const & // //============================================================================ -namespace unnamed_svtools_inettype { +namespace unnamed_svl_inettype { MediaTypeEntry const * seekEntry(UniString const & rTypeName, MediaTypeEntry const * pMap, sal_Size nSize) diff --git a/svl/source/misc/lockfilecommon.cxx b/svl/source/misc/lockfilecommon.cxx index 8d0bc0f26415..f13ed574a87f 100644 --- a/svl/source/misc/lockfilecommon.cxx +++ b/svl/source/misc/lockfilecommon.cxx @@ -59,7 +59,7 @@ #include -#include +#include using namespace ::com::sun::star; diff --git a/svl/source/misc/mediatyp.src b/svl/source/misc/mediatyp.src index c7acdf8efc45..63033af29d03 100644 --- a/svl/source/misc/mediatyp.src +++ b/svl/source/misc/mediatyp.src @@ -35,7 +35,7 @@ //============================================================================ #ifndef _SVTOOLS_HRC -#include +#include #endif String STR_SVT_MIMETYPE_APP_OCTSTREAM diff --git a/svl/source/misc/ownlist.cxx b/svl/source/misc/ownlist.cxx index e642f00ba826..def341d57b7c 100644 --- a/svl/source/misc/ownlist.cxx +++ b/svl/source/misc/ownlist.cxx @@ -34,7 +34,7 @@ #include #include -#include +#include using namespace com::sun::star; diff --git a/svl/source/misc/restrictedpaths.cxx b/svl/source/misc/restrictedpaths.cxx index 286b046a5067..3c45d43bdd5b 100644 --- a/svl/source/misc/restrictedpaths.cxx +++ b/svl/source/misc/restrictedpaths.cxx @@ -30,13 +30,13 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svl.hxx" -#include +#include #include #include #include #include -#include +#include namespace svt { diff --git a/svl/source/misc/sharecontrolfile.cxx b/svl/source/misc/sharecontrolfile.cxx index 2a151b24fd26..9249fa3f33de 100644 --- a/svl/source/misc/sharecontrolfile.cxx +++ b/svl/source/misc/sharecontrolfile.cxx @@ -59,7 +59,7 @@ #include -#include +#include using namespace ::com::sun::star; diff --git a/svl/source/misc/svldata.cxx b/svl/source/misc/svldata.cxx index d791e9d9a560..0ba8075069cd 100644 --- a/svl/source/misc/svldata.cxx +++ b/svl/source/misc/svldata.cxx @@ -35,7 +35,7 @@ #include #include #include -#include +#include namespace unnamed_svl_svldata {} using namespace unnamed_svl_svldata; diff --git a/svl/source/misc/urihelper.cxx b/svl/source/misc/urihelper.cxx index 58e21f425bf6..5473bf1c995d 100644 --- a/svl/source/misc/urihelper.cxx +++ b/svl/source/misc/urihelper.cxx @@ -67,8 +67,8 @@ #include #include "rtl/instance.hxx" -namespace unnamed_svtools_urihelper {} -using namespace unnamed_svtools_urihelper; +namespace unnamed_svl_urihelper {} +using namespace unnamed_svl_urihelper; // unnamed namespaces don't work well yet... namespace css = com::sun::star; @@ -80,7 +80,7 @@ using namespace com::sun::star; // //============================================================================ -namespace unnamed_svtools_urihelper { +namespace unnamed_svl_urihelper { inline UniString toUniString(ByteString const & rString) { @@ -425,7 +425,7 @@ rtl::OUString URIHelper::simpleNormalizedMakeRelative( // //============================================================================ -namespace unnamed_svtools_urihelper { +namespace unnamed_svl_urihelper { inline xub_StrLen nextChar(UniString const & rStr, xub_StrLen nPos) { diff --git a/svl/source/notify/brdcst.cxx b/svl/source/notify/brdcst.cxx index 928ec79fe328..08562fe9fece 100644 --- a/svl/source/notify/brdcst.cxx +++ b/svl/source/notify/brdcst.cxx @@ -35,14 +35,14 @@ #endif #include -#include -#include -#include +#include +#include +#include SV_DECL_PTRARR( SfxListenerArr_Impl, SfxListener*, 0, 2 ) #define _SFX_BRDCST_CXX -#include +#include //==================================================================== DBG_NAME(SfxBroadcaster) diff --git a/svl/source/notify/broadcast.cxx b/svl/source/notify/broadcast.cxx index 62c00ff8c414..ede14e4171b2 100644 --- a/svl/source/notify/broadcast.cxx +++ b/svl/source/notify/broadcast.cxx @@ -38,7 +38,7 @@ #include "listener.hxx" #include "listeneriter.hxx" #include "broadcast.hxx" -#include +#include //==================================================================== diff --git a/svl/source/notify/cancel.cxx b/svl/source/notify/cancel.cxx index 12969a4f8e6a..1df3abb22776 100644 --- a/svl/source/notify/cancel.cxx +++ b/svl/source/notify/cancel.cxx @@ -31,13 +31,13 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svl.hxx" #define _SFX_CANCEL_CXX -#include +#include #include #include -#include -#include +#include +#include #include namespace { struct lclMutex : public rtl::Static< ::vos::OMutex, lclMutex >{}; } diff --git a/svl/source/notify/hint.cxx b/svl/source/notify/hint.cxx index 8f48ba28f895..36bcfb9990d9 100644 --- a/svl/source/notify/hint.cxx +++ b/svl/source/notify/hint.cxx @@ -33,7 +33,7 @@ #ifndef GCC #endif -#include +#include //==================================================================== diff --git a/svl/source/notify/isethint.cxx b/svl/source/notify/isethint.cxx index 77c630cd2148..5138fb2a9ad9 100644 --- a/svl/source/notify/isethint.cxx +++ b/svl/source/notify/isethint.cxx @@ -34,8 +34,8 @@ #ifndef GCC #endif -#include -#include +#include +#include //==================================================================== diff --git a/svl/source/notify/lstner.cxx b/svl/source/notify/lstner.cxx index 87afd96365cc..4be2020967b5 100644 --- a/svl/source/notify/lstner.cxx +++ b/svl/source/notify/lstner.cxx @@ -37,13 +37,13 @@ #include #endif -#include -#include +#include +#include SV_DECL_PTRARR( SfxBroadcasterArr_Impl, SfxBroadcaster*, 0, 2 ) #define _SFX_LSTNER_CXX -#include +#include //==================================================================== DBG_NAME(SfxListener) diff --git a/svl/source/notify/smplhint.cxx b/svl/source/notify/smplhint.cxx index bd9933d2dece..454710a1b79f 100644 --- a/svl/source/notify/smplhint.cxx +++ b/svl/source/notify/smplhint.cxx @@ -33,7 +33,7 @@ #ifndef GCC #endif -#include +#include //==================================================================== diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx index 598680c4da75..65ea024a7e34 100644 --- a/svl/source/numbers/numfmuno.cxx +++ b/svl/source/numbers/numfmuno.cxx @@ -45,9 +45,9 @@ #include "numfmuno.hxx" #include "numuno.hxx" -#include -#include -#include +#include +#include +#include using namespace com::sun::star; diff --git a/svl/source/numbers/numuno.cxx b/svl/source/numbers/numuno.cxx index a66a48f0a3f5..e909fb2fd4e8 100644 --- a/svl/source/numbers/numuno.cxx +++ b/svl/source/numbers/numuno.cxx @@ -44,7 +44,7 @@ #include "numuno.hxx" #include "numfmuno.hxx" -#include +#include using namespace com::sun::star; diff --git a/svl/source/numbers/supservs.hxx b/svl/source/numbers/supservs.hxx index df48d6567ecc..7dbbfe27177d 100644 --- a/svl/source/numbers/supservs.hxx +++ b/svl/source/numbers/supservs.hxx @@ -32,7 +32,7 @@ #define _SVTOOLS_NUMBERS_SUPPLIERSERVICE_HXX_ #include "numuno.hxx" -#include +#include #include #include #include diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index b5719f7ac868..372ae2b15abf 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -44,9 +44,9 @@ #include #include -#include // NUMBERFORMAT_XXX +#include // NUMBERFORMAT_XXX #include "zforscan.hxx" -#include +#include #define _ZFORFIND_CXX #include "zforfind.hxx" diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 885a6df53533..76bc6bad2bc0 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -50,21 +50,21 @@ #include #define _SVSTDARR_USHORTS -#include +#include #define _ZFORLIST_CXX #include -#include +#include #undef _ZFORLIST_CXX #include "zforscan.hxx" #include "zforfind.hxx" -#include +#include #include "numhead.hxx" -#include +#include #include "listener.hxx" -#include +#include #include #include #include @@ -237,7 +237,7 @@ SvNumberFormatter::~SvNumberFormatter() void SvNumberFormatter::ImpConstruct( LanguageType eLang ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aTimeLog, "svtools", "er93726", "SvNumberFormatter::ImpConstruct" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aTimeLog, "svl", "er93726", "SvNumberFormatter::ImpConstruct" ); if ( eLang == LANGUAGE_DONTKNOW ) eLang = UNKNOWN_SUBSTITUTE; @@ -307,7 +307,7 @@ void SvNumberFormatter::ChangeIntl(LanguageType eLnge) if( !pMutex ) { // #i77768# Due to a static reference in the toolkit lib - // we need a mutex that lives longer than the svtools library. + // we need a mutex that lives longer than the svl library. // Otherwise the dtor would use a destructed mutex!! pMutex = new ::osl::Mutex; } @@ -3547,7 +3547,7 @@ void SvNumberFormatter::ImpInitCurrencyTable() return ; bInitializing = TRUE; - RTL_LOGFILE_CONTEXT_AUTHOR( aTimeLog, "svtools", "er93726", "SvNumberFormatter::ImpInitCurrencyTable" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aTimeLog, "svl", "er93726", "SvNumberFormatter::ImpInitCurrencyTable" ); LanguageType eSysLang = Application::GetSettings().GetLanguage(); LocaleDataWrapper* pLocaleData = new LocaleDataWrapper( diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 7c7cf6bcc524..52d37b9cd26f 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -49,11 +49,11 @@ #include #define _ZFORMAT_CXX -#include +#include #include "zforscan.hxx" #include "zforfind.hxx" -#include +#include #include "numhead.hxx" #include #include "nfsymbol.hxx" diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx index 9eb939403afd..5c0d45a53ed2 100644 --- a/svl/source/numbers/zforscan.cxx +++ b/svl/source/numbers/zforscan.cxx @@ -41,8 +41,8 @@ #include #include -#include -#include +#include +#include #include #define _ZFORSCAN_CXX diff --git a/svl/source/numbers/zforscan.hxx b/svl/source/numbers/zforscan.hxx index bc19ac5b633f..300715dfeaa5 100644 --- a/svl/source/numbers/zforscan.hxx +++ b/svl/source/numbers/zforscan.hxx @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include "nfsymbol.hxx" class SvNumberFormatter; diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index d5f3c62173e4..237a493452c7 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -1480,7 +1480,7 @@ Sequence< ::rtl::OUString > SAL_CALL PasswordContainer::impl_getStaticSupportedS ::rtl::OUString SAL_CALL PasswordContainer::impl_getStaticImplementationName() throw(uno::RuntimeException) { - return ::rtl::OUString::createFromAscii("stardiv.svtools.PasswordContainer"); + return ::rtl::OUString::createFromAscii("stardiv.svl.PasswordContainer"); } //------------------------------------------------------------------------- @@ -1563,7 +1563,7 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( Reference< XRegistryKey > xNewKey; xNewKey = xRegistryKey->createKey( - ::rtl::OUString::createFromAscii( "/stardiv.svtools.PasswordContainer/UNO/SERVICES" )); + ::rtl::OUString::createFromAscii( "/stardiv.svl.PasswordContainer/UNO/SERVICES" )); xNewKey->createKey( ::rtl::OUString::createFromAscii("com.sun.star.task.PasswordContainer")); return sal_True; diff --git a/svl/source/passwordcontainer/syscreds.cxx b/svl/source/passwordcontainer/syscreds.cxx index b8c223040e6d..ae43c1c70e6b 100644 --- a/svl/source/passwordcontainer/syscreds.cxx +++ b/svl/source/passwordcontainer/syscreds.cxx @@ -112,7 +112,7 @@ void SysCredentialsConfigItem::setSystemCredentialsURLs( namespace { - // TODO: This code is actually copied from svtools/source/passwordcontainer.cxx + // TODO: This code is actually copied from svl/source/passwordcontainer.cxx bool removeLastSegment( ::rtl::OUString & aURL ) { sal_Int32 aInd = aURL.lastIndexOf( sal_Unicode( '/' ) ); @@ -134,7 +134,7 @@ namespace bool findURL( StringSet const & rContainer, rtl::OUString const & aURL, rtl::OUString & aResult ) { - // TODO: This code is actually copied from svtools/source/passwordcontainer.cxx + // TODO: This code is actually copied from svl/source/passwordcontainer.cxx if( !rContainer.empty() && aURL.getLength() ) { ::rtl::OUString aUrl( aURL ); diff --git a/svl/source/svdde/ddecli.cxx b/svl/source/svdde/ddecli.cxx index 8f6f72c655df..3c224efe89a1 100644 --- a/svl/source/svdde/ddecli.cxx +++ b/svl/source/svdde/ddecli.cxx @@ -34,7 +34,7 @@ #define UNICODE #include // memset #include "ddeimp.hxx" -#include +#include #include #include diff --git a/svl/source/svdde/ddedata.cxx b/svl/source/svdde/ddedata.cxx index 765c5feff0ba..8ae22a8cfb20 100644 --- a/svl/source/svdde/ddedata.cxx +++ b/svl/source/svdde/ddedata.cxx @@ -40,7 +40,7 @@ #include #include "ddeimp.hxx" -#include +#include #include diff --git a/svl/source/svdde/ddeinf.cxx b/svl/source/svdde/ddeinf.cxx index 923f1a725046..b5154e1f7530 100644 --- a/svl/source/svdde/ddeinf.cxx +++ b/svl/source/svdde/ddeinf.cxx @@ -35,7 +35,7 @@ #include #include "ddeimp.hxx" -#include +#include // --- DdeInternal::InfCallback() ---------------------------------- diff --git a/svl/source/svdde/ddestrg.cxx b/svl/source/svdde/ddestrg.cxx index 27e36162a187..9cd594a7920d 100644 --- a/svl/source/svdde/ddestrg.cxx +++ b/svl/source/svdde/ddestrg.cxx @@ -34,7 +34,7 @@ #define UNICODE #include "ddeimp.hxx" -#include +#include #if defined( WIN ) && defined( MSC ) #pragma code_seg( "SVDDE_MISC_CODE" ) diff --git a/svl/source/svdde/ddesvr.cxx b/svl/source/svdde/ddesvr.cxx index 45461cf0006c..9b7a4b4e15bf 100644 --- a/svl/source/svdde/ddesvr.cxx +++ b/svl/source/svdde/ddesvr.cxx @@ -33,8 +33,8 @@ #define UNICODE #include "ddeimp.hxx" -#include -#include +#include +#include #include #include diff --git a/svl/source/syslocale/syslocale.cxx b/svl/source/syslocale/syslocale.cxx index 97db482f4409..074e900ea9ab 100644 --- a/svl/source/syslocale/syslocale.cxx +++ b/svl/source/syslocale/syslocale.cxx @@ -33,13 +33,13 @@ #ifndef GCC #endif -#include +#include #include #include -#include +#include #include #include -#include +#include #include #include @@ -143,7 +143,7 @@ Mutex& SvtSysLocale::GetMutex() if( !pMutex ) { // #i77768# Due to a static reference in the toolkit lib - // we need a mutex that lives longer than the svtools library. + // we need a mutex that lives longer than the svl library. // Otherwise the dtor would use a destructed mutex!! pMutex = new Mutex; } diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx index 49999834a8ff..a8442098237e 100644 --- a/svl/source/undo/undo.cxx +++ b/svl/source/undo/undo.cxx @@ -35,7 +35,7 @@ #include -#include +#include using ::com::sun::star::uno::Exception; @@ -313,7 +313,7 @@ USHORT SfxUndoManager::GetUndoActionCount() const XubString SfxUndoManager::GetUndoActionComment( USHORT nNo ) const { - DBG_ASSERT( nNo < pActUndoArray->nCurUndoAction, "svtools::SfxUndoManager::GetUndoActionComment(), illegal id!" ); + DBG_ASSERT( nNo < pActUndoArray->nCurUndoAction, "svl::SfxUndoManager::GetUndoActionComment(), illegal id!" ); if( nNo < pActUndoArray->nCurUndoAction ) { return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1-nNo]->GetComment(); //! @@ -329,7 +329,7 @@ XubString SfxUndoManager::GetUndoActionComment( USHORT nNo ) const USHORT SfxUndoManager::GetUndoActionId( USHORT nNo ) const { - DBG_ASSERT( nNo < pActUndoArray->nCurUndoAction, "svtools::SfxUndoManager::GetUndoActionId(), illegal id!" ); + DBG_ASSERT( nNo < pActUndoArray->nCurUndoAction, "svl::SfxUndoManager::GetUndoActionId(), illegal id!" ); if( nNo < pActUndoArray->nCurUndoAction ) { return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1-nNo]->GetId(); //! @@ -344,7 +344,7 @@ USHORT SfxUndoManager::GetUndoActionId( USHORT nNo ) const SfxUndoAction* SfxUndoManager::GetUndoAction( USHORT nNo ) const { - DBG_ASSERT( nNo < pActUndoArray->nCurUndoAction, "svtools::SfxUndoManager::GetUndoAction(), illegal id!" ); + DBG_ASSERT( nNo < pActUndoArray->nCurUndoAction, "svl::SfxUndoManager::GetUndoAction(), illegal id!" ); if( nNo < pActUndoArray->nCurUndoAction ) { return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1-nNo]; //! @@ -360,7 +360,7 @@ SfxUndoAction* SfxUndoManager::GetUndoAction( USHORT nNo ) const /** clears the redo stack and removes the top undo action */ void SfxUndoManager::RemoveLastUndoAction() { - DBG_ASSERT( pActUndoArray->nCurUndoAction, "svtools::SfxUndoManager::RemoveLastUndoAction(), no action to remove?!" ); + DBG_ASSERT( pActUndoArray->nCurUndoAction, "svl::SfxUndoManager::RemoveLastUndoAction(), no action to remove?!" ); if( pActUndoArray->nCurUndoAction ) { pActUndoArray->nCurUndoAction--; @@ -387,7 +387,7 @@ BOOL SfxUndoManager::Undo( USHORT ) try { - DBG_ASSERT( pActUndoArray == pUndoArray, "svtools::SfxUndoManager::Undo(), LeaveListAction() not yet called!" ); + DBG_ASSERT( pActUndoArray == pUndoArray, "svl::SfxUndoManager::Undo(), LeaveListAction() not yet called!" ); if ( pActUndoArray->nCurUndoAction ) { Undo( *pActUndoArray->aUndoActions[ --pActUndoArray->nCurUndoAction ] ); @@ -587,11 +587,11 @@ void SfxUndoManager::LeaveListAction() if( pActUndoArray == pUndoArray ) { - DBG_ERROR( "svtools::SfxUndoManager::LeaveListAction(), called without calling EnterListAction()!" ); + DBG_ERROR( "svl::SfxUndoManager::LeaveListAction(), called without calling EnterListAction()!" ); return; } - DBG_ASSERT(pActUndoArray->pFatherUndoArray,"svtools::SfxUndoManager::LeaveListAction(), no father undo array!?"); + DBG_ASSERT(pActUndoArray->pFatherUndoArray,"svl::SfxUndoManager::LeaveListAction(), no father undo array!?"); SfxUndoArray* pTmp=pActUndoArray; pActUndoArray=pActUndoArray->pFatherUndoArray; diff --git a/svl/source/uno/pathservice.cxx b/svl/source/uno/pathservice.cxx index e54a96bf30ce..78c339773aec 100644 --- a/svl/source/uno/pathservice.cxx +++ b/svl/source/uno/pathservice.cxx @@ -54,7 +54,7 @@ public: virtual OUString SAL_CALL getImplementationName() throw(css::uno::RuntimeException) { - return OUString::createFromAscii("com.sun.star.comp.svtools.PathService"); + return OUString::createFromAscii("com.sun.star.comp.svl.PathService"); } virtual sal_Bool SAL_CALL supportsService ( diff --git a/svl/source/uno/registerservices.cxx b/svl/source/uno/registerservices.cxx index 1f761123ae56..daaf799bffea 100644 --- a/svl/source/uno/registerservices.cxx +++ b/svl/source/uno/registerservices.cxx @@ -84,7 +84,7 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( OUString::createFromAscii( "com.sun.star.util.NumberFormatter" ) ); xNewKey = xRegistryKey->createKey( - OUString::createFromAscii( "/com.sun.star.comp.svtools.PathService/UNO/SERVICES" ) ); + OUString::createFromAscii( "/com.sun.star.comp.svl.PathService/UNO/SERVICES" ) ); xNewKey->createKey ( OUString::createFromAscii( "com.sun.star.config.SpecialConfigManager" ) ); @@ -129,7 +129,7 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory ( aServiceNames); } else if (rtl_str_compare ( - pImplementationName, "com.sun.star.comp.svtools.PathService") == 0) + pImplementationName, "com.sun.star.comp.svl.PathService") == 0) { Sequence< OUString > aServiceNames(1); aServiceNames.getArray()[0] = diff --git a/svl/unx/source/svdde/ddedummy.cxx b/svl/unx/source/svdde/ddedummy.cxx index aa1ccad80630..2aec705bc7ef 100644 --- a/svl/unx/source/svdde/ddedummy.cxx +++ b/svl/unx/source/svdde/ddedummy.cxx @@ -30,7 +30,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svl.hxx" -#include +#include #include DdeData::DdeData() -- cgit From 62c0e0c6b18e5e7a9d0ce9d6c53f4c3b1ba5204e Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Thu, 8 Oct 2009 18:23:23 +0200 Subject: #i103496#: make svtools buildable --- svtools/inc/svtools/menuoptions.hxx | 6 +- svtools/inc/svtools/optionsdrawinglayer.hxx | 6 +- svtools/inc/svtools/svtdata.hxx | 33 +-- svtools/prj/build.lst | 69 ++--- svtools/prj/d.lst | 104 +------ svtools/source/config/accessibilityoptions.cxx | 5 - svtools/source/config/apearcfg.cxx | 5 - svtools/source/config/colorcfg.cxx | 5 - svtools/source/config/extcolorcfg.cxx | 7 +- svtools/source/config/fontsubstconfig.cxx | 5 - svtools/source/config/helpopt.cxx | 5 - svtools/source/config/itemholder2.cxx | 30 -- svtools/source/config/makefile.mk | 21 +- svtools/source/config/miscopt.cxx | 4 - svtools/source/config/printoptions.cxx | 5 - svtools/source/control/fileurlbox.cxx | 2 +- svtools/source/control/inettbc.cxx | 2 +- svtools/source/control/makefile.mk | 1 - svtools/source/control/reginfo.cxx | 375 ------------------------- svtools/source/control/urlcontrol.cxx | 6 +- svtools/source/dialogs/addresstemplate.cxx | 2 +- svtools/source/dialogs/printdlg.cxx | 2 +- svtools/source/edit/textview.cxx | 2 +- svtools/source/filter.vcl/filter/makefile.mk | 2 + svtools/source/filter.vcl/igif/makefile.mk | 1 + svtools/source/filter.vcl/ixbm/makefile.mk | 1 + svtools/source/filter.vcl/ixpm/makefile.mk | 1 + svtools/source/filter.vcl/jpeg/makefile.mk | 2 + svtools/source/misc/embedhlp.cxx | 1 + svtools/source/misc/imagemgr.cxx | 1 + svtools/source/misc/imap.cxx | 2 +- svtools/source/misc/imap2.cxx | 2 +- svtools/source/misc/makefile.mk | 37 +-- svtools/source/misc/svtdata.cxx | 44 +-- svtools/source/misc/transfer.cxx | 2 +- svtools/source/misc/transfer2.cxx | 2 +- svtools/source/svhtml/htmlout.cxx | 2 +- svtools/source/uno/makefile.mk | 2 +- svtools/source/uno/unoiface.cxx | 2 +- svtools/util/makefile.mk | 110 +------- 40 files changed, 106 insertions(+), 810 deletions(-) delete mode 100644 svtools/source/control/reginfo.cxx diff --git a/svtools/inc/svtools/menuoptions.hxx b/svtools/inc/svtools/menuoptions.hxx index 19eddb75bf35..6b01ad6079e5 100644 --- a/svtools/inc/svtools/menuoptions.hxx +++ b/svtools/inc/svtools/menuoptions.hxx @@ -34,7 +34,7 @@ // includes //_________________________________________________________________________________________________________________ -#include "svtools/svldllapi.h" +#include "svtools/svtdllapi.h" #include #include #include @@ -67,7 +67,7 @@ class SvtMenuOptions_Impl; @devstatus ready to use *//*-*************************************************************************************************************/ -class SVL_DLLPUBLIC SvtMenuOptions: public utl::detail::Options +class SVT_DLLPUBLIC SvtMenuOptions: public utl::detail::Options { //------------------------------------------------------------------------------------------------------------- // public methods @@ -148,7 +148,7 @@ class SVL_DLLPUBLIC SvtMenuOptions: public utl::detail::Options @onerror - *//*-*****************************************************************************************************/ - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); + SVT_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); //------------------------------------------------------------------------------------------------------------- // private member diff --git a/svtools/inc/svtools/optionsdrawinglayer.hxx b/svtools/inc/svtools/optionsdrawinglayer.hxx index 120cccfa4232..18ce9c65e897 100644 --- a/svtools/inc/svtools/optionsdrawinglayer.hxx +++ b/svtools/inc/svtools/optionsdrawinglayer.hxx @@ -35,7 +35,7 @@ // includes //_________________________________________________________________________________________________________________ -#include "svtools/svldllapi.h" +#include "svtools/svtdllapi.h" #include #include #include @@ -68,7 +68,7 @@ class SvtOptionsDrawinglayer_Impl; @devstatus ready to use *//*-*************************************************************************************************************/ -class SVL_DLLPUBLIC SvtOptionsDrawinglayer +class SVT_DLLPUBLIC SvtOptionsDrawinglayer { //------------------------------------------------------------------------------------------------------------- // public methods @@ -217,7 +217,7 @@ class SVL_DLLPUBLIC SvtOptionsDrawinglayer @onerror - *//*-*****************************************************************************************************/ - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); + SVT_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); //------------------------------------------------------------------------------------------------------------- // private member diff --git a/svtools/inc/svtools/svtdata.hxx b/svtools/inc/svtools/svtdata.hxx index c929faad3d13..b1cc8136ef68 100644 --- a/svtools/inc/svtools/svtdata.hxx +++ b/svtools/inc/svtools/svtdata.hxx @@ -32,34 +32,22 @@ #define _SVTOOLS_SVTDATA_HXX #include -#include +#include class ResMgr; class SfxItemDesruptorList_Impl; -class SfxItemPool; -class Twain; //============================================================================ class ImpSvtData { public: - Twain * pTwain; - const SfxItemPool * pStoringPool; SfxItemDesruptorList_Impl * pItemDesruptList; - ResMgr * pResMgr; ResMgr * pPatchResMgr; - void* m_pThreadsafeRMs; - // one SimpleResMgr for each language for which a resource was requested - // (When using the 'non-simple' resmgr, the first request for any language wins, any - // further request for any other language supply the resmgr of the first call. - // For the simple resmgr we have a mgr for each language ever requested). - private: ImpSvtData(): - pTwain(0), pStoringPool(0), pItemDesruptList(0), pResMgr(0), - pPatchResMgr(NULL), m_pThreadsafeRMs(NULL) + pItemDesruptList(0), pResMgr(0), pPatchResMgr(0) {} ~ImpSvtData(); @@ -67,13 +55,9 @@ private: public: ResMgr * GetResMgr(const ::com::sun::star::lang::Locale aLocale); ResMgr * GetResMgr(); // VCL dependant, only available in SVT, not in SVL! - ResMgr * GetPatchResMgr(); ResMgr * GetPatchResMgr(const ::com::sun::star::lang::Locale& aLocale); - - SimpleResMgr * GetSimpleRM(const ::com::sun::star::lang::Locale& rLocale); - static ImpSvtData & GetSvtData(); }; @@ -100,18 +84,5 @@ public: // VCL dependant, only available in SVT, not in SVL! }; -//============================================================================ -class SvtSimpleResId -{ - String m_sValue; - -public: - SvtSimpleResId(USHORT nId, const ::com::sun::star::lang::Locale aLocale) : m_sValue(ImpSvtData::GetSvtData().GetSimpleRM(aLocale)->ReadString(nId)) { }; - - operator String () const { return m_sValue; } -}; - - - #endif // _SVTOOLS_SVTDATA_HXX diff --git a/svtools/prj/build.lst b/svtools/prj/build.lst index a60199740561..5a67b9414181 100644 --- a/svtools/prj/build.lst +++ b/svtools/prj/build.lst @@ -1,55 +1,28 @@ -st svtools : l10n offuh toolkit ucbhelper unotools JPEG:jpeg cppu cppuhelper comphelper sal sot jvmfwk NULL -st svtools usr1 - all st_mkout NULL -st svtools\inc nmake - all st_inc NULL -st svtools\inc\sane get - all st_incsa NULL -st svtools\prj get - all st_prj NULL -st svtools\res get - all st_res NULL -st svtools\win\inc get - all st_winc NULL -st svtools\win\res get - all st_wres NULL -st svtools\os2\inc get - all st_oinc NULL -st svtools\mac\inc get - all st_minc NULL -st svtools\unx\inc get - all st_uinc NULL -st svtools\bmpmaker nmake - all st_bmp st_inc NULL -st svtools\source\memtools nmake - all st_mem st_inc NULL -st svtools\source\numbers nmake - all st_num st_inc NULL -st svtools\source\notify nmake - all st_not st_inc NULL -st svtools\source\config nmake - all st_conf st_inc NULL -st svtools\unx\source\svdde nmake - u st_usdde st_inc NULL -st svtools\unx\source\svdde nmake - p st_psdde st_inc NULL -st svtools\mac\source\svdde nmake - m st_msdde st_inc NULL -st svtools\mac\source\misc nmake - m st_msc st_inc NULL -st svtools\source\control nmake - all st_ctl st_inc NULL -st svtools\source\filerec nmake - all st_file st_inc NULL -st svtools\source\filter.vcl\filter nmake - all st_vfilt st_inc NULL -st svtools\source\filter.vcl\wmf nmake - all st_vwmf st_inc NULL -st svtools\source\filter.vcl\igif nmake - all st_vigif st_inc NULL -st svtools\source\filter.vcl\jpeg nmake - all st_vjpeg st_inc NULL -st svtools\source\filter.vcl\ixbm nmake - all st_vixbm st_inc NULL -st svtools\source\filter.vcl\ixpm nmake - all st_vixpm st_inc NULL +st svtools : l10n svl offuh toolkit ucbhelper unotools JPEG:jpeg cppu cppuhelper comphelper sal sot jvmfwk NULL +st svtools usr1 - all st_mkout NULL +st svtools\inc nmake - all st_inc NULL +st svtools\bmpmaker nmake - all st_bmp st_inc NULL st svtools\source\brwbox nmake - all st__brw st_bmp st_inc NULL -st svtools\source\urlobj nmake - all st__url st_inc NULL -st svtools\source\misc nmake - all st__misc st_bmp st_inc NULL -st svtools\source\misc1 nmake - all st__misc1 st_inc NULL +st svtools\source\config nmake - all st_conf st_inc NULL st svtools\source\contnr nmake - all st__ctr st_inc NULL -st svtools\source\svdde nmake - all st__dde st_inc NULL -st svtools\source\items nmake - all st__item st_inc NULL -st svtools\source\items1 nmake - all st__item1 st_inc NULL -st svtools\source\undo nmake - all st_undo st_inc NULL -st svtools\source\plugapp nmake - all st_papp st_inc NULL +st svtools\source\control nmake - all st_ctl st_inc NULL st svtools\source\dialogs nmake - all st_dial st_inc NULL -st svtools\source\edit nmake - all st_edit st_inc NULL -st svtools\source\table nmake - all st_table st_inc NULL -st svtools\source\uno nmake - all st_uno st_inc NULL -st svtools\source\svrtf nmake - all st_rtf st_inc NULL -st svtools\source\svsql nmake - all st_sql st_inc NULL +st svtools\source\edit nmake - all st_edit st_inc NULL +st svtools\source\filter.vcl\filter nmake - all st_vfilt st_inc NULL +st svtools\source\filter.vcl\wmf nmake - all st_vwmf st_inc NULL +st svtools\source\filter.vcl\igif nmake - all st_vigif st_inc NULL +st svtools\source\filter.vcl\jpeg nmake - all st_vjpeg st_inc NULL +st svtools\source\filter.vcl\ixbm nmake - all st_vixbm st_inc NULL +st svtools\source\filter.vcl\ixpm nmake - all st_vixpm st_inc NULL +st svtools\source\java nmake - all st_svtjava st_inc NULL +st svtools\source\misc nmake - all st__misc st_bmp st_inc NULL +st svtools\source\plugapp nmake - all st_papp st_inc NULL st svtools\source\svhtml nmake - all st_html st_inc NULL -st svtools\source\syslocale nmake - all st_sysloc st_inc NULL -st svtools\source\filepicker nmake - all st_filepick st_inc NULL -st svtools\util nmake - all st_util st__brw st__ctr st__dde st__item st__item1 st__misc st__misc1 st__url st_ctl st_dial st_edit st_file st_html st_papp st_rtf st_sql st_usdde.u st_psdde.p st_msdde.m st_msc.m st_undo st_table st_uno st_vfilt st_vigif st_vixbm st_vixpm st_vjpeg st_vwmf st_sysloc st_filepick st_not st_conf st_mem st_num st_svtjava NULL -st svtools\source\fsstor nmake - all st_fsstor st_inc NULL +st svtools\source\svrtf nmake - all st_rtf st_inc NULL +st svtools\source\table nmake - all st_table st_inc NULL +st svtools\source\uno nmake - all st_uno st_inc NULL +st svtools\source\urlobj nmake - all st__url st_inc NULL +st svtools\util nmake - all st_util st__brw st__ctr st_conf st_ctl st_dial st_edit st__misc st__url st_html st_papp st_rtf st_table st_uno st_vfilt st_vigif st_vixbm st_vixpm st_vjpeg st_vwmf st_svtjava NULL st svtools\source\hatchwindow nmake - all st_hatchwin st_inc NULL -st svtools\source\passwordcontainer nmake - all st_passcont st_inc NULL st svtools\source\productregistration nmake - all st_prodreg st_util st_inc NULL -st svtools\uno nmake - all st_svtuno st_util st_inc NULL -st svtools\source\java nmake - all st_svtjava st_inc NULL st svtools\workben\unodialog nmake - all st_workben_udlg st_util NULL diff --git a/svtools/prj/d.lst b/svtools/prj/d.lst index a3a7679f8aea..0a3ccd8a9819 100644 --- a/svtools/prj/d.lst +++ b/svtools/prj/d.lst @@ -5,11 +5,8 @@ mkdir: %_DEST%\inc%_EXT%\svtools ..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid ..\%__SRC%\srs\ehdl.srs %_DEST%\res%_EXT%\svtools.srs ..\%COMMON_OUTDIR%\srs\ehdl_srs.hid %COMMON_DEST%\res%_EXT%\svtools_srs.hid -..\%__SRC%\lib\isvl.lib %_DEST%\lib%_EXT%\isvl.lib ..\%__SRC%\lib\svtool.lib %_DEST%\lib%_EXT%\svtool.lib ..\%__SRC%\slb\svt.lib %_DEST%\lib%_EXT%\xsvtool.lib -..\%__SRC%\bin\dllver.exe %_DEST%\bin%_EXT%\dllver.exe -..\%__SRC%\bin\dllver %_DEST%\bin%_EXT%\dllver ..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\* ..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\* ..\%__SRC%\bin\bmp.* %_DEST%\bin%_EXT%\bmp.* @@ -28,104 +25,9 @@ mkdir: %_DEST%\inc%_EXT%\svtools ..\inc\svtools\*.hxx %_DEST%\inc%_EXT%\svtools\*.hxx ..\inc\svtools\*.h %_DEST%\inc%_EXT%\svtools\*.h ..\inc\svtools\*.hrc %_DEST%\inc%_EXT%\svtools\*.hrc - -..\inc\imagemgr.hxx %_DEST%\inc%_EXT%\svtools\imagemgr.hxx -..\inc\imagemgr.hrc %_DEST%\inc%_EXT%\svtools\imagemgr.hrc -..\inc\testtool.hxx %_DEST%\inc%_EXT%\svtools\testtool.hxx -..\inc\flbytes.hxx %_DEST%\inc%_EXT%\svtools\flbytes.hxx -..\inc\adrparse.hxx %_DEST%\inc%_EXT%\svtools\adrparse.hxx -..\inc\broadcast.hxx %_DEST%\inc%_EXT%\svtools\broadcast.hxx -..\inc\calendar.hxx %_DEST%\inc%_EXT%\svtools\calendar.hxx -..\inc\cntnrsrt.hxx %_DEST%\inc%_EXT%\svtools\cntnrsrt.hxx -..\inc\ctrlbox.hxx %_DEST%\inc%_EXT%\svtools\ctrlbox.hxx -..\inc\ctrltool.hxx %_DEST%\inc%_EXT%\svtools\ctrltool.hxx -..\inc\collatorres.hxx %_DEST%\inc%_EXT%\svtools\collatorres.hxx -..\inc\indexentryres.hxx %_DEST%\inc%_EXT%\svtools\indexentryres.hxx -..\inc\cntwids.hrc %_DEST%\inc%_EXT%\svtools\cntwids.hrc -..\inc\itemdel.hxx %_DEST%\inc%_EXT%\svtools\itemdel.hxx -..\inc\wallitem.hxx %_DEST%\inc%_EXT%\svtools\wallitem.hxx -..\inc\stylepool.hxx %_DEST%\inc%_EXT%\svtools\stylepool.hxx -..\inc\dialogcontrolling.hxx %_DEST%\inc%_EXT%\svtools\dialogcontrolling.hxx -..\inc\filedlg.hxx %_DEST%\inc%_EXT%\svtools\filedlg.hxx -..\inc\fltdefs.hxx %_DEST%\inc%_EXT%\svtools\fltdefs.hxx -..\inc\imgdef.hxx %_DEST%\inc%_EXT%\svtools\imgdef.hxx -..\inc\inetdef.hxx %_DEST%\inc%_EXT%\svtools\inetdef.hxx -..\inc\inetmsg.hxx %_DEST%\inc%_EXT%\svtools\inetmsg.hxx -..\inc\inetstrm.hxx %_DEST%\inc%_EXT%\svtools\inetstrm.hxx -..\inc\listener.hxx %_DEST%\inc%_EXT%\svtools\listener.hxx -..\inc\listeneriter.hxx %_DEST%\inc%_EXT%\svtools\listeneriter.hxx -..\inc\memberid.hrc %_DEST%\inc%_EXT%\svtools\memberid.hrc -..\inc\prgsbar.hxx %_DEST%\inc%_EXT%\svtools\prgsbar.hxx -..\inc\poolcach.hxx %_DEST%\inc%_EXT%\svtools\poolcach.hxx -..\inc\ruler.hxx %_DEST%\inc%_EXT%\svtools\ruler.hxx -..\inc\scrwin.hxx %_DEST%\inc%_EXT%\svtools\scrwin.hxx -..\inc\scriptedtext.hxx %_DEST%\inc%_EXT%\svtools\scriptedtext.hxx -..\inc\tabbar.hxx %_DEST%\inc%_EXT%\svtools\tabbar.hxx -..\inc\taskbar.hxx %_DEST%\inc%_EXT%\svtools\taskbar.hxx -..\inc\whiter.hxx %_DEST%\inc%_EXT%\svtools\whiter.hxx -..\inc\stdmenu.hxx %_DEST%\inc%_EXT%\svtools\stdmenu.hxx -..\inc\tooltiplbox.hxx %_DEST%\inc%_EXT%\svtools\tooltiplbox.hxx -..\inc\txtattr.hxx %_DEST%\inc%_EXT%\svtools\txtattr.hxx -..\inc\sychconv.hxx %_DEST%\inc%_EXT%\svtools\sychconv.hxx -..\inc\cliplistener.hxx %_DEST%\inc%_EXT%\svtools\cliplistener.hxx -..\inc\txtcmp.hxx %_DEST%\inc%_EXT%\svtools\txtcmp.hxx -..\inc\urlbmk.hxx %_DEST%\inc%_EXT%\svtools\urlbmk.hxx -..\inc\inetimg.hxx %_DEST%\inc%_EXT%\svtools\inetimg.hxx -..\inc\nfsymbol.hxx %_DEST%\inc%_EXT%\svtools\nfsymbol.hxx -..\inc\numuno.hxx %_DEST%\inc%_EXT%\svtools\numuno.hxx -..\inc\imageresourceaccess.hxx %_DEST%\inc%_EXT%\svtools\imageresourceaccess.hxx -..\inc\addresstemplate.hxx %_DEST%\inc%_EXT%\svtools\addresstemplate.hxx -..\inc\templatefoldercache.hxx %_DEST%\inc%_EXT%\svtools\templatefoldercache.hxx -..\inc\folderrestriction.hxx %_DEST%\inc%_EXT%\svtools\folderrestriction.hxx -..\inc\filenotation.hxx %_DEST%\inc%_EXT%\svtools\filenotation.hxx -..\inc\framestatuslistener.hxx %_DEST%\inc%_EXT%\svtools\framestatuslistener.hxx -..\inc\statusbarcontroller.hxx %_DEST%\inc%_EXT%\svtools\statusbarcontroller.hxx -..\inc\htmltokn.h %_DEST%\inc%_EXT%\svtools\htmltokn.h -..\inc\htmlkywd.hxx %_DEST%\inc%_EXT%\svtools\htmlkywd.hxx -..\source\svrtf\rtfout.hxx %_DEST%\inc%_EXT%\svtools\rtfout.hxx -..\source\svrtf\rtftoken.h %_DEST%\inc%_EXT%\svtools\rtftoken.h -..\source\svrtf\rtfkeywd.hxx %_DEST%\inc%_EXT%\svtools\rtfkeywd.hxx -..\inc\strmadpt.hxx %_DEST%\inc%_EXT%\svtools\strmadpt.hxx -..\inc\instrm.hxx %_DEST%\inc%_EXT%\svtools\instrm.hxx -..\inc\outstrm.hxx %_DEST%\inc%_EXT%\svtools\outstrm.hxx -..\inc\sectctr.hxx %_DEST%\inc%_EXT%\svtools\sectctr.hxx -..\inc\privsplt.hxx %_DEST%\inc%_EXT%\svtools\privsplt.hxx -..\inc\expander.hxx %_DEST%\inc%_EXT%\svtools\expander.hxx -..\source\svsql\converter.hxx %_DEST%\inc%_EXT%\svtools\converter.hxx -..\inc\filectrl.hxx %_DEST%\inc%_EXT%\svtools\filectrl.hxx -..\inc\sfxecode.hxx %_DEST%\inc%_EXT%\svtools\sfxecode.hxx -..\source\dialogs\filedlg2.hrc %_DEST%\inc%_EXT%\svtools\filedlg2.hrc -..\inc\xmlement.hxx %_DEST%\inc%_EXT%\svtools\xmlement.hxx -..\inc\urihelper.hxx %_DEST%\inc%_EXT%\svtools\urihelper.hxx -..\inc\reginfo.hxx %_DEST%\inc%_EXT%\svtools\reginfo.hxx -..\inc\fstathelper.hxx %_DEST%\inc%_EXT%\svtools\fstathelper.hxx -..\inc\localresaccess.hxx %_DEST%\inc%_EXT%\svtools\localresaccess.hxx -..\inc\roadmap.hxx %_DEST%\inc%_EXT%\svtools\roadmap.hxx -..\inc\helpagentwindow.hxx %_DEST%\inc%_EXT%\svtools\helpagentwindow.hxx -..\inc\pickerhistory.hxx %_DEST%\inc%_EXT%\svtools\pickerhistory.hxx -..\inc\pickerhistoryaccess.hxx %_DEST%\inc%_EXT%\svtools\pickerhistoryaccess.hxx -..\inc\pickerhelper.hxx %_DEST%\inc%_EXT%\svtools\pickerhelper.hxx -..\inc\lngmisc.hxx %_DEST%\inc%_EXT%\svtools\lngmisc.hxx -..\inc\PasswordHelper.hxx %_DEST%\inc%_EXT%\svtools\PasswordHelper.hxx -..\inc\unoimap.hxx %_DEST%\inc%_EXT%\svtools\unoimap.hxx -..\inc\unoevent.hxx %_DEST%\inc%_EXT%\svtools\unoevent.hxx -..\inc\ivctrl.hxx %_DEST%\inc%_EXT%\svtools\ivctrl.hxx -..\inc\fileview.hxx %_DEST%\inc%_EXT%\svtools\fileview.hxx -..\inc\templdlg.hxx %_DEST%\inc%_EXT%\svtools\templdlg.hxx -..\inc\asynclink.hxx %_DEST%\inc%_EXT%\svtools\asynclink.hxx -..\inc\controldims.hrc %_DEST%\inc%_EXT%\svtools\controldims.hrc -..\inc\soerr.hxx %_DEST%\inc%_EXT%\svtools\soerr.hxx -..\inc\sores.hxx %_DEST%\inc%_EXT%\svtools\sores.hxx -..\inc\textwindowaccessibility.hxx %_DEST%\inc%_EXT%\svtools\textwindowaccessibility.hxx -..\inc\fontsubstconfig.hxx %_DEST%\inc%_EXT%\svtools\fontsubstconfig.hxx -..\inc\apearcfg.hxx %_DEST%\inc%_EXT%\svtools\apearcfg.hxx -..\inc\misccfg.hxx %_DEST%\inc%_EXT%\svtools\misccfg.hxx -..\inc\acceleratorexecute.hxx %_DEST%\inc%_EXT%\svtools\acceleratorexecute.hxx -..\inc\QueryFolderName.hxx %_DEST%\inc%_EXT%\svtools\QueryFolderName.hxx -..\inc\DocumentInfoPreview.hxx %_DEST%\inc%_EXT%\svtools\DocumentInfoPreview.hxx -..\inc\dialogclosedlistener.hxx %_DEST%\inc%_EXT%\svtools\dialogclosedlistener.hxx -..\inc\contextmenuhelper.hxx %_DEST%\inc%_EXT%\svtools\contextmenuhelper.hxx -..\inc\extcolorcfg.hxx %_DEST%\inc%_EXT%\svtools\extcolorcfg.hxx +..\inc\*.hxx %_DEST%\inc%_EXT%\svtools\*.hxx +..\inc\*.h %_DEST%\inc%_EXT%\svtools\*.h +..\inc\*.hrc %_DEST%\inc%_EXT%\svtools\*.hrc dos: sh -c "if test %OS% = MACOSX; then macosx-create-bundle %_DEST%\bin%_EXT%\bmp=%__PRJROOT%\%__SRC%\bin%_EXT%; fi" diff --git a/svtools/source/config/accessibilityoptions.cxx b/svtools/source/config/accessibilityoptions.cxx index bbe9c65ede9e..147d0fea5c59 100644 --- a/svtools/source/config/accessibilityoptions.cxx +++ b/svtools/source/config/accessibilityoptions.cxx @@ -31,11 +31,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION - #include #include "configitems/accessibilityoptions_const.hxx" diff --git a/svtools/source/config/apearcfg.cxx b/svtools/source/config/apearcfg.cxx index 35a07a715dd5..ccfc402ac221 100644 --- a/svtools/source/config/apearcfg.cxx +++ b/svtools/source/config/apearcfg.cxx @@ -31,11 +31,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION - #include "apearcfg.hxx" #include "com/sun/star/uno/Any.hxx" diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx index 0c39fde11390..f600be830b41 100644 --- a/svtools/source/config/colorcfg.cxx +++ b/svtools/source/config/colorcfg.cxx @@ -31,11 +31,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION - #include #include #include diff --git a/svtools/source/config/extcolorcfg.cxx b/svtools/source/config/extcolorcfg.cxx index 4610a1571baf..66dfd8af1ebb 100644 --- a/svtools/source/config/extcolorcfg.cxx +++ b/svtools/source/config/extcolorcfg.cxx @@ -27,11 +27,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" #include "extcolorcfg.hxx" #include diff --git a/svtools/source/config/fontsubstconfig.cxx b/svtools/source/config/fontsubstconfig.cxx index 8fe799dec67a..4d1c9b7db5c5 100644 --- a/svtools/source/config/fontsubstconfig.cxx +++ b/svtools/source/config/fontsubstconfig.cxx @@ -31,11 +31,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION - #include "fontsubstconfig.hxx" #include #include diff --git a/svtools/source/config/helpopt.cxx b/svtools/source/config/helpopt.cxx index 0ca09c176072..16982a695e11 100644 --- a/svtools/source/config/helpopt.cxx +++ b/svtools/source/config/helpopt.cxx @@ -31,11 +31,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION - #include #include #include diff --git a/svtools/source/config/itemholder2.cxx b/svtools/source/config/itemholder2.cxx index d0e5b30007f9..759fabbee686 100644 --- a/svtools/source/config/itemholder2.cxx +++ b/svtools/source/config/itemholder2.cxx @@ -31,11 +31,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION - #include "itemholder2.hxx" //----------------------------------------------- @@ -45,16 +40,11 @@ #include #include -#include #include #include -#include #include #include -#include -#include #include -#include #include #include @@ -177,18 +167,10 @@ void ItemHolder2::impl_newItem(TItemInfo& rItem) // no ref count rItem.pItem = new SvtTabAppearanceCfg(); break; - case E_CJKOPTIONS : - rItem.pItem = new SvtCJKOptions(); - break; - case E_COLORCFG : rItem.pItem = new ::svtools::ColorConfig(); break; - case E_CTLOPTIONS : - rItem.pItem = new SvtCTLOptions(); - break; - case E_FONTSUBSTCONFIG : // no ref count rItem.pItem = new SvtFontSubstConfig(); break; @@ -197,14 +179,6 @@ void ItemHolder2::impl_newItem(TItemInfo& rItem) rItem.pItem = new SvtHelpOptions(); break; - case E_LANGUAGEOPTIONS : -// capsulate CTL and CJL options ! rItem.pItem = new SvtLanguageOptions(); - break; - - case E_MISCCFG : -// no ref count rItem.pItem = new SfxMiscCfg(); - break; - case E_MENUOPTIONS : rItem.pItem = new SvtMenuOptions(); break; @@ -217,10 +191,6 @@ void ItemHolder2::impl_newItem(TItemInfo& rItem) rItem.pItem = new SvtPrintFileOptions(); break; - case E_SYSLOCALEOPTIONS : - rItem.pItem = new SvtSysLocaleOptions(); - break; - case E_MISCOPTIONS : rItem.pItem = new SvtMiscOptions(); break; diff --git a/svtools/source/config/makefile.mk b/svtools/source/config/makefile.mk index d3f2615776da..9de32bd9e43d 100644 --- a/svtools/source/config/makefile.mk +++ b/svtools/source/config/makefile.mk @@ -38,27 +38,22 @@ ENABLE_EXCEPTIONS := TRUE # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svl.pmk +.INCLUDE : $(PRJ)$/util$/svt.pmk # --- Files -------------------------------------------------------- SLOFILES= \ - $(SLO)$/accessibilityoptions.obj \ - $(SLO)$/apearcfg.obj \ - $(SLO)$/cjkoptions.obj \ + $(SLO)$/accessibilityoptions.obj \ + $(SLO)$/apearcfg.obj \ $(SLO)$/colorcfg.obj \ - $(SLO)$/ctloptions.obj \ $(SLO)$/extcolorcfg.obj \ - $(SLO)$/fontsubstconfig.obj \ + $(SLO)$/fontsubstconfig.obj \ $(SLO)$/helpopt.obj \ - $(SLO)$/itemholder2.obj \ - $(SLO)$/languageoptions.obj \ - $(SLO)$/menuoptions.obj \ - $(SLO)$/misccfg.obj \ + $(SLO)$/itemholder2.obj \ + $(SLO)$/menuoptions.obj \ $(SLO)$/miscopt.obj \ - $(SLO)$/optionsdrawinglayer.obj \ - $(SLO)$/printoptions.obj \ - $(SLO)$/syslocaleoptions.obj + $(SLO)$/optionsdrawinglayer.obj \ + $(SLO)$/printoptions.obj # --- Targets ------------------------------------------------------ diff --git a/svtools/source/config/miscopt.cxx b/svtools/source/config/miscopt.cxx index 7a6dc4281da6..edf5b9e7c40c 100644 --- a/svtools/source/config/miscopt.cxx +++ b/svtools/source/config/miscopt.cxx @@ -33,10 +33,6 @@ //_________________________________________________________________________________________________________________ // includes //_________________________________________________________________________________________________________________ -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION #include #include diff --git a/svtools/source/config/printoptions.cxx b/svtools/source/config/printoptions.cxx index dcaa3b7d1bb3..9627a2ce10d9 100644 --- a/svtools/source/config/printoptions.cxx +++ b/svtools/source/config/printoptions.cxx @@ -31,11 +31,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION - //_________________________________________________________________________________________________________________ // includes //_________________________________________________________________________________________________________________ diff --git a/svtools/source/control/fileurlbox.cxx b/svtools/source/control/fileurlbox.cxx index 936f8b3e25c5..3ba69e826e1c 100644 --- a/svtools/source/control/fileurlbox.cxx +++ b/svtools/source/control/fileurlbox.cxx @@ -32,7 +32,7 @@ #include "precompiled_svtools.hxx" #include #include -#include "filenotation.hxx" +#include "svtools/filenotation.hxx" //......................................................................... namespace svt diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index d5e7fbaa5cd4..89f4a988aec2 100644 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -71,7 +71,7 @@ #include #include #include -#include "urihelper.hxx" +#include "svtools/urihelper.hxx" #include #define _SVSTDARR_STRINGSDTOR diff --git a/svtools/source/control/makefile.mk b/svtools/source/control/makefile.mk index 10bb6beb50e4..eecf983ab756 100644 --- a/svtools/source/control/makefile.mk +++ b/svtools/source/control/makefile.mk @@ -77,7 +77,6 @@ SLOFILES=\ $(SLO)$/calendar.obj \ $(SLO)$/filectrl.obj \ $(SLO)$/scrwin.obj \ - $(SLO)$/reginfo.obj \ $(SLO)$/collatorres.obj \ $(SLO)$/indexentryres.obj \ $(SLO)$/hyperlabel.obj \ diff --git a/svtools/source/control/reginfo.cxx b/svtools/source/control/reginfo.cxx deleted file mode 100644 index 24daba5e6123..000000000000 --- a/svtools/source/control/reginfo.cxx +++ /dev/null @@ -1,375 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: reginfo.cxx,v $ - * $Revision: 1.8 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include "reginfo.hxx" -#include -#include - -#define MAXREGVALUE 200 - -// ***************************************************************************** -#if defined(WIN) || defined(WNT) - -#include - -#define DBG_HDL DBG_ASSERT(pImp->bValidGroup, "Keine Gruppe gesetzt"); \ - if( !pImp->bValidGroup ) return - -struct RegInfo_Impl -{ - HKEY aGroupHdl; - BOOL bValidGroup; -}; - -RegInfo::RegInfo() -{ - pImp=new RegInfo_Impl; - pImp->bValidGroup = FALSE; -} - -RegInfo::~RegInfo() -{ - if(pImp->bValidGroup) - RegCloseKey( pImp->aGroupHdl ); - delete pImp; -} - -String RegInfo::GetKeyName( USHORT nKey ) const -{ - DBG_HDL String::EmptyString(); - char aBuffer[MAXREGVALUE]; - RegEnumKey( pImp->aGroupHdl, nKey, aBuffer, MAXREGVALUE ); - return String( UniString::CreateFromAscii(aBuffer) ); -} - -USHORT RegInfo::GetKeyCount() const -{ - DBG_HDL 0; -#ifdef WNT - DWORD nKeys; - DWORD Dum1=10, Dum2, Dum3, Dum4, Dum5, Dum6, Dum7; - char s[10]; - FILETIME aDumFileTime; - RegQueryInfoKey( pImp->aGroupHdl, s, &Dum1, 0, &nKeys, &Dum2, &Dum3, - &Dum4, &Dum5, &Dum6, &Dum7, &aDumFileTime ); - return (USHORT) nKeys; -#else - char aBuffer[MAXREGVALUE]; - USHORT n=0; - while(RegEnumKey( - pImp->aGroupHdl, n, aBuffer, MAXREGVALUE) == ERROR_SUCCESS) - n++; - return n; -#endif -} - -inline String MakeAppGroupString_Impl( const String &rGroup ) -{ - String aGroup( UniString::CreateFromAscii("SvAppGroups\\") ); - aGroup+=rGroup; - return aGroup; -} - -void RegInfo::SetAppGroup( const String& rGroup ) -{ - aCurrentGroup = MakeAppGroupString_Impl(rGroup); - if( pImp->bValidGroup ) - { - RegCloseKey( pImp->aGroupHdl ); - pImp->bValidGroup = FALSE; - } - ByteString aBStr( aCurrentGroup, osl_getThreadTextEncoding() ); - RegCreateKey( HKEY_CLASSES_ROOT, aBStr.GetBuffer(), &pImp->aGroupHdl ); - pImp->bValidGroup = TRUE; -} - -void RegInfo::DeleteAppGroup( const String &rGroup ) -{ - String aOldGroup = aCurrentGroup; - SetAppGroup( rGroup ); - DBG_HDL; - USHORT nMax = GetKeyCount(); - for( USHORT n = nMax; n--; ) - { - String aKey( GetKeyName( n )); - DeleteKey( aKey ); - } - RegCloseKey( pImp->aGroupHdl ); - - ByteString aBStr( rGroup, osl_getThreadTextEncoding() ); - RegDeleteKey( HKEY_CLASSES_ROOT, aBStr.GetBuffer() ); - pImp->bValidGroup = FALSE; - if( rGroup != aOldGroup ) - SetAppGroup( aOldGroup ); -} - -BOOL ReadKey_Impl( const String& rKey, - HKEY aHdl, String& rResult ) -{ - char s[MAXREGVALUE]; - LONG aLen=MAXREGVALUE; - - ByteString aBStr( rKey, osl_getThreadTextEncoding() ); - LONG nRes = RegQueryValue( aHdl, aBStr.GetBuffer(), s, &aLen); - if(nRes == ERROR_SUCCESS) - { - rResult = UniString::CreateFromAscii(s); - return TRUE; - } - else - return FALSE; -} - -String RegInfo::ReadKey( const String& rKey ) const -{ - DBG_HDL String::EmptyString(); - String aRes; - if(ReadKey_Impl( rKey, pImp->aGroupHdl, aRes)) - return aRes; - else - return String::EmptyString(); -} - -String RegInfo::ReadKey( const String& rKey, const String &rDefault ) const -{ - DBG_HDL String::EmptyString(); - String aRes; - if(ReadKey_Impl( rKey, pImp->aGroupHdl, aRes)) - return aRes; - else - return rDefault; -} - -void RegInfo::WriteKey( const String& rKey, const String& rValue ) -{ - DBG_HDL; - ByteString aBStr( rKey, osl_getThreadTextEncoding() ); - ByteString aBStr1( rValue, osl_getThreadTextEncoding() ); - RegSetValue( pImp->aGroupHdl, aBStr.GetBuffer(), REG_SZ, aBStr1.GetBuffer(), 0); -} - - -void RegInfo::DeleteKey( const String& rKey ) -{ - DBG_HDL; - ByteString aBStr( rKey, osl_getThreadTextEncoding() ); - RegDeleteKey( pImp->aGroupHdl, aBStr.GetBuffer() ); -} - -// ***************************************************************************** -#elif defined(OS2) - -#define INCL_WINSHELLDATA -#include - -struct RegInfo_Impl -{ - char *pKeyList; - String aCurrentApp; - void BuildKeyList( const String &rGroup ); -}; - -void RegInfo_Impl::BuildKeyList( const String &rGroup ) -{ - ByteString aBStr( rGroup, osl_getThreadTextEncoding() ); - USHORT nLen = 0; - do - { - nLen+=1000; - delete[] pKeyList; - pKeyList = new char[nLen]; - *(int *)pKeyList = 0; - } - while( PrfQueryProfileString( - HINI_USERPROFILE, (PCSZ)aBStr.GetBuffer(), - 0, 0, pKeyList, nLen) == nLen); -} - - -RegInfo::RegInfo() -{ - pImp=new RegInfo_Impl; - pImp->pKeyList = 0; -} - -RegInfo::~RegInfo() -{ - delete[] pImp->pKeyList; - delete pImp; -} - -inline String MakeAppGroupString_Impl( const String &rGroup ) -{ - String aGroup(UniString::CreateFromAscii("SvAppGroups:")); - aGroup+=rGroup; - return aGroup; -} - -String RegInfo::GetKeyName( USHORT nKey ) const -{ - if( !pImp->pKeyList ) - pImp->BuildKeyList(pImp->aCurrentApp); - - const char *pc=pImp->pKeyList; - for( USHORT n=0; npKeyList ) - pImp->BuildKeyList( pImp->aCurrentApp); - - const char *pc=pImp->pKeyList; - USHORT nRet=0; - while(*pc) - { - while(*pc++); - nRet++; - } - return nRet; -} - -void RegInfo::SetAppGroup( const String& rGroup ) -{ - delete[] pImp->pKeyList; - pImp->pKeyList = 0; - aCurrentGroup = rGroup; - pImp->aCurrentApp = MakeAppGroupString_Impl( rGroup ); -} - -void RegInfo::DeleteAppGroup( const String &rGroup ) -{ - ByteString aBStr( MakeAppGroupString_Impl( rGroup ), osl_getThreadTextEncoding() ); - PrfWriteProfileString( - HINI_USERPROFILE, (PCSZ)aBStr.GetBuffer(), 0, 0); -} - - -String RegInfo::ReadKey( const String& rKey ) const -{ - ULONG ulBufferMax = MAXREGVALUE; - char *pBuffer= new char[MAXREGVALUE]; - ByteString aBStr( pImp->aCurrentApp, osl_getThreadTextEncoding() ); - ByteString aBStr1( rKey, osl_getThreadTextEncoding() ); - *pBuffer=0; - PrfQueryProfileData( - HINI_USERPROFILE, (PCSZ)aBStr.GetBuffer(), (PCSZ)aBStr1.GetBuffer(), pBuffer, &ulBufferMax); - String aRet(UniString::CreateFromAscii(pBuffer)); - delete[] pBuffer; - return aRet; -} - - -String RegInfo::ReadKey( const String& rKey, const String &rDefault ) const -{ - String aResult = ReadKey(rKey); - if (!aResult.Len()) - return rDefault; - else - return aResult; -} - - -void RegInfo::WriteKey( const String& rKey, const String& rValue ) -{ - ByteString aBStr( pImp->aCurrentApp, osl_getThreadTextEncoding() ); - ByteString aBStr1( rKey, osl_getThreadTextEncoding() ); - PrfWriteProfileData( - HINI_USERPROFILE, (PCSZ)aBStr.GetBuffer(), (PCSZ)aBStr1.GetBuffer(), (PVOID)rValue.GetBuffer(), rValue.Len()*2); -} - -void RegInfo::DeleteKey( const String& rKey ) -{ - ByteString aBStr( pImp->aCurrentApp, osl_getThreadTextEncoding() ); - ByteString aBStr1( rKey, osl_getThreadTextEncoding() ); - PrfWriteProfileString( - HINI_USERPROFILE, (PCSZ)aBStr.GetBuffer(), (PCSZ)rKey.GetBuffer(), 0); -} - -// ***************************************************************************** - -#else - -RegInfo::RegInfo() -{ -} - - -RegInfo::~RegInfo() -{ -} - -String RegInfo::GetKeyName( USHORT ) const -{ - return String::EmptyString(); -} - -USHORT RegInfo::GetKeyCount() const -{ - return 0; -} - -void RegInfo::SetAppGroup( const String& ) -{ - return ; -} - -void RegInfo::DeleteAppGroup( const String& ) -{ - return; -} - -String RegInfo::ReadKey( const String& ) const -{ - return String::EmptyString(); -} - -String RegInfo::ReadKey( const String&, const String& ) const -{ - return String::EmptyString(); -} - -void RegInfo::WriteKey( const String&, const String& ) -{ - return; -} - -void RegInfo::DeleteKey( const String& ) -{ - return; -} - -#endif diff --git a/svtools/source/control/urlcontrol.cxx b/svtools/source/control/urlcontrol.cxx index 1252fc17a1d6..4ad0969dd732 100644 --- a/svtools/source/control/urlcontrol.cxx +++ b/svtools/source/control/urlcontrol.cxx @@ -31,12 +31,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#ifndef SVTOOL_URLCONTROL_HXX #include -#endif -#ifndef SVTOOLS_FILENOTATION_HXX_ -#include "filenotation.hxx" -#endif +#include "svtools/filenotation.hxx" //......................................................................... namespace svt diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx index 14ede88482a6..ca7064e101fa 100644 --- a/svtools/source/dialogs/addresstemplate.cxx +++ b/svtools/source/dialogs/addresstemplate.cxx @@ -70,7 +70,7 @@ #include #include "localresaccess.hxx" #ifndef SVTOOLS_FILENOTATION_HXX_ -#include "filenotation.hxx" +#include "svtools/filenotation.hxx" #endif #include diff --git a/svtools/source/dialogs/printdlg.cxx b/svtools/source/dialogs/printdlg.cxx index 68acffc62a74..5aeea754aef2 100644 --- a/svtools/source/dialogs/printdlg.cxx +++ b/svtools/source/dialogs/printdlg.cxx @@ -47,7 +47,7 @@ #include #include #include -#include "pickerhelper.hxx" +#include "svtools/pickerhelper.hxx" #ifndef _SVT_HELPID_HRC #include #endif diff --git a/svtools/source/edit/textview.cxx b/svtools/source/edit/textview.cxx index e0697a488287..c21bd70b3fd9 100644 --- a/svtools/source/edit/textview.cxx +++ b/svtools/source/edit/textview.cxx @@ -44,7 +44,7 @@ #include #include -#include +#include #ifndef _COM_SUN_STAR_TEXT_XBREAKITERATOR_HPP_ #include diff --git a/svtools/source/filter.vcl/filter/makefile.mk b/svtools/source/filter.vcl/filter/makefile.mk index 2229f8f05546..ecdf48ba5671 100644 --- a/svtools/source/filter.vcl/filter/makefile.mk +++ b/svtools/source/filter.vcl/filter/makefile.mk @@ -40,6 +40,8 @@ LIBTARGET=NO .INCLUDE : settings.mk .INCLUDE : $(PRJ)$/util$/svt.pmk +SOLARINC+=-I../../inc + # --- Files -------------------------------------------------------- SRS1NAME=$(TARGET) diff --git a/svtools/source/filter.vcl/igif/makefile.mk b/svtools/source/filter.vcl/igif/makefile.mk index 0562813c00cc..49e2461bd7a8 100644 --- a/svtools/source/filter.vcl/igif/makefile.mk +++ b/svtools/source/filter.vcl/igif/makefile.mk @@ -38,6 +38,7 @@ TARGET=igif .INCLUDE : settings.mk .INCLUDE : $(PRJ)$/util$/svt.pmk +SOLARINC+=-I../../inc # --- Files -------------------------------------------------------- diff --git a/svtools/source/filter.vcl/ixbm/makefile.mk b/svtools/source/filter.vcl/ixbm/makefile.mk index 9c090e1de04a..41d6f7425474 100644 --- a/svtools/source/filter.vcl/ixbm/makefile.mk +++ b/svtools/source/filter.vcl/ixbm/makefile.mk @@ -38,6 +38,7 @@ TARGET=ixbm .INCLUDE : settings.mk .INCLUDE : $(PRJ)$/util$/svt.pmk +SOLARINC+=-I../../inc # --- Files -------------------------------------------------------- diff --git a/svtools/source/filter.vcl/ixpm/makefile.mk b/svtools/source/filter.vcl/ixpm/makefile.mk index 2e5cb851ebbf..10792f41ab3a 100644 --- a/svtools/source/filter.vcl/ixpm/makefile.mk +++ b/svtools/source/filter.vcl/ixpm/makefile.mk @@ -38,6 +38,7 @@ TARGET=ixpm .INCLUDE : settings.mk .INCLUDE : $(PRJ)$/util$/svt.pmk +SOLARINC+=-I../../inc # --- Files -------------------------------------------------------- diff --git a/svtools/source/filter.vcl/jpeg/makefile.mk b/svtools/source/filter.vcl/jpeg/makefile.mk index 86c9c89c8bf0..7a9b5fc509c9 100644 --- a/svtools/source/filter.vcl/jpeg/makefile.mk +++ b/svtools/source/filter.vcl/jpeg/makefile.mk @@ -43,6 +43,8 @@ TARGET=jpeg CFLAGS+=-DSYSTEM_JPEG .ENDIF +SOLARINC+=-I../../inc + # --- Files -------------------------------------------------------- SLOFILES= $(SLO)$/jpegc.obj \ diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx index 6bd1126f8082..ba21db8a8e76 100644 --- a/svtools/source/misc/embedhlp.cxx +++ b/svtools/source/misc/embedhlp.cxx @@ -58,6 +58,7 @@ #include #include "vcl/svapp.hxx" #include +#include using namespace com::sun::star; diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx index 314242063711..ddf6a7350772 100644 --- a/svtools/source/misc/imagemgr.cxx +++ b/svtools/source/misc/imagemgr.cxx @@ -58,6 +58,7 @@ #include #include "imagemgr.hrc" #include +#include // globals ******************************************************************* diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx index 9fb60111094e..8ea4296d6db3 100644 --- a/svtools/source/misc/imap.cxx +++ b/svtools/source/misc/imap.cxx @@ -36,7 +36,7 @@ #include #include -#include "urihelper.hxx" +#include "svtools/urihelper.hxx" #include #include #include diff --git a/svtools/source/misc/imap2.cxx b/svtools/source/misc/imap2.cxx index b1e03a574188..dc18e1a9c24b 100644 --- a/svtools/source/misc/imap2.cxx +++ b/svtools/source/misc/imap2.cxx @@ -43,7 +43,7 @@ #endif #include -#include "urihelper.hxx" +#include "svtools/urihelper.hxx" #include #include #include diff --git a/svtools/source/misc/makefile.mk b/svtools/source/misc/makefile.mk index a23092e120da..77cf8a41a8bd 100644 --- a/svtools/source/misc/makefile.mk +++ b/svtools/source/misc/makefile.mk @@ -46,11 +46,9 @@ ENABLE_EXCEPTIONS := TRUE SRS1NAME=misc SRC1FILES=\ - config.src \ - iniman.src \ ehdl.src \ - imagemgr.src \ helpagent.src \ + imagemgr.src \ langtab.src SRS2NAME=ehdl @@ -59,33 +57,28 @@ SRC2FILES=\ SLOFILES=\ $(SLO)$/acceleratorexecute.obj \ + $(SLO)$/chartprettypainter.obj \ $(SLO)$/cliplistener.obj \ + $(SLO)$/dialogclosedlistener.obj\ + $(SLO)$/dialogcontrolling.obj \ + $(SLO)$/ehdl.obj \ $(SLO)$/embedhlp.obj \ $(SLO)$/embedtransfer.obj \ + $(SLO)$/helpagentwindow.obj \ $(SLO)$/imagemgr.obj \ $(SLO)$/imageresourceaccess.obj \ - $(SLO)$/templatefoldercache.obj \ - $(SLO)$/transfer.obj \ - $(SLO)$/transfer2.obj \ - $(SLO)$/stringtransfer.obj \ - $(SLO)$/urihelper.obj \ - $(SLO)$/svtaccessiblefactory.obj \ - $(SLO)$/ehdl.obj \ - $(SLO)$/flbytes.obj \ - $(SLO)$/helpagentwindow.obj \ $(SLO)$/imap.obj \ $(SLO)$/imap2.obj \ $(SLO)$/imap3.obj \ - $(SLO)$/ownlist.obj \ - $(SLO)$/vcldata.obj \ - $(SLO)$/restrictedpaths.obj \ - $(SLO)$/dialogclosedlistener.obj\ - $(SLO)$/dialogcontrolling.obj \ - $(SLO)$/chartprettypainter.obj \ - $(SLO)$/lockfilecommon.obj \ - $(SLO)$/sharecontrolfile.obj \ - $(SLO)$/documentlockfile.obj \ - $(SLO)$/langtab.obj + $(SLO)$/itemdel.obj \ + $(SLO)$/langtab.obj \ + $(SLO)$/stringtransfer.obj \ + $(SLO)$/svtaccessiblefactory.obj \ + $(SLO)$/svtdata.obj \ + $(SLO)$/templatefoldercache.obj \ + $(SLO)$/transfer.obj \ + $(SLO)$/transfer2.obj \ + $(SLO)$/wallitem.obj # --- Targets ------------------------------------------------------- diff --git a/svtools/source/misc/svtdata.cxx b/svtools/source/misc/svtdata.cxx index 51247a628c0e..2bc1977e9197 100644 --- a/svtools/source/misc/svtdata.cxx +++ b/svtools/source/misc/svtdata.cxx @@ -36,17 +36,7 @@ #include #include #include - -namespace unnamed_svtools_svtdata {} -using namespace unnamed_svtools_svtdata; - // unnamed namespaces don't work well yet - -//============================================================================ -namespace unnamed_svtools_svtdata { - -typedef std::map< rtl::OUString, SimpleResMgr * > SimpleResMgrMap; - -} +#include //============================================================================ // @@ -57,11 +47,6 @@ typedef std::map< rtl::OUString, SimpleResMgr * > SimpleResMgrMap; ImpSvtData::~ImpSvtData() { delete pResMgr; - for (SimpleResMgrMap::iterator t - = static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs)->begin(); - t != static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs)->end(); ++t) - delete t->second; - delete static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs); } //============================================================================ @@ -74,22 +59,9 @@ ResMgr * ImpSvtData::GetResMgr(const ::com::sun::star::lang::Locale aLocale) return pResMgr; } -//============================================================================ -SimpleResMgr* ImpSvtData::GetSimpleRM(const ::com::sun::star::lang::Locale& rLocale) +ResMgr * ImpSvtData::GetResMgr() { - if (!m_pThreadsafeRMs) - m_pThreadsafeRMs = new SimpleResMgrMap; - rtl::OUString aISOcode = rLocale.Language; - aISOcode += rtl::OStringToOUString("-", RTL_TEXTENCODING_UTF8); - aISOcode += rLocale.Country; - - SimpleResMgr *& rResMgr - = (*static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs))[aISOcode]; - if (!rResMgr) - { - rResMgr = new SimpleResMgr(CREATEVERSIONRESMGR_NAME(svs), rLocale ); - } - return rResMgr; + return GetResMgr(Application::GetSettings().GetUILocale()); } ResMgr * ImpSvtData::GetPatchResMgr(const ::com::sun::star::lang::Locale& aLocale) @@ -101,6 +73,16 @@ ResMgr * ImpSvtData::GetPatchResMgr(const ::com::sun::star::lang::Locale& aLocal return pPatchResMgr; } +ResMgr * ImpSvtData::GetPatchResMgr() +{ + return GetPatchResMgr(Application::GetSettings().GetUILocale()); +} + +SvpResId::SvpResId( USHORT nId ) : + ResId( nId, *ImpSvtData::GetSvtData().GetPatchResMgr() ) +{ +} + //============================================================================ // static ImpSvtData & ImpSvtData::GetSvtData() diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index 0bcd00af40aa..e2cd8f803a04 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -76,7 +76,7 @@ #include #include -#include "urlbmk.hxx" +#include "svtools/urlbmk.hxx" #include "inetimg.hxx" #include #include diff --git a/svtools/source/misc/transfer2.cxx b/svtools/source/misc/transfer2.cxx index 8dcbbf9d93dc..eebf91ab57ff 100644 --- a/svtools/source/misc/transfer2.cxx +++ b/svtools/source/misc/transfer2.cxx @@ -50,7 +50,7 @@ #include #endif -#include "urlbmk.hxx" +#include "svtools/urlbmk.hxx" #include "inetimg.hxx" #include #include diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx index 5b584a37059d..9783188e3b7c 100644 --- a/svtools/source/svhtml/htmlout.cxx +++ b/svtools/source/svhtml/htmlout.cxx @@ -44,7 +44,7 @@ #include #include #include -#include "urihelper.hxx" +#include "svtools/urihelper.hxx" #ifndef RTL_CONSTASCII_STRINGPARAM #define RTL_CONSTASCII_STRINGPARAM( c ) c, sizeof(c)-1 diff --git a/svtools/source/uno/makefile.mk b/svtools/source/uno/makefile.mk index 47eaf4f25749..d8438bd48ccf 100644 --- a/svtools/source/uno/makefile.mk +++ b/svtools/source/uno/makefile.mk @@ -46,7 +46,7 @@ SRS1NAME= uno SRC1FILES= unoifac2.src SLOFILES= \ - $(SLO)$/adrtempuno.obj \ + $(SLO)$/addrtempuno.obj \ $(SLO)$/contextmenuhelper.obj \ $(SLO)$/framestatuslistener.obj \ $(SLO)$/generictoolboxcontroller.obj \ diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx index 54cc448ff89e..cc367c5a0264 100644 --- a/svtools/source/uno/unoiface.cxx +++ b/svtools/source/uno/unoiface.cxx @@ -48,7 +48,7 @@ #include #include #include -#include +#include #include #include diff --git a/svtools/util/makefile.mk b/svtools/util/makefile.mk index fac8f654bfbe..51ea7a9fef31 100644 --- a/svtools/util/makefile.mk +++ b/svtools/util/makefile.mk @@ -35,7 +35,6 @@ PRJNAME=svtools TARGET=svtool RESTARGET=svt RESTARGETPATCH=svp -RESTARGETSIMPLE=svs GEN_HID=TRUE GEN_HID_OTHER=TRUE ENABLE_EXCEPTIONS=TRUE @@ -49,53 +48,33 @@ USE_LDUMP2=TRUE # --- general section ---------------------------------------------------- .IF "$(GUI)"!="UNX" -LIB3TARGET= $(LB)$/svtool.lib -LIB3FILES= $(LB)$/_svt.lib +LIB2TARGET= $(LB)$/svtool.lib +LIB2FILES= $(LB)$/_svt.lib .ENDIF -.IF "$(GUI)"!="UNX" -LIB4TARGET= $(LB)$/isvl.lib -LIB4FILES= $(LB)$/_isvl.lib -.ENDIF - -LIB7TARGET= $(SLB)$/svt.lib -LIB7FILES= \ - $(SLB)$/misc.lib \ - $(SLB)$/items.lib \ +LIB1TARGET= $(SLB)$/svt.lib +LIB1FILES= \ $(SLB)$/browse.lib \ + $(SLB)$/config.lib \ + $(SLB)$/svcontnr.lib \ $(SLB)$/ctrl.lib \ $(SLB)$/dialogs.lib \ $(SLB)$/edit.lib \ - $(SLB)$/unoiface.lib \ $(SLB)$/filter.lib \ + $(SLB)$/filter.uno.lib \ $(SLB)$/igif.lib \ $(SLB)$/jpeg.lib \ $(SLB)$/ixpm.lib \ $(SLB)$/ixbm.lib \ - $(SLB)$/numbers.lib \ - $(SLB)$/numbers.uno.lib \ $(SLB)$/wmf.lib \ - $(SLB)$/undo.lib \ - $(SLB)$/urlobj.lib \ + $(SLB)$/java.lib \ + $(SLB)$/misc.lib \ $(SLB)$/plugapp.lib \ - $(SLB)$/svcontnr.lib \ - $(SLB)$/syslocale.lib \ - $(SLB)$/svdde.lib \ $(SLB)$/svhtml.lib \ $(SLB)$/svrtf.lib \ - $(SLB)$/config.lib \ $(SLB)$/table.lib \ - $(SLB)$/java.lib - -LIB8TARGET= $(SLB)$/svl.lib -LIB8FILES= \ - $(SLB)$/filerec.lib \ - $(SLB)$/filepicker.lib \ - $(SLB)$/items1.lib \ - $(SLB)$/misc1.lib \ - $(SLB)$/notify.lib \ - $(SLB)$/svarray.lib \ - $(SLB)$/svsql.lib + $(SLB)$/unoiface.lib \ + $(SLB)$/urlobj.lib # generation of resourcen-lib ---------------------------------------- @@ -112,12 +91,6 @@ RESLIB1SRSFILES= \ $(SRS)$/browse.srs \ $(SRS)$/javaerror.srs -RESLIB2NAME= $(RESTARGETSIMPLE) -RESLIB2SRSFILES=\ - $(SRS)$/items1.srs \ - $(SRS)$/misc1.srs - - RESLIB3NAME= $(RESTARGETPATCH) RESLIB3SRSFILES= \ $(SRS)$/patchjavaerror.srs @@ -168,55 +141,16 @@ SHL1STDLIBS+= \ $(OLEAUT32LIB) .ENDIF # WNT -SHL1OBJS= \ - $(SLO)$/svtdata.obj - SHL1LIBS= \ $(SLB)$/svt.lib SHL1DEF= $(MISC)$/$(SHL1TARGET).def -SHL1DEPN=$(SHL2TARGETN) DEF1NAME= $(SHL1TARGET) -DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt DEFLIB1NAME =svt DEF1DES =SvTools -# --- svtools lite -------------------------------------------------- - -SHL2TARGET= svl$(DLLPOSTFIX) -SHL2IMPLIB= _isvl -SHL2USE_EXPORTS=name -#Do not link with VCL or any other library that links with VCL -SHL2STDLIBS= \ - $(UNOTOOLSLIB) \ - $(TOOLSLIB) \ - $(I18NISOLANGLIB) \ - $(UCBHELPERLIB) \ - $(COMPHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(VOSLIB) \ - $(VCLLIB) \ - $(SALLIB) - -.IF "$(GUI)"=="WNT" -SHL2STDLIBS+= \ - $(UWINAPILIB) \ - $(ADVAPI32LIB) \ - $(GDI32LIB) -.ENDIF # WNT - -SHL2LIBS= $(SLB)$/svl.lib - -SHL2DEF= $(MISC)$/$(SHL2TARGET).def - -DEF2NAME= $(SHL2TARGET) -DEF2DEPN= $(MISC)$/$(SHL2TARGET).flt $(SLB)$/svl.lib -DEFLIB2NAME=svl -DEF2DES =SvTools lite - # --- g2g application -------------------------------------------------- APP2TARGET = g2g @@ -240,19 +174,14 @@ APP2STDLIBS+= $(VCLLIB) \ # --- Targets ------------------------------------------------------ .IF "$(GUI)"=="UNX" -SVTTARGETS= $(LB)$/lib$(SHL2TARGET)$(DLLPOST) $(LB)$/lib$(SHL1TARGET)$(DLLPOST) +SVTTARGETS= $(LB)$/lib$(SHL1TARGET)$(DLLPOST) .ELSE -SVTTARGETS= $(LB)$/isvl.lib \ - $(BIN)$/$(SHL2TARGET)$(DLLPOST) $(BIN)$/$(SHL1TARGET)$(DLLPOST) +SVTTARGETS= $(BIN)$/$(SHL1TARGET)$(DLLPOST) .ENDIF # just a quick fix - has to be cleaned up some day... .IF "$(L10N-framework)"=="" -ALL: $(SLB)$/svl.lib \ - $(SLB)$/svt.lib \ - $(MISC)$/$(SHL2TARGET).flt \ - $(MISC)$/$(SHL1TARGET).flt \ - $(MISC)$/$(SHL2TARGET).def \ +ALL: $(SLB)$/svt.lib \ $(MISC)$/$(SHL1TARGET).def \ $(SVTTARGETS) \ ALLTAR @@ -260,15 +189,4 @@ ALL: $(SLB)$/svl.lib \ .INCLUDE : target.mk -# --- Svtools-Control-Filter-Datei --- - -$(MISC)$/$(SHL1TARGET).flt: svt.flt - @echo ------------------------------ - @echo Making: $@ - $(TYPE) svt.flt >$@ - -$(MISC)$/$(SHL2TARGET).flt: svl.flt - @echo ------------------------------ - @echo Making: $@ - $(TYPE) svl.flt >$@ -- cgit From cac5ec7effaae0f1f25758cf2f4fe94846a21b9a Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Thu, 8 Oct 2009 20:57:40 +0200 Subject: #i103496#: have SolarMutex in tools --- tools/inc/tools/solarmutex.hxx | 45 ++++++++++++++++++++++++++ tools/prj/d.lst | 1 + tools/source/misc/makefile.mk | 3 +- tools/source/misc/solarmutex.cxx | 60 +++++++++++++++++++++++++++++++++++ unotools/source/config/configitem.cxx | 37 +++++++-------------- vcl/win/source/app/salinst.cxx | 2 ++ 6 files changed, 122 insertions(+), 26 deletions(-) create mode 100644 tools/inc/tools/solarmutex.hxx create mode 100644 tools/source/misc/solarmutex.cxx diff --git a/tools/inc/tools/solarmutex.hxx b/tools/inc/tools/solarmutex.hxx new file mode 100644 index 000000000000..b1166f2b19a5 --- /dev/null +++ b/tools/inc/tools/solarmutex.hxx @@ -0,0 +1,45 @@ +/************************************************************************* + * + * 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 + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _TOOLS_SOLARMUTEX_HXX +#define _TOOLS_SOLARMUTEX_HXX + +#include "tools/toolsdllapi.h" +#include + +namespace tools +{ + class TOOLS_DLLPUBLIC SolarMutex + { + public: + static ::vos::IMutex* GetSolarMutex(); + static void SetSolarMutex( ::vos::IMutex* pMutex ); + static bool Acquire(); + static void Release(); + }; +}; + +#endif diff --git a/tools/prj/d.lst b/tools/prj/d.lst index e8fde61686a4..c9fa9d2574a4 100644 --- a/tools/prj/d.lst +++ b/tools/prj/d.lst @@ -34,6 +34,7 @@ mkdir: %_DEST%\inc%_EXT%\bootstrp ..\inc\tools\postx.h %_DEST%\inc%_EXT%\tools\postx.h ..\inc\tools\prex.h %_DEST%\inc%_EXT%\tools\prex.h +..\inc\tools\solarmutex.hxx %_DEST%\inc%_EXT%\tools\solarmutex.hxx ..\inc\tools\agapi.hxx %_DEST%\inc%_EXT%\tools\agapi.hxx ..\inc\tools\agapi.hxx %_DEST%\inc%_EXT%\tools\agapi.hxx ..\inc\tools\agitem.hxx %_DEST%\inc%_EXT%\tools\agitem.hxx diff --git a/tools/source/misc/makefile.mk b/tools/source/misc/makefile.mk index 7742c471445f..adc098b023b8 100644 --- a/tools/source/misc/makefile.mk +++ b/tools/source/misc/makefile.mk @@ -42,9 +42,10 @@ LIB1TARGET = $(SLB)$/$(TARGET).lib LIB1OBJFILES = \ $(SLO)$/appendunixshellword.obj \ $(SLO)$/extendapplicationenvironment.obj \ + $(SLO)$/solarmutex.obj \ $(SLO)$/getprocessworkingdir.obj OBJFILES = $(OBJ)$/pathutils.obj -SLOFILES = $(SLO)$/pathutils.obj $(LIB1OBJFILES) +SLOFILES = $(SLO)$/pathutils.obj $(LIB1OBJFILES) $(SLO)$/solarmutex.obj .INCLUDE: target.mk diff --git a/tools/source/misc/solarmutex.cxx b/tools/source/misc/solarmutex.cxx new file mode 100644 index 000000000000..9049c13997a9 --- /dev/null +++ b/tools/source/misc/solarmutex.cxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * 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 + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_tools.hxx" +#include + +namespace tools +{ + static ::vos::IMutex* pSolarMutex = 0; + + ::vos::IMutex* SolarMutex::GetSolarMutex() + { + return pSolarMutex; + } + + void SolarMutex::SetSolarMutex( ::vos::IMutex* pMutex ) + { + pSolarMutex = pMutex; + } + + bool SolarMutex::Acquire() + { + if ( pSolarMutex ) + pSolarMutex->acquire(); + else + return false; + return true; + } + + void SolarMutex::Release() + { + if ( pSolarMutex ) + pSolarMutex->release(); + } +} diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx index 3170fae25a5d..38aee1b39d16 100644 --- a/unotools/source/config/configitem.cxx +++ b/unotools/source/config/configitem.cxx @@ -45,13 +45,12 @@ #include #include #include -#include #include #include #include #include #include - +#include #include using namespace utl; @@ -65,7 +64,7 @@ using namespace com::sun::star::container; using namespace com::sun::star::configuration; #define C2U(cChar) OUString::createFromAscii(cChar) -#include // helper for implementations +#include // helper for implementations #ifdef DBG_UTIL inline void lcl_CFG_DBG_EXCEPTION(const sal_Char* cText, const Exception& rEx) @@ -85,10 +84,9 @@ catch(Exception& rEx) \ #endif namespace utl{ - class ConfigChangeListener_Impl : public cppu::WeakImplHelper2 + class ConfigChangeListener_Impl : public cppu::WeakImplHelper1 < - com::sun::star::util::XChangesListener, - com::sun::star::awt::XCallback + com::sun::star::util::XChangesListener > { public: @@ -102,9 +100,6 @@ namespace utl{ //XEventListener virtual void SAL_CALL disposing( const EventObject& Source ) throw(RuntimeException); - - //XAsyncCallback - virtual void SAL_CALL notify ( const Any& rData ) throw(RuntimeException); }; /* -----------------------------12.02.01 11:38-------------------------------- @@ -214,28 +209,23 @@ void ConfigChangeListener_Impl::changesOccurred( const ChangesEvent& rEvent ) th if(lcl_Find(sTemp, pCheckPropertyNames, aPropertyNames.getLength())) pNames[nNotify++] = sTemp; } - if(nNotify) + if( nNotify ) { - aChangedNames.realloc(nNotify); - Reference < com::sun::star::awt::XRequestCallback > aCallback( ::comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.awt.AsyncCallback") ), UNO_QUERY ); - aCallback->addCallback( this, makeAny( aChangedNames ) ); + if ( ::tools::SolarMutex::Acquire() ) + { + aChangedNames.realloc(nNotify); + pParent->CallNotify(aChangedNames); + ::tools::SolarMutex::Release(); + } } } -void ConfigChangeListener_Impl::notify ( const Any& rData ) throw(RuntimeException) -{ - Sequence aChangedNames; - if ( (rData >>= aChangedNames) && pParent ) - pParent->CallNotify(aChangedNames); -} - /* -----------------------------29.08.00 16:34-------------------------------- ---------------------------------------------------------------------------*/ void ConfigChangeListener_Impl::disposing( const EventObject& /*rSource*/ ) throw(RuntimeException) { - if ( pParent ) - pParent->RemoveChangesListener(); + pParent->RemoveChangesListener(); } /* -----------------------------29.08.00 12:50-------------------------------- @@ -282,9 +272,6 @@ ConfigItem::~ConfigItem() { if(pImpl->pManager) { - ConfigChangeListener_Impl* pListener = dynamic_cast < ConfigChangeListener_Impl* >( xChangeLstnr.get() ); - if ( pListener ) - pListener->pParent = 0; RemoveChangesListener(); pImpl->pManager->RemoveConfigItem(*this); } diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index d57cdd48eed2..6fac71b1513e 100644 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -656,6 +656,7 @@ WinSalInstance::WinSalInstance() { mhComWnd = 0; mpSalYieldMutex = new SalYieldMutex( this ); + ::tools::SolarMutex::SetSolarMutex( mpSalYieldMutex ); mpSalWaitMutex = new vos::OMutex; mnYieldWaitCount = 0; mpSalYieldMutex->acquire(); @@ -666,6 +667,7 @@ WinSalInstance::WinSalInstance() WinSalInstance::~WinSalInstance() { mpSalYieldMutex->release(); + ::tools::SolarMutex::SetSolarMutex( 0 ); delete mpSalYieldMutex; delete mpSalWaitMutex; DestroyWindow( mhComWnd ); -- cgit From 609de6a8feea12300005a6b8f4dc29fc00fd2697 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 9 Oct 2009 15:14:09 +0200 Subject: #i97029#: sax::Converter: add convertDateOrDateTime() and convertDate() --- sax/inc/sax/tools/converter.hxx | 15 +++++++-- sax/source/tools/converter.cxx | 71 ++++++++++++++++++++++++++++++++++------- 2 files changed, 73 insertions(+), 13 deletions(-) diff --git a/sax/inc/sax/tools/converter.hxx b/sax/inc/sax/tools/converter.hxx index 18212dfb9b8b..6632dda8507e 100644 --- a/sax/inc/sax/tools/converter.hxx +++ b/sax/inc/sax/tools/converter.hxx @@ -154,15 +154,26 @@ public: static bool convertTime( ::com::sun::star::util::DateTime& rDateTime, const ::rtl::OUString& rString ); - /** convert util::DateTime to ISO Date String */ + /** convert util::Date to ISO Date String */ + static void convertDate( ::rtl::OUStringBuffer& rBuffer, + const com::sun::star::util::Date& rDate ); + + /** convert util::DateTime to ISO Date or DateTime String */ static void convertDateTime( ::rtl::OUStringBuffer& rBuffer, const com::sun::star::util::DateTime& rDateTime, bool bAddTimeIf0AM = false ); - /** convert ISO Date String to util::DateTime */ + /** convert ISO Date or DateTime String to util::DateTime */ static bool convertDateTime( com::sun::star::util::DateTime& rDateTime, const ::rtl::OUString& rString ); + /** convert ISO Date or DateTime String to util::DateTime or util::Date */ + static bool convertDateOrDateTime( + com::sun::star::util::Date & rDate, + com::sun::star::util::DateTime & rDateTime, + bool & rbDateTime, + const ::rtl::OUString & rString ); + /** gets the position of the first comma after npos in the string rStr. Commas inside '"' pairs are not matched */ static sal_Int32 indexOfComma( const ::rtl::OUString& rStr, diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index 354ee1936094..d7203f61bf20 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -937,7 +937,17 @@ bool Converter::convertTime( ::com::sun::star::util::DateTime& rDateTime, return false; } -/** convert util::DateTime to ISO Date String */ +/** convert util::Date to ISO Date String */ +void Converter::convertDate( + ::rtl::OUStringBuffer& i_rBuffer, + const util::Date& i_rDate) +{ + const util::DateTime dt( + i_rDate.Year, i_rDate.Month, i_rDate.Day, 0, 0, 0, 0); + convertDateTime(i_rBuffer, dt, false); +} + +/** convert util::DateTime to ISO Date or DateTime String */ void Converter::convertDateTime( ::rtl::OUStringBuffer& i_rBuffer, const com::sun::star::util::DateTime& i_rDateTime, @@ -990,9 +1000,36 @@ void Converter::convertDateTime( } } -/** convert ISO Date String to util::DateTime */ -bool Converter::convertDateTime( com::sun::star::util::DateTime& rDateTime, - const ::rtl::OUString& rString ) +/** convert ISO Date or DateTime String to util::DateTime */ +bool Converter::convertDateTime( util::DateTime& rDateTime, + const ::rtl::OUString& rString ) +{ + bool isDateTime; + util::Date date; + if (convertDateOrDateTime(date, rDateTime, isDateTime, rString)) + { + if (!isDateTime) + { + rDateTime.Year = date.Year; + rDateTime.Month = date.Month; + rDateTime.Day = date.Day; + rDateTime.Hours = 0; + rDateTime.Minutes = 0; + rDateTime.Seconds = 0; + rDateTime.HundredthSeconds = 0; + } + return true; + } + else + { + return false; + } +} + +/** convert ISO Date or DateTime String to util::DateTime or util::Date */ +bool Converter::convertDateOrDateTime( + util::Date & rDate, util::DateTime & rDateTime, + bool & rbDateTime, const ::rtl::OUString & rString ) { bool bSuccess = true; @@ -1077,13 +1114,25 @@ bool Converter::convertDateTime( com::sun::star::util::DateTime& rDateTime, if (bSuccess) { - rDateTime.Year = (sal_uInt16)nYear; - rDateTime.Month = (sal_uInt16)nMonth; - rDateTime.Day = (sal_uInt16)nDay; - rDateTime.Hours = (sal_uInt16)nHour; - rDateTime.Minutes = (sal_uInt16)nMin; - rDateTime.Seconds = (sal_uInt16)nSec; - rDateTime.HundredthSeconds = (sal_uInt16)(sDoubleStr.toDouble() * 100); + if ( aTimeStr.getLength() > 0 ) // time is optional + { + rDateTime.Year = static_cast(nYear); + rDateTime.Month = static_cast(nMonth); + rDateTime.Day = static_cast(nDay); + rDateTime.Hours = static_cast(nHour); + rDateTime.Minutes = static_cast(nMin); + rDateTime.Seconds = static_cast(nSec); + rDateTime.HundredthSeconds = + static_cast((sDoubleStr).toDouble() * 100); + rbDateTime = true; + } + else + { + rDate.Year = static_cast(nYear); + rDate.Month = static_cast(nMonth); + rDate.Day = static_cast(nDay); + rbDateTime = false; + } } return bSuccess; } -- cgit From 83e74faedcb1204f33db435c63fca13fbd0011b7 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Fri, 9 Oct 2009 17:53:50 +0200 Subject: #i103496#: forgot include --- vcl/win/source/app/salinst.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index 6fac71b1513e..e4b136e9715e 100644 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -55,6 +55,7 @@ #include #include #include // CS_DROPSHADOW +#include #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) -- cgit From b1b5009015a70525edc7515d4f9723d53788aafc Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Fri, 9 Oct 2009 17:54:26 +0200 Subject: #i103496#: unused code removed --- svl/inc/svl/cstitem.hxx | 94 -------------- svl/inc/svl/dateitem.hxx | 109 ---------------- svl/inc/svl/svtools.hrc | 11 -- svl/source/items/cstitem.cxx | 252 ------------------------------------- svl/source/items/cstitem.src | 112 ----------------- svl/source/items/dateitem.cxx | 284 ------------------------------------------ svl/source/items/makefile.mk | 6 - svl/util/makefile.mk | 5 +- 8 files changed, 3 insertions(+), 870 deletions(-) delete mode 100644 svl/inc/svl/cstitem.hxx delete mode 100644 svl/inc/svl/dateitem.hxx delete mode 100644 svl/source/items/cstitem.cxx delete mode 100644 svl/source/items/cstitem.src delete mode 100644 svl/source/items/dateitem.cxx diff --git a/svl/inc/svl/cstitem.hxx b/svl/inc/svl/cstitem.hxx deleted file mode 100644 index 001731d68b41..000000000000 --- a/svl/inc/svl/cstitem.hxx +++ /dev/null @@ -1,94 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: cstitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _CSTITEM_HXX -#define _CSTITEM_HXX - -#include - -#include - -class SvStream; - -enum CrawlStatus -{ - CSTAT_NEVER_UPD = 0, /* noch nie ueberprueft */ - CSTAT_IN_UPD = 1, /* Ueberpruefung laeuft */ - CSTAT_UPD_NEWER = 2, /* wurde ueberprueft und ist neuer */ - CSTAT_UPD_NOT_NEWER = 3, /* wurde ueberprueft und ist nicht neuer */ - CSTAT_UPD_CANCEL = 4, /* Ueberpruefung vom Benutzer abgebrochen */ - CSTAT_ERR_GENERAL = 5, /* allgemeiner Fehler */ - CSTAT_ERR_NOTEXISTS = 6, /* Server existiert nicht */ - CSTAT_ERR_NOTREACHED = 7, /* Server nicht ereicht */ - CSTAT_UPD_IMMEDIATELY = 8, /* es wird gleich ueberprueftt */ - CSTAT_ERR_OFFLINE = 9 /* Ueberpruefung nicht m�glich, da Offline */ -}; - -DBG_NAMEEX(SfxCrawlStatusItem) - -// class SfxDateTimeRangeItem ------------------------------------------------- - -class SfxCrawlStatusItem : public SfxPoolItem -{ -private: - CrawlStatus eStatus; -public: - TYPEINFO(); - - SfxCrawlStatusItem( const SfxCrawlStatusItem& rCpy ); - SfxCrawlStatusItem( USHORT nWhich ); - SfxCrawlStatusItem( USHORT nWhich, CrawlStatus eStat ); - ~SfxCrawlStatusItem() { DBG_DTOR(SfxCrawlStatusItem, 0); } - - virtual int operator==( const SfxPoolItem& ) const; - using SfxPoolItem::Compare; - virtual int Compare( const SfxPoolItem &rWith ) const; - virtual SfxPoolItem* Create( SvStream&, USHORT nItemVersion ) const; - virtual SvStream& Store( SvStream&, USHORT nItemVersion ) const; - virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; - - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper * pIntlWrapper = 0 ) - const; - - CrawlStatus GetStatus() const { return eStatus; } - void SetStatus(CrawlStatus eNew) { eStatus = eNew; } - - virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; -}; - -#endif - diff --git a/svl/inc/svl/dateitem.hxx b/svl/inc/svl/dateitem.hxx deleted file mode 100644 index c66c9a84285d..000000000000 --- a/svl/inc/svl/dateitem.hxx +++ /dev/null @@ -1,109 +0,0 @@ - /************************************************************************* - * - * 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 - * - * $RCSfile: dateitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _DATETIMEITEM_HXX -#define _DATETIMEITEM_HXX - -#include -#include - -#include - -class SvStream; - -DBG_NAMEEX(SfxDateTimeItem) - -// class SfxDateTimeItem ------------------------------------------------- - -class SfxDateTimeItem : public SfxPoolItem -{ -private: - DateTime aDateTime; - -public: - TYPEINFO(); - - SfxDateTimeItem( USHORT nWhich ); - SfxDateTimeItem( USHORT nWhich, - const DateTime& rDT ); - SfxDateTimeItem( const SfxDateTimeItem& rCpy ); - - ~SfxDateTimeItem() { - DBG_DTOR(SfxDateTimeItem, 0); } - - virtual int operator==( const SfxPoolItem& ) const; - using SfxPoolItem::Compare; - virtual int Compare( const SfxPoolItem &rWith ) const; - virtual SfxPoolItem* Create( SvStream&, USHORT nItemVersion ) const; - virtual SvStream& Store( SvStream&, USHORT nItemVersion ) const; - virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; - - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper * pIntlWrapper = 0 ) - const; - - const DateTime& GetDateTime() const { return aDateTime; } - void SetDateTime( const DateTime& rDT ) { - DBG_ASSERT( GetRefCount() == 0, - "SetDateTime() with pooled item" ); - aDateTime = rDT; } - - virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; -}; - -class SfxColumnDateTimeItem : public SfxDateTimeItem -{ -public: - TYPEINFO(); - - SfxColumnDateTimeItem( USHORT nWhich ); - SfxColumnDateTimeItem( USHORT nWhich, - const DateTime& rDT ); - SfxColumnDateTimeItem( const SfxDateTimeItem& rCpy ); - - ~SfxColumnDateTimeItem() {} - - virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; - - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper * pIntlWrapper = 0 ) - const; -}; - -#endif - diff --git a/svl/inc/svl/svtools.hrc b/svl/inc/svl/svtools.hrc index 2bccf2ee74c4..60095caa8784 100644 --- a/svl/inc/svl/svtools.hrc +++ b/svl/inc/svl/svtools.hrc @@ -90,17 +90,6 @@ #define STR_SVT_SAMPLES_HELP (RID_SVTOOLS_START+66) #define STR_WARNING_ITEM (RID_SVTOOLS_START+90) -#define STR_CSTAT_NEVER_UPD (RID_SVTOOLS_START+91) -#define STR_CSTAT_IN_UPD (RID_SVTOOLS_START+92) -#define STR_CSTAT_UPD_NEWER (RID_SVTOOLS_START+93) -#define STR_CSTAT_UPD_NOT_NEWER (RID_SVTOOLS_START+94) -#define STR_CSTAT_UPD_CANCEL (RID_SVTOOLS_START+95) -#define STR_CSTAT_ERR_GENERAL (RID_SVTOOLS_START+96) -#define STR_CSTAT_ERR_NOTEXISTS (RID_SVTOOLS_START+97) -#define STR_CSTAT_ERR_NOTREACHED (RID_SVTOOLS_START+98) -#define STR_COLUM_DT_AUTO (RID_SVTOOLS_START+99) -#define STR_CSTAT_UPD_IMMEDIATELY (RID_SVTOOLS_START+100) -#define STR_CSTAT_ERR_OFFLINE (RID_SVTOOLS_START+101) #define CONFIG_BASIC_FORMAT_START (RID_SVTOOLS_START+102) #define STR_BASICKEY_FORMAT_ON (RID_SVTOOLS_START+103) diff --git a/svl/source/items/cstitem.cxx b/svl/source/items/cstitem.cxx deleted file mode 100644 index af2bfbc18fb9..000000000000 --- a/svl/source/items/cstitem.cxx +++ /dev/null @@ -1,252 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: cstitem.cxx,v $ - * $Revision: 1.9 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svl.hxx" -#include - -#include - -#include -#include -#include - -#include -#include - -#include -#include - -DBG_NAME( SfxCrawlStatusItem ) -TYPEINIT1( SfxCrawlStatusItem, SfxPoolItem ); - -// ----------------------------------------------------------------------- - -SfxCrawlStatusItem::SfxCrawlStatusItem( USHORT which ) : - SfxPoolItem( which ) -{ - DBG_CTOR( SfxCrawlStatusItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxCrawlStatusItem::SfxCrawlStatusItem( USHORT which, CrawlStatus eStat ) : - SfxPoolItem( which ), - eStatus( eStat ) -{ - DBG_CTOR( SfxCrawlStatusItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxCrawlStatusItem::SfxCrawlStatusItem( const SfxCrawlStatusItem& rItem ) : - SfxPoolItem( rItem ), - eStatus( rItem.eStatus ) -{ - DBG_CTOR( SfxCrawlStatusItem, 0 ); -} - -// ----------------------------------------------------------------------- - -int SfxCrawlStatusItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS( SfxCrawlStatusItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - return ((SfxCrawlStatusItem&)rItem).eStatus == eStatus; -} - -// ----------------------------------------------------------------------- - -int SfxCrawlStatusItem::Compare( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS( SfxCrawlStatusItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - if( ((const SfxCrawlStatusItem&)rItem).eStatus < eStatus ) - return -1; - else if( ((const SfxCrawlStatusItem&)rItem).eStatus == eStatus ) - return 0; - else - return 1; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxCrawlStatusItem::Create( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxCrawlStatusItem, 0); - - USHORT _eStatus; - rStream >> _eStatus; - - return new SfxCrawlStatusItem( Which(), (CrawlStatus)_eStatus ); -} - -// ----------------------------------------------------------------------- - -SvStream& SfxCrawlStatusItem::Store( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS( SfxCrawlStatusItem, 0 ); - - USHORT nStatus = (USHORT)eStatus; - rStream << (USHORT) nStatus; - - return rStream; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxCrawlStatusItem::Clone( SfxItemPool* ) const -{ - DBG_CHKTHIS( SfxCrawlStatusItem, 0 ); - return new SfxCrawlStatusItem( *this ); -} -// ----------------------------------------------------------------------- - -SfxItemPresentation SfxCrawlStatusItem::GetPresentation -( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * pIntlWrapper -) const -{ - DBG_CHKTHIS(SfxCrawlStatusItem, 0); - DBG_ASSERT(pIntlWrapper, - "SfxCrawlStatusItem::GetPresentation():" - " Using default IntlWrapper"); - - ::com::sun::star::lang::Locale aLocale; - - switch (eStatus) - { - case CSTAT_NEVER_UPD: - rText = String(SvtSimpleResId(STR_CSTAT_NEVER_UPD, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_IN_UPD: - rText = String(SvtSimpleResId(STR_CSTAT_IN_UPD, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_UPD_NEWER: - rText = String(SvtSimpleResId(STR_CSTAT_UPD_NEWER, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_UPD_NOT_NEWER: - rText = String(SvtSimpleResId(STR_CSTAT_UPD_NOT_NEWER, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_UPD_CANCEL: - rText = String(SvtSimpleResId(STR_CSTAT_UPD_CANCEL, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_ERR_GENERAL: - rText = String(SvtSimpleResId(STR_CSTAT_ERR_GENERAL, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_ERR_NOTEXISTS: - rText = String(SvtSimpleResId(STR_CSTAT_ERR_NOTEXISTS, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_ERR_NOTREACHED: - rText = String(SvtSimpleResId(STR_CSTAT_ERR_NOTREACHED, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_UPD_IMMEDIATELY: - rText = String(SvtSimpleResId(STR_CSTAT_UPD_IMMEDIATELY, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_ERR_OFFLINE: - rText = String(SvtSimpleResId(STR_CSTAT_ERR_OFFLINE, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - default: - rText.Erase(); - break; - } - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL SfxCrawlStatusItem::PutValue( const com::sun::star::uno::Any& rVal,BYTE ) -{ - sal_Int16 aValue = sal_Int16(); - if ( rVal >>= aValue ) - { - SetStatus( static_cast< CrawlStatus >( aValue ) ); - return TRUE; - } - - DBG_ERROR( "SfxCrawlStatusItem::PutValue - Wrong type!" ); - return FALSE; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL SfxCrawlStatusItem::QueryValue( com::sun::star::uno::Any& rVal,BYTE ) const -{ - sal_Int16 aValue = sal::static_int_cast< sal_Int16 >(GetStatus()); - rVal <<= aValue; - return TRUE; -} - diff --git a/svl/source/items/cstitem.src b/svl/source/items/cstitem.src deleted file mode 100644 index b25b980e39cf..000000000000 --- a/svl/source/items/cstitem.src +++ /dev/null @@ -1,112 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: cstitem.src,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -String STR_CSTAT_NEVER_UPD -{ - Text [ en-US ] = "No update has occurred" ; -}; -String STR_CSTAT_IN_UPD -{ - Text [ en-US ] = "Updating in progress" ; -}; -String STR_CSTAT_UPD_NEWER -{ - Text [ en-US ] = "Changes discovered" ; -}; -String STR_CSTAT_UPD_NOT_NEWER -{ - Text [ en-US ] = "No changes discovered" ; -}; -String STR_CSTAT_UPD_CANCEL -{ - Text [ en-US ] = "Canceled by user" ; -}; -String STR_CSTAT_UPD_IMMEDIATELY -{ - Text [ en-US ] = "Updating immediately" ; -}; -String STR_CSTAT_ERR_OFFLINE -{ - Text [ en-US ] = "failed, you have not been online" ; -}; -String STR_CSTAT_ERR_GENERAL -{ - Text [ en-US ] = "General error" ; -}; -String STR_CSTAT_ERR_NOTEXISTS -{ - Text [ en-US ] = "Server does not exist" ; -}; -String STR_CSTAT_ERR_NOTREACHED -{ - Text [ en-US ] = "Server not available" ; -}; -String STR_COLUM_DT_AUTO -{ - Text [ en-US ] = "automatic" ; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svl/source/items/dateitem.cxx b/svl/source/items/dateitem.cxx deleted file mode 100644 index 7f901dac9cd8..000000000000 --- a/svl/source/items/dateitem.cxx +++ /dev/null @@ -1,284 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: dateitem.cxx,v $ - * $Revision: 1.8 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svl.hxx" - -// include --------------------------------------------------------------- - -#define _DATETIMEITEM_CXX -#include - -#include -#include - - -#include -#include -#include -#include -#include -#include - - -#include - -#include -#include - -// STATIC DATA ----------------------------------------------------------- - -DBG_NAME(SfxDateTimeItem) - - -// ----------------------------------------------------------------------- - -TYPEINIT1(SfxDateTimeItem, SfxPoolItem); - -// ----------------------------------------------------------------------- - -SfxDateTimeItem::SfxDateTimeItem( USHORT which ) : - SfxPoolItem( which ) -{ - DBG_CTOR(SfxDateTimeItem, 0); -} - -// ----------------------------------------------------------------------- - -SfxDateTimeItem::SfxDateTimeItem( USHORT which, const DateTime& rDT ) : - SfxPoolItem( which ), - aDateTime( rDT ) - -{ - DBG_CTOR(SfxDateTimeItem, 0); -} - -// ----------------------------------------------------------------------- - -SfxDateTimeItem::SfxDateTimeItem( const SfxDateTimeItem& rItem ) : - SfxPoolItem( rItem ), - aDateTime( rItem.aDateTime ) -{ - DBG_CTOR(SfxDateTimeItem, 0); -} - -// ----------------------------------------------------------------------- - -int SfxDateTimeItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS(SfxDateTimeItem, 0); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - return ( ( (SfxDateTimeItem&)rItem ).aDateTime == aDateTime ); -} - -// ----------------------------------------------------------------------- - -int SfxDateTimeItem::Compare( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS(SfxDateTimeItem, 0); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - // da X.Compare( Y ) am String einem Compare( Y, X ) entspricht, - // vergleichen wir hier Y mit X - if ( ( (const SfxDateTimeItem&)rItem ).aDateTime < aDateTime ) - return -1; - else if ( ( (const SfxDateTimeItem&)rItem ).aDateTime == aDateTime ) - return 0; - else - return 1; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxDateTimeItem::Create( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxDateTimeItem, 0); - sal_uInt32 nDate = 0; - sal_Int32 nTime = 0; - rStream >> nDate; - rStream >> nTime; - DateTime aDT(nDate, nTime); - return new SfxDateTimeItem( Which(), aDT ); -} - -// ----------------------------------------------------------------------- - -SvStream& SfxDateTimeItem::Store( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxDateTimeItem, 0); - rStream << aDateTime.GetDate(); - rStream << aDateTime.GetTime(); - return rStream; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxDateTimeItem::Clone( SfxItemPool* ) const -{ - DBG_CHKTHIS(SfxDateTimeItem, 0); - return new SfxDateTimeItem( *this ); -} - -// ----------------------------------------------------------------------- - -SfxItemPresentation SfxDateTimeItem::GetPresentation -( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * pIntlWrapper -) const -{ - DBG_CHKTHIS(SfxDateTimeItem, 0); - if (aDateTime.IsValid()) - if (pIntlWrapper) - { - rText = pIntlWrapper->getLocaleData()->getDate(aDateTime); - rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); - rText += pIntlWrapper->getLocaleData()->getTime(aDateTime); - } - else - { - DBG_WARNING("SfxDateTimeItem::GetPresentation():" - " Using default en_US IntlWrapper"); - const IntlWrapper aIntlWrapper( - ::comphelper::getProcessServiceFactory(), LANGUAGE_ENGLISH_US ); - rText = aIntlWrapper.getLocaleData()->getDate(aDateTime); - rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); - rText += aIntlWrapper.getLocaleData()->getTime(aDateTime); - } - else - rText.Erase(); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL SfxDateTimeItem::PutValue( const com::sun::star::uno::Any& rVal, - BYTE nMemberId ) -{ - nMemberId &= ~CONVERT_TWIPS; - com::sun::star::util::DateTime aValue; - if ( rVal >>= aValue ) - { - aDateTime = DateTime( Date( aValue.Day, - aValue.Month, - aValue.Year ), - Time( aValue.Hours, - aValue.Minutes, - aValue.Seconds, - aValue.HundredthSeconds ) ); - return TRUE; - } - - DBG_ERROR( "SfxDateTimeItem::PutValue - Wrong type!" ); - return FALSE; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL SfxDateTimeItem::QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId ) const -{ - nMemberId &= ~CONVERT_TWIPS; - com::sun::star::util::DateTime aValue( aDateTime.Get100Sec(), - aDateTime.GetSec(), - aDateTime.GetMin(), - aDateTime.GetHour(), - aDateTime.GetDay(), - aDateTime.GetMonth(), - aDateTime.GetYear() ); - rVal <<= aValue; - return TRUE; -} - -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- - -TYPEINIT1(SfxColumnDateTimeItem, SfxDateTimeItem); - - -SfxColumnDateTimeItem::SfxColumnDateTimeItem( USHORT which ) : - SfxDateTimeItem( which ) -{} - -SfxColumnDateTimeItem::SfxColumnDateTimeItem( USHORT which, const DateTime& rDT ) : - SfxDateTimeItem( which, rDT ) -{} - -SfxColumnDateTimeItem::SfxColumnDateTimeItem( const SfxDateTimeItem& rCpy ) : - SfxDateTimeItem( rCpy ) -{} - -SfxPoolItem* SfxColumnDateTimeItem::Clone( SfxItemPool* ) const -{ - return new SfxColumnDateTimeItem( *this ); -} - -SfxItemPresentation SfxColumnDateTimeItem::GetPresentation -( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * pIntlWrapper -) const -{ - DBG_ASSERT(pIntlWrapper, - "SfxColumnDateTimeItem::GetPresentation():" - " Using default en_US IntlWrapper"); - - ::com::sun::star::lang::Locale aLocale; - if (GetDateTime() == DateTime(Date(1, 2, 3), Time(3, 2, 1))) - rText = String(SvtSimpleResId(STR_COLUM_DT_AUTO, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - else if (pIntlWrapper) - { - rText = pIntlWrapper->getLocaleData()->getDate(GetDateTime()); - rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); - rText += pIntlWrapper->getLocaleData()->getTime(GetDateTime()); - } - else - { - const IntlWrapper aIntlWrapper( - ::comphelper::getProcessServiceFactory(), LANGUAGE_ENGLISH_US ); - rText = aIntlWrapper.getLocaleData()->getDate(GetDateTime()); - rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); - rText += aIntlWrapper.getLocaleData()->getTime(GetDateTime()); - } - return SFX_ITEM_PRESENTATION_NAMELESS; -} - - - diff --git a/svl/source/items/makefile.mk b/svl/source/items/makefile.mk index ea376eeb08ee..525fff0bc90a 100644 --- a/svl/source/items/makefile.mk +++ b/svl/source/items/makefile.mk @@ -60,10 +60,8 @@ SLOFILES=\ $(SLO)$/cenumitm.obj \ $(SLO)$/cintitem.obj \ $(SLO)$/cntwall.obj \ - $(SLO)$/cstitem.obj \ $(SLO)$/ctypeitm.obj \ $(SLO)$/custritm.obj \ - $(SLO)$/dateitem.obj \ $(SLO)$/dtritem.obj \ $(SLO)$/frqitem.obj \ $(SLO)$/ilstitem.obj \ @@ -83,10 +81,6 @@ SLOFILES=\ $(SLO)$/whiter.obj \ $(SLO)$/visitem.obj -SRS1NAME=$(TARGET) -SRC1FILES=\ - cstitem.src - # --- Targets ------------------------------------------------------- .INCLUDE : target.mk diff --git a/svl/util/makefile.mk b/svl/util/makefile.mk index 56f3d0bfed15..a8bdd52fd81c 100644 --- a/svl/util/makefile.mk +++ b/svl/util/makefile.mk @@ -45,8 +45,8 @@ ENABLE_EXCEPTIONS=TRUE # --- general section ---------------------------------------------------- .IF "$(GUI)"!="UNX" -LIB1TARGET= $(LB)$/isvl.lib -LIB1FILES= $(LB)$/_isvl.lib +LIB2TARGET= $(LB)$/isvl.lib +LIB2FILES= $(LB)$/_isvl.lib .ENDIF LIB1TARGET= $(SLB)$/svl.lib @@ -88,6 +88,7 @@ SHL1STDLIBS= \ $(CPPULIB) \ $(VOSLIB) \ $(VCLLIB) \ + $(SOTLIB) \ $(SALLIB) .IF "$(GUI)"=="WNT" -- cgit From e0cea8e136b36724c6b1298e6546a4dbb8f09d00 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Fri, 9 Oct 2009 18:03:16 +0200 Subject: #i103496#: SolarMutex in tools --- vcl/aqua/source/app/salinst.cxx | 4 +++- vcl/os2/source/app/salinst.cxx | 3 +++ vcl/unx/source/app/salinst.cxx | 4 +++- vcl/win/source/app/salinst.cxx | 14 +++++++------- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx index 56bf1a612b40..13699cb75c6e 100644 --- a/vcl/aqua/source/app/salinst.cxx +++ b/vcl/aqua/source/app/salinst.cxx @@ -61,7 +61,7 @@ #import "apple_remote/RemoteMainController.h" #include "apple_remote/RemoteControl.h" #include "postmac.h" - +#include using namespace std; @@ -463,6 +463,7 @@ AquaSalInstance::AquaSalInstance() { mpSalYieldMutex = new SalYieldMutex; mpSalYieldMutex->acquire(); + ::tools::SolarMutex::SetSolarMutex( mpSalYieldMutex ); maMainThread = vos::OThread::getCurrentIdentifier(); mbWaitingYield = false; maUserEventListMutex = osl_createMutex(); @@ -473,6 +474,7 @@ AquaSalInstance::AquaSalInstance() AquaSalInstance::~AquaSalInstance() { + ::tools::SolarMutex::SetSolarMutex( 0 ); mpSalYieldMutex->release(); delete mpSalYieldMutex; osl_destroyMutex( maUserEventListMutex ); diff --git a/vcl/os2/source/app/salinst.cxx b/vcl/os2/source/app/salinst.cxx index a14881c253ee..2fffa3afd89d 100644 --- a/vcl/os2/source/app/salinst.cxx +++ b/vcl/os2/source/app/salinst.cxx @@ -55,6 +55,7 @@ #include #include #include +#include // ======================================================================= @@ -501,12 +502,14 @@ Os2SalInstance::Os2SalInstance() mpSalWaitMutex = new vos::OMutex; mnYieldWaitCount = 0; mpSalYieldMutex->acquire(); + ::tools::SolarMutex::SetSolarMutex( mpSalYieldMutex ); } // ----------------------------------------------------------------------- Os2SalInstance::~Os2SalInstance() { + ::tools::SolarMutex::SetSolarMutex( 0 ); mpSalYieldMutex->release(); delete mpSalYieldMutex; delete mpSalWaitMutex; diff --git a/vcl/unx/source/app/salinst.cxx b/vcl/unx/source/app/salinst.cxx index d84b7fa5df6d..53c41aa525e1 100644 --- a/vcl/unx/source/app/salinst.cxx +++ b/vcl/unx/source/app/salinst.cxx @@ -48,7 +48,7 @@ #include "vcl/salwtype.hxx" #include "vcl/salatype.hxx" #include "vcl/helper.hxx" - +#include #include "vos/mutex.hxx" // ------------------------------------------------------------------------- @@ -61,6 +61,7 @@ SalYieldMutex::SalYieldMutex() { mnCount = 0; mnThreadId = 0; + ::tools::SolarMutex::SetSolarMutex( this ); } void SalYieldMutex::acquire() @@ -139,6 +140,7 @@ X11SalInstance::~X11SalInstance() delete pSalData; SetSalData( NULL ); + ::tools::SolarMutex::SetSolarMutex( 0 ); delete mpSalYieldMutex; } diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index e4b136e9715e..4c8a1fc86714 100644 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -457,10 +457,10 @@ void InitSalData() { SalData* pSalData = new SalData; CoInitialize(0); - - // init GDIPlus - static Gdiplus::GdiplusStartupInput gdiplusStartupInput; - Gdiplus::GdiplusStartup(&pSalData->gdiplusToken, &gdiplusStartupInput, NULL); + + // init GDIPlus + static Gdiplus::GdiplusStartupInput gdiplusStartupInput; + Gdiplus::GdiplusStartup(&pSalData->gdiplusToken, &gdiplusStartupInput, NULL); } @@ -472,7 +472,7 @@ void DeInitSalData() // deinit GDIPlus if(pSalData) { - Gdiplus::GdiplusShutdown(pSalData->gdiplusToken); + Gdiplus::GdiplusShutdown(pSalData->gdiplusToken); } delete pSalData; @@ -657,18 +657,18 @@ WinSalInstance::WinSalInstance() { mhComWnd = 0; mpSalYieldMutex = new SalYieldMutex( this ); - ::tools::SolarMutex::SetSolarMutex( mpSalYieldMutex ); mpSalWaitMutex = new vos::OMutex; mnYieldWaitCount = 0; mpSalYieldMutex->acquire(); + ::tools::SolarMutex::SetSolarMutex( mpSalYieldMutex ); } // ----------------------------------------------------------------------- WinSalInstance::~WinSalInstance() { - mpSalYieldMutex->release(); ::tools::SolarMutex::SetSolarMutex( 0 ); + mpSalYieldMutex->release(); delete mpSalYieldMutex; delete mpSalWaitMutex; DestroyWindow( mhComWnd ); -- cgit From 59cfb5db4135f4e57e40143cb03f944982c6eff8 Mon Sep 17 00:00:00 2001 From: os Date: Mon, 12 Oct 2009 10:27:11 +0200 Subject: date time order fixed --- sax/source/tools/converter.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index d7203f61bf20..1efda01ea77a 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -943,7 +943,7 @@ void Converter::convertDate( const util::Date& i_rDate) { const util::DateTime dt( - i_rDate.Year, i_rDate.Month, i_rDate.Day, 0, 0, 0, 0); + 0, 0, 0, 0, i_rDate.Day, i_rDate.Month, i_rDate.Year); convertDateTime(i_rBuffer, dt, false); } -- cgit From 9a4d0581c72653e60562d1b8e2121772d21f8a9e Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Mon, 12 Oct 2009 11:49:13 +0200 Subject: #i103496#: move SysLocale stuff to unotools --- svl/inc/flbytes.hxx | 174 -------- svl/inc/misccfg.hxx | 75 ---- svl/inc/svl/ondemand.hxx | 2 +- svl/inc/svl/syslocale.hxx | 78 ---- svl/inc/svl/syslocaleoptions.hxx | 164 -------- svl/prj/build.lst | 3 +- svl/source/config/ctloptions.cxx | 13 +- svl/source/config/itemholder2.cxx | 10 - svl/source/config/languageoptions.cxx | 13 +- svl/source/config/makefile.mk | 4 +- svl/source/config/misccfg.cxx | 190 --------- svl/source/config/syslocaleoptions.cxx | 632 ---------------------------- svl/source/items/dtritem.cxx | 3 - svl/source/items/style.cxx | 5 +- svl/source/misc/flbytes.cxx | 432 ------------------- svl/source/misc/makefile.mk | 1 - svl/source/misc/restrictedpaths.cxx | 2 +- svl/source/numbers/numfmuno.cxx | 1 - svl/source/numbers/supservs.cxx | 1 - svl/source/numbers/zforlist.cxx | 48 +-- svl/source/svdde/ddecli.cxx | 10 +- svl/source/syslocale/makefile.mk | 48 --- svl/source/syslocale/syslocale.cxx | 176 -------- svl/util/makefile.mk | 2 - unotools/inc/unotools/configitem.hxx | 1 - unotools/inc/unotools/misccfg.hxx | 70 +++ unotools/inc/unotools/options.hxx | 3 + unotools/inc/unotools/syslocale.hxx | 82 ++++ unotools/inc/unotools/syslocaleoptions.hxx | 162 +++++++ unotools/source/config/configitem.cxx | 1 + unotools/source/config/itemholder1.cxx | 10 +- unotools/source/config/makefile.mk | 2 + unotools/source/config/misccfg.cxx | 312 ++++++++++++++ unotools/source/config/options.cxx | 23 +- unotools/source/config/syslocaleoptions.cxx | 584 +++++++++++++++++++++++++ unotools/source/config/undoopt.cxx | 4 - unotools/source/config/useroptions.cxx | 4 - unotools/source/misc/makefile.mk | 1 + unotools/source/misc/syslocale.cxx | 205 +++++++++ vcl/inc/vcl/settings.hxx | 12 +- vcl/source/app/settings.cxx | 44 +- vcl/source/app/svapp.cxx | 1 + vcl/source/control/field2.cxx | 7 +- vcl/win/source/window/salframe.cxx | 3 +- 44 files changed, 1548 insertions(+), 2070 deletions(-) delete mode 100644 svl/inc/flbytes.hxx delete mode 100644 svl/inc/misccfg.hxx delete mode 100644 svl/inc/svl/syslocale.hxx delete mode 100644 svl/inc/svl/syslocaleoptions.hxx delete mode 100644 svl/source/config/misccfg.cxx delete mode 100644 svl/source/config/syslocaleoptions.cxx delete mode 100644 svl/source/misc/flbytes.cxx delete mode 100644 svl/source/syslocale/makefile.mk delete mode 100644 svl/source/syslocale/syslocale.cxx create mode 100644 unotools/inc/unotools/misccfg.hxx create mode 100644 unotools/inc/unotools/syslocale.hxx create mode 100644 unotools/inc/unotools/syslocaleoptions.hxx create mode 100644 unotools/source/config/misccfg.cxx create mode 100644 unotools/source/config/syslocaleoptions.cxx create mode 100644 unotools/source/misc/syslocale.cxx diff --git a/svl/inc/flbytes.hxx b/svl/inc/flbytes.hxx deleted file mode 100644 index 86c19191de2a..000000000000 --- a/svl/inc/flbytes.hxx +++ /dev/null @@ -1,174 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: flbytes.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _FLBYTES_HXX -#define _FLBYTES_HXX - -#include -#include - -//============================================================================ -class SvFillLockBytes : public SvLockBytes -{ - SvLockBytesRef xLockBytes; - ULONG nFilledSize; - BOOL bTerminated; - BOOL bSync; -public: - TYPEINFO(); - - SvFillLockBytes( SvLockBytes* pLockBytes ); - virtual ErrCode ReadAt( - ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pRead ) const; - virtual ErrCode WriteAt( - ULONG nPos, const void* pBuffer, ULONG nCount, ULONG* pWritten ); - virtual ErrCode Flush() const; - virtual ErrCode SetSize( ULONG nSize ); - virtual ErrCode LockRegion( ULONG nPos, ULONG nCount, LockType ); - virtual ErrCode UnlockRegion( ULONG nPos, ULONG nCount, LockType ); - virtual ErrCode Stat( SvLockBytesStat*, SvLockBytesStatFlag ) const; - ErrCode FillAppend( const void* pBuffer, ULONG nCount, ULONG *pWritten ); - ULONG Tell() const { return nFilledSize; } - void Seek( ULONG nPos ) { nFilledSize = nPos; } - - void Terminate(); -}; - -SV_DECL_IMPL_REF( SvFillLockBytes ) - -//============================================================================ -class SvSyncLockBytes: public SvOpenLockBytes -{ - SvAsyncLockBytesRef m_xAsyncLockBytes; - -public: - TYPEINFO(); - - /// Create a synchronous wrapper around existing asynchronous lock bytes. - /// - /// @param pTheAsyncLockBytes Must not be null. - inline SvSyncLockBytes(SvAsyncLockBytes * pTheAsyncLockBytes); - - /// Create a synchronous wrapper around an existing stream. - /// - /// @descr This is like first creating asynchronous lock bytes around the - /// stream and than creating a synchronous wrapper around the asynchronous - /// lock bytes. - /// - /// @param pStream Must not be null. - /// - /// @param bOwner True if these lock bytes own the stream (delete it on - /// destruction). - SvSyncLockBytes(SvStream * pStream, BOOL bOwner): - m_xAsyncLockBytes(new SvAsyncLockBytes(pStream, bOwner)) {} - - virtual const SvStream * GetStream() const - { return m_xAsyncLockBytes->GetStream(); } - - virtual void SetSynchronMode(BOOL bSync = TRUE) - { m_xAsyncLockBytes->SetSynchronMode(bSync); } - - virtual BOOL IsSynchronMode() const - { return m_xAsyncLockBytes->IsSynchronMode(); } - - virtual ErrCode ReadAt(ULONG nPos, void * pBuffer, ULONG nCount, - ULONG * pRead) const; - - virtual ErrCode WriteAt(ULONG nPos, const void * pBuffer, ULONG nCount, - ULONG * pWritten); - - virtual ErrCode Flush() const { return m_xAsyncLockBytes->Flush(); } - - virtual ErrCode SetSize(ULONG nSize) - { return m_xAsyncLockBytes->SetSize(nSize); } - - virtual ErrCode LockRegion(ULONG nPos, ULONG nCount, LockType eType) - { return m_xAsyncLockBytes->LockRegion(nPos, nCount, eType); } - - virtual ErrCode UnlockRegion(ULONG nPos, ULONG nCount, LockType eType) - { return m_xAsyncLockBytes->UnlockRegion(nPos, nCount, eType); } - - virtual ErrCode Stat(SvLockBytesStat * pStat, SvLockBytesStatFlag eFlag) - const - { return m_xAsyncLockBytes->Stat(pStat, eFlag); } - - virtual ErrCode FillAppend(const void * pBuffer, ULONG nCount, - ULONG * pWritten) - { return m_xAsyncLockBytes->FillAppend(pBuffer, nCount, pWritten); } - - virtual ULONG Tell() const { return m_xAsyncLockBytes->Tell(); } - - virtual ULONG Seek(ULONG nPos) - { return m_xAsyncLockBytes->Seek(nPos); } - - virtual void Terminate() { m_xAsyncLockBytes->Terminate(); } -}; - -inline SvSyncLockBytes::SvSyncLockBytes(SvAsyncLockBytes * - pTheAsyncLockBytes): - m_xAsyncLockBytes(pTheAsyncLockBytes) -{ - DBG_ASSERT(m_xAsyncLockBytes.Is(), - "SvSyncLockBytes::SvSyncLockBytes(): Null"); -} - -SV_DECL_IMPL_REF(SvSyncLockBytes); - -//============================================================================ -struct SvCompositeLockBytes_Impl; -class SvCompositeLockBytes : public SvLockBytes -{ - SvCompositeLockBytes_Impl* pImpl; -public: - TYPEINFO(); - - SvCompositeLockBytes( ); - ~SvCompositeLockBytes(); - - void Append( SvLockBytes* pLockBytes, ULONG nPos, ULONG nOffset ); - ULONG RelativeOffset( ULONG nPos ) const; - void SetIsPending( BOOL bSet ); - SvLockBytes* GetLastLockBytes() const; - - virtual ErrCode ReadAt( - ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pRead ) const; - virtual ErrCode WriteAt( - ULONG nPos, const void* pBuffer, ULONG nCount, ULONG* pWritten ); - virtual ErrCode Flush() const; - virtual ErrCode SetSize( ULONG nSize ); - virtual ErrCode LockRegion( ULONG nPos, ULONG nCount, LockType ); - virtual ErrCode UnlockRegion( ULONG nPos, ULONG nCount, LockType ); - virtual ErrCode Stat( SvLockBytesStat*, SvLockBytesStatFlag ) const; -}; - -SV_DECL_IMPL_REF( SvCompositeLockBytes ) - - -#endif diff --git a/svl/inc/misccfg.hxx b/svl/inc/misccfg.hxx deleted file mode 100644 index 7b89361b7390..000000000000 --- a/svl/inc/misccfg.hxx +++ /dev/null @@ -1,75 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: misccfg.hxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFX_MISCCFG_HXX -#define _SFX_MISCCFG_HXX - -#include "svl/svldllapi.h" -#include "tools/solar.h" -#include "unotools/configitem.hxx" - -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ - -class SVL_DLLPUBLIC SfxMiscCfg : public utl::ConfigItem -{ - BOOL bPaperSize; // printer warnings - BOOL bPaperOrientation; - BOOL bNotFound; - sal_Int32 nYear2000; // two digit year representation - - const com::sun::star::uno::Sequence& GetPropertyNames(); - void Load(); - -public: - SfxMiscCfg( ); - ~SfxMiscCfg( ); - - virtual void Notify( const com::sun::star::uno::Sequence& aPropertyNames); - virtual void Commit(); - - BOOL IsNotFoundWarning() const {return bNotFound;} - void SetNotFoundWarning( BOOL bSet); - - BOOL IsPaperSizeWarning() const {return bPaperSize;} - void SetPaperSizeWarning(BOOL bSet); - - BOOL IsPaperOrientationWarning() const {return bPaperOrientation;} - void SetPaperOrientationWarning( BOOL bSet); - - // 0 ... 99 - sal_Int32 GetYear2000() const { return nYear2000; } - void SetYear2000( sal_Int32 nSet ); - -}; - -#endif // _MISCCFG_HXX - - diff --git a/svl/inc/svl/ondemand.hxx b/svl/inc/svl/ondemand.hxx index 76fd9efe3672..3369f286b2cd 100644 --- a/svl/inc/svl/ondemand.hxx +++ b/svl/inc/svl/ondemand.hxx @@ -31,7 +31,7 @@ #ifndef INCLUDED_SVTOOLS_ONDEMAND_HXX #define INCLUDED_SVTOOLS_ONDEMAND_HXX -#include +#include #include #include #include diff --git a/svl/inc/svl/syslocale.hxx b/svl/inc/svl/syslocale.hxx deleted file mode 100644 index e655f2eb3006..000000000000 --- a/svl/inc/svl/syslocale.hxx +++ /dev/null @@ -1,78 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: syslocale.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_SVTOOLS_SYSLOCALE_HXX -#define INCLUDED_SVTOOLS_SYSLOCALE_HXX - -#include "svl/svldllapi.h" -#include -#include -#include - - -class SvtSysLocale_Impl; -namespace osl { class Mutex; } -class LocaleDataWrapper; - -/** - SvtSysLocale provides a refcounted single instance of an application wide - LocaleDataWrapper and CharClass which always - follow the locale as it is currently configured by the user. You may use - it anywhere to access the locale data elements like decimal separator and - simple date formatting and so on. Contructing and destructing a - SvtSysLocale is not expensive as long as there is at least one instance - left. - */ -class SVL_DLLPUBLIC SvtSysLocale -{ - friend class SvtSysLocale_Impl; // access to mutex - - static SvtSysLocale_Impl* pImpl; - static sal_Int32 nRefCount; - - SVL_DLLPRIVATE static ::osl::Mutex& GetMutex(); - -public: - SvtSysLocale(); - ~SvtSysLocale(); - - const LocaleDataWrapper& GetLocaleData() const; - const CharClass& GetCharClass() const; - - /** It is safe to store the pointers locally and use them AS LONG AS THE - INSTANCE OF SvtSysLocale LIVES! - It is a faster access but be sure what you do! - */ - const LocaleDataWrapper* GetLocaleDataPtr() const; - const CharClass* GetCharClassPtr() const; - -}; - -#endif // INCLUDED_SVTOOLS_SYSLOCALE_HXX diff --git a/svl/inc/svl/syslocaleoptions.hxx b/svl/inc/svl/syslocaleoptions.hxx deleted file mode 100644 index 4570f7453ec0..000000000000 --- a/svl/inc/svl/syslocaleoptions.hxx +++ /dev/null @@ -1,164 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: syslocaleoptions.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX -#define INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX - -#include "svl/svldllapi.h" -#include -#include -#include -#include -#include -#include -#include - -// bits for broadcasting hints of changes in a SfxSimpleHint, may be combined -const ULONG SYSLOCALEOPTIONS_HINT_LOCALE = 0x00000001; -const ULONG SYSLOCALEOPTIONS_HINT_CURRENCY = 0x00000002; - -class SvtSysLocaleOptions_Impl; -class SvtListener; -namespace osl { class Mutex; } - -class SVL_DLLPUBLIC SvtSysLocaleOptions: public utl::detail::Options -{ - static SvtSysLocaleOptions_Impl* pOptions; - static sal_Int32 nRefCount; - - SVL_DLLPRIVATE static ::osl::Mutex& GetMutex(); - -public: - - enum EOption - { - E_LOCALE, - E_CURRENCY - }; - SvtSysLocaleOptions(); - virtual ~SvtSysLocaleOptions(); - - // ConfigItem methods - - sal_Bool IsModified(); - void Commit(); - - /** Add a listener to react on config changes - which are broadcasted in a SfxSimpleHint - @return - if added - if not added - */ - BOOL AddListener( SvtListener& ); - BOOL RemoveListener( SvtListener& ); - - /** Block broadcasts and accumulate hints. This may be useful if, for - example, the locale and currency are changed and the currency was - empty before, since changing the locale with an empty currency does - also broadcast a change hint for the currency which would result in - two currency changes broadcasted. - - @param bBlock - : broadcasts are blocked until reversed. - : broadcasts are not blocked anymore. Pending hints are - broadcasted if no other instance blocks the broadcast. - - @ATTENTION - All SvtSysLocaleOptions instances point to exactly one refcounted - internal representation instance and broadcast blocks are counted. - Thus if you issue a BlockBroadcasts(TRUE) you MUST issue a matching - BlockBroadcasts(FALSE) or otherwise pending hints would never be - broadcasted again. - */ - void BlockBroadcasts( BOOL bBlock ); - - // config value access methods - - /// The config string may be empty to denote the SYSTEM locale - const ::rtl::OUString& GetLocaleConfigString() const; - void SetLocaleConfigString( const ::rtl::OUString& rStr ); - - /// The config string may be empty to denote the default currency of the locale - const ::rtl::OUString& GetCurrencyConfigString() const; - void SetCurrencyConfigString( const ::rtl::OUString& rStr ); - // determine whether the decimal separator defined in the keyboard layout is used - // or the one approriate to the locale - sal_Bool IsDecimalSeparatorAsLocale() const; - void SetDecimalSeparatorAsLocale( sal_Bool bSet); - - // convenience methods - - /** Get the LanguageType of the current locale, may be LANGUAGE_SYSTEM if - LocaleConfigString is empty. If you need the real locale used in the - application, call Application::GetSettings().GetLanguage() instead */ - LanguageType GetLocaleLanguageType() const; - - /// Get currency abbreviation and locale from an USD-en-US or EUR-de-DE string - static void GetCurrencyAbbrevAndLanguage( - String& rAbbrev, - LanguageType& eLang, - const ::rtl::OUString& rConfigString ); - - /// Create an USD-en-US or EUR-de-DE string - static ::rtl::OUString CreateCurrencyConfigString( - const String& rAbbrev, - LanguageType eLang ); - - void GetCurrencyAbbrevAndLanguage( - String& rAbbrev, - LanguageType& eLang ) const - { - GetCurrencyAbbrevAndLanguage( rAbbrev, - eLang, GetCurrencyConfigString() ); - } - - void SetCurrencyAbbrevAndLanguage( - const String& rAbbrev, - LanguageType eLang ) - { - SetCurrencyConfigString( - CreateCurrencyConfigString( - rAbbrev, eLang ) ); - } - - /** Set a link to a method to be called whenever the default currency - changes. This can be only one method, and normally it is the static - link method which calls SvNumberFormatter::SetDefaultSystemCurrency(). - This is needed because the number formatter isn't part of the svl light - library, otherwise we could call SetDefaultSystemCurrency() directly. - */ - static void SetCurrencyChangeLink( const Link& rLink ); - static const Link& GetCurrencyChangeLink(); - - /** return the readonly state of the queried option. */ - sal_Bool IsReadOnly( EOption eOption ) const; -}; - -#endif // INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX diff --git a/svl/prj/build.lst b/svl/prj/build.lst index 52bc7f82b3cd..8dc6d831f850 100644 --- a/svl/prj/build.lst +++ b/svl/prj/build.lst @@ -13,10 +13,9 @@ sl svl\source\notify nmake - all sl_not sl_inc NULL sl svl\source\numbers nmake - all sl_num sl_inc NULL sl svl\source\svdde nmake - all sl__dde sl_inc NULL sl svl\source\svsql nmake - all sl_sql sl_inc NULL -sl svl\source\syslocale nmake - all sl_sysloc sl_inc NULL sl svl\source\undo nmake - all sl_undo sl_inc NULL sl svl\source\uno nmake - all sl_uno sl_inc NULL -sl svl\util nmake - all sl_util sl_usdde.u sl_psdde.p sl_conf sl_filepick sl_file sl__item sl_mem sl__misc sl_not sl_num sl__dde sl_sql sl_sysloc sl_undo sl_uno NULL +sl svl\util nmake - all sl_util sl_usdde.u sl_psdde.p sl_conf sl_filepick sl_file sl__item sl_mem sl__misc sl_not sl_num sl__dde sl_sql sl_undo sl_uno NULL sl svl\source\fsstor nmake - all sl_fsstor sl_inc NULL sl svl\source\passwordcontainer nmake - all sl_passcont sl_inc NULL diff --git a/svl/source/config/ctloptions.cxx b/svl/source/config/ctloptions.cxx index f2f82425e7de..a63944140672 100644 --- a/svl/source/config/ctloptions.cxx +++ b/svl/source/config/ctloptions.cxx @@ -42,9 +42,9 @@ #include #include #include -#include #include - +#include +#include #include using namespace ::com::sun::star; @@ -309,7 +309,7 @@ void SvtCTLOptions_Impl::Load() ((eSystemLanguage != LANGUAGE_SYSTEM) && ( nWinScript & SCRIPTTYPE_COMPLEX ))) ) { m_bCTLFontEnabled = sal_True; - sal_uInt16 nLanguage = Application::GetSettings().GetLanguage(); + sal_uInt16 nLanguage = SvtSysLocale().GetLanguage(); //enable sequence checking for the appropriate languages m_bCTLSequenceChecking = m_bCTLRestricted = m_bCTLTypeAndReplace = (MsLangId::needsSequenceChecking( nLanguage) || @@ -490,8 +490,11 @@ sal_Bool SvtCTLOptions::IsReadOnly(EOption eOption) const --------------------------------------------------*/ void SvtCTLOptions::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - vos::OGuard aVclGuard( Application::GetSolarMutex() ); - Broadcast( rHint ); + if ( ::tools::SolarMutex::Acquire() ) + { + Broadcast( rHint ); + ::tools::SolarMutex::Release(); + } } // ----------------------------------------------------------------------------- diff --git a/svl/source/config/itemholder2.cxx b/svl/source/config/itemholder2.cxx index f8fc8a8427e7..695c6598140c 100644 --- a/svl/source/config/itemholder2.cxx +++ b/svl/source/config/itemholder2.cxx @@ -41,8 +41,6 @@ #include #include #include -#include -#include #include #include @@ -167,14 +165,6 @@ void ItemHolder2::impl_newItem(TItemInfo& rItem) // capsulate CTL and CJL options ! rItem.pItem = new SvtLanguageOptions(); break; - case E_MISCCFG : -// no ref count rItem.pItem = new SfxMiscCfg(); - break; - - case E_SYSLOCALEOPTIONS : - rItem.pItem = new SvtSysLocaleOptions(); - break; - default: OSL_ASSERT(false); break; diff --git a/svl/source/config/languageoptions.cxx b/svl/source/config/languageoptions.cxx index fa01996b6a82..20a74bbba28a 100644 --- a/svl/source/config/languageoptions.cxx +++ b/svl/source/config/languageoptions.cxx @@ -34,13 +34,13 @@ #include #include #include -#include #include #include -#include #include #include #include +#include +#include using namespace ::com::sun::star; // global ---------------------------------------------------------------------- @@ -205,8 +205,11 @@ sal_Bool SvtLanguageOptions::IsReadOnly(SvtLanguageOptions::EOption eOption) con --------------------------------------------------*/ void SvtLanguageOptions::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - vos::OGuard aVclGuard( Application::GetSolarMutex() ); - Broadcast( rHint ); + if ( ::tools::SolarMutex::Acquire() ) + { + Broadcast( rHint ); + ::tools::SolarMutex::Release(); + } } // ----------------------------------------------------------------------------- @@ -216,7 +219,7 @@ sal_uInt16 SvtLanguageOptions::GetScriptTypeOfLanguage( sal_uInt16 nLang ) if( LANGUAGE_DONTKNOW == nLang ) nLang = LANGUAGE_ENGLISH_US; else if( LANGUAGE_SYSTEM == nLang ) - nLang = Application::GetSettings().GetLanguage(); + nLang = SvtSysLocale().GetLanguage(); sal_Int16 nScriptType = MsLangId::getScriptType( nLang ); USHORT nScript; diff --git a/svl/source/config/makefile.mk b/svl/source/config/makefile.mk index e9beacce6a8e..82c4ae12828f 100644 --- a/svl/source/config/makefile.mk +++ b/svl/source/config/makefile.mk @@ -46,9 +46,7 @@ SLOFILES= \ $(SLO)$/cjkoptions.obj \ $(SLO)$/ctloptions.obj \ $(SLO)$/itemholder2.obj \ - $(SLO)$/languageoptions.obj \ - $(SLO)$/misccfg.obj \ - $(SLO)$/syslocaleoptions.obj + $(SLO)$/languageoptions.obj # --- Targets ------------------------------------------------------ diff --git a/svl/source/config/misccfg.cxx b/svl/source/config/misccfg.cxx deleted file mode 100644 index b7a9f230c849..000000000000 --- a/svl/source/config/misccfg.cxx +++ /dev/null @@ -1,190 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: misccfg.cxx,v $ - * $Revision: 1.9 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svl.hxx" - -#include "misccfg.hxx" -#include -#include - -#include - - -#define DEFAULT_TAB 2000 - -#define DEF_INCH 2540L -#define DEF_RELTWIP 1440L - -using namespace rtl; -using namespace com::sun::star::uno; - -#define C2U(cChar) OUString::createFromAscii(cChar) -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ -SfxMiscCfg::SfxMiscCfg() : - ConfigItem(C2U("Office.Common") ), - bPaperSize(FALSE), - bPaperOrientation (FALSE), - bNotFound (FALSE), - nYear2000( SvNumberFormatter::GetYear2000Default() ) -{ - RTL_LOGFILE_CONTEXT(aLog, "svl SfxMiscCfg::SfxMiscCfg()"); - - Load(); -} -/* -----------------------------02.03.01 15:31-------------------------------- - - ---------------------------------------------------------------------------*/ -SfxMiscCfg::~SfxMiscCfg() -{ -} -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ - -void SfxMiscCfg::SetNotFoundWarning( BOOL bSet) -{ - if(bNotFound != bSet) - SetModified(); - bNotFound = bSet; -} - -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ - -void SfxMiscCfg::SetPaperSizeWarning( BOOL bSet) -{ - if(bPaperSize != bSet) - SetModified(); - bPaperSize = bSet; -} - -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ -void SfxMiscCfg::SetPaperOrientationWarning( BOOL bSet) -{ - if(bPaperOrientation != bSet) - SetModified(); - bPaperOrientation = bSet; -} -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ - -void SfxMiscCfg::SetYear2000( sal_Int32 nSet ) -{ - if(nYear2000 != nSet) - SetModified(); - nYear2000 = nSet; -} -/* -----------------------------02.03.01 15:31-------------------------------- - - ---------------------------------------------------------------------------*/ -const Sequence& SfxMiscCfg::GetPropertyNames() -{ - static Sequence aNames; - if(!aNames.getLength()) - { - static const char* aPropNames[] = - { - "Print/Warning/PaperSize", // 0 - "Print/Warning/PaperOrientation", // 1 - "Print/Warning/NotFound", // 2 - "DateFormat/TwoDigitYear", // 3 - }; - const int nCount = 4; - aNames.realloc(nCount); - OUString* pNames = aNames.getArray(); - for(int i = 0; i < nCount; i++) - pNames[i] = OUString::createFromAscii(aPropNames[i]); - } - return aNames; -} -/* -----------------------------02.03.01 15:31-------------------------------- - - ---------------------------------------------------------------------------*/ -void SfxMiscCfg::Load() -{ - const Sequence& aNames = GetPropertyNames(); - Sequence aValues = GetProperties(aNames); - EnableNotification(aNames); - const Any* pValues = aValues.getConstArray(); - DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed"); - if(aValues.getLength() == aNames.getLength()) - { - for(int nProp = 0; nProp < aNames.getLength(); nProp++) - { - if(pValues[nProp].hasValue()) - { - switch(nProp) - { - case 0: bPaperSize = *(sal_Bool*)pValues[nProp].getValue(); break; //"Print/Warning/PaperSize", - case 1: bPaperOrientation = *(sal_Bool*)pValues[nProp].getValue(); break; //"Print/Warning/PaperOrientation", - case 2: bNotFound = *(sal_Bool*)pValues[nProp].getValue() ; break; //"Print/Warning/NotFound", - case 3: pValues[nProp] >>= nYear2000;break; //"DateFormat/TwoDigitYear", - } - } - } - } -} -/* -----------------------------02.03.01 15:31-------------------------------- - - ---------------------------------------------------------------------------*/ -void SfxMiscCfg::Notify( const com::sun::star::uno::Sequence& ) -{ - Load(); -} -/* -----------------------------02.03.01 15:31-------------------------------- - - ---------------------------------------------------------------------------*/ -void SfxMiscCfg::Commit() -{ - const Sequence& aNames = GetPropertyNames(); - Sequence aValues(aNames.getLength()); - Any* pValues = aValues.getArray(); - - const Type& rType = ::getBooleanCppuType(); - for(int nProp = 0; nProp < aNames.getLength(); nProp++) - { - switch(nProp) - { - case 0: pValues[nProp].setValue(&bPaperSize, rType);break; //"Print/Warning/PaperSize", - case 1: pValues[nProp].setValue(&bPaperOrientation, rType);break; //"Print/Warning/PaperOrientation", - case 2: pValues[nProp].setValue(&bNotFound, rType);break; //"Print/Warning/NotFound", - case 3: pValues[nProp] <<= nYear2000;break; //"DateFormat/TwoDigitYear", - } - } - PutProperties(aNames, aValues); -} - diff --git a/svl/source/config/syslocaleoptions.cxx b/svl/source/config/syslocaleoptions.cxx deleted file mode 100644 index dc6f7d630d40..000000000000 --- a/svl/source/config/syslocaleoptions.cxx +++ /dev/null @@ -1,632 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: syslocaleoptions.cxx,v $ - * $Revision: 1.23 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svl.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "itemholder2.hxx" - - -#define CFG_READONLY_DEFAULT sal_False - -using namespace osl; -using namespace utl; -using namespace rtl; -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; - - -SvtSysLocaleOptions_Impl* SvtSysLocaleOptions::pOptions = NULL; -sal_Int32 SvtSysLocaleOptions::nRefCount = 0; -namespace -{ - struct CurrencyChangeLink - : public rtl::Static {}; -} - -class SvtSysLocaleOptions_Impl : public utl::ConfigItem -{ - OUString m_aLocaleString; // en-US or de-DE or empty for SYSTEM - LanguageType m_eLocaleLanguageType; // same for convenience access - OUString m_aCurrencyString; // USD-en-US or EUR-de-DE - SvtBroadcaster m_aBroadcaster; - ULONG m_nBlockedHint; // pending hints - sal_Int32 m_nBroadcastBlocked; // broadcast only if this is 0 - sal_Bool m_bDecimalSeparator; //use decimal separator same as locale - - - sal_Bool m_bROLocale; - sal_Bool m_bROCurrency; - sal_Bool m_bRODecimalSeparator; - - static const Sequence< /* const */ OUString > GetPropertyNames(); - - void UpdateMiscSettings_Impl(); - ULONG ChangeLocaleSettings(); - void ChangeDefaultCurrency() const; - void Broadcast( ULONG nHint ); - -public: - SvtSysLocaleOptions_Impl(); - virtual ~SvtSysLocaleOptions_Impl(); - - virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); - virtual void Commit(); - - const OUString& GetLocaleString() const - { return m_aLocaleString; } - void SetLocaleString( const OUString& rStr ); - LanguageType GetLocaleLanguageType() const - { return m_eLocaleLanguageType; } - - const OUString& GetCurrencyString() const - { return m_aCurrencyString; } - void SetCurrencyString( const OUString& rStr ); - - sal_Bool IsDecimalSeparatorAsLocale() const { return m_bDecimalSeparator;} - void SetDecimalSeparatorAsLocale( sal_Bool bSet); - - SvtBroadcaster& GetBroadcaster() - { return m_aBroadcaster; } - void BlockBroadcasts( BOOL bBlock ); - sal_Bool IsReadOnly( SvtSysLocaleOptions::EOption eOption ) const; -}; - - -#define ROOTNODE_SYSLOCALE OUString(RTL_CONSTASCII_USTRINGPARAM("Setup/L10N")) - -#define PROPERTYNAME_LOCALE OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupSystemLocale")) -#define PROPERTYNAME_CURRENCY OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupCurrency")) -#define PROPERTYNAME_DECIMALSEPARATOR OUString(RTL_CONSTASCII_USTRINGPARAM("DecimalSeparatorAsLocale")) - -#define PROPERTYHANDLE_LOCALE 0 -#define PROPERTYHANDLE_CURRENCY 1 -#define PROPERTYHANDLE_DECIMALSEPARATOR 2 - -#define PROPERTYCOUNT 3 - -const Sequence< OUString > SvtSysLocaleOptions_Impl::GetPropertyNames() -{ - static const OUString pProperties[] = - { - PROPERTYNAME_LOCALE, - PROPERTYNAME_CURRENCY, - PROPERTYNAME_DECIMALSEPARATOR - }; - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); - return seqPropertyNames; -} - - -// ----------------------------------------------------------------------- - -SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl() - : ConfigItem( ROOTNODE_SYSLOCALE ) - , m_nBlockedHint( 0 ) - , m_nBroadcastBlocked( 0 ) - , m_bDecimalSeparator( sal_True ) - , m_bROLocale(CFG_READONLY_DEFAULT) - , m_bROCurrency(CFG_READONLY_DEFAULT) - , m_bRODecimalSeparator(sal_False) - -{ - if ( !IsValidConfigMgr() ) - ChangeLocaleSettings(); // assume SYSTEM defaults during Setup - else - { - const Sequence< OUString > aNames = GetPropertyNames(); - Sequence< Any > aValues = GetProperties( aNames ); - Sequence< sal_Bool > aROStates = GetReadOnlyStates( aNames ); - const Any* pValues = aValues.getConstArray(); - const sal_Bool* pROStates = aROStates.getConstArray(); - DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" ); - DBG_ASSERT( aROStates.getLength() == aNames.getLength(), "GetReadOnlyStates failed" ); - if ( aValues.getLength() == aNames.getLength() && aROStates.getLength() == aNames.getLength() ) - { - for ( sal_Int32 nProp = 0; nProp < aNames.getLength(); nProp++ ) - { - DBG_ASSERT( pValues[nProp].hasValue(), "property value missing" ); - if ( pValues[nProp].hasValue() ) - { - switch ( nProp ) - { - case PROPERTYHANDLE_LOCALE : - { - OUString aStr; - if ( pValues[nProp] >>= aStr ) - m_aLocaleString = aStr; - else - { - DBG_ERRORFILE( "Wrong property type!" ); - } - m_bROLocale = pROStates[nProp]; - } - break; - case PROPERTYHANDLE_CURRENCY : - { - OUString aStr; - if ( pValues[nProp] >>= aStr ) - m_aCurrencyString = aStr; - else - { - DBG_ERRORFILE( "Wrong property type!" ); - } - m_bROCurrency = pROStates[nProp]; - } - break; - case PROPERTYHANDLE_DECIMALSEPARATOR: - { - sal_Bool bValue = sal_Bool(); - if ( pValues[nProp] >>= bValue ) - m_bDecimalSeparator = bValue; - else - { - DBG_ERRORFILE( "Wrong property type!" ); - } - m_bRODecimalSeparator = pROStates[nProp]; - } - break; - default: - DBG_ERRORFILE( "Wrong property type!" ); - } - } - } - } - UpdateMiscSettings_Impl(); - ChangeLocaleSettings(); - EnableNotification( aNames ); - } -} - - -SvtSysLocaleOptions_Impl::~SvtSysLocaleOptions_Impl() -{ - if ( IsModified() ) - Commit(); -} - - -void SvtSysLocaleOptions_Impl::BlockBroadcasts( BOOL bBlock ) -{ - if ( bBlock ) - ++m_nBroadcastBlocked; - else if ( m_nBroadcastBlocked ) - { - if ( --m_nBroadcastBlocked == 0 ) - Broadcast( 0 ); - } -} - -sal_Bool SvtSysLocaleOptions_Impl::IsReadOnly( SvtSysLocaleOptions::EOption eOption ) const -{ - sal_Bool bReadOnly = CFG_READONLY_DEFAULT; - switch(eOption) - { - case SvtSysLocaleOptions::E_LOCALE : - { - bReadOnly = m_bROLocale; - break; - } - case SvtSysLocaleOptions::E_CURRENCY : - { - bReadOnly = m_bROCurrency; - break; - } - } - return bReadOnly; -} - - -void SvtSysLocaleOptions_Impl::Broadcast( ULONG nHint ) -{ - if ( m_nBroadcastBlocked ) - m_nBlockedHint |= nHint; - else - { - nHint |= m_nBlockedHint; - m_nBlockedHint = 0; - if ( nHint ) - { - if ( nHint & SYSLOCALEOPTIONS_HINT_CURRENCY ) - ChangeDefaultCurrency(); - SfxSimpleHint aHint( nHint ); - GetBroadcaster().Broadcast( aHint ); - } - } -} - - -void SvtSysLocaleOptions_Impl::Commit() -{ - const Sequence< OUString > aOrgNames = GetPropertyNames(); - sal_Int32 nOrgCount = aOrgNames.getLength(); - - Sequence< OUString > aNames( nOrgCount ); - Sequence< Any > aValues( nOrgCount ); - - OUString* pNames = aNames.getArray(); - Any* pValues = aValues.getArray(); - sal_Int32 nRealCount = 0; - - for ( sal_Int32 nProp = 0; nProp < nOrgCount; nProp++ ) - { - switch ( nProp ) - { - case PROPERTYHANDLE_LOCALE : - { - if (!m_bROLocale) - { - pNames[nRealCount] = aOrgNames[nProp]; - pValues[nRealCount] <<= m_aLocaleString; - ++nRealCount; - } - } - break; - case PROPERTYHANDLE_CURRENCY : - { - if (!m_bROLocale) - { - pNames[nRealCount] = aOrgNames[nProp]; - pValues[nRealCount] <<= m_aCurrencyString; - ++nRealCount; - } - } - break; - case PROPERTYHANDLE_DECIMALSEPARATOR: - if( !m_bRODecimalSeparator ) - { - pNames[nRealCount] = aOrgNames[nProp]; - pValues[nRealCount] <<= m_bDecimalSeparator; - ++nRealCount; - } - break; - default: - DBG_ERRORFILE( "invalid index to save a path" ); - } - } - aNames.realloc(nRealCount); - aValues.realloc(nRealCount); - PutProperties( aNames, aValues ); - ClearModified(); -} - - -void SvtSysLocaleOptions_Impl::SetLocaleString( const OUString& rStr ) -{ - if (!m_bROLocale && rStr != m_aLocaleString ) - { - m_aLocaleString = rStr; - SetModified(); - ULONG nHint = SYSLOCALEOPTIONS_HINT_LOCALE; - nHint |= ChangeLocaleSettings(); - Broadcast( nHint ); - } -} - - -ULONG SvtSysLocaleOptions_Impl::ChangeLocaleSettings() -{ - // An empty config value denotes SYSTEM locale - if ( m_aLocaleString.getLength() ) - m_eLocaleLanguageType = MsLangId::convertIsoStringToLanguage( m_aLocaleString ); - else - m_eLocaleLanguageType = LANGUAGE_SYSTEM; - ULONG nHint = 0; - // new locale and no fixed currency => locale default currency might change - if ( !m_aCurrencyString.getLength() ) - nHint |= SYSLOCALEOPTIONS_HINT_CURRENCY; - return nHint; -} - - -void SvtSysLocaleOptions_Impl::SetCurrencyString( const OUString& rStr ) -{ - if (!m_bROCurrency && rStr != m_aCurrencyString ) - { - m_aCurrencyString = rStr; - SetModified(); - Broadcast( SYSLOCALEOPTIONS_HINT_CURRENCY ); - } -} - -void SvtSysLocaleOptions_Impl::SetDecimalSeparatorAsLocale( sal_Bool bSet) -{ - if(bSet != m_bDecimalSeparator) - { - m_bDecimalSeparator = bSet; - SetModified(); - UpdateMiscSettings_Impl(); - } -} - - -void SvtSysLocaleOptions_Impl::ChangeDefaultCurrency() const -{ - const Link& rLink = SvtSysLocaleOptions::GetCurrencyChangeLink(); - if ( rLink.IsSet() ) - rLink.Call( NULL ); -} - - -void SvtSysLocaleOptions_Impl::Notify( const Sequence< rtl::OUString >& seqPropertyNames ) -{ - ULONG nHint = 0; - Sequence< Any > seqValues = GetProperties( seqPropertyNames ); - Sequence< sal_Bool > seqROStates = GetReadOnlyStates( seqPropertyNames ); - sal_Int32 nCount = seqPropertyNames.getLength(); - for( sal_Int32 nProp = 0; nProp < nCount; ++nProp ) - { - if( seqPropertyNames[nProp] == PROPERTYNAME_LOCALE ) - { - DBG_ASSERT( seqValues[nProp].getValueTypeClass() == TypeClass_STRING, "Locale property type" ); - seqValues[nProp] >>= m_aLocaleString; - m_bROLocale = seqROStates[nProp]; - nHint |= SYSLOCALEOPTIONS_HINT_LOCALE; - nHint |= ChangeLocaleSettings(); - } - else if( seqPropertyNames[nProp] == PROPERTYNAME_CURRENCY ) - { - DBG_ASSERT( seqValues[nProp].getValueTypeClass() == TypeClass_STRING, "Currency property type" ); - seqValues[nProp] >>= m_aCurrencyString; - m_bROCurrency = seqROStates[nProp]; - nHint |= SYSLOCALEOPTIONS_HINT_CURRENCY; - } - else if( seqPropertyNames[nProp] == PROPERTYNAME_DECIMALSEPARATOR ) - { - seqValues[nProp] >>= m_bDecimalSeparator; - m_bRODecimalSeparator = seqROStates[nProp]; - UpdateMiscSettings_Impl(); - } - } - if ( nHint ) - Broadcast( nHint ); -} -/* -----------------10.02.2004 15:25----------------- - - --------------------------------------------------*/ -void SvtSysLocaleOptions_Impl::UpdateMiscSettings_Impl() -{ - AllSettings aAllSettings( Application::GetSettings() ); - MiscSettings aMiscSettings = aAllSettings.GetMiscSettings(); - aMiscSettings.SetEnableLocalizedDecimalSep(m_bDecimalSeparator); - aAllSettings.SetMiscSettings( aMiscSettings ); - Application::SetSettings( aAllSettings ); -} - -// ==================================================================== - -SvtSysLocaleOptions::SvtSysLocaleOptions() -{ - MutexGuard aGuard( GetMutex() ); - if ( !pOptions ) - { - RTL_LOGFILE_CONTEXT(aLog, "svl ( ??? ) ::SvtSysLocaleOptions_Impl::ctor()"); - pOptions = new SvtSysLocaleOptions_Impl; - - ItemHolder2::holdConfigItem(E_SYSLOCALEOPTIONS); - } - ++nRefCount; -} - - -SvtSysLocaleOptions::~SvtSysLocaleOptions() -{ - MutexGuard aGuard( GetMutex() ); - if ( !--nRefCount ) - { - delete pOptions; - pOptions = NULL; - } -} - - -// static -Mutex& SvtSysLocaleOptions::GetMutex() -{ - static Mutex* pMutex = NULL; - if( !pMutex ) - { - MutexGuard aGuard( Mutex::getGlobalMutex() ); - if( !pMutex ) - { - // #i77768# Due to a static reference in the toolkit lib - // we need a mutex that lives longer than the svl library. - // Otherwise the dtor would use a destructed mutex!! - pMutex = new Mutex; - } - } - return *pMutex; -} - - -sal_Bool SvtSysLocaleOptions::IsModified() -{ - MutexGuard aGuard( GetMutex() ); - return pOptions->IsModified(); -} - - -void SvtSysLocaleOptions::Commit() -{ - MutexGuard aGuard( GetMutex() ); - pOptions->Commit(); -} - - -BOOL SvtSysLocaleOptions::AddListener( SvtListener& rLst ) -{ - MutexGuard aGuard( GetMutex() ); - return rLst.StartListening( pOptions->GetBroadcaster() ); -} - - -BOOL SvtSysLocaleOptions::RemoveListener( SvtListener& rLst ) -{ - MutexGuard aGuard( GetMutex() ); - return rLst.EndListening( pOptions->GetBroadcaster() ); -} - - -void SvtSysLocaleOptions::BlockBroadcasts( BOOL bBlock ) -{ - MutexGuard aGuard( GetMutex() ); - pOptions->BlockBroadcasts( bBlock ); -} - - -const OUString& SvtSysLocaleOptions::GetLocaleConfigString() const -{ - MutexGuard aGuard( GetMutex() ); - return pOptions->GetLocaleString(); -} - - -void SvtSysLocaleOptions::SetLocaleConfigString( const OUString& rStr ) -{ - MutexGuard aGuard( GetMutex() ); - pOptions->SetLocaleString( rStr ); -} - - -const OUString& SvtSysLocaleOptions::GetCurrencyConfigString() const -{ - MutexGuard aGuard( GetMutex() ); - return pOptions->GetCurrencyString(); -} - - -void SvtSysLocaleOptions::SetCurrencyConfigString( const OUString& rStr ) -{ - MutexGuard aGuard( GetMutex() ); - pOptions->SetCurrencyString( rStr ); -} - - -LanguageType SvtSysLocaleOptions::GetLocaleLanguageType() const -{ - MutexGuard aGuard( GetMutex() ); - return pOptions->GetLocaleLanguageType(); -} - -/*-- 11.02.2004 13:31:41--------------------------------------------------- - - -----------------------------------------------------------------------*/ -sal_Bool SvtSysLocaleOptions::IsDecimalSeparatorAsLocale() const -{ - MutexGuard aGuard( GetMutex() ); - return pOptions->IsDecimalSeparatorAsLocale(); -} -/*-- 11.02.2004 13:31:41--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SvtSysLocaleOptions::SetDecimalSeparatorAsLocale( sal_Bool bSet) -{ - MutexGuard aGuard( GetMutex() ); - pOptions->SetDecimalSeparatorAsLocale(bSet); -} - - -sal_Bool SvtSysLocaleOptions::IsReadOnly( EOption eOption ) const -{ - MutexGuard aGuard( GetMutex() ); - return pOptions->IsReadOnly( eOption ); -} - -// static -void SvtSysLocaleOptions::GetCurrencyAbbrevAndLanguage( String& rAbbrev, - LanguageType& eLang, const ::rtl::OUString& rConfigString ) -{ - sal_Int32 nDelim = rConfigString.indexOf( '-' ); - if ( nDelim >= 0 ) - { - rAbbrev = rConfigString.copy( 0, nDelim ); - String aIsoStr( rConfigString.copy( nDelim+1 ) ); - eLang = MsLangId::convertIsoStringToLanguage( aIsoStr ); - } - else - { - rAbbrev = rConfigString; - eLang = (rAbbrev.Len() ? LANGUAGE_NONE : LANGUAGE_SYSTEM); - } -} - - -// static -::rtl::OUString SvtSysLocaleOptions::CreateCurrencyConfigString( - const String& rAbbrev, LanguageType eLang ) -{ - String aIsoStr( MsLangId::convertLanguageToIsoString( eLang ) ); - if ( aIsoStr.Len() ) - { - ::rtl::OUStringBuffer aStr( rAbbrev.Len() + 1 + aIsoStr.Len() ); - aStr.append( rAbbrev.GetBuffer(), rAbbrev.Len() ); - aStr.append( sal_Unicode('-') ); - aStr.append( aIsoStr.GetBuffer(), aIsoStr.Len() ); - return aStr.makeStringAndClear(); - } - else - return rAbbrev; -} - - -// static -void SvtSysLocaleOptions::SetCurrencyChangeLink( const Link& rLink ) -{ - MutexGuard aGuard( GetMutex() ); - DBG_ASSERT( !CurrencyChangeLink::get().IsSet(), "SvtSysLocaleOptions::SetCurrencyChangeLink: already set" ); - CurrencyChangeLink::get() = rLink; -} - - -// static -const Link& SvtSysLocaleOptions::GetCurrencyChangeLink() -{ - MutexGuard aGuard( GetMutex() ); - return CurrencyChangeLink::get(); -} - diff --git a/svl/source/items/dtritem.cxx b/svl/source/items/dtritem.cxx index 32a7fdc1c60d..12d7828350bb 100644 --- a/svl/source/items/dtritem.cxx +++ b/svl/source/items/dtritem.cxx @@ -40,9 +40,6 @@ #include #include #include - -#include - #include diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index 7ed44f7a9694..756a2f7edc21 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -52,8 +52,7 @@ #include #include #include -#include - +#include #include #define STYLESTREAM "SfxStyleSheets" @@ -393,7 +392,7 @@ XubString SfxStyleSheetBase::GetDescription( SfxMapUnit eMetric ) const SfxPoolItem* pItem = aIter.FirstItem(); IntlWrapper aIntlWrapper(comphelper::getProcessServiceFactory(), - Application::GetSettings().GetLanguage()); + SvtSysLocale().GetLanguage()); while ( pItem ) { XubString aItemPresentation; diff --git a/svl/source/misc/flbytes.cxx b/svl/source/misc/flbytes.cxx deleted file mode 100644 index b8a124f8ec3b..000000000000 --- a/svl/source/misc/flbytes.cxx +++ /dev/null @@ -1,432 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: flbytes.cxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svl.hxx" -#include -#include - -#ifndef _SVSTDARR_ULONGS_DECL -#define _SVSTDARR_ULONGS -#include -#undef _SVSTDARR_ULONGS -#endif - -namespace unnamed_svl_flbytes {} using namespace unnamed_svl_flbytes; - // unnamed namespaces don't work well yet - -//============================================================================ -namespace unnamed_svl_flbytes { - -inline ULONG MyMin( long a, long b ) -{ - return Max( long( Min( a , b ) ), 0L ); -} - -} - -//============================================================================ -// -// SvFillLockBytes -// -//============================================================================ - -TYPEINIT1(SvFillLockBytes, SvLockBytes); - -//============================================================================ -SvFillLockBytes::SvFillLockBytes( SvLockBytes* pLockBytes ) - : xLockBytes( pLockBytes ), - nFilledSize( 0 ), - bTerminated( FALSE ) -{ -} - -//============================================================================ -ErrCode SvFillLockBytes::ReadAt( ULONG nPos, void* pBuffer, ULONG nCount, - ULONG *pRead ) const -{ - if( bTerminated ) - return xLockBytes->ReadAt( nPos, pBuffer, nCount, pRead ); - else - { - ULONG nWanted = nPos + nCount; - if( IsSynchronMode() ) - { - while( nWanted > nFilledSize && !bTerminated ) - Application::Yield(); - return xLockBytes->ReadAt( nPos, pBuffer, nCount, pRead ); - } - else - { - ULONG nRead = MyMin( nCount, long( nFilledSize ) - nPos ); - ULONG nErr = xLockBytes->ReadAt( nPos, pBuffer, nRead, pRead ); - return ( !nCount || nRead == nCount || nErr ) ? - nErr : ERRCODE_IO_PENDING; - } - } -} - -//============================================================================ -ErrCode SvFillLockBytes::WriteAt( ULONG nPos, const void* pBuffer, - ULONG nCount, ULONG *pWritten ) -{ - if( bTerminated ) - return xLockBytes->WriteAt( nPos, pBuffer, nCount, pWritten ); - else - { - ULONG nWanted = nPos + nCount; - if( IsSynchronMode() ) - { - while( nWanted > nFilledSize && !bTerminated ) - Application::Yield(); - return xLockBytes->WriteAt( nPos, pBuffer, nCount, pWritten ); - } - else - { - ULONG nRead = MyMin( nCount, long( nFilledSize ) - nPos ); - ULONG nErr = xLockBytes->WriteAt( nPos, pBuffer, nRead, pWritten ); - return ( !nCount || nRead == nCount || nErr ) ? - nErr : ERRCODE_IO_PENDING; - } - } -} - -//============================================================================ -ErrCode SvFillLockBytes::Flush() const -{ - return xLockBytes->Flush( ); -} - -//============================================================================ -ErrCode SvFillLockBytes::SetSize( ULONG nSize ) -{ - return xLockBytes->SetSize( nSize ); -} - -//============================================================================ -ErrCode SvFillLockBytes::LockRegion( ULONG nPos, ULONG nCount, LockType eType) -{ - return xLockBytes->LockRegion( nPos, nCount, eType ); -} - -//============================================================================ -ErrCode SvFillLockBytes::UnlockRegion( - ULONG nPos, ULONG nCount, LockType eType) -{ - return xLockBytes->UnlockRegion( nPos, nCount, eType ); -} - -//============================================================================ -ErrCode SvFillLockBytes::Stat( - SvLockBytesStat* pStat, SvLockBytesStatFlag eFlag) const -{ - return xLockBytes->Stat( pStat, eFlag ); -} - -//============================================================================ -ErrCode SvFillLockBytes::FillAppend( const void* pBuffer, ULONG nCount, ULONG *pWritten ) -{ - ErrCode nRet = xLockBytes->WriteAt( - nFilledSize, pBuffer, nCount, pWritten ); - nFilledSize += *pWritten; - return nRet; -} - -//============================================================================ -void SvFillLockBytes::Terminate() -{ - bTerminated = TRUE; -} - -//============================================================================ -SV_DECL_IMPL_REF_LIST( SvLockBytes, SvLockBytes* ) - -//============================================================================ -// -// SvSyncLockBytes -// -//============================================================================ - -TYPEINIT1(SvSyncLockBytes, SvOpenLockBytes); - -//============================================================================ -// virtual -ErrCode SvSyncLockBytes::ReadAt(ULONG nPos, void * pBuffer, ULONG nCount, - ULONG * pRead) const -{ - for (ULONG nReadTotal = 0;;) - { - ULONG nReadCount = 0; - ErrCode nError = m_xAsyncLockBytes->ReadAt(nPos, pBuffer, nCount, - &nReadCount); - nReadTotal += nReadCount; - if (nError != ERRCODE_IO_PENDING || !IsSynchronMode()) - { - if (pRead) - *pRead = nReadTotal; - return nError; - } - nPos += nReadCount; - pBuffer = static_cast< sal_Char * >(pBuffer) + nReadCount; - nCount -= nReadCount; - Application::Yield(); - } -} - -//============================================================================ -// virtual -ErrCode SvSyncLockBytes::WriteAt(ULONG nPos, const void * pBuffer, - ULONG nCount, ULONG * pWritten) -{ - for (ULONG nWrittenTotal = 0;;) - { - ULONG nWrittenCount = 0; - ErrCode nError = m_xAsyncLockBytes->WriteAt(nPos, pBuffer, nCount, - &nWrittenCount); - nWrittenTotal += nWrittenCount; - if (nError != ERRCODE_IO_PENDING || !IsSynchronMode()) - { - if (pWritten) - *pWritten = nWrittenTotal; - return nError; - } - nPos += nWrittenCount; - pBuffer = static_cast< sal_Char const * >(pBuffer) + nWrittenCount; - nCount -= nWrittenCount; - Application::Yield(); - } -} - -//============================================================================ -// -// SvCompositeLockBytes -// -//============================================================================ - -struct SvCompositeLockBytes_Impl -{ - SvLockBytesMemberList aLockBytes; - SvULongs aPositions; - SvULongs aOffsets; - BOOL bPending; - ULONG RelativeOffset( ULONG nPos ) const; - ErrCode ReadWrite_Impl( - ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pProcessed, - BOOL bRead ); - SvCompositeLockBytes_Impl() : bPending( FALSE ){} -}; - -//============================================================================ -ULONG SvCompositeLockBytes_Impl::RelativeOffset( ULONG nPos ) const -{ - const SvULongs& rPositions = aPositions; - const SvULongs& rOffsets = aOffsets; - - USHORT nMinPos = 0; - USHORT nListCount = rPositions.Count(); - - // Erster Lockbytes, der bearbeitet werden muss - while( nMinPos + 1 < nListCount && rPositions[ nMinPos + 1 ] <= nPos ) - nMinPos ++; - ULONG nSectionStart = rPositions[ nMinPos ]; - if( nSectionStart > nPos ) - return ULONG_MAX; - return rOffsets[ nMinPos ] + nPos - nSectionStart; -} - -//============================================================================ -ErrCode SvCompositeLockBytes_Impl::ReadWrite_Impl( - ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pProcessed, - BOOL bRead ) -{ - ErrCode nErr = ERRCODE_NONE; - SvULongs& rPositions = aPositions; - SvULongs& rOffsets = aOffsets; - SvLockBytesMemberList& rLockBytes = aLockBytes; - - ULONG nBytes = nCount; - USHORT nListCount = rPositions.Count(); - USHORT nMinPos = 0; - - // Erster Lockbytes, der bearbeitet werden muss - while( nMinPos + 1 < nListCount && rPositions[ nMinPos + 1 ] <= nPos ) - nMinPos ++; - ULONG nSectionStart = rPositions[ nMinPos ]; - - if( nSectionStart > nPos ) - { - // Es wird aus fuehrendem Leerbereich gearbeitet - *pProcessed = 0; - return ERRCODE_IO_CANTREAD; - } - - ULONG nDone; - while( nMinPos < nListCount ) - { - ULONG nToProcess; - ULONG nSectionStop; - if( nMinPos + 1 < nListCount ) - { - nSectionStop = rPositions[ nMinPos + 1 ]; - nToProcess = MyMin( long( nSectionStop ) - nPos, nBytes ); - } - else - { - nToProcess = nBytes; - nSectionStop = 0; - } - ULONG nAbsPos = nPos - nSectionStart + rOffsets[ nMinPos ]; - SvLockBytes* pLB = rLockBytes.GetObject( nMinPos ); - if( bRead ) - nErr = pLB->ReadAt( nAbsPos, pBuffer, nToProcess, &nDone ); - else - nErr = pLB->WriteAt( nAbsPos, pBuffer, nToProcess, &nDone ); - nBytes -= nDone; - if( nErr || nDone < nToProcess || !nBytes ) - { - *pProcessed = nCount - nBytes; - // Wenn aus dem letzten LockBytes nichts mehr gelesen wurde und - // bPending gesetzt ist, Pending zurueck - if( !nDone && nMinPos == nListCount - 1 ) - return bPending ? ERRCODE_IO_PENDING : nErr; - else return nErr; - } - pBuffer = static_cast< sal_Char * >(pBuffer) + nDone; - nPos += nDone; - nSectionStart = nSectionStop; - nMinPos++; - } - return nErr; -} - -//============================================================================ -TYPEINIT1(SvCompositeLockBytes, SvLockBytes); - -//============================================================================ -SvCompositeLockBytes::SvCompositeLockBytes() - : pImpl( new SvCompositeLockBytes_Impl ) -{ -} - -//============================================================================ -SvCompositeLockBytes::~SvCompositeLockBytes() -{ - delete pImpl; -} - -//============================================================================ -void SvCompositeLockBytes::SetIsPending( BOOL bSet ) -{ - pImpl->bPending = bSet; -} - -//============================================================================ -ULONG SvCompositeLockBytes::RelativeOffset( ULONG nPos ) const -{ - return pImpl->RelativeOffset( nPos ); -} - -//============================================================================ -ErrCode SvCompositeLockBytes::ReadAt( - ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pRead ) const -{ - return pImpl->ReadWrite_Impl( nPos, pBuffer, nCount, pRead, TRUE ); -} - -//============================================================================ -ErrCode SvCompositeLockBytes::WriteAt( - ULONG nPos, const void* pBuffer, ULONG nCount, ULONG* pWritten ) -{ - return pImpl->ReadWrite_Impl( - nPos, const_cast< void * >(pBuffer), nCount, pWritten, FALSE ); -} - -//============================================================================ -ErrCode SvCompositeLockBytes::Flush() const -{ - SvLockBytesMemberList& rLockBytes = pImpl->aLockBytes; - ErrCode nErr = ERRCODE_NONE; - for( USHORT nCount = (USHORT)rLockBytes.Count(); !nErr && nCount--; ) - nErr = rLockBytes.GetObject( nCount )->Flush(); - return nErr; -} - -//============================================================================ -ErrCode SvCompositeLockBytes::SetSize( ULONG ) -{ - DBG_ERROR( "not implemented" ); - return ERRCODE_IO_NOTSUPPORTED; -} - -//============================================================================ -ErrCode SvCompositeLockBytes::LockRegion( ULONG, ULONG, LockType ) -{ - DBG_ERROR( "not implemented" ); - return ERRCODE_IO_NOTSUPPORTED; -} - -//============================================================================ -ErrCode SvCompositeLockBytes::UnlockRegion( - ULONG, ULONG, LockType ) -{ - DBG_ERROR( "not implemented" ); - return ERRCODE_IO_NOTSUPPORTED; -} - -//============================================================================ -ErrCode SvCompositeLockBytes::Stat( - SvLockBytesStat* pStat, SvLockBytesStatFlag eFlag) const -{ - USHORT nMax = pImpl->aPositions.Count() - 1; - - SvLockBytesStat aStat; - ErrCode nErr = pImpl->aLockBytes.GetObject( nMax )->Stat( &aStat, eFlag ); - pStat->nSize = pImpl->aPositions[ nMax ] + aStat.nSize; - - return nErr; -} - -//============================================================================ -void SvCompositeLockBytes::Append( - SvLockBytes* pLockBytes, ULONG nPos, ULONG nOffset ) -{ - USHORT nCount = pImpl->aOffsets.Count(); - pImpl->aLockBytes.Insert( pLockBytes, nCount ); - pImpl->aPositions.Insert( nPos, nCount ); - pImpl->aOffsets.Insert( nOffset, nCount ); -} - -//============================================================================ -SvLockBytes* SvCompositeLockBytes::GetLastLockBytes() const -{ - return pImpl->aLockBytes.Count() ? - pImpl->aLockBytes.GetObject( pImpl->aLockBytes.Count() - 1 ) : 0; -} - diff --git a/svl/source/misc/makefile.mk b/svl/source/misc/makefile.mk index 93ebc7f9470c..adc659a7b60b 100644 --- a/svl/source/misc/makefile.mk +++ b/svl/source/misc/makefile.mk @@ -42,7 +42,6 @@ TARGET=misc EXCEPTIONSFILES=\ $(SLO)$/documentlockfile.obj \ - $(SLO)$/flbytes.obj \ $(SLO)$/folderrestriction.obj \ $(SLO)$/fstathelper.obj \ $(SLO)$/lockfilecommon.obj \ diff --git a/svl/source/misc/restrictedpaths.cxx b/svl/source/misc/restrictedpaths.cxx index 3c45d43bdd5b..9eda454604b1 100644 --- a/svl/source/misc/restrictedpaths.cxx +++ b/svl/source/misc/restrictedpaths.cxx @@ -36,7 +36,7 @@ #include #include #include -#include +#include namespace svt { diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx index 65ea024a7e34..23f627834955 100644 --- a/svl/source/numbers/numfmuno.cxx +++ b/svl/source/numbers/numfmuno.cxx @@ -33,7 +33,6 @@ #ifndef GCC #endif -#include #include #include #include diff --git a/svl/source/numbers/supservs.cxx b/svl/source/numbers/supservs.cxx index 67b9170d59fc..7e4d8560dae7 100644 --- a/svl/source/numbers/supservs.cxx +++ b/svl/source/numbers/supservs.cxx @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include "instrm.hxx" diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 76bc6bad2bc0..eb867f67fb57 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -35,11 +35,6 @@ // #include #include -#ifndef _SOUND_HXX //autogen -#include -#endif -#include -#include #include #include #include @@ -48,6 +43,7 @@ #include #include #include +#include #define _SVSTDARR_USHORTS #include @@ -62,7 +58,7 @@ #include #include "numhead.hxx" -#include +#include #include "listener.hxx" #include #include @@ -107,7 +103,7 @@ static sal_uInt32 __FAR_DATA theIndexTable[NF_INDEX_TABLE_ENTRIES]; also handles one instance of the SysLocale options */ -class SvNumberFormatterRegistry_Impl : public SvtListener +class SvNumberFormatterRegistry_Impl : public utl::ConfigurationListener { List aFormatters; SvtSysLocaleOptions aSysLocaleOptions; @@ -124,30 +120,26 @@ public: sal_uInt32 Count() { return aFormatters.Count(); } - virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint ); - + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster* ); }; SvNumberFormatterRegistry_Impl::SvNumberFormatterRegistry_Impl() { eSysLanguage = MsLangId::getRealLanguage( LANGUAGE_SYSTEM ); - aSysLocaleOptions.AddListener( *this ); + aSysLocaleOptions.AddListener( this ); } SvNumberFormatterRegistry_Impl::~SvNumberFormatterRegistry_Impl() { - aSysLocaleOptions.RemoveListener( *this ); + aSysLocaleOptions.RemoveListener( this ); } -void SvNumberFormatterRegistry_Impl::Notify( SvtBroadcaster&, const SfxHint& rHint ) +void SvNumberFormatterRegistry_Impl::ConfigurationChanged( utl::ConfigurationBroadcaster* ) { - const SfxSimpleHint* pHint = PTR_CAST( SfxSimpleHint, &rHint ); - if( pHint ) - { - if ( pHint->GetId() & SYSLOCALEOPTIONS_HINT_LOCALE ) + //if ( pHint->GetId() & SYSLOCALEOPTIONS_HINT_LOCALE ) { ::osl::MutexGuard aGuard( SvNumberFormatter::GetMutex() ); for ( SvNumberFormatter* p = (SvNumberFormatter*)aFormatters.First(); @@ -157,7 +149,7 @@ void SvNumberFormatterRegistry_Impl::Notify( SvtBroadcaster&, const SfxHint& rHi } eSysLanguage = MsLangId::getRealLanguage( LANGUAGE_SYSTEM ); } - if ( pHint->GetId() & SYSLOCALEOPTIONS_HINT_CURRENCY ) + //if ( pHint->GetId() & SYSLOCALEOPTIONS_HINT_CURRENCY ) { ::osl::MutexGuard aGuard( SvNumberFormatter::GetMutex() ); for ( SvNumberFormatter* p = (SvNumberFormatter*)aFormatters.First(); @@ -166,7 +158,6 @@ void SvNumberFormatterRegistry_Impl::Notify( SvtBroadcaster&, const SfxHint& rHi p->ResetDefaultSystemCurrency(); } } - } } @@ -535,7 +526,6 @@ BOOL SvNumberFormatter::PutEntry(String& rString, sal_uInt32 nPos = CLOffset + pStdFormat->GetLastInsertKey(); if (nPos - CLOffset >= SV_COUNTRY_LANGUAGE_OFFSET) { - Sound::Beep(); DBG_ERROR("SvNumberFormatter:: Zu viele Formate pro CL"); delete p_Entry; } @@ -601,15 +591,14 @@ sal_uInt32 SvNumberFormatter::GetIndexPuttingAndConverting( String & rString, // #62389# empty format string (of Writer) => General standard format if (!rString.Len()) ; // nothing - else if (eLnge == LANGUAGE_SYSTEM && eSysLnge != - Application::GetSettings().GetLanguage()) + else if (eLnge == LANGUAGE_SYSTEM && eSysLnge != SvtSysLocale().GetLanguage()) { sal_uInt32 nOrig = GetEntryKey( rString, eSysLnge ); if (nOrig == NUMBERFORMAT_ENTRY_NOT_FOUND) nKey = nOrig; // none avaliable, maybe user-defined else - nKey = GetFormatForLanguageIfBuiltIn( nOrig, - Application::GetSettings().GetLanguage()); + nKey = GetFormatForLanguageIfBuiltIn( nOrig, SvtSysLocale().GetLanguage() ); + if (nKey == nOrig) { // Not a builtin format, convert. @@ -617,7 +606,7 @@ sal_uInt32 SvNumberFormatter::GetIndexPuttingAndConverting( String & rString, // language and wouldn't match eSysLnge anymore, do that on a copy. String aTmp( rString); rNewInserted = PutandConvertEntrySystem( aTmp, rCheckPos, rType, - nKey, eLnge, Application::GetSettings().GetLanguage()); + nKey, eLnge, SvtSysLocale().GetLanguage()); if (rCheckPos > 0) { DBG_ERRORFILE("SvNumberFormatter::GetIndexPuttingAndConverting: bad format code string for current locale"); @@ -685,7 +674,7 @@ void SvNumberFormatter::SetFormatUsed(sal_uInt32 nFIndex) BOOL SvNumberFormatter::Load( SvStream& rStream ) { - LanguageType eSysLang = Application::GetSettings().GetLanguage(); + LanguageType eSysLang = SvtSysLocale().GetLanguage(); SvNumberFormatter* pConverter = NULL; ImpSvNumMultipleReadHeader aHdr( rStream ); @@ -894,7 +883,7 @@ BOOL SvNumberFormatter::Save( SvStream& rStream ) const ImpSvNumMultipleWriteHeader aHdr( rStream ); // ab 364i wird gespeichert was SYSTEM wirklich war, vorher hart LANGUAGE_SYSTEM rStream << (USHORT) SV_NUMBERFORMATTER_VERSION; - rStream << (USHORT) Application::GetSettings().GetLanguage() << (USHORT) IniLnge; + rStream << (USHORT) SvtSysLocale().GetLanguage() << (USHORT) IniLnge; SvNumberFormatTable* pTable = (SvNumberFormatTable*) &aFTable; SvNumberformat* pEntry = (SvNumberformat*) pTable->First(); while (pEntry) @@ -2900,7 +2889,6 @@ SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter nNewKey = nPos+1; if (nPos - nCLOffset >= SV_COUNTRY_LANGUAGE_OFFSET) { - Sound::Beep(); DBG_ERROR( "SvNumberFormatter:: Zu viele Formate pro CL"); delete pNewEntry; @@ -3005,7 +2993,7 @@ USHORT SvNumberFormatter::ExpandTwoDigitYear( USHORT nYear ) const // static USHORT SvNumberFormatter::GetYear2000Default() { - return Application::GetSettings().GetMiscSettings().GetTwoDigitYearStart(); + return (USHORT) ::utl::MiscCfg().GetYear2000(); } @@ -3106,7 +3094,7 @@ void SvNumberFormatter::SetDefaultSystemCurrency( const String& rAbbrev, Languag { ::osl::MutexGuard aGuard( GetMutex() ); if ( eLang == LANGUAGE_SYSTEM ) - eLang = Application::GetSettings().GetLanguage(); + eLang = SvtSysLocale().GetLanguage(); const NfCurrencyTable& rTable = GetTheCurrencyTable(); USHORT nCount = rTable.Count(); const NfCurrencyEntryPtr* ppData = rTable.GetData(); @@ -3549,7 +3537,7 @@ void SvNumberFormatter::ImpInitCurrencyTable() RTL_LOGFILE_CONTEXT_AUTHOR( aTimeLog, "svl", "er93726", "SvNumberFormatter::ImpInitCurrencyTable" ); - LanguageType eSysLang = Application::GetSettings().GetLanguage(); + LanguageType eSysLang = SvtSysLocale().GetLanguage(); LocaleDataWrapper* pLocaleData = new LocaleDataWrapper( ::comphelper::getProcessServiceFactory(), MsLangId::convertLanguageToLocale( eSysLang ) ); diff --git a/svl/source/svdde/ddecli.cxx b/svl/source/svdde/ddecli.cxx index 3c224efe89a1..dd3c9c237f9a 100644 --- a/svl/source/svdde/ddecli.cxx +++ b/svl/source/svdde/ddecli.cxx @@ -38,7 +38,7 @@ #include #include -#include +#include #include // static DWORD hDdeInst = NULL; @@ -367,9 +367,11 @@ const String& DdeTransaction::GetName() const void __EXPORT DdeTransaction::Data( const DdeData* p ) { - Application::GetSolarMutex().acquire(); - aData.Call( (void*)p ); - Application::GetSolarMutex().release(); + if ( ::tools::SolarMutex::Acquire() ) + { + aData.Call( (void*)p ); + ::tools::SolarMutex::Release(); + } } // --- DdeTransaction::Done() -------------------------------------- diff --git a/svl/source/syslocale/makefile.mk b/svl/source/syslocale/makefile.mk deleted file mode 100644 index 1bb619a69ec3..000000000000 --- a/svl/source/syslocale/makefile.mk +++ /dev/null @@ -1,48 +0,0 @@ -#************************************************************************* -# -# 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 -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.5 $ -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/.. - -PRJNAME=svl -TARGET=syslocale - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svl.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/syslocale.obj - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/svl/source/syslocale/syslocale.cxx b/svl/source/syslocale/syslocale.cxx deleted file mode 100644 index 074e900ea9ab..000000000000 --- a/svl/source/syslocale/syslocale.cxx +++ /dev/null @@ -1,176 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: syslocale.cxx,v $ - * $Revision: 1.11 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svl.hxx" -#ifndef GCC -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -using namespace osl; -using namespace com::sun::star; - - -SvtSysLocale_Impl* SvtSysLocale::pImpl = NULL; -sal_Int32 SvtSysLocale::nRefCount = 0; - - -class SvtSysLocale_Impl : public SvtListener -{ - friend class SvtSysLocale; - - SvtSysLocaleOptions aSysLocaleOptions; - LocaleDataWrapper* pLocaleData; - CharClass* pCharClass; - -public: - SvtSysLocale_Impl(); - virtual ~SvtSysLocale_Impl(); - - virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint ); - - CharClass* GetCharClass(); - -}; - - -// ----------------------------------------------------------------------- - -SvtSysLocale_Impl::SvtSysLocale_Impl() : pCharClass(NULL) -{ - const lang::Locale& rLocale = Application::GetSettings().GetLocale(); - pLocaleData = new LocaleDataWrapper( - ::comphelper::getProcessServiceFactory(), rLocale ); - aSysLocaleOptions.AddListener( *this ); -} - - -SvtSysLocale_Impl::~SvtSysLocale_Impl() -{ - aSysLocaleOptions.RemoveListener( *this ); - delete pCharClass; - delete pLocaleData; -} - -CharClass* SvtSysLocale_Impl::GetCharClass() -{ - if ( !pCharClass ) - { - const lang::Locale& rLocale = Application::GetSettings().GetLocale(); - pCharClass = new CharClass(::comphelper::getProcessServiceFactory(), rLocale ); - } - return pCharClass; -} -void SvtSysLocale_Impl::Notify( SvtBroadcaster&, const SfxHint& rHint ) -{ - const SfxSimpleHint* p = PTR_CAST( SfxSimpleHint, &rHint ); - if( p && (p->GetId() & SYSLOCALEOPTIONS_HINT_LOCALE) ) - { - MutexGuard aGuard( SvtSysLocale::GetMutex() ); - const lang::Locale& rLocale = Application::GetSettings().GetLocale(); - pLocaleData->setLocale( rLocale ); - GetCharClass()->setLocale( rLocale ); - } -} - - -// ==================================================================== - -SvtSysLocale::SvtSysLocale() -{ - MutexGuard aGuard( GetMutex() ); - if ( !pImpl ) - pImpl = new SvtSysLocale_Impl; - ++nRefCount; -} - - -SvtSysLocale::~SvtSysLocale() -{ - MutexGuard aGuard( GetMutex() ); - if ( !--nRefCount ) - { - delete pImpl; - pImpl = NULL; - } -} - - -// static -Mutex& SvtSysLocale::GetMutex() -{ - static Mutex* pMutex = NULL; - if( !pMutex ) - { - MutexGuard aGuard( Mutex::getGlobalMutex() ); - if( !pMutex ) - { - // #i77768# Due to a static reference in the toolkit lib - // we need a mutex that lives longer than the svl library. - // Otherwise the dtor would use a destructed mutex!! - pMutex = new Mutex; - } - } - return *pMutex; -} - - -const LocaleDataWrapper& SvtSysLocale::GetLocaleData() const -{ - return *(pImpl->pLocaleData); -} - - -const LocaleDataWrapper* SvtSysLocale::GetLocaleDataPtr() const -{ - return pImpl->pLocaleData; -} - - -const CharClass& SvtSysLocale::GetCharClass() const -{ - return *(pImpl->GetCharClass()); -} - - -const CharClass* SvtSysLocale::GetCharClassPtr() const -{ - return pImpl->GetCharClass(); -} diff --git a/svl/util/makefile.mk b/svl/util/makefile.mk index a8bdd52fd81c..522e1b3c0a3c 100644 --- a/svl/util/makefile.mk +++ b/svl/util/makefile.mk @@ -52,7 +52,6 @@ LIB2FILES= $(LB)$/_isvl.lib LIB1TARGET= $(SLB)$/svl.lib LIB1FILES= \ $(SLB)$/config.lib \ - $(SLB)$/syslocale.lib \ $(SLB)$/svdde.lib \ $(SLB)$/undo.lib \ $(SLB)$/numbers.lib \ @@ -69,7 +68,6 @@ LIB1FILES= \ RESLIB1NAME= $(RESTARGETSIMPLE) RESLIB1SRSFILES=\ - $(SRS)$/items.srs \ $(SRS)$/misc.srs # build the shared library -------------------------------------------------- diff --git a/unotools/inc/unotools/configitem.hxx b/unotools/inc/unotools/configitem.hxx index 2af7a089bb54..0e938cedd47f 100644 --- a/unotools/inc/unotools/configitem.hxx +++ b/unotools/inc/unotools/configitem.hxx @@ -88,7 +88,6 @@ namespace utl com::sun::star::uno::Reference< com::sun::star::util::XChangesListener > xChangeLstnr; ConfigItem_Impl* pImpl; - IMPL_ConfigurationListenerList* mpList; ConfigItem();// void RemoveChangesListener(); diff --git a/unotools/inc/unotools/misccfg.hxx b/unotools/inc/unotools/misccfg.hxx new file mode 100644 index 000000000000..2a1383d307a5 --- /dev/null +++ b/unotools/inc/unotools/misccfg.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: misccfg.hxx,v $ + * $Revision: 1.5 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _UTL_MISCCFG_HXX +#define _UTL_MISCCFG_HXX + +#include "unotools/unotoolsdllapi.h" +#include "tools/solar.h" +#include "unotools/options.hxx" + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ +namespace utl +{ + class SfxMiscCfg; + +class UNOTOOLS_DLLPUBLIC MiscCfg : public detail::Options +{ + SfxMiscCfg* pImpl; + +public: + MiscCfg( ); + virtual ~MiscCfg( ); + + BOOL IsNotFoundWarning() const; + void SetNotFoundWarning( BOOL bSet); + + BOOL IsPaperSizeWarning() const; + void SetPaperSizeWarning(BOOL bSet); + + BOOL IsPaperOrientationWarning() const; + void SetPaperOrientationWarning( BOOL bSet); + + // 0 ... 99 + sal_Int32 GetYear2000() const; + void SetYear2000( sal_Int32 nSet ); +}; + +}; + +#endif // _MISCCFG_HXX + + diff --git a/unotools/inc/unotools/options.hxx b/unotools/inc/unotools/options.hxx index 6e3b40075a04..ca8d70657f0f 100644 --- a/unotools/inc/unotools/options.hxx +++ b/unotools/inc/unotools/options.hxx @@ -48,12 +48,15 @@ namespace utl { class UNOTOOLS_DLLPUBLIC ConfigurationBroadcaster { IMPL_ConfigurationListenerList* mpList; + sal_Int32 m_nBroadcastBlocked; // broadcast only if this is 0 + public: void AddListener( utl::ConfigurationListener* pListener ); void RemoveListener( utl::ConfigurationListener* pListener ); void NotifyListeners(); ConfigurationBroadcaster(); ~ConfigurationBroadcaster(); + void BlockBroadcasts( bool bBlock ); }; namespace detail { diff --git a/unotools/inc/unotools/syslocale.hxx b/unotools/inc/unotools/syslocale.hxx new file mode 100644 index 000000000000..87482abbb117 --- /dev/null +++ b/unotools/inc/unotools/syslocale.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: syslocale.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_SVTOOLS_SYSLOCALE_HXX +#define INCLUDED_SVTOOLS_SYSLOCALE_HXX + +#include "unotools/unotoolsdllapi.h" +#include +#include +#include +#include + +class SvtSysLocale_Impl; +class SvtSysLocaleOptions; + +namespace osl { class Mutex; } +class LocaleDataWrapper; + +/** + SvtSysLocale provides a refcounted single instance of an application wide + LocaleDataWrapper and CharClass which always + follow the locale as it is currently configured by the user. You may use + it anywhere to access the locale data elements like decimal separator and + simple date formatting and so on. Contructing and destructing a + SvtSysLocale is not expensive as long as there is at least one instance + left. + */ +class UNOTOOLS_DLLPUBLIC SvtSysLocale +{ + friend class SvtSysLocale_Impl; // access to mutex + + static SvtSysLocale_Impl* pImpl; + static sal_Int32 nRefCount; + + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetMutex(); + +public: + SvtSysLocale(); + ~SvtSysLocale(); + + const LocaleDataWrapper& GetLocaleData() const; + const CharClass& GetCharClass() const; + + /** It is safe to store the pointers locally and use them AS LONG AS THE + INSTANCE OF SvtSysLocale LIVES! + It is a faster access but be sure what you do! + */ + const LocaleDataWrapper* GetLocaleDataPtr() const; + const CharClass* GetCharClassPtr() const; + SvtSysLocaleOptions& GetOptions() const; + com::sun::star::lang::Locale GetLocale() const; + LanguageType GetLanguage() const; +}; + +#endif // INCLUDED_SVTOOLS_SYSLOCALE_HXX diff --git a/unotools/inc/unotools/syslocaleoptions.hxx b/unotools/inc/unotools/syslocaleoptions.hxx new file mode 100644 index 000000000000..6c48c83a8500 --- /dev/null +++ b/unotools/inc/unotools/syslocaleoptions.hxx @@ -0,0 +1,162 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: syslocaleoptions.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX +#define INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX + +#include "unotools/unotoolsdllapi.h" +#include +#include +#include +#include +#include +#include +#include + +// bits for broadcasting hints of changes in a SfxSimpleHint, may be combined +const ULONG SYSLOCALEOPTIONS_HINT_LOCALE = 0x00000001; +const ULONG SYSLOCALEOPTIONS_HINT_CURRENCY = 0x00000002; + +class SvtSysLocaleOptions_Impl; +class SvtListener; +namespace osl { class Mutex; } + +class UNOTOOLS_DLLPUBLIC SvtSysLocaleOptions: public utl::detail::Options +{ + static SvtSysLocaleOptions_Impl* pOptions; + static sal_Int32 nRefCount; + + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetMutex(); + +public: + + enum EOption + { + E_LOCALE, + E_CURRENCY + }; + SvtSysLocaleOptions(); + virtual ~SvtSysLocaleOptions(); + + // ConfigItem methods + + sal_Bool IsModified(); + void Commit(); + + /** Add a listener to react on config changes + which are broadcasted in a SfxSimpleHint + @return + if added + if not added + */ + + /** Block broadcasts and accumulate hints. This may be useful if, for + example, the locale and currency are changed and the currency was + empty before, since changing the locale with an empty currency does + also broadcast a change hint for the currency which would result in + two currency changes broadcasted. + + @param bBlock + : broadcasts are blocked until reversed. + : broadcasts are not blocked anymore. Pending hints are + broadcasted if no other instance blocks the broadcast. + + @ATTENTION + All SvtSysLocaleOptions instances point to exactly one refcounted + internal representation instance and broadcast blocks are counted. + Thus if you issue a BlockBroadcasts(TRUE) you MUST issue a matching + BlockBroadcasts(FALSE) or otherwise pending hints would never be + broadcasted again. + */ + void BlockBroadcasts( BOOL bBlock ); + + // config value access methods + + /// The config string may be empty to denote the SYSTEM locale + const ::rtl::OUString& GetLocaleConfigString() const; + void SetLocaleConfigString( const ::rtl::OUString& rStr ); + + /// The config string may be empty to denote the default currency of the locale + const ::rtl::OUString& GetCurrencyConfigString() const; + void SetCurrencyConfigString( const ::rtl::OUString& rStr ); + // determine whether the decimal separator defined in the keyboard layout is used + // or the one approriate to the locale + sal_Bool IsDecimalSeparatorAsLocale() const; + void SetDecimalSeparatorAsLocale( sal_Bool bSet); + + // convenience methods + + /** Get the LanguageType of the current locale, may be LANGUAGE_SYSTEM if + LocaleConfigString is empty. If you need the real locale used in the + application, call Application::GetSettings().GetLanguage() instead */ + LanguageType GetLocaleLanguageType() const; + + /// Get currency abbreviation and locale from an USD-en-US or EUR-de-DE string + static void GetCurrencyAbbrevAndLanguage( + String& rAbbrev, + LanguageType& eLang, + const ::rtl::OUString& rConfigString ); + + /// Create an USD-en-US or EUR-de-DE string + static ::rtl::OUString CreateCurrencyConfigString( + const String& rAbbrev, + LanguageType eLang ); + + void GetCurrencyAbbrevAndLanguage( + String& rAbbrev, + LanguageType& eLang ) const + { + GetCurrencyAbbrevAndLanguage( rAbbrev, + eLang, GetCurrencyConfigString() ); + } + + void SetCurrencyAbbrevAndLanguage( + const String& rAbbrev, + LanguageType eLang ) + { + SetCurrencyConfigString( + CreateCurrencyConfigString( + rAbbrev, eLang ) ); + } + + /** Set a link to a method to be called whenever the default currency + changes. This can be only one method, and normally it is the static + link method which calls SvNumberFormatter::SetDefaultSystemCurrency(). + This is needed because the number formatter isn't part of the svl light + library, otherwise we could call SetDefaultSystemCurrency() directly. + */ + static void SetCurrencyChangeLink( const Link& rLink ); + static const Link& GetCurrencyChangeLink(); + + /** return the readonly state of the queried option. */ + sal_Bool IsReadOnly( EOption eOption ) const; +}; + +#endif // INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx index 38aee1b39d16..ad83b9b79cae 100644 --- a/unotools/source/config/configitem.cxx +++ b/unotools/source/config/configitem.cxx @@ -1427,3 +1427,4 @@ void ConfigItem::UnlockTree() m_xHierarchyAccess = 0; } + diff --git a/unotools/source/config/itemholder1.cxx b/unotools/source/config/itemholder1.cxx index cf1194f6e652..214b5a9b4276 100644 --- a/unotools/source/config/itemholder1.cxx +++ b/unotools/source/config/itemholder1.cxx @@ -38,6 +38,7 @@ #include #include +#include #include #include #include @@ -70,6 +71,7 @@ #include #include #include +#include //----------------------------------------------- // namespaces @@ -252,8 +254,8 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem) rItem.pItem = new SvtPrintWarningOptions(); break; - case E_REGOPTIONS : -// no ref count rItem.pItem = new ::utl::RegOptions(); + case E_MISCCFG : + rItem.pItem = new ::utl::MiscCfg(); break; case E_SAVEOPTIONS : @@ -308,6 +310,10 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem) rItem.pItem = new SvtUserOptions(); break; + case E_SYSLOCALEOPTIONS : + rItem.pItem = new SvtSysLocaleOptions(); + break; + default: OSL_ASSERT( "unknown item type" ); break; diff --git a/unotools/source/config/makefile.mk b/unotools/source/config/makefile.mk index edc0c9f2ad4f..eee8d4af9d73 100644 --- a/unotools/source/config/makefile.mk +++ b/unotools/source/config/makefile.mk @@ -45,6 +45,7 @@ ENABLE_EXCEPTIONS=TRUE # --- Files ------------------------------------- SLOFILES=\ + $(SLO)$/syslocaleoptions.obj \ $(SLO)$/configvaluecontainer.obj \ $(SLO)$/confignode.obj \ $(SLO)$/configitem.obj \ @@ -69,6 +70,7 @@ SLOFILES=\ $(SLO)$/javaoptions.obj \ $(SLO)$/lingucfg.obj \ $(SLO)$/localisationoptions.obj \ + $(SLO)$/misccfg.obj \ $(SLO)$/moduleoptions.obj \ $(SLO)$/options.obj \ $(SLO)$/optionsdlg.obj \ diff --git a/unotools/source/config/misccfg.cxx b/unotools/source/config/misccfg.cxx new file mode 100644 index 000000000000..febb3610f6a2 --- /dev/null +++ b/unotools/source/config/misccfg.cxx @@ -0,0 +1,312 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: misccfg.cxx,v $ + * $Revision: 1.9 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" + +#include +#include "rtl/instance.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include "itemholder1.hxx" + +#define DEFAULT_TAB 2000 + +#define DEF_INCH 2540L +#define DEF_RELTWIP 1440L + +using namespace rtl; +using namespace com::sun::star::uno; + +#define C2U(cChar) OUString::createFromAscii(cChar) + +namespace utl +{ + +static SfxMiscCfg* pOptions = NULL; +static sal_Int32 nRefCount = 0; + +class SfxMiscCfg : public utl::ConfigItem +{ + BOOL bPaperSize; // printer warnings + BOOL bPaperOrientation; + BOOL bNotFound; + sal_Int32 nYear2000; // two digit year representation + + const com::sun::star::uno::Sequence& GetPropertyNames(); + void Load(); + +public: + SfxMiscCfg( ); + ~SfxMiscCfg( ); + + virtual void Notify( const com::sun::star::uno::Sequence& aPropertyNames); + virtual void Commit(); + + BOOL IsNotFoundWarning() const {return bNotFound;} + void SetNotFoundWarning( BOOL bSet); + + BOOL IsPaperSizeWarning() const {return bPaperSize;} + void SetPaperSizeWarning(BOOL bSet); + + BOOL IsPaperOrientationWarning() const {return bPaperOrientation;} + void SetPaperOrientationWarning( BOOL bSet); + + // 0 ... 99 + sal_Int32 GetYear2000() const { return nYear2000; } + void SetYear2000( sal_Int32 nSet ); + +}; + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ +SfxMiscCfg::SfxMiscCfg() : + ConfigItem(C2U("Office.Common") ), + bPaperSize(FALSE), + bPaperOrientation (FALSE), + bNotFound (FALSE), + nYear2000( 1930 ) +{ + RTL_LOGFILE_CONTEXT(aLog, "svl SfxMiscCfg::SfxMiscCfg()"); + + Load(); +} +/* -----------------------------02.03.01 15:31-------------------------------- + + ---------------------------------------------------------------------------*/ +SfxMiscCfg::~SfxMiscCfg() +{ +} +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +void SfxMiscCfg::SetNotFoundWarning( BOOL bSet) +{ + if(bNotFound != bSet) + SetModified(); + bNotFound = bSet; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +void SfxMiscCfg::SetPaperSizeWarning( BOOL bSet) +{ + if(bPaperSize != bSet) + SetModified(); + bPaperSize = bSet; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ +void SfxMiscCfg::SetPaperOrientationWarning( BOOL bSet) +{ + if(bPaperOrientation != bSet) + SetModified(); + bPaperOrientation = bSet; +} +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +void SfxMiscCfg::SetYear2000( sal_Int32 nSet ) +{ + if(nYear2000 != nSet) + SetModified(); + nYear2000 = nSet; +} +/* -----------------------------02.03.01 15:31-------------------------------- + + ---------------------------------------------------------------------------*/ +const Sequence& SfxMiscCfg::GetPropertyNames() +{ + static Sequence aNames; + if(!aNames.getLength()) + { + static const char* aPropNames[] = + { + "Print/Warning/PaperSize", // 0 + "Print/Warning/PaperOrientation", // 1 + "Print/Warning/NotFound", // 2 + "DateFormat/TwoDigitYear", // 3 + }; + const int nCount = 4; + aNames.realloc(nCount); + OUString* pNames = aNames.getArray(); + for(int i = 0; i < nCount; i++) + pNames[i] = OUString::createFromAscii(aPropNames[i]); + } + return aNames; +} +/* -----------------------------02.03.01 15:31-------------------------------- + + ---------------------------------------------------------------------------*/ +void SfxMiscCfg::Load() +{ + const Sequence& aNames = GetPropertyNames(); + Sequence aValues = GetProperties(aNames); + EnableNotification(aNames); + const Any* pValues = aValues.getConstArray(); + DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed"); + if(aValues.getLength() == aNames.getLength()) + { + for(int nProp = 0; nProp < aNames.getLength(); nProp++) + { + if(pValues[nProp].hasValue()) + { + switch(nProp) + { + case 0: bPaperSize = *(sal_Bool*)pValues[nProp].getValue(); break; //"Print/Warning/PaperSize", + case 1: bPaperOrientation = *(sal_Bool*)pValues[nProp].getValue(); break; //"Print/Warning/PaperOrientation", + case 2: bNotFound = *(sal_Bool*)pValues[nProp].getValue() ; break; //"Print/Warning/NotFound", + case 3: pValues[nProp] >>= nYear2000;break; //"DateFormat/TwoDigitYear", + } + } + } + } +} +/* -----------------------------02.03.01 15:31-------------------------------- + + ---------------------------------------------------------------------------*/ +void SfxMiscCfg::Notify( const com::sun::star::uno::Sequence& ) +{ + Load(); +} +/* -----------------------------02.03.01 15:31-------------------------------- + + ---------------------------------------------------------------------------*/ +void SfxMiscCfg::Commit() +{ + const Sequence& aNames = GetPropertyNames(); + Sequence aValues(aNames.getLength()); + Any* pValues = aValues.getArray(); + + const Type& rType = ::getBooleanCppuType(); + for(int nProp = 0; nProp < aNames.getLength(); nProp++) + { + switch(nProp) + { + case 0: pValues[nProp].setValue(&bPaperSize, rType);break; //"Print/Warning/PaperSize", + case 1: pValues[nProp].setValue(&bPaperOrientation, rType);break; //"Print/Warning/PaperOrientation", + case 2: pValues[nProp].setValue(&bNotFound, rType);break; //"Print/Warning/NotFound", + case 3: pValues[nProp] <<= nYear2000;break; //"DateFormat/TwoDigitYear", + } + } + PutProperties(aNames, aValues); +} +// ----------------------------------------------------------------------- +namespace +{ + class LocalSingleton : public rtl::Static< osl::Mutex, LocalSingleton > + { + }; +} + +MiscCfg::MiscCfg( ) +{ + // Global access, must be guarded (multithreading) + ::osl::MutexGuard aGuard( LocalSingleton::get() ); + if ( !pOptions ) + { + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) SfxMiscCfg::ctor()"); + pOptions = new SfxMiscCfg; + + ItemHolder1::holdConfigItem(E_MISCCFG); + } + + ++nRefCount; + pImpl = pOptions; + pImpl->AddListener(this); +} + +MiscCfg::~MiscCfg( ) +{ + // Global access, must be guarded (multithreading) + ::osl::MutexGuard aGuard( LocalSingleton::get() ); + pImpl->RemoveListener(this); + if ( !--nRefCount ) + { + if ( pOptions->IsModified() ) + pOptions->Commit(); + DELETEZ( pOptions ); + } +} + +BOOL MiscCfg::IsNotFoundWarning() const +{ + return pImpl->IsNotFoundWarning(); +} + +void MiscCfg::SetNotFoundWarning( BOOL bSet) +{ + pImpl->SetNotFoundWarning( bSet ); +} + +BOOL MiscCfg::IsPaperSizeWarning() const +{ + return pImpl->IsPaperSizeWarning(); +} + +void MiscCfg::SetPaperSizeWarning(BOOL bSet) +{ + pImpl->SetPaperSizeWarning( bSet ); +} + +BOOL MiscCfg::IsPaperOrientationWarning() const +{ + return pImpl->IsPaperOrientationWarning(); +} + +void MiscCfg::SetPaperOrientationWarning( BOOL bSet) +{ + pImpl->SetPaperOrientationWarning( bSet ); +} + +sal_Int32 MiscCfg::GetYear2000() const +{ + return pImpl->GetYear2000(); +} + +void MiscCfg::SetYear2000( sal_Int32 nSet ) +{ + pImpl->SetYear2000( nSet ); +} + +} \ No newline at end of file diff --git a/unotools/source/config/options.cxx b/unotools/source/config/options.cxx index eba75b347edf..b4e9aec8c6dd 100644 --- a/unotools/source/config/options.cxx +++ b/unotools/source/config/options.cxx @@ -45,6 +45,7 @@ using utl::ConfigurationBroadcaster; ConfigurationBroadcaster::ConfigurationBroadcaster() : mpList(0) +, m_nBroadcastBlocked( 0 ) { } @@ -68,9 +69,15 @@ void ConfigurationBroadcaster::RemoveListener( utl::ConfigurationListener* pList void ConfigurationBroadcaster::NotifyListeners() { - if ( mpList ) - for ( sal_uInt32 n=0; nCount(); n++ ) - mpList->GetObject(n)->ConfigurationChanged(this); +// if ( m_nBroadcastBlocked ) +// m_nBlockedHint |= nHint; +// else + if (!m_nBroadcastBlocked) + { + if ( mpList ) + for ( sal_uInt32 n=0; nCount(); n++ ) + mpList->GetObject(n)->ConfigurationChanged(this); + } } Options::Options() @@ -86,3 +93,13 @@ void Options::ConfigurationChanged( utl::ConfigurationBroadcaster* ) NotifyListeners(); } +void ConfigurationBroadcaster::BlockBroadcasts( bool bBlock ) +{ + if ( bBlock ) + ++m_nBroadcastBlocked; + else if ( m_nBroadcastBlocked ) + { + if ( --m_nBroadcastBlocked == 0 ) + NotifyListeners(); + } +} diff --git a/unotools/source/config/syslocaleoptions.cxx b/unotools/source/config/syslocaleoptions.cxx new file mode 100644 index 000000000000..3815136b27f0 --- /dev/null +++ b/unotools/source/config/syslocaleoptions.cxx @@ -0,0 +1,584 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: syslocaleoptions.cxx,v $ + * $Revision: 1.23 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "itemholder1.hxx" + + +#define CFG_READONLY_DEFAULT sal_False + +using namespace osl; +using namespace utl; +using namespace rtl; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; + + +SvtSysLocaleOptions_Impl* SvtSysLocaleOptions::pOptions = NULL; +sal_Int32 SvtSysLocaleOptions::nRefCount = 0; +namespace +{ + struct CurrencyChangeLink + : public rtl::Static {}; +} + +class SvtSysLocaleOptions_Impl : public utl::ConfigItem +{ + OUString m_aLocaleString; // en-US or de-DE or empty for SYSTEM + LanguageType m_eLocaleLanguageType; // same for convenience access + OUString m_aCurrencyString; // USD-en-US or EUR-de-DE + ULONG m_nBlockedHint; // pending hints + sal_Bool m_bDecimalSeparator; //use decimal separator same as locale + + sal_Bool m_bROLocale; + sal_Bool m_bROCurrency; + sal_Bool m_bRODecimalSeparator; + + static const Sequence< /* const */ OUString > GetPropertyNames(); + + ULONG ChangeLocaleSettings(); + void ChangeDefaultCurrency() const; + +public: + SvtSysLocaleOptions_Impl(); + virtual ~SvtSysLocaleOptions_Impl(); + + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); + virtual void Commit(); + + const OUString& GetLocaleString() const + { return m_aLocaleString; } + void SetLocaleString( const OUString& rStr ); + LanguageType GetLocaleLanguageType() const + { return m_eLocaleLanguageType; } + + const OUString& GetCurrencyString() const + { return m_aCurrencyString; } + void SetCurrencyString( const OUString& rStr ); + + sal_Bool IsDecimalSeparatorAsLocale() const { return m_bDecimalSeparator;} + void SetDecimalSeparatorAsLocale( sal_Bool bSet); + + sal_Bool IsReadOnly( SvtSysLocaleOptions::EOption eOption ) const; +}; + + +#define ROOTNODE_SYSLOCALE OUString(RTL_CONSTASCII_USTRINGPARAM("Setup/L10N")) + +#define PROPERTYNAME_LOCALE OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupSystemLocale")) +#define PROPERTYNAME_CURRENCY OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupCurrency")) +#define PROPERTYNAME_DECIMALSEPARATOR OUString(RTL_CONSTASCII_USTRINGPARAM("DecimalSeparatorAsLocale")) + +#define PROPERTYHANDLE_LOCALE 0 +#define PROPERTYHANDLE_CURRENCY 1 +#define PROPERTYHANDLE_DECIMALSEPARATOR 2 + +#define PROPERTYCOUNT 3 + +const Sequence< OUString > SvtSysLocaleOptions_Impl::GetPropertyNames() +{ + static const OUString pProperties[] = + { + PROPERTYNAME_LOCALE, + PROPERTYNAME_CURRENCY, + PROPERTYNAME_DECIMALSEPARATOR + }; + static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + return seqPropertyNames; +} + + +// ----------------------------------------------------------------------- + +SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl() + : ConfigItem( ROOTNODE_SYSLOCALE ) + , m_nBlockedHint( 0 ) + , m_bDecimalSeparator( sal_True ) + , m_bROLocale(CFG_READONLY_DEFAULT) + , m_bROCurrency(CFG_READONLY_DEFAULT) + , m_bRODecimalSeparator(sal_False) + +{ + if ( !IsValidConfigMgr() ) + ChangeLocaleSettings(); // assume SYSTEM defaults during Setup + else + { + const Sequence< OUString > aNames = GetPropertyNames(); + Sequence< Any > aValues = GetProperties( aNames ); + Sequence< sal_Bool > aROStates = GetReadOnlyStates( aNames ); + const Any* pValues = aValues.getConstArray(); + const sal_Bool* pROStates = aROStates.getConstArray(); + DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" ); + DBG_ASSERT( aROStates.getLength() == aNames.getLength(), "GetReadOnlyStates failed" ); + if ( aValues.getLength() == aNames.getLength() && aROStates.getLength() == aNames.getLength() ) + { + for ( sal_Int32 nProp = 0; nProp < aNames.getLength(); nProp++ ) + { + DBG_ASSERT( pValues[nProp].hasValue(), "property value missing" ); + if ( pValues[nProp].hasValue() ) + { + switch ( nProp ) + { + case PROPERTYHANDLE_LOCALE : + { + OUString aStr; + if ( pValues[nProp] >>= aStr ) + m_aLocaleString = aStr; + else + { + DBG_ERRORFILE( "Wrong property type!" ); + } + m_bROLocale = pROStates[nProp]; + } + break; + case PROPERTYHANDLE_CURRENCY : + { + OUString aStr; + if ( pValues[nProp] >>= aStr ) + m_aCurrencyString = aStr; + else + { + DBG_ERRORFILE( "Wrong property type!" ); + } + m_bROCurrency = pROStates[nProp]; + } + break; + case PROPERTYHANDLE_DECIMALSEPARATOR: + { + sal_Bool bValue = sal_Bool(); + if ( pValues[nProp] >>= bValue ) + m_bDecimalSeparator = bValue; + else + { + DBG_ERRORFILE( "Wrong property type!" ); + } + m_bRODecimalSeparator = pROStates[nProp]; + } + break; + default: + DBG_ERRORFILE( "Wrong property type!" ); + } + } + } + } +// UpdateMiscSettings_Impl(); + ChangeLocaleSettings(); + EnableNotification( aNames ); + } +} + + +SvtSysLocaleOptions_Impl::~SvtSysLocaleOptions_Impl() +{ + if ( IsModified() ) + Commit(); +} + + +sal_Bool SvtSysLocaleOptions_Impl::IsReadOnly( SvtSysLocaleOptions::EOption eOption ) const +{ + sal_Bool bReadOnly = CFG_READONLY_DEFAULT; + switch(eOption) + { + case SvtSysLocaleOptions::E_LOCALE : + { + bReadOnly = m_bROLocale; + break; + } + case SvtSysLocaleOptions::E_CURRENCY : + { + bReadOnly = m_bROCurrency; + break; + } + } + return bReadOnly; +} + + +/*void SvtSysLocaleOptions_Impl::Broadcast( ULONG nHint ) +{ + if ( m_nBroadcastBlocked ) + m_nBlockedHint |= nHint; + else + { + nHint |= m_nBlockedHint; + m_nBlockedHint = 0; + if ( nHint ) + { + if ( nHint & SYSLOCALEOPTIONS_HINT_CURRENCY ) + ChangeDefaultCurrency(); + SfxSimpleHint aHint( nHint ); + GetBroadcaster().Broadcast( aHint ); + } + } +}*/ + + +void SvtSysLocaleOptions_Impl::Commit() +{ + const Sequence< OUString > aOrgNames = GetPropertyNames(); + sal_Int32 nOrgCount = aOrgNames.getLength(); + + Sequence< OUString > aNames( nOrgCount ); + Sequence< Any > aValues( nOrgCount ); + + OUString* pNames = aNames.getArray(); + Any* pValues = aValues.getArray(); + sal_Int32 nRealCount = 0; + + for ( sal_Int32 nProp = 0; nProp < nOrgCount; nProp++ ) + { + switch ( nProp ) + { + case PROPERTYHANDLE_LOCALE : + { + if (!m_bROLocale) + { + pNames[nRealCount] = aOrgNames[nProp]; + pValues[nRealCount] <<= m_aLocaleString; + ++nRealCount; + } + } + break; + case PROPERTYHANDLE_CURRENCY : + { + if (!m_bROLocale) + { + pNames[nRealCount] = aOrgNames[nProp]; + pValues[nRealCount] <<= m_aCurrencyString; + ++nRealCount; + } + } + break; + case PROPERTYHANDLE_DECIMALSEPARATOR: + if( !m_bRODecimalSeparator ) + { + pNames[nRealCount] = aOrgNames[nProp]; + pValues[nRealCount] <<= m_bDecimalSeparator; + ++nRealCount; + } + break; + default: + DBG_ERRORFILE( "invalid index to save a path" ); + } + } + aNames.realloc(nRealCount); + aValues.realloc(nRealCount); + PutProperties( aNames, aValues ); + ClearModified(); +} + + +void SvtSysLocaleOptions_Impl::SetLocaleString( const OUString& rStr ) +{ + if (!m_bROLocale && rStr != m_aLocaleString ) + { + m_aLocaleString = rStr; + SetModified(); + ULONG nHint = SYSLOCALEOPTIONS_HINT_LOCALE; + nHint |= ChangeLocaleSettings(); + //Broadcast( nHint ); + NotifyListeners(); + } +} + + +ULONG SvtSysLocaleOptions_Impl::ChangeLocaleSettings() +{ + // An empty config value denotes SYSTEM locale + if ( m_aLocaleString.getLength() ) + m_eLocaleLanguageType = MsLangId::convertIsoStringToLanguage( m_aLocaleString ); + else + m_eLocaleLanguageType = LANGUAGE_SYSTEM; + ULONG nHint = 0; + // new locale and no fixed currency => locale default currency might change + if ( !m_aCurrencyString.getLength() ) + nHint |= SYSLOCALEOPTIONS_HINT_CURRENCY; + return nHint; +} + + +void SvtSysLocaleOptions_Impl::SetCurrencyString( const OUString& rStr ) +{ + if (!m_bROCurrency && rStr != m_aCurrencyString ) + { + m_aCurrencyString = rStr; + SetModified(); + //Broadcast( SYSLOCALEOPTIONS_HINT_CURRENCY ); + NotifyListeners(); + } +} + +void SvtSysLocaleOptions_Impl::SetDecimalSeparatorAsLocale( sal_Bool bSet) +{ + if(bSet != m_bDecimalSeparator) + { + m_bDecimalSeparator = bSet; + SetModified(); + //UpdateMiscSettings_Impl(); + NotifyListeners(); + } +} + + +void SvtSysLocaleOptions_Impl::ChangeDefaultCurrency() const +{ + const Link& rLink = SvtSysLocaleOptions::GetCurrencyChangeLink(); + if ( rLink.IsSet() ) + rLink.Call( NULL ); +} + + +void SvtSysLocaleOptions_Impl::Notify( const Sequence< rtl::OUString >& seqPropertyNames ) +{ + ULONG nHint = 0; + Sequence< Any > seqValues = GetProperties( seqPropertyNames ); + Sequence< sal_Bool > seqROStates = GetReadOnlyStates( seqPropertyNames ); + sal_Int32 nCount = seqPropertyNames.getLength(); + for( sal_Int32 nProp = 0; nProp < nCount; ++nProp ) + { + if( seqPropertyNames[nProp] == PROPERTYNAME_LOCALE ) + { + DBG_ASSERT( seqValues[nProp].getValueTypeClass() == TypeClass_STRING, "Locale property type" ); + seqValues[nProp] >>= m_aLocaleString; + m_bROLocale = seqROStates[nProp]; + nHint |= SYSLOCALEOPTIONS_HINT_LOCALE; + nHint |= ChangeLocaleSettings(); + } + else if( seqPropertyNames[nProp] == PROPERTYNAME_CURRENCY ) + { + DBG_ASSERT( seqValues[nProp].getValueTypeClass() == TypeClass_STRING, "Currency property type" ); + seqValues[nProp] >>= m_aCurrencyString; + m_bROCurrency = seqROStates[nProp]; + nHint |= SYSLOCALEOPTIONS_HINT_CURRENCY; + } + else if( seqPropertyNames[nProp] == PROPERTYNAME_DECIMALSEPARATOR ) + { + seqValues[nProp] >>= m_bDecimalSeparator; + m_bRODecimalSeparator = seqROStates[nProp]; + } + } + if ( nHint ) + //Broadcast( nHint ); + NotifyListeners(); +} + +// ==================================================================== + +SvtSysLocaleOptions::SvtSysLocaleOptions() +{ + MutexGuard aGuard( GetMutex() ); + if ( !pOptions ) + { + RTL_LOGFILE_CONTEXT(aLog, "svl ( ??? ) ::SvtSysLocaleOptions_Impl::ctor()"); + pOptions = new SvtSysLocaleOptions_Impl; + + ItemHolder1::holdConfigItem(E_SYSLOCALEOPTIONS); + } + ++nRefCount; +} + + +SvtSysLocaleOptions::~SvtSysLocaleOptions() +{ + MutexGuard aGuard( GetMutex() ); + if ( !--nRefCount ) + { + delete pOptions; + pOptions = NULL; + } +} + + +// static +Mutex& SvtSysLocaleOptions::GetMutex() +{ + static Mutex* pMutex = NULL; + if( !pMutex ) + { + MutexGuard aGuard( Mutex::getGlobalMutex() ); + if( !pMutex ) + { + // #i77768# Due to a static reference in the toolkit lib + // we need a mutex that lives longer than the svl library. + // Otherwise the dtor would use a destructed mutex!! + pMutex = new Mutex; + } + } + return *pMutex; +} + + +sal_Bool SvtSysLocaleOptions::IsModified() +{ + MutexGuard aGuard( GetMutex() ); + return pOptions->IsModified(); +} + + +void SvtSysLocaleOptions::Commit() +{ + MutexGuard aGuard( GetMutex() ); + pOptions->Commit(); +} + + +void SvtSysLocaleOptions::BlockBroadcasts( BOOL bBlock ) +{ + MutexGuard aGuard( GetMutex() ); + pOptions->BlockBroadcasts( bBlock ); +} + + +const OUString& SvtSysLocaleOptions::GetLocaleConfigString() const +{ + MutexGuard aGuard( GetMutex() ); + return pOptions->GetLocaleString(); +} + + +void SvtSysLocaleOptions::SetLocaleConfigString( const OUString& rStr ) +{ + MutexGuard aGuard( GetMutex() ); + pOptions->SetLocaleString( rStr ); +} + + +const OUString& SvtSysLocaleOptions::GetCurrencyConfigString() const +{ + MutexGuard aGuard( GetMutex() ); + return pOptions->GetCurrencyString(); +} + + +void SvtSysLocaleOptions::SetCurrencyConfigString( const OUString& rStr ) +{ + MutexGuard aGuard( GetMutex() ); + pOptions->SetCurrencyString( rStr ); +} + + +LanguageType SvtSysLocaleOptions::GetLocaleLanguageType() const +{ + MutexGuard aGuard( GetMutex() ); + return pOptions->GetLocaleLanguageType(); +} + +/*-- 11.02.2004 13:31:41--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Bool SvtSysLocaleOptions::IsDecimalSeparatorAsLocale() const +{ + MutexGuard aGuard( GetMutex() ); + return pOptions->IsDecimalSeparatorAsLocale(); +} +/*-- 11.02.2004 13:31:41--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SvtSysLocaleOptions::SetDecimalSeparatorAsLocale( sal_Bool bSet) +{ + MutexGuard aGuard( GetMutex() ); + pOptions->SetDecimalSeparatorAsLocale(bSet); +} + + +sal_Bool SvtSysLocaleOptions::IsReadOnly( EOption eOption ) const +{ + MutexGuard aGuard( GetMutex() ); + return pOptions->IsReadOnly( eOption ); +} + +// static +void SvtSysLocaleOptions::GetCurrencyAbbrevAndLanguage( String& rAbbrev, + LanguageType& eLang, const ::rtl::OUString& rConfigString ) +{ + sal_Int32 nDelim = rConfigString.indexOf( '-' ); + if ( nDelim >= 0 ) + { + rAbbrev = rConfigString.copy( 0, nDelim ); + String aIsoStr( rConfigString.copy( nDelim+1 ) ); + eLang = MsLangId::convertIsoStringToLanguage( aIsoStr ); + } + else + { + rAbbrev = rConfigString; + eLang = (rAbbrev.Len() ? LANGUAGE_NONE : LANGUAGE_SYSTEM); + } +} + + +// static +::rtl::OUString SvtSysLocaleOptions::CreateCurrencyConfigString( + const String& rAbbrev, LanguageType eLang ) +{ + String aIsoStr( MsLangId::convertLanguageToIsoString( eLang ) ); + if ( aIsoStr.Len() ) + { + ::rtl::OUStringBuffer aStr( rAbbrev.Len() + 1 + aIsoStr.Len() ); + aStr.append( rAbbrev.GetBuffer(), rAbbrev.Len() ); + aStr.append( sal_Unicode('-') ); + aStr.append( aIsoStr.GetBuffer(), aIsoStr.Len() ); + return aStr.makeStringAndClear(); + } + else + return rAbbrev; +} + + +// static +void SvtSysLocaleOptions::SetCurrencyChangeLink( const Link& rLink ) +{ + MutexGuard aGuard( GetMutex() ); + DBG_ASSERT( !CurrencyChangeLink::get().IsSet(), "SvtSysLocaleOptions::SetCurrencyChangeLink: already set" ); + CurrencyChangeLink::get() = rLink; +} + + +// static +const Link& SvtSysLocaleOptions::GetCurrencyChangeLink() +{ + MutexGuard aGuard( GetMutex() ); + return CurrencyChangeLink::get(); +} + diff --git a/unotools/source/config/undoopt.cxx b/unotools/source/config/undoopt.cxx index 006de02e084a..9b1712032e18 100644 --- a/unotools/source/config/undoopt.cxx +++ b/unotools/source/config/undoopt.cxx @@ -30,10 +30,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_unotools.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION #include #include "rtl/instance.hxx" diff --git a/unotools/source/config/useroptions.cxx b/unotools/source/config/useroptions.cxx index ad5f50977114..3b62e8225730 100644 --- a/unotools/source/config/useroptions.cxx +++ b/unotools/source/config/useroptions.cxx @@ -30,10 +30,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_unotools.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION #include #include diff --git a/unotools/source/misc/makefile.mk b/unotools/source/misc/makefile.mk index 8e505e41aaac..4d9f7f40746b 100644 --- a/unotools/source/misc/makefile.mk +++ b/unotools/source/misc/makefile.mk @@ -45,6 +45,7 @@ ENABLE_EXCEPTIONS=TRUE SLOFILES= $(SLO)$/atom.obj \ $(SLO)$/datetime.obj \ + $(SLO)$/syslocale.obj \ $(SLO)$/eventlisteneradapter.obj \ $(SLO)$/desktopterminationobserver.obj \ $(SLO)$/sharedunocomponent.obj \ diff --git a/unotools/source/misc/syslocale.cxx b/unotools/source/misc/syslocale.cxx new file mode 100644 index 000000000000..a299867f83e8 --- /dev/null +++ b/unotools/source/misc/syslocale.cxx @@ -0,0 +1,205 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: syslocale.cxx,v $ + * $Revision: 1.11 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +#ifndef GCC +#endif + +#include +#include +#include +#include +#include +#include + +using namespace osl; +using namespace com::sun::star; + + +SvtSysLocale_Impl* SvtSysLocale::pImpl = NULL; +sal_Int32 SvtSysLocale::nRefCount = 0; + + +class SvtSysLocale_Impl : public utl::ConfigurationListener +{ + friend class SvtSysLocale; + + SvtSysLocaleOptions aSysLocaleOptions; + LocaleDataWrapper* pLocaleData; + CharClass* pCharClass; + com::sun::star::lang::Locale maLocale; + +public: + SvtSysLocale_Impl(); + virtual ~SvtSysLocale_Impl(); + + CharClass* GetCharClass(); + SvtSysLocaleOptions& GetOptions() { return aSysLocaleOptions; } + void ConfigurationChanged( utl::ConfigurationBroadcaster* ); + com::sun::star::lang::Locale GetLocale(); +}; + +com::sun::star::lang::Locale SvtSysLocale_Impl::GetLocale() +{ + // ask configuration + rtl::OUString aLocaleString = aSysLocaleOptions.GetLocaleConfigString(); + if (!aLocaleString.getLength()) + // if no configuration is set, use system locale + return maLocale; + + com::sun::star::lang::Locale aLocale; + sal_Int32 nSep = aLocaleString.indexOf('-'); + if (nSep < 0) + aLocale.Language = aLocaleString; + else + { + aLocale.Language = aLocaleString.copy(0, nSep); + if (nSep < aLocaleString.getLength()) + aLocale.Country = aLocaleString.copy(nSep+1, aLocaleString.getLength() - (nSep+1)); + } + + return aLocale; +} + +// ----------------------------------------------------------------------- + +SvtSysLocale_Impl::SvtSysLocale_Impl() : pCharClass(NULL) +{ + // first initialize maLocale with system locale + MsLangId::convertLanguageToLocale( MsLangId::getSystemLanguage(), maLocale ); + + pLocaleData = new LocaleDataWrapper( ::comphelper::getProcessServiceFactory(), GetLocale() ); + + // listen for further changes + aSysLocaleOptions.AddListener( this ); +} + + +SvtSysLocale_Impl::~SvtSysLocale_Impl() +{ + aSysLocaleOptions.RemoveListener( this ); + delete pCharClass; + delete pLocaleData; +} + +CharClass* SvtSysLocale_Impl::GetCharClass() +{ + if ( !pCharClass ) + pCharClass = new CharClass(::comphelper::getProcessServiceFactory(), GetLocale() ); + return pCharClass; +} + +void SvtSysLocale_Impl::ConfigurationChanged( utl::ConfigurationBroadcaster* ) +{ + MutexGuard aGuard( SvtSysLocale::GetMutex() ); + lang::Locale aLocale = GetLocale(); + pLocaleData->setLocale( aLocale ); + GetCharClass()->setLocale( aLocale ); +} + +// ==================================================================== + +SvtSysLocale::SvtSysLocale() +{ + MutexGuard aGuard( GetMutex() ); + if ( !pImpl ) + pImpl = new SvtSysLocale_Impl; + ++nRefCount; +} + + +SvtSysLocale::~SvtSysLocale() +{ + MutexGuard aGuard( GetMutex() ); + if ( !--nRefCount ) + { + delete pImpl; + pImpl = NULL; + } +} + + +// static +Mutex& SvtSysLocale::GetMutex() +{ + static Mutex* pMutex = NULL; + if( !pMutex ) + { + MutexGuard aGuard( Mutex::getGlobalMutex() ); + if( !pMutex ) + { + // #i77768# Due to a static reference in the toolkit lib + // we need a mutex that lives longer than the svl library. + // Otherwise the dtor would use a destructed mutex!! + pMutex = new Mutex; + } + } + return *pMutex; +} + + +const LocaleDataWrapper& SvtSysLocale::GetLocaleData() const +{ + return *(pImpl->pLocaleData); +} + + +const LocaleDataWrapper* SvtSysLocale::GetLocaleDataPtr() const +{ + return pImpl->pLocaleData; +} + + +const CharClass& SvtSysLocale::GetCharClass() const +{ + return *(pImpl->GetCharClass()); +} + + +const CharClass* SvtSysLocale::GetCharClassPtr() const +{ + return pImpl->GetCharClass(); +} + +SvtSysLocaleOptions& SvtSysLocale::GetOptions() const +{ + return pImpl->GetOptions(); +} + +com::sun::star::lang::Locale SvtSysLocale::GetLocale() const +{ + return pImpl->GetLocale(); +} + +LanguageType SvtSysLocale::GetLanguage() const +{ + return MsLangId::convertLocaleToLanguage( pImpl->GetLocale() ); +} \ No newline at end of file diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx index decb7d01b2d4..9f41b933f516 100644 --- a/vcl/inc/vcl/settings.hxx +++ b/vcl/inc/vcl/settings.hxx @@ -38,6 +38,7 @@ #include "vcl/accel.hxx" #include "vcl/wall.hxx" #include "com/sun/star/lang/Locale.hpp" +#include class CollatorWrapper; class LocaleDataWrapper; @@ -993,7 +994,6 @@ class ImplMiscData private: ULONG mnRefCount; - USHORT mnTwoDigitYearStart; USHORT mnEnableATT; BOOL mbEnableLocalizedDecimalSep; USHORT mnDisablePrinting; @@ -1015,10 +1015,6 @@ public: MiscSettings( const MiscSettings& rSet ); ~MiscSettings(); - void SetTwoDigitYearStart( USHORT nYearStart ) - { CopyData(); mpData->mnTwoDigitYearStart = nYearStart; } - USHORT GetTwoDigitYearStart() const - { return mpData->mnTwoDigitYearStart; } void SetEnableATToolSupport( BOOL bEnable ); BOOL GetEnableATToolSupport() const; void SetDisablePrinting( BOOL bEnable ); @@ -1141,7 +1137,7 @@ public: // ----------------------- // - ImplAllSettingsData - // ----------------------- - +class LocaleConfigurationListener; class ImplAllSettingsData { friend class AllSettings; @@ -1171,6 +1167,8 @@ private: CollatorWrapper* mpUICollatorWrapper; vcl::I18nHelper* mpI18nHelper; vcl::I18nHelper* mpUII18nHelper; + LocaleConfigurationListener* mpLocaleCfgListener; + SvtSysLocale maSysLocale; }; // --------------- @@ -1287,6 +1285,8 @@ public: BOOL operator ==( const AllSettings& rSet ) const; BOOL operator !=( const AllSettings& rSet ) const { return !(*this == rSet); } + static void LocaleSettingsChanged(); + void StartListening(); }; #endif // _SV_SETTINGS_HXX diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 6aa453563596..d30a1c9745f4 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -45,6 +45,7 @@ #include "unotools/collatorwrapper.hxx" #include "unotools/configmgr.hxx" #include "unotools/confignode.hxx" +#include #ifdef WNT #include "tools/prewin.h" @@ -66,6 +67,16 @@ DBG_NAME( AllSettings ) STYLE_OPTION_NOMNEMONICS) // ======================================================================= +class LocaleConfigurationListener : public utl::ConfigurationListener +{ +public: + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster* ); +}; + +void LocaleConfigurationListener::ConfigurationChanged( utl::ConfigurationBroadcaster* ) +{ + AllSettings::LocaleSettingsChanged(); +} ImplMachineData::ImplMachineData() { @@ -1069,7 +1080,6 @@ BOOL StyleSettings::operator ==( const StyleSettings& rSet ) const ImplMiscData::ImplMiscData() { mnRefCount = 1; - mnTwoDigitYearStart = 1930; mnEnableATT = sal::static_int_cast(~0U); mnDisablePrinting = sal::static_int_cast(~0U); static const char* pEnv = getenv("SAL_DECIMALSEP_ENABLED" ); // set default without UI @@ -1081,7 +1091,6 @@ ImplMiscData::ImplMiscData() ImplMiscData::ImplMiscData( const ImplMiscData& rData ) { mnRefCount = 1; - mnTwoDigitYearStart = rData.mnTwoDigitYearStart; mnEnableATT = rData.mnEnableATT; mnDisablePrinting = rData.mnDisablePrinting; mbEnableLocalizedDecimalSep = rData.mbEnableLocalizedDecimalSep; @@ -1155,8 +1164,7 @@ BOOL MiscSettings::operator ==( const MiscSettings& rSet ) const if ( mpData == rSet.mpData ) return TRUE; - if ( (mpData->mnTwoDigitYearStart == rSet.mpData->mnTwoDigitYearStart ) && - (mpData->mnEnableATT == rSet.mpData->mnEnableATT ) && + if ( (mpData->mnEnableATT == rSet.mpData->mnEnableATT ) && (mpData->mnDisablePrinting == rSet.mpData->mnDisablePrinting ) && (mpData->mbEnableLocalizedDecimalSep == rSet.mpData->mbEnableLocalizedDecimalSep ) ) return TRUE; @@ -1535,6 +1543,8 @@ ImplAllSettingsData::ImplAllSettingsData() mpUICollatorWrapper = NULL; mpI18nHelper = NULL; mpUII18nHelper = NULL; + mpLocaleCfgListener = NULL; + maMiscSettings.SetEnableLocalizedDecimalSep( maSysLocale.GetOptions().IsDecimalSeparatorAsLocale() ); } // ----------------------------------------------------------------------- @@ -1564,6 +1574,7 @@ ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData& rData ) : mpUICollatorWrapper = NULL; mpI18nHelper = NULL; mpUII18nHelper = NULL; + mpLocaleCfgListener = NULL; } // ----------------------------------------------------------------------- @@ -1582,6 +1593,11 @@ ImplAllSettingsData::~ImplAllSettingsData() delete mpI18nHelper; if ( mpUII18nHelper ) delete mpUII18nHelper; + if (mpLocaleCfgListener ) + { + maSysLocale.GetOptions().RemoveListener( mpLocaleCfgListener ); + delete mpLocaleCfgListener; + } } // ----------------------------------------------------------------------- @@ -1640,6 +1656,13 @@ const AllSettings& AllSettings::operator =( const AllSettings& rSet ) return *this; } +void AllSettings::StartListening() +{ + if (!mpData->mpLocaleCfgListener) + mpData->mpLocaleCfgListener = new LocaleConfigurationListener; + mpData->maSysLocale.GetOptions().AddListener( mpData->mpLocaleCfgListener ); +} + // ----------------------------------------------------------------------- void AllSettings::CopyData() @@ -2075,4 +2098,15 @@ const CollatorWrapper& AllSettings::GetUICollatorWrapper() const return *mpData->mpUICollatorWrapper; } */ - +void AllSettings::LocaleSettingsChanged() +{ + AllSettings aAllSettings( Application::GetSettings() ); + MiscSettings aMiscSettings = aAllSettings.GetMiscSettings(); + BOOL bIsDecSepAsLocale = aAllSettings.mpData->maSysLocale.GetOptions().IsDecimalSeparatorAsLocale(); + if ( aMiscSettings.GetEnableLocalizedDecimalSep() != bIsDecSepAsLocale ) + { + aMiscSettings.SetEnableLocalizedDecimalSep( bIsDecSepAsLocale ); + aAllSettings.SetMiscSettings( aMiscSettings ); + Application::SetSettings( aAllSettings ); + } +} \ No newline at end of file diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index b53ceceeb757..9f381381fae8 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -710,6 +710,7 @@ void Application::SetSettings( const AllSettings& rSettings ) if ( !pSVData->maAppData.mpSettings ) { pSVData->maAppData.mpSettings = new AllSettings(); + pSVData->maAppData.mpSettings->StartListening(); *pSVData->maAppData.mpSettings = rSettings; ResMgr::SetDefaultLocale( rSettings.GetUILocale() ); } diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index b417774142d3..1d8f9a727be4 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -55,6 +55,7 @@ #include #include #include +#include using namespace ::com::sun::star; @@ -1312,7 +1313,7 @@ static BOOL ImplDateGetValue( const XubString& rStr, Date& rDate, ExtDateFieldFo return FALSE; Date aNewDate( nDay, nMonth, nYear ); - DateFormatter::ExpandCentury( aNewDate, rSettings.GetMiscSettings().GetTwoDigitYearStart() ); + DateFormatter::ExpandCentury( aNewDate, utl::MiscCfg().GetYear2000() ); if ( aNewDate.IsValid() ) { rDate = aNewDate; @@ -1379,7 +1380,7 @@ XubString DateFormatter::ImplGetDateAsText( const Date& rDate, if ( !bShowCentury ) { // Check if I have to use force showing the century - USHORT nTwoDigitYearStart = rSettings.GetMiscSettings().GetTwoDigitYearStart(); + USHORT nTwoDigitYearStart = utl::MiscCfg().GetYear2000(); USHORT nYear = rDate.GetYear(); // Wenn Jahr nicht im 2stelligen Grenzbereich liegt, @@ -2033,7 +2034,7 @@ void DateFormatter::Reformat() void DateFormatter::ExpandCentury( Date& rDate ) { - ExpandCentury( rDate, Application::GetSettings().GetMiscSettings().GetTwoDigitYearStart() ); + ExpandCentury( rDate, utl::MiscCfg().GetYear2000() ); } // ----------------------------------------------------------------------- diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 4a49d83918da..802ff48e41d6 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -3085,7 +3086,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) if ( (nValue > 1000) && (nValue < 10000) ) { MiscSettings aMiscSettings = rSettings.GetMiscSettings(); - aMiscSettings.SetTwoDigitYearStart( (USHORT)(nValue-99) ); + utl::MiscCfg().SetYear2000( (sal_Int32)(nValue-99) ); rSettings.SetMiscSettings( aMiscSettings ); } } -- cgit From 5930e250f6b3a8e50152150d391b068c9761f2f0 Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Tue, 13 Oct 2009 09:48:08 +0000 Subject: #i10000# --- vcl/source/gdi/makefile.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk index 8ca2e1a4817c..c77508ea159e 100644 --- a/vcl/source/gdi/makefile.mk +++ b/vcl/source/gdi/makefile.mk @@ -75,7 +75,8 @@ EXCEPTIONSFILES= $(SLO)$/salmisc.obj \ $(SLO)$/virdev.obj \ $(SLO)$/impprn.obj \ $(SLO)$/gdimtf.obj \ - $(SLO)$/graphictools.obj + $(SLO)$/graphictools.obj \ + $(SLO)$/textlayout.obj SLOFILES= $(EXCEPTIONSFILES) \ $(SLO)$/animate.obj \ @@ -117,8 +118,7 @@ SLOFILES= $(EXCEPTIONSFILES) \ $(SLO)$/pdfwriter.obj \ $(SLO)$/salgdilayout.obj \ $(SLO)$/extoutdevdata.obj \ - $(SLO)$/salnativewidgets-none.obj \ - $(SLO)$/textlayout.obj + $(SLO)$/salnativewidgets-none.obj # --- Targets ------------------------------------------------------ -- cgit From aba606ba5eceadb69462ba3463d1094de875c01a Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Tue, 13 Oct 2009 09:49:33 +0000 Subject: #i10000# --- vcl/inc/vcl/button.hxx | 6 ++++-- vcl/inc/vcl/edit.hxx | 1 + vcl/inc/vcl/fixbrd.hxx | 1 + vcl/inc/vcl/fixed.hxx | 4 ++++ vcl/inc/vcl/group.hxx | 1 + vcl/inc/vcl/ilstbox.hxx | 1 + vcl/inc/vcl/slider.hxx | 1 + vcl/inc/vcl/tabctrl.hxx | 1 + 8 files changed, 14 insertions(+), 2 deletions(-) diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx index 3905768ca140..b80edf6712cd 100644 --- a/vcl/inc/vcl/button.hxx +++ b/vcl/inc/vcl/button.hxx @@ -144,10 +144,10 @@ protected: SAL_DLLPRIVATE PushButton( const PushButton & ); SAL_DLLPRIVATE PushButton& operator=( const PushButton & ); -protected: - using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + using Control::ImplInitSettings; + using Window::ImplInit; public: SAL_DLLPRIVATE void ImplSetDefButton( BOOL bSet ); SAL_DLLPRIVATE static void ImplDrawPushButtonFrame( Window* pDev, Rectangle& rRect, USHORT nStyle ); @@ -324,6 +324,7 @@ private: SAL_DLLPRIVATE RadioButton& operator= (const RadioButton &); protected: + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); @@ -439,6 +440,7 @@ private: SAL_DLLPRIVATE CheckBox& operator= (const CheckBox &); protected: + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); diff --git a/vcl/inc/vcl/edit.hxx b/vcl/inc/vcl/edit.hxx index 534d63b3427c..fb99bd028631 100644 --- a/vcl/inc/vcl/edit.hxx +++ b/vcl/inc/vcl/edit.hxx @@ -124,6 +124,7 @@ private: SAL_DLLPRIVATE ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > ImplGetBreakIterator() const; protected: + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); diff --git a/vcl/inc/vcl/fixbrd.hxx b/vcl/inc/vcl/fixbrd.hxx index 52de68d1c71f..68e1e69b9054 100644 --- a/vcl/inc/vcl/fixbrd.hxx +++ b/vcl/inc/vcl/fixbrd.hxx @@ -57,6 +57,7 @@ private: BOOL mbTransparent; private: + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); diff --git a/vcl/inc/vcl/fixed.hxx b/vcl/inc/vcl/fixed.hxx index 83f8c0fcb190..a5c834fce486 100644 --- a/vcl/inc/vcl/fixed.hxx +++ b/vcl/inc/vcl/fixed.hxx @@ -47,6 +47,7 @@ class VCL_DLLPUBLIC FixedText : public Control { //#if 0 // _SOLAR__PRIVATE private: + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); @@ -86,6 +87,7 @@ public: class VCL_DLLPUBLIC FixedLine : public Control { private: + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); @@ -122,6 +124,7 @@ private: Bitmap maBitmap; Bitmap maBitmapHC; + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); @@ -162,6 +165,7 @@ private: BOOL mbInUserDraw; private: + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); diff --git a/vcl/inc/vcl/group.hxx b/vcl/inc/vcl/group.hxx index 7c3d5d87954e..7d5dd43fbee3 100644 --- a/vcl/inc/vcl/group.hxx +++ b/vcl/inc/vcl/group.hxx @@ -42,6 +42,7 @@ class VCL_DLLPUBLIC GroupBox : public Control { private: + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); diff --git a/vcl/inc/vcl/ilstbox.hxx b/vcl/inc/vcl/ilstbox.hxx index e5f6696005fa..81dd32ef2705 100644 --- a/vcl/inc/vcl/ilstbox.hxx +++ b/vcl/inc/vcl/ilstbox.hxx @@ -369,6 +369,7 @@ public: void SetReadOnly( BOOL bReadOnly ) { mbReadOnly = bReadOnly; } BOOL IsReadOnly() const { return mbReadOnly; } + using Control::ImplInitSettings; void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); USHORT ImplGetTextStyle() const; diff --git a/vcl/inc/vcl/slider.hxx b/vcl/inc/vcl/slider.hxx index 396ed0ca83cb..c3dfcfd42608 100644 --- a/vcl/inc/vcl/slider.hxx +++ b/vcl/inc/vcl/slider.hxx @@ -70,6 +70,7 @@ private: Link maSlideHdl; Link maEndSlideHdl; + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); diff --git a/vcl/inc/vcl/tabctrl.hxx b/vcl/inc/vcl/tabctrl.hxx index 4cd4011b3e10..30edf6227a60 100644 --- a/vcl/inc/vcl/tabctrl.hxx +++ b/vcl/inc/vcl/tabctrl.hxx @@ -78,6 +78,7 @@ private: Link maActivateHdl; Link maDeactivateHdl; + using Control::ImplInitSettings; SAL_DLLPRIVATE void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); SAL_DLLPRIVATE ImplTabItem* ImplGetItem( USHORT nId ) const; SAL_DLLPRIVATE void ImplScrollBtnsColor(); -- cgit From b069c118803f3d63d5a2c0f90925ce87324fca2c Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Tue, 13 Oct 2009 10:54:50 +0000 Subject: #i10000# --- svtools/inc/calendar.hxx | 1 + svtools/inc/svtools/editbrowsebox.hxx | 1 + svtools/inc/svtools/svmedit.hxx | 1 + svtools/inc/svtools/valueset.hxx | 1 + 4 files changed, 4 insertions(+) diff --git a/svtools/inc/calendar.hxx b/svtools/inc/calendar.hxx index 6f20a7f8c6c3..1c81945a669c 100644 --- a/svtools/inc/calendar.hxx +++ b/svtools/inc/calendar.hxx @@ -251,6 +251,7 @@ private: USHORT mnDragScrollHitTest; #ifdef _SV_CALENDAR_CXX + using Control::ImplInitSettings; using Window::ImplInit; SVT_DLLPRIVATE void ImplInit( WinBits nWinStyle ); SVT_DLLPRIVATE void ImplInitSettings(); diff --git a/svtools/inc/svtools/editbrowsebox.hxx b/svtools/inc/svtools/editbrowsebox.hxx index c72c7c54f877..60fcbc9efb1a 100644 --- a/svtools/inc/svtools/editbrowsebox.hxx +++ b/svtools/inc/svtools/editbrowsebox.hxx @@ -675,6 +675,7 @@ namespace svt private: virtual void PaintField(OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId ) const; + using Control::ImplInitSettings; SVT_DLLPRIVATE void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground ); SVT_DLLPRIVATE void DetermineFocus( const sal_uInt16 _nGetFocusFlags = 0); inline void HideAndDisable(CellControllerRef& rController); diff --git a/svtools/inc/svtools/svmedit.hxx b/svtools/inc/svtools/svmedit.hxx index b1e0d368c9ba..ccf77299965c 100644 --- a/svtools/inc/svtools/svmedit.hxx +++ b/svtools/inc/svtools/svmedit.hxx @@ -61,6 +61,7 @@ protected: void DataChanged( const DataChangedEvent& rDCEvt ); virtual long PreNotify( NotifyEvent& rNEvt ); long Notify( NotifyEvent& rNEvt ); + using Control::ImplInitSettings; void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); WinBits ImplInitStyle( WinBits nStyle ); diff --git a/svtools/inc/svtools/valueset.hxx b/svtools/inc/svtools/valueset.hxx index 647851008c8f..fc12f9517b6d 100644 --- a/svtools/inc/svtools/valueset.hxx +++ b/svtools/inc/svtools/valueset.hxx @@ -285,6 +285,7 @@ private: #ifdef _SV_VALUESET_CXX friend class ValueSetAcc; friend class ValueItemAcc; + using Control::ImplInitSettings; using Window::ImplInit; SVT_DLLPRIVATE void ImplInit(); SVT_DLLPRIVATE void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); -- cgit From 280df82edc59bc802dcb9615d98090002ddfeed6 Mon Sep 17 00:00:00 2001 From: hdu Date: Tue, 13 Oct 2009 15:58:01 +0200 Subject: #i92671# fix parsing of GSUB.cov2 subtables (thanks cmc!) --- vcl/source/fontsubset/gsub.cxx | 8 ++++++-- vcl/source/glyphs/gcach_ftyp.cxx | 6 ++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/vcl/source/fontsubset/gsub.cxx b/vcl/source/fontsubset/gsub.cxx index 9715e7fc8585..600c03194210 100644 --- a/vcl/source/fontsubset/gsub.cxx +++ b/vcl/source/fontsubset/gsub.cxx @@ -32,6 +32,8 @@ #include "gsub.h" +#include + #include #include #include @@ -280,9 +282,11 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, { const USHORT nGlyph0 = NEXT_UShort( pCoverage ); const USHORT nGlyph1 = NEXT_UShort( pCoverage ); - const USHORT nCovIdx = NEXT_UShort( pCoverage ); + const USHORT nStartCoverageIndex = NEXT_UShort( pCoverage ); + OSL_ENSURE( aSubstVector.size() == nStartCoverageIndex, "coverage index mismatch"); + (void)nStartCoverageIndex; for( USHORT j = nGlyph0; j <= nGlyph1; ++j ) - aSubstVector.push_back( GlyphSubst( j + nCovIdx, 0 ) ); + aSubstVector.push_back( GlyphSubst( j, 0 ) ); } } break; diff --git a/vcl/source/glyphs/gcach_ftyp.cxx b/vcl/source/glyphs/gcach_ftyp.cxx index 712c2334b35c..86feb0d31dae 100644 --- a/vcl/source/glyphs/gcach_ftyp.cxx +++ b/vcl/source/glyphs/gcach_ftyp.cxx @@ -2487,10 +2487,12 @@ bool FreetypeServerFont::ApplyGSUB( const ImplFontSelectData& rFSD ) { const USHORT nGlyph0 = GetUShort( pCoverage+0 ); const USHORT nGlyph1 = GetUShort( pCoverage+2 ); - const USHORT nCovIdx = GetUShort( pCoverage+4 ); + const USHORT nStartCoverageIndex = GetUShort( pCoverage+4 ); + DBG_ASSERT( aSubstVector.size() == nStartCoverageIndex, "coverage index mismatch"); + (void)nStartCoverageIndex; pCoverage += 6; for( USHORT j = nGlyph0; j <= nGlyph1; ++j ) - aSubstVector.push_back( GlyphSubst( j + nCovIdx, 0 ) ); + aSubstVector.push_back( GlyphSubst( j, 0 ) ); } } break; -- cgit From 65f75b3b255a4db2484d88ba03fed71ba331aa81 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Tue, 13 Oct 2009 19:36:40 +0200 Subject: #i105876# check fgets return (thanks cmc) --- padmin/source/cmddlg.cxx | 54 ++++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/padmin/source/cmddlg.cxx b/padmin/source/cmddlg.cxx index 9aa65c8ce204..c6daf547369c 100644 --- a/padmin/source/cmddlg.cxx +++ b/padmin/source/cmddlg.cxx @@ -79,20 +79,22 @@ void CommandStore::getSystemPdfCommands( ::std::list< String >& rCommands ) pPipe = popen( "which gs 2>/dev/null", "r" ); if( pPipe ) { - fgets( pBuffer, sizeof( pBuffer ), pPipe ); - int nLen = strlen( pBuffer ); - if( pBuffer[nLen-1] == '\n' ) // strip newline - pBuffer[--nLen] = 0; - aCommand = String( ByteString( pBuffer ), aEncoding ); - if( ( ( aCommand.GetChar( 0 ) == '/' ) - || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '/' ) - || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '.' && aCommand.GetChar( 2 ) == '/' ) ) - && nLen > 2 - && aCommand.GetChar( nLen-2 ) == 'g' - && aCommand.GetChar( nLen-1 ) == 's' ) + if (fgets( pBuffer, sizeof( pBuffer ), pPipe ) != NULL) { - aCommand.AppendAscii( " -q -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=\"(OUTFILE)\" -" ); - aSysCommands.push_back( aCommand ); + int nLen = strlen( pBuffer ); + if( pBuffer[nLen-1] == '\n' ) // strip newline + pBuffer[--nLen] = 0; + aCommand = String( ByteString( pBuffer ), aEncoding ); + if( ( ( aCommand.GetChar( 0 ) == '/' ) + || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '/' ) + || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '.' && aCommand.GetChar( 2 ) == '/' ) ) + && nLen > 2 + && aCommand.GetChar( nLen-2 ) == 'g' + && aCommand.GetChar( nLen-1 ) == 's' ) + { + aCommand.AppendAscii( " -q -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=\"(OUTFILE)\" -" ); + aSysCommands.push_back( aCommand ); + } } pclose( pPipe ); } @@ -100,19 +102,21 @@ void CommandStore::getSystemPdfCommands( ::std::list< String >& rCommands ) pPipe = popen( "which distill 2>/dev/null", "r" ); if( pPipe ) { - fgets( pBuffer, sizeof( pBuffer ), pPipe ); - int nLen = strlen( pBuffer ); - if( pBuffer[nLen-1] == '\n' ) // strip newline - pBuffer[--nLen] = 0; - aCommand = String( ByteString( pBuffer ), aEncoding ); - if( ( ( aCommand.GetChar( 0 ) == '/' ) - || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '/' ) - || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '.' && aCommand.GetChar( 2 ) == '/' ) ) - && nLen > 7 - && aCommand.Copy( nLen - 8 ).EqualsAscii( "/distill" ) ) + if (fgets( pBuffer, sizeof( pBuffer ), pPipe ) != NULL) { - aCommand.AppendAscii( " (TMP) ; mv `echo (TMP) | sed s/\\.ps\\$/.pdf/` \"(OUTFILE)\"" ); - aSysCommands.push_back( aCommand ); + int nLen = strlen( pBuffer ); + if( pBuffer[nLen-1] == '\n' ) // strip newline + pBuffer[--nLen] = 0; + aCommand = String( ByteString( pBuffer ), aEncoding ); + if( ( ( aCommand.GetChar( 0 ) == '/' ) + || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '/' ) + || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '.' && aCommand.GetChar( 2 ) == '/' ) ) + && nLen > 7 + && aCommand.Copy( nLen - 8 ).EqualsAscii( "/distill" ) ) + { + aCommand.AppendAscii( " (TMP) ; mv `echo (TMP) | sed s/\\.ps\\$/.pdf/` \"(OUTFILE)\"" ); + aSysCommands.push_back( aCommand ); + } } pclose( pPipe ); } -- cgit From 510329a13fabb3c8631ede58423350833410f67e Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Tue, 13 Oct 2009 20:27:33 +0000 Subject: remove obsolete files, instead of fixing newly introduced warnings in them --- svtools/inc/privsplt.hxx | 86 ---------------------- svtools/inc/sectctr.hxx | 154 ---------------------------------------- svtools/inc/svtools/section.hxx | 104 --------------------------- svtools/prj/d.lst | 3 - 4 files changed, 347 deletions(-) delete mode 100644 svtools/inc/privsplt.hxx delete mode 100644 svtools/inc/sectctr.hxx delete mode 100644 svtools/inc/svtools/section.hxx diff --git a/svtools/inc/privsplt.hxx b/svtools/inc/privsplt.hxx deleted file mode 100644 index 50a500de8848..000000000000 --- a/svtools/inc/privsplt.hxx +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: privsplt.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_PRIVSPLT_HXX -#define _SV_PRIVSPLT_HXX - -#include - -enum PRIVSPLIT_DIRECTION {PRIVSPLIT_HORZ,PRIVSPLIT_VERT }; - -class SvPrivatSplit : public FixedLine -{ - private: - - Link aCtrModifiedLink; - BOOL aMovingFlag; - Pointer aWinPointer; - PRIVSPLIT_DIRECTION eAdrSplit; - short nOldX; - short nOldY; - short nNewX; - short nNewY; - short nMinPos; - short nMaxPos; - Range aXMovingRange; - Range aYMovingRange; - short nDeltaX; - short nDeltaY; - void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); - - protected: - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void Tracking( const TrackingEvent& rTEvt ); - - public: - - SvPrivatSplit( Window* pWindow, const ResId& rResId,PRIVSPLIT_DIRECTION eAdrSplit); - - SvPrivatSplit( Window* pParent,PRIVSPLIT_DIRECTION eAdrSplit, WinBits nStyle = 0); - - virtual short GetDeltaX(); - virtual short GetDeltaY(); - - virtual void CtrModified(); - - void SetXRange(Range cRgeX); - void SetYRange(Range cRgeY); - - void MoveSplitTo(Point aPos); - - virtual void StateChanged( StateChangedType nType ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); - - void SetCtrModifiedHdl( const Link& rLink ) { aCtrModifiedLink = rLink; } - const Link& GetCtrModifiedHdl() const { return aCtrModifiedLink; } -}; - - -#endif diff --git a/svtools/inc/sectctr.hxx b/svtools/inc/sectctr.hxx deleted file mode 100644 index da73e7aed4a7..000000000000 --- a/svtools/inc/sectctr.hxx +++ /dev/null @@ -1,154 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: sectctr.hxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SECTCTR_HXX -#define _SV_SECTCTR_HXX - -#include -#include - -class ImplSplitWindow; -class ScrollBar; -class ScrollBarBox; -class SvSection; - -#define SECTION_APPEND ((USHORT)0xFFFF) -#define SECTION_NOTFOUND ((USHORT)0xFFFF) - -#define WB_SECTION_STYLE WB_VSCROLL | WB_HSCROLL | WB_TABSTOP - -class SvSectionControl : public Control -{ -private: - - Window aSplitWinContainer; - ImplSplitWindow* pSplitWin; - ScrollBar* pVScrollBar; - ScrollBar* pHScrollBar; - ScrollBarBox* pScrollBarBox; - DockingWindow* pDummy; - long nRealHeight; - long nMaxHeight; - long nMinWidth; - Wallpaper aWallpaper; - - DECL_LINK( ScrollHdl, ScrollBar* ); - DECL_LINK( EndScrollHdl, ScrollBar* ); - - -protected: - - virtual void Resize(); - virtual void Paint( const Rectangle& rRect ); - virtual void StateChanged( StateChangedType nStateChange ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); - virtual void Command( const CommandEvent& rCEvt ); - virtual long PreNotify( NotifyEvent& rNEvt ); - virtual long Notify( NotifyEvent& rNEvt ); - virtual long KeyEventNotify( const KeyEvent& rKEvt ); - using Control::SetPosSizePixel; - virtual void SetPosSizePixel( long nX, long nY,long nWidth, long nHeight,USHORT nFlags); - - - - long CalcMaxHeight(); - long CalcRealHeight(); - long CalcSectionWidth(); - - void SetScrollBars(BOOL bVert,BOOL bHorz); - void ShowScrollBarBox(); - void UpdateScrollBars(); - - BOOL VScrollResize(Size &aSize); - BOOL HScrollResize(Size &aSize); - void SetChildPos(long nPos, BOOL bScrolling = TRUE); - -public: - SvSectionControl( Window* pParent,WinBits nStyle = WB_SECTION_STYLE); - SvSectionControl( Window* pParent, const ResId& rResId ); - ~SvSectionControl(); - - - void InsertSection( USHORT nSectionId,SvSection* pSection,long nSize,USHORT nPos); - void InsertSection( USHORT nSectionId,SvSection* pSection,USHORT nPos); - void RemoveSection( USHORT nSectionId ); - void Clear(); - - USHORT GetSectionCount() const; - USHORT GetSectionId( USHORT nPos ) const; - USHORT GetSectionPos( USHORT nSectionId ) const; - USHORT GetSectionId( const Point& rPos ) const; - - void SetSectionSize( USHORT nId, long nNewSize ); - long GetSectionSize( USHORT nId ) const; - - /* - void SetCurSectionId( USHORT nSectionId ); - USHORT GetCurSectionId() const; - - void SetFirstSectionId( USHORT nSectionId ); - USHORT GetFirstSectionId() const { return GetSectionId( mnFirstSectionPos ); } - - void MakeVisible( USHORT nSectionId ); - */ - - void SetSectionWidth( USHORT nSectionId, long nWidth); - long GetSectionWidth( USHORT nSectionId ) const; - - void SetSection( USHORT nSectionId, SvSection* pPage ); - SvSection* GetSection( USHORT nSectionId ) const; - - void SetSectionText( USHORT nSectionId, const XubString& rText ); - XubString GetSectionText( USHORT nSectionId ) const; - - void SetHelpText( USHORT nSectionId, const XubString& rText ); - const XubString& GetHelpText( USHORT nSectionId ) const; - - void SetHelpId( USHORT nSectionId, ULONG nHelpId ); - ULONG GetHelpId( USHORT nSectionId ) const; - - void SetHelpText( const XubString& rText ) - { Control::SetHelpText( rText ); } - const XubString& GetHelpText() const - { return Control::GetHelpText(); } - - void SetHelpId( ULONG nId ) - { Control::SetHelpId( nId ); } - ULONG GetHelpId() const - { return Control::GetHelpId(); } - - using Control::SetBackground; - void SetBackground( const Wallpaper& rBackground ){aWallpaper=rBackground; } - const Wallpaper& GetBackground() const { return aWallpaper; } - -}; - - -#endif diff --git a/svtools/inc/svtools/section.hxx b/svtools/inc/svtools/section.hxx deleted file mode 100644 index 48941d06b7ca..000000000000 --- a/svtools/inc/svtools/section.hxx +++ /dev/null @@ -1,104 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: section.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SECTION_HXX -#define _SV_SECTION_HXX - -#include -#include -#include -#include -#include -#include - -class SvSectionControl; - -class SvSection : public DockingWindow -{ -private: - SvSectionControl* pSectionControl; - USHORT nSectionID; - Window* pChildWin; - XubString aName; - long nHeight; - long nMinHeight; - long nMinWidth; - long nOldHeight; - - DECL_LINK( ToggleHdl, SvExpander* ); - DECL_LINK( SplitHdl, SvPrivatSplit* ); - - void ImplExpandSection(); - void ImplShrinkSection(); - -protected: - SvExpander aExpander; - Window aChildWinContainer; - SvPrivatSplit aPrivatSplit; - - virtual void Resize(); - virtual void Paint( const Rectangle& rRect ); - virtual long Notify( NotifyEvent& rNEvt ); - -public: - SvSection(const XubString& rName,SvSectionControl* pParent, - WinBits nStyle = 0); - SvSection(const XubString& rName,SvSectionControl* pParent, - Window* pChildWin, WinBits nStyle = 0); - - virtual void SetScrollPos(long nPos); - void SetChildPos(long nPos); - - void SetSectionControl(SvSectionControl* pParent); - const SvSectionControl* GetSectionControl()const ; - void SetSectionText( const XubString& ); - const XubString& GetSectionText() const {return aName;} - - void SetChildWin(Window* pChildWin); - Window* GetChildWin() const {return pChildWin;} - - void SetSectionID(USHORT nId) {nSectionID=nId;} - USHORT GetSectionID() const {return nSectionID;} - - void SetMaxHeight(long nHeight); - long GetMaxHeight(); - - void SetMinHeight(long nHeight); - long GetMinHeight(); - - void SetMinWidth(long nWidth); - long GetMinWidth(); - - void ExpandSection(); - void ShrinkSection(); - BOOL IsExpanded(); -}; - -#endif diff --git a/svtools/prj/d.lst b/svtools/prj/d.lst index 3dc9c0b013bb..aebe1dabc908 100644 --- a/svtools/prj/d.lst +++ b/svtools/prj/d.lst @@ -210,9 +210,6 @@ mkdir: %_DEST%\inc%_EXT%\svtools ..\inc\instrm.hxx %_DEST%\inc%_EXT%\svtools\instrm.hxx ..\inc\outstrm.hxx %_DEST%\inc%_EXT%\svtools\outstrm.hxx -..\inc\svtools\section.hxx %_DEST%\inc%_EXT%\svtools\section.hxx -..\inc\sectctr.hxx %_DEST%\inc%_EXT%\svtools\sectctr.hxx -..\inc\privsplt.hxx %_DEST%\inc%_EXT%\svtools\privsplt.hxx ..\inc\expander.hxx %_DEST%\inc%_EXT%\svtools\expander.hxx ..\source\svsql\converter.hxx %_DEST%\inc%_EXT%\svtools\converter.hxx -- cgit From b4d6bef1c269e6e7b78e3f713e7f17d863a10434 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Wed, 14 Oct 2009 15:23:26 +0200 Subject: #i104877# handle MetaFloatTransparentAction better in flat transparency case --- vcl/source/gdi/pdfwriter_impl.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index e7ee18ec7705..7b6d5e7f41aa 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -8792,6 +8792,13 @@ bool PDFWriterImpl::writeTransparentObject( TransparencyEmit& rObject ) aLine.append( ' ' ); appendFixedInt( rObject.m_aBoundRect.Bottom()+1, aLine ); aLine.append( " ]\n" ); + if( ! rObject.m_pSoftMaskStream ) + { + if( ! m_bIsPDF_A1 ) + { + aLine.append( "/Group<>\n" ); + } + } /* #i42884# the PDF reference recommends that each Form XObject * should have a resource dict; alas if that is the same object * as the one of the page it triggers an endless recursion in -- cgit From ad482351a6c12cddb06575f6a9a00ec1b72d92fb Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Fri, 16 Oct 2009 00:05:16 +0200 Subject: #i103496#: split svtools; improve ConfitItems --- goodies/inc/chtuner.hxx | 2 +- goodies/inc/goodies.hrc | 2 +- goodies/inc/pch/precompiled_goodies.hxx | 8 +- goodies/source/filter.vcl/egif/egif.cxx | 2 +- goodies/source/filter.vcl/eos2met/eos2met.cxx | 2 +- goodies/source/filter.vcl/epbm/epbm.cxx | 2 +- goodies/source/filter.vcl/epgm/epgm.cxx | 2 +- goodies/source/filter.vcl/epict/epict.cxx | 2 +- goodies/source/filter.vcl/eppm/eppm.cxx | 2 +- goodies/source/filter.vcl/eps/eps.cxx | 2 +- goodies/source/filter.vcl/etiff/etiff.cxx | 2 +- goodies/source/filter.vcl/ipcd/ipcd.cxx | 2 +- goodies/source/inv/invader.cxx | 2 +- goodies/source/unographic/descriptor.cxx | 2 +- goodies/source/unographic/provider.cxx | 2 +- goodies/source/unographic/renderer.cxx | 2 +- goodies/source/unographic/transformer.cxx | 2 +- svl/inc/svl/bintitem.hxx | 88 ---- svl/inc/svl/ctloptions.hxx | 5 +- svl/inc/svl/dateitem.hxx | 109 ++++ svl/inc/svl/dtritem.hxx | 93 ---- svl/inc/svl/frqitem.hxx | 178 ------- svl/inc/svl/languageoptions.hxx | 6 +- svl/inc/svl/svtools.hrc | 1 + svl/inc/svl/tfrmitem.hxx | 90 ---- svl/inc/svl/tresitem.hxx | 65 --- svl/prj/d.lst | 14 +- svl/source/config/cjkoptions.cxx | 2 + svl/source/config/ctloptions.cxx | 28 +- svl/source/config/languageoptions.cxx | 26 +- svl/source/items/bintitem.cxx | 169 ------ svl/source/items/cstitem.src | 72 +++ svl/source/items/dateitem.cxx | 286 ++++++++++ svl/source/items/dtritem.cxx | 241 --------- svl/source/items/frqitem.cxx | 580 --------------------- svl/source/items/makefile.mk | 42 +- svl/source/items/tfrmitem.cxx | 184 ------- svl/source/items/tresitem.cxx | 78 --- svl/source/numbers/numuno.cxx | 1 - svl/source/numbers/zforlist.cxx | 10 +- svl/source/passwordcontainer/syscreds.cxx | 5 + svl/source/passwordcontainer/syscreds.hxx | 2 +- svl/util/makefile.mk | 2 +- svtools/bmpmaker/bmp.cxx | 2 +- svtools/bmpmaker/bmpsum.cxx | 2 +- svtools/inc/apearcfg.hxx | 1 + svtools/inc/extcolorcfg.hxx | 4 +- svtools/inc/fontsubstconfig.hxx | 1 + svtools/inc/svtools/accessibilityoptions.hxx | 6 +- svtools/inc/svtools/colorcfg.hxx | 9 +- svtools/inc/svtools/fmtfield.hxx | 2 +- svtools/inc/svtools/helpid.hrc | 2 +- svtools/inc/svtools/htmlout.hxx | 2 +- svtools/inc/svtools/imapobj.hxx | 2 +- svtools/inc/svtools/insdlg.hxx | 2 +- svtools/inc/svtools/parhtml.hxx | 2 +- svtools/inc/svtools/parrtf.hxx | 2 +- svtools/inc/svtools/svlbox.hxx | 2 +- svtools/inc/svtools/syntaxhighlight.hxx | 4 +- svtools/inc/svtools/textdata.hxx | 4 +- svtools/inc/svtools/texteng.hxx | 2 +- svtools/source/brwbox/editbrowsebox.cxx | 2 +- svtools/source/brwbox/editbrowsebox.src | 2 +- svtools/source/config/accessibilityoptions.cxx | 4 +- svtools/source/config/apearcfg.cxx | 5 + svtools/source/config/colorcfg.cxx | 99 +--- svtools/source/config/extcolorcfg.cxx | 4 +- svtools/source/config/fontsubstconfig.cxx | 6 +- svtools/source/config/optionsdrawinglayer.cxx | 5 + svtools/source/contnr/contentenumeration.cxx | 2 +- svtools/source/contnr/fileview.cxx | 6 +- svtools/source/contnr/fileview.src | 2 +- svtools/source/contnr/imivctl.hxx | 2 +- svtools/source/contnr/svcontnr.src | 2 +- svtools/source/contnr/svimpbox.cxx | 2 +- svtools/source/contnr/svimpicn.cxx | 2 +- svtools/source/contnr/svlbox.cxx | 2 +- svtools/source/contnr/svtabbx.cxx | 2 +- svtools/source/contnr/templwin.cxx | 4 +- svtools/source/contnr/templwin.hxx | 2 +- svtools/source/contnr/templwin.src | 2 +- svtools/source/control/calendar.cxx | 2 +- svtools/source/control/calendar.src | 2 +- svtools/source/control/collatorres.cxx | 2 +- svtools/source/control/ctrlbox.cxx | 2 +- svtools/source/control/ctrlbox.src | 2 +- svtools/source/control/ctrltool.cxx | 2 +- svtools/source/control/ctrltool.src | 2 +- svtools/source/control/fileurlbox.cxx | 2 +- svtools/source/control/fmtfield.cxx | 4 +- svtools/source/control/indexentryres.cxx | 2 +- svtools/source/control/inettbc.cxx | 14 +- svtools/source/control/taskstat.cxx | 2 +- svtools/source/control/urlcontrol.cxx | 2 +- svtools/source/dialogs/addresstemplate.cxx | 16 +- svtools/source/dialogs/addresstemplate.src | 2 +- svtools/source/dialogs/logindlg.cxx | 2 +- svtools/source/dialogs/logindlg.src | 2 +- svtools/source/dialogs/printdlg.cxx | 2 +- svtools/source/dialogs/printdlg.hrc | 2 +- svtools/source/dialogs/prnsetup.hrc | 2 +- svtools/source/dialogs/propctrl.hxx | 2 +- svtools/source/dialogs/roadmapwizard.cxx | 2 +- svtools/source/dialogs/wizardmachine.cxx | 2 +- svtools/source/dialogs/wizardmachine.src | 2 +- svtools/source/edit/svmedit.cxx | 8 +- svtools/source/edit/textdat2.hxx | 2 +- svtools/source/edit/textdoc.hxx | 2 +- svtools/source/edit/texteng.cxx | 2 +- svtools/source/edit/textundo.hxx | 2 +- svtools/source/edit/textview.cxx | 4 +- .../filter.vcl/filter/SvFilterOptionsDialog.cxx | 4 +- svtools/source/filter.vcl/filter/dlgejpg.hrc | 2 +- svtools/source/filter.vcl/filter/dlgepng.hrc | 2 +- svtools/source/filter.vcl/filter/dlgexpor.hrc | 2 +- svtools/source/filter.vcl/filter/filter.cxx | 2 +- svtools/source/filter.vcl/filter/strings.hrc | 2 +- svtools/source/inc/iodlg.hrc | 2 +- svtools/source/inc/property.hxx | 8 +- svtools/source/java/javaerror.src | 2 +- svtools/source/java/javainteractionhandler.cxx | 2 +- svtools/source/java/patchjavaerror.src | 2 +- svtools/source/misc/ehdl.cxx | 2 +- svtools/source/misc/ehdl.src | 2 +- svtools/source/misc/embedhlp.cxx | 2 +- svtools/source/misc/errtxt.src | 2 +- svtools/source/misc/helpagent.src | 2 +- svtools/source/misc/helpagentwindow.cxx | 2 +- svtools/source/misc/imagemgr.cxx | 2 +- svtools/source/misc/imagemgr.src | 2 +- svtools/source/misc/imap.cxx | 2 +- svtools/source/misc/imap2.cxx | 2 +- svtools/source/misc/itemdel.cxx | 4 +- svtools/source/misc/langtab.cxx | 4 +- svtools/source/misc/langtab.src | 2 +- svtools/source/misc/transfer.cxx | 2 +- svtools/source/misc/transfer2.cxx | 2 +- svtools/source/misc/wallitem.cxx | 2 +- svtools/source/plugapp/testtool.src | 2 +- .../productregistration/productregistration.cxx | 2 +- .../source/productregistration/registrationdlg.cxx | 2 +- .../source/productregistration/registrationdlg.src | 2 +- svtools/source/svhtml/htmlout.cxx | 8 +- svtools/source/svhtml/htmlsupp.cxx | 2 +- svtools/source/svhtml/parhtml.cxx | 4 +- svtools/source/svrtf/svparser.cxx | 2 +- svtools/source/uno/unoevent.cxx | 2 +- svtools/source/uno/unoifac2.hrc | 2 +- svtools/source/uno/unoiface.cxx | 2 +- svtools/workben/unodialog/udlg_global.hrc | 2 +- unotools/inc/unotools/configitem.hxx | 4 +- unotools/inc/unotools/options.hxx | 26 +- unotools/inc/unotools/syslocale.hxx | 6 +- unotools/inc/unotools/syslocaleoptions.hxx | 15 +- unotools/source/config/cacheoptions.cxx | 5 + unotools/source/config/configitem.cxx | 25 +- unotools/source/config/defaultoptions.cxx | 12 + unotools/source/config/fltrcfg.cxx | 8 + unotools/source/config/historyoptions.cxx | 2 +- unotools/source/config/javaoptions.cxx | 5 + unotools/source/config/lingucfg.cxx | 3 + unotools/source/config/localisationoptions.cxx | 2 + unotools/source/config/options.cxx | 40 +- unotools/source/config/printwarningoptions.cxx | 5 + unotools/source/config/searchopt.cxx | 5 + unotools/source/config/sourceviewconfig.cxx | 2 +- unotools/source/config/syslocaleoptions.cxx | 214 +++++--- unotools/source/config/undoopt.cxx | 2 +- unotools/source/config/useroptions.cxx | 2 +- unotools/source/misc/syslocale.cxx | 96 ++-- vcl/inc/vcl/settings.hxx | 4 +- vcl/inc/vcl/svdata.hxx | 7 + vcl/source/app/settings.cxx | 62 +-- vcl/source/app/svapp.cxx | 9 +- vcl/source/app/svdata.cxx | 6 + vcl/source/app/svmain.cxx | 8 +- 176 files changed, 1094 insertions(+), 2300 deletions(-) delete mode 100644 svl/inc/svl/bintitem.hxx create mode 100644 svl/inc/svl/dateitem.hxx delete mode 100644 svl/inc/svl/dtritem.hxx delete mode 100644 svl/inc/svl/frqitem.hxx delete mode 100644 svl/inc/svl/tfrmitem.hxx delete mode 100644 svl/inc/svl/tresitem.hxx delete mode 100644 svl/source/items/bintitem.cxx create mode 100644 svl/source/items/cstitem.src create mode 100644 svl/source/items/dateitem.cxx delete mode 100644 svl/source/items/dtritem.cxx delete mode 100644 svl/source/items/frqitem.cxx delete mode 100644 svl/source/items/tfrmitem.cxx delete mode 100644 svl/source/items/tresitem.cxx diff --git a/goodies/inc/chtuner.hxx b/goodies/inc/chtuner.hxx index 4c7e288d2ce3..7a54c1e05a41 100644 --- a/goodies/inc/chtuner.hxx +++ b/goodies/inc/chtuner.hxx @@ -38,7 +38,7 @@ #endif -#include +#include class ChannelItem; class ChannelList; diff --git a/goodies/inc/goodies.hrc b/goodies/inc/goodies.hrc index 18584985a603..139987c4f6ee 100644 --- a/goodies/inc/goodies.hrc +++ b/goodies/inc/goodies.hrc @@ -31,7 +31,7 @@ #define _GOODIES_HRC #ifndef _SOLAR_HRC -#include +#include #endif // Dialoge --------------------------------------------------------------- diff --git a/goodies/inc/pch/precompiled_goodies.hxx b/goodies/inc/pch/precompiled_goodies.hxx index 85a97433411b..fe6f2ec433e5 100644 --- a/goodies/inc/pch/precompiled_goodies.hxx +++ b/goodies/inc/pch/precompiled_goodies.hxx @@ -98,11 +98,11 @@ #include "svtools/FilterConfigItem.hxx" #include "unotools/cacheoptions.hxx" #include "svtools/fltcall.hxx" -#include "svtools/itemprop.hxx" -#include "svtools/lstner.hxx" -#include "svtools/solar.hrc" +#include "svl/itemprop.hxx" +#include "svl/lstner.hxx" +#include "svl/solar.hrc" #include "svtools/stdctrl.hxx" -#include "svtools/svarray.hxx" +#include "svl/svarray.hxx" #include "toolkit/helper/vclunohelper.hxx" diff --git a/goodies/source/filter.vcl/egif/egif.cxx b/goodies/source/filter.vcl/egif/egif.cxx index e1547c7339d0..9f2aeaddd686 100644 --- a/goodies/source/filter.vcl/egif/egif.cxx +++ b/goodies/source/filter.vcl/egif/egif.cxx @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include "giflzwc.hxx" diff --git a/goodies/source/filter.vcl/eos2met/eos2met.cxx b/goodies/source/filter.vcl/eos2met/eos2met.cxx index b176d186a217..51ef34d79cfd 100644 --- a/goodies/source/filter.vcl/eos2met/eos2met.cxx +++ b/goodies/source/filter.vcl/eos2met/eos2met.cxx @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include "strings.hrc" #include "dlgeos2.hxx" diff --git a/goodies/source/filter.vcl/epbm/epbm.cxx b/goodies/source/filter.vcl/epbm/epbm.cxx index 92aeb501e141..a624e7f45cfb 100644 --- a/goodies/source/filter.vcl/epbm/epbm.cxx +++ b/goodies/source/filter.vcl/epbm/epbm.cxx @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include "strings.hrc" diff --git a/goodies/source/filter.vcl/epgm/epgm.cxx b/goodies/source/filter.vcl/epgm/epgm.cxx index b6056339f11e..32d6e74a5cfe 100644 --- a/goodies/source/filter.vcl/epgm/epgm.cxx +++ b/goodies/source/filter.vcl/epgm/epgm.cxx @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include "strings.hrc" diff --git a/goodies/source/filter.vcl/epict/epict.cxx b/goodies/source/filter.vcl/epict/epict.cxx index 4df7abea01fc..e176be21d6bb 100644 --- a/goodies/source/filter.vcl/epict/epict.cxx +++ b/goodies/source/filter.vcl/epict/epict.cxx @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include diff --git a/goodies/source/filter.vcl/eppm/eppm.cxx b/goodies/source/filter.vcl/eppm/eppm.cxx index 8cd71176e31b..d17b4f7777ae 100644 --- a/goodies/source/filter.vcl/eppm/eppm.cxx +++ b/goodies/source/filter.vcl/eppm/eppm.cxx @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include "strings.hrc" diff --git a/goodies/source/filter.vcl/eps/eps.cxx b/goodies/source/filter.vcl/eps/eps.cxx index 8a163659050a..dc8e407b178e 100644 --- a/goodies/source/filter.vcl/eps/eps.cxx +++ b/goodies/source/filter.vcl/eps/eps.cxx @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/goodies/source/filter.vcl/etiff/etiff.cxx b/goodies/source/filter.vcl/etiff/etiff.cxx index 12289cb8f0a9..3cdec42d0978 100644 --- a/goodies/source/filter.vcl/etiff/etiff.cxx +++ b/goodies/source/filter.vcl/etiff/etiff.cxx @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include diff --git a/goodies/source/filter.vcl/ipcd/ipcd.cxx b/goodies/source/filter.vcl/ipcd/ipcd.cxx index f70d1c8b84c5..f7a5f3652cbf 100644 --- a/goodies/source/filter.vcl/ipcd/ipcd.cxx +++ b/goodies/source/filter.vcl/ipcd/ipcd.cxx @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include //============================ PCDReader ================================== diff --git a/goodies/source/inv/invader.cxx b/goodies/source/inv/invader.cxx index be15ff2e75d4..0aed6e76848f 100644 --- a/goodies/source/inv/invader.cxx +++ b/goodies/source/inv/invader.cxx @@ -37,7 +37,7 @@ #include "invader.hrc" #include "strings.hrc" #include "score.hxx" -#include +#include #include #include #include diff --git a/goodies/source/unographic/descriptor.cxx b/goodies/source/unographic/descriptor.cxx index e75b008cfb69..c19318d6e11e 100644 --- a/goodies/source/unographic/descriptor.cxx +++ b/goodies/source/unographic/descriptor.cxx @@ -37,7 +37,7 @@ #include #include #include -#include +#include #ifndef _COM_SUN_STAR_BEANS_PROPERTYSTATE_HDL_ #include diff --git a/goodies/source/unographic/provider.cxx b/goodies/source/unographic/provider.cxx index 2eb0aede9bdf..1f7de99d4473 100644 --- a/goodies/source/unographic/provider.cxx +++ b/goodies/source/unographic/provider.cxx @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/goodies/source/unographic/renderer.cxx b/goodies/source/unographic/renderer.cxx index 78f006cc69be..d280ed832999 100644 --- a/goodies/source/unographic/renderer.cxx +++ b/goodies/source/unographic/renderer.cxx @@ -48,7 +48,7 @@ #include #include -#include +#include #include "grfmgr.hxx" #include "graphic.hxx" #include "renderer.hxx" diff --git a/goodies/source/unographic/transformer.cxx b/goodies/source/unographic/transformer.cxx index 4422d161d7c4..7e18c10cdd41 100644 --- a/goodies/source/unographic/transformer.cxx +++ b/goodies/source/unographic/transformer.cxx @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/svl/inc/svl/bintitem.hxx b/svl/inc/svl/bintitem.hxx deleted file mode 100644 index 4c969c0a29c7..000000000000 --- a/svl/inc/svl/bintitem.hxx +++ /dev/null @@ -1,88 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: bintitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BINTITEM_HXX -#define _BINTITEM_HXX - -#include -#include -#include -#include - -#include - -class SfxArguments; -class SvStream; - -DBG_NAMEEX(SfxBigIntItem) - -class SfxBigIntItem: public SfxPoolItem -{ - BigInt aVal; - -public: - TYPEINFO(); - SfxBigIntItem(); - SfxBigIntItem(USHORT nWhich, const BigInt& rValue); - SfxBigIntItem(USHORT nWhich, SvStream &); - SfxBigIntItem(const SfxBigIntItem&); - ~SfxBigIntItem() { DBG_DTOR(SfxBigIntItem, 0); } - - virtual SfxItemPresentation GetPresentation( - SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper * = 0 ) const; - - virtual int operator==(const SfxPoolItem&) const; - using SfxPoolItem::Compare; - virtual int Compare(const SfxPoolItem &rWith) const; - virtual SfxPoolItem* Clone(SfxItemPool *pPool = 0) const; - virtual SfxPoolItem* Create(SvStream &, USHORT nVersion) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; - - virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; - - virtual SfxFieldUnit GetUnit() const; // FUNIT_NONE - - const BigInt& GetValue() const { return aVal; } - void SetValue(const BigInt& rNewVal) - { - DBG_ASSERT(GetRefCount() == 0, "SetValue() with pooled item"); - aVal = rNewVal; - } -}; - -#endif /* _BINTITEM_HXX */ - diff --git a/svl/inc/svl/ctloptions.hxx b/svl/inc/svl/ctloptions.hxx index 10fc4bb98446..28b2191cad94 100644 --- a/svl/inc/svl/ctloptions.hxx +++ b/svl/inc/svl/ctloptions.hxx @@ -40,8 +40,7 @@ class SvtCTLOptions_Impl; // class SvtCTLOptions -------------------------------------------------------- -class SVL_DLLPUBLIC SvtCTLOptions: - public utl::detail::Options, public SfxBroadcaster, public SfxListener +class SVL_DLLPUBLIC SvtCTLOptions : public utl::detail::Options { private: SvtCTLOptions_Impl* m_pImp; @@ -52,8 +51,6 @@ public: SvtCTLOptions( sal_Bool bDontLoad = sal_False ); virtual ~SvtCTLOptions(); - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - void SetCTLFontEnabled( sal_Bool _bEnabled ); sal_Bool IsCTLFontEnabled() const; diff --git a/svl/inc/svl/dateitem.hxx b/svl/inc/svl/dateitem.hxx new file mode 100644 index 000000000000..c66c9a84285d --- /dev/null +++ b/svl/inc/svl/dateitem.hxx @@ -0,0 +1,109 @@ + /************************************************************************* + * + * 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 + * + * $RCSfile: dateitem.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _DATETIMEITEM_HXX +#define _DATETIMEITEM_HXX + +#include +#include + +#include + +class SvStream; + +DBG_NAMEEX(SfxDateTimeItem) + +// class SfxDateTimeItem ------------------------------------------------- + +class SfxDateTimeItem : public SfxPoolItem +{ +private: + DateTime aDateTime; + +public: + TYPEINFO(); + + SfxDateTimeItem( USHORT nWhich ); + SfxDateTimeItem( USHORT nWhich, + const DateTime& rDT ); + SfxDateTimeItem( const SfxDateTimeItem& rCpy ); + + ~SfxDateTimeItem() { + DBG_DTOR(SfxDateTimeItem, 0); } + + virtual int operator==( const SfxPoolItem& ) const; + using SfxPoolItem::Compare; + virtual int Compare( const SfxPoolItem &rWith ) const; + virtual SfxPoolItem* Create( SvStream&, USHORT nItemVersion ) const; + virtual SvStream& Store( SvStream&, USHORT nItemVersion ) const; + virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + XubString &rText, + const IntlWrapper * pIntlWrapper = 0 ) + const; + + const DateTime& GetDateTime() const { return aDateTime; } + void SetDateTime( const DateTime& rDT ) { + DBG_ASSERT( GetRefCount() == 0, + "SetDateTime() with pooled item" ); + aDateTime = rDT; } + + virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ); + virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, + BYTE nMemberId = 0 ) const; +}; + +class SfxColumnDateTimeItem : public SfxDateTimeItem +{ +public: + TYPEINFO(); + + SfxColumnDateTimeItem( USHORT nWhich ); + SfxColumnDateTimeItem( USHORT nWhich, + const DateTime& rDT ); + SfxColumnDateTimeItem( const SfxDateTimeItem& rCpy ); + + ~SfxColumnDateTimeItem() {} + + virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; + + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + XubString &rText, + const IntlWrapper * pIntlWrapper = 0 ) + const; +}; + +#endif + diff --git a/svl/inc/svl/dtritem.hxx b/svl/inc/svl/dtritem.hxx deleted file mode 100644 index 406cc5ee6af1..000000000000 --- a/svl/inc/svl/dtritem.hxx +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: dtritem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _DTRITEM_HXX -#define _DTRITEM_HXX - -#include -#include - -#include - -class SvStream; - -DBG_NAMEEX(SfxDateTimeRangeItem) - -// class SfxDateTimeRangeItem ------------------------------------------------- - -class SfxDateTimeRangeItem : public SfxPoolItem -{ -private: - DateTime aStartDateTime; - DateTime aEndDateTime; - -public: - TYPEINFO(); - - SfxDateTimeRangeItem( const SfxDateTimeRangeItem& rCpy ); - SfxDateTimeRangeItem( USHORT nWhich ); - SfxDateTimeRangeItem( USHORT nWhich, const DateTime& rStartDT, - const DateTime& rEndDT ); - - ~SfxDateTimeRangeItem() - { DBG_DTOR(SfxDateTimeRangeItem, 0); } - - virtual int operator==( const SfxPoolItem& ) const; - using SfxPoolItem::Compare; - virtual int Compare( const SfxPoolItem &rWith ) const; - virtual SfxPoolItem* Create( SvStream&, USHORT nItemVersion ) const; - virtual SvStream& Store( SvStream&, USHORT nItemVersion ) const; - virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper * pIntlWrapper = 0 ) - const; - - virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; - - const DateTime& GetStartDateTime() const { return aStartDateTime; } - const DateTime& GetEndDateTime() const { return aEndDateTime; } - - void SetStartDateTime( const DateTime& rDT ) - { DBG_ASSERT( GetRefCount() == 0, "SetDateTime() with pooled item" ); - aStartDateTime = rDT; } - - void SetEndDateTime( const DateTime& rDT ) - { DBG_ASSERT( GetRefCount() == 0, "SetDateTime() with pooled item" ); - aEndDateTime = rDT; } -}; - -#endif - diff --git a/svl/inc/svl/frqitem.hxx b/svl/inc/svl/frqitem.hxx deleted file mode 100644 index 8d11c20610e2..000000000000 --- a/svl/inc/svl/frqitem.hxx +++ /dev/null @@ -1,178 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: frqitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _FRQITEM_HXX -#define _FRQITEM_HXX - -#include -#include -#include -#include - -#include - -class SvStream; - -DBG_NAMEEX(SfxFrequencyItem) - -// class SfxFrequencyItem ------------------------------------------------- - -/////////////////////////////////////////////////////////////////////////////// -/* -FRQ_DAILY - * jeden X'ten Tag - nInterval1 = 1 .. 999 - - * jeden Wochentag - nInterval1 = USHRT_MAX - -FRQ_WEEKLY - + wiederhole jede X'te Woche - nInterval1 = 1 .. 99 - - + an SU, MO, TU, WE, TH, FR, SA - nInterval2 = WD_SUNDAY | WD_MONDAY | WD_TUESDAY | WD_WEDNESDAY | - WD_THURSDAY | WD_FRIDAY | WD_SATURDAY - -FRQ_MONTHLY_DAILY - * jeden X'ten Tag von jedem X'ten Monat - nInterval1 = 1 .. 31 - nInterval2 = 1 .. 6 - -FRQ_MONTHLY_LOGIC - * jeden ersten, zweiten, dritten, vierten oder letzten Wochentag jeden X'ten Monats - nInterval1 = 0 .. 4 - nInterval2 = WD_SUNDAY | WD_MONDAY | WD_TUESDAY | WD_WEDNESDAY | - WD_THURSDAY | WD_FRIDAY | WD_SATURDAY - nInterval3 = 1 .. 6 - -=============================================================================== - -FRQ_TIME_AT - * Update um Uhrzeit - nTime1 = 00:00:00 - 24:00:00 - -FRQ_TIME_REPEAT - * Wiederhole alle X Stunden - nTInterval1 = 1 .. 8 - + zwischen Uhrzeit 1 und 2 - nTime1 = 00:00:00 - 24:00:00 - nTime2 = 00:00:00 - 24:00:00 - -*/ -/////////////////////////////////////////////////////////////////////////////// - -enum FrequencyMode -{ - FRQ_DAILY = 1, - FRQ_WEEKLY = 2, - FRQ_MONTHLY_DAILY = 3, - FRQ_MONTHLY_LOGIC = 4 -}; - -enum FrequencyTimeMode -{ - FRQ_TIME_AT = 1, - FRQ_TIME_REPEAT = 2, - FRQ_TIME_REPEAT_RANGE = 3 -}; - -#define WD_SUNDAY 0x0001 -#define WD_MONDAY 0x0002 -#define WD_TUESDAY 0x0004 -#define WD_WEDNESDAY 0x0008 -#define WD_THURSDAY 0x0010 -#define WD_FRIDAY 0x0020 -#define WD_SATURDAY 0x0040 - -class SfxFrequencyItem : public SfxPoolItem -{ -private: - FrequencyMode eFrqMode; - FrequencyTimeMode eFrqTimeMode; - - USHORT nDInterval1; - USHORT nDInterval2; - USHORT nDInterval3; - - USHORT nTInterval1; - Time aTime1; - Time aTime2; - - BOOL bMissingDate; - DateTime aMissingDate; - - Time _CalcTime( BOOL bForToday ) const; -public: - TYPEINFO(); - - SfxFrequencyItem( const SfxFrequencyItem& rCpy ); - SfxFrequencyItem( USHORT nWhich ); - SfxFrequencyItem( USHORT nWhich, FrequencyMode eMode, FrequencyTimeMode eTMode, - USHORT nDI1, USHORT nDI2, USHORT nDI3, USHORT nTI1, - const Time& rT1, const Time& rT2 ); - ~SfxFrequencyItem() { DBG_DTOR(SfxFrequencyItem, 0); } - - virtual int operator==( const SfxPoolItem& ) const; - using SfxPoolItem::Compare; - virtual int Compare( const SfxPoolItem &rWith ) const; - virtual SfxPoolItem* Create( SvStream&, USHORT nItemVersion ) const; - virtual SvStream& Store( SvStream&, USHORT nItemVersion ) const; - virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, XubString &rText, - const IntlWrapper * = 0 ) const; - - DateTime CalcNextTick( const DateTime& rNow, BOOL bFirst = FALSE ); - - BOOL HasMissingDate() const { return bMissingDate; } - DateTime GetMissingDate() const { return aMissingDate; } - - FrequencyMode GetFrequencyMode() const { return eFrqMode; } - FrequencyTimeMode GetFrequencyTimeMode() const { return eFrqTimeMode; } - USHORT GetDInterval_1() const { return nDInterval1; } - USHORT GetDInterval_2() const { return nDInterval2; } - USHORT GetDInterval_3() const { return nDInterval3; } - USHORT GetTInterval_1() const { return nTInterval1; } - const Time& GetTime_1() const { return aTime1; } - const Time& GetTime_2() const { return aTime2; } - - void SetFrequencyMode(FrequencyMode eNew) { eFrqMode = eNew; } - void SetFrequencyTimeMode(FrequencyTimeMode eNew){ eFrqTimeMode = eNew; } - void SetDInterval_1(USHORT nNew) { nDInterval1 = nNew; } - void SetDInterval_2(USHORT nNew) { nDInterval2 = nNew; } - void SetDInterval_3(USHORT nNew) { nDInterval3 = nNew; } - void SetTInterval_1(USHORT nNew) { nTInterval1 = nNew; } - void SetTime_1(const Time& rNew) { aTime1 = rNew; } - void SetTime_2(const Time& rNew) { aTime2 = rNew; } -}; - -#endif - diff --git a/svl/inc/svl/languageoptions.hxx b/svl/inc/svl/languageoptions.hxx index 77682ce69765..0cba5235674a 100644 --- a/svl/inc/svl/languageoptions.hxx +++ b/svl/inc/svl/languageoptions.hxx @@ -35,6 +35,7 @@ #include #include #include +#include #include // class SvtLanguageOptions ---------------------------------------------------- @@ -47,7 +48,7 @@ class SvtCJKOptions; class SvtCTLOptions; -class SVL_DLLPUBLIC SvtLanguageOptions : public SfxBroadcaster, public SfxListener +class SVL_DLLPUBLIC SvtLanguageOptions : public ::utl::detail::Options { private: SvtCJKOptions* m_pCJKOptions; @@ -78,8 +79,6 @@ public: SvtLanguageOptions( sal_Bool _bDontLoad = sal_False ); ~SvtLanguageOptions(); - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - // CJK options sal_Bool IsCJKFontEnabled() const; sal_Bool IsVerticalTextEnabled() const; @@ -123,6 +122,7 @@ public: ~SvtSystemLanguageOptions(); virtual void Commit(); + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames ); LanguageType GetWin16SystemLanguage(); }; diff --git a/svl/inc/svl/svtools.hrc b/svl/inc/svl/svtools.hrc index 60095caa8784..e4cc91cfcb49 100644 --- a/svl/inc/svl/svtools.hrc +++ b/svl/inc/svl/svtools.hrc @@ -90,6 +90,7 @@ #define STR_SVT_SAMPLES_HELP (RID_SVTOOLS_START+66) #define STR_WARNING_ITEM (RID_SVTOOLS_START+90) +#define STR_COLUM_DT_AUTO (RID_SVTOOLS_START+99) #define CONFIG_BASIC_FORMAT_START (RID_SVTOOLS_START+102) #define STR_BASICKEY_FORMAT_ON (RID_SVTOOLS_START+103) diff --git a/svl/inc/svl/tfrmitem.hxx b/svl/inc/svl/tfrmitem.hxx deleted file mode 100644 index 82f08eccdf24..000000000000 --- a/svl/inc/svl/tfrmitem.hxx +++ /dev/null @@ -1,90 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: tfrmitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _TFRMITEM_HXX -#define _TFRMITEM_HXX - -#include - -#include - -class SvStream; - -enum SfxOpenMode -{ - SfxOpenSelect = 0, // selected in view - SfxOpenOpen = 1, // doubleclicked or - SfxOpenAddTask = 2, // doubleclicked or with Ctrl-Modifier - SfxOpenDontKnow = 3, - SfxOpenReserved1 = 4, - SfxOpenReserved2 = 5, - SfxOpenModeLast = 5 -}; - -DBG_NAMEEX(SfxTargetFrameItem) - -// class SfxTargetFrameItem ------------------------------------------------- - -class SfxTargetFrameItem : public SfxPoolItem -{ -private: - String _aFrames[ (USHORT)SfxOpenModeLast+1 ]; -public: - TYPEINFO(); - - SfxTargetFrameItem( const SfxTargetFrameItem& rCpy ); - SfxTargetFrameItem( USHORT nWhich ); - SfxTargetFrameItem( - USHORT nWhich, - const String& rOpenSelectFrame, - const String& rOpenOpenFrame, - const String& rOpenAddTaskFrame ); - ~SfxTargetFrameItem(); - - virtual int operator==( const SfxPoolItem& ) const; - virtual SfxPoolItem* Create( SvStream&, USHORT nItemVersion ) const; - virtual SvStream& Store( SvStream&, USHORT nItemVersion ) const; - virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; - - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; - virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); - /* - Framebezeichner im Sfx: - _browser : Beamerview - _document : Desktopview - _blank : new task - "" : do nothing - */ - String GetTargetFrame( SfxOpenMode eMode ) const; -}; - -#endif - diff --git a/svl/inc/svl/tresitem.hxx b/svl/inc/svl/tresitem.hxx deleted file mode 100644 index c0254a1bf1fc..000000000000 --- a/svl/inc/svl/tresitem.hxx +++ /dev/null @@ -1,65 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: tresitem.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SVTOOLS_TRESITEM_HXX -#define SVTOOLS_TRESITEM_HXX - -#include -#include - -//============================================================================ -class CntTransferResultItem: public SfxPoolItem -{ - com::sun::star::ucb::TransferResult m_aResult; - -public: - TYPEINFO(); - - CntTransferResultItem(USHORT which = 0): SfxPoolItem(which) {} - - CntTransferResultItem(USHORT which, - com::sun::star::ucb::TransferResult const & - rTheResult): - SfxPoolItem(which), m_aResult(rTheResult) {} - - virtual int operator ==(SfxPoolItem const & rItem) const; - - virtual BOOL QueryValue(com::sun::star::uno::Any & rVal, BYTE = 0) const; - - virtual BOOL PutValue(const com::sun::star::uno::Any & rVal, BYTE = 0); - - virtual SfxPoolItem * Clone(SfxItemPool * = 0) const; - - com::sun::star::ucb::TransferResult const & GetValue() const - { return m_aResult; } -}; - -#endif // SVTOOLS_TRESITEM_HXX - diff --git a/svl/prj/d.lst b/svl/prj/d.lst index e32ffa624397..a5c2564e81cd 100644 --- a/svl/prj/d.lst +++ b/svl/prj/d.lst @@ -1,6 +1,6 @@ mkdir: %COMMON_DEST%\bin%_EXT%\hid mkdir: %COMMON_DEST%\res%_EXT% -mkdir: %_DEST%\inc%_EXT%\svtools +mkdir: %_DEST%\inc%_EXT%\svl ..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid ..\%__SRC%\lib\isvl.lib %_DEST%\lib%_EXT%\isvl.lib @@ -9,12 +9,12 @@ mkdir: %_DEST%\inc%_EXT%\svtools ..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\* ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\* -..\inc\svl\*.hrc %_DEST%\inc%_EXT%\svtools\*.hrc -..\inc\svl\*.hxx %_DEST%\inc%_EXT%\svtools\*.hxx -..\inc\svl\*.h %_DEST%\inc%_EXT%\svtools\*.h -..\inc\*.hrc %_DEST%\inc%_EXT%\svtools\*.hrc -..\inc\*.hxx %_DEST%\inc%_EXT%\svtools\*.hxx -..\inc\*.h %_DEST%\inc%_EXT%\svtools\*.h +..\inc\svl\*.hrc %_DEST%\inc%_EXT%\svl\*.hrc +..\inc\svl\*.hxx %_DEST%\inc%_EXT%\svl\*.hxx +..\inc\svl\*.h %_DEST%\inc%_EXT%\svl\*.h +..\inc\*.hrc %_DEST%\inc%_EXT%\svl\*.hrc +..\inc\*.hxx %_DEST%\inc%_EXT%\svl\*.hxx +..\inc\*.h %_DEST%\inc%_EXT%\svl\*.h dos: sh -c "if test %OS% = MACOSX; then macosx-create-bundle %_DEST%\bin%_EXT%\bmp=%__PRJROOT%\%__SRC%\bin%_EXT%; fi" diff --git a/svl/source/config/cjkoptions.cxx b/svl/source/config/cjkoptions.cxx index 7ce2a45ce7a0..c149c91c86f5 100644 --- a/svl/source/config/cjkoptions.cxx +++ b/svl/source/config/cjkoptions.cxx @@ -168,6 +168,7 @@ void SvtCJKOptions_Impl::SetAll(sal_Bool bSet) SetModified(); Commit(); + NotifyListeners(0); } } /*-- 10.04.01 12:41:56--------------------------------------------------- @@ -240,6 +241,7 @@ void SvtCJKOptions_Impl::Load() void SvtCJKOptions_Impl::Notify( const Sequence< OUString >& ) { Load(); + NotifyListeners(0); } /*-- 10.04.01 12:41:57--------------------------------------------------- diff --git a/svl/source/config/ctloptions.cxx b/svl/source/config/ctloptions.cxx index a63944140672..a776bc4b807c 100644 --- a/svl/source/config/ctloptions.cxx +++ b/svl/source/config/ctloptions.cxx @@ -43,7 +43,6 @@ #include #include #include -#include #include #include @@ -55,7 +54,7 @@ using namespace ::com::sun::star::uno; // SvtCJKOptions_Impl ---------------------------------------------------------- -class SvtCTLOptions_Impl : public utl::ConfigItem, public SfxBroadcaster +class SvtCTLOptions_Impl : public utl::ConfigItem { private: sal_Bool m_bIsLoaded; @@ -155,7 +154,7 @@ SvtCTLOptions_Impl::~SvtCTLOptions_Impl() void SvtCTLOptions_Impl::Notify( const Sequence< rtl::OUString >& ) { Load(); - Broadcast(SfxSimpleHint(SFX_HINT_CTL_SETTINGS_CHANGED)); + NotifyListeners(SFX_HINT_CTL_SETTINGS_CHANGED); } // ----------------------------------------------------------------------------- void SvtCTLOptions_Impl::Commit() @@ -247,7 +246,7 @@ void SvtCTLOptions_Impl::Commit() aValues.realloc(nRealCount); PutProperties( aNames, aValues ); //broadcast changes - Broadcast(SfxSimpleHint(SFX_HINT_CTL_SETTINGS_CHANGED)); + NotifyListeners(SFX_HINT_CTL_SETTINGS_CHANGED); } // ----------------------------------------------------------------------------- void SvtCTLOptions_Impl::Load() @@ -325,6 +324,7 @@ void SvtCTLOptions_Impl::SetCTLFontEnabled( sal_Bool _bEnabled ) { m_bCTLFontEnabled = _bEnabled; SetModified(); + NotifyListeners(0); } } //------------------------------------------------------------------------------ @@ -334,6 +334,7 @@ void SvtCTLOptions_Impl::SetCTLSequenceChecking( sal_Bool _bEnabled ) { SetModified(); m_bCTLSequenceChecking = _bEnabled; + NotifyListeners(0); } } //------------------------------------------------------------------------------ @@ -343,6 +344,7 @@ void SvtCTLOptions_Impl::SetCTLSequenceCheckingRestricted( sal_Bool _bEnabled ) { SetModified(); m_bCTLRestricted = _bEnabled; + NotifyListeners(0); } } //------------------------------------------------------------------------------ @@ -352,6 +354,7 @@ void SvtCTLOptions_Impl::SetCTLSequenceCheckingTypeAndReplace( sal_Bool _bEnabl { SetModified(); m_bCTLTypeAndReplace = _bEnabled; + NotifyListeners(0); } } //------------------------------------------------------------------------------ @@ -361,6 +364,7 @@ void SvtCTLOptions_Impl::SetCTLCursorMovement( SvtCTLOptions::CursorMovement _eM { SetModified(); m_eCTLCursorMovement = _eMovement; + NotifyListeners(0); } } //------------------------------------------------------------------------------ @@ -370,6 +374,7 @@ void SvtCTLOptions_Impl::SetCTLTextNumerals( SvtCTLOptions::TextNumerals _eNumer { SetModified(); m_eCTLTextNumerals = _eNumerals; + NotifyListeners(0); } } // global ---------------------------------------------------------------- @@ -394,7 +399,7 @@ SvtCTLOptions::SvtCTLOptions( sal_Bool bDontLoad ) ++nCTLRefCount; m_pImp = pCTLOptions; - StartListening( *m_pImp); + m_pImp->AddListener(this); } // ----------------------------------------------------------------------- @@ -404,6 +409,7 @@ SvtCTLOptions::~SvtCTLOptions() // Global access, must be guarded (multithreading) ::osl::MutexGuard aGuard( CTLMutex::get() ); + m_pImp->RemoveListener(this); if ( !--nCTLRefCount ) DELETEZ( pCTLOptions ); } @@ -485,17 +491,5 @@ sal_Bool SvtCTLOptions::IsReadOnly(EOption eOption) const DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); return pCTLOptions->IsReadOnly(eOption); } -/* -----------------30.04.2003 10:40----------------- - - --------------------------------------------------*/ -void SvtCTLOptions::Notify( SfxBroadcaster&, const SfxHint& rHint ) -{ - if ( ::tools::SolarMutex::Acquire() ) - { - Broadcast( rHint ); - ::tools::SolarMutex::Release(); - } -} - // ----------------------------------------------------------------------------- diff --git a/svl/source/config/languageoptions.cxx b/svl/source/config/languageoptions.cxx index 20a74bbba28a..f16c0b6add49 100644 --- a/svl/source/config/languageoptions.cxx +++ b/svl/source/config/languageoptions.cxx @@ -39,7 +39,6 @@ #include #include #include -#include #include using namespace ::com::sun::star; @@ -56,7 +55,8 @@ SvtLanguageOptions::SvtLanguageOptions( sal_Bool _bDontLoad ) m_pCJKOptions = new SvtCJKOptions( _bDontLoad ); m_pCTLOptions = new SvtCTLOptions( _bDontLoad ); - StartListening(*m_pCTLOptions); + m_pCTLOptions->AddListener(this); + m_pCJKOptions->AddListener(this); } //------------------------------------------------------------------------------ SvtLanguageOptions::~SvtLanguageOptions() @@ -64,6 +64,9 @@ SvtLanguageOptions::~SvtLanguageOptions() // Global access, must be guarded (multithreading) ::osl::MutexGuard aGuard( ALMutex::get() ); + m_pCTLOptions->RemoveListener(this); + m_pCJKOptions->RemoveListener(this); + delete m_pCJKOptions; delete m_pCTLOptions; } @@ -200,19 +203,8 @@ sal_Bool SvtLanguageOptions::IsReadOnly(SvtLanguageOptions::EOption eOption) con } return bReadOnly; } -/* -----------------30.04.2003 11:03----------------- - - --------------------------------------------------*/ -void SvtLanguageOptions::Notify( SfxBroadcaster&, const SfxHint& rHint ) -{ - if ( ::tools::SolarMutex::Acquire() ) - { - Broadcast( rHint ); - ::tools::SolarMutex::Release(); - } -} +/* -----------------30.04.2003 11:03-----------------*/ -// ----------------------------------------------------------------------------- // returns for a language the scripttype sal_uInt16 SvtLanguageOptions::GetScriptTypeOfLanguage( sal_uInt16 nLang ) { @@ -268,6 +260,12 @@ void SvtSystemLanguageOptions::Commit() { //does nothing } + +void SvtSystemLanguageOptions::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& ) +{ + // no listeners supported yet +} + /*-- 27.10.2005 08:36:14--------------------------------------------------- -----------------------------------------------------------------------*/ diff --git a/svl/source/items/bintitem.cxx b/svl/source/items/bintitem.cxx deleted file mode 100644 index 5236f36504f8..000000000000 --- a/svl/source/items/bintitem.cxx +++ /dev/null @@ -1,169 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: bintitem.cxx,v $ - * $Revision: 1.8 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svl.hxx" -#include -#include -#include -#include - -// STATIC DATA - -DBG_NAME(SfxBigIntItem) - -// RTTI -TYPEINIT1_AUTOFACTORY(SfxBigIntItem, SfxPoolItem); - -// SfxBigIntItem - -//============================================================================ -SfxBigIntItem::SfxBigIntItem() - : SfxPoolItem(0), - aVal(0) -{ - DBG_CTOR(SfxBigIntItem, 0); -} - -//============================================================================ -SfxBigIntItem::SfxBigIntItem(USHORT which, const BigInt& rValue) - : SfxPoolItem(which), - aVal(rValue) -{ - DBG_CTOR(SfxBigIntItem, 0); -} - -//============================================================================ -SfxBigIntItem::SfxBigIntItem(USHORT which, SvStream &rStream) - : SfxPoolItem(which) -{ - DBG_CTOR(SfxBigIntItem, 0); - ByteString sTmp; - rStream.ReadByteString(sTmp); - BigInt aTmp(sTmp); - aVal = aTmp; -} - -//============================================================================ -SfxBigIntItem::SfxBigIntItem(const SfxBigIntItem& rItem) - : SfxPoolItem(rItem), - aVal(rItem.aVal) -{ - DBG_CTOR(SfxBigIntItem, 0); -} - -//============================================================================ -SfxItemPresentation SfxBigIntItem::GetPresentation( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * ) const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - rText = aVal.GetString(); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -//============================================================================ -int SfxBigIntItem::operator==(const SfxPoolItem& rItem) const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - DBG_ASSERT(SfxPoolItem::operator==(rItem), "unequal type"); - return ((SfxBigIntItem&)rItem).aVal == aVal; -} - -//============================================================================ -int SfxBigIntItem::Compare(const SfxPoolItem& rItem) const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - DBG_ASSERT(SfxPoolItem::operator==(rItem), "unequal type"); - - if (((const SfxBigIntItem&)rItem ).aVal < aVal ) - return -1; - else if (((const SfxBigIntItem&)rItem ).aVal == aVal) - return 0; - else - return 1; -} - -//============================================================================ -SfxPoolItem* SfxBigIntItem::Clone(SfxItemPool *) const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - return new SfxBigIntItem(*this); -} - -//============================================================================ -SfxPoolItem* SfxBigIntItem::Create(SvStream &rStream, USHORT) const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - return new SfxBigIntItem(Which(), rStream); -} - -//============================================================================ -SvStream& SfxBigIntItem::Store(SvStream &rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - rStream.WriteByteString( aVal.GetByteString() ); - return rStream; -} - -//============================================================================ -SfxFieldUnit SfxBigIntItem::GetUnit() const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - return SFX_FUNIT_NONE; -} - -//============================================================================ -// virtual -BOOL SfxBigIntItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE ) -{ - double aValue = 0.0; - if ( rVal >>= aValue ) - { - SetValue( aValue ); - return TRUE; - } - - DBG_ERROR( "SfxBigIntItem::PutValue - Wrong type!" ); - return FALSE; -} - -//============================================================================ -// virtual -BOOL SfxBigIntItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE ) const -{ - double aValue = GetValue(); - rVal <<= aValue; - return TRUE; -} - diff --git a/svl/source/items/cstitem.src b/svl/source/items/cstitem.src new file mode 100644 index 000000000000..54951dd3761e --- /dev/null +++ b/svl/source/items/cstitem.src @@ -0,0 +1,72 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: cstitem.src,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include +String STR_COLUM_DT_AUTO +{ + Text [ en-US ] = "automatic" ; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/svl/source/items/dateitem.cxx b/svl/source/items/dateitem.cxx new file mode 100644 index 000000000000..d5989d4b7a2b --- /dev/null +++ b/svl/source/items/dateitem.cxx @@ -0,0 +1,286 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: dateitem.cxx,v $ + * $Revision: 1.8 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svl.hxx" + +// include --------------------------------------------------------------- + +#define _DATETIMEITEM_CXX +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + + +#include + +#include + +// STATIC DATA ----------------------------------------------------------- + +DBG_NAME(SfxDateTimeItem) + + +// ----------------------------------------------------------------------- + +TYPEINIT1(SfxDateTimeItem, SfxPoolItem); + +// ----------------------------------------------------------------------- + +SfxDateTimeItem::SfxDateTimeItem( USHORT which ) : + SfxPoolItem( which ) +{ + DBG_CTOR(SfxDateTimeItem, 0); +} + +// ----------------------------------------------------------------------- + +SfxDateTimeItem::SfxDateTimeItem( USHORT which, const DateTime& rDT ) : + SfxPoolItem( which ), + aDateTime( rDT ) + +{ + DBG_CTOR(SfxDateTimeItem, 0); +} + +// ----------------------------------------------------------------------- + +SfxDateTimeItem::SfxDateTimeItem( const SfxDateTimeItem& rItem ) : + SfxPoolItem( rItem ), + aDateTime( rItem.aDateTime ) +{ + DBG_CTOR(SfxDateTimeItem, 0); +} + +// ----------------------------------------------------------------------- + +int SfxDateTimeItem::operator==( const SfxPoolItem& rItem ) const +{ + DBG_CHKTHIS(SfxDateTimeItem, 0); + DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); + return ( ( (SfxDateTimeItem&)rItem ).aDateTime == aDateTime ); +} + +// ----------------------------------------------------------------------- + +int SfxDateTimeItem::Compare( const SfxPoolItem& rItem ) const +{ + DBG_CHKTHIS(SfxDateTimeItem, 0); + DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); + + // da X.Compare( Y ) am String einem Compare( Y, X ) entspricht, + // vergleichen wir hier Y mit X + if ( ( (const SfxDateTimeItem&)rItem ).aDateTime < aDateTime ) + return -1; + else if ( ( (const SfxDateTimeItem&)rItem ).aDateTime == aDateTime ) + return 0; + else + return 1; +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxDateTimeItem::Create( SvStream& rStream, USHORT ) const +{ + DBG_CHKTHIS(SfxDateTimeItem, 0); + sal_uInt32 nDate = 0; + sal_Int32 nTime = 0; + rStream >> nDate; + rStream >> nTime; + DateTime aDT(nDate, nTime); + return new SfxDateTimeItem( Which(), aDT ); +} + +// ----------------------------------------------------------------------- + +SvStream& SfxDateTimeItem::Store( SvStream& rStream, USHORT ) const +{ + DBG_CHKTHIS(SfxDateTimeItem, 0); + rStream << aDateTime.GetDate(); + rStream << aDateTime.GetTime(); + return rStream; +} + +// ----------------------------------------------------------------------- + +SfxPoolItem* SfxDateTimeItem::Clone( SfxItemPool* ) const +{ + DBG_CHKTHIS(SfxDateTimeItem, 0); + return new SfxDateTimeItem( *this ); +} + +// ----------------------------------------------------------------------- + +SfxItemPresentation SfxDateTimeItem::GetPresentation +( + SfxItemPresentation /*ePresentation*/, + SfxMapUnit /*eCoreMetric*/, + SfxMapUnit /*ePresentationMetric*/, + XubString& rText, + const IntlWrapper * pIntlWrapper +) const +{ + DBG_CHKTHIS(SfxDateTimeItem, 0); + if (aDateTime.IsValid()) + if (pIntlWrapper) + { + rText = pIntlWrapper->getLocaleData()->getDate(aDateTime); + rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + rText += pIntlWrapper->getLocaleData()->getTime(aDateTime); + } + else + { + DBG_WARNING("SfxDateTimeItem::GetPresentation():" + " Using default en_US IntlWrapper"); + const IntlWrapper aIntlWrapper( + ::comphelper::getProcessServiceFactory(), LANGUAGE_ENGLISH_US ); + rText = aIntlWrapper.getLocaleData()->getDate(aDateTime); + rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + rText += aIntlWrapper.getLocaleData()->getTime(aDateTime); + } + else + rText.Erase(); + return SFX_ITEM_PRESENTATION_NAMELESS; +} + +//---------------------------------------------------------------------------- +// virtual +BOOL SfxDateTimeItem::PutValue( const com::sun::star::uno::Any& rVal, + BYTE nMemberId ) +{ + nMemberId &= ~CONVERT_TWIPS; + com::sun::star::util::DateTime aValue; + if ( rVal >>= aValue ) + { + aDateTime = DateTime( Date( aValue.Day, + aValue.Month, + aValue.Year ), + Time( aValue.Hours, + aValue.Minutes, + aValue.Seconds, + aValue.HundredthSeconds ) ); + return TRUE; + } + + DBG_ERROR( "SfxDateTimeItem::PutValue - Wrong type!" ); + return FALSE; +} + +//---------------------------------------------------------------------------- +// virtual +BOOL SfxDateTimeItem::QueryValue( com::sun::star::uno::Any& rVal, + BYTE nMemberId ) const +{ + nMemberId &= ~CONVERT_TWIPS; + com::sun::star::util::DateTime aValue( aDateTime.Get100Sec(), + aDateTime.GetSec(), + aDateTime.GetMin(), + aDateTime.GetHour(), + aDateTime.GetDay(), + aDateTime.GetMonth(), + aDateTime.GetYear() ); + rVal <<= aValue; + return TRUE; +} + +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- + +TYPEINIT1(SfxColumnDateTimeItem, SfxDateTimeItem); + + +SfxColumnDateTimeItem::SfxColumnDateTimeItem( USHORT which ) : + SfxDateTimeItem( which ) +{} + +SfxColumnDateTimeItem::SfxColumnDateTimeItem( USHORT which, const DateTime& rDT ) : + SfxDateTimeItem( which, rDT ) +{} + +SfxColumnDateTimeItem::SfxColumnDateTimeItem( const SfxDateTimeItem& rCpy ) : + SfxDateTimeItem( rCpy ) +{} + +SfxPoolItem* SfxColumnDateTimeItem::Clone( SfxItemPool* ) const +{ + return new SfxColumnDateTimeItem( *this ); +} + +SfxItemPresentation SfxColumnDateTimeItem::GetPresentation +( + SfxItemPresentation /*ePresentation*/, + SfxMapUnit /*eCoreMetric*/, + SfxMapUnit /*ePresentationMetric*/, + XubString& rText, + const IntlWrapper * pIntlWrapper +) const +{ + DBG_ASSERT(pIntlWrapper, + "SfxColumnDateTimeItem::GetPresentation():" + " Using default en_US IntlWrapper"); + + ::com::sun::star::lang::Locale aLocale; + if (GetDateTime() == DateTime(Date(1, 2, 3), Time(3, 2, 1))) + { + rText = String(SvtSimpleResId(STR_COLUM_DT_AUTO, + pIntlWrapper ? + pIntlWrapper->getLocale() : + aLocale)); + } + else if (pIntlWrapper) + { + rText = pIntlWrapper->getLocaleData()->getDate(GetDateTime()); + rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + rText += pIntlWrapper->getLocaleData()->getTime(GetDateTime()); + } + else + { + const IntlWrapper aIntlWrapper( + ::comphelper::getProcessServiceFactory(), LANGUAGE_ENGLISH_US ); + rText = aIntlWrapper.getLocaleData()->getDate(GetDateTime()); + rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + rText += aIntlWrapper.getLocaleData()->getTime(GetDateTime()); + } + return SFX_ITEM_PRESENTATION_NAMELESS; +} + + + diff --git a/svl/source/items/dtritem.cxx b/svl/source/items/dtritem.cxx deleted file mode 100644 index 12d7828350bb..000000000000 --- a/svl/source/items/dtritem.cxx +++ /dev/null @@ -1,241 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: dtritem.cxx,v $ - * $Revision: 1.8 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svl.hxx" -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - - -DBG_NAME( SfxDateTimeRangeItem ) -TYPEINIT1( SfxDateTimeRangeItem, SfxPoolItem ); - -// ----------------------------------------------------------------------- - -SfxDateTimeRangeItem::SfxDateTimeRangeItem( USHORT which ) : - SfxPoolItem( which ) -{ - DBG_CTOR( SfxDateTimeRangeItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxDateTimeRangeItem::SfxDateTimeRangeItem( USHORT which, const DateTime& rStartDT, - const DateTime& rEndDT ) : - SfxPoolItem( which ), - aStartDateTime( rStartDT ), - aEndDateTime( rEndDT ) -{ - DBG_CTOR( SfxDateTimeRangeItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxDateTimeRangeItem::SfxDateTimeRangeItem( const SfxDateTimeRangeItem& rItem ) : - SfxPoolItem( rItem ), - aStartDateTime( rItem.aStartDateTime ), - aEndDateTime( rItem.aEndDateTime ) -{ - DBG_CTOR( SfxDateTimeRangeItem, 0 ); -} - -// ----------------------------------------------------------------------- - -int SfxDateTimeRangeItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS( SfxDateTimeRangeItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - return ((SfxDateTimeRangeItem&)rItem ).aStartDateTime == aStartDateTime && - ((SfxDateTimeRangeItem&)rItem ).aEndDateTime == aEndDateTime; -} - -// ----------------------------------------------------------------------- - -int SfxDateTimeRangeItem::Compare( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS( SfxDateTimeRangeItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - double fThisRange = aEndDateTime - aStartDateTime; - double fRange = ((const SfxDateTimeRangeItem&)rItem).aEndDateTime - - ((const SfxDateTimeRangeItem&)rItem).aStartDateTime; - - if ( ::rtl::math::approxEqual( fRange, fThisRange ) ) - return 0; - else if ( fRange < fThisRange ) - return -1; - else - return 1; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxDateTimeRangeItem::Create( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxDateTimeRangeItem, 0); - - sal_uInt32 nStartDate, nEndDate; - sal_Int32 nStartTime, nEndTime; - - rStream >> nStartDate; - rStream >> nStartTime; - - rStream >> nEndDate; - rStream >> nEndTime; - - DateTime aStartDT, aEndDT; - - aStartDT.SetDate( nStartDate ); - aStartDT.SetTime( nStartTime ); - - aEndDT.SetDate( nEndDate ); - aEndDT.SetTime( nEndTime ); - - return new SfxDateTimeRangeItem( Which(), aStartDT, aEndDT ); -} - -// ----------------------------------------------------------------------- - -SvStream& SfxDateTimeRangeItem::Store( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS( SfxDateTimeRangeItem, 0 ); - - rStream << aStartDateTime.GetDate(); - rStream << aStartDateTime.GetTime(); - - rStream << aEndDateTime.GetDate(); - rStream << aEndDateTime.GetTime(); - - return rStream; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxDateTimeRangeItem::Clone( SfxItemPool* ) const -{ - DBG_CHKTHIS( SfxDateTimeRangeItem, 0 ); - - return new SfxDateTimeRangeItem( *this ); -} -// ----------------------------------------------------------------------- - -SfxItemPresentation SfxDateTimeRangeItem::GetPresentation -( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * pIntlWrapper -) const -{ - DBG_CHKTHIS(SfxDateTimeRangeItem, 0); - DateTime aRange(aEndDateTime - (const Time&)aStartDateTime); - if (pIntlWrapper) - { - rText = pIntlWrapper->getLocaleData()->getDate(aRange); - rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); - rText += pIntlWrapper->getLocaleData()->getTime(aRange); - } - else - { - DBG_WARNING("SfxDateTimeRangeItem::GetPresentation():" - " Using default en_US IntlWrapper"); - const IntlWrapper aIntlWrapper( - ::comphelper::getProcessServiceFactory(), LANGUAGE_ENGLISH_US ); - rText = aIntlWrapper.getLocaleData()->getDate(aRange); - rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); - rText += aIntlWrapper.getLocaleData()->getTime(aRange); - } - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL SfxDateTimeRangeItem::PutValue( const com::sun::star::uno::Any& rVal,BYTE ) -{ - com::sun::star::util::DateTimeRange aValue; - if ( rVal >>= aValue ) - { - aStartDateTime = DateTime( Date( aValue.StartDay, - aValue.StartMonth, - aValue.StartYear ), - Time( aValue.StartHours, - aValue.StartMinutes, - aValue.StartSeconds, - aValue.StartHundredthSeconds ) ); - aEndDateTime = DateTime( Date( aValue.EndDay, - aValue.EndMonth, - aValue.EndYear ), - Time( aValue.EndHours, - aValue.EndMinutes, - aValue.EndSeconds, - aValue.EndHundredthSeconds ) ); - return TRUE; - } - - DBG_ERROR( "SfxDateTimeRangeItem::PutValue - Wrong type!" ); - return FALSE; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL SfxDateTimeRangeItem::QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId ) const -{ - nMemberId &= ~CONVERT_TWIPS; - com::sun::star::util::DateTimeRange aValue( aStartDateTime.Get100Sec(), - aStartDateTime.GetSec(), - aStartDateTime.GetMin(), - aStartDateTime.GetHour(), - aStartDateTime.GetDay(), - aStartDateTime.GetMonth(), - aStartDateTime.GetYear(), - aEndDateTime.Get100Sec(), - aEndDateTime.GetSec(), - aEndDateTime.GetMin(), - aEndDateTime.GetHour(), - aEndDateTime.GetDay(), - aEndDateTime.GetMonth(), - aEndDateTime.GetYear() ); - rVal <<= aValue; - return TRUE; -} - - diff --git a/svl/source/items/frqitem.cxx b/svl/source/items/frqitem.cxx deleted file mode 100644 index cfa1db17ef65..000000000000 --- a/svl/source/items/frqitem.cxx +++ /dev/null @@ -1,580 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: frqitem.cxx,v $ - * $Revision: 1.8.136.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svl.hxx" -#ifndef GCC -#endif - -#include - -#include -#include -#include - -#include - -DBG_NAME( SfxFrequencyItem ) - -TYPEINIT1( SfxFrequencyItem, SfxPoolItem ); - -#define MAX_GOTO 32000 - -#define DECL_SAVE_GOTO() \ - ULONG nSafetyMeasures = 0; - -#define SAVE_GOTO(tag) \ - if(nSafetyMeasures < MAX_GOTO) \ - { nSafetyMeasures++; goto tag; } - -// ----------------------------------------------------------------------- - -SfxFrequencyItem::SfxFrequencyItem( USHORT which ) : - SfxPoolItem ( which ), - eFrqMode ( FRQ_DAILY ), - eFrqTimeMode ( FRQ_TIME_AT ), - nDInterval1 ( 1 ), - nDInterval2 ( 0 ), - nDInterval3 ( 0 ), - nTInterval1 ( 1 ), - aTime1 ( Time( 12, 0, 0 ) ), - aTime2 ( Time( 12, 0, 0 ) ), - bMissingDate ( FALSE ), - aMissingDate ( DateTime(0, 0) ) -{ - DBG_CTOR( SfxFrequencyItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxFrequencyItem::SfxFrequencyItem( USHORT which, FrequencyMode eMode, FrequencyTimeMode eTMode, - USHORT nDI1, USHORT nDI2, USHORT nDI3, USHORT nTI1, - const Time& rT1, const Time& rT2 ) : - SfxPoolItem ( which ), - eFrqMode ( eMode ), - eFrqTimeMode ( eTMode ), - nDInterval1 ( nDI1 ), - nDInterval2 ( nDI2 ), - nDInterval3 ( nDI3 ), - nTInterval1 ( nTI1 ), - aTime1 ( rT1 ), - aTime2 ( rT2 ), - bMissingDate ( FALSE ) -{ - DBG_CTOR( SfxFrequencyItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxFrequencyItem::SfxFrequencyItem( const SfxFrequencyItem& rItem ) : - SfxPoolItem ( rItem ), - eFrqMode ( rItem.eFrqMode ), - eFrqTimeMode ( rItem.eFrqTimeMode ), - nDInterval1 ( rItem.nDInterval1 ), - nDInterval2 ( rItem.nDInterval2 ), - nDInterval3 ( rItem.nDInterval3 ), - nTInterval1 ( rItem.nTInterval1 ), - aTime1 ( rItem.aTime1 ), - aTime2 ( rItem.aTime2 ), - bMissingDate ( rItem.bMissingDate ) -{ - DBG_CTOR( SfxFrequencyItem, 0 ); -} - -// ----------------------------------------------------------------------- - -int SfxFrequencyItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS( SfxFrequencyItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - return ((SfxFrequencyItem&)rItem ).eFrqMode == eFrqMode && - ((SfxFrequencyItem&)rItem ).eFrqTimeMode == eFrqTimeMode && - ((SfxFrequencyItem&)rItem ).nDInterval1 == nDInterval1 && - ((SfxFrequencyItem&)rItem ).nDInterval2 == nDInterval2 && - ((SfxFrequencyItem&)rItem ).nDInterval3 == nDInterval3 && - ((SfxFrequencyItem&)rItem ).nTInterval1 == nTInterval1 && - ((SfxFrequencyItem&)rItem ).aTime1 == aTime1 && - ((SfxFrequencyItem&)rItem ).aTime2 == aTime2; -} - -// ----------------------------------------------------------------------- - -int SfxFrequencyItem::Compare( const SfxPoolItem& -#ifdef DBG_UTIL -rItem -#endif -) const -{ - DBG_CHKTHIS( SfxFrequencyItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - -/* DateTime aThisRange( aEndDateTime - aStartDateTime ); - DateTime aRange(((const SfxFrequencyItem&)rItem).aEndDateTime - - ((const SfxFrequencyItem&)rItem).aStartDateTime ); - if( aRange < aThisRange ) - return -1; - else if( aRange == aThisRange ) - return 0; - else -*/ - return 1; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxFrequencyItem::Create( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxFrequencyItem, 0); - - USHORT _eFrqMode; - USHORT _eFrqTimeMode; - USHORT _nDInterval1; - USHORT _nDInterval2; - USHORT _nDInterval3; - USHORT _nTInterval1; - long _nTime1; - long _nTime2; - - rStream >> _eFrqMode; - rStream >> _eFrqTimeMode; - rStream >> _nDInterval1; - rStream >> _nDInterval2; - rStream >> _nDInterval3; - rStream >> _nTInterval1; - rStream >> _nTime1; - rStream >> _nTime2; - - return new SfxFrequencyItem( Which(), (FrequencyMode)_eFrqMode, - (FrequencyTimeMode) _eFrqTimeMode, _nDInterval1, _nDInterval2, _nDInterval3, - _nTInterval1, Time(_nTime1), Time(_nTime2) ); -} - -// ----------------------------------------------------------------------- - -SvStream& SfxFrequencyItem::Store( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS( SfxFrequencyItem, 0 ); - - USHORT nEMode = (USHORT)eFrqMode; - USHORT nETimeMode = (USHORT)eFrqTimeMode; - - rStream << (USHORT) nEMode; - rStream << (USHORT) nETimeMode; - - rStream << nDInterval1; - rStream << nDInterval2; - rStream << nDInterval3; - - rStream << nTInterval1; - rStream << aTime1.GetTime(); - rStream << aTime2.GetTime(); - - return rStream; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxFrequencyItem::Clone( SfxItemPool* ) const -{ - DBG_CHKTHIS( SfxFrequencyItem, 0 ); - return new SfxFrequencyItem( *this ); -} - -// ----------------------------------------------------------------------- - -SfxItemPresentation SfxFrequencyItem::GetPresentation -( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * -) const -{ - DBG_CHKTHIS(SfxFrequencyItem, 0); - rText.AssignAscii(RTL_CONSTASCII_STRINGPARAM("SNIY")); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -// ----------------------------------------------------------------------- - -Time SfxFrequencyItem::_CalcTime( BOOL bForToday ) const -{ - Time aNow; - Time aTime; - - DECL_SAVE_GOTO(); - - switch( eFrqTimeMode ) - { - ////////////////////////////////////////////////////////// - // FRQ_TIME_AT - // - // Update um Uhrzeit - // nTime1 = 00:00:00 - 24:00:00 - // - case FRQ_TIME_AT : - aTime = aTime1; - break; - - ////////////////////////////////////////////////////////// - // FRQ_TIME_REPEAT - // - // Wiederhole alle X Stunden - // nTInterval1 = 1 .. 8 - // - case FRQ_TIME_REPEAT : - aTime = Time( 0, 0 ); - if( bForToday ) - { - - RECALC_TIME_REPEAT: - if( aNow > aTime ) - { - aTime += Time( nTInterval1, 0 ); - SAVE_GOTO( RECALC_TIME_REPEAT ); - } - break; - } - break; - - ////////////////////////////////////////////////////////// - // FRQ_TIME_REPEAT_RANGE - // - // FRQ_TIME_REPEAT zwischen Uhrzeit 1 und 2 - // nTime1 = 00:00:00 - 24:00:00 - // nTime2 = 00:00:00 - 24:00:00 - // - case FRQ_TIME_REPEAT_RANGE : - aTime = aTime1; - if( bForToday ) - { - if( aNow > aTime2 ) - return aTime1; - - RECALC_TIME_REPEAT_RANGE: - if( aNow > aTime ) - { - aTime += Time( nTInterval1, 0 ); - if( aTime > aTime2 ) - return aTime1; - SAVE_GOTO( RECALC_TIME_REPEAT_RANGE ); - } - break; - } - break; - } - return aTime; -} - -DateTime SfxFrequencyItem::CalcNextTick( const DateTime& rBase, BOOL bFirst ) -{ - Date aDateToday; - Time aTimeToday; - Date aDateBase; - Time aTimeBase; - - if( bFirst ) - { - aDateBase = Date( 17, 2, 1969 ); - aTimeBase = Time( 8, 0, 0 ); - } - else - { - aDateBase = rBase.GetDate(); - aTimeBase = rBase.GetTime(); - } - - Time aNextTime( _CalcTime(FALSE) ); - Date aNextDate( aDateBase ); - bMissingDate = FALSE; - - DECL_SAVE_GOTO(); - - switch( eFrqMode ) - { - ////////////////////////////////////////////////////////// - // FRQ_DAILY - // - // jeden X'ten Tag - // nInterval1 = 1 .. 999 - // - // jeden Wochentag - // nInterval1 = USHRT_MAX - // - case FRQ_DAILY : - { - if( bFirst ) - { - aNextTime = _CalcTime( TRUE ); - if( aNextTime < aTimeToday ) - { - aNextTime = _CalcTime( FALSE ); - aNextDate = aDateToday + (USHORT) - ((nDInterval1 == USHRT_MAX)? 1 : nDInterval1); - } - else - aNextDate = aDateToday; - break; - } - - RECALC_FRQ_DAILY: - if( aNextDate < aDateToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - aNextDate += (USHORT)((nDInterval1 == USHRT_MAX)? 1 : nDInterval1); - SAVE_GOTO( RECALC_FRQ_DAILY ); - } - - if( aNextDate == aDateToday ) - { - aNextTime = _CalcTime( TRUE ); - if( aNextTime < aTimeToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - aNextDate += (USHORT)((nDInterval1 == USHRT_MAX)? 1 : nDInterval1); - aNextTime = _CalcTime( FALSE ); - } - } - else - aNextTime = _CalcTime( FALSE ); - } break; - - ////////////////////////////////////////////////////////// - // FRQ_WEEKLY - // wiederhole jede X'te Woche - // nInterval1 = 1 .. 99 - // - // an SU, MO, TU, WE, TH, FR, SA - // nInterval2 = WD_SUNDAY | WD_MONDAY | WD_TUESDAY | - // WD_WEDNESDAY | WD_THURSDAY | WD_FRIDAY | - // WD_SATURDAY - // - case FRQ_WEEKLY : - { - BOOL bInRecalc = FALSE; - - RECALC_FRQ_WEEKLY: - if( !bFirst || bInRecalc ) - aNextDate += (nDInterval1 - 1) * 7; - - aNextDate -= (USHORT) ((aNextDate.GetDayOfWeek() != SUNDAY) ? - aNextDate.GetDayOfWeek() + 1 : 0); - - if( nDInterval2 & WD_SUNDAY && (aNextDate >= aDateToday) ) - aNextDate += 0; - else if( nDInterval2 & WD_MONDAY && (aNextDate + 1 >= aDateToday) ) - aNextDate += 1; - else if( nDInterval2 & WD_TUESDAY && (aNextDate + 2 >= aDateToday) ) - aNextDate += 2; - else if( nDInterval2 & WD_WEDNESDAY && (aNextDate + 3 >= aDateToday) ) - aNextDate += 3; - else if( nDInterval2 & WD_THURSDAY && (aNextDate + 4 >= aDateToday) ) - aNextDate += 4; - else if( nDInterval2 & WD_FRIDAY && (aNextDate + 5 >= aDateToday) ) - aNextDate += 5; - else if( nDInterval2 & WD_SATURDAY && (aNextDate + 6 >= aDateToday) ) - aNextDate += 6; - - if( aNextDate < aDateToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - bInRecalc = TRUE; - aNextDate += 7; - SAVE_GOTO( RECALC_FRQ_WEEKLY ); - } - if( aNextDate == aDateToday ) - { - aNextTime = _CalcTime( TRUE ); - if( aNextTime < aTimeToday ) - { - bInRecalc = TRUE; - aNextDate += 7; - SAVE_GOTO( RECALC_FRQ_WEEKLY ); - } - } - else - aNextTime = _CalcTime( FALSE ); - } break; - - ////////////////////////////////////////////////////////// - // FRQ_MONTHLY_DAILY - // - // jeden X'ten Tag von jedem X'ten Monat - // nInterval1 = 1 .. 31 - // nInterval2 = 1 .. 6 - // - case FRQ_MONTHLY_DAILY : - { - BOOL bInRecalc = FALSE; - aNextDate.SetDay( nDInterval1 ); - - RECALC_FRQ_MONTHLY_DAILY: - if( nDInterval2 > 1 || bInRecalc ) - { - long nMonth = aNextDate.GetMonth() - 1; - nMonth += nDInterval2; - aNextDate.SetYear( - sal::static_int_cast< USHORT >( - aNextDate.GetYear() + nMonth / 12 ) ); - aNextDate.SetMonth( - sal::static_int_cast< USHORT >( ( nMonth % 12 ) + 1 ) ); - } - - if( aNextDate < aDateToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - bInRecalc = TRUE; - SAVE_GOTO( RECALC_FRQ_MONTHLY_DAILY ); - } - - if( aNextDate == aDateToday ) - { - aNextTime = _CalcTime( TRUE ); - if( aNextTime < aTimeToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - bInRecalc = TRUE; - SAVE_GOTO( RECALC_FRQ_MONTHLY_DAILY ); - } - } - else - aNextTime = _CalcTime( FALSE ); - } break; - - ////////////////////////////////////////////////////////// - // FRQ_MONTHLY_LOGIC - // - // jeden ersten, zweiten, dritten, vierten oder letzten - // Wochentag jeden X'ten Monats - // nInterval1 = 0 .. 4 - // nInterval2 = WD_SUNDAY | WD_MONDAY | WD_TUESDAY | - // WD_WEDNESDAY | WD_THURSDAY | WD_FRIDAY | - // WD_SATURDAY - // nInterval3 = 1 .. 6 - // - case FRQ_MONTHLY_LOGIC : - { - BOOL bInRecalc = FALSE; - - RECALC_FRQ_MONTHLY_LOGIC: - if( nDInterval3 > 1 || bInRecalc ) - { - long nMonth = aNextDate.GetMonth() - 1; - nMonth += nDInterval3; - aNextDate.SetYear( - sal::static_int_cast< USHORT >( - aNextDate.GetYear() + nMonth / 12 ) ); - aNextDate.SetMonth( - sal::static_int_cast< USHORT >( ( nMonth % 12 ) + 1 ) ); - } - - USHORT nDay; - if( nDInterval2 & WD_SUNDAY ) - nDay = 6; - else if( nDInterval2 & WD_MONDAY ) - nDay = 0; - else if( nDInterval2 & WD_TUESDAY ) - nDay = 1; - else if( nDInterval2 & WD_WEDNESDAY ) - nDay = 2; - else if( nDInterval2 & WD_THURSDAY ) - nDay = 3; - else if( nDInterval2 & WD_FRIDAY ) - nDay = 4; - else nDay = 5; - - if( nDInterval1 == 4 ) - { - DateTime aDT = aNextDate; - aDT.SetDay( 1 ); - aDT += (long)(aNextDate.GetDaysInMonth() - 1); - if( aDT.GetDayOfWeek() != nDay ) - for( aDT--; aDT.GetDayOfWeek() != nDay; aDT-- ) ; - aNextDate = aDT; - } - else - { - DateTime aDT = aNextDate; - aDT.SetDay( 1 ); - aDT += (long)(nDay - USHORT(aDT.GetDayOfWeek())); - if( aDT.GetMonth() != aNextDate.GetMonth() ) - aDT += 7L; - aDT += (long)(nDInterval1 * 7); - aNextDate = aDT; - } - - if( aNextDate < aDateToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - bInRecalc = TRUE; - SAVE_GOTO( RECALC_FRQ_MONTHLY_LOGIC ); - } - - if( aNextDate == aDateToday ) - { - aNextTime = _CalcTime( TRUE ); - if( aNextTime < aTimeToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - bInRecalc = TRUE; - SAVE_GOTO( RECALC_FRQ_MONTHLY_LOGIC ); - } - } - else - aNextTime = _CalcTime( FALSE ); - } break; - } - - return DateTime( aNextDate, aNextTime ); -} - diff --git a/svl/source/items/makefile.mk b/svl/source/items/makefile.mk index 525fff0bc90a..d779e16e24d1 100644 --- a/svl/source/items/makefile.mk +++ b/svl/source/items/makefile.mk @@ -43,43 +43,43 @@ ENABLE_EXCEPTIONS=TRUE SLOFILES=\ $(SLO)$/aeitem.obj \ - $(SLO)$/eitem.obj \ - $(SLO)$/flagitem.obj \ - $(SLO)$/globalnameitem.obj \ - $(SLO)$/imageitm.obj \ - $(SLO)$/intitem.obj \ - $(SLO)$/macitem.obj \ - $(SLO)$/poolcach.obj \ - $(SLO)$/ptitem.obj \ - $(SLO)$/rectitem.obj \ - $(SLO)$/rngitem.obj \ - $(SLO)$/stritem.obj \ - $(SLO)$/style.obj \ - $(SLO)$/szitem.obj \ - $(SLO)$/bintitem.obj \ $(SLO)$/cenumitm.obj \ $(SLO)$/cintitem.obj \ $(SLO)$/cntwall.obj \ $(SLO)$/ctypeitm.obj \ $(SLO)$/custritm.obj \ - $(SLO)$/dtritem.obj \ - $(SLO)$/frqitem.obj \ + $(SLO)$/dateitem.obj \ + $(SLO)$/eitem.obj \ + $(SLO)$/flagitem.obj \ + $(SLO)$/globalnameitem.obj \ $(SLO)$/ilstitem.obj \ + $(SLO)$/imageitm.obj \ + $(SLO)$/intitem.obj \ $(SLO)$/itemiter.obj \ $(SLO)$/itempool.obj \ $(SLO)$/itemprop.obj \ $(SLO)$/itemset.obj \ $(SLO)$/lckbitem.obj \ + $(SLO)$/macitem.obj \ + $(SLO)$/poolcach.obj \ $(SLO)$/poolio.obj \ - $(SLO)$/stylepool.obj \ $(SLO)$/poolitem.obj \ + $(SLO)$/ptitem.obj \ + $(SLO)$/rectitem.obj \ + $(SLO)$/rngitem.obj \ $(SLO)$/sfontitm.obj \ $(SLO)$/sitem.obj \ $(SLO)$/slstitm.obj \ - $(SLO)$/tfrmitem.obj \ - $(SLO)$/tresitem.obj \ - $(SLO)$/whiter.obj \ - $(SLO)$/visitem.obj + $(SLO)$/stritem.obj \ + $(SLO)$/style.obj \ + $(SLO)$/stylepool.obj \ + $(SLO)$/szitem.obj \ + $(SLO)$/visitem.obj \ + $(SLO)$/whiter.obj + +SRS1NAME=$(TARGET) +SRC1FILES=\ + cstitem.src # --- Targets ------------------------------------------------------- diff --git a/svl/source/items/tfrmitem.cxx b/svl/source/items/tfrmitem.cxx deleted file mode 100644 index 636b3e9eb0a1..000000000000 --- a/svl/source/items/tfrmitem.cxx +++ /dev/null @@ -1,184 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: tfrmitem.cxx,v $ - * $Revision: 1.8 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svl.hxx" -#include - -#include -#include -#include - -#include - -DBG_NAME( SfxTargetFrameItem ) -TYPEINIT1( SfxTargetFrameItem, SfxPoolItem ); - -// ----------------------------------------------------------------------- - -SfxTargetFrameItem::SfxTargetFrameItem( USHORT which ) : - SfxPoolItem( which ) -{ - DBG_CTOR( SfxTargetFrameItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxTargetFrameItem::SfxTargetFrameItem( const SfxTargetFrameItem& rItem ) : - SfxPoolItem( rItem ) -{ - DBG_CTOR( SfxTargetFrameItem, 0 ); - for( USHORT nCur = 0; nCur <= (USHORT)SfxOpenModeLast; nCur++ ) - _aFrames[nCur] = rItem._aFrames[nCur]; -} - -// ----------------------------------------------------------------------- - -SfxTargetFrameItem::SfxTargetFrameItem( USHORT which, - const String& rOpenSelectFrame, const String& rOpenOpenFrame, - const String& rOpenAddTaskFrame ) : SfxPoolItem( which ) -{ - DBG_CTOR( SfxTargetFrameItem, 0 ); - _aFrames[ (USHORT)SfxOpenSelect ] = rOpenSelectFrame; - _aFrames[ (USHORT)SfxOpenOpen ] = rOpenOpenFrame; - _aFrames[ (USHORT)SfxOpenAddTask ] = rOpenAddTaskFrame; -} - -// ----------------------------------------------------------------------- - -SfxTargetFrameItem::~SfxTargetFrameItem() -{ - DBG_DTOR(SfxTargetFrameItem, 0); -} - -// ----------------------------------------------------------------------- - -String SfxTargetFrameItem::GetTargetFrame( SfxOpenMode eMode ) const -{ - DBG_CHKTHIS( SfxTargetFrameItem, 0 ); - if( eMode <= SfxOpenModeLast ) - return _aFrames[ (USHORT)eMode ]; - String aResult; - return aResult; -} - -// ----------------------------------------------------------------------- - -int SfxTargetFrameItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS( SfxTargetFrameItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - for( USHORT nCur = 0; nCur <= (USHORT)SfxOpenModeLast; nCur++ ) - { - if( _aFrames[nCur] != ((const SfxTargetFrameItem&)rItem)._aFrames[nCur] ) - return 0; - } - return 1; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxTargetFrameItem::Create( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxTargetFrameItem, 0); - SfxTargetFrameItem* pItem = new SfxTargetFrameItem( Which() ); - USHORT nCount = 0; - rStream >> nCount; - for(USHORT nCur=0; nCur<= (USHORT)SfxOpenModeLast && nCount; nCur++,nCount--) - { - readByteString(rStream, pItem->_aFrames[ nCur ]); - } - // die uebriggebliebenen ueberspringen - String aTemp; - while( nCount ) - { - readByteString(rStream, aTemp); - nCount--; - } - return pItem; -} - -// ----------------------------------------------------------------------- - -SvStream& SfxTargetFrameItem::Store( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS( SfxTargetFrameItem, 0 ); - USHORT nCount = (USHORT)(SfxOpenModeLast+1); - rStream << nCount; - for( USHORT nCur = 0; nCur <= (USHORT)SfxOpenModeLast; nCur++ ) - { - writeByteString(rStream, _aFrames[ nCur ]); - } - return rStream; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxTargetFrameItem::Clone( SfxItemPool* ) const -{ - DBG_CHKTHIS( SfxTargetFrameItem, 0 ); - return new SfxTargetFrameItem( *this ); -} - -// ----------------------------------------------------------------------- -// virtual -BOOL SfxTargetFrameItem::QueryValue( com::sun::star::uno::Any& rVal,BYTE ) const -{ - String aVal; - for ( int i = 0; i <= SfxOpenModeLast; i++ ) - { - aVal += _aFrames[ i ]; - aVal += ';' ; - } - - rVal <<= rtl::OUString( aVal ); - return TRUE; -} - -// ----------------------------------------------------------------------- -// virtual -BOOL SfxTargetFrameItem::PutValue( const com::sun::star::uno::Any& rVal,BYTE ) -{ - rtl::OUString aValue; - if ( rVal >>= aValue ) - { - const String aVal( aValue ); - - for ( USHORT i = 0; i <= SfxOpenModeLast; i++ ) - _aFrames[ i ] = aVal.GetToken( i ); - - return TRUE; - } - - DBG_ERROR( "SfxTargetFrameItem::PutValue - Wrong type!" ); - return FALSE; -} - diff --git a/svl/source/items/tresitem.cxx b/svl/source/items/tresitem.cxx deleted file mode 100644 index 3fdf3f750180..000000000000 --- a/svl/source/items/tresitem.cxx +++ /dev/null @@ -1,78 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: tresitem.cxx,v $ - * $Revision: 1.6 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svl.hxx" -#include - -using namespace com::sun::star; - -//============================================================================ -// -// CntTransferResultItem -// -//============================================================================ - -TYPEINIT1_AUTOFACTORY(CntTransferResultItem, SfxPoolItem) - -//============================================================================ -// virtual -int CntTransferResultItem::operator ==(SfxPoolItem const & rItem) const -{ - if (CntTransferResultItem * pResultItem = PTR_CAST(CntTransferResultItem, - &rItem)) - return m_aResult.Source == pResultItem->m_aResult.Source - && m_aResult.Target == pResultItem->m_aResult.Target - && m_aResult.Result == pResultItem->m_aResult.Result; - return false; -} - -//============================================================================ -// virtual -BOOL CntTransferResultItem::QueryValue(uno::Any & rVal, BYTE) const -{ - rVal <<= m_aResult; - return true; -} - -//============================================================================ -// virtual -BOOL CntTransferResultItem::PutValue(uno::Any const & rVal, BYTE) -{ - return rVal >>= m_aResult; -} - -//============================================================================ -// virtual -SfxPoolItem * CntTransferResultItem::Clone(SfxItemPool *) const -{ - return new CntTransferResultItem(*this); -} - diff --git a/svl/source/numbers/numuno.cxx b/svl/source/numbers/numuno.cxx index e909fb2fd4e8..3cc90998e2dc 100644 --- a/svl/source/numbers/numuno.cxx +++ b/svl/source/numbers/numuno.cxx @@ -35,7 +35,6 @@ #define _ZFORLIST_DECLARE_TABLE -#include #include #include #include diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index eb867f67fb57..f03ef3f31140 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -59,8 +59,6 @@ #include "numhead.hxx" #include -#include "listener.hxx" -#include #include #include #include @@ -120,7 +118,7 @@ public: sal_uInt32 Count() { return aFormatters.Count(); } - virtual void ConfigurationChanged( utl::ConfigurationBroadcaster* ); + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); }; @@ -137,9 +135,9 @@ SvNumberFormatterRegistry_Impl::~SvNumberFormatterRegistry_Impl() } -void SvNumberFormatterRegistry_Impl::ConfigurationChanged( utl::ConfigurationBroadcaster* ) +void SvNumberFormatterRegistry_Impl::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 nHint ) { - //if ( pHint->GetId() & SYSLOCALEOPTIONS_HINT_LOCALE ) + if ( nHint & SYSLOCALEOPTIONS_HINT_LOCALE ) { ::osl::MutexGuard aGuard( SvNumberFormatter::GetMutex() ); for ( SvNumberFormatter* p = (SvNumberFormatter*)aFormatters.First(); @@ -149,7 +147,7 @@ void SvNumberFormatterRegistry_Impl::ConfigurationChanged( utl::ConfigurationBro } eSysLanguage = MsLangId::getRealLanguage( LANGUAGE_SYSTEM ); } - //if ( pHint->GetId() & SYSLOCALEOPTIONS_HINT_CURRENCY ) + if ( nHint & SYSLOCALEOPTIONS_HINT_CURRENCY ) { ::osl::MutexGuard aGuard( SvNumberFormatter::GetMutex() ); for ( SvNumberFormatter* p = (SvNumberFormatter*)aFormatters.First(); diff --git a/svl/source/passwordcontainer/syscreds.cxx b/svl/source/passwordcontainer/syscreds.cxx index ae43c1c70e6b..faf086e369bd 100644 --- a/svl/source/passwordcontainer/syscreds.cxx +++ b/svl/source/passwordcontainer/syscreds.cxx @@ -59,6 +59,11 @@ void SysCredentialsConfigItem::Notify( m_pOwner->persistentConfigChanged(); } +void SysCredentialsConfigItem::Commit() +{ + // does nothing +} + uno::Sequence< rtl::OUString > SysCredentialsConfigItem::getSystemCredentialsURLs() { diff --git a/svl/source/passwordcontainer/syscreds.hxx b/svl/source/passwordcontainer/syscreds.hxx index b037e17c348e..68de21049fdc 100644 --- a/svl/source/passwordcontainer/syscreds.hxx +++ b/svl/source/passwordcontainer/syscreds.hxx @@ -49,7 +49,7 @@ class SysCredentialsConfigItem : public utl::ConfigItem virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString > & seqPropertyNames ); - //virtual void Commit(); + virtual void Commit(); com::sun::star::uno::Sequence< rtl::OUString > getSystemCredentialsURLs(); diff --git a/svl/util/makefile.mk b/svl/util/makefile.mk index 522e1b3c0a3c..36e1d3f63852 100644 --- a/svl/util/makefile.mk +++ b/svl/util/makefile.mk @@ -68,6 +68,7 @@ LIB1FILES= \ RESLIB1NAME= $(RESTARGETSIMPLE) RESLIB1SRSFILES=\ + $(SRS)$/items.srs \ $(SRS)$/misc.srs # build the shared library -------------------------------------------------- @@ -85,7 +86,6 @@ SHL1STDLIBS= \ $(CPPUHELPERLIB) \ $(CPPULIB) \ $(VOSLIB) \ - $(VCLLIB) \ $(SOTLIB) \ $(SALLIB) diff --git a/svtools/bmpmaker/bmp.cxx b/svtools/bmpmaker/bmp.cxx index df20c7e05376..b91dae79bbad 100644 --- a/svtools/bmpmaker/bmp.cxx +++ b/svtools/bmpmaker/bmp.cxx @@ -43,7 +43,7 @@ using namespace std; #include -#include "svtools/solar.hrc" +#include "svl/solar.hrc" #include "filedlg.hxx" #include "bmpcore.hxx" #include "bmp.hrc" diff --git a/svtools/bmpmaker/bmpsum.cxx b/svtools/bmpmaker/bmpsum.cxx index 0633eb4c6a09..3eee49ef695d 100644 --- a/svtools/bmpmaker/bmpsum.cxx +++ b/svtools/bmpmaker/bmpsum.cxx @@ -45,7 +45,7 @@ #include #include -#include "svtools/solar.hrc" +#include "svl/solar.hrc" #define EXIT_NOERROR 0x00000000 #define EXIT_INVALIDFILE 0x00000001 diff --git a/svtools/inc/apearcfg.hxx b/svtools/inc/apearcfg.hxx index 1123eb839eff..412faab3107b 100644 --- a/svtools/inc/apearcfg.hxx +++ b/svtools/inc/apearcfg.hxx @@ -87,6 +87,7 @@ public: ~SvtTabAppearanceCfg( ); virtual void Commit(); + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames); USHORT GetLookNFeel () const { return nLookNFeel; } void SetLookNFeel ( USHORT nSet ); diff --git a/svtools/inc/extcolorcfg.hxx b/svtools/inc/extcolorcfg.hxx index f8154c86f88f..228ef9823fd2 100644 --- a/svtools/inc/extcolorcfg.hxx +++ b/svtools/inc/extcolorcfg.hxx @@ -34,8 +34,8 @@ #include #include #include -#include -#include +#include +#include //----------------------------------------------------------------------------- namespace svtools{ diff --git a/svtools/inc/fontsubstconfig.hxx b/svtools/inc/fontsubstconfig.hxx index 7bcb20e509fe..7ce7e64362b5 100644 --- a/svtools/inc/fontsubstconfig.hxx +++ b/svtools/inc/fontsubstconfig.hxx @@ -53,6 +53,7 @@ public: virtual ~SvtFontSubstConfig(); virtual void Commit(); + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames); sal_Bool IsEnabled() const {return bIsEnabled;} void Enable(sal_Bool bSet) {bIsEnabled = bSet; SetModified();} diff --git a/svtools/inc/svtools/accessibilityoptions.hxx b/svtools/inc/svtools/accessibilityoptions.hxx index 00a0efdc1b13..bde908fb1851 100644 --- a/svtools/inc/svtools/accessibilityoptions.hxx +++ b/svtools/inc/svtools/accessibilityoptions.hxx @@ -33,14 +33,14 @@ #include "svtools/svtdllapi.h" #include #include -#include -#include +#include +#include #include class SvtAccessibilityOptions_Impl; class SVT_DLLPUBLIC SvtAccessibilityOptions: - public utl::detail::Options, public SfxBroadcaster, private SfxListener + public utl::detail::Options, private SfxListener { private: static SvtAccessibilityOptions_Impl* volatile sm_pSingleImplConfig; diff --git a/svtools/inc/svtools/colorcfg.hxx b/svtools/inc/svtools/colorcfg.hxx index 98152e80b7c3..dd3ba4018280 100644 --- a/svtools/inc/svtools/colorcfg.hxx +++ b/svtools/inc/svtools/colorcfg.hxx @@ -34,8 +34,8 @@ #include #include #include -#include -#include +#include +#include #include //----------------------------------------------------------------------------- @@ -108,7 +108,7 @@ struct ColorConfigValue ---------------------------------------------------------------------------*/ class SVT_DLLPUBLIC ColorConfig: - public utl::detail::Options, public SfxBroadcaster, public SfxListener + public utl::detail::Options { friend class ColorConfig_Impl; private: @@ -117,12 +117,9 @@ public: ColorConfig(); virtual ~ColorConfig(); - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - // get the configured value - if bSmart is set the default color setting is provided // instead of the automatic color ColorConfigValue GetColorValue(ColorConfigEntry eEntry, sal_Bool bSmart = sal_True)const; - static Color GetDefaultColor(ColorConfigEntry eEntry); }; /* -----------------------------22.03.2002 15:31------------------------------ diff --git a/svtools/inc/svtools/fmtfield.hxx b/svtools/inc/svtools/fmtfield.hxx index e2fe243f8399..27e9376ea1c7 100644 --- a/svtools/inc/svtools/fmtfield.hxx +++ b/svtools/inc/svtools/fmtfield.hxx @@ -33,7 +33,7 @@ #include "svtools/svtdllapi.h" #include -#include +#include //#define REGEXP_SUPPORT diff --git a/svtools/inc/svtools/helpid.hrc b/svtools/inc/svtools/helpid.hrc index efbb0d2628d9..937898f37af1 100644 --- a/svtools/inc/svtools/helpid.hrc +++ b/svtools/inc/svtools/helpid.hrc @@ -33,7 +33,7 @@ // include --------------------------------------------------------------- -#include +#include // Help-Ids -------------------------------------------------------------- diff --git a/svtools/inc/svtools/htmlout.hxx b/svtools/inc/svtools/htmlout.hxx index 1f0b91c3c353..13df12b64ea9 100644 --- a/svtools/inc/svtools/htmlout.hxx +++ b/svtools/inc/svtools/htmlout.hxx @@ -34,7 +34,7 @@ #include "svtools/svtdllapi.h" #include #include -#include +#include class Color; class ImageMap; diff --git a/svtools/inc/svtools/imapobj.hxx b/svtools/inc/svtools/imapobj.hxx index 3671bf50878c..b8da0e5c3ee8 100644 --- a/svtools/inc/svtools/imapobj.hxx +++ b/svtools/inc/svtools/imapobj.hxx @@ -33,7 +33,7 @@ #include "svtools/svtdllapi.h" #include -#include +#include class Point; class Rectangle; diff --git a/svtools/inc/svtools/insdlg.hxx b/svtools/inc/svtools/insdlg.hxx index 191c3db68397..9721d55761f0 100644 --- a/svtools/inc/svtools/insdlg.hxx +++ b/svtools/inc/svtools/insdlg.hxx @@ -38,7 +38,7 @@ #include #ifndef _OWNCONT_HXX -#include +#include #endif #include diff --git a/svtools/inc/svtools/parhtml.hxx b/svtools/inc/svtools/parhtml.hxx index f5de6aea358d..e1eb53c6e052 100644 --- a/svtools/inc/svtools/parhtml.hxx +++ b/svtools/inc/svtools/parhtml.hxx @@ -34,7 +34,7 @@ #include "svtools/svtdllapi.h" #include #include -#include +#include #include diff --git a/svtools/inc/svtools/parrtf.hxx b/svtools/inc/svtools/parrtf.hxx index 94e81e798bdf..1882b127ae90 100644 --- a/svtools/inc/svtools/parrtf.hxx +++ b/svtools/inc/svtools/parrtf.hxx @@ -33,7 +33,7 @@ #include "svtools/svtdllapi.h" #include -#include +#include struct RtfParserState_Impl { diff --git a/svtools/inc/svtools/svlbox.hxx b/svtools/inc/svtools/svlbox.hxx index 7371c2feee05..a7f385941fc6 100644 --- a/svtools/inc/svtools/svlbox.hxx +++ b/svtools/inc/svtools/svlbox.hxx @@ -52,7 +52,7 @@ #include #include #include -#include +#include #include class Application; diff --git a/svtools/inc/svtools/syntaxhighlight.hxx b/svtools/inc/svtools/syntaxhighlight.hxx index 27dd28b5b783..c9680821affc 100644 --- a/svtools/inc/svtools/syntaxhighlight.hxx +++ b/svtools/inc/svtools/syntaxhighlight.hxx @@ -40,7 +40,7 @@ #include #include -#include +#include #include @@ -60,7 +60,7 @@ #include #include -#include +#include // Token-Typen TT_... diff --git a/svtools/inc/svtools/textdata.hxx b/svtools/inc/svtools/textdata.hxx index 5b44b1364492..bd119b63c095 100644 --- a/svtools/inc/svtools/textdata.hxx +++ b/svtools/inc/svtools/textdata.hxx @@ -32,8 +32,8 @@ #define _TEXTDATA_HXX #include "svtools/svtdllapi.h" -#include -#include +#include +#include #include #define TEXTUNDO_START 100 diff --git a/svtools/inc/svtools/texteng.hxx b/svtools/inc/svtools/texteng.hxx index c1d7746d73c6..e1d64aa42ecd 100644 --- a/svtools/inc/svtools/texteng.hxx +++ b/svtools/inc/svtools/texteng.hxx @@ -54,7 +54,7 @@ class Timer; class TextLine; class TETextPortion; -#include +#include #include #include #include diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx index 086e00674a8e..a6e47765eb06 100644 --- a/svtools/source/brwbox/editbrowsebox.cxx +++ b/svtools/source/brwbox/editbrowsebox.cxx @@ -50,7 +50,7 @@ #include #ifndef _SVTOOLS_HRC -#include +#include #endif #include diff --git a/svtools/source/brwbox/editbrowsebox.src b/svtools/source/brwbox/editbrowsebox.src index 39991363c906..c04e1294c0af 100644 --- a/svtools/source/brwbox/editbrowsebox.src +++ b/svtools/source/brwbox/editbrowsebox.src @@ -33,7 +33,7 @@ #endif #ifndef _SVTOOLS_HRC -#include +#include #endif ImageList RID_SVTOOLS_IMAGELIST_EDITBROWSEBOX diff --git a/svtools/source/config/accessibilityoptions.cxx b/svtools/source/config/accessibilityoptions.cxx index 147d0fea5c59..4077231c5c84 100644 --- a/svtools/source/config/accessibilityoptions.cxx +++ b/svtools/source/config/accessibilityoptions.cxx @@ -55,7 +55,7 @@ #include #endif -#include +#include #include #include @@ -539,7 +539,7 @@ SvtAccessibilityOptions::~SvtAccessibilityOptions() void SvtAccessibilityOptions::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - Broadcast( rHint ); + NotifyListeners(0); if ( rHint.IsA(TYPE(SfxSimpleHint)) ) { if ( ((SfxSimpleHint&)rHint).GetId() == SFX_HINT_ACCESSIBILITY_CHANGED ) diff --git a/svtools/source/config/apearcfg.cxx b/svtools/source/config/apearcfg.cxx index ccfc402ac221..0d4865ee563e 100644 --- a/svtools/source/config/apearcfg.cxx +++ b/svtools/source/config/apearcfg.cxx @@ -171,6 +171,11 @@ void SvtTabAppearanceCfg::Commit() } PutProperties(rNames, aValues); } + +void SvtTabAppearanceCfg::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& ) +{ +} + /*-------------------------------------------------------------------- Beschreibung: --------------------------------------------------------------------*/ diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx index f600be830b41..9008d7a27ee1 100644 --- a/svtools/source/config/colorcfg.cxx +++ b/svtools/source/config/colorcfg.cxx @@ -41,8 +41,8 @@ #include #include #include -#include //Any2Bool -#include +#include //Any2Bool +#include #include #include @@ -76,15 +76,12 @@ ColorConfig_Impl* ColorConfig::m_pImpl = NULL; /* -----------------------------16.01.01 15:36-------------------------------- ---------------------------------------------------------------------------*/ -class ColorConfig_Impl : public utl::ConfigItem, public SfxBroadcaster +class ColorConfig_Impl : public utl::ConfigItem { ColorConfigValue m_aConfigValues[ColorConfigEntryCount]; sal_Bool m_bEditMode; rtl::OUString m_sIsVisible; rtl::OUString m_sLoadedScheme; - sal_Bool m_bIsBroadcastEnabled; - static sal_Bool m_bLockBroadcast; - static sal_Bool m_bBroadcastWhenUnlocked; uno::Sequence< ::rtl::OUString> GetPropertyNames(const rtl::OUString& rScheme); public: @@ -113,13 +110,6 @@ public: void ClearModified(){ConfigItem::ClearModified();} void SettingsChanged(); - static void DisableBroadcast(); - static void EnableBroadcast(); - static sal_Bool IsEnableBroadcast(); - - static void LockBroadcast(); - static void UnlockBroadcast(); - // #100822# DECL_LINK( DataChangedEventListener, VclWindowEvent* ); @@ -214,13 +204,10 @@ uno::Sequence< OUString> ColorConfig_Impl::GetPropertyNames(const rtl::OUString& /* -----------------------------22.03.2002 14:37------------------------------ ---------------------------------------------------------------------------*/ -sal_Bool ColorConfig_Impl::m_bLockBroadcast = sal_False; -sal_Bool ColorConfig_Impl::m_bBroadcastWhenUnlocked = sal_False; ColorConfig_Impl::ColorConfig_Impl(sal_Bool bEditMode) : ConfigItem(C2U("Office.UI/ColorScheme")), m_bEditMode(bEditMode), - m_sIsVisible(C2U("/IsVisible")), - m_bIsBroadcastEnabled(sal_True) + m_sIsVisible(C2U("/IsVisible")) { if(!m_bEditMode) { @@ -244,23 +231,6 @@ ColorConfig_Impl::~ColorConfig_Impl() // #100822# ::Application::RemoveEventListener( LINK(this, ColorConfig_Impl, DataChangedEventListener) ); } -// ----------------------------------------------------------------------------- -void ColorConfig_Impl::DisableBroadcast() -{ - if ( ColorConfig::m_pImpl ) - ColorConfig::m_pImpl->m_bIsBroadcastEnabled = sal_False; -} -// ----------------------------------------------------------------------------- -void ColorConfig_Impl::EnableBroadcast() -{ - if ( ColorConfig::m_pImpl ) - ColorConfig::m_pImpl->m_bIsBroadcastEnabled = sal_True; -} -// ----------------------------------------------------------------------------- -sal_Bool ColorConfig_Impl::IsEnableBroadcast() -{ - return ColorConfig::m_pImpl ? ColorConfig::m_pImpl->m_bIsBroadcastEnabled : sal_False; -} /* -----------------------------22.03.2002 14:38------------------------------ ---------------------------------------------------------------------------*/ @@ -303,16 +273,7 @@ void ColorConfig_Impl::Notify( const uno::Sequence& ) { //loading via notification always uses the default setting Load(::rtl::OUString()); - - vos::OGuard aVclGuard( Application::GetSolarMutex() ); - - if(m_bLockBroadcast) - { - m_bBroadcastWhenUnlocked = sal_True; - ImplUpdateApplicationSettings(); - } - else - Broadcast(SfxSimpleHint(SFX_HINT_COLORS_CHANGED)); + NotifyListeners(0); } /* -----------------------------22.03.2002 14:38------------------------------ @@ -409,34 +370,7 @@ void ColorConfig_Impl::SettingsChanged() ImplUpdateApplicationSettings(); - Broadcast( SfxSimpleHint( SFX_HINT_COLORS_CHANGED ) ); -} -/* -----------------11.12.2002 09:21----------------- - * - * --------------------------------------------------*/ -void ColorConfig_Impl::LockBroadcast() -{ - m_bLockBroadcast = sal_True; -} -/* -----------------11.12.2002 09:21----------------- - * - * --------------------------------------------------*/ -void ColorConfig_Impl::UnlockBroadcast() -{ - if ( m_bBroadcastWhenUnlocked ) - { - m_bBroadcastWhenUnlocked = ColorConfig::m_pImpl != NULL; - if ( m_bBroadcastWhenUnlocked ) - { - ColorConfig::m_pImpl->ImplUpdateApplicationSettings(); - if ( ColorConfig::m_pImpl->IsEnableBroadcast() ) - { - m_bBroadcastWhenUnlocked = sal_False; - ColorConfig::m_pImpl->Broadcast(SfxSimpleHint(SFX_HINT_COLORS_CHANGED)); - } - } - } - m_bLockBroadcast = sal_False; + NotifyListeners(0); } /* -----------------------------2002/08/16 12:07 ----------------------------- #100822# @@ -495,7 +429,7 @@ ColorConfig::ColorConfig() ItemHolder2::holdConfigItem(E_COLORCFG); } ++nColorRefCount_Impl; - StartListening( *m_pImpl); + m_pImpl->AddListener(this); } /* -----------------------------16.01.01 15:36-------------------------------- @@ -503,7 +437,7 @@ ColorConfig::ColorConfig() ColorConfig::~ColorConfig() { ::osl::MutexGuard aGuard( ColorMutex_Impl::get() ); - EndListening( *m_pImpl); + m_pImpl->RemoveListener(this); if(!--nColorRefCount_Impl) { delete m_pImpl; @@ -631,15 +565,6 @@ ColorConfigValue ColorConfig::GetColorValue(ColorConfigEntry eEntry, sal_Bool bS return aRet; } -/* -----------------------------12.04.2002 09:25------------------------------ - - ---------------------------------------------------------------------------*/ -void ColorConfig::Notify( SfxBroadcaster&, const SfxHint& rHint ) -{ - vos::OGuard aVclGuard( Application::GetSolarMutex() ); - - Broadcast( rHint ); -} /* -----------------------------25.03.2002 12:01------------------------------ ---------------------------------------------------------------------------*/ @@ -647,14 +572,14 @@ EditableColorConfig::EditableColorConfig() : m_pImpl(new ColorConfig_Impl), m_bModified(sal_False) { - m_pImpl->LockBroadcast(); + m_pImpl->BlockBroadcasts(TRUE); } /*-- 25.03.2002 12:03:08--------------------------------------------------- -----------------------------------------------------------------------*/ EditableColorConfig::~EditableColorConfig() { - m_pImpl->UnlockBroadcast(); + m_pImpl->BlockBroadcasts(FALSE); if(m_bModified) m_pImpl->SetModified(); if(m_pImpl->IsModified()) @@ -752,12 +677,12 @@ void EditableColorConfig::Commit() // ----------------------------------------------------------------------------- void EditableColorConfig::DisableBroadcast() { - m_pImpl->DisableBroadcast(); + m_pImpl->BlockBroadcasts(TRUE); } // ----------------------------------------------------------------------------- void EditableColorConfig::EnableBroadcast() { - m_pImpl->EnableBroadcast(); + m_pImpl->BlockBroadcasts(FALSE); } // ----------------------------------------------------------------------------- diff --git a/svtools/source/config/extcolorcfg.cxx b/svtools/source/config/extcolorcfg.cxx index 66dfd8af1ebb..89bf41ac9f58 100644 --- a/svtools/source/config/extcolorcfg.cxx +++ b/svtools/source/config/extcolorcfg.cxx @@ -40,8 +40,8 @@ #include #include #include -#include //Any2Bool -#include +#include //Any2Bool +#include #include /* #100822# ---- diff --git a/svtools/source/config/fontsubstconfig.cxx b/svtools/source/config/fontsubstconfig.cxx index 4d1c9b7db5c5..dc9bfa64e6d4 100644 --- a/svtools/source/config/fontsubstconfig.cxx +++ b/svtools/source/config/fontsubstconfig.cxx @@ -32,7 +32,7 @@ #include "precompiled_svtools.hxx" #include "fontsubstconfig.hxx" -#include +#include #include #include #include @@ -124,6 +124,10 @@ SvtFontSubstConfig::~SvtFontSubstConfig() /*-- 18.01.01 12:08:00--------------------------------------------------- -----------------------------------------------------------------------*/ +void SvtFontSubstConfig::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& ) +{ +} + void SvtFontSubstConfig::Commit() { Sequence aNames(1); diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx index abb044c7863e..d4aeda6e6be8 100644 --- a/svtools/source/config/optionsdrawinglayer.cxx +++ b/svtools/source/config/optionsdrawinglayer.cxx @@ -191,6 +191,7 @@ public: //--------------------------------------------------------------------------------------------------------- virtual void Commit(); + virtual void Notify( const com::sun::star::uno::Sequence& aPropertyNames); //--------------------------------------------------------------------------------------------------------- // public interface @@ -735,6 +736,10 @@ void SvtOptionsDrawinglayer_Impl::Commit() PutProperties( aSeqNames, aSeqValues ); } +void SvtOptionsDrawinglayer_Impl::Notify( const com::sun::star::uno::Sequence& ) +{ +} + //***************************************************************************************************************** // public method //***************************************************************************************************************** diff --git a/svtools/source/contnr/contentenumeration.cxx b/svtools/source/contnr/contentenumeration.cxx index af379db9b12b..a0e6b353dfb6 100644 --- a/svtools/source/contnr/contentenumeration.cxx +++ b/svtools/source/contnr/contentenumeration.cxx @@ -31,7 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" #include "contentenumeration.hxx" -#include +#include #include #include "imagemgr.hxx" diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index 274557051c27..cea28d2d2fb5 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -37,7 +37,7 @@ #include #include -#include +#include #include "fileview.hrc" #include "contentenumeration.hxx" #include @@ -78,8 +78,8 @@ #include #include #include -#include -#include +#include +#include using namespace ::com::sun::star::lang; using namespace ::com::sun::star::sdbc; diff --git a/svtools/source/contnr/fileview.src b/svtools/source/contnr/fileview.src index c86db1ce418a..9d1cdb618cda 100644 --- a/svtools/source/contnr/fileview.src +++ b/svtools/source/contnr/fileview.src @@ -30,7 +30,7 @@ // includes ------------------------------------------------------------------ -#include +#include #include "fileview.hrc" #include diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx index d4ec597aebfc..d443beb7fff9 100644 --- a/svtools/source/contnr/imivctl.hxx +++ b/svtools/source/contnr/imivctl.hxx @@ -45,7 +45,7 @@ #include #include "ivctrl.hxx" -#include +#include class IcnCursor_Impl; class SvtIconChoiceCtrl; diff --git a/svtools/source/contnr/svcontnr.src b/svtools/source/contnr/svcontnr.src index c26c906eb3f6..f81bc3fdfa9b 100644 --- a/svtools/source/contnr/svcontnr.src +++ b/svtools/source/contnr/svcontnr.src @@ -28,7 +28,7 @@ * ************************************************************************/ -#include +#include Image RID_IMG_TREENODE_COLLAPSED { diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index e17b81e548a9..f2674279f4df 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -50,7 +50,7 @@ #include #ifndef _SVTOOLS_HRC -#include +#include #endif // #102891# -------------------- diff --git a/svtools/source/contnr/svimpicn.cxx b/svtools/source/contnr/svimpicn.cxx index 37ee096dc6d9..8d7a79701d27 100644 --- a/svtools/source/contnr/svimpicn.cxx +++ b/svtools/source/contnr/svimpicn.cxx @@ -46,7 +46,7 @@ #ifndef _SVLBITM_HXX #include #endif -#include +#include diff --git a/svtools/source/contnr/svlbox.cxx b/svtools/source/contnr/svlbox.cxx index e56db398b8fb..77a9a3798d6d 100644 --- a/svtools/source/contnr/svlbox.cxx +++ b/svtools/source/contnr/svlbox.cxx @@ -48,7 +48,7 @@ #include #define _SVSTDARR_ULONGSSORT -#include +#include #ifndef _SVEDI_HXX #include diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx index 1770810c7a5d..3b4907e7a80d 100644 --- a/svtools/source/contnr/svtabbx.cxx +++ b/svtools/source/contnr/svtabbx.cxx @@ -34,7 +34,7 @@ #include #include #ifndef _SVTOOLS_HRC -#include +#include #endif #include #include diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx index 7c386b33dc82..28d541513cff 100644 --- a/svtools/source/contnr/templwin.cxx +++ b/svtools/source/contnr/templwin.cxx @@ -37,14 +37,14 @@ #include #include #include -#include +#include #include "imagemgr.hxx" #include #include "templatefoldercache.hxx" #include "imgdef.hxx" #include "txtattr.hxx" #ifndef _SVTOOLS_HRC -#include +#include #endif #ifndef _SVTOOLS_TEMPLWIN_HRC #include "templwin.hrc" diff --git a/svtools/source/contnr/templwin.hxx b/svtools/source/contnr/templwin.hxx index bd3eb4afd5dd..050ba7ab6739 100644 --- a/svtools/source/contnr/templwin.hxx +++ b/svtools/source/contnr/templwin.hxx @@ -38,7 +38,7 @@ #include "fileview.hxx" #include "ivctrl.hxx" #include -#include +#include #include #include diff --git a/svtools/source/contnr/templwin.src b/svtools/source/contnr/templwin.src index 30149de4da14..f7f42b7e176b 100644 --- a/svtools/source/contnr/templwin.src +++ b/svtools/source/contnr/templwin.src @@ -33,7 +33,7 @@ #include "templwin.hrc" #include "controldims.hrc" #include -#include +#include // Magenta and Grey as mask colors #define MASK_COL_MAGENTA Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx index 8ff008eaf7e4..481f6f2ceeae 100644 --- a/svtools/source/control/calendar.cxx +++ b/svtools/source/control/calendar.cxx @@ -62,7 +62,7 @@ #include #define _SV_CALENDAR_CXX -#include +#include #include #include diff --git a/svtools/source/control/calendar.src b/svtools/source/control/calendar.src index 44bffd361847..043dd9808663 100644 --- a/svtools/source/control/calendar.src +++ b/svtools/source/control/calendar.src @@ -28,7 +28,7 @@ * ************************************************************************/ -#include +#include String STR_SVT_CALENDAR_DAY { Text [ en-US ] = "Day" ; diff --git a/svtools/source/control/collatorres.cxx b/svtools/source/control/collatorres.cxx index 692d470b8f5b..c976d7442bc0 100644 --- a/svtools/source/control/collatorres.cxx +++ b/svtools/source/control/collatorres.cxx @@ -32,7 +32,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" #include -#include +#include #include diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 5be239a5593e..1ba8af0c8dca 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -43,7 +43,7 @@ #include #include -#include +#include #include #include diff --git a/svtools/source/control/ctrlbox.src b/svtools/source/control/ctrlbox.src index 5cfee79e5f11..05c75577cdbf 100644 --- a/svtools/source/control/ctrlbox.src +++ b/svtools/source/control/ctrlbox.src @@ -27,7 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include +#include #ifndef IMAGE_STDBTN_COLOR #define IMAGE_STDBTN_COLOR Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; } diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx index 77bb996584bd..1573ed531662 100644 --- a/svtools/source/control/ctrltool.cxx +++ b/svtools/source/control/ctrltool.cxx @@ -45,7 +45,7 @@ #include #include -#include +#include #include #include diff --git a/svtools/source/control/ctrltool.src b/svtools/source/control/ctrltool.src index 267a65e98517..ab8005cd9698 100644 --- a/svtools/source/control/ctrltool.src +++ b/svtools/source/control/ctrltool.src @@ -27,7 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include +#include String STR_SVT_STYLE_LIGHT { diff --git a/svtools/source/control/fileurlbox.cxx b/svtools/source/control/fileurlbox.cxx index 3ba69e826e1c..554f713fd4d6 100644 --- a/svtools/source/control/fileurlbox.cxx +++ b/svtools/source/control/fileurlbox.cxx @@ -32,7 +32,7 @@ #include "precompiled_svtools.hxx" #include #include -#include "svtools/filenotation.hxx" +#include "svl/filenotation.hxx" //......................................................................... namespace svt diff --git a/svtools/source/control/fmtfield.cxx b/svtools/source/control/fmtfield.cxx index 387c1db34fc1..bbf00329cf93 100644 --- a/svtools/source/control/fmtfield.cxx +++ b/svtools/source/control/fmtfield.cxx @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include @@ -45,7 +45,7 @@ #include #include #include -#include +#include #ifndef REGEXP_SUPPORT #include diff --git a/svtools/source/control/indexentryres.cxx b/svtools/source/control/indexentryres.cxx index 49096144b215..f69e9b34e5ea 100644 --- a/svtools/source/control/indexentryres.cxx +++ b/svtools/source/control/indexentryres.cxx @@ -32,7 +32,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" #include -#include +#include #include diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index 89f4a988aec2..b4904afee418 100644 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -67,15 +67,15 @@ #endif #include #include -#include -#include -#include -#include -#include "svtools/urihelper.hxx" +#include +#include +#include +#include +#include "svl/urihelper.hxx" #include #define _SVSTDARR_STRINGSDTOR -#include +#include #include #include #include @@ -83,7 +83,7 @@ #include "iodlg.hrc" #include -#include +#include #include #include diff --git a/svtools/source/control/taskstat.cxx b/svtools/source/control/taskstat.cxx index 86098af7de4a..82165a711285 100644 --- a/svtools/source/control/taskstat.cxx +++ b/svtools/source/control/taskstat.cxx @@ -43,7 +43,7 @@ #include #include -#include +#include #include // ======================================================================= diff --git a/svtools/source/control/urlcontrol.cxx b/svtools/source/control/urlcontrol.cxx index 4ad0969dd732..899867414e2f 100644 --- a/svtools/source/control/urlcontrol.cxx +++ b/svtools/source/control/urlcontrol.cxx @@ -32,7 +32,7 @@ #include "precompiled_svtools.hxx" #include -#include "svtools/filenotation.hxx" +#include "svl/filenotation.hxx" //......................................................................... namespace svt diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx index ca7064e101fa..aa18a3683916 100644 --- a/svtools/source/dialogs/addresstemplate.cxx +++ b/svtools/source/dialogs/addresstemplate.cxx @@ -39,7 +39,7 @@ #include "addresstemplate.hrc" #endif #ifndef _SVTOOLS_HRC -#include +#include #endif #ifndef _SVT_HELPID_HRC #include @@ -70,7 +70,7 @@ #include #include "localresaccess.hxx" #ifndef SVTOOLS_FILENOTATION_HXX_ -#include "svtools/filenotation.hxx" +#include "svl/filenotation.hxx" #endif #include @@ -324,8 +324,20 @@ public: virtual void setDatasourceName(const ::rtl::OUString& _rName); virtual void setCommand(const ::rtl::OUString& _rCommand); + + virtual void Notify( const com::sun::star::uno::Sequence& aPropertyNames); + virtual void Commit(); }; + +void AssignmentPersistentData::Notify( const com::sun::star::uno::Sequence& ) +{ +} + +void AssignmentPersistentData::Commit() +{ +} + // ------------------------------------------------------------------- AssignmentPersistentData::AssignmentPersistentData() :ConfigItem( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.DataAccess/AddressBook" ))) diff --git a/svtools/source/dialogs/addresstemplate.src b/svtools/source/dialogs/addresstemplate.src index 9c4997cae9d2..63c0e6475597 100644 --- a/svtools/source/dialogs/addresstemplate.src +++ b/svtools/source/dialogs/addresstemplate.src @@ -29,7 +29,7 @@ ************************************************************************/ #ifndef _SVTOOLS_HRC -#include +#include #endif #ifndef _SVT_ADDRESSTEMPLATE_HRC_ #include "addresstemplate.hrc" diff --git a/svtools/source/dialogs/logindlg.cxx b/svtools/source/dialogs/logindlg.cxx index 7ac65a77947d..791e373086af 100644 --- a/svtools/source/dialogs/logindlg.cxx +++ b/svtools/source/dialogs/logindlg.cxx @@ -38,7 +38,7 @@ #include "logindlg.hrc" #endif #ifndef _SVTOOLS_HRC -#include +#include #endif #include diff --git a/svtools/source/dialogs/logindlg.src b/svtools/source/dialogs/logindlg.src index 897597f383bf..b3ef357bbae4 100644 --- a/svtools/source/dialogs/logindlg.src +++ b/svtools/source/dialogs/logindlg.src @@ -29,7 +29,7 @@ ************************************************************************/ #ifndef _SVTOOLS_HRC -#include +#include #endif #ifndef _SVTOOLS_LOGINDLG_HRC_ diff --git a/svtools/source/dialogs/printdlg.cxx b/svtools/source/dialogs/printdlg.cxx index 5aeea754aef2..f2b269e13b6a 100644 --- a/svtools/source/dialogs/printdlg.cxx +++ b/svtools/source/dialogs/printdlg.cxx @@ -47,7 +47,7 @@ #include #include #include -#include "svtools/pickerhelper.hxx" +#include "svl/pickerhelper.hxx" #ifndef _SVT_HELPID_HRC #include #endif diff --git a/svtools/source/dialogs/printdlg.hrc b/svtools/source/dialogs/printdlg.hrc index cae57cefdb0e..2f2f43e3ba10 100644 --- a/svtools/source/dialogs/printdlg.hrc +++ b/svtools/source/dialogs/printdlg.hrc @@ -28,7 +28,7 @@ * ************************************************************************/ -#include +#include #define FL_PRINTER 1 #define LB_NAMES 2 diff --git a/svtools/source/dialogs/prnsetup.hrc b/svtools/source/dialogs/prnsetup.hrc index 33f98f7ed5e0..00623d97084c 100644 --- a/svtools/source/dialogs/prnsetup.hrc +++ b/svtools/source/dialogs/prnsetup.hrc @@ -27,7 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include +#include #define FL_PRINTER 1 #define LB_NAMES 2 diff --git a/svtools/source/dialogs/propctrl.hxx b/svtools/source/dialogs/propctrl.hxx index b2698f6a1c8e..59019fc21b90 100644 --- a/svtools/source/dialogs/propctrl.hxx +++ b/svtools/source/dialogs/propctrl.hxx @@ -34,7 +34,7 @@ #include "sbx.hxx" #include "sbxbase.hxx" #include "sbxres.hxx" -#include +#include */ diff --git a/svtools/source/dialogs/roadmapwizard.cxx b/svtools/source/dialogs/roadmapwizard.cxx index b0fff49e5e8d..c7473e446986 100644 --- a/svtools/source/dialogs/roadmapwizard.cxx +++ b/svtools/source/dialogs/roadmapwizard.cxx @@ -32,7 +32,7 @@ #include "precompiled_svtools.hxx" #include -#include +#include #include #include "roadmap.hxx" #include diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx index c436256a31c4..602c2e3e6f8a 100644 --- a/svtools/source/dialogs/wizardmachine.cxx +++ b/svtools/source/dialogs/wizardmachine.cxx @@ -36,7 +36,7 @@ #include #include #ifndef _SVTOOLS_HRC -#include +#include #endif //......................................................................... diff --git a/svtools/source/dialogs/wizardmachine.src b/svtools/source/dialogs/wizardmachine.src index d83fdd98824b..2fa50ef20bf6 100644 --- a/svtools/source/dialogs/wizardmachine.src +++ b/svtools/source/dialogs/wizardmachine.src @@ -29,7 +29,7 @@ ************************************************************************/ #ifndef _SVTOOLS_HRC -#include +#include #endif String STR_WIZDLG_FINISH diff --git a/svtools/source/edit/svmedit.cxx b/svtools/source/edit/svmedit.cxx index aeb1964b3893..8c60a62063df 100644 --- a/svtools/source/edit/svmedit.cxx +++ b/svtools/source/edit/svmedit.cxx @@ -43,11 +43,11 @@ #include #include -#include -#include +#include +#include #include -#include -#include +#include +#include // IDs erstmal aus VCL geklaut, muss mal richtig delivert werden... diff --git a/svtools/source/edit/textdat2.hxx b/svtools/source/edit/textdat2.hxx index 51336e75741e..7ee667db2305 100644 --- a/svtools/source/edit/textdat2.hxx +++ b/svtools/source/edit/textdat2.hxx @@ -32,7 +32,7 @@ #ifndef _TEXTDAT2_HXX #define _TEXTDAT2_HXX -#include +#include #include #include #include diff --git a/svtools/source/edit/textdoc.hxx b/svtools/source/edit/textdoc.hxx index 45b03e70ac47..b940bb6f4da7 100644 --- a/svtools/source/edit/textdoc.hxx +++ b/svtools/source/edit/textdoc.hxx @@ -31,7 +31,7 @@ #ifndef _TEXTDOC_HXX #define _TEXTDOC_HXX -#include +#include #include #include diff --git a/svtools/source/edit/texteng.cxx b/svtools/source/edit/texteng.cxx index e7eff8385206..596ca89054e7 100644 --- a/svtools/source/edit/texteng.cxx +++ b/svtools/source/edit/texteng.cxx @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include diff --git a/svtools/source/edit/textundo.hxx b/svtools/source/edit/textundo.hxx index fe2c53bca45e..7ce7169e1563 100644 --- a/svtools/source/edit/textundo.hxx +++ b/svtools/source/edit/textundo.hxx @@ -30,7 +30,7 @@ #ifndef _TEXTUNDO_HXX #define _TEXTUNDO_HXX -#include +#include class TextEngine; diff --git a/svtools/source/edit/textview.cxx b/svtools/source/edit/textview.cxx index c21bd70b3fd9..99b6fc900885 100644 --- a/svtools/source/edit/textview.cxx +++ b/svtools/source/edit/textview.cxx @@ -36,7 +36,7 @@ #include #include -#include +#include #include #include #include @@ -44,7 +44,7 @@ #include #include -#include +#include #ifndef _COM_SUN_STAR_TEXT_XBREAKITERATOR_HPP_ #include diff --git a/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx b/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx index 1bc83575ec38..584814dd9e92 100644 --- a/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx +++ b/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx @@ -37,7 +37,7 @@ #include "FilterConfigCache.hxx" #include #include -#include +#include #include #include "dlgexpor.hxx" #include "dlgejpg.hxx" @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include "vcl/svapp.hxx" #if defined WIN || (defined OS2 && !defined ICC) diff --git a/svtools/source/filter.vcl/filter/dlgejpg.hrc b/svtools/source/filter.vcl/filter/dlgejpg.hrc index 4342a89d1d24..67ac915df367 100644 --- a/svtools/source/filter.vcl/filter/dlgejpg.hrc +++ b/svtools/source/filter.vcl/filter/dlgejpg.hrc @@ -27,7 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include +#include #define BTN_OK 1 #define BTN_CANCEL 1 diff --git a/svtools/source/filter.vcl/filter/dlgepng.hrc b/svtools/source/filter.vcl/filter/dlgepng.hrc index 79d4b189aa5a..d687141abf56 100644 --- a/svtools/source/filter.vcl/filter/dlgepng.hrc +++ b/svtools/source/filter.vcl/filter/dlgepng.hrc @@ -27,7 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include +#include #define BTN_OK 1 #define BTN_CANCEL 1 diff --git a/svtools/source/filter.vcl/filter/dlgexpor.hrc b/svtools/source/filter.vcl/filter/dlgexpor.hrc index 28921b5f178c..cae15d7276d2 100644 --- a/svtools/source/filter.vcl/filter/dlgexpor.hrc +++ b/svtools/source/filter.vcl/filter/dlgexpor.hrc @@ -27,7 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include +#include #define BTN_OK_PIX 1 #define BTN_CANCEL_PIX 1 diff --git a/svtools/source/filter.vcl/filter/filter.cxx b/svtools/source/filter.vcl/filter/filter.cxx index 3586ddd02ddd..306307a0bf91 100644 --- a/svtools/source/filter.vcl/filter/filter.cxx +++ b/svtools/source/filter.vcl/filter/filter.cxx @@ -54,7 +54,7 @@ #include "jpeg.hxx" #include "xbmread.hxx" #include "xpmread.hxx" -#include +#include #include "strings.hrc" #include "sgffilt.hxx" #include "osl/module.hxx" diff --git a/svtools/source/filter.vcl/filter/strings.hrc b/svtools/source/filter.vcl/filter/strings.hrc index 0cfa4e6bf7c4..a3356982609a 100644 --- a/svtools/source/filter.vcl/filter/strings.hrc +++ b/svtools/source/filter.vcl/filter/strings.hrc @@ -27,4 +27,4 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include +#include diff --git a/svtools/source/inc/iodlg.hrc b/svtools/source/inc/iodlg.hrc index 36e3092064cd..9c41e06a2b6c 100644 --- a/svtools/source/inc/iodlg.hrc +++ b/svtools/source/inc/iodlg.hrc @@ -32,7 +32,7 @@ #define _SVTOOLS_IODLGIMPL_HRC #ifndef _SVTOOLS_HRC -#include +#include #endif // ModalDialog DLG_SVT_EXPLORERFILE diff --git a/svtools/source/inc/property.hxx b/svtools/source/inc/property.hxx index cfdc62dd350c..2a756f177608 100644 --- a/svtools/source/inc/property.hxx +++ b/svtools/source/inc/property.hxx @@ -54,17 +54,17 @@ #endif #include #include -#include +#include #define _SVSTDARR_USHORTS -#include +#include #include #include -#include +#include #ifndef _SVSTDARR_STRINGS #define _SVSTDARR_STRINGS -#include +#include #endif #include #include diff --git a/svtools/source/java/javaerror.src b/svtools/source/java/javaerror.src index 3063bcd994d5..3460df859c2b 100644 --- a/svtools/source/java/javaerror.src +++ b/svtools/source/java/javaerror.src @@ -28,7 +28,7 @@ * ************************************************************************/ -#include +#include WarningBox WARNINGBOX_JAVANOTFOUND { diff --git a/svtools/source/java/javainteractionhandler.cxx b/svtools/source/java/javainteractionhandler.cxx index 30f8775a6d5f..a7808c80992b 100644 --- a/svtools/source/java/javainteractionhandler.cxx +++ b/svtools/source/java/javainteractionhandler.cxx @@ -33,7 +33,7 @@ -#include +#include #include #include #include diff --git a/svtools/source/java/patchjavaerror.src b/svtools/source/java/patchjavaerror.src index bfdfd5a8bcba..2d2ad06a9592 100644 --- a/svtools/source/java/patchjavaerror.src +++ b/svtools/source/java/patchjavaerror.src @@ -28,7 +28,7 @@ * ************************************************************************/ -#include +#include WarningBox WARNINGBOX_JAVANOTFOUND { diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx index 6e89193f1b6b..4084aa47bc80 100644 --- a/svtools/source/misc/ehdl.cxx +++ b/svtools/source/misc/ehdl.cxx @@ -45,7 +45,7 @@ #include #include -#include +#include #include "sfxecode.hxx" //========================================================================= diff --git a/svtools/source/misc/ehdl.src b/svtools/source/misc/ehdl.src index ed32172a92e2..5267d13765c3 100644 --- a/svtools/source/misc/ehdl.src +++ b/svtools/source/misc/ehdl.src @@ -29,7 +29,7 @@ ************************************************************************/ #define __RSC -#include +#include #include "sfxecode.hxx" // pragma ---------------------------------------------------------------- diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx index ba21db8a8e76..93a75681da52 100644 --- a/svtools/source/misc/embedhlp.cxx +++ b/svtools/source/misc/embedhlp.cxx @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include diff --git a/svtools/source/misc/errtxt.src b/svtools/source/misc/errtxt.src index ebd922bfedf7..3ab58ef92dbf 100644 --- a/svtools/source/misc/errtxt.src +++ b/svtools/source/misc/errtxt.src @@ -29,7 +29,7 @@ ************************************************************************/ #define __RSC -#include +#include #include "sfxecode.hxx" // pragma ---------------------------------------------------------------- Resource RID_ERRCTX diff --git a/svtools/source/misc/helpagent.src b/svtools/source/misc/helpagent.src index 3b9e2a450ec1..181583bc8f6d 100644 --- a/svtools/source/misc/helpagent.src +++ b/svtools/source/misc/helpagent.src @@ -29,7 +29,7 @@ ************************************************************************/ #ifndef _SVTOOLS_HRC -#include +#include #endif Bitmap BMP_HELP_AGENT_IMAGE diff --git a/svtools/source/misc/helpagentwindow.cxx b/svtools/source/misc/helpagentwindow.cxx index 368c55a94ade..51cd7ebfb740 100644 --- a/svtools/source/misc/helpagentwindow.cxx +++ b/svtools/source/misc/helpagentwindow.cxx @@ -39,7 +39,7 @@ #include #ifndef _SVTOOLS_HRC -#include +#include #endif #ifndef _SVT_HELPID_HRC #include diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx index ddf6a7350772..76752b27354e 100644 --- a/svtools/source/misc/imagemgr.cxx +++ b/svtools/source/misc/imagemgr.cxx @@ -55,7 +55,7 @@ #include #include -#include +#include #include "imagemgr.hrc" #include #include diff --git a/svtools/source/misc/imagemgr.src b/svtools/source/misc/imagemgr.src index 0aada34305da..e082398beaa1 100644 --- a/svtools/source/misc/imagemgr.src +++ b/svtools/source/misc/imagemgr.src @@ -29,7 +29,7 @@ ************************************************************************/ // includes ****************************************************************** -#include +#include #include "imagemgr.hrc" // images ******************************************************************** diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx index 8ea4296d6db3..df7760f7931b 100644 --- a/svtools/source/misc/imap.cxx +++ b/svtools/source/misc/imap.cxx @@ -36,7 +36,7 @@ #include #include -#include "svtools/urihelper.hxx" +#include "svl/urihelper.hxx" #include #include #include diff --git a/svtools/source/misc/imap2.cxx b/svtools/source/misc/imap2.cxx index dc18e1a9c24b..1dd10c36c81a 100644 --- a/svtools/source/misc/imap2.cxx +++ b/svtools/source/misc/imap2.cxx @@ -43,7 +43,7 @@ #endif #include -#include "svtools/urihelper.hxx" +#include "svl/urihelper.hxx" #include #include #include diff --git a/svtools/source/misc/itemdel.cxx b/svtools/source/misc/itemdel.cxx index 4028aa497c22..9db70f852d30 100644 --- a/svtools/source/misc/itemdel.cxx +++ b/svtools/source/misc/itemdel.cxx @@ -37,8 +37,8 @@ #include #include -#include -#include +#include +#include // STATIC DATA ----------------------------------------------------------- diff --git a/svtools/source/misc/langtab.cxx b/svtools/source/misc/langtab.cxx index 870e6378a216..ef2cedcc50c2 100644 --- a/svtools/source/misc/langtab.cxx +++ b/svtools/source/misc/langtab.cxx @@ -42,10 +42,10 @@ #include #include -#include +#include #include #include -#include +#include using namespace ::com::sun::star; diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src index 4458d4b0f132..0aa90f8e96b9 100644 --- a/svtools/source/misc/langtab.src +++ b/svtools/source/misc/langtab.src @@ -29,7 +29,7 @@ ************************************************************************/ // include --------------------------------------------------------------- -#include +#include #define RSC_RESOURCE_USAGE 1 #include diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index e2cd8f803a04..4a814637e1af 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -76,7 +76,7 @@ #include #include -#include "svtools/urlbmk.hxx" +#include "svl/urlbmk.hxx" #include "inetimg.hxx" #include #include diff --git a/svtools/source/misc/transfer2.cxx b/svtools/source/misc/transfer2.cxx index eebf91ab57ff..027dbc31572d 100644 --- a/svtools/source/misc/transfer2.cxx +++ b/svtools/source/misc/transfer2.cxx @@ -50,7 +50,7 @@ #include #endif -#include "svtools/urlbmk.hxx" +#include "svl/urlbmk.hxx" #include "inetimg.hxx" #include #include diff --git a/svtools/source/misc/wallitem.cxx b/svtools/source/misc/wallitem.cxx index 32797f69a48c..6ceb414db003 100644 --- a/svtools/source/misc/wallitem.cxx +++ b/svtools/source/misc/wallitem.cxx @@ -52,7 +52,7 @@ #include #include "wallitem.hxx" -#include +#include // ----------------------------------------------------------------------- diff --git a/svtools/source/plugapp/testtool.src b/svtools/source/plugapp/testtool.src index 599675a6c494..78b63c2fb819 100644 --- a/svtools/source/plugapp/testtool.src +++ b/svtools/source/plugapp/testtool.src @@ -28,7 +28,7 @@ * ************************************************************************/ #include "testtool.hrc" -#include +#include #define Control_Control 5 diff --git a/svtools/source/productregistration/productregistration.cxx b/svtools/source/productregistration/productregistration.cxx index 4f9d1bb476ef..f5fc03337cd6 100644 --- a/svtools/source/productregistration/productregistration.cxx +++ b/svtools/source/productregistration/productregistration.cxx @@ -35,7 +35,7 @@ #include "unotools/regoptions.hxx" #include "registrationdlg.hxx" #ifndef _SVTOOLS_HRC -#include +#include #endif #include "cppuhelper/factory.hxx" #include diff --git a/svtools/source/productregistration/registrationdlg.cxx b/svtools/source/productregistration/registrationdlg.cxx index 83018cfa804b..d3969828cb1f 100644 --- a/svtools/source/productregistration/registrationdlg.cxx +++ b/svtools/source/productregistration/registrationdlg.cxx @@ -35,7 +35,7 @@ #if 0 /* @@@ */ #include #ifndef _SVTOOLS_HRC -#include +#include #endif #endif /* @@@ */ diff --git a/svtools/source/productregistration/registrationdlg.src b/svtools/source/productregistration/registrationdlg.src index 86024ef765cd..f9462a420061 100644 --- a/svtools/source/productregistration/registrationdlg.src +++ b/svtools/source/productregistration/registrationdlg.src @@ -32,7 +32,7 @@ #include "registrationdlg.hrc" #endif #ifndef _SVTOOLS_HRC -#include +#include #endif #ifndef _SVT_HELPID_HRC #include diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx index 9783188e3b7c..5bb26367075e 100644 --- a/svtools/source/svhtml/htmlout.cxx +++ b/svtools/source/svhtml/htmlout.cxx @@ -32,11 +32,11 @@ #include "precompiled_svtools.hxx" #include -#include -#include +#include +#include #include #include -#include +#include #include #include "htmlkywd.hxx" @@ -44,7 +44,7 @@ #include #include #include -#include "svtools/urihelper.hxx" +#include "svl/urihelper.hxx" #ifndef RTL_CONSTASCII_STRINGPARAM #define RTL_CONSTASCII_STRINGPARAM( c ) c, sizeof(c)-1 diff --git a/svtools/source/svhtml/htmlsupp.cxx b/svtools/source/svhtml/htmlsupp.cxx index 11f48e7fdf5d..9103161afb51 100644 --- a/svtools/source/svhtml/htmlsupp.cxx +++ b/svtools/source/svhtml/htmlsupp.cxx @@ -36,7 +36,7 @@ #include #ifndef _SVSTDARR_HXX #define _SVSTDARR_ULONGS -#include +#include #endif #include diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index 215133c8efb4..b4eb6c05cffd 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -40,12 +40,12 @@ #include #ifndef _SVSTDARR_HXX #define _SVSTDARR_ULONGS -#include +#include #endif #include #include -#include +#include #include #include #include diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx index 6d6f4f059545..2af7af71adac 100644 --- a/svtools/source/svrtf/svparser.cxx +++ b/svtools/source/svrtf/svparser.cxx @@ -37,7 +37,7 @@ #include #include #define _SVSTDARR_USHORTS -#include +#include #include #include diff --git a/svtools/source/uno/unoevent.cxx b/svtools/source/uno/unoevent.cxx index 19d40c17ce5c..6fc8b0017ad8 100644 --- a/svtools/source/uno/unoevent.cxx +++ b/svtools/source/uno/unoevent.cxx @@ -40,7 +40,7 @@ #include #include #include "unoevent.hxx" -#include +#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; diff --git a/svtools/source/uno/unoifac2.hrc b/svtools/source/uno/unoifac2.hrc index 4e8cf0303da5..4f46edffdc51 100644 --- a/svtools/source/uno/unoifac2.hrc +++ b/svtools/source/uno/unoifac2.hrc @@ -33,7 +33,7 @@ #ifndef _SOLAR_HRC -#include +#include #endif //! Um den berblick ber alle benutzten HelpID's zu behalten sind diese diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx index cc367c5a0264..711abe1b6617 100644 --- a/svtools/source/uno/unoiface.cxx +++ b/svtools/source/uno/unoiface.cxx @@ -48,7 +48,7 @@ #include #include #include -#include +#include #include #include diff --git a/svtools/workben/unodialog/udlg_global.hrc b/svtools/workben/unodialog/udlg_global.hrc index 71a67cd2b7e8..bde0e5e86ce2 100644 --- a/svtools/workben/unodialog/udlg_global.hrc +++ b/svtools/workben/unodialog/udlg_global.hrc @@ -31,7 +31,7 @@ #ifndef SVTOOLS_UDLG_GLOBAL_HRC #define SVTOOLS_UDLG_GLOBAL_HRC -#include +#include //===================================================================== //= bases diff --git a/unotools/inc/unotools/configitem.hxx b/unotools/inc/unotools/configitem.hxx index 0e938cedd47f..3cc0dc1b079e 100644 --- a/unotools/inc/unotools/configitem.hxx +++ b/unotools/inc/unotools/configitem.hxx @@ -186,7 +186,7 @@ namespace utl /** is called from the ConfigManager before application ends of from the PropertyChangeListener if the sub tree broadcasts changes. */ - virtual void Notify( const com::sun::star::uno::Sequence& aPropertyNames); + virtual void Notify( const com::sun::star::uno::Sequence& aPropertyNames)=0; /** is called from the ConfigManager if it is destroyed before the ConfigItem. */ void ReleaseConfigMgr(); @@ -201,7 +201,7 @@ namespace utl sal_Bool IsModified() const; /** writes the changed values into the sub tree. Always called in the Dtor of the derived class. */ - virtual void Commit(); + virtual void Commit()=0; sal_Bool IsInValueChange() const; diff --git a/unotools/inc/unotools/options.hxx b/unotools/inc/unotools/options.hxx index ca8d70657f0f..f7254589150d 100644 --- a/unotools/inc/unotools/options.hxx +++ b/unotools/inc/unotools/options.hxx @@ -34,26 +34,40 @@ #include "sal/config.h" #include "unotools/unotoolsdllapi.h" +/* + The class utl::detail::Options provides a kind of multiplexer. It implements a ConfigurationListener + that is usually registered at a ConfigItem class. At the same time it implements a ConfigurationBroadcaster + that allows further ("external") listeners to register. + Once the class deriving from Options is notified about + configuration changes by the ConfigItem if its content has been changed by calling some of its methods, + a call of the Options::NotifyListeners() method will send out notifications to all external listeners. +*/ + namespace utl { class ConfigurationBroadcaster; class IMPL_ConfigurationListenerList; + // interface for configuration listener class UNOTOOLS_DLLPUBLIC ConfigurationListener { public: - virtual void ConfigurationChanged( ConfigurationBroadcaster* ) = 0; + virtual void ConfigurationChanged( ConfigurationBroadcaster* p, sal_uInt32 nHint=0 ) = 0; }; + // complete broadcasting implementation class UNOTOOLS_DLLPUBLIC ConfigurationBroadcaster { IMPL_ConfigurationListenerList* mpList; sal_Int32 m_nBroadcastBlocked; // broadcast only if this is 0 + sal_uInt32 m_nBlockedHint; public: void AddListener( utl::ConfigurationListener* pListener ); void RemoveListener( utl::ConfigurationListener* pListener ); - void NotifyListeners(); + + // notify listeners; nHint is an implementation detail of the particular class deriving from ConfigurationBroadcaster + void NotifyListeners( sal_uInt32 nHint ); ConfigurationBroadcaster(); ~ConfigurationBroadcaster(); void BlockBroadcasts( bool bBlock ); @@ -63,7 +77,9 @@ namespace detail { // A base class for the various option classes supported by // unotools/source/config/itemholderbase.hxx (which must be public, as it is -// shared between svl and svt): +// shared between unotools, svl and svt) +// It also provides an implementation for a Configuration Listener and inherits a broadcaster implementation + class UNOTOOLS_DLLPUBLIC Options : public utl::ConfigurationBroadcaster, public utl::ConfigurationListener { public: @@ -74,7 +90,9 @@ public: private: UNOTOOLS_DLLPRIVATE Options(Options &); // not defined UNOTOOLS_DLLPRIVATE void operator =(Options &); // not defined - virtual void ConfigurationChanged( utl::ConfigurationBroadcaster* ); + +protected: + virtual void ConfigurationChanged( ::utl::ConfigurationBroadcaster* p, sal_uInt32 nHint=0 ); }; } } diff --git a/unotools/inc/unotools/syslocale.hxx b/unotools/inc/unotools/syslocale.hxx index 87482abbb117..adce66b7e84a 100644 --- a/unotools/inc/unotools/syslocale.hxx +++ b/unotools/inc/unotools/syslocale.hxx @@ -28,8 +28,8 @@ * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_SYSLOCALE_HXX -#define INCLUDED_SVTOOLS_SYSLOCALE_HXX +#ifndef INCLUDED_UNOTOOLS_SYSLOCALE_HXX +#define INCLUDED_UNOTOOLS_SYSLOCALE_HXX #include "unotools/unotoolsdllapi.h" #include @@ -77,6 +77,8 @@ public: SvtSysLocaleOptions& GetOptions() const; com::sun::star::lang::Locale GetLocale() const; LanguageType GetLanguage() const; + com::sun::star::lang::Locale GetUILocale() const; + LanguageType GetUILanguage() const; }; #endif // INCLUDED_SVTOOLS_SYSLOCALE_HXX diff --git a/unotools/inc/unotools/syslocaleoptions.hxx b/unotools/inc/unotools/syslocaleoptions.hxx index 6c48c83a8500..2da102c161cc 100644 --- a/unotools/inc/unotools/syslocaleoptions.hxx +++ b/unotools/inc/unotools/syslocaleoptions.hxx @@ -43,6 +43,8 @@ // bits for broadcasting hints of changes in a SfxSimpleHint, may be combined const ULONG SYSLOCALEOPTIONS_HINT_LOCALE = 0x00000001; const ULONG SYSLOCALEOPTIONS_HINT_CURRENCY = 0x00000002; +const ULONG SYSLOCALEOPTIONS_HINT_UILOCALE = 0x00000004; +const ULONG SYSLOCALEOPTIONS_HINT_DECSEP = 0x00000008; class SvtSysLocaleOptions_Impl; class SvtListener; @@ -54,12 +56,14 @@ class UNOTOOLS_DLLPUBLIC SvtSysLocaleOptions: public utl::detail::Options static sal_Int32 nRefCount; UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetMutex(); + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster* p, sal_uInt32 nHint ); public: enum EOption { E_LOCALE, + E_UILOCALE, E_CURRENCY }; SvtSysLocaleOptions(); @@ -102,6 +106,12 @@ public: /// The config string may be empty to denote the SYSTEM locale const ::rtl::OUString& GetLocaleConfigString() const; void SetLocaleConfigString( const ::rtl::OUString& rStr ); + com::sun::star::lang::Locale GetLocale() const; + + /// The config string may be empty to denote the SYSTEM locale + const ::rtl::OUString& GetUILocaleConfigString() const; + void SetUILocaleConfigString( const ::rtl::OUString& rStr ); + com::sun::star::lang::Locale GetUILocale() const; /// The config string may be empty to denote the default currency of the locale const ::rtl::OUString& GetCurrencyConfigString() const; @@ -113,11 +123,6 @@ public: // convenience methods - /** Get the LanguageType of the current locale, may be LANGUAGE_SYSTEM if - LocaleConfigString is empty. If you need the real locale used in the - application, call Application::GetSettings().GetLanguage() instead */ - LanguageType GetLocaleLanguageType() const; - /// Get currency abbreviation and locale from an USD-en-US or EUR-de-DE string static void GetCurrencyAbbrevAndLanguage( String& rAbbrev, diff --git a/unotools/source/config/cacheoptions.cxx b/unotools/source/config/cacheoptions.cxx index c226e8b80921..dc8031ea0078 100644 --- a/unotools/source/config/cacheoptions.cxx +++ b/unotools/source/config/cacheoptions.cxx @@ -94,6 +94,7 @@ public: //--------------------------------------------------------------------------------------------------------- virtual void Commit(); + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); //--------------------------------------------------------------------------------------------------------- // public interface @@ -247,6 +248,10 @@ void SvtCacheOptions_Impl::Commit() PutProperties( aSeqNames, aSeqValues ); } +void SvtCacheOptions_Impl::Notify( const Sequence< rtl::OUString >& ) +{ +} + //***************************************************************************************************************** // public method //***************************************************************************************************************** diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx index ad83b9b79cae..3d70f99f4ec0 100644 --- a/unotools/source/config/configitem.cxx +++ b/unotools/source/config/configitem.cxx @@ -83,6 +83,13 @@ catch(Exception& rEx) \ #define CATCH_INFO(a) catch(Exception& ){} #endif +/* + The ConfigChangeListener_Impl receives notifications from the configuration about changes that + have happened. It forwards this notification to the ConfigItem it knows a pParent by calling its + "CallNotify" method. As ConfigItems are most probably not thread safe, the SolarMutex is acquired + before doing so. +*/ + namespace utl{ class ConfigChangeListener_Impl : public cppu::WeakImplHelper1 < @@ -277,13 +284,6 @@ ConfigItem::~ConfigItem() } delete pImpl; } -/* -----------------------------29.08.00 12:52-------------------------------- - - ---------------------------------------------------------------------------*/ -void ConfigItem::Commit() -{ - OSL_ENSURE(sal_False, "Base class called"); -} /* -----------------------------29.08.00 12:52-------------------------------- ---------------------------------------------------------------------------*/ @@ -308,18 +308,13 @@ void ConfigItem::ReleaseConfigMgr() ---------------------------------------------------------------------------*/ void ConfigItem::CallNotify( const com::sun::star::uno::Sequence& rPropertyNames ) { + // the call is forwarded to the virtual Notify() method + // it is pure virtual, so all classes deriving from ConfigItem have to decide how they + // want to notify listeners if(!IsInValueChange() || pImpl->bEnableInternalNotification) Notify(rPropertyNames); - NotifyListeners(); } -/* -----------------------------29.08.00 12:52-------------------------------- - - ---------------------------------------------------------------------------*/ -void ConfigItem::Notify( const com::sun::star::uno::Sequence& /*rPropertyNames*/) -{ - OSL_ENSURE(sal_False, "Base class called"); -} /* -----------------------------12.12.00 17:09-------------------------------- ---------------------------------------------------------------------------*/ diff --git a/unotools/source/config/defaultoptions.cxx b/unotools/source/config/defaultoptions.cxx index 36c79b451f45..baaa4a220a93 100644 --- a/unotools/source/config/defaultoptions.cxx +++ b/unotools/source/config/defaultoptions.cxx @@ -111,6 +111,8 @@ public: SvtDefaultOptions_Impl(); String GetDefaultPath( USHORT nId ) const; + virtual void Commit(); + virtual void Notify( const com::sun::star::uno::Sequence& aPropertyNames); }; // global ---------------------------------------------------------------- @@ -189,6 +191,16 @@ Sequence< OUString > GetDefaultPropertyNames() return aNames; } +void SvtDefaultOptions_Impl::Notify( const Sequence< rtl::OUString >& ) +{ + // no notification, will never be changed +} + +void SvtDefaultOptions_Impl::Commit() +{ + // will never be changed +} + // class SvtDefaultOptions_Impl ------------------------------------------ String SvtDefaultOptions_Impl::GetDefaultPath( USHORT nId ) const diff --git a/unotools/source/config/fltrcfg.cxx b/unotools/source/config/fltrcfg.cxx index 7050e4734401..a0870ff6a8a5 100644 --- a/unotools/source/config/fltrcfg.cxx +++ b/unotools/source/config/fltrcfg.cxx @@ -81,6 +81,7 @@ public: bSaveVBA(sal_False) {} ~SvtAppFilterOptions_Impl(); virtual void Commit(); + virtual void Notify( const com::sun::star::uno::Sequence& aPropertyNames); void Load(); sal_Bool IsLoad() const {return bLoadVBA;} @@ -125,6 +126,13 @@ void SvtAppFilterOptions_Impl::Commit() PutProperties(aNames, aValues); } + +void SvtAppFilterOptions_Impl::Notify( const Sequence< rtl::OUString >& ) +{ + // no listeners supported yet +} + + /* -----------------------------22.01.01 10:38-------------------------------- ---------------------------------------------------------------------------*/ diff --git a/unotools/source/config/historyoptions.cxx b/unotools/source/config/historyoptions.cxx index 73d006a27507..0a28884e24c2 100644 --- a/unotools/source/config/historyoptions.cxx +++ b/unotools/source/config/historyoptions.cxx @@ -648,7 +648,7 @@ SvtHistoryOptions::SvtHistoryOptions() // ... and initialize ouer data container only if it not already exist! if( m_pDataContainer == NULL ) { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtHistoryOptions_Impl::ctor()"); + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtHistoryOptions_Impl::ctor()"); m_pDataContainer = new SvtHistoryOptions_Impl; ItemHolder1::holdConfigItem(E_HISTORYOPTIONS); diff --git a/unotools/source/config/javaoptions.cxx b/unotools/source/config/javaoptions.cxx index 91a74f43b886..0eec89a31782 100644 --- a/unotools/source/config/javaoptions.cxx +++ b/unotools/source/config/javaoptions.cxx @@ -57,6 +57,7 @@ public: SvtExecAppletsItem_Impl(); virtual void Commit(); + void Notify( const Sequence< rtl::OUString >& ); sal_Bool IsExecuteApplets() const {return bExecute;} void SetExecuteApplets(sal_Bool bSet); @@ -108,6 +109,10 @@ void SvtExecAppletsItem_Impl::Commit() PutProperties(aNames, aValues); } +void SvtExecAppletsItem_Impl::Notify( const Sequence< rtl::OUString >& ) +{ + // no listeners supported yet +} struct SvtJavaOptions_Impl { diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx index 25da00dd4a26..d4eff83efec6 100644 --- a/unotools/source/config/lingucfg.cxx +++ b/unotools/source/config/lingucfg.cxx @@ -229,6 +229,7 @@ SvtLinguConfigItem::~SvtLinguConfigItem() void SvtLinguConfigItem::Notify( const uno::Sequence< OUString > &rPropertyNames ) { LoadOptions( rPropertyNames ); + NotifyListeners(0); } @@ -573,6 +574,7 @@ BOOL SvtLinguConfigItem::SetProperty( INT32 nPropertyHandle, const uno::Any &rVa if (bMod) SetModified(); + NotifyListeners(0); return bSucc; } @@ -592,6 +594,7 @@ BOOL SvtLinguConfigItem::SetOptions( const SvtLinguOptions &rOptions ) aOpt = rOptions; SetModified(); + NotifyListeners(0); return TRUE; } diff --git a/unotools/source/config/localisationoptions.cxx b/unotools/source/config/localisationoptions.cxx index a341021ca926..2ac2524e7d08 100644 --- a/unotools/source/config/localisationoptions.cxx +++ b/unotools/source/config/localisationoptions.cxx @@ -271,6 +271,8 @@ void SvtLocalisationOptions_Impl::Notify( const Sequence< OUString >& seqPropert else DBG_ASSERT( sal_False, "SvtLocalisationOptions_Impl::Notify()\nUnkown property detected ... I can't handle these!\n" ); #endif } + + NotifyListeners(0); } //***************************************************************************************************************** diff --git a/unotools/source/config/options.cxx b/unotools/source/config/options.cxx index b4e9aec8c6dd..5bd2ed46f7ec 100644 --- a/unotools/source/config/options.cxx +++ b/unotools/source/config/options.cxx @@ -46,6 +46,7 @@ using utl::ConfigurationBroadcaster; ConfigurationBroadcaster::ConfigurationBroadcaster() : mpList(0) , m_nBroadcastBlocked( 0 ) +, m_nBlockedHint( 0 ) { } @@ -67,39 +68,42 @@ void ConfigurationBroadcaster::RemoveListener( utl::ConfigurationListener* pList mpList->Remove( pListener ); } -void ConfigurationBroadcaster::NotifyListeners() +void ConfigurationBroadcaster::NotifyListeners( sal_uInt32 nHint ) { -// if ( m_nBroadcastBlocked ) -// m_nBlockedHint |= nHint; -// else - if (!m_nBroadcastBlocked) + if ( m_nBroadcastBlocked ) + m_nBlockedHint |= nHint; + else { + nHint |= m_nBlockedHint; + m_nBlockedHint = 0; if ( mpList ) for ( sal_uInt32 n=0; nCount(); n++ ) - mpList->GetObject(n)->ConfigurationChanged(this); + mpList->GetObject(n)->ConfigurationChanged( this, nHint ); } } -Options::Options() +void ConfigurationBroadcaster::BlockBroadcasts( bool bBlock ) { + if ( bBlock ) + ++m_nBroadcastBlocked; + else if ( m_nBroadcastBlocked ) + { + if ( --m_nBroadcastBlocked == 0 ) + NotifyListeners( 0 ); + } } -Options::~Options() +Options::Options() { } -void Options::ConfigurationChanged( utl::ConfigurationBroadcaster* ) +Options::~Options() { - NotifyListeners(); } -void ConfigurationBroadcaster::BlockBroadcasts( bool bBlock ) +void Options::ConfigurationChanged( ConfigurationBroadcaster* p, sal_uInt32 nHint ) { - if ( bBlock ) - ++m_nBroadcastBlocked; - else if ( m_nBroadcastBlocked ) - { - if ( --m_nBroadcastBlocked == 0 ) - NotifyListeners(); - } + NotifyListeners( nHint ); } + + diff --git a/unotools/source/config/printwarningoptions.cxx b/unotools/source/config/printwarningoptions.cxx index c64064c8fadc..29dfabd45ea7 100644 --- a/unotools/source/config/printwarningoptions.cxx +++ b/unotools/source/config/printwarningoptions.cxx @@ -91,6 +91,7 @@ public: //--------------------------------------------------------------------------------------------------------- virtual void Commit(); + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); //--------------------------------------------------------------------------------------------------------- // public interface @@ -242,6 +243,10 @@ void SvtPrintWarningOptions_Impl::Commit() PutProperties( aSeqNames, aSeqValues ); } +void SvtPrintWarningOptions_Impl::Notify( const Sequence< rtl::OUString >& ) +{ +} + //***************************************************************************************************************** // private method //***************************************************************************************************************** diff --git a/unotools/source/config/searchopt.cxx b/unotools/source/config/searchopt.cxx index 7ca888e8ef7b..01fbd9a3216d 100644 --- a/unotools/source/config/searchopt.cxx +++ b/unotools/source/config/searchopt.cxx @@ -75,6 +75,7 @@ public: // ConfigItem virtual void Commit(); + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); BOOL GetFlag( USHORT nOffset ) const; void SetFlag( USHORT nOffset, BOOL bVal ); @@ -104,6 +105,10 @@ void SvtSearchOptions_Impl::Commit() Save(); } +void SvtSearchOptions_Impl::Notify( const Sequence< rtl::OUString >& ) +{ +} + BOOL SvtSearchOptions_Impl::GetFlag( USHORT nOffset ) const { diff --git a/unotools/source/config/sourceviewconfig.cxx b/unotools/source/config/sourceviewconfig.cxx index 46c926ffb86e..3de0276643bf 100644 --- a/unotools/source/config/sourceviewconfig.cxx +++ b/unotools/source/config/sourceviewconfig.cxx @@ -191,7 +191,7 @@ void SourceViewConfig_Impl::Commit() } PutProperties( aNames, aValues ); - NotifyListeners(); + NotifyListeners(0); } /*-- 28.08.2002 16:32:19--------------------------------------------------- diff --git a/unotools/source/config/syslocaleoptions.cxx b/unotools/source/config/syslocaleoptions.cxx index 3815136b27f0..6c4071709e02 100644 --- a/unotools/source/config/syslocaleoptions.cxx +++ b/unotools/source/config/syslocaleoptions.cxx @@ -31,21 +31,20 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_unotools.hxx" -#include -#include -#include +#include #include #include +#include +#include +#include +#include +#include #include #include -#include #include -#include -#include #include "itemholder1.hxx" - #define CFG_READONLY_DEFAULT sal_False using namespace osl; @@ -66,20 +65,18 @@ namespace class SvtSysLocaleOptions_Impl : public utl::ConfigItem { OUString m_aLocaleString; // en-US or de-DE or empty for SYSTEM - LanguageType m_eLocaleLanguageType; // same for convenience access + OUString m_aUILocaleString; // en-US or de-DE or empty for SYSTEM OUString m_aCurrencyString; // USD-en-US or EUR-de-DE ULONG m_nBlockedHint; // pending hints sal_Bool m_bDecimalSeparator; //use decimal separator same as locale sal_Bool m_bROLocale; + sal_Bool m_bROUILocale; sal_Bool m_bROCurrency; sal_Bool m_bRODecimalSeparator; static const Sequence< /* const */ OUString > GetPropertyNames(); - ULONG ChangeLocaleSettings(); - void ChangeDefaultCurrency() const; - public: SvtSysLocaleOptions_Impl(); virtual ~SvtSysLocaleOptions_Impl(); @@ -90,8 +87,10 @@ public: const OUString& GetLocaleString() const { return m_aLocaleString; } void SetLocaleString( const OUString& rStr ); - LanguageType GetLocaleLanguageType() const - { return m_eLocaleLanguageType; } + + const OUString& GetUILocaleString() const + { return m_aUILocaleString; } + void SetUILocaleString( const OUString& rStr ); const OUString& GetCurrencyString() const { return m_aCurrencyString; } @@ -104,23 +103,26 @@ public: }; -#define ROOTNODE_SYSLOCALE OUString(RTL_CONSTASCII_USTRINGPARAM("Setup/L10N")) +#define ROOTNODE_SYSLOCALE OUString(RTL_CONSTASCII_USTRINGPARAM("Setup/L10N")) -#define PROPERTYNAME_LOCALE OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupSystemLocale")) -#define PROPERTYNAME_CURRENCY OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupCurrency")) -#define PROPERTYNAME_DECIMALSEPARATOR OUString(RTL_CONSTASCII_USTRINGPARAM("DecimalSeparatorAsLocale")) +#define PROPERTYNAME_LOCALE OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupSystemLocale")) +#define PROPERTYNAME_UILOCALE OUString(RTL_CONSTASCII_USTRINGPARAM("ooLocale")) +#define PROPERTYNAME_CURRENCY OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupCurrency")) +#define PROPERTYNAME_DECIMALSEPARATOR OUString(RTL_CONSTASCII_USTRINGPARAM("DecimalSeparatorAsLocale")) -#define PROPERTYHANDLE_LOCALE 0 -#define PROPERTYHANDLE_CURRENCY 1 -#define PROPERTYHANDLE_DECIMALSEPARATOR 2 +#define PROPERTYHANDLE_LOCALE 0 +#define PROPERTYHANDLE_UILOCALE 1 +#define PROPERTYHANDLE_CURRENCY 2 +#define PROPERTYHANDLE_DECIMALSEPARATOR 3 -#define PROPERTYCOUNT 3 +#define PROPERTYCOUNT 4 const Sequence< OUString > SvtSysLocaleOptions_Impl::GetPropertyNames() { static const OUString pProperties[] = { PROPERTYNAME_LOCALE, + PROPERTYNAME_UILOCALE, PROPERTYNAME_CURRENCY, PROPERTYNAME_DECIMALSEPARATOR }; @@ -128,7 +130,6 @@ const Sequence< OUString > SvtSysLocaleOptions_Impl::GetPropertyNames() return seqPropertyNames; } - // ----------------------------------------------------------------------- SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl() @@ -136,13 +137,12 @@ SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl() , m_nBlockedHint( 0 ) , m_bDecimalSeparator( sal_True ) , m_bROLocale(CFG_READONLY_DEFAULT) + , m_bROUILocale(CFG_READONLY_DEFAULT) , m_bROCurrency(CFG_READONLY_DEFAULT) , m_bRODecimalSeparator(sal_False) { - if ( !IsValidConfigMgr() ) - ChangeLocaleSettings(); // assume SYSTEM defaults during Setup - else + if ( IsValidConfigMgr() ) { const Sequence< OUString > aNames = GetPropertyNames(); Sequence< Any > aValues = GetProperties( aNames ); @@ -172,6 +172,18 @@ SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl() m_bROLocale = pROStates[nProp]; } break; + case PROPERTYHANDLE_UILOCALE : + { + OUString aStr; + if ( pValues[nProp] >>= aStr ) + m_aUILocaleString = aStr; + else + { + DBG_ERRORFILE( "Wrong property type!" ); + } + m_bROUILocale = pROStates[nProp]; + } + break; case PROPERTYHANDLE_CURRENCY : { OUString aStr; @@ -203,7 +215,6 @@ SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl() } } // UpdateMiscSettings_Impl(); - ChangeLocaleSettings(); EnableNotification( aNames ); } } @@ -226,6 +237,11 @@ sal_Bool SvtSysLocaleOptions_Impl::IsReadOnly( SvtSysLocaleOptions::EOption eOpt bReadOnly = m_bROLocale; break; } + case SvtSysLocaleOptions::E_UILOCALE : + { + bReadOnly = m_bROUILocale; + break; + } case SvtSysLocaleOptions::E_CURRENCY : { bReadOnly = m_bROCurrency; @@ -236,25 +252,6 @@ sal_Bool SvtSysLocaleOptions_Impl::IsReadOnly( SvtSysLocaleOptions::EOption eOpt } -/*void SvtSysLocaleOptions_Impl::Broadcast( ULONG nHint ) -{ - if ( m_nBroadcastBlocked ) - m_nBlockedHint |= nHint; - else - { - nHint |= m_nBlockedHint; - m_nBlockedHint = 0; - if ( nHint ) - { - if ( nHint & SYSLOCALEOPTIONS_HINT_CURRENCY ) - ChangeDefaultCurrency(); - SfxSimpleHint aHint( nHint ); - GetBroadcaster().Broadcast( aHint ); - } - } -}*/ - - void SvtSysLocaleOptions_Impl::Commit() { const Sequence< OUString > aOrgNames = GetPropertyNames(); @@ -281,9 +278,19 @@ void SvtSysLocaleOptions_Impl::Commit() } } break; + case PROPERTYHANDLE_UILOCALE : + { + if (!m_bROUILocale) + { + pNames[nRealCount] = aOrgNames[nProp]; + pValues[nRealCount] <<= m_aUILocaleString; + ++nRealCount; + } + } + break; case PROPERTYHANDLE_CURRENCY : { - if (!m_bROLocale) + if (!m_bROCurrency) { pNames[nRealCount] = aOrgNames[nProp]; pValues[nRealCount] <<= m_aCurrencyString; @@ -317,36 +324,29 @@ void SvtSysLocaleOptions_Impl::SetLocaleString( const OUString& rStr ) m_aLocaleString = rStr; SetModified(); ULONG nHint = SYSLOCALEOPTIONS_HINT_LOCALE; - nHint |= ChangeLocaleSettings(); - //Broadcast( nHint ); - NotifyListeners(); + if ( !m_aCurrencyString.getLength() ) + nHint |= SYSLOCALEOPTIONS_HINT_CURRENCY; + NotifyListeners( nHint ); } } - -ULONG SvtSysLocaleOptions_Impl::ChangeLocaleSettings() +void SvtSysLocaleOptions_Impl::SetUILocaleString( const OUString& rStr ) { - // An empty config value denotes SYSTEM locale - if ( m_aLocaleString.getLength() ) - m_eLocaleLanguageType = MsLangId::convertIsoStringToLanguage( m_aLocaleString ); - else - m_eLocaleLanguageType = LANGUAGE_SYSTEM; - ULONG nHint = 0; - // new locale and no fixed currency => locale default currency might change - if ( !m_aCurrencyString.getLength() ) - nHint |= SYSLOCALEOPTIONS_HINT_CURRENCY; - return nHint; + if (!m_bROUILocale && rStr != m_aUILocaleString ) + { + m_aUILocaleString = rStr; + SetModified(); + NotifyListeners( SYSLOCALEOPTIONS_HINT_UILOCALE ); + } } - void SvtSysLocaleOptions_Impl::SetCurrencyString( const OUString& rStr ) { if (!m_bROCurrency && rStr != m_aCurrencyString ) { m_aCurrencyString = rStr; SetModified(); - //Broadcast( SYSLOCALEOPTIONS_HINT_CURRENCY ); - NotifyListeners(); + NotifyListeners( SYSLOCALEOPTIONS_HINT_CURRENCY ); } } @@ -356,20 +356,10 @@ void SvtSysLocaleOptions_Impl::SetDecimalSeparatorAsLocale( sal_Bool bSet) { m_bDecimalSeparator = bSet; SetModified(); - //UpdateMiscSettings_Impl(); - NotifyListeners(); + NotifyListeners( SYSLOCALEOPTIONS_HINT_DECSEP ); } } - -void SvtSysLocaleOptions_Impl::ChangeDefaultCurrency() const -{ - const Link& rLink = SvtSysLocaleOptions::GetCurrencyChangeLink(); - if ( rLink.IsSet() ) - rLink.Call( NULL ); -} - - void SvtSysLocaleOptions_Impl::Notify( const Sequence< rtl::OUString >& seqPropertyNames ) { ULONG nHint = 0; @@ -384,7 +374,15 @@ void SvtSysLocaleOptions_Impl::Notify( const Sequence< rtl::OUString >& seqPrope seqValues[nProp] >>= m_aLocaleString; m_bROLocale = seqROStates[nProp]; nHint |= SYSLOCALEOPTIONS_HINT_LOCALE; - nHint |= ChangeLocaleSettings(); + if ( !m_aCurrencyString.getLength() ) + nHint |= SYSLOCALEOPTIONS_HINT_CURRENCY; + } + if( seqPropertyNames[nProp] == PROPERTYNAME_UILOCALE ) + { + DBG_ASSERT( seqValues[nProp].getValueTypeClass() == TypeClass_STRING, "Locale property type" ); + seqValues[nProp] >>= m_aUILocaleString; + m_bROUILocale = seqROStates[nProp]; + nHint |= SYSLOCALEOPTIONS_HINT_UILOCALE; } else if( seqPropertyNames[nProp] == PROPERTYNAME_CURRENCY ) { @@ -400,8 +398,7 @@ void SvtSysLocaleOptions_Impl::Notify( const Sequence< rtl::OUString >& seqPrope } } if ( nHint ) - //Broadcast( nHint ); - NotifyListeners(); + NotifyListeners( nHint ); } // ==================================================================== @@ -417,12 +414,14 @@ SvtSysLocaleOptions::SvtSysLocaleOptions() ItemHolder1::holdConfigItem(E_SYSLOCALEOPTIONS); } ++nRefCount; + pOptions->AddListener(this); } SvtSysLocaleOptions::~SvtSysLocaleOptions() { MutexGuard aGuard( GetMutex() ); + pOptions->RemoveListener(this); if ( !--nRefCount ) { delete pOptions; @@ -477,13 +476,23 @@ const OUString& SvtSysLocaleOptions::GetLocaleConfigString() const return pOptions->GetLocaleString(); } - void SvtSysLocaleOptions::SetLocaleConfigString( const OUString& rStr ) { MutexGuard aGuard( GetMutex() ); pOptions->SetLocaleString( rStr ); } +const OUString& SvtSysLocaleOptions::GetUILocaleConfigString() const +{ + MutexGuard aGuard( GetMutex() ); + return pOptions->GetUILocaleString(); +} + +void SvtSysLocaleOptions::SetUILocaleConfigString( const OUString& rStr ) +{ + MutexGuard aGuard( GetMutex() ); + pOptions->SetUILocaleString( rStr ); +} const OUString& SvtSysLocaleOptions::GetCurrencyConfigString() const { @@ -499,11 +508,6 @@ void SvtSysLocaleOptions::SetCurrencyConfigString( const OUString& rStr ) } -LanguageType SvtSysLocaleOptions::GetLocaleLanguageType() const -{ - MutexGuard aGuard( GetMutex() ); - return pOptions->GetLocaleLanguageType(); -} /*-- 11.02.2004 13:31:41--------------------------------------------------- @@ -582,3 +586,45 @@ const Link& SvtSysLocaleOptions::GetCurrencyChangeLink() return CurrencyChangeLink::get(); } + +void SvtSysLocaleOptions::ConfigurationChanged( utl::ConfigurationBroadcaster* p, sal_uInt32 nHint ) +{ + if ( nHint & SYSLOCALEOPTIONS_HINT_CURRENCY ) + { + const Link& rLink = GetCurrencyChangeLink(); + if ( rLink.IsSet() ) + rLink.Call( NULL ); + } + + ::utl::detail::Options::ConfigurationChanged( p, nHint ); +} + +com::sun::star::lang::Locale lcl_str_to_locale( const ::rtl::OUString rStr ) +{ + com::sun::star::lang::Locale aRet; + if ( rStr.getLength() ) + { + aRet = com::sun::star::lang::Locale(); + sal_Int32 nSep = rStr.indexOf('-'); + if (nSep < 0) + aRet.Language = rStr; + else + { + aRet.Language = rStr.copy(0, nSep); + if (nSep < rStr.getLength()) + aRet.Country = rStr.copy(nSep+1, rStr.getLength() - (nSep+1)); + } + } + + return aRet; +} + +com::sun::star::lang::Locale SvtSysLocaleOptions::GetLocale() const +{ + return lcl_str_to_locale( GetLocaleConfigString() ); +} + +com::sun::star::lang::Locale SvtSysLocaleOptions::GetUILocale() const +{ + return lcl_str_to_locale( GetUILocaleConfigString() ); +} diff --git a/unotools/source/config/undoopt.cxx b/unotools/source/config/undoopt.cxx index 9b1712032e18..c2c79120995f 100644 --- a/unotools/source/config/undoopt.cxx +++ b/unotools/source/config/undoopt.cxx @@ -94,7 +94,7 @@ void SvtUndoOptions_Impl::Commit() } PutProperties( m_aPropertyNames, aValues ); - NotifyListeners(); + NotifyListeners(0); } // ----------------------------------------------------------------------- diff --git a/unotools/source/config/useroptions.cxx b/unotools/source/config/useroptions.cxx index 3b62e8225730..e06d6a794e20 100644 --- a/unotools/source/config/useroptions.cxx +++ b/unotools/source/config/useroptions.cxx @@ -772,7 +772,7 @@ void SvtUserOptions_Impl::SetApartment( const ::rtl::OUString& sApartment ) void SvtUserOptions_Impl::Notify() { - NotifyListeners(); + NotifyListeners(0); } // ----------------------------------------------------------------------- diff --git a/unotools/source/misc/syslocale.cxx b/unotools/source/misc/syslocale.cxx index a299867f83e8..f108cd2ed3df 100644 --- a/unotools/source/misc/syslocale.cxx +++ b/unotools/source/misc/syslocale.cxx @@ -50,53 +50,61 @@ sal_Int32 SvtSysLocale::nRefCount = 0; class SvtSysLocale_Impl : public utl::ConfigurationListener { - friend class SvtSysLocale; - +public: SvtSysLocaleOptions aSysLocaleOptions; LocaleDataWrapper* pLocaleData; CharClass* pCharClass; com::sun::star::lang::Locale maLocale; + com::sun::star::lang::Locale maUILocale; + LanguageType meLanguage; + LanguageType meUILanguage; -public: - SvtSysLocale_Impl(); - virtual ~SvtSysLocale_Impl(); + SvtSysLocale_Impl(); + virtual ~SvtSysLocale_Impl(); - CharClass* GetCharClass(); - SvtSysLocaleOptions& GetOptions() { return aSysLocaleOptions; } - void ConfigurationChanged( utl::ConfigurationBroadcaster* ); - com::sun::star::lang::Locale GetLocale(); + CharClass* GetCharClass(); + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); + void GetLocale(); + void GetUILocale(); }; -com::sun::star::lang::Locale SvtSysLocale_Impl::GetLocale() +void SvtSysLocale_Impl::GetLocale() { // ask configuration - rtl::OUString aLocaleString = aSysLocaleOptions.GetLocaleConfigString(); - if (!aLocaleString.getLength()) - // if no configuration is set, use system locale - return maLocale; - - com::sun::star::lang::Locale aLocale; - sal_Int32 nSep = aLocaleString.indexOf('-'); - if (nSep < 0) - aLocale.Language = aLocaleString; + maLocale = aSysLocaleOptions.GetLocale(); + if ( maLocale.Language.getLength() ) + { + meLanguage = MsLangId::convertLocaleToLanguage( maLocale ); + } else { - aLocale.Language = aLocaleString.copy(0, nSep); - if (nSep < aLocaleString.getLength()) - aLocale.Country = aLocaleString.copy(nSep+1, aLocaleString.getLength() - (nSep+1)); + meLanguage = MsLangId::getSystemLanguage(); + MsLangId::convertLanguageToLocale( meLanguage, maLocale ); } +} - return aLocale; +void SvtSysLocale_Impl::GetUILocale() +{ + maLocale = aSysLocaleOptions.GetLocale(); + if ( maUILocale.Language.getLength() ) + { + meUILanguage = MsLangId::convertLocaleToLanguage( maUILocale ); + } + else + { + meUILanguage = MsLangId::getSystemUILanguage(); + MsLangId::convertLanguageToLocale( meUILanguage, maUILocale ); + } } // ----------------------------------------------------------------------- SvtSysLocale_Impl::SvtSysLocale_Impl() : pCharClass(NULL) { - // first initialize maLocale with system locale - MsLangId::convertLanguageToLocale( MsLangId::getSystemLanguage(), maLocale ); + GetLocale(); + GetUILocale(); - pLocaleData = new LocaleDataWrapper( ::comphelper::getProcessServiceFactory(), GetLocale() ); + pLocaleData = new LocaleDataWrapper( ::comphelper::getProcessServiceFactory(), maLocale ); // listen for further changes aSysLocaleOptions.AddListener( this ); @@ -113,16 +121,22 @@ SvtSysLocale_Impl::~SvtSysLocale_Impl() CharClass* SvtSysLocale_Impl::GetCharClass() { if ( !pCharClass ) - pCharClass = new CharClass(::comphelper::getProcessServiceFactory(), GetLocale() ); + pCharClass = new CharClass(::comphelper::getProcessServiceFactory(), maLocale ); return pCharClass; } -void SvtSysLocale_Impl::ConfigurationChanged( utl::ConfigurationBroadcaster* ) +void SvtSysLocale_Impl::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 nHint ) { MutexGuard aGuard( SvtSysLocale::GetMutex() ); - lang::Locale aLocale = GetLocale(); - pLocaleData->setLocale( aLocale ); - GetCharClass()->setLocale( aLocale ); + if ( nHint & SYSLOCALEOPTIONS_HINT_LOCALE ) + { + GetLocale(); + pLocaleData->setLocale( maLocale ); + GetCharClass()->setLocale( maLocale ); + } + + if ( nHint & SYSLOCALEOPTIONS_HINT_UILOCALE ) + GetUILocale(); } // ==================================================================== @@ -191,15 +205,27 @@ const CharClass* SvtSysLocale::GetCharClassPtr() const SvtSysLocaleOptions& SvtSysLocale::GetOptions() const { - return pImpl->GetOptions(); + return pImpl->aSysLocaleOptions; } com::sun::star::lang::Locale SvtSysLocale::GetLocale() const { - return pImpl->GetLocale(); + return pImpl->maLocale; } LanguageType SvtSysLocale::GetLanguage() const { - return MsLangId::convertLocaleToLanguage( pImpl->GetLocale() ); -} \ No newline at end of file + return pImpl->meLanguage; +} + +com::sun::star::lang::Locale SvtSysLocale::GetUILocale() const +{ + return pImpl->maUILocale; +} + +LanguageType SvtSysLocale::GetUILanguage() const +{ + return pImpl->meUILanguage; +} + + diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx index 9f41b933f516..8891fdcfcf14 100644 --- a/vcl/inc/vcl/settings.hxx +++ b/vcl/inc/vcl/settings.hxx @@ -1285,8 +1285,8 @@ public: BOOL operator ==( const AllSettings& rSet ) const; BOOL operator !=( const AllSettings& rSet ) const { return !(*this == rSet); } - static void LocaleSettingsChanged(); - void StartListening(); + static void LocaleSettingsChanged( sal_uInt32 nHint ); + SvtSysLocale& GetSysLocale() { return mpData->maSysLocale; } }; #endif // _SV_SETTINGS_HXX diff --git a/vcl/inc/vcl/svdata.hxx b/vcl/inc/vcl/svdata.hxx index c044364f2064..2ca7c2818a5e 100644 --- a/vcl/inc/vcl/svdata.hxx +++ b/vcl/inc/vcl/svdata.hxx @@ -44,6 +44,7 @@ #include #include #include +#include namespace com { namespace sun { @@ -118,6 +119,11 @@ namespace vcl { class DisplayConnection; class FontSubstConfiguration; class Set // ----------------- // - ImplSVAppData - // ----------------- +class LocaleConfigurationListener : public utl::ConfigurationListener +{ +public: + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); +}; struct ImplSVAppData { @@ -131,6 +137,7 @@ struct ImplSVAppData ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF; String* mpMSFTempFileName; AllSettings* mpSettings; // Application settings + LocaleConfigurationListener* mpCfgListener; VclEventListeners* mpEventListeners; // listeners for vcl events (eg, extended toolkit) VclEventListeners* mpKeyListeners; // listeners for key events only (eg, extended toolkit) ImplAccelManager* mpAccelMgr; // Accelerator Manager diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index d30a1c9745f4..ae142c170b53 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -67,17 +67,6 @@ DBG_NAME( AllSettings ) STYLE_OPTION_NOMNEMONICS) // ======================================================================= -class LocaleConfigurationListener : public utl::ConfigurationListener -{ -public: - virtual void ConfigurationChanged( utl::ConfigurationBroadcaster* ); -}; - -void LocaleConfigurationListener::ConfigurationChanged( utl::ConfigurationBroadcaster* ) -{ - AllSettings::LocaleSettingsChanged(); -} - ImplMachineData::ImplMachineData() { mnRefCount = 1; @@ -1543,7 +1532,6 @@ ImplAllSettingsData::ImplAllSettingsData() mpUICollatorWrapper = NULL; mpI18nHelper = NULL; mpUII18nHelper = NULL; - mpLocaleCfgListener = NULL; maMiscSettings.SetEnableLocalizedDecimalSep( maSysLocale.GetOptions().IsDecimalSeparatorAsLocale() ); } @@ -1574,7 +1562,6 @@ ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData& rData ) : mpUICollatorWrapper = NULL; mpI18nHelper = NULL; mpUII18nHelper = NULL; - mpLocaleCfgListener = NULL; } // ----------------------------------------------------------------------- @@ -1593,11 +1580,6 @@ ImplAllSettingsData::~ImplAllSettingsData() delete mpI18nHelper; if ( mpUII18nHelper ) delete mpUII18nHelper; - if (mpLocaleCfgListener ) - { - maSysLocale.GetOptions().RemoveListener( mpLocaleCfgListener ); - delete mpLocaleCfgListener; - } } // ----------------------------------------------------------------------- @@ -1656,13 +1638,6 @@ const AllSettings& AllSettings::operator =( const AllSettings& rSet ) return *this; } -void AllSettings::StartListening() -{ - if (!mpData->mpLocaleCfgListener) - mpData->mpLocaleCfgListener = new LocaleConfigurationListener; - mpData->maSysLocale.GetOptions().AddListener( mpData->mpLocaleCfgListener ); -} - // ----------------------------------------------------------------------- void AllSettings::CopyData() @@ -1996,8 +1971,7 @@ BOOL AllSettings::GetLayoutRTL() const const ::com::sun::star::lang::Locale& AllSettings::GetLocale() const { if ( !mpData->maLocale.Language.getLength() ) - MsLangId::convertLanguageToLocale( GetLanguage(), - ((AllSettings*)this)->mpData->maLocale ); + mpData->maLocale = mpData->maSysLocale.GetLocale(); return mpData->maLocale; } @@ -2007,8 +1981,7 @@ const ::com::sun::star::lang::Locale& AllSettings::GetLocale() const const ::com::sun::star::lang::Locale& AllSettings::GetUILocale() const { if ( !mpData->maUILocale.Language.getLength() ) - MsLangId::convertLanguageToLocale( GetUILanguage(), - ((AllSettings*)this)->mpData->maUILocale ); + mpData->maUILocale = mpData->maSysLocale.GetUILocale(); return mpData->maUILocale; } @@ -2018,7 +1991,7 @@ const ::com::sun::star::lang::Locale& AllSettings::GetUILocale() const LanguageType AllSettings::GetLanguage() const { if ( mpData->meLanguage == LANGUAGE_SYSTEM ) - return MsLangId::getSystemLanguage(); + mpData->meLanguage = mpData->maSysLocale.GetLanguage(); return mpData->meLanguage; } @@ -2028,7 +2001,7 @@ LanguageType AllSettings::GetLanguage() const LanguageType AllSettings::GetUILanguage() const { if ( mpData->meUILanguage == LANGUAGE_SYSTEM ) - return MsLangId::getSystemUILanguage(); + mpData->meUILanguage = mpData->maSysLocale.GetUILanguage(); return mpData->meUILanguage; } @@ -2098,15 +2071,26 @@ const CollatorWrapper& AllSettings::GetUICollatorWrapper() const return *mpData->mpUICollatorWrapper; } */ -void AllSettings::LocaleSettingsChanged() + +void AllSettings::LocaleSettingsChanged( sal_uInt32 nHint ) { AllSettings aAllSettings( Application::GetSettings() ); - MiscSettings aMiscSettings = aAllSettings.GetMiscSettings(); - BOOL bIsDecSepAsLocale = aAllSettings.mpData->maSysLocale.GetOptions().IsDecimalSeparatorAsLocale(); - if ( aMiscSettings.GetEnableLocalizedDecimalSep() != bIsDecSepAsLocale ) + if ( nHint & SYSLOCALEOPTIONS_HINT_DECSEP ) { - aMiscSettings.SetEnableLocalizedDecimalSep( bIsDecSepAsLocale ); - aAllSettings.SetMiscSettings( aMiscSettings ); - Application::SetSettings( aAllSettings ); + MiscSettings aMiscSettings = aAllSettings.GetMiscSettings(); + BOOL bIsDecSepAsLocale = aAllSettings.mpData->maSysLocale.GetOptions().IsDecimalSeparatorAsLocale(); + if ( aMiscSettings.GetEnableLocalizedDecimalSep() != bIsDecSepAsLocale ) + { + aMiscSettings.SetEnableLocalizedDecimalSep( bIsDecSepAsLocale ); + aAllSettings.SetMiscSettings( aMiscSettings ); + } } -} \ No newline at end of file + + if ( nHint & SYSLOCALEOPTIONS_HINT_LOCALE ) + aAllSettings.SetLocale( aAllSettings.mpData->maSysLocale.GetOptions().GetLocale() ); + + if ( nHint & SYSLOCALEOPTIONS_HINT_UILOCALE ) + aAllSettings.SetLocale( aAllSettings.mpData->maSysLocale.GetOptions().GetUILocale() ); + + Application::SetSettings( aAllSettings ); +} diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 9f381381fae8..19b8ea1ff14d 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -88,6 +88,7 @@ #include #include +#include using namespace ::com::sun::star::uno; @@ -709,8 +710,7 @@ void Application::SetSettings( const AllSettings& rSettings ) ImplSVData* pSVData = ImplGetSVData(); if ( !pSVData->maAppData.mpSettings ) { - pSVData->maAppData.mpSettings = new AllSettings(); - pSVData->maAppData.mpSettings->StartListening(); + GetSettings(); *pSVData->maAppData.mpSettings = rSettings; ResMgr::SetDefaultLocale( rSettings.GetUILocale() ); } @@ -812,7 +812,12 @@ const AllSettings& Application::GetSettings() { ImplSVData* pSVData = ImplGetSVData(); if ( !pSVData->maAppData.mpSettings ) + { + pSVData->maAppData.mpCfgListener = new LocaleConfigurationListener; pSVData->maAppData.mpSettings = new AllSettings(); + pSVData->maAppData.mpSettings->GetSysLocale().GetOptions().AddListener( pSVData->maAppData.mpCfgListener ); + } + return *(pSVData->maAppData.mpSettings); } diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index 21e1f34c1ef5..b40777eb2e01 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -523,3 +523,9 @@ Window* ImplFindWindow( const SalFrame* pFrame, Point& rSalFramePos ) return NULL; } + +void LocaleConfigurationListener::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 nHint ) +{ + AllSettings::LocaleSettingsChanged( nHint ); +} + diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index 6c09978e37b1..d8b1e8a833a2 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -79,7 +79,7 @@ #include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/lang/XComponent.hpp" #include "rtl/logfile.hxx" - +#include #include "vcl/fontcfg.hxx" #include "vcl/configsettings.hxx" #include "vcl/lazydelete.hxx" @@ -467,6 +467,12 @@ void DeInitVCL() if ( pSVData->maAppData.mpSettings ) { + if ( pSVData->maAppData.mpCfgListener ) + { + pSVData->maAppData.mpSettings->GetSysLocale().GetOptions().RemoveListener( pSVData->maAppData.mpCfgListener ); + delete pSVData->maAppData.mpCfgListener; + } + delete pSVData->maAppData.mpSettings; pSVData->maAppData.mpSettings = NULL; } -- cgit From 84e49c6bbbc61384618c90193c45af8799d24ea3 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Fri, 16 Oct 2009 15:21:16 +0000 Subject: #i105945# no optimization for textsearch on unxsoli --- i18npool/source/search/makefile.mk | 6 ++++++ i18npool/source/search/textsearch.cxx | 1 + 2 files changed, 7 insertions(+) diff --git a/i18npool/source/search/makefile.mk b/i18npool/source/search/makefile.mk index 1b48919624f6..2e81ec3f1d53 100644 --- a/i18npool/source/search/makefile.mk +++ b/i18npool/source/search/makefile.mk @@ -50,6 +50,12 @@ SLOFILES= \ $(EXCEPTIONSFILES) \ $(SLO)$/levdis.obj +# on unxsoli, no optimization for textsearch because of i105945 +.IF "$(OS)$(COM)$(CPUNAME)"=="SOLARISC52INTEL" +EXCEPTIONSNOOPTFILES= \ + $(SLO)$/textsearch.obj +.ENDIF + SHL1TARGET= $(TARGET) SHL1OBJS= $(SLOFILES) diff --git a/i18npool/source/search/textsearch.cxx b/i18npool/source/search/textsearch.cxx index 96f033f4e4e3..2518a6cb0481 100644 --- a/i18npool/source/search/textsearch.cxx +++ b/i18npool/source/search/textsearch.cxx @@ -562,6 +562,7 @@ sal_Int32 TextSearch::GetDiff( const sal_Unicode cChr ) const } +// TextSearch::NSrchFrwrd is mis-optimized on unxsoli (#i105945#) SearchResult TextSearch::NSrchFrwrd( const OUString& searchStr, sal_Int32 startPos, sal_Int32 endPos ) throw(RuntimeException) { -- cgit From c5ddee96afdc3ceb5bcc023b36185122a16b283d Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Sun, 18 Oct 2009 15:05:21 +0200 Subject: #i103496#: move some enums, defines and inlines from vcl to tools to get xmloff free of vcl stuff --- tools/inc/poly.h | 13 -- tools/inc/tools/fldunit.hxx | 44 ++++++ tools/inc/tools/fontenum.hxx | 175 ++++++++++++++++++++++ tools/inc/tools/gen.hxx | 31 ++++ tools/inc/tools/mapunit.hxx | 44 ++++++ tools/inc/tools/wintypes.hxx | 337 ++++++++++++++++++++++++++++++++++++++++++ tools/prj/d.lst | 5 +- tools/source/generic/line.cxx | 5 - vcl/inc/vcl/fldunit.hxx | 10 +- vcl/inc/vcl/mapunit.hxx | 10 +- vcl/inc/vcl/salbtype.hxx | 32 +--- vcl/inc/vcl/wintypes.hxx | 303 +------------------------------------ 12 files changed, 639 insertions(+), 370 deletions(-) create mode 100644 tools/inc/tools/fldunit.hxx create mode 100644 tools/inc/tools/fontenum.hxx create mode 100644 tools/inc/tools/mapunit.hxx create mode 100644 tools/inc/tools/wintypes.hxx diff --git a/tools/inc/poly.h b/tools/inc/poly.h index ed70359be0c0..4f281a9b1359 100644 --- a/tools/inc/poly.h +++ b/tools/inc/poly.h @@ -99,17 +99,4 @@ public: ~ImplPolyPolygon(); }; -inline long MinMax( long nVal, long nMin, long nMax ) -{ - return( nVal >= nMin ? ( nVal <= nMax ? nVal : nMax ) : nMin ); -} - -// ------------------------------------------------------------------ - -inline long FRound( double fVal ) -{ - return( fVal > 0.0 ? (long) ( fVal + 0.5 ) : -(long) ( -fVal + 0.5 ) ); -} - - #endif // _SV_POLY_H diff --git a/tools/inc/tools/fldunit.hxx b/tools/inc/tools/fldunit.hxx new file mode 100644 index 000000000000..786796030eb3 --- /dev/null +++ b/tools/inc/tools/fldunit.hxx @@ -0,0 +1,44 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: fldunit.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _TOOLS_FLDUNIT_HXX +#define _TOOLS_FLDUNIT_HXX + +// -------------- +// - FieldTypes - +// -------------- + +// By changes you must also change: rsc/vclrsc.hxx +enum FieldUnit { FUNIT_NONE, FUNIT_MM, FUNIT_CM, FUNIT_M, FUNIT_KM, + FUNIT_TWIP, FUNIT_POINT, FUNIT_PICA, + FUNIT_INCH, FUNIT_FOOT, FUNIT_MILE, FUNIT_CUSTOM, + FUNIT_PERCENT, FUNIT_100TH_MM }; + +#endif // _TOOLS_FLDUNIT_HXX diff --git a/tools/inc/tools/fontenum.hxx b/tools/inc/tools/fontenum.hxx new file mode 100644 index 000000000000..6c529cedb30d --- /dev/null +++ b/tools/inc/tools/fontenum.hxx @@ -0,0 +1,175 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: vclenum.hxx,v $ + * $Revision: 1.6 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _TOOLS_FONTENUM_HXX +#define _TOOLS_FONTENUM_HXX + +#include +#include + +#ifndef ENUM_FONTFAMILY_DECLARED +#define ENUM_FONTFAMILY_DECLARED + +enum FontFamily { FAMILY_DONTKNOW, FAMILY_DECORATIVE, FAMILY_MODERN, + FAMILY_ROMAN, FAMILY_SCRIPT, FAMILY_SWISS, FAMILY_SYSTEM, FontFamily_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +// ------------------------------------------------------------ + +#ifndef ENUM_FONTPITCH_DECLARED +#define ENUM_FONTPITCH_DECLARED + +enum FontPitch { PITCH_DONTKNOW, PITCH_FIXED, PITCH_VARIABLE, FontPitch_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +// ------------------------------------------------------------ + +#ifndef ENUM_TEXTALIGN_DECLARED +#define ENUM_TEXTALIGN_DECLARED + +enum TextAlign { ALIGN_TOP, ALIGN_BASELINE, ALIGN_BOTTOM, TextAlign_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +// ------------------------------------------------------------ + +#ifndef ENUM_FONTWEIGHT_DECLARED +#define ENUM_FONTWEIGHT_DECLARED + +enum FontWeight { WEIGHT_DONTKNOW, WEIGHT_THIN, WEIGHT_ULTRALIGHT, + WEIGHT_LIGHT, WEIGHT_SEMILIGHT, WEIGHT_NORMAL, + WEIGHT_MEDIUM, WEIGHT_SEMIBOLD, WEIGHT_BOLD, + WEIGHT_ULTRABOLD, WEIGHT_BLACK, FontWeight_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +// ------------------------------------------------------------ + +#ifndef ENUM_FONTWIDTH_DECLARED +#define ENUM_FONTWIDTH_DECLARED + +enum FontWidth { WIDTH_DONTKNOW, WIDTH_ULTRA_CONDENSED, WIDTH_EXTRA_CONDENSED, + WIDTH_CONDENSED, WIDTH_SEMI_CONDENSED, WIDTH_NORMAL, + WIDTH_SEMI_EXPANDED, WIDTH_EXPANDED, WIDTH_EXTRA_EXPANDED, + WIDTH_ULTRA_EXPANDED, + FontWidth_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +// ------------------------------------------------------------ + +#ifndef ENUM_FONTITALIC_DECLARED +#define ENUM_FONTITALIC_DECLARED + +enum FontItalic { ITALIC_NONE, ITALIC_OBLIQUE, ITALIC_NORMAL, ITALIC_DONTKNOW, FontItalic_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +// ------------------------------------------------------------ + +#ifndef ENUM_FONTUNDERLINE_DECLARED +#define ENUM_FONTUNDERLINE_DECLARED + +enum FontUnderline { UNDERLINE_NONE, UNDERLINE_SINGLE, UNDERLINE_DOUBLE, + UNDERLINE_DOTTED, UNDERLINE_DONTKNOW, + UNDERLINE_DASH, UNDERLINE_LONGDASH, + UNDERLINE_DASHDOT, UNDERLINE_DASHDOTDOT, + UNDERLINE_SMALLWAVE, + UNDERLINE_WAVE, UNDERLINE_DOUBLEWAVE, + UNDERLINE_BOLD, UNDERLINE_BOLDDOTTED, + UNDERLINE_BOLDDASH, UNDERLINE_BOLDLONGDASH, + UNDERLINE_BOLDDASHDOT, UNDERLINE_BOLDDASHDOTDOT, + UNDERLINE_BOLDWAVE, + FontUnderline_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +// ------------------------------------------------------------ + +#ifndef ENUM_FONTSTRIKEOUT_DECLARED +#define ENUM_FONTSTRIKEOUT_DECLARED + +enum FontStrikeout { STRIKEOUT_NONE, STRIKEOUT_SINGLE, STRIKEOUT_DOUBLE, + STRIKEOUT_DONTKNOW, STRIKEOUT_BOLD, + STRIKEOUT_SLASH, STRIKEOUT_X, + FontStrikeout_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +// ------------------------------------------------------------ + +#ifndef ENUM_FONTEMPHASISMARK_DECLARED +#define ENUM_FONTEMPHASISMARK_DECLARED + +typedef USHORT FontEmphasisMark; +#define EMPHASISMARK_NONE ((FontEmphasisMark)0x0000) +#define EMPHASISMARK_DOT ((FontEmphasisMark)0x0001) +#define EMPHASISMARK_CIRCLE ((FontEmphasisMark)0x0002) +#define EMPHASISMARK_DISC ((FontEmphasisMark)0x0003) +#define EMPHASISMARK_ACCENT ((FontEmphasisMark)0x0004) +#define EMPHASISMARK_STYLE ((FontEmphasisMark)0x00FF) +#define EMPHASISMARK_POS_ABOVE ((FontEmphasisMark)0x1000) +#define EMPHASISMARK_POS_BELOW ((FontEmphasisMark)0x2000) + +// Only for kompability +#define EMPHASISMARK_DOTS_ABOVE (EMPHASISMARK_DOT | EMPHASISMARK_POS_ABOVE) +#define EMPHASISMARK_DOTS_BELOW (EMPHASISMARK_DOT | EMPHASISMARK_POS_BELOW) +#define EMPHASISMARK_SIDE_DOTS (EMPHASISMARK_ACCENT | EMPHASISMARK_POS_ABOVE) +#define EMPHASISMARK_CIRCLE_ABOVE (EMPHASISMARK_CIRCLE | EMPHASISMARK_POS_ABOVE) + +#endif + +// ------------------------------------------------------------ + +#ifndef ENUM_FONTTYPE_DECLARED +#define ENUM_FONTTYPE_DECLARED + +enum FontType { TYPE_DONTKNOW, TYPE_RASTER, TYPE_VECTOR, TYPE_SCALABLE, + FontType_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +#ifndef ENUM_FONTEMBEDDEDBITMAP_DECLARED +#define ENUM_FONTEMBEDDEDBITMAP_DECLARED + +enum FontEmbeddedBitmap { EMBEDDEDBITMAP_DONTKNOW, EMBEDDEDBITMAP_FALSE, EMBEDDEDBITMAP_TRUE }; + +#endif + +#ifndef ENUM_FONTANTIALIAS_DECLARED +#define ENUM_FONTANTIALIAS_DECLARED + +enum FontAntiAlias { ANTIALIAS_DONTKNOW, ANTIALIAS_FALSE, ANTIALIAS_TRUE }; + +#endif + +#endif // _TOOLS_FONTENUM_HXX diff --git a/tools/inc/tools/gen.hxx b/tools/inc/tools/gen.hxx index e01eb98842c2..0d82f4d73160 100644 --- a/tools/inc/tools/gen.hxx +++ b/tools/inc/tools/gen.hxx @@ -37,6 +37,37 @@ class SvStream; +// -------------------- +// - Helper functions - +// -------------------- + +inline long MinMax( long nVal, long nMin, long nMax ); +inline long AlignedWidth4Bytes( long nWidthBits ); +inline long FRound( double fVal ); + +// --------------- +// - Inlines - +// --------------- + +inline long MinMax( long nVal, long nMin, long nMax ) +{ + return( nVal >= nMin ? ( nVal <= nMax ? nVal : nMax ) : nMin ); +} + +// ------------------------------------------------------------------ + +inline long AlignedWidth4Bytes( long nWidthBits ) +{ + return( ( ( nWidthBits + 31 ) >> 5 ) << 2 ); +} + +// ------------------------------------------------------------------ + +inline long FRound( double fVal ) +{ + return( fVal > 0.0 ? (long) ( fVal + 0.5 ) : -(long) ( -fVal + 0.5 ) ); +} + // -------- // - Pair - // -------- diff --git a/tools/inc/tools/mapunit.hxx b/tools/inc/tools/mapunit.hxx new file mode 100644 index 000000000000..76267192347a --- /dev/null +++ b/tools/inc/tools/mapunit.hxx @@ -0,0 +1,44 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: mapunit.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _TOOLS_MAPUNIT_HXX +#define _TOOLS_MAPUNIT_HXX + +// ----------------- +// - MapMode-Types - +// ----------------- + +// By changes you must also change: rsc/vclrsc.hxx +enum MapUnit { MAP_100TH_MM, MAP_10TH_MM, MAP_MM, MAP_CM, + MAP_1000TH_INCH, MAP_100TH_INCH, MAP_10TH_INCH, MAP_INCH, + MAP_POINT, MAP_TWIP, MAP_PIXEL, MAP_SYSFONT, MAP_APPFONT, + MAP_RELATIVE, MAP_REALAPPFONT, MAP_LASTENUMDUMMY }; + +#endif // _TOOLS_MAPUNIT_HXX diff --git a/tools/inc/tools/wintypes.hxx b/tools/inc/tools/wintypes.hxx new file mode 100644 index 000000000000..a9c23de87ddd --- /dev/null +++ b/tools/inc/tools/wintypes.hxx @@ -0,0 +1,337 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: wintypes.hxx,v $ + * $Revision: 1.9 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _TOOLS_WINTYPES_HXX +#define _TOOLS_WINTYPES_HXX + +#include +#include + +// ---------------- +// - Window-Types - +// ---------------- + +typedef USHORT WindowType; +#define WINDOW_BASE 0x0100 +#define WINDOW_FIRST (WINDOW_BASE + 0x30) +#define WINDOW_MESSBOX (WINDOW_FIRST) +#define WINDOW_INFOBOX (WINDOW_FIRST + 0x01) +#define WINDOW_WARNINGBOX (WINDOW_FIRST + 0x02) +#define WINDOW_ERRORBOX (WINDOW_FIRST + 0x03) +#define WINDOW_QUERYBOX (WINDOW_FIRST + 0x04) +#define WINDOW_WINDOW (WINDOW_FIRST + 0x05) +#define WINDOW_SYSWINDOW (WINDOW_FIRST + 0x06) +#define WINDOW_WORKWINDOW (WINDOW_FIRST + 0x07) +// #define WINDOW_MDIWINDOW (WINDOW_FIRST + 0x08) +#define WINDOW_FLOATINGWINDOW (WINDOW_FIRST + 0x09) +#define WINDOW_DIALOG (WINDOW_FIRST + 0x0a) +#define WINDOW_MODELESSDIALOG (WINDOW_FIRST + 0x0b) +#define WINDOW_MODALDIALOG (WINDOW_FIRST + 0x0c) +#define WINDOW_SYSTEMDIALOG (WINDOW_FIRST + 0x0d) +#define WINDOW_PATHDIALOG (WINDOW_FIRST + 0x0e) +#define WINDOW_FILEDIALOG (WINDOW_FIRST + 0x0f) +#define WINDOW_PRINTERSETUPDIALOG (WINDOW_FIRST + 0x10) +#define WINDOW_PRINTDIALOG (WINDOW_FIRST + 0x11) +#define WINDOW_COLORDIALOG (WINDOW_FIRST + 0x12) +#define WINDOW_FONTDIALOG (WINDOW_FIRST + 0x13) +#define WINDOW_CONTROL (WINDOW_FIRST + 0x14) +#define WINDOW_BUTTON (WINDOW_FIRST + 0x15) +#define WINDOW_PUSHBUTTON (WINDOW_FIRST + 0x16) +#define WINDOW_OKBUTTON (WINDOW_FIRST + 0x17) +#define WINDOW_CANCELBUTTON (WINDOW_FIRST + 0x18) +#define WINDOW_HELPBUTTON (WINDOW_FIRST + 0x19) +#define WINDOW_IMAGEBUTTON (WINDOW_FIRST + 0x1a) +#define WINDOW_MENUBUTTON (WINDOW_FIRST + 0x1b) +#define WINDOW_MOREBUTTON (WINDOW_FIRST + 0x1c) +#define WINDOW_SPINBUTTON (WINDOW_FIRST + 0x1d) +#define WINDOW_RADIOBUTTON (WINDOW_FIRST + 0x1e) +#define WINDOW_IMAGERADIOBUTTON (WINDOW_FIRST + 0x1f) +#define WINDOW_CHECKBOX (WINDOW_FIRST + 0x20) +#define WINDOW_TRISTATEBOX (WINDOW_FIRST + 0x21) +#define WINDOW_EDIT (WINDOW_FIRST + 0x22) +#define WINDOW_MULTILINEEDIT (WINDOW_FIRST + 0x23) +#define WINDOW_COMBOBOX (WINDOW_FIRST + 0x24) +#define WINDOW_LISTBOX (WINDOW_FIRST + 0x25) +#define WINDOW_MULTILISTBOX (WINDOW_FIRST + 0x26) +#define WINDOW_FIXEDTEXT (WINDOW_FIRST + 0x27) +#define WINDOW_FIXEDLINE (WINDOW_FIRST + 0x28) +#define WINDOW_FIXEDBITMAP (WINDOW_FIRST + 0x29) +#define WINDOW_FIXEDIMAGE (WINDOW_FIRST + 0x2a) +#define WINDOW_GROUPBOX (WINDOW_FIRST + 0x2c) +#define WINDOW_SCROLLBAR (WINDOW_FIRST + 0x2d) +#define WINDOW_SCROLLBARBOX (WINDOW_FIRST + 0x2e) +#define WINDOW_SPLITTER (WINDOW_FIRST + 0x2f) +#define WINDOW_SPLITWINDOW (WINDOW_FIRST + 0x30) +#define WINDOW_SPINFIELD (WINDOW_FIRST + 0x31) +#define WINDOW_PATTERNFIELD (WINDOW_FIRST + 0x32) +#define WINDOW_NUMERICFIELD (WINDOW_FIRST + 0x33) +#define WINDOW_METRICFIELD (WINDOW_FIRST + 0x34) +#define WINDOW_CURRENCYFIELD (WINDOW_FIRST + 0x35) +#define WINDOW_DATEFIELD (WINDOW_FIRST + 0x36) +#define WINDOW_TIMEFIELD (WINDOW_FIRST + 0x37) +#define WINDOW_PATTERNBOX (WINDOW_FIRST + 0x38) +#define WINDOW_NUMERICBOX (WINDOW_FIRST + 0x39) +#define WINDOW_METRICBOX (WINDOW_FIRST + 0x3a) +#define WINDOW_CURRENCYBOX (WINDOW_FIRST + 0x3b) +#define WINDOW_DATEBOX (WINDOW_FIRST + 0x3c) +#define WINDOW_TIMEBOX (WINDOW_FIRST + 0x3d) +#define WINDOW_LONGCURRENCYFIELD (WINDOW_FIRST + 0x3e) +#define WINDOW_LONGCURRENCYBOX (WINDOW_FIRST + 0x3f) +#define WINDOW_TOOLBOX (WINDOW_FIRST + 0x41) +#define WINDOW_DOCKINGWINDOW (WINDOW_FIRST + 0x42) +#define WINDOW_STATUSBAR (WINDOW_FIRST + 0x43) +#define WINDOW_TABPAGE (WINDOW_FIRST + 0x44) +#define WINDOW_TABCONTROL (WINDOW_FIRST + 0x45) +#define WINDOW_TABDIALOG (WINDOW_FIRST + 0x46) +#define WINDOW_BORDERWINDOW (WINDOW_FIRST + 0x47) +#define WINDOW_BUTTONDIALOG (WINDOW_FIRST + 0x48) +#define WINDOW_SYSTEMCHILDWINDOW (WINDOW_FIRST + 0x49) +#define WINDOW_FIXEDBORDER (WINDOW_FIRST + 0x4a) +#define WINDOW_SLIDER (WINDOW_FIRST + 0x4b) +#define WINDOW_MENUBARWINDOW (WINDOW_FIRST + 0x4c) +#define WINDOW_TREELISTBOX (WINDOW_FIRST + 0x4d) +#define WINDOW_HELPTEXTWINDOW (WINDOW_FIRST + 0x4e) +#define WINDOW_INTROWINDOW (WINDOW_FIRST + 0x4f) +#define WINDOW_LISTBOXWINDOW (WINDOW_FIRST + 0x50) +#define WINDOW_DOCKINGAREA (WINDOW_FIRST + 0x51) +#define WINDOW_LAST (WINDOW_DOCKINGAREA) + + +// --------------- +// - Window-Bits - +// --------------- + +// By changes you must also change: rsc/vclrsc.hxx +typedef sal_Int64 WinBits; + +// Window-Bits fuer Window +#define WB_CLIPCHILDREN ((WinBits)0x00000001) +#define WB_DIALOGCONTROL ((WinBits)0x00000002) +#define WB_NODIALOGCONTROL ((WinBits)0x00000004) +#define WB_BORDER ((WinBits)0x00000008) +#define WB_NOBORDER ((WinBits)0x00000010) +#define WB_SIZEABLE ((WinBits)0x00000020) +#define WB_3DLOOK ((WinBits)0x00000040) +#define WB_AUTOSIZE ((WinBits)0x00000080) + +// Window-Bits fuer SystemWindows +#define WB_MOVEABLE ((WinBits)0x00000100) +#define WB_ROLLABLE ((WinBits)0x00000200) +#define WB_CLOSEABLE ((WinBits)0x00000400) +#define WB_STANDALONE ((WinBits)0x00000800) +#define WB_APP ((WinBits)0x00001000) +#define WB_PINABLE ((WinBits)0x00002000) +#define WB_SYSTEMWINDOW ((WinBits)SAL_CONST_INT64(0x40000000)) +// warning: do not confuse WB_SYSTEMCHILDWINDOW with the SystemChildWindow class + +// the SystemChildWindow class was there first and is a very specialized +// sytem child window type for plugged applications. The SystemChildWindow class +// explicitly should never use the WB_SYSTEMCHILDWINDOW WinBit + +// WB_SYSTEMCHILDWINDOW on the other hand is to be used on system windows +// which should be created as system child windows with (more or less) +// normal event handling +#define WB_SYSTEMCHILDWINDOW ((WinBits)SAL_CONST_INT64(0x8000000000)) +#define WB_SIZEMOVE (WB_SIZEABLE | WB_MOVEABLE) + +// Standard-Window-Bits fuer ChildWindows +#define WB_TABSTOP ((WinBits)0x00000100) +#define WB_NOTABSTOP ((WinBits)0x00000200) +#define WB_GROUP ((WinBits)0x00000400) +#define WB_NOGROUP ((WinBits)0x00000800) +#define WB_HORZ ((WinBits)0x00001000) +#define WB_VERT ((WinBits)0x00002000) +#define WB_LEFT ((WinBits)0x00004000) +#define WB_CENTER ((WinBits)0x00008000) +#define WB_RIGHT ((WinBits)0x00010000) +#define WB_TOP ((WinBits)0x00020000) +#define WB_VCENTER ((WinBits)0x00040000) +#define WB_BOTTOM ((WinBits)0x00080000) +#define WB_DRAG ((WinBits)0x00100000) +#define WB_SPIN ((WinBits)0x00200000) +#define WB_REPEAT ((WinBits)0x00400000) +#define WB_NOPOINTERFOCUS ((WinBits)0x00800000) +#define WB_WORDBREAK ((WinBits)0x01000000) +#define WB_NOLABEL ((WinBits)0x02000000) +#define WB_SORT ((WinBits)0x04000000) +#define WB_DROPDOWN ((WinBits)0x08000000) +#define WB_AUTOHSCROLL ((WinBits)SAL_CONST_INT64(0x10000000)) +#define WB_DOCKABLE ((WinBits)SAL_CONST_INT64(0x20000000)) +#define WB_AUTOVSCROLL ((WinBits)SAL_CONST_INT64(0x40000000)) +#define WB_HYPHENATION (((WinBits)SAL_CONST_INT64(0x80000000)) | WB_WORDBREAK) +#define WB_CHILDDLGCTRL ((WinBits)SAL_CONST_INT64(0x100000000000)) + +// system floating window +#define WB_SYSTEMFLOATWIN ((WinBits)SAL_CONST_INT64(0x100000000)) +#define WB_INTROWIN ((WinBits)SAL_CONST_INT64(0x200000000)) +#define WB_NOSHADOW ((WinBits)SAL_CONST_INT64(0x400000000)) +#define WB_TOOLTIPWIN ((WinBits)SAL_CONST_INT64(0x800000000)) +#define WB_OWNERDRAWDECORATION ((WinBits)SAL_CONST_INT64(0x2000000000)) +#define WB_DEFAULTWIN ((WinBits)SAL_CONST_INT64(0x4000000000)) +#define WB_NEEDSFOCUS ((WinBits)SAL_CONST_INT64(0x1000000000)) + +#define WB_HIDE ((WinBits)SAL_CONST_INT64(0x80000000)) +#define WB_HSCROLL WB_HORZ +#define WB_VSCROLL WB_VERT +#define WB_TOPIMAGE WB_TOP + +// Window-Bits for PushButtons +#define WB_DEFBUTTON ((WinBits)0x10000000) +#define WB_NOLIGHTBORDER ((WinBits)0x20000000) +#define WB_RECTSTYLE ((WinBits)0x08000000) +#define WB_SMALLSTYLE ((WinBits)0x04000000) +#define WB_TOGGLE ((WinBits)SAL_CONST_INT64(0x1000000000)) +#define WB_BEVELBUTTON ((WinBits)SAL_CONST_INT64(0x2000000000)) + +// Window-Bits for FixedText +#define WB_PATHELLIPSIS ((WinBits)0x00100000) +#define WB_EXTRAOFFSET ((WinBits)0x02000000) +#define WB_NOMULTILINE ((WinBits)0x10000000) +#define WB_INFO ((WinBits)0x20000000) + +// Window-Bits for CheckBox +#define WB_CBLINESTYLE ((WinBits)SAL_CONST_INT64(0x2000000000)) + +// Window-Bits for Edit +#define WB_PASSWORD ((WinBits)0x01000000) +#define WB_READONLY ((WinBits)0x02000000) +#define WB_NOHIDESELECTION ((WinBits)SAL_CONST_INT64(0x1000000000)) +#define WB_FORCECTRLBACKGROUND ((WinBits)0x80000000) + +// Window-Bits for MultiLineEdit +#define WB_IGNORETAB ((WinBits)0x20000000) + +// Window-Bits for ListBox and MultiListBox +#define WB_SIMPLEMODE ((WinBits)0x20000000) + +// Window-Bits for FixedBitmap +#define WB_FAST ((WinBits)0x04000000) +#define WB_SCALE ((WinBits)0x08000000) +#define WB_TOPLEFTVISIBLE ((WinBits)0x10000000) + +// Window-Bits for ToolBox +#define WB_LINESPACING ((WinBits)0x01000000) +#define WB_SCROLL ((WinBits)0x02000000) +#define WB_FORCETABCYCLE ((WinBits)0x04000000) + +// Window-Bits for TabControl +#define WB_SINGLELINE ((WinBits)0x02000000) + +// Window-Bits for DockingWindows +#define WB_DOCKBORDER ((WinBits)0x00001000) + +// Window-Bits for SplitWindow +#define WB_NOSPLITDRAW ((WinBits)0x01000000) +#define WB_FLATSPLITDRAW ((WinBits)0x02000000) + +// Window-Bits for MessageBoxen +#define WB_OK ((WinBits)0x00100000) +#define WB_OK_CANCEL ((WinBits)0x00200000) +#define WB_YES_NO ((WinBits)0x00400000) +#define WB_YES_NO_CANCEL ((WinBits)0x00800000) +#define WB_RETRY_CANCEL ((WinBits)0x01000000) +#define WB_DEF_OK ((WinBits)0x02000000) +#define WB_DEF_CANCEL ((WinBits)0x04000000) +#define WB_DEF_RETRY ((WinBits)0x08000000) +#define WB_DEF_YES ((WinBits)SAL_CONST_INT64(0x10000000)) +#define WB_DEF_NO ((WinBits)SAL_CONST_INT64(0x20000000)) +#define WB_ABORT_RETRY_IGNORE ((WinBits)SAL_CONST_INT64(0x1000000000)) +#define WB_DEF_IGNORE ((WinBits)SAL_CONST_INT64(0x2000000000)) + +// Standard-WinBits +#define WB_STDWORK (WB_SIZEMOVE | WB_CLOSEABLE) +#define WB_STDDOCKWIN (WB_DOCKABLE | WB_MOVEABLE | WB_CLOSEABLE) +#define WB_STDFLOATWIN (WB_SIZEMOVE | WB_CLOSEABLE | WB_ROLLABLE) +#define WB_STDDIALOG (WB_MOVEABLE | WB_CLOSEABLE) +#define WB_STDMODELESS (WB_STDDIALOG) +#define WB_STDMODAL (WB_STDDIALOG) +#define WB_STDTABDIALOG (WB_STDDIALOG) +#define WB_STDTABCONTROL 0 + +// For TreeListBox +#define WB_HASBUTTONS ((WinBits)0x00800000) +#define WB_HASLINES ((WinBits)0x01000000) +#define WB_HASLINESATROOT ((WinBits)0x02000000) + +// For FileOpen Dialog +#define WB_PATH ((WinBits)0x00100000) +#define WB_OPEN ((WinBits)0x00200000) +#define WB_SAVEAS ((WinBits)0x00400000) + +// For Slider +// Window-Bits for TabControl +#define WB_SLIDERSET ((WinBits)0x02000000) + + +// -------------------- +// - extended WinBits - +// -------------------- +#define WB_EXT_DOCUMENT ((WinBits)0x00000001) +#define WB_EXT_DOCMODIFIED ((WinBits)0x00000002) + +// --------------- +// - WindowAlign - +// --------------- + +// By changes you must also change: rsc/vclrsc.hxx +enum WindowAlign { WINDOWALIGN_LEFT, WINDOWALIGN_TOP, WINDOWALIGN_RIGHT, WINDOWALIGN_BOTTOM }; +enum ImageAlign { IMAGEALIGN_LEFT, IMAGEALIGN_TOP, IMAGEALIGN_RIGHT, IMAGEALIGN_BOTTOM, + IMAGEALIGN_LEFT_TOP, IMAGEALIGN_LEFT_BOTTOM, IMAGEALIGN_TOP_LEFT, + IMAGEALIGN_TOP_RIGHT, IMAGEALIGN_RIGHT_TOP, IMAGEALIGN_RIGHT_BOTTOM, + IMAGEALIGN_BOTTOM_LEFT, IMAGEALIGN_BOTTOM_RIGHT, IMAGEALIGN_CENTER }; +enum SymbolAlign { SYMBOLALIGN_LEFT, SYMBOLALIGN_RIGHT }; + +// ------------ +// - TriState - +// ------------ + +// By changes you must also change: rsc/vclrsc.hxx +enum TriState { STATE_NOCHECK, STATE_CHECK, STATE_DONTKNOW }; + + +// ---------------------- +// - ButtonDialog-Types - +// ---------------------- + +typedef USHORT StandardButtonType; +#define BUTTON_OK ((StandardButtonType)0) +#define BUTTON_CANCEL ((StandardButtonType)1) +#define BUTTON_YES ((StandardButtonType)2) +#define BUTTON_NO ((StandardButtonType)3) +#define BUTTON_RETRY ((StandardButtonType)4) +#define BUTTON_HELP ((StandardButtonType)5) +#define BUTTON_CLOSE ((StandardButtonType)6) +#define BUTTON_MORE ((StandardButtonType)7) +#define BUTTON_IGNORE ((StandardButtonType)8) +#define BUTTON_ABORT ((StandardButtonType)9) +#define BUTTON_LESS ((StandardButtonType)10) +#define BUTTON_COUNT 11 + +#endif // _TOOLS_WINTYPES_HXX + diff --git a/tools/prj/d.lst b/tools/prj/d.lst index c9fa9d2574a4..3208ecbb3168 100644 --- a/tools/prj/d.lst +++ b/tools/prj/d.lst @@ -35,7 +35,10 @@ mkdir: %_DEST%\inc%_EXT%\bootstrp ..\inc\tools\prex.h %_DEST%\inc%_EXT%\tools\prex.h ..\inc\tools\solarmutex.hxx %_DEST%\inc%_EXT%\tools\solarmutex.hxx -..\inc\tools\agapi.hxx %_DEST%\inc%_EXT%\tools\agapi.hxx +..\inc\tools\wintypes.hxx %_DEST%\inc%_EXT%\tools\wintypes.hxx +..\inc\tools\mapunit.hxx %_DEST%\inc%_EXT%\tools\mapunit.hxx +..\inc\tools\fldunit.hxx %_DEST%\inc%_EXT%\tools\fldunit.hxx +..\inc\tools\fontenum.hxx %_DEST%\inc%_EXT%\tools\fontenum.hxx ..\inc\tools\agapi.hxx %_DEST%\inc%_EXT%\tools\agapi.hxx ..\inc\tools\agitem.hxx %_DEST%\inc%_EXT%\tools\agitem.hxx ..\inc\tools\appendunixshellword.hxx %_DEST%\inc%_EXT%\tools\appendunixshellword.hxx diff --git a/tools/source/generic/line.cxx b/tools/source/generic/line.cxx index 5e698d50c006..d86ff82cb739 100644 --- a/tools/source/generic/line.cxx +++ b/tools/source/generic/line.cxx @@ -39,11 +39,6 @@ #include #include -inline long FRound( double fVal ) -{ - return( fVal > 0.0 ? (long) ( fVal + 0.5 ) : -(long) ( -fVal + 0.5 ) ); -} - // -------- // - Line - // -------- diff --git a/vcl/inc/vcl/fldunit.hxx b/vcl/inc/vcl/fldunit.hxx index 98bc27cbadba..7417342d95be 100644 --- a/vcl/inc/vcl/fldunit.hxx +++ b/vcl/inc/vcl/fldunit.hxx @@ -31,14 +31,6 @@ #ifndef _VCL_FLDUNIT_HXX #define _VCL_FLDUNIT_HXX -// -------------- -// - FieldTypes - -// -------------- - -// By changes you must also change: rsc/vclrsc.hxx -enum FieldUnit { FUNIT_NONE, FUNIT_MM, FUNIT_CM, FUNIT_M, FUNIT_KM, - FUNIT_TWIP, FUNIT_POINT, FUNIT_PICA, - FUNIT_INCH, FUNIT_FOOT, FUNIT_MILE, FUNIT_CUSTOM, - FUNIT_PERCENT, FUNIT_100TH_MM }; +#include #endif // _VCL_FLDUNIT_HXX diff --git a/vcl/inc/vcl/mapunit.hxx b/vcl/inc/vcl/mapunit.hxx index 6ba500f4fdb7..c50ba49c17bb 100644 --- a/vcl/inc/vcl/mapunit.hxx +++ b/vcl/inc/vcl/mapunit.hxx @@ -31,14 +31,6 @@ #ifndef _VCL_MAPUNIT_HXX #define _VCL_MAPUNIT_HXX -// ----------------- -// - MapMode-Types - -// ----------------- - -// By changes you must also change: rsc/vclrsc.hxx -enum MapUnit { MAP_100TH_MM, MAP_10TH_MM, MAP_MM, MAP_CM, - MAP_1000TH_INCH, MAP_100TH_INCH, MAP_10TH_INCH, MAP_INCH, - MAP_POINT, MAP_TWIP, MAP_PIXEL, MAP_SYSFONT, MAP_APPFONT, - MAP_RELATIVE, MAP_REALAPPFONT, MAP_LASTENUMDUMMY }; +#include #endif // _VCL_MAPUNIT_HXX diff --git a/vcl/inc/vcl/salbtype.hxx b/vcl/inc/vcl/salbtype.hxx index 2a10353bee94..d9be75369a5d 100644 --- a/vcl/inc/vcl/salbtype.hxx +++ b/vcl/inc/vcl/salbtype.hxx @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -49,14 +50,6 @@ typedef HPBYTE Scanline; typedef const BYTE* ConstHPBYTE; typedef ConstHPBYTE ConstScanline; -// -------------------- -// - Helper functions - -// -------------------- - -inline long MinMax( long nVal, long nMin, long nMax ); -inline long AlignedWidth4Bytes( long nWidthBits ); -inline long FRound( double fVal ); - // ------------------ // - Bitmap formats - // ------------------ @@ -292,29 +285,6 @@ struct VCL_DLLPUBLIC BitmapBuffer VCL_DLLPUBLIC BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRect& rTwoRect, ULONG nDstBitmapFormat, BitmapPalette* pDstPal = NULL, ColorMask* pDstMask = NULL ); -// --------------- -// - Inlines - -// --------------- - -inline long MinMax( long nVal, long nMin, long nMax ) -{ - return( nVal >= nMin ? ( nVal <= nMax ? nVal : nMax ) : nMin ); -} - -// ------------------------------------------------------------------ - -inline long AlignedWidth4Bytes( long nWidthBits ) -{ - return( ( ( nWidthBits + 31 ) >> 5 ) << 2 ); -} - -// ------------------------------------------------------------------ - -inline long FRound( double fVal ) -{ - return( fVal > 0.0 ? (long) ( fVal + 0.5 ) : -(long) ( -fVal + 0.5 ) ); -} - // ------------------------------------------------------------------ inline BitmapColor::BitmapColor() : diff --git a/vcl/inc/vcl/wintypes.hxx b/vcl/inc/vcl/wintypes.hxx index 968f0e1d255f..9e84648fb6a8 100644 --- a/vcl/inc/vcl/wintypes.hxx +++ b/vcl/inc/vcl/wintypes.hxx @@ -30,308 +30,7 @@ #ifndef _SV_WINTYPES_HXX #define _SV_WINTYPES_HXX -#include -#include - -// ---------------- -// - Window-Types - -// ---------------- - -typedef USHORT WindowType; -#define WINDOW_BASE 0x0100 -#define WINDOW_FIRST (WINDOW_BASE + 0x30) -#define WINDOW_MESSBOX (WINDOW_FIRST) -#define WINDOW_INFOBOX (WINDOW_FIRST + 0x01) -#define WINDOW_WARNINGBOX (WINDOW_FIRST + 0x02) -#define WINDOW_ERRORBOX (WINDOW_FIRST + 0x03) -#define WINDOW_QUERYBOX (WINDOW_FIRST + 0x04) -#define WINDOW_WINDOW (WINDOW_FIRST + 0x05) -#define WINDOW_SYSWINDOW (WINDOW_FIRST + 0x06) -#define WINDOW_WORKWINDOW (WINDOW_FIRST + 0x07) -// #define WINDOW_MDIWINDOW (WINDOW_FIRST + 0x08) -#define WINDOW_FLOATINGWINDOW (WINDOW_FIRST + 0x09) -#define WINDOW_DIALOG (WINDOW_FIRST + 0x0a) -#define WINDOW_MODELESSDIALOG (WINDOW_FIRST + 0x0b) -#define WINDOW_MODALDIALOG (WINDOW_FIRST + 0x0c) -#define WINDOW_SYSTEMDIALOG (WINDOW_FIRST + 0x0d) -#define WINDOW_PATHDIALOG (WINDOW_FIRST + 0x0e) -#define WINDOW_FILEDIALOG (WINDOW_FIRST + 0x0f) -#define WINDOW_PRINTERSETUPDIALOG (WINDOW_FIRST + 0x10) -#define WINDOW_PRINTDIALOG (WINDOW_FIRST + 0x11) -#define WINDOW_COLORDIALOG (WINDOW_FIRST + 0x12) -#define WINDOW_FONTDIALOG (WINDOW_FIRST + 0x13) -#define WINDOW_CONTROL (WINDOW_FIRST + 0x14) -#define WINDOW_BUTTON (WINDOW_FIRST + 0x15) -#define WINDOW_PUSHBUTTON (WINDOW_FIRST + 0x16) -#define WINDOW_OKBUTTON (WINDOW_FIRST + 0x17) -#define WINDOW_CANCELBUTTON (WINDOW_FIRST + 0x18) -#define WINDOW_HELPBUTTON (WINDOW_FIRST + 0x19) -#define WINDOW_IMAGEBUTTON (WINDOW_FIRST + 0x1a) -#define WINDOW_MENUBUTTON (WINDOW_FIRST + 0x1b) -#define WINDOW_MOREBUTTON (WINDOW_FIRST + 0x1c) -#define WINDOW_SPINBUTTON (WINDOW_FIRST + 0x1d) -#define WINDOW_RADIOBUTTON (WINDOW_FIRST + 0x1e) -#define WINDOW_IMAGERADIOBUTTON (WINDOW_FIRST + 0x1f) -#define WINDOW_CHECKBOX (WINDOW_FIRST + 0x20) -#define WINDOW_TRISTATEBOX (WINDOW_FIRST + 0x21) -#define WINDOW_EDIT (WINDOW_FIRST + 0x22) -#define WINDOW_MULTILINEEDIT (WINDOW_FIRST + 0x23) -#define WINDOW_COMBOBOX (WINDOW_FIRST + 0x24) -#define WINDOW_LISTBOX (WINDOW_FIRST + 0x25) -#define WINDOW_MULTILISTBOX (WINDOW_FIRST + 0x26) -#define WINDOW_FIXEDTEXT (WINDOW_FIRST + 0x27) -#define WINDOW_FIXEDLINE (WINDOW_FIRST + 0x28) -#define WINDOW_FIXEDBITMAP (WINDOW_FIRST + 0x29) -#define WINDOW_FIXEDIMAGE (WINDOW_FIRST + 0x2a) -#define WINDOW_GROUPBOX (WINDOW_FIRST + 0x2c) -#define WINDOW_SCROLLBAR (WINDOW_FIRST + 0x2d) -#define WINDOW_SCROLLBARBOX (WINDOW_FIRST + 0x2e) -#define WINDOW_SPLITTER (WINDOW_FIRST + 0x2f) -#define WINDOW_SPLITWINDOW (WINDOW_FIRST + 0x30) -#define WINDOW_SPINFIELD (WINDOW_FIRST + 0x31) -#define WINDOW_PATTERNFIELD (WINDOW_FIRST + 0x32) -#define WINDOW_NUMERICFIELD (WINDOW_FIRST + 0x33) -#define WINDOW_METRICFIELD (WINDOW_FIRST + 0x34) -#define WINDOW_CURRENCYFIELD (WINDOW_FIRST + 0x35) -#define WINDOW_DATEFIELD (WINDOW_FIRST + 0x36) -#define WINDOW_TIMEFIELD (WINDOW_FIRST + 0x37) -#define WINDOW_PATTERNBOX (WINDOW_FIRST + 0x38) -#define WINDOW_NUMERICBOX (WINDOW_FIRST + 0x39) -#define WINDOW_METRICBOX (WINDOW_FIRST + 0x3a) -#define WINDOW_CURRENCYBOX (WINDOW_FIRST + 0x3b) -#define WINDOW_DATEBOX (WINDOW_FIRST + 0x3c) -#define WINDOW_TIMEBOX (WINDOW_FIRST + 0x3d) -#define WINDOW_LONGCURRENCYFIELD (WINDOW_FIRST + 0x3e) -#define WINDOW_LONGCURRENCYBOX (WINDOW_FIRST + 0x3f) -#define WINDOW_TOOLBOX (WINDOW_FIRST + 0x41) -#define WINDOW_DOCKINGWINDOW (WINDOW_FIRST + 0x42) -#define WINDOW_STATUSBAR (WINDOW_FIRST + 0x43) -#define WINDOW_TABPAGE (WINDOW_FIRST + 0x44) -#define WINDOW_TABCONTROL (WINDOW_FIRST + 0x45) -#define WINDOW_TABDIALOG (WINDOW_FIRST + 0x46) -#define WINDOW_BORDERWINDOW (WINDOW_FIRST + 0x47) -#define WINDOW_BUTTONDIALOG (WINDOW_FIRST + 0x48) -#define WINDOW_SYSTEMCHILDWINDOW (WINDOW_FIRST + 0x49) -#define WINDOW_FIXEDBORDER (WINDOW_FIRST + 0x4a) -#define WINDOW_SLIDER (WINDOW_FIRST + 0x4b) -#define WINDOW_MENUBARWINDOW (WINDOW_FIRST + 0x4c) -#define WINDOW_TREELISTBOX (WINDOW_FIRST + 0x4d) -#define WINDOW_HELPTEXTWINDOW (WINDOW_FIRST + 0x4e) -#define WINDOW_INTROWINDOW (WINDOW_FIRST + 0x4f) -#define WINDOW_LISTBOXWINDOW (WINDOW_FIRST + 0x50) -#define WINDOW_DOCKINGAREA (WINDOW_FIRST + 0x51) -#define WINDOW_LAST (WINDOW_DOCKINGAREA) - - -// --------------- -// - Window-Bits - -// --------------- - -// By changes you must also change: rsc/vclrsc.hxx -typedef sal_Int64 WinBits; - -// Window-Bits fuer Window -#define WB_CLIPCHILDREN ((WinBits)0x00000001) -#define WB_DIALOGCONTROL ((WinBits)0x00000002) -#define WB_NODIALOGCONTROL ((WinBits)0x00000004) -#define WB_BORDER ((WinBits)0x00000008) -#define WB_NOBORDER ((WinBits)0x00000010) -#define WB_SIZEABLE ((WinBits)0x00000020) -#define WB_3DLOOK ((WinBits)0x00000040) -#define WB_AUTOSIZE ((WinBits)0x00000080) - -// Window-Bits fuer SystemWindows -#define WB_MOVEABLE ((WinBits)0x00000100) -#define WB_ROLLABLE ((WinBits)0x00000200) -#define WB_CLOSEABLE ((WinBits)0x00000400) -#define WB_STANDALONE ((WinBits)0x00000800) -#define WB_APP ((WinBits)0x00001000) -#define WB_PINABLE ((WinBits)0x00002000) -#define WB_SYSTEMWINDOW ((WinBits)SAL_CONST_INT64(0x40000000)) -// warning: do not confuse WB_SYSTEMCHILDWINDOW with the SystemChildWindow class - -// the SystemChildWindow class was there first and is a very specialized -// sytem child window type for plugged applications. The SystemChildWindow class -// explicitly should never use the WB_SYSTEMCHILDWINDOW WinBit - -// WB_SYSTEMCHILDWINDOW on the other hand is to be used on system windows -// which should be created as system child windows with (more or less) -// normal event handling -#define WB_SYSTEMCHILDWINDOW ((WinBits)SAL_CONST_INT64(0x8000000000)) -#define WB_SIZEMOVE (WB_SIZEABLE | WB_MOVEABLE) - -// Standard-Window-Bits fuer ChildWindows -#define WB_TABSTOP ((WinBits)0x00000100) -#define WB_NOTABSTOP ((WinBits)0x00000200) -#define WB_GROUP ((WinBits)0x00000400) -#define WB_NOGROUP ((WinBits)0x00000800) -#define WB_HORZ ((WinBits)0x00001000) -#define WB_VERT ((WinBits)0x00002000) -#define WB_LEFT ((WinBits)0x00004000) -#define WB_CENTER ((WinBits)0x00008000) -#define WB_RIGHT ((WinBits)0x00010000) -#define WB_TOP ((WinBits)0x00020000) -#define WB_VCENTER ((WinBits)0x00040000) -#define WB_BOTTOM ((WinBits)0x00080000) -#define WB_DRAG ((WinBits)0x00100000) -#define WB_SPIN ((WinBits)0x00200000) -#define WB_REPEAT ((WinBits)0x00400000) -#define WB_NOPOINTERFOCUS ((WinBits)0x00800000) -#define WB_WORDBREAK ((WinBits)0x01000000) -#define WB_NOLABEL ((WinBits)0x02000000) -#define WB_SORT ((WinBits)0x04000000) -#define WB_DROPDOWN ((WinBits)0x08000000) -#define WB_AUTOHSCROLL ((WinBits)SAL_CONST_INT64(0x10000000)) -#define WB_DOCKABLE ((WinBits)SAL_CONST_INT64(0x20000000)) -#define WB_AUTOVSCROLL ((WinBits)SAL_CONST_INT64(0x40000000)) -#define WB_HYPHENATION (((WinBits)SAL_CONST_INT64(0x80000000)) | WB_WORDBREAK) -#define WB_CHILDDLGCTRL ((WinBits)SAL_CONST_INT64(0x100000000000)) - -// system floating window -#define WB_SYSTEMFLOATWIN ((WinBits)SAL_CONST_INT64(0x100000000)) -#define WB_INTROWIN ((WinBits)SAL_CONST_INT64(0x200000000)) -#define WB_NOSHADOW ((WinBits)SAL_CONST_INT64(0x400000000)) -#define WB_TOOLTIPWIN ((WinBits)SAL_CONST_INT64(0x800000000)) -#define WB_OWNERDRAWDECORATION ((WinBits)SAL_CONST_INT64(0x2000000000)) -#define WB_DEFAULTWIN ((WinBits)SAL_CONST_INT64(0x4000000000)) -#define WB_NEEDSFOCUS ((WinBits)SAL_CONST_INT64(0x1000000000)) - -#define WB_HIDE ((WinBits)SAL_CONST_INT64(0x80000000)) -#define WB_HSCROLL WB_HORZ -#define WB_VSCROLL WB_VERT -#define WB_TOPIMAGE WB_TOP - -// Window-Bits for PushButtons -#define WB_DEFBUTTON ((WinBits)0x10000000) -#define WB_NOLIGHTBORDER ((WinBits)0x20000000) -#define WB_RECTSTYLE ((WinBits)0x08000000) -#define WB_SMALLSTYLE ((WinBits)0x04000000) -#define WB_TOGGLE ((WinBits)SAL_CONST_INT64(0x1000000000)) -#define WB_BEVELBUTTON ((WinBits)SAL_CONST_INT64(0x2000000000)) - -// Window-Bits for FixedText -#define WB_PATHELLIPSIS ((WinBits)0x00100000) -#define WB_EXTRAOFFSET ((WinBits)0x02000000) -#define WB_NOMULTILINE ((WinBits)0x10000000) -#define WB_INFO ((WinBits)0x20000000) - -// Window-Bits for CheckBox -#define WB_CBLINESTYLE ((WinBits)SAL_CONST_INT64(0x2000000000)) - -// Window-Bits for Edit -#define WB_PASSWORD ((WinBits)0x01000000) -#define WB_READONLY ((WinBits)0x02000000) -#define WB_NOHIDESELECTION ((WinBits)SAL_CONST_INT64(0x1000000000)) -#define WB_FORCECTRLBACKGROUND ((WinBits)0x80000000) - -// Window-Bits for MultiLineEdit -#define WB_IGNORETAB ((WinBits)0x20000000) - -// Window-Bits for ListBox and MultiListBox -#define WB_SIMPLEMODE ((WinBits)0x20000000) - -// Window-Bits for FixedBitmap -#define WB_FAST ((WinBits)0x04000000) -#define WB_SCALE ((WinBits)0x08000000) -#define WB_TOPLEFTVISIBLE ((WinBits)0x10000000) - -// Window-Bits for ToolBox -#define WB_LINESPACING ((WinBits)0x01000000) -#define WB_SCROLL ((WinBits)0x02000000) -#define WB_FORCETABCYCLE ((WinBits)0x04000000) - -// Window-Bits for TabControl -#define WB_SINGLELINE ((WinBits)0x02000000) - -// Window-Bits for DockingWindows -#define WB_DOCKBORDER ((WinBits)0x00001000) - -// Window-Bits for SplitWindow -#define WB_NOSPLITDRAW ((WinBits)0x01000000) -#define WB_FLATSPLITDRAW ((WinBits)0x02000000) - -// Window-Bits for MessageBoxen -#define WB_OK ((WinBits)0x00100000) -#define WB_OK_CANCEL ((WinBits)0x00200000) -#define WB_YES_NO ((WinBits)0x00400000) -#define WB_YES_NO_CANCEL ((WinBits)0x00800000) -#define WB_RETRY_CANCEL ((WinBits)0x01000000) -#define WB_DEF_OK ((WinBits)0x02000000) -#define WB_DEF_CANCEL ((WinBits)0x04000000) -#define WB_DEF_RETRY ((WinBits)0x08000000) -#define WB_DEF_YES ((WinBits)SAL_CONST_INT64(0x10000000)) -#define WB_DEF_NO ((WinBits)SAL_CONST_INT64(0x20000000)) -#define WB_ABORT_RETRY_IGNORE ((WinBits)SAL_CONST_INT64(0x1000000000)) -#define WB_DEF_IGNORE ((WinBits)SAL_CONST_INT64(0x2000000000)) - -// Standard-WinBits -#define WB_STDWORK (WB_SIZEMOVE | WB_CLOSEABLE) -#define WB_STDDOCKWIN (WB_DOCKABLE | WB_MOVEABLE | WB_CLOSEABLE) -#define WB_STDFLOATWIN (WB_SIZEMOVE | WB_CLOSEABLE | WB_ROLLABLE) -#define WB_STDDIALOG (WB_MOVEABLE | WB_CLOSEABLE) -#define WB_STDMODELESS (WB_STDDIALOG) -#define WB_STDMODAL (WB_STDDIALOG) -#define WB_STDTABDIALOG (WB_STDDIALOG) -#define WB_STDTABCONTROL 0 - -// For TreeListBox -#define WB_HASBUTTONS ((WinBits)0x00800000) -#define WB_HASLINES ((WinBits)0x01000000) -#define WB_HASLINESATROOT ((WinBits)0x02000000) - -// For FileOpen Dialog -#define WB_PATH ((WinBits)0x00100000) -#define WB_OPEN ((WinBits)0x00200000) -#define WB_SAVEAS ((WinBits)0x00400000) - -// For Slider -// Window-Bits for TabControl -#define WB_SLIDERSET ((WinBits)0x02000000) - - -// -------------------- -// - extended WinBits - -// -------------------- -#define WB_EXT_DOCUMENT ((WinBits)0x00000001) -#define WB_EXT_DOCMODIFIED ((WinBits)0x00000002) - -// --------------- -// - WindowAlign - -// --------------- - -// By changes you must also change: rsc/vclrsc.hxx -enum WindowAlign { WINDOWALIGN_LEFT, WINDOWALIGN_TOP, WINDOWALIGN_RIGHT, WINDOWALIGN_BOTTOM }; -enum ImageAlign { IMAGEALIGN_LEFT, IMAGEALIGN_TOP, IMAGEALIGN_RIGHT, IMAGEALIGN_BOTTOM, - IMAGEALIGN_LEFT_TOP, IMAGEALIGN_LEFT_BOTTOM, IMAGEALIGN_TOP_LEFT, - IMAGEALIGN_TOP_RIGHT, IMAGEALIGN_RIGHT_TOP, IMAGEALIGN_RIGHT_BOTTOM, - IMAGEALIGN_BOTTOM_LEFT, IMAGEALIGN_BOTTOM_RIGHT, IMAGEALIGN_CENTER }; -enum SymbolAlign { SYMBOLALIGN_LEFT, SYMBOLALIGN_RIGHT }; - -// ------------ -// - TriState - -// ------------ - -// By changes you must also change: rsc/vclrsc.hxx -enum TriState { STATE_NOCHECK, STATE_CHECK, STATE_DONTKNOW }; - - -// ---------------------- -// - ButtonDialog-Types - -// ---------------------- - -typedef USHORT StandardButtonType; -#define BUTTON_OK ((StandardButtonType)0) -#define BUTTON_CANCEL ((StandardButtonType)1) -#define BUTTON_YES ((StandardButtonType)2) -#define BUTTON_NO ((StandardButtonType)3) -#define BUTTON_RETRY ((StandardButtonType)4) -#define BUTTON_HELP ((StandardButtonType)5) -#define BUTTON_CLOSE ((StandardButtonType)6) -#define BUTTON_MORE ((StandardButtonType)7) -#define BUTTON_IGNORE ((StandardButtonType)8) -#define BUTTON_ABORT ((StandardButtonType)9) -#define BUTTON_LESS ((StandardButtonType)10) -#define BUTTON_COUNT 11 +#include #endif // _SV_WINTYPES_HXX -- cgit From 942dbe34b9a1400c926a81f88e849d248b58ed55 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Mon, 19 Oct 2009 13:22:39 +0200 Subject: #i103496#: move some fontsubstitution stuff from vcl to unotools to get xmloff vcl free --- svtools/source/filter.vcl/wmf/wmfwr.cxx | 2 +- unotools/inc/unotools/fontcfg.hxx | 230 +++++ unotools/inc/unotools/fontcvt.hxx | 82 ++ unotools/inc/unotools/fontdefs.hxx | 110 +++ unotools/source/config/fontcfg.cxx | 1220 ++++++++++++++++++++++++ unotools/source/config/makefile.mk | 1 + unotools/source/misc/fontcvt.cxx | 1523 ++++++++++++++++++++++++++++++ unotools/source/misc/fontdefs.cxx | 596 ++++++++++++ unotools/source/misc/makefile.mk | 2 + vcl/inc/vcl/fontcfg.hxx | 232 ----- vcl/inc/vcl/fontcvt.hxx | 103 --- vcl/inc/vcl/outdev.h | 29 +- vcl/inc/vcl/outdev.hxx | 26 +- vcl/inc/vcl/outfont.hxx | 16 +- vcl/inc/vcl/svdata.hxx | 7 +- vcl/source/app/settings.cxx | 4 +- vcl/source/app/svdata.cxx | 2 +- vcl/source/app/svmain.cxx | 2 +- vcl/source/gdi/configsettings.cxx | 205 +++++ vcl/source/gdi/font.cxx | 12 +- vcl/source/gdi/fontcfg.cxx | 1381 ---------------------------- vcl/source/gdi/fontcvt.cxx | 1528 ------------------------------- vcl/source/gdi/makefile.mk | 5 +- vcl/source/gdi/outdev3.cxx | 611 +----------- vcl/source/window/window.cxx | 4 +- vcl/util/makefile.mk | 1 - 26 files changed, 4022 insertions(+), 3912 deletions(-) create mode 100644 unotools/inc/unotools/fontcfg.hxx create mode 100644 unotools/inc/unotools/fontcvt.hxx create mode 100644 unotools/inc/unotools/fontdefs.hxx create mode 100644 unotools/source/config/fontcfg.cxx create mode 100644 unotools/source/misc/fontcvt.cxx create mode 100644 unotools/source/misc/fontdefs.cxx delete mode 100644 vcl/inc/vcl/fontcfg.hxx delete mode 100644 vcl/inc/vcl/fontcvt.hxx create mode 100644 vcl/source/gdi/configsettings.cxx delete mode 100644 vcl/source/gdi/fontcfg.cxx delete mode 100644 vcl/source/gdi/fontcvt.cxx diff --git a/svtools/source/filter.vcl/wmf/wmfwr.cxx b/svtools/source/filter.vcl/wmf/wmfwr.cxx index ee3a71c51f9d..5b9970ee471f 100644 --- a/svtools/source/filter.vcl/wmf/wmfwr.cxx +++ b/svtools/source/filter.vcl/wmf/wmfwr.cxx @@ -33,7 +33,7 @@ #include #include "wmfwr.hxx" -#include +#include #include #include #include diff --git a/unotools/inc/unotools/fontcfg.hxx b/unotools/inc/unotools/fontcfg.hxx new file mode 100644 index 000000000000..4d0ed4036328 --- /dev/null +++ b/unotools/inc/unotools/fontcfg.hxx @@ -0,0 +1,230 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: fontcfg.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _UNOTOOLS_FONTCFG_HXX +#define _UNOTOOLS_FONTCFG_HXX + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace com { +namespace sun { +namespace star { +namespace lang { + +// equality operator needed for hash_map; +// (-> why does this need to be in the namespace of Locale ? g++ fails to compile else) +inline bool operator==( const com::sun::star::lang::Locale& rLeft, const com::sun::star::lang::Locale& rRight ) +{ + return + rLeft.Language.equals( rRight.Language ) && + rLeft.Country.equals( rRight.Country ) && + rLeft.Variant.equals( rRight.Variant ) + ; +} +}}}} + +namespace utl +{ + +struct LocaleHash +{ + size_t operator()( const com::sun::star::lang::Locale& rLocale ) const + { + return + (size_t)rLocale.Language.hashCode() ^ + (size_t)rLocale.Country.hashCode() ^ + (size_t)rLocale.Variant.hashCode(); + } +}; + +class UNOTOOLS_DLLPUBLIC DefaultFontConfiguration +{ + com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > + m_xConfigProvider; + com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > + m_xConfigAccess; + + struct LocaleAccess + { + // the real string used in the configuration + // used to get rid of upper/lower case problems + rtl::OUString aConfigLocaleString; + // xAccess is mutable to be able to be filled on demand + mutable com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xAccess; + }; + + std::hash_map< com::sun::star::lang::Locale, + LocaleAccess, + utl::LocaleHash > + m_aConfig; + + rtl::OUString tryLocale( const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rType ) const; + + DefaultFontConfiguration(); + public: + ~DefaultFontConfiguration(); + + static DefaultFontConfiguration* get(); + + rtl::OUString getDefaultFont( const com::sun::star::lang::Locale& rLocale, int nType ) const; + rtl::OUString getUserInterfaceFont( const com::sun::star::lang::Locale& rLocale ) const; +}; + +// IMPL_FONT_ATTR_DEFAULT - Default-Font like Andale Sans UI, Palace Script, Albany, Thorndale, Cumberland, ... +// IMPL_FONT_ATTR_STANDARD - Standard-Font like Arial, Times, Courier, ... +// IMPL_FONT_ATTR_NORMAL - normal Font for writing text like Arial, Verdana, Arial Narrow, Trebuchet, Times, Courier, ... +// IMPL_FONT_ATTR_SYMBOL - Font with symbols +// IMPL_FONT_ATTR_DECORATIVE - Readable and normally used for drawings +// IMPL_FONT_ATTR_SPECIAL - very special design +// IMPL_FONT_ATTR_TITLING - only uppercase characters +// IMPL_FONT_ATTR_FULL - Font with normally all characters +// IMPL_FONT_ATTR_CAPITALS - only uppercase characters, but lowercase characters smaller as the uppercase characters +// IMPL_FONT_ATTR_TYPEWRITER - like a typewriter: Courier, ... +// IMPL_FONT_ATTR_SCRIPT - Handwriting or Script +// IMPL_FONT_ATTR_HANDWRITING - More Handwriting with normal letters +// IMPL_FONT_ATTR_CHANCERY - Like Zapf Chancery +// IMPL_FONT_ATTR_COMIC - Like Comic Sans MS +// IMPL_FONT_ATTR_BRUSHSCRIPT - More Script +// IMPL_FONT_ATTR_OTHERSTYLE - OldStyle, ... so negativ points +#define IMPL_FONT_ATTR_DEFAULT ((ULONG)0x00000001) +#define IMPL_FONT_ATTR_STANDARD ((ULONG)0x00000002) +#define IMPL_FONT_ATTR_NORMAL ((ULONG)0x00000004) +#define IMPL_FONT_ATTR_SYMBOL ((ULONG)0x00000008) +#define IMPL_FONT_ATTR_FIXED ((ULONG)0x00000010) +#define IMPL_FONT_ATTR_SANSSERIF ((ULONG)0x00000020) +#define IMPL_FONT_ATTR_SERIF ((ULONG)0x00000040) +#define IMPL_FONT_ATTR_DECORATIVE ((ULONG)0x00000080) +#define IMPL_FONT_ATTR_SPECIAL ((ULONG)0x00000100) +#define IMPL_FONT_ATTR_ITALIC ((ULONG)0x00000200) +#define IMPL_FONT_ATTR_TITLING ((ULONG)0x00000400) +#define IMPL_FONT_ATTR_CAPITALS ((ULONG)0x00000800) +#define IMPL_FONT_ATTR_CJK ((ULONG)0x00001000) +#define IMPL_FONT_ATTR_CJK_JP ((ULONG)0x00002000) +#define IMPL_FONT_ATTR_CJK_SC ((ULONG)0x00004000) +#define IMPL_FONT_ATTR_CJK_TC ((ULONG)0x00008000) +#define IMPL_FONT_ATTR_CJK_KR ((ULONG)0x00010000) +#define IMPL_FONT_ATTR_CTL ((ULONG)0x00020000) +#define IMPL_FONT_ATTR_NONELATIN ((ULONG)0x00040000) +#define IMPL_FONT_ATTR_FULL ((ULONG)0x00080000) +#define IMPL_FONT_ATTR_OUTLINE ((ULONG)0x00100000) +#define IMPL_FONT_ATTR_SHADOW ((ULONG)0x00200000) +#define IMPL_FONT_ATTR_ROUNDED ((ULONG)0x00400000) +#define IMPL_FONT_ATTR_TYPEWRITER ((ULONG)0x00800000) +#define IMPL_FONT_ATTR_SCRIPT ((ULONG)0x01000000) +#define IMPL_FONT_ATTR_HANDWRITING ((ULONG)0x02000000) +#define IMPL_FONT_ATTR_CHANCERY ((ULONG)0x04000000) +#define IMPL_FONT_ATTR_COMIC ((ULONG)0x08000000) +#define IMPL_FONT_ATTR_BRUSHSCRIPT ((ULONG)0x10000000) +#define IMPL_FONT_ATTR_GOTHIC ((ULONG)0x20000000) +#define IMPL_FONT_ATTR_SCHOOLBOOK ((ULONG)0x40000000) +#define IMPL_FONT_ATTR_OTHERSTYLE ((ULONG)0x80000000) + +#define IMPL_FONT_ATTR_CJK_ALLLANG (IMPL_FONT_ATTR_CJK_JP | IMPL_FONT_ATTR_CJK_SC | IMPL_FONT_ATTR_CJK_TC | IMPL_FONT_ATTR_CJK_KR) +#define IMPL_FONT_ATTR_ALLSCRIPT (IMPL_FONT_ATTR_SCRIPT | IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_COMIC | IMPL_FONT_ATTR_BRUSHSCRIPT) +#define IMPL_FONT_ATTR_ALLSUBSCRIPT (IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_COMIC | IMPL_FONT_ATTR_BRUSHSCRIPT) +#define IMPL_FONT_ATTR_ALLSERIFSTYLE (IMPL_FONT_ATTR_ALLSCRIPT |\ + IMPL_FONT_ATTR_SANSSERIF | IMPL_FONT_ATTR_SERIF |\ + IMPL_FONT_ATTR_FIXED | IMPL_FONT_ATTR_ITALIC |\ + IMPL_FONT_ATTR_GOTHIC | IMPL_FONT_ATTR_SCHOOLBOOK |\ + IMPL_FONT_ATTR_SHADOW | IMPL_FONT_ATTR_OUTLINE) + +struct UNOTOOLS_DLLPUBLIC FontNameAttr +{ + String Name; + ::std::vector< String > Substitutions; + ::std::vector< String > MSSubstitutions; + ::std::vector< String > PSSubstitutions; + ::std::vector< String > HTMLSubstitutions; + FontWeight Weight; + FontWidth Width; + unsigned long Type; // bitfield of IMPL_FONT_ATTR_* +}; + +class UNOTOOLS_DLLPUBLIC FontSubstConfiguration +{ +private: + com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > + m_xConfigProvider; + com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > + m_xConfigAccess; + struct LocaleSubst + { + rtl::OUString aConfigLocaleString; + mutable bool bConfigRead; + // note: aSubstAttributes must be sorted alphabetically by Name + // searches on the substitutes are done with Name as key, where + // a minimal match is sufficient (that is e.g. "Thorndale" will match + // "Thorndale BlaBlub"). Also names must be lower case. + mutable std::vector< FontNameAttr > aSubstAttributes; + + LocaleSubst() : bConfigRead( false ) {} + }; + std::hash_map< com::sun::star::lang::Locale, LocaleSubst, utl::LocaleHash > m_aSubst; + typedef std::hash_set< rtl::OUString, rtl::OUStringHash > UniqueSubstHash; + mutable UniqueSubstHash maSubstHash; + + + void fillSubstVector( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xFont, + const rtl::OUString& rType, + std::vector< String >& rSubstVector ) const; + FontWeight getSubstWeight( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xFont, + const rtl::OUString& rType ) const; + FontWidth getSubstWidth( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xFont, + const rtl::OUString& rType ) const; + unsigned long getSubstType( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xFont, + const rtl::OUString& rType ) const; + void readLocaleSubst( const com::sun::star::lang::Locale& rLocale ) const; + FontSubstConfiguration(); +public: + ~FontSubstConfiguration(); + + static FontSubstConfiguration* get(); + + const FontNameAttr* getSubstInfo( + const String& rFontName, + const com::sun::star::lang::Locale& rLocale = + com::sun::star::lang::Locale( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "en" ) ), + rtl::OUString(), + rtl::OUString() ) + ) const; + static void getMapName( const String& rOrgName, String& rShortName, String& rFamilyName, FontWeight& rWeight, FontWidth& rWidth, ULONG& rType ); +}; + +} // namespace utl + +#endif // _UNOTOOLS_FONTCFG_HXX diff --git a/unotools/inc/unotools/fontcvt.hxx b/unotools/inc/unotools/fontcvt.hxx new file mode 100644 index 000000000000..679a2dc5a6d9 --- /dev/null +++ b/unotools/inc/unotools/fontcvt.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: fontcvt.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _UNOTOOLS_FONTCVT_HXX +#define _UNOTOOLS_FONTCVT_HXX + +#include +#include + +// ------------------ +// - FontToSubsFont - +// ------------------ + +#define FONTTOSUBSFONT_IMPORT ((ULONG)0x00000001) +#define FONTTOSUBSFONT_EXPORT ((ULONG)0x00000002) +#define FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ((ULONG)0x00000004) + +typedef void* FontToSubsFontConverter; +UNOTOOLS_DLLPUBLIC FontToSubsFontConverter CreateFontToSubsFontConverter( const String& rFontName, ULONG nFlags ); +UNOTOOLS_DLLPUBLIC void DestroyFontToSubsFontConverter( FontToSubsFontConverter hConverter ); +UNOTOOLS_DLLPUBLIC sal_Unicode ConvertFontToSubsFontChar( FontToSubsFontConverter hConverter, sal_Unicode c ); +UNOTOOLS_DLLPUBLIC String GetFontToSubsFontName( FontToSubsFontConverter hConverter ); + +// --------------------------- +// - StarSymbolToMSMultiFont - +// --------------------------- + +class UNOTOOLS_DLLPUBLIC StarSymbolToMSMultiFont +{ +public: + //Returns the name of the best windows symbol font which this char can be + //mapped to. Sets rChar to the correct position for that font. If no + //match found, then no name is returned, and rChar is unchanged. If you + //want to convert a string, you don't want to use this. + virtual String ConvertChar(sal_Unicode &rChar) = 0; + + //Starts converting the string at position rIndex. It converts as much of + //the string that can be converted to the same symbol font and returns the + //name of that font. rIndex is modified to the last index that was + //converted. Typically you call if continously until rIndex == + //rString.Len() and handle each section as seperate 8bit strings using + //seperate fonts. Will return an empty string for a continous section + //that has no possible mapping. + virtual String ConvertString(String &rString, xub_StrLen &rIndex) = 0; + virtual ~StarSymbolToMSMultiFont() {} +}; + +//with bPerfect set the converter will only try and convert symbols which have +//perfect mappings to the windows symbols fonts. With it not set, it will +//allow somewhat more dubious transformations that are nevertheless +//recognizably similiar. Even in this mode there will be characters that fail. +//The users of this might want to make a distinction between failed characters +//which were inside and those outside the unicode private area. +UNOTOOLS_DLLPUBLIC StarSymbolToMSMultiFont *CreateStarSymbolToMSMultiFont(bool bPerfectOnly=false); +#endif // _UNOTOOLS_FONTCVT_HXX diff --git a/unotools/inc/unotools/fontdefs.hxx b/unotools/inc/unotools/fontdefs.hxx new file mode 100644 index 000000000000..e595fe45400d --- /dev/null +++ b/unotools/inc/unotools/fontdefs.hxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * 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 + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _UNOTOOLS_FONTDEFS_HXX +#define _UNOTOOLS_FONTDEFS_HXX + +#include +#include +#include + +namespace utl { + class FontSubstConfiguration; + class FontNameAttr; +} + +// ---------------- +// - SubsFontName - +// ---------------- + +#define SUBSFONT_ONLYONE ((ULONG)0x00000001) +#define SUBSFONT_MS ((ULONG)0x00000002) +#define SUBSFONT_PS ((ULONG)0x00000004) +#define SUBSFONT_HTML ((ULONG)0x00000008) + +UNOTOOLS_DLLPUBLIC String GetSubsFontName( const String& rName, ULONG nFlags ); + +// ----------------- +// - FontTokenName - +// ----------------- + +UNOTOOLS_DLLPUBLIC String GetFontToken( const String& rName, xub_StrLen nToken, xub_StrLen& rIndex ); +inline String GetFontToken( const String& rName, xub_StrLen nToken ) +{ + xub_StrLen nTempIndex = 0; + return GetFontToken( rName, nToken, nTempIndex ); +} + +UNOTOOLS_DLLPUBLIC void AddTokenFontName( String& rName, const String& rNewToken ); + +struct UNOTOOLS_DLLPUBLIC FontNameHash { int operator()(const String&) const; }; + +// --------------- +// - ConvertChar - +// --------------- + +class UNOTOOLS_DLLPUBLIC ConvertChar +{ +public: + const sal_Unicode* mpCvtTab; + const char* mpSubsFontName; + sal_Unicode (*mpCvtFunc)( sal_Unicode ); + sal_Unicode RecodeChar( sal_Unicode c ) const; + void RecodeString( String& rStra, xub_StrLen nIndex, xub_StrLen nLen ) const; + static const ConvertChar* GetRecodeData( const String& rOrgFontName, const String& rMapFontName ); +}; + + +// Default-Font +#define DEFAULTFONT_SANS_UNICODE ((USHORT)1) +#define DEFAULTFONT_SANS ((USHORT)2) +#define DEFAULTFONT_SERIF ((USHORT)3) +#define DEFAULTFONT_FIXED ((USHORT)4) +#define DEFAULTFONT_SYMBOL ((USHORT)5) +#define DEFAULTFONT_UI_SANS ((USHORT)1000) +#define DEFAULTFONT_UI_FIXED ((USHORT)1001) +#define DEFAULTFONT_LATIN_TEXT ((USHORT)2000) +#define DEFAULTFONT_LATIN_PRESENTATION ((USHORT)2001) +#define DEFAULTFONT_LATIN_SPREADSHEET ((USHORT)2002) +#define DEFAULTFONT_LATIN_HEADING ((USHORT)2003) +#define DEFAULTFONT_LATIN_DISPLAY ((USHORT)2004) +#define DEFAULTFONT_LATIN_FIXED ((USHORT)2005) +#define DEFAULTFONT_CJK_TEXT ((USHORT)3000) +#define DEFAULTFONT_CJK_PRESENTATION ((USHORT)3001) +#define DEFAULTFONT_CJK_SPREADSHEET ((USHORT)3002) +#define DEFAULTFONT_CJK_HEADING ((USHORT)3003) +#define DEFAULTFONT_CJK_DISPLAY ((USHORT)3004) +#define DEFAULTFONT_CTL_TEXT ((USHORT)4000) +#define DEFAULTFONT_CTL_PRESENTATION ((USHORT)4001) +#define DEFAULTFONT_CTL_SPREADSHEET ((USHORT)4002) +#define DEFAULTFONT_CTL_HEADING ((USHORT)4003) +#define DEFAULTFONT_CTL_DISPLAY ((USHORT)4004) + +UNOTOOLS_DLLPUBLIC String GetNextFontToken( const String& rTokenStr, xub_StrLen& rIndex ); + +UNOTOOLS_DLLPUBLIC void GetEnglishSearchFontName( String& rName ); + +#endif diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx new file mode 100644 index 000000000000..3ee556f372c7 --- /dev/null +++ b/unotools/source/config/fontcfg.cxx @@ -0,0 +1,1220 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: fontcfg.cxx,v $ + * $Revision: 1.49.114.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if OSL_DEBUG_LEVEL > 1 +#include +#endif + +#include +#include +#include + +#define DEFAULTFONT_CONFIGNODE "VCL/DefaultFonts" +#define SUBSTFONT_CONFIGNODE "VCL/FontSubstitutions" + +using namespace rtl; +using namespace utl; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::container; + +static DefaultFontConfiguration* mpDefaultFontConfiguration = 0; + +static FontSubstConfiguration* mpFontSubstConfiguration = 0; + +/* + * DefaultFontConfiguration + */ + +static const char* getKeyType( int nKeyType ) +{ + switch( nKeyType ) + { + case DEFAULTFONT_CJK_DISPLAY: return "CJK_DISPLAY"; + case DEFAULTFONT_CJK_HEADING: return "CJK_HEADING"; + case DEFAULTFONT_CJK_PRESENTATION: return "CJK_PRESENTATION"; + case DEFAULTFONT_CJK_SPREADSHEET: return "CJK_SPREADSHEET"; + case DEFAULTFONT_CJK_TEXT: return "CJK_TEXT"; + case DEFAULTFONT_CTL_DISPLAY: return "CTL_DISPLAY"; + case DEFAULTFONT_CTL_HEADING: return "CTL_HEADING"; + case DEFAULTFONT_CTL_PRESENTATION: return "CTL_PRESENTATION"; + case DEFAULTFONT_CTL_SPREADSHEET: return "CTL_SPREADSHEET"; + case DEFAULTFONT_CTL_TEXT: return "CTL_TEXT"; + case DEFAULTFONT_FIXED: return "FIXED"; + case DEFAULTFONT_LATIN_DISPLAY: return "LATIN_DISPLAY"; + case DEFAULTFONT_LATIN_FIXED: return "LATIN_FIXED"; + case DEFAULTFONT_LATIN_HEADING: return "LATIN_HEADING"; + case DEFAULTFONT_LATIN_PRESENTATION: return "LATIN_PRESENTATION"; + case DEFAULTFONT_LATIN_SPREADSHEET: return "LATIN_SPREADSHEET"; + case DEFAULTFONT_LATIN_TEXT: return "LATIN_TEXT"; + case DEFAULTFONT_SANS: return "SANS"; + case DEFAULTFONT_SANS_UNICODE: return "SANS_UNICODE"; + case DEFAULTFONT_SERIF: return "SERIF"; + case DEFAULTFONT_SYMBOL: return "SYMBOL"; + case DEFAULTFONT_UI_FIXED: return "UI_FIXED"; + case DEFAULTFONT_UI_SANS: return "UI_SANS"; + default: + DBG_ERROR( "unmatched type" ); + return ""; + } +} + +DefaultFontConfiguration* DefaultFontConfiguration::get() +{ + if( !mpDefaultFontConfiguration ) + mpDefaultFontConfiguration = new DefaultFontConfiguration(); + return mpDefaultFontConfiguration; +} + +DefaultFontConfiguration::DefaultFontConfiguration() +{ + try + { + // get service provider + Reference< XMultiServiceFactory > xSMgr( comphelper::getProcessServiceFactory() ); + // create configuration hierachical access name + if( xSMgr.is() ) + { + try + { + m_xConfigProvider = + Reference< XMultiServiceFactory >( + xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.ConfigurationProvider" ))), + UNO_QUERY ); + if( m_xConfigProvider.is() ) + { + Sequence< Any > aArgs(1); + PropertyValue aVal; + aVal.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ); + aVal.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.VCL/DefaultFonts" ) ); + aArgs.getArray()[0] <<= aVal; + m_xConfigAccess = + Reference< XNameAccess >( + m_xConfigProvider->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.ConfigurationAccess" )), + aArgs ), + UNO_QUERY ); + if( m_xConfigAccess.is() ) + { + Sequence< OUString > aLocales = m_xConfigAccess->getElementNames(); + // fill config hash with empty interfaces + int nLocales = aLocales.getLength(); + const OUString* pLocaleStrings = aLocales.getConstArray(); + Locale aLoc; + for( int i = 0; i < nLocales; i++ ) + { + sal_Int32 nIndex = 0; + aLoc.Language = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiLowerCase(); + if( nIndex != -1 ) + aLoc.Country = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase(); + else + aLoc.Country = OUString(); + if( nIndex != -1 ) + aLoc.Variant = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase(); + else + aLoc.Variant = OUString(); + m_aConfig[ aLoc ] = LocaleAccess(); + m_aConfig[ aLoc ].aConfigLocaleString = pLocaleStrings[i]; + } + } + } + } + catch( Exception& ) + { + // configuration is awry + m_xConfigProvider.clear(); + m_xConfigAccess.clear(); + } + } + } + catch( WrappedTargetException& ) + { + } + #if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "config provider: %s, config access: %s\n", + m_xConfigProvider.is() ? "true" : "false", + m_xConfigAccess.is() ? "true" : "false" + ); + #endif +} + +DefaultFontConfiguration::~DefaultFontConfiguration() +{ + // release all nodes + m_aConfig.clear(); + // release top node + m_xConfigAccess.clear(); + // release config provider + m_xConfigProvider.clear(); +} + +OUString DefaultFontConfiguration::tryLocale( const Locale& rLocale, const OUString& rType ) const +{ + OUString aRet; + + std::hash_map< Locale, LocaleAccess, LocaleHash >::const_iterator it = + m_aConfig.find( rLocale ); + if( it != m_aConfig.end() ) + { + if( !it->second.xAccess.is() ) + { + try + { + Reference< XNameAccess > xNode; + if ( m_xConfigAccess->hasByName( it->second.aConfigLocaleString ) ) + { + Any aAny = m_xConfigAccess->getByName( it->second.aConfigLocaleString ); + if( aAny >>= xNode ) + it->second.xAccess = xNode; + } + } + catch( NoSuchElementException ) + { + } + catch( WrappedTargetException ) + { + } + } + if( it->second.xAccess.is() ) + { + try + { + if ( it->second.xAccess->hasByName( rType ) ) + { + Any aAny = it->second.xAccess->getByName( rType ); + aAny >>= aRet; + } + } + catch( NoSuchElementException& ) + { + } + catch( WrappedTargetException& ) + { + } + } + } + + return aRet; +} + +OUString DefaultFontConfiguration::getDefaultFont( const Locale& rLocale, int nType ) const +{ + Locale aLocale; + aLocale.Language = rLocale.Language.toAsciiLowerCase(); + aLocale.Country = rLocale.Country.toAsciiUpperCase(); + aLocale.Variant = rLocale.Variant.toAsciiUpperCase(); + + OUString aType = OUString::createFromAscii( getKeyType( nType ) ); + OUString aRet = tryLocale( aLocale, aType ); + if( ! aRet.getLength() && aLocale.Variant.getLength() ) + { + aLocale.Variant = OUString(); + aRet = tryLocale( aLocale, aType ); + } + if( ! aRet.getLength() && aLocale.Country.getLength() ) + { + aLocale.Country = OUString(); + aRet = tryLocale( aLocale, aType ); + } + if( ! aRet.getLength() ) + { + aLocale.Language = OUString( RTL_CONSTASCII_USTRINGPARAM( "en" ) ); + aRet = tryLocale( aLocale, aType ); + } + return aRet; +} + +OUString DefaultFontConfiguration::getUserInterfaceFont( const Locale& rLocale ) const +{ + Locale aLocale = rLocale; + if( ! aLocale.Language.getLength() ) + aLocale = SvtSysLocale().GetUILocale(); + + OUString aUIFont = getDefaultFont( aLocale, DEFAULTFONT_UI_SANS ); + + if( aUIFont.getLength() ) + return aUIFont; + + // fallback mechanism (either no configuration or no entry in configuration + + #define FALLBACKFONT_UI_SANS "Andale Sans UI;Albany;Albany AMT;Tahoma;Arial Unicode MS;Arial;Nimbus Sans L;Bitstream Vera Sans;gnu-unifont;Interface User;Geneva;WarpSans;Dialog;Swiss;Lucida;Helvetica;Charcoal;Chicago;MS Sans Serif;Helv;Times;Times New Roman;Interface System" + #define FALLBACKFONT_UI_SANS_LATIN2 "Andale Sans UI;Albany;Albany AMT;Tahoma;Arial Unicode MS;Arial;Nimbus Sans L;Luxi Sans;Bitstream Vera Sans;Interface User;Geneva;WarpSans;Dialog;Swiss;Lucida;Helvetica;Charcoal;Chicago;MS Sans Serif;Helv;Times;Times New Roman;Interface System" + #define FALLBACKFONT_UI_SANS_ARABIC "Tahoma;Traditional Arabic;Simplified Arabic;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;clearlyU;Interface User;Arial Unicode MS;Lucida Sans Unicode;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany;Lucida;Helvetica;Charcoal;Chicago;Arial;Helmet;Interface System;Sans Serif" + #define FALLBACKFONT_UI_SANS_THAI "OONaksit;Tahoma;Lucidasans;Arial Unicode MS" + #define FALLBACKFONT_UI_SANS_KOREAN "SunGulim;BaekmukGulim;Gulim;Roundgothic;Arial Unicode MS;Lucida Sans Unicode;gnu-unifont;Andale Sans UI" + #define FALLBACKFONT_UI_SANS_JAPANESE1 "HG-GothicB-Sun;Andale Sans UI;HG MhinchoLightJ" + #define FALLBACKFONT_UI_SANS_JAPANESE2 "Kochi Gothic;Gothic" + #define FALLBACKFONT_UI_SANS_CHINSIM "Andale Sans UI;Arial Unicode MS;ZYSong18030;AR PL SungtiL GB;AR PL KaitiM GB;SimSun;Lucida Sans Unicode;Fangsong;Hei;Song;Kai;Ming;gnu-unifont;Interface User;" + #define FALLBACKFONT_UI_SANS_CHINTRD "Andale Sans UI;Arial Unicode MS;AR PL Mingti2L Big5;AR PL KaitiM Big5;Kai;PMingLiU;MingLiU;Ming;Lucida Sans Unicode;gnu-unifont;Interface User;" + + // we need localized names for japanese fonts + static sal_Unicode const aMSGothic[] = { 0xFF2D, 0xFF33, ' ', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; + static sal_Unicode const aMSPGothic[] = { 0xFF2D, 0xFF33, ' ', 0xFF30, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; + static sal_Unicode const aTLPGothic[] = { 0x0054, 0x004C, 0x0050, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; + static sal_Unicode const aLXGothic[] = { 0x004C, 0x0058, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; + static sal_Unicode const aKochiGothic[] = { 0x6771, 0x98A8, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; + + String aFallBackJapaneseLocalized( RTL_CONSTASCII_USTRINGPARAM( "MS UI Gothic;" ) ); + aFallBackJapaneseLocalized += String( RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_JAPANESE1 ) ); + aFallBackJapaneseLocalized += String( aMSPGothic ); + aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) ); + aFallBackJapaneseLocalized += String( aMSGothic ); + aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) ); + aFallBackJapaneseLocalized += String( aTLPGothic ); + aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) ); + aFallBackJapaneseLocalized += String( aLXGothic ); + aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) ); + aFallBackJapaneseLocalized += String( aKochiGothic ); + aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) ); + aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_JAPANESE2 ) ); + static const OUString aFallBackJapanese( aFallBackJapaneseLocalized ); + static const OUString aFallback (RTL_CONSTASCII_USTRINGPARAM(FALLBACKFONT_UI_SANS)); + static const OUString aFallbackLatin2 (RTL_CONSTASCII_USTRINGPARAM(FALLBACKFONT_UI_SANS_LATIN2)); + static const OUString aFallBackArabic (RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_ARABIC ) ); + static const OUString aFallBackThai (RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_THAI ) ); + static const OUString aFallBackChineseSIM (RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_CHINSIM ) ); + static const OUString aFallBackChineseTRD (RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_CHINTRD ) ); + + // we need localized names for korean fonts + static sal_Unicode const aSunGulim[] = { 0xC36C, 0xAD74, 0xB9BC, 0 }; + static sal_Unicode const aBaekmukGulim[] = { 0xBC31, 0xBC35, 0xAD74, 0xB9BC, 0 }; + String aFallBackKoreanLocalized( aSunGulim ); + aFallBackKoreanLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) ); + aFallBackKoreanLocalized += String( aBaekmukGulim ); + aFallBackKoreanLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) ); + aFallBackKoreanLocalized += String(RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_KOREAN ) ); + static const OUString aFallBackKorean( aFallBackKoreanLocalized ); + + // optimize font list for some locales, as long as Andale Sans UI does not support them + if( aLocale.Language.equalsAscii( "ar" ) || + aLocale.Language.equalsAscii( "he" ) || + aLocale.Language.equalsAscii( "iw" ) ) + { + return aFallBackArabic; + } + else if( aLocale.Language.equalsAscii( "th" ) ) + { + return aFallBackThai; + } + else if( aLocale.Language.equalsAscii( "ko" ) ) + { + return aFallBackKorean; + } + else if( aLocale.Language.equalsAscii( "cs" ) || + aLocale.Language.equalsAscii( "hu" ) || + aLocale.Language.equalsAscii( "pl" ) || + aLocale.Language.equalsAscii( "ro" ) || + aLocale.Language.equalsAscii( "rm" ) || + aLocale.Language.equalsAscii( "hr" ) || + aLocale.Language.equalsAscii( "sk" ) || + aLocale.Language.equalsAscii( "sl" ) || + aLocale.Language.equalsAscii( "sb" ) ) + { + return aFallbackLatin2; + } + else if( aLocale.Language.equalsAscii( "zh" ) ) + { + if( ! aLocale.Country.equalsAscii( "cn" ) ) + return aFallBackChineseTRD; + else + return aFallBackChineseSIM; + } + else if( aLocale.Language.equalsAscii( "ja" ) ) + { + return aFallBackJapanese; + } + + return aFallback; +} + +// ------------------------------------------------------------------------------------ + +/* + * FontSubstConfigItem::get + */ + +FontSubstConfiguration* FontSubstConfiguration::get() +{ + if( !mpFontSubstConfiguration ) + mpFontSubstConfiguration = new FontSubstConfiguration(); + return mpFontSubstConfiguration; +} + +/* + * FontSubstConfigItem::FontSubstConfigItem + */ + +FontSubstConfiguration::FontSubstConfiguration() : + maSubstHash( 300 ) +{ + try + { + // get service provider + Reference< XMultiServiceFactory > xSMgr( comphelper::getProcessServiceFactory() ); + // create configuration hierachical access name + if( xSMgr.is() ) + { + try + { + m_xConfigProvider = + Reference< XMultiServiceFactory >( + xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.ConfigurationProvider" ))), + UNO_QUERY ); + if( m_xConfigProvider.is() ) + { + Sequence< Any > aArgs(1); + PropertyValue aVal; + aVal.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ); + aVal.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.VCL/FontSubstitutions" ) ); + aArgs.getArray()[0] <<= aVal; + m_xConfigAccess = + Reference< XNameAccess >( + m_xConfigProvider->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.ConfigurationAccess" )), + aArgs ), + UNO_QUERY ); + if( m_xConfigAccess.is() ) + { + Sequence< OUString > aLocales = m_xConfigAccess->getElementNames(); + // fill config hash with empty interfaces + int nLocales = aLocales.getLength(); + const OUString* pLocaleStrings = aLocales.getConstArray(); + Locale aLoc; + for( int i = 0; i < nLocales; i++ ) + { + sal_Int32 nIndex = 0; + aLoc.Language = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiLowerCase(); + if( nIndex != -1 ) + aLoc.Country = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase(); + else + aLoc.Country = OUString(); + if( nIndex != -1 ) + aLoc.Variant = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase(); + else + aLoc.Variant = OUString(); + m_aSubst[ aLoc ] = LocaleSubst(); + m_aSubst[ aLoc ].aConfigLocaleString = pLocaleStrings[i]; + } + } + } + } + catch( Exception& ) + { + // configuration is awry + m_xConfigProvider.clear(); + m_xConfigAccess.clear(); + } + } + } + catch( WrappedTargetException& ) + { + } + #if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "config provider: %s, config access: %s\n", + m_xConfigProvider.is() ? "true" : "false", + m_xConfigAccess.is() ? "true" : "false" + ); + #endif +} + +/* + * FontSubstConfigItem::~FontSubstConfigItem + */ + +FontSubstConfiguration::~FontSubstConfiguration() +{ + // release config access + m_xConfigAccess.clear(); + // release config provider + m_xConfigProvider.clear(); +} + +/* + * FontSubstConfigItem::getMapName + */ +// ======================================================================= + +static const char* const aImplKillLeadingList[] = +{ + "microsoft", + "monotype", + "linotype", + "baekmuk", + "adobe", + "nimbus", + "zycjk", + "itc", + "sun", + "amt", + "ms", + "mt", + "cg", + "hg", + "fz", + "ipa", + "sazanami", + "kochi", + NULL +}; + +// ----------------------------------------------------------------------- + +static const char* const aImplKillTrailingList[] = +{ + "microsoft", + "monotype", + "linotype", + "adobe", + "nimbus", + "itc", + "sun", + "amt", + "ms", + "mt", + "clm", + // Scripts, for compatibility with older versions + "we", + "cyr", + "tur", + "wt", + "greek", + "wl", + // CJK extensions + "gb", + "big5", + "pro", + "z01", + "z02", + "z03", + "z13", + "b01", + "w3x12", + // Old Printer Fontnames + "5cpi", + "6cpi", + "7cpi", + "8cpi", + "9cpi", + "10cpi", + "11cpi", + "12cpi", + "13cpi", + "14cpi", + "15cpi", + "16cpi", + "18cpi", + "24cpi", + "scale", + "pc", + NULL +}; + +// ----------------------------------------------------------------------- + +static const char* const aImplKillTrailingWithExceptionsList[] = +{ + "ce", "monospace", "oldface", NULL, + "ps", "caps", NULL, + NULL +}; + +// ----------------------------------------------------------------------- + +struct ImplFontAttrWeightSearchData +{ + const char* mpStr; + FontWeight meWeight; +}; + +static ImplFontAttrWeightSearchData const aImplWeightAttrSearchList[] = +{ +// the attribute names are ordered by "first match wins" +// e.g. "semilight" should wins over "semi" +{ "extrablack", WEIGHT_BLACK }, +{ "ultrablack", WEIGHT_BLACK }, +{ "ultrabold", WEIGHT_ULTRABOLD }, +{ "semibold", WEIGHT_SEMIBOLD }, +{ "semilight", WEIGHT_SEMILIGHT }, +{ "semi", WEIGHT_SEMIBOLD }, +{ "demi", WEIGHT_SEMIBOLD }, +{ "black", WEIGHT_BLACK }, +{ "bold", WEIGHT_BOLD }, +{ "heavy", WEIGHT_BLACK }, +{ "ultralight", WEIGHT_ULTRALIGHT }, +{ "light", WEIGHT_LIGHT }, +{ "medium", WEIGHT_MEDIUM }, +{ NULL, WEIGHT_DONTKNOW }, +}; + +// ----------------------------------------------------------------------- + +struct ImplFontAttrWidthSearchData +{ + const char* mpStr; + FontWidth meWidth; +}; + +static ImplFontAttrWidthSearchData const aImplWidthAttrSearchList[] = +{ +{ "narrow", WIDTH_CONDENSED }, +{ "semicondensed", WIDTH_SEMI_CONDENSED }, +{ "ultracondensed", WIDTH_ULTRA_CONDENSED }, +{ "semiexpanded", WIDTH_SEMI_EXPANDED }, +{ "ultraexpanded", WIDTH_ULTRA_EXPANDED }, +{ "expanded", WIDTH_EXPANDED }, +{ "wide", WIDTH_ULTRA_EXPANDED }, +{ "condensed", WIDTH_CONDENSED }, +{ "cond", WIDTH_CONDENSED }, +{ "cn", WIDTH_CONDENSED }, +{ NULL, WIDTH_DONTKNOW }, +}; + +struct ImplFontAttrTypeSearchData +{ + const char* mpStr; + ULONG mnType; +}; + +static ImplFontAttrTypeSearchData const aImplTypeAttrSearchList[] = +{ +{ "monotype", 0 }, +{ "linotype", 0 }, +{ "titling", IMPL_FONT_ATTR_TITLING }, +{ "captitals", IMPL_FONT_ATTR_CAPITALS }, +{ "captital", IMPL_FONT_ATTR_CAPITALS }, +{ "caps", IMPL_FONT_ATTR_CAPITALS }, +{ "italic", IMPL_FONT_ATTR_ITALIC }, +{ "oblique", IMPL_FONT_ATTR_ITALIC }, +{ "rounded", IMPL_FONT_ATTR_ROUNDED }, +{ "outline", IMPL_FONT_ATTR_OUTLINE }, +{ "shadow", IMPL_FONT_ATTR_SHADOW }, +{ "handwriting", IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_SCRIPT }, +{ "hand", IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_SCRIPT }, +{ "signet", IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_SCRIPT }, +{ "script", IMPL_FONT_ATTR_BRUSHSCRIPT | IMPL_FONT_ATTR_SCRIPT }, +{ "calligraphy", IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_SCRIPT }, +{ "chancery", IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_SCRIPT }, +{ "corsiva", IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_SCRIPT }, +{ "gothic", IMPL_FONT_ATTR_SANSSERIF | IMPL_FONT_ATTR_GOTHIC }, +{ "schoolbook", IMPL_FONT_ATTR_SERIF | IMPL_FONT_ATTR_SCHOOLBOOK }, +{ "schlbk", IMPL_FONT_ATTR_SERIF | IMPL_FONT_ATTR_SCHOOLBOOK }, +{ "typewriter", IMPL_FONT_ATTR_TYPEWRITER | IMPL_FONT_ATTR_FIXED }, +{ "lineprinter", IMPL_FONT_ATTR_TYPEWRITER | IMPL_FONT_ATTR_FIXED }, +{ "monospaced", IMPL_FONT_ATTR_FIXED }, +{ "monospace", IMPL_FONT_ATTR_FIXED }, +{ "mono", IMPL_FONT_ATTR_FIXED }, +{ "fixed", IMPL_FONT_ATTR_FIXED }, +{ "sansserif", IMPL_FONT_ATTR_SANSSERIF }, +{ "sans", IMPL_FONT_ATTR_SANSSERIF }, +{ "swiss", IMPL_FONT_ATTR_SANSSERIF }, +{ "serif", IMPL_FONT_ATTR_SERIF }, +{ "bright", IMPL_FONT_ATTR_SERIF }, +{ "symbols", IMPL_FONT_ATTR_SYMBOL }, +{ "symbol", IMPL_FONT_ATTR_SYMBOL }, +{ "dingbats", IMPL_FONT_ATTR_SYMBOL }, +{ "dings", IMPL_FONT_ATTR_SYMBOL }, +{ "ding", IMPL_FONT_ATTR_SYMBOL }, +{ "bats", IMPL_FONT_ATTR_SYMBOL }, +{ "math", IMPL_FONT_ATTR_SYMBOL }, +{ "oldstyle", IMPL_FONT_ATTR_OTHERSTYLE }, +{ "oldface", IMPL_FONT_ATTR_OTHERSTYLE }, +{ "old", IMPL_FONT_ATTR_OTHERSTYLE }, +{ "new", 0 }, +{ "modern", 0 }, +{ "lucida", 0 }, +{ "regular", 0 }, +{ "extended", 0 }, +{ "extra", IMPL_FONT_ATTR_OTHERSTYLE }, +{ "ext", 0 }, +{ "scalable", 0 }, +{ "scale", 0 }, +{ "nimbus", 0 }, +{ "adobe", 0 }, +{ "itc", 0 }, +{ "amt", 0 }, +{ "mt", 0 }, +{ "ms", 0 }, +{ "cpi", 0 }, +{ "no", 0 }, +{ NULL, 0 }, +}; + +// ----------------------------------------------------------------------- + +static bool ImplKillLeading( String& rName, const char* const* ppStr ) +{ + for(; *ppStr; ++ppStr ) + { + const char* pStr = *ppStr; + const xub_Unicode* pNameStr = rName.GetBuffer(); + while ( (*pNameStr == (xub_Unicode)(unsigned char)*pStr) && *pStr ) + { + pNameStr++; + pStr++; + } + if ( !*pStr ) + { + xub_StrLen nLen = sal::static_int_cast(pNameStr - rName.GetBuffer()); + rName.Erase( 0, nLen ); + return true; + } + } + + // special case for Baekmuk + // TODO: allow non-ASCII KillLeading list + const xub_Unicode* pNameStr = rName.GetBuffer(); + if( (pNameStr[0]==0xBC31) && (pNameStr[1]==0xBC35) ) + { + xub_StrLen nLen = (pNameStr[2]==0x0020) ? 3 : 2; + rName.Erase( 0, nLen ); + return true; + } + + return false; +} + +// ----------------------------------------------------------------------- + +static xub_StrLen ImplIsTrailing( const String& rName, const char* pStr ) +{ + xub_StrLen nStrLen = static_cast( strlen( pStr ) ); + if( nStrLen >= rName.Len() ) + return 0; + + const xub_Unicode* pEndName = rName.GetBuffer() + rName.Len(); + const sal_Unicode* pNameStr = pEndName - nStrLen; + do if( *(pNameStr++) != *(pStr++) ) + return 0; + while( *pStr ); + + return nStrLen; +} + +// ----------------------------------------------------------------------- + +static bool ImplKillTrailing( String& rName, const char* const* ppStr ) +{ + for(; *ppStr; ++ppStr ) + { + xub_StrLen nTrailLen = ImplIsTrailing( rName, *ppStr ); + if( nTrailLen ) + { + rName.Erase( rName.Len()-nTrailLen ); + return true; + } + } + + return false; +} + +// ----------------------------------------------------------------------- + +static bool ImplKillTrailingWithExceptions( String& rName, const char* const* ppStr ) +{ + for(; *ppStr; ++ppStr ) + { + xub_StrLen nTrailLen = ImplIsTrailing( rName, *ppStr ); + if( nTrailLen ) + { + // check string match against string exceptions + while( *++ppStr ) + if( ImplIsTrailing( rName, *ppStr ) ) + return false; + + rName.Erase( rName.Len()-nTrailLen ); + return true; + } + else + { + // skip exception strings + while( *++ppStr ) ; + } + } + + return false; +} + +// ----------------------------------------------------------------------- + +static BOOL ImplFindAndErase( String& rName, const char* pStr ) +{ + xub_StrLen nPos = rName.SearchAscii( pStr ); + if ( nPos == STRING_NOTFOUND ) + return FALSE; + + const char* pTempStr = pStr; + while ( *pTempStr ) + pTempStr++; + rName.Erase( nPos, (xub_StrLen)(pTempStr-pStr) ); + return TRUE; +} + +// ======================================================================= + +void FontSubstConfiguration::getMapName( const String& rOrgName, String& rShortName, + String& rFamilyName, FontWeight& rWeight, FontWidth& rWidth, ULONG& rType ) +{ + rShortName = rOrgName; + + // TODO: get rid of the crazy O(N*strlen) searches below + // they should be possible in O(strlen) + + // Kill leading vendor names and other unimportant data + ImplKillLeading( rShortName, aImplKillLeadingList ); + + // Kill trailing vendor names and other unimportant data + ImplKillTrailing( rShortName, aImplKillTrailingList ); + ImplKillTrailingWithExceptions( rShortName, aImplKillTrailingWithExceptionsList ); + + rFamilyName = rShortName; + + // Kill attributes from the name and update the data + // Weight + const ImplFontAttrWeightSearchData* pWeightList = aImplWeightAttrSearchList; + while ( pWeightList->mpStr ) + { + if ( ImplFindAndErase( rFamilyName, pWeightList->mpStr ) ) + { + if ( (rWeight == WEIGHT_DONTKNOW) || (rWeight == WEIGHT_NORMAL) ) + rWeight = pWeightList->meWeight; + break; + } + pWeightList++; + } + + // Width + const ImplFontAttrWidthSearchData* pWidthList = aImplWidthAttrSearchList; + while ( pWidthList->mpStr ) + { + if ( ImplFindAndErase( rFamilyName, pWidthList->mpStr ) ) + { + if ( (rWidth == WIDTH_DONTKNOW) || (rWidth == WIDTH_NORMAL) ) + rWidth = pWidthList->meWidth; + break; + } + pWidthList++; + } + + // Type + rType = 0; + const ImplFontAttrTypeSearchData* pTypeList = aImplTypeAttrSearchList; + while ( pTypeList->mpStr ) + { + if ( ImplFindAndErase( rFamilyName, pTypeList->mpStr ) ) + rType |= pTypeList->mnType; + pTypeList++; + } + + // Remove numbers + // TODO: also remove localized and fullwidth digits + xub_StrLen i = 0; + while ( i < rFamilyName.Len() ) + { + sal_Unicode c = rFamilyName.GetChar( i ); + if ( (c >= 0x0030) && (c <= 0x0039) ) + rFamilyName.Erase( i, 1 ); + else + i++; + } +} + + +struct StrictStringSort : public ::std::binary_function< const FontNameAttr&, const FontNameAttr&, bool > +{ + bool operator()( const FontNameAttr& rLeft, const FontNameAttr& rRight ) + { return rLeft.Name.CompareTo( rRight.Name ) == COMPARE_LESS ; } +}; + +static const char* const pAttribNames[] = +{ + "default", + "standard", + "normal", + "symbol", + "fixed", + "sansserif", + "serif", + "decorative", + "special", + "italic", + "title", + "capitals", + "cjk", + "cjk_jp", + "cjk_sc", + "cjk_tc", + "cjk_kr", + "ctl", + "nonelatin", + "full", + "outline", + "shadow", + "rounded", + "typewriter", + "script", + "handwriting", + "chancery", + "comic", + "brushscript", + "gothic", + "schoolbook", + "other" +}; + +struct enum_convert +{ + const char* pName; + int nEnum; +}; + + +static const enum_convert pWeightNames[] = +{ + { "normal", WEIGHT_NORMAL }, + { "medium", WEIGHT_MEDIUM }, + { "bold", WEIGHT_BOLD }, + { "black", WEIGHT_BLACK }, + { "semibold", WEIGHT_SEMIBOLD }, + { "light", WEIGHT_LIGHT }, + { "semilight", WEIGHT_SEMILIGHT }, + { "ultrabold", WEIGHT_ULTRABOLD }, + { "semi", WEIGHT_SEMIBOLD }, + { "demi", WEIGHT_SEMIBOLD }, + { "heavy", WEIGHT_BLACK }, + { "unknown", WEIGHT_DONTKNOW }, + { "thin", WEIGHT_THIN }, + { "ultralight", WEIGHT_ULTRALIGHT } +}; + +static const enum_convert pWidthNames[] = +{ + { "normal", WIDTH_NORMAL }, + { "condensed", WIDTH_CONDENSED }, + { "expanded", WIDTH_EXPANDED }, + { "unknown", WIDTH_DONTKNOW }, + { "ultracondensed", WIDTH_ULTRA_CONDENSED }, + { "extracondensed", WIDTH_EXTRA_CONDENSED }, + { "semicondensed", WIDTH_SEMI_CONDENSED }, + { "semiexpanded", WIDTH_SEMI_EXPANDED }, + { "extraexpanded", WIDTH_EXTRA_EXPANDED }, + { "ultraexpanded", WIDTH_ULTRA_EXPANDED } +}; + +void FontSubstConfiguration::fillSubstVector( const com::sun::star::uno::Reference< XNameAccess > xFont, + const rtl::OUString& rType, + std::vector< String >& rSubstVector ) const +{ + try + { + Any aAny = xFont->getByName( rType ); + if( aAny.getValueTypeClass() == TypeClass_STRING ) + { + const OUString* pLine = (const OUString*)aAny.getValue(); + sal_Int32 nIndex = 0; + sal_Int32 nLength = pLine->getLength(); + if( nLength ) + { + const sal_Unicode* pStr = pLine->getStr(); + sal_Int32 nTokens = 0; + // count tokens + while( nLength-- ) + { + if( *pStr++ == sal_Unicode(';') ) + nTokens++; + } + rSubstVector.clear(); + // optimize performance, heap fragmentation + rSubstVector.reserve( nTokens ); + while( nIndex != -1 ) + { + OUString aSubst( pLine->getToken( 0, ';', nIndex ) ); + if( aSubst.getLength() ) + { + UniqueSubstHash::iterator aEntry = maSubstHash.find( aSubst ); + if (aEntry != maSubstHash.end()) + aSubst = *aEntry; + else + maSubstHash.insert( aSubst ); + rSubstVector.push_back( aSubst ); + } + } + } + } + } + catch( NoSuchElementException ) + { + } + catch( WrappedTargetException ) + { + } +} + +FontWeight FontSubstConfiguration::getSubstWeight( const com::sun::star::uno::Reference< XNameAccess > xFont, + const rtl::OUString& rType ) const +{ + int weight = -1; + try + { + Any aAny = xFont->getByName( rType ); + if( aAny.getValueTypeClass() == TypeClass_STRING ) + { + const OUString* pLine = (const OUString*)aAny.getValue(); + if( pLine->getLength() ) + { + for( weight=sizeof(pWeightNames)/sizeof(pWeightNames[0])-1; weight >= 0; weight-- ) + if( pLine->equalsIgnoreAsciiCaseAscii( pWeightNames[weight].pName ) ) + break; + } +#if OSL_DEBUG_LEVEL > 1 + if( weight < 0 ) + fprintf( stderr, "Error: invalid weight %s\n", + OUStringToOString( *pLine, RTL_TEXTENCODING_ASCII_US ).getStr() ); +#endif + } + } + catch( NoSuchElementException ) + { + } + catch( WrappedTargetException ) + { + } + return (FontWeight)( weight >= 0 ? pWeightNames[weight].nEnum : WEIGHT_DONTKNOW ); +} + +FontWidth FontSubstConfiguration::getSubstWidth( const com::sun::star::uno::Reference< XNameAccess > xFont, + const rtl::OUString& rType ) const +{ + int width = -1; + try + { + Any aAny = xFont->getByName( rType ); + if( aAny.getValueTypeClass() == TypeClass_STRING ) + { + const OUString* pLine = (const OUString*)aAny.getValue(); + if( pLine->getLength() ) + { + for( width=sizeof(pWidthNames)/sizeof(pWidthNames[0])-1; width >= 0; width-- ) + if( pLine->equalsIgnoreAsciiCaseAscii( pWidthNames[width].pName ) ) + break; + } +#if OSL_DEBUG_LEVEL > 1 + if( width < 0 ) + fprintf( stderr, "Error: invalid width %s\n", + OUStringToOString( *pLine, RTL_TEXTENCODING_ASCII_US ).getStr() ); +#endif + } + } + catch( NoSuchElementException ) + { + } + catch( WrappedTargetException ) + { + } + return (FontWidth)( width >= 0 ? pWidthNames[width].nEnum : WIDTH_DONTKNOW ); +} + +unsigned long FontSubstConfiguration::getSubstType( const com::sun::star::uno::Reference< XNameAccess > xFont, + const rtl::OUString& rType ) const +{ + unsigned long type = 0; + try + { + Any aAny = xFont->getByName( rType ); + if( aAny.getValueTypeClass() == TypeClass_STRING ) + { + const OUString* pLine = (const OUString*)aAny.getValue(); + if( pLine->getLength() ) + { + sal_Int32 nIndex = 0; + while( nIndex != -1 ) + { + String aToken( pLine->getToken( 0, ',', nIndex ) ); + for( int k = 0; k < 32; k++ ) + if( aToken.EqualsIgnoreCaseAscii( pAttribNames[k] ) ) + { + type |= 1 << k; + break; + } + } + } + } + } + catch( NoSuchElementException ) + { + } + catch( WrappedTargetException ) + { + } + + return type; +} + +void FontSubstConfiguration::readLocaleSubst( const com::sun::star::lang::Locale& rLocale ) const +{ + std::hash_map< Locale, LocaleSubst, LocaleHash >::const_iterator it = + m_aSubst.find( rLocale ); + if( it != m_aSubst.end() ) + { + if( ! it->second.bConfigRead ) + { + it->second.bConfigRead = true; + Reference< XNameAccess > xNode; + try + { + Any aAny = m_xConfigAccess->getByName( it->second.aConfigLocaleString ); + aAny >>= xNode; + } + catch( NoSuchElementException ) + { + } + catch( WrappedTargetException ) + { + } + if( xNode.is() ) + { + Sequence< OUString > aFonts = xNode->getElementNames(); + int nFonts = aFonts.getLength(); + const OUString* pFontNames = aFonts.getConstArray(); + // improve performance, heap fragmentation + it->second.aSubstAttributes.reserve( nFonts ); + + // strings for subst retrieval, construct only once + OUString aSubstFontsStr ( RTL_CONSTASCII_USTRINGPARAM( "SubstFonts" ) ); + OUString aSubstFontsMSStr ( RTL_CONSTASCII_USTRINGPARAM( "SubstFontsMS" ) ); + OUString aSubstFontsPSStr ( RTL_CONSTASCII_USTRINGPARAM( "SubstFontsPS" ) ); + OUString aSubstFontsHTMLStr ( RTL_CONSTASCII_USTRINGPARAM( "SubstFontsHTML" ) ); + OUString aSubstWeightStr ( RTL_CONSTASCII_USTRINGPARAM( "FontWeight" ) ); + OUString aSubstWidthStr ( RTL_CONSTASCII_USTRINGPARAM( "FontWidth" ) ); + OUString aSubstTypeStr ( RTL_CONSTASCII_USTRINGPARAM( "FontType" ) ); + for( int i = 0; i < nFonts; i++ ) + { + Reference< XNameAccess > xFont; + try + { + Any aAny = xNode->getByName( pFontNames[i] ); + aAny >>= xFont; + } + catch( NoSuchElementException ) + { + } + catch( WrappedTargetException ) + { + } + if( ! xFont.is() ) + { + #if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "did not get font attributes for %s\n", + OUStringToOString( pFontNames[i], RTL_TEXTENCODING_UTF8 ).getStr() ); + #endif + continue; + } + + FontNameAttr aAttr; + // read subst attributes from config + aAttr.Name = pFontNames[i]; + fillSubstVector( xFont, aSubstFontsStr, aAttr.Substitutions ); + fillSubstVector( xFont, aSubstFontsMSStr, aAttr.MSSubstitutions ); + fillSubstVector( xFont, aSubstFontsPSStr, aAttr.PSSubstitutions ); + fillSubstVector( xFont, aSubstFontsHTMLStr, aAttr.HTMLSubstitutions ); + aAttr.Weight = getSubstWeight( xFont, aSubstWeightStr ); + aAttr.Width = getSubstWidth( xFont, aSubstWidthStr ); + aAttr.Type = getSubstType( xFont, aSubstTypeStr ); + + // finally insert this entry + it->second.aSubstAttributes.push_back( aAttr ); + } + std::sort( it->second.aSubstAttributes.begin(), it->second.aSubstAttributes.end(), StrictStringSort() ); + } + } + } +} + +const FontNameAttr* FontSubstConfiguration::getSubstInfo( const String& rFontName, const Locale& rLocale ) const +{ + if( !rFontName.Len() ) + return NULL; + + // search if a (language dep.) replacement table for the given font exists + // fallback is english + String aSearchFont( rFontName ); + aSearchFont.ToLowerAscii(); + FontNameAttr aSearchAttr; + aSearchAttr.Name = aSearchFont; + + Locale aLocale; + aLocale.Language = rLocale.Language.toAsciiLowerCase(); + aLocale.Country = rLocale.Country.toAsciiUpperCase(); + aLocale.Variant = rLocale.Variant.toAsciiUpperCase(); + + if( ! aLocale.Language.getLength() ) + aLocale = SvtSysLocale().GetUILocale(); + + while( aLocale.Language.getLength() ) + { + std::hash_map< Locale, LocaleSubst, LocaleHash >::const_iterator lang = m_aSubst.find( aLocale ); + if( lang != m_aSubst.end() ) + { + if( ! lang->second.bConfigRead ) + readLocaleSubst( aLocale ); + // try to find an exact match + // because the list is sorted this will also find fontnames of the form searchfontname* + std::vector< FontNameAttr >::const_iterator it = ::std::lower_bound( lang->second.aSubstAttributes.begin(), lang->second.aSubstAttributes.end(), aSearchAttr, StrictStringSort() ); + if( it != lang->second.aSubstAttributes.end() && aSearchFont.CompareTo( it->Name, aSearchFont.Len() ) == COMPARE_EQUAL ) + return &(*it); + } + // gradually become more unspecific + if( aLocale.Variant.getLength() ) + aLocale.Variant = OUString(); + else if( aLocale.Country.getLength() ) + aLocale.Country = OUString(); + else if( ! aLocale.Language.equalsAscii( "en" ) ) + aLocale.Language = OUString( RTL_CONSTASCII_USTRINGPARAM( "en" ) ); + else + aLocale.Language = OUString(); + } + return NULL; +} + diff --git a/unotools/source/config/makefile.mk b/unotools/source/config/makefile.mk index eee8d4af9d73..de87d9503339 100644 --- a/unotools/source/config/makefile.mk +++ b/unotools/source/config/makefile.mk @@ -62,6 +62,7 @@ SLOFILES=\ $(SLO)$/eventcfg.obj \ $(SLO)$/extendedsecurityoptions.obj \ $(SLO)$/fltrcfg.obj \ + $(SLO)$/fontcfg.obj \ $(SLO)$/fontoptions.obj \ $(SLO)$/historyoptions.obj \ $(SLO)$/inetoptions.obj \ diff --git a/unotools/source/misc/fontcvt.cxx b/unotools/source/misc/fontcvt.cxx new file mode 100644 index 000000000000..5c4f902fbd55 --- /dev/null +++ b/unotools/source/misc/fontcvt.cxx @@ -0,0 +1,1523 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: fontcvt.cxx,v $ + * $Revision: 1.24 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +#include +#include + +#ifndef _STLP_MAP +#include +#endif +#ifndef _STLP_VECTOR +#include +#endif +#ifndef _STLP_ALGORITHM +#include +#endif +#ifndef _STLP_FUNCTIONAL +#include +#endif + +//======================================================================= +// note: the character mappings that are only approximations +// are marked (with an empty comment) + +static const sal_Unicode aStarBatsTab[224] = +{ + // F020 + 0x0020, 0x263a, 0x25cf, 0x274d, + 0x25a0, 0x25a1, 0xE000, 0x2751, + 0x2752, 0xE001, 0xE002, 0xE003, + 0x2756, 0xE004, 0xE005, 0x27a2, + // F030 + 0xE006, 0x2794, 0x2713, 0x2612, + 0x2611, 0x27b2, 0x261b, 0x270d, + 0x270e, 0xE007, 0x2714, 0xE008, + 0xE009, 0xE00A, 0x274f, 0x2750, + // F040 + 0xE00B, 0xE00C, 0xE00D, 0xE00E, + 0x2722, 0x2723, 0x2724, 0x2725, + 0x2733, 0x2734, 0x2735, 0x2736, + 0x2737, 0x2738, 0x2739, 0x2717, + // F050 + 0x2718, 0x2719, 0x271a, 0x271b, + 0x271c, 0x272b, 0x272c, 0x272d, + 0x272e, 0x272f, 0x2730, 0, + 0xE00F, 0x278a, 0x278b, 0x278c, + // F060 + 0x278d, 0x278e, 0x278f, 0x2790, + 0x2791, 0x2792, 0x2793, 0xE010, + 0x2780, 0x2781, 0x2782, 0x2783, + 0x2784, 0x2785, 0x2786, 0x2787, + // F070 + 0x2788, 0x2789, 0xE011, 0xE012, + 0x260e, 0xE013, 0xE014, 0xE015, + 0xE016, 0xE017, 0xE018, 0xE019, + 0xE01A, 0x261e, 0xE01B, 0, + // F080 + 0x20ac, 0, 0x201a, 0x0192, + 0x201e, 0x2026, 0x2020, 0x2021, + 0xE01c, 0x2030, 0x0160, 0x2039, + 0x0152, 0, 0x017d, 0, + // F090 + 0, 0x2018, 0x2019, 0x201c, + 0x201d, 0x2022, 0x2013, 0x2014, + 0xE01d, 0x2122, 0x0161, 0x203a, + 0x0153, 0, 0x017e, 0x0178, + // F0A0 + 0, 0x21e7, 0x21e8, 0x21e9, + 0x21e6, 0xE01e, 0xE01f, 0x00a7, + 0xE020, 0xE021, 0xE022, 0x00ab, + 0xE023, 0x2639, 0xE024, 0xE025, + // F0B0 + 0xE026, 0xE027, 0xE028, 0x21e5, + 0x21e4, 0x2192, 0x2193, 0x2190, + 0x2191, 0xE029, 0xE02a, 0x00bb, + 0xE02b, 0xE02c, 0xE02d, 0xE02e, + // F0C0 + 0xE02f, 0xE030, 0xE031, 0xE032, + 0x25be, 0x25b4, 0x25bf, 0x25b5, + 0xE033, 0xE034, 0xE035, 0x2702, + 0x2708, 0x2721, 0x273f, 0x2744, + // F0D0 + 0x25d7, 0x2759, 0xE036, 0xE037, + 0x2762, 0x2663, 0x2665, 0x2660, + 0x2194, 0x2195, 0x2798, 0x279a, + 0x27b8, 0, 0x00b6, 0, + // F0E0 + 0x00a2, 0x00a4, 0x00a5, 0xE038, + 0x20a1, 0x20a2, 0x20a3, 0x20a4, + 0x20a9, 0x20ab, 0x20a8, 0xE039, + 0, 0, 0, 0, + // F0F0 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0xE03a +}; + +// ----------------------------------------------------------------------- + +static const sal_Unicode aStarMathTab[224] = +{ + // F020 + 0x0020, 0x0021, 0x0022, 0x0023, + 0xE080, 0x0025, 0x0026, 0x221e, + 0x0028, 0x0029, 0x002a, 0x002b, + 0x002c, 0x002d, 0x002e, 0x002f, + // F030 + 0x2224, 0x21d2, 0x21d0, 0x21d4, + 0xE081, 0xE082, 0x00b0, 0, + 0, 0, 0x003a, 0x003b, + 0x003c, 0x003d, 0x003e, 0x00bf, + // F040 + 0x2260, 0xE083, 0x2212, 0x2217, + 0x00d7, 0x22c5, 0x00f7, 0x00b1, + 0x2213, 0x2295, 0x2296, 0x2297, + 0x2298, 0x2299, 0x222a, 0x2229, + // F050 + 0xE084, 0xE085, 0x2264, 0x2265, + 0xE086, 0xE087, 0x226a, 0x226b, + 0x007e, 0x2243, 0x2248, 0x225d, + 0x2261, 0x221d, 0x2202, 0x2282, + // F060 + 0x2283, 0x2286, 0x2287, 0x2284, + 0x2285, 0x2288, 0x2289, 0x2208, + 0x2209, 0xE089, 0x2203, 0x220d, + 0x2135, 0x2111, 0x211c, 0x2118, + // F070 + 0xE08a, 0x2221, 0x2222, 0x2223, + 0x2225, 0x22a5, 0xE08b, 0x22ef, + 0x22ee, 0x22f0, 0x22f1, 0x22b6, + 0x22b7, 0xE08c, 0x2216, 0x00ac, + // F080 + 0x222b, 0x222c, 0x222d, 0x222e, + 0x222f, 0x2230, 0x221a, 0xE08d, + 0xE08e, 0xE08f, 0x2210, 0x220f, + 0x2211, 0x2207, 0x2200, 0xE090, + // F090 + 0xE091, 0xE092, 0xE093, 0xE094, + 0xE095, 0xE096, 0xE097, 0xE098, + 0x02d9, 0x00a8, 0xE09b, 0x02da, + 0x2227, 0x2228, 0x220b, 0x2205, + // F0A0 + 0x007b, 0x007d, 0xe09e, 0xe09f, + 0x2329, 0x232a, 0x005b, 0x005d, + 0xE0a0, 0x22be, 0xE0a1, 0x2259, + 0x2254, 0x2255, 0x21b3, 0x2197, + // F0B0 + 0x2198, 0x2245, 0x301a, 0x301b, + 0x2373, 0xE0a5, 0xE0a6, 0x22a4, + 0x2112, 0x2130, 0x2131, 0, + 0xE0a7, 0xE0a8, 0xE0a9, 0xE0aa, + // F0C0 + 0x2308, 0x230a, 0x2309, 0x230b, + 0, 0xe0ab, 0xe0ac, 0xe0ad, + 0xe0ae, 0xe0af, 0xe0b0, 0xe0b1, + 0xe0b2, 0xe0b3, 0xe0b4, 0xe0b5, + // F0D0 + 0xe0b6, 0xe0b7, 0xe0b8, 0xe0b9, + 0xe0ba, 0xe0bb, 0xe0bc, 0xe0bd, + 0xe0be, 0xe0bf, 0xe0c0, 0xe0c1, + 0xe0c2, 0xe0c3, 0xe0c4, 0xe0c5, + // F0E0 + 0xe0c6, 0xe0c7, 0xe0c8, 0xe0c9, + 0xe0ca, 0xe0cb, 0xe0cc, 0xe0cd, + 0xe0ce, 0xe0cf, 0xe0d0, 0xe0d1, + 0x03f1, 0xe0d3, 0xe0d4, 0xe0d5, + // F0F0 + 0x2113, 0xe0d6, 0x2107, 0x2127, + 0x210a, 0xe0d9, 0x210f, 0x019b, + 0xe0db, 0xe0dc, 0xe0dd, 0x2115, + 0x2124, 0x211a, 0x211d, 0x2102 +}; + +// ----------------------------------------------------------------------- + +static const sal_Unicode aWingDingsTab[224] = +{ + // F020 + 0x0020, 0xe400, 0xe401, 0xe402, + 0xe403, 0xe404, 0xe405, 0xe406, + 0xe407, 0xe408, 0xe409, 0xe40a, + 0xe40b, 0xe40c, 0xe40d, 0xe40e, + // F030 + 0xe40f, 0xe410, 0xe411, 0xe412, + 0xe413, 0xe414, 0xe415, 0xe416, + 0xe417, 0xe418, 0xe419, 0xe41a, + 0xe41b, 0xe41c, 0x2707, 0xe41d, + // F040 + 0xe41e, 0xe41f, 0xe420, 0xe421, + 0x261c, 0xe423, 0x261d, 0x261f, + 0x261f, 0xe424, 0xe425, 0xe426, + 0xe427, 0xe428, 0xe429, 0xe42a, + // F050 + 0xe42b, 0xe42c, 0x263c, 0xe42d, + 0xe42e, 0xe42f, 0xe430, 0xe431, + 0xe432, 0xe433, 0x262a, 0x262f, + 0x0950, 0xe434, 0x2648, 0x2649, + // F060 + 0x264a, 0x264b, 0x264c, 0x264d, + 0x264e, 0x264f, 0x2650, 0x2651, + 0x2652, 0x2653, 0xe435, 0xe436, + 0xe437, 0xe438, 0xe439, 0xe43a, + // F070 + 0xe43b, 0xe43c, 0xe43d, 0xe43e, + 0xe43f, 0xe440, 0xe441, 0xe442, + 0xe443, 0x2353, 0x2318, 0xe444, + 0xe445, 0xe446, 0xe447, 0, + // F080 + 0xe448, 0xe449, 0xe44a, 0xe44b, + 0xe44c, 0xe44d, 0xe44e, 0xe44f, + 0xe450, 0xe451, 0xe452, 0xe453, + 0xe454, 0xe455, 0xe456, 0xe457, + // F090 + 0xe458, 0xe459, 0xe45a, 0xe45b, + 0xe45c, 0xe45d, 0xe45e, 0xe45f, + 0xe460, 0xe461, 0xe462, 0xe463, + 0xe464, 0xe465, 0xe466, 0xe467, + // F0a0 + 0xe468, 0xe469, 0xe46a, 0xe46b, + 0xe46c, 0xe46d, 0xe46e, 0xe46f, + 0xe470, 0xe471, 0xe472, 0xe473, + 0xe474, 0xe475, 0xe476, 0xe477, + // F0b0 + 0xe478, 0xe479, 0xe47a, 0xe47b, + 0xe47c, 0xe47d, 0xe47e, 0xe47f, + 0xe480, 0xe481, 0xe482, 0xe483, + 0xe484, 0xe485, 0xe486, 0xe487, + // F0c0 + 0xe488, 0xe489, 0xe48a, 0xe48b, + 0xe48c, 0xe48d, 0xe48e, 0xe48f, + 0xe490, 0xe491, 0xe492, 0xe493, + 0xe494, 0xe495, 0xe496, 0xe497, + // F0d0 + 0xe498, 0xe499, 0xe49a, 0xe49b, + 0xe49c, 0x232b, 0x2326, 0xe49d, + 0xe49e, 0xe49f, 0xe4a0, 0xe4a1, + 0xe4a2, 0xe4a3, 0xe4a4, 0xe4a5, + // F0e0 + 0xe4a6, 0xe4a7, 0xe4a8, 0xe4a9, + 0xe4aa, 0xe4ab, 0xe4ac, 0xe4ad, + 0xe4ae, 0xe4af, 0xe4b0, 0xe4b1, + 0xe4b2, 0xe4b3, 0xe4b4, 0xe4b5, + // F0f0 + 0xe4b6, 0xe4b7, 0xe4b8, 0xe4b9, + 0xe4ba, 0xe4bb, 0xe4bc, 0xe4bd, + 0xe4be, 0xe4bf, 0xe4c0, 0xe4c1, + 0xe4c2, 0xe4c3, 0xe4c4, 0xe4c5 +}; + +// ----------------------------------------------------------------------- + +static const sal_Unicode aWingDings2Tab[224] = +{ + // F020 + 0x0020, 0xe500, 0xe501, 0xe502, + 0xe503, 0xe504, 0xe505, 0xe506, + 0xe507, 0xe508, 0xe509, 0xe50a, + 0xe50b, 0xe50c, 0xe50d, 0xe50e, + // F030 + 0xe50f, 0xe510, 0xe511, 0xe512, + 0xe513, 0xe514, 0xe515, 0xe516, + 0xe517, 0xe518, 0xe519, 0xe51a, + 0xe51b, 0xe51c, 0xe51d, 0xe51e, + // F040 + 0xe51f, 0xe520, 0xe521, 0xe522, + 0xe523, 0xe524, 0xe525, 0xe526, + 0xe527, 0xe528, 0xe529, 0xe52a, + 0xe52b, 0xe52c, 0xe52d, 0xe52e, + // F050 + 0xe52f, 0xe530, 0xe531, 0xe532, + 0xe533, 0xe534, 0xe535, 0xe536, + 0xe537, 0xe538, 0xe539, 0xe53a, + 0xe53b, 0xe53c, 0xe53d, 0xe53e, + // F060 + 0xe53f, 0xe540, 0xe541, 0xe542, + 0xe543, 0xe544, 0xe545, 0xe546, + 0xe547, 0xe548, 0xe549, 0xe54a, + 0xe54b, 0xe54c, 0xe54d, 0xe54e, + // F070 + 0xe54e, 0xe54f, 0xe550, 0xe551, + 0xe552, 0xe553, 0xe554, 0xe555, + 0xe556, 0xe557, 0xe558, 0xe559, + 0xe55a, 0xe55b, 0xe55c, 0, + // F080 + 0x2609, 0x25cb, 0x263d, 0x263e, + 0xe55d, 0xe55e, 0xe55f, 0xe560, + 0xe561, 0xe562, 0xe563, 0xe564, + 0xe565, 0xe566, 0xe567, 0xe568, + // F090 + 0xe569, 0xe56a, 0xe56b, 0xe56c, + 0xe56d, 0xe56e, 0xe56f, 0xe570, + 0xe571, 0xe572, 0xe573, 0xe574, + 0xe575, 0xe576, 0xe577, 0xe578, + // F0a0 + 0xe579, 0xe57a, 0xe57b, 0xe57c, + 0xe57d, 0xe57e, 0xe57f, 0xe580, + 0xe581, 0xe582, 0xe583, 0xe584, + 0xe585, 0xe586, 0xe587, 0xe588, + // F0b0 + 0xe589, 0xe58a, 0xe58b, 0xe58c, + 0xe58d, 0xe58e, 0xe58f, 0xe590, + 0xe591, 0xe592, 0xe593, 0xe594, + 0xe595, 0xe596, 0xe597, 0xe598, + // F0c0 + 0xe599, 0xe59a, 0xe59b, 0xe59c, + 0xe59d, 0xe59e, 0xe59f, 0xe5a0, + 0xe5a1, 0xe5a2, 0xe5a3, 0xe5a4, + 0xe5a5, 0xe5a6, 0xe5a7, 0xe5a8, + // F0d0 + 0xe5a9, 0xe5aa, 0xe5ab, 0xe5ac, + 0xe5ad, 0xe5ae, 0xe5af, 0xe5b0, + 0xe5b1, 0xe5b2, 0xe5b3, 0xe5b4, + 0xe5b5, 0xe5b6, 0xe5b7, 0xe5b8, + // F0e0 + 0xe5b9, 0xe5ba, 0xe5bb, 0xe5bc, + 0xe5bd, 0xe5be, 0xe5bf, 0xe5c0, + 0xe5c1, 0xe5c2, 0xe5c3, 0xe5c4, + 0xe5c5, 0xe5c6, 0xe5c7, 0xe5c8, + // F0f0 + 0xe5c9, 0xe5ca, 0xe5cb, 0xe5cc, + 0xe5cd, 0xe5ce, 0xe5cf, 0xe5d0, + 0x203b, 0x2042, 0, 0, + 0, 0, 0, 0 +}; + +// ----------------------------------------------------------------------- + +static const sal_Unicode aWingDings3Tab[224] = +{ + // F020 + 0x0020, 0xe600, 0xe601, 0xe602, + 0xe603, 0x2196, 0xe604, 0x2199, + 0xe605, 0xe606, 0xe607, 0xe608, + 0xe609, 0xe60a, 0xe60b, 0x21de, + // F030 + 0x21df, 0xe60c, 0xe60d, 0xe60e, + 0x21e2, 0x21e1, 0x21e3, 0x21af, + 0x21b5, 0xe60f, 0xe610, 0xe611, + 0xe612, 0xe613, 0xe614, 0xe615, + // F040 + 0xe616, 0xe617, 0xe618, 0xe619, + 0x21c4, 0x21c5, 0xe61a, 0xe61b, + 0x21c7, 0x21c9, 0x21c8, 0x21ca, + 0x21b6, 0x21b7, 0xe61c, 0xe61d, + // F050 + 0x21bb, 0x21ba, 0xe61e, 0x2324, + 0x2303, 0x2325, 0x2334, 0xe61f, + 0x21ea, 0xe620, 0xe621, 0xe622, + 0xe623, 0xe624, 0xe625, 0xe626, + // F060 + 0xe627, 0xe628, 0xe629, 0xe62a, + 0xe62b, 0xe62c, 0xe62d, 0xe62e, + 0xe62f, 0xe630, 0xe631, 0xe632, + 0xe633, 0xe634, 0xe635, 0xe636, + // F070 + 0xe637, 0xe638, 0x25b3, 0x25bd, + 0x25c0, 0x25b6, 0x25c1, 0x25b7, + 0x25e3, 0xe639, 0x25e4, 0x25e5, + 0x25c2, 0x25b8, 0xe63a, 0, + // F080 + 0xe63b, 0xe63c, 0xe63d, 0xe63e, + 0xe63f, 0xe640, 0xe641, 0xe642, + 0xe643, 0xe644, 0xe645, 0xe646, + 0xe647, 0xe648, 0xe649, 0xe64a, + // F090 + 0xe64b, 0xe64c, 0xe64d, 0xe64e, + 0xe64f, 0xe650, 0xe651, 0xe652, + 0xe653, 0xe654, 0xe655, 0xe656, + 0xe657, 0xe658, 0xe659, 0xe65a, + // F0a0 + 0xe65b, 0xe65c, 0xe65d, 0xe65e, + 0xe65f, 0xe660, 0xe661, 0xe662, + 0xe663, 0xe664, 0xe665, 0xe666, + 0xe667, 0xe668, 0xe669, 0xe66a, + // F0b0 + 0xe66b, 0xe66c, 0xe66d, 0xe66e, + 0xe66f, 0xe670, 0xe671, 0xe672, + 0xe673, 0xe674, 0xe675, 0xe676, + 0xe677, 0xe678, 0xe679, 0xe67a, + // F0c0 + 0xe67b, 0xe67c, 0xe67d, 0xe67e, + 0xe67f, 0xe680, 0xe681, 0xe682, + 0xe683, 0xe684, 0xe685, 0xe686, + 0xe687, 0xe688, 0xe689, 0xe68a, + // F0d0 + 0xe68b, 0xe68c, 0xe68d, 0xe68e, + 0xe68f, 0xe690, 0xe691, 0xe692, + 0xe693, 0xe694, 0xe695, 0xe696, + 0xe697, 0xe698, 0xe699, 0xe69a, + // F0e0 + 0xe69b, 0xe69c, 0xe69d, 0xe69e, + 0xe69f, 0xe6a0, 0xe6a1, 0xe6a2, + 0xe6a3, 0xe6a4, 0xe6a5, 0xe6a6, + 0xe6a7, 0xe6a8, 0xe6a9, 0xe6aa, + // F0f0 + 0xe6ab, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0 +}; + +// ----------------------------------------------------------------------- + +static const sal_Unicode aWebDingsTab[224] = +{ + // F020 + 0x0020, 0xe300, 0xe301, 0xe302, + 0xe303, 0xe304, 0xe305, 0xe306, + 0xe307, 0xe308, 0xe309, 0xe30a, + 0xe30b, 0xe30c, 0xe30d, 0xe30e, + // F030 + 0xe30f, 0xe310, 0xe311, 0xe312, + 0xe313, 0xe314, 0xe315, 0xe316, + 0xe317, 0xe318, 0xe319, 0xe31a, + 0xe31b, 0xe31c, 0xe31d, 0xe31e, + // F040 + 0xe31f, 0xe320, 0xe321, 0xe322, + 0xe323, 0xe324, 0xe325, 0xe326, + 0xe327, 0xe328, 0xe329, 0xe32a, + 0xe32b, 0xe32c, 0xe32d, 0xe32e, + // F050 + 0xe32f, 0xe330, 0xe331, 0xe332, + 0xe333, 0xe334, 0xe335, 0xe336, + 0xe337, 0xe338, 0xe339, 0xe33a, + 0xe33b, 0xe33c, 0xe33d, 0xe33e, + // F060 + 0xe33f, 0xe340, 0xe341, 0xe342, + 0xe343, 0xe344, 0xe345, 0xe346, + 0xe347, 0xe348, 0xe349, 0xe34a, + 0xe34b, 0xe34c, 0xe34d, 0xe34e, + // F070 + 0xe34f, 0xe350, 0xe351, 0xe352, + 0xe353, 0xe354, 0xe355, 0xe356, + 0xe357, 0xe358, 0xe359, 0xe35a, + 0xe35b, 0xe35c, 0xe35d, 0, + // F080 + 0xe35e, 0xe35f, 0xe360, 0xe361, + 0xe362, 0xe363, 0xe364, 0xe365, + 0xe366, 0xe367, 0xe368, 0xe369, + 0xe36a, 0xe36b, 0xe36c, 0xe36d, + // F090 + 0xe36e, 0xe36f, 0xe370, 0xe371, + 0xe372, 0xe373, 0xe374, 0xe375, + 0xe376, 0xe377, 0xe378, 0xe379, + 0xe37a, 0xe37b, 0xe37c, 0xe37d, + // F0a0 + 0xe37e, 0xe37f, 0xe380, 0xe381, + 0xe382, 0xe383, 0xe384, 0xe385, + 0xe386, 0xe387, 0xe388, 0xe389, + 0xe38a, 0xe38b, 0xe38c, 0xe38d, + // F0b0 + 0xe38e, 0xe38f, 0xe390, 0xe391, + 0xe392, 0xe393, 0xe394, 0xe395, + 0xe396, 0xe397, 0xe398, 0xe399, + 0xe39a, 0xe39b, 0xe39c, 0xe39d, + // F0c0 + 0xe39e, 0xe39f, 0xe3a0, 0xe3a1, + 0xe3a2, 0xe3a3, 0xe3a4, 0xe3a5, + 0xe3a6, 0xe3a7, 0xe3a8, 0xe3a9, + 0xe3aa, 0xe3ab, 0xe3ac, 0xe3ad, + // F0d0 + 0xe3ae, 0xe3af, 0xe3b0, 0xe3b1, + 0xe3b2, 0xe3b3, 0xe3b4, 0xe3b5, + 0xe3b6, 0xe3b7, 0xe3b8, 0xe3b9, + 0xe3ba, 0xe3bb, 0xe3bc, 0xe3bd, + // F0e0 + 0xe3be, 0xe3bf, 0xe3c0, 0xe3c1, + 0xe3c2, 0xe3c3, 0xe3c4, 0xe3c5, + 0xe3c6, 0xe3c7, 0xe3c8, 0xe3c9, + 0xe3ca, 0xe3cb, 0xe3cd, 0xe3ce, + // F0f0 + 0xe3cf, 0xe3d0, 0xe3d1, 0xe3d2, + 0xe3d3, 0xe3d4, 0xe3d5, 0xe3d6, + 0xe3d7, 0xe3d8, 0xe3d9, 0xe3da, + 0xe3db, 0xe3dc, 0xe3dd, 0xe3de +}; + +// ----------------------------------------------------------------------- + +static const sal_Unicode aAdobeSymbolTab[224] = +{ +//TODO: + // F020 + 0x0020, 0xe100, 0xe101, 0xe102, + 0xe103, 0xe104, 0xe16a, 0xe105, + 0xe106, 0xe107, 0xe108, 0xe109, + 0xe10a, 0xe10b, 0xe10c, 0xe10d, + // F030 + 0x0030, 0x0031, 0x0032, 0x0033, + 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0xe10e, 0xe10f, + 0xe110, 0xe111, 0xe112, 0x003f, + // F040 + 0xe113, 0x0391, 0x0392, 0x03a7, + 0x0394, 0x0395, 0x03a6, 0x0393, + 0x0397, 0x0399, 0x03d1, 0x039a, + 0x039b, 0x039c, 0x039d, 0x039f, + // F050 + 0x03a0, 0x0398, 0x03a1, 0x03a3, + 0x03a4, 0x03a5, 0x03c2, 0x03a9, + 0x039e, 0x03a8, 0x0396, 0xe114, + 0x2234, 0xe115, 0xe116, 0x005f, + // F060 + 0x00af, 0x03b1, 0x03b2, 0x03c7, + 0x03b4, 0x03b5, 0x03d5, 0x03b3, + 0x03b7, 0x03b9, 0x03c6, 0x03ba, + 0x03bb, 0x03bc, 0x03bd, 0x03bf, + // F070 + 0x03c0, 0x03b8, 0x03c1, 0x03c3, + 0x03c4, 0x03c5, 0x03d6, 0x03c9, + 0x03be, 0x03c8, 0x03b6, 0xe117, + 0x007c, 0xe118, 0xe119, 0, + // F080 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + // F090 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + // F0a0 + 0xe11a, 0x03d2, 0x0384, 0xe11b, + 0x2215, 0xe11c, 0xe11d, 0xe11e, + 0x2666, 0xe11f, 0xe120, 0xe121, + 0xe122, 0xe123, 0xe124, 0xe125, + // F0b0 + 0xe126, 0xe127, 0x2033, 0xe128, + 0xe129, 0xe12a, 0xe12b, 0xe12c, + 0xe12d, 0xe12e, 0xe12f, 0xe130, + 0xe131, 0x2502, 0x2500, 0x21b2, + // F0c0 + 0xe132, 0xe133, 0xe134, 0xe135, + 0xe136, 0xe137, 0xe138, 0xe139, + 0xe13a, 0xe13b, 0xe13c, 0xe13d, + 0xe13e, 0xe13f, 0xe140, 0xe141, + // F0d0 + 0x2220, 0xe142, 0x00ae, 0x00a9, + 0xe143, 0xe144, 0xe145, 0xe146, + 0xe147, 0xe148, 0xe149, 0xe14a, + 0xe14b, 0x21d1, 0xe14c, 0x21d3, + // F0e0 + 0x25ca, 0xe14d, 0xe14e, 0xe14f, + 0xe150, 0xe151, 0xe152, 0xe153, + 0xe154, 0xe155, 0xe156, 0xe157, + 0xe158, 0xe159, 0xe15a, 0xe15b, + // F0f0 + 0, 0xe15c, 0xe15d, 0xe15e, + 0xe15f, 0xe160, 0xe161, 0xe162, + 0xe163, 0xe164, 0xe165, 0xe166, + 0xe167, 0xe168, 0xe169, 0, +}; + +// ----------------------------------------------------------------------- + +static const sal_Unicode aMonotypeSortsTab[224] = +{ + // F020 + 0x0020, 0x2701, 0xe200, 0x2703, + 0x2704, 0xe201, 0x2706, 0xe202, + 0xe203, 0xe203, 0xe204, 0xe205, + 0x270c, 0xe206, 0xe207, 0xe208, + // F030 + 0x2710, 0x2711, 0x2712, 0xe209, + 0xe20a, 0x2715, 0x2716, 0xe20b, + 0xe20c, 0xe20d, 0xe20e, 0xe20f, + 0xe210, 0x271d, 0x271e, 0x271f, + // F040 + 0x2720, 0xe211, 0xe212, 0xe213, + 0xe214, 0xe215, 0x2726, 0x2727, + 0x2605, 0x2729, 0x272a, 0xe216, + 0xe217, 0xe218, 0xe219, 0xe21a, + // F050 + 0xe21b, 0xe21c, 0x2732, 0xe21d, + 0xe21e, 0xe21f, 0xe220, 0xe221, + 0xe222, 0xe223, 0x273a, 0x273b, + 0x273c, 0x273d, 0x273e, 0xe224, + // F060 + 0x2740, 0x2741, 0x2742, 0x2743, + 0xe225, 0x2745, 0x2746, 0x2747, + 0x2748, 0x2749, 0x274a, 0x274b, + 0xe226, 0xe227, 0xe228, 0xe229, + // F070 + 0xe22a, 0xe22b, 0xe22c, 0x25b2, + 0x25bc, 0xe22d, 0xe22e, 0xe22f, + 0x2758, 0xe230, 0x275a, 0x275b, + 0x275c, 0x275d, 0x275e, 0, + // F080 + 0xe231, 0xe232, 0xe233, 0xe234, + 0xe235, 0xe236, 0xe237, 0xe238, + 0xe239, 0xe23a, 0xe23b, 0xe23c, + 0xe23d, 0xe23e, 0, 0, + // F090 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + // F0a0 + 0, 0xe23f, 0xe240, 0x2763, + 0x2764, 0x2765, 0x2766, 0x2767, + 0xe241, 0xe242, 0xe243, 0xe244, + 0x2460, 0x2461, 0x2462, 0x2463, + // F0b0 + 0x2464, 0x2465, 0x2466, 0x2467, + 0x2468, 0x2469, 0x2776, 0x2777, + 0x2778, 0x2779, 0x277a, 0x277b, + 0x277c, 0x277d, 0x277e, 0x277f, + // F0c0 + 0xe245, 0xe246, 0xe247, 0xe248, + 0xe249, 0xe24a, 0xe24b, 0xe24c, + 0xe24d, 0xe24e, 0xe24f, 0xe250, + 0xe251, 0xe252, 0xe253, 0xe254, + // F0d0 + 0xe255, 0xe256, 0xe257, 0xe258, + 0xe259, 0xe25a, 0xe25b, 0xe25c, + 0xe25d, 0x2799, 0xe25e, 0x279b, + 0x279c, 0x279d, 0x279e, 0x279f, + // F0e0 + 0x27a0, 0x27a1, 0xe25f, 0x27a3, + 0x27a4, 0x27a5, 0x27a6, 0x27a7, + 0x27a8, 0x27a9, 0x27aa, 0x27ab, + 0x27ac, 0x27ad, 0x27ae, 0x27af, + // F0f0 + 0, 0x27b1, 0xe260, 0x27b3, + 0x27b4, 0x27b5, 0x27b6, 0x27b7, + 0xe261, 0x27b9, 0x27ba, 0x27bb, + 0x27bc, 0x27bd, 0x27be, 0, +}; + +// ----------------------------------------------------------------------- + +/* +static const sal_Unicode aMonotypeSorts2Tab[224] = +{ +//TODO: + // F020 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + // F030 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + // F040 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + // F050 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + // F060 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + // F070 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + // F080 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + // F090 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + // F0a0 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + // F0b0 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + // F0c0 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + // F0d0 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + // F0e0 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + // F0f0 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, +}; +*/ + +static const sal_Unicode aMTExtraTab[224] = +{ + // F020 + 0x0020, 0, 0, 0xE095, + 0xE091, 0xE096, 0x02D9, 0, + 0xE093, 0, 0, 0, + 0, 0, 0, 0, + // F030 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0x25C1, 0, 0x25B7, 0, + // F040 + 0, 0, 0x2210, 0x019b, + 0, 0, 0, 0, + 0, 0x2229, 0, 0xE08B, + 0x22EF, 0x22EE, 0x22F0, 0x22F1, + // F050 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + // F060 + 0xE095, 0, 0xE25C, 0xE4BA, + 0, 0, 0x210F, 0, + 0, 0, 0, 0, + 0x2113, 0x2213, 0, 0x00B0, + // F070 + 0, 0, 0xE098, 0, + 0, 0xE097, 0, 0, + 0, 0, 0, 0xE081, + 0, 0xE082, 0, 0, + // F080 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + // F090 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + // F0a0 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + // F0b0 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + // F0c0 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + // F0d0 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + // F0e0 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + // F0f0 + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0 +}; + + +//======================================================================= + +static sal_Unicode ImplStarSymbolToStarBats( sal_Unicode c ) +{ + switch ( c ) + { + case 0x00A2: c = 0xF0E0; break; + case 0x00A4: c = 0xF0E1; break; + case 0x00A5: c = 0xF0E2; break; + case 0x00A7: c = 0xF0A7; break; + case 0x00AB: c = 0xF0AB; break; + case 0x00B6: c = 0xF0DE; break; + case 0x00BB: c = 0xF0BB; break; + + case 0x0152: c = 0xF08C; break; + case 0x0153: c = 0xF09C; break; + case 0x0160: c = 0xF08A; break; + case 0x0161: c = 0xF09A; break; + case 0x0178: c = 0xF09F; break; + case 0x017D: c = 0xF08E; break; + case 0x017E: c = 0xF09E; break; + + case 0x0192: c = 0xF083; break; + case 0x02C6: c = 0xF088; break; + case 0x02DC: c = 0xF098; break; + case 0x2013: c = 0xF096; break; + case 0x2014: c = 0xF097; break; + case 0x2018: c = 0xF091; break; + + case 0x2019: c = 0xF092; break; + case 0x201A: c = 0xF082; break; + case 0x201C: c = 0xF093; break; + case 0x201D: c = 0xF094; break; + case 0x201E: c = 0xF084; break; + case 0x2020: c = 0xF086; break; + + case 0x2021: c = 0xF087; break; + case 0x2022: c = 0xF095; break; + case 0x2026: c = 0xF085; break; + case 0x2030: c = 0xF089; break; + case 0x2039: c = 0xF08B; break; + case 0x203A: c = 0xF09B; break; + + case 0x20A1: c = 0xF0E4; break; + case 0x20A2: c = 0xF0E5; break; + case 0x20A3: c = 0xF0E6; break; + case 0x20A4: c = 0xF0E7; break; + case 0x20A8: c = 0xF0EA; break; + case 0x20A9: c = 0xF0E8; break; + case 0x20AB: c = 0xF0E9; break; + case 0x20AC: c = 0xF080; break; + + case 0x2122: c = 0xF099; break; + case 0x2190: c = 0xF0B7; break; + case 0x2191: c = 0xF0B8; break; + case 0x2192: c = 0xF0B5; break; + case 0x2193: c = 0xF0B6; break; + case 0x2194: c = 0xF0D8; break; + case 0x2195: c = 0xF0D9; break; + + case 0x21E4: c = 0xF0B4; break; + case 0x21E5: c = 0xF0B3; break; + case 0x21E6: c = 0xF0A4; break; + case 0x21E7: c = 0xF0B2; break; + case 0x21E8: c = 0xF0AF; break; + case 0x21E9: c = 0xF0A3; break; + + case 0x25A0: c = 0xF024; break; + case 0x25A1: c = 0xF025; break; + case 0x25B4: c = 0xF0C5; break; + case 0x25B5: c = 0xF0C7; break; + case 0x25BE: c = 0xF0C4; break; + case 0x25BF: c = 0xF0C6; break; + case 0x25C6: c = 0xF043; break; + case 0x25CF: c = 0xF022; break; + case 0x25D7: c = 0xF0D0; break; + + case 0x260E: c = 0xF074; break; + case 0x2611: c = 0xF034; break; + case 0x2612: c = 0xF033; break; + case 0x261B: c = 0xF036; break; + case 0x261E: c = 0xF07D; break; + case 0x2639: c = 0xF0AD; break; + case 0x263A: c = 0xF021; break; + + case 0x2702: c = 0xF0CB; break; + case 0x2708: c = 0xF0CC; break; + case 0x270D: c = 0xF07E; break; + case 0x270E: c = 0xF038; break; + + case 0x2713: c = 0xF039; break; + case 0x2714: c = 0xF03A; break; + case 0x2717: c = 0xF04F; break; + case 0x2718: c = 0xF050; break; + case 0x2719: c = 0xF051; break; + case 0x271A: c = 0xF052; break; + case 0x271B: c = 0xF053; break; + case 0x271C: c = 0xF054; break; + + case 0x2721: c = 0xF0CD; break; + case 0x2722: c = 0xF044; break; + case 0x2723: c = 0xF045; break; + case 0x2724: c = 0xF046; break; + case 0x2725: c = 0xF047; break; + case 0x272B: c = 0xF055; break; + case 0x272C: c = 0xF056; break; + case 0x272D: c = 0xF057; break; + case 0x272E: c = 0xF058; break; + case 0x272F: c = 0xF059; break; + + case 0x2730: c = 0xF05A; break; + case 0x2733: c = 0xF048; break; + case 0x2734: c = 0xF049; break; + case 0x2735: c = 0xF04A; break; + case 0x2736: c = 0xF04B; break; + case 0x2737: c = 0xF04C; break; + case 0x2738: c = 0xF04D; break; + case 0x2739: c = 0xF04E; break; + case 0x273F: c = 0xF0CE; break; + + case 0x2744: c = 0xF0CF; break; + case 0x274D: c = 0xF023; break; + case 0x274F: c = 0xF03E; break; + case 0x2750: c = 0xF03F; break; + case 0x2751: c = 0xF027; break; + case 0x2752: c = 0xF028; break; + case 0x2756: c = 0xF02C; break; + case 0x2759: c = 0xF0D1; break; + case 0x2762: c = 0xF0D4; break; + + case 0x2780: c = 0xF068; break; + case 0x2781: c = 0xF069; break; + case 0x2782: c = 0xF06A; break; + case 0x2783: c = 0xF06B; break; + case 0x2784: c = 0xF06C; break; + case 0x2785: c = 0xF06D; break; + case 0x2786: c = 0xF06E; break; + case 0x2787: c = 0xF06F; break; + case 0x2788: c = 0xF070; break; + case 0x2789: c = 0xF071; break; + case 0x278A: c = 0xF05D; break; + case 0x278B: c = 0xF05E; break; + case 0x278C: c = 0xF05F; break; + case 0x278D: c = 0xF060; break; + case 0x278E: c = 0xF061; break; + case 0x278F: c = 0xF062; break; + + case 0x2790: c = 0xF063; break; + case 0x2791: c = 0xF064; break; + case 0x2792: c = 0xF065; break; + case 0x2793: c = 0xF066; break; + case 0x2794: c = 0xF031; break; + case 0x2798: c = 0xF0DA; break; + case 0x279A: c = 0xF0DB; break; + + case 0x27A2: c = 0xF02F; break; + case 0x27B2: c = 0xF035; break; + case 0x27B8: c = 0xF0DC; break; + + case 0xE000: c = 0xF000+38; break; + case 0xE001: c = 0xF000+41; break; + case 0xE002: c = 0xF000+42; break; + case 0xE003: c = 0xF000+43; break; + case 0xE004: c = 0xF000+45; break; + case 0xE005: c = 0xF000+46; break; + case 0xE006: c = 0xF000+48; break; + case 0xE007: c = 0xF000+57; break; + + case 0xE008: c = 0xF000+59; break; + case 0xE009: c = 0xF000+60; break; + case 0xE00a: c = 0xF000+61; break; + case 0xE00b: c = 0xF000+64; break; + case 0xE00c: c = 0xF000+65; break; + case 0xE00d: c = 0xF000+66; break; + case 0xE00e: c = 0xF000+67; break; + case 0xE00f: c = 0xF000+92; break; + + case 0xE010: c = 0xF000+103; break; + case 0xE011: c = 0xF000+114; break; + case 0xE012: c = 0xF000+115; break; + case 0xE013: c = 0xF000+117; break; + case 0xE014: c = 0xF000+118; break; + case 0xE015: c = 0xF000+119; break; + case 0xE016: c = 0xF000+120; break; + case 0xE017: c = 0xF000+121; break; + + case 0xE018: c = 0xF000+122; break; + case 0xE019: c = 0xF000+123; break; + case 0xE01a: c = 0xF000+124; break; + case 0xE01b: c = 0xF000+126; break; + case 0xE01c: c = 0xF000+136; break; + case 0xE01d: c = 0xF000+155; break; + case 0xE01e: c = 0xF000+165; break; + case 0xE01f: c = 0xF000+166; break; + + case 0xE020: c = 0xF000+168; break; + case 0xE021: c = 0xF000+169; break; + case 0xE022: c = 0xF000+170; break; + case 0xE023: c = 0xF000+172; break; + case 0xE024: c = 0xF000+174; break; + case 0xE025: c = 0xF000+175; break; + case 0xE026: c = 0xF000+176; break; + case 0xE027: c = 0xF000+177; break; + + case 0xE028: c = 0xF000+178; break; + case 0xE029: c = 0xF000+185; break; + case 0xE02a: c = 0xF000+186; break; + case 0xE02b: c = 0xF000+188; break; + case 0xE02c: c = 0xF000+189; break; + case 0xE02d: c = 0xF000+190; break; + case 0xE02e: c = 0xF000+191; break; + case 0xE02f: c = 0xF000+192; break; + + case 0xE030: c = 0xF000+193; break; + case 0xE031: c = 0xF000+194; break; + case 0xE032: c = 0xF000+195; break; + case 0xE033: c = 0xF000+200; break; + case 0xE034: c = 0xF000+201; break; + case 0xE035: c = 0xF000+202; break; + case 0xE036: c = 0xF000+210; break; + case 0xE037: c = 0xF000+211; break; + + case 0xE038: c = 0xF000+227; break; + case 0xE039: c = 0xF000+235; break; + case 0xE03a: c = 0xF000+255; break; + + default: c = 0; break; + } + + return c; +} + +enum SymbolFont +{ + Symbol=1, Wingdings=2, MonotypeSorts=4, Webdings=8, Wingdings2=16, + Wingdings3=32, MTExtra=64, TimesNewRoman=128 +}; + +const char *aSymbolNames[] = +{ + "Symbol", "Wingdings", "Monotype Sorts", "Webdings", "Wingdings 2", + "Wingdings 3", "MT Extra", "Times New Roman" +}; + +struct SymbolEntry +{ + sal_uInt8 cIndex; + enum SymbolFont eFont; +}; + +class StarSymbolToMSMultiFontImpl : public StarSymbolToMSMultiFont +{ +private: + ::std::multimap maMagicMap; +public: + StarSymbolToMSMultiFontImpl(bool bPerfectOnly); + String ConvertChar(sal_Unicode &rChar); + String ConvertString(String &rString, xub_StrLen& rIndex); +}; + +struct ExtraTable { sal_Unicode cStar; sal_uInt8 cMS;}; + +ExtraTable aWingDingsExtraTab[] = +{ + {0x25cf, 0x6C}, {0x2714, 0xFC}, {0x2717, 0xFB}, {0x2794, 0xE8}, + {0x27a2, 0xD8}, {0xe000, 0x6F}, {0xe001, 0x73}, {0xe002, 0x74}, + {0xe003, 0x75}, {0xe004, 0x77}, {0xe005, 0xA6}, {0xe006, 0xE0}, + {0xe007, 0xFC}, {0xe008, 0x6C}, {0xe009, 0x6D}, {0xe00a, 0x6E}, + {0xe00b, 0x72}, {0xe00c, 0x75}, {0xe00d, 0x76}, {0xe00e, 0x74}, + {0xe00f, 0x8B}, {0xe010, 0x80}, {0xe011, 0x2B}, {0xe012, 0x3A}, + {0xe013, 0x5D}, {0xe014, 0x29}, {0xe015, 0x3A}, {0xe016, 0x3C}, + {0xe017, 0x38}, {0xe018, 0x3A}, {0xe019, 0x2A}, {0xe01a, 0x2B}, + {0xe01b, 0x3F}, {0xe01c, 0x9F}, {0xe01d, 0x80}, {0xe01e, 0x8B}, + {0xe023, 0x4A}, {0xe025, 0xF0}, {0xe026, 0xF2}, {0xe027, 0xEF}, + {0xe028, 0xF1}, {0xe029, 0x52}, {0xe02a, 0x29}, {0xe02b, 0xE0}, + {0xe02c, 0xE2}, {0xe02d, 0xDF}, {0xe02e, 0xE1}, {0xe02f, 0xAC}, + {0xe030, 0xAD}, {0xe031, 0xAE}, {0xe032, 0x7C}, {0xe033, 0x43}, + {0xe034, 0x4D}, {0xe0aa, 0x71}, {0xe422, 0x44} +}; + +ExtraTable aSymbolExtraTab2[] = +{ + {0x0020, 0x20}, {0x00A0, 0x20}, {0x0021, 0x21}, {0x2200, 0x22}, + {0x0023, 0x23}, {0x2203, 0x24}, {0x0025, 0x25}, {0x0026, 0x26}, + {0x220B, 0x27}, {0x0028, 0x28}, {0x0029, 0x29}, {0x2217, 0x2A}, + {0x002B, 0x2B}, {0x002C, 0x2C}, {0x2212, 0x2D}, {0x002E, 0x2E}, + {0x002F, 0x2F}, {0x003A, 0x3A}, {0x003B, 0x3B}, {0x003C, 0x3C}, + {0x003D, 0x3D}, {0x003E, 0x3E}, {0x2245, 0x40}, {0x2206, 0x44}, + {0x2126, 0x57}, {0x005B, 0x5B}, {0x005D, 0x5D}, {0x22A5, 0x5E}, + {0x03C6, 0x66}, {0x03D5, 0x6A}, {0x00B5, 0x6D}, {0x007B, 0x7B}, + {0x007C, 0x7C}, {0x007D, 0x7D}, {0x223C, 0x7E}, {0x20AC, 0xA0}, + {0x2032, 0xA2}, {0x2264, 0xA3}, {0x2044, 0xA4}, {0x221E, 0xA5}, + {0x0192, 0xA6}, {0x2663, 0xA7}, {0x2665, 0xA9}, {0x2660, 0xAA}, + {0x2194, 0xAB}, {0x2190, 0xAC}, {0x2191, 0xAD}, {0x2192, 0xAE}, + {0x2193, 0xAF}, {0x00B0, 0xB0}, {0x00B1, 0xB1}, {0x2265, 0xB3}, + {0x00D7, 0xB4}, {0x221D, 0xB5}, {0x2202, 0xB6}, {0x2022, 0xB7}, + {0x00F7, 0xB8}, {0x2260, 0xB9}, {0x2261, 0xBA}, {0x2248, 0xBB}, + {0x2026, 0xBC}, {0x21B5, 0xBF}, {0x2135, 0xC0}, {0x2111, 0xC1}, + {0x211C, 0xC2}, {0x2118, 0xC3}, {0x2297, 0xC4}, {0x2295, 0xC5}, + {0x2205, 0xC6}, {0x2229, 0xC7}, {0x222A, 0xC8}, {0x2283, 0xC9}, + {0x2287, 0xCA}, {0x2284, 0xCB}, {0x2282, 0xCC}, {0x2286, 0xCD}, + {0x2208, 0xCE}, {0x2209, 0xCF}, {0x2207, 0xD1}, {0x220F, 0xD5}, + {0x221A, 0xD6}, {0x22C5, 0xD7}, {0x00AC, 0xD8}, {0x2227, 0xD9}, + {0x2228, 0xDA}, {0x21D4, 0xDB}, {0x21D0, 0xDC}, {0x21D2, 0xDE}, + {0x2329, 0xE1}, {0x2211, 0xE5}, {0x232A, 0xF1}, {0x222B, 0xF2}, + {0x2320, 0xF3}, {0x2321, 0xF5}, {0x2013, 0x2D} +}; + +ExtraTable aSymbolExtraTab[] = +{ + {0xe021, 0xD3}, {0xe024, 0xD2}, {0xe035, 0x20}, {0xe036, 0x28}, + {0xe037, 0x29}, {0xe039, 0x20}, {0xe083, 0x2B}, {0xe084, 0x3C}, + {0xe085, 0x3E}, {0xe086, 0xA3}, {0xe087, 0xB3}, {0xe089, 0xCE}, + {0xe08a, 0xA6}, {0xe08c, 0xAE}, {0xe08d, 0xD6}, {0xe08e, 0xD6}, + {0xe08f, 0xD6}, {0xe094, 0xA2}, {0xe09e, 0x28}, {0xe09f, 0x29}, + {0xe0a0, 0xD0}, {0xe0a6, 0xA2}, {0xe0a7, 0x7C}, {0xe0a8, 0x2F}, + {0xe0ab, 0x7C}, {0xe0ac, 0x47}, {0xe0ad, 0x44}, {0xe0ae, 0x51}, + {0xe0af, 0x4C}, {0xe0b0, 0x58}, {0xe0b1, 0x50}, {0xe0b2, 0x53}, + {0xe0b3, 0x55}, {0xe0b4, 0x46}, {0xe0b5, 0x59}, {0xe0b6, 0x57}, + {0xe0b7, 0x61}, {0xe0b8, 0x62}, {0xe0b9, 0x67}, {0xe0ba, 0x64}, + {0xe0bb, 0x65}, {0xe0bc, 0x7A}, {0xe0bd, 0x68}, {0xe0be, 0x71}, + {0xe0bf, 0x69}, {0xe0c0, 0x6B}, {0xe0c1, 0x6C}, {0xe0c2, 0x6D}, + {0xe0c3, 0x6E}, {0xe0c4, 0x78}, {0xe0c5, 0x6F}, {0xe0c6, 0x70}, + {0xe0c7, 0x72}, {0xe0c8, 0x73}, {0xe0c9, 0x74}, {0xe0ca, 0x75}, + {0xe0cb, 0x66}, {0xe0cc, 0x63}, {0xe0cd, 0x79}, {0xe0ce, 0x77}, + {0xe0cf, 0x65}, {0xe0d0, 0x4A}, {0xe0d1, 0x76}, {0xe0d3, 0x56}, + {0xe0d4, 0x6A}, {0xe0d5, 0xB6}, {0xe0d6, 0x69}, {0xe0db, 0xAC}, + {0xe0dc, 0xAD}, {0xe0dd, 0xAF} +}; + +ExtraTable aTNRExtraTab[] = +{ + {0xe021, 0xA9}, + {0xe022, 0x40}, + {0xe024, 0xAE}, + {0xe035, 0x20}, + {0xe036, '('}, + {0xe037, ')'}, + {0xe039, 0x20}, + {0xe03a, 0x80}, + {0xe080, 0x89}, + {0xe083, '+'}, + {0xe084, '<'}, + {0xe085, '>'}, + {0xe0a9, '\\'} +}; + +StarSymbolToMSMultiFontImpl::StarSymbolToMSMultiFontImpl(bool bPerfectOnly) +{ + struct ConvertTable + { + enum SymbolFont meFont; + const sal_Unicode* pTab; + }; + + //In order of preference + const ConvertTable aConservativeTable[] = + { + {Symbol, aAdobeSymbolTab}, + {Wingdings, aWingDingsTab}, + {MonotypeSorts, aMonotypeSortsTab}, + {Webdings, aWebDingsTab}, + {Wingdings2, aWingDings2Tab}, + {Wingdings3, aWingDings3Tab}, + {MTExtra, aMTExtraTab} + }; + + struct ExtendedConvertTable + { + enum SymbolFont meFont; + const ExtraTable *mpTable; + size_t mnSize; + ExtendedConvertTable(SymbolFont eFont, const ExtraTable *pTable, + size_t nSize) + : meFont(eFont), mpTable(pTable), mnSize(nSize) {} + }; + + //Reverse map from a given starsymbol char to exact matches in ms symbol + //fonts. + int nEntries = sizeof(aConservativeTable) / sizeof(aConservativeTable[0]); + int i; + for (i = 0; i < nEntries; ++i) + { + const ConvertTable& r = aConservativeTable[i]; + SymbolEntry aEntry; + aEntry.eFont = r.meFont; + for (aEntry.cIndex = 0xFF; aEntry.cIndex >= 0x20; --aEntry.cIndex) + { + if (sal_Unicode cChar = r.pTab[aEntry.cIndex-0x20]) + maMagicMap.insert( + ::std::multimap::value_type( + cChar, aEntry)); + } + } + + //In order of preference + const ExtendedConvertTable aAgressiveTable[] = + { + ExtendedConvertTable(Symbol, aSymbolExtraTab2, + sizeof(aSymbolExtraTab2)), + ExtendedConvertTable(Symbol, aSymbolExtraTab, + sizeof(aSymbolExtraTab)), + ExtendedConvertTable(Wingdings, aWingDingsExtraTab, + sizeof(aWingDingsExtraTab)), + ExtendedConvertTable(TimesNewRoman, aTNRExtraTab, + sizeof(aTNRExtraTab)) + }; + + //Allow extra conversions that are not perfect, but "good enough" + if (!bPerfectOnly) + nEntries = sizeof(aAgressiveTable) / sizeof(aAgressiveTable[0]); + else + nEntries = 1; + + for (i = 0; i < nEntries; ++i) + { + const ExtendedConvertTable& r = aAgressiveTable[i]; + SymbolEntry aEntry; + aEntry.eFont = r.meFont; + for (int j = r.mnSize / sizeof(r.mpTable[0]); j >=0; --j) + { + aEntry.cIndex = r.mpTable[j].cMS; + maMagicMap.insert( + ::std::multimap::value_type( + r.mpTable[j].cStar, aEntry)); + } + } +} + +const char *SymbolFontToString(int nResult) +{ + const char **ppName = aSymbolNames; + int nI = Symbol; + while (nI <= nResult) + { + if (!(nI & nResult)) + nI = nI << 1; + else + break; + ppName++; + } + return *ppName; +} + +String StarSymbolToMSMultiFontImpl::ConvertChar(sal_Unicode &rChar) +{ + String sRet; + + ::std::multimap::const_iterator aResult = + maMagicMap.find(rChar); + + if (aResult != maMagicMap.end()) + { + const SymbolEntry &rEntry = (*aResult).second; + sRet.AssignAscii(SymbolFontToString(rEntry.eFont)); + rChar = rEntry.cIndex; + } + + return sRet; +} + +String StarSymbolToMSMultiFontImpl::ConvertString(String &rString, + xub_StrLen& rIndex) +{ + typedef ::std::multimap::iterator MI; + typedef ::std::pair Result; + + String sRet; + + xub_StrLen nLen = rString.Len(); + if (rIndex >= nLen) + return sRet; + + int nTotal = 0, nResult = 0; + ::std::vector aPossibilities; + aPossibilities.reserve(nLen - rIndex); + xub_StrLen nStart = rIndex; + do + { + Result aResult = maMagicMap.equal_range(rString.GetChar(rIndex)); + int nBitfield = 0; + for (MI aIndex = aResult.first; aIndex != aResult.second; ++aIndex) + nBitfield |= aIndex->second.eFont; + + if (!nTotal) + nTotal = nBitfield; + else + { + if (nTotal != nBitfield) //Allow a series of failures + { + nTotal &= nBitfield; + if (!nTotal) + break; + } + } + nResult = nTotal; + if (nResult) //Don't bother storing a series of failures + aPossibilities.push_back(aResult); + ++rIndex; + }while(rIndex < nLen); + + if (nResult) + { + int nI = Symbol; + while (nI <= nResult) + { + if (!(nI & nResult)) + nI = nI << 1; + else + break; + } + sRet.AssignAscii(SymbolFontToString(nI)); + + xub_StrLen nSize = sal::static_int_cast(aPossibilities.size()); + for(xub_StrLen nPos = 0; nPos < nSize; ++nPos) + { + const Result &rResult = aPossibilities[nPos]; + + for (MI aIndex = rResult.first; aIndex != rResult.second; ++aIndex) + { + if (aIndex->second.eFont == nI) + { + rString.SetChar(nPos+nStart, aIndex->second.cIndex); + break; + } + } + } + } + + return sRet; +} + +StarSymbolToMSMultiFont *CreateStarSymbolToMSMultiFont(bool bPerfectOnly) +{ + return new StarSymbolToMSMultiFontImpl(bPerfectOnly); +} + +//======================================================================= + +sal_Unicode ConvertChar::RecodeChar( sal_Unicode cChar ) const +{ + sal_Unicode cRetVal = 0; + if( mpCvtFunc ) + { + // use a conversion function for recoding + cRetVal = mpCvtFunc( cChar ); + } + else + { + // use a conversion table for recoding + sal_Unicode cIndex = cChar; + // allow symbol aliasing + if( cIndex & 0xFF00 ) + cIndex -= 0xF000; + // recode the symbol + if( cIndex>=0x0020 && cIndex<=0x00FF ) + cRetVal = mpCvtTab[ cIndex - 0x0020 ]; + } + + return cRetVal ? cRetVal : cChar; +} + +// ----------------------------------------------------------------------- + +// recode the string assuming the character codes are symbol codes +// from an traditional symbol font (i.e. U+F020..U+F0FF) +void ConvertChar::RecodeString( String& rStr, xub_StrLen nIndex, xub_StrLen nLen ) const +{ + ULONG nLastIndex = (ULONG)nIndex + nLen; + if( nLastIndex > rStr.Len() ) + nLastIndex = rStr.Len(); + + for(; nIndex < nLastIndex; ++nIndex ) + { + sal_Unicode cOrig = rStr.GetChar( nIndex ); + // only recode symbols and their U+00xx aliases + if( ((cOrig < 0x0020) || (cOrig > 0x00FF)) + && ((cOrig < 0xF020) || (cOrig > 0xF0FF)) ) + continue; + + // recode a symbol + sal_Unicode cNew = RecodeChar( cOrig ); + if( cOrig != cNew ) + rStr.SetChar( nIndex, cNew ); + } +} + +//======================================================================= + +struct RecodeTable { const char* pOrgName; ConvertChar aCvt;}; + +static RecodeTable aRecodeTable[] = +{ + // the first two entries must be StarMath and StarBats; do not reorder! + // reason: fgrep for FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS + {"starbats", {aStarBatsTab, "StarSymbol", NULL}}, + {"starmath", {aStarMathTab, "StarSymbol", NULL}}, + + {"symbol", {aAdobeSymbolTab, "StarSymbol", NULL}}, + {"standardsymbols", {aAdobeSymbolTab, "StarSymbol", NULL}}, + {"standardsymbolsl",{aAdobeSymbolTab, "StarSymbol", NULL}}, + + {"monotypesorts", {aMonotypeSortsTab, "StarSymbol", NULL}}, +// {"monotypesorts2", {aMonotypeSorts2Tab, "StarSymbol", NULL}} + {"zapfdingbats", {aMonotypeSortsTab, "StarSymbol", NULL}}, //ZapfDingbats=MonotypeSorts-X? + {"itczapfdingbats", {aMonotypeSortsTab, "StarSymbol", NULL}}, + {"dingbats", {aMonotypeSortsTab, "StarSymbol", NULL}}, + + {"webdings", {aWebDingsTab, "StarSymbol", NULL}}, + {"wingdings", {aWingDingsTab, "StarSymbol", NULL}}, + {"wingdings2", {aWingDings2Tab, "StarSymbol", NULL}}, + {"wingdings3", {aWingDings3Tab, "StarSymbol", NULL}}, + {"mtextra", {aMTExtraTab, "StarSymbol", NULL}} +}; + +static ConvertChar aImplStarSymbolCvt = { NULL, "StarBats", ImplStarSymbolToStarBats }; + +// ----------------------------------------------------------------------- + +const ConvertChar* ConvertChar::GetRecodeData( const String& rOrgFontName, const String& rMapFontName ) +{ + const ConvertChar* pCvt = NULL; + String aOrgName( rOrgFontName ); + GetEnglishSearchFontName( aOrgName ); + String aMapName( rMapFontName ); + GetEnglishSearchFontName( aMapName ); + + if( aMapName.EqualsAscii( "starsymbol" ) + || aMapName.EqualsAscii( "opensymbol" ) ) + { + int nEntries = sizeof(aRecodeTable) / sizeof(aRecodeTable[0]); + for( int i = 0; i < nEntries; ++i) + { + RecodeTable& r = aRecodeTable[i]; + if( aOrgName.EqualsAscii( r.pOrgName ) ) + { pCvt = &r.aCvt; break; } + } + } + else if( aMapName.EqualsAscii( "starbats" ) ) + { + if( aOrgName.EqualsAscii( "starsymbol" ) ) + pCvt = &aImplStarSymbolCvt; + else if( aOrgName.EqualsAscii( "opensymbol" ) ) + pCvt = &aImplStarSymbolCvt; + } + + return pCvt; +} + +//======================================================================= + +FontToSubsFontConverter CreateFontToSubsFontConverter( + const String& rOrgName, ULONG nFlags ) +{ + const ConvertChar* pCvt = NULL; + + String aName = rOrgName; + GetEnglishSearchFontName( aName ); + + if ( nFlags & FONTTOSUBSFONT_IMPORT ) + { + int nEntries = sizeof(aRecodeTable) / sizeof(aRecodeTable[0]); + if ( nFlags & FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ) // only StarMath+StarBats + nEntries = 2; + for( int i = 0; i < nEntries; ++i ) + { + RecodeTable& r = aRecodeTable[i]; + if( aName.EqualsAscii( r.pOrgName ) ) + { pCvt = &r.aCvt; break; } + } + } + else + { + // TODO: FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS + if( aName.EqualsAscii( "starsymbol" ) ) pCvt = &aImplStarSymbolCvt; + else if( aName.EqualsAscii( "opensymbol" ) ) pCvt = &aImplStarSymbolCvt; + } + + return (FontToSubsFontConverter)pCvt; +} + +// ----------------------------------------------------------------------- + +void DestroyFontToSubsFontConverter( FontToSubsFontConverter ) +{ + // nothing to do for now, because we use static ImplCvtChars +} + +// ----------------------------------------------------------------------- + +sal_Unicode ConvertFontToSubsFontChar( + FontToSubsFontConverter hConverter, sal_Unicode cChar ) +{ + if ( hConverter ) + return ((ConvertChar*)hConverter)->RecodeChar( cChar ); + else + return cChar; +} + +// ----------------------------------------------------------------------- + +String GetFontToSubsFontName( FontToSubsFontConverter hConverter ) +{ + if ( !hConverter ) + return String(); + + const char* pName = ((ConvertChar*)hConverter)->mpSubsFontName; + return String::CreateFromAscii( pName ); +} + diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx new file mode 100644 index 000000000000..15e67c44f001 --- /dev/null +++ b/unotools/source/misc/fontdefs.cxx @@ -0,0 +1,596 @@ +/************************************************************************* + * + * 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 + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" +#include +#include +#include + +struct ImplLocalizedFontName +{ + const char* mpEnglishName; + const sal_Unicode* mpLocalizedNames; +}; + +static sal_Unicode const aBatang[] = { 0xBC14, 0xD0D5, 0, 0 }; +static sal_Unicode const aBatangChe[] = { 0xBC14, 0xD0D5, 0xCCB4, 0, 0 }; +static sal_Unicode const aGungsuh[] = { 0xAD81, 0xC11C, 0, 0 }; +static sal_Unicode const aGungsuhChe[] = { 0xAD81, 0xC11C, 0xCCB4, 0, 0 }; +static sal_Unicode const aGulim[] = { 0xAD74, 0xB9BC, 0, 0 }; +static sal_Unicode const aGulimChe[] = { 0xAD74, 0xB9BC, 0xCCB4, 0, 0 }; +static sal_Unicode const aDotum[] = { 0xB3CB, 0xC6C0, 0, 0 }; +static sal_Unicode const aDotumChe[] = { 0xB3CB, 0xC6C0, 0xCCB4, 0, 0 }; +static sal_Unicode const aSimSun[] = { 0x5B8B, 0x4F53, 0, 0 }; +static sal_Unicode const aNSimSun[] = { 0x65B0, 0x5B8B, 0x4F53, 0, 0 }; +static sal_Unicode const aSimHei[] = { 0x9ED1, 0x4F53, 0, 0 }; +static sal_Unicode const aSimKai[] = { 0x6977, 0x4F53, 0, 0 }; +static sal_Unicode const azycjkSun[] = { 0x4E2D, 0x6613, 0x5B8B, 0x4F53, 0, 0 }; +static sal_Unicode const azycjkHei[] = { 0x4E2D, 0x6613, 0x9ED1, 0x4F53, 0, 0 }; +static sal_Unicode const azycjkKai[] = { 0x4E2D, 0x6613, 0x6977, 0x4F53, 0, 0 }; +static sal_Unicode const aFZHei[] = { 0x65B9, 0x6B63, 0x9ED1, 0x4F53, 0, 0 }; +static sal_Unicode const aFZKai[] = { 0x65B9, 0x6B63, 0x6977, 0x4F53, 0, 0 }; +static sal_Unicode const aFZSongYI[] = { 0x65B9, 0x6B63, 0x5B8B, 0x4E00, 0, 0 }; +static sal_Unicode const aFZShuSong[] = { 0x65B9, 0x6B63, 0x4E66, 0x5B8B, 0, 0 }; +static sal_Unicode const aFZFangSong[] = { 0x65B9, 0x6B63, 0x4EFF, 0x5B8B, 0, 0 }; +// Attention: this fonts includes the wrong encoding vector - so we double the names with correct and wrong encoding +// First one is the GB-Encoding (we think the correct one), second is the big5 encoded name +static sal_Unicode const aMHei[] = { 'm', 0x7B80, 0x9ED1, 0, 'm', 0x6F60, 0x7AAA, 0, 0 }; +static sal_Unicode const aMKai[] = { 'm', 0x7B80, 0x6977, 0x566C, 0, 'm', 0x6F60, 0x7FF1, 0x628E, 0, 0 }; +static sal_Unicode const aMSong[] = { 'm', 0x7B80, 0x5B8B, 0, 'm', 0x6F60, 0x51BC, 0, 0 }; +static sal_Unicode const aCFangSong[] = { 'm', 0x7B80, 0x592B, 0x5B8B, 0, 'm', 0x6F60, 0x6E98, 0x51BC, 0, 0 }; +static sal_Unicode const aMingLiU[] = { 0x7D30, 0x660E, 0x9AD4, 0, 0 }; +static sal_Unicode const aPMingLiU[] = { 0x65B0, 0x7D30, 0x660E, 0x9AD4, 0, 0 }; +static sal_Unicode const aHei[] = { 0x6865, 0, 0 }; +static sal_Unicode const aKai[] = { 0x6B61, 0, 0 }; +static sal_Unicode const aMing[] = { 0x6D69, 0x6E67, 0, 0 }; +static sal_Unicode const aMSGothic[] = { 'm','s', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; +static sal_Unicode const aMSPGothic[] = { 'm','s','p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; +static sal_Unicode const aMSMincho[] = { 'm', 's', 0x660E, 0x671D, 0 }; +static sal_Unicode const aMSPMincho[] = { 'm','s','p', 0x660E, 0x671D, 0 }; +static sal_Unicode const aMeiryo[] = { 0x30e1, 0x30a4, 0x30ea, 0x30aa, 0 }; +static sal_Unicode const aHGMinchoL[] = { 'h','g', 0x660E, 0x671D, 'l', 0, 0 }; +static sal_Unicode const aHGGothicB[] = { 'h','g', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 0 }; +static sal_Unicode const aHGPMinchoL[] = { 'h','g','p', 0x660E, 0x671D, 'l', 0 }; +static sal_Unicode const aHGPGothicB[] = { 'h','g','p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 0 }; +static sal_Unicode const aHGMinchoLSun[] = { 'h','g', 0x660E, 0x671D, 'l', 's', 'u', 'n', 0 }; +static sal_Unicode const aHGPMinchoLSun[] = { 'h','g','p', 0x660E, 0x671D, 'l', 's', 'u', 'n', 0 }; +static sal_Unicode const aHGGothicBSun[] = { 'h', 'g', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 's', 'u', 'n', 0 }; +static sal_Unicode const aHGPGothicBSun[] = { 'h', 'g', 'p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 's', 'u', 'n', 0 }; +static sal_Unicode const aHGHeiseiMin[] = { 'h', 'g', 0x5E73, 0x6210, 0x660E, 0x671D, 0x4F53, 0, 'h', 'g', 0x5E73, 0x6210, 0x660E, 0x671D, 0x4F53, 'w', '3', 'x', '1', '2', 0, 0 }; +static sal_Unicode const aIPAMincho[] = { 'i', 'p', 'a', 0x660E, 0x671D, 0 }; +static sal_Unicode const aIPAPMincho[] = { 'i', 'p', 'a', 'p', 0x660E, 0x671D, 0 }; +static sal_Unicode const aIPAGothic[] = { 'i', 'p', 'a', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 }; +static sal_Unicode const aIPAPGothic[] = { 'i', 'p', 'a', 'p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 }; +static sal_Unicode const aIPAUIGothic[] = { 'i', 'p', 'a', 'u', 'i', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 }; +static sal_Unicode const aSazanamiMincho[] = { 0x3055, 0x3056, 0x306A, 0x307F, 0x660E, 0x671D, 0, 0 }; +static sal_Unicode const aSazanamiGothic[] = { 0x3055, 0x3056, 0x306A, 0x307F, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; +static sal_Unicode const aKochiMincho[] = { 0x6771, 0x98A8, 0x660E, 0x671D, 0, 0 }; +static sal_Unicode const aKochiGothic[] = { 0x6771, 0x98A8, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; +static sal_Unicode const aSunDotum[] = { 0xC36C, 0xB3CB, 0xC6C0, 0, 0 }; +static sal_Unicode const aSunGulim[] = { 0xC36C, 0xAD74, 0xB9BC, 0, 0 }; +static sal_Unicode const aSunBatang[] = { 0xC36C, 0xBC14, 0xD0D5, 0, 0 }; +static sal_Unicode const aBaekmukDotum[] = { 0xBC31, 0xBB35, 0xB3CB, 0xC6C0, 0, 0 }; +static sal_Unicode const aBaekmukGulim[] = { 0xBC31, 0xBB35, 0xAD74, 0xB9BC, 0, 0 }; +static sal_Unicode const aBaekmukBatang[] = { 0xBC31, 0xBB35, 0xBC14, 0xD0D5, 0, 0 }; +static sal_Unicode const aFzMingTi[] = { 0x65B9, 0x6B63, 0x660E, 0x9AD4, 0, 0 }; +static sal_Unicode const aFzHeiTiTW[]= { 0x65B9, 0x6B63, 0x9ED1, 0x9AD4, 0, 0 }; +static sal_Unicode const aFzKaiTiTW[]= { 0x65B9, 0x6B63, 0x6977, 0x9AD4, 0, 0 }; +static sal_Unicode const aFzHeiTiCN[]= { 0x65B9, 0x6B63, 0x9ED1, 0x4F53, 0, 0 }; +static sal_Unicode const aFzKaiTiCN[]= { 0x65B9, 0x6B63, 0x6977, 0x4F53, 0, 0 }; +static sal_Unicode const aFzSongTi[] = { 0x65B9, 0x6B63, 0x5B8B, 0x4F53, 0, 0 }; +static sal_Unicode const aHYMyeongJoExtra[] = { 'h', 'y', 0xACAC, 0xBA85, 0xC870, 0, 0 }; +static sal_Unicode const aHYSinMyeongJoMedium[] = { 'h', 'y', 0xC2E0, 0xBA85, 0xC870, 0, 0 }; +static sal_Unicode const aHYGothicMedium[] = { 'h', 'y', 0xC911, 0xACE0, 0xB515, 0, 0 }; +static sal_Unicode const aHYGraphicMedium[] = { 'h', 'y', 0xADF8, 0xB798, 0xD53D, 'm', 0, 0 }; +static sal_Unicode const aHYGraphic[] = { 'h', 'y', 0xADF8, 0xB798, 0xD53D, 0, 0 }; +static sal_Unicode const aNewGulim[] = { 0xC0C8, 0xAD74, 0xB9BC, 0, 0 }; +static sal_Unicode const aSunGungseo[] = { 0xC36C, 0xAD81, 0xC11C, 0, 0 }; +static sal_Unicode const aHYGungSoBold[] = { 'h','y', 0xAD81, 0xC11C, 'b', 0, 0 }; +static sal_Unicode const aHYGungSo[] = { 'h','y', 0xAD81, 0xC11C, 0, 0 }; +static sal_Unicode const aSunHeadLine[] = { 0xC36C, 0xD5E4, 0xB4DC, 0xB77C, 0xC778, 0, 0 }; +static sal_Unicode const aHYHeadLineMedium[] = { 'h', 'y', 0xD5E4, 0xB4DC, 0xB77C, 0xC778, 'm', 0, 0 }; +static sal_Unicode const aHYHeadLine[] = { 'h', 'y', 0xD5E4, 0xB4DC, 0xB77C, 0xC778, 0, 0 }; +static sal_Unicode const aYetR[] = { 0xD734, 0xBA3C, 0xC61B, 0xCCB4, 0, 0 }; +static sal_Unicode const aHYGothicExtra[] = { 'h', 'y', 0xACAC, 0xACE0, 0xB515, 0, 0 }; +static sal_Unicode const aSunMokPan[] = { 0xC36C, 0xBAA9, 0xD310, 0, 0 }; +static sal_Unicode const aSunYeopseo[] = { 0xC36C, 0xC5FD, 0xC11C, 0, 0 }; +static sal_Unicode const aSunBaekSong[] = { 0xC36C, 0xBC31, 0xC1A1, 0, 0 }; +static sal_Unicode const aHYPostLight[] = { 'h', 'y', 0xC5FD, 0xC11C, 'l', 0, 0 }; +static sal_Unicode const aHYPost[] = { 'h', 'y', 0xC5FD, 0xC11C, 0, 0 }; +static sal_Unicode const aMagicR[] = { 0xD734, 0xBA3C, 0xB9E4, 0xC9C1, 0xCCB4, 0, 0 }; +static sal_Unicode const aSunCrystal[] = { 0xC36C, 0xD06C, 0xB9AC, 0xC2A4, 0xD0C8, 0, 0 }; +static sal_Unicode const aSunSaemmul[] = { 0xC36C, 0xC0D8, 0xBB3C, 0, 0 }; +static sal_Unicode const aHaansoftBatang[] = { 0xD55C, 0xCEF4, 0xBC14, 0xD0D5, 0, 0 }; +static sal_Unicode const aHaansoftDotum[] = { 0xD55C, 0xCEF4, 0xB3CB, 0xC6C0, 0, 0 }; +static sal_Unicode const aHyhaeseo[] = { 0xD55C, 0xC591, 0xD574, 0xC11C, 0, 0 }; +static sal_Unicode const aMDSol[] = { 'm', 'd', 0xC194, 0xCCB4, 0, 0 }; +static sal_Unicode const aMDGaesung[] = { 'm', 'd', 0xAC1C, 0xC131, 0xCCB4, 0, 0 }; +static sal_Unicode const aMDArt[] = { 'm', 'd', 0xC544, 0xD2B8, 0xCCB4, 0, 0 }; +static sal_Unicode const aMDAlong[] = { 'm', 'd', 0xC544, 0xB871, 0xCCB4, 0, 0 }; +static sal_Unicode const aMDEasop[] = { 'm', 'd', 0xC774, 0xC19D, 0xCCB4, 0, 0 }; +static sal_Unicode const aHYShortSamulMedium[] = { 'h', 'y', 0xC595, 0xC740, 0xC0D8, 0xBB3C, 'm', 0 }; +static sal_Unicode const aHYShortSamul[] = { 'h', 'y', 0xC595, 0xC740, 0xC0D8, 0xBB3C, 0 }; +static sal_Unicode const aHGGothicE[] = { 'h','g', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'e', 0 }; +static sal_Unicode const aHGPGothicE[] = { 'h','g','p', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'e', 0 }; +static sal_Unicode const aHGSGothicE[] = { 'h','g','s', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'e', 0 }; +static sal_Unicode const aHGGothicM[] = { 'h','g', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'm', 0 }; +static sal_Unicode const aHGPGothicM[] = { 'h','g','p', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'm', 0 }; +static sal_Unicode const aHGSGothicM[] = { 'h','g','s', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'm', 0 }; +static sal_Unicode const aHGGyoshotai[] = { 'h','g', 0x884C, 0x66F8, 0x4F53, 0 }; +static sal_Unicode const aHGPGyoshotai[] = { 'h','g','p', 0x884C, 0x66F8, 0x4F53, 0 }; +static sal_Unicode const aHGSGyoshotai[] = { 'h','g','s', 0x884C, 0x66F8, 0x4F53, 0 }; +static sal_Unicode const aHGKyokashotai[] = { 'h','g', 0x6559, 0x79D1, 0x66F8, 0x4F53, 0 }; +static sal_Unicode const aHGPKyokashotai[] = { 'h','g','p', 0x6559, 0x79D1, 0x66F8, 0x4F53, 0 }; +static sal_Unicode const aHGSKyokashotai[] = { 'h','g','s', 0x6559, 0x79D1, 0x66F8, 0x4F53, 0 }; +static sal_Unicode const aHGMinchoB[] = { 'h','g', 0x660E, 0x671D, 'b', 0 }; +static sal_Unicode const aHGPMinchoB[] = { 'h','g','p', 0x660E, 0x671D, 'b', 0 }; +static sal_Unicode const aHGSMinchoB[] = { 'h','g','s', 0x660E, 0x671D, 'b', 0 }; +static sal_Unicode const aHGMinchoE[] = { 'h','g', 0x660E, 0x671D, 'e', 0 }; +static sal_Unicode const aHGPMinchoE[] = { 'h','g','p', 0x660E, 0x671D, 'e', 0 }; +static sal_Unicode const aHGSMinchoE[] = { 'h','g','s', 0x660E, 0x671D, 'e', 0 }; +static sal_Unicode const aHGSoeiKakupoptai[] = { 'h','g', 0x5275,0x82F1,0x89D2,0xFF8E, + 0xFF9F,0xFF6F,0xFF8C,0xFF9F,0x4F53,0}; +static sal_Unicode const aHGPSoeiKakupoptai[] = { 'h','g', 'p', 0x5275,0x82F1,0x89D2,0xFF8E, + 0xFF9F,0xFF6F,0xFF8C,0xFF9F,0x4F53,0}; +static sal_Unicode const aHGSSoeiKakupoptai[] = { 'h','g', 's', 0x5275,0x82F1,0x89D2,0xFF8E, + 0xFF9F,0xFF6F,0xFF8C,0xFF9F,0x4F53,0}; +static sal_Unicode const aHGSoeiPresenceEB[] = { 'h','g', 0x5275,0x82F1,0xFF8C,0xFF9F, + 0xFF9A,0xFF7E,0xFF9E,0xFF9D,0xFF7D, 'e','b',0}; +static sal_Unicode const aHGPSoeiPresenceEB[] = { 'h','g','p', 0x5275,0x82F1,0xFF8C,0xFF9F, + 0xFF9A,0xFF7E,0xFF9E,0xFF9D,0xFF7D, 'e','b',0}; +static sal_Unicode const aHGSSoeiPresenceEB[] = { 'h','g','s', 0x5275,0x82F1,0xFF8C,0xFF9F, + 0xFF9A,0xFF7E,0xFF9E,0xFF9D,0xFF7D, 'e','b',0}; +static sal_Unicode const aHGSoeiKakugothicUB[] = { 'h','g', 0x5275,0x82F1,0x89D2,0xFF7A, + 0xFF9E,0xFF7C,0xFF6F,0xFF78,'u','b',0}; +static sal_Unicode const aHGPSoeiKakugothicUB[] = { 'h','g','p', 0x5275,0x82F1,0x89D2,0xFF7A, + 0xFF9E,0xFF7C,0xFF6F,0xFF78,'u','b',0}; +static sal_Unicode const aHGSSoeiKakugothicUB[] = { 'h','g','s', 0x5275,0x82F1,0x89D2,0xFF7A, + 0xFF9E,0xFF7C,0xFF6F,0xFF78,'u','b',0}; +static sal_Unicode const aHGSeikaishotaiPRO[] = { 'h','g', 0x6B63,0x6977,0x66F8,0x4F53, '-','p','r','o',0}; +static sal_Unicode const aHGMaruGothicMPRO[] = { 'h','g', 0x4E38,0xFF7A,0xFF9E,0xFF7C,0xFF6F,0xFF78, '-','p','r','o',0}; +static sal_Unicode const aHiraginoMinchoPro[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x660E, 0x671D, 'p','r','o',0}; +static sal_Unicode const aHiraginoMinchoProN[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x660E, 0x671D, 'p','r','o','n',0}; +static sal_Unicode const aHiraginoKakuGothicPro[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x89D2, 0x30B4, 'p','r','o',0}; +static sal_Unicode const aHiraginoKakuGothicProN[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x89D2, 0x30B4, 'p','r','o','n',0}; +static sal_Unicode const aHiraginoMaruGothicPro[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o',0}; +static sal_Unicode const aHiraginoMaruGothicProN[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o','n',0}; + + +static ImplLocalizedFontName aImplLocalizedNamesList[] = +{ +{ "batang", aBatang }, +{ "batangche", aBatangChe }, +{ "gungshu", aGungsuh }, +{ "gungshuche", aGungsuhChe }, +{ "gulim", aGulim }, +{ "gulimche", aGulimChe }, +{ "dotum", aDotum }, +{ "dotumche", aDotumChe }, +{ "simsun", aSimSun }, +{ "nsimsun", aNSimSun }, +{ "simhei", aSimHei }, +{ "simkai", aSimKai }, +{ "zycjksun", azycjkSun }, +{ "zycjkhei", azycjkHei }, +{ "zycjkkai", azycjkKai }, +{ "fzhei", aFZHei }, +{ "fzkai", aFZKai }, +{ "fzsong", aFZSongYI }, +{ "fzshusong", aFZShuSong }, +{ "fzfangsong", aFZFangSong }, +{ "mhei", aMHei }, +{ "mkai", aMKai }, +{ "msong", aMSong }, +{ "cfangsong", aCFangSong }, +{ "mingliu", aMingLiU }, +{ "pmingliu", aPMingLiU }, +{ "hei", aHei }, +{ "kai", aKai }, +{ "ming", aMing }, +{ "msgothic", aMSGothic }, +{ "mspgothic", aMSPGothic }, +{ "msmincho", aMSMincho }, +{ "mspmincho", aMSPMincho }, +{ "meiryo", aMeiryo }, +{ "hgminchol", aHGMinchoL }, +{ "hggothicb", aHGGothicB }, +{ "hgpminchol", aHGPMinchoL }, +{ "hgpgothicb", aHGPGothicB }, +{ "hgmincholsun", aHGMinchoLSun }, +{ "hggothicbsun", aHGGothicBSun }, +{ "hgpmincholsun", aHGPMinchoLSun }, +{ "hgpgothicbsun", aHGPGothicBSun }, +{ "hgheiseimin", aHGHeiseiMin }, +{ "ipamincho", aIPAMincho }, +{ "ipapmincho", aIPAPMincho }, +{ "ipagothic", aIPAGothic }, +{ "ipapgothic", aIPAPGothic }, +{ "ipauigothic", aIPAUIGothic }, +{ "sazanamimincho", aSazanamiMincho }, +{ "sazanamigothic", aSazanamiGothic }, +{ "kochimincho", aKochiMincho }, +{ "kochigothic", aKochiGothic }, +{ "sundotum", aSunDotum }, +{ "sungulim", aSunGulim }, +{ "sunbatang", aSunBatang }, +{ "baekmukdotum", aBaekmukDotum }, +{ "baekmukgulim", aBaekmukGulim }, +{ "baekmukbatang", aBaekmukBatang }, +{ "fzheiti", aFzHeiTiCN }, +{ "fzheiti", aFzHeiTiTW }, +{ "fzkaiti", aFzKaiTiCN }, +{ "fzkaitib", aFzKaiTiTW }, +{ "fzmingtib", aFzMingTi }, +{ "fzsongti", aFzSongTi }, +{ "hymyeongjoextra", aHYMyeongJoExtra }, +{ "hysinmyeongjomedium", aHYSinMyeongJoMedium }, +{ "hygothicmedium", aHYGothicMedium }, +{ "hygraphicmedium", aHYGraphicMedium }, +{ "hygraphic", aHYGraphic }, +{ "newgulim", aNewGulim }, +{ "sungungseo", aSunGungseo }, +{ "hygungsobold", aHYGungSoBold }, +{ "hygungso", aHYGungSo }, +{ "sunheadline", aSunHeadLine }, +{ "hyheadlinemedium", aHYHeadLineMedium }, +{ "hyheadline", aHYHeadLine }, +{ "yetr", aYetR }, +{ "hygothicextra", aHYGothicExtra }, +{ "sunmokpan", aSunMokPan }, +{ "sunyeopseo", aSunYeopseo }, +{ "sunbaeksong", aSunBaekSong }, +{ "hypostlight", aHYPostLight }, +{ "hypost", aHYPost }, +{ "magicr", aMagicR }, +{ "suncrystal", aSunCrystal }, +{ "sunsaemmul", aSunSaemmul }, +{ "hyshortsamulmedium", aHYShortSamulMedium }, +{ "hyshortsamul", aHYShortSamul }, +{ "haansoftbatang", aHaansoftBatang }, +{ "haansoftdotum", aHaansoftDotum }, +{ "hyhaeseo", aHyhaeseo }, +{ "mdsol", aMDSol }, +{ "mdgaesung", aMDGaesung }, +{ "mdart", aMDArt }, +{ "mdalong", aMDAlong }, +{ "mdeasop", aMDEasop }, +{ "hggothice", aHGGothicE }, +{ "hgpgothice", aHGPGothicE }, +{ "hgpothice", aHGSGothicE }, +{ "hggothicm", aHGGothicM }, +{ "hgpgothicm", aHGPGothicM }, +{ "hgpgothicm", aHGSGothicM }, +{ "hggyoshotai", aHGGyoshotai }, +{ "hgpgyoshotai", aHGPGyoshotai }, +{ "hgsgyoshotai", aHGSGyoshotai }, +{ "hgkyokashotai", aHGKyokashotai }, +{ "hgpkyokashotai", aHGPKyokashotai }, +{ "hgskyokashotai", aHGSKyokashotai }, +{ "hgminchob", aHGMinchoB }, +{ "hgpminchob", aHGPMinchoB }, +{ "hgsminchob", aHGSMinchoB }, +{ "hgminchoe", aHGMinchoE }, +{ "hgpminchoe", aHGPMinchoE }, +{ "hgsminchoe", aHGSMinchoE }, +{ "hgsoeikakupoptai", aHGSoeiKakupoptai }, +{ "hgpsoeikakupopta", aHGPSoeiKakupoptai }, +{ "hgssoeikakupopta", aHGSSoeiKakupoptai }, +{ "hgsoeipresenceeb", aHGSoeiPresenceEB }, +{ "hgpsoeipresenceeb", aHGPSoeiPresenceEB }, +{ "hgssoeipresenceeb", aHGSSoeiPresenceEB }, +{ "hgsoeikakugothicub", aHGSoeiKakugothicUB }, +{ "hgpsoeikakugothicub", aHGPSoeiKakugothicUB }, +{ "hgssoeikakugothicub", aHGSSoeiKakugothicUB }, +{ "hgseikaishotaipro", aHGSeikaishotaiPRO }, +{ "hgmarugothicmpro", aHGMaruGothicMPRO }, +{ "hiraginominchopro", aHiraginoMinchoPro }, +{ "hiraginominchopron", aHiraginoMinchoProN }, +{ "hiraginokakugothicpro", aHiraginoKakuGothicPro }, +{ "hiraginokakugothicpron", aHiraginoKakuGothicProN }, +{ "hiraginomarugothicpro", aHiraginoMaruGothicPro }, +{ "hiraginomarugothicpron", aHiraginoMaruGothicProN }, +{ NULL, NULL }, +}; + +// ----------------------------------------------------------------------- + +void GetEnglishSearchFontName( String& rName ) +{ + bool bNeedTranslation = false; + xub_StrLen nLen = rName.Len(); + + // Remove trailing whitespaces + xub_StrLen i = nLen; + while ( i && (rName.GetChar( i-1 ) < 32) ) + i--; + if ( i != nLen ) + rName.Erase( i ); + + // Remove Script at the end + // Scriptname must be the last part of the fontname and + // looks like "fontname (scriptname)". So there can only be a + // script name at the and of the fontname, when the last char is ')' + if ( (nLen >= 3) && rName.GetChar( nLen-1 ) == ')' ) + { + int nOpen = 1; + xub_StrLen nTempLen = nLen-2; + while ( nTempLen ) + { + if ( rName.GetChar( nTempLen ) == '(' ) + { + nOpen--; + if ( !nOpen ) + { + // Remove Space at the end + if ( nTempLen && (rName.GetChar( nTempLen-1 ) == ' ') ) + nTempLen--; + rName.Erase( nTempLen ); + nLen = nTempLen; + break; + } + } + if ( rName.GetChar( nTempLen ) == ')' ) + nOpen++; + nTempLen--; + } + } + + // remove all whitespaces and converts to lower case ASCII + // TODO: better transliteration to ASCII e.g. all digits + i = 0; + while ( i < nLen ) + { + sal_Unicode c = rName.GetChar( i ); + if ( c > 127 ) + { + // Translate to Lowercase-ASCII + // FullWidth-ASCII to half ASCII + if ( (c >= 0xFF00) && (c <= 0xFF5E) ) + { + c -= 0xFF00-0x0020; + // Upper to Lower + if ( (c >= 'A') && (c <= 'Z') ) + c += 'a' - 'A'; + rName.SetChar( i, c ); + } + else + { + // Only Fontnames with None-Ascii-Characters must be translated + bNeedTranslation = true; + } + } + // not lowercase Ascii + else if ( !((c >= 'a') && (c <= 'z')) ) + { + // To Lowercase-Ascii + if ( (c >= 'A') && (c <= 'Z') ) + { + c += 'a' - 'A'; + rName.SetChar( i, c ); + } + else if( ((c < '0') || (c > '9')) && (c != ';') ) // not 0-9 or semicolon + { + // Remove white spaces and special characters + rName.Erase( i, 1 ); + nLen--; + continue; + } + } + + i++; + } + + // translate normalized localized name to its normalized English ASCII name + if( bNeedTranslation ) + { + typedef std::hash_map FontNameDictionary; + static FontNameDictionary aDictionary( sizeof(aImplLocalizedNamesList) / sizeof(*aImplLocalizedNamesList) ); + // the font name dictionary needs to be intialized once + if( aDictionary.empty() ) + { + // TODO: check if all dictionary entries are already normalized? + const ImplLocalizedFontName* pList = aImplLocalizedNamesList; + for(; pList->mpEnglishName; ++pList ) + aDictionary[ pList->mpLocalizedNames ] = pList->mpEnglishName; + } + + FontNameDictionary::const_iterator it = aDictionary.find( rName ); + if( it != aDictionary.end() ) + rName.AssignAscii( it->second ); + } +} + +// ----------------------------------------------------------------------- + +String GetNextFontToken( const String& rTokenStr, xub_StrLen& rIndex ) +{ + // check for valid start index + int nStringLen = rTokenStr.Len(); + if( rIndex >= nStringLen ) + { + rIndex = STRING_NOTFOUND; + return String(); + } + + // find the next token delimiter and return the token substring + const sal_Unicode* pStr = rTokenStr.GetBuffer() + rIndex; + const sal_Unicode* pEnd = rTokenStr.GetBuffer() + nStringLen; + for(; pStr < pEnd; ++pStr ) + if( (*pStr == ';') || (*pStr == ',') ) + break; + + xub_StrLen nTokenStart = rIndex; + xub_StrLen nTokenLen; + if( pStr < pEnd ) + { + rIndex = sal::static_int_cast(pStr - rTokenStr.GetBuffer()); + nTokenLen = rIndex - nTokenStart; + ++rIndex; // skip over token separator + } + else + { + // no token delimiter found => handle last token + rIndex = STRING_NOTFOUND; + nTokenLen = STRING_LEN; + + // optimize if the token string consists of just one token + if( !nTokenStart ) + return rTokenStr; + } + + return String( rTokenStr, nTokenStart, nTokenLen ); +} + +// TODO: get rid of this in another incompatible build with SW project. +// SW's WW8 and RTF filters still use this (from fontcvt.hxx) +String GetFontToken( const String& rTokenStr, xub_StrLen nToken, xub_StrLen& rIndex ) +{ + // skip nToken Tokens + for( xub_StrLen i = 0; (i < nToken) && (rIndex != STRING_NOTFOUND); ++i ) + GetNextFontToken( rTokenStr, rIndex ); + + return GetNextFontToken( rTokenStr, rIndex ); +} + +// ======================================================================= + +static bool ImplIsFontToken( const String& rName, const String& rToken ) +{ + String aTempName; + xub_StrLen nIndex = 0; + do + { + aTempName = GetNextFontToken( rName, nIndex ); + if ( rToken == aTempName ) + return true; + } + while ( nIndex != STRING_NOTFOUND ); + + return false; +} + +// ----------------------------------------------------------------------- + +static void ImplAppendFontToken( String& rName, const String& rNewToken ) +{ + if ( rName.Len() ) + { + rName.Append( ';' ); + rName.Append( rNewToken ); + } + else + rName = rNewToken; +} + +void AddTokenFontName( String& rName, const String& rNewToken ) +{ + if ( !ImplIsFontToken( rName, rNewToken ) ) + ImplAppendFontToken( rName, rNewToken ); +} + + + +// ======================================================================= + +String GetSubsFontName( const String& rName, ULONG nFlags ) +{ + String aName; + + xub_StrLen nIndex = 0; + String aOrgName = GetNextFontToken( rName, nIndex ); + GetEnglishSearchFontName( aOrgName ); + + // #93662# do not try to replace StarSymbol with MS only font + if( nFlags == (SUBSFONT_MS|SUBSFONT_ONLYONE) + && ( aOrgName.EqualsAscii( "starsymbol" ) + || aOrgName.EqualsAscii( "opensymbol" ) ) ) + return aName; + + const utl::FontNameAttr* pAttr = utl::FontSubstConfiguration::get()->getSubstInfo( aOrgName ); + if ( pAttr ) + { + for( int i = 0; i < 3; i++ ) + { + const ::std::vector< String >* pVector = NULL; + switch( i ) + { + case 0: + if( nFlags & SUBSFONT_MS && pAttr->MSSubstitutions.size() ) + pVector = &pAttr->MSSubstitutions; + break; + case 1: + if( nFlags & SUBSFONT_PS && pAttr->PSSubstitutions.size() ) + pVector = &pAttr->PSSubstitutions; + break; + case 2: + if( nFlags & SUBSFONT_HTML && pAttr->HTMLSubstitutions.size() ) + pVector = &pAttr->HTMLSubstitutions; + break; + } + if( ! pVector ) + continue; + for( ::std::vector< String >::const_iterator it = pVector->begin(); it != pVector->end(); ++it ) + if( ! ImplIsFontToken( rName, *it ) ) + { + ImplAppendFontToken( aName, *it ); + if( nFlags & SUBSFONT_ONLYONE ) + { + i = 4; + break; + } + } + } + } + + return aName; +} + +// ----------------------------------------------------------------------- + +// TODO: use a more generic String hash +int FontNameHash::operator()( const String& rStr ) const +{ + // this simple hash just has to be good enough for font names + int nHash = 0; + const int nLen = rStr.Len(); + const sal_Unicode* p = rStr.GetBuffer(); + switch( nLen ) + { + default: nHash = (p[0]<<16) - (p[1]<<8) + p[2]; + nHash += nLen; + p += nLen - 3; + // fall through + case 3: nHash += (p[2]<<16); // fall through + case 2: nHash += (p[1]<<8); // fall through + case 1: nHash += p[0]; // fall through + case 0: break; + }; + + return nHash; +} + diff --git a/unotools/source/misc/makefile.mk b/unotools/source/misc/makefile.mk index 4d9f7f40746b..d588a216c159 100644 --- a/unotools/source/misc/makefile.mk +++ b/unotools/source/misc/makefile.mk @@ -47,6 +47,8 @@ SLOFILES= $(SLO)$/atom.obj \ $(SLO)$/datetime.obj \ $(SLO)$/syslocale.obj \ $(SLO)$/eventlisteneradapter.obj \ + $(SLO)$/fontcvt.obj \ + $(SLO)$/fontdefs.obj \ $(SLO)$/desktopterminationobserver.obj \ $(SLO)$/sharedunocomponent.obj \ $(SLO)$/componentresmodule.obj diff --git a/vcl/inc/vcl/fontcfg.hxx b/vcl/inc/vcl/fontcfg.hxx deleted file mode 100644 index 76864f0cb40a..000000000000 --- a/vcl/inc/vcl/fontcfg.hxx +++ /dev/null @@ -1,232 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: fontcfg.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _VCL_FONTCFG_HXX -#define _VCL_FONTCFG_HXX - -#include "dllapi.h" -#include -#ifndef _VCL_ENUM_HXX -#include -#endif -#include -#include -#include - -#include -#include -#include - -namespace com { -namespace sun { -namespace star { -namespace lang { - -// equality operator needed for hash_map; -// (-> why does this need to be in the namespace of Locale ? g++ fails to compile else) -inline bool operator==( const com::sun::star::lang::Locale& rLeft, const com::sun::star::lang::Locale& rRight ) -{ - return - rLeft.Language.equals( rRight.Language ) && - rLeft.Country.equals( rRight.Country ) && - rLeft.Variant.equals( rRight.Variant ) - ; -} -}}}} - -namespace vcl -{ - -struct LocaleHash -{ - size_t operator()( const com::sun::star::lang::Locale& rLocale ) const - { - return - (size_t)rLocale.Language.hashCode() ^ - (size_t)rLocale.Country.hashCode() ^ - (size_t)rLocale.Variant.hashCode(); - } -}; - -class DefaultFontConfiguration -{ - com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > - m_xConfigProvider; - com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > - m_xConfigAccess; - - struct LocaleAccess - { - // the real string used in the configuration - // used to get rid of upper/lower case problems - rtl::OUString aConfigLocaleString; - // xAccess is mutable to be able to be filled on demand - mutable com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xAccess; - }; - - std::hash_map< com::sun::star::lang::Locale, - LocaleAccess, - vcl::LocaleHash > - m_aConfig; - - rtl::OUString tryLocale( const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rType ) const; - - DefaultFontConfiguration(); - public: - ~DefaultFontConfiguration(); - - static DefaultFontConfiguration* get(); - - rtl::OUString getDefaultFont( const com::sun::star::lang::Locale& rLocale, int nType ) const; - rtl::OUString getUserInterfaceFont( const com::sun::star::lang::Locale& rLocale ) const; -}; - -// IMPL_FONT_ATTR_DEFAULT - Default-Font like Andale Sans UI, Palace Script, Albany, Thorndale, Cumberland, ... -// IMPL_FONT_ATTR_STANDARD - Standard-Font like Arial, Times, Courier, ... -// IMPL_FONT_ATTR_NORMAL - normal Font for writing text like Arial, Verdana, Arial Narrow, Trebuchet, Times, Courier, ... -// IMPL_FONT_ATTR_SYMBOL - Font with symbols -// IMPL_FONT_ATTR_DECORATIVE - Readable and normally used for drawings -// IMPL_FONT_ATTR_SPECIAL - very special design -// IMPL_FONT_ATTR_TITLING - only uppercase characters -// IMPL_FONT_ATTR_FULL - Font with normally all characters -// IMPL_FONT_ATTR_CAPITALS - only uppercase characters, but lowercase characters smaller as the uppercase characters -// IMPL_FONT_ATTR_TYPEWRITER - like a typewriter: Courier, ... -// IMPL_FONT_ATTR_SCRIPT - Handwriting or Script -// IMPL_FONT_ATTR_HANDWRITING - More Handwriting with normal letters -// IMPL_FONT_ATTR_CHANCERY - Like Zapf Chancery -// IMPL_FONT_ATTR_COMIC - Like Comic Sans MS -// IMPL_FONT_ATTR_BRUSHSCRIPT - More Script -// IMPL_FONT_ATTR_OTHERSTYLE - OldStyle, ... so negativ points -#define IMPL_FONT_ATTR_DEFAULT ((ULONG)0x00000001) -#define IMPL_FONT_ATTR_STANDARD ((ULONG)0x00000002) -#define IMPL_FONT_ATTR_NORMAL ((ULONG)0x00000004) -#define IMPL_FONT_ATTR_SYMBOL ((ULONG)0x00000008) -#define IMPL_FONT_ATTR_FIXED ((ULONG)0x00000010) -#define IMPL_FONT_ATTR_SANSSERIF ((ULONG)0x00000020) -#define IMPL_FONT_ATTR_SERIF ((ULONG)0x00000040) -#define IMPL_FONT_ATTR_DECORATIVE ((ULONG)0x00000080) -#define IMPL_FONT_ATTR_SPECIAL ((ULONG)0x00000100) -#define IMPL_FONT_ATTR_ITALIC ((ULONG)0x00000200) -#define IMPL_FONT_ATTR_TITLING ((ULONG)0x00000400) -#define IMPL_FONT_ATTR_CAPITALS ((ULONG)0x00000800) -#define IMPL_FONT_ATTR_CJK ((ULONG)0x00001000) -#define IMPL_FONT_ATTR_CJK_JP ((ULONG)0x00002000) -#define IMPL_FONT_ATTR_CJK_SC ((ULONG)0x00004000) -#define IMPL_FONT_ATTR_CJK_TC ((ULONG)0x00008000) -#define IMPL_FONT_ATTR_CJK_KR ((ULONG)0x00010000) -#define IMPL_FONT_ATTR_CTL ((ULONG)0x00020000) -#define IMPL_FONT_ATTR_NONELATIN ((ULONG)0x00040000) -#define IMPL_FONT_ATTR_FULL ((ULONG)0x00080000) -#define IMPL_FONT_ATTR_OUTLINE ((ULONG)0x00100000) -#define IMPL_FONT_ATTR_SHADOW ((ULONG)0x00200000) -#define IMPL_FONT_ATTR_ROUNDED ((ULONG)0x00400000) -#define IMPL_FONT_ATTR_TYPEWRITER ((ULONG)0x00800000) -#define IMPL_FONT_ATTR_SCRIPT ((ULONG)0x01000000) -#define IMPL_FONT_ATTR_HANDWRITING ((ULONG)0x02000000) -#define IMPL_FONT_ATTR_CHANCERY ((ULONG)0x04000000) -#define IMPL_FONT_ATTR_COMIC ((ULONG)0x08000000) -#define IMPL_FONT_ATTR_BRUSHSCRIPT ((ULONG)0x10000000) -#define IMPL_FONT_ATTR_GOTHIC ((ULONG)0x20000000) -#define IMPL_FONT_ATTR_SCHOOLBOOK ((ULONG)0x40000000) -#define IMPL_FONT_ATTR_OTHERSTYLE ((ULONG)0x80000000) - -#define IMPL_FONT_ATTR_CJK_ALLLANG (IMPL_FONT_ATTR_CJK_JP | IMPL_FONT_ATTR_CJK_SC | IMPL_FONT_ATTR_CJK_TC | IMPL_FONT_ATTR_CJK_KR) -#define IMPL_FONT_ATTR_ALLSCRIPT (IMPL_FONT_ATTR_SCRIPT | IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_COMIC | IMPL_FONT_ATTR_BRUSHSCRIPT) -#define IMPL_FONT_ATTR_ALLSUBSCRIPT (IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_COMIC | IMPL_FONT_ATTR_BRUSHSCRIPT) -#define IMPL_FONT_ATTR_ALLSERIFSTYLE (IMPL_FONT_ATTR_ALLSCRIPT |\ - IMPL_FONT_ATTR_SANSSERIF | IMPL_FONT_ATTR_SERIF |\ - IMPL_FONT_ATTR_FIXED | IMPL_FONT_ATTR_ITALIC |\ - IMPL_FONT_ATTR_GOTHIC | IMPL_FONT_ATTR_SCHOOLBOOK |\ - IMPL_FONT_ATTR_SHADOW | IMPL_FONT_ATTR_OUTLINE) - -struct FontNameAttr -{ - String Name; - ::std::vector< String > Substitutions; - ::std::vector< String > MSSubstitutions; - ::std::vector< String > PSSubstitutions; - ::std::vector< String > HTMLSubstitutions; - FontWeight Weight; - FontWidth Width; - unsigned long Type; // bitfield of IMPL_FONT_ATTR_* -}; - -class VCL_DLLPUBLIC FontSubstConfiguration -{ -private: - com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > - m_xConfigProvider; - com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > - m_xConfigAccess; - struct LocaleSubst - { - rtl::OUString aConfigLocaleString; - mutable bool bConfigRead; - // note: aSubstAttributes must be sorted alphabetically by Name - // searches on the substitutes are done with Name as key, where - // a minimal match is sufficient (that is e.g. "Thorndale" will match - // "Thorndale BlaBlub"). Also names must be lower case. - mutable std::vector< FontNameAttr > aSubstAttributes; - - LocaleSubst() : bConfigRead( false ) {} - }; - std::hash_map< com::sun::star::lang::Locale, LocaleSubst, vcl::LocaleHash > m_aSubst; - typedef std::hash_set< rtl::OUString, rtl::OUStringHash > UniqueSubstHash; - mutable UniqueSubstHash maSubstHash; - - - void fillSubstVector( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xFont, - const rtl::OUString& rType, - std::vector< String >& rSubstVector ) const; - FontWeight getSubstWeight( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xFont, - const rtl::OUString& rType ) const; - FontWidth getSubstWidth( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xFont, - const rtl::OUString& rType ) const; - unsigned long getSubstType( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xFont, - const rtl::OUString& rType ) const; - void readLocaleSubst( const com::sun::star::lang::Locale& rLocale ) const; - FontSubstConfiguration(); -public: - ~FontSubstConfiguration(); - - static FontSubstConfiguration* get(); - - const FontNameAttr* getSubstInfo( - const String& rFontName, - const com::sun::star::lang::Locale& rLocale = - com::sun::star::lang::Locale( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "en" ) ), - rtl::OUString(), - rtl::OUString() ) - ) const; - static void getMapName( const String& rOrgName, String& rShortName, String& rFamilyName, FontWeight& rWeight, FontWidth& rWidth, ULONG& rType ); -}; - -} // namespace vcl - -#endif // _VCL_FONTCFG_HXX diff --git a/vcl/inc/vcl/fontcvt.hxx b/vcl/inc/vcl/fontcvt.hxx deleted file mode 100644 index 8269928dc730..000000000000 --- a/vcl/inc/vcl/fontcvt.hxx +++ /dev/null @@ -1,103 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: fontcvt.hxx,v $ - * $Revision: 1.3 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_FONTCVT_HXX -#define _SV_FONTCVT_HXX - -#include -#include - -// ------------------ -// - FontToSubsFont - -// ------------------ - -#define FONTTOSUBSFONT_IMPORT ((ULONG)0x00000001) -#define FONTTOSUBSFONT_EXPORT ((ULONG)0x00000002) -#define FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ((ULONG)0x00000004) - -typedef void* FontToSubsFontConverter; -VCL_DLLPUBLIC FontToSubsFontConverter CreateFontToSubsFontConverter( const String& rFontName, ULONG nFlags ); -VCL_DLLPUBLIC void DestroyFontToSubsFontConverter( FontToSubsFontConverter hConverter ); -VCL_DLLPUBLIC sal_Unicode ConvertFontToSubsFontChar( FontToSubsFontConverter hConverter, sal_Unicode c ); -VCL_DLLPUBLIC String GetFontToSubsFontName( FontToSubsFontConverter hConverter ); - -// ---------------- -// - SubsFontName - -// ---------------- - -#define SUBSFONT_ONLYONE ((ULONG)0x00000001) -#define SUBSFONT_MS ((ULONG)0x00000002) -#define SUBSFONT_PS ((ULONG)0x00000004) -#define SUBSFONT_HTML ((ULONG)0x00000008) -VCL_DLLPUBLIC String GetSubsFontName( const String& rName, ULONG nFlags ); - -// ----------------- -// - FontTokenName - -// ----------------- - -VCL_DLLPUBLIC String GetFontToken( const String& rName, xub_StrLen nToken, xub_StrLen& rIndex ); -inline String GetFontToken( const String& rName, xub_StrLen nToken ) -{ - xub_StrLen nTempIndex = 0; - return GetFontToken( rName, nToken, nTempIndex ); -} - -// --------------------------- -// - StarSymbolToMSMultiFont - -// --------------------------- - -class VCL_DLLPUBLIC StarSymbolToMSMultiFont -{ -public: - //Returns the name of the best windows symbol font which this char can be - //mapped to. Sets rChar to the correct position for that font. If no - //match found, then no name is returned, and rChar is unchanged. If you - //want to convert a string, you don't want to use this. - virtual String ConvertChar(sal_Unicode &rChar) = 0; - - //Starts converting the string at position rIndex. It converts as much of - //the string that can be converted to the same symbol font and returns the - //name of that font. rIndex is modified to the last index that was - //converted. Typically you call if continously until rIndex == - //rString.Len() and handle each section as seperate 8bit strings using - //seperate fonts. Will return an empty string for a continous section - //that has no possible mapping. - virtual String ConvertString(String &rString, xub_StrLen &rIndex) = 0; - virtual ~StarSymbolToMSMultiFont() {} -}; - -//with bPerfect set the converter will only try and convert symbols which have -//perfect mappings to the windows symbols fonts. With it not set, it will -//allow somewhat more dubious transformations that are nevertheless -//recognizably similiar. Even in this mode there will be characters that fail. -//The users of this might want to make a distinction between failed characters -//which were inside and those outside the unicode private area. -VCL_DLLPUBLIC StarSymbolToMSMultiFont *CreateStarSymbolToMSMultiFont(bool bPerfectOnly=false); -#endif // _SV_FONTCVT_HXX diff --git a/vcl/inc/vcl/outdev.h b/vcl/inc/vcl/outdev.h index af671e24ee0a..67dc256ce11c 100644 --- a/vcl/inc/vcl/outdev.h +++ b/vcl/inc/vcl/outdev.h @@ -31,7 +31,7 @@ #ifndef _SV_OUTDEV_H #define _SV_OUTDEV_H -#include +#include #include #include @@ -44,13 +44,6 @@ class VirtualDevice; class ImplServerGraphics; class ImplGetDevFontList; class GetDevSizeList; -namespace vcl { -class FontSubstConfiguration; -} - -// ----------------------------------------------------------------------- - -void ImplGetEnglishSearchFontName( String& rName ); // ----------------------- // - ImplDevFontListData - @@ -80,7 +73,7 @@ public: int GetMinQuality() const { return mnMinQuality; } bool AddFontFace( ImplFontData* ); - void InitMatchData( const vcl::FontSubstConfiguration&, + void InitMatchData( const utl::FontSubstConfiguration&, const String& rSearchName ); ImplFontData* FindBestFontFace( const ImplFontSelectData& rFSD ) const; @@ -106,24 +99,6 @@ friend class ImplDevFontList; // TODO: remove soon }; -// --------------- -// - ImplCvtChar - -// --------------- - -class ImplCvtChar -{ -public: - const sal_Unicode* mpCvtTab; - const char* mpSubsFontName; - sal_Unicode (*mpCvtFunc)( sal_Unicode ); -}; - -sal_Unicode ImplRecodeChar( const ImplCvtChar* pCvtData, sal_Unicode c ); -void ImplRecodeString( const ImplCvtChar* pCvtData, String& rStr, - xub_StrLen nIndex, xub_StrLen nLen ); -const ImplCvtChar* ImplGetRecodeData( const String& rOrgFontName, - const String& rMapFontName ); - // ---------------------- // - ImplGetDevFontList - // ---------------------- diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx index f4e42846dd5e..088936f3eb4c 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -45,6 +45,7 @@ #include #include #include +#include #include @@ -260,31 +261,6 @@ struct KerningPair #define FONT_SUBSTITUTE_ALWAYS ((USHORT)0x0001) #define FONT_SUBSTITUTE_SCREENONLY ((USHORT)0x0002) -// Default-Font -#define DEFAULTFONT_SANS_UNICODE ((USHORT)1) -#define DEFAULTFONT_SANS ((USHORT)2) -#define DEFAULTFONT_SERIF ((USHORT)3) -#define DEFAULTFONT_FIXED ((USHORT)4) -#define DEFAULTFONT_SYMBOL ((USHORT)5) -#define DEFAULTFONT_UI_SANS ((USHORT)1000) -#define DEFAULTFONT_UI_FIXED ((USHORT)1001) -#define DEFAULTFONT_LATIN_TEXT ((USHORT)2000) -#define DEFAULTFONT_LATIN_PRESENTATION ((USHORT)2001) -#define DEFAULTFONT_LATIN_SPREADSHEET ((USHORT)2002) -#define DEFAULTFONT_LATIN_HEADING ((USHORT)2003) -#define DEFAULTFONT_LATIN_DISPLAY ((USHORT)2004) -#define DEFAULTFONT_LATIN_FIXED ((USHORT)2005) -#define DEFAULTFONT_CJK_TEXT ((USHORT)3000) -#define DEFAULTFONT_CJK_PRESENTATION ((USHORT)3001) -#define DEFAULTFONT_CJK_SPREADSHEET ((USHORT)3002) -#define DEFAULTFONT_CJK_HEADING ((USHORT)3003) -#define DEFAULTFONT_CJK_DISPLAY ((USHORT)3004) -#define DEFAULTFONT_CTL_TEXT ((USHORT)4000) -#define DEFAULTFONT_CTL_PRESENTATION ((USHORT)4001) -#define DEFAULTFONT_CTL_SPREADSHEET ((USHORT)4002) -#define DEFAULTFONT_CTL_HEADING ((USHORT)4003) -#define DEFAULTFONT_CTL_DISPLAY ((USHORT)4004) - #define DEFAULTFONT_FLAGS_ONLYONE ((ULONG)0x00000001) enum OutDevType { OUTDEV_DONTKNOW, OUTDEV_WINDOW, OUTDEV_PRINTER, OUTDEV_VIRDEV }; diff --git a/vcl/inc/vcl/outfont.hxx b/vcl/inc/vcl/outfont.hxx index 88316130cc3a..b72e78994a75 100644 --- a/vcl/inc/vcl/outfont.hxx +++ b/vcl/inc/vcl/outfont.hxx @@ -32,9 +32,9 @@ #include #include #include -#include +#include #include - +#include #include #include @@ -48,14 +48,10 @@ class ImplPreMatchFontSubstitution; class ImplGlyphFallbackFontSubstitution; class ImplFontSelectData; class Font; -class ImplCvtChar; +class ConvertChar; struct FontMatchStatus; class OutputDevice; -namespace vcl { - struct FontNameAttr; -} - // ---------------------- // - ImplFontAttributes - // ---------------------- @@ -185,8 +181,6 @@ public: // TODO: change to private ImplFontEntry* mpFontEntry; // pointer to the resulting FontCache entry }; -struct FontNameHash { int operator()(const String&) const; }; - // ------------------- // - ImplDevFontList - // ------------------- @@ -238,7 +232,7 @@ protected: ImplDevFontListData* ImplFindByTokenNames( const String& ) const; ImplDevFontListData* ImplFindByAliasName( const String& rSearchName, const String& rShortName ) const; - ImplDevFontListData* ImplFindBySubstFontAttr( const vcl::FontNameAttr& ) const; + ImplDevFontListData* ImplFindBySubstFontAttr( const utl::FontNameAttr& ) const; ImplDevFontListData* ImplFindByAttributes( ULONG nSearchType, FontWeight, FontWidth, FontFamily, FontItalic, const String& rSearchFamily ) const; ImplDevFontListData* FindDefaultFont() const; @@ -337,7 +331,7 @@ public: public: // TODO: make data members private ImplFontSelectData maFontSelData; // FontSelectionData ImplFontMetricData maMetric; // Font Metric - const ImplCvtChar* mpConversion; // used e.g. for StarBats->StarSymbol + const ConvertChar* mpConversion; // used e.g. for StarBats->StarSymbol long mnLineHeight; ULONG mnRefCount; USHORT mnSetFontFlags; // Flags returned by SalGraphics::SetFont() diff --git a/vcl/inc/vcl/svdata.hxx b/vcl/inc/vcl/svdata.hxx index 2ca7c2818a5e..12c595350472 100644 --- a/vcl/inc/vcl/svdata.hxx +++ b/vcl/inc/vcl/svdata.hxx @@ -114,7 +114,8 @@ class DockingManager; namespace vos { class OMutex; } namespace vos { class OCondition; } -namespace vcl { class DisplayConnection; class FontSubstConfiguration; class SettingsConfigItem; class DefaultFontConfiguration; class DeleteOnDeinitBase; } +namespace vcl { class DisplayConnection; class SettingsConfigItem; class DeleteOnDeinitBase; } +namespace utl { class DefaultFontConfiguration; class FontSubstConfiguration; } // ----------------- // - ImplSVAppData - @@ -203,8 +204,8 @@ struct ImplSVGDIData long mnAppFontX; // AppFont X-Numenator for 40/tel Width + DialogScaleX long mnAppFontY; // AppFont Y-Numenator for 80/tel Height BOOL mbFontSubChanged; // TRUE: FontSubstitution wurde zwischen Begin/End geaendert - vcl::DefaultFontConfiguration* mpDefaultFontConfiguration; - vcl::FontSubstConfiguration* mpFontSubstConfiguration; + utl::DefaultFontConfiguration* mpDefaultFontConfiguration; + utl::FontSubstConfiguration* mpFontSubstConfiguration; bool mbPrinterPullModel; // true: use pull model instead of normal push model when printing bool mbNativeFontConfig; // true: do not override UI font bool mbNoXORClipping; // true: do not use XOR to achieve clipping effects diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index ae142c170b53..9ecbef93656c 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -37,7 +37,7 @@ #include "vcl/event.hxx" #include "vcl/settings.hxx" #include "vcl/i18nhelp.hxx" -#include "vcl/fontcfg.hxx" +#include "unotools/fontcfg.hxx" #include "vcl/configsettings.hxx" #include "vcl/gradient.hxx" #include "vcl/unohelp.hxx" @@ -549,7 +549,7 @@ void ImplStyleData::SetStandardStyles() Font aStdFont( FAMILY_SWISS, Size( 0, 8 ) ); aStdFont.SetCharSet( gsl_getSystemTextEncoding() ); aStdFont.SetWeight( WEIGHT_NORMAL ); - aStdFont.SetName( vcl::DefaultFontConfiguration::get()->getUserInterfaceFont(com::sun::star::lang::Locale( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), rtl::OUString(), rtl::OUString() ) ) ); + aStdFont.SetName( utl::DefaultFontConfiguration::get()->getUserInterfaceFont(com::sun::star::lang::Locale( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), rtl::OUString(), rtl::OUString() ) ) ); maAppFont = aStdFont; maHelpFont = aStdFont; maMenuFont = aStdFont; diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index b40777eb2e01..6a61d15db4c0 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index d8b1e8a833a2..310c01a40673 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -80,7 +80,7 @@ #include "com/sun/star/lang/XComponent.hpp" #include "rtl/logfile.hxx" #include -#include "vcl/fontcfg.hxx" +#include "unotools/fontcfg.hxx" #include "vcl/configsettings.hxx" #include "vcl/lazydelete.hxx" diff --git a/vcl/source/gdi/configsettings.cxx b/vcl/source/gdi/configsettings.cxx new file mode 100644 index 000000000000..b601caef301a --- /dev/null +++ b/vcl/source/gdi/configsettings.cxx @@ -0,0 +1,205 @@ +/************************************************************************* + * + * 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 + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_vcl.hxx" + +#include +#include +#include +#include +#include + +using namespace rtl; +using namespace utl; +using namespace vcl; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::container; + +#define SETTINGS_CONFIGNODE "VCL/Settings" + +/* + * SettingsConfigItem::get + */ + +SettingsConfigItem* SettingsConfigItem::get() +{ + ImplSVData* pSVData = ImplGetSVData(); + if( ! pSVData->mpSettingsConfigItem ) + pSVData->mpSettingsConfigItem = new SettingsConfigItem(); + return pSVData->mpSettingsConfigItem; +} + +/* + * SettignsConfigItem constructor + */ + +SettingsConfigItem::SettingsConfigItem() + : + ConfigItem( OUString( RTL_CONSTASCII_USTRINGPARAM( SETTINGS_CONFIGNODE ) ), + CONFIG_MODE_DELAYED_UPDATE ), + m_aSettings( 0 ) +{ + getValues(); +} + +/* + * SettingsConfigItem destructor + */ + +SettingsConfigItem::~SettingsConfigItem() +{ + if( IsModified() ) + Commit(); +} + +/* + * SettingsConfigItem::Commit + */ + +void SettingsConfigItem::Commit() +{ + if( ! IsValidConfigMgr() ) + return; + + std::hash_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group; + + for( group = m_aSettings.begin(); group != m_aSettings.end(); ++group ) + { + String aKeyName( group->first ); + /*sal_Bool bAdded =*/ AddNode( OUString(), aKeyName ); + Sequence< PropertyValue > aValues( group->second.size() ); + PropertyValue* pValues = aValues.getArray(); + int nIndex = 0; + SmallOUStrMap::const_iterator it; + for( it = group->second.begin(); it != group->second.end(); ++it ) + { + String aName( aKeyName ); + aName.Append( '/' ); + aName.Append( String( it->first ) ); + pValues[nIndex].Name = aName; + pValues[nIndex].Handle = 0; + pValues[nIndex].Value <<= it->second; + pValues[nIndex].State = PropertyState_DIRECT_VALUE; + nIndex++; + } + ReplaceSetProperties( aKeyName, aValues ); + } +} + +/* + * SettingsConfigItem::Notify + */ + +void SettingsConfigItem::Notify( const Sequence< OUString >& ) +{ + getValues(); +} + +/* + * SettingsConfigItem::getValues + */ +void SettingsConfigItem::getValues() +{ + if( ! IsValidConfigMgr() ) + return; + + m_aSettings.clear(); + + Sequence< OUString > aNames( GetNodeNames( OUString() ) ); + m_aSettings.resize( aNames.getLength() ); + + for( int j = 0; j < aNames.getLength(); j++ ) + { +#if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, "found settings data for \"%s\"\n", + OUStringToOString( aNames.getConstArray()[j], RTL_TEXTENCODING_ASCII_US ).getStr() + ); +#endif + String aKeyName( aNames.getConstArray()[j] ); + Sequence< OUString > aKeys( GetNodeNames( aKeyName ) ); + Sequence< OUString > aSettingsKeys( aKeys.getLength() ); + const OUString* pFrom = aKeys.getConstArray(); + OUString* pTo = aSettingsKeys.getArray(); + for( int m = 0; m < aKeys.getLength(); m++ ) + { + String aName( aKeyName ); + aName.Append( '/' ); + aName.Append( String( pFrom[m] ) ); + pTo[m] = aName; + } + Sequence< Any > aValues( GetProperties( aSettingsKeys ) ); + const Any* pValue = aValues.getConstArray(); + for( int i = 0; i < aValues.getLength(); i++, pValue++ ) + { + if( pValue->getValueTypeClass() == TypeClass_STRING ) + { + const OUString* pLine = (const OUString*)pValue->getValue(); + if( pLine->getLength() ) + m_aSettings[ aKeyName ][ pFrom[i] ] = *pLine; +#if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, " \"%s\"=\"%.30s\"\n", + OUStringToOString( aKeys.getConstArray()[i], RTL_TEXTENCODING_ASCII_US ).getStr(), + OUStringToOString( *pLine, RTL_TEXTENCODING_ASCII_US ).getStr() + ); +#endif + } + } + } +} + +/* + * SettingsConfigItem::getDefaultFont + */ + +const OUString& SettingsConfigItem::getValue( const OUString& rGroup, const OUString& rKey ) const +{ + ::std::hash_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group = m_aSettings.find( rGroup ); + if( group == m_aSettings.end() || group->second.find( rKey ) == group->second.end() ) + { + static OUString aEmpty; + return aEmpty; + } + return group->second.find(rKey)->second; +} + +/* + * SettingsConfigItem::setDefaultFont + */ + +void SettingsConfigItem::setValue( const OUString& rGroup, const OUString& rKey, const OUString& rValue ) +{ + bool bModified = m_aSettings[ rGroup ][ rKey ] != rValue; + if( bModified ) + { + m_aSettings[ rGroup ][ rKey ] = rValue; + SetModified(); + } +} + diff --git a/vcl/source/gdi/font.cxx b/vcl/source/gdi/font.cxx index 3bbdba5dad5f..afd6181351b4 100644 --- a/vcl/source/gdi/font.cxx +++ b/vcl/source/gdi/font.cxx @@ -38,8 +38,8 @@ #include "tools/debug.hxx" #include "vcl/font.hxx" #include "vcl/impfont.hxx" -#include "vcl/fontcfg.hxx" -#include "vcl/outdev.h" // just for ImplGetEnglishSearchFontName! TODO: move it +#include "vcl/outfont.hxx" +#include "unotools/fontcfg.hxx" #include @@ -169,7 +169,7 @@ void Impl_Font::AskConfig() mbConfigLookup = true; // prepare the FontSubst configuration lookup - const vcl::FontSubstConfiguration* pFontSubst = vcl::FontSubstConfiguration::get(); + const utl::FontSubstConfiguration* pFontSubst = utl::FontSubstConfiguration::get(); String aShortName; String aFamilyName; @@ -177,12 +177,12 @@ void Impl_Font::AskConfig() FontWeight eWeight = WEIGHT_DONTKNOW; FontWidth eWidthType = WIDTH_DONTKNOW; String aMapName = maFamilyName; - ImplGetEnglishSearchFontName( aMapName ); - vcl::FontSubstConfiguration::getMapName( aMapName, + GetEnglishSearchFontName( aMapName ); + utl::FontSubstConfiguration::getMapName( aMapName, aShortName, aFamilyName, eWeight, eWidthType, nType ); // lookup the font name in the configuration - const vcl::FontNameAttr* pFontAttr = pFontSubst->getSubstInfo( aMapName ); + const utl::FontNameAttr* pFontAttr = pFontSubst->getSubstInfo( aMapName ); // if the direct lookup failed try again with an alias name if ( !pFontAttr && (aShortName != aMapName) ) diff --git a/vcl/source/gdi/fontcfg.cxx b/vcl/source/gdi/fontcfg.cxx deleted file mode 100644 index 68d3b499341d..000000000000 --- a/vcl/source/gdi/fontcfg.cxx +++ /dev/null @@ -1,1381 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: fontcfg.cxx,v $ - * $Revision: 1.49.114.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_vcl.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if OSL_DEBUG_LEVEL > 1 -#include -#endif - -#include -#include -#include - -#define DEFAULTFONT_CONFIGNODE "VCL/DefaultFonts" -#define SUBSTFONT_CONFIGNODE "VCL/FontSubstitutions" -#define SETTINGS_CONFIGNODE "VCL/Settings" - -using namespace vcl; -using namespace rtl; -using namespace utl; -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::beans; -using namespace com::sun::star::container; - - -/* - * DefaultFontConfiguration - */ - -static const char* getKeyType( int nKeyType ) -{ - switch( nKeyType ) - { - case DEFAULTFONT_CJK_DISPLAY: return "CJK_DISPLAY"; - case DEFAULTFONT_CJK_HEADING: return "CJK_HEADING"; - case DEFAULTFONT_CJK_PRESENTATION: return "CJK_PRESENTATION"; - case DEFAULTFONT_CJK_SPREADSHEET: return "CJK_SPREADSHEET"; - case DEFAULTFONT_CJK_TEXT: return "CJK_TEXT"; - case DEFAULTFONT_CTL_DISPLAY: return "CTL_DISPLAY"; - case DEFAULTFONT_CTL_HEADING: return "CTL_HEADING"; - case DEFAULTFONT_CTL_PRESENTATION: return "CTL_PRESENTATION"; - case DEFAULTFONT_CTL_SPREADSHEET: return "CTL_SPREADSHEET"; - case DEFAULTFONT_CTL_TEXT: return "CTL_TEXT"; - case DEFAULTFONT_FIXED: return "FIXED"; - case DEFAULTFONT_LATIN_DISPLAY: return "LATIN_DISPLAY"; - case DEFAULTFONT_LATIN_FIXED: return "LATIN_FIXED"; - case DEFAULTFONT_LATIN_HEADING: return "LATIN_HEADING"; - case DEFAULTFONT_LATIN_PRESENTATION: return "LATIN_PRESENTATION"; - case DEFAULTFONT_LATIN_SPREADSHEET: return "LATIN_SPREADSHEET"; - case DEFAULTFONT_LATIN_TEXT: return "LATIN_TEXT"; - case DEFAULTFONT_SANS: return "SANS"; - case DEFAULTFONT_SANS_UNICODE: return "SANS_UNICODE"; - case DEFAULTFONT_SERIF: return "SERIF"; - case DEFAULTFONT_SYMBOL: return "SYMBOL"; - case DEFAULTFONT_UI_FIXED: return "UI_FIXED"; - case DEFAULTFONT_UI_SANS: return "UI_SANS"; - default: - DBG_ERROR( "unmatched type" ); - return ""; - } -} - -DefaultFontConfiguration* DefaultFontConfiguration::get() -{ - ImplSVData* pSVData = ImplGetSVData(); - if( ! pSVData->maGDIData.mpDefaultFontConfiguration ) - pSVData->maGDIData.mpDefaultFontConfiguration = new DefaultFontConfiguration(); - return pSVData->maGDIData.mpDefaultFontConfiguration; -} - -DefaultFontConfiguration::DefaultFontConfiguration() -{ - try - { - // get service provider - Reference< XMultiServiceFactory > xSMgr( unohelper::GetMultiServiceFactory() ); - // create configuration hierachical access name - if( xSMgr.is() ) - { - try - { - m_xConfigProvider = - Reference< XMultiServiceFactory >( - xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.ConfigurationProvider" ))), - UNO_QUERY ); - if( m_xConfigProvider.is() ) - { - Sequence< Any > aArgs(1); - PropertyValue aVal; - aVal.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ); - aVal.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.VCL/DefaultFonts" ) ); - aArgs.getArray()[0] <<= aVal; - m_xConfigAccess = - Reference< XNameAccess >( - m_xConfigProvider->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.ConfigurationAccess" )), - aArgs ), - UNO_QUERY ); - if( m_xConfigAccess.is() ) - { - Sequence< OUString > aLocales = m_xConfigAccess->getElementNames(); - // fill config hash with empty interfaces - int nLocales = aLocales.getLength(); - const OUString* pLocaleStrings = aLocales.getConstArray(); - Locale aLoc; - for( int i = 0; i < nLocales; i++ ) - { - sal_Int32 nIndex = 0; - aLoc.Language = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiLowerCase(); - if( nIndex != -1 ) - aLoc.Country = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase(); - else - aLoc.Country = OUString(); - if( nIndex != -1 ) - aLoc.Variant = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase(); - else - aLoc.Variant = OUString(); - m_aConfig[ aLoc ] = LocaleAccess(); - m_aConfig[ aLoc ].aConfigLocaleString = pLocaleStrings[i]; - } - } - } - } - catch( Exception& ) - { - // configuration is awry - m_xConfigProvider.clear(); - m_xConfigAccess.clear(); - } - } - } - catch( WrappedTargetException& ) - { - } - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "config provider: %s, config access: %s\n", - m_xConfigProvider.is() ? "true" : "false", - m_xConfigAccess.is() ? "true" : "false" - ); - #endif -} - -DefaultFontConfiguration::~DefaultFontConfiguration() -{ - // release all nodes - m_aConfig.clear(); - // release top node - m_xConfigAccess.clear(); - // release config provider - m_xConfigProvider.clear(); -} - -OUString DefaultFontConfiguration::tryLocale( const Locale& rLocale, const OUString& rType ) const -{ - OUString aRet; - - std::hash_map< Locale, LocaleAccess, LocaleHash >::const_iterator it = - m_aConfig.find( rLocale ); - if( it != m_aConfig.end() ) - { - if( !it->second.xAccess.is() ) - { - try - { - Reference< XNameAccess > xNode; - if ( m_xConfigAccess->hasByName( it->second.aConfigLocaleString ) ) - { - Any aAny = m_xConfigAccess->getByName( it->second.aConfigLocaleString ); - if( aAny >>= xNode ) - it->second.xAccess = xNode; - } - } - catch( NoSuchElementException ) - { - } - catch( WrappedTargetException ) - { - } - } - if( it->second.xAccess.is() ) - { - try - { - if ( it->second.xAccess->hasByName( rType ) ) - { - Any aAny = it->second.xAccess->getByName( rType ); - aAny >>= aRet; - } - } - catch( NoSuchElementException& ) - { - } - catch( WrappedTargetException& ) - { - } - } - } - - return aRet; -} - -OUString DefaultFontConfiguration::getDefaultFont( const Locale& rLocale, int nType ) const -{ - Locale aLocale; - aLocale.Language = rLocale.Language.toAsciiLowerCase(); - aLocale.Country = rLocale.Country.toAsciiUpperCase(); - aLocale.Variant = rLocale.Variant.toAsciiUpperCase(); - - OUString aType = OUString::createFromAscii( getKeyType( nType ) ); - OUString aRet = tryLocale( aLocale, aType ); - if( ! aRet.getLength() && aLocale.Variant.getLength() ) - { - aLocale.Variant = OUString(); - aRet = tryLocale( aLocale, aType ); - } - if( ! aRet.getLength() && aLocale.Country.getLength() ) - { - aLocale.Country = OUString(); - aRet = tryLocale( aLocale, aType ); - } - if( ! aRet.getLength() ) - { - aLocale.Language = OUString( RTL_CONSTASCII_USTRINGPARAM( "en" ) ); - aRet = tryLocale( aLocale, aType ); - } - return aRet; -} - -OUString DefaultFontConfiguration::getUserInterfaceFont( const Locale& rLocale ) const -{ - Locale aLocale = rLocale; - if( ! aLocale.Language.getLength() ) - aLocale = Application::GetSettings().GetUILocale(); - - OUString aUIFont = getDefaultFont( aLocale, DEFAULTFONT_UI_SANS ); - - if( aUIFont.getLength() ) - return aUIFont; - - // fallback mechanism (either no configuration or no entry in configuration - - #define FALLBACKFONT_UI_SANS "Andale Sans UI;Albany;Albany AMT;Tahoma;Arial Unicode MS;Arial;Nimbus Sans L;Bitstream Vera Sans;gnu-unifont;Interface User;Geneva;WarpSans;Dialog;Swiss;Lucida;Helvetica;Charcoal;Chicago;MS Sans Serif;Helv;Times;Times New Roman;Interface System" - #define FALLBACKFONT_UI_SANS_LATIN2 "Andale Sans UI;Albany;Albany AMT;Tahoma;Arial Unicode MS;Arial;Nimbus Sans L;Luxi Sans;Bitstream Vera Sans;Interface User;Geneva;WarpSans;Dialog;Swiss;Lucida;Helvetica;Charcoal;Chicago;MS Sans Serif;Helv;Times;Times New Roman;Interface System" - #define FALLBACKFONT_UI_SANS_ARABIC "Tahoma;Traditional Arabic;Simplified Arabic;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;clearlyU;Interface User;Arial Unicode MS;Lucida Sans Unicode;WarpSans;Geneva;MS Sans Serif;Helv;Dialog;Albany;Lucida;Helvetica;Charcoal;Chicago;Arial;Helmet;Interface System;Sans Serif" - #define FALLBACKFONT_UI_SANS_THAI "OONaksit;Tahoma;Lucidasans;Arial Unicode MS" - #define FALLBACKFONT_UI_SANS_KOREAN "SunGulim;BaekmukGulim;Gulim;Roundgothic;Arial Unicode MS;Lucida Sans Unicode;gnu-unifont;Andale Sans UI" - #define FALLBACKFONT_UI_SANS_JAPANESE1 "HG-GothicB-Sun;Andale Sans UI;HG MhinchoLightJ" - #define FALLBACKFONT_UI_SANS_JAPANESE2 "Kochi Gothic;Gothic" - #define FALLBACKFONT_UI_SANS_CHINSIM "Andale Sans UI;Arial Unicode MS;ZYSong18030;AR PL SungtiL GB;AR PL KaitiM GB;SimSun;Lucida Sans Unicode;Fangsong;Hei;Song;Kai;Ming;gnu-unifont;Interface User;" - #define FALLBACKFONT_UI_SANS_CHINTRD "Andale Sans UI;Arial Unicode MS;AR PL Mingti2L Big5;AR PL KaitiM Big5;Kai;PMingLiU;MingLiU;Ming;Lucida Sans Unicode;gnu-unifont;Interface User;" - - // we need localized names for japanese fonts - static sal_Unicode const aMSGothic[] = { 0xFF2D, 0xFF33, ' ', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; - static sal_Unicode const aMSPGothic[] = { 0xFF2D, 0xFF33, ' ', 0xFF30, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; - static sal_Unicode const aTLPGothic[] = { 0x0054, 0x004C, 0x0050, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; - static sal_Unicode const aLXGothic[] = { 0x004C, 0x0058, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; - static sal_Unicode const aKochiGothic[] = { 0x6771, 0x98A8, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; - - String aFallBackJapaneseLocalized( RTL_CONSTASCII_USTRINGPARAM( "MS UI Gothic;" ) ); - aFallBackJapaneseLocalized += String( RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_JAPANESE1 ) ); - aFallBackJapaneseLocalized += String( aMSPGothic ); - aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) ); - aFallBackJapaneseLocalized += String( aMSGothic ); - aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) ); - aFallBackJapaneseLocalized += String( aTLPGothic ); - aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) ); - aFallBackJapaneseLocalized += String( aLXGothic ); - aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) ); - aFallBackJapaneseLocalized += String( aKochiGothic ); - aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) ); - aFallBackJapaneseLocalized += String(RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_JAPANESE2 ) ); - static const OUString aFallBackJapanese( aFallBackJapaneseLocalized ); - static const OUString aFallback (RTL_CONSTASCII_USTRINGPARAM(FALLBACKFONT_UI_SANS)); - static const OUString aFallbackLatin2 (RTL_CONSTASCII_USTRINGPARAM(FALLBACKFONT_UI_SANS_LATIN2)); - static const OUString aFallBackArabic (RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_ARABIC ) ); - static const OUString aFallBackThai (RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_THAI ) ); - static const OUString aFallBackChineseSIM (RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_CHINSIM ) ); - static const OUString aFallBackChineseTRD (RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_CHINTRD ) ); - - // we need localized names for korean fonts - static sal_Unicode const aSunGulim[] = { 0xC36C, 0xAD74, 0xB9BC, 0 }; - static sal_Unicode const aBaekmukGulim[] = { 0xBC31, 0xBC35, 0xAD74, 0xB9BC, 0 }; - String aFallBackKoreanLocalized( aSunGulim ); - aFallBackKoreanLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) ); - aFallBackKoreanLocalized += String( aBaekmukGulim ); - aFallBackKoreanLocalized += String(RTL_CONSTASCII_USTRINGPARAM( ";" ) ); - aFallBackKoreanLocalized += String(RTL_CONSTASCII_USTRINGPARAM( FALLBACKFONT_UI_SANS_KOREAN ) ); - static const OUString aFallBackKorean( aFallBackKoreanLocalized ); - - // optimize font list for some locales, as long as Andale Sans UI does not support them - if( aLocale.Language.equalsAscii( "ar" ) || - aLocale.Language.equalsAscii( "he" ) || - aLocale.Language.equalsAscii( "iw" ) ) - { - return aFallBackArabic; - } - else if( aLocale.Language.equalsAscii( "th" ) ) - { - return aFallBackThai; - } - else if( aLocale.Language.equalsAscii( "ko" ) ) - { - return aFallBackKorean; - } - else if( aLocale.Language.equalsAscii( "cs" ) || - aLocale.Language.equalsAscii( "hu" ) || - aLocale.Language.equalsAscii( "pl" ) || - aLocale.Language.equalsAscii( "ro" ) || - aLocale.Language.equalsAscii( "rm" ) || - aLocale.Language.equalsAscii( "hr" ) || - aLocale.Language.equalsAscii( "sk" ) || - aLocale.Language.equalsAscii( "sl" ) || - aLocale.Language.equalsAscii( "sb" ) ) - { - return aFallbackLatin2; - } - else if( aLocale.Language.equalsAscii( "zh" ) ) - { - if( ! aLocale.Country.equalsAscii( "cn" ) ) - return aFallBackChineseTRD; - else - return aFallBackChineseSIM; - } - else if( aLocale.Language.equalsAscii( "ja" ) ) - { - return aFallBackJapanese; - } - - return aFallback; -} - -// ------------------------------------------------------------------------------------ - -/* - * FontSubstConfigItem::get - */ - -FontSubstConfiguration* FontSubstConfiguration::get() -{ - ImplSVData* pSVData = ImplGetSVData(); - if( ! pSVData->maGDIData.mpFontSubstConfiguration ) - pSVData->maGDIData.mpFontSubstConfiguration = new FontSubstConfiguration(); - return pSVData->maGDIData.mpFontSubstConfiguration; -} - -/* - * FontSubstConfigItem::FontSubstConfigItem - */ - -FontSubstConfiguration::FontSubstConfiguration() : - maSubstHash( 300 ) -{ - try - { - // get service provider - Reference< XMultiServiceFactory > xSMgr( unohelper::GetMultiServiceFactory() ); - // create configuration hierachical access name - if( xSMgr.is() ) - { - try - { - m_xConfigProvider = - Reference< XMultiServiceFactory >( - xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.ConfigurationProvider" ))), - UNO_QUERY ); - if( m_xConfigProvider.is() ) - { - Sequence< Any > aArgs(1); - PropertyValue aVal; - aVal.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ); - aVal.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.VCL/FontSubstitutions" ) ); - aArgs.getArray()[0] <<= aVal; - m_xConfigAccess = - Reference< XNameAccess >( - m_xConfigProvider->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.ConfigurationAccess" )), - aArgs ), - UNO_QUERY ); - if( m_xConfigAccess.is() ) - { - Sequence< OUString > aLocales = m_xConfigAccess->getElementNames(); - // fill config hash with empty interfaces - int nLocales = aLocales.getLength(); - const OUString* pLocaleStrings = aLocales.getConstArray(); - Locale aLoc; - for( int i = 0; i < nLocales; i++ ) - { - sal_Int32 nIndex = 0; - aLoc.Language = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiLowerCase(); - if( nIndex != -1 ) - aLoc.Country = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase(); - else - aLoc.Country = OUString(); - if( nIndex != -1 ) - aLoc.Variant = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase(); - else - aLoc.Variant = OUString(); - m_aSubst[ aLoc ] = LocaleSubst(); - m_aSubst[ aLoc ].aConfigLocaleString = pLocaleStrings[i]; - } - } - } - } - catch( Exception& ) - { - // configuration is awry - m_xConfigProvider.clear(); - m_xConfigAccess.clear(); - } - } - } - catch( WrappedTargetException& ) - { - } - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "config provider: %s, config access: %s\n", - m_xConfigProvider.is() ? "true" : "false", - m_xConfigAccess.is() ? "true" : "false" - ); - #endif -} - -/* - * FontSubstConfigItem::~FontSubstConfigItem - */ - -FontSubstConfiguration::~FontSubstConfiguration() -{ - // release config access - m_xConfigAccess.clear(); - // release config provider - m_xConfigProvider.clear(); -} - -/* - * FontSubstConfigItem::getMapName - */ -// ======================================================================= - -static const char* const aImplKillLeadingList[] = -{ - "microsoft", - "monotype", - "linotype", - "baekmuk", - "adobe", - "nimbus", - "zycjk", - "itc", - "sun", - "amt", - "ms", - "mt", - "cg", - "hg", - "fz", - "ipa", - "sazanami", - "kochi", - NULL -}; - -// ----------------------------------------------------------------------- - -static const char* const aImplKillTrailingList[] = -{ - "microsoft", - "monotype", - "linotype", - "adobe", - "nimbus", - "itc", - "sun", - "amt", - "ms", - "mt", - "clm", - // Scripts, for compatibility with older versions - "we", - "cyr", - "tur", - "wt", - "greek", - "wl", - // CJK extensions - "gb", - "big5", - "pro", - "z01", - "z02", - "z03", - "z13", - "b01", - "w3x12", - // Old Printer Fontnames - "5cpi", - "6cpi", - "7cpi", - "8cpi", - "9cpi", - "10cpi", - "11cpi", - "12cpi", - "13cpi", - "14cpi", - "15cpi", - "16cpi", - "18cpi", - "24cpi", - "scale", - "pc", - NULL -}; - -// ----------------------------------------------------------------------- - -static const char* const aImplKillTrailingWithExceptionsList[] = -{ - "ce", "monospace", "oldface", NULL, - "ps", "caps", NULL, - NULL -}; - -// ----------------------------------------------------------------------- - -struct ImplFontAttrWeightSearchData -{ - const char* mpStr; - FontWeight meWeight; -}; - -static ImplFontAttrWeightSearchData const aImplWeightAttrSearchList[] = -{ -// the attribute names are ordered by "first match wins" -// e.g. "semilight" should wins over "semi" -{ "extrablack", WEIGHT_BLACK }, -{ "ultrablack", WEIGHT_BLACK }, -{ "ultrabold", WEIGHT_ULTRABOLD }, -{ "semibold", WEIGHT_SEMIBOLD }, -{ "semilight", WEIGHT_SEMILIGHT }, -{ "semi", WEIGHT_SEMIBOLD }, -{ "demi", WEIGHT_SEMIBOLD }, -{ "black", WEIGHT_BLACK }, -{ "bold", WEIGHT_BOLD }, -{ "heavy", WEIGHT_BLACK }, -{ "ultralight", WEIGHT_ULTRALIGHT }, -{ "light", WEIGHT_LIGHT }, -{ "medium", WEIGHT_MEDIUM }, -{ NULL, WEIGHT_DONTKNOW }, -}; - -// ----------------------------------------------------------------------- - -struct ImplFontAttrWidthSearchData -{ - const char* mpStr; - FontWidth meWidth; -}; - -static ImplFontAttrWidthSearchData const aImplWidthAttrSearchList[] = -{ -{ "narrow", WIDTH_CONDENSED }, -{ "semicondensed", WIDTH_SEMI_CONDENSED }, -{ "ultracondensed", WIDTH_ULTRA_CONDENSED }, -{ "semiexpanded", WIDTH_SEMI_EXPANDED }, -{ "ultraexpanded", WIDTH_ULTRA_EXPANDED }, -{ "expanded", WIDTH_EXPANDED }, -{ "wide", WIDTH_ULTRA_EXPANDED }, -{ "condensed", WIDTH_CONDENSED }, -{ "cond", WIDTH_CONDENSED }, -{ "cn", WIDTH_CONDENSED }, -{ NULL, WIDTH_DONTKNOW }, -}; - -struct ImplFontAttrTypeSearchData -{ - const char* mpStr; - ULONG mnType; -}; - -static ImplFontAttrTypeSearchData const aImplTypeAttrSearchList[] = -{ -{ "monotype", 0 }, -{ "linotype", 0 }, -{ "titling", IMPL_FONT_ATTR_TITLING }, -{ "captitals", IMPL_FONT_ATTR_CAPITALS }, -{ "captital", IMPL_FONT_ATTR_CAPITALS }, -{ "caps", IMPL_FONT_ATTR_CAPITALS }, -{ "italic", IMPL_FONT_ATTR_ITALIC }, -{ "oblique", IMPL_FONT_ATTR_ITALIC }, -{ "rounded", IMPL_FONT_ATTR_ROUNDED }, -{ "outline", IMPL_FONT_ATTR_OUTLINE }, -{ "shadow", IMPL_FONT_ATTR_SHADOW }, -{ "handwriting", IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_SCRIPT }, -{ "hand", IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_SCRIPT }, -{ "signet", IMPL_FONT_ATTR_HANDWRITING | IMPL_FONT_ATTR_SCRIPT }, -{ "script", IMPL_FONT_ATTR_BRUSHSCRIPT | IMPL_FONT_ATTR_SCRIPT }, -{ "calligraphy", IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_SCRIPT }, -{ "chancery", IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_SCRIPT }, -{ "corsiva", IMPL_FONT_ATTR_CHANCERY | IMPL_FONT_ATTR_SCRIPT }, -{ "gothic", IMPL_FONT_ATTR_SANSSERIF | IMPL_FONT_ATTR_GOTHIC }, -{ "schoolbook", IMPL_FONT_ATTR_SERIF | IMPL_FONT_ATTR_SCHOOLBOOK }, -{ "schlbk", IMPL_FONT_ATTR_SERIF | IMPL_FONT_ATTR_SCHOOLBOOK }, -{ "typewriter", IMPL_FONT_ATTR_TYPEWRITER | IMPL_FONT_ATTR_FIXED }, -{ "lineprinter", IMPL_FONT_ATTR_TYPEWRITER | IMPL_FONT_ATTR_FIXED }, -{ "monospaced", IMPL_FONT_ATTR_FIXED }, -{ "monospace", IMPL_FONT_ATTR_FIXED }, -{ "mono", IMPL_FONT_ATTR_FIXED }, -{ "fixed", IMPL_FONT_ATTR_FIXED }, -{ "sansserif", IMPL_FONT_ATTR_SANSSERIF }, -{ "sans", IMPL_FONT_ATTR_SANSSERIF }, -{ "swiss", IMPL_FONT_ATTR_SANSSERIF }, -{ "serif", IMPL_FONT_ATTR_SERIF }, -{ "bright", IMPL_FONT_ATTR_SERIF }, -{ "symbols", IMPL_FONT_ATTR_SYMBOL }, -{ "symbol", IMPL_FONT_ATTR_SYMBOL }, -{ "dingbats", IMPL_FONT_ATTR_SYMBOL }, -{ "dings", IMPL_FONT_ATTR_SYMBOL }, -{ "ding", IMPL_FONT_ATTR_SYMBOL }, -{ "bats", IMPL_FONT_ATTR_SYMBOL }, -{ "math", IMPL_FONT_ATTR_SYMBOL }, -{ "oldstyle", IMPL_FONT_ATTR_OTHERSTYLE }, -{ "oldface", IMPL_FONT_ATTR_OTHERSTYLE }, -{ "old", IMPL_FONT_ATTR_OTHERSTYLE }, -{ "new", 0 }, -{ "modern", 0 }, -{ "lucida", 0 }, -{ "regular", 0 }, -{ "extended", 0 }, -{ "extra", IMPL_FONT_ATTR_OTHERSTYLE }, -{ "ext", 0 }, -{ "scalable", 0 }, -{ "scale", 0 }, -{ "nimbus", 0 }, -{ "adobe", 0 }, -{ "itc", 0 }, -{ "amt", 0 }, -{ "mt", 0 }, -{ "ms", 0 }, -{ "cpi", 0 }, -{ "no", 0 }, -{ NULL, 0 }, -}; - -// ----------------------------------------------------------------------- - -static bool ImplKillLeading( String& rName, const char* const* ppStr ) -{ - for(; *ppStr; ++ppStr ) - { - const char* pStr = *ppStr; - const xub_Unicode* pNameStr = rName.GetBuffer(); - while ( (*pNameStr == (xub_Unicode)(unsigned char)*pStr) && *pStr ) - { - pNameStr++; - pStr++; - } - if ( !*pStr ) - { - xub_StrLen nLen = sal::static_int_cast(pNameStr - rName.GetBuffer()); - rName.Erase( 0, nLen ); - return true; - } - } - - // special case for Baekmuk - // TODO: allow non-ASCII KillLeading list - const xub_Unicode* pNameStr = rName.GetBuffer(); - if( (pNameStr[0]==0xBC31) && (pNameStr[1]==0xBC35) ) - { - xub_StrLen nLen = (pNameStr[2]==0x0020) ? 3 : 2; - rName.Erase( 0, nLen ); - return true; - } - - return false; -} - -// ----------------------------------------------------------------------- - -static xub_StrLen ImplIsTrailing( const String& rName, const char* pStr ) -{ - xub_StrLen nStrLen = static_cast( strlen( pStr ) ); - if( nStrLen >= rName.Len() ) - return 0; - - const xub_Unicode* pEndName = rName.GetBuffer() + rName.Len(); - const sal_Unicode* pNameStr = pEndName - nStrLen; - do if( *(pNameStr++) != *(pStr++) ) - return 0; - while( *pStr ); - - return nStrLen; -} - -// ----------------------------------------------------------------------- - -static bool ImplKillTrailing( String& rName, const char* const* ppStr ) -{ - for(; *ppStr; ++ppStr ) - { - xub_StrLen nTrailLen = ImplIsTrailing( rName, *ppStr ); - if( nTrailLen ) - { - rName.Erase( rName.Len()-nTrailLen ); - return true; - } - } - - return false; -} - -// ----------------------------------------------------------------------- - -static bool ImplKillTrailingWithExceptions( String& rName, const char* const* ppStr ) -{ - for(; *ppStr; ++ppStr ) - { - xub_StrLen nTrailLen = ImplIsTrailing( rName, *ppStr ); - if( nTrailLen ) - { - // check string match against string exceptions - while( *++ppStr ) - if( ImplIsTrailing( rName, *ppStr ) ) - return false; - - rName.Erase( rName.Len()-nTrailLen ); - return true; - } - else - { - // skip exception strings - while( *++ppStr ) ; - } - } - - return false; -} - -// ----------------------------------------------------------------------- - -static BOOL ImplFindAndErase( String& rName, const char* pStr ) -{ - xub_StrLen nPos = rName.SearchAscii( pStr ); - if ( nPos == STRING_NOTFOUND ) - return FALSE; - - const char* pTempStr = pStr; - while ( *pTempStr ) - pTempStr++; - rName.Erase( nPos, (xub_StrLen)(pTempStr-pStr) ); - return TRUE; -} - -// ======================================================================= - -void FontSubstConfiguration::getMapName( const String& rOrgName, String& rShortName, - String& rFamilyName, FontWeight& rWeight, FontWidth& rWidth, ULONG& rType ) -{ - rShortName = rOrgName; - - // TODO: get rid of the crazy O(N*strlen) searches below - // they should be possible in O(strlen) - - // Kill leading vendor names and other unimportant data - ImplKillLeading( rShortName, aImplKillLeadingList ); - - // Kill trailing vendor names and other unimportant data - ImplKillTrailing( rShortName, aImplKillTrailingList ); - ImplKillTrailingWithExceptions( rShortName, aImplKillTrailingWithExceptionsList ); - - rFamilyName = rShortName; - - // Kill attributes from the name and update the data - // Weight - const ImplFontAttrWeightSearchData* pWeightList = aImplWeightAttrSearchList; - while ( pWeightList->mpStr ) - { - if ( ImplFindAndErase( rFamilyName, pWeightList->mpStr ) ) - { - if ( (rWeight == WEIGHT_DONTKNOW) || (rWeight == WEIGHT_NORMAL) ) - rWeight = pWeightList->meWeight; - break; - } - pWeightList++; - } - - // Width - const ImplFontAttrWidthSearchData* pWidthList = aImplWidthAttrSearchList; - while ( pWidthList->mpStr ) - { - if ( ImplFindAndErase( rFamilyName, pWidthList->mpStr ) ) - { - if ( (rWidth == WIDTH_DONTKNOW) || (rWidth == WIDTH_NORMAL) ) - rWidth = pWidthList->meWidth; - break; - } - pWidthList++; - } - - // Type - rType = 0; - const ImplFontAttrTypeSearchData* pTypeList = aImplTypeAttrSearchList; - while ( pTypeList->mpStr ) - { - if ( ImplFindAndErase( rFamilyName, pTypeList->mpStr ) ) - rType |= pTypeList->mnType; - pTypeList++; - } - - // Remove numbers - // TODO: also remove localized and fullwidth digits - xub_StrLen i = 0; - while ( i < rFamilyName.Len() ) - { - sal_Unicode c = rFamilyName.GetChar( i ); - if ( (c >= 0x0030) && (c <= 0x0039) ) - rFamilyName.Erase( i, 1 ); - else - i++; - } -} - - -struct StrictStringSort : public ::std::binary_function< const FontNameAttr&, const FontNameAttr&, bool > -{ - bool operator()( const FontNameAttr& rLeft, const FontNameAttr& rRight ) - { return rLeft.Name.CompareTo( rRight.Name ) == COMPARE_LESS ; } -}; - -static const char* const pAttribNames[] = -{ - "default", - "standard", - "normal", - "symbol", - "fixed", - "sansserif", - "serif", - "decorative", - "special", - "italic", - "title", - "capitals", - "cjk", - "cjk_jp", - "cjk_sc", - "cjk_tc", - "cjk_kr", - "ctl", - "nonelatin", - "full", - "outline", - "shadow", - "rounded", - "typewriter", - "script", - "handwriting", - "chancery", - "comic", - "brushscript", - "gothic", - "schoolbook", - "other" -}; - -struct enum_convert -{ - const char* pName; - int nEnum; -}; - - -static const enum_convert pWeightNames[] = -{ - { "normal", WEIGHT_NORMAL }, - { "medium", WEIGHT_MEDIUM }, - { "bold", WEIGHT_BOLD }, - { "black", WEIGHT_BLACK }, - { "semibold", WEIGHT_SEMIBOLD }, - { "light", WEIGHT_LIGHT }, - { "semilight", WEIGHT_SEMILIGHT }, - { "ultrabold", WEIGHT_ULTRABOLD }, - { "semi", WEIGHT_SEMIBOLD }, - { "demi", WEIGHT_SEMIBOLD }, - { "heavy", WEIGHT_BLACK }, - { "unknown", WEIGHT_DONTKNOW }, - { "thin", WEIGHT_THIN }, - { "ultralight", WEIGHT_ULTRALIGHT } -}; - -static const enum_convert pWidthNames[] = -{ - { "normal", WIDTH_NORMAL }, - { "condensed", WIDTH_CONDENSED }, - { "expanded", WIDTH_EXPANDED }, - { "unknown", WIDTH_DONTKNOW }, - { "ultracondensed", WIDTH_ULTRA_CONDENSED }, - { "extracondensed", WIDTH_EXTRA_CONDENSED }, - { "semicondensed", WIDTH_SEMI_CONDENSED }, - { "semiexpanded", WIDTH_SEMI_EXPANDED }, - { "extraexpanded", WIDTH_EXTRA_EXPANDED }, - { "ultraexpanded", WIDTH_ULTRA_EXPANDED } -}; - -void FontSubstConfiguration::fillSubstVector( const com::sun::star::uno::Reference< XNameAccess > xFont, - const rtl::OUString& rType, - std::vector< String >& rSubstVector ) const -{ - try - { - Any aAny = xFont->getByName( rType ); - if( aAny.getValueTypeClass() == TypeClass_STRING ) - { - const OUString* pLine = (const OUString*)aAny.getValue(); - sal_Int32 nIndex = 0; - sal_Int32 nLength = pLine->getLength(); - if( nLength ) - { - const sal_Unicode* pStr = pLine->getStr(); - sal_Int32 nTokens = 0; - // count tokens - while( nLength-- ) - { - if( *pStr++ == sal_Unicode(';') ) - nTokens++; - } - rSubstVector.clear(); - // optimize performance, heap fragmentation - rSubstVector.reserve( nTokens ); - while( nIndex != -1 ) - { - OUString aSubst( pLine->getToken( 0, ';', nIndex ) ); - if( aSubst.getLength() ) - { - UniqueSubstHash::iterator aEntry = maSubstHash.find( aSubst ); - if (aEntry != maSubstHash.end()) - aSubst = *aEntry; - else - maSubstHash.insert( aSubst ); - rSubstVector.push_back( aSubst ); - } - } - } - } - } - catch( NoSuchElementException ) - { - } - catch( WrappedTargetException ) - { - } -} - -FontWeight FontSubstConfiguration::getSubstWeight( const com::sun::star::uno::Reference< XNameAccess > xFont, - const rtl::OUString& rType ) const -{ - int weight = -1; - try - { - Any aAny = xFont->getByName( rType ); - if( aAny.getValueTypeClass() == TypeClass_STRING ) - { - const OUString* pLine = (const OUString*)aAny.getValue(); - if( pLine->getLength() ) - { - for( weight=sizeof(pWeightNames)/sizeof(pWeightNames[0])-1; weight >= 0; weight-- ) - if( pLine->equalsIgnoreAsciiCaseAscii( pWeightNames[weight].pName ) ) - break; - } -#if OSL_DEBUG_LEVEL > 1 - if( weight < 0 ) - fprintf( stderr, "Error: invalid weight %s\n", - OUStringToOString( *pLine, RTL_TEXTENCODING_ASCII_US ).getStr() ); -#endif - } - } - catch( NoSuchElementException ) - { - } - catch( WrappedTargetException ) - { - } - return (FontWeight)( weight >= 0 ? pWeightNames[weight].nEnum : WEIGHT_DONTKNOW ); -} - -FontWidth FontSubstConfiguration::getSubstWidth( const com::sun::star::uno::Reference< XNameAccess > xFont, - const rtl::OUString& rType ) const -{ - int width = -1; - try - { - Any aAny = xFont->getByName( rType ); - if( aAny.getValueTypeClass() == TypeClass_STRING ) - { - const OUString* pLine = (const OUString*)aAny.getValue(); - if( pLine->getLength() ) - { - for( width=sizeof(pWidthNames)/sizeof(pWidthNames[0])-1; width >= 0; width-- ) - if( pLine->equalsIgnoreAsciiCaseAscii( pWidthNames[width].pName ) ) - break; - } -#if OSL_DEBUG_LEVEL > 1 - if( width < 0 ) - fprintf( stderr, "Error: invalid width %s\n", - OUStringToOString( *pLine, RTL_TEXTENCODING_ASCII_US ).getStr() ); -#endif - } - } - catch( NoSuchElementException ) - { - } - catch( WrappedTargetException ) - { - } - return (FontWidth)( width >= 0 ? pWidthNames[width].nEnum : WIDTH_DONTKNOW ); -} - -unsigned long FontSubstConfiguration::getSubstType( const com::sun::star::uno::Reference< XNameAccess > xFont, - const rtl::OUString& rType ) const -{ - unsigned long type = 0; - try - { - Any aAny = xFont->getByName( rType ); - if( aAny.getValueTypeClass() == TypeClass_STRING ) - { - const OUString* pLine = (const OUString*)aAny.getValue(); - if( pLine->getLength() ) - { - sal_Int32 nIndex = 0; - while( nIndex != -1 ) - { - String aToken( pLine->getToken( 0, ',', nIndex ) ); - for( int k = 0; k < 32; k++ ) - if( aToken.EqualsIgnoreCaseAscii( pAttribNames[k] ) ) - { - type |= 1 << k; - break; - } - } - } - } - } - catch( NoSuchElementException ) - { - } - catch( WrappedTargetException ) - { - } - - return type; -} - -void FontSubstConfiguration::readLocaleSubst( const com::sun::star::lang::Locale& rLocale ) const -{ - std::hash_map< Locale, LocaleSubst, LocaleHash >::const_iterator it = - m_aSubst.find( rLocale ); - if( it != m_aSubst.end() ) - { - if( ! it->second.bConfigRead ) - { - it->second.bConfigRead = true; - Reference< XNameAccess > xNode; - try - { - Any aAny = m_xConfigAccess->getByName( it->second.aConfigLocaleString ); - aAny >>= xNode; - } - catch( NoSuchElementException ) - { - } - catch( WrappedTargetException ) - { - } - if( xNode.is() ) - { - Sequence< OUString > aFonts = xNode->getElementNames(); - int nFonts = aFonts.getLength(); - const OUString* pFontNames = aFonts.getConstArray(); - // improve performance, heap fragmentation - it->second.aSubstAttributes.reserve( nFonts ); - - // strings for subst retrieval, construct only once - OUString aSubstFontsStr ( RTL_CONSTASCII_USTRINGPARAM( "SubstFonts" ) ); - OUString aSubstFontsMSStr ( RTL_CONSTASCII_USTRINGPARAM( "SubstFontsMS" ) ); - OUString aSubstFontsPSStr ( RTL_CONSTASCII_USTRINGPARAM( "SubstFontsPS" ) ); - OUString aSubstFontsHTMLStr ( RTL_CONSTASCII_USTRINGPARAM( "SubstFontsHTML" ) ); - OUString aSubstWeightStr ( RTL_CONSTASCII_USTRINGPARAM( "FontWeight" ) ); - OUString aSubstWidthStr ( RTL_CONSTASCII_USTRINGPARAM( "FontWidth" ) ); - OUString aSubstTypeStr ( RTL_CONSTASCII_USTRINGPARAM( "FontType" ) ); - for( int i = 0; i < nFonts; i++ ) - { - Reference< XNameAccess > xFont; - try - { - Any aAny = xNode->getByName( pFontNames[i] ); - aAny >>= xFont; - } - catch( NoSuchElementException ) - { - } - catch( WrappedTargetException ) - { - } - if( ! xFont.is() ) - { - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "did not get font attributes for %s\n", - OUStringToOString( pFontNames[i], RTL_TEXTENCODING_UTF8 ).getStr() ); - #endif - continue; - } - - FontNameAttr aAttr; - // read subst attributes from config - aAttr.Name = pFontNames[i]; - fillSubstVector( xFont, aSubstFontsStr, aAttr.Substitutions ); - fillSubstVector( xFont, aSubstFontsMSStr, aAttr.MSSubstitutions ); - fillSubstVector( xFont, aSubstFontsPSStr, aAttr.PSSubstitutions ); - fillSubstVector( xFont, aSubstFontsHTMLStr, aAttr.HTMLSubstitutions ); - aAttr.Weight = getSubstWeight( xFont, aSubstWeightStr ); - aAttr.Width = getSubstWidth( xFont, aSubstWidthStr ); - aAttr.Type = getSubstType( xFont, aSubstTypeStr ); - - // finally insert this entry - it->second.aSubstAttributes.push_back( aAttr ); - } - std::sort( it->second.aSubstAttributes.begin(), it->second.aSubstAttributes.end(), StrictStringSort() ); - } - } - } -} - -const FontNameAttr* FontSubstConfiguration::getSubstInfo( const String& rFontName, const Locale& rLocale ) const -{ - if( !rFontName.Len() ) - return NULL; - - // search if a (language dep.) replacement table for the given font exists - // fallback is english - String aSearchFont( rFontName ); - aSearchFont.ToLowerAscii(); - FontNameAttr aSearchAttr; - aSearchAttr.Name = aSearchFont; - - Locale aLocale; - aLocale.Language = rLocale.Language.toAsciiLowerCase(); - aLocale.Country = rLocale.Country.toAsciiUpperCase(); - aLocale.Variant = rLocale.Variant.toAsciiUpperCase(); - - if( ! aLocale.Language.getLength() ) - aLocale = Application::GetSettings().GetUILocale(); - - while( aLocale.Language.getLength() ) - { - std::hash_map< Locale, LocaleSubst, LocaleHash >::const_iterator lang = m_aSubst.find( aLocale ); - if( lang != m_aSubst.end() ) - { - if( ! lang->second.bConfigRead ) - readLocaleSubst( aLocale ); - // try to find an exact match - // because the list is sorted this will also find fontnames of the form searchfontname* - std::vector< FontNameAttr >::const_iterator it = ::std::lower_bound( lang->second.aSubstAttributes.begin(), lang->second.aSubstAttributes.end(), aSearchAttr, StrictStringSort() ); - if( it != lang->second.aSubstAttributes.end() && aSearchFont.CompareTo( it->Name, aSearchFont.Len() ) == COMPARE_EQUAL ) - return &(*it); - } - // gradually become more unspecific - if( aLocale.Variant.getLength() ) - aLocale.Variant = OUString(); - else if( aLocale.Country.getLength() ) - aLocale.Country = OUString(); - else if( ! aLocale.Language.equalsAscii( "en" ) ) - aLocale.Language = OUString( RTL_CONSTASCII_USTRINGPARAM( "en" ) ); - else - aLocale.Language = OUString(); - } - return NULL; -} - -/* - * SettingsConfigItem::get - */ - -SettingsConfigItem* SettingsConfigItem::get() -{ - ImplSVData* pSVData = ImplGetSVData(); - if( ! pSVData->mpSettingsConfigItem ) - pSVData->mpSettingsConfigItem = new SettingsConfigItem(); - return pSVData->mpSettingsConfigItem; -} - -/* - * SettignsConfigItem constructor - */ - -SettingsConfigItem::SettingsConfigItem() - : - ConfigItem( OUString( RTL_CONSTASCII_USTRINGPARAM( SETTINGS_CONFIGNODE ) ), - CONFIG_MODE_DELAYED_UPDATE ), - m_aSettings( 0 ) -{ - getValues(); -} - -/* - * SettingsConfigItem destructor - */ - -SettingsConfigItem::~SettingsConfigItem() -{ - if( IsModified() ) - Commit(); -} - -/* - * SettingsConfigItem::Commit - */ - -void SettingsConfigItem::Commit() -{ - if( ! IsValidConfigMgr() ) - return; - - std::hash_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group; - - for( group = m_aSettings.begin(); group != m_aSettings.end(); ++group ) - { - String aKeyName( group->first ); - /*sal_Bool bAdded =*/ AddNode( OUString(), aKeyName ); - Sequence< PropertyValue > aValues( group->second.size() ); - PropertyValue* pValues = aValues.getArray(); - int nIndex = 0; - SmallOUStrMap::const_iterator it; - for( it = group->second.begin(); it != group->second.end(); ++it ) - { - String aName( aKeyName ); - aName.Append( '/' ); - aName.Append( String( it->first ) ); - pValues[nIndex].Name = aName; - pValues[nIndex].Handle = 0; - pValues[nIndex].Value <<= it->second; - pValues[nIndex].State = PropertyState_DIRECT_VALUE; - nIndex++; - } - ReplaceSetProperties( aKeyName, aValues ); - } -} - -/* - * SettingsConfigItem::Notify - */ - -void SettingsConfigItem::Notify( const Sequence< OUString >& ) -{ - getValues(); -} - -/* - * SettingsConfigItem::getValues - */ -void SettingsConfigItem::getValues() -{ - if( ! IsValidConfigMgr() ) - return; - - m_aSettings.clear(); - - Sequence< OUString > aNames( GetNodeNames( OUString() ) ); - m_aSettings.resize( aNames.getLength() ); - - for( int j = 0; j < aNames.getLength(); j++ ) - { -#if OSL_DEBUG_LEVEL > 2 - fprintf( stderr, "found settings data for \"%s\"\n", - OUStringToOString( aNames.getConstArray()[j], RTL_TEXTENCODING_ASCII_US ).getStr() - ); -#endif - String aKeyName( aNames.getConstArray()[j] ); - Sequence< OUString > aKeys( GetNodeNames( aKeyName ) ); - Sequence< OUString > aSettingsKeys( aKeys.getLength() ); - const OUString* pFrom = aKeys.getConstArray(); - OUString* pTo = aSettingsKeys.getArray(); - for( int m = 0; m < aKeys.getLength(); m++ ) - { - String aName( aKeyName ); - aName.Append( '/' ); - aName.Append( String( pFrom[m] ) ); - pTo[m] = aName; - } - Sequence< Any > aValues( GetProperties( aSettingsKeys ) ); - const Any* pValue = aValues.getConstArray(); - for( int i = 0; i < aValues.getLength(); i++, pValue++ ) - { - if( pValue->getValueTypeClass() == TypeClass_STRING ) - { - const OUString* pLine = (const OUString*)pValue->getValue(); - if( pLine->getLength() ) - m_aSettings[ aKeyName ][ pFrom[i] ] = *pLine; -#if OSL_DEBUG_LEVEL > 2 - fprintf( stderr, " \"%s\"=\"%.30s\"\n", - OUStringToOString( aKeys.getConstArray()[i], RTL_TEXTENCODING_ASCII_US ).getStr(), - OUStringToOString( *pLine, RTL_TEXTENCODING_ASCII_US ).getStr() - ); -#endif - } - } - } -} - -/* - * SettingsConfigItem::getDefaultFont - */ - -const OUString& SettingsConfigItem::getValue( const OUString& rGroup, const OUString& rKey ) const -{ - ::std::hash_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group = m_aSettings.find( rGroup ); - if( group == m_aSettings.end() || group->second.find( rKey ) == group->second.end() ) - { - static OUString aEmpty; - return aEmpty; - } - return group->second.find(rKey)->second; -} - -/* - * SettingsConfigItem::setDefaultFont - */ - -void SettingsConfigItem::setValue( const OUString& rGroup, const OUString& rKey, const OUString& rValue ) -{ - bool bModified = m_aSettings[ rGroup ][ rKey ] != rValue; - if( bModified ) - { - m_aSettings[ rGroup ][ rKey ] = rValue; - SetModified(); - } -} - diff --git a/vcl/source/gdi/fontcvt.cxx b/vcl/source/gdi/fontcvt.cxx deleted file mode 100644 index 565c92740dad..000000000000 --- a/vcl/source/gdi/fontcvt.cxx +++ /dev/null @@ -1,1528 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: fontcvt.cxx,v $ - * $Revision: 1.24 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_vcl.hxx" -#include -#include - -#ifndef _STLP_MAP -#include -#endif -#ifndef _STLP_VECTOR -#include -#endif -#ifndef _STLP_ALGORITHM -#include -#endif -#ifndef _STLP_FUNCTIONAL -#include -#endif - -//======================================================================= -// note: the character mappings that are only approximations -// are marked (with an empty comment) - -static const sal_Unicode aStarBatsTab[224] = -{ - // F020 - 0x0020, 0x263a, 0x25cf, 0x274d, - 0x25a0, 0x25a1, 0xE000, 0x2751, - 0x2752, 0xE001, 0xE002, 0xE003, - 0x2756, 0xE004, 0xE005, 0x27a2, - // F030 - 0xE006, 0x2794, 0x2713, 0x2612, - 0x2611, 0x27b2, 0x261b, 0x270d, - 0x270e, 0xE007, 0x2714, 0xE008, - 0xE009, 0xE00A, 0x274f, 0x2750, - // F040 - 0xE00B, 0xE00C, 0xE00D, 0xE00E, - 0x2722, 0x2723, 0x2724, 0x2725, - 0x2733, 0x2734, 0x2735, 0x2736, - 0x2737, 0x2738, 0x2739, 0x2717, - // F050 - 0x2718, 0x2719, 0x271a, 0x271b, - 0x271c, 0x272b, 0x272c, 0x272d, - 0x272e, 0x272f, 0x2730, 0, - 0xE00F, 0x278a, 0x278b, 0x278c, - // F060 - 0x278d, 0x278e, 0x278f, 0x2790, - 0x2791, 0x2792, 0x2793, 0xE010, - 0x2780, 0x2781, 0x2782, 0x2783, - 0x2784, 0x2785, 0x2786, 0x2787, - // F070 - 0x2788, 0x2789, 0xE011, 0xE012, - 0x260e, 0xE013, 0xE014, 0xE015, - 0xE016, 0xE017, 0xE018, 0xE019, - 0xE01A, 0x261e, 0xE01B, 0, - // F080 - 0x20ac, 0, 0x201a, 0x0192, - 0x201e, 0x2026, 0x2020, 0x2021, - 0xE01c, 0x2030, 0x0160, 0x2039, - 0x0152, 0, 0x017d, 0, - // F090 - 0, 0x2018, 0x2019, 0x201c, - 0x201d, 0x2022, 0x2013, 0x2014, - 0xE01d, 0x2122, 0x0161, 0x203a, - 0x0153, 0, 0x017e, 0x0178, - // F0A0 - 0, 0x21e7, 0x21e8, 0x21e9, - 0x21e6, 0xE01e, 0xE01f, 0x00a7, - 0xE020, 0xE021, 0xE022, 0x00ab, - 0xE023, 0x2639, 0xE024, 0xE025, - // F0B0 - 0xE026, 0xE027, 0xE028, 0x21e5, - 0x21e4, 0x2192, 0x2193, 0x2190, - 0x2191, 0xE029, 0xE02a, 0x00bb, - 0xE02b, 0xE02c, 0xE02d, 0xE02e, - // F0C0 - 0xE02f, 0xE030, 0xE031, 0xE032, - 0x25be, 0x25b4, 0x25bf, 0x25b5, - 0xE033, 0xE034, 0xE035, 0x2702, - 0x2708, 0x2721, 0x273f, 0x2744, - // F0D0 - 0x25d7, 0x2759, 0xE036, 0xE037, - 0x2762, 0x2663, 0x2665, 0x2660, - 0x2194, 0x2195, 0x2798, 0x279a, - 0x27b8, 0, 0x00b6, 0, - // F0E0 - 0x00a2, 0x00a4, 0x00a5, 0xE038, - 0x20a1, 0x20a2, 0x20a3, 0x20a4, - 0x20a9, 0x20ab, 0x20a8, 0xE039, - 0, 0, 0, 0, - // F0F0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0xE03a -}; - -// ----------------------------------------------------------------------- - -static const sal_Unicode aStarMathTab[224] = -{ - // F020 - 0x0020, 0x0021, 0x0022, 0x0023, - 0xE080, 0x0025, 0x0026, 0x221e, - 0x0028, 0x0029, 0x002a, 0x002b, - 0x002c, 0x002d, 0x002e, 0x002f, - // F030 - 0x2224, 0x21d2, 0x21d0, 0x21d4, - 0xE081, 0xE082, 0x00b0, 0, - 0, 0, 0x003a, 0x003b, - 0x003c, 0x003d, 0x003e, 0x00bf, - // F040 - 0x2260, 0xE083, 0x2212, 0x2217, - 0x00d7, 0x22c5, 0x00f7, 0x00b1, - 0x2213, 0x2295, 0x2296, 0x2297, - 0x2298, 0x2299, 0x222a, 0x2229, - // F050 - 0xE084, 0xE085, 0x2264, 0x2265, - 0xE086, 0xE087, 0x226a, 0x226b, - 0x007e, 0x2243, 0x2248, 0x225d, - 0x2261, 0x221d, 0x2202, 0x2282, - // F060 - 0x2283, 0x2286, 0x2287, 0x2284, - 0x2285, 0x2288, 0x2289, 0x2208, - 0x2209, 0xE089, 0x2203, 0x220d, - 0x2135, 0x2111, 0x211c, 0x2118, - // F070 - 0xE08a, 0x2221, 0x2222, 0x2223, - 0x2225, 0x22a5, 0xE08b, 0x22ef, - 0x22ee, 0x22f0, 0x22f1, 0x22b6, - 0x22b7, 0xE08c, 0x2216, 0x00ac, - // F080 - 0x222b, 0x222c, 0x222d, 0x222e, - 0x222f, 0x2230, 0x221a, 0xE08d, - 0xE08e, 0xE08f, 0x2210, 0x220f, - 0x2211, 0x2207, 0x2200, 0xE090, - // F090 - 0xE091, 0xE092, 0xE093, 0xE094, - 0xE095, 0xE096, 0xE097, 0xE098, - 0x02d9, 0x00a8, 0xE09b, 0x02da, - 0x2227, 0x2228, 0x220b, 0x2205, - // F0A0 - 0x007b, 0x007d, 0xe09e, 0xe09f, - 0x2329, 0x232a, 0x005b, 0x005d, - 0xE0a0, 0x22be, 0xE0a1, 0x2259, - 0x2254, 0x2255, 0x21b3, 0x2197, - // F0B0 - 0x2198, 0x2245, 0x301a, 0x301b, - 0x2373, 0xE0a5, 0xE0a6, 0x22a4, - 0x2112, 0x2130, 0x2131, 0, - 0xE0a7, 0xE0a8, 0xE0a9, 0xE0aa, - // F0C0 - 0x2308, 0x230a, 0x2309, 0x230b, - 0, 0xe0ab, 0xe0ac, 0xe0ad, - 0xe0ae, 0xe0af, 0xe0b0, 0xe0b1, - 0xe0b2, 0xe0b3, 0xe0b4, 0xe0b5, - // F0D0 - 0xe0b6, 0xe0b7, 0xe0b8, 0xe0b9, - 0xe0ba, 0xe0bb, 0xe0bc, 0xe0bd, - 0xe0be, 0xe0bf, 0xe0c0, 0xe0c1, - 0xe0c2, 0xe0c3, 0xe0c4, 0xe0c5, - // F0E0 - 0xe0c6, 0xe0c7, 0xe0c8, 0xe0c9, - 0xe0ca, 0xe0cb, 0xe0cc, 0xe0cd, - 0xe0ce, 0xe0cf, 0xe0d0, 0xe0d1, - 0x03f1, 0xe0d3, 0xe0d4, 0xe0d5, - // F0F0 - 0x2113, 0xe0d6, 0x2107, 0x2127, - 0x210a, 0xe0d9, 0x210f, 0x019b, - 0xe0db, 0xe0dc, 0xe0dd, 0x2115, - 0x2124, 0x211a, 0x211d, 0x2102 -}; - -// ----------------------------------------------------------------------- - -static const sal_Unicode aWingDingsTab[224] = -{ - // F020 - 0x0020, 0xe400, 0xe401, 0xe402, - 0xe403, 0xe404, 0xe405, 0xe406, - 0xe407, 0xe408, 0xe409, 0xe40a, - 0xe40b, 0xe40c, 0xe40d, 0xe40e, - // F030 - 0xe40f, 0xe410, 0xe411, 0xe412, - 0xe413, 0xe414, 0xe415, 0xe416, - 0xe417, 0xe418, 0xe419, 0xe41a, - 0xe41b, 0xe41c, 0x2707, 0xe41d, - // F040 - 0xe41e, 0xe41f, 0xe420, 0xe421, - 0x261c, 0xe423, 0x261d, 0x261f, - 0x261f, 0xe424, 0xe425, 0xe426, - 0xe427, 0xe428, 0xe429, 0xe42a, - // F050 - 0xe42b, 0xe42c, 0x263c, 0xe42d, - 0xe42e, 0xe42f, 0xe430, 0xe431, - 0xe432, 0xe433, 0x262a, 0x262f, - 0x0950, 0xe434, 0x2648, 0x2649, - // F060 - 0x264a, 0x264b, 0x264c, 0x264d, - 0x264e, 0x264f, 0x2650, 0x2651, - 0x2652, 0x2653, 0xe435, 0xe436, - 0xe437, 0xe438, 0xe439, 0xe43a, - // F070 - 0xe43b, 0xe43c, 0xe43d, 0xe43e, - 0xe43f, 0xe440, 0xe441, 0xe442, - 0xe443, 0x2353, 0x2318, 0xe444, - 0xe445, 0xe446, 0xe447, 0, - // F080 - 0xe448, 0xe449, 0xe44a, 0xe44b, - 0xe44c, 0xe44d, 0xe44e, 0xe44f, - 0xe450, 0xe451, 0xe452, 0xe453, - 0xe454, 0xe455, 0xe456, 0xe457, - // F090 - 0xe458, 0xe459, 0xe45a, 0xe45b, - 0xe45c, 0xe45d, 0xe45e, 0xe45f, - 0xe460, 0xe461, 0xe462, 0xe463, - 0xe464, 0xe465, 0xe466, 0xe467, - // F0a0 - 0xe468, 0xe469, 0xe46a, 0xe46b, - 0xe46c, 0xe46d, 0xe46e, 0xe46f, - 0xe470, 0xe471, 0xe472, 0xe473, - 0xe474, 0xe475, 0xe476, 0xe477, - // F0b0 - 0xe478, 0xe479, 0xe47a, 0xe47b, - 0xe47c, 0xe47d, 0xe47e, 0xe47f, - 0xe480, 0xe481, 0xe482, 0xe483, - 0xe484, 0xe485, 0xe486, 0xe487, - // F0c0 - 0xe488, 0xe489, 0xe48a, 0xe48b, - 0xe48c, 0xe48d, 0xe48e, 0xe48f, - 0xe490, 0xe491, 0xe492, 0xe493, - 0xe494, 0xe495, 0xe496, 0xe497, - // F0d0 - 0xe498, 0xe499, 0xe49a, 0xe49b, - 0xe49c, 0x232b, 0x2326, 0xe49d, - 0xe49e, 0xe49f, 0xe4a0, 0xe4a1, - 0xe4a2, 0xe4a3, 0xe4a4, 0xe4a5, - // F0e0 - 0xe4a6, 0xe4a7, 0xe4a8, 0xe4a9, - 0xe4aa, 0xe4ab, 0xe4ac, 0xe4ad, - 0xe4ae, 0xe4af, 0xe4b0, 0xe4b1, - 0xe4b2, 0xe4b3, 0xe4b4, 0xe4b5, - // F0f0 - 0xe4b6, 0xe4b7, 0xe4b8, 0xe4b9, - 0xe4ba, 0xe4bb, 0xe4bc, 0xe4bd, - 0xe4be, 0xe4bf, 0xe4c0, 0xe4c1, - 0xe4c2, 0xe4c3, 0xe4c4, 0xe4c5 -}; - -// ----------------------------------------------------------------------- - -static const sal_Unicode aWingDings2Tab[224] = -{ - // F020 - 0x0020, 0xe500, 0xe501, 0xe502, - 0xe503, 0xe504, 0xe505, 0xe506, - 0xe507, 0xe508, 0xe509, 0xe50a, - 0xe50b, 0xe50c, 0xe50d, 0xe50e, - // F030 - 0xe50f, 0xe510, 0xe511, 0xe512, - 0xe513, 0xe514, 0xe515, 0xe516, - 0xe517, 0xe518, 0xe519, 0xe51a, - 0xe51b, 0xe51c, 0xe51d, 0xe51e, - // F040 - 0xe51f, 0xe520, 0xe521, 0xe522, - 0xe523, 0xe524, 0xe525, 0xe526, - 0xe527, 0xe528, 0xe529, 0xe52a, - 0xe52b, 0xe52c, 0xe52d, 0xe52e, - // F050 - 0xe52f, 0xe530, 0xe531, 0xe532, - 0xe533, 0xe534, 0xe535, 0xe536, - 0xe537, 0xe538, 0xe539, 0xe53a, - 0xe53b, 0xe53c, 0xe53d, 0xe53e, - // F060 - 0xe53f, 0xe540, 0xe541, 0xe542, - 0xe543, 0xe544, 0xe545, 0xe546, - 0xe547, 0xe548, 0xe549, 0xe54a, - 0xe54b, 0xe54c, 0xe54d, 0xe54e, - // F070 - 0xe54e, 0xe54f, 0xe550, 0xe551, - 0xe552, 0xe553, 0xe554, 0xe555, - 0xe556, 0xe557, 0xe558, 0xe559, - 0xe55a, 0xe55b, 0xe55c, 0, - // F080 - 0x2609, 0x25cb, 0x263d, 0x263e, - 0xe55d, 0xe55e, 0xe55f, 0xe560, - 0xe561, 0xe562, 0xe563, 0xe564, - 0xe565, 0xe566, 0xe567, 0xe568, - // F090 - 0xe569, 0xe56a, 0xe56b, 0xe56c, - 0xe56d, 0xe56e, 0xe56f, 0xe570, - 0xe571, 0xe572, 0xe573, 0xe574, - 0xe575, 0xe576, 0xe577, 0xe578, - // F0a0 - 0xe579, 0xe57a, 0xe57b, 0xe57c, - 0xe57d, 0xe57e, 0xe57f, 0xe580, - 0xe581, 0xe582, 0xe583, 0xe584, - 0xe585, 0xe586, 0xe587, 0xe588, - // F0b0 - 0xe589, 0xe58a, 0xe58b, 0xe58c, - 0xe58d, 0xe58e, 0xe58f, 0xe590, - 0xe591, 0xe592, 0xe593, 0xe594, - 0xe595, 0xe596, 0xe597, 0xe598, - // F0c0 - 0xe599, 0xe59a, 0xe59b, 0xe59c, - 0xe59d, 0xe59e, 0xe59f, 0xe5a0, - 0xe5a1, 0xe5a2, 0xe5a3, 0xe5a4, - 0xe5a5, 0xe5a6, 0xe5a7, 0xe5a8, - // F0d0 - 0xe5a9, 0xe5aa, 0xe5ab, 0xe5ac, - 0xe5ad, 0xe5ae, 0xe5af, 0xe5b0, - 0xe5b1, 0xe5b2, 0xe5b3, 0xe5b4, - 0xe5b5, 0xe5b6, 0xe5b7, 0xe5b8, - // F0e0 - 0xe5b9, 0xe5ba, 0xe5bb, 0xe5bc, - 0xe5bd, 0xe5be, 0xe5bf, 0xe5c0, - 0xe5c1, 0xe5c2, 0xe5c3, 0xe5c4, - 0xe5c5, 0xe5c6, 0xe5c7, 0xe5c8, - // F0f0 - 0xe5c9, 0xe5ca, 0xe5cb, 0xe5cc, - 0xe5cd, 0xe5ce, 0xe5cf, 0xe5d0, - 0x203b, 0x2042, 0, 0, - 0, 0, 0, 0 -}; - -// ----------------------------------------------------------------------- - -static const sal_Unicode aWingDings3Tab[224] = -{ - // F020 - 0x0020, 0xe600, 0xe601, 0xe602, - 0xe603, 0x2196, 0xe604, 0x2199, - 0xe605, 0xe606, 0xe607, 0xe608, - 0xe609, 0xe60a, 0xe60b, 0x21de, - // F030 - 0x21df, 0xe60c, 0xe60d, 0xe60e, - 0x21e2, 0x21e1, 0x21e3, 0x21af, - 0x21b5, 0xe60f, 0xe610, 0xe611, - 0xe612, 0xe613, 0xe614, 0xe615, - // F040 - 0xe616, 0xe617, 0xe618, 0xe619, - 0x21c4, 0x21c5, 0xe61a, 0xe61b, - 0x21c7, 0x21c9, 0x21c8, 0x21ca, - 0x21b6, 0x21b7, 0xe61c, 0xe61d, - // F050 - 0x21bb, 0x21ba, 0xe61e, 0x2324, - 0x2303, 0x2325, 0x2334, 0xe61f, - 0x21ea, 0xe620, 0xe621, 0xe622, - 0xe623, 0xe624, 0xe625, 0xe626, - // F060 - 0xe627, 0xe628, 0xe629, 0xe62a, - 0xe62b, 0xe62c, 0xe62d, 0xe62e, - 0xe62f, 0xe630, 0xe631, 0xe632, - 0xe633, 0xe634, 0xe635, 0xe636, - // F070 - 0xe637, 0xe638, 0x25b3, 0x25bd, - 0x25c0, 0x25b6, 0x25c1, 0x25b7, - 0x25e3, 0xe639, 0x25e4, 0x25e5, - 0x25c2, 0x25b8, 0xe63a, 0, - // F080 - 0xe63b, 0xe63c, 0xe63d, 0xe63e, - 0xe63f, 0xe640, 0xe641, 0xe642, - 0xe643, 0xe644, 0xe645, 0xe646, - 0xe647, 0xe648, 0xe649, 0xe64a, - // F090 - 0xe64b, 0xe64c, 0xe64d, 0xe64e, - 0xe64f, 0xe650, 0xe651, 0xe652, - 0xe653, 0xe654, 0xe655, 0xe656, - 0xe657, 0xe658, 0xe659, 0xe65a, - // F0a0 - 0xe65b, 0xe65c, 0xe65d, 0xe65e, - 0xe65f, 0xe660, 0xe661, 0xe662, - 0xe663, 0xe664, 0xe665, 0xe666, - 0xe667, 0xe668, 0xe669, 0xe66a, - // F0b0 - 0xe66b, 0xe66c, 0xe66d, 0xe66e, - 0xe66f, 0xe670, 0xe671, 0xe672, - 0xe673, 0xe674, 0xe675, 0xe676, - 0xe677, 0xe678, 0xe679, 0xe67a, - // F0c0 - 0xe67b, 0xe67c, 0xe67d, 0xe67e, - 0xe67f, 0xe680, 0xe681, 0xe682, - 0xe683, 0xe684, 0xe685, 0xe686, - 0xe687, 0xe688, 0xe689, 0xe68a, - // F0d0 - 0xe68b, 0xe68c, 0xe68d, 0xe68e, - 0xe68f, 0xe690, 0xe691, 0xe692, - 0xe693, 0xe694, 0xe695, 0xe696, - 0xe697, 0xe698, 0xe699, 0xe69a, - // F0e0 - 0xe69b, 0xe69c, 0xe69d, 0xe69e, - 0xe69f, 0xe6a0, 0xe6a1, 0xe6a2, - 0xe6a3, 0xe6a4, 0xe6a5, 0xe6a6, - 0xe6a7, 0xe6a8, 0xe6a9, 0xe6aa, - // F0f0 - 0xe6ab, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0 -}; - -// ----------------------------------------------------------------------- - -static const sal_Unicode aWebDingsTab[224] = -{ - // F020 - 0x0020, 0xe300, 0xe301, 0xe302, - 0xe303, 0xe304, 0xe305, 0xe306, - 0xe307, 0xe308, 0xe309, 0xe30a, - 0xe30b, 0xe30c, 0xe30d, 0xe30e, - // F030 - 0xe30f, 0xe310, 0xe311, 0xe312, - 0xe313, 0xe314, 0xe315, 0xe316, - 0xe317, 0xe318, 0xe319, 0xe31a, - 0xe31b, 0xe31c, 0xe31d, 0xe31e, - // F040 - 0xe31f, 0xe320, 0xe321, 0xe322, - 0xe323, 0xe324, 0xe325, 0xe326, - 0xe327, 0xe328, 0xe329, 0xe32a, - 0xe32b, 0xe32c, 0xe32d, 0xe32e, - // F050 - 0xe32f, 0xe330, 0xe331, 0xe332, - 0xe333, 0xe334, 0xe335, 0xe336, - 0xe337, 0xe338, 0xe339, 0xe33a, - 0xe33b, 0xe33c, 0xe33d, 0xe33e, - // F060 - 0xe33f, 0xe340, 0xe341, 0xe342, - 0xe343, 0xe344, 0xe345, 0xe346, - 0xe347, 0xe348, 0xe349, 0xe34a, - 0xe34b, 0xe34c, 0xe34d, 0xe34e, - // F070 - 0xe34f, 0xe350, 0xe351, 0xe352, - 0xe353, 0xe354, 0xe355, 0xe356, - 0xe357, 0xe358, 0xe359, 0xe35a, - 0xe35b, 0xe35c, 0xe35d, 0, - // F080 - 0xe35e, 0xe35f, 0xe360, 0xe361, - 0xe362, 0xe363, 0xe364, 0xe365, - 0xe366, 0xe367, 0xe368, 0xe369, - 0xe36a, 0xe36b, 0xe36c, 0xe36d, - // F090 - 0xe36e, 0xe36f, 0xe370, 0xe371, - 0xe372, 0xe373, 0xe374, 0xe375, - 0xe376, 0xe377, 0xe378, 0xe379, - 0xe37a, 0xe37b, 0xe37c, 0xe37d, - // F0a0 - 0xe37e, 0xe37f, 0xe380, 0xe381, - 0xe382, 0xe383, 0xe384, 0xe385, - 0xe386, 0xe387, 0xe388, 0xe389, - 0xe38a, 0xe38b, 0xe38c, 0xe38d, - // F0b0 - 0xe38e, 0xe38f, 0xe390, 0xe391, - 0xe392, 0xe393, 0xe394, 0xe395, - 0xe396, 0xe397, 0xe398, 0xe399, - 0xe39a, 0xe39b, 0xe39c, 0xe39d, - // F0c0 - 0xe39e, 0xe39f, 0xe3a0, 0xe3a1, - 0xe3a2, 0xe3a3, 0xe3a4, 0xe3a5, - 0xe3a6, 0xe3a7, 0xe3a8, 0xe3a9, - 0xe3aa, 0xe3ab, 0xe3ac, 0xe3ad, - // F0d0 - 0xe3ae, 0xe3af, 0xe3b0, 0xe3b1, - 0xe3b2, 0xe3b3, 0xe3b4, 0xe3b5, - 0xe3b6, 0xe3b7, 0xe3b8, 0xe3b9, - 0xe3ba, 0xe3bb, 0xe3bc, 0xe3bd, - // F0e0 - 0xe3be, 0xe3bf, 0xe3c0, 0xe3c1, - 0xe3c2, 0xe3c3, 0xe3c4, 0xe3c5, - 0xe3c6, 0xe3c7, 0xe3c8, 0xe3c9, - 0xe3ca, 0xe3cb, 0xe3cd, 0xe3ce, - // F0f0 - 0xe3cf, 0xe3d0, 0xe3d1, 0xe3d2, - 0xe3d3, 0xe3d4, 0xe3d5, 0xe3d6, - 0xe3d7, 0xe3d8, 0xe3d9, 0xe3da, - 0xe3db, 0xe3dc, 0xe3dd, 0xe3de -}; - -// ----------------------------------------------------------------------- - -static const sal_Unicode aAdobeSymbolTab[224] = -{ -//TODO: - // F020 - 0x0020, 0xe100, 0xe101, 0xe102, - 0xe103, 0xe104, 0xe16a, 0xe105, - 0xe106, 0xe107, 0xe108, 0xe109, - 0xe10a, 0xe10b, 0xe10c, 0xe10d, - // F030 - 0x0030, 0x0031, 0x0032, 0x0033, - 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0xe10e, 0xe10f, - 0xe110, 0xe111, 0xe112, 0x003f, - // F040 - 0xe113, 0x0391, 0x0392, 0x03a7, - 0x0394, 0x0395, 0x03a6, 0x0393, - 0x0397, 0x0399, 0x03d1, 0x039a, - 0x039b, 0x039c, 0x039d, 0x039f, - // F050 - 0x03a0, 0x0398, 0x03a1, 0x03a3, - 0x03a4, 0x03a5, 0x03c2, 0x03a9, - 0x039e, 0x03a8, 0x0396, 0xe114, - 0x2234, 0xe115, 0xe116, 0x005f, - // F060 - 0x00af, 0x03b1, 0x03b2, 0x03c7, - 0x03b4, 0x03b5, 0x03d5, 0x03b3, - 0x03b7, 0x03b9, 0x03c6, 0x03ba, - 0x03bb, 0x03bc, 0x03bd, 0x03bf, - // F070 - 0x03c0, 0x03b8, 0x03c1, 0x03c3, - 0x03c4, 0x03c5, 0x03d6, 0x03c9, - 0x03be, 0x03c8, 0x03b6, 0xe117, - 0x007c, 0xe118, 0xe119, 0, - // F080 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F090 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0a0 - 0xe11a, 0x03d2, 0x0384, 0xe11b, - 0x2215, 0xe11c, 0xe11d, 0xe11e, - 0x2666, 0xe11f, 0xe120, 0xe121, - 0xe122, 0xe123, 0xe124, 0xe125, - // F0b0 - 0xe126, 0xe127, 0x2033, 0xe128, - 0xe129, 0xe12a, 0xe12b, 0xe12c, - 0xe12d, 0xe12e, 0xe12f, 0xe130, - 0xe131, 0x2502, 0x2500, 0x21b2, - // F0c0 - 0xe132, 0xe133, 0xe134, 0xe135, - 0xe136, 0xe137, 0xe138, 0xe139, - 0xe13a, 0xe13b, 0xe13c, 0xe13d, - 0xe13e, 0xe13f, 0xe140, 0xe141, - // F0d0 - 0x2220, 0xe142, 0x00ae, 0x00a9, - 0xe143, 0xe144, 0xe145, 0xe146, - 0xe147, 0xe148, 0xe149, 0xe14a, - 0xe14b, 0x21d1, 0xe14c, 0x21d3, - // F0e0 - 0x25ca, 0xe14d, 0xe14e, 0xe14f, - 0xe150, 0xe151, 0xe152, 0xe153, - 0xe154, 0xe155, 0xe156, 0xe157, - 0xe158, 0xe159, 0xe15a, 0xe15b, - // F0f0 - 0, 0xe15c, 0xe15d, 0xe15e, - 0xe15f, 0xe160, 0xe161, 0xe162, - 0xe163, 0xe164, 0xe165, 0xe166, - 0xe167, 0xe168, 0xe169, 0, -}; - -// ----------------------------------------------------------------------- - -static const sal_Unicode aMonotypeSortsTab[224] = -{ - // F020 - 0x0020, 0x2701, 0xe200, 0x2703, - 0x2704, 0xe201, 0x2706, 0xe202, - 0xe203, 0xe203, 0xe204, 0xe205, - 0x270c, 0xe206, 0xe207, 0xe208, - // F030 - 0x2710, 0x2711, 0x2712, 0xe209, - 0xe20a, 0x2715, 0x2716, 0xe20b, - 0xe20c, 0xe20d, 0xe20e, 0xe20f, - 0xe210, 0x271d, 0x271e, 0x271f, - // F040 - 0x2720, 0xe211, 0xe212, 0xe213, - 0xe214, 0xe215, 0x2726, 0x2727, - 0x2605, 0x2729, 0x272a, 0xe216, - 0xe217, 0xe218, 0xe219, 0xe21a, - // F050 - 0xe21b, 0xe21c, 0x2732, 0xe21d, - 0xe21e, 0xe21f, 0xe220, 0xe221, - 0xe222, 0xe223, 0x273a, 0x273b, - 0x273c, 0x273d, 0x273e, 0xe224, - // F060 - 0x2740, 0x2741, 0x2742, 0x2743, - 0xe225, 0x2745, 0x2746, 0x2747, - 0x2748, 0x2749, 0x274a, 0x274b, - 0xe226, 0xe227, 0xe228, 0xe229, - // F070 - 0xe22a, 0xe22b, 0xe22c, 0x25b2, - 0x25bc, 0xe22d, 0xe22e, 0xe22f, - 0x2758, 0xe230, 0x275a, 0x275b, - 0x275c, 0x275d, 0x275e, 0, - // F080 - 0xe231, 0xe232, 0xe233, 0xe234, - 0xe235, 0xe236, 0xe237, 0xe238, - 0xe239, 0xe23a, 0xe23b, 0xe23c, - 0xe23d, 0xe23e, 0, 0, - // F090 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0a0 - 0, 0xe23f, 0xe240, 0x2763, - 0x2764, 0x2765, 0x2766, 0x2767, - 0xe241, 0xe242, 0xe243, 0xe244, - 0x2460, 0x2461, 0x2462, 0x2463, - // F0b0 - 0x2464, 0x2465, 0x2466, 0x2467, - 0x2468, 0x2469, 0x2776, 0x2777, - 0x2778, 0x2779, 0x277a, 0x277b, - 0x277c, 0x277d, 0x277e, 0x277f, - // F0c0 - 0xe245, 0xe246, 0xe247, 0xe248, - 0xe249, 0xe24a, 0xe24b, 0xe24c, - 0xe24d, 0xe24e, 0xe24f, 0xe250, - 0xe251, 0xe252, 0xe253, 0xe254, - // F0d0 - 0xe255, 0xe256, 0xe257, 0xe258, - 0xe259, 0xe25a, 0xe25b, 0xe25c, - 0xe25d, 0x2799, 0xe25e, 0x279b, - 0x279c, 0x279d, 0x279e, 0x279f, - // F0e0 - 0x27a0, 0x27a1, 0xe25f, 0x27a3, - 0x27a4, 0x27a5, 0x27a6, 0x27a7, - 0x27a8, 0x27a9, 0x27aa, 0x27ab, - 0x27ac, 0x27ad, 0x27ae, 0x27af, - // F0f0 - 0, 0x27b1, 0xe260, 0x27b3, - 0x27b4, 0x27b5, 0x27b6, 0x27b7, - 0xe261, 0x27b9, 0x27ba, 0x27bb, - 0x27bc, 0x27bd, 0x27be, 0, -}; - -// ----------------------------------------------------------------------- - -/* -static const sal_Unicode aMonotypeSorts2Tab[224] = -{ -//TODO: - // F020 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F030 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F040 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F050 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F060 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F070 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F080 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F090 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0a0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0b0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0c0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0d0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0e0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0f0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, -}; -*/ - -static const sal_Unicode aMTExtraTab[224] = -{ - // F020 - 0x0020, 0, 0, 0xE095, - 0xE091, 0xE096, 0x02D9, 0, - 0xE093, 0, 0, 0, - 0, 0, 0, 0, - // F030 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0x25C1, 0, 0x25B7, 0, - // F040 - 0, 0, 0x2210, 0x019b, - 0, 0, 0, 0, - 0, 0x2229, 0, 0xE08B, - 0x22EF, 0x22EE, 0x22F0, 0x22F1, - // F050 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F060 - 0xE095, 0, 0xE25C, 0xE4BA, - 0, 0, 0x210F, 0, - 0, 0, 0, 0, - 0x2113, 0x2213, 0, 0x00B0, - // F070 - 0, 0, 0xE098, 0, - 0, 0xE097, 0, 0, - 0, 0, 0, 0xE081, - 0, 0xE082, 0, 0, - // F080 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F090 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0a0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0b0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0c0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0d0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0e0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - // F0f0 - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0 -}; - - -//======================================================================= - -static sal_Unicode ImplStarSymbolToStarBats( sal_Unicode c ) -{ - switch ( c ) - { - case 0x00A2: c = 0xF0E0; break; - case 0x00A4: c = 0xF0E1; break; - case 0x00A5: c = 0xF0E2; break; - case 0x00A7: c = 0xF0A7; break; - case 0x00AB: c = 0xF0AB; break; - case 0x00B6: c = 0xF0DE; break; - case 0x00BB: c = 0xF0BB; break; - - case 0x0152: c = 0xF08C; break; - case 0x0153: c = 0xF09C; break; - case 0x0160: c = 0xF08A; break; - case 0x0161: c = 0xF09A; break; - case 0x0178: c = 0xF09F; break; - case 0x017D: c = 0xF08E; break; - case 0x017E: c = 0xF09E; break; - - case 0x0192: c = 0xF083; break; - case 0x02C6: c = 0xF088; break; - case 0x02DC: c = 0xF098; break; - case 0x2013: c = 0xF096; break; - case 0x2014: c = 0xF097; break; - case 0x2018: c = 0xF091; break; - - case 0x2019: c = 0xF092; break; - case 0x201A: c = 0xF082; break; - case 0x201C: c = 0xF093; break; - case 0x201D: c = 0xF094; break; - case 0x201E: c = 0xF084; break; - case 0x2020: c = 0xF086; break; - - case 0x2021: c = 0xF087; break; - case 0x2022: c = 0xF095; break; - case 0x2026: c = 0xF085; break; - case 0x2030: c = 0xF089; break; - case 0x2039: c = 0xF08B; break; - case 0x203A: c = 0xF09B; break; - - case 0x20A1: c = 0xF0E4; break; - case 0x20A2: c = 0xF0E5; break; - case 0x20A3: c = 0xF0E6; break; - case 0x20A4: c = 0xF0E7; break; - case 0x20A8: c = 0xF0EA; break; - case 0x20A9: c = 0xF0E8; break; - case 0x20AB: c = 0xF0E9; break; - case 0x20AC: c = 0xF080; break; - - case 0x2122: c = 0xF099; break; - case 0x2190: c = 0xF0B7; break; - case 0x2191: c = 0xF0B8; break; - case 0x2192: c = 0xF0B5; break; - case 0x2193: c = 0xF0B6; break; - case 0x2194: c = 0xF0D8; break; - case 0x2195: c = 0xF0D9; break; - - case 0x21E4: c = 0xF0B4; break; - case 0x21E5: c = 0xF0B3; break; - case 0x21E6: c = 0xF0A4; break; - case 0x21E7: c = 0xF0B2; break; - case 0x21E8: c = 0xF0AF; break; - case 0x21E9: c = 0xF0A3; break; - - case 0x25A0: c = 0xF024; break; - case 0x25A1: c = 0xF025; break; - case 0x25B4: c = 0xF0C5; break; - case 0x25B5: c = 0xF0C7; break; - case 0x25BE: c = 0xF0C4; break; - case 0x25BF: c = 0xF0C6; break; - case 0x25C6: c = 0xF043; break; - case 0x25CF: c = 0xF022; break; - case 0x25D7: c = 0xF0D0; break; - - case 0x260E: c = 0xF074; break; - case 0x2611: c = 0xF034; break; - case 0x2612: c = 0xF033; break; - case 0x261B: c = 0xF036; break; - case 0x261E: c = 0xF07D; break; - case 0x2639: c = 0xF0AD; break; - case 0x263A: c = 0xF021; break; - - case 0x2702: c = 0xF0CB; break; - case 0x2708: c = 0xF0CC; break; - case 0x270D: c = 0xF07E; break; - case 0x270E: c = 0xF038; break; - - case 0x2713: c = 0xF039; break; - case 0x2714: c = 0xF03A; break; - case 0x2717: c = 0xF04F; break; - case 0x2718: c = 0xF050; break; - case 0x2719: c = 0xF051; break; - case 0x271A: c = 0xF052; break; - case 0x271B: c = 0xF053; break; - case 0x271C: c = 0xF054; break; - - case 0x2721: c = 0xF0CD; break; - case 0x2722: c = 0xF044; break; - case 0x2723: c = 0xF045; break; - case 0x2724: c = 0xF046; break; - case 0x2725: c = 0xF047; break; - case 0x272B: c = 0xF055; break; - case 0x272C: c = 0xF056; break; - case 0x272D: c = 0xF057; break; - case 0x272E: c = 0xF058; break; - case 0x272F: c = 0xF059; break; - - case 0x2730: c = 0xF05A; break; - case 0x2733: c = 0xF048; break; - case 0x2734: c = 0xF049; break; - case 0x2735: c = 0xF04A; break; - case 0x2736: c = 0xF04B; break; - case 0x2737: c = 0xF04C; break; - case 0x2738: c = 0xF04D; break; - case 0x2739: c = 0xF04E; break; - case 0x273F: c = 0xF0CE; break; - - case 0x2744: c = 0xF0CF; break; - case 0x274D: c = 0xF023; break; - case 0x274F: c = 0xF03E; break; - case 0x2750: c = 0xF03F; break; - case 0x2751: c = 0xF027; break; - case 0x2752: c = 0xF028; break; - case 0x2756: c = 0xF02C; break; - case 0x2759: c = 0xF0D1; break; - case 0x2762: c = 0xF0D4; break; - - case 0x2780: c = 0xF068; break; - case 0x2781: c = 0xF069; break; - case 0x2782: c = 0xF06A; break; - case 0x2783: c = 0xF06B; break; - case 0x2784: c = 0xF06C; break; - case 0x2785: c = 0xF06D; break; - case 0x2786: c = 0xF06E; break; - case 0x2787: c = 0xF06F; break; - case 0x2788: c = 0xF070; break; - case 0x2789: c = 0xF071; break; - case 0x278A: c = 0xF05D; break; - case 0x278B: c = 0xF05E; break; - case 0x278C: c = 0xF05F; break; - case 0x278D: c = 0xF060; break; - case 0x278E: c = 0xF061; break; - case 0x278F: c = 0xF062; break; - - case 0x2790: c = 0xF063; break; - case 0x2791: c = 0xF064; break; - case 0x2792: c = 0xF065; break; - case 0x2793: c = 0xF066; break; - case 0x2794: c = 0xF031; break; - case 0x2798: c = 0xF0DA; break; - case 0x279A: c = 0xF0DB; break; - - case 0x27A2: c = 0xF02F; break; - case 0x27B2: c = 0xF035; break; - case 0x27B8: c = 0xF0DC; break; - - case 0xE000: c = 0xF000+38; break; - case 0xE001: c = 0xF000+41; break; - case 0xE002: c = 0xF000+42; break; - case 0xE003: c = 0xF000+43; break; - case 0xE004: c = 0xF000+45; break; - case 0xE005: c = 0xF000+46; break; - case 0xE006: c = 0xF000+48; break; - case 0xE007: c = 0xF000+57; break; - - case 0xE008: c = 0xF000+59; break; - case 0xE009: c = 0xF000+60; break; - case 0xE00a: c = 0xF000+61; break; - case 0xE00b: c = 0xF000+64; break; - case 0xE00c: c = 0xF000+65; break; - case 0xE00d: c = 0xF000+66; break; - case 0xE00e: c = 0xF000+67; break; - case 0xE00f: c = 0xF000+92; break; - - case 0xE010: c = 0xF000+103; break; - case 0xE011: c = 0xF000+114; break; - case 0xE012: c = 0xF000+115; break; - case 0xE013: c = 0xF000+117; break; - case 0xE014: c = 0xF000+118; break; - case 0xE015: c = 0xF000+119; break; - case 0xE016: c = 0xF000+120; break; - case 0xE017: c = 0xF000+121; break; - - case 0xE018: c = 0xF000+122; break; - case 0xE019: c = 0xF000+123; break; - case 0xE01a: c = 0xF000+124; break; - case 0xE01b: c = 0xF000+126; break; - case 0xE01c: c = 0xF000+136; break; - case 0xE01d: c = 0xF000+155; break; - case 0xE01e: c = 0xF000+165; break; - case 0xE01f: c = 0xF000+166; break; - - case 0xE020: c = 0xF000+168; break; - case 0xE021: c = 0xF000+169; break; - case 0xE022: c = 0xF000+170; break; - case 0xE023: c = 0xF000+172; break; - case 0xE024: c = 0xF000+174; break; - case 0xE025: c = 0xF000+175; break; - case 0xE026: c = 0xF000+176; break; - case 0xE027: c = 0xF000+177; break; - - case 0xE028: c = 0xF000+178; break; - case 0xE029: c = 0xF000+185; break; - case 0xE02a: c = 0xF000+186; break; - case 0xE02b: c = 0xF000+188; break; - case 0xE02c: c = 0xF000+189; break; - case 0xE02d: c = 0xF000+190; break; - case 0xE02e: c = 0xF000+191; break; - case 0xE02f: c = 0xF000+192; break; - - case 0xE030: c = 0xF000+193; break; - case 0xE031: c = 0xF000+194; break; - case 0xE032: c = 0xF000+195; break; - case 0xE033: c = 0xF000+200; break; - case 0xE034: c = 0xF000+201; break; - case 0xE035: c = 0xF000+202; break; - case 0xE036: c = 0xF000+210; break; - case 0xE037: c = 0xF000+211; break; - - case 0xE038: c = 0xF000+227; break; - case 0xE039: c = 0xF000+235; break; - case 0xE03a: c = 0xF000+255; break; - - default: c = 0; break; - } - - return c; -} - -enum SymbolFont -{ - Symbol=1, Wingdings=2, MonotypeSorts=4, Webdings=8, Wingdings2=16, - Wingdings3=32, MTExtra=64, TimesNewRoman=128 -}; - -const char *aSymbolNames[] = -{ - "Symbol", "Wingdings", "Monotype Sorts", "Webdings", "Wingdings 2", - "Wingdings 3", "MT Extra", "Times New Roman" -}; - -struct SymbolEntry -{ - sal_uInt8 cIndex; - enum SymbolFont eFont; -}; - -class StarSymbolToMSMultiFontImpl : public StarSymbolToMSMultiFont -{ -private: - ::std::multimap maMagicMap; -public: - StarSymbolToMSMultiFontImpl(bool bPerfectOnly); - String ConvertChar(sal_Unicode &rChar); - String ConvertString(String &rString, xub_StrLen& rIndex); -}; - -struct ExtraTable { sal_Unicode cStar; sal_uInt8 cMS;}; - -ExtraTable aWingDingsExtraTab[] = -{ - {0x25cf, 0x6C}, {0x2714, 0xFC}, {0x2717, 0xFB}, {0x2794, 0xE8}, - {0x27a2, 0xD8}, {0xe000, 0x6F}, {0xe001, 0x73}, {0xe002, 0x74}, - {0xe003, 0x75}, {0xe004, 0x77}, {0xe005, 0xA6}, {0xe006, 0xE0}, - {0xe007, 0xFC}, {0xe008, 0x6C}, {0xe009, 0x6D}, {0xe00a, 0x6E}, - {0xe00b, 0x72}, {0xe00c, 0x75}, {0xe00d, 0x76}, {0xe00e, 0x74}, - {0xe00f, 0x8B}, {0xe010, 0x80}, {0xe011, 0x2B}, {0xe012, 0x3A}, - {0xe013, 0x5D}, {0xe014, 0x29}, {0xe015, 0x3A}, {0xe016, 0x3C}, - {0xe017, 0x38}, {0xe018, 0x3A}, {0xe019, 0x2A}, {0xe01a, 0x2B}, - {0xe01b, 0x3F}, {0xe01c, 0x9F}, {0xe01d, 0x80}, {0xe01e, 0x8B}, - {0xe023, 0x4A}, {0xe025, 0xF0}, {0xe026, 0xF2}, {0xe027, 0xEF}, - {0xe028, 0xF1}, {0xe029, 0x52}, {0xe02a, 0x29}, {0xe02b, 0xE0}, - {0xe02c, 0xE2}, {0xe02d, 0xDF}, {0xe02e, 0xE1}, {0xe02f, 0xAC}, - {0xe030, 0xAD}, {0xe031, 0xAE}, {0xe032, 0x7C}, {0xe033, 0x43}, - {0xe034, 0x4D}, {0xe0aa, 0x71}, {0xe422, 0x44} -}; - -ExtraTable aSymbolExtraTab2[] = -{ - {0x0020, 0x20}, {0x00A0, 0x20}, {0x0021, 0x21}, {0x2200, 0x22}, - {0x0023, 0x23}, {0x2203, 0x24}, {0x0025, 0x25}, {0x0026, 0x26}, - {0x220B, 0x27}, {0x0028, 0x28}, {0x0029, 0x29}, {0x2217, 0x2A}, - {0x002B, 0x2B}, {0x002C, 0x2C}, {0x2212, 0x2D}, {0x002E, 0x2E}, - {0x002F, 0x2F}, {0x003A, 0x3A}, {0x003B, 0x3B}, {0x003C, 0x3C}, - {0x003D, 0x3D}, {0x003E, 0x3E}, {0x2245, 0x40}, {0x2206, 0x44}, - {0x2126, 0x57}, {0x005B, 0x5B}, {0x005D, 0x5D}, {0x22A5, 0x5E}, - {0x03C6, 0x66}, {0x03D5, 0x6A}, {0x00B5, 0x6D}, {0x007B, 0x7B}, - {0x007C, 0x7C}, {0x007D, 0x7D}, {0x223C, 0x7E}, {0x20AC, 0xA0}, - {0x2032, 0xA2}, {0x2264, 0xA3}, {0x2044, 0xA4}, {0x221E, 0xA5}, - {0x0192, 0xA6}, {0x2663, 0xA7}, {0x2665, 0xA9}, {0x2660, 0xAA}, - {0x2194, 0xAB}, {0x2190, 0xAC}, {0x2191, 0xAD}, {0x2192, 0xAE}, - {0x2193, 0xAF}, {0x00B0, 0xB0}, {0x00B1, 0xB1}, {0x2265, 0xB3}, - {0x00D7, 0xB4}, {0x221D, 0xB5}, {0x2202, 0xB6}, {0x2022, 0xB7}, - {0x00F7, 0xB8}, {0x2260, 0xB9}, {0x2261, 0xBA}, {0x2248, 0xBB}, - {0x2026, 0xBC}, {0x21B5, 0xBF}, {0x2135, 0xC0}, {0x2111, 0xC1}, - {0x211C, 0xC2}, {0x2118, 0xC3}, {0x2297, 0xC4}, {0x2295, 0xC5}, - {0x2205, 0xC6}, {0x2229, 0xC7}, {0x222A, 0xC8}, {0x2283, 0xC9}, - {0x2287, 0xCA}, {0x2284, 0xCB}, {0x2282, 0xCC}, {0x2286, 0xCD}, - {0x2208, 0xCE}, {0x2209, 0xCF}, {0x2207, 0xD1}, {0x220F, 0xD5}, - {0x221A, 0xD6}, {0x22C5, 0xD7}, {0x00AC, 0xD8}, {0x2227, 0xD9}, - {0x2228, 0xDA}, {0x21D4, 0xDB}, {0x21D0, 0xDC}, {0x21D2, 0xDE}, - {0x2329, 0xE1}, {0x2211, 0xE5}, {0x232A, 0xF1}, {0x222B, 0xF2}, - {0x2320, 0xF3}, {0x2321, 0xF5}, {0x2013, 0x2D} -}; - -ExtraTable aSymbolExtraTab[] = -{ - {0xe021, 0xD3}, {0xe024, 0xD2}, {0xe035, 0x20}, {0xe036, 0x28}, - {0xe037, 0x29}, {0xe039, 0x20}, {0xe083, 0x2B}, {0xe084, 0x3C}, - {0xe085, 0x3E}, {0xe086, 0xA3}, {0xe087, 0xB3}, {0xe089, 0xCE}, - {0xe08a, 0xA6}, {0xe08c, 0xAE}, {0xe08d, 0xD6}, {0xe08e, 0xD6}, - {0xe08f, 0xD6}, {0xe094, 0xA2}, {0xe09e, 0x28}, {0xe09f, 0x29}, - {0xe0a0, 0xD0}, {0xe0a6, 0xA2}, {0xe0a7, 0x7C}, {0xe0a8, 0x2F}, - {0xe0ab, 0x7C}, {0xe0ac, 0x47}, {0xe0ad, 0x44}, {0xe0ae, 0x51}, - {0xe0af, 0x4C}, {0xe0b0, 0x58}, {0xe0b1, 0x50}, {0xe0b2, 0x53}, - {0xe0b3, 0x55}, {0xe0b4, 0x46}, {0xe0b5, 0x59}, {0xe0b6, 0x57}, - {0xe0b7, 0x61}, {0xe0b8, 0x62}, {0xe0b9, 0x67}, {0xe0ba, 0x64}, - {0xe0bb, 0x65}, {0xe0bc, 0x7A}, {0xe0bd, 0x68}, {0xe0be, 0x71}, - {0xe0bf, 0x69}, {0xe0c0, 0x6B}, {0xe0c1, 0x6C}, {0xe0c2, 0x6D}, - {0xe0c3, 0x6E}, {0xe0c4, 0x78}, {0xe0c5, 0x6F}, {0xe0c6, 0x70}, - {0xe0c7, 0x72}, {0xe0c8, 0x73}, {0xe0c9, 0x74}, {0xe0ca, 0x75}, - {0xe0cb, 0x66}, {0xe0cc, 0x63}, {0xe0cd, 0x79}, {0xe0ce, 0x77}, - {0xe0cf, 0x65}, {0xe0d0, 0x4A}, {0xe0d1, 0x76}, {0xe0d3, 0x56}, - {0xe0d4, 0x6A}, {0xe0d5, 0xB6}, {0xe0d6, 0x69}, {0xe0db, 0xAC}, - {0xe0dc, 0xAD}, {0xe0dd, 0xAF} -}; - -ExtraTable aTNRExtraTab[] = -{ - {0xe021, 0xA9}, - {0xe022, 0x40}, - {0xe024, 0xAE}, - {0xe035, 0x20}, - {0xe036, '('}, - {0xe037, ')'}, - {0xe039, 0x20}, - {0xe03a, 0x80}, - {0xe080, 0x89}, - {0xe083, '+'}, - {0xe084, '<'}, - {0xe085, '>'}, - {0xe0a9, '\\'} -}; - -StarSymbolToMSMultiFontImpl::StarSymbolToMSMultiFontImpl(bool bPerfectOnly) -{ - struct ConvertTable - { - enum SymbolFont meFont; - const sal_Unicode* pTab; - }; - - //In order of preference - const ConvertTable aConservativeTable[] = - { - {Symbol, aAdobeSymbolTab}, - {Wingdings, aWingDingsTab}, - {MonotypeSorts, aMonotypeSortsTab}, - {Webdings, aWebDingsTab}, - {Wingdings2, aWingDings2Tab}, - {Wingdings3, aWingDings3Tab}, - {MTExtra, aMTExtraTab} - }; - - struct ExtendedConvertTable - { - enum SymbolFont meFont; - const ExtraTable *mpTable; - size_t mnSize; - ExtendedConvertTable(SymbolFont eFont, const ExtraTable *pTable, - size_t nSize) - : meFont(eFont), mpTable(pTable), mnSize(nSize) {} - }; - - //Reverse map from a given starsymbol char to exact matches in ms symbol - //fonts. - int nEntries = sizeof(aConservativeTable) / sizeof(aConservativeTable[0]); - int i; - for (i = 0; i < nEntries; ++i) - { - const ConvertTable& r = aConservativeTable[i]; - SymbolEntry aEntry; - aEntry.eFont = r.meFont; - for (aEntry.cIndex = 0xFF; aEntry.cIndex >= 0x20; --aEntry.cIndex) - { - if (sal_Unicode cChar = r.pTab[aEntry.cIndex-0x20]) - maMagicMap.insert( - ::std::multimap::value_type( - cChar, aEntry)); - } - } - - //In order of preference - const ExtendedConvertTable aAgressiveTable[] = - { - ExtendedConvertTable(Symbol, aSymbolExtraTab2, - sizeof(aSymbolExtraTab2)), - ExtendedConvertTable(Symbol, aSymbolExtraTab, - sizeof(aSymbolExtraTab)), - ExtendedConvertTable(Wingdings, aWingDingsExtraTab, - sizeof(aWingDingsExtraTab)), - ExtendedConvertTable(TimesNewRoman, aTNRExtraTab, - sizeof(aTNRExtraTab)) - }; - - //Allow extra conversions that are not perfect, but "good enough" - if (!bPerfectOnly) - nEntries = sizeof(aAgressiveTable) / sizeof(aAgressiveTable[0]); - else - nEntries = 1; - - for (i = 0; i < nEntries; ++i) - { - const ExtendedConvertTable& r = aAgressiveTable[i]; - SymbolEntry aEntry; - aEntry.eFont = r.meFont; - for (int j = r.mnSize / sizeof(r.mpTable[0]); j >=0; --j) - { - aEntry.cIndex = r.mpTable[j].cMS; - maMagicMap.insert( - ::std::multimap::value_type( - r.mpTable[j].cStar, aEntry)); - } - } -} - -const char *SymbolFontToString(int nResult) -{ - const char **ppName = aSymbolNames; - int nI = Symbol; - while (nI <= nResult) - { - if (!(nI & nResult)) - nI = nI << 1; - else - break; - ppName++; - } - return *ppName; -} - -String StarSymbolToMSMultiFontImpl::ConvertChar(sal_Unicode &rChar) -{ - String sRet; - - ::std::multimap::const_iterator aResult = - maMagicMap.find(rChar); - - if (aResult != maMagicMap.end()) - { - const SymbolEntry &rEntry = (*aResult).second; - sRet.AssignAscii(SymbolFontToString(rEntry.eFont)); - rChar = rEntry.cIndex; - } - - return sRet; -} - -String StarSymbolToMSMultiFontImpl::ConvertString(String &rString, - xub_StrLen& rIndex) -{ - typedef ::std::multimap::iterator MI; - typedef ::std::pair Result; - - String sRet; - - xub_StrLen nLen = rString.Len(); - if (rIndex >= nLen) - return sRet; - - int nTotal = 0, nResult = 0; - ::std::vector aPossibilities; - aPossibilities.reserve(nLen - rIndex); - xub_StrLen nStart = rIndex; - do - { - Result aResult = maMagicMap.equal_range(rString.GetChar(rIndex)); - int nBitfield = 0; - for (MI aIndex = aResult.first; aIndex != aResult.second; ++aIndex) - nBitfield |= aIndex->second.eFont; - - if (!nTotal) - nTotal = nBitfield; - else - { - if (nTotal != nBitfield) //Allow a series of failures - { - nTotal &= nBitfield; - if (!nTotal) - break; - } - } - nResult = nTotal; - if (nResult) //Don't bother storing a series of failures - aPossibilities.push_back(aResult); - ++rIndex; - }while(rIndex < nLen); - - if (nResult) - { - int nI = Symbol; - while (nI <= nResult) - { - if (!(nI & nResult)) - nI = nI << 1; - else - break; - } - sRet.AssignAscii(SymbolFontToString(nI)); - - xub_StrLen nSize = sal::static_int_cast(aPossibilities.size()); - for(xub_StrLen nPos = 0; nPos < nSize; ++nPos) - { - const Result &rResult = aPossibilities[nPos]; - - for (MI aIndex = rResult.first; aIndex != rResult.second; ++aIndex) - { - if (aIndex->second.eFont == nI) - { - rString.SetChar(nPos+nStart, aIndex->second.cIndex); - break; - } - } - } - } - - return sRet; -} - -StarSymbolToMSMultiFont *CreateStarSymbolToMSMultiFont(bool bPerfectOnly) -{ - return new StarSymbolToMSMultiFontImpl(bPerfectOnly); -} - -//======================================================================= - -sal_Unicode ImplRecodeChar( const ImplCvtChar* pConversion, sal_Unicode cChar ) -{ - sal_Unicode cRetVal = 0; - if( pConversion->mpCvtFunc ) - { - // use a conversion function for recoding - cRetVal = pConversion->mpCvtFunc( cChar ); - } - else - { - // use a conversion table for recoding - sal_Unicode cIndex = cChar; - // allow symbol aliasing - if( cIndex & 0xFF00 ) - cIndex -= 0xF000; - // recode the symbol - if( cIndex>=0x0020 && cIndex<=0x00FF ) - cRetVal = pConversion->mpCvtTab[ cIndex - 0x0020 ]; - } - - return cRetVal ? cRetVal : cChar; -} - -// ----------------------------------------------------------------------- - -// recode the string assuming the character codes are symbol codes -// from an traditional symbol font (i.e. U+F020..U+F0FF) -void ImplRecodeString( const ImplCvtChar* pConversion, String& rStr, - xub_StrLen nIndex, xub_StrLen nLen ) -{ - ULONG nLastIndex = (ULONG)nIndex + nLen; - if( nLastIndex > rStr.Len() ) - nLastIndex = rStr.Len(); - - for(; nIndex < nLastIndex; ++nIndex ) - { - sal_Unicode cOrig = rStr.GetChar( nIndex ); - // only recode symbols and their U+00xx aliases - if( ((cOrig < 0x0020) || (cOrig > 0x00FF)) - && ((cOrig < 0xF020) || (cOrig > 0xF0FF)) ) - continue; - - // recode a symbol - sal_Unicode cNew = ImplRecodeChar( pConversion, cOrig ); - if( cOrig != cNew ) - rStr.SetChar( nIndex, cNew ); - } -} - -//======================================================================= - -struct RecodeTable { const char* pOrgName; ImplCvtChar aCvt;}; - -static RecodeTable aRecodeTable[] = -{ - // the first two entries must be StarMath and StarBats; do not reorder! - // reason: fgrep for FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS - {"starbats", {aStarBatsTab, "StarSymbol", NULL}}, - {"starmath", {aStarMathTab, "StarSymbol", NULL}}, - - {"symbol", {aAdobeSymbolTab, "StarSymbol", NULL}}, - {"standardsymbols", {aAdobeSymbolTab, "StarSymbol", NULL}}, - {"standardsymbolsl",{aAdobeSymbolTab, "StarSymbol", NULL}}, - - {"monotypesorts", {aMonotypeSortsTab, "StarSymbol", NULL}}, -// {"monotypesorts2", {aMonotypeSorts2Tab, "StarSymbol", NULL}} - {"zapfdingbats", {aMonotypeSortsTab, "StarSymbol", NULL}}, //ZapfDingbats=MonotypeSorts-X? - {"itczapfdingbats", {aMonotypeSortsTab, "StarSymbol", NULL}}, - {"dingbats", {aMonotypeSortsTab, "StarSymbol", NULL}}, - - {"webdings", {aWebDingsTab, "StarSymbol", NULL}}, - {"wingdings", {aWingDingsTab, "StarSymbol", NULL}}, - {"wingdings2", {aWingDings2Tab, "StarSymbol", NULL}}, - {"wingdings3", {aWingDings3Tab, "StarSymbol", NULL}}, - {"mtextra", {aMTExtraTab, "StarSymbol", NULL}} -}; - -static ImplCvtChar aImplStarSymbolCvt = { NULL, "StarBats", ImplStarSymbolToStarBats }; -#if 0 -// not used -static ImplCvtChar aImplDingBatsCvt = { aMonotypeSortsTab, "StarSymbol", NULL }; -#endif - -// ----------------------------------------------------------------------- - -const ImplCvtChar* ImplGetRecodeData( const String& rOrgFontName, - const String& rMapFontName ) -{ - const ImplCvtChar* pCvt = NULL; - String aOrgName( rOrgFontName ); - ImplGetEnglishSearchFontName( aOrgName ); - String aMapName( rMapFontName ); - ImplGetEnglishSearchFontName( aMapName ); - - if( aMapName.EqualsAscii( "starsymbol" ) - || aMapName.EqualsAscii( "opensymbol" ) ) - { - int nEntries = sizeof(aRecodeTable) / sizeof(aRecodeTable[0]); - for( int i = 0; i < nEntries; ++i) - { - RecodeTable& r = aRecodeTable[i]; - if( aOrgName.EqualsAscii( r.pOrgName ) ) - { pCvt = &r.aCvt; break; } - } - } - else if( aMapName.EqualsAscii( "starbats" ) ) - { - if( aOrgName.EqualsAscii( "starsymbol" ) ) - pCvt = &aImplStarSymbolCvt; - else if( aOrgName.EqualsAscii( "opensymbol" ) ) - pCvt = &aImplStarSymbolCvt; - } - - return pCvt; -} - -//======================================================================= - -FontToSubsFontConverter CreateFontToSubsFontConverter( - const String& rOrgName, ULONG nFlags ) -{ - const ImplCvtChar* pCvt = NULL; - - String aName = rOrgName; - ImplGetEnglishSearchFontName( aName ); - - if ( nFlags & FONTTOSUBSFONT_IMPORT ) - { - int nEntries = sizeof(aRecodeTable) / sizeof(aRecodeTable[0]); - if ( nFlags & FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ) // only StarMath+StarBats - nEntries = 2; - for( int i = 0; i < nEntries; ++i ) - { - RecodeTable& r = aRecodeTable[i]; - if( aName.EqualsAscii( r.pOrgName ) ) - { pCvt = &r.aCvt; break; } - } - } - else - { - // TODO: FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS - if( aName.EqualsAscii( "starsymbol" ) ) pCvt = &aImplStarSymbolCvt; - else if( aName.EqualsAscii( "opensymbol" ) ) pCvt = &aImplStarSymbolCvt; - } - - return (FontToSubsFontConverter)pCvt; -} - -// ----------------------------------------------------------------------- - -void DestroyFontToSubsFontConverter( FontToSubsFontConverter ) -{ - // nothing to do for now, because we use static ImplCvtChars -} - -// ----------------------------------------------------------------------- - -sal_Unicode ConvertFontToSubsFontChar( - FontToSubsFontConverter hConverter, sal_Unicode cChar ) -{ - if ( hConverter ) - return ImplRecodeChar( (ImplCvtChar*)hConverter, cChar ); - else - return cChar; -} - -// ----------------------------------------------------------------------- - -String GetFontToSubsFontName( FontToSubsFontConverter hConverter ) -{ - if ( !hConverter ) - return String(); - - const char* pName = ((ImplCvtChar*)hConverter)->mpSubsFontName; - return String::CreateFromAscii( pName ); -} diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk index a09ae92dcb5e..d55dec36b65c 100644 --- a/vcl/source/gdi/makefile.mk +++ b/vcl/source/gdi/makefile.mk @@ -59,8 +59,9 @@ SLOFILES= $(SLO)$/salmisc.obj \ $(SLO)$/bitmap3.obj \ $(SLO)$/bitmap4.obj \ $(SLO)$/alpha.obj \ + $(SLO)$/configsettings.obj \ $(SLO)$/bitmapex.obj \ - $(SLO)$/imgcons.obj \ + $(SLO)$/imgcons.obj \ $(SLO)$/bmpacc.obj \ $(SLO)$/bmpacc2.obj \ $(SLO)$/bmpacc3.obj \ @@ -96,13 +97,11 @@ SLOFILES= $(SLO)$/salmisc.obj \ $(SLO)$/outdev5.obj \ $(SLO)$/outdev6.obj \ $(SLO)$/virdev.obj \ - $(SLO)$/fontcvt.obj \ $(SLO)$/print.obj \ $(SLO)$/print2.obj \ $(SLO)$/regband.obj \ $(SLO)$/region.obj \ $(SLO)$/wall.obj \ - $(SLO)$/fontcfg.obj \ $(SLO)$/base14.obj \ $(SLO)$/pdfwriter.obj \ $(SLO)$/pdfwriter_impl.obj \ diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 0a7a8b765b6b..ff8947069060 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -56,10 +56,10 @@ #include #include #include -#include +#include #include #include -#include +#include #include #ifndef _OSL_FILE_H #include @@ -96,6 +96,7 @@ #include #include + // ======================================================================= DBG_NAMEEX( OutputDevice ) @@ -107,6 +108,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::rtl; using namespace ::vcl; +using namespace ::utl; // ======================================================================= @@ -304,451 +306,6 @@ void OutputDevice::ImplUpdateAllFontData( bool bNewFontLists ) // ======================================================================= -struct ImplLocalizedFontName -{ - const char* mpEnglishName; - const sal_Unicode* mpLocalizedNames; -}; - -static sal_Unicode const aBatang[] = { 0xBC14, 0xD0D5, 0, 0 }; -static sal_Unicode const aBatangChe[] = { 0xBC14, 0xD0D5, 0xCCB4, 0, 0 }; -static sal_Unicode const aGungsuh[] = { 0xAD81, 0xC11C, 0, 0 }; -static sal_Unicode const aGungsuhChe[] = { 0xAD81, 0xC11C, 0xCCB4, 0, 0 }; -static sal_Unicode const aGulim[] = { 0xAD74, 0xB9BC, 0, 0 }; -static sal_Unicode const aGulimChe[] = { 0xAD74, 0xB9BC, 0xCCB4, 0, 0 }; -static sal_Unicode const aDotum[] = { 0xB3CB, 0xC6C0, 0, 0 }; -static sal_Unicode const aDotumChe[] = { 0xB3CB, 0xC6C0, 0xCCB4, 0, 0 }; -static sal_Unicode const aSimSun[] = { 0x5B8B, 0x4F53, 0, 0 }; -static sal_Unicode const aNSimSun[] = { 0x65B0, 0x5B8B, 0x4F53, 0, 0 }; -static sal_Unicode const aSimHei[] = { 0x9ED1, 0x4F53, 0, 0 }; -static sal_Unicode const aSimKai[] = { 0x6977, 0x4F53, 0, 0 }; -static sal_Unicode const azycjkSun[] = { 0x4E2D, 0x6613, 0x5B8B, 0x4F53, 0, 0 }; -static sal_Unicode const azycjkHei[] = { 0x4E2D, 0x6613, 0x9ED1, 0x4F53, 0, 0 }; -static sal_Unicode const azycjkKai[] = { 0x4E2D, 0x6613, 0x6977, 0x4F53, 0, 0 }; -static sal_Unicode const aFZHei[] = { 0x65B9, 0x6B63, 0x9ED1, 0x4F53, 0, 0 }; -static sal_Unicode const aFZKai[] = { 0x65B9, 0x6B63, 0x6977, 0x4F53, 0, 0 }; -static sal_Unicode const aFZSongYI[] = { 0x65B9, 0x6B63, 0x5B8B, 0x4E00, 0, 0 }; -static sal_Unicode const aFZShuSong[] = { 0x65B9, 0x6B63, 0x4E66, 0x5B8B, 0, 0 }; -static sal_Unicode const aFZFangSong[] = { 0x65B9, 0x6B63, 0x4EFF, 0x5B8B, 0, 0 }; -// Attention: this fonts includes the wrong encoding vector - so we double the names with correct and wrong encoding -// First one is the GB-Encoding (we think the correct one), second is the big5 encoded name -static sal_Unicode const aMHei[] = { 'm', 0x7B80, 0x9ED1, 0, 'm', 0x6F60, 0x7AAA, 0, 0 }; -static sal_Unicode const aMKai[] = { 'm', 0x7B80, 0x6977, 0x566C, 0, 'm', 0x6F60, 0x7FF1, 0x628E, 0, 0 }; -static sal_Unicode const aMSong[] = { 'm', 0x7B80, 0x5B8B, 0, 'm', 0x6F60, 0x51BC, 0, 0 }; -static sal_Unicode const aCFangSong[] = { 'm', 0x7B80, 0x592B, 0x5B8B, 0, 'm', 0x6F60, 0x6E98, 0x51BC, 0, 0 }; -static sal_Unicode const aMingLiU[] = { 0x7D30, 0x660E, 0x9AD4, 0, 0 }; -static sal_Unicode const aPMingLiU[] = { 0x65B0, 0x7D30, 0x660E, 0x9AD4, 0, 0 }; -static sal_Unicode const aHei[] = { 0x6865, 0, 0 }; -static sal_Unicode const aKai[] = { 0x6B61, 0, 0 }; -static sal_Unicode const aMing[] = { 0x6D69, 0x6E67, 0, 0 }; -static sal_Unicode const aMSGothic[] = { 'm','s', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; -static sal_Unicode const aMSPGothic[] = { 'm','s','p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; -static sal_Unicode const aMSMincho[] = { 'm', 's', 0x660E, 0x671D, 0 }; -static sal_Unicode const aMSPMincho[] = { 'm','s','p', 0x660E, 0x671D, 0 }; -static sal_Unicode const aMeiryo[] = { 0x30e1, 0x30a4, 0x30ea, 0x30aa, 0 }; -static sal_Unicode const aHGMinchoL[] = { 'h','g', 0x660E, 0x671D, 'l', 0, 0 }; -static sal_Unicode const aHGGothicB[] = { 'h','g', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 0 }; -static sal_Unicode const aHGPMinchoL[] = { 'h','g','p', 0x660E, 0x671D, 'l', 0 }; -static sal_Unicode const aHGPGothicB[] = { 'h','g','p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 0 }; -static sal_Unicode const aHGMinchoLSun[] = { 'h','g', 0x660E, 0x671D, 'l', 's', 'u', 'n', 0 }; -static sal_Unicode const aHGPMinchoLSun[] = { 'h','g','p', 0x660E, 0x671D, 'l', 's', 'u', 'n', 0 }; -static sal_Unicode const aHGGothicBSun[] = { 'h', 'g', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 's', 'u', 'n', 0 }; -static sal_Unicode const aHGPGothicBSun[] = { 'h', 'g', 'p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 's', 'u', 'n', 0 }; -static sal_Unicode const aHGHeiseiMin[] = { 'h', 'g', 0x5E73, 0x6210, 0x660E, 0x671D, 0x4F53, 0, 'h', 'g', 0x5E73, 0x6210, 0x660E, 0x671D, 0x4F53, 'w', '3', 'x', '1', '2', 0, 0 }; -static sal_Unicode const aIPAMincho[] = { 'i', 'p', 'a', 0x660E, 0x671D, 0 }; -static sal_Unicode const aIPAPMincho[] = { 'i', 'p', 'a', 'p', 0x660E, 0x671D, 0 }; -static sal_Unicode const aIPAGothic[] = { 'i', 'p', 'a', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 }; -static sal_Unicode const aIPAPGothic[] = { 'i', 'p', 'a', 'p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 }; -static sal_Unicode const aIPAUIGothic[] = { 'i', 'p', 'a', 'u', 'i', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 }; -static sal_Unicode const aSazanamiMincho[] = { 0x3055, 0x3056, 0x306A, 0x307F, 0x660E, 0x671D, 0, 0 }; -static sal_Unicode const aSazanamiGothic[] = { 0x3055, 0x3056, 0x306A, 0x307F, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; -static sal_Unicode const aKochiMincho[] = { 0x6771, 0x98A8, 0x660E, 0x671D, 0, 0 }; -static sal_Unicode const aKochiGothic[] = { 0x6771, 0x98A8, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; -static sal_Unicode const aSunDotum[] = { 0xC36C, 0xB3CB, 0xC6C0, 0, 0 }; -static sal_Unicode const aSunGulim[] = { 0xC36C, 0xAD74, 0xB9BC, 0, 0 }; -static sal_Unicode const aSunBatang[] = { 0xC36C, 0xBC14, 0xD0D5, 0, 0 }; -static sal_Unicode const aBaekmukDotum[] = { 0xBC31, 0xBB35, 0xB3CB, 0xC6C0, 0, 0 }; -static sal_Unicode const aBaekmukGulim[] = { 0xBC31, 0xBB35, 0xAD74, 0xB9BC, 0, 0 }; -static sal_Unicode const aBaekmukBatang[] = { 0xBC31, 0xBB35, 0xBC14, 0xD0D5, 0, 0 }; -static sal_Unicode const aFzMingTi[] = { 0x65B9, 0x6B63, 0x660E, 0x9AD4, 0, 0 }; -static sal_Unicode const aFzHeiTiTW[]= { 0x65B9, 0x6B63, 0x9ED1, 0x9AD4, 0, 0 }; -static sal_Unicode const aFzKaiTiTW[]= { 0x65B9, 0x6B63, 0x6977, 0x9AD4, 0, 0 }; -static sal_Unicode const aFzHeiTiCN[]= { 0x65B9, 0x6B63, 0x9ED1, 0x4F53, 0, 0 }; -static sal_Unicode const aFzKaiTiCN[]= { 0x65B9, 0x6B63, 0x6977, 0x4F53, 0, 0 }; -static sal_Unicode const aFzSongTi[] = { 0x65B9, 0x6B63, 0x5B8B, 0x4F53, 0, 0 }; -static sal_Unicode const aHYMyeongJoExtra[] = { 'h', 'y', 0xACAC, 0xBA85, 0xC870, 0, 0 }; -static sal_Unicode const aHYSinMyeongJoMedium[] = { 'h', 'y', 0xC2E0, 0xBA85, 0xC870, 0, 0 }; -static sal_Unicode const aHYGothicMedium[] = { 'h', 'y', 0xC911, 0xACE0, 0xB515, 0, 0 }; -static sal_Unicode const aHYGraphicMedium[] = { 'h', 'y', 0xADF8, 0xB798, 0xD53D, 'm', 0, 0 }; -static sal_Unicode const aHYGraphic[] = { 'h', 'y', 0xADF8, 0xB798, 0xD53D, 0, 0 }; -static sal_Unicode const aNewGulim[] = { 0xC0C8, 0xAD74, 0xB9BC, 0, 0 }; -static sal_Unicode const aSunGungseo[] = { 0xC36C, 0xAD81, 0xC11C, 0, 0 }; -static sal_Unicode const aHYGungSoBold[] = { 'h','y', 0xAD81, 0xC11C, 'b', 0, 0 }; -static sal_Unicode const aHYGungSo[] = { 'h','y', 0xAD81, 0xC11C, 0, 0 }; -static sal_Unicode const aSunHeadLine[] = { 0xC36C, 0xD5E4, 0xB4DC, 0xB77C, 0xC778, 0, 0 }; -static sal_Unicode const aHYHeadLineMedium[] = { 'h', 'y', 0xD5E4, 0xB4DC, 0xB77C, 0xC778, 'm', 0, 0 }; -static sal_Unicode const aHYHeadLine[] = { 'h', 'y', 0xD5E4, 0xB4DC, 0xB77C, 0xC778, 0, 0 }; -static sal_Unicode const aYetR[] = { 0xD734, 0xBA3C, 0xC61B, 0xCCB4, 0, 0 }; -static sal_Unicode const aHYGothicExtra[] = { 'h', 'y', 0xACAC, 0xACE0, 0xB515, 0, 0 }; -static sal_Unicode const aSunMokPan[] = { 0xC36C, 0xBAA9, 0xD310, 0, 0 }; -static sal_Unicode const aSunYeopseo[] = { 0xC36C, 0xC5FD, 0xC11C, 0, 0 }; -static sal_Unicode const aSunBaekSong[] = { 0xC36C, 0xBC31, 0xC1A1, 0, 0 }; -static sal_Unicode const aHYPostLight[] = { 'h', 'y', 0xC5FD, 0xC11C, 'l', 0, 0 }; -static sal_Unicode const aHYPost[] = { 'h', 'y', 0xC5FD, 0xC11C, 0, 0 }; -static sal_Unicode const aMagicR[] = { 0xD734, 0xBA3C, 0xB9E4, 0xC9C1, 0xCCB4, 0, 0 }; -static sal_Unicode const aSunCrystal[] = { 0xC36C, 0xD06C, 0xB9AC, 0xC2A4, 0xD0C8, 0, 0 }; -static sal_Unicode const aSunSaemmul[] = { 0xC36C, 0xC0D8, 0xBB3C, 0, 0 }; -static sal_Unicode const aHaansoftBatang[] = { 0xD55C, 0xCEF4, 0xBC14, 0xD0D5, 0, 0 }; -static sal_Unicode const aHaansoftDotum[] = { 0xD55C, 0xCEF4, 0xB3CB, 0xC6C0, 0, 0 }; -static sal_Unicode const aHyhaeseo[] = { 0xD55C, 0xC591, 0xD574, 0xC11C, 0, 0 }; -static sal_Unicode const aMDSol[] = { 'm', 'd', 0xC194, 0xCCB4, 0, 0 }; -static sal_Unicode const aMDGaesung[] = { 'm', 'd', 0xAC1C, 0xC131, 0xCCB4, 0, 0 }; -static sal_Unicode const aMDArt[] = { 'm', 'd', 0xC544, 0xD2B8, 0xCCB4, 0, 0 }; -static sal_Unicode const aMDAlong[] = { 'm', 'd', 0xC544, 0xB871, 0xCCB4, 0, 0 }; -static sal_Unicode const aMDEasop[] = { 'm', 'd', 0xC774, 0xC19D, 0xCCB4, 0, 0 }; -static sal_Unicode const aHYShortSamulMedium[] = { 'h', 'y', 0xC595, 0xC740, 0xC0D8, 0xBB3C, 'm', 0 }; -static sal_Unicode const aHYShortSamul[] = { 'h', 'y', 0xC595, 0xC740, 0xC0D8, 0xBB3C, 0 }; -static sal_Unicode const aHGGothicE[] = { 'h','g', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'e', 0 }; -static sal_Unicode const aHGPGothicE[] = { 'h','g','p', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'e', 0 }; -static sal_Unicode const aHGSGothicE[] = { 'h','g','s', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'e', 0 }; -static sal_Unicode const aHGGothicM[] = { 'h','g', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'm', 0 }; -static sal_Unicode const aHGPGothicM[] = { 'h','g','p', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'm', 0 }; -static sal_Unicode const aHGSGothicM[] = { 'h','g','s', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'm', 0 }; -static sal_Unicode const aHGGyoshotai[] = { 'h','g', 0x884C, 0x66F8, 0x4F53, 0 }; -static sal_Unicode const aHGPGyoshotai[] = { 'h','g','p', 0x884C, 0x66F8, 0x4F53, 0 }; -static sal_Unicode const aHGSGyoshotai[] = { 'h','g','s', 0x884C, 0x66F8, 0x4F53, 0 }; -static sal_Unicode const aHGKyokashotai[] = { 'h','g', 0x6559, 0x79D1, 0x66F8, 0x4F53, 0 }; -static sal_Unicode const aHGPKyokashotai[] = { 'h','g','p', 0x6559, 0x79D1, 0x66F8, 0x4F53, 0 }; -static sal_Unicode const aHGSKyokashotai[] = { 'h','g','s', 0x6559, 0x79D1, 0x66F8, 0x4F53, 0 }; -static sal_Unicode const aHGMinchoB[] = { 'h','g', 0x660E, 0x671D, 'b', 0 }; -static sal_Unicode const aHGPMinchoB[] = { 'h','g','p', 0x660E, 0x671D, 'b', 0 }; -static sal_Unicode const aHGSMinchoB[] = { 'h','g','s', 0x660E, 0x671D, 'b', 0 }; -static sal_Unicode const aHGMinchoE[] = { 'h','g', 0x660E, 0x671D, 'e', 0 }; -static sal_Unicode const aHGPMinchoE[] = { 'h','g','p', 0x660E, 0x671D, 'e', 0 }; -static sal_Unicode const aHGSMinchoE[] = { 'h','g','s', 0x660E, 0x671D, 'e', 0 }; -static sal_Unicode const aHGSoeiKakupoptai[] = { 'h','g', 0x5275,0x82F1,0x89D2,0xFF8E, - 0xFF9F,0xFF6F,0xFF8C,0xFF9F,0x4F53,0}; -static sal_Unicode const aHGPSoeiKakupoptai[] = { 'h','g', 'p', 0x5275,0x82F1,0x89D2,0xFF8E, - 0xFF9F,0xFF6F,0xFF8C,0xFF9F,0x4F53,0}; -static sal_Unicode const aHGSSoeiKakupoptai[] = { 'h','g', 's', 0x5275,0x82F1,0x89D2,0xFF8E, - 0xFF9F,0xFF6F,0xFF8C,0xFF9F,0x4F53,0}; -static sal_Unicode const aHGSoeiPresenceEB[] = { 'h','g', 0x5275,0x82F1,0xFF8C,0xFF9F, - 0xFF9A,0xFF7E,0xFF9E,0xFF9D,0xFF7D, 'e','b',0}; -static sal_Unicode const aHGPSoeiPresenceEB[] = { 'h','g','p', 0x5275,0x82F1,0xFF8C,0xFF9F, - 0xFF9A,0xFF7E,0xFF9E,0xFF9D,0xFF7D, 'e','b',0}; -static sal_Unicode const aHGSSoeiPresenceEB[] = { 'h','g','s', 0x5275,0x82F1,0xFF8C,0xFF9F, - 0xFF9A,0xFF7E,0xFF9E,0xFF9D,0xFF7D, 'e','b',0}; -static sal_Unicode const aHGSoeiKakugothicUB[] = { 'h','g', 0x5275,0x82F1,0x89D2,0xFF7A, - 0xFF9E,0xFF7C,0xFF6F,0xFF78,'u','b',0}; -static sal_Unicode const aHGPSoeiKakugothicUB[] = { 'h','g','p', 0x5275,0x82F1,0x89D2,0xFF7A, - 0xFF9E,0xFF7C,0xFF6F,0xFF78,'u','b',0}; -static sal_Unicode const aHGSSoeiKakugothicUB[] = { 'h','g','s', 0x5275,0x82F1,0x89D2,0xFF7A, - 0xFF9E,0xFF7C,0xFF6F,0xFF78,'u','b',0}; -static sal_Unicode const aHGSeikaishotaiPRO[] = { 'h','g', 0x6B63,0x6977,0x66F8,0x4F53, '-','p','r','o',0}; -static sal_Unicode const aHGMaruGothicMPRO[] = { 'h','g', 0x4E38,0xFF7A,0xFF9E,0xFF7C,0xFF6F,0xFF78, '-','p','r','o',0}; -static sal_Unicode const aHiraginoMinchoPro[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x660E, 0x671D, 'p','r','o',0}; -static sal_Unicode const aHiraginoMinchoProN[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x660E, 0x671D, 'p','r','o','n',0}; -static sal_Unicode const aHiraginoKakuGothicPro[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x89D2, 0x30B4, 'p','r','o',0}; -static sal_Unicode const aHiraginoKakuGothicProN[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x89D2, 0x30B4, 'p','r','o','n',0}; -static sal_Unicode const aHiraginoMaruGothicPro[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o',0}; -static sal_Unicode const aHiraginoMaruGothicProN[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o','n',0}; - - -static ImplLocalizedFontName aImplLocalizedNamesList[] = -{ -{ "batang", aBatang }, -{ "batangche", aBatangChe }, -{ "gungshu", aGungsuh }, -{ "gungshuche", aGungsuhChe }, -{ "gulim", aGulim }, -{ "gulimche", aGulimChe }, -{ "dotum", aDotum }, -{ "dotumche", aDotumChe }, -{ "simsun", aSimSun }, -{ "nsimsun", aNSimSun }, -{ "simhei", aSimHei }, -{ "simkai", aSimKai }, -{ "zycjksun", azycjkSun }, -{ "zycjkhei", azycjkHei }, -{ "zycjkkai", azycjkKai }, -{ "fzhei", aFZHei }, -{ "fzkai", aFZKai }, -{ "fzsong", aFZSongYI }, -{ "fzshusong", aFZShuSong }, -{ "fzfangsong", aFZFangSong }, -{ "mhei", aMHei }, -{ "mkai", aMKai }, -{ "msong", aMSong }, -{ "cfangsong", aCFangSong }, -{ "mingliu", aMingLiU }, -{ "pmingliu", aPMingLiU }, -{ "hei", aHei }, -{ "kai", aKai }, -{ "ming", aMing }, -{ "msgothic", aMSGothic }, -{ "mspgothic", aMSPGothic }, -{ "msmincho", aMSMincho }, -{ "mspmincho", aMSPMincho }, -{ "meiryo", aMeiryo }, -{ "hgminchol", aHGMinchoL }, -{ "hggothicb", aHGGothicB }, -{ "hgpminchol", aHGPMinchoL }, -{ "hgpgothicb", aHGPGothicB }, -{ "hgmincholsun", aHGMinchoLSun }, -{ "hggothicbsun", aHGGothicBSun }, -{ "hgpmincholsun", aHGPMinchoLSun }, -{ "hgpgothicbsun", aHGPGothicBSun }, -{ "hgheiseimin", aHGHeiseiMin }, -{ "ipamincho", aIPAMincho }, -{ "ipapmincho", aIPAPMincho }, -{ "ipagothic", aIPAGothic }, -{ "ipapgothic", aIPAPGothic }, -{ "ipauigothic", aIPAUIGothic }, -{ "sazanamimincho", aSazanamiMincho }, -{ "sazanamigothic", aSazanamiGothic }, -{ "kochimincho", aKochiMincho }, -{ "kochigothic", aKochiGothic }, -{ "sundotum", aSunDotum }, -{ "sungulim", aSunGulim }, -{ "sunbatang", aSunBatang }, -{ "baekmukdotum", aBaekmukDotum }, -{ "baekmukgulim", aBaekmukGulim }, -{ "baekmukbatang", aBaekmukBatang }, -{ "fzheiti", aFzHeiTiCN }, -{ "fzheiti", aFzHeiTiTW }, -{ "fzkaiti", aFzKaiTiCN }, -{ "fzkaitib", aFzKaiTiTW }, -{ "fzmingtib", aFzMingTi }, -{ "fzsongti", aFzSongTi }, -{ "hymyeongjoextra", aHYMyeongJoExtra }, -{ "hysinmyeongjomedium", aHYSinMyeongJoMedium }, -{ "hygothicmedium", aHYGothicMedium }, -{ "hygraphicmedium", aHYGraphicMedium }, -{ "hygraphic", aHYGraphic }, -{ "newgulim", aNewGulim }, -{ "sungungseo", aSunGungseo }, -{ "hygungsobold", aHYGungSoBold }, -{ "hygungso", aHYGungSo }, -{ "sunheadline", aSunHeadLine }, -{ "hyheadlinemedium", aHYHeadLineMedium }, -{ "hyheadline", aHYHeadLine }, -{ "yetr", aYetR }, -{ "hygothicextra", aHYGothicExtra }, -{ "sunmokpan", aSunMokPan }, -{ "sunyeopseo", aSunYeopseo }, -{ "sunbaeksong", aSunBaekSong }, -{ "hypostlight", aHYPostLight }, -{ "hypost", aHYPost }, -{ "magicr", aMagicR }, -{ "suncrystal", aSunCrystal }, -{ "sunsaemmul", aSunSaemmul }, -{ "hyshortsamulmedium", aHYShortSamulMedium }, -{ "hyshortsamul", aHYShortSamul }, -{ "haansoftbatang", aHaansoftBatang }, -{ "haansoftdotum", aHaansoftDotum }, -{ "hyhaeseo", aHyhaeseo }, -{ "mdsol", aMDSol }, -{ "mdgaesung", aMDGaesung }, -{ "mdart", aMDArt }, -{ "mdalong", aMDAlong }, -{ "mdeasop", aMDEasop }, -{ "hggothice", aHGGothicE }, -{ "hgpgothice", aHGPGothicE }, -{ "hgpothice", aHGSGothicE }, -{ "hggothicm", aHGGothicM }, -{ "hgpgothicm", aHGPGothicM }, -{ "hgpgothicm", aHGSGothicM }, -{ "hggyoshotai", aHGGyoshotai }, -{ "hgpgyoshotai", aHGPGyoshotai }, -{ "hgsgyoshotai", aHGSGyoshotai }, -{ "hgkyokashotai", aHGKyokashotai }, -{ "hgpkyokashotai", aHGPKyokashotai }, -{ "hgskyokashotai", aHGSKyokashotai }, -{ "hgminchob", aHGMinchoB }, -{ "hgpminchob", aHGPMinchoB }, -{ "hgsminchob", aHGSMinchoB }, -{ "hgminchoe", aHGMinchoE }, -{ "hgpminchoe", aHGPMinchoE }, -{ "hgsminchoe", aHGSMinchoE }, -{ "hgsoeikakupoptai", aHGSoeiKakupoptai }, -{ "hgpsoeikakupopta", aHGPSoeiKakupoptai }, -{ "hgssoeikakupopta", aHGSSoeiKakupoptai }, -{ "hgsoeipresenceeb", aHGSoeiPresenceEB }, -{ "hgpsoeipresenceeb", aHGPSoeiPresenceEB }, -{ "hgssoeipresenceeb", aHGSSoeiPresenceEB }, -{ "hgsoeikakugothicub", aHGSoeiKakugothicUB }, -{ "hgpsoeikakugothicub", aHGPSoeiKakugothicUB }, -{ "hgssoeikakugothicub", aHGSSoeiKakugothicUB }, -{ "hgseikaishotaipro", aHGSeikaishotaiPRO }, -{ "hgmarugothicmpro", aHGMaruGothicMPRO }, -{ "hiraginominchopro", aHiraginoMinchoPro }, -{ "hiraginominchopron", aHiraginoMinchoProN }, -{ "hiraginokakugothicpro", aHiraginoKakuGothicPro }, -{ "hiraginokakugothicpron", aHiraginoKakuGothicProN }, -{ "hiraginomarugothicpro", aHiraginoMaruGothicPro }, -{ "hiraginomarugothicpron", aHiraginoMaruGothicProN }, -{ NULL, NULL }, -}; - -// ----------------------------------------------------------------------- - -void ImplGetEnglishSearchFontName( String& rName ) -{ - bool bNeedTranslation = false; - xub_StrLen nLen = rName.Len(); - - // Remove trailing whitespaces - xub_StrLen i = nLen; - while ( i && (rName.GetChar( i-1 ) < 32) ) - i--; - if ( i != nLen ) - rName.Erase( i ); - - // Remove Script at the end - // Scriptname must be the last part of the fontname and - // looks like "fontname (scriptname)". So there can only be a - // script name at the and of the fontname, when the last char is ')' - if ( (nLen >= 3) && rName.GetChar( nLen-1 ) == ')' ) - { - int nOpen = 1; - xub_StrLen nTempLen = nLen-2; - while ( nTempLen ) - { - if ( rName.GetChar( nTempLen ) == '(' ) - { - nOpen--; - if ( !nOpen ) - { - // Remove Space at the end - if ( nTempLen && (rName.GetChar( nTempLen-1 ) == ' ') ) - nTempLen--; - rName.Erase( nTempLen ); - nLen = nTempLen; - break; - } - } - if ( rName.GetChar( nTempLen ) == ')' ) - nOpen++; - nTempLen--; - } - } - - // remove all whitespaces and converts to lower case ASCII - // TODO: better transliteration to ASCII e.g. all digits - i = 0; - while ( i < nLen ) - { - sal_Unicode c = rName.GetChar( i ); - if ( c > 127 ) - { - // Translate to Lowercase-ASCII - // FullWidth-ASCII to half ASCII - if ( (c >= 0xFF00) && (c <= 0xFF5E) ) - { - c -= 0xFF00-0x0020; - // Upper to Lower - if ( (c >= 'A') && (c <= 'Z') ) - c += 'a' - 'A'; - rName.SetChar( i, c ); - } - else - { - // Only Fontnames with None-Ascii-Characters must be translated - bNeedTranslation = true; - } - } - // not lowercase Ascii - else if ( !((c >= 'a') && (c <= 'z')) ) - { - // To Lowercase-Ascii - if ( (c >= 'A') && (c <= 'Z') ) - { - c += 'a' - 'A'; - rName.SetChar( i, c ); - } - else if( ((c < '0') || (c > '9')) && (c != ';') ) // not 0-9 or semicolon - { - // Remove white spaces and special characters - rName.Erase( i, 1 ); - nLen--; - continue; - } - } - - i++; - } - - // translate normalized localized name to its normalized English ASCII name - if( bNeedTranslation ) - { - typedef std::hash_map FontNameDictionary; - static FontNameDictionary aDictionary( sizeof(aImplLocalizedNamesList) / sizeof(*aImplLocalizedNamesList) ); - // the font name dictionary needs to be intialized once - if( aDictionary.empty() ) - { - // TODO: check if all dictionary entries are already normalized? - const ImplLocalizedFontName* pList = aImplLocalizedNamesList; - for(; pList->mpEnglishName; ++pList ) - aDictionary[ pList->mpLocalizedNames ] = pList->mpEnglishName; - } - - FontNameDictionary::const_iterator it = aDictionary.find( rName ); - if( it != aDictionary.end() ) - rName.AssignAscii( it->second ); - } -} - -// ----------------------------------------------------------------------- - -static String GetNextFontToken( const String& rTokenStr, xub_StrLen& rIndex ) -{ - // check for valid start index - int nStringLen = rTokenStr.Len(); - if( rIndex >= nStringLen ) - { - rIndex = STRING_NOTFOUND; - return String(); - } - - // find the next token delimiter and return the token substring - const sal_Unicode* pStr = rTokenStr.GetBuffer() + rIndex; - const sal_Unicode* pEnd = rTokenStr.GetBuffer() + nStringLen; - for(; pStr < pEnd; ++pStr ) - if( (*pStr == ';') || (*pStr == ',') ) - break; - - xub_StrLen nTokenStart = rIndex; - xub_StrLen nTokenLen; - if( pStr < pEnd ) - { - rIndex = sal::static_int_cast(pStr - rTokenStr.GetBuffer()); - nTokenLen = rIndex - nTokenStart; - ++rIndex; // skip over token separator - } - else - { - // no token delimiter found => handle last token - rIndex = STRING_NOTFOUND; - nTokenLen = STRING_LEN; - - // optimize if the token string consists of just one token - if( !nTokenStart ) - return rTokenStr; - } - - return String( rTokenStr, nTokenStart, nTokenLen ); -} - -// TODO: get rid of this in another incompatible build with SW project. -// SW's WW8 and RTF filters still use this (from fontcvt.hxx) -String GetFontToken( const String& rTokenStr, xub_StrLen nToken, xub_StrLen& rIndex ) -{ - // skip nToken Tokens - for( xub_StrLen i = 0; (i < nToken) && (rIndex != STRING_NOTFOUND); ++i ) - GetNextFontToken( rTokenStr, rIndex ); - - return GetNextFontToken( rTokenStr, rIndex ); -} // ======================================================================= @@ -812,8 +369,8 @@ ImplFontSubstEntry::ImplFontSubstEntry( const String& rFontName, { maSearchName = rFontName; maSearchReplaceName = rSubstFontName; - ImplGetEnglishSearchFontName( maSearchName ); - ImplGetEnglishSearchFontName( maSearchReplaceName ); + GetEnglishSearchFontName( maSearchName ); + GetEnglishSearchFontName( maSearchReplaceName ); } // ----------------------------------------------------------------------- @@ -913,7 +470,7 @@ static void ImplFontSubstitute( String& rFontName, { #ifdef DBG_UTIL String aTempName = rFontName; - ImplGetEnglishSearchFontName( aTempName ); + GetEnglishSearchFontName( aTempName ); DBG_ASSERT( aTempName == rFontName, "ImplFontSubstitute() called without a searchname" ); #endif @@ -938,44 +495,6 @@ static void ImplFontSubstitute( String& rFontName, } } -// ======================================================================= - -static bool ImplIsFontToken( const String& rName, const String& rToken ) -{ - String aTempName; - xub_StrLen nIndex = 0; - do - { - aTempName = GetNextFontToken( rName, nIndex ); - if ( rToken == aTempName ) - return true; - } - while ( nIndex != STRING_NOTFOUND ); - - return false; -} - -// ----------------------------------------------------------------------- - -static void ImplAppendFontToken( String& rName, const String& rNewToken ) -{ - if ( rName.Len() ) - { - rName.Append( ';' ); - rName.Append( rNewToken ); - } - else - rName = rNewToken; -} - -// ----------------------------------------------------------------------- - -static void ImplAddTokenFontName( String& rName, const String& rNewToken ) -{ - if ( !ImplIsFontToken( rName, rNewToken ) ) - ImplAppendFontToken( rName, rNewToken ); -} - // ----------------------------------------------------------------------- Font OutputDevice::GetDefaultFont( USHORT nType, LanguageType eLang, @@ -993,7 +512,7 @@ Font OutputDevice::GetDefaultFont( USHORT nType, LanguageType eLang, MsLangId::convertLanguageToLocale( eLang, aLocale ); } - DefaultFontConfiguration& rDefaults = *DefaultFontConfiguration::get(); + utl::DefaultFontConfiguration& rDefaults = *utl::DefaultFontConfiguration::get(); String aSearch = rDefaults.getUserInterfaceFont( aLocale ); // ensure a fallback String aDefault = rDefaults.getDefaultFont( aLocale, nType ); if( aDefault.Len() ) @@ -1072,11 +591,11 @@ Font OutputDevice::GetDefaultFont( USHORT nType, LanguageType eLang, do { aSearchName = GetNextFontToken( aSearch, nIndex ); - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); ImplDevFontListData* pFontFamily = pOutDev->mpFontList->ImplFindBySearchName( aSearchName ); if( pFontFamily ) { - ImplAddTokenFontName( aName, pFontFamily->GetFamilyName() ); + AddTokenFontName( aName, pFontFamily->GetFamilyName() ); if( nFlags & DEFAULTFONT_FLAGS_ONLYONE ) break; } @@ -1176,61 +695,6 @@ Font OutputDevice::GetDefaultFont( USHORT nType, LanguageType eLang, // ======================================================================= -String GetSubsFontName( const String& rName, ULONG nFlags ) -{ - String aName; - - xub_StrLen nIndex = 0; - String aOrgName = GetNextFontToken( rName, nIndex ); - ImplGetEnglishSearchFontName( aOrgName ); - - // #93662# do not try to replace StarSymbol with MS only font - if( nFlags == (SUBSFONT_MS|SUBSFONT_ONLYONE) - && ( aOrgName.EqualsAscii( "starsymbol" ) - || aOrgName.EqualsAscii( "opensymbol" ) ) ) - return aName; - - const FontNameAttr* pAttr = FontSubstConfiguration::get()->getSubstInfo( aOrgName ); - if ( pAttr ) - { - for( int i = 0; i < 3; i++ ) - { - const ::std::vector< String >* pVector = NULL; - switch( i ) - { - case 0: - if( nFlags & SUBSFONT_MS && pAttr->MSSubstitutions.size() ) - pVector = &pAttr->MSSubstitutions; - break; - case 1: - if( nFlags & SUBSFONT_PS && pAttr->PSSubstitutions.size() ) - pVector = &pAttr->PSSubstitutions; - break; - case 2: - if( nFlags & SUBSFONT_HTML && pAttr->HTMLSubstitutions.size() ) - pVector = &pAttr->HTMLSubstitutions; - break; - } - if( ! pVector ) - continue; - for( ::std::vector< String >::const_iterator it = pVector->begin(); it != pVector->end(); ++it ) - if( ! ImplIsFontToken( rName, *it ) ) - { - ImplAppendFontToken( aName, *it ); - if( nFlags & SUBSFONT_ONLYONE ) - { - i = 4; - break; - } - } - } - } - - return aName; -} - -// ======================================================================= - static unsigned ImplIsCJKFont( const String& rFontName ) { // Test, if Fontname includes CJK characters --> In this case we @@ -1695,7 +1159,7 @@ bool ImplDevFontListData::AddFontFace( ImplFontData* pNewData ) // ----------------------------------------------------------------------- // get font attributes using the normalized font family name -void ImplDevFontListData::InitMatchData( const vcl::FontSubstConfiguration& rFontSubst, +void ImplDevFontListData::InitMatchData( const utl::FontSubstConfiguration& rFontSubst, const String& rSearchName ) { String aShortName; @@ -1834,29 +1298,6 @@ void ImplDevFontList::Clear() mbMatchData = false; } -// ----------------------------------------------------------------------- - -// TODO: use a more generic String hash -int FontNameHash::operator()( const String& rStr ) const -{ - // this simple hash just has to be good enough for font names - int nHash = 0; - const int nLen = rStr.Len(); - const sal_Unicode* p = rStr.GetBuffer(); - switch( nLen ) - { - default: nHash = (p[0]<<16) - (p[1]<<8) + p[2]; - nHash += nLen; - p += nLen - 3; - // fall through - case 3: nHash += (p[2]<<16); // fall through - case 2: nHash += (p[1]<<8); // fall through - case 1: nHash += p[0]; // fall through - case 0: break; - }; - - return nHash; -} // ----------------------------------------------------------------------- @@ -2003,7 +1444,7 @@ ImplDevFontListData* ImplDevFontList::GetGlyphFallbackFont( ImplFontSelectData& // call the hook to query the best matching glyph fallback font if( mpFallbackHook->FindFontSubstitute( rFontSelData, rMissingCodes ) ) // apply outdev3.cxx specific fontname normalization - ImplGetEnglishSearchFontName( rFontSelData.maSearchName ); + GetEnglishSearchFontName( rFontSelData.maSearchName ); else rFontSelData.maSearchName = String(); @@ -2058,7 +1499,7 @@ void ImplDevFontList::Add( ImplFontData* pNewData ) for( xub_StrLen nMapNameIndex = 0; nMapNameIndex != STRING_NOTFOUND; ) { String aSearchName = pNewData->maName; - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); DevFontList::const_iterator it = maDevFontList.find( aSearchName ); ImplDevFontListData* pFoundData = NULL; @@ -2095,7 +1536,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindBySearchName( const String& rSearc { #ifdef DEBUG String aTempName = rSearchName; - ImplGetEnglishSearchFontName( aTempName ); + GetEnglishSearchFontName( aTempName ); DBG_ASSERT( aTempName == rSearchName, "ImplDevFontList::ImplFindBySearchName() called with non-normalized name" ); #endif @@ -2150,7 +1591,7 @@ ImplDevFontListData* ImplDevFontList::FindFontFamily( const String& rFontName ) { // normalize the font fomily name and String aName = rFontName; - ImplGetEnglishSearchFontName( aName ); + GetEnglishSearchFontName( aName ); ImplDevFontListData* pFound = ImplFindBySearchName( aName ); return pFound; } @@ -2167,7 +1608,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByTokenNames( const String& rToken String aSearchName = GetNextFontToken( rTokenStr, nTokenPos ); if( !aSearchName.Len() ) continue; - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); pFoundData = ImplFindBySearchName( aSearchName ); if( pFoundData ) break; @@ -2178,7 +1619,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByTokenNames( const String& rToken // ----------------------------------------------------------------------- -ImplDevFontListData* ImplDevFontList::ImplFindBySubstFontAttr( const vcl::FontNameAttr& rFontAttr ) const +ImplDevFontListData* ImplDevFontList::ImplFindBySubstFontAttr( const utl::FontNameAttr& rFontAttr ) const { ImplDevFontListData* pFoundData = NULL; @@ -2187,7 +1628,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindBySubstFontAttr( const vcl::FontNa for(; it != rFontAttr.Substitutions.end(); ++it ) { String aSearchName( *it ); - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); pFoundData = ImplFindBySearchName( aSearchName ); if( pFoundData ) @@ -2933,7 +2374,7 @@ ImplFontEntry* ImplFontCache::GetFontEntry( ImplDevFontList* pFontList, // if we found a different symbol font we need a symbol conversion table if( pFontData->IsSymbolFont() ) if( aFontSelData.maTargetName != aFontSelData.maSearchName ) - pEntry->mpConversion = ImplGetRecodeData( aFontSelData.maTargetName, aFontSelData.maSearchName ); + pEntry->mpConversion = ConvertChar::GetRecodeData( aFontSelData.maTargetName, aFontSelData.maSearchName ); // add the new entry to the cache maFontInstanceList[ aFontSelData ] = pEntry; @@ -2981,7 +2422,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD, #endif - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); ImplFontSubstitute( aSearchName, nSubstFlags, pDevSpecific ); // #114999# special emboldening for Ricoh fonts // TODO: smarter check for special cases by using PreMatch infrastructure? @@ -3029,7 +2470,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD, #endif if( mpPreMatchHook ) if( mpPreMatchHook->FindFontSubstitute( rFSD ) ) - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); #ifdef ENABLE_GRAPHITE // the prematch hook uses the target name to search, but we now need // to restore the features to make the font selection data unique @@ -3056,13 +2497,13 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD, { rFSD.maTargetName = GetNextFontToken( rFSD.maName, nTokenPos ); aSearchName = rFSD.maTargetName; - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); } else nTokenPos = STRING_NOTFOUND; if( mpPreMatchHook ) if( mpPreMatchHook->FindFontSubstitute( rFSD ) ) - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); ImplFontSubstitute( aSearchName, nSubstFlags, pDevSpecific ); ImplDevFontListData* pFoundData = ImplFindBySearchName( aSearchName ); if( pFoundData ) @@ -3076,7 +2517,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD, nTokenPos = 0; rFSD.maTargetName = GetNextFontToken( rFSD.maName, nTokenPos ); aSearchName = rFSD.maTargetName; - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); } String aSearchShortName; @@ -3151,7 +2592,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD, continue; aSearchName = rFSD.maTargetName; - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); String aTempShortName; String aTempFamilyName; @@ -6483,7 +5924,7 @@ SalLayout* OutputDevice::ImplLayout( const String& rOrigStr, // convert from logical units to physical units // recode string if needed if( mpFontEntry->mpConversion ) - ImplRecodeString( mpFontEntry->mpConversion, aStr, 0, aStr.Len() ); + mpFontEntry->mpConversion->RecodeString( aStr, 0, aStr.Len() ); long nPixelWidth = nLogicalWidth; if( nLogicalWidth && mbMap ) diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 6aff4779d8b2..9ebd49e73eb3 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -68,7 +68,7 @@ #include "vcl/wall.hxx" #include "vcl/gradient.hxx" #include "vcl/toolbox.h" -#include "vcl/fontcfg.hxx" +#include "unotools/fontcfg.hxx" #include "vcl/sysdata.hxx" #include "vcl/sallayout.hxx" #include "vcl/button.hxx" // Button::GetStandardText @@ -310,7 +310,7 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, BOOL bCallHdl ) if ( !bUseSystemFont ) { ImplInitFontList(); - String aConfigFont = vcl::DefaultFontConfiguration::get()->getUserInterfaceFont( rSettings.GetUILocale() ); + String aConfigFont = utl::DefaultFontConfiguration::get()->getUserInterfaceFont( rSettings.GetUILocale() ); xub_StrLen nIndex = 0; while( nIndex != STRING_NOTFOUND ) { diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk index 32620d9e966a..ef4f13301ecd 100644 --- a/vcl/util/makefile.mk +++ b/vcl/util/makefile.mk @@ -73,7 +73,6 @@ HXXDEPNLST= $(INC)$/vcl$/accel.hxx \ $(INC)$/vcl$/fixed.hxx \ $(INC)$/vcl$/floatwin.hxx \ $(INC)$/vcl$/font.hxx \ - $(INC)$/vcl$/fontcvt.hxx \ $(INC)$/vcl$/floatwin.hxx \ $(INC)$/vcl$/graph.hxx \ $(INC)$/vcl$/group.hxx \ -- cgit From 03685ed53213d63c3126624e2a65954e60df4e14 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Mon, 19 Oct 2009 17:30:42 +0200 Subject: #i103496#: forgotten commit --- svl/source/items/dateitem.cxx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/svl/source/items/dateitem.cxx b/svl/source/items/dateitem.cxx index d5989d4b7a2b..d6ef8fdc7c9e 100644 --- a/svl/source/items/dateitem.cxx +++ b/svl/source/items/dateitem.cxx @@ -35,7 +35,7 @@ #define _DATETIMEITEM_CXX #include - +#include #include #include @@ -49,10 +49,6 @@ #include -#include - -#include - // STATIC DATA ----------------------------------------------------------- DBG_NAME(SfxDateTimeItem) -- cgit From 43e577e5aec58aaffc76c2ea01c169c256b92818 Mon Sep 17 00:00:00 2001 From: Armin Weiss Date: Tue, 20 Oct 2009 15:36:02 +0000 Subject: #i105065# speedup 3D/FontWork --- vcl/inc/vcl/bitmapex.hxx | 13 ++++++++ vcl/source/gdi/bitmapex.cxx | 73 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/vcl/inc/vcl/bitmapex.hxx b/vcl/inc/vcl/bitmapex.hxx index 3da80ce8c2f1..e5ddf50f1efa 100644 --- a/vcl/inc/vcl/bitmapex.hxx +++ b/vcl/inc/vcl/bitmapex.hxx @@ -381,6 +381,19 @@ public: const BmpFilterParam* pFilterParam = NULL, const Link* pProgress = NULL ); + /** Get transparency at given position + + @param nX + integer X-Position in Bitmap + + @param nY + integer Y-Position in Bitmap + + @return transparency value in the range of [0 .. 255] where + 0 is not transparent, 255 is fully transparent + */ + sal_uInt8 GetTransparency(sal_Int32 nX, sal_Int32 nY) const; + public: friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx ); diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index cfcac8851089..6626a12d29a2 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -47,6 +47,7 @@ #include #endif #include +#include // ------------ // - BitmapEx - @@ -761,6 +762,78 @@ void BitmapEx::Draw( OutputDevice* pOutDev, // ------------------------------------------------------------------ +sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 nY) const +{ + sal_uInt8 nTransparency(0xff); + + if(!aBitmap.IsEmpty()) + { + if(nX >= 0 && nX < aBitmapSize.Width() && nY >= 0 && nY < aBitmapSize.Height()) + { + switch(eTransparent) + { + case TRANSPARENT_NONE: + { + // not transparent, ergo all covered + nTransparency = 0x00; + break; + } + case TRANSPARENT_COLOR: + { + Bitmap aTestBitmap(aBitmap); + BitmapReadAccess* pRead = aTestBitmap.AcquireReadAccess(); + + if(pRead) + { + const Color aColor(Color(pRead->GetColor(nY, nX))); + + // if color is not equal to TransparentColor, we are not transparent + if(aColor != aTransparentColor) + { + nTransparency = 0x00; + } + + aTestBitmap.ReleaseAccess(pRead); + } + break; + } + case TRANSPARENT_BITMAP: + { + if(!aMask.IsEmpty()) + { + Bitmap aTestBitmap(aMask); + BitmapReadAccess* pRead = aTestBitmap.AcquireReadAccess(); + + if(pRead) + { + const BitmapColor aBitmapColor(pRead->GetPixel(nY, nX)); + + if(bAlpha) + { + nTransparency = aBitmapColor.GetIndex(); + } + else + { + if(0x00 != aBitmapColor.GetIndex()) + { + nTransparency = 0x00; + } + } + + aTestBitmap.ReleaseAccess(pRead); + } + } + break; + } + } + } + } + + return nTransparency; +} + +// ------------------------------------------------------------------ + SvStream& operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx ) { rBitmapEx.aBitmap.Write( rOStm ); -- cgit From c17a26a1df43233008981c7aebd4f504a6b532ff Mon Sep 17 00:00:00 2001 From: Armin Weiss Date: Tue, 20 Oct 2009 15:36:14 +0000 Subject: #i105065# speedup 3D/FontWork --- basegfx/source/polygon/b3dpolygontools.cxx | 167 ++++++++++++++++++++++------- 1 file changed, 131 insertions(+), 36 deletions(-) diff --git a/basegfx/source/polygon/b3dpolygontools.cxx b/basegfx/source/polygon/b3dpolygontools.cxx index ea303886dd88..52e0f0fcc36f 100644 --- a/basegfx/source/polygon/b3dpolygontools.cxx +++ b/basegfx/source/polygon/b3dpolygontools.cxx @@ -875,52 +875,147 @@ namespace basegfx } else { + bool bRetval(false); const B3DVector aPlaneNormal(rCandidate.getNormal()); if(!aPlaneNormal.equalZero()) { - const double fAbsX(fabs(aPlaneNormal.getX())); - const double fAbsY(fabs(aPlaneNormal.getY())); - const double fAbsZ(fabs(aPlaneNormal.getZ())); + const sal_uInt32 nPointCount(rCandidate.count()); - if(fAbsX > fAbsY && fAbsX > fAbsZ) + if(nPointCount) { - // normal points mostly in X-Direction, use YZ-Polygon projection for check - B3DHomMatrix aTrans; + B3DPoint aCurrentPoint(rCandidate.getB3DPoint(nPointCount - 1)); + const double fAbsX(fabs(aPlaneNormal.getX())); + const double fAbsY(fabs(aPlaneNormal.getY())); + const double fAbsZ(fabs(aPlaneNormal.getZ())); - aTrans.set(0, 0, 0.0); - aTrans.set(0, 1, 1.0); - aTrans.set(1, 1, 0.0); - aTrans.set(1, 2, 1.0); - - const B2DPolygon aYZ(createB2DPolygonFromB3DPolygon(rCandidate, aTrans)); - - return isInside(aYZ, B2DPoint(rPoint.getY(), rPoint.getZ()), bWithBorder); - } - else if(fAbsY > fAbsX && fAbsY > fAbsZ) - { - // normal points mostly in Y-Direction, use XZ-Polygon projection for check - B3DHomMatrix aTrans; - - aTrans.set(1, 1, 0.0); - aTrans.set(1, 2, 1.0); - - const B2DPolygon aXZ(createB2DPolygonFromB3DPolygon(rCandidate, aTrans)); - - return isInside(aXZ, B2DPoint(rPoint.getX(), rPoint.getZ()), bWithBorder); - } - else - { - // normal points mostly in Z-Direction, use XY-Polygon projection for check - B3DHomMatrix aTrans; - - const B2DPolygon aXY(createB2DPolygonFromB3DPolygon(rCandidate, aTrans)); - - return isInside(aXY, B2DPoint(rPoint.getX(), rPoint.getY()), bWithBorder); + if(fAbsX > fAbsY && fAbsX > fAbsZ) + { + // normal points mostly in X-Direction, use YZ-Polygon projection for check + // x -> y, y -> z + for(sal_uInt32 a(0); a < nPointCount; a++) + { + const B3DPoint aPreviousPoint(aCurrentPoint); + aCurrentPoint = rCandidate.getB3DPoint(a); + + // cross-over in Z? + const bool bCompZA(fTools::more(aPreviousPoint.getZ(), rPoint.getZ())); + const bool bCompZB(fTools::more(aCurrentPoint.getZ(), rPoint.getZ())); + + if(bCompZA != bCompZB) + { + // cross-over in Y? + const bool bCompYA(fTools::more(aPreviousPoint.getY(), rPoint.getY())); + const bool bCompYB(fTools::more(aCurrentPoint.getY(), rPoint.getY())); + + if(bCompYA == bCompYB) + { + if(bCompYA) + { + bRetval = !bRetval; + } + } + else + { + const double fCompare( + aCurrentPoint.getY() - (aCurrentPoint.getZ() - rPoint.getZ()) * + (aPreviousPoint.getY() - aCurrentPoint.getY()) / + (aPreviousPoint.getZ() - aCurrentPoint.getZ())); + + if(fTools::more(fCompare, rPoint.getY())) + { + bRetval = !bRetval; + } + } + } + } + } + else if(fAbsY > fAbsX && fAbsY > fAbsZ) + { + // normal points mostly in Y-Direction, use XZ-Polygon projection for check + // x -> x, y -> z + for(sal_uInt32 a(0); a < nPointCount; a++) + { + const B3DPoint aPreviousPoint(aCurrentPoint); + aCurrentPoint = rCandidate.getB3DPoint(a); + + // cross-over in Z? + const bool bCompZA(fTools::more(aPreviousPoint.getZ(), rPoint.getZ())); + const bool bCompZB(fTools::more(aCurrentPoint.getZ(), rPoint.getZ())); + + if(bCompZA != bCompZB) + { + // cross-over in X? + const bool bCompXA(fTools::more(aPreviousPoint.getX(), rPoint.getX())); + const bool bCompXB(fTools::more(aCurrentPoint.getX(), rPoint.getX())); + + if(bCompXA == bCompXB) + { + if(bCompXA) + { + bRetval = !bRetval; + } + } + else + { + const double fCompare( + aCurrentPoint.getX() - (aCurrentPoint.getZ() - rPoint.getZ()) * + (aPreviousPoint.getX() - aCurrentPoint.getX()) / + (aPreviousPoint.getZ() - aCurrentPoint.getZ())); + + if(fTools::more(fCompare, rPoint.getX())) + { + bRetval = !bRetval; + } + } + } + } + } + else + { + // normal points mostly in Z-Direction, use XY-Polygon projection for check + // x -> x, y -> y + for(sal_uInt32 a(0); a < nPointCount; a++) + { + const B3DPoint aPreviousPoint(aCurrentPoint); + aCurrentPoint = rCandidate.getB3DPoint(a); + + // cross-over in Y? + const bool bCompYA(fTools::more(aPreviousPoint.getY(), rPoint.getY())); + const bool bCompYB(fTools::more(aCurrentPoint.getY(), rPoint.getY())); + + if(bCompYA != bCompYB) + { + // cross-over in X? + const bool bCompXA(fTools::more(aPreviousPoint.getX(), rPoint.getX())); + const bool bCompXB(fTools::more(aCurrentPoint.getX(), rPoint.getX())); + + if(bCompXA == bCompXB) + { + if(bCompXA) + { + bRetval = !bRetval; + } + } + else + { + const double fCompare( + aCurrentPoint.getX() - (aCurrentPoint.getY() - rPoint.getY()) * + (aPreviousPoint.getX() - aCurrentPoint.getX()) / + (aPreviousPoint.getY() - aCurrentPoint.getY())); + + if(fTools::more(fCompare, rPoint.getX())) + { + bRetval = !bRetval; + } + } + } + } + } } } - return false; + return bRetval; } } -- cgit From 1430eb436b67615e94a9ebf7e8ae91a345f5f969 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Tue, 20 Oct 2009 15:42:51 +0000 Subject: #i106068# add missing SAL_FRAME_STYLE_FLOAT_FOCUSABLE handling --- vcl/unx/gtk/window/gtkframe.cxx | 16 ++++++++++++---- vcl/unx/inc/plugins/gtk/gtkframe.hxx | 7 ++++--- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index 8963ac2e3643..227764f83fc4 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -772,7 +772,10 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) m_aForeignTopLevelWindow = None; m_nStyle = nStyle; - GtkWindowType eWinType = ((nStyle & SAL_FRAME_STYLE_FLOAT) && ! (nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION)) + GtkWindowType eWinType = ( (nStyle & SAL_FRAME_STYLE_FLOAT) && + ! (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION| + SAL_FRAME_STYLE_FLOAT_FOCUSABLE)) + ) ? GTK_WINDOW_POPUP : GTK_WINDOW_TOPLEVEL; if( nStyle & SAL_FRAME_STYLE_SYSTEMCHILD ) @@ -801,7 +804,7 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) bool bDecoHandling = ! isChild() && ( ! (nStyle & SAL_FRAME_STYLE_FLOAT) || - (nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) ); + (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION|SAL_FRAME_STYLE_FLOAT_FOCUSABLE) ) ); /* #i100116# metacity has a peculiar behavior regarding WM_HINT accept focus and _NET_WM_USER_TIME at some point that may be fixed in metacity and we will have to revisit this @@ -832,6 +835,11 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, true ); bNoDecor = true; } + else if( (nStyle & SAL_FRAME_STYLE_FLOAT_FOCUSABLE) ) + { + eType = GDK_WINDOW_TYPE_HINT_UTILITY; + } + if( (nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ) ) { eType = GDK_WINDOW_TYPE_HINT_TOOLBAR; @@ -869,7 +877,7 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) if( bDecoHandling ) { gtk_window_set_resizable( GTK_WINDOW(m_pWindow), (nStyle & SAL_FRAME_STYLE_SIZEABLE) ? TRUE : FALSE ); - if( ( (nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) ) || bMetaCityToolWindowHack ) + if( ( (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION)) ) || bMetaCityToolWindowHack ) lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, false ); } @@ -2072,7 +2080,7 @@ void GtkSalFrame::ToTop( USHORT nFlags ) * to our window - which it of course won't since our input hint * is set to false. */ - if( (m_nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) ) + if( (m_nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION|SAL_FRAME_STYLE_FLOAT_FOCUSABLE)) ) XSetInputFocus( getDisplay()->GetDisplay(), GDK_WINDOW_XWINDOW( m_pWindow->window ), RevertToParent, CurrentTime ); } else diff --git a/vcl/unx/inc/plugins/gtk/gtkframe.hxx b/vcl/unx/inc/plugins/gtk/gtkframe.hxx index 74394c71e4b2..3a31d0188920 100644 --- a/vcl/unx/inc/plugins/gtk/gtkframe.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkframe.hxx @@ -242,9 +242,10 @@ class GtkSalFrame : public SalFrame bool isFloatGrabWindow() const { return - (m_nStyle & SAL_FRAME_STYLE_FLOAT) && // only a float can be floatgrab - !(m_nStyle & SAL_FRAME_STYLE_TOOLTIP) && // tool tips are not - !(m_nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION); // toolbars are also not + (m_nStyle & SAL_FRAME_STYLE_FLOAT) && // only a float can be floatgrab + !(m_nStyle & SAL_FRAME_STYLE_TOOLTIP) && // tool tips are not + !(m_nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) && // toolbars are also not + !(m_nStyle & SAL_FRAME_STYLE_FLOAT_FOCUSABLE); // focusable floats are not } bool isChild( bool bPlug = true, bool bSysChild = true ) -- cgit From 47185865ba1217151a0244de5855e5574114b327 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Tue, 20 Oct 2009 23:12:55 +0200 Subject: #i106113# update from shtylman and kendy (thanks !) --- vcl/unx/kde4/KDESalFrame.cxx | 23 +++++++++++------------ vcl/unx/kde4/KDEXLib.cxx | 13 ++++++++++--- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx index 796350a63d50..1984cd979117 100644 --- a/vcl/unx/kde4/KDESalFrame.cxx +++ b/vcl/unx/kde4/KDESalFrame.cxx @@ -181,7 +181,6 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) StyleSettings style( rSettings.GetStyleSettings() ); BOOL bSetTitleFont = false; - // General settings QPalette pal = kapp->palette(); @@ -214,6 +213,14 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) pKey = "Theme"; if ( aGroup.hasKey( pKey ) ) style.SetPreferredSymbolsStyleName( readEntryUntranslated( &aGroup, pKey ) ); + + //toolbar + pKey = "toolbarFont"; + if ( aGroup.hasKey( pKey ) ) + { + Font aFont = toFont( aGroup.readEntry( pKey, QFont() ), rSettings.GetUILocale() ); + style.SetToolFont( aFont ); + } } Color aFore = toColor( pal.color( QPalette::Active, QPalette::WindowText ) ); @@ -288,7 +295,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) style.SetFloatTitleFont( aFont ); style.SetMenuFont( aFont ); // will be changed according to pMenuBar - style.SetToolFont( aFont ); // will be changed according to pToolBar + //style.SetToolFont( aFont ); //already set above style.SetLabelFont( aFont ); style.SetInfoFont( aFont ); style.SetRadioCheckFont( aFont ); @@ -300,11 +307,9 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) int flash_time = QApplication::cursorFlashTime(); style.SetCursorBlinkTime( flash_time != 0 ? flash_time/2 : STYLE_CURSOR_NOBLINKTIME ); - KMainWindow qMainWindow; - // Menu style.SetSkipDisabledInMenus( TRUE ); - KMenuBar *pMenuBar = qMainWindow.menuBar(); + KMenuBar* pMenuBar = new KMenuBar(); if ( pMenuBar ) { // Color @@ -337,13 +342,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) style.SetMenuFont( aFont ); } - // Tool bar - KToolBar *pToolBar = qMainWindow.toolBar(); - if ( pToolBar ) - { - aFont = toFont( pToolBar->font(), rSettings.GetUILocale() ); - style.SetToolFont( aFont ); - } + delete pMenuBar; // Scroll bar size style.SetScrollBarSize( kapp->style()->pixelMetric( QStyle::PM_ScrollBarExtent ) ); diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx index 70b1796df7f0..dedda64d157e 100644 --- a/vcl/unx/kde4/KDEXLib.cxx +++ b/vcl/unx/kde4/KDEXLib.cxx @@ -77,24 +77,30 @@ void KDEXLib::Init() pInputMethod->SetLocale(); XrmInitialize(); - KAboutData *kAboutData = new KAboutData( "OpenOffice.org", - "OpenOffice.org", + KAboutData *kAboutData = new KAboutData("OpenOffice.org", + "kdelibs4", ki18n( "OpenOffice.org" ), "3.0.0", ki18n( "OpenOffice.org with KDE Native Widget Support." ), KAboutData::License_LGPL, - ki18n( "Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008 Novell, Inc"), + ki18n( "Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Novell, Inc"), ki18n( "OpenOffice.org is an office suite.\n" ), "http://kde.openoffice.org/index.html", "dev@kde.openoffice.org" ); + kAboutData->addAuthor( ki18n( "Jan Holesovsky" ), ki18n( "Original author and maintainer of the KDE NWF." ), "kendy@artax.karlin.mff.cuni.cz", "http://artax.karlin.mff.cuni.cz/~kendy" ); + kAboutData->addAuthor( ki18n("Roman Shtylman"), + ki18n( "Porting to KDE 4." ), + "shtylman@gmail.com", "http://shtylman.com" ); kAboutData->addAuthor( ki18n("Eric Bischoff"), ki18n( "Accessibility fixes, porting to KDE 4." ), "bischoff@kde.org" ); + //kAboutData->setProgramIconName("OpenOffice"); + m_nFakeCmdLineArgs = 1; USHORT nIdx; vos::OExtCommandLine aCommandLine; @@ -135,6 +141,7 @@ void KDEXLib::Init() m_pApplication = new VCLKDEApplication(); kapp->disableSessionManagement(); + KApplication::setQuitOnLastWindowClosed(false); Display* pDisp = QX11Info::display(); SalKDEDisplay *pSalDisplay = new SalKDEDisplay(pDisp); -- cgit From dbea801cbb1af5fb33b3627590cfad69800b50f2 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Wed, 21 Oct 2009 10:47:51 +0200 Subject: #i103496#: some warnings, pch and windows only fixes --- canvas/source/directx/dx_config.cxx | 3 +++ canvas/source/directx/dx_config.hxx | 2 ++ svl/source/items/itemprop.cxx | 14 +++++++------- svl/source/items/stylepool.cxx | 2 ++ svtools/source/config/optionsdrawinglayer.cxx | 3 +++ unotools/inc/unotools/fontdefs.hxx | 2 +- unotools/source/config/options.cxx | 2 +- unotools/source/config/regoptions.cxx | 1 - 8 files changed, 19 insertions(+), 10 deletions(-) diff --git a/canvas/source/directx/dx_config.cxx b/canvas/source/directx/dx_config.cxx index 48f44e3ba816..e124d4d78e6a 100755 --- a/canvas/source/directx/dx_config.cxx +++ b/canvas/source/directx/dx_config.cxx @@ -144,6 +144,9 @@ namespace dxcanvas } } + void DXCanvasItem::Notify( const com::sun::star::uno::Sequence& ) {} + void DXCanvasItem::Commit() {} + bool DXCanvasItem::isDeviceUsable( const DeviceInfo& rDeviceInfo ) const { return maValues.find(rDeviceInfo) == maValues.end(); diff --git a/canvas/source/directx/dx_config.hxx b/canvas/source/directx/dx_config.hxx index 34deddb509a7..1fffcb2ed56e 100644 --- a/canvas/source/directx/dx_config.hxx +++ b/canvas/source/directx/dx_config.hxx @@ -77,6 +77,8 @@ namespace dxcanvas bool isBlacklistCurrentDevice() const; void blacklistDevice( const DeviceInfo& rDeviceInfo ); void adaptMaxTextureSize( basegfx::B2IVector& io_maxTextureSize ) const; + virtual void Notify( const com::sun::star::uno::Sequence& aPropertyNames); + virtual void Commit(); private: typedef std::set< DeviceInfo > ValueSet; diff --git a/svl/source/items/itemprop.cxx b/svl/source/items/itemprop.cxx index cd50c1c51794..3add3f466495 100644 --- a/svl/source/items/itemprop.cxx +++ b/svl/source/items/itemprop.cxx @@ -43,7 +43,7 @@ using namespace com::sun::star; using namespace com::sun::star::beans; using namespace com::sun::star::lang; using namespace com::sun::star::uno; -using namespace ::rtl; + /*-- 16.02.2009 10:03:55--------------------------------------------------- -----------------------------------------------------------------------*/ @@ -262,7 +262,7 @@ void SfxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry& rEn /* -----------------------------06.06.01 12:32-------------------------------- ---------------------------------------------------------------------------*/ -void SfxItemPropertySet::getPropertyValue( const OUString &rName, +void SfxItemPropertySet::getPropertyValue( const rtl::OUString &rName, const SfxItemSet& rSet, Any& rAny ) const throw(RuntimeException, UnknownPropertyException) { @@ -275,7 +275,7 @@ void SfxItemPropertySet::getPropertyValue( const OUString &rName, /* -----------------------------21.02.00 11:26-------------------------------- ---------------------------------------------------------------------------*/ -Any SfxItemPropertySet::getPropertyValue( const OUString &rName, +Any SfxItemPropertySet::getPropertyValue( const rtl::OUString &rName, const SfxItemSet& rSet ) const throw(RuntimeException, UnknownPropertyException) { @@ -327,7 +327,7 @@ void SfxItemPropertySet::setPropertyValue( const SfxItemPropertySimpleEntry& rEn /* -----------------------------21.02.00 11:26-------------------------------- ---------------------------------------------------------------------------*/ -void SfxItemPropertySet::setPropertyValue( const OUString &rName, +void SfxItemPropertySet::setPropertyValue( const rtl::OUString &rName, const Any& aVal, SfxItemSet& rSet ) const throw(RuntimeException, @@ -360,7 +360,7 @@ PropertyState SfxItemPropertySet::getPropertyState(const SfxItemPropertySimpleEn return eRet; } PropertyState SfxItemPropertySet::getPropertyState( - const OUString& rName, const SfxItemSet& rSet) const + const rtl::OUString& rName, const SfxItemSet& rSet) const throw(UnknownPropertyException) { PropertyState eRet = PropertyState_DIRECT_VALUE; @@ -489,7 +489,7 @@ Sequence< Property > SAL_CALL ---------------------------------------------------------------------------*/ Property SAL_CALL - SfxExtItemPropertySetInfo::getPropertyByName( const OUString& rPropertyName ) +SfxExtItemPropertySetInfo::getPropertyByName( const rtl::OUString& rPropertyName ) throw(UnknownPropertyException, RuntimeException) { return aExtMap.getPropertyByName( rPropertyName ); @@ -498,7 +498,7 @@ Property SAL_CALL ---------------------------------------------------------------------------*/ sal_Bool SAL_CALL - SfxExtItemPropertySetInfo::hasPropertyByName( const OUString& rPropertyName ) +SfxExtItemPropertySetInfo::hasPropertyByName( const rtl::OUString& rPropertyName ) throw(RuntimeException) { return aExtMap.hasPropertyByName( rPropertyName ); diff --git a/svl/source/items/stylepool.cxx b/svl/source/items/stylepool.cxx index 57ba991afcb4..6d214b6b94dd 100644 --- a/svl/source/items/stylepool.cxx +++ b/svl/source/items/stylepool.cxx @@ -27,6 +27,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svl.hxx" #ifdef _MSC_VER #pragma hdrstop diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx index d4aeda6e6be8..43490c5ea79e 100644 --- a/svtools/source/config/optionsdrawinglayer.cxx +++ b/svtools/source/config/optionsdrawinglayer.cxx @@ -27,6 +27,9 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + #ifdef _MSC_VER #pragma hdrstop #endif diff --git a/unotools/inc/unotools/fontdefs.hxx b/unotools/inc/unotools/fontdefs.hxx index e595fe45400d..ef4f68bb9e8a 100644 --- a/unotools/inc/unotools/fontdefs.hxx +++ b/unotools/inc/unotools/fontdefs.hxx @@ -33,7 +33,7 @@ namespace utl { class FontSubstConfiguration; - class FontNameAttr; + struct FontNameAttr; } // ---------------- diff --git a/unotools/source/config/options.cxx b/unotools/source/config/options.cxx index 5bd2ed46f7ec..3b41d14bdd6c 100644 --- a/unotools/source/config/options.cxx +++ b/unotools/source/config/options.cxx @@ -101,7 +101,7 @@ Options::~Options() { } -void Options::ConfigurationChanged( ConfigurationBroadcaster* p, sal_uInt32 nHint ) +void Options::ConfigurationChanged( ConfigurationBroadcaster*, sal_uInt32 nHint ) { NotifyListeners( nHint ); } diff --git a/unotools/source/config/regoptions.cxx b/unotools/source/config/regoptions.cxx index 9b1017785bd7..b0f41602da2e 100644 --- a/unotools/source/config/regoptions.cxx +++ b/unotools/source/config/regoptions.cxx @@ -43,7 +43,6 @@ namespace utl { //........................................................................ - using namespace ::utl; using namespace ::com::sun::star::uno; //==================================================================== -- cgit From b1419a4de2ff47d32cd7d93b4042727b05435fad Mon Sep 17 00:00:00 2001 From: hdu Date: Wed, 21 Oct 2009 11:06:38 +0200 Subject: #i106127# perf: add and use B2DPolygon::reserve() to prevent many reallocations --- basegfx/inc/basegfx/polygon/b2dpolygon.hxx | 1 + basegfx/source/polygon/b2dpolygon.cxx | 15 +++++++++++++++ basegfx/source/polygon/b2dpolygontools.cxx | 9 +++++++++ 3 files changed, 25 insertions(+) diff --git a/basegfx/inc/basegfx/polygon/b2dpolygon.hxx b/basegfx/inc/basegfx/polygon/b2dpolygon.hxx index ee12d55d460b..1d5f8aaa4356 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolygon.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolygon.hxx @@ -89,6 +89,7 @@ namespace basegfx /// Coordinate insert/append void insert(sal_uInt32 nIndex, const basegfx::B2DPoint& rPoint, sal_uInt32 nCount = 1); void append(const basegfx::B2DPoint& rPoint, sal_uInt32 nCount = 1); + void reserve(sal_uInt32 nCount); /// Basic ControlPoint interface basegfx::B2DPoint getPrevControlPoint(sal_uInt32 nIndex) const; diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx index 467a4b90f516..d44599e0f49e 100644 --- a/basegfx/source/polygon/b2dpolygon.cxx +++ b/basegfx/source/polygon/b2dpolygon.cxx @@ -123,6 +123,11 @@ public: maVector[nIndex].setCoordinate(rValue); } + void reserve(sal_uInt32 nCount) + { + maVector.reserve(nCount); + } + void insert(sal_uInt32 nIndex, const CoordinateData2D& rValue, sal_uInt32 nCount) { if(nCount) @@ -741,6 +746,11 @@ public: maPoints.setCoordinate(nIndex, rValue); } + void reserve(sal_uInt32 nCount) + { + maPoints.reserve(nCount); + } + void insert(sal_uInt32 nIndex, const basegfx::B2DPoint& rPoint, sal_uInt32 nCount) { if(nCount) @@ -1190,6 +1200,11 @@ namespace basegfx } } + void B2DPolygon::reserve(sal_uInt32 nCount) + { + mpPolygon->reserve(nCount); + } + void B2DPolygon::insert(sal_uInt32 nIndex, const B2DPoint& rPoint, sal_uInt32 nCount) { OSL_ENSURE(nIndex <= mpPolygon->count(), "B2DPolygon Insert outside range (!)"); diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index c1e5dc80d8c4..038ad0b35300 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -192,6 +192,9 @@ namespace basegfx B2DCubicBezier aBezier; aBezier.setStartPoint(rCandidate.getB2DPoint(0)); + // perf: try to avoid too many realloctions by guessing the result's pointcount + aRetval.reserve(nPointCount*4); + // add start point (always) aRetval.append(aBezier.getStartPoint()); @@ -272,6 +275,9 @@ namespace basegfx B2DCubicBezier aBezier; aBezier.setStartPoint(rCandidate.getB2DPoint(0)); + // perf: try to avoid too many realloctions by guessing the result's pointcount + aRetval.reserve(nPointCount*4); + // add start point (always) aRetval.append(aBezier.getStartPoint()); @@ -342,6 +348,9 @@ namespace basegfx B2DCubicBezier aBezier; aBezier.setStartPoint(rCandidate.getB2DPoint(0)); + // perf: try to avoid too many realloctions by guessing the result's pointcount + aRetval.reserve(nPointCount*4); + // add start point (always) aRetval.append(aBezier.getStartPoint()); -- cgit From 593aebed34f922feeb9c4f1f0f864e67f8b78527 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Wed, 21 Oct 2009 09:47:51 +0000 Subject: fix a compile problem --- vcl/source/gdi/bitmapex.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index 6626a12d29a2..4e2ed20a7966 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -785,7 +785,7 @@ sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 nY) const if(pRead) { - const Color aColor(Color(pRead->GetColor(nY, nX))); + const Color aColor = pRead->GetColor(nY, nX); // if color is not equal to TransparentColor, we are not transparent if(aColor != aTransparentColor) -- cgit From b40fbbe280b3636369521479f8e3438aefcd544d Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Wed, 21 Oct 2009 14:01:28 +0200 Subject: #i105131# initialization (thanks mst!) --- vcl/unx/source/dtrans/X11_selection.cxx | 40 +++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/vcl/unx/source/dtrans/X11_selection.cxx b/vcl/unx/source/dtrans/X11_selection.cxx index 3f7dfc2df709..c6036ae4f78e 100644 --- a/vcl/unx/source/dtrans/X11_selection.cxx +++ b/vcl/unx/source/dtrans/X11_selection.cxx @@ -219,28 +219,64 @@ SelectionManager::SelectionManager() : m_aWindow( None ), m_nSelectionTimeout( 0 ), m_nSelectionTimestamp( CurrentTime ), + m_bDropEnterSent( true ), m_aCurrentDropWindow( None ), + m_nDropTime( None ), + m_nLastDropAction( 0 ), + m_nLastX( 0 ), + m_nLastY( 0 ), + m_nDropTimestamp( 0 ), m_bDropWaitingForCompletion( false ), m_aDropWindow( None ), m_aDropProxy( None ), m_aDragSourceWindow( None ), + m_nLastDragX( 0 ), + m_nLastDragY( 0 ), m_nNoPosX( 0 ), m_nNoPosY( 0 ), m_nNoPosWidth( 0 ), m_nNoPosHeight( 0 ), + m_nDragButton( 0 ), + m_nUserDragAction( 0 ), + m_nTargetAcceptAction( 0 ), + m_nSourceActions( 0 ), m_bLastDropAccepted( false ), m_bDropSuccess( false ), m_bDropSent( false ), m_bWaitingForPrimaryConversion( false ), + m_nDragTimestamp( None ), m_aMoveCursor( None ), m_aCopyCursor( None ), m_aLinkCursor( None ), m_aNoneCursor( None ), m_aCurrentCursor( None ), - m_nCurrentProtocolVersion( nXdndProtocolRevision ) + m_nCurrentProtocolVersion( nXdndProtocolRevision ), + m_nCLIPBOARDAtom( None ), + m_nTARGETSAtom( None ), + m_nTIMESTAMPAtom( None ), + m_nTEXTAtom( None ), + m_nINCRAtom( None ), + m_nCOMPOUNDAtom( None ), + m_nMULTIPLEAtom( None ), + m_nUTF16Atom( None ), + m_nImageBmpAtom( None ), + m_nXdndAware( None ), + m_nXdndEnter( None ), + m_nXdndLeave( None ), + m_nXdndPosition( None ), + m_nXdndStatus( None ), + m_nXdndDrop( None ), + m_nXdndFinished( None ), + m_nXdndSelection( None ), + m_nXdndTypeList( None ), + m_nXdndProxy( None ), + m_nXdndActionCopy( None ), + m_nXdndActionMove( None ), + m_nXdndActionLink( None ), + m_nXdndActionAsk( None ), + m_nXdndActionPrivate( None ) { m_aDropEnterEvent.data.l[0] = None; - m_bDropEnterSent = true; m_aDragRunning.reset(); } -- cgit From c94382c18059ecf000d1becbffa5425812dcc3f6 Mon Sep 17 00:00:00 2001 From: hdu Date: Wed, 21 Oct 2009 15:43:13 +0200 Subject: #i106127# perf: make self-intersection-test of bezier curve much cheaper --- basegfx/source/polygon/b2dpolygoncutandtouch.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx index 26016942717d..9d40acc0dcab 100644 --- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx +++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx @@ -497,6 +497,11 @@ namespace basegfx const B2DCubicBezier& rCubicA, sal_uInt32 nInd, temporaryPointVector& rTempPoints) { + double fDummy; + const bool bHasAnyExtremum = rCubicA.getMinimumExtremumPosition( fDummy ); + if( !bHasAnyExtremum ) + return; + // find all self-intersections on the given bezier segment. Add an entry to the tempPoints // for each self intersection point with the cut value describing the relative position on given // bezier segment. -- cgit From 9e8d18328987be288a84e686eee1d4c35d8754e9 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Wed, 21 Oct 2009 15:49:31 +0200 Subject: #i103932# allow duplicate field names in PDF export on request --- vcl/inc/vcl/pdfwriter.hxx | 2 ++ vcl/source/gdi/pdfwriter_impl.cxx | 37 ++++++++++++++++++++----------------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/vcl/inc/vcl/pdfwriter.hxx b/vcl/inc/vcl/pdfwriter.hxx index bdf636754c77..a4a6c4d53170 100644 --- a/vcl/inc/vcl/pdfwriter.hxx +++ b/vcl/inc/vcl/pdfwriter.hxx @@ -546,6 +546,7 @@ The following structure describes the permissions used in PDF security will be submitted. */ PDFWriter::ExportDataFormat SubmitFormat; + bool AllowDuplicateFieldNames; /* the following data members are used to customize the PDF viewer preferences */ @@ -590,6 +591,7 @@ The following structure describes the permissions used in PDF security Tagged( false ), EmbedStandardFonts( false ), SubmitFormat( PDFWriter::FDF ), + AllowDuplicateFieldNames( false ), PDFDocumentMode( PDFWriter::ModeDefault ), PDFDocumentAction( PDFWriter::ActionDefault ), Zoom( 100 ), diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 7b6d5e7f41aa..dc3ead5d2d6f 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -667,26 +667,29 @@ OString PDFWriterImpl::convertWidgetFieldName( const rtl::OUString& rString ) } OString aRet = aBuffer.makeStringAndClear(); - std::hash_map::iterator it = m_aFieldNameMap.find( aRet ); - - if( it != m_aFieldNameMap.end() ) // not unique + if( ! m_aContext.AllowDuplicateFieldNames ) { - std::hash_map< OString, sal_Int32, OStringHash >::const_iterator check_it; - OString aTry; - do + std::hash_map::iterator it = m_aFieldNameMap.find( aRet ); + + if( it != m_aFieldNameMap.end() ) // not unique { - OStringBuffer aUnique( aRet.getLength() + 16 ); - aUnique.append( aRet ); - aUnique.append( '_' ); - aUnique.append( it->second ); - it->second++; - aTry = aUnique.makeStringAndClear(); - check_it = m_aFieldNameMap.find( aTry ); - } while( check_it != m_aFieldNameMap.end() ); - aRet = aTry; + std::hash_map< OString, sal_Int32, OStringHash >::const_iterator check_it; + OString aTry; + do + { + OStringBuffer aUnique( aRet.getLength() + 16 ); + aUnique.append( aRet ); + aUnique.append( '_' ); + aUnique.append( it->second ); + it->second++; + aTry = aUnique.makeStringAndClear(); + check_it = m_aFieldNameMap.find( aTry ); + } while( check_it != m_aFieldNameMap.end() ); + aRet = aTry; + } + else + m_aFieldNameMap[ aRet ] = 2; } - else - m_aFieldNameMap[ aRet ] = 2; return aRet; } -- cgit From 61b3bb859f1f9150a68edd307c0367bb89ab69c5 Mon Sep 17 00:00:00 2001 From: hdu Date: Wed, 21 Oct 2009 18:16:37 +0200 Subject: #i106127# perf: add B2DCubicBezier::getMaxDistancePositions ( ) to allow better bezier-subdivisions --- basegfx/inc/basegfx/curve/b2dcubicbezier.hxx | 16 ++++++++++ basegfx/source/curve/b2dcubicbezier.cxx | 48 ++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/basegfx/inc/basegfx/curve/b2dcubicbezier.hxx b/basegfx/inc/basegfx/curve/b2dcubicbezier.hxx index 4dc2f45568f1..81be451499ea 100644 --- a/basegfx/inc/basegfx/curve/b2dcubicbezier.hxx +++ b/basegfx/inc/basegfx/curve/b2dcubicbezier.hxx @@ -203,6 +203,22 @@ namespace basegfx sense to use reserve(4) at the vector as preparation. */ void getAllExtremumPositions(::std::vector< double >& rResults) const; + + /** Get optimum-split position on this segment + + This method calculates the positions of all points of the segment + that have the maximimum distance to the corresponding line from + startpoint-endpoint. This helps to approximate the bezier curve + with a minimum number of line segments + + @param fResults + Result positions are in the range ]0.0 .. 1.0[ + Cubic beziers have at most two of these positions + + @return + Returns the number of split positions found + */ + int getMaxDistancePositions( double fResults[2]) const; }; } // end of namespace basegfx diff --git a/basegfx/source/curve/b2dcubicbezier.cxx b/basegfx/source/curve/b2dcubicbezier.cxx index e7247a95333b..f0a1a0b54e90 100644 --- a/basegfx/source/curve/b2dcubicbezier.cxx +++ b/basegfx/source/curve/b2dcubicbezier.cxx @@ -1045,6 +1045,54 @@ namespace basegfx impCheckExtremumResult(fCY / (2 * fBY), rResults); } } + + int B2DCubicBezier::getMaxDistancePositions( double pResult[2]) const + { + // the distance from the bezier to a line through start and end + // is proportional to (ENDx-STARTx,ENDy-STARTy)*(+BEZIERy(t),-BEZIERx(t)) + // this distance becomes zero for at least t==0 and t==1 + // its extrema that are between 0..1 are interesting as split candidates + // its derived function has the form dD/dt = fA*t^2 + 2*fB*t + fC + const B2DPoint aRelativeEndPoint(maEndPoint-maStartPoint); + const double fA = 3 * (maEndPoint.getX() - maControlPointB.getX()) * aRelativeEndPoint.getY() + - 3 * (maEndPoint.getY() - maControlPointB.getY()) * aRelativeEndPoint.getX(); + const double fB = (maControlPointB.getX() - maControlPointA.getX()) * aRelativeEndPoint.getY() + - (maControlPointB.getY() - maControlPointA.getY()) * aRelativeEndPoint.getX(); + const double fC = (maControlPointA.getX() - maStartPoint.getX()) * aRelativeEndPoint.getY() + - (maControlPointA.getY() - maStartPoint.getY()) * aRelativeEndPoint.getX(); + + if( fTools::equalZero(fA) ) + { + // test for degenerated case: straight line + if( fTools::equalZero(fB) ) + return 0; + + // degenerated case: quadratic bezier + pResult[0] = -fC / (2*fB); + if( pResult[0] < 0 || pResult[0]>1) + return 0; + return 1; + } + + // derivative is polynomial of order 2 => use binomial formula + const double fD = fB*fB - fA*fC; + if( fD >= 0.0 ) + { + const double fS = sqrt(fD); + const double fQ = fB + ((fB >= 0) ? +fS : -fS); + pResult[0] = fQ / fA; + pResult[1] = fC / fQ; + int nCount = 2; + if( pResult[1] < 0 || pResult[1]>1) + --nCount; + if( pResult[0] < 0 || pResult[0]>1) + { --nCount; pResult[0] = pResult[0]; } + return nCount; + } + + return 0; + } + } // end of namespace basegfx // eof -- cgit From b3ca7dcbcf0f0cb9e885583a3e7a617439d58008 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Wed, 21 Oct 2009 18:35:16 +0200 Subject: #i105152# fix border painting --- vcl/unx/kde4/KDESalGraphics.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index 2e8f0dcad96b..1c9882923b43 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -513,10 +513,12 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, } else if (type == CTRL_FRAME) { + pixmap.fill(KApplication::palette().color(QPalette::Window)); lcl_drawFrame( widgetRect, painter, QStyle::PE_Frame, nControlState, value ); } else if (type == CTRL_FIXEDBORDER) { + pixmap.fill(KApplication::palette().color(QPalette::Window)); lcl_drawFrame( widgetRect, painter, QStyle::PE_FrameWindow, nControlState, value ); } else if (type == CTRL_WINDOW_BACKGROUND) -- cgit From f7de0f3ce2a36dc443e0dd3bd181a4add7258f2b Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Wed, 21 Oct 2009 19:11:24 +0200 Subject: #i104396#: some warnings, PCH and windows only fixes --- svl/util/makefile.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svl/util/makefile.mk b/svl/util/makefile.mk index 36e1d3f63852..6d4327700340 100644 --- a/svl/util/makefile.mk +++ b/svl/util/makefile.mk @@ -35,7 +35,7 @@ PRJNAME=svl TARGET=svl RESTARGETSIMPLE=svs GEN_HID=TRUE -GEN_HID_OTHER=TRUE +# GEN_HID_OTHER=TRUE ENABLE_EXCEPTIONS=TRUE # --- Settings ----------------------------------------------------- -- cgit From bd76a8cd10f3a734f4dc0489faa76bd4ce92866a Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Thu, 22 Oct 2009 09:12:25 +0200 Subject: #i103496#: forgot to add lib to svl --- svl/source/uno/registerservices.cxx | 7 ++++--- svl/util/makefile.mk | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/svl/source/uno/registerservices.cxx b/svl/source/uno/registerservices.cxx index daaf799bffea..39be9e177fea 100644 --- a/svl/source/uno/registerservices.cxx +++ b/svl/source/uno/registerservices.cxx @@ -36,6 +36,7 @@ #include #include #include +#include namespace css = com::sun::star; using css::uno::Reference; @@ -56,13 +57,13 @@ DECLARE_CREATEINSTANCE( PathService ) extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( +SVL_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment ( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( +SVL_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo ( void * /* _pServiceManager */, void * _pRegistryKey) { if (_pRegistryKey) @@ -93,7 +94,7 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( return sal_False; } -SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory ( +SVL_DLLPUBLIC void* SAL_CALL component_getFactory ( const sal_Char * pImplementationName, void * _pServiceManager, void * /* _pRegistryKey*/) { void * pResult = 0; diff --git a/svl/util/makefile.mk b/svl/util/makefile.mk index 6d4327700340..47a37a6e9173 100644 --- a/svl/util/makefile.mk +++ b/svl/util/makefile.mk @@ -61,6 +61,7 @@ LIB1FILES= \ $(SLB)$/items.lib \ $(SLB)$/misc.lib \ $(SLB)$/notify.lib \ + $(SLB)$/unoiface.lib \ $(SLB)$/svarray.lib \ $(SLB)$/svsql.lib -- cgit From 10235e9e83bd48e47e07486a5542b4e1b9299e90 Mon Sep 17 00:00:00 2001 From: hdu Date: Thu, 22 Oct 2009 09:19:00 +0200 Subject: #i106127# perf: free roaming curve-subdivision also benefit from pre-allocation --- basegfx/source/polygon/b2dpolygoncutandtouch.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx index 9d40acc0dcab..7597bf1ed11b 100644 --- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx +++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx @@ -7,7 +7,6 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: b2dpolygoncutandtouch.cxx,v $ - * $Revision: 1.8 $ * * This file is part of OpenOffice.org. * @@ -430,6 +429,7 @@ namespace basegfx // create subdivided polygons and find cuts between them // Keep adaptiveSubdivideByCount due to needed quality + aTempPolygonA.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); aTempPolygonA.append(rCubicA.getStartPoint()); rCubicA.adaptiveSubdivideByCount(aTempPolygonA, SUBDIVIDE_FOR_CUT_TEST_COUNT); aTempPolygonEdge.append(rCurrB); @@ -470,8 +470,10 @@ namespace basegfx // create subdivided polygons and find cuts between them // Keep adaptiveSubdivideByCount due to needed quality + aTempPolygonA.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); aTempPolygonA.append(rCubicA.getStartPoint()); rCubicA.adaptiveSubdivideByCount(aTempPolygonA, SUBDIVIDE_FOR_CUT_TEST_COUNT); + aTempPolygonB.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); aTempPolygonB.append(rCubicB.getStartPoint()); rCubicB.adaptiveSubdivideByCount(aTempPolygonB, SUBDIVIDE_FOR_CUT_TEST_COUNT); @@ -497,6 +499,8 @@ namespace basegfx const B2DCubicBezier& rCubicA, sal_uInt32 nInd, temporaryPointVector& rTempPoints) { + // avoid expensive part of this method if possible + // TODO: use hasAnyExtremum() method instead when it becomes available double fDummy; const bool bHasAnyExtremum = rCubicA.getMinimumExtremumPosition( fDummy ); if( !bHasAnyExtremum ) @@ -510,6 +514,7 @@ namespace basegfx // create subdivided polygon and find cuts on it // Keep adaptiveSubdivideByCount due to needed quality + aTempPolygon.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); aTempPolygon.append(rCubicA.getStartPoint()); rCubicA.adaptiveSubdivideByCount(aTempPolygon, SUBDIVIDE_FOR_CUT_TEST_COUNT); findCuts(aTempPolygon, aTempPointVector); -- cgit From 350ea0397036814992d47c7b836ef6f5005c6e98 Mon Sep 17 00:00:00 2001 From: hdu Date: Thu, 22 Oct 2009 09:35:47 +0200 Subject: #i106127# fix typo in new method getMaxDistancePositions() --- basegfx/source/curve/b2dcubicbezier.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/basegfx/source/curve/b2dcubicbezier.cxx b/basegfx/source/curve/b2dcubicbezier.cxx index f0a1a0b54e90..38d783e9651d 100644 --- a/basegfx/source/curve/b2dcubicbezier.cxx +++ b/basegfx/source/curve/b2dcubicbezier.cxx @@ -7,7 +7,6 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: b2dcubicbezier.cxx,v $ - * $Revision: 1.16 $ * * This file is part of OpenOffice.org. * @@ -1086,7 +1085,8 @@ namespace basegfx if( pResult[1] < 0 || pResult[1]>1) --nCount; if( pResult[0] < 0 || pResult[0]>1) - { --nCount; pResult[0] = pResult[0]; } + if( --nCount) + pResult[0] = pResult[1]; return nCount; } -- cgit From ab818b36b52e646b43e390d1b6c0140b91a92523 Mon Sep 17 00:00:00 2001 From: hdu Date: Thu, 22 Oct 2009 11:39:42 +0200 Subject: #i106127# perf: consecutive polygon segments always touch so costly decisions based only on the touch-criterion should be avoided for this case --- basegfx/inc/basegfx/range/b1drange.hxx | 6 ++++- basegfx/inc/basegfx/range/b2drange.hxx | 9 ++++++- basegfx/inc/basegfx/range/basicrange.hxx | 9 ++++++- basegfx/source/polygon/b2dpolygoncutandtouch.cxx | 33 +++++++++++++++++++++--- 4 files changed, 50 insertions(+), 7 deletions(-) diff --git a/basegfx/inc/basegfx/range/b1drange.hxx b/basegfx/inc/basegfx/range/b1drange.hxx index efca06d92dfd..366431c3cd50 100644 --- a/basegfx/inc/basegfx/range/b1drange.hxx +++ b/basegfx/inc/basegfx/range/b1drange.hxx @@ -7,7 +7,6 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: b1drange.hxx,v $ - * $Revision: 1.15 $ * * This file is part of OpenOffice.org. * @@ -131,6 +130,11 @@ namespace basegfx return maRange.overlaps(rRange.maRange); } + bool overlapsMore(const B1DRange& rRange) const + { + return maRange.overlapsMore(rRange.maRange); + } + void expand(double fValue) { maRange.expand(fValue); diff --git a/basegfx/inc/basegfx/range/b2drange.hxx b/basegfx/inc/basegfx/range/b2drange.hxx index 66892865399f..8a70d4782f47 100644 --- a/basegfx/inc/basegfx/range/b2drange.hxx +++ b/basegfx/inc/basegfx/range/b2drange.hxx @@ -7,7 +7,6 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: b2drange.hxx,v $ - * $Revision: 1.19 $ * * This file is part of OpenOffice.org. * @@ -222,6 +221,14 @@ namespace basegfx ); } + bool overlapsMore(const B2DRange& rRange) const + { + return ( + maRangeX.overlapsMore(rRange.maRangeX) + && maRangeY.overlapsMore(rRange.maRangeY) + ); + } + void expand(const B2DTuple& rTuple) { maRangeX.expand(rTuple.getX()); diff --git a/basegfx/inc/basegfx/range/basicrange.hxx b/basegfx/inc/basegfx/range/basicrange.hxx index a7c402c905c8..59d13cf530c0 100644 --- a/basegfx/inc/basegfx/range/basicrange.hxx +++ b/basegfx/inc/basegfx/range/basicrange.hxx @@ -7,7 +7,6 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: basicrange.hxx,v $ - * $Revision: 1.15 $ * * This file is part of OpenOffice.org. * @@ -142,6 +141,14 @@ namespace basegfx } } + bool overlapsMore(const BasicRange& rRange) const + { + if(isEmpty() || rRange.isEmpty()) + return false; + // returns true if the overlap is more than just a touching at the limits + return ((rRange.mnMaximum > mnMinimum) && (rRange.mnMinimum < mnMaximum)); + } + bool operator==( const BasicRange& rRange ) const { return (mnMinimum == rRange.mnMinimum && mnMaximum == rRange.mnMaximum); diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx index 7597bf1ed11b..e35e22ae3a04 100644 --- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx +++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx @@ -567,7 +567,14 @@ namespace basegfx const bool bEdgeBIsCurve(aCubicB.isBezier()); const B2DRange aRangeB(aCubicB.getRange()); - if(aRangeA.overlaps(aRangeB)) + // only overlapping segments need to be tested + // consecutive segments touch of course + bool bOverlap = false; + if( b > a+1) + bOverlap = aRangeA.overlaps(aRangeB); + else + bOverlap = aRangeA.overlapsMore(aRangeB); + if( bOverlap) { if(bEdgeAIsCurve && bEdgeBIsCurve) { @@ -609,7 +616,13 @@ namespace basegfx const B2DPoint aNextB(rCandidate.getB2DPoint(b + 1L == nPointCount ? 0L : b + 1L)); const B2DRange aRangeB(aCurrB, aNextB); - if(aRangeA.overlaps(aRangeB)) + // consecutive segments touch of course + bool bOverlap = false; + if( b > a+1) + bOverlap = aRangeA.overlaps(aRangeB); + else + bOverlap = aRangeA.overlapsMore(aRangeB); + if( bOverlap) { findEdgeCutsTwoEdges(aCurrA, aNextA, aCurrB, aNextB, a, b, rTempPoints, rTempPoints); } @@ -806,7 +819,13 @@ namespace basegfx const bool bEdgeBIsCurve(aCubicB.isBezier()); const B2DRange aRangeB(aCubicB.getRange()); - if(aRangeA.overlaps(aRangeB)) + // consecutive segments touch of course + bool bOverlap = false; + if( b > a+1) + bOverlap = aRangeA.overlaps(aRangeB); + else + bOverlap = aRangeA.overlapsMore(aRangeB); + if( bOverlap) { if(bEdgeAIsCurve && bEdgeBIsCurve) { @@ -848,7 +867,13 @@ namespace basegfx const B2DPoint aNextB(rCandidateB.getB2DPoint(b + 1L == nPointCountB ? 0L : b + 1L)); const B2DRange aRangeB(aCurrB, aNextB); - if(aRangeA.overlaps(aRangeB)) + // consecutive segments touch of course + bool bOverlap = false; + if( b > a+1) + bOverlap = aRangeA.overlaps(aRangeB); + else + bOverlap = aRangeA.overlapsMore(aRangeB); + if( bOverlap) { // test for simple edge-edge cuts findEdgeCutsTwoEdges(aCurrA, aNextA, aCurrB, aNextB, a, b, rTempPointsA, rTempPointsB); -- cgit From 6d8370250d2e64ff8ea6047fae628ee68df1f822 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Thu, 22 Oct 2009 15:46:06 +0200 Subject: #i106052# call close handler asynchronously --- vcl/source/window/menu.cxx | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index ebd4475a80fc..c9e0c23e7f16 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -5136,15 +5136,23 @@ IMPL_LINK( MenuBarWindow, CloserHdl, PushButton*, EMPTYARG ) return 0; if( aCloser.GetCurItemId() == IID_DOCUMENTCLOSE ) - return ((MenuBar*)pMenu)->GetCloserHdl().Call( pMenu ); - std::map::iterator it = m_aAddButtons.find( aCloser.GetCurItemId() ); - if( it != m_aAddButtons.end() ) { - MenuBar::MenuBarButtonCallbackArg aArg; - aArg.nId = it->first; - aArg.bHighlight = (aCloser.GetHighlightItemId() == it->first); - aArg.pMenuBar = dynamic_cast(pMenu); - return it->second.m_aSelectLink.Call( &aArg ); + // #i106052# call close hdl asynchronously to ease handler implementation + // this avoids still being in the handler while the DecoToolBox already + // gets destroyed + Application::PostUserEvent( ((MenuBar*)pMenu)->GetCloserHdl(), pMenu ); + } + else + { + std::map::iterator it = m_aAddButtons.find( aCloser.GetCurItemId() ); + if( it != m_aAddButtons.end() ) + { + MenuBar::MenuBarButtonCallbackArg aArg; + aArg.nId = it->first; + aArg.bHighlight = (aCloser.GetHighlightItemId() == it->first); + aArg.pMenuBar = dynamic_cast(pMenu); + return it->second.m_aSelectLink.Call( &aArg ); + } } return 0; } -- cgit From aa99d186de8cd2841cd7aabc371f68f1e05bae1f Mon Sep 17 00:00:00 2001 From: hdu Date: Thu, 22 Oct 2009 15:55:15 +0200 Subject: #i106127# more pre-allocations to prevent reallocations --- basegfx/source/polygon/b2dpolygoncutandtouch.cxx | 1 + basegfx/source/polygon/b2dpolygontools.cxx | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx index e35e22ae3a04..da6ff8904725 100644 --- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx +++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx @@ -711,6 +711,7 @@ namespace basegfx // create subdivided polygon and find cuts on it // Keep adaptiveSubdivideByCount due to needed quality + aTempPolygon.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); aTempPolygon.append(rCubicA.getStartPoint()); rCubicA.adaptiveSubdivideByCount(aTempPolygon, SUBDIVIDE_FOR_CUT_TEST_COUNT); findTouches(aTempPolygon, rPointPolygon, aTempPointVector); diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index 038ad0b35300..7485387c6cb9 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -7,7 +7,6 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: b2dpolygontools.cxx,v $ - * $Revision: 1.29.4.1 $ * * This file is part of OpenOffice.org. * @@ -3278,6 +3277,9 @@ namespace basegfx B2DCubicBezier aBezier; aBezier.setStartPoint(rCandidate.getB2DPoint(0)); + // try to avoid costly reallocations + aRetval.reserve( nEdgeCount+1); + // add start point aRetval.append(aBezier.getStartPoint()); -- cgit From 406092f60abbb258bbd1fc6f2d09e7a669af943b Mon Sep 17 00:00:00 2001 From: hdu Date: Thu, 22 Oct 2009 16:54:19 +0200 Subject: #i106127# perf: using vector.push_back() instead of the generic vector.insertAtWithCount() is worth it when it gets called a gazillion times --- basegfx/inc/basegfx/polygon/b2dpolygon.hxx | 4 ++-- basegfx/source/polygon/b2dpolygon.cxx | 35 +++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/basegfx/inc/basegfx/polygon/b2dpolygon.hxx b/basegfx/inc/basegfx/polygon/b2dpolygon.hxx index 1d5f8aaa4356..c0de4b57ced8 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolygon.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolygon.hxx @@ -7,7 +7,6 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: b2dpolygon.hxx,v $ - * $Revision: 1.14 $ * * This file is part of OpenOffice.org. * @@ -88,7 +87,8 @@ namespace basegfx /// Coordinate insert/append void insert(sal_uInt32 nIndex, const basegfx::B2DPoint& rPoint, sal_uInt32 nCount = 1); - void append(const basegfx::B2DPoint& rPoint, sal_uInt32 nCount = 1); + void append(const basegfx::B2DPoint& rPoint, sal_uInt32 nCount); + void append(const basegfx::B2DPoint& rPoint); void reserve(sal_uInt32 nCount); /// Basic ControlPoint interface diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx index d44599e0f49e..48d00ddcec7d 100644 --- a/basegfx/source/polygon/b2dpolygon.cxx +++ b/basegfx/source/polygon/b2dpolygon.cxx @@ -7,7 +7,6 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: b2dpolygon.cxx,v $ - * $Revision: 1.22 $ * * This file is part of OpenOffice.org. * @@ -128,6 +127,11 @@ public: maVector.reserve(nCount); } + void append(const CoordinateData2D& rValue) + { + maVector.push_back(rValue); + } + void insert(sal_uInt32 nIndex, const CoordinateData2D& rValue, sal_uInt32 nCount) { if(nCount) @@ -385,6 +389,17 @@ public: } } + void append(const ControlVectorPair2D& rValue) + { + maVector.push_back(rValue); + + if(!rValue.getPrevVector().equalZero()) + mnUsedVectors += 1; + + if(!rValue.getNextVector().equalZero()) + mnUsedVectors += 1; + } + void insert(sal_uInt32 nIndex, const ControlVectorPair2D& rValue, sal_uInt32 nCount) { if(nCount) @@ -751,6 +766,19 @@ public: maPoints.reserve(nCount); } + void append(const basegfx::B2DPoint& rPoint) + { + mpBufferedData.reset(); // TODO: is this needed? + const CoordinateData2D aCoordinate(rPoint); + maPoints.append(aCoordinate); + + if(mpControlVector) + { + const ControlVectorPair2D aVectorPair; + mpControlVector->append(aVectorPair); + } + } + void insert(sal_uInt32 nIndex, const basegfx::B2DPoint& rPoint, sal_uInt32 nCount) { if(nCount) @@ -1223,6 +1251,11 @@ namespace basegfx } } + void B2DPolygon::append(const B2DPoint& rPoint) + { + mpPolygon->append(rPoint); + } + B2DPoint B2DPolygon::getPrevControlPoint(sal_uInt32 nIndex) const { OSL_ENSURE(nIndex < mpPolygon->count(), "B2DPolygon access outside range (!)"); -- cgit From f4b316f0117ef507758dfa5c5a1038e0870eded6 Mon Sep 17 00:00:00 2001 From: hdu Date: Fri, 23 Oct 2009 11:02:48 +0200 Subject: #i106127# perf: ignore multiplicit solutions in maxdist calculation --- basegfx/source/curve/b2dcubicbezier.cxx | 34 +++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/basegfx/source/curve/b2dcubicbezier.cxx b/basegfx/source/curve/b2dcubicbezier.cxx index 38d783e9651d..83c620df7870 100644 --- a/basegfx/source/curve/b2dcubicbezier.cxx +++ b/basegfx/source/curve/b2dcubicbezier.cxx @@ -1060,6 +1060,7 @@ namespace basegfx const double fC = (maControlPointA.getX() - maStartPoint.getX()) * aRelativeEndPoint.getY() - (maControlPointA.getY() - maStartPoint.getY()) * aRelativeEndPoint.getX(); + // test for degenerated case: non-cubic curve if( fTools::equalZero(fA) ) { // test for degenerated case: straight line @@ -1068,25 +1069,34 @@ namespace basegfx // degenerated case: quadratic bezier pResult[0] = -fC / (2*fB); - if( pResult[0] < 0 || pResult[0]>1) - return 0; - return 1; + + // test root: ignore it when it is outside the curve + int nCount = ((pResult[0] > 0) && (pResult[0] < 1)); + return nCount; } - // derivative is polynomial of order 2 => use binomial formula + // derivative is polynomial of order 2 + // check if the polynomial has non-imaginary roots const double fD = fB*fB - fA*fC; - if( fD >= 0.0 ) + if( fD >= 0.0 ) // TODO: is this test needed? geometrically not IMHO { + // calculate the first root const double fS = sqrt(fD); const double fQ = fB + ((fB >= 0) ? +fS : -fS); pResult[0] = fQ / fA; - pResult[1] = fC / fQ; - int nCount = 2; - if( pResult[1] < 0 || pResult[1]>1) - --nCount; - if( pResult[0] < 0 || pResult[0]>1) - if( --nCount) - pResult[0] = pResult[1]; + // test root: ignore it when it is outside the curve + int nCount = ((pResult[0] > 0) && (pResult[0] < 1)); + + // ignore multiplicit roots + if( !fTools::equalZero(fD) ) + { + // calculate the second root + const double fRoot = fC / fQ; + pResult[ nCount ] = fC / fQ; + // test root: ignore it when it is outside the curve + nCount += ((fRoot > 0) && (fRoot < 1)); + } + return nCount; } -- cgit From 909922aba1dc7154de5e179aae118aece259cbdc Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Fri, 23 Oct 2009 12:42:45 +0200 Subject: #i103932# allow duplicate field names --- vcl/source/gdi/pdfextoutdevdata.cxx | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index a7d91abcbd5f..9c8c1ec1bf5e 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -283,8 +283,6 @@ struct PageSyncData std::deque< Graphic > mGraphics; std::deque< ::boost::shared_ptr< PDFWriter::AnyWidget > > mControls; - std::set< ::rtl::OUString > mControlNames; - GlobalSyncData* mpGlobalData; sal_Bool mbGroupIgnoreGDIMtfActions; @@ -375,7 +373,6 @@ sal_Bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIM if ( pControl.get() ) rWriter.CreateControl( *pControl ); mControls.pop_front(); - mControlNames.erase( pControl->Name ); } break; case PDFExtOutDevDataSync::BeginGroup : @@ -772,16 +769,6 @@ void PDFExtOutDevData::CreateControl( const PDFWriter::AnyWidget& rControlType, mpPageSyncData->PushAction( mrOutDev, PDFExtOutDevDataSync::CreateControl ); ::boost::shared_ptr< PDFWriter::AnyWidget > pClone( rControlType.Clone() ); - // ensure a unique name - ::rtl::OUString sUniqueName( pClone->Name ); - sal_Int32 nUniqueNumber( 0 ); - while ( mpPageSyncData->mControlNames.find( sUniqueName ) != mpPageSyncData->mControlNames.end() ) - { - sUniqueName = pClone->Name + ::rtl::OUString::valueOf( ++nUniqueNumber ); - } - pClone->Name = sUniqueName; - mpPageSyncData->mControlNames.insert( pClone->Name ); - mpPageSyncData->mControls.push_back( pClone ); } -- cgit From 04c0a8dfe8e68ee04348206ba95872123d584e7e Mon Sep 17 00:00:00 2001 From: hdu Date: Mon, 26 Oct 2009 12:10:17 +0100 Subject: #i106087# inconsistent freetype tests/workaround for old versions --- vcl/source/glyphs/gcach_ftyp.cxx | 4 +++- vcl/source/glyphs/graphite_adaptors.cxx | 10 ++++++---- vcl/source/glyphs/makefile.mk | 3 --- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/vcl/source/glyphs/gcach_ftyp.cxx b/vcl/source/glyphs/gcach_ftyp.cxx index 86feb0d31dae..18857b94af8f 100644 --- a/vcl/source/glyphs/gcach_ftyp.cxx +++ b/vcl/source/glyphs/gcach_ftyp.cxx @@ -135,7 +135,8 @@ static int nFTVERSION = 0; static FT_Error (*pFTNewSize)(FT_Face,FT_Size*); static FT_Error (*pFTActivateSize)(FT_Size); static FT_Error (*pFTDoneSize)(FT_Size); -static FT_Error (*pFTEmbolden)(FT_GlyphSlot); +FT_Error (*pFTEmbolden)(FT_GlyphSlot); +FT_Error (*pFTOblique)(FT_GlyphSlot); static bool bEnableSizeFT = false; struct EqStr{ bool operator()(const char* a, const char* b) const { return !strcmp(a,b); } }; @@ -472,6 +473,7 @@ FreetypeManager::FreetypeManager() pFTActivateSize = (FT_Error(*)(FT_Size))(sal_IntPtr)dlsym( RTLD_DEFAULT, "FT_Activate_Size" ); pFTDoneSize = (FT_Error(*)(FT_Size))(sal_IntPtr)dlsym( RTLD_DEFAULT, "FT_Done_Size" ); pFTEmbolden = (FT_Error(*)(FT_GlyphSlot))(sal_IntPtr)dlsym( RTLD_DEFAULT, "FT_GlyphSlot_Embolden" ); + pFTOblique = (FT_Error(*)(FT_GlyphSlot))(sal_IntPtr)dlsym( RTLD_DEFAULT, "FT_GlyphSlot_Oblique" ); bEnableSizeFT = (pFTNewSize!=NULL) && (pFTActivateSize!=NULL) && (pFTDoneSize!=NULL); diff --git a/vcl/source/glyphs/graphite_adaptors.cxx b/vcl/source/glyphs/graphite_adaptors.cxx index 9b16318fdc40..34e2f5f5bbe3 100644 --- a/vcl/source/glyphs/graphite_adaptors.cxx +++ b/vcl/source/glyphs/graphite_adaptors.cxx @@ -71,6 +71,8 @@ namespace typedef std::hash_map SilfMap; SilfMap sSilfMap; } +extern FT_Error (*pFTEmbolden)(FT_GlyphSlot); +extern FT_Error (*pFTOblique)(FT_GlyphSlot); // class CharacterRenderProperties implentation. // @@ -303,11 +305,11 @@ void GraphiteFontAdaptor::getGlyphMetrics(gr::gid16 nGlyphId, gr::Rect & aBoundi return; } // check whether we need synthetic bold/italic otherwise metric is wrong - if (mrFont.NeedsArtificialBold()) - FT_GlyphSlot_Embolden(aFace->glyph); + if (mrFont.NeedsArtificialBold() && pFTEmbolden) + (*pFTEmbolden)(aFace->glyph); - if (mrFont.NeedsArtificialItalic()) - FT_GlyphSlot_Oblique(aFace->glyph); + if (mrFont.NeedsArtificialItalic() && pFTOblique) + (*pFTOblique)(aFace->glyph); const FT_Glyph_Metrics &gm = aFace->glyph->metrics; diff --git a/vcl/source/glyphs/makefile.mk b/vcl/source/glyphs/makefile.mk index 3e79cdc63da2..e43daaeac2ee 100644 --- a/vcl/source/glyphs/makefile.mk +++ b/vcl/source/glyphs/makefile.mk @@ -42,9 +42,6 @@ ENABLE_EXCEPTIONS=true .INCLUDE : $(PRJ)$/util$/makefile2.pmk CFLAGS+= $(FREETYPE_CFLAGS) -.IF "$(USE_FT_EMBOLDEN)" == "YES" -CFLAGS+=-DUSE_FT_EMBOLDEN -.ENDIF # --- Files -------------------------------------------------------- -- cgit From acae9170ea69e3b54b31ebf0322b53e4818172a3 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Mon, 26 Oct 2009 15:10:09 +0100 Subject: #i103496#: shorten timespan when locale settings are inconsistent as they are stored at three different locations --- i18npool/source/isolang/inwnt.cxx | 4 - unotools/inc/unotools/syslocaleoptions.hxx | 4 + unotools/source/config/syslocaleoptions.cxx | 115 +++++++++++++++++++++++----- unotools/source/misc/syslocale.cxx | 59 +++----------- vcl/source/app/settings.cxx | 113 ++++++++------------------- vcl/source/app/svapp.cxx | 3 - 6 files changed, 139 insertions(+), 159 deletions(-) diff --git a/i18npool/source/isolang/inwnt.cxx b/i18npool/source/isolang/inwnt.cxx index 7d5e4d3216e7..2550eb3acd10 100644 --- a/i18npool/source/isolang/inwnt.cxx +++ b/i18npool/source/isolang/inwnt.cxx @@ -104,11 +104,7 @@ LanguageType MsLangId::getPlatformSystemUILanguage() { // TODO: this could be distinguished, #if(WINVER >= 0x0500) // needs _run_ time differentiation though, not at compile time. -#if 0 getPlatformSystemLanguageImpl( nImplSystemUILanguage, &GetUserDefaultUILanguage, &GetSystemDefaultUILanguage); -#endif - getPlatformSystemLanguageImpl( nImplSystemUILanguage, - &GetUserDefaultLangID, &GetSystemDefaultLangID); return nImplSystemUILanguage; } diff --git a/unotools/inc/unotools/syslocaleoptions.hxx b/unotools/inc/unotools/syslocaleoptions.hxx index 2da102c161cc..6bb81fdd3ee0 100644 --- a/unotools/inc/unotools/syslocaleoptions.hxx +++ b/unotools/inc/unotools/syslocaleoptions.hxx @@ -107,11 +107,15 @@ public: const ::rtl::OUString& GetLocaleConfigString() const; void SetLocaleConfigString( const ::rtl::OUString& rStr ); com::sun::star::lang::Locale GetLocale() const; + com::sun::star::lang::Locale GetRealLocale() const; + LanguageType GetRealLanguage() const; /// The config string may be empty to denote the SYSTEM locale const ::rtl::OUString& GetUILocaleConfigString() const; void SetUILocaleConfigString( const ::rtl::OUString& rStr ); com::sun::star::lang::Locale GetUILocale() const; + com::sun::star::lang::Locale GetRealUILocale() const; + LanguageType GetRealUILanguage() const; /// The config string may be empty to denote the default currency of the locale const ::rtl::OUString& GetCurrencyConfigString() const; diff --git a/unotools/source/config/syslocaleoptions.cxx b/unotools/source/config/syslocaleoptions.cxx index 6c4071709e02..f358fe24df4f 100644 --- a/unotools/source/config/syslocaleoptions.cxx +++ b/unotools/source/config/syslocaleoptions.cxx @@ -62,8 +62,32 @@ namespace : public rtl::Static {}; } +com::sun::star::lang::Locale lcl_str_to_locale( const ::rtl::OUString rStr ) +{ + com::sun::star::lang::Locale aRet; + if ( rStr.getLength() ) + { + aRet = com::sun::star::lang::Locale(); + sal_Int32 nSep = rStr.indexOf('-'); + if (nSep < 0) + aRet.Language = rStr; + else + { + aRet.Language = rStr.copy(0, nSep); + if (nSep < rStr.getLength()) + aRet.Country = rStr.copy(nSep+1, rStr.getLength() - (nSep+1)); + } + } + + return aRet; +} + class SvtSysLocaleOptions_Impl : public utl::ConfigItem { + Locale m_aRealLocale; + Locale m_aRealUILocale; + LanguageType m_eRealLanguage; + LanguageType m_eRealUILanguage; OUString m_aLocaleString; // en-US or de-DE or empty for SYSTEM OUString m_aUILocaleString; // en-US or de-DE or empty for SYSTEM OUString m_aCurrencyString; // USD-en-US or EUR-de-DE @@ -75,7 +99,9 @@ class SvtSysLocaleOptions_Impl : public utl::ConfigItem sal_Bool m_bROCurrency; sal_Bool m_bRODecimalSeparator; - static const Sequence< /* const */ OUString > GetPropertyNames(); + static const Sequence< /* const */ OUString > GetPropertyNames(); + void MakeRealLocale(); + void MakeRealUILocale(); public: SvtSysLocaleOptions_Impl(); @@ -100,6 +126,10 @@ public: void SetDecimalSeparatorAsLocale( sal_Bool bSet); sal_Bool IsReadOnly( SvtSysLocaleOptions::EOption eOption ) const; + const Locale& GetRealLocale() { return m_aRealLocale; } + const Locale& GetRealUILocale() { return m_aRealUILocale; } + LanguageType GetRealLanguage() { return m_eRealLanguage; } + LanguageType GetRealUILanguage() { return m_eRealUILanguage; } }; @@ -217,6 +247,9 @@ SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl() // UpdateMiscSettings_Impl(); EnableNotification( aNames ); } + + MakeRealLocale(); + MakeRealUILocale(); } @@ -226,6 +259,37 @@ SvtSysLocaleOptions_Impl::~SvtSysLocaleOptions_Impl() Commit(); } +void SvtSysLocaleOptions_Impl::MakeRealLocale() +{ + m_aRealLocale = lcl_str_to_locale( m_aLocaleString ); + if ( m_aRealLocale.Language.getLength() ) + { + m_eRealLanguage = MsLangId::convertLocaleToLanguage( m_aRealLocale ); + } + else + { + m_eRealLanguage = MsLangId::getSystemLanguage(); + MsLangId::convertLanguageToLocale( m_eRealLanguage, m_aRealLocale ); + } +} + +void SvtSysLocaleOptions_Impl::MakeRealUILocale() +{ + if ( !m_aRealUILocale.Language.getLength() ) + { + // as we can't switch UILocale at runtime, we only store changes in the configuration + m_aRealUILocale = lcl_str_to_locale( m_aUILocaleString ); + if ( m_aRealUILocale.Language.getLength() ) + { + m_eRealUILanguage = MsLangId::convertLocaleToLanguage( m_aRealUILocale ); + } + else + { + m_eRealUILanguage = MsLangId::getSystemUILanguage(); + MsLangId::convertLanguageToLocale( m_eRealUILanguage, m_aRealUILocale ); + } + } +} sal_Bool SvtSysLocaleOptions_Impl::IsReadOnly( SvtSysLocaleOptions::EOption eOption ) const { @@ -322,6 +386,8 @@ void SvtSysLocaleOptions_Impl::SetLocaleString( const OUString& rStr ) if (!m_bROLocale && rStr != m_aLocaleString ) { m_aLocaleString = rStr; + MakeRealLocale(); + MsLangId::setConfiguredSystemLanguage( m_eRealLanguage ); SetModified(); ULONG nHint = SYSLOCALEOPTIONS_HINT_LOCALE; if ( !m_aCurrencyString.getLength() ) @@ -335,8 +401,13 @@ void SvtSysLocaleOptions_Impl::SetUILocaleString( const OUString& rStr ) if (!m_bROUILocale && rStr != m_aUILocaleString ) { m_aUILocaleString = rStr; +/* + // as we can't switch UILocale at runtime, we only store changes in the configuration + MakeRealUILocale(); + MsLangId::setConfiguredSystemLanguage( m_eRealUILanguage ); SetModified(); NotifyListeners( SYSLOCALEOPTIONS_HINT_UILOCALE ); +*/ } } @@ -376,6 +447,7 @@ void SvtSysLocaleOptions_Impl::Notify( const Sequence< rtl::OUString >& seqPrope nHint |= SYSLOCALEOPTIONS_HINT_LOCALE; if ( !m_aCurrencyString.getLength() ) nHint |= SYSLOCALEOPTIONS_HINT_CURRENCY; + MakeRealLocale(); } if( seqPropertyNames[nProp] == PROPERTYNAME_UILOCALE ) { @@ -383,6 +455,7 @@ void SvtSysLocaleOptions_Impl::Notify( const Sequence< rtl::OUString >& seqPrope seqValues[nProp] >>= m_aUILocaleString; m_bROUILocale = seqROStates[nProp]; nHint |= SYSLOCALEOPTIONS_HINT_UILOCALE; + MakeRealUILocale(); } else if( seqPropertyNames[nProp] == PROPERTYNAME_CURRENCY ) { @@ -599,26 +672,6 @@ void SvtSysLocaleOptions::ConfigurationChanged( utl::ConfigurationBroadcaster* p ::utl::detail::Options::ConfigurationChanged( p, nHint ); } -com::sun::star::lang::Locale lcl_str_to_locale( const ::rtl::OUString rStr ) -{ - com::sun::star::lang::Locale aRet; - if ( rStr.getLength() ) - { - aRet = com::sun::star::lang::Locale(); - sal_Int32 nSep = rStr.indexOf('-'); - if (nSep < 0) - aRet.Language = rStr; - else - { - aRet.Language = rStr.copy(0, nSep); - if (nSep < rStr.getLength()) - aRet.Country = rStr.copy(nSep+1, rStr.getLength() - (nSep+1)); - } - } - - return aRet; -} - com::sun::star::lang::Locale SvtSysLocaleOptions::GetLocale() const { return lcl_str_to_locale( GetLocaleConfigString() ); @@ -628,3 +681,23 @@ com::sun::star::lang::Locale SvtSysLocaleOptions::GetUILocale() const { return lcl_str_to_locale( GetUILocaleConfigString() ); } + +com::sun::star::lang::Locale SvtSysLocaleOptions::GetRealLocale() const +{ + return pOptions->GetRealLocale(); +} + +com::sun::star::lang::Locale SvtSysLocaleOptions::GetRealUILocale() const +{ + return pOptions->GetRealUILocale(); +} + +LanguageType SvtSysLocaleOptions::GetRealLanguage() const +{ + return pOptions->GetRealLanguage(); +} + +LanguageType SvtSysLocaleOptions::GetRealUILanguage() const +{ + return pOptions->GetRealUILanguage(); +} \ No newline at end of file diff --git a/unotools/source/misc/syslocale.cxx b/unotools/source/misc/syslocale.cxx index f108cd2ed3df..8e9d75c6ce0c 100644 --- a/unotools/source/misc/syslocale.cxx +++ b/unotools/source/misc/syslocale.cxx @@ -54,57 +54,19 @@ public: SvtSysLocaleOptions aSysLocaleOptions; LocaleDataWrapper* pLocaleData; CharClass* pCharClass; - com::sun::star::lang::Locale maLocale; - com::sun::star::lang::Locale maUILocale; - LanguageType meLanguage; - LanguageType meUILanguage; SvtSysLocale_Impl(); virtual ~SvtSysLocale_Impl(); CharClass* GetCharClass(); virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); - void GetLocale(); - void GetUILocale(); }; -void SvtSysLocale_Impl::GetLocale() -{ - // ask configuration - maLocale = aSysLocaleOptions.GetLocale(); - if ( maLocale.Language.getLength() ) - { - meLanguage = MsLangId::convertLocaleToLanguage( maLocale ); - } - else - { - meLanguage = MsLangId::getSystemLanguage(); - MsLangId::convertLanguageToLocale( meLanguage, maLocale ); - } -} - -void SvtSysLocale_Impl::GetUILocale() -{ - maLocale = aSysLocaleOptions.GetLocale(); - if ( maUILocale.Language.getLength() ) - { - meUILanguage = MsLangId::convertLocaleToLanguage( maUILocale ); - } - else - { - meUILanguage = MsLangId::getSystemUILanguage(); - MsLangId::convertLanguageToLocale( meUILanguage, maUILocale ); - } -} - // ----------------------------------------------------------------------- SvtSysLocale_Impl::SvtSysLocale_Impl() : pCharClass(NULL) { - GetLocale(); - GetUILocale(); - - pLocaleData = new LocaleDataWrapper( ::comphelper::getProcessServiceFactory(), maLocale ); + pLocaleData = new LocaleDataWrapper( ::comphelper::getProcessServiceFactory(), aSysLocaleOptions.GetRealLocale() ); // listen for further changes aSysLocaleOptions.AddListener( this ); @@ -121,7 +83,7 @@ SvtSysLocale_Impl::~SvtSysLocale_Impl() CharClass* SvtSysLocale_Impl::GetCharClass() { if ( !pCharClass ) - pCharClass = new CharClass(::comphelper::getProcessServiceFactory(), maLocale ); + pCharClass = new CharClass(::comphelper::getProcessServiceFactory(), aSysLocaleOptions.GetRealLocale() ); return pCharClass; } @@ -130,13 +92,10 @@ void SvtSysLocale_Impl::ConfigurationChanged( utl::ConfigurationBroadcaster*, sa MutexGuard aGuard( SvtSysLocale::GetMutex() ); if ( nHint & SYSLOCALEOPTIONS_HINT_LOCALE ) { - GetLocale(); - pLocaleData->setLocale( maLocale ); - GetCharClass()->setLocale( maLocale ); + com::sun::star::lang::Locale aLocale( aSysLocaleOptions.GetRealLocale() ); + pLocaleData->setLocale( aLocale ); + GetCharClass()->setLocale( aLocale ); } - - if ( nHint & SYSLOCALEOPTIONS_HINT_UILOCALE ) - GetUILocale(); } // ==================================================================== @@ -210,22 +169,22 @@ SvtSysLocaleOptions& SvtSysLocale::GetOptions() const com::sun::star::lang::Locale SvtSysLocale::GetLocale() const { - return pImpl->maLocale; + return pImpl->aSysLocaleOptions.GetRealLocale(); } LanguageType SvtSysLocale::GetLanguage() const { - return pImpl->meLanguage; + return pImpl->aSysLocaleOptions.GetRealLanguage(); } com::sun::star::lang::Locale SvtSysLocale::GetUILocale() const { - return pImpl->maUILocale; + return pImpl->aSysLocaleOptions.GetRealUILocale(); } LanguageType SvtSysLocale::GetUILanguage() const { - return pImpl->meUILanguage; + return pImpl->aSysLocaleOptions.GetRealUILanguage(); } diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 9ecbef93656c..09262dff7eec 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -1525,7 +1525,7 @@ ImplAllSettingsData::ImplAllSettingsData() mnSystemUpdate = SETTINGS_ALLSETTINGS; mnWindowUpdate = SETTINGS_ALLSETTINGS; meLanguage = LANGUAGE_SYSTEM; - meUILanguage = LANGUAGE_SYSTEM; + meUILanguage = LANGUAGE_SYSTEM; mpLocaleDataWrapper = NULL; mpUILocaleDataWrapper = NULL; mpCollatorWrapper = NULL; @@ -1544,15 +1544,12 @@ ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData& rData ) : maMiscSettings( rData.maMiscSettings ), maNotificationSettings( rData.maNotificationSettings ), maHelpSettings( rData.maHelpSettings ), - maLocale( rData.maLocale ), - maUILocale( rData.maUILocale ) - + maLocale( rData.maLocale ) { mnRefCount = 1; mnSystemUpdate = rData.mnSystemUpdate; mnWindowUpdate = rData.mnWindowUpdate; meLanguage = rData.meLanguage; - meUILanguage = rData.meUILanguage; // Pointer couldn't shared and objects haven't a copy ctor // So we create the cache objects new, if the GetFunction is // called @@ -1748,11 +1745,7 @@ ULONG AllSettings::Update( ULONG nFlags, const AllSettings& rSet ) if ( nFlags & SETTINGS_UILOCALE ) { - if ( mpData->meUILanguage || rSet.mpData->meUILanguage ) - { - SetUILanguage( rSet.mpData->meUILanguage ); - nChangeFlags |= SETTINGS_UILOCALE; - } + DBG_ERROR("UILocale can't be changed!"); } return nChangeFlags; @@ -1791,9 +1784,6 @@ ULONG AllSettings::GetChangeFlags( const AllSettings& rSet ) const if ( mpData->meLanguage || rSet.mpData->meLanguage ) nChangeFlags |= SETTINGS_LOCALE; - if ( mpData->meUILanguage || rSet.mpData->meUILanguage ) - nChangeFlags |= SETTINGS_UILOCALE; - return nChangeFlags; } @@ -1815,18 +1805,13 @@ BOOL AllSettings::operator ==( const AllSettings& rSet ) const (mpData->maNotificationSettings == rSet.mpData->maNotificationSettings) && (mpData->maHelpSettings == rSet.mpData->maHelpSettings) && (mpData->mnSystemUpdate == rSet.mpData->mnSystemUpdate) && + (mpData->maLocale == rSet.mpData->maLocale) && (mpData->mnWindowUpdate == rSet.mpData->mnWindowUpdate) ) { - // special treatment for Locale, because maLocale is only - // initialized after first call of GetLocale(). - ::com::sun::star::lang::Locale aEmptyLocale; - if ( ( ImplCompareLocales( mpData->maLocale, aEmptyLocale ) && ImplCompareLocales( rSet.mpData->maLocale, aEmptyLocale ) ) - || ImplCompareLocales( GetLocale(), rSet.GetLocale() ) ) - { - return TRUE; - } + return TRUE; } - return FALSE; + else + return FALSE; } // ----------------------------------------------------------------------- @@ -1855,70 +1840,39 @@ void AllSettings::SetLocale( const ::com::sun::star::lang::Locale& rLocale ) // ----------------------------------------------------------------------- -void AllSettings::SetUILocale( const ::com::sun::star::lang::Locale& rLocale ) +void AllSettings::SetUILocale( const ::com::sun::star::lang::Locale& ) { - CopyData(); - - mpData->maUILocale = rLocale; - - if ( !rLocale.Language.getLength() ) - mpData->meUILanguage = LANGUAGE_SYSTEM; - else - mpData->meUILanguage = MsLangId::convertLocaleToLanguage( rLocale ); - if ( mpData->mpUILocaleDataWrapper ) - { - delete mpData->mpUILocaleDataWrapper; - mpData->mpUILocaleDataWrapper = NULL; - } - if ( mpData->mpUII18nHelper ) - { - delete mpData->mpUII18nHelper; - mpData->mpUII18nHelper = NULL; - } + // there is only one UILocale per process } // ----------------------------------------------------------------------- void AllSettings::SetLanguage( LanguageType eLang ) { - CopyData(); - - mpData->meLanguage = eLang; - - // Will be calculated in GetLocale() - mpData->maLocale = ::com::sun::star::lang::Locale(); - if ( mpData->mpLocaleDataWrapper ) + if ( eLang != mpData->meLanguage ) { - delete mpData->mpLocaleDataWrapper; - mpData->mpLocaleDataWrapper = NULL; - } - if ( mpData->mpI18nHelper ) - { - delete mpData->mpI18nHelper; - mpData->mpI18nHelper = NULL; + CopyData(); + + mpData->meLanguage = eLang; + MsLangId::convertLanguageToLocale( GetLanguage(), ((AllSettings*)this)->mpData->maLocale ); + if ( mpData->mpLocaleDataWrapper ) + { + delete mpData->mpLocaleDataWrapper; + mpData->mpLocaleDataWrapper = NULL; + } + if ( mpData->mpI18nHelper ) + { + delete mpData->mpI18nHelper; + mpData->mpI18nHelper = NULL; + } } } // ----------------------------------------------------------------------- -void AllSettings::SetUILanguage( LanguageType eLang ) +void AllSettings::SetUILanguage( LanguageType ) { - CopyData(); - - mpData->meUILanguage = eLang; - - // Will be calculated in GetUILocale() - mpData->maUILocale = ::com::sun::star::lang::Locale(); - if ( mpData->mpUILocaleDataWrapper ) - { - delete mpData->mpUILocaleDataWrapper; - mpData->mpUILocaleDataWrapper = NULL; - } - if ( mpData->mpUII18nHelper ) - { - delete mpData->mpUII18nHelper; - mpData->mpUII18nHelper = NULL; - } + // there is only one UILanguage per process } // ----------------------------------------------------------------------- @@ -1980,6 +1934,7 @@ const ::com::sun::star::lang::Locale& AllSettings::GetLocale() const const ::com::sun::star::lang::Locale& AllSettings::GetUILocale() const { + // the UILocale is never changed if ( !mpData->maUILocale.Language.getLength() ) mpData->maUILocale = mpData->maSysLocale.GetUILocale(); @@ -1990,8 +1945,9 @@ const ::com::sun::star::lang::Locale& AllSettings::GetUILocale() const LanguageType AllSettings::GetLanguage() const { + // meLanguage == LANGUAGE_SYSTEM means: use settings from SvtSysLocale if ( mpData->meLanguage == LANGUAGE_SYSTEM ) - mpData->meLanguage = mpData->maSysLocale.GetLanguage(); + return mpData->maSysLocale.GetLanguage(); return mpData->meLanguage; } @@ -2000,10 +1956,8 @@ LanguageType AllSettings::GetLanguage() const LanguageType AllSettings::GetUILanguage() const { - if ( mpData->meUILanguage == LANGUAGE_SYSTEM ) - mpData->meUILanguage = mpData->maSysLocale.GetUILanguage(); - - return mpData->meUILanguage; + // the UILanguage is never changed + return mpData->maSysLocale.GetUILanguage(); } // ----------------------------------------------------------------------- @@ -2086,11 +2040,8 @@ void AllSettings::LocaleSettingsChanged( sal_uInt32 nHint ) } } - if ( nHint & SYSLOCALEOPTIONS_HINT_LOCALE ) + if ( (nHint & SYSLOCALEOPTIONS_HINT_LOCALE) ) aAllSettings.SetLocale( aAllSettings.mpData->maSysLocale.GetOptions().GetLocale() ); - if ( nHint & SYSLOCALEOPTIONS_HINT_UILOCALE ) - aAllSettings.SetLocale( aAllSettings.mpData->maSysLocale.GetOptions().GetUILocale() ); - Application::SetSettings( aAllSettings ); } diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 19b8ea1ff14d..40f6d17f36ae 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #ifndef _ACCMGR_HXX @@ -705,8 +704,6 @@ bool Application::ValidateSystemFont() void Application::SetSettings( const AllSettings& rSettings ) { - MsLangId::setConfiguredSystemLanguage( rSettings.GetLanguage()); - MsLangId::setConfiguredSystemUILanguage( rSettings.GetUILanguage()); ImplSVData* pSVData = ImplGetSVData(); if ( !pSVData->maAppData.mpSettings ) { -- cgit From 7bda1112bb57fb92a44bd22023396ec0cee3825f Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Tue, 27 Oct 2009 12:24:12 +0000 Subject: unix line ends --- vcl/source/gdi/textlayout.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx index 75d594258d1c..67a30c351b7a 100755 --- a/vcl/source/gdi/textlayout.cxx +++ b/vcl/source/gdi/textlayout.cxx @@ -22,7 +22,7 @@ * * for a copy of the LGPLv3 License. ************************************************************************/ - + // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -- cgit From 53c9c396125833bbfce4aa376637b96239826cc7 Mon Sep 17 00:00:00 2001 From: Frank Schönheit Date: Tue, 27 Oct 2009 14:15:36 +0000 Subject: #i105717# draw without reference device if the target device equals the reference device. This catches the case where the Writer sets a PIXEL-based ref device, and draws onto it - the usual 'draw using ref device' code doesn't allow for PIXELs --- vcl/source/control/ctrl.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index 521d3d6844d7..1800327df33c 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -563,7 +563,7 @@ void Control::DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRec } #endif - if ( !mpControlData->mpReferenceDevice ) + if ( !mpControlData->mpReferenceDevice || ( mpControlData->mpReferenceDevice == &_rTargetDevice ) ) { _io_rRect = _rTargetDevice.GetTextRect( _io_rRect, _rStr, _nStyle ); _rTargetDevice.DrawText( _io_rRect, _rStr, _nStyle, _pVector, _pDisplayText ); -- cgit From 475a5ec764e1963f179df43cfa91e1c73b5a97c5 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Tue, 27 Oct 2009 15:01:25 +0000 Subject: CWS-TOOLING: integrate CWS impress178 2009-10-16 19:54:41 +0200 sj r276995 : removed warning 2009-10-16 17:46:12 +0200 sj r276993 : #i103757# applied patch (fixed crash if model changes) 2009-10-16 16:06:07 +0200 sj r276985 : CWS-TOOLING: rebase CWS impress178 to branches/OOO320@276942 (milestone: OOO320:m2) 2009-10-08 13:51:23 +0200 sj r276790 : #i105654# fixed closing of line geometry 2009-10-07 17:26:56 +0200 sj r276762 : #i105606# fixed object shadow 2009-10-07 17:25:39 +0200 sj r276761 : minor improvements 2009-10-07 11:48:26 +0200 af r276745 : #i103047# Prevent context menu of LayoutMenu from being shown when user clicks on background. 2009-10-07 11:33:59 +0200 af r276743 : #i99866# Set position of the design control manually. 2009-10-06 17:18:23 +0200 sj r276721 : minor improvements 2009-10-05 18:34:23 +0200 sj r276692 : #105606# fixed fontsize problem 2009-10-05 17:26:21 +0200 af r276691 : #i105354# Never process more than one request in a row. 2009-10-02 13:24:25 +0200 af r276639 : #i94242# Taking insertion position of slide sorter correctly into account. 2009-10-01 13:46:47 +0200 aw r276602 : #i102224# some Polygon/PolyPolygon usages in SVMConverter ignored the possible curve status of tools::Polygon; added at least an AdaptiveSubdivide 2009-10-01 12:33:56 +0200 aw r276588 : #i102224# ImplWritePolyPolygon killed the curve information at the PolyPolygon by NOT copying the flags 2009-09-30 17:48:56 +0200 aw r276567 : #i102224# removed GetSimple() from Polygon and PolyPolygon, replaced completely with AdaptiveSubdivide 2009-09-30 15:45:46 +0200 aw r276559 : #i102048# secured primitive creation for dimension lines with linestyle none 2009-09-30 14:56:41 +0200 af r276556 : #i105471# Reordered statements in ~SdModule. 2009-09-30 14:47:12 +0200 aw r276555 : #i105373# corrected curve ignoring places in MetaFile export --- goodies/source/filter.vcl/eos2met/eos2met.cxx | 6 +-- goodies/source/filter.vcl/epict/epict.cxx | 6 +-- svtools/source/filter.vcl/igif/decode.cxx | 3 +- svtools/source/filter.vcl/ixpm/xpmread.cxx | 21 ++++++++--- svtools/source/filter.vcl/wmf/wmfwr.cxx | 6 +-- tools/inc/tools/poly.hxx | 2 - tools/source/generic/poly.cxx | 53 --------------------------- tools/source/generic/poly2.cxx | 17 --------- vcl/source/gdi/cvtsvm.cxx | 40 ++++++++++++++++---- vcl/source/gdi/metaact.cxx | 37 ++++++++++++++++--- vcl/source/gdi/outdev3.cxx | 2 +- vcl/source/gdi/region.cxx | 8 +++- 12 files changed, 97 insertions(+), 104 deletions(-) diff --git a/goodies/source/filter.vcl/eos2met/eos2met.cxx b/goodies/source/filter.vcl/eos2met/eos2met.cxx index b176d186a217..e0b6c2bdea43 100644 --- a/goodies/source/filter.vcl/eos2met/eos2met.cxx +++ b/goodies/source/filter.vcl/eos2met/eos2met.cxx @@ -1753,7 +1753,7 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) Polygon aSimplePoly; const Polygon& rPoly = pA->GetPolygon(); if ( rPoly.HasFlags() ) - rPoly.GetSimple( aSimplePoly ); + rPoly.AdaptiveSubdivide( aSimplePoly ); else aSimplePoly = rPoly; METLine( aSimplePoly ); @@ -1772,7 +1772,7 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) Polygon aSimplePoly; const Polygon& rPoly = pA->GetPolygon(); if ( rPoly.HasFlags() ) - rPoly.GetSimple( aSimplePoly ); + rPoly.AdaptiveSubdivide( aSimplePoly ); else aSimplePoly = rPoly; if( aGDIFillColor != Color( COL_TRANSPARENT ) ) @@ -1809,7 +1809,7 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) if ( aSimplePolyPoly[ i ].HasFlags() ) { Polygon aSimplePoly; - aSimplePolyPoly[ i ].GetSimple( aSimplePoly ); + aSimplePolyPoly[ i ].AdaptiveSubdivide( aSimplePoly ); aSimplePolyPoly[ i ] = aSimplePoly; } } diff --git a/goodies/source/filter.vcl/epict/epict.cxx b/goodies/source/filter.vcl/epict/epict.cxx index 4df7abea01fc..73e321a5b5b3 100644 --- a/goodies/source/filter.vcl/epict/epict.cxx +++ b/goodies/source/filter.vcl/epict/epict.cxx @@ -1573,7 +1573,7 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) Polygon aSimplePoly; if ( rPoly.HasFlags() ) - rPoly.GetSimple( aSimplePoly ); + rPoly.AdaptiveSubdivide( aSimplePoly ); else aSimplePoly = rPoly; @@ -1603,7 +1603,7 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) Polygon aSimplePoly; if ( rPoly.HasFlags() ) - rPoly.GetSimple( aSimplePoly ); + rPoly.AdaptiveSubdivide( aSimplePoly ); else aSimplePoly = rPoly; @@ -1632,7 +1632,7 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) if ( aSimplePolyPoly[ i ].HasFlags() ) { Polygon aSimplePoly; - aSimplePolyPoly[ i ].GetSimple( aSimplePoly ); + aSimplePolyPoly[ i ].AdaptiveSubdivide( aSimplePoly ); aSimplePolyPoly[ i ] = aSimplePoly; } } diff --git a/svtools/source/filter.vcl/igif/decode.cxx b/svtools/source/filter.vcl/igif/decode.cxx index 960a91845bf8..9babc02665a3 100644 --- a/svtools/source/filter.vcl/igif/decode.cxx +++ b/svtools/source/filter.vcl/igif/decode.cxx @@ -51,7 +51,6 @@ GIFLZWDecompressor::GIFLZWDecompressor( BYTE cDataSize ) : bEOIFound ( FALSE ), nDataSize ( cDataSize ) { - pTable = new GIFLZWTableEntry[ 4096 ]; pOutBuf = new BYTE[ 4096 ]; nClearCode = 1 << nDataSize; @@ -61,6 +60,8 @@ GIFLZWDecompressor::GIFLZWDecompressor( BYTE cDataSize ) : nOldCode = 0xffff; pOutBufData = pOutBuf + 4096; + pTable = new GIFLZWTableEntry[ 4098 ]; + for( USHORT i = 0; i < nTableSize; i++ ) { pTable[i].pPrev = NULL; diff --git a/svtools/source/filter.vcl/ixpm/xpmread.cxx b/svtools/source/filter.vcl/ixpm/xpmread.cxx index 0aa070e41596..1a667908f2f1 100644 --- a/svtools/source/filter.vcl/ixpm/xpmread.cxx +++ b/svtools/source/filter.vcl/ixpm/xpmread.cxx @@ -109,6 +109,10 @@ ReadState XPMReader::ReadXPM( Graphic& rGraphic ) mnColors = ImplGetULONG( 2 ); mnCpp = ImplGetULONG( 3 ); } + if ( mnColors > ( SAL_MAX_UINT32 / ( 4 + mnCpp ) ) ) + mbStatus = sal_False; + if ( ( mnWidth * mnCpp ) >= XPMSTRINGBUF ) + mbStatus = sal_False; if ( mbStatus && mnWidth && mnHeight && mnColors && mnCpp ) { mnIdentifier = XPMCOLORS; @@ -118,15 +122,20 @@ ReadState XPMReader::ReadXPM( Graphic& rGraphic ) // 1 Byte -> 0xff wenn Farbe transparent ist // 3 Bytes -> RGB Wert der Farbe mpColMap = new BYTE[ mnColors * ( 4 + mnCpp ) ]; - - for ( ULONG i = 0; i < mnColors; i++ ) + if ( mpColMap ) { - if ( ImplGetColor( i ) == FALSE ) + for ( ULONG i = 0; i < mnColors; i++ ) { - mbStatus = FALSE; - break; + if ( ImplGetColor( i ) == FALSE ) + { + mbStatus = FALSE; + break; + } } } + else + mbStatus = sal_False; + if ( mbStatus ) { // bei mehr als 256 Farben wird eine 24 Bit Grafik erstellt @@ -630,7 +639,7 @@ BOOL XPMReader::ImplGetString( void ) mnStatus &=~XPMSTRING; // end of parameter by eol break; } - if ( mnStringSize >= XPMSTRINGBUF ) + if ( mnStringSize >= ( XPMSTRINGBUF - 1 ) ) { mbStatus = FALSE; break; diff --git a/svtools/source/filter.vcl/wmf/wmfwr.cxx b/svtools/source/filter.vcl/wmf/wmfwr.cxx index ee3a71c51f9d..95c60f1265c1 100644 --- a/svtools/source/filter.vcl/wmf/wmfwr.cxx +++ b/svtools/source/filter.vcl/wmf/wmfwr.cxx @@ -755,7 +755,7 @@ void WMFWriter::WMFRecord_Polygon(const Polygon & rPoly) Polygon aSimplePoly; if ( rPoly.HasFlags() ) - rPoly.GetSimple( aSimplePoly ); + rPoly.AdaptiveSubdivide( aSimplePoly ); else aSimplePoly = rPoly; nSize = aSimplePoly.GetSize(); @@ -770,7 +770,7 @@ void WMFWriter::WMFRecord_PolyLine(const Polygon & rPoly) USHORT nSize,i; Polygon aSimplePoly; if ( rPoly.HasFlags() ) - rPoly.GetSimple( aSimplePoly ); + rPoly.AdaptiveSubdivide( aSimplePoly ); else aSimplePoly = rPoly; nSize=aSimplePoly.GetSize(); @@ -792,7 +792,7 @@ void WMFWriter::WMFRecord_PolyPolygon(const PolyPolygon & rPolyPoly) if ( aSimplePolyPoly[ i ].HasFlags() ) { Polygon aSimplePoly; - aSimplePolyPoly[ i ].GetSimple( aSimplePoly ); + aSimplePolyPoly[ i ].AdaptiveSubdivide( aSimplePoly ); aSimplePolyPoly[ i ] = aSimplePoly; } } diff --git a/tools/inc/tools/poly.hxx b/tools/inc/tools/poly.hxx index a77782bc963c..05092957c48e 100644 --- a/tools/inc/tools/poly.hxx +++ b/tools/inc/tools/poly.hxx @@ -182,7 +182,6 @@ public: void Clip( const Rectangle& rRect, BOOL bPolygon = TRUE ); void Optimize( ULONG nOptimizeFlags, const PolyOptimizeData* pData = NULL ); - void GetSimple( Polygon& rResult ) const; /** Adaptive subdivision of polygons with curves This method adaptively subdivides bezier arcs within the @@ -288,7 +287,6 @@ public: void Clip( const Rectangle& rRect ); void Optimize( ULONG nOptimizeFlags, const PolyOptimizeData* pData = NULL ); - void GetSimple( PolyPolygon& rResult ) const; /** Adaptive subdivision of polygons with curves This method adaptively subdivides bezier arcs within the diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 5cca29b3066e..7f1eb94b646d 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -957,59 +957,6 @@ void Polygon::Optimize( ULONG nOptimizeFlags, const PolyOptimizeData* pData ) } } -// ----------------------------------------------------------------------- - -void Polygon::GetSimple( Polygon& rResult ) const -{ - if( !mpImplPolygon->mpFlagAry ) - rResult = *this; - else - { - ::std::vector< Point > aPointVector; - - for( USHORT i = 0, nCount = GetSize(); i < nCount; ) - { - if( ( ( i + 3 ) < nCount ) && - ( POLY_NORMAL == mpImplPolygon->mpFlagAry[ i ] ) && - ( POLY_CONTROL == mpImplPolygon->mpFlagAry[ i + 1 ] ) && - ( POLY_CONTROL == mpImplPolygon->mpFlagAry[ i + 2 ] ) && - ( POLY_NORMAL == mpImplPolygon->mpFlagAry[ i + 3 ] ) ) - { - const USHORT nSegmentPoints = 25; - const Polygon aSegmentPoly( mpImplPolygon->mpPointAry[ i ], mpImplPolygon->mpPointAry[ i + 1 ], - mpImplPolygon->mpPointAry[ i + 3 ], mpImplPolygon->mpPointAry[ i + 2 ], - nSegmentPoints ); - const USHORT nSegmentSize = aSegmentPoly.GetSize(); - - if( nSegmentSize ) - { - const Point* pPointArray = aSegmentPoly.mpImplPolygon->mpPointAry; - const Point* pCur = pPointArray; - const Point* pLast; - - aPointVector.push_back( *( pLast = pCur ) ); - - for( USHORT j = 1; j < nSegmentSize; j++ ) - if( *( pCur = pPointArray + j ) != *pLast ) - aPointVector.push_back( *( pLast = pCur ) ); - } - - i += 3; - } - else - aPointVector.push_back( mpImplPolygon->mpPointAry[ i++ ] ); - } - - // fill result polygon - rResult = Polygon( (USHORT)aPointVector.size() ); - ::std::vector< Point >::iterator aIter( aPointVector.begin() ), aEnd( aPointVector.end() ); - Point* pPointArray = rResult.mpImplPolygon->mpPointAry; - USHORT nPoints = rResult.mpImplPolygon->mnPoints; - while( nPoints-- && aIter != aEnd ) - *pPointArray++ = *aIter++; - } -} - // ======================================================================= /* Recursively subdivide cubic bezier curve via deCasteljau. diff --git a/tools/source/generic/poly2.cxx b/tools/source/generic/poly2.cxx index ff97e6006a41..692e47a9d1d2 100644 --- a/tools/source/generic/poly2.cxx +++ b/tools/source/generic/poly2.cxx @@ -346,23 +346,6 @@ void PolyPolygon::Optimize( ULONG nOptimizeFlags, const PolyOptimizeData* pData // ----------------------------------------------------------------------- -void PolyPolygon::GetSimple( PolyPolygon& rResult ) const -{ - DBG_CHKTHIS( PolyPolygon, NULL ); - - rResult.Clear(); - - Polygon aPolygon; - - for( USHORT i = 0; i < mpImplPolyPolygon->mnCount; i++ ) - { - mpImplPolyPolygon->mpPolyAry[ i ]->GetSimple( aPolygon ); - rResult.Insert( aPolygon ); - } -} - -// ----------------------------------------------------------------------- - void PolyPolygon::AdaptiveSubdivide( PolyPolygon& rResult, const double d ) const { DBG_CHKTHIS( PolyPolygon, NULL ); diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx index c1c02b673658..4ecb89ec5a8e 100644 --- a/vcl/source/gdi/cvtsvm.cxx +++ b/vcl/source/gdi/cvtsvm.cxx @@ -90,12 +90,17 @@ void ImplReadPoly( SvStream& rIStm, Polygon& rPoly ) void ImplWritePoly( SvStream& rOStm, const Polygon& rPoly ) { - INT32 nSize = rPoly.GetSize(); + // #i102224# Here the evtl. curved nature of Polygon was + // ignored (for all those Years). Adapted to at least write + // a polygon representing the curve as good as possible + Polygon aSimplePoly; + rPoly.AdaptiveSubdivide(aSimplePoly); + INT32 nSize = aSimplePoly.GetSize(); rOStm << nSize; for( INT32 i = 0; i < nSize; i++ ) - rOStm << rPoly[ (USHORT) i ]; + rOStm << aSimplePoly[ (USHORT) i ]; } // ------------------------------------------------------------------------ @@ -131,13 +136,18 @@ void ImplWritePolyPolyAction( SvStream& rOStm, const PolyPolygon& rPolyPoly ) for( n = 0; n < nPoly; n++ ) { + // #i102224# Here the evtl. curved nature of Polygon was + // ignored (for all those Years). Adapted to at least write + // a polygon representing the curve as good as possible const Polygon& rPoly = rPolyPoly[ n ]; - const USHORT nSize = rPoly.GetSize(); + Polygon aSimplePoly; + rPoly.AdaptiveSubdivide(aSimplePoly); + const USHORT nSize = aSimplePoly.GetSize(); rOStm << (INT32) nSize; for( USHORT j = 0; j < nSize; j++ ) - rOStm << rPoly[ j ]; + rOStm << aSimplePoly[ j ]; } } @@ -1354,8 +1364,15 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { MetaPolyLineAction* pAct = (MetaPolyLineAction*) pAction; const Polygon& rPoly = pAct->GetPolygon(); + + // #i102224# Here the evtl. curved nature of Polygon was + // ignored (for all those Years). Adapted to at least write + // a polygon representing the curve as good as possible + Polygon aSimplePoly; + rPoly.AdaptiveSubdivide(aSimplePoly); + const LineInfo& rInfo = pAct->GetLineInfo(); - const USHORT nPoints = rPoly.GetSize(); + const USHORT nPoints = aSimplePoly.GetSize(); const BOOL bFatLine = ( !rInfo.IsDefault() && ( LINE_NONE != rInfo.GetStyle() ) ); if( bFatLine ) @@ -1369,7 +1386,7 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, rOStm << (INT32) nPoints; for( USHORT n = 0; n < nPoints; n++ ) - rOStm << rPoly[ n ]; + rOStm << aSimplePoly[ n ]; nCount++; @@ -1385,14 +1402,21 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { MetaPolygonAction* pAct = (MetaPolygonAction*) pAction; const Polygon& rPoly = pAct->GetPolygon(); - const USHORT nPoints = rPoly.GetSize(); + + // #i102224# Here the evtl. curved nature of Polygon was + // ignored (for all those Years). Adapted to at least write + // a polygon representing the curve as good as possible + Polygon aSimplePoly; + rPoly.AdaptiveSubdivide(aSimplePoly); + + const USHORT nPoints = aSimplePoly.GetSize(); rOStm << (INT16) GDI_POLYGON_ACTION; rOStm << (INT32) ( 8 + ( nPoints << 3 ) ); rOStm << (INT32) nPoints; for( USHORT n = 0; n < nPoints; n++ ) - rOStm << rPoly[ n ]; + rOStm << aSimplePoly[ n ]; nCount++; } diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index 4fe9a41be797..82566b2b4362 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -989,7 +989,7 @@ void MetaPolyLineAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) WRITE_BASE_COMPAT( rOStm, 3, pData ); Polygon aSimplePoly; - maPoly.GetSimple( aSimplePoly ); + maPoly.AdaptiveSubdivide( aSimplePoly ); rOStm << aSimplePoly; // Version 1 rOStm << maLineInfo; // Version 2 @@ -1077,7 +1077,7 @@ void MetaPolygonAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) WRITE_BASE_COMPAT( rOStm, 2, pData ); Polygon aSimplePoly; // Version 1 - maPoly.GetSimple( aSimplePoly ); + maPoly.AdaptiveSubdivide( aSimplePoly ); rOStm << aSimplePoly; sal_uInt8 bHasPolyFlags = maPoly.HasFlags(); // Version 2 @@ -1169,7 +1169,7 @@ void MetaPolyPolygonAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) const Polygon& rPoly = maPolyPoly.GetObject( i ); if ( rPoly.HasFlags() ) nNumberOfComplexPolygons++; - rPoly.GetSimple( aSimplePoly ); + rPoly.AdaptiveSubdivide( aSimplePoly ); rOStm << aSimplePoly; } @@ -2581,7 +2581,13 @@ sal_Bool MetaGradientExAction::Compare( const MetaAction& rMetaAction ) const void MetaGradientExAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { WRITE_BASE_COMPAT( rOStm, 1, pData ); - rOStm << maPolyPoly << maGradient; + + // #i105373# see comment at MetaTransparentAction::Write + PolyPolygon aNoCurvePolyPolygon; + maPolyPoly.AdaptiveSubdivide(aNoCurvePolyPolygon); + + rOStm << aNoCurvePolyPolygon; + rOStm << maGradient; } // ------------------------------------------------------------------------ @@ -2649,7 +2655,13 @@ sal_Bool MetaHatchAction::Compare( const MetaAction& rMetaAction ) const void MetaHatchAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { WRITE_BASE_COMPAT( rOStm, 1, pData ); - rOStm << maPolyPoly << maHatch; + + // #i105373# see comment at MetaTransparentAction::Write + PolyPolygon aNoCurvePolyPolygon; + maPolyPoly.AdaptiveSubdivide(aNoCurvePolyPolygon); + + rOStm << aNoCurvePolyPolygon; + rOStm << maHatch; } // ------------------------------------------------------------------------ @@ -3716,7 +3728,20 @@ sal_Bool MetaTransparentAction::Compare( const MetaAction& rMetaAction ) const void MetaTransparentAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { WRITE_BASE_COMPAT( rOStm, 1, pData ); - rOStm << maPolyPoly; + + // #i105373# The PolyPolygon in this action may be a curve; this + // was ignored until now what is an error. To make older office + // versions work with MetaFiles, i opt for applying AdaptiveSubdivide + // to the PolyPoylgon. + // The alternative would be to really write the curve information + // like in MetaPolyPolygonAction::Write (where someone extended it + // correctly, but not here :-( ). + // The golden solution would be to combine both, but i think it's + // not necessary; a good subdivision will be sufficient. + PolyPolygon aNoCurvePolyPolygon; + maPolyPoly.AdaptiveSubdivide(aNoCurvePolyPolygon); + + rOStm << aNoCurvePolyPolygon; rOStm << mnTransPercent; } diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 0a7a8b765b6b..8a057b3f3c7b 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -4835,7 +4835,7 @@ void OutputDevice::ImplGetEmphasisMark( PolyPolygon& rPolyPoly, BOOL& rPolyLine, double dScale = ((double)nDotSize)/1000.0; aPoly.Scale( dScale, dScale ); Polygon aTemp; - aPoly.GetSimple( aTemp ); + aPoly.AdaptiveSubdivide( aTemp ); Rectangle aBoundRect = aTemp.GetBoundRect(); rWidth = aBoundRect.GetWidth(); nDotSize = aBoundRect.GetHeight(); diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx index b98712419cf1..2393270a32f0 100644 --- a/vcl/source/gdi/region.cxx +++ b/vcl/source/gdi/region.cxx @@ -2534,7 +2534,13 @@ SvStream& operator<<( SvStream& rOStrm, const Region& rRegion ) rOStrm << bHasPolyPolygon; if( bHasPolyPolygon ) - rOStrm << rRegion.GetPolyPolygon(); + { + // #i105373# + PolyPolygon aNoCurvePolyPolygon; + rRegion.GetPolyPolygon().AdaptiveSubdivide(aNoCurvePolyPolygon); + + rOStrm << aNoCurvePolyPolygon; + } } return rOStrm; -- cgit From 959cfafb5d71c24b4568473fc3fa8c3bb8c30243 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Tue, 27 Oct 2009 16:20:25 +0000 Subject: CWS-TOOLING: integrate CWS ooo32gsl01 2009-10-13 15:59:25 +0200 hdu r276868 : #i100000# fix remaining merge conflict 2009-10-12 16:08:38 +0200 hdu r276837 : CWS-TOOLING: rebase CWS ooo32gsl01 to branches/OOO320@276773 (milestone: OOO320:m1) 2009-09-15 10:09:52 +0200 hdu r276150 : #i104861# adjust metrics to pseudo-emUnits==1000 expectation for better precision allow non-integer charwidth/stemwidth 2009-09-15 09:58:00 +0200 hdu r276149 : #i104861# prepare to fix by updating cff.cxx to latest version from CWS vcl105 2009-09-14 16:06:46 +0200 hdu r276130 : #i104221# treat judeo-spanish varika as diacritic also in problematic fonts (thanks yoramg) 2009-09-14 15:27:14 +0200 hdu r276126 : #i104221# fix regression with he/ar diacritics 2009-09-10 15:39:58 +0200 aw r276038 : #i104867# added a GraphicVersion number to EmbeddedObjectRef to allow Grahic chamge checks without fetching the graphic 2009-09-10 15:38:41 +0200 aw r276037 : #i104867# added GraphicVersionNumber to SdrOleContentPrimitive to detect OLE content change without getting the Graphic 2009-09-09 17:16:43 +0200 hdu r276006 : #i104886# Aqua: fix for 101491 only applies to non-hairlines 2009-09-09 16:39:05 +0200 hdu r276002 : #i99849# don't give up on ScriptItemize too early --- svtools/inc/svtools/embedhlp.hxx | 10 ++++-- svtools/source/misc/embedhlp.cxx | 41 ++++++++++++++++----- vcl/aqua/source/gdi/salgdi.cxx | 6 ++-- vcl/source/fontsubset/cff.cxx | 78 +++++++++++++++++++++++----------------- vcl/source/gdi/sallayout.cxx | 8 +++-- vcl/win/source/gdi/winlayout.cxx | 5 +-- 6 files changed, 96 insertions(+), 52 deletions(-) diff --git a/svtools/inc/svtools/embedhlp.hxx b/svtools/inc/svtools/embedhlp.hxx index f4cccd3115b8..68763a3fd487 100644 --- a/svtools/inc/svtools/embedhlp.hxx +++ b/svtools/inc/svtools/embedhlp.hxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: embedhlp.hxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -131,6 +128,13 @@ namespace svt BOOL is() const { return mxObj.is(); } BOOL IsChart() const; + + // #i104867# + // Provides a graphic version number for the fetchable Graphic during this object's lifetime. Internally, + // that number is incremented at each change of the Graphic. This mechanism is needed to identify if a + // remembered Graphic (e.g. primitives) has changed compared to the current one, but without actively + // fetching the Graphic what would be too expensive e.g. for charts + sal_uInt32 getGraphicVersion() const; void SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM );//#i103460# charts do not necessaryly have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this method }; } diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx index 6bd1126f8082..edddb7c1ab6d 100644 --- a/svtools/source/misc/embedhlp.cxx +++ b/svtools/source/misc/embedhlp.cxx @@ -7,7 +7,6 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: embedhlp.cxx,v $ - * $Revision: 1.28 $ * * This file is part of OpenOffice.org. * @@ -189,7 +188,6 @@ void SAL_CALL EmbedEventListener_Impl::modified( const lang::EventObject& ) thro pObject->UpdateReplacementOnDemand(); } } - } void SAL_CALL EmbedEventListener_Impl::notifyEvent( const document::EventObject& aEvent ) throw( uno::RuntimeException ) @@ -250,6 +248,9 @@ struct EmbeddedObjectRef_Impl sal_Int64 nViewAspect; BOOL bIsLocked; sal_Bool bNeedUpdate; + + // #i104867# + sal_uInt32 mnGraphicVersion; awt::Size aDefaultSizeForChart_In_100TH_MM;//#i103460# charts do not necessaryly have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this member }; @@ -262,6 +263,7 @@ void EmbeddedObjectRef::Construct_Impl() mpImp->nViewAspect = embed::Aspects::MSOLE_CONTENT; mpImp->bIsLocked = FALSE; mpImp->bNeedUpdate = sal_False; + mpImp->mnGraphicVersion = 0; mpImp->aDefaultSizeForChart_In_100TH_MM = awt::Size(8000,7000); } @@ -297,12 +299,14 @@ EmbeddedObjectRef::EmbeddedObjectRef( const EmbeddedObjectRef& rObj ) mpImp->pGraphic = 0; mpImp->pHCGraphic = 0; + mpImp->mnGraphicVersion = 0; } EmbeddedObjectRef::~EmbeddedObjectRef() { delete mpImp->pGraphic; - if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic ); + if ( mpImp->pHCGraphic ) + DELETEZ( mpImp->pHCGraphic ); Clear(); } /* @@ -453,10 +457,15 @@ void EmbeddedObjectRef::GetReplacement( BOOL bUpdate ) DELETEZ( mpImp->pGraphic ); mpImp->aMediaType = ::rtl::OUString(); mpImp->pGraphic = new Graphic; - if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic ); + if ( mpImp->pHCGraphic ) + DELETEZ( mpImp->pHCGraphic ); + mpImp->mnGraphicVersion++; } else if ( !mpImp->pGraphic ) + { mpImp->pGraphic = new Graphic; + mpImp->mnGraphicVersion++; + } else { DBG_ERROR("No update, but replacement exists already!"); @@ -469,6 +478,7 @@ void EmbeddedObjectRef::GetReplacement( BOOL bUpdate ) GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); if( mpImp->pGraphic ) pGF->ImportGraphic( *mpImp->pGraphic, String(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW ); + mpImp->mnGraphicVersion++; delete pGraphicStream; } } @@ -598,6 +608,7 @@ Graphic* EmbeddedObjectRef::GetHCGraphic() const mpImp->pHCGraphic = pGraphic; else delete pGraphic; + mpImp->mnGraphicVersion++; } delete pStream; @@ -615,7 +626,9 @@ void EmbeddedObjectRef::SetGraphicStream( const uno::Reference< io::XInputStream delete mpImp->pGraphic; mpImp->pGraphic = new Graphic(); mpImp->aMediaType = rMediaType; - if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic ); + if ( mpImp->pHCGraphic ) + DELETEZ( mpImp->pHCGraphic ); + mpImp->mnGraphicVersion++; SvStream* pGraphicStream = ::utl::UcbStreamHelper::CreateStream( xInGrStream ); @@ -623,6 +636,7 @@ void EmbeddedObjectRef::SetGraphicStream( const uno::Reference< io::XInputStream { GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); pGF->ImportGraphic( *mpImp->pGraphic, String(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW ); + mpImp->mnGraphicVersion++; if ( mpImp->pContainer ) { @@ -645,7 +659,9 @@ void EmbeddedObjectRef::SetGraphic( const Graphic& rGraphic, const ::rtl::OUStri delete mpImp->pGraphic; mpImp->pGraphic = new Graphic( rGraphic ); mpImp->aMediaType = rMediaType; - if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic ); + if ( mpImp->pHCGraphic ) + DELETEZ( mpImp->pHCGraphic ); + mpImp->mnGraphicVersion++; if ( mpImp->pContainer ) SetGraphicToContainer( rGraphic, *mpImp->pContainer, mpImp->aPersistName, rMediaType ); @@ -880,7 +896,9 @@ void EmbeddedObjectRef::UpdateReplacementOnDemand() { DELETEZ( mpImp->pGraphic ); mpImp->bNeedUpdate = sal_True; - if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic ); + if ( mpImp->pHCGraphic ) + DELETEZ( mpImp->pHCGraphic ); + mpImp->mnGraphicVersion++; if( mpImp->pContainer ) { @@ -914,6 +932,12 @@ BOOL EmbeddedObjectRef::IsChart() const return sal_False; } +// #i104867# +sal_uInt32 EmbeddedObjectRef::getGraphicVersion() const +{ + return mpImp->mnGraphicVersion; +} + void EmbeddedObjectRef::SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM ) { //#i103460# charts do not necessaryly have an own size within ODF files, @@ -928,4 +952,5 @@ void EmbeddedObjectRef::SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM ) xSizeTransmitter->setDefaultSize( mpImp->aDefaultSizeForChart_In_100TH_MM ); } -} +} // namespace svt + diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index e0905fe1d377..f389abd19a82 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -966,13 +966,15 @@ bool AquaSalGraphics::drawPolyLine( const ::basegfx::B2DPolygon& rPolyLine, if( nPointCount <= 0 ) return true; - // reject strange requests + // reject requests that cannot be handled yet if( rLineWidths.getX() != rLineWidths.getY() ) return false; // #i101491# Aqua does not support B2DLINEJOIN_NONE; return false to use // the fallback (own geometry preparation) - if(basegfx::B2DLINEJOIN_NONE == eLineJoin) + // #i104886# linejoin-mode and thus the above only applies to "fat" lines + if( (basegfx::B2DLINEJOIN_NONE == eLineJoin) + && (rLineWidths.getX() > 1.3) ) return false; // setup line attributes diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx index e5d83dc0733a..dd198ff521db 100644 --- a/vcl/source/fontsubset/cff.cxx +++ b/vcl/source/fontsubset/cff.cxx @@ -332,12 +332,13 @@ struct CffLocal int mnLocalSubrBase; int mnLocalSubrCount; int mnLocalSubrBias; - int mnNominalWidth; - int mnDefaultWidth; + + ValType maNominalWidth; + ValType maDefaultWidth; // ATM hinting related values - int mnStemStdHW; - int mnStemStdVW; + ValType maStemStdHW; + ValType maStemStdVW; ValVector maStemSnapH; ValVector maStemSnapV; ValVector maBlueValues; @@ -461,10 +462,10 @@ public: // TODO: is public really needed? void getHintPair( int nIndex, ValType* nMin, ValType* nEnd) const; // accessing other charstring specifics - bool hasCharWidth( void) const { return (mnCharWidth != -1);} - int getCharWidth( void) const { return mnCharWidth;} - void setNominalWidth( int nWidth) { mpCffLocal->mnNominalWidth = nWidth;} - void setDefaultWidth( int nWidth) { mpCffLocal->mnDefaultWidth = nWidth;} + bool hasCharWidth( void) const { return (maCharWidth > 0);} + ValType getCharWidth( void) const { return maCharWidth;} + void setNominalWidth( ValType aWidth) { mpCffLocal->maNominalWidth = aWidth;} + void setDefaultWidth( ValType aWidth) { mpCffLocal->maDefaultWidth = aWidth;} void updateWidth( bool bUseFirstVal); private: @@ -477,7 +478,7 @@ private: int mnHorzHintSize; ValType mnHintStack[ NMAXHINTS]; - int mnCharWidth; + ValType maCharWidth; }; // -------------------------------------------------------------------- @@ -488,7 +489,7 @@ CffSubsetterContext::CffSubsetterContext( const U8* pBasePtr, int nBaseLen) , mnStackIdx(0) , mnHintSize(0) , mnHorzHintSize(0) -, mnCharWidth(-1) +, maCharWidth(-1) { // setCharStringType( 1); // TODO: new CffLocal[ mnFDAryCount]; @@ -542,13 +543,13 @@ inline void CffSubsetterContext::updateWidth( bool bUseFirstVal) return; #endif if( bUseFirstVal) { - mnCharWidth = static_cast(mpCffLocal->mnNominalWidth + mnValStack[0]); + maCharWidth = mpCffLocal->maNominalWidth + mnValStack[0]; // remove bottom stack entry --mnStackIdx; for( int i = 0; i < mnStackIdx; ++i) mnValStack[ i] = mnValStack[ i+1]; } else { - mnCharWidth = mpCffLocal->mnDefaultWidth; + maCharWidth = mpCffLocal->maDefaultWidth; } } @@ -615,7 +616,7 @@ void CffSubsetterContext::readCharString( const U8* pTypeOps, int nTypeLen) mnStackIdx = 0; mnHintSize = 0; mnHorzHintSize = 0; - mnCharWidth = -1; + maCharWidth = -1; assert( nTypeLen >= 0); // assert( nEnd <= getLength()); @@ -659,14 +660,14 @@ void CffSubsetterContext::readDictOp( void) nVal = popVal(); nInt = static_cast(nVal); switch( nOpId) { - case 10: mpCffLocal->mnStemStdHW = nInt; break; // "StdHW" - case 11: mpCffLocal->mnStemStdVW = nInt; break; // "StdVW" + case 10: mpCffLocal->maStemStdHW = nVal; break; // "StdHW" + case 11: mpCffLocal->maStemStdVW = nVal; break; // "StdVW" case 15: mnCharsetBase = nInt; break; // "charset" case 16: mnEncodingBase = nInt; break; // "nEncoding" case 17: mnCharStrBase = nInt; break; // "nCharStrings" case 19: mpCffLocal->mnLocalSubrOffs = nInt; break;// "nSubrs" - case 20: setDefaultWidth( nInt ); break; // "defaultWidthX" - case 21: setNominalWidth( nInt ); break; // "nominalWidthX" + case 20: setDefaultWidth( nVal ); break; // "defaultWidthX" + case 21: setNominalWidth( nVal ); break; // "nominalWidthX" case 909: mpCffLocal->mfBlueScale = nVal; break; // "BlueScale" case 910: mpCffLocal->mfBlueShift = nVal; break; // "BlueShift" case 911: mpCffLocal->mfBlueFuzz = nVal; break; // "BlueFuzz" @@ -1477,7 +1478,7 @@ int CffSubsetterContext::convert2Type1Ops( CffLocal* pCffLocal, const U8* const mbSawError = false; mbNeedClose = false; mbIgnoreHints = false; -mnHintSize=mnHorzHintSize=mnStackIdx=0; mnCharWidth=-1;//####### +mnHintSize=mnHorzHintSize=mnStackIdx=0; maCharWidth=-1;//####### mnCntrMask = 0; while( mpReadPtr < mpReadEnd) convertOneTypeOp(); @@ -1673,10 +1674,10 @@ CffLocal::CffLocal( void) , mnLocalSubrBase( 0) , mnLocalSubrCount( 0) , mnLocalSubrBias( 0) -, mnNominalWidth( 0) -, mnDefaultWidth( 0) -, mnStemStdHW( 0) -, mnStemStdVW( 0) +, maNominalWidth( 0) +, maDefaultWidth( 0) +, maStemStdHW( 0) +, maStemStdVW( 0) , mfBlueScale( 0.0) , mfBlueShift( 0.0) , mfBlueFuzz( 0.0) @@ -2296,8 +2297,8 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, nPrivEntryCount += (mpCffLocal->mfBlueShift != 0.0); nPrivEntryCount += (mpCffLocal->mfBlueFuzz != 0.0); // emit stem hints only if non-default values - nPrivEntryCount += (mpCffLocal->mnStemStdHW != 0); - nPrivEntryCount += (mpCffLocal->mnStemStdVW != 0); + nPrivEntryCount += (mpCffLocal->maStemStdHW != 0); + nPrivEntryCount += (mpCffLocal->maStemStdVW != 0); nPrivEntryCount += !mpCffLocal->maStemSnapH.empty(); nPrivEntryCount += !mpCffLocal->maStemSnapV.empty(); // emit other hints only if non-default values @@ -2337,10 +2338,10 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, pOut += sprintf( pOut, "/BlueFuzz %.1f def\n", mpCffLocal->mfBlueFuzz); // emit stem hint related privdict entries - if( mpCffLocal->mnStemStdHW) - pOut += sprintf( pOut, "/StdHW [%d] def\n", mpCffLocal->mnStemStdHW); - if( mpCffLocal->mnStemStdVW) - pOut += sprintf( pOut, "/StdVW [%d] def\n", mpCffLocal->mnStemStdVW); + if( mpCffLocal->maStemStdHW) + pOut += sprintf( pOut, "/StdHW [%g] def\n", mpCffLocal->maStemStdHW); + if( mpCffLocal->maStemStdVW) + pOut += sprintf( pOut, "/StdVW [%g] def\n", mpCffLocal->maStemStdVW); rEmitter.emitValVector( "/StemSnapH [", "]ND\n", mpCffLocal->maStemSnapH); rEmitter.emitValVector( "/StemSnapV [", "]ND\n", mpCffLocal->maStemSnapV); @@ -2413,8 +2414,12 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, pOut += sprintf( pOut, " ND\n"); rEmitter.emitAllCrypted(); // provide individual glyphwidths if requested - if( pGlyphWidths ) - pGlyphWidths[i] = getCharWidth(); + if( pGlyphWidths ) { + ValType aCharWidth = getCharWidth(); + if( maFontMatrix.size() >= 4) + aCharWidth *= 1000.0F * maFontMatrix[0]; + pGlyphWidths[i] = static_cast(aCharWidth); + } } pOut += sprintf( pOut, "end end\nreadonly put\nput\n"); pOut += sprintf( pOut, "dup/FontName get exch definefont pop\n"); @@ -2446,8 +2451,17 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, // provide details to the subset requesters, TODO: move into own method? // note: Top and Bottom are flipped between Type1 and VCL - rFSInfo.m_aFontBBox = Rectangle( Point( static_cast(maFontBBox[0]), static_cast(maFontBBox[1]) ), - Point( static_cast(maFontBBox[2]), static_cast(maFontBBox[3]) ) ); + // note: the rest of VCL expects the details below to be scaled like for an emUnits==1000 font + ValType fXFactor = 1.0; + ValType fYFactor = 1.0; + if( maFontMatrix.size() >= 4) { + fXFactor = 1000.0F * maFontMatrix[0]; + fYFactor = 1000.0F * maFontMatrix[3]; + } + rFSInfo.m_aFontBBox = Rectangle( Point( static_cast(maFontBBox[0] * fXFactor), + static_cast(maFontBBox[1] * fYFactor) ), + Point( static_cast(maFontBBox[2] * fXFactor), + static_cast(maFontBBox[3] * fYFactor) ) ); // PDF-Spec says the values below mean the ink bounds! // TODO: use better approximations for these ink bounds rFSInfo.m_nAscent = +rFSInfo.m_aFontBBox.Bottom(); // for capital letters diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 21ac05a498fc..1f44b823ce44 100755 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -95,11 +95,12 @@ bool IsDiacritic( sal_UCS4 nChar ) if( nChar >= 0x2100 ) return false; + // TODO: #i105058# use icu uchar.h's character classification instead of the handcrafted table struct DiaRange { sal_UCS4 mnMin, mnEnd;}; static const DiaRange aRanges[] = { {0x0300, 0x0370}, - {0x0590, 0x05C0}, {0x05C1, 0x05C3}, {0x05C3, 0x05C6}, {0x05C7, 0x05C8}, - {0x0610, 0x061B}, {0x064B, 0x0660}, {0x0670, 0x0671}, {0x06D6, 0x06DC}, {0x06DF, 0x06EE}, + {0x0590, 0x05BE}, {0x05BF, 0x05C0}, {0x05C1, 0x05C3}, {0x05C4, 0x05C6}, {0x05C7, 0x05C8}, + {0x0610, 0x061B}, {0x064B, 0x0660}, {0x0670, 0x0671}, {0x06D6, 0x06DD}, {0x06DF, 0x06E5}, {0x06E7, 0x06E9}, {0x06EA,0x06EF}, {0x0730, 0x074D}, {0x07A6, 0x07B1}, {0x07EB, 0x07F4}, #if 0 // all known fonts have zero-width diacritics already, so no need to query it {0x0900, 0x0904}, {0x093C, 0x093D}, {0x0941, 0x0948}, {0x094D, 0x0950}, {0x0951, 0x0958}, @@ -107,7 +108,8 @@ bool IsDiacritic( sal_UCS4 nChar ) {0x0A00, 0x0A05}, {0x0A3C, 0x0A59}, //... #endif {0x1DC0, 0x1E00}, - {0x205F, 0x2070}, {0x20D0, 0x2100} + {0x205F, 0x2070}, {0x20D0, 0x2100}, + {0xFB1E, 0xFB1F} }; // TODO: almost anything is faster than an O(n) search diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index 1b80bf578530..bf56b2a1082b 100644 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: winlayout.cxx,v $ - * $Revision: 1.113.6.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -1385,7 +1382,7 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs ) mpScriptItems = NULL; if( nRC != E_OUTOFMEMORY ) return false; - if( nItemCapacity > (nSubStringEnd - mnSubStringMin) ) + if( nItemCapacity > (nSubStringEnd - mnSubStringMin) + 16 ) return false; } -- cgit From 51977c2b62de1b3d227cce0a1f7f9648f4e98063 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Tue, 27 Oct 2009 17:08:07 +0000 Subject: #i106351# avoid early exits when changing state --- vcl/aqua/source/gdi/salgdi.cxx | 63 ++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index f389abd19a82..eb6434100208 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -931,27 +931,29 @@ bool AquaSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPol AddPolygonToPath( xPath, rPolygon, true, !getAntiAliasB2DDraw(), IsPenVisible() ); } - // use the path to prepare the graphics context - CGContextSaveGState( mrContext ); - CGContextBeginPath( mrContext ); - CGContextAddPath( mrContext, xPath ); const CGRect aRefreshRect = CGPathGetBoundingBox( xPath ); - CGPathRelease( xPath ); - #ifndef NO_I97317_WORKAROUND // #i97317# workaround for Quartz having problems with drawing small polygons - if( (aRefreshRect.size.width <= 0.125) && (aRefreshRect.size.height <= 0.125) ) - return true; + if( ! ((aRefreshRect.size.width <= 0.125) && (aRefreshRect.size.height <= 0.125)) ) #endif + { + // use the path to prepare the graphics context + CGContextSaveGState( mrContext ); + CGContextBeginPath( mrContext ); + CGContextAddPath( mrContext, xPath ); + + // draw path with antialiased polygon + CGContextSetShouldAntialias( mrContext, true ); + CGContextSetAlpha( mrContext, 1.0 - fTransparency ); + CGContextDrawPath( mrContext, kCGPathEOFillStroke ); + CGContextRestoreGState( mrContext ); + + // mark modified rectangle as updated + RefreshRect( aRefreshRect ); + } - // draw path with antialiased polygon - CGContextSetShouldAntialias( mrContext, true ); - CGContextSetAlpha( mrContext, 1.0 - fTransparency ); - CGContextDrawPath( mrContext, kCGPathEOFillStroke ); - CGContextRestoreGState( mrContext ); + CGPathRelease( xPath ); - // mark modified rectangle as updated - RefreshRect( aRefreshRect ); return true; } @@ -991,27 +993,28 @@ bool AquaSalGraphics::drawPolyLine( const ::basegfx::B2DPolygon& rPolyLine, CGMutablePathRef xPath = CGPathCreateMutable(); AddPolygonToPath( xPath, rPolyLine, rPolyLine.isClosed(), !getAntiAliasB2DDraw(), true ); - // use the path to prepare the graphics context - CGContextSaveGState( mrContext ); - CGContextAddPath( mrContext, xPath ); const CGRect aRefreshRect = CGPathGetBoundingBox( xPath ); - CGPathRelease( xPath ); - #ifndef NO_I97317_WORKAROUND // #i97317# workaround for Quartz having problems with drawing small polygons - if( (aRefreshRect.size.width <= 0.125) && (aRefreshRect.size.height <= 0.125) ) - return true; + if( ! ((aRefreshRect.size.width <= 0.125) && (aRefreshRect.size.height <= 0.125)) ) #endif + { + // use the path to prepare the graphics context + CGContextSaveGState( mrContext ); + CGContextAddPath( mrContext, xPath ); + // draw path with antialiased line + CGContextSetShouldAntialias( mrContext, true ); + CGContextSetLineJoin( mrContext, aCGLineJoin ); + CGContextSetLineWidth( mrContext, rLineWidths.getX() ); + CGContextDrawPath( mrContext, kCGPathStroke ); + CGContextRestoreGState( mrContext ); + + // mark modified rectangle as updated + RefreshRect( aRefreshRect ); + } - // draw path with antialiased line - CGContextSetShouldAntialias( mrContext, true ); - CGContextSetLineJoin( mrContext, aCGLineJoin ); - CGContextSetLineWidth( mrContext, rLineWidths.getX() ); - CGContextDrawPath( mrContext, kCGPathStroke ); - CGContextRestoreGState( mrContext ); + CGPathRelease( xPath ); - // mark modified rectangle as updated - RefreshRect( aRefreshRect ); return true; } -- cgit From 19af9e2b8f2c744e3047a11c0bb21dd11eda2522 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Wed, 28 Oct 2009 14:32:30 +0100 Subject: #i105062# improve icon theme fallback (thanks pmladek) --- vcl/inc/vcl/impimagetree.hxx | 22 +++++++++------ vcl/inc/vcl/settings.hxx | 4 ++- vcl/source/app/settings.cxx | 44 +++++++++++++++++++++++++++--- vcl/source/gdi/impimagetree.cxx | 60 ++++++++++++++++++++++++++++++++++++----- 4 files changed, 111 insertions(+), 19 deletions(-) diff --git a/vcl/inc/vcl/impimagetree.hxx b/vcl/inc/vcl/impimagetree.hxx index dfbcb366fe6a..92761eabdf3c 100644 --- a/vcl/inc/vcl/impimagetree.hxx +++ b/vcl/inc/vcl/impimagetree.hxx @@ -54,14 +54,17 @@ public: ~ImplImageTree(); + // check whether the icon style is installed + bool checkStyle(rtl::OUString const & style); + bool loadImage( rtl::OUString const & name, rtl::OUString const & style, - BitmapEx & bitmap, bool localized = false); + BitmapEx & bitmap, bool localized = false ); void shutDown(); // a crude form of life cycle control (called from DeInitVCL; otherwise, // if the ImplImageTree singleton were destroyed during exit that would - // be too late for the destructors of the bitmaps in m_cache) + // be too late for the destructors of the bitmaps in m_iconCache) private: typedef std::list< @@ -71,20 +74,23 @@ private: com::sun::star::container::XNameAccess > > > Zips; typedef std::hash_map< - rtl::OUString, std::pair< bool, BitmapEx >, rtl::OUStringHash > Cache; + rtl::OUString, bool, rtl::OUStringHash > CheckStyleCache; + typedef std::hash_map< + rtl::OUString, std::pair< bool, BitmapEx >, rtl::OUStringHash > IconCache; rtl::OUString m_style; Zips m_zips; - Cache m_cache; + CheckStyleCache m_checkStyleCache; + IconCache m_iconCache; - void setStyle(rtl::OUString const & style); + void setStyle(rtl::OUString const & style ); void resetZips(); - bool cacheLookup( - rtl::OUString const & name, bool localized, BitmapEx & bitmap); + bool checkStyleCacheLookup( rtl::OUString const & style, bool &exists ); + bool iconCacheLookup( rtl::OUString const & name, bool localized, BitmapEx & bitmap ); - bool find(std::vector< rtl::OUString > const & paths, BitmapEx & bitmap); + bool find(std::vector< rtl::OUString > const & paths, BitmapEx & bitmap ); }; typedef salhelper::SingletonRef< ImplImageTree > ImplImageTreeSingletonRef; diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx index decb7d01b2d4..2cccc253c809 100644 --- a/vcl/inc/vcl/settings.hxx +++ b/vcl/inc/vcl/settings.hxx @@ -523,7 +523,7 @@ private: #define STYLE_SYMBOLS_CRYSTAL ((ULONG)4) #define STYLE_SYMBOLS_TANGO ((ULONG)5) #define STYLE_SYMBOLS_CLASSIC ((ULONG)6) -#define STYLE_SYMBOLS_THEMES_MAX ((ULONG)6) +#define STYLE_SYMBOLS_THEMES_MAX ((ULONG)7) #define STYLE_CURSOR_NOBLINKTIME ((ULONG)0xFFFFFFFF) @@ -947,6 +947,8 @@ public: void SetPreferredSymbolsStyleName( const ::rtl::OUString &rName ); ULONG GetPreferredSymbolsStyle() const { return mpData->mnPreferredSymbolsStyle; } + // check whether the symbols style is supported (icons are installed) + bool CheckSymbolStyle( ULONG nStyle ) const; ULONG GetAutoSymbolsStyle() const; ULONG GetCurrentSymbolsStyle() const; diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 6aa453563596..55fe97a2b25a 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -41,6 +41,8 @@ #include "vcl/configsettings.hxx" #include "vcl/gradient.hxx" #include "vcl/unohelp.hxx" +#include "vcl/bitmapex.hxx" +#include "vcl/impimagetree.hxx" #include "unotools/localedatawrapper.hxx" #include "unotools/collatorwrapper.hxx" #include "unotools/configmgr.hxx" @@ -759,12 +761,12 @@ ULONG StyleSettings::GetCurrentSymbolsStyle() const // style selected in Tools -> Options... -> OpenOffice.org -> View ULONG nStyle = GetSymbolsStyle(); - if ( nStyle == STYLE_SYMBOLS_AUTO ) + if ( nStyle == STYLE_SYMBOLS_AUTO || ( !CheckSymbolStyle (nStyle) ) ) { // the preferred style can be read from the desktop setting by the desktop native widgets modules ULONG nPreferredStyle = GetPreferredSymbolsStyle(); - if ( nPreferredStyle == STYLE_SYMBOLS_AUTO ) + if ( nPreferredStyle == STYLE_SYMBOLS_AUTO || ( !CheckSymbolStyle (nPreferredStyle) ) ) { // use a hardcoded desktop-specific fallback if no preferred style has been detected @@ -780,7 +782,10 @@ ULONG StyleSettings::GetCurrentSymbolsStyle() const nPreferredStyle = snFallbackDesktopStyle; } - nStyle = GetHighContrastMode()? STYLE_SYMBOLS_HICONTRAST: nPreferredStyle; + if (GetHighContrastMode() && CheckSymbolStyle (STYLE_SYMBOLS_HICONTRAST) ) + nStyle = STYLE_SYMBOLS_HICONTRAST; + else + nStyle = nPreferredStyle; } return nStyle; @@ -816,11 +821,44 @@ ULONG StyleSettings::GetAutoSymbolsStyle() const nRet = STYLE_SYMBOLS_CRYSTAL; } + // falback to any existing style + if ( ! CheckSymbolStyle (nRet) ) + { + for ( ULONG n = 0 ; n <= STYLE_SYMBOLS_THEMES_MAX ; n++ ) + { + ULONG nStyleToCheck = n; + + // auto is not a real theme => can't be fallback + if ( nStyleToCheck == STYLE_SYMBOLS_AUTO ) + continue; + + // will check hicontrast in the end + if ( nStyleToCheck == STYLE_SYMBOLS_HICONTRAST ) + continue; + if ( nStyleToCheck == STYLE_SYMBOLS_THEMES_MAX ) + nStyleToCheck = STYLE_SYMBOLS_HICONTRAST; + + if ( CheckSymbolStyle ( nStyleToCheck ) ) + { + nRet = nStyleToCheck; + n = STYLE_SYMBOLS_THEMES_MAX; + } + } + } + return nRet; } // ----------------------------------------------------------------------- +bool StyleSettings::CheckSymbolStyle( ULONG nStyle ) const +{ + static ImplImageTreeSingletonRef aImageTree; + return aImageTree->checkStyle( ImplSymbolsStyleToName( nStyle ) ); +} + +// ----------------------------------------------------------------------- + void StyleSettings::SetStandardStyles() { CopyData(); diff --git a/vcl/source/gdi/impimagetree.cxx b/vcl/source/gdi/impimagetree.cxx index 039041826124..8178204a4ffd 100644 --- a/vcl/source/gdi/impimagetree.cxx +++ b/vcl/source/gdi/impimagetree.cxx @@ -46,6 +46,7 @@ #include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/Sequence.hxx" #include "comphelper/processfactory.hxx" +#include "osl/file.hxx" #include "osl/diagnose.h" #include "rtl/bootstrap.hxx" #include "rtl/string.h" @@ -118,12 +119,43 @@ ImplImageTree::ImplImageTree() {} ImplImageTree::~ImplImageTree() {} +bool ImplImageTree::checkStyle(rtl::OUString const & style) +{ + bool exists; + + // using cache because setStyle is an expensive operation + // setStyle calls resetZips => closes any opened zip files with icons, cleans the icon cache, ... + if (checkStyleCacheLookup(style, exists)) { + return exists; + } + + setStyle(style); + + exists = false; + const rtl::OUString sBrandURLSuffix(RTL_CONSTASCII_USTRINGPARAM("_brand.zip")); + for (Zips::iterator i(m_zips.begin()); i != m_zips.end() && !exists;) { + ::rtl::OUString aZipURL = i->first; + sal_Int32 nFromIndex = aZipURL.getLength() - sBrandURLSuffix.getLength(); + // skip brand-specific icon themes; they are incomplete and thus not useful for this check + if (nFromIndex < 0 || !aZipURL.match(sBrandURLSuffix, nFromIndex)) { + osl::File aZip(aZipURL); + if (aZip.open(OpenFlag_Read) == ::osl::FileBase::E_None) { + aZip.close(); + exists = true; + } + } + ++i; + } + m_checkStyleCache[style] = exists; + return exists; +} + bool ImplImageTree::loadImage( rtl::OUString const & name, rtl::OUString const & style, BitmapEx & bitmap, bool localized) { setStyle(style); - if (cacheLookup(name, localized, bitmap)) { + if (iconCacheLookup(name, localized, bitmap)) { return true; } if (!bitmap.IsEmpty()) { @@ -164,7 +196,7 @@ bool ImplImageTree::loadImage( rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); } if (found) { - m_cache[name.intern()] = std::make_pair(localized, bitmap); + m_iconCache[name.intern()] = std::make_pair(localized, bitmap); } return found; } @@ -173,7 +205,8 @@ void ImplImageTree::shutDown() { m_style = rtl::OUString(); // for safety; empty m_style means "not initialized" m_zips.clear(); - m_cache.clear(); + m_iconCache.clear(); + m_checkStyleCache.clear(); } void ImplImageTree::setStyle(rtl::OUString const & style) { @@ -181,7 +214,7 @@ void ImplImageTree::setStyle(rtl::OUString const & style) { if (style != m_style) { m_style = style; resetZips(); - m_cache.clear(); + m_iconCache.clear(); } } @@ -241,6 +274,7 @@ void ImplImageTree::resetZips() { u.GetMainURL(INetURLObject::NO_DECODE), css::uno::Reference< css::container::XNameAccess >())); } + if ( m_style.equals(::rtl::OUString::createFromAscii("default")) ) { rtl::OUString url( RTL_CONSTASCII_USTRINGPARAM( @@ -252,11 +286,23 @@ void ImplImageTree::resetZips() { } } -bool ImplImageTree::cacheLookup( +bool ImplImageTree::checkStyleCacheLookup( + rtl::OUString const & style, bool &exists) +{ + CheckStyleCache::iterator i(m_checkStyleCache.find(style)); + if (i != m_checkStyleCache.end()) { + exists = i->second; + return true; + } else { + return false; + } +} + +bool ImplImageTree::iconCacheLookup( rtl::OUString const & name, bool localized, BitmapEx & bitmap) { - Cache::iterator i(m_cache.find(name)); - if (i != m_cache.end() && i->second.first == localized) { + IconCache::iterator i(m_iconCache.find(name)); + if (i != m_iconCache.end() && i->second.first == localized) { bitmap = i->second.second; return true; } else { -- cgit From 1b4aa4f14c4e2449345e2f1c23cc88319cc3a649 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Wed, 28 Oct 2009 18:38:39 +0100 Subject: #i42985# use system fonts for fields --- vcl/inc/vcl/pdfwriter.hxx | 2 + vcl/source/gdi/pdfwriter_impl.cxx | 232 ++++++++++++++++++++++++++++++++++---- vcl/source/gdi/pdfwriter_impl.hxx | 7 ++ 3 files changed, 219 insertions(+), 22 deletions(-) diff --git a/vcl/inc/vcl/pdfwriter.hxx b/vcl/inc/vcl/pdfwriter.hxx index bdf636754c77..9d7f1503a08c 100644 --- a/vcl/inc/vcl/pdfwriter.hxx +++ b/vcl/inc/vcl/pdfwriter.hxx @@ -546,6 +546,7 @@ The following structure describes the permissions used in PDF security will be submitted. */ PDFWriter::ExportDataFormat SubmitFormat; + bool FieldsUseSystemFonts; /* the following data members are used to customize the PDF viewer preferences */ @@ -590,6 +591,7 @@ The following structure describes the permissions used in PDF security Tagged( false ), EmbedStandardFonts( false ), SubmitFormat( PDFWriter::FDF ), + FieldsUseSystemFonts( true ), PDFDocumentMode( PDFWriter::ModeDefault ), PDFDocumentAction( PDFWriter::ActionDefault ), Zoom( 100 ), diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index e7ee18ec7705..442c225c34bb 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -2844,6 +2844,121 @@ static bool getPfbSegmentLengths( const unsigned char* pFontBytes, int nByteLen, return true; } +std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const ImplFontData* pFont, EmbedFont& rEmbed ) +{ + std::map< sal_Int32, sal_Int32 > aRet; + if( isBuiltinFont( pFont ) ) + { + aRet[ rEmbed.m_nNormalFontID ] = emitBuiltinFont( pFont ); + return aRet; + } + + sal_Int32 nFontObject = 0; + sal_Int32 nFontDescriptor = 0; + rtl::OString aSubType( "/Type1" ); + FontSubsetInfo aInfo; + // fill in dummy values + aInfo.m_nAscent = 1000; + aInfo.m_nDescent = 200; + aInfo.m_nCapHeight = 1000; + aInfo.m_aFontBBox = Rectangle( Point( -200, -200 ), Size( 1700, 1700 ) ); + aInfo.m_aPSName = pFont->maName; + sal_Int32 pWidths[256]; + rtl_zeroMemory( pWidths, sizeof(pWidths) ); + if( pFont->IsEmbeddable() ) + { + const unsigned char* pFontData = NULL; + long nFontLen = 0; + sal_Ucs nEncodedCodes[256]; + sal_Int32 pEncWidths[256]; + if( (pFontData = (const unsigned char*)m_pReferenceDevice->mpGraphics->GetEmbedFontData( pFont, nEncodedCodes, pEncWidths, aInfo, &nFontLen )) != NULL ) + { + m_pReferenceDevice->mpGraphics->FreeEmbedFontData( pFontData, nFontLen ); + for( int i = 0; i < 256; i++ ) + { + if( nEncodedCodes[i] >= 32 && nEncodedCodes[i] < 256 ) + { + pWidths[i] = pEncWidths[ i ]; + } + } + } + } + else if( pFont->mbSubsettable ) + { + aSubType = rtl::OString( "/TrueType" ); + Int32Vector aGlyphWidths; + Ucs2UIntMap aUnicodeMap; + m_pReferenceDevice->mpGraphics->GetGlyphWidths( pFont, false, aGlyphWidths, aUnicodeMap ); + + OUString aTmpName; + osl_createTempFile( NULL, NULL, &aTmpName.pData ); + sal_Int32 pGlyphIDs[ 256 ]; + sal_uInt8 pEncoding[ 256 ]; + sal_Ucs pUnicodes[ 256 ]; + sal_Int32 pDuWidths[ 256 ]; + + memset( pGlyphIDs, 0, sizeof( pGlyphIDs ) ); + memset( pEncoding, 0, sizeof( pEncoding ) ); + memset( pUnicodes, 0, sizeof( pUnicodes ) ); + memset( pDuWidths, 0, sizeof( pDuWidths ) ); + + for( sal_Ucs c = 32; c < 256; c++ ) + { + pUnicodes[c] = c; + pEncoding[c] = c; + pGlyphIDs[c] = 0; + if( aUnicodeMap.find( c ) != aUnicodeMap.end() ) + pWidths[ c ] = aGlyphWidths[ aUnicodeMap[ c ] ]; + } + + m_pReferenceDevice->mpGraphics->CreateFontSubset( aTmpName, pFont, pGlyphIDs, pEncoding, pDuWidths, 256, aInfo ); + osl_removeFile( aTmpName.pData ); + } + else + { + DBG_ERROR( "system font neither embeddable nor subsettable" ); + } + + // write font descriptor + nFontDescriptor = emitFontDescriptor( pFont, aInfo, 0, 0 ); + if( nFontDescriptor ) + { + // write font object + sal_Int32 nObject = createObject(); + if( updateObject( nObject ) ) + { + OStringBuffer aLine( 1024 ); + aLine.append( nObject ); + aLine.append( " 0 obj\n" + "<mbSymbolFlag ) + aLine.append( "/Encoding/WinAnsiEncoding\n" ); + aLine.append( "/FirstChar 32 /LastChar 255\n" + "/Widths[" ); + for( int i = 32; i < 256; i++ ) + { + aLine.append( pWidths[i] ); + aLine.append( ((i&15) == 15) ? "\n" : " " ); + } + aLine.append( "]\n" + "/FontDescriptor " ); + aLine.append( nFontDescriptor ); + aLine.append( " 0 R>>\n" + "endobj\n\n" ); + writeBuffer( aLine.getStr(), aLine.getLength() ); + + nFontObject = nObject; + aRet[ rEmbed.m_nNormalFontID ] = nObject; + } + } + + return aRet; +} + // TODO: always subset instead of embedding the full font => this method becomes obsolete then std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFontData* pFont, EmbedFont& rEmbed ) { @@ -3603,23 +3718,28 @@ sal_Int32 PDFWriterImpl::emitFontDescriptor( const ImplFontData* pFont, FontSubs // According to PDF reference 1.4 StemV is required // seems a tad strange to me, but well ... aLine.append( "\n" - "/StemV 80\n" - "/FontFile" ); - switch( rInfo.m_nFontType ) + "/StemV 80\n" ); + if( nFontStream ) { - case FontSubsetInfo::SFNT_TTF: - aLine.append( '2' ); - break; - case FontSubsetInfo::TYPE1_PFA: - case FontSubsetInfo::TYPE1_PFB: - break; - default: - DBG_ERROR( "unknown fonttype in PDF font descriptor" ); - return 0; + aLine.append( "/FontFile" ); + switch( rInfo.m_nFontType ) + { + case FontSubsetInfo::SFNT_TTF: + aLine.append( '2' ); + break; + case FontSubsetInfo::TYPE1_PFA: + case FontSubsetInfo::TYPE1_PFB: + break; + default: + DBG_ERROR( "unknown fonttype in PDF font descriptor" ); + return 0; + } + aLine.append( ' ' ); + aLine.append( nFontStream ); + aLine.append( " 0 R\n" ); } - aLine.append( ' ' ); - aLine.append( nFontStream ); - aLine.append( " 0 R>>\n" + + aLine.append( ">>\n" "endobj\n\n" ); CHECK_RETURN( writeBuffer( aLine.getStr(), aLine.getLength() ) ); @@ -3876,6 +3996,17 @@ bool PDFWriterImpl::emitFonts() } } + // emit system fonts + for( FontEmbedData::iterator sit = m_aSystemFonts.begin(); sit != m_aSystemFonts.end(); ++sit ) + { + std::map< sal_Int32, sal_Int32 > aObjects = emitSystemFont( sit->first, sit->second ); + for( std::map< sal_Int32, sal_Int32 >::iterator fit = aObjects.begin(); fit != aObjects.end(); ++fit ) + { + CHECK_RETURN( fit->second ); + aFontIDToObject[ fit->first ] = fit->second; + } + } + OStringBuffer aFontDict( 1024 ); aFontDict.append( getFontDictObject() ); aFontDict.append( " 0 obj\n" @@ -4576,13 +4707,25 @@ void PDFWriterImpl::createDefaultEditAppearance( PDFWidget& rEdit, const PDFWrit // prepare font to use, draw field border Font aFont = drawFieldBorder( rEdit, rWidget, rSettings ); - sal_Int32 nBest = getBestBuiltinFont( aFont ); + sal_Int32 nBest = m_aContext.FieldsUseSystemFonts ? getSystemFont( aFont ): getBestBuiltinFont( aFont ); // prepare DA string OStringBuffer aDA( 32 ); appendNonStrokingColor( replaceColor( rWidget.TextColor, rSettings.GetFieldTextColor() ), aDA ); aDA.append( ' ' ); - aDA.append( m_aBuiltinFonts[nBest].getNameObject() ); + if( m_aContext.FieldsUseSystemFonts ) + { + aDA.append( "/F" ); + aDA.append( nBest ); + + OStringBuffer aDR( 32 ); + aDR.append( "/Font " ); + aDR.append( getFontDictObject() ); + aDR.append( " 0 R" ); + rEdit.m_aDRDict = aDR.makeStringAndClear(); + } + else + aDA.append( m_aBuiltinFonts[nBest].getNameObject() ); aDA.append( ' ' ); m_aPages[ m_nCurrentPage ].appendMappedLength( sal_Int32( aFont.GetHeight() ), aDA ); aDA.append( " Tf" ); @@ -4616,7 +4759,7 @@ void PDFWriterImpl::createDefaultListBoxAppearance( PDFWidget& rBox, const PDFWr // prepare font to use, draw field border Font aFont = drawFieldBorder( rBox, rWidget, rSettings ); - sal_Int32 nBest = getBestBuiltinFont( aFont ); + sal_Int32 nBest = m_aContext.FieldsUseSystemFonts ? getSystemFont( aFont ): getBestBuiltinFont( aFont ); beginRedirect( pListBoxStream, rBox.m_aRect ); OStringBuffer aAppearance( 64 ); @@ -4664,9 +4807,22 @@ void PDFWriterImpl::createDefaultListBoxAppearance( PDFWidget& rBox, const PDFWr aDA.append( " 2 Tr " ); } #endif + // prepare DA string appendNonStrokingColor( replaceColor( rWidget.TextColor, rSettings.GetFieldTextColor() ), aDA ); aDA.append( ' ' ); - aDA.append( m_aBuiltinFonts[nBest].getNameObject() ); + if( m_aContext.FieldsUseSystemFonts ) + { + aDA.append( "/F" ); + aDA.append( nBest ); + + OStringBuffer aDR( 32 ); + aDR.append( "/Font " ); + aDR.append( getFontDictObject() ); + aDR.append( " 0 R" ); + rBox.m_aDRDict = aDR.makeStringAndClear(); + } + else + aDA.append( m_aBuiltinFonts[nBest].getNameObject() ); aDA.append( ' ' ); m_aPages[ m_nCurrentPage ].appendMappedLength( sal_Int32( aFont.GetHeight() ), aDA ); aDA.append( " Tf" ); @@ -5243,9 +5399,18 @@ bool PDFWriterImpl::emitWidgetAnnotations() } if( rWidget.m_aDAString.getLength() ) { - aLine.append( "/DR<>>>\n" ); + if( rWidget.m_aDRDict.getLength() ) + { + aLine.append( "/DR<<" ); + aLine.append( rWidget.m_aDRDict ); + aLine.append( ">>\n" ); + } + else + { + aLine.append( "/DR<>>>\n" ); + } aLine.append( "/DA" ); appendLiteralStringEncrypt( rWidget.m_aDAString, rWidget.m_nObject, aLine ); aLine.append( "\n" ); @@ -6386,6 +6551,29 @@ std::set< PDFWriter::ErrorCode > PDFWriterImpl::getErrors() return m_aErrors; } +sal_Int32 PDFWriterImpl::getSystemFont( const Font& i_rFont ) +{ + getReferenceDevice()->Push(); + getReferenceDevice()->SetFont( i_rFont ); + getReferenceDevice()->ImplNewFont(); + + const ImplFontData* pDevFont = m_pReferenceDevice->mpFontEntry->maFontSelData.mpFontData; + sal_Int32 nFontID = 0; + FontEmbedData::iterator it = m_aSystemFonts.find( pDevFont ); + if( it != m_aSystemFonts.end() ) + nFontID = it->second.m_nNormalFontID; + else + { + nFontID = m_nNextFID++; + m_aSystemFonts[ pDevFont ] = EmbedFont(); + m_aSystemFonts[ pDevFont ].m_nNormalFontID = nFontID; + } + + getReferenceDevice()->Pop(); + getReferenceDevice()->ImplNewFont(); + + return nFontID; +} void PDFWriterImpl::registerGlyphs( int nGlyphs, sal_GlyphId* pGlyphs, diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index 7d5ec2bf4f61..4a7f8ab0e33a 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -311,6 +311,8 @@ public: { sal_Int32 m_nNormalFontID; std::list< EmbedEncoding > m_aExtendedEncodings; + + EmbedFont() : m_nNormalFontID( 0 ) {} }; typedef std::map< const ImplFontData*, EmbedFont > FontEmbedData; @@ -396,6 +398,7 @@ public: USHORT m_nTextStyle; rtl::OUString m_aValue; rtl::OString m_aDAString; + rtl::OString m_aDRDict; rtl::OString m_aMKDict; rtl::OString m_aMKDictCAString; // i12626, added to be able to encrypt the /CA text string // since the object number is not known at the moment @@ -612,6 +615,7 @@ private: FontSubsetData m_aSubsets; bool m_bEmbedStandardFonts; FontEmbedData m_aEmbeddedFonts; + FontEmbedData m_aSystemFonts; sal_Int32 m_nNextFID; PDFFontCache m_aFontCache; @@ -897,6 +901,8 @@ i12626 sal_Int32 emitBuiltinFont( const ImplFontData*, sal_Int32 nObject = -1 ); /* writes a type1 embedded font object and returns its mapping from font ids to object ids (or 0 in case of failure ) */ std::map< sal_Int32, sal_Int32 > emitEmbeddedFont( const ImplFontData*, EmbedFont& ); + /* writes a type1 system font object and returns its mapping from font ids to object ids (or 0 in case of failure ) */ + std::map< sal_Int32, sal_Int32 > emitSystemFont( const ImplFontData*, EmbedFont& ); /* writes a font descriptor and returns its object id (or 0) */ sal_Int32 emitFontDescriptor( const ImplFontData*, FontSubsetInfo&, sal_Int32 nSubsetID, sal_Int32 nStream ); /* writes a ToUnicode cmap, returns the corresponding stream object */ @@ -983,6 +989,7 @@ i12626 sal_Int32 findRadioGroupWidget( const PDFWriter::RadioButtonWidget& rRadio ); Font replaceFont( const Font& rControlFont, const Font& rAppSetFont ); sal_Int32 getBestBuiltinFont( const Font& rFont ); + sal_Int32 getSystemFont( const Font& i_rFont ); // used for edit and listbox Font drawFieldBorder( PDFWidget&, const PDFWriter::AnyWidget&, const StyleSettings& ); -- cgit From 67709c13a6f4c7c15ec3431c494661a1c588e2bc Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Thu, 29 Oct 2009 13:22:30 +0000 Subject: CWS-TOOLING: integrate CWS c07v026_OOO320 2009-10-19 10:26:11 +0200 mav r277008 : #b6886425# use standard solution to encode the URL for the Gnome 2009-10-19 08:38:28 +0200 mav r276998 : #b6886425# encode the URL correctly for the Gnome 2009-10-07 12:49:32 +0200 os r276749 : #b6887668# resize items depending on the item text length 2009-09-28 18:42:32 +0200 dr r276499 : #b6883075# shrink print ranges to Excel sheet limits 2009-09-28 16:50:25 +0200 od r276497 : #b6882166# method - assure notification on position changes, otherwise the layout will not be correct. 2009-09-15 18:31:37 +0200 dr r276185 : #b6872823# check cursor before using, patch by aw 2009-09-09 10:52:52 +0200 od r275975 : #b6879723# correct handling of new list level attributes regarding paragraph indent values, especially in case of OOo 2.0 and former hidden compatibility option "Ignore first line indent on numbering" 2009-09-08 11:10:31 +0200 od r275918 : #b6876367# method - do not reset list attributes at paragraph, if its applied list style will not change due to the newly applied paragraph style. 2009-09-07 12:48:58 +0200 obo r275890 : Merge from c07v025 into this CWS --- vcl/source/window/status.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index 4aaef6a707b1..ede3bcc107aa 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -1320,8 +1320,13 @@ void StatusBar::SetItemText( USHORT nItemId, const XubString& rText ) // adjust item width - see also DataChanged() long nFudge = GetTextHeight()/4; long nWidth = GetTextWidth( pItem->maText ) + nFudge; - if( nWidth > pItem->mnWidth + STATUSBAR_OFFSET ) + if( (nWidth > pItem->mnWidth + STATUSBAR_OFFSET) || + ((nWidth < pItem->mnWidth) && (mnDX - STATUSBAR_OFFSET) < mnItemsWidth )) + { pItem->mnWidth = nWidth + STATUSBAR_OFFSET; + ImplFormat(); + Invalidate(); + } // Item neu Zeichen, wenn StatusBar sichtbar und // UpdateMode gesetzt ist -- cgit From 979028e7efbcaf1b419040d9bd9df34218b3fca2 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Thu, 29 Oct 2009 18:25:35 +0100 Subject: #i90599# fix a case of incomplete accel sequences (thanks cmc and dtardon) --- vcl/source/window/accmgr.cxx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/vcl/source/window/accmgr.cxx b/vcl/source/window/accmgr.cxx index 71373bbabee5..36064fc8bc6b 100644 --- a/vcl/source/window/accmgr.cxx +++ b/vcl/source/window/accmgr.cxx @@ -83,6 +83,23 @@ void ImplAccelManager::RemoveAccel( Accelerator* pAccel ) if ( !mpAccelList ) return; + //e.g. #i90599#. Someone starts typing a sequence in a dialog, but doesn't + //end it, and then closes the dialog, deleting the accelerators. So if + //we're removing an accelerator that a sub-accelerator which is in the + //sequence list, throw away the entire sequence + if ( mpSequenceList ) + { + for (USHORT i = 0; i < pAccel->GetItemCount(); ++i) + { + Accelerator* pSubAccel = pAccel->GetAccel(pAccel->GetItemId(i)); + if ( mpSequenceList->GetPos( pSubAccel ) != LIST_ENTRY_NOTFOUND ) + { + EndSequence( true ); + break; + } + } + } + // Raus damit mpAccelList->Remove( pAccel ); } -- cgit From e9a9ad41f2482c12f4e5fc7af966675bf0c3a568 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 30 Oct 2009 09:37:43 +0000 Subject: #cmcfixes65: #i106469# fix fortify warnings --- transex3/source/directory.cxx | 17 +++++++++-- transex3/source/help/HelpLinker.cxx | 60 ++++++++++++++++++++++--------------- transex3/source/localize.cxx | 6 ++-- 3 files changed, 54 insertions(+), 29 deletions(-) diff --git a/transex3/source/directory.cxx b/transex3/source/directory.cxx index a4a2abc70e0f..ed0fe27d22c2 100644 --- a/transex3/source/directory.cxx +++ b/transex3/source/directory.cxx @@ -174,6 +174,16 @@ void Directory::readDirectory ( const rtl::OUString& sFullpath ) #else +class dirholder +{ +private: + DIR *mpDir; +public: + dirholder(DIR *pDir) : mpDir(pDir) {} + int close() { int nRet = mpDir ? closedir(mpDir) : 0; mpDir = NULL; return nRet; } + ~dirholder() { close(); } +}; + void Directory::readDirectory( const rtl::OUString& sFullpath ) { struct stat statbuf; @@ -195,13 +205,14 @@ void Directory::readDirectory( const rtl::OUString& sFullpath ) if( S_ISDIR(statbuf.st_mode ) == 0 ) { return; }// error } return; // not dir if( (dir = opendir( path ) ) == NULL ) {printf("readerror 2 in %s \n",path); return; } // error } return; // error + dirholder aHolder(dir); sFullpathext += rtl::OString( "/" ); const rtl::OString sDot ( "." ) ; const rtl::OString sDDot( ".." ); - chdir( path ); + if ( chdir( path ) == -1 ) { printf("chdir error in %s \n",path); return; } // error while( ( dirp = readdir( dir ) ) != NULL ) { @@ -253,8 +264,8 @@ void Directory::readDirectory( const rtl::OUString& sFullpath ) } } } - chdir( ".." ); - if( closedir( dir ) < 0 ) return ; // error + if ( chdir( ".." ) == -1 ) { printf("chdir error in .. \n"); return; } // error + if( aHolder.close() < 0 ) return ; // error std::sort( aFileVec.begin() , aFileVec.end() , File::lessFile ); std::sort( aDirVec.begin() , aDirVec.end() , Directory::lessDir ); diff --git a/transex3/source/help/HelpLinker.cxx b/transex3/source/help/HelpLinker.cxx index 67049df439e1..19b9ead8521e 100644 --- a/transex3/source/help/HelpLinker.cxx +++ b/transex3/source/help/HelpLinker.cxx @@ -174,15 +174,23 @@ void writeKeyValue_DBHelp( FILE* pFile, const std::string& aKeyStr, const std::s if( pFile == NULL ) return; char cLF = 10; - int nKeyLen = aKeyStr.length(); - int nValueLen = aValueStr.length(); + unsigned int nKeyLen = aKeyStr.length(); + unsigned int nValueLen = aValueStr.length(); fprintf( pFile, "%x ", nKeyLen ); if( nKeyLen > 0 ) - fwrite( aKeyStr.c_str(), 1, nKeyLen, pFile ); - fprintf( pFile, " %x ", nValueLen ); + { + if (fwrite( aKeyStr.c_str(), 1, nKeyLen, pFile ) != nKeyLen) + fprintf(stderr, "fwrite to db failed\n"); + } + if (fprintf( pFile, " %x ", nValueLen ) < 0) + fprintf(stderr, "fwrite to db failed\n"); if( nValueLen > 0 ) - fwrite( aValueStr.c_str(), 1, nValueLen, pFile ); - fprintf( pFile, "%c", cLF ); + { + if (fwrite( aValueStr.c_str(), 1, nValueLen, pFile ) != nValueLen) + fprintf(stderr, "fwrite to db failed\n"); + } + if (fprintf( pFile, "%c", cLF ) < 0) + fprintf(stderr, "fwrite to db failed\n"); } class HelpKeyword @@ -384,8 +392,8 @@ void HelpLinker::initIndexerPreProcessor() */ void HelpLinker::link() throw( HelpProcessingException ) { - bool bIndexForExtension = true; - + bool bIndexForExtension = true; + if( bExtensionMode ) { indexDirParentName = sourceRoot; @@ -476,8 +484,10 @@ void HelpLinker::link() throw( HelpProcessingException ) if( !bExtensionMode ) { +#ifndef OS2 // YD @TODO@ crashes libc runtime :-( std::cout << "Making " << outputFile.native_file_string() << " from " << helpFiles.size() << " input files" << std::endl; +#endif } // here we start our loop over the hzip files. @@ -928,34 +938,34 @@ void HelpLinker::main(std::vector &args, std::string* pExtensionPat aStrStream << "no index caption stylesheet given" << std::endl; throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); } - else if ( bExtensionMode ) - { - rtl::OUString aIdxCaptionPathFileURL( aOfficeHelpPath ); - aIdxCaptionPathFileURL += rtl::OUString::createFromAscii( "/idxcaption.xsl" ); - + else if ( bExtensionMode ) + { + rtl::OUString aIdxCaptionPathFileURL( aOfficeHelpPath ); + aIdxCaptionPathFileURL += rtl::OUString::createFromAscii( "/idxcaption.xsl" ); + rtl::OString aOStr_IdxCaptionPathFileURL( rtl::OUStringToOString ( aIdxCaptionPathFileURL, fs::getThreadTextEncoding() ) ); std::string aStdStr_IdxCaptionPathFileURL( aOStr_IdxCaptionPathFileURL.getStr() ); - - idxCaptionStylesheet = fs::path( aStdStr_IdxCaptionPathFileURL ); - } + + idxCaptionStylesheet = fs::path( aStdStr_IdxCaptionPathFileURL ); + } if (!bExtensionMode && idxContentStylesheet.empty()) { std::stringstream aStrStream; aStrStream << "no index content stylesheet given" << std::endl; throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); } - else if ( bExtensionMode ) - { - rtl::OUString aIdxContentPathFileURL( aOfficeHelpPath ); - aIdxContentPathFileURL += rtl::OUString::createFromAscii( "/idxcontent.xsl" ); - + else if ( bExtensionMode ) + { + rtl::OUString aIdxContentPathFileURL( aOfficeHelpPath ); + aIdxContentPathFileURL += rtl::OUString::createFromAscii( "/idxcontent.xsl" ); + rtl::OString aOStr_IdxContentPathFileURL( rtl::OUStringToOString ( aIdxContentPathFileURL, fs::getThreadTextEncoding() ) ); std::string aStdStr_IdxContentPathFileURL( aOStr_IdxContentPathFileURL.getStr() ); - - idxContentStylesheet = fs::path( aStdStr_IdxContentPathFileURL ); - } + + idxContentStylesheet = fs::path( aStdStr_IdxContentPathFileURL ); + } if (!bExtensionMode && embeddStylesheet.empty()) { std::stringstream aStrStream; @@ -1014,7 +1024,9 @@ int main(int argc, char**argv) exit(1); } sal_uInt32 endtime = osl_getGlobalTimer(); +#ifndef OS2 // YD @TODO@ crashes libc runtime :-( std::cout << "time taken was " << (endtime-starttime)/1000.0 << " seconds" << std::endl; +#endif return 0; } diff --git a/transex3/source/localize.cxx b/transex3/source/localize.cxx index bcd45d7027a4..31143ab50d38 100644 --- a/transex3/source/localize.cxx +++ b/transex3/source/localize.cxx @@ -345,7 +345,8 @@ void SourceTreeLocalizer::WorkOnFile( sCommand +=" -QQ "; } //printf("DBG: %s\n",sCommand.GetBuffer()); - system( sCommand.GetBuffer()); + if (system(sCommand.GetBuffer()) == -1) + fprintf(stderr, "%s failed\n", sCommand.GetBuffer()); nFileCnt++; printf("."); fflush( stdout ); @@ -621,7 +622,8 @@ BOOL SourceTreeLocalizer::MergeSingleFile( DirEntry aOldCWD; aPath.SetCWD(); - system( sCommand.GetBuffer()); + if (system(sCommand.GetBuffer()) == -1) + fprintf(stderr, "%s failed\n", sCommand.GetBuffer()); nFileCnt++; printf("."); //if( bQuiet2 ){ printf("."); } -- cgit From 953559b4f9446b14280611d35d5391b92640cab6 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 30 Oct 2009 11:38:40 +0100 Subject: #i106475# alias patch (thanks cmc) --- rsc/inc/rsctools.hxx | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/rsc/inc/rsctools.hxx b/rsc/inc/rsctools.hxx index eb9f8937b939..fd8e49135eb0 100644 --- a/rsc/inc/rsctools.hxx +++ b/rsc/inc/rsctools.hxx @@ -138,28 +138,41 @@ public: sal_uInt32 Size(){ return( nLen ); }; void Put( sal_uInt64 lVal ) { + union + { + sal_uInt64 lVal64; + sal_uInt32 aVal32[2]; + }; + lVal64 = lVal; if( bSwap ) { - Put( *(((sal_uInt32*)&lVal)+1) ); - Put( *(sal_uInt32*)&lVal ); + Put( aVal32[1] ); + Put( aVal32[0] ); } else { - Put( *(sal_uInt32*)&lVal ); - Put( *(((sal_uInt32*)&lVal)+1) ); + Put( aVal32[0] ); + Put( aVal32[1] ); } } void Put( sal_Int32 lVal ) { + union + { + sal_uInt32 lVal32; + sal_uInt16 aVal16[2]; + }; + lVal32 = lVal; + if( bSwap ) { - Put( *(((sal_uInt16*)&lVal) +1) ); - Put( *(sal_uInt16*)&lVal ); + Put( aVal16[1] ); + Put( aVal16[0] ); } else { - Put( *(sal_uInt16*)&lVal ); - Put( *(((sal_uInt16*)&lVal) +1) ); + Put( aVal16[0] ); + Put( aVal16[1] ); } } void Put( sal_uInt32 nValue ) @@ -171,15 +184,22 @@ public: void PutAt( sal_uInt32 nPos, INT32 lVal ) { + union + { + sal_uInt32 lVal32; + sal_uInt16 aVal16[2]; + }; + lVal32 = lVal; + if( bSwap ) { - PutAt( nPos, *(((sal_uInt16*)&lVal) +1) ); - PutAt( nPos + 2, *(sal_uInt16*)&lVal ); + PutAt( nPos, aVal16[1] ); + PutAt( nPos + 2, aVal16[0] ); } else { - PutAt( nPos, *(sal_uInt16*)&lVal ); - PutAt( nPos + 2, *(((sal_uInt16*)&lVal) +1) ); + PutAt( nPos, aVal16[0] ); + PutAt( nPos + 2, aVal16[1] ); } } void PutAt( sal_uInt32 nPos, sal_uInt32 lVal ) -- cgit From 09d85652245626a0b4f489f8bc74bb80f03973f4 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 30 Oct 2009 13:22:36 +0100 Subject: vcl107: #i105197# avoid enless loop on premature EOF --- vcl/source/gdi/region.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx index 43bb224aaa94..4b8a49959c9b 100644 --- a/vcl/source/gdi/region.cxx +++ b/vcl/source/gdi/region.cxx @@ -2459,6 +2459,14 @@ SvStream& operator>>( SvStream& rIStrm, Region& rRegion ) } } + if( rIStrm.IsEof() ) + { + DBG_ERROR( "premature end of region stream" ); + delete rRegion.mpImplRegion; + rRegion.mpImplRegion = (ImplRegion*)&aImplEmptyRegion; + return rIStrm; + } + // get next header rIStrm >> nTmp16; } -- cgit From 34c697928962e1b8f6cd4c657d83a62c11fffadb Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Fri, 30 Oct 2009 12:37:25 +0000 Subject: fixes for i106470 --- svtools/inc/svtools/accessiblefactory.hxx | 6 + svtools/inc/svtools/accessibletable.hxx | 185 ++++++ svtools/inc/svtools/table/tablecontrol.hxx | 86 ++- svtools/inc/svtools/table/tablemodel.hxx | 4 +- svtools/prj/d.lst | 3 + svtools/source/table/tablecontrol.cxx | 370 +++++++++++- svtools/source/table/tablecontrol_impl.cxx | 25 +- svtools/source/table/tablecontrol_impl.hxx | 20 +- svtools/source/uno/makefile.mk | 1 + svtools/source/uno/svtxgridcontrol.cxx | 458 +++++++++++++++ svtools/source/uno/svtxgridcontrol.hxx | 106 ++++ svtools/source/uno/unocontroltablemodel.cxx | 849 ++++++++++++++-------------- svtools/source/uno/unocontroltablemodel.hxx | 146 +++-- svtools/source/uno/unoiface.cxx | 12 +- 14 files changed, 1727 insertions(+), 544 deletions(-) create mode 100755 svtools/inc/svtools/accessibletable.hxx create mode 100755 svtools/source/uno/svtxgridcontrol.cxx create mode 100755 svtools/source/uno/svtxgridcontrol.hxx diff --git a/svtools/inc/svtools/accessiblefactory.hxx b/svtools/inc/svtools/accessiblefactory.hxx index f7cad847edda..f4d8a03ef872 100644 --- a/svtools/inc/svtools/accessiblefactory.hxx +++ b/svtools/inc/svtools/accessiblefactory.hxx @@ -40,6 +40,7 @@ #endif #include "AccessibleBrowseBoxObjType.hxx" #include "accessibletableprovider.hxx" +#include "accessibletable.hxx" namespace com { namespace sun { namespace star { namespace accessibility { @@ -89,6 +90,11 @@ namespace svt const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, IAccessibleTableProvider& _rBrowseBox ) const = 0; + virtual table::IAccessibleTableControl* + createAccessibleTableControl( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, + table::IAccessibleTable& _rTable + ) const = 0; virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > createAccessibleIconChoiceCtrl( diff --git a/svtools/inc/svtools/accessibletable.hxx b/svtools/inc/svtools/accessibletable.hxx new file mode 100755 index 000000000000..0e3f08bfc568 --- /dev/null +++ b/svtools/inc/svtools/accessibletable.hxx @@ -0,0 +1,185 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: accessibletable.hxx,v $ + * $Revision: 1.4 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVTOOLS_ACCESSIBLETABLE_HXX +#define _SVTOOLS_ACCESSIBLETABLE_HXX + +#include +#include +#include + +// ============================================================================ + +namespace svt{ namespace table +{ + +typedef sal_Int32 RowPos; + +// ============================================================================ + +enum AccessibleTableType +{ + /** Child index of the column header bar (first row). */ + TCINDEX_COLUMNHEADERBAR = 0, + /** Child index of the row header bar ("handle column"). */ + TCINDEX_ROWHEADERBAR = 1, + /** Child index of the data table. */ + TCINDEX_TABLE = 2 +}; + +enum AccessibleTableControlObjType +{ + TCTYPE_GRIDCONTROL, /// The GridControl itself. + TCTYPE_TABLE, /// The data table. + TCTYPE_ROWHEADERBAR, /// The row header bar. + TCTYPE_COLUMNHEADERBAR, /// The horizontal column header bar. + TCTYPE_TABLECELL, /// A cell of the data table. + TCTYPE_ROWHEADERCELL, /// A cell of the row header bar. + TCTYPE_COLUMNHEADERCELL, /// A cell of the column header bar. +}; + +// ============================================================================ + +#define XACC ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + +/** This abstract class provides methods to implement an accessible table object. +*/ +class IAccessibleTable +{ +public: + /** @return The position of the current row. */ + virtual sal_Int32 GetCurrentRow() const = 0; + /** @return The position of the current column. */ + virtual sal_Int32 GetCurrentColumn() const = 0; + /** Creates and returns the accessible object of the whole GridControl. */ + virtual XACC CreateAccessible()= 0; + virtual XACC CreateAccessibleControl( sal_Int32 _nIndex )= 0; + virtual ::rtl::OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const= 0; + virtual sal_Bool GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow )= 0; + virtual sal_Bool HasColHeader() = 0; + virtual sal_Bool HasRowHeader() = 0; + + /** return the description of the specified object. + @param eObjType + The type to ask for + @param _nPosition + The position of a tablecell (index position), header bar colum/row cell + @return + The description of the specified object. + */ + virtual ::rtl::OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const= 0; + + /** Fills the StateSet with all states (except DEFUNC and SHOWING, done by + the accessible object), depending on the specified object type. */ + virtual void FillAccessibleStateSet( + ::utl::AccessibleStateSetHelper& rStateSet, + AccessibleTableControlObjType eObjType ) const= 0; + + // Window + virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) = 0; + virtual void GrabFocus()= 0; + virtual XACC GetAccessible( BOOL bCreate = TRUE )= 0; + virtual Window* GetAccessibleParentWindow() const= 0; + virtual Window* GetWindowInstance()= 0; + virtual sal_Int32 GetAccessibleControlCount() const = 0; + virtual sal_Bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint )= 0; + virtual long GetRowCount() const= 0; + virtual long GetColumnCount() const= 0; + virtual sal_Bool HasRowHeader() const= 0; + virtual sal_Int32 GetSelectedRowCount() const= 0; + virtual bool IsRowSelected( long _nRow ) const= 0; + virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint )= 0; + virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, BOOL _bOnScreen = TRUE ) = 0; + virtual Rectangle calcTableRect( BOOL _bOnScreen = TRUE ) = 0; + virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex)= 0; + virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint)= 0; + virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const= 0; + virtual ::rtl::OUString GetRowDescription( sal_Int32 _nRow ) const = 0; + virtual ::rtl::OUString GetRowName(sal_Int32 _nIndex) const = 0; + virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const = 0; + virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const = 0; + virtual ::rtl::OUString GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0; + virtual std::vector& GetSelectedRows() = 0; +}; + +// ---------------------------------------------------------------------------- + +/** interface for an implementation of a table control's Accesible component +*/ +class IAccessibleTableControl +{ +public: + /** returns the XAccessible object itself + + The reference returned here can be used to control the life time of the + IAccessibleTableImplementation object. + + The returned reference is guaranteed to not be . + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + getMyself() = 0; + + /** disposes the accessible implementation, so that it becomes defunc + */ + virtual void dispose() = 0; + + /** checks whether the accessible implementation, and its context, are still alive + @return , if the object is not disposed or disposing. + */ + virtual sal_Bool isAlive() const = 0; + + /** returns the accessible object for the row or the column header bar + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + getTableHeader( ::svt::table::AccessibleTableControlObjType _eObjType ) = 0; + + /** returns the accessible object for the table representation + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + getTable() = 0; + + ///** Commits an event to all listeners. */ + virtual void commitEvent( + sal_Int16 nEventId, + const ::com::sun::star::uno::Any& rNewValue, + const ::com::sun::star::uno::Any& rOldValue + ) = 0; +}; + +// ---------------------------------------------------------------------------- + +// ============================================================================ +} // namespace table +} // namespace svt + +// ============================================================================ + +#endif // _SVTOOLS_ACCESSIBLETABLE_HXX + diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index 98fddcb7d9e1..1315adf0c371 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -30,6 +30,8 @@ #include #include #include +#include +#include "svtaccessiblefactory.hxx" //........................................................................ namespace svt { namespace table @@ -38,6 +40,8 @@ namespace svt { namespace table class TableControl_Impl; class TableDataWindow; + class AccessibleTableControl_Impl; + //==================================================================== //= TableControl //==================================================================== @@ -55,10 +59,11 @@ namespace svt { namespace table The control supports the concept of a current (or active cell). + The control supports supports accessibility, this is encapsulated in IAccessibleTable // TODO: scrolling? */ - class TableControl : public Control + class TableControl : public Control, public IAccessibleTable { private: DECL_LINK( ImplMouseButtonDownHdl, MouseEvent* ); @@ -66,6 +71,8 @@ namespace svt { namespace table TableControl_Impl* m_pImpl; public: + ::std::auto_ptr< AccessibleTableControl_Impl > m_pAccessTable; + TableControl( Window* _pParent, WinBits _nStyle ); ~TableControl(); @@ -88,11 +95,11 @@ namespace svt { namespace table if there is no active cell, e.g. because the table does not contain any rows or columns. */ - RowPos GetCurrentRow() const; + sal_Int32 GetCurrentRow() const; /** returns the row, which contains the input point*/ - RowPos GetCurrentRow (const Point& rPoint); + ColPos GetCurrentRow (const Point& rPoint); /** retrieves the current column @@ -103,7 +110,7 @@ namespace svt { namespace table if there is no active cell, e.g. because the table does not contain any rows or columns. */ - ColPos GetCurrentColumn() const; + sal_Int32 GetCurrentColumn() const; /** activates the cell at the given position @@ -113,7 +120,7 @@ namespace svt { namespace table or impossibility to execute the move at all (for instance because of invalid coordinates). */ - bool GoTo( ColPos _nColumn, RowPos _nRow ); + bool GoTo( ColPos _nColumnPos, RowPos _nRow); /** moves the active cell to the given column, by keeping the active row @@ -147,26 +154,91 @@ namespace svt { namespace table void InvalidateDataWindow(RowPos _nRowStart, bool _bRemoved); /**gets the vector, which contains the selected rows */ - std::vector getSelectedRows(); + std::vector& GetSelectedRows(); /**after removing a row, updates the vector which contains the selected rows if the row, which should be removed, is selected, it will be erased from the vector */ void removeSelectedRow(RowPos _nRowPos); SelectionEngine* getSelEngine(); TableDataWindow* getDataWindow(); - // protected: + // Window overridables virtual void GetFocus(); virtual void LoseFocus(); virtual void KeyInput( const KeyEvent& rKEvt ); //virtual long Notify(NotifyEvent& rNEvt); + /** Creates and returns the accessible object of the whole BrowseBox. */ + virtual XACC CreateAccessible(); + virtual XACC CreateAccessibleControl( sal_Int32 _nIndex ); + virtual ::rtl::OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const; + virtual sal_Bool GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow ); + virtual ::rtl::OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const; + virtual void FillAccessibleStateSet( + ::utl::AccessibleStateSetHelper& rStateSet, + AccessibleTableControlObjType eObjType ) const; + + //// Window + virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ); + virtual void GrabFocus(); + virtual XACC GetAccessible( BOOL bCreate = TRUE ); + virtual Window* GetAccessibleParentWindow() const; + virtual Window* GetWindowInstance(); + virtual sal_Int32 GetAccessibleControlCount() const; + virtual sal_Bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint ); + virtual long GetRowCount() const; + virtual long GetColumnCount() const; + virtual sal_Bool HasRowHeader() const; + virtual sal_Int32 GetSelectedRowCount() const; + virtual bool IsRowSelected( long _nRow ) const; + virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint ); + virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, BOOL _bOnScreen = TRUE ); + virtual Rectangle calcTableRect( BOOL _bOnScreen = TRUE ); + virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex); + virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint); + virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const; + virtual ::rtl::OUString GetRowDescription( sal_Int32 _nRow ) const; + virtual ::rtl::OUString GetRowName(sal_Int32 _nIndex) const; + virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const; + virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const; + virtual ::rtl::OUString GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const; + virtual sal_Bool HasRowHeader(); + virtual sal_Bool HasColHeader(); + virtual sal_Bool isAccessibleAlive( ) const; + virtual void commitGridControlEvent( sal_Int16 _nEventId, const com::sun::star::uno::Any& _rNewValue, const com::sun::star::uno::Any& _rOldValue ); + + + protected: + /// retrieves the XAccessible implementation associated with the GridControl instance + ::svt::IAccessibleFactory& getAccessibleFactory(); + private: TableControl(); // never implemented TableControl( const TableControl& ); // never implemented TableControl& operator=( const TableControl& ); // never implemented }; + class AccessibleTableControl_Impl + { + public: + AccessibleFactoryAccess m_aFactoryAccess; + IAccessibleTableControl* m_pAccessible; + + public: + AccessibleTableControl_Impl() : m_pAccessible(NULL) + { + } + + + /// @see AccessibleTableControl::getTableRowHeader + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + getAccessibleTableHeader( AccessibleTableControlObjType _eObjType ); + /// @see AccessibleTableControl::getTable + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + getAccessibleTable( ); + + }; + //........................................................................ } } // namespace svt::table //........................................................................ diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index a1af1e1750ed..6e74d35b8586 100644 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -434,13 +434,13 @@ namespace svt { namespace table virtual void setCellContent(std::vector > cellContent)=0; /** gets the content of the cells */ - virtual std::vector > getCellContent() = 0; + virtual std::vector >& getCellContent() = 0; /**sets title of header rows */ virtual void setRowHeaderName(std::vector cellColumnContent)=0; /** gets title of header rows */ - virtual std::vector getRowHeaderName() = 0; + virtual std::vector& getRowHeaderName() = 0; /// destroys the table model instance virtual ~ITableModel() { } diff --git a/svtools/prj/d.lst b/svtools/prj/d.lst index 3dc9c0b013bb..1edf7d3aea1a 100644 --- a/svtools/prj/d.lst +++ b/svtools/prj/d.lst @@ -76,6 +76,7 @@ mkdir: %_DEST%\inc%_EXT%\svtools ..\inc\svtools\accessibletableprovider.hxx %_DEST%\inc%_EXT%\svtools\accessibletableprovider.hxx ..\inc\svtools\AccessibleBrowseBoxObjType.hxx %_DEST%\inc%_EXT%\svtools\AccessibleBrowseBoxObjType.hxx ..\inc\svtools\accessiblefactory.hxx %_DEST%\inc%_EXT%\svtools\accessiblefactory.hxx +..\inc\svtools\accessibletable.hxx %_DEST%\inc%_EXT%\svtools\accessibletable.hxx ..\inc\svtools\textwindowpeer.hxx %_DEST%\inc%_EXT%\svtools\textwindowpeer.hxx ..\inc\imgdef.hxx %_DEST%\inc%_EXT%\svtools\imgdef.hxx ..\inc\inetdef.hxx %_DEST%\inc%_EXT%\svtools\inetdef.hxx @@ -311,6 +312,8 @@ mkdir: %_DEST%\inc%_EXT%\svtools ..\inc\textwindowaccessibility.hxx %_DEST%\inc%_EXT%\svtools\textwindowaccessibility.hxx +..\inc\docpasswdrequest.hxx %_DEST%\inc%_EXT%\svtools\docpasswdrequest.hxx +..\inc\docmspasswdrequest.hxx %_DEST%\inc%_EXT%\svtools\docmspasswdrequest.hxx ..\inc\fontsubstconfig.hxx %_DEST%\inc%_EXT%\svtools\fontsubstconfig.hxx ..\inc\apearcfg.hxx %_DEST%\inc%_EXT%\svtools\apearcfg.hxx ..\inc\fltrcfg.hxx %_DEST%\inc%_EXT%\svtools\fltrcfg.hxx diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index c8895a19408d..521b1ad819f9 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -30,10 +30,35 @@ #include "tablegeometry.hxx" #include "tablecontrol_impl.hxx" #include "svtools/table/tabledatawindow.hxx" +#include +#include + +using namespace ::com::sun::star::uno; +using ::com::sun::star::accessibility::XAccessible; +using namespace ::com::sun::star::accessibility; +using namespace ::com::sun::star::lang; +using namespace utl; +//using namespace rtl; //........................................................................ namespace svt { namespace table { -//........................................................................ + //==================================================================== + //= AccessibleTableControl_Impl + //==================================================================== + // ---------------------------------------------------------------------------- + Reference< XAccessible > AccessibleTableControl_Impl::getAccessibleTableHeader( AccessibleTableControlObjType _eObjType ) + { + if ( m_pAccessible && m_pAccessible->isAlive() ) + return m_pAccessible->getTableHeader( _eObjType ); + return NULL; + } + // ---------------------------------------------------------------------------- + Reference< XAccessible > AccessibleTableControl_Impl::getAccessibleTable( ) + { + if ( m_pAccessible && m_pAccessible->isAlive() ) + return m_pAccessible->getTable( ); + return NULL; + } //==================================================================== //= TableControl @@ -45,12 +70,17 @@ namespace svt { namespace table { m_pImpl->getDataWindow()->SetMouseButtonDownHdl( LINK( this, TableControl, ImplMouseButtonDownHdl ) ); m_pImpl->getDataWindow()->SetMouseButtonUpHdl( LINK( this, TableControl, ImplMouseButtonUpHdl ) ); + m_pAccessTable.reset(new ::svt::table::AccessibleTableControl_Impl()); } //-------------------------------------------------------------------- TableControl::~TableControl() { DELETEZ( m_pImpl ); + if ( m_pAccessTable->m_pAccessible ) + { + m_pAccessTable->m_pAccessible->dispose(); + } } //-------------------------------------------------------------------- @@ -59,7 +89,7 @@ namespace svt { namespace table if ( !m_pImpl->getInputHandler()->GetFocus( *m_pImpl ) ) { Control::GetFocus(); - GrabFocus(); + Control::GrabFocus(); } } @@ -109,13 +139,13 @@ namespace svt { namespace table } //-------------------------------------------------------------------- - RowPos TableControl::GetCurrentRow() const + sal_Int32 TableControl::GetCurrentRow() const { return m_pImpl->getCurRow(); } //-------------------------------------------------------------------- - ColPos TableControl::GetCurrentColumn() const + sal_Int32 TableControl::GetCurrentColumn() const { return m_pImpl->getCurColumn(); } @@ -126,6 +156,11 @@ namespace svt { namespace table return m_pImpl->goTo( _nColumn, _nRow ); } //-------------------------------------------------------------------- + sal_Bool TableControl::GoToCell(sal_Int32 _nColPos, sal_Int32 _nRowPos) + { + return m_pImpl->goTo( _nColPos, _nRowPos ); + } + //-------------------------------------------------------------------- void TableControl::InvalidateDataWindow(RowPos _nRowStart, bool _bRemoved) { Rectangle _rRect; @@ -135,7 +170,7 @@ namespace svt { namespace table return m_pImpl->invalidateRow(_nRowStart, _rRect); } //-------------------------------------------------------------------- - std::vector TableControl::getSelectedRows() + std::vector& TableControl::GetSelectedRows() { return m_pImpl->getSelectedRows(); } @@ -174,6 +209,329 @@ namespace svt { namespace table { return m_pImpl->getDataWindow(); } + + Reference< XAccessible > TableControl::CreateAccessible() + { + Window* pParent = GetAccessibleParentWindow(); + DBG_ASSERT( pParent, "TableControl::CreateAccessible - parent not found" ); + + if( pParent && !m_pAccessTable->m_pAccessible) + { + Reference< XAccessible > xAccParent = pParent->GetAccessible(); + if( xAccParent.is() ) + { + m_pAccessTable->m_pAccessible = getAccessibleFactory().createAccessibleTableControl( + xAccParent, *this + ); + } + } + Reference< XAccessible > xAccessible; + if ( m_pAccessTable->m_pAccessible ) + xAccessible = m_pAccessTable->m_pAccessible->getMyself(); + return xAccessible; + } + Reference TableControl::CreateAccessibleControl( sal_Int32 _nIndex ) + { + (void)_nIndex; + DBG_ASSERT( FALSE, "TableControl::CreateAccessibleControl: to be overwritten!" ); + return NULL; + } + ::rtl::OUString TableControl::GetAccessibleObjectName( AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const + { + ::rtl::OUString aRetText; + switch( eObjType ) + { + case TCTYPE_GRIDCONTROL: + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GridControl" ) ); + break; + case TCTYPE_TABLE: + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Table" ) ); + break; + case TCTYPE_ROWHEADERBAR: + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RowHeaderBar" ) ); + break; + case TCTYPE_COLUMNHEADERBAR: + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnHeaderBar" ) ); + break; + case TCTYPE_TABLECELL: + aRetText = GetCellContent(_nRow, _nCol); + break; + case TCTYPE_ROWHEADERCELL: + aRetText = GetRowName(_nRow); + break; + case TCTYPE_COLUMNHEADERCELL: + aRetText = GetColumnName(_nCol); + break; + default: + OSL_ENSURE(0,"GridControl::GetAccessibleName: invalid enum!"); + } + return aRetText; + } +// ----------------------------------------------------------------------------- + +::rtl::OUString TableControl::GetAccessibleObjectDescription( AccessibleTableControlObjType eObjType, sal_Int32 ) const +{ + ::rtl::OUString aRetText; + switch( eObjType ) + { + case TCTYPE_GRIDCONTROL: + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GridControl description" ) ); + break; + case TCTYPE_TABLE: + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TABLE description" ) ); + break; + case TCTYPE_ROWHEADERBAR: + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ROWHEADERBAR description" ) ); + break; + case TCTYPE_COLUMNHEADERBAR: + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "COLUMNHEADERBAR description" ) ); + break; + case TCTYPE_TABLECELL: + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TABLECELL description" ) ); + break; + case TCTYPE_ROWHEADERCELL: + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ROWHEADERCELL description" ) ); + break; + case TCTYPE_COLUMNHEADERCELL: + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "COLUMNHEADERCELL description" ) ); + break; + } + return aRetText; +} +// ----------------------------------------------------------------------------- + +::rtl::OUString TableControl::GetRowDescription( sal_Int32 _nRow) const +{ + (void)_nRow; + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "row description" ) ); +} +// ----------------------------------------------------------------------------- + +::rtl::OUString TableControl::GetRowName( sal_Int32 _nIndex) const +{ + return GetModel()->getRowHeaderName()[_nIndex]; +} +// ----------------------------------------------------------------------------- + +::rtl::OUString TableControl::GetColumnDescription( sal_uInt16 _nColumn) const +{ + (void)_nColumn; + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "col description" ) ); +} +// ----------------------------------------------------------------------------- + +::rtl::OUString TableControl::GetColumnName( sal_Int32 _nIndex) const +{ + return GetModel()->getColumnModel(_nIndex)->getName(); +} + +// ----------------------------------------------------------------------------- + +::rtl::OUString TableControl::GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const +{ + ::rtl::OUString cellContent = ::rtl::OUString::createFromAscii(""); + std::vector >& aTableContent = GetModel()->getCellContent(); + if(&aTableContent) + { + std::vector& aRowContent = aTableContent[_nRowPos]; + if(&aRowContent) + cellContent = aRowContent[_nColPos]; + } + return cellContent; +} +// ----------------------------------------------------------------------------- + +void TableControl::FillAccessibleStateSet( + ::utl::AccessibleStateSetHelper& rStateSet, + AccessibleTableControlObjType eObjType ) const +{ + switch( eObjType ) + { + case TCTYPE_GRIDCONTROL: + case TCTYPE_TABLE: + + rStateSet.AddState( AccessibleStateType::FOCUSABLE ); + rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE); + if ( HasFocus() ) + rStateSet.AddState( AccessibleStateType::FOCUSED ); + if ( IsActive() ) + rStateSet.AddState( AccessibleStateType::ACTIVE ); + if ( IsEnabled() ) + rStateSet.AddState( AccessibleStateType::ENABLED ); + if ( IsReallyVisible() ) + rStateSet.AddState( AccessibleStateType::VISIBLE ); + rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS ); + + break; + case TCTYPE_ROWHEADERBAR: + rStateSet.AddState( AccessibleStateType::VISIBLE ); + rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS ); + break; + case TCTYPE_COLUMNHEADERBAR: + rStateSet.AddState( AccessibleStateType::VISIBLE ); + rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS ); + break; + case TCTYPE_TABLECELL: + { + //sal_Int32 nRow = GetCurRow(); + //sal_uInt16 nColumn = GetCurColumnId(); + //if ( IsFieldVisible(nRow,nColumn) ) + // rStateSet.AddState( AccessibleStateType::VISIBLE ); + rStateSet.AddState( AccessibleStateType::TRANSIENT ); + rStateSet.AddState( AccessibleStateType::SELECTABLE); + if( GetSelectedRowCount()>0) + rStateSet.AddState( AccessibleStateType::SELECTED); + } + break; + case TCTYPE_ROWHEADERCELL: + rStateSet.AddState( AccessibleStateType::VISIBLE ); + rStateSet.AddState( AccessibleStateType::TRANSIENT ); + break; + case TCTYPE_COLUMNHEADERCELL: + rStateSet.AddState( AccessibleStateType::VISIBLE ); + break; + } +} + +Rectangle TableControl::GetWindowExtentsRelative( Window *pRelativeWindow ) +{ + return Control::GetWindowExtentsRelative( pRelativeWindow ); +} +//----------------------------------------------------------------------------- +void TableControl::GrabFocus() +{ + Control::GrabFocus(); +} +// ----------------------------------------------------------------------------- +Reference< XAccessible > TableControl::GetAccessible( BOOL bCreate ) +{ + return Control::GetAccessible( bCreate ); +} +// ----------------------------------------------------------------------------- +Window* TableControl::GetAccessibleParentWindow() const +{ + return Control::GetAccessibleParentWindow(); +} +// ----------------------------------------------------------------------------- +Window* TableControl::GetWindowInstance() +{ + return this; +} + +sal_Bool TableControl::HasRowHeader() +{ + return GetModel()->hasRowHeaders(); +} +//-------------------------------------------------------------------------------- +sal_Bool TableControl::HasColHeader() +{ + return GetModel()->hasColumnHeaders(); +} +//-------------------------------------------------------------------------------- +sal_Int32 TableControl::GetAccessibleControlCount() const +{ + sal_Int32 count = 0; + if(GetRowCount()>0) + count+=1; + if(GetModel()->hasRowHeaders()) + count+=1; + if(GetModel()->hasColumnHeaders()) + count+=1; + return count; +} +sal_Bool TableControl::ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint ) +{ + sal_Int32 nRow = m_pImpl->getCurrentRow(_rPoint); + sal_Int32 nCol = GetCurrentColumn(); + _rnIndex = nRow * GetColumnCount() + nCol; + return nRow>=0 ? sal_True : sal_False; +} + +long TableControl::GetRowCount() const +{ + return m_pImpl->getRowCount(); +} +long TableControl::GetColumnCount() const +{ + return m_pImpl->getColumnCount(); +} +sal_Bool TableControl::HasRowHeader() const +{ + PTableModel pModel = GetModel(); + return pModel->hasRowHeaders(); +} +sal_Int32 TableControl::GetSelectedRowCount() const +{ + return m_pImpl->getSelectedRows().size(); +} +bool TableControl::IsRowSelected( long _nRow ) const +{ + return m_pImpl->isRowSelected(m_pImpl->getSelectedRows(), _nRow); +} +sal_Bool TableControl::ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint ) +{ + _rnRow = m_pImpl->getCurrentRow(_rPoint); + _rnColPos = GetCurrentColumn(); + return _rnRow>=0 ? sal_True : sal_False; +} +void TableControl::FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const +{ + if ( GetCurrentRow() == _nRow && GetCurrentColumn() == _nColumnPos ) + _rStateSet.AddState( AccessibleStateType::FOCUSED ); + else // only transient when column is not focused + _rStateSet.AddState( AccessibleStateType::TRANSIENT ); +} +Rectangle TableControl::GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) +{ + (void)_nRow; + (void)_nColumnPos; + return GetCharacterBounds(nIndex); +} +sal_Int32 TableControl::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) +{ + (void)_nRow; + (void)_nColumnPos; + return GetIndexForPoint(_rPoint); +; +} + // ----------------------------------------------------------------------------- +sal_Bool TableControl::isAccessibleAlive( ) const +{ + return ( NULL != m_pAccessTable->m_pAccessible ) && m_pAccessTable->m_pAccessible->isAlive(); +} + +// ----------------------------------------------------------------------------- +::svt::IAccessibleFactory& TableControl::getAccessibleFactory() +{ + return m_pAccessTable->m_aFactoryAccess.getFactory(); +} +// ----------------------------------------------------------------------------- +void TableControl::commitGridControlEvent( sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue ) +{ + if ( isAccessibleAlive() ) + m_pAccessTable->m_pAccessible->commitEvent( _nEventId, _rNewValue, _rOldValue); +} +// ----------------------------------------------------------------------------- +Rectangle TableControl::calcHeaderRect(sal_Bool _bIsColumnBar,BOOL _bOnScreen) +{ + Rectangle aRectTable, aRectTableWithHeaders; + m_pImpl->impl_getAllVisibleDataCellArea(aRectTable); + m_pImpl->impl_getAllVisibleCellsArea(aRectTableWithHeaders); + Size aSizeTable(aRectTable.GetSize()); + Size aSizeTableWithHeaders(aRectTableWithHeaders.GetSize()); + if(_bIsColumnBar) + return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width()-aSizeTable.Width(), aSizeTableWithHeaders.Height())); + else + return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width(), aSizeTableWithHeaders.Height()-aSizeTable.Height())); +} +// ----------------------------------------------------------------------------- +Rectangle TableControl::calcTableRect(BOOL _bOnScreen) +{ + Rectangle aRect; + m_pImpl->impl_getAllVisibleDataCellArea(aRect); + return aRect; +} + //........................................................................ -} } // namespace svt::table +}} // namespace svt::table //........................................................................ diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index e1ff3aeb7f2a..89c0eed4229a 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -181,24 +181,23 @@ namespace svt { namespace table { (void)pCellEntryType; } - virtual std::vector > getCellContent() + virtual std::vector >& getCellContent() { - std::vector cCC; - cCC.push_back(rtl::OUString::createFromAscii("")); - std::vector > cC; - cC.push_back(cCC); - return cC; + return *( new std::vector >); } virtual void setRowHeaderName(std::vector pCellEntryType) { (void)pCellEntryType; } - virtual std::vector getRowHeaderName() + virtual std::vector& getRowHeaderName() { - std::vector cCC; - cCC.push_back(rtl::OUString::createFromAscii("")); - return cCC; + aRowHeaderNames.clear(); + aRowHeaderNames.push_back(rtl::OUString::createFromAscii("")); + return aRowHeaderNames; } + + private: + std::vector aRowHeaderNames; }; @@ -882,7 +881,7 @@ namespace svt { namespace table impl_getAllVisibleDataCellArea( aAllDataCellsArea ); //get the vector, which contains row vectors, each containing the data for the cells in this row - std::vector > aCellContent = m_pModel->getCellContent(); + std::vector >& aCellContent = m_pModel->getCellContent(); //if the vector is empty, fill it with empty data, so the table can be painted if(aCellContent.empty()) { @@ -895,7 +894,7 @@ namespace svt { namespace table } std::vector >::iterator it = aCellContent.begin()+m_nTopRow; //get the vector, which contains the row header titles - std::vector aRowHeaderContent; + std::vector& aRowHeaderContent = m_pModel->getRowHeaderName(); ::std::vector::iterator itRowName = aRowHeaderContent.begin(); if(m_pModel->hasRowHeaders()) @@ -1525,7 +1524,7 @@ namespace svt { namespace table } //------------------------------------------------------------------------------- - std::vector TableControl_Impl::getSelectedRows() + std::vector& TableControl_Impl::getSelectedRows() { return m_nRowSelected; } diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx index 410bc8b4c3a1..0a25e82e4502 100644 --- a/svtools/source/table/tablecontrol_impl.hxx +++ b/svtools/source/table/tablecontrol_impl.hxx @@ -138,6 +138,8 @@ namespace svt { namespace table inline RowPos getCurRow() const { return m_nCurRow; } inline void setCurRow(RowPos curRow){ m_nCurRow = curRow; } inline RowPos getTopRow() const { return m_nTopRow; } + inline long getRowCount() const { return m_nRowCount; } + inline long getColumnCount() const { return m_nColumnCount; } inline long getColHeaderHightPixel() const { return m_nColHeaderHeightPixel; } @@ -194,7 +196,7 @@ namespace svt { namespace table /** to be called when a new row is added to the control*/ void invalidateRow(RowPos _nRowPos, Rectangle& _rCellRect ); /** returns the vector, which contains the selected rows*/ - std::vector getSelectedRows(); + std::vector& getSelectedRows(); /** updates the vector, which contains the selected rows after removing the row nRowPos*/ void removeSelectedRow(RowPos _nRowPos); void invalidateRows(RowPos _nRowStart, Rectangle& _rCellRect ); @@ -208,15 +210,6 @@ namespace svt { namespace table virtual SelectionEngine* getSelEngine(); TableDataWindow* getDataWindow(); - - private: - /** toggles the cursor visibility - - The method is not bound to the classes public invariants, as it's used in - situations where the they must not necessarily be fullfilled. - */ - void impl_ni_doSwitchCursor( bool _bOn ); - /** retrieves the area occupied by the totality of (at least partially) visible cells The returned area includes row and column headers. Also, it takes into @@ -234,6 +227,13 @@ namespace svt { namespace table minus the row and column header areas. */ void impl_getAllVisibleDataCellArea( Rectangle& _rCellArea ) const; + private: + /** toggles the cursor visibility + + The method is not bound to the classes public invariants, as it's used in + situations where the they must not necessarily be fullfilled. + */ + void impl_ni_doSwitchCursor( bool _bOn ); /** returns the number of visible rows. diff --git a/svtools/source/uno/makefile.mk b/svtools/source/uno/makefile.mk index 51e55a1f9123..8af6b2ae7467 100644 --- a/svtools/source/uno/makefile.mk +++ b/svtools/source/uno/makefile.mk @@ -56,6 +56,7 @@ SLOFILES= \ $(SLO)$/generictoolboxcontroller.obj \ $(SLO)$/treecontrolpeer.obj \ $(SLO)$/unocontroltablemodel.obj \ + $(SLO)$/svtxgridcontrol.obj \ $(SLO)$/registerservices.obj\ $(SLO)$/contextmenuhelper.obj diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx new file mode 100755 index 000000000000..73c9f091985f --- /dev/null +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -0,0 +1,458 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: SVTXGridControl.cxx,v $ + * $Revision: 1.32 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include "svtxgridcontrol.hxx" +#include +#include "svtools/table/gridtablerenderer.hxx" +#include "svtools/table/defaultinputhandler.hxx" +#include "svtools/table/tablecontrol.hxx" +#include "unocontroltablemodel.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +using ::rtl::OUString; +using namespace ::svt::table; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::awt::grid; +using namespace ::com::sun::star::view; +using namespace ::toolkit; +using namespace ::com::sun::star::accessibility; +using namespace ::com::sun::star::accessibility::AccessibleEventId; +using namespace ::com::sun::star::accessibility::AccessibleTableModelChangeType; +using ::com::sun::star::accessibility::AccessibleTableModelChange; + + +SVTXGridControl::SVTXGridControl() + :m_pTableModel (new UnoControlTableModel()), + m_xDataModel(0), + m_xColumnModel(0), + m_bHasColumnHeaders(false), + m_bHasRowHeaders(false), + m_bVScroll(false), + m_bHScroll(false) +{ +} + +//-------------------------------------------------------------------- +SVTXGridControl::~SVTXGridControl() +{ + DELETEZ(m_pTableModel); +} + +::com::sun::star::uno::Any SVTXGridControl::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType, + SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridControl*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridDataListener*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) ); + return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( SVTXGridControl ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridControl>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener>* ) NULL ), + VCLXWindow::getTypes() +IMPL_XTYPEPROVIDER_END + +::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL SVTXGridControl::getColumnModel( ) throw (::com::sun::star::uno::RuntimeException) +{ + return NULL; +} +void SAL_CALL SVTXGridControl::setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException) +{ + (void)model; +} +::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL SVTXGridControl::getDataModel( ) throw (::com::sun::star::uno::RuntimeException) +{ + return NULL; +} +void SAL_CALL SVTXGridControl::setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException) +{ + (void)model; +} +sal_Int32 SAL_CALL SVTXGridControl::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) +{ + TableControl* pTable = (TableControl*)GetWindow(); + return pTable->GetCurrentRow( Point(x,y) ); +} + +void SAL_CALL SVTXGridControl::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) +{ + (void)listener; +} + +void SAL_CALL SVTXGridControl::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) +{ + (void) listener; +} + +void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const Any& aValue) throw(RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + TableControl* pTable = (TableControl*)GetWindow(); + + switch( GetPropertyId( PropertyName ) ) + { + case BASEPROPERTY_GRID_SELECTIONMODE: + { + SelectionType eSelectionType; + if( aValue >>= eSelectionType ) + { + SelectionMode eSelMode; + switch( eSelectionType ) + { + case SelectionType_SINGLE: eSelMode = SINGLE_SELECTION; break; + case SelectionType_RANGE: eSelMode = RANGE_SELECTION; break; + case SelectionType_MULTI: eSelMode = MULTIPLE_SELECTION; break; + // case SelectionType_NONE: + default: eSelMode = NO_SELECTION; break; + } + if( pTable->getSelEngine()->GetSelectionMode() != eSelMode ) + pTable->getSelEngine()->SetSelectionMode( eSelMode ); + } + break; + } + case BASEPROPERTY_HSCROLL: + { + sal_Bool bHScroll = true; + if( aValue >>= bHScroll ) + { + m_bHScroll = bHScroll; + } + break; + } + case BASEPROPERTY_VSCROLL: + { + sal_Bool bVScroll = true; + if( aValue >>= bVScroll ) + { + m_bVScroll = bVScroll; + } + break; + } + case BASEPROPERTY_GRID_SHOWROWHEADER: + { + sal_Bool rowHeader = true; + if( aValue >>= rowHeader ) + { + m_pTableModel->setRowHeaders(rowHeader); + } + break; + } + + case BASEPROPERTY_GRID_SHOWCOLUMNHEADER: + { + sal_Bool colHeader = true; + if( aValue >>= colHeader ) + { + m_pTableModel->setColumnHeaders(colHeader); + } + break; + } + case BASEPROPERTY_GRID_DATAMODEL: + { + m_xDataModel = Reference< XGridDataModel >( aValue, UNO_QUERY ); + Sequence > cellData = m_xDataModel->getData(); + Sequence rowData(0); + std::vector< std::vector< rtl::OUString > > aCellContent(0); + for(int i = 0; i< m_xDataModel->getRowCount();++i) + { + rowData = cellData[i]; + std::vector newRow( + comphelper::sequenceToContainer< std::vector >(rowData)); + if(newRow.size() < m_pTableModel->getColumnCount()) + newRow.resize( m_pTableModel->getColumnCount(),rtl::OUString::createFromAscii("")); + aCellContent.push_back(newRow); + } + m_pTableModel->setCellContent(aCellContent); + Sequence< ::rtl::OUString > rowHeaders = m_xDataModel->getRowHeaders(); + std::vector< rtl::OUString > newRow( + comphelper::sequenceToContainer< std::vector >(rowHeaders)); + m_pTableModel->setRowCount(m_xDataModel->getRowCount()); + m_pTableModel->setRowHeaderName(newRow); + break; + } + case BASEPROPERTY_GRID_COLUMNMODEL: + { + m_xColumnModel = Reference< XGridColumnModel >( aValue, UNO_QUERY ); + Sequence > columns = m_xColumnModel->getColumns(); + std::vector > aNewColumns( + comphelper::sequenceToContainer > >(columns)); + /* if(m_pTable->GetColumnCount().size()>0) + m_pTable->GetColumnName.clear();*/ + for ( ::svt::table::ColPos col = 0; col < m_xColumnModel->getColumnCount(); ++col ) + { + UnoControlTableColumn* tableColumn = new UnoControlTableColumn(aNewColumns[col]); + m_pTableModel->getColumnModel().push_back((PColumnModel)tableColumn); + } + break; + } + default: + VCLXWindow::setProperty( PropertyName, aValue ); + break; + } +} + +Any SVTXGridControl::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + const sal_uInt16 nPropId = GetPropertyId( PropertyName ); + TableControl* pTable = (TableControl*)GetWindow(); + if(pTable) + { + switch(nPropId) + { + case BASEPROPERTY_GRID_SELECTIONMODE: + { + SelectionType eSelectionType; + + SelectionMode eSelMode = pTable->getSelEngine()->GetSelectionMode(); + switch( eSelMode ) + { + case SINGLE_SELECTION: eSelectionType = SelectionType_SINGLE; break; + case RANGE_SELECTION: eSelectionType = SelectionType_RANGE; break; + case MULTIPLE_SELECTION:eSelectionType = SelectionType_MULTI; break; +// case NO_SELECTION: + default: eSelectionType = SelectionType_NONE; break; + } + return Any( eSelectionType ); + } + case BASEPROPERTY_GRID_SHOWROWHEADER: + { + return Any ((sal_Bool) m_pTableModel->hasRowHeaders()); + } + case BASEPROPERTY_GRID_SHOWCOLUMNHEADER: + return Any ((sal_Bool) m_pTableModel->hasColumnHeaders()); + case BASEPROPERTY_GRID_DATAMODEL: + return Any ( m_xDataModel ); + case BASEPROPERTY_GRID_COLUMNMODEL: + return Any ( m_xColumnModel); + case BASEPROPERTY_HSCROLL: + return Any ( m_bHScroll); + case BASEPROPERTY_VSCROLL: + return Any ( m_bVScroll); + } + } + return VCLXWindow::getProperty( PropertyName ); +} + +void SVTXGridControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) +{ + PushPropertyIds( rIds, + BASEPROPERTY_GRID_SHOWROWHEADER, + BASEPROPERTY_GRID_SHOWCOLUMNHEADER, + BASEPROPERTY_GRID_DATAMODEL, + BASEPROPERTY_GRID_COLUMNMODEL, + BASEPROPERTY_GRID_SELECTIONMODE, + 0); + VCLXWindow::ImplGetPropertyIds( rIds, true ); +} +void SAL_CALL SVTXGridControl::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException) +{ + TableControl* pTable = (TableControl*)GetWindow(); + if ( pTable ) + { + pTable->SetModel(PTableModel(m_pTableModel)); + //m_pTable->SetPosSizePixel( Point( nPosX, nPosY ), Size(nWidth, nHeight) ); + pTable->Show( bVisible ); + } +} +void SAL_CALL SVTXGridControl::setFocus() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + if ( GetWindow()) + GetWindow()->GrabFocus(); +} +void SAL_CALL SVTXGridControl::rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) +{ + std::vector aNewRow( + comphelper::sequenceToContainer< std::vector >(Event.rowData)); + if(aNewRow.size()< m_pTableModel->getColumnCount()) + aNewRow.resize(m_pTableModel->getColumnCount(),rtl::OUString::createFromAscii("")); + m_pTableModel->getCellContent().push_back(aNewRow); + if(m_pTableModel->hasRowHeaders()) + m_pTableModel->getRowHeaderName().push_back(Event.headerName); + m_pTableModel->setRowCount(m_pTableModel->getRowHeaderName().size()); + TableControl* pTable = (TableControl*)GetWindow(); + pTable->InvalidateDataWindow(m_pTableModel->getRowHeaderName().size()-1, false); + //pTable->GrabFocus(); + if(pTable->isAccessibleAlive()) + { + pTable->commitGridControlEvent(TABLE_MODEL_CHANGED, + makeAny( AccessibleTableModelChange(INSERT, m_pTableModel->getRowCount()-1, m_pTableModel->getRowCount(), 0, m_pTableModel->getColumnCount())), + Any()); + pTable->commitGridControlEvent(CHILD, + makeAny( pTable->m_pAccessTable->m_pAccessible->getTableHeader(TCTYPE_ROWHEADERBAR)), + Any()); + for (sal_Int32 i = 0 ; i <= m_pTableModel->getColumnCount() ; ++i) + { + pTable->commitGridControlEvent( + CHILD, + makeAny( pTable->m_pAccessTable->m_pAccessible->getTable() ), + Any()); + } + } +} + +void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) +{ + TableControl* pTable = (TableControl*)GetWindow(); + //unsigned int rows =m_pImpl->aCellContent.size()-1; + if(Event.index == -1) + { + if(m_pTableModel->hasRowHeaders()) + m_pTableModel->getRowHeaderName().clear(); + m_pTableModel->getCellContent().clear(); + if(pTable->isAccessibleAlive()) + { + pTable->commitGridControlEvent(TABLE_MODEL_CHANGED, + makeAny( AccessibleTableModelChange(DELETE, 0, m_pTableModel->getColumnCount(), 0, m_pTableModel->getColumnCount())), + Any()); + } + } + else + { + pTable->removeSelectedRow(Event.index); + if(m_pTableModel->getCellContent().size()>1) + { + if(m_pTableModel->hasRowHeaders()) + m_pTableModel->getRowHeaderName().erase(m_pTableModel->getRowHeaderName().begin()+Event.index); + m_pTableModel->getCellContent().erase(m_pTableModel->getCellContent().begin()+Event.index); + + } + else + { + if(m_pTableModel->hasRowHeaders()) + m_pTableModel->getRowHeaderName().clear(); + m_pTableModel->getCellContent().clear(); + //m_pImpl->nRowCount=0; + } + } + //pTable->InvalidateDataWindow(Event.index, true); + m_pTableModel->setRowCount(m_pTableModel->getCellContent().size()); + pTable->InvalidateDataWindow(Event.index, true); + if(pTable->isAccessibleAlive()) + { + pTable->commitGridControlEvent(TABLE_MODEL_CHANGED, + makeAny( AccessibleTableModelChange(DELETE, Event.index, Event.index+1, 0, m_pTableModel->getColumnCount())), + Any()); + //pTable->commitGridControlEvent(CHILD, + // makeAny( pTable->m_pAccessTable->m_pAccessible->getTableHeader(TCTYPE_ROWHEADERBAR)), + // Any()); + //for (sal_Int32 i = 0 ; i <= m_pTableModel->getColumnCount() ; ++i) + //{ + // pTable->commitGridControlEvent( + // CHILD, + // makeAny( pTable->m_pAccessTable->m_pAccessible->getTable() ), + // Any()); + //} + } + //pTable->Invalidate(); +} + +void SAL_CALL SVTXGridControl::dataChanged(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) +{ + (void) Event; +} + + void SAL_CALL SVTXGridControl::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) + { + VCLXWindow::disposing( Source ); + } + +::sal_Int32 SAL_CALL SVTXGridControl::getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException) +{ + return 0; +} + +::sal_Int32 SAL_CALL SVTXGridControl::getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException) +{ + return 0; +} + +void SAL_CALL SVTXGridControl::insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException) +{ + (void)length; + (void)start; +} + +void SAL_CALL SVTXGridControl::removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException) +{ + (void)end; + (void)start; +} + +::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL SVTXGridControl::getSelection() throw (::com::sun::star::uno::RuntimeException) +{ + TableControl* pTable = (TableControl*)GetWindow(); + std::vector& selectedRows = pTable->GetSelectedRows(); + Sequence selectedRowsToSequence(comphelper::containerToSequence(selectedRows)); + return selectedRowsToSequence; +} + +::sal_Bool SAL_CALL SVTXGridControl::isCellEditable() throw (::com::sun::star::uno::RuntimeException) +{ + return sal_False; +} + +::sal_Bool SAL_CALL SVTXGridControl::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException) +{ + return sal_False; +} + +::sal_Bool SAL_CALL SVTXGridControl::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException) +{ + (void)index; + return sal_False; +} + +void SAL_CALL SVTXGridControl::selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) +{ + (void)y; +} + +void SAL_CALL SVTXGridControl::selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException) +{ + (void)x; +} diff --git a/svtools/source/uno/svtxgridcontrol.hxx b/svtools/source/uno/svtxgridcontrol.hxx new file mode 100755 index 000000000000..9ca6901681c9 --- /dev/null +++ b/svtools/source/uno/svtxgridcontrol.hxx @@ -0,0 +1,106 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: SVTXGridControl.hxx,v $ + * $Revision: 1.32 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVT_GRIDCONTROL_HXX_ +#define _SVT_GRIDCONTROL_HXX_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//#include + + +using namespace ::svt::table; + +class SVTXGridControl : public ::cppu::ImplInheritanceHelper2< VCLXWindow, ::com::sun::star::awt::grid::XGridControl, + ::com::sun::star::awt::grid::XGridDataListener> +{ +private: + UnoControlTableModel* m_pTableModel; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >m_xDataModel; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >m_xColumnModel; + bool m_bHasColumnHeaders; + bool m_bHasRowHeaders; + bool m_bVScroll; + bool m_bHScroll; + +public: + SVTXGridControl(); + ~SVTXGridControl(); + //XGridDataListener overridables + virtual void SAL_CALL rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dataChanged(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); + + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL acquire() throw() { VCLXWindow::acquire(); } + void SAL_CALL release() throw() { VCLXWindow::release(); } + + // ::com::sun::star::lang::XTypeProvider + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + //::com::sun::star::awt::grid::XGridControl + ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL getColumnModel( ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL getDataModel( ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException); + + virtual ::sal_Int32 SAL_CALL getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelection() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isCellEditable() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException); + + void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); + static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds ); + void SAL_CALL setVisible(sal_Bool bVisible) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setFocus() throw(::com::sun::star::uno::RuntimeException); + }; + #endif // _SVT_GRIDCONTROL_HXX_ diff --git a/svtools/source/uno/unocontroltablemodel.cxx b/svtools/source/uno/unocontroltablemodel.cxx index e322dbb8f96e..566848f19023 100644 --- a/svtools/source/uno/unocontroltablemodel.cxx +++ b/svtools/source/uno/unocontroltablemodel.cxx @@ -47,38 +47,6 @@ using namespace ::svt::table; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::awt::grid; -using namespace ::svt::table; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::view; -using namespace ::toolkit; - -class UnoControlTableColumn : public IColumnModel - { - private: - ColumnID m_nID; - String m_sName; - bool m_bIsResizable; - TableMetrics m_nWidth; - TableMetrics m_nMinWidth; - TableMetrics m_nMaxWidth; - - public: - UnoControlTableColumn(Reference); - - // IColumnModel overridables - virtual ColumnID getID() const; - virtual bool setID( const ColumnID _nID ); - virtual String getName() const; - virtual void setName( const String& _rName ); - virtual bool isResizable() const; - virtual void setResizable( bool _bResizable ); - virtual TableMetrics getWidth() const; - virtual void setWidth( TableMetrics _nWidth ); - virtual TableMetrics getMinWidth() const; - virtual void setMinWidth( TableMetrics _nMinWidth ); - virtual TableMetrics getMaxWidth() const; - virtual void setMaxWidth( TableMetrics _nMaxWidth ); - }; //-------------------------------------------------------------------- UnoControlTableColumn::UnoControlTableColumn(Reference m_xGridColumn) @@ -181,7 +149,7 @@ class UnoControlTableColumn : public IColumnModel //==================================================================== struct UnoControlTableModel_Impl { - ::std::vector< PColumnModel > aColumns; + ::std::vector< PColumnModel >& aColumns; TableSize nRowCount; bool bHasColumnHeaders; bool bHasRowHeaders; @@ -190,8 +158,8 @@ class UnoControlTableColumn : public IColumnModel TableMetrics nRowHeight; TableMetrics nColumnHeaderHeight; TableMetrics nRowHeaderWidth; - std::vector aRowHeadersTitle; - std::vector > aCellContent; + std::vector& aRowHeadersTitle; + std::vector >& aCellContent; UnoControlTableModel_Impl() :nRowCount ( 0 ) @@ -202,8 +170,9 @@ class UnoControlTableColumn : public IColumnModel ,nRowHeight ( 4 * 100 ) // 40 mm ,nColumnHeaderHeight( 5 * 100 ) // 50 mm ,nRowHeaderWidth ( 10 * 100 ) // 50 mm - ,aRowHeadersTitle ( 0 ) - ,aCellContent ( 0 ) + ,aRowHeadersTitle ( *(new std::vector(0))) + ,aCellContent ( *(new std::vector >(0))) + ,aColumns ( *(new std::vector< PColumnModel> (0))) { } }; @@ -213,16 +182,10 @@ class UnoControlTableColumn : public IColumnModel //==================================================================== //-------------------------------------------------------------------- UnoControlTableModel::UnoControlTableModel() - :m_pImpl( new UnoControlTableModel_Impl ), - m_xDataModel(0), - m_xColumnModel(0), - m_bHasColumnHeaders(false), - m_bHasRowHeaders(false), - m_bVScroll(false), - m_bHScroll(false) - { - m_pImpl->bHasColumnHeaders = m_bHasColumnHeaders; - m_pImpl->bHasRowHeaders = m_bHasRowHeaders; + :m_pImpl( new UnoControlTableModel_Impl ) + { + m_pImpl->bHasColumnHeaders = false; + m_pImpl->bHasRowHeaders = false; m_pImpl->pRenderer.reset( new GridTableRenderer( *this ) ); m_pImpl->pInputHandler.reset( new DefaultInputHandler ); } @@ -236,7 +199,7 @@ class UnoControlTableColumn : public IColumnModel //-------------------------------------------------------------------- TableSize UnoControlTableModel::getColumnCount() const { - m_pImpl->aColumns.resize( m_xColumnModel->getColumnCount()); + //m_pImpl->aColumns.resize( m_xColumnModel->getColumnCount()); return (TableSize)m_pImpl->aColumns.size(); } @@ -311,6 +274,11 @@ class UnoControlTableColumn : public IColumnModel return m_pImpl->aColumns[ column ]; } + //-------------------------------------------------------------------- + std::vector& UnoControlTableModel::getColumnModel() + { + return m_pImpl->aColumns; + } //-------------------------------------------------------------------- PColumnModel UnoControlTableModel::getColumnModelByID( ColumnID id ) { @@ -376,7 +344,7 @@ class UnoControlTableColumn : public IColumnModel //-------------------------------------------------------------------- ScrollbarVisibility UnoControlTableModel::getVerticalScrollbarVisibility(int overAllHeight, int actHeight) const { - if(overAllHeight>=actHeight && !m_bVScroll) + if(overAllHeight>=actHeight)// && !m_bVScroll) return ScrollbarShowNever; else return ScrollbarShowAlways; @@ -385,7 +353,7 @@ class UnoControlTableColumn : public IColumnModel //-------------------------------------------------------------------- ScrollbarVisibility UnoControlTableModel::getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const { - if(overAllWidth>=actWidth && !m_bHScroll) + if(overAllWidth>=actWidth)// && !m_bHScroll) return ScrollbarShowNever; else return ScrollbarShowAlways; @@ -393,25 +361,26 @@ class UnoControlTableColumn : public IColumnModel //-------------------------------------------------------------------- void UnoControlTableModel::setCellContent(std::vector > cellContent) { - if(cellContent.empty()) - { - unsigned int i = m_pImpl->aColumns.size(); - std::vector emptyCells; - while(i!=0) - { - cellContent.push_back(emptyCells); - --i; - } - } - std::vector cCC; - for(::std::vector >::iterator iter = cellContent.begin(); iter!= cellContent.end();++iter) - { - cCC = *iter; - m_pImpl->aCellContent.push_back(cCC); - } - } - - std::vector > UnoControlTableModel::getCellContent() + //if(cellContent.empty()) + //{ + // unsigned int i = m_pImpl->aColumns.size(); + // std::vector& emptyCells; + // while(i!=0) + // { + // cellContent.push_back(emptyCells); + // --i; + // } + //} + //std::vector cCC; + //for(::std::vector >::iterator iter = cellContent.begin(); iter!= cellContent.end();++iter) + //{ + // cCC = *iter; + // m_pImpl->aCellContent.push_back(cCC); + //} + m_pImpl->aCellContent.swap( cellContent ); + } + + std::vector >& UnoControlTableModel::getCellContent() { return m_pImpl->aCellContent; } @@ -435,378 +404,378 @@ class UnoControlTableColumn : public IColumnModel } } - std::vector UnoControlTableModel::getRowHeaderName() + std::vector& UnoControlTableModel::getRowHeaderName() { return m_pImpl->aRowHeadersTitle; } -::com::sun::star::uno::Any UnoControlTableModel::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) -{ - ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType, - SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridControl*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridDataListener*, this ), - //SAL_STATIC_CAST( com::sun::star::lang::XEventListener*, this ), - //SAL_STATIC_CAST( com::sun::star::awt::XMouseListener*, this ), - SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) ); - return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); -} - -// ::com::sun::star::lang::XTypeProvider -IMPL_XTYPEPROVIDER_START( UnoControlTableModel ) - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridControl>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener>* ) NULL ), - VCLXWindow::getTypes() -IMPL_XTYPEPROVIDER_END - -::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL UnoControlTableModel::getColumnModel( ) throw (::com::sun::star::uno::RuntimeException) -{ - return NULL; -} -void SAL_CALL UnoControlTableModel::setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException) -{ - (void)model; -} -::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL UnoControlTableModel::getDataModel( ) throw (::com::sun::star::uno::RuntimeException) -{ - return NULL; -} -void SAL_CALL UnoControlTableModel::setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException) -{ - (void)model; -} -sal_Int32 SAL_CALL UnoControlTableModel::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) -{ - TableControl* pTableControl = (TableControl*)GetWindow(); - return pTableControl->GetCurrentRow( Point(x,y) ); -} - -/* -void SAL_CALL UnoControlTableModel::addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException) -{ - VCLXWindow::addMouseListener( listener ); -} - -void SAL_CALL UnoControlTableModel::removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException) -{ - VCLXWindow::removeMouseListener( listener ); -} -*/ -/* -void SAL_CALL UnoControlTableModel::mousePressed( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) -{ - (void)rEvent; -} -void SAL_CALL UnoControlTableModel::mouseReleased( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) -{ - (void)rEvent; -} -void SAL_CALL UnoControlTableModel::mouseEntered( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) -{ - (void) rEvent; -} -void SAL_CALL UnoControlTableModel::mouseExited( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) -{ - (void) rEvent; -} -*/ -void SAL_CALL UnoControlTableModel::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) -{ - (void)listener; -} - -void SAL_CALL UnoControlTableModel::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) -{ - (void) listener; -} - -void UnoControlTableModel::setProperty( const ::rtl::OUString& PropertyName, const Any& aValue) throw(RuntimeException) -{ - ::vos::OGuard aGuard( GetMutex() ); - - TableControl* pTableControl = (TableControl*)GetWindow(); - - switch( GetPropertyId( PropertyName ) ) - { - case BASEPROPERTY_GRID_SELECTIONMODE: - { - SelectionType eSelectionType; - if( aValue >>= eSelectionType ) - { - SelectionMode eSelMode; - switch( eSelectionType ) - { - case SelectionType_SINGLE: eSelMode = SINGLE_SELECTION; break; - case SelectionType_RANGE: eSelMode = RANGE_SELECTION; break; - case SelectionType_MULTI: eSelMode = MULTIPLE_SELECTION; break; - // case SelectionType_NONE: - default: eSelMode = NO_SELECTION; break; - } - if( pTableControl->getSelEngine()->GetSelectionMode() != eSelMode ) - pTableControl->getSelEngine()->SetSelectionMode( eSelMode ); - } - break; - } - case BASEPROPERTY_HSCROLL: - { - sal_Bool bHScroll = true; - if( aValue >>= bHScroll ) - { - m_bHScroll = bHScroll; - } - break; - } - case BASEPROPERTY_VSCROLL: - { - sal_Bool bVScroll = true; - if( aValue >>= bVScroll ) - { - m_bVScroll = bVScroll; - } - break; - } - case BASEPROPERTY_GRID_SHOWROWHEADER: - { - sal_Bool rowHeader = true; - if( aValue >>= rowHeader ) - { - setRowHeaders(rowHeader); - } - break; - } - - case BASEPROPERTY_GRID_SHOWCOLUMNHEADER: - { - sal_Bool colHeader = true; - if( aValue >>= colHeader ) - { - setColumnHeaders(colHeader); - } - break; - } - case BASEPROPERTY_GRID_DATAMODEL: - { - m_xDataModel = Reference< XGridDataModel >( aValue, UNO_QUERY ); - Sequence > cellData = m_xDataModel->getData(); - Sequence rowData(0); - for(int i = 0; i< m_xDataModel->getRowCount();++i) - { - rowData = cellData[i]; - std::vector newRow( - comphelper::sequenceToContainer< std::vector >(rowData)); - if(newRow.size()aColumns.size()) - newRow.resize(m_pImpl->aColumns.size(),rtl::OUString::createFromAscii("")); - m_pImpl->aCellContent.push_back(newRow); - } - Sequence< ::rtl::OUString > rowHeaders = m_xDataModel->getRowHeaders(); - std::vector< rtl::OUString > newRow( - comphelper::sequenceToContainer< std::vector >(rowHeaders)); - m_pImpl->nRowCount = m_xDataModel->getRowCount(); - setRowHeaderName(newRow); - break; - } - case BASEPROPERTY_GRID_COLUMNMODEL: - { - m_xColumnModel = Reference< XGridColumnModel >( aValue, UNO_QUERY ); - Sequence > columns = m_xColumnModel->getColumns(); - std::vector > aNewColumns( - comphelper::sequenceToContainer > >(columns)); - if(!m_pImpl->aColumns.empty()) - m_pImpl->aColumns.clear(); - for ( ::svt::table::ColPos col = 0; col < m_xColumnModel->getColumnCount(); ++col ) - { - UnoControlTableColumn* tableColumn = new UnoControlTableColumn(aNewColumns[col]); - m_pImpl->aColumns.push_back((PColumnModel)tableColumn); - } - break; - } - default: - VCLXWindow::setProperty( PropertyName, aValue ); - break; - } -} - -Any UnoControlTableModel::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException) -{ - ::vos::OGuard aGuard( GetMutex() ); - - const sal_uInt16 nPropId = GetPropertyId( PropertyName ); - TableControl* pTableControl = (TableControl*)GetWindow(); - if(pTableControl) - { - switch(nPropId) - { - case BASEPROPERTY_GRID_SELECTIONMODE: - { - SelectionType eSelectionType; - - SelectionMode eSelMode = pTableControl->getSelEngine()->GetSelectionMode(); - switch( eSelMode ) - { - case SINGLE_SELECTION: eSelectionType = SelectionType_SINGLE; break; - case RANGE_SELECTION: eSelectionType = SelectionType_RANGE; break; - case MULTIPLE_SELECTION:eSelectionType = SelectionType_MULTI; break; -// case NO_SELECTION: - default: eSelectionType = SelectionType_NONE; break; - } - return Any( eSelectionType ); - } - case BASEPROPERTY_GRID_SHOWROWHEADER: - { - return Any ((sal_Bool) pTableControl->GetModel()->hasRowHeaders()); - } - case BASEPROPERTY_GRID_SHOWCOLUMNHEADER: - return Any ((sal_Bool) pTableControl->GetModel()->hasColumnHeaders()); - case BASEPROPERTY_GRID_DATAMODEL: - return Any ( m_xDataModel ); - case BASEPROPERTY_GRID_COLUMNMODEL: - return Any ( m_xColumnModel); - case BASEPROPERTY_HSCROLL: - return Any ( m_bHScroll); - case BASEPROPERTY_VSCROLL: - return Any ( m_bVScroll); - } - } - return VCLXWindow::getProperty( PropertyName ); -} - -void UnoControlTableModel::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - PushPropertyIds( rIds, - BASEPROPERTY_GRID_SHOWROWHEADER, - BASEPROPERTY_GRID_SHOWCOLUMNHEADER, - BASEPROPERTY_GRID_DATAMODEL, - BASEPROPERTY_GRID_COLUMNMODEL, - BASEPROPERTY_GRID_SELECTIONMODE, - 0); - VCLXWindow::ImplGetPropertyIds( rIds, true ); -} -void SAL_CALL UnoControlTableModel::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException) -{ - TableControl* pTable = (TableControl*)GetWindow(); - if ( pTable ) - { - pTable->SetModel(PTableModel(this)); - pTable->Show( bVisible ); - } -} -void SAL_CALL UnoControlTableModel::setFocus() throw(::com::sun::star::uno::RuntimeException) -{ - ::vos::OGuard aGuard( GetMutex() ); - if ( GetWindow()) - GetWindow()->GrabFocus(); -} -void SAL_CALL UnoControlTableModel::rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) -{ - std::vector aNewRow( - comphelper::sequenceToContainer< std::vector >(Event.rowData)); - if(aNewRow.size()aColumns.size()) - aNewRow.resize(m_pImpl->aColumns.size(),rtl::OUString::createFromAscii("")); - m_pImpl->aCellContent.push_back(aNewRow); - if(hasRowHeaders()) - m_pImpl->aRowHeadersTitle.push_back(Event.headerName); - m_pImpl->nRowCount=m_pImpl->aCellContent.size(); - TableControl* pTable = (TableControl*)GetWindow(); - pTable->InvalidateDataWindow(m_pImpl->nRowCount-1, false); - //pTable->GrabFocus(); -} - -void SAL_CALL UnoControlTableModel::rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) -{ - TableControl* pTable = (TableControl*)GetWindow(); - //unsigned int rows =m_pImpl->aCellContent.size()-1; - if(Event.index == -1) - { - if(hasRowHeaders()) - m_pImpl->aRowHeadersTitle.clear(); - m_pImpl->aCellContent.clear(); - } - else - { - pTable->removeSelectedRow(Event.index); - if(m_pImpl->aCellContent.size()>1) - { - if(hasRowHeaders()) - m_pImpl->aRowHeadersTitle.erase(m_pImpl->aRowHeadersTitle.begin()+Event.index); - m_pImpl->aCellContent.erase(m_pImpl->aCellContent.begin()+Event.index); - - } - else - { - if(hasRowHeaders()) - m_pImpl->aRowHeadersTitle.clear(); - m_pImpl->aCellContent.clear(); - //m_pImpl->nRowCount=0; - } - } - //pTable->InvalidateDataWindow(Event.index, true); - setRowCount(m_pImpl->aCellContent.size()); - pTable->InvalidateDataWindow(Event.index, true); - //pTable->Invalidate(); -} - -void SAL_CALL UnoControlTableModel::dataChanged(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) -{ - (void) Event; -} - - void SAL_CALL UnoControlTableModel::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) - { - VCLXWindow::disposing( Source ); - } - -::sal_Int32 SAL_CALL UnoControlTableModel::getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException) -{ - return 0; -} - -::sal_Int32 SAL_CALL UnoControlTableModel::getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException) -{ - return 0; -} - -void SAL_CALL UnoControlTableModel::insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException) -{ - (void)length; - (void)start; -} - -void SAL_CALL UnoControlTableModel::removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException) -{ - (void)end; - (void)start; -} - -::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL UnoControlTableModel::getSelection() throw (::com::sun::star::uno::RuntimeException) -{ - TableControl* pTable = (TableControl*)GetWindow(); - std::vector selectedRows = pTable->getSelectedRows(); - Sequence selectedRowsToSequence(comphelper::containerToSequence(selectedRows)); - return selectedRowsToSequence; -} - -::sal_Bool SAL_CALL UnoControlTableModel::isCellEditable() throw (::com::sun::star::uno::RuntimeException) -{ - return sal_False; -} - -::sal_Bool SAL_CALL UnoControlTableModel::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException) -{ - return sal_False; -} - -::sal_Bool SAL_CALL UnoControlTableModel::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException) -{ - (void)index; - return sal_False; -} - -void SAL_CALL UnoControlTableModel::selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) -{ - (void)y; -} - -void SAL_CALL UnoControlTableModel::selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException) -{ - (void)x; -} +//::com::sun::star::uno::Any UnoControlTableModel::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) +//{ +// ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType, +// SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridControl*, this ), +// SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridDataListener*, this ), +// //SAL_STATIC_CAST( com::sun::star::lang::XEventListener*, this ), +// //SAL_STATIC_CAST( com::sun::star::awt::XMouseListener*, this ), +// SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) ); +// return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); +//} +// +//// ::com::sun::star::lang::XTypeProvider +//IMPL_XTYPEPROVIDER_START( UnoControlTableModel ) +// getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridControl>* ) NULL ), +// getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel>* ) NULL ), +// getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener>* ) NULL ), +// VCLXWindow::getTypes() +//IMPL_XTYPEPROVIDER_END +// +//::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL UnoControlTableModel::getColumnModel( ) throw (::com::sun::star::uno::RuntimeException) +//{ +// return NULL; +//} +//void SAL_CALL UnoControlTableModel::setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException) +//{ +// (void)model; +//} +//::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL UnoControlTableModel::getDataModel( ) throw (::com::sun::star::uno::RuntimeException) +//{ +// return NULL; +//} +//void SAL_CALL UnoControlTableModel::setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException) +//{ +// (void)model; +//} +//sal_Int32 SAL_CALL UnoControlTableModel::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) +//{ +// TableControl* pTableControl = (TableControl*)GetWindow(); +// return pTableControl->GetCurrentRow( Point(x,y) ); +//} +// +///* +//void SAL_CALL UnoControlTableModel::addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException) +//{ +// VCLXWindow::addMouseListener( listener ); +//} +// +//void SAL_CALL UnoControlTableModel::removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException) +//{ +// VCLXWindow::removeMouseListener( listener ); +//} +//*/ +///* +//void SAL_CALL UnoControlTableModel::mousePressed( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) +//{ +// (void)rEvent; +//} +//void SAL_CALL UnoControlTableModel::mouseReleased( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) +//{ +// (void)rEvent; +//} +//void SAL_CALL UnoControlTableModel::mouseEntered( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) +//{ +// (void) rEvent; +//} +//void SAL_CALL UnoControlTableModel::mouseExited( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) +//{ +// (void) rEvent; +//} +//*/ +//void SAL_CALL UnoControlTableModel::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) +//{ +// (void)listener; +//} +// +//void SAL_CALL UnoControlTableModel::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) +//{ +// (void) listener; +//} +// +//void UnoControlTableModel::setProperty( const ::rtl::OUString& PropertyName, const Any& aValue) throw(RuntimeException) +//{ +// ::vos::OGuard aGuard( GetMutex() ); +// +// TableControl* pTableControl = (TableControl*)GetWindow(); +// +// switch( GetPropertyId( PropertyName ) ) +// { +// case BASEPROPERTY_GRID_SELECTIONMODE: +// { +// SelectionType eSelectionType; +// if( aValue >>= eSelectionType ) +// { +// SelectionMode eSelMode; +// switch( eSelectionType ) +// { +// case SelectionType_SINGLE: eSelMode = SINGLE_SELECTION; break; +// case SelectionType_RANGE: eSelMode = RANGE_SELECTION; break; +// case SelectionType_MULTI: eSelMode = MULTIPLE_SELECTION; break; +// // case SelectionType_NONE: +// default: eSelMode = NO_SELECTION; break; +// } +// if( pTableControl->getSelEngine()->GetSelectionMode() != eSelMode ) +// pTableControl->getSelEngine()->SetSelectionMode( eSelMode ); +// } +// break; +// } +// case BASEPROPERTY_HSCROLL: +// { +// sal_Bool bHScroll = true; +// if( aValue >>= bHScroll ) +// { +// m_bHScroll = bHScroll; +// } +// break; +// } +// case BASEPROPERTY_VSCROLL: +// { +// sal_Bool bVScroll = true; +// if( aValue >>= bVScroll ) +// { +// m_bVScroll = bVScroll; +// } +// break; +// } +// case BASEPROPERTY_GRID_SHOWROWHEADER: +// { +// sal_Bool rowHeader = true; +// if( aValue >>= rowHeader ) +// { +// setRowHeaders(rowHeader); +// } +// break; +// } +// +// case BASEPROPERTY_GRID_SHOWCOLUMNHEADER: +// { +// sal_Bool colHeader = true; +// if( aValue >>= colHeader ) +// { +// setColumnHeaders(colHeader); +// } +// break; +// } +// case BASEPROPERTY_GRID_DATAMODEL: +// { +// m_xDataModel = Reference< XGridDataModel >( aValue, UNO_QUERY ); +// Sequence > cellData = m_xDataModel->getData(); +// Sequence rowData(0); +// for(int i = 0; i< m_xDataModel->getRowCount();++i) +// { +// rowData = cellData[i]; +// std::vector newRow( +// comphelper::sequenceToContainer< std::vector >(rowData)); +// if(newRow.size()aColumns.size()) +// newRow.resize(m_pImpl->aColumns.size(),rtl::OUString::createFromAscii("")); +// m_pImpl->aCellContent.push_back(newRow); +// } +// Sequence< ::rtl::OUString > rowHeaders = m_xDataModel->getRowHeaders(); +// std::vector< rtl::OUString > newRow( +// comphelper::sequenceToContainer< std::vector >(rowHeaders)); +// m_pImpl->nRowCount = m_xDataModel->getRowCount(); +// setRowHeaderName(newRow); +// break; +// } +// case BASEPROPERTY_GRID_COLUMNMODEL: +// { +// m_xColumnModel = Reference< XGridColumnModel >( aValue, UNO_QUERY ); +// Sequence > columns = m_xColumnModel->getColumns(); +// std::vector > aNewColumns( +// comphelper::sequenceToContainer > >(columns)); +// if(!m_pImpl->aColumns.empty()) +// m_pImpl->aColumns.clear(); +// for ( ::svt::table::ColPos col = 0; col < m_xColumnModel->getColumnCount(); ++col ) +// { +// UnoControlTableColumn* tableColumn = new UnoControlTableColumn(aNewColumns[col]); +// m_pImpl->aColumns.push_back((PColumnModel)tableColumn); +// } +// break; +// } +// default: +// VCLXWindow::setProperty( PropertyName, aValue ); +// break; +// } +//} +// +//Any UnoControlTableModel::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException) +//{ +// ::vos::OGuard aGuard( GetMutex() ); +// +// const sal_uInt16 nPropId = GetPropertyId( PropertyName ); +// TableControl* pTableControl = (TableControl*)GetWindow(); +// if(pTableControl) +// { +// switch(nPropId) +// { +// case BASEPROPERTY_GRID_SELECTIONMODE: +// { +// SelectionType eSelectionType; +// +// SelectionMode eSelMode = pTableControl->getSelEngine()->GetSelectionMode(); +// switch( eSelMode ) +// { +// case SINGLE_SELECTION: eSelectionType = SelectionType_SINGLE; break; +// case RANGE_SELECTION: eSelectionType = SelectionType_RANGE; break; +// case MULTIPLE_SELECTION:eSelectionType = SelectionType_MULTI; break; +//// case NO_SELECTION: +// default: eSelectionType = SelectionType_NONE; break; +// } +// return Any( eSelectionType ); +// } +// case BASEPROPERTY_GRID_SHOWROWHEADER: +// { +// return Any ((sal_Bool) pTableControl->GetModel()->hasRowHeaders()); +// } +// case BASEPROPERTY_GRID_SHOWCOLUMNHEADER: +// return Any ((sal_Bool) pTableControl->GetModel()->hasColumnHeaders()); +// case BASEPROPERTY_GRID_DATAMODEL: +// return Any ( m_xDataModel ); +// case BASEPROPERTY_GRID_COLUMNMODEL: +// return Any ( m_xColumnModel); +// case BASEPROPERTY_HSCROLL: +// return Any ( m_bHScroll); +// case BASEPROPERTY_VSCROLL: +// return Any ( m_bVScroll); +// } +// } +// return VCLXWindow::getProperty( PropertyName ); +//} +// +//void UnoControlTableModel::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) +//{ +// PushPropertyIds( rIds, +// BASEPROPERTY_GRID_SHOWROWHEADER, +// BASEPROPERTY_GRID_SHOWCOLUMNHEADER, +// BASEPROPERTY_GRID_DATAMODEL, +// BASEPROPERTY_GRID_COLUMNMODEL, +// BASEPROPERTY_GRID_SELECTIONMODE, +// 0); +// VCLXWindow::ImplGetPropertyIds( rIds, true ); +//} +//void SAL_CALL UnoControlTableModel::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException) +//{ +// TableControl* pTable = (TableControl*)GetWindow(); +// if ( pTable ) +// { +// pTable->SetModel(PTableModel(this)); +// pTable->Show( bVisible ); +// } +//} +//void SAL_CALL UnoControlTableModel::setFocus() throw(::com::sun::star::uno::RuntimeException) +//{ +// ::vos::OGuard aGuard( GetMutex() ); +// if ( GetWindow()) +// GetWindow()->GrabFocus(); +//} +//void SAL_CALL UnoControlTableModel::rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) +//{ +// std::vector aNewRow( +// comphelper::sequenceToContainer< std::vector >(Event.rowData)); +// if(aNewRow.size()aColumns.size()) +// aNewRow.resize(m_pImpl->aColumns.size(),rtl::OUString::createFromAscii("")); +// m_pImpl->aCellContent.push_back(aNewRow); +// if(hasRowHeaders()) +// m_pImpl->aRowHeadersTitle.push_back(Event.headerName); +// m_pImpl->nRowCount=m_pImpl->aCellContent.size(); +// TableControl* pTable = (TableControl*)GetWindow(); +// pTable->InvalidateDataWindow(m_pImpl->nRowCount-1, false); +// //pTable->GrabFocus(); +//} +// +//void SAL_CALL UnoControlTableModel::rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) +//{ +// TableControl* pTable = (TableControl*)GetWindow(); +// //unsigned int rows =m_pImpl->aCellContent.size()-1; +// if(Event.index == -1) +// { +// if(hasRowHeaders()) +// m_pImpl->aRowHeadersTitle.clear(); +// m_pImpl->aCellContent.clear(); +// } +// else +// { +// pTable->removeSelectedRow(Event.index); +// if(m_pImpl->aCellContent.size()>1) +// { +// if(hasRowHeaders()) +// m_pImpl->aRowHeadersTitle.erase(m_pImpl->aRowHeadersTitle.begin()+Event.index); +// m_pImpl->aCellContent.erase(m_pImpl->aCellContent.begin()+Event.index); +// +// } +// else +// { +// if(hasRowHeaders()) +// m_pImpl->aRowHeadersTitle.clear(); +// m_pImpl->aCellContent.clear(); +// //m_pImpl->nRowCount=0; +// } +// } +// //pTable->InvalidateDataWindow(Event.index, true); +// setRowCount(m_pImpl->aCellContent.size()); +// pTable->InvalidateDataWindow(Event.index, true); +// //pTable->Invalidate(); +//} +// +//void SAL_CALL UnoControlTableModel::dataChanged(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) +//{ +// (void) Event; +//} +// +// void SAL_CALL UnoControlTableModel::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) +// { +// VCLXWindow::disposing( Source ); +// } +// +//::sal_Int32 SAL_CALL UnoControlTableModel::getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException) +//{ +// return 0; +//} +// +//::sal_Int32 SAL_CALL UnoControlTableModel::getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException) +//{ +// return 0; +//} +// +//void SAL_CALL UnoControlTableModel::insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException) +//{ +// (void)length; +// (void)start; +//} +// +//void SAL_CALL UnoControlTableModel::removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException) +//{ +// (void)end; +// (void)start; +//} +// +//::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL UnoControlTableModel::getSelection() throw (::com::sun::star::uno::RuntimeException) +//{ +// TableControl* pTable = (TableControl*)GetWindow(); +// std::vector& selectedRows = pTable->GetSelectedRows(); +// Sequence selectedRowsToSequence(comphelper::containerToSequence(selectedRows)); +// return selectedRowsToSequence; +//} +// +//::sal_Bool SAL_CALL UnoControlTableModel::isCellEditable() throw (::com::sun::star::uno::RuntimeException) +//{ +// return sal_False; +//} +// +//::sal_Bool SAL_CALL UnoControlTableModel::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException) +//{ +// return sal_False; +//} +// +//::sal_Bool SAL_CALL UnoControlTableModel::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException) +//{ +// (void)index; +// return sal_False; +//} +// +//void SAL_CALL UnoControlTableModel::selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) +//{ +// (void)y; +//} +// +//void SAL_CALL UnoControlTableModel::selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException) +//{ +// (void)x; +//} diff --git a/svtools/source/uno/unocontroltablemodel.hxx b/svtools/source/uno/unocontroltablemodel.hxx index 5da9cc871756..6b431cc8fb1f 100644 --- a/svtools/source/uno/unocontroltablemodel.hxx +++ b/svtools/source/uno/unocontroltablemodel.hxx @@ -43,25 +43,48 @@ #include #include #include +#include //#include using namespace ::svt::table; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::awt::grid; + +class UnoControlTableColumn : public IColumnModel + { + private: + ColumnID m_nID; + String m_sName; + bool m_bIsResizable; + TableMetrics m_nWidth; + TableMetrics m_nMinWidth; + TableMetrics m_nMaxWidth; + + public: + UnoControlTableColumn(Reference); + + // IColumnModel overridables + virtual ColumnID getID() const; + virtual bool setID( const ColumnID _nID ); + virtual String getName() const; + virtual void setName( const String& _rName ); + virtual bool isResizable() const; + virtual void setResizable( bool _bResizable ); + virtual TableMetrics getWidth() const; + virtual void setWidth( TableMetrics _nWidth ); + virtual TableMetrics getMinWidth() const; + virtual void setMinWidth( TableMetrics _nMinWidth ); + virtual TableMetrics getMaxWidth() const; + virtual void setMaxWidth( TableMetrics _nMaxWidth ); + }; struct UnoControlTableModel_Impl; - class UnoControlTableModel : public ITableModel, public ::cppu::ImplInheritanceHelper2< VCLXWindow, ::com::sun::star::awt::grid::XGridControl, - ::com::sun::star::awt::grid::XGridDataListener> + class UnoControlTableModel : public ITableModel { private: UnoControlTableModel_Impl* m_pImpl; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >m_xDataModel; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >m_xColumnModel; - bool m_bHasColumnHeaders; - bool m_bHasRowHeaders; - bool m_bVScroll; - bool m_bHScroll; - //MouseListenerMultiplexer m_aMouseListeners; public: UnoControlTableModel(); @@ -103,6 +126,7 @@ using namespace ::svt::table; virtual void addTableModelListener( const PTableModelListener& listener ); virtual void removeTableModelListener( const PTableModelListener& listener ); virtual PColumnModel getColumnModel( ColPos column ); + virtual std::vector& getColumnModel(); virtual PColumnModel getColumnModelByID( ColumnID id ); virtual PTableRenderer getRenderer() const; virtual PTableInputHandler getInputHandler() const; @@ -112,59 +136,59 @@ using namespace ::svt::table; virtual ScrollbarVisibility getVerticalScrollbarVisibility(int overAllHeight, int actHeight) const; virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const; virtual void setCellContent(std::vector > cellContent); - virtual std::vector > getCellContent(); + virtual std::vector >& getCellContent(); virtual void setRowHeaderName(std::vector cellColumnContent); - virtual std::vector getRowHeaderName(); - - //XGridDataListener overridables - virtual void SAL_CALL rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL dataChanged(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); - - ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL acquire() throw() { VCLXWindow::acquire(); } - void SAL_CALL release() throw() { VCLXWindow::release(); } - - // ::com::sun::star::lang::XTypeProvider - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); - - //::com::sun::star::awt::grid::XGridControl - ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL getColumnModel( ) throw (::com::sun::star::uno::RuntimeException); - void SAL_CALL setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL getDataModel( ) throw (::com::sun::star::uno::RuntimeException); - void SAL_CALL setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException); - - virtual ::sal_Int32 SAL_CALL getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelection() throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL isCellEditable() throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException); - - //void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException); - //void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException); - //::com::sun::star::awt::XMouseListener - /* - virtual void SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL mouseEntered( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL mouseExited( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); - */ - - void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); - static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds ); - void SAL_CALL setVisible(sal_Bool bVisible) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL setFocus() throw(::com::sun::star::uno::RuntimeException); + virtual std::vector& getRowHeaderName(); + + // //XGridDataListener overridables + // virtual void SAL_CALL rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event) throw (::com::sun::star::uno::RuntimeException); + // virtual void SAL_CALL rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException); + // virtual void SAL_CALL dataChanged(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException); + // virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); + + //::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //void SAL_CALL acquire() throw() { VCLXWindow::acquire(); } + //void SAL_CALL release() throw() { VCLXWindow::release(); } + + // // ::com::sun::star::lang::XTypeProvider + //::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + //::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + + ////::com::sun::star::awt::grid::XGridControl + //::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL getColumnModel( ) throw (::com::sun::star::uno::RuntimeException); + // void SAL_CALL setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException); + // ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL getDataModel( ) throw (::com::sun::star::uno::RuntimeException); + // void SAL_CALL setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException); + + //virtual ::sal_Int32 SAL_CALL getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException); + //virtual ::sal_Int32 SAL_CALL getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException); + //virtual void SAL_CALL insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException); + //virtual void SAL_CALL removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException); + //virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelection() throw (::com::sun::star::uno::RuntimeException); + //virtual ::sal_Bool SAL_CALL isCellEditable() throw (::com::sun::star::uno::RuntimeException); + //virtual ::sal_Bool SAL_CALL isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException); + //virtual ::sal_Bool SAL_CALL isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException); + //virtual void SAL_CALL selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException); + //virtual void SAL_CALL selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException); + //virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException); + //virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException); + //virtual ::sal_Int32 SAL_CALL getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException); + + ////void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException); + ////void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException); + ////::com::sun::star::awt::XMouseListener + ///* + //virtual void SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + //virtual void SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + //virtual void SAL_CALL mouseEntered( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + //virtual void SAL_CALL mouseExited( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + //*/ + + // void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); + // ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); + //static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds ); + //void SAL_CALL setVisible(sal_Bool bVisible) throw(::com::sun::star::uno::RuntimeException); + //void SAL_CALL setFocus() throw(::com::sun::star::uno::RuntimeException); }; inline void UnoControlTableModel::SetColumnWidth( ColPos _nColumn, TableMetrics _nWidth100thMM ) diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx index 54cc448ff89e..45c93f5849c5 100644 --- a/svtools/source/uno/unoiface.cxx +++ b/svtools/source/uno/unoiface.cxx @@ -55,7 +55,7 @@ #include #include "treecontrolpeer.hxx" //#include "vclxgridcontrol.hxx" -#include "unocontroltablemodel.hxx" +#include "svtxgridcontrol.hxx" #include namespace @@ -172,10 +172,12 @@ SAL_DLLPUBLIC_EXPORT Window* CreateWindow( VCLXWindow** ppNewComp, const ::com:: { if ( pParent ) { - ::svt::table::TableControl* m_pTable = new ::svt::table::TableControl(pParent, nWinBits); - UnoControlTableModel* pModel = new UnoControlTableModel(); - *ppNewComp = pModel; - pWindow = m_pTable; + //::svt::table::TableControl* m_pTable = new ::svt::table::TableControl(pParent, nWinBits); + //UnoControlTableModel* pModel = new UnoControlTableModel(); + //*ppNewComp = pModel; + //pWindow = m_pTable; + pWindow = new ::svt::table::TableControl(pParent, nWinBits); + *ppNewComp = new SVTXGridControl; } else { -- cgit From 9b78615ffc2dcdfe8140afa82448209f96ce66f4 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 30 Oct 2009 14:17:50 +0100 Subject: vcl107: #i104701# use builtin symbol font with correct encoding --- vcl/source/gdi/base14.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/source/gdi/base14.cxx b/vcl/source/gdi/base14.cxx index 17e616d196b4..56d1c3ff5eba 100644 --- a/vcl/source/gdi/base14.cxx +++ b/vcl/source/gdi/base14.cxx @@ -601,7 +601,7 @@ const PDFWriterImpl::BuiltinFont PDFWriterImpl::m_aBuiltinFonts[ 14 ] = { "Symbol", // PSName 1010, -293, // ascend, descend FAMILY_DONTKNOW, // family style - RTL_TEXTENCODING_SYMBOL, // charset + RTL_TEXTENCODING_ADOBE_SYMBOL, // charset PITCH_VARIABLE, // pitch WIDTH_NORMAL, // width type WEIGHT_NORMAL, // weight type -- cgit From dee6705fb88196368bc72b1b8a95f938541e496e Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 30 Oct 2009 17:11:35 +0100 Subject: vcl107: #i89505# use Close asynchronously in Key handler --- vcl/inc/vcl/dialog.hxx | 1 + vcl/source/window/dialog.cxx | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/vcl/inc/vcl/dialog.hxx b/vcl/inc/vcl/dialog.hxx index f34db3a2a5db..c5f032dfff82 100644 --- a/vcl/inc/vcl/dialog.hxx +++ b/vcl/inc/vcl/dialog.hxx @@ -65,6 +65,7 @@ private: SAL_DLLPRIVATE Dialog (const Dialog &); SAL_DLLPRIVATE Dialog & operator= (const Dialog &); + DECL_DLLPRIVATE_LINK( ImplAsyncCloseHdl, void* ); protected: using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 1fc2b9be703a..997e63d8b22e 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -453,6 +453,14 @@ Dialog::~Dialog() // ----------------------------------------------------------------------- +IMPL_LINK( Dialog, ImplAsyncCloseHdl, void*, EMPTYARG ) +{ + Close(); + return 0; +} + +// ----------------------------------------------------------------------- + long Dialog::Notify( NotifyEvent& rNEvt ) { // Zuerst Basisklasse rufen wegen TabSteuerung @@ -468,7 +476,11 @@ long Dialog::Notify( NotifyEvent& rNEvt ) if ( (nKeyCode == KEY_ESCAPE) && ((GetStyle() & WB_CLOSEABLE) || ImplGetCancelButton( this ) || ImplGetOKButton( this )) ) { - Close(); + // #i89505# for the benefit of slightly mentally challenged implementations + // like e.g. SfxModelessDialog which destroy themselves inside Close() + // post this Close asynchronous so we can leave our key handler before + // we get destroyed + PostUserEvent( LINK( this, Dialog, ImplAsyncCloseHdl ), this ); return TRUE; } } -- cgit From 700477601664fd243f9151abf8754dfe9697bb23 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Sat, 31 Oct 2009 00:36:06 +0100 Subject: #i106421#: move svx/source/cui to cui --- svl/inc/svl/solar.hrc | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/svl/inc/svl/solar.hrc b/svl/inc/svl/solar.hrc index 348422ef6477..73e17bfbc2f6 100644 --- a/svl/inc/svl/solar.hrc +++ b/svl/inc/svl/solar.hrc @@ -194,17 +194,11 @@ #define HID_EXTENSIONS_START (HID_LIB_START+1000) #define HID_EXTENSIONS_END (HID_LIB_START+1099) -#define HID_SO2_START (HID_LIB_START+1100) -#define HID_SO2_END (HID_LIB_START+1149) +#define HID_CUI_START (HID_LIB_START+1100) +#define HID_CUI_END (HID_LIB_START+1699) -#define HID_MAIL_START (HID_LIB_START+1150) -#define HID_MAIL_END (HID_LIB_START+1199) - -#define HID_INET_START (HID_LIB_START+1200) -#define HID_INET_END (HID_LIB_START+1259) - -#define HID_OFA_START (HID_LIB_START+1260) -#define HID_OFA_END (HID_LIB_START+1399) +#define HID_OFA_START (HID_LIB_START+1760) +#define HID_OFA_END (HID_LIB_START+1999) #define HID_HELP_START (HID_LIB_START+2000) #define HID_HELP_END (HID_LIB_START+2050) @@ -278,8 +272,8 @@ #define HID_OBJ_START (HID_START+30000) #define HID_OBJ_END (HID_START+32767) -#define HID_SIM_START (HID_OBJ_START+ 0) -#define HID_SIM_END (HID_OBJ_START+ 239) +#define HID_CUI3_START (HID_OBJ_START+ 0) +#define HID_CUI3_END (HID_OBJ_START+ 239) #define HID_AVMEDIA_START (HID_OBJ_START+ 240) #define HID_AVMEDIA_END (HID_OBJ_START+ 255) -- cgit From fd6a0c28038e964215e2a1318cd4640942b6be17 Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Mon, 2 Nov 2009 09:15:45 +0000 Subject: fixes for i106470 --- svtools/inc/svtools/table/tablecontrol.hxx | 8 ++++---- svtools/source/misc/svtaccessiblefactory.cxx | 9 +++++++++ svtools/source/uno/unoiface.cxx | 5 ----- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index 1315adf0c371..e3edd0b681ae 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -59,7 +59,7 @@ namespace svt { namespace table The control supports the concept of a current (or active cell). - The control supports supports accessibility, this is encapsulated in IAccessibleTable + The control supports accessibility, this is encapsulated in IAccessibleTable // TODO: scrolling? */ @@ -203,9 +203,9 @@ namespace svt { namespace table virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const; virtual ::rtl::OUString GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const; virtual sal_Bool HasRowHeader(); - virtual sal_Bool HasColHeader(); - virtual sal_Bool isAccessibleAlive( ) const; - virtual void commitGridControlEvent( sal_Int16 _nEventId, const com::sun::star::uno::Any& _rNewValue, const com::sun::star::uno::Any& _rOldValue ); + virtual sal_Bool HasColHeader(); + virtual sal_Bool isAccessibleAlive( ) const; + virtual void commitGridControlEvent( sal_Int16 _nEventId, const com::sun::star::uno::Any& _rNewValue, const com::sun::star::uno::Any& _rOldValue ); protected: diff --git a/svtools/source/misc/svtaccessiblefactory.cxx b/svtools/source/misc/svtaccessiblefactory.cxx index b2d57c250d32..a4b3cc1e8ecc 100644 --- a/svtools/source/misc/svtaccessiblefactory.cxx +++ b/svtools/source/misc/svtaccessiblefactory.cxx @@ -107,6 +107,15 @@ namespace svt return NULL; } + virtual table::IAccessibleTableControl* + createAccessibleTableControl( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*_rxParent*/, + table::IAccessibleTable& /*_rTable*/ + ) const + { + return NULL; + } + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > createAccessibleIconChoiceCtrl( SvtIconChoiceCtrl& /*_rIconCtrl*/, diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx index 45c93f5849c5..a4e003b69682 100644 --- a/svtools/source/uno/unoiface.cxx +++ b/svtools/source/uno/unoiface.cxx @@ -54,7 +54,6 @@ #include #include "treecontrolpeer.hxx" -//#include "vclxgridcontrol.hxx" #include "svtxgridcontrol.hxx" #include @@ -172,10 +171,6 @@ SAL_DLLPUBLIC_EXPORT Window* CreateWindow( VCLXWindow** ppNewComp, const ::com:: { if ( pParent ) { - //::svt::table::TableControl* m_pTable = new ::svt::table::TableControl(pParent, nWinBits); - //UnoControlTableModel* pModel = new UnoControlTableModel(); - //*ppNewComp = pModel; - //pWindow = m_pTable; pWindow = new ::svt::table::TableControl(pParent, nWinBits); *ppNewComp = new SVTXGridControl; } -- cgit From ae8202d5199620bb615bccb073441bd2b333dc05 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 2 Nov 2009 10:35:19 +0100 Subject: vcl107: #i106450# fix aliasing warning (thanks cmc) --- vcl/source/gdi/outdev.cxx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx index 5b543258cb0b..6298ff51a16a 100644 --- a/vcl/source/gdi/outdev.cxx +++ b/vcl/source/gdi/outdev.cxx @@ -1128,11 +1128,16 @@ namespace { inline int iround( float x ) { - sal_Int32 a = *reinterpret_cast(&x); - sal_Int32 exponent = (127 + 31) - ((a >> 23) & 0xFF); - sal_Int32 r = ((sal_Int32(a) << 8) | (1U << 31)) >> exponent; + union + { + float f; + sal_Int32 i; + }; + f = x; + sal_Int32 exponent = (127 + 31) - ((i >> 23) & 0xFF); + sal_Int32 r = ((sal_Int32(i) << 8) | (1U << 31)) >> exponent; r &= ((exponent - 32) >> 31); - sal_Int32 sign = a >> 31; + sal_Int32 sign = i >> 31; return r = (r ^ sign) - sign; } -- cgit From c51a2e370e95f2f5af8fcdd0da01aa1df46076cd Mon Sep 17 00:00:00 2001 From: Herbert Duerr Date: Mon, 2 Nov 2009 10:03:31 +0000 Subject: #i105769# start integrating my intersection-solver --- vcl/unx/source/gdi/salgdi.cxx | 243 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 240 insertions(+), 3 deletions(-) diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index 34f2dfd4b935..df97b93ce539 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -1096,6 +1096,7 @@ bool IsLeftOf( const XLineFixed& rA, const XLineFixed& rB ) const XFixed aXDiff = rU.p2.x - rU.p1.x; const XFixed aYDiff = rU.p2.y - rU.p1.y; + // compare upper point of lower segment with line through upper segment if( (rU.p1.y != rL.p1.y) || (rU.p1.x != rL.p1.x) ) { const sal_Int64 n1 = (sal_Int64)aXDiff * (rL.p1.y - rU.p1.y); @@ -1104,6 +1105,7 @@ bool IsLeftOf( const XLineFixed& rA, const XLineFixed& rB ) return ((n1 < n2) == bAbove); } + // compare lower point of lower segment with line through upper segment if( (rU.p2.y != rL.p2.y) || (rU.p2.x != rL.p2.x) ) { const sal_Int64 n3 = (sal_Int64)aXDiff * (rL.p2.y - rU.p1.y); @@ -1145,7 +1147,7 @@ class HTQueue { public: void reserve( size_t n ) { c.reserve( n ); } - int capacity() { return c.capacity(); } + int capacity() const { return c.capacity(); } }; typedef std::vector TrapezoidVector; @@ -1237,6 +1239,15 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly if( !nClippedPolyCount ) continue; +#ifndef DISABLE_SOLVECROSSOVER_WORKAROUND + aGoodPolyPoly = aClippedPolygon; + for( int nClippedPolyIdx = 0; nClippedPolyIdx < nClippedPolyCount; ++nClippedPolyIdx ) + { + const ::basegfx::B2DPolygon aSolvedPolygon = aClippedPolygon.getB2DPolygon( nClippedPolyIdx ); + const int nPointCount = aSolvedPolygon.count(); + nHTQueueReserve += aSolvedPolygon.areControlPointsUsed() ? 8 * nPointCount : nPointCount; + } +#else // DISABLE_SOLVECROSSOVER_WORKAROUND // #i103259# polypoly.solveCrossover() fails to remove self-intersections // but polygon.solveCrossover() works. Use it to build the intersection-free polypolygon // TODO: if the self-intersection prevention is too expensive make the trap-algorithm tolerate intersections @@ -1255,6 +1266,7 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly nHTQueueReserve += aSolvedPolygon.areControlPointsUsed() ? 8 * nPointCount : nPointCount; } } +#endif // DISABLE_SOLVECROSSOVER_WORKAROUND } // #i100922# try to prevent priority-queue reallocations by reservering enough nHTQueueReserve = ((4*nHTQueueReserve) | 0x1FFF) + 1; @@ -1334,6 +1346,18 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly if( aHTQueue.empty() ) return TRUE; +#ifndef DISABLE_SOLVECROSSOVER_WORKAROUND + // TODO: remove when solveCrossOvers gets fast enough so its use can be enabled above + // FAQ: why should intersecting-segment segments be handled before adaptiveSubdivide()? + // Answer: because it is conceptually much faster + // Example: consider two intersecting circles with a diameter of 1000 pixels + // before subdivision: eight bezier segments + // after subdivision: a thousand line segments + // since even the best generic intersection finders have a complexity of O((n+k)*log(n+k)) it becomes + // obvious that testing while the segment count is still low is a much better approach. + // find intersecting halftraps and split them up +#endif // WORKAROUND_SOLVECROSSOVER_PERF + // then convert the HalfTrapezoids into full Trapezoids TrapezoidVector aTrapVector; aTrapVector.reserve( aHTQueue.size() * 2 ); // just a guess @@ -1354,7 +1378,7 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly aTrapezoid.bottom = rLeft.maLine.p2.y; aTrapezoid.left = rLeft.maLine; -#if 0 +#if 0 // TODO: is it worth it to enable this? // ignore empty trapezoids if( aTrapezoid.bottom <= aTrapezoid.top ) continue; @@ -1378,7 +1402,7 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly bool bSplit = false; for(;;) { - // check if the new trapezoid overlaps with an old trapezoid + // check if the new trapezoid overlaps with another active trapezoid ActiveTrapSet::iterator aActiveTrapsIt = aActiveTraps.upper_bound( aTrapVector.size()-1 ); if( aActiveTrapsIt == aActiveTraps.begin() ) @@ -1568,3 +1592,216 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const : // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +#ifndef DISABLE_SOLVECROSSOVER_WORKAROUND + +class LineSeg +{ +public: + double mfX1, mfY1; + double mfX2, mfY2; + int mnUniqueId; + + double getXMin( void) const { return (mfX1 + // (r1.p1x - r2.p1x) == s * (r1.p1x - r1.p2x) + t * (r2.p2x - r2.p1x) + // (r1.p1y - r2.p1y) == s * (r1.p1y - r1.p2y) + t * (r2.p2y - r2.p1y) + // check if lines are identical or parallel => not intersecting + const double fDet = (r1.mfX1-r1.mfX2)*(r2.mfY2-r2.mfY1) - (r2.mfX2-r2.mfX1)*(r1.mfY1-r1.mfY2); + static const double fEps = 1e-8; + if( fabs(fDet) < fEps) + return false; + // check if intersection on first segment + const double fS1 = (r2.mfY2 - r2.mfY1) * (r1.mfX1 - r2.mfX1); + const double fS2 = (r2.mfX2 - r2.mfX1) * (r2.mfY1 - r1.mfY1); + const double fS = (fS1 + fS2) / fDet; + if( (fS <= +fEps) || (fS >= 1-fEps)) + return false; + pCutParams[0] = fS; + // check if intersection on second segment + const double fT1 = (r1.mfY2 - r1.mfY1) * (r1.mfX1 - r2.mfX1); + const double fT2 = (r1.mfX2 - r1.mfX1) * (r2.mfY1 - r1.mfY1); + const double fT = (fT1 + fT2) / fDet; + if( (fT <= +fEps) || (fT >= 1-fEps)) + return false; + pCutParams[1] = fT; +#if 0 + rCutPt.mfX = r1.mfX1 + fS * (r1.mfX2 - r1.mfX1); + rCutPt.mfY = r1.mfY1 + fS * (r1.mfY2 - r1.mfY1); +#endif + return true; +} + +typedef std::vector LSVector; +typedef std::priority_queue< LineSeg, LSVector, LSYMinCmp> LSYMinQueueBase; +typedef std::priority_queue< LineSeg, LSVector, LSYMaxCmp> LSYMaxQueueBase; +typedef std::multiset< LineSeg, LSXMinCmp> LSXMinSet; +typedef std::set DoubleSet; + +class LSYMinQueue : public LSYMinQueueBase +{ +public: + void reserve( size_t n) { c.reserve(n);} + void swapvec( LSVector& v) { c.swap(v);} + const LineSeg& operator[]( size_t i) { return c[i];} +}; + +class LSYMaxQueue : public LSYMaxQueueBase +{ +public: + void reserve( size_t n) { c.reserve(n);} +}; + +void addAndCutSegment( LSVector& rLSVector, const LineSeg& rLS, DoubleSet& rCutParmSet) +{ + // short circuit when no segment was cut + if( rCutParmSet.empty()) { + rLSVector.push_back( rLS); + return; + } + + // iterate through all cutparms of this segment + LineSeg aCS = rLS; + const double fCutMin = rLS.mnUniqueId; + DoubleSet::iterator itFirst = rCutParmSet.lower_bound( fCutMin); + DoubleSet::iterator it = itFirst; + for(; it != rCutParmSet.end(); ++it) { + const double fCutParm = (*it) - fCutMin; + if( fCutParm >= 1.0) + break; + // cut segment at parameter fCutParm + aCS.mfX2 = rLS.mfX1 + fCutParm * (rLS.mfX2 - rLS.mfX1); + aCS.mfY2 = rLS.mfY1 + fCutParm * (rLS.mfY2 - rLS.mfY1); +// if( aCS.mfY1 != aCS.mfY2) + rLSVector.push_back( aCS); + // prepare for next segment cut + aCS.mfX1 = aCS.mfX2; + aCS.mfY1 = aCS.mfY2; + } + // remove cutparams that will no longer be needed + // TODO: is it worth it or should we just keep the cutparams? + rCutParmSet.erase( itFirst, it); + + // add segment part remaining after last cut + aCS.mfX2 = rLS.mfX2; + aCS.mfY2 = rLS.mfY2; + rLSVector.push_back( aCS); +} + +void splitIntersectingSegments( LSVector& rLSVector) +{ + // get an y-sorted queue from the input vector + LSYMinQueue aYMinQueue; + LSYMinCmp aLSYMinCmp; + std::make_heap( rLSVector.begin(), rLSVector.end(), aLSYMinCmp); + aYMinQueue.swapvec( rLSVector); + + // prepare the result vector + // try to avoid reallocations by guessing a reasonable result size + rLSVector.reserve( aYMinQueue.size() * 1.5); + + // find the intersections and record their cut-parameters + DoubleSet aCutParmSet; + LSXMinSet aXMinSet; + LSYMaxQueue aYMaxQueue; + aYMaxQueue.reserve( aYMinQueue.size()); + // sweep-down and check all segment-pairs that might intersect + while( !aYMinQueue.empty()) { + // get next input-segment + const LineSeg& rLS = aYMinQueue.top(); + // retire obsoleted segments + const double fYCur = rLS.mfY1; + while( !aYMaxQueue.empty()) { + // check next segment to be retired + const LineSeg& rOS = aYMaxQueue.top(); + if( fYCur < rOS.mfY2) + break; + // emit resolved segment into result + addAndCutSegment( rLSVector, rOS, aCutParmSet); + // find segment to be retired in xmin-compare-set + LSXMinSet::iterator itR = aXMinSet.lower_bound( rOS); + while( !(*itR == rOS)) ++itR; + // retire segment from xmin-compare-set + aXMinSet.erase( itR); + // this segment is pining for the fjords + aYMaxQueue.pop(); + } + + // iterate over all segments that might overlap + // skip over the leftmost segments that cannot overlap + const double fXMax = rLS.getXMax(); + LSXMinSet::const_iterator itC = aXMinSet.begin(); + for(; itC != aXMinSet.end(); ++itC) + if( (*itC).getXMin() <= fXMax) + break; + // TODO: if the linear search becomes too expensive + // then use an XMaxQueue based approach to replace it + const double fXMin = rLS.getXMin(); + for(; itC != aXMinSet.end(); ++itC) { + const LineSeg& rOS = *itC; + if( fXMin >= rOS.getXMax()) + continue; + if( fXMax < rOS.getXMin()) + break; + double fCutParms[2]; + if( !findIntersection( rLS, rOS, fCutParms)) + continue; + // remember cut parameters + // TODO: if many cutpoints are expected reserve some/use a different std::set allocator + aCutParmSet.insert( rLS.mnUniqueId + fCutParms[0]); + aCutParmSet.insert( rOS.mnUniqueId + fCutParms[1]); + } + // add segment to xmin-compare-set + // TODO: do we have a good insertion hint? + aXMinSet.insert( /*itC,*/ rLS); + // register segment for retirement + aYMaxQueue.push( rLS); + aYMinQueue.pop(); + } + + // retire the remaining segments + aXMinSet.clear(); + while( !aYMaxQueue.empty()) { + // emit segments and cut them up if needed + const LineSeg& rLS = aYMaxQueue.top(); + addAndCutSegment( rLSVector, rLS, aCutParmSet); + aYMaxQueue.pop(); + } +} + +#endif // DISABLE_SOLVECROSSOVER_WORKAROUND + +// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + -- cgit From 22b85f04d2c6aae3eb24cc6fb29835dd821b4aa6 Mon Sep 17 00:00:00 2001 From: Herbert Duerr Date: Mon, 2 Nov 2009 18:06:32 +0000 Subject: #i105769# adjust my intersection-solver for the needs of the trapezoid converter --- vcl/unx/source/gdi/salgdi.cxx | 180 ++++++++++++++++++++++++++---------------- 1 file changed, 113 insertions(+), 67 deletions(-) diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index df97b93ce539..e7119b7e013e 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -1124,10 +1124,14 @@ struct HalfTrapezoid // maLine.p1.y <= mnY < maLine.p2.y XLineFixed maLine; XFixed mnY; + + XFixed getXMin() const { return std::min( maLine.p1.x, maLine.p2.x); } + XFixed getXMax() const { return std::max( maLine.p1.x, maLine.p2.x); } }; -struct HalfTrapCompare +class HalfTrapCompare { +public: bool operator()( const HalfTrapezoid& rA, const HalfTrapezoid& rB ) const { bool bIsTopLeft = false; @@ -1140,14 +1144,15 @@ struct HalfTrapCompare } }; -typedef std::priority_queue< HalfTrapezoid, std::vector, HalfTrapCompare > HTQueueBase; +typedef std::vector< HalfTrapezoid > HTVector; +typedef std::priority_queue< HalfTrapezoid, HTVector, HalfTrapCompare > HTQueueBase; // we need a priority queue with a reserve() to prevent countless reallocations class HTQueue : public HTQueueBase { public: void reserve( size_t n ) { c.reserve( n ); } - int capacity() const { return c.capacity(); } + void swapvec( HTVector& v) { c.swap( v); } }; typedef std::vector TrapezoidVector; @@ -1175,6 +1180,10 @@ public: }; typedef std::multiset< int, TrapezoidYCompare > VerticalTrapSet; + +#ifndef DISABLE_SOLVECROSSOVER_WORKAROUND +void splitIntersectingSegments( HTVector&); +#endif // DISABLE_SOLVECROSSOVER_WORKAROUND } // end of anonymous namespace // draw a poly-polygon @@ -1270,8 +1279,8 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly } // #i100922# try to prevent priority-queue reallocations by reservering enough nHTQueueReserve = ((4*nHTQueueReserve) | 0x1FFF) + 1; - HTQueue aHTQueue; - aHTQueue.reserve( nHTQueueReserve ); + HTVector aHTVector; + aHTVector.reserve( nHTQueueReserve ); // first convert the B2DPolyPolygon to HalfTrapezoids const int nGoodPolyCount = aGoodPolyPoly.count(); @@ -1311,9 +1320,11 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly // check if enough data is available for a new HalfTrapezoid if( nPointIdx == 0 ) continue; +#ifdef DISABLE_SOLVECROSSOVER_WORKAROUND // vertical segments can intersect too => don't ignore them // ignore vertical segments if( aNewXPF.y == aOldXPF.y ) continue; +#endif // DISABLE_SOLVECROSSOVER_WORKAROUND // construct HalfTrapezoid as topdown segment HalfTrapezoid aHT; @@ -1338,25 +1349,32 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly #endif // queue up the HalfTrapezoid - aHTQueue.push( aHT ); + aHTVector.push_back( aHT ); } } } - if( aHTQueue.empty() ) + if( aHTVector.empty() ) return TRUE; #ifndef DISABLE_SOLVECROSSOVER_WORKAROUND + // find intersecting halftraps and split them up // TODO: remove when solveCrossOvers gets fast enough so its use can be enabled above - // FAQ: why should intersecting-segment segments be handled before adaptiveSubdivide()? + // FAQ: why should segment intersection be handled before adaptiveSubdivide()? // Answer: because it is conceptually much faster // Example: consider two intersecting circles with a diameter of 1000 pixels // before subdivision: eight bezier segments - // after subdivision: a thousand line segments - // since even the best generic intersection finders have a complexity of O((n+k)*log(n+k)) it becomes - // obvious that testing while the segment count is still low is a much better approach. - // find intersecting halftraps and split them up -#endif // WORKAROUND_SOLVECROSSOVER_PERF + // after subdivision: more than a thousand line segments + // since even the best generic intersection finders have a complexity of O((n+k)*log(n+k)) + // it shows that testing while the segment count is still low is a much better approach. + splitIntersectingSegments( aHTVector); +#endif // DISABLE_SOLVECROSSOVER_WORKAROUND + + // build queue from vector of intersection free half-trapezoids + // TODO: is replacing the priority-queue by a sorted vector worth it? + std::make_heap( aHTVector.begin(), aHTVector.end(), HalfTrapCompare()); + HTQueue aHTQueue; + aHTQueue.swapvec( aHTVector); // then convert the HalfTrapezoids into full Trapezoids TrapezoidVector aTrapVector; @@ -1551,13 +1569,20 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const : aPolygon.transform( aAnisoMatrix ); } - // AW: reSegment no longer needed; new createAreaGeometry will remove exteme positions - // and create bezier polygons - //if( aPolygon.areControlPointsUsed() ) - // aPolygon = basegfx::tools::reSegmentPolygonEdges( aPolygon, 8, true, false ); - //const basegfx::B2DPolyPolygon aAreaPolyPoly = basegfx::tools::createAreaGeometryForSimplePolygon( - // aPolygon, 0.5*rLineWidth.getX(), eLineJoin ); - const basegfx::B2DPolyPolygon aAreaPolyPoly(basegfx::tools::createAreaGeometry(aPolygon, 0.5*rLineWidth.getX(), eLineJoin)); + // special handling for hairlines to improve the drawing performance + // TODO: revisit after basegfx performance related changes + const bool bIsHairline = (rLineWidth.getX() < 1.2) && (rLineWidth.getY() < 1.2); + if( bIsHairline ) + { + // for hairlines the linejoin style becomes irrelevant + eLineJoin = basegfx::B2DLINEJOIN_NONE; + // createAreaGeometry is still too expensive when beziers are involved + if( aPolygon.areControlPointsUsed() ) + aPolygon = ::basegfx::tools::adaptiveSubdivideByDistance( aPolygon, 0.125 ); + } + + // create the area-polygon for the line + const basegfx::B2DPolyPolygon aAreaPolyPoly( basegfx::tools::createAreaGeometry(aPolygon, 0.5*rLineWidth.getX(), eLineJoin) ); if( (rLineWidth.getX() != rLineWidth.getY()) && !basegfx::fTools::equalZero( rLineWidth.getX() ) ) @@ -1593,36 +1618,31 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const : // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #ifndef DISABLE_SOLVECROSSOVER_WORKAROUND +// TODO: move the intersection solver into basegfx +// and then support bezier-intersection finding too -class LineSeg -{ -public: - double mfX1, mfY1; - double mfX2, mfY2; - int mnUniqueId; +namespace { // anonymous namespace to prevent export - double getXMin( void) const { return (mfX1 not intersecting - const double fDet = (r1.mfX1-r1.mfX2)*(r2.mfY2-r2.mfY1) - (r2.mfX2-r2.mfX1)*(r1.mfY1-r1.mfY2); + const XLineFixed& r1 = rLS1.maLine; + const XLineFixed& r2 = rLS2.maLine; + const double fDet = (double)(r1.p1.x - r1.p2.x) * (r2.p2.y - r2.p1.y) + - (double)(r2.p2.x - r2.p1.x) * (r1.p1.y - r1.p2.y); static const double fEps = 1e-8; if( fabs(fDet) < fEps) return false; // check if intersection on first segment - const double fS1 = (r2.mfY2 - r2.mfY1) * (r1.mfX1 - r2.mfX1); - const double fS2 = (r2.mfX2 - r2.mfX1) * (r2.mfY1 - r1.mfY1); + const double fS1 = (double)(r2.p2.y - r2.p1.y) * (r1.p1.x - r2.p1.x); + const double fS2 = (double)(r2.p2.x - r2.p1.x) * (r2.p1.y - r1.p1.y); const double fS = (fS1 + fS2) / fDet; if( (fS <= +fEps) || (fS >= 1-fEps)) return false; pCutParams[0] = fS; // check if intersection on second segment - const double fT1 = (r1.mfY2 - r1.mfY1) * (r1.mfX1 - r2.mfX1); - const double fT2 = (r1.mfX2 - r1.mfX1) * (r2.mfY1 - r1.mfY1); + const double fT1 = (double)(r1.p2.y - r1.p1.y) * (r1.p1.x - r2.p1.x); + const double fT2 = (double)(r1.p2.x - r1.p1.x) * (r2.p1.y - r1.p1.y); const double fT = (fT1 + fT2) / fDet; if( (fT <= +fEps) || (fT >= 1-fEps)) return false; pCutParams[1] = fT; -#if 0 - rCutPt.mfX = r1.mfX1 + fS * (r1.mfX2 - r1.mfX1); - rCutPt.mfY = r1.mfY1 + fS * (r1.mfY2 - r1.mfY1); -#endif return true; } -typedef std::vector LSVector; typedef std::priority_queue< LineSeg, LSVector, LSYMinCmp> LSYMinQueueBase; typedef std::priority_queue< LineSeg, LSVector, LSYMaxCmp> LSYMaxQueueBase; typedef std::multiset< LineSeg, LSXMinCmp> LSXMinSet; @@ -1673,9 +1691,8 @@ typedef std::set DoubleSet; class LSYMinQueue : public LSYMinQueueBase { public: - void reserve( size_t n) { c.reserve(n);} - void swapvec( LSVector& v) { c.swap(v);} - const LineSeg& operator[]( size_t i) { return c[i];} + void reserve( size_t n) { c.reserve(n);} + void swapvec( LSVector& v) { c.swap(v);} }; class LSYMaxQueue : public LSYMaxQueueBase @@ -1694,7 +1711,7 @@ void addAndCutSegment( LSVector& rLSVector, const LineSeg& rLS, DoubleSet& rCutP // iterate through all cutparms of this segment LineSeg aCS = rLS; - const double fCutMin = rLS.mnUniqueId; + const double fCutMin = rLS.mnY; DoubleSet::iterator itFirst = rCutParmSet.lower_bound( fCutMin); DoubleSet::iterator it = itFirst; for(; it != rCutParmSet.end(); ++it) { @@ -1702,30 +1719,33 @@ void addAndCutSegment( LSVector& rLSVector, const LineSeg& rLS, DoubleSet& rCutP if( fCutParm >= 1.0) break; // cut segment at parameter fCutParm - aCS.mfX2 = rLS.mfX1 + fCutParm * (rLS.mfX2 - rLS.mfX1); - aCS.mfY2 = rLS.mfY1 + fCutParm * (rLS.mfY2 - rLS.mfY1); -// if( aCS.mfY1 != aCS.mfY2) + aCS.maLine.p2.x = rLS.maLine.p1.x + (XFixed)(fCutParm * (rLS.maLine.p2.x - rLS.maLine.p1.x)); + aCS.maLine.p2.y = rLS.maLine.p1.y + (XFixed)(fCutParm * (rLS.maLine.p2.y - rLS.maLine.p1.y)); + if( aCS.maLine.p1.y != aCS.maLine.p2.y) rLSVector.push_back( aCS); // prepare for next segment cut - aCS.mfX1 = aCS.mfX2; - aCS.mfY1 = aCS.mfY2; + aCS.maLine.p1 = aCS.maLine.p2; } // remove cutparams that will no longer be needed // TODO: is it worth it or should we just keep the cutparams? rCutParmSet.erase( itFirst, it); // add segment part remaining after last cut - aCS.mfX2 = rLS.mfX2; - aCS.mfY2 = rLS.mfY2; - rLSVector.push_back( aCS); + aCS.maLine.p2 = rLS.maLine.p2; + if( aCS.maLine.p1.y != aCS.maLine.p2.y) + rLSVector.push_back( aCS); } void splitIntersectingSegments( LSVector& rLSVector) { + for( int i = rLSVector.size(); --i >= 0;) { + LineSeg& rLS = rLSVector[i]; + // get a unique id for each lineseg, temporarily abuse the mnY member + rLS.mnY = i; + } // get an y-sorted queue from the input vector LSYMinQueue aYMinQueue; - LSYMinCmp aLSYMinCmp; - std::make_heap( rLSVector.begin(), rLSVector.end(), aLSYMinCmp); + std::make_heap( rLSVector.begin(), rLSVector.end(), LSYMinCmp()); aYMinQueue.swapvec( rLSVector); // prepare the result vector @@ -1742,11 +1762,11 @@ void splitIntersectingSegments( LSVector& rLSVector) // get next input-segment const LineSeg& rLS = aYMinQueue.top(); // retire obsoleted segments - const double fYCur = rLS.mfY1; + const double fYCur = rLS.maLine.p1.y; while( !aYMaxQueue.empty()) { // check next segment to be retired const LineSeg& rOS = aYMaxQueue.top(); - if( fYCur < rOS.mfY2) + if( fYCur < rOS.maLine.p2.y) break; // emit resolved segment into result addAndCutSegment( rLSVector, rOS, aCutParmSet); @@ -1779,9 +1799,11 @@ void splitIntersectingSegments( LSVector& rLSVector) if( !findIntersection( rLS, rOS, fCutParms)) continue; // remember cut parameters - // TODO: if many cutpoints are expected reserve some/use a different std::set allocator - aCutParmSet.insert( rLS.mnUniqueId + fCutParms[0]); - aCutParmSet.insert( rOS.mnUniqueId + fCutParms[1]); + // TODO: std::set seems to use individual allocations + // which results in perf-problems for many entries + // => pre-allocate nodes by using a non-default allocator + aCutParmSet.insert( rLS.mnY + fCutParms[0]); + aCutParmSet.insert( rOS.mnY + fCutParms[1]); } // add segment to xmin-compare-set // TODO: do we have a good insertion hint? @@ -1799,8 +1821,32 @@ void splitIntersectingSegments( LSVector& rLSVector) addAndCutSegment( rLSVector, rLS, aCutParmSet); aYMaxQueue.pop(); } + + // get the segments ready to be consumed by the drawPolygon() caller + int nNewSize = 0; + const int nOldSize = rLSVector.size(); + for( int i = 0; i < nOldSize; ++i) { + LineSeg& rLS = rLSVector[i]; + // prevent integer rounding problems in LSBs + rLS.maLine.p1.x = (rLS.maLine.p1.x + 32) & ~63; + rLS.maLine.p1.y = (rLS.maLine.p1.y + 32) & ~63; + rLS.maLine.p2.x = (rLS.maLine.p2.x + 32) & ~63; + rLS.maLine.p2.y = (rLS.maLine.p2.y + 32) & ~63; + // reset each mnY to y-top of the segment + rLS.mnY = rLS.maLine.p1.y; + // ignore horizontal segments + if( rLS.mnY == rLS.maLine.p2.y) + continue; + if( i != nNewSize) + rLSVector[ nNewSize] = rLS; + ++nNewSize; + } + if( nNewSize != nOldSize) + rLSVector.resize( nNewSize); } +} // end anonymous namespace + #endif // DISABLE_SOLVECROSSOVER_WORKAROUND // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -- cgit From 1cc52698919def56d44c055988b0b8943e42f19a Mon Sep 17 00:00:00 2001 From: Herbert Duerr Date: Tue, 3 Nov 2009 07:04:26 +0000 Subject: #i105769# remove elimination of horizontal segments out of intersection solver again --- vcl/unx/source/gdi/salgdi.cxx | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index e7119b7e013e..9218708affac 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -1320,11 +1320,6 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly // check if enough data is available for a new HalfTrapezoid if( nPointIdx == 0 ) continue; -#ifdef DISABLE_SOLVECROSSOVER_WORKAROUND // vertical segments can intersect too => don't ignore them - // ignore vertical segments - if( aNewXPF.y == aOldXPF.y ) - continue; -#endif // DISABLE_SOLVECROSSOVER_WORKAROUND // construct HalfTrapezoid as topdown segment HalfTrapezoid aHT; @@ -1391,23 +1386,28 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly XTrapezoid aTrapezoid; // convert a HalfTrapezoid pair + // get the left side of the trapezoid const HalfTrapezoid& rLeft = aHTQueue.top(); aTrapezoid.top = rLeft.mnY; aTrapezoid.bottom = rLeft.maLine.p2.y; aTrapezoid.left = rLeft.maLine; + aHTQueue.pop(); -#if 0 // TODO: is it worth it to enable this? // ignore empty trapezoids if( aTrapezoid.bottom <= aTrapezoid.top ) continue; -#endif - aHTQueue.pop(); - if( aHTQueue.empty() ) // TODO: assert + // get the right side of the trapezoid + while( !aHTQueue.empty() ) { + const HalfTrapezoid& rRight = aHTQueue.top(); + aTrapezoid.right = rRight.maLine; + aHTQueue.pop(); + // break when non-horizontal segment found + if( aTrapezoid.right.p2.y > aTrapezoid.right.p1.y ) + break; + } + if( aTrapezoid.right.p2.y <= aTrapezoid.top ) // TODO: assert break; - const HalfTrapezoid& rRight = aHTQueue.top(); - aTrapezoid.right = rRight.maLine; - aHTQueue.pop(); aTrapezoid.bottom = aTrapezoid.left.p2.y; if( aTrapezoid.bottom > aTrapezoid.right.p2.y ) @@ -1823,10 +1823,9 @@ void splitIntersectingSegments( LSVector& rLSVector) } // get the segments ready to be consumed by the drawPolygon() caller - int nNewSize = 0; - const int nOldSize = rLSVector.size(); - for( int i = 0; i < nOldSize; ++i) { - LineSeg& rLS = rLSVector[i]; + LSVector::iterator aLSit = rLSVector.begin(); + for(; aLSit != rLSVector.end(); ++aLSit) { + LineSeg& rLS = *aLSit; // prevent integer rounding problems in LSBs rLS.maLine.p1.x = (rLS.maLine.p1.x + 32) & ~63; rLS.maLine.p1.y = (rLS.maLine.p1.y + 32) & ~63; @@ -1834,15 +1833,7 @@ void splitIntersectingSegments( LSVector& rLSVector) rLS.maLine.p2.y = (rLS.maLine.p2.y + 32) & ~63; // reset each mnY to y-top of the segment rLS.mnY = rLS.maLine.p1.y; - // ignore horizontal segments - if( rLS.mnY == rLS.maLine.p2.y) - continue; - if( i != nNewSize) - rLSVector[ nNewSize] = rLS; - ++nNewSize; } - if( nNewSize != nOldSize) - rLSVector.resize( nNewSize); } } // end anonymous namespace -- cgit From c131a4bba9e1c09c8e82731b36896451981cd9aa Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Tue, 3 Nov 2009 14:01:51 +0000 Subject: fixes for i106470 --- svtools/source/uno/unocontroltablemodel.cxx | 374 +--------------------------- svtools/source/uno/unocontroltablemodel.hxx | 50 ---- 2 files changed, 2 insertions(+), 422 deletions(-) diff --git a/svtools/source/uno/unocontroltablemodel.cxx b/svtools/source/uno/unocontroltablemodel.cxx index 566848f19023..b4ddc2cc472d 100644 --- a/svtools/source/uno/unocontroltablemodel.cxx +++ b/svtools/source/uno/unocontroltablemodel.cxx @@ -162,7 +162,8 @@ using namespace ::com::sun::star::awt::grid; std::vector >& aCellContent; UnoControlTableModel_Impl() - :nRowCount ( 0 ) + :aColumns ( *(new std::vector< PColumnModel> (0))) + ,nRowCount ( 0 ) ,bHasColumnHeaders ( false ) ,bHasRowHeaders ( false ) ,pRenderer ( ) @@ -172,7 +173,6 @@ using namespace ::com::sun::star::awt::grid; ,nRowHeaderWidth ( 10 * 100 ) // 50 mm ,aRowHeadersTitle ( *(new std::vector(0))) ,aCellContent ( *(new std::vector >(0))) - ,aColumns ( *(new std::vector< PColumnModel> (0))) { } }; @@ -409,373 +409,3 @@ using namespace ::com::sun::star::awt::grid; return m_pImpl->aRowHeadersTitle; } -//::com::sun::star::uno::Any UnoControlTableModel::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) -//{ -// ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType, -// SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridControl*, this ), -// SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridDataListener*, this ), -// //SAL_STATIC_CAST( com::sun::star::lang::XEventListener*, this ), -// //SAL_STATIC_CAST( com::sun::star::awt::XMouseListener*, this ), -// SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) ); -// return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); -//} -// -//// ::com::sun::star::lang::XTypeProvider -//IMPL_XTYPEPROVIDER_START( UnoControlTableModel ) -// getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridControl>* ) NULL ), -// getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel>* ) NULL ), -// getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener>* ) NULL ), -// VCLXWindow::getTypes() -//IMPL_XTYPEPROVIDER_END -// -//::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL UnoControlTableModel::getColumnModel( ) throw (::com::sun::star::uno::RuntimeException) -//{ -// return NULL; -//} -//void SAL_CALL UnoControlTableModel::setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException) -//{ -// (void)model; -//} -//::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL UnoControlTableModel::getDataModel( ) throw (::com::sun::star::uno::RuntimeException) -//{ -// return NULL; -//} -//void SAL_CALL UnoControlTableModel::setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException) -//{ -// (void)model; -//} -//sal_Int32 SAL_CALL UnoControlTableModel::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) -//{ -// TableControl* pTableControl = (TableControl*)GetWindow(); -// return pTableControl->GetCurrentRow( Point(x,y) ); -//} -// -///* -//void SAL_CALL UnoControlTableModel::addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException) -//{ -// VCLXWindow::addMouseListener( listener ); -//} -// -//void SAL_CALL UnoControlTableModel::removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException) -//{ -// VCLXWindow::removeMouseListener( listener ); -//} -//*/ -///* -//void SAL_CALL UnoControlTableModel::mousePressed( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) -//{ -// (void)rEvent; -//} -//void SAL_CALL UnoControlTableModel::mouseReleased( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) -//{ -// (void)rEvent; -//} -//void SAL_CALL UnoControlTableModel::mouseEntered( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) -//{ -// (void) rEvent; -//} -//void SAL_CALL UnoControlTableModel::mouseExited( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) -//{ -// (void) rEvent; -//} -//*/ -//void SAL_CALL UnoControlTableModel::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) -//{ -// (void)listener; -//} -// -//void SAL_CALL UnoControlTableModel::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) -//{ -// (void) listener; -//} -// -//void UnoControlTableModel::setProperty( const ::rtl::OUString& PropertyName, const Any& aValue) throw(RuntimeException) -//{ -// ::vos::OGuard aGuard( GetMutex() ); -// -// TableControl* pTableControl = (TableControl*)GetWindow(); -// -// switch( GetPropertyId( PropertyName ) ) -// { -// case BASEPROPERTY_GRID_SELECTIONMODE: -// { -// SelectionType eSelectionType; -// if( aValue >>= eSelectionType ) -// { -// SelectionMode eSelMode; -// switch( eSelectionType ) -// { -// case SelectionType_SINGLE: eSelMode = SINGLE_SELECTION; break; -// case SelectionType_RANGE: eSelMode = RANGE_SELECTION; break; -// case SelectionType_MULTI: eSelMode = MULTIPLE_SELECTION; break; -// // case SelectionType_NONE: -// default: eSelMode = NO_SELECTION; break; -// } -// if( pTableControl->getSelEngine()->GetSelectionMode() != eSelMode ) -// pTableControl->getSelEngine()->SetSelectionMode( eSelMode ); -// } -// break; -// } -// case BASEPROPERTY_HSCROLL: -// { -// sal_Bool bHScroll = true; -// if( aValue >>= bHScroll ) -// { -// m_bHScroll = bHScroll; -// } -// break; -// } -// case BASEPROPERTY_VSCROLL: -// { -// sal_Bool bVScroll = true; -// if( aValue >>= bVScroll ) -// { -// m_bVScroll = bVScroll; -// } -// break; -// } -// case BASEPROPERTY_GRID_SHOWROWHEADER: -// { -// sal_Bool rowHeader = true; -// if( aValue >>= rowHeader ) -// { -// setRowHeaders(rowHeader); -// } -// break; -// } -// -// case BASEPROPERTY_GRID_SHOWCOLUMNHEADER: -// { -// sal_Bool colHeader = true; -// if( aValue >>= colHeader ) -// { -// setColumnHeaders(colHeader); -// } -// break; -// } -// case BASEPROPERTY_GRID_DATAMODEL: -// { -// m_xDataModel = Reference< XGridDataModel >( aValue, UNO_QUERY ); -// Sequence > cellData = m_xDataModel->getData(); -// Sequence rowData(0); -// for(int i = 0; i< m_xDataModel->getRowCount();++i) -// { -// rowData = cellData[i]; -// std::vector newRow( -// comphelper::sequenceToContainer< std::vector >(rowData)); -// if(newRow.size()aColumns.size()) -// newRow.resize(m_pImpl->aColumns.size(),rtl::OUString::createFromAscii("")); -// m_pImpl->aCellContent.push_back(newRow); -// } -// Sequence< ::rtl::OUString > rowHeaders = m_xDataModel->getRowHeaders(); -// std::vector< rtl::OUString > newRow( -// comphelper::sequenceToContainer< std::vector >(rowHeaders)); -// m_pImpl->nRowCount = m_xDataModel->getRowCount(); -// setRowHeaderName(newRow); -// break; -// } -// case BASEPROPERTY_GRID_COLUMNMODEL: -// { -// m_xColumnModel = Reference< XGridColumnModel >( aValue, UNO_QUERY ); -// Sequence > columns = m_xColumnModel->getColumns(); -// std::vector > aNewColumns( -// comphelper::sequenceToContainer > >(columns)); -// if(!m_pImpl->aColumns.empty()) -// m_pImpl->aColumns.clear(); -// for ( ::svt::table::ColPos col = 0; col < m_xColumnModel->getColumnCount(); ++col ) -// { -// UnoControlTableColumn* tableColumn = new UnoControlTableColumn(aNewColumns[col]); -// m_pImpl->aColumns.push_back((PColumnModel)tableColumn); -// } -// break; -// } -// default: -// VCLXWindow::setProperty( PropertyName, aValue ); -// break; -// } -//} -// -//Any UnoControlTableModel::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException) -//{ -// ::vos::OGuard aGuard( GetMutex() ); -// -// const sal_uInt16 nPropId = GetPropertyId( PropertyName ); -// TableControl* pTableControl = (TableControl*)GetWindow(); -// if(pTableControl) -// { -// switch(nPropId) -// { -// case BASEPROPERTY_GRID_SELECTIONMODE: -// { -// SelectionType eSelectionType; -// -// SelectionMode eSelMode = pTableControl->getSelEngine()->GetSelectionMode(); -// switch( eSelMode ) -// { -// case SINGLE_SELECTION: eSelectionType = SelectionType_SINGLE; break; -// case RANGE_SELECTION: eSelectionType = SelectionType_RANGE; break; -// case MULTIPLE_SELECTION:eSelectionType = SelectionType_MULTI; break; -//// case NO_SELECTION: -// default: eSelectionType = SelectionType_NONE; break; -// } -// return Any( eSelectionType ); -// } -// case BASEPROPERTY_GRID_SHOWROWHEADER: -// { -// return Any ((sal_Bool) pTableControl->GetModel()->hasRowHeaders()); -// } -// case BASEPROPERTY_GRID_SHOWCOLUMNHEADER: -// return Any ((sal_Bool) pTableControl->GetModel()->hasColumnHeaders()); -// case BASEPROPERTY_GRID_DATAMODEL: -// return Any ( m_xDataModel ); -// case BASEPROPERTY_GRID_COLUMNMODEL: -// return Any ( m_xColumnModel); -// case BASEPROPERTY_HSCROLL: -// return Any ( m_bHScroll); -// case BASEPROPERTY_VSCROLL: -// return Any ( m_bVScroll); -// } -// } -// return VCLXWindow::getProperty( PropertyName ); -//} -// -//void UnoControlTableModel::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -//{ -// PushPropertyIds( rIds, -// BASEPROPERTY_GRID_SHOWROWHEADER, -// BASEPROPERTY_GRID_SHOWCOLUMNHEADER, -// BASEPROPERTY_GRID_DATAMODEL, -// BASEPROPERTY_GRID_COLUMNMODEL, -// BASEPROPERTY_GRID_SELECTIONMODE, -// 0); -// VCLXWindow::ImplGetPropertyIds( rIds, true ); -//} -//void SAL_CALL UnoControlTableModel::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException) -//{ -// TableControl* pTable = (TableControl*)GetWindow(); -// if ( pTable ) -// { -// pTable->SetModel(PTableModel(this)); -// pTable->Show( bVisible ); -// } -//} -//void SAL_CALL UnoControlTableModel::setFocus() throw(::com::sun::star::uno::RuntimeException) -//{ -// ::vos::OGuard aGuard( GetMutex() ); -// if ( GetWindow()) -// GetWindow()->GrabFocus(); -//} -//void SAL_CALL UnoControlTableModel::rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) -//{ -// std::vector aNewRow( -// comphelper::sequenceToContainer< std::vector >(Event.rowData)); -// if(aNewRow.size()aColumns.size()) -// aNewRow.resize(m_pImpl->aColumns.size(),rtl::OUString::createFromAscii("")); -// m_pImpl->aCellContent.push_back(aNewRow); -// if(hasRowHeaders()) -// m_pImpl->aRowHeadersTitle.push_back(Event.headerName); -// m_pImpl->nRowCount=m_pImpl->aCellContent.size(); -// TableControl* pTable = (TableControl*)GetWindow(); -// pTable->InvalidateDataWindow(m_pImpl->nRowCount-1, false); -// //pTable->GrabFocus(); -//} -// -//void SAL_CALL UnoControlTableModel::rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) -//{ -// TableControl* pTable = (TableControl*)GetWindow(); -// //unsigned int rows =m_pImpl->aCellContent.size()-1; -// if(Event.index == -1) -// { -// if(hasRowHeaders()) -// m_pImpl->aRowHeadersTitle.clear(); -// m_pImpl->aCellContent.clear(); -// } -// else -// { -// pTable->removeSelectedRow(Event.index); -// if(m_pImpl->aCellContent.size()>1) -// { -// if(hasRowHeaders()) -// m_pImpl->aRowHeadersTitle.erase(m_pImpl->aRowHeadersTitle.begin()+Event.index); -// m_pImpl->aCellContent.erase(m_pImpl->aCellContent.begin()+Event.index); -// -// } -// else -// { -// if(hasRowHeaders()) -// m_pImpl->aRowHeadersTitle.clear(); -// m_pImpl->aCellContent.clear(); -// //m_pImpl->nRowCount=0; -// } -// } -// //pTable->InvalidateDataWindow(Event.index, true); -// setRowCount(m_pImpl->aCellContent.size()); -// pTable->InvalidateDataWindow(Event.index, true); -// //pTable->Invalidate(); -//} -// -//void SAL_CALL UnoControlTableModel::dataChanged(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) -//{ -// (void) Event; -//} -// -// void SAL_CALL UnoControlTableModel::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) -// { -// VCLXWindow::disposing( Source ); -// } -// -//::sal_Int32 SAL_CALL UnoControlTableModel::getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException) -//{ -// return 0; -//} -// -//::sal_Int32 SAL_CALL UnoControlTableModel::getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException) -//{ -// return 0; -//} -// -//void SAL_CALL UnoControlTableModel::insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException) -//{ -// (void)length; -// (void)start; -//} -// -//void SAL_CALL UnoControlTableModel::removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException) -//{ -// (void)end; -// (void)start; -//} -// -//::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL UnoControlTableModel::getSelection() throw (::com::sun::star::uno::RuntimeException) -//{ -// TableControl* pTable = (TableControl*)GetWindow(); -// std::vector& selectedRows = pTable->GetSelectedRows(); -// Sequence selectedRowsToSequence(comphelper::containerToSequence(selectedRows)); -// return selectedRowsToSequence; -//} -// -//::sal_Bool SAL_CALL UnoControlTableModel::isCellEditable() throw (::com::sun::star::uno::RuntimeException) -//{ -// return sal_False; -//} -// -//::sal_Bool SAL_CALL UnoControlTableModel::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException) -//{ -// return sal_False; -//} -// -//::sal_Bool SAL_CALL UnoControlTableModel::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException) -//{ -// (void)index; -// return sal_False; -//} -// -//void SAL_CALL UnoControlTableModel::selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) -//{ -// (void)y; -//} -// -//void SAL_CALL UnoControlTableModel::selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException) -//{ -// (void)x; -//} diff --git a/svtools/source/uno/unocontroltablemodel.hxx b/svtools/source/uno/unocontroltablemodel.hxx index 6b431cc8fb1f..fe3d1f28e9ed 100644 --- a/svtools/source/uno/unocontroltablemodel.hxx +++ b/svtools/source/uno/unocontroltablemodel.hxx @@ -139,56 +139,6 @@ class UnoControlTableColumn : public IColumnModel virtual std::vector >& getCellContent(); virtual void setRowHeaderName(std::vector cellColumnContent); virtual std::vector& getRowHeaderName(); - - // //XGridDataListener overridables - // virtual void SAL_CALL rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event) throw (::com::sun::star::uno::RuntimeException); - // virtual void SAL_CALL rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException); - // virtual void SAL_CALL dataChanged(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException); - // virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); - - //::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - //void SAL_CALL acquire() throw() { VCLXWindow::acquire(); } - //void SAL_CALL release() throw() { VCLXWindow::release(); } - - // // ::com::sun::star::lang::XTypeProvider - //::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); - //::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); - - ////::com::sun::star::awt::grid::XGridControl - //::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL getColumnModel( ) throw (::com::sun::star::uno::RuntimeException); - // void SAL_CALL setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException); - // ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL getDataModel( ) throw (::com::sun::star::uno::RuntimeException); - // void SAL_CALL setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException); - - //virtual ::sal_Int32 SAL_CALL getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException); - //virtual ::sal_Int32 SAL_CALL getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException); - //virtual void SAL_CALL insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException); - //virtual void SAL_CALL removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException); - //virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelection() throw (::com::sun::star::uno::RuntimeException); - //virtual ::sal_Bool SAL_CALL isCellEditable() throw (::com::sun::star::uno::RuntimeException); - //virtual ::sal_Bool SAL_CALL isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException); - //virtual ::sal_Bool SAL_CALL isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException); - //virtual void SAL_CALL selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException); - //virtual void SAL_CALL selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException); - //virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException); - //virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException); - //virtual ::sal_Int32 SAL_CALL getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException); - - ////void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException); - ////void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException); - ////::com::sun::star::awt::XMouseListener - ///* - //virtual void SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); - //virtual void SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); - //virtual void SAL_CALL mouseEntered( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); - //virtual void SAL_CALL mouseExited( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); - //*/ - - // void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); - // ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); - //static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds ); - //void SAL_CALL setVisible(sal_Bool bVisible) throw(::com::sun::star::uno::RuntimeException); - //void SAL_CALL setFocus() throw(::com::sun::star::uno::RuntimeException); }; inline void UnoControlTableModel::SetColumnWidth( ColPos _nColumn, TableMetrics _nWidth100thMM ) -- cgit From 91067556c846928cfa254e05274dc1bd9fc9d3a4 Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Tue, 3 Nov 2009 14:42:58 +0000 Subject: fixes for i106470 --- svtools/source/uno/svtxgridcontrol.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index 73c9f091985f..2f2c896ee6a8 100755 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -200,7 +200,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An rowData = cellData[i]; std::vector newRow( comphelper::sequenceToContainer< std::vector >(rowData)); - if(newRow.size() < m_pTableModel->getColumnCount()) + if(newRow.size() < (unsigned)m_pTableModel->getColumnCount()) newRow.resize( m_pTableModel->getColumnCount(),rtl::OUString::createFromAscii("")); aCellContent.push_back(newRow); } @@ -308,7 +308,7 @@ void SAL_CALL SVTXGridControl::rowAdded(const ::com::sun::star::awt::grid::GridD { std::vector aNewRow( comphelper::sequenceToContainer< std::vector >(Event.rowData)); - if(aNewRow.size()< m_pTableModel->getColumnCount()) + if(aNewRow.size()< (unsigned)m_pTableModel->getColumnCount()) aNewRow.resize(m_pTableModel->getColumnCount(),rtl::OUString::createFromAscii("")); m_pTableModel->getCellContent().push_back(aNewRow); if(m_pTableModel->hasRowHeaders()) -- cgit From 6ce14717d50ed3fad1f5879faf5d034aaf8f3d3b Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 3 Nov 2009 18:12:19 +0100 Subject: #i104678# use high contrast mode setting instead of IsDark (paradigm shift begun with issue i35482) --- padmin/source/adddlg.cxx | 2 +- padmin/source/padialog.cxx | 2 +- svtools/source/brwbox/editbrowsebox.cxx | 12 +----------- svtools/source/contnr/fileview.cxx | 2 +- svtools/source/contnr/ivctrl.cxx | 2 +- svtools/source/contnr/svlbitm.cxx | 3 +-- svtools/source/contnr/svtreebx.cxx | 2 +- svtools/source/contnr/templwin.cxx | 6 +++--- svtools/source/control/ctrlbox.cxx | 3 +-- svtools/source/dialogs/printdlg.cxx | 2 +- svtools/source/uno/contextmenuhelper.cxx | 2 +- svtools/source/uno/toolboxcontroller.cxx | 2 +- toolkit/source/helper/throbberimpl.cxx | 4 ++-- vcl/unx/kde4/KDESalFrame.cxx | 5 ----- 14 files changed, 16 insertions(+), 33 deletions(-) diff --git a/padmin/source/adddlg.cxx b/padmin/source/adddlg.cxx index 052de2cbb731..58c37dcffa83 100644 --- a/padmin/source/adddlg.cxx +++ b/padmin/source/adddlg.cxx @@ -807,7 +807,7 @@ AddPrinterDialog::~AddPrinterDialog() void AddPrinterDialog::updateSettings() { - if( ! GetDisplayBackground().GetColor().IsDark() ) + if( ! GetSettings().GetStyleSettings().GetHighContrastMode() ) m_aTitleImage.SetImage( Image( BitmapEx( PaResId( RID_BMP_PRINTER ) ) ) ); else m_aTitleImage.SetImage( Image( BitmapEx( PaResId( RID_BMP_PRINTER_HC ) ) ) ); diff --git a/padmin/source/padialog.cxx b/padmin/source/padialog.cxx index 5b49409a1c8a..f73427526be6 100644 --- a/padmin/source/padialog.cxx +++ b/padmin/source/padialog.cxx @@ -106,7 +106,7 @@ PADialog::PADialog( Window* pParent, BOOL /*bAdmin*/ ) : void PADialog::updateSettings() { - if( ! GetDisplayBackground().GetColor().IsDark() ) + if( ! GetSettings().GetStyleSettings().GetHighContrastMode() ) { m_aPrinterImg = Image( BitmapEx( PaResId( RID_BMP_SMALL_PRINTER ) ) ); m_aFaxImg = Image( BitmapEx( PaResId( RID_BMP_SMALL_FAX ) ) ); diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx index 086e00674a8e..36a798d666cd 100644 --- a/svtools/source/brwbox/editbrowsebox.cxx +++ b/svtools/source/brwbox/editbrowsebox.cxx @@ -70,17 +70,7 @@ namespace svt sal_Bool isHiContrast(Window* _pWindow) { OSL_ENSURE(_pWindow,"Window must be not null!"); - Window* pIter = _pWindow; - // while( pIter && pIter->GetBackground().GetColor().GetColor() == COL_TRANSPARENT ) - while( pIter ) - { - const Color& aColor = pIter->GetBackground().GetColor(); - if ( aColor.GetColor() == COL_TRANSPARENT ) - pIter = pIter->GetParent(); - else - break; - } - return pIter && pIter->GetBackground().GetColor().IsDark(); + return _pWindow && _pWindow->GetSettings().GetStyleSettings().GetHighContrastMode(); } //.............................................................. diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index 274557051c27..243856a8e15a 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -167,7 +167,7 @@ namespace static sal_Bool isHighContrast( const Window* _pView ) { - return _pView->GetDisplayBackground().GetColor().IsDark(); + return _pView->GetSettings().GetStyleSettings().GetHighContrastMode(); } // ----------------------------------------------------------------------- diff --git a/svtools/source/contnr/ivctrl.cxx b/svtools/source/contnr/ivctrl.cxx index c0f40fd306df..b3b5829b479e 100644 --- a/svtools/source/contnr/ivctrl.cxx +++ b/svtools/source/contnr/ivctrl.cxx @@ -201,7 +201,7 @@ BOOL SvtIconChoiceCtrl::EditingEntry( SvxIconChoiceCtrlEntry* ) } void SvtIconChoiceCtrl::DrawEntryImage( SvxIconChoiceCtrlEntry* pEntry, const Point& rPos, OutputDevice& rDev ) { - rDev.DrawImage ( rPos, GetDisplayBackground().GetColor().IsDark() ? pEntry->GetImageHC() : pEntry->GetImage() ); + rDev.DrawImage( rPos, GetSettings().GetStyleSettings().GetHighContrastMode() ? pEntry->GetImageHC() : pEntry->GetImage() ); } String SvtIconChoiceCtrl::GetEntryText( SvxIconChoiceCtrlEntry* pEntry, BOOL ) { diff --git a/svtools/source/contnr/svlbitm.cxx b/svtools/source/contnr/svlbitm.cxx index ccd98e6a32a1..e9125b7fb2e1 100644 --- a/svtools/source/contnr/svlbitm.cxx +++ b/svtools/source/contnr/svlbitm.cxx @@ -590,8 +590,7 @@ void SvLBoxContextBmp::Paint( const Point& _rPos, SvLBox& _rDev, BmpColorMode eMode( BMP_COLOR_NORMAL ); if ( !!m_pImpl->m_aImage1_hc ) { // we really have HC images - const Wallpaper& rDeviceBackground = _rDev.GetDisplayBackground(); - if ( rDeviceBackground.GetColor().IsDark() ) + if ( _rDev.GetSettings().GetStyleSettings().GetHighContrastMode() ) eMode = BMP_COLOR_HIGHCONTRAST; } diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx index a697928842af..503325ddf802 100644 --- a/svtools/source/contnr/svtreebx.cxx +++ b/svtools/source/contnr/svtreebx.cxx @@ -1813,7 +1813,7 @@ long SvTreeListBox::PaintEntry1(SvLBoxEntry* pEntry,long nLine,USHORT nTabFlags, const Image* pImg = 0; BmpColorMode eBitmapMode = BMP_COLOR_NORMAL; - if ( GetDisplayBackground().GetColor().IsDark() ) + if ( GetSettings().GetStyleSettings().GetHighContrastMode() ) eBitmapMode = BMP_COLOR_HIGHCONTRAST; if( IsExpanded(pEntry) ) diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx index 2b212fdcffeb..8312fc432299 100644 --- a/svtools/source/contnr/templwin.cxx +++ b/svtools/source/contnr/templwin.cxx @@ -369,7 +369,7 @@ SvtIconWindow_Impl::SvtIconWindow_Impl( Window* pParent ) : // insert the categories // "New Document" - sal_Bool bHiContrast = GetBackground().GetColor().IsDark(); + sal_Bool bHiContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); Image aImage( SvtResId( bHiContrast ? IMG_SVT_NEWDOC_HC : IMG_SVT_NEWDOC ) ); nMaxTextLength = aImage.GetSizePixel().Width(); String aEntryStr = String( SvtResId( STR_SVT_NEWDOC ) ); @@ -1348,7 +1348,7 @@ void SvtTemplateWindow::InitToolBoxImages() { SvtMiscOptions aMiscOpt; BOOL bLarge = aMiscOpt.AreCurrentSymbolsLarge(); - sal_Bool bHiContrast = aFileViewTB.GetBackground().GetColor().IsDark(); + sal_Bool bHiContrast = aFileViewTB.GetSettings().GetStyleSettings().GetHighContrastMode(); aFileViewTB.SetItemImage( TI_DOCTEMPLATE_BACK, Image( SvtResId( bLarge ? bHiContrast ? IMG_SVT_DOCTEMPL_HC_BACK_LARGE : IMG_SVT_DOCTEMPLATE_BACK_LARGE @@ -1372,7 +1372,7 @@ void SvtTemplateWindow::InitToolBoxImages() void SvtTemplateWindow::UpdateIcons() { - pIconWin->UpdateIcons( aFileViewTB.GetBackground().GetColor().IsDark() ); + pIconWin->UpdateIcons( aFileViewTB.GetSettings().GetStyleSettings().GetHighContrastMode() ); } // ------------------------------------------------------------------------ diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 5be239a5593e..097bba0e39f9 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -644,8 +644,7 @@ void FontNameBox::DataChanged( const DataChangedEvent& rDCEvt ) void FontNameBox::InitBitmaps( void ) { - Color aCol = GetSettings().GetStyleSettings().GetWindowColor(); - BOOL bHC = aCol.IsDark(); + BOOL bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); maImagePrinterFont = Image( SvtResId( bHC? RID_IMG_PRINTERFONT_HC : RID_IMG_PRINTERFONT ) ); maImageBitmapFont = Image( SvtResId( bHC? RID_IMG_BITMAPFONT_HC : RID_IMG_BITMAPFONT ) ); diff --git a/svtools/source/dialogs/printdlg.cxx b/svtools/source/dialogs/printdlg.cxx index 68acffc62a74..3a7171090cd2 100644 --- a/svtools/source/dialogs/printdlg.cxx +++ b/svtools/source/dialogs/printdlg.cxx @@ -172,7 +172,7 @@ PrintDialog::~PrintDialog() void PrintDialog::ImplSetImages() { - if( ! GetSettings().GetStyleSettings().GetDialogColor().IsDark() ) + if( ! GetSettings().GetStyleSettings().GetHighContrastMode() ) { maImgCollate.SetModeImage( Image( SvtResId( RID_IMG_PRNDLG_COLLATE ) ), BMP_COLOR_NORMAL ); maImgNotCollate.SetModeImage( Image( SvtResId( RID_IMG_PRNDLG_NOCOLLATE ) ), BMP_COLOR_NORMAL ); diff --git a/svtools/source/uno/contextmenuhelper.cxx b/svtools/source/uno/contextmenuhelper.cxx index be7738adaf14..b3ae322aa3ba 100644 --- a/svtools/source/uno/contextmenuhelper.cxx +++ b/svtools/source/uno/contextmenuhelper.cxx @@ -611,7 +611,7 @@ ContextMenuHelper::completeMenuProperties( // menu correctly. const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); bool bShowMenuImages( rSettings.GetUseImagesInMenus() ); - bool bIsHiContrast( rSettings.GetMenuColor().IsDark() ); + bool bIsHiContrast( rSettings.GetHighContrastMode() ); if ( pMenu ) { diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx index eb8a543d31f9..a8d05c49a7ae 100644 --- a/svtools/source/uno/toolboxcontroller.cxx +++ b/svtools/source/uno/toolboxcontroller.cxx @@ -646,7 +646,7 @@ sal_Bool ToolboxController::isHighContrast() const vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow ) - bHighContrast = ( ((ToolBox *)pWindow)->GetBackground().GetColor().IsDark() ); + bHighContrast = ( ((ToolBox *)pWindow)->GetSettings().GetStyleSettings().GetHighContrastMode() ); } return bHighContrast; diff --git a/toolkit/source/helper/throbberimpl.cxx b/toolkit/source/helper/throbberimpl.cxx index 902792918de0..423e40c4f305 100644 --- a/toolkit/source/helper/throbberimpl.cxx +++ b/toolkit/source/helper/throbberimpl.cxx @@ -110,9 +110,9 @@ namespace toolkit { FixedImage* pImage = static_cast< FixedImage* >( mxParent->GetWindow() ); if ( pImage ) - return pImage->GetSettings().GetStyleSettings().GetFaceColor().IsDark(); + return pImage->GetSettings().GetStyleSettings().GetHighContrastMode(); else - return Application::GetSettings().GetStyleSettings().GetFaceColor().IsDark(); + return Application::GetSettings().GetStyleSettings().GetHighContrastMode(); } // ----------------------------------------------------------------------- diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx index 796350a63d50..99dfd701a434 100644 --- a/vcl/unx/kde4/KDESalFrame.cxx +++ b/vcl/unx/kde4/KDESalFrame.cxx @@ -348,11 +348,6 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) // Scroll bar size style.SetScrollBarSize( kapp->style()->pixelMetric( QStyle::PM_ScrollBarExtent ) ); - // #i59364# high contrast mode - BOOL bHC = ( style.GetFaceColor().IsDark() || - style.GetWindowColor().IsDark() ); - style.SetHighContrastMode( bHC ); - rSettings.SetStyleSettings( style ); } -- cgit From 20820038846ae5821d42897623ca2bee2f8e0d87 Mon Sep 17 00:00:00 2001 From: mb93783 Date: Tue, 3 Nov 2009 18:41:58 +0100 Subject: some fixes for warnings and errors found while building on more platforms --- svtools/inc/svtools/menuoptions.hxx | 4 ++-- svtools/inc/svtools/miscopt.hxx | 4 ++-- svtools/source/config/menuoptions.cxx | 16 ++++++++-------- svtools/source/config/miscopt.cxx | 16 ++++++++-------- tools/inc/tools/solarmutex.hxx | 2 +- unotools/inc/unotools/misccfg.hxx | 2 +- unotools/inc/unotools/options.hxx | 2 +- unotools/inc/unotools/syslocaleoptions.hxx | 2 +- unotools/source/config/misccfg.cxx | 3 ++- unotools/source/config/options.cxx | 2 +- unotools/source/config/syslocaleoptions.cxx | 6 ++++-- vcl/source/app/settings.cxx | 9 --------- vcl/source/control/field2.cxx | 4 ++-- vcl/source/gdi/makefile.mk | 3 ++- 14 files changed, 35 insertions(+), 40 deletions(-) mode change 100644 => 100755 tools/inc/tools/solarmutex.hxx mode change 100644 => 100755 unotools/inc/unotools/options.hxx mode change 100644 => 100755 unotools/inc/unotools/syslocaleoptions.hxx mode change 100644 => 100755 unotools/source/config/options.cxx mode change 100644 => 100755 unotools/source/config/syslocaleoptions.cxx mode change 100644 => 100755 vcl/source/app/settings.cxx mode change 100644 => 100755 vcl/source/gdi/makefile.mk diff --git a/svtools/inc/svtools/menuoptions.hxx b/svtools/inc/svtools/menuoptions.hxx index 6b01ad6079e5..2bc5588519c2 100644 --- a/svtools/inc/svtools/menuoptions.hxx +++ b/svtools/inc/svtools/menuoptions.hxx @@ -98,8 +98,8 @@ class SVT_DLLPUBLIC SvtMenuOptions: public utl::detail::Options SvtMenuOptions(); virtual ~SvtMenuOptions(); - void AddListener( const Link& rLink ); - void RemoveListener( const Link& rLink ); + void AddListenerLink( const Link& rLink ); + void RemoveListenerLink( const Link& rLink ); //--------------------------------------------------------------------------------------------------------- // interface //--------------------------------------------------------------------------------------------------------- diff --git a/svtools/inc/svtools/miscopt.hxx b/svtools/inc/svtools/miscopt.hxx index bc98d9e50d44..556dd7f0cc7e 100644 --- a/svtools/inc/svtools/miscopt.hxx +++ b/svtools/inc/svtools/miscopt.hxx @@ -102,8 +102,8 @@ class SVT_DLLPUBLIC SvtMiscOptions: public utl::detail::Options SvtMiscOptions(); virtual ~SvtMiscOptions(); - void AddListener( const Link& rLink ); - void RemoveListener( const Link& rLink ); + void AddListenerLink( const Link& rLink ); + void RemoveListenerLink( const Link& rLink ); //--------------------------------------------------------------------------------------------------------- // interface diff --git a/svtools/source/config/menuoptions.cxx b/svtools/source/config/menuoptions.cxx index e9b1b71a1cc6..8c00d7165ba5 100644 --- a/svtools/source/config/menuoptions.cxx +++ b/svtools/source/config/menuoptions.cxx @@ -111,8 +111,8 @@ class SvtMenuOptions_Impl : public ConfigItem SvtMenuOptions_Impl(); ~SvtMenuOptions_Impl(); - void AddListener( const Link& rLink ); - void RemoveListener( const Link& rLink ); + void AddListenerLink( const Link& rLink ); + void RemoveListenerLink( const Link& rLink ); //--------------------------------------------------------------------------------------------------------- // overloaded methods of baseclass @@ -412,12 +412,12 @@ Sequence< OUString > SvtMenuOptions_Impl::impl_GetPropertyNames() return seqPropertyNames; } -void SvtMenuOptions_Impl::AddListener( const Link& rLink ) +void SvtMenuOptions_Impl::AddListenerLink( const Link& rLink ) { aList.Insert( new Link( rLink ) ); } -void SvtMenuOptions_Impl::RemoveListener( const Link& rLink ) +void SvtMenuOptions_Impl::RemoveListenerLink( const Link& rLink ) { for ( USHORT n=0; nAddListener( rLink ); + m_pDataContainer->AddListenerLink( rLink ); } -void SvtMenuOptions::RemoveListener( const Link& rLink ) +void SvtMenuOptions::RemoveListenerLink( const Link& rLink ) { - m_pDataContainer->RemoveListener( rLink ); + m_pDataContainer->RemoveListenerLink( rLink ); } diff --git a/svtools/source/config/miscopt.cxx b/svtools/source/config/miscopt.cxx index edf5b9e7c40c..ace9f710baa3 100644 --- a/svtools/source/config/miscopt.cxx +++ b/svtools/source/config/miscopt.cxx @@ -227,8 +227,8 @@ class SvtMiscOptions_Impl : public ConfigItem inline sal_Bool IsUseSystemPrintDialogReadOnly() const { return m_bIsUseSystemPrintDialogRO; } - void AddListener( const Link& rLink ); - void RemoveListener( const Link& rLink ); + void AddListenerLink( const Link& rLink ); + void RemoveListenerLink( const Link& rLink ); void CallListeners(); //------------------------------------------------------------------------------------------------------------- @@ -499,12 +499,12 @@ void SvtMiscOptions_Impl::Load( const Sequence< OUString >& rPropertyNames ) } } -void SvtMiscOptions_Impl::AddListener( const Link& rLink ) +void SvtMiscOptions_Impl::AddListenerLink( const Link& rLink ) { aList.Insert( new Link( rLink ) ); } -void SvtMiscOptions_Impl::RemoveListener( const Link& rLink ) +void SvtMiscOptions_Impl::RemoveListenerLink( const Link& rLink ) { for ( USHORT n=0; nAddListener( rLink ); + m_pDataContainer->AddListenerLink( rLink ); } -void SvtMiscOptions::RemoveListener( const Link& rLink ) +void SvtMiscOptions::RemoveListenerLink( const Link& rLink ) { - m_pDataContainer->RemoveListener( rLink ); + m_pDataContainer->RemoveListenerLink( rLink ); } diff --git a/tools/inc/tools/solarmutex.hxx b/tools/inc/tools/solarmutex.hxx old mode 100644 new mode 100755 index b1166f2b19a5..42aff1f23f43 --- a/tools/inc/tools/solarmutex.hxx +++ b/tools/inc/tools/solarmutex.hxx @@ -40,6 +40,6 @@ namespace tools static bool Acquire(); static void Release(); }; -}; +} #endif diff --git a/unotools/inc/unotools/misccfg.hxx b/unotools/inc/unotools/misccfg.hxx index 2a1383d307a5..14ecb12b388a 100644 --- a/unotools/inc/unotools/misccfg.hxx +++ b/unotools/inc/unotools/misccfg.hxx @@ -63,7 +63,7 @@ public: void SetYear2000( sal_Int32 nSet ); }; -}; +} #endif // _MISCCFG_HXX diff --git a/unotools/inc/unotools/options.hxx b/unotools/inc/unotools/options.hxx old mode 100644 new mode 100755 index f7254589150d..c0eaf5557033 --- a/unotools/inc/unotools/options.hxx +++ b/unotools/inc/unotools/options.hxx @@ -70,7 +70,7 @@ namespace utl { void NotifyListeners( sal_uInt32 nHint ); ConfigurationBroadcaster(); ~ConfigurationBroadcaster(); - void BlockBroadcasts( bool bBlock ); + virtual void BlockBroadcasts( bool bBlock ); }; namespace detail { diff --git a/unotools/inc/unotools/syslocaleoptions.hxx b/unotools/inc/unotools/syslocaleoptions.hxx old mode 100644 new mode 100755 index 6bb81fdd3ee0..b417e00eec12 --- a/unotools/inc/unotools/syslocaleoptions.hxx +++ b/unotools/inc/unotools/syslocaleoptions.hxx @@ -99,7 +99,7 @@ public: BlockBroadcasts(FALSE) or otherwise pending hints would never be broadcasted again. */ - void BlockBroadcasts( BOOL bBlock ); + virtual void BlockBroadcasts( bool bBlock ); // config value access methods diff --git a/unotools/source/config/misccfg.cxx b/unotools/source/config/misccfg.cxx index febb3610f6a2..a1c905d292f3 100644 --- a/unotools/source/config/misccfg.cxx +++ b/unotools/source/config/misccfg.cxx @@ -309,4 +309,5 @@ void MiscCfg::SetYear2000( sal_Int32 nSet ) pImpl->SetYear2000( nSet ); } -} \ No newline at end of file +} + diff --git a/unotools/source/config/options.cxx b/unotools/source/config/options.cxx old mode 100644 new mode 100755 index 3b41d14bdd6c..7c004e1475a6 --- a/unotools/source/config/options.cxx +++ b/unotools/source/config/options.cxx @@ -37,7 +37,7 @@ namespace utl { - DECLARE_LIST( IMPL_ConfigurationListenerList, ConfigurationListener* ); + DECLARE_LIST( IMPL_ConfigurationListenerList, ConfigurationListener* ) } using utl::detail::Options; diff --git a/unotools/source/config/syslocaleoptions.cxx b/unotools/source/config/syslocaleoptions.cxx old mode 100644 new mode 100755 index f358fe24df4f..7b14c9cb8c2f --- a/unotools/source/config/syslocaleoptions.cxx +++ b/unotools/source/config/syslocaleoptions.cxx @@ -536,7 +536,7 @@ void SvtSysLocaleOptions::Commit() } -void SvtSysLocaleOptions::BlockBroadcasts( BOOL bBlock ) +void SvtSysLocaleOptions::BlockBroadcasts( bool bBlock ) { MutexGuard aGuard( GetMutex() ); pOptions->BlockBroadcasts( bBlock ); @@ -700,4 +700,6 @@ LanguageType SvtSysLocaleOptions::GetRealLanguage() const LanguageType SvtSysLocaleOptions::GetRealUILanguage() const { return pOptions->GetRealUILanguage(); -} \ No newline at end of file +} + + diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx old mode 100644 new mode 100755 index 09262dff7eec..acfb7988b9bd --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -1510,15 +1510,6 @@ BOOL HelpSettings::operator ==( const HelpSettings& rSet ) const // ======================================================================= -static BOOL ImplCompareLocales( const ::com::sun::star::lang::Locale& L1, const ::com::sun::star::lang::Locale& L2 ) -{ - return ( ( L1.Language == L2.Language ) && - ( L1.Country == L2.Country ) && - ( L1.Variant == L2.Variant ) ); -} - -// ======================================================================= - ImplAllSettingsData::ImplAllSettingsData() { mnRefCount = 1; diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index 1d8f9a727be4..a7729f4ace24 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -1215,7 +1215,7 @@ static BOOL ImplDateProcessKeyInput( Edit*, const KeyEvent& rKEvt, ExtDateFieldF static BOOL ImplDateGetValue( const XubString& rStr, Date& rDate, ExtDateFieldFormat eDateFormat, const LocaleDataWrapper& rLocaleDataWrapper, const CalendarWrapper& rCalendarWrapper, - const AllSettings& rSettings ) + const AllSettings& ) { USHORT nDay = 0; USHORT nMonth = 0; @@ -1356,7 +1356,7 @@ BOOL DateFormatter::ImplDateReformat( const XubString& rStr, XubString& rOutStr, // ----------------------------------------------------------------------- XubString DateFormatter::ImplGetDateAsText( const Date& rDate, - const AllSettings& rSettings ) const + const AllSettings& ) const { BOOL bShowCentury = FALSE; switch ( GetExtDateFormat() ) diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk old mode 100644 new mode 100755 index d55dec36b65c..7f10a7e5454c --- a/vcl/source/gdi/makefile.mk +++ b/vcl/source/gdi/makefile.mk @@ -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 @@ -122,6 +122,7 @@ EXCEPTIONSFILES= $(SLO)$/salmisc.obj \ $(SLO)$/gfxlink.obj \ $(SLO)$/print.obj \ $(SLO)$/print2.obj \ + $(SLO)$/configsettings.obj \ $(SLO)$/sallayout.obj \ $(SLO)$/image.obj \ $(SLO)$/impimage.obj \ -- cgit From 130f53129c7c1cb4eb195e99c9b06bbf8292e688 Mon Sep 17 00:00:00 2001 From: Herbert Duerr Date: Wed, 4 Nov 2009 17:54:50 +0000 Subject: #i105769# force intersection point to be bit-identical on each involved segment --- vcl/unx/source/gdi/salgdi.cxx | 121 +++++++++++++++++++++++++----------------- 1 file changed, 72 insertions(+), 49 deletions(-) diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index 9218708affac..5477ed3b2566 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -1635,22 +1635,42 @@ inline bool operator==( const LineSeg& r1, const LineSeg& r2) return true; } -struct LSYMinCmp { +struct LSYMinCmp +{ bool operator()( const LineSeg& r1, const LineSeg& r2) const { return r2.maLine.p1.y < r1.maLine.p1.y; } }; -struct LSYMaxCmp { +struct LSYMaxCmp +{ bool operator()( const LineSeg& r1, const LineSeg& r2) const { return r2.maLine.p2.y < r1.maLine.p2.y; } }; -struct LSXMinCmp { +struct LSXMinCmp +{ bool operator()( const LineSeg& r1, const LineSeg& r2) const { return( r1.getXMin() < r2.getXMin()); } }; -bool findIntersection( const LineSeg& rLS1, const LineSeg& rLS2, double pCutParams[2]) +struct CutPoint +{ + XFixed mnSegmentId; + float mfCutParam; + XPointFixed maPoint; +}; + +struct CutPointCmp +{ + bool operator()( const CutPoint& r1, const CutPoint& r2) const + { + if( r1.mnSegmentId != r2.mnSegmentId) + return (r1.mnSegmentId < r2.mnSegmentId); + return (r1.mfCutParam < r2.mfCutParam); + } +}; + +bool findIntersection( const LineSeg& rLS1, const LineSeg& rLS2, CutPoint aCutPoints[2]) { // segments intersect at r1.p1 + s*(r1.p2-r1.p1) == r2.p1 + t*(r2.p2-r2.p1) // when both segment-parameters are ((0 = 1-fEps)) return false; - pCutParams[0] = fS; - // check if intersection on second segment + // check if intersecting with second segment const double fT1 = (double)(r1.p2.y - r1.p1.y) * (r1.p1.x - r2.p1.x); const double fT2 = (double)(r1.p2.x - r1.p1.x) * (r2.p1.y - r1.p1.y); const double fT = (fT1 + fT2) / fDet; if( (fT <= +fEps) || (fT >= 1-fEps)) return false; - pCutParams[1] = fT; + // force the intersection point to be exactly identical on both segments + aCutPoints[0].maPoint.x = (XFixed)(r1.p1.x + fS * (r1.p2.x - r1.p1.x)); + aCutPoints[0].maPoint.y = (XFixed)(r1.p1.y + fS * (r1.p2.y - r1.p1.y)); + aCutPoints[1].maPoint.x = aCutPoints[0].maPoint.x; + aCutPoints[1].maPoint.y = aCutPoints[0].maPoint.y; + aCutPoints[0].mnSegmentId = rLS1.mnY; + aCutPoints[0].mfCutParam = (float)fS; + aCutPoints[1].mnSegmentId = rLS2.mnY; + aCutPoints[1].mfCutParam = (float)fT; return true; } typedef std::priority_queue< LineSeg, LSVector, LSYMinCmp> LSYMinQueueBase; typedef std::priority_queue< LineSeg, LSVector, LSYMaxCmp> LSYMaxQueueBase; typedef std::multiset< LineSeg, LSXMinCmp> LSXMinSet; -typedef std::set DoubleSet; +typedef std::set< CutPoint, CutPointCmp> CutPointSet; class LSYMinQueue : public LSYMinQueueBase { @@ -1701,47 +1728,48 @@ public: void reserve( size_t n) { c.reserve(n);} }; -void addAndCutSegment( LSVector& rLSVector, const LineSeg& rLS, DoubleSet& rCutParmSet) +void addAndCutSegment( LSVector& rLSVector, const LineSeg& rLS, CutPointSet& rCutPointSet) { // short circuit when no segment was cut - if( rCutParmSet.empty()) { + if( rCutPointSet.empty()) { rLSVector.push_back( rLS); return; } - // iterate through all cutparms of this segment + // find the first cut point for this segment LineSeg aCS = rLS; - const double fCutMin = rLS.mnY; - DoubleSet::iterator itFirst = rCutParmSet.lower_bound( fCutMin); - DoubleSet::iterator it = itFirst; - for(; it != rCutParmSet.end(); ++it) { - const double fCutParm = (*it) - fCutMin; - if( fCutParm >= 1.0) + CutPoint aMinCutPoint; + aMinCutPoint.mnSegmentId = rLS.mnY; + aMinCutPoint.mfCutParam = 0.0; + CutPointSet::iterator itFirst = rCutPointSet.lower_bound( aMinCutPoint); + CutPointSet::iterator it = itFirst; + // iterate through all cut points of this segment + for(; it != rCutPointSet.end(); ++it) { + const CutPoint rCutPoint = (*it); + if( rCutPoint.mnSegmentId != rLS.mnY) break; - // cut segment at parameter fCutParm - aCS.maLine.p2.x = rLS.maLine.p1.x + (XFixed)(fCutParm * (rLS.maLine.p2.x - rLS.maLine.p1.x)); - aCS.maLine.p2.y = rLS.maLine.p1.y + (XFixed)(fCutParm * (rLS.maLine.p2.y - rLS.maLine.p1.y)); - if( aCS.maLine.p1.y != aCS.maLine.p2.y) - rLSVector.push_back( aCS); + // cut segment at the cutpoint + aCS.maLine.p2 = rCutPoint.maPoint; + rLSVector.push_back( aCS); // prepare for next segment cut aCS.maLine.p1 = aCS.maLine.p2; } // remove cutparams that will no longer be needed // TODO: is it worth it or should we just keep the cutparams? - rCutParmSet.erase( itFirst, it); + rCutPointSet.erase( itFirst, it); // add segment part remaining after last cut aCS.maLine.p2 = rLS.maLine.p2; - if( aCS.maLine.p1.y != aCS.maLine.p2.y) - rLSVector.push_back( aCS); + rLSVector.push_back( aCS); } void splitIntersectingSegments( LSVector& rLSVector) { - for( int i = rLSVector.size(); --i >= 0;) { - LineSeg& rLS = rLSVector[i]; - // get a unique id for each lineseg, temporarily abuse the mnY member - rLS.mnY = i; + // get a unique id for each lineseg, temporarily abuse the mnY member + LSVector::iterator aLSit = rLSVector.begin(); + for( int i = 0; aLSit != rLSVector.end(); ++aLSit) { + LineSeg& rLS = *aLSit; + rLS.mnY = i++; } // get an y-sorted queue from the input vector LSYMinQueue aYMinQueue; @@ -1752,24 +1780,24 @@ void splitIntersectingSegments( LSVector& rLSVector) // try to avoid reallocations by guessing a reasonable result size rLSVector.reserve( aYMinQueue.size() * 1.5); - // find the intersections and record their cut-parameters - DoubleSet aCutParmSet; + // find all intersections + CutPointSet aCutPointSet; LSXMinSet aXMinSet; LSYMaxQueue aYMaxQueue; aYMaxQueue.reserve( aYMinQueue.size()); - // sweep-down and check all segment-pairs that might intersect + // sweep-down and check all segment-pairs that overlap while( !aYMinQueue.empty()) { // get next input-segment const LineSeg& rLS = aYMinQueue.top(); // retire obsoleted segments - const double fYCur = rLS.maLine.p1.y; + const XFixed fYCur = rLS.maLine.p1.y; while( !aYMaxQueue.empty()) { // check next segment to be retired const LineSeg& rOS = aYMaxQueue.top(); if( fYCur < rOS.maLine.p2.y) break; // emit resolved segment into result - addAndCutSegment( rLSVector, rOS, aCutParmSet); + addAndCutSegment( rLSVector, rOS, aCutPointSet); // find segment to be retired in xmin-compare-set LSXMinSet::iterator itR = aXMinSet.lower_bound( rOS); while( !(*itR == rOS)) ++itR; @@ -1781,29 +1809,29 @@ void splitIntersectingSegments( LSVector& rLSVector) // iterate over all segments that might overlap // skip over the leftmost segments that cannot overlap - const double fXMax = rLS.getXMax(); + const XFixed fXMax = rLS.getXMax(); LSXMinSet::const_iterator itC = aXMinSet.begin(); for(; itC != aXMinSet.end(); ++itC) if( (*itC).getXMin() <= fXMax) break; // TODO: if the linear search becomes too expensive // then use an XMaxQueue based approach to replace it - const double fXMin = rLS.getXMin(); + const XFixed fXMin = rLS.getXMin(); for(; itC != aXMinSet.end(); ++itC) { const LineSeg& rOS = *itC; if( fXMin >= rOS.getXMax()) continue; if( fXMax < rOS.getXMin()) break; - double fCutParms[2]; - if( !findIntersection( rLS, rOS, fCutParms)) + CutPoint aCutPoints[2]; + if( !findIntersection( rLS, rOS, aCutPoints)) continue; // remember cut parameters // TODO: std::set seems to use individual allocations // which results in perf-problems for many entries // => pre-allocate nodes by using a non-default allocator - aCutParmSet.insert( rLS.mnY + fCutParms[0]); - aCutParmSet.insert( rOS.mnY + fCutParms[1]); + aCutPointSet.insert( aCutPoints[0]); + aCutPointSet.insert( aCutPoints[1]); } // add segment to xmin-compare-set // TODO: do we have a good insertion hint? @@ -1818,20 +1846,15 @@ void splitIntersectingSegments( LSVector& rLSVector) while( !aYMaxQueue.empty()) { // emit segments and cut them up if needed const LineSeg& rLS = aYMaxQueue.top(); - addAndCutSegment( rLSVector, rLS, aCutParmSet); + addAndCutSegment( rLSVector, rLS, aCutPointSet); aYMaxQueue.pop(); } // get the segments ready to be consumed by the drawPolygon() caller - LSVector::iterator aLSit = rLSVector.begin(); + aLSit = rLSVector.begin(); for(; aLSit != rLSVector.end(); ++aLSit) { LineSeg& rLS = *aLSit; - // prevent integer rounding problems in LSBs - rLS.maLine.p1.x = (rLS.maLine.p1.x + 32) & ~63; - rLS.maLine.p1.y = (rLS.maLine.p1.y + 32) & ~63; - rLS.maLine.p2.x = (rLS.maLine.p2.x + 32) & ~63; - rLS.maLine.p2.y = (rLS.maLine.p2.y + 32) & ~63; - // reset each mnY to y-top of the segment + // restore the segment top member rLS.mnY = rLS.maLine.p1.y; } } -- cgit From 21d48c450e03aac5f0aff5293199f138378c8d17 Mon Sep 17 00:00:00 2001 From: Herbert Duerr Date: Wed, 4 Nov 2009 19:19:30 +0000 Subject: #i105769# final cleanup of the trapezoid converter for OOO320 --- vcl/unx/source/gdi/salgdi.cxx | 78 +++++++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 32 deletions(-) diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index 5477ed3b2566..6ccf7adf1889 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -1152,7 +1152,7 @@ class HTQueue { public: void reserve( size_t n ) { c.reserve( n ); } - void swapvec( HTVector& v) { c.swap( v); } + void swapvec( HTVector& v ) { c.swap( v ); } }; typedef std::vector TrapezoidVector; @@ -1221,7 +1221,7 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly // don't bother with polygons outside of visible area const basegfx::B2DRange aViewRange( 0, 0, GetGraphicsWidth(), GetGraphicsHeight() ); const basegfx::B2DRange aPolyRange = basegfx::tools::getRange( rOrigPolyPoly ); - const bool bNeedViewClip = !aPolyRange.isInside( aViewRange ); + const bool bNeedViewClip = aPolyRange.isInside( aViewRange ); if( !aPolyRange.overlaps( aViewRange ) ) return true; @@ -1249,11 +1249,11 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly continue; #ifndef DISABLE_SOLVECROSSOVER_WORKAROUND - aGoodPolyPoly = aClippedPolygon; for( int nClippedPolyIdx = 0; nClippedPolyIdx < nClippedPolyCount; ++nClippedPolyIdx ) { const ::basegfx::B2DPolygon aSolvedPolygon = aClippedPolygon.getB2DPolygon( nClippedPolyIdx ); const int nPointCount = aSolvedPolygon.count(); + aGoodPolyPoly.append( aSolvedPolygon ); nHTQueueReserve += aSolvedPolygon.areControlPointsUsed() ? 8 * nPointCount : nPointCount; } #else // DISABLE_SOLVECROSSOVER_WORKAROUND @@ -1365,7 +1365,7 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly splitIntersectingSegments( aHTVector); #endif // DISABLE_SOLVECROSSOVER_WORKAROUND - // build queue from vector of intersection free half-trapezoids + // build queue from vector of intersection-free segments // TODO: is replacing the priority-queue by a sorted vector worth it? std::make_heap( aHTVector.begin(), aHTVector.end(), HalfTrapCompare()); HTQueue aHTQueue; @@ -1389,26 +1389,25 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly // get the left side of the trapezoid const HalfTrapezoid& rLeft = aHTQueue.top(); aTrapezoid.top = rLeft.mnY; - aTrapezoid.bottom = rLeft.maLine.p2.y; aTrapezoid.left = rLeft.maLine; aHTQueue.pop(); - // ignore empty trapezoids - if( aTrapezoid.bottom <= aTrapezoid.top ) + // ignore left segment that would result in an empty trapezoid + if( aTrapezoid.left.p2.y <= aTrapezoid.top ) continue; // get the right side of the trapezoid + aTrapezoid.right.p2.y = aTrapezoid.bottom; while( !aHTQueue.empty() ) { const HalfTrapezoid& rRight = aHTQueue.top(); aTrapezoid.right = rRight.maLine; aHTQueue.pop(); - // break when non-horizontal segment found - if( aTrapezoid.right.p2.y > aTrapezoid.right.p1.y ) + // ignore right segment that would result in an empty trapezoid + if( aTrapezoid.right.p2.y > aTrapezoid.top ) break; } - if( aTrapezoid.right.p2.y <= aTrapezoid.top ) // TODO: assert - break; + // the topmost endpoint determines the trapezoid bottom aTrapezoid.bottom = aTrapezoid.left.p2.y; if( aTrapezoid.bottom > aTrapezoid.right.p2.y ) aTrapezoid.bottom = aTrapezoid.right.p2.y; @@ -1416,44 +1415,49 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly // keep the full Trapezoid candidate aTrapVector.push_back( aTrapezoid ); - // unless it splits an older trapezoid + // unless it splits another trapezoid that is still active bool bSplit = false; - for(;;) + ActiveTrapSet::iterator aActiveTrapsIt = aActiveTraps.begin(); + for(; aActiveTrapsIt != aActiveTraps.end(); ++aActiveTrapsIt ) { - // check if the new trapezoid overlaps with another active trapezoid - ActiveTrapSet::iterator aActiveTrapsIt - = aActiveTraps.upper_bound( aTrapVector.size()-1 ); - if( aActiveTrapsIt == aActiveTraps.begin() ) - break; - --aActiveTrapsIt; - XTrapezoid& rLeftTrap = aTrapVector[ *aActiveTrapsIt ]; + // skip until first overlap candidate + // TODO: use stl::*er_bound() instead + if( IsLeftOf( aTrapezoid.left, rLeftTrap.left) ) + continue; + // in the ActiveTrapSet there are still trapezoids where // a vertical overlap with new trapezoids is no longer possible // they could have been removed in the verticaltraps loop below - // but this would have been expensive and is not needed as we can - // simply ignore them now and remove them from the ActiveTrapSet - // so they won't bother us in the future + // but this would be expensive and is not needed as we can + // simply ignore them until we stumble upon them here. if( rLeftTrap.bottom <= aTrapezoid.top ) { - aActiveTraps.erase( aActiveTrapsIt ); + ActiveTrapSet::iterator it = aActiveTrapsIt; + if( aActiveTrapsIt != aActiveTraps.begin() ) + --aActiveTrapsIt; + aActiveTraps.erase( it ); continue; } // check if there is horizontal overlap // aTrapezoid.left==rLeftTrap.right is allowed though if( !IsLeftOf( aTrapezoid.left, rLeftTrap.right ) ) - break; + continue; - // split the old trapezoid and keep its upper part + // prepare to split the old trapezoid and keep its upper part // find the old trapezoids entry in the VerticalTrapSet and remove it typedef std::pair VTSPair; VTSPair aVTSPair = aVerticalTraps.equal_range( *aActiveTrapsIt ); VerticalTrapSet::iterator aVTSit = aVTSPair.first; - for(; (aVTSit != aVTSPair.second) && (*aVTSit != *aActiveTrapsIt); ++aVTSit ) ; - if( aVTSit != aVTSPair.second ) + for(; aVTSit != aVTSPair.second; ++aVTSit ) + { + if( *aVTSit != *aActiveTrapsIt ) + continue; aVerticalTraps.erase( aVTSit ); + break; + } // then update the old trapezoid's bottom rLeftTrap.bottom = aTrapezoid.top; // enter the updated old trapzoid in VerticalTrapSet @@ -1486,24 +1490,26 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly // mark trapezoids that can no longer be split as inactive // and recycle their sides which were not fully resolved static const XFixed nMaxTop = +0x7FFFFFFF; - XFixed nNewTop = aHTQueue.empty() ? nMaxTop : aHTQueue.top().mnY; + const XFixed nNewTop = aHTQueue.empty() ? nMaxTop : aHTQueue.top().mnY; while( !aVerticalTraps.empty() ) { + // check the next trapezoid to be retired const XTrapezoid& rOldTrap = aTrapVector[ *aVerticalTraps.begin() ]; if( nNewTop < rOldTrap.bottom ) break; - // the reference Trapezoid can no longer be split + // this trapezoid can no longer be split aVerticalTraps.erase( aVerticalTraps.begin() ); // recycle its sides that were not fully resolved HalfTrapezoid aHT; aHT.mnY = rOldTrap.bottom; - if( rOldTrap.left.p2.y > rOldTrap.bottom ) + + if( rOldTrap.left.p2.y > aHT.mnY ) { aHT.maLine = rOldTrap.left; aHTQueue.push( aHT ); } - if( rOldTrap.right.p2.y > rOldTrap.bottom ) + if( rOldTrap.right.p2.y > aHT.mnY ) { aHT.maLine = rOldTrap.right; aHTQueue.push( aHT ); @@ -1852,11 +1858,19 @@ void splitIntersectingSegments( LSVector& rLSVector) // get the segments ready to be consumed by the drawPolygon() caller aLSit = rLSVector.begin(); + LSVector::iterator aLSit2 = aLSit; for(; aLSit != rLSVector.end(); ++aLSit) { LineSeg& rLS = *aLSit; // restore the segment top member rLS.mnY = rLS.maLine.p1.y; + // remove horizontal segments for now + // TODO: until the trapezoid converter is adjusted to handle them + if( rLS.maLine.p1.y == rLS.maLine.p2.y ) + continue; + *(aLSit2++) = rLS; } + if(aLSit2 != aLSit) + rLSVector.resize( aLSit2 - rLSVector.begin() ); } } // end anonymous namespace -- cgit From 2e563207e1f067b161282d2181629c070114a4b9 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Wed, 4 Nov 2009 21:54:56 +0100 Subject: #i196421#: some problems with pch on Windows --- unotools/inc/unotools/options.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unotools/inc/unotools/options.hxx b/unotools/inc/unotools/options.hxx index c0eaf5557033..b5664edac2d1 100755 --- a/unotools/inc/unotools/options.hxx +++ b/unotools/inc/unotools/options.hxx @@ -69,7 +69,7 @@ namespace utl { // notify listeners; nHint is an implementation detail of the particular class deriving from ConfigurationBroadcaster void NotifyListeners( sal_uInt32 nHint ); ConfigurationBroadcaster(); - ~ConfigurationBroadcaster(); + virtual ~ConfigurationBroadcaster(); virtual void BlockBroadcasts( bool bBlock ); }; -- cgit From d5419d602489de7df1d9eccd2cbb03c33302f38b Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Thu, 5 Nov 2009 07:05:41 +0000 Subject: fixes for i106470 --- svtools/source/table/tablecontrol.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index 521b1ad819f9..1d7b046ae94b 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -514,6 +514,7 @@ void TableControl::commitGridControlEvent( sal_Int16 _nEventId, const Any& _rNew // ----------------------------------------------------------------------------- Rectangle TableControl::calcHeaderRect(sal_Bool _bIsColumnBar,BOOL _bOnScreen) { + (void)_bOnScreen; Rectangle aRectTable, aRectTableWithHeaders; m_pImpl->impl_getAllVisibleDataCellArea(aRectTable); m_pImpl->impl_getAllVisibleCellsArea(aRectTableWithHeaders); @@ -527,6 +528,7 @@ Rectangle TableControl::calcHeaderRect(sal_Bool _bIsColumnBar,BOOL _bOnScreen) // ----------------------------------------------------------------------------- Rectangle TableControl::calcTableRect(BOOL _bOnScreen) { + (void)_bOnScreen; Rectangle aRect; m_pImpl->impl_getAllVisibleDataCellArea(aRect); return aRect; -- cgit From 633f194aa52df3fa85458f70be7d33d35b9dbf01 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 6 Nov 2009 10:56:40 +0000 Subject: cmcfixes66: #i106673# fix memleak --- i18npool/source/textconversion/genconv_dict.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/i18npool/source/textconversion/genconv_dict.cxx b/i18npool/source/textconversion/genconv_dict.cxx index 23a264603df9..3455cfecd3cc 100644 --- a/i18npool/source/textconversion/genconv_dict.cxx +++ b/i18npool/source/textconversion/genconv_dict.cxx @@ -357,8 +357,8 @@ void make_stc_word(FILE *sfp, FILE *cfp) { sal_Int32 count, i, length; sal_Unicode STC_WordData[0x10000]; - Index *STC_WordEntry_S2T = (Index*) malloc(0x10000 * sizeof(Index)); - Index *STC_WordEntry_T2S = (Index*) malloc(0x10000 * sizeof(Index)); + Index STC_WordEntry_S2T[0x10000]; + Index STC_WordEntry_T2S[0x10000]; sal_Int32 count_S2T = 0, count_T2S = 0; sal_Int32 line = 0, char_total = 0; sal_Char Cstr[1024]; @@ -480,7 +480,5 @@ void make_stc_word(FILE *sfp, FILE *cfp) fprintf (cfp, "\tconst sal_uInt16* getSTC_WordEntry_T2S() { return NULL; }\n"); fprintf (cfp, "\tconst sal_uInt16* getSTC_WordIndex_T2S(sal_Int32& count) { count = 0; return NULL; }\n"); } - free(STC_WordEntry_S2T); - free(STC_WordEntry_T2S); } -- cgit From 3a97ef970ec15962081705be7006ccc2805dedb5 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 6 Nov 2009 11:03:40 +0000 Subject: cmcfixes66: #i106674# fix remaining new[]/delete mismatches --- svtools/source/svdde/ddeml1.cxx | 2 +- svtools/source/svdde/ddesvr.cxx | 2 +- tools/source/fsys/wntmsc.cxx | 2 +- tools/source/stream/strmunx.cxx | 2 +- vcl/os2/source/gdi/salgdi.cxx | 2 +- vcl/os2/source/window/salframe.cxx | 6 +++--- vcl/source/gdi/salmisc.cxx | 8 ++++---- vcl/win/source/window/salframe.cxx | 26 +++++++++++++------------- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/svtools/source/svdde/ddeml1.cxx b/svtools/source/svdde/ddeml1.cxx index 6cc09b612ecf..4b8011627c7d 100644 --- a/svtools/source/svdde/ddeml1.cxx +++ b/svtools/source/svdde/ddeml1.cxx @@ -1089,7 +1089,7 @@ ImpService* ImpDdeMgr::PutService( HSZ hszService ) String aStr( (ULONG)hWndServer ); aStr += pBuf; HSZ hszInstServ = DdeCreateStringHandle( (PSZ)(const char*)pBuf, 850 ); - delete pBuf; + delete [] pBuf; pPtr->hBaseServName = hszService; pPtr->hInstServName = hszInstServ; diff --git a/svtools/source/svdde/ddesvr.cxx b/svtools/source/svdde/ddesvr.cxx index a2124548b4c8..8c72c1713e90 100644 --- a/svtools/source/svdde/ddesvr.cxx +++ b/svtools/source/svdde/ddesvr.cxx @@ -190,7 +190,7 @@ HDDEDATA CALLBACK _export DdeInternal::SvrCallback( pInst->hDdeInstSvr, (LPBYTE) pPairs, sizeof(HSZPAIR) * (nTopics+1), 0, NULL, nCbType, 0); - delete pPairs; + delete [] pPairs; return h; } diff --git a/tools/source/fsys/wntmsc.cxx b/tools/source/fsys/wntmsc.cxx index 0e8e5ebc7918..153fbf37de2e 100644 --- a/tools/source/fsys/wntmsc.cxx +++ b/tools/source/fsys/wntmsc.cxx @@ -91,7 +91,7 @@ struct dirent *readdir( DIR *pDir ) pDir->h = FindFirstFile( pBuf, &pDir->aDirEnt ); bOk = pDir->h != INVALID_HANDLE_VALUE; pDir->p = NULL; - delete pBuf; + delete [] pBuf; } else pDir->h = INVALID_HANDLE_VALUE; diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx index 538c02e78fde..d27fe1f7f2c0 100644 --- a/tools/source/stream/strmunx.cxx +++ b/tools/source/stream/strmunx.cxx @@ -745,7 +745,7 @@ void SvFileStream::Open( const String& rFilename, StreamMode nOpenMode ) aFileCopier.Execute(); } } - delete pBuf; + delete [] pBuf; } } } diff --git a/vcl/os2/source/gdi/salgdi.cxx b/vcl/os2/source/gdi/salgdi.cxx index b6616eb3a24b..082e690c09e7 100644 --- a/vcl/os2/source/gdi/salgdi.cxx +++ b/vcl/os2/source/gdi/salgdi.cxx @@ -1016,7 +1016,7 @@ BOOL Os2SalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* } } - delete pBuf; + delete [] pBuf; return bRet; } diff --git a/vcl/os2/source/window/salframe.cxx b/vcl/os2/source/window/salframe.cxx index 345573b268c3..5e4b843c7cff 100644 --- a/vcl/os2/source/window/salframe.cxx +++ b/vcl/os2/source/window/salframe.cxx @@ -3320,7 +3320,7 @@ static long ImplHandleIMEConversion( Os2SalFrame* pFrame, MPARAM nMP2Param ) if ( pBuf ) { aEvt.maText = XubString( pBuf, (USHORT)nBufLen ); - delete pBuf; + delete [] pBuf; if ( pAttrBuf ) { USHORT nTextLen = aEvt.maText.Len(); @@ -3346,7 +3346,7 @@ static long ImplHandleIMEConversion( Os2SalFrame* pFrame, MPARAM nMP2Param ) } aEvt.mpTextAttr = pSalAttrAry; } - delete pAttrBuf; + delete [] pAttrBuf; } if ( bLastCursor ) aEvt.mnCursorPos = aEvt.maText.Len(); @@ -3358,7 +3358,7 @@ static long ImplHandleIMEConversion( Os2SalFrame* pFrame, MPARAM nMP2Param ) // wieder zerstoeren pFrame->CallCallback( SALEVENT_EXTTEXTINPUT, (void*)&aEvt ); if ( pSalAttrAry ) - delete pSalAttrAry; + delete [] pSalAttrAry; } else pIMEData->mpReleaseIME( hWnd, hIMI ); diff --git a/vcl/source/gdi/salmisc.cxx b/vcl/source/gdi/salmisc.cxx index fc24c0289b50..8b442086eabf 100644 --- a/vcl/source/gdi/salmisc.cxx +++ b/vcl/source/gdi/salmisc.cxx @@ -426,10 +426,10 @@ BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRec // memory exception, clean up // remark: the buffer ptr causing the exception // is still NULL here - delete pSrcScan; - delete pDstScan; - delete pMapX; - delete pMapY; + delete[] pSrcScan; + delete[] pDstScan; + delete[] pMapX; + delete[] pMapY; delete pDstBuffer; return NULL; } diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 78c4e4e6ddcc..53f822a1e409 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -2158,15 +2158,15 @@ static void ImplSalToTop( HWND hWnd, USHORT nFlags ) if ( nFlags & SAL_FRAME_TOTOP_FOREGROUNDTASK ) { - // This magic code is necessary to connect the input focus of the - // current window thread and the thread which owns the window that - // should be the new foreground window. - HWND hCurrWnd = GetForegroundWindow(); - DWORD myThreadID = GetCurrentThreadId(); - DWORD currThreadID = GetWindowThreadProcessId(hCurrWnd,NULL); - AttachThreadInput(myThreadID, currThreadID,TRUE); - SetForegroundWindow(hWnd); - AttachThreadInput(myThreadID,currThreadID,FALSE); + // This magic code is necessary to connect the input focus of the + // current window thread and the thread which owns the window that + // should be the new foreground window. + HWND hCurrWnd = GetForegroundWindow(); + DWORD myThreadID = GetCurrentThreadId(); + DWORD currThreadID = GetWindowThreadProcessId(hCurrWnd,NULL); + AttachThreadInput(myThreadID, currThreadID,TRUE); + SetForegroundWindow(hWnd); + AttachThreadInput(myThreadID,currThreadID,FALSE); } if ( nFlags & SAL_FRAME_TOTOP_RESTOREWHENMIN ) @@ -5436,7 +5436,7 @@ static BOOL ImplHandleIMECompositionInput( WinSalFrame* pFrame, WCHAR* pTextBuf = new WCHAR[nTextLen]; ImmGetCompositionStringW( hIMC, GCS_RESULTSTR, pTextBuf, nTextLen*sizeof( WCHAR ) ); aEvt.maText = XubString( reinterpret_cast(pTextBuf), (xub_StrLen)nTextLen ); - delete pTextBuf; + delete [] pTextBuf; } aEvt.mnCursorPos = aEvt.maText.Len(); @@ -5462,7 +5462,7 @@ static BOOL ImplHandleIMECompositionInput( WinSalFrame* pFrame, WCHAR* pTextBuf = new WCHAR[nTextLen]; ImmGetCompositionStringW( hIMC, GCS_COMPSTR, pTextBuf, nTextLen*sizeof( WCHAR ) ); aEvt.maText = XubString( reinterpret_cast(pTextBuf), (xub_StrLen)nTextLen ); - delete pTextBuf; + delete [] pTextBuf; WIN_BYTE* pAttrBuf = NULL; LONG nAttrLen = ImmGetCompositionStringW( hIMC, GCS_COMPATTR, 0, 0 ); @@ -5498,7 +5498,7 @@ static BOOL ImplHandleIMECompositionInput( WinSalFrame* pFrame, } aEvt.mpTextAttr = pSalAttrAry; - delete pAttrBuf; + delete [] pAttrBuf; } } @@ -5535,7 +5535,7 @@ static BOOL ImplHandleIMECompositionInput( WinSalFrame* pFrame, } if ( pSalAttrAry ) - delete pSalAttrAry; + delete [] pSalAttrAry; } return !bDef; -- cgit From 25ea9e73b66a5747c34cbb82f27d0069c2a677e0 Mon Sep 17 00:00:00 2001 From: Herbert Duerr Date: Fri, 6 Nov 2009 14:37:01 +0000 Subject: #i106572# PDF-export: fix FontDescriptor for embedded Type1 fonts --- vcl/source/gdi/pdfwriter_impl.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index d4fc6fa27117..dd2f4a62c88d 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -3615,6 +3615,7 @@ sal_Int32 PDFWriterImpl::emitFontDescriptor( const ImplFontData* pFont, FontSubs break; case FontSubsetInfo::TYPE1_PFA: case FontSubsetInfo::TYPE1_PFB: + case FontSubsetInfo::ANY_TYPE1: break; default: DBG_ERROR( "unknown fonttype in PDF font descriptor" ); -- cgit From 8239c5f0abf4cfc5b24b31fad64e247b5e343195 Mon Sep 17 00:00:00 2001 From: Herbert Duerr Date: Fri, 6 Nov 2009 14:38:53 +0000 Subject: #i106572# explicitly distinguish between PFA/PFB in DoGetEmbedFontData() result --- vcl/unx/headless/svppspgraphics.cxx | 22 ++++++++++++++-------- vcl/unx/source/gdi/pspgraphics.cxx | 22 ++++++++++++++-------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/vcl/unx/headless/svppspgraphics.cxx b/vcl/unx/headless/svppspgraphics.cxx index 3e9d67bcbbe9..1311aaed4ee4 100644 --- a/vcl/unx/headless/svppspgraphics.cxx +++ b/vcl/unx/headless/svppspgraphics.cxx @@ -986,13 +986,6 @@ const void* PspGraphics::DoGetEmbedFontData( fontID aFont, const sal_Ucs* pUnico return NULL; // fill in font info - switch( aFontInfo.m_eType ) - { - case psp::fonttype::TrueType: rInfo.m_nFontType = FontSubsetInfo::SFNT_TTF; break; - case psp::fonttype::Type1: rInfo.m_nFontType = FontSubsetInfo::ANY_TYPE1; break; - default: - return NULL; - } rInfo.m_nAscent = aFontInfo.m_nAscend; rInfo.m_nDescent = aFontInfo.m_nDescend; rInfo.m_aPSName = rMgr.getPSName( aFont ); @@ -1029,9 +1022,22 @@ const void* PspGraphics::DoGetEmbedFontData( fontID aFont, const sal_Ucs* pUnico rInfo.m_nCapHeight = yMax; // Well ... for( int i = 0; i < 256; i++ ) - pWidths[i] = (aMetrics[i].width > 0 ? aMetrics[i].width : 0); + switch( aFontInfo.m_eType ) + { + case psp::fonttype::TrueType: + rInfo.m_nFontType = FontSubsetInfo::SFNT_TTF; + break; + case psp::fonttype::Type1: { + const bool bPFA = ((*(unsigned char*)pFile) < 0x80); + rInfo.m_nFontType = bPFA ? FontSubsetInfo::TYPE1_PFA : FontSubsetInfo::TYPE1_PFB; + } + break; + default: + return NULL; + } + return pFile; } diff --git a/vcl/unx/source/gdi/pspgraphics.cxx b/vcl/unx/source/gdi/pspgraphics.cxx index 009b14c56062..227d6cd7e9b2 100644 --- a/vcl/unx/source/gdi/pspgraphics.cxx +++ b/vcl/unx/source/gdi/pspgraphics.cxx @@ -1094,13 +1094,6 @@ const void* PspGraphics::DoGetEmbedFontData( fontID aFont, const sal_Ucs* pUnico return NULL; // fill in font info - switch( aFontInfo.m_eType ) - { - case psp::fonttype::TrueType: rInfo.m_nFontType = FontSubsetInfo::SFNT_TTF; break; - case psp::fonttype::Type1: rInfo.m_nFontType = FontSubsetInfo::ANY_TYPE1; break; - default: - return NULL; - } rInfo.m_nAscent = aFontInfo.m_nAscend; rInfo.m_nDescent = aFontInfo.m_nDescend; rInfo.m_aPSName = rMgr.getPSName( aFont ); @@ -1137,9 +1130,22 @@ const void* PspGraphics::DoGetEmbedFontData( fontID aFont, const sal_Ucs* pUnico rInfo.m_nCapHeight = yMax; // Well ... for( int i = 0; i < 256; i++ ) - pWidths[i] = (aMetrics[i].width > 0 ? aMetrics[i].width : 0); + switch( aFontInfo.m_eType ) + { + case psp::fonttype::TrueType: + rInfo.m_nFontType = FontSubsetInfo::SFNT_TTF; + break; + case psp::fonttype::Type1: { + const bool bPFA = ((*(unsigned char*)pFile) < 0x80); + rInfo.m_nFontType = bPFA ? FontSubsetInfo::TYPE1_PFA : FontSubsetInfo::TYPE1_PFB; + } + break; + default: + return NULL; + } + return pFile; } -- cgit From 71b4a7f02742a949904070b1189b5560d68eaba7 Mon Sep 17 00:00:00 2001 From: Herbert Duerr Date: Fri, 6 Nov 2009 14:45:07 +0000 Subject: #i106572# explicitly distinguish between PFA/PFB result also in GetEmbedFontData() --- vcl/win/source/gdi/salgdi3.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index 73f4d8320acc..94ff1fe4e30c 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -2723,7 +2723,8 @@ const void* WinSalGraphics::GetEmbedFontData( const ImplFontData* pFont, TEXTMETRICA aTm; if( !::GetTextMetricsA( mhDC, &aTm ) ) *pDataLen = 0; - rInfo.m_nFontType = FontSubsetInfo::ANY_TYPE1; + const bool bPFA = (*RawFontData.get() < 0x80); + rInfo.m_nFontType = bPFA ? FontSubsetInfo::TYPE1_PFA : FontSubsetInfo::TYPE1_PFB; WCHAR aFaceName[64]; int nFNLen = ::GetTextFaceW( mhDC, 64, aFaceName ); // #i59854# strip eventual null byte -- cgit From dddba26a2f9e03f52980c555cad1303d13848c70 Mon Sep 17 00:00:00 2001 From: Herbert Duerr Date: Mon, 9 Nov 2009 09:30:56 +0000 Subject: #i105880# reset clip region of recycled render pictures --- vcl/unx/source/gdi/salgdi.cxx | 11 ++++++++++- vcl/unx/source/gdi/xrender_peer.cxx | 4 ++++ vcl/unx/source/gdi/xrender_peer.hxx | 14 ++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index 34f2dfd4b935..3349b27148cb 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -1028,11 +1028,12 @@ BOOL X11SalGraphics::drawEPS( long,long,long,long,void*,ULONG ) XID X11SalGraphics::GetXRenderPicture() { + XRenderPeer& rRenderPeer = XRenderPeer::GetInstance(); + if( !m_aRenderPicture ) { // check xrender support for matching visual // find a XRenderPictFormat compatible with the Drawable - XRenderPeer& rRenderPeer = XRenderPeer::GetInstance(); XRenderPictFormat* pVisualFormat = static_cast(GetXRenderFormat()); if( !pVisualFormat ) { @@ -1053,7 +1054,15 @@ XID X11SalGraphics::GetXRenderPicture() // TODO: avoid clipping if already set correctly if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) ) rRenderPeer.SetPictureClipRegion( aDstPic, pClipRegion_ ); + else #endif + { + // reset clip region + // TODO: avoid clip reset if already done + XRenderPictureAttributes aAttr; + aAttr.clip_mask = None; + rRenderPeer.ChangePicture( m_aRenderPicture, CPClipMask, &aAttr ); + } return m_aRenderPicture; } diff --git a/vcl/unx/source/gdi/xrender_peer.cxx b/vcl/unx/source/gdi/xrender_peer.cxx index d8f2045c6fde..fc8de818fafd 100644 --- a/vcl/unx/source/gdi/xrender_peer.cxx +++ b/vcl/unx/source/gdi/xrender_peer.cxx @@ -142,6 +142,10 @@ void XRenderPeer::InitRenderLib() mpXRenderCreatePicture = (Picture(*)(Display*,Drawable,const XRenderPictFormat*, unsigned long,const XRenderPictureAttributes*))pFunc; + pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderChangePicture" ); + if( !pFunc ) return; + mpXRenderChangePicture = (void(*)(Display*,Picture,unsigned long,const XRenderPictureAttributes*))pFunc; + pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderSetPictureClipRegion" ); if( !pFunc ) return; mpXRenderSetPictureClipRegion = (void(*)(Display*,Picture,XLIB_Region))pFunc; diff --git a/vcl/unx/source/gdi/xrender_peer.hxx b/vcl/unx/source/gdi/xrender_peer.hxx index f1e2fd77a273..27c8fb3dcaeb 100644 --- a/vcl/unx/source/gdi/xrender_peer.hxx +++ b/vcl/unx/source/gdi/xrender_peer.hxx @@ -66,6 +66,8 @@ public: const XRenderPictFormat& ) const; Picture CreatePicture( Drawable, const XRenderPictFormat*, unsigned long nDrawable, const XRenderPictureAttributes* ) const; + void ChangePicture( Picture, unsigned long nValueMask, + const XRenderPictureAttributes* ) const; void SetPictureClipRegion( Picture, XLIB_Region ) const; void CompositePicture( int nOp, Picture aSrc, Picture aMask, Picture aDst, int nXSrc, int nYSrc, int nXMask, int nYMask, @@ -103,6 +105,8 @@ private: Picture (*mpXRenderCreatePicture)(Display*,Drawable, const XRenderPictFormat*, unsigned long,const XRenderPictureAttributes*); + void (*mpXRenderChangePicture)(Display*,Picture, + unsigned long,const XRenderPictureAttributes*); void (*mpXRenderSetPictureClipRegion)(Display*,Picture,XLIB_Region); void (*mpXRenderFreePicture)(Display*,Picture); void (*mpXRenderComposite)(Display*,int,Picture,Picture,Picture, @@ -194,6 +198,16 @@ inline Picture XRenderPeer::CreatePicture( Drawable aDrawable, #endif } +inline void XRenderPeer::ChangePicture( Picture aPicture, + unsigned long nValueMask, const XRenderPictureAttributes* pRenderAttr ) const +{ +#ifdef XRENDER_LINK + XRenderChangePicture( mpDisplay, aPicture, nValueMask, pRenderAttr ); +#else + (*mpXRenderChangePicture)( mpDisplay, aPicture, nValueMask, pRenderAttr ); +#endif +} + inline void XRenderPeer::SetPictureClipRegion( Picture aPicture, XLIB_Region aXlibRegion ) const { -- cgit From f213a6f615501541dcee0ff34d8b49ee87354026 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 9 Nov 2009 09:59:57 +0000 Subject: cmcfixes66: #i106673# arrays don't fit in windows default stack --- i18npool/source/textconversion/genconv_dict.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/i18npool/source/textconversion/genconv_dict.cxx b/i18npool/source/textconversion/genconv_dict.cxx index 3455cfecd3cc..a49bf3031bbc 100644 --- a/i18npool/source/textconversion/genconv_dict.cxx +++ b/i18npool/source/textconversion/genconv_dict.cxx @@ -39,6 +39,8 @@ #include #include +#include + using namespace ::rtl; void make_hhc_char(FILE *sfp, FILE *cfp); @@ -357,8 +359,8 @@ void make_stc_word(FILE *sfp, FILE *cfp) { sal_Int32 count, i, length; sal_Unicode STC_WordData[0x10000]; - Index STC_WordEntry_S2T[0x10000]; - Index STC_WordEntry_T2S[0x10000]; + std::vector STC_WordEntry_S2T(0x10000); + std::vector STC_WordEntry_T2S(0x10000); sal_Int32 count_S2T = 0, count_T2S = 0; sal_Int32 line = 0, char_total = 0; sal_Char Cstr[1024]; @@ -416,7 +418,7 @@ void make_stc_word(FILE *sfp, FILE *cfp) sal_uInt16 STC_WordIndex[0x100]; if (count_S2T > 0) { - qsort(STC_WordEntry_S2T, count_S2T, sizeof(Index), Index_comp); + qsort(&STC_WordEntry_S2T[0], count_S2T, sizeof(Index), Index_comp); fprintf(cfp, "\nstatic const sal_uInt16 STC_WordEntry_S2T[] = {"); count = 0; @@ -449,7 +451,7 @@ void make_stc_word(FILE *sfp, FILE *cfp) } if (count_T2S > 0) { - qsort(STC_WordEntry_T2S, count_T2S, sizeof(Index), Index_comp); + qsort(&STC_WordEntry_T2S[0], count_T2S, sizeof(Index), Index_comp); fprintf(cfp, "\nstatic const sal_uInt16 STC_WordEntry_T2S[] = {"); count = 0; -- cgit From 9b4b1b5a1cc6448e0195e7f871393fdfbf59c857 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Mon, 9 Nov 2009 13:14:29 +0100 Subject: wrong assertion --- vcl/source/app/settings.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index acfb7988b9bd..10db065af0c7 100755 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -1736,7 +1736,7 @@ ULONG AllSettings::Update( ULONG nFlags, const AllSettings& rSet ) if ( nFlags & SETTINGS_UILOCALE ) { - DBG_ERROR("UILocale can't be changed!"); + // UILocale can't be changed } return nChangeFlags; -- cgit From 81ad8eff32ac87a05b52f7718ebaf7dc85eff7c9 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 9 Nov 2009 14:20:19 +0100 Subject: #i103482# add oxygen icon theme --- vcl/inc/vcl/settings.hxx | 7 ++++--- vcl/inc/vcl/toolbox.h | 1 + vcl/source/app/settings.cxx | 5 +++++ vcl/source/window/toolbox2.cxx | 3 +++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx index 2cccc253c809..fda4a8f22d5a 100644 --- a/vcl/inc/vcl/settings.hxx +++ b/vcl/inc/vcl/settings.hxx @@ -521,9 +521,10 @@ private: #define STYLE_SYMBOLS_HICONTRAST ((ULONG)2) #define STYLE_SYMBOLS_INDUSTRIAL ((ULONG)3) #define STYLE_SYMBOLS_CRYSTAL ((ULONG)4) -#define STYLE_SYMBOLS_TANGO ((ULONG)5) -#define STYLE_SYMBOLS_CLASSIC ((ULONG)6) -#define STYLE_SYMBOLS_THEMES_MAX ((ULONG)7) +#define STYLE_SYMBOLS_TANGO ((ULONG)5) +#define STYLE_SYMBOLS_OXYGEN ((ULONG)6) +#define STYLE_SYMBOLS_CLASSIC ((ULONG)7) +#define STYLE_SYMBOLS_THEMES_MAX ((ULONG)8) #define STYLE_CURSOR_NOBLINKTIME ((ULONG)0xFFFFFFFF) diff --git a/vcl/inc/vcl/toolbox.h b/vcl/inc/vcl/toolbox.h index 52a0db40b226..2dee85ab6b82 100644 --- a/vcl/inc/vcl/toolbox.h +++ b/vcl/inc/vcl/toolbox.h @@ -51,6 +51,7 @@ #define TB_LARGEIMAGESIZE 26 #define TB_LARGEIMAGESIZE_INDUSTRIAL 24 #define TB_LARGEIMAGESIZE_CRYSTAL 22 +#define TB_LARGEIMAGESIZE_OXYGEN 22 class Window; diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 55fe97a2b25a..d3bc81d63582 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -708,6 +708,7 @@ void StyleSettings::Set3DColors( const Color& rColor ) case STYLE_SYMBOLS_INDUSTRIAL: return ::rtl::OUString::createFromAscii( "industrial" ); case STYLE_SYMBOLS_CRYSTAL: return ::rtl::OUString::createFromAscii( "crystal" ); case STYLE_SYMBOLS_TANGO: return ::rtl::OUString::createFromAscii( "tango" ); + case STYLE_SYMBOLS_OXYGEN: return ::rtl::OUString::createFromAscii( "oxygen" ); case STYLE_SYMBOLS_CLASSIC: return ::rtl::OUString::createFromAscii( "classic" ); } @@ -728,6 +729,8 @@ ULONG StyleSettings::ImplNameToSymbolsStyle( const ::rtl::OUString &rName ) cons return STYLE_SYMBOLS_CRYSTAL; else if ( rName == ::rtl::OUString::createFromAscii( "tango" ) ) return STYLE_SYMBOLS_TANGO; + else if ( rName == ::rtl::OUString::createFromAscii( "oxygen" ) ) + return STYLE_SYMBOLS_OXYGEN; else if ( rName == ::rtl::OUString::createFromAscii( "classic" ) ) return STYLE_SYMBOLS_CLASSIC; @@ -819,6 +822,8 @@ ULONG StyleSettings::GetAutoSymbolsStyle() const nRet = STYLE_SYMBOLS_TANGO; else if( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde" ) ) nRet = STYLE_SYMBOLS_CRYSTAL; + else if( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde4" ) ) + nRet = STYLE_SYMBOLS_OXYGEN; } // falback to any existing style diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 9ec86fab20de..ecc335420f18 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -1002,6 +1002,9 @@ const Size& ToolBox::GetDefaultImageSize() const case STYLE_SYMBOLS_CRYSTAL: aLargeButtonSize = Size( TB_LARGEIMAGESIZE_CRYSTAL, TB_LARGEIMAGESIZE_CRYSTAL ); break; + case STYLE_SYMBOLS_OXYGEN: + aLargeButtonSize = Size( TB_LARGEIMAGESIZE_OXYGEN, TB_LARGEIMAGESIZE_OXYGEN ); + break; default: aLargeButtonSize = Size( TB_LARGEIMAGESIZE, TB_LARGEIMAGESIZE ); } -- cgit From 78eccc15fcc68cb77a1a7a3bbf529e1d363c944d Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 9 Nov 2009 18:22:51 +0100 Subject: vcl107: #i91205# add document path menu on Mac --- vcl/aqua/inc/salframe.h | 3 ++- vcl/aqua/source/window/salframe.cxx | 24 +++++++++++++++++++----- vcl/inc/vcl/salframe.hxx | 1 + vcl/inc/vcl/syswin.hxx | 4 ++++ vcl/source/app/salvtables.cxx | 7 +++++++ vcl/source/window/syswin.cxx | 24 ++++++++++++++++++++++++ 6 files changed, 57 insertions(+), 6 deletions(-) diff --git a/vcl/aqua/inc/salframe.h b/vcl/aqua/inc/salframe.h index 1d1eb3cb6bd3..5ddd96dae34d 100644 --- a/vcl/aqua/inc/salframe.h +++ b/vcl/aqua/inc/salframe.h @@ -121,6 +121,7 @@ public: virtual BOOL PostEvent( void* pData ); virtual void SetTitle( const XubString& rTitle ); virtual void SetIcon( USHORT nIcon ); + virtual void SetRepresentedURL( const rtl::OUString& ); virtual void SetMenu( SalMenu* pSalMenu ); virtual void DrawMenuBar(); virtual void Show( BOOL bVisible, BOOL bNoActivate = FALSE ); @@ -140,7 +141,7 @@ public: virtual void SetPointer( PointerStyle ePointerStyle ); virtual void CaptureMouse( BOOL bMouse ); virtual void SetPointerPos( long nX, long nY ); - virtual void Flush( void); + virtual void Flush( void ); virtual void Flush( const Rectangle& ); virtual void Sync(); virtual void SetInputContext( SalInputContext* pContext ); diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx index b942c97cead1..7fe3b93ef2e8 100644 --- a/vcl/aqua/source/window/salframe.cxx +++ b/vcl/aqua/source/window/salframe.cxx @@ -54,10 +54,7 @@ #include "boost/assert.hpp" #include "vcl/svapp.hxx" #include "rtl/ustrbuf.hxx" - -#include -#include -#include +#include "osl/file.h" using namespace std; @@ -329,8 +326,25 @@ void AquaSalFrame::SetTitle(const XubString& rTitle) // ----------------------------------------------------------------------- -void AquaSalFrame::SetIcon( USHORT nIcon ) +void AquaSalFrame::SetIcon( USHORT ) +{ +} + +// ----------------------------------------------------------------------- + +void AquaSalFrame::SetRepresentedURL( const rtl::OUString& i_rDocURL ) { + if( i_rDocURL.indexOfAsciiL( "file:", 5 ) == 0 ) + { + rtl::OUString aSysPath; + osl_getSystemPathFromFileURL( i_rDocURL.pData, &aSysPath.pData ); + NSString* pStr = CreateNSString( aSysPath ); + if( pStr ) + { + [pStr autorelease]; + [mpWindow setRepresentedFilename: pStr]; + } + } } // ----------------------------------------------------------------------- diff --git a/vcl/inc/vcl/salframe.hxx b/vcl/inc/vcl/salframe.hxx index 0e3f4e94a0b3..b95f7036ad19 100644 --- a/vcl/inc/vcl/salframe.hxx +++ b/vcl/inc/vcl/salframe.hxx @@ -170,6 +170,7 @@ public: virtual void SetTitle( const XubString& rTitle ) = 0; virtual void SetIcon( USHORT nIcon ) = 0; + virtual void SetRepresentedURL( const rtl::OUString& ); virtual void SetMenu( SalMenu *pSalMenu ) = 0; virtual void DrawMenuBar() = 0; diff --git a/vcl/inc/vcl/syswin.hxx b/vcl/inc/vcl/syswin.hxx index 99a340ae4a58..d590cfe0a37e 100644 --- a/vcl/inc/vcl/syswin.hxx +++ b/vcl/inc/vcl/syswin.hxx @@ -201,6 +201,10 @@ public: void SetIcon( USHORT nIcon ); USHORT GetIcon() const { return mnIcon; } + // for systems like MacOSX which can display the URL a document is loaded from + // separately from the window title + void SetRepresentedURL( const rtl::OUString& ); + const rtl::OUString& GetRepresentedURL() const; void SetZLevel( BYTE nLevel ); BYTE GetZLevel() const; diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 9d398aef10cd..516b23dd76be 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -61,6 +61,13 @@ void SalFrame::Flush( const Rectangle& ) // ----------------------------------------------------------------------- +void SalFrame::SetRepresentedURL( const rtl::OUString& ) +{ + // currently this is Mac only functionality +} + +// ----------------------------------------------------------------------- + SalInstance::~SalInstance() { } diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index f3ce8b2d05ea..2d99fbb20b65 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -62,6 +62,7 @@ public: TaskPaneList* mpTaskPaneList; Size maMaxOutSize; + rtl::OUString maRepresentedURL; }; SystemWindow::ImplData::ImplData() @@ -277,6 +278,29 @@ void SystemWindow::SetZLevel( BYTE nLevel ) // ----------------------------------------------------------------------- +void SystemWindow::SetRepresentedURL( const rtl::OUString& i_rURL ) +{ + bool bChanged = (i_rURL != mpImplData->maRepresentedURL); + mpImplData->maRepresentedURL = i_rURL; + if ( !mbSysChild && bChanged ) + { + const Window* pWindow = this; + while ( pWindow->mpWindowImpl->mpBorderWindow ) + pWindow = pWindow->mpWindowImpl->mpBorderWindow; + + if ( pWindow->mpWindowImpl->mbFrame ) + pWindow->mpWindowImpl->mpFrame->SetRepresentedURL( i_rURL ); + } +} +// ----------------------------------------------------------------------- + +const rtl::OUString& SystemWindow::GetRepresentedURL() const +{ + return mpImplData->maRepresentedURL; +} + +// ----------------------------------------------------------------------- + void SystemWindow::SetIcon( USHORT nIcon ) { if ( mnIcon == nIcon ) -- cgit From b3d69ae9c69f1f331acc4f6393f7248a54bb9d2c Mon Sep 17 00:00:00 2001 From: Herbert Duerr Date: Tue, 10 Nov 2009 11:17:06 +0000 Subject: #i106572# fixed typo --- vcl/win/source/gdi/salgdi3.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index 94ff1fe4e30c..cb6b19f98492 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -2723,7 +2723,7 @@ const void* WinSalGraphics::GetEmbedFontData( const ImplFontData* pFont, TEXTMETRICA aTm; if( !::GetTextMetricsA( mhDC, &aTm ) ) *pDataLen = 0; - const bool bPFA = (*RawFontData.get() < 0x80); + const bool bPFA = (*aRawFontData.get() < 0x80); rInfo.m_nFontType = bPFA ? FontSubsetInfo::TYPE1_PFA : FontSubsetInfo::TYPE1_PFB; WCHAR aFaceName[64]; int nFNLen = ::GetTextFaceW( mhDC, 64, aFaceName ); -- cgit From ec0694539bf368dc89fed212ea3ef860a758782f Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Wed, 11 Nov 2009 07:25:37 +0100 Subject: #i103496#: sandbox removed --- toolkit/qa/complex/toolkit/interface_tests/makefile.mk | 2 +- toolkit/qa/complex/toolkit/makefile.mk | 2 +- toolkit/src2xml/include.lst | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/toolkit/qa/complex/toolkit/interface_tests/makefile.mk b/toolkit/qa/complex/toolkit/interface_tests/makefile.mk index 8c9cb27ecd04..ed7855663f36 100755 --- a/toolkit/qa/complex/toolkit/interface_tests/makefile.mk +++ b/toolkit/qa/complex/toolkit/interface_tests/makefile.mk @@ -40,7 +40,7 @@ PACKAGE = complex$/toolkit$/interface_tests #----- compile .java files ----------------------------------------- -JARFILES = mysql.jar sandbox.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar +JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar JAVAFILES = _XAccessibleComponent.java \ _XAccessibleContext.java \ _XAccessibleExtendedComponent.java \ diff --git a/toolkit/qa/complex/toolkit/makefile.mk b/toolkit/qa/complex/toolkit/makefile.mk index b375d1d5b238..c895c8403498 100755 --- a/toolkit/qa/complex/toolkit/makefile.mk +++ b/toolkit/qa/complex/toolkit/makefile.mk @@ -40,7 +40,7 @@ PACKAGE = complex$/toolkit #----- compile .java files ----------------------------------------- -JARFILES = mysql.jar sandbox.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar +JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar JAVAFILES = CheckAccessibleStatusBar.java CheckAccessibleStatusBarItem.java CheckAsyncCallback.java CallbackClass.java JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) SUBDIRS = interface_tests diff --git a/toolkit/src2xml/include.lst b/toolkit/src2xml/include.lst index 7b35ccc73c73..d4be6f5e3517 100644 --- a/toolkit/src2xml/include.lst +++ b/toolkit/src2xml/include.lst @@ -128,7 +128,6 @@ ../../cppcanvas/inc ../../cppcanvas/source/inc ../../cppcanvas/unxlngi6.pro/inc -../../sandbox/unxlngi6.pro/inc ../../eventattacher/unxlngi6.pro/inc ../../unotools/inc ../../unotools/unxlngi6.pro/inc @@ -301,4 +300,4 @@ ../../cli_ure/inc ../../cli_ure/unxlngi6.pro/inc ../../psprint/inc -../../psprint/unxlngi6.pro/inc \ No newline at end of file +../../psprint/unxlngi6.pro/inc -- cgit From 0b8b4fd0168fbf648488ce575eabc830d0a5dd16 Mon Sep 17 00:00:00 2001 From: Herbert Duerr Date: Wed, 11 Nov 2009 17:00:15 +0000 Subject: #i106572# fix PDF-export with type1 fonts on win --- vcl/win/source/gdi/salgdi3.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index cb6b19f98492..2ce549f785e6 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -557,7 +557,7 @@ static ImplDevFontAttributes WinFont2DevFontAttributes( const ENUMLOGFONTEXA& rE if( 0 != (rMetric.ntmFlags & (NTM_TT_OPENTYPE | NTM_PS_OPENTYPE)) || 0 != (rMetric.tmPitchAndFamily & TMPF_TRUETYPE)) aDFA.mbSubsettable = true; - else if( 0 != (rMetric.tmPitchAndFamily & NTM_TYPE1) ) // TODO: implement subsetting for type1 too + else if( 0 != (rMetric.ntmFlags & NTM_TYPE1) ) // TODO: implement subsetting for type1 too aDFA.mbEmbeddable = true; // heuristics for font quality @@ -636,7 +636,7 @@ static ImplDevFontAttributes WinFont2DevFontAttributes( const ENUMLOGFONTEXW& rE if( 0 != (rMetric.ntmFlags & (NTM_TT_OPENTYPE | NTM_PS_OPENTYPE)) || 0 != (rMetric.tmPitchAndFamily & TMPF_TRUETYPE)) aDFA.mbSubsettable = true; - else if( 0 != (rMetric.tmPitchAndFamily & NTM_TYPE1) ) // TODO: implement subsetting for type1 too + else if( 0 != (rMetric.ntmFlags & NTM_TYPE1) ) // TODO: implement subsetting for type1 too aDFA.mbEmbeddable = true; // heuristics for font quality -- cgit From b48c0ede8f74ff21415a216a08001e3a129c23f3 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 12 Nov 2009 19:07:34 +0100 Subject: vcl107: #i103482# support oxygen theme also in config item --- svtools/inc/imgdef.hxx | 11 ---------- svtools/source/config/miscopt.cxx | 42 +++------------------------------------ 2 files changed, 3 insertions(+), 50 deletions(-) diff --git a/svtools/inc/imgdef.hxx b/svtools/inc/imgdef.hxx index e5b682d91bfe..2881fe5150bc 100644 --- a/svtools/inc/imgdef.hxx +++ b/svtools/inc/imgdef.hxx @@ -38,17 +38,6 @@ enum SfxSymbolsSize SFX_SYMBOLS_SIZE_AUTO }; -enum SfxSymbolsStyle -{ - SFX_SYMBOLS_STYLE_AUTO, - SFX_SYMBOLS_STYLE_DEFAULT, - SFX_SYMBOLS_STYLE_HICONTRAST, - SFX_SYMBOLS_STYLE_INDUSTRIAL, - SFX_SYMBOLS_STYLE_CRYSTAL, - SFX_SYMBOLS_STYLE_TANGO, - SFX_SYMBOLS_STYLE_CLASSIC -}; - #define SFX_TOOLBOX_CHANGESYMBOLSET 0x0001 #define SFX_TOOLBOX_CHANGEOUTSTYLE 0x0002 #define SFX_TOOLBOX_CHANGEBUTTONTYPE 0x0004 diff --git a/svtools/source/config/miscopt.cxx b/svtools/source/config/miscopt.cxx index 7a6dc4281da6..c712abfa1a29 100644 --- a/svtools/source/config/miscopt.cxx +++ b/svtools/source/config/miscopt.cxx @@ -260,42 +260,6 @@ class SvtMiscOptions_Impl : public ConfigItem void ImplSetSymbolsStyle( bool bValue, sal_Int16 nSet, const ::rtl::OUString &rName ); }; -//_________________________________________________________________________________________________________________ -// definitions -//_________________________________________________________________________________________________________________ - -static sal_Int16 implSymbolsStyleFromVCL( ULONG nStyle ) -{ - switch ( nStyle ) - { - case STYLE_SYMBOLS_AUTO: return SFX_SYMBOLS_STYLE_AUTO; - case STYLE_SYMBOLS_DEFAULT: return SFX_SYMBOLS_STYLE_DEFAULT; - case STYLE_SYMBOLS_HICONTRAST: return SFX_SYMBOLS_STYLE_HICONTRAST; - case STYLE_SYMBOLS_INDUSTRIAL: return SFX_SYMBOLS_STYLE_INDUSTRIAL; - case STYLE_SYMBOLS_CRYSTAL: return SFX_SYMBOLS_STYLE_CRYSTAL; - case STYLE_SYMBOLS_TANGO: return SFX_SYMBOLS_STYLE_TANGO; - case STYLE_SYMBOLS_CLASSIC: return SFX_SYMBOLS_STYLE_CLASSIC; - } - - return SFX_SYMBOLS_STYLE_AUTO; -} - -static ULONG implSymbolsStyleToVCL( sal_Int16 nStyle ) -{ - switch ( nStyle ) - { - case SFX_SYMBOLS_STYLE_AUTO: return STYLE_SYMBOLS_AUTO; - case SFX_SYMBOLS_STYLE_DEFAULT: return STYLE_SYMBOLS_DEFAULT; - case SFX_SYMBOLS_STYLE_HICONTRAST: return STYLE_SYMBOLS_HICONTRAST; - case SFX_SYMBOLS_STYLE_INDUSTRIAL: return STYLE_SYMBOLS_INDUSTRIAL; - case SFX_SYMBOLS_STYLE_CRYSTAL: return STYLE_SYMBOLS_CRYSTAL; - case SFX_SYMBOLS_STYLE_TANGO: return STYLE_SYMBOLS_TANGO; - case SFX_SYMBOLS_STYLE_CLASSIC: return STYLE_SYMBOLS_CLASSIC; - } - - return STYLE_SYMBOLS_AUTO; -} - //***************************************************************************************************************** // constructor //***************************************************************************************************************** @@ -543,7 +507,7 @@ void SvtMiscOptions_Impl::SetSymbolsSize( sal_Int16 nSet ) sal_Int16 SvtMiscOptions_Impl::GetSymbolsStyle() const { - return implSymbolsStyleFromVCL( Application::GetSettings().GetStyleSettings().GetSymbolsStyle() ); + return (sal_Int16)Application::GetSettings().GetStyleSettings().GetSymbolsStyle(); } ::rtl::OUString SvtMiscOptions_Impl::GetSymbolsStyleName() const @@ -553,7 +517,7 @@ sal_Int16 SvtMiscOptions_Impl::GetSymbolsStyle() const sal_Int16 SvtMiscOptions_Impl::GetCurrentSymbolsStyle() const { - return implSymbolsStyleFromVCL( Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyle() ); + return (sal_Int16)Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyle(); } void SvtMiscOptions_Impl::ImplSetSymbolsStyle( bool bValue, sal_Int16 nSet, const ::rtl::OUString &rName ) @@ -565,7 +529,7 @@ void SvtMiscOptions_Impl::ImplSetSymbolsStyle( bool bValue, sal_Int16 nSet, cons StyleSettings aStyleSettings = aAllSettings.GetStyleSettings(); if ( bValue ) - aStyleSettings.SetSymbolsStyle( implSymbolsStyleToVCL( nSet ) ); + aStyleSettings.SetSymbolsStyle( nSet ); else aStyleSettings.SetSymbolsStyleName( rName ); -- cgit From 2f144f86f48f4bbe9b309e35ccac8810467c4416 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 13 Nov 2009 11:06:34 +0000 Subject: #i106889# upgrade expat to 2.0.1 --- sax/source/expatwrap/sax_expat.cxx | 4 ---- sax/source/fastparser/fastparser.hxx | 4 ---- transex3/inc/xmlparse.hxx | 4 ---- transex3/source/help/HelpLinker.cxx | 4 ---- 4 files changed, 16 deletions(-) diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx index e1f5161b7e3a..b1726f750127 100644 --- a/sax/source/expatwrap/sax_expat.cxx +++ b/sax/source/expatwrap/sax_expat.cxx @@ -46,11 +46,7 @@ #include #include -#ifdef SYSTEM_EXPAT #include -#else -#include "expat/xmlparse.h" -#endif using namespace ::rtl; using namespace ::std; diff --git a/sax/source/fastparser/fastparser.hxx b/sax/source/fastparser/fastparser.hxx index 07cb6afac77d..3e6220a0c782 100644 --- a/sax/source/fastparser/fastparser.hxx +++ b/sax/source/fastparser/fastparser.hxx @@ -42,11 +42,7 @@ #include #include -#ifdef SYSTEM_EXPAT #include -#else -#include "expat/xmlparse.h" -#endif #include "xml2utf.hxx" #include diff --git a/transex3/inc/xmlparse.hxx b/transex3/inc/xmlparse.hxx index a497355d6201..18b047ef75c1 100644 --- a/transex3/inc/xmlparse.hxx +++ b/transex3/inc/xmlparse.hxx @@ -32,11 +32,7 @@ #define BOOTSTRP_XMLPARSE_HXX #include -#ifdef SYSTEM_EXPAT #include -#else -#include -#endif #include #include #include "tools/string.hxx" diff --git a/transex3/source/help/HelpLinker.cxx b/transex3/source/help/HelpLinker.cxx index 19b9ead8521e..47d9181a75a0 100644 --- a/transex3/source/help/HelpLinker.cxx +++ b/transex3/source/help/HelpLinker.cxx @@ -45,11 +45,7 @@ #include #include -#ifdef SYSTEM_EXPAT #include -#else -#include -#endif #define DBHELP_ONLY -- cgit From 92add3dfd55926c3a8526750fe5569771e8adc26 Mon Sep 17 00:00:00 2001 From: Herbert Duerr Date: Mon, 16 Nov 2009 11:37:51 +0000 Subject: #i106941# register app-specific fonts again after the 3-layer changes for OOo32 --- vcl/win/source/gdi/salgdi3.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index 2ce549f785e6..d82830a9022f 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -2162,7 +2162,7 @@ void WinSalGraphics::GetDevFontList( ImplDevFontList* pFontList ) ::rtl::OUString aExecutableFile( aPath ); aPath = aPath.copy( 0, aPath.lastIndexOf('/') ); String aFontDirUrl = aPath.copy( 0, aPath.lastIndexOf('/') ); - aFontDirUrl += String( RTL_CONSTASCII_USTRINGPARAM("/share/fonts/truetype") ); + aFontDirUrl += String( RTL_CONSTASCII_USTRINGPARAM("/Basis/share/fonts/truetype") ); // collect fonts in font path that could not be registered osl::Directory aFontDir( aFontDirUrl ); -- cgit From efc43491417daa4f382bf4c54d6aa1dd2b158ea8 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Mon, 16 Nov 2009 13:48:33 +0100 Subject: validityref: #i103899# manual migration from svn (contribution from PengYunQuan) --- tools/source/memtools/table.cxx | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/tools/source/memtools/table.cxx b/tools/source/memtools/table.cxx index ba0dbb8a90f9..75aafddb6c58 100644 --- a/tools/source/memtools/table.cxx +++ b/tools/source/memtools/table.cxx @@ -125,26 +125,37 @@ BOOL Table::Insert( ULONG nKey, void* p ) { USHORT n = 0; USHORT nTempCount = (USHORT)nCount * 2; - void** pNodes = Container::ImpGetOnlyNodes(); - ULONG nCompareKey = (ULONG)(*pNodes); - while ( nKey > nCompareKey ) + //Modified by PengYunQuan for resolving a NULL pointer access } else { -- cgit From 23fe446722559c904e317d9bad2b94820109fc91 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Tue, 17 Nov 2009 13:37:57 +0000 Subject: #i106901# work around a crash when getting input from keyboard viewer --- vcl/aqua/source/window/salframeview.mm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm index 0305b4cadb43..aabc287dc885 100755 --- a/vcl/aqua/source/window/salframeview.mm +++ b/vcl/aqua/source/window/salframeview.mm @@ -1332,11 +1332,32 @@ private: { mbNeedSpecialKeyHandle = true; } + + // FIXME: + // #i106901# + // if we come here outside of mbInKeyInput, this is likely to be because + // of the keyboard viewer. For unknown reasons having no marked range + // in this case causes a crash. So we say we have a marked range anyway + // This is a hack, since it is not understood what a) causes that crash + // and b) why we should have a marked range at this point. + if( ! mbInKeyInput ) + bHasMarkedText = YES; + return bHasMarkedText; } - (NSRange)markedRange { + // FIXME: + // #i106901# + // if we come here outside of mbInKeyInput, this is likely to be because + // of the keyboard viewer. For unknown reasons having no marked range + // in this case causes a crash. So we say we have a marked range anyway + // This is a hack, since it is not understood what a) causes that crash + // and b) why we should have a marked range at this point. + if( ! mbInKeyInput ) + return NSMakeRange( 0, 0 ); + return [self hasMarkedText] ? mMarkedRange : NSMakeRange( NSNotFound, 0 ); } -- cgit From 4eefccc8a3a0e0baac52647624e1a8c24244cdf1 Mon Sep 17 00:00:00 2001 From: Herbert Duerr Date: Wed, 18 Nov 2009 09:37:27 +0000 Subject: #i106980# fix psprinting of hairline beziers (thanks thb!) --- vcl/unx/source/printergfx/common_gfx.cxx | 66 ++++++++++---------------------- 1 file changed, 21 insertions(+), 45 deletions(-) diff --git a/vcl/unx/source/printergfx/common_gfx.cxx b/vcl/unx/source/printergfx/common_gfx.cxx index 632f0d70aa2f..9b305ff323ba 100644 --- a/vcl/unx/source/printergfx/common_gfx.cxx +++ b/vcl/unx/source/printergfx/common_gfx.cxx @@ -7,7 +7,6 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: common_gfx.cxx,v $ - * $Revision: 1.20.18.1 $ * * This file is part of OpenOffice.org. * @@ -535,68 +534,47 @@ PrinterGfx::DrawPolyLineBezier (sal_uInt32 nPoints, const Point* pPath, const BY const sal_uInt32 nBezString = 1024; sal_Char pString[nBezString]; - if ( maLineColor.Is() && nPoints && pPath ) + if ( nPoints > 1 && maLineColor.Is() && pPath ) { PSSetColor (maLineColor); PSSetColor (); PSSetLineWidth (); - if (pFlgAry[0] != POLY_NORMAL) //There must be a starting point to moveto - { - return; - } - else - { - snprintf(pString, nBezString, "%li %li moveto\n", pPath[0].X(), pPath[0].Y()); - WritePS(mpPageBody, pString); - } + snprintf(pString, nBezString, "%li %li moveto\n", pPath[0].X(), pPath[0].Y()); + WritePS(mpPageBody, pString); // Handle the drawing of mixed lines mixed with curves // - a normal point followed by a normal point is a line // - a normal point followed by 2 control points and a normal point is a curve for (unsigned int i=1; i= nPoints) return; //Make sure we don't pass the end of the array snprintf(pString, nBezString, "%li %li lineto\n", pPath[i].X(), pPath[i].Y()); i++; } else //Otherwise we're drawing a spline { - if (i+3 >= nPoints) return; //Make sure we don't pass the end of the array - snprintf(pString, nBezString, "%li %li %li %li %li %li curveto\n", - pPath[i+1].X(), pPath[i+1].Y(), - pPath[i+2].X(), pPath[i+2].Y(), - pPath[i+3].X(), pPath[i+3].Y()); + if (i+2 >= nPoints) + return; //Error: wrong sequence of contol/normal points somehow + if ((pFlgAry[i] == POLY_CONTROL) && (pFlgAry[i+1] == POLY_CONTROL) && + (pFlgAry[i+2] != POLY_CONTROL)) + { + snprintf(pString, nBezString, "%li %li %li %li %li %li curveto\n", + pPath[i].X(), pPath[i].Y(), + pPath[i+1].X(), pPath[i+1].Y(), + pPath[i+2].X(), pPath[i+2].Y()); + } + else + { + DBG_ERROR( "PrinterGfx::DrawPolyLineBezier: Strange output" ); + } i+=3; } WritePS(mpPageBody, pString); } - } - - // if eofill and stroke, save the current path - if( maFillColor.Is() && maLineColor.Is()) - PSGSave(); - - // first draw area - if( maFillColor.Is() ) - { - PSSetColor (maFillColor); - PSSetColor (); - WritePS (mpPageBody, "eofill\n"); - } - - // restore the current path - if( maFillColor.Is() && maLineColor.Is()) - PSGRestore(); - // now draw outlines - if( maLineColor.Is() ) - { - PSSetColor (maLineColor); - PSSetColor (); - PSSetLineWidth (); + // now draw outlines WritePS (mpPageBody, "stroke\n"); } } @@ -635,7 +613,7 @@ PrinterGfx::DrawPolygonBezier (sal_uInt32 nPoints, const Point* pPath, const BYT } else { - fprintf(stderr, "Strange output\n"); + DBG_ERROR( "PrinterGfx::DrawPolygonBezier: Strange output" ); } i+=3; } @@ -699,9 +677,7 @@ PrinterGfx::DrawPolyPolygonBezier (sal_uInt32 nPoly, const sal_uInt32 * pPoints, } else { -#if OSL_DEBUG_LEVEL > 1 - fprintf(stderr, "Strange output\n"); -#endif + DBG_ERROR( "PrinterGfx::DrawPolyPolygonBezier: Strange output" ); } j+=3; } -- cgit From 72b6e82f7534a183f38354e032ca9099c1a42f17 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Wed, 18 Nov 2009 17:50:36 +0100 Subject: #i107009# source_config file / multiple repository support in l10n tools --- transex3/inc/export.hxx | 7 +- transex3/inc/gsicheck.hxx | 131 ++++++++++++++++++++++++++ transex3/inc/inireader.hxx | 52 +++++++++++ transex3/inc/treeconfig.hxx | 28 ++++++ transex3/source/cfgmerge.cxx | 6 +- transex3/source/export2.cxx | 13 ++- transex3/source/gsicheck.hxx | 131 -------------------------- transex3/source/hw2fw.cxx | 202 ----------------------------------------- transex3/source/inireader.cxx | 132 +++++++++++++++++++++++++++ transex3/source/localize.cxx | 169 +++++++++++----------------------- transex3/source/makefile.mk | 29 +++--- transex3/source/treeconfig.cxx | 119 ++++++++++++++++++++++++ transex3/source/txtconv.cxx | 168 ---------------------------------- transex3/source/xrmmerge.cxx | 6 +- 14 files changed, 550 insertions(+), 643 deletions(-) create mode 100644 transex3/inc/gsicheck.hxx create mode 100644 transex3/inc/inireader.hxx create mode 100644 transex3/inc/treeconfig.hxx delete mode 100644 transex3/source/gsicheck.hxx delete mode 100644 transex3/source/hw2fw.cxx create mode 100644 transex3/source/inireader.cxx create mode 100644 transex3/source/treeconfig.cxx delete mode 100644 transex3/source/txtconv.cxx diff --git a/transex3/inc/export.hxx b/transex3/inc/export.hxx index 3d7eee8e1eaf..b9c83af56ba0 100644 --- a/transex3/inc/export.hxx +++ b/transex3/inc/export.hxx @@ -51,6 +51,7 @@ #include /* std::set*/ #include /* std::vector*/ #include +#include #define NO_TRANSLATE_ISO "x-no-translate" @@ -326,7 +327,6 @@ public: static bool skipProject( ByteString sPrj ) ; - static ByteString sIsoCode99; static void InitLanguages( bool bMergeMode = false ); static void InitForcedLanguages( bool bMergeMode = false ); static std::vector GetLanguages(); @@ -349,12 +349,12 @@ public: static bool isSourceLanguage( const ByteString &sLanguage ); static bool isAllowed( const ByteString &sLanguage ); - //static bool isMergingGermanAllowed( const ByteString& rPrj ); static bool LanguageAllowed( const ByteString &nLanguage ); static void Languages( std::vector::const_iterator& begin , std::vector::const_iterator& end ); static void getRandomName( const ByteString& sPrefix , ByteString& sRandStr , const ByteString& sPostfix ); static void getRandomName( ByteString& sRandStr ); + static void getCurrentDir( std::string& dir ); static void replaceEncoding( ByteString& rString ); @@ -517,8 +517,6 @@ private: public: MergeDataFile( const ByteString &rFileName, const ByteString& rFile , BOOL bErrLog, CharSet aCharSet, bool bCaseSensitive = false ); -// MergeDataFile( const ByteString &rFileName, const ByteString& rFile , BOOL bErrLog, CharSet aCharSet -// ); ~MergeDataFile(); @@ -538,7 +536,6 @@ public: static ByteString CreateKey( const ByteString& rTYP , const ByteString& rGID , const ByteString& rLID , const ByteString& rFilename , bool bCaseSensitive = false ); ByteString Dump(); -// void WriteErrorLog( const ByteString &rFileName ); void WriteError( const ByteString &rLine ); }; diff --git a/transex3/inc/gsicheck.hxx b/transex3/inc/gsicheck.hxx new file mode 100644 index 000000000000..13debcfc7106 --- /dev/null +++ b/transex3/inc/gsicheck.hxx @@ -0,0 +1,131 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: gsicheck.hxx,v $ + * $Revision: 1.8.22.1 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _GSICHECK_HXX_ +#define _GSICHECK_HXX_ + +#include "tagtest.hxx" + +// +// class GSILine +// +enum LineFormat { FORMAT_GSI, FORMAT_SDF, FORMAT_UNKNOWN }; + +class GSILine : public ByteString +{ +private: + + ParserMessageList aMessages; + LineFormat aFormat; + ULONG nLineNumber; + + ByteString aUniqId; + ByteString aLineType; + ByteString aLangId; + ByteString aText; + ByteString aQuickHelpText; + ByteString aTitle; + + BOOL bOK; + BOOL bFixed; + + void ReassembleLine(); + +public: + GSILine( const ByteString &rLine, ULONG nLine ); + LineFormat GetLineFormat() const { return aFormat; } + ULONG GetLineNumber() const { return nLineNumber; } + + ByteString const GetUniqId() const { return aUniqId; } + ByteString const GetLineType() const { return aLineType; } + ByteString const GetLanguageId() const { return aLangId; } + ByteString const GetText() const { return aText; } + String const GetUText() const { return String( aText, RTL_TEXTENCODING_UTF8 ); } + ByteString const GetQuickHelpText() const { return aQuickHelpText; } + ByteString const GetTitle() const { return aTitle; } + + void SetUText( String &aNew ) { aText = ByteString( aNew, RTL_TEXTENCODING_UTF8 ); ReassembleLine(); } + void SetText( ByteString &aNew ) { aText = aNew; ReassembleLine(); } + void SetQuickHelpText( ByteString &aNew ) { aQuickHelpText = aNew; ReassembleLine(); } + void SetTitle( ByteString &aNew ) { aTitle = aNew; ReassembleLine(); } + + ParserMessageList* GetMessageList() { return &aMessages; }; + BOOL HasMessages(){ return ( aMessages.Count() > 0 ); }; + + BOOL IsOK() const { return bOK; } + void NotOK(); + + BOOL IsFixed() const { return bFixed; } + void SetFixed() { bFixed = TRUE; }; +}; + +// +// class GSIBlock +// + +DECLARE_LIST( GSIBlock_Impl, GSILine * ) + +class LazySvFileStream; + +class GSIBlock : public GSIBlock_Impl +{ +private: + GSILine *pSourceLine; + GSILine *pReferenceLine; + void PrintList( ParserMessageList *pList, ByteString aPrefix, GSILine *pLine ); + BOOL bPrintContext; + BOOL bCheckSourceLang; + BOOL bCheckTranslationLang; + BOOL bReference; + BOOL bAllowKeyIDs; + BOOL bAllowSuspicious; + + BOOL bHasBlockError; + + BOOL IsUTF8( const ByteString &aTestee, BOOL bFixTags, USHORT &nErrorPos, ByteString &aErrorMsg, BOOL &bHasBeenFixed, ByteString &aFixed ) const; + BOOL TestUTF8( GSILine* pTestee, BOOL bFixTags ); + BOOL HasSuspiciousChars( GSILine* pTestee, GSILine* pSource ); + +public: + GSIBlock( BOOL PbPrintContext, BOOL bSource, BOOL bTrans, BOOL bRef, BOOL bAllowKID, BOOL bAllowSusp ); + ~GSIBlock(); + void PrintMessage( ByteString aType, ByteString aMsg, ByteString aPrefix, ByteString aContext, ULONG nLine, ByteString aUniqueId = ByteString() ); + void PrintError( ByteString aMsg, ByteString aPrefix, ByteString aContext, ULONG nLine, ByteString aUniqueId = ByteString() ); + void InsertLine( GSILine* pLine, const ByteString aSourceLang); + void SetReferenceLine( GSILine* pLine ); + BOOL CheckSyntax( ULONG nLine, BOOL bRequireSourceLine, BOOL bFixTags ); + + void WriteError( LazySvFileStream &aErrOut, BOOL bRequireSourceLine ); + void WriteCorrect( LazySvFileStream &aOkOut, BOOL bRequireSourceLine ); + void WriteFixed( LazySvFileStream &aFixOut, BOOL bRequireSourceLine ); +}; + +#endif + diff --git a/transex3/inc/inireader.hxx b/transex3/inc/inireader.hxx new file mode 100644 index 000000000000..0861290adf9f --- /dev/null +++ b/transex3/inc/inireader.hxx @@ -0,0 +1,52 @@ +#include +#include +#include + +using namespace std; + +namespace transex3 +{ + +struct eqstr +{ + bool operator()( const string s1 , const string s2) const + { + return s1.compare( s2 ) == 0; + } +}; + +typedef std::hash_map< string , string > stringmap; +typedef std::hash_map< string, stringmap* > INImap; + +class INIreader +{ + private: + UErrorCode section_status; + UErrorCode parameter_status; + RegexMatcher* section_match; + RegexMatcher* parameter_match; + + public: + INIreader(): section_status ( U_ZERO_ERROR ) , + parameter_status ( U_ZERO_ERROR ) + { + section_match = new RegexMatcher ( "^\\s*\\[([a-zA-Z0-9]*)\\].*" , 0 , section_status ); + parameter_match = new RegexMatcher ( "^\\s*([a-zA-Z0-9]*)\\s*=\\s*([a-zA-Z0-9 ]*).*" , 0 , parameter_status ) ; + } + ~INIreader() + { + delete section_match; + delete parameter_match; + } + // open "filename", fill hash_map with sections / paramaters + bool read( INImap& myMap , string& filename ); + + private: + bool is_section( string& line , string& section_str ); + bool is_parameter( string& line , string& parameter_key , string& parameter_value ); + inline void check_status( UErrorCode status ); + inline void toStlString ( const UnicodeString& str, string& stl_str ); + inline void trim( string& str ); +}; + +} diff --git a/transex3/inc/treeconfig.hxx b/transex3/inc/treeconfig.hxx new file mode 100644 index 000000000000..96d693b0d376 --- /dev/null +++ b/transex3/inc/treeconfig.hxx @@ -0,0 +1,28 @@ +#include +#include + +#include "inireader.hxx" + +namespace transex3{ + +class Treeconfig +{ + + private: + INIreader inireader; + INImap map; + bool has_config_file; + void getCurrentDir( string& dir ); + bool isConfigFilePresent(); + + public: + + Treeconfig() : has_config_file( false ) { parseConfig(); } + // read the config file, returns true in case a config file had been found + bool parseConfig(); + // returns a string vector containing all active repositories, returns true in case we are deep inside + // of a source tree. This could affect the behavour of the tool + bool getActiveRepositories( vector& active_repos); +}; + +} diff --git a/transex3/source/cfgmerge.cxx b/transex3/source/cfgmerge.cxx index 21b4aeff185d..7f92ad8ac721 100644 --- a/transex3/source/cfgmerge.cxx +++ b/transex3/source/cfgmerge.cxx @@ -172,9 +172,9 @@ extern char *GetOutputFile( int argc, char* argv[]) Export::sLanguages = ByteString( argv[ i ]); } break; - case STATE_ISOCODE99: { - Export::sIsoCode99 = ByteString( argv[ i ]); - } +// case STATE_ISOCODE99: { +// Export::sIsoCode99 = ByteString( argv[ i ]); +// } break; } } diff --git a/transex3/source/export2.cxx b/transex3/source/export2.cxx index 5db1067a7afb..7815e80e033f 100644 --- a/transex3/source/export2.cxx +++ b/transex3/source/export2.cxx @@ -42,6 +42,7 @@ #include #include #include +#include using namespace std; // @@ -93,7 +94,7 @@ ResData::~ResData() /*****************************************************************************/ ByteString Export::sLanguages; ByteString Export::sForcedLanguages; -ByteString Export::sIsoCode99; +//ByteString Export::sIsoCode99; /*****************************************************************************/ void Export::DumpExportList( ByteString& sListName , ExportList& aList ){ @@ -648,6 +649,16 @@ int Export::getCurrentDirectory( rtl::OUString& base_fqurl_out, rtl::OUString& b return osl::File::getFileURLFromSystemPath( base_out , base_fqurl_out ); } +void Export::getCurrentDir( string& dir ) +{ + char buffer[64000]; + if( getcwd( buffer , sizeof( buffer ) ) == 0 ){ + cerr << "Error: getcwd failed!\n"; + exit( -1 ); + } + dir = string( buffer ); +} + // Stolen from sal/osl/unx/tempfile.c diff --git a/transex3/source/gsicheck.hxx b/transex3/source/gsicheck.hxx deleted file mode 100644 index 13debcfc7106..000000000000 --- a/transex3/source/gsicheck.hxx +++ /dev/null @@ -1,131 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: gsicheck.hxx,v $ - * $Revision: 1.8.22.1 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _GSICHECK_HXX_ -#define _GSICHECK_HXX_ - -#include "tagtest.hxx" - -// -// class GSILine -// -enum LineFormat { FORMAT_GSI, FORMAT_SDF, FORMAT_UNKNOWN }; - -class GSILine : public ByteString -{ -private: - - ParserMessageList aMessages; - LineFormat aFormat; - ULONG nLineNumber; - - ByteString aUniqId; - ByteString aLineType; - ByteString aLangId; - ByteString aText; - ByteString aQuickHelpText; - ByteString aTitle; - - BOOL bOK; - BOOL bFixed; - - void ReassembleLine(); - -public: - GSILine( const ByteString &rLine, ULONG nLine ); - LineFormat GetLineFormat() const { return aFormat; } - ULONG GetLineNumber() const { return nLineNumber; } - - ByteString const GetUniqId() const { return aUniqId; } - ByteString const GetLineType() const { return aLineType; } - ByteString const GetLanguageId() const { return aLangId; } - ByteString const GetText() const { return aText; } - String const GetUText() const { return String( aText, RTL_TEXTENCODING_UTF8 ); } - ByteString const GetQuickHelpText() const { return aQuickHelpText; } - ByteString const GetTitle() const { return aTitle; } - - void SetUText( String &aNew ) { aText = ByteString( aNew, RTL_TEXTENCODING_UTF8 ); ReassembleLine(); } - void SetText( ByteString &aNew ) { aText = aNew; ReassembleLine(); } - void SetQuickHelpText( ByteString &aNew ) { aQuickHelpText = aNew; ReassembleLine(); } - void SetTitle( ByteString &aNew ) { aTitle = aNew; ReassembleLine(); } - - ParserMessageList* GetMessageList() { return &aMessages; }; - BOOL HasMessages(){ return ( aMessages.Count() > 0 ); }; - - BOOL IsOK() const { return bOK; } - void NotOK(); - - BOOL IsFixed() const { return bFixed; } - void SetFixed() { bFixed = TRUE; }; -}; - -// -// class GSIBlock -// - -DECLARE_LIST( GSIBlock_Impl, GSILine * ) - -class LazySvFileStream; - -class GSIBlock : public GSIBlock_Impl -{ -private: - GSILine *pSourceLine; - GSILine *pReferenceLine; - void PrintList( ParserMessageList *pList, ByteString aPrefix, GSILine *pLine ); - BOOL bPrintContext; - BOOL bCheckSourceLang; - BOOL bCheckTranslationLang; - BOOL bReference; - BOOL bAllowKeyIDs; - BOOL bAllowSuspicious; - - BOOL bHasBlockError; - - BOOL IsUTF8( const ByteString &aTestee, BOOL bFixTags, USHORT &nErrorPos, ByteString &aErrorMsg, BOOL &bHasBeenFixed, ByteString &aFixed ) const; - BOOL TestUTF8( GSILine* pTestee, BOOL bFixTags ); - BOOL HasSuspiciousChars( GSILine* pTestee, GSILine* pSource ); - -public: - GSIBlock( BOOL PbPrintContext, BOOL bSource, BOOL bTrans, BOOL bRef, BOOL bAllowKID, BOOL bAllowSusp ); - ~GSIBlock(); - void PrintMessage( ByteString aType, ByteString aMsg, ByteString aPrefix, ByteString aContext, ULONG nLine, ByteString aUniqueId = ByteString() ); - void PrintError( ByteString aMsg, ByteString aPrefix, ByteString aContext, ULONG nLine, ByteString aUniqueId = ByteString() ); - void InsertLine( GSILine* pLine, const ByteString aSourceLang); - void SetReferenceLine( GSILine* pLine ); - BOOL CheckSyntax( ULONG nLine, BOOL bRequireSourceLine, BOOL bFixTags ); - - void WriteError( LazySvFileStream &aErrOut, BOOL bRequireSourceLine ); - void WriteCorrect( LazySvFileStream &aOkOut, BOOL bRequireSourceLine ); - void WriteFixed( LazySvFileStream &aFixOut, BOOL bRequireSourceLine ); -}; - -#endif - diff --git a/transex3/source/hw2fw.cxx b/transex3/source/hw2fw.cxx deleted file mode 100644 index dd77b8d9210c..000000000000 --- a/transex3/source/hw2fw.cxx +++ /dev/null @@ -1,202 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: hw2fw.cxx,v $ - * $Revision: 1.4 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_transex3.hxx" -#include - -struct hw_pair -{ - sal_Unicode nFrom; - sal_Unicode nTo; -}; - -#define MAKE_PAIR(a,b) { a, b } - -static struct hw_pair aHWPairs[] = -{ - MAKE_PAIR( 0xFF65, 0x30FB ), // HALFWIDTH KATAKANA MIDDLE DOT --> KATAKANA MIDDLE DOT - MAKE_PAIR( 0xFF66, 0x30F2 ), // HALFWIDTH KATAKANA LETTER WO --> KATAKANA LETTER WO - MAKE_PAIR( 0xFF67, 0x30A1 ), // HALFWIDTH KATAKANA LETTER SMALL A --> KATAKANA LETTER SMALL A - MAKE_PAIR( 0xFF68, 0x30A3 ), // HALFWIDTH KATAKANA LETTER SMALL I --> KATAKANA LETTER SMALL I - MAKE_PAIR( 0xFF69, 0x30A5 ), // HALFWIDTH KATAKANA LETTER SMALL U --> KATAKANA LETTER SMALL U - MAKE_PAIR( 0xFF6A, 0x30A7 ), // HALFWIDTH KATAKANA LETTER SMALL E --> KATAKANA LETTER SMALL E - MAKE_PAIR( 0xFF6B, 0x30A9 ), // HALFWIDTH KATAKANA LETTER SMALL O --> KATAKANA LETTER SMALL O - MAKE_PAIR( 0xFF6C, 0x30E3 ), // HALFWIDTH KATAKANA LETTER SMALL YA --> KATAKANA LETTER SMALL YA - MAKE_PAIR( 0xFF6D, 0x30E5 ), // HALFWIDTH KATAKANA LETTER SMALL YU --> KATAKANA LETTER SMALL YU - MAKE_PAIR( 0xFF6E, 0x30E7 ), // HALFWIDTH KATAKANA LETTER SMALL YO --> KATAKANA LETTER SMALL YO - MAKE_PAIR( 0xFF6F, 0x30C3 ), // HALFWIDTH KATAKANA LETTER SMALL TU --> KATAKANA LETTER SMALL TU - MAKE_PAIR( 0xFF70, 0x30FC ), // HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK --> KATAKANA-HIRAGANA PROLONGED SOUND MARK - MAKE_PAIR( 0xFF71, 0x30A2 ), // HALFWIDTH KATAKANA LETTER A --> KATAKANA LETTER A - MAKE_PAIR( 0xFF72, 0x30A4 ), // HALFWIDTH KATAKANA LETTER I --> KATAKANA LETTER I - MAKE_PAIR( 0xFF73, 0x30A6 ), // HALFWIDTH KATAKANA LETTER U --> KATAKANA LETTER U - MAKE_PAIR( 0xFF74, 0x30A8 ), // HALFWIDTH KATAKANA LETTER E --> KATAKANA LETTER E - MAKE_PAIR( 0xFF75, 0x30AA ), // HALFWIDTH KATAKANA LETTER O --> KATAKANA LETTER O - MAKE_PAIR( 0xFF76, 0x30AB ), // HALFWIDTH KATAKANA LETTER KA --> KATAKANA LETTER KA - MAKE_PAIR( 0xFF77, 0x30AD ), // HALFWIDTH KATAKANA LETTER KI --> KATAKANA LETTER KI - MAKE_PAIR( 0xFF78, 0x30AF ), // HALFWIDTH KATAKANA LETTER KU --> KATAKANA LETTER KU - MAKE_PAIR( 0xFF79, 0x30B1 ), // HALFWIDTH KATAKANA LETTER KE --> KATAKANA LETTER KE - MAKE_PAIR( 0xFF7A, 0x30B3 ), // HALFWIDTH KATAKANA LETTER KO --> KATAKANA LETTER KO - MAKE_PAIR( 0xFF7B, 0x30B5 ), // HALFWIDTH KATAKANA LETTER SA --> KATAKANA LETTER SA - MAKE_PAIR( 0xFF7C, 0x30B7 ), // HALFWIDTH KATAKANA LETTER SI --> KATAKANA LETTER SI - MAKE_PAIR( 0xFF7D, 0x30B9 ), // HALFWIDTH KATAKANA LETTER SU --> KATAKANA LETTER SU - MAKE_PAIR( 0xFF7E, 0x30BB ), // HALFWIDTH KATAKANA LETTER SE --> KATAKANA LETTER SE - MAKE_PAIR( 0xFF7F, 0x30BD ), // HALFWIDTH KATAKANA LETTER SO --> KATAKANA LETTER SO - MAKE_PAIR( 0xFF80, 0x30BF ), // HALFWIDTH KATAKANA LETTER TA --> KATAKANA LETTER TA - MAKE_PAIR( 0xFF81, 0x30C1 ), // HALFWIDTH KATAKANA LETTER TI --> KATAKANA LETTER TI - MAKE_PAIR( 0xFF82, 0x30C4 ), // HALFWIDTH KATAKANA LETTER TU --> KATAKANA LETTER TU - MAKE_PAIR( 0xFF83, 0x30C6 ), // HALFWIDTH KATAKANA LETTER TE --> KATAKANA LETTER TE - MAKE_PAIR( 0xFF84, 0x30C8 ), // HALFWIDTH KATAKANA LETTER TO --> KATAKANA LETTER TO - MAKE_PAIR( 0xFF85, 0x30CA ), // HALFWIDTH KATAKANA LETTER NA --> KATAKANA LETTER NA - MAKE_PAIR( 0xFF86, 0x30CB ), // HALFWIDTH KATAKANA LETTER NI --> KATAKANA LETTER NI - MAKE_PAIR( 0xFF87, 0x30CC ), // HALFWIDTH KATAKANA LETTER NU --> KATAKANA LETTER NU - MAKE_PAIR( 0xFF88, 0x30CD ), // HALFWIDTH KATAKANA LETTER NE --> KATAKANA LETTER NE - MAKE_PAIR( 0xFF89, 0x30CE ), // HALFWIDTH KATAKANA LETTER NO --> KATAKANA LETTER NO - MAKE_PAIR( 0xFF8A, 0x30CF ), // HALFWIDTH KATAKANA LETTER HA --> KATAKANA LETTER HA - MAKE_PAIR( 0xFF8B, 0x30D2 ), // HALFWIDTH KATAKANA LETTER HI --> KATAKANA LETTER HI - MAKE_PAIR( 0xFF8C, 0x30D5 ), // HALFWIDTH KATAKANA LETTER HU --> KATAKANA LETTER HU - MAKE_PAIR( 0xFF8D, 0x30D8 ), // HALFWIDTH KATAKANA LETTER HE --> KATAKANA LETTER HE - MAKE_PAIR( 0xFF8E, 0x30DB ), // HALFWIDTH KATAKANA LETTER HO --> KATAKANA LETTER HO - MAKE_PAIR( 0xFF8F, 0x30DE ), // HALFWIDTH KATAKANA LETTER MA --> KATAKANA LETTER MA - MAKE_PAIR( 0xFF90, 0x30DF ), // HALFWIDTH KATAKANA LETTER MI --> KATAKANA LETTER MI - MAKE_PAIR( 0xFF91, 0x30E0 ), // HALFWIDTH KATAKANA LETTER MU --> KATAKANA LETTER MU - MAKE_PAIR( 0xFF92, 0x30E1 ), // HALFWIDTH KATAKANA LETTER ME --> KATAKANA LETTER ME - MAKE_PAIR( 0xFF93, 0x30E2 ), // HALFWIDTH KATAKANA LETTER MO --> KATAKANA LETTER MO - MAKE_PAIR( 0xFF94, 0x30E4 ), // HALFWIDTH KATAKANA LETTER YA --> KATAKANA LETTER YA - MAKE_PAIR( 0xFF95, 0x30E6 ), // HALFWIDTH KATAKANA LETTER YU --> KATAKANA LETTER YU - MAKE_PAIR( 0xFF96, 0x30E8 ), // HALFWIDTH KATAKANA LETTER YO --> KATAKANA LETTER YO - MAKE_PAIR( 0xFF97, 0x30E9 ), // HALFWIDTH KATAKANA LETTER RA --> KATAKANA LETTER RA - MAKE_PAIR( 0xFF98, 0x30EA ), // HALFWIDTH KATAKANA LETTER RI --> KATAKANA LETTER RI - MAKE_PAIR( 0xFF99, 0x30EB ), // HALFWIDTH KATAKANA LETTER RU --> KATAKANA LETTER RU - MAKE_PAIR( 0xFF9A, 0x30EC ), // HALFWIDTH KATAKANA LETTER RE --> KATAKANA LETTER RE - MAKE_PAIR( 0xFF9B, 0x30ED ), // HALFWIDTH KATAKANA LETTER RO --> KATAKANA LETTER RO - MAKE_PAIR( 0xFF9C, 0x30EF ), // HALFWIDTH KATAKANA LETTER WA --> KATAKANA LETTER WA - MAKE_PAIR( 0xFF9D, 0x30F3 ), // HALFWIDTH KATAKANA LETTER N --> KATAKANA LETTER N - MAKE_PAIR( 0xFF9E, 0x3099 ), // HALFWIDTH KATAKANA VOICED SOUND MARK --> COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK - MAKE_PAIR( 0xFF9F, 0x309A ) // HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK --> COMBINING KATAKANA- -}; - - -static struct hw_pair aCombine3099[] = -{ - { 0x30a6, 0x30f4 }, - { 0x30ab, 0x30ac }, - { 0x30ad, 0x30ae }, - { 0x30af, 0x30b0 }, - { 0x30b1, 0x30b2 }, - { 0x30b3, 0x30b4 }, - { 0x30b5, 0x30b6 }, - { 0x30b7, 0x30b8 }, - { 0x30b9, 0x30ba }, - { 0x30bb, 0x30bc }, - { 0x30bd, 0x30be }, - { 0x30bf, 0x30c0 }, - { 0x30c1, 0x30c2 }, - { 0x30c4, 0x30c5 }, - { 0x30c6, 0x30c7 }, - { 0x30c8, 0x30c9 }, - { 0x30cf, 0x30d0 }, - { 0x30d2, 0x30d3 }, - { 0x30d5, 0x30d6 }, - { 0x30d8, 0x30d9 }, - { 0x30db, 0x30dc }, - { 0x30ef, 0x30f7 }, - { 0x30f0, 0x30f8 }, - { 0x30f1, 0x30f9 }, - { 0x30f2, 0x30fa }, - { 0x30fd, 0x30fe } -}; - -static struct hw_pair aCombine309A[] = -{ - { 0x30cf, 0x30d1 }, - { 0x30d2, 0x30d4 }, - { 0x30d5, 0x30d7 }, - { 0x30d8, 0x30da }, - { 0x30db, 0x30dd } -}; - -USHORT ImplReplaceFullWidth( sal_Unicode* pString, USHORT nLen ) -{ - sal_Unicode* pRead = pString; - sal_Unicode* pWrite = pRead; - USHORT nNewLen = nLen; - - while( (pRead - pString) < nLen ) - { - if( pWrite != pRead ) - *pWrite = *pRead; - - if( *pRead >= 0xff65 && *pRead <= 0xff9f ) - { - *pWrite = aHWPairs[ *pRead - 0xff65 ].nTo; - - struct hw_pair* pTable = NULL; - int nTableEntries = 0; - if( *pWrite == 0x3099 ) - { - // replace 0x3099 combinations - pTable = aCombine3099; - nTableEntries = sizeof(aCombine3099)/sizeof(aCombine3099[0]); - } - else if( *pWrite == 0x309a ) - { - // replace 0x309a combinations - pTable = aCombine309A; - nTableEntries = sizeof(aCombine309A)/sizeof(aCombine309A[0]); - } - if( pTable ) - { - sal_Unicode c = pWrite[-1]; - for( int i = 0; i < nTableEntries; i++ ) - if( c == pTable[i].nFrom ) - { - pWrite--; - *pWrite = pTable[i].nTo; - nNewLen--; - break; - } - } - } - pRead++; - pWrite++; - } - if( pWrite < pRead ) - *pWrite = 0; - - return nNewLen; -} - -void ConvertHalfwitdhToFullwidth( String& rString ) -{ - USHORT nNewLen = ImplReplaceFullWidth( rString.GetBufferAccess(), rString.Len() ); - rString.ReleaseBufferAccess( nNewLen ); -} diff --git a/transex3/source/inireader.cxx b/transex3/source/inireader.cxx new file mode 100644 index 000000000000..0985e788452d --- /dev/null +++ b/transex3/source/inireader.cxx @@ -0,0 +1,132 @@ +#include +#include +#include +#include +#include +#include "inireader.hxx" + +using namespace std; +namespace transex3 +{ + +bool INIreader::read( INImap& myMap , string& filename ) +{ + ifstream aFStream( filename.c_str() ); + if( aFStream && aFStream.is_open()) + { + string line; + string section; + string param_key; + string param_value; + stringmap* myvalues = 0; + + while( std::getline( aFStream , line ) ) + { + trim( line ); + if( line.empty() ){ + } + else if( is_section( line , section ) ) + { + //cerr << "[" << section << "]\n"; + myvalues = new stringmap(); + myMap[ section ] = myvalues ; + } + else if ( is_parameter( line , param_key , param_value ) ) + { + //cerr << "" << param_key << " = " << param_value << "\n"; + if( myvalues ) + { + (*myvalues)[ param_key ] = param_value ; + } + else + { + cerr << "ERROR: The INI file " << filename << " appears to be broken ... parameters without a section?!?\n"; + if( aFStream.is_open() ) aFStream.close(); + return false; + } + } + } + + if( aFStream.is_open() ) + aFStream.close(); + + return true; + } + else + { + cerr << "ERROR: Can't open file '" << filename << "'\n"; + } + return false; +} + +bool INIreader::is_section( string& line , string& section_str ) +{ + // Error in regex ? + check_status( section_status ); + UnicodeString target( line.c_str() , line.length() ); + + section_match->reset( target ); + check_status( section_status ); + + if( section_match->find() ) + { + check_status( section_status ); + UnicodeString result( section_match->group( 1 , section_status) ); + check_status( section_status ); + toStlString( result , section_str ); + + return true; + } + return false; +} + +bool INIreader::is_parameter( string& line , string& parameter_key , string& parameter_value ) +{ + // Error in regex ? + check_status( parameter_status ); + UnicodeString target( line.c_str() , line.length() ); + + parameter_match->reset( target ); + check_status( parameter_status ); + + if( parameter_match->find() ) + { + check_status( parameter_status ); + + UnicodeString result1( parameter_match->group( 1 , parameter_status) ); + check_status( parameter_status ); + toStlString( result1 , parameter_key ); + UnicodeString result2( parameter_match->group( 2 , parameter_status) ); + check_status( parameter_status ); + toStlString( result2 , parameter_value ); + + return true; + } + return false; +} + +void INIreader::check_status( UErrorCode status ) +{ + if( U_FAILURE( status) ) + { + cerr << "Error in or while using regex: " << u_errorName( status ) << "\n"; + exit(-1); + } +} + +void INIreader::toStlString( const UnicodeString& str , string& stl_str) +{ + // convert to string + char* buffer = new char[ str.length()*3 ]; + str.extract( 0 , str.length() , buffer ); + stl_str = string( buffer ); + delete buffer; +} + +void INIreader::trim( string& str ) +{ + string str1 = str.substr( 0 , str.find_last_not_of(' ') + 1 ); + str = str1.empty() ? str1 : str1.substr( str1.find_first_not_of(' ') ); +} + +} diff --git a/transex3/source/localize.cxx b/transex3/source/localize.cxx index 31143ab50d38..09c9b29bb447 100644 --- a/transex3/source/localize.cxx +++ b/transex3/source/localize.cxx @@ -33,7 +33,11 @@ #include "srciter.hxx" #include "export.hxx" +#include "treeconfig.hxx" +#include +#include #include +#include #include "tools/errcode.hxx" #include "tools/fsys.hxx" @@ -42,6 +46,8 @@ #include #endif +namespace transex3 +{ // // SourceTreeLocalizer @@ -131,7 +137,6 @@ private: ByteString sLanguageRestriction; - ByteString sIsoCode99; ByteString sOutputFile; bool bQuiet2; @@ -147,8 +152,7 @@ private: void WorkOnFile( const ByteString &rFileName, const ByteString &rExecutable, - const ByteString &rParameter, - const ByteString &rIso + const ByteString &rParameter ); void WorkOnFileType( @@ -156,8 +160,7 @@ private: const ByteString &rExtension, const ByteString &rExecutable, const ByteString &rParameter, - const ByteString &rCollectMode, - const ByteString &rIso + const ByteString &rCollectMode ); void WorkOnDirectory( const ByteString &rDirectory ); BOOL ExecuteMerge(); @@ -175,8 +178,6 @@ public: void SetLanguageRestriction( const ByteString& rRestrictions ) { sLanguageRestriction = rRestrictions; } - void SetIsoCode99( const ByteString& rIsoCode ) - { sIsoCode99 = rIsoCode; } int getFileCnt(); BOOL Extract( const ByteString &rDestinationFile ); BOOL Merge( const ByteString &rSourceFile , const ByteString &rOutput ); @@ -215,16 +216,6 @@ const ByteString SourceTreeLocalizer::GetProjectName( BOOL bAbs ) DirEntry aTest = aCur + DirEntry(PRJ_DIR_NAME) + DirEntry(DLIST_NAME); if ( aTest.Exists() ) { - // HACK !!!!!!!!!!!!!!!!!!!!!!!!!!!!! - if (( ByteString( aCur.GetName(), RTL_TEXTENCODING_ASCII_US ).Equals("webinstall") ) || - ( ByteString( aCur.GetName(), RTL_TEXTENCODING_ASCII_US ).Equals("portal") ) || - ( ByteString( aCur.GetName(), RTL_TEXTENCODING_ASCII_US ).Equals("xulclient") ) || - ( ByteString( aCur.GetName(), RTL_TEXTENCODING_ASCII_US ).Search( "wdk_" ) == 0 )) - return ""; - // end HACK !!!!!!!!!!!!!!!!!!!!!!!!! - - - if ( bAbs ) return ByteString( aCur.GetFull(), RTL_TEXTENCODING_ASCII_US ); else @@ -280,10 +271,9 @@ bool skipProject( ByteString sPrj ) /*****************************************************************************/ void SourceTreeLocalizer::WorkOnFile( const ByteString &rFileName, const ByteString &rExecutable, - const ByteString &rParameter, const ByteString &rIso ) + const ByteString &rParameter ) /*****************************************************************************/ { - (void) rIso; // Remove me ;) String sFull( rFileName, RTL_TEXTENCODING_ASCII_US ); DirEntry aEntry( sFull ); ByteString sFileName( aEntry.GetName(), RTL_TEXTENCODING_ASCII_US ); @@ -294,14 +284,10 @@ void SourceTreeLocalizer::WorkOnFile( aPath.SetCWD(); ByteString sPrj( GetProjectName()); - //printf ("prj = %s , exe = %s\n", sPrj.GetBuffer() , rExecutable.GetBuffer() ); -// printf("Skip %s = %d \n",sPrj.GetBuffer() , skipProject( sPrj ) ); - //printf("prj = %s\n",sPrj.GetBuffer()); if ( sPrj.Len() && !skipProject( sPrj ) ) { ByteString sRoot( GetProjectRootRel()); - // get temp file DirEntry aTemp( Export::GetTempFile()); ByteString sTempFile( aTemp.GetFull(), RTL_TEXTENCODING_ASCII_US ); @@ -442,7 +428,7 @@ BOOL SourceTreeLocalizer::CheckPositiveList( const ByteString &rFileName ) void SourceTreeLocalizer::WorkOnFileType( const ByteString &rDirectory, const ByteString &rExtension, const ByteString &rExecutable, const ByteString &rParameter, - const ByteString &rCollectMode, const ByteString &rIso + const ByteString &rCollectMode ) /*****************************************************************************/ { @@ -466,7 +452,7 @@ void SourceTreeLocalizer::WorkOnFileType( bAllowed = CheckPositiveList( sFile ); if ( bAllowed ) - WorkOnFile( sFile, rExecutable, rParameter, rIso ); + WorkOnFile( sFile, rExecutable, rParameter ); } } @@ -480,7 +466,6 @@ void SourceTreeLocalizer::WorkOnDirectory( const ByteString &rDirectory ) ByteString sExecutable( ExeTable[ nIndex ][ 1 ] ); ByteString sParameter( ExeTable[ nIndex ][ 2 ] ); ByteString sCollectMode( ExeTable[ nIndex ][ 3 ] ); - ByteString sIso( ExeTable[ nIndex ][ 4 ] ); while( !sExtension.Equals( "NULL" )) { WorkOnFileType( @@ -488,8 +473,7 @@ void SourceTreeLocalizer::WorkOnDirectory( const ByteString &rDirectory ) sExtension, sExecutable, sParameter, - sCollectMode, - sIso + sCollectMode ); nIndex++; @@ -498,7 +482,6 @@ void SourceTreeLocalizer::WorkOnDirectory( const ByteString &rDirectory ) sExecutable = ExeTable[ nIndex ][ 1 ]; sParameter = ExeTable[ nIndex ][ 2 ]; sCollectMode = ExeTable[ nIndex ][ 3 ]; - sIso = ExeTable[ nIndex ][ 4 ]; } } @@ -518,11 +501,12 @@ BOOL SourceTreeLocalizer::Extract( const ByteString &rDestinationFile ) { nMode = LOCALIZE_EXTRACT; aSDF.Open( String( rDestinationFile, RTL_TEXTENCODING_ASCII_US ), - STREAM_STD_WRITE | STREAM_TRUNC ); + STREAM_STD_WRITE ); aSDF.SetLineDelimiter( LINEEND_CRLF ); BOOL bReturn = aSDF.IsOpen(); if ( bReturn ) { + aSDF.Seek( STREAM_SEEK_TO_END ); bReturn = StartExecute(); aSDF.Close(); } @@ -569,8 +553,6 @@ BOOL SourceTreeLocalizer::MergeSingleFile( while( !sCandidate.Equals ("NULL") && !sCandidate.Equals(sExtension) ) sCandidate = ExeTable[ ++nIndex ][ 0 ]; - ByteString sIso( ExeTable[ nIndex ][ 4 ] ); - if ( !sCandidate.Equals( "NULL" ) ) { if( !aEntry.Exists()) { DirEntryKind theDir=FSYS_KIND_FILE; @@ -606,10 +588,6 @@ BOOL SourceTreeLocalizer::MergeSingleFile( sCommand += sOutput; sCommand += " "; sCommand += ByteString( ExeTable[ nIndex ][ 2 ] ); - if ( sIso.Equals( "iso" ) && sIsoCode99.Len()) { - sCommand += " -ISO99 "; - sCommand += sIsoCode99; - } if ( sLanguageRestriction.Len()) { sCommand += " -l "; sCommand += sLanguageRestriction; @@ -707,7 +685,6 @@ BOOL SourceTreeLocalizer::ExecuteMerge( ) ByteString sBDel( sDel.GetBuffer() , sDel.Len() , RTL_TEXTENCODING_UTF8 ); if( bLocal ){ xub_StrLen nPos = sOutputFileName.SearchBackward( sBDel.GetChar(0) ); - //if( nPos >= 0 ) sOutputFileName = sOutputFileName.Copy( nPos+1 , sOutputFileName.Len()-nPos-1 ); } ByteStringBoolHashMap aFileHM; @@ -720,7 +697,6 @@ BOOL SourceTreeLocalizer::ExecuteMerge( ) aFileHM[sFileName]=true; } - // RECODE THIS !!!!!!!!!!!!!!!!!!!!! for( ByteStringBoolHashMap::iterator iter = aFileHM.begin(); iter != aFileHM.end(); ++iter ){ sFileKey = iter->first; aSDF.Seek( 0 ); @@ -757,7 +733,6 @@ BOOL SourceTreeLocalizer::ExecuteMerge( ) bMerged = true; if ( !MergeSingleFile( sPrj, sFile, sSDFFile )) bReturn = FALSE; - //} }else{ bMerged = true; //printf("MergeSingleFile('%s','%s','%s')\n",sPrj.GetBuffer(),sFile.GetBuffer(),sSDFFile.GetBuffer()); @@ -766,7 +741,6 @@ BOOL SourceTreeLocalizer::ExecuteMerge( ) } } } - //} aEntry.Kill(); // If Outputfile not included in the SDF file copy it without merge @@ -800,6 +774,8 @@ BOOL SourceTreeLocalizer::Merge( const ByteString &rSourceFile , const ByteStrin return bReturn; } +} +using namespace transex3; #define STATE_NONE 0x0000 #define STATE_EXPORT 0x0001 @@ -819,13 +795,11 @@ void Help() fprintf( stdout, "As part of the L10N framework, localize extracts and merges translations\n" "out of and into the whole source tree.\n\n" - "Syntax: localize -e|-m -l l1[=f1][,l2[=f2]][...] -f FileName [-QQ][-skip_links]\n" + "Syntax: localize -e -l en-US -f FileName [-QQ]\n" "Parameter:\n" "\t-e: Extract mode\n" - "\t-m: Merge mode\n" "\tFileName: Output file when extract mode, input file when merge mode\n" "\tl1...ln: supported languages (\"all\" for all languages).\n" - "\tf1...fn: fallback languages for supported languages\n" "\tQQ: quiet output)" ); @@ -834,16 +808,9 @@ void Help() fprintf( stdout, "\nExample 1:\n" "==========\n" - "localize -e -l en-US,de -f MyFile\n\n" + "localize -e -l en-US -f MyFile\n\n" "All strings will be extracted for language de and language en-US.\n" ); - fprintf( stdout, - "\nExample 2:\n" - "==========\n" - "localize -m -l es -f MyFile\n\n" - "All strings in MyFile will be merged into language es in the\n" - "source code.\n" - ); } /*****************************************************************************/ @@ -880,11 +847,13 @@ int _cdecl main( int argc, char *argv[] ) bool bQuiet2 = false; bool bSkipLinks = false; - ByteString sIsoCode; ByteString sLanguages; ByteString sFileName; ByteString sOutput; + bQuiet2 = true; + bExport = TRUE; + for( int i = 1; i < argc; i++ ) { ByteString sSwitch( argv[ i ] ); sSwitch.ToUpperAscii(); @@ -895,12 +864,6 @@ int _cdecl main( int argc, char *argv[] ) return Error(); bExport = TRUE; } - else if ( sSwitch.Equals( "-M" )) { - nState = STATE_MERGE; - if ( bExport ) - return Error(); - bMerge = TRUE; - } else if( sSwitch.Equals( "-Q" )) { bQuiet = true; } @@ -912,20 +875,12 @@ int _cdecl main( int argc, char *argv[] ) nState = STATE_FILENAME; else if ( sSwitch.Equals( "-QQ" )) bQuiet2 = true; - // else if ( ByteString( argv[ i ]).ToUpperAscii().Equals( "-SKIP_LINKS" )) - // bSkipLinks = true; else if ( ByteString( argv[ i ]).ToUpperAscii().Equals( "-O" ) ) nState = STATE_OUTPUT; else { switch ( nState ) { case STATE_NONE: return Error(); - case STATE_ISOCODE: - if ( sIsoCode.Len()) - return Error(); - sIsoCode = ByteString( argv[ i ] ); - nState = STATE_NONE; - break; case STATE_OUTPUT: if ( sOutput.Len()) return Error(); @@ -954,12 +909,10 @@ int _cdecl main( int argc, char *argv[] ) return 1; } - ByteString sRoot( Export::GetEnv( "SRC_ROOT" )); - DirEntry aRoot( String( sRoot, RTL_TEXTENCODING_ASCII_US )); - sRoot = ByteString( aRoot.GetFull(), RTL_TEXTENCODING_ASCII_US ); + ByteString sSolarVer( Export::GetEnv( "WORK_STAMP" )); ByteString sVersion( Export::GetEnv( "WORK_STAMP" )); - if ( !sRoot.Len() || !sVersion.Len()) { + if ( !sSolarVer.Len() || !sVersion.Len()) { fprintf( stderr, "ERROR: No environment set!\n" ); return 1; } @@ -972,55 +925,39 @@ int _cdecl main( int argc, char *argv[] ) return 3; } - ByteString sMode( "merge" ); - if ( bExport ) - sMode = "extract"; - - ByteString sICode( sIsoCode ); - if ( !sICode.Len()) - sICode = "not given, support for language 99 disabled"; - if(!bQuiet && !bQuiet2 ){ - fprintf( stdout, - "\n" - "============================================================\n" - "Current settings:\n" - "============================================================\n" - "Mode: %s\n" - "Workspace: %s\n" - "Source tree: %s\n" - "Languages: %s\n" - "ISO code (99): %s\n" - "Filename: %s\n" - "Outputfile %s\n" - "============================================================\n" - "\n" - , - sMode.GetBuffer(), - sVersion.GetBuffer(), - sRoot.GetBuffer(), - sLanguages.GetBuffer(), - sICode.GetBuffer(), - sFileName.GetBuffer(), - sOutput.GetBuffer() - ); - } - SourceTreeLocalizer aIter( sRoot, sVersion , (sOutput.Len() > 0) , bQuiet2 , bSkipLinks ); - - aIter.SetLanguageRestriction( sLanguages ); - aIter.SetIsoCode99( sIsoCode ); - if ( bExport ){ - if( bQuiet2 ){ /*printf("");*/fflush( stdout );} - aIter.Extract( sFileName ); - if( bQuiet2 ){ printf("\n %d files found!\n",aIter.GetFileCnt());} + Treeconfig treeconfig; + vector repos; + bool hasPwd = treeconfig.getActiveRepositories( repos ); + if( hasPwd ) cout << "Found special path!\n"; + + // localize through all repositories + for( vector::iterator iter = repos.begin(); iter != repos.end() ; ++iter ) + { + string curRepository = string( Export::GetEnv("SOURCE_ROOT_DIR") ) + "/" + *iter; + cout << "Localizing repository " << curRepository << "\n"; + SourceTreeLocalizer aIter( ByteString( curRepository.c_str() ) , sVersion , (sOutput.Len() > 0) , bQuiet2 , bSkipLinks ); + aIter.SetLanguageRestriction( sLanguages ); + if ( bExport ){ + if( bQuiet2 ){ /*printf("");*/fflush( stdout );} + aIter.Extract( sFileName ); + if( bQuiet2 ){ printf("\n %d files found!\n",aIter.GetFileCnt());} + } } - else { + if( hasPwd ) + { + string pwd; + Export::getCurrentDir( pwd ); + cout << "Localizing repository " << pwd << "\n"; + SourceTreeLocalizer aIter( ByteString( pwd.c_str() ) , sVersion , (sOutput.Len() > 0) , bQuiet2 , bSkipLinks ); + aIter.SetLanguageRestriction( sLanguages ); + if ( bExport ){ + if( bQuiet2 ){ /*printf("");*/fflush( stdout );} + aIter.Extract( sFileName ); + if( bQuiet2 ){ printf("\n %d files found!\n",aIter.GetFileCnt());} + } - DirEntry aEntry( String( sFileName, RTL_TEXTENCODING_ASCII_US )); - if ( !aEntry.Exists()) - return FALSE; - printf("%s\n",sFileName.GetBuffer()); - aIter.Merge( sFileName , sOutput ); } return 0; } + diff --git a/transex3/source/makefile.mk b/transex3/source/makefile.mk index 68b94a5b58fa..73c74825fa3a 100644 --- a/transex3/source/makefile.mk +++ b/transex3/source/makefile.mk @@ -61,8 +61,8 @@ OBJFILES= \ $(OBJ)$/helpmerge.obj \ $(OBJ)$/helpex.obj \ $(OBJ)$/file.obj \ - $(OBJ)$/directory.obj \ - $(OBJ)$/hw2fw.obj + $(OBJ)$/directory.obj + LIB1TARGET= $(LB)$/$(TARGET).lib LIB1ARCHIV= $(LB)$/libtransex.a @@ -73,8 +73,8 @@ LIB1OBJFILES= $(OBJ)$/export.obj \ $(OBJ)$/srciter.obj \ $(OBJ)$/file.obj \ $(OBJ)$/directory.obj \ - $(OBJ)$/utf8conv.obj \ - $(OBJ)$/hw2fw.obj + $(OBJ)$/utf8conv.obj + APP1VERSIONMAP=exports.map @@ -96,7 +96,7 @@ APP1LIBS+= $(LB)$/$(TARGET).lib APP1DEPN= $(OBJ)$/src_yy_wrapper.obj $(LB)$/$(TARGET).lib APP2TARGET= helpex -APP2OBJS= $(OBJ)$/helpmerge.obj $(OBJ)$/xmlparse.obj $(OBJ)$/export2.obj $(OBJ)$/utf8conv.obj $(OBJ)$/merge.obj $(OBJ)$/helpex.obj $(OBJ)$/hw2fw.obj +APP2OBJS= $(OBJ)$/helpmerge.obj $(OBJ)$/xmlparse.obj $(OBJ)$/export2.obj $(OBJ)$/utf8conv.obj $(OBJ)$/merge.obj $(OBJ)$/helpex.obj APP2RPATH= NONE .IF "$(OS)"!="MACOSX" @@ -110,7 +110,7 @@ APP2STDLIBS+=$(SALLIB) $(EXPATASCII3RDLIB) $(TOOLSLIB) $(VOSLIB) # extractor and merger for *.lng and *.lng APP3TARGET= ulfex -APP3OBJS= $(OBJ)$/lngmerge.obj $(OBJ)$/hw2fw.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/lngex.obj $(OBJ)$/utf8conv.obj +APP3OBJS= $(OBJ)$/lngmerge.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/lngex.obj $(OBJ)$/utf8conv.obj APP3RPATH= NONE .IF "$(OS)"!="MACOSX" @@ -142,7 +142,7 @@ APP5STDLIBS+= \ # extractor and merger for *.cfg APP6TARGET= cfgex -APP6OBJS= $(OBJ)$/cfgmerge.obj $(OBJ)$/cfg_yy_wrapper.obj $(OBJ)$/hw2fw.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/utf8conv.obj +APP6OBJS= $(OBJ)$/cfgmerge.obj $(OBJ)$/cfg_yy_wrapper.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/utf8conv.obj .IF "$(OS)"!="MACOSX" #APP6STDLIBS+= $(BTSTRPLIB) @@ -159,7 +159,7 @@ APP6STDLIBS+= \ # extractor and merger for *.xrm APP7TARGET= xrmex -APP7OBJS= $(OBJ)$/xrmmerge.obj $(OBJ)$/xrm_yy_wrapper.obj $(OBJ)$/hw2fw.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/utf8conv.obj +APP7OBJS= $(OBJ)$/xrmmerge.obj $(OBJ)$/xrm_yy_wrapper.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/utf8conv.obj APP7RPATH= NONE .IF "$(OS)"!="MACOSX" @@ -174,21 +174,22 @@ APP7STDLIBS+= \ # static libs at end for OS X .ENDIF -# encoding converter for text files -APP8TARGET= txtconv -#APP8STACK= 16000 -APP8OBJS= $(OBJ)$/utf8conv.obj $(OBJ)$/txtconv.obj $(OBJ)$/hw2fw.obj -APP8STDLIBS=$(TOOLSLIB) $(SALLIB) +# +#APP8TARGET= treeconfig +#APP8OBJS= $(OBJ)$/treeconfig.obj $(OBJ)$/inireader.obj $(OBJ)$/export2.obj +#APP8STDLIBS=$(TOOLSLIB) $(SALLIB) $(VOSLIB) $(ICUINLIB) $(STLPORT) # localizer for l10n framework APP9TARGET= localize_sl EXCEPTIONSFILES= \ $(OBJ)$/localize.obj -APP9OBJS= $(OBJ)$/localize.obj $(OBJ)$/utf8conv.obj $(OBJ)$/srciter.obj $(OBJ)$/export2.obj $(OBJ)$/file.obj $(OBJ)$/directory.obj +APP9OBJS= $(OBJ)$/localize.obj $(OBJ)$/utf8conv.obj $(OBJ)$/srciter.obj $(OBJ)$/export2.obj $(OBJ)$/file.obj $(OBJ)$/directory.obj $(OBJ)$/treeconfig.obj $(OBJ)$/inireader.obj APP9STDLIBS+= \ $(TOOLSLIB) \ $(VOSLIB) \ + $(ICUINLIB) \ + $(STLPORTLIB) \ $(SALLIB) DEPOBJFILES=$(APP1OBJS) $(APP2OBJS) $(APP3OBJS) $(APP4OBJS) $(APP5OBJS) $(APP6OBJS) $(APP7OBJS) $(APP8OBJS) $(APP9OBJS) diff --git a/transex3/source/treeconfig.cxx b/transex3/source/treeconfig.cxx new file mode 100644 index 000000000000..2430f11f0e0d --- /dev/null +++ b/transex3/source/treeconfig.cxx @@ -0,0 +1,119 @@ +#include +#include +#include +#include "treeconfig.hxx" +#include "export.hxx" +#include +#include +#include +#include +#include + +using namespace std; + +namespace transex3 +{ + +bool Treeconfig::parseConfig(){ + + string source_config_file = string( static_cast( Export::GetEnv("SOURCE_ROOT_DIR") ).GetBuffer() ); + if( source_config_file.empty() ) + { + cerr << "Error: no suitable environment set?!?"; + exit( -1 ); + } + source_config_file += string("/source_config"); + if( isConfigFilePresent() ) + { + inireader.read( map , source_config_file ); + return true; + } + else return false; +} + +// ALWAYS add all repositories from source_config file to the container active_repos +// if a config_file is present ALWAYS return false +// if you are in the root of a repository also add it to the container active_repos +// if you are far inside a repository /my/path/ooo/sw/source then don't add it to the container but return true +// if you are in some misc place like /tmp then return true +// => the application can decide what to do in case the function returns true thus how to handle pwd() path +bool Treeconfig::getActiveRepositories( vector& active_repos ){ + + bool isPresent = isConfigFilePresent(); + bool hasPath = false; + string pwd; + string guessedRepo; + Export::getCurrentDir( pwd ); + string source_root = Export::GetEnv( "SOURCE_ROOT_DIR" ); + string solarsrc = Export::GetEnv( "SOLARSRC" ); + string partial; + + // if we are inside of a repository root then active it otherwise let the app handle the return! + unsigned int pos = pwd.find_first_of( source_root ); + if( pos != string::npos && ( pos + source_root.length() +1 ) < pwd.length()){ // I am within SOURCE_ROOT_DIR + partial = pwd.substr( pos + source_root.length() +1 , pwd.length()); + unsigned int nextPart = partial.find_first_of( "/" ); + if( nextPart != string::npos ) + hasPath = true; + else + guessedRepo = partial; + } + else // I am NOT within SOURCE_ROOT_DIR + hasPath = true; + + if( isPresent ) + { + hasPath = false; // if config_file is present don't care about pwd + stringmap* repos = static_cast( map[ string("repositories") ] ); + if( repos != 0 ) + { + for( stringmap::iterator iter = repos->begin() ; iter != repos->end() ; ++iter ) + { + if( static_cast( iter->second ) == string( "active" ) ) + { + active_repos.push_back( iter->first ); + if( static_cast( iter->first ) == guessedRepo ) + { + guessedRepo.clear(); // don't add double in case it is present in config_file + } + } + } + } + else + { + cerr << "Error: source_config files doesn't contain a 'repositories' section ?!?"; + exit( -1 ); + } + } + if( !guessedRepo.empty() ){ + active_repos.push_back( guessedRepo ); // add myrepo + } + return hasPath; // are we deep inside of a source tree or outside of SOURCE_ROOT_DIR? +} + +void Treeconfig::getCurrentDir( string& dir ) +{ + char buffer[64000]; + if( getcwd( buffer , sizeof( buffer ) ) == 0 ){ + cerr << "Error: getcwd failed!\n"; + exit( -1 ); + } + dir = string( buffer ); +} + +bool Treeconfig::isConfigFilePresent() +{ + string config_file = Export::GetEnv( "SOURCE_ROOT_DIR" ); + config_file += "/source_config"; + + struct stat status; + if( stat( config_file.c_str() , &status ) < 0 ) + { + return false; + } + return ( status.st_mode & S_IFREG ) && ( access( config_file.c_str() , R_OK ) >= 0 ) ; +} + + + +} diff --git a/transex3/source/txtconv.cxx b/transex3/source/txtconv.cxx deleted file mode 100644 index 2f442b80a83d..000000000000 --- a/transex3/source/txtconv.cxx +++ /dev/null @@ -1,168 +0,0 @@ -/************************************************************************* - * - * 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 - * - * $RCSfile: txtconv.cxx,v $ - * $Revision: 1.8 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_transex3.hxx" -#include -#include -#include - -// local includes -#include "utf8conv.hxx" - -extern void ConvertHalfwitdhToFullwidth( String& rString ); - -/*****************************************************************************/ -void Help() -/*****************************************************************************/ -{ - fprintf( stdout, "\n" ); - fprintf( stdout, "txtconv (c)2001 by StarOffice Entwicklungs GmbH\n" ); - fprintf( stdout, "===============================================\n" ); - fprintf( stdout, "\n" ); - fprintf( stdout, "txtconv converts textfiles from or to UTF-8\n" ); - fprintf( stdout, "\n" ); - fprintf( stdout, "Syntax: txtconv -t|-f charset filename (destinationfile)\n" ); - fprintf( stdout, "Switches: -t => conversion from charset to UTF-8\n" ); - fprintf( stdout, " -f => conversion from UTF-8 to charset\n" ); - fprintf( stdout, "\n" ); - fprintf( stdout, "Allowed charsets:\n" ); - fprintf( stdout, " MS_932 => Japanese\n" ); - fprintf( stdout, " MS_936 => Chinese Simplified\n" ); - fprintf( stdout, " MS_949 => Korean\n" ); - fprintf( stdout, " MS_950 => Chinese Traditional\n" ); - fprintf( stdout, " MS_1250 => East Europe\n" ); - fprintf( stdout, " MS_1251 => Cyrillic\n" ); - fprintf( stdout, " MS_1252 => West Europe\n" ); - fprintf( stdout, " MS_1253 => Greek\n" ); - fprintf( stdout, " MS_1254 => Turkish\n" ); - fprintf( stdout, " MS_1255 => Hebrew\n" ); - fprintf( stdout, " MS_1256 => Arabic\n" ); - fprintf( stdout, " HW2FW => Only with -t, converts half to full width katakana" ); - fprintf( stdout, "\n" ); -} - -/*****************************************************************************/ -#if defined(UNX) || defined(OS2) -int main( int argc, char *argv[] ) -#else -int _cdecl main( int argc, char *argv[] ) -#endif -/*****************************************************************************/ -{ - if (( argc != 4 ) && ( argc != 5 )) { - Help(); - exit ( 0 ); - } - - if ( ByteString( argv[ 1 ] ) == "-t" || ByteString( argv[ 1 ] ) == "-f" ) { - rtl_TextEncoding nEncoding = RTL_TEXTENCODING_MS_1252; - - BOOL bHW2FW = FALSE; - - ByteString sCharset( argv[ 2 ] ); - sCharset.ToUpperAscii(); - - if ( sCharset == "MS_932" ) nEncoding = RTL_TEXTENCODING_MS_932; - else if ( sCharset == "MS_936" ) nEncoding = RTL_TEXTENCODING_MS_936; - else if ( sCharset == "MS_949" ) nEncoding = RTL_TEXTENCODING_MS_949; - else if ( sCharset == "MS_950" ) nEncoding = RTL_TEXTENCODING_MS_950; - else if ( sCharset == "MS_1250" ) nEncoding = RTL_TEXTENCODING_MS_1250; - else if ( sCharset == "MS_1251" ) nEncoding = RTL_TEXTENCODING_MS_1251; - else if ( sCharset == "MS_1252" ) nEncoding = RTL_TEXTENCODING_MS_1252; - else if ( sCharset == "MS_1253" ) nEncoding = RTL_TEXTENCODING_MS_1253; - else if ( sCharset == "MS_1254" ) nEncoding = RTL_TEXTENCODING_MS_1254; - else if ( sCharset == "MS_1255" ) nEncoding = RTL_TEXTENCODING_MS_1255; - else if ( sCharset == "MS_1256" ) nEncoding = RTL_TEXTENCODING_MS_1256; - else if ( sCharset == "MS_1257" ) nEncoding = RTL_TEXTENCODING_MS_1257; - else if (( sCharset == "HW2FW" ) && ( ByteString( argv[ 1 ] ) == "-t" )) bHW2FW = TRUE; - - else { - Help(); - exit ( 1 ); - } - - DirEntry aSource = DirEntry( String( argv[ 3 ], RTL_TEXTENCODING_ASCII_US )); - if ( !aSource.Exists()) { - fprintf( stderr, "\nERROR: File %s not found!\n\n", ByteString( argv[ 3 ] ).GetBuffer()); - exit ( 2 ); - } - - String sOutput; - SvFileStream aOutput; - if ( argc == 5 ) { - sOutput= String( argv[ 4 ], RTL_TEXTENCODING_ASCII_US ); - aOutput.Open( sOutput, STREAM_STD_WRITE | STREAM_TRUNC ); - if ( !aOutput.IsOpen()) { - fprintf( stderr, "\nERROR: Could not open output file %s!\n\n", argv[ 4 ]); - exit ( 3 ); - } - } - - String sGSI( argv[ 3 ], RTL_TEXTENCODING_ASCII_US ); - SvFileStream aGSI( sGSI, STREAM_STD_READ ); - if ( !aGSI.IsOpen()) { - fprintf( stderr, "\nERROR: Could not open input file %s!\n\n", argv[ 3 ]); - exit ( 3 ); - } - - ByteString sGSILine; - while ( !aGSI.IsEof()) { - - aGSI.ReadLine( sGSILine ); - if ( bHW2FW ) { - String sConverter( sGSILine, RTL_TEXTENCODING_UTF8 ); - ConvertHalfwitdhToFullwidth( sConverter ); - sGSILine = ByteString( sConverter, RTL_TEXTENCODING_UTF8 ); - } - else { - if ( ByteString( argv[ 1 ] ) == "-t" ) - sGSILine = UTF8Converter::ConvertToUTF8( sGSILine, nEncoding ); - else - sGSILine = UTF8Converter::ConvertFromUTF8( sGSILine, nEncoding ); - } - - if ( aOutput.IsOpen()) - aOutput.WriteLine( sGSILine ); - else - fprintf( stdout, "%s\n", sGSILine.GetBuffer()); - } - - aGSI.Close(); - if ( aOutput.IsOpen()) - aOutput.Close(); - } - else { - Help(); - exit( 1 ); - } - - return 0; -} diff --git a/transex3/source/xrmmerge.cxx b/transex3/source/xrmmerge.cxx index 4daf94e2357a..35797a49a0b5 100644 --- a/transex3/source/xrmmerge.cxx +++ b/transex3/source/xrmmerge.cxx @@ -163,9 +163,9 @@ extern char *GetOutputFile( int argc, char* argv[]) Export::sLanguages = ByteString( argv[ i ]); } break; - case STATE_ISOCODE99: { - Export::sIsoCode99 = ByteString( argv[ i ]); - } +// case STATE_ISOCODE99: { +// Export::sIsoCode99 = ByteString( argv[ i ]); +// } break; } } -- cgit From ea2e1162e6c8376fe3707c165b91d1712e194538 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Wed, 18 Nov 2009 18:20:25 +0100 Subject: sconfigl10n: #i107009#: source_config file / multiple repository support in l10n tools. Solaris build fix --- transex3/source/cfgmerge.cxx | 4 ---- transex3/source/makefile.mk | 1 + transex3/source/xrmmerge.cxx | 4 ---- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/transex3/source/cfgmerge.cxx b/transex3/source/cfgmerge.cxx index 7f92ad8ac721..0607c9e9bb06 100644 --- a/transex3/source/cfgmerge.cxx +++ b/transex3/source/cfgmerge.cxx @@ -172,10 +172,6 @@ extern char *GetOutputFile( int argc, char* argv[]) Export::sLanguages = ByteString( argv[ i ]); } break; -// case STATE_ISOCODE99: { -// Export::sIsoCode99 = ByteString( argv[ i ]); -// } - break; } } } diff --git a/transex3/source/makefile.mk b/transex3/source/makefile.mk index 73c74825fa3a..a557b210aad0 100644 --- a/transex3/source/makefile.mk +++ b/transex3/source/makefile.mk @@ -189,6 +189,7 @@ APP9STDLIBS+= \ $(TOOLSLIB) \ $(VOSLIB) \ $(ICUINLIB) \ + $(ICUUCLIB) \ $(STLPORTLIB) \ $(SALLIB) diff --git a/transex3/source/xrmmerge.cxx b/transex3/source/xrmmerge.cxx index 35797a49a0b5..f1b3d4d6cb5a 100644 --- a/transex3/source/xrmmerge.cxx +++ b/transex3/source/xrmmerge.cxx @@ -163,10 +163,6 @@ extern char *GetOutputFile( int argc, char* argv[]) Export::sLanguages = ByteString( argv[ i ]); } break; -// case STATE_ISOCODE99: { -// Export::sIsoCode99 = ByteString( argv[ i ]); -// } - break; } } } -- cgit From 9ea262814e66ea01c6b3ace22833e644e3ce30a1 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 19 Nov 2009 11:56:21 +0100 Subject: #i97029#: sax::Converter: properly support XMLSchema-2 "duration" type: replace convertTime() funtions with convertDuration(). reimplement convertDuration(util::Duration) to be free of rounding error. --- sax/inc/sax/tools/converter.hxx | 45 +++-- sax/source/tools/converter.cxx | 437 +++++++++++++++++++++++++++++++++++----- 2 files changed, 409 insertions(+), 73 deletions(-) diff --git a/sax/inc/sax/tools/converter.hxx b/sax/inc/sax/tools/converter.hxx index 6632dda8507e..f8c988d2fceb 100644 --- a/sax/inc/sax/tools/converter.hxx +++ b/sax/inc/sax/tools/converter.hxx @@ -31,11 +31,13 @@ #ifndef _SAX_CONVERTER_HXX #define _SAX_CONVERTER_HXX -#include #include "sax/dllapi.h" -#include + +#include + #include + namespace rtl { class OUString; @@ -43,8 +45,12 @@ class OUStringBuffer; } namespace com { namespace sun { namespace star { - namespace util { struct DateTime; } -}}} + namespace util { + struct Date; + struct DateTime; + struct Duration; + } +} } } namespace sax { @@ -138,36 +144,37 @@ public: /** convert string to double number (using ::rtl::math) with unit conversion */ static bool convertDouble(double& rValue, const ::rtl::OUString& rString, sal_Int16 nTargetUnit ); - /** convert double to ISO Time String */ - static void convertTime( ::rtl::OUStringBuffer& rBuffer, - const double& fTime); + /** convert double to ISO "duration" string; negative durations allowed */ + static void convertDuration(::rtl::OUStringBuffer& rBuffer, + const double fTime); - /** convert util::DateTime to ISO Time String */ - static void convertTime( ::rtl::OUStringBuffer& rBuffer, - const ::com::sun::star::util::DateTime& rDateTime ); + /** convert util::Duration to ISO "duration" string */ + static void convertDuration(::rtl::OUStringBuffer& rBuffer, + const ::com::sun::star::util::Duration& rDuration); - /** convert ISO Time String to double */ - static bool convertTime( double& fTime, + /** convert ISO "duration" string to double; negative durations allowed */ + static bool convertDuration(double & rfTime, const ::rtl::OUString& rString); - /** convert ISO Time String to util::DateTime */ - static bool convertTime( ::com::sun::star::util::DateTime& rDateTime, - const ::rtl::OUString& rString ); + /** convert ISO "duration" string to util::Duration */ + static bool convertDuration(::com::sun::star::util::Duration& rDuration, + const ::rtl::OUString& rString); - /** convert util::Date to ISO Date String */ + /** convert util::Date to ISO "date" string */ static void convertDate( ::rtl::OUStringBuffer& rBuffer, const com::sun::star::util::Date& rDate ); - /** convert util::DateTime to ISO Date or DateTime String */ + /** convert util::DateTime to ISO "date" or "dateTime" string */ static void convertDateTime( ::rtl::OUStringBuffer& rBuffer, const com::sun::star::util::DateTime& rDateTime, bool bAddTimeIf0AM = false ); - /** convert ISO Date or DateTime String to util::DateTime */ + /** convert ISO "date" or "dateTime" string to util::DateTime */ static bool convertDateTime( com::sun::star::util::DateTime& rDateTime, const ::rtl::OUString& rString ); - /** convert ISO Date or DateTime String to util::DateTime or util::Date */ + /** convert ISO "date" or "dateTime" string to util::DateTime or + util::Date */ static bool convertDateOrDateTime( com::sun::star::util::Date & rDate, com::sun::star::util::DateTime & rDateTime, diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index 1efda01ea77a..e13df493628a 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -32,8 +32,9 @@ #include #include #include -#include +#include #include + #include #include #include "sax/tools/converter.hxx" @@ -683,11 +684,10 @@ bool Converter::convertDouble(double& rValue, const ::rtl::OUString& rString) return ( eStatus == rtl_math_ConversionStatus_Ok ); } -/** convert double to ISO Time String; negative durations allowed */ -void Converter::convertTime( ::rtl::OUStringBuffer& rBuffer, - const double& fTime) +/** convert double to ISO "duration" string; negative durations allowed */ +void Converter::convertDuration(::rtl::OUStringBuffer& rBuffer, + const double fTime) { - double fValue = fTime; // take care of negative durations as specified in: @@ -755,9 +755,9 @@ void Converter::convertTime( ::rtl::OUStringBuffer& rBuffer, rBuffer.append( sal_Unicode('S')); } -/** convert ISO Time String to double; negative durations allowed */ -bool Converter::convertTime( double& fTime, - const ::rtl::OUString& rString) +/** convert ISO "duration" string to double; negative durations allowed */ +bool Converter::convertDuration(double& rfTime, + const ::rtl::OUString& rString) { rtl::OUString aTrimmed = rString.trim().toAsciiUpperCase(); const sal_Unicode* pStr = aTrimmed.getStr(); @@ -880,64 +880,393 @@ bool Converter::convertTime( double& fTime, fTempTime = -fTempTime; } - fTime = fTempTime; + rfTime = fTempTime; } return bSuccess; } -/** convert util::DateTime to ISO Time String */ -void Converter::convertTime( ::rtl::OUStringBuffer& rBuffer, - const ::com::sun::star::util::DateTime& rDateTime ) +/** convert util::Duration to ISO "duration" string */ +void Converter::convertDuration(::rtl::OUStringBuffer& rBuffer, + const ::util::Duration& rDuration) { - double fHour = rDateTime.Hours; - double fMin = rDateTime.Minutes; - double fSec = rDateTime.Seconds; - double fSec100 = rDateTime.HundredthSeconds; - double fTempTime = fHour / 24; - fTempTime += fMin / (24 * 60); - fTempTime += fSec / (24 * 60 * 60); - fTempTime += fSec100 / (24 * 60 * 60 * 100); - convertTime( rBuffer, fTempTime ); + if (rDuration.Negative) + { + rBuffer.append(sal_Unicode('-')); + } + rBuffer.append(sal_Unicode('P')); + const bool bHaveDate(static_cast(rDuration.Years) + +static_cast(rDuration.Months) + +static_cast(rDuration.Days)); + if (rDuration.Years) + { + rBuffer.append(static_cast(rDuration.Years)); + rBuffer.append(sal_Unicode('Y')); + } + if (rDuration.Months) + { + rBuffer.append(static_cast(rDuration.Months)); + rBuffer.append(sal_Unicode('M')); + } + if (rDuration.Days) + { + rBuffer.append(static_cast(rDuration.Days)); + rBuffer.append(sal_Unicode('D')); + } + const sal_Int32 nHSecs(static_cast(rDuration.Seconds) + + static_cast(rDuration.HundredthSeconds)); + if (static_cast(rDuration.Hours) + + static_cast(rDuration.Minutes) + nHSecs) + { + rBuffer.append(sal_Unicode('T')); // time separator + if (rDuration.Hours) + { + rBuffer.append(static_cast(rDuration.Hours)); + rBuffer.append(sal_Unicode('H')); + } + if (rDuration.Minutes) + { + rBuffer.append(static_cast(rDuration.Minutes)); + rBuffer.append(sal_Unicode('M')); + } + if (nHSecs) + { + // seconds must not be omitted (i.e. ".42S" is not valid) + rBuffer.append(static_cast(rDuration.Seconds)); + if (rDuration.HundredthSeconds) + { + rBuffer.append(sal_Unicode('.')); + const sal_Int32 nHundredthSeconds( + rDuration.HundredthSeconds % 100); + if (nHundredthSeconds < 10) + { + rBuffer.append(sal_Unicode('0')); + } + rBuffer.append(nHundredthSeconds); + } + rBuffer.append(sal_Unicode('S')); + } + } + else if (!bHaveDate) + { + // zero duration: XMLSchema-2 says there must be at least one component + rBuffer.append(sal_Unicode('0')); + rBuffer.append(sal_Unicode('D')); + } } -/** convert ISO Time String to util::DateTime */ -bool Converter::convertTime( ::com::sun::star::util::DateTime& rDateTime, - const ::rtl::OUString& rString ) +enum Result { R_NOTHING, R_OVERFLOW, R_SUCCESS }; + +static Result +readUnsignedNumber(const ::rtl::OUString & rString, + sal_Int32 & io_rnPos, sal_Int32 & o_rNumber) { - double fCalculatedTime = 0.0; - if( convertTime( fCalculatedTime, rString ) ) + bool bOverflow(false); + sal_Int32 nTemp(0); + + for (sal_Int32 nPos = io_rnPos; (nPos < rString.getLength()); ++nPos) { - // #101357# declare as volatile to prevent optimization - // (gcc 3.0.1 Linux) - volatile double fTempTime = fCalculatedTime; - fTempTime *= 24; - double fHoursValue = ::rtl::math::approxFloor (fTempTime); - fTempTime -= fHoursValue; - fTempTime *= 60; - double fMinsValue = ::rtl::math::approxFloor (fTempTime); - fTempTime -= fMinsValue; - fTempTime *= 60; - double fSecsValue = ::rtl::math::approxFloor (fTempTime); - fTempTime -= fSecsValue; - double f100SecsValue = 0.0; - - if( fTempTime > 0.00001 ) - f100SecsValue = fTempTime; - - rDateTime.Year = 0; - rDateTime.Month = 0; - rDateTime.Day = 0; - rDateTime.Hours = static_cast < sal_uInt16 > ( fHoursValue ); - rDateTime.Minutes = static_cast < sal_uInt16 > ( fMinsValue ); - rDateTime.Seconds = static_cast < sal_uInt16 > ( fSecsValue ); - rDateTime.HundredthSeconds = static_cast < sal_uInt16 > ( f100SecsValue * 100.0 ); + const sal_Unicode c = rString[nPos]; + if ((sal_Unicode('0') <= c) && (c <= sal_Unicode('9'))) + { + nTemp *= 10; + nTemp += (c - sal_Unicode('0')); + if (nTemp >= SAL_MAX_INT16) + { + bOverflow = true; + } + } + else + { + if (io_rnPos != nPos) // read something? + { + io_rnPos = nPos; + if (bOverflow) + { + return R_OVERFLOW; + } + else + { + o_rNumber = nTemp; + return R_SUCCESS; + } + } + else break; + } + } + + o_rNumber = -1; + return R_NOTHING; +} +static bool +readDurationT(const ::rtl::OUString & rString, sal_Int32 & io_rnPos) +{ + if ((io_rnPos < rString.getLength()) && + (rString[io_rnPos] == sal_Unicode('T'))) + { + ++io_rnPos; return true; } return false; } -/** convert util::Date to ISO Date String */ +static bool +readDurationComponent(const ::rtl::OUString & rString, + sal_Int32 & io_rnPos, sal_Int32 & io_rnTemp, bool & io_rbTimePart, + sal_Int32 & o_rnTarget, const sal_Unicode c) +{ + if ((io_rnPos < rString.getLength())) + { + if (c == rString[io_rnPos]) + { + ++io_rnPos; + if (-1 != io_rnTemp) + { + o_rnTarget = io_rnTemp; + io_rnTemp = -1; + if (!io_rbTimePart) + { + io_rbTimePart = readDurationT(rString, io_rnPos); + } + return (R_OVERFLOW != + readUnsignedNumber(rString, io_rnPos, io_rnTemp)); + } + else + { + return false; + } + } + } + return true; +} + +/** convert ISO "duration" string to util::Duration */ +bool Converter::convertDuration(util::Duration& rDuration, + const ::rtl::OUString& rString) +{ + const ::rtl::OUString string = rString.trim().toAsciiUpperCase(); + sal_Int32 nPos(0); + + bool bIsNegativeDuration(false); + if (string.getLength() && (sal_Unicode('-') == string[0])) + { + bIsNegativeDuration = true; + ++nPos; + } + + if ((nPos < string.getLength()) + && (string[nPos] != sal_Unicode('P'))) // duration must start with "P" + { + return false; + } + + ++nPos; + + /// last read number; -1 == no valid number! always reset after using! + sal_Int32 nTemp(-1); + bool bTimePart(false); // have we read 'T'? + bool bSuccess(false); + sal_Int32 nYears(0); + sal_Int32 nMonths(0); + sal_Int32 nDays(0); + sal_Int32 nHours(0); + sal_Int32 nMinutes(0); + sal_Int32 nSeconds(0); + sal_Int32 nHundredthSeconds(0); + + bTimePart = readDurationT(string, nPos); + bSuccess = (R_SUCCESS == readUnsignedNumber(string, nPos, nTemp)); + + if (!bTimePart && bSuccess) + { + bSuccess = readDurationComponent(string, nPos, nTemp, bTimePart, + nYears, sal_Unicode('Y')); + } + + if (!bTimePart && bSuccess) + { + bSuccess = readDurationComponent(string, nPos, nTemp, bTimePart, + nMonths, sal_Unicode('M')); + } + + if (!bTimePart && bSuccess) + { + bSuccess = readDurationComponent(string, nPos, nTemp, bTimePart, + nDays, sal_Unicode('D')); + } + + if (bTimePart) + { + if (-1 == nTemp) // a 'T' must be followed by a component + { + bSuccess = false; + } + + if (bSuccess) + { + bSuccess = readDurationComponent(string, nPos, nTemp, bTimePart, + nHours, sal_Unicode('H')); + } + + if (bSuccess) + { + bSuccess = readDurationComponent(string, nPos, nTemp, bTimePart, + nMinutes, sal_Unicode('M')); + } + + // eeek! seconds are icky. + if ((nPos < string.getLength()) && bSuccess) + { + if (sal_Unicode('.') == string[nPos]) + { + ++nPos; + if (-1 != nTemp) + { + nSeconds = nTemp; + nTemp = -1; + const sal_Int32 nStart(nPos); + bSuccess = + (R_SUCCESS == readUnsignedNumber(string, nPos, nTemp)); + if ((nPos < string.getLength()) && bSuccess) + { + if (sal_Unicode('S') == string[nPos]) + { + ++nPos; + if (-1 != nTemp) + { + nTemp = -1; + const sal_Int32 nDigits = nPos - nStart; + OSL_ENSURE(nDigits > 0, "bad code monkey"); + nHundredthSeconds = 10 * + (string[nStart] - sal_Unicode('0')); + if (nDigits >= 2) + { + nHundredthSeconds += + (string[nStart+1] - sal_Unicode('0')); + } + } + else + { + bSuccess = false; + } + } + } + } + else + { + bSuccess = false; + } + } + else if (sal_Unicode('S') == string[nPos]) + { + ++nPos; + if (-1 != nTemp) + { + nSeconds = nTemp; + nTemp = -1; + } + else + { + bSuccess = false; + } + } + } + } + + if (nPos != string.getLength()) // string not processed completely? + { + bSuccess = false; + } + + if (nTemp != -1) // unprocessed number? + { + bSuccess = false; + } + + if (bSuccess) + { + rDuration.Negative = bIsNegativeDuration; + rDuration.Years = static_cast(nYears); + rDuration.Months = static_cast(nMonths); + rDuration.Days = static_cast(nDays); + rDuration.Hours = static_cast(nHours); + rDuration.Minutes = static_cast(nMinutes); + rDuration.Seconds = static_cast(nSeconds); + rDuration.HundredthSeconds = static_cast(nHundredthSeconds); + } + + return bSuccess; +} + +#if 0 +//FIXME +struct Test { + static bool eqDuration(util::Duration a, util::Duration b) { + return a.Years == b.Years && a.Months == b.Months && a.Days == b.Days + && a.Hours == b.Hours && a.Minutes == b.Minutes + && a.Seconds == b.Seconds + && a.HundredthSeconds == b.HundredthSeconds + && a.Negative == b.Negative; + } + static void doTest(util::Duration const & rid, const char * pis) + { + bool bSuccess(false); + ::rtl::OUStringBuffer buf; + Converter::convertDuration(buf, rid); + ::rtl::OUString os(buf.makeStringAndClear()); + OSL_TRACE(::rtl::OUStringToOString(os.getStr(), RTL_TEXTENCODING_UTF8)); + OSL_ASSERT(os.equalsAscii(pis)); + util::Duration od; + bSuccess = Converter::convertDuration(od, os); + OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dH", + od.Negative, od.Years, od.Months, od.Days, + od.Hours, od.Minutes, od.Seconds, od.HundredthSeconds); + OSL_ASSERT(bSuccess); + OSL_ASSERT(eqDuration(rid, od)); + } + static void doTestF(const char * pis) + { + util::Duration od; + bool bSuccess = Converter::convertDuration(od, + ::rtl::OUString::createFromAscii(pis)); + OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dH", + od.Negative, od.Years, od.Months, od.Days, + od.Hours, od.Minutes, od.Seconds, od.HundredthSeconds); + OSL_ASSERT(!bSuccess); + } + Test() { + OSL_TRACE("\nSAX CONVERTER TEST BEGIN\n"); + doTest( util::Duration(false, 1, 0, 0, 0, 0, 0, 0), "P1Y" ); + doTest( util::Duration(false, 0, 42, 0, 0, 0, 0, 0), "P42M" ); + doTest( util::Duration(false, 0, 0, 111, 0, 0, 0, 0), "P111D" ); + doTest( util::Duration(false, 0, 0, 0, 52, 0, 0, 0), "PT52H" ); + doTest( util::Duration(false, 0, 0, 0, 0, 717, 0, 0), "PT717M" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 121, 0), "PT121S" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 19), "PT0.19S" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 9), "PT0.09S" ); + doTest( util::Duration(true , 0, 0, 9999, 0, 0, 0, 0), "-P9999D" ); + doTest( util::Duration(true , 7, 6, 5, 4, 3, 2, 1), + "-P7Y6M5DT4H3M2.01S" ); + doTest( util::Duration(false, 0, 6, 0, 0, 3, 0, 0), "P6MT3M" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 0), "P0D" ); + doTestF("1Y1M"); + doTestF("P-1Y1M"); + doTestF("P1M1Y"); + doTestF("PT1Y"); + doTestF("P1Y1M1M"); + doTestF("P1YT1MT1M"); + doTestF("P1YT"); + doTestF("P99999999999Y"); + doTestF("PT.1S"); + doTestF("PT5M.134S"); + doTestF("PT1.S"); + OSL_TRACE("\nSAX CONVERTER TEST END\n"); + } +}; +static Test test; +#endif + +/** convert util::Date to ISO "date" string */ void Converter::convertDate( ::rtl::OUStringBuffer& i_rBuffer, const util::Date& i_rDate) @@ -947,7 +1276,7 @@ void Converter::convertDate( convertDateTime(i_rBuffer, dt, false); } -/** convert util::DateTime to ISO Date or DateTime String */ +/** convert util::DateTime to ISO "date" or "dateTime" string */ void Converter::convertDateTime( ::rtl::OUStringBuffer& i_rBuffer, const com::sun::star::util::DateTime& i_rDateTime, @@ -1000,7 +1329,7 @@ void Converter::convertDateTime( } } -/** convert ISO Date or DateTime String to util::DateTime */ +/** convert ISO "date" or "dateTime" string to util::DateTime */ bool Converter::convertDateTime( util::DateTime& rDateTime, const ::rtl::OUString& rString ) { @@ -1026,7 +1355,7 @@ bool Converter::convertDateTime( util::DateTime& rDateTime, } } -/** convert ISO Date or DateTime String to util::DateTime or util::Date */ +/** convert ISO "date" or "dateTime" string to util::DateTime or util::Date */ bool Converter::convertDateOrDateTime( util::Date & rDate, util::DateTime & rDateTime, bool & rbDateTime, const ::rtl::OUString & rString ) -- cgit From 09ac98f41e9aaf302b3013a8b462d98b610e4269 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 19 Nov 2009 15:41:16 +0000 Subject: linuxhppa1: #i107051#: port to linux hppa (parisc) --- tools/inc/tools/solar.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/inc/tools/solar.h b/tools/inc/tools/solar.h index 46fe42b9c36f..cd069886d8b6 100644 --- a/tools/inc/tools/solar.h +++ b/tools/inc/tools/solar.h @@ -385,6 +385,8 @@ template inline T Abs(T a) { return (a>=0?a:-a); } #define __DLLEXTENSION "la.so" #elif defined LINUX && defined M68K #define __DLLEXTENSION "lm.so" +#elif defined LINUX && defined HPPA + #define __DLLEXTENSION "lh.so" #elif defined LINUX #error unknown plattform #elif defined FREEBSD && defined X86 -- cgit From 0599d83e9234d822dc76ff5a00ac7d048956e9d3 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Thu, 19 Nov 2009 16:58:34 +0000 Subject: #i106367#: typo prevents correct asian language fallback --- i18npool/source/isolang/mslangid.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18npool/source/isolang/mslangid.cxx b/i18npool/source/isolang/mslangid.cxx index 3476341fbc79..1e58db4e2c0b 100644 --- a/i18npool/source/isolang/mslangid.cxx +++ b/i18npool/source/isolang/mslangid.cxx @@ -160,7 +160,7 @@ LanguageType MsLangId::resolveSystemLanguageByScriptType( LanguageType nLang, sa if (nConfiguredComplexFallback == LANGUAGE_SYSTEM) nLang = LANGUAGE_HINDI; else - nLang = nConfiguredComplexFallback; + nLang = nConfiguredAsianFallback; break; default: if (nConfiguredWesternFallback == LANGUAGE_SYSTEM) -- cgit From c990d5b829ea877c77ccda968eede9ea5ed0836c Mon Sep 17 00:00:00 2001 From: Herbert Duerr Date: Fri, 20 Nov 2009 09:28:09 +0000 Subject: #i107006# text justification invalidates previous measurements of a layout --- vcl/aqua/source/gdi/salatslayout.cxx | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/vcl/aqua/source/gdi/salatslayout.cxx b/vcl/aqua/source/gdi/salatslayout.cxx index 3021e85fed5c..1387a46c6345 100755 --- a/vcl/aqua/source/gdi/salatslayout.cxx +++ b/vcl/aqua/source/gdi/salatslayout.cxx @@ -70,12 +70,13 @@ private: // to prevent ATS overflowing the Fixed16.16 values // ATS font requests get size limited by downscaling huge fonts // in these cases the font scale becomes something bigger than 1.0 - float mfFontScale; + float mfFontScale; private: bool InitGIA( ImplLayoutArgs* pArgs = NULL ) const; bool GetIdealX() const; bool GetDeltaY() const; + void InvalidateMeasurements(); int Fixed2Vcl( Fixed ) const; // convert ATSU-Fixed units to VCL units int AtsuPix2Vcl( int ) const; // convert ATSU-Pixel units to VCL units @@ -310,7 +311,7 @@ void ATSLayout::AdjustLayout( ImplLayoutArgs& rArgs ) mnTrailingSpaceWidth = rArgs.mpDXArray[ mnCharCount-1 ]; if( i > 0 ) mnTrailingSpaceWidth -= rArgs.mpDXArray[ i-1 ]; - InitGIA(); // ensure valid mpCharWidths[] + InitGIA(); // ensure valid mpCharWidths[], TODO: use GetIdealX() instead? mnTrailingSpaceWidth -= Fixed2Vcl( mpCharWidths[i] ); // ignore trailing space for calculating the available width nOrigWidth -= mnTrailingSpaceWidth; @@ -324,11 +325,15 @@ void ATSLayout::AdjustLayout( ImplLayoutArgs& rArgs ) if( !nPixelWidth ) return; - // HACK: justification requests which change the width by just one pixel are probably + // HACK: justification requests which change the width by just one pixel were probably // #i86038# introduced by lossy conversions between integer based coordinate system + // => ignoring such requests has many more benefits than eventual drawbacks if( (nOrigWidth >= nPixelWidth-1) && (nOrigWidth <= nPixelWidth+1) ) return; + // changing the layout will make all previous measurements invalid + InvalidateMeasurements(); + ATSUAttributeTag nTags[3]; ATSUAttributeValuePtr nVals[3]; ByteCount nBytes[3]; @@ -352,7 +357,7 @@ void ATSLayout::AdjustLayout( ImplLayoutArgs& rArgs ) if( eStatus != noErr ) return; - // check result of the justied layout + // update the measurements of the justified layout to match the justification request if( rArgs.mpDXArray ) InitGIA( &rArgs ); } @@ -1069,6 +1074,23 @@ bool ATSLayout::GetDeltaY() const return true; } +// ----------------------------------------------------------------------- + +#define DELETEAZ( X ) { delete[] X; X = NULL; } + +void ATSLayout::InvalidateMeasurements() +{ + mnGlyphCount = -1; + DELETEAZ( mpGlyphIds ); + DELETEAZ( mpCharWidths ); + DELETEAZ( mpChars2Glyphs ); + DELETEAZ( mpGlyphs2Chars ); + DELETEAZ( mpGlyphRTLFlags ); + DELETEAZ( mpGlyphAdvances ); + DELETEAZ( mpGlyphOrigAdvs ); + DELETEAZ( mpDeltaY ); +} + // ======================================================================= #if 0 -- cgit From e3676e17c0f64f8970ded846c70305e01571b22f Mon Sep 17 00:00:00 2001 From: Herbert Duerr Date: Fri, 20 Nov 2009 15:41:39 +0000 Subject: #ii107076# limit minimal device resolution --- vcl/aqua/source/gdi/salgdi.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index eb6434100208..477eeeea9acf 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -407,6 +407,11 @@ void AquaSalGraphics::initResolution( NSWindow* pWin ) // for OSX any anisotropy reported for the display resolution is best ignored (e.g. TripleHead2Go) mnRealDPIX = mnRealDPIY = (mnRealDPIX + mnRealDPIY + 1) / 2; + // #i107076# maintaining size-WYSIWYG-ness causes many problems for low resolution devices + // or for mis-reporting devices => it is better to use a default resolution then + if( mnRealDPIY < 72 ) + mnRealDPIY = 72; + pSalData->mnDPIX = mnRealDPIX; pSalData->mnDPIY = mnRealDPIY; } -- cgit From c419c52df11e6f1860a0fda5a49f7eeeac4a6fd6 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Fri, 20 Nov 2009 17:13:26 +0100 Subject: sconfigl10n: #i107009#: source_config file / multiple repository support in l10n tools --- transex3/inc/export.hxx | 5 +++++ transex3/source/localize.cxx | 16 ++++++++++++---- transex3/source/treeconfig.cxx | 9 +++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/transex3/inc/export.hxx b/transex3/inc/export.hxx index b9c83af56ba0..ec5195034e91 100644 --- a/transex3/inc/export.hxx +++ b/transex3/inc/export.hxx @@ -53,6 +53,11 @@ #include #include +#include +#ifdef WNT +#include +#endif + #define NO_TRANSLATE_ISO "x-no-translate" #define JAPANESE_ISO "ja" diff --git a/transex3/source/localize.cxx b/transex3/source/localize.cxx index 09c9b29bb447..c82d152cac7e 100644 --- a/transex3/source/localize.cxx +++ b/transex3/source/localize.cxx @@ -500,8 +500,8 @@ BOOL SourceTreeLocalizer::Extract( const ByteString &rDestinationFile ) /*****************************************************************************/ { nMode = LOCALIZE_EXTRACT; - aSDF.Open( String( rDestinationFile, RTL_TEXTENCODING_ASCII_US ), - STREAM_STD_WRITE ); + + aSDF.Open( String( rDestinationFile , RTL_TEXTENCODING_ASCII_US ) , STREAM_STD_WRITE ); aSDF.SetLineDelimiter( LINEEND_CRLF ); BOOL bReturn = aSDF.IsOpen(); @@ -514,6 +514,7 @@ BOOL SourceTreeLocalizer::Extract( const ByteString &rDestinationFile ) printf("ERROR: Can't create file %s\n", rDestinationFile.GetBuffer() ); } nMode = LOCALIZE_NONE; + aSDF.Close(); return bReturn; } @@ -767,9 +768,9 @@ BOOL SourceTreeLocalizer::Merge( const ByteString &rSourceFile , const ByteStrin BOOL bReturn = aSDF.IsOpen(); if ( bReturn ) { bReturn = ExecuteMerge(); - aSDF.Close(); +// aSDF.Close(); } - + aSDF.Close(); nMode = LOCALIZE_NONE; return bReturn; } @@ -925,6 +926,13 @@ int _cdecl main( int argc, char *argv[] ) return 3; } + DirEntry aEntry( String( sFileName , RTL_TEXTENCODING_ASCII_US )); + aEntry.ToAbs(); + String sFullEntry = aEntry.GetFull(); + ByteString sFileABS( aEntry.GetFull(), gsl_getSystemTextEncoding()); + //printf("B %s\nA %s\n",rDestinationFile.GetBuffer(), sFile.GetBuffer()); + sFileName = sFileABS; + Treeconfig treeconfig; vector repos; bool hasPwd = treeconfig.getActiveRepositories( repos ); diff --git a/transex3/source/treeconfig.cxx b/transex3/source/treeconfig.cxx index 2430f11f0e0d..d9e3b829982b 100644 --- a/transex3/source/treeconfig.cxx +++ b/transex3/source/treeconfig.cxx @@ -3,7 +3,12 @@ #include #include "treeconfig.hxx" #include "export.hxx" +#ifdef WNT +#include +#include +#else #include +#endif #include #include #include @@ -111,7 +116,11 @@ bool Treeconfig::isConfigFilePresent() { return false; } +#ifdef WNT + return ( status.st_mode & _S_IFREG ) && ( _access( config_file.c_str() , 4 ) >= 0 ) ; +#else return ( status.st_mode & S_IFREG ) && ( access( config_file.c_str() , R_OK ) >= 0 ) ; +#endif } -- cgit From 972c78c8869ee4e786ca37d9570b00edb1820f23 Mon Sep 17 00:00:00 2001 From: Herbert Duerr Date: Mon, 23 Nov 2009 10:43:01 +0000 Subject: #i107076# device DPI now gets a minimum limit --- vcl/aqua/source/gdi/salgdi.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index 477eeeea9acf..f94c346caa71 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -404,13 +404,14 @@ void AquaSalGraphics::initResolution( NSWindow* pWin ) DBG_ERROR( "no screen found" ); } - // for OSX any anisotropy reported for the display resolution is best ignored (e.g. TripleHead2Go) - mnRealDPIX = mnRealDPIY = (mnRealDPIX + mnRealDPIY + 1) / 2; - // #i107076# maintaining size-WYSIWYG-ness causes many problems for low resolution devices // or for mis-reporting devices => it is better to use a default resolution then - if( mnRealDPIY < 72 ) - mnRealDPIY = 72; + static const int nMinDPI = 72; + if( (mnRealDPIX < nMinDPI) || (mnRealDPIY < nMinDPI) ) + mnRealDPIX = mnRealDPIY = nMinDPI; + + // for OSX any anisotropy reported for the display resolution is best ignored (e.g. TripleHead2Go) + mnRealDPIX = mnRealDPIY = (mnRealDPIX + mnRealDPIY + 1) / 2; pSalData->mnDPIX = mnRealDPIX; pSalData->mnDPIY = mnRealDPIY; -- cgit From eb7cae342a96d738a45a28ad8cf0d7c2b7d1b39f Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Mon, 23 Nov 2009 16:33:39 +0000 Subject: CWS-TOOLING: integrate CWS fwk125 2009-11-19 08:11:20 +0100 jsk r277554 : fwk125: #i105760# - removed warnlog, re-enabled autotest e_help.bas 2009-11-16 16:21:49 +0100 tl r277521 : #i106571# fixed locale list for dictionaries to get rid of duplicate entries 2009-11-12 08:47:31 +0100 hde r277469 : rework of hyphenation 2009-11-11 15:25:16 +0100 hde r277462 : rework of hyphenation 2009-11-11 15:24:09 +0100 hde r277461 : rework of hyphenation 2009-11-11 13:52:02 +0100 hde r277453 : new include for hyphenation tools 2009-11-10 12:28:51 +0100 tl r277427 : #i102304# fix for hyphenation dialog 2009-11-10 12:00:10 +0100 mav r277425 : #i10000# A workaround for pch and windows headers conflict 2009-11-10 11:58:32 +0100 mav r277424 : #i10000# A workaround for pch and windows headers conflict 2009-11-09 15:47:59 +0100 kso r277414 : #i16732# fixed url matching. 2009-11-09 11:51:40 +0100 mav r277406 : #i10000# use precompiled headers 2009-11-08 23:53:03 +0100 mav r277399 : #i10000# fix warning 2009-11-08 23:50:23 +0100 mav r277398 : #i10000# adapt for unix 2009-11-08 23:49:52 +0100 mav r277397 : #i10000# adapt for unix 2009-11-08 21:26:06 +0100 mav r277396 : CWS-TOOLING: rebase CWS fwk125 to branches/OOO320@277373 (milestone: OOO320:m4) 2009-11-06 16:30:27 +0100 ab r277394 : #i106100# Hold references to packages to speed up further calls to getDeployedPackages() 2009-11-06 15:58:48 +0100 mav r277392 : #i102464# check the Windows ACL 2009-11-06 15:58:23 +0100 mav r277391 : #i102464# check the Windows ACL 2009-11-04 11:54:06 +0100 tl r277342 : #i106497# incorrectly found 'supported languages' fixed 2009-11-04 10:40:51 +0100 tl r277335 : #i106571# dictionary updates for Polish and Swedish. 2009-10-28 09:54:41 +0100 tl r277236 : #i106100# context menu performance 2009-10-27 15:47:05 +0100 tl r277213 : #i106100# context menu performance 2009-10-23 17:31:56 +0200 mav r277170 : #i106075# use correct path to inprocserv.dll 2009-10-23 16:07:27 +0200 mav r277168 : #i105760# seek the temporary file to beginning also for URL case 2009-10-23 11:03:58 +0200 mav r277134 : CWS-TOOLING: rebase CWS fwk125 to branches/OOO320@276942 (milestone: OOO320:m2) --- svtools/source/passwordcontainer/passwordcontainer.cxx | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/svtools/source/passwordcontainer/passwordcontainer.cxx b/svtools/source/passwordcontainer/passwordcontainer.cxx index cebde0705f12..2349a9f9a3da 100644 --- a/svtools/source/passwordcontainer/passwordcontainer.cxx +++ b/svtools/source/passwordcontainer/passwordcontainer.cxx @@ -152,17 +152,10 @@ static vector< ::rtl::OUString > getInfoFromInd( ::rtl::OUString aInd ) static sal_Bool shorterUrl( ::rtl::OUString& aURL ) { sal_Int32 aInd = aURL.lastIndexOf( sal_Unicode( '/' ) ); - - if( aInd > 0 ) + if( aInd > 0 && aURL.indexOf( ::rtl::OUString::createFromAscii( "://" ) ) != aInd-2 ) { - sal_Int32 aPrevInd = aURL.lastIndexOf( sal_Unicode( '/' ), aInd ); - if ( aURL.indexOf( ::rtl::OUString::createFromAscii( "://" ) ) - != aPrevInd - 2 || - aInd != aURL.getLength() - 1 ) - { - aURL = aURL.copy( 0, aInd ); - return sal_True; - } + aURL = aURL.copy( 0, aInd ); + return sal_True; } return sal_False; -- cgit From 9d63153784cc630907fa0e4347e4cb922f0eb74d Mon Sep 17 00:00:00 2001 From: Herbert Duerr Date: Tue, 24 Nov 2009 08:00:19 +0000 Subject: #i107076# device DPI also gets a maximum limit --- vcl/aqua/source/gdi/salgdi.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index f94c346caa71..1c9bdda3fbdb 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -404,11 +404,15 @@ void AquaSalGraphics::initResolution( NSWindow* pWin ) DBG_ERROR( "no screen found" ); } - // #i107076# maintaining size-WYSIWYG-ness causes many problems for low resolution devices - // or for mis-reporting devices => it is better to use a default resolution then + // #i107076# maintaining size-WYSIWYG-ness causes many problems for + // low-DPI, high-DPI or for mis-reporting devices + // => it is better to limit the calculation result then static const int nMinDPI = 72; if( (mnRealDPIX < nMinDPI) || (mnRealDPIY < nMinDPI) ) mnRealDPIX = mnRealDPIY = nMinDPI; + static const int nMaxDPI = 200; + if( (mnRealDPIX > nMaxDPI) || (mnRealDPIY > nMaxDPI) ) + mnRealDPIX = mnRealDPIY = nMaxDPI; // for OSX any anisotropy reported for the display resolution is best ignored (e.g. TripleHead2Go) mnRealDPIX = mnRealDPIY = (mnRealDPIX + mnRealDPIY + 1) / 2; -- cgit From 49f38b850c63d5886c18a351979e6ebdac81868a Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Tue, 24 Nov 2009 12:04:19 +0000 Subject: #i107080# autorelease pool only on first yield --- vcl/aqua/source/app/salinst.cxx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx index e4037df0c4aa..cd291fdfbbf2 100644 --- a/vcl/aqua/source/app/salinst.cxx +++ b/vcl/aqua/source/app/salinst.cxx @@ -675,8 +675,21 @@ class ReleasePoolHolder { NSAutoreleasePool* mpPool; public: - ReleasePoolHolder() : mpPool( [[NSAutoreleasePool alloc] init] ) {} - ~ReleasePoolHolder() { [mpPool release]; } + ReleasePoolHolder() : mpPool( nil ) + { + // NSAutoreleasePool documentation suggests we should have + // an own pool for each yield level + // #i107080# however shows us that doing that can easily crash + // while VoiceOver is active. So for now let's create an + // autorelease pool only for the top of the yield stack + if( ImplGetSVData()->maAppData.mnDispatchLevel == 1 ) + mpPool = [[NSAutoreleasePool alloc] init]; + } + ~ReleasePoolHolder() + { + if( mpPool ) + [mpPool release]; + } }; void AquaSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) @@ -685,8 +698,6 @@ void AquaSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) // will therefore not be destroyed by cocoa implicitly SalData::ensureThreadAutoreleasePool(); - // NSAutoreleasePool documentation suggests we should have - // an own pool for each yield level ReleasePoolHolder aReleasePool; // Release all locks so that we don't deadlock when we pull pending -- cgit From ffd903ad592ccc69c180ef2dd2117f6c69705d6e Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 24 Nov 2009 13:00:13 +0000 Subject: cmcfixes67: #i101158# fix parallel build with system lucene, and remove unused copy of MANIFEST.MK --- transex3/source/help/MANIFEST.MF | 2 -- transex3/source/help/makefile.mk | 19 ------------------- 2 files changed, 21 deletions(-) delete mode 100644 transex3/source/help/MANIFEST.MF diff --git a/transex3/source/help/MANIFEST.MF b/transex3/source/help/MANIFEST.MF deleted file mode 100644 index bf0e4ab46cb2..000000000000 --- a/transex3/source/help/MANIFEST.MF +++ /dev/null @@ -1,2 +0,0 @@ -RegistrationClassName: com.sun.star.help.HelpComponent -Class-Path: lucene-core-2.3.jar lucene-analyzers-2.3.jar diff --git a/transex3/source/help/makefile.mk b/transex3/source/help/makefile.mk index edf68d906133..6fc823a1b59a 100644 --- a/transex3/source/help/makefile.mk +++ b/transex3/source/help/makefile.mk @@ -104,36 +104,17 @@ JAVACLASSFILES = \ $(CLASSDIR)$/$(PACKAGE)$/HelpIndexerTool.class \ $(CLASSDIR)$/$(PACKAGE)$/HelpFileDocument.class - -# $(CLASSDIR)$/$(PACKAGE)$/HelpSearch.class \ -# $(CLASSDIR)$/$(PACKAGE)$/HelpIndexer.class \ -# $(CLASSDIR)$/$(PACKAGE)$/HelpComponent.class \ -# $(CLASSDIR)$/$(PACKAGE)$/HelpFileDocument.class - -#JARFILES = ridl.jar jurt.jar unoil.jar juh.jar .IF "$(SYSTEM_LUCENE)" == "YES" CLASSPATH!:=$(CLASSPATH)$(PATH_SEPERATOR)$(LUCENE_CORE_JAR)$(PATH_SEPERATOR)$(LUCENE_ANALYZERS_JAR) -COMP=fix_system_lucene .ELSE JARFILES += lucene-core-2.3.jar lucene-analyzers-2.3.jar .ENDIF JAVAFILES = $(subst,$(CLASSDIR)$/$(PACKAGE)$/, $(subst,.class,.java $(JAVACLASSFILES))) -#JAVAFILES = $(JAVACLASSFILES) JARCLASSDIRS = $(PACKAGE)/* JARTARGET = HelpIndexerTool.jar JARCOMPRESS = TRUE -#CUSTOMMANIFESTFILE = MANIFEST.MF # --- Targets ------------------------------------------------------ .INCLUDE : target.mk - -.IF "$(JARTARGETN)"!="" -$(JARTARGETN) : $(COMP) -.ENDIF - -fix_system_lucene: - @echo "Fix Java Class-Path entry for Lucene libraries from system." - @$(SED) -r -e "s#^(Class-Path:).*#\1 file://$(LUCENE_CORE_JAR) file://$(LUCENE_ANALYZERS_JAR)#" \ - -i ../../$(INPATH)/class/HelpLinker/META-INF/MANIFEST.MF -- cgit From e4f41f75acdebc7885377d476606fd5ffbfa8e0d Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Tue, 24 Nov 2009 13:41:47 +0000 Subject: #i107075# check interface pointer, XAxccessibleTextMarkup is not implemented in Calc --- vcl/unx/gtk/a11y/atktext.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vcl/unx/gtk/a11y/atktext.cxx b/vcl/unx/gtk/a11y/atktext.cxx index 8d83ca008e4a..f6755deb60b5 100644 --- a/vcl/unx/gtk/a11y/atktext.cxx +++ b/vcl/unx/gtk/a11y/atktext.cxx @@ -188,7 +188,8 @@ static accessibility::XAccessibleTextMarkup* { uno::Any any = pWrap->mpContext->queryInterface( accessibility::XAccessibleTextMarkup::static_type(NULL) ); pWrap->mpTextMarkup = reinterpret_cast< accessibility::XAccessibleTextMarkup * > (any.pReserved); - pWrap->mpTextMarkup->acquire(); + if( pWrap->mpTextMarkup ) + pWrap->mpTextMarkup->acquire(); } return pWrap->mpTextMarkup; -- cgit From 701312f1975f3ce7f50e22e7923cb7280c5d7076 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Tue, 24 Nov 2009 14:40:24 +0000 Subject: CWS-TOOLING: integrate CWS localization37 2009-11-20 17:34:04 +0100 ihi r277585 : not yet the best solution 2009-11-19 14:34:34 +0100 ihi r277560 : #i103247# updated Luxembourgish autocorrect data 2009-11-16 16:58:56 +0100 ihi r277525 : added ast to no_ms_lang 2009-11-16 16:57:23 +0100 ihi r277524 : added ast 2009-11-16 16:41:22 +0100 ihi r277523 : #i106900# updated identifier ShowAnnotation -> ShowAnnotations 2009-11-16 16:39:34 +0100 ihi r277522 : small helper script 2009-11-16 15:24:34 +0100 ihi r277520 : Fixed german and removed ln ti pap ur 2009-11-11 14:27:38 +0100 releng r277457 : added ug, om, si, oc, or, ml, as to non ms langs 2009-11-11 14:23:30 +0100 releng r277456 : Fix for merging more then just one 2009-11-11 14:12:52 +0100 ihi r277455 : #i106775# Merge of OOo 3.2 l10n cws localization37 nb nn he ga uk my bg ja uz fi bn kid fr nl vi ca pt-BR ru ka oc gl cs km kn ko sh si om gu sk sl zh-CN ku or da sr de sv hi-IN pa-IN ta te pl th hu dz lv pt tr en-GB id el ar as eo es ml et eu zh-TW is ug it mr 2009-11-05 23:07:09 +0100 ihi r277375 : added om kid , removed dupe ta-IN 2009-11-03 18:09:39 +0100 ihi r277327 : removed dupe 2009-11-02 19:02:55 +0100 ihi r277303 : #i105973 obsolete sdf files removed 2009-11-02 19:02:16 +0100 ihi r277302 : #i105973 obsolete sdf files removed 2009-10-13 19:19:06 +0200 ihi r276871 : CWS-TOOLING: rebase CWS localization37 to branches/OOO320@276773 (milestone: OOO320:m1) 2009-10-01 13:19:45 +0200 ihi r276598 : key -> ky ... this one triggered a bad crash in rsc 2009-09-09 17:02:20 +0200 ihi r276004 : added some langs 2009-09-09 13:17:16 +0200 ihi r275986 : lucky local cygwin fix 2009-09-03 18:47:45 +0200 ihi r275769 : #104328# deal with l10nless src files 2009-09-03 15:58:51 +0200 ihi r275760 : added some new langs 2009-09-03 15:54:16 +0200 ihi r275759 : old localize.pl tool used as a helper 2009-09-03 15:53:48 +0200 ihi r275758 : do not merge not wellformated sdf files 2009-09-03 15:51:59 +0200 ihi r275757 : old localize.pl tool used as a helper 2009-09-03 15:50:03 +0200 ihi r275756 : some small helpers added 2009-09-01 18:22:04 +0200 ihi r275681 : update DEV300 code line with OOO310 strings 2009-09-01 13:45:43 +0200 ihi r275658 : #i104680# prevent that self defined or dupe ms ids are merged --- transex3/prj/d.lst | 2 + transex3/scripts/fast_merge.pl | 2 +- transex3/scripts/localize_old.pl | 1130 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 1133 insertions(+), 1 deletion(-) create mode 100755 transex3/scripts/localize_old.pl diff --git a/transex3/prj/d.lst b/transex3/prj/d.lst index 39bafa4694c6..a469837275ed 100644 --- a/transex3/prj/d.lst +++ b/transex3/prj/d.lst @@ -41,8 +41,10 @@ mkdir: %_DEST%\bin%_EXT%\help\com\sun\star\help ..\%__SRC%\class\receditor\receditor.jar %_DEST%\bin%_EXT%\receditor.jar ..\scripts\localize.pl %_DEST%\bin%_EXT%\localize.pl +..\scripts\localize_old.pl %_DEST%\bin%_EXT%\localize_old.pl ..\scripts\localize %_DEST%\bin%_EXT%\localize ..\scripts\fast_merge.pl %_DEST%\bin%_EXT%\fast_merge.pl +..\scripts\keyidGen.pl %_DEST%\bin%_EXT%\keyidGen.pl ..\inc\export.hxx %_DEST%\inc%_EXT%\transex3\export.hxx ..\inc\transex3\directory.hxx %_DEST%\inc%_EXT%\transex3\directory.hxx diff --git a/transex3/scripts/fast_merge.pl b/transex3/scripts/fast_merge.pl index 266c1c0801e8..7321a9a42911 100644 --- a/transex3/scripts/fast_merge.pl +++ b/transex3/scripts/fast_merge.pl @@ -179,7 +179,7 @@ sub getNextSdfObj } else { - $line =~ /^(([^\t]*)\t([^\t]*).*)/o ; + $line =~ /^(([^\t]*)\t([^\t]*)[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t*)/o ; if( defined $1 && defined $2 && defined $3 ) { $obj->line ( $1 ); diff --git a/transex3/scripts/localize_old.pl b/transex3/scripts/localize_old.pl new file mode 100755 index 000000000000..151399d22002 --- /dev/null +++ b/transex3/scripts/localize_old.pl @@ -0,0 +1,1130 @@ +: +eval 'exec perl -wS $0 ${1+"$@"}' + if 0; + + +#************************************************************************* +# +# 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 +# +# $RCSfile: localize.pl,v $ +# +# $Revision: 1.18 $ +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +use strict; +use Getopt::Long; +use IO::Handle; +use File::Find; +use File::Temp; +use File::Copy; +use File::Glob qw(:glob csh_glob); +use Cwd; + +# ver 1.1 +# +#### module lookup +#use lib ("$ENV{SOLARENV}/bin/modules", "$ENV{COMMON_ENV_TOOLS}/modules"); + +#### module lookup +# OOo conform +my @lib_dirs; +BEGIN { + if ( !defined($ENV{SOLARENV}) ) { + die "No environment found (environment variable SOLARENV is undefined)"; + } + push(@lib_dirs, "$ENV{SOLARENV}/bin/modules"); + push(@lib_dirs, "$ENV{COMMON_ENV_TOOLS}/modules") if defined($ENV{COMMON_ENV_TOOLS}); +} +use lib (@lib_dirs); + +#### globals #### +my $sdffile = ''; +my $no_sort = ''; +my $outputfile = ''; +my $mode = ''; +my $bVerbose="0"; +my $srcpath = ''; +my $WIN; +my $languages; +#my %sl_modules; # Contains all modules where en-US and de is source language +my $use_default_date = '0'; + + # ( leftpart ) ( rightpart ) + # prj file dummy type gid lid helpid pform width lang text helptext qhelptext title timestamp +my $sdf_regex = "((([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*))\t([^\t]*)\t(([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t)([^\t]*))"; +my $file_types = "(src|hrc|xcs|xcu|lng|ulf|xrm|xhp|xcd|xgf|xxl|xrb)"; +# Always use this date to prevent cvs conflicts +my $default_date = "2002-02-02 02:02:02"; + +#### main #### +parse_options(); + +if ( defined $ENV{USE_SHELL} && $ENV{USE_SHELL} eq '4nt' ) { + $WIN = 'TRUE'; +} + else { + $WIN = ''; +} + +#%sl_modules = fetch_sourcelanguage_dirlist(); + + +if ( $mode eq "merge" ) { + merge_gsicheck(); + splitfile( $sdffile ); + unlink $sdffile; # remove temp file! +} +elsif( $mode eq "extract" ) { + collectfiles( $outputfile ); +} +else { + usage(); +} + +exit(0); + +######################################################### +sub splitfile{ + + my $lastFile = ''; + my $currentFile = ''; + my $cur_sdffile = ''; + my $last_sdffile = ''; + my $delim; + my $badDelim; + my $start = 'TRUE'; + my %index = (); + my %block; + + STDOUT->autoflush( 1 ); + + #print STDOUT "Open File $sdffile\n"; + open MYFILE , "< $sdffile" + or die "Can't open '$sdffile'\n"; + + while( ){ + if( /$sdf_regex/ ){ + my $line = defined $_ ? $_ : ''; + my $prj = defined $3 ? $3 : ''; + my $file = defined $4 ? $4 : ''; + my $type = defined $6 ? $6 : ''; + my $gid = defined $7 ? $7 : ''; + my $lid = defined $8 ? $8 : ''; + my $lang = defined $12 ? $12 : ''; + my $plattform = defined $10 ? $10 : ''; + my $helpid = defined $9 ? $9 : ''; + + next if( $prj eq "binfilter" ); # Don't merge strings into binfilter module + chomp( $line ); + $currentFile = $srcpath . '\\' . $prj . '\\' . $file; + if ( $WIN ) { $currentFile =~ s/\//\\/g; } + else { $currentFile =~ s/\\/\//g; } + + $cur_sdffile = $currentFile; + #if( $cur_sdffile =~ /\.$file_types[\s]*$/ ){ + if( $WIN ) { $cur_sdffile =~ s/\\[^\\]*\.$file_types[\s]*$/\\localize.sdf/; } + else { $cur_sdffile =~ s/\/[^\/]*\.$file_types[\s]*$/\/localize.sdf/; } + #} + + # Set default date + if( $line =~ /(.*)\t[^\t\$]*$/ ){ + $line = $1."\t".$default_date; + } + + if( $start ){ + $start=''; + $lastFile = $currentFile; # ? + $last_sdffile = $cur_sdffile; + } + + if( $lang eq "en-US" ){} + elsif( $cur_sdffile eq $last_sdffile ) + { + $block{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } = $line ; + } + else + { + writesdf( $lastFile , \%block ); + $lastFile = $currentFile; #? + $last_sdffile = $cur_sdffile; + %block = (); + #if( ! $lang eq "en-US" ) { + $block{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } = $line ; + #} + + } + } #else { print STDOUT "splitfile REGEX kaputt\n";} + + } + writesdf( $lastFile , \%block ); + %block = (); + close( MYFILE ); + +} +######################################################### + +#sub fetch_sourcelanguage_dirlist +#{ +# +# my $working_path = getcwd(); +# my %sl_dirlist; +# +# chdir $srcpath; +# my @all_dirs = csh_glob( "*" ); +# +# foreach my $file ( @all_dirs ) +# { +# if( -d $file ) +# { +# my $module = $file; +# $file .= "/prj/l10n"; +# $file =~ s/\//\\/ , if( $WIN ) ; +# +# if( -f $file ) # Test file /prj/l10n +# { +# $sl_dirlist{ $module } = 1; +# if( $bVerbose eq "1" ) { print STDOUT "$module: de and en-US source language detected\n"; } +# } +# } +# } +# +# chdir $working_path; +# +# return %sl_dirlist; +#} + +#sub has_two_sourcelanguages +#{ +# my $module = shift; +# return defined $sl_modules{ $module } ; +#} +sub writesdf{ + + my $lastFile = shift; + my $blockhash_ref = shift; + my $localizeFile = $lastFile; + my %index=(); + + if( $localizeFile =~ /\.$file_types[\s]*$/ ){ + if( $WIN ) { $localizeFile =~ s/\\[^\\]*\.$file_types[\s]*$/\\localize.sdf/; } + else { $localizeFile =~ s/\/[^\/]*\.$file_types[\s]*$/\/localize.sdf/; } + }else { + print STDERR "Strange filetype found '$localizeFile'\n"; + return; + } + if( open DESTFILE , "< $localizeFile" ){ + + #or die "Can't open/create '\$localizeFile'"; + + #### Build hash + while(){ + if( /$sdf_regex/ ){ + my $line = defined $_ ? $_ : ''; + my $prj = defined $3 ? $3 : ''; + my $file = defined $4 ? $4 : ''; + my $type = defined $6 ? $6 : ''; + my $gid = defined $7 ? $7 : ''; + my $lid = defined $8 ? $8 : ''; + my $lang = defined $12 ? $12 : ''; + my $plattform = defined $10 ? $10 : ''; + my $helpid = defined $9 ? $9 : ''; + + chomp( $line ); + $index{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } = $line ; + + } #else { print STDOUT "writesdf REGEX kaputt $_\n";} + + } + close( DESTFILE ); + } + #### Copy new strings + my @mykeys = keys( %{ $blockhash_ref } ); + my $isDirty = "FALSE"; + foreach my $key( @mykeys ){ + if( ! defined $index{ $key } ){ + # Add new entry + $index{ $key } = $blockhash_ref->{ $key} ; + $isDirty = "TRUE"; + }elsif( $index{ $key } ne $blockhash_ref->{ $key } ){ + # Overwrite old entry + $index{ $key } = $blockhash_ref->{ $key }; + $isDirty = "TRUE"; + }else { + } + } + + #### Write file + + if( !$bVerbose ){ print STDOUT "."; } + if( $isDirty eq "TRUE" ){ + if( $bVerbose ){ print STDOUT "$localizeFile\n"; } + if( open DESTFILE , "+> $localizeFile" ){ + print DESTFILE get_license_header(); + @mykeys = sort keys( %index ); + foreach my $key( @mykeys ){ + print DESTFILE ( $index{ $key } , "\n" ); + } + close DESTFILE; + }else { + print STDOUT "WARNING: File $localizeFile is not writable , try to merge ...\n"; + my ( $TMPFILE , $tmpfile ) = File::Temp::tempfile(); + if( open DESTFILE , "+> $tmpfile " ){ + @mykeys = keys( %index ); + foreach my $key( @mykeys ){ + print DESTFILE ( $index{ $key } , "\n" ); + } + close DESTFILE; + if( move( $localizeFile , $localizeFile.".backup" ) ){ + if( copy( $tmpfile , $localizeFile ) ){ + unlink $localizeFile.".backup"; + } else { print STDERR "Can't open/create '$localizeFile', original file is renamed to $localizeFile.backup\n"; } + } else { print STDERR "Can't open/create '$localizeFile'\n"; } + }else{ + print STDERR "WARNING: Can't open/create '$localizeFile'\n"; + } + unlink $tmpfile; + } + } +# if( $no_sort eq '' ){ +# sort_outfile( $localizeFile ); +# } +} + +sub get_license_header{ + return +"#\n". +"# #### ### # # ### ##### ##### #### ##### ##### \n". +"# # # # # ## # # # # # # # # # \n". +"# # # # # # # # # # # ### # # # # \n". +"# # # # # # ## # # # # # # # # \n". +"# #### ### # # ### # ##### #### ##### # \n". +"#\n". +"# DO NOT EDIT! This file will be overwritten by localisation process\n". +"#\n". +"#*************************************************************************\n". +"#\n". +"# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n". +"# \n". +"# Copyright 2008 by Sun Microsystems, Inc.\n". +"#\n". +"# OpenOffice.org - a multi-platform office productivity suite\n". +"#\n". +"# \$RCSfile:". +"localize.pl,v \$\n". +"#\n". +"# \$Revision: ". +"1.17.4.1 \$\n". +"#\n". +"# This file is part of OpenOffice.org.\n". +"#\n". +"# OpenOffice.org is free software: you can redistribute it and/or modify\n". +"# it under the terms of the GNU Lesser General Public License version 3\n". +"# only, as published by the Free Software Foundation.\n". +"#\n". +"# OpenOffice.org is distributed in the hope that it will be useful,\n". +"# but WITHOUT ANY WARRANTY; without even the implied warranty of\n". +"# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n". +"# GNU Lesser General Public License version 3 for more details\n". +"# (a copy is included in the LICENSE file that accompanied this code).\n". +"#\n". +"# You should have received a copy of the GNU Lesser General Public License\n". +"# version 3 along with OpenOffice.org. If not, see\n". +"# \n". +"# for a copy of the LGPLv3 License.\n". +"#\n". +"#*************************************************************************\n"; +} +######## Check input sdf file and use only the correct part +sub merge_gsicheck{ + my $command = ''; + my ( $TMPHANDLE , $tmpfile ) = File::Temp::tempfile(); + my ( $TMPHANDLE2 , $tmpfile2 ) = File::Temp::tempfile(); + close ( $TMPHANDLE ); + close ( $TMPHANDLE2 ); + + unlink $tmpfile2; + my $output2 = `cat $sdffile | sort > $tmpfile2`; + my $rc2 = $? << 8; + if( $rc2 ne 0 ){ + printf("ERROR: Failed -> cat $sdffile | sort > $tmpfile2\n$output2\n"); + exit( -1 ); + } + +# if( $ENV{WRAPCMD} ){ +# $command = "$ENV{WRAPCMD} gsicheck"; +# }else{ +# $command = "gsicheck"; +# } +# my $errfile = $tmpfile.".err"; +# $command .= " -k -c -wcf $tmpfile -wef $errfile -l \"\" $tmpfile2"; +# my $output = `$command`; +# my $rc = $? << 8; +# if ( $output ne "" ){ +# print STDOUT "### gsicheck ###\n"; +# print STDOUT "### The file $errfile have been written containing the errors in your sdf file. Those lines will not be merged: ###\n\n"; +# print STDOUT "$output\n"; +# print STDOUT "################\n"; +# +# }else{ +# # Remove the 0 Byte file +# unlink $errfile; +# } + $sdffile = $tmpfile2; +# unlink $tmpfile2; +} +######################################################### +sub collectfiles{ + print STDOUT "### Localize\n"; + my @sdfparticles; + my $localizehash_ref; + my ( $bAll , $bUseLocalize, $langhash_ref , $bHasSourceLanguage , $bFakeEnglish ) = parseLanguages(); + + # Enable autoflush on STDOUT + # $| = 1; + STDOUT->autoflush( 1 ); + + ### Search sdf particles + print STDOUT "### Searching sdf particles\n"; + my $working_path = getcwd(); + chdir $srcpath; + find sub { + my $file = $File::Find::name; + if( -f && $file =~ /.*localize.sdf$/ ) { + push @sdfparticles , $file; + if( $bVerbose eq "1" ) { print STDOUT "$file\n"; } + else { print "."; } + + } + } , getcwd() ;#"."; #$srcpath; + chdir $working_path; + + my $nFound = $#sdfparticles +1; + print "\n $nFound files found !\n"; + + my ( $LOCALIZEPARTICLE , $localizeSDF ) = File::Temp::tempfile(); + close( $LOCALIZEPARTICLE ); + + my ( $ALLPARTICLES_MERGED , $particleSDF_merged ) = File::Temp::tempfile(); + close( $ALLPARTICLES_MERGED ); + my ( $LOCALIZE_LOG , $my_localize_log ) = File::Temp::tempfile(); + close( $LOCALIZE_LOG ); + + ## Get the localize de,en-US extract + if( $bAll || $bUseLocalize ){ + print "### Fetching source language strings\n"; + my $command = ""; + my $args = ""; + + if( $ENV{WRAPCMD} ){ + $command = "$ENV{WRAPCMD} localize_sl"; + }else{ + $command = "localize_sl"; + } + + # -e + # if ( -x $command ){ + if( $command ){ + if( !$bVerbose ){ $args .= " -QQ -skip_links "; } + $args .= " -e -f $localizeSDF -l "; + my $bFlag=""; + if( $bAll ) {$args .= " en-US";} + else{ + my @list; + foreach my $isokey ( keys( %{ $langhash_ref } ) ){ + push @list , $isokey; + if( $langhash_ref->{ $isokey } ne "" ){ + push @list , $langhash_ref->{ $isokey }; + } + } + remove_duplicates( \@list ); + foreach my $isokey ( @list ){ + switch :{ + #( $isokey=~ /^de$/i ) + # && do{ + # if( $bFlag eq "TRUE" ){ $args .= ",de"; } + # else { + # $args .= "de"; $bFlag = "TRUE"; + # } + # }; + ( $isokey=~ /^en-US$/i ) + && do{ + if( $bFlag eq "TRUE" ){ $args .= ",en-US"; } + else { + $args .= "en-US"; $bFlag = "TRUE"; + } + }; + + } #switch + } #foreach + } # if + } # if +# if ( !$bVerbose ){ +# if ( $WIN eq "TRUE" ) { $args .= " > $my_localize_log"; } +# else { $args .= " >& $my_localize_log"; } +# } + if ( $bVerbose ) { print STDOUT $command.$args."\n"; } + + my $rc = system( $command.$args ); + + #my $output = `$command.$args`; + #my $rc = $? << 8; + + if( $rc < 0 ){ print STDERR "ERROR: localize rc = $rc\n"; exit( -1 ); } + ( $localizehash_ref ) = read_file( $localizeSDF , $langhash_ref ); + + } + ## Get sdf particles + open ALLPARTICLES_MERGED , "+>> $particleSDF_merged" + or die "Can't open $particleSDF_merged"; + + ## Fill fackback hash + my( $fallbackhashhash_ref ) = fetch_fallback( \@sdfparticles , $localizeSDF , $langhash_ref ); +# my( $fallbackhashhash_ref ) = fetch_fallback( \@sdfparticles , $localizeSDF , $langhash_ref ); + my %block; + my $cur_fallback; + if( !$bAll) { + foreach my $cur_lang ( keys( %{ $langhash_ref } ) ){ + #print STDOUT "DBG: G1 cur_lang=$cur_lang\n"; + $cur_fallback = $langhash_ref->{ $cur_lang }; + if( $cur_fallback ne "" ){ + # Insert fallback strings + #print STDOUT "DBG: Renaming $cur_fallback to $cur_lang in fallbackhash\n"; + rename_language( $fallbackhashhash_ref , $cur_fallback , $cur_lang ); + } + foreach my $currentfile ( @sdfparticles ){ + if ( open MYFILE , "< $currentfile" ) { + while(){ + if( /$sdf_regex/ ){ + my $line = defined $_ ? $_ : ''; + my $prj = defined $3 ? $3 : ''; + my $file = defined $4 ? $4 : ''; + my $type = defined $6 ? $6 : ''; + my $gid = defined $7 ? $7 : ''; + my $lid = defined $8 ? $8 : ''; + my $lang = defined $12 ? $12 : ''; + my $plattform = defined $10 ? $10 : ''; + my $helpid = defined $9 ? $9 : ''; + + chomp( $line ); + + if ( $lang eq $cur_lang ){ + # Overwrite fallback strings with collected strings + #if( ( !has_two_sourcelanguages( $cur_lang) && $cur_lang eq "de" ) || $cur_lang ne "en-US" ){ + $fallbackhashhash_ref->{ $cur_lang }{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } = $line ; + #} + + } + } + } + }else { print STDERR "WARNING: Can't open file $currentfile"; } + } + + foreach my $line ( keys( %{$fallbackhashhash_ref->{ $cur_lang } } )) { + if( #$cur_lang ne "de" && + $cur_lang ne "en-US" ){ + print ALLPARTICLES_MERGED ( $fallbackhashhash_ref->{ $cur_lang }{ $line }, "\n" ); + } + } + } + } else { + foreach my $currentfile ( @sdfparticles ){ + if ( open MYFILE , "< $currentfile" ) { + while( ){ + print ALLPARTICLES_MERGED ( $_, "\n" ); # recheck de / en-US ! + } + } + else { print STDERR "WARNING: Can't open file $currentfile"; } + } + } + close ALLPARTICLES_MERGED; + + + # Hash of array + my %output; + my @order; + + ## Join both + if( $outputfile ){ + if( open DESTFILE , "+> $outputfile" ){ + if( !open LOCALIZEPARTICLE , "< $localizeSDF" ) { print STDERR "ERROR: Can't open file $localizeSDF\n"; } + if( !open ALLPARTICLES_MERGED , "< $particleSDF_merged" ) { print STDERR "ERROR: Can't open file $particleSDF_merged\n"; } + + # Insert localize + my $extract_date=""; + while ( ){ + if( /$sdf_regex/ ){ + my $leftpart = defined $2 ? $2 : ''; + my $lang = defined $12 ? $12 : ''; + my $rightpart = defined $13 ? $13 : ''; + my $timestamp = defined $18 ? $18 : ''; + + my $prj = defined $3 ? $3 : ''; + my $file = defined $4 ? $4 : ''; + my $type = defined $6 ? $6 : ''; + my $gid = defined $7 ? $7 : ''; + my $lid = defined $8 ? $8 : ''; + #my $lang = defined $12 ? $12 : ''; + my $plattform = defined $10 ? $10 : ''; + my $helpid = defined $9 ? $9 : ''; + + + if( $use_default_date ) + { + $extract_date = "$default_date\n" ; + } + elsif( $extract_date eq "" ) { + $extract_date = $timestamp ; + $extract_date =~ tr/\r\n//d; + $extract_date .= "\n"; + } + + if( $bAll ){ print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date ; } + else { + foreach my $sLang ( keys( %{ $langhash_ref } ) ){ + if( $sLang=~ /all/i ) { + push @{ $output{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } } , $leftpart."\t".$lang."\t".$rightpart.$extract_date ; + #print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date; + } + #if( $sLang eq "de" && $lang eq "de" ) { + # push @{ $output{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } } , $leftpart."\t".$lang."\t".$rightpart.$extract_date ; + #print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date; + #} + if( $sLang eq "en-US" && $lang eq "en-US" ) { + push @order , $prj.$gid.$lid.$file.$type.$plattform.$helpid; + if( !$bFakeEnglish ){ push @{ $output{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } } , $leftpart."\t".$lang."\t".$rightpart.$extract_date ; } + #print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date; + } + + } + } + } + } + # Insert particles + while ( ){ + if( /$sdf_regex/ ){ + my $leftpart = defined $2 ? $2 : ''; + my $prj = defined $3 ? $3 : ''; + my $lang = defined $12 ? $12 : ''; + my $rightpart = defined $13 ? $13 : ''; + my $timestamp = defined $18 ? $18 : ''; + + #my $prj = defined $3 ? $3 : ''; + my $file = defined $4 ? $4 : ''; + my $type = defined $6 ? $6 : ''; + my $gid = defined $7 ? $7 : ''; + my $lid = defined $8 ? $8 : ''; + #my $lang = defined $12 ? $12 : ''; + my $plattform = defined $10 ? $10 : ''; + my $helpid = defined $9 ? $9 : ''; + + + if( $use_default_date ) + { + $extract_date = "$default_date\n" ; + } + elsif( $extract_date eq "" ) + { + $extract_date = $timestamp; + } + + if( ! ( $prj =~ /binfilter/i ) ) { + push @{ $output{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } } , $leftpart."\t".$lang."\t".$rightpart.$extract_date ; + #print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date ; + } + } + } + + # Write! + foreach my $curkey ( @order ){ + foreach my $curlist ( $output{ $curkey } ){ + foreach my $line ( @{$curlist} ){ + print DESTFILE $line; + } + } + } + + }else { print STDERR "Can't open $outputfile";} + } + close DESTFILE; + close LOCALIZEPARTICLE; + close ALLPARTICLES_MERGED; + + #print STDOUT "DBG: \$localizeSDF $localizeSDF \$particleSDF_merged $particleSDF_merged\n"; + unlink $localizeSDF , $particleSDF_merged , $my_localize_log; + + #sort_outfile( $outputfile ); + #remove_obsolete( $outputfile ) , if $bHasSourceLanguage ne ""; + } + +######################################################### +sub remove_obsolete{ + my $outfile = shift; + my @lines; + my $enusleftpart; + my @good_lines; + + print STDOUT "### Removing obsolete strings\n"; + + # Kick out all strings without en-US reference + if ( open ( SORTEDFILE , "< $outfile" ) ){ + while( ){ + if( /$sdf_regex/ ){ + my $line = defined $_ ? $_ : ''; + my $language = defined $12 ? $12 : ''; + my $prj = defined $3 ? $3 : ''; + my $file = defined $4 ? $4 : ''; + my $type = defined $6 ? $6 : ''; + my $gid = defined $7 ? $7 : ''; + my $lid = defined $8 ? $8 : ''; + my $plattform = defined $10 ? $10 : ''; + my $helpid = defined $9 ? $9 : ''; + + my $leftpart = $prj.$gid.$lid.$file.$type.$plattform.$helpid; + + if( $language eq "en-US" ){ # source string found, 1. entry + $enusleftpart = $leftpart; + push @good_lines , $line; + }else{ + if( !defined $enusleftpart or !defined $leftpart ){ + print STDERR "BADLINE: $line\n"; + print STDERR "\$enusleftpart = $enusleftpart\n"; + print STDERR "\$leftpart = $leftpart\n"; + } + if( $enusleftpart eq $leftpart ){ # matching language + push @good_lines , $line; + } + #else{ + # print STDERR "OUT: \$enusleftpart=$enusleftpart \$leftpart=$leftpart \$line=$line\n"; + #} + } + } + } + close SORTEDFILE; + } else { print STDERR "ERROR: Can't open file $outfile\n";} + + # Write file + if ( open ( SORTEDFILE , "> $outfile" ) ){ + foreach my $newline ( @good_lines ) { + print SORTEDFILE $newline; + } + close SORTEDFILE; + } else { print STDERR "ERROR: Can't open file $outfile\n";} + +} +######################################################### +sub sort_outfile{ + my $outfile = shift; + print STDOUT "### Sorting ... $outfile ..."; + my @lines; + my @sorted_lines; + + + #if ( open ( SORTEDFILE , "< $outputfile" ) ){ + if ( open ( SORTEDFILE , "< $outfile" ) ){ + my $line; + while ( ){ + $line = $_; + if( $line =~ /^[^\#]/ ){ + push @lines , $line; + } + } + close SORTEDFILE; + @sorted_lines = sort { + my $xa_lang = ""; + my $xa_left_part = ""; + my $xa_right_part = ""; + my $xa_timestamp = ""; + my $xb_lang = ""; + my $xb_left_part = ""; + my $xb_right_part = ""; + my $xb_timestamp = ""; + my $xa = ""; + my $xb = ""; + my @alist; + my @blist; + + if( $a=~ /$sdf_regex/ ){ + $xa_left_part = defined $2 ? $2 : ''; + $xa_lang = defined $12 ? $12 : ''; + $xa_right_part = defined $13 ? $13 : ''; + $xa_left_part = remove_last_column( $xa_left_part ); + + } + if( $b=~ /$sdf_regex/ ){ + $xb_left_part = defined $2 ? $2 : ''; + $xb_lang = defined $12 ? $12 : ''; + $xb_right_part = defined $13 ? $13 : ''; + $xb_left_part = remove_last_column( $xb_left_part ); + + + } + if( ( $xa_left_part cmp $xb_left_part ) == 0 ){ # Left part equal + if( ( $xa_lang cmp $xb_lang ) == 0 ){ # Lang equal + return ( $xa_right_part cmp $xb_right_part ); # Right part compare + } + elsif( $xa_lang eq "en-US" ) { return -1; } # en-US wins + elsif( $xb_lang eq "en-US" ) { return 1; } # en-US wins + else { return $xa_lang cmp $xb_lang; } # lang compare + } + else { + return $xa_left_part cmp $xb_left_part; # Left part compare + } + } @lines; + + if ( open ( SORTEDFILE , "> $outfile" ) ){ + print SORTEDFILE get_license_header(); + foreach my $newline ( @sorted_lines ) { + print SORTEDFILE $newline; + #print STDOUT $newline; + } + } + close SORTEDFILE; + } else { print STDERR "WARNING: Can't open file $outfile\n";} + print "done\n"; + +} +######################################################### +sub remove_last_column{ + my $string = shift; + my @alist = split ( "\t" , $string ); + pop @alist; + return join( "\t" , @alist ); +} + +######################################################### +sub rename_language{ + my $fallbackhashhash_ref = shift; + my $cur_fallback = shift; + my $cur_lang = shift; + my $line; + + foreach my $key( keys ( %{ $fallbackhashhash_ref->{ $cur_fallback } } ) ){ + $line = $fallbackhashhash_ref->{ $cur_fallback }{ $key }; + if( $line =~ /$sdf_regex/ ){ + my $leftpart = defined $2 ? $2 : ''; + my $lang = defined $12 ? $12 : ''; + my $rightpart = defined $13 ? $13 : ''; + + $fallbackhashhash_ref->{ $cur_lang }{ $key } = $leftpart."\t".$cur_lang."\t".$rightpart; + } + } +} + +############################################################ +sub remove_duplicates{ + my $list_ref = shift; + my %tmphash; + foreach my $key ( @{ $list_ref } ){ $tmphash{ $key } = '' ; } + @{$list_ref} = keys( %tmphash ); +} + +############################################################## +sub fetch_fallback{ + my $sdfparticleslist_ref = shift; + my $localizeSDF = shift; + my $langhash_ref = shift; + my %fallbackhashhash; + my $cur_lang; + my @langlist; + + foreach my $key ( keys ( %{ $langhash_ref } ) ){ + $cur_lang = $langhash_ref->{ $key }; + if ( $cur_lang ne "" ) { + push @langlist , $cur_lang; + } + } + remove_duplicates( \@langlist ); + foreach $cur_lang ( @langlist ){ + if( $cur_lang eq "en-US" ){ + read_fallbacks_from_source( $localizeSDF , $cur_lang , \%fallbackhashhash ); + } + } + + # remove de / en-US + my @tmplist; + foreach $cur_lang( @langlist ){ + if( $cur_lang ne "en-US" ){ + push @tmplist , $cur_lang; + + } + } + @langlist = @tmplist; + if ( $#langlist +1 ){ + read_fallbacks_from_particles( $sdfparticleslist_ref , \@langlist , \%fallbackhashhash ); + + } + return (\%fallbackhashhash); +} + +######################################################### +sub write_file{ + + my $localizeFile = shift; + my $index_ref = shift; + + if( open DESTFILE , "+> $localizeFile" ){ + foreach my $key( %{ $index_ref } ){ + print DESTFILE ($index_ref->{ $key }, "\n" ); + } + close DESTFILE; + }else { + print STDERR "Can't open/create '$localizeFile'"; + } +} + +######################################################### +sub read_file{ + + my $sdffile = shift; + my $langhash_ref = shift; + my %block = (); + + open MYFILE , "< $sdffile" + or die "Can't open '$sdffile'\n"; + while( ){ + if( /$sdf_regex/ ){ + my $line = defined $_ ? $_ : ''; + my $prj = defined $3 ? $3 : ''; + my $file = defined $4 ? $4 : ''; + my $type = defined $6 ? $6 : ''; + my $gid = defined $7 ? $7 : ''; + my $lid = defined $8 ? $8 : ''; + my $plattform = defined $10 ? $10 : ''; + my $lang = defined $12 ? $12 : ''; + my $helpid = defined $9 ? $9 : ''; + + foreach my $isolang ( keys ( %{ $langhash_ref } ) ){ + if( $isolang=~ /$lang/i || $isolang=~ /all/i ) { $block{$prj.$gid.$lid.$file.$type.$plattform.$helpid } = $line ; } + } + } + } + return (\%block); +} + +######################################################### +sub read_fallbacks_from_particles{ + + my $sdfparticleslist_ref = shift; + my $isolanglist_ref = shift; + my $fallbackhashhash_ref = shift; + my $block_ref; + foreach my $currentfile ( @{ $sdfparticleslist_ref } ){ + if ( open MYFILE , "< $currentfile" ) { + while(){ + if( /$sdf_regex/ ){ + my $line = defined $_ ? $_ : ''; + my $prj = defined $3 ? $3 : ''; + my $file = defined $4 ? $4 : ''; + my $type = defined $6 ? $6 : ''; + my $gid = defined $7 ? $7 : ''; + my $lid = defined $8 ? $8 : ''; + my $lang = defined $12 ? $12 : ''; + my $plattform = defined $10 ? $10 : ''; + my $helpid = defined $9 ? $9 : ''; + + chomp( $line ); + + foreach my $isolang ( @{$isolanglist_ref} ){ + if( $isolang=~ /$lang/i ) { + $fallbackhashhash_ref->{ $isolang }{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } = $line ; + } + } + } + } + }else { print STDERR "WARNING: Can't open file $currentfile"; } + } +} + +######################################################### +sub read_fallbacks_from_source{ + + my $sdffile = shift; + my $isolang = shift; + my $fallbackhashhash_ref = shift; + my $block_ref; + # read fallback for single file + open MYFILE , "< $sdffile" + or die "Can't open '$sdffile'\n"; + + while( ){ + if( /$sdf_regex/ ){ + my $line = defined $_ ? $_ : ''; + my $prj = defined $3 ? $3 : ''; + my $file = defined $4 ? $4 : ''; + my $type = defined $6 ? $6 : ''; + my $gid = defined $7 ? $7 : ''; + my $lid = defined $8 ? $8 : ''; + my $helpid = defined $9 ? $9 : ''; + my $lang = defined $12 ? $12 : ''; + my $plattform = defined $10 ? $10 : ''; + + chomp( $line ); + if( $isolang=~ /$lang/i ) { $fallbackhashhash_ref->{ $isolang }{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } = $line ; + } + } + } +} + +######################################################### +sub parseLanguages{ + + my $bAll; + my $bUseLocalize; + my $bHasSourceLanguage=""; + my $bFakeEnglish=""; + my %langhash; + my $iso=""; + my $fallback=""; + + #### -l all + if( $languages=~ /all/ ){ + $bAll = "TRUE"; + $bHasSourceLanguage = "TRUE"; + } + ### -l fr=de,de + elsif( $languages=~ /.*,.*/ ){ + my @tmpstr = split "," , $languages; + for my $lang ( @tmpstr ){ + if( $lang=~ /([a-zA-Z]{2,3}(-[a-zA-Z\-]*)*)(=([a-zA-Z]{2,3}(-[a-zA-Z\-]*)*))?/ ){ + $iso = $1; + $fallback = $4; + + if( ( $iso && $iso=~ /(en-US)/i ) || ( $fallback && $fallback=~ /(en-US)/i ) ) { + $bUseLocalize = "TRUE"; + } + if( ( $iso && $iso=~ /(en-US)/i ) ) { + $bHasSourceLanguage = "TRUE"; + } + if( $fallback ) { $langhash{ $iso } = $fallback; } + else { $langhash{ $iso } = ""; } + } + } + } + ### -l de + else{ + if( $languages=~ /([a-zA-Z]{2,3}(-[a-zA-Z\-]*)*)(=([a-zA-Z]{2,3}(-[a-zA-Z\-]*)*))?/ ){ + $iso = $1; + $fallback = $4; + + if( ( $iso && $iso=~ /(en-US)/i ) || ( $fallback && $fallback=~ /(en-US)/i ) ) { + $bUseLocalize = "TRUE"; + + } + if( ( $iso && $iso=~ /(en-US)/i ) ) { + $bHasSourceLanguage = "TRUE"; + } + + if( $fallback ) { $langhash{ $iso } = $fallback; } + else { $langhash{ $iso } = ""; } + } + } + # HACK en-US always needed! + if( !$bHasSourceLanguage ){ + #$bHasSourceLanguage = "TRUE"; + $bUseLocalize = "TRUE"; + $bFakeEnglish = "TRUE"; + $langhash{ "en-US" } = ""; + } + return ( $bAll , $bUseLocalize , \%langhash , $bHasSourceLanguage, $bFakeEnglish); +} + +######################################################### +sub parse_options{ + + my $help; + my $merge; + my $extract; + my $success = GetOptions('f=s' => \$sdffile , 'l=s' => \$languages , 's=s' => \$srcpath , 'h' => \$help , 'v' => \$bVerbose , + 'm' => \$merge , 'e' => \$extract , 'x' => \$no_sort , 'd' => \$use_default_date ); + $outputfile = $sdffile; + + #print STDOUT "DBG: lang = $languages\n"; + if( !$srcpath ){ + #$srcpath = "$ENV{SRC_ROOT}"; + if( !$srcpath ){ + print STDERR "No path to the source root found!\n\n"; + usage(); + exit(1); + } + } + if( $help || !$success || $#ARGV > 1 || ( !$sdffile ) ){ + usage(); + exit(1); + } + if( $merge && $sdffile && ! ( -r $sdffile)){ + print STDERR "Can't open file '$sdffile'\n"; + exit(1); + } + if( !( $languages=~ /[a-zA-Z]{2,3}(-[a-zA-Z\-]*)*(=[a-zA-Z]{2,3}(-[a-zA-Z\-]*)*)?(,[a-zA-Z]{2,3}(-[a-zA-Z\-]*)*(=[a-zA-Z]{2,3}(-[a-zA-Z\-]*)*)?)*/ ) ){ + print STDERR "Please check the -l iso code\n"; + exit(1); + } + if( ( !$merge && !$extract ) || ( $merge && $extract ) ){ usage();exit( -1 );} + if( $extract ){ $mode = "extract"; } + else { $mode = "merge"; } +} + +######################################################### +sub usage{ + + print STDERR "Usage: localize.pl\n"; + print STDERR "Split or collect SDF files\n"; + print STDERR " merge: -m -f -l l1[=f1][,l2[=f2]][...] [ -s ]\n"; + print STDERR " extract: -e -f -l [ -s ] [-d]\n"; + print STDERR "Options:\n"; + print STDERR " -h help\n"; + print STDERR " -m Merge mode\n"; + print STDERR " -e Extract mode\n"; + print STDERR " -f To split a big SDF file into particles\n"; + print STDERR " To collect and join all particles to one big file\n"; + print STDERR " -s Path to the modules, if no \$SRC_ROOT is set\n"; + print STDERR " -l ( all | | =fallback ) comma seperated languages\n"; + print STDERR " -d Use default date in extracted sdf file\n"; + print STDERR " -v Verbose\n"; + print STDERR "\nExample:\n"; + print STDERR "\nlocalize -e -l en-US,pt-BR=en-US -f my.sdf\n( Extract en-US and pt-BR with en-US fallback )\n"; + print STDERR "\nlocalize -m -l cs -f my.sdf\n( Merge cs translation into the sourcecode ) \n"; +} + +# my $line = defined $_ ? $_ : ''; +# my $leftpart = defined $2 ? $2 : ''; +# my $prj = defined $3 ? $3 : ''; +# my $file = defined $4 ? $4 : ''; +# my $dummy = defined $5 ? $5 : ''; +# my $type = defined $6 ? $6 : ''; +# my $gid = defined $7 ? $7 : ''; +# my $lid = defined $8 ? $8 : ''; +# my $helpid = defined $9 ? $9 : ''; +# my $plattform = defined $10 ? $10 : ''; +# my $width = defined $11 ? $11 : ''; +# my $lang = defined $12 ? $12 : ''; +# my $rightpart = defined $13 ? $13 : ''; +# my $text = defined $14 ? $14 : ''; +# my $helptext = defined $15 ? $15 : ''; +# my $quickhelptext = defined $16 ? $16 : ''; +# my $title = defined $17 ? $17 : ''; +# my $timestamp = defined $18 ? $18 : ''; + -- cgit From 3ef399fb3302214147ed2dd97e5f8717666a5acd Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Wed, 25 Nov 2009 12:34:59 +0000 Subject: revert earlier ineffective change --- vcl/aqua/source/app/salinst.cxx | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx index cd291fdfbbf2..e4037df0c4aa 100644 --- a/vcl/aqua/source/app/salinst.cxx +++ b/vcl/aqua/source/app/salinst.cxx @@ -675,21 +675,8 @@ class ReleasePoolHolder { NSAutoreleasePool* mpPool; public: - ReleasePoolHolder() : mpPool( nil ) - { - // NSAutoreleasePool documentation suggests we should have - // an own pool for each yield level - // #i107080# however shows us that doing that can easily crash - // while VoiceOver is active. So for now let's create an - // autorelease pool only for the top of the yield stack - if( ImplGetSVData()->maAppData.mnDispatchLevel == 1 ) - mpPool = [[NSAutoreleasePool alloc] init]; - } - ~ReleasePoolHolder() - { - if( mpPool ) - [mpPool release]; - } + ReleasePoolHolder() : mpPool( [[NSAutoreleasePool alloc] init] ) {} + ~ReleasePoolHolder() { [mpPool release]; } }; void AquaSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) @@ -698,6 +685,8 @@ void AquaSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) // will therefore not be destroyed by cocoa implicitly SalData::ensureThreadAutoreleasePool(); + // NSAutoreleasePool documentation suggests we should have + // an own pool for each yield level ReleasePoolHolder aReleasePool; // Release all locks so that we don't deadlock when we pull pending -- cgit From d14ff396c43feebd0cbceb7cdc327ad56024195a Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Thu, 26 Nov 2009 10:50:48 +0000 Subject: #i107204# fix some native shortcuts on Snow Leopard --- vcl/aqua/inc/salframeview.h | 6 ++++++ vcl/aqua/source/window/salframeview.mm | 35 ++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/vcl/aqua/inc/salframeview.h b/vcl/aqua/inc/salframeview.h index 7fd4d96c4a45..e823837e7af6 100755 --- a/vcl/aqua/inc/salframeview.h +++ b/vcl/aqua/inc/salframeview.h @@ -132,7 +132,11 @@ -(void)moveWordForwardAndModifySelection: (id)aSender; -(void)moveWordRightAndModifySelection: (id)aSender; -(void)moveToEndOfLine: (id)aSender; +-(void)moveToRightEndOfLine: (id)aSender; +-(void)moveToLeftEndOfLine: (id)aSender; -(void)moveToEndOfLineAndModifySelection: (id)aSender; +-(void)moveToRightEndOfLineAndModifySelection: (id)aSender; +-(void)moveToLeftEndOfLineAndModifySelection: (id)aSender; -(void)moveToBeginningOfLine: (id)aSender; -(void)moveToBeginningOfLineAndModifySelection: (id)aSender; -(void)moveToEndOfParagraph: (id)aSender; @@ -144,8 +148,10 @@ -(void)moveParagraphBackward: (id)aSender; -(void)moveParagraphBackwardAndModifySelection: (id)aSender; -(void)moveToEndOfDocument: (id)aSender; +-(void)scrollToEndOfDocument: (id)aSender; -(void)moveToEndOfDocumentAndModifySelection: (id)aSender; -(void)moveToBeginningOfDocument: (id)aSender; +-(void)scrollToBeginningOfDocument: (id)aSender; -(void)moveToBeginningOfDocumentAndModifySelection: (id)aSender; -(void)insertNewline: (id)aSender; -(void)deleteBackward: (id)aSender; diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm index aabc287dc885..51f1b1a3b63c 100755 --- a/vcl/aqua/source/window/salframeview.mm +++ b/vcl/aqua/source/window/salframeview.mm @@ -1065,21 +1065,41 @@ private: [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_END_OF_LINE character: 0 modifiers: 0]; } +-(void)moveToRightEndOfLine: (id)aSender +{ + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_END_OF_LINE character: 0 modifiers: 0]; +} + -(void)moveToEndOfLineAndModifySelection: (id)aSender { [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::SELECT_TO_END_OF_LINE character: 0 modifiers: 0]; } +-(void)moveToRightEndOfLineAndModifySelection: (id)aSender +{ + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::SELECT_TO_END_OF_LINE character: 0 modifiers: 0]; +} + -(void)moveToBeginningOfLine: (id)aSender { [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_LINE character: 0 modifiers: 0]; } +-(void)moveToLeftEndOfLine: (id)aSender +{ + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_LINE character: 0 modifiers: 0]; +} + -(void)moveToBeginningOfLineAndModifySelection: (id)aSender { [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_LINE character: 0 modifiers: 0]; } +-(void)moveToLeftEndOfLineAndModifySelection: (id)aSender +{ + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_LINE character: 0 modifiers: 0]; +} + -(void)moveToEndOfParagraph: (id)aSender { [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_END_OF_PARAGRAPH character: 0 modifiers: 0]; @@ -1125,6 +1145,12 @@ private: [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_END_OF_DOCUMENT character: 0 modifiers: 0]; } +-(void)scrollToEndOfDocument: (id)aSender +{ + // this is not exactly what we should do, but it makes "End" and "Shift-End" behave consistent + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_END_OF_DOCUMENT character: 0 modifiers: 0]; +} + -(void)moveToEndOfDocumentAndModifySelection: (id)aSender { [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::SELECT_TO_END_OF_DOCUMENT character: 0 modifiers: 0]; @@ -1135,6 +1161,12 @@ private: [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT character: 0 modifiers: 0]; } +-(void)scrollToBeginningOfDocument: (id)aSender +{ + // this is not exactly what we should do, but it makes "Home" and "Shift-Home" behave consistent + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT character: 0 modifiers: 0]; +} + -(void)moveToBeginningOfDocumentAndModifySelection: (id)aSender { [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT character: 0 modifiers: 0]; @@ -1462,6 +1494,9 @@ private: { if( AquaSalFrame::isAlive( mpFrame ) ) { + #if OSL_DEBUG_LEVEL > 1 + // fprintf( stderr, "SalFrameView: doCommandBySelector %s\n", (char*)aSelector ); + #endif if( (mpFrame->mnICOptions & SAL_INPUTCONTEXT_TEXT) != 0 && aSelector != NULL && [self respondsToSelector: aSelector] ) { -- cgit From f80a20d5960bdca8edeacc76bd91e6338d2fd5d2 Mon Sep 17 00:00:00 2001 From: Mikhail Voitenko Date: Thu, 26 Nov 2009 14:13:55 +0000 Subject: #i105172# PL: implement cancelShutdown --- vcl/unx/inc/sm.hxx | 2 +- vcl/unx/source/app/sm.cxx | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/vcl/unx/inc/sm.hxx b/vcl/unx/inc/sm.hxx index 17bb40e2106a..09d2f5557e1d 100644 --- a/vcl/unx/inc/sm.hxx +++ b/vcl/unx/inc/sm.hxx @@ -69,7 +69,7 @@ public: static bool checkDocumentsSaved(); static bool queryInteraction(); static void saveDone(); - static void interactionDone(); + static void interactionDone( bool bCancelShutdown ); static String getExecName(); static VCL_DLLPUBLIC const ByteString& getSessionID(); diff --git a/vcl/unx/source/app/sm.cxx b/vcl/unx/source/app/sm.cxx index ff981b04259b..75722ec89de3 100644 --- a/vcl/unx/source/app/sm.cxx +++ b/vcl/unx/source/app/sm.cxx @@ -114,7 +114,7 @@ void IceSalSession::queryInteraction() void IceSalSession::interactionDone() { - SessionManagerClient::interactionDone(); + SessionManagerClient::interactionDone( false ); } void IceSalSession::saveDone() @@ -129,6 +129,7 @@ void IceSalSession::saveDone() bool IceSalSession::cancelShutdown() { + SessionManagerClient::interactionDone( true ); return false; } @@ -526,12 +527,12 @@ bool SessionManagerClient::queryInteraction() return bRet; } -void SessionManagerClient::interactionDone() +void SessionManagerClient::interactionDone( bool bCancelShutdown ) { if( aSmcConnection ) { ICEConnectionObserver::lock(); - SmcInteractDone( aSmcConnection, False ); + SmcInteractDone( aSmcConnection, bCancelShutdown ? True : False ); ICEConnectionObserver::unlock(); } } -- cgit From 98686c447f73b1fb65393dde646e87355006ac43 Mon Sep 17 00:00:00 2001 From: Jens-Heiner Rechtien Date: Fri, 27 Nov 2009 12:39:32 +0000 Subject: dba33a: summary migration from SVN 2009-11-06 13:10:39 +0000 msc r277387 : minor fix for automatic test 2009-11-06 13:09:33 +0000 msc r277385 : minor fix for automatic test 2009-11-06 12:30:57 +0000 fs r277383 : argh. On some virtual machines, waiting 5 seconds for the event to arrive is not enough. Increasing the timeout ... 2009-11-06 12:13:34 +0000 fs r277382 : this diagnostic code should not have slipped in 2009-11-05 13:21:06 +0000 fs r277369 : SHL2NOCHECK=TRUE (requested by hjs) 2009-11-04 14:09:46 +0000 msc r277355 : minor fix for automatic testing 2009-11-04 13:23:02 +0000 msc r277352 : minor fix for automatic testing 2009-11-04 10:53:28 +0000 msc r277341 : minor fix for automated testscript 2009-11-04 08:30:58 +0000 msc r277333 : minor fix for automatic test 2009-11-04 08:15:43 +0000 msc r277332 : minor fix for automatic test 2009-11-03 14:25:44 +0000 fs r277324 : #i10000# 2009-11-03 09:47:47 +0000 fs r277315 : found yet another help ID zombie ... moved formhelpid.hrc content to propctrlr.hrc, where it belongs 2009-11-03 08:50:24 +0000 fs r277312 : use createTempFileURL, which cares for some more specialities ... 2009-11-03 08:44:55 +0000 fs r277311 : when creating a temp file for purpose of getting a temp file URL, the delete the file immediately. On some machines/JVMs, the file exists, with write access denied, which isn't Good (TM) 2009-10-22 13:06:17 +0000 fs r277126 : removed wrong assertion 2009-10-21 08:10:35 +0000 fs r277077 : reverted the previous change, which was nonsense 2009-10-21 07:19:43 +0000 fs r277076 : export the component_foo functions, now that some of the objects are built with VISIBILITY_HIDDEN=TRUE 2009-10-21 07:08:35 +0000 fs r277075 : spare useless call 2009-10-20 21:26:31 +0000 fs r277072 : #i10000# 2009-10-20 08:06:04 +0000 fs r277039 : CWS-TOOLING: rebase CWS dba33a to trunk@277035 (milestone: DEV300:m62) 2009-10-16 09:55:25 +0000 fs r276960 : remove one of the superfluous implts_doLayout calls introduced with the previous patch 2009-10-15 13:18:52 +0000 fs r276941 : removed the basic tests. According to cn, they're not used anymore (for a long time), and according to 'du -h', they take up 6.0M on my hard disc. For too much for useless code, /me thinks. 2009-10-15 13:06:51 +0000 fs r276940 : #i10000# remove useless include (otherwise the compiler warning it provokes would need to be fixed by declaring VISIBILITY_HIDDEN=TRUE in the makefile.mk) 2009-10-15 12:52:39 +0000 fs r276939 : #i10000# 2009-10-15 12:44:26 +0000 fs r276938 : #i10000# 2009-10-15 12:00:33 +0000 fs r276936 : #i10000# 2009-10-15 10:31:37 +0000 fs r276934 : #i105259# prepare for the Hidden arg 2009-10-15 10:31:05 +0000 fs r276933 : IsMaximized -> const 2009-10-15 09:50:15 +0000 fs r276932 : during #i105259#: introduce an option to the layout manager to preserve, if possible, the size of the content window when layouting. Enable this option for embedded (SFX-based) documents opened for outplace editing. (the option is incompatible with in-place editing, anyway) This is because such embedded objects couple the (content) window size to the VisAreaSize, in that both are used interchangeably. When an embedded object is closed, it remembers the VisAreaSize, and restores it upon next open. This, however, leads to different content window sizes when the window is closed with another toolbar set than used during opening. This patch here prevents those different content window sizes. Also, now the content window size doesn't change when, explicitly or implicitly, a toolbar is shown or hidden. Instead, the content window size stays the same, and the container window size is adjusted. 2009-10-15 09:32:41 +0000 fs r276931 : during #i105259#: UNO access to more attributes of top windows 2009-10-15 09:30:28 +0000 fs r276930 : indention corrected (better readable) 2009-10-15 09:26:46 +0000 fs r276929 : during #i105259#: access to more attributes of top windows 2009-10-14 10:04:39 +0000 fs r276889 : connecting via services manager, not naming service 2009-10-12 11:31:08 +0000 fs r276831 : during #i105806# FillPropertySet: do not attempt to set *AutoStyleName if it doesn't exist 2009-10-12 11:24:44 +0000 fs r276830 : #i105806# getPropertyValue: throw an UnknownPropertyException for, well, unknown properties 2009-10-08 08:20:58 +0000 fs r276774 : implSubmit: re-throw WrappedTargetExceptions unmodified 2009-10-07 19:19:42 +0000 fs r276770 : #i105198# do not pass an CommandType if we do not have a command 2009-10-07 17:39:36 +0000 fs r276768 : export the OWeakObject::disposeWeakConnectionPoint symbol 2009-10-07 12:59:17 +0000 fs r276754 : #i87693# 2009-10-07 11:19:22 +0000 fs r276752 : #i10000# 2009-10-07 10:21:08 +0000 fs r276748 : #105482# do not require a controller, at least not in *all* circumstances (executed reports have a model, the ReportDefinition, but no Controller) 2009-10-07 10:04:08 +0000 fs r276747 : copying the changes from CWS fwk121 herein, in particular the fix for issue #i105371# 2009-10-07 09:58:30 +0000 fs r276746 : copying the changes from CWS fwk121 herein, in particular the fix for issue #i105371# 2009-10-07 09:48:14 +0000 fs r276744 : removed (now) pointless assertion 2009-10-07 06:59:19 +0000 fs r276740 : export the OWeakObject::disposeWeakConnectionPoint symbol 2009-10-07 06:44:43 +0000 fs r276739 : OComponentHelper::release & WeakAggComponentImplHelperBase::release: when our ref count drops to 0, call OWeakObject's disposeWeakConnectionPoint before (temporarily) incrementing the ref count, again. This ensures that our adapter cannot create references to the dying object anymore. (A complex test case in dbaccess (#i105505#) triggered such a situation, but in another class using an analogous release/dispose/destroy pattern, namely WeakComponentImplHelperBase) 2009-10-07 06:37:20 +0000 fs r276738 : found during some new complex test cases: call disposeWeakConnectionPoint before actually starting to destroy the object, this ensures no other threads will resurrect it while it is dying 2009-10-06 21:58:24 +0000 fs r276734 : oops, two small corrections to the previous fix (hey, complex test cases are cool) 2009-10-06 21:51:16 +0000 fs r276733 : log the name of the data source which cannot be revoked 2009-10-06 21:50:41 +0000 fs r276732 : more detailed error message when cleanup fails 2009-10-06 21:50:01 +0000 fs r276731 : reworked the ModelImpl caching. The new and improved UNO API test for css.sdb.RowSet revealed some inconsistencies, in whether the objects are cached by their URL, or by their registration name. This has been changed to caching by registration name. 2009-10-06 13:50:34 +0000 fs r276714 : print diagnostics when we cannot clean up the test case 2009-10-06 13:45:02 +0000 fs r276713 : this test failed all the time, since the core (rightfully) threw an exception. Disabled it for the moment, until issue 84253 is fixed 2009-10-06 12:52:46 +0000 fs r276711 : rewrote this test. Now we do not re-use the same .odb across different test cases, as this leads to unreliable (timing-dependent) results/failures. Instead, every test sets up a new odb file. Also, did some re-factoring, improved the cleanup code, and caught a few more errors. 2009-10-06 12:51:07 +0000 fs r276710 : DBTools taking a logger now 2009-10-06 12:50:42 +0000 fs r276709 : taking a PrintWriter for logging purpose 2009-10-06 12:50:03 +0000 fs r276708 : DBTools taking a logger now 2009-10-06 12:49:22 +0000 fs r276707 : typo 2009-10-06 12:49:03 +0000 fs r276706 : typo 2009-10-06 12:48:52 +0000 fs r276705 : wrappers around some database-related services - initial versions only, to evolve over time, and intended to finally replace the DBTools class 2009-10-06 12:48:02 +0000 fs r276704 : typo 2009-10-06 12:38:42 +0000 fs r276702 : some better diagnostics, done during getting the API tests to work more reliably 2009-10-06 10:35:51 +0000 fs r276698 : when living in, e.g., the DataSourceBrowser, we can't expect to find an XModifiable2, so don't assert its existence 2009-10-05 12:47:52 +0000 oj r276677 : #i105607# check for read moved into if scope 2009-10-05 11:37:06 +0000 fs r276676 : when saving a file fails, retrieve the error message from the InteractionRequestStringResolver - this is better than any generic message we can create 2009-10-05 10:04:23 +0000 oj r276673 : #i105607# check for read moved into if scope 2009-10-05 09:46:17 +0000 fs r276671 : #i10000# 2009-10-05 08:43:58 +0000 fs r276664 : #i105505# release: dispose the (base classes) weak connection point before disposing ourself, and in particular before temporarily incrementing our ref count, again. This way, we prevent that a separate thread re-surrects us (using the weak connection point's queryAdapted) while we're in the process of destruction 2009-10-05 08:41:49 +0000 fs r276663 : #i105505# +disposeWeakConnectionPoint (outsourced into dedicated method from ::release) 2009-10-05 08:40:26 +0000 fs r276662 : no need to derived from OSubComponent, its features are not used, directly derive from WeakComponentImplFoo instead 2009-10-05 08:39:38 +0000 fs r276661 : #i105505# diagnostics 2009-10-05 08:39:16 +0000 fs r276660 : #i105505# +testDocumentRevenants 2009-10-05 08:36:01 +0000 fs r276659 : #i105560# reverted the removal of GenericController::openHelpAgent - this is needed in module reportdesign 2009-10-04 19:53:30 +0000 fs r276657 : #105560# remove unused code thanks to cmc@openoffice.org for submitting the patch 2009-10-04 19:50:28 +0000 fs r276656 : #i105550# remove unused 'fire' method (thanks to cmc) 2009-10-03 16:13:15 +0000 fs r276655 : CWS-TOOLING: rebase CWS dba33a to trunk@276429 (milestone: DEV300:m60) 2009-10-02 19:20:48 +0000 fs r276651 : #i104117# lotta changed IDs ... 2009-10-02 10:52:24 +0000 fs r276634 : #i105505# If a model is created, and is a revenant of a previous incarnation, then ensure it is properly initialized. In particular, in its ctor, set the state to "Initializing", not "Initialized", and then let the ModelImpl call attachResource. This ensures that the model is initialized completely, including firing the necessary events. 2009-10-02 10:51:08 +0000 fs r276633 : #i105505# always do an attachResource at the newly loaded model, even if it (internally) was not really loaded, but only a revenant of a previous incarnation of this document 2009-10-01 11:10:13 +0000 fs r276597 : do not rely on the name 'Standard' for the one and only form in a document 2009-10-01 10:36:29 +0000 fs r276590 : #i105509# don't rely on default form component names, use indexes 2009-10-01 09:12:20 +0000 fs r276582 : #i105505# 2009-09-30 07:55:21 +0000 fs r276542 : removed some unsed methods / spared some unnecessary pixel<->logic conversion 2009-09-30 07:53:22 +0000 fs r276541 : removed unneeded methods 2009-09-30 06:35:59 +0000 fs r276538 : #i10000# 2009-09-29 13:45:02 +0000 fs r276531 : refactored the Roadmap* classes, to be able to fix above-mentioned #i105113# 2009-09-29 10:27:10 +0000 fs r276520 : #i105367# 2009-09-29 08:46:45 +0000 fs r276510 : #i104956# cleaned up the makefiles 2009-09-28 21:00:07 +0000 fs r276505 : #i104117# sourced those IDs out from extension.hrc 2009-09-28 20:59:05 +0000 fs r276504 : no need to let one FREE... 2009-09-28 20:53:36 +0000 fs r276503 : #i104117# cleaned up the mess with help IDs in module extensions. Formerly, extensions used to use help IDs which were declared in module svx, and vice versa. Also, help ID ranges were not respected. 2009-09-28 11:25:36 +0000 fs r276489 : typo 2009-09-28 11:25:10 +0000 fs r276488 : #i105235# 2009-09-24 11:53:16 +0000 fs r276423 : #i105234# do not zoom the control when they view information is still uninitialized (happens at least in Writer when opening a form document) 2009-09-24 09:42:28 +0000 fs r276415 : #i105234# proper zoom handling for the nav bar 2009-09-24 09:42:19 +0000 fs r276414 : #i105234# setZoom: care for precision errors caused by implicit conversion float->double 2009-09-16 11:11:43 +0000 fs r276195 : #i105082# consolidated the sub storage handling, by delegating more functionality into the DocumentStorageAccess class. As a result, there won't be that many unnecessary commits anymore. Also, the two different storage caches (in ModelImpl::m_aStorages and DocumentStorageAccess::m_aExposedStorages) have been consolidated. This is not really part of the fix of issue 105082, but it helped reducing the calls to the storage/package implementation. 2009-09-15 21:42:27 +0000 fs r276190 : don't calculate space for BOLD if the text is not really bold (speeds up rendering for large tree structures) 2009-09-15 20:20:23 +0000 fs r276188 : getTypeInfo: fill m_aTypeInfoRows only if really all type infos could be retrieved 2009-09-15 20:19:29 +0000 fs r276187 : do not continue loading when the controller initialization throws an error 2009-09-14 12:25:57 +0000 fs r276119 : oops, this patch was not intended for this CWS 2009-09-14 12:13:57 +0000 fs r276114 : #cr6875455# introduce a ReferenceDevice property for various control models 2009-09-14 10:33:02 +0000 fs r276106 : removed dead file 2009-09-09 08:37:31 +0000 fs r275972 : remove OSL_TRACE in VCLXButton dtor 2009-09-08 11:19:17 +0000 oj r275926 : i76534# remove mnemonic from fixed text 2009-09-07 08:39:37 +0000 fs r275874 : create CWS dba33a from cws/dba32g@275857 (CWS: dba32g) --- svtools/inc/roadmap.hxx | 82 +--- svtools/inc/svtools/hyperlabel.hxx | 11 +- svtools/inc/svtools/solar.hrc | 15 +- svtools/source/control/hyperlabel.cxx | 43 +- svtools/source/control/roadmap.cxx | 687 ++++++++++++++++-------------- toolkit/inc/toolkit/awt/vclxtopwindow.hxx | 37 +- toolkit/inc/toolkit/awt/vclxwindows.hxx | 5 +- toolkit/source/awt/vclxdialog.cxx | 1 + toolkit/source/awt/vclxtopwindow.cxx | 166 +++++--- toolkit/source/awt/vclxwindows.cxx | 3 - toolkit/source/controls/unocontrol.cxx | 8 +- vcl/inc/vcl/wrkwin.hxx | 2 +- vcl/source/window/wrkwin.cxx | 2 +- 13 files changed, 547 insertions(+), 515 deletions(-) diff --git a/svtools/inc/roadmap.hxx b/svtools/inc/roadmap.hxx index 8a6f75eb1428..14ed6abceed6 100644 --- a/svtools/inc/roadmap.hxx +++ b/svtools/inc/roadmap.hxx @@ -54,64 +54,8 @@ namespace svt typedef sal_Int32 ItemIndex; }; - class RoadmapImpl; - - - class ORoadmapIDHyperLabel : public FixedText - { - public: - ORoadmapIDHyperLabel( Window* _pParent, const ResId& _rId ); - ORoadmapIDHyperLabel( Window* _pParent, WinBits _nWinStyle = 0 ); - ~ORoadmapIDHyperLabel( ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); - }; - - class ORoadmapHyperLabel : public RoadmapTypes - { - private: - ORoadmapIDHyperLabel* mpIDLabel; - HyperLabel* mpDescHyperLabel; - - - public: - - ORoadmapHyperLabel( Window* _pParent, const ResId& _rId ); - ORoadmapHyperLabel( Window* _pParent, WinBits _nWinStyle = 0 ); - ~ORoadmapHyperLabel( ); - - void SetID( sal_Int16 _ID ); - sal_Int16 GetID() const; - - void SetIndex( sal_Int32 _Index ); - sal_Int32 GetIndex() const; - - void SetLabel( ::rtl::OUString _rText ); - ::rtl::OUString GetLabel( ); - - void SetLabelAndSize( ItemIndex _RMIndex, ::rtl::OUString _rText, const Size& rNewSize); - - void SetPosition( ORoadmapHyperLabel* OldHyperLabel ); - Point GetLogicalPosition(); - - void ToggleBackgroundColor( const Color& _rGBColor ); - void SetInteractive( sal_Bool _bInteractive ); - - void SetClickHdl( const Link& rLink ); - const Link& GetClickHdl() const; - void SetZOrder( ORoadmapHyperLabel* pRefRoadmapHyperLabel, USHORT nFlags ); - void Enable( BOOL bEnable = TRUE); - BOOL IsEnabled() const; - void GrabFocus(); - - void SetIDLabel(ORoadmapIDHyperLabel* _pIDLabel){mpIDLabel = _pIDLabel;}; - ORoadmapIDHyperLabel* GetIDLabel() const { return mpIDLabel;}; - - HyperLabel* GetDescriptionHyperLabel() const { return mpDescHyperLabel;}; - void SetDescriptionHyperLabel(HyperLabel* _pDescriptionHyperLabel){mpDescHyperLabel = _pDescriptionHyperLabel;}; - }; - - + class RoadmapItem; //===================================================================== //= Roadmap @@ -135,7 +79,7 @@ namespace svt void EnableRoadmapItem( ItemId _nItemId, sal_Bool _bEnable, ItemIndex _nStartIndex = 0 ); sal_Bool IsRoadmapItemEnabled( ItemId _nItemId, ItemIndex _nStartIndex = 0 ) const; - void ChangeRoadmapItemLabel( ItemId _nID, ::rtl::OUString sLabel, ItemIndex _nStartIndex = 0 ); + void ChangeRoadmapItemLabel( ItemId _nID, const ::rtl::OUString& sLabel, ItemIndex _nStartIndex = 0 ); ::rtl::OUString GetRoadmapItemLabel( ItemId _nID, ItemIndex _nStartIndex = 0 ); void ChangeRoadmapItemID( ItemId _nID, ItemId _NewID, ItemIndex _nStartIndex = 0 ); @@ -149,8 +93,8 @@ namespace svt ItemId GetItemID( ItemIndex _nIndex ) const; ItemIndex GetItemIndex( ItemId _nID ) const; - void InsertRoadmapItem( ItemIndex _Index, ::rtl::OUString _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled = sal_True ); - void ReplaceRoadmapItem( ItemIndex _Index, ::rtl::OUString _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled ); + void InsertRoadmapItem( ItemIndex _Index, const ::rtl::OUString& _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled = sal_True ); + void ReplaceRoadmapItem( ItemIndex _Index, const ::rtl::OUString& _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled ); void DeleteRoadmapItem( ItemIndex _nIndex ); ItemId GetCurrentRoadmapItemID() const; @@ -172,22 +116,20 @@ namespace svt private: DECL_LINK(ImplClickHdl, HyperLabel*); - ORoadmapHyperLabel* GetByIndex( ItemIndex _nItemIndex ); - const ORoadmapHyperLabel* GetByIndex( ItemIndex _nItemIndex ) const; + RoadmapItem* GetByIndex( ItemIndex _nItemIndex ); + const RoadmapItem* GetByIndex( ItemIndex _nItemIndex ) const; - ORoadmapHyperLabel* GetByID( ItemId _nID, ItemIndex _nStartIndex = 0 ); - const ORoadmapHyperLabel* GetByID( ItemId _nID, ItemIndex _nStartIndex = 0 ) const; - ORoadmapHyperLabel* GetPreviousHyperLabel( ItemIndex _Index); + RoadmapItem* GetByID( ItemId _nID, ItemIndex _nStartIndex = 0 ); + const RoadmapItem* GetByID( ItemId _nID, ItemIndex _nStartIndex = 0 ) const; + RoadmapItem* GetPreviousHyperLabel( ItemIndex _Index); void DrawHeadline(); void DeselectOldRoadmapItems(); ItemId GetNextAvailableItemId( ItemIndex _NewIndex ); ItemId GetPreviousAvailableItemId( ItemIndex _NewIndex ); - ORoadmapHyperLabel* GetByPointer(Window* pWindow); - void InitializeHyperLabelSize(); - ORoadmapHyperLabel* InsertHyperLabel( ItemIndex _Index, ::rtl::OUString _aStr, ItemId _RMID, sal_Bool _bEnabled = sal_True ); - void UpdatefollowingHyperLabels( ItemIndex _Index, sal_Int16 _nadd = 1); - void SetRoadmapLabel(ORoadmapHyperLabel* CurHyperLabel, sal_Int32 _nPrefix, String _sDescription); + RoadmapItem* GetByPointer(Window* pWindow); + RoadmapItem* InsertHyperLabel( ItemIndex _Index, const ::rtl::OUString& _aStr, ItemId _RMID, sal_Bool _bEnabled = sal_True ); + void UpdatefollowingHyperLabels( ItemIndex _Index ); }; //......................................................................... diff --git a/svtools/inc/svtools/hyperlabel.hxx b/svtools/inc/svtools/hyperlabel.hxx index c11568816158..939b1799c0de 100644 --- a/svtools/inc/svtools/hyperlabel.hxx +++ b/svtools/inc/svtools/hyperlabel.hxx @@ -75,26 +75,25 @@ namespace svt void SetIndex( sal_Int32 _Index ); sal_Int32 GetIndex() const; - void SetLabelAndSize( ::rtl::OUString _rText, const Size& rNewSize); - void SetLabel( ::rtl::OUString _rText ); + void SetLabel( const ::rtl::OUString& _rText ); sal_Int32 GetLogicWidth(); ::rtl::OUString GetLabel( ); - void SetHyperLabelPosition(sal_uInt16 XPos, sal_uInt16 YPos); - Point GetLogicalPosition(); - void ToggleBackgroundColor( const Color& _rGBColor ); void SetInteractive( sal_Bool _bInteractive ); void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; } const Link& GetClickHdl() const { return maClickHdl; } + Size CalcMinimumSize( long nMaxWidth = 0 ) const; + private: DECL_LINK(ImplClickHdl, HyperLabel*); - sal_Bool ImplCalcMinimumSize(const Size& _rCompSize ); + private: + using FixedText::CalcMinimumSize; }; } diff --git a/svtools/inc/svtools/solar.hrc b/svtools/inc/svtools/solar.hrc index 348422ef6477..00211573f876 100644 --- a/svtools/inc/svtools/solar.hrc +++ b/svtools/inc/svtools/solar.hrc @@ -132,6 +132,8 @@ #define RID_FILTER_START (RID_LIB_START+10200) #define RID_FILTER_END (RID_LIB_START+10299) +// do *NOT* add more ranges here, RID_LIB_END is (RID_LIB_START + 10000) + #define RID_APP_START 20000 #define RID_APP_END 31999 @@ -144,12 +146,6 @@ #define RID_SD_START (27000) #define RID_SD_END (27999) -#define RID_Sa_START (28000) -#define RID_Sa_END (28999) - -#define RID_Sb_START (29000) -#define RID_Sb_END (29999) - #define RID_OBJ_START (30000) #define RID_OBJ_END (32767) @@ -191,8 +187,7 @@ #define HID_WIZARD_END (HID_LIB_START+999) //please note: There is also HID_WIZARD2 below -#define HID_EXTENSIONS_START (HID_LIB_START+1000) -#define HID_EXTENSIONS_END (HID_LIB_START+1099) +// FREE #define HID_SO2_START (HID_LIB_START+1100) #define HID_SO2_END (HID_LIB_START+1149) @@ -308,5 +303,9 @@ #define HID_FORMULA_START (HID_OBJ_START+2081) #define HID_FORMULA_END (HID_OBJ_START+2280) +#define HID_EXTENSIONS_START (HID_OBJ_START+2281) +#define HID_EXTENSIONS_END (HID_OBJ_START+2800) + + #endif diff --git a/svtools/source/control/hyperlabel.cxx b/svtools/source/control/hyperlabel.cxx index ec8387ecb662..7d7477130e0d 100644 --- a/svtools/source/control/hyperlabel.cxx +++ b/svtools/source/control/hyperlabel.cxx @@ -107,35 +107,16 @@ namespace svt } - void HyperLabel::SetLabelAndSize(::rtl::OUString _rText, const Size& _rNewSize ) + Size HyperLabel::CalcMinimumSize( long nMaxWidth ) const { - Size rLocSize = _rNewSize; - Size rLogicLocSize = PixelToLogic( _rNewSize, MAP_APPFONT ); - SetLabel( _rText ); - ImplCalcMinimumSize( rLocSize ); - rLocSize.Height() = ( m_pImpl->m_aMinSize.Height()); -// else -// rLocSize = LogicToPixel( Size( rLogicLocSize.Width(), LABELBASEMAPHEIGHT ), MAP_APPFONT ); - SetSizePixel( rLocSize ); - Show(); - } - - sal_Bool HyperLabel::ImplCalcMinimumSize(const Size& _rCompSize ) - { - sal_Bool b_AdjustMinWidth = sal_False; - m_pImpl->m_aMinSize = CalcMinimumSize( ); - if ( m_pImpl->m_aMinSize.Width() >= _rCompSize.Width() ) // the MinimumSize is used to size the FocusRectangle - { - m_pImpl->m_aMinSize.Width() = _rCompSize.Width(); // and for the MouseMove method - m_pImpl->m_aMinSize = CalcMinimumSize(_rCompSize.Width() ); - b_AdjustMinWidth = sal_True; - } + m_pImpl->m_aMinSize = FixedText::CalcMinimumSize( nMaxWidth ); + // the MinimumSize is used to size the FocusRectangle + // and for the MouseMove method m_pImpl->m_aMinSize.Height() += 2; m_pImpl->m_aMinSize.Width() += 1; - return b_AdjustMinWidth; + return m_pImpl->m_aMinSize; } - void HyperLabel::implInit() { ToggleBackgroundColor( COL_TRANSPARENT ); @@ -234,17 +215,6 @@ namespace svt m_pImpl->bInteractive = ( _bInteractive && IsEnabled() ); } - void HyperLabel::SetHyperLabelPosition(sal_uInt16 XPos, sal_uInt16 YPos) - { - SetPosPixel( LogicToPixel( Point( XPos, YPos ), MAP_APPFONT ) ); - } - - Point HyperLabel::GetLogicalPosition() - { - Point aPoint = GetPosPixel( ); - return PixelToLogic( aPoint, MAP_APPFONT ); - } - sal_Int16 HyperLabel::GetID() const { return m_pImpl->ID; @@ -270,10 +240,9 @@ namespace svt return GetText(); } - void HyperLabel::SetLabel( ::rtl::OUString _rText ) + void HyperLabel::SetLabel( const ::rtl::OUString& _rText ) { SetText(_rText); - Show(); } diff --git a/svtools/source/control/roadmap.cxx b/svtools/source/control/roadmap.cxx index b0e178e631d9..693bca733813 100644 --- a/svtools/source/control/roadmap.cxx +++ b/svtools/source/control/roadmap.cxx @@ -49,11 +49,10 @@ #endif #include -#define RMENTRYPOINT_X 4 -#define RMENTRYPOINT_Y 27 -#define RMITEMDISTANCE_Y 6 +#define ROADMAP_INDENT_X 4 +#define ROADMAP_INDENT_Y 27 +#define ROADMAP_ITEM_DISTANCE_Y 6 #define RMINCOMPLETE -1 -#define NREMOVERMITEM -1 #define NADDITEM 1 #define INCOMPLETELABEL ::String::CreateFromAscii("...") // TODO: Cast to String @@ -63,30 +62,18 @@ namespace svt //......................................................................... typedef std::vector< ::rtl::OUString > S_Vector; - typedef std::vector< ORoadmapHyperLabel* > HL_Vector; + typedef std::vector< RoadmapItem* > HL_Vector; //===================================================================== - //= FontChanger + //= ColorChanger //===================================================================== -// class FontChanger -// { -// protected: -// OutputDevice* m_pDev; -// -// public: -// FontChanger( OutputDevice* _pDev, const Font& _rNewFont ) -// :m_pDev( _pDev ) -// { -// m_pDev->Push( PUSH_FONT ); -// m_pDev->SetFont( _rNewFont ); -// } -// -// ~FontChanger() -// { -// m_pDev->Pop( ); -// } -// }; - + class IDLabel : public FixedText + { + public: + IDLabel( Window* _pParent, WinBits _nWinStyle = 0 ); + ~IDLabel( ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + }; //===================================================================== //= ColorChanger @@ -111,6 +98,51 @@ namespace svt } }; + //===================================================================== + //= RoadmapItem + //===================================================================== + class RoadmapItem : public RoadmapTypes + { + private: + IDLabel* mpID; + HyperLabel* mpDescription; + const Size m_aItemPlayground; + + public: + RoadmapItem( ORoadmap& _rParent, const Size& _rItemPlayground ); + ~RoadmapItem( ); + + void SetID( sal_Int16 _ID ); + sal_Int16 GetID() const; + + void SetIndex( ItemIndex _Index ); + ItemIndex GetIndex() const; + + void SetLabel( const ::rtl::OUString& _rText ); + ::rtl::OUString GetLabel( ); + + void Update( ItemIndex _RMIndex, const ::rtl::OUString& _rText ); + + void SetPosition( RoadmapItem* OldHyperLabel ); + + void ToggleBackgroundColor( const Color& _rGBColor ); + void SetInteractive( sal_Bool _bInteractive ); + + void SetClickHdl( const Link& rLink ); + const Link& GetClickHdl() const; + void SetZOrder( RoadmapItem* pRefRoadmapHyperLabel, USHORT nFlags ); + void Enable( BOOL bEnable = TRUE); + BOOL IsEnabled() const; + void GrabFocus(); + + bool Contains( const Window* _pWindow ) const; + + HyperLabel* GetDescriptionHyperLabel() const { return mpDescription; } + + private: + void ImplUpdateIndex( const ItemIndex _nIndex ); + void ImplUpdatePosSize(); + }; //===================================================================== //= RoadmapImpl @@ -118,27 +150,32 @@ namespace svt class RoadmapImpl : public RoadmapTypes { protected: + const ORoadmap& m_rAntiImpl; Link m_aSelectHdl; BitmapEx m_aPicture; HL_Vector m_aRoadmapSteps; ItemId m_iCurItemID; sal_Bool m_bInteractive; sal_Bool m_bComplete; + Size m_aItemSizePixel; public: - RoadmapImpl() : - m_bInteractive( sal_True ), - m_bComplete( sal_True ) {} + RoadmapImpl( const ORoadmap& _rAntiImpl ) + :m_rAntiImpl( _rAntiImpl ) + ,m_iCurItemID( -1 ) + ,m_bInteractive( sal_True ) + ,m_bComplete( sal_True ) + { + } - Size aHyperLabelPixelSize; - ORoadmapHyperLabel* InCompleteHyperLabel; + RoadmapItem* InCompleteHyperLabel; - void addHyperLabel( ORoadmapHyperLabel* _rRoadmapStep ) { m_aRoadmapSteps.push_back(_rRoadmapStep); } + void addHyperLabel( RoadmapItem* _rRoadmapStep ) { m_aRoadmapSteps.push_back(_rRoadmapStep); } HL_Vector& getHyperLabels() { return m_aRoadmapSteps; } const HL_Vector& getHyperLabels() const { return m_aRoadmapSteps; } - void insertHyperLabel( ItemIndex _Index, ORoadmapHyperLabel* _rRoadmapStep ) { m_aRoadmapSteps.insert( m_aRoadmapSteps.begin() + _Index, _rRoadmapStep ); } + void insertHyperLabel( ItemIndex _Index, RoadmapItem* _rRoadmapStep ) { m_aRoadmapSteps.insert( m_aRoadmapSteps.begin() + _Index, _rRoadmapStep ); } ItemIndex getItemCount() const { return m_aRoadmapSteps.size();} @@ -157,6 +194,9 @@ namespace svt void setSelectHdl( const Link& _rHdl ) { m_aSelectHdl = _rHdl; } const Link& getSelectHdl( ) const { return m_aSelectHdl; } + void initItemSize(); + const Size& getItemSize() const { return m_aItemSizePixel; } + void removeHyperLabel( ItemIndex _Index ) { if ( ( _Index > -1 ) && ( _Index < getItemCount() ) ) @@ -172,8 +212,21 @@ namespace svt //= Roadmap //===================================================================== //--------------------------------------------------------------------- - ORoadmap::ORoadmap( Window* _pParent, const ResId& _rId ):Control( _pParent, _rId ) - ,m_pImpl( new RoadmapImpl() ) + void RoadmapImpl::initItemSize() + { + Size aLabelSize( m_rAntiImpl.GetOutputSizePixel() ); + aLabelSize.Height() = m_rAntiImpl.LogicToPixel( Size( 0, LABELBASEMAPHEIGHT ), MAP_APPFONT ).Height(); + aLabelSize.Width() -= m_rAntiImpl.LogicToPixel( Size( 2 * ROADMAP_INDENT_X, 0 ), MAP_APPFONT ).Width(); + m_aItemSizePixel = aLabelSize; + } + + //===================================================================== + //= Roadmap + //===================================================================== + //--------------------------------------------------------------------- + ORoadmap::ORoadmap( Window* _pParent, const ResId& _rId ) + :Control( _pParent, _rId ) + ,m_pImpl( new RoadmapImpl( *this ) ) { implInit(); } @@ -181,7 +234,7 @@ namespace svt //--------------------------------------------------------------------- ORoadmap::ORoadmap( Window* _pParent, WinBits _nWinStyle ) :Control( _pParent, _nWinStyle ) - , m_pImpl( new RoadmapImpl() ) + ,m_pImpl( new RoadmapImpl( *this ) ) { implInit(); @@ -216,14 +269,15 @@ namespace svt // on this with calculating a new bold font. // Unfortunately, the OutputDevice does not offer a notify mechanism for a changed font. // So settings the font from outside is simply a forbidded scenario at the moment + EnableMapMode( sal_False ); } //--------------------------------------------------------------------- ORoadmap::~ORoadmap( ) { - HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels(); + HL_Vector aItemsCopy = m_pImpl->getHyperLabels(); m_pImpl->getHyperLabels().clear(); - for ( HL_Vector::iterator i = pLocRoadmapItems.begin(); i< pLocRoadmapItems.end(); i++) + for ( HL_Vector::iterator i = aItemsCopy.begin(); i< aItemsCopy.end(); ++i ) { delete *i; } @@ -240,54 +294,43 @@ namespace svt } - void ORoadmap::InitializeHyperLabelSize() + RoadmapItem* ORoadmap::GetPreviousHyperLabel( ItemIndex _Index) { - Size aSize = GetSizePixel(); - Size aLogicSize = PixelToLogic( aSize, MAP_APPFONT ); - aLogicSize.Height() = LABELBASEMAPHEIGHT; - aLogicSize.Width() -= (2*RMENTRYPOINT_X); - m_pImpl->aHyperLabelPixelSize = LogicToPixel( aLogicSize, MAP_APPFONT ); - EnableMapMode( sal_False ); - } - - - ORoadmapHyperLabel* ORoadmap::GetPreviousHyperLabel( ItemIndex _Index) - { - ORoadmapHyperLabel* OldHyperLabel = NULL; - if (_Index > 0) - OldHyperLabel = m_pImpl->getHyperLabels().at( _Index - 1 ); - return OldHyperLabel; + RoadmapItem* pOldItem = NULL; + if ( _Index > 0 ) + pOldItem = m_pImpl->getHyperLabels().at( _Index - 1 ); + return pOldItem; } //--------------------------------------------------------------------- - ORoadmapHyperLabel* ORoadmap::InsertHyperLabel( ItemIndex _Index, ::rtl::OUString _sLabel, ItemId _RMID, sal_Bool _bEnabled) + RoadmapItem* ORoadmap::InsertHyperLabel( ItemIndex _Index, const ::rtl::OUString& _sLabel, ItemId _RMID, sal_Bool _bEnabled) { - if (m_pImpl->getItemCount() == 0 ) - InitializeHyperLabelSize(); - ORoadmapHyperLabel* CurHyperLabel; - ORoadmapHyperLabel* OldHyperLabel = GetPreviousHyperLabel( _Index); + if ( m_pImpl->getItemCount() == 0 ) + m_pImpl->initItemSize(); + + RoadmapItem* pItem = NULL; + RoadmapItem* pOldItem = GetPreviousHyperLabel( _Index ); - if (_RMID != RMINCOMPLETE ) + pItem = new RoadmapItem( *this, m_pImpl->getItemSize() ); + if ( _RMID != RMINCOMPLETE ) { - CurHyperLabel = new ORoadmapHyperLabel(this, WB_WORDBREAK); - CurHyperLabel->SetInteractive( m_pImpl->isInteractive() ); - m_pImpl->insertHyperLabel(_Index, CurHyperLabel ); + pItem->SetInteractive( m_pImpl->isInteractive() ); + m_pImpl->insertHyperLabel( _Index, pItem ); } else { - CurHyperLabel = new ORoadmapHyperLabel(this); - CurHyperLabel->SetInteractive( sal_False ); + pItem->SetInteractive( sal_False ); } - CurHyperLabel->SetPosition( OldHyperLabel ); - CurHyperLabel->SetLabelAndSize( _Index, _sLabel, m_pImpl->aHyperLabelPixelSize ); - CurHyperLabel->SetClickHdl(LINK( this, ORoadmap, ImplClickHdl ) ); - CurHyperLabel->SetID( _RMID ); - CurHyperLabel->SetIndex( _Index ); + pItem->SetPosition( pOldItem ); + pItem->Update( _Index, _sLabel ); + pItem->SetClickHdl(LINK( this, ORoadmap, ImplClickHdl ) ); + pItem->SetID( _RMID ); + pItem->SetIndex( _Index ); if (!_bEnabled) - CurHyperLabel->Enable( _bEnabled ); - return CurHyperLabel; + pItem->Enable( _bEnabled ); + return pItem; } //--------------------------------------------------------------------- @@ -308,12 +351,14 @@ namespace svt void ORoadmap::SetRoadmapInteractive( sal_Bool _bInteractive ) { m_pImpl->setInteractive( _bInteractive ); - ORoadmapHyperLabel* CurHyperLabel; - HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels(); - for ( HL_Vector::iterator i = pLocRoadmapItems.begin(); i< pLocRoadmapItems.end(); i++) + + const HL_Vector& rItems = m_pImpl->getHyperLabels(); + for ( HL_Vector::const_iterator i = rItems.begin(); + i < rItems.end(); + ++i + ) { - CurHyperLabel = *i; - CurHyperLabel->SetInteractive( _bInteractive ); + (*i)->SetInteractive( _bInteractive ); } } @@ -326,76 +371,55 @@ namespace svt //--------------------------------------------------------------------- void ORoadmap::SetRoadmapComplete( sal_Bool _bComplete ) { - sal_Bool OldbComplete = m_pImpl->isComplete(); - m_pImpl->setComplete( _bComplete); - if (_bComplete) + sal_Bool bWasComplete = m_pImpl->isComplete(); + m_pImpl->setComplete( _bComplete ); + if ( _bComplete ) { if ( m_pImpl->InCompleteHyperLabel != NULL) { - if (m_pImpl->getItemCount() > 0) - { - HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels(); - pLocRoadmapItems.pop_back(); - delete m_pImpl->InCompleteHyperLabel; - } + delete m_pImpl->InCompleteHyperLabel; m_pImpl->InCompleteHyperLabel = NULL; } } - else if (OldbComplete) - m_pImpl->InCompleteHyperLabel = InsertHyperLabel( m_pImpl->getItemCount(), ::String::CreateFromAscii("..."), RMINCOMPLETE ); + else if ( bWasComplete ) + m_pImpl->InCompleteHyperLabel = InsertHyperLabel( m_pImpl->getItemCount(), ::String::CreateFromAscii( "..." ), RMINCOMPLETE ); } //--------------------------------------------------------------------- - void ORoadmap::SetRoadmapLabel(ORoadmapHyperLabel* CurHyperLabel, sal_Int32 _nPrefix, String _sDescription) + void ORoadmap::UpdatefollowingHyperLabels( ItemIndex _nIndex ) { - const xub_StrLen n_Pos = _sDescription.Search( String::CreateFromAscii(".") ); - if ( n_Pos != STRING_NOTFOUND ) + const HL_Vector& rItems = m_pImpl->getHyperLabels(); + if ( _nIndex < (ItemIndex)rItems.size() ) { - const String sID = ::String::CreateFromInt32( _nPrefix ); - _sDescription.Replace(0 , n_Pos, sID ); - } - CurHyperLabel->SetLabelAndSize( _nPrefix, _sDescription, m_pImpl->aHyperLabelPixelSize ); - } - - //--------------------------------------------------------------------- - void ORoadmap::UpdatefollowingHyperLabels( ItemIndex _Index, sal_Int16 ) - { - if ( _Index < ( m_pImpl->getItemCount() ) ) - { - Point aPos; - String sLabel; - HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels(); - ORoadmapHyperLabel* CurHyperLabel = NULL; - ItemIndex n_CurPrefix = _Index + 1 ; - for ( HL_Vector::iterator i = pLocRoadmapItems.begin()+ _Index; i< pLocRoadmapItems.end(); i++) + RoadmapItem* pItem = NULL; + for ( HL_Vector::const_iterator i = rItems.begin() + _nIndex; + i< rItems.end(); + ++i, ++_nIndex + ) { - CurHyperLabel = *i; - aPos = CurHyperLabel->GetLogicalPosition(); - CurHyperLabel->SetIndex( n_CurPrefix - 1); - sLabel = CurHyperLabel->GetLabel(); - SetRoadmapLabel(CurHyperLabel, n_CurPrefix, sLabel); - ORoadmapHyperLabel* OldHyperLabel = GetPreviousHyperLabel( n_CurPrefix-1); - CurHyperLabel->SetPosition( OldHyperLabel); - n_CurPrefix++; + pItem = *i; + + pItem->SetIndex( _nIndex ); + pItem->SetPosition( GetPreviousHyperLabel( _nIndex ) ); } } if ( ! m_pImpl->isComplete() ) { - ORoadmapHyperLabel* OldHyperLabel = GetPreviousHyperLabel( m_pImpl->getItemCount()); - m_pImpl->InCompleteHyperLabel->SetPosition( OldHyperLabel ); - m_pImpl->InCompleteHyperLabel->SetLabelAndSize( m_pImpl->getItemCount(), ::String::CreateFromAscii("..."), m_pImpl->aHyperLabelPixelSize ); + RoadmapItem* pOldItem = GetPreviousHyperLabel( m_pImpl->getItemCount() ); + m_pImpl->InCompleteHyperLabel->SetPosition( pOldItem ); + m_pImpl->InCompleteHyperLabel->Update( m_pImpl->getItemCount(), ::String::CreateFromAscii("...") ); } } //--------------------------------------------------------------------- - void ORoadmap::ReplaceRoadmapItem( ItemIndex _Index, ::rtl::OUString _RoadmapItem, ItemId _RMID, sal_Bool _bEnabled ) + void ORoadmap::ReplaceRoadmapItem( ItemIndex _Index, const ::rtl::OUString& _RoadmapItem, ItemId _RMID, sal_Bool _bEnabled ) { - ORoadmapHyperLabel* CurHyperLabel = GetByIndex( _Index); - if ( CurHyperLabel != NULL ) + RoadmapItem* pItem = GetByIndex( _Index); + if ( pItem != NULL ) { - CurHyperLabel->SetLabelAndSize( _Index, _RoadmapItem, m_pImpl->aHyperLabelPixelSize ); - CurHyperLabel->SetID( _RMID ); - CurHyperLabel->Enable( _bEnabled ); + pItem->Update( _Index, _RoadmapItem ); + pItem->SetID( _RMID ); + pItem->Enable( _bEnabled ); } } @@ -408,7 +432,7 @@ namespace svt //--------------------------------------------------------------------- RoadmapTypes::ItemId ORoadmap::GetItemID( ItemIndex _nIndex ) const { - const ORoadmapHyperLabel* pHyperLabel = GetByIndex( _nIndex ); + const RoadmapItem* pHyperLabel = GetByIndex( _nIndex ); if ( pHyperLabel ) return pHyperLabel->GetID(); return -1; @@ -417,28 +441,26 @@ namespace svt //--------------------------------------------------------------------- RoadmapTypes::ItemIndex ORoadmap::GetItemIndex( ItemId _nID ) const { - ORoadmapHyperLabel* CurHyperLabel; ItemId nLocID = 0; - HL_Vector &LocHyperLabels = m_pImpl->getHyperLabels(); - ItemIndex nResult = 0; - for ( HL_Vector::iterator i = LocHyperLabels.begin(); i< LocHyperLabels.end(); i++) + const HL_Vector& rItems = m_pImpl->getHyperLabels(); + for ( HL_Vector::const_iterator i = rItems.begin(); + i < rItems.end(); + ++i + ) { - CurHyperLabel = *i; - nLocID = CurHyperLabel->GetID(); + nLocID = (*i)->GetID(); if ( nLocID == _nID ) - return nResult; - nResult++; + return ItemIndex( i - rItems.begin() ); } return -1; } //--------------------------------------------------------------------- - void ORoadmap::InsertRoadmapItem( ItemIndex _Index, ::rtl::OUString _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled ) + void ORoadmap::InsertRoadmapItem( ItemIndex _Index, const ::rtl::OUString& _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled ) { - ORoadmapHyperLabel* CurHyperLabel; - CurHyperLabel = InsertHyperLabel(_Index, _RoadmapItem, _nUniqueId, _bEnabled); + InsertHyperLabel( _Index, _RoadmapItem, _nUniqueId, _bEnabled ); // Todo: YPos is superfluous, if items are always appended - UpdatefollowingHyperLabels( _Index + 1); + UpdatefollowingHyperLabels( _Index + 1 ); } //--------------------------------------------------------------------- @@ -447,7 +469,7 @@ namespace svt if ( m_pImpl->getItemCount() > 0 && ( _Index > -1) && ( _Index < m_pImpl->getItemCount() ) ) { m_pImpl->removeHyperLabel( _Index ); - UpdatefollowingHyperLabels( _Index, NREMOVERMITEM); + UpdatefollowingHyperLabels( _Index ); } } @@ -460,33 +482,33 @@ namespace svt //--------------------------------------------------------------------- sal_Bool ORoadmap::IsRoadmapItemEnabled( ItemId _nItemId, ItemIndex _nStartIndex ) const { - const ORoadmapHyperLabel* _pLabelItem = GetByID( _nItemId, _nStartIndex ); + const RoadmapItem* _pLabelItem = GetByID( _nItemId, _nStartIndex ); return _pLabelItem ? _pLabelItem->IsEnabled() : sal_False; } //--------------------------------------------------------------------- void ORoadmap::EnableRoadmapItem( ItemId _nItemId, sal_Bool _bEnable, ItemIndex _nStartIndex ) { - ORoadmapHyperLabel* CurHyperLabel = GetByID( _nItemId, _nStartIndex ); - if ( CurHyperLabel != NULL ) - CurHyperLabel->Enable( _bEnable ); + RoadmapItem* pItem = GetByID( _nItemId, _nStartIndex ); + if ( pItem != NULL ) + pItem->Enable( _bEnable ); } //--------------------------------------------------------------------- - void ORoadmap::ChangeRoadmapItemLabel( ItemId _nID, ::rtl::OUString _sLabel, ItemIndex _nStartIndex ) + void ORoadmap::ChangeRoadmapItemLabel( ItemId _nID, const ::rtl::OUString& _sLabel, ItemIndex _nStartIndex ) { - ORoadmapHyperLabel* CurHyperLabel = GetByID( _nID, _nStartIndex ); - if ( CurHyperLabel != NULL ) + RoadmapItem* pItem = GetByID( _nID, _nStartIndex ); + if ( pItem != NULL ) { - CurHyperLabel->SetLabelAndSize( CurHyperLabel->GetIndex(), _sLabel, m_pImpl->aHyperLabelPixelSize ); - HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels(); - ItemIndex Index = _nStartIndex; - for ( HL_Vector::iterator i = pLocRoadmapItems.begin()+ Index; i< pLocRoadmapItems.end(); i++) + pItem->Update( pItem->GetIndex(), _sLabel ); + + const HL_Vector& rItems = m_pImpl->getHyperLabels(); + for ( HL_Vector::const_iterator i = rItems.begin() + _nStartIndex; + i < rItems.end(); + ++i + ) { - CurHyperLabel = *i; - ORoadmapHyperLabel* OldHyperLabel = GetPreviousHyperLabel( Index ); - CurHyperLabel->SetPosition( OldHyperLabel); - Index++; + (*i)->SetPosition( GetPreviousHyperLabel( i - rItems.begin() ) ); } } } @@ -495,9 +517,9 @@ namespace svt ::rtl::OUString ORoadmap::GetRoadmapItemLabel( ItemId _nID, ItemIndex _nStartIndex ) { - ORoadmapHyperLabel* CurHyperLabel = GetByID( _nID, _nStartIndex ); - if ( CurHyperLabel != NULL ) - return CurHyperLabel->GetLabel(); + RoadmapItem* pItem = GetByID( _nID, _nStartIndex ); + if ( pItem != NULL ) + return pItem->GetLabel(); else return ::rtl::OUString(); } @@ -505,47 +527,47 @@ namespace svt //--------------------------------------------------------------------- void ORoadmap::ChangeRoadmapItemID( ItemId _nID, ItemId _NewID, ItemIndex _nStartIndex ) { - ORoadmapHyperLabel* CurHyperLabel = GetByID( _nID, _nStartIndex ); - if ( CurHyperLabel != NULL ) - CurHyperLabel->SetID( _NewID ); + RoadmapItem* pItem = GetByID( _nID, _nStartIndex ); + if ( pItem != NULL ) + pItem->SetID( _NewID ); } //--------------------------------------------------------------------- - ORoadmapHyperLabel* ORoadmap::GetByID( ItemId _nID, ItemIndex _nStartIndex) + RoadmapItem* ORoadmap::GetByID( ItemId _nID, ItemIndex _nStartIndex) { - ORoadmapHyperLabel* CurHyperLabel; ItemId nLocID = 0; - HL_Vector &LocHyperLabels = m_pImpl->getHyperLabels(); - for ( HL_Vector::iterator i = LocHyperLabels.begin()+ _nStartIndex; i< LocHyperLabels.end(); i++) + const HL_Vector& rItems = m_pImpl->getHyperLabels(); + for ( HL_Vector::const_iterator i = rItems.begin() + _nStartIndex; + i < rItems.end(); + ++i + ) { - CurHyperLabel = *i; - nLocID = CurHyperLabel->GetID(); + nLocID = (*i)->GetID(); if ( nLocID == _nID ) - return CurHyperLabel; + return *i; } return NULL; } //--------------------------------------------------------------------- - const ORoadmapHyperLabel* ORoadmap::GetByID( ItemId _nID, ItemIndex _nStartIndex ) const + const RoadmapItem* ORoadmap::GetByID( ItemId _nID, ItemIndex _nStartIndex ) const { return const_cast< ORoadmap* >( this )->GetByID( _nID, _nStartIndex ); } //--------------------------------------------------------------------- - ORoadmapHyperLabel* ORoadmap::GetByIndex( ItemIndex _nItemIndex) + RoadmapItem* ORoadmap::GetByIndex( ItemIndex _nItemIndex) { - HL_Vector &LocHyperLabels = m_pImpl->getHyperLabels(); - if ((_nItemIndex > -1) && (_nItemIndex < m_pImpl->getItemCount( ) ) ) + const HL_Vector& rItems = m_pImpl->getHyperLabels(); + if ( ( _nItemIndex > -1 ) && ( _nItemIndex < (ItemIndex)rItems.size() ) ) { - ORoadmapHyperLabel* CurHyperLabel = LocHyperLabels.at(_nItemIndex); // Vectors are one-based - return CurHyperLabel; + return rItems.at( _nItemIndex ); } return NULL; } //--------------------------------------------------------------------- - const ORoadmapHyperLabel* ORoadmap::GetByIndex( ItemIndex _nItemIndex ) const + const RoadmapItem* ORoadmap::GetByIndex( ItemIndex _nItemIndex ) const { return const_cast< ORoadmap* >( this )->GetByIndex( _nItemIndex ); } @@ -553,14 +575,14 @@ namespace svt //--------------------------------------------------------------------- RoadmapTypes::ItemId ORoadmap::GetNextAvailableItemId( ItemIndex _nNewIndex ) { - ORoadmapHyperLabel* CurHyperLabel; + RoadmapItem* pItem = NULL; ItemIndex searchIndex = ++_nNewIndex; while ( searchIndex < m_pImpl->getItemCount() ) { - CurHyperLabel = GetByIndex( searchIndex ); - if ( CurHyperLabel->IsEnabled() ) - return CurHyperLabel->GetID( ); + pItem = GetByIndex( searchIndex ); + if ( pItem->IsEnabled() ) + return pItem->GetID( ); ++searchIndex; } @@ -570,13 +592,13 @@ namespace svt //--------------------------------------------------------------------- RoadmapTypes::ItemId ORoadmap::GetPreviousAvailableItemId( ItemIndex _nNewIndex ) { - ORoadmapHyperLabel* CurHyperLabel; + RoadmapItem* pItem = NULL; ItemIndex searchIndex = --_nNewIndex; while ( searchIndex > -1 ) { - CurHyperLabel = GetByIndex( searchIndex ); - if ( CurHyperLabel->IsEnabled() ) - return CurHyperLabel->GetID( ); + pItem = GetByIndex( searchIndex ); + if ( pItem->IsEnabled() ) + return pItem->GetID( ); searchIndex--; } @@ -586,12 +608,13 @@ namespace svt //--------------------------------------------------------------------- void ORoadmap::DeselectOldRoadmapItems() { - HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels(); - ORoadmapHyperLabel* CurHyperLabel = NULL; - for ( HL_Vector::iterator i = pLocRoadmapItems.begin(); i< pLocRoadmapItems.end(); i++) + const HL_Vector& rItems = m_pImpl->getHyperLabels(); + for ( HL_Vector::const_iterator i = rItems.begin(); + i < rItems.end(); + ++i + ) { - CurHyperLabel = *i; - CurHyperLabel->ToggleBackgroundColor( COL_TRANSPARENT ); + (*i)->ToggleBackgroundColor( COL_TRANSPARENT ); } } @@ -617,7 +640,7 @@ namespace svt //--------------------------------------------------------------------- void ORoadmap::GetFocus() { - ORoadmapHyperLabel* pCurHyperLabel = GetByID( GetCurrentRoadmapItemID() ); + RoadmapItem* pCurHyperLabel = GetByID( GetCurrentRoadmapItemID() ); if ( pCurHyperLabel != NULL ) pCurHyperLabel->GrabFocus(); } @@ -626,15 +649,15 @@ namespace svt sal_Bool ORoadmap::SelectRoadmapItemByID( ItemId _nNewID ) { DeselectOldRoadmapItems(); - ORoadmapHyperLabel* CurHyperLabel = GetByID( _nNewID ); - if (CurHyperLabel != NULL) + RoadmapItem* pItem = GetByID( _nNewID ); + if ( pItem != NULL ) { - if (CurHyperLabel->IsEnabled()) + if ( pItem->IsEnabled() ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - CurHyperLabel->ToggleBackgroundColor( rStyleSettings.GetHighlightColor() ); //HighlightColor + pItem->ToggleBackgroundColor( rStyleSettings.GetHighlightColor() ); //HighlightColor - CurHyperLabel->GrabFocus(); + pItem->GrabFocus(); m_pImpl->setCurItemID(_nNewID); Select(); @@ -670,7 +693,7 @@ namespace svt //--------------------------------------------------------------------- void ORoadmap::DrawHeadline() { - Point aTextPos = LogicToPixel( Point( RMENTRYPOINT_X, 8 ), MAP_APPFONT ); + Point aTextPos = LogicToPixel( Point( ROADMAP_INDENT_X, 8 ), MAP_APPFONT ); Size aOutputSize( GetOutputSizePixel() ); @@ -683,15 +706,16 @@ namespace svt } //--------------------------------------------------------------------- - ORoadmapHyperLabel* ORoadmap::GetByPointer(Window* pWindow) + RoadmapItem* ORoadmap::GetByPointer(Window* pWindow) { - ORoadmapHyperLabel* CurHyperLabel; - HL_Vector &LocHyperLabels = m_pImpl->getHyperLabels(); - for ( HL_Vector::iterator i = LocHyperLabels.begin(); i< LocHyperLabels.end(); i++) + const HL_Vector& rItems = m_pImpl->getHyperLabels(); + for ( HL_Vector::const_iterator i = rItems.begin(); + i < rItems.end(); + ++i + ) { - CurHyperLabel = *i; - if ( (CurHyperLabel->GetIDLabel() == pWindow) || (CurHyperLabel->GetDescriptionHyperLabel() == pWindow) ) - return CurHyperLabel; + if ( (*i)->Contains( pWindow ) ) + return *i; } return NULL; } @@ -703,30 +727,30 @@ namespace svt if ( _rNEvt.GetType() == EVENT_KEYINPUT ) { Window* pWindow = _rNEvt.GetWindow(); - ORoadmapHyperLabel* CurHyperLabel = GetByPointer( pWindow ); - if ( CurHyperLabel != NULL ) + RoadmapItem* pItem = GetByPointer( pWindow ); + if ( pItem != NULL ) { sal_Int16 nKeyCode = _rNEvt.GetKeyEvent()->GetKeyCode().GetCode(); switch( nKeyCode ) { case KEY_UP: - { // Note: Performancewhise this is not optimal, because we search for an ID in the labels + { // Note: Performancewise this is not optimal, because we search for an ID in the labels // and afterwards we search again for a label with the appropriate ID -> // unnecessarily we search twice!!! - ItemId nPrevItemID = GetPreviousAvailableItemId( CurHyperLabel->GetIndex() ); + ItemId nPrevItemID = GetPreviousAvailableItemId( pItem->GetIndex() ); if ( nPrevItemID != -1 ) return SelectRoadmapItemByID( nPrevItemID ); } break; case KEY_DOWN: { - ItemId nNextItemID = GetNextAvailableItemId( CurHyperLabel->GetIndex() ); + ItemId nNextItemID = GetNextAvailableItemId( pItem->GetIndex() ); if ( nNextItemID != -1 ) return SelectRoadmapItemByID( nNextItemID ); } break; case KEY_SPACE: - return SelectRoadmapItemByID( CurHyperLabel->GetID() ); + return SelectRoadmapItemByID( pItem->GetID() ); } } } @@ -736,9 +760,12 @@ namespace svt //--------------------------------------------------------------------- IMPL_LINK(ORoadmap, ImplClickHdl, HyperLabel*, _CurHyperLabel) { - return SelectRoadmapItemByID( _CurHyperLabel->GetID() ); + return SelectRoadmapItemByID( _CurHyperLabel->GetID() ); } + + + //--------------------------------------------------------------------- void ORoadmap::DataChanged( const DataChangedEvent& rDCEvt ) { if ((( rDCEvt.GetType() == DATACHANGED_SETTINGS ) || @@ -752,216 +779,228 @@ namespace svt aFont.SetColor( aTextColor ); SetFont( aFont ); RoadmapTypes::ItemId curItemID = GetCurrentRoadmapItemID(); - ORoadmapHyperLabel* pLabelItem = GetByID( curItemID ); + RoadmapItem* pLabelItem = GetByID( curItemID ); pLabelItem->ToggleBackgroundColor(rStyleSettings.GetHighlightColor()); Invalidate(); } } - ORoadmapHyperLabel::ORoadmapHyperLabel( Window* _pParent, const ResId& ) + //--------------------------------------------------------------------- + RoadmapItem::RoadmapItem( ORoadmap& _rParent, const Size& _rItemPlayground ) + :m_aItemPlayground( _rItemPlayground ) { - mpIDLabel = new ORoadmapIDHyperLabel(_pParent, WB_WORDBREAK); - mpDescHyperLabel = new HyperLabel(_pParent, WB_NOTABSTOP | WB_WORDBREAK); + mpID = new IDLabel( &_rParent, WB_WORDBREAK ); + mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetFieldTextColor( ) ); + mpID->Show(); + mpDescription = new HyperLabel( &_rParent, WB_NOTABSTOP | WB_WORDBREAK ); + mpDescription->Show(); } - - ORoadmapHyperLabel::ORoadmapHyperLabel( Window* _pParent, WinBits ) + //--------------------------------------------------------------------- + bool RoadmapItem::Contains( const Window* _pWindow ) const { - mpIDLabel = new ORoadmapIDHyperLabel(_pParent, WB_WORDBREAK); - mpIDLabel->SetTextColor( mpIDLabel->GetSettings().GetStyleSettings().GetFieldTextColor( ) ); - mpDescHyperLabel = new HyperLabel(_pParent, WB_NOTABSTOP | WB_WORDBREAK); + return ( mpID == _pWindow ) || ( mpDescription == _pWindow ); } //--------------------------------------------------------------------- - void ORoadmapHyperLabel::GrabFocus() + void RoadmapItem::GrabFocus() { - if ( mpDescHyperLabel ) - mpDescHyperLabel->GrabFocus(); + if ( mpDescription ) + mpDescription->GrabFocus(); } - - void ORoadmapHyperLabel::SetInteractive( sal_Bool _bInteractive ) + //--------------------------------------------------------------------- + void RoadmapItem::SetInteractive( sal_Bool _bInteractive ) { - if ( mpDescHyperLabel ) - mpDescHyperLabel->SetInteractive(_bInteractive); + if ( mpDescription ) + mpDescription->SetInteractive(_bInteractive); } - void ORoadmapHyperLabel::SetID( sal_Int16 _ID ) + //--------------------------------------------------------------------- + void RoadmapItem::SetID( sal_Int16 _ID ) { - if ( mpDescHyperLabel ) - mpDescHyperLabel->SetID(_ID); + if ( mpDescription ) + mpDescription->SetID(_ID); } - sal_Int16 ORoadmapHyperLabel::GetID() const + //--------------------------------------------------------------------- + sal_Int16 RoadmapItem::GetID() const { - return mpDescHyperLabel ? mpDescHyperLabel->GetID() : sal_Int16(-1); + return mpDescription ? mpDescription->GetID() : sal_Int16(-1); } - void ORoadmapHyperLabel::SetIndex( sal_Int32 _Index ) + //--------------------------------------------------------------------- + void RoadmapItem::ImplUpdateIndex( const ItemIndex _nIndex ) { - if ( mpDescHyperLabel ) - mpDescHyperLabel->SetIndex(_Index); - } + if ( mpDescription ) + mpDescription->SetIndex( _nIndex ); + if ( mpID ) + { + ::rtl::OUString aIDText = ::rtl::OUString::valueOf( (sal_Int32)( _nIndex + 1 ) ) + ::rtl::OUString::createFromAscii( "." ); + mpID->SetText( aIDText ); + } - sal_Int32 ORoadmapHyperLabel::GetIndex() const - { - return mpDescHyperLabel ? mpDescHyperLabel->GetIndex() : sal_Int32(-1); + // update the geometry of both controls + ImplUpdatePosSize(); } - - void ORoadmapHyperLabel::SetLabel( ::rtl::OUString _rText ) + //--------------------------------------------------------------------- + void RoadmapItem::SetIndex( ItemIndex _Index ) { - if ( mpDescHyperLabel ) - mpDescHyperLabel->SetText(_rText); + ImplUpdateIndex( _Index ); } + //--------------------------------------------------------------------- + RoadmapTypes::ItemIndex RoadmapItem::GetIndex() const + { + return mpDescription ? mpDescription->GetIndex() : ItemIndex(-1); + } - ::rtl::OUString ORoadmapHyperLabel::GetLabel( ) + //--------------------------------------------------------------------- + void RoadmapItem::SetLabel( const ::rtl::OUString& _rText ) { - return mpDescHyperLabel ? mpDescHyperLabel->GetText() : String(); + if ( mpDescription ) + mpDescription->SetText(_rText); } + //--------------------------------------------------------------------- + ::rtl::OUString RoadmapItem::GetLabel( ) + { + return mpDescription ? mpDescription->GetText() : String(); + } - void ORoadmapHyperLabel::SetPosition(ORoadmapHyperLabel* OldHyperLabel) + //--------------------------------------------------------------------- + void RoadmapItem::SetPosition( RoadmapItem* _pOldItem ) { - Point aNewLogicalPoint; - Point aNewPoint; - if (OldHyperLabel == NULL) + Point aIDPos; + if ( _pOldItem == NULL ) { - aNewLogicalPoint = Point( RMENTRYPOINT_X, RMENTRYPOINT_Y); - aNewPoint = mpIDLabel->LogicToPixel(aNewLogicalPoint, MAP_APPFONT ); + aIDPos = mpID->LogicToPixel( Point( ROADMAP_INDENT_X, ROADMAP_INDENT_Y ), MAP_APPFONT ); } else { - Size aOldSize = OldHyperLabel->GetDescriptionHyperLabel()->GetSizePixel(); - Point aOldLogicalPoint = OldHyperLabel->GetLogicalPosition(); - aNewLogicalPoint = Point(aOldLogicalPoint.X(), (aOldLogicalPoint.Y() + RMITEMDISTANCE_Y)); - aNewPoint = mpIDLabel->LogicToPixel(aNewLogicalPoint, MAP_APPFONT ); - aNewPoint = Point(aNewPoint.X(),aNewPoint.Y() + aOldSize.Height()); + Size aOldSize = _pOldItem->GetDescriptionHyperLabel()->GetSizePixel(); + + aIDPos = _pOldItem->mpID->GetPosPixel(); + aIDPos.Y() += aOldSize.Height(); + aIDPos.Y() += mpID->GetParent()->LogicToPixel( Size( 0, ROADMAP_ITEM_DISTANCE_Y ) ).Height(); } - mpIDLabel->SetPosPixel( aNewPoint ); - sal_Int32 xDescPos = aNewPoint.X() + mpIDLabel->GetSizePixel().Width(); - mpDescHyperLabel->SetPosPixel( Point(xDescPos, aNewPoint.Y()) ); - } + mpID->SetPosPixel( aIDPos ); + sal_Int32 nDescPos = aIDPos.X() + mpID->GetSizePixel().Width(); + mpDescription->SetPosPixel( Point( nDescPos, aIDPos.Y() ) ); + } - void ORoadmapHyperLabel::SetZOrder( ORoadmapHyperLabel* pRefRoadmapHyperLabel, USHORT nFlags ) + //--------------------------------------------------------------------- + void RoadmapItem::SetZOrder( RoadmapItem* pRefRoadmapHyperLabel, USHORT nFlags ) { if (pRefRoadmapHyperLabel == NULL) - mpDescHyperLabel->SetZOrder( NULL, nFlags); //WINDOW_ZORDER_FIRST ); + mpDescription->SetZOrder( NULL, nFlags); //WINDOW_ZORDER_FIRST ); else - mpDescHyperLabel->SetZOrder( pRefRoadmapHyperLabel->mpDescHyperLabel, nFlags); //, WINDOW_ZORDER_BEHIND ); + mpDescription->SetZOrder( pRefRoadmapHyperLabel->mpDescription, nFlags); //, WINDOW_ZORDER_BEHIND ); } - - void ORoadmapHyperLabel::Enable( BOOL _bEnable) + //--------------------------------------------------------------------- + void RoadmapItem::Enable( BOOL _bEnable) { - mpIDLabel->Enable(_bEnable); - mpDescHyperLabel->Enable(_bEnable); + mpID->Enable(_bEnable); + mpDescription->Enable(_bEnable); } - BOOL ORoadmapHyperLabel::IsEnabled() const + //--------------------------------------------------------------------- + BOOL RoadmapItem::IsEnabled() const { - return mpIDLabel->IsEnabled(); + return mpID->IsEnabled(); } -// void ORoadmapHyperLabel::GrabFocus() -// { -// mpDescHyperLabel->GrabFocus(); -// -// } - - void ORoadmapHyperLabel::ToggleBackgroundColor( const Color& _rGBColor ) + //--------------------------------------------------------------------- + void RoadmapItem::ToggleBackgroundColor( const Color& _rGBColor ) { if (_rGBColor == COL_TRANSPARENT) { - mpIDLabel->SetTextColor( mpIDLabel->GetSettings().GetStyleSettings().GetFieldTextColor( ) ); - mpIDLabel->SetControlBackground( COL_TRANSPARENT ); + mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetFieldTextColor( ) ); + mpID->SetControlBackground( COL_TRANSPARENT ); } else { - mpIDLabel->SetControlBackground( mpIDLabel->GetSettings().GetStyleSettings().GetHighlightColor() ); - mpIDLabel->SetTextColor( mpIDLabel->GetSettings().GetStyleSettings().GetHighlightTextColor( ) ); + mpID->SetControlBackground( mpID->GetSettings().GetStyleSettings().GetHighlightColor() ); + mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetHighlightTextColor( ) ); } - mpDescHyperLabel->ToggleBackgroundColor(_rGBColor); + mpDescription->ToggleBackgroundColor(_rGBColor); } - - Point ORoadmapHyperLabel::GetLogicalPosition() + //--------------------------------------------------------------------- + void RoadmapItem::ImplUpdatePosSize() { - Point aPoint = mpIDLabel->GetPosPixel( ); - Size aSize = Size(aPoint.X(), aPoint.Y()); - aSize = mpIDLabel->PixelToLogic( aSize, MAP_APPFONT ); - aPoint = Point(aSize.Width(), aSize.Height()); - return aPoint; - } + // calculate widths + long nIDWidth = mpID->GetTextWidth( mpID->GetText() ); + long nMaxIDWidth = mpID->GetTextWidth( ::rtl::OUString::createFromAscii( "100." ) ); + nIDWidth = ::std::min( nIDWidth, nMaxIDWidth ); + + // check how many space the description would need + Size aDescriptionSize = mpDescription->CalcMinimumSize( m_aItemPlayground.Width() - nIDWidth ); + + // position and size both controls + Size aIDSize( nIDWidth, aDescriptionSize.Height() ); + mpID->SetSizePixel( aIDSize ); + Point aIDPos = mpID->GetPosPixel(); + mpDescription->SetPosPixel( Point( aIDPos.X() + nIDWidth, aIDPos.Y() ) ); + mpDescription->SetSizePixel( aDescriptionSize ); + } - void ORoadmapHyperLabel::SetLabelAndSize( ItemIndex _RMIndex, ::rtl::OUString _rText, const Size& _rNewSize) + //--------------------------------------------------------------------- + void RoadmapItem::Update( ItemIndex _RMIndex, const ::rtl::OUString& _rText ) { - Size rIDSize = _rNewSize; - ::rtl::OUString aStr = ::rtl::OUString::valueOf( (sal_Int32)( _RMIndex + 1 ) ) + ::rtl::OUString::createFromAscii( "." ); - rIDSize.Width() = (sal_Int32) mpIDLabel->GetTextWidth( aStr ); - long nMaxWidth = mpIDLabel->GetTextWidth( ::rtl::OUString::createFromAscii("100.") ); - rIDSize.Width() = ::std::min( rIDSize.getWidth(),nMaxWidth ); - mpIDLabel->SetSizePixel(mpIDLabel->LogicToPixel( rIDSize)); - mpIDLabel->SetText( aStr); - mpIDLabel->Show(); - Size rDescSize = _rNewSize; - rDescSize.Width() -= rIDSize.Width(); - sal_Int32 xDescPos = mpIDLabel->GetPosPixel().X() + mpIDLabel->GetSizePixel().Width(); - sal_Int32 yDescPos = mpIDLabel->GetPosPixel().Y(); - Point aPoint = Point(xDescPos, yDescPos); - mpDescHyperLabel->SetPosPixel( aPoint ); - mpDescHyperLabel->SetLabelAndSize(_rText, rDescSize); - mpIDLabel->SetSizePixel( Size( mpIDLabel->GetSizePixel().Width(), mpDescHyperLabel->GetSizePixel().Height() ) ); + // update description label + mpDescription->SetLabel( _rText ); + + // update the index in both controls, which triggers updating the geometry of both + ImplUpdateIndex( _RMIndex ); } - ORoadmapHyperLabel::~ORoadmapHyperLabel( ) + //--------------------------------------------------------------------- + RoadmapItem::~RoadmapItem( ) { { - ::std::auto_ptr aTemp(mpIDLabel); - mpIDLabel = NULL; + ::std::auto_ptr aTemp(mpID); + mpID = NULL; } { - ::std::auto_ptr aTemp(mpDescHyperLabel); - mpDescHyperLabel = NULL; + ::std::auto_ptr aTemp(mpDescription); + mpDescription = NULL; } } - - void ORoadmapHyperLabel::SetClickHdl( const Link& rLink ) - { - if ( mpDescHyperLabel ) - mpDescHyperLabel->SetClickHdl( rLink); - } - - const Link& ORoadmapHyperLabel::GetClickHdl( ) const + //--------------------------------------------------------------------- + void RoadmapItem::SetClickHdl( const Link& rLink ) { - return mpDescHyperLabel->GetClickHdl(); + if ( mpDescription ) + mpDescription->SetClickHdl( rLink); } - - ORoadmapIDHyperLabel::ORoadmapIDHyperLabel( Window* _pParent, const ResId& _rId ) - :FixedText( _pParent, _rId ) + //--------------------------------------------------------------------- + const Link& RoadmapItem::GetClickHdl( ) const { + return mpDescription->GetClickHdl(); } - ORoadmapIDHyperLabel::ORoadmapIDHyperLabel( Window* _pParent, WinBits _nWinStyle ) + //--------------------------------------------------------------------- + IDLabel::IDLabel( Window* _pParent, WinBits _nWinStyle ) :FixedText( _pParent, _nWinStyle ) { } - - ORoadmapIDHyperLabel::~ORoadmapIDHyperLabel( ) + //--------------------------------------------------------------------- + IDLabel::~IDLabel( ) { } - - void ORoadmapIDHyperLabel::DataChanged( const DataChangedEvent& rDCEvt ) + //--------------------------------------------------------------------- + void IDLabel::DataChanged( const DataChangedEvent& rDCEvt ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); FixedText::DataChanged( rDCEvt ); diff --git a/toolkit/inc/toolkit/awt/vclxtopwindow.hxx b/toolkit/inc/toolkit/awt/vclxtopwindow.hxx index 7b4f1922b99e..4716120a347b 100644 --- a/toolkit/inc/toolkit/awt/vclxtopwindow.hxx +++ b/toolkit/inc/toolkit/awt/vclxtopwindow.hxx @@ -32,31 +32,45 @@ #define _TOOLKIT_AWT_VCLXTOPWINDOW_HXX_ #include -#include +#include #include #include #include -#include +#include #include -typedef ::cppu::ImplHelper2 < ::com::sun::star::awt::XTopWindow, - ::com::sun::star::awt::XSystemDependentWindowPeer - > VCLXTopWindow_XBase; +typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XTopWindow2 + > VCLXTopWindow_XBase; +typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XSystemDependentWindowPeer + > VCLXTopWindow_SBase; -class TOOLKIT_DLLPUBLIC VCLXTopWindow_Base: public VCLXTopWindow_XBase +class TOOLKIT_DLLPUBLIC VCLXTopWindow_Base :public VCLXTopWindow_XBase + ,public VCLXTopWindow_SBase { +private: + const bool m_bWHWND; + protected: ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar> mxMenuBar; + bool isSystemDependentWindowPeer() const { return m_bWHWND; } + virtual ::vos::IMutex& GetMutexImpl() = 0; virtual Window* GetWindowImpl() = 0; virtual ::cppu::OInterfaceContainerHelper& GetTopWindowListenersImpl() = 0; + VCLXTopWindow_Base( const bool _bSupportSystemWindowPeer ); + public: virtual ~VCLXTopWindow_Base(); + // XInterface equivalents + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + // XTypeProvider equivalents + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + // ::com::sun::star::awt::XSystemDependentWindowPeer ::com::sun::star::uno::Any SAL_CALL getWindowHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& ProcessId, sal_Int16 SystemType ) throw(::com::sun::star::uno::RuntimeException); @@ -66,6 +80,14 @@ public: void SAL_CALL toFront() throw(::com::sun::star::uno::RuntimeException); void SAL_CALL toBack() throw(::com::sun::star::uno::RuntimeException); void SAL_CALL setMenuBar( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar >& xMenu ) throw(::com::sun::star::uno::RuntimeException); + + // XTopWindow2 + virtual ::sal_Bool SAL_CALL getIsMaximized() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setIsMaximized( ::sal_Bool _ismaximized ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getIsMinimized() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setIsMinimized( ::sal_Bool _isminimized ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getDisplay() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDisplay( ::sal_Int32 _display ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException); }; // ---------------------------------------------------- @@ -75,9 +97,6 @@ public: class VCLXTopWindow: public VCLXTopWindow_Base, public VCLXContainer { -private: - bool m_bWHWND; - protected: virtual vos::IMutex& GetMutexImpl(); virtual Window* GetWindowImpl(); diff --git a/toolkit/inc/toolkit/awt/vclxwindows.hxx b/toolkit/inc/toolkit/awt/vclxwindows.hxx index 3e61a9e9aa87..b6958c720f29 100644 --- a/toolkit/inc/toolkit/awt/vclxwindows.hxx +++ b/toolkit/inc/toolkit/awt/vclxwindows.hxx @@ -32,6 +32,7 @@ #define _TOOLKIT_AWT_VCLXWINDOWS_HXX_ #include + #include #include #include @@ -88,8 +89,8 @@ #include #include -#include -#include +#include "toolkit/awt/vclxwindow.hxx" +#include "toolkit/awt/vclxtopwindow.hxx" #include #include diff --git a/toolkit/source/awt/vclxdialog.cxx b/toolkit/source/awt/vclxdialog.cxx index 0712f8ca074c..32f2931e7438 100644 --- a/toolkit/source/awt/vclxdialog.cxx +++ b/toolkit/source/awt/vclxdialog.cxx @@ -66,6 +66,7 @@ DBG_NAME( VCLXDialog ) VCLXDialog::VCLXDialog() : VCLXWindow() + , VCLXTopWindow_Base( true ) , VCLXDialog_Base() , Bin() , bRealized( false ) diff --git a/toolkit/source/awt/vclxtopwindow.cxx b/toolkit/source/awt/vclxtopwindow.cxx index 26e457d74583..6e532c7bef3e 100644 --- a/toolkit/source/awt/vclxtopwindow.cxx +++ b/toolkit/source/awt/vclxtopwindow.cxx @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -54,13 +55,44 @@ #include #include #include +#include #include +using ::com::sun::star::uno::RuntimeException; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::Type; +using ::com::sun::star::uno::Any; +using ::com::sun::star::lang::IndexOutOfBoundsException; + +VCLXTopWindow_Base::VCLXTopWindow_Base( const bool _bSupportSystemWindowPeer ) + :m_bWHWND( _bSupportSystemWindowPeer ) +{ +} + VCLXTopWindow_Base::~VCLXTopWindow_Base() { } +Any VCLXTopWindow_Base::queryInterface( const Type & rType ) throw(RuntimeException) +{ + ::com::sun::star::uno::Any aRet( VCLXTopWindow_XBase::queryInterface( rType ) ); + + // do not expose XSystemDependentWindowPeer if we do not have a system window handle + if ( !aRet.hasValue() && m_bWHWND ) + aRet = VCLXTopWindow_SBase::queryInterface( rType ); + + return aRet; +} + +Sequence< Type > VCLXTopWindow_Base::getTypes() throw(RuntimeException) +{ + Sequence< Type > aTypes( VCLXTopWindow_XBase::getTypes() ); + if ( m_bWHWND ) + aTypes = ::comphelper::concatSequences( aTypes, VCLXTopWindow_SBase::getTypes() ); + return aTypes; +} + ::com::sun::star::uno::Any VCLXTopWindow_Base::getWindowHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& /*ProcessId*/, sal_Int16 SystemType ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutexImpl() ); @@ -157,6 +189,81 @@ void VCLXTopWindow_Base::setMenuBar( const ::com::sun::star::uno::Reference< ::c mxMenuBar = rxMenu; } +//-------------------------------------------------------------------- +::sal_Bool SAL_CALL VCLXTopWindow_Base::getIsMaximized() throw (RuntimeException) +{ + ::vos::OGuard aGuard( GetMutexImpl() ); + + const WorkWindow* pWindow = dynamic_cast< const WorkWindow* >( GetWindowImpl() ); + if ( !pWindow ) + return sal_False; + + return pWindow->IsMaximized(); +} + +//-------------------------------------------------------------------- +void SAL_CALL VCLXTopWindow_Base::setIsMaximized( ::sal_Bool _ismaximized ) throw (RuntimeException) +{ + ::vos::OGuard aGuard( GetMutexImpl() ); + + WorkWindow* pWindow = dynamic_cast< WorkWindow* >( GetWindowImpl() ); + if ( !pWindow ) + return; + + pWindow->Maximize( _ismaximized ); +} + +//-------------------------------------------------------------------- +::sal_Bool SAL_CALL VCLXTopWindow_Base::getIsMinimized() throw (RuntimeException) +{ + ::vos::OGuard aGuard( GetMutexImpl() ); + + const WorkWindow* pWindow = dynamic_cast< const WorkWindow* >( GetWindowImpl() ); + if ( !pWindow ) + return sal_False; + + return pWindow->IsMinimized(); +} + +//-------------------------------------------------------------------- +void SAL_CALL VCLXTopWindow_Base::setIsMinimized( ::sal_Bool _isMinimized ) throw (RuntimeException) +{ + ::vos::OGuard aGuard( GetMutexImpl() ); + + WorkWindow* pWindow = dynamic_cast< WorkWindow* >( GetWindowImpl() ); + if ( !pWindow ) + return; + + _isMinimized ? pWindow->Minimize() : pWindow->Restore(); +} + +//-------------------------------------------------------------------- +::sal_Int32 SAL_CALL VCLXTopWindow_Base::getDisplay() throw (RuntimeException) +{ + ::vos::OGuard aGuard( GetMutexImpl() ); + + const SystemWindow* pWindow = dynamic_cast< const SystemWindow* >( GetWindowImpl() ); + if ( !pWindow ) + return 0; + + return pWindow->GetScreenNumber(); +} + +//-------------------------------------------------------------------- +void SAL_CALL VCLXTopWindow_Base::setDisplay( ::sal_Int32 _display ) throw (RuntimeException, IndexOutOfBoundsException) +{ + ::vos::OGuard aGuard( GetMutexImpl() ); + + if ( ( _display < 0 ) || ( _display >= (sal_Int32)Application::GetScreenCount() ) ) + throw IndexOutOfBoundsException(); + + SystemWindow* pWindow = dynamic_cast< SystemWindow* >( GetWindowImpl() ); + if ( !pWindow ) + return; + + pWindow->SetScreenNumber( _display ); +} + // ---------------------------------------------------- // class VCLXTopWindow // ---------------------------------------------------- @@ -167,7 +274,7 @@ void VCLXTopWindow::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) } VCLXTopWindow::VCLXTopWindow(bool bWHWND) - : m_bWHWND(bWHWND) + : VCLXTopWindow_Base( bWHWND ) { } @@ -193,24 +300,19 @@ Window* VCLXTopWindow::GetWindowImpl() // ::com::sun::star::uno::XInterface ::com::sun::star::uno::Any VCLXTopWindow::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { - ::com::sun::star::uno::Any aRet; - if(! m_bWHWND) { - aRet = ::cppu::queryInterface( rType, - SAL_STATIC_CAST( ::com::sun::star::awt::XTopWindow*, this ) ); - } - else { - aRet = ::cppu::queryInterface( rType, - SAL_STATIC_CAST( ::com::sun::star::awt::XTopWindow*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XSystemDependentWindowPeer*, this ) ); - } - return (aRet.hasValue() ? aRet : VCLXContainer::queryInterface( rType )); + ::com::sun::star::uno::Any aRet( VCLXTopWindow_Base::queryInterface( rType ) ); + + if ( !aRet.hasValue() ) + aRet = VCLXContainer::queryInterface( rType ); + + return aRet; } ::com::sun::star::uno::Sequence< sal_Int8 > VCLXTopWindow::getImplementationId() throw(::com::sun::star::uno::RuntimeException) { static ::cppu::OImplementationId* pId = NULL; static ::cppu::OImplementationId* pIdWithHandle = NULL; - if ( m_bWHWND ) + if ( isSystemDependentWindowPeer() ) { if( !pIdWithHandle ) { @@ -242,41 +344,5 @@ Window* VCLXTopWindow::GetWindowImpl() ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > VCLXTopWindow::getTypes() throw(::com::sun::star::uno::RuntimeException) { - static ::cppu::OTypeCollection* pCollection = NULL; - static ::cppu::OTypeCollection* pCollectionWithHandle = NULL; - - if ( m_bWHWND ) - { - if( !pCollectionWithHandle ) - { - ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); - if( !pCollectionWithHandle ) - { - static ::cppu::OTypeCollection collectionWithHandle( - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSystemDependentWindowPeer>* ) NULL ), - VCLXContainer::getTypes() ); - pCollectionWithHandle = &collectionWithHandle; - } - } - - return (*pCollectionWithHandle).getTypes(); - } - else - { - if( !pCollection ) - { - ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); - if( !pCollection ) - { - static ::cppu::OTypeCollection collection( - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow>* ) NULL ), - VCLXContainer::getTypes() ); - pCollection = &collection; - } - } - return (*pCollection).getTypes(); - } + return ::comphelper::concatSequences( VCLXTopWindow_Base::getTypes(), VCLXContainer::getTypes() ); } diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index b49fa1a621d6..1df275589063 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -420,9 +420,6 @@ VCLXButton::VCLXButton() VCLXButton::~VCLXButton() { -#ifndef __SUNPRO_CC - OSL_TRACE ("%s", __FUNCTION__); -#endif } ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXButton::CreateAccessibleContext() diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx index 0775b6ee74f3..21876feb072b 100644 --- a/toolkit/source/controls/unocontrol.cxx +++ b/toolkit/source/controls/unocontrol.cxx @@ -1050,10 +1050,10 @@ void UnoControl::draw( sal_Int32 x, sal_Int32 y ) throw(RuntimeException) if ( xDrawPeerView.is() ) { - Reference< XVclWindowPeer > xWindowPeer; - xWindowPeer.set( xDrawPeer, UNO_QUERY ); - if ( xWindowPeer.is() ) - xWindowPeer->setDesignMode( mbDesignMode ); + Reference< XVclWindowPeer > xWindowPeer; + xWindowPeer.set( xDrawPeer, UNO_QUERY ); + if ( xWindowPeer.is() ) + xWindowPeer->setDesignMode( mbDesignMode ); xDrawPeerView->draw( x, y ); } diff --git a/vcl/inc/vcl/wrkwin.hxx b/vcl/inc/vcl/wrkwin.hxx index 8b2701420a2f..1dd46d8debe5 100644 --- a/vcl/inc/vcl/wrkwin.hxx +++ b/vcl/inc/vcl/wrkwin.hxx @@ -105,7 +105,7 @@ public: void Restore(); void Maximize( BOOL bMaximize = TRUE ); - BOOL IsMaximized(); + BOOL IsMaximized() const; }; #endif // _SV_WRKWIN_HXX diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx index 0c19c5c5ee4f..c1f80bb061e5 100644 --- a/vcl/source/window/wrkwin.cxx +++ b/vcl/source/window/wrkwin.cxx @@ -310,7 +310,7 @@ void WorkWindow::Maximize( BOOL bMaximize ) ImplSetFrameState( bMaximize ? SAL_FRAMESTATE_MAXIMIZED : SAL_FRAMESTATE_NORMAL ); } -BOOL WorkWindow::IsMaximized() +BOOL WorkWindow::IsMaximized() const { BOOL bRet = FALSE; -- cgit From ab651c33a7a67bb50f49015d7bccb18fd7eae8e3 Mon Sep 17 00:00:00 2001 From: Thorsten Behrens Date: Fri, 27 Nov 2009 17:39:26 +0000 Subject: #i107248# Free render Picture before killing underlying drawable --- vcl/unx/gtk/window/gtkframe.cxx | 5 +++++ vcl/unx/inc/salframe.h | 2 +- vcl/unx/source/window/salframe.cxx | 9 +++++---- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index 99a331be2318..92ff2d3b8d8e 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -2377,6 +2377,11 @@ void GtkSalFrame::createNewWindow( XLIB_Window aNewParent, bool bXEmbed, int nSc } } + // free xrender resources + for( unsigned int i = 0; i < sizeof(m_aGraphics)/sizeof(m_aGraphics[0]); i++ ) + if( m_aGraphics[i].bInUse ) + m_aGraphics[i].pGraphics->SetDrawable( None, m_nScreen ); + // first deinit frame if( m_pIMHandler ) { diff --git a/vcl/unx/inc/salframe.h b/vcl/unx/inc/salframe.h index 848f2250d31c..c640b0398a97 100644 --- a/vcl/unx/inc/salframe.h +++ b/vcl/unx/inc/salframe.h @@ -212,7 +212,7 @@ public: virtual SalGraphics* GetGraphics(); virtual void ReleaseGraphics( SalGraphics* pGraphics ); - virtual void updateGraphics(); + virtual void updateGraphics( Drawable drawable ); virtual BOOL PostEvent( void* pData ); diff --git a/vcl/unx/source/window/salframe.cxx b/vcl/unx/source/window/salframe.cxx index 6219b50d6ec3..37f995838d48 100644 --- a/vcl/unx/source/window/salframe.cxx +++ b/vcl/unx/source/window/salframe.cxx @@ -930,12 +930,12 @@ void X11SalFrame::ReleaseGraphics( SalGraphics *pGraphics ) pGraphics_ = NULL; } -void X11SalFrame::updateGraphics() +void X11SalFrame::updateGraphics( Drawable drawable ) { if( pGraphics_ ) - pGraphics_->SetDrawable( GetWindow(), m_nScreen ); + pGraphics_->SetDrawable( drawable, m_nScreen ); if( pFreeGraphics_ ) - pFreeGraphics_->SetDrawable( GetWindow(), m_nScreen ); + pFreeGraphics_->SetDrawable( drawable, m_nScreen ); } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -2726,6 +2726,7 @@ void X11SalFrame::createNewWindow( XLIB_Window aNewParent, int nScreen ) } // first deinit frame + updateGraphics(None); if( mpInputContext ) { mpInputContext->UnsetICFocus( this ); @@ -2748,7 +2749,7 @@ void X11SalFrame::createNewWindow( XLIB_Window aNewParent, int nScreen ) Init( nStyle_ & ~SAL_FRAME_STYLE_PLUG, nScreen, NULL, true ); // update graphics if necessary - updateGraphics(); + updateGraphics(GetWindow()); if( m_aTitle.Len() ) SetTitle( m_aTitle ); -- cgit From 1ceebe9d381561079e7f7ca916d856224f81064a Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Mon, 30 Nov 2009 16:03:42 +0000 Subject: #i107080# invalidate is needed --- vcl/aqua/source/a11y/documentfocuslistener.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vcl/aqua/source/a11y/documentfocuslistener.cxx b/vcl/aqua/source/a11y/documentfocuslistener.cxx index 2bb1429bc9fe..f20a67a85f29 100644 --- a/vcl/aqua/source/a11y/documentfocuslistener.cxx +++ b/vcl/aqua/source/a11y/documentfocuslistener.cxx @@ -102,12 +102,12 @@ DocumentFocusListener::notifyEvent( const AccessibleEventObject& aEvent ) break; case AccessibleEventId::INVALIDATE_ALL_CHILDREN: -/* { + { Reference< XAccessible > xAccessible( getAccessible(aEvent) ); detachRecursive(xAccessible); attachRecursive(xAccessible); } -*/ + OSL_TRACE( "Invalidate all children called\n" ); break; default: -- cgit From 9612596d539624f9b2550264647732f1043bdbb6 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Mon, 30 Nov 2009 17:15:30 +0000 Subject: #i107248# cleanup updateGraphics --- vcl/unx/inc/plugins/kde/kdedata.hxx | 2 +- vcl/unx/inc/salframe.h | 4 +++- vcl/unx/kde/salnativewidgets-kde.cxx | 5 +++-- vcl/unx/kde4/KDESalFrame.cxx | 5 +++-- vcl/unx/kde4/KDESalFrame.hxx | 2 +- vcl/unx/source/window/salframe.cxx | 11 ++++++----- 6 files changed, 17 insertions(+), 12 deletions(-) diff --git a/vcl/unx/inc/plugins/kde/kdedata.hxx b/vcl/unx/inc/plugins/kde/kdedata.hxx index 831621e38cc1..04730b39fad2 100644 --- a/vcl/unx/inc/plugins/kde/kdedata.hxx +++ b/vcl/unx/inc/plugins/kde/kdedata.hxx @@ -75,7 +75,7 @@ public: virtual SalGraphics* GetGraphics(); virtual void ReleaseGraphics( SalGraphics *pGraphics ); - virtual void updateGraphics(); + virtual void updateGraphics( bool bClear ); virtual void UpdateSettings( AllSettings& rSettings ); virtual void Show( BOOL bVisible, BOOL bNoActivate ); }; diff --git a/vcl/unx/inc/salframe.h b/vcl/unx/inc/salframe.h index c640b0398a97..8dad0350a937 100644 --- a/vcl/unx/inc/salframe.h +++ b/vcl/unx/inc/salframe.h @@ -212,7 +212,9 @@ public: virtual SalGraphics* GetGraphics(); virtual void ReleaseGraphics( SalGraphics* pGraphics ); - virtual void updateGraphics( Drawable drawable ); + // call with true to clear graphics (setting None as drawable) + // call with false to setup graphics with window (GetWindow()) + virtual void updateGraphics( bool bClear ); virtual BOOL PostEvent( void* pData ); diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx index 8046d22d75d3..8e294c0adecc 100644 --- a/vcl/unx/kde/salnativewidgets-kde.cxx +++ b/vcl/unx/kde/salnativewidgets-kde.cxx @@ -2073,12 +2073,13 @@ void KDESalFrame::ReleaseGraphics( SalGraphics *pGraphics ) } } -void KDESalFrame::updateGraphics() +void KDESalFrame::updateGraphics( bool bClear ) { + Drawable aDrawable = bClear ? None : GetWindow(); for( int i = 0; i < nMaxGraphics; i++ ) { if( m_aGraphics[i].bInUse ) - m_aGraphics[i].pGraphics->SetDrawable( GetWindow(), GetScreenNumber() ); + m_aGraphics[i].pGraphics->SetDrawable( aDrawable, GetScreenNumber() ); } } diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx index 202d3dbcd517..6177c4b2896a 100644 --- a/vcl/unx/kde4/KDESalFrame.cxx +++ b/vcl/unx/kde4/KDESalFrame.cxx @@ -363,12 +363,13 @@ void KDESalFrame::ReleaseGraphics( SalGraphics *pGraphics ) } } -void KDESalFrame::updateGraphics() +void KDESalFrame::updateGraphics( bool bClear ) { + Drawable aDrawable = bClear ? None : GetWindow(); for( int i = 0; i < nMaxGraphics; i++ ) { if( m_aGraphics[i].bInUse ) - m_aGraphics[i].pGraphics->SetDrawable( GetWindow(), GetScreenNumber() ); + m_aGraphics[i].pGraphics->SetDrawable( aDrawable, GetScreenNumber() ); } } diff --git a/vcl/unx/kde4/KDESalFrame.hxx b/vcl/unx/kde4/KDESalFrame.hxx index 11a22bd93ba5..de3a5af189ee 100644 --- a/vcl/unx/kde4/KDESalFrame.hxx +++ b/vcl/unx/kde4/KDESalFrame.hxx @@ -52,7 +52,7 @@ class KDESalFrame : public X11SalFrame virtual SalGraphics* GetGraphics(); virtual void ReleaseGraphics( SalGraphics *pGraphics ); - virtual void updateGraphics(); + virtual void updateGraphics( bool bClear ); virtual void UpdateSettings( AllSettings& rSettings ); virtual void Show( BOOL bVisible, BOOL bNoActivate ); }; \ No newline at end of file diff --git a/vcl/unx/source/window/salframe.cxx b/vcl/unx/source/window/salframe.cxx index 37f995838d48..68c99e05da77 100644 --- a/vcl/unx/source/window/salframe.cxx +++ b/vcl/unx/source/window/salframe.cxx @@ -930,12 +930,13 @@ void X11SalFrame::ReleaseGraphics( SalGraphics *pGraphics ) pGraphics_ = NULL; } -void X11SalFrame::updateGraphics( Drawable drawable ) +void X11SalFrame::updateGraphics( bool bClear ) { + Drawable aDrawable = bClear ? None : GetWindow(); if( pGraphics_ ) - pGraphics_->SetDrawable( drawable, m_nScreen ); + pGraphics_->SetDrawable( aDrawable, m_nScreen ); if( pFreeGraphics_ ) - pFreeGraphics_->SetDrawable( drawable, m_nScreen ); + pFreeGraphics_->SetDrawable( aDrawable, m_nScreen ); } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -2726,7 +2727,7 @@ void X11SalFrame::createNewWindow( XLIB_Window aNewParent, int nScreen ) } // first deinit frame - updateGraphics(None); + updateGraphics(true); if( mpInputContext ) { mpInputContext->UnsetICFocus( this ); @@ -2749,7 +2750,7 @@ void X11SalFrame::createNewWindow( XLIB_Window aNewParent, int nScreen ) Init( nStyle_ & ~SAL_FRAME_STYLE_PLUG, nScreen, NULL, true ); // update graphics if necessary - updateGraphics(GetWindow()); + updateGraphics(false); if( m_aTitle.Len() ) SetTitle( m_aTitle ); -- cgit From 91c0dd3c2d8df26e5a826617d2e8e8632b810356 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Wed, 2 Dec 2009 12:48:33 +0100 Subject: correct wrong hg copy --- svl/prj/build.lst | 22 ---------------------- svl/prj/d.lst | 22 ---------------------- 2 files changed, 44 deletions(-) delete mode 100644 svl/prj/build.lst delete mode 100644 svl/prj/d.lst diff --git a/svl/prj/build.lst b/svl/prj/build.lst deleted file mode 100644 index 8dc6d831f850..000000000000 --- a/svl/prj/build.lst +++ /dev/null @@ -1,22 +0,0 @@ -sl svl : l10n offuh ucbhelper unotools cppu cppuhelper comphelper sal sot NULL -sl svl usr1 - all sl_mkout NULL -sl svl\inc nmake - all sl_inc NULL -sl svl\unx\source\svdde nmake - u sl_usdde sl_inc NULL -sl svl\unx\source\svdde nmake - p sl_psdde sl_inc NULL -sl svl\source\config nmake - all sl_conf sl_inc NULL -sl svl\source\filepicker nmake - all sl_filepick sl_inc NULL -sl svl\source\filerec nmake - all sl_file sl_inc NULL -sl svl\source\items nmake - all sl__item sl_inc NULL -sl svl\source\memtools nmake - all sl_mem sl_inc NULL -sl svl\source\misc nmake - all sl__misc sl_inc NULL -sl svl\source\notify nmake - all sl_not sl_inc NULL -sl svl\source\numbers nmake - all sl_num sl_inc NULL -sl svl\source\svdde nmake - all sl__dde sl_inc NULL -sl svl\source\svsql nmake - all sl_sql sl_inc NULL -sl svl\source\undo nmake - all sl_undo sl_inc NULL -sl svl\source\uno nmake - all sl_uno sl_inc NULL -sl svl\util nmake - all sl_util sl_usdde.u sl_psdde.p sl_conf sl_filepick sl_file sl__item sl_mem sl__misc sl_not sl_num sl__dde sl_sql sl_undo sl_uno NULL -sl svl\source\fsstor nmake - all sl_fsstor sl_inc NULL -sl svl\source\passwordcontainer nmake - all sl_passcont sl_inc NULL - - diff --git a/svl/prj/d.lst b/svl/prj/d.lst deleted file mode 100644 index a5c2564e81cd..000000000000 --- a/svl/prj/d.lst +++ /dev/null @@ -1,22 +0,0 @@ -mkdir: %COMMON_DEST%\bin%_EXT%\hid -mkdir: %COMMON_DEST%\res%_EXT% -mkdir: %_DEST%\inc%_EXT%\svl - -..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid -..\%__SRC%\lib\isvl.lib %_DEST%\lib%_EXT%\isvl.lib -..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\* -..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\* -..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\* -..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\* - -..\inc\svl\*.hrc %_DEST%\inc%_EXT%\svl\*.hrc -..\inc\svl\*.hxx %_DEST%\inc%_EXT%\svl\*.hxx -..\inc\svl\*.h %_DEST%\inc%_EXT%\svl\*.h -..\inc\*.hrc %_DEST%\inc%_EXT%\svl\*.hrc -..\inc\*.hxx %_DEST%\inc%_EXT%\svl\*.hxx -..\inc\*.h %_DEST%\inc%_EXT%\svl\*.h - -dos: sh -c "if test %OS% = MACOSX; then macosx-create-bundle %_DEST%\bin%_EXT%\bmp=%__PRJROOT%\%__SRC%\bin%_EXT%; fi" - -*.xml %_DEST%\xml%_EXT%\*.xml - -- cgit From 100882583706d346d20d36f39b534789f62df2a4 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Wed, 2 Dec 2009 12:49:13 +0100 Subject: correct wrong hg copy --- svl/prj/build.lst | 22 ++++++++++++++++++++++ svl/prj/d.lst | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 svl/prj/build.lst create mode 100644 svl/prj/d.lst diff --git a/svl/prj/build.lst b/svl/prj/build.lst new file mode 100644 index 000000000000..8dc6d831f850 --- /dev/null +++ b/svl/prj/build.lst @@ -0,0 +1,22 @@ +sl svl : l10n offuh ucbhelper unotools cppu cppuhelper comphelper sal sot NULL +sl svl usr1 - all sl_mkout NULL +sl svl\inc nmake - all sl_inc NULL +sl svl\unx\source\svdde nmake - u sl_usdde sl_inc NULL +sl svl\unx\source\svdde nmake - p sl_psdde sl_inc NULL +sl svl\source\config nmake - all sl_conf sl_inc NULL +sl svl\source\filepicker nmake - all sl_filepick sl_inc NULL +sl svl\source\filerec nmake - all sl_file sl_inc NULL +sl svl\source\items nmake - all sl__item sl_inc NULL +sl svl\source\memtools nmake - all sl_mem sl_inc NULL +sl svl\source\misc nmake - all sl__misc sl_inc NULL +sl svl\source\notify nmake - all sl_not sl_inc NULL +sl svl\source\numbers nmake - all sl_num sl_inc NULL +sl svl\source\svdde nmake - all sl__dde sl_inc NULL +sl svl\source\svsql nmake - all sl_sql sl_inc NULL +sl svl\source\undo nmake - all sl_undo sl_inc NULL +sl svl\source\uno nmake - all sl_uno sl_inc NULL +sl svl\util nmake - all sl_util sl_usdde.u sl_psdde.p sl_conf sl_filepick sl_file sl__item sl_mem sl__misc sl_not sl_num sl__dde sl_sql sl_undo sl_uno NULL +sl svl\source\fsstor nmake - all sl_fsstor sl_inc NULL +sl svl\source\passwordcontainer nmake - all sl_passcont sl_inc NULL + + diff --git a/svl/prj/d.lst b/svl/prj/d.lst new file mode 100644 index 000000000000..a5c2564e81cd --- /dev/null +++ b/svl/prj/d.lst @@ -0,0 +1,22 @@ +mkdir: %COMMON_DEST%\bin%_EXT%\hid +mkdir: %COMMON_DEST%\res%_EXT% +mkdir: %_DEST%\inc%_EXT%\svl + +..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid +..\%__SRC%\lib\isvl.lib %_DEST%\lib%_EXT%\isvl.lib +..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\* +..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\* +..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\* +..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\* + +..\inc\svl\*.hrc %_DEST%\inc%_EXT%\svl\*.hrc +..\inc\svl\*.hxx %_DEST%\inc%_EXT%\svl\*.hxx +..\inc\svl\*.h %_DEST%\inc%_EXT%\svl\*.h +..\inc\*.hrc %_DEST%\inc%_EXT%\svl\*.hrc +..\inc\*.hxx %_DEST%\inc%_EXT%\svl\*.hxx +..\inc\*.h %_DEST%\inc%_EXT%\svl\*.h + +dos: sh -c "if test %OS% = MACOSX; then macosx-create-bundle %_DEST%\bin%_EXT%\bmp=%__PRJROOT%\%__SRC%\bin%_EXT%; fi" + +*.xml %_DEST%\xml%_EXT%\*.xml + -- cgit From 549fb21f357eaa2cda1a53d4fa84cf87896aed6d Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Thu, 3 Dec 2009 08:26:03 +0100 Subject: more resync fixes --- vcl/source/gdi/makefile.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk index edb4ae49f7de..421505a3d500 100755 --- a/vcl/source/gdi/makefile.mk +++ b/vcl/source/gdi/makefile.mk @@ -65,7 +65,6 @@ EXCEPTIONSFILES= $(SLO)$/salmisc.obj \ $(SLO)$/metric.obj \ $(SLO)$/pdfwriter_impl.obj \ $(SLO)$/pdffontcache.obj\ - $(SLO)$/fontcfg.obj \ $(SLO)$/bmpconv.obj \ $(SLO)$/pdfextoutdevdata.obj \ $(SLO)$/jobset.obj \ -- cgit From 4793d7a82cf3aa5f2714464ceecc69e06efcee60 Mon Sep 17 00:00:00 2001 From: Mikhail Voitenko Date: Thu, 3 Dec 2009 10:20:53 +0000 Subject: #i105172# PL:extend session management --- vcl/inc/vcl/salsession.hxx | 10 +++++++++- vcl/source/app/session.cxx | 26 ++++++++++++++++++++++++++ vcl/unx/source/app/sm.cxx | 6 ++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/vcl/inc/vcl/salsession.hxx b/vcl/inc/vcl/salsession.hxx index 05aa76cb0f56..bdc698fc63fd 100644 --- a/vcl/inc/vcl/salsession.hxx +++ b/vcl/inc/vcl/salsession.hxx @@ -37,7 +37,8 @@ enum SalSessionEventType { Interaction, SaveRequest, - ShutdownCancel + ShutdownCancel, + Quit }; struct SalSessionEvent @@ -78,6 +79,13 @@ struct SalSessionShutdownCancelEvent : public SalSessionEvent {} }; +struct SalSessionQuitEvent : public SalSessionEvent +{ + SalSessionQuitEvent() + : SalSessionEvent( Quit ) + {} +}; + typedef void(*SessionProc)( SalSessionEvent *pEvent); class VCL_DLLPUBLIC SalSession diff --git a/vcl/source/app/session.cxx b/vcl/source/app/session.cxx index ed8e355c2071..e82e93a9ccca 100644 --- a/vcl/source/app/session.cxx +++ b/vcl/source/app/session.cxx @@ -38,6 +38,7 @@ #include #include #include +#include #include @@ -81,6 +82,7 @@ class VCLSession : public cppu::WeakComponentImplHelper1 < XSessionManagerClient void callSaveRequested( bool bShutdown, bool bCancelable ); void callShutdownCancelled(); void callInteractionGranted( bool bGranted ); + void callQuit(); public: VCLSession(); virtual ~VCLSession(); @@ -199,6 +201,27 @@ void VCLSession::callShutdownCancelled() Application::AcquireSolarMutex( nAcquireCount ); } +void VCLSession::callQuit() +{ + std::list< Listener > aListeners; + { + osl::MutexGuard aGuard( m_aMutex ); + // copy listener list since calling a listener may remove it. + aListeners = m_aListeners; + // set back interaction state + m_bInteractionRequested = m_bInteractionDone = m_bInteractionGranted = false; + } + + ULONG nAcquireCount = Application::ReleaseSolarMutex(); + for( std::list< Listener >::const_iterator it = aListeners.begin(); it != aListeners.end(); ++it ) + { + Reference< XSessionManagerListener2 > xListener2( it->m_xListener, UNO_QUERY ); + if( xListener2.is() ) + xListener2->doQuit(); + } + Application::AcquireSolarMutex( nAcquireCount ); +} + void VCLSession::SalSessionEventProc( SalSessionEvent* pEvent ) { switch( pEvent->m_eType ) @@ -218,6 +241,9 @@ void VCLSession::SalSessionEventProc( SalSessionEvent* pEvent ) case ShutdownCancel: pOneInstance->callShutdownCancelled(); break; + case Quit: + pOneInstance->callQuit(); + break; } } diff --git a/vcl/unx/source/app/sm.cxx b/vcl/unx/source/app/sm.cxx index 75722ec89de3..c5605cec1dfb 100644 --- a/vcl/unx/source/app/sm.cxx +++ b/vcl/unx/source/app/sm.cxx @@ -369,6 +369,12 @@ void SessionManagerClient::SaveYourselfProc( IMPL_STATIC_LINK_NOINSTANCE( SessionManagerClient, ShutDownHdl, void*, EMPTYARG ) { + if( pOneInstance ) + { + SalSessionQuitEvent aEvent; + pOneInstance->CallCallback( &aEvent ); + } + const std::list< SalFrame* >& rFrames = GetX11SalData()->GetDisplay()->getFrames(); SMprintf( rFrames.begin() != rFrames.end() ? "shutdown on first frame\n" : "shutdown event but no frame\n" ); if( rFrames.begin() != rFrames.end() ) -- cgit From 231200087c468fb036324d27784c9b3379b8bdfe Mon Sep 17 00:00:00 2001 From: Andreas Bregas Date: Thu, 3 Dec 2009 17:21:16 +0000 Subject: #i107283# Pass config help path as argument to compileExtensionHelp() --- transex3/source/help/HelpLinker.cxx | 64 ++++++++++++++++++++---------------- transex3/source/help/compilehelp.hxx | 1 + 2 files changed, 37 insertions(+), 28 deletions(-) diff --git a/transex3/source/help/HelpLinker.cxx b/transex3/source/help/HelpLinker.cxx index 19b9ead8521e..d2bf955069f7 100644 --- a/transex3/source/help/HelpLinker.cxx +++ b/transex3/source/help/HelpLinker.cxx @@ -118,35 +118,41 @@ void IndexerPreProcessor::processDocument { std::string aStdStr_EncodedDocPathURL = getEncodedPath( EncodedDocPath ); - xmlDocPtr resCaption = xsltApplyStylesheet( m_xsltStylesheetPtrCaption, doc, NULL ); - xmlNodePtr pResNodeCaption = resCaption->xmlChildrenNode; - if( pResNodeCaption ) + if( m_xsltStylesheetPtrCaption ) { - fs::path fsCaptionPureTextFile_docURL = m_fsCaptionFilesDirName / aStdStr_EncodedDocPathURL; - std::string aCaptionPureTextFileStr_docURL = fsCaptionPureTextFile_docURL.native_file_string(); - FILE* pFile_docURL = fopen( aCaptionPureTextFileStr_docURL.c_str(), "w" ); - if( pFile_docURL ) + xmlDocPtr resCaption = xsltApplyStylesheet( m_xsltStylesheetPtrCaption, doc, NULL ); + xmlNodePtr pResNodeCaption = resCaption->xmlChildrenNode; + if( pResNodeCaption ) { - fprintf( pFile_docURL, "%s\n", pResNodeCaption->content ); - fclose( pFile_docURL ); + fs::path fsCaptionPureTextFile_docURL = m_fsCaptionFilesDirName / aStdStr_EncodedDocPathURL; + std::string aCaptionPureTextFileStr_docURL = fsCaptionPureTextFile_docURL.native_file_string(); + FILE* pFile_docURL = fopen( aCaptionPureTextFileStr_docURL.c_str(), "w" ); + if( pFile_docURL ) + { + fprintf( pFile_docURL, "%s\n", pResNodeCaption->content ); + fclose( pFile_docURL ); + } } + xmlFreeDoc(resCaption); } - xmlFreeDoc(resCaption); - xmlDocPtr resContent = xsltApplyStylesheet( m_xsltStylesheetPtrContent, doc, NULL ); - xmlNodePtr pResNodeContent = resContent->xmlChildrenNode; - if( pResNodeContent ) + if( m_xsltStylesheetPtrContent ) { - fs::path fsContentPureTextFile_docURL = m_fsContentFilesDirName / aStdStr_EncodedDocPathURL; - std::string aContentPureTextFileStr_docURL = fsContentPureTextFile_docURL.native_file_string(); - FILE* pFile_docURL = fopen( aContentPureTextFileStr_docURL.c_str(), "w" ); - if( pFile_docURL ) + xmlDocPtr resContent = xsltApplyStylesheet( m_xsltStylesheetPtrContent, doc, NULL ); + xmlNodePtr pResNodeContent = resContent->xmlChildrenNode; + if( pResNodeContent ) { - fprintf( pFile_docURL, "%s\n", pResNodeContent->content ); - fclose( pFile_docURL ); + fs::path fsContentPureTextFile_docURL = m_fsContentFilesDirName / aStdStr_EncodedDocPathURL; + std::string aContentPureTextFileStr_docURL = fsContentPureTextFile_docURL.native_file_string(); + FILE* pFile_docURL = fopen( aContentPureTextFileStr_docURL.c_str(), "w" ); + if( pFile_docURL ) + { + fprintf( pFile_docURL, "%s\n", pResNodeContent->content ); + fclose( pFile_docURL ); + } } + xmlFreeDoc(resContent); } - xmlFreeDoc(resContent); } struct Data @@ -245,8 +251,9 @@ public: class HelpLinker { public: - void main(std::vector &args, std::string* pExtensionPath = NULL ) - throw( HelpProcessingException ); + void main(std::vector &args, + std::string* pExtensionPath = NULL, const rtl::OUString* pOfficeHelpPath = NULL ) + throw( HelpProcessingException ); HelpLinker() : init(true) @@ -751,21 +758,21 @@ void HelpLinker::link() throw( HelpProcessingException ) } -void HelpLinker::main(std::vector &args, std::string* pExtensionPath) - throw( HelpProcessingException ) +void HelpLinker::main( std::vector &args, + std::string* pExtensionPath, const rtl::OUString* pOfficeHelpPath ) + throw( HelpProcessingException ) { rtl::OUString aOfficeHelpPath; bExtensionMode = false; - if( pExtensionPath && pExtensionPath->length() > 0 ) + if( pExtensionPath && pExtensionPath->length() > 0 && pOfficeHelpPath ) { helpFiles.clear(); bExtensionMode = true; extensionPath = *pExtensionPath; sourceRoot = fs::path(extensionPath); - aOfficeHelpPath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("$OOO_BASE_DIR/help") ); - rtl::Bootstrap::expandMacros( aOfficeHelpPath ); + aOfficeHelpPath = *pOfficeHelpPath; } if (args.size() > 0 && args[0][0] == '@') { @@ -1065,6 +1072,7 @@ HelpProcessingErrorInfo& HelpProcessingErrorInfo::operator=( const struct HelpPr // Returns true in case of success, false in case of error HELPLINKER_DLLPUBLIC bool compileExtensionHelp ( + const rtl::OUString& aOfficeHelpPath, const rtl::OUString& aExtensionName, const rtl::OUString& aExtensionLanguageRoot, sal_Int32 nXhpFileCount, const rtl::OUString* pXhpFiles, @@ -1107,7 +1115,7 @@ HELPLINKER_DLLPUBLIC bool compileExtensionHelp try { HelpLinker* pHelpLinker = new HelpLinker(); - pHelpLinker->main( args,&aStdStrExtensionPath ); + pHelpLinker->main( args, &aStdStrExtensionPath, &aOfficeHelpPath ); delete pHelpLinker; } catch( const HelpProcessingException& e ) diff --git a/transex3/source/help/compilehelp.hxx b/transex3/source/help/compilehelp.hxx index 1e9a1c8604b8..d123d628be27 100644 --- a/transex3/source/help/compilehelp.hxx +++ b/transex3/source/help/compilehelp.hxx @@ -71,6 +71,7 @@ struct HelpProcessingErrorInfo // Returns true in case of success, false in case of error HELPLINKER_DLLPUBLIC bool compileExtensionHelp ( + const rtl::OUString& aOfficeHelpPath, const rtl::OUString& aExtensionName, const rtl::OUString& aExtensionLanguageRoot, sal_Int32 nXhpFileCount, const rtl::OUString* pXhpFiles, -- cgit From f7b51af1397309b611c3f98f26bdbfed0271095e Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Fri, 4 Dec 2009 14:24:57 +0000 Subject: #i106833# fix subset font encoding --- vcl/unx/source/printergfx/glyphset.cxx | 38 +++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/vcl/unx/source/printergfx/glyphset.cxx b/vcl/unx/source/printergfx/glyphset.cxx index 156517d98220..5adff6683267 100644 --- a/vcl/unx/source/printergfx/glyphset.cxx +++ b/vcl/unx/source/printergfx/glyphset.cxx @@ -46,6 +46,7 @@ #include #include +#include using namespace vcl; using namespace psp; @@ -785,6 +786,17 @@ GlyphSet::PSUploadEncoding(osl::File* pOutFile, PrinterGfx &rGfx) return sal_True; } +struct EncEntry +{ + sal_uChar aEnc; + long aGID; + + EncEntry() : aEnc( 0 ), aGID( 0 ) {} + + bool operator<( const EncEntry& rRight ) const + { return aEnc < rRight.aEnc; } +}; + static void CreatePSUploadableFont( TrueTypeFont* pSrcFont, FILE* pTmpFile, const char* pGlyphSetName, int nGlyphCount, /*const*/ sal_uInt16* pRequestedGlyphs, /*const*/ sal_uChar* pEncoding, @@ -796,17 +808,29 @@ static void CreatePSUploadableFont( TrueTypeFont* pSrcFont, FILE* pTmpFile, if( bAllowType42 ) nTargetMask |= FontSubsetInfo::TYPE42_FONT; + std::vector< EncEntry > aSorted( nGlyphCount, EncEntry() ); + for( int i = 0; i < nGlyphCount; i++ ) + { + aSorted[i].aEnc = pEncoding[i]; + aSorted[i].aGID = pRequestedGlyphs[i]; + } + + std::stable_sort( aSorted.begin(), aSorted.end() ); + + std::vector< sal_uChar > aEncoding( nGlyphCount ); + std::vector< long > aRequestedGlyphs( nGlyphCount ); + + for( int i = 0; i < nGlyphCount; i++ ) + { + aEncoding[i] = aSorted[i].aEnc; + aRequestedGlyphs[i] = aSorted[i].aGID; + } + FontSubsetInfo aInfo; aInfo.LoadFont( pSrcFont ); -#if 1 // TODO: remove 16bit->long conversion when input args has been changed - long aRequestedGlyphs[256]; - for( int i = 0; i < nGlyphCount; ++i ) - aRequestedGlyphs[i] = pRequestedGlyphs[i]; -#endif - aInfo.CreateFontSubset( nTargetMask, pTmpFile, pGlyphSetName, - aRequestedGlyphs, pEncoding, nGlyphCount, NULL ); + &aRequestedGlyphs[0], &aEncoding[0], nGlyphCount, NULL ); } sal_Bool -- cgit From 97116f6e7af5bef7a6390b530a323c50d8920f75 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Fri, 4 Dec 2009 14:28:51 +0000 Subject: #i107358# fix uninitialized value (thanks cmc) --- vcl/source/gdi/pdfwriter_impl.hxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index 7d5ec2bf4f61..29de6d4f5971 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -679,6 +679,7 @@ private: m_aOverlineColor( COL_TRANSPARENT ), m_nAntiAlias( 1 ), m_nLayoutMode( 0 ), + m_aDigitLanguage( 0 ), m_nTransparentPercent( 0 ), m_nFlags( 0xffff ), m_nUpdateFlags( 0xffff ) @@ -693,6 +694,7 @@ private: m_aClipRegion( rState.m_aClipRegion ), m_nAntiAlias( rState.m_nAntiAlias ), m_nLayoutMode( rState.m_nLayoutMode ), + m_aDigitLanguage( rState.m_aDigitLanguage ), m_nTransparentPercent( rState.m_nTransparentPercent ), m_nFlags( rState.m_nFlags ), m_nUpdateFlags( rState.m_nUpdateFlags ) @@ -710,6 +712,7 @@ private: m_aClipRegion = rState.m_aClipRegion; m_nAntiAlias = rState.m_nAntiAlias; m_nLayoutMode = rState.m_nLayoutMode; + m_aDigitLanguage = rState.m_aDigitLanguage; m_nTransparentPercent = rState.m_nTransparentPercent; m_nFlags = rState.m_nFlags; m_nUpdateFlags = rState.m_nUpdateFlags; -- cgit From 92b464823c7c74afbf09023534878cbb38213a49 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Mon, 7 Dec 2009 13:19:39 +0000 Subject: #i106367#: typo again --- i18npool/source/isolang/mslangid.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/i18npool/source/isolang/mslangid.cxx b/i18npool/source/isolang/mslangid.cxx index 1e58db4e2c0b..aab92d717429 100644 --- a/i18npool/source/isolang/mslangid.cxx +++ b/i18npool/source/isolang/mslangid.cxx @@ -154,13 +154,13 @@ LanguageType MsLangId::resolveSystemLanguageByScriptType( LanguageType nLang, sa if (nConfiguredAsianFallback == LANGUAGE_SYSTEM) nLang = LANGUAGE_CHINESE_SIMPLIFIED; else - nLang = nConfiguredComplexFallback; + nLang = nConfiguredAsianFallback; break; case ::com::sun::star::i18n::ScriptType::COMPLEX: if (nConfiguredComplexFallback == LANGUAGE_SYSTEM) nLang = LANGUAGE_HINDI; else - nLang = nConfiguredAsianFallback; + nLang = nConfiguredComplexFallback; break; default: if (nConfiguredWesternFallback == LANGUAGE_SYSTEM) -- cgit From f8ada8f2a93659e27928f3b5244c813de2c3847b Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Mon, 7 Dec 2009 17:37:18 +0100 Subject: masterfix: #i10000# type fixed --- transex3/source/treeconfig.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/transex3/source/treeconfig.cxx b/transex3/source/treeconfig.cxx index d9e3b829982b..137492c39a50 100644 --- a/transex3/source/treeconfig.cxx +++ b/transex3/source/treeconfig.cxx @@ -54,10 +54,10 @@ bool Treeconfig::getActiveRepositories( vector& active_repos ){ string partial; // if we are inside of a repository root then active it otherwise let the app handle the return! - unsigned int pos = pwd.find_first_of( source_root ); + string::size_type pos = pwd.find_first_of( source_root ); if( pos != string::npos && ( pos + source_root.length() +1 ) < pwd.length()){ // I am within SOURCE_ROOT_DIR partial = pwd.substr( pos + source_root.length() +1 , pwd.length()); - unsigned int nextPart = partial.find_first_of( "/" ); + string::size_type nextPart = partial.find_first_of( "/" ); if( nextPart != string::npos ) hasPath = true; else -- cgit From cee9bce554887502b98ae64fc38592069d651b8e Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Mon, 7 Dec 2009 17:43:56 +0100 Subject: some fixes after resync --- svtools/source/uno/makefile.mk | 2 +- vcl/inc/vcl/svdata.hxx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/svtools/source/uno/makefile.mk b/svtools/source/uno/makefile.mk index 7b992637e152..82e509f1ce08 100644 --- a/svtools/source/uno/makefile.mk +++ b/svtools/source/uno/makefile.mk @@ -58,7 +58,7 @@ SLOFILES= \ $(SLO)$/unocontroltablemodel.obj \ $(SLO)$/unoevent.obj \ $(SLO)$/unoiface.obj \ - $(SLO)$/unoimap.obj \ + $(SLO)$/unoimap.obj \ $(SLO)$/svtxgridcontrol.obj # --- Targets ------------------------------------------------------ diff --git a/vcl/inc/vcl/svdata.hxx b/vcl/inc/vcl/svdata.hxx index d912c172baa5..17ad1aa28c1a 100644 --- a/vcl/inc/vcl/svdata.hxx +++ b/vcl/inc/vcl/svdata.hxx @@ -138,6 +138,7 @@ struct ImplSVAppData ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF; String* mpMSFTempFileName; + AllSettings* mpSettings; // Application settings LocaleConfigurationListener* mpCfgListener; VclEventListeners* mpEventListeners; // listeners for vcl events (eg, extended toolkit) VclEventListeners* mpKeyListeners; // listeners for key events only (eg, extended toolkit) -- cgit From d0b307e10caaa858d1ef91bd98240da9bba0a78c Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Tue, 8 Dec 2009 18:21:07 +0000 Subject: #i107529# change fallback mechanism --- vcl/unx/source/plugadapt/salplug.cxx | 58 +++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/vcl/unx/source/plugadapt/salplug.cxx b/vcl/unx/source/plugadapt/salplug.cxx index 14de25b13e4d..f1c63b8abee7 100644 --- a/vcl/unx/source/plugadapt/salplug.cxx +++ b/vcl/unx/source/plugadapt/salplug.cxx @@ -149,34 +149,53 @@ static const rtl::OUString& get_desktop_environment() return aRet; } -static const char* autodetect_plugin() +static SalInstance* autodetect_plugin() { + static const char* pKDEFallbackList[] = + { + "kde4", "kde", "gtk", "gen", 0 + }; + + static const char* pStandardFallbackList[] = + { + "gtk", "gen", 0 + }; + + static const char* pHeadlessFallbackList[] = + { + "svp", 0 + }; + const rtl::OUString& desktop( get_desktop_environment() ); - const char * pRet = "gen"; + const char ** pList = pStandardFallbackList; + int nListEntry = 0; // no server at all: dummy plugin if ( desktop.equalsAscii( desktop_strings[DESKTOP_NONE] ) ) - pRet = "svp"; + pList = pHeadlessFallbackList; else if ( desktop.equalsAscii( desktop_strings[DESKTOP_GNOME] ) ) - pRet = "gtk"; + pList = pStandardFallbackList; else if( desktop.equalsAscii( desktop_strings[DESKTOP_KDE] ) ) - pRet = "kde"; - else if( desktop.equalsAscii( desktop_strings[DESKTOP_KDE4] ) ) - pRet = "kde4"; - else { - // #i95296# use the much nicer looking gtk plugin - // on desktops that set gtk variables (e.g. XFCE) - static const char* pEnv = getenv( "GTK2_RC_FILES" ); - if( pEnv && *pEnv ) // check for existance and non emptiness - pRet = "gtk"; + pList = pKDEFallbackList; + nListEntry = 1; } + else if( desktop.equalsAscii( desktop_strings[DESKTOP_KDE4] ) ) + pList = pKDEFallbackList; -#if OSL_DEBUG_LEVEL > 1 - std::fprintf( stderr, "plugin autodetection: %s\n", pRet ); -#endif + SalInstance* pInst = NULL; + while( pList[nListEntry] && pInst == NULL ) + { + rtl::OUString aTry( rtl::OUString::createFromAscii( pList[nListEntry] ) ); + pInst = tryInstance( aTry ); + #if OSL_DEBUG_LEVEL > 1 + if( pInst ) + std::fprintf( stderr, "plugin autodetection: %s\n", pList[nListEntry] ); + #endif + nListEntry++; + } - return pRet; + return pInst; } static SalInstance* check_headless_plugin() @@ -202,10 +221,7 @@ SalInstance *CreateSalInstance() pInst = check_headless_plugin(); if( ! pInst && !(pUsePlugin && *pUsePlugin) ) - pUsePlugin = autodetect_plugin(); - - if( ! pInst && pUsePlugin && *pUsePlugin ) - pInst = tryInstance( OUString::createFromAscii( pUsePlugin ) ); + pInst = autodetect_plugin(); // fallback to gen if( ! pInst ) -- cgit From aef89426cd30ec9d6066b4e50f8d0e2a692c8c9b Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Tue, 8 Dec 2009 22:53:47 +0100 Subject: another resolved merge conflict --- svtools/prj/d.lst | 306 ------------------------------------------------------ 1 file changed, 306 deletions(-) diff --git a/svtools/prj/d.lst b/svtools/prj/d.lst index 924459d9c9f0..0a3ccd8a9819 100644 --- a/svtools/prj/d.lst +++ b/svtools/prj/d.lst @@ -22,318 +22,12 @@ mkdir: %_DEST%\inc%_EXT%\svtools ..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\* ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\* -<<<<<<< local ..\inc\svtools\*.hxx %_DEST%\inc%_EXT%\svtools\*.hxx ..\inc\svtools\*.h %_DEST%\inc%_EXT%\svtools\*.h ..\inc\svtools\*.hrc %_DEST%\inc%_EXT%\svtools\*.hrc ..\inc\*.hxx %_DEST%\inc%_EXT%\svtools\*.hxx ..\inc\*.h %_DEST%\inc%_EXT%\svtools\*.h ..\inc\*.hrc %_DEST%\inc%_EXT%\svtools\*.hrc -======= -..\inc\svtools\svldllapi.h %_DEST%\inc%_EXT%\svtools\svldllapi.h -..\inc\svtools\svtdllapi.h %_DEST%\inc%_EXT%\svtools\svtdllapi.h - -..\inc\svtools\globalnameitem.hxx %_DEST%\inc%_EXT%\svtools\globalnameitem.hxx -..\inc\imagemgr.hxx %_DEST%\inc%_EXT%\svtools\imagemgr.hxx -..\inc\imagemgr.hrc %_DEST%\inc%_EXT%\svtools\imagemgr.hrc -..\inc\testtool.hxx %_DEST%\inc%_EXT%\svtools\testtool.hxx -..\inc\flbytes.hxx %_DEST%\inc%_EXT%\svtools\flbytes.hxx -..\inc\adrparse.hxx %_DEST%\inc%_EXT%\svtools\adrparse.hxx -..\inc\svtools\aeitem.hxx %_DEST%\inc%_EXT%\svtools\aeitem.hxx -..\inc\svtools\brdcst.hxx %_DEST%\inc%_EXT%\svtools\brdcst.hxx -..\inc\broadcast.hxx %_DEST%\inc%_EXT%\svtools\broadcast.hxx -..\inc\svtools\brwbox.hxx %_DEST%\inc%_EXT%\svtools\brwbox.hxx -..\inc\calendar.hxx %_DEST%\inc%_EXT%\svtools\calendar.hxx -..\inc\svtools\cancel.hxx %_DEST%\inc%_EXT%\svtools\cancel.hxx -..\inc\cntnrsrt.hxx %_DEST%\inc%_EXT%\svtools\cntnrsrt.hxx -..\inc\svtools\colrdlg.hxx %_DEST%\inc%_EXT%\svtools\colrdlg.hxx -..\inc\svtools\colctrl.hxx %_DEST%\inc%_EXT%\svtools\colctrl.hxx -..\inc\ctrlbox.hxx %_DEST%\inc%_EXT%\svtools\ctrlbox.hxx -..\inc\ctrltool.hxx %_DEST%\inc%_EXT%\svtools\ctrltool.hxx -..\inc\collatorres.hxx %_DEST%\inc%_EXT%\svtools\collatorres.hxx -..\inc\indexentryres.hxx %_DEST%\inc%_EXT%\svtools\indexentryres.hxx -..\inc\cntwids.hrc %_DEST%\inc%_EXT%\svtools\cntwids.hrc -..\inc\svtools\dateitem.hxx %_DEST%\inc%_EXT%\svtools\dateitem.hxx -..\inc\svtools\dtritem.hxx %_DEST%\inc%_EXT%\svtools\dtritem.hxx -..\inc\svtools\frqitem.hxx %_DEST%\inc%_EXT%\svtools\frqitem.hxx -..\inc\svtools\cstitem.hxx %_DEST%\inc%_EXT%\svtools\cstitem.hxx -..\inc\svtools\tfrmitem.hxx %_DEST%\inc%_EXT%\svtools\tfrmitem.hxx -..\inc\svtools\cntwall.hxx %_DEST%\inc%_EXT%\svtools\cntwall.hxx -..\inc\svtools\langtab.hxx %_DEST%\inc%_EXT%\svtools\langtab.hxx -..\inc\itemdel.hxx %_DEST%\inc%_EXT%\svtools\itemdel.hxx -..\inc\wallitem.hxx %_DEST%\inc%_EXT%\svtools\wallitem.hxx -..\inc\svtools\sfontitm.hxx %_DEST%\inc%_EXT%\svtools\sfontitm.hxx -..\inc\svtools\bintitem.hxx %_DEST%\inc%_EXT%\svtools\bintitem.hxx -..\inc\stylepool.hxx %_DEST%\inc%_EXT%\svtools\stylepool.hxx -..\inc\dialogcontrolling.hxx %_DEST%\inc%_EXT%\svtools\dialogcontrolling.hxx -..\inc\svtools\eitem.hxx %_DEST%\inc%_EXT%\svtools\eitem.hxx -..\inc\eventcfg.hxx %_DEST%\inc%_EXT%\svtools\eventcfg.hxx -..\inc\filedlg.hxx %_DEST%\inc%_EXT%\svtools\filedlg.hxx -..\inc\svtools\filerec.hxx %_DEST%\inc%_EXT%\svtools\filerec.hxx -..\inc\svtools\flagitem.hxx %_DEST%\inc%_EXT%\svtools\flagitem.hxx -..\inc\svtools\fltcall.hxx %_DEST%\inc%_EXT%\svtools\fltcall.hxx -..\inc\svtools\wmf.hxx %_DEST%\inc%_EXT%\svtools\wmf.hxx -..\inc\fltdefs.hxx %_DEST%\inc%_EXT%\svtools\fltdefs.hxx -..\inc\svtools\filter.hxx %_DEST%\inc%_EXT%\svtools\filter.hxx -..\inc\svtools\FilterConfigItem.hxx %_DEST%\inc%_EXT%\svtools\FilterConfigItem.hxx -..\inc\svtools\fmtfield.hxx %_DEST%\inc%_EXT%\svtools\fmtfield.hxx -..\inc\svtools\hint.hxx %_DEST%\inc%_EXT%\svtools\hint.hxx -..\inc\svtools\accessibletableprovider.hxx %_DEST%\inc%_EXT%\svtools\accessibletableprovider.hxx -..\inc\svtools\AccessibleBrowseBoxObjType.hxx %_DEST%\inc%_EXT%\svtools\AccessibleBrowseBoxObjType.hxx -..\inc\svtools\accessiblefactory.hxx %_DEST%\inc%_EXT%\svtools\accessiblefactory.hxx -..\inc\svtools\accessibletable.hxx %_DEST%\inc%_EXT%\svtools\accessibletable.hxx -..\inc\svtools\textwindowpeer.hxx %_DEST%\inc%_EXT%\svtools\textwindowpeer.hxx -..\inc\imgdef.hxx %_DEST%\inc%_EXT%\svtools\imgdef.hxx -..\inc\inetdef.hxx %_DEST%\inc%_EXT%\svtools\inetdef.hxx -..\inc\svtools\inethist.hxx %_DEST%\inc%_EXT%\svtools\inethist.hxx -..\inc\inetmsg.hxx %_DEST%\inc%_EXT%\svtools\inetmsg.hxx -..\inc\inetstrm.hxx %_DEST%\inc%_EXT%\svtools\inetstrm.hxx -..\inc\svtools\intitem.hxx %_DEST%\inc%_EXT%\svtools\intitem.hxx -..\inc\svtools\visitem.hxx %_DEST%\inc%_EXT%\svtools\visitem.hxx -..\inc\svtools\imageitm.hxx %_DEST%\inc%_EXT%\svtools\imageitm.hxx -..\inc\svtools\isethint.hxx %_DEST%\inc%_EXT%\svtools\isethint.hxx -..\inc\svtools\itemiter.hxx %_DEST%\inc%_EXT%\svtools\itemiter.hxx -..\inc\svtools\itempool.hxx %_DEST%\inc%_EXT%\svtools\itempool.hxx -..\inc\svtools\itemset.hxx %_DEST%\inc%_EXT%\svtools\itemset.hxx -..\inc\svtools\lckbitem.hxx %_DEST%\inc%_EXT%\svtools\lckbitem.hxx -..\inc\listener.hxx %_DEST%\inc%_EXT%\svtools\listener.hxx -..\inc\listeneriter.hxx %_DEST%\inc%_EXT%\svtools\listeneriter.hxx -..\inc\svtools\lstner.hxx %_DEST%\inc%_EXT%\svtools\lstner.hxx -..\inc\svtools\macitem.hxx %_DEST%\inc%_EXT%\svtools\macitem.hxx -..\inc\memberid.hrc %_DEST%\inc%_EXT%\svtools\memberid.hrc -..\inc\svtools\nranges.hxx %_DEST%\inc%_EXT%\svtools\nranges.hxx -..\inc\svtools\ownlist.hxx %_DEST%\inc%_EXT%\svtools\ownlist.hxx -..\inc\prgsbar.hxx %_DEST%\inc%_EXT%\svtools\prgsbar.hxx -..\inc\svtools\prnsetup.hxx %_DEST%\inc%_EXT%\svtools\prnsetup.hxx -..\inc\poolcach.hxx %_DEST%\inc%_EXT%\svtools\poolcach.hxx -..\inc\svtools\poolitem.hxx %_DEST%\inc%_EXT%\svtools\poolitem.hxx -..\inc\svtools\printdlg.hxx %_DEST%\inc%_EXT%\svtools\printdlg.hxx -..\inc\svtools\ptitem.hxx %_DEST%\inc%_EXT%\svtools\ptitem.hxx -..\inc\svtools\szitem.hxx %_DEST%\inc%_EXT%\svtools\szitem.hxx -..\inc\svtools\rectitem.hxx %_DEST%\inc%_EXT%\svtools\rectitem.hxx -..\inc\svtools\rngitem.hxx %_DEST%\inc%_EXT%\svtools\rngitem.hxx -..\inc\ruler.hxx %_DEST%\inc%_EXT%\svtools\ruler.hxx -..\inc\scrwin.hxx %_DEST%\inc%_EXT%\svtools\scrwin.hxx -..\inc\svtools\sharecontrolfile.hxx %_DEST%\inc%_EXT%\svtools\sharecontrolfile.hxx -..\inc\svtools\documentlockfile.hxx %_DEST%\inc%_EXT%\svtools\documentlockfile.hxx -..\inc\svtools\lockfilecommon.hxx %_DEST%\inc%_EXT%\svtools\lockfilecommon.hxx -..\inc\svtools\slstitm.hxx %_DEST%\inc%_EXT%\svtools\slstitm.hxx -..\inc\svtools\ilstitem.hxx %_DEST%\inc%_EXT%\svtools\ilstitem.hxx -..\inc\svtools\smplhint.hxx %_DEST%\inc%_EXT%\svtools\smplhint.hxx -..\inc\svtools\cnclhint.hxx %_DEST%\inc%_EXT%\svtools\cnclhint.hxx -..\inc\svtools\inettype.hxx %_DEST%\inc%_EXT%\svtools\inettype.hxx -..\inc\svtools\brwhead.hxx %_DEST%\inc%_EXT%\svtools\brwhead.hxx -..\inc\svtools\solar.hrc %_DEST%\inc%_EXT%\svtools\solar.hrc -..\inc\scriptedtext.hxx %_DEST%\inc%_EXT%\svtools\scriptedtext.hxx -..\inc\svtools\stdctrl.hxx %_DEST%\inc%_EXT%\svtools\stdctrl.hxx -..\inc\svtools\stritem.hxx %_DEST%\inc%_EXT%\svtools\stritem.hxx -..\inc\svtools\style.hrc %_DEST%\inc%_EXT%\svtools\style.hrc -..\inc\svtools\style.hxx %_DEST%\inc%_EXT%\svtools\style.hxx -..\inc\svtools\svarray.hxx %_DEST%\inc%_EXT%\svtools\svarray.hxx -..\inc\svtools\svdde.hxx %_DEST%\inc%_EXT%\svtools\svdde.hxx -..\inc\svtools\svtdata.hxx %_DEST%\inc%_EXT%\svtools\svtdata.hxx -..\inc\tabbar.hxx %_DEST%\inc%_EXT%\svtools\tabbar.hxx -..\inc\taskbar.hxx %_DEST%\inc%_EXT%\svtools\taskbar.hxx -..\inc\svtools\undo.hxx %_DEST%\inc%_EXT%\svtools\undo.hxx -..\inc\whiter.hxx %_DEST%\inc%_EXT%\svtools\whiter.hxx -..\inc\svtools\valueset.hxx %_DEST%\inc%_EXT%\svtools\valueset.hxx -..\inc\stdmenu.hxx %_DEST%\inc%_EXT%\svtools\stdmenu.hxx -..\inc\svtools\headbar.hxx %_DEST%\inc%_EXT%\svtools\headbar.hxx -..\inc\svtools\svicnvw.hxx %_DEST%\inc%_EXT%\svtools\svicnvw.hxx -..\inc\svtools\svlbitm.hxx %_DEST%\inc%_EXT%\svtools\svlbitm.hxx -..\inc\svtools\svlbox.hxx %_DEST%\inc%_EXT%\svtools\svlbox.hxx -..\inc\svtools\svtabbx.hxx %_DEST%\inc%_EXT%\svtools\svtabbx.hxx -..\inc\svtools\svtreebx.hxx %_DEST%\inc%_EXT%\svtools\svtreebx.hxx -..\inc\tooltiplbox.hxx %_DEST%\inc%_EXT%\svtools\tooltiplbox.hxx -..\inc\svtools\treelist.hxx %_DEST%\inc%_EXT%\svtools\treelist.hxx -..\inc\svtools\xtextedt.hxx %_DEST%\inc%_EXT%\svtools\xtextedt.hxx -..\inc\svtools\texteng.hxx %_DEST%\inc%_EXT%\svtools\texteng.hxx -..\inc\svtools\textview.hxx %_DEST%\inc%_EXT%\svtools\textview.hxx -..\inc\svtools\textdata.hxx %_DEST%\inc%_EXT%\svtools\textdata.hxx -..\inc\txtattr.hxx %_DEST%\inc%_EXT%\svtools\txtattr.hxx -..\inc\sychconv.hxx %_DEST%\inc%_EXT%\svtools\sychconv.hxx -..\inc\svtools\ttprops.hxx %_DEST%\inc%_EXT%\svtools\ttprops.hxx -..\inc\svtools\transfer.hxx %_DEST%\inc%_EXT%\svtools\transfer.hxx -..\inc\svtools\embedtransfer.hxx %_DEST%\inc%_EXT%\svtools\embedtransfer.hxx -..\inc\svtools\embedhlp.hxx %_DEST%\inc%_EXT%\svtools\embedhlp.hxx -..\inc\cliplistener.hxx %_DEST%\inc%_EXT%\svtools\cliplistener.hxx -..\inc\txtcmp.hxx %_DEST%\inc%_EXT%\svtools\txtcmp.hxx -..\inc\urlbmk.hxx %_DEST%\inc%_EXT%\svtools\urlbmk.hxx -..\inc\inetimg.hxx %_DEST%\inc%_EXT%\svtools\inetimg.hxx -..\inc\svtools\svmedit.hxx %_DEST%\inc%_EXT%\svtools\svmedit.hxx -..\inc\svtools\editsyntaxhighlighter.hxx %_DEST%\inc%_EXT%\svtools\editsyntaxhighlighter.hxx -..\inc\svtools\syntaxhighlight.hxx %_DEST%\inc%_EXT%\svtools\syntaxhighlight.hxx -..\inc\svtools\svmedit2.hxx %_DEST%\inc%_EXT%\svtools\svmedit2.hxx -..\inc\svtools\svstdarr.hxx %_DEST%\inc%_EXT%\svtools\svstdarr.hxx -..\inc\svtools\metitem.hxx %_DEST%\inc%_EXT%\svtools\metitem.hxx -..\inc\svtools\nfversi.hxx %_DEST%\inc%_EXT%\svtools\nfversi.hxx -..\inc\svtools\nfkeytab.hxx %_DEST%\inc%_EXT%\svtools\nfkeytab.hxx -..\inc\nfsymbol.hxx %_DEST%\inc%_EXT%\svtools\nfsymbol.hxx -..\inc\svtools\wizdlg.hxx %_DEST%\inc%_EXT%\svtools\wizdlg.hxx -..\inc\svtools\zforlist.hxx %_DEST%\inc%_EXT%\svtools\zforlist.hxx -..\inc\svtools\zformat.hxx %_DEST%\inc%_EXT%\svtools\zformat.hxx -..\inc\numuno.hxx %_DEST%\inc%_EXT%\svtools\numuno.hxx -..\inc\svtools\ondemand.hxx %_DEST%\inc%_EXT%\svtools\ondemand.hxx -..\inc\svtools\loginerr.hxx %_DEST%\inc%_EXT%\svtools\loginerr.hxx -..\inc\svtools\logindlg.hxx %_DEST%\inc%_EXT%\svtools\logindlg.hxx -..\inc\svtools\httpcook.hxx %_DEST%\inc%_EXT%\svtools\httpcook.hxx -..\inc\imageresourceaccess.hxx %_DEST%\inc%_EXT%\svtools\imageresourceaccess.hxx -..\inc\svtools\itemprop.hxx %_DEST%\inc%_EXT%\svtools\itemprop.hxx -..\inc\addresstemplate.hxx %_DEST%\inc%_EXT%\svtools\addresstemplate.hxx -..\inc\svtools\genericunodialog.hxx %_DEST%\inc%_EXT%\svtools\genericunodialog.hxx -..\inc\svtools\editbrowsebox.hxx %_DEST%\inc%_EXT%\svtools\editbrowsebox.hxx -..\inc\svtools\editimplementation.hxx %_DEST%\inc%_EXT%\svtools\editimplementation.hxx -..\inc\templatefoldercache.hxx %_DEST%\inc%_EXT%\svtools\templatefoldercache.hxx -..\inc\folderrestriction.hxx %_DEST%\inc%_EXT%\svtools\folderrestriction.hxx -..\inc\filenotation.hxx %_DEST%\inc%_EXT%\svtools\filenotation.hxx -..\inc\svtools\urlcontrol.hxx %_DEST%\inc%_EXT%\svtools\urlcontrol.hxx -..\inc\svtools\fileurlbox.hxx %_DEST%\inc%_EXT%\svtools\fileurlbox.hxx -..\inc\svtools\toolboxcontroller.hxx %_DEST%\inc%_EXT%\svtools\toolboxcontroller.hxx -..\inc\framestatuslistener.hxx %_DEST%\inc%_EXT%\svtools\framestatuslistener.hxx -..\inc\statusbarcontroller.hxx %_DEST%\inc%_EXT%\svtools\statusbarcontroller.hxx -..\inc\svtools\generictoolboxcontroller.hxx %_DEST%\inc%_EXT%\svtools\generictoolboxcontroller.hxx -..\inc\svtools\restrictedpaths.hxx %_DEST%\inc%_EXT%\svtools\restrictedpaths.hxx - -..\inc\svtools\imap.hxx %_DEST%\inc%_EXT%\svtools\imap.hxx -..\inc\svtools\imapobj.hxx %_DEST%\inc%_EXT%\svtools\imapobj.hxx -..\inc\svtools\imaprect.hxx %_DEST%\inc%_EXT%\svtools\imaprect.hxx -..\inc\svtools\imapcirc.hxx %_DEST%\inc%_EXT%\svtools\imapcirc.hxx -..\inc\svtools\imappoly.hxx %_DEST%\inc%_EXT%\svtools\imappoly.hxx - -..\inc\svtools\parhtml.hxx %_DEST%\inc%_EXT%\svtools\parhtml.hxx -..\inc\htmltokn.h %_DEST%\inc%_EXT%\svtools\htmltokn.h -..\inc\htmlkywd.hxx %_DEST%\inc%_EXT%\svtools\htmlkywd.hxx -..\inc\svtools\svparser.hxx %_DEST%\inc%_EXT%\svtools\svparser.hxx -..\inc\svtools\htmlout.hxx %_DEST%\inc%_EXT%\svtools\htmlout.hxx -..\source\svrtf\rtfout.hxx %_DEST%\inc%_EXT%\svtools\rtfout.hxx -..\inc\svtools\parrtf.hxx %_DEST%\inc%_EXT%\svtools\parrtf.hxx -..\source\svrtf\rtftoken.h %_DEST%\inc%_EXT%\svtools\rtftoken.h -..\source\svrtf\rtfkeywd.hxx %_DEST%\inc%_EXT%\svtools\rtfkeywd.hxx - -..\inc\svtools\ctypeitm.hxx %_DEST%\inc%_EXT%\svtools\ctypeitm.hxx - -..\inc\strmadpt.hxx %_DEST%\inc%_EXT%\svtools\strmadpt.hxx -..\inc\instrm.hxx %_DEST%\inc%_EXT%\svtools\instrm.hxx -..\inc\outstrm.hxx %_DEST%\inc%_EXT%\svtools\outstrm.hxx - -..\inc\expander.hxx %_DEST%\inc%_EXT%\svtools\expander.hxx -..\source\svsql\converter.hxx %_DEST%\inc%_EXT%\svtools\converter.hxx - -..\inc\filectrl.hxx %_DEST%\inc%_EXT%\svtools\filectrl.hxx -..\inc\svtools\cenumitm.hxx %_DEST%\inc%_EXT%\svtools\cenumitm.hxx -..\inc\svtools\cintitem.hxx %_DEST%\inc%_EXT%\svtools\cintitem.hxx -..\inc\svtools\custritm.hxx %_DEST%\inc%_EXT%\svtools\custritm.hxx - -..\inc\sfxecode.hxx %_DEST%\inc%_EXT%\svtools\sfxecode.hxx -..\inc\svtools\ehdl.hxx %_DEST%\inc%_EXT%\svtools\ehdl.hxx -..\inc\svtools\svtools.hrc %_DEST%\inc%_EXT%\svtools\svtools.hrc -..\source\dialogs\filedlg2.hrc %_DEST%\inc%_EXT%\svtools\filedlg2.hrc - -..\inc\xmlement.hxx %_DEST%\inc%_EXT%\svtools\xmlement.hxx -..\inc\svtools\tresitem.hxx %_DEST%\inc%_EXT%\svtools\tresitem.hxx -..\inc\urihelper.hxx %_DEST%\inc%_EXT%\svtools\urihelper.hxx -..\inc\reginfo.hxx %_DEST%\inc%_EXT%\svtools\reginfo.hxx -..\inc\cacheoptions.hxx %_DEST%\inc%_EXT%\svtools\cacheoptions.hxx -..\inc\svtools\cjkoptions.hxx %_DEST%\inc%_EXT%\svtools\cjkoptions.hxx -..\inc\javaoptions.hxx %_DEST%\inc%_EXT%\svtools\javaoptions.hxx -..\inc\svtools\accelcfg.hxx %_DEST%\inc%_EXT%\svtools\accelcfg.hxx -..\inc\svtools\pathoptions.hxx %_DEST%\inc%_EXT%\svtools\pathoptions.hxx -..\inc\svtools\useroptions.hxx %_DEST%\inc%_EXT%\svtools\useroptions.hxx -..\inc\fstathelper.hxx %_DEST%\inc%_EXT%\svtools\fstathelper.hxx -..\inc\svtools\saveopt.hxx %_DEST%\inc%_EXT%\svtools\saveopt.hxx -..\inc\svtools\undoopt.hxx %_DEST%\inc%_EXT%\svtools\undoopt.hxx -..\inc\svtools\helpopt.hxx %_DEST%\inc%_EXT%\svtools\helpopt.hxx -..\inc\svtools\optionsdlg.hxx %_DEST%\inc%_EXT%\svtools\optionsdlg.hxx -..\inc\svtools\moduleoptions.hxx %_DEST%\inc%_EXT%\svtools\moduleoptions.hxx -..\inc\svtools\securityoptions.hxx %_DEST%\inc%_EXT%\svtools\securityoptions.hxx -..\inc\svtools\extendedsecurityoptions.hxx %_DEST%\inc%_EXT%\svtools\extendedsecurityoptions.hxx -..\inc\svtools\miscopt.hxx %_DEST%\inc%_EXT%\svtools\miscopt.hxx -..\inc\svtools\localisationoptions.hxx %_DEST%\inc%_EXT%\svtools\localisationoptions.hxx -..\inc\svtools\workingsetoptions.hxx %_DEST%\inc%_EXT%\svtools\workingsetoptions.hxx -..\inc\svtools\viewoptions.hxx %_DEST%\inc%_EXT%\svtools\viewoptions.hxx -..\inc\svtools\internaloptions.hxx %_DEST%\inc%_EXT%\svtools\internaloptions.hxx -..\inc\svtools\startoptions.hxx %_DEST%\inc%_EXT%\svtools\startoptions.hxx -..\inc\svtools\historyoptions.hxx %_DEST%\inc%_EXT%\svtools\historyoptions.hxx -..\inc\svtools\inetoptions.hxx %_DEST%\inc%_EXT%\svtools\inetoptions.hxx -..\inc\svtools\menuoptions.hxx %_DEST%\inc%_EXT%\svtools\menuoptions.hxx -..\inc\svtools\options3d.hxx %_DEST%\inc%_EXT%\svtools\options3d.hxx -..\inc\svtools\optionsdrawinglayer.hxx %_DEST%\inc%_EXT%\svtools\optionsdrawinglayer.hxx -..\inc\svtools\fontoptions.hxx %_DEST%\inc%_EXT%\svtools\fontoptions.hxx -..\inc\svtools\addxmltostorageoptions.hxx %_DEST%\inc%_EXT%\svtools\addxmltostorageoptions.hxx -..\inc\svtools\defaultoptions.hxx %_DEST%\inc%_EXT%\svtools\defaultoptions.hxx -..\inc\svtools\printwarningoptions.hxx %_DEST%\inc%_EXT%\svtools\printwarningoptions.hxx -..\inc\svtools\printoptions.hxx %_DEST%\inc%_EXT%\svtools\printoptions.hxx -..\inc\svtools\dynamicmenuoptions.hxx %_DEST%\inc%_EXT%\svtools\dynamicmenuoptions.hxx -..\inc\svtools\compatibility.hxx %_DEST%\inc%_EXT%\svtools\compatibility.hxx -..\inc\svtools\syslocaleoptions.hxx %_DEST%\inc%_EXT%\svtools\syslocaleoptions.hxx -..\inc\localresaccess.hxx %_DEST%\inc%_EXT%\svtools\localresaccess.hxx -..\inc\svtools\wizardmachine.hxx %_DEST%\inc%_EXT%\svtools\wizardmachine.hxx -..\inc\svtools\roadmapwizard.hxx %_DEST%\inc%_EXT%\svtools\roadmapwizard.hxx -..\inc\roadmap.hxx %_DEST%\inc%_EXT%\svtools\roadmap.hxx -..\inc\svtools\hyperlabel.hxx %_DEST%\inc%_EXT%\svtools\hyperlabel.hxx -..\inc\svtools\fixedhyper.hxx %_DEST%\inc%_EXT%\svtools\fixedhyper.hxx -..\inc\helpagentwindow.hxx %_DEST%\inc%_EXT%\svtools\helpagentwindow.hxx -..\inc\pickerhistory.hxx %_DEST%\inc%_EXT%\svtools\pickerhistory.hxx -..\inc\pickerhistoryaccess.hxx %_DEST%\inc%_EXT%\svtools\pickerhistoryaccess.hxx -..\inc\pickerhelper.hxx %_DEST%\inc%_EXT%\svtools\pickerhelper.hxx -..\inc\regoptions.hxx %_DEST%\inc%_EXT%\svtools\regoptions.hxx -..\inc\svtools\accessibilityoptions.hxx %_DEST%\inc%_EXT%\svtools\accessibilityoptions.hxx -..\inc\svtools\cmdoptions.hxx %_DEST%\inc%_EXT%\svtools\cmdoptions.hxx -..\inc\svtools\ctloptions.hxx %_DEST%\inc%_EXT%\svtools\ctloptions.hxx -..\inc\svtools\languageoptions.hxx %_DEST%\inc%_EXT%\svtools\languageoptions.hxx -..\inc\svtools\sourceviewconfig.hxx %_DEST%\inc%_EXT%\svtools\sourceviewconfig.hxx -..\inc\svtools\colorcfg.hxx %_DEST%\inc%_EXT%\svtools\colorcfg.hxx - -..\inc\lngmisc.hxx %_DEST%\inc%_EXT%\svtools\lngmisc.hxx -..\inc\svtools\lingucfg.hxx %_DEST%\inc%_EXT%\svtools\lingucfg.hxx -..\inc\linguprops.hxx %_DEST%\inc%_EXT%\svtools\linguprops.hxx -..\inc\searchopt.hxx %_DEST%\inc%_EXT%\svtools\searchopt.hxx - -..\inc\PasswordHelper.hxx %_DEST%\inc%_EXT%\svtools\PasswordHelper.hxx - -..\inc\svtools\syslocale.hxx %_DEST%\inc%_EXT%\svtools\syslocale.hxx - -..\inc\unoimap.hxx %_DEST%\inc%_EXT%\svtools\unoimap.hxx -..\inc\unoevent.hxx %_DEST%\inc%_EXT%\svtools\unoevent.hxx - -..\inc\svtools\stringtransfer.hxx %_DEST%\inc%_EXT%\svtools\stringtransfer.hxx - -..\inc\ivctrl.hxx %_DEST%\inc%_EXT%\svtools\ivctrl.hxx -..\inc\fileview.hxx %_DEST%\inc%_EXT%\svtools\fileview.hxx -..\inc\templdlg.hxx %_DEST%\inc%_EXT%\svtools\templdlg.hxx -..\inc\asynclink.hxx %_DEST%\inc%_EXT%\svtools\asynclink.hxx -..\inc\svtools\inettbc.hxx %_DEST%\inc%_EXT%\svtools\inettbc.hxx -..\inc\svtools\urlfilter.hxx %_DEST%\inc%_EXT%\svtools\urlfilter.hxx - -..\inc\controldims.hrc %_DEST%\inc%_EXT%\svtools\controldims.hrc - -..\inc\svtools\helpid.hrc %_DEST%\inc%_EXT%\svtools\helpid.hrc -..\inc\svtools\insdlg.hxx %_DEST%\inc%_EXT%\svtools\insdlg.hxx -..\inc\soerr.hxx %_DEST%\inc%_EXT%\svtools\soerr.hxx -..\inc\sores.hxx %_DEST%\inc%_EXT%\svtools\sores.hxx - -..\inc\textwindowaccessibility.hxx %_DEST%\inc%_EXT%\svtools\textwindowaccessibility.hxx - -..\inc\docpasswdrequest.hxx %_DEST%\inc%_EXT%\svtools\docpasswdrequest.hxx -..\inc\docmspasswdrequest.hxx %_DEST%\inc%_EXT%\svtools\docmspasswdrequest.hxx -..\inc\fontsubstconfig.hxx %_DEST%\inc%_EXT%\svtools\fontsubstconfig.hxx -..\inc\apearcfg.hxx %_DEST%\inc%_EXT%\svtools\apearcfg.hxx -..\inc\fltrcfg.hxx %_DEST%\inc%_EXT%\svtools\fltrcfg.hxx -..\inc\misccfg.hxx %_DEST%\inc%_EXT%\svtools\misccfg.hxx -..\inc\acceleratorexecute.hxx %_DEST%\inc%_EXT%\svtools\acceleratorexecute.hxx - -..\inc\QueryFolderName.hxx %_DEST%\inc%_EXT%\svtools\QueryFolderName.hxx -..\inc\DocumentInfoPreview.hxx %_DEST%\inc%_EXT%\svtools\DocumentInfoPreview.hxx -..\inc\svtools\javacontext.hxx %_DEST%\inc%_EXT%\svtools\javacontext.hxx -..\inc\svtools\javainteractionhandler.hxx %_DEST%\inc%_EXT%\svtools\javainteractionhandler.hxx -..\inc\dialogclosedlistener.hxx %_DEST%\inc%_EXT%\svtools\dialogclosedlistener.hxx -..\inc\svtools\options.hxx %_DEST%\inc%_EXT%\svtools\options.hxx -..\inc\contextmenuhelper.hxx %_DEST%\inc%_EXT%\svtools\contextmenuhelper.hxx -..\inc\extcolorcfg.hxx %_DEST%\inc%_EXT%\svtools\extcolorcfg.hxx - -..\inc\svtools\chartprettypainter.hxx %_DEST%\inc%_EXT%\svtools\chartprettypainter.hxx -..\inc\svtools\extensionlistbox.hxx %_DEST%\inc%_EXT%\svtools\extensionlistbox.hxx ->>>>>>> other dos: sh -c "if test %OS% = MACOSX; then macosx-create-bundle %_DEST%\bin%_EXT%\bmp=%__PRJROOT%\%__SRC%\bin%_EXT%; fi" -- cgit From 28b33be9d69a49140fa8fc4bbb77c968203b2bc1 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Wed, 9 Dec 2009 11:11:02 +0100 Subject: missing dependency on rsc --- svl/prj/build.lst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svl/prj/build.lst b/svl/prj/build.lst index 8dc6d831f850..03e8887ceabd 100644 --- a/svl/prj/build.lst +++ b/svl/prj/build.lst @@ -1,4 +1,4 @@ -sl svl : l10n offuh ucbhelper unotools cppu cppuhelper comphelper sal sot NULL +sl svl : l10n rsc offuh ucbhelper unotools cppu cppuhelper comphelper sal sot NULL sl svl usr1 - all sl_mkout NULL sl svl\inc nmake - all sl_inc NULL sl svl\unx\source\svdde nmake - u sl_usdde sl_inc NULL -- cgit From 9f4bc225ca4628c58d728e8f32e5aaaa3fac8bca Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Wed, 9 Dec 2009 14:51:45 +0000 Subject: #i107554# protect against stack underflow --- vcl/source/gdi/pdfwriter_impl.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index dd2f4a62c88d..62da1a72a96c 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -10145,12 +10145,17 @@ void PDFWriterImpl::setFont( const Font& rFont ) void PDFWriterImpl::push( sal_uInt16 nFlags ) { + OSL_ENSURE( m_aGraphicsStack.size() > 0, "invalid graphics stack" ); m_aGraphicsStack.push_front( m_aGraphicsStack.front() ); m_aGraphicsStack.front().m_nFlags = nFlags; } void PDFWriterImpl::pop() { + OSL_ENSURE( m_aGraphicsStack.size() > 1, "pop without push" ); + if( m_aGraphicsStack.size() < 2 ) + return; + GraphicsState aState = m_aGraphicsStack.front(); m_aGraphicsStack.pop_front(); GraphicsState& rOld = m_aGraphicsStack.front(); -- cgit From 6cfb4e0977e2f7974edabd2e617286c6e2e46738 Mon Sep 17 00:00:00 2001 From: Andreas Bregas Date: Wed, 9 Dec 2009 14:52:59 +0000 Subject: #i107075# Check any type in getTextMarkup() --- vcl/unx/gtk/a11y/atktext.cxx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/vcl/unx/gtk/a11y/atktext.cxx b/vcl/unx/gtk/a11y/atktext.cxx index f6755deb60b5..0a97e5ba1ca6 100644 --- a/vcl/unx/gtk/a11y/atktext.cxx +++ b/vcl/unx/gtk/a11y/atktext.cxx @@ -187,9 +187,16 @@ static accessibility::XAccessibleTextMarkup* if( !pWrap->mpTextMarkup && pWrap->mpContext ) { uno::Any any = pWrap->mpContext->queryInterface( accessibility::XAccessibleTextMarkup::static_type(NULL) ); - pWrap->mpTextMarkup = reinterpret_cast< accessibility::XAccessibleTextMarkup * > (any.pReserved); - if( pWrap->mpTextMarkup ) - pWrap->mpTextMarkup->acquire(); + /* Since this not a dedicated interface in Atk and thus has not + * been queried during wrapper initialization, we need to check + * the return value here. + */ + if( typelib_TypeClass_INTERFACE == any.pType->eTypeClass ) + { + pWrap->mpTextMarkup = reinterpret_cast< accessibility::XAccessibleTextMarkup * > (any.pReserved); + if( pWrap->mpTextMarkup ) + pWrap->mpTextMarkup->acquire(); + } } return pWrap->mpTextMarkup; -- cgit From 4392bf6cfd08e58667d7d479ea56180c15406472 Mon Sep 17 00:00:00 2001 From: Mikhail Voitenko Date: Thu, 10 Dec 2009 10:58:16 +0000 Subject: #i107512# let the singleton be registered --- comphelper/source/misc/comphelper_services.cxx | 2 ++ comphelper/source/misc/documentiologring.cxx | 25 ++++++++++++++++--------- comphelper/source/misc/documentiologring.hxx | 11 +++++------ 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/comphelper/source/misc/comphelper_services.cxx b/comphelper/source/misc/comphelper_services.cxx index 77ab145e2581..8fa318a92eb1 100644 --- a/comphelper/source/misc/comphelper_services.cxx +++ b/comphelper/source/misc/comphelper_services.cxx @@ -39,6 +39,7 @@ extern void createRegistryInfo_AnyCompareFactory(); extern void createRegistryInfo_OfficeInstallationDirectories(); extern void createRegistryInfo_OInstanceLocker(); extern void createRegistryInfo_Map(); +extern void createRegistryInfo_OSimpleLogRing(); //........................................................................ namespace comphelper { namespace module @@ -63,6 +64,7 @@ namespace comphelper { namespace module createRegistryInfo_OfficeInstallationDirectories(); createRegistryInfo_OInstanceLocker(); createRegistryInfo_Map(); + createRegistryInfo_OSimpleLogRing(); } } } diff --git a/comphelper/source/misc/documentiologring.cxx b/comphelper/source/misc/documentiologring.cxx index 7969b938e108..8b999aaf4449 100644 --- a/comphelper/source/misc/documentiologring.cxx +++ b/comphelper/source/misc/documentiologring.cxx @@ -34,6 +34,8 @@ #include #include +#include + #include "documentiologring.hxx" using namespace ::com::sun::star; @@ -56,33 +58,33 @@ OSimpleLogRing::~OSimpleLogRing() } // ---------------------------------------------------------- -uno::Sequence< ::rtl::OUString > SAL_CALL OSimpleLogRing::impl_staticGetSupportedServiceNames() +uno::Sequence< ::rtl::OUString > SAL_CALL OSimpleLogRing::getSupportedServiceNames_static() { uno::Sequence< rtl::OUString > aResult( 1 ); - aResult[0] = impl_staticGetServiceName(); + aResult[0] = getServiceName_static(); return aResult; } // ---------------------------------------------------------- -::rtl::OUString SAL_CALL OSimpleLogRing::impl_staticGetImplementationName() +::rtl::OUString SAL_CALL OSimpleLogRing::getImplementationName_static() { return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.logging.SimpleLogRing" ) ); } // ---------------------------------------------------------- -::rtl::OUString SAL_CALL OSimpleLogRing::impl_staticGetSingletonName() +::rtl::OUString SAL_CALL OSimpleLogRing::getSingletonName_static() { return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.logging.DocumentIOLogRing" ) ); } // ---------------------------------------------------------- -::rtl::OUString SAL_CALL OSimpleLogRing::impl_staticGetServiceName() +::rtl::OUString SAL_CALL OSimpleLogRing::getServiceName_static() { return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.logging.SimpleLogRing" ) ); } // ---------------------------------------------------------- -uno::Reference< uno::XInterface > SAL_CALL OSimpleLogRing::impl_staticCreateSelfInstance( const uno::Reference< uno::XComponentContext >& rxContext ) +uno::Reference< uno::XInterface > SAL_CALL OSimpleLogRing::Create( const uno::Reference< uno::XComponentContext >& rxContext ) { return static_cast< cppu::OWeakObject* >( new OSimpleLogRing( rxContext ) ); } @@ -149,13 +151,13 @@ void SAL_CALL OSimpleLogRing::initialize( const uno::Sequence< uno::Any >& aArgu // ---------------------------------------------------------- ::rtl::OUString SAL_CALL OSimpleLogRing::getImplementationName() throw (uno::RuntimeException) { - return impl_staticGetImplementationName(); + return getImplementationName_static(); } // ---------------------------------------------------------- ::sal_Bool SAL_CALL OSimpleLogRing::supportsService( const ::rtl::OUString& aServiceName ) throw (uno::RuntimeException) { - const uno::Sequence< rtl::OUString > & aSupportedNames = impl_staticGetSupportedServiceNames(); + const uno::Sequence< rtl::OUString > & aSupportedNames = getSupportedServiceNames_static(); for ( sal_Int32 nInd = 0; nInd < aSupportedNames.getLength(); nInd++ ) { if ( aSupportedNames[ nInd ].equals( aServiceName ) ) @@ -168,8 +170,13 @@ void SAL_CALL OSimpleLogRing::initialize( const uno::Sequence< uno::Any >& aArgu // ---------------------------------------------------------- uno::Sequence< ::rtl::OUString > SAL_CALL OSimpleLogRing::getSupportedServiceNames() throw (uno::RuntimeException) { - return impl_staticGetSupportedServiceNames(); + return getSupportedServiceNames_static(); } } // namespace comphelper +void createRegistryInfo_OSimpleLogRing() +{ + static ::comphelper::module::OAutoRegistration< ::comphelper::OSimpleLogRing > aAutoRegistration; + static ::comphelper::module::OSingletonRegistration< ::comphelper::OSimpleLogRing > aSingletonRegistration; +} diff --git a/comphelper/source/misc/documentiologring.hxx b/comphelper/source/misc/documentiologring.hxx index ae7d2a6eaf19..b2b935c478af 100644 --- a/comphelper/source/misc/documentiologring.hxx +++ b/comphelper/source/misc/documentiologring.hxx @@ -60,17 +60,16 @@ public: virtual ~OSimpleLogRing(); static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL - impl_staticGetSupportedServiceNames(); + getSupportedServiceNames_static(); - static ::rtl::OUString SAL_CALL impl_staticGetImplementationName(); + static ::rtl::OUString SAL_CALL getImplementationName_static(); - static ::rtl::OUString SAL_CALL impl_staticGetSingletonName(); + static ::rtl::OUString SAL_CALL getSingletonName_static(); - static ::rtl::OUString SAL_CALL impl_staticGetServiceName(); + static ::rtl::OUString SAL_CALL getServiceName_static(); static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL - impl_staticCreateSelfInstance( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); + Create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); // XSimpleLogRing virtual void SAL_CALL logString( const ::rtl::OUString& aMessage ) throw (::com::sun::star::uno::RuntimeException); -- cgit From 058f03010f53563a2555741c06d84b68e8d2447d Mon Sep 17 00:00:00 2001 From: Kai Ahrens Date: Mon, 14 Dec 2009 07:15:29 +0000 Subject: added community patches --- goodies/source/graphic/grfcache.cxx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/goodies/source/graphic/grfcache.cxx b/goodies/source/graphic/grfcache.cxx index 1a2af16ed741..f0a41ceca53f 100644 --- a/goodies/source/graphic/grfcache.cxx +++ b/goodies/source/graphic/grfcache.cxx @@ -37,6 +37,8 @@ #include #include "grfcache.hxx" +#include + // ----------- // - Defines - // ----------- @@ -612,7 +614,12 @@ void GraphicCache::AddGraphicObject( const GraphicObject& rObj, Graphic& rSubsti if( !bInserted ) { GraphicCacheEntry* pEntry = static_cast< GraphicCacheEntry* >( maGraphicCache.First() ); - const GraphicID aID( rObj ); + ::std::auto_ptr< GraphicID > apID; + + if( !pID ) + { + apID.reset( new GraphicID( rObj ) ); + } while( !bInserted && pEntry ) { @@ -647,10 +654,13 @@ void GraphicCache::AddGraphicObject( const GraphicObject& rObj, Graphic& rSubsti } } } - else if( rEntryID == aID ) + else { - pEntry->AddGraphicObjectReference( rObj, rSubstitute ); - bInserted = TRUE; + if( rEntryID == *apID ) + { + pEntry->AddGraphicObjectReference( rObj, rSubstitute ); + bInserted = TRUE; + } } if( !bInserted ) -- cgit From 3c3a4f8fcba66452dede208e05b9e8a69e573742 Mon Sep 17 00:00:00 2001 From: Release Engineering Date: Wed, 16 Dec 2009 09:40:02 +0100 Subject: #i107025# fix for WaE --- vcl/unx/source/gdi/salgdi.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index c09803dcb269..cb554bccea21 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -1793,7 +1793,7 @@ void splitIntersectingSegments( LSVector& rLSVector) // prepare the result vector // try to avoid reallocations by guessing a reasonable result size - rLSVector.reserve( aYMinQueue.size() * 1.5); + rLSVector.reserve( aYMinQueue.size() * 3/2 ); // find all intersections CutPointSet aCutPointSet; -- cgit From 0c5348ff2c5cede4607555fdab45642db10b07ba Mon Sep 17 00:00:00 2001 From: Release Engineering Date: Wed, 16 Dec 2009 15:39:14 +0100 Subject: #100000# fix for SO build environment --- svl/prj/build.lst | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/svl/prj/build.lst b/svl/prj/build.lst index 03e8887ceabd..f2d4bf324d01 100644 --- a/svl/prj/build.lst +++ b/svl/prj/build.lst @@ -1,22 +1,22 @@ sl svl : l10n rsc offuh ucbhelper unotools cppu cppuhelper comphelper sal sot NULL -sl svl usr1 - all sl_mkout NULL -sl svl\inc nmake - all sl_inc NULL -sl svl\unx\source\svdde nmake - u sl_usdde sl_inc NULL -sl svl\unx\source\svdde nmake - p sl_psdde sl_inc NULL -sl svl\source\config nmake - all sl_conf sl_inc NULL -sl svl\source\filepicker nmake - all sl_filepick sl_inc NULL -sl svl\source\filerec nmake - all sl_file sl_inc NULL -sl svl\source\items nmake - all sl__item sl_inc NULL -sl svl\source\memtools nmake - all sl_mem sl_inc NULL -sl svl\source\misc nmake - all sl__misc sl_inc NULL -sl svl\source\notify nmake - all sl_not sl_inc NULL -sl svl\source\numbers nmake - all sl_num sl_inc NULL -sl svl\source\svdde nmake - all sl__dde sl_inc NULL -sl svl\source\svsql nmake - all sl_sql sl_inc NULL -sl svl\source\undo nmake - all sl_undo sl_inc NULL -sl svl\source\uno nmake - all sl_uno sl_inc NULL -sl svl\util nmake - all sl_util sl_usdde.u sl_psdde.p sl_conf sl_filepick sl_file sl__item sl_mem sl__misc sl_not sl_num sl__dde sl_sql sl_undo sl_uno NULL -sl svl\source\fsstor nmake - all sl_fsstor sl_inc NULL -sl svl\source\passwordcontainer nmake - all sl_passcont sl_inc NULL +sl svl usr1 - all svl_mkout NULL +sl svl\inc nmake - all svl_inc NULL +sl svl\unx\source\svdde nmake - u svl_usdde svl_inc NULL +sl svl\unx\source\svdde nmake - p svl_psdde svl_inc NULL +sl svl\source\config nmake - all svl_conf svl_inc NULL +sl svl\source\filepicker nmake - all svl_filepick svl_inc NULL +sl svl\source\filerec nmake - all svl_file svl_inc NULL +sl svl\source\items nmake - all svl__item svl_inc NULL +sl svl\source\memtools nmake - all svl_mem svl_inc NULL +sl svl\source\misc nmake - all svl__misc svl_inc NULL +sl svl\source\notify nmake - all svl_not svl_inc NULL +sl svl\source\numbers nmake - all svl_num svl_inc NULL +sl svl\source\svdde nmake - all svl__dde svl_inc NULL +sl svl\source\svsql nmake - all svl_sql svl_inc NULL +sl svl\source\undo nmake - all svl_undo svl_inc NULL +sl svl\source\uno nmake - all svl_uno svl_inc NULL +sl svl\util nmake - all svl_util svl_usdde.u svl_psdde.p svl_conf svl_filepick svl_file svl__item svl_mem svl__misc svl_not svl_num svl__dde svl_sql svl_undo svl_uno NULL +sl svl\source\fsstor nmake - all svl_fsstor svl_inc NULL +sl svl\source\passwordcontainer nmake - all svl_passcont svl_inc NULL -- cgit