diff options
author | sj <sj@openoffice.org> | 2010-08-13 15:02:26 +0200 |
---|---|---|
committer | sj <sj@openoffice.org> | 2010-08-13 15:02:26 +0200 |
commit | 1352676b8173290c3aa828596e01bfe76ad5545a (patch) | |
tree | a9e89970fbe6bd49c4f9ebae7a5a70dfc56dd268 /svtools | |
parent | d3f7ff0321d03c423d9eaff787b3921862f47f8c (diff) | |
parent | deee1f03fb16af83c642121a5682af3398d90ece (diff) |
impress186: merge with DEV300m86
Diffstat (limited to 'svtools')
63 files changed, 2539 insertions, 1097 deletions
diff --git a/svtools/inc/svtools/accessibletable.hxx b/svtools/inc/svtools/accessibletable.hxx index 198a24b8eb62..8ff17a2b71c7 100755 --- a/svtools/inc/svtools/accessibletable.hxx +++ b/svtools/inc/svtools/accessibletable.hxx @@ -124,7 +124,7 @@ public: virtual ::com::sun::star::uno::Any GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0; virtual std::vector<sal_Int32>& GetSelectedRows() = 0; virtual void RemoveSelectedRow(sal_Int32 _nRowPos) = 0; - virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) = 0; + virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0; }; // ---------------------------------------------------------------------------- diff --git a/svtools/inc/svtools/filter.hxx b/svtools/inc/svtools/filter.hxx index 770e81b00551..49ec77adfea5 100644 --- a/svtools/inc/svtools/filter.hxx +++ b/svtools/inc/svtools/filter.hxx @@ -62,6 +62,8 @@ class Graphic; #define GRFILTER_ABORT 6 #define GRFILTER_TOOBIG 7 +#define GRFILTER_OUTHINT_GREY 1 + #define GRFILTER_FORMAT_NOTFOUND ((USHORT)0xFFFF) #define GRFILTER_FORMAT_DONTKNOW ((USHORT)0xFFFF) @@ -323,7 +325,7 @@ protected: sal_Bool bDummy2; sal_Bool bDummy3; sal_Bool bDummy4; - long nDummy1; + long nExpGraphHint; long nDummy2; void* pDummy1; void* pDummy2; @@ -374,6 +376,7 @@ public: USHORT ExportGraphic( const Graphic& rGraphic, const String& rPath, SvStream& rOStm, USHORT nFormat = GRFILTER_FORMAT_DONTKNOW, const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* pFilterData = NULL ); + long GetExportGraphicHint() const { return nExpGraphHint; } USHORT CanImportGraphic( const INetURLObject& rPath, USHORT nFormat = GRFILTER_FORMAT_DONTKNOW, diff --git a/svtools/inc/svtools/logindlg.hxx b/svtools/inc/svtools/logindlg.hxx deleted file mode 100644 index 9cf12dd70610..000000000000 --- a/svtools/inc/svtools/logindlg.hxx +++ /dev/null @@ -1,118 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVTOOLS_LOGINDLG_HXX_ -#define _SVTOOLS_LOGINDLG_HXX_ - -#include "svtools/svtdllapi.h" -#include <svtools/stdctrl.hxx> -#ifndef _SV_BUTTON_HXX -#include <vcl/button.hxx> -#endif -#include <vcl/dialog.hxx> -#include <vcl/edit.hxx> -#include <vcl/fixed.hxx> - -//============================================================================ -#define LF_NO_PATH 0x0001 // hide "path" -#define LF_NO_USERNAME 0x0002 // hide "name" -#define LF_NO_PASSWORD 0x0004 // hide "password" -#define LF_NO_SAVEPASSWORD 0x0008 // hide "save password" -#define LF_NO_ERRORTEXT 0x0010 // hide message -#define LF_PATH_READONLY 0x0020 // "path" readonly -#define LF_USERNAME_READONLY 0x0040 // "name" readonly -#define LF_NO_ACCOUNT 0x0080 // hide "account" - -//............................................................................ -namespace svt -{ -//............................................................................ - -//============================================================================ -class SVT_DLLPUBLIC LoginDialog : public ModalDialog -{ - FixedInfo aErrorInfo; - FixedLine aErrorGB; - FixedInfo aRequestInfo; - FixedText aPathFT; - Edit aPathED; - FixedInfo aPathInfo; - PushButton aPathBtn; - FixedText aNameFT; - Edit aNameED; - FixedInfo aNameInfo; - FixedText aPasswordFT; - Edit aPasswordED; - FixedText aAccountFT; - Edit aAccountED; - CheckBox aSavePasswdBtn; - FixedLine aLoginGB; - OKButton aOKBtn; - CancelButton aCancelBtn; - HelpButton aHelpBtn; - - SVT_DLLPRIVATE void HideControls_Impl( USHORT nFlags ); - - DECL_DLLPRIVATE_LINK( OKHdl_Impl, OKButton * ); - DECL_DLLPRIVATE_LINK( PathHdl_Impl, PushButton * ); - -public: - LoginDialog( Window* pParent, USHORT nFlags, - const String& rServer, const String* pRealm = NULL ); - - String GetPath() const { return aPathED.GetText(); } - void SetPath( const String& rNewPath ) - { aPathED.SetText( rNewPath ); - aPathInfo.SetText( rNewPath );} - String GetName() const { return aNameED.GetText(); } - void SetName( const String& rNewName ); - String GetPassword() const { return aPasswordED.GetText(); } - void SetPassword( const String& rNew ) - { aPasswordED.SetText( rNew ); } - String GetAccount() const { return aAccountED.GetText(); } - void SetAccount( const String& rNew ) - { aAccountED.SetText( rNew ); } - BOOL IsSavePassword() const - { return aSavePasswdBtn.IsChecked(); } - void SetSavePassword( BOOL bSave ) - { aSavePasswdBtn.Check( bSave ); } - void SetSavePasswordText( const String& rTxt ) - { aSavePasswdBtn.SetText( rTxt ); } - void SetErrorText( const String& rTxt ) - { aErrorInfo.SetText( rTxt ); } - void SetLoginRequestText( const String& rTxt ) - { aRequestInfo.SetText( rTxt ); } - void ClearPassword(); - void ClearAccount(); -}; - -//............................................................................ -} // namespace svt -//............................................................................ - -#endif // _SVTOOLS_LOGINDLG_HXX_ - diff --git a/svtools/inc/svtools/roadmapwizard.hxx b/svtools/inc/svtools/roadmapwizard.hxx index 49a0f441c49c..5d8e0d9b01bb 100644 --- a/svtools/inc/svtools/roadmapwizard.hxx +++ b/svtools/inc/svtools/roadmapwizard.hxx @@ -80,6 +80,11 @@ namespace svt const ResId& _rRes, sal_uInt32 _nButtonFlags = WZB_NEXT | WZB_PREVIOUS | WZB_FINISH | WZB_CANCEL | WZB_HELP ); + RoadmapWizard( + Window* _pParent, + const WinBits i_nStyle, + sal_uInt32 _nButtonFlags = WZB_NEXT | WZB_PREVIOUS | WZB_FINISH | WZB_CANCEL | WZB_HELP + ); ~RoadmapWizard( ); void SetRoadmapBitmap( const BitmapEx& _rBitmap ); @@ -137,7 +142,7 @@ protected: You can only activate paths which share the first <code>k</code> states with the path which is previously active (if any), where <code>k</code> is the index of the - current state within the current page. + current state within the current path. <example> Say you have paths, <code>(0,1,2,5)</code> and <code>(0,1,4,5)</code>. This means that after @@ -197,6 +202,10 @@ protected: */ void enableState( WizardState _nState, bool _bEnable = true ); + /** returns true if and only if the given state is known in at least one declared path + */ + bool knowsState( WizardState _nState ) const; + // OWizardMachine overriables virtual void enterState( WizardState _nState ); @@ -230,13 +239,15 @@ protected: private: SVT_DLLPRIVATE void ResizeFixedLine(); - private: DECL_DLLPRIVATE_LINK( OnRoadmapItemSelected, void* ); /** updates the roadmap control to show the given path, as far as possible (modulo conflicts with other paths) */ SVT_DLLPRIVATE void implUpdateRoadmap( ); + + private: + SVT_DLLPRIVATE void impl_construct(); }; //........................................................................ diff --git a/svtools/inc/svtools/svlbitm.hxx b/svtools/inc/svtools/svlbitm.hxx index c28b8d5db10c..5158c38fbd87 100644 --- a/svtools/inc/svtools/svlbitm.hxx +++ b/svtools/inc/svtools/svlbitm.hxx @@ -176,6 +176,8 @@ class SVT_DLLPUBLIC SvLBoxButton : public SvLBoxItem USHORT nItemFlags; USHORT nImgArrOffs; USHORT nBaseOffs; + + void ImplAdjustBoxSize( Size& io_rCtrlSize, ControlType i_eType, Window* pParent ); public: // An SvLBoxButton can be of three different kinds: an // enabled checkbox (the normal kind), a disabled checkbox diff --git a/svtools/inc/svtools/table/abstracttablecontrol.hxx b/svtools/inc/svtools/table/abstracttablecontrol.hxx index 2b3951f6aaf3..9206f20ecbcb 100644 --- a/svtools/inc/svtools/table/abstracttablecontrol.hxx +++ b/svtools/inc/svtools/table/abstracttablecontrol.hxx @@ -116,6 +116,7 @@ namespace svt { namespace table /** returns selection engine*/ virtual SelectionEngine* getSelEngine() = 0; virtual void setCursorAtCurrentCell(const Point& rPoint) = 0; + virtual bool isTooltipActive() = 0; virtual rtl::OUString& setTooltip(const Point& rPoint ) = 0; virtual RowPos getCurrentRow(const Point& rPoint ) = 0; virtual void resizeColumn(const Point& rPoint ) = 0; diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index f08a1723c143..f3b7ed88b565 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -79,6 +79,7 @@ namespace svt { namespace table ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aText; Link m_aSelectHdl; bool m_bSelectionChanged; + bool m_bTooltip; public: ::std::auto_ptr< AccessibleTableControl_Impl > m_pAccessTable; @@ -177,7 +178,7 @@ namespace svt { namespace table virtual void GetFocus(); virtual void LoseFocus(); virtual void KeyInput( const KeyEvent& rKEvt ); - //virtual long Notify(NotifyEvent& rNEvt); + virtual void StateChanged( StateChangedType i_nStateChange ); /** Creates and returns the accessible object of the whole GridControl. */ SVT_DLLPRIVATE virtual XACC CreateAccessible(); @@ -217,11 +218,13 @@ namespace svt { namespace table 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 void RemoveSelectedRow(RowPos _nRowPos); - virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos); + virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const; ::com::sun::star::uno::Sequence< sal_Int32 >& getColumnsForTooltip(); ::com::sun::star::uno::Sequence< ::rtl::OUString >& getTextForTooltip(); void setTooltip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aText, const ::com::sun::star::uno::Sequence< sal_Int32 >& nCols); + void clearSelection(); void selectionChanged(bool _bChanged); + bool isTooltip(); protected: /// retrieves the XAccessible implementation associated with the GridControl instance diff --git a/svtools/inc/svtools/table/tabledatawindow.hxx b/svtools/inc/svtools/table/tabledatawindow.hxx index c9f96483d943..9a6ece489119 100644 --- a/svtools/inc/svtools/table/tabledatawindow.hxx +++ b/svtools/inc/svtools/table/tabledatawindow.hxx @@ -74,6 +74,11 @@ namespace svt { namespace table virtual void CaptureMouse(); virtual void ReleaseMouse(); virtual long Notify(NotifyEvent& rNEvt); + virtual void SetControlBackground(const Color& rColor); + virtual void SetControlBackground(); + + void SetBackground(const Wallpaper& rColor); + void SetBackground(); }; //........................................................................ } } // namespace svt::table diff --git a/svtools/inc/svtools/toolboxcontroller.hxx b/svtools/inc/svtools/toolboxcontroller.hxx index 96e48a399831..7a49b294759c 100644 --- a/svtools/inc/svtools/toolboxcontroller.hxx +++ b/svtools/inc/svtools/toolboxcontroller.hxx @@ -42,7 +42,13 @@ #include <cppuhelper/interfacecontainer.hxx> #include <comphelper/broadcasthelper.hxx> #include <com/sun/star/util/XURLTransformer.hpp> - +//shizhoubo for ToolbarController Visiable +#include <comphelper/proparrhlp.hxx> +#include <comphelper/property.hxx> +#include <comphelper/propertycontainer.hxx> +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/interfacecontainer.hxx> +//end #ifndef INCLUDED_HASH_MAP #include <hash_map> #define INCLUDED_HASH_MAP @@ -59,9 +65,13 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL public ::com::sun::star::lang::XInitialization, public ::com::sun::star::util::XUpdatable, public ::com::sun::star::lang::XComponent, - public ::comphelper::OBaseMutex, + public ::comphelper::OMutexAndBroadcastHelper,//shizhoubo + public ::comphelper::OPropertyContainer,//shizhoubo + public ::comphelper::OPropertyArrayUsageHelper< ToolboxController >,//shizhoubo public ::cppu::OWeakObject { + private: + sal_Bool m_bSupportVisiable; //shizhoubo public: ToolboxController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, @@ -93,6 +103,7 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); // XEventListener + using cppu::OPropertySetHelper::disposing; virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); // XStatusListener @@ -104,6 +115,15 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException); + // OPropertySetHelper //shizhoubo + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const com::sun::star::uno::Any& rValue ) throw(com::sun::star::uno::Exception); + virtual sal_Bool SAL_CALL convertFastPropertyValue( com::sun::star::uno::Any& rConvertedValue, com::sun::star::uno::Any& rOldValue, sal_Int32 nHandle, const com::sun::star::uno::Any& rValue) throw(com::sun::star::lang::IllegalArgumentException); + // XPropertySet //shizhoubo + virtual ::com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + // OPropertyArrayUsageHelper //shizhoubo + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + const rtl::OUString& getCommandURL() const { return m_aCommandURL; } const rtl::OUString& getModuleName() const; @@ -114,7 +134,7 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL protected: bool getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox ); - + void setSupportVisiableProperty(sal_Bool bValue); //shizhoubo struct Listener { Listener( const ::com::sun::star::util::URL& rURL, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& rDispatch ) : diff --git a/svtools/inc/svtools/wizardmachine.hxx b/svtools/inc/svtools/wizardmachine.hxx index f45087f78705..02562ac4bb63 100644 --- a/svtools/inc/svtools/wizardmachine.hxx +++ b/svtools/inc/svtools/wizardmachine.hxx @@ -42,6 +42,7 @@ namespace svt //......................................................................... // wizard buttons +#define WZB_NONE 0x0000 #define WZB_NEXT 0x0001 #define WZB_PREVIOUS 0x0002 #define WZB_FINISH 0x0004 @@ -62,12 +63,11 @@ namespace svt eTravelForward, // traveling forward (maybe with skipping pages) eTravelBackward, // traveling backward (maybe with skipping pages) eFinish, // the wizard is about to be finished - eValidate, // the data should be validated only, no traveling wll happen - eValidateNoUI // the data should be validated only, without displaying error messages and other UI + eValidate // the data should be validated only, no traveling wll happen }; }; - class SAL_NO_VTABLE IWizardPage : public WizardTypes + class SAL_NO_VTABLE IWizardPageController { public: //----------------------------------------------------------------- @@ -78,7 +78,16 @@ namespace svt // to be committed for this. // So initializePage and commitPage are designated to initialitzing/committing data on the page. virtual void initializePage() = 0; - virtual sal_Bool commitPage( CommitPageReason _eReason ) = 0; + virtual sal_Bool commitPage( WizardTypes::CommitPageReason _eReason ) = 0; + + /** determines whether or not it is allowed to advance to a next page + + You should make this dependent on the current state of the page only, not on + states on other pages of the whole dialog. + + The default implementation always returns <TRUE/>. + */ + virtual bool canAdvance() const = 0; }; //===================================================================== @@ -87,7 +96,7 @@ namespace svt class OWizardMachine; struct WizardPageImplData; - class SVT_DLLPUBLIC OWizardPage : public TabPage, public IWizardPage + class SVT_DLLPUBLIC OWizardPage : public TabPage, public IWizardPageController { private: WizardPageImplData* m_pImpl; @@ -101,23 +110,10 @@ namespace svt OWizardPage( Window* _pParent, const ResId& _rResId ); ~OWizardPage(); - // This methods behave somewhat different than ActivatePage/DeactivatePage - // The latter are handled by the base class itself whenever changing the pages is in the offing, - // i.e., when it's already decided which page is the next. - // We may have situations where the next page depends on the state of the current, which needs - // to be committed for this. - // So initializePage and commitPage are designated to initialitzing/committing data on the page. + // IWizardPageController overridables virtual void initializePage(); - virtual sal_Bool commitPage( CommitPageReason _eReason ); - - /** determines whether or not it is allowed to advance to a next page - - You should make this dependent on the current state of the page only, not on - states on other pages of the whole dialog. - - The default implementation always returns <TRUE/>. - */ - virtual bool canAdvance() const; + virtual sal_Bool commitPage( WizardTypes::CommitPageReason _eReason ); + virtual bool canAdvance() const; protected: // TabPage overridables @@ -189,6 +185,7 @@ namespace svt For the button flags, use any combination of the WZB_* flags. */ OWizardMachine(Window* _pParent, const ResId& _rRes, sal_uInt32 _nButtonFlags ); + OWizardMachine(Window* _pParent, const WinBits i_nStyle, sal_uInt32 _nButtonFlags ); ~OWizardMachine(); /// enable (or disable) buttons @@ -263,7 +260,7 @@ namespace svt /** called when the finish button is pressed <p>By default, only the base class' Finnish method (which is not virtual) is called</p> */ - virtual sal_Bool onFinish(sal_Int32 _nResult); + virtual sal_Bool onFinish(); /// travel to the next state sal_Bool travelNext(); @@ -342,7 +339,8 @@ namespace svt */ WizardState getCurrentState() const { return WizardDialog::GetCurLevel(); } - virtual IWizardPage* getWizardPage(TabPage* _pCurrentPage) const; + virtual IWizardPageController* + getPageController( TabPage* _pCurrentPage ) const; /** retrieves a copy of the state history, i.e. all states we already visited */ @@ -355,6 +353,9 @@ namespace svt void resumeTraveling( AccessGuard ); bool isTravelingSuspended() const; + protected: + TabPage* GetOrCreatePage( const WizardState i_nState ); + private: // long OnNextPage( PushButton* ); DECL_DLLPRIVATE_LINK(OnNextPage, PushButton*); @@ -363,6 +364,7 @@ namespace svt SVT_DLLPRIVATE void implResetDefault(Window* _pWindow); SVT_DLLPRIVATE void implUpdateTitle(); + SVT_DLLPRIVATE void implConstruct( const sal_uInt32 _nButtonFlags ); }; /// helper class to temporarily suspend any traveling in the wizard diff --git a/svtools/inc/svtools/xwindowitem.hxx b/svtools/inc/svtools/xwindowitem.hxx new file mode 100644 index 000000000000..eca425cf1369 --- /dev/null +++ b/svtools/inc/svtools/xwindowitem.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: chrtitem.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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _XWINDOWITEM_HXX_ +#define _XWINDOWITEM_HXX_ + + +#include "svtools/svtdllapi.h" + +#include <svl/poolitem.hxx> +#include <toolkit/helper/vclunohelper.hxx> + +#include <com/sun/star/awt/XWindow.hpp> + +class Window; + +////////////////////////////////////////////////////////////////////// + +class SVT_DLLPUBLIC XWindowItem : public SfxPoolItem +{ + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xWin; + + // disallow use assignment operator + XWindowItem & operator = ( const XWindowItem & ); + +public: + TYPEINFO(); + XWindowItem(); + explicit XWindowItem( USHORT nWhich, Window * pWin ); + XWindowItem( USHORT nWhich, com::sun::star::uno::Reference< com::sun::star::awt::XWindow > & rxWin ); + XWindowItem( const XWindowItem &rItem ); + ~XWindowItem(); + + virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const; + virtual int operator == ( const SfxPoolItem& rAttr ) const; + + Window * GetWindowPtr() const { return VCLUnoHelper::GetWindow( m_xWin ); } + com::sun::star::uno::Reference< com::sun::star::awt::XWindow > GetXWindow() const { return m_xWin; } +}; + +////////////////////////////////////////////////////////////////////// + +#endif + diff --git a/svtools/inc/tabbar.hxx b/svtools/inc/tabbar.hxx index cf89d4426726..e036f4c2f045 100644 --- a/svtools/inc/tabbar.hxx +++ b/svtools/inc/tabbar.hxx @@ -320,9 +320,6 @@ typedef USHORT TabBarPageBits; // - TabBar-Types - // ---------------- -#define TABBAR_APPEND ((USHORT)0xFFFF) -#define TABBAR_PAGE_NOTFOUND ((USHORT)0xFFFF) - #define TABBAR_RENAMING_YES ((long)TRUE) #define TABBAR_RENAMING_NO ((long)FALSE) #define TABBAR_RENAMING_CANCEL ((long)2) @@ -400,6 +397,9 @@ private: DECL_DLLPRIVATE_LINK( ImplClickHdl, ImplTabButton* ); public: + static const sal_uInt16 APPEND; + static const sal_uInt16 PAGE_NOT_FOUND; + TabBar( Window* pParent, WinBits nWinStyle = WB_STDTABBAR ); virtual ~TabBar(); @@ -424,9 +424,14 @@ public: void InsertPage( USHORT nPageId, const XubString& rText, TabBarPageBits nBits = 0, - USHORT nPos = TABBAR_APPEND ); + USHORT nPos = TabBar::APPEND ); void RemovePage( USHORT nPageId ); void MovePage( USHORT nPageId, USHORT nNewPos ); + + Color GetTabBgColor( USHORT nPageId ) const; + void SetTabBgColor( USHORT nPageId, const Color& aTabBgColor ); + BOOL IsDefaultTabBgColor( USHORT nPageId ); + void Clear(); void EnablePage( USHORT nPageId, BOOL bEnable = TRUE ); @@ -453,7 +458,7 @@ public: void SelectPage( USHORT nPageId, BOOL bSelect = TRUE ); void SelectPageRange( BOOL bSelect = FALSE, USHORT nStartPos = 0, - USHORT nEndPos = TABBAR_APPEND ); + USHORT nEndPos = TabBar::APPEND ); USHORT GetSelectPage( USHORT nSelIndex = 0 ) const; USHORT GetSelectPageCount() const; BOOL IsPageSelected( USHORT nPageId ) const; diff --git a/svtools/prj/build.lst b/svtools/prj/build.lst index 2645b9e6bf6a..a7d8569de301 100644 --- a/svtools/prj/build.lst +++ b/svtools/prj/build.lst @@ -23,8 +23,9 @@ 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\toolpanel nmake - all st_toolpanel st_inc NULL st svtools\source\uno nmake - all st_uno st_inc NULL +st svtools\source\uno\wizard nmake - all st_uno_wiz st_inc NULL st svtools\source\urlobj nmake - all st__url st_inc NULL -st svtools\util nmake - all st_util st_svtgraphic 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_toolpanel st_uno st_vfilt st_vigif st_vixbm st_vixpm st_vjpeg st_vwmf st_svtjava NULL +st svtools\util nmake - all st_util st_svtgraphic 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_toolpanel st_uno st_uno_wiz 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\productregistration nmake - all st_prodreg st_util st_inc NULL st svtools\workben\unodialog nmake - all st_workben_udlg st_util NULL diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index 843de83f7710..af19379d8b8f 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -54,6 +54,9 @@ #include <vcl/waitobj.hxx> #include <com/sun/star/io/XPersist.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/ucb/XCommandInfo.hpp> +#include <com/sun/star/beans/XPropertySetInfo.hpp> +#include <com/sun/star/beans/PropertyAttribute.hpp> #include <algorithm> #include <memory> @@ -100,7 +103,7 @@ using ::rtl::OUString; DECLARE_LIST( StringList_Impl, OUString* ) -#define ROW_HEIGHT 17 // the height of a row has to be a little higher than the bitmap +#define ROW_HEIGHT 17 // the height of a row has to be a little higher than the bitmap #define QUICK_SEARCH_TIMEOUT 1500 // time in mSec before the quicksearch string will be reseted namespace @@ -210,6 +213,7 @@ private: sal_Bool mbResizeDisabled : 1; sal_Bool mbAutoResize : 1; sal_Bool mbEnableDelete : 1; + sal_Bool mbEnableRename : 1; void DeleteEntries(); void DoQuickSearch( const xub_Unicode& rChar ); @@ -232,6 +236,7 @@ public: void EnableAutoResize() { mbAutoResize = sal_True; } void EnableDelete( sal_Bool bEnable ) { mbEnableDelete = bEnable; } + void EnableRename( sal_Bool bEnable ) { mbEnableRename = bEnable; } sal_Bool IsDeleteOrContextMenuEnabled() { return mbEnableDelete || IsContextMenuHandlingEnabled(); } Reference< XCommandEnvironment > GetCommandEnvironment() const { return mxCmdEnv; } @@ -299,11 +304,11 @@ inline const OUString& HashedEntry::GetName() const class HashedEntryList : protected List {// provides a list of _unique_ Entries protected: - inline HashedEntry* First(); - inline HashedEntry* Next(); - inline void Append( HashedEntry* pNewEntry ); + inline HashedEntry* First(); + inline HashedEntry* Next(); + inline void Append( HashedEntry* pNewEntry ); public: - virtual ~HashedEntryList(); + virtual ~HashedEntryList(); const HashedEntry* Find( const OUString& rNameToSearchFor ); const HashedEntry* Find( const HashedEntry& rToSearchFor ); @@ -338,7 +343,7 @@ HashedEntryList::~HashedEntryList() const HashedEntry* HashedEntryList::Find( const OUString& rRefName ) { // simple linear search, which should be fast enough for this purpose - HashedEntry aRef( rRefName ); + HashedEntry aRef( rRefName ); HashedEntry* pIter = First(); while( pIter && *pIter != aRef ) pIter = Next(); @@ -419,12 +424,12 @@ class NameTranslationList : protected HashedEntryList { // contains a list of substitutes of strings for a given folder (as URL) // explanation of the circumstances see in remarks for Init(); protected: - INetURLObject maTransFile; // URL of file with translation entries - HashedEntry maHashedURL; // for future purposes when dealing with a set of cached - // NameTranslationLists + INetURLObject maTransFile; // URL of file with translation entries + HashedEntry maHashedURL; // for future purposes when dealing with a set of cached + // NameTranslationLists private: const String maTransFileName; - void Init(); // reads the translation file and fills the (internal) list + void Init(); // reads the translation file and fills the (internal) list public: NameTranslationList( const INetURLObject& rBaseURL ); @@ -436,12 +441,12 @@ public: using List::operator!=; inline sal_Bool operator !=( const HashedEntry& rRef ) const; - const OUString* Translate( const OUString& rName ) const; + const OUString* Translate( const OUString& rName ) const; // returns NULL, if rName can't be found - inline void Update(); // clears list and init + inline void Update(); // clears list and init - inline const String& GetTransTableFileName() const; + inline const String& GetTransTableFileName() const; // returns the name for the file, which contains the translation strings }; @@ -463,7 +468,7 @@ void NameTranslationList::Init() if( aTestContent.isDocument() ) {// ... also tests the existence of maTransFile by throwing an Exception - const sal_Char* pSection = "TRANSLATIONNAMES"; + const sal_Char* pSection = "TRANSLATIONNAMES"; String aFsysName( maTransFile.getFSysPath( INetURLObject::FSYS_DETECT ) ); Config aConfig( aFsysName ); @@ -475,7 +480,7 @@ void NameTranslationList::Init() Insert( new NameTranslationEntry( aConfig.GetKeyName( nCnt ), aConfig.ReadKey( nCnt ) ) ); } } - catch( Exception& ) {} + catch( Exception const & ) {} } NameTranslationList::NameTranslationList( const INetURLObject& rBaseURL ): @@ -527,7 +532,7 @@ public: // IContentTitleTranslation virtual sal_Bool GetTranslation( const OUString& rOriginalName, OUString& rTranslatedName ) const; - void UpdateTranslationTable(); // reads the translation file again + void UpdateTranslationTable(); // reads the translation file again void SetActualFolder( const INetURLObject& rActualFolder ); const String* GetTransTableFileName() const; @@ -600,7 +605,7 @@ public: void OpenFolder_Impl(); // #83004# ------- - void ReplaceTabWithString( OUString& aValue ); + void ReplaceTabWithString( OUString& aValue ); void CreateDisplayText_Impl(); void CreateVector_Impl( const Sequence < OUString > &rList ); void SortFolderContent_Impl(); @@ -661,11 +666,13 @@ inline void SvtFileView_Impl::EnableDelete( sal_Bool bEnable ) inline sal_Bool SvtFileView_Impl::EnableNameReplacing( sal_Bool bEnable ) { + mpView->EnableRename( bEnable ); + sal_Bool bRet; if( mpView->IsDeleteOrContextMenuEnabled() ) { DBG_ASSERT( !mbReplaceNames, "SvtFileView_Impl::EnableNameReplacing(): state should be not possible!" ); - bRet = !bEnable; // only for enabling this is an unsuccessful result + bRet = !bEnable; // only for enabling this is an unsuccessful result } else { @@ -744,7 +751,8 @@ ViewTabListBox_Impl::ViewTabListBox_Impl( Window* pParentWin, mnSearchIndex ( 0 ), mbResizeDisabled ( sal_False ), mbAutoResize ( sal_False ), - mbEnableDelete ( sal_True ) + mbEnableDelete ( sal_True ), + mbEnableRename ( sal_True ) { Size aBoxSize = pParentWin->GetSizePixel(); @@ -824,7 +832,7 @@ void ViewTabListBox_Impl::Resize() mbResizeDisabled = sal_True; Point aPos = GetPosPixel(); SetPosSizePixel( Point( 0, aBarSize.Height() ), - Size( aBoxSize.Width(), aBoxSize.Height() - aBarSize.Height() ) ); + Size( aBoxSize.Width(), aBoxSize.Height() - aBarSize.Height() ) ); mbResizeDisabled = sal_False; } } @@ -870,20 +878,90 @@ void ViewTabListBox_Impl::KeyInput( const KeyEvent& rKEvt ) PopupMenu* ViewTabListBox_Impl::CreateContextMenu( void ) { - PopupMenu* pRet; - sal_Int32 nSelectedEntries = GetSelectionCount(); + bool bEnableDelete = mbEnableDelete; + bool bEnableRename = mbEnableRename; + + if ( bEnableDelete || bEnableRename ) + { + sal_Int32 nSelectedEntries = GetSelectionCount(); + bEnableDelete &= nSelectedEntries > 0; + bEnableRename &= nSelectedEntries == 1; + } + + if ( bEnableDelete || bEnableRename ) + { + SvLBoxEntry* pEntry = FirstSelected(); + while ( pEntry ) + { + ::ucbhelper::Content aCnt; + try + { + OUString aURL( static_cast< SvtContentEntry * >( + pEntry->GetUserData() )->maURL ); + aCnt = ::ucbhelper::Content( aURL, mxCmdEnv ); + } + catch( Exception const & ) + { + bEnableDelete = bEnableRename = false; + } + + if ( bEnableDelete ) + { + try + { + Reference< XCommandInfo > aCommands = aCnt.getCommands(); + if ( aCommands.is() ) + bEnableDelete + = aCommands->hasCommandByName( + OUString::createFromAscii( "delete" ) ); + else + bEnableDelete = false; + } + catch( Exception const & ) + { + bEnableDelete = false; + } + } + + if ( bEnableRename ) + { + try + { + Reference< XPropertySetInfo > aProps = aCnt.getProperties(); + if ( aProps.is() ) + { + Property aProp + = aProps->getPropertyByName( + OUString::createFromAscii( "Title" ) ); + bEnableRename + = !( aProp.Attributes & PropertyAttribute::READONLY ); + } + else + bEnableRename = false; + } + catch( Exception const & ) + { + bEnableRename = false; + } + } + + pEntry = ( bEnableDelete || bEnableRename ) + ? NextSelected( pEntry ) + : 0; + } + } - if ( nSelectedEntries ) + if ( bEnableDelete || bEnableRename ) { - pRet = new PopupMenu( SvtResId( RID_FILEVIEW_CONTEXTMENU ) ); - pRet->EnableItem( MID_FILEVIEW_DELETE, 0 < nSelectedEntries ); - pRet->EnableItem( MID_FILEVIEW_RENAME, 1 == nSelectedEntries ); + PopupMenu * pRet + = new PopupMenu( SvtResId( RID_FILEVIEW_CONTEXTMENU ) ); + pRet->EnableItem( MID_FILEVIEW_DELETE, bEnableDelete ); + pRet->EnableItem( MID_FILEVIEW_RENAME, bEnableRename ); pRet->RemoveDisabledEntries( sal_True, sal_True ); + return pRet; } - else - pRet = NULL; - return pRet; + return NULL; } // ----------------------------------------------------------------------- @@ -928,12 +1006,31 @@ void ViewTabListBox_Impl::DeleteEntries() aURL = ( (SvtContentEntry*)pCurEntry->GetUserData() )->maURL; if ( !aURL.Len() ) - return; + continue; + + bool canDelete = true; + try + { + ::ucbhelper::Content aCnt( aURL, mxCmdEnv ); + Reference< XCommandInfo > aCommands = aCnt.getCommands(); + if ( aCommands.is() ) + canDelete + = aCommands->hasCommandByName( + OUString::createFromAscii( "delete" ) ); + else + canDelete = false; + } + catch( Exception const & ) + { + canDelete = false; + } - INetURLObject aObj( aURL ); + if (!canDelete) + continue; // process next entry if ( eResult != svtools::QUERYDELETE_ALL ) { + INetURLObject aObj( aURL ); svtools::QueryDeleteDlg_Impl aDlg( NULL, aObj.GetName( INetURLObject::DECODE_WITH_CHARSET ) ); if ( sDialogPosition.Len() ) aDlg.SetWindowState( sDialogPosition ); @@ -979,22 +1076,44 @@ BOOL ViewTabListBox_Impl::EditedEntry( SvLBoxEntry* pEntry, try { + OUString aPropName = OUString::createFromAscii( "Title" ); + bool canRename = true; ::ucbhelper::Content aContent( aURL, mxCmdEnv ); - OUString aPropName = OUString::createFromAscii( "Title" ); - Any aValue; - aValue <<= OUString( rNewText ); - aContent.setPropertyValue( aPropName, aValue ); - mpParent->EntryRenamed( aURL, rNewText ); + try + { + Reference< XPropertySetInfo > aProps = aContent.getProperties(); + if ( aProps.is() ) + { + Property aProp = aProps->getPropertyByName( aPropName ); + canRename = !( aProp.Attributes & PropertyAttribute::READONLY ); + } + else + { + canRename = false; + } + } + catch ( Exception const & ) + { + canRename = false; + } + + if ( canRename ) + { + Any aValue; + aValue <<= OUString( rNewText ); + aContent.setPropertyValue( aPropName, aValue ); + mpParent->EntryRenamed( aURL, rNewText ); - pData->maURL = aURL; - pEntry->SetUserData( pData ); + pData->maURL = aURL; + pEntry->SetUserData( pData ); - bRet = TRUE; + bRet = TRUE; + } + } + catch( Exception const & ) + { } - catch( ::com::sun::star::ucb::ContentCreationException ) {} - catch( ::com::sun::star::ucb::CommandAbortedException ) {} - catch( ::com::sun::star::uno::Exception ) {} return bRet; } @@ -1095,12 +1214,12 @@ sal_Bool ViewTabListBox_Impl::Kill( const OUString& rContent ) ::ucbhelper::Content aCnt( rContent, mxCmdEnv ); aCnt.executeCommand( OUString::createFromAscii( "delete" ), makeAny( sal_Bool( sal_True ) ) ); } - catch( ::com::sun::star::ucb::CommandAbortedException& ) + catch( ::com::sun::star::ucb::CommandAbortedException const & ) { DBG_WARNING( "CommandAbortedException" ); bRet = sal_False; } - catch( ::com::sun::star::uno::Exception& ) + catch( Exception const & ) { DBG_WARNING( "Any other exception" ); bRet = sal_False; @@ -1314,7 +1433,7 @@ sal_Bool SvtFileView::GetParentURL( String& rParentURL ) const } } } - catch( ::com::sun::star::uno::Exception ) + catch( Exception const & ) { // perhaps an unkown url protocol (e.g. "private:newdoc") } @@ -1366,7 +1485,7 @@ sal_Bool SvtFileView::Initialize( const ::com::sun::star::uno::Reference< ::com: mpImp->FilterFolderContent_Impl( rFilter ); - mpImp->SortFolderContent_Impl(); // possibly not necessary!!!!!!!!!! + mpImp->SortFolderContent_Impl(); // possibly not necessary!!!!!!!!!! mpImp->CreateDisplayText_Impl(); mpImp->OpenFolder_Impl(); @@ -1999,7 +2118,7 @@ void SvtFileView_Impl::FilterFolderContent_Impl( const OUString &rFilter ) { // normalize the content title (we always match case-insensitive) // 91872 - 11.09.2001 - frank.schoenheit@sun.com - sCompareString = (*aContentLoop)->GetFileName(); // filter works on file name, not on title! + sCompareString = (*aContentLoop)->GetFileName(); // filter works on file name, not on title! sal_Bool bDelete; if( bHideTransFile && sCompareString == sHideEntry ) @@ -2643,12 +2762,12 @@ QueryDeleteDlg_Impl::QueryDeleteDlg_Impl ModalDialog( pParent, SvtResId( DLG_SVT_QUERYDELETE ) ), - _aEntryLabel ( this, SvtResId( TXT_ENTRY ) ), - _aEntry ( this, SvtResId( TXT_ENTRYNAME ) ), - _aQueryMsg ( this, SvtResId( TXT_QUERYMSG ) ), - _aYesButton ( this, SvtResId( BTN_YES ) ), - _aAllButton ( this, SvtResId( BTN_ALL ) ), - _aNoButton ( this, SvtResId( BTN_NO ) ), + _aEntryLabel ( this, SvtResId( TXT_ENTRY ) ), + _aEntry ( this, SvtResId( TXT_ENTRYNAME ) ), + _aQueryMsg ( this, SvtResId( TXT_QUERYMSG ) ), + _aYesButton ( this, SvtResId( BTN_YES ) ), + _aAllButton ( this, SvtResId( BTN_ALL ) ), + _aNoButton ( this, SvtResId( BTN_NO ) ), _aCancelButton( this, SvtResId( BTN_CANCEL ) ) { @@ -2671,12 +2790,6 @@ QueryDeleteDlg_Impl::QueryDeleteDlg_Impl // ----------------------------------------------------------------------- IMPL_STATIC_LINK( QueryDeleteDlg_Impl, ClickLink, PushButton*, pBtn ) - -/* [Beschreibung] - - Die Methode wertet das Resultat der Abfrage aus. -*/ - { if ( pBtn == &pThis->_aYesButton ) pThis->_eResult = QUERYDELETE_YES; diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index 671b5a9f54e5..484584828b9f 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -1067,14 +1067,14 @@ void SvImpLBox::DrawNet() //so that SvImpLBox::DrawNet() doesn't draw anything too if(pView->IsNativeControlSupported( CTRL_LISTNET, PART_ENTIRE_CONTROL)) { ImplControlValue aControlValue; - Point aTemp(0,0); // temporary needed for g++ 3.3.5 - Region aCtrlRegion( Rectangle(aTemp, Size( 0, 0 )) ); + Point aTemp(0,0); // temporary needed for g++ 3.3.5 + Rectangle aCtrlRegion( aTemp, Size( 0, 0 ) ); ControlState nState = CTRL_STATE_ENABLED; - if( pView->DrawNativeControl( CTRL_LISTNET, PART_ENTIRE_CONTROL, - aCtrlRegion, nState, aControlValue, rtl::OUString() ) ) - { - return; - } + if( pView->DrawNativeControl( CTRL_LISTNET, PART_ENTIRE_CONTROL, + aCtrlRegion, nState, aControlValue, rtl::OUString() ) ) + { + return; + } } @@ -3115,7 +3115,7 @@ void lcl_DeleteSubPopups(PopupMenu* pPopup) } } -void SvImpLBox::Command( const CommandEvent& rCEvt ) +bool SvImpLBox::Command( const CommandEvent& rCEvt ) { USHORT nCommand = rCEvt.GetCommand(); @@ -3123,9 +3123,22 @@ void SvImpLBox::Command( const CommandEvent& rCEvt ) aEditTimer.Stop(); // Rollmaus-Event? - if( ( ( nCommand == COMMAND_WHEEL ) || ( nCommand == COMMAND_STARTAUTOSCROLL ) || ( nCommand == COMMAND_AUTOSCROLL ) ) - && pView->HandleScrollCommand( rCEvt, &aHorSBar, &aVerSBar ) ) - return; + if ( ( ( nCommand == COMMAND_WHEEL ) + || ( nCommand == COMMAND_STARTAUTOSCROLL ) + || ( nCommand == COMMAND_AUTOSCROLL ) + ) + && pView->HandleScrollCommand( rCEvt, &aHorSBar, &aVerSBar ) + ) + { + return true; + } + + if ( ( nCommand == COMMAND_CONTEXTMENU ) + && !bContextMenuHandling + ) + { + return false; + } if( bContextMenuHandling && nCommand == COMMAND_CONTEXTMENU ) { @@ -3174,8 +3187,6 @@ void SvImpLBox::Command( const CommandEvent& rCEvt ) { // deselect all pView->SelectAll( FALSE ); } - - } else { // key event (or at least no mouse event) @@ -3235,15 +3246,18 @@ void SvImpLBox::Command( const CommandEvent& rCEvt ) aSelRestore.pop(); } } + return true; } -#ifndef NOCOMMAND - else - { - const Point& rPos = rCEvt.GetMousePosPixel(); - if( rPos.X() < aOutputSize.Width() && rPos.Y() < aOutputSize.Height() ) - aSelEng.Command( rCEvt ); - } -#endif + + const Point& rPos = rCEvt.GetMousePosPixel(); + if( rPos.X() < aOutputSize.Width() && rPos.Y() < aOutputSize.Height() ) + aSelEng.Command( rCEvt ); + + // strictly, this is not correct. However, it leads to a behavior compatible to the one at the time + // when this method did have a void return value ... + // A proper solution would be to give the EditEngine::Command also a boolean return value, and forward + // this (or false) to our caller + return true; } void SvImpLBox::BeginScroll() diff --git a/svtools/source/contnr/svlbitm.cxx b/svtools/source/contnr/svlbitm.cxx index 82321b53259e..d260f984c2b0 100644 --- a/svtools/source/contnr/svlbitm.cxx +++ b/svtools/source/contnr/svlbitm.cxx @@ -406,7 +406,7 @@ BOOL SvLBoxButton::ClickHdl( SvLBox*, SvLBoxEntry* pEntry ) } void SvLBoxButton::Paint( const Point& rPos, SvLBox& rDev, USHORT /* nFlags */, - SvLBoxEntry* ) + SvLBoxEntry* /*pEntry*/ ) { DBG_CHKTHIS(SvLBoxButton,0); USHORT nIndex = eKind == SvLBoxButtonKind_staticImage @@ -418,14 +418,13 @@ void SvLBoxButton::Paint( const Point& rPos, SvLBox& rDev, USHORT /* nFlags */, //Native drawing /// BOOL bNativeOK = FALSE; - Window *pWin = NULL; - if( rDev.GetOutDevType() == OUTDEV_WINDOW ) - pWin = (Window*) &rDev; - - if ( nIndex != SV_BMP_STATICIMAGE && pWin && pWin->IsNativeControlSupported( (pData->IsRadio())? CTRL_RADIOBUTTON : CTRL_CHECKBOX, PART_ENTIRE_CONTROL) ) + ControlType eCtrlType = (pData->IsRadio())? CTRL_RADIOBUTTON : CTRL_CHECKBOX; + if ( nIndex != SV_BMP_STATICIMAGE && rDev.IsNativeControlSupported( eCtrlType, PART_ENTIRE_CONTROL) ) { + Size aSize(pData->Width(), pData->Height()); + ImplAdjustBoxSize( aSize, eCtrlType, &rDev ); ImplControlValue aControlValue; - Region aCtrlRegion( Rectangle(rPos, Size(pData->Width(), pData->Height())) ); + Rectangle aCtrlRegion( rPos, aSize ); ControlState nState = 0; //states CTRL_STATE_DEFAULT, CTRL_STATE_PRESSED and CTRL_STATE_ROLLOVER are not implemented @@ -439,7 +438,7 @@ void SvLBoxButton::Paint( const Point& rPos, SvLBox& rDev, USHORT /* nFlags */, else if ( IsStateTristate() ) aControlValue.setTristateVal( BUTTONVALUE_MIXED ); - bNativeOK = pWin->DrawNativeControl( (pData->IsRadio())? CTRL_RADIOBUTTON : CTRL_CHECKBOX, PART_ENTIRE_CONTROL, + bNativeOK = rDev.DrawNativeControl( eCtrlType, PART_ENTIRE_CONTROL, aCtrlRegion, nState, aControlValue, rtl::OUString() ); } @@ -459,13 +458,47 @@ void SvLBoxButton::Clone( SvLBoxItem* pSource ) pData = ((SvLBoxButton*)pSource)->pData; } +void SvLBoxButton::ImplAdjustBoxSize( Size& io_rSize, ControlType i_eType, Window* i_pParent ) +{ + if ( i_pParent->IsNativeControlSupported( i_eType, PART_ENTIRE_CONTROL) ) + { + ImplControlValue aControlValue; + Rectangle aCtrlRegion( Point( 0, 0 ), io_rSize ); + ControlState nState = CTRL_STATE_ENABLED; + + aControlValue.setTristateVal( BUTTONVALUE_ON ); + + Rectangle aNativeBounds, aNativeContent; + bool bNativeOK = i_pParent->GetNativeControlRegion( i_eType, + PART_ENTIRE_CONTROL, + aCtrlRegion, + nState, + aControlValue, + rtl::OUString(), + aNativeBounds, + aNativeContent ); + if( bNativeOK ) + { + Size aContentSize( aNativeContent.GetSize() ); + // leave a little space around the box image (looks better + if( aContentSize.Height() + 2 > io_rSize.Height() ) + io_rSize.Height() = aContentSize.Height() + 2; + } + } +} + void SvLBoxButton::InitViewData( SvLBox* pView,SvLBoxEntry* pEntry, SvViewDataItem* pViewData ) { DBG_CHKTHIS(SvLBoxButton,0); if( !pViewData ) pViewData = pView->GetViewDataItem( pEntry, this ); - pViewData->aSize = Size( pData->Width(), pData->Height() ); + Size aSize( pData->Width(), pData->Height() ); + + ControlType eCtrlType = (pData->IsRadio())? CTRL_RADIOBUTTON : CTRL_CHECKBOX; + if ( eKind != SvLBoxButtonKind_staticImage && pView ) + ImplAdjustBoxSize( aSize, eCtrlType, pView ); + pViewData->aSize = aSize; } bool SvLBoxButton::CheckModification() const diff --git a/svtools/source/contnr/svlbox.cxx b/svtools/source/contnr/svlbox.cxx index 2752e813052e..fb71f64772ad 100644 --- a/svtools/source/contnr/svlbox.cxx +++ b/svtools/source/contnr/svlbox.cxx @@ -1515,9 +1515,10 @@ void SvLBox::MakeVisible( SvLBoxEntry* ) DBG_CHKTHIS(SvLBox,0); } -void SvLBox::Command( const CommandEvent& ) +void SvLBox::Command( const CommandEvent& i_rCommandEvent ) { DBG_CHKTHIS(SvLBox,0); + Control::Command( i_rCommandEvent ); } void SvLBox::KeyInput( const KeyEvent& rKEvt ) @@ -1774,10 +1775,14 @@ void SvLBox::StartDrag( sal_Int8, const Point& rPosPixel ) { DBG_CHKTHIS(SvLBox,0); + nOldDragMode = GetDragDropMode(); + if ( !nOldDragMode ) + return; + ReleaseMouse(); + SvLBoxEntry* pEntry = GetEntry( rPosPixel ); // GetDropTarget( rPos ); - nOldDragMode = GetDragDropMode(); - if( !pEntry || !nOldDragMode ) + if( !pEntry ) { DragFinished( DND_ACTION_NONE ); return; diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx index 736f27a1eafb..b11a3f12ddf3 100644 --- a/svtools/source/contnr/svtreebx.cxx +++ b/svtools/source/contnr/svtreebx.cxx @@ -40,6 +40,7 @@ class TabBar; #include <svtools/svlbox.hxx> #include <svtools/svlbitm.hxx> #include <svtools/svtreebx.hxx> +#include <tools/diagnose_ex.h> #include <svimpbox.hxx> #include <unotools/accessiblestatesethelper.hxx> #include <com/sun/star/accessibility/AccessibleStateType.hpp> @@ -427,17 +428,6 @@ SvLBoxEntry* SvTreeListBox::InsertEntry( const XubString& aText,SvLBoxEntry* pPa else SvLBox::Insert( pEntry, pParent, nPos ); - short nExpWidth = (short)rDefExpBmp.GetSizePixel().Width(); - short nColWidth = (short)rDefColBmp.GetSizePixel().Width(); - short nMax = Max(nExpWidth, nColWidth); - // #97680# ---------------- - nMax = pImp->UpdateContextBmpWidthVector( pEntry, nMax ); - if( nMax > nContextBmpWidthMax ) - { - nContextBmpWidthMax = nMax; - SetTabs(); - } - aPrevInsertedExpBmp = rDefExpBmp; aPrevInsertedColBmp = rDefColBmp; @@ -468,17 +458,6 @@ SvLBoxEntry* SvTreeListBox::InsertEntry( const XubString& aText, else SvLBox::Insert( pEntry, pParent, nPos ); - short nExpWidth = (short)aExpEntryBmp.GetSizePixel().Width(); - short nColWidth = (short)aCollEntryBmp.GetSizePixel().Width(); - short nMax = Max(nExpWidth, nColWidth); - // #97680# ---------------- - nMax = pImp->UpdateContextBmpWidthVector( pEntry, nMax ); - if( nMax > nContextBmpWidthMax ) - { - nContextBmpWidthMax = nMax; - SetTabs(); - } - aPrevInsertedExpBmp = aExpEntryBmp; aPrevInsertedColBmp = aCollEntryBmp; @@ -1835,7 +1814,7 @@ long SvTreeListBox::PaintEntry1(SvLBoxEntry* pEntry,long nLine,USHORT nTabFlags, if ( IsNativeControlSupported( CTRL_LISTNODE, PART_ENTIRE_CONTROL) ) { ImplControlValue aControlValue; - Region aCtrlRegion( Rectangle(aPos, pImg->GetSizePixel() ) ); + Rectangle aCtrlRegion( aPos, pImg->GetSizePixel() ); ControlState nState = 0; if ( IsEnabled() ) nState |= CTRL_STATE_ENABLED; @@ -2250,7 +2229,8 @@ Region SvTreeListBox::GetDragRegion() const void SvTreeListBox::Command( const CommandEvent& rCEvt ) { DBG_CHKTHIS(SvTreeListBox,0); - pImp->Command( rCEvt ); + if ( !pImp->Command( rCEvt ) ) + SvLBox::Command( rCEvt ); } @@ -2346,6 +2326,25 @@ void SvTreeListBox::ModelNotification( USHORT nActionId, SvListEntry* pEntry1, SvLBox::ModelNotification( nActionId, pEntry1, pEntry2, nPos ); switch( nActionId ) { + case LISTACTION_INSERTED: + { + SvLBoxEntry* pEntry( dynamic_cast< SvLBoxEntry* >( pEntry1 ) ); + ENSURE_OR_BREAK( pEntry, "SvTreeListBox::ModelNotification: invalid entry!" ); + SvLBoxContextBmp* pBmpItem = static_cast< SvLBoxContextBmp* >( pEntry->GetFirstItem( SV_ITEM_ID_LBOXCONTEXTBMP ) ); + if ( !pBmpItem ) + break; + const Image& rBitmap1( pBmpItem->GetBitmap1() ); + const Image& rBitmap2( pBmpItem->GetBitmap2() ); + short nMaxWidth = short( Max( rBitmap1.GetSizePixel().Width(), rBitmap2.GetSizePixel().Width() ) ); + nMaxWidth = pImp->UpdateContextBmpWidthVector( pEntry, nMaxWidth ); + if( nMaxWidth > nContextBmpWidthMax ) + { + nContextBmpWidthMax = nMaxWidth; + SetTabs(); + } + } + break; + case LISTACTION_RESORTING: SetUpdateMode( FALSE ); break; diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index c4896ba8b812..2ad81da40716 100644..100755 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -39,6 +39,8 @@ #include <vcl/edit.hxx> #include "svtaccessiblefactory.hxx" +#include <limits> + // ======================================================================= #define TABBAR_OFFSET_X 7 @@ -62,6 +64,10 @@ struct ImplTabBarItem BOOL mbShort; BOOL mbSelect; BOOL mbEnable; + Color maTabBgColor; + bool IsDefaultTabBgColor() const { return maTabBgColor == Color(COL_AUTO) ? TRUE : FALSE; }; + Color maTabTextColor; + bool IsDefaultTabTextColor() const { return maTabTextColor == Color(COL_AUTO) ? TRUE : FALSE; }; ImplTabBarItem( USHORT nItemId, const XubString& rText, TabBarPageBits nPageBits ) : @@ -74,6 +80,8 @@ struct ImplTabBarItem mbShort = FALSE; mbSelect = FALSE; mbEnable = TRUE; + maTabBgColor = Color( COL_AUTO ); + maTabTextColor = Color( COL_AUTO ); } }; @@ -348,6 +356,9 @@ struct TabBar_Impl // ======================================================================= +const sal_uInt16 TabBar::APPEND = ::std::numeric_limits<sal_uInt16>::max(); +const sal_uInt16 TabBar::PAGE_NOT_FOUND = ::std::numeric_limits<sal_uInt16>::max(); + void TabBar::ImplInit( WinBits nWinStyle ) { mpItemList = new ImplTabBarList; @@ -1046,7 +1057,8 @@ void TabBar::Paint( const Rectangle& ) // Font selektieren Font aFont = GetFont(); Font aLightFont = aFont; - aLightFont.SetWeight( WEIGHT_LIGHT ); + //aLightFont.SetWeight( WEIGHT_LIGHT ); //TODO Make font weight light on custom color only? + aLightFont.SetWeight( WEIGHT_NORMAL ); // #i36013# exclude push buttons from painting area Rectangle aClipRect( Point( mnOffX, 0 ), Point( mnLastOffX, GetOutputHeightPixel() - 1 ) ); @@ -1120,15 +1132,23 @@ void TabBar::Paint( const Rectangle& ) SetFont( aLightFont ); // Je nach Status die richtige FillInBrush setzen + // Set the correct FillInBrush depending upon status if ( pItem->mbSelect || (pItem->mnId == mnCurPageId) ) { + // Currently selected Tab SetFillColor( aSelectColor ); SetTextColor( aSelectTextColor ); } else { - SetFillColor( aFaceColor ); - SetTextColor( aFaceTextColor ); + if ( !pItem->IsDefaultTabBgColor() && !rStyleSettings.GetHighContrastMode() ) + { + SetFillColor( pItem->maTabBgColor ); + SetTextColor( pItem->maTabTextColor ); + } else { + SetFillColor( aFaceColor ); + SetTextColor( aFaceTextColor ); + } } // Muss Font Kursiv geschaltet werden @@ -1160,21 +1180,38 @@ void TabBar::Paint( const Rectangle& ) long nTextHeight = GetTextHeight(); Point aTxtPos( aRect.Left()+(aRectSize.Width()-nTextWidth)/2, (aRectSize.Height()-nTextHeight)/2 ); - if ( !pItem->mbEnable ) - DrawCtrlText( aTxtPos, aText, 0, STRING_LEN, (TEXT_DRAW_DISABLE | TEXT_DRAW_MNEMONIC) ); - else - DrawText( aTxtPos, aText ); - + if ( pItem->IsDefaultTabBgColor() || (!pItem->mbSelect) ) + { + if ( !pItem->mbEnable ) + DrawCtrlText( aTxtPos, aText, 0, STRING_LEN, (TEXT_DRAW_DISABLE | TEXT_DRAW_MNEMONIC) ); + else + DrawText( aTxtPos, aText ); + } // Jetzt im Inhalt den 3D-Effekt ausgeben aPos0.X()++; aPos1.X()++; aPos2.X()--; aPos3.X()--; - SetLineColor( rStyleSettings.GetLightColor() ); + + // If this is the current tab, draw the left inner shadow the default color, + // otherwise make it the same as the custom background color + if ( pItem->mbSelect || (pItem->mnId == mnCurPageId) ) { + SetLineColor( rStyleSettings.GetLightColor() ); + } else { + if ( !pItem->IsDefaultTabBgColor() && ! rStyleSettings.GetHighContrastMode() ) + { + SetLineColor( pItem->maTabBgColor ); + } else { + SetLineColor( rStyleSettings.GetLightColor() ); + } + } + // Draw the left side of the tab DrawLine( aPos0, aPos1 ); if ( !pItem->mbSelect && (pItem->mnId != mnCurPageId) ) { + // Draw the top inner shadow + // ToDo: Change from this static color to tab custom bg color DrawLine( Point( aPos0.X(), aPos0.Y()+1 ), Point( aPos3.X(), aPos3.Y()+1 ) ); } @@ -1184,8 +1221,27 @@ void TabBar::Paint( const Rectangle& ) aPos1.X()--; aPos1.Y()--; aPos2.Y()--; + if ( !pItem->IsDefaultTabBgColor() && ( pItem->mbSelect || (pItem->mnId == mnCurPageId) ) ) + { + SetLineColor( pItem->maTabBgColor ); + DrawLine( Point(aPos1.X()-1, aPos1.Y()-1), Point(aPos2.X(), aPos2.Y()-1) ); + } DrawLine( aPos1, aPos2 ); + // draw a small 2px sliver of the original background color at the bottom of the selected tab + + if ( !pItem->IsDefaultTabBgColor() ) + { + if ( pItem->mbSelect || (pItem->mnId == mnCurPageId) || rStyleSettings.GetHighContrastMode() ) { + SetLineColor( pItem->maTabBgColor ); + DrawLine( Point(aPos1.X()-1, aPos1.Y()-1), Point(aPos2.X(), aPos2.Y()-1) ); + if ( !pItem->mbEnable ) + DrawCtrlText( aTxtPos, aText, 0, STRING_LEN, (TEXT_DRAW_DISABLE | TEXT_DRAW_MNEMONIC) ); + else + DrawText( aTxtPos, aText ); + } + } + // Da etwas uebermalt werden konnte, muessen wir die Polygon- // umrandung nocheinmal ausgeben SetLineColor( rStyleSettings.GetDarkShadowColor() ); @@ -1540,7 +1596,7 @@ void TabBar::InsertPage( USHORT nPageId, const XubString& rText, TabBarPageBits nBits, USHORT nPos ) { DBG_ASSERT( nPageId, "TabBar::InsertPage(): PageId == 0" ); - DBG_ASSERT( GetPagePos( nPageId ) == TABBAR_PAGE_NOTFOUND, + DBG_ASSERT( GetPagePos( nPageId ) == PAGE_NOT_FOUND, "TabBar::InsertPage(): PageId already exists" ); DBG_ASSERT( nBits <= TPB_SPECIAL, "TabBar::InsertPage(): nBits is wrong" ); @@ -1562,12 +1618,47 @@ void TabBar::InsertPage( USHORT nPageId, const XubString& rText, // ----------------------------------------------------------------------- +Color TabBar::GetTabBgColor( USHORT nPageId ) const +{ + USHORT nPos = GetPagePos( nPageId ); + + if ( nPos != PAGE_NOT_FOUND ) + return mpItemList->GetObject( nPos )->maTabBgColor; + else + return Color( COL_AUTO ); +} + +void TabBar::SetTabBgColor( USHORT nPageId, const Color& aTabBgColor ) +{ + USHORT nPos = GetPagePos( nPageId ); + ImplTabBarItem* pItem; + if ( nPos != PAGE_NOT_FOUND ) + { + pItem = mpItemList->GetObject( nPos ); + if ( aTabBgColor != Color( COL_AUTO ) ) + { + pItem->maTabBgColor = aTabBgColor; + if ( aTabBgColor.GetLuminance() <= 128 ) //Do not use aTabBgColor.IsDark(), because that threshold is way too low... + pItem->maTabTextColor = Color( COL_WHITE ); + else + pItem->maTabTextColor = Color( COL_BLACK ); + } + else + { + pItem->maTabBgColor = Color( COL_AUTO ); + pItem->maTabTextColor = Color( COL_AUTO ); + } + } +} + +// ----------------------------------------------------------------------- + void TabBar::RemovePage( USHORT nPageId ) { USHORT nPos = GetPagePos( nPageId ); // Existiert Item - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { if ( mnCurPageId == nPageId ) mnCurPageId = 0; @@ -1602,7 +1693,7 @@ void TabBar::MovePage( USHORT nPageId, USHORT nNewPos ) return; // Existiert Item - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { // TabBar-Item in der Liste verschieben ImplTabBarItem* pItem = mpItemList->Remove( nPos ); @@ -1640,7 +1731,7 @@ void TabBar::Clear() if ( IsReallyVisible() && IsUpdateMode() ) Invalidate(); - CallEventListeners( VCLEVENT_TABBAR_PAGEREMOVED, (void*) TABBAR_PAGE_NOTFOUND ); + CallEventListeners( VCLEVENT_TABBAR_PAGEREMOVED, (void*) PAGE_NOT_FOUND ); } // ----------------------------------------------------------------------- @@ -1649,7 +1740,7 @@ void TabBar::EnablePage( USHORT nPageId, BOOL bEnable ) { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { ImplTabBarItem* pItem = mpItemList->GetObject( nPos ); @@ -1672,7 +1763,7 @@ BOOL TabBar::IsPageEnabled( USHORT nPageId ) const { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) return mpItemList->GetObject( nPos )->mbEnable; else return FALSE; @@ -1684,7 +1775,7 @@ void TabBar::SetPageBits( USHORT nPageId, TabBarPageBits nBits ) { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { ImplTabBarItem* pItem = mpItemList->GetObject( nPos ); @@ -1705,7 +1796,7 @@ TabBarPageBits TabBar::GetPageBits( USHORT nPageId ) const { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) return mpItemList->GetObject( nPos )->mnBits; else return FALSE; @@ -1742,7 +1833,7 @@ USHORT TabBar::GetPagePos( USHORT nPageId ) const pItem = mpItemList->Next(); } - return TABBAR_PAGE_NOTFOUND; + return PAGE_NOT_FOUND; } // ----------------------------------------------------------------------- @@ -1767,7 +1858,7 @@ Rectangle TabBar::GetPageRect( USHORT nPageId ) const { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) return mpItemList->GetObject( nPos )->maRect; else return Rectangle(); @@ -1780,7 +1871,7 @@ void TabBar::SetCurPageId( USHORT nPageId ) USHORT nPos = GetPagePos( nPageId ); // Wenn Item nicht existiert, dann nichts machen - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { // Wenn sich aktuelle Page nicht geaendert hat, dann muessen wir // jetzt nichts mehr machen @@ -1872,7 +1963,7 @@ void TabBar::MakeVisible( USHORT nPageId ) USHORT nPos = GetPagePos( nPageId ); // Wenn Item nicht existiert, dann nichts machen - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { if ( nPos < mnFirstPos ) SetFirstPageId( nPageId ); @@ -1921,7 +2012,7 @@ void TabBar::SetFirstPageId( USHORT nPageId ) USHORT nPos = GetPagePos( nPageId ); // Wenn Item nicht existiert, dann FALSE zurueckgeben - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { if ( nPos != mnFirstPos ) { @@ -1955,7 +2046,7 @@ void TabBar::SelectPage( USHORT nPageId, BOOL bSelect ) { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { ImplTabBarItem* pItem = mpItemList->GetObject( nPos ); @@ -2036,7 +2127,7 @@ USHORT TabBar::GetSelectPageCount() const BOOL TabBar::IsPageSelected( USHORT nPageId ) const { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) return mpItemList->GetObject( nPos )->mbSelect; else return FALSE; @@ -2047,7 +2138,7 @@ BOOL TabBar::IsPageSelected( USHORT nPageId ) const BOOL TabBar::StartEditMode( USHORT nPageId ) { USHORT nPos = GetPagePos( nPageId ); - if ( mpEdit || (nPos == TABBAR_PAGE_NOTFOUND) || (mnLastOffX < 8) ) + if ( mpEdit || (nPos == PAGE_NOT_FOUND) || (mnLastOffX < 8) ) return FALSE; mnEditId = nPageId; @@ -2268,7 +2359,7 @@ void TabBar::SetSelectTextColor( const Color& rColor ) void TabBar::SetPageText( USHORT nPageId, const XubString& rText ) { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { mpItemList->GetObject( nPos )->maText = rText; mbSizeFormat = TRUE; @@ -2286,7 +2377,7 @@ void TabBar::SetPageText( USHORT nPageId, const XubString& rText ) XubString TabBar::GetPageText( USHORT nPageId ) const { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) return mpItemList->GetObject( nPos )->maText; else return XubString(); @@ -2297,7 +2388,7 @@ XubString TabBar::GetPageText( USHORT nPageId ) const void TabBar::SetHelpText( USHORT nPageId, const XubString& rText ) { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) mpItemList->GetObject( nPos )->maHelpText = rText; } @@ -2306,7 +2397,7 @@ void TabBar::SetHelpText( USHORT nPageId, const XubString& rText ) XubString TabBar::GetHelpText( USHORT nPageId ) const { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { ImplTabBarItem* pItem = mpItemList->GetObject( nPos ); if ( !pItem->maHelpText.Len() && pItem->mnHelpId ) @@ -2327,7 +2418,7 @@ XubString TabBar::GetHelpText( USHORT nPageId ) const void TabBar::SetHelpId( USHORT nPageId, ULONG nHelpId ) { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) mpItemList->GetObject( nPos )->mnHelpId = nHelpId; } @@ -2336,7 +2427,7 @@ void TabBar::SetHelpId( USHORT nPageId, ULONG nHelpId ) ULONG TabBar::GetHelpId( USHORT nPageId ) const { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) return mpItemList->GetObject( nPos )->mnHelpId; else return 0; @@ -2483,9 +2574,12 @@ USHORT TabBar::ShowDropPos( const Point& rPos ) nX--; else nX++; + if ( !pItem->IsDefaultTabBgColor() && !pItem->mbSelect) + SetLineColor( pItem->maTabTextColor ); DrawLine( Point( nX, nY ), Point( nX, nY ) ); DrawLine( Point( nX+1, nY-1 ), Point( nX+1, nY+1 ) ); DrawLine( Point( nX+2, nY-2 ), Point( nX+2, nY+2 ) ); + SetLineColor( aBlackColor ); } if ( (mnDropPos > 0) && (mnDropPos < nItemCount+1) ) { @@ -2493,6 +2587,8 @@ USHORT TabBar::ShowDropPos( const Point& rPos ) nX = pItem->maRect.Right()-TABBAR_OFFSET_X; if ( mnDropPos == nCurPos ) nX++; + if ( !pItem->IsDefaultTabBgColor() && !pItem->mbSelect) + SetLineColor( pItem->maTabTextColor ); DrawLine( Point( nX, nY ), Point( nX, nY ) ); DrawLine( Point( nX-1, nY-1 ), Point( nX-1, nY+1 ) ); DrawLine( Point( nX-2, nY-2 ), Point( nX-2, nY+2 ) ); diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx index f07ebd7fe8cd..f0bd192fc02c 100644 --- a/svtools/source/control/toolbarmenu.cxx +++ b/svtools/source/control/toolbarmenu.cxx @@ -481,6 +481,9 @@ void ToolbarMenu::implInit(const Reference< XFrame >& rFrame) { mpImpl = new ToolbarMenu_Impl( *this, rFrame ); + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + SetControlBackground( rStyleSettings.GetMenuColor() ); + initWindow(); Window* pWindow = GetTopMostParentSystemWindow( this ); @@ -638,8 +641,6 @@ void ToolbarMenu::initWindow() { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - SetControlBackground( GetSettings().GetStyleSettings().GetFaceGradientColor() ); - SetPointFont( rStyleSettings.GetMenuFont() ); SetBackground( Wallpaper( GetControlBackground() ) ); SetTextColor( rStyleSettings.GetMenuTextColor() ); @@ -919,7 +920,7 @@ void ToolbarMenu::implHighlightEntry( int nHighlightEntry, bool bHighlight ) IntersectClipRegion( Rectangle( Point( nX, nY ), Size( aSz.Width(), pEntry->maSize.Height() ) ) ); Rectangle aCtrlRect( Point( nX, 0 ), Size( aPxSize.Width()-nX, aPxSize.Height() ) ); DrawNativeControl( CTRL_MENU_POPUP, PART_ENTIRE_CONTROL, - Region( aCtrlRect ), + aCtrlRect, CTRL_STATE_ENABLED, ImplControlValue(), OUString() ); @@ -927,7 +928,7 @@ void ToolbarMenu::implHighlightEntry( int nHighlightEntry, bool bHighlight ) { bDrawItemRect = false; if( FALSE == DrawNativeControl( CTRL_MENU_POPUP, PART_MENU_ITEM, - Region( aItemRect ), + aItemRect, CTRL_STATE_SELECTED | ( pEntry->mbEnabled? CTRL_STATE_ENABLED: 0 ), ImplControlValue(), OUString() ) ) @@ -1311,13 +1312,12 @@ static void ImplPaintCheckBackground( Window* i_pWindow, const Rectangle& i_rRec if( i_pWindow->IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) ) { ImplControlValue aControlValue; - Region aCtrlRegion( i_rRect ); ControlState nState = CTRL_STATE_PRESSED | CTRL_STATE_ENABLED; aControlValue.setTristateVal( BUTTONVALUE_ON ); bNativeOk = i_pWindow->DrawNativeControl( CTRL_TOOLBAR, PART_BUTTON, - aCtrlRegion, nState, aControlValue, + i_rRect, nState, aControlValue, rtl::OUString() ); } @@ -1334,10 +1334,10 @@ static long ImplGetNativeCheckAndRadioSize( Window* pWin, long& rCheckHeight, lo rMaxWidth = rCheckHeight = rRadioHeight = 0; ImplControlValue aVal; - Region aNativeBounds; - Region aNativeContent; + Rectangle aNativeBounds; + Rectangle aNativeContent; Point tmp( 0, 0 ); - Region aCtrlRegion( Rectangle( tmp, Size( 100, 15 ) ) ); + Rectangle aCtrlRegion( tmp, Size( 100, 15 ) ); if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM_CHECK_MARK ) ) { if( pWin->GetNativeControlRegion( ControlType(CTRL_MENU_POPUP), @@ -1350,8 +1350,8 @@ static long ImplGetNativeCheckAndRadioSize( Window* pWin, long& rCheckHeight, lo aNativeContent ) ) { - rCheckHeight = aNativeBounds.GetBoundRect().GetHeight(); - rMaxWidth = aNativeContent.GetBoundRect().GetWidth(); + rCheckHeight = aNativeBounds.GetHeight(); + rMaxWidth = aNativeContent.GetWidth(); } } if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM_RADIO_MARK ) ) @@ -1366,8 +1366,8 @@ static long ImplGetNativeCheckAndRadioSize( Window* pWin, long& rCheckHeight, lo aNativeContent ) ) { - rRadioHeight = aNativeBounds.GetBoundRect().GetHeight(); - rMaxWidth = Max (rMaxWidth, aNativeContent.GetBoundRect().GetWidth()); + rRadioHeight = aNativeBounds.GetHeight(); + rMaxWidth = Max (rMaxWidth, aNativeContent.GetWidth()); } } return (rCheckHeight > rRadioHeight) ? rCheckHeight : rRadioHeight; @@ -1491,7 +1491,7 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) aTmpPos.Y() = aOuterCheckRect.Top() + (aOuterCheckRect.GetHeight() - nCtrlHeight)/2; Rectangle aCheckRect( aTmpPos, Size( nCtrlHeight, nCtrlHeight ) ); - DrawNativeControl( CTRL_MENU_POPUP, nPart, Region( aCheckRect ), nState, ImplControlValue(), OUString() ); + DrawNativeControl( CTRL_MENU_POPUP, nPart, aCheckRect, nState, ImplControlValue(), OUString() ); } else if ( pEntry->mbChecked ) // by default do nothing for unchecked items { diff --git a/svtools/source/dialogs/logindlg.cxx b/svtools/source/dialogs/logindlg.cxx deleted file mode 100644 index 036d5d71a4cf..000000000000 --- a/svtools/source/dialogs/logindlg.cxx +++ /dev/null @@ -1,312 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include <filedlg.hxx> -#include <vcl/msgbox.hxx> -#include <svtools/logindlg.hxx> - -#ifndef _SVTOOLS_LOGINDLG_HRC_ -#include "logindlg.hrc" -#endif -#ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> -#endif -#include <svtools/svtdata.hxx> - -#ifdef UNX -#include <limits.h> -#define _MAX_PATH PATH_MAX -#endif - -// LoginDialog ------------------------------------------------------- - -//............................................................................ -namespace svt -{ -//............................................................................ - -void LoginDialog::HideControls_Impl( USHORT nFlags ) -{ - FASTBOOL bPathHide = FALSE; - FASTBOOL bErrorHide = FALSE; - FASTBOOL bAccountHide = FALSE; - - if ( ( nFlags & LF_NO_PATH ) == LF_NO_PATH ) - { - aPathFT.Hide(); - aPathED.Hide(); - aPathBtn.Hide(); - bPathHide = TRUE; - } - else if ( ( nFlags & LF_PATH_READONLY ) == LF_PATH_READONLY ) - { - aPathED.Hide(); - aPathInfo.Show(); - aPathBtn.Hide(); - } - - if ( ( nFlags & LF_NO_USERNAME ) == LF_NO_USERNAME ) - { - aNameFT.Hide(); - aNameED.Hide(); - } - else if ( ( nFlags & LF_USERNAME_READONLY ) == LF_USERNAME_READONLY ) - { - aNameED.Hide(); - aNameInfo.Show(); - } - - if ( ( nFlags & LF_NO_PASSWORD ) == LF_NO_PASSWORD ) - { - aPasswordFT.Hide(); - aPasswordED.Hide(); - } - - if ( ( nFlags & LF_NO_SAVEPASSWORD ) == LF_NO_SAVEPASSWORD ) - aSavePasswdBtn.Hide(); - - if ( ( nFlags & LF_NO_ERRORTEXT ) == LF_NO_ERRORTEXT ) - { - aErrorInfo.Hide(); - aErrorGB.Hide(); - bErrorHide = TRUE; - } - - if ( ( nFlags & LF_NO_ACCOUNT ) == LF_NO_ACCOUNT ) - { - aAccountFT.Hide(); - aAccountED.Hide(); - bAccountHide = TRUE; - } - - if ( bErrorHide ) - { - long nOffset = aLoginGB.GetPosPixel().Y() - - aErrorGB.GetPosPixel().Y(); - Point aNewPnt = aRequestInfo.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aRequestInfo.SetPosPixel( aNewPnt ); - aNewPnt = aPathFT.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aPathFT.SetPosPixel( aNewPnt ); - aNewPnt = aPathED.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aPathED.SetPosPixel( aNewPnt ); - aNewPnt = aPathInfo.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aPathInfo.SetPosPixel( aNewPnt ); - aNewPnt = aPathBtn.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aPathBtn.SetPosPixel( aNewPnt ); - aNewPnt = aNameFT.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aNameFT.SetPosPixel( aNewPnt ); - aNewPnt = aNameED.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aNameED.SetPosPixel( aNewPnt ); - aNewPnt = aNameInfo.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aNameInfo.SetPosPixel( aNewPnt ); - aNewPnt = aPasswordFT.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aPasswordFT.SetPosPixel( aNewPnt ); - aNewPnt = aPasswordED.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aPasswordED.SetPosPixel( aNewPnt ); - aNewPnt = aAccountFT.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aAccountFT.SetPosPixel( aNewPnt ); - aNewPnt = aAccountED.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aAccountED.SetPosPixel( aNewPnt ); - aNewPnt = aSavePasswdBtn.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aSavePasswdBtn.SetPosPixel( aNewPnt ); - aNewPnt = aLoginGB.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aLoginGB.SetPosPixel( aNewPnt ); - Size aNewSiz = GetSizePixel(); - aNewSiz.Height() -= nOffset; - SetSizePixel( aNewSiz ); - } - - if ( bPathHide ) - { - long nOffset = aNameED.GetPosPixel().Y() - - aPathED.GetPosPixel().Y(); - - Point aTmpPnt1 = aNameFT.GetPosPixel(); - Point aTmpPnt2 = aPasswordFT.GetPosPixel(); - aNameFT.SetPosPixel( aPathFT.GetPosPixel() ); - aPasswordFT.SetPosPixel( aTmpPnt1 ); - aAccountFT.SetPosPixel( aTmpPnt2 ); - aTmpPnt1 = aNameED.GetPosPixel(); - aTmpPnt2 = aPasswordED.GetPosPixel(); - aNameED.SetPosPixel( aPathED.GetPosPixel() ); - aPasswordED.SetPosPixel( aTmpPnt1 ); - aAccountED.SetPosPixel( aTmpPnt2 ); - aNameInfo.SetPosPixel( aPathInfo.GetPosPixel() ); - aTmpPnt1 = aSavePasswdBtn.GetPosPixel(); - aTmpPnt1.Y() -= nOffset; - aSavePasswdBtn.SetPosPixel( aTmpPnt1 ); - Size aNewSz = GetSizePixel(); - aNewSz.Height() -= nOffset; - SetSizePixel( aNewSz ); - } - - if ( bAccountHide ) - { - long nOffset = aAccountED.GetPosPixel().Y() - aPasswordED.GetPosPixel().Y(); - - Point aTmpPnt = aSavePasswdBtn.GetPosPixel(); - aTmpPnt.Y() -= nOffset; - aSavePasswdBtn.SetPosPixel( aTmpPnt ); - Size aNewSz = GetSizePixel(); - aNewSz.Height() -= nOffset; - SetSizePixel( aNewSz ); - } -}; - -// ----------------------------------------------------------------------- - -IMPL_LINK( LoginDialog, OKHdl_Impl, OKButton *, EMPTYARG ) -{ - // trim the strings - aNameED.SetText( aNameED.GetText().EraseLeadingChars(). - EraseTrailingChars() ); - aPasswordED.SetText( aPasswordED.GetText().EraseLeadingChars(). - EraseTrailingChars() ); - EndDialog( RET_OK ); - return 1; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( LoginDialog, PathHdl_Impl, PushButton *, EMPTYARG ) -{ - PathDialog* pDlg = new PathDialog( this, WB_3DLOOK ); -// DirEntry aEntry; -// aEntry.ToAbs(); -// pDlg->SetPath( aEntry.GetFull() ); - - if ( pDlg->Execute() == RET_OK ) - aPathED.SetText( pDlg->GetPath() ); - - delete pDlg; - return 1; -} - -// ----------------------------------------------------------------------- - -LoginDialog::LoginDialog -( - Window* pParent, - USHORT nFlags, - const String& rServer, - const String* pRealm -) : - - ModalDialog( pParent, SvtResId( DLG_LOGIN ) ), - - aErrorInfo ( this, SvtResId( INFO_LOGIN_ERROR ) ), - aErrorGB ( this, SvtResId( GB_LOGIN_ERROR ) ), - aRequestInfo ( this, SvtResId( INFO_LOGIN_REQUEST ) ), - aPathFT ( this, SvtResId( FT_LOGIN_PATH ) ), - aPathED ( this, SvtResId( ED_LOGIN_PATH ) ), - aPathInfo ( this, SvtResId( INFO_LOGIN_PATH ) ), - aPathBtn ( this, SvtResId( BTN_LOGIN_PATH ) ), - aNameFT ( this, SvtResId( FT_LOGIN_USERNAME ) ), - aNameED ( this, SvtResId( ED_LOGIN_USERNAME ) ), - aNameInfo ( this, SvtResId( INFO_LOGIN_USERNAME ) ), - aPasswordFT ( this, SvtResId( FT_LOGIN_PASSWORD ) ), - aPasswordED ( this, SvtResId( ED_LOGIN_PASSWORD ) ), - aAccountFT ( this, SvtResId( FT_LOGIN_ACCOUNT ) ), - aAccountED ( this, SvtResId( ED_LOGIN_ACCOUNT ) ), - aSavePasswdBtn ( this, SvtResId( CB_LOGIN_SAVEPASSWORD ) ), - aLoginGB ( this, SvtResId( GB_LOGIN_LOGIN ) ), - aOKBtn ( this, SvtResId( BTN_LOGIN_OK ) ), - aCancelBtn ( this, SvtResId( BTN_LOGIN_CANCEL ) ), - aHelpBtn ( this, SvtResId( BTN_LOGIN_HELP ) ) - -{ - // Einlog-Ort eintragen - String aServer; - - if ( ( ( nFlags & LF_NO_ACCOUNT ) == LF_NO_ACCOUNT ) && pRealm && pRealm->Len() ) - { - aServer = *pRealm; - ( ( aServer += ' ' ) += String( SvtResId( STR_LOGIN_AT ) ) ) += ' '; - } - aServer += rServer; - String aTxt = aRequestInfo.GetText(); - aTxt.SearchAndReplaceAscii( "%1", aServer ); - aRequestInfo.SetText( aTxt ); - - FreeResource(); - - aPathED.SetMaxTextLen( _MAX_PATH ); - aNameED.SetMaxTextLen( _MAX_PATH ); - - aOKBtn.SetClickHdl( LINK( this, LoginDialog, OKHdl_Impl ) ); - aPathBtn.SetClickHdl( LINK( this, LoginDialog, PathHdl_Impl ) ); - - HideControls_Impl( nFlags ); -}; - -// ----------------------------------------------------------------------- - -void LoginDialog::SetName( const String& rNewName ) -{ - aNameED.SetText( rNewName ); - aNameInfo.SetText( rNewName ); -} - -// ----------------------------------------------------------------------- - -void LoginDialog::ClearPassword() -{ - aPasswordED.SetText( String() ); - - if ( 0 == aNameED.GetText().Len() ) - aNameED.GrabFocus(); - else - aPasswordED.GrabFocus(); -}; - -// ----------------------------------------------------------------------- - -void LoginDialog::ClearAccount() -{ - aAccountED.SetText( String() ); - aAccountED.GrabFocus(); -}; - -//............................................................................ -} // namespace svt -//............................................................................ diff --git a/svtools/source/dialogs/logindlg.hrc b/svtools/source/dialogs/logindlg.hrc deleted file mode 100644 index 7baf6010f531..000000000000 --- a/svtools/source/dialogs/logindlg.hrc +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef _SVTOOLS_LOGINDLG_HRC_ -#define _SVTOOLS_LOGINDLG_HRC_ - -//============================================================================ -#define INFO_LOGIN_ERROR 10 -#define GB_LOGIN_ERROR 11 - -#define INFO_LOGIN_REQUEST 20 -#define FT_LOGIN_PATH 21 -#define ED_LOGIN_PATH 22 -#define INFO_LOGIN_PATH 23 -#define BTN_LOGIN_PATH 24 -#define FT_LOGIN_USERNAME 25 -#define ED_LOGIN_USERNAME 26 -#define INFO_LOGIN_USERNAME 27 -#define FT_LOGIN_PASSWORD 28 -#define ED_LOGIN_PASSWORD 29 -#define FT_LOGIN_ACCOUNT 30 -#define ED_LOGIN_ACCOUNT 31 -#define CB_LOGIN_SAVEPASSWORD 32 -#define GB_LOGIN_LOGIN 33 - -#define BTN_LOGIN_OK 50 -#define BTN_LOGIN_CANCEL 51 -#define BTN_LOGIN_HELP 52 - -#define STR_LOGIN_AT 60 - -#endif // _SVTOOLS_LOGINDLG_HRC_ diff --git a/svtools/source/dialogs/logindlg.src b/svtools/source/dialogs/logindlg.src deleted file mode 100644 index f6e3565d8cd9..000000000000 --- a/svtools/source/dialogs/logindlg.src +++ /dev/null @@ -1,200 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> -#endif - -#ifndef _SVTOOLS_LOGINDLG_HRC_ -#include "logindlg.hrc" -#endif - -ModalDialog DLG_LOGIN -{ -// HelpId = HID_DLG_LOGIN ; - Border = TRUE ; - Moveable = TRUE ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 265 , 158 ) ; - FixedText INFO_LOGIN_ERROR - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 185 , 18 ) ; - WordBreak = TRUE ; - }; - FixedLine GB_LOGIN_ERROR - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 197 , 8 ) ; - Text [ en-US ] = "Message from server" ; - }; - FixedText INFO_LOGIN_REQUEST - { - Pos = MAP_APPFONT ( 12 , 55 ) ; - Size = MAP_APPFONT ( 185 , 18 ) ; - WordBreak = TRUE ; - Text [ en-US ] = "Please enter user name and password for %1." ; - }; - FixedText FT_LOGIN_PATH - { - Pos = MAP_APPFONT ( 12 , 77 ) ; - Size = MAP_APPFONT ( 57 , 10 ) ; - Text [ en-US ] = "~Path" ; - }; - Edit ED_LOGIN_PATH - { - Border = TRUE ; - Pos = MAP_APPFONT ( 72 , 76 ) ; - Size = MAP_APPFONT ( 108 , 12 ) ; - }; - FixedText INFO_LOGIN_PATH - { - Hide = TRUE ; - Pos = MAP_APPFONT ( 72 , 77 ) ; - Size = MAP_APPFONT ( 125 , 10 ) ; - }; - PushButton BTN_LOGIN_PATH - { - Pos = MAP_APPFONT ( 183 , 75 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - Text = "~..." ; - }; - FixedText FT_LOGIN_USERNAME - { - Pos = MAP_APPFONT ( 12 , 92 ) ; - Size = MAP_APPFONT ( 57 , 10 ) ; - Text [ en-US ] = "~User name" ; - }; - Edit ED_LOGIN_USERNAME - { - Border = TRUE ; - Pos = MAP_APPFONT ( 72 , 91 ) ; - Size = MAP_APPFONT ( 125 , 12 ) ; - }; - FixedText INFO_LOGIN_USERNAME - { - Hide = TRUE ; - Pos = MAP_APPFONT ( 72 , 92 ) ; - Size = MAP_APPFONT ( 125 , 10 ) ; - }; - FixedText FT_LOGIN_PASSWORD - { - Pos = MAP_APPFONT ( 12 , 107 ) ; - Size = MAP_APPFONT ( 57 , 10 ) ; - Text [ en-US ] = "Pass~word" ; - }; - Edit ED_LOGIN_PASSWORD - { - Border = TRUE ; - Pos = MAP_APPFONT ( 72 , 106 ) ; - Size = MAP_APPFONT ( 125 , 12 ) ; - PassWord = TRUE ; - }; - FixedText FT_LOGIN_ACCOUNT - { - Pos = MAP_APPFONT ( 12 , 122 ) ; - Size = MAP_APPFONT ( 57 , 10 ) ; - Text [ en-US ] = "A~ccount"; - }; - Edit ED_LOGIN_ACCOUNT - { - Border = TRUE ; - Pos = MAP_APPFONT ( 72 , 121 ) ; - Size = MAP_APPFONT ( 125 , 12 ) ; - PassWord = TRUE ; - }; - CheckBox CB_LOGIN_SAVEPASSWORD - { - Pos = MAP_APPFONT ( 12 , 136 ) ; - Size = MAP_APPFONT ( 185 , 10 ) ; - Text [ en-US ] = "~Save password" ; - }; - FixedLine GB_LOGIN_LOGIN - { - Pos = MAP_APPFONT ( 7 , 44 ) ; - Size = MAP_APPFONT ( 197 , 8 ) ; - Text [ en-US ] = "Log in" ; - }; - OKButton BTN_LOGIN_OK - { - Pos = MAP_APPFONT ( 209 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton BTN_LOGIN_CANCEL - { - Pos = MAP_APPFONT ( 209 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton BTN_LOGIN_HELP - { - Pos = MAP_APPFONT ( 209 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - String STR_LOGIN_AT - { - Text [ en-US ] = "to " ; - }; - Text [ en-US ] = "User Name and Password Required" ; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svtools/source/dialogs/makefile.mk b/svtools/source/dialogs/makefile.mk index 16528ee7d4cd..99c4b59b76ae 100644 --- a/svtools/source/dialogs/makefile.mk +++ b/svtools/source/dialogs/makefile.mk @@ -44,7 +44,6 @@ SRC1FILES= filedlg2.src \ prnsetup.src \ printdlg.src \ colrdlg.src \ - logindlg.src \ addresstemplate.src \ wizardmachine.src @@ -69,8 +68,7 @@ SLOFILES= \ $(SLO)$/colrdlg.obj \ $(SLO)$/property.obj \ $(SLO)$/wizdlg.obj \ - $(SLO)$/mcvmath.obj \ - $(SLO)$/logindlg.obj + $(SLO)$/mcvmath.obj # --- Targets ------------------------------------------------------ diff --git a/svtools/source/dialogs/roadmapwizard.cxx b/svtools/source/dialogs/roadmapwizard.cxx index 9a03a9b16c2d..c28cfe1d4b18 100644 --- a/svtools/source/dialogs/roadmapwizard.cxx +++ b/svtools/source/dialogs/roadmapwizard.cxx @@ -182,7 +182,21 @@ namespace svt ,m_pImpl( new RoadmapWizardImpl ) { DBG_CTOR( RoadmapWizard, CheckInvariants ); + impl_construct(); + } + + //-------------------------------------------------------------------- + RoadmapWizard::RoadmapWizard( Window* _pParent, const WinBits i_nStyle, sal_uInt32 _nButtonFlags ) + :OWizardMachine( _pParent, i_nStyle, _nButtonFlags ) + ,m_pImpl( new RoadmapWizardImpl ) + { + DBG_CTOR( RoadmapWizard, CheckInvariants ); + impl_construct(); + } + //-------------------------------------------------------------------- + void RoadmapWizard::impl_construct() + { SetLeftAlignedButtonCount( 1 ); SetEmptyViewMargin(); @@ -328,15 +342,16 @@ namespace svt if ( (sal_Int32)aNewPathPos->second.size() <= nCurrentStatePathIndex ) return; -#if OSL_DEBUG_LEVEL > 0 // assert that the current and the new path are equal, up to nCurrentStatePathIndex Paths::const_iterator aActivePathPos = m_pImpl->aPaths.find( m_pImpl->nActivePath ); if ( aActivePathPos != m_pImpl->aPaths.end() ) { - DBG_ASSERT( m_pImpl->getFirstDifferentIndex( aActivePathPos->second, aNewPathPos->second ) > nCurrentStatePathIndex, - "RoadmapWizard::activate: you cannot activate a path which conflicts with the current one *before* the current state!" ); + if ( m_pImpl->getFirstDifferentIndex( aActivePathPos->second, aNewPathPos->second ) <= nCurrentStatePathIndex ) + { + OSL_ENSURE( false, "RoadmapWizard::activate: you cannot activate a path which conflicts with the current one *before* the current state!" ); + return; + } } -#endif m_pImpl->nActivePath = _nPathId; m_pImpl->bActivePathIsDefinite = _bDecideForIt; @@ -383,8 +398,14 @@ namespace svt } // can we advance from the current page? - const OWizardPage* pCurrentPage = dynamic_cast< const OWizardPage* >( GetPage( getCurrentState() ) ); - const bool bCurrentPageCanAdvance = !pCurrentPage || pCurrentPage->canAdvance(); + bool bCurrentPageCanAdvance = true; + TabPage* pCurrentPage = GetPage( getCurrentState() ); + if ( pCurrentPage ) + { + const IWizardPageController* pController = getPageController( GetPage( getCurrentState() ) ); + OSL_ENSURE( pController != NULL, "RoadmapWizard::implUpdateRoadmap: no controller for the current page!" ); + bCurrentPageCanAdvance = !pController || pController->canAdvance(); + } // now, we have to remove all items after nCurrentStatePathIndex, and insert the items from the active // path, up to (excluding) nUpperStepBoundary @@ -641,11 +662,33 @@ namespace svt // if the state is currently in the roadmap, reflect it's new status m_pImpl->pRoadmap->EnableRoadmapItem( (RoadmapTypes::ItemId)_nState, _bEnable ); } + + //-------------------------------------------------------------------- + bool RoadmapWizard::knowsState( WizardState i_nState ) const + { + for ( Paths::const_iterator path = m_pImpl->aPaths.begin(); + path != m_pImpl->aPaths.end(); + ++path + ) + { + for ( WizardPath::const_iterator state = path->second.begin(); + state != path->second.end(); + ++state + ) + { + if ( *state == i_nState ) + return true; + } + } + return false; + } + //-------------------------------------------------------------------- bool RoadmapWizard::isStateEnabled( WizardState _nState ) const { return m_pImpl->aDisabledStates.find( _nState ) == m_pImpl->aDisabledStates.end(); } + //-------------------------------------------------------------------- void RoadmapWizard::Resize() { diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx index 3aaf279889d8..2053da80019d 100644 --- a/svtools/source/dialogs/wizardmachine.cxx +++ b/svtools/source/dialogs/wizardmachine.cxx @@ -30,6 +30,7 @@ #include <svtools/wizardmachine.hxx> #include <svtools/helpid.hrc> #include <tools/debug.hxx> +#include <tools/diagnose_ex.h> #include <vcl/msgbox.hxx> #include <svtools/svtdata.hxx> #ifndef _SVTOOLS_HRC @@ -101,7 +102,7 @@ namespace svt } //--------------------------------------------------------------------- - sal_Bool OWizardPage::commitPage( CommitPageReason ) + sal_Bool OWizardPage::commitPage( WizardTypes::CommitPageReason ) { return sal_True; } @@ -161,6 +162,25 @@ namespace svt ,m_pHelp(NULL) ,m_pImpl( new WizardMachineImplData ) { + implConstruct( _nButtonFlags ); + } + + //--------------------------------------------------------------------- + OWizardMachine::OWizardMachine(Window* _pParent, const WinBits i_nStyle, sal_uInt32 _nButtonFlags ) + :WizardDialog( _pParent, i_nStyle ) + ,m_pFinish(NULL) + ,m_pCancel(NULL) + ,m_pNextPage(NULL) + ,m_pPrevPage(NULL) + ,m_pHelp(NULL) + ,m_pImpl( new WizardMachineImplData ) + { + implConstruct( _nButtonFlags ); + } + + //--------------------------------------------------------------------- + void OWizardMachine::implConstruct( const sal_uInt32 _nButtonFlags ) + { m_pImpl->sTitleBase = GetText(); // create the buttons according to the wizard button flags @@ -225,8 +245,6 @@ namespace svt AddButton( m_pCancel, WIZARDDIALOG_BUTTON_STDOFFSET_X ); } - - } //--------------------------------------------------------------------- @@ -274,35 +292,42 @@ namespace svt } //--------------------------------------------------------------------- - void OWizardMachine::ActivatePage() + TabPage* OWizardMachine::GetOrCreatePage( const WizardState i_nState ) { - WizardDialog::ActivatePage(); - - WizardState nCurrentLevel = GetCurLevel(); - if (NULL == GetPage(nCurrentLevel)) + if ( NULL == GetPage( i_nState ) ) { - TabPage* pNewPage = createPage(nCurrentLevel); - DBG_ASSERT(pNewPage, "OWizardMachine::ActivatePage: invalid new page (NULL)!"); + TabPage* pNewPage = createPage( i_nState ); + DBG_ASSERT( pNewPage, "OWizardMachine::GetOrCreatePage: invalid new page (NULL)!" ); // fill up the page sequence of our base class (with dummies) - while (m_pImpl->nFirstUnknownPage < nCurrentLevel) + while ( m_pImpl->nFirstUnknownPage < i_nState ) { - AddPage(NULL); + AddPage( NULL ); ++m_pImpl->nFirstUnknownPage; } - if (m_pImpl->nFirstUnknownPage == nCurrentLevel) + if ( m_pImpl->nFirstUnknownPage == i_nState ) { // encountered this page number the first time - AddPage(pNewPage); + AddPage( pNewPage ); ++m_pImpl->nFirstUnknownPage; } else // already had this page - just change it - SetPage(nCurrentLevel, pNewPage); + SetPage( i_nState, pNewPage ); } + return GetPage( i_nState ); + } - enterState(nCurrentLevel); + //--------------------------------------------------------------------- + void OWizardMachine::ActivatePage() + { + WizardDialog::ActivatePage(); + + WizardState nCurrentLevel = GetCurLevel(); + GetOrCreatePage( nCurrentLevel ); + + enterState( nCurrentLevel ); } //--------------------------------------------------------------------- @@ -330,8 +355,10 @@ namespace svt if (m_pCancel && (_nWizardButtonFlags & WZB_CANCEL)) pNewDefButton = m_pCancel; - if (pNewDefButton) - defaultButton(pNewDefButton); + if ( pNewDefButton ) + defaultButton( pNewDefButton ); + else + implResetDefault( this ); } //--------------------------------------------------------------------- @@ -395,9 +422,10 @@ namespace svt void OWizardMachine::enterState(WizardState _nState) { // tell the page - IWizardPage* pCurrentPage = getWizardPage(GetPage(_nState)); - if ( pCurrentPage ) - pCurrentPage->initializePage(); + IWizardPageController* pController = getPageController( GetPage( _nState ) ); + OSL_ENSURE( pController, "OWizardMachine::enterState: no controller for the given page!" ); + if ( pController ) + pController->initializePage(); if ( isAutomaticNextButtonStateEnabled() ) enableButtons( WZB_NEXT, canAdvance() ); @@ -419,9 +447,9 @@ namespace svt } //--------------------------------------------------------------------- - sal_Bool OWizardMachine::onFinish(sal_Int32 _nResult) + sal_Bool OWizardMachine::onFinish() { - return Finnish(_nResult); + return Finnish( RET_OK ); } //--------------------------------------------------------------------- @@ -434,8 +462,7 @@ namespace svt { return 0L; } - long nRet = onFinish( RET_OK ); - return nRet; + return onFinish() ? 1L : 0L; } //--------------------------------------------------------------------- @@ -447,10 +474,9 @@ namespace svt //--------------------------------------------------------------------- sal_Bool OWizardMachine::prepareLeaveCurrentState( CommitPageReason _eReason ) { - IWizardPage* pCurrentPage = getWizardPage(GetPage(getCurrentState())); - if ( pCurrentPage ) - return pCurrentPage->commitPage( _eReason ); - return sal_True; + IWizardPageController* pController = getPageController( GetPage( getCurrentState() ) ); + ENSURE_OR_RETURN( pController != NULL, "OWizardMachine::prepareLeaveCurrentState: no controller for the current page!", sal_True ); + return pController->commitPage( _eReason ); } //--------------------------------------------------------------------- @@ -664,10 +690,10 @@ namespace svt } //--------------------------------------------------------------------- - IWizardPage* OWizardMachine::getWizardPage(TabPage* _pCurrentPage) const + IWizardPageController* OWizardMachine::getPageController( TabPage* _pCurrentPage ) const { - OWizardPage* pPage = dynamic_cast< OWizardPage* >( _pCurrentPage ); - return pPage; + IWizardPageController* pController = dynamic_cast< IWizardPageController* >( _pCurrentPage ); + return pController; } //--------------------------------------------------------------------- @@ -690,11 +716,12 @@ namespace svt //--------------------------------------------------------------------- void OWizardMachine::updateTravelUI() { - OWizardPage* pPage = dynamic_cast< OWizardPage* >( GetPage( getCurrentState() ) ); + const IWizardPageController* pController = getPageController( GetPage( getCurrentState() ) ); + OSL_ENSURE( pController != NULL, "RoadmapWizard::updateTravelUI: no controller for the current page!" ); bool bCanAdvance = - ( !pPage || pPage->canAdvance() ) // the current page allows to advance - && canAdvance(); // the dialog as a whole allows to advance + ( !pController || pController->canAdvance() ) // the current page allows to advance + && canAdvance(); // the dialog as a whole allows to advance enableButtons( WZB_NEXT, bCanAdvance ); } diff --git a/svtools/source/filter.vcl/filter/filter.cxx b/svtools/source/filter.vcl/filter/filter.cxx index c7dd30354e10..cebe7f2efd93 100644 --- a/svtools/source/filter.vcl/filter/filter.cxx +++ b/svtools/source/filter.vcl/filter/filter.cxx @@ -992,7 +992,8 @@ namespace { struct Cache : public rtl::Static<ImpFilterLibCache, Cache> {}; } // ----------------- GraphicFilter::GraphicFilter( sal_Bool bConfig ) : - bUseConfig ( bConfig ) + bUseConfig ( bConfig ), + nExpGraphHint ( 0 ) { ImplInit(); } @@ -1678,6 +1679,7 @@ USHORT GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& rPat USHORT nFormatCount = GetExportFormatCount(); ResetLastError(); + nExpGraphHint = 0; if( nFormat == GRFILTER_FORMAT_DONTKNOW ) { @@ -1850,8 +1852,10 @@ USHORT GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& rPat } else if( aFilterName.EqualsIgnoreCaseAscii( EXP_JPEG ) ) { - if( !ExportJPEG( rOStm, aGraphic, pFilterData ) ) + bool bExportedGrayJPEG = false; + if( !ExportJPEG( rOStm, aGraphic, pFilterData, &bExportedGrayJPEG ) ) nStatus = GRFILTER_FORMATERROR; + nExpGraphHint = bExportedGrayJPEG ? GRFILTER_OUTHINT_GREY : 0; if( rOStm.GetError() ) nStatus = GRFILTER_IOERROR; diff --git a/svtools/source/filter.vcl/jpeg/jpeg.cxx b/svtools/source/filter.vcl/jpeg/jpeg.cxx index 7fd2e09a82dd..a2de92171af3 100644 --- a/svtools/source/filter.vcl/jpeg/jpeg.cxx +++ b/svtools/source/filter.vcl/jpeg/jpeg.cxx @@ -590,10 +590,11 @@ ReadState JPEGReader::Read( Graphic& rGraphic ) // - JPEGWriter - // -------------- -JPEGWriter::JPEGWriter( SvStream& rStm, const uno::Sequence< beans::PropertyValue >* pFilterData ) : +JPEGWriter::JPEGWriter( SvStream& rStm, const uno::Sequence< beans::PropertyValue >* pFilterData, bool* pExportWasGrey ) : rOStm ( rStm ), pAcc ( NULL ), - pBuffer ( NULL ) + pBuffer ( NULL ), + pExpWasGrey ( pExportWasGrey ) { FilterConfigItem aConfigItem( (uno::Sequence< beans::PropertyValue >*)pFilterData ); bGreys = aConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "ColorMode" ) ), 0 ) != 0; @@ -704,6 +705,9 @@ BOOL JPEGWriter::Write( const Graphic& rGraphic ) bGreys = sal_True; } + if( pExpWasGrey ) + *pExpWasGrey = bGreys; + if( pAcc ) { bNative = ( pAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB ); @@ -765,8 +769,11 @@ BOOL ImportJPEG( SvStream& rStm, Graphic& rGraphic, void* pCallerData, sal_Int32 // - ExportJPEG - // -------------- -BOOL ExportJPEG( SvStream& rOStm, const Graphic& rGraphic, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData ) +BOOL ExportJPEG( SvStream& rOStm, const Graphic& rGraphic, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData, + bool* pExportWasGrey + ) { - JPEGWriter aJPEGWriter( rOStm, pFilterData ); + JPEGWriter aJPEGWriter( rOStm, pFilterData, pExportWasGrey ); return aJPEGWriter.Write( rGraphic ); } diff --git a/svtools/source/filter.vcl/wmf/winmtf.cxx b/svtools/source/filter.vcl/wmf/winmtf.cxx index bf176015fd77..787e6522b890 100644 --- a/svtools/source/filter.vcl/wmf/winmtf.cxx +++ b/svtools/source/filter.vcl/wmf/winmtf.cxx @@ -2043,7 +2043,7 @@ void WinMtfOutput::ModifyWorldTransform( const XForm& rXForm, UINT32 nMode ) case MWT_IDENTITY : { maXForm.eM11 = maXForm.eM12 = maXForm.eM21 = maXForm.eM22 = 1.0f; - maXForm.eDx = maXForm.eDx = 0.0f; + maXForm.eDx = maXForm.eDy = 0.0f; } break; diff --git a/svtools/source/inc/jpeg.hxx b/svtools/source/inc/jpeg.hxx index 906bcd9ea2de..9923190c5e21 100644 --- a/svtools/source/inc/jpeg.hxx +++ b/svtools/source/inc/jpeg.hxx @@ -99,13 +99,16 @@ class JPEGWriter sal_Bool bGreys; sal_Int32 nQuality; + bool* pExpWasGrey; + 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( SvStream& rOStm, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData, + bool* pExportWasGrey = NULL ); ~JPEGWriter() {}; BOOL Write( const Graphic& rGraphic ); @@ -119,6 +122,10 @@ public: 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 ); +BOOL ExportJPEG( SvStream& rStream, + const Graphic& rGraphic, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData, + bool* pExportWasGrey = NULL + ); #endif // _JPEG_HXX diff --git a/svtools/source/inc/svimpbox.hxx b/svtools/source/inc/svimpbox.hxx index cde986b3cb7d..92b9f960b65c 100644 --- a/svtools/source/inc/svimpbox.hxx +++ b/svtools/source/inc/svimpbox.hxx @@ -340,7 +340,7 @@ public: 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 ); + bool Command( const CommandEvent& rCEvt ); void Invalidate(); void DestroyAnchor() { pAnchor=0; aSelEng.Reset(); } diff --git a/svtools/source/inc/unoiface.hxx b/svtools/source/inc/unoiface.hxx index 5d34ea6f47ed..f15cb7c10d4c 100644 --- a/svtools/source/inc/unoiface.hxx +++ b/svtools/source/inc/unoiface.hxx @@ -39,7 +39,6 @@ #include <com/sun/star/awt/XTextLayoutConstrains.hpp> #include <svtools/svmedit.hxx> #include <svtools/fmtfield.hxx> -#include <com/sun/star/awt/XImageConsumer.hpp> #include <comphelper/uno3.hxx> @@ -243,7 +242,7 @@ struct RMItemData ::rtl::OUString Label; }; -typedef ::cppu::ImplInheritanceHelper3 < VCLXImageConsumer +typedef ::cppu::ImplInheritanceHelper3 < VCLXGraphicControl , ::com::sun::star::container::XContainerListener , ::com::sun::star::beans::XPropertyChangeListener , ::com::sun::star::awt::XItemEventBroadcaster @@ -288,7 +287,7 @@ public: protected: - // VCLXImageConsumer overridables + // VCLXGraphicControl overridables virtual void ImplSetNewImage(); static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds ); diff --git a/svtools/source/misc/errtxt.src b/svtools/source/misc/errtxt.src index 6c1a90ae6412..f33896e20003 100644 --- a/svtools/source/misc/errtxt.src +++ b/svtools/source/misc/errtxt.src @@ -328,23 +328,23 @@ Resource RID_ERRHDL }; String ERRCODE_INET_CONNECT { - Text [ en-US ] = "Could not establish Internet connection to $(ARG1)." ; + Text [ en-US ] = "Could not establish network connection to $(ARG1)." ; }; String ERRCODE_INET_READ { - Text [ en-US ] = "Error reading data from the Internet.\nServer error message: $(ARG1)." ; + Text [ en-US ] = "Error reading data from the network.\nServer error message: $(ARG1)." ; }; String ERRCODE_INET_WRITE { - Text [ en-US ] = "Error transferring data to the Internet.\nServer error message: $(ARG1)." ; + Text [ en-US ] = "Error transferring data to the network.\nServer error message: $(ARG1)." ; }; String ERRCODE_INET_GENERAL { - Text [ en-US ] = "General Internet error has occurred." ; + Text [ en-US ] = "General network error has occurred." ; }; String ERRCODE_INET_OFFLINE { - Text [ en-US ] = "The requested Internet data is not available in the cache and cannot be transmitted as the Online mode has not be activated." ; + Text [ en-US ] = "The requested network data is not available in the cache and cannot be transmitted as the Online mode has not be activated." ; }; String ERRCODE_SFXMSG_STYLEREPLACE { diff --git a/svtools/source/misc/imageresourceaccess.cxx b/svtools/source/misc/imageresourceaccess.cxx index a4f19d9e004a..436c3f721833 100644 --- a/svtools/source/misc/imageresourceaccess.cxx +++ b/svtools/source/misc/imageresourceaccess.cxx @@ -48,8 +48,6 @@ namespace svt { //........................................................................ -#define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:" - using namespace ::utl; using namespace ::comphelper; using namespace ::com::sun::star::io; @@ -141,8 +139,14 @@ namespace svt //-------------------------------------------------------------------- bool GraphicAccess::isSupportedURL( const ::rtl::OUString& _rURL ) { - ::rtl::OUString sIndicator( RTL_CONSTASCII_USTRINGPARAM( "private:resource/" ) ); - return ( ( _rURL.indexOf( sIndicator ) == 0 ) || ( _rURL.compareToAscii( GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( GRAPHOBJ_URLPREFIX ) ) == 0 ) ); + if ( ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:resource/" ) ) == 0 ) + || ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:graphicrepository/" ) ) == 0 ) + || ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:standardimage/" ) ) == 0 ) + || ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "vnd.sun.star.GraphicObject:" ) ) == 0 ) + || ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "vnd.sun.star.extension://" ) ) == 0 ) + ) + return true; + return false; } //-------------------------------------------------------------------- diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src index 0b83cb535ec4..067eb601a5af 100644 --- a/svtools/source/misc/langtab.src +++ b/svtools/source/misc/langtab.src @@ -138,7 +138,7 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE < "Lithuanian" ; LANGUAGE_LITHUANIAN ; > ; < "Macedonian" ; LANGUAGE_MACEDONIAN ; > ; < "Malay (Malaysia)" ; LANGUAGE_MALAY_MALAYSIA ; > ; - < "Malay (Brunei Darusalam)" ; LANGUAGE_MALAY_BRUNEI_DARUSSALAM ; > ; + < "Malay (Brunei Darussalam)" ; LANGUAGE_MALAY_BRUNEI_DARUSSALAM ; > ; < "Malayalam" ; LANGUAGE_MALAYALAM ; > ; < "Manipuri" ; LANGUAGE_MANIPURI ; > ; < "Marathi" ; LANGUAGE_MARATHI ; > ; @@ -319,6 +319,10 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE < "Sardinian, Logudorese" ; LANGUAGE_USER_SARDINIAN_LOGUDORESE ; > ; < "Sardinian, Sassarese" ; LANGUAGE_USER_SARDINIAN_SASSARESE ; > ; < "Bafia" ; LANGUAGE_USER_BAFIA ; > ; + < "Gikuyu" ; LANGUAGE_USER_GIKUYU ; > ; + < "Yoruba" ; LANGUAGE_YORUBA ; > ; + < "Rusyn (Ukraine)" ; LANGUAGE_USER_RUSYN_UKRAINE ; > ; + < "Rusyn (Slovakia)" ; LANGUAGE_USER_RUSYN_SLOVAKIA ; > ; }; }; diff --git a/svtools/source/misc/makefile.mk b/svtools/source/misc/makefile.mk index 65e43747a586..32781dbfefb1 100644 --- a/svtools/source/misc/makefile.mk +++ b/svtools/source/misc/makefile.mk @@ -75,7 +75,8 @@ SLOFILES=\ $(SLO)$/transfer.obj \ $(SLO)$/transfer2.obj \ $(SLO)$/unitconv.obj \ - $(SLO)$/wallitem.obj + $(SLO)$/wallitem.obj \ + $(SLO)$/xwindowitem.obj # --- Targets ------------------------------------------------------- diff --git a/svtools/source/misc/xwindowitem.cxx b/svtools/source/misc/xwindowitem.cxx new file mode 100644 index 000000000000..a382d8293617 --- /dev/null +++ b/svtools/source/misc/xwindowitem.cxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include "svtools/xwindowitem.hxx" + +#include <vcl/window.hxx> + + +using namespace ::com::sun::star; + +////////////////////////////////////////////////////////////////////// + +TYPEINIT1_FACTORY( XWindowItem, SfxPoolItem, new XWindowItem ); + + +XWindowItem::XWindowItem() : + SfxPoolItem() +{ +} + + +XWindowItem::XWindowItem( USHORT nWhichId, Window * pWin ) : + SfxPoolItem( nWhichId ) +{ + if (pWin) + { + m_xWin = uno::Reference< awt::XWindow >( pWin->GetComponentInterface(), uno::UNO_QUERY ); + // the assertion can't possibly fails since VCLXWindow implements XWindow... + DBG_ASSERT( m_xWin.is(), "failed to get XWindow" ); + } +} + + +XWindowItem::XWindowItem( USHORT nWhichId, uno::Reference< awt::XWindow > & rxWin ) : + SfxPoolItem( nWhichId ), + m_xWin( rxWin ) +{ +} + + +XWindowItem::XWindowItem( const XWindowItem &rItem ) : + SfxPoolItem( Which() ), + m_xWin( rItem.m_xWin ) +{ +} + + +XWindowItem::~XWindowItem() +{ +} + + +SfxPoolItem * XWindowItem::Clone( SfxItemPool* /*pPool*/ ) const +{ + return new XWindowItem( *this ); +} + + +int XWindowItem::operator == ( const SfxPoolItem & rAttr ) const +{ + DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); + + const XWindowItem * pItem = dynamic_cast< const XWindowItem * >(&rAttr); + return pItem ? m_xWin == pItem->m_xWin : 0; +} + + +////////////////////////////////////////////////////////////////////// + + diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index 67fc5f619fdf..ade58688dc55 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -2118,11 +2118,7 @@ enum eHtmlMetas { }; // <META NAME=xxx> -#ifdef __MINGW32__ // for runtime pseudo reloc -static HTMLOptionEnum aHTMLMetaNameTable[] = -#else static HTMLOptionEnum __READONLY_DATA aHTMLMetaNameTable[] = -#endif { { OOO_STRING_SVTOOLS_HTML_META_author, HTML_META_AUTHOR }, { OOO_STRING_SVTOOLS_HTML_META_changed, HTML_META_CHANGED }, diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx index a3f954e0bef5..8e5bd181a583 100644 --- a/svtools/source/table/gridtablerenderer.cxx +++ b/svtools/source/table/gridtablerenderer.cxx @@ -109,7 +109,10 @@ namespace svt { namespace table DBG_ASSERT( !!pColumn, "GridTableRenderer::PaintColumnHeader: invalid column model object!" ); if ( !!pColumn ) sHeaderText = pColumn->getName(); - _rDevice.SetTextColor(m_pImpl->rModel.getTextColor()); + if(m_pImpl->rModel.getTextColor() != 0x000000) + _rDevice.SetTextColor(m_pImpl->rModel.getTextColor()); + else + _rDevice.SetTextColor(_rStyle.GetFieldTextColor()); ULONG nHorFlag = TEXT_DRAW_LEFT; ULONG nVerFlag = TEXT_DRAW_TOP; if(m_pImpl->rModel.getVerticalAlign() == 1) @@ -146,6 +149,11 @@ namespace svt { namespace table Color aRowBackground = m_pImpl->rModel.getOddRowBackgroundColor(); Color line = m_pImpl->rModel.getLineColor(); Color aRowBackground2 = m_pImpl->rModel.getEvenRowBackgroundColor(); + Color fieldColor = _rStyle.GetFieldColor(); + if(aRowBackground == 0xFFFFFF) + aRowBackground = fieldColor; + if(aRowBackground2 == 0xFFFFFF) + aRowBackground2 = fieldColor; //if row is selected background color becomes blue, and lines should be also blue //if they aren't user defined if(_bSelected) @@ -161,7 +169,7 @@ namespace svt { namespace table //and set line color to be the same else { - if(aRowBackground2 != 0xFFFFFF && _nRow%2) + if(aRowBackground2 != fieldColor && _nRow%2) { aRowBackground = aRowBackground2; if(line == 0xFFFFFF) @@ -170,7 +178,7 @@ namespace svt { namespace table _rDevice.SetLineColor(line); } //fill the rows with alternating background colors if second background color is specified - else if(aRowBackground != 0xFFFFFF && line == 0xFFFFFF) + else if(aRowBackground != fieldColor && line == 0xFFFFFF) _rDevice.SetLineColor(aRowBackground); else { @@ -195,7 +203,10 @@ namespace svt { namespace table _rDevice.Push( PUSH_LINECOLOR); _rDevice.SetLineColor(_rStyle.GetSeparatorColor()); _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() ); - _rDevice.SetTextColor(m_pImpl->rModel.getTextColor()); + if(m_pImpl->rModel.getTextColor() != 0x000000) + _rDevice.SetTextColor(m_pImpl->rModel.getTextColor()); + else + _rDevice.SetTextColor(_rStyle.GetFieldTextColor()); ULONG nHorFlag = TEXT_DRAW_LEFT; ULONG nVerFlag = TEXT_DRAW_TOP; if(m_pImpl->rModel.getVerticalAlign() == 1) @@ -221,44 +232,42 @@ namespace svt { namespace table void GridTableRenderer::PaintCellImage( ColPos _nColumn, bool _bSelected, bool _bActive, OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, Image* _pCellData ) { - _rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR | PUSH_CLIPREGION); - _rDevice.IntersectClipRegion( _rArea ); - Color background1 = m_pImpl->rModel.getOddRowBackgroundColor(); - Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor(); - Color line = m_pImpl->rModel.getLineColor(); - //if row is selected and line color isn't user specified, set it blue - if(_bSelected) - { - if(line == 0xFFFFFF) - _rDevice.SetLineColor(_rStyle.GetHighlightColor()); - else - _rDevice.SetLineColor(line); - } - //else set line color to the color of row background - else - { - if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2) + _rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR); + Color background1 = m_pImpl->rModel.getOddRowBackgroundColor(); + Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor(); + Color line = m_pImpl->rModel.getLineColor(); + //if row is selected and line color isn't user specified, set it blue + if(_bSelected) { if(line == 0xFFFFFF) - _rDevice.SetLineColor(background2); + _rDevice.SetLineColor(_rStyle.GetHighlightColor()); else _rDevice.SetLineColor(line); } - else if(background1 != 0xFFFFFF && line == 0xFFFFFF) - _rDevice.SetLineColor(background1); + //else set line color to the color of row background else { - //if line color is set, then it was user defined and should be visible - //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible - _rDevice.SetLineColor(line); + if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2) + { + if(line == 0xFFFFFF) + _rDevice.SetLineColor(background2); + else + _rDevice.SetLineColor(line); + } + else if(background1 != 0xFFFFFF && line == 0xFFFFFF) + _rDevice.SetLineColor(background1); + else + { + //if line color is set, then it was user defined and should be visible + //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible + _rDevice.SetLineColor(line); + } } - } - _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() ); - { - // TODO: remove those temporary place holders - Rectangle aRect( _rArea ); - ++aRect.Left(); --aRect.Right(); - aRect.Top(); aRect.Bottom(); + _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() ); + + Rectangle aRect( _rArea ); + ++aRect.Left(); --aRect.Right(); + aRect.Top(); aRect.Bottom(); Point imagePos(Point(aRect.Left(), aRect.Top())); Size imageSize = _pCellData->GetSizePixel(); if(aRect.GetWidth() > imageSize.Width()) @@ -281,8 +290,7 @@ namespace svt { namespace table imageSize.Height() = aRect.GetHeight()-1; Image& image (*_pCellData); _rDevice.DrawImage(imagePos, imageSize, image, 0); - } - _rDevice.Pop(); + _rDevice.Pop(); (void)_bActive; // no special painting for the active cell at the moment @@ -293,48 +301,47 @@ namespace svt { namespace table OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, rtl::OUString& _rText ) { _rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); - Color background1 = m_pImpl->rModel.getOddRowBackgroundColor(); - Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor(); - Color line = m_pImpl->rModel.getLineColor(); - //if row is selected and line color isn't user specified, set it blue - if(_bSelected) - { - if(line == 0xFFFFFF) - _rDevice.SetLineColor(_rStyle.GetHighlightColor()); - else - _rDevice.SetLineColor(line); - } - //else set line color to the color of row background - else - { - if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2) + Color background1 = m_pImpl->rModel.getOddRowBackgroundColor(); + Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor(); + Color line = m_pImpl->rModel.getLineColor(); + //if row is selected and line color isn't user specified, set it blue + if(_bSelected) { if(line == 0xFFFFFF) - _rDevice.SetLineColor(background2); + _rDevice.SetLineColor(_rStyle.GetHighlightColor()); else _rDevice.SetLineColor(line); } - else if(background1 != 0xFFFFFF && line == 0xFFFFFF) - _rDevice.SetLineColor(background1); + //else set line color to the color of row background else { - //if Line color is set, then it was user defined and should be visible - //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible - _rDevice.SetLineColor(line); + if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2) + { + if(line == 0xFFFFFF) + _rDevice.SetLineColor(background2); + else + _rDevice.SetLineColor(line); + } + else if(background1 != 0xFFFFFF && line == 0xFFFFFF) + _rDevice.SetLineColor(background1); + else + { + //if Line color is set, then it was user defined and should be visible + //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible + _rDevice.SetLineColor(line); + } } - } - _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() ); - { - // TODO: remove those temporary place holders - Rectangle aRect( _rArea ); - ++aRect.Left(); --aRect.Right(); - aRect.Top(); aRect.Bottom(); + _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() ); + + Rectangle aRect( _rArea ); + ++aRect.Left(); --aRect.Right(); + aRect.Top(); aRect.Bottom(); if(_bSelected) - { _rDevice.SetTextColor(_rStyle.GetHighlightTextColor()); - } - else + else if(m_pImpl->rModel.getTextColor() != 0x000000) _rDevice.SetTextColor(m_pImpl->rModel.getTextColor()); + else + _rDevice.SetTextColor(_rStyle.GetFieldTextColor()); ULONG nHorFlag = TEXT_DRAW_LEFT; ULONG nVerFlag = TEXT_DRAW_TOP; if(m_pImpl->rModel.getVerticalAlign() == 1) @@ -348,8 +355,8 @@ namespace svt { namespace table Rectangle textRect(_rArea); textRect.Left()+=4; textRect.Right()-=4; textRect.Bottom()-=2; - _rDevice.DrawText( textRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP); - } + _rDevice.DrawText( textRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP); + _rDevice.Pop(); (void)_bActive; // no special painting for the active cell at the moment diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index 8c95fab6120b..33c80e642118 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -70,12 +70,18 @@ namespace svt { namespace table :Control( _pParent, _nStyle ) ,m_pImpl( new TableControl_Impl( *this ) ) ,m_bSelectionChanged(false) + ,m_bTooltip(false) { TableDataWindow* aTableData = m_pImpl->getDataWindow(); aTableData->SetMouseButtonDownHdl( LINK( this, TableControl, ImplMouseButtonDownHdl ) ); aTableData->SetMouseButtonUpHdl( LINK( this, TableControl, ImplMouseButtonUpHdl ) ); aTableData->SetSelectHdl( LINK( this, TableControl, ImplSelectHdl ) ); m_pAccessTable.reset(new ::svt::table::AccessibleTableControl_Impl()); + + // by default, use the background as determined by the style settings + const Color aWindowColor( GetSettings().GetStyleSettings().GetFieldColor() ); + SetBackground( Wallpaper( aWindowColor ) ); + SetFillColor( aWindowColor ); } //-------------------------------------------------------------------- @@ -120,6 +126,39 @@ namespace svt { namespace table } } } + + + //-------------------------------------------------------------------- + void TableControl::StateChanged( StateChangedType i_nStateChange ) + { + Control::StateChanged( i_nStateChange ); + + // forward certain settings to the data window + switch ( i_nStateChange ) + { + case STATE_CHANGE_CONTROLBACKGROUND: + if ( IsControlBackground() ) + getDataWindow()->SetControlBackground( GetControlBackground() ); + else + getDataWindow()->SetControlBackground(); + break; + + case STATE_CHANGE_CONTROLFOREGROUND: + if ( IsControlForeground() ) + getDataWindow()->SetControlForeground( GetControlForeground() ); + else + getDataWindow()->SetControlForeground(); + break; + + case STATE_CHANGE_CONTROLFONT: + if ( IsControlFont() ) + getDataWindow()->SetControlFont( GetControlFont() ); + else + getDataWindow()->SetControlFont(); + break; + } + } + //-------------------------------------------------------------------- void TableControl::Resize() { @@ -175,6 +214,11 @@ namespace svt { namespace table return m_pImpl->goTo( _nColPos, _nRowPos ); } //-------------------------------------------------------------------- + void TableControl::clearSelection() + { + m_pImpl->clearSelection(); + } + //-------------------------------------------------------------------- void TableControl::InvalidateDataWindow(RowPos _nRowStart, RowPos _nRowEnd, bool _bRemoved) { Rectangle _rRect; @@ -263,7 +307,7 @@ namespace svt { namespace table aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnHeaderBar" ) ); break; case TCTYPE_TABLECELL: - aRetText = GetRowName(_nRow); + aRetText = GetAccessibleCellText(_nRow, _nCol); break; case TCTYPE_ROWHEADERCELL: aRetText = GetRowName(_nRow); @@ -346,9 +390,9 @@ namespace svt { namespace table } // ----------------------------------------------------------------------------- -::rtl::OUString TableControl::GetAccessibleCellText( sal_Int32 _nRowPos, sal_Int32 _nColPos) +::rtl::OUString TableControl::GetAccessibleCellText( sal_Int32 _nRowPos, sal_Int32 _nColPos) const { - ::com::sun::star::uno::Any cellContent = GetCellContent(_nRowPos, _nColPos); + const ::com::sun::star::uno::Any cellContent = GetCellContent(_nRowPos, _nColPos); return m_pImpl->convertToString(cellContent); } // ----------------------------------------------------------------------------- @@ -546,6 +590,7 @@ void TableControl::setTooltip(const ::com::sun::star::uno::Sequence< ::rtl::OUSt { m_aText = aText; m_nCols = nCols; + m_bTooltip = true; } // ----------------------------------------------------------------------- void TableControl::selectionChanged(bool _bChanged) @@ -553,6 +598,11 @@ void TableControl::selectionChanged(bool _bChanged) m_bSelectionChanged = _bChanged; } // ----------------------------------------------------------------------- +bool TableControl::isTooltip() +{ + return m_bTooltip; +} +// ----------------------------------------------------------------------- IMPL_LINK( TableControl, ImplSelectHdl, void*, EMPTYARG ) { Select(); diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index 1526dbdb778d..90bc4899209b 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -609,10 +609,10 @@ namespace svt { namespace table if(pColumn->getMinWidth() == 0 && bResizable) { pColumn->setMinWidth(1); - minColWithoutFixedSum+=m_rAntiImpl.LogicToPixel( Size( 1, 0 ), MAP_APPFONT ).Width(); + minColWithoutFixedSum+=m_rAntiImpl.PixelToLogic( Size( 1, 0 ), MAP_APPFONT ).Width(); } if(pColumn->getMaxWidth() == 0 && bResizable) - pColumn->setMaxWidth(m_rAntiImpl.LogicToPixel( Size( (int)gridWidth, 0 ), MAP_APPFONT ).Width()); + pColumn->setMaxWidth(m_rAntiImpl.PixelToLogic( Size( (int)gridWidth, 0 ), MAP_APPFONT ).Width()); if( colPrefWidth != 0) { if(m_bResizingGrid) @@ -884,6 +884,16 @@ namespace svt { namespace table // position it if ( m_pHScroll ) { + TableSize nVisibleUnits = lcl_getColumnsVisibleWithin( aDataCellPlayground, m_nLeftColumn, *this, false ); + int nRange = m_nColumnCount; + if( m_nLeftColumn + nVisibleUnits == nRange-1) + { + if(m_aAccColumnWidthsPixel[nRange-2] - m_aAccColumnWidthsPixel[m_nLeftColumn] + m_aColumnWidthsPixel[nRange-1]>aDataCellPlayground.GetWidth()) + { + m_pHScroll->SetVisibleSize( nVisibleUnits -1 ); + m_pHScroll->SetPageSize(nVisibleUnits -1); + } + } Rectangle aScrollbarArea( Point( 0, aDataCellPlayground.Bottom() + 1 ), Size( aDataCellPlayground.Right() + 1, nScrollbarMetrics ) @@ -1000,7 +1010,6 @@ namespace svt { namespace table *m_pDataWindow, aCell.getRect(), rStyle ); } } - // the area occupied by the row header, if any Rectangle aRowHeaderArea; if ( m_pModel->hasRowHeaders() ) @@ -1014,12 +1023,13 @@ namespace svt { namespace table //to avoid double lines when scrolling vertically if(m_nTopRow != 0) --aRowHeaderArea.Top(); + --aRowHeaderArea.Right(); pRenderer->PaintHeaderArea(*m_pDataWindow, aRowHeaderArea, false, true, rStyle); // Note that strictly, aRowHeaderArea also contains the intersection between column // and row header area. However, below we go to paint this intersection, again, // so this hopefully doesn't hurt if we already paint it here. - if ( getModel()->hasColumnHeaders() ) + if ( m_pModel->hasColumnHeaders() ) { TableCellGeometry aIntersection( *this, Rectangle( Point( 0, 0 ), aAllCellsWithHeaders.BottomRight() ), COL_ROW_HEADERS, ROW_COL_HEADERS ); @@ -1030,6 +1040,7 @@ namespace svt { namespace table --aInters.Top(); --aInters.Bottom(); } + --aInters.Right(); pRenderer->PaintHeaderArea( *m_pDataWindow, aInters, true, true, rStyle ); @@ -1068,6 +1079,11 @@ namespace svt { namespace table --aRect.Top(); if(m_nLeftColumn != 0) --aRect.Left(); + else + { + if(m_pModel->hasRowHeaders()) + --aRect.Left(); + } // give the redenderer a chance to prepare the row pRenderer->PrepareRow( aRowIterator.getRow(), isActiveRow, isSelectedRow, *m_pDataWindow, aRect, rStyle ); @@ -1647,6 +1663,12 @@ namespace svt { namespace table { return m_nRowSelected; } + //-------------------------------------------------------------------- + void TableControl_Impl::clearSelection() + { + m_nRowSelected.clear(); + } + //-------------------------------------------------------------------- //------------------------------------------------------------------------------- void TableControl_Impl::removeSelectedRow(RowPos _nRowPos) { @@ -1902,6 +1924,11 @@ namespace svt { namespace table return -1; } //------------------------------------------------------------------------------- + bool TableControl_Impl::isTooltipActive() + { + return m_rAntiImpl.isTooltip(); + } + //------------------------------------------------------------------------------- ::rtl::OUString& TableControl_Impl::setTooltip(const Point& rPoint ) { ::rtl::OUString aTooltipText; @@ -2027,8 +2054,8 @@ namespace svt { namespace table { m_pDataWindow->HideTracking(); PColumnModel pColumn = m_pModel->getColumnModel(m_nResizingColumn); - int maxWidth = pColumn->getMaxWidth(); - int minWidth = pColumn->getMinWidth(); + int maxWidth = m_rAntiImpl.LogicToPixel( Size( pColumn->getMaxWidth(), 0 ), MAP_APPFONT ).Width(); + int minWidth = m_rAntiImpl.LogicToPixel( Size( pColumn->getMinWidth(), 0 ), MAP_APPFONT ).Width(); int resizeCol = m_nResizingColumn-m_nLeftColumn; //new position of mouse int actX = rPoint.X(); @@ -2038,7 +2065,7 @@ namespace svt { namespace table int leftX = 0; if(m_nResizingColumn > m_nLeftColumn) leftX = m_aVisibleColumnWidthsPixel[resizeCol-1]; - else if(m_nResizingColumn == 0 && m_pModel->hasRowHeaders()) + else if(m_nResizingColumn == m_nLeftColumn && m_pModel->hasRowHeaders()) leftX = m_rAntiImpl.LogicToPixel( Size( m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT ).Width(); int actWidth = actX - leftX; int newActWidth = 0; @@ -2051,7 +2078,7 @@ namespace svt { namespace table pColumn->setPreferredWidth(newActWidth); } else - pColumn->setPreferredWidth(minWidth); + pColumn->setPreferredWidth(pColumn->getMinWidth()); if(m_nLeftColumn != 0) impl_updateLeftColumn(); } @@ -2063,7 +2090,7 @@ namespace svt { namespace table pColumn->setPreferredWidth(newActWidth); } else - pColumn->setPreferredWidth(maxWidth); + pColumn->setPreferredWidth(pColumn->getMaxWidth()); } m_nCurColumn = m_nResizingColumn; impl_ni_updateColumnWidths(); diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx index 0a487c77c76c..053766d92841 100644 --- a/svtools/source/table/tablecontrol_impl.hxx +++ b/svtools/source/table/tablecontrol_impl.hxx @@ -204,11 +204,13 @@ namespace svt { namespace table /** updates the vector, which contains the selected rows after removing the row nRowPos*/ void removeSelectedRow(RowPos _nRowPos); void invalidateRows(); + void clearSelection(); // IAbstractTableControl virtual void hideCursor(); virtual void showCursor(); virtual bool dispatchAction( TableControlAction _eAction ); virtual SelectionEngine* getSelEngine(); + virtual bool isTooltipActive(); virtual rtl::OUString& setTooltip(const Point& rPoint ); virtual void resizeColumn(const Point& rPoint); virtual bool startResizeColumn(const Point& rPoint); diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx index e307071e2699..e2e1ce5353fe 100644 --- a/svtools/source/table/tabledatawindow.cxx +++ b/svtools/source/table/tabledatawindow.cxx @@ -47,6 +47,10 @@ namespace svt { namespace table ,m_rTableControl ( _rTableControl ) ,m_nRowAlreadySelected( -1 ) { + // by default, use the background as determined by the style settings + const Color aWindowColor( GetSettings().GetStyleSettings().GetFieldColor() ); + SetBackground( Wallpaper( aWindowColor ) ); + SetFillColor( aWindowColor ); } //-------------------------------------------------------------------- @@ -55,12 +59,32 @@ namespace svt { namespace table m_rTableControl.doPaintContent( rUpdateRect ); } //-------------------------------------------------------------------- + void TableDataWindow::SetBackground( const Wallpaper& rColor ) + { + Window::SetBackground( rColor ); + } + //-------------------------------------------------------------------- + void TableDataWindow::SetControlBackground( const Color& rColor ) + { + Window::SetControlBackground( rColor ); + } + //-------------------------------------------------------------------- + void TableDataWindow::SetBackground() + { + Window::SetBackground(); + } + //-------------------------------------------------------------------- + void TableDataWindow::SetControlBackground() + { + Window::SetControlBackground(); + } + //-------------------------------------------------------------------- void TableDataWindow::MouseMove( const MouseEvent& rMEvt ) { Point aPoint = rMEvt.GetPosPixel(); if ( !m_rTableControl.getInputHandler()->MouseMove( m_rTableControl, rMEvt ) ) { - if(m_rTableControl.getCurrentRow(aPoint)>=0 ) + if(m_rTableControl.getCurrentRow(aPoint)>=0 && m_rTableControl.isTooltipActive() ) { SetPointer(POINTER_ARROW); rtl::OUString& rHelpText = m_rTableControl.setTooltip(aPoint); @@ -97,12 +121,9 @@ namespace svt { namespace table m_nRowAlreadySelected = nCurRow; m_aSelectHdl.Call( NULL ); } - else - m_aMouseButtonDownHdl.Call((MouseEvent*) &rMEvt); } - else - m_aMouseButtonDownHdl.Call((MouseEvent*) &rMEvt); } + m_aMouseButtonDownHdl.Call((MouseEvent*) &rMEvt); m_rTableControl.getAntiImpl().LoseFocus(); } //-------------------------------------------------------------------- @@ -110,8 +131,7 @@ namespace svt { namespace table { if ( !m_rTableControl.getInputHandler()->MouseButtonUp( m_rTableControl, rMEvt ) ) Window::MouseButtonUp( rMEvt ); - else - m_aMouseButtonUpHdl.Call((MouseEvent*) &rMEvt); + m_aMouseButtonUpHdl.Call((MouseEvent*) &rMEvt); m_rTableControl.getAntiImpl().GetFocus(); } //-------------------------------------------------------------------- diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index 38aee00c8f55..23067d3ee5d0 100755 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -296,19 +296,18 @@ namespace svt const ControlState nState( lcl_ItemToControlState( i_nItemFlags ) ); TabitemValue tiValue; - ImplControlValue aControlValue( (void*)(&tiValue) ); - Region aBoundingRegion, aContentRegion; + Rectangle aBoundingRegion, aContentRegion; bool bNativeOK = getTargetDevice().GetNativeControlRegion( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL, i_rContentArea, nState, - aControlValue, ::rtl::OUString(), + tiValue, ::rtl::OUString(), aBoundingRegion, aContentRegion ); (void)bNativeOK; OSL_ENSURE( bNativeOK, "NWFTabItemRenderer::calculateDecorations: GetNativeControlRegion not implemented for CTRL_TAB_ITEM?!" ); - return aBoundingRegion.GetBoundRect(); + return aBoundingRegion; } //------------------------------------------------------------------------------------------------------------------ @@ -322,9 +321,8 @@ namespace svt if ( i_nItemFlags & ITEM_POSITION_LAST ) tiValue.mnAlignment |= TABITEM_LAST_IN_GROUP; - ImplControlValue aControlValue( (void *)(&tiValue) ); - bool bNativeOK = getTargetDevice().DrawNativeControl( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL, i_rContentRect, nState, aControlValue, rtl::OUString() ); + bool bNativeOK = getTargetDevice().DrawNativeControl( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL, i_rContentRect, nState, tiValue, rtl::OUString() ); (void)bNativeOK; OSL_ENSURE( bNativeOK, "NWFTabItemRenderer::preRenderItem: inconsistent NWF implementation!" ); // IsNativeControlSupported returned true, previously, otherwise we would not be here ... diff --git a/svtools/source/toolpanel/toolpanel.cxx b/svtools/source/toolpanel/toolpanel.cxx index 35446d1ffe2b..f7b999494563 100644 --- a/svtools/source/toolpanel/toolpanel.cxx +++ b/svtools/source/toolpanel/toolpanel.cxx @@ -24,6 +24,8 @@ * ************************************************************************/ +#include "precompiled_svtools.hxx" + #include "svtools/toolpanel/toolpanel.hxx" //........................................................................ diff --git a/svtools/source/uno/miscservices.cxx b/svtools/source/uno/miscservices.cxx index 433c1e1acbcb..e16a1ecb56dc 100644 --- a/svtools/source/uno/miscservices.cxx +++ b/svtools/source/uno/miscservices.cxx @@ -38,10 +38,13 @@ #include <uno/mapping.hxx> #include "provider.hxx" #include "renderer.hxx" +#include "unowizard.hxx" #include <com/sun/star/registry/XRegistryKey.hpp> #include "comphelper/servicedecl.hxx" +#include "cppuhelper/implementationentry.hxx" + using namespace ::com::sun::star::uno; using namespace ::com::sun::star::registry; using namespace ::com::sun::star::lang; @@ -67,6 +70,20 @@ extern sdecl::ServiceDecl const serviceDecl; Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& ); \ } +namespace +{ + static struct ::cppu::ImplementationEntry s_aServiceEntries[] = + { + { + ::svt::uno::Wizard::Create, + ::svt::uno::Wizard::getImplementationName_static, + ::svt::uno::Wizard::getSupportedServiceNames_static, + ::cppu::createSingleComponentFactory, NULL, 0 + }, + { 0, 0, 0, 0, 0, 0 } + }; +} + // ------------------------------------------------------------------------------------- DECLARE_CREATEINSTANCE_NAMESPACE( svt, OAddressBookSourceDialogUno ) @@ -126,9 +143,9 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( xNewKey->createKey( aServices.getConstArray()[ i ] ); if ( !component_writeInfoHelper( reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), reinterpret_cast< registry::XRegistryKey* >( _pRegistryKey ), serviceDecl ) ) - return false; + return false; - return sal_True; + return ::cppu::component_writeInfoHelper( pServiceManager, _pRegistryKey, s_aServiceEntries ); } return sal_False; } @@ -185,6 +202,8 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( else { pResult = component_getFactoryHelper( pImplementationName, reinterpret_cast< lang::XMultiServiceFactory * >( _pServiceManager ),reinterpret_cast< registry::XRegistryKey* >( pRegistryKey ), serviceDecl ); + if ( !pResult ) + pResult = ::cppu::component_getFactoryHelper( pImplementationName, _pServiceManager, pRegistryKey, s_aServiceEntries ); } if ( xFactory.is() ) diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index b411181c2aab..f5bc837f60b0 100755 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -79,7 +79,6 @@ SVTXGridControl::SVTXGridControl() //-------------------------------------------------------------------- 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) @@ -129,6 +128,18 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An TableControl* pTable = (TableControl*)GetWindow(); switch( GetPropertyId( PropertyName ) ) { + case BASEPROPERTY_BACKGROUNDCOLOR: + { + // let the base class handle this for the TableControl + VCLXWindow::setProperty( PropertyName, aValue ); + // and forward to the grid control's data window + if ( pTable->IsBackground() ) + pTable->getDataWindow()->SetBackground( pTable->GetBackground() ); + else + pTable->getDataWindow()->SetBackground(); + } + break; + case BASEPROPERTY_GRID_SELECTIONMODE: { SelectionType eSelectionType; @@ -180,7 +191,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An } case BASEPROPERTY_GRID_HEADER_BACKGROUND: { - sal_Int32 colorHeader = 0x000000; + sal_Int32 colorHeader = 0xFFFFFF; if( aValue >>= colorHeader ) { m_pTableModel->setHeaderBackgroundColor(colorHeader); @@ -189,7 +200,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An } case BASEPROPERTY_GRID_LINE_COLOR: { - sal_Int32 colorLine = 0x000000; + sal_Int32 colorLine = 0xFFFFFF; if( aValue >>= colorLine ) { m_pTableModel->setLineColor(colorLine); @@ -198,7 +209,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An } case BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND: { - sal_Int32 colorEvenRow = 0x000000; + sal_Int32 colorEvenRow = 0xFFFFFF; if( aValue >>= colorEvenRow ) { m_pTableModel->setEvenRowBackgroundColor(colorEvenRow); @@ -207,7 +218,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An } case BASEPROPERTY_GRID_ROW_BACKGROUND: { - sal_Int32 colorBackground = 0x000000; + sal_Int32 colorBackground = 0xFFFFFF; if( aValue >>= colorBackground ) { m_pTableModel->setOddRowBackgroundColor(colorBackground); @@ -216,7 +227,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An } case BASEPROPERTY_TEXTCOLOR: { - sal_Int32 colorText = 0xFFFFFF; + sal_Int32 colorText = 0x000000; if( aValue >>= colorText ) { m_pTableModel->setTextColor(colorText); @@ -410,6 +421,7 @@ void SVTXGridControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) } void SAL_CALL SVTXGridControl::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aGuard( GetMutex() ); TableControl* pTable = (TableControl*)GetWindow(); if ( pTable ) { @@ -425,6 +437,8 @@ void SAL_CALL SVTXGridControl::setFocus() throw(::com::sun::star::uno::RuntimeEx } void SAL_CALL SVTXGridControl::rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aGuard( GetMutex() ); + std::vector< Any > newRow; Sequence< Any > rawRowData = Event.rowData; int colCount = m_xColumnModel->getColumnCount(); @@ -471,6 +485,8 @@ void SAL_CALL SVTXGridControl::rowAdded(const ::com::sun::star::awt::grid::GridD void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aGuard( GetMutex() ); + TableControl* pTable = (TableControl*)GetWindow(); if(Event.index == -1) { @@ -478,6 +494,7 @@ void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::Gri deselectAllRows(); if(m_pTableModel->hasRowHeaders()) m_pTableModel->getRowHeaderName().clear(); + pTable->clearSelection(); m_pTableModel->getCellContent().clear(); if(pTable->isAccessibleAlive()) { @@ -511,6 +528,8 @@ void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::Gri void SAL_CALL SVTXGridControl::columnChanged(const ::com::sun::star::awt::grid::GridColumnEvent& Event ) throw (::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aGuard( GetMutex() ); + TableControl* pTable = (TableControl*)GetWindow(); if(Event.valueName == rtl::OUString::createFromAscii("ColumnResize")) { @@ -558,6 +577,8 @@ void SAL_CALL SVTXGridControl::columnChanged(const ::com::sun::star::awt::grid: } void SAL_CALL SVTXGridControl::dataChanged(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aGuard( GetMutex() ); + TableControl* pTable = (TableControl*)GetWindow(); if(Event.valueName == rtl::OUString::createFromAscii("RowHeight")) { @@ -652,10 +673,10 @@ void SAL_CALL SVTXGridControl::selectRows(const ::com::sun::star::uno::Sequence< if((start >= 0 && start < m_pTableModel->getRowCount()) && (end >= 0 && end < m_pTableModel->getRowCount())) { std::vector<RowPos>& selectedRows = pTable->GetSelectedRows(); - if(!selectedRows.empty()) - selectedRows.clear(); if(eSelMode == SINGLE_SELECTION) { + if(!selectedRows.empty()) + selectedRows.clear(); if(rangeOfRows.getLength() == 1) selectedRows.push_back(start); else @@ -664,7 +685,10 @@ void SAL_CALL SVTXGridControl::selectRows(const ::com::sun::star::uno::Sequence< else { for(int i=0;i<seqSize;i++) - selectedRows.push_back(rangeOfRows[i]); + { + if(!isSelectedIndex(rangeOfRows[i])) + selectedRows.push_back(rangeOfRows[i]); + } } pTable->selectionChanged(true); pTable->InvalidateDataWindow(start, end, false); @@ -692,24 +716,23 @@ void SAL_CALL SVTXGridControl::selectAllRows() throw (::com::sun::star::uno::Run SetSynthesizingVCLEvent( sal_False ); } } + void SAL_CALL SVTXGridControl::deselectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException) { TableControl* pTable = (TableControl*)GetWindow(); std::vector<RowPos>& selectedRows = pTable->GetSelectedRows(); std::vector<RowPos>::iterator itStart = selectedRows.begin(); std::vector<RowPos>::iterator itEnd = selectedRows.end(); - sal_Int32 start = rangeOfRows[0]; - sal_Int32 end = rangeOfRows[rangeOfRows.getLength()-1]; - if((start >= 0 && start < m_pTableModel->getRowCount()) && (end >= 0 && end < m_pTableModel->getRowCount())) + for(int i = 0; i < rangeOfRows.getLength(); i++ ) { - std::vector<RowPos>::iterator iter = std::find(itStart, itEnd, start); - selectedRows.erase(iter, iter+(end-start)+1); - pTable->selectionChanged(true); - pTable->InvalidateDataWindow(start, end, false); - SetSynthesizingVCLEvent( sal_True ); - pTable->Select(); - SetSynthesizingVCLEvent( sal_False ); + std::vector<RowPos>::iterator iter = std::find(itStart, itEnd, rangeOfRows[i]); + selectedRows.erase(iter); } + pTable->selectionChanged(true); + pTable->Invalidate(); + SetSynthesizingVCLEvent( sal_True ); + pTable->Select(); + SetSynthesizingVCLEvent( sal_False ); } void SAL_CALL SVTXGridControl::deselectAllRows() throw (::com::sun::star::uno::RuntimeException) @@ -848,7 +871,7 @@ void SVTXGridControl::ImplCallItemListeners() aEvent.Range = diff; } //selected row changed - else if(diff == 0) + else if(diff == 0 && actSelRowCount != 0) { aEvent.Row = selRows[actSelRowCount-1]; aEvent.Action = com::sun::star::awt::grid::SelectionEventType(2); diff --git a/svtools/source/uno/svtxgridcontrol.hxx b/svtools/source/uno/svtxgridcontrol.hxx index bcb8badf72e5..b15507e4614f 100755 --- a/svtools/source/uno/svtxgridcontrol.hxx +++ b/svtools/source/uno/svtxgridcontrol.hxx @@ -51,7 +51,7 @@ class SVTXGridControl : public ::cppu::ImplInheritanceHelper3< VCLXWindow, ::com ::com::sun::star::awt::grid::XGridDataListener, ::com::sun::star::awt::grid::XGridColumnListener> { private: - UnoControlTableModel* m_pTableModel; + ::boost::shared_ptr< 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; diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx index d9b84aa2e356..bdb2256a07e8 100644 --- a/svtools/source/uno/toolboxcontroller.cxx +++ b/svtools/source/uno/toolboxcontroller.cxx @@ -42,6 +42,12 @@ #include <toolkit/unohlp.hxx> #endif #include <vcl/toolbox.hxx> +//shizhobo +#include <com/sun/star/beans/PropertyAttribute.hpp> +const int TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE = 1; +const int TOOLBARCONTROLLER_PROPCOUNT = 1; +const rtl::OUString TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIABLE( RTL_CONSTASCII_USTRINGPARAM( "SupportsVisiable" )); +//end using ::rtl::OUString; @@ -82,10 +88,12 @@ struct ToolboxController_Impl }; ToolboxController::ToolboxController( + const Reference< XMultiServiceFactory >& rServiceManager, const Reference< XFrame >& xFrame, const ::rtl::OUString& aCommandURL ) : - OWeakObject() + OPropertyContainer(GetBroadcastHelper()) + , OWeakObject() , m_bInitialized( sal_False ) , m_bDisposed( sal_False ) , m_xFrame(xFrame) @@ -93,6 +101,10 @@ ToolboxController::ToolboxController( , m_aCommandURL( aCommandURL ) , m_aListenerContainer( m_aMutex ) { + //registger Propertyh by shizhoubo + registerProperty(TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIABLE, TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE, com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY, + &m_bSupportVisiable, getCppuType(&m_bSupportVisiable)); + m_pImpl = new ToolboxController_Impl; try @@ -107,11 +119,16 @@ ToolboxController::ToolboxController( } ToolboxController::ToolboxController() : - OWeakObject() + OPropertyContainer(GetBroadcastHelper()) + , OWeakObject() , m_bInitialized( sal_False ) , m_bDisposed( sal_False ) , m_aListenerContainer( m_aMutex ) { + //registger Propertyh by shizhoubo + registerProperty(TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIABLE, TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE, com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY, + &m_bSupportVisiable, getCppuType(&m_bSupportVisiable)); + m_pImpl = new ToolboxController_Impl; } @@ -167,11 +184,16 @@ throw ( RuntimeException ) static_cast< XInitialization* >( this ), static_cast< XComponent* >( this ), static_cast< XUpdatable* >( this )); - - if ( a.hasValue() ) - return a; - - return OWeakObject::queryInterface( rType ); + if ( !a.hasValue()) + { + a = ::cppu::queryInterface(rType + ,static_cast<XPropertySet*>(this) + ,static_cast<XMultiPropertySet*>(this) + ,static_cast<XFastPropertySet*>(this)); + if (!a.hasValue()) + return OWeakObject::queryInterface( rType ); + } + return a; } void SAL_CALL ToolboxController::acquire() throw () @@ -202,7 +224,8 @@ throw ( Exception, RuntimeException ) { vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); m_bInitialized = sal_True; - + //shizhoubo add + m_bSupportVisiable = sal_False; PropertyValue aPropValue; for ( int i = 0; i < aArguments.getLength(); i++ ) { @@ -747,6 +770,70 @@ void ToolboxController::dispatchCommand( const OUString& sCommandURL, const Sequ } } +// +//------------------------------------------------------------------------- +// XPropertySet by shizhoubo +com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL ToolboxController::getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException) +{ + Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} +//------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper& ToolboxController::getInfoHelper() +{ + return *const_cast<ToolboxController*>(this)->getArrayHelper(); +} +//OPropertyArrayUsageHelper by shizhoubo +//------------------------------------------------------------------------------ +::cppu::IPropertyArrayHelper* ToolboxController::createArrayHelper( ) const +{ + com::sun::star::uno::Sequence< Property > aProps; + describeProperties(aProps); + return new ::cppu::OPropertyArrayHelper(aProps); +} +//shizhoubo for supportsvisiable +void ToolboxController::setSupportVisiableProperty(sal_Bool bValue) +{ + m_bSupportVisiable = bValue; +} +//OPropertySetHelper by shizhoubo +sal_Bool SAL_CALL ToolboxController::convertFastPropertyValue( com::sun::star::uno::Any& aConvertedValue , + com::sun::star::uno::Any& aOldValue , + sal_Int32 nHandle , + const com::sun::star::uno::Any& aValue ) throw( com::sun::star::lang::IllegalArgumentException ) +{ + switch (nHandle) + { + case TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE: + { + sal_Bool aNewValue(sal_False); + aValue >>= aNewValue; + if (aNewValue != m_bSupportVisiable) + { + aConvertedValue <<= aNewValue; + aOldValue <<= m_bSupportVisiable; + return sal_True; + } + return sal_False; + } + } + return OPropertyContainer::convertFastPropertyValue(aConvertedValue, aOldValue, nHandle, aValue); +} + +void SAL_CALL ToolboxController::setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const com::sun::star::uno::Any& aValue ) +throw( com::sun::star::uno::Exception) +{ + OPropertyContainer::setFastPropertyValue_NoBroadcast(nHandle, aValue); + if (TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE == nHandle) + { + sal_Bool rValue(sal_False); + if (( aValue >>= rValue ) && m_bInitialized) + this->setSupportVisiableProperty( rValue ); + } +} + //-------------------------------------------------------------------- IMPL_STATIC_LINK_NOINSTANCE( ToolboxController_Impl, ExecuteHdl_Impl, DispatchInfo*, pDispatchInfo ) @@ -794,5 +881,6 @@ bool ToolboxController::getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox ) return (rItemId != SAL_MAX_UINT16) && (( ppToolBox == 0) || (*ppToolBox != 0) ); } +//end } // svt diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx index e5a273bbbf6d..7fb1a007960f 100644 --- a/svtools/source/uno/treecontrolpeer.cxx +++ b/svtools/source/uno/treecontrolpeer.cxx @@ -34,6 +34,7 @@ #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/view/SelectionType.hpp> #include <toolkit/helper/property.hxx> +#include <toolkit/helper/vclunohelper.hxx> #include <com/sun/star/awt/tree/XMutableTreeNode.hpp> #include <treecontrolpeer.hxx> @@ -196,9 +197,7 @@ void TreeControlPeer::addEntry( UnoTreeListEntry* pEntry ) mpTreeNodeMap = new TreeNodeMap(); } - const Reference< XTreeNode > xNormalizedNode( pEntry->mxNode, UNO_QUERY ); - (*mpTreeNodeMap)[ xNormalizedNode ] = pEntry; - OSL_TRACE( "tree: adding %p => %p", xNormalizedNode.get(), pEntry ); + (*mpTreeNodeMap)[ pEntry->mxNode ] = pEntry; } } @@ -208,11 +207,9 @@ void TreeControlPeer::removeEntry( UnoTreeListEntry* pEntry ) { if( mpTreeNodeMap && pEntry && pEntry->mxNode.is() ) { - const Reference< XTreeNode > xNormalizedNode( pEntry->mxNode, UNO_QUERY ); - TreeNodeMap::iterator aIter( mpTreeNodeMap->find( xNormalizedNode ) ); + TreeNodeMap::iterator aIter( mpTreeNodeMap->find( pEntry->mxNode ) ); if( aIter != mpTreeNodeMap->end() ) { - OSL_TRACE( "tree: removing %p => %p", xNormalizedNode.get(), pEntry ); mpTreeNodeMap->erase( aIter ); } } @@ -224,8 +221,7 @@ UnoTreeListEntry* TreeControlPeer::getEntry( const Reference< XTreeNode >& xNode { if( mpTreeNodeMap ) { - const Reference< XTreeNode > xNormalizedNode( xNode, UNO_QUERY ); - TreeNodeMap::iterator aIter( mpTreeNodeMap->find( xNormalizedNode ) ); + TreeNodeMap::iterator aIter( mpTreeNodeMap->find( xNode ) ); if( aIter != mpTreeNodeMap->end() ) return (*aIter).second; } @@ -287,14 +283,14 @@ UnoTreeListEntry* TreeControlPeer::createEntry( const Reference< XTreeNode >& xN pEntry->AddItem( pUnoItem ); + mpTreeImpl->insert( pEntry, pParent, nPos ); + if( msDefaultExpandedGraphicURL.getLength() ) mpTreeImpl->SetExpandedEntryBmp( pEntry, maDefaultExpandedImage ); if( msDefaultCollapsedGraphicURL.getLength() ) mpTreeImpl->SetCollapsedEntryBmp( pEntry, maDefaultCollapsedImage ); - mpTreeImpl->insert( pEntry, pParent, nPos ); - updateEntry( pEntry ); } return pEntry; @@ -922,6 +918,19 @@ Reference< XTreeNode > SAL_CALL TreeControlPeer::getClosestNodeForLocation( sal_ // ------------------------------------------------------------------- +awt::Rectangle SAL_CALL TreeControlPeer::getNodeRect( const Reference< XTreeNode >& i_Node ) throw (IllegalArgumentException, RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow(); + UnoTreeListEntry* pEntry = getEntry( i_Node, true ); + + ::Rectangle aEntryRect( rTree.GetFocusRect( pEntry, rTree.GetEntryPosition( pEntry ).Y() ) ); + return VCLUnoHelper::ConvertToAWTRect( aEntryRect ); +} + +// ------------------------------------------------------------------- + sal_Bool SAL_CALL TreeControlPeer::isEditing( ) throw (RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); diff --git a/svtools/source/uno/treecontrolpeer.hxx b/svtools/source/uno/treecontrolpeer.hxx index 015e131321f8..336830804a6f 100644 --- a/svtools/source/uno/treecontrolpeer.hxx +++ b/svtools/source/uno/treecontrolpeer.hxx @@ -91,6 +91,7 @@ public: virtual void SAL_CALL removeTreeExpansionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeExpansionListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getNodeForLocation( ::sal_Int32 x, ::sal_Int32 y ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getClosestNodeForLocation( ::sal_Int32 x, ::sal_Int32 y ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getNodeRect( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL isEditing( ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL stopEditing( ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL cancelEditing( ) throw (::com::sun::star::uno::RuntimeException); diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx index f2090be1655f..2d22d9cedb33 100644 --- a/svtools/source/uno/unoiface.cxx +++ b/svtools/source/uno/unoiface.cxx @@ -1664,7 +1664,7 @@ void SVTXRoadmap::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_TEXT, 0); VCLXWindow::ImplGetPropertyIds( rIds, true ); - VCLXImageConsumer::ImplGetPropertyIds( rIds ); + VCLXGraphicControl::ImplGetPropertyIds( rIds ); } // ---------------------------------------------------- diff --git a/svtools/source/uno/unoimap.cxx b/svtools/source/uno/unoimap.cxx index 6b6e35482ae9..88f22f0c8402 100644 --- a/svtools/source/uno/unoimap.cxx +++ b/svtools/source/uno/unoimap.cxx @@ -210,6 +210,8 @@ PropertySetInfo* SvUnoImageMapObject::createPropertySetInfo( UINT16 nType ) SvUnoImageMapObject::SvUnoImageMapObject( UINT16 nType, const SvEventDescription* pSupportedMacroItems ) : PropertySetHelper( createPropertySetInfo( nType ) ), mnType( nType ) +, mbIsActive( true ) +, mnRadius( 0 ) { mpEvents = new SvMacroTableEventDescriptor( pSupportedMacroItems ); mpEvents->acquire(); @@ -218,6 +220,8 @@ SvUnoImageMapObject::SvUnoImageMapObject( UINT16 nType, const SvEventDescription SvUnoImageMapObject::SvUnoImageMapObject( const IMapObject& rMapObject, const SvEventDescription* pSupportedMacroItems ) : PropertySetHelper( createPropertySetInfo( rMapObject.GetType() ) ), mnType( rMapObject.GetType() ) +, mbIsActive( true ) +, mnRadius( 0 ) { maURL = rMapObject.GetURL(); maAltText = rMapObject.GetAltText(); diff --git a/svtools/source/uno/unowizard.hxx b/svtools/source/uno/unowizard.hxx new file mode 100644 index 000000000000..ceb8fac14eb6 --- /dev/null +++ b/svtools/source/uno/unowizard.hxx @@ -0,0 +1,117 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVT_UNO_WIZARD_HXX +#define SVT_UNO_WIZARD_HXX + +#include "svtools/genericunodialog.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/ui/dialogs/XWizard.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/ui/dialogs/XWizardController.hpp> +/** === end UNO includes === **/ + +#include <cppuhelper/implbase1.hxx> +#include <comphelper/componentcontext.hxx> + +//...................................................................................................................... +namespace svt { namespace uno +{ +//...................................................................................................................... + + //================================================================================================================== + //= Wizard - declaration + //================================================================================================================== + typedef ::cppu::ImplInheritanceHelper1 < ::svt::OGenericUnoDialog + , ::com::sun::star::ui::dialogs::XWizard + > Wizard_Base; + class Wizard; + typedef ::comphelper::OPropertyArrayUsageHelper< Wizard > Wizard_PBase; + class Wizard : public Wizard_Base + , public Wizard_PBase + { + public: + Wizard( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext ); + + // ::com::sun::star::lang::XServiceInfo - static version + static ::rtl::OUString SAL_CALL getImplementationName_static() throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static() throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext ); + + protected: + // ::com::sun::star::lang::XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::beans::XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + + // ::com::sun::star::ui::dialogs::XWizard + virtual ::rtl::OUString SAL_CALL getHelpURL() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setHelpURL( const ::rtl::OUString& _helpurl ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getDialogWindow() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage > SAL_CALL getCurrentPage( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL enableButton( ::sal_Int16 WizardButton, ::sal_Bool Enable ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDefaultButton( ::sal_Int16 WizardButton ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL travelNext( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL travelPrevious( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL enablePage( ::sal_Int16 PageID, ::sal_Bool Enable ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::util::InvalidStateException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateTravelUI( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL advanceTo( ::sal_Int16 PageId ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL goBackTo( ::sal_Int16 PageId ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL activatePath( ::sal_Int16 PathIndex, ::sal_Bool Final ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::util::InvalidStateException, ::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::ui::dialogs::XExecutableDialog + virtual void SAL_CALL setTitle( const ::rtl::OUString& aTitle ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL execute( ) throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::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); + + protected: + ~Wizard(); + + protected: + virtual Dialog* createDialog( Window* _pParent ); + virtual void destroyDialog(); + + private: + ::comphelper::ComponentContext m_aContext; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int16 > > m_aWizardSteps; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController > m_xController; + ::rtl::OUString m_sHelpURL; + }; + +//...................................................................................................................... +} } // namespace svt::uno +//...................................................................................................................... + +#endif // SVT_UNO_WIZARD_HXX diff --git a/svtools/source/uno/wizard/makefile.mk b/svtools/source/uno/wizard/makefile.mk new file mode 100644 index 000000000000..521496fc5d48 --- /dev/null +++ b/svtools/source/uno/wizard/makefile.mk @@ -0,0 +1,48 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=../../.. + +PRJNAME=svtools +TARGET=unowiz +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/svt.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES= \ + $(SLO)$/unowizard.obj \ + $(SLO)$/wizardshell.obj \ + $(SLO)$/wizardpagecontroller.obj + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx new file mode 100644 index 000000000000..9440c0e69f26 --- /dev/null +++ b/svtools/source/uno/wizard/unowizard.cxx @@ -0,0 +1,452 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_svtools.hxx" + +#include "../unowizard.hxx" +#include "wizardshell.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/beans/XPropertySetInfo.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/ucb/AlreadyInitializedException.hpp> +#include <com/sun/star/ui/dialogs/XWizardController.hpp> +#include <com/sun/star/ui/dialogs/WizardButton.hpp> +/** === end UNO includes === **/ + +#include <tools/diagnose_ex.h> +#include <rtl/strbuf.hxx> +#include <vos/mutex.hxx> +#include <vcl/svapp.hxx> + +//...................................................................................................................... +namespace svt { namespace uno +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::lang::XServiceInfo; + using ::com::sun::star::ui::dialogs::XWizard; + using ::com::sun::star::lang::XInitialization; + using ::com::sun::star::beans::XPropertySetInfo; + using ::com::sun::star::uno::XComponentContext; + using ::com::sun::star::beans::Property; + using ::com::sun::star::lang::IllegalArgumentException; + using ::com::sun::star::ucb::AlreadyInitializedException; + using ::com::sun::star::ui::dialogs::XWizardController; + using ::com::sun::star::ui::dialogs::XWizardPage; + using ::com::sun::star::container::NoSuchElementException; + using ::com::sun::star::util::InvalidStateException; + using ::com::sun::star::awt::XWindow; + /** === end UNO using === **/ + namespace WizardButton = ::com::sun::star::ui::dialogs::WizardButton; + + //------------------------------------------------------------------------------------------------------------------ + namespace + { + sal_uInt32 lcl_convertWizardButtonToWZB( const sal_Int16 i_nWizardButton ) + { + switch ( i_nWizardButton ) + { + case WizardButton::NONE: return WZB_NONE; + case WizardButton::NEXT: return WZB_NEXT; + case WizardButton::PREVIOUS: return WZB_PREVIOUS; + case WizardButton::FINISH: return WZB_FINISH; + case WizardButton::CANCEL: return WZB_CANCEL; + case WizardButton::HELP: return WZB_HELP; + } + OSL_ENSURE( false, "lcl_convertWizardButtonToWZB: invalid WizardButton constant!" ); + return WZB_NONE; + } + } + + //================================================================================================================== + //= Wizard - implementation + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + Wizard::Wizard( const Reference< XComponentContext >& _rxContext ) + :Wizard_Base( _rxContext ) + ,m_aContext( _rxContext ) + { + } + + //-------------------------------------------------------------------- + Wizard::~Wizard() + { + // we do this here cause the base class' call to destroyDialog won't reach us anymore : we're within an dtor, + // so this virtual-method-call the base class does does not work, we're already dead then ... + if ( m_pDialog ) + { + ::osl::MutexGuard aGuard( m_aMutex ); + if ( m_pDialog ) + destroyDialog(); + } + } + + //-------------------------------------------------------------------- + Reference< XInterface > SAL_CALL Wizard::Create( const Reference< XComponentContext >& _rxContext ) + { + return *(new Wizard( _rxContext ) ); + } + + //-------------------------------------------------------------------- + namespace + { + static void lcl_checkPaths( const Sequence< Sequence< sal_Int16 > >& i_rPaths, const Reference< XInterface >& i_rContext ) + { + // need at least one path + if ( i_rPaths.getLength() == 0 ) + throw IllegalArgumentException( ::rtl::OUString(), i_rContext, 2 ); + + // each path must be of length 1, at least + for ( sal_Int32 i = 0; i < i_rPaths.getLength(); ++i ) + { + if ( i_rPaths[i].getLength() == 0 ) + throw IllegalArgumentException( ::rtl::OUString(), i_rContext, 2 ); + + // page IDs must be in ascending order + sal_Int16 nPreviousPageID = i_rPaths[i][0]; + for ( sal_Int32 j=1; j<i_rPaths[i].getLength(); ++j ) + { + if ( i_rPaths[i][j] <= nPreviousPageID ) + { + ::rtl::OStringBuffer message; + message.append( "Path " ); + message.append( i ); + message.append( ": invalid page ID sequence - each page ID must be greater than the previous one." ); + throw IllegalArgumentException( + ::rtl::OStringToOUString( message.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US ), + i_rContext, 2 ); + } + nPreviousPageID = i_rPaths[i][j]; + } + } + + // if we have one path, that's okay + if ( i_rPaths.getLength() == 1 ) + return; + + // if we have multiple paths, they must start with the same page id + const sal_Int16 nFirstPageId = i_rPaths[0][0]; + for ( sal_Int32 i = 0; i < i_rPaths.getLength(); ++i ) + { + if ( i_rPaths[i][0] != nFirstPageId ) + throw IllegalArgumentException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "All paths must start with the same page id." ) ), + i_rContext, 2 ); + } + } + } + + //-------------------------------------------------------------------- + void SAL_CALL Wizard::initialize( const Sequence< Any >& i_Arguments ) throw (Exception, RuntimeException) + { + ::osl::MutexGuard aGuard( m_aMutex ); + if ( m_bInitialized ) + throw AlreadyInitializedException( ::rtl::OUString(), *this ); + + if ( i_Arguments.getLength() != 2 ) + throw IllegalArgumentException( ::rtl::OUString(), *this, -1 ); + + // the second argument must be a XWizardController, for each constructor + m_xController.set( i_Arguments[1], UNO_QUERY ); + if ( !m_xController.is() ) + throw IllegalArgumentException( ::rtl::OUString(), *this, 2 ); + + // the first arg is either a single path (short[]), or multiple paths (short[][]) + Sequence< sal_Int16 > aSinglePath; + i_Arguments[0] >>= aSinglePath; + Sequence< Sequence< sal_Int16 > > aMultiplePaths; + i_Arguments[0] >>= aMultiplePaths; + + if ( !aMultiplePaths.getLength() ) + { + aMultiplePaths.realloc(1); + aMultiplePaths[0] = aSinglePath; + } + lcl_checkPaths( aMultiplePaths, *this ); + // if we survived this, the paths are valid, and we're done here ... + m_aWizardSteps = aMultiplePaths; + + m_bInitialized = true; + } + + //-------------------------------------------------------------------- + Dialog* Wizard::createDialog( Window* i_pParent ) + { + WizardShell* pDialog( new WizardShell( i_pParent, this, m_xController, m_aWizardSteps ) ); + pDialog->SetSmartHelpId( SmartId( m_sHelpURL ) ); + pDialog->setTitleBase( m_sTitle ); + return pDialog; + } + + //-------------------------------------------------------------------- + void Wizard::destroyDialog() + { + if ( m_pDialog ) + m_sHelpURL = m_pDialog->GetSmartHelpId().GetStr(); + + Wizard_Base::destroyDialog(); + } + + //-------------------------------------------------------------------- + ::rtl::OUString SAL_CALL Wizard::getImplementationName_static() throw(RuntimeException) + { + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.uno.Wizard" ) ); + } + + //-------------------------------------------------------------------- + Sequence< ::rtl::OUString > SAL_CALL Wizard::getSupportedServiceNames_static() throw(RuntimeException) + { + Sequence< ::rtl::OUString > aServices(1); + aServices[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.Wizard" ) ); + return aServices; + } + + //-------------------------------------------------------------------- + ::rtl::OUString SAL_CALL Wizard::getImplementationName() throw(RuntimeException) + { + return getImplementationName_static(); + } + + //-------------------------------------------------------------------- + Sequence< ::rtl::OUString > SAL_CALL Wizard::getSupportedServiceNames() throw(RuntimeException) + { + return getSupportedServiceNames_static(); + } + + //-------------------------------------------------------------------- + Reference< XPropertySetInfo > SAL_CALL Wizard::getPropertySetInfo() throw(RuntimeException) + { + return createPropertySetInfo( getInfoHelper() ); + } + + //-------------------------------------------------------------------- + ::cppu::IPropertyArrayHelper& SAL_CALL Wizard::getInfoHelper() + { + return *const_cast< Wizard* >( this )->getArrayHelper(); + } + + //-------------------------------------------------------------------- + ::cppu::IPropertyArrayHelper* Wizard::createArrayHelper( ) const + { + Sequence< Property > aProps; + describeProperties( aProps ); + return new ::cppu::OPropertyArrayHelper( aProps ); + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString SAL_CALL Wizard::getHelpURL() throw (RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pDialog ) + return m_sHelpURL; + + const SmartId aSmartId( m_pDialog->GetSmartHelpId() ); + return aSmartId.GetStr(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL Wizard::setHelpURL( const ::rtl::OUString& i_HelpURL ) throw (RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pDialog ) + m_sHelpURL = i_HelpURL; + else + m_pDialog->SetSmartHelpId( SmartId( i_HelpURL ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XWindow > SAL_CALL Wizard::getDialogWindow() throw (RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + ENSURE_OR_RETURN( m_pDialog, "Wizard::getDialogWindow: illegal call (execution did not start, yet)!", NULL ); + return Reference< XWindow >( m_pDialog->GetComponentInterface(), UNO_QUERY ); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL Wizard::enableButton( ::sal_Int16 i_WizardButton, ::sal_Bool i_Enable ) throw (RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::enableButtons: invalid dialog implementation!" ); + + pWizardImpl->enableButtons( lcl_convertWizardButtonToWZB( i_WizardButton ), i_Enable ); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL Wizard::setDefaultButton( ::sal_Int16 i_WizardButton ) throw (RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::setDefaultButton: invalid dialog implementation!" ); + + pWizardImpl->defaultButton( lcl_convertWizardButtonToWZB( i_WizardButton ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Bool SAL_CALL Wizard::travelNext( ) throw (RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::travelNext: invalid dialog implementation!" ); + + return pWizardImpl->travelNext(); + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Bool SAL_CALL Wizard::travelPrevious( ) throw (RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::travelPrevious: invalid dialog implementation!" ); + + return pWizardImpl->travelPrevious(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL Wizard::enablePage( ::sal_Int16 i_PageID, ::sal_Bool i_Enable ) throw (NoSuchElementException, InvalidStateException, RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::enablePage: invalid dialog implementation!" ); + + if ( !pWizardImpl->knowsPage( i_PageID ) ) + throw NoSuchElementException( ::rtl::OUString(), *this ); + + if ( i_PageID == pWizardImpl->getCurrentPage() ) + throw InvalidStateException( ::rtl::OUString(), *this ); + + pWizardImpl->enablePage( i_PageID, i_Enable ); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL Wizard::updateTravelUI( ) throw (RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::updateTravelUI: invalid dialog implementation!" ); + + pWizardImpl->updateTravelUI(); + } + + //------------------------------------------------------------------------------------------------------------------ + ::sal_Bool SAL_CALL Wizard::advanceTo( ::sal_Int16 i_PageId ) throw (RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::advanceTo: invalid dialog implementation!" ); + + return pWizardImpl->advanceTo( i_PageId ); + } + + //------------------------------------------------------------------------------------------------------------------ + ::sal_Bool SAL_CALL Wizard::goBackTo( ::sal_Int16 i_PageId ) throw (RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::goBackTo: invalid dialog implementation!" ); + + return pWizardImpl->goBackTo( i_PageId ); + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XWizardPage > SAL_CALL Wizard::getCurrentPage( ) throw (RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::getCurrentPage: invalid dialog implementation!" ); + + return pWizardImpl->getCurrentWizardPage(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL Wizard::activatePath( ::sal_Int16 i_PathIndex, ::sal_Bool i_Final ) throw (NoSuchElementException, InvalidStateException, RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( ( i_PathIndex < 0 ) || ( i_PathIndex >= m_aWizardSteps.getLength() ) ) + throw NoSuchElementException( ::rtl::OUString(), *this ); + + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::activatePath: invalid dialog implementation!" ); + + pWizardImpl->activatePath( i_PathIndex, i_Final ); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL Wizard::setTitle( const ::rtl::OUString& i_Title ) throw (RuntimeException) + { + // simply disambiguate + Wizard_Base::OGenericUnoDialog::setTitle( i_Title ); + } + + //------------------------------------------------------------------------------------------------------------------ + ::sal_Int16 SAL_CALL Wizard::execute( ) throw (RuntimeException) + { + return Wizard_Base::OGenericUnoDialog::execute(); + } + +//...................................................................................................................... +} } // namespace svt::uno +//...................................................................................................................... diff --git a/svtools/source/uno/wizard/wizardpagecontroller.cxx b/svtools/source/uno/wizard/wizardpagecontroller.cxx new file mode 100644 index 000000000000..d6f7029b477c --- /dev/null +++ b/svtools/source/uno/wizard/wizardpagecontroller.cxx @@ -0,0 +1,190 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_svtools.hxx" + +#include "wizardpagecontroller.hxx" +#include "wizardshell.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/awt/XControl.hpp> +/** === end UNO includes === **/ + +#include <toolkit/helper/vclunohelper.hxx> +#include <tools/diagnose_ex.h> + +//...................................................................................................................... +namespace svt { namespace uno +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::ui::dialogs::XWizardController; + using ::com::sun::star::awt::XWindow; + using ::com::sun::star::lang::XComponent; + using ::com::sun::star::awt::XControl; + /** === end UNO using === **/ + using namespace ::com::sun::star; + + //================================================================================================================== + //= WizardPageController + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + WizardPageController::WizardPageController( WizardShell& i_rParent, const Reference< XWizardController >& i_rController, + const sal_Int16 i_nPageId ) + :m_xController( i_rController ) + ,m_xWizardPage() + ,m_nPageId( i_nPageId ) + { + ENSURE_OR_THROW( m_xController.is(), "no controller" ); + try + { + m_xWizardPage.set( m_xController->createPage( + Reference< XWindow >( i_rParent.GetComponentInterface( TRUE ), UNO_QUERY_THROW ), + m_nPageId + ), UNO_SET_THROW ); + + Reference< XWindow > xPageWindow( m_xWizardPage->getWindow(), UNO_SET_THROW ); + xPageWindow->setVisible( sal_True ); + + TabPage* pTabPage( getTabPage() ); + if ( pTabPage ) + pTabPage->SetStyle( pTabPage->GetStyle() | WB_CHILDDLGCTRL | WB_DIALOGCONTROL ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //------------------------------------------------------------------------------------------------------------------ + WizardPageController::~WizardPageController() + { + try + { + if ( m_xWizardPage.is() ) + m_xWizardPage->dispose(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //------------------------------------------------------------------------------------------------------------------ + TabPage* WizardPageController::getTabPage() const + { + ENSURE_OR_RETURN( m_xWizardPage.is(), "WizardPageController::getTabPage: no external wizard page!", NULL ); + try + { + Reference< XWindow > xPageWindow( m_xWizardPage->getWindow(), UNO_SET_THROW ); + Window* pPageWindow = VCLUnoHelper::GetWindow( xPageWindow ); + if ( pPageWindow == NULL ) + { + // windows created via the XContainerWindowProvider might be controls, not real windows, so resolve + // that one indirection + const Reference< XControl > xPageControl( m_xWizardPage->getWindow(), UNO_QUERY_THROW ); + xPageWindow.set( xPageControl->getPeer(), UNO_QUERY_THROW ); + pPageWindow = VCLUnoHelper::GetWindow( xPageWindow ); + } + + OSL_ENSURE( pPageWindow != NULL, "WizardPageController::getTabPage: unable to find the Window implementation for the page's window!" ); + return dynamic_cast< TabPage* >( pPageWindow ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return NULL; + } + + //------------------------------------------------------------------------------------------------------------------ + void WizardPageController::initializePage() + { + if ( !m_xWizardPage.is() ) + return; + + try + { + m_xWizardPage->activatePage(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Bool WizardPageController::commitPage( WizardTypes::CommitPageReason i_eReason ) + { + if ( !m_xWizardPage.is() ) + return sal_True; + + try + { + return m_xWizardPage->commitPage( WizardShell::convertCommitReasonToTravelType( i_eReason ) ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return sal_True; + } + + //------------------------------------------------------------------------------------------------------------------ + bool WizardPageController::canAdvance() const + { + if ( !m_xWizardPage.is() ) + return true; + + try + { + return m_xWizardPage->canAdvance(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return true; + } + +//...................................................................................................................... +} } // namespace svt::uno +//...................................................................................................................... diff --git a/svtools/source/uno/wizard/wizardpagecontroller.hxx b/svtools/source/uno/wizard/wizardpagecontroller.hxx new file mode 100644 index 000000000000..9de04d2f0dd4 --- /dev/null +++ b/svtools/source/uno/wizard/wizardpagecontroller.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVT_UNOWIZ_WIZARDPAGECONTROLLER_HXX +#define SVT_UNOWIZ_WIZARDPAGECONTROLLER_HXX + +#include "svtools/wizardmachine.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/ui/dialogs/XWizardController.hpp> +/** === end UNO includes === **/ + +//...................................................................................................................... +namespace svt { namespace uno +{ +//...................................................................................................................... + + class WizardShell; + + //================================================================================================================== + //= WizardPageController + //================================================================================================================== + class WizardPageController : public IWizardPageController + { + public: + WizardPageController( + WizardShell& i_rParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController >& i_rController, + const sal_Int16 i_nPageId + ); + ~WizardPageController(); + + // IWizardPageController overridables + virtual void initializePage(); + virtual sal_Bool commitPage( WizardTypes::CommitPageReason _eReason ); + virtual bool canAdvance() const; + + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage >& + getWizardPage() const { return m_xWizardPage; } + TabPage* getTabPage() const; + + private: + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController > m_xController; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage > m_xWizardPage; + const sal_Int16 m_nPageId; + }; + +//...................................................................................................................... +} } // namespace svt::uno +//...................................................................................................................... + +#endif // SVT_UNOWIZ_WIZARDPAGECONTROLLER_HXX diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx new file mode 100644 index 000000000000..7737b214ac1f --- /dev/null +++ b/svtools/source/uno/wizard/wizardshell.cxx @@ -0,0 +1,279 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_svtools.hxx" + +#include "wizardshell.hxx" +#include "wizardpagecontroller.hxx" + +#include <tools/diagnose_ex.h> + +/** === begin UNO includes === **/ +#include <com/sun/star/ui/dialogs/WizardTravelType.hpp> +/** === end UNO includes === **/ + +#include <vcl/msgbox.hxx> + +//...................................................................................................................... +namespace svt { namespace uno +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::ui::dialogs::XWizardController; + using ::com::sun::star::ui::dialogs::XWizard; + using ::com::sun::star::ui::dialogs::XWizardPage; + /** === end UNO using === **/ + namespace WizardTravelType = ::com::sun::star::ui::dialogs::WizardTravelType; + + //================================================================================================================== + namespace + { + //-------------------------------------------------------------------------------------------------------------- + sal_Int16 lcl_determineFirstPageID( const Sequence< Sequence< sal_Int16 > >& i_rPaths ) + { + ENSURE_OR_THROW( ( i_rPaths.getLength() > 0 ) && ( i_rPaths[0].getLength() > 0 ), "illegal paths" ); + return i_rPaths[0][0]; + } + } + + //================================================================================================================== + //= WizardShell + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + WizardShell::WizardShell( Window* i_pParent, const Reference< XWizard >& i_rWizard, const Reference< XWizardController >& i_rController, + const Sequence< Sequence< sal_Int16 > >& i_rPaths ) + :WizardShell_Base( i_pParent, WB_MOVEABLE | WB_CLOSEABLE ) + ,m_xWizard( i_rWizard ) + ,m_xController( i_rController ) + ,m_nFirstPageID( lcl_determineFirstPageID( i_rPaths ) ) + { + ENSURE_OR_THROW( m_xWizard.is() && m_xController.is(), "invalid wizard/controller" ); + + // declare the paths + for ( sal_Int32 i=0; i<i_rPaths.getLength(); ++i ) + { + const Sequence< sal_Int16 >& rPath( i_rPaths[i] ); + WizardPath aPath( rPath.getLength() ); + for ( sal_Int32 j=0; j<rPath.getLength(); ++j ) + aPath[j] = impl_pageIdToState( rPath[j] ); + declarePath( i, aPath ); + } + + // create the first page, to know the page size + TabPage* pStartPage = GetOrCreatePage( impl_pageIdToState( i_rPaths[0][0] ) ); + SetPageSizePixel( pStartPage->GetSizePixel() ); + + // some defaults + ShowButtonFixedLine( true ); + SetRoadmapInteractive( true ); + enableAutomaticNextButtonState(); + } + + //------------------------------------------------------------------------------------------------------------------ + WizardShell::~WizardShell() + { + } + + //------------------------------------------------------------------------------------------------------------------ + short WizardShell::Execute() + { + ActivatePage(); + return WizardShell_Base::Execute(); + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Int16 WizardShell::convertCommitReasonToTravelType( const CommitPageReason i_eReason ) + { + switch ( i_eReason ) + { + case WizardTypes::eTravelForward: + return WizardTravelType::FORWARD; + + case WizardTypes::eTravelBackward: + return WizardTravelType::BACKWARD; + + case WizardTypes::eFinish: + return WizardTravelType::FINISH; + + default: + break; + } + OSL_ENSURE( false, "WizardShell::convertCommitReasonToTravelType: unsupported CommitPageReason!" ); + return WizardTravelType::FINISH; + } + + //------------------------------------------------------------------------------------------------------------------ + void WizardShell::enterState( WizardState i_nState ) + { + WizardShell_Base::enterState( i_nState ); + + if ( !m_xController.is() ) + return; + + try + { + m_xController->onActivatePage( impl_stateToPageId( i_nState ) ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Bool WizardShell::leaveState( WizardState i_nState ) + { + if ( !WizardShell_Base::leaveState( i_nState ) ) + return sal_False; + + if ( !m_xController.is() ) + return sal_True; + + try + { + m_xController->onDeactivatePage( impl_stateToPageId( i_nState ) ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return sal_True; + } + + //------------------------------------------------------------------------------------------------------------------ + PWizardPageController WizardShell::impl_getController( TabPage* i_pPage ) const + { + Page2ControllerMap::const_iterator pos = m_aPageControllers.find( i_pPage ); + ENSURE_OR_RETURN( pos != m_aPageControllers.end(), "WizardShell::impl_getController: no controller for this page!", PWizardPageController() ); + return pos->second; + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XWizardPage > WizardShell::getCurrentWizardPage() const + { + const WizardState eState = getCurrentState(); + + PWizardPageController pController( impl_getController( GetPage( eState ) ) ); + ENSURE_OR_RETURN( pController, "WizardShell::getCurrentWizardPage: invalid page/controller!", NULL ); + + return pController->getWizardPage(); + } + + //------------------------------------------------------------------------------------------------------------------ + void WizardShell::enablePage( const sal_Int16 i_nPageID, const sal_Bool i_bEnable ) + { + enableState( impl_pageIdToState( i_nPageID ), i_bEnable ); + } + + //------------------------------------------------------------------------------------------------------------------ + TabPage* WizardShell::createPage( WizardState i_nState ) + { + ENSURE_OR_RETURN( m_xController.is(), "WizardShell::createPage: no WizardController!", NULL ); + + ::boost::shared_ptr< WizardPageController > pController( new WizardPageController( *this, m_xController, impl_stateToPageId( i_nState ) ) ); + TabPage* pPage = pController->getTabPage(); + OSL_ENSURE( pPage != NULL, "WizardShell::createPage: illegal tab page!" ); + if ( pPage == NULL ) + { + // fallback for ill-behaved clients: empty page + pPage = new TabPage( this, 0 ); + pPage->SetSizePixel( LogicToPixel( Size( 280, 185 ), MAP_APPFONT ) ); + } + + m_aPageControllers[ pPage ] = pController; + return pPage; + } + + //------------------------------------------------------------------------------------------------------------------ + IWizardPageController* WizardShell::getPageController( TabPage* i_pCurrentPage ) const + { + return impl_getController( i_pCurrentPage ).get(); + } + + //------------------------------------------------------------------------------------------------------------------ + String WizardShell::getStateDisplayName( WizardState i_nState ) const + { + try + { + if ( m_xController.is() ) + return m_xController->getPageTitle( impl_stateToPageId( i_nState ) ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + // fallback for ill-behaved clients: the numeric state + return String::CreateFromInt32( i_nState ); + } + + //------------------------------------------------------------------------------------------------------------------ + bool WizardShell::canAdvance() const + { + try + { + if ( m_xController.is() && !m_xController->canAdvance() ) + return false; + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return WizardShell_Base::canAdvance(); + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Bool WizardShell::onFinish() + { + try + { + if ( m_xController.is() && !m_xController->confirmFinish() ) + return sal_False; + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return WizardShell_Base::onFinish(); + } + +//...................................................................................................................... +} } // namespace svt::uno +//...................................................................................................................... diff --git a/svtools/source/uno/wizard/wizardshell.hxx b/svtools/source/uno/wizard/wizardshell.hxx new file mode 100644 index 000000000000..338b4f38dc4a --- /dev/null +++ b/svtools/source/uno/wizard/wizardshell.hxx @@ -0,0 +1,147 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVT_UNO_WIZARD_SHELL +#define SVT_UNO_WIZARD_SHELL + +/** === begin UNO includes === **/ +#include <com/sun/star/ui/dialogs/XWizardController.hpp> +#include <com/sun/star/ui/dialogs/XWizard.hpp> +/** === end UNO includes === **/ + +#include <svtools/roadmapwizard.hxx> + +#include <boost/shared_ptr.hpp> +#include <map> + +//...................................................................................................................... +namespace svt { namespace uno +{ +//...................................................................................................................... + + class WizardPageController; + typedef ::boost::shared_ptr< WizardPageController > PWizardPageController; + + //================================================================================================================== + //= WizardShell + //================================================================================================================== + typedef ::svt::RoadmapWizard WizardShell_Base; + class WizardShell : public WizardShell_Base + { + public: + WizardShell( + Window* _pParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizard >& i_rWizard, + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController >& i_rController, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int16 > >& i_rPaths + ); + virtual ~WizardShell(); + + // Dialog overridables + virtual short Execute(); + + // OWizardMachine overridables + virtual TabPage* createPage( WizardState i_nState ); + virtual void enterState( WizardState i_nState ); + virtual sal_Bool leaveState( WizardState i_nState ); + virtual String getStateDisplayName( WizardState i_nState ) const; + virtual bool canAdvance() const; + virtual sal_Bool onFinish(); + virtual IWizardPageController* + getPageController( TabPage* _pCurrentPage ) const; + + // attribute access + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizard >& + getWizard() const { return m_xWizard; } + + static sal_Int16 convertCommitReasonToTravelType( const CommitPageReason i_eReason ); + + // operations + sal_Bool advanceTo( const sal_Int16 i_nPageId ) + { + return skipUntil( impl_pageIdToState( i_nPageId ) ); + } + sal_Bool goBackTo( const sal_Int16 i_nPageId ) + { + return skipBackwardUntil( impl_pageIdToState( i_nPageId ) ); + } + sal_Bool travelNext() { return WizardShell_Base::travelNext(); } + sal_Bool travelPrevious() { return WizardShell_Base::travelPrevious(); } + + void activatePath( const sal_Int16 i_nPathID, const sal_Bool i_bFinal ) + { + WizardShell_Base::activatePath( PathId( i_nPathID ), i_bFinal ); + } + + ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage > + getCurrentWizardPage() const; + + sal_Int16 getCurrentPage() const + { + return impl_stateToPageId( getCurrentState() ); + } + + void enablePage( const sal_Int16 i_PageID, const sal_Bool i_Enable ); + + bool knowsPage( const sal_Int16 i_nPageID ) const + { + return knowsState( impl_pageIdToState( i_nPageID ) ); + } + + private: + sal_Int16 impl_stateToPageId( const WizardTypes::WizardState i_nState ) const + { + return static_cast< sal_Int16 >( i_nState + m_nFirstPageID ); + } + + WizardState impl_pageIdToState( const sal_Int16 i_nPageId ) const + { + return static_cast< WizardState >( i_nPageId - m_nFirstPageID ); + } + + PWizardPageController impl_getController( TabPage* i_pPage ) const; + + // prevent outside access to some base class members + using WizardShell_Base::skip; + using WizardShell_Base::skipUntil; + using WizardShell_Base::skipBackwardUntil; + using WizardShell_Base::getCurrentState; + using WizardShell_Base::activatePath; + + private: + typedef ::std::map< TabPage*, PWizardPageController > Page2ControllerMap; + + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizard > m_xWizard; + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController > m_xController; + const sal_Int16 m_nFirstPageID; + Page2ControllerMap m_aPageControllers; + }; + +//...................................................................................................................... +} } // namespace svt::uno +//...................................................................................................................... + +#endif // SVT_UNO_WIZARD_SHELL diff --git a/svtools/util/makefile.mk b/svtools/util/makefile.mk index 0040b1d1ee65..f9c14a540410 100644 --- a/svtools/util/makefile.mk +++ b/svtools/util/makefile.mk @@ -71,6 +71,7 @@ LIB1FILES= \ $(SLB)/svrtf.lib \ $(SLB)/table.lib \ $(SLB)/unoiface.lib \ + $(SLB)/unowiz.lib \ $(SLB)/urlobj.lib \ $(SLB)/toolpanel.lib diff --git a/svtools/workben/unodialog/roadmapskeleton.cxx b/svtools/workben/unodialog/roadmapskeleton.cxx index f261f219c3fd..e3ed06707f14 100644 --- a/svtools/workben/unodialog/roadmapskeleton.cxx +++ b/svtools/workben/unodialog/roadmapskeleton.cxx @@ -103,9 +103,9 @@ namespace udlg } //-------------------------------------------------------------------- - sal_Bool RoadmapSkeletonDialog::onFinish( sal_Int32 _nResult ) + sal_Bool RoadmapSkeletonDialog::onFinish() { - return RoadmapSkeletonDialog_Base::onFinish( _nResult ); + return RoadmapSkeletonDialog_Base::onFinish(); } //........................................................................ diff --git a/svtools/workben/unodialog/roadmapskeleton.hxx b/svtools/workben/unodialog/roadmapskeleton.hxx index 216c940b842a..8859390c4b58 100644 --- a/svtools/workben/unodialog/roadmapskeleton.hxx +++ b/svtools/workben/unodialog/roadmapskeleton.hxx @@ -52,7 +52,7 @@ namespace udlg virtual sal_Bool prepareLeaveCurrentState( CommitPageReason _eReason ); virtual sal_Bool leaveState( WizardState _nState ); virtual WizardState determineNextState( WizardState _nCurrentState ) const; - virtual sal_Bool onFinish( sal_Int32 _nResult ); + virtual sal_Bool onFinish(); private: ::comphelper::ComponentContext m_aContext; |