From 6aad92c994f65f44927b7186645c6c77b6b81ff9 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Thu, 17 Sep 2009 07:41:59 +0000 Subject: #i1601# Sentence case, Title case, and Toggle case transliteration added --- svx/inc/globlmn_tmpl.hrc | 29 ++++++++++++++++--- svx/inc/svx/svxids.hrc | 6 +++- svx/sdi/svx.sdi | 75 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+), 5 deletions(-) (limited to 'svx') diff --git a/svx/inc/globlmn_tmpl.hrc b/svx/inc/globlmn_tmpl.hrc index d40ca4de1876..45488894b37a 100644 --- a/svx/inc/globlmn_tmpl.hrc +++ b/svx/inc/globlmn_tmpl.hrc @@ -1341,10 +1341,10 @@ {\ MenuItem\ {\ - Identifier = SID_TRANSLITERATE_UPPER ; \ - Command = ".uno:ChangeCaseToUpper" ; \ - HelpID = SID_TRANSLITERATE_UPPER ; \ - Text [ en-US ] = "~Uppercase";\ + Identifier = SID_TRANSLITERATE_SENTENCE_CASE; \ + Command = ".uno:ChangeCaseToSentenceCase" ; \ + HelpID = SID_TRANSLITERATE_SENTENCE_CASE; \ + Text [ en-US ] = "~Sentence case";\ };\ MenuItem\ {\ @@ -1354,6 +1354,27 @@ Text [ en-US ] = "~Lowercase";\ };\ MenuItem\ + {\ + Identifier = SID_TRANSLITERATE_UPPER ; \ + Command = ".uno:ChangeCaseToUpper" ; \ + HelpID = SID_TRANSLITERATE_UPPER ; \ + Text [ en-US ] = "~Uppercase";\ + };\ + MenuItem\ + {\ + Identifier = SID_TRANSLITERATE_TITLE_CASE; \ + Command = ".uno:ChangeCaseToTitleCase" ; \ + HelpID = SID_TRANSLITERATE_TITLE_CASE; \ + Text [ en-US ] = "~Title case (aka. First letter capitalization)";\ + };\ + MenuItem\ + {\ + Identifier = SID_TRANSLITERATE_TOGGLE_CASE; \ + Command = ".uno:ChangeCaseToToggleCase" ; \ + HelpID = SID_TRANSLITERATE_TOGGLE_CASE; \ + Text [ en-US ] = "T~oggle case";\ + };\ + MenuItem\ {\ Identifier = SID_TRANSLITERATE_HALFWIDTH; \ Command = ".uno:ChangeCaseToHalfWidth" ; \ diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc index d7c018bedaac..6ed62ada704d 100644 --- a/svx/inc/svx/svxids.hrc +++ b/svx/inc/svx/svxids.hrc @@ -1347,9 +1347,13 @@ #define SID_CHAR_DLG_PREVIEW_STRING (SID_SVX_START+1090) #define SID_RECHECK_DOCUMENT (SID_SVX_START+1091) #define SID_ATTR_PARA_OUTLINE_LEVEL (SID_SVX_START+1092) +#define SID_TRANSLITERATE_SENTENCE_CASE (SID_SVX_START+1093) +#define SID_TRANSLITERATE_TITLE_CASE (SID_SVX_START+1094) +#define SID_TRANSLITERATE_TOGGLE_CASE (SID_SVX_START+1095) + // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id -#define SID_SVX_FIRSTFREE SID_ATTR_PARA_OUTLINE_LEVEL + 1 +#define SID_SVX_FIRSTFREE SID_TRANSLITERATE_TOGGLE_CASE + 1 // -------------------------------------------------------------------------- // Overflow check for slot IDs diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index a69aae4cf9fd..1a3b39b26eff 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -1457,6 +1457,81 @@ SfxVoidItem ChangeCaseToKatakana SID_TRANSLITERATE_KATAGANA GroupId = GID_FORMAT; ] +//-------------------------------------------------------------------------- +SfxVoidItem ChangeCaseToSentenceCase SID_TRANSLITERATE_SENTENCE_CASE +() +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = TRUE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- +SfxVoidItem ChangeCaseToTitleCase SID_TRANSLITERATE_TITLE_CASE +() +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = TRUE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + +//-------------------------------------------------------------------------- +SfxVoidItem ChangeCaseToToggleCase SID_TRANSLITERATE_TOGGLE_CASE +() +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = TRUE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] + //-------------------------------------------------------------------------- SfxVoidItem ChangeCaseToLower SID_TRANSLITERATE_LOWER () -- cgit From d86ed27c5d8b22f5c0fe2094061ecc9bec07f2af Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Wed, 23 Sep 2009 12:32:20 +0000 Subject: #i1601# transliteration for sentence case, title case and toggle case --- svx/inc/globlmn_tmpl.hrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'svx') diff --git a/svx/inc/globlmn_tmpl.hrc b/svx/inc/globlmn_tmpl.hrc index 45488894b37a..8f5e3f390a1b 100644 --- a/svx/inc/globlmn_tmpl.hrc +++ b/svx/inc/globlmn_tmpl.hrc @@ -1365,7 +1365,7 @@ Identifier = SID_TRANSLITERATE_TITLE_CASE; \ Command = ".uno:ChangeCaseToTitleCase" ; \ HelpID = SID_TRANSLITERATE_TITLE_CASE; \ - Text [ en-US ] = "~Title case (aka. First letter capitalization)";\ + Text [ en-US ] = "~Title case";\ };\ MenuItem\ {\ -- cgit From e640bf3c6d47ead0b1249c87ed828d0730533c94 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Thu, 1 Oct 2009 10:58:02 +0000 Subject: #i1601# new strings for menu entries --- svx/inc/globlmn_tmpl.hrc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'svx') diff --git a/svx/inc/globlmn_tmpl.hrc b/svx/inc/globlmn_tmpl.hrc index 8f5e3f390a1b..c3dae141a766 100644 --- a/svx/inc/globlmn_tmpl.hrc +++ b/svx/inc/globlmn_tmpl.hrc @@ -1351,28 +1351,28 @@ Identifier = SID_TRANSLITERATE_LOWER; \ Command = ".uno:ChangeCaseToLower" ; \ HelpID = SID_TRANSLITERATE_LOWER; \ - Text [ en-US ] = "~Lowercase";\ + Text [ en-US ] = "~lowercase";\ };\ MenuItem\ {\ Identifier = SID_TRANSLITERATE_UPPER ; \ Command = ".uno:ChangeCaseToUpper" ; \ HelpID = SID_TRANSLITERATE_UPPER ; \ - Text [ en-US ] = "~Uppercase";\ + Text [ en-US ] = "~UPPERCASE";\ };\ MenuItem\ {\ Identifier = SID_TRANSLITERATE_TITLE_CASE; \ Command = ".uno:ChangeCaseToTitleCase" ; \ HelpID = SID_TRANSLITERATE_TITLE_CASE; \ - Text [ en-US ] = "~Title case";\ + Text [ en-US ] = "~Capitalize Every Word";\ };\ MenuItem\ {\ Identifier = SID_TRANSLITERATE_TOGGLE_CASE; \ Command = ".uno:ChangeCaseToToggleCase" ; \ HelpID = SID_TRANSLITERATE_TOGGLE_CASE; \ - Text [ en-US ] = "T~oggle case";\ + Text [ en-US ] = "~tOGGLE cASE";\ };\ MenuItem\ {\ -- cgit From 607673f3238bfc80ad90c74e2fd85038eece7892 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 19 Oct 2009 08:35:55 +0000 Subject: #106019# 'reset languages' menu entry --- svx/inc/svx/svxids.hrc | 1 + 1 file changed, 1 insertion(+) (limited to 'svx') diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc index 900250a4ed8b..dfe174b4e26e 100644 --- a/svx/inc/svx/svxids.hrc +++ b/svx/inc/svx/svxids.hrc @@ -398,6 +398,7 @@ #define FN_INSERT_HARD_SPACE (FN_INSERT + 44) /* hard space */ #define FN_INSERT_HARDHYPHEN (FN_INSERT + 85) /* hyphen withou break*/ +//!! be aware to not overwrite something that is used in sw/inc/cmdid.h already !! #define FN_FORMAT (SID_SW_START + 400) #define FN_SET_JUSTIFY_PARA (FN_FORMAT + 21) #define FN_FORMAT_RESET (FN_FORMAT + 69) -- cgit From 302b0d4b30348d95c18684b1254693f191d8001b Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Wed, 25 Nov 2009 16:50:10 +0000 Subject: #i51258# thesaurus for right click context menu --- svx/inc/svx/editview.hxx | 4 ++- svx/inc/svx/outliner.hxx | 6 ++++ svx/sdi/svx.sdi | 4 +-- svx/source/editeng/editview.cxx | 4 +-- svx/source/outliner/outlvw.cxx | 61 ++++++++++++++++++++++++++++++++++++++++- 5 files changed, 73 insertions(+), 6 deletions(-) (limited to 'svx') diff --git a/svx/inc/svx/editview.hxx b/svx/inc/svx/editview.hxx index 79deaab4dc36..f13d90b9211d 100644 --- a/svx/inc/svx/editview.hxx +++ b/svx/inc/svx/editview.hxx @@ -31,6 +31,8 @@ #ifndef _MyEDITVIEW_HXX #define _MyEDITVIEW_HXX +#include + #include #include #include @@ -114,7 +116,7 @@ public: BOOL HasSelection() const; ESelection GetSelection() const; void SetSelection( const ESelection& rNewSel ); - BOOL SelectCurrentWord(); + BOOL SelectCurrentWord( sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ); void IndentBlock(); void UnindentBlock(); diff --git a/svx/inc/svx/outliner.hxx b/svx/inc/svx/outliner.hxx index 37e3d8ac71ee..9aafe5ff853e 100644 --- a/svx/inc/svx/outliner.hxx +++ b/svx/inc/svx/outliner.hxx @@ -392,6 +392,12 @@ public: Selection GetSurroundingTextSelection() const; }; + +// some thesaurus functionality to avoid code duplication in different projects... +bool SVX_DLLPUBLIC GetStatusValueForThesaurusFromContext( String &rStatusVal, LanguageType &rLang, const EditView &rEditView ); +void SVX_DLLPUBLIC ReplaceTextWithSynonym( EditView &rEditView, const String &rSynonmText ); + + //#if 0 // _SOLAR__PRIVATE DECLARE_LIST(ViewList,OutlinerView*) //#else diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index b414195457bc..c8f38bf98b55 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -10937,7 +10937,7 @@ SdrTextFitToSizeTypeItem TextFitToSize SID_ATTR_TEXT_FITTOSIZE ] //-------------------------------------------------------------------------- -SfxVoidItem Thesaurus SID_THESAURUS +SfxVoidItem ThesaurusDialog SID_THESAURUS () [ /* flags: */ @@ -10946,7 +10946,7 @@ SfxVoidItem Thesaurus SID_THESAURUS FastCall = FALSE, HasCoreId = FALSE, HasDialog = TRUE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, diff --git a/svx/source/editeng/editview.cxx b/svx/source/editeng/editview.cxx index 6776f57ea2b6..9ebb01daa3b7 100644 --- a/svx/source/editeng/editview.cxx +++ b/svx/source/editeng/editview.cxx @@ -1260,13 +1260,13 @@ void EditView::SpellIgnoreWord() pImpEditView->SpellIgnoreOrAddWord( sal_False ); } -sal_Bool EditView::SelectCurrentWord() +sal_Bool EditView::SelectCurrentWord( sal_Int16 nWordType ) { DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); EditSelection aCurSel( pImpEditView->GetEditSelection() ); pImpEditView->DrawSelection(); - aCurSel = PIMPEE->SelectWord( aCurSel.Max() ); + aCurSel = PIMPEE->SelectWord( aCurSel.Max(), nWordType ); pImpEditView->SetEditSelection( aCurSel ); pImpEditView->DrawSelection(); ShowCursor( sal_True, sal_False ); diff --git a/svx/source/outliner/outlvw.cxx b/svx/source/outliner/outlvw.cxx index 098a4055ce0f..be45692993bf 100644 --- a/svx/source/outliner/outlvw.cxx +++ b/svx/source/outliner/outlvw.cxx @@ -31,7 +31,11 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" #include + +#include + #include +#include #define _OUTLINER_CXX #include @@ -56,6 +60,8 @@ #define OL_SCROLL_HOROFFSET 20 /* in % von VisibleSize.Width */ #define OL_SCROLL_VEROFFSET 20 /* in % von VisibleSize.Height */ +using namespace ::com::sun::star; + DBG_NAME(OutlinerView) @@ -1272,7 +1278,7 @@ void OutlinerView::RemoveAttribs( BOOL bRemoveParaAttribs, USHORT nWhich, BOOL b - // ===================================================================== +// ===================================================================== // ====================== Einfache Durchreicher ======================= // ====================================================================== @@ -1647,3 +1653,56 @@ Selection OutlinerView::GetSurroundingTextSelection() const DBG_CHKTHIS(OutlinerView,0); return pEditView->GetSurroundingTextSelection(); } + + +// ====================================================================== +// ===== some code for thesaurus sub menu within context menu +// ====================================================================== + +// returns: true if a word for thesaurus look-up was found at the current cursor position. +// The status string will be word + iso language string (e.g. "light#en-US") +bool SVX_DLLPUBLIC GetStatusValueForThesaurusFromContext( + String &rStatusVal, + LanguageType &rLang, + const EditView &rEditView ) +{ + // get text and locale for thesaurus look up + String aText; + EditEngine *pEditEngine = rEditView.GetEditEngine(); + ESelection aTextSel( rEditView.GetSelection() ); + if (!aTextSel.HasRange()) + aTextSel = pEditEngine->GetWord( aTextSel, i18n::WordType::DICTIONARY_WORD ); + aText = pEditEngine->GetText( aTextSel ); + aTextSel.Adjust(); + LanguageType nLang = pEditEngine->GetLanguage( aTextSel.nStartPara, aTextSel.nStartPos ); + String aLangText( MsLangId::convertLanguageToIsoString( nLang ) ); + + // set word and locale to look up as status value + String aStatusVal( aText ); + aStatusVal.AppendAscii( "#" ); + aStatusVal += aLangText; + + rStatusVal = aStatusVal; + rLang = nLang; + + return aText.Len() > 0; +} + + +void SVX_DLLPUBLIC ReplaceTextWithSynonym( EditView &rEditView, const String &rSynonmText ) +{ + // get selection to use + ESelection aCurSel( rEditView.GetSelection() ); + if (!rEditView.HasSelection()) + { + // select the same word that was used in GetStatusValueForThesaurusFromContext by calling GetWord. + // (In the end both functions will call ImpEditEngine::SelectWord) + rEditView.SelectCurrentWord( i18n::WordType::DICTIONARY_WORD ); + aCurSel = rEditView.GetSelection(); + } + + // replace word ... + rEditView.InsertText( rSynonmText ); + rEditView.ShowCursor( sal_True, sal_False ); +} + -- cgit From b544ded204950f587b561518bd41aa138798d5c7 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Wed, 2 Dec 2009 10:19:06 +0100 Subject: #i107213# added ViewOverlayManager --- svx/inc/svx/sdr/overlay/overlaybitmapex.hxx | 5 ++++- svx/source/sdr/overlay/overlaybitmapex.cxx | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'svx') diff --git a/svx/inc/svx/sdr/overlay/overlaybitmapex.hxx b/svx/inc/svx/sdr/overlay/overlaybitmapex.hxx index 96295d0f9f80..053f87452788 100644 --- a/svx/inc/svx/sdr/overlay/overlaybitmapex.hxx +++ b/svx/inc/svx/sdr/overlay/overlaybitmapex.hxx @@ -50,13 +50,16 @@ namespace sdr sal_uInt16 mnCenterX; sal_uInt16 mnCenterY; + // optional transparency + double mfAlpha; + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); public: OverlayBitmapEx( const basegfx::B2DPoint& rBasePos, const BitmapEx& rBitmapEx, - sal_uInt16 nCenX = 0, sal_uInt16 nCenY = 0); + sal_uInt16 nCenX = 0, sal_uInt16 nCenY = 0, double fAlpha = 0.0 ); virtual ~OverlayBitmapEx(); const BitmapEx& getBitmapEx() const { return maBitmapEx; } diff --git a/svx/source/sdr/overlay/overlaybitmapex.cxx b/svx/source/sdr/overlay/overlaybitmapex.cxx index cd50c9149b27..c5208710f0df 100644 --- a/svx/source/sdr/overlay/overlaybitmapex.cxx +++ b/svx/source/sdr/overlay/overlaybitmapex.cxx @@ -30,6 +30,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" +#include #include #include #include @@ -44,24 +45,32 @@ namespace sdr { drawinglayer::primitive2d::Primitive2DSequence OverlayBitmapEx::createOverlayObjectPrimitive2DSequence() { - const drawinglayer::primitive2d::Primitive2DReference aReference( + drawinglayer::primitive2d::Primitive2DReference aReference( new drawinglayer::primitive2d::OverlayBitmapExPrimitive( getBitmapEx(), getBasePosition(), getCenterX(), getCenterY())); + if(basegfx::fTools::more(mfAlpha, 0.0)) + { + const drawinglayer::primitive2d::Primitive2DSequence aNewTransPrimitiveVector(&aReference, 1L); + aReference = drawinglayer::primitive2d::Primitive2DReference( + new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(aNewTransPrimitiveVector, mfAlpha)); + } + return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1); } OverlayBitmapEx::OverlayBitmapEx( const basegfx::B2DPoint& rBasePos, const BitmapEx& rBitmapEx, - sal_uInt16 nCenX, sal_uInt16 nCenY) + sal_uInt16 nCenX, sal_uInt16 nCenY, double fAlpha) : OverlayObjectWithBasePosition(rBasePos, Color(COL_WHITE)), maBitmapEx(rBitmapEx), mnCenterX(nCenX), - mnCenterY(nCenY) + mnCenterY(nCenY), + mfAlpha(fAlpha) { } -- cgit From 3b25deb0ed6c36da87c18be1382c76216ec2d204 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Thu, 3 Dec 2009 18:53:41 +0100 Subject: renaissance01: #i107213# further layout work, initial support for new layout toolbox control --- svx/inc/svx/svdhdl.hxx | 13 +++ svx/inc/svx/svdmrkv.hxx | 1 + svx/inc/svx/toolbarmenu.hxx | 127 ++++++++++++++++++++++++++++++ svx/prj/d.lst | 1 + svx/source/svdraw/svdedxv.cxx | 2 +- svx/source/svdraw/svdhdl.cxx | 19 ++++- svx/source/svdraw/svdmrkv.cxx | 44 ++++++++++- svx/source/tbxctrls/extrusioncontrols.cxx | 4 +- svx/source/tbxctrls/fontworkgallery.cxx | 2 +- svx/source/tbxctrls/toolbarmenu.cxx | 48 ++++++++--- svx/source/tbxctrls/toolbarmenu.hxx | 90 --------------------- 11 files changed, 239 insertions(+), 112 deletions(-) create mode 100644 svx/inc/svx/toolbarmenu.hxx delete mode 100644 svx/source/tbxctrls/toolbarmenu.hxx (limited to 'svx') diff --git a/svx/inc/svx/svdhdl.hxx b/svx/inc/svx/svdhdl.hxx index 4960323feeb7..ea8f8e09f834 100644 --- a/svx/inc/svx/svdhdl.hxx +++ b/svx/inc/svx/svdhdl.hxx @@ -187,6 +187,9 @@ protected: // cleanup marker if one exists void GetRidOfIAObject(); +private: + bool mbMouseOver; // is true if the mouse is over this handle + protected: ::sdr::overlay::OverlayObject* CreateOverlayObject( const basegfx::B2DPoint& rPos, @@ -244,6 +247,16 @@ public: virtual BOOL IsFocusHdl() const; void SetMoveOutside( bool bMoveOutside ); + + /** is called when the mouse enters the area of this handle. If the handle changes his + visualisation during mouse over it must override this method and call Touch(). */ + virtual void onMouseEnter(); + + /** is called when the mouse leaves the area of this handle. If the handle changes his + visualisation during mouse over it must override this method and call Touch(). */ + virtual void onMouseLeave(); + + bool isMouseOver() const; }; //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/svx/inc/svx/svdmrkv.hxx b/svx/inc/svx/svdmrkv.hxx index 88d0b941273d..0d443346e664 100644 --- a/svx/inc/svx/svdmrkv.hxx +++ b/svx/inc/svx/svdmrkv.hxx @@ -172,6 +172,7 @@ protected: virtual void SetMarkRects(); // Rects an den PageViews virtual void CheckMarked(); // MarkList nach Del und Lock Layer durchsuchen... virtual void AddDragModeHdl(SdrDragMode eMode); + virtual BOOL MouseMove(const MouseEvent& rMEvt, Window* pWin); // add custom handles (used by other apps, e.g. AnchorPos) virtual void AddCustomHdl(); diff --git a/svx/inc/svx/toolbarmenu.hxx b/svx/inc/svx/toolbarmenu.hxx new file mode 100644 index 000000000000..fcd3bf814831 --- /dev/null +++ b/svx/inc/svx/toolbarmenu.hxx @@ -0,0 +1,127 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: colrctrl.hxx,v $ + * $Revision: 1.3.76.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVX_TOOLBARMENU_HXX_ +#define _SVX_TOOLBARMENU_HXX_ + +#include + +#include + +#include "svx/svxdllapi.h" + +class ToolbarMenuEntry; +typedef std::vector< ToolbarMenuEntry * > ToolbarMenuEntryVector; + +class SVX_DLLPUBLIC ToolbarMenu : public Control +{ +public: + ToolbarMenu( Window* pParent, WinBits nStyle ); + ~ToolbarMenu(); + + virtual void MouseMove( const MouseEvent& rMEvt ); + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void MouseButtonUp( const MouseEvent& rMEvt ); + virtual void KeyInput( const KeyEvent& rKEvent ); + virtual void Command( const CommandEvent& rCEvt ); + virtual void Paint( const Rectangle& rRect ); + virtual void RequestHelp( const HelpEvent& rHEvt ); + virtual void Resize(); + virtual void GetFocus(); + virtual void LoseFocus(); + + void appendEntry( int nEntryId, const String& rStr, MenuItemBits nItemBits = 0 ); + void appendEntry( int nEntryId, const Image& rImage, MenuItemBits nItemBits = 0 ); + void appendEntry( int nEntryId, const String& rStr, const Image& rImage, MenuItemBits nItemBits = 0 ); + void appendEntry( int nEntryId, Control* pControl, MenuItemBits nItemBits = 0 ); + void appendEntry( int nEntryId, const String& rStr, Control* pControl, MenuItemBits nItemBits = 0 ); + void appendSeparator(); + + void checkEntry( int nEntryId, bool bCheck = true ); + bool isEntryChecked( int nEntryId ) const; + + void enableEntry( int nEntryId, bool bEnable = true ); + bool isEntryEnabled( int nEntryId ) const; + + void setEntryText( int nEntryId, const String& rStr ); + const String& getEntryText( int nEntryId ) const; + + void setEntryImage( int nEntryId, const Image& rImage ); + const Image& getEntryImage( int nEntryId ) const; + + const Size& getMenuSize() const { return maSize; } + + void SetHighlightHdl( const Link& rLink ) { maHighlightHdl = rLink; } + const Link& GetHighlightHdl() const { return maHighlightHdl; } + + void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; } + const Link& GetSelectHdl() const { return maSelectHdl; } + + int getSelectedEntryId() const; + int getHighlightedEntryId() const; + +private: + ToolbarMenuEntryVector maEntryVector; + + int mnCheckPos; + int mnImagePos; + int mnTextPos; + + int mnHighlightedEntry; + int mnSelectedEntry; + + Size maSize; + + Link maHighlightHdl; + Link maSelectHdl; + + void StateChanged( StateChangedType nType ); + void DataChanged( const DataChangedEvent& rDCEvt ); + + void initWindow(); + + Size implCalcSize(); + + void appendEntry( ToolbarMenuEntry* pEntry ); + + void implPaint( ToolbarMenuEntry* pThisOnly = NULL, bool bHighlight = false ); + + void implHighlightEntry( int nHighlightEntry, bool bHighlight ); + void implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown ); + + void implChangeHighlightEntry( int nEntry ); + void implSelectEntry( int nSelectedEntry ); + + ToolbarMenuEntry* implCursorUpDown( bool bUp, bool bHomeEnd ); + ToolbarMenuEntry* implGetEntry( int nEntry ) const; + ToolbarMenuEntry* implSearchEntry( int nEntryId ) const; +}; + +#endif diff --git a/svx/prj/d.lst b/svx/prj/d.lst index 7edc2fbc9c11..23ed549ceee4 100644 --- a/svx/prj/d.lst +++ b/svx/prj/d.lst @@ -658,5 +658,6 @@ mkdir: %_DEST%\inc%_EXT%\svx\sdr\table ..\inc\svx\selectioncontroller.hxx %_DEST%\inc%_EXT%\svx\selectioncontroller.hxx ..\inc\svx\helperhittest3d.hxx %_DEST%\inc%_EXT%\svx\helperhittest3d.hxx ..\inc\svx\optimprove.hxx %_DEST%\inc%_EXT%\svx\optimprove.hxx +..\inc\svx\toolbarmenu.hxx %_DEST%\inc%_EXT%\svx\toolbarmenu.hxx ..\%__SRC%\bin\*-layout.zip %_DEST%\pck%_EXT%\*.* diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 901bc0e7e5b6..8b6591974742 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -1163,7 +1163,7 @@ BOOL SdrObjEditView::KeyInput(const KeyEvent& rKEvt, Window* pWin) #endif if (pTextEditOutlinerView->PostKeyEvent(rKEvt)) { - if( pMod && !pMod->IsChanged() ) + if( pMod /* && !pMod->IsChanged() */ ) { if( pTextEditOutliner && pTextEditOutliner->IsModified() ) pMod->SetChanged( sal_True ); diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index d3202e389f83..884057321899 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -309,7 +309,8 @@ SdrHdl::SdrHdl(): bSelect(FALSE), b1PixMore(FALSE), bPlusHdl(FALSE), - mbMoveOutside(false) + mbMoveOutside(false), + mbMouseOver(false) { } @@ -327,7 +328,8 @@ SdrHdl::SdrHdl(const Point& rPnt, SdrHdlKind eNewKind): bSelect(FALSE), b1PixMore(FALSE), bPlusHdl(FALSE), - mbMoveOutside(false) + mbMoveOutside(false), + mbMouseOver(false) { } @@ -949,6 +951,19 @@ BOOL SdrHdl::IsFocusHdl() const } } +void SdrHdl::onMouseEnter() +{ +} + +void SdrHdl::onMouseLeave() +{ +} + +bool SdrHdl::isMouseOver() const +{ + return mbMouseOver; +} + //////////////////////////////////////////////////////////////////////////////////////////////////// // class SdrHdlColor diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index f80b14503914..feb6c91765e3 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -209,9 +209,9 @@ void __EXPORT SdrMarkView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) bMarkedPointsRectsDirty=TRUE; } /* removed for now since this breaks existing code who iterates over the mark list and sequentially replaces objects - if( eKind==HINT_OBJREMOVED && IsObjMarked( const_cast(pSdrHint->GetObject()) ) ) - { - MarkObj( const_cast(pSdrHint->GetObject()), GetSdrPageView(), TRUE ); + if( eKind==HINT_OBJREMOVED && IsObjMarked( const_cast(pSdrHint->GetObject()) ) ) + { + MarkObj( const_cast(pSdrHint->GetObject()), GetSdrPageView(), TRUE ); } */ } @@ -1063,6 +1063,44 @@ void SdrMarkView::AddDragModeHdl(SdrDragMode eMode) } } +/** handle mouse over effects for handles */ +BOOL SdrMarkView::MouseMove(const MouseEvent& rMEvt, Window* pWin) +{ + const ULONG nHdlCount = aHdl.GetHdlCount(); + if( nHdlCount ) + { + SdrHdl* pMouseOverHdl = 0; + if( !rMEvt.IsLeaveWindow() && pWin ) + { + Point aMDPos( pWin->PixelToLogic( rMEvt.GetPosPixel() ) ); + pMouseOverHdl = PickHandle(aMDPos); + } + + // notify last mouse over handle that he lost the mouse + for(ULONG nHdl = 0; nHdl < nHdlCount; nHdl++ ) + { + SdrHdl* pCurrentHdl = GetHdl(nHdl); + if( pCurrentHdl->mbMouseOver ) + { + if( pCurrentHdl != pMouseOverHdl ) + { + pCurrentHdl->mbMouseOver = false; + pCurrentHdl->onMouseLeave(); + } + break; + } + } + + // notify current mouse over handle + if( pMouseOverHdl && !pMouseOverHdl->mbMouseOver ) + { + pMouseOverHdl->mbMouseOver = true; + pMouseOverHdl->onMouseEnter(); + } + } + return SdrSnapView::MouseMove(rMEvt, pWin); +} + void SdrMarkView::ForceRefToMarked() { switch(eDragMode) diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx index f4964d1b1ff1..22fa8e3a88cf 100644 --- a/svx/source/tbxctrls/extrusioncontrols.cxx +++ b/svx/source/tbxctrls/extrusioncontrols.cxx @@ -56,7 +56,7 @@ #include "extrusioncontrols.hxx" #include "extrusioncontrols.hrc" #include -#include "toolbarmenu.hxx" +#include "svx/toolbarmenu.hxx" #include "colorwindow.hxx" #include @@ -132,7 +132,6 @@ void ExtrusionDirectionWindow::implInit() mpDirectionSet = new ValueSet( mpMenu, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT ); mpDirectionSet->SetHelpId( HID_VALUESET_EXTRUSION_DIRECTION ); - mpDirectionSet->SetHelpId( HID_POPUP_LINEEND_CTRL ); mpDirectionSet->SetSelectHdl( LINK( this, ExtrusionDirectionWindow, SelectHdl ) ); mpDirectionSet->SetColCount( 3 ); mpDirectionSet->EnableFullItemMode( FALSE ); @@ -877,7 +876,6 @@ void ExtrusionLightingWindow::implInit() mpLightingSet = new ValueSet( mpMenu, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT ); mpLightingSet->SetHelpId( HID_VALUESET_EXTRUSION_LIGHTING ); - mpLightingSet->SetHelpId( HID_POPUP_LINEEND_CTRL ); mpLightingSet->SetSelectHdl( LINK( this, ExtrusionLightingWindow, SelectHdl ) ); mpLightingSet->SetColCount( 3 ); mpLightingSet->EnableFullItemMode( FALSE ); diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx index 111f2394836a..c0ec26b02b7a 100644 --- a/svx/source/tbxctrls/fontworkgallery.cxx +++ b/svx/source/tbxctrls/fontworkgallery.cxx @@ -47,7 +47,7 @@ #include #include #include -#include "toolbarmenu.hxx" +#include "svx/toolbarmenu.hxx" #include "fontworkgallery.hxx" #include "fontworkgallery.hrc" diff --git a/svx/source/tbxctrls/toolbarmenu.cxx b/svx/source/tbxctrls/toolbarmenu.cxx index 28867a30685d..24f93ea13a6e 100644 --- a/svx/source/tbxctrls/toolbarmenu.cxx +++ b/svx/source/tbxctrls/toolbarmenu.cxx @@ -31,14 +31,16 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" + #include #include #include -#include "toolbarmenu.hxx" +#include "svx/toolbarmenu.hxx" const int EXTRAITEMHEIGHT = 4; const int SEPARATOR_HEIGHT = 8; +const int TITLE_ID = -1; class ToolbarMenuEntry { @@ -556,7 +558,6 @@ void ToolbarMenu::implHighlightEntry( int nHighlightEntry, bool bHighlight ) aRect.Right() -= nFontHeight + nFontHeight/4; } DrawRect( aRect ); - implPaint( p, bHighlight ); if( bHighlight && ((p->mpControl == NULL) || (p->mbHasText)) ) { @@ -566,6 +567,9 @@ void ToolbarMenu::implHighlightEntry( int nHighlightEntry, bool bHighlight ) aRect.nRight -= 1; DrawSelectionBackground( aRect, true, false, TRUE, TRUE ); } + + implPaint( p, bHighlight ); + /* if( bRestoreLineColor ) SetLineColor( oldLineColor ); @@ -628,7 +632,7 @@ void ToolbarMenu::implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown ) for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) { ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; - if( pEntry ) + if( pEntry && (pEntry->mnEntryId != TITLE_ID) ) { long nOldY = nY; nY += pEntry->maSize.Height(); @@ -716,8 +720,8 @@ ToolbarMenuEntry* ToolbarMenu::implCursorUpDown( bool bUp, bool bHomeEnd ) else if( mnHighlightedEntry == -1 ) n = maEntryVector.size()-1; -// else -// break; + else + break; } else { @@ -726,12 +730,12 @@ ToolbarMenuEntry* ToolbarMenu::implCursorUpDown( bool bUp, bool bHomeEnd ) else if( mnHighlightedEntry == -1 ) n = 0; -// else -// break; + else + break; } ToolbarMenuEntry* pData = maEntryVector[n]; - if( pData ) + if( pData && (pData->mnEntryId != TITLE_ID) ) { implChangeHighlightEntry( n ); return pData; @@ -809,7 +813,7 @@ void ToolbarMenu::KeyInput( const KeyEvent& rKEvent ) case KEY_RETURN: { ToolbarMenuEntry* pEntry = implGetEntry( mnHighlightedEntry ); - if ( pEntry && pEntry->mbEnabled ) + if ( pEntry && pEntry->mbEnabled && (pEntry->mnEntryId != TITLE_ID) ) { if( pEntry->mpControl ) { @@ -908,8 +912,31 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) { if( !pThisOnly || ( pEntry == pThisOnly ) ) { + const bool bTitle = pEntry->mnEntryId == TITLE_ID; + if( pThisOnly && bHighlighted ) SetTextColor( rSettings.GetMenuHighlightTextColor() ); + else + SetTextColor( rSettings.GetMenuTextColor() ); + + if( bTitle ) + { + Rectangle aRect( aTopLeft, Size( aOutSz.Width(), pEntry->maSize.Height() ) ); + + // fill the background + Color aColor (rSettings.GetDialogColor()); + + SetFillColor (aColor); + SetLineColor (); + DrawRect(aRect); + + // Erase the four corner pixels to make the rectangle appear rounded. + SetLineColor( rSettings.GetMenuColor()); + DrawPixel( aRect.TopLeft()); + DrawPixel( Point(aRect.Right(), aRect.Top())); + DrawPixel( Point(aRect.Left(), aRect.Bottom())); + DrawPixel( Point(aRect.Right(), aRect.Bottom())); + } long nTextOffsetY = ((pEntry->maSize.Height()-nFontHeight)/2); @@ -971,9 +998,6 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) aDecoView.DrawSymbol( aRect, eSymbol, GetTextColor(), nSymbolStyle ); } } - - if( pThisOnly && bHighlighted ) - SetTextColor( rSettings.GetMenuTextColor() ); } aTopLeft.Y() += pEntry->maSize.Height(); diff --git a/svx/source/tbxctrls/toolbarmenu.hxx b/svx/source/tbxctrls/toolbarmenu.hxx deleted file mode 100644 index 30f56c92b943..000000000000 --- a/svx/source/tbxctrls/toolbarmenu.hxx +++ /dev/null @@ -1,90 +0,0 @@ -#include - -#include - -class ToolbarMenuEntry; -typedef std::vector< ToolbarMenuEntry * > ToolbarMenuEntryVector; - -class ToolbarMenu : public Control -{ -private: - ToolbarMenuEntryVector maEntryVector; - - int mnCheckPos; - int mnImagePos; - int mnTextPos; - - int mnHighlightedEntry; - int mnSelectedEntry; - - Size maSize; - - Link maHighlightHdl; - Link maSelectHdl; - - void StateChanged( StateChangedType nType ); - void DataChanged( const DataChangedEvent& rDCEvt ); - - void initWindow(); - - Size implCalcSize(); - - void appendEntry( ToolbarMenuEntry* pEntry ); - - void implPaint( ToolbarMenuEntry* pThisOnly = NULL, bool bHighlight = false ); - - void implHighlightEntry( int nHighlightEntry, bool bHighlight ); - void implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown ); - - void implChangeHighlightEntry( int nEntry ); - void implSelectEntry( int nSelectedEntry ); - - ToolbarMenuEntry* implCursorUpDown( bool bUp, bool bHomeEnd ); - ToolbarMenuEntry* implGetEntry( int nEntry ) const; - ToolbarMenuEntry* implSearchEntry( int nEntryId ) const; - -public: - ToolbarMenu( Window* pParent, WinBits nStyle ); - ~ToolbarMenu(); - - virtual void MouseMove( const MouseEvent& rMEvt ); - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void MouseButtonUp( const MouseEvent& rMEvt ); - virtual void KeyInput( const KeyEvent& rKEvent ); - virtual void Command( const CommandEvent& rCEvt ); - virtual void Paint( const Rectangle& rRect ); - virtual void RequestHelp( const HelpEvent& rHEvt ); - virtual void Resize(); - virtual void GetFocus(); - virtual void LoseFocus(); - - void appendEntry( int nEntryId, const String& rStr, MenuItemBits nItemBits = 0 ); - void appendEntry( int nEntryId, const Image& rImage, MenuItemBits nItemBits = 0 ); - void appendEntry( int nEntryId, const String& rStr, const Image& rImage, MenuItemBits nItemBits = 0 ); - void appendEntry( int nEntryId, Control* pControl, MenuItemBits nItemBits = 0 ); - void appendEntry( int nEntryId, const String& rStr, Control* pControl, MenuItemBits nItemBits = 0 ); - void appendSeparator(); - - void checkEntry( int nEntryId, bool bCheck = true ); - bool isEntryChecked( int nEntryId ) const; - - void enableEntry( int nEntryId, bool bEnable = true ); - bool isEntryEnabled( int nEntryId ) const; - - void setEntryText( int nEntryId, const String& rStr ); - const String& getEntryText( int nEntryId ) const; - - void setEntryImage( int nEntryId, const Image& rImage ); - const Image& getEntryImage( int nEntryId ) const; - - const Size& getMenuSize() const { return maSize; } - - void SetHighlightHdl( const Link& rLink ) { maHighlightHdl = rLink; } - const Link& GetHighlightHdl() const { return maHighlightHdl; } - - void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; } - const Link& GetSelectHdl() const { return maSelectHdl; } - - int getSelectedEntryId() const; - int getHighlightedEntryId() const; -}; -- cgit From b354b53c2d2c28a93fc06b06e1e855f38a46e841 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Tue, 8 Dec 2009 17:33:39 +0100 Subject: renaissance01: #i107213# more work on layout popup --- svx/inc/svx/toolbarmenu.hxx | 1 + 1 file changed, 1 insertion(+) (limited to 'svx') diff --git a/svx/inc/svx/toolbarmenu.hxx b/svx/inc/svx/toolbarmenu.hxx index fcd3bf814831..4299ddb4c943 100644 --- a/svx/inc/svx/toolbarmenu.hxx +++ b/svx/inc/svx/toolbarmenu.hxx @@ -34,6 +34,7 @@ #include #include +#include #include "svx/svxdllapi.h" -- cgit From 28687b22eef200c32a37f6901cd40c0328b8766d Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Wed, 16 Dec 2009 11:55:37 +0000 Subject: #i107721# thesaurus dialog redesign --- svx/inc/helpid.hrc | 2 + svx/inc/svx/thesdlg.hxx | 15 +++-- svx/source/dialog/makefile.mk | 2 +- svx/source/dialog/thesdlg.cxx | 122 +++++++++++++++++++++++++++++++++++++-- svx/source/dialog/thesdlg.hrc | 6 +- svx/source/dialog/thesdlg.src | 131 ++++++++++++++++++++++++++---------------- 6 files changed, 214 insertions(+), 64 deletions(-) (limited to 'svx') diff --git a/svx/inc/helpid.hrc b/svx/inc/helpid.hrc index 3cac79c92f80..48accc405276 100644 --- a/svx/inc/helpid.hrc +++ b/svx/inc/helpid.hrc @@ -450,6 +450,8 @@ #define HID_GRFFILTER_EMBOSS_LIGHT (HID_SVX_START + 408) +#define HID_CT_THES_ALTERNATIVES (HID_SVX_START + 409) + #define HID_GALLERY_NEWTHEME (HID_SVX_START + 410) #define HID_GALLERY_THEMELIST (HID_SVX_START + 411) diff --git a/svx/inc/svx/thesdlg.hxx b/svx/inc/svx/thesdlg.hxx index 4ca5376ad8a7..74a9f0c45b56 100644 --- a/svx/inc/svx/thesdlg.hxx +++ b/svx/inc/svx/thesdlg.hxx @@ -31,29 +31,26 @@ #define _SVX_THESDLG_HXX // include --------------------------------------------------------------- -#ifndef _EDIT_HXX //autogen #include -#endif -#ifndef _BUTTON_HXX //autogen #include -#endif -#ifndef _LSTBOX_HXX //autogen #include -#endif -#ifndef _FIXED_HXX //autogen #include -#endif #include #include #include #include + +#include + #include "svx/svxdllapi.h" + // forward --------------------------------------------------------------- struct ThesDlg_Impl; class SvxThesaurusLanguageDlg_Impl; +class ThesaurusAlternativesCtrl_Impl; namespace com { namespace sun { namespace star { namespace linguistic2 { @@ -91,6 +88,8 @@ private: ListBox aMeanLB; FixedText aSynonymText; ListBox aSynonymLB; + FixedText m_aAlternativesText; + boost::shared_ptr< ThesaurusAlternativesCtrl_Impl > m_pAlternativesCT; FixedLine aVarFL; OKButton aOkBtn; diff --git a/svx/source/dialog/makefile.mk b/svx/source/dialog/makefile.mk index c54081365a11..e24fad3ec7d9 100644 --- a/svx/source/dialog/makefile.mk +++ b/svx/source/dialog/makefile.mk @@ -82,6 +82,7 @@ SRC2FILES = \ LIB1TARGET=$(SLB)$/$(TARGET)-core.lib LIB1OBJFILES= \ + $(SLO)$/checklbx.obj \ $(SLO)$/dialmgr.obj\ $(SLO)$/dlgutil.obj \ $(SLO)$/framelink.obj\ @@ -100,7 +101,6 @@ LIB2TARGET=$(SLB)$/$(TARGET).lib LIB2OBJFILES= \ $(SLO)$/charmap.obj \ - $(SLO)$/checklbx.obj \ $(SLO)$/connctrl.obj \ $(SLO)$/contwnd.obj \ $(SLO)$/ctredlin.obj \ diff --git a/svx/source/dialog/thesdlg.cxx b/svx/source/dialog/thesdlg.cxx index 7a5497181b59..ad63b347327e 100644 --- a/svx/source/dialog/thesdlg.cxx +++ b/svx/source/dialog/thesdlg.cxx @@ -30,15 +30,15 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" + #include #include +#include +#include #include -#ifndef _MSGBOX_HXX //autogen #include -#endif -#ifndef _APP_HXX //autogen #include -#endif + #include #include @@ -54,6 +54,7 @@ #include "thesdlg.hrc" #include #include +#include using namespace ::com::sun::star; @@ -67,6 +68,7 @@ using namespace ::com::sun::star::linguistic2; //#define S2U(s) StringToOUString(s, CHARSET_SYSTEM) //#define U2S(s) OUStringToString(s, CHARSET_SYSTEM) +#define A2S(x) String::CreateFromAscii( x ) // GetReplaceEditString ------------------------------- @@ -97,6 +99,116 @@ static void GetReplaceEditString( String &rText ) rText.EraseLeadingAndTrailingChars( sal_Unicode(' ') ); } +// class ThesaurusAlternativesCtrl_Impl ---------------------------------- + +class AlternativesUserData_Impl +{ + String sText; + bool bHeader; + +public: + AlternativesUserData_Impl( const String &rText, bool bIsHeader ) : + sText(rText), + bHeader(bIsHeader) + { + } + + bool IsHeader() const { return bHeader; } + const String& GetText() const { return sText; } +}; + + +class AlternativesString_Impl : public SvLBoxString +{ +public: + + AlternativesString_Impl( SvLBoxEntry* pEntry, USHORT nFlags, const String& rStr ) + : SvLBoxString( pEntry, nFlags, rStr ) {} + + virtual void Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags, SvLBoxEntry* pEntry); +}; + + +void AlternativesString_Impl::Paint( + const Point& rPos, + SvLBox& rDev, USHORT, + SvLBoxEntry* pEntry ) +{ + AlternativesUserData_Impl* pData = (AlternativesUserData_Impl*)pEntry->GetUserData(); + Point aPos( rPos ); + Font aOldFont( rDev.GetFont()); + if (pData && pData->IsHeader()) + { + Font aFont( aOldFont ); + aFont.SetWeight( WEIGHT_BOLD ); + rDev.SetFont( aFont ); + aPos.X() = 0; + } + else + aPos.X() += 5; + rDev.DrawText( aPos, GetText() ); + rDev.SetFont( aOldFont ); +} + + +class ThesaurusAlternativesCtrl_Impl : + public SvxCheckListBox +{ + std::vector< SvLBoxEntry * > m_aEntries; + + + SvLBoxEntry * AddEntry( const String &rText, bool bIsHeader ); + + // disable copy c-tor and assignment operator + ThesaurusAlternativesCtrl_Impl( const ThesaurusAlternativesCtrl_Impl & ); + ThesaurusAlternativesCtrl_Impl & operator = ( const ThesaurusAlternativesCtrl_Impl & ); + +public: + ThesaurusAlternativesCtrl_Impl( Window* pParent ); + virtual ~ThesaurusAlternativesCtrl_Impl(); +}; + + +ThesaurusAlternativesCtrl_Impl::ThesaurusAlternativesCtrl_Impl( + Window* pParent ) : + SvxCheckListBox( pParent, SVX_RES( CT_THES_ALTERNATIVES ) ) +{ + FreeResource(); + + SetWindowBits( WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE ); + SetHighlightRange(); +// SetSelectHdl( LINK( this, SvxEditModulesDlg, SelectHdl_Impl )); +// SetCheckButtonHdl( LINK( this, SvxEditModulesDlg, BoxCheckButtonHdl_Impl) ); + +// AddEntry( A2S("klein"), true ); +// AddEntry( A2S("1. alpha"), false ); +// AddEntry( A2S("2. beta"), false ); + +// AddEntry( A2S("gross"), true ); +// AddEntry( A2S("1. ALPHA"), false ); +// AddEntry( A2S("2. BETA"), false ); +// AddEntry( A2S("3. GAMMA"), false ); +} + + +ThesaurusAlternativesCtrl_Impl::~ThesaurusAlternativesCtrl_Impl() +{ +} + + +SvLBoxEntry * ThesaurusAlternativesCtrl_Impl::AddEntry( const String &rText, bool bIsHeader ) +{ + SvLBoxEntry* pEntry = new SvLBoxEntry; + String sEmpty; + pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) ); // Leerspalte +// pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0)); // Sonst Puff! + pEntry->AddItem( new AlternativesString_Impl( pEntry, 0, rText ) ); + + m_aEntries.push_back( pEntry ); + return pEntry; +} + + // struct ThesDlg_Impl --------------------------------------------------- struct ThesDlg_Impl @@ -203,6 +315,8 @@ SvxThesaurusDialog::SvxThesaurusDialog( Window* pParent, Reference< XThesaurus > aSynonymText( this, SVX_RES( FT_SYNON ) ), aSynonymLB ( this, SVX_RES( LB_SYNON ) ), aVarFL ( this, SVX_RES( FL_VAR ) ), + m_aAlternativesText ( this, SVX_RES( FT_THES_ALTERNATIVES ) ), + m_pAlternativesCT ( new ThesaurusAlternativesCtrl_Impl( this ) ), aOkBtn ( this, SVX_RES( BTN_THES_OK ) ), aCancelBtn ( this, SVX_RES( BTN_THES_CANCEL ) ), aLookUpBtn ( this, SVX_RES( BTN_LOOKUP ) ), diff --git a/svx/source/dialog/thesdlg.hrc b/svx/source/dialog/thesdlg.hrc index 4292de929236..5c488123aed8 100644 --- a/svx/source/dialog/thesdlg.hrc +++ b/svx/source/dialog/thesdlg.hrc @@ -45,14 +45,16 @@ #define LB_SYNON 20 #define FT_REPL 21 #define ED_REPL 22 -#define FL_VAR 23 +#define FL_VAR 23 +#define FT_THES_ALTERNATIVES 24 +#define CT_THES_ALTERNATIVES 25 #define STR_ERR_WORDNOTFOUND 30 // LanguageDialog -------------------------------------------------------- #define LB_THES_LANGUAGE 10 -#define FL_THES_LANGUAGE 11 +#define FL_THES_LANGUAGE 11 #define BTN_LANG_OK 12 #define BTN_LANG_CANCEL 12 #define BTN_LANG_HELP 13 diff --git a/svx/source/dialog/thesdlg.src b/svx/source/dialog/thesdlg.src index 661a046175e2..40b5361bb170 100644 --- a/svx/source/dialog/thesdlg.src +++ b/svx/source/dialog/thesdlg.src @@ -39,99 +39,132 @@ ModalDialog RID_SVXDLG_THESAURUS { HelpId = SID_THESAURUS ; OutputSize = TRUE ; - Size = MAP_APPFONT ( 285 , 116 ) ; +// Size = MAP_APPFONT ( 285, 116 ) ; + Size = MAP_APPFONT ( 220, 230 ) ; Text [ en-US ] = "Thesaurus" ; Moveable = TRUE ; SvLook = TRUE ; - OkButton BTN_THES_OK - { - Pos = MAP_APPFONT ( 219 , 6 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton BTN_THES_CANCEL + + FixedText FT_WORD { - Pos = MAP_APPFONT ( 219 , 23 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; + Pos = MAP_APPFONT ( 5 , 5 ) ; + Size = MAP_APPFONT ( 143 , 8 ) ; + Text [ en-US ] = "Current ~word" ; + LEFT = TRUE ; }; - PushButton BTN_LOOKUP + ListBox LB_WORD { - Pos = MAP_APPFONT ( 219 , 40 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Search" ; + DropDown = TRUE ; + Pos = MAP_APPFONT ( 5 , 16 ) ; + Size = MAP_APPFONT ( 143 , 12 ) ; }; PushButton BTN_LANGUAGE { - Pos = MAP_APPFONT ( 219 , 57 ) ; + Pos = MAP_APPFONT ( 154 , 16 ) ; Size = MAP_APPFONT ( 60 , 14 ) ; Text [ en-US ] = "~Language..." ; }; - HelpButton BTN_THES_HELP - { - Pos = MAP_APPFONT ( 219 , 77 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - }; - FixedText FT_WORD - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 96 , 8 ) ; - Text [ en-US ] = "~Word" ; - LEFT = TRUE ; - }; - ListBox LB_WORD - { - DropDown = TRUE ; - Pos = MAP_APPFONT ( 12 , 25 ) ; - Size = MAP_APPFONT ( 96 , 65 ) ; - }; + FixedText FT_MEAN { - Pos = MAP_APPFONT ( 12 , 43 ) ; - Size = MAP_APPFONT ( 96 , 8 ) ; + Pos = MAP_APPFONT ( 5 , 33 ) ; + Size = MAP_APPFONT ( 100 , 8 ) ; Text [ en-US ] = "~Meaning " ; LEFT = TRUE ; }; ListBox LB_MEAN { BORDER = TRUE ; - Pos = MAP_APPFONT ( 12 , 55 ) ; - Size = MAP_APPFONT ( 96 , 50 ) ; + Pos = MAP_APPFONT ( 5 , 45 ) ; + Size = MAP_APPFONT ( 100 , 50 ) ; AutoHScroll = TRUE ; }; FixedText FT_SYNON { - Pos = MAP_APPFONT ( 111 , 43 ) ; - Size = MAP_APPFONT ( 96 , 8 ) ; + Pos = MAP_APPFONT ( 115 , 33 ) ; + Size = MAP_APPFONT ( 100 , 8 ) ; Text [ en-US ] = "Sy~nonym" ; LEFT = TRUE ; }; ListBox LB_SYNON { BORDER = TRUE ; - Pos = MAP_APPFONT ( 111 , 55 ) ; - Size = MAP_APPFONT ( 96 , 50 ) ; + Pos = MAP_APPFONT ( 115 , 45 ) ; + Size = MAP_APPFONT ( 100 , 50 ) ; AutoHScroll = TRUE ; }; + + FixedText FT_THES_ALTERNATIVES + { + Pos = MAP_APPFONT ( 5 , 101 ) ; + Size = MAP_APPFONT ( 220 , 8 ) ; + Text [ en-US ] = "~Alternatives" ; + LEFT = TRUE ; + }; + Control CT_THES_ALTERNATIVES + { + HelpID = HID_CT_THES_ALTERNATIVES ; + Pos = MAP_APPFONT ( 5 , 112 ) ; + Size = MAP_APPFONT ( 209 , 50 ) ; + Border = TRUE; + TabStop = TRUE ; +// DialogControl = TRUE; +// ??? OutputSize = TRUE ; +/* + ScrollBar VB_ALTERNATIVES_VSCROLL + { + Pos = MAP_APPFONT ( 228 , 10 ) ; + Size = MAP_APPFONT ( 8 , 124 ) ; + VScroll = TRUE; + }; +*/ + }; + FixedText FT_REPL { - Pos = MAP_APPFONT ( 111 , 14 ) ; - Size = MAP_APPFONT ( 96 , 8 ) ; - Text [ en-US ] = "~Replace" ; + Pos = MAP_APPFONT ( 5 , 173 ) ; + Size = MAP_APPFONT ( 143 , 8 ) ; + Text [ en-US ] = "~Replace with" ; LEFT = TRUE ; }; Edit ED_REPL { BORDER = TRUE ; - Pos = MAP_APPFONT ( 111 , 25 ) ; - Size = MAP_APPFONT ( 96 , 12 ) ; + Pos = MAP_APPFONT ( 5 , 184 ) ; + Size = MAP_APPFONT ( 143 , 12 ) ; LEFT = TRUE ; }; + PushButton BTN_LOOKUP + { + Pos = MAP_APPFONT ( 154 , 184 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; + Text [ en-US ] = "Look ~Up" ; + }; FixedLine FL_VAR { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 207 , 8 ) ; - Text [ en-US ] = "Variations" ; + Pos = MAP_APPFONT ( 0 , 200 ) ; + Size = MAP_APPFONT ( 220 , 8 ) ; +// Text [ en-US ] = "Variations" ; }; + + + HelpButton BTN_THES_HELP + { + Pos = MAP_APPFONT ( 5 , 210 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; + }; + OkButton BTN_THES_OK + { + Pos = MAP_APPFONT ( 88 , 210 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; + DefButton = TRUE ; + }; + CancelButton BTN_THES_CANCEL + { + Pos = MAP_APPFONT ( 154 , 210 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; + }; + String STR_ERR_WORDNOTFOUND { Text [ en-US ] = "Word not found in thesaurus" ; -- cgit From e3e522b13deb675ad1135a924857330aaab0e569 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Fri, 8 Jan 2010 15:01:57 +0100 Subject: dba33f: merge conflict --- svx/source/form/fmtools.cxx | 4 ++-- svx/source/inc/fmsrcimp.hxx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'svx') diff --git a/svx/source/form/fmtools.cxx b/svx/source/form/fmtools.cxx index e87b651c8b97..1b91750072a5 100644 --- a/svx/source/form/fmtools.cxx +++ b/svx/source/form/fmtools.cxx @@ -91,8 +91,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/svx/source/inc/fmsrcimp.hxx b/svx/source/inc/fmsrcimp.hxx index d9fd445f3257..0ede7660d2e4 100644 --- a/svx/source/inc/fmsrcimp.hxx +++ b/svx/source/inc/fmsrcimp.hxx @@ -51,7 +51,7 @@ #ifndef _SVSTDARR_ULONGS #define _SVSTDARR_ULONGS -#include +#include #endif // =================================================================================================== -- cgit From 3af527bf8c85dea2bc94fc812b96ff6253712232 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 11 Jan 2010 08:09:14 +0100 Subject: dba33e: svx split --- svx/inc/svx/fmtools.hxx | 1 - 1 file changed, 1 deletion(-) (limited to 'svx') diff --git a/svx/inc/svx/fmtools.hxx b/svx/inc/svx/fmtools.hxx index da0339fc25af..8bab4054f258 100644 --- a/svx/inc/svx/fmtools.hxx +++ b/svx/inc/svx/fmtools.hxx @@ -27,7 +27,6 @@ #ifndef _SVX_FMTOOLS_HXX #define _SVX_FMTOOLS_HXX -#include "fmprop.hrc" #include "svx/svxdllapi.h" #include -- cgit From 1b030104d238985d6df1036f0e48eee5bb6d8bb5 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Mon, 11 Jan 2010 14:46:35 +0100 Subject: cws tl74: merge errors --- svx/inc/helpid.hrc | 3 ++- svx/source/dialog/thesdlg.cxx | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'svx') diff --git a/svx/inc/helpid.hrc b/svx/inc/helpid.hrc index bc36634e24c3..cc28189cc2f3 100644 --- a/svx/inc/helpid.hrc +++ b/svx/inc/helpid.hrc @@ -283,6 +283,7 @@ #define HID_SVX_SENDMENU_SIGNANDENCRYPT (HID_SVX_START + 245) #define HID_SVX_TP_APPEARANCE (HID_SVX_START + 246) #define HID_SVX_TP_DESKTOP (HID_SVX_START + 247) +#define HID_CT_THES_ALTERNATIVES (HID_SVX_START + 248) // please adjust ACT_SVX_HID_END2 below if you add entries here! @@ -290,7 +291,7 @@ // Overrun check --------------------------------------------------------- // ----------------------------------------------------------------------- -#define ACT_SVX_HID_END (HID_SVX_START+247) +#define ACT_SVX_HID_END (HID_SVX_START+248) #if ACT_SVX_HID_END > HID_SVX_END #error Resource-Ueberlauf in #line, #file #endif diff --git a/svx/source/dialog/thesdlg.cxx b/svx/source/dialog/thesdlg.cxx index d57bb02872ff..bd1cff76de02 100644 --- a/svx/source/dialog/thesdlg.cxx +++ b/svx/source/dialog/thesdlg.cxx @@ -33,8 +33,8 @@ #include #include -#include -#include +#include +#include #include #include #include @@ -198,6 +198,7 @@ ThesaurusAlternativesCtrl_Impl::~ThesaurusAlternativesCtrl_Impl() SvLBoxEntry * ThesaurusAlternativesCtrl_Impl::AddEntry( const String &rText, bool bIsHeader ) { + (void) bIsHeader; SvLBoxEntry* pEntry = new SvLBoxEntry; String sEmpty; pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) ); // Leerspalte @@ -314,9 +315,9 @@ SvxThesaurusDialog::SvxThesaurusDialog( Window* pParent, Reference< XThesaurus > aMeanLB ( this, SVX_RES( LB_MEAN ) ), aSynonymText( this, SVX_RES( FT_SYNON ) ), aSynonymLB ( this, SVX_RES( LB_SYNON ) ), - aVarFL ( this, SVX_RES( FL_VAR ) ), m_aAlternativesText ( this, SVX_RES( FT_THES_ALTERNATIVES ) ), m_pAlternativesCT ( new ThesaurusAlternativesCtrl_Impl( this ) ), + aVarFL ( this, SVX_RES( FL_VAR ) ), aOkBtn ( this, SVX_RES( BTN_THES_OK ) ), aCancelBtn ( this, SVX_RES( BTN_THES_CANCEL ) ), aLookUpBtn ( this, SVX_RES( BTN_LOOKUP ) ), -- cgit From fbb7a4cd4c90471ab9582b799e04a6c1023d507e Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 13 Jan 2010 08:44:34 +0100 Subject: dba33f: #i20615# new feature to allow server side column descrriptions to be visible and changeable in the table designer. --- svx/source/fmcomp/fmgridcl.cxx | 16 ++++++++++++++-- svx/source/inc/fmprop.hrc | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'svx') diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx index 35506d7d5ef4..89b18a05f650 100644 --- a/svx/source/fmcomp/fmgridcl.cxx +++ b/svx/source/fmcomp/fmgridcl.cxx @@ -213,10 +213,11 @@ void FmGridHeader::RequestHelp( const HelpEvent& rHEvt ) Reference< ::com::sun::star::container::XIndexContainer > xColumns(static_cast(GetParent())->GetPeer()->getColumns()); try { - Reference< ::com::sun::star::beans::XPropertySet > xColumn; - ::cppu::extractInterface(xColumn, xColumns->getByIndex(nPos)); + Reference< ::com::sun::star::beans::XPropertySet > xColumn(xColumns->getByIndex(nPos),UNO_QUERY); ::rtl::OUString aHelpText; xColumn->getPropertyValue(FM_PROP_HELPTEXT) >>= aHelpText; + if ( !aHelpText.getLength() ) + xColumn->getPropertyValue(FM_PROP_DESCRIPTION) >>= aHelpText; if ( aHelpText.getLength() ) { if ( rHEvt.GetMode() & HELPMODE_BALLOON ) @@ -2002,7 +2003,11 @@ namespace { Reference xProp(GetPeer()->getColumns(),UNO_QUERY); if ( xProp.is() ) + { xProp->getPropertyValue(FM_PROP_HELPTEXT) >>= sRetText; + if ( !sRetText.getLength() ) + xProp->getPropertyValue(FM_PROP_DESCRIPTION) >>= sRetText; + } } break; case ::svt::BBTYPE_COLUMNHEADERCELL: @@ -2011,6 +2016,13 @@ namespace GetModelColumnPos( sal::static_int_cast< sal_uInt16 >(_nPosition)), FM_PROP_HELPTEXT); + if ( !sRetText.getLength() ) + sRetText = getColumnPropertyFromPeer( + GetPeer(), + GetModelColumnPos( + sal::static_int_cast< sal_uInt16 >(_nPosition)), + FM_PROP_DESCRIPTION); + break; default: sRetText = DbGridControl::GetAccessibleObjectDescription(_eObjType,_nPosition); diff --git a/svx/source/inc/fmprop.hrc b/svx/source/inc/fmprop.hrc index 34d88b325731..111b69174b9f 100644 --- a/svx/source/inc/fmprop.hrc +++ b/svx/source/inc/fmprop.hrc @@ -177,5 +177,6 @@ #define FM_PROP_INPUT_REQUIRED rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InputRequired" ) ) #define FM_PROP_WRITING_MODE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "WritingMode" ) ) #define FM_PROP_MOUSE_WHEEL_BEHAVIOR rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MouseWheelBehavior" ) ) +#define FM_PROP_DESCRIPTION rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Description" ) ) #endif // _SVX_FMPROP_HRC -- cgit From 5d9eda8b975ea497ff1ce5bd306975d829a07bfa Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Wed, 13 Jan 2010 19:12:02 +0100 Subject: toolbar menu rendering finetuning --- svx/inc/extrusioncontrols.hxx | 29 +-- svx/inc/fontworkgallery.hxx | 14 +- svx/inc/svx/toolbarmenu.hxx | 20 +- svx/source/tbxctrls/extrusioncontrols.cxx | 311 ++++++++++-------------------- svx/source/tbxctrls/extrusioncontrols.src | 10 +- svx/source/tbxctrls/fontworkgallery.cxx | 192 +++++++----------- svx/source/tbxctrls/fontworkgallery.src | 8 +- svx/source/tbxctrls/toolbarmenu.cxx | 158 ++++++++------- 8 files changed, 298 insertions(+), 444 deletions(-) (limited to 'svx') diff --git a/svx/inc/extrusioncontrols.hxx b/svx/inc/extrusioncontrols.hxx index b707cae39f98..cd4d298cbee6 100644 --- a/svx/inc/extrusioncontrols.hxx +++ b/svx/inc/extrusioncontrols.hxx @@ -30,9 +30,10 @@ #ifndef _SVX_EXTRUSION_CONTROLS_HXX #define _SVX_EXTRUSION_CONTROLS_HXX +#include "svx/svxdllapi.h" + #include #include -#include #include #ifndef _SV_BUTTON_HXX #include @@ -40,10 +41,10 @@ #include #include #include -#include "svx/svxdllapi.h" + +#include "svx/toolbarmenu.hxx" class SfxBindings; -class ToolbarMenu; class SfxStatusForwarder; //======================================================================== @@ -52,12 +53,11 @@ namespace svx { class ToolboxButtonColorUpdater; -class ExtrusionDirectionWindow : public SfxPopupWindow +class ExtrusionDirectionWindow : public ToolbarMenu { using FloatingWindow::StateChanged; private: - ToolbarMenu* mpMenu; ValueSet* mpDirectionSet; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; @@ -92,8 +92,6 @@ protected: virtual void GetFocus (void); public: - ExtrusionDirectionWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); ExtrusionDirectionWindow( USHORT nId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ); @@ -124,13 +122,11 @@ public: //======================================================================== -class ExtrusionDepthWindow : public SfxPopupWindow +class ExtrusionDepthWindow : public ToolbarMenu { using FloatingWindow::StateChanged; private: - ToolbarMenu* mpMenu; - Image maImgDepth0; Image maImgDepth1; Image maImgDepth2; @@ -171,8 +167,6 @@ protected: virtual void GetFocus (void); public: - ExtrusionDepthWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); ExtrusionDepthWindow( USHORT nId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ); @@ -203,12 +197,11 @@ public: //======================================================================== -class ExtrusionLightingWindow : public SfxPopupWindow +class ExtrusionLightingWindow : public ToolbarMenu { using FloatingWindow::StateChanged; private: - ToolbarMenu* mpMenu; ValueSet* mpLightingSet; Image maImgLightingOff[9]; @@ -253,8 +246,6 @@ protected: virtual void GetFocus (void); public: - ExtrusionLightingWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); ExtrusionLightingWindow( USHORT nId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ); @@ -285,12 +276,10 @@ public: //======================================================================== -class ExtrusionSurfaceWindow : public SfxPopupWindow +class ExtrusionSurfaceWindow : public ToolbarMenu { using FloatingWindow::StateChanged; private: - ToolbarMenu* mpMenu; - Image maImgSurface1; Image maImgSurface2; Image maImgSurface3; @@ -321,8 +310,6 @@ protected: virtual void GetFocus (void); public: - ExtrusionSurfaceWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); ExtrusionSurfaceWindow( USHORT nId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ); diff --git a/svx/inc/fontworkgallery.hxx b/svx/inc/fontworkgallery.hxx index 3ceb365d32f0..b41f1a942c95 100644 --- a/svx/inc/fontworkgallery.hxx +++ b/svx/inc/fontworkgallery.hxx @@ -40,9 +40,8 @@ #include #endif #include -#include #include "svx/svxdllapi.h" - +#include "svx/toolbarmenu.hxx" #include class FmFormModel; @@ -53,7 +52,6 @@ class SdrObject; class SdrModel; class SfxBindings; -class ToolbarMenu; class SfxStatusForwarder; //------------------------------------------------------------------------ @@ -61,12 +59,10 @@ class SfxStatusForwarder; namespace svx { -class FontWorkAlignmentWindow : public SfxPopupWindow +class FontWorkAlignmentWindow : public ToolbarMenu { using FloatingWindow::StateChanged; private: - ToolbarMenu* mpMenu; - Image maImgAlgin1; Image maImgAlgin2; Image maImgAlgin3; @@ -98,8 +94,6 @@ protected: virtual void GetFocus (void); public: - FontWorkAlignmentWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); FontWorkAlignmentWindow( USHORT nId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ); @@ -128,12 +122,10 @@ public: //------------------------------------------------------------------------ -class FontWorkCharacterSpacingWindow : public SfxPopupWindow +class FontWorkCharacterSpacingWindow : public ToolbarMenu { using FloatingWindow::StateChanged; private: - ToolbarMenu* mpMenu; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; bool mbPopupMode; diff --git a/svx/inc/svx/toolbarmenu.hxx b/svx/inc/svx/toolbarmenu.hxx index 4299ddb4c943..7809d373e1fa 100644 --- a/svx/inc/svx/toolbarmenu.hxx +++ b/svx/inc/svx/toolbarmenu.hxx @@ -36,15 +36,26 @@ #include #include +#include + #include "svx/svxdllapi.h" class ToolbarMenuEntry; typedef std::vector< ToolbarMenuEntry * > ToolbarMenuEntryVector; -class SVX_DLLPUBLIC ToolbarMenu : public Control +class SVX_DLLPUBLIC ToolbarMenu : public SfxPopupWindow { public: - ToolbarMenu( Window* pParent, WinBits nStyle ); + ToolbarMenu( USHORT nId, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, + Window* pParentWindow, + WinBits nBits ); + + ToolbarMenu( USHORT nId, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, + Window* pParentWindow, + const ResId& rResId ); + ~ToolbarMenu(); virtual void MouseMove( const MouseEvent& rMEvt ); @@ -62,7 +73,7 @@ public: void appendEntry( int nEntryId, const Image& rImage, MenuItemBits nItemBits = 0 ); void appendEntry( int nEntryId, const String& rStr, const Image& rImage, MenuItemBits nItemBits = 0 ); void appendEntry( int nEntryId, Control* pControl, MenuItemBits nItemBits = 0 ); - void appendEntry( int nEntryId, const String& rStr, Control* pControl, MenuItemBits nItemBits = 0 ); +// void appendEntry( int nEntryId, const String& rStr, Control* pControl, MenuItemBits nItemBits = 0 ); void appendSeparator(); void checkEntry( int nEntryId, bool bCheck = true ); @@ -103,6 +114,8 @@ private: Link maHighlightHdl; Link maSelectHdl; + void implInit(); + void StateChanged( StateChangedType nType ); void DataChanged( const DataChangedEvent& rDCEvt ); @@ -113,6 +126,7 @@ private: void appendEntry( ToolbarMenuEntry* pEntry ); void implPaint( ToolbarMenuEntry* pThisOnly = NULL, bool bHighlight = false ); + void implDrawBorder(); void implHighlightEntry( int nHighlightEntry, bool bHighlight ); void implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown ); diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx index bbb2861091b4..14da4459e04d 100644 --- a/svx/source/tbxctrls/extrusioncontrols.cxx +++ b/svx/source/tbxctrls/extrusioncontrols.cxx @@ -78,27 +78,11 @@ SFX_IMPL_TOOLBOX_CONTROL( ExtrusionDirectionControl, SfxBoolItem ); static sal_Int32 gSkewList[] = { 135, 90, 45, 180, 0, -360, -135, -90, -45 }; -ExtrusionDirectionWindow::ExtrusionDirectionWindow( - USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ) : - SfxPopupWindow( nId, - rFrame, - SVX_RES( RID_SVXFLOAT_EXTRUSION_DIRECTION )), - mxFrame( rFrame ), - maImgPerspective( SVX_RES( IMG_PERSPECTIVE ) ), - maImgPerspectiveH( SVX_RES( IMG_PERSPECTIVE_H ) ), - maImgParallel( SVX_RES( IMG_PARALLEL ) ), - maImgParallelH( SVX_RES( IMG_PARALLEL_H ) ), - mbPopupMode ( TRUE ) -{ - implInit(); -} - ExtrusionDirectionWindow::ExtrusionDirectionWindow( USHORT nId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) : - SfxPopupWindow( nId, + ToolbarMenu( nId, rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_DIRECTION )), @@ -126,10 +110,10 @@ void ExtrusionDirectionWindow::implInit() // mpDirectionForewarder = new SfxStatusForwarder( SID_EXTRUSION_DIRECTION, *this ); // mpProjectionForewarder = new SfxStatusForwarder( SID_EXTRUSION_PROJECTION, *this ); - mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); - mpMenu->SetHelpId( HID_MENU_EXTRUSION_DIRECTION ); - mpMenu->SetSelectHdl( LINK( this, ExtrusionDirectionWindow, SelectHdl ) ); - mpDirectionSet = new ValueSet( mpMenu, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT ); +// mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); + /*mpMenu->*/SetHelpId( HID_MENU_EXTRUSION_DIRECTION ); + /*mpMenu->*/SetSelectHdl( LINK( this, ExtrusionDirectionWindow, SelectHdl ) ); + mpDirectionSet = new ValueSet( /*mpMenu->*/this, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT ); mpDirectionSet->SetHelpId( HID_VALUESET_EXTRUSION_DIRECTION ); mpDirectionSet->SetSelectHdl( LINK( this, ExtrusionDirectionWindow, SelectHdl ) ); @@ -146,15 +130,15 @@ void ExtrusionDirectionWindow::implInit() mpDirectionSet->SetOutputSizePixel( Size( 72, 72 ) ); - mpMenu->appendEntry( 2, mpDirectionSet ); - mpMenu->appendSeparator(); - mpMenu->appendEntry( 0, String( SVX_RES( STR_PERSPECTIVE ) ), bHighContrast ? maImgPerspectiveH : maImgPerspective ); - mpMenu->appendEntry( 1, String( SVX_RES( STR_PARALLEL ) ), bHighContrast ? maImgParallelH : maImgParallel ); + /*mpMenu->*/appendEntry( 2, mpDirectionSet ); + /*mpMenu->*/appendSeparator(); + /*mpMenu->*/appendEntry( 0, String( SVX_RES( STR_PERSPECTIVE ) ), bHighContrast ? maImgPerspectiveH : maImgPerspective ); + /*mpMenu->*/appendEntry( 1, String( SVX_RES( STR_PARALLEL ) ), bHighContrast ? maImgParallelH : maImgParallel ); - SetOutputSizePixel( mpMenu->getMenuSize() ); - mpMenu->SetOutputSizePixel( GetOutputSizePixel() ); + SetOutputSizePixel( /*mpMenu->*/getMenuSize() ); + //mpMenu->SetOutputSizePixel( GetOutputSizePixel() ); - mpMenu->Show(); + //mpMenu->Show(); FreeResource(); @@ -164,7 +148,7 @@ void ExtrusionDirectionWindow::implInit() SfxPopupWindow* ExtrusionDirectionWindow::Clone() const { - return new ExtrusionDirectionWindow( GetId(), mxFrame ); + return new ExtrusionDirectionWindow( GetId(), mxFrame, 0 ); } void ExtrusionDirectionWindow::DataChanged( const DataChangedEvent& rDCEvt ) @@ -181,8 +165,8 @@ void ExtrusionDirectionWindow::DataChanged( const DataChangedEvent& rDCEvt ) mpDirectionSet->SetItemImage( i+1, bHighContrast ? maImgDirectionH[ i ] : maImgDirection[ i ] ); } - mpMenu->setEntryImage( 0, bHighContrast ? maImgPerspectiveH : maImgPerspective ); - mpMenu->setEntryImage( 1, bHighContrast ? maImgParallelH : maImgParallel ); + /*mpMenu->*/setEntryImage( 0, bHighContrast ? maImgPerspectiveH : maImgPerspective ); + /*mpMenu->*/setEntryImage( 1, bHighContrast ? maImgParallelH : maImgParallel ); } } @@ -190,7 +174,7 @@ void ExtrusionDirectionWindow::DataChanged( const DataChangedEvent& rDCEvt ) ExtrusionDirectionWindow::~ExtrusionDirectionWindow() { - delete mpMenu; + //delete mpMenu; } // ----------------------------------------------------------------------- @@ -215,9 +199,9 @@ void ExtrusionDirectionWindow::implSetDirection( sal_Int32 nSkew, bool bEnabled mpDirectionSet->SetNoSelection(); } } - if( mpMenu ) +// if( mpMenu ) { - mpMenu->enableEntry( 2, bEnabled ); + /*mpMenu->*/enableEntry( 2, bEnabled ); } } @@ -225,12 +209,12 @@ void ExtrusionDirectionWindow::implSetDirection( sal_Int32 nSkew, bool bEnabled void ExtrusionDirectionWindow::implSetProjection( sal_Int32 nProjection, bool bEnabled ) { - if( mpMenu ) +// if( mpMenu ) { - mpMenu->checkEntry( 0, (nProjection == 0) && bEnabled ); - mpMenu->checkEntry( 1, (nProjection == 1 ) && bEnabled ); - mpMenu->enableEntry( 0, bEnabled ); - mpMenu->enableEntry( 1, bEnabled ); + /*mpMenu->*/checkEntry( 0, (nProjection == 0) && bEnabled ); + /*mpMenu->*/checkEntry( 1, (nProjection == 1 ) && bEnabled ); + /*mpMenu->*/enableEntry( 0, bEnabled ); + /*mpMenu->*/enableEntry( 1, bEnabled ); } } @@ -303,7 +287,7 @@ IMPL_LINK( ExtrusionDirectionWindow, SelectHdl, void *, pControl ) } else { - int nProjection = mpMenu->getSelectedEntryId(); + int nProjection = /*mpMenu->*/getSelectedEntryId(); if( (nProjection >= 0) && (nProjection < 2 ) ) { SfxInt32Item aItem( SID_EXTRUSION_PROJECTION, nProjection ); @@ -400,7 +384,7 @@ SfxPopupWindowType ExtrusionDirectionControl::GetPopupWindowType() const SfxPopupWindow* ExtrusionDirectionControl::CreatePopupWindow() { ExtrusionDirectionWindow* pWin = new ExtrusionDirectionWindow( GetId(), m_xFrame, &GetToolBox() ); - pWin->StartPopupMode( &GetToolBox(), TRUE ); + pWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_REMOVEDECORATION ); pWin->StartSelection(); SetPopupWindow( pWin ); return pWin; @@ -448,36 +432,10 @@ double ExtrusionDepthDialog::getDepth() const SFX_IMPL_TOOLBOX_CONTROL( ExtrusionDepthControl, SfxBoolItem ); -ExtrusionDepthWindow::ExtrusionDepthWindow( - USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ) : - SfxPopupWindow( nId, - rFrame, - SVX_RES( RID_SVXFLOAT_EXTRUSION_DEPTH )), - maImgDepth0( SVX_RES( IMG_DEPTH_0 ) ), - maImgDepth1( SVX_RES( IMG_DEPTH_1 ) ), - maImgDepth2( SVX_RES( IMG_DEPTH_2 ) ), - maImgDepth3( SVX_RES( IMG_DEPTH_3 ) ), - maImgDepth4( SVX_RES( IMG_DEPTH_4 ) ), - maImgDepthInfinity( SVX_RES( IMG_DEPTH_INFINITY ) ), - maImgDepth0h( SVX_RES( IMG_DEPTH_0_H ) ), - maImgDepth1h( SVX_RES( IMG_DEPTH_1_H ) ), - maImgDepth2h( SVX_RES( IMG_DEPTH_2_H ) ), - maImgDepth3h( SVX_RES( IMG_DEPTH_3_H ) ), - maImgDepth4h( SVX_RES( IMG_DEPTH_4_H ) ), - maImgDepthInfinityh( SVX_RES( IMG_DEPTH_INFINITY_H ) ), - mxFrame( rFrame ), - mbPopupMode ( true ), - mfDepth( -1.0 ), - mbEnabled( false ) -{ - implInit(); -} - ExtrusionDepthWindow::ExtrusionDepthWindow( USHORT nId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) : - SfxPopupWindow( nId, + ToolbarMenu( nId, rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_DEPTH )), @@ -508,48 +466,43 @@ void ExtrusionDepthWindow::implInit() // mpDepthForewarder = new SfxStatusForwarder( SID_EXTRUSION_DEPTH, *this ); // mpMetricForewarder = new SfxStatusForwarder( SID_ATTR_METRIC, *this ); - mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); - mpMenu->SetHelpId( HID_MENU_EXTRUSION_DEPTH ); +// mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); + /*mpMenu->*/SetHelpId( HID_MENU_EXTRUSION_DEPTH ); - mpMenu->SetSelectHdl( LINK( this, ExtrusionDepthWindow, SelectHdl ) ); + /*mpMenu->*/SetSelectHdl( LINK( this, ExtrusionDepthWindow, SelectHdl ) ); bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); String aEmpty; - mpMenu->appendEntry( 0, aEmpty, bHighContrast ? maImgDepth0h : maImgDepth0 ); - mpMenu->appendEntry( 1, aEmpty, bHighContrast ? maImgDepth1h : maImgDepth1 ); - mpMenu->appendEntry( 2, aEmpty, bHighContrast ? maImgDepth2h : maImgDepth2 ); - mpMenu->appendEntry( 3, aEmpty, bHighContrast ? maImgDepth3h : maImgDepth3 ); - mpMenu->appendEntry( 4, aEmpty, bHighContrast ? maImgDepth4h : maImgDepth4 ); - mpMenu->appendEntry( 5, String( SVX_RES( STR_INFINITY ) ), bHighContrast ? maImgDepthInfinityh : maImgDepthInfinity ); - mpMenu->appendEntry( 6, String( SVX_RES( STR_CUSTOM ) ) ); + /*mpMenu->*/appendEntry( 0, aEmpty, bHighContrast ? maImgDepth0h : maImgDepth0 ); + /*mpMenu->*/appendEntry( 1, aEmpty, bHighContrast ? maImgDepth1h : maImgDepth1 ); + /*mpMenu->*/appendEntry( 2, aEmpty, bHighContrast ? maImgDepth2h : maImgDepth2 ); + /*mpMenu->*/appendEntry( 3, aEmpty, bHighContrast ? maImgDepth3h : maImgDepth3 ); + /*mpMenu->*/appendEntry( 4, aEmpty, bHighContrast ? maImgDepth4h : maImgDepth4 ); + /*mpMenu->*/appendEntry( 5, String( SVX_RES( STR_INFINITY ) ), bHighContrast ? maImgDepthInfinityh : maImgDepthInfinity ); + /*mpMenu->*/appendEntry( 6, String( SVX_RES( STR_CUSTOM ) ) ); - SetOutputSizePixel( mpMenu->getMenuSize() ); - mpMenu->SetOutputSizePixel( GetOutputSizePixel() ); + SetOutputSizePixel( /*mpMenu->*/getMenuSize() ); +// mpMenu->SetOutputSizePixel( GetOutputSizePixel() ); - mpMenu->Show(); +// mpMenu->Show(); FreeResource(); AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepth" ))); AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:MetricUnit" ))); -// rBindings.Update( SID_ATTR_METRIC ); -// rBindings.Update( SID_EXTRUSION_DEPTH ); } SfxPopupWindow* ExtrusionDepthWindow::Clone() const { - return new ExtrusionDepthWindow( GetId(), mxFrame ); + return new ExtrusionDepthWindow( GetId(), mxFrame, 0 ); } // ----------------------------------------------------------------------- ExtrusionDepthWindow::~ExtrusionDepthWindow() { -// delete mpDepthForewarder; -// delete mpMetricForewarder; - - delete mpMenu; +// delete mpMenu; } // ----------------------------------------------------------------------- @@ -561,20 +514,20 @@ void ExtrusionDepthWindow::implSetDepth( double fDepth, bool bEnabled ) { mbEnabled = bEnabled; mfDepth = fDepth; - if( mpMenu ) +// if( mpMenu ) { int i; for( i = 0; i < 7; i++ ) { if( i == 5 ) { - mpMenu->checkEntry( i, (fDepth >= 338666) && bEnabled ); + /*mpMenu->*/checkEntry( i, (fDepth >= 338666) && bEnabled ); } else if( i != 6 ) { - mpMenu->checkEntry( i, (fDepth == (IsMetric( meUnit ) ? aDepthListMM[i] : aDepthListInch[i]) && bEnabled ) ); + /*mpMenu->*/checkEntry( i, (fDepth == (IsMetric( meUnit ) ? aDepthListMM[i] : aDepthListInch[i]) && bEnabled ) ); } - mpMenu->enableEntry( i, bEnabled ); + /*mpMenu->*/enableEntry( i, bEnabled ); } } } @@ -589,7 +542,7 @@ void ExtrusionDepthWindow::implFillStrings( FieldUnit eUnit ) for( int i = 0; i < 5; i++ ) { String aStr( SVX_RES( nResource + i ) ); - mpMenu->setEntryText( i, aStr ); + /*mpMenu->*/setEntryText( i, aStr ); }; } @@ -636,12 +589,12 @@ void ExtrusionDepthWindow::DataChanged( const DataChangedEvent& rDCEvt ) { bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - mpMenu->setEntryImage( 0, bHighContrast ? maImgDepth0h : maImgDepth0 ); - mpMenu->setEntryImage( 1, bHighContrast ? maImgDepth1h : maImgDepth1 ); - mpMenu->setEntryImage( 2, bHighContrast ? maImgDepth2h : maImgDepth2 ); - mpMenu->setEntryImage( 3, bHighContrast ? maImgDepth3h : maImgDepth3 ); - mpMenu->setEntryImage( 4, bHighContrast ? maImgDepth4h : maImgDepth4 ); - mpMenu->setEntryImage( 5, bHighContrast ? maImgDepthInfinityh : maImgDepthInfinity ); + /*mpMenu->*/setEntryImage( 0, bHighContrast ? maImgDepth0h : maImgDepth0 ); + /*mpMenu->*/setEntryImage( 1, bHighContrast ? maImgDepth1h : maImgDepth1 ); + /*mpMenu->*/setEntryImage( 2, bHighContrast ? maImgDepth2h : maImgDepth2 ); + /*mpMenu->*/setEntryImage( 3, bHighContrast ? maImgDepth3h : maImgDepth3 ); + /*mpMenu->*/setEntryImage( 4, bHighContrast ? maImgDepth4h : maImgDepth4 ); + /*mpMenu->*/setEntryImage( 5, bHighContrast ? maImgDepthInfinityh : maImgDepthInfinity ); } } @@ -652,7 +605,7 @@ IMPL_LINK( ExtrusionDepthWindow, SelectHdl, void *, EMPTYARG ) { // SfxDispatcher* pDisp = GetBindings().GetDispatcher(); - int nSelected = mpMenu->getSelectedEntryId(); + int nSelected = /*mpMenu->*/getSelectedEntryId(); if( nSelected != -1 ) { if( nSelected == 6 ) @@ -746,8 +699,8 @@ void ExtrusionDepthWindow::GetFocus (void) SfxPopupWindow::GetFocus(); // Grab the focus to the line ends value set so that it can be controlled // with the keyboard. - if( mpMenu ) - mpMenu->GrabFocus(); + //if( mpMenu ) + /*mpMenu->*/GrabFocus(); } // ======================================================================== @@ -777,7 +730,7 @@ SfxPopupWindowType ExtrusionDepthControl::GetPopupWindowType() const SfxPopupWindow* ExtrusionDepthControl::CreatePopupWindow() { ExtrusionDepthWindow* pWin = new ExtrusionDepthWindow( GetId(), m_xFrame, &GetToolBox() ); - pWin->StartPopupMode( &GetToolBox(), TRUE ); + pWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_REMOVEDECORATION ); pWin->StartSelection(); SetPopupWindow( pWin ); return pWin; @@ -798,35 +751,13 @@ void ExtrusionDepthControl::StateChanged( USHORT, SfxItemState eState, const Sfx SFX_IMPL_TOOLBOX_CONTROL( ExtrusionLightingControl, SfxBoolItem ); -ExtrusionLightingWindow::ExtrusionLightingWindow( - USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ) : - SfxPopupWindow( nId, - rFrame, - SVX_RES( RID_SVXFLOAT_EXTRUSION_LIGHTING ) ), - maImgBright( SVX_RES( IMG_LIGHTING_BRIGHT ) ), - maImgNormal( SVX_RES( IMG_LIGHTING_NORMAL ) ), - maImgDim( SVX_RES( IMG_LIGHTING_DIM ) ), - maImgBrighth( SVX_RES( IMG_LIGHTING_BRIGHT_H ) ), - maImgNormalh( SVX_RES( IMG_LIGHTING_NORMAL_H ) ), - maImgDimh( SVX_RES( IMG_LIGHTING_DIM_H ) ), - mxFrame( rFrame ), - mbPopupMode( true ), - mnLevel( 0 ), - mbLevelEnabled( false ), - mnDirection( FROM_FRONT ), - mbDirectionEnabled( false ) -{ - implInit(); -} - -// ----------------------------------------------------------------------- +// ------------------------------------------------------------------------- ExtrusionLightingWindow::ExtrusionLightingWindow( USHORT nId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) : - SfxPopupWindow( nId, + ToolbarMenu( nId, rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_LIGHTING ) ), @@ -866,14 +797,11 @@ void ExtrusionLightingWindow::implInit() maImgLightingPreviewh[i] = Image( SVX_RES( IMG_LIGHT_PREVIEW_H + i ) ); } -// mpLightingDirectionForewarder = new SfxStatusForwarder( SID_EXTRUSION_LIGHTING_DIRECTION, *this ); -// mpLightingIntensityForewarder = new SfxStatusForwarder( SID_EXTRUSION_LIGHTING_INTENSITY, *this ); - - mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); - mpMenu->SetHelpId( HID_MENU_EXTRUSION_LIGHTING ); - mpMenu->SetSelectHdl( LINK( this, ExtrusionLightingWindow, SelectHdl ) ); +// mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); + /*mpMenu->*/SetHelpId( HID_MENU_EXTRUSION_LIGHTING ); + /*mpMenu->*/SetSelectHdl( LINK( this, ExtrusionLightingWindow, SelectHdl ) ); - mpLightingSet = new ValueSet( mpMenu, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT ); + mpLightingSet = new ValueSet( /*mpMenu->*/this, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT ); mpLightingSet->SetHelpId( HID_VALUESET_EXTRUSION_LIGHTING ); mpLightingSet->SetSelectHdl( LINK( this, ExtrusionLightingWindow, SelectHdl ) ); @@ -895,16 +823,16 @@ void ExtrusionLightingWindow::implInit() } mpLightingSet->SetOutputSizePixel( Size( 72, 72 ) ); - mpMenu->appendEntry( 3, mpLightingSet ); - mpMenu->appendSeparator(); - mpMenu->appendEntry( 0, String( SVX_RES( STR_BRIGHT ) ), bHighContrast ? maImgBrighth : maImgBright ); - mpMenu->appendEntry( 1, String( SVX_RES( STR_NORMAL ) ), bHighContrast ? maImgNormalh : maImgNormal ); - mpMenu->appendEntry( 2, String( SVX_RES( STR_DIM ) ), bHighContrast ? maImgDimh : maImgDim ); + /*mpMenu->*/appendEntry( 3, mpLightingSet ); + /*mpMenu->*/appendSeparator(); + /*mpMenu->*/appendEntry( 0, String( SVX_RES( STR_BRIGHT ) ), bHighContrast ? maImgBrighth : maImgBright ); + /*mpMenu->*/appendEntry( 1, String( SVX_RES( STR_NORMAL ) ), bHighContrast ? maImgNormalh : maImgNormal ); + /*mpMenu->*/appendEntry( 2, String( SVX_RES( STR_DIM ) ), bHighContrast ? maImgDimh : maImgDim ); - SetOutputSizePixel( mpMenu->getMenuSize() ); - mpMenu->SetOutputSizePixel( GetOutputSizePixel() ); + SetOutputSizePixel( /*mpMenu->*/getMenuSize() ); + //mpMenu->SetOutputSizePixel( GetOutputSizePixel() ); - mpMenu->Show(); + //mpMenu->Show(); FreeResource(); @@ -916,14 +844,14 @@ void ExtrusionLightingWindow::implInit() SfxPopupWindow* ExtrusionLightingWindow::Clone() const { - return new ExtrusionLightingWindow( GetId(), mxFrame ); + return new ExtrusionLightingWindow( GetId(), mxFrame, 0 ); } // ----------------------------------------------------------------------- ExtrusionLightingWindow::~ExtrusionLightingWindow() { - delete mpMenu; + //delete mpMenu; } // ----------------------------------------------------------------------- @@ -935,8 +863,8 @@ void ExtrusionLightingWindow::implSetIntensity( int nLevel, bool bEnabled ) int i = 0; for( i = 0; i < 3; i++ ) { - mpMenu->checkEntry( i, (i == nLevel) && bEnabled ); - mpMenu->enableEntry( i, bEnabled ); + /*mpMenu->*/checkEntry( i, (i == nLevel) && bEnabled ); + /*mpMenu->*/enableEntry( i, bEnabled ); } } @@ -972,7 +900,7 @@ void ExtrusionLightingWindow::implSetDirection( int nDirection, bool bEnabled ) } } - mpMenu->enableEntry( 3, bEnabled ); + /*mpMenu->*/enableEntry( 3, bEnabled ); } // ----------------------------------------------------------------------- @@ -1023,9 +951,9 @@ void ExtrusionLightingWindow::DataChanged( const DataChangedEvent& rDCEvt ) bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); implSetDirection( mnDirection, mbDirectionEnabled ); - mpMenu->setEntryImage( 0, bHighContrast ? maImgBrighth : maImgBright ); - mpMenu->setEntryImage( 1, bHighContrast ? maImgNormalh : maImgNormal ); - mpMenu->setEntryImage( 2, bHighContrast ? maImgDimh : maImgDim ); + /*mpMenu->*/setEntryImage( 0, bHighContrast ? maImgBrighth : maImgBright ); + /*mpMenu->*/setEntryImage( 1, bHighContrast ? maImgNormalh : maImgNormal ); + /*mpMenu->*/setEntryImage( 2, bHighContrast ? maImgDimh : maImgDim ); } } @@ -1038,9 +966,9 @@ IMPL_LINK( ExtrusionLightingWindow, SelectHdl, void *, pControl ) // SfxDispatcher* pDisp = GetBindings().GetDispatcher(); - if( pControl == mpMenu ) + if( pControl == /*mpMenu->*/this ) { - int nLevel = mpMenu->getSelectedEntryId(); + int nLevel = /*mpMenu->*/getSelectedEntryId(); if( nLevel >= 0 ) { if( nLevel != 3 ) @@ -1128,8 +1056,8 @@ void ExtrusionLightingWindow::GetFocus (void) SfxPopupWindow::GetFocus(); // Grab the focus to the line ends value set so that it can be controlled // with the keyboard. - if( mpMenu ) - mpMenu->GrabFocus(); +// if( mpMenu ) + /*mpMenu->*/GrabFocus(); } // ======================================================================== @@ -1158,7 +1086,7 @@ SfxPopupWindowType ExtrusionLightingControl::GetPopupWindowType() const SfxPopupWindow* ExtrusionLightingControl::CreatePopupWindow() { ExtrusionLightingWindow* pWin = new ExtrusionLightingWindow( GetId(), m_xFrame, &GetToolBox() ); - pWin->StartPopupMode( &GetToolBox(), TRUE ); + pWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_REMOVEDECORATION ); pWin->StartSelection(); SetPopupWindow( pWin ); return pWin; @@ -1179,33 +1107,12 @@ void ExtrusionLightingControl::StateChanged( USHORT, SfxItemState eState, const SFX_IMPL_TOOLBOX_CONTROL( ExtrusionSurfaceControl, SfxBoolItem ); -ExtrusionSurfaceWindow::ExtrusionSurfaceWindow( - USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ) : - - SfxPopupWindow( nId, - rFrame, - SVX_RES( RID_SVXFLOAT_EXTRUSION_SURFACE )), - maImgSurface1( SVX_RES( IMG_WIRE_FRAME ) ), - maImgSurface2( SVX_RES( IMG_MATTE ) ), - maImgSurface3( SVX_RES( IMG_PLASTIC ) ), - maImgSurface4( SVX_RES( IMG_METAL ) ), - maImgSurface1h( SVX_RES( IMG_WIRE_FRAME_H ) ), - maImgSurface2h( SVX_RES( IMG_MATTE_H ) ), - maImgSurface3h( SVX_RES( IMG_PLASTIC_H ) ), - maImgSurface4h( SVX_RES( IMG_METAL_H ) ), - mxFrame( rFrame ), - mbPopupMode( true ) -{ - implInit(); -} - ExtrusionSurfaceWindow::ExtrusionSurfaceWindow( USHORT nId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) : - SfxPopupWindow( nId, + ToolbarMenu( nId, rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_SURFACE )), @@ -1231,54 +1138,50 @@ void ExtrusionSurfaceWindow::implInit() bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); -// mpSurfaceForewarder = new SfxStatusForwarder( SID_EXTRUSION_SURFACE, *this ); - - mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); - mpMenu->SetHelpId( HID_MENU_EXTRUSION_SURFACE ); - mpMenu->SetSelectHdl( LINK( this, ExtrusionSurfaceWindow, SelectHdl ) ); +// mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); + /*mpMenu->*/SetHelpId( HID_MENU_EXTRUSION_SURFACE ); + /*mpMenu->*/SetSelectHdl( LINK( this, ExtrusionSurfaceWindow, SelectHdl ) ); - mpMenu->appendEntry( 0, String( SVX_RES( STR_WIREFRAME ) ), bHighContrast ? maImgSurface1h : maImgSurface1 ); - mpMenu->appendEntry( 1, String( SVX_RES( STR_MATTE ) ), bHighContrast ? maImgSurface2h : maImgSurface2 ); - mpMenu->appendEntry( 2, String( SVX_RES( STR_PLASTIC ) ), bHighContrast ? maImgSurface3h : maImgSurface3 ); - mpMenu->appendEntry( 3, String( SVX_RES( STR_METAL ) ), bHighContrast ? maImgSurface4h : maImgSurface4 ); + /*mpMenu->*/appendEntry( 0, String( SVX_RES( STR_WIREFRAME ) ), bHighContrast ? maImgSurface1h : maImgSurface1 ); + /*mpMenu->*/appendEntry( 1, String( SVX_RES( STR_MATTE ) ), bHighContrast ? maImgSurface2h : maImgSurface2 ); + /*mpMenu->*/appendEntry( 2, String( SVX_RES( STR_PLASTIC ) ), bHighContrast ? maImgSurface3h : maImgSurface3 ); + /*mpMenu->*/appendEntry( 3, String( SVX_RES( STR_METAL ) ), bHighContrast ? maImgSurface4h : maImgSurface4 ); - SetOutputSizePixel( mpMenu->getMenuSize() ); - mpMenu->SetOutputSizePixel( GetOutputSizePixel() ); + SetOutputSizePixel( /*mpMenu->*/getMenuSize() ); + //mpMenu->SetOutputSizePixel( GetOutputSizePixel() ); - mpMenu->Show(); + //mpMenu->Show(); FreeResource(); AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionSurface" ))); -// rBindings.Update( SID_EXTRUSION_SURFACE ); } // ----------------------------------------------------------------------- SfxPopupWindow* ExtrusionSurfaceWindow::Clone() const { - return new ExtrusionSurfaceWindow( GetId(), mxFrame ); + return new ExtrusionSurfaceWindow( GetId(), mxFrame, 0 ); } // ----------------------------------------------------------------------- ExtrusionSurfaceWindow::~ExtrusionSurfaceWindow() { -// delete mpSurfaceForewarder; - delete mpMenu; +// delete mpMenu; } // ----------------------------------------------------------------------- void ExtrusionSurfaceWindow::implSetSurface( int nSurface, bool bEnabled ) { - if( mpMenu ) +// if( mpMenu ) { int i; for( i = 0; i < 4; i++ ) { - mpMenu->checkEntry( i, (i == nSurface) && bEnabled ); - mpMenu->enableEntry( i, bEnabled ); + /*mpMenu->*/checkEntry( i, (i == nSurface) && bEnabled ); + /*mpMenu->*/enableEntry( i, bEnabled ); } } } @@ -1316,10 +1219,10 @@ void ExtrusionSurfaceWindow::DataChanged( const DataChangedEvent& rDCEvt ) { bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - mpMenu->appendEntry( 0, String( SVX_RES( STR_WIREFRAME ) ), bHighContrast ? maImgSurface1h : maImgSurface1 ); - mpMenu->appendEntry( 1, String( SVX_RES( STR_MATTE ) ), bHighContrast ? maImgSurface2h : maImgSurface2 ); - mpMenu->appendEntry( 2, String( SVX_RES( STR_PLASTIC ) ), bHighContrast ? maImgSurface3h : maImgSurface3 ); - mpMenu->appendEntry( 3, String( SVX_RES( STR_METAL ) ), bHighContrast ? maImgSurface4h : maImgSurface4 ); + /*mpMenu->*/appendEntry( 0, String( SVX_RES( STR_WIREFRAME ) ), bHighContrast ? maImgSurface1h : maImgSurface1 ); + /*mpMenu->*/appendEntry( 1, String( SVX_RES( STR_MATTE ) ), bHighContrast ? maImgSurface2h : maImgSurface2 ); + /*mpMenu->*/appendEntry( 2, String( SVX_RES( STR_PLASTIC ) ), bHighContrast ? maImgSurface3h : maImgSurface3 ); + /*mpMenu->*/appendEntry( 3, String( SVX_RES( STR_METAL ) ), bHighContrast ? maImgSurface4h : maImgSurface4 ); } } @@ -1332,7 +1235,7 @@ IMPL_LINK( ExtrusionSurfaceWindow, SelectHdl, void *, EMPTYARG ) // SfxDispatcher* pDisp = GetBindings().GetDispatcher(); - sal_Int32 nSurface = mpMenu->getSelectedEntryId(); + sal_Int32 nSurface = /*mpMenu->*/getSelectedEntryId(); if( nSurface >= 0 ) { SfxInt32Item aItem( SID_EXTRUSION_SURFACE, nSurface ); @@ -1388,8 +1291,8 @@ void ExtrusionSurfaceWindow::GetFocus (void) SfxPopupWindow::GetFocus(); // Grab the focus to the line ends value set so that it can be controlled // with the keyboard. - if( mpMenu ) - mpMenu->GrabFocus(); + //if( mpMenu ) + /*mpMenu->*/GrabFocus(); } // ======================================================================== @@ -1419,7 +1322,7 @@ SfxPopupWindowType ExtrusionSurfaceControl::GetPopupWindowType() const SfxPopupWindow* ExtrusionSurfaceControl::CreatePopupWindow() { ExtrusionSurfaceWindow* pWin = new ExtrusionSurfaceWindow( GetId(), m_xFrame, &GetToolBox() ); - pWin->StartPopupMode( &GetToolBox(), TRUE ); + pWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_REMOVEDECORATION ); pWin->StartSelection(); SetPopupWindow( pWin ); return pWin; diff --git a/svx/source/tbxctrls/extrusioncontrols.src b/svx/source/tbxctrls/extrusioncontrols.src index 09e5f88d4171..0a5e2a4b11a2 100644 --- a/svx/source/tbxctrls/extrusioncontrols.src +++ b/svx/source/tbxctrls/extrusioncontrols.src @@ -35,7 +35,7 @@ FloatingWindow RID_SVXFLOAT_EXTRUSION_DIRECTION { - Border = TRUE ; + Border = FALSE ; Hide = TRUE ; SVLook = TRUE ; Sizeable = FALSE ; @@ -205,7 +205,7 @@ FloatingWindow RID_SVXFLOAT_EXTRUSION_DIRECTION FloatingWindow RID_SVXFLOAT_EXTRUSION_DEPTH { - Border = TRUE ; + Border = FALSE ; Hide = TRUE ; SVLook = TRUE ; Sizeable = FALSE ; @@ -294,7 +294,7 @@ FloatingWindow RID_SVXFLOAT_EXTRUSION_DEPTH FloatingWindow RID_SVXFLOAT_EXTRUSION_LIGHTING { - Border = TRUE ; + Border = FALSE ; Hide = TRUE ; SVLook = TRUE ; Sizeable = FALSE ; @@ -610,7 +610,7 @@ FloatingWindow RID_SVXFLOAT_EXTRUSION_LIGHTING FloatingWindow RID_SVXFLOAT_EXTRUSION_SURFACE { - Border = TRUE ; + Border = FALSE ; Hide = TRUE ; SVLook = TRUE ; Sizeable = FALSE ; @@ -706,7 +706,7 @@ ModalDialog RID_SVX_MDLG_EXTRUSION_DEPTH MetricField MTR_DEPTH { //HelpId = HID_SD_CTL_FAVORITES ; - Border = TRUE ; + Border = FALSE ; Pos = MAP_APPFONT ( 3 , 14 ) ; Size = MAP_APPFONT ( WIDTH - 50 - 12, 12 ) ; TabStop = TRUE ; diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx index 9c4a4af5c836..ed25ad41d43e 100644 --- a/svx/source/tbxctrls/fontworkgallery.cxx +++ b/svx/source/tbxctrls/fontworkgallery.cxx @@ -344,37 +344,13 @@ void FontWorkShapeTypeControl::Select( BOOL ) SFX_IMPL_TOOLBOX_CONTROL( FontWorkAlignmentControl, SfxBoolItem ); -FontWorkAlignmentWindow::FontWorkAlignmentWindow( - USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ) : - - SfxPopupWindow( nId, - rFrame, - SVX_RES( RID_SVXFLOAT_FONTWORK_ALIGNMENT )), - maImgAlgin1( SVX_RES( IMG_FONTWORK_ALIGN_LEFT_16 ) ), - maImgAlgin2( SVX_RES( IMG_FONTWORK_ALIGN_CENTER_16 ) ), - maImgAlgin3( SVX_RES( IMG_FONTWORK_ALIGN_RIGHT_16 ) ), - maImgAlgin4( SVX_RES( IMG_FONTWORK_ALIGN_WORD_16 ) ), - maImgAlgin5( SVX_RES( IMG_FONTWORK_ALIGN_STRETCH_16 ) ), - maImgAlgin1h( SVX_RES( IMG_FONTWORK_ALIGN_LEFT_16_H ) ), - maImgAlgin2h( SVX_RES( IMG_FONTWORK_ALIGN_CENTER_16_H ) ), - maImgAlgin3h( SVX_RES( IMG_FONTWORK_ALIGN_RIGHT_16_H ) ), - maImgAlgin4h( SVX_RES( IMG_FONTWORK_ALIGN_WORD_16_H ) ), - maImgAlgin5h( SVX_RES( IMG_FONTWORK_ALIGN_STRETCH_16_H ) ), - mxFrame( rFrame ), - mbPopupMode( true ) -{ - SetHelpId( HID_WIN_FONTWORK_ALIGN ); - implInit(); -} - FontWorkAlignmentWindow::FontWorkAlignmentWindow( USHORT nId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* /*pParentWindow*/ ) : + Window* pParentWindow ) : - SfxPopupWindow( nId, - rFrame, + ToolbarMenu( nId, + rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_FONTWORK_ALIGNMENT )), maImgAlgin1( SVX_RES( IMG_FONTWORK_ALIGN_LEFT_16 ) ), maImgAlgin2( SVX_RES( IMG_FONTWORK_ALIGN_CENTER_16 ) ), @@ -399,20 +375,16 @@ void FontWorkAlignmentWindow::implInit() bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); - mpMenu->SetHelpId( HID_POPUP_FONTWORK_ALIGN ); - mpMenu->SetSelectHdl( LINK( this, FontWorkAlignmentWindow, SelectHdl ) ); - - mpMenu->appendEntry( 0, String( SVX_RES( STR_ALIGN_LEFT ) ), bHighContrast ? maImgAlgin1h : maImgAlgin1 ); - mpMenu->appendEntry( 1, String( SVX_RES( STR_ALIGN_CENTER ) ), bHighContrast ? maImgAlgin2h : maImgAlgin2 ); - mpMenu->appendEntry( 2, String( SVX_RES( STR_ALIGN_RIGHT ) ), bHighContrast ? maImgAlgin3h : maImgAlgin3 ); - mpMenu->appendEntry( 3, String( SVX_RES( STR_ALIGN_WORD ) ), bHighContrast ? maImgAlgin4h : maImgAlgin4 ); - mpMenu->appendEntry( 4, String( SVX_RES( STR_ALIGN_STRETCH ) ), bHighContrast ? maImgAlgin5h : maImgAlgin5 ); + SetHelpId( HID_POPUP_FONTWORK_ALIGN ); + SetSelectHdl( LINK( this, FontWorkAlignmentWindow, SelectHdl ) ); - SetOutputSizePixel( mpMenu->getMenuSize() ); - mpMenu->SetOutputSizePixel( GetOutputSizePixel() ); + appendEntry( 0, String( SVX_RES( STR_ALIGN_LEFT ) ), bHighContrast ? maImgAlgin1h : maImgAlgin1 ); + appendEntry( 1, String( SVX_RES( STR_ALIGN_CENTER ) ), bHighContrast ? maImgAlgin2h : maImgAlgin2 ); + appendEntry( 2, String( SVX_RES( STR_ALIGN_RIGHT ) ), bHighContrast ? maImgAlgin3h : maImgAlgin3 ); + appendEntry( 3, String( SVX_RES( STR_ALIGN_WORD ) ), bHighContrast ? maImgAlgin4h : maImgAlgin4 ); + appendEntry( 4, String( SVX_RES( STR_ALIGN_STRETCH ) ), bHighContrast ? maImgAlgin5h : maImgAlgin5 ); - mpMenu->Show(); + SetOutputSizePixel( getMenuSize() ); FreeResource(); @@ -421,28 +393,24 @@ void FontWorkAlignmentWindow::implInit() SfxPopupWindow* FontWorkAlignmentWindow::Clone() const { - return new FontWorkAlignmentWindow( GetId(), mxFrame ); + return new FontWorkAlignmentWindow( GetId(), mxFrame, 0 ); } // ----------------------------------------------------------------------- FontWorkAlignmentWindow::~FontWorkAlignmentWindow() { - delete mpMenu; } // ----------------------------------------------------------------------- void FontWorkAlignmentWindow::implSetAlignment( int nSurface, bool bEnabled ) { - if( mpMenu ) + int i; + for( i = 0; i < 5; i++ ) { - int i; - for( i = 0; i < 5; i++ ) - { - mpMenu->checkEntry( i, (i == nSurface) && bEnabled ); - mpMenu->enableEntry( i, bEnabled ); - } + checkEntry( i, (i == nSurface) && bEnabled ); + enableEntry( i, bEnabled ); } } @@ -479,11 +447,11 @@ void FontWorkAlignmentWindow::DataChanged( const DataChangedEvent& rDCEvt ) { bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - mpMenu->appendEntry( 0, String( SVX_RES( STR_ALIGN_LEFT ) ), bHighContrast ? maImgAlgin1h : maImgAlgin1 ); - mpMenu->appendEntry( 1, String( SVX_RES( STR_ALIGN_CENTER ) ), bHighContrast ? maImgAlgin2h : maImgAlgin2 ); - mpMenu->appendEntry( 2, String( SVX_RES( STR_ALIGN_RIGHT ) ), bHighContrast ? maImgAlgin3h : maImgAlgin3 ); - mpMenu->appendEntry( 3, String( SVX_RES( STR_ALIGN_WORD ) ), bHighContrast ? maImgAlgin4h : maImgAlgin4 ); - mpMenu->appendEntry( 4, String( SVX_RES( STR_ALIGN_STRETCH ) ), bHighContrast ? maImgAlgin5h : maImgAlgin5 ); + appendEntry( 0, String( SVX_RES( STR_ALIGN_LEFT ) ), bHighContrast ? maImgAlgin1h : maImgAlgin1 ); + appendEntry( 1, String( SVX_RES( STR_ALIGN_CENTER ) ), bHighContrast ? maImgAlgin2h : maImgAlgin2 ); + appendEntry( 2, String( SVX_RES( STR_ALIGN_RIGHT ) ), bHighContrast ? maImgAlgin3h : maImgAlgin3 ); + appendEntry( 3, String( SVX_RES( STR_ALIGN_WORD ) ), bHighContrast ? maImgAlgin4h : maImgAlgin4 ); + appendEntry( 4, String( SVX_RES( STR_ALIGN_STRETCH ) ), bHighContrast ? maImgAlgin5h : maImgAlgin5 ); } } @@ -496,7 +464,7 @@ IMPL_LINK( FontWorkAlignmentWindow, SelectHdl, void *, EMPTYARG ) // SfxDispatcher* pDisp = GetBindings().GetDispatcher(); - sal_Int32 nAlignment = mpMenu->getSelectedEntryId(); + sal_Int32 nAlignment = getSelectedEntryId(); if( nAlignment >= 0 ) { SfxInt32Item aItem( SID_FONTWORK_ALIGNMENT, nAlignment ); @@ -551,8 +519,7 @@ void FontWorkAlignmentWindow::GetFocus (void) SfxPopupWindow::GetFocus(); // Grab the focus to the line ends value set so that it can be controlled // with the keyboard. - if( mpMenu ) - mpMenu->GrabFocus(); + GrabFocus(); } // ======================================================================== @@ -582,7 +549,7 @@ SfxPopupWindowType FontWorkAlignmentControl::GetPopupWindowType() const SfxPopupWindow* FontWorkAlignmentControl::CreatePopupWindow() { FontWorkAlignmentWindow* pWin = new FontWorkAlignmentWindow( GetId(), m_xFrame, &GetToolBox() ); - pWin->StartPopupMode( &GetToolBox(), TRUE ); + pWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_REMOVEDECORATION ); pWin->StartSelection(); SetPopupWindow( pWin ); return pWin; @@ -603,33 +570,18 @@ void FontWorkAlignmentControl::StateChanged( USHORT /*nSID*/, SfxItemState eStat SFX_IMPL_TOOLBOX_CONTROL( FontWorkCharacterSpacingControl, SfxBoolItem ); -FontWorkCharacterSpacingWindow::FontWorkCharacterSpacingWindow( - USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ) : - - SfxPopupWindow( nId, - rFrame, - SVX_RES( RID_SVXFLOAT_FONTWORK_CHARSPACING )), - mxFrame( rFrame ), - mbPopupMode( true ) -{ - SetHelpId( HID_WIN_FONTWORK_CHARSPACE ); - implInit(); -} - FontWorkCharacterSpacingWindow::FontWorkCharacterSpacingWindow( USHORT nId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) : - SfxPopupWindow( nId, + ToolbarMenu( nId, rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_FONTWORK_CHARSPACING )), mxFrame( rFrame ), mbPopupMode( true ) { - SetHelpId( HID_WIN_FONTWORK_CHARSPACE ); implInit(); } @@ -639,23 +591,19 @@ void FontWorkCharacterSpacingWindow::implInit() // bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); - mpMenu->SetHelpId( HID_POPUP_FONTWORK_CHARSPACE ); - mpMenu->SetSelectHdl( LINK( this, FontWorkCharacterSpacingWindow, SelectHdl ) ); - - mpMenu->appendEntry( 0, String( SVX_RES( STR_CHARS_SPACING_VERY_TIGHT ) ), MIB_RADIOCHECK ); - mpMenu->appendEntry( 1, String( SVX_RES( STR_CHARS_SPACING_TIGHT ) ), MIB_RADIOCHECK ); - mpMenu->appendEntry( 2, String( SVX_RES( STR_CHARS_SPACING_NORMAL ) ), MIB_RADIOCHECK ); - mpMenu->appendEntry( 3, String( SVX_RES( STR_CHARS_SPACING_LOOSE ) ), MIB_RADIOCHECK ); - mpMenu->appendEntry( 4, String( SVX_RES( STR_CHARS_SPACING_VERY_LOOSE ) ), MIB_RADIOCHECK ); - mpMenu->appendEntry( 5, String( SVX_RES( STR_CHARS_SPACING_CUSTOM ) ), MIB_RADIOCHECK ); - mpMenu->appendSeparator(); - mpMenu->appendEntry( 6, String( SVX_RES( STR_CHARS_SPACING_KERN_PAIRS ) ), MIB_CHECKABLE ); + SetHelpId( HID_POPUP_FONTWORK_CHARSPACE ); + SetSelectHdl( LINK( this, FontWorkCharacterSpacingWindow, SelectHdl ) ); - SetOutputSizePixel( mpMenu->getMenuSize() ); - mpMenu->SetOutputSizePixel( GetOutputSizePixel() ); + appendEntry( 0, String( SVX_RES( STR_CHARS_SPACING_VERY_TIGHT ) ), MIB_RADIOCHECK ); + appendEntry( 1, String( SVX_RES( STR_CHARS_SPACING_TIGHT ) ), MIB_RADIOCHECK ); + appendEntry( 2, String( SVX_RES( STR_CHARS_SPACING_NORMAL ) ), MIB_RADIOCHECK ); + appendEntry( 3, String( SVX_RES( STR_CHARS_SPACING_LOOSE ) ), MIB_RADIOCHECK ); + appendEntry( 4, String( SVX_RES( STR_CHARS_SPACING_VERY_LOOSE ) ), MIB_RADIOCHECK ); + appendEntry( 5, String( SVX_RES( STR_CHARS_SPACING_CUSTOM ) ), MIB_RADIOCHECK ); + appendSeparator(); + appendEntry( 6, String( SVX_RES( STR_CHARS_SPACING_KERN_PAIRS ) ), MIB_CHECKABLE ); - mpMenu->Show(); + SetOutputSizePixel( getMenuSize() ); FreeResource(); @@ -664,52 +612,45 @@ void FontWorkCharacterSpacingWindow::implInit() SfxPopupWindow* FontWorkCharacterSpacingWindow::Clone() const { - return new FontWorkCharacterSpacingWindow( GetId(), mxFrame ); + return new FontWorkCharacterSpacingWindow( GetId(), mxFrame, 0 ); } // ----------------------------------------------------------------------- FontWorkCharacterSpacingWindow::~FontWorkCharacterSpacingWindow() { - delete mpMenu; } // ----------------------------------------------------------------------- void FontWorkCharacterSpacingWindow::implSetCharacterSpacing( sal_Int32 nCharacterSpacing, bool bEnabled ) { - if( mpMenu ) + sal_Int32 i; + for ( i = 0; i < 6; i++ ) { - sal_Int32 i; - for ( i = 0; i < 6; i++ ) - { - mpMenu->checkEntry( i, sal_False ); - mpMenu->enableEntry( i, bEnabled ); - } - if ( nCharacterSpacing != -1 ) + checkEntry( i, sal_False ); + enableEntry( i, bEnabled ); + } + if ( nCharacterSpacing != -1 ) + { + sal_Int32 nEntry; + switch( nCharacterSpacing ) { - sal_Int32 nEntry; - switch( nCharacterSpacing ) - { - case 80 : nEntry = 0; break; - case 90 : nEntry = 1; break; - case 100 : nEntry = 2; break; - case 120 : nEntry = 3; break; - case 150 : nEntry = 4; break; - default : nEntry = 5; break; - } - mpMenu->checkEntry( nEntry, bEnabled ); + case 80 : nEntry = 0; break; + case 90 : nEntry = 1; break; + case 100 : nEntry = 2; break; + case 120 : nEntry = 3; break; + case 150 : nEntry = 4; break; + default : nEntry = 5; break; } + checkEntry( nEntry, bEnabled ); } } void FontWorkCharacterSpacingWindow::implSetKernCharacterPairs( sal_Bool, bool bEnabled ) { - if( mpMenu ) - { - mpMenu->enableEntry( 6, bEnabled ); - mpMenu->checkEntry( 6, bEnabled ); - } + enableEntry( 6, bEnabled ); + checkEntry( 6, bEnabled ); } // ----------------------------------------------------------------------- @@ -756,14 +697,14 @@ void FontWorkCharacterSpacingWindow::DataChanged( const DataChangedEvent& rDCEvt { // bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - mpMenu->appendEntry( 0, String( SVX_RES( STR_CHARS_SPACING_VERY_TIGHT ) ), MIB_CHECKABLE ); - mpMenu->appendEntry( 1, String( SVX_RES( STR_CHARS_SPACING_TIGHT ) ), MIB_CHECKABLE ); - mpMenu->appendEntry( 2, String( SVX_RES( STR_CHARS_SPACING_NORMAL ) ), MIB_CHECKABLE ); - mpMenu->appendEntry( 3, String( SVX_RES( STR_CHARS_SPACING_LOOSE ) ), MIB_CHECKABLE ); - mpMenu->appendEntry( 4, String( SVX_RES( STR_CHARS_SPACING_VERY_LOOSE ) ), MIB_CHECKABLE ); - mpMenu->appendEntry( 5, String( SVX_RES( STR_CHARS_SPACING_CUSTOM ) ), MIB_CHECKABLE ); - mpMenu->appendSeparator(); - mpMenu->appendEntry( 6, String( SVX_RES( STR_CHARS_SPACING_KERN_PAIRS ) ), MIB_CHECKABLE ); + appendEntry( 0, String( SVX_RES( STR_CHARS_SPACING_VERY_TIGHT ) ), MIB_CHECKABLE ); + appendEntry( 1, String( SVX_RES( STR_CHARS_SPACING_TIGHT ) ), MIB_CHECKABLE ); + appendEntry( 2, String( SVX_RES( STR_CHARS_SPACING_NORMAL ) ), MIB_CHECKABLE ); + appendEntry( 3, String( SVX_RES( STR_CHARS_SPACING_LOOSE ) ), MIB_CHECKABLE ); + appendEntry( 4, String( SVX_RES( STR_CHARS_SPACING_VERY_LOOSE ) ), MIB_CHECKABLE ); + appendEntry( 5, String( SVX_RES( STR_CHARS_SPACING_CUSTOM ) ), MIB_CHECKABLE ); + appendSeparator(); + appendEntry( 6, String( SVX_RES( STR_CHARS_SPACING_KERN_PAIRS ) ), MIB_CHECKABLE ); } } @@ -774,7 +715,7 @@ IMPL_LINK( FontWorkCharacterSpacingWindow, SelectHdl, void *, EMPTYARG ) if ( IsInPopupMode() ) EndPopupMode(); - sal_Int32 nSelection = mpMenu->getSelectedEntryId(); + sal_Int32 nSelection = getSelectedEntryId(); sal_Int32 nCharacterSpacing; switch( nSelection ) { @@ -872,8 +813,7 @@ void FontWorkCharacterSpacingWindow::GetFocus (void) SfxPopupWindow::GetFocus(); // Grab the focus to the line ends value set so that it can be controlled // with the keyboard. - if( mpMenu ) - mpMenu->GrabFocus(); + GrabFocus(); } // ======================================================================== @@ -903,7 +843,7 @@ SfxPopupWindowType FontWorkCharacterSpacingControl::GetPopupWindowType() const SfxPopupWindow* FontWorkCharacterSpacingControl::CreatePopupWindow() { FontWorkCharacterSpacingWindow* pWin = new FontWorkCharacterSpacingWindow( GetId(), m_xFrame, &GetToolBox() ); - pWin->StartPopupMode( &GetToolBox(), TRUE ); + pWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_REMOVEDECORATION ); pWin->StartSelection(); SetPopupWindow( pWin ); return pWin; diff --git a/svx/source/tbxctrls/fontworkgallery.src b/svx/source/tbxctrls/fontworkgallery.src index 78f100e6ddaf..d21bb3fdac0e 100644 --- a/svx/source/tbxctrls/fontworkgallery.src +++ b/svx/source/tbxctrls/fontworkgallery.src @@ -58,7 +58,7 @@ ModalDialog RID_SVX_MDLG_FONTWORK_GALLERY Control CTL_FAVORITES { HelpId = HID_CTL_FONTWORK_FAVORITES ; - Border = TRUE ; + Border = FALSE ; Pos = MAP_APPFONT ( 3 , 14 ) ; Size = MAP_APPFONT ( WIDTH - 6, HEIGHT - RSC_CD_PUSHBUTTON_HEIGHT - @@ -97,7 +97,7 @@ ModalDialog RID_SVX_MDLG_FONTWORK_GALLERY FloatingWindow RID_SVXFLOAT_FONTWORK_ALIGNMENT { - Border = TRUE ; + Border = FALSE ; Hide = TRUE ; SVLook = TRUE ; Sizeable = FALSE ; @@ -232,7 +232,7 @@ FloatingWindow RID_SVXFLOAT_FONTWORK_ALIGNMENT FloatingWindow RID_SVXFLOAT_FONTWORK_CHARSPACING { - Border = TRUE ; + Border = FALSE ; Hide = TRUE ; SVLook = TRUE ; Sizeable = FALSE ; @@ -309,7 +309,7 @@ ModalDialog RID_SVX_MDLG_FONTWORK_CHARSPACING }; MetricField MF_VALUE { - Border = TRUE ; + Border = FALSE ; Pos = MAP_APPFONT ( 6 , 17 ) ; Size = MAP_APPFONT ( 32 , 12 ) ; TabStop = TRUE ; diff --git a/svx/source/tbxctrls/toolbarmenu.cxx b/svx/source/tbxctrls/toolbarmenu.cxx index 24f93ea13a6e..382ab0581919 100644 --- a/svx/source/tbxctrls/toolbarmenu.cxx +++ b/svx/source/tbxctrls/toolbarmenu.cxx @@ -39,8 +39,10 @@ #include "svx/toolbarmenu.hxx" const int EXTRAITEMHEIGHT = 4; -const int SEPARATOR_HEIGHT = 8; +const int SEPARATOR_HEIGHT = 6; const int TITLE_ID = -1; +const int BORDER_X = 3; +const int BORDER_Y = 3; class ToolbarMenuEntry { @@ -141,9 +143,30 @@ ToolbarMenuEntry::~ToolbarMenuEntry() delete mpControl; } -ToolbarMenu::ToolbarMenu( Window* pParent, WinBits nStyle ) : - Control( pParent, nStyle ) +ToolbarMenu::ToolbarMenu( USHORT nId, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, + Window* pParentWindow, + WinBits nBits ) +: SfxPopupWindow(nId, rFrame, pParentWindow, nBits) { + implInit(); +} + +ToolbarMenu::ToolbarMenu( USHORT nId, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, + Window* pParentWindow, + const ResId& rResId ) +: SfxPopupWindow(nId, rFrame, pParentWindow, rResId) +{ + implInit(); +} + +void ToolbarMenu::implInit() +{ +// SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_NOBORDER | WB_SYSTEMWINDOW ); + +// EnableChildTransparentMode(); + mnCheckPos = 0; mnImagePos = 0; mnTextPos = 0; @@ -267,8 +290,10 @@ void ToolbarMenu::initWindow() { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + SetControlBackground( GetSettings().GetStyleSettings().GetFaceGradientColor() ); + SetPointFont( rStyleSettings.GetMenuFont() ); - SetBackground( Wallpaper( rStyleSettings.GetMenuColor() ) ); + SetBackground( Wallpaper( GetControlBackground() ) ); SetTextColor( rStyleSettings.GetMenuTextColor() ); SetTextFillColor(); SetLineColor(); @@ -339,8 +364,12 @@ Size ToolbarMenu::implCalcSize() int gfxExtra = Max( nExtra, 7L ); + if ( aMaxImgSz.Width() ) + mnTextPos += gfxExtra; + if ( bCheckable ) + mnTextPos += 16; + mnCheckPos = nExtra; -// mnImagePos = mnCheckPos + nFontHeight/2 + gfxExtra; mnImagePos = nExtra; mnTextPos = mnImagePos + aMaxImgSz.Width(); @@ -353,31 +382,18 @@ Size ToolbarMenu::implCalcSize() // Text: if( pEntry->mbHasText ) { - long nTextWidth = GetCtrlTextWidth( pEntry->maText ); - if ( nTextWidth > nMaxTextWidth ) - nMaxTextWidth = nTextWidth; - long nTextHeight = GetTextHeight(); + long nTextWidth = GetCtrlTextWidth( pEntry->maText ) + mnTextPos; + nMaxTextWidth = Max( nTextWidth, nMaxTextWidth ); - pEntry->maSize.Height() = Max( Max( nTextHeight, pEntry->maSize.Height() ), nMinMenuItemHeight ); + pEntry->maSize.Height() = Max( Max( GetTextHeight(), pEntry->maSize.Height() ), nMinMenuItemHeight ); } - // Control: - if( pEntry->mpControl ) + else if( pEntry->mpControl ) { - long nTextWidth = pEntry->mbHasText ? GetCtrlTextWidth( pEntry->maText ) : -mnTextPos; - Size aControlSize( pEntry->mpControl->GetOutputSizePixel() ); - if( nTextWidth ) - nTextWidth += nExtra; - - nTextWidth += aControlSize.Width(); - - if ( nTextWidth > nMaxTextWidth ) - nMaxTextWidth = nTextWidth; - - if ( aControlSize.Height() > pEntry->maSize.Height() ) - pEntry->maSize.Height() = aControlSize.Height(); + nMaxTextWidth = Max( aControlSize.Width(), nMaxTextWidth ); + pEntry->maSize.Height() = Max( aControlSize.Height(), pEntry->maSize.Height() ); } pEntry->maSize.Height() += EXTRAITEMHEIGHT; @@ -390,17 +406,11 @@ Size ToolbarMenu::implCalcSize() } } - if ( aMaxImgSz.Width() ) - mnTextPos += gfxExtra; - if ( bCheckable ) - mnTextPos += 16; - - - aSz.Width() = mnTextPos + nMaxTextWidth; - aSz.Width() += 2*nExtra; + aSz.Width() = nMaxTextWidth + (BORDER_X<<1); + aSz.Height() += BORDER_Y<<1; // positionate controls - int nY = 0; + int nY = BORDER_Y; for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) { ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; @@ -410,7 +420,7 @@ Size ToolbarMenu::implCalcSize() if( pEntry->mpControl ) { Size aControlSize( pEntry->mpControl->GetOutputSizePixel() ); - Point aControlPos( pEntry->mbHasText ? mnTextPos : ( aSz.Width() - aControlSize.Width() ) / 2, nY); + Point aControlPos( (aSz.Width() - aControlSize.Width())>>1, nY); if( pEntry->mbHasText ) aControlPos.X() += GetCtrlTextWidth( pEntry->maText ) + 4*gfxExtra; @@ -436,7 +446,7 @@ void ToolbarMenu::GetFocus() implChangeHighlightEntry( 0 ); } */ - Control::GetFocus(); + SfxPopupWindow::GetFocus(); } void ToolbarMenu::LoseFocus() @@ -445,7 +455,7 @@ void ToolbarMenu::LoseFocus() { implChangeHighlightEntry( -1 ); } - Control::LoseFocus(); + SfxPopupWindow::LoseFocus(); } void ToolbarMenu::appendEntry( int nEntryId, const String& rStr, MenuItemBits nItemBits ) @@ -467,12 +477,12 @@ void ToolbarMenu::appendEntry( int nEntryId, Control* pControl, MenuItemBits nIt { appendEntry( new ToolbarMenuEntry( nEntryId, pControl, nItemBits ) ); } - +/* void ToolbarMenu::appendEntry( int nEntryId, const String& rStr, Control* pControl, MenuItemBits nItemBits ) { appendEntry( new ToolbarMenuEntry( nEntryId, rStr, pControl, nItemBits ) ); } - +*/ void ToolbarMenu::appendEntry( ToolbarMenuEntry* pEntry ) { maEntryVector.push_back( pEntry ); @@ -518,8 +528,8 @@ ToolbarMenuEntry* ToolbarMenu::implSearchEntry( int nEntryId ) const void ToolbarMenu::implHighlightEntry( int nHighlightEntry, bool bHighlight ) { Size aSz = GetOutputSizePixel(); - long nY = 0; - long nX = 0; + long nY = BORDER_Y; + long nX = BORDER_X; const int nEntryCount = maEntryVector.size(); int nEntry; @@ -530,34 +540,17 @@ void ToolbarMenu::implHighlightEntry( int nHighlightEntry, bool bHighlight ) { if(nEntry == nHighlightEntry) { -// bool bRestoreLineColor = false; - Color oldLineColor; -/* - if( bHighlight && ((p->mpControl == NULL) || (p->mbHasText)) ) - { - if( p->mbEnabled ) - { - SetFillColor( GetSettings().GetStyleSettings().GetMenuHighlightColor() ); - } - else - { - SetFillColor(); - oldLineColor = GetLineColor(); - SetLineColor( GetSettings().GetStyleSettings().GetMenuHighlightColor() ); - bRestoreLineColor = true; - } - } - else -*/ - SetFillColor( GetSettings().GetStyleSettings().GetMenuColor() ); + SetFillColor( GetSettings().GetStyleSettings().GetMenuColor() ); - Rectangle aRect( Point( nX, nY ), Size( aSz.Width(), p->maSize.Height() ) ); + Rectangle aRect( Point( nX, nY ), Size( aSz.Width()-(BORDER_X<<1), p->maSize.Height() ) ); +/* if( p->mnBits & MIB_POPUPSELECT ) { long nFontHeight = GetTextHeight(); aRect.Right() -= nFontHeight + nFontHeight/4; } DrawRect( aRect ); +*/ if( bHighlight && ((p->mpControl == NULL) || (p->mbHasText)) ) { @@ -570,10 +563,6 @@ void ToolbarMenu::implHighlightEntry( int nHighlightEntry, bool bHighlight ) implPaint( p, bHighlight ); -/* - if( bRestoreLineColor ) - SetLineColor( oldLineColor ); -*/ maHighlightHdl.Call( this ); break; } @@ -671,16 +660,20 @@ void ToolbarMenu::implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown ) void ToolbarMenu::implChangeHighlightEntry( int nEntry ) { +/* if( mnHighlightedEntry != -1 ) { implHighlightEntry( mnHighlightedEntry, false ); } - +*/ mnHighlightedEntry = nEntry; + Invalidate(); + /* if( mnHighlightedEntry != -1 ) { implHighlightEntry( mnHighlightedEntry, true ); } + */ } ToolbarMenuEntry* ToolbarMenu::implCursorUpDown( bool bUp, bool bHomeEnd ) @@ -860,6 +853,26 @@ void ToolbarMenu::KeyInput( const KeyEvent& rKEvent ) } } +void ToolbarMenu::implDrawBorder() +{ + SetFillColor(); + SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() ); + Point aPt; + Rectangle aRect( aPt, GetOutputSizePixel() ); + + Region oldClipRgn( GetClipRegion( ) ); + Region aClipRgn( aRect ); + Rectangle aItemClipRect( ImplGetItemEdgeClipRect() ); + if( !aItemClipRect.IsEmpty() ) + { + aItemClipRect.SetPos( AbsoluteScreenToOutputPixel( aItemClipRect.TopLeft() ) ); + aClipRgn.Exclude( aItemClipRect ); + SetClipRegion( aClipRgn ); + } + DrawRect( aRect ); + SetClipRegion( oldClipRgn ); +} + void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) { const long nFontHeight = GetTextHeight(); @@ -871,7 +884,7 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) const Size aOutSz( GetOutputSizePixel() ); // const long nMaxY = aOutSz.Height(); - Point aTopLeft, aTmpPos; + Point aTopLeft( BORDER_X, BORDER_Y ), aTmpPos; const int nEntryCount = maEntryVector.size(); int nEntry; @@ -922,6 +935,10 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) if( bTitle ) { Rectangle aRect( aTopLeft, Size( aOutSz.Width(), pEntry->maSize.Height() ) ); + aRect.nLeft += 2; + aRect.nTop += 2; + aRect.nRight -= 4; + aRect.nBottom -= 4; // fill the background Color aColor (rSettings.GetDialogColor()); @@ -951,7 +968,7 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) // Text: if( pEntry->mbHasText ) { - aTmpPos.X() = aPos.X() + mnTextPos; + aTmpPos.X() = aPos.X() + (bTitle ? 4 : mnTextPos); aTmpPos.Y() = aPos.Y(); aTmpPos.Y() += nTextOffsetY; USHORT nStyle = nTextStyle|TEXT_DRAW_MNEMONIC; @@ -1007,6 +1024,7 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) void ToolbarMenu::Paint( const Rectangle& ) { + implDrawBorder(); implPaint(); if( mnHighlightedEntry != -1 ) @@ -1020,7 +1038,7 @@ void ToolbarMenu::RequestHelp( const HelpEvent& rHEvt ) void ToolbarMenu::StateChanged( StateChangedType nType ) { - Control::StateChanged( nType ); + SfxPopupWindow::StateChanged( nType ); if ( ( nType == STATE_CHANGE_CONTROLFOREGROUND ) || ( nType == STATE_CHANGE_CONTROLBACKGROUND ) ) { @@ -1031,7 +1049,7 @@ void ToolbarMenu::StateChanged( StateChangedType nType ) void ToolbarMenu::DataChanged( const DataChangedEvent& rDCEvt ) { - Control::DataChanged( rDCEvt ); + SfxPopupWindow::DataChanged( rDCEvt ); if ( (rDCEvt.GetType() == DATACHANGED_FONTS) || (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) || -- cgit From 53a0265c8721e910a07a6de0a46bb0ae7c181bb4 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Thu, 14 Jan 2010 16:13:13 +0100 Subject: #i107721# new thesaurus dialog --- svx/source/dialog/thesdlg.cxx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'svx') diff --git a/svx/source/dialog/thesdlg.cxx b/svx/source/dialog/thesdlg.cxx index ef4ddcbc47be..6212f2f7a1a3 100755 --- a/svx/source/dialog/thesdlg.cxx +++ b/svx/source/dialog/thesdlg.cxx @@ -155,8 +155,6 @@ void AlternativesString_Impl::Paint( class ThesaurusAlternativesCtrl_Impl : public SvxCheckListBox { - std::vector< SvLBoxEntry * > m_aEntries; - // disable copy c-tor and assignment operator ThesaurusAlternativesCtrl_Impl( const ThesaurusAlternativesCtrl_Impl & ); ThesaurusAlternativesCtrl_Impl & operator = ( const ThesaurusAlternativesCtrl_Impl & ); @@ -165,8 +163,12 @@ public: ThesaurusAlternativesCtrl_Impl( Window* pParent ); virtual ~ThesaurusAlternativesCtrl_Impl(); + + SvLBoxEntry * AddEntry( sal_Int32 nVal, const String &rText, bool bIsHeader ); void ClearUserData(); + + virtual void KeyInput( const KeyEvent& rKEvt ); }; @@ -210,10 +212,21 @@ SvLBoxEntry * ThesaurusAlternativesCtrl_Impl::AddEntry( sal_Int32 nVal, const St pEntry->SetUserData( pUserData ); GetModel()->Insert( pEntry ); - m_aEntries.push_back( pEntry ); return pEntry; } + +void ThesaurusAlternativesCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) +{ + const KeyCode& rKey = rKEvt.GetKeyCode(); + + if (rKey.GetCode() == KEY_RETURN) + GetParent()->KeyInput( rKEvt ); // parent will close dialog... + else if ( GetEntryCount() ) + SvxCheckListBox::KeyInput( rKEvt ); +} + + // struct SvxThesaurusDialog_Impl ---------------------------------------- struct SvxThesaurusDialog_Impl -- cgit From 68074bab39bb2324ce4a4db1aadc9e4c1d4b1d60 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Fri, 15 Jan 2010 16:04:24 +0100 Subject: #i107721# new thesaurus dialog --- svx/inc/svx/dialogs.hrc | 2 -- svx/inc/svx/thesdlg.hxx | 26 +++++++------- svx/source/dialog/thesdlg.cxx | 2 +- svx/source/dialog/thesdlg.src | 80 +++---------------------------------------- 4 files changed, 18 insertions(+), 92 deletions(-) mode change 100644 => 100755 svx/inc/svx/dialogs.hrc (limited to 'svx') diff --git a/svx/inc/svx/dialogs.hrc b/svx/inc/svx/dialogs.hrc old mode 100644 new mode 100755 index c7cddf48e27c..a6eb98144aaa --- a/svx/inc/svx/dialogs.hrc +++ b/svx/inc/svx/dialogs.hrc @@ -182,7 +182,6 @@ // ResId fuer die Linguistik-Dialoge #define RID_SVXDLG_HYPHENATE (RID_SVX_START + 30) #define RID_SVXDLG_THESAURUS (RID_SVX_START + 31) -#define RID_SVXDLG_THES_LANGUAGE (RID_SVX_START + 38) // ResIds fuer HM-QueryBoxen und Error-Strings #define RID_SVXQB_THESAURUS (RID_SVX_START + 33) @@ -190,7 +189,6 @@ #define RID_SVXQB_BODYTEXT (RID_SVX_START + 35) #define RID_SVXQB_SPECIAL (RID_SVX_START + 36) #define RID_SVXQB_SPECIAL_FORCED (RID_SVX_START + 37) -// + 38 ist vergeben, siehe RID_SVXDLG_THES_LANGUAGE #define RID_SVXQB_BW_CONTINUE (RID_SVX_START + 39) // ResId's fuer Dialoge aus StarDraw diff --git a/svx/inc/svx/thesdlg.hxx b/svx/inc/svx/thesdlg.hxx index 78b1d372dcc9..9ec4d21f7549 100755 --- a/svx/inc/svx/thesdlg.hxx +++ b/svx/inc/svx/thesdlg.hxx @@ -54,23 +54,12 @@ class SVX_DLLPUBLIC SvxThesaurusDialog : public SvxStandardDialog { boost::shared_ptr< SvxThesaurusDialog_Impl > m_pImpl; -public: - - SvxThesaurusDialog( Window* pParent, - ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XThesaurus > xThesaurus, - const String &rWord, sal_Int16 nLanguage ); - ~SvxThesaurusDialog(); - - String GetWord(); - sal_uInt16 GetLanguage() const; - - SVX_DLLPRIVATE virtual void Apply(); - #ifdef _SVX_THESDLG_CXX SVX_DLLPRIVATE bool UpdateAlternativesBox_Impl(); SVX_DLLPRIVATE void SetWindowTitle(sal_Int16 nLanguage); - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XMeaning > > SAL_CALL queryMeanings_Impl( ::rtl::OUString& rTerm, const ::com::sun::star::lang::Locale& rLocale, const ::com::sun::star::beans::PropertyValues& rProperties ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XMeaning > > SAL_CALL + queryMeanings_Impl( ::rtl::OUString& rTerm, const ::com::sun::star::lang::Locale& rLocale, const ::com::sun::star::beans::PropertyValues& rProperties ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); // Handler DECL_LINK( LanguageHdl_Impl, MenuButton * ); @@ -79,6 +68,17 @@ public: DECL_LINK( AlternativesSelectHdl_Impl, SvxCheckListBox * ); DECL_LINK( AlternativesDoubleClickHdl_Impl, SvxCheckListBox * ); #endif + + SVX_DLLPRIVATE virtual void Apply(); + +public: + SvxThesaurusDialog( Window* pParent, + ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XThesaurus > xThesaurus, + const String &rWord, sal_Int16 nLanguage ); + ~SvxThesaurusDialog(); + + String GetWord(); + sal_uInt16 GetLanguage() const; }; #endif diff --git a/svx/source/dialog/thesdlg.cxx b/svx/source/dialog/thesdlg.cxx index 6212f2f7a1a3..25dca8f3cc4a 100755 --- a/svx/source/dialog/thesdlg.cxx +++ b/svx/source/dialog/thesdlg.cxx @@ -220,7 +220,7 @@ void ThesaurusAlternativesCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) { const KeyCode& rKey = rKEvt.GetKeyCode(); - if (rKey.GetCode() == KEY_RETURN) + if (rKey.GetCode() == KEY_RETURN || rKey.GetCode() == KEY_ESCAPE) GetParent()->KeyInput( rKEvt ); // parent will close dialog... else if ( GetEntryCount() ) SvxCheckListBox::KeyInput( rKEvt ); diff --git a/svx/source/dialog/thesdlg.src b/svx/source/dialog/thesdlg.src index 21308f95ec4f..9af5fc0b49a5 100755 --- a/svx/source/dialog/thesdlg.src +++ b/svx/source/dialog/thesdlg.src @@ -80,15 +80,13 @@ ModalDialog RID_SVXDLG_THESAURUS Size = MAP_APPFONT ( 209 , 121 ) ; Border = TRUE; TabStop = TRUE ; -// ??? DialogControl = TRUE; -// ??? OutputSize = TRUE ; }; FixedText FT_REPL { Pos = MAP_APPFONT ( 5 , 173 ) ; Size = MAP_APPFONT ( 143 , 8 ) ; - Text [ en-US ] = "~Replace with" ; + Text [ en-US ] = "Replace ~with" ; LEFT = TRUE ; }; Edit ED_REPL @@ -108,7 +106,6 @@ ModalDialog RID_SVXDLG_THESAURUS { Pos = MAP_APPFONT ( 0 , 200 ) ; Size = MAP_APPFONT ( 220 , 8 ) ; -// Text [ en-US ] = "Variations" ; }; @@ -119,8 +116,9 @@ ModalDialog RID_SVXDLG_THESAURUS }; OkButton BTN_THES_OK { - Pos = MAP_APPFONT ( 88 , 210 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; + Pos = MAP_APPFONT ( 70 , 210 ) ; + Size = MAP_APPFONT ( 79 , 14 ) ; + Text [ en-US ] = "~Replace" ; DefButton = TRUE ; }; CancelButton BTN_THES_CANCEL @@ -134,74 +132,4 @@ ModalDialog RID_SVXDLG_THESAURUS Text [ en-US ] = "Word not found in thesaurus" ; }; }; - // RID_SVXDLG_THES_LANGUAGE ---------------------------------------------- -ModalDialog RID_SVXDLG_THES_LANGUAGE -{ - HelpId = HID_THES_LANGUAGE ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 170 , 86 ) ; - /* ### ACHTUNG: Neuer Text in Resource? Sprache auswählen : Sprache auswõhlen */ - /* ### ACHTUNG: Neuer Text in Resource? Sprache auswählen : Sprache auswõhlen */ - Text [ en-US ] = "Select Language" ; - Moveable = TRUE ; - ListBox LB_THES_LANGUAGE - { - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 90 , 60 ) ; - Sort = TRUE ; - }; - FixedLine FL_THES_LANGUAGE - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 102 , 8 ) ; - Text [ en-US ] = "Selection" ; - }; - OKButton BTN_LANG_OK - { - Pos = MAP_APPFONT ( 114 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton BTN_LANG_CANCEL - { - Pos = MAP_APPFONT ( 114 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton BTN_LANG_HELP - { - Pos = MAP_APPFONT ( 114 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; -}; - // ********************************************************************** EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit From 89c3e0a86b1143039adc34d979693bdcf675949b Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Fri, 15 Jan 2010 16:06:34 +0100 Subject: #i108358# new hyphenation dialog --- svx/source/dialog/hyphen.cxx | 349 +++++++++++++++++++++++++------------------ svx/source/dialog/hyphen.hrc | 3 +- svx/source/dialog/hyphen.hxx | 62 +++----- svx/source/dialog/hyphen.src | 87 +++++------ 4 files changed, 258 insertions(+), 243 deletions(-) mode change 100644 => 100755 svx/source/dialog/hyphen.cxx mode change 100644 => 100755 svx/source/dialog/hyphen.hrc mode change 100644 => 100755 svx/source/dialog/hyphen.hxx mode change 100644 => 100755 svx/source/dialog/hyphen.src (limited to 'svx') diff --git a/svx/source/dialog/hyphen.cxx b/svx/source/dialog/hyphen.cxx old mode 100644 new mode 100755 index 34c7a1cfa21b..0fedaf7f5cf8 --- a/svx/source/dialog/hyphen.cxx +++ b/svx/source/dialog/hyphen.cxx @@ -49,19 +49,9 @@ #include "dlgutil.hxx" #include #include -#ifndef _USR_USTRING_HXX -//#include -#endif using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::linguistic2; -#undef S2U -#undef U2S -//#define S2U(s) StringToOUString(s, CHARSET_SYSTEM) -//#define U2S(s) OUStringToString(s, CHARSET_SYSTEM) // define ---------------------------------------------------------------- @@ -108,57 +98,107 @@ void SvxHyphenEdit::KeyInput( const KeyEvent& rKEvt ) } } -// class SvxHyphenWordDialog --------------------------------------------- +// struct SvxHyphenWordDialog_Impl --------------------------------------------- -SvxHyphenWordDialog::SvxHyphenWordDialog( const String &rWord, LanguageType nLang, - Window* pParent, - Reference< XHyphenator > &xHyphen, - SvxSpellWrapper* pWrapper ) : - SfxModalDialog( pParent, SVX_RES( RID_SVXDLG_HYPHENATE ) ), - - aWordFT ( this, SVX_RES( FT_WORD ) ), - aWordEdit ( this, SVX_RES( ED_WORD ) ), - aLeftBtn ( this, SVX_RES( BTN_LEFT ) ), - aRightBtn ( this, SVX_RES( BTN_RIGHT ) ), - aOkBtn ( this, SVX_RES( BTN_HYPH_CUT ) ), - aCancelBtn ( this, SVX_RES( BTN_HYPH_CANCEL ) ), - aContBtn ( this, SVX_RES( BTN_HYPH_CONTINUE ) ), - aDelBtn ( this, SVX_RES( BTN_HYPH_DELETE ) ), - aHelpBtn ( this, SVX_RES( BTN_HYPH_HELP ) ), - aLabel ( GetText() ), - pHyphWrapper ( pWrapper ), - xHyphenator ( xHyphen ), - aActWord ( rWord ), - nActLanguage ( nLang ), +struct SvxHyphenWordDialog_Impl +{ + FixedText aWordFT; + SvxHyphenEdit aWordEdit; + ImageButton aLeftBtn; + ImageButton aRightBtn; + OKButton aOkBtn; + PushButton aContBtn; + PushButton aDelBtn; + FixedLine aFLBottom; + HelpButton aHelpBtn; + PushButton aHyphAll; + CancelButton aCancelBtn; + String aLabel; + SvxSpellWrapper* pHyphWrapper; + uno::Reference< linguistic2::XHyphenator > xHyphenator; + uno::Reference< linguistic2::XPossibleHyphens > xPossHyph; + String aActWord; // actual (to be displayed) word + LanguageType nActLanguage; // and language + sal_uInt16 nMaxHyphenationPos; // right most valid hyphenation pos + sal_uInt16 nHyphPos; + sal_uInt16 nOldPos; + sal_Bool bBusy; + + SvxHyphenWordDialog_Impl( Window* pParent ); + ~SvxHyphenWordDialog_Impl(); +}; + + +SvxHyphenWordDialog_Impl::SvxHyphenWordDialog_Impl( Window* pParent ) : + aWordFT ( pParent, SVX_RES( FT_WORD ) ), + aWordEdit ( pParent, SVX_RES( ED_WORD ) ), + aLeftBtn ( pParent, SVX_RES( BTN_LEFT ) ), + aRightBtn ( pParent, SVX_RES( BTN_RIGHT ) ), + aOkBtn ( pParent, SVX_RES( BTN_HYPH_CUT ) ), + aContBtn ( pParent, SVX_RES( BTN_HYPH_CONTINUE ) ), + aDelBtn ( pParent, SVX_RES( BTN_HYPH_DELETE ) ), + aFLBottom ( pParent, SVX_RES( FL_BOTTOM ) ), + aHelpBtn ( pParent, SVX_RES( BTN_HYPH_HELP ) ), + aHyphAll ( pParent, SVX_RES( BTN_HYPH_ALL ) ), + aCancelBtn ( pParent, SVX_RES( BTN_HYPH_CANCEL ) ), + aLabel ( ), + pHyphWrapper ( NULL ), + xHyphenator ( NULL ), + xPossHyph ( NULL ), + aActWord ( ), + nActLanguage ( LANGUAGE_NONE ), + nMaxHyphenationPos ( 0 ), nHyphPos ( 0 ), nOldPos ( 0 ), bBusy ( sal_False ) { - aContBtn.SetClickHdl( - LINK( this, SvxHyphenWordDialog, ContinueHdl_Impl ) ); - aOkBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, CutHdl_Impl ) ); - aDelBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, DeleteHdl_Impl ) ); - aCancelBtn.SetClickHdl( - LINK( this, SvxHyphenWordDialog, CancelHdl_Impl ) ); - aLeftBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, Left_Impl ) ); - aRightBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, Right_Impl ) ); - - aWordEdit.SetGetFocusHdl( - LINK( this, SvxHyphenWordDialog, GetFocusHdl_Impl ) ); - - Reference< XHyphenatedWord > xHyphWord( pWrapper ? - pWrapper->GetLast() : Reference< XInterface > () , UNO_QUERY ); +} + + +SvxHyphenWordDialog_Impl::~SvxHyphenWordDialog_Impl() +{ +} + +// class SvxHyphenWordDialog --------------------------------------------- + +SvxHyphenWordDialog::SvxHyphenWordDialog( + const String &rWord, LanguageType nLang, + Window* pParent, + uno::Reference< linguistic2::XHyphenator > &xHyphen, + SvxSpellWrapper* pWrapper ) : + + SfxModalDialog( pParent, SVX_RES( RID_SVXDLG_HYPHENATE ) ) +{ + m_pImpl = boost::shared_ptr< SvxHyphenWordDialog_Impl >(new SvxHyphenWordDialog_Impl( this )); + + FreeResource(); + + m_pImpl->aLabel = GetText(); + m_pImpl->pHyphWrapper = pWrapper; + m_pImpl->xHyphenator = xHyphen; + m_pImpl->aActWord = rWord; + m_pImpl->nActLanguage = nLang; + + m_pImpl->aLeftBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, Left_Impl ) ); + m_pImpl->aRightBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, Right_Impl ) ); + m_pImpl->aOkBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, CutHdl_Impl ) ); + m_pImpl->aContBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, ContinueHdl_Impl ) ); + m_pImpl->aDelBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, DeleteHdl_Impl ) ); + m_pImpl->aHyphAll.SetClickHdl( LINK( this, SvxHyphenWordDialog, HyphenateAllHdl_Impl ) ); + m_pImpl->aCancelBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog, CancelHdl_Impl ) ); + m_pImpl->aWordEdit.SetGetFocusHdl( LINK( this, SvxHyphenWordDialog, GetFocusHdl_Impl ) ); + + uno::Reference< linguistic2::XHyphenatedWord > xHyphWord( pWrapper ? + pWrapper->GetLast() : uno::Reference< uno::XInterface > () , uno::UNO_QUERY ); DBG_ASSERT(xHyphWord.is(), "missing hyphenated word"); - nMaxHyphenationPos = xHyphWord.is() ? xHyphWord->getHyphenationPos() : 0; + m_pImpl->nMaxHyphenationPos = xHyphWord.is() ? xHyphWord->getHyphenationPos() : 0; SetLabel_Impl( nLang ); InitControls_Impl(); - aWordEdit.GrabFocus(); - - FreeResource(); + m_pImpl->aWordEdit.GrabFocus(); // disable controls if service is not available - if (!xHyphenator.is()) + if (!m_pImpl->xHyphenator.is()) Enable( sal_False ); } @@ -166,25 +206,25 @@ SvxHyphenWordDialog::SvxHyphenWordDialog( const String &rWord, LanguageType nLan void SvxHyphenWordDialog::SelLeft() { - String aTxt( aWordEdit.GetText() ); + String aTxt( m_pImpl->aWordEdit.GetText() ); - for ( xub_StrLen i = nOldPos + 1; i-- > 0 ; ) + for ( xub_StrLen i = m_pImpl->nOldPos + 1; i-- > 0 ; ) { DBG_ASSERT(i <= aTxt.Len(), "index out of range"); if( aTxt.GetChar( i ) == sal_Unicode( SW_SOFT_HYPHEN ) ) { aTxt.SetChar( i, sal_Unicode( HYPHHERE ) ); - if ( nOldPos != 0 && nOldPos != aTxt.Len() ) - aTxt.SetChar( nOldPos, sal_Unicode( SW_SOFT_HYPHEN ) ); - nOldPos = i; - aWordEdit.SetText( aTxt ); - aWordEdit.GrabFocus(); - aWordEdit.SetSelection( Selection( i, i + 1 ) ); + if ( m_pImpl->nOldPos != 0 && m_pImpl->nOldPos != aTxt.Len() ) + aTxt.SetChar( m_pImpl->nOldPos, sal_Unicode( SW_SOFT_HYPHEN ) ); + m_pImpl->nOldPos = i; + m_pImpl->aWordEdit.SetText( aTxt ); + m_pImpl->aWordEdit.GrabFocus(); + m_pImpl->aWordEdit.SetSelection( Selection( i, i + 1 ) ); break; } } - nHyphPos = GetHyphIndex_Impl(); + m_pImpl->nHyphPos = GetHyphIndex_Impl(); EnableLRBtn_Impl(); } @@ -192,24 +232,24 @@ void SvxHyphenWordDialog::SelLeft() void SvxHyphenWordDialog::SelRight() { - String aTxt( aWordEdit.GetText() ); + String aTxt( m_pImpl->aWordEdit.GetText() ); - for ( xub_StrLen i = nOldPos + 1; i < aTxt.Len(); ++i ) + for ( xub_StrLen i = m_pImpl->nOldPos + 1; i < aTxt.Len(); ++i ) { if( aTxt.GetChar( i ) == sal_Unicode( SW_SOFT_HYPHEN ) ) { aTxt.SetChar( i, sal_Unicode( HYPHHERE ) ); - if ( nOldPos != 0 && nOldPos != aTxt.Len() ) - aTxt.SetChar( nOldPos, sal_Unicode( SW_SOFT_HYPHEN ) ); - nOldPos = i; - aWordEdit.SetText( aTxt ); - aWordEdit.GrabFocus(); - aWordEdit.SetSelection( Selection( i, i + 1 ) ); + if ( m_pImpl->nOldPos != 0 && m_pImpl->nOldPos != aTxt.Len() ) + aTxt.SetChar( m_pImpl->nOldPos, sal_Unicode( SW_SOFT_HYPHEN ) ); + m_pImpl->nOldPos = i; + m_pImpl->aWordEdit.SetText( aTxt ); + m_pImpl->aWordEdit.GrabFocus(); + m_pImpl->aWordEdit.SetSelection( Selection( i, i + 1 ) ); break; } } - nHyphPos = GetHyphIndex_Impl(); + m_pImpl->nHyphPos = GetHyphIndex_Impl(); EnableLRBtn_Impl(); } @@ -217,29 +257,29 @@ void SvxHyphenWordDialog::SelRight() void SvxHyphenWordDialog::EnableLRBtn_Impl() { - String aTxt( aWordEdit.GetText() ); + String aTxt( m_pImpl->aWordEdit.GetText() ); xub_StrLen nLen = aTxt.Len(); xub_StrLen i; - aRightBtn.Disable(); - for ( i = nOldPos + 2; i < nLen; ++i ) + m_pImpl->aRightBtn.Disable(); + for ( i = m_pImpl->nOldPos + 2; i < nLen; ++i ) { if ( aTxt.GetChar( i ) == sal_Unicode( SW_SOFT_HYPHEN ) ) { - aRightBtn.Enable(); + m_pImpl->aRightBtn.Enable(); break; } } - DBG_ASSERT(nOldPos < aTxt.Len(), "nOldPos out of range"); - if (nOldPos >= aTxt.Len()) - nOldPos = aTxt.Len() - 1; - aLeftBtn.Disable(); - for ( i = nOldPos; i-- > 0; ) + DBG_ASSERT(m_pImpl->nOldPos < aTxt.Len(), "m_pImpl->nOldPos out of range"); + if (m_pImpl->nOldPos >= aTxt.Len()) + m_pImpl->nOldPos = aTxt.Len() - 1; + m_pImpl->aLeftBtn.Disable(); + for ( i = m_pImpl->nOldPos; i-- > 0; ) { if ( aTxt.GetChar( i ) == sal_Unicode( SW_SOFT_HYPHEN ) ) { - aLeftBtn.Enable(); + m_pImpl->aLeftBtn.Enable(); break; } } @@ -251,7 +291,7 @@ void SvxHyphenWordDialog::EnableLRBtn_Impl() void SvxHyphenWordDialog::SetLabel_Impl( LanguageType nLang ) { String aLangStr( ::GetLanguageString( nLang ) ); - String aTmp( aLabel ); + String aTmp( m_pImpl->aLabel ); aTmp.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) ); aTmp.Append( aLangStr ); aTmp.Append( sal_Unicode( ')' ) ); @@ -261,7 +301,7 @@ void SvxHyphenWordDialog::SetLabel_Impl( LanguageType nLang ) // ----------------------------------------------------------------------- String SvxHyphenWordDialog::EraseUnusableHyphens_Impl( - Reference< XPossibleHyphens > &rxPossHyph, + uno::Reference< linguistic2::XPossibleHyphens > &rxPossHyph, sal_uInt16 _nMaxHyphenationPos ) { // returns a String showing only those hyphen positions which will result @@ -273,7 +313,7 @@ String SvxHyphenWordDialog::EraseUnusableHyphens_Impl( { aTxt = String( rxPossHyph->getPossibleHyphens() ); - Sequence< sal_Int16 > aHyphenationPositions( + uno::Sequence< sal_Int16 > aHyphenationPositions( rxPossHyph->getHyphenationPositions() ); sal_Int32 nLen = aHyphenationPositions.getLength(); const sal_Int16 *pHyphenationPos = aHyphenationPositions.getConstArray(); @@ -320,21 +360,21 @@ String SvxHyphenWordDialog::EraseUnusableHyphens_Impl( void SvxHyphenWordDialog::InitControls_Impl() { String aTxt; - xPossHyph = NULL; - if (xHyphenator.is()) + m_pImpl->xPossHyph = NULL; + if (m_pImpl->xHyphenator.is()) { - lang::Locale aLocale( SvxCreateLocale(nActLanguage) ); - xPossHyph = xHyphenator->createPossibleHyphens( aActWord, aLocale, - Sequence< PropertyValue >() ); - if (xPossHyph.is()) + lang::Locale aLocale( SvxCreateLocale(m_pImpl->nActLanguage) ); + m_pImpl->xPossHyph = m_pImpl->xHyphenator->createPossibleHyphens( m_pImpl->aActWord, aLocale, + uno::Sequence< beans::PropertyValue >() ); + if (m_pImpl->xPossHyph.is()) { - aTxt = EraseUnusableHyphens_Impl( xPossHyph, nMaxHyphenationPos ); + aTxt = EraseUnusableHyphens_Impl( m_pImpl->xPossHyph, m_pImpl->nMaxHyphenationPos ); } - SetLabel_Impl( nActLanguage ); + SetLabel_Impl( m_pImpl->nActLanguage ); } - aWordEdit.SetText( aTxt ); + m_pImpl->aWordEdit.SetText( aTxt ); - nOldPos = aTxt.Len(); + m_pImpl->nOldPos = aTxt.Len(); SelLeft(); EnableLRBtn_Impl(); } @@ -343,12 +383,11 @@ void SvxHyphenWordDialog::InitControls_Impl() void SvxHyphenWordDialog::ContinueHyph_Impl( sal_uInt16 nInsPos ) { - if ( nInsPos != CONTINUE_HYPH && xPossHyph.is()) + if ( nInsPos != CONTINUE_HYPH && m_pImpl->xPossHyph.is()) { if (nInsPos) { - //String aTmp( U2S( xPossHyph->getPossibleHyphens() ) ); - String aTmp( aWordEdit.GetText() ); + String aTmp( m_pImpl->aWordEdit.GetText() ); DBG_ASSERT(nInsPos <= aTmp.Len() - 2, "wrong hyphen position"); sal_uInt16 nIdxPos = 0; @@ -360,33 +399,33 @@ void SvxHyphenWordDialog::ContinueHyph_Impl( sal_uInt16 nInsPos ) nIdxPos++; } - Sequence< sal_Int16 > aSeq = xPossHyph->getHyphenationPositions(); + uno::Sequence< sal_Int16 > aSeq = m_pImpl->xPossHyph->getHyphenationPositions(); sal_Int32 nLen = aSeq.getLength(); DBG_ASSERT(nLen, "empty sequence"); DBG_ASSERT(nIdxPos < nLen, "index out of range"); if (nLen && nIdxPos < nLen) { nInsPos = aSeq.getConstArray()[ nIdxPos ]; - pHyphWrapper->InsertHyphen( nInsPos ); + m_pImpl->pHyphWrapper->InsertHyphen( nInsPos ); } } else { //! calling with 0 as argument will remove hyphens! - pHyphWrapper->InsertHyphen( nInsPos ); + m_pImpl->pHyphWrapper->InsertHyphen( nInsPos ); } } - if ( pHyphWrapper->FindSpellError() ) + if ( m_pImpl->pHyphWrapper->FindSpellError() ) { - Reference< XHyphenatedWord > xHyphWord( pHyphWrapper->GetLast(), UNO_QUERY ); + uno::Reference< linguistic2::XHyphenatedWord > xHyphWord( m_pImpl->pHyphWrapper->GetLast(), uno::UNO_QUERY ); // adapt actual word and language to new found hyphenation result if(xHyphWord.is()) { - aActWord = String( xHyphWord->getWord() ); - nActLanguage = SvxLocaleToLanguage( xHyphWord->getLocale() ); - nMaxHyphenationPos = xHyphWord->getHyphenationPos(); + m_pImpl->aActWord = String( xHyphWord->getWord() ); + m_pImpl->nActLanguage = SvxLocaleToLanguage( xHyphWord->getLocale() ); + m_pImpl->nMaxHyphenationPos = xHyphWord->getHyphenationPos(); InitControls_Impl(); } } @@ -399,7 +438,7 @@ void SvxHyphenWordDialog::ContinueHyph_Impl( sal_uInt16 nInsPos ) sal_uInt16 SvxHyphenWordDialog::GetHyphIndex_Impl() { sal_uInt16 nPos = 0; - String aTxt(aWordEdit.GetText()); + String aTxt(m_pImpl->aWordEdit.GetText()); for ( sal_uInt16 i=0 ; i < aTxt.Len(); ++i ) { @@ -416,107 +455,121 @@ sal_uInt16 SvxHyphenWordDialog::GetHyphIndex_Impl() // ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, CutHdl_Impl, Button *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog, CutHdl_Impl, Button *, EMPTYARG ) { - if( !bBusy ) + if( !m_pImpl->bBusy ) { - bBusy = sal_True; - ContinueHyph_Impl( nHyphPos ); - bBusy = sal_False; + m_pImpl->bBusy = sal_True; + ContinueHyph_Impl( m_pImpl->nHyphPos ); + m_pImpl->bBusy = sal_False; } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, CutHdl_Impl, Button *, EMPTYARG ) // ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, DeleteHdl_Impl, Button *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog, HyphenateAllHdl_Impl, Button *, EMPTYARG /*pButton*/ ) { - if( !bBusy ) + if( !m_pImpl->bBusy ) { - bBusy = sal_True; - ContinueHyph_Impl(); - bBusy = sal_False; + try + { + uno::Reference< beans::XPropertySet > xProp( SvxGetLinguPropertySet() ); + const rtl::OUString aName( rtl::OUString::createFromAscii( "IsHyphAuto" ) ); + uno::Any aAny; + + aAny <<= sal_True; + xProp->setPropertyValue( aName, aAny ); + + m_pImpl->bBusy = sal_True; + ContinueHyph_Impl( m_pImpl->nHyphPos ); + m_pImpl->bBusy = sal_False; + + aAny <<= sal_False; + xProp->setPropertyValue( aName, aAny ); + } + catch (uno::Exception &e) + { + (void) e; + DBG_ASSERT( 0, "Hyphenate All failed" ); + } } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, DeleteHdl_Impl, Button *, EMPTYARG ) // ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, ContinueHdl_Impl, Button *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog, DeleteHdl_Impl, Button *, EMPTYARG ) { - if( !bBusy ) + if( !m_pImpl->bBusy ) { - bBusy = sal_True; - ContinueHyph_Impl( CONTINUE_HYPH ); - bBusy = sal_False; + m_pImpl->bBusy = sal_True; + ContinueHyph_Impl(); + m_pImpl->bBusy = sal_False; } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, ContinueHdl_Impl, Button *, EMPTYARG ) // ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, CancelHdl_Impl, Button *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog, ContinueHdl_Impl, Button *, EMPTYARG ) { - if( !bBusy ) + if( !m_pImpl->bBusy ) { - bBusy = sal_True; - pHyphWrapper->SpellEnd(); - EndDialog( RET_CANCEL ); - bBusy = sal_False; + m_pImpl->bBusy = sal_True; + ContinueHyph_Impl( CONTINUE_HYPH ); + m_pImpl->bBusy = sal_False; } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, CancelHdl_Impl, Button *, EMPTYARG ) // ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, Left_Impl, Button *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog, CancelHdl_Impl, Button *, EMPTYARG ) { - if( !bBusy ) + if( !m_pImpl->bBusy ) { - bBusy = sal_True; - SelLeft(); - bBusy = sal_False; + m_pImpl->bBusy = sal_True; + m_pImpl->pHyphWrapper->SpellEnd(); + EndDialog( RET_CANCEL ); + m_pImpl->bBusy = sal_False; } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, Left_Impl, Button *, EMPTYARG ) // ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, Right_Impl, Button *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog, Left_Impl, Button *, EMPTYARG ) { - if( !bBusy ) + if( !m_pImpl->bBusy ) { - bBusy = sal_True; - SelRight(); - bBusy = sal_False; + m_pImpl->bBusy = sal_True; + SelLeft(); + m_pImpl->bBusy = sal_False; } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, Right_Impl, Button *, EMPTYARG ) // ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SvxHyphenWordDialog, GetFocusHdl_Impl, Edit *, EMPTYARG ) +IMPL_LINK( SvxHyphenWordDialog, Right_Impl, Button *, EMPTYARG ) { - aWordEdit.SetSelection( Selection( nOldPos, nOldPos + 1 ) ); + if( !m_pImpl->bBusy ) + { + m_pImpl->bBusy = sal_True; + SelRight(); + m_pImpl->bBusy = sal_False; + } return 0; } -IMPL_LINK_INLINE_END( SvxHyphenWordDialog, GetFocusHdl_Impl, Edit *, EMPTYARG ) // ----------------------------------------------------------------------- -IMPL_LINK( SvxHyphenWordDialog, LangError_Impl, void *, nLang ) +IMPL_LINK( SvxHyphenWordDialog, GetFocusHdl_Impl, Edit *, EMPTYARG ) { - // Status anzeigen - String aErr( ::GetLanguageString( (LanguageType)(sal_IntPtr)nLang ) ); - aErr += SVX_RESSTR( RID_SVXSTR_HMERR_CHECKINSTALL ); - InfoBox( this, aErr ).Execute(); + m_pImpl->aWordEdit.SetSelection( Selection( m_pImpl->nOldPos, m_pImpl->nOldPos + 1 ) ); return 0; } + diff --git a/svx/source/dialog/hyphen.hrc b/svx/source/dialog/hyphen.hrc old mode 100644 new mode 100755 index a87b7b6588b8..e60339b137e1 --- a/svx/source/dialog/hyphen.hrc +++ b/svx/source/dialog/hyphen.hrc @@ -36,13 +36,14 @@ #define BTN_LEFT 11 #define BTN_RIGHT 12 #define FT_WORD 13 +#define FL_BOTTOM 14 #define BTN_HYPH_CONTINUE 20 #define BTN_HYPH_DELETE 21 #define BTN_HYPH_CUT 22 #define BTN_HYPH_CANCEL 23 #define BTN_HYPH_HELP 24 - +#define BTN_HYPH_ALL 25 #endif diff --git a/svx/source/dialog/hyphen.hxx b/svx/source/dialog/hyphen.hxx old mode 100644 new mode 100755 index 5508183c2d3e..48fda9192a3b --- a/svx/source/dialog/hyphen.hxx +++ b/svx/source/dialog/hyphen.hxx @@ -32,6 +32,8 @@ // include --------------------------------------------------------------- +#include + #include #ifndef _SV_BUTTON_HXX #include @@ -62,63 +64,39 @@ protected: // class SvxHyphenWordDialog --------------------------------------------- +struct SvxHyphenWordDialog_Impl; + class SvxHyphenWordDialog : public SfxModalDialog { -public: - SvxHyphenWordDialog( const String &rWord, LanguageType nLang, - Window* pParent, - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XHyphenator > &xHyphen, - SvxSpellWrapper* pWrapper ); - - void SelLeft(); - void SelRight(); - -private: - FixedText aWordFT; - SvxHyphenEdit aWordEdit; - ImageButton aLeftBtn; - ImageButton aRightBtn; - OKButton aOkBtn; - CancelButton aCancelBtn; - PushButton aContBtn; - PushButton aDelBtn; - HelpButton aHelpBtn; - String aLabel; - SvxSpellWrapper* pHyphWrapper; - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XHyphenator > xHyphenator; - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XPossibleHyphens > xPossHyph; - String aActWord; // actual (to be displayed) word - LanguageType nActLanguage; // and language - sal_uInt16 nMaxHyphenationPos; // right most valid hyphenation pos - sal_uInt16 nHyphPos; - sal_uInt16 nOldPos; - sal_Bool bBusy; + boost::shared_ptr< SvxHyphenWordDialog_Impl > m_pImpl; #ifdef _SVX_HYPHEN_CXX void EnableLRBtn_Impl(); - //void EnableCutBtn_Impl(); void SetLabel_Impl( LanguageType nLang ); - String EraseUnusableHyphens_Impl( - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XPossibleHyphens > &rxPossHyph, - sal_uInt16 nMaxHyphenationPos ); + String EraseUnusableHyphens_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XPossibleHyphens > &rxPossHyph, sal_uInt16 nMaxHyphenationPos ); void InitControls_Impl(); void ContinueHyph_Impl( sal_uInt16 nInsPos = 0 ); - sal_uInt16 GetHyphIndex_Impl(); + sal_uInt16 GetHyphIndex_Impl(); + DECL_LINK( Left_Impl, Button* ); + DECL_LINK( Right_Impl, Button* ); DECL_LINK( CutHdl_Impl, Button* ); - DECL_LINK( DeleteHdl_Impl, Button* ); DECL_LINK( ContinueHdl_Impl, Button* ); + DECL_LINK( DeleteHdl_Impl, Button* ); + DECL_LINK( HyphenateAllHdl_Impl, Button* ); DECL_LINK( CancelHdl_Impl, Button* ); - DECL_LINK( Left_Impl, Button* ); - DECL_LINK( Right_Impl, Button* ); DECL_LINK( GetFocusHdl_Impl, Edit* ); - DECL_LINK( LangError_Impl, void* ); #endif + +public: + SvxHyphenWordDialog( const String &rWord, LanguageType nLang, + Window* pParent, + ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenator > &xHyphen, + SvxSpellWrapper* pWrapper ); + + void SelLeft(); + void SelRight(); }; diff --git a/svx/source/dialog/hyphen.src b/svx/source/dialog/hyphen.src old mode 100644 new mode 100755 index aa423028e6e2..fd3db6e41af4 --- a/svx/source/dialog/hyphen.src +++ b/svx/source/dialog/hyphen.src @@ -37,104 +37,87 @@ ModalDialog RID_SVXDLG_HYPHENATE { HelpId = HID_HYPHENATE ; - Size = MAP_APPFONT ( 188 , 100 ) ; + Size = MAP_APPFONT ( 200 , 111 ) ; OutputSize = TRUE ; SvLook = TRUE ; Text [ en-US ] = "Hyphenation" ; Moveable = TRUE ; + + FixedText FT_WORD + { + Pos = MAP_APPFONT ( 5 , 5 ) ; + Size = MAP_APPFONT ( 120 , 8 ) ; + Text [ en-US ] = "~Word" ; + }; Edit ED_WORD { BORDER = TRUE ; - Pos = MAP_APPFONT ( 6 , 17 ) ; - Size = MAP_APPFONT ( 120 , 12 ) ; + Pos = MAP_APPFONT ( 5 , 17 ) ; + Size = MAP_APPFONT ( 132 , 12 ) ; TABSTOP = TRUE ; LEFT = TRUE ; }; ImageButton BTN_LEFT { - Pos = MAP_APPFONT ( 6 , 33 ) ; + Pos = MAP_APPFONT ( 56 , 33 ) ; Size = MAP_APPFONT ( 14 , 14 ) ; TABSTOP = TRUE ; SYMBOL = IMAGEBUTTON_ARROW_LEFT ; }; ImageButton BTN_RIGHT { - Pos = MAP_APPFONT ( 22 , 33 ) ; + Pos = MAP_APPFONT ( 75 , 33 ) ; Size = MAP_APPFONT ( 14 , 14 ) ; TABSTOP = TRUE ; Symbol = IMAGEBUTTON_ARROW_RIGHT ; }; - FixedText FT_WORD + OKButton BTN_HYPH_CUT { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Text [ en-US ] = "~Word" ; + Pos = MAP_APPFONT ( 144 , 17 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "H~yphenate" ; + TABSTOP = TRUE ; + DEFBUTTON = TRUE ; }; PushButton BTN_HYPH_CONTINUE { - Pos = MAP_APPFONT ( 132 , 43 ) ; + Pos = MAP_APPFONT ( 144 , 35 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Next" ; + Text [ en-US ] = "~Skip" ; TABSTOP = TRUE ; }; PushButton BTN_HYPH_DELETE { - Pos = MAP_APPFONT ( 132 , 60 ) ; + Pos = MAP_APPFONT ( 144 , 52 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; Text [ en-US ] = "~Remove" ; TABSTOP = TRUE ; }; - OKButton BTN_HYPH_CUT + FixedLine FL_BOTTOM + { + Pos = MAP_APPFONT ( 0 , 81 ) ; + Size = MAP_APPFONT ( 200 , 8 ) ; + }; + HelpButton BTN_HYPH_HELP { - Pos = MAP_APPFONT ( 132 , 6 ) ; + Pos = MAP_APPFONT ( 5 , 93 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Hyphenate" ; TABSTOP = TRUE ; - DEFBUTTON = TRUE ; }; - CancelButton BTN_HYPH_CANCEL + PushButton BTN_HYPH_ALL { - Pos = MAP_APPFONT ( 132 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + Pos = MAP_APPFONT ( 63 , 93 ) ; + Size = MAP_APPFONT ( 74 , 14 ) ; + Text [ en-US ] = "Hyphenate ~All" ; TABSTOP = TRUE ; }; - HelpButton BTN_HYPH_HELP + CancelButton BTN_HYPH_CANCEL { - Pos = MAP_APPFONT ( 132 , 80 ) ; + Pos = MAP_APPFONT ( 144 , 93 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Close"; TABSTOP = TRUE ; }; }; - // ******************************************************************* EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit From ae3991040d82bb3a9e504bb1307384004b355dfd Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Sun, 17 Jan 2010 18:25:26 +0100 Subject: allow vcl::DockManager popup with ToolbarMenu class for a nicer look --- svx/inc/extrusioncontrols.hxx | 48 ++-- svx/inc/fontworkgallery.hxx | 23 +- svx/inc/svx/toolbarmenu.hxx | 46 +++- svx/source/tbxctrls/extrusioncontrols.cxx | 377 ++++++++++-------------------- svx/source/tbxctrls/extrusioncontrols.src | 8 +- svx/source/tbxctrls/fontworkgallery.cxx | 172 +++++--------- svx/source/tbxctrls/fontworkgallery.src | 4 +- svx/source/tbxctrls/toolbarmenu.cxx | 121 ++++++++-- 8 files changed, 347 insertions(+), 452 deletions(-) (limited to 'svx') diff --git a/svx/inc/extrusioncontrols.hxx b/svx/inc/extrusioncontrols.hxx index cd4d298cbee6..cf0432d888f2 100644 --- a/svx/inc/extrusioncontrols.hxx +++ b/svx/inc/extrusioncontrols.hxx @@ -55,8 +55,6 @@ class ToolboxButtonColorUpdater; class ExtrusionDirectionWindow : public ToolbarMenu { - using FloatingWindow::StateChanged; - private: ValueSet* mpDirectionSet; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; @@ -72,7 +70,8 @@ private: Image maImgParallel; Image maImgParallelH; - bool mbPopupMode; + const rtl::OUString msExtrusionDirection; + const rtl::OUString msExtrusionProjection; DECL_LINK( SelectHdl, void * ); void FillValueSet(); @@ -82,9 +81,6 @@ private: void implInit(); protected: - virtual BOOL Close(); - virtual void PopupModeEnd(); - /** This function is called when the window gets the focus. It grabs the focus to the line ends value set so that it can be controlled with the keyboard. @@ -99,9 +95,7 @@ public: void StartSelection(); - virtual SfxPopupWindow* Clone() const; - - virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ); + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); virtual void DataChanged( const DataChangedEvent& rDCEvt ); }; @@ -124,8 +118,6 @@ public: class ExtrusionDepthWindow : public ToolbarMenu { - using FloatingWindow::StateChanged; - private: Image maImgDepth0; Image maImgDepth1; @@ -145,11 +137,13 @@ private: SfxStatusForwarder* mpMetricForewarder; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - bool mbPopupMode; FieldUnit meUnit; double mfDepth; bool mbEnabled; + const rtl::OUString msExtrusionDepth; + const rtl::OUString msMetricUnit; + DECL_LINK( SelectHdl, void * ); void implFillStrings( FieldUnit eUnit ); @@ -157,9 +151,6 @@ private: void implInit(); protected: - virtual BOOL Close(); - virtual void PopupModeEnd(); - /** This function is called when the window gets the focus. It grabs the focus to the line ends value set so that it can be controlled with the keyboard. @@ -174,9 +165,7 @@ public: void StartSelection(); - virtual SfxPopupWindow* Clone() const; - - virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ); + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); virtual void DataChanged( const DataChangedEvent& rDCEvt ); }; @@ -199,8 +188,6 @@ public: class ExtrusionLightingWindow : public ToolbarMenu { - using FloatingWindow::StateChanged; - private: ValueSet* mpLightingSet; @@ -223,12 +210,14 @@ private: SfxStatusForwarder* mpLightingIntensityForewarder; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - bool mbPopupMode; int mnLevel; bool mbLevelEnabled; int mnDirection; bool mbDirectionEnabled; + const rtl::OUString msExtrusionLightingDirection; + const rtl::OUString msExtrusionLightingIntensity; + void implSetIntensity( int nLevel, bool bEnabled ); void implSetDirection( int nDirection, bool bEnabled ); void implInit(); @@ -236,9 +225,6 @@ private: DECL_LINK( SelectHdl, void * ); protected: - virtual BOOL Close(); - virtual void PopupModeEnd(); - /** This function is called when the window gets the focus. It grabs the focus to the line ends value set so that it can be controlled with the keyboard. @@ -253,9 +239,7 @@ public: void StartSelection(); - virtual SfxPopupWindow* Clone() const; - - virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ); + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); virtual void DataChanged( const DataChangedEvent& rDCEvt ); }; @@ -278,7 +262,6 @@ public: class ExtrusionSurfaceWindow : public ToolbarMenu { - using FloatingWindow::StateChanged; private: Image maImgSurface1; Image maImgSurface2; @@ -292,7 +275,7 @@ private: SfxStatusForwarder* mpSurfaceForewarder; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - bool mbPopupMode; + const rtl::OUString msExtrusionSurface; DECL_LINK( SelectHdl, void * ); @@ -300,9 +283,6 @@ private: void implInit(); protected: - virtual BOOL Close(); - virtual void PopupModeEnd(); - /** This function is called when the window gets the focus. It grabs the focus to the line ends value set so that it can be controlled with the keyboard. @@ -317,9 +297,7 @@ public: void StartSelection(); - virtual SfxPopupWindow* Clone() const; - - virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ); + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); virtual void DataChanged( const DataChangedEvent& rDCEvt ); }; diff --git a/svx/inc/fontworkgallery.hxx b/svx/inc/fontworkgallery.hxx index b41f1a942c95..617243f2959a 100644 --- a/svx/inc/fontworkgallery.hxx +++ b/svx/inc/fontworkgallery.hxx @@ -61,7 +61,6 @@ namespace svx class FontWorkAlignmentWindow : public ToolbarMenu { - using FloatingWindow::StateChanged; private: Image maImgAlgin1; Image maImgAlgin2; @@ -76,7 +75,7 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - bool mbPopupMode; + const rtl::OUString msFontworkAlignment; DECL_LINK( SelectHdl, void * ); @@ -84,9 +83,6 @@ private: void implInit(); protected: - virtual BOOL Close(); - virtual void PopupModeEnd(); - /** This function is called when the window gets the focus. It grabs the focus to the line ends value set so that it can be controlled with the keyboard. @@ -101,9 +97,7 @@ public: void StartSelection(); - virtual SfxPopupWindow* Clone() const; - - virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ); + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); virtual void DataChanged( const DataChangedEvent& rDCEvt ); }; @@ -124,11 +118,11 @@ public: class FontWorkCharacterSpacingWindow : public ToolbarMenu { - using FloatingWindow::StateChanged; private: ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - bool mbPopupMode; + const rtl::OUString msFontworkCharacterSpacing; + const rtl::OUString msFontworkKernCharacterPairs; DECL_LINK( SelectHdl, void * ); @@ -137,9 +131,6 @@ private: void implInit(); protected: - virtual BOOL Close(); - virtual void PopupModeEnd(); - /** This function is called when the window gets the focus. It grabs the focus to the line ends value set so that it can be controlled with the keyboard. @@ -156,9 +147,7 @@ public: void StartSelection(); - virtual SfxPopupWindow* Clone() const; - - virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ); + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); virtual void DataChanged( const DataChangedEvent& rDCEvt ); }; @@ -187,8 +176,6 @@ public: ~FontWorkShapeTypeControl(); virtual void Select( BOOL bMod1 = FALSE ); - virtual void StateChanged( USHORT nSID, SfxItemState eState, - const SfxPoolItem* pState ); virtual SfxPopupWindowType GetPopupWindowType() const; virtual SfxPopupWindow* CreatePopupWindow(); }; diff --git a/svx/inc/svx/toolbarmenu.hxx b/svx/inc/svx/toolbarmenu.hxx index 7809d373e1fa..a0f5aa55c6d0 100644 --- a/svx/inc/svx/toolbarmenu.hxx +++ b/svx/inc/svx/toolbarmenu.hxx @@ -31,28 +31,37 @@ #ifndef _SVX_TOOLBARMENU_HXX_ #define _SVX_TOOLBARMENU_HXX_ +#include +#include + #include +#include + #include #include +#include + +#include #include + #include "svx/svxdllapi.h" class ToolbarMenuEntry; + typedef std::vector< ToolbarMenuEntry * > ToolbarMenuEntryVector; -class SVX_DLLPUBLIC ToolbarMenu : public SfxPopupWindow +class SVX_DLLPUBLIC ToolbarMenu : public DockingWindow { + friend class ToolbarMenuStatusListener; public: - ToolbarMenu( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, + ToolbarMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow, WinBits nBits ); - ToolbarMenu( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, + ToolbarMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow, const ResId& rResId ); @@ -99,7 +108,29 @@ public: int getSelectedEntryId() const; int getHighlightedEntryId() const; +protected: + // todo: move to new base class that will replace SfxPopupWindo + void AddStatusListener( const rtl::OUString& rCommandURL ); + void RemoveStatusListener( const rtl::OUString& rCommandURL ); + void UpdateStatus( const rtl::OUString& rCommandURL ); + + bool IsInPopupMode(); + void EndPopupMode(); + + // XStatusListener (subclasses must override this one to get the status updates + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + void StateChanged( StateChangedType nType ); + void DataChanged( const DataChangedEvent& rDCEvt ); + + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > GetFrame() const { return mxFrame; } private: + void initStatusListener(); + + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; + rtl::Reference< svt::FrameStatusListener > mxStatusListener; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceManager; + ToolbarMenuEntryVector maEntryVector; int mnCheckPos; @@ -116,9 +147,6 @@ private: void implInit(); - void StateChanged( StateChangedType nType ); - void DataChanged( const DataChangedEvent& rDCEvt ); - void initWindow(); Size implCalcSize(); @@ -126,7 +154,7 @@ private: void appendEntry( ToolbarMenuEntry* pEntry ); void implPaint( ToolbarMenuEntry* pThisOnly = NULL, bool bHighlight = false ); - void implDrawBorder(); +// void implDrawBorder(); void implHighlightEntry( int nHighlightEntry, bool bHighlight ); void implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown ); diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx index 14da4459e04d..972a9b951bc1 100644 --- a/svx/source/tbxctrls/extrusioncontrols.cxx +++ b/svx/source/tbxctrls/extrusioncontrols.cxx @@ -78,20 +78,15 @@ SFX_IMPL_TOOLBOX_CONTROL( ExtrusionDirectionControl, SfxBoolItem ); static sal_Int32 gSkewList[] = { 135, 90, 45, 180, 0, -360, -135, -90, -45 }; -ExtrusionDirectionWindow::ExtrusionDirectionWindow( - USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ) : - ToolbarMenu( nId, - rFrame, - pParentWindow, - SVX_RES( RID_SVXFLOAT_EXTRUSION_DIRECTION )), - mxFrame( rFrame ), - maImgPerspective( SVX_RES( IMG_PERSPECTIVE ) ), - maImgPerspectiveH( SVX_RES( IMG_PERSPECTIVE_H ) ), - maImgParallel( SVX_RES( IMG_PARALLEL ) ), - maImgParallelH( SVX_RES( IMG_PARALLEL_H ) ), - mbPopupMode ( TRUE ) +ExtrusionDirectionWindow::ExtrusionDirectionWindow( USHORT /*nId*/, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) +: ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_DIRECTION )) +, mxFrame( rFrame ) +, maImgPerspective( SVX_RES( IMG_PERSPECTIVE ) ) +, maImgPerspectiveH( SVX_RES( IMG_PERSPECTIVE_H ) ) +, maImgParallel( SVX_RES( IMG_PARALLEL ) ) +, maImgParallelH( SVX_RES( IMG_PARALLEL_H ) ) +, msExtrusionDirection( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirection" ) ) +, msExtrusionProjection( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionProjection" ) ) { implInit(); } @@ -142,18 +137,16 @@ void ExtrusionDirectionWindow::implInit() FreeResource(); - AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirection" ))); - AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionProjection" ))); -} - -SfxPopupWindow* ExtrusionDirectionWindow::Clone() const -{ - return new ExtrusionDirectionWindow( GetId(), mxFrame, 0 ); + AddStatusListener( msExtrusionDirection ); + AddStatusListener( msExtrusionProjection ); } void ExtrusionDirectionWindow::DataChanged( const DataChangedEvent& rDCEvt ) { - SfxPopupWindow::DataChanged( rDCEvt ); + AddStatusListener( msExtrusionDirection ); + AddStatusListener( msExtrusionProjection ); + + ToolbarMenu::DataChanged( rDCEvt ); if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) { @@ -220,37 +213,32 @@ void ExtrusionDirectionWindow::implSetProjection( sal_Int32 nProjection, bool bE // ----------------------------------------------------------------------- -void ExtrusionDirectionWindow::StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ) +void SAL_CALL ExtrusionDirectionWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) { - switch( nSID ) + if( Event.FeatureURL.Path.equals( msExtrusionDirection ) ) { - case SID_EXTRUSION_DIRECTION: + if( !Event.IsEnabled ) { - if( eState == SFX_ITEM_DISABLED ) - { - implSetDirection( -1, false ); - } - else - { - const SfxInt32Item* pStateItem = PTR_CAST( SfxInt32Item, pState ); - if( pStateItem ) - implSetDirection( pStateItem->GetValue(), true ); - } - break; + implSetDirection( -1, false ); } - case SID_EXTRUSION_PROJECTION: + else { - if( eState == SFX_ITEM_DISABLED ) - { - implSetProjection( -1, false ); - } - else - { - const SfxInt32Item* pStateItem = PTR_CAST( SfxInt32Item, pState ); - if( pStateItem ) - implSetProjection( pStateItem->GetValue(), true ); - } - break; + sal_Int32 nValue = 0; + if( Event.State >>= nValue ) + implSetDirection( nValue, true ); + } + } + else if( Event.FeatureURL.Path.equals( msExtrusionProjection ) ) + { + if( !Event.IsEnabled ) + { + implSetProjection( -1, false ); + } + else + { + sal_Int32 nValue = 0; + if( Event.State >>= nValue ) + implSetProjection( nValue, true ); } } } @@ -269,7 +257,7 @@ IMPL_LINK( ExtrusionDirectionWindow, SelectHdl, void *, pControl ) sal_Int32 nSkew = gSkewList[mpDirectionSet->GetSelectItemId()-1]; SfxInt32Item aItem( SID_EXTRUSION_DIRECTION, nSkew ); - rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirection" )); + rtl::OUString aCommand( msExtrusionDirection ); Any a; INetURLObject aObj( aCommand ); @@ -291,7 +279,7 @@ IMPL_LINK( ExtrusionDirectionWindow, SelectHdl, void *, pControl ) if( (nProjection >= 0) && (nProjection < 2 ) ) { SfxInt32Item aItem( SID_EXTRUSION_PROJECTION, nProjection ); - rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionProjection" )); + rtl::OUString aCommand( msExtrusionProjection ); Any a; INetURLObject aObj( aCommand ); @@ -326,27 +314,9 @@ void ExtrusionDirectionWindow::StartSelection() // ----------------------------------------------------------------------- -BOOL ExtrusionDirectionWindow::Close() -{ - return SfxPopupWindow::Close(); -} - -// ----------------------------------------------------------------------- - -void ExtrusionDirectionWindow::PopupModeEnd() -{ - if ( IsVisible() ) - { - mbPopupMode = FALSE; - } - SfxPopupWindow::PopupModeEnd(); -} - -// ----------------------------------------------------------------------- - void ExtrusionDirectionWindow::GetFocus (void) { - SfxPopupWindow::GetFocus(); + ToolbarMenu::GetFocus(); // Grab the focus to the line ends value set so that it can be controlled // with the keyboard. if( mpDirectionSet ) @@ -384,10 +354,12 @@ SfxPopupWindowType ExtrusionDirectionControl::GetPopupWindowType() const SfxPopupWindow* ExtrusionDirectionControl::CreatePopupWindow() { ExtrusionDirectionWindow* pWin = new ExtrusionDirectionWindow( GetId(), m_xFrame, &GetToolBox() ); - pWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_REMOVEDECORATION ); + StartPopupMode( pWin ); +// pWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_ALLOWTEAROFF ); pWin->StartSelection(); - SetPopupWindow( pWin ); - return pWin; + // SetPopupWindow( pWin ); +// return pWin; + return 0; } // ----------------------------------------------------------------------- @@ -432,13 +404,10 @@ double ExtrusionDepthDialog::getDepth() const SFX_IMPL_TOOLBOX_CONTROL( ExtrusionDepthControl, SfxBoolItem ); -ExtrusionDepthWindow::ExtrusionDepthWindow( USHORT nId, +ExtrusionDepthWindow::ExtrusionDepthWindow( USHORT /*nId*/, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) : - ToolbarMenu( nId, - rFrame, - pParentWindow, - SVX_RES( RID_SVXFLOAT_EXTRUSION_DEPTH )), + ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_DEPTH )), maImgDepth0( SVX_RES( IMG_DEPTH_0 ) ), maImgDepth1( SVX_RES( IMG_DEPTH_1 ) ), maImgDepth2( SVX_RES( IMG_DEPTH_2 ) ), @@ -452,9 +421,10 @@ ExtrusionDepthWindow::ExtrusionDepthWindow( USHORT nId, maImgDepth4h( SVX_RES( IMG_DEPTH_4_H ) ), maImgDepthInfinityh( SVX_RES( IMG_DEPTH_INFINITY_H ) ), mxFrame( rFrame ), - mbPopupMode ( true ), mfDepth( -1.0 ), - mbEnabled( false ) + mbEnabled( false ), + msExtrusionDepth( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepth" ) ), + msMetricUnit( RTL_CONSTASCII_USTRINGPARAM( ".uno:MetricUnit" ) ) { implInit(); } @@ -463,9 +433,6 @@ void ExtrusionDepthWindow::implInit() { SetHelpId( HID_POPUP_EXTRUSION_DEPTH ); -// mpDepthForewarder = new SfxStatusForwarder( SID_EXTRUSION_DEPTH, *this ); -// mpMetricForewarder = new SfxStatusForwarder( SID_ATTR_METRIC, *this ); - // mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); /*mpMenu->*/SetHelpId( HID_MENU_EXTRUSION_DEPTH ); @@ -489,13 +456,8 @@ void ExtrusionDepthWindow::implInit() FreeResource(); - AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepth" ))); - AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:MetricUnit" ))); -} - -SfxPopupWindow* ExtrusionDepthWindow::Clone() const -{ - return new ExtrusionDepthWindow( GetId(), mxFrame, 0 ); + AddStatusListener( msExtrusionDepth ); + AddStatusListener( msMetricUnit ); } // ----------------------------------------------------------------------- @@ -548,30 +510,29 @@ void ExtrusionDepthWindow::implFillStrings( FieldUnit eUnit ) // ----------------------------------------------------------------------- -void ExtrusionDepthWindow::StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ) +void SAL_CALL ExtrusionDepthWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) { - switch( nSID ) + if( Event.FeatureURL.Path.equals( msExtrusionDepth ) ) { - case SID_EXTRUSION_DEPTH: + if( !Event.IsEnabled ) { - if( eState == SFX_ITEM_DISABLED ) - { - implSetDepth( 0, false ); - } - else - { - const SvxDoubleItem* pStateItem = PTR_CAST( SvxDoubleItem, pState ); - if( pStateItem ) - implSetDepth( pStateItem->GetValue(), true ); - } - break; + implSetDepth( 0, false ); } - case SID_ATTR_METRIC: + else { - const SfxUInt16Item* pStateItem = PTR_CAST( SfxUInt16Item, pState ); - if( pStateItem ) + double fValue = 0.0; + if( Event.State >>= fValue ) + implSetDepth( fValue, true ); + } + } + else if( Event.FeatureURL.Path.equals( msMetricUnit ) ) + { + if( Event.IsEnabled ) + { + sal_Int32 nValue = 0; + if( Event.State >>= nValue ) { - implFillStrings( (FieldUnit)pStateItem->GetValue() ); + implFillStrings( static_cast(nValue) ); if( mfDepth >= 0.0 ) implSetDepth( mfDepth, mbEnabled ); } @@ -583,7 +544,7 @@ void ExtrusionDepthWindow::StateChanged( USHORT nSID, SfxItemState eState, const void ExtrusionDepthWindow::DataChanged( const DataChangedEvent& rDCEvt ) { - SfxPopupWindow::DataChanged( rDCEvt ); + ToolbarMenu::DataChanged( rDCEvt ); if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) { @@ -646,7 +607,7 @@ IMPL_LINK( ExtrusionDepthWindow, SelectHdl, void *, EMPTYARG ) } SvxDoubleItem aItem( fDepth, SID_EXTRUSION_DEPTH ); - rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepth" )); + rtl::OUString aCommand( msExtrusionDepth ); Any a; INetURLObject aObj( aCommand ); @@ -676,27 +637,11 @@ void ExtrusionDepthWindow::StartSelection() // ----------------------------------------------------------------------- -BOOL ExtrusionDepthWindow::Close() -{ - return SfxPopupWindow::Close(); -} - -// ----------------------------------------------------------------------- - -void ExtrusionDepthWindow::PopupModeEnd() -{ - if ( IsVisible() ) - { - mbPopupMode = FALSE; - } - SfxPopupWindow::PopupModeEnd(); -} - // ----------------------------------------------------------------------- void ExtrusionDepthWindow::GetFocus (void) { - SfxPopupWindow::GetFocus(); + ToolbarMenu::GetFocus(); // Grab the focus to the line ends value set so that it can be controlled // with the keyboard. //if( mpMenu ) @@ -730,10 +675,8 @@ SfxPopupWindowType ExtrusionDepthControl::GetPopupWindowType() const SfxPopupWindow* ExtrusionDepthControl::CreatePopupWindow() { ExtrusionDepthWindow* pWin = new ExtrusionDepthWindow( GetId(), m_xFrame, &GetToolBox() ); - pWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_REMOVEDECORATION ); - pWin->StartSelection(); - SetPopupWindow( pWin ); - return pWin; + StartPopupMode( pWin ); + return 0; } // ----------------------------------------------------------------------- @@ -754,13 +697,10 @@ SFX_IMPL_TOOLBOX_CONTROL( ExtrusionLightingControl, SfxBoolItem ); // ------------------------------------------------------------------------- ExtrusionLightingWindow::ExtrusionLightingWindow( - USHORT nId, + USHORT /*nId*/, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) : - ToolbarMenu( nId, - rFrame, - pParentWindow, - SVX_RES( RID_SVXFLOAT_EXTRUSION_LIGHTING ) ), + ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_LIGHTING ) ), maImgBright( SVX_RES( IMG_LIGHTING_BRIGHT ) ), maImgNormal( SVX_RES( IMG_LIGHTING_NORMAL ) ), maImgDim( SVX_RES( IMG_LIGHTING_DIM ) ), @@ -768,11 +708,12 @@ ExtrusionLightingWindow::ExtrusionLightingWindow( maImgNormalh( SVX_RES( IMG_LIGHTING_NORMAL_H ) ), maImgDimh( SVX_RES( IMG_LIGHTING_DIM_H ) ), mxFrame( rFrame ), - mbPopupMode( true ), mnLevel( 0 ), mbLevelEnabled( false ), mnDirection( FROM_FRONT ), - mbDirectionEnabled( false ) + mbDirectionEnabled( false ), + msExtrusionLightingDirection( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingDirection" )), + msExtrusionLightingIntensity( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingIntensity" )) { implInit(); } @@ -836,15 +777,8 @@ void ExtrusionLightingWindow::implInit() FreeResource(); - AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingDirection" ))); - AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingIntensity" ))); -} - -// ----------------------------------------------------------------------- - -SfxPopupWindow* ExtrusionLightingWindow::Clone() const -{ - return new ExtrusionLightingWindow( GetId(), mxFrame, 0 ); + AddStatusListener( msExtrusionLightingDirection ); + AddStatusListener( msExtrusionLightingIntensity ); } // ----------------------------------------------------------------------- @@ -905,37 +839,32 @@ void ExtrusionLightingWindow::implSetDirection( int nDirection, bool bEnabled ) // ----------------------------------------------------------------------- -void ExtrusionLightingWindow::StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ) +void SAL_CALL ExtrusionLightingWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) { - switch( nSID ) + if( Event.FeatureURL.Path.equals( msExtrusionLightingIntensity ) ) { - case SID_EXTRUSION_LIGHTING_INTENSITY: + if( !Event.IsEnabled ) { - if( eState == SFX_ITEM_DISABLED ) - { - implSetIntensity( 0, false ); - } - else - { - const SfxInt32Item* pStateItem = PTR_CAST( SfxInt32Item, pState ); - if( pStateItem ) - implSetIntensity( pStateItem->GetValue(), true ); - } - break; + implSetIntensity( 0, false ); } - case SID_EXTRUSION_LIGHTING_DIRECTION: + else { - if( eState == SFX_ITEM_DISABLED ) - { - implSetDirection( 0, false ); - } - else - { - const SfxInt32Item* pStateItem = PTR_CAST( SfxInt32Item, pState ); - if( pStateItem ) - implSetDirection( pStateItem->GetValue(), true ); - } - break; + sal_Int32 nValue = 0; + if( Event.State >>= nValue ) + implSetIntensity( nValue, true ); + } + } + else if( Event.FeatureURL.Path.equals( msExtrusionLightingDirection ) ) + { + if( !Event.IsEnabled ) + { + implSetDirection( 0, false ); + } + else + { + sal_Int32 nValue = 0; + if( Event.State >>= nValue ) + implSetDirection( nValue, true ); } } } @@ -944,7 +873,7 @@ void ExtrusionLightingWindow::StateChanged( USHORT nSID, SfxItemState eState, co void ExtrusionLightingWindow::DataChanged( const DataChangedEvent& rDCEvt ) { - SfxPopupWindow::DataChanged( rDCEvt ); + ToolbarMenu::DataChanged( rDCEvt ); if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) { @@ -974,7 +903,7 @@ IMPL_LINK( ExtrusionLightingWindow, SelectHdl, void *, pControl ) if( nLevel != 3 ) { SfxInt32Item aItem( SID_EXTRUSION_LIGHTING_INTENSITY, nLevel ); - rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingIntensity" )); + rtl::OUString aCommand( msExtrusionLightingIntensity ); Any a; INetURLObject aObj( aCommand ); @@ -988,7 +917,6 @@ IMPL_LINK( ExtrusionLightingWindow, SelectHdl, void *, pControl ) aCommand, aArgs ); -// pDisp->Execute( SID_EXTRUSION_LIGHTING_INTENSITY, SFX_CALLMODE_RECORD, &aItem, 0L , 0L ); implSetIntensity( nLevel, true ); } } @@ -1002,7 +930,7 @@ IMPL_LINK( ExtrusionLightingWindow, SelectHdl, void *, pControl ) nDirection--; SfxInt32Item aItem( SID_EXTRUSION_LIGHTING_DIRECTION, nDirection ); - rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingDirection" )); + rtl::OUString aCommand( msExtrusionLightingDirection ); Any a; INetURLObject aObj( aCommand ); @@ -1015,7 +943,6 @@ IMPL_LINK( ExtrusionLightingWindow, SelectHdl, void *, pControl ) mxFrame->getController(), UNO_QUERY ), aCommand, aArgs ); -// pDisp->Execute( SID_EXTRUSION_LIGHTING_DIRECTION, SFX_CALLMODE_RECORD, &aItem, 0L , 0L ); implSetDirection( nDirection, true ); } @@ -1033,27 +960,11 @@ void ExtrusionLightingWindow::StartSelection() // ----------------------------------------------------------------------- -BOOL ExtrusionLightingWindow::Close() -{ - return SfxPopupWindow::Close(); -} - -// ----------------------------------------------------------------------- - -void ExtrusionLightingWindow::PopupModeEnd() -{ - if ( IsVisible() ) - { - mbPopupMode = FALSE; - } - SfxPopupWindow::PopupModeEnd(); -} - // ----------------------------------------------------------------------- void ExtrusionLightingWindow::GetFocus (void) { - SfxPopupWindow::GetFocus(); + ToolbarMenu::GetFocus(); // Grab the focus to the line ends value set so that it can be controlled // with the keyboard. // if( mpMenu ) @@ -1086,10 +997,8 @@ SfxPopupWindowType ExtrusionLightingControl::GetPopupWindowType() const SfxPopupWindow* ExtrusionLightingControl::CreatePopupWindow() { ExtrusionLightingWindow* pWin = new ExtrusionLightingWindow( GetId(), m_xFrame, &GetToolBox() ); - pWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_REMOVEDECORATION ); - pWin->StartSelection(); - SetPopupWindow( pWin ); - return pWin; + StartPopupMode( pWin ); + return 0; } // ----------------------------------------------------------------------- @@ -1108,14 +1017,10 @@ void ExtrusionLightingControl::StateChanged( USHORT, SfxItemState eState, const SFX_IMPL_TOOLBOX_CONTROL( ExtrusionSurfaceControl, SfxBoolItem ); ExtrusionSurfaceWindow::ExtrusionSurfaceWindow( - USHORT nId, + USHORT /*nId*/, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) : - - ToolbarMenu( nId, - rFrame, - pParentWindow, - SVX_RES( RID_SVXFLOAT_EXTRUSION_SURFACE )), + ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_SURFACE )), maImgSurface1( SVX_RES( IMG_WIRE_FRAME ) ), maImgSurface2( SVX_RES( IMG_MATTE ) ), maImgSurface3( SVX_RES( IMG_PLASTIC ) ), @@ -1125,7 +1030,7 @@ ExtrusionSurfaceWindow::ExtrusionSurfaceWindow( maImgSurface3h( SVX_RES( IMG_PLASTIC_H ) ), maImgSurface4h( SVX_RES( IMG_METAL_H ) ), mxFrame( rFrame ), - mbPopupMode( true ) + msExtrusionSurface( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionSurface" )) { implInit(); } @@ -1154,14 +1059,7 @@ void ExtrusionSurfaceWindow::implInit() FreeResource(); - AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionSurface" ))); -} - -// ----------------------------------------------------------------------- - -SfxPopupWindow* ExtrusionSurfaceWindow::Clone() const -{ - return new ExtrusionSurfaceWindow( GetId(), mxFrame, 0 ); + AddStatusListener( msExtrusionSurface ); } // ----------------------------------------------------------------------- @@ -1188,23 +1086,19 @@ void ExtrusionSurfaceWindow::implSetSurface( int nSurface, bool bEnabled ) // ----------------------------------------------------------------------- -void ExtrusionSurfaceWindow::StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ) +void SAL_CALL ExtrusionSurfaceWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) { - switch( nSID ) + if( Event.FeatureURL.Path.equals( msExtrusionSurface ) ) { - case SID_EXTRUSION_SURFACE: + if( !Event.IsEnabled ) { - if( eState == SFX_ITEM_DISABLED ) - { - implSetSurface( 0, false ); - } - else - { - const SfxInt32Item* pStateItem = PTR_CAST( SfxInt32Item, pState ); - if( pStateItem ) - implSetSurface( pStateItem->GetValue(), true ); - } - break; + implSetSurface( 0, false ); + } + else + { + sal_Int32 nValue = 0; + if( Event.State >>= nValue ) + implSetSurface( nValue, true ); } } } @@ -1213,7 +1107,7 @@ void ExtrusionSurfaceWindow::StateChanged( USHORT nSID, SfxItemState eState, con void ExtrusionSurfaceWindow::DataChanged( const DataChangedEvent& rDCEvt ) { - SfxPopupWindow::DataChanged( rDCEvt ); + ToolbarMenu::DataChanged( rDCEvt ); if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) { @@ -1239,7 +1133,7 @@ IMPL_LINK( ExtrusionSurfaceWindow, SelectHdl, void *, EMPTYARG ) if( nSurface >= 0 ) { SfxInt32Item aItem( SID_EXTRUSION_SURFACE, nSurface ); - rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionSurface" )); + rtl::OUString aCommand( msExtrusionSurface ); Any a; INetURLObject aObj( aCommand ); @@ -1252,7 +1146,6 @@ IMPL_LINK( ExtrusionSurfaceWindow, SelectHdl, void *, EMPTYARG ) mxFrame->getController(), UNO_QUERY ), aCommand, aArgs ); -// pDisp->Execute( SID_EXTRUSION_SURFACE, SFX_CALLMODE_RECORD, &aItem, 0L , 0L ); implSetSurface( nSurface, true ); } @@ -1268,27 +1161,11 @@ void ExtrusionSurfaceWindow::StartSelection() // ----------------------------------------------------------------------- -BOOL ExtrusionSurfaceWindow::Close() -{ - return SfxPopupWindow::Close(); -} - -// ----------------------------------------------------------------------- - -void ExtrusionSurfaceWindow::PopupModeEnd() -{ - if ( IsVisible() ) - { - mbPopupMode = FALSE; - } - SfxPopupWindow::PopupModeEnd(); -} - // ----------------------------------------------------------------------- void ExtrusionSurfaceWindow::GetFocus (void) { - SfxPopupWindow::GetFocus(); + ToolbarMenu::GetFocus(); // Grab the focus to the line ends value set so that it can be controlled // with the keyboard. //if( mpMenu ) @@ -1322,10 +1199,8 @@ SfxPopupWindowType ExtrusionSurfaceControl::GetPopupWindowType() const SfxPopupWindow* ExtrusionSurfaceControl::CreatePopupWindow() { ExtrusionSurfaceWindow* pWin = new ExtrusionSurfaceWindow( GetId(), m_xFrame, &GetToolBox() ); - pWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_REMOVEDECORATION ); - pWin->StartSelection(); - SetPopupWindow( pWin ); - return pWin; + StartPopupMode( pWin ); + return 0; } // ----------------------------------------------------------------------- diff --git a/svx/source/tbxctrls/extrusioncontrols.src b/svx/source/tbxctrls/extrusioncontrols.src index 0a5e2a4b11a2..9d5949fbc825 100644 --- a/svx/source/tbxctrls/extrusioncontrols.src +++ b/svx/source/tbxctrls/extrusioncontrols.src @@ -33,7 +33,7 @@ #define MASKCOLOR MaskColor = Color { Red=0xFFFF; Green=0x0000; Blue=0xFFFF; }; -FloatingWindow RID_SVXFLOAT_EXTRUSION_DIRECTION +DockingWindow RID_SVXFLOAT_EXTRUSION_DIRECTION { Border = FALSE ; Hide = TRUE ; @@ -203,7 +203,7 @@ FloatingWindow RID_SVXFLOAT_EXTRUSION_DIRECTION }; }; -FloatingWindow RID_SVXFLOAT_EXTRUSION_DEPTH +DockingWindow RID_SVXFLOAT_EXTRUSION_DEPTH { Border = FALSE ; Hide = TRUE ; @@ -292,7 +292,7 @@ FloatingWindow RID_SVXFLOAT_EXTRUSION_DEPTH }; }; -FloatingWindow RID_SVXFLOAT_EXTRUSION_LIGHTING +DockingWindow RID_SVXFLOAT_EXTRUSION_LIGHTING { Border = FALSE ; Hide = TRUE ; @@ -608,7 +608,7 @@ FloatingWindow RID_SVXFLOAT_EXTRUSION_LIGHTING }; }; -FloatingWindow RID_SVXFLOAT_EXTRUSION_SURFACE +DockingWindow RID_SVXFLOAT_EXTRUSION_SURFACE { Border = FALSE ; Hide = TRUE ; diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx index ed25ad41d43e..b6cd012f9aea 100644 --- a/svx/source/tbxctrls/fontworkgallery.cxx +++ b/svx/source/tbxctrls/fontworkgallery.cxx @@ -328,13 +328,6 @@ SfxPopupWindow* FontWorkShapeTypeControl::CreatePopupWindow() // ----------------------------------------------------------------------- -void FontWorkShapeTypeControl::StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ) -{ - SfxToolBoxControl::StateChanged( nSID, eState, pState ); -} - -// ----------------------------------------------------------------------- - void FontWorkShapeTypeControl::Select( BOOL ) { @@ -345,13 +338,11 @@ void FontWorkShapeTypeControl::Select( BOOL ) SFX_IMPL_TOOLBOX_CONTROL( FontWorkAlignmentControl, SfxBoolItem ); FontWorkAlignmentWindow::FontWorkAlignmentWindow( - USHORT nId, + USHORT /*nId*/, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) : - ToolbarMenu( nId, - rFrame, pParentWindow, - SVX_RES( RID_SVXFLOAT_FONTWORK_ALIGNMENT )), + ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_FONTWORK_ALIGNMENT )), maImgAlgin1( SVX_RES( IMG_FONTWORK_ALIGN_LEFT_16 ) ), maImgAlgin2( SVX_RES( IMG_FONTWORK_ALIGN_CENTER_16 ) ), maImgAlgin3( SVX_RES( IMG_FONTWORK_ALIGN_RIGHT_16 ) ), @@ -363,7 +354,7 @@ FontWorkAlignmentWindow::FontWorkAlignmentWindow( maImgAlgin4h( SVX_RES( IMG_FONTWORK_ALIGN_WORD_16_H ) ), maImgAlgin5h( SVX_RES( IMG_FONTWORK_ALIGN_STRETCH_16_H ) ), mxFrame( rFrame ), - mbPopupMode( true ) + msFontworkAlignment( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkAlignment" ) ) { SetHelpId( HID_WIN_FONTWORK_ALIGN ); implInit(); @@ -388,12 +379,7 @@ void FontWorkAlignmentWindow::implInit() FreeResource(); - AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkAlignment" ))); -} - -SfxPopupWindow* FontWorkAlignmentWindow::Clone() const -{ - return new FontWorkAlignmentWindow( GetId(), mxFrame, 0 ); + AddStatusListener( msFontworkAlignment ); } // ----------------------------------------------------------------------- @@ -416,23 +402,19 @@ void FontWorkAlignmentWindow::implSetAlignment( int nSurface, bool bEnabled ) // ----------------------------------------------------------------------- -void FontWorkAlignmentWindow::StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ) +void SAL_CALL FontWorkAlignmentWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) { - switch( nSID ) + if( Event.FeatureURL.Path.equals( msFontworkAlignment ) ) { - case SID_FONTWORK_ALIGNMENT: + if( !Event.IsEnabled ) { - if( eState == SFX_ITEM_DISABLED ) - { - implSetAlignment( 0, false ); - } - else - { - const SfxInt32Item* pStateItem = PTR_CAST( SfxInt32Item, pState ); - if( pStateItem ) - implSetAlignment( pStateItem->GetValue(), true ); - } - break; + implSetAlignment( 0, false ); + } + else + { + sal_Int32 nValue; + if( Event.State >>= nValue ) + implSetAlignment( nValue, true ); } } } @@ -441,7 +423,7 @@ void FontWorkAlignmentWindow::StateChanged( USHORT nSID, SfxItemState eState, co void FontWorkAlignmentWindow::DataChanged( const DataChangedEvent& rDCEvt ) { - SfxPopupWindow::DataChanged( rDCEvt ); + ToolbarMenu::DataChanged( rDCEvt ); if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) { @@ -496,27 +478,9 @@ void FontWorkAlignmentWindow::StartSelection() // ----------------------------------------------------------------------- -BOOL FontWorkAlignmentWindow::Close() -{ - return SfxPopupWindow::Close(); -} - -// ----------------------------------------------------------------------- - -void FontWorkAlignmentWindow::PopupModeEnd() -{ - if ( IsVisible() ) - { - mbPopupMode = FALSE; - } - SfxPopupWindow::PopupModeEnd(); -} - -// ----------------------------------------------------------------------- - void FontWorkAlignmentWindow::GetFocus (void) { - SfxPopupWindow::GetFocus(); + ToolbarMenu::GetFocus(); // Grab the focus to the line ends value set so that it can be controlled // with the keyboard. GrabFocus(); @@ -549,10 +513,8 @@ SfxPopupWindowType FontWorkAlignmentControl::GetPopupWindowType() const SfxPopupWindow* FontWorkAlignmentControl::CreatePopupWindow() { FontWorkAlignmentWindow* pWin = new FontWorkAlignmentWindow( GetId(), m_xFrame, &GetToolBox() ); - pWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_REMOVEDECORATION ); - pWin->StartSelection(); - SetPopupWindow( pWin ); - return pWin; + StartPopupMode( pWin ); + return 0; } // ----------------------------------------------------------------------- @@ -570,17 +532,11 @@ void FontWorkAlignmentControl::StateChanged( USHORT /*nSID*/, SfxItemState eStat SFX_IMPL_TOOLBOX_CONTROL( FontWorkCharacterSpacingControl, SfxBoolItem ); -FontWorkCharacterSpacingWindow::FontWorkCharacterSpacingWindow( - USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ) : - - ToolbarMenu( nId, - rFrame, - pParentWindow, - SVX_RES( RID_SVXFLOAT_FONTWORK_CHARSPACING )), - mxFrame( rFrame ), - mbPopupMode( true ) +FontWorkCharacterSpacingWindow::FontWorkCharacterSpacingWindow( USHORT /*nId*/, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) +: ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_FONTWORK_CHARSPACING )) +, mxFrame( rFrame ) +, msFontworkCharacterSpacing( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkCharacterSpacing" ) ) +, msFontworkKernCharacterPairs( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkKernCharacterPairs" ) ) { implInit(); } @@ -607,12 +563,8 @@ void FontWorkCharacterSpacingWindow::implInit() FreeResource(); - AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkCharacterSpacing" ))); -} - -SfxPopupWindow* FontWorkCharacterSpacingWindow::Clone() const -{ - return new FontWorkCharacterSpacingWindow( GetId(), mxFrame, 0 ); + AddStatusListener( msFontworkCharacterSpacing ); + AddStatusListener( msFontworkKernCharacterPairs ); } // ----------------------------------------------------------------------- @@ -647,6 +599,8 @@ void FontWorkCharacterSpacingWindow::implSetCharacterSpacing( sal_Int32 nCharact } } +// ----------------------------------------------------------------------- + void FontWorkCharacterSpacingWindow::implSetKernCharacterPairs( sal_Bool, bool bEnabled ) { enableEntry( 6, bEnabled ); @@ -655,35 +609,33 @@ void FontWorkCharacterSpacingWindow::implSetKernCharacterPairs( sal_Bool, bool b // ----------------------------------------------------------------------- -void FontWorkCharacterSpacingWindow::StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ) +void SAL_CALL FontWorkCharacterSpacingWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) { - switch( nSID ) + if( Event.FeatureURL.Path.equals( msFontworkCharacterSpacing ) ) { - case SID_FONTWORK_CHARACTER_SPACING: + if( !Event.IsEnabled ) { - if( eState == SFX_ITEM_DISABLED ) - implSetCharacterSpacing( 0, false ); - else - { - const SfxInt32Item* pStateItem = PTR_CAST( SfxInt32Item, pState ); - if( pStateItem ) - implSetCharacterSpacing( pStateItem->GetValue(), true ); - } + implSetCharacterSpacing( 0, false ); } - break; - - case SID_FONTWORK_KERN_CHARACTER_PAIRS : + else { - if( eState == SFX_ITEM_DISABLED ) - implSetKernCharacterPairs( 0, false ); - else - { - const SfxBoolItem* pStateItem = PTR_CAST( SfxBoolItem, pState ); - if( pStateItem ) - implSetKernCharacterPairs( pStateItem->GetValue(), true ); - } + sal_Int32 nValue = 0; + if( Event.State >>= nValue ) + implSetCharacterSpacing( nValue, true ); + } + } + else if( Event.FeatureURL.Path.equals( msFontworkKernCharacterPairs ) ) + { + if( !Event.IsEnabled ) + { + implSetKernCharacterPairs( 0, false ); + } + else + { + sal_Bool bValue = sal_False; + if( Event.State >>= bValue ) + implSetKernCharacterPairs( bValue, true ); } - break; } } @@ -691,7 +643,7 @@ void FontWorkCharacterSpacingWindow::StateChanged( USHORT nSID, SfxItemState eSt void FontWorkCharacterSpacingWindow::DataChanged( const DataChangedEvent& rDCEvt ) { - SfxPopupWindow::DataChanged( rDCEvt ); + ToolbarMenu::DataChanged( rDCEvt ); if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) { @@ -790,27 +742,9 @@ void FontWorkCharacterSpacingWindow::StartSelection() // ----------------------------------------------------------------------- -BOOL FontWorkCharacterSpacingWindow::Close() -{ - return SfxPopupWindow::Close(); -} - -// ----------------------------------------------------------------------- - -void FontWorkCharacterSpacingWindow::PopupModeEnd() -{ - if ( IsVisible() ) - { - mbPopupMode = FALSE; - } - SfxPopupWindow::PopupModeEnd(); -} - -// ----------------------------------------------------------------------- - void FontWorkCharacterSpacingWindow::GetFocus (void) { - SfxPopupWindow::GetFocus(); + ToolbarMenu::GetFocus(); // Grab the focus to the line ends value set so that it can be controlled // with the keyboard. GrabFocus(); @@ -843,10 +777,8 @@ SfxPopupWindowType FontWorkCharacterSpacingControl::GetPopupWindowType() const SfxPopupWindow* FontWorkCharacterSpacingControl::CreatePopupWindow() { FontWorkCharacterSpacingWindow* pWin = new FontWorkCharacterSpacingWindow( GetId(), m_xFrame, &GetToolBox() ); - pWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_REMOVEDECORATION ); - pWin->StartSelection(); - SetPopupWindow( pWin ); - return pWin; + StartPopupMode( pWin ); + return 0; } // ----------------------------------------------------------------------- diff --git a/svx/source/tbxctrls/fontworkgallery.src b/svx/source/tbxctrls/fontworkgallery.src index d21bb3fdac0e..df3e52a168f6 100644 --- a/svx/source/tbxctrls/fontworkgallery.src +++ b/svx/source/tbxctrls/fontworkgallery.src @@ -95,7 +95,7 @@ ModalDialog RID_SVX_MDLG_FONTWORK_GALLERY }; }; -FloatingWindow RID_SVXFLOAT_FONTWORK_ALIGNMENT +DockingWindow RID_SVXFLOAT_FONTWORK_ALIGNMENT { Border = FALSE ; Hide = TRUE ; @@ -230,7 +230,7 @@ FloatingWindow RID_SVXFLOAT_FONTWORK_ALIGNMENT }; }; -FloatingWindow RID_SVXFLOAT_FONTWORK_CHARSPACING +DockingWindow RID_SVXFLOAT_FONTWORK_CHARSPACING { Border = FALSE ; Hide = TRUE ; diff --git a/svx/source/tbxctrls/toolbarmenu.cxx b/svx/source/tbxctrls/toolbarmenu.cxx index 382ab0581919..9867210b41af 100644 --- a/svx/source/tbxctrls/toolbarmenu.cxx +++ b/svx/source/tbxctrls/toolbarmenu.cxx @@ -32,6 +32,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" +#include + +#include #include #include #include @@ -143,20 +146,20 @@ ToolbarMenuEntry::~ToolbarMenuEntry() delete mpControl; } -ToolbarMenu::ToolbarMenu( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, +ToolbarMenu::ToolbarMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow, WinBits nBits ) -: SfxPopupWindow(nId, rFrame, pParentWindow, nBits) +: DockingWindow(pParentWindow, nBits) +, mxFrame( rFrame ) { implInit(); } -ToolbarMenu::ToolbarMenu( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, +ToolbarMenu::ToolbarMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow, const ResId& rResId ) -: SfxPopupWindow(nId, rFrame, pParentWindow, rResId) +: DockingWindow(pParentWindow, rResId) +, mxFrame( rFrame ) { implInit(); } @@ -167,6 +170,8 @@ void ToolbarMenu::implInit() // EnableChildTransparentMode(); + mxServiceManager = ::comphelper::getProcessServiceFactory(); + mnCheckPos = 0; mnImagePos = 0; mnTextPos = 0; @@ -178,6 +183,12 @@ void ToolbarMenu::implInit() ToolbarMenu::~ToolbarMenu() { + if ( mxStatusListener.is() ) + { + mxStatusListener->dispose(); + mxStatusListener.clear(); + } + // delete all menu entries const int nEntryCount = maEntryVector.size(); int nEntry; @@ -446,7 +457,7 @@ void ToolbarMenu::GetFocus() implChangeHighlightEntry( 0 ); } */ - SfxPopupWindow::GetFocus(); + DockingWindow::GetFocus(); } void ToolbarMenu::LoseFocus() @@ -455,7 +466,7 @@ void ToolbarMenu::LoseFocus() { implChangeHighlightEntry( -1 ); } - SfxPopupWindow::LoseFocus(); + DockingWindow::LoseFocus(); } void ToolbarMenu::appendEntry( int nEntryId, const String& rStr, MenuItemBits nItemBits ) @@ -498,7 +509,7 @@ void ToolbarMenu::appendSeparator() void ToolbarMenu::Resize() { - Window::Resize(); + DockingWindow::Resize(); } ToolbarMenuEntry* ToolbarMenu::implGetEntry( int nEntry ) const @@ -853,6 +864,7 @@ void ToolbarMenu::KeyInput( const KeyEvent& rKEvent ) } } +/* void ToolbarMenu::implDrawBorder() { SetFillColor(); @@ -872,6 +884,7 @@ void ToolbarMenu::implDrawBorder() DrawRect( aRect ); SetClipRegion( oldClipRgn ); } +*/ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) { @@ -1024,7 +1037,7 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) void ToolbarMenu::Paint( const Rectangle& ) { - implDrawBorder(); +// implDrawBorder(); implPaint(); if( mnHighlightedEntry != -1 ) @@ -1033,12 +1046,12 @@ void ToolbarMenu::Paint( const Rectangle& ) void ToolbarMenu::RequestHelp( const HelpEvent& rHEvt ) { - Window::RequestHelp( rHEvt ); + DockingWindow::RequestHelp( rHEvt ); } void ToolbarMenu::StateChanged( StateChangedType nType ) { - SfxPopupWindow::StateChanged( nType ); + DockingWindow::StateChanged( nType ); if ( ( nType == STATE_CHANGE_CONTROLFOREGROUND ) || ( nType == STATE_CHANGE_CONTROLBACKGROUND ) ) { @@ -1049,7 +1062,7 @@ void ToolbarMenu::StateChanged( StateChangedType nType ) void ToolbarMenu::DataChanged( const DataChangedEvent& rDCEvt ) { - SfxPopupWindow::DataChanged( rDCEvt ); + DockingWindow::DataChanged( rDCEvt ); if ( (rDCEvt.GetType() == DATACHANGED_FONTS) || (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) || @@ -1072,3 +1085,85 @@ void ToolbarMenu::Command( const CommandEvent& rCEvt ) } } } + +// todo: move to new base class that will replace SfxPopupWindo +void ToolbarMenu::AddStatusListener( const rtl::OUString& rCommandURL ) +{ + initStatusListener(); + mxStatusListener->addStatusListener( rCommandURL ); +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::RemoveStatusListener( const rtl::OUString& rCommandURL ) +{ + mxStatusListener->removeStatusListener( rCommandURL ); +} +// -------------------------------------------------------------------- + + +void ToolbarMenu::UpdateStatus( const rtl::OUString& rCommandURL ) +{ + mxStatusListener->updateStatus( rCommandURL ); +} + +// -------------------------------------------------------------------- + +// XStatusListener (subclasses must override this one to get the status updates +void SAL_CALL ToolbarMenu::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& /*Event*/ ) throw ( ::com::sun::star::uno::RuntimeException ) +{ +} + +// -------------------------------------------------------------------- + +class ToolbarMenuStatusListener : public svt::FrameStatusListener +{ +public: + ToolbarMenuStatusListener( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, + ToolbarMenu& rToolbarMenu ); + + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + ToolbarMenu* mpMenu; +}; + +ToolbarMenuStatusListener::ToolbarMenuStatusListener( + const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, + ToolbarMenu& rToolbarMenu ) +: svt::FrameStatusListener( xServiceManager, xFrame ) +, mpMenu( &rToolbarMenu ) +{ +} + +void SAL_CALL ToolbarMenuStatusListener::dispose() throw (::com::sun::star::uno::RuntimeException) +{ + mpMenu = 0; + svt::FrameStatusListener::dispose(); +} + +void SAL_CALL ToolbarMenuStatusListener::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) +{ + if( mpMenu ) + mpMenu->statusChanged( Event ); +} + +void ToolbarMenu::initStatusListener() +{ + if( !mxStatusListener.is() ) + mxStatusListener.set( new ToolbarMenuStatusListener( mxServiceManager, mxFrame, *this ) ); +} + +bool ToolbarMenu::IsInPopupMode() +{ + return GetDockingManager()->IsInPopupMode(this); +} + +void ToolbarMenu::EndPopupMode() +{ + GetDockingManager()->EndPopupMode(this); +} + + -- cgit From 8f5509e83dbd92e7f8660c58241d782ec99f626e Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Tue, 19 Jan 2010 12:13:46 +0100 Subject: #i107721# tab-order and travel select fixed --- svx/source/dialog/thesdlg.cxx | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'svx') diff --git a/svx/source/dialog/thesdlg.cxx b/svx/source/dialog/thesdlg.cxx index 25dca8f3cc4a..9fdca370c535 100755 --- a/svx/source/dialog/thesdlg.cxx +++ b/svx/source/dialog/thesdlg.cxx @@ -233,17 +233,16 @@ struct SvxThesaurusDialog_Impl { FixedText aWordText; ListBox aWordLB; - FixedText aReplaceText; - Edit aReplaceEdit; + MenuButton aLangMBtn; FixedText m_aAlternativesText; boost::shared_ptr< ThesaurusAlternativesCtrl_Impl > m_pAlternativesCT; + FixedText aReplaceText; + Edit aReplaceEdit; + PushButton aLookUpBtn; FixedLine aFL; - + HelpButton aHelpBtn; OKButton aOkBtn; CancelButton aCancelBtn; - PushButton aLookUpBtn; - MenuButton aLangMBtn; - HelpButton aHelpBtn; String aErrStr; @@ -251,7 +250,7 @@ struct SvxThesaurusDialog_Impl OUString aLookUpText; LanguageType nLookUpLanguage; - SfxErrorContext* pErrContext; // ErrorContext, w"ahrend der Dialog oben ist + SfxErrorContext* pErrContext; // error context while dfalog is opened SvxThesaurusDialog_Impl( Window* pParent ); @@ -262,16 +261,16 @@ struct SvxThesaurusDialog_Impl SvxThesaurusDialog_Impl::SvxThesaurusDialog_Impl( Window* pParent ) : aWordText ( pParent, SVX_RES( FT_WORD ) ), aWordLB ( pParent, SVX_RES( LB_WORD ) ), - aReplaceText ( pParent, SVX_RES( FT_REPL ) ), - aReplaceEdit ( pParent, SVX_RES( ED_REPL ) ), + aLangMBtn ( pParent, SVX_RES( MB_LANGUAGE ) ), m_aAlternativesText ( pParent, SVX_RES( FT_THES_ALTERNATIVES ) ), m_pAlternativesCT ( new ThesaurusAlternativesCtrl_Impl( pParent ) ), + aReplaceText ( pParent, SVX_RES( FT_REPL ) ), + aReplaceEdit ( pParent, SVX_RES( ED_REPL ) ), + aLookUpBtn ( pParent, SVX_RES( BTN_LOOKUP ) ), aFL ( pParent, SVX_RES( FL_VAR ) ), + aHelpBtn ( pParent, SVX_RES( BTN_THES_HELP ) ), aOkBtn ( pParent, SVX_RES( BTN_THES_OK ) ), aCancelBtn ( pParent, SVX_RES( BTN_THES_CANCEL ) ), - aLookUpBtn ( pParent, SVX_RES( BTN_LOOKUP ) ), - aLangMBtn ( pParent, SVX_RES( MB_LANGUAGE ) ), - aHelpBtn ( pParent, SVX_RES( BTN_THES_HELP ) ), aErrStr ( SVX_RES( STR_ERR_WORDNOTFOUND ) ), xThesaurus ( NULL ), aLookUpText (), @@ -308,9 +307,9 @@ SvxThesaurusDialog::SvxThesaurusDialog( FreeResource(); + m_pImpl->aWordLB.SetSelectHdl( LINK( this, SvxThesaurusDialog, WordSelectHdl_Impl ) ); m_pImpl->aLangMBtn.SetSelectHdl( LINK( this, SvxThesaurusDialog, LanguageHdl_Impl ) ); m_pImpl->aLookUpBtn.SetClickHdl( LINK( this, SvxThesaurusDialog, LookUpHdl_Impl ) ); - m_pImpl->aWordLB.SetSelectHdl( LINK( this, SvxThesaurusDialog, WordSelectHdl_Impl ) ); m_pImpl->m_pAlternativesCT->SetSelectHdl( LINK( this, SvxThesaurusDialog, AlternativesSelectHdl_Impl )); m_pImpl->m_pAlternativesCT->SetDoubleClickHdl( LINK( this, SvxThesaurusDialog, AlternativesDoubleClickHdl_Impl )); @@ -491,6 +490,7 @@ IMPL_LINK( SvxThesaurusDialog, LookUpHdl_Impl, Button *, pBtn ) m_pImpl->aWordLB.SelectEntry( aText ); m_pImpl->aReplaceEdit.SetText( String() ); + m_pImpl->m_pAlternativesCT->GrabFocus(); return 0; } @@ -499,11 +499,14 @@ IMPL_LINK( SvxThesaurusDialog, LookUpHdl_Impl, Button *, pBtn ) IMPL_LINK( SvxThesaurusDialog, WordSelectHdl_Impl, ListBox *, pBox ) { - String aStr( pBox->GetSelectEntry() ); - GetReplaceEditString( aStr ); - m_pImpl->aReplaceEdit.SetText( aStr ); + if (!m_pImpl->aWordLB.IsTravelSelect()) // act only upon return key and not when traveling with cursor keys + { + String aStr( pBox->GetSelectEntry() ); + GetReplaceEditString( aStr ); + m_pImpl->aReplaceEdit.SetText( aStr ); - LookUpHdl_Impl( &m_pImpl->aCancelBtn ); + LookUpHdl_Impl( &m_pImpl->aCancelBtn ); + } return 0; } -- cgit From c5d06228178634cf099226a5edf16170bbd1a42b Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Tue, 19 Jan 2010 18:24:27 +0100 Subject: updated title rendering --- svx/source/tbxctrls/toolbarmenu.cxx | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'svx') diff --git a/svx/source/tbxctrls/toolbarmenu.cxx b/svx/source/tbxctrls/toolbarmenu.cxx index 9867210b41af..5de3e8627687 100644 --- a/svx/source/tbxctrls/toolbarmenu.cxx +++ b/svx/source/tbxctrls/toolbarmenu.cxx @@ -44,8 +44,8 @@ const int EXTRAITEMHEIGHT = 4; const int SEPARATOR_HEIGHT = 6; const int TITLE_ID = -1; -const int BORDER_X = 3; -const int BORDER_Y = 3; +const int BORDER_X = 0; +const int BORDER_Y = 0; class ToolbarMenuEntry { @@ -947,25 +947,13 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) if( bTitle ) { - Rectangle aRect( aTopLeft, Size( aOutSz.Width(), pEntry->maSize.Height() ) ); - aRect.nLeft += 2; - aRect.nTop += 2; - aRect.nRight -= 4; - aRect.nBottom -= 4; - // fill the background - Color aColor (rSettings.GetDialogColor()); - - SetFillColor (aColor); - SetLineColor (); + Rectangle aRect( aTopLeft, Size( aOutSz.Width(), pEntry->maSize.Height() ) ); + SetFillColor(rSettings.GetDialogColor()); + SetLineColor(); DrawRect(aRect); - - // Erase the four corner pixels to make the rectangle appear rounded. - SetLineColor( rSettings.GetMenuColor()); - DrawPixel( aRect.TopLeft()); - DrawPixel( Point(aRect.Right(), aRect.Top())); - DrawPixel( Point(aRect.Left(), aRect.Bottom())); - DrawPixel( Point(aRect.Right(), aRect.Bottom())); + SetLineColor( rSettings.GetShadowColor() ); + DrawLine( aRect.BottomLeft(), aRect.BottomRight() ); } long nTextOffsetY = ((pEntry->maSize.Height()-nFontHeight)/2); -- cgit From 8e071e3e2a509c15afcbbfcdf2b0e3bf404c25f5 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Wed, 20 Jan 2010 10:46:21 +0100 Subject: #i107721# setting selection after double click fixed --- svx/inc/svx/thesdlg.hxx | 2 ++ svx/source/dialog/thesdlg.cxx | 53 ++++++++++++++++++++++++++++++++----------- svx/source/dialog/thesdlg.src | 4 ++-- 3 files changed, 44 insertions(+), 15 deletions(-) (limited to 'svx') diff --git a/svx/inc/svx/thesdlg.hxx b/svx/inc/svx/thesdlg.hxx index 9ec4d21f7549..f3687496b6bb 100755 --- a/svx/inc/svx/thesdlg.hxx +++ b/svx/inc/svx/thesdlg.hxx @@ -67,6 +67,8 @@ class SVX_DLLPUBLIC SvxThesaurusDialog : public SvxStandardDialog DECL_LINK( WordSelectHdl_Impl, ListBox * ); DECL_LINK( AlternativesSelectHdl_Impl, SvxCheckListBox * ); DECL_LINK( AlternativesDoubleClickHdl_Impl, SvxCheckListBox * ); + + DECL_STATIC_LINK( SvxThesaurusDialog, SelectFirstHdl_Impl, SvxCheckListBox * ); #endif SVX_DLLPRIVATE virtual void Apply(); diff --git a/svx/source/dialog/thesdlg.cxx b/svx/source/dialog/thesdlg.cxx index 9fdca370c535..ebed699ad0f6 100755 --- a/svx/source/dialog/thesdlg.cxx +++ b/svx/source/dialog/thesdlg.cxx @@ -405,17 +405,18 @@ sal_uInt16 SvxThesaurusDialog::GetLanguage() const bool SvxThesaurusDialog::UpdateAlternativesBox_Impl() { + lang::Locale aLocale( SvxCreateLocale( m_pImpl->nLookUpLanguage ) ); + uno::Sequence< uno::Reference< linguistic2::XMeaning > > aMeanings = queryMeanings_Impl( + m_pImpl->aLookUpText, aLocale, uno::Sequence< beans::PropertyValue >() ); + const sal_Int32 nMeanings = aMeanings.getLength(); + const uno::Reference< linguistic2::XMeaning > *pMeanings = aMeanings.getConstArray(); + // clear old user data of control before creating new ones via AddEntry below m_pImpl->m_pAlternativesCT->ClearUserData(); m_pImpl->m_pAlternativesCT->Clear(); m_pImpl->m_pAlternativesCT->SetUpdateMode( FALSE ); - lang::Locale aLocale( SvxCreateLocale( m_pImpl->nLookUpLanguage ) ); - uno::Sequence< uno::Reference< linguistic2::XMeaning > > aMeanings = queryMeanings_Impl( - m_pImpl->aLookUpText, aLocale, uno::Sequence< beans::PropertyValue >() ); - const sal_Int32 nMeanings = aMeanings.getLength(); - const uno::Reference< linguistic2::XMeaning > *pMeanings = aMeanings.getConstArray(); for (sal_Int32 i = 0; i < nMeanings; ++i) { OUString rMeaningTxt = pMeanings[i]->getMeaning(); @@ -467,14 +468,16 @@ IMPL_LINK( SvxThesaurusDialog, LanguageHdl_Impl, MenuButton *, pBtn ) if (m_pImpl->xThesaurus->hasLocale( SvxCreateLocale( nLang ) )) m_pImpl->nLookUpLanguage = nLang; SetWindowTitle( nLang ); - UpdateAlternativesBox_Impl(); + bool bWordFound = UpdateAlternativesBox_Impl(); + if (!bWordFound) + InfoBox( this, m_pImpl->aErrStr ).Execute(); } return 0; } // ----------------------------------------------------------------------- -IMPL_LINK( SvxThesaurusDialog, LookUpHdl_Impl, Button *, pBtn ) +IMPL_LINK( SvxThesaurusDialog, LookUpHdl_Impl, Button *, EMPTYARG /*pBtn*/ ) { String aText( m_pImpl->aReplaceEdit.GetText() ); @@ -490,6 +493,7 @@ IMPL_LINK( SvxThesaurusDialog, LookUpHdl_Impl, Button *, pBtn ) m_pImpl->aWordLB.SelectEntry( aText ); m_pImpl->aReplaceEdit.SetText( String() ); + m_pImpl->aOkBtn.Enable( FALSE ); m_pImpl->m_pAlternativesCT->GrabFocus(); return 0; @@ -504,8 +508,9 @@ IMPL_LINK( SvxThesaurusDialog, WordSelectHdl_Impl, ListBox *, pBox ) String aStr( pBox->GetSelectEntry() ); GetReplaceEditString( aStr ); m_pImpl->aReplaceEdit.SetText( aStr ); + m_pImpl->aOkBtn.Enable( aStr.Len() > 0 ); - LookUpHdl_Impl( &m_pImpl->aCancelBtn ); + LookUpHdl_Impl( NULL ); } return 0; @@ -519,9 +524,14 @@ IMPL_LINK( SvxThesaurusDialog, AlternativesSelectHdl_Impl, SvxCheckListBox *, pB if (pEntry) { AlternativesUserData_Impl * pData = (AlternativesUserData_Impl *) pEntry->GetUserData(); - String aStr( pData->GetText() ); - GetReplaceEditString( aStr ); + String aStr; + if (!pData->IsHeader()) + { + aStr = pData->GetText(); + GetReplaceEditString( aStr ); + } m_pImpl->aReplaceEdit.SetText( aStr ); + m_pImpl->aOkBtn.Enable( aStr.Len() > 0 ); } return 0; } @@ -534,12 +544,29 @@ IMPL_LINK( SvxThesaurusDialog, AlternativesDoubleClickHdl_Impl, SvxCheckListBox if (pEntry) { AlternativesUserData_Impl * pData = (AlternativesUserData_Impl *) pEntry->GetUserData(); - String aStr( pData->GetText() ); - GetReplaceEditString( aStr ); + String aStr; + if (!pData->IsHeader()) + { + aStr = pData->GetText(); + GetReplaceEditString( aStr ); + } m_pImpl->aReplaceEdit.SetText( aStr ); - LookUpHdl_Impl( &m_pImpl->aCancelBtn ); + m_pImpl->aOkBtn.Enable( aStr.Len() > 0 ); + + if (aStr.Len() > 0) + LookUpHdl_Impl( NULL ); } + + //! workaround to set the selection since calling SelectEntryPos within + //! the double click handler does not work + Application::PostUserEvent( STATIC_LINK( this, SvxThesaurusDialog, SelectFirstHdl_Impl ), pBox ); return 0; } +IMPL_STATIC_LINK( SvxThesaurusDialog, SelectFirstHdl_Impl, SvxCheckListBox *, pBox ) +{ + if (pBox && pBox->GetEntryCount() > 0) + pBox->SelectEntryPos( 0 ); + return 0; +} \ No newline at end of file diff --git a/svx/source/dialog/thesdlg.src b/svx/source/dialog/thesdlg.src index 9af5fc0b49a5..6e7ea88ceff2 100755 --- a/svx/source/dialog/thesdlg.src +++ b/svx/source/dialog/thesdlg.src @@ -116,8 +116,8 @@ ModalDialog RID_SVXDLG_THESAURUS }; OkButton BTN_THES_OK { - Pos = MAP_APPFONT ( 70 , 210 ) ; - Size = MAP_APPFONT ( 79 , 14 ) ; + Pos = MAP_APPFONT ( 89 , 210 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; Text [ en-US ] = "~Replace" ; DefButton = TRUE ; }; -- cgit From ed22274c92f84abaebc53b5ddac922964894943d Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Wed, 20 Jan 2010 12:41:09 +0100 Subject: cws tl74: warning-free code --- svx/source/dialog/thesdlg.cxx | 122 +++++++++++++++++++++--------------------- svx/source/dialog/thesdlg.hrc | 0 svx/source/dialog/thesdlg.src | 0 3 files changed, 62 insertions(+), 60 deletions(-) mode change 100755 => 100644 svx/source/dialog/thesdlg.cxx mode change 100755 => 100644 svx/source/dialog/thesdlg.hrc mode change 100755 => 100644 svx/source/dialog/thesdlg.src (limited to 'svx') diff --git a/svx/source/dialog/thesdlg.cxx b/svx/source/dialog/thesdlg.cxx old mode 100755 new mode 100644 index ebed699ad0f6..afe53e0865a7 --- a/svx/source/dialog/thesdlg.cxx +++ b/svx/source/dialog/thesdlg.cxx @@ -39,10 +39,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include @@ -189,8 +189,8 @@ ThesaurusAlternativesCtrl_Impl::~ThesaurusAlternativesCtrl_Impl() void ThesaurusAlternativesCtrl_Impl::ClearUserData() { - for (USHORT i = 0; i < GetEntryCount(); ++i) - delete (AlternativesUserData_Impl*)GetEntry(i)->GetUserData(); + for (USHORT i = 0; i < GetEntryCount(); ++i) + delete (AlternativesUserData_Impl*)GetEntry(i)->GetUserData(); } @@ -208,10 +208,10 @@ SvLBoxEntry * ThesaurusAlternativesCtrl_Impl::AddEntry( sal_Int32 nVal, const St pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0 ) ); // otherwise crash pEntry->AddItem( new AlternativesString_Impl( pEntry, 0, aText ) ); - AlternativesUserData_Impl* pUserData = new AlternativesUserData_Impl( rText, bIsHeader ); - pEntry->SetUserData( pUserData ); - GetModel()->Insert( pEntry ); - + AlternativesUserData_Impl* pUserData = new AlternativesUserData_Impl( rText, bIsHeader ); + pEntry->SetUserData( pUserData ); + GetModel()->Insert( pEntry ); + return pEntry; } @@ -231,30 +231,30 @@ void ThesaurusAlternativesCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) struct SvxThesaurusDialog_Impl { - FixedText aWordText; - ListBox aWordLB; - MenuButton aLangMBtn; - FixedText m_aAlternativesText; - boost::shared_ptr< ThesaurusAlternativesCtrl_Impl > m_pAlternativesCT; - FixedText aReplaceText; - Edit aReplaceEdit; - PushButton aLookUpBtn; - FixedLine aFL; - HelpButton aHelpBtn; - OKButton aOkBtn; - CancelButton aCancelBtn; - - String aErrStr; - + FixedText aWordText; + ListBox aWordLB; + MenuButton aLangMBtn; + FixedText m_aAlternativesText; + boost::shared_ptr< ThesaurusAlternativesCtrl_Impl > m_pAlternativesCT; + FixedText aReplaceText; + Edit aReplaceEdit; + PushButton aLookUpBtn; + FixedLine aFL; + HelpButton aHelpBtn; + OKButton aOkBtn; + CancelButton aCancelBtn; + + String aErrStr; + uno::Reference< linguistic2::XThesaurus > xThesaurus; OUString aLookUpText; LanguageType nLookUpLanguage; SfxErrorContext* pErrContext; // error context while dfalog is opened - - - SvxThesaurusDialog_Impl( Window* pParent ); - ~SvxThesaurusDialog_Impl(); + + + SvxThesaurusDialog_Impl( Window* pParent ); + ~SvxThesaurusDialog_Impl(); }; @@ -308,7 +308,7 @@ SvxThesaurusDialog::SvxThesaurusDialog( FreeResource(); m_pImpl->aWordLB.SetSelectHdl( LINK( this, SvxThesaurusDialog, WordSelectHdl_Impl ) ); - m_pImpl->aLangMBtn.SetSelectHdl( LINK( this, SvxThesaurusDialog, LanguageHdl_Impl ) ); + m_pImpl->aLangMBtn.SetSelectHdl( LINK( this, SvxThesaurusDialog, LanguageHdl_Impl ) ); m_pImpl->aLookUpBtn.SetClickHdl( LINK( this, SvxThesaurusDialog, LookUpHdl_Impl ) ); m_pImpl->m_pAlternativesCT->SetSelectHdl( LINK( this, SvxThesaurusDialog, AlternativesSelectHdl_Impl )); m_pImpl->m_pAlternativesCT->SetDoubleClickHdl( LINK( this, SvxThesaurusDialog, AlternativesDoubleClickHdl_Impl )); @@ -331,20 +331,20 @@ SvxThesaurusDialog::SvxThesaurusDialog( aLocales = m_pImpl->xThesaurus->getLocales(); const sal_Int32 nLocales = aLocales.getLength(); const lang::Locale *pLocales = aLocales.getConstArray(); - delete m_pImpl->aLangMBtn.GetPopupMenu(); + delete m_pImpl->aLangMBtn.GetPopupMenu(); PopupMenu* pMenu = new PopupMenu; pMenu->SetMenuFlags( MENU_FLAG_NOAUTOMNEMONICS ); - std::vector< OUString > aLangVec; - for (sal_Int32 i = 0; i < nLocales; ++i ) - { - const LanguageType nLang = SvxLocaleToLanguage( pLocales[i] ); - DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" ); - aLangVec.push_back( aLangTab.GetString( nLang ) ); - } - std::sort( aLangVec.begin(), aLangVec.end() ); - for (size_t i = 0; i < aLangVec.size(); ++i) - pMenu->InsertItem( (USHORT)i+1, aLangVec[i] ); // menu items should be enumerated from 1 and not 0 - m_pImpl->aLangMBtn.SetPopupMenu( pMenu ); + std::vector< OUString > aLangVec; + for (sal_Int32 i = 0; i < nLocales; ++i ) + { + const LanguageType nLang = SvxLocaleToLanguage( pLocales[i] ); + DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" ); + aLangVec.push_back( aLangTab.GetString( nLang ) ); + } + std::sort( aLangVec.begin(), aLangVec.end() ); + for (size_t i = 0; i < aLangVec.size(); ++i) + pMenu->InsertItem( (USHORT)i+1, aLangVec[i] ); // menu items should be enumerated from 1 and not 0 + m_pImpl->aLangMBtn.SetPopupMenu( pMenu ); // disable controls if service is missing if (!m_pImpl->xThesaurus.is()) @@ -388,11 +388,11 @@ uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL SvxThesaurusDi } // ----------------------------------------------------------------------- - -String SvxThesaurusDialog::GetWord() -{ - return m_pImpl->aReplaceEdit.GetText(); -} + +String SvxThesaurusDialog::GetWord() +{ + return m_pImpl->aReplaceEdit.GetText(); +} // ----------------------------------------------------------------------- @@ -455,8 +455,8 @@ void SvxThesaurusDialog::SetWindowTitle(sal_Int16 nLanguage) } // ----------------------------------------------------------------------- - -IMPL_LINK( SvxThesaurusDialog, LanguageHdl_Impl, MenuButton *, pBtn ) + +IMPL_LINK( SvxThesaurusDialog, LanguageHdl_Impl, MenuButton *, pBtn ) { PopupMenu *pMenu = m_pImpl->aLangMBtn.GetPopupMenu(); if (pMenu && pBtn) @@ -464,11 +464,11 @@ IMPL_LINK( SvxThesaurusDialog, LanguageHdl_Impl, MenuButton *, pBtn ) USHORT nItem = pBtn->GetCurItemId(); String aLangText( pMenu->GetItemText( nItem ) ); LanguageType nLang = SvtLanguageTable().GetType( aLangText ); - DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" ); - if (m_pImpl->xThesaurus->hasLocale( SvxCreateLocale( nLang ) )) - m_pImpl->nLookUpLanguage = nLang; - SetWindowTitle( nLang ); - bool bWordFound = UpdateAlternativesBox_Impl(); + DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" ); + if (m_pImpl->xThesaurus->hasLocale( SvxCreateLocale( nLang ) )) + m_pImpl->nLookUpLanguage = nLang; + SetWindowTitle( nLang ); + bool bWordFound = UpdateAlternativesBox_Impl(); if (!bWordFound) InfoBox( this, m_pImpl->aErrStr ).Execute(); } @@ -564,9 +564,11 @@ IMPL_LINK( SvxThesaurusDialog, AlternativesDoubleClickHdl_Impl, SvxCheckListBox } -IMPL_STATIC_LINK( SvxThesaurusDialog, SelectFirstHdl_Impl, SvxCheckListBox *, pBox ) -{ - if (pBox && pBox->GetEntryCount() > 0) - pBox->SelectEntryPos( 0 ); - return 0; -} \ No newline at end of file +IMPL_STATIC_LINK( SvxThesaurusDialog, SelectFirstHdl_Impl, SvxCheckListBox *, pBox ) +{ + (void) pThis; + if (pBox && pBox->GetEntryCount() > 0) + pBox->SelectEntryPos( 0 ); + return 0; +} + diff --git a/svx/source/dialog/thesdlg.hrc b/svx/source/dialog/thesdlg.hrc old mode 100755 new mode 100644 diff --git a/svx/source/dialog/thesdlg.src b/svx/source/dialog/thesdlg.src old mode 100755 new mode 100644 -- cgit From 1a409343f786de0ed1386eecb5918863e696df6d Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Thu, 21 Jan 2010 18:30:51 +0100 Subject: fixed new listeners for extrusion and fontwork controllers --- svx/source/tbxctrls/extrusioncontrols.cxx | 21 +++--- svx/source/tbxctrls/fontworkgallery.cxx | 6 +- svx/source/tbxctrls/toolbarmenu.cxx | 108 ++++++++++++------------------ 3 files changed, 55 insertions(+), 80 deletions(-) (limited to 'svx') diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx index 972a9b951bc1..e5f22073d60c 100644 --- a/svx/source/tbxctrls/extrusioncontrols.cxx +++ b/svx/source/tbxctrls/extrusioncontrols.cxx @@ -126,7 +126,7 @@ void ExtrusionDirectionWindow::implInit() mpDirectionSet->SetOutputSizePixel( Size( 72, 72 ) ); /*mpMenu->*/appendEntry( 2, mpDirectionSet ); - /*mpMenu->*/appendSeparator(); + /*mpMenu->appendSeparator()*/; /*mpMenu->*/appendEntry( 0, String( SVX_RES( STR_PERSPECTIVE ) ), bHighContrast ? maImgPerspectiveH : maImgPerspective ); /*mpMenu->*/appendEntry( 1, String( SVX_RES( STR_PARALLEL ) ), bHighContrast ? maImgParallelH : maImgParallel ); @@ -143,9 +143,6 @@ void ExtrusionDirectionWindow::implInit() void ExtrusionDirectionWindow::DataChanged( const DataChangedEvent& rDCEvt ) { - AddStatusListener( msExtrusionDirection ); - AddStatusListener( msExtrusionProjection ); - ToolbarMenu::DataChanged( rDCEvt ); if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) @@ -215,7 +212,7 @@ void ExtrusionDirectionWindow::implSetProjection( sal_Int32 nProjection, bool bE void SAL_CALL ExtrusionDirectionWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) { - if( Event.FeatureURL.Path.equals( msExtrusionDirection ) ) + if( Event.FeatureURL.Main.equals( msExtrusionDirection ) ) { if( !Event.IsEnabled ) { @@ -228,7 +225,7 @@ void SAL_CALL ExtrusionDirectionWindow::statusChanged( const ::com::sun::star::f implSetDirection( nValue, true ); } } - else if( Event.FeatureURL.Path.equals( msExtrusionProjection ) ) + else if( Event.FeatureURL.Main.equals( msExtrusionProjection ) ) { if( !Event.IsEnabled ) { @@ -512,7 +509,7 @@ void ExtrusionDepthWindow::implFillStrings( FieldUnit eUnit ) void SAL_CALL ExtrusionDepthWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) { - if( Event.FeatureURL.Path.equals( msExtrusionDepth ) ) + if( Event.FeatureURL.Main.equals( msExtrusionDepth ) ) { if( !Event.IsEnabled ) { @@ -525,7 +522,7 @@ void SAL_CALL ExtrusionDepthWindow::statusChanged( const ::com::sun::star::frame implSetDepth( fValue, true ); } } - else if( Event.FeatureURL.Path.equals( msMetricUnit ) ) + else if( Event.FeatureURL.Main.equals( msMetricUnit ) ) { if( Event.IsEnabled ) { @@ -765,7 +762,7 @@ void ExtrusionLightingWindow::implInit() mpLightingSet->SetOutputSizePixel( Size( 72, 72 ) ); /*mpMenu->*/appendEntry( 3, mpLightingSet ); - /*mpMenu->*/appendSeparator(); + /*mpMenu->appendSeparator();*/ /*mpMenu->*/appendEntry( 0, String( SVX_RES( STR_BRIGHT ) ), bHighContrast ? maImgBrighth : maImgBright ); /*mpMenu->*/appendEntry( 1, String( SVX_RES( STR_NORMAL ) ), bHighContrast ? maImgNormalh : maImgNormal ); /*mpMenu->*/appendEntry( 2, String( SVX_RES( STR_DIM ) ), bHighContrast ? maImgDimh : maImgDim ); @@ -841,7 +838,7 @@ void ExtrusionLightingWindow::implSetDirection( int nDirection, bool bEnabled ) void SAL_CALL ExtrusionLightingWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) { - if( Event.FeatureURL.Path.equals( msExtrusionLightingIntensity ) ) + if( Event.FeatureURL.Main.equals( msExtrusionLightingIntensity ) ) { if( !Event.IsEnabled ) { @@ -854,7 +851,7 @@ void SAL_CALL ExtrusionLightingWindow::statusChanged( const ::com::sun::star::fr implSetIntensity( nValue, true ); } } - else if( Event.FeatureURL.Path.equals( msExtrusionLightingDirection ) ) + else if( Event.FeatureURL.Main.equals( msExtrusionLightingDirection ) ) { if( !Event.IsEnabled ) { @@ -1088,7 +1085,7 @@ void ExtrusionSurfaceWindow::implSetSurface( int nSurface, bool bEnabled ) void SAL_CALL ExtrusionSurfaceWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) { - if( Event.FeatureURL.Path.equals( msExtrusionSurface ) ) + if( Event.FeatureURL.Main.equals( msExtrusionSurface ) ) { if( !Event.IsEnabled ) { diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx index b6cd012f9aea..2148d116db1a 100644 --- a/svx/source/tbxctrls/fontworkgallery.cxx +++ b/svx/source/tbxctrls/fontworkgallery.cxx @@ -404,7 +404,7 @@ void FontWorkAlignmentWindow::implSetAlignment( int nSurface, bool bEnabled ) void SAL_CALL FontWorkAlignmentWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) { - if( Event.FeatureURL.Path.equals( msFontworkAlignment ) ) + if( Event.FeatureURL.Main.equals( msFontworkAlignment ) ) { if( !Event.IsEnabled ) { @@ -611,7 +611,7 @@ void FontWorkCharacterSpacingWindow::implSetKernCharacterPairs( sal_Bool, bool b void SAL_CALL FontWorkCharacterSpacingWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) { - if( Event.FeatureURL.Path.equals( msFontworkCharacterSpacing ) ) + if( Event.FeatureURL.Main.equals( msFontworkCharacterSpacing ) ) { if( !Event.IsEnabled ) { @@ -624,7 +624,7 @@ void SAL_CALL FontWorkCharacterSpacingWindow::statusChanged( const ::com::sun::s implSetCharacterSpacing( nValue, true ); } } - else if( Event.FeatureURL.Path.equals( msFontworkKernCharacterPairs ) ) + else if( Event.FeatureURL.Main.equals( msFontworkKernCharacterPairs ) ) { if( !Event.IsEnabled ) { diff --git a/svx/source/tbxctrls/toolbarmenu.cxx b/svx/source/tbxctrls/toolbarmenu.cxx index 5de3e8627687..7c739064bdfa 100644 --- a/svx/source/tbxctrls/toolbarmenu.cxx +++ b/svx/source/tbxctrls/toolbarmenu.cxx @@ -41,8 +41,8 @@ #include "svx/toolbarmenu.hxx" -const int EXTRAITEMHEIGHT = 4; -const int SEPARATOR_HEIGHT = 6; +const int EXTRAITEMHEIGHT = 0; // 4; +const int SEPARATOR_HEIGHT = 4; const int TITLE_ID = -1; const int BORDER_X = 0; const int BORDER_Y = 0; @@ -404,11 +404,8 @@ Size ToolbarMenu::implCalcSize() Size aControlSize( pEntry->mpControl->GetOutputSizePixel() ); nMaxTextWidth = Max( aControlSize.Width(), nMaxTextWidth ); - pEntry->maSize.Height() = Max( aControlSize.Height(), pEntry->maSize.Height() ); + pEntry->maSize.Height() = Max( aControlSize.Height(), pEntry->maSize.Height() ) + 1; } - - pEntry->maSize.Height() += EXTRAITEMHEIGHT; - aSz.Height() += pEntry->maSize.Height(); } else @@ -551,25 +548,21 @@ void ToolbarMenu::implHighlightEntry( int nHighlightEntry, bool bHighlight ) { if(nEntry == nHighlightEntry) { - SetFillColor( GetSettings().GetStyleSettings().GetMenuColor() ); - - Rectangle aRect( Point( nX, nY ), Size( aSz.Width()-(BORDER_X<<1), p->maSize.Height() ) ); -/* - if( p->mnBits & MIB_POPUPSELECT ) + if( (p->mpControl == NULL) || (p->mbHasText) ) { - long nFontHeight = GetTextHeight(); - aRect.Right() -= nFontHeight + nFontHeight/4; - } - DrawRect( aRect ); -*/ + Rectangle aRect( Point( nX, nY ), Size( aSz.Width()-(BORDER_X<<1), p->maSize.Height() ) ); + SetFillColor( GetSettings().GetStyleSettings().GetMenuColor() ); + SetLineColor(); + DrawRect( aRect ); - if( bHighlight && ((p->mpControl == NULL) || (p->mbHasText)) ) - { - aRect.nLeft += 1; - aRect.nTop += 1; - aRect.nBottom -= 1; - aRect.nRight -= 1; - DrawSelectionBackground( aRect, true, false, TRUE, TRUE ); + if( bHighlight ) + { + aRect.nLeft += 1; + aRect.nTop += 1; + aRect.nBottom -= 1; + aRect.nRight -= 1; + DrawSelectionBackground( aRect, true, false, TRUE, TRUE ); + } } implPaint( p, bHighlight ); @@ -632,27 +625,31 @@ void ToolbarMenu::implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown ) for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) { ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; - if( pEntry && (pEntry->mnEntryId != TITLE_ID) ) + if( pEntry ) { long nOldY = nY; nY += pEntry->maSize.Height(); - if ( ( nOldY <= nMouseY ) && ( nY > nMouseY ) ) + + if( pEntry->mnEntryId != TITLE_ID ) { - if( bMBDown ) + if ( ( nOldY <= nMouseY ) && ( nY > nMouseY ) ) { - if( nEntry != mnHighlightedEntry ) + if( bMBDown ) { - implChangeHighlightEntry( nEntry ); + if( nEntry != mnHighlightedEntry ) + { + implChangeHighlightEntry( nEntry ); + } } - } - else - { - if ( nEntry != mnHighlightedEntry ) + else { - implChangeHighlightEntry( nEntry ); + if ( nEntry != mnHighlightedEntry ) + { + implChangeHighlightEntry( nEntry ); + } } + bHighlighted = true; } - bHighlighted = true; } } else @@ -671,20 +668,18 @@ void ToolbarMenu::implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown ) void ToolbarMenu::implChangeHighlightEntry( int nEntry ) { -/* if( mnHighlightedEntry != -1 ) { implHighlightEntry( mnHighlightedEntry, false ); } -*/ + mnHighlightedEntry = nEntry; - Invalidate(); - /* +// Invalidate(); + if( mnHighlightedEntry != -1 ) { implHighlightEntry( mnHighlightedEntry, true ); } - */ } ToolbarMenuEntry* ToolbarMenu::implCursorUpDown( bool bUp, bool bHomeEnd ) @@ -864,28 +859,6 @@ void ToolbarMenu::KeyInput( const KeyEvent& rKEvent ) } } -/* -void ToolbarMenu::implDrawBorder() -{ - SetFillColor(); - SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() ); - Point aPt; - Rectangle aRect( aPt, GetOutputSizePixel() ); - - Region oldClipRgn( GetClipRegion( ) ); - Region aClipRgn( aRect ); - Rectangle aItemClipRect( ImplGetItemEdgeClipRect() ); - if( !aItemClipRect.IsEmpty() ) - { - aItemClipRect.SetPos( AbsoluteScreenToOutputPixel( aItemClipRect.TopLeft() ) ); - aClipRgn.Exclude( aItemClipRect ); - SetClipRegion( aClipRgn ); - } - DrawRect( aRect ); - SetClipRegion( oldClipRgn ); -} -*/ - void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) { const long nFontHeight = GetTextHeight(); @@ -895,7 +868,6 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) const StyleSettings& rSettings = GetSettings().GetStyleSettings(); const Size aOutSz( GetOutputSizePixel() ); -// const long nMaxY = aOutSz.Height(); Point aTopLeft( BORDER_X, BORDER_Y ), aTmpPos; @@ -922,7 +894,6 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) if( pThisOnly == NULL ) { aTmpPos.Y() = aPos.Y() + ((SEPARATOR_HEIGHT-2)/2); - aTmpPos.X() = aPos.X() + 2; SetLineColor( rSettings.GetShadowColor() ); DrawLine( aTmpPos, Point( aOutSz.Width() - 3, aTmpPos.Y() ) ); @@ -945,13 +916,20 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) else SetTextColor( rSettings.GetMenuTextColor() ); + Rectangle aRect( aTopLeft, Size( aOutSz.Width(), pEntry->maSize.Height() ) ); if( bTitle ) { // fill the background - Rectangle aRect( aTopLeft, Size( aOutSz.Width(), pEntry->maSize.Height() ) ); SetFillColor(rSettings.GetDialogColor()); SetLineColor(); DrawRect(aRect); + SetLineColor( rSettings.GetLightColor() ); + DrawLine( aRect.TopLeft(), aRect.TopRight() ); + SetLineColor( rSettings.GetShadowColor() ); + DrawLine( aRect.BottomLeft(), aRect.BottomRight() ); + } + else if( pEntry->mpControl ) + { SetLineColor( rSettings.GetShadowColor() ); DrawLine( aRect.BottomLeft(), aRect.BottomRight() ); } @@ -976,6 +954,7 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) DrawCtrlText( aTmpPos, pEntry->maText, 0, pEntry->maText.Len(), nStyle ); } + // CheckMark if( pEntry->mbChecked ) { @@ -1025,7 +1004,6 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) void ToolbarMenu::Paint( const Rectangle& ) { -// implDrawBorder(); implPaint(); if( mnHighlightedEntry != -1 ) -- cgit From 02f6eae3aacc973f98fce99219ee74ddb75f2c9a Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Fri, 22 Jan 2010 08:14:22 +0100 Subject: dba33f: #i108548# extend SingleSelectQueryComposer appendFilterByColumn with additonal parameter --- svx/source/fmcomp/dbaexchange.cxx | 57 ++++++++------------------------------- svx/source/fmcomp/gridcell.cxx | 46 ++++++++++--------------------- 2 files changed, 25 insertions(+), 78 deletions(-) (limited to 'svx') diff --git a/svx/source/fmcomp/dbaexchange.cxx b/svx/source/fmcomp/dbaexchange.cxx index 99abbd9853f7..235cd57865ec 100644 --- a/svx/source/fmcomp/dbaexchange.cxx +++ b/svx/source/fmcomp/dbaexchange.cxx @@ -138,30 +138,19 @@ namespace svx { try { - // need a query composer for this - Reference< XSQLQueryComposerFactory > xComposerFac; - _rxForm->getPropertyValue(FM_PROP_ACTIVE_CONNECTION) >>= xComposerFac; - Reference< XSQLQueryComposer > xComposer; - if (xComposerFac.is()) - xComposer = xComposerFac->createQueryComposer(); - - if (xComposer.is()) + Reference< XTablesSupplier > xSupTab; + _rxForm->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SingleSelectQueryComposer"))) >>= xSupTab; + + if(xSupTab.is()) { - ::rtl::OUString sActiveCommand; - _rxForm->getPropertyValue(FM_PROP_ACTIVECOMMAND) >>= sActiveCommand; - xComposer->setQuery(sActiveCommand); - Reference< XTablesSupplier > xSupTab(xComposer, UNO_QUERY); - if(xSupTab.is()) + Reference< XNameAccess > xNames = xSupTab->getTables(); + if (xNames.is()) { - Reference< XNameAccess > xNames = xSupTab->getTables(); - if (xNames.is()) + Sequence< ::rtl::OUString > aTables = xNames->getElementNames(); + if (1 == aTables.getLength()) { - Sequence< ::rtl::OUString > aTables = xNames->getElementNames(); - if (1 == aTables.getLength()) - { - sCommand = aTables[0]; - nCommandType = CommandType::TABLE; - } + sCommand = aTables[0]; + nCommandType = CommandType::TABLE; } } } @@ -460,34 +449,10 @@ namespace svx String sObjectKind = (CommandType::TABLE == nObjectType) ? String('1') : String('0'); // check if the SQL-statement is modified - sal_Bool bHasFilterOrSort(sal_False); ::rtl::OUString sCompleteStatement; try { - ::rtl::OUString sFilter, sSort; - if (::cppu::any2bool(_rxLivingForm->getPropertyValue(FM_PROP_APPLYFILTER))) - _rxLivingForm->getPropertyValue(FM_PROP_FILTER) >>= sFilter; - _rxLivingForm->getPropertyValue(FM_PROP_SORT) >>= sSort; - bHasFilterOrSort = (sFilter.getLength()>0) || (sSort.getLength()>0); - _rxLivingForm->getPropertyValue(FM_PROP_ACTIVECOMMAND) >>= sCompleteStatement; - - // create a composer - Reference< XSQLQueryComposerFactory > xFactory( xConnection, UNO_QUERY ); - Reference< XSQLQueryComposer > xComposer; - if (xFactory.is()) - xComposer = xFactory->createQueryComposer(); - - // let the composer compose - if (xComposer.is()) - { - xComposer->setQuery(sCompleteStatement); - xComposer->setFilter(sFilter); - xComposer->setOrder(sSort); - sCompleteStatement = xComposer->getComposedQuery(); - } - // Usually, I would expect the result of the composing to be the same as the ActiveCommand property - // But this code here is pretty old, and I don't know wha the side effects are if I remove it now ... } catch(Exception&) { @@ -499,7 +464,7 @@ namespace svx ,sConnectionResource ,nObjectType ,sObjectName,xConnection - ,!((CommandType::QUERY == nObjectType) && !bHasFilterOrSort) + ,!((CommandType::QUERY == nObjectType)) ,sCompleteStatement); } diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index c94a63c853f4..92e8d9aebaa1 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -48,6 +48,8 @@ #include #include #include +#include +#include #include #include #include @@ -85,6 +87,7 @@ using namespace ::svt; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::form; @@ -3042,43 +3045,22 @@ void DbFilterField::Update() if (!xForm.is()) return; - Reference< XConnection > xConnection(getRowSetConnection(xForm)); - if (!xConnection.is()) - return; - - Reference< ::com::sun::star::sdb::XSQLQueryComposerFactory > xFactory(xConnection, UNO_QUERY); - if (!xFactory.is()) - { - DBG_ERROR("DbFilterField::Update : used the right place to request the ::com::sun::star::sdb::XSQLQueryComposerFactory interface ?"); - return; - } - - Reference< ::com::sun::star::sdb::XSQLQueryComposer > xComposer = xFactory->createQueryComposer(); - try - { - Reference< ::com::sun::star::beans::XPropertySet > xFormAsSet(xForm, UNO_QUERY); - ::rtl::OUString sStatement; - xFormAsSet->getPropertyValue(FM_PROP_ACTIVECOMMAND) >>= sStatement; - xComposer->setQuery(sStatement); - } - catch(const Exception&) - { - ::comphelper::disposeComponent(xComposer); - return; - } + Reference xFormProp(xForm,UNO_QUERY); + Reference< XTablesSupplier > xSupTab; + xFormProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SingleSelectQueryComposer"))) >>= xSupTab; - Reference< ::com::sun::star::beans::XPropertySet > xComposerAsSet(xComposer, UNO_QUERY); - if (!xComposerAsSet.is()) + Reference< XConnection > xConnection(getRowSetConnection(xForm)); + if (!xSupTab.is()) return; // search the field - Reference< ::com::sun::star::container::XNameAccess > xFieldNames; - Reference< ::com::sun::star::container::XNameAccess > xTablesNames; - Reference< ::com::sun::star::beans::XPropertySet > xComposerFieldAsSet; + Reference< XColumnsSupplier > xSupCol(xSupTab,UNO_QUERY); + Reference< ::com::sun::star::container::XNameAccess > xFieldNames = xSupCol->getColumns(); + if (!xFieldNames->hasByName(aName)) + return; - ::cppu::extractInterface(xFieldNames, xComposerAsSet->getPropertyValue(FM_PROP_SELECTED_FIELDS)); - ::cppu::extractInterface(xTablesNames, xComposerAsSet->getPropertyValue(FM_PROP_SELECTED_TABLES)); - ::cppu::extractInterface(xComposerFieldAsSet, xFieldNames->getByName(aName)); + Reference< ::com::sun::star::container::XNameAccess > xTablesNames = xSupTab->getTables(); + Reference< ::com::sun::star::beans::XPropertySet > xComposerFieldAsSet(xFieldNames->getByName(aName),UNO_QUERY); if (xComposerFieldAsSet.is() && ::comphelper::hasProperty(FM_PROP_TABLENAME, xComposerFieldAsSet) && ::comphelper::hasProperty(FM_PROP_FIELDSOURCE, xComposerFieldAsSet)) -- cgit From d1b2fe65137236a64cc45fdb84157efaaadc6115 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Fri, 22 Jan 2010 12:14:40 +0100 Subject: dba33f: #i108548# handle Label property from parse column and rowsetcolumn --- svx/source/form/fmvwimp.cxx | 8 ++++++- svx/source/form/tabwin.cxx | 58 +++++++++++++++++++++++++++++++++++++-------- 2 files changed, 55 insertions(+), 11 deletions(-) (limited to 'svx') diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index e30a1a110151..fc31cf6d333d 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -1594,7 +1594,13 @@ bool FmXFormView::createControlLabelPair( const ::comphelper::ComponentContext& xLabelModel.set( pLabel->GetUnoControlModel(), UNO_QUERY ); if ( xLabelModel.is() ) { - xLabelModel->setPropertyValue( FM_PROP_LABEL, makeAny( sFieldName + _rFieldPostfix ) ); + ::rtl::OUString sLabel; + if ( _rxField.is() && _rxField->getPropertySetInfo()->hasPropertyByName(FM_PROP_LABEL) ) + _rxField->getPropertyValue(FM_PROP_LABEL) >>= sLabel; + if ( !sLabel.getLength() ) + sLabel = sFieldName; + + xLabelModel->setPropertyValue( FM_PROP_LABEL, makeAny( sLabel + _rFieldPostfix ) ); String sObjectLabel( SVX_RES( RID_STR_OBJECT_LABEL ) ); sObjectLabel.SearchAndReplaceAllAscii( "#object#", sFieldName ); xLabelModel->setPropertyValue( FM_PROP_NAME, makeAny( ::rtl::OUString( sObjectLabel ) ) ); diff --git a/svx/source/form/tabwin.cxx b/svx/source/form/tabwin.cxx index 50736536bfd0..339b9691c8a2 100644 --- a/svx/source/form/tabwin.cxx +++ b/svx/source/form/tabwin.cxx @@ -94,9 +94,46 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::form; using namespace ::com::sun::star::container; +using namespace ::com::sun::star; using namespace ::svxform; using namespace ::svx; + +struct ColumnInfo +{ + ::rtl::OUString sColumnName; + ::rtl::OUString sLabel; + bool bColumn; + ColumnInfo(const ::rtl::OUString& i_sColumnName,const ::rtl::OUString& i_sLabel) + : sColumnName(i_sColumnName) + , sLabel(i_sLabel) + , bColumn(true) + { + } + ColumnInfo(const ::rtl::OUString& i_sColumnName) + : sColumnName(i_sColumnName) + , bColumn(false) + { + } +}; + +void lcl_addToList( SvTreeListBox& _rListBox, const uno::Reference< container::XNameAccess>& i_xColumns ) +{ + uno::Sequence< ::rtl::OUString > aEntries = i_xColumns->getElementNames(); + const ::rtl::OUString* pEntries = aEntries.getConstArray(); + sal_Int32 nEntries = aEntries.getLength(); + for ( sal_Int32 i = 0; i < nEntries; ++i, ++pEntries ) + { + uno::Reference< beans::XPropertySet> xColumn(i_xColumns->getByName(*pEntries),UNO_QUERY_THROW); + ::rtl::OUString sLabel; + if ( xColumn->getPropertySetInfo()->hasPropertyByName(FM_PROP_LABEL) ) + xColumn->getPropertyValue(FM_PROP_LABEL) >>= sLabel; + if ( sLabel.getLength() ) + _rListBox.InsertEntry( sLabel,NULL,FALSE,LIST_APPEND,new ColumnInfo(*pEntries,sLabel) ); + else + _rListBox.InsertEntry( *pEntries,NULL,FALSE,LIST_APPEND,new ColumnInfo(*pEntries,sLabel) ); + } +} //================================================================== // class FmFieldWinListBox //================================================================== @@ -152,7 +189,8 @@ void FmFieldWinListBox::StartDrag( sal_Int8 /*_nAction*/, const Point& /*_rPosPi aDescriptor[ daConnection ] <<= pTabWin->GetConnection().getTyped(); aDescriptor[ daCommand ] <<= pTabWin->GetObjectName(); aDescriptor[ daCommandType ]<<= pTabWin->GetObjectType(); - aDescriptor[ daColumnName ] <<= ::rtl::OUString( GetEntryText( pSelected ) ); + ColumnInfo* pInfo = static_cast(pSelected->GetUserData()); + aDescriptor[ daColumnName ] <<= pInfo->sColumnName; TransferableHelper* pTransferColumn = new OColumnTransferable( aDescriptor, CTF_FIELD_DESCRIPTOR | CTF_CONTROL_EXCHANGE | CTF_COLUMN_DESCRIPTOR @@ -241,7 +279,8 @@ sal_Bool FmFieldWin::createSelectionControls( ) aDescr[ daCommand ] <<= GetObjectName(); aDescr[ daCommandType ] <<= GetObjectType(); - aDescr[ daColumnName ] <<= ::rtl::OUString( pListBox->GetEntryText( pSelected) ); + ColumnInfo* pInfo = static_cast(pSelected->GetUserData()); + aDescr[ daColumnName ] <<= pInfo->sColumnName;//::rtl::OUString( pListBox->GetEntryText( pSelected) ); // transfer this to the SFX world SfxUnoAnyItem aDescriptorItem( SID_FM_DATACCESS_DESCRIPTOR, makeAny( aDescr.createPropertyValueSequence() ) ); @@ -347,15 +386,14 @@ void FmFieldWin::UpdateContent(const ::com::sun::star::uno::Reference< ::com::su // the place, and connectRowset should be replaced with ensureRowSetConnection // get the fields of the object - Sequence< ::rtl::OUString> aFieldNames; - if ( m_aConnection.is() && m_aObjectName.getLength() ) - aFieldNames = getFieldNamesByCommandDescriptor( m_aConnection, m_nObjectType, m_aObjectName ); - // put them into the list - const ::rtl::OUString* pFieldNames = aFieldNames.getConstArray(); - sal_Int32 nFieldsCount = aFieldNames.getLength(); - for ( sal_Int32 i = 0; i < nFieldsCount; ++i, ++pFieldNames) - pListBox->InsertEntry( * pFieldNames); + if ( m_aConnection.is() && m_aObjectName.getLength() ) + { + Reference< XComponent > xKeepFieldsAlive; + Reference< XNameAccess > xColumns = getFieldsByCommandDescriptor( m_aConnection, m_nObjectType, m_aObjectName,xKeepFieldsAlive ); + if ( xColumns.is() ) + lcl_addToList(*pListBox,xColumns); + } // Prefix setzen UniString aPrefix; -- cgit From 393e4f73f7b8477eeca268526f477160b567ae49 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Tue, 26 Jan 2010 15:05:10 +0100 Subject: cws tl74: #i107721# further changes to new thesaurus dialog --- svx/inc/svx/thesdlg.hxx | 30 +-- svx/source/dialog/thesdlg.cxx | 460 +++++++++++++++++-------------------- svx/source/dialog/thesdlg.hrc | 3 +- svx/source/dialog/thesdlg.src | 52 +++-- svx/source/dialog/thesdlg_impl.hxx | 185 +++++++++++++++ 5 files changed, 434 insertions(+), 296 deletions(-) create mode 100755 svx/source/dialog/thesdlg_impl.hxx (limited to 'svx') diff --git a/svx/inc/svx/thesdlg.hxx b/svx/inc/svx/thesdlg.hxx index f3687496b6bb..dd58f3670aed 100755 --- a/svx/inc/svx/thesdlg.hxx +++ b/svx/inc/svx/thesdlg.hxx @@ -29,21 +29,18 @@ ************************************************************************/ #ifndef _SVX_THESDLG_HXX #define _SVX_THESDLG_HXX -// include --------------------------------------------------------------- -#include -#include -#include -#include +#include #include "svx/stddlg.hxx" #include "svx/svxdllapi.h" +#include -class MenuButton; class Button; -class ListBox; +class MenuButton; +class ComboBox; class SvxCheckListBox; ///////////////////////////////////////////////////////////////// @@ -54,29 +51,12 @@ class SVX_DLLPUBLIC SvxThesaurusDialog : public SvxStandardDialog { boost::shared_ptr< SvxThesaurusDialog_Impl > m_pImpl; -#ifdef _SVX_THESDLG_CXX - SVX_DLLPRIVATE bool UpdateAlternativesBox_Impl(); - SVX_DLLPRIVATE void SetWindowTitle(sal_Int16 nLanguage); - - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XMeaning > > SAL_CALL - queryMeanings_Impl( ::rtl::OUString& rTerm, const ::com::sun::star::lang::Locale& rLocale, const ::com::sun::star::beans::PropertyValues& rProperties ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - - // Handler - DECL_LINK( LanguageHdl_Impl, MenuButton * ); - DECL_LINK( LookUpHdl_Impl, Button * ); - DECL_LINK( WordSelectHdl_Impl, ListBox * ); - DECL_LINK( AlternativesSelectHdl_Impl, SvxCheckListBox * ); - DECL_LINK( AlternativesDoubleClickHdl_Impl, SvxCheckListBox * ); - - DECL_STATIC_LINK( SvxThesaurusDialog, SelectFirstHdl_Impl, SvxCheckListBox * ); -#endif - SVX_DLLPRIVATE virtual void Apply(); public: SvxThesaurusDialog( Window* pParent, ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XThesaurus > xThesaurus, - const String &rWord, sal_Int16 nLanguage ); + const String &rWord, LanguageType nLanguage ); ~SvxThesaurusDialog(); String GetWord(); diff --git a/svx/source/dialog/thesdlg.cxx b/svx/source/dialog/thesdlg.cxx index ebed699ad0f6..e4cf77453e9d 100755 --- a/svx/source/dialog/thesdlg.cxx +++ b/svx/source/dialog/thesdlg.cxx @@ -31,6 +31,17 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include "thesdlg_impl.hxx" +#include "thesdlg.hrc" + #include #include @@ -39,30 +50,10 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include #include -#define _SVX_THESDLG_CXX - -#include -#include -#include "dlgutil.hxx" -#include "svxerr.hxx" -#include "thesdlg.hrc" - -#include -#include -#include -#include - +#include #include using namespace ::com::sun::star; @@ -71,6 +62,8 @@ using ::rtl::OUString; #define A2S(x) String::CreateFromAscii( x ) + + // GetReplaceEditString ------------------------------- static void GetReplaceEditString( String &rText ) @@ -100,35 +93,40 @@ static void GetReplaceEditString( String &rText ) rText.EraseLeadingAndTrailingChars( sal_Unicode(' ') ); } -// class ThesaurusAlternativesCtrl_Impl ---------------------------------- +// class LookUpComboBox -------------------------------------------------- -class AlternativesUserData_Impl +LookUpComboBox::LookUpComboBox( + Window *pParent, const ResId &rResId ) : + ComboBox (pParent, rResId) { - String sText; - bool bHeader; +} -public: - AlternativesUserData_Impl( const String &rText, bool bIsHeader ) : - sText(rText), - bHeader(bIsHeader) - { - } - bool IsHeader() const { return bHeader; } - const String& GetText() const { return sText; } -}; +LookUpComboBox::~LookUpComboBox() +{ +} + +void LookUpComboBox::Modify() +{ + if (m_pBtn) + m_pBtn->Enable( GetText().Len() > 0 ); +} -class AlternativesString_Impl : public SvLBoxString +void LookUpComboBox::SetText( const XubString& rStr ) { -public: + ComboBox::SetText( rStr ); + Modify(); +} - AlternativesString_Impl( SvLBoxEntry* pEntry, USHORT nFlags, const String& rStr ) - : SvLBoxString( pEntry, nFlags, rStr ) {} - virtual void Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags, SvLBoxEntry* pEntry); -}; +void LookUpComboBox::SetText( const XubString& rStr, const Selection& rNewSelection ) +{ + ComboBox::SetText( rStr, rNewSelection ); + Modify(); +} +// class ThesaurusAlternativesCtrl_Impl ---------------------------------- void AlternativesString_Impl::Paint( const Point& rPos, @@ -152,29 +150,11 @@ void AlternativesString_Impl::Paint( } -class ThesaurusAlternativesCtrl_Impl : - public SvxCheckListBox -{ - // disable copy c-tor and assignment operator - ThesaurusAlternativesCtrl_Impl( const ThesaurusAlternativesCtrl_Impl & ); - ThesaurusAlternativesCtrl_Impl & operator = ( const ThesaurusAlternativesCtrl_Impl & ); - -public: - ThesaurusAlternativesCtrl_Impl( Window* pParent ); - virtual ~ThesaurusAlternativesCtrl_Impl(); - - - - SvLBoxEntry * AddEntry( sal_Int32 nVal, const String &rText, bool bIsHeader ); - void ClearUserData(); - - virtual void KeyInput( const KeyEvent& rKEvt ); -}; - - ThesaurusAlternativesCtrl_Impl::ThesaurusAlternativesCtrl_Impl( - Window* pParent ) : - SvxCheckListBox( pParent, SVX_RES( CT_THES_ALTERNATIVES ) ) + Window* pParent, + SvxThesaurusDialog_Impl &rImpl ) : + SvxCheckListBox( pParent, SVX_RES( CT_THES_ALTERNATIVES ) ), + m_rDialogImpl( rImpl ) { SetWindowBits( WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE ); SetHighlightRange(); @@ -222,53 +202,28 @@ void ThesaurusAlternativesCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) if (rKey.GetCode() == KEY_RETURN || rKey.GetCode() == KEY_ESCAPE) GetParent()->KeyInput( rKEvt ); // parent will close dialog... - else if ( GetEntryCount() ) + else if (rKey.GetCode() == KEY_SPACE) + m_rDialogImpl.AlternativesDoubleClickHdl_Impl( this ); // look up current selected entry + else if (GetEntryCount()) SvxCheckListBox::KeyInput( rKEvt ); } // struct SvxThesaurusDialog_Impl ---------------------------------------- -struct SvxThesaurusDialog_Impl -{ - FixedText aWordText; - ListBox aWordLB; - MenuButton aLangMBtn; - FixedText m_aAlternativesText; - boost::shared_ptr< ThesaurusAlternativesCtrl_Impl > m_pAlternativesCT; - FixedText aReplaceText; - Edit aReplaceEdit; - PushButton aLookUpBtn; - FixedLine aFL; - HelpButton aHelpBtn; - OKButton aOkBtn; - CancelButton aCancelBtn; - - String aErrStr; - - uno::Reference< linguistic2::XThesaurus > xThesaurus; - OUString aLookUpText; - LanguageType nLookUpLanguage; - - SfxErrorContext* pErrContext; // error context while dfalog is opened - - - SvxThesaurusDialog_Impl( Window* pParent ); - ~SvxThesaurusDialog_Impl(); -}; - - SvxThesaurusDialog_Impl::SvxThesaurusDialog_Impl( Window* pParent ) : + m_pParent ( pParent ), + aLeftBtn ( pParent, SVX_RES( BTN_LEFT ) ), aWordText ( pParent, SVX_RES( FT_WORD ) ), - aWordLB ( pParent, SVX_RES( LB_WORD ) ), - aLangMBtn ( pParent, SVX_RES( MB_LANGUAGE ) ), + aWordCB ( pParent, SVX_RES( CB_WORD ) ), + aLookUpBtn ( pParent, SVX_RES( BTN_LOOKUP ) ), m_aAlternativesText ( pParent, SVX_RES( FT_THES_ALTERNATIVES ) ), - m_pAlternativesCT ( new ThesaurusAlternativesCtrl_Impl( pParent ) ), + m_pAlternativesCT ( new ThesaurusAlternativesCtrl_Impl( pParent, *this ) ), aReplaceText ( pParent, SVX_RES( FT_REPL ) ), aReplaceEdit ( pParent, SVX_RES( ED_REPL ) ), - aLookUpBtn ( pParent, SVX_RES( BTN_LOOKUP ) ), aFL ( pParent, SVX_RES( FL_VAR ) ), aHelpBtn ( pParent, SVX_RES( BTN_THES_HELP ) ), + aLangMBtn ( pParent, SVX_RES( MB_LANGUAGE ) ), aOkBtn ( pParent, SVX_RES( BTN_THES_OK ) ), aCancelBtn ( pParent, SVX_RES( BTN_THES_CANCEL ) ), aErrStr ( SVX_RES( STR_ERR_WORDNOTFOUND ) ), @@ -278,6 +233,15 @@ SvxThesaurusDialog_Impl::SvxThesaurusDialog_Impl( Window* pParent ) : pErrContext ( NULL ) { // note: FreeResource must only be called in the c-tor of SvxThesaurusDialog + + aWordCB.SetButton( &aLookUpBtn ); + + aLeftBtn.SetClickHdl( LINK( this, SvxThesaurusDialog_Impl, LeftBtnHdl_Impl ) ); + aWordCB.SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, WordSelectHdl_Impl ) ); + aLangMBtn.SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, LanguageHdl_Impl ) ); + aLookUpBtn.SetClickHdl( LINK( this, SvxThesaurusDialog_Impl, LookUpHdl_Impl ) ); + m_pAlternativesCT->SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, AlternativesSelectHdl_Impl )); + m_pAlternativesCT->SetDoubleClickHdl( LINK( this, SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl )); } @@ -287,87 +251,15 @@ SvxThesaurusDialog_Impl::~SvxThesaurusDialog_Impl() delete pErrContext; } -// class SvxThesaurusDialog ---------------------------------------------- -SvxThesaurusDialog::SvxThesaurusDialog( - Window* pParent, - uno::Reference< linguistic2::XThesaurus > xThes, - const String &rWord, - sal_Int16 nLanguage ) : - - SvxStandardDialog( pParent, SVX_RES( RID_SVXDLG_THESAURUS ) ) -{ - m_pImpl = boost::shared_ptr< SvxThesaurusDialog_Impl >(new SvxThesaurusDialog_Impl( this )); - - m_pImpl->xThesaurus = xThes; - m_pImpl->aLookUpText = OUString( rWord ); - m_pImpl->nLookUpLanguage = nLanguage; - m_pImpl->pErrContext = new SfxErrorContext( ERRCTX_SVX_LINGU_THESAURUS, String(), this, - RID_SVXERRCTX, &DIALOG_MGR() ); - - FreeResource(); - - m_pImpl->aWordLB.SetSelectHdl( LINK( this, SvxThesaurusDialog, WordSelectHdl_Impl ) ); - m_pImpl->aLangMBtn.SetSelectHdl( LINK( this, SvxThesaurusDialog, LanguageHdl_Impl ) ); - m_pImpl->aLookUpBtn.SetClickHdl( LINK( this, SvxThesaurusDialog, LookUpHdl_Impl ) ); - m_pImpl->m_pAlternativesCT->SetSelectHdl( LINK( this, SvxThesaurusDialog, AlternativesSelectHdl_Impl )); - m_pImpl->m_pAlternativesCT->SetDoubleClickHdl( LINK( this, SvxThesaurusDialog, AlternativesDoubleClickHdl_Impl )); - - OUString aTmp( rWord ); - linguistic::RemoveHyphens( aTmp ); - linguistic::ReplaceControlChars( aTmp ); - m_pImpl->aReplaceEdit.SetText( aTmp ); - m_pImpl->aWordLB.InsertEntry( aTmp ); - m_pImpl->aWordLB.SelectEntry( aTmp ); - - SetWindowTitle( nLanguage ); - UpdateAlternativesBox_Impl(); - m_pImpl->m_pAlternativesCT->GrabFocus(); - - // fill language menu button list - SvtLanguageTable aLangTab; - uno::Sequence< lang::Locale > aLocales; - if (m_pImpl->xThesaurus.is()) - aLocales = m_pImpl->xThesaurus->getLocales(); - const sal_Int32 nLocales = aLocales.getLength(); - const lang::Locale *pLocales = aLocales.getConstArray(); - delete m_pImpl->aLangMBtn.GetPopupMenu(); - PopupMenu* pMenu = new PopupMenu; - pMenu->SetMenuFlags( MENU_FLAG_NOAUTOMNEMONICS ); - std::vector< OUString > aLangVec; - for (sal_Int32 i = 0; i < nLocales; ++i ) - { - const LanguageType nLang = SvxLocaleToLanguage( pLocales[i] ); - DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" ); - aLangVec.push_back( aLangTab.GetString( nLang ) ); - } - std::sort( aLangVec.begin(), aLangVec.end() ); - for (size_t i = 0; i < aLangVec.size(); ++i) - pMenu->InsertItem( (USHORT)i+1, aLangVec[i] ); // menu items should be enumerated from 1 and not 0 - m_pImpl->aLangMBtn.SetPopupMenu( pMenu ); - - // disable controls if service is missing - if (!m_pImpl->xThesaurus.is()) - Enable( sal_False ); -} - - -// ----------------------------------------------------------------------- - -SvxThesaurusDialog::~SvxThesaurusDialog() -{ -} - -// ----------------------------------------------------------------------- - -uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL SvxThesaurusDialog::queryMeanings_Impl( +uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL SvxThesaurusDialog_Impl::queryMeanings_Impl( OUString& rTerm, const lang::Locale& rLocale, const beans::PropertyValues& rProperties ) throw(lang::IllegalArgumentException, uno::RuntimeException) { uno::Sequence< uno::Reference< linguistic2::XMeaning > > aMeanings( - m_pImpl->xThesaurus->queryMeanings( rTerm, rLocale, rProperties ) ); + xThesaurus->queryMeanings( rTerm, rLocale, rProperties ) ); // text with '.' at the end? if (0 == aMeanings.getLength() && rTerm.getLength() && @@ -377,7 +269,7 @@ uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL SvxThesaurusDi // end of a sentence and not an abbreviation... String aTxt( rTerm ); aTxt.EraseTrailingChars( '.' ); - aMeanings = m_pImpl->xThesaurus->queryMeanings( aTxt, rLocale, rProperties ); + aMeanings = xThesaurus->queryMeanings( aTxt, rLocale, rProperties ); if (aMeanings.getLength()) { rTerm = aTxt; @@ -387,35 +279,20 @@ uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL SvxThesaurusDi return aMeanings; } -// ----------------------------------------------------------------------- - -String SvxThesaurusDialog::GetWord() -{ - return m_pImpl->aReplaceEdit.GetText(); -} - -// ----------------------------------------------------------------------- - -sal_uInt16 SvxThesaurusDialog::GetLanguage() const -{ - return m_pImpl->nLookUpLanguage; -} - -// ----------------------------------------------------------------------- -bool SvxThesaurusDialog::UpdateAlternativesBox_Impl() +bool SvxThesaurusDialog_Impl::UpdateAlternativesBox_Impl() { - lang::Locale aLocale( SvxCreateLocale( m_pImpl->nLookUpLanguage ) ); + lang::Locale aLocale( SvxCreateLocale( nLookUpLanguage ) ); uno::Sequence< uno::Reference< linguistic2::XMeaning > > aMeanings = queryMeanings_Impl( - m_pImpl->aLookUpText, aLocale, uno::Sequence< beans::PropertyValue >() ); + aLookUpText, aLocale, uno::Sequence< beans::PropertyValue >() ); const sal_Int32 nMeanings = aMeanings.getLength(); const uno::Reference< linguistic2::XMeaning > *pMeanings = aMeanings.getConstArray(); // clear old user data of control before creating new ones via AddEntry below - m_pImpl->m_pAlternativesCT->ClearUserData(); + m_pAlternativesCT->ClearUserData(); - m_pImpl->m_pAlternativesCT->Clear(); - m_pImpl->m_pAlternativesCT->SetUpdateMode( FALSE ); + m_pAlternativesCT->Clear(); + m_pAlternativesCT->SetUpdateMode( FALSE ); for (sal_Int32 i = 0; i < nMeanings; ++i) { @@ -426,89 +303,96 @@ bool SvxThesaurusDialog::UpdateAlternativesBox_Impl() DBG_ASSERT( rMeaningTxt.getLength() > 0, "meaning with empty text" ); DBG_ASSERT( nSynonyms > 0, "meaning without synonym" ); - m_pImpl->m_pAlternativesCT->AddEntry( i + 1, rMeaningTxt, true ); + m_pAlternativesCT->AddEntry( i + 1, rMeaningTxt, true ); for (sal_Int32 k = 0; k < nSynonyms; ++k) - m_pImpl->m_pAlternativesCT->AddEntry( -1, pSynonyms[k], false ); + m_pAlternativesCT->AddEntry( -1, pSynonyms[k], false ); } - m_pImpl->m_pAlternativesCT->SetUpdateMode( TRUE ); + m_pAlternativesCT->SetUpdateMode( TRUE ); - return nMeanings > 0; + const bool bWordFound = nMeanings > 0; + if (!bWordFound) + InfoBox( m_pParent, aErrStr ).Execute(); + return bWordFound; } -// ----------------------------------------------------------------------- - -void SvxThesaurusDialog::Apply() -{ -} -// ----------------------------------------------------------------------- -void SvxThesaurusDialog::SetWindowTitle(sal_Int16 nLanguage) +void SvxThesaurusDialog_Impl::SetWindowTitle( LanguageType nLanguage ) { // Sprache anpassen - String aStr( GetText() ); + String aStr( m_pParent->GetText() ); aStr.Erase( aStr.Search( sal_Unicode( '(' ) ) - 1 ); aStr.Append( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) ) ); aStr += GetLanguageString( (LanguageType) nLanguage ); aStr.Append( sal_Unicode( ')' ) ); - SetText( aStr ); // set window title + m_pParent->SetText( aStr ); // set window title +} + + +IMPL_LINK( SvxThesaurusDialog_Impl, LeftBtnHdl_Impl, Button *, pBtn ) +{ + if (pBtn) + { + aLookUpHistory.pop(); // remove current look up word from stack + aWordCB.SetText( aLookUpHistory.top() ); // retrieve previous look up word + aLookUpHistory.pop(); + LookUpHdl_Impl( NULL ); + } + return 0; } -// ----------------------------------------------------------------------- -IMPL_LINK( SvxThesaurusDialog, LanguageHdl_Impl, MenuButton *, pBtn ) +IMPL_LINK( SvxThesaurusDialog_Impl, LanguageHdl_Impl, MenuButton *, pBtn ) { - PopupMenu *pMenu = m_pImpl->aLangMBtn.GetPopupMenu(); + PopupMenu *pMenu = aLangMBtn.GetPopupMenu(); if (pMenu && pBtn) { USHORT nItem = pBtn->GetCurItemId(); String aLangText( pMenu->GetItemText( nItem ) ); LanguageType nLang = SvtLanguageTable().GetType( aLangText ); DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" ); - if (m_pImpl->xThesaurus->hasLocale( SvxCreateLocale( nLang ) )) - m_pImpl->nLookUpLanguage = nLang; + if (xThesaurus->hasLocale( SvxCreateLocale( nLang ) )) + nLookUpLanguage = nLang; SetWindowTitle( nLang ); - bool bWordFound = UpdateAlternativesBox_Impl(); - if (!bWordFound) - InfoBox( this, m_pImpl->aErrStr ).Execute(); + UpdateAlternativesBox_Impl(); } return 0; } -// ----------------------------------------------------------------------- -IMPL_LINK( SvxThesaurusDialog, LookUpHdl_Impl, Button *, EMPTYARG /*pBtn*/ ) +IMPL_LINK( SvxThesaurusDialog_Impl, LookUpHdl_Impl, Button *, EMPTYARG /*pBtn*/ ) { - String aText( m_pImpl->aReplaceEdit.GetText() ); + String aText( aWordCB.GetText() ); - OUString aOldLookUpText = m_pImpl->aLookUpText; - m_pImpl->aLookUpText = OUString( aText ); + aLookUpText = OUString( aText ); + if (aLookUpText.getLength() > 0) + aLookUpHistory.push( aLookUpText ); - bool bWordFound = UpdateAlternativesBox_Impl(); - if (!bWordFound) - InfoBox( this, m_pImpl->aErrStr ).Execute(); + UpdateAlternativesBox_Impl(); - if ( m_pImpl->aWordLB.GetEntryPos( aText ) == LISTBOX_ENTRY_NOTFOUND ) - m_pImpl->aWordLB.InsertEntry( aText ); + if ( aWordCB.GetEntryPos( aText ) == LISTBOX_ENTRY_NOTFOUND ) + aWordCB.InsertEntry( aText ); - m_pImpl->aWordLB.SelectEntry( aText ); - m_pImpl->aReplaceEdit.SetText( String() ); - m_pImpl->aOkBtn.Enable( FALSE ); - m_pImpl->m_pAlternativesCT->GrabFocus(); + aWordCB.SelectEntryPos( aWordCB.GetEntryPos( aText ) ); + aReplaceEdit.SetText( String() ); + aOkBtn.Enable( FALSE ); + m_pAlternativesCT->GrabFocus(); + + aLeftBtn.Enable( aLookUpHistory.size() > 1 ); return 0; } -// ----------------------------------------------------------------------- -IMPL_LINK( SvxThesaurusDialog, WordSelectHdl_Impl, ListBox *, pBox ) +IMPL_LINK( SvxThesaurusDialog_Impl, WordSelectHdl_Impl, ComboBox *, pBox ) { - if (!m_pImpl->aWordLB.IsTravelSelect()) // act only upon return key and not when traveling with cursor keys + if (pBox && !aWordCB.IsTravelSelect()) // act only upon return key and not when traveling with cursor keys { - String aStr( pBox->GetSelectEntry() ); + USHORT nPos = pBox->GetSelectEntryPos(); + String aStr( pBox->GetEntry( nPos ) ); GetReplaceEditString( aStr ); - m_pImpl->aReplaceEdit.SetText( aStr ); - m_pImpl->aOkBtn.Enable( aStr.Len() > 0 ); + aWordCB.SetText( aStr ); + aOkBtn.Enable( aStr.Len() > 0 ); LookUpHdl_Impl( NULL ); } @@ -516,11 +400,10 @@ IMPL_LINK( SvxThesaurusDialog, WordSelectHdl_Impl, ListBox *, pBox ) return 0; } -// ----------------------------------------------------------------------- -IMPL_LINK( SvxThesaurusDialog, AlternativesSelectHdl_Impl, SvxCheckListBox *, pBox ) +IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesSelectHdl_Impl, SvxCheckListBox *, pBox ) { - SvLBoxEntry *pEntry = pBox->GetCurEntry(); + SvLBoxEntry *pEntry = pBox ? pBox->GetCurEntry() : NULL; if (pEntry) { AlternativesUserData_Impl * pData = (AlternativesUserData_Impl *) pEntry->GetUserData(); @@ -530,17 +413,16 @@ IMPL_LINK( SvxThesaurusDialog, AlternativesSelectHdl_Impl, SvxCheckListBox *, pB aStr = pData->GetText(); GetReplaceEditString( aStr ); } - m_pImpl->aReplaceEdit.SetText( aStr ); - m_pImpl->aOkBtn.Enable( aStr.Len() > 0 ); + aReplaceEdit.SetText( aStr ); + aOkBtn.Enable( aStr.Len() > 0 ); } return 0; } -// ----------------------------------------------------------------------- -IMPL_LINK( SvxThesaurusDialog, AlternativesDoubleClickHdl_Impl, SvxCheckListBox *, pBox ) +IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl, SvxCheckListBox *, pBox ) { - SvLBoxEntry *pEntry = pBox->GetCurEntry(); + SvLBoxEntry *pEntry = pBox ? pBox->GetCurEntry() : NULL; if (pEntry) { AlternativesUserData_Impl * pData = (AlternativesUserData_Impl *) pEntry->GetUserData(); @@ -550,8 +432,8 @@ IMPL_LINK( SvxThesaurusDialog, AlternativesDoubleClickHdl_Impl, SvxCheckListBox aStr = pData->GetText(); GetReplaceEditString( aStr ); } - m_pImpl->aReplaceEdit.SetText( aStr ); - m_pImpl->aOkBtn.Enable( aStr.Len() > 0 ); + aWordCB.SetText( aStr ); + aOkBtn.Enable( aStr.Len() > 0 ); if (aStr.Len() > 0) LookUpHdl_Impl( NULL ); @@ -559,14 +441,100 @@ IMPL_LINK( SvxThesaurusDialog, AlternativesDoubleClickHdl_Impl, SvxCheckListBox //! workaround to set the selection since calling SelectEntryPos within //! the double click handler does not work - Application::PostUserEvent( STATIC_LINK( this, SvxThesaurusDialog, SelectFirstHdl_Impl ), pBox ); + Application::PostUserEvent( STATIC_LINK( this, SvxThesaurusDialog_Impl, SelectFirstHdl_Impl ), pBox ); return 0; } -IMPL_STATIC_LINK( SvxThesaurusDialog, SelectFirstHdl_Impl, SvxCheckListBox *, pBox ) +IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, SelectFirstHdl_Impl, SvxCheckListBox *, pBox ) { if (pBox && pBox->GetEntryCount() > 0) pBox->SelectEntryPos( 0 ); return 0; -} \ No newline at end of file +} + + +// class SvxThesaurusDialog ---------------------------------------------- + +SvxThesaurusDialog::SvxThesaurusDialog( + Window* pParent, + uno::Reference< linguistic2::XThesaurus > xThes, + const String &rWord, + LanguageType nLanguage ) : + + SvxStandardDialog( pParent, SVX_RES( RID_SVXDLG_THESAURUS ) ) +{ + m_pImpl = boost::shared_ptr< SvxThesaurusDialog_Impl >(new SvxThesaurusDialog_Impl( this )); + + m_pImpl->xThesaurus = xThes; + m_pImpl->aLookUpText = OUString( rWord ); + m_pImpl->nLookUpLanguage = nLanguage; + if (rWord.Len() > 0) + m_pImpl->aLookUpHistory.push( rWord ); + m_pImpl->pErrContext = new SfxErrorContext( ERRCTX_SVX_LINGU_THESAURUS, String(), this, + RID_SVXERRCTX, &DIALOG_MGR() ); + + FreeResource(); + + OUString aTmp( rWord ); + linguistic::RemoveHyphens( aTmp ); + linguistic::ReplaceControlChars( aTmp ); + String aTmp2( aTmp ); + m_pImpl->aReplaceEdit.SetText( aTmp2 ); + m_pImpl->aWordCB.InsertEntry( aTmp2 ); + m_pImpl->aWordCB.SelectEntryPos( m_pImpl->aWordCB.GetEntryPos( aTmp2 ) ); + + m_pImpl->SetWindowTitle( nLanguage ); + m_pImpl->UpdateAlternativesBox_Impl(); + m_pImpl->m_pAlternativesCT->GrabFocus(); + m_pImpl->aLeftBtn.Enable( sal_False ); + + // fill language menu button list + SvtLanguageTable aLangTab; + uno::Sequence< lang::Locale > aLocales; + if (m_pImpl->xThesaurus.is()) + aLocales = m_pImpl->xThesaurus->getLocales(); + const sal_Int32 nLocales = aLocales.getLength(); + const lang::Locale *pLocales = aLocales.getConstArray(); + delete m_pImpl->aLangMBtn.GetPopupMenu(); + PopupMenu* pMenu = new PopupMenu; + pMenu->SetMenuFlags( MENU_FLAG_NOAUTOMNEMONICS ); + std::vector< OUString > aLangVec; + for (sal_Int32 i = 0; i < nLocales; ++i ) + { + const LanguageType nLang = SvxLocaleToLanguage( pLocales[i] ); + DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" ); + aLangVec.push_back( aLangTab.GetString( nLang ) ); + } + std::sort( aLangVec.begin(), aLangVec.end() ); + for (size_t i = 0; i < aLangVec.size(); ++i) + pMenu->InsertItem( (USHORT)i+1, aLangVec[i] ); // menu items should be enumerated from 1 and not 0 + m_pImpl->aLangMBtn.SetPopupMenu( pMenu ); + + // disable controls if service is missing + if (!m_pImpl->xThesaurus.is()) + Enable( sal_False ); +} + + +SvxThesaurusDialog::~SvxThesaurusDialog() +{ +} + + +String SvxThesaurusDialog::GetWord() +{ + return m_pImpl->aReplaceEdit.GetText(); +} + + +sal_uInt16 SvxThesaurusDialog::GetLanguage() const +{ + return m_pImpl->nLookUpLanguage; +} + + +void SvxThesaurusDialog::Apply() +{ +} + diff --git a/svx/source/dialog/thesdlg.hrc b/svx/source/dialog/thesdlg.hrc index 4a11bb126e67..aa7a7abf31a3 100755 --- a/svx/source/dialog/thesdlg.hrc +++ b/svx/source/dialog/thesdlg.hrc @@ -32,13 +32,14 @@ // defines --------------------------------------------------------------- +#define BTN_LEFT 9 #define BTN_THES_OK 10 #define BTN_THES_CANCEL 11 #define MB_LANGUAGE 12 #define BTN_THES_HELP 13 #define BTN_LOOKUP 14 #define FT_WORD 15 -#define LB_WORD 16 +#define CB_WORD 16 #define FT_REPL 21 #define ED_REPL 22 #define FL_VAR 23 diff --git a/svx/source/dialog/thesdlg.src b/svx/source/dialog/thesdlg.src index 6e7ea88ceff2..67b37a97e15e 100755 --- a/svx/source/dialog/thesdlg.src +++ b/svx/source/dialog/thesdlg.src @@ -39,37 +39,42 @@ ModalDialog RID_SVXDLG_THESAURUS { HelpId = SID_THESAURUS ; OutputSize = TRUE ; -// Size = MAP_APPFONT ( 285, 116 ) ; - Size = MAP_APPFONT ( 220, 230 ) ; + Size = MAP_APPFONT ( 265, 230 ) ; Text [ en-US ] = "Thesaurus" ; Moveable = TRUE ; SvLook = TRUE ; + ImageButton BTN_LEFT + { + Pos = MAP_APPFONT ( 5 , 15 ) ; + Size = MAP_APPFONT ( 14 , 14 ) ; + TABSTOP = TRUE ; + SYMBOL = IMAGEBUTTON_ARROW_LEFT ; + }; FixedText FT_WORD { - Pos = MAP_APPFONT ( 5 , 5 ) ; + Pos = MAP_APPFONT ( 24 , 5 ) ; Size = MAP_APPFONT ( 143 , 8 ) ; Text [ en-US ] = "Current ~word" ; LEFT = TRUE ; }; - ListBox LB_WORD + ComboBox CB_WORD { DropDown = TRUE ; - Pos = MAP_APPFONT ( 5 , 16 ) ; - Size = MAP_APPFONT ( 143 , 60 ) ; // have drop down space for several lines + Pos = MAP_APPFONT ( 24 , 16 ) ; + Size = MAP_APPFONT ( 171 , 60 ) ; // have drop down space for several lines }; - MenuButton MB_LANGUAGE + PushButton BTN_LOOKUP { - Pos = MAP_APPFONT ( 154 , 16 ) ; - Pos = MAP_APPFONT ( 154 , 16 ) ; + Pos = MAP_APPFONT ( 200 , 16 ) ; Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Language" ; + Text [ en-US ] = "Look ~Up" ; }; FixedText FT_THES_ALTERNATIVES { Pos = MAP_APPFONT ( 5 , 33 ) ; - Size = MAP_APPFONT ( 220 , 8 ) ; + Size = MAP_APPFONT ( 255 , 8 ) ; Text [ en-US ] = "~Alternatives" ; LEFT = TRUE ; }; @@ -77,7 +82,7 @@ ModalDialog RID_SVXDLG_THESAURUS { HelpID = HID_CT_THES_ALTERNATIVES ; Pos = MAP_APPFONT ( 5 , 45 ) ; - Size = MAP_APPFONT ( 209 , 121 ) ; + Size = MAP_APPFONT ( 255 , 121 ) ; Border = TRUE; TabStop = TRUE ; }; @@ -85,7 +90,7 @@ ModalDialog RID_SVXDLG_THESAURUS FixedText FT_REPL { Pos = MAP_APPFONT ( 5 , 173 ) ; - Size = MAP_APPFONT ( 143 , 8 ) ; + Size = MAP_APPFONT ( 255 , 8 ) ; Text [ en-US ] = "Replace ~with" ; LEFT = TRUE ; }; @@ -93,37 +98,36 @@ ModalDialog RID_SVXDLG_THESAURUS { BORDER = TRUE ; Pos = MAP_APPFONT ( 5 , 184 ) ; - Size = MAP_APPFONT ( 143 , 12 ) ; + Size = MAP_APPFONT ( 255 , 12 ) ; LEFT = TRUE ; }; - PushButton BTN_LOOKUP - { - Pos = MAP_APPFONT ( 154 , 184 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "Look ~Up" ; - }; FixedLine FL_VAR { Pos = MAP_APPFONT ( 0 , 200 ) ; - Size = MAP_APPFONT ( 220 , 8 ) ; + Size = MAP_APPFONT ( 265 , 8 ) ; }; - HelpButton BTN_THES_HELP { Pos = MAP_APPFONT ( 5 , 210 ) ; Size = MAP_APPFONT ( 60 , 14 ) ; }; + MenuButton MB_LANGUAGE + { + Pos = MAP_APPFONT ( 70 , 210 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; + Text [ en-US ] = "~Language" ; + }; OkButton BTN_THES_OK { - Pos = MAP_APPFONT ( 89 , 210 ) ; + Pos = MAP_APPFONT ( 135 , 210 ) ; Size = MAP_APPFONT ( 60 , 14 ) ; Text [ en-US ] = "~Replace" ; DefButton = TRUE ; }; CancelButton BTN_THES_CANCEL { - Pos = MAP_APPFONT ( 154 , 210 ) ; + Pos = MAP_APPFONT ( 200 , 210 ) ; Size = MAP_APPFONT ( 60 , 14 ) ; }; diff --git a/svx/source/dialog/thesdlg_impl.hxx b/svx/source/dialog/thesdlg_impl.hxx new file mode 100755 index 000000000000..e862f2199730 --- /dev/null +++ b/svx/source/dialog/thesdlg_impl.hxx @@ -0,0 +1,185 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: $ + * $Revision: $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVX_THESDLG_IMPL_HXX +#define _SVX_THESDLG_IMPL_HXX + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +using namespace ::com::sun::star; +using ::rtl::OUString; + +// class LookUpComboBox -------------------------------------------------- + +class LookUpComboBox : public ComboBox +{ + Button * m_pBtn; + + // disable copy c-tor and assignment operator + LookUpComboBox( const LookUpComboBox & ); + LookUpComboBox & operator = ( const LookUpComboBox & ); + +public: + LookUpComboBox( Window *pParent, const ResId &rResId ); + virtual ~LookUpComboBox(); + + void SetButton( Button *pBtn ) { m_pBtn = pBtn; } + + // ComboBox + virtual void Modify(); + virtual void SetText( const XubString& rStr ); + virtual void SetText( const XubString& rStr, const Selection& rNewSelection ); +}; + +// class ThesaurusAlternativesCtrl_Impl ---------------------------------- + +class AlternativesUserData_Impl +{ + String sText; + bool bHeader; + + // disable copy c-tor and assignment operator + AlternativesUserData_Impl( const AlternativesUserData_Impl & ); + AlternativesUserData_Impl & operator = ( const AlternativesUserData_Impl & ); + +public: + AlternativesUserData_Impl( const String &rText, bool bIsHeader ) : + sText(rText), + bHeader(bIsHeader) + { + } + + bool IsHeader() const { return bHeader; } + const String& GetText() const { return sText; } +}; + + +class AlternativesString_Impl : public SvLBoxString +{ +public: + + AlternativesString_Impl( SvLBoxEntry* pEntry, USHORT nFlags, const String& rStr ) + : SvLBoxString( pEntry, nFlags, rStr ) {} + + virtual void Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags, SvLBoxEntry* pEntry); +}; + + +class ThesaurusAlternativesCtrl_Impl : + public SvxCheckListBox +{ + SvxThesaurusDialog_Impl & m_rDialogImpl; + + // disable copy c-tor and assignment operator + ThesaurusAlternativesCtrl_Impl( const ThesaurusAlternativesCtrl_Impl & ); + ThesaurusAlternativesCtrl_Impl & operator = ( const ThesaurusAlternativesCtrl_Impl & ); + +public: + ThesaurusAlternativesCtrl_Impl( Window* pParent, SvxThesaurusDialog_Impl &rImpl ); + virtual ~ThesaurusAlternativesCtrl_Impl(); + + + SvLBoxEntry * AddEntry( sal_Int32 nVal, const String &rText, bool bIsHeader ); + void ClearUserData(); + + virtual void KeyInput( const KeyEvent& rKEvt ); +}; + + +// struct SvxThesaurusDialog_Impl ---------------------------------------- + +struct SvxThesaurusDialog_Impl +{ + Window* m_pParent; + + ImageButton aLeftBtn; + FixedText aWordText; + LookUpComboBox aWordCB; + PushButton aLookUpBtn; + FixedText m_aAlternativesText; + boost::shared_ptr< ThesaurusAlternativesCtrl_Impl > m_pAlternativesCT; + FixedText aReplaceText; + Edit aReplaceEdit; + FixedLine aFL; + HelpButton aHelpBtn; + MenuButton aLangMBtn; + OKButton aOkBtn; + CancelButton aCancelBtn; + + String aErrStr; + + uno::Reference< linguistic2::XThesaurus > xThesaurus; + OUString aLookUpText; + LanguageType nLookUpLanguage; + std::stack< OUString > aLookUpHistory; + + SfxErrorContext* pErrContext; // error context while dfalog is opened + + + // Handler + DECL_LINK( LeftBtnHdl_Impl, Button * ); + DECL_LINK( LanguageHdl_Impl, MenuButton * ); + DECL_LINK( LookUpHdl_Impl, Button * ); + DECL_LINK( WordSelectHdl_Impl, ComboBox * ); + DECL_LINK( AlternativesSelectHdl_Impl, SvxCheckListBox * ); + DECL_LINK( AlternativesDoubleClickHdl_Impl, SvxCheckListBox * ); + + DECL_STATIC_LINK( SvxThesaurusDialog_Impl, SelectFirstHdl_Impl, SvxCheckListBox * ); + + + SvxThesaurusDialog_Impl( Window* pParent ); + ~SvxThesaurusDialog_Impl(); + + uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL + queryMeanings_Impl( ::rtl::OUString& rTerm, const lang::Locale& rLocale, const beans::PropertyValues& rProperties ) throw(lang::IllegalArgumentException, uno::RuntimeException); + + bool UpdateAlternativesBox_Impl(); + void SetWindowTitle( LanguageType nLanguage ); +}; + +#endif + -- cgit From 4c8c50fdc10ef9afb826a826c4de23781a70bf43 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Fri, 5 Feb 2010 13:45:10 +0100 Subject: #161586# allowing for thesaurus vendor images --- svx/source/dialog/thesdlg.cxx | 208 ++++++++++++++++++++++++++++++++++++- svx/source/dialog/thesdlg.hrc | 13 +-- svx/source/dialog/thesdlg.src | 18 +++- svx/source/dialog/thesdlg_impl.hxx | 6 ++ 4 files changed, 234 insertions(+), 11 deletions(-) (limited to 'svx') diff --git a/svx/source/dialog/thesdlg.cxx b/svx/source/dialog/thesdlg.cxx index e4cf77453e9d..7b37f9a40a8e 100755 --- a/svx/source/dialog/thesdlg.cxx +++ b/svx/source/dialog/thesdlg.cxx @@ -44,13 +44,17 @@ #include #include +#include #include #include #include #include #include +#include #include +#include +#include #include @@ -213,6 +217,7 @@ void ThesaurusAlternativesCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) SvxThesaurusDialog_Impl::SvxThesaurusDialog_Impl( Window* pParent ) : m_pParent ( pParent ), + aVendorImageFI ( pParent , SVX_RES( IMG_VENDOR ) ), aLeftBtn ( pParent, SVX_RES( BTN_LEFT ) ), aWordText ( pParent, SVX_RES( FT_WORD ) ), aWordCB ( pParent, SVX_RES( CB_WORD ) ), @@ -227,6 +232,8 @@ SvxThesaurusDialog_Impl::SvxThesaurusDialog_Impl( Window* pParent ) : aOkBtn ( pParent, SVX_RES( BTN_THES_OK ) ), aCancelBtn ( pParent, SVX_RES( BTN_THES_CANCEL ) ), aErrStr ( SVX_RES( STR_ERR_WORDNOTFOUND ) ), + aVendorDefaultImage ( SVX_RES( IMG_DEFAULT_VENDOR ) ), + aVendorDefaultImageHC ( SVX_RES( IMG_DEFAULT_VENDOR_HC ) ), xThesaurus ( NULL ), aLookUpText (), nLookUpLanguage ( LANGUAGE_NONE ), @@ -242,6 +249,8 @@ SvxThesaurusDialog_Impl::SvxThesaurusDialog_Impl( Window* pParent ) : aLookUpBtn.SetClickHdl( LINK( this, SvxThesaurusDialog_Impl, LookUpHdl_Impl ) ); m_pAlternativesCT->SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, AlternativesSelectHdl_Impl )); m_pAlternativesCT->SetDoubleClickHdl( LINK( this, SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl )); + + Application::PostUserEvent( STATIC_LINK( this, SvxThesaurusDialog_Impl, VendorImageInitHdl ) ); } @@ -354,7 +363,8 @@ IMPL_LINK( SvxThesaurusDialog_Impl, LanguageHdl_Impl, MenuButton *, pBtn ) if (xThesaurus->hasLocale( SvxCreateLocale( nLang ) )) nLookUpLanguage = nLang; SetWindowTitle( nLang ); - UpdateAlternativesBox_Impl(); + UpdateVendorImage(); + UpdateAlternativesBox_Impl(); } return 0; } @@ -453,6 +463,202 @@ IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, SelectFirstHdl_Impl, SvxCheckListBox return 0; } +//////////////////////////////////////////////////////////// + +//!! temporary implement locally: +//!! once MBAs latest CWS is integrated this functions are available in svtools +//!! under a slightly different name + +#include +#include + +#define IMPGRF_INIKEY_ASLINK "ImportGraphicAsLink" +#define IMPGRF_INIKEY_PREVIEW "ImportGraphicPreview" +#define IMPGRF_CONFIGNAME String(DEFINE_CONST_UNICODE("ImportGraphicDialog")) + +GraphicFilter* lcl_GetGrfFilter() +{ + return GraphicFilter::GetGraphicFilter(); +} + +// ----------------------------------------------------------------------- + +int lcl_LoadGraphic( const String &rPath, const String &rFilterName, + Graphic& rGraphic, GraphicFilter* pFilter, + USHORT* pDeterminedFormat ) +{ + if ( !pFilter ) + pFilter = ::lcl_GetGrfFilter(); + + const USHORT nFilter = rFilterName.Len() && pFilter->GetImportFormatCount() + ? pFilter->GetImportFormatNumber( rFilterName ) + : GRFILTER_FORMAT_DONTKNOW; + + SfxMedium* pMed = 0; + + // dann teste mal auf File-Protokoll: + SvStream* pStream = NULL; + INetURLObject aURL( rPath ); + + if ( aURL.HasError() || INET_PROT_NOT_VALID == aURL.GetProtocol() ) + { + aURL.SetSmartProtocol( INET_PROT_FILE ); + aURL.SetSmartURL( rPath ); + } + else if ( INET_PROT_FILE != aURL.GetProtocol() ) + { + // z.Z. nur auf die aktuelle DocShell + pMed = new SfxMedium( rPath, STREAM_READ, TRUE ); + pMed->DownLoad(); + pStream = pMed->GetInStream(); + } + int nRes = GRFILTER_OK; + + if ( !pStream ) + nRes = pFilter->ImportGraphic( rGraphic, aURL, nFilter, pDeterminedFormat ); + else + nRes = pFilter->ImportGraphic( rGraphic, rPath, *pStream, + nFilter, pDeterminedFormat ); + if ( pMed ) + delete pMed; + return nRes; +} + +//////////////////////////////////////////////////////////// + +static Image lcl_GetImageFromPngUrl( const OUString &rFileUrl ) +{ + Image aRes; + + OUString aTmp; + osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp ); + + Graphic aGraphic; + const String aFilterName( RTL_CONSTASCII_USTRINGPARAM( IMP_PNG ) ); + if( GRFILTER_OK == lcl_LoadGraphic( aTmp, aFilterName, aGraphic, NULL, NULL ) ) + { + aRes = Image( aGraphic.GetBitmapEx() ); + } + return aRes; +} + + +static String lcl_GetThesImplName( const lang::Locale &rLocale ) +{ + String aRes; + + uno::Reference< linguistic2::XLinguServiceManager > xLngMgr; + try + { + uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); + xLngMgr = uno::Reference< linguistic2::XLinguServiceManager >( xMSF->createInstance( + OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.linguistic2.LinguServiceManager" ))), uno::UNO_QUERY_THROW ); + + DBG_ASSERT( xLngMgr.is(), "LinguServiceManager missing" ); + if (xLngMgr.is()) + { + uno::Sequence< OUString > aServiceNames = xLngMgr->getConfiguredServices( + OUString::createFromAscii("com.sun.star.linguistic2.Thesaurus"), rLocale ); + // there should be at most one thesaurus configured for each language + DBG_ASSERT( aServiceNames.getLength() <= 1, "more than one thesaurus found. Should not be possible" ); + if (aServiceNames.getLength() == 1) + aRes = aServiceNames[0]; + } + } + catch (uno::Exception &e) + { + (void) e; + DBG_ASSERT( 0, "failed to get thesaurus" ); + } + + return aRes; +} + + +void SvxThesaurusDialog_Impl::UpdateVendorImage() +{ + m_pParent->SetUpdateMode( sal_False ); + + SvtLinguConfig aCfg; + if (aCfg.HasVendorImages( "ThesaurusDialogImage" )) + { + const bool bHC = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); + + Image aImage; + String sThesImplName( lcl_GetThesImplName( SvxCreateLocale( nLookUpLanguage ) ) ); + OUString aThesDialogImageUrl( aCfg.GetThesaurusDialogImage( sThesImplName, bHC ) ); + if (sThesImplName.Len() > 0 && aThesDialogImageUrl.getLength() > 0) + aImage = Image( lcl_GetImageFromPngUrl( aThesDialogImageUrl ) ); + else + aImage = bHC ? aVendorDefaultImageHC : aVendorDefaultImage; + aVendorImageFI.SetImage( aImage ); + } + + m_pParent->SetUpdateMode( sal_True ); +} + + +IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, VendorImageInitHdl, SvxThesaurusDialog_Impl *, EMPTYARG ) +{ + pThis->m_pParent->SetUpdateMode( sal_False ); + + SvtLinguConfig aCfg; + if (aCfg.HasVendorImages( "ThesaurusDialogImage" )) + { + const bool bHC = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); + Image aImage( bHC ? pThis->aVendorDefaultImageHC : pThis->aVendorDefaultImage ); + pThis->aVendorImageFI.SetImage( aImage ); + pThis->aVendorImageFI.Show(); + + // move down visible controls according to the vendor images height + Size aVendorSize = pThis->aVendorImageFI.GetSizePixel(); + Size aImageSize = pThis->aVendorImageFI.GetImage().GetSizePixel(); + if (aImageSize.Height()) + { + aVendorSize.Height() = aImageSize.Height(); + if(aVendorSize.Width() < aImageSize.Width()) + aVendorSize.Width() = aImageSize.Width(); + pThis->aVendorImageFI.SetSizePixel( aVendorSize ); + } + const sal_Int32 nDiff = aVendorSize.Height(); + pThis->aVendorImageFI.SetSizePixel( aVendorSize ); + Control* aControls[] = { + &pThis->aLeftBtn, + &pThis->aWordText, + &pThis->aWordCB, + &pThis->aLookUpBtn, + &pThis->m_aAlternativesText, + pThis->m_pAlternativesCT.get(), + &pThis->aReplaceText, + &pThis->aReplaceEdit, + &pThis->aFL, + &pThis->aHelpBtn, + &pThis->aLangMBtn, + &pThis->aOkBtn, + &pThis->aCancelBtn, + 0 + }; + sal_Int32 nControl = 0; + while (aControls[nControl]) + { + Point aPos = aControls[nControl]->GetPosPixel(); + aPos.Y() += nDiff; + aControls[nControl]->SetPosPixel(aPos); + ++nControl; + } + Size aDlgSize = pThis->m_pParent->GetSizePixel(); + aDlgSize.Height() += nDiff; + pThis->m_pParent->SetSizePixel( aDlgSize ); + pThis->m_pParent->Invalidate(); + } + + pThis->UpdateVendorImage(); + pThis->m_pParent->SetUpdateMode( sal_True ); + + return 0; +}; + // class SvxThesaurusDialog ---------------------------------------------- diff --git a/svx/source/dialog/thesdlg.hrc b/svx/source/dialog/thesdlg.hrc index aa7a7abf31a3..2d776ca92d4f 100755 --- a/svx/source/dialog/thesdlg.hrc +++ b/svx/source/dialog/thesdlg.hrc @@ -45,16 +45,11 @@ #define FL_VAR 23 #define FT_THES_ALTERNATIVES 24 #define CT_THES_ALTERNATIVES 25 +#define IMG_VENDOR 26 +#define IMG_DEFAULT_VENDOR 27 +#define IMG_DEFAULT_VENDOR_HC 28 -#define STR_ERR_WORDNOTFOUND 30 - -// LanguageDialog -------------------------------------------------------- - -#define LB_THES_LANGUAGE 10 -#define FL_THES_LANGUAGE 11 -#define BTN_LANG_OK 12 -#define BTN_LANG_CANCEL 12 -#define BTN_LANG_HELP 13 +#define STR_ERR_WORDNOTFOUND 101 #endif diff --git a/svx/source/dialog/thesdlg.src b/svx/source/dialog/thesdlg.src index 67b37a97e15e..501b54964946 100755 --- a/svx/source/dialog/thesdlg.src +++ b/svx/source/dialog/thesdlg.src @@ -41,8 +41,15 @@ ModalDialog RID_SVXDLG_THESAURUS OutputSize = TRUE ; Size = MAP_APPFONT ( 265, 230 ) ; Text [ en-US ] = "Thesaurus" ; - Moveable = TRUE ; SvLook = TRUE ; + Moveable = TRUE ; + + FixedImage IMG_VENDOR + { + Pos = MAP_APPFONT ( 0, 0 ) ; + Size = MAP_APPFONT ( 265, 0 ) ; // correct size will be applied at runtime + Hide = TRUE; + }; ImageButton BTN_LEFT { @@ -135,5 +142,14 @@ ModalDialog RID_SVXDLG_THESAURUS { Text [ en-US ] = "Word not found in thesaurus" ; }; + + Image IMG_DEFAULT_VENDOR + { + ImageBitmap = Bitmap { File = "vendor01.png"; }; + }; + Image IMG_DEFAULT_VENDOR_HC + { + ImageBitmap = Bitmap { File = "vendor01h.png"; }; + }; }; diff --git a/svx/source/dialog/thesdlg_impl.hxx b/svx/source/dialog/thesdlg_impl.hxx index e862f2199730..848d86fca54b 100755 --- a/svx/source/dialog/thesdlg_impl.hxx +++ b/svx/source/dialog/thesdlg_impl.hxx @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -136,6 +137,7 @@ struct SvxThesaurusDialog_Impl { Window* m_pParent; + FixedImage aVendorImageFI; ImageButton aLeftBtn; FixedText aWordText; LookUpComboBox aWordCB; @@ -151,6 +153,8 @@ struct SvxThesaurusDialog_Impl CancelButton aCancelBtn; String aErrStr; + Image aVendorDefaultImage; + Image aVendorDefaultImageHC; uno::Reference< linguistic2::XThesaurus > xThesaurus; OUString aLookUpText; @@ -169,6 +173,7 @@ struct SvxThesaurusDialog_Impl DECL_LINK( AlternativesDoubleClickHdl_Impl, SvxCheckListBox * ); DECL_STATIC_LINK( SvxThesaurusDialog_Impl, SelectFirstHdl_Impl, SvxCheckListBox * ); + DECL_STATIC_LINK( SvxThesaurusDialog_Impl, VendorImageInitHdl, SvxThesaurusDialog_Impl * ); SvxThesaurusDialog_Impl( Window* pParent ); @@ -178,6 +183,7 @@ struct SvxThesaurusDialog_Impl queryMeanings_Impl( ::rtl::OUString& rTerm, const lang::Locale& rLocale, const beans::PropertyValues& rProperties ) throw(lang::IllegalArgumentException, uno::RuntimeException); bool UpdateAlternativesBox_Impl(); + void UpdateVendorImage(); void SetWindowTitle( LanguageType nLanguage ); }; -- cgit From e474be5696a4c026ba6831b54f3a3abe532542e5 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Fri, 5 Feb 2010 14:55:32 +0100 Subject: #161586# minor fix for LookUp --- svx/source/dialog/thesdlg.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) mode change 100644 => 100755 svx/source/dialog/thesdlg.cxx (limited to 'svx') diff --git a/svx/source/dialog/thesdlg.cxx b/svx/source/dialog/thesdlg.cxx old mode 100644 new mode 100755 index a47bee57b79a..2c77545d2bae --- a/svx/source/dialog/thesdlg.cxx +++ b/svx/source/dialog/thesdlg.cxx @@ -340,7 +340,7 @@ void SvxThesaurusDialog_Impl::SetWindowTitle( LanguageType nLanguage ) IMPL_LINK( SvxThesaurusDialog_Impl, LeftBtnHdl_Impl, Button *, pBtn ) { - if (pBtn) + if (pBtn && aLookUpHistory.size() >= 2) { aLookUpHistory.pop(); // remove current look up word from stack aWordCB.SetText( aLookUpHistory.top() ); // retrieve previous look up word @@ -364,7 +364,7 @@ IMPL_LINK( SvxThesaurusDialog_Impl, LanguageHdl_Impl, MenuButton *, pBtn ) nLookUpLanguage = nLang; SetWindowTitle( nLang ); UpdateVendorImage(); - UpdateAlternativesBox_Impl(); + LookUpHdl_Impl( NULL ); } return 0; } @@ -375,7 +375,8 @@ IMPL_LINK( SvxThesaurusDialog_Impl, LookUpHdl_Impl, Button *, EMPTYARG /*pBtn*/ String aText( aWordCB.GetText() ); aLookUpText = OUString( aText ); - if (aLookUpText.getLength() > 0) + if (aLookUpText.getLength() > 0 && + (aLookUpHistory.size() == 0 || aLookUpText != aLookUpHistory.top())) aLookUpHistory.push( aLookUpText ); UpdateAlternativesBox_Impl(); -- cgit From 830a87f87567a467d6e32fa06f9585e6d9dd813d Mon Sep 17 00:00:00 2001 From: os Date: Mon, 8 Feb 2010 12:08:54 +0100 Subject: #i103024# display and use of tab stops fixed --- svx/source/dialog/svxruler.cxx | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) (limited to 'svx') diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx index a07cf1f254d2..b76db960d526 100644 --- a/svx/source/dialog/svxruler.cxx +++ b/svx/source/dialog/svxruler.cxx @@ -1217,9 +1217,7 @@ void SvxRuler::UpdateTabs() long nRightFrameMargin = GetRightFrameMargin(); //#i24363# tab stops relative to indent - const long nParaItemTxtLeft = pRuler_Imp->bIsTabsRelativeToIndent ? - pParaItem->GetTxtLeft() : - 0; + const long nParaItemTxtLeft = pParaItem->GetTxtLeft(); const long lParaIndent = nLeftFrameMargin + nParaItemTxtLeft; @@ -1256,7 +1254,7 @@ void SvxRuler::UpdateTabs() const SvxTabStop *pTab = &(*pTabStopItem)[j]; pTabs[nTabCount+TAB_GAP].nPos = ConvertHPosPixel( - lParaIndent + pTab->GetTabPos() + lAppNullOffset); + (pRuler_Imp->bIsTabsRelativeToIndent ? lParaIndent : 0 ) + pTab->GetTabPos() + lAppNullOffset); if(bRTL) { pTabs[nTabCount+TAB_GAP].nPos = lParaIndentPix + lRightPixMargin - pTabs[nTabCount+TAB_GAP].nPos; @@ -1289,13 +1287,37 @@ void SvxRuler::UpdateTabs() { for(j = 0; j < nDefTabBuf; ++j) { - pTabs[nTabCount + TAB_GAP].nPos = + if( j == 0 ) + { + //set the first default tab stop + if(pRuler_Imp->bIsTabsRelativeToIndent) + { + pTabs[nTabCount + TAB_GAP].nPos = + (pTabs[nTabCount].nPos + nDefTabDist); + pTabs[nTabCount + TAB_GAP].nPos -= + ((pTabs[nTabCount + TAB_GAP].nPos - lParaIndentPix) + % nDefTabDist ); + } + else + { + if( pTabs[nTabCount].nPos < 0 ) + { + pTabs[nTabCount + TAB_GAP].nPos = ( pTabs[nTabCount].nPos / nDefTabDist ) * nDefTabDist; + } + else + { + pTabs[nTabCount + TAB_GAP].nPos = ( pTabs[nTabCount].nPos / nDefTabDist + 1 ) * nDefTabDist; + } + } + + } + else + { + //simply add the default distance to the last position + pTabs[nTabCount + TAB_GAP].nPos = pTabs[nTabCount].nPos + nDefTabDist; + } - if(j == 0 ) - pTabs[nTabCount + TAB_GAP].nPos -= - ((pTabs[nTabCount + TAB_GAP].nPos - lParaIndentPix) - % nDefTabDist ); if(pTabs[nTabCount+TAB_GAP].nPos >= lRightIndent) break; pTabs[nTabCount + TAB_GAP].nStyle = RULER_TAB_DEFAULT; -- cgit From 737eebe72d6fbf5af87d61b229b036da9469683b Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Mon, 8 Feb 2010 13:05:08 +0100 Subject: fixed build errors on unix systems --- svx/source/tbxctrls/fontworkgallery.cxx | 2 +- svx/source/tbxctrls/toolbarmenu.cxx | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'svx') diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx index 2148d116db1a..49f4673e0a4f 100644 --- a/svx/source/tbxctrls/fontworkgallery.cxx +++ b/svx/source/tbxctrls/fontworkgallery.cxx @@ -412,7 +412,7 @@ void SAL_CALL FontWorkAlignmentWindow::statusChanged( const ::com::sun::star::fr } else { - sal_Int32 nValue; + sal_Int32 nValue = 0; if( Event.State >>= nValue ) implSetAlignment( nValue, true ); } diff --git a/svx/source/tbxctrls/toolbarmenu.cxx b/svx/source/tbxctrls/toolbarmenu.cxx index 7c739064bdfa..f99fdd0c8a37 100644 --- a/svx/source/tbxctrls/toolbarmenu.cxx +++ b/svx/source/tbxctrls/toolbarmenu.cxx @@ -964,16 +964,16 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) aTmpPos.Y() = aPos.Y(); aTmpPos.Y() += (pEntry->maSize.Height()-pEntry->maImage.GetSizePixel().Height())/2; - Rectangle aRect( aTmpPos, pEntry->maImage.GetSizePixel() ); - aRect.nLeft -= 2; - aRect.nTop -= 2; - aRect.nRight += 2; - aRect.nBottom += 2; - DrawSelectionBackground( aRect, false, true, TRUE, TRUE ); + Rectangle aSelRect( aTmpPos, pEntry->maImage.GetSizePixel() ); + aSelRect.nLeft -= 2; + aSelRect.nTop -= 2; + aSelRect.nRight += 2; + aSelRect.nBottom += 2; + DrawSelectionBackground( aSelRect, false, true, TRUE, TRUE ); } else { - Rectangle aRect; + Rectangle aSelRect; SymbolType eSymbol; aTmpPos.Y() = aPos.Y(); aTmpPos.Y() += nExtra/2; @@ -983,16 +983,16 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) aTmpPos.X() = aPos.X() + mnCheckPos; eSymbol = SYMBOL_RADIOCHECKMARK; aTmpPos.Y() -= nFontHeight/4; - aRect = Rectangle( aTmpPos, Size( nFontHeight/2, nFontHeight/2 ) ); + aSelRect = Rectangle( aTmpPos, Size( nFontHeight/2, nFontHeight/2 ) ); } else { aTmpPos.X() = aPos.X() + mnCheckPos; eSymbol = SYMBOL_CHECKMARK; aTmpPos.Y() -= nFontHeight/4; - aRect = Rectangle( aTmpPos, Size( (nFontHeight*25)/40, nFontHeight/2 ) ); + aSelRect = Rectangle( aTmpPos, Size( (nFontHeight*25)/40, nFontHeight/2 ) ); } - aDecoView.DrawSymbol( aRect, eSymbol, GetTextColor(), nSymbolStyle ); + aDecoView.DrawSymbol( aSelRect, eSymbol, GetTextColor(), nSymbolStyle ); } } } -- cgit From 1e76109004db25f8d4906852124252738e54403a Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 8 Feb 2010 14:04:15 +0100 Subject: dba33f: #i53377# handle read-only columns in grid control --- svx/source/fmcomp/fmgridcl.cxx | 3 +- svx/source/fmcomp/gridcell.cxx | 65 ++++++++++++++++++++++++++++++++++-------- svx/source/inc/gridcell.hxx | 3 +- 3 files changed, 57 insertions(+), 14 deletions(-) (limited to 'svx') diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx index 89b18a05f650..b12cd41a9872 100644 --- a/svx/source/fmcomp/fmgridcl.cxx +++ b/svx/source/fmcomp/fmgridcl.cxx @@ -1741,11 +1741,12 @@ void FmGridControl::InitColumnByField( _pColumn->SetObject( (sal_Int16)nFieldPos ); return; } - +/* // handle readonly columns sal_Bool bReadOnly = sal_True; xField->getPropertyValue( FM_PROP_ISREADONLY ) >>= bReadOnly; _pColumn->SetReadOnly( bReadOnly ); +*/ } // the control type is determined by the ColumnServiceName diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index 92e8d9aebaa1..69f099da8c7e 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -557,6 +557,7 @@ TYPEINIT1( DbFilterField, DbCellControl ) //------------------------------------------------------------------------------ DbCellControl::DbCellControl( DbGridColumn& _rColumn, sal_Bool /*_bText*/ ) :OPropertyChangeListener(m_aMutex) + ,m_pFieldChangeBroadcaster(NULL) ,m_bTransparent( sal_False ) ,m_bAlignedController( sal_True ) ,m_bAccessingValueProperty( sal_False ) @@ -580,6 +581,31 @@ DbCellControl::DbCellControl( DbGridColumn& _rColumn, sal_Bool /*_bText*/ ) implDoPropertyListening( FM_PROP_STATE, sal_False ); implDoPropertyListening( FM_PROP_TEXT, sal_False ); implDoPropertyListening( FM_PROP_EFFECTIVE_VALUE, sal_False ); + + // be listener at the bound field as well + try + { + Reference< XPropertySet > xColModelProps( m_rColumn.getModel(), UNO_QUERY ); + Reference< XPropertySetInfo > xPSI; + if ( xColModelProps.is() ) + xPSI = xColModelProps->getPropertySetInfo(); + + if ( xPSI.is() && xPSI->hasPropertyByName( FM_PROP_BOUNDFIELD ) ) + { + Reference< XPropertySet > xField; + xColModelProps->getPropertyValue( FM_PROP_BOUNDFIELD ) >>= xField; + if ( xField.is() ) + { + m_pFieldChangeBroadcaster = new ::comphelper::OPropertyChangeMultiplexer(this, xField); + m_pFieldChangeBroadcaster->acquire(); + m_pFieldChangeBroadcaster->addProperty( FM_PROP_ISREADONLY ); + } + } + } + catch( const Exception& ) + { + DBG_ERROR( "DbCellControl::doPropertyListening: caught an exception!" ); + } } } @@ -611,17 +637,22 @@ void DbCellControl::doPropertyListening( const ::rtl::OUString& _rPropertyName ) { implDoPropertyListening( _rPropertyName ); } - //------------------------------------------------------------------------------ -DbCellControl::~DbCellControl() +void lcl_clearBroadCaster(::comphelper::OPropertyChangeMultiplexer*& _pBroadcaster) { - if ( m_pModelChangeBroadcaster ) + if ( _pBroadcaster ) { - m_pModelChangeBroadcaster->dispose(); - m_pModelChangeBroadcaster->release(); - m_pModelChangeBroadcaster = NULL; + _pBroadcaster->dispose(); + _pBroadcaster->release(); + _pBroadcaster = NULL; // no delete, this is done implicitly } +} +//------------------------------------------------------------------------------ +DbCellControl::~DbCellControl() +{ + lcl_clearBroadCaster(m_pModelChangeBroadcaster); + lcl_clearBroadCaster(m_pFieldChangeBroadcaster); delete m_pWindow; delete m_pPainter; @@ -666,7 +697,14 @@ void DbCellControl::_propertyChanged(const PropertyChangeEvent& _rEvent) throw(R } else if ( _rEvent.PropertyName.equals( FM_PROP_READONLY ) ) { - implAdjustReadOnly( xSourceProps ); + implAdjustReadOnly( xSourceProps, true); + } + else if ( _rEvent.PropertyName.equals( FM_PROP_ISREADONLY ) ) + { + sal_Bool bReadOnly = sal_True; + _rEvent.NewValue >>= bReadOnly; + m_rColumn.SetReadOnly(bReadOnly); + implAdjustReadOnly( xSourceProps, false); } else if ( _rEvent.PropertyName.equals( FM_PROP_ENABLED ) ) { @@ -804,7 +842,7 @@ void DbCellControl::ImplInitWindow( Window& rParent, const InitWindowFacet _eIni } //------------------------------------------------------------------------------ -void DbCellControl::implAdjustReadOnly( const Reference< XPropertySet >& _rxModel ) +void DbCellControl::implAdjustReadOnly( const Reference< XPropertySet >& _rxModel,bool i_bReadOnly ) { DBG_ASSERT( m_pWindow, "DbCellControl::implAdjustReadOnly: not to be called without window!" ); DBG_ASSERT( _rxModel.is(), "DbCellControl::implAdjustReadOnly: invalid model!" ); @@ -813,9 +851,12 @@ void DbCellControl::implAdjustReadOnly( const Reference< XPropertySet >& _rxMode Edit* pEditWindow = dynamic_cast< Edit* >( m_pWindow ); if ( pEditWindow ) { - sal_Bool bReadOnly = sal_True; - _rxModel->getPropertyValue( FM_PROP_READONLY ) >>= bReadOnly; - static_cast< Edit* >( m_pWindow )->SetReadOnly( m_rColumn.IsReadOnly() || bReadOnly ); + sal_Bool bReadOnly = m_rColumn.IsReadOnly(); + if ( !bReadOnly ) + { + _rxModel->getPropertyValue( i_bReadOnly ? FM_PROP_READONLY : FM_PROP_ISREADONLY) >>= bReadOnly; + } + static_cast< Edit* >( m_pWindow )->SetReadOnly( bReadOnly ); } } } @@ -852,7 +893,7 @@ void DbCellControl::Init( Window& rParent, const Reference< XRowSet >& _rxCursor if ( xModelPSI->hasPropertyByName( FM_PROP_READONLY ) ) { - implAdjustReadOnly( xModel ); + implAdjustReadOnly( xModel,true ); } if ( xModelPSI->hasPropertyByName( FM_PROP_ENABLED ) ) diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx index b3792b76422c..a81e860844f3 100644 --- a/svx/source/inc/gridcell.hxx +++ b/svx/source/inc/gridcell.hxx @@ -222,6 +222,7 @@ class DbCellControl { private: ::comphelper::OPropertyChangeMultiplexer* m_pModelChangeBroadcaster; + ::comphelper::OPropertyChangeMultiplexer* m_pFieldChangeBroadcaster; private: sal_Bool m_bTransparent : 1; @@ -351,7 +352,7 @@ private: void implDoPropertyListening( const ::rtl::OUString& _rPropertyName, sal_Bool _bWarnIfNotExistent = sal_True ); /// updates the "readonly" setting on m_pWindow, according to the respective property value in the given model - void implAdjustReadOnly( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel ); + void implAdjustReadOnly( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel,bool i_bReadOnly ); /// updates the "enabled" setting on m_pWindow, according to the respective property value in the given model void implAdjustEnabled( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel ); -- cgit From be823b13e919dca677905ead35a95087bd9f963f Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 15 Feb 2010 10:11:09 +0100 Subject: dba33f: #i53377# new event and listener to get the changed bookmarks and refresh the grid --- svx/inc/svx/gridctrl.hxx | 16 +++++++++++--- svx/source/fmcomp/gridcell.cxx | 2 +- svx/source/fmcomp/gridctrl.cxx | 47 ++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 59 insertions(+), 6 deletions(-) (limited to 'svx') diff --git a/svx/inc/svx/gridctrl.hxx b/svx/inc/svx/gridctrl.hxx index 834ea17eaa1f..d8810c55d337 100644 --- a/svx/inc/svx/gridctrl.hxx +++ b/svx/inc/svx/gridctrl.hxx @@ -32,6 +32,8 @@ #include #include +#include +#include #include #include #include @@ -250,6 +252,8 @@ private: // For that reason we have to listen to some properties of our data source. ::comphelper::OPropertyChangeMultiplexer* m_pDataSourcePropMultiplexer; FmXGridSourcePropListener* m_pDataSourcePropListener; + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowsChangeListener> + m_xRowSetListener; // get notification when rows were changed void* m_pFieldListeners; // property listeners for field values @@ -526,15 +530,20 @@ public: void setGridListener( FmGridListener* _pListener ) { m_pGridListener = _pListener; } // helper class to grant access to selected methods from within the DbCellControl class - struct GrantCellControlAccess + struct GrantControlAccess { friend class DbCellControl; + friend class RowSetEventListener; protected: - GrantCellControlAccess() { } + GrantControlAccess() { } }; /// called when a controller needs to be re-initialized - void refreshController(sal_uInt16 _nColId, GrantCellControlAccess _aAccess); + void refreshController(sal_uInt16 _nColId, GrantControlAccess _aAccess); + + CursorWrapper* GetSeekCursor(GrantControlAccess /*_aAccess*/) const { return m_pSeekCursor; } + const DbGridRowRef& GetSeekRow(GrantControlAccess /*_aAccess*/) const { return m_xSeekRow; } + void SetSeekPos(sal_Int32 nPos,GrantControlAccess /*_aAccess*/) {m_nSeekPos = nPos;} /** @return @@ -589,6 +598,7 @@ protected: const DbGridRowRef& GetPaintRow() const { return m_xPaintRow; } CursorWrapper* GetSeekCursor() const { return m_pSeekCursor; } + void ConnectToFields(); void DisconnectFromFields(); diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index 69f099da8c7e..e0a683b64db3 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -1050,7 +1050,7 @@ double DbCellControl::GetValue(const Reference< ::com::sun::star::sdb::XColumn > //------------------------------------------------------------------------------ void DbCellControl::invalidatedController() { - m_rColumn.GetParent().refreshController(m_rColumn.GetId(), DbGridControl::GrantCellControlAccess()); + m_rColumn.GetParent().refreshController(m_rColumn.GetId(), DbGridControl::GrantControlAccess()); } /*************************************************************************/ diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index 173354958150..9b785531e766 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -47,6 +47,8 @@ #include #include #include +#include +#include #include #include #include @@ -105,6 +107,39 @@ using namespace com::sun::star::accessibility; | BROWSER_VLINESFULL \ | BROWSER_HEADERBAR_NEW \ +class RowSetEventListener : public ::cppu::WeakImplHelper1 +{ + DbGridControl* m_pControl; +public: + RowSetEventListener(DbGridControl* i_pControl) : m_pControl(i_pControl) + { + } +private: + // XEventListener + virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& /*i_aEvt*/) + { + } + virtual void SAL_CALL rowsChanged(const ::com::sun::star::sdb::RowsChangeEvent& i_aEvt) + { + if ( i_aEvt.Action == RowChangeAction::UPDATE ) + { + ::DbGridControl::GrantControlAccess aAccess; + CursorWrapper* pSeek = m_pControl->GetSeekCursor(aAccess); + const DbGridRowRef& rSeekRow = m_pControl->GetSeekRow(aAccess); + const Any* pIter = i_aEvt.Bookmarks.getConstArray(); + const Any* pEnd = pIter + i_aEvt.Bookmarks.getLength(); + for(;pIter != pEnd;++pIter) + { + pSeek->moveToBookmark(*pIter); + // get the data + rSeekRow->SetState(pSeek, sal_True); + sal_Int32 nSeekPos = pSeek->getRow() - 1; + m_pControl->SetSeekPos(nSeekPos,aAccess); + m_pControl->RowModified(nSeekPos); + } + } + } +}; //============================================================================== class GridFieldValueListener; @@ -990,6 +1025,7 @@ DbGridControl::~DbGridControl() m_pDataSourcePropMultiplexer = NULL; m_pDataSourcePropListener = NULL; } + m_xRowSetListener.clear(); delete m_pDataCursor; delete m_pSeekCursor; @@ -1380,7 +1416,7 @@ sal_Bool DbGridControl::IsPermanentCursorEnabled() const } //------------------------------------------------------------------------------ -void DbGridControl::refreshController(sal_uInt16 _nColId, GrantCellControlAccess /*_aAccess*/) +void DbGridControl::refreshController(sal_uInt16 _nColId, GrantControlAccess /*_aAccess*/) { if ((GetCurColumnId() == _nColId) && IsEditing()) { // the controller which is currently active needs to be refreshed @@ -1415,6 +1451,7 @@ void DbGridControl::setDataSource(const Reference< XRowSet >& _xCursor, sal_uInt m_pDataSourcePropMultiplexer = NULL; m_pDataSourcePropListener = NULL; } + m_xRowSetListener.clear(); // is the new cursor valid ? // the cursor is only valid if it contains some columns @@ -1506,7 +1543,7 @@ void DbGridControl::setDataSource(const Reference< XRowSet >& _xCursor, sal_uInt Reference< XPropertySet > xSet(_xCursor, UNO_QUERY); if (xSet.is()) { - // feststellen welche Updatem�glichkeiten bestehen + // feststellen welche Updatemoeglichkeiten bestehen sal_Int32 nConcurrency = ResultSetConcurrency::READ_ONLY; xSet->getPropertyValue(FM_PROP_RESULTSET_CONCURRENCY) >>= nConcurrency; @@ -1568,6 +1605,12 @@ void DbGridControl::setDataSource(const Reference< XRowSet >& _xCursor, sal_uInt xSet->getPropertyValue(FM_PROP_ROWCOUNT) >>= nRecordCount; m_bRecordCountFinal = ::comphelper::getBOOL(xSet->getPropertyValue(FM_PROP_ROWCOUNTFINAL)); + m_xRowSetListener = new RowSetEventListener(this); + Reference< XRowsChangeBroadcaster> xChangeBroad(xSet,UNO_QUERY); + if ( xChangeBroad.is( ) ) + xChangeBroad->addRowsChangeListener(m_xRowSetListener); + + // insert the currently known rows // and one row if we are able to insert rows if (m_nOptions & OPT_INSERT) -- cgit From ee11939027272d48e9e0691dd47993c250edeb27 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 19 Feb 2010 11:45:02 +0100 Subject: dba33f: #i109403#: ControlHolder::invalidate: allowed to have no Window, *if* we have no peer --- svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'svx') diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index 81d19df1e2fa..dc5770b37592 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -302,10 +302,14 @@ namespace sdr { namespace contact { //-------------------------------------------------------------------- void ControlHolder::invalidate() const { - Window* pWindow = VCLUnoHelper::GetWindow( m_xControl->getPeer() ); - OSL_ENSURE( pWindow, "ControlHolder::invalidate: no implementation access!" ); - if ( pWindow ) - pWindow->Invalidate(); + Reference< XWindowPeer > xPeer( m_xControl->getPeer() ); + if ( xPeer.is() ) + { + Window* pWindow = VCLUnoHelper::GetWindow( xPeer ); + OSL_ENSURE( pWindow, "ControlHolder::invalidate: no implementation access!" ); + if ( pWindow ) + pWindow->Invalidate(); + } } //-------------------------------------------------------------------- -- cgit From a0c5d9c462f98ef6065e5ca31bf25d773bc4d6ad Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 19 Feb 2010 11:59:23 +0100 Subject: dba33f: do not call MakeVisible with an empty rect, this gives assertions --- svx/source/form/navigatortree.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'svx') diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx index e03f3d121514..da3360022bc6 100644 --- a/svx/source/form/navigatortree.cxx +++ b/svx/source/form/navigatortree.cxx @@ -2235,7 +2235,7 @@ namespace svxform { SdrPaintWindow* pPaintWindow = pFormView->GetPaintWindow( i ); OutputDevice& rOutDev = pPaintWindow->GetOutputDevice(); - if ( OUTDEV_WINDOW == rOutDev.GetOutDevType() ) + if ( ( OUTDEV_WINDOW == rOutDev.GetOutDevType() ) && !aMarkRect.IsEmpty() ) { pFormView->MakeVisible( aMarkRect, (Window&)rOutDev ); } -- cgit From dabd58773267c42a03cfa6c10ddf76944a40ef38 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 19 Feb 2010 22:40:09 +0100 Subject: dba33f: use Ctrl-F5 to toggle the focus between a control and the document. At least in Writer. In this course, SID_FM_GRABCONTROLFOCUS has been renamed to SID_FM_TOGGLECONTROLFOCUS (with the UNO slot name also being affected.). Also, now Writer handles the SID_FM_TOGGLECONTROLFOCUS slot (instead of the FmFormShell), and calls the newly introduced ToggleControlFocus at the FmFormShell. A part of SwFEShell::GotoObj has been outsourced into SwFEShell::GetBestObject, which now can deliver the object (not only object group) of the given type, which is neares to the current position. --- svx/inc/svx/fmshell.hxx | 22 +++++++ svx/inc/svx/sdrobjectfilter.hxx | 58 +++++++++++++++++ svx/inc/svx/svxids.hrc | 2 +- svx/prj/d.lst | 1 + svx/sdi/fmslots.sdi | 2 +- svx/sdi/svx.sdi | 2 +- svx/source/form/fmshell.cxx | 101 +++++++++++++++++++++++++++-- svx/source/form/fmshimp.cxx | 26 ++++++++ svx/source/form/fmvwimp.cxx | 93 ++++++++++++++------------ svx/source/inc/fmshimp.hxx | 3 + svx/source/inc/fmvwimp.hxx | 5 ++ svx/source/svdraw/svdobj.cxx | 8 +++ svx/uiconfig/accelerator/en-US/default.xml | 2 +- svx/uiconfig/accelerator/es/default.xml | 2 +- 14 files changed, 275 insertions(+), 52 deletions(-) create mode 100644 svx/inc/svx/sdrobjectfilter.hxx (limited to 'svx') diff --git a/svx/inc/svx/fmshell.hxx b/svx/inc/svx/fmshell.hxx index 9f180156367f..7c679d4d138a 100644 --- a/svx/inc/svx/fmshell.hxx +++ b/svx/inc/svx/fmshell.hxx @@ -63,6 +63,11 @@ namespace com { namespace sun { namespace star { namespace form { } } } } } +namespace svx +{ + class ISdrObjectFilter; +} + //======================================================================== class SVX_DLLPUBLIC FmDesignModeChangedHint : public SfxHint { @@ -149,11 +154,28 @@ public: const OutputDevice& _rDevice, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _out_rxControl ) const; + ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > GetFormController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm, const SdrView& _rView, const OutputDevice& _rDevice ) const; + + /** puts the focus into the document window, if current a form control has the focus. Otherwise, moves the focus + to the control belonging to the given SdrUnoObj. + */ + void ToggleControlFocus( + const SdrUnoObj& i_rNextCandidate, + const SdrView& i_rView, + OutputDevice& i_rDevice + ) const; + + ::std::auto_ptr< ::svx::ISdrObjectFilter > + CreateFocusableControlFilter( + const SdrView& i_rView, + const OutputDevice& i_rDevice + ) const; + sal_Bool IsDesignMode() const { return m_bDesignMode; } void SetDesignMode( sal_Bool _bDesignMode ); diff --git a/svx/inc/svx/sdrobjectfilter.hxx b/svx/inc/svx/sdrobjectfilter.hxx new file mode 100644 index 000000000000..55eda09c99af --- /dev/null +++ b/svx/inc/svx/sdrobjectfilter.hxx @@ -0,0 +1,58 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +************************************************************************/ + +#ifndef SDROBJECTFILTER_HXX +#define SDROBJECTFILTER_HXX + +#include "svx/svxdllapi.h" + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +class SdrObject; + +//........................................................................ +namespace svx +{ +//........................................................................ + + //==================================================================== + //= SdrObjectFilter + //==================================================================== + /** specifies a boolean predicate on the set of all SdrObjects - vulgo a filter. + */ + class SVX_DLLPUBLIC SAL_NO_VTABLE ISdrObjectFilter + { + public: + virtual bool includeObject( const SdrObject& i_rObject ) const = 0; + + virtual ~ISdrObjectFilter() = 0; + }; + +//........................................................................ +} // namespace svx +//........................................................................ + +#endif // SDROBJECTFILTER_HXX diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc index 5c541b3b24dd..7c7d54e2df82 100644 --- a/svx/inc/svx/svxids.hrc +++ b/svx/inc/svx/svxids.hrc @@ -1102,7 +1102,7 @@ #define SID_DSBROWSER_EXPLORER ( SID_SVX_START + 764 ) #define SID_FM_CREATE_FIELDCONTROL ( SID_SVX_START + 765 ) #define SID_FM_DATACCESS_DESCRIPTOR ( SID_SVX_START + 766 ) -#define SID_FM_GRABCONTROLFOCUS ( SID_SVX_START + 767 ) +#define SID_FM_TOGGLECONTROLFOCUS ( SID_SVX_START + 767 ) #define SID_FM_SCROLLBAR ( SID_SVX_START + 768 ) #define SID_FM_SPINBUTTON ( SID_SVX_START + 769 ) #define SID_FM_CONVERTTO_SCROLLBAR ( SID_SVX_START + 770 ) diff --git a/svx/prj/d.lst b/svx/prj/d.lst index 8b4675feb3e9..b3a7c30be715 100644 --- a/svx/prj/d.lst +++ b/svx/prj/d.lst @@ -577,6 +577,7 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\svx\databaselocationinput.hxx %_DEST%\inc%_EXT%\svx\databaselocationinput.hxx ..\inc\svx\dbcharsethelper.hxx %_DEST%\inc%_EXT%\svx\dbcharsethelper.hxx ..\inc\svx\dbtoolsclient.hxx %_DEST%\inc%_EXT%\svx\dbtoolsclient.hxx +..\inc\svx\sdrobjectfilter.hxx %_DEST%\inc%_EXT%\svx\sdrobjectfilter.hxx ..\inc\svx\subtoolboxcontrol.hxx %_DEST%\inc%_EXT%\svx\subtoolboxcontrol.hxx ..\inc\svx\svdtext.hxx %_DEST%\inc%_EXT%\svx\svdtext.hxx diff --git a/svx/sdi/fmslots.sdi b/svx/sdi/fmslots.sdi index f372c6ad5e4b..612df2fbafc0 100644 --- a/svx/sdi/fmslots.sdi +++ b/svx/sdi/fmslots.sdi @@ -660,7 +660,7 @@ shell FmFormShell [ ExecMethod = Execute ; ] - SID_FM_GRABCONTROLFOCUS + SID_FM_TOGGLECONTROLFOCUS [ ExecMethod = Execute ; ] diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index e3826708c196..cfdc5f45aa5d 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -11728,7 +11728,7 @@ SfxVoidItem ZoomVisArea SID_SIZE_VISAREA ] //-------------------------------------------------------------------------- -SfxVoidItem GrabControlFocus SID_FM_GRABCONTROLFOCUS +SfxVoidItem ToggleControlFocus SID_FM_TOGGLECONTROLFOCUS () [ /* flags: */ diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx index 93cf9c1778af..5219ff43ac0c 100644 --- a/svx/source/form/fmshell.cxx +++ b/svx/source/form/fmshell.cxx @@ -81,6 +81,7 @@ #include #include #include +#include #include #include #include @@ -101,6 +102,8 @@ #include //CHINA001 #include //CHINA001 +#include "svx/sdrobjectfilter.hxx" + #define HANDLE_SQL_ERRORS( action, successflag, context, message ) \ try \ { \ @@ -550,7 +553,7 @@ void FmFormShell::Execute(SfxRequest &rReq) case SID_FM_SCROLLBAR: case SID_FM_SPINBUTTON: { - SFX_REQUEST_ARG( rReq, pGrabFocusItem, SfxBoolItem, SID_FM_GRABCONTROLFOCUS, sal_False ); + SFX_REQUEST_ARG( rReq, pGrabFocusItem, SfxBoolItem, SID_FM_TOGGLECONTROLFOCUS, sal_False ); if ( pGrabFocusItem && pGrabFocusItem->GetValue() ) { // see below SfxViewShell* pShell = GetViewShell(); @@ -578,9 +581,9 @@ void FmFormShell::Execute(SfxRequest &rReq) { // #99013# if selected with control key, return focus to current view // do this asynchron, so that the creation can be finished first - // reusing the SID_FM_GRABCONTROLFOCUS is somewhat hacky ... which it wouldn't if it would have another + // reusing the SID_FM_TOGGLECONTROLFOCUS is somewhat hacky ... which it wouldn't if it would have another // name, so I do not really have a big problem with this .... - SfxBoolItem aGrabFocusIndicatorItem( SID_FM_GRABCONTROLFOCUS, sal_True ); + SfxBoolItem aGrabFocusIndicatorItem( SID_FM_TOGGLECONTROLFOCUS, sal_True ); GetViewShell()->GetViewFrame()->GetDispatcher()->Execute( nSlot, SFX_CALLMODE_ASYNCHRON, &aGrabFocusIndicatorItem, NULL ); } @@ -601,11 +604,27 @@ void FmFormShell::Execute(SfxRequest &rReq) } break; - case SID_FM_GRABCONTROLFOCUS: + case SID_FM_TOGGLECONTROLFOCUS: { FmFormView* pFormView = GetFormView(); - if ( pFormView ) + if ( !pFormView ) + break; + + // if we execute this ourself, then either the application does not implement an own handling for this, + // of we're on the top of the dispatcher stack, which means a control has the focus. + // In the latter case, we put the focus to the document window, otherwise, we focus the first control + const bool bHasControlFocus = GetImpl()->HasControlFocus(); + if ( bHasControlFocus ) + { + const OutputDevice* pDevice = GetCurrentViewDevice(); + Window* pWindow = static_cast< Window* >( const_cast< OutputDevice* >( pDevice ) ); + if ( pWindow ) + pWindow->GrabFocus(); + } + else + { pFormView->GrabFirstControlFocus( ); + } } break; @@ -1361,6 +1380,78 @@ namespace } } +//------------------------------------------------------------------------ +void FmFormShell::ToggleControlFocus( const SdrUnoObj& i_rUnoObject, const SdrView& i_rView, OutputDevice& i_rDevice ) const +{ + try + { + // check if the focus currently is in a control + // Well, okay, do it the other way 'round: Check whether the current control of the active controller + // actually has the focus. This should be equivalent. + const bool bHasControlFocus = GetImpl()->HasControlFocus(); + + if ( bHasControlFocus ) + { + Window* pWindow( dynamic_cast< Window* >( &i_rDevice ) ); + OSL_ENSURE( pWindow, "FmFormShell::ToggleControlFocus: I need a Window, really!" ); + if ( pWindow ) + pWindow->GrabFocus(); + } + else + { + Reference< XControl > xControl; + GetFormControl( i_rUnoObject.GetUnoControlModel(), i_rView, i_rDevice, xControl ); + Reference< XWindow > xControlWindow( xControl, UNO_QUERY ); + if ( xControlWindow.is() ) + xControlWindow->setFocus(); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + +//------------------------------------------------------------------------ +namespace +{ + class FocusableControlsFilter : public ::svx::ISdrObjectFilter + { + public: + FocusableControlsFilter( const SdrView& i_rView, const OutputDevice& i_rDevice ) + :m_rView( i_rView ) + ,m_rDevice( i_rDevice ) + { + } + + public: + virtual bool includeObject( const SdrObject& i_rObject ) const + { + const SdrUnoObj* pUnoObj = dynamic_cast< const SdrUnoObj* >( &i_rObject ); + if ( !pUnoObj ) + return false; + + Reference< XControl > xControl = pUnoObj->GetUnoControl( m_rView, m_rDevice ); + return FmXFormView::isFocusable( xControl ); + } + + private: + const SdrView& m_rView; + const OutputDevice& m_rDevice; + }; +} + +//------------------------------------------------------------------------ +::std::auto_ptr< ::svx::ISdrObjectFilter > FmFormShell::CreateFocusableControlFilter( const SdrView& i_rView, const OutputDevice& i_rDevice ) const +{ + ::std::auto_ptr< ::svx::ISdrObjectFilter > pFilter; + + if ( !i_rView.IsDesignMode() ) + pFilter.reset( new FocusableControlsFilter( i_rView, i_rDevice ) ); + + return pFilter; +} + //------------------------------------------------------------------------ SdrUnoObj* FmFormShell::GetFormControl( const Reference< XControlModel >& _rxModel, const SdrView& _rView, const OutputDevice& _rDevice, Reference< XControl >& _out_rxControl ) const { diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 38df41896f13..2ac74c679e09 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -59,6 +59,7 @@ #include "svx/svxids.hrc" /** === begin UNO includes === **/ +#include #include #include #include @@ -4508,6 +4509,31 @@ void FmXFormShell::handleMouseButtonDown( const SdrViewEvent& _rViewEvent ) } } +//------------------------------------------------------------------------------ +bool FmXFormShell::HasControlFocus() const +{ + bool bHasControlFocus = false; + + try + { + Reference< XFormController > xController( getActiveController() ); + Reference< XControl > xCurrentControl; + if ( xController.is() ) + xCurrentControl.set( xController->getCurrentControl() ); + if ( xCurrentControl.is() ) + { + Reference< XWindow2 > xPeerWindow( xCurrentControl->getPeer(), UNO_QUERY_THROW ); + bHasControlFocus = xPeerWindow->hasFocus(); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return bHasControlFocus; +} + //============================================================================== //============================================================================== SearchableControlIterator::SearchableControlIterator(Reference< XInterface> xStartingPoint) diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index a272715bbd98..462774c59d3f 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -826,6 +826,48 @@ void FmXFormView::AutoFocus( sal_Bool _bSync ) else m_nAutoFocusEvent = Application::PostUserEvent(LINK(this, FmXFormView, OnAutoFocus)); } + +// ----------------------------------------------------------------------------- +bool FmXFormView::isFocusable( const Reference< XControl >& i_rControl ) +{ + if ( !i_rControl.is() ) + return false; + + try + { + Reference< XPropertySet > xModelProps( i_rControl->getModel(), UNO_QUERY_THROW ); + + // only enabled controls are allowed to participate + sal_Bool bEnabled = sal_False; + OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_ENABLED ) >>= bEnabled ); + if ( !bEnabled ) + return false; + + // check the class id of the control model + sal_Int16 nClassId = FormComponentType::CONTROL; + OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_CLASSID ) >>= nClassId ); + + // controls which are not focussable + if ( ( FormComponentType::CONTROL != nClassId ) + && ( FormComponentType::IMAGEBUTTON != nClassId ) + && ( FormComponentType::GROUPBOX != nClassId ) + && ( FormComponentType::FIXEDTEXT != nClassId ) + && ( FormComponentType::HIDDENCONTROL != nClassId ) + && ( FormComponentType::IMAGECONTROL != nClassId ) + && ( FormComponentType::SCROLLBAR != nClassId ) + && ( FormComponentType::SPINBUTTON!= nClassId ) + ) + { + return true; + } + } + catch( const Exception& e ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return false; +} + // ----------------------------------------------------------------------------- static Reference< XControl > lcl_firstFocussableControl( const Sequence< Reference< XControl > >& _rControls ) { @@ -836,47 +878,19 @@ static Reference< XControl > lcl_firstFocussableControl( const Sequence< Referen const Reference< XControl >* pControlsEnd = _rControls.getConstArray() + _rControls.getLength(); for ( ; pControls != pControlsEnd; ++pControls ) { - try - { - if ( !pControls->is() ) - continue; - - Reference< XPropertySet > xModelProps( (*pControls)->getModel(), UNO_QUERY_THROW ); - - // only enabled controls are allowed to participate - sal_Bool bEnabled = sal_False; - OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_ENABLED ) >>= bEnabled ); - if ( !bEnabled ) - continue; - - // check the class id of the control model - sal_Int16 nClassId = FormComponentType::CONTROL; - OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_CLASSID ) >>= nClassId ); - - // controls which are not focussable - if ( ( FormComponentType::CONTROL != nClassId ) - && ( FormComponentType::IMAGEBUTTON != nClassId ) - && ( FormComponentType::GROUPBOX != nClassId ) - && ( FormComponentType::FIXEDTEXT != nClassId ) - && ( FormComponentType::HIDDENCONTROL != nClassId ) - && ( FormComponentType::IMAGECONTROL != nClassId ) - && ( FormComponentType::SCROLLBAR != nClassId ) - && ( FormComponentType::SPINBUTTON!= nClassId ) - ) - { - xReturn = *pControls; - break; - } - } - catch( const Exception& e ) + if ( !pControls->is() ) + continue; + + if ( FmXFormView::isFocusable( *pControls ) ) { - (void)e; // make compiler happy + xReturn = *pControls; + break; } - - if ( !xReturn.is() && _rControls.getLength() ) - xReturn = _rControls[0]; } + if ( !xReturn.is() && _rControls.getLength() ) + xReturn = _rControls[0]; + return xReturn; } @@ -1010,11 +1024,6 @@ IMPL_LINK(FmXFormView, OnAutoFocus, void*, /*EMPTYTAG*/) return 1L; } -// ----------------------------------------------------------------------------- -namespace -{ -} - // ----------------------------------------------------------------------------- void FmXFormView::onCreatedFormObject( FmFormObj& _rFormObject ) { diff --git a/svx/source/inc/fmshimp.hxx b/svx/source/inc/fmshimp.hxx index 35a00ccf7427..b61f64ea4f88 100644 --- a/svx/source/inc/fmshimp.hxx +++ b/svx/source/inc/fmshimp.hxx @@ -508,6 +508,9 @@ public: // if the form belongs to the controller (extern) displaying a grid, the according internal form will // be displayed, _xForm else + // check if the current control of the active controler has the focus + bool HasControlFocus() const; + private: DECL_LINK(OnFoundData, FmFoundRecordInformation*); DECL_LINK(OnCanceledNotFound, FmFoundRecordInformation*); diff --git a/svx/source/inc/fmvwimp.hxx b/svx/source/inc/fmvwimp.hxx index c51c935883ed..3fbef5922a87 100644 --- a/svx/source/inc/fmvwimp.hxx +++ b/svx/source/inc/fmvwimp.hxx @@ -243,6 +243,11 @@ public: void onCreatedFormObject( FmFormObj& _rFormObject ); + static bool + isFocusable( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& i_rControl + ); + private: FmWinRecList::iterator findWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& _rxCC ); //void addWindow(const SdrPageViewWinRec*); diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index fb26d7b5fc9c..2a4e87c17e93 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -124,6 +124,7 @@ #include #include #include +#include using namespace ::com::sun::star; @@ -3332,4 +3333,11 @@ void SdrObjFactory::RemoveMakeUserDataHdl(const Link& rLink) rLL.RemoveLink(rLink); } +namespace svx +{ + ISdrObjectFilter::~ISdrObjectFilter() + { + } +} + // eof diff --git a/svx/uiconfig/accelerator/en-US/default.xml b/svx/uiconfig/accelerator/en-US/default.xml index 67a6e9127c8a..1969c9b00098 100644 --- a/svx/uiconfig/accelerator/en-US/default.xml +++ b/svx/uiconfig/accelerator/en-US/default.xml @@ -23,7 +23,7 @@ - + diff --git a/svx/uiconfig/accelerator/es/default.xml b/svx/uiconfig/accelerator/es/default.xml index 71ba6212d275..3a0c362b61bb 100644 --- a/svx/uiconfig/accelerator/es/default.xml +++ b/svx/uiconfig/accelerator/es/default.xml @@ -23,7 +23,7 @@ - + -- cgit From 08305a40f70ed36b2c096ec798d4a28b1bb18dc1 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Sun, 21 Feb 2010 20:49:23 +0100 Subject: dba33f: use dynamic_cast instead of static_cast - the OutputDevice is not necessarily a Window --- svx/source/form/fmshell.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'svx') diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx index 5219ff43ac0c..fe2f52c6780a 100644 --- a/svx/source/form/fmshell.cxx +++ b/svx/source/form/fmshell.cxx @@ -617,7 +617,7 @@ void FmFormShell::Execute(SfxRequest &rReq) if ( bHasControlFocus ) { const OutputDevice* pDevice = GetCurrentViewDevice(); - Window* pWindow = static_cast< Window* >( const_cast< OutputDevice* >( pDevice ) ); + Window* pWindow = dynamic_cast< Window* >( const_cast< OutputDevice* >( pDevice ) ); if ( pWindow ) pWindow->GrabFocus(); } -- cgit From 05e896cd790b601feb373ebfd2d69a1031145ae1 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Mon, 22 Feb 2010 13:09:07 +0100 Subject: #i107721# another rework of the thesaurus dialog --- svx/source/dialog/thesdlg.cxx | 182 ++++++++++++++++++++++++------------- svx/source/dialog/thesdlg.hrc | 3 +- svx/source/dialog/thesdlg.src | 32 +++---- svx/source/dialog/thesdlg_impl.hxx | 103 +++++++++++++-------- 4 files changed, 199 insertions(+), 121 deletions(-) (limited to 'svx') diff --git a/svx/source/dialog/thesdlg.cxx b/svx/source/dialog/thesdlg.cxx index 2c77545d2bae..8d95cb0b542e 100755 --- a/svx/source/dialog/thesdlg.cxx +++ b/svx/source/dialog/thesdlg.cxx @@ -97,39 +97,73 @@ static void GetReplaceEditString( String &rText ) rText.EraseLeadingAndTrailingChars( sal_Unicode(' ') ); } -// class LookUpComboBox -------------------------------------------------- +// class LookUpComboBox_Impl -------------------------------------------------- -LookUpComboBox::LookUpComboBox( +LookUpComboBox_Impl::LookUpComboBox_Impl( + Window *pParent, const ResId &rResId, SvxThesaurusDialog_Impl &rImpl ) : + ComboBox (pParent, rResId), + m_rDialogImpl( rImpl ) +{ + m_aModifyTimer.SetTimeoutHdl( LINK( this, LookUpComboBox_Impl, ModifyTimer_Hdl ) ); + m_aModifyTimer.SetTimeout( 500 ); + + EnableAutocomplete( FALSE ); +} + + +LookUpComboBox_Impl::~LookUpComboBox_Impl() +{ +} + + +void LookUpComboBox_Impl::Modify() +{ + m_aModifyTimer.Start(); +} + + +IMPL_LINK( LookUpComboBox_Impl, ModifyTimer_Hdl, Timer *, EMPTYARG /*pTimer*/ ) +{ + m_rDialogImpl.LookUp( GetText() ); + m_aModifyTimer.Stop(); + return 0; +} + + +// class ReplaceEdit_Impl -------------------------------------------------- + +ReplaceEdit_Impl::ReplaceEdit_Impl( Window *pParent, const ResId &rResId ) : - ComboBox (pParent, rResId) + Edit (pParent, rResId) { } -LookUpComboBox::~LookUpComboBox() +ReplaceEdit_Impl::~ReplaceEdit_Impl() { } -void LookUpComboBox::Modify() +void ReplaceEdit_Impl::Modify() { if (m_pBtn) m_pBtn->Enable( GetText().Len() > 0 ); } -void LookUpComboBox::SetText( const XubString& rStr ) +void ReplaceEdit_Impl::SetText( const XubString& rStr ) { - ComboBox::SetText( rStr ); + Edit::SetText( rStr ); Modify(); } -void LookUpComboBox::SetText( const XubString& rStr, const Selection& rNewSelection ) +void ReplaceEdit_Impl::SetText( const XubString& rStr, const Selection& rNewSelection ) { - ComboBox::SetText( rStr, rNewSelection ); + Edit::SetText( rStr ); Modify(); } + // class ThesaurusAlternativesCtrl_Impl ---------------------------------- void AlternativesString_Impl::Paint( @@ -182,7 +216,7 @@ SvLBoxEntry * ThesaurusAlternativesCtrl_Impl::AddEntry( sal_Int32 nVal, const St { SvLBoxEntry* pEntry = new SvLBoxEntry; String aText; - if (bIsHeader) + if (bIsHeader && nVal >= 0) { aText = String::CreateFromInt32( nVal ); aText += A2S( ". " ); @@ -194,7 +228,10 @@ SvLBoxEntry * ThesaurusAlternativesCtrl_Impl::AddEntry( sal_Int32 nVal, const St AlternativesUserData_Impl* pUserData = new AlternativesUserData_Impl( rText, bIsHeader ); pEntry->SetUserData( pUserData ); - GetModel()->Insert( pEntry ); + USHORT nPos = GetModel()->Insert( pEntry ); + + if (bIsHeader) + GetViewDataEntry( pEntry )->SetSelectable( false ); return pEntry; } @@ -213,6 +250,31 @@ void ThesaurusAlternativesCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) } +void ThesaurusAlternativesCtrl_Impl::Paint( const Rectangle& rRect ) +{ + if (!m_rDialogImpl.m_bWordFound) + { + Push( PUSH_FONT ); + + Font aFont(GetFont() ); + aFont.SetHeight( 2 * aFont.GetHeight() ); + SetFont( aFont ); + + Size aTextSize( GetTextWidth( m_rDialogImpl.aErrStr ), GetTextHeight() ); + aTextSize = LogicToPixel( aTextSize ); + Point aPos = GetPosPixel(); + aPos.X() += GetSizePixel().Width() / 2 - aTextSize.Width() / 2; + aPos.Y() += /*GetSizePixel().Height() / 2 - */aTextSize.Height() / 2; + aPos = PixelToLogic( aPos ); + DrawText( aPos, m_rDialogImpl.aErrStr ); + + Pop(); + } + else + SvxCheckListBox::Paint( rRect ); +} + + // struct SvxThesaurusDialog_Impl ---------------------------------------- SvxThesaurusDialog_Impl::SvxThesaurusDialog_Impl( Window* pParent ) : @@ -220,8 +282,7 @@ SvxThesaurusDialog_Impl::SvxThesaurusDialog_Impl( Window* pParent ) : aVendorImageFI ( pParent , SVX_RES( IMG_VENDOR ) ), aLeftBtn ( pParent, SVX_RES( BTN_LEFT ) ), aWordText ( pParent, SVX_RES( FT_WORD ) ), - aWordCB ( pParent, SVX_RES( CB_WORD ) ), - aLookUpBtn ( pParent, SVX_RES( BTN_LOOKUP ) ), + aWordCB ( pParent, SVX_RES( CB_WORD ), *this ), m_aAlternativesText ( pParent, SVX_RES( FT_THES_ALTERNATIVES ) ), m_pAlternativesCT ( new ThesaurusAlternativesCtrl_Impl( pParent, *this ) ), aReplaceText ( pParent, SVX_RES( FT_REPL ) ), @@ -229,24 +290,24 @@ SvxThesaurusDialog_Impl::SvxThesaurusDialog_Impl( Window* pParent ) : aFL ( pParent, SVX_RES( FL_VAR ) ), aHelpBtn ( pParent, SVX_RES( BTN_THES_HELP ) ), aLangMBtn ( pParent, SVX_RES( MB_LANGUAGE ) ), - aOkBtn ( pParent, SVX_RES( BTN_THES_OK ) ), + aReplaceBtn ( pParent, SVX_RES( BTN_THES_OK ) ), aCancelBtn ( pParent, SVX_RES( BTN_THES_CANCEL ) ), - aErrStr ( SVX_RES( STR_ERR_WORDNOTFOUND ) ), - aVendorDefaultImage ( SVX_RES( IMG_DEFAULT_VENDOR ) ), - aVendorDefaultImageHC ( SVX_RES( IMG_DEFAULT_VENDOR_HC ) ), + aErrStr ( SVX_RES( STR_ERR_TEXTNOTFOUND ) ), + aVendorDefaultImage ( SVX_RES( IMG_DEFAULT_VENDOR ) ), + aVendorDefaultImageHC ( SVX_RES( IMG_DEFAULT_VENDOR_HC ) ), xThesaurus ( NULL ), aLookUpText (), nLookUpLanguage ( LANGUAGE_NONE ), + m_bWordFound( false ), pErrContext ( NULL ) { // note: FreeResource must only be called in the c-tor of SvxThesaurusDialog - aWordCB.SetButton( &aLookUpBtn ); + aReplaceEdit.SetButton( &aReplaceBtn ); aLeftBtn.SetClickHdl( LINK( this, SvxThesaurusDialog_Impl, LeftBtnHdl_Impl ) ); aWordCB.SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, WordSelectHdl_Impl ) ); - aLangMBtn.SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, LanguageHdl_Impl ) ); - aLookUpBtn.SetClickHdl( LINK( this, SvxThesaurusDialog_Impl, LookUpHdl_Impl ) ); + aLangMBtn.SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, LanguageHdl_Impl ) ); m_pAlternativesCT->SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, AlternativesSelectHdl_Impl )); m_pAlternativesCT->SetDoubleClickHdl( LINK( this, SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl )); @@ -297,12 +358,12 @@ bool SvxThesaurusDialog_Impl::UpdateAlternativesBox_Impl() const sal_Int32 nMeanings = aMeanings.getLength(); const uno::Reference< linguistic2::XMeaning > *pMeanings = aMeanings.getConstArray(); + m_pAlternativesCT->SetUpdateMode( FALSE ); + // clear old user data of control before creating new ones via AddEntry below m_pAlternativesCT->ClearUserData(); m_pAlternativesCT->Clear(); - m_pAlternativesCT->SetUpdateMode( FALSE ); - for (sal_Int32 i = 0; i < nMeanings; ++i) { OUString rMeaningTxt = pMeanings[i]->getMeaning(); @@ -319,10 +380,7 @@ bool SvxThesaurusDialog_Impl::UpdateAlternativesBox_Impl() m_pAlternativesCT->SetUpdateMode( TRUE ); - const bool bWordFound = nMeanings > 0; - if (!bWordFound) - InfoBox( m_pParent, aErrStr ).Execute(); - return bWordFound; + return nMeanings > 0; } @@ -338,6 +396,14 @@ void SvxThesaurusDialog_Impl::SetWindowTitle( LanguageType nLanguage ) } +void SvxThesaurusDialog_Impl::LookUp( const String &rText ) +{ + if (rText != aWordCB.GetText()) // avoid moving of the cursor if the text is the same + aWordCB.SetText( rText ); + LookUp_Impl(); +} + + IMPL_LINK( SvxThesaurusDialog_Impl, LeftBtnHdl_Impl, Button *, pBtn ) { if (pBtn && aLookUpHistory.size() >= 2) @@ -345,13 +411,13 @@ IMPL_LINK( SvxThesaurusDialog_Impl, LeftBtnHdl_Impl, Button *, pBtn ) aLookUpHistory.pop(); // remove current look up word from stack aWordCB.SetText( aLookUpHistory.top() ); // retrieve previous look up word aLookUpHistory.pop(); - LookUpHdl_Impl( NULL ); + LookUp_Impl(); } return 0; } - -IMPL_LINK( SvxThesaurusDialog_Impl, LanguageHdl_Impl, MenuButton *, pBtn ) + +IMPL_LINK( SvxThesaurusDialog_Impl, LanguageHdl_Impl, MenuButton *, pBtn ) { PopupMenu *pMenu = aLangMBtn.GetPopupMenu(); if (pMenu && pBtn) @@ -359,18 +425,18 @@ IMPL_LINK( SvxThesaurusDialog_Impl, LanguageHdl_Impl, MenuButton *, pBtn ) USHORT nItem = pBtn->GetCurItemId(); String aLangText( pMenu->GetItemText( nItem ) ); LanguageType nLang = SvtLanguageTable().GetType( aLangText ); - DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" ); - if (xThesaurus->hasLocale( SvxCreateLocale( nLang ) )) - nLookUpLanguage = nLang; - SetWindowTitle( nLang ); + DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" ); + if (xThesaurus->hasLocale( SvxCreateLocale( nLang ) )) + nLookUpLanguage = nLang; + SetWindowTitle( nLang ); UpdateVendorImage(); - LookUpHdl_Impl( NULL ); + LookUp_Impl(); } return 0; } -IMPL_LINK( SvxThesaurusDialog_Impl, LookUpHdl_Impl, Button *, EMPTYARG /*pBtn*/ ) +void SvxThesaurusDialog_Impl::LookUp_Impl() { String aText( aWordCB.GetText() ); @@ -379,19 +445,14 @@ IMPL_LINK( SvxThesaurusDialog_Impl, LookUpHdl_Impl, Button *, EMPTYARG /*pBtn*/ (aLookUpHistory.size() == 0 || aLookUpText != aLookUpHistory.top())) aLookUpHistory.push( aLookUpText ); - UpdateAlternativesBox_Impl(); + m_bWordFound = UpdateAlternativesBox_Impl(); + m_pAlternativesCT->Enable( m_bWordFound ); if ( aWordCB.GetEntryPos( aText ) == LISTBOX_ENTRY_NOTFOUND ) aWordCB.InsertEntry( aText ); - aWordCB.SelectEntryPos( aWordCB.GetEntryPos( aText ) ); aReplaceEdit.SetText( String() ); - aOkBtn.Enable( FALSE ); - m_pAlternativesCT->GrabFocus(); - aLeftBtn.Enable( aLookUpHistory.size() > 1 ); - - return 0; } @@ -403,9 +464,7 @@ IMPL_LINK( SvxThesaurusDialog_Impl, WordSelectHdl_Impl, ComboBox *, pBox ) String aStr( pBox->GetEntry( nPos ) ); GetReplaceEditString( aStr ); aWordCB.SetText( aStr ); - aOkBtn.Enable( aStr.Len() > 0 ); - - LookUpHdl_Impl( NULL ); + LookUp_Impl(); } return 0; @@ -425,7 +484,6 @@ IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesSelectHdl_Impl, SvxCheckListBox GetReplaceEditString( aStr ); } aReplaceEdit.SetText( aStr ); - aOkBtn.Enable( aStr.Len() > 0 ); } return 0; } @@ -443,11 +501,10 @@ IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl, SvxCheckLis aStr = pData->GetText(); GetReplaceEditString( aStr ); } - aWordCB.SetText( aStr ); - aOkBtn.Enable( aStr.Len() > 0 ); + aWordCB.SetText( aStr ); if (aStr.Len() > 0) - LookUpHdl_Impl( NULL ); + LookUp_Impl(); } //! workaround to set the selection since calling SelectEntryPos within @@ -457,11 +514,11 @@ IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl, SvxCheckLis } -IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, SelectFirstHdl_Impl, SvxCheckListBox *, pBox ) -{ - if (pBox && pBox->GetEntryCount() > 0) - pBox->SelectEntryPos( 0 ); - return 0; +IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, SelectFirstHdl_Impl, SvxCheckListBox *, pBox ) +{ + if (pBox && pBox->GetEntryCount() > 0) + pBox->SelectEntryPos( 0 ); + return 0; } //////////////////////////////////////////////////////////// @@ -628,7 +685,6 @@ IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, VendorImageInitHdl, SvxThesaurusDialo &pThis->aLeftBtn, &pThis->aWordText, &pThis->aWordCB, - &pThis->aLookUpBtn, &pThis->m_aAlternativesText, pThis->m_pAlternativesCT.get(), &pThis->aReplaceText, @@ -636,7 +692,7 @@ IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, VendorImageInitHdl, SvxThesaurusDialo &pThis->aFL, &pThis->aHelpBtn, &pThis->aLangMBtn, - &pThis->aOkBtn, + &pThis->aReplaceBtn, &pThis->aCancelBtn, 0 }; @@ -689,10 +745,10 @@ SvxThesaurusDialog::SvxThesaurusDialog( String aTmp2( aTmp ); m_pImpl->aReplaceEdit.SetText( aTmp2 ); m_pImpl->aWordCB.InsertEntry( aTmp2 ); - m_pImpl->aWordCB.SelectEntryPos( m_pImpl->aWordCB.GetEntryPos( aTmp2 ) ); m_pImpl->SetWindowTitle( nLanguage ); - m_pImpl->UpdateAlternativesBox_Impl(); + + m_pImpl->LookUp( aTmp2 ); m_pImpl->m_pAlternativesCT->GrabFocus(); m_pImpl->aLeftBtn.Enable( sal_False ); @@ -728,11 +784,11 @@ SvxThesaurusDialog::~SvxThesaurusDialog() { } - -String SvxThesaurusDialog::GetWord() -{ - return m_pImpl->aReplaceEdit.GetText(); -} + +String SvxThesaurusDialog::GetWord() +{ + return m_pImpl->aReplaceEdit.GetText(); +} sal_uInt16 SvxThesaurusDialog::GetLanguage() const diff --git a/svx/source/dialog/thesdlg.hrc b/svx/source/dialog/thesdlg.hrc index 2d776ca92d4f..18ceadad4831 100755 --- a/svx/source/dialog/thesdlg.hrc +++ b/svx/source/dialog/thesdlg.hrc @@ -37,7 +37,6 @@ #define BTN_THES_CANCEL 11 #define MB_LANGUAGE 12 #define BTN_THES_HELP 13 -#define BTN_LOOKUP 14 #define FT_WORD 15 #define CB_WORD 16 #define FT_REPL 21 @@ -49,7 +48,7 @@ #define IMG_DEFAULT_VENDOR 27 #define IMG_DEFAULT_VENDOR_HC 28 -#define STR_ERR_WORDNOTFOUND 101 +#define STR_ERR_TEXTNOTFOUND 101 #endif diff --git a/svx/source/dialog/thesdlg.src b/svx/source/dialog/thesdlg.src index 501b54964946..eec56a0c46c3 100755 --- a/svx/source/dialog/thesdlg.src +++ b/svx/source/dialog/thesdlg.src @@ -39,7 +39,7 @@ ModalDialog RID_SVXDLG_THESAURUS { HelpId = SID_THESAURUS ; OutputSize = TRUE ; - Size = MAP_APPFONT ( 265, 230 ) ; + Size = MAP_APPFONT ( 235, 230 ) ; Text [ en-US ] = "Thesaurus" ; SvLook = TRUE ; Moveable = TRUE ; @@ -47,7 +47,7 @@ ModalDialog RID_SVXDLG_THESAURUS FixedImage IMG_VENDOR { Pos = MAP_APPFONT ( 0, 0 ) ; - Size = MAP_APPFONT ( 265, 0 ) ; // correct size will be applied at runtime + Size = MAP_APPFONT ( 235, 0 ) ; // correct size will be applied at runtime Hide = TRUE; }; @@ -69,13 +69,13 @@ ModalDialog RID_SVXDLG_THESAURUS { DropDown = TRUE ; Pos = MAP_APPFONT ( 24 , 16 ) ; - Size = MAP_APPFONT ( 171 , 60 ) ; // have drop down space for several lines + Size = MAP_APPFONT ( 141 , 60 ) ; // have drop down space for several lines }; - PushButton BTN_LOOKUP + MenuButton MB_LANGUAGE { - Pos = MAP_APPFONT ( 200 , 16 ) ; + Pos = MAP_APPFONT ( 170 , 16 ) ; Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "Look ~Up" ; + Text [ en-US ] = "~Language" ; }; FixedText FT_THES_ALTERNATIVES @@ -89,7 +89,7 @@ ModalDialog RID_SVXDLG_THESAURUS { HelpID = HID_CT_THES_ALTERNATIVES ; Pos = MAP_APPFONT ( 5 , 45 ) ; - Size = MAP_APPFONT ( 255 , 121 ) ; + Size = MAP_APPFONT ( 225 , 121 ) ; Border = TRUE; TabStop = TRUE ; }; @@ -105,13 +105,13 @@ ModalDialog RID_SVXDLG_THESAURUS { BORDER = TRUE ; Pos = MAP_APPFONT ( 5 , 184 ) ; - Size = MAP_APPFONT ( 255 , 12 ) ; + Size = MAP_APPFONT ( 225 , 12 ) ; LEFT = TRUE ; }; FixedLine FL_VAR { Pos = MAP_APPFONT ( 0 , 200 ) ; - Size = MAP_APPFONT ( 265 , 8 ) ; + Size = MAP_APPFONT ( 235 , 8 ) ; }; HelpButton BTN_THES_HELP @@ -119,28 +119,22 @@ ModalDialog RID_SVXDLG_THESAURUS Pos = MAP_APPFONT ( 5 , 210 ) ; Size = MAP_APPFONT ( 60 , 14 ) ; }; - MenuButton MB_LANGUAGE - { - Pos = MAP_APPFONT ( 70 , 210 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Language" ; - }; OkButton BTN_THES_OK { - Pos = MAP_APPFONT ( 135 , 210 ) ; + Pos = MAP_APPFONT ( 105 , 210 ) ; Size = MAP_APPFONT ( 60 , 14 ) ; Text [ en-US ] = "~Replace" ; DefButton = TRUE ; }; CancelButton BTN_THES_CANCEL { - Pos = MAP_APPFONT ( 200 , 210 ) ; + Pos = MAP_APPFONT ( 170 , 210 ) ; Size = MAP_APPFONT ( 60 , 14 ) ; }; - String STR_ERR_WORDNOTFOUND + String STR_ERR_TEXTNOTFOUND { - Text [ en-US ] = "Word not found in thesaurus" ; + Text [ en-US ] = "Text not found" ; }; Image IMG_DEFAULT_VENDOR diff --git a/svx/source/dialog/thesdlg_impl.hxx b/svx/source/dialog/thesdlg_impl.hxx index 848d86fca54b..354bc95c09db 100755 --- a/svx/source/dialog/thesdlg_impl.hxx +++ b/svx/source/dialog/thesdlg_impl.hxx @@ -34,15 +34,16 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include -#include +#include #include #include #include +#include #include #include @@ -54,24 +55,49 @@ using namespace ::com::sun::star; using ::rtl::OUString; -// class LookUpComboBox -------------------------------------------------- +// class LookUpComboBox_Impl -------------------------------------------------- -class LookUpComboBox : public ComboBox +class LookUpComboBox_Impl : public ComboBox { - Button * m_pBtn; + Timer m_aModifyTimer; + Selection m_aSelection; + Button * m_pBtn; + SvxThesaurusDialog_Impl & m_rDialogImpl; // disable copy c-tor and assignment operator - LookUpComboBox( const LookUpComboBox & ); - LookUpComboBox & operator = ( const LookUpComboBox & ); + LookUpComboBox_Impl( const LookUpComboBox_Impl & ); + LookUpComboBox_Impl & operator = ( const LookUpComboBox_Impl & ); public: - LookUpComboBox( Window *pParent, const ResId &rResId ); - virtual ~LookUpComboBox(); + LookUpComboBox_Impl( Window *pParent, const ResId &rResId, SvxThesaurusDialog_Impl &rImpl ); + virtual ~LookUpComboBox_Impl(); + + DECL_LINK( ModifyTimer_Hdl, Timer * ); void SetButton( Button *pBtn ) { m_pBtn = pBtn; } // ComboBox virtual void Modify(); +}; + +// class ReplaceEdit_Impl -------------------------------------------------- + +class ReplaceEdit_Impl : public Edit +{ + Button * m_pBtn; + + // disable copy c-tor and assignment operator + ReplaceEdit_Impl( const ReplaceEdit_Impl & ); + ReplaceEdit_Impl & operator = ( const ReplaceEdit_Impl & ); + +public: + ReplaceEdit_Impl( Window *pParent, const ResId &rResId ); + virtual ~ReplaceEdit_Impl(); + + void SetButton( Button *pBtn ) { m_pBtn = pBtn; } + + // Edit + virtual void Modify(); virtual void SetText( const XubString& rStr ); virtual void SetText( const XubString& rStr, const Selection& rNewSelection ); }; @@ -127,7 +153,8 @@ public: SvLBoxEntry * AddEntry( sal_Int32 nVal, const String &rText, bool bIsHeader ); void ClearUserData(); - virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void Paint( const Rectangle& rRect ); }; @@ -135,34 +162,34 @@ public: struct SvxThesaurusDialog_Impl { - Window* m_pParent; - - FixedImage aVendorImageFI; - ImageButton aLeftBtn; - FixedText aWordText; - LookUpComboBox aWordCB; - PushButton aLookUpBtn; - FixedText m_aAlternativesText; - boost::shared_ptr< ThesaurusAlternativesCtrl_Impl > m_pAlternativesCT; - FixedText aReplaceText; - Edit aReplaceEdit; - FixedLine aFL; - HelpButton aHelpBtn; - MenuButton aLangMBtn; - OKButton aOkBtn; - CancelButton aCancelBtn; - - String aErrStr; + Window * m_pParent; + + FixedImage aVendorImageFI; + ImageButton aLeftBtn; + FixedText aWordText; + LookUpComboBox_Impl aWordCB; + FixedText m_aAlternativesText; + boost::shared_ptr< ThesaurusAlternativesCtrl_Impl > m_pAlternativesCT; + FixedText aReplaceText; + ReplaceEdit_Impl aReplaceEdit; + FixedLine aFL; + HelpButton aHelpBtn; + MenuButton aLangMBtn; + OKButton aReplaceBtn; + CancelButton aCancelBtn; + + String aErrStr; Image aVendorDefaultImage; Image aVendorDefaultImageHC; - + uno::Reference< linguistic2::XThesaurus > xThesaurus; - OUString aLookUpText; - LanguageType nLookUpLanguage; + OUString aLookUpText; + LanguageType nLookUpLanguage; std::stack< OUString > aLookUpHistory; + bool m_bWordFound; SfxErrorContext* pErrContext; // error context while dfalog is opened - + // Handler DECL_LINK( LeftBtnHdl_Impl, Button * ); @@ -176,8 +203,8 @@ struct SvxThesaurusDialog_Impl DECL_STATIC_LINK( SvxThesaurusDialog_Impl, VendorImageInitHdl, SvxThesaurusDialog_Impl * ); - SvxThesaurusDialog_Impl( Window* pParent ); - ~SvxThesaurusDialog_Impl(); + SvxThesaurusDialog_Impl( Window* pParent ); + ~SvxThesaurusDialog_Impl(); uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL queryMeanings_Impl( ::rtl::OUString& rTerm, const lang::Locale& rLocale, const beans::PropertyValues& rProperties ) throw(lang::IllegalArgumentException, uno::RuntimeException); @@ -185,6 +212,8 @@ struct SvxThesaurusDialog_Impl bool UpdateAlternativesBox_Impl(); void UpdateVendorImage(); void SetWindowTitle( LanguageType nLanguage ); + void LookUp( const String &rText ); + void LookUp_Impl(); }; #endif -- cgit From c5a9cb727bc21a36442f77aedc6ce007de82dd97 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Mon, 22 Feb 2010 13:55:03 +0100 Subject: #i107721# minor change for thesaurus dialog --- svx/source/dialog/thesdlg.cxx | 14 +++++++------- svx/source/dialog/thesdlg.src | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'svx') diff --git a/svx/source/dialog/thesdlg.cxx b/svx/source/dialog/thesdlg.cxx index 8d95cb0b542e..87272d3ae89b 100755 --- a/svx/source/dialog/thesdlg.cxx +++ b/svx/source/dialog/thesdlg.cxx @@ -254,21 +254,21 @@ void ThesaurusAlternativesCtrl_Impl::Paint( const Rectangle& rRect ) { if (!m_rDialogImpl.m_bWordFound) { - Push( PUSH_FONT ); +/* Push( PUSH_FONT ); - Font aFont(GetFont() ); + Font aFont( GetFont() ); aFont.SetHeight( 2 * aFont.GetHeight() ); SetFont( aFont ); - +*/ Size aTextSize( GetTextWidth( m_rDialogImpl.aErrStr ), GetTextHeight() ); aTextSize = LogicToPixel( aTextSize ); - Point aPos = GetPosPixel(); - aPos.X() += GetSizePixel().Width() / 2 - aTextSize.Width() / 2; - aPos.Y() += /*GetSizePixel().Height() / 2 - */aTextSize.Height() / 2; + Point aPos; + aPos.X() += GetSizePixel().Width() / 2 - aTextSize.Width() / 2; + aPos.Y() += GetSizePixel().Height() / 2 /*- aTextSize.Height() / 2*/; aPos = PixelToLogic( aPos ); DrawText( aPos, m_rDialogImpl.aErrStr ); - Pop(); +// Pop(); } else SvxCheckListBox::Paint( rRect ); diff --git a/svx/source/dialog/thesdlg.src b/svx/source/dialog/thesdlg.src index eec56a0c46c3..7cad0bc196de 100755 --- a/svx/source/dialog/thesdlg.src +++ b/svx/source/dialog/thesdlg.src @@ -134,7 +134,7 @@ ModalDialog RID_SVXDLG_THESAURUS String STR_ERR_TEXTNOTFOUND { - Text [ en-US ] = "Text not found" ; + Text [ en-US ] = "No alternatives found." ; }; Image IMG_DEFAULT_VENDOR -- cgit From 97d964702b7d8a9814a52b974505603ffba2e6c6 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Mon, 22 Feb 2010 15:23:01 +0100 Subject: cws tl74: warning free code --- svx/source/dialog/thesdlg.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'svx') diff --git a/svx/source/dialog/thesdlg.cxx b/svx/source/dialog/thesdlg.cxx index 87272d3ae89b..c99dfc506195 100755 --- a/svx/source/dialog/thesdlg.cxx +++ b/svx/source/dialog/thesdlg.cxx @@ -159,7 +159,7 @@ void ReplaceEdit_Impl::SetText( const XubString& rStr ) void ReplaceEdit_Impl::SetText( const XubString& rStr, const Selection& rNewSelection ) { - Edit::SetText( rStr ); + Edit::SetText( rStr, rNewSelection ); Modify(); } @@ -228,7 +228,7 @@ SvLBoxEntry * ThesaurusAlternativesCtrl_Impl::AddEntry( sal_Int32 nVal, const St AlternativesUserData_Impl* pUserData = new AlternativesUserData_Impl( rText, bIsHeader ); pEntry->SetUserData( pUserData ); - USHORT nPos = GetModel()->Insert( pEntry ); + GetModel()->Insert( pEntry ); if (bIsHeader) GetViewDataEntry( pEntry )->SetSelectable( false ); @@ -516,6 +516,7 @@ IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl, SvxCheckLis IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, SelectFirstHdl_Impl, SvxCheckListBox *, pBox ) { + (void) pThis; if (pBox && pBox->GetEntryCount() > 0) pBox->SelectEntryPos( 0 ); return 0; -- cgit From 24be43ab5287828705356e22421cc7fc47fa30a4 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Tue, 23 Feb 2010 00:23:09 +0100 Subject: presentation placeholder rework --- svx/inc/svx/svdobj.hxx | 8 +++++++ svx/inc/svx/svdograf.hxx | 2 +- svx/inc/svx/svdomedia.hxx | 2 ++ svx/inc/svx/svdotable.hxx | 1 + svx/source/svdraw/svdobj.cxx | 5 +++++ svx/source/svdraw/svdograf.cxx | 2 +- svx/source/svdraw/svdomedia.cxx | 49 +++++++++++++++++++++++++++++++++++++++++ svx/source/svdraw/svdview.cxx | 4 ++++ svx/source/table/svdotable.cxx | 10 +++++++++ svx/source/unodraw/unopage.cxx | 8 ++++++- 10 files changed, 88 insertions(+), 3 deletions(-) (limited to 'svx') diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx index cc21e645e4d2..23829d1d0011 100644 --- a/svx/inc/svx/svdobj.hxx +++ b/svx/inc/svx/svdobj.hxx @@ -811,6 +811,14 @@ public: virtual void SetLogicRect(const Rectangle& rRect); virtual void NbcSetLogicRect(const Rectangle& rRect); + /** the defaul is to set the logic rect to the given rectangle rMaxRect. If the shape + has an intrinsic aspect ratio it may set the logic rect so the aspect + ratio is kept but still inside the rectangle rMaxRect. + + If bShrinkOnly is set to true, the size of the current logic rect will not + be changed if it is smaller than the given rectangle rMaxRect. */ + virtual void AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false ); + // Drehwinkel und Shear virtual long GetRotateAngle() const; virtual long GetShearAngle(FASTBOOL bVertical=FALSE) const; diff --git a/svx/inc/svx/svdograf.hxx b/svx/inc/svx/svdograf.hxx index 238f6953af7a..a5c7086161cb 100644 --- a/svx/inc/svx/svdograf.hxx +++ b/svx/inc/svx/svdograf.hxx @@ -211,7 +211,7 @@ public: virtual SdrObject* DoConvertToPolyObj(BOOL bBezier) const; - void AdjustToMaxRect( const Rectangle& rMaxRect, BOOL bShrinkOnly ); + virtual void AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false ); virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); diff --git a/svx/inc/svx/svdomedia.hxx b/svx/inc/svx/svdomedia.hxx index 4b612dcf7e9e..7ca78dc307cc 100644 --- a/svx/inc/svx/svdomedia.hxx +++ b/svx/inc/svx/svdomedia.hxx @@ -66,6 +66,8 @@ public: virtual void operator=(const SdrObject& rObj); + virtual void AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false ); + public: void setURL( const ::rtl::OUString& rURL ); diff --git a/svx/inc/svx/svdotable.hxx b/svx/inc/svx/svdotable.hxx index a524ce757898..e7e05d948da4 100644 --- a/svx/inc/svx/svdotable.hxx +++ b/svx/inc/svx/svdotable.hxx @@ -237,6 +237,7 @@ public: virtual const Rectangle& GetLogicRect() const; virtual void NbcSetLogicRect(const Rectangle& rRect); + virtual void AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false ); virtual sal_uInt32 GetSnapPointCount() const; virtual Point GetSnapPoint(sal_uInt32 i) const; diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index fb26d7b5fc9c..8ce207c471fe 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -1733,6 +1733,11 @@ void SdrObject::NbcSetLogicRect(const Rectangle& rRect) NbcSetSnapRect(rRect); } +void SdrObject::AdjustToMaxRect( const Rectangle& rMaxRect, bool /* bShrinkOnly = false */ ) +{ + SetLogicRect( rMaxRect ); +} + void SdrObject::SetSnapRect(const Rectangle& rRect) { Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect(); diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index d9cdfbb44f37..6b4c5dd7e3ad 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -1029,7 +1029,7 @@ void SdrGrafObj::ImpSetGrafInfoToAttr() // ----------------------------------------------------------------------------- -void SdrGrafObj::AdjustToMaxRect( const Rectangle& rMaxRect, BOOL bShrinkOnly ) +void SdrGrafObj::AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly ) { Size aSize; Size aMaxSize( rMaxRect.GetSize() ); diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx index 688ccca735c8..12157ed10d34 100644 --- a/svx/source/svdraw/svdomedia.cxx +++ b/svx/source/svdraw/svdomedia.cxx @@ -31,6 +31,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" +#include + #include #include "svdglob.hxx" #include "svdstr.hrc" @@ -150,6 +152,53 @@ void SdrMediaObj::operator=(const SdrObject& rObj) // ------------------------------------------------------------------------------ +void SdrMediaObj::AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly /* = false */ ) +{ + Size aSize( Application::GetDefaultDevice()->PixelToLogic( getPreferredSize(), MAP_100TH_MM ) ); + Size aMaxSize( rMaxRect.GetSize() ); + + if( aSize.Height() != 0 && aSize.Width() != 0 ) + { + Point aPos( rMaxRect.TopLeft() ); + + // Falls Grafik zu gross, wird die Grafik + // in die Seite eingepasst + if ( (!bShrinkOnly || + ( aSize.Height() > aMaxSize.Height() ) || + ( aSize.Width() > aMaxSize.Width() ) )&& + aSize.Height() && aMaxSize.Height() ) + { + float fGrfWH = (float)aSize.Width() / + (float)aSize.Height(); + float fWinWH = (float)aMaxSize.Width() / + (float)aMaxSize.Height(); + + // Grafik an Pagesize anpassen (skaliert) + if ( fGrfWH < fWinWH ) + { + aSize.Width() = (long)(aMaxSize.Height() * fGrfWH); + aSize.Height()= aMaxSize.Height(); + } + else if ( fGrfWH > 0.F ) + { + aSize.Width() = aMaxSize.Width(); + aSize.Height()= (long)(aMaxSize.Width() / fGrfWH); + } + + aPos = rMaxRect.Center(); + } + + if( bShrinkOnly ) + aPos = aRect.TopLeft(); + + aPos.X() -= aSize.Width() / 2; + aPos.Y() -= aSize.Height() / 2; + SetLogicRect( Rectangle( aPos, aSize ) ); + } +} + +// ------------------------------------------------------------------------------ + void SdrMediaObj::setURL( const ::rtl::OUString& rURL ) { ::avmedia::MediaItem aURLItem; diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx index edda4b700e29..d92e13333ffb 100644 --- a/svx/source/svdraw/svdview.cxx +++ b/svx/source/svdraw/svdview.cxx @@ -1361,6 +1361,10 @@ SdrViewContext SdrView::GetContext() const for( ULONG nMarkNum = 0; nMarkNum < nMarkAnz && ( bGraf || bMedia ); nMarkNum++ ) { const SdrObject* pMarkObj = GetMarkedObjectByIndex( nMarkNum ); + DBG_ASSERT( pMarkObj, "SdrView::GetContext(), null pointer in mark list!" ); + + if( !pMarkObj ) + continue; if( !pMarkObj->ISA( SdrGrafObj ) ) bGraf = FALSE; diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index 0a537f4f8999..658c5a85c613 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -2181,6 +2181,16 @@ void SdrTableObj::NbcSetLogicRect(const Rectangle& rRect) SetRectsDirty(); } + +// -------------------------------------------------------------------- + +void SdrTableObj::AdjustToMaxRect( const Rectangle& rMaxRect, bool /* bShrinkOnly = false */ ) +{ + Rectangle aRect( rMaxRect ); + aRect.setHeight( GetLogicRect().getHeight() ); + SetLogicRect( aRect ); +} + // -------------------------------------------------------------------- void SdrTableObj::NbcMove(const Size& rSiz) diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx index 3c47dadf7b0c..e108d8313455 100644 --- a/svx/source/unodraw/unopage.cxx +++ b/svx/source/unodraw/unopage.cxx @@ -656,11 +656,17 @@ void SvxDrawPage::GetTypeAndInventor( sal_uInt16& rType, sal_uInt32& rInventor, if( nTempType == UHASHMAP_NOTFOUND ) { - if( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TableShape")) ) + if( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TableShape")) || + aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TableShape")) ) { rInventor = SdrInventor; rType = OBJ_TABLE; } + else if( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.MediaShape" )) ) + { + rInventor = SdrInventor; + rType = OBJ_MEDIA; + } } else if(nTempType & E3D_INVENTOR_FLAG) { -- cgit From 7b751ca65de375664ca928bcd8138d25d8a0bb2b Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Wed, 24 Feb 2010 13:01:59 +0100 Subject: unix build fixes --- svx/source/table/svdotable.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'svx') diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index 658c5a85c613..6ff02d3874ce 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -2186,9 +2186,9 @@ void SdrTableObj::NbcSetLogicRect(const Rectangle& rRect) void SdrTableObj::AdjustToMaxRect( const Rectangle& rMaxRect, bool /* bShrinkOnly = false */ ) { - Rectangle aRect( rMaxRect ); - aRect.setHeight( GetLogicRect().getHeight() ); - SetLogicRect( aRect ); + Rectangle aAdjustRect( rMaxRect ); + aAdjustRect.setHeight( GetLogicRect().getHeight() ); + SetLogicRect( aAdjustRect ); } // -------------------------------------------------------------------- -- cgit From 29a2e8a4fc4093a1dbbacc79783a7f5cd173ae6f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 25 Feb 2010 14:10:32 +0100 Subject: #i108606# fix issue found by GCC 4 warning - thanks to cmc@openoffice.org --- svx/source/fmcomp/fmgridcl.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'svx') diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx index b12cd41a9872..5395f62ac8f6 100644 --- a/svx/source/fmcomp/fmgridcl.cxx +++ b/svx/source/fmcomp/fmgridcl.cxx @@ -2045,7 +2045,7 @@ void FmGridControl::Select() // die HandleColumn wird nicht selektiert switch (nSelectedColumn) { - case -1 : break; // no selection + case SAL_MAX_UINT16: break; // no selection case 0 : nSelectedColumn = SAL_MAX_UINT16; break; // handle col can't be seledted default : -- cgit From 3138e431cb23a6ba95d16713ce30a54451566665 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Thu, 25 Feb 2010 18:04:05 +0100 Subject: more fixes for new presentation layout shapes --- svx/source/form/fmview.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'svx') diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx index b4e4b46561e0..abb53a836578 100644 --- a/svx/source/form/fmview.cxx +++ b/svx/source/form/fmview.cxx @@ -342,7 +342,7 @@ void FmFormView::GrabFirstControlFocus( sal_Bool _bForceSync ) //------------------------------------------------------------------------ SdrPageView* FmFormView::ShowSdrPage(SdrPage* pPage) { - OSL_TRACE( "--- FmFormView::ShowSdrPage : ........, %p, %p", this, pPage ); +// OSL_TRACE( "--- FmFormView::ShowSdrPage : ........, %p, %p", this, pPage ); SdrPageView* pPV = E3dView::ShowSdrPage(pPage); @@ -380,7 +380,7 @@ SdrPageView* FmFormView::ShowSdrPage(SdrPage* pPage) //------------------------------------------------------------------------ void FmFormView::HideSdrPage() { - OSL_TRACE( "--- FmFormView::HideSdrPage : ........, %p, %p", this, GetCurPage() ); +// OSL_TRACE( "--- FmFormView::HideSdrPage : ........, %p, %p", this, GetCurPage() ); // --- 1. deactivate controls if ( !IsDesignMode() ) -- cgit From 33ef17ed7207b82d8e6fe1fa4ddaec676092d0f1 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Tue, 2 Mar 2010 19:50:13 +0100 Subject: added Visible property for shapes --- svx/inc/svdstr.hrc | 2 +- svx/inc/svx/svddef.hxx | 3 +- svx/inc/svx/svdobj.hxx | 11 +++--- svx/inc/svx/sxopitm.hxx | 6 ++++ svx/inc/svx/unoshprp.hxx | 1 + .../sdr/contact/viewobjectcontactofsdrobj.cxx | 13 ++++++-- .../sdr/contact/viewobjectcontactofunocontrol.cxx | 11 +++--- svx/source/svdraw/sdrhittesthelper.cxx | 2 +- svx/source/svdraw/svdattr.cxx | 2 ++ svx/source/svdraw/svdedtv1.cxx | 4 +++ svx/source/svdraw/svdmrkv.cxx | 6 +++- svx/source/svdraw/svdobj.cxx | 39 +++++++++++++++++++--- svx/source/svdraw/svdoedge.cxx | 2 +- svx/source/svdraw/svdpagv.cxx | 6 ++++ svx/source/svdraw/svdstr.src | 5 +++ svx/source/unodraw/unoshape.cxx | 18 ++++++++-- 16 files changed, 107 insertions(+), 24 deletions(-) (limited to 'svx') diff --git a/svx/inc/svdstr.hrc b/svx/inc/svdstr.hrc index f1c19b4e0895..f1bc8cfdae19 100644 --- a/svx/inc/svdstr.hrc +++ b/svx/inc/svdstr.hrc @@ -674,7 +674,7 @@ #define SIP_SA_CIRCRESERVE1 (SIP_Begin + 177) #define SIP_SA_CIRCRESERVE2 (SIP_Begin + 178) #define SIP_SA_CIRCRESERVE3 (SIP_Begin + 179) -//BFS01#define SIP_SDRATTRSET_CIRC (SIP_Begin + 180) +#define SIP_SA_OBJVISIBLE (SIP_Begin + 180) #define SIP_SA_OBJMOVEPROTECT (SIP_Begin + 181) #define SIP_SA_OBJSIZEPROTECT (SIP_Begin + 182) #define SIP_SA_OBJPRINTABLE (SIP_Begin + 183) diff --git a/svx/inc/svx/svddef.hxx b/svx/inc/svx/svddef.hxx index a758e9c1dba7..a9e5d175680c 100644 --- a/svx/inc/svx/svddef.hxx +++ b/svx/inc/svx/svddef.hxx @@ -203,7 +203,8 @@ #define SDRATTR_TRANSFORMREF2X (SDRATTR_NOTPERSIST_FIRST+32) /* 1212 long, def=0 */ #define SDRATTR_TRANSFORMREF2Y (SDRATTR_NOTPERSIST_FIRST+33) /* 1213 long, def=0 */ #define SDRATTR_TEXTDIRECTION (SDRATTR_NOTPERSIST_FIRST+34) /* 1214 V4+++ long, def=0 */ -#define SDRATTR_NOTPERSIST_LAST (SDRATTR_TEXTDIRECTION) /* 1228 V4+++*/ /* 1213*/ /* 1085 */ /* 1040 */ /* 1123 */ /* Pool V1: 1065 */ +#define SDRATTR_OBJVISIBLE (SDRATTR_NOTPERSIST_FIRST+35) +#define SDRATTR_NOTPERSIST_LAST (SDRATTR_OBJVISIBLE) /* 1228 V4+++*/ /* 1213*/ /* 1085 */ /* 1040 */ /* 1123 */ /* Pool V1: 1065 */ // kein SetItem hierfuer #define SDRATTR_GRAF_FIRST (SDRATTR_NOTPERSIST_LAST+1) /* 1229 V4+++*/ diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx index 7d2f5b483e5b..c6e6579967b6 100644 --- a/svx/inc/svx/svdobj.hxx +++ b/svx/inc/svx/svdobj.hxx @@ -283,6 +283,7 @@ public: BOOL bSizProt; BOOL bNoPrint; BOOL bClosedObj; + bool mbVisible; SdrLayerID mnLayerID; public: @@ -467,10 +468,10 @@ protected: unsigned bGrouped : 1; // Member eines GroupObjektes? // Die folgende Flags werden gestreamt - unsigned bMovProt : 1; // Position geschuetzt - unsigned bSizProt : 1; // Groesse geschuetzt - unsigned bNoPrint : 1; // Nicht drucken - + unsigned bMovProt : 1; // If true, the position is protected + unsigned bSizProt : 1; // If true, the size is protected + unsigned bNoPrint : 1; // If true, the object is not printed. + unsigned mbVisible : 1; // If false, the object is not visible on screen (but maybe on printer, depending on bNoprint // Wenn bEmptyPresObj TRUE ist, handelt es sich um ein // Praesentationsobjekt, dem noch kein Inhalt zugewiesen // wurde. Default ist das Flag auf FALSE. Die Verwaltung @@ -1010,6 +1011,8 @@ public: sal_Bool IsResizeProtect() const { return bSizProt; } void SetPrintable(sal_Bool bPrn); sal_Bool IsPrintable() const { return !bNoPrint; } + void SetVisible(sal_Bool bVisible); + sal_Bool IsVisible() const { return mbVisible; } void SetEmptyPresObj(sal_Bool bEpt) { bEmptyPresObj=bEpt; } sal_Bool IsEmptyPresObj() const { return bEmptyPresObj; } void SetNotVisibleAsMaster(sal_Bool bFlg) { bNotVisibleAsMaster=bFlg; } diff --git a/svx/inc/svx/sxopitm.hxx b/svx/inc/svx/sxopitm.hxx index 947660e71cc0..dd402c3a0915 100644 --- a/svx/inc/svx/sxopitm.hxx +++ b/svx/inc/svx/sxopitm.hxx @@ -39,4 +39,10 @@ public: SdrObjPrintableItem(SvStream& rIn): SdrYesNoItem(SDRATTR_OBJPRINTABLE,rIn) {} }; +class SdrObjVisibleItem: public SdrYesNoItem { +public: + SdrObjVisibleItem(bool bOn=true): SdrYesNoItem(SDRATTR_OBJVISIBLE,bOn) {} + SdrObjVisibleItem(SvStream& rIn): SdrYesNoItem(SDRATTR_OBJVISIBLE,rIn) {} +}; + #endif diff --git a/svx/inc/svx/unoshprp.hxx b/svx/inc/svx/unoshprp.hxx index 27196079db07..fcf86488f7a3 100755 --- a/svx/inc/svx/unoshprp.hxx +++ b/svx/inc/svx/unoshprp.hxx @@ -325,6 +325,7 @@ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_MOVEPROTECT), SDRATTR_OBJMOVEPROTECT , &::getBooleanCppuType(), 0, 0}, \ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_NAME), SDRATTR_OBJECTNAME , &::getCppuType((const ::rtl::OUString*)0), 0, 0}, \ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_PRINTABLE), SDRATTR_OBJPRINTABLE , &::getBooleanCppuType(), 0, 0}, \ + { MAP_CHAR_LEN("Visible"), SDRATTR_OBJVISIBLE , &::getBooleanCppuType(), 0, 0}, \ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_SIZEPROTECT), SDRATTR_OBJSIZEPROTECT , &::getBooleanCppuType(), 0, 0},\ { MAP_CHAR_LEN("UINameSingular"), OWN_ATTR_UINAME_SINGULAR , &::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, \ { MAP_CHAR_LEN("UINamePlural"), OWN_ATTR_UINAME_PLURAL , &::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, \ diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx index 8447fe639a28..485afe35f9c1 100644 --- a/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx @@ -68,10 +68,17 @@ namespace sdr return false; } - // Test if print output but not printable - if(GetObjectContact().isOutputToPrinter() && !rObject.IsPrintable()) + if(GetObjectContact().isOutputToPrinter() ) { - return false; + // Test if print output but not printable + if( !rObject.IsPrintable()) + return false; + } + else + { + // test is object is not visible on screen + if( !rObject.IsVisible() ) + return false; } // Test for hidden object on MasterPage diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index 5d00418a5729..8233bd91b9f3 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -1310,12 +1310,12 @@ namespace sdr { namespace contact { { // the layer of our object SdrLayerID nObjectLayer = _rUnoObject.GetLayer(); - // is the layer we're residing in visible in this view? - bool bIsObjectLayerVisible = _rPageView.isLayerVisible( nObjectLayer ); + // is the object we're residing in visible in this view? + bool bIsObjectVisible = _rUnoObject.IsVisible() && _rPageView.isLayerVisible( nObjectLayer ); - if ( _bForce || ( bIsObjectLayerVisible != _bIsCurrentlyVisible ) ) + if ( _bForce || ( bIsObjectVisible != _bIsCurrentlyVisible ) ) { - _rControl.setVisible( bIsObjectLayerVisible ); + _rControl.setVisible( bIsObjectVisible ); } } } @@ -1863,7 +1863,8 @@ namespace sdr { namespace contact { if(pSdrPageView) { - const bool bIsLayerVisible(pSdrPageView->GetVisibleLayers().IsSet(getSdrObject().GetLayer())); + const SdrObject& rObject = getSdrObject(); + const bool bIsLayerVisible( rObject.IsVisible() && pSdrPageView->GetVisibleLayers().IsSet(rObject.GetLayer())); if(rControl.isVisible() != bIsLayerVisible) { diff --git a/svx/source/svdraw/sdrhittesthelper.cxx b/svx/source/svdraw/sdrhittesthelper.cxx index 473c09b10f5d..58eef58a9fd6 100644 --- a/svx/source/svdraw/sdrhittesthelper.cxx +++ b/svx/source/svdraw/sdrhittesthelper.cxx @@ -60,7 +60,7 @@ SdrObject* SdrObjectPrimitiveHit( } else { - if(!pVisiLayer || pVisiLayer->IsSet(rObject.GetLayer())) + if( rObject.IsVisible() && (!pVisiLayer || pVisiLayer->IsSet(rObject.GetLayer()))) { // single object, 3d object, empty scene or empty group. Check if // it's a single 3D object diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index d831906fa94c..3a3935f819f8 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -189,6 +189,7 @@ SdrItemPool::SdrItemPool( mppLocalPoolDefaults[SDRATTR_OBJMOVEPROTECT -SDRATTR_START]=new SdrObjMoveProtectItem; mppLocalPoolDefaults[SDRATTR_OBJSIZEPROTECT -SDRATTR_START]=new SdrObjSizeProtectItem; mppLocalPoolDefaults[SDRATTR_OBJPRINTABLE -SDRATTR_START]=new SdrObjPrintableItem; + mppLocalPoolDefaults[SDRATTR_OBJVISIBLE -SDRATTR_START]=new SdrObjVisibleItem; mppLocalPoolDefaults[SDRATTR_LAYERID -SDRATTR_START]=new SdrLayerIdItem; mppLocalPoolDefaults[SDRATTR_LAYERNAME -SDRATTR_START]=new SdrLayerNameItem; mppLocalPoolDefaults[SDRATTR_OBJECTNAME -SDRATTR_START]=new SdrObjectNameItem; @@ -546,6 +547,7 @@ void SdrItemPool::TakeItemName(sal_uInt16 nWhich, String& rItemName) case SDRATTR_OBJMOVEPROTECT : nResId = SIP_SA_OBJMOVEPROTECT;break; case SDRATTR_OBJSIZEPROTECT : nResId = SIP_SA_OBJSIZEPROTECT;break; case SDRATTR_OBJPRINTABLE : nResId = SIP_SA_OBJPRINTABLE;break; + case SDRATTR_OBJVISIBLE : nResId = SIP_SA_OBJVISIBLE;break; case SDRATTR_LAYERID : nResId = SIP_SA_LAYERID;break; case SDRATTR_LAYERNAME : nResId = SIP_SA_LAYERNAME;break; case SDRATTR_OBJECTNAME : nResId = SIP_SA_OBJECTNAME;break; diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx index 48870cda0e02..1ac6d0b89945 100644 --- a/svx/source/svdraw/svdedtv1.cxx +++ b/svx/source/svdraw/svdedtv1.cxx @@ -760,6 +760,7 @@ void SdrEditView::MergeNotPersistAttrFromMarked(SfxItemSet& rAttr, BOOL /*bOnlyH BOOL bMovProtect=FALSE,bMovProtectDC=FALSE; BOOL bSizProtect=FALSE,bSizProtectDC=FALSE; BOOL bPrintable =TRUE ,bPrintableDC=FALSE; + BOOL bVisible = TRUE, bVisibleDC=FALSE; SdrLayerID nLayerId=0; BOOL bLayerDC=FALSE; XubString aObjName; BOOL bObjNameDC=FALSE,bObjNameSet=FALSE; long nSnapPosX=0; BOOL bSnapPosXDC=FALSE; @@ -781,6 +782,7 @@ void SdrEditView::MergeNotPersistAttrFromMarked(SfxItemSet& rAttr, BOOL /*bOnlyH bMovProtect=pObj->IsMoveProtect(); bSizProtect=pObj->IsResizeProtect(); bPrintable =pObj->IsPrintable(); + bVisible = pObj->IsVisible(); Rectangle aSnapRect2(pObj->GetSnapRect()); Rectangle aLogicRect2(pObj->GetLogicRect()); nSnapPosX=aSnapRect2.Left(); @@ -798,6 +800,7 @@ void SdrEditView::MergeNotPersistAttrFromMarked(SfxItemSet& rAttr, BOOL /*bOnlyH if (!bMovProtectDC && bMovProtect!=pObj->IsMoveProtect()) bMovProtectDC=TRUE; if (!bSizProtectDC && bSizProtect!=pObj->IsResizeProtect()) bSizProtectDC=TRUE; if (!bPrintableDC && bPrintable !=pObj->IsPrintable()) bPrintableDC=TRUE; + if (!bVisibleDC && bVisible !=pObj->IsVisible()) bVisibleDC=TRUE; if (!bRotAngleDC && nRotAngle !=pObj->GetRotateAngle()) bRotAngleDC=TRUE; if (!bShrAngleDC && nShrAngle !=pObj->GetShearAngle()) bShrAngleDC=TRUE; if (!bSnapWdtDC || !bSnapHgtDC || !bSnapPosXDC || !bSnapPosYDC || !bLogicWdtDiff || !bLogicHgtDiff) { @@ -837,6 +840,7 @@ void SdrEditView::MergeNotPersistAttrFromMarked(SfxItemSet& rAttr, BOOL /*bOnlyH rAttr.Put(SdrRotateOneItem()); rAttr.Put(SdrHorzShearOneItem()); rAttr.Put(SdrVertShearOneItem()); + if (nMarkAnz>1) { rAttr.Put(SdrResizeXAllItem()); rAttr.Put(SdrResizeYAllItem()); diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index b9598cef4ceb..8b3d09017f28 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -1188,6 +1188,10 @@ void SdrMarkView::CheckMarked() } bRaus=bRaus || pPV->GetLockedLayers().IsSet(nLay) || // Layer gesperrt? !pPV->GetVisibleLayers().IsSet(nLay); // Layer nicht sichtbar? + + if( !bRaus ) + bRaus = !pObj->IsVisible(); // not visible objects can not be marked + if (!bRaus) { // Joe am 9.3.1997: Gruppierte Objekten koennen nun auch // markiert werden. Nach EnterGroup muessen aber die Objekte @@ -1591,7 +1595,7 @@ void SdrMarkView::SetMarkHdlSizePixel(USHORT nSiz) #define SDRSEARCH_IMPISMASTER 0x80000000 /* MasterPage wird gerade durchsucht */ SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, USHORT nTol, SdrObject* pObj, SdrPageView* pPV, ULONG nOptions, const SetOfByte* pMVisLay) const { - if((nOptions & SDRSEARCH_IMPISMASTER) && pObj->IsNotVisibleAsMaster()) + if(((nOptions & SDRSEARCH_IMPISMASTER) && pObj->IsNotVisibleAsMaster()) || (!pObj->IsVisible())) { return NULL; } diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index d44b44210ca0..5ab5cb25f7a1 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -235,6 +235,7 @@ SdrObjGeoData::SdrObjGeoData(): bSizProt(FALSE), bNoPrint(FALSE), bClosedObj(FALSE), + mbVisible(true), mnLayerID(0) { DBG_CTOR(SdrObjGeoData,NULL); @@ -457,6 +458,7 @@ SdrObject::SdrObject() bEmptyPresObj =FALSE; bNotVisibleAsMaster=FALSE; bClosedObj =FALSE; + mbVisible = true; // #i25616# mbLineIsOutsideGeometry = sal_False; @@ -1092,6 +1094,7 @@ void SdrObject::operator=(const SdrObject& rObj) bSizProt=rObj.bSizProt; bMovProt=rObj.bMovProt; bNoPrint=rObj.bNoPrint; + mbVisible=rObj.mbVisible; bMarkProt=rObj.bMarkProt; //EmptyPresObj wird nicht kopiert: nun doch! (25-07-1995, Joe) bEmptyPresObj =rObj.bEmptyPresObj; @@ -1958,6 +1961,7 @@ void SdrObject::SaveGeoData(SdrObjGeoData& rGeo) const rGeo.bMovProt =bMovProt ; rGeo.bSizProt =bSizProt ; rGeo.bNoPrint =bNoPrint ; + rGeo.mbVisible =mbVisible ; rGeo.bClosedObj =bClosedObj ; rGeo.mnLayerID = mnLayerID; @@ -1984,6 +1988,7 @@ void SdrObject::RestGeoData(const SdrObjGeoData& rGeo) bMovProt =rGeo.bMovProt ; bSizProt =rGeo.bSizProt ; bNoPrint =rGeo.bNoPrint ; + mbVisible =rGeo.mbVisible ; bClosedObj =rGeo.bClosedObj ; mnLayerID = rGeo.mnLayerID; @@ -2191,6 +2196,11 @@ void SdrObject::NbcApplyNotPersistAttr(const SfxItemSet& rAttr) SetPrintable(b); } + if (rAttr.GetItemState(SDRATTR_OBJVISIBLE,TRUE,&pPoolItem)==SFX_ITEM_SET) { + bool b=((const SdrObjVisibleItem*)pPoolItem)->GetValue(); + SetVisible(b); + } + SdrLayerID nLayer=SDRLAYER_NOTFOUND; if (rAttr.GetItemState(SDRATTR_LAYERID,TRUE,&pPoolItem)==SFX_ITEM_SET) { nLayer=((const SdrLayerIdItem*)pPoolItem)->GetValue(); @@ -2252,6 +2262,7 @@ void SdrObject::TakeNotPersistAttr(SfxItemSet& rAttr, FASTBOOL bMerge) const lcl_SetItem(rAttr,bMerge,SdrObjMoveProtectItem(IsMoveProtect())); lcl_SetItem(rAttr,bMerge,SdrObjSizeProtectItem(IsResizeProtect())); lcl_SetItem(rAttr,bMerge,SdrObjPrintableItem(IsPrintable())); + lcl_SetItem(rAttr,bMerge,SdrObjVisibleItem(IsVisible())); lcl_SetItem(rAttr,bMerge,SdrRotateAngleItem(GetRotateAngle())); lcl_SetItem(rAttr,bMerge,SdrShearAngleItem(GetShearAngle())); lcl_SetItem(rAttr,bMerge,SdrOneSizeWidthItem(rSnap.GetWidth()-1)); @@ -2730,11 +2741,29 @@ void SdrObject::SetResizeProtect(sal_Bool bProt) void SdrObject::SetPrintable(sal_Bool bPrn) { - bNoPrint=!bPrn; - SetChanged(); - if (IsInserted() && pModel!=NULL) { - SdrHint aHint(*this); - pModel->Broadcast(aHint); + if( bPrn != bNoPrint ) + { + bNoPrint=!bPrn; + SetChanged(); + if (IsInserted() && pModel!=NULL) + { + SdrHint aHint(*this); + pModel->Broadcast(aHint); + } + } +} + +void SdrObject::SetVisible(sal_Bool bVisible) +{ + if( bVisible != mbVisible ) + { + mbVisible = bVisible; + SetChanged(); + if (IsInserted() && pModel!=NULL) + { + SdrHint aHint(*this); + pModel->Broadcast(aHint); + } } } diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx index dc76855f05cc..dffdbe6966d7 100644 --- a/svx/source/svdraw/svdoedge.cxx +++ b/svx/source/svdraw/svdoedge.cxx @@ -2100,7 +2100,7 @@ FASTBOOL SdrEdgeObj::ImpFindConnector(const Point& rPt, const SdrPageView& rPV, // Problem: Gruppenobjekt mit verschiedenen Layern liefert LayerID 0 !!!! no--; SdrObject* pObj=pOL->GetObj(no); - if (rVisLayer.IsSet(pObj->GetLayer()) && // nur sichtbare Objekte + if (rVisLayer.IsSet(pObj->GetLayer()) && pObj->IsVisible() && // only visible objects (pThis==NULL || pObj!=(SdrObject*)pThis) && // nicht an mich selbst connecten pObj->IsNode()) { diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx index 6239708394bd..bad1401c2305 100644 --- a/svx/source/svdraw/svdpagv.cxx +++ b/svx/source/svdraw/svdpagv.cxx @@ -754,6 +754,12 @@ sal_Bool SdrPageView::IsObjMarkable(SdrObject* pObj) const return sal_False; } + // only visible are markable + if( !pObj->IsVisible() ) + { + return sal_False; + } + // #112440# if(pObj->ISA(SdrObjGroup)) { diff --git a/svx/source/svdraw/svdstr.src b/svx/source/svdraw/svdstr.src index ee6cbaea9632..1317a0e1328d 100644 --- a/svx/source/svdraw/svdstr.src +++ b/svx/source/svdraw/svdstr.src @@ -2395,6 +2395,11 @@ String SIP_SA_OBJPRINTABLE Text [ en-US ] = "Object, printable"; }; +String SIP_SA_OBJVISIBLE +{ + Text [ en-US ] = "Object, visible"; +}; + String SIP_SA_LAYERID { Text [ en-US ] = "Level ID"; diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 1e79962736aa..dd5f5c527671 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -2699,6 +2699,16 @@ bool SvxShape::setPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper } break; } + case SDRATTR_OBJVISIBLE: + { + sal_Bool bVisible = sal_Bool(); + if( rValue >>= bVisible ) + { + mpObj->SetVisible(bVisible); + return true; + } + break; + } case SDRATTR_OBJSIZEPROTECT: { sal_Bool bResizeProtect = sal_Bool(); @@ -3069,11 +3079,15 @@ bool SvxShape::getPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper } case SDRATTR_OBJPRINTABLE: - rValue = uno::makeAny( (sal_Bool) mpObj->IsPrintable() ); + rValue <<= static_cast( mpObj->IsPrintable() ); + break; + + case SDRATTR_OBJVISIBLE: + rValue <<= static_cast( mpObj->IsVisible() ); break; case SDRATTR_OBJSIZEPROTECT: - rValue = uno::makeAny( (sal_Bool)mpObj->IsResizeProtect() ); + rValue <<= static_cast( mpObj->IsResizeProtect() ); break; case OWN_ATTR_PAGE_NUMBER: -- cgit From b7792cd554c3144c1cc2b06bb7ceb467bc771230 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Thu, 4 Mar 2010 16:38:48 +0100 Subject: #i161701# fixing typo --- .../sdr/contact/viewobjectcontactofgroup.cxx | 69 ++++++++++++---------- svx/source/svdraw/svdobj.cxx | 2 +- 2 files changed, 38 insertions(+), 33 deletions(-) (limited to 'svx') diff --git a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx index 7c17f0bb9144..0f7b69481d8d 100644 --- a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx @@ -71,51 +71,56 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfGroup::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const { - const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount()); + drawinglayer::primitive2d::Primitive2DSequence xRetval; - if(nSubHierarchyCount) + // check model-view visibility + if(isPrimitiveVisible(rDisplayInfo)) { - const sal_Bool bDoGhostedDisplaying( - GetObjectContact().DoVisualizeEnteredGroup() - && !GetObjectContact().isOutputToPrinter() - && GetObjectContact().getActiveViewContact() == &GetViewContact()); + const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount()); - if(bDoGhostedDisplaying) + if(nSubHierarchyCount) { - rDisplayInfo.ClearGhostedDrawMode(); - } + const sal_Bool bDoGhostedDisplaying( + GetObjectContact().DoVisualizeEnteredGroup() + && !GetObjectContact().isOutputToPrinter() + && GetObjectContact().getActiveViewContact() == &GetViewContact()); - // create object hierarchy - drawinglayer::primitive2d::Primitive2DSequence xRetval(getPrimitive2DSequenceSubHierarchy(rDisplayInfo)); + if(bDoGhostedDisplaying) + { + rDisplayInfo.ClearGhostedDrawMode(); + } - if(xRetval.hasElements()) - { - // get ranges - const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D()); - const ::basegfx::B2DRange aObjectRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xRetval, rViewInformation2D)); - const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport()); + // create object hierarchy + xRetval = getPrimitive2DSequenceSubHierarchy(rDisplayInfo); - // check geometrical visibility - if(!aViewRange.isEmpty() && !aViewRange.overlaps(aObjectRange)) + if(xRetval.hasElements()) { - // not visible, release - xRetval.realloc(0); + // get ranges + const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D()); + const ::basegfx::B2DRange aObjectRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xRetval, rViewInformation2D)); + const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport()); + + // check geometrical visibility + if(!aViewRange.isEmpty() && !aViewRange.overlaps(aObjectRange)) + { + // not visible, release + xRetval.realloc(0); + } } - } - if(bDoGhostedDisplaying) + if(bDoGhostedDisplaying) + { + rDisplayInfo.SetGhostedDrawMode(); + } + } + else { - rDisplayInfo.SetGhostedDrawMode(); + // draw replacement object for group. This will use ViewContactOfGroup::createViewIndependentPrimitive2DSequence + // which creates the replacement primitives for an empty group + xRetval = ViewObjectContactOfSdrObj::getPrimitive2DSequenceHierarchy(rDisplayInfo); } - - return xRetval; - } - else - { - // draw replacement object for group. This will use ViewContactOfGroup::createViewIndependentPrimitive2DSequence - // which creates the replacement primitives for an empty group - return ViewObjectContactOfSdrObj::getPrimitive2DSequenceHierarchy(rDisplayInfo); } + return xRetval; } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 5ab5cb25f7a1..aafb929a8e81 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -2741,7 +2741,7 @@ void SdrObject::SetResizeProtect(sal_Bool bProt) void SdrObject::SetPrintable(sal_Bool bPrn) { - if( bPrn != bNoPrint ) + if( bPrn == bNoPrint ) { bNoPrint=!bPrn; SetChanged(); -- cgit From 20966eeae767a734d1f1002163f27ebc090a8f51 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Fri, 5 Mar 2010 10:49:41 +0100 Subject: enable toolbar menu cursor traveling without focus --- svx/source/tbxctrls/toolbarmenu.cxx | 164 ++++++++++++++++++++++++------------ 1 file changed, 112 insertions(+), 52 deletions(-) (limited to 'svx') diff --git a/svx/source/tbxctrls/toolbarmenu.cxx b/svx/source/tbxctrls/toolbarmenu.cxx index f99fdd0c8a37..6d44b9677d5d 100644 --- a/svx/source/tbxctrls/toolbarmenu.cxx +++ b/svx/source/tbxctrls/toolbarmenu.cxx @@ -38,6 +38,9 @@ #include #include #include +#include + +#include #include "svx/toolbarmenu.hxx" @@ -47,6 +50,29 @@ const int TITLE_ID = -1; const int BORDER_X = 0; const int BORDER_Y = 0; +static Window* GetTopMostParentSystemWindow( Window* pWindow ) +{ + OSL_ASSERT( pWindow ); + if ( pWindow ) + { + // ->manually search topmost system window + // required because their might be another system window between this and the top window + pWindow = pWindow->GetParent(); + SystemWindow* pTopMostSysWin = NULL; + while ( pWindow ) + { + if ( pWindow->IsSystemWindow() ) + pTopMostSysWin = (SystemWindow*)pWindow; + pWindow = pWindow->GetParent(); + } + pWindow = pTopMostSysWin; + OSL_ASSERT( pWindow ); + return pWindow; + } + + return NULL; +} + class ToolbarMenuEntry { public: @@ -170,6 +196,10 @@ void ToolbarMenu::implInit() // EnableChildTransparentMode(); + Window* pWindow = GetTopMostParentSystemWindow( this ); + if ( pWindow ) + ((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( this ); + mxServiceManager = ::comphelper::getProcessServiceFactory(); mnCheckPos = 0; @@ -183,6 +213,10 @@ void ToolbarMenu::implInit() ToolbarMenu::~ToolbarMenu() { + Window* pWindow = GetTopMostParentSystemWindow( this ); + if ( pWindow ) + ((SystemWindow *)pWindow)->GetTaskPaneList()->RemoveWindow( this ); + if ( mxStatusListener.is() ) { mxStatusListener->dispose(); @@ -448,17 +482,18 @@ Size ToolbarMenu::implCalcSize() void ToolbarMenu::GetFocus() { -/* + OSL_TRACE("ToolbarMenu::GetFocus()"); + if( mnHighlightedEntry == -1 ) { implChangeHighlightEntry( 0 ); } -*/ DockingWindow::GetFocus(); } void ToolbarMenu::LoseFocus() { + OSL_TRACE("ToolbarMenu::LoseFocus()"); if( mnHighlightedEntry != -1 ) { implChangeHighlightEntry( -1 ); @@ -533,6 +568,16 @@ ToolbarMenuEntry* ToolbarMenu::implSearchEntry( int nEntryId ) const return NULL; } +static void implDeselectControl( Control* pControl ) +{ + ValueSet* pValueSet = dynamic_cast< ValueSet* >( pControl ); + if( pValueSet ) + { + pValueSet->SetNoSelection(); + pValueSet->Invalidate(); + } +} + void ToolbarMenu::implHighlightEntry( int nHighlightEntry, bool bHighlight ) { Size aSz = GetOutputSizePixel(); @@ -564,6 +609,10 @@ void ToolbarMenu::implHighlightEntry( int nHighlightEntry, bool bHighlight ) DrawSelectionBackground( aRect, true, false, TRUE, TRUE ); } } + else if( p->mpControl != NULL ) + { + implDeselectControl( p->mpControl ); + } implPaint( p, bHighlight ); @@ -682,6 +731,32 @@ void ToolbarMenu::implChangeHighlightEntry( int nEntry ) } } +static bool implCheckSubControlCursorMove( Control* pControl, bool bUp ) +{ + ValueSet* pValueSet = dynamic_cast< ValueSet* >( pControl ); + if( pValueSet ) + { + USHORT nItemPos = pValueSet->GetItemPos( pValueSet->GetSelectItemId() ); + if( nItemPos != VALUESET_ITEM_NOTFOUND ) + { + const USHORT nColCount = pValueSet->GetColCount(); + const USHORT nLine = nItemPos / nColCount; + + if( bUp ) + { + return nLine > 0; + } + else + { + const USHORT nLineCount = (pValueSet->GetItemCount() + nColCount - 1) / nColCount; + return (nLine+1) < nLineCount; + } + } + } + + return false; +} + ToolbarMenuEntry* ToolbarMenu::implCursorUpDown( bool bUp, bool bHomeEnd ) { int n = mnHighlightedEntry; @@ -692,6 +767,18 @@ ToolbarMenuEntry* ToolbarMenu::implCursorUpDown( bool bUp, bool bHomeEnd ) else n = maEntryVector.size()-1; } + else if( !bHomeEnd ) + { + // if we have a currently selected entry and + // cursor keys are used than check if this entry + // has a control that can use those cursor keys + ToolbarMenuEntry* pData = maEntryVector[n]; + if( pData && pData->mpControl && !pData->mbHasText ) + { + if( implCheckSubControlCursorMove( pData->mpControl, bUp ) ) + return pData; + } + } int nLoop = n; @@ -746,6 +833,8 @@ ToolbarMenuEntry* ToolbarMenu::implCursorUpDown( bool bUp, bool bHomeEnd ) void ToolbarMenu::KeyInput( const KeyEvent& rKEvent ) { + OSL_TRACE("ToolbarMenu::KeyInput()"); + Control* pForwardControl = 0; USHORT nCode = rKEvent.GetKeyCode().GetCode(); switch ( nCode ) { @@ -756,12 +845,19 @@ void ToolbarMenu::KeyInput( const KeyEvent& rKEvent ) ToolbarMenuEntry*p = implCursorUpDown( nCode == KEY_UP, false ); if( p && p->mpControl && !p->mbHasText ) { - p->mpControl->GrabFocus(); + OSL_TRACE("ToolbarMenu::KeyInput() - grab focus to control"); +// p->mpControl->GrabFocus(); if( nOldEntry != mnHighlightedEntry ) { KeyCode aKeyCode( (nCode == KEY_UP) ? KEY_END : KEY_HOME ); KeyEvent aKeyEvent( 0, aKeyCode ); p->mpControl->KeyInput( aKeyEvent ); + p->mpControl->Invalidate(); + } + else if( !p->mpControl->HasFocus() ) + { + // in case we are in a system floating window, GrabFocus does not work :-/ + pForwardControl = p->mpControl; } } } @@ -772,10 +868,11 @@ void ToolbarMenu::KeyInput( const KeyEvent& rKEvent ) ToolbarMenuEntry* p = implCursorUpDown( nCode == KEY_END, true ); if( p && p->mpControl && !p->mbHasText ) { - p->mpControl->GrabFocus(); +// p->mpControl->GrabFocus(); KeyCode aKeyCode( KEY_HOME ); KeyEvent aKeyEvent( 0, aKeyCode ); p->mpControl->KeyInput( aKeyEvent ); + p->mpControl->Invalidate(); } } break; @@ -783,29 +880,10 @@ void ToolbarMenu::KeyInput( const KeyEvent& rKEvent ) case KEY_ESCAPE: { // Ctrl-F6 acts like ESC here, the menu bar however will then put the focus in the document - if( nCode == KEY_F6 && !rKEvent.GetKeyCode().IsMod1() ) - break; +// if( nCode == KEY_F6 && !rKEvent.GetKeyCode().IsMod1() ) +// break; implSelectEntry( -1 ); -/* - if ( !pMenu->pStartedFrom ) - { - StopExecute(); - KillActivePopup(); - } - else if ( pMenu->pStartedFrom->bIsMenuBar ) - { - // Forward... - ((MenuBarWindow*)((MenuBar*)pMenu->pStartedFrom)->ImplGetWindow())->KeyInput( rKEvent ); - } - else - { - StopExecute(); - ToolbarMenu* pFloat = ((PopupMenu*)pMenu->pStartedFrom)->ImplGetFloatingWindow(); - pFloat->GrabFocus(); - pFloat->KillActivePopup(); - } -*/ } break; @@ -816,47 +894,29 @@ void ToolbarMenu::KeyInput( const KeyEvent& rKEvent ) { if( pEntry->mpControl ) { - pEntry->mpControl->GrabFocus(); + pForwardControl = pEntry->mpControl; } else { implSelectEntry( mnHighlightedEntry ); } } - // else - // StopExecute(); } break; default: { -/* - xub_Unicode nCharCode = rKEvent.GetCharCode(); - USHORT nPos; - USHORT nDuplicates = 0; - MenuItemData* pData = nCharCode ? pMenu->GetItemList()->SearchItem( nCharCode, nPos, nDuplicates, nHighlightedItem ) : NULL; - if ( pData ) - { - if ( pData->pSubMenu || nDuplicates > 1 ) - { - implChangeHighlightEntry( nPos ); - HighlightChanged( 0 ); - } - else - { - nHighlightedItem = nPos; - EndExecute(); - } - } - else + ToolbarMenuEntry* pEntry = implGetEntry( mnHighlightedEntry ); + if ( pEntry && pEntry->mbEnabled && pEntry->mpControl && !pEntry->mbHasText ) { - // Bei ungueltigen Tasten Beepen, aber nicht bei HELP und F-Tasten - if ( !rKEvent.GetKeyCode().IsControlMod() && ( nCode != KEY_HELP ) && ( rKEvent.GetKeyCode().GetGroup() != KEYGROUP_FKEYS ) ) - Sound::Beep(); - FloatingWindow::KeyInput( rKEvent ); +// pEntry->mpControl->GrabFocus(); + pForwardControl = pEntry->mpControl; } - */ } + } + if( pForwardControl ) + pForwardControl->KeyInput( rKEvent ); + } void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) -- cgit From 88635eddcd4e4d8a3eb4293cbbe055415cd147c4 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Thu, 11 Mar 2010 18:18:08 +0100 Subject: moved toolbarmenu to svtools and reworked to non sfx2 code --- svx/source/tbxctrls/toolbarmenu.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'svx') diff --git a/svx/source/tbxctrls/toolbarmenu.cxx b/svx/source/tbxctrls/toolbarmenu.cxx index 6d44b9677d5d..9f737f82aaea 100644 --- a/svx/source/tbxctrls/toolbarmenu.cxx +++ b/svx/source/tbxctrls/toolbarmenu.cxx @@ -853,6 +853,7 @@ void ToolbarMenu::KeyInput( const KeyEvent& rKEvent ) KeyEvent aKeyEvent( 0, aKeyCode ); p->mpControl->KeyInput( aKeyEvent ); p->mpControl->Invalidate(); + p->mpControl->Update(); } else if( !p->mpControl->HasFocus() ) { @@ -873,6 +874,7 @@ void ToolbarMenu::KeyInput( const KeyEvent& rKEvent ) KeyEvent aKeyEvent( 0, aKeyCode ); p->mpControl->KeyInput( aKeyEvent ); p->mpControl->Invalidate(); + p->mpControl->Update(); } } break; -- cgit From d17e846b168e1a41cb9bbad9123924499787a208 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 15 Mar 2010 14:07:56 +0100 Subject: dba33f: #i110036#: when creating new controls or grid columns, set MouseWheelBehavior to NEVER --- svx/source/form/formcontrolfactory.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'svx') diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx index 0a0f17f8d1c6..eaf0234d538c 100644 --- a/svx/source/form/formcontrolfactory.cxx +++ b/svx/source/form/formcontrolfactory.cxx @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -100,6 +101,7 @@ namespace svxform /** === end UNO using === **/ namespace FormComponentType = ::com::sun::star::form::FormComponentType; namespace ScrollBarOrientation = ::com::sun::star::awt::ScrollBarOrientation; + namespace MouseWheelBehavior = ::com::sun::star::awt::MouseWheelBehavior; namespace LineEndFormat = ::com::sun::star::awt::LineEndFormat; namespace ImageScaleMode = ::com::sun::star::awt::ImageScaleMode; namespace DataType = ::com::sun::star::sdbc::DataType; @@ -509,6 +511,12 @@ namespace svxform _rxControlModel->setPropertyValue( FM_PROP_STRICTFORMAT, makeAny( sal_Bool( sal_True ) ) ); } + // mouse wheel: don't use it for scrolling by default (i110036) + if ( xPSI->hasPropertyByName( FM_PROP_MOUSE_WHEEL_BEHAVIOR ) ) + { + _rxControlModel->setPropertyValue( FM_PROP_MOUSE_WHEEL_BEHAVIOR, makeAny( MouseWheelBehavior::SCROLL_DISABLED ) ); + } + if ( xPSI->hasPropertyByName( FM_PROP_WRITING_MODE ) ) _rxControlModel->setPropertyValue( FM_PROP_WRITING_MODE, makeAny( WritingMode2::CONTEXT ) ); } -- cgit From b3ca4b3cbdce79eb3b387da6e84126c7a9f20eaa Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Sun, 21 Mar 2010 20:01:33 +0100 Subject: Adding PopupMenuController to allow PopupMenuControllerBase dervivates to be used in toolbars --- svx/inc/extrusioncontrols.hxx | 355 --------- svx/inc/extrusiondepthdialog.hxx | 60 ++ svx/inc/fontworkgallery.hxx | 122 +-- svx/inc/svx/dialogs.hrc | 16 + svx/inc/svx/extrusioncolorcontrol.hxx | 56 ++ svx/inc/svx/toolbarmenu.hxx | 170 ---- svx/prj/build.lst | 3 +- svx/prj/d.lst | 4 +- svx/source/core/coreservices.cxx | 183 +++++ svx/source/core/makefile.mk | 47 ++ svx/source/tbxctrls/extrusioncontrols.cxx | 877 ++++++++------------- svx/source/tbxctrls/extrusioncontrols.hxx | 241 ++++++ svx/source/tbxctrls/extrusioncontrols.src | 144 ++-- svx/source/tbxctrls/fontworkgallery.cxx | 378 ++++----- svx/source/tbxctrls/makefile.mk | 1 - svx/source/tbxctrls/toolbarmenu.cxx | 1194 ----------------------------- svx/source/toolbars/extrusionbar.cxx | 3 +- svx/source/unodraw/unoctabl.cxx | 27 +- svx/util/makefile.mk | 4 + 19 files changed, 1219 insertions(+), 2666 deletions(-) delete mode 100644 svx/inc/extrusioncontrols.hxx create mode 100644 svx/inc/extrusiondepthdialog.hxx create mode 100644 svx/inc/svx/extrusioncolorcontrol.hxx delete mode 100644 svx/inc/svx/toolbarmenu.hxx create mode 100644 svx/source/core/coreservices.cxx create mode 100644 svx/source/core/makefile.mk create mode 100644 svx/source/tbxctrls/extrusioncontrols.hxx delete mode 100644 svx/source/tbxctrls/toolbarmenu.cxx (limited to 'svx') diff --git a/svx/inc/extrusioncontrols.hxx b/svx/inc/extrusioncontrols.hxx deleted file mode 100644 index 7b85820a5f22..000000000000 --- a/svx/inc/extrusioncontrols.hxx +++ /dev/null @@ -1,355 +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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_EXTRUSION_CONTROLS_HXX -#define _SVX_EXTRUSION_CONTROLS_HXX - -#include "svx/svxdllapi.h" - -#include -#include -#include -#ifndef _SV_BUTTON_HXX -#include -#endif -#include -#include -#include - -#include "svx/toolbarmenu.hxx" - -class SfxBindings; -class SfxStatusForwarder; - -//======================================================================== - -namespace svx -{ -class ToolboxButtonColorUpdater; - -class ExtrusionDirectionWindow : public ToolbarMenu -{ -private: - ValueSet* mpDirectionSet; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - - SfxStatusForwarder* mpDirectionForewarder; - SfxStatusForwarder* mpProjectionForewarder; - - Image maImgDirection[9]; - Image maImgDirectionH[9]; - - Image maImgPerspective; - Image maImgPerspectiveH; - Image maImgParallel; - Image maImgParallelH; - - const rtl::OUString msExtrusionDirection; - const rtl::OUString msExtrusionProjection; - - DECL_LINK( SelectHdl, void * ); - void FillValueSet(); - - void implSetDirection( sal_Int32 nSkew, bool bEnabled = true ); - void implSetProjection( sal_Int32 nProjection, bool bEnabled = true ); - void implInit(); - -protected: - /** This function is called when the window gets the focus. It grabs - the focus to the line ends value set so that it can be controlled with - the keyboard. - */ - virtual void GetFocus (void); - -public: - ExtrusionDirectionWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ); - ~ExtrusionDirectionWindow(); - - void StartSelection(); - - virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); -}; - -//======================================================================== - -class SVX_DLLPUBLIC ExtrusionDirectionControl : public SfxToolBoxControl -{ -public: - SFX_DECL_TOOLBOX_CONTROL(); - ExtrusionDirectionControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); - ~ExtrusionDirectionControl(); - - virtual void StateChanged( USHORT nSID, SfxItemState eState, - const SfxPoolItem* pState ); - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); -}; - -//======================================================================== - -class ExtrusionDepthWindow : public ToolbarMenu -{ -private: - Image maImgDepth0; - Image maImgDepth1; - Image maImgDepth2; - Image maImgDepth3; - Image maImgDepth4; - Image maImgDepthInfinity; - - Image maImgDepth0h; - Image maImgDepth1h; - Image maImgDepth2h; - Image maImgDepth3h; - Image maImgDepth4h; - Image maImgDepthInfinityh; - - SfxStatusForwarder* mpDepthForewarder; - SfxStatusForwarder* mpMetricForewarder; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - - FieldUnit meUnit; - double mfDepth; - bool mbEnabled; - - const rtl::OUString msExtrusionDepth; - const rtl::OUString msMetricUnit; - - DECL_LINK( SelectHdl, void * ); - - void implFillStrings( FieldUnit eUnit ); - void implSetDepth( double fDepth, bool bEnabled ); - void implInit(); - -protected: - /** This function is called when the window gets the focus. It grabs - the focus to the line ends value set so that it can be controlled with - the keyboard. - */ - virtual void GetFocus (void); - -public: - ExtrusionDepthWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ); - ~ExtrusionDepthWindow(); - - void StartSelection(); - - virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); -}; - -//======================================================================== - -class SVX_DLLPUBLIC ExtrusionDepthControl : public SfxToolBoxControl -{ -public: - SFX_DECL_TOOLBOX_CONTROL(); - ExtrusionDepthControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); - ~ExtrusionDepthControl(); - - virtual void StateChanged( USHORT nSID, SfxItemState eState, - const SfxPoolItem* pState ); - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); -}; - -//======================================================================== - -class ExtrusionLightingWindow : public ToolbarMenu -{ -private: - ValueSet* mpLightingSet; - - Image maImgLightingOff[9]; - Image maImgLightingOn[9]; - Image maImgLightingPreview[9]; - - Image maImgLightingOffh[9]; - Image maImgLightingOnh[9]; - Image maImgLightingPreviewh[9]; - - Image maImgBright; - Image maImgNormal; - Image maImgDim; - Image maImgBrighth; - Image maImgNormalh; - Image maImgDimh; - - SfxStatusForwarder* mpLightingDirectionForewarder; - SfxStatusForwarder* mpLightingIntensityForewarder; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - - int mnLevel; - bool mbLevelEnabled; - int mnDirection; - bool mbDirectionEnabled; - - const rtl::OUString msExtrusionLightingDirection; - const rtl::OUString msExtrusionLightingIntensity; - - void implSetIntensity( int nLevel, bool bEnabled ); - void implSetDirection( int nDirection, bool bEnabled ); - void implInit(); - - DECL_LINK( SelectHdl, void * ); - -protected: - /** This function is called when the window gets the focus. It grabs - the focus to the line ends value set so that it can be controlled with - the keyboard. - */ - virtual void GetFocus (void); - -public: - ExtrusionLightingWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ); - ~ExtrusionLightingWindow(); - - void StartSelection(); - - virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); -}; - -//======================================================================== - -class SVX_DLLPUBLIC ExtrusionLightingControl : public SfxToolBoxControl -{ -public: - SFX_DECL_TOOLBOX_CONTROL(); - ExtrusionLightingControl( USHORT nSlotid, USHORT nId, ToolBox& rTbx ); - ~ExtrusionLightingControl(); - - virtual void StateChanged( USHORT nSID, SfxItemState eState, - const SfxPoolItem* pState ); - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); -}; - -//======================================================================== - -class ExtrusionSurfaceWindow : public ToolbarMenu -{ -private: - Image maImgSurface1; - Image maImgSurface2; - Image maImgSurface3; - Image maImgSurface4; - Image maImgSurface1h; - Image maImgSurface2h; - Image maImgSurface3h; - Image maImgSurface4h; - - SfxStatusForwarder* mpSurfaceForewarder; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - - const rtl::OUString msExtrusionSurface; - - DECL_LINK( SelectHdl, void * ); - - void implSetSurface( int nSurface, bool bEnabled ); - void implInit(); - -protected: - /** This function is called when the window gets the focus. It grabs - the focus to the line ends value set so that it can be controlled with - the keyboard. - */ - virtual void GetFocus (void); - -public: - ExtrusionSurfaceWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ); - ~ExtrusionSurfaceWindow(); - - void StartSelection(); - - virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); -}; - -//======================================================================== - -class SVX_DLLPUBLIC ExtrusionSurfaceControl : public SfxToolBoxControl -{ -public: - SFX_DECL_TOOLBOX_CONTROL(); - ExtrusionSurfaceControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); - ~ExtrusionSurfaceControl(); - - virtual void StateChanged( USHORT nSID, SfxItemState eState, - const SfxPoolItem* pState ); - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); -}; - -//======================================================================== - -class SVX_DLLPUBLIC ExtrusionColorControl : public SfxToolBoxControl -{ -private: - ToolboxButtonColorUpdater* mpBtnUpdater; - -public: - SFX_DECL_TOOLBOX_CONTROL(); - ExtrusionColorControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); - ~ExtrusionColorControl(); - - virtual void StateChanged( USHORT nSID, SfxItemState eState, - const SfxPoolItem* pState ); - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); -}; - -//======================================================================== - -class ExtrusionDepthDialog : public ModalDialog -{ - FixedText maFLDepth; - MetricField maMtrDepth; - OKButton maOKButton; - CancelButton maCancelButton; - HelpButton maHelpButton; - - FieldUnit meDefaultUnit; - -public: - ExtrusionDepthDialog( Window* pParent, double fDepth, FieldUnit eDefaultUnit ); - ~ExtrusionDepthDialog(); - - double getDepth() const; -}; - -} -#endif - diff --git a/svx/inc/extrusiondepthdialog.hxx b/svx/inc/extrusiondepthdialog.hxx new file mode 100644 index 000000000000..600e646e8cb6 --- /dev/null +++ b/svx/inc/extrusiondepthdialog.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVX_EXTRUSIONDEPTHDIALOG_HXX +#define _SVX_EXTRUSIONDEPTHDIALOG_HXX + +#include "svx/svxdllapi.h" + +#include +#include +#include +#include + +namespace svx { + +class ExtrusionDepthDialog : public ModalDialog +{ + FixedText maFLDepth; + MetricField maMtrDepth; + OKButton maOKButton; + CancelButton maCancelButton; + HelpButton maHelpButton; + + FieldUnit meDefaultUnit; + +public: + ExtrusionDepthDialog( Window* pParent, double fDepth, FieldUnit eDefaultUnit ); + ~ExtrusionDepthDialog(); + + double getDepth() const; +}; + +} + +#endif // _SVX_EXTRUSIONDEPTHDIALOG_HXX + diff --git a/svx/inc/fontworkgallery.hxx b/svx/inc/fontworkgallery.hxx index 31650479636f..40ac3cef966a 100644 --- a/svx/inc/fontworkgallery.hxx +++ b/svx/inc/fontworkgallery.hxx @@ -29,16 +29,17 @@ #ifndef _SVX_FONTWORK_GALLERY_DIALOG_HXX #define _SVX_FONTWORK_GALLERY_DIALOG_HXX -#ifndef _FIXED_HXX //autogen +#include "svx/svxdllapi.h" + #include -#endif -#include -#ifndef _SV_BUTTON_HXX #include -#endif #include -#include "svx/svxdllapi.h" -#include "svx/toolbarmenu.hxx" +#include + +#include + +#include + #include class FmFormModel; @@ -56,113 +57,6 @@ class SfxStatusForwarder; namespace svx { -class FontWorkAlignmentWindow : public ToolbarMenu -{ -private: - Image maImgAlgin1; - Image maImgAlgin2; - Image maImgAlgin3; - Image maImgAlgin4; - Image maImgAlgin5; - Image maImgAlgin1h; - Image maImgAlgin2h; - Image maImgAlgin3h; - Image maImgAlgin4h; - Image maImgAlgin5h; - - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - - const rtl::OUString msFontworkAlignment; - - DECL_LINK( SelectHdl, void * ); - - void implSetAlignment( int nAlignmentMode, bool bEnabled ); - void implInit(); - -protected: - /** This function is called when the window gets the focus. It grabs - the focus to the line ends value set so that it can be controlled with - the keyboard. - */ - virtual void GetFocus (void); - -public: - FontWorkAlignmentWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ); - ~FontWorkAlignmentWindow(); - - void StartSelection(); - - virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); -}; - -class SVX_DLLPUBLIC FontWorkAlignmentControl : public SfxToolBoxControl -{ -public: - SFX_DECL_TOOLBOX_CONTROL(); - FontWorkAlignmentControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); - ~FontWorkAlignmentControl(); - - virtual void StateChanged( USHORT nSID, SfxItemState eState, - const SfxPoolItem* pState ); - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); -}; - -//------------------------------------------------------------------------ - -class FontWorkCharacterSpacingWindow : public ToolbarMenu -{ -private: - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - - const rtl::OUString msFontworkCharacterSpacing; - const rtl::OUString msFontworkKernCharacterPairs; - - DECL_LINK( SelectHdl, void * ); - - void implSetCharacterSpacing( sal_Int32 nCharacterSpacing, bool bEnabled ); - void implSetKernCharacterPairs( sal_Bool bKernOnOff, bool bEnabled ); - void implInit(); - -protected: - /** This function is called when the window gets the focus. It grabs - the focus to the line ends value set so that it can be controlled with - the keyboard. - */ - virtual void GetFocus (void); - -public: - FontWorkCharacterSpacingWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); - FontWorkCharacterSpacingWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ); - ~FontWorkCharacterSpacingWindow(); - - void StartSelection(); - - virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); -}; - -class SVX_DLLPUBLIC FontWorkCharacterSpacingControl : public SfxToolBoxControl -{ -public: - SFX_DECL_TOOLBOX_CONTROL(); - FontWorkCharacterSpacingControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); - ~FontWorkCharacterSpacingControl(); - - virtual void StateChanged( USHORT nSID, SfxItemState eState, - const SfxPoolItem* pState ); - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); -}; - -//------------------------------------------------------------------------ - class SVX_DLLPUBLIC FontWorkShapeTypeControl : public SfxToolBoxControl { using SfxToolBoxControl::Select; diff --git a/svx/inc/svx/dialogs.hrc b/svx/inc/svx/dialogs.hrc index d193652b57fc..10e0bf3fbed4 100644 --- a/svx/inc/svx/dialogs.hrc +++ b/svx/inc/svx/dialogs.hrc @@ -379,6 +379,19 @@ #define RID_SVXDLG_TEXTCONTROL_CHARATTR (RID_SVX_START + 286) #define RID_SVXDLG_TEXTCONTROL_PARAATTR (RID_SVX_START + 287) +#define RID_SVXIMG_EXTRUSION_DEPTH_0 (RID_SVX_START + 288) +#define RID_SVXIMG_EXTRUSION_DEPTH_1 (RID_SVX_START + 289) +#define RID_SVXIMG_EXTRUSION_DEPTH_2 (RID_SVX_START + 290) +#define RID_SVXIMG_EXTRUSION_DEPTH_3 (RID_SVX_START + 291) +#define RID_SVXIMG_EXTRUSION_DEPTH_4 (RID_SVX_START + 292) +#define RID_SVXIMG_EXTRUSION_DEPTH_0_H (RID_SVX_START + 293) +#define RID_SVXIMG_EXTRUSION_DEPTH_1_H (RID_SVX_START + 294) +#define RID_SVXIMG_EXTRUSION_DEPTH_2_H (RID_SVX_START + 295) +#define RID_SVXIMG_EXTRUSION_DEPTH_3_H (RID_SVX_START + 296) +#define RID_SVXIMG_EXTRUSION_DEPTH_4_H (RID_SVX_START + 297) +#define RID_SVXIMG_EXTRUSION_DEPTH_INFINITY (RID_SVX_START + 298) +#define RID_SVXIMG_EXTRUSION_DEPTH_INFINITY_H (RID_SVX_START + 299) + // !!! please update RID_SVX_FIRSTFREE !!! see line 46 // Strings ------------------------------------------------------------------ @@ -612,6 +625,9 @@ #define RID_SVXSTR_SEABLUE (RID_SVX_START + 546) #define RID_SVXSTR_COLOR_SUN (RID_SVX_START + 547) +#define RID_SVXSTR_EXTRUSION_CUSTOM (RID_SVX_START + 548) +#define RID_SVXSTR_EXTRUSION_INFINITY (RID_SVX_START + 549) + // JP: string resource ids for table-autoformat-names, used in SW/SC // !!! Urgent: the order of Ids is persistent. New Ids have to append !!! #define RID_SVXSTR_TBLAFMT_BEGIN (RID_SVX_START + 560) diff --git a/svx/inc/svx/extrusioncolorcontrol.hxx b/svx/inc/svx/extrusioncolorcontrol.hxx new file mode 100644 index 000000000000..ff4a53e65a41 --- /dev/null +++ b/svx/inc/svx/extrusioncolorcontrol.hxx @@ -0,0 +1,56 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVX_EXTRUSIONCOLORCONTROL_HXX +#define _SVX_EXTRUSIONCOLORCONTROL_HXX + +#include +#include "svx/svxdllapi.h" +#include "svx/tbxcolorupdate.hxx" + +namespace svx { + +class SVX_DLLPUBLIC ExtrusionColorControl : public SfxToolBoxControl +{ +private: + ToolboxButtonColorUpdater* mpBtnUpdater; + +public: + SFX_DECL_TOOLBOX_CONTROL(); + ExtrusionColorControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); + ~ExtrusionColorControl(); + + virtual void StateChanged( USHORT nSID, SfxItemState eState, + const SfxPoolItem* pState ); + virtual SfxPopupWindowType GetPopupWindowType() const; + virtual SfxPopupWindow* CreatePopupWindow(); +}; + +} + +#endif // _SVX_EXTRUSIONCOLORCONTROL_HXX + diff --git a/svx/inc/svx/toolbarmenu.hxx b/svx/inc/svx/toolbarmenu.hxx deleted file mode 100644 index a0f5aa55c6d0..000000000000 --- a/svx/inc/svx/toolbarmenu.hxx +++ /dev/null @@ -1,170 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: colrctrl.hxx,v $ - * $Revision: 1.3.76.1 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVX_TOOLBARMENU_HXX_ -#define _SVX_TOOLBARMENU_HXX_ - -#include -#include - -#include - -#include - -#include -#include -#include - -#include - -#include - - -#include "svx/svxdllapi.h" - -class ToolbarMenuEntry; - -typedef std::vector< ToolbarMenuEntry * > ToolbarMenuEntryVector; - -class SVX_DLLPUBLIC ToolbarMenu : public DockingWindow -{ - friend class ToolbarMenuStatusListener; -public: - ToolbarMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow, - WinBits nBits ); - - ToolbarMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow, - const ResId& rResId ); - - ~ToolbarMenu(); - - virtual void MouseMove( const MouseEvent& rMEvt ); - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void MouseButtonUp( const MouseEvent& rMEvt ); - virtual void KeyInput( const KeyEvent& rKEvent ); - virtual void Command( const CommandEvent& rCEvt ); - virtual void Paint( const Rectangle& rRect ); - virtual void RequestHelp( const HelpEvent& rHEvt ); - virtual void Resize(); - virtual void GetFocus(); - virtual void LoseFocus(); - - void appendEntry( int nEntryId, const String& rStr, MenuItemBits nItemBits = 0 ); - void appendEntry( int nEntryId, const Image& rImage, MenuItemBits nItemBits = 0 ); - void appendEntry( int nEntryId, const String& rStr, const Image& rImage, MenuItemBits nItemBits = 0 ); - void appendEntry( int nEntryId, Control* pControl, MenuItemBits nItemBits = 0 ); -// void appendEntry( int nEntryId, const String& rStr, Control* pControl, MenuItemBits nItemBits = 0 ); - void appendSeparator(); - - void checkEntry( int nEntryId, bool bCheck = true ); - bool isEntryChecked( int nEntryId ) const; - - void enableEntry( int nEntryId, bool bEnable = true ); - bool isEntryEnabled( int nEntryId ) const; - - void setEntryText( int nEntryId, const String& rStr ); - const String& getEntryText( int nEntryId ) const; - - void setEntryImage( int nEntryId, const Image& rImage ); - const Image& getEntryImage( int nEntryId ) const; - - const Size& getMenuSize() const { return maSize; } - - void SetHighlightHdl( const Link& rLink ) { maHighlightHdl = rLink; } - const Link& GetHighlightHdl() const { return maHighlightHdl; } - - void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; } - const Link& GetSelectHdl() const { return maSelectHdl; } - - int getSelectedEntryId() const; - int getHighlightedEntryId() const; - -protected: - // todo: move to new base class that will replace SfxPopupWindo - void AddStatusListener( const rtl::OUString& rCommandURL ); - void RemoveStatusListener( const rtl::OUString& rCommandURL ); - void UpdateStatus( const rtl::OUString& rCommandURL ); - - bool IsInPopupMode(); - void EndPopupMode(); - - // XStatusListener (subclasses must override this one to get the status updates - virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); - - void StateChanged( StateChangedType nType ); - void DataChanged( const DataChangedEvent& rDCEvt ); - - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > GetFrame() const { return mxFrame; } -private: - void initStatusListener(); - - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - rtl::Reference< svt::FrameStatusListener > mxStatusListener; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceManager; - - ToolbarMenuEntryVector maEntryVector; - - int mnCheckPos; - int mnImagePos; - int mnTextPos; - - int mnHighlightedEntry; - int mnSelectedEntry; - - Size maSize; - - Link maHighlightHdl; - Link maSelectHdl; - - void implInit(); - - void initWindow(); - - Size implCalcSize(); - - void appendEntry( ToolbarMenuEntry* pEntry ); - - void implPaint( ToolbarMenuEntry* pThisOnly = NULL, bool bHighlight = false ); -// void implDrawBorder(); - - void implHighlightEntry( int nHighlightEntry, bool bHighlight ); - void implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown ); - - void implChangeHighlightEntry( int nEntry ); - void implSelectEntry( int nSelectedEntry ); - - ToolbarMenuEntry* implCursorUpDown( bool bUp, bool bHomeEnd ); - ToolbarMenuEntry* implGetEntry( int nEntry ) const; - ToolbarMenuEntry* implSearchEntry( int nEntryId ) const; -}; - -#endif diff --git a/svx/prj/build.lst b/svx/prj/build.lst index 5b99711edaa2..dd56a2c59e83 100644 --- a/svx/prj/build.lst +++ b/svx/prj/build.lst @@ -30,8 +30,9 @@ sx svx\source\unodraw nmake - all sx_undrw sx_inc NULL sx svx\source\unogallery nmake - all sx_ungal sx_inc NULL sx svx\source\gallery2 nmake - all sx_gall sx_inc NULL sx svx\source\xml nmake - all sx_xml sx_inc NULL +sx svx\source\core nmake - all sx_core sx_inc NULL sx svx\source\accessibility nmake - all sx_accessibility sx_inc NULL sx svx\source\customshapes nmake - all sx_customshapes sx_inc NULL sx svx\source\toolbars nmake - all sx_toolbars sx_inc NULL -sx svx\util nmake - all sx_util sx_3deng sx_dlg sx_draw sx_attribute sx_properties sx_contact sx_event sx_animation sx_primitive2d sx_primitive3d sx_overlay sx_fmcmp sx_form sx_gall sx_items sx_mnuc sx_sdi sx_stbc sx_tbxc sx_undrw sx_ungal sx_xml sx_xout sx_accessibility sx_intro sx_customshapes sx_toolbars sx_table sx_smarttags NULL +sx svx\util nmake - all sx_util sx_3deng sx_dlg sx_draw sx_attribute sx_properties sx_contact sx_event sx_animation sx_primitive2d sx_primitive3d sx_overlay sx_fmcmp sx_form sx_gall sx_items sx_mnuc sx_sdi sx_stbc sx_tbxc sx_undrw sx_ungal sx_xml sx_core sx_xout sx_accessibility sx_intro sx_customshapes sx_toolbars sx_table sx_smarttags NULL sx svx\source\gengal nmake - all sx_gengal sx_util NULL diff --git a/svx/prj/d.lst b/svx/prj/d.lst index 537193f3190b..9d9c9fbbf6c7 100644 --- a/svx/prj/d.lst +++ b/svx/prj/d.lst @@ -69,7 +69,6 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\editstat.hxx %_DEST%\inc%_EXT%\svx\editstat.hxx ..\inc\editund2.hxx %_DEST%\inc%_EXT%\svx\editund2.hxx ..\inc\eerdll.hxx %_DEST%\inc%_EXT%\svx\editdll.hxx -..\inc\extrusioncontrols.hxx %_DEST%\inc%_EXT%\svx\extrusioncontrols.hxx ..\inc\flstitem.hxx %_DEST%\inc%_EXT%\svx\flstitem.hxx ..\inc\fmgridif.hxx %_DEST%\inc%_EXT%\svx\fmgridif.hxx ..\inc\fmobjfac.hxx %_DEST%\inc%_EXT%\svx\fmobjfac.hxx @@ -484,7 +483,7 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\svx\viewlayoutitem.hxx %_DEST%\inc%_EXT%\svx\viewlayoutitem.hxx ..\inc\svx\zoomslideritem.hxx %_DEST%\inc%_EXT%\svx\zoomslideritem.hxx ..\inc\svx\zoomsliderctrl.hxx %_DEST%\inc%_EXT%\svx\zoomsliderctrl.hxx - +..\inc\svx\extrusioncolorcontrol.hxx %_DEST%\inc%_EXT%\svx\extrusioncolorcontrol.hxx ..\inc\svx\itemtype.hxx %_DEST%\inc%_EXT%\svx\itemtype.hxx ..\inc\svx\outliner.hxx %_DEST%\inc%_EXT%\svx\outliner.hxx @@ -686,7 +685,6 @@ mkdir: %_DEST%\inc%_EXT%\svx\sdr\table ..\inc\svx\selectioncontroller.hxx %_DEST%\inc%_EXT%\svx\selectioncontroller.hxx ..\inc\svx\helperhittest3d.hxx %_DEST%\inc%_EXT%\svx\helperhittest3d.hxx ..\inc\svx\optimprove.hxx %_DEST%\inc%_EXT%\svx\optimprove.hxx -..\inc\svx\toolbarmenu.hxx %_DEST%\inc%_EXT%\svx\toolbarmenu.hxx ..\inc\svx\msvbahelper.hxx %_DEST%\inc%_EXT%\svx\msvbahelper.hxx ..\%__SRC%\bin\*-layout.zip %_DEST%\pck%_EXT%\*.* diff --git a/svx/source/core/coreservices.cxx b/svx/source/core/coreservices.cxx new file mode 100644 index 000000000000..1f1d69781756 --- /dev/null +++ b/svx/source/core/coreservices.cxx @@ -0,0 +1,183 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +/** this file contains the uno service registrations for all services in the svxcore lib */ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svx.hxx" + +#include "sal/types.h" +#include "osl/diagnose.h" +#include "cppuhelper/factory.hxx" +#include "uno/lbnames.h" + +using rtl::OUString; + +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::registry; + +namespace svx +{ +extern OUString SAL_CALL ExtrusionDepthController_getImplementationName(); +extern Reference< XInterface > SAL_CALL ExtrusionDepthController_createInstance(const Reference< XMultiServiceFactory > &) throw( RuntimeException ); +extern Sequence< OUString > SAL_CALL ExtrusionDepthController_getSupportedServiceNames() throw( RuntimeException ); + +extern OUString SAL_CALL ExtrusionDirectionControl_getImplementationName(); +extern Reference< XInterface > SAL_CALL ExtrusionDirectionControl_createInstance(const Reference< XMultiServiceFactory > &) throw( RuntimeException ); +extern Sequence< OUString > SAL_CALL ExtrusionDirectionControl_getSupportedServiceNames() throw( RuntimeException ); + +extern OUString SAL_CALL ExtrusionLightingControl_getImplementationName(); +extern Reference< XInterface > SAL_CALL ExtrusionLightingControl_createInstance(const Reference< XMultiServiceFactory > &) throw( RuntimeException ); +extern Sequence< OUString > SAL_CALL ExtrusionLightingControl_getSupportedServiceNames() throw( RuntimeException ); + +extern OUString SAL_CALL ExtrusionSurfaceControl_getImplementationName(); +extern Reference< XInterface > SAL_CALL ExtrusionSurfaceControl_createInstance(const Reference< XMultiServiceFactory > &) throw( RuntimeException ); +extern Sequence< OUString > SAL_CALL ExtrusionSurfaceControl_getSupportedServiceNames() throw( RuntimeException ); + +extern OUString SAL_CALL FontWorkAlignmentControl_getImplementationName(); +extern Reference< XInterface > SAL_CALL FontWorkAlignmentControl_createInstance(const Reference< XMultiServiceFactory > &) throw( RuntimeException ); +extern Sequence< OUString > SAL_CALL FontWorkAlignmentControl_getSupportedServiceNames() throw( RuntimeException ); + +extern OUString SAL_CALL FontWorkCharacterSpacingControl_getImplementationName(); +extern Reference< XInterface > SAL_CALL FontWorkCharacterSpacingControl_createInstance(const Reference< XMultiServiceFactory > &) throw( RuntimeException ); +extern Sequence< OUString > SAL_CALL FontWorkCharacterSpacingControl_getSupportedServiceNames() throw( RuntimeException ); +} + +extern "C" +{ + +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( + const sal_Char ** ppEnvTypeName, uno_Environment ** ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +static void writeInfo ( + XRegistryKey * pRegistryKey, + const OUString& rImplementationName, + const Sequence< OUString >& rServices) +{ + Reference< XRegistryKey > xNewKey( + pRegistryKey->createKey( + OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + rImplementationName + OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) ) ); + + for( sal_Int32 i = 0; i < rServices.getLength(); i++ ) + xNewKey->createKey( rServices.getConstArray()[i]); +} + +SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( + void * , void * pRegistryKey) +{ + if( pRegistryKey ) + { + try + { + XRegistryKey *pKey = reinterpret_cast< XRegistryKey * >( pRegistryKey ); + + writeInfo( pKey, ::svx::ExtrusionDepthController_getImplementationName(),::svx::ExtrusionDepthController_getSupportedServiceNames() ); + writeInfo( pKey, ::svx::ExtrusionDirectionControl_getImplementationName(),::svx::ExtrusionDirectionControl_getSupportedServiceNames() ); + writeInfo( pKey, ::svx::ExtrusionLightingControl_getImplementationName(),::svx::ExtrusionLightingControl_getSupportedServiceNames() ); + writeInfo( pKey, ::svx::ExtrusionSurfaceControl_getImplementationName(),::svx::ExtrusionSurfaceControl_getSupportedServiceNames() ); + writeInfo( pKey, ::svx::FontWorkAlignmentControl_getImplementationName(),::svx::FontWorkAlignmentControl_getSupportedServiceNames() ); + writeInfo( pKey, ::svx::FontWorkCharacterSpacingControl_getImplementationName(),::svx::FontWorkCharacterSpacingControl_getSupportedServiceNames() ); + } + catch (InvalidRegistryException &) + { + OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); + } + } + + return sal_True; +} + +SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( + const sal_Char * pImplName, void * pServiceManager, void * ) +{ + void * pRet = 0; + if( pServiceManager ) + { + Reference< XSingleServiceFactory > xFactory; + + if( ::svx::ExtrusionDepthController_getImplementationName().equalsAscii( pImplName ) ) + { + xFactory = ::cppu::createSingleFactory( + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + ::svx::ExtrusionDepthController_getImplementationName(), + ::svx::ExtrusionDepthController_createInstance, + ::svx::ExtrusionDepthController_getSupportedServiceNames() ); + } + else if( ::svx::ExtrusionDirectionControl_getImplementationName().equalsAscii( pImplName ) ) + { + xFactory = ::cppu::createSingleFactory( + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + ::svx::ExtrusionDirectionControl_getImplementationName(), + ::svx::ExtrusionDirectionControl_createInstance, + ::svx::ExtrusionDirectionControl_getSupportedServiceNames() ); + } + else if( ::svx::ExtrusionLightingControl_getImplementationName().equalsAscii( pImplName ) ) + { + xFactory = ::cppu::createSingleFactory( + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + ::svx::ExtrusionLightingControl_getImplementationName(), + ::svx::ExtrusionLightingControl_createInstance, + ::svx::ExtrusionLightingControl_getSupportedServiceNames() ); + } + else if( ::svx::ExtrusionSurfaceControl_getImplementationName().equalsAscii( pImplName ) ) + { + xFactory = ::cppu::createSingleFactory( + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + ::svx::ExtrusionSurfaceControl_getImplementationName(), + ::svx::ExtrusionSurfaceControl_createInstance, + ::svx::ExtrusionSurfaceControl_getSupportedServiceNames() ); + } + else if( ::svx::FontWorkAlignmentControl_getImplementationName().equalsAscii( pImplName ) ) + { + xFactory = ::cppu::createSingleFactory( + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + ::svx::FontWorkAlignmentControl_getImplementationName(), + ::svx::FontWorkAlignmentControl_createInstance, + ::svx::FontWorkAlignmentControl_getSupportedServiceNames() ); + } + else if( ::svx::FontWorkCharacterSpacingControl_getImplementationName().equalsAscii( pImplName ) ) + { + xFactory = ::cppu::createSingleFactory( + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + ::svx::FontWorkCharacterSpacingControl_getImplementationName(), + ::svx::FontWorkCharacterSpacingControl_createInstance, + ::svx::FontWorkCharacterSpacingControl_getSupportedServiceNames() ); + } if( xFactory.is()) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + } + + return pRet; +} + +} diff --git a/svx/source/core/makefile.mk b/svx/source/core/makefile.mk new file mode 100644 index 000000000000..da874894bae6 --- /dev/null +++ b/svx/source/core/makefile.mk @@ -0,0 +1,47 @@ +#************************************************************************* +# +# 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 +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=svx +TARGET=core +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/coreservices.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx index 7be1d857b028..2fdc95bb28fb 100644 --- a/svx/source/tbxctrls/extrusioncontrols.cxx +++ b/svx/source/tbxctrls/extrusioncontrols.cxx @@ -32,9 +32,14 @@ #include // HACK: prevent conflict between STLPORT and Workshop headers -#ifndef _TOOLBOX_HXX //autogen +#include +#include +#include +#include + +#include + #include -#endif #include #include #include @@ -42,30 +47,35 @@ #include #include #include -#include "chrtitem.hxx" #include #include -#include "helpid.hrc" - #include +#include #include +#include "svx/extrusioncolorcontrol.hxx" + +//#include "chrtitem.hxx" +#include "helpid.hrc" #include "extrusioncontrols.hxx" #include "extrusioncontrols.hrc" -#include -#include "svx/toolbarmenu.hxx" #include "colorwindow.hxx" - -#include +#include "extrusiondepthdialog.hxx" //////////// -using namespace svx; +using ::rtl::OUString; +using ::svtools::ToolbarMenu; + +using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::graphic; -SFX_IMPL_TOOLBOX_CONTROL( ExtrusionDirectionControl, SfxBoolItem ); +namespace svx +{ /************************************************************************* |* @@ -75,9 +85,9 @@ SFX_IMPL_TOOLBOX_CONTROL( ExtrusionDirectionControl, SfxBoolItem ); static sal_Int32 gSkewList[] = { 135, 90, 45, 180, 0, -360, -135, -90, -45 }; -ExtrusionDirectionWindow::ExtrusionDirectionWindow( USHORT /*nId*/, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) +ExtrusionDirectionWindow::ExtrusionDirectionWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) : ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_DIRECTION )) -, mxFrame( rFrame ) +, mrController( rController ) , maImgPerspective( SVX_RES( IMG_PERSPECTIVE ) ) , maImgPerspectiveH( SVX_RES( IMG_PERSPECTIVE_H ) ) , maImgParallel( SVX_RES( IMG_PARALLEL ) ) @@ -85,12 +95,7 @@ ExtrusionDirectionWindow::ExtrusionDirectionWindow( USHORT /*nId*/, const ::com: , msExtrusionDirection( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirection" ) ) , msExtrusionProjection( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionProjection" ) ) { - implInit(); -} - -void ExtrusionDirectionWindow::implInit() -{ - SetHelpId( HID_POPUP_EXTRUSION_DIRECTION ); + SetHelpId( HID_MENU_EXTRUSION_DIRECTION ); USHORT i; for( i = DIRECTION_NW; i <= DIRECTION_SE; i++ ) @@ -99,13 +104,8 @@ void ExtrusionDirectionWindow::implInit() maImgDirectionH[i] = Image( SVX_RES( IMG_DIRECTION_H + i ) ); } -// mpDirectionForewarder = new SfxStatusForwarder( SID_EXTRUSION_DIRECTION, *this ); -// mpProjectionForewarder = new SfxStatusForwarder( SID_EXTRUSION_PROJECTION, *this ); - -// mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); - /*mpMenu->*/SetHelpId( HID_MENU_EXTRUSION_DIRECTION ); - /*mpMenu->*/SetSelectHdl( LINK( this, ExtrusionDirectionWindow, SelectHdl ) ); - mpDirectionSet = new ValueSet( /*mpMenu->*/this, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT ); + SetSelectHdl( LINK( this, ExtrusionDirectionWindow, SelectHdl ) ); + mpDirectionSet = createEmptyValueSetControl(); mpDirectionSet->SetHelpId( HID_VALUESET_EXTRUSION_DIRECTION ); mpDirectionSet->SetSelectHdl( LINK( this, ExtrusionDirectionWindow, SelectHdl ) ); @@ -122,15 +122,11 @@ void ExtrusionDirectionWindow::implInit() mpDirectionSet->SetOutputSizePixel( Size( 72, 72 ) ); - /*mpMenu->*/appendEntry( 2, mpDirectionSet ); - /*mpMenu->appendSeparator()*/; - /*mpMenu->*/appendEntry( 0, String( SVX_RES( STR_PERSPECTIVE ) ), bHighContrast ? maImgPerspectiveH : maImgPerspective ); - /*mpMenu->*/appendEntry( 1, String( SVX_RES( STR_PARALLEL ) ), bHighContrast ? maImgParallelH : maImgParallel ); + appendEntry( 2, mpDirectionSet ); + appendEntry( 0, String( SVX_RES( STR_PERSPECTIVE ) ), bHighContrast ? maImgPerspectiveH : maImgPerspective ); + appendEntry( 1, String( SVX_RES( STR_PARALLEL ) ), bHighContrast ? maImgParallelH : maImgParallel ); - SetOutputSizePixel( /*mpMenu->*/getMenuSize() ); - //mpMenu->SetOutputSizePixel( GetOutputSizePixel() ); - - //mpMenu->Show(); + SetOutputSizePixel( getMenuSize() ); FreeResource(); @@ -146,26 +142,18 @@ void ExtrusionDirectionWindow::DataChanged( const DataChangedEvent& rDCEvt ) { bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - USHORT i; - for( i = DIRECTION_NW; i <= DIRECTION_SE; i++ ) + for( USHORT i = DIRECTION_NW; i <= DIRECTION_SE; i++ ) { mpDirectionSet->SetItemImage( i+1, bHighContrast ? maImgDirectionH[ i ] : maImgDirection[ i ] ); } - /*mpMenu->*/setEntryImage( 0, bHighContrast ? maImgPerspectiveH : maImgPerspective ); - /*mpMenu->*/setEntryImage( 1, bHighContrast ? maImgParallelH : maImgParallel ); + setEntryImage( 0, bHighContrast ? maImgPerspectiveH : maImgPerspective ); + setEntryImage( 1, bHighContrast ? maImgParallelH : maImgParallel ); } } // ----------------------------------------------------------------------- -ExtrusionDirectionWindow::~ExtrusionDirectionWindow() -{ - //delete mpMenu; -} - -// ----------------------------------------------------------------------- - void ExtrusionDirectionWindow::implSetDirection( sal_Int32 nSkew, bool bEnabled ) { if( mpDirectionSet ) @@ -186,23 +174,17 @@ void ExtrusionDirectionWindow::implSetDirection( sal_Int32 nSkew, bool bEnabled mpDirectionSet->SetNoSelection(); } } -// if( mpMenu ) - { - /*mpMenu->*/enableEntry( 2, bEnabled ); - } + enableEntry( 2, bEnabled ); } // ----------------------------------------------------------------------- void ExtrusionDirectionWindow::implSetProjection( sal_Int32 nProjection, bool bEnabled ) { -// if( mpMenu ) - { - /*mpMenu->*/checkEntry( 0, (nProjection == 0) && bEnabled ); - /*mpMenu->*/checkEntry( 1, (nProjection == 1 ) && bEnabled ); - /*mpMenu->*/enableEntry( 0, bEnabled ); - /*mpMenu->*/enableEntry( 1, bEnabled ); - } + checkEntry( 0, (nProjection == 0) && bEnabled ); + checkEntry( 1, (nProjection == 1 ) && bEnabled ); + enableEntry( 0, bEnabled ); + enableEntry( 1, bEnabled ); } // ----------------------------------------------------------------------- @@ -244,48 +226,24 @@ IMPL_LINK( ExtrusionDirectionWindow, SelectHdl, void *, pControl ) if ( IsInPopupMode() ) EndPopupMode(); -// SfxDispatcher* pDisp = GetBindings().GetDispatcher(); - if( pControl == mpDirectionSet ) { - sal_Int32 nSkew = gSkewList[mpDirectionSet->GetSelectItemId()-1]; - - SfxInt32Item aItem( SID_EXTRUSION_DIRECTION, nSkew ); - rtl::OUString aCommand( msExtrusionDirection ); - - Any a; - INetURLObject aObj( aCommand ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aItem.QueryValue( a ); - aArgs[0].Value = a; - - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + aArgs[0].Name = msExtrusionDirection.copy(5); + aArgs[0].Value <<= (sal_Int32)gSkewList[mpDirectionSet->GetSelectItemId()-1]; -// pDisp->Execute( SID_EXTRUSION_DIRECTION, SFX_CALLMODE_RECORD, &aItem, 0L , 0L ); + mrController.dispatchCommand( msExtrusionDirection, aArgs ); } else { - int nProjection = /*mpMenu->*/getSelectedEntryId(); + int nProjection = getSelectedEntryId(); if( (nProjection >= 0) && (nProjection < 2 ) ) { - SfxInt32Item aItem( SID_EXTRUSION_PROJECTION, nProjection ); - rtl::OUString aCommand( msExtrusionProjection ); - - Any a; - INetURLObject aObj( aCommand ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aItem.QueryValue( a ); - aArgs[0].Value = a; - - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + aArgs[0].Name = msExtrusionProjection.copy(5); + aArgs[0].Value <<= (sal_Int32)nProjection; + + mrController.dispatchCommand( msExtrusionProjection, aArgs ); implSetProjection( nProjection, true ); } } @@ -293,78 +251,61 @@ IMPL_LINK( ExtrusionDirectionWindow, SelectHdl, void *, pControl ) return 0; } -// ----------------------------------------------------------------------- +/************************************************************************* +|* +|* SvxLineEndToolBoxControl +|* +\************************************************************************/ -void ExtrusionDirectionWindow::FillValueSet() +ExtrusionDirectionControl::ExtrusionDirectionControl( const Reference< lang::XMultiServiceFactory >& rServiceManager ) +: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirectionFloater" ) ) ) { } // ----------------------------------------------------------------------- -void ExtrusionDirectionWindow::StartSelection() +::Window* ExtrusionDirectionControl::createPopupWindow( ::Window* pParent ) { - mpDirectionSet->StartSelection(); + return new ExtrusionDirectionWindow( *this, m_xFrame, pParent ); } +// ----------------------------------------------------------------------- +// XServiceInfo // ----------------------------------------------------------------------- -void ExtrusionDirectionWindow::GetFocus (void) -{ - ToolbarMenu::GetFocus(); - // Grab the focus to the line ends value set so that it can be controlled - // with the keyboard. - if( mpDirectionSet ) - mpDirectionSet->GrabFocus(); -} - -/************************************************************************* -|* -|* SvxLineEndToolBoxControl -|* -\************************************************************************/ - -ExtrusionDirectionControl::ExtrusionDirectionControl( - USHORT nSlotId, USHORT nId, ToolBox &rTbx ) -: SfxToolBoxControl( nSlotId, nId, rTbx ) +OUString SAL_CALL ExtrusionDirectionControl_getImplementationName() { - rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); + return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionDirectionController" )); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -ExtrusionDirectionControl::~ExtrusionDirectionControl() +Sequence< OUString > SAL_CALL ExtrusionDirectionControl_getSupportedServiceNames() throw( RuntimeException ) { + Sequence< OUString > aSNS( 1 ); + aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); + return aSNS; } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindowType ExtrusionDirectionControl::GetPopupWindowType() const +Reference< XInterface > SAL_CALL SAL_CALL ExtrusionDirectionControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) { - return SFX_POPUPWINDOW_ONCLICK; + return *new ExtrusionDirectionControl( rSMgr ); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindow* ExtrusionDirectionControl::CreatePopupWindow() +OUString SAL_CALL ExtrusionDirectionControl::getImplementationName( ) throw (RuntimeException) { - ExtrusionDirectionWindow* pWin = new ExtrusionDirectionWindow( GetId(), m_xFrame, &GetToolBox() ); - StartPopupMode( pWin ); -// pWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_ALLOWTEAROFF ); - pWin->StartSelection(); - // SetPopupWindow( pWin ); -// return pWin; - return 0; + return ExtrusionDirectionControl_getImplementationName(); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -void ExtrusionDirectionControl::StateChanged( USHORT, SfxItemState eState, const SfxPoolItem* ) +Sequence< OUString > SAL_CALL ExtrusionDirectionControl::getSupportedServiceNames( ) throw (RuntimeException) { - USHORT nId = GetId(); - ToolBox& rTbx = GetToolBox(); - - rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); - rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); + return ExtrusionDirectionControl_getSupportedServiceNames(); } // #################################################################### @@ -396,127 +337,151 @@ double ExtrusionDepthDialog::getDepth() const // #################################################################### -SFX_IMPL_TOOLBOX_CONTROL( ExtrusionDepthControl, SfxBoolItem ); - -ExtrusionDepthWindow::ExtrusionDepthWindow( USHORT /*nId*/, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ) : - ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_DEPTH )), - maImgDepth0( SVX_RES( IMG_DEPTH_0 ) ), - maImgDepth1( SVX_RES( IMG_DEPTH_1 ) ), - maImgDepth2( SVX_RES( IMG_DEPTH_2 ) ), - maImgDepth3( SVX_RES( IMG_DEPTH_3 ) ), - maImgDepth4( SVX_RES( IMG_DEPTH_4 ) ), - maImgDepthInfinity( SVX_RES( IMG_DEPTH_INFINITY ) ), - maImgDepth0h( SVX_RES( IMG_DEPTH_0_H ) ), - maImgDepth1h( SVX_RES( IMG_DEPTH_1_H ) ), - maImgDepth2h( SVX_RES( IMG_DEPTH_2_H ) ), - maImgDepth3h( SVX_RES( IMG_DEPTH_3_H ) ), - maImgDepth4h( SVX_RES( IMG_DEPTH_4_H ) ), - maImgDepthInfinityh( SVX_RES( IMG_DEPTH_INFINITY_H ) ), - mxFrame( rFrame ), - mfDepth( -1.0 ), - mbEnabled( false ), - msExtrusionDepth( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepth" ) ), - msMetricUnit( RTL_CONSTASCII_USTRINGPARAM( ".uno:MetricUnit" ) ) +double aDepthListInch[] = { 0, 1270,2540,5080,10160 }; +double aDepthListMM[] = { 0, 1000, 2500, 5000, 10000 }; + +ExtrusionDepthController::ExtrusionDepthController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) +: svt::PopupMenuControllerBase( xServiceManager ) +, mfDepth( -1.0 ) +, msExtrusionDepth( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepth" ) ) +, msMetricUnit( RTL_CONSTASCII_USTRINGPARAM( ".uno:MetricUnit" ) ) { - implInit(); + for( int i = 0; i < 5; i++ ) + { + maImgDepth[i] = Image( SVX_RES( RID_SVXIMG_EXTRUSION_DEPTH_0 + i ) ); + maImgDepth_hc[i] = Image( SVX_RES( RID_SVXIMG_EXTRUSION_DEPTH_0_H + i ) ); + } + + maImgDepthInfinity = Image( SVX_RES( RID_SVXIMG_EXTRUSION_DEPTH_INFINITY ) ); + maImgDepthInfinityh = Image( SVX_RES( RID_SVXIMG_EXTRUSION_DEPTH_INFINITY_H ) ); } -void ExtrusionDepthWindow::implInit() +// XPopupMenuController +void SAL_CALL ExtrusionDepthController::updatePopupMenu() throw (RuntimeException) { - SetHelpId( HID_POPUP_EXTRUSION_DEPTH ); + const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); + bool bShowImages( rSettings.GetUseImagesInMenus() ); + bool bHiContrast( rSettings.GetHighContrastMode() ); -// mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); - /*mpMenu->*/SetHelpId( HID_MENU_EXTRUSION_DEPTH ); + updateCommand( msExtrusionDepth ); + updateCommand( msMetricUnit ); - /*mpMenu->*/SetSelectHdl( LINK( this, ExtrusionDepthWindow, SelectHdl ) ); + Reference< awt::XPopupMenuExtended > xPopupMenu( m_xPopupMenu, UNO_QUERY ); + if( xPopupMenu.is() ) + { + // clear existing entries + if( m_xPopupMenu->getItemCount() ) + m_xPopupMenu->removeItem( 0, m_xPopupMenu->getItemCount() ); - bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); + USHORT nResource = IsMetric( meUnit ) ? RID_SVXSTR_DEPTH_0 : RID_SVXSTR_DEPTH_0_INCH; - String aEmpty; - /*mpMenu->*/appendEntry( 0, aEmpty, bHighContrast ? maImgDepth0h : maImgDepth0 ); - /*mpMenu->*/appendEntry( 1, aEmpty, bHighContrast ? maImgDepth1h : maImgDepth1 ); - /*mpMenu->*/appendEntry( 2, aEmpty, bHighContrast ? maImgDepth2h : maImgDepth2 ); - /*mpMenu->*/appendEntry( 3, aEmpty, bHighContrast ? maImgDepth3h : maImgDepth3 ); - /*mpMenu->*/appendEntry( 4, aEmpty, bHighContrast ? maImgDepth4h : maImgDepth4 ); - /*mpMenu->*/appendEntry( 5, String( SVX_RES( STR_INFINITY ) ), bHighContrast ? maImgDepthInfinityh : maImgDepthInfinity ); - /*mpMenu->*/appendEntry( 6, String( SVX_RES( STR_CUSTOM ) ) ); + Reference< XGraphic > xGraphic; - SetOutputSizePixel( /*mpMenu->*/getMenuSize() ); -// mpMenu->SetOutputSizePixel( GetOutputSizePixel() ); + for( int i = 0; i < 5; i++ ) + { + OUString aStr( String( SVX_RES( nResource + i ) ) ); + m_xPopupMenu->insertItem( i+1, aStr, awt::MenuItemStyle::CHECKABLE, i+1 ); + if( bShowImages ) + { + if( bHiContrast ) + xGraphic = maImgDepth_hc[i].GetXGraphic(); + else + xGraphic = maImgDepth[i].GetXGraphic(); + } + xPopupMenu->setItemImage( i+1, xGraphic, sal_False ); -// mpMenu->Show(); + xPopupMenu->checkItem( i+1, (mfDepth == (IsMetric( meUnit ) ? aDepthListMM[i] : aDepthListInch[i])) ? TRUE : FALSE ); + } - FreeResource(); + if( bShowImages ) + { + if( bHiContrast ) + xGraphic = maImgDepthInfinityh.GetXGraphic(); + else + xGraphic = maImgDepthInfinity.GetXGraphic(); + } + m_xPopupMenu->insertItem( 6, OUString( String( SVX_RES( RID_SVXSTR_EXTRUSION_INFINITY ) ) ), awt::MenuItemStyle::CHECKABLE, 6 ); + xPopupMenu->setItemImage( 6, xGraphic, sal_False ); + xPopupMenu->checkItem( 6, (mfDepth >= 338666) ? TRUE : FALSE ); - AddStatusListener( msExtrusionDepth ); - AddStatusListener( msMetricUnit ); + m_xPopupMenu->insertItem( 7, OUString( String( SVX_RES( RID_SVXSTR_EXTRUSION_CUSTOM ) ) ), awt::MenuItemStyle::CHECKABLE, 7 ); + } } // ----------------------------------------------------------------------- -ExtrusionDepthWindow::~ExtrusionDepthWindow() +ExtrusionDepthController::~ExtrusionDepthController() { -// delete mpMenu; } +// ----------------------------------------------------------------------- +// XEventListener // ----------------------------------------------------------------------- -double aDepthListInch[] = { 0, 1270,2540,5080,10160 }; -double aDepthListMM[] = { 0, 1000, 2500, 5000, 10000 }; - -void ExtrusionDepthWindow::implSetDepth( double fDepth, bool bEnabled ) +void SAL_CALL ExtrusionDepthController::disposing( const EventObject& ) throw ( RuntimeException ) { - mbEnabled = bEnabled; - mfDepth = fDepth; -// if( mpMenu ) - { - int i; - for( i = 0; i < 7; i++ ) - { - if( i == 5 ) - { - /*mpMenu->*/checkEntry( i, (fDepth >= 338666) && bEnabled ); - } - else if( i != 6 ) - { - /*mpMenu->*/checkEntry( i, (fDepth == (IsMetric( meUnit ) ? aDepthListMM[i] : aDepthListInch[i]) && bEnabled ) ); - } - /*mpMenu->*/enableEntry( i, bEnabled ); - } - } + Reference< awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); + + osl::MutexGuard aLock( m_aMutex ); + m_xFrame.clear(); + m_xDispatch.clear(); + m_xServiceManager.clear(); + + if ( m_xPopupMenu.is() ) + m_xPopupMenu->removeMenuListener( Reference< awt::XMenuListener >(( OWeakObject *)this, UNO_QUERY )); + m_xPopupMenu.clear(); } +// ----------------------------------------------------------------------- +// XServiceInfo // ----------------------------------------------------------------------- -void ExtrusionDepthWindow::implFillStrings( FieldUnit eUnit ) +OUString SAL_CALL ExtrusionDepthController_getImplementationName() { - meUnit = eUnit; - USHORT nResource = IsMetric( eUnit ) ? RID_SVXSTR_DEPTH_0 : RID_SVXSTR_DEPTH_0_INCH; + return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionDepthController" )); +} - for( int i = 0; i < 5; i++ ) - { - String aStr( SVX_RES( nResource + i ) ); - /*mpMenu->*/setEntryText( i, aStr ); - }; +// -------------------------------------------------------------------- + +Sequence< OUString > SAL_CALL ExtrusionDepthController_getSupportedServiceNames() throw( RuntimeException ) +{ + Sequence< OUString > aSNS( 1 ); + aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.PopupMenuController" )); + return aSNS; +} + +// -------------------------------------------------------------------- + +Reference< XInterface > SAL_CALL SAL_CALL ExtrusionDepthController_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) +{ + return *new ExtrusionDepthController( rSMgr ); +} + +// -------------------------------------------------------------------- + +OUString SAL_CALL ExtrusionDepthController::getImplementationName( ) throw (RuntimeException) +{ + return ExtrusionDepthController_getImplementationName(); +} + +// -------------------------------------------------------------------- + +Sequence< OUString > SAL_CALL ExtrusionDepthController::getSupportedServiceNames( ) throw (RuntimeException) +{ + return ExtrusionDepthController_getSupportedServiceNames(); } +// ----------------------------------------------------------------------- +// XStatusListener // ----------------------------------------------------------------------- -void SAL_CALL ExtrusionDepthWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) +void SAL_CALL ExtrusionDepthController::statusChanged( const frame::FeatureStateEvent& Event ) throw ( RuntimeException ) { if( Event.FeatureURL.Main.equals( msExtrusionDepth ) ) { - if( !Event.IsEnabled ) - { - implSetDepth( 0, false ); - } - else + if( Event.IsEnabled ) { - double fValue = 0.0; - if( Event.State >>= fValue ) - implSetDepth( fValue, true ); + Event.State >>= mfDepth; } } else if( Event.FeatureURL.Main.equals( msMetricUnit ) ) @@ -525,199 +490,91 @@ void SAL_CALL ExtrusionDepthWindow::statusChanged( const ::com::sun::star::frame { sal_Int32 nValue = 0; if( Event.State >>= nValue ) - { - implFillStrings( static_cast(nValue) ); - if( mfDepth >= 0.0 ) - implSetDepth( mfDepth, mbEnabled ); - } + meUnit = (FieldUnit)nValue; } } } // ----------------------------------------------------------------------- - -void ExtrusionDepthWindow::DataChanged( const DataChangedEvent& rDCEvt ) -{ - ToolbarMenu::DataChanged( rDCEvt ); - - if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) - { - bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - - /*mpMenu->*/setEntryImage( 0, bHighContrast ? maImgDepth0h : maImgDepth0 ); - /*mpMenu->*/setEntryImage( 1, bHighContrast ? maImgDepth1h : maImgDepth1 ); - /*mpMenu->*/setEntryImage( 2, bHighContrast ? maImgDepth2h : maImgDepth2 ); - /*mpMenu->*/setEntryImage( 3, bHighContrast ? maImgDepth3h : maImgDepth3 ); - /*mpMenu->*/setEntryImage( 4, bHighContrast ? maImgDepth4h : maImgDepth4 ); - /*mpMenu->*/setEntryImage( 5, bHighContrast ? maImgDepthInfinityh : maImgDepthInfinity ); - } -} - - +// XMenuListener // ----------------------------------------------------------------------- -IMPL_LINK( ExtrusionDepthWindow, SelectHdl, void *, EMPTYARG ) +void SAL_CALL ExtrusionDepthController::select( const awt::MenuEvent& rEvent ) throw (RuntimeException) { -// SfxDispatcher* pDisp = GetBindings().GetDispatcher(); - - int nSelected = /*mpMenu->*/getSelectedEntryId(); - if( nSelected != -1 ) + if( rEvent.MenuId ) { - if( nSelected == 6 ) + if( rEvent.MenuId == 7 ) { - if ( IsInPopupMode() ) - EndPopupMode(); + const rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepthDialog" )); - SvxDoubleItem aDepthItem( mfDepth, SID_EXTRUSION_DEPTH ); - SfxUInt16Item aMetricItem( - SID_ATTR_METRIC, sal::static_int_cast< UINT16 >( meUnit ) ); - rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepthDialog" )); - - Any a; Sequence< PropertyValue > aArgs( 2 ); aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Depth" )); - aDepthItem.QueryValue( a ); - aArgs[0].Value = a; + aArgs[0].Value <<= mfDepth; aArgs[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" )); - aMetricItem.QueryValue( a ); - aArgs[1].Value = a; + aArgs[1].Value <<= (sal_Int32)meUnit; - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + dispatchCommand( aCommand, aArgs ); } else { double fDepth; - if( nSelected == 5 ) + if( rEvent.MenuId == 6 ) { fDepth = 338666.6; } else { - fDepth = IsMetric( meUnit ) ? aDepthListMM[nSelected] : aDepthListInch[nSelected]; + fDepth = IsMetric( meUnit ) ? aDepthListMM[rEvent.MenuId-1] : aDepthListInch[rEvent.MenuId-1]; } - SvxDoubleItem aItem( fDepth, SID_EXTRUSION_DEPTH ); - rtl::OUString aCommand( msExtrusionDepth ); - - Any a; - INetURLObject aObj( aCommand ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aItem.QueryValue( a ); - aArgs[0].Value = a; - - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); - implSetDepth( fDepth, true ); - - if ( IsInPopupMode() ) - EndPopupMode(); + aArgs[0].Name = msExtrusionDepth.copy(5); + aArgs[0].Value <<= fDepth; + + dispatchCommand( msExtrusionDepth, aArgs ); } } - return 0; } // ----------------------------------------------------------------------- - -void ExtrusionDepthWindow::StartSelection() -{ -} - +// XInitialization // ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- - -void ExtrusionDepthWindow::GetFocus (void) +void SAL_CALL ExtrusionDepthController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException ) { - ToolbarMenu::GetFocus(); - // Grab the focus to the line ends value set so that it can be controlled - // with the keyboard. - //if( mpMenu ) - /*mpMenu->*/GrabFocus(); -} - -// ======================================================================== - -ExtrusionDepthControl::ExtrusionDepthControl( - USHORT nSlotId, USHORT nId, ToolBox &rTbx ) -: SfxToolBoxControl( nSlotId, nId, rTbx ) -{ - rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); -} - -// ----------------------------------------------------------------------- - -ExtrusionDepthControl::~ExtrusionDepthControl() -{ -} - -// ----------------------------------------------------------------------- - -SfxPopupWindowType ExtrusionDepthControl::GetPopupWindowType() const -{ - return SFX_POPUPWINDOW_ONCLICK; -} + osl::MutexGuard aLock( m_aMutex ); -// ----------------------------------------------------------------------- - -SfxPopupWindow* ExtrusionDepthControl::CreatePopupWindow() -{ - ExtrusionDepthWindow* pWin = new ExtrusionDepthWindow( GetId(), m_xFrame, &GetToolBox() ); - StartPopupMode( pWin ); - return 0; + sal_Bool bInitalized( m_bInitialized ); + if ( !bInitalized ) + { + svt::PopupMenuControllerBase::initialize( aArguments ); + m_aBaseURL = ::rtl::OUString(); + } } - // ----------------------------------------------------------------------- -void ExtrusionDepthControl::StateChanged( USHORT, SfxItemState eState, const SfxPoolItem* ) -{ - USHORT nId = GetId(); - ToolBox& rTbx = GetToolBox(); - - rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); - rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); -} // #################################################################### -SFX_IMPL_TOOLBOX_CONTROL( ExtrusionLightingControl, SfxBoolItem ); - // ------------------------------------------------------------------------- -ExtrusionLightingWindow::ExtrusionLightingWindow( - USHORT /*nId*/, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ) : - ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_LIGHTING ) ), - maImgBright( SVX_RES( IMG_LIGHTING_BRIGHT ) ), - maImgNormal( SVX_RES( IMG_LIGHTING_NORMAL ) ), - maImgDim( SVX_RES( IMG_LIGHTING_DIM ) ), - maImgBrighth( SVX_RES( IMG_LIGHTING_BRIGHT_H ) ), - maImgNormalh( SVX_RES( IMG_LIGHTING_NORMAL_H ) ), - maImgDimh( SVX_RES( IMG_LIGHTING_DIM_H ) ), - mxFrame( rFrame ), - mnLevel( 0 ), - mbLevelEnabled( false ), - mnDirection( FROM_FRONT ), - mbDirectionEnabled( false ), - msExtrusionLightingDirection( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingDirection" )), - msExtrusionLightingIntensity( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingIntensity" )) -{ - implInit(); -} - -// ----------------------------------------------------------------------- - -void ExtrusionLightingWindow::implInit() +ExtrusionLightingWindow::ExtrusionLightingWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) +: ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_LIGHTING )) +, mrController( rController ) +, maImgBright( SVX_RES( IMG_LIGHTING_BRIGHT ) ) +, maImgNormal( SVX_RES( IMG_LIGHTING_NORMAL ) ) +, maImgDim( SVX_RES( IMG_LIGHTING_DIM ) ) +, maImgBrighth( SVX_RES( IMG_LIGHTING_BRIGHT_H ) ) +, maImgNormalh( SVX_RES( IMG_LIGHTING_NORMAL_H ) ) +, maImgDimh( SVX_RES( IMG_LIGHTING_DIM_H ) ) +, mnLevel( 0 ) +, mbLevelEnabled( false ) +, mnDirection( FROM_FRONT ) +, mbDirectionEnabled( false ) +, msExtrusionLightingDirection( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingDirection" )) +, msExtrusionLightingIntensity( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingIntensity" )) { - SetHelpId( HID_POPUP_EXTRUSION_LIGHTING ); - USHORT i; for( i = FROM_TOP_LEFT; i <= FROM_BOTTOM_RIGHT; i++ ) { @@ -732,11 +589,10 @@ void ExtrusionLightingWindow::implInit() maImgLightingPreviewh[i] = Image( SVX_RES( IMG_LIGHT_PREVIEW_H + i ) ); } -// mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); - /*mpMenu->*/SetHelpId( HID_MENU_EXTRUSION_LIGHTING ); - /*mpMenu->*/SetSelectHdl( LINK( this, ExtrusionLightingWindow, SelectHdl ) ); + SetHelpId( HID_MENU_EXTRUSION_LIGHTING ); + SetSelectHdl( LINK( this, ExtrusionLightingWindow, SelectHdl ) ); - mpLightingSet = new ValueSet( /*mpMenu->*/this, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT ); + mpLightingSet = createEmptyValueSetControl(); mpLightingSet->SetHelpId( HID_VALUESET_EXTRUSION_LIGHTING ); mpLightingSet->SetSelectHdl( LINK( this, ExtrusionLightingWindow, SelectHdl ) ); @@ -758,16 +614,12 @@ void ExtrusionLightingWindow::implInit() } mpLightingSet->SetOutputSizePixel( Size( 72, 72 ) ); - /*mpMenu->*/appendEntry( 3, mpLightingSet ); - /*mpMenu->appendSeparator();*/ - /*mpMenu->*/appendEntry( 0, String( SVX_RES( STR_BRIGHT ) ), bHighContrast ? maImgBrighth : maImgBright ); - /*mpMenu->*/appendEntry( 1, String( SVX_RES( STR_NORMAL ) ), bHighContrast ? maImgNormalh : maImgNormal ); - /*mpMenu->*/appendEntry( 2, String( SVX_RES( STR_DIM ) ), bHighContrast ? maImgDimh : maImgDim ); - - SetOutputSizePixel( /*mpMenu->*/getMenuSize() ); - //mpMenu->SetOutputSizePixel( GetOutputSizePixel() ); + appendEntry( 3, mpLightingSet ); + appendEntry( 0, String( SVX_RES( STR_BRIGHT ) ), bHighContrast ? maImgBrighth : maImgBright ); + appendEntry( 1, String( SVX_RES( STR_NORMAL ) ), bHighContrast ? maImgNormalh : maImgNormal ); + appendEntry( 2, String( SVX_RES( STR_DIM ) ), bHighContrast ? maImgDimh : maImgDim ); - //mpMenu->Show(); + SetOutputSizePixel( getMenuSize() ); FreeResource(); @@ -777,13 +629,6 @@ void ExtrusionLightingWindow::implInit() // ----------------------------------------------------------------------- -ExtrusionLightingWindow::~ExtrusionLightingWindow() -{ - //delete mpMenu; -} - -// ----------------------------------------------------------------------- - void ExtrusionLightingWindow::implSetIntensity( int nLevel, bool bEnabled ) { mnLevel = nLevel; @@ -791,8 +636,8 @@ void ExtrusionLightingWindow::implSetIntensity( int nLevel, bool bEnabled ) int i = 0; for( i = 0; i < 3; i++ ) { - /*mpMenu->*/checkEntry( i, (i == nLevel) && bEnabled ); - /*mpMenu->*/enableEntry( i, bEnabled ); + checkEntry( i, (i == nLevel) && bEnabled ); + enableEntry( i, bEnabled ); } } @@ -828,7 +673,7 @@ void ExtrusionLightingWindow::implSetDirection( int nDirection, bool bEnabled ) } } - /*mpMenu->*/enableEntry( 3, bEnabled ); + enableEntry( 3, bEnabled ); } // ----------------------------------------------------------------------- @@ -874,9 +719,9 @@ void ExtrusionLightingWindow::DataChanged( const DataChangedEvent& rDCEvt ) bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); implSetDirection( mnDirection, mbDirectionEnabled ); - /*mpMenu->*/setEntryImage( 0, bHighContrast ? maImgBrighth : maImgBright ); - /*mpMenu->*/setEntryImage( 1, bHighContrast ? maImgNormalh : maImgNormal ); - /*mpMenu->*/setEntryImage( 2, bHighContrast ? maImgDimh : maImgDim ); + setEntryImage( 0, bHighContrast ? maImgBrighth : maImgBright ); + setEntryImage( 1, bHighContrast ? maImgNormalh : maImgNormal ); + setEntryImage( 2, bHighContrast ? maImgDimh : maImgDim ); } } @@ -887,29 +732,18 @@ IMPL_LINK( ExtrusionLightingWindow, SelectHdl, void *, pControl ) if ( IsInPopupMode() ) EndPopupMode(); -// SfxDispatcher* pDisp = GetBindings().GetDispatcher(); - - if( pControl == /*mpMenu->*/this ) + if( pControl == this ) { - int nLevel = /*mpMenu->*/getSelectedEntryId(); + int nLevel = getSelectedEntryId(); if( nLevel >= 0 ) { if( nLevel != 3 ) { - SfxInt32Item aItem( SID_EXTRUSION_LIGHTING_INTENSITY, nLevel ); - rtl::OUString aCommand( msExtrusionLightingIntensity ); - - Any a; - INetURLObject aObj( aCommand ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aItem.QueryValue( a ); - aArgs[0].Value = a; + aArgs[0].Name = msExtrusionLightingIntensity.copy(5); + aArgs[0].Value <<= (sal_Int32)nLevel; - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + mrController.dispatchCommand( msExtrusionLightingIntensity, aArgs ); implSetIntensity( nLevel, true ); } @@ -923,20 +757,11 @@ IMPL_LINK( ExtrusionLightingWindow, SelectHdl, void *, pControl ) { nDirection--; - SfxInt32Item aItem( SID_EXTRUSION_LIGHTING_DIRECTION, nDirection ); - rtl::OUString aCommand( msExtrusionLightingDirection ); - - Any a; - INetURLObject aObj( aCommand ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aItem.QueryValue( a ); - aArgs[0].Value = a; + aArgs[0].Name = msExtrusionLightingDirection.copy(5); + aArgs[0].Value <<= (sal_Int32)nDirection; - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + mrController.dispatchCommand( msExtrusionLightingDirection, aArgs ); implSetDirection( nDirection, true ); } @@ -946,110 +771,85 @@ IMPL_LINK( ExtrusionLightingWindow, SelectHdl, void *, pControl ) return 0; } -// ----------------------------------------------------------------------- +// ======================================================================== -void ExtrusionLightingWindow::StartSelection() +ExtrusionLightingControl::ExtrusionLightingControl( const Reference< lang::XMultiServiceFactory >& rServiceManager ) +: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirectionFloater" ) ) ) { } // ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- - -void ExtrusionLightingWindow::GetFocus (void) +::Window* ExtrusionLightingControl::createPopupWindow( ::Window* pParent ) { - ToolbarMenu::GetFocus(); - // Grab the focus to the line ends value set so that it can be controlled - // with the keyboard. -// if( mpMenu ) - /*mpMenu->*/GrabFocus(); -} - -// ======================================================================== - -ExtrusionLightingControl::ExtrusionLightingControl( USHORT nSlotId, USHORT nId, ToolBox &rTbx ) -: SfxToolBoxControl( nSlotId, nId, rTbx ) -{ - rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); + return new ExtrusionLightingWindow( *this, m_xFrame, pParent ); } +// ----------------------------------------------------------------------- +// XServiceInfo // ----------------------------------------------------------------------- -ExtrusionLightingControl::~ExtrusionLightingControl() +OUString SAL_CALL ExtrusionLightingControl_getImplementationName() { + return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionLightingController" )); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindowType ExtrusionLightingControl::GetPopupWindowType() const +Sequence< OUString > SAL_CALL ExtrusionLightingControl_getSupportedServiceNames() throw( RuntimeException ) { - return SFX_POPUPWINDOW_ONCLICK; + Sequence< OUString > aSNS( 1 ); + aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); + return aSNS; } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindow* ExtrusionLightingControl::CreatePopupWindow() +Reference< XInterface > SAL_CALL SAL_CALL ExtrusionLightingControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) { - ExtrusionLightingWindow* pWin = new ExtrusionLightingWindow( GetId(), m_xFrame, &GetToolBox() ); - StartPopupMode( pWin ); - return 0; + return *new ExtrusionLightingControl( rSMgr ); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -void ExtrusionLightingControl::StateChanged( USHORT, SfxItemState eState, const SfxPoolItem* ) +OUString SAL_CALL ExtrusionLightingControl::getImplementationName( ) throw (RuntimeException) { - USHORT nId = GetId(); - ToolBox& rTbx = GetToolBox(); - - rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); - rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); + return ExtrusionLightingControl_getImplementationName(); } -// #################################################################### +// -------------------------------------------------------------------- -SFX_IMPL_TOOLBOX_CONTROL( ExtrusionSurfaceControl, SfxBoolItem ); - -ExtrusionSurfaceWindow::ExtrusionSurfaceWindow( - USHORT /*nId*/, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ) : - ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_SURFACE )), - maImgSurface1( SVX_RES( IMG_WIRE_FRAME ) ), - maImgSurface2( SVX_RES( IMG_MATTE ) ), - maImgSurface3( SVX_RES( IMG_PLASTIC ) ), - maImgSurface4( SVX_RES( IMG_METAL ) ), - maImgSurface1h( SVX_RES( IMG_WIRE_FRAME_H ) ), - maImgSurface2h( SVX_RES( IMG_MATTE_H ) ), - maImgSurface3h( SVX_RES( IMG_PLASTIC_H ) ), - maImgSurface4h( SVX_RES( IMG_METAL_H ) ), - mxFrame( rFrame ), - msExtrusionSurface( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionSurface" )) +Sequence< OUString > SAL_CALL ExtrusionLightingControl::getSupportedServiceNames( ) throw (RuntimeException) { - implInit(); + return ExtrusionLightingControl_getSupportedServiceNames(); } -// ----------------------------------------------------------------------- +// #################################################################### -void ExtrusionSurfaceWindow::implInit() +ExtrusionSurfaceWindow::ExtrusionSurfaceWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) +: ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_SURFACE )) +, mrController( rController ) +, maImgSurface1( SVX_RES( IMG_WIRE_FRAME ) ) +, maImgSurface2( SVX_RES( IMG_MATTE ) ) +, maImgSurface3( SVX_RES( IMG_PLASTIC ) ) +, maImgSurface4( SVX_RES( IMG_METAL ) ) +, maImgSurface1h( SVX_RES( IMG_WIRE_FRAME_H ) ) +, maImgSurface2h( SVX_RES( IMG_MATTE_H ) ) +, maImgSurface3h( SVX_RES( IMG_PLASTIC_H ) ) +, maImgSurface4h( SVX_RES( IMG_METAL_H ) ) +, msExtrusionSurface( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionSurface" )) { - SetHelpId( HID_POPUP_EXTRUSION_SURFACE ); - bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); -// mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); - /*mpMenu->*/SetHelpId( HID_MENU_EXTRUSION_SURFACE ); - /*mpMenu->*/SetSelectHdl( LINK( this, ExtrusionSurfaceWindow, SelectHdl ) ); - - /*mpMenu->*/appendEntry( 0, String( SVX_RES( STR_WIREFRAME ) ), bHighContrast ? maImgSurface1h : maImgSurface1 ); - /*mpMenu->*/appendEntry( 1, String( SVX_RES( STR_MATTE ) ), bHighContrast ? maImgSurface2h : maImgSurface2 ); - /*mpMenu->*/appendEntry( 2, String( SVX_RES( STR_PLASTIC ) ), bHighContrast ? maImgSurface3h : maImgSurface3 ); - /*mpMenu->*/appendEntry( 3, String( SVX_RES( STR_METAL ) ), bHighContrast ? maImgSurface4h : maImgSurface4 ); + SetHelpId( HID_MENU_EXTRUSION_SURFACE ); + SetSelectHdl( LINK( this, ExtrusionSurfaceWindow, SelectHdl ) ); - SetOutputSizePixel( /*mpMenu->*/getMenuSize() ); - //mpMenu->SetOutputSizePixel( GetOutputSizePixel() ); + appendEntry( 0, String( SVX_RES( STR_WIREFRAME ) ), bHighContrast ? maImgSurface1h : maImgSurface1 ); + appendEntry( 1, String( SVX_RES( STR_MATTE ) ), bHighContrast ? maImgSurface2h : maImgSurface2 ); + appendEntry( 2, String( SVX_RES( STR_PLASTIC ) ), bHighContrast ? maImgSurface3h : maImgSurface3 ); + appendEntry( 3, String( SVX_RES( STR_METAL ) ), bHighContrast ? maImgSurface4h : maImgSurface4 ); - //mpMenu->Show(); + SetOutputSizePixel( getMenuSize() ); FreeResource(); @@ -1058,13 +858,6 @@ void ExtrusionSurfaceWindow::implInit() // ----------------------------------------------------------------------- -ExtrusionSurfaceWindow::~ExtrusionSurfaceWindow() -{ -// delete mpMenu; -} - -// ----------------------------------------------------------------------- - void ExtrusionSurfaceWindow::implSetSurface( int nSurface, bool bEnabled ) { // if( mpMenu ) @@ -1072,8 +865,8 @@ void ExtrusionSurfaceWindow::implSetSurface( int nSurface, bool bEnabled ) int i; for( i = 0; i < 4; i++ ) { - /*mpMenu->*/checkEntry( i, (i == nSurface) && bEnabled ); - /*mpMenu->*/enableEntry( i, bEnabled ); + checkEntry( i, (i == nSurface) && bEnabled ); + enableEntry( i, bEnabled ); } } } @@ -1099,47 +892,19 @@ void SAL_CALL ExtrusionSurfaceWindow::statusChanged( const ::com::sun::star::fra // ----------------------------------------------------------------------- -void ExtrusionSurfaceWindow::DataChanged( const DataChangedEvent& rDCEvt ) -{ - ToolbarMenu::DataChanged( rDCEvt ); - - if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) - { - bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - - /*mpMenu->*/appendEntry( 0, String( SVX_RES( STR_WIREFRAME ) ), bHighContrast ? maImgSurface1h : maImgSurface1 ); - /*mpMenu->*/appendEntry( 1, String( SVX_RES( STR_MATTE ) ), bHighContrast ? maImgSurface2h : maImgSurface2 ); - /*mpMenu->*/appendEntry( 2, String( SVX_RES( STR_PLASTIC ) ), bHighContrast ? maImgSurface3h : maImgSurface3 ); - /*mpMenu->*/appendEntry( 3, String( SVX_RES( STR_METAL ) ), bHighContrast ? maImgSurface4h : maImgSurface4 ); - } -} - -// ----------------------------------------------------------------------- - IMPL_LINK( ExtrusionSurfaceWindow, SelectHdl, void *, EMPTYARG ) { if ( IsInPopupMode() ) EndPopupMode(); -// SfxDispatcher* pDisp = GetBindings().GetDispatcher(); - - sal_Int32 nSurface = /*mpMenu->*/getSelectedEntryId(); + sal_Int32 nSurface = getSelectedEntryId(); if( nSurface >= 0 ) { - SfxInt32Item aItem( SID_EXTRUSION_SURFACE, nSurface ); - rtl::OUString aCommand( msExtrusionSurface ); - - Any a; - INetURLObject aObj( aCommand ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aItem.QueryValue( a ); - aArgs[0].Value = a; + aArgs[0].Name = msExtrusionSurface.copy(5); + aArgs[0].Value <<= (sal_Int32)nSurface; - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + mrController.dispatchCommand( msExtrusionSurface, aArgs ); implSetSurface( nSurface, true ); } @@ -1147,65 +912,57 @@ IMPL_LINK( ExtrusionSurfaceWindow, SelectHdl, void *, EMPTYARG ) return 0; } -// ----------------------------------------------------------------------- +// ======================================================================== -void ExtrusionSurfaceWindow::StartSelection() +ExtrusionSurfaceControl::ExtrusionSurfaceControl( const Reference< lang::XMultiServiceFactory >& rServiceManager ) +: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionSurfaceFloater" ) ) ) { } // ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- - -void ExtrusionSurfaceWindow::GetFocus (void) +::Window* ExtrusionSurfaceControl::createPopupWindow( ::Window* pParent ) { - ToolbarMenu::GetFocus(); - // Grab the focus to the line ends value set so that it can be controlled - // with the keyboard. - //if( mpMenu ) - /*mpMenu->*/GrabFocus(); + return new ExtrusionLightingWindow( *this, m_xFrame, pParent ); } -// ======================================================================== +// ----------------------------------------------------------------------- +// XServiceInfo +// ----------------------------------------------------------------------- -ExtrusionSurfaceControl::ExtrusionSurfaceControl( - USHORT nSlotId, USHORT nId, ToolBox &rTbx ) -: SfxToolBoxControl( nSlotId, nId, rTbx ) +OUString SAL_CALL ExtrusionSurfaceControl_getImplementationName() { - rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); + return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionSurfaceController" )); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -ExtrusionSurfaceControl::~ExtrusionSurfaceControl() +Sequence< OUString > SAL_CALL ExtrusionSurfaceControl_getSupportedServiceNames() throw( RuntimeException ) { + Sequence< OUString > aSNS( 1 ); + aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); + return aSNS; } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindowType ExtrusionSurfaceControl::GetPopupWindowType() const +Reference< XInterface > SAL_CALL SAL_CALL ExtrusionSurfaceControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) { - return SFX_POPUPWINDOW_ONCLICK; + return *new ExtrusionSurfaceControl( rSMgr ); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindow* ExtrusionSurfaceControl::CreatePopupWindow() +OUString SAL_CALL ExtrusionSurfaceControl::getImplementationName( ) throw (RuntimeException) { - ExtrusionSurfaceWindow* pWin = new ExtrusionSurfaceWindow( GetId(), m_xFrame, &GetToolBox() ); - StartPopupMode( pWin ); - return 0; + return ExtrusionSurfaceControl_getImplementationName(); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -void ExtrusionSurfaceControl::StateChanged( USHORT, SfxItemState eState, const SfxPoolItem* ) +Sequence< OUString > SAL_CALL ExtrusionSurfaceControl::getSupportedServiceNames( ) throw (RuntimeException) { - USHORT nId = GetId(); - ToolBox& rTbx = GetToolBox(); - - rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); - rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); + return ExtrusionSurfaceControl_getSupportedServiceNames(); } //======================================================================== @@ -1271,3 +1028,5 @@ void ExtrusionColorControl::StateChanged( USHORT nSID, SfxItemState eState, cons rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); } + +} diff --git a/svx/source/tbxctrls/extrusioncontrols.hxx b/svx/source/tbxctrls/extrusioncontrols.hxx new file mode 100644 index 000000000000..958ccc014afc --- /dev/null +++ b/svx/source/tbxctrls/extrusioncontrols.hxx @@ -0,0 +1,241 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVX_EXTRUSION_CONTROLS_HXX +#define _SVX_EXTRUSION_CONTROLS_HXX + +#include "svx/svxdllapi.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +class SfxBindings; +class SfxStatusForwarder; + +//======================================================================== + +namespace svx +{ +class ToolboxButtonColorUpdater; + +class ExtrusionDirectionWindow : public svtools::ToolbarMenu +{ +public: + ExtrusionDirectionWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ); + + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + +private: + svt::ToolboxController& mrController; + ValueSet* mpDirectionSet; + + Image maImgDirection[9]; + Image maImgDirectionH[9]; + + Image maImgPerspective; + Image maImgPerspectiveH; + Image maImgParallel; + Image maImgParallelH; + + const rtl::OUString msExtrusionDirection; + const rtl::OUString msExtrusionProjection; + + DECL_LINK( SelectHdl, void * ); + void FillValueSet(); + + void implSetDirection( sal_Int32 nSkew, bool bEnabled = true ); + void implSetProjection( sal_Int32 nProjection, bool bEnabled = true ); + +}; + +//======================================================================== + +class ExtrusionDirectionControl : public svt::PopupWindowController +{ +public: + ExtrusionDirectionControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + + virtual ::Window* createPopupWindow( ::Window* pParent ); + + // 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 ); +}; + +//======================================================================== + +class ExtrusionDepthController : public svt::PopupMenuControllerBase +{ + using svt::PopupMenuControllerBase::disposing; +private: + Image maImgDepth[5]; + Image maImgDepthInfinity; + + Image maImgDepth_hc[5]; + Image maImgDepthInfinityh; + + FieldUnit meUnit; + double mfDepth; + + const rtl::OUString msExtrusionDepth; + const rtl::OUString msMetricUnit; + +public: + ExtrusionDepthController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~ExtrusionDepthController(); + + // 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); + + // 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); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XMenuListener + virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XPopupMenuController + virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException); +}; + +//======================================================================== + +class ExtrusionLightingWindow : public svtools::ToolbarMenu +{ +private: + svt::ToolboxController& mrController; + ValueSet* mpLightingSet; + + Image maImgLightingOff[9]; + Image maImgLightingOn[9]; + Image maImgLightingPreview[9]; + + Image maImgLightingOffh[9]; + Image maImgLightingOnh[9]; + Image maImgLightingPreviewh[9]; + + Image maImgBright; + Image maImgNormal; + Image maImgDim; + Image maImgBrighth; + Image maImgNormalh; + Image maImgDimh; + + int mnLevel; + bool mbLevelEnabled; + int mnDirection; + bool mbDirectionEnabled; + + const rtl::OUString msExtrusionLightingDirection; + const rtl::OUString msExtrusionLightingIntensity; + + void implSetIntensity( int nLevel, bool bEnabled ); + void implSetDirection( int nDirection, bool bEnabled ); + + DECL_LINK( SelectHdl, void * ); +public: + ExtrusionLightingWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ); + + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); +}; + +//======================================================================== + +class ExtrusionLightingControl : public svt::PopupWindowController +{ +public: + ExtrusionLightingControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + + virtual ::Window* createPopupWindow( ::Window* pParent ); + + // 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 ); +}; + +//======================================================================== + +class ExtrusionSurfaceWindow : public svtools::ToolbarMenu +{ +private: + svt::ToolboxController& mrController; + + Image maImgSurface1; + Image maImgSurface2; + Image maImgSurface3; + Image maImgSurface4; + Image maImgSurface1h; + Image maImgSurface2h; + Image maImgSurface3h; + Image maImgSurface4h; + + const rtl::OUString msExtrusionSurface; + + DECL_LINK( SelectHdl, void * ); + + void implSetSurface( int nSurface, bool bEnabled ); + +public: + ExtrusionSurfaceWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ); + + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); +}; + +//======================================================================== + +class ExtrusionSurfaceControl : public svt::PopupWindowController +{ +public: + ExtrusionSurfaceControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + + virtual ::Window* createPopupWindow( ::Window* pParent ); + + // 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 ); +}; + +//======================================================================== + +} +#endif + diff --git a/svx/source/tbxctrls/extrusioncontrols.src b/svx/source/tbxctrls/extrusioncontrols.src index 5a819a223d81..11f40e6f2976 100644 --- a/svx/source/tbxctrls/extrusioncontrols.src +++ b/svx/source/tbxctrls/extrusioncontrols.src @@ -200,93 +200,81 @@ DockingWindow RID_SVXFLOAT_EXTRUSION_DIRECTION }; }; -DockingWindow RID_SVXFLOAT_EXTRUSION_DEPTH +String RID_SVXSTR_EXTRUSION_CUSTOM { - Border = FALSE ; - Hide = TRUE ; - SVLook = TRUE ; - Sizeable = FALSE ; - Moveable = TRUE ; - Closeable = TRUE ; - Zoomable = TRUE ; - - Text [ en-US ] = "Extrusion Depth" ; + Text [ en-US ] = "~Custom..."; +}; - String STR_CUSTOM - { - Text [ en-US ] = "~Custom..."; - }; +String RID_SVXSTR_EXTRUSION_INFINITY +{ + Text [ en-US ] = "~Infinity"; +}; - String STR_INFINITY - { - Text [ en-US ] = "~Infinity"; - }; +Image RID_SVXIMG_EXTRUSION_DEPTH_0 +{ + ImageBitmap = Bitmap { File = "extrusion0inch_16.bmp"; }; + MASKCOLOR +}; +Image RID_SVXIMG_EXTRUSION_DEPTH_0_H +{ + ImageBitmap = Bitmap { File = "extrusion0inch_16_h.bmp"; }; + MASKCOLOR +}; - Image IMG_DEPTH_0 - { - ImageBitmap = Bitmap { File = "extrusion0inch_16.bmp"; }; - MASKCOLOR - }; - Image IMG_DEPTH_0_H - { - ImageBitmap = Bitmap { File = "extrusion0inch_16_h.bmp"; }; - MASKCOLOR - }; +Image RID_SVXIMG_EXTRUSION_DEPTH_1 +{ + ImageBitmap = Bitmap { File = "extrusion05inch_16.bmp"; }; + MASKCOLOR +}; +Image RID_SVXIMG_EXTRUSION_DEPTH_1_H +{ + ImageBitmap = Bitmap { File = "extrusion05inch_16_h.bmp"; }; + MASKCOLOR +}; - Image IMG_DEPTH_1 - { - ImageBitmap = Bitmap { File = "extrusion05inch_16.bmp"; }; - MASKCOLOR - }; - Image IMG_DEPTH_1_H - { - ImageBitmap = Bitmap { File = "extrusion05inch_16_h.bmp"; }; - MASKCOLOR - }; +Image RID_SVXIMG_EXTRUSION_DEPTH_2 +{ + ImageBitmap = Bitmap { File = "extrusion1inch_16.bmp"; }; + MASKCOLOR +}; - Image IMG_DEPTH_2 - { - ImageBitmap = Bitmap { File = "extrusion1inch_16.bmp"; }; - MASKCOLOR - }; - Image IMG_DEPTH_2_H - { - ImageBitmap = Bitmap { File = "extrusion1inch_16_h.bmp"; }; - MASKCOLOR - }; +Image RID_SVXIMG_EXTRUSION_DEPTH_2_H +{ + ImageBitmap = Bitmap { File = "extrusion1inch_16_h.bmp"; }; + MASKCOLOR +}; - Image IMG_DEPTH_3 - { - ImageBitmap = Bitmap { File = "extrusion2inch_16.bmp"; }; - MASKCOLOR - }; - Image IMG_DEPTH_3_H - { - ImageBitmap = Bitmap { File = "extrusion2inch_16_h.bmp"; }; - MASKCOLOR - }; +Image RID_SVXIMG_EXTRUSION_DEPTH_3 +{ + ImageBitmap = Bitmap { File = "extrusion2inch_16.bmp"; }; + MASKCOLOR +}; +Image RID_SVXIMG_EXTRUSION_DEPTH_3_H +{ + ImageBitmap = Bitmap { File = "extrusion2inch_16_h.bmp"; }; + MASKCOLOR +}; - Image IMG_DEPTH_4 - { - ImageBitmap = Bitmap { File = "extrusion4inch_16.bmp"; }; - MASKCOLOR - }; - Image IMG_DEPTH_4_H - { - ImageBitmap = Bitmap { File = "extrusion4inch_16_h.bmp"; }; - MASKCOLOR - }; +Image RID_SVXIMG_EXTRUSION_DEPTH_4 +{ + ImageBitmap = Bitmap { File = "extrusion4inch_16.bmp"; }; + MASKCOLOR +}; +Image RID_SVXIMG_EXTRUSION_DEPTH_4_H +{ + ImageBitmap = Bitmap { File = "extrusion4inch_16_h.bmp"; }; + MASKCOLOR +}; - Image IMG_DEPTH_INFINITY - { - ImageBitmap = Bitmap { File = "extrusioninfinity_16.bmp"; }; - MASKCOLOR - }; - Image IMG_DEPTH_INFINITY_H - { - ImageBitmap = Bitmap { File = "extrusioninfinity_16_h.bmp"; }; - MASKCOLOR - }; +Image RID_SVXIMG_EXTRUSION_DEPTH_INFINITY +{ + ImageBitmap = Bitmap { File = "extrusioninfinity_16.bmp"; }; + MASKCOLOR +}; +Image RID_SVXIMG_EXTRUSION_DEPTH_INFINITY_H +{ + ImageBitmap = Bitmap { File = "extrusioninfinity_16_h.bmp"; }; + MASKCOLOR }; DockingWindow RID_SVXFLOAT_EXTRUSION_LIGHTING diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx index 915f0743c8fd..1fbf10868661 100644 --- a/svx/source/tbxctrls/fontworkgallery.cxx +++ b/svx/source/tbxctrls/fontworkgallery.cxx @@ -27,40 +27,53 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" + #include -#include + +#include + #include -#include + +#include +#include +#include + +#include #include -#include +#include +#include + +#include #include #include #include -#include "gallery.hxx" #include #include #include #include -#include -#include -#include "svx/toolbarmenu.hxx" + +#include "gallery.hxx" +#include #include "fontworkgallery.hxx" #include "fontworkgallery.hrc" #include -#ifndef _TOOLBOX_HXX //autogen -#include -#endif -#ifndef _SVX_HELPID_HRC #include "helpid.hrc" -#endif -using namespace svx; + +using ::rtl::OUString; +using ::svtools::ToolbarMenu; + +using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::frame; + +namespace svx +{ const int nColCount = 4; const int nLineCount = 4; @@ -291,7 +304,7 @@ IMPL_LINK( FontWorkGalleryDialog, DoubleClickFavoriteHdl, void*, EMPTYARG ) return( 0L ); } -// ----------------------------------------------------------------------- +//------------------------------------------------------------------------ SFX_IMPL_TOOLBOX_CONTROL( FontWorkShapeTypeControl, SfxStringItem ); FontWorkShapeTypeControl::FontWorkShapeTypeControl( USHORT nSlotId, USHORT nId, ToolBox &rTbx ) @@ -332,35 +345,50 @@ void FontWorkShapeTypeControl::Select( BOOL ) // #################################################################### -SFX_IMPL_TOOLBOX_CONTROL( FontWorkAlignmentControl, SfxBoolItem ); - -FontWorkAlignmentWindow::FontWorkAlignmentWindow( - USHORT /*nId*/, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ) : - - ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_FONTWORK_ALIGNMENT )), - maImgAlgin1( SVX_RES( IMG_FONTWORK_ALIGN_LEFT_16 ) ), - maImgAlgin2( SVX_RES( IMG_FONTWORK_ALIGN_CENTER_16 ) ), - maImgAlgin3( SVX_RES( IMG_FONTWORK_ALIGN_RIGHT_16 ) ), - maImgAlgin4( SVX_RES( IMG_FONTWORK_ALIGN_WORD_16 ) ), - maImgAlgin5( SVX_RES( IMG_FONTWORK_ALIGN_STRETCH_16 ) ), - maImgAlgin1h( SVX_RES( IMG_FONTWORK_ALIGN_LEFT_16_H ) ), - maImgAlgin2h( SVX_RES( IMG_FONTWORK_ALIGN_CENTER_16_H ) ), - maImgAlgin3h( SVX_RES( IMG_FONTWORK_ALIGN_RIGHT_16_H ) ), - maImgAlgin4h( SVX_RES( IMG_FONTWORK_ALIGN_WORD_16_H ) ), - maImgAlgin5h( SVX_RES( IMG_FONTWORK_ALIGN_STRETCH_16_H ) ), - mxFrame( rFrame ), - msFontworkAlignment( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkAlignment" ) ) -{ - SetHelpId( HID_WIN_FONTWORK_ALIGN ); - implInit(); -} - -void FontWorkAlignmentWindow::implInit() +class FontWorkAlignmentWindow : public ToolbarMenu +{ +public: + FontWorkAlignmentWindow( svt::ToolboxController& rController, const Reference< XFrame >& rFrame, Window* pParentWindow ); + + virtual void SAL_CALL statusChanged( const frame::FeatureStateEvent& Event ) throw ( RuntimeException ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + +private: + svt::ToolboxController& mrController; + + Image maImgAlgin1; + Image maImgAlgin2; + Image maImgAlgin3; + Image maImgAlgin4; + Image maImgAlgin5; + Image maImgAlgin1h; + Image maImgAlgin2h; + Image maImgAlgin3h; + Image maImgAlgin4h; + Image maImgAlgin5h; + + const rtl::OUString msFontworkAlignment; + + DECL_LINK( SelectHdl, void * ); + + void implSetAlignment( int nAlignmentMode, bool bEnabled ); +}; + +FontWorkAlignmentWindow::FontWorkAlignmentWindow( svt::ToolboxController& rController, const Reference< XFrame >& rFrame, Window* pParentWindow ) +: ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_FONTWORK_ALIGNMENT )) +, mrController( rController ) +, maImgAlgin1( SVX_RES( IMG_FONTWORK_ALIGN_LEFT_16 ) ) +, maImgAlgin2( SVX_RES( IMG_FONTWORK_ALIGN_CENTER_16 ) ) +, maImgAlgin3( SVX_RES( IMG_FONTWORK_ALIGN_RIGHT_16 ) ) +, maImgAlgin4( SVX_RES( IMG_FONTWORK_ALIGN_WORD_16 ) ) +, maImgAlgin5( SVX_RES( IMG_FONTWORK_ALIGN_STRETCH_16 ) ) +, maImgAlgin1h( SVX_RES( IMG_FONTWORK_ALIGN_LEFT_16_H ) ) +, maImgAlgin2h( SVX_RES( IMG_FONTWORK_ALIGN_CENTER_16_H ) ) +, maImgAlgin3h( SVX_RES( IMG_FONTWORK_ALIGN_RIGHT_16_H ) ) +, maImgAlgin4h( SVX_RES( IMG_FONTWORK_ALIGN_WORD_16_H ) ) +, maImgAlgin5h( SVX_RES( IMG_FONTWORK_ALIGN_STRETCH_16_H ) ) +, msFontworkAlignment( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkAlignment" ) ) { - SetHelpId( HID_POPUP_FONTWORK_ALIGN ); - bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); SetHelpId( HID_POPUP_FONTWORK_ALIGN ); @@ -381,12 +409,6 @@ void FontWorkAlignmentWindow::implInit() // ----------------------------------------------------------------------- -FontWorkAlignmentWindow::~FontWorkAlignmentWindow() -{ -} - -// ----------------------------------------------------------------------- - void FontWorkAlignmentWindow::implSetAlignment( int nSurface, bool bEnabled ) { int i; @@ -399,7 +421,7 @@ void FontWorkAlignmentWindow::implSetAlignment( int nSurface, bool bEnabled ) // ----------------------------------------------------------------------- -void SAL_CALL FontWorkAlignmentWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) +void SAL_CALL FontWorkAlignmentWindow::statusChanged( const frame::FeatureStateEvent& Event ) throw ( RuntimeException ) { if( Event.FeatureURL.Main.equals( msFontworkAlignment ) ) { @@ -441,25 +463,14 @@ IMPL_LINK( FontWorkAlignmentWindow, SelectHdl, void *, EMPTYARG ) if ( IsInPopupMode() ) EndPopupMode(); -// SfxDispatcher* pDisp = GetBindings().GetDispatcher(); - sal_Int32 nAlignment = getSelectedEntryId(); if( nAlignment >= 0 ) { - SfxInt32Item aItem( SID_FONTWORK_ALIGNMENT, nAlignment ); - rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkAlignment" )); - - Any a; - INetURLObject aObj( aCommand ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aItem.QueryValue( a ); - aArgs[0].Value = a; + aArgs[0].Name = msFontworkAlignment.copy(5); + aArgs[0].Value <<= (sal_Int32)nAlignment; - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + mrController.dispatchCommand( msFontworkAlignment, aArgs ); implSetAlignment( nAlignment, true ); } @@ -467,56 +478,74 @@ IMPL_LINK( FontWorkAlignmentWindow, SelectHdl, void *, EMPTYARG ) return 0; } -// ----------------------------------------------------------------------- +// ======================================================================== -void FontWorkAlignmentWindow::StartSelection() +class FontWorkAlignmentControl : public svt::PopupWindowController +{ +public: + FontWorkAlignmentControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + + virtual ::Window* createPopupWindow( ::Window* pParent ); + + // 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 ); +}; + + +FontWorkAlignmentControl::FontWorkAlignmentControl( const Reference< lang::XMultiServiceFactory >& rServiceManager ) +: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkAlignment" ) ) ) { } // ----------------------------------------------------------------------- -void FontWorkAlignmentWindow::GetFocus (void) +::Window* FontWorkAlignmentControl::createPopupWindow( ::Window* pParent ) { - ToolbarMenu::GetFocus(); - // Grab the focus to the line ends value set so that it can be controlled - // with the keyboard. - GrabFocus(); + return new FontWorkAlignmentWindow( *this, m_xFrame, pParent ); } -// ======================================================================== +// ----------------------------------------------------------------------- +// XServiceInfo +// ----------------------------------------------------------------------- -FontWorkAlignmentControl::FontWorkAlignmentControl( - USHORT nSlotId, USHORT nId, ToolBox &rTbx ) -: SfxToolBoxControl( nSlotId, nId, rTbx ) +OUString SAL_CALL FontWorkAlignmentControl_getImplementationName() { - rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); + return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.FontWorkAlignmentController" )); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -FontWorkAlignmentControl::~FontWorkAlignmentControl() +Sequence< OUString > SAL_CALL FontWorkAlignmentControl_getSupportedServiceNames() throw( RuntimeException ) { + Sequence< OUString > aSNS( 1 ); + aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); + return aSNS; } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindowType FontWorkAlignmentControl::GetPopupWindowType() const +Reference< XInterface > SAL_CALL SAL_CALL FontWorkAlignmentControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) { - return SFX_POPUPWINDOW_ONCLICK; + return *new FontWorkAlignmentControl( rSMgr ); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindow* FontWorkAlignmentControl::CreatePopupWindow() +OUString SAL_CALL FontWorkAlignmentControl::getImplementationName( ) throw (RuntimeException) { - FontWorkAlignmentWindow* pWin = new FontWorkAlignmentWindow( GetId(), m_xFrame, &GetToolBox() ); - StartPopupMode( pWin ); - return 0; + return FontWorkAlignmentControl_getImplementationName(); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- + +Sequence< OUString > SAL_CALL FontWorkAlignmentControl::getSupportedServiceNames( ) throw (RuntimeException) +{ + return FontWorkAlignmentControl_getSupportedServiceNames(); +} -void FontWorkAlignmentControl::StateChanged( USHORT /*nSID*/, SfxItemState eState, const SfxPoolItem* /*pState*/ ) +/** todo ? +void FontWorkAlignmentControl::StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ) { USHORT nId = GetId(); ToolBox& rTbx = GetToolBox(); @@ -525,26 +554,36 @@ void FontWorkAlignmentControl::StateChanged( USHORT /*nSID*/, SfxItemState eStat rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); } +*/ + // #################################################################### -SFX_IMPL_TOOLBOX_CONTROL( FontWorkCharacterSpacingControl, SfxBoolItem ); +class FontWorkCharacterSpacingWindow : public ToolbarMenu +{ +public: + FontWorkCharacterSpacingWindow( svt::ToolboxController& rController, const Reference< XFrame >& rFrame, Window* pParentWindow ); + + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); +private: + svt::ToolboxController& mrController; + + const rtl::OUString msFontworkCharacterSpacing; + const rtl::OUString msFontworkKernCharacterPairs; + + DECL_LINK( SelectHdl, void * ); -FontWorkCharacterSpacingWindow::FontWorkCharacterSpacingWindow( USHORT /*nId*/, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) + void implSetCharacterSpacing( sal_Int32 nCharacterSpacing, bool bEnabled ); + void implSetKernCharacterPairs( sal_Bool bKernOnOff, bool bEnabled ); + +}; + +FontWorkCharacterSpacingWindow::FontWorkCharacterSpacingWindow( svt::ToolboxController& rController, const Reference< XFrame >& rFrame, Window* pParentWindow ) : ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_FONTWORK_CHARSPACING )) -, mxFrame( rFrame ) +, mrController( rController ) , msFontworkCharacterSpacing( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkCharacterSpacing" ) ) , msFontworkKernCharacterPairs( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkKernCharacterPairs" ) ) -{ - implInit(); -} - -void FontWorkCharacterSpacingWindow::implInit() { SetHelpId( HID_POPUP_FONTWORK_CHARSPACE ); - -// bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - - SetHelpId( HID_POPUP_FONTWORK_CHARSPACE ); SetSelectHdl( LINK( this, FontWorkCharacterSpacingWindow, SelectHdl ) ); appendEntry( 0, String( SVX_RES( STR_CHARS_SPACING_VERY_TIGHT ) ), MIB_RADIOCHECK ); @@ -566,12 +605,6 @@ void FontWorkCharacterSpacingWindow::implInit() // ----------------------------------------------------------------------- -FontWorkCharacterSpacingWindow::~FontWorkCharacterSpacingWindow() -{ -} - -// ----------------------------------------------------------------------- - void FontWorkCharacterSpacingWindow::implSetCharacterSpacing( sal_Int32 nCharacterSpacing, bool bEnabled ) { sal_Int32 i; @@ -638,27 +671,6 @@ void SAL_CALL FontWorkCharacterSpacingWindow::statusChanged( const ::com::sun::s // ----------------------------------------------------------------------- -void FontWorkCharacterSpacingWindow::DataChanged( const DataChangedEvent& rDCEvt ) -{ - ToolbarMenu::DataChanged( rDCEvt ); - - if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) - { -// bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - - appendEntry( 0, String( SVX_RES( STR_CHARS_SPACING_VERY_TIGHT ) ), MIB_CHECKABLE ); - appendEntry( 1, String( SVX_RES( STR_CHARS_SPACING_TIGHT ) ), MIB_CHECKABLE ); - appendEntry( 2, String( SVX_RES( STR_CHARS_SPACING_NORMAL ) ), MIB_CHECKABLE ); - appendEntry( 3, String( SVX_RES( STR_CHARS_SPACING_LOOSE ) ), MIB_CHECKABLE ); - appendEntry( 4, String( SVX_RES( STR_CHARS_SPACING_VERY_LOOSE ) ), MIB_CHECKABLE ); - appendEntry( 5, String( SVX_RES( STR_CHARS_SPACING_CUSTOM ) ), MIB_CHECKABLE ); - appendSeparator(); - appendEntry( 6, String( SVX_RES( STR_CHARS_SPACING_KERN_PAIRS ) ), MIB_CHECKABLE ); - } -} - -// ----------------------------------------------------------------------- - IMPL_LINK( FontWorkCharacterSpacingWindow, SelectHdl, void *, EMPTYARG ) { if ( IsInPopupMode() ) @@ -677,53 +689,31 @@ IMPL_LINK( FontWorkCharacterSpacingWindow, SelectHdl, void *, EMPTYARG ) } if ( nSelection == 5 ) // custom spacing { - SfxInt32Item aItem( SID_FONTWORK_CHARACTER_SPACING, nCharacterSpacing ); - rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkCharacterSpacingDialog" )); - - Any a; Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontworkCharacterSpacing" )); - aItem.QueryValue( a ); - aArgs[0].Value = a; - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + aArgs[0].Name = msFontworkCharacterSpacing.copy(5); + aArgs[0].Value <<= (sal_Int32)nCharacterSpacing; + + mrController.dispatchCommand( OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkCharacterSpacingDialog" )), aArgs ); } else if ( nSelection == 6 ) // KernCharacterPairs { - sal_Bool bOnOff = sal_True; - SfxBoolItem aItem( SID_FONTWORK_KERN_CHARACTER_PAIRS, bOnOff ); rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkKernCharacterPairs" )); - Any a; Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontworkKernCharacterPairs" )); - aItem.QueryValue( a ); - aArgs[0].Value = a; - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); - - implSetKernCharacterPairs( bOnOff, true ); + aArgs[0].Name = msFontworkKernCharacterPairs.copy(5); + aArgs[0].Value <<= (sal_Bool) sal_True; + + mrController.dispatchCommand( msFontworkKernCharacterPairs, aArgs ); + + implSetKernCharacterPairs( sal_True, true ); } else if( nSelection >= 0 ) { - SfxInt32Item aItem( SID_FONTWORK_CHARACTER_SPACING, nCharacterSpacing ); - rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkCharacterSpacing" )); - - Any a; - INetURLObject aObj( aCommand ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aItem.QueryValue( a ); - aArgs[0].Value = a; + aArgs[0].Name = msFontworkCharacterSpacing.copy(5); + aArgs[0].Value <<=( sal_Int32)nCharacterSpacing; - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + mrController.dispatchCommand( msFontworkCharacterSpacing, aArgs ); implSetCharacterSpacing( nCharacterSpacing, true ); } @@ -731,55 +721,74 @@ IMPL_LINK( FontWorkCharacterSpacingWindow, SelectHdl, void *, EMPTYARG ) return 0; } -// ----------------------------------------------------------------------- +// ======================================================================== -void FontWorkCharacterSpacingWindow::StartSelection() +class FontWorkCharacterSpacingControl : public svt::PopupWindowController +{ +public: + FontWorkCharacterSpacingControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + + virtual ::Window* createPopupWindow( ::Window* pParent ); + + // 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 ); +}; + + +FontWorkCharacterSpacingControl::FontWorkCharacterSpacingControl( const Reference< lang::XMultiServiceFactory >& rServiceManager ) +: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkCharacterSpacingFloater" ) ) ) { } // ----------------------------------------------------------------------- -void FontWorkCharacterSpacingWindow::GetFocus (void) +::Window* FontWorkCharacterSpacingControl::createPopupWindow( ::Window* pParent ) { - ToolbarMenu::GetFocus(); - // Grab the focus to the line ends value set so that it can be controlled - // with the keyboard. - GrabFocus(); + return new FontWorkCharacterSpacingWindow( *this, m_xFrame, pParent ); } -// ======================================================================== +// ----------------------------------------------------------------------- +// XServiceInfo +// ----------------------------------------------------------------------- -FontWorkCharacterSpacingControl::FontWorkCharacterSpacingControl( - USHORT nSlotId, USHORT nId, ToolBox &rTbx ) -: SfxToolBoxControl( nSlotId, nId, rTbx ) +OUString SAL_CALL FontWorkCharacterSpacingControl_getImplementationName() { - rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); + return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.FontWorkCharacterSpacingController" )); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -FontWorkCharacterSpacingControl::~FontWorkCharacterSpacingControl() +Sequence< OUString > SAL_CALL FontWorkCharacterSpacingControl_getSupportedServiceNames() throw( RuntimeException ) { + Sequence< OUString > aSNS( 1 ); + aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); + return aSNS; } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindowType FontWorkCharacterSpacingControl::GetPopupWindowType() const +Reference< XInterface > SAL_CALL SAL_CALL FontWorkCharacterSpacingControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) { - return SFX_POPUPWINDOW_ONCLICK; + return *new FontWorkCharacterSpacingControl( rSMgr ); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindow* FontWorkCharacterSpacingControl::CreatePopupWindow() +OUString SAL_CALL FontWorkCharacterSpacingControl::getImplementationName( ) throw (RuntimeException) { - FontWorkCharacterSpacingWindow* pWin = new FontWorkCharacterSpacingWindow( GetId(), m_xFrame, &GetToolBox() ); - StartPopupMode( pWin ); - return 0; + return FontWorkCharacterSpacingControl_getImplementationName(); } +// -------------------------------------------------------------------- + +Sequence< OUString > SAL_CALL FontWorkCharacterSpacingControl::getSupportedServiceNames( ) throw (RuntimeException) +{ + return FontWorkCharacterSpacingControl_getSupportedServiceNames(); +} // ----------------------------------------------------------------------- +/** todo ? void FontWorkCharacterSpacingControl::StateChanged( USHORT, SfxItemState eState, const SfxPoolItem* ) { USHORT nId = GetId(); @@ -788,6 +797,7 @@ void FontWorkCharacterSpacingControl::StateChanged( USHORT, SfxItemState eState, rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); } +*/ // ----------------------------------------------------------------------- @@ -811,3 +821,5 @@ sal_Int32 FontworkCharacterSpacingDialog::getScale() const { return (sal_Int32)maMtrScale.GetValue(); } + +} diff --git a/svx/source/tbxctrls/makefile.mk b/svx/source/tbxctrls/makefile.mk index 47da008e87a3..9b08caa587aa 100644 --- a/svx/source/tbxctrls/makefile.mk +++ b/svx/source/tbxctrls/makefile.mk @@ -44,7 +44,6 @@ LIB1OBJFILES= \ $(SLO)$/fontworkgallery.obj\ $(SLO)$/extrusioncontrols.obj \ $(SLO)$/tbcontrl.obj \ - $(SLO)$/toolbarmenu.obj \ $(SLO)$/tbxcolorupdate.obj LIB2TARGET= $(SLB)$/$(TARGET).lib diff --git a/svx/source/tbxctrls/toolbarmenu.cxx b/svx/source/tbxctrls/toolbarmenu.cxx deleted file mode 100644 index e121aa3a88ef..000000000000 --- a/svx/source/tbxctrls/toolbarmenu.cxx +++ /dev/null @@ -1,1194 +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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svx.hxx" - -#include - -#include -#include -#include -#include -#include - -#include - -#include "svx/toolbarmenu.hxx" - -const int EXTRAITEMHEIGHT = 0; // 4; -const int SEPARATOR_HEIGHT = 4; -const int TITLE_ID = -1; -const int BORDER_X = 0; -const int BORDER_Y = 0; - -static Window* GetTopMostParentSystemWindow( Window* pWindow ) -{ - OSL_ASSERT( pWindow ); - if ( pWindow ) - { - // ->manually search topmost system window - // required because their might be another system window between this and the top window - pWindow = pWindow->GetParent(); - SystemWindow* pTopMostSysWin = NULL; - while ( pWindow ) - { - if ( pWindow->IsSystemWindow() ) - pTopMostSysWin = (SystemWindow*)pWindow; - pWindow = pWindow->GetParent(); - } - pWindow = pTopMostSysWin; - OSL_ASSERT( pWindow ); - return pWindow; - } - - return NULL; -} - -class ToolbarMenuEntry -{ -public: - int mnEntryId; - MenuItemBits mnBits; - Size maSize; - - bool mbHasText; - bool mbHasImage; - bool mbHasControl; - bool mbChecked; - bool mbEnabled; - - String maText; - Image maImage; - Control* mpControl; - -public: - ToolbarMenuEntry( int nEntryId, const String& rText, MenuItemBits nBits ); - ToolbarMenuEntry( int nEntryId, const Image& rImage, MenuItemBits nBits ); - ToolbarMenuEntry( int nEntryId, const Image& rImage, const String& rText, MenuItemBits nBits ); - ToolbarMenuEntry( int nEntryId, Control* pControl, MenuItemBits nBits ); - ToolbarMenuEntry( int nEntryId, const String& rText, Control* pControl, MenuItemBits nBits ); - ~ToolbarMenuEntry(); - - void init( int nEntryId, MenuItemBits nBits ); -}; - -void ToolbarMenuEntry::init( int nEntryId, MenuItemBits nBits ) -{ - mnEntryId = nEntryId; - mnBits = nBits; - - mbHasText = false; - mbHasImage = false; - mbHasControl = false; - mbChecked = false; - mbEnabled = true; - - mpControl = NULL; -} - -ToolbarMenuEntry::ToolbarMenuEntry( int nEntryId, const String& rText, MenuItemBits nBits ) -{ - init( nEntryId, nBits ); - - maText = rText; - mbHasText = true; -} - -ToolbarMenuEntry::ToolbarMenuEntry( int nEntryId, const Image& rImage, MenuItemBits nBits ) -{ - init( nEntryId, nBits ); - - maImage = rImage; - mbHasImage = true; -} - -ToolbarMenuEntry::ToolbarMenuEntry( int nEntryId, const Image& rImage, const String& rText, MenuItemBits nBits ) -{ - init( nEntryId, nBits ); - - maText = rText; - mbHasText = true; - - maImage = rImage; - mbHasImage = true; -} - -ToolbarMenuEntry::ToolbarMenuEntry( int nEntryId, Control* pControl, MenuItemBits nBits ) -{ - init( nEntryId, nBits ); - - if( pControl ) - { - mpControl = pControl; - mpControl->Show(); - } -} - -ToolbarMenuEntry::ToolbarMenuEntry( int nEntryId, const String& rText, Control* pControl, MenuItemBits nBits ) -{ - init( nEntryId, nBits ); - - maText = rText; - mbHasText = true; - - if( pControl ) - { - mpControl = pControl; - mpControl->Show(); - } -} - -ToolbarMenuEntry::~ToolbarMenuEntry() -{ - delete mpControl; -} - -ToolbarMenu::ToolbarMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow, - WinBits nBits ) -: DockingWindow(pParentWindow, nBits) -, mxFrame( rFrame ) -{ - implInit(); -} - -ToolbarMenu::ToolbarMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow, - const ResId& rResId ) -: DockingWindow(pParentWindow, rResId) -, mxFrame( rFrame ) -{ - implInit(); -} - -void ToolbarMenu::implInit() -{ -// SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_NOBORDER | WB_SYSTEMWINDOW ); - -// EnableChildTransparentMode(); - - Window* pWindow = GetTopMostParentSystemWindow( this ); - if ( pWindow ) - ((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( this ); - - mxServiceManager = ::comphelper::getProcessServiceFactory(); - - mnCheckPos = 0; - mnImagePos = 0; - mnTextPos = 0; - - mnHighlightedEntry = -1; - mnSelectedEntry = -1; - initWindow(); -} - -ToolbarMenu::~ToolbarMenu() -{ - Window* pWindow = GetTopMostParentSystemWindow( this ); - if ( pWindow ) - ((SystemWindow *)pWindow)->GetTaskPaneList()->RemoveWindow( this ); - - if ( mxStatusListener.is() ) - { - mxStatusListener->dispose(); - mxStatusListener.clear(); - } - - // delete all menu entries - const int nEntryCount = maEntryVector.size(); - int nEntry; - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - delete maEntryVector[nEntry]; - } -} - -int ToolbarMenu::getSelectedEntryId() const -{ - ToolbarMenuEntry* pEntry = implGetEntry( mnSelectedEntry ); - return pEntry ? pEntry->mnEntryId : -1; -} - -int ToolbarMenu::getHighlightedEntryId() const -{ - ToolbarMenuEntry* pEntry = implGetEntry( mnHighlightedEntry ); - return pEntry ? pEntry->mnEntryId : -1; -} - -void ToolbarMenu::checkEntry( int nEntryId, bool bChecked ) -{ - ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); - if( pEntry && pEntry->mbChecked != bChecked ) - { - pEntry->mbChecked = bChecked; - Invalidate(); - } -} - -bool ToolbarMenu::isEntryChecked( int nEntryId ) const -{ - ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); - return pEntry && pEntry->mbChecked; -} - -void ToolbarMenu::enableEntry( int nEntryId, bool bEnable ) -{ - ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); - if( pEntry && pEntry->mbEnabled != bEnable ) - { - pEntry->mbEnabled = bEnable; - if( pEntry->mpControl ) - { - pEntry->mpControl->Enable( bEnable ); - - // hack for the valueset to make it paint itself anew - pEntry->mpControl->Resize(); - } - Invalidate(); - } -} - -bool ToolbarMenu::isEntryEnabled( int nEntryId ) const -{ - ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); - return pEntry && pEntry->mbEnabled; -} - -void ToolbarMenu::setEntryText( int nEntryId, const String& rStr ) -{ - ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); - if( pEntry && pEntry->maText != rStr ) - { - pEntry->maText = rStr; - maSize = implCalcSize(); - if( IsVisible() ) - Invalidate(); - } -} - -const String& ToolbarMenu::getEntryText( int nEntryId ) const -{ - ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); - if( pEntry ) - return pEntry->maText; - else - { - static String aEmptyStr; - return aEmptyStr; - } -} - -void ToolbarMenu::setEntryImage( int nEntryId, const Image& rImage ) -{ - ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); - if( pEntry && pEntry->maImage != rImage ) - { - pEntry->maImage = rImage; - maSize = implCalcSize(); - if( IsVisible() ) - Invalidate(); - } -} - -const Image& ToolbarMenu::getEntryImage( int nEntryId ) const -{ - ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); - if( pEntry ) - return pEntry->maImage; - else - { - static Image aEmptyImage; - return aEmptyImage; - } -} - -void ToolbarMenu::initWindow() -{ - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - SetControlBackground( GetSettings().GetStyleSettings().GetFaceGradientColor() ); - - SetPointFont( rStyleSettings.GetMenuFont() ); - SetBackground( Wallpaper( GetControlBackground() ) ); - SetTextColor( rStyleSettings.GetMenuTextColor() ); - SetTextFillColor(); - SetLineColor(); - - maSize = implCalcSize(); -} - -Size ToolbarMenu::implCalcSize() -{ - const long nFontHeight = GetTextHeight(); - long nExtra = nFontHeight/4; - - Size aSz; - Size aMaxImgSz; - long nMaxTextWidth = 0; - long nMinMenuItemHeight = nFontHeight; - sal_Bool bCheckable = sal_False; - - const int nEntryCount = maEntryVector.size(); - int nEntry; - - const StyleSettings& rSettings = GetSettings().GetStyleSettings(); - if ( rSettings.GetUseImagesInMenus() ) - { - nMinMenuItemHeight = 16; - - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; - if( pEntry && pEntry->mbHasImage ) - { - Size aImgSz = pEntry->maImage.GetSizePixel(); - if ( aImgSz.Height() > aMaxImgSz.Height() ) - aMaxImgSz.Height() = aImgSz.Height(); - if ( aImgSz.Height() > nMinMenuItemHeight ) - nMinMenuItemHeight = aImgSz.Height(); - break; - } - } - } - - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; - - if( pEntry ) - { - pEntry->maSize.Height() = 0; - pEntry->maSize.Width() = 0; - - - if ( ( pEntry->mnBits ) & ( MIB_RADIOCHECK | MIB_CHECKABLE ) ) - bCheckable = sal_True; - - // Image: - if( pEntry->mbHasImage ) - { - Size aImgSz = pEntry->maImage.GetSizePixel(); - if ( (aImgSz.Width() + 4) > aMaxImgSz.Width() ) - aMaxImgSz.Width() = aImgSz.Width() + 4; - if ( (aImgSz.Height() + 4) > aMaxImgSz.Height() ) - aMaxImgSz.Height() = aImgSz.Height() + 4; - if ( (aImgSz.Height() + 4) > pEntry->maSize.Height() ) - pEntry->maSize.Height() = aImgSz.Height() + 4; - } - } - } - - int gfxExtra = Max( nExtra, 7L ); - - if ( aMaxImgSz.Width() ) - mnTextPos += gfxExtra; - if ( bCheckable ) - mnTextPos += 16; - - mnCheckPos = nExtra; - mnImagePos = nExtra; - mnTextPos = mnImagePos + aMaxImgSz.Width(); - - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; - - if( pEntry ) - { - // Text: - if( pEntry->mbHasText ) - { - long nTextWidth = GetCtrlTextWidth( pEntry->maText ) + mnTextPos; - nMaxTextWidth = Max( nTextWidth, nMaxTextWidth ); - - pEntry->maSize.Height() = Max( Max( GetTextHeight(), pEntry->maSize.Height() ), nMinMenuItemHeight ); - } - // Control: - else if( pEntry->mpControl ) - { - Size aControlSize( pEntry->mpControl->GetOutputSizePixel() ); - - nMaxTextWidth = Max( aControlSize.Width(), nMaxTextWidth ); - pEntry->maSize.Height() = Max( aControlSize.Height(), pEntry->maSize.Height() ) + 1; - } - aSz.Height() += pEntry->maSize.Height(); - } - else - { - aSz.Height() += SEPARATOR_HEIGHT; - } - } - - aSz.Width() = nMaxTextWidth + (BORDER_X<<1); - aSz.Height() += BORDER_Y<<1; - - // positionate controls - int nY = BORDER_Y; - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; - - if( pEntry ) - { - if( pEntry->mpControl ) - { - Size aControlSize( pEntry->mpControl->GetOutputSizePixel() ); - Point aControlPos( (aSz.Width() - aControlSize.Width())>>1, nY); - if( pEntry->mbHasText ) - aControlPos.X() += GetCtrlTextWidth( pEntry->maText ) + 4*gfxExtra; - - pEntry->mpControl->SetPosPixel( aControlPos ); - } - - nY += pEntry->maSize.Height(); - } - else - { - nY += SEPARATOR_HEIGHT; - } - } - - return aSz; -} - -void ToolbarMenu::GetFocus() -{ - OSL_TRACE("ToolbarMenu::GetFocus()"); - - if( mnHighlightedEntry == -1 ) - { - implChangeHighlightEntry( 0 ); - } - DockingWindow::GetFocus(); -} - -void ToolbarMenu::LoseFocus() -{ - OSL_TRACE("ToolbarMenu::LoseFocus()"); - if( mnHighlightedEntry != -1 ) - { - implChangeHighlightEntry( -1 ); - } - DockingWindow::LoseFocus(); -} - -void ToolbarMenu::appendEntry( int nEntryId, const String& rStr, MenuItemBits nItemBits ) -{ - appendEntry( new ToolbarMenuEntry( nEntryId, rStr, nItemBits ) ); -} - -void ToolbarMenu::appendEntry( int nEntryId, const Image& rImage, MenuItemBits nItemBits ) -{ - appendEntry( new ToolbarMenuEntry( nEntryId, rImage, nItemBits ) ); -} - -void ToolbarMenu::appendEntry( int nEntryId, const String& rStr, const Image& rImage, MenuItemBits nItemBits ) -{ - appendEntry( new ToolbarMenuEntry( nEntryId, rImage, rStr, nItemBits ) ); -} - -void ToolbarMenu::appendEntry( int nEntryId, Control* pControl, MenuItemBits nItemBits ) -{ - appendEntry( new ToolbarMenuEntry( nEntryId, pControl, nItemBits ) ); -} -/* -void ToolbarMenu::appendEntry( int nEntryId, const String& rStr, Control* pControl, MenuItemBits nItemBits ) -{ - appendEntry( new ToolbarMenuEntry( nEntryId, rStr, pControl, nItemBits ) ); -} -*/ -void ToolbarMenu::appendEntry( ToolbarMenuEntry* pEntry ) -{ - maEntryVector.push_back( pEntry ); - maSize = implCalcSize(); - if( IsVisible() ) - Invalidate(); -} - -void ToolbarMenu::appendSeparator() -{ - appendEntry( 0 ); -} - -void ToolbarMenu::Resize() -{ - DockingWindow::Resize(); -} - -ToolbarMenuEntry* ToolbarMenu::implGetEntry( int nEntry ) const -{ - if( (nEntry < 0) || (nEntry >= (int)maEntryVector.size() ) ) - return NULL; - - return maEntryVector[nEntry]; -} - -ToolbarMenuEntry* ToolbarMenu::implSearchEntry( int nEntryId ) const -{ - const int nEntryCount = maEntryVector.size(); - int nEntry; - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* p = maEntryVector[nEntry]; - if( p && p->mnEntryId == nEntryId ) - { - return p; - } - } - - return NULL; -} - -static void implDeselectControl( Control* pControl ) -{ - ValueSet* pValueSet = dynamic_cast< ValueSet* >( pControl ); - if( pValueSet ) - { - pValueSet->SetNoSelection(); - pValueSet->Invalidate(); - } -} - -void ToolbarMenu::implHighlightEntry( int nHighlightEntry, bool bHighlight ) -{ - Size aSz = GetOutputSizePixel(); - long nY = BORDER_Y; - long nX = BORDER_X; - - const int nEntryCount = maEntryVector.size(); - int nEntry; - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* p = maEntryVector[nEntry]; - if( p ) - { - if(nEntry == nHighlightEntry) - { - if( (p->mpControl == NULL) || (p->mbHasText) ) - { - Rectangle aRect( Point( nX, nY ), Size( aSz.Width()-(BORDER_X<<1), p->maSize.Height() ) ); - SetFillColor( GetSettings().GetStyleSettings().GetMenuColor() ); - SetLineColor(); - DrawRect( aRect ); - - if( bHighlight ) - { - aRect.nLeft += 1; - aRect.nTop += 1; - aRect.nBottom -= 1; - aRect.nRight -= 1; - DrawSelectionBackground( aRect, true, false, TRUE, TRUE ); - } - } - else if( p->mpControl != NULL ) - { - implDeselectControl( p->mpControl ); - } - - implPaint( p, bHighlight ); - - maHighlightHdl.Call( this ); - break; - } - - nY += p->maSize.Height(); - } - else - { - nY += SEPARATOR_HEIGHT; - } - } -} - -void ToolbarMenu::implSelectEntry( int nSelectedEntry ) -{ - mnSelectedEntry = nSelectedEntry; - - ToolbarMenuEntry* pEntry = NULL; - if( nSelectedEntry != -1 ) - pEntry = maEntryVector[ nSelectedEntry ]; - - if( pEntry ) - maSelectHdl.Call( this ); -} - -void ToolbarMenu::MouseButtonDown( const MouseEvent& rMEvt ) -{ - implHighlightEntry( rMEvt, true ); - - implSelectEntry( mnHighlightedEntry ); -} - -void ToolbarMenu::MouseButtonUp( const MouseEvent& ) -{ -} - -void ToolbarMenu::MouseMove( const MouseEvent& rMEvt ) -{ - if ( !IsVisible() ) - return; - - implHighlightEntry( rMEvt, false ); -} - -void ToolbarMenu::implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown ) -{ - long nY = 0; - long nMouseY = rMEvt.GetPosPixel().Y(); - Size aOutSz = GetOutputSizePixel(); - if ( ( nMouseY >= 0 ) && ( nMouseY < aOutSz.Height() ) ) - { - bool bHighlighted = FALSE; - - const int nEntryCount = maEntryVector.size(); - int nEntry; - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; - if( pEntry ) - { - long nOldY = nY; - nY += pEntry->maSize.Height(); - - if( pEntry->mnEntryId != TITLE_ID ) - { - if ( ( nOldY <= nMouseY ) && ( nY > nMouseY ) ) - { - if( bMBDown ) - { - if( nEntry != mnHighlightedEntry ) - { - implChangeHighlightEntry( nEntry ); - } - } - else - { - if ( nEntry != mnHighlightedEntry ) - { - implChangeHighlightEntry( nEntry ); - } - } - bHighlighted = true; - } - } - } - else - { - nY += SEPARATOR_HEIGHT; - } - } - if ( !bHighlighted ) - implChangeHighlightEntry( -1 ); - } - else - { - implChangeHighlightEntry( -1 ); - } -} - -void ToolbarMenu::implChangeHighlightEntry( int nEntry ) -{ - if( mnHighlightedEntry != -1 ) - { - implHighlightEntry( mnHighlightedEntry, false ); - } - - mnHighlightedEntry = nEntry; -// Invalidate(); - - if( mnHighlightedEntry != -1 ) - { - implHighlightEntry( mnHighlightedEntry, true ); - } -} - -static bool implCheckSubControlCursorMove( Control* pControl, bool bUp ) -{ - ValueSet* pValueSet = dynamic_cast< ValueSet* >( pControl ); - if( pValueSet ) - { - USHORT nItemPos = pValueSet->GetItemPos( pValueSet->GetSelectItemId() ); - if( nItemPos != VALUESET_ITEM_NOTFOUND ) - { - const USHORT nColCount = pValueSet->GetColCount(); - const USHORT nLine = nItemPos / nColCount; - - if( bUp ) - { - return nLine > 0; - } - else - { - const USHORT nLineCount = (pValueSet->GetItemCount() + nColCount - 1) / nColCount; - return (nLine+1) < nLineCount; - } - } - } - - return false; -} - -ToolbarMenuEntry* ToolbarMenu::implCursorUpDown( bool bUp, bool bHomeEnd ) -{ - int n = mnHighlightedEntry; - if( n == -1 ) - { - if( bUp ) - n = 0; - else - n = maEntryVector.size()-1; - } - else if( !bHomeEnd ) - { - // if we have a currently selected entry and - // cursor keys are used than check if this entry - // has a control that can use those cursor keys - ToolbarMenuEntry* pData = maEntryVector[n]; - if( pData && pData->mpControl && !pData->mbHasText ) - { - if( implCheckSubControlCursorMove( pData->mpControl, bUp ) ) - return pData; - } - } - - int nLoop = n; - - if( bHomeEnd ) - { - // absolute positioning - if( bUp ) - { - n = maEntryVector.size(); - nLoop = n-1; - } - else - { - n = -1; - nLoop = n+1; - } - } - - do - { - if( bUp ) - { - if ( n ) - n--; - else - if( mnHighlightedEntry == -1 ) - n = maEntryVector.size()-1; - else - break; - } - else - { - if( n < ((int)maEntryVector.size()-1) ) - n++; - else - if( mnHighlightedEntry == -1 ) - n = 0; - else - break; - } - - ToolbarMenuEntry* pData = maEntryVector[n]; - if( pData && (pData->mnEntryId != TITLE_ID) ) - { - implChangeHighlightEntry( n ); - return pData; - } - } while ( n != nLoop ); - - return 0; -} - -void ToolbarMenu::KeyInput( const KeyEvent& rKEvent ) -{ - OSL_TRACE("ToolbarMenu::KeyInput()"); - Control* pForwardControl = 0; - USHORT nCode = rKEvent.GetKeyCode().GetCode(); - switch ( nCode ) - { - case KEY_UP: - case KEY_DOWN: - { - int nOldEntry = mnHighlightedEntry; - ToolbarMenuEntry*p = implCursorUpDown( nCode == KEY_UP, false ); - if( p && p->mpControl && !p->mbHasText ) - { - OSL_TRACE("ToolbarMenu::KeyInput() - grab focus to control"); -// p->mpControl->GrabFocus(); - if( nOldEntry != mnHighlightedEntry ) - { - KeyCode aKeyCode( (nCode == KEY_UP) ? KEY_END : KEY_HOME ); - KeyEvent aKeyEvent( 0, aKeyCode ); - p->mpControl->KeyInput( aKeyEvent ); - p->mpControl->Invalidate(); - p->mpControl->Update(); - } - else if( !p->mpControl->HasFocus() ) - { - // in case we are in a system floating window, GrabFocus does not work :-/ - pForwardControl = p->mpControl; - } - } - } - break; - case KEY_END: - case KEY_HOME: - { - ToolbarMenuEntry* p = implCursorUpDown( nCode == KEY_END, true ); - if( p && p->mpControl && !p->mbHasText ) - { -// p->mpControl->GrabFocus(); - KeyCode aKeyCode( KEY_HOME ); - KeyEvent aKeyEvent( 0, aKeyCode ); - p->mpControl->KeyInput( aKeyEvent ); - p->mpControl->Invalidate(); - p->mpControl->Update(); - } - } - break; - case KEY_F6: - case KEY_ESCAPE: - { - // Ctrl-F6 acts like ESC here, the menu bar however will then put the focus in the document -// if( nCode == KEY_F6 && !rKEvent.GetKeyCode().IsMod1() ) -// break; - - implSelectEntry( -1 ); - } - break; - - case KEY_RETURN: - { - ToolbarMenuEntry* pEntry = implGetEntry( mnHighlightedEntry ); - if ( pEntry && pEntry->mbEnabled && (pEntry->mnEntryId != TITLE_ID) ) - { - if( pEntry->mpControl ) - { - pForwardControl = pEntry->mpControl; - } - else - { - implSelectEntry( mnHighlightedEntry ); - } - } - } - break; - default: - { - ToolbarMenuEntry* pEntry = implGetEntry( mnHighlightedEntry ); - if ( pEntry && pEntry->mbEnabled && pEntry->mpControl && !pEntry->mbHasText ) - { -// pEntry->mpControl->GrabFocus(); - pForwardControl = pEntry->mpControl; - } - } - - } - if( pForwardControl ) - pForwardControl->KeyInput( rKEvent ); - -} - -void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) -{ - const long nFontHeight = GetTextHeight(); - const long nExtra = nFontHeight/4; - - DecorationView aDecoView( this ); - const StyleSettings& rSettings = GetSettings().GetStyleSettings(); - - const Size aOutSz( GetOutputSizePixel() ); - - Point aTopLeft( BORDER_X, BORDER_Y ), aTmpPos; - - const int nEntryCount = maEntryVector.size(); - int nEntry; - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; - Point aPos( aTopLeft ); - - USHORT nTextStyle = 0; - USHORT nSymbolStyle = 0; - USHORT nImageStyle = 0; - if( pEntry && !pEntry->mbEnabled ) - { - nTextStyle |= TEXT_DRAW_DISABLE; - nSymbolStyle |= SYMBOL_DRAW_DISABLE; - nImageStyle |= IMAGE_DRAW_DISABLE; - } - - // Separator - if( pEntry == NULL ) - { - if( pThisOnly == NULL ) - { - aTmpPos.Y() = aPos.Y() + ((SEPARATOR_HEIGHT-2)/2); - - SetLineColor( rSettings.GetShadowColor() ); - DrawLine( aTmpPos, Point( aOutSz.Width() - 3, aTmpPos.Y() ) ); - aTmpPos.Y()++; - SetLineColor( rSettings.GetLightColor() ); - DrawLine( aTmpPos, Point( aOutSz.Width() - 3, aTmpPos.Y() ) ); - SetLineColor(); - } - - aTopLeft.Y() += SEPARATOR_HEIGHT; - } - else - { - if( !pThisOnly || ( pEntry == pThisOnly ) ) - { - const bool bTitle = pEntry->mnEntryId == TITLE_ID; - - if( pThisOnly && bHighlighted ) - SetTextColor( rSettings.GetMenuHighlightTextColor() ); - else - SetTextColor( rSettings.GetMenuTextColor() ); - - Rectangle aRect( aTopLeft, Size( aOutSz.Width(), pEntry->maSize.Height() ) ); - if( bTitle ) - { - // fill the background - SetFillColor(rSettings.GetDialogColor()); - SetLineColor(); - DrawRect(aRect); - SetLineColor( rSettings.GetLightColor() ); - DrawLine( aRect.TopLeft(), aRect.TopRight() ); - SetLineColor( rSettings.GetShadowColor() ); - DrawLine( aRect.BottomLeft(), aRect.BottomRight() ); - } - else if( pEntry->mpControl ) - { - SetLineColor( rSettings.GetShadowColor() ); - DrawLine( aRect.BottomLeft(), aRect.BottomRight() ); - } - - long nTextOffsetY = ((pEntry->maSize.Height()-nFontHeight)/2); - - // Image - if( pEntry->mbHasImage ) - { - aTmpPos.X() = aPos.X() + mnImagePos; - aTmpPos.Y() = aPos.Y(); - aTmpPos.Y() += (pEntry->maSize.Height()-pEntry->maImage.GetSizePixel().Height())/2; - DrawImage( aTmpPos, pEntry->maImage, nImageStyle ); - } - // Text: - if( pEntry->mbHasText ) - { - aTmpPos.X() = aPos.X() + (bTitle ? 4 : mnTextPos); - aTmpPos.Y() = aPos.Y(); - aTmpPos.Y() += nTextOffsetY; - USHORT nStyle = nTextStyle|TEXT_DRAW_MNEMONIC; - - DrawCtrlText( aTmpPos, pEntry->maText, 0, pEntry->maText.Len(), nStyle ); - } - - // CheckMark - if( pEntry->mbChecked ) - { - if( pEntry->mbHasImage ) - { - aTmpPos.X() = aPos.X() + mnImagePos; - aTmpPos.Y() = aPos.Y(); - aTmpPos.Y() += (pEntry->maSize.Height()-pEntry->maImage.GetSizePixel().Height())/2; - - Rectangle aSelRect( aTmpPos, pEntry->maImage.GetSizePixel() ); - aSelRect.nLeft -= 2; - aSelRect.nTop -= 2; - aSelRect.nRight += 2; - aSelRect.nBottom += 2; - DrawSelectionBackground( aSelRect, false, true, TRUE, TRUE ); - } - else - { - Rectangle aSelRect; - SymbolType eSymbol; - aTmpPos.Y() = aPos.Y(); - aTmpPos.Y() += nExtra/2; - aTmpPos.Y() += pEntry->maSize.Height() / 2; - if ( pEntry->mnBits & MIB_RADIOCHECK ) - { - aTmpPos.X() = aPos.X() + mnCheckPos; - eSymbol = SYMBOL_RADIOCHECKMARK; - aTmpPos.Y() -= nFontHeight/4; - aSelRect = Rectangle( aTmpPos, Size( nFontHeight/2, nFontHeight/2 ) ); - } - else - { - aTmpPos.X() = aPos.X() + mnCheckPos; - eSymbol = SYMBOL_CHECKMARK; - aTmpPos.Y() -= nFontHeight/4; - aSelRect = Rectangle( aTmpPos, Size( (nFontHeight*25)/40, nFontHeight/2 ) ); - } - aDecoView.DrawSymbol( aSelRect, eSymbol, GetTextColor(), nSymbolStyle ); - } - } - } - - aTopLeft.Y() += pEntry->maSize.Height(); - } - } -} - -void ToolbarMenu::Paint( const Rectangle& ) -{ - implPaint(); - - if( mnHighlightedEntry != -1 ) - implHighlightEntry( mnHighlightedEntry, true ); -} - -void ToolbarMenu::RequestHelp( const HelpEvent& rHEvt ) -{ - DockingWindow::RequestHelp( rHEvt ); -} - -void ToolbarMenu::StateChanged( StateChangedType nType ) -{ - DockingWindow::StateChanged( nType ); - - if ( ( nType == STATE_CHANGE_CONTROLFOREGROUND ) || ( nType == STATE_CHANGE_CONTROLBACKGROUND ) ) - { - initWindow(); - Invalidate(); - } -} - -void ToolbarMenu::DataChanged( const DataChangedEvent& rDCEvt ) -{ - DockingWindow::DataChanged( rDCEvt ); - - if ( (rDCEvt.GetType() == DATACHANGED_FONTS) || - (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) || - ((rDCEvt.GetType() == DATACHANGED_SETTINGS) && - (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) - { - initWindow(); - Invalidate(); - } -} - -void ToolbarMenu::Command( const CommandEvent& rCEvt ) -{ - if ( rCEvt.GetCommand() == COMMAND_WHEEL ) - { - const CommandWheelData* pData = rCEvt.GetWheelData(); - if( !pData->GetModifier() && ( pData->GetMode() == COMMAND_WHEEL_SCROLL ) ) - { - implCursorUpDown( pData->GetDelta() > 0L, false ); - } - } -} - -// todo: move to new base class that will replace SfxPopupWindo -void ToolbarMenu::AddStatusListener( const rtl::OUString& rCommandURL ) -{ - initStatusListener(); - mxStatusListener->addStatusListener( rCommandURL ); -} - -// -------------------------------------------------------------------- - -void ToolbarMenu::RemoveStatusListener( const rtl::OUString& rCommandURL ) -{ - mxStatusListener->removeStatusListener( rCommandURL ); -} -// -------------------------------------------------------------------- - - -void ToolbarMenu::UpdateStatus( const rtl::OUString& rCommandURL ) -{ - mxStatusListener->updateStatus( rCommandURL ); -} - -// -------------------------------------------------------------------- - -// XStatusListener (subclasses must override this one to get the status updates -void SAL_CALL ToolbarMenu::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& /*Event*/ ) throw ( ::com::sun::star::uno::RuntimeException ) -{ -} - -// -------------------------------------------------------------------- - -class ToolbarMenuStatusListener : public svt::FrameStatusListener -{ -public: - ToolbarMenuStatusListener( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, - ToolbarMenu& rToolbarMenu ); - - virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); - - ToolbarMenu* mpMenu; -}; - -ToolbarMenuStatusListener::ToolbarMenuStatusListener( - const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, - ToolbarMenu& rToolbarMenu ) -: svt::FrameStatusListener( xServiceManager, xFrame ) -, mpMenu( &rToolbarMenu ) -{ -} - -void SAL_CALL ToolbarMenuStatusListener::dispose() throw (::com::sun::star::uno::RuntimeException) -{ - mpMenu = 0; - svt::FrameStatusListener::dispose(); -} - -void SAL_CALL ToolbarMenuStatusListener::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) -{ - if( mpMenu ) - mpMenu->statusChanged( Event ); -} - -void ToolbarMenu::initStatusListener() -{ - if( !mxStatusListener.is() ) - mxStatusListener.set( new ToolbarMenuStatusListener( mxServiceManager, mxFrame, *this ) ); -} - -bool ToolbarMenu::IsInPopupMode() -{ - return GetDockingManager()->IsInPopupMode(this); -} - -void ToolbarMenu::EndPopupMode() -{ - GetDockingManager()->EndPopupMode(this); -} - - diff --git a/svx/source/toolbars/extrusionbar.cxx b/svx/source/toolbars/extrusionbar.cxx index daf1f23d4442..3005289268b9 100644 --- a/svx/source/toolbars/extrusionbar.cxx +++ b/svx/source/toolbars/extrusionbar.cxx @@ -53,7 +53,8 @@ #include "chrtitem.hxx" #include -#include "extrusioncontrols.hxx" +#include "extrusiondepthdialog.hxx" + using namespace ::svx; using namespace ::rtl; diff --git a/svx/source/unodraw/unoctabl.cxx b/svx/source/unodraw/unoctabl.cxx index 5dd4814c6ab5..8b4351cc8df0 100644 --- a/svx/source/unodraw/unoctabl.cxx +++ b/svx/source/unodraw/unoctabl.cxx @@ -233,9 +233,7 @@ uno::Reference< uno::XInterface > SAL_CALL create_EnhancedCustomShapeEngine( con // export this service // -#ifndef SVX_LIGHT #include "UnoGraphicExporter.hxx" -#endif #include "unogalthemeprovider.hxx" #include #include "sal/types.h" @@ -244,6 +242,15 @@ uno::Reference< uno::XInterface > SAL_CALL create_EnhancedCustomShapeEngine( con #include "uno/lbnames.h" #include +/* +namespace svx +{ +extern OUString SAL_CALL ExtrusionDepthController_getImplementationName(); +extern uno::Reference< uno::XInterface > SAL_CALL ExtrusionDepthController_createInstance(const uno::Reference< lang::XMultiServiceFactory > &) throw( uno::RuntimeException ); +extern uno::Sequence< OUString > SAL_CALL ExtrusionDepthController_getSupportedServiceNames() throw( uno::RuntimeException ); +} +*/ + extern "C" { @@ -279,9 +286,7 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( writeInfo( pKey, SvxUnoColorTable::getImplementationName_Static(), SvxUnoColorTable::getSupportedServiceNames_Static() ); writeInfo( pKey, EnhancedCustomShapeEngine_getImplementationName(), EnhancedCustomShapeEngine_getSupportedServiceNames() ); writeInfo( pKey, svx::RecoveryUI::st_getImplementationName(), svx::RecoveryUI::st_getSupportedServiceNames() ); -#ifndef SVX_LIGHT writeInfo( pKey, svx::GraphicExporter_getImplementationName(), svx::GraphicExporter_getSupportedServiceNames() ); -#endif writeInfo( pKey, svx::FontHeightToolBoxControl::getImplementationName_Static(), svx::FontHeightToolBoxControl::getSupportedServiceNames_Static() ); writeInfo( pKey, ::unogallery::GalleryThemeProvider_getImplementationName(),::unogallery::GalleryThemeProvider_getSupportedServiceNames() ); @@ -292,6 +297,7 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( writeInfo( pKey, ::svx::SvXMLGraphicImportHelper_getImplementationName(),::svx::SvXMLGraphicImportHelper_getSupportedServiceNames() ); writeInfo( pKey, ::svx::SvXMLGraphicExportHelper_getImplementationName(),::svx::SvXMLGraphicExportHelper_getSupportedServiceNames() ); +// writeInfo( pKey, ::svx::ExtrusionDepthController_getImplementationName(),::svx::ExtrusionDepthController_getSupportedServiceNames() ); } catch (registry::InvalidRegistryException &) { @@ -338,7 +344,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( svx::RecoveryUI::st_createInstance, svx::RecoveryUI::st_getSupportedServiceNames() ); } -#ifndef SVX_LIGHT else if( svx::GraphicExporter_getImplementationName().equalsAscii( pImplName ) ) { xFactory = ::cppu::createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), @@ -346,7 +351,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( svx::GraphicExporter_createInstance, svx::GraphicExporter_getSupportedServiceNames() ); } -#endif else if ( svx::FontHeightToolBoxControl::getImplementationName_Static().equalsAscii( pImplName ) ) { xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), @@ -385,7 +389,16 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( ::svx::SvXMLGraphicExportHelper_createInstance, ::svx::SvXMLGraphicExportHelper_getSupportedServiceNames() ); } - +/* + else if( ::svx::ExtrusionDepthController_getImplementationName().equalsAscii( pImplName ) ) + { + xFactory = ::cppu::createSingleFactory( + reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), + ::svx::ExtrusionDepthController_getImplementationName(), + ::svx::ExtrusionDepthController_createInstance, + ::svx::ExtrusionDepthController_getSupportedServiceNames() ); + } +*/ if( xFactory.is()) { xFactory->acquire(); diff --git a/svx/util/makefile.mk b/svx/util/makefile.mk index 0006fa2ff5fe..050decc8d4f5 100644 --- a/svx/util/makefile.mk +++ b/svx/util/makefile.mk @@ -45,6 +45,10 @@ SHL1TARGET= svxcore$(DLLPOSTFIX) SHL1IMPLIB= isvxcore SHL1USE_EXPORTS=name +SHL1OBJS= \ + $(SLO)$/coreservices.obj + + SHL1LIBS= \ $(SLB)$/animation.lib \ $(SLB)$/attribute.lib \ -- cgit From 8c665456f0e7596d2d154d260a44382192203389 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Thu, 25 Mar 2010 12:33:15 +0100 Subject: reworked ExtrusionDepthContoller to use toolbarmenu again --- svx/inc/svx/dialogs.hrc | 16 -- svx/source/tbxctrls/extrusioncontrols.cxx | 295 ++++++++++++++++-------------- svx/source/tbxctrls/extrusioncontrols.hxx | 49 +++-- svx/source/tbxctrls/extrusioncontrols.src | 145 ++++++++------- 4 files changed, 266 insertions(+), 239 deletions(-) (limited to 'svx') diff --git a/svx/inc/svx/dialogs.hrc b/svx/inc/svx/dialogs.hrc index 10e0bf3fbed4..d193652b57fc 100644 --- a/svx/inc/svx/dialogs.hrc +++ b/svx/inc/svx/dialogs.hrc @@ -379,19 +379,6 @@ #define RID_SVXDLG_TEXTCONTROL_CHARATTR (RID_SVX_START + 286) #define RID_SVXDLG_TEXTCONTROL_PARAATTR (RID_SVX_START + 287) -#define RID_SVXIMG_EXTRUSION_DEPTH_0 (RID_SVX_START + 288) -#define RID_SVXIMG_EXTRUSION_DEPTH_1 (RID_SVX_START + 289) -#define RID_SVXIMG_EXTRUSION_DEPTH_2 (RID_SVX_START + 290) -#define RID_SVXIMG_EXTRUSION_DEPTH_3 (RID_SVX_START + 291) -#define RID_SVXIMG_EXTRUSION_DEPTH_4 (RID_SVX_START + 292) -#define RID_SVXIMG_EXTRUSION_DEPTH_0_H (RID_SVX_START + 293) -#define RID_SVXIMG_EXTRUSION_DEPTH_1_H (RID_SVX_START + 294) -#define RID_SVXIMG_EXTRUSION_DEPTH_2_H (RID_SVX_START + 295) -#define RID_SVXIMG_EXTRUSION_DEPTH_3_H (RID_SVX_START + 296) -#define RID_SVXIMG_EXTRUSION_DEPTH_4_H (RID_SVX_START + 297) -#define RID_SVXIMG_EXTRUSION_DEPTH_INFINITY (RID_SVX_START + 298) -#define RID_SVXIMG_EXTRUSION_DEPTH_INFINITY_H (RID_SVX_START + 299) - // !!! please update RID_SVX_FIRSTFREE !!! see line 46 // Strings ------------------------------------------------------------------ @@ -625,9 +612,6 @@ #define RID_SVXSTR_SEABLUE (RID_SVX_START + 546) #define RID_SVXSTR_COLOR_SUN (RID_SVX_START + 547) -#define RID_SVXSTR_EXTRUSION_CUSTOM (RID_SVX_START + 548) -#define RID_SVXSTR_EXTRUSION_INFINITY (RID_SVX_START + 549) - // JP: string resource ids for table-autoformat-names, used in SW/SC // !!! Urgent: the order of Ids is persistent. New Ids have to append !!! #define RID_SVXSTR_TBLAFMT_BEGIN (RID_SVX_START + 560) diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx index 2fdc95bb28fb..7300fe8048b3 100644 --- a/svx/source/tbxctrls/extrusioncontrols.cxx +++ b/svx/source/tbxctrls/extrusioncontrols.cxx @@ -123,6 +123,7 @@ ExtrusionDirectionWindow::ExtrusionDirectionWindow( svt::ToolboxController& rCon mpDirectionSet->SetOutputSizePixel( Size( 72, 72 ) ); appendEntry( 2, mpDirectionSet ); + appendSeparator(); appendEntry( 0, String( SVX_RES( STR_PERSPECTIVE ) ), bHighContrast ? maImgPerspectiveH : maImgPerspective ); appendEntry( 1, String( SVX_RES( STR_PARALLEL ) ), bHighContrast ? maImgParallelH : maImgParallel ); @@ -251,11 +252,9 @@ IMPL_LINK( ExtrusionDirectionWindow, SelectHdl, void *, pControl ) return 0; } -/************************************************************************* -|* -|* SvxLineEndToolBoxControl -|* -\************************************************************************/ +// ======================================================================= +// ExtrusionDirectionControl +// ======================================================================= ExtrusionDirectionControl::ExtrusionDirectionControl( const Reference< lang::XMultiServiceFactory >& rServiceManager ) : svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirectionFloater" ) ) ) @@ -340,148 +339,96 @@ double ExtrusionDepthDialog::getDepth() const double aDepthListInch[] = { 0, 1270,2540,5080,10160 }; double aDepthListMM[] = { 0, 1000, 2500, 5000, 10000 }; -ExtrusionDepthController::ExtrusionDepthController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) -: svt::PopupMenuControllerBase( xServiceManager ) +ExtrusionDepthWindow::ExtrusionDepthWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) +: ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_DIRECTION )) +, mrController( rController ) +, maImgDepth0( SVX_RES( IMG_DEPTH_0 ) ) +, maImgDepth1( SVX_RES( IMG_DEPTH_1 ) ) +, maImgDepth2( SVX_RES( IMG_DEPTH_2 ) ) +, maImgDepth3( SVX_RES( IMG_DEPTH_3 ) ) +, maImgDepth4( SVX_RES( IMG_DEPTH_4 ) ) +, maImgDepthInfinity( SVX_RES( IMG_DEPTH_INFINITY ) ) +, maImgDepth0h( SVX_RES( IMG_DEPTH_0_H ) ) +, maImgDepth1h( SVX_RES( IMG_DEPTH_1_H ) ) +, maImgDepth2h( SVX_RES( IMG_DEPTH_2_H ) ) +, maImgDepth3h( SVX_RES( IMG_DEPTH_3_H ) ) +, maImgDepth4h( SVX_RES( IMG_DEPTH_4_H ) ) +, maImgDepthInfinityh( SVX_RES( IMG_DEPTH_INFINITY_H ) ) , mfDepth( -1.0 ) , msExtrusionDepth( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepth" ) ) , msMetricUnit( RTL_CONSTASCII_USTRINGPARAM( ".uno:MetricUnit" ) ) { - for( int i = 0; i < 5; i++ ) - { - maImgDepth[i] = Image( SVX_RES( RID_SVXIMG_EXTRUSION_DEPTH_0 + i ) ); - maImgDepth_hc[i] = Image( SVX_RES( RID_SVXIMG_EXTRUSION_DEPTH_0_H + i ) ); - } + SetHelpId( HID_MENU_EXTRUSION_DEPTH ); - maImgDepthInfinity = Image( SVX_RES( RID_SVXIMG_EXTRUSION_DEPTH_INFINITY ) ); - maImgDepthInfinityh = Image( SVX_RES( RID_SVXIMG_EXTRUSION_DEPTH_INFINITY_H ) ); -} + SetSelectHdl( LINK( this, ExtrusionDepthWindow, SelectHdl ) ); -// XPopupMenuController -void SAL_CALL ExtrusionDepthController::updatePopupMenu() throw (RuntimeException) -{ - const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); - bool bShowImages( rSettings.GetUseImagesInMenus() ); - bool bHiContrast( rSettings.GetHighContrastMode() ); + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - updateCommand( msExtrusionDepth ); - updateCommand( msMetricUnit ); + String aEmpty; + appendEntry( 0, aEmpty, bHighContrast ? maImgDepth0h : maImgDepth0 ); + appendEntry( 1, aEmpty, bHighContrast ? maImgDepth1h : maImgDepth1 ); + appendEntry( 2, aEmpty, bHighContrast ? maImgDepth2h : maImgDepth2 ); + appendEntry( 3, aEmpty, bHighContrast ? maImgDepth3h : maImgDepth3 ); + appendEntry( 4, aEmpty, bHighContrast ? maImgDepth4h : maImgDepth4 ); + appendEntry( 5, String( SVX_RES( STR_INFINITY ) ), bHighContrast ? maImgDepthInfinityh : maImgDepthInfinity ); + appendEntry( 6, String( SVX_RES( STR_CUSTOM ) ) ); - Reference< awt::XPopupMenuExtended > xPopupMenu( m_xPopupMenu, UNO_QUERY ); - if( xPopupMenu.is() ) - { - // clear existing entries - if( m_xPopupMenu->getItemCount() ) - m_xPopupMenu->removeItem( 0, m_xPopupMenu->getItemCount() ); + SetOutputSizePixel( getMenuSize() ); - USHORT nResource = IsMetric( meUnit ) ? RID_SVXSTR_DEPTH_0 : RID_SVXSTR_DEPTH_0_INCH; + FreeResource(); - Reference< XGraphic > xGraphic; + AddStatusListener( msExtrusionDepth ); + AddStatusListener( msMetricUnit ); +} - for( int i = 0; i < 5; i++ ) - { - OUString aStr( String( SVX_RES( nResource + i ) ) ); - m_xPopupMenu->insertItem( i+1, aStr, awt::MenuItemStyle::CHECKABLE, i+1 ); - if( bShowImages ) - { - if( bHiContrast ) - xGraphic = maImgDepth_hc[i].GetXGraphic(); - else - xGraphic = maImgDepth[i].GetXGraphic(); - } - xPopupMenu->setItemImage( i+1, xGraphic, sal_False ); +// ----------------------------------------------------------------------- - xPopupMenu->checkItem( i+1, (mfDepth == (IsMetric( meUnit ) ? aDepthListMM[i] : aDepthListInch[i])) ? TRUE : FALSE ); +void ExtrusionDepthWindow::implSetDepth( double fDepth ) +{ + mfDepth = fDepth; + int i; + for( i = 0; i < 7; i++ ) + { + if( i == 5 ) + { + checkEntry( i, fDepth >= 338666 ); } - - if( bShowImages ) + else if( i != 6 ) { - if( bHiContrast ) - xGraphic = maImgDepthInfinityh.GetXGraphic(); - else - xGraphic = maImgDepthInfinity.GetXGraphic(); + checkEntry( i, (fDepth == (IsMetric( meUnit ) ? aDepthListMM[i] : aDepthListInch[i]) ) ); } - m_xPopupMenu->insertItem( 6, OUString( String( SVX_RES( RID_SVXSTR_EXTRUSION_INFINITY ) ) ), awt::MenuItemStyle::CHECKABLE, 6 ); - xPopupMenu->setItemImage( 6, xGraphic, sal_False ); - xPopupMenu->checkItem( 6, (mfDepth >= 338666) ? TRUE : FALSE ); - - m_xPopupMenu->insertItem( 7, OUString( String( SVX_RES( RID_SVXSTR_EXTRUSION_CUSTOM ) ) ), awt::MenuItemStyle::CHECKABLE, 7 ); } } // ----------------------------------------------------------------------- -ExtrusionDepthController::~ExtrusionDepthController() -{ -} - -// ----------------------------------------------------------------------- -// XEventListener -// ----------------------------------------------------------------------- - -void SAL_CALL ExtrusionDepthController::disposing( const EventObject& ) throw ( RuntimeException ) -{ - Reference< awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); - - osl::MutexGuard aLock( m_aMutex ); - m_xFrame.clear(); - m_xDispatch.clear(); - m_xServiceManager.clear(); - - if ( m_xPopupMenu.is() ) - m_xPopupMenu->removeMenuListener( Reference< awt::XMenuListener >(( OWeakObject *)this, UNO_QUERY )); - m_xPopupMenu.clear(); -} - -// ----------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------- - -OUString SAL_CALL ExtrusionDepthController_getImplementationName() -{ - return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionDepthController" )); -} - -// -------------------------------------------------------------------- - -Sequence< OUString > SAL_CALL ExtrusionDepthController_getSupportedServiceNames() throw( RuntimeException ) -{ - Sequence< OUString > aSNS( 1 ); - aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.PopupMenuController" )); - return aSNS; -} - -// -------------------------------------------------------------------- - -Reference< XInterface > SAL_CALL SAL_CALL ExtrusionDepthController_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) -{ - return *new ExtrusionDepthController( rSMgr ); -} - -// -------------------------------------------------------------------- - -OUString SAL_CALL ExtrusionDepthController::getImplementationName( ) throw (RuntimeException) +void ExtrusionDepthWindow::implFillStrings( FieldUnit eUnit ) { - return ExtrusionDepthController_getImplementationName(); -} + meUnit = eUnit; + USHORT nResource = IsMetric( eUnit ) ? RID_SVXSTR_DEPTH_0 : RID_SVXSTR_DEPTH_0_INCH; -// -------------------------------------------------------------------- - -Sequence< OUString > SAL_CALL ExtrusionDepthController::getSupportedServiceNames( ) throw (RuntimeException) -{ - return ExtrusionDepthController_getSupportedServiceNames(); + for( int i = 0; i < 5; i++ ) + { + String aStr( SVX_RES( nResource + i ) ); + setEntryText( i, aStr ); + }; } -// ----------------------------------------------------------------------- -// XStatusListener // ----------------------------------------------------------------------- -void SAL_CALL ExtrusionDepthController::statusChanged( const frame::FeatureStateEvent& Event ) throw ( RuntimeException ) +void SAL_CALL ExtrusionDepthWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) { if( Event.FeatureURL.Main.equals( msExtrusionDepth ) ) { - if( Event.IsEnabled ) + if( !Event.IsEnabled ) { - Event.State >>= mfDepth; + implSetDepth( 0 ); + } + else + { + double fValue = 0.0; + if( Event.State >>= fValue ) + implSetDepth( fValue ); } } else if( Event.FeatureURL.Main.equals( msMetricUnit ) ) @@ -490,69 +437,140 @@ void SAL_CALL ExtrusionDepthController::statusChanged( const frame::FeatureState { sal_Int32 nValue = 0; if( Event.State >>= nValue ) - meUnit = (FieldUnit)nValue; + { + implFillStrings( static_cast(nValue) ); + if( mfDepth >= 0.0 ) + implSetDepth( mfDepth ); + } } } } // ----------------------------------------------------------------------- -// XMenuListener + +void ExtrusionDepthWindow::DataChanged( const DataChangedEvent& rDCEvt ) +{ + ToolbarMenu::DataChanged( rDCEvt ); + + if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) + { + bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); + + setEntryImage( 0, bHighContrast ? maImgDepth0h : maImgDepth0 ); + setEntryImage( 1, bHighContrast ? maImgDepth1h : maImgDepth1 ); + setEntryImage( 2, bHighContrast ? maImgDepth2h : maImgDepth2 ); + setEntryImage( 3, bHighContrast ? maImgDepth3h : maImgDepth3 ); + setEntryImage( 4, bHighContrast ? maImgDepth4h : maImgDepth4 ); + setEntryImage( 5, bHighContrast ? maImgDepthInfinityh : maImgDepthInfinity ); + } +} + + // ----------------------------------------------------------------------- -void SAL_CALL ExtrusionDepthController::select( const awt::MenuEvent& rEvent ) throw (RuntimeException) +IMPL_LINK( ExtrusionDepthWindow, SelectHdl, void *, EMPTYARG ) { - if( rEvent.MenuId ) + int nSelected = getSelectedEntryId(); + if( nSelected != -1 ) { - if( rEvent.MenuId == 7 ) + if( nSelected == 6 ) { + if ( IsInPopupMode() ) + EndPopupMode(); + const rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepthDialog" )); + Any a; Sequence< PropertyValue > aArgs( 2 ); aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Depth" )); aArgs[0].Value <<= mfDepth; aArgs[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" )); - aArgs[1].Value <<= (sal_Int32)meUnit; + aArgs[1].Value <<= static_cast( meUnit ); - dispatchCommand( aCommand, aArgs ); + mrController.dispatchCommand( aCommand, aArgs ); } else { double fDepth; - if( rEvent.MenuId == 6 ) + if( nSelected == 5 ) { fDepth = 338666.6; } else { - fDepth = IsMetric( meUnit ) ? aDepthListMM[rEvent.MenuId-1] : aDepthListInch[rEvent.MenuId-1]; + fDepth = IsMetric( meUnit ) ? aDepthListMM[nSelected] : aDepthListInch[nSelected]; } Sequence< PropertyValue > aArgs( 1 ); aArgs[0].Name = msExtrusionDepth.copy(5); aArgs[0].Value <<= fDepth; - dispatchCommand( msExtrusionDepth, aArgs ); + mrController.dispatchCommand( msExtrusionDepth, aArgs ); + implSetDepth( fDepth ); + + if ( IsInPopupMode() ) + EndPopupMode(); } } + return 0; +} + +// ======================================================================= +// ExtrusionDirectionControl +// ======================================================================= + +ExtrusionDepthController::ExtrusionDepthController( const Reference< lang::XMultiServiceFactory >& rServiceManager ) +: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepthFloater" ) ) ) +{ } // ----------------------------------------------------------------------- -// XInitialization + +::Window* ExtrusionDepthController::createPopupWindow( ::Window* pParent ) +{ + return new ExtrusionDirectionWindow( *this, m_xFrame, pParent ); +} + + +// ----------------------------------------------------------------------- +// XServiceInfo // ----------------------------------------------------------------------- -void SAL_CALL ExtrusionDepthController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException ) +OUString SAL_CALL ExtrusionDepthController_getImplementationName() { - osl::MutexGuard aLock( m_aMutex ); + return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionDepthController" )); +} - sal_Bool bInitalized( m_bInitialized ); - if ( !bInitalized ) - { - svt::PopupMenuControllerBase::initialize( aArguments ); - m_aBaseURL = ::rtl::OUString(); - } +// -------------------------------------------------------------------- + +Sequence< OUString > SAL_CALL ExtrusionDepthController_getSupportedServiceNames() throw( RuntimeException ) +{ + Sequence< OUString > aSNS( 1 ); + aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.PopupMenuController" )); + return aSNS; +} + +// -------------------------------------------------------------------- + +Reference< XInterface > SAL_CALL SAL_CALL ExtrusionDepthController_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) +{ + return *new ExtrusionDepthController( rSMgr ); +} + +// -------------------------------------------------------------------- + +OUString SAL_CALL ExtrusionDepthController::getImplementationName( ) throw (RuntimeException) +{ + return ExtrusionDepthController_getImplementationName(); +} + +// -------------------------------------------------------------------- + +Sequence< OUString > SAL_CALL ExtrusionDepthController::getSupportedServiceNames( ) throw (RuntimeException) +{ + return ExtrusionDepthController_getSupportedServiceNames(); } -// ----------------------------------------------------------------------- // #################################################################### @@ -615,6 +633,7 @@ ExtrusionLightingWindow::ExtrusionLightingWindow( svt::ToolboxController& rContr mpLightingSet->SetOutputSizePixel( Size( 72, 72 ) ); appendEntry( 3, mpLightingSet ); + appendSeparator(); appendEntry( 0, String( SVX_RES( STR_BRIGHT ) ), bHighContrast ? maImgBrighth : maImgBright ); appendEntry( 1, String( SVX_RES( STR_NORMAL ) ), bHighContrast ? maImgNormalh : maImgNormal ); appendEntry( 2, String( SVX_RES( STR_DIM ) ), bHighContrast ? maImgDimh : maImgDim ); @@ -923,7 +942,7 @@ ExtrusionSurfaceControl::ExtrusionSurfaceControl( const Reference< lang::XMultiS ::Window* ExtrusionSurfaceControl::createPopupWindow( ::Window* pParent ) { - return new ExtrusionLightingWindow( *this, m_xFrame, pParent ); + return new ExtrusionSurfaceWindow( *this, m_xFrame, pParent ); } // ----------------------------------------------------------------------- diff --git a/svx/source/tbxctrls/extrusioncontrols.hxx b/svx/source/tbxctrls/extrusioncontrols.hxx index 958ccc014afc..4f5e2404d83f 100644 --- a/svx/source/tbxctrls/extrusioncontrols.hxx +++ b/svx/source/tbxctrls/extrusioncontrols.hxx @@ -96,14 +96,23 @@ public: //======================================================================== -class ExtrusionDepthController : public svt::PopupMenuControllerBase +class ExtrusionDepthWindow : public svtools::ToolbarMenu { - using svt::PopupMenuControllerBase::disposing; private: - Image maImgDepth[5]; + svt::ToolboxController& mrController; + + Image maImgDepth0; + Image maImgDepth1; + Image maImgDepth2; + Image maImgDepth3; + Image maImgDepth4; Image maImgDepthInfinity; - Image maImgDepth_hc[5]; + Image maImgDepth0h; + Image maImgDepth1h; + Image maImgDepth2h; + Image maImgDepth3h; + Image maImgDepth4h; Image maImgDepthInfinityh; FieldUnit meUnit; @@ -112,28 +121,30 @@ private: const rtl::OUString msExtrusionDepth; const rtl::OUString msMetricUnit; -public: - ExtrusionDepthController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); - virtual ~ExtrusionDepthController(); + DECL_LINK( SelectHdl, void * ); - // 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); + void implFillStrings( FieldUnit eUnit ); + void implSetDepth( double fDepth ); - // 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); +public: + ExtrusionDepthWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ); - // XStatusListener virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); +}; - // XMenuListener - virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); +//======================================================================== + +class ExtrusionDepthController : public svt::PopupWindowController +{ +public: + ExtrusionDepthController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); - // XEventListener - virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual ::Window* createPopupWindow( ::Window* pParent ); - // XPopupMenuController - virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException); + // 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 ); }; //======================================================================== diff --git a/svx/source/tbxctrls/extrusioncontrols.src b/svx/source/tbxctrls/extrusioncontrols.src index 11f40e6f2976..084606439cc3 100644 --- a/svx/source/tbxctrls/extrusioncontrols.src +++ b/svx/source/tbxctrls/extrusioncontrols.src @@ -200,83 +200,96 @@ DockingWindow RID_SVXFLOAT_EXTRUSION_DIRECTION }; }; -String RID_SVXSTR_EXTRUSION_CUSTOM +DockingWindow RID_SVXFLOAT_EXTRUSION_DEPTH { - Text [ en-US ] = "~Custom..."; -}; + Border = FALSE ; + Hide = TRUE ; + SVLook = TRUE ; + Sizeable = FALSE ; + Moveable = TRUE ; + Closeable = TRUE ; + Zoomable = TRUE ; -String RID_SVXSTR_EXTRUSION_INFINITY -{ - Text [ en-US ] = "~Infinity"; -}; + Text [ en-US ] = "Extrusion Depth" ; -Image RID_SVXIMG_EXTRUSION_DEPTH_0 -{ - ImageBitmap = Bitmap { File = "extrusion0inch_16.bmp"; }; - MASKCOLOR -}; -Image RID_SVXIMG_EXTRUSION_DEPTH_0_H -{ - ImageBitmap = Bitmap { File = "extrusion0inch_16_h.bmp"; }; - MASKCOLOR -}; + String STR_CUSTOM + { + Text [ en-US ] = "~Custom..."; + }; -Image RID_SVXIMG_EXTRUSION_DEPTH_1 -{ - ImageBitmap = Bitmap { File = "extrusion05inch_16.bmp"; }; - MASKCOLOR -}; -Image RID_SVXIMG_EXTRUSION_DEPTH_1_H -{ - ImageBitmap = Bitmap { File = "extrusion05inch_16_h.bmp"; }; - MASKCOLOR -}; + String STR_INFINITY + { + Text [ en-US ] = "~Infinity"; + }; -Image RID_SVXIMG_EXTRUSION_DEPTH_2 -{ - ImageBitmap = Bitmap { File = "extrusion1inch_16.bmp"; }; - MASKCOLOR -}; + Image IMG_DEPTH_0 + { + ImageBitmap = Bitmap { File = "extrusion0inch_16.bmp"; }; + MASKCOLOR + }; + Image IMG_DEPTH_0_H + { + ImageBitmap = Bitmap { File = "extrusion0inch_16_h.bmp"; }; + MASKCOLOR + }; -Image RID_SVXIMG_EXTRUSION_DEPTH_2_H -{ - ImageBitmap = Bitmap { File = "extrusion1inch_16_h.bmp"; }; - MASKCOLOR -}; + Image IMG_DEPTH_1 + { + ImageBitmap = Bitmap { File = "extrusion05inch_16.bmp"; }; + MASKCOLOR + }; + Image IMG_DEPTH_1_H + { + ImageBitmap = Bitmap { File = "extrusion05inch_16_h.bmp"; }; + MASKCOLOR + }; -Image RID_SVXIMG_EXTRUSION_DEPTH_3 -{ - ImageBitmap = Bitmap { File = "extrusion2inch_16.bmp"; }; - MASKCOLOR -}; -Image RID_SVXIMG_EXTRUSION_DEPTH_3_H -{ - ImageBitmap = Bitmap { File = "extrusion2inch_16_h.bmp"; }; - MASKCOLOR -}; + Image IMG_DEPTH_2 + { + ImageBitmap = Bitmap { File = "extrusion1inch_16.bmp"; }; + MASKCOLOR + }; + Image IMG_DEPTH_2_H + { + ImageBitmap = Bitmap { File = "extrusion1inch_16_h.bmp"; }; + MASKCOLOR + }; -Image RID_SVXIMG_EXTRUSION_DEPTH_4 -{ - ImageBitmap = Bitmap { File = "extrusion4inch_16.bmp"; }; - MASKCOLOR -}; -Image RID_SVXIMG_EXTRUSION_DEPTH_4_H -{ - ImageBitmap = Bitmap { File = "extrusion4inch_16_h.bmp"; }; - MASKCOLOR -}; + Image IMG_DEPTH_3 + { + ImageBitmap = Bitmap { File = "extrusion2inch_16.bmp"; }; + MASKCOLOR + }; + Image IMG_DEPTH_3_H + { + ImageBitmap = Bitmap { File = "extrusion2inch_16_h.bmp"; }; + MASKCOLOR + }; -Image RID_SVXIMG_EXTRUSION_DEPTH_INFINITY -{ - ImageBitmap = Bitmap { File = "extrusioninfinity_16.bmp"; }; - MASKCOLOR -}; -Image RID_SVXIMG_EXTRUSION_DEPTH_INFINITY_H -{ - ImageBitmap = Bitmap { File = "extrusioninfinity_16_h.bmp"; }; - MASKCOLOR + Image IMG_DEPTH_4 + { + ImageBitmap = Bitmap { File = "extrusion4inch_16.bmp"; }; + MASKCOLOR + }; + Image IMG_DEPTH_4_H + { + ImageBitmap = Bitmap { File = "extrusion4inch_16_h.bmp"; }; + MASKCOLOR + }; + + Image IMG_DEPTH_INFINITY + { + ImageBitmap = Bitmap { File = "extrusioninfinity_16.bmp"; }; + MASKCOLOR + }; + Image IMG_DEPTH_INFINITY_H + { + ImageBitmap = Bitmap { File = "extrusioninfinity_16_h.bmp"; }; + MASKCOLOR + }; }; + DockingWindow RID_SVXFLOAT_EXTRUSION_LIGHTING { Border = FALSE ; -- cgit From 993932abf386214397c1847cecf517c196b97d0b Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Thu, 25 Mar 2010 13:28:04 +0100 Subject: fixed opening wrong controller --- svx/source/tbxctrls/extrusioncontrols.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'svx') diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx index 7300fe8048b3..eb5e2e67e02b 100644 --- a/svx/source/tbxctrls/extrusioncontrols.cxx +++ b/svx/source/tbxctrls/extrusioncontrols.cxx @@ -529,7 +529,7 @@ ExtrusionDepthController::ExtrusionDepthController( const Reference< lang::XMult ::Window* ExtrusionDepthController::createPopupWindow( ::Window* pParent ) { - return new ExtrusionDirectionWindow( *this, m_xFrame, pParent ); + return new ExtrusionDepthWindow( *this, m_xFrame, pParent ); } -- cgit From cd272478cc3d14074769012ecc94f918d1daa5ca Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Thu, 25 Mar 2010 13:45:57 +0100 Subject: fixed wrong resource --- svx/source/tbxctrls/extrusioncontrols.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'svx') diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx index eb5e2e67e02b..f98fd57a0480 100644 --- a/svx/source/tbxctrls/extrusioncontrols.cxx +++ b/svx/source/tbxctrls/extrusioncontrols.cxx @@ -340,7 +340,7 @@ double aDepthListInch[] = { 0, 1270,2540,5080,10160 }; double aDepthListMM[] = { 0, 1000, 2500, 5000, 10000 }; ExtrusionDepthWindow::ExtrusionDepthWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) -: ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_DIRECTION )) +: ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_DEPTH )) , mrController( rController ) , maImgDepth0( SVX_RES( IMG_DEPTH_0 ) ) , maImgDepth1( SVX_RES( IMG_DEPTH_1 ) ) -- cgit From d7c43c9580a226008261e2b2f80a3f5c923a388c Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Thu, 25 Mar 2010 17:21:13 +0100 Subject: cws l10ntooling18: #i110394# Introduce the variable %OOOVENDOR --- svx/source/intro/makefile.mk | 4 ++++ svx/source/intro/ooo.src | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'svx') diff --git a/svx/source/intro/makefile.mk b/svx/source/intro/makefile.mk index 3ed86b3bcda3..9399514c3631 100644 --- a/svx/source/intro/makefile.mk +++ b/svx/source/intro/makefile.mk @@ -40,6 +40,10 @@ RSCLOCINC!:=$(RSCLOCINC);$(PRJ)$/RES OOO_VENDOR*=$(USER)$(USERNAME) RSCDEFS+=-DOOO_VENDOR="$(OOO_VENDOR)" +.IF "x$(OOO_VENDOR)x" == "xx" +.EXPORT : OOO_VENDOR +.ENDIF + # --- Allgemein ----------------------------------------------------------- LOCALIZE_ME=intro_tmpl.hrc diff --git a/svx/source/intro/ooo.src b/svx/source/intro/ooo.src index 6c52a054e3ce..f638120a507d 100644 --- a/svx/source/intro/ooo.src +++ b/svx/source/intro/ooo.src @@ -86,7 +86,7 @@ ModalDialog RID_DEFAULTABOUT { Pos = MAP_APPFONT ( 54 , 25 ) ; Size = MAP_APPFONT ( 168 , 51 ) ; - Text[ en-US ] ="Copyright 2000-2009 Sun Microsystems Inc.\nThis product was created by " OOO_VENDOR ", based on OpenOffice.org.\nOpenOffice.org acknowledges all community members, especially those mentioned at http://www.openoffice.org/welcome/credits.html."; + Text[ en-US ] ="Copyright 2000-2009 Sun Microsystems Inc.\nThis product was created by %OOOVENDOR, based on OpenOffice.org.\nOpenOffice.org acknowledges all community members, especially those mentioned at http://www.openoffice.org/welcome/credits.html."; WordBreak = TRUE ; }; StringArray ABOUT_STR_DEVELOPER_ARY -- cgit From 78d5c55e026562260b0ed0b46d656e11dfbe40fa Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Thu, 25 Mar 2010 17:28:17 +0100 Subject: cws l10ntooling18: #i110394# OOO_VENDOR is no longer merged by rsc but by config --- svx/source/intro/makefile.mk | 8 -------- 1 file changed, 8 deletions(-) (limited to 'svx') diff --git a/svx/source/intro/makefile.mk b/svx/source/intro/makefile.mk index 9399514c3631..4d0686baac04 100644 --- a/svx/source/intro/makefile.mk +++ b/svx/source/intro/makefile.mk @@ -36,14 +36,6 @@ TARGET=intro RSCLOCINC!:=$(RSCLOCINC);$(PRJ)$/RES -# setting the compiled by $user$ string in the About box -OOO_VENDOR*=$(USER)$(USERNAME) -RSCDEFS+=-DOOO_VENDOR="$(OOO_VENDOR)" - -.IF "x$(OOO_VENDOR)x" == "xx" -.EXPORT : OOO_VENDOR -.ENDIF - # --- Allgemein ----------------------------------------------------------- LOCALIZE_ME=intro_tmpl.hrc -- cgit From a1c06b2a131f2cdf2e9cc6bc67bcec2bb365bd42 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Fri, 26 Mar 2010 15:38:44 +0100 Subject: removed unused code --- svx/source/tbxctrls/fontworkgallery.cxx | 39 ++++++++++++--------------------- 1 file changed, 14 insertions(+), 25 deletions(-) (limited to 'svx') diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx index 1fbf10868661..80185ee20af7 100644 --- a/svx/source/tbxctrls/fontworkgallery.cxx +++ b/svx/source/tbxctrls/fontworkgallery.cxx @@ -343,7 +343,9 @@ void FontWorkShapeTypeControl::Select( BOOL ) } -// #################################################################### +// ======================================================================== +// FontWorkAlignmentWindow +// ======================================================================== class FontWorkAlignmentWindow : public ToolbarMenu { @@ -478,6 +480,8 @@ IMPL_LINK( FontWorkAlignmentWindow, SelectHdl, void *, EMPTYARG ) return 0; } +// ======================================================================== +// FontWorkAlignmentControl // ======================================================================== class FontWorkAlignmentControl : public svt::PopupWindowController @@ -493,6 +497,8 @@ public: }; +// ----------------------------------------------------------------------- + FontWorkAlignmentControl::FontWorkAlignmentControl( const Reference< lang::XMultiServiceFactory >& rServiceManager ) : svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkAlignment" ) ) ) { @@ -544,17 +550,6 @@ Sequence< OUString > SAL_CALL FontWorkAlignmentControl::getSupportedServiceNames return FontWorkAlignmentControl_getSupportedServiceNames(); } -/** todo ? -void FontWorkAlignmentControl::StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ) -{ - USHORT nId = GetId(); - ToolBox& rTbx = GetToolBox(); - - rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); - rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); -} - -*/ // #################################################################### @@ -577,6 +572,8 @@ private: }; +// ----------------------------------------------------------------------- + FontWorkCharacterSpacingWindow::FontWorkCharacterSpacingWindow( svt::ToolboxController& rController, const Reference< XFrame >& rFrame, Window* pParentWindow ) : ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_FONTWORK_CHARSPACING )) , mrController( rController ) @@ -721,6 +718,8 @@ IMPL_LINK( FontWorkCharacterSpacingWindow, SelectHdl, void *, EMPTYARG ) return 0; } +// ======================================================================== +// FontWorkCharacterSpacingControl // ======================================================================== class FontWorkCharacterSpacingControl : public svt::PopupWindowController @@ -786,20 +785,10 @@ Sequence< OUString > SAL_CALL FontWorkCharacterSpacingControl::getSupportedServi { return FontWorkCharacterSpacingControl_getSupportedServiceNames(); } -// ----------------------------------------------------------------------- -/** todo ? -void FontWorkCharacterSpacingControl::StateChanged( USHORT, SfxItemState eState, const SfxPoolItem* ) -{ - USHORT nId = GetId(); - ToolBox& rTbx = GetToolBox(); - - rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); - rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); -} -*/ - -// ----------------------------------------------------------------------- +// ======================================================================== +// FontworkCharacterSpacingDialog +// ======================================================================== FontworkCharacterSpacingDialog::FontworkCharacterSpacingDialog( Window* pParent, sal_Int32 nScale ) : ModalDialog( pParent, SVX_RES( RID_SVX_MDLG_FONTWORK_CHARSPACING ) ), -- cgit From 9194927f107bf3672810af94b5f30aff476ffcbe Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 8 Apr 2010 12:32:07 +0200 Subject: slidecopy: oops, the ID for SID_TASKPANE was used already. Did I mention our number circles suck? --- svx/inc/svx/svxids.hrc | 1 + 1 file changed, 1 insertion(+) (limited to 'svx') diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc index 5c541b3b24dd..ba8d71387bb7 100644 --- a/svx/inc/svx/svxids.hrc +++ b/svx/inc/svx/svxids.hrc @@ -775,6 +775,7 @@ #define SID_ATTR_TEXT_FITTOSIZE ( SID_SVX_START + 367 ) #define SID_ATTR_BRUSH_ROW ( SID_SVX_START + 368 ) #define SID_OPTFILTER_MSOFFICE ( SID_SVX_START + 369 ) +//#define SID_TASKPANE ( SID_SVX_START + 370 ) -> sfxsids.hrc #define SID_IMAP ( SID_SVX_START + 371 ) #define SID_IMAP_DLG ( SID_SVX_START + 372 ) #define SID_IMAP_SELECT ( SID_SVX_START + 373 ) -- cgit From d30937f3ef1f1c8c2f38d0923ab30607c0aceb7f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 9 Apr 2010 11:05:09 +0200 Subject: slidecopy: separate resource ID number circles for svl and svtools (thanks to MBA for the patch) --- svx/source/form/datanavi.cxx | 2 +- svx/source/intro/iso.src | 2 +- svx/source/intro/ooo.src | 2 +- svx/workben/msview/msview.cxx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'svx') diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx index 2ce8e1728ee4..d5fd749190a6 100644 --- a/svx/source/form/datanavi.cxx +++ b/svx/source/form/datanavi.cxx @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/svx/source/intro/iso.src b/svx/source/intro/iso.src index 510379d54ab5..cff148376d2a 100644 --- a/svx/source/intro/iso.src +++ b/svx/source/intro/iso.src @@ -33,7 +33,7 @@ #endif #ifndef _SVTOOLS_HRC -#include +#include #endif #include "intro.hrc" diff --git a/svx/source/intro/ooo.src b/svx/source/intro/ooo.src index eea02180d922..9a59a643168f 100644 --- a/svx/source/intro/ooo.src +++ b/svx/source/intro/ooo.src @@ -29,7 +29,7 @@ ************************************************************************/ #ifndef _SVTOOLS_HRC -#include +#include #endif #ifndef _SVTOOLS_IMAGEMGR_HRC diff --git a/svx/workben/msview/msview.cxx b/svx/workben/msview/msview.cxx index 2036553465be..fe1c22612d60 100644 --- a/svx/workben/msview/msview.cxx +++ b/svx/workben/msview/msview.cxx @@ -37,7 +37,7 @@ #include #include #ifndef _SVTOOLS_HRC -#include +#include #endif #include -- cgit From 4cef86a3df68deac59ad6eec71db7eb4bf1476e7 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Mon, 12 Apr 2010 18:28:42 +0200 Subject: fixed merge error --- svx/source/sdr/overlay/overlaybitmapex.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'svx') diff --git a/svx/source/sdr/overlay/overlaybitmapex.cxx b/svx/source/sdr/overlay/overlaybitmapex.cxx index c0b8975cf1c4..2a3a00b25b99 100644 --- a/svx/source/sdr/overlay/overlaybitmapex.cxx +++ b/svx/source/sdr/overlay/overlaybitmapex.cxx @@ -27,7 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" -#include +#include #include #include #include @@ -53,7 +53,7 @@ namespace sdr { const drawinglayer::primitive2d::Primitive2DSequence aNewTransPrimitiveVector(&aReference, 1L); aReference = drawinglayer::primitive2d::Primitive2DReference( - new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(aNewTransPrimitiveVector, mfAlpha)); + new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aNewTransPrimitiveVector, mfAlpha)); } return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1); -- cgit From 5b8d16eb981022d62e6f2fc5e27603c849807e53 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 14 Apr 2010 17:17:09 +0200 Subject: aw081 #i110861# corrected mpSdrPageProperties usages in SdrPage implementation to do the right things in the right situations --- svx/inc/svx/svdpage.hxx | 1 - svx/source/svdraw/svdpage.cxx | 45 +++++++++++++++++++++++++++---------------- 2 files changed, 28 insertions(+), 18 deletions(-) (limited to 'svx') diff --git a/svx/inc/svx/svdpage.hxx b/svx/inc/svx/svdpage.hxx index 29cf17ec9180..c601fddef181 100644 --- a/svx/inc/svx/svdpage.hxx +++ b/svx/inc/svx/svdpage.hxx @@ -376,7 +376,6 @@ private: public: // construct/destruct SdrPageProperties(SdrPage& rSdrPage); - SdrPageProperties(const SdrPageProperties& rCandidate); virtual ~SdrPageProperties(); // Notify(...) from baseclass SfxListener diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 6dd816d429da..6cc3460875bb 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -1221,18 +1221,6 @@ SdrPageProperties::SdrPageProperties(SdrPage& rSdrPage) } } -SdrPageProperties::SdrPageProperties(const SdrPageProperties& rCandidate) -: SfxListener(), - mpSdrPage(rCandidate.mpSdrPage), - mpStyleSheet(0), - mpProperties(new SfxItemSet(*rCandidate.mpProperties)) -{ - if(rCandidate.GetStyleSheet()) - { - ImpAddStyleSheet(*rCandidate.GetStyleSheet()); - } -} - SdrPageProperties::~SdrPageProperties() { ImpRemoveStyleSheet(); @@ -1365,6 +1353,8 @@ SdrPage::SdrPage(const SdrPage& rSrcPage) // Warning: this leads to slicing (see issue 93186) and has to be // removed as soon as possible. *this = rSrcPage; + OSL_ENSURE(mpSdrPageProperties, + "SdrPage::SdrPage: operator= did not create needed SdrPageProperties (!)"); // be careful and correct eListKind, a member of SdrObjList which // will be changed by the SdrOIbjList::operator= before... @@ -1382,8 +1372,6 @@ SdrPage::SdrPage(const SdrPage& rSrcPage) mxUnoPage = NULL; xComponent->dispose(); } - - mpSdrPageProperties = new SdrPageProperties(rSrcPage.getSdrPageProperties()); } SdrPage::~SdrPage() @@ -1478,8 +1466,21 @@ void SdrPage::operator=(const SdrPage& rSrcPage) mbObjectsNotPersistent = rSrcPage.mbObjectsNotPersistent; { - delete mpSdrPageProperties; - mpSdrPageProperties = new SdrPageProperties(rSrcPage.getSdrPageProperties()); + if(!mpSdrPageProperties) + { + mpSdrPageProperties = new SdrPageProperties(*this); + } + else + { + mpSdrPageProperties->ClearItem(0); + } + + if(!IsMasterPage()) + { + mpSdrPageProperties->PutItemSet(rSrcPage.getSdrPageProperties().GetItemSet()); + } + + mpSdrPageProperties->SetStyleSheet(rSrcPage.getSdrPageProperties().GetStyleSheet()); } // Now copy the contained obejcts (by cloning them) @@ -1659,7 +1660,17 @@ void SdrPage::SetModel(SdrModel* pNewModel) } pLayerAdmin->SetModel(pNewModel); - SdrPageProperties *pNew = new SdrPageProperties(getSdrPageProperties()); + // create new SdrPageProperties with new model (due to SfxItemSet there) + // and copy ItemSet and StyleSheet + SdrPageProperties *pNew = new SdrPageProperties(*this); + + if(!IsMasterPage()) + { + pNew->PutItemSet(getSdrPageProperties().GetItemSet()); + } + + pNew->SetStyleSheet(getSdrPageProperties().GetStyleSheet()); + delete mpSdrPageProperties; mpSdrPageProperties = pNew; } -- cgit From 7ff2125a6163e6734f9e6065d61bf71a9b6b68c3 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 15 Apr 2010 11:27:39 +0200 Subject: aw081 #i110846# added needed exceptions to do the right hing for MasterPages with no style sheets --- svx/inc/svx/sdrmasterpagedescriptor.hxx | 2 -- .../contact/viewcontactofmasterpagedescriptor.cxx | 27 ++++++++++++++++++---- svx/source/sdr/contact/viewcontactofsdrpage.cxx | 16 +++++++++---- svx/source/svdraw/sdrmasterpagedescriptor.cxx | 12 ---------- 4 files changed, 35 insertions(+), 22 deletions(-) (limited to 'svx') diff --git a/svx/inc/svx/sdrmasterpagedescriptor.hxx b/svx/inc/svx/sdrmasterpagedescriptor.hxx index 8325d2a57fa1..612f2ab927ec 100644 --- a/svx/inc/svx/sdrmasterpagedescriptor.hxx +++ b/svx/inc/svx/sdrmasterpagedescriptor.hxx @@ -89,8 +89,6 @@ namespace sdr // operators sal_Bool operator==(const MasterPageDescriptor& rCandidate) const; sal_Bool operator!=(const MasterPageDescriptor& rCandidate) const; - - const SfxItemSet& getCorrectFillAttributes() const; }; } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx index ba260e79bba9..cbe9c4a9c615 100644 --- a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx @@ -61,11 +61,30 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfMasterPageDescriptor::createViewIndependentPrimitive2DSequence() const { drawinglayer::primitive2d::Primitive2DSequence xRetval; + drawinglayer::attribute::SdrFillAttribute aFill; + const SdrPage* pCorrectPage = &GetMasterPageDescriptor().GetOwnerPage(); + const SdrPageProperties* pCorrectProperties = &pCorrectPage->getSdrPageProperties(); - // build primitive from page fill attributes - const SfxItemSet& rPageFillAttributes = GetMasterPageDescriptor().getCorrectFillAttributes(); - const drawinglayer::attribute::SdrFillAttribute aFill( - drawinglayer::primitive2d::createNewSdrFillAttribute(rPageFillAttributes)); + if(XFILL_NONE == ((const XFillStyleItem&)pCorrectProperties->GetItemSet().Get(XATTR_FILLSTYLE)).GetValue()) + { + pCorrectPage = &GetMasterPageDescriptor().GetUsedPage(); + pCorrectProperties = &pCorrectPage->getSdrPageProperties(); + } + + if(pCorrectPage->IsMasterPage() && !pCorrectProperties->GetStyleSheet()) + { + // #i110846# Suppress SdrPage FillStyle for MasterPages without StyleSheets, + // else the PoolDefault (XFILL_COLOR and Blue8) will be used. Normally, all + // MasterPages should have a StyleSheet excactly for this reason, but historically + // e.g. the Notes MasterPage has no StyleSheet set (and there maybe others). + pCorrectProperties = 0; + } + + if(pCorrectProperties) + { + // create page fill attributes when correct properties were identified + aFill = drawinglayer::primitive2d::createNewSdrFillAttribute(pCorrectProperties->GetItemSet()); + } if(!aFill.isDefault()) { diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx index e486f978fafb..b80b6fcbba88 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx @@ -203,10 +203,18 @@ namespace sdr } else { - // build primitive from pObject's attributes - const SfxItemSet& rFillAttributes = rPage.getSdrPageProperties().GetItemSet(); - const drawinglayer::attribute::SdrFillAttribute aFill( - drawinglayer::primitive2d::createNewSdrFillAttribute(rFillAttributes)); + drawinglayer::attribute::SdrFillAttribute aFill; + + // #i110846# Suppress SdrPage FillStyle for MasterPages without StyleSheets, + // else the PoolDefault (XFILL_COLOR and Blue8) will be used. Normally, all + // MasterPages should have a StyleSheet excactly for this reason, but historically + // e.g. the Notes MasterPage has no StyleSheet set (and there maybe others). + if(rPage.getSdrPageProperties().GetStyleSheet()) + { + // create page fill attributes with correct properties + aFill = drawinglayer::primitive2d::createNewSdrFillAttribute( + rPage.getSdrPageProperties().GetItemSet()); + } if(!aFill.isDefault()) { diff --git a/svx/source/svdraw/sdrmasterpagedescriptor.cxx b/svx/source/svdraw/sdrmasterpagedescriptor.cxx index 6bcdd8f55856..67b2de8b693c 100644 --- a/svx/source/svdraw/sdrmasterpagedescriptor.cxx +++ b/svx/source/svdraw/sdrmasterpagedescriptor.cxx @@ -113,18 +113,6 @@ namespace sdr || &maUsedPage != &rCandidate.maUsedPage || maVisibleLayers != rCandidate.maVisibleLayers); } - - const SfxItemSet& MasterPageDescriptor::getCorrectFillAttributes() const - { - const SfxItemSet& rOwnerPageAtributes = GetOwnerPage().getSdrPageProperties().GetItemSet(); - - if(XFILL_NONE != ((const XFillStyleItem&)rOwnerPageAtributes.Get(XATTR_FILLSTYLE)).GetValue()) - { - return rOwnerPageAtributes; - } - - return GetUsedPage().getSdrPageProperties().GetItemSet(); - } } // end of namespace sdr ////////////////////////////////////////////////////////////////////////////// -- cgit From b09ce90f0a73acff0c0272978c6e5514325e913e Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 15 Apr 2010 13:20:32 +0200 Subject: aw081 #i110779# Adapted DoDepthArrange to use logical AND PolyPolygon checks instead of IsInside checks to get bettter quality --- svx/source/engine3d/view3d.cxx | 170 +++++++++++++++++------------------------ 1 file changed, 69 insertions(+), 101 deletions(-) (limited to 'svx') diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx index 97fee2250658..047faef2cb41 100644 --- a/svx/source/engine3d/view3d.cxx +++ b/svx/source/engine3d/view3d.cxx @@ -75,6 +75,7 @@ #include #include #include +#include #define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue() @@ -1066,77 +1067,39 @@ void E3dView::ConvertMarkedObjTo3D(BOOL bExtrude, basegfx::B2DPoint aPnt1, baseg struct E3dDepthNeighbour { - E3dDepthNeighbour* pNext; - E3dExtrudeObj* pObj; - - E3dDepthNeighbour() { pNext = NULL; pObj = NULL; } + E3dDepthNeighbour* mpNext; + E3dExtrudeObj* mpObj; + basegfx::B2DPolyPolygon maPreparedPolyPolygon; + + E3dDepthNeighbour() + : mpNext(0), + mpObj(0), + maPreparedPolyPolygon() + { + } }; struct E3dDepthLayer { - E3dDepthLayer* pDown; - E3dDepthNeighbour* pNext; - - E3dDepthLayer() { pDown = NULL; pNext = NULL; } - ~E3dDepthLayer() { while(pNext) { E3dDepthNeighbour* pSucc = pNext->pNext; delete pNext; pNext = pSucc; }} -}; - -bool ImpDoesOverlap(const basegfx::B2DPolygon& rPolygonA, const basegfx::B2DPolygon& rPolygonB) -{ - bool bRetval(false); - const basegfx::B2DRange aRangeA(basegfx::tools::getRange(rPolygonA)); - const basegfx::B2DRange aRangeB(basegfx::tools::getRange(rPolygonB)); + E3dDepthLayer* mpDown; + E3dDepthNeighbour* mpNext; - if(aRangeA.overlaps(aRangeB)) + E3dDepthLayer() + : mpDown(0), + mpNext(0) { - // A in B ? - if(basegfx::tools::isInside(rPolygonA, rPolygonB)) - return true; - - // B in A ? - if(basegfx::tools::isInside(rPolygonB, rPolygonA)) - return true; - - // A and B the same ? - if(basegfx::tools::isInside(rPolygonB, rPolygonA, true)) - return true; } - return bRetval; -} - -bool ImpDoesOverlap(const basegfx::B2DPolyPolygon& rPolyPolygonA, const basegfx::B2DPolyPolygon& rPolyPolygonB) -{ - bool bRetval(false); - const basegfx::B2DRange aRangeA(basegfx::tools::getRange(rPolyPolygonA)); - const basegfx::B2DRange aRangeB(basegfx::tools::getRange(rPolyPolygonB)); - - if(aRangeA.overlaps(aRangeB)) + ~E3dDepthLayer() { - const sal_uInt32 nCntA(rPolyPolygonA.count()); - const sal_uInt32 nCntB(rPolyPolygonB.count()); - - for(sal_uInt32 a(0L); !bRetval && a < nCntA; a++) + while(mpNext) { - const basegfx::B2DPolygon aPolygonA(rPolyPolygonA.getB2DPolygon(a)); - - if(aPolygonA.isClosed()) - { - for(sal_uInt32 b(0L); !bRetval && b < nCntB; b++) - { - const basegfx::B2DPolygon aPolygonB(rPolyPolygonB.getB2DPolygon(b)); - - if(aPolygonB.isClosed()) - { - bRetval = ImpDoesOverlap(aPolygonA, aPolygonB); - } - } - } + E3dDepthNeighbour* pSucc = mpNext->mpNext; + delete mpNext; + mpNext = pSucc; } } - - return bRetval; -} +}; void E3dView::DoDepthArrange(E3dScene* pScene, double fDepth) { @@ -1147,39 +1110,41 @@ void E3dView::DoDepthArrange(E3dScene* pScene, double fDepth) E3dDepthLayer* pBaseLayer = NULL; E3dDepthLayer* pLayer = NULL; INT32 nNumLayers = 0; - //SfxItemPool& rPool = pMod->GetItemPool(); while(aIter.IsMore()) { - E3dObject* pSubObj = (E3dObject*)aIter.Next(); + E3dExtrudeObj* pExtrudeObj = dynamic_cast< E3dExtrudeObj* >(aIter.Next()); - if(pSubObj && pSubObj->ISA(E3dExtrudeObj)) + if(pExtrudeObj) { - E3dExtrudeObj* pExtrudeObj = (E3dExtrudeObj*)pSubObj; - const basegfx::B2DPolyPolygon aExtrudePoly(pExtrudeObj->GetExtrudePolygon()); - + const basegfx::B2DPolyPolygon aExtrudePoly( + basegfx::tools::prepareForPolygonOperation(pExtrudeObj->GetExtrudePolygon())); const SfxItemSet& rLocalSet = pExtrudeObj->GetMergedItemSet(); - XFillStyle eLocalFillStyle = ITEMVALUE(rLocalSet, XATTR_FILLSTYLE, XFillStyleItem); - Color aLocalColor = ((const XFillColorItem&)(rLocalSet.Get(XATTR_FILLCOLOR))).GetColorValue(); + const XFillStyle eLocalFillStyle = ITEMVALUE(rLocalSet, XATTR_FILLSTYLE, XFillStyleItem); + const Color aLocalColor = ((const XFillColorItem&)(rLocalSet.Get(XATTR_FILLCOLOR))).GetColorValue(); - // ExtrudeObj einordnen + // sort in ExtrudeObj if(pLayer) { - // Gibt es eine Ueberschneidung mit einem Objekt dieses - // Layers? - BOOL bOverlap(FALSE); - E3dDepthNeighbour* pAct = pLayer->pNext; + // do we have overlap with an object of this layer? + bool bOverlap(false); + E3dDepthNeighbour* pAct = pLayer->mpNext; while(!bOverlap && pAct) { - // ueberlappen sich pAct->pObj und pExtrudeObj ? - const basegfx::B2DPolyPolygon aActPoly(pAct->pObj->GetExtrudePolygon()); - bOverlap = ImpDoesOverlap(aExtrudePoly, aActPoly); + // do pAct->mpObj and pExtrudeObj overlap? Check by + // using logical AND clipping + const basegfx::B2DPolyPolygon aAndPolyPolygon( + basegfx::tools::solvePolygonOperationAnd( + aExtrudePoly, + pAct->maPreparedPolyPolygon)); + + bOverlap = (0 != aAndPolyPolygon.count()); if(bOverlap) { // second ciriteria: is another fillstyle or color used? - const SfxItemSet& rCompareSet = pAct->pObj->GetMergedItemSet(); + const SfxItemSet& rCompareSet = pAct->mpObj->GetMergedItemSet(); XFillStyle eCompareFillStyle = ITEMVALUE(rCompareSet, XATTR_FILLSTYLE, XFillStyleItem); @@ -1201,71 +1166,74 @@ void E3dView::DoDepthArrange(E3dScene* pScene, double fDepth) } } - pAct = pAct->pNext; + pAct = pAct->mpNext; } if(bOverlap) { - // ja, beginne einen neuen Layer - pLayer->pDown = new E3dDepthLayer; - pLayer = pLayer->pDown; + // yes, start a new layer + pLayer->mpDown = new E3dDepthLayer; + pLayer = pLayer->mpDown; nNumLayers++; - pLayer->pNext = new E3dDepthNeighbour; - pLayer->pNext->pObj = pExtrudeObj; + pLayer->mpNext = new E3dDepthNeighbour; + pLayer->mpNext->mpObj = pExtrudeObj; + pLayer->mpNext->maPreparedPolyPolygon = aExtrudePoly; } else { - // nein, Objekt kann in aktuellen Layer + // no, add to current layer E3dDepthNeighbour* pNewNext = new E3dDepthNeighbour; - pNewNext->pObj = pExtrudeObj; - pNewNext->pNext = pLayer->pNext; - pLayer->pNext = pNewNext; + pNewNext->mpObj = pExtrudeObj; + pNewNext->maPreparedPolyPolygon = aExtrudePoly; + pNewNext->mpNext = pLayer->mpNext; + pLayer->mpNext = pNewNext; } } else { - // erster Layer ueberhaupt + // first layer ever pBaseLayer = new E3dDepthLayer; pLayer = pBaseLayer; nNumLayers++; - pLayer->pNext = new E3dDepthNeighbour; - pLayer->pNext->pObj = pExtrudeObj; + pLayer->mpNext = new E3dDepthNeighbour; + pLayer->mpNext->mpObj = pExtrudeObj; + pLayer->mpNext->maPreparedPolyPolygon = aExtrudePoly; } } } - // Anzahl Layer steht fest + // number of layers is done if(nNumLayers > 1) { - // Arrangement ist notwendig + // need to be arranged double fMinDepth = fDepth * 0.8; double fStep = (fDepth - fMinDepth) / (double)nNumLayers; pLayer = pBaseLayer; while(pLayer) { - // an pLayer entlangspazieren - E3dDepthNeighbour* pAct = pLayer->pNext; + // move along layer + E3dDepthNeighbour* pAct = pLayer->mpNext; while(pAct) { - // Anpassen - pAct->pObj->SetMergedItem(SfxUInt32Item(SDRATTR_3DOBJ_DEPTH, sal_uInt32(fMinDepth + 0.5))); + // adapt extrude value + pAct->mpObj->SetMergedItem(SfxUInt32Item(SDRATTR_3DOBJ_DEPTH, sal_uInt32(fMinDepth + 0.5))); - // Naechster Eintrag - pAct = pAct->pNext; + // next + pAct = pAct->mpNext; } - // naechster Layer - pLayer = pLayer->pDown; + // next layer + pLayer = pLayer->mpDown; fMinDepth += fStep; } } - // angelegte Strukturen aufraeumen + // cleanup while(pBaseLayer) { - pLayer = pBaseLayer->pDown; + pLayer = pBaseLayer->mpDown; delete pBaseLayer; pBaseLayer = pLayer; } -- cgit From 03b7bc0ba9614ed80fca87be41d263818574cfae Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 15 Apr 2010 13:45:37 +0200 Subject: aw081 #i108255# simplified SdrPathPrimitive2D::create2DDecomposition by removing correctOrientations there; for paint the corrections are not needed and may get expensive for complex polygons --- svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'svx') diff --git a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx index ac9b6307dd05..2ceea2c69b7d 100644 --- a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx @@ -51,13 +51,11 @@ namespace drawinglayer if(!getSdrLFSTAttribute().getFill().isDefault() && getUnitPolyPolygon().isClosed()) { - // take care for orientations - const basegfx::B2DPolyPolygon aOrientedUnitPolyPolygon( - basegfx::tools::correctOrientations(getUnitPolyPolygon())); - + // #i108255# no need to use correctOrientations here; target is + // straight visualisation appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive( - aOrientedUnitPolyPolygon, + getUnitPolyPolygon(), getTransform(), getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); -- cgit From c2ec11e253ef87f509ef8c975ae4730abed97541 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Fri, 16 Apr 2010 10:06:13 +0200 Subject: merged placeholder handles into one to avoid display errors due to pixel rounding in some zoom levels --- svx/inc/svx/svdhdl.hxx | 3 ++- svx/source/svdraw/svdhdl.cxx | 2 +- svx/source/svdraw/svdmrkv.cxx | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'svx') diff --git a/svx/inc/svx/svdhdl.hxx b/svx/inc/svx/svdhdl.hxx index 7255f933fd65..f96b650d2be4 100644 --- a/svx/inc/svx/svdhdl.hxx +++ b/svx/inc/svx/svdhdl.hxx @@ -55,6 +55,7 @@ class SdrHdlList; class SdrMarkView; class SdrObject; class SdrPageView; +class MouseEvent; //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -247,7 +248,7 @@ public: /** is called when the mouse enters the area of this handle. If the handle changes his visualisation during mouse over it must override this method and call Touch(). */ - virtual void onMouseEnter(); + virtual void onMouseEnter(const MouseEvent& rMEvt); /** is called when the mouse leaves the area of this handle. If the handle changes his visualisation during mouse over it must override this method and call Touch(). */ diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index 76b0e44a6b2f..47a04241e5bb 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -948,7 +948,7 @@ BOOL SdrHdl::IsFocusHdl() const } } -void SdrHdl::onMouseEnter() +void SdrHdl::onMouseEnter(const MouseEvent& /*rMEvt*/) { } diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 64c996e5843c..a15cf8c8b2ac 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -1089,10 +1089,10 @@ BOOL SdrMarkView::MouseMove(const MouseEvent& rMEvt, Window* pWin) } // notify current mouse over handle - if( pMouseOverHdl && !pMouseOverHdl->mbMouseOver ) + if( pMouseOverHdl /* && !pMouseOverHdl->mbMouseOver */ ) { pMouseOverHdl->mbMouseOver = true; - pMouseOverHdl->onMouseEnter(); + pMouseOverHdl->onMouseEnter(rMEvt); } } return SdrSnapView::MouseMove(rMEvt, pWin); -- cgit From 2a8198c6ddfc3552f6630a85c1b23a9f697d091e Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 16 Apr 2010 14:30:41 +0200 Subject: slidecopy: removed some traces which are of no use anymore --- svx/source/form/fmshimp.cxx | 5 ----- 1 file changed, 5 deletions(-) (limited to 'svx') diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 463749b68364..2455f92b9b8d 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -941,7 +941,6 @@ void SAL_CALL FmXFormShell::formDeactivated(const EventObject& rEvent) throw( Ru void FmXFormShell::disposing() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::disposing" ); - OSL_TRACE( "--- FmXFormShell::disposing : %p, ........, ........", this ); impl_checkDisposed(); FmXFormShell_BASE::disposing(); @@ -3761,7 +3760,6 @@ void FmXFormShell::SetWizardUsing(sal_Bool _bUseThem) void FmXFormShell::viewDeactivated( FmFormView& _rCurrentView, sal_Bool _bDeactivateController /* = sal_True */ ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::viewDeactivated" ); - OSL_TRACE( "--- FmXFormShell::viewDeactivated: %p, %p, ........", this, &_rCurrentView ); if ( _rCurrentView.GetImpl() && !_rCurrentView.IsDesignMode() ) { @@ -3796,7 +3794,6 @@ void FmXFormShell::viewDeactivated( FmFormView& _rCurrentView, sal_Bool _bDeacti // remove callbacks at the page if ( pPage ) { - OSL_TRACE( "--- FmXFormShell::resetHandler : %p, ........, %p", this, pPage ); pPage->GetImpl().SetFormsCreationHdl( Link() ); } UpdateForms( sal_True ); @@ -3835,7 +3832,6 @@ IMPL_LINK( FmXFormShell, OnFormsCreated, FmFormPage*, /*_pPage*/ ) void FmXFormShell::viewActivated( FmFormView& _rCurrentView, sal_Bool _bSyncAction /* = sal_False */ ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::viewActivated" ); - OSL_TRACE( "--- FmXFormShell::viewActivated : %p, %p, ........", this, &_rCurrentView ); FmFormPage* pPage = _rCurrentView.GetCurPage(); @@ -3865,7 +3861,6 @@ void FmXFormShell::viewActivated( FmFormView& _rCurrentView, sal_Bool _bSyncActi // set callbacks at the page if ( pPage ) { - OSL_TRACE( "--- FmXFormShell::setHandler : %p, ........, %p", this, pPage ); pPage->GetImpl().SetFormsCreationHdl( LINK( this, FmXFormShell, OnFormsCreated ) ); } -- cgit From 9b25eec03e9d88474c748b9ab6da023197aeb7df Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Sat, 17 Apr 2010 15:37:08 +0200 Subject: dba33f: post-rebase build problems fixed --- svx/source/fmcomp/gridcell.cxx | 8 ++------ svx/source/fmcomp/gridctrl.cxx | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'svx') diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index 39ed72dc5bee..bb8afd502d43 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -582,12 +582,8 @@ DbCellControl::DbCellControl( DbGridColumn& _rColumn, sal_Bool /*_bText*/ ) // be listener at the bound field as well try { - Reference< XPropertySet > xColModelProps( m_rColumn.getModel(), UNO_QUERY ); - Reference< XPropertySetInfo > xPSI; - if ( xColModelProps.is() ) - xPSI = xColModelProps->getPropertySetInfo(); - - if ( xPSI.is() && xPSI->hasPropertyByName( FM_PROP_BOUNDFIELD ) ) + Reference< XPropertySetInfo > xPSI( xColModelProps->getPropertySetInfo(), UNO_SET_THROW ); + if ( xPSI->hasPropertyByName( FM_PROP_BOUNDFIELD ) ) { Reference< XPropertySet > xField; xColModelProps->getPropertyValue( FM_PROP_BOUNDFIELD ) >>= xField; diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index 0468c42a7ccc..1944bd47dad5 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -113,10 +113,10 @@ public: } private: // XEventListener - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& /*i_aEvt*/) + virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& /*i_aEvt*/) throw ( RuntimeException ) { } - virtual void SAL_CALL rowsChanged(const ::com::sun::star::sdb::RowsChangeEvent& i_aEvt) + virtual void SAL_CALL rowsChanged(const ::com::sun::star::sdb::RowsChangeEvent& i_aEvt) throw ( RuntimeException ) { if ( i_aEvt.Action == RowChangeAction::UPDATE ) { -- cgit From 4070f44212ff502ee211c1278fb4d9ede3614884 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Sat, 17 Apr 2010 23:01:24 +0200 Subject: dba33f: patch provided by dtardon: fix slot id ordering --- svx/source/form/fmtextcontrolshell.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'svx') diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx index 430c52cfa4db..320baea302b7 100644 --- a/svx/source/form/fmtextcontrolshell.cxx +++ b/svx/source/form/fmtextcontrolshell.cxx @@ -130,7 +130,6 @@ namespace svx SID_ATTR_LRSPACE, /* 48 */ SID_ATTR_ULSPACE, /* 49 */ SID_ATTR_CHAR_AUTOKERN, - SID_ATTR_CHAR_OVERLINE, SID_SET_SUPER_SCRIPT, SID_SET_SUB_SCRIPT, SID_CHAR_DLG, @@ -141,6 +140,7 @@ namespace svx SID_ATTR_CHAR_RELIEF, SID_ATTR_PARA_LEFT_TO_RIGHT, /* 950 */ SID_ATTR_PARA_RIGHT_TO_LEFT, + SID_ATTR_CHAR_OVERLINE, 0 }; -- cgit From 507024196797db68d8df9a4ea67e4798163504d2 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 19 Apr 2010 14:27:32 +0200 Subject: slidecopy: removed more useless (by now) traces --- svx/source/form/fmview.cxx | 4 ---- 1 file changed, 4 deletions(-) (limited to 'svx') diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx index fd7da1f7eb8f..22681d511b82 100644 --- a/svx/source/form/fmview.cxx +++ b/svx/source/form/fmview.cxx @@ -339,8 +339,6 @@ void FmFormView::GrabFirstControlFocus( sal_Bool _bForceSync ) //------------------------------------------------------------------------ SdrPageView* FmFormView::ShowSdrPage(SdrPage* pPage) { - OSL_TRACE( "--- FmFormView::ShowSdrPage : ........, %p, %p", this, pPage ); - SdrPageView* pPV = E3dView::ShowSdrPage(pPage); if (pPage) @@ -377,8 +375,6 @@ SdrPageView* FmFormView::ShowSdrPage(SdrPage* pPage) //------------------------------------------------------------------------ void FmFormView::HideSdrPage() { - OSL_TRACE( "--- FmFormView::HideSdrPage : ........, %p, %p", this, GetCurPage() ); - // --- 1. deactivate controls if ( !IsDesignMode() ) DeactivateControls(GetSdrPageView()); -- cgit From dcee57dba3d6bb88dcdc9f36ac4c6dd0dca699b9 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Thu, 22 Apr 2010 13:08:19 +0200 Subject: cws tl80: #i110341# problems with spell check dialog fixed --- svx/inc/svx/SpellDialogChildWindow.hxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'svx') diff --git a/svx/inc/svx/SpellDialogChildWindow.hxx b/svx/inc/svx/SpellDialogChildWindow.hxx index 034b6372f6f1..3702b643e17e 100644 --- a/svx/inc/svx/SpellDialogChildWindow.hxx +++ b/svx/inc/svx/SpellDialogChildWindow.hxx @@ -69,15 +69,19 @@ protected: @return returns an empty vector if no error could be found */ - virtual SpellPortions GetNextWrongSentence (void) = 0; + virtual SpellPortions GetNextWrongSentence (bool bRecheck) = 0; /** This abstract method applies the changes made in the spelling dialog to the document. The dialog always updates its settings when it gets the focus. The document can rely on the fact that the methods ApplyChangedSentence() is called for the position that the last GetNextWrongSentence() returned. + If 'bRecheck' is set to true then the same sentence should be rechecked once from + the start. This should be used too find errors that the user has introduced by + manual changes in the edit field, and in order to not miss the still following errors + in that sentence. */ - virtual void ApplyChangedSentence(const SpellPortions& rChanged) = 0; + virtual void ApplyChangedSentence(const SpellPortions& rChanged, bool bRecheck ) = 0; /** This methods determines whether the application supports AutoCorrection */ virtual bool HasAutoCorrection(); -- cgit From ce10a8f36bfba7096d581cc1a19162a5b864a0d8 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 22 Apr 2010 16:16:37 +0200 Subject: slidecopy: removed accelerator/*/default.xml - they're not used for a long time now ... (accelerator config is now in Accelerators.xcu in officecfg. No need to confuse people with those dead files) --- svx/prj/d.lst | 7 ------- svx/uiconfig/accelerator/default.xml | 5 ----- svx/uiconfig/accelerator/en-US/default.xml | 29 ----------------------------- svx/uiconfig/accelerator/es/default.xml | 29 ----------------------------- 4 files changed, 70 deletions(-) delete mode 100644 svx/uiconfig/accelerator/default.xml delete mode 100644 svx/uiconfig/accelerator/en-US/default.xml delete mode 100644 svx/uiconfig/accelerator/es/default.xml (limited to 'svx') diff --git a/svx/prj/d.lst b/svx/prj/d.lst index 7d2f508d9d21..6a1854b117d4 100644 --- a/svx/prj/d.lst +++ b/svx/prj/d.lst @@ -2,9 +2,6 @@ mkdir: %COMMON_DEST%\bin%_EXT%\hid mkdir: %COMMON_DEST%\res%_EXT% mkdir: %_DEST%\xml%_EXT%\uiconfig mkdir: %_DEST%\xml%_EXT%\uiconfig\global -mkdir: %_DEST%\xml%_EXT%\uiconfig\global\accelerator -mkdir: %_DEST%\xml%_EXT%\uiconfig\global\accelerator\en-US -mkdir: %_DEST%\xml%_EXT%\uiconfig\global\accelerator\es ..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid ..\%__SRC%\lib\lib*.* %_DEST%\lib%_EXT%\lib*.* @@ -679,10 +676,6 @@ mkdir: %_DEST%\inc%_EXT%\svx\sdr\table ..\xml\AccessibleControlShape.xml %_DEST%\xml%_EXT%\AccessibleControlShape.xml ..\xml\AccessibleEditableTextPara.xml %_DEST%\xml%_EXT%\AccessibleEditableTextPara.xml -..\uiconfig\accelerator\*.xml %_DEST%\xml%_EXT%\uiconfig\global\accelerator\*.xml -..\uiconfig\accelerator\en-US\*.xml %_DEST%\xml%_EXT%\uiconfig\global\accelerator\en-US\*.xml -..\uiconfig\accelerator\es\*.xml %_DEST%\xml%_EXT%\uiconfig\global\accelerator\es\*.xml - ..\inc\svx\subtoolboxcontrol.hxx %_DEST%\inc%_EXT%\svx\subtoolboxcontrol.hxx ..\inc\svx\svdtext.hxx %_DEST%\inc%_EXT%\svx\svdtext.hxx ..\inc\svx\svdotable.hxx %_DEST%\inc%_EXT%\svx\svdotable.hxx diff --git a/svx/uiconfig/accelerator/default.xml b/svx/uiconfig/accelerator/default.xml deleted file mode 100644 index dafd9e022f12..000000000000 --- a/svx/uiconfig/accelerator/default.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/svx/uiconfig/accelerator/en-US/default.xml b/svx/uiconfig/accelerator/en-US/default.xml deleted file mode 100644 index 67a6e9127c8a..000000000000 --- a/svx/uiconfig/accelerator/en-US/default.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svx/uiconfig/accelerator/es/default.xml b/svx/uiconfig/accelerator/es/default.xml deleted file mode 100644 index 71ba6212d275..000000000000 --- a/svx/uiconfig/accelerator/es/default.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit From 8a429819aab795e131bb2567f08cc0c2d1784624 Mon Sep 17 00:00:00 2001 From: Wu Yan Date: Wed, 28 Apr 2010 18:45:33 +0800 Subject: findbar01: enhancements for findbar --- svx/inc/tbunosearchcontrollers.hxx | 284 +++++++ svx/source/tbxctrls/makefile.mk | 3 +- svx/source/tbxctrls/tbunosearchcontrollers.cxx | 1018 ++++++++++++++++++++++++ svx/source/unodraw/unoctabl.cxx | 35 + 4 files changed, 1339 insertions(+), 1 deletion(-) create mode 100644 svx/inc/tbunosearchcontrollers.hxx create mode 100644 svx/source/tbxctrls/tbunosearchcontrollers.cxx (limited to 'svx') diff --git a/svx/inc/tbunosearchcontrollers.hxx b/svx/inc/tbunosearchcontrollers.hxx new file mode 100644 index 000000000000..3b52852c61fd --- /dev/null +++ b/svx/inc/tbunosearchcontrollers.hxx @@ -0,0 +1,284 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __TBUNOSEARCHCONTROLLERS_HXX_ +#define __TBUNOSEARCHCONTROLLERS_HXX_ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +namespace css = ::com::sun::star ; +namespace svx +{ + +class FindTextFieldControl; + +struct ExecuteInfo +{ + css::uno::Reference< css::frame::XDispatch > xDispatch; + css::util::URL aTargetURL; + css::uno::Sequence< css::beans::PropertyValue > aArgs; +}; + +class SearchToolbarControllersManager +{ +public: + + SearchToolbarControllersManager(); + ~SearchToolbarControllersManager(); + + static SearchToolbarControllersManager* createControllersManager(); + + void registryController( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& xStatusListener, const ::rtl::OUString& sCommandURL ); + void freeController ( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& xStatusListener, const ::rtl::OUString& sCommandURL ); + css::uno::Reference< css::frame::XStatusListener > findController( const css::uno::Reference< css::frame::XFrame >& xFrame, const ::rtl::OUString& sCommandURL ); + +private: + + static SearchToolbarControllersManager* m_pInstance; + + typedef ::comphelper::SequenceAsVector< css::beans::PropertyValue > SearchToolbarControllersVec; + typedef ::std::map< css::uno::Reference< css::frame::XFrame >, SearchToolbarControllersVec > SearchToolbarControllersMap; + SearchToolbarControllersMap aSearchToolbarControllersMap; + +}; + +class FindTextToolbarController : public svt::ToolboxController, + public css::lang::XServiceInfo +{ +public: + + FindTextToolbarController( const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager ); + ~FindTextToolbarController(); + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ); + + static ::rtl::OUString getImplementationName_Static() throw() + { + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.svx.FindTextToolboxController" )); + } + + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); + + // XComponent + virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException ); + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException ); + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw ( css::uno::RuntimeException); + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) throw ( css::uno::RuntimeException ); + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) throw ( css::uno::RuntimeException ); + + sal_Int32 getFontSizePixel( const Window* pWindow ); + + DECL_STATIC_LINK( FindTextToolbarController, ExecuteHdl_Impl, ExecuteInfo* ); + DECL_LINK(EditModifyHdl, void*); + +private: + + css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer; + FindTextFieldControl* m_pFindTextFieldControl; + + USHORT m_nDownSearchId; // item position of findbar + USHORT m_nUpSearchId; // item position of findbar + +}; + +class DownSearchToolboxController : public svt::ToolboxController, + public css::lang::XServiceInfo +{ +public: + + DownSearchToolboxController( const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager ); + ~DownSearchToolboxController(); + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ); + + static ::rtl::OUString getImplementationName_Static() throw() + { + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.svx.DownSearchToolboxController" )); + } + + static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); + + // XComponent + virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException ); + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException ); + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw ( css::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException ); + + DECL_STATIC_LINK( DownSearchToolboxController, ExecuteHdl_Impl, ExecuteInfo* ); + +private : + + css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer; + +}; + +class UpSearchToolboxController : public svt::ToolboxController, + public css::lang::XServiceInfo +{ +public: + + UpSearchToolboxController( const css::uno::Reference< css::lang::XMultiServiceFactory >& rServiceManager ); + ~UpSearchToolboxController(); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ); + + static ::rtl::OUString getImplementationName_Static() throw() + { + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.svx.UpSearchToolboxController" )); + } + + static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); + + // XComponent + virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException ); + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException); + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw ( css::uno::RuntimeException ); + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException ); + + DECL_STATIC_LINK( UpSearchToolboxController, ExecuteHdl_Impl, ExecuteInfo* ); + +private : + + css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer; + +}; + +// protocol handler for "vnd.sun.star.findbar:*" URLs +// The dispatch object will be used for shortcut commands for findbar +class FindbarDispatcher : public css::lang::XServiceInfo, + public css::lang::XInitialization, + public css::frame::XDispatchProvider, + public css::frame::XDispatch, + public ::cppu::OWeakObject +{ +public: + + FindbarDispatcher( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + virtual ~FindbarDispatcher(); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ); + + static ::rtl::OUString getImplementationName_Static() throw() + { + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.Impl.FindbarDispatcher" )); + } + + static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException ); + + // XDispatchProvider + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL& aURL, const ::rtl::OUString& sTargetFrameName , sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptions ) throw( css::uno::RuntimeException ); + + // XDispatch + virtual void SAL_CALL dispatch( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener, const css::util::URL& aURL ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener, const css::util::URL& aURL ) throw( css::uno::RuntimeException ); + +private: + + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory; + css::uno::Reference< css::frame::XFrame > m_xFrame; + +}; + +// createInstance +css::uno::Reference< css::uno::XInterface > SAL_CALL FindTextToolbarController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ); +css::uno::Reference< css::uno::XInterface > SAL_CALL DownSearchToolboxController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ); +css::uno::Reference< css::uno::XInterface > SAL_CALL UpSearchToolboxController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ); +css::uno::Reference< css::uno::XInterface > SAL_CALL FindbarDispatcher_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ); + +} + +#endif // __TBUNOSEARCHCONTROLLERS_HXX_ diff --git a/svx/source/tbxctrls/makefile.mk b/svx/source/tbxctrls/makefile.mk index 47da008e87a3..d7b264d30fc0 100644 --- a/svx/source/tbxctrls/makefile.mk +++ b/svx/source/tbxctrls/makefile.mk @@ -62,7 +62,8 @@ LIB2OBJFILES= \ $(SLO)$/verttexttbxctrl.obj \ $(SLO)$/subtoolboxcontrol.obj \ $(SLO)$/tbxcolor.obj \ - $(SLO)$/tbunocontroller.obj + $(SLO)$/tbunocontroller.obj \ + $(SLO)$/tbunosearchcontrollers.obj SLOFILES = $(LIB1OBJFILES) $(LIB2OBJFILES) diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx new file mode 100644 index 000000000000..8dcf2ceed0f0 --- /dev/null +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -0,0 +1,1018 @@ +/************************************************************************* + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svx.hxx" + +#include "tbunosearchcontrollers.hxx" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace svx +{ + +static const ::rtl::OUString SEARCHITEM_SEARCHSTRING = ::rtl::OUString::createFromAscii("SearchItem.SearchString"); +static const ::rtl::OUString SEARCHITEM_SEARCHBACKWARD = ::rtl::OUString::createFromAscii("SearchItem.Backward"); + +static const ::rtl::OUString COMMAND_FINDTEXT = ::rtl::OUString::createFromAscii(".uno:FindText") ; +static const ::rtl::OUString COMMAND_DOWNSEARCH = ::rtl::OUString::createFromAscii(".uno:DownSearch"); +static const ::rtl::OUString COMMAND_UPSEARCH = ::rtl::OUString::createFromAscii(".uno:UpSearch") ; + +static const ::rtl::OUString COMMAND_APPENDSEARCHHISTORY = ::rtl::OUString::createFromAscii("AppendSearchHistory") ; + +class FindTextFieldControl : public ComboBox +{ +public: + FindTextFieldControl( Window* pParent, WinBits nStyle, + css::uno::Reference< css::frame::XFrame >& xFrame, + css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~FindTextFieldControl(); + + virtual void Modify(); + virtual long PreNotify( NotifyEvent& rNEvt ); + + void InitControls_Impl(); + void Remember_Impl(const String& rStr); + +private: + + css::uno::Reference< css::frame::XFrame > m_xFrame; + css::uno::Reference < css::util::XURLTransformer > m_xURLTransformer; + css::uno::Reference< css::lang::XMultiServiceFactory > m_xServiceManager; + + sal_Bool m_bToClearTextField; + +}; + +FindTextFieldControl::FindTextFieldControl( Window* pParent, WinBits nStyle, + css::uno::Reference< css::frame::XFrame >& xFrame, + css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager) : + ComboBox( pParent, nStyle ), + m_xFrame(xFrame), + m_xServiceManager(xServiceManager), + m_bToClearTextField(sal_True) +{ + m_xURLTransformer = css::uno::Reference< css::util::XURLTransformer >( m_xServiceManager->createInstance( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), + css::uno::UNO_QUERY_THROW ); + + InitControls_Impl(); +} + +FindTextFieldControl::~FindTextFieldControl() +{ +} + +void FindTextFieldControl::InitControls_Impl() +{ + SetText( String( ::rtl::OUString::createFromAscii("Find") ) ); + SetControlForeground(COL_GRAY); + + EnableAutocomplete(TRUE, TRUE); +} + +void FindTextFieldControl::Remember_Impl(const String& rStr) +{ + USHORT nCount = GetEntryCount(); + for (USHORT i=0; iGetKeyCode().GetCode(); + sal_Bool bCtrl = pKeyEvent->GetKeyCode().IsMod1(); + if (bCtrl && KEY_G== nCode) + GrabFocusToDocument(); + + if (KEY_RETURN == nCode) + { + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + + Remember_Impl(GetText()); + + css::uno::Reference< css::frame::XDispatch > xDispatch; + css::util::URL aTargetURL; + + if ( m_xURLTransformer.is() ) + { + aTargetURL.Complete = ::rtl::OUString::createFromAscii(".uno:ExecuteSearch"); + m_xURLTransformer->parseStrict( aTargetURL ); + + css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( m_xFrame, css::uno::UNO_QUERY); + if ( xDispatchProvider.is() ) + xDispatch = xDispatchProvider->queryDispatch( aTargetURL, rtl::OUString(), 0 ); + } + + if ( xDispatch.is() && aTargetURL.Complete.getLength() > 0 ) + { + ::rtl::OUString sFindText = GetText(); + css::uno::Sequence< css::beans::PropertyValue > aArgs( 2 ); + aArgs[0].Name = SEARCHITEM_SEARCHSTRING; + aArgs[0].Value <<= sFindText; + aArgs[1].Name = SEARCHITEM_SEARCHBACKWARD; + aArgs[1].Value <<= sal_False; + + // Execute dispatch asynchronously + ExecuteInfo* pExecuteInfo = new ExecuteInfo; + pExecuteInfo->xDispatch = xDispatch; + pExecuteInfo->aTargetURL = aTargetURL; + pExecuteInfo->aArgs = aArgs; + Application::PostUserEvent( STATIC_LINK(0, DownSearchToolboxController , ExecuteHdl_Impl), pExecuteInfo ); + } + } + break; + } + + case EVENT_GETFOCUS: + if ( m_bToClearTextField ) + { + SetText( String() ); + m_bToClearTextField = sal_False; + } + break; + + case EVENT_LOSEFOCUS: + if ( GetText().Len() == 0 ) + { + SetText( String( ::rtl::OUString::createFromAscii("Find") ) ); + SetControlForeground(COL_GRAY); + + m_bToClearTextField = sal_True; + } + break; + } + + return nRet; +} + + +//----------------------------------------------------------------------------------------------------------- +// SearchToolbarControllersManager + +SearchToolbarControllersManager* SearchToolbarControllersManager::m_pInstance = 0; + +SearchToolbarControllersManager::SearchToolbarControllersManager() +{ +} + +SearchToolbarControllersManager::~SearchToolbarControllersManager() +{ +} + +SearchToolbarControllersManager* SearchToolbarControllersManager::createControllersManager() +{ + if (!m_pInstance) + m_pInstance = new SearchToolbarControllersManager(); + + return m_pInstance; +} + +void SearchToolbarControllersManager::registryController( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& xStatusListener, const ::rtl::OUString& sCommandURL ) +{ + SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame); + if (pIt == aSearchToolbarControllersMap.end()) + { + SearchToolbarControllersVec lControllers(1); + lControllers[0].Name = sCommandURL; + lControllers[0].Value <<= xStatusListener; + aSearchToolbarControllersMap.insert(SearchToolbarControllersMap::value_type(xFrame, lControllers)); + } + else + { + sal_Int32 nSize = pIt->second.size(); + for (sal_Int32 i=0; isecond[i].Name.equals(sCommandURL)) + return; + } + + pIt->second.resize(nSize+1); + pIt->second[nSize].Name = sCommandURL; + pIt->second[nSize].Value <<= xStatusListener; + } + +} + +void SearchToolbarControllersManager::freeController( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& xStatusListener, const ::rtl::OUString& sCommandURL ) +{ + SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame); + if (pIt != aSearchToolbarControllersMap.end()) + { + for (SearchToolbarControllersVec::iterator pItCtrl=pIt->second.begin(); pItCtrl!=pIt->second.end(); ++pItCtrl) + { + if (pItCtrl->Name.equals(sCommandURL)) + { + pIt->second.erase(pItCtrl); + break; + } + } + + if (pIt->second.empty()) + aSearchToolbarControllersMap.erase(pIt); + } +} + +css::uno::Reference< css::frame::XStatusListener > SearchToolbarControllersManager::findController( const css::uno::Reference< css::frame::XFrame >& xFrame, const ::rtl::OUString& sCommandURL ) +{ + css::uno::Reference< css::frame::XStatusListener > xStatusListener; + + SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame); + if (pIt != aSearchToolbarControllersMap.end()) + { + for (SearchToolbarControllersVec::iterator pItCtrl =pIt->second.begin(); pItCtrl != pIt->second.end(); ++pItCtrl) + { + if (pItCtrl->Name.equals(sCommandURL)) + { + pItCtrl->Value >>= xStatusListener; + break; + } + } + } + + return xStatusListener; +} + +//----------------------------------------------------------------------------------------------------------- +// FindTextToolbarController + +FindTextToolbarController::FindTextToolbarController( const css::uno::Reference< css::lang::XMultiServiceFactory >& rServiceManager ) + :svt::ToolboxController( rServiceManager, + css::uno::Reference< css::frame::XFrame >(), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FindText" )) ) +{ + m_xURLTransformer = css::uno::Reference< css::util::XURLTransformer >( m_xServiceManager->createInstance( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), + css::uno::UNO_QUERY_THROW ); +} + +FindTextToolbarController::~FindTextToolbarController() +{ +} + +// XInterface +css::uno::Any SAL_CALL FindTextToolbarController::queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ) +{ + css::uno::Any a = ToolboxController::queryInterface( aType ); + if ( a.hasValue() ) + return a; + + return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >( this ) ); +} + +void SAL_CALL FindTextToolbarController::acquire() throw () +{ + ToolboxController::acquire(); +} + +void SAL_CALL FindTextToolbarController::release() throw () +{ + ToolboxController::release(); +} + +// XServiceInfo +::rtl::OUString SAL_CALL FindTextToolbarController::getImplementationName() throw( css::uno::RuntimeException ) +{ + return getImplementationName_Static(); +} + +sal_Bool SAL_CALL FindTextToolbarController::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ) +{ + const css::uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); + const ::rtl::OUString * pArray = aSNL.getConstArray(); + + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == ServiceName ) + return true; + + return false; +} + +css::uno::Sequence< ::rtl::OUString > SAL_CALL FindTextToolbarController::getSupportedServiceNames() throw( css::uno::RuntimeException ) +{ + return getSupportedServiceNames_Static(); +} + +css::uno::Sequence< ::rtl::OUString > FindTextToolbarController::getSupportedServiceNames_Static() throw() +{ + css::uno::Sequence< ::rtl::OUString > aSNS( 1 ); + aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ) ); + return aSNS; +} + +// XComponent +void SAL_CALL FindTextToolbarController::dispose() throw ( css::uno::RuntimeException ) +{ + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + + SearchToolbarControllersManager::createControllersManager()->freeController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); + + svt::ToolboxController::dispose(); + delete m_pFindTextFieldControl; + m_pFindTextFieldControl = 0; +} + +// XInitialization +void SAL_CALL FindTextToolbarController::initialize( const css::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException) +{ + svt::ToolboxController::initialize(aArguments); + + Window* pWindow = VCLUnoHelper::GetWindow( getParent() ); + ToolBox* pToolBox = (ToolBox*)pWindow; + if ( pToolBox ) + { + USHORT nItemCount = pToolBox->GetItemCount(); + for ( USHORT i=0; iGetItemCommand(i); + if ( sItemCommand.equals( COMMAND_DOWNSEARCH ) ) + m_nDownSearchId = i; + else if (sItemCommand.equals( COMMAND_UPSEARCH )) + m_nUpSearchId = i; + } + } + + SearchToolbarControllersManager::createControllersManager()->registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); +} + +// XToolbarController +void SAL_CALL FindTextToolbarController::execute( sal_Int16 /*KeyModifier*/ ) throw ( css::uno::RuntimeException ) +{ +} + +css::uno::Reference< css::awt::XWindow > SAL_CALL FindTextToolbarController::createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) throw ( css::uno::RuntimeException ) +{ + css::uno::Reference< css::awt::XWindow > xItemWindow; + + css::uno::Reference< css::awt::XWindow > xParent( Parent ); + Window* pParent = VCLUnoHelper::GetWindow( xParent ); + if ( pParent ) + { + ToolBox* pToolbar = ( ToolBox* )pParent; + m_pFindTextFieldControl = new FindTextFieldControl( pToolbar, WinBits( WB_DROPDOWN | WB_VSCROLL), m_xFrame, m_xServiceManager ); + + // Calculate height of the edit field according to the application font height + sal_Int32 nHeight = getFontSizePixel( m_pFindTextFieldControl ); + nHeight += 200; + m_pFindTextFieldControl->SetSizePixel( Size( 100, nHeight )); + + m_pFindTextFieldControl->SetModifyHdl(LINK(this, FindTextToolbarController, EditModifyHdl)); + + } + xItemWindow = VCLUnoHelper::GetInterface( m_pFindTextFieldControl ); + + return xItemWindow; +} + +// XStatusListener +void SAL_CALL FindTextToolbarController::statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException ) +{ + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + if ( m_bDisposed ) + return; + + ::rtl::OUString aFeatureURL = rEvent.FeatureURL.Complete; + if (aFeatureURL.equalsAscii("AppendSearchHistory")) + { + m_pFindTextFieldControl->Remember_Impl(m_pFindTextFieldControl->GetText()); + } +} + +sal_Int32 FindTextToolbarController::getFontSizePixel( const Window* pWindow ) +{ + const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); + const Font& rFont = rSettings.GetAppFont(); + + // Calculate height of the application font used by window + sal_Int32 nHeight = sal_Int32( rFont.GetHeight() ); + ::Size aPixelSize = pWindow->LogicToPixel( ::Size( 0, nHeight ), MAP_APPFONT ); + return aPixelSize.Height(); +} + +IMPL_STATIC_LINK_NOINSTANCE( FindTextToolbarController, ExecuteHdl_Impl, ExecuteInfo*, pExecuteInfo ) +{ + const sal_uInt32 nRef = Application::ReleaseSolarMutex(); + try + { + // Asynchronous execution as this can lead to our own destruction! + // Framework can recycle our current frame and the layout manager disposes all user interface + // elements if a component gets detached from its frame! + pExecuteInfo->xDispatch->dispatch( pExecuteInfo->aTargetURL, pExecuteInfo->aArgs ); + } + catch ( css::uno::Exception& ) + { + + } + + Application::AcquireSolarMutex( nRef ); + delete pExecuteInfo; + + return 0; +} + +IMPL_LINK( FindTextToolbarController, EditModifyHdl, void *, EMPTYARG ) +{ + // enable or disable item DownSearch/UpSearch of findbar + Window* pWindow = VCLUnoHelper::GetWindow( getParent() ); + ToolBox* pToolBox = (ToolBox*)pWindow; + if ( pToolBox && m_pFindTextFieldControl ) + { + if (m_pFindTextFieldControl->GetText().Len()>0) + { + if ( !pToolBox->IsItemEnabled(m_nDownSearchId) ) + pToolBox->EnableItem(m_nDownSearchId, sal_True); + if ( !pToolBox->IsItemEnabled(m_nUpSearchId) ) + pToolBox->EnableItem(m_nUpSearchId, sal_True); + } + else + { + if ( pToolBox->IsItemEnabled(m_nDownSearchId) ) + pToolBox->EnableItem(m_nDownSearchId, sal_False); + if ( pToolBox->IsItemEnabled(m_nUpSearchId) ) + pToolBox->EnableItem(m_nUpSearchId, sal_False); + } + } + + return 0; +} + +//----------------------------------------------------------------------------------------------------------- +// class DownSearchToolboxController + +DownSearchToolboxController::DownSearchToolboxController(const css::uno::Reference< css::lang::XMultiServiceFactory >& rServiceManager ) + : svt::ToolboxController( rServiceManager, + css::uno::Reference< css::frame::XFrame >(), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DownSearch" )) ) +{ + m_xURLTransformer = css::uno::Reference< css::util::XURLTransformer >( m_xServiceManager->createInstance( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), + css::uno::UNO_QUERY_THROW ); +} + +DownSearchToolboxController::~DownSearchToolboxController() +{ +} + +// XInterface +css::uno::Any SAL_CALL DownSearchToolboxController::queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ) +{ + css::uno::Any a = ToolboxController::queryInterface( aType ); + if ( a.hasValue() ) + return a; + + return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >( this ) ); +} + +void SAL_CALL DownSearchToolboxController::acquire() throw () +{ + ToolboxController::acquire(); +} + +void SAL_CALL DownSearchToolboxController::release() throw () +{ + ToolboxController::release(); +} + +// XServiceInfo +::rtl::OUString SAL_CALL DownSearchToolboxController::getImplementationName() throw( css::uno::RuntimeException ) +{ + return getImplementationName_Static(); +} + +sal_Bool SAL_CALL DownSearchToolboxController::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ) +{ + const css::uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); + const ::rtl::OUString * pArray = aSNL.getConstArray(); + + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == ServiceName ) + return true; + + return false; +} + +css::uno::Sequence< ::rtl::OUString > SAL_CALL DownSearchToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException ) +{ + return getSupportedServiceNames_Static(); +} + +css::uno::Sequence< ::rtl::OUString > DownSearchToolboxController::getSupportedServiceNames_Static() throw() +{ + css::uno::Sequence< ::rtl::OUString > aSNS( 1 ); + aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); + return aSNS; +} + +// XComponent +void SAL_CALL DownSearchToolboxController::dispose() throw ( css::uno::RuntimeException ) +{ + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + + SearchToolbarControllersManager::createControllersManager()->freeController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); + + svt::ToolboxController::dispose(); +} + +// XInitialization +void SAL_CALL DownSearchToolboxController::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException ) +{ + svt::ToolboxController::initialize( aArguments ); + SearchToolbarControllersManager::createControllersManager()->registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); +} + +// XToolbarController +void SAL_CALL DownSearchToolboxController::execute( sal_Int16 /*KeyModifier*/ ) throw ( css::uno::RuntimeException) +{ + if ( m_bDisposed ) + throw css::lang::DisposedException(); + + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + + css::uno::Reference< css::frame::XDispatch > xDispatch; + css::util::URL aTargetURL; + + if ( m_xURLTransformer.is() ) + { + aTargetURL.Complete = ::rtl::OUString::createFromAscii(".uno:ExecuteSearch"); + m_xURLTransformer->parseStrict( aTargetURL ); + + css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( m_xFrame, css::uno::UNO_QUERY); + if ( xDispatchProvider.is() ) + xDispatch = xDispatchProvider->queryDispatch( aTargetURL, rtl::OUString(), 0 ); + } + + if ( xDispatch.is() && aTargetURL.Complete.getLength() > 0 ) + { + ::rtl::OUString sFindText; + Window* pWindow = VCLUnoHelper::GetWindow( getParent() ); + ToolBox* pToolBox = (ToolBox*)pWindow; + if ( pToolBox ) + { + USHORT nItemCount = pToolBox->GetItemCount(); + for ( USHORT i=0; iGetItemCommand(i); + if ( sItemCommand.equals( COMMAND_FINDTEXT ) ) + { + Window* pItemWin = pToolBox->GetItemWindow(i); + if (pItemWin) + sFindText = pItemWin->GetText(); + break; + } + } + } + + css::uno::Sequence< css::beans::PropertyValue > aArgs( 2 ); + aArgs[0].Name = SEARCHITEM_SEARCHSTRING; + aArgs[0].Value <<= sFindText; + aArgs[1].Name = SEARCHITEM_SEARCHBACKWARD; + aArgs[1].Value <<= sal_False; + + // Execute dispatch asynchronously + ExecuteInfo* pExecuteInfo = new ExecuteInfo; + pExecuteInfo->xDispatch = xDispatch; + pExecuteInfo->aTargetURL = aTargetURL; + pExecuteInfo->aArgs = aArgs; + Application::PostUserEvent( STATIC_LINK(0, DownSearchToolboxController , ExecuteHdl_Impl), pExecuteInfo ); + + css::frame::FeatureStateEvent aEvent; + css::util::URL aCommand; + aCommand.Complete = COMMAND_APPENDSEARCHHISTORY; + aEvent.FeatureURL = aCommand; + aEvent.IsEnabled = sal_True; + + css::uno::Reference< css::frame::XStatusListener > xStatusListener = SearchToolbarControllersManager::createControllersManager()->findController(m_xFrame, COMMAND_FINDTEXT); + xStatusListener->statusChanged( aEvent ); + } +} + +// XStatusListener +void SAL_CALL DownSearchToolboxController::statusChanged( const css::frame::FeatureStateEvent& /*rEvent*/ ) throw ( css::uno::RuntimeException ) +{ +} + +IMPL_STATIC_LINK_NOINSTANCE( DownSearchToolboxController, ExecuteHdl_Impl, ExecuteInfo*, pExecuteInfo ) +{ + const sal_uInt32 nRef = Application::ReleaseSolarMutex(); + try + { + // Asynchronous execution as this can lead to our own destruction! + // Framework can recycle our current frame and the layout manager disposes all user interface + // elements if a component gets detached from its frame! + pExecuteInfo->xDispatch->dispatch( pExecuteInfo->aTargetURL, pExecuteInfo->aArgs ); + } + catch ( css::uno::Exception& ) + { + } + + Application::AcquireSolarMutex( nRef ); + delete pExecuteInfo; + + return 0; +} + +//----------------------------------------------------------------------------------------------------------- +// class UpSearchToolboxController + +UpSearchToolboxController::UpSearchToolboxController( const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager ) + :svt::ToolboxController( rServiceManager, + css::uno::Reference< css::frame::XFrame >(), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:UpSearch" )) ) +{ + m_xURLTransformer = css::uno::Reference< css::util::XURLTransformer >( m_xServiceManager->createInstance( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), + css::uno::UNO_QUERY_THROW ); +} + +UpSearchToolboxController::~UpSearchToolboxController() +{ +} + +// XInterface +css::uno::Any SAL_CALL UpSearchToolboxController::queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException ) +{ + css::uno::Any a = ToolboxController::queryInterface( aType ); + if ( a.hasValue() ) + return a; + + return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >( this ) ); +} + +void SAL_CALL UpSearchToolboxController::acquire() throw () +{ + ToolboxController::acquire(); +} + +void SAL_CALL UpSearchToolboxController::release() throw () +{ + ToolboxController::release(); +} + +// XServiceInfo +::rtl::OUString SAL_CALL UpSearchToolboxController::getImplementationName() throw( css::uno::RuntimeException ) +{ + return getImplementationName_Static(); +} + +sal_Bool SAL_CALL UpSearchToolboxController::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ) +{ + const css::uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); + const ::rtl::OUString * pArray = aSNL.getConstArray(); + + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == ServiceName ) + return true; + + return false; +} + +css::uno::Sequence< ::rtl::OUString > SAL_CALL UpSearchToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException ) +{ + return getSupportedServiceNames_Static(); +} + +css::uno::Sequence< ::rtl::OUString > UpSearchToolboxController::getSupportedServiceNames_Static() throw() +{ + css::uno::Sequence< ::rtl::OUString > aSNS( 1 ); + aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ) ); + return aSNS; +} + +// XComponent +void SAL_CALL UpSearchToolboxController::dispose() throw ( css::uno::RuntimeException ) +{ + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + + SearchToolbarControllersManager::createControllersManager()->freeController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); + + svt::ToolboxController::dispose(); +} + +// XInitialization +void SAL_CALL UpSearchToolboxController::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException ) +{ + svt::ToolboxController::initialize( aArguments ); + SearchToolbarControllersManager::createControllersManager()->registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); +} + +// XToolbarController +void SAL_CALL UpSearchToolboxController::execute( sal_Int16 /*KeyModifier*/ ) throw ( css::uno::RuntimeException ) +{ + if ( m_bDisposed ) + throw css::lang::DisposedException(); + + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + + css::uno::Reference< css::frame::XDispatch > xDispatch; + css::util::URL aTargetURL; + + if ( m_xURLTransformer.is() ) + { + aTargetURL.Complete = ::rtl::OUString::createFromAscii(".uno:ExecuteSearch"); + m_xURLTransformer->parseStrict( aTargetURL ); + + css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( m_xFrame, css::uno::UNO_QUERY); + if ( xDispatchProvider.is() ) + xDispatch = xDispatchProvider->queryDispatch( aTargetURL, rtl::OUString(), 0 ); + } + + if ( xDispatch.is() && aTargetURL.Complete.getLength() > 0 ) + { + ::rtl::OUString sFindText; + Window* pWindow = VCLUnoHelper::GetWindow( getParent() ); + ToolBox* pToolBox = (ToolBox*)pWindow; + if ( pToolBox ) + { + USHORT nItemCount = pToolBox->GetItemCount(); + for ( USHORT i=0; iGetItemCommand(i); + if ( sItemCommand.equals( COMMAND_FINDTEXT ) ) + { + Window* pItemWin = pToolBox->GetItemWindow(i); + if (pItemWin) + sFindText = pItemWin->GetText(); + break; + } + } + } + + css::uno::Sequence< css::beans::PropertyValue > aArgs( 2 ); + aArgs[0].Name = SEARCHITEM_SEARCHSTRING; + aArgs[0].Value <<= sFindText; + aArgs[1].Name = SEARCHITEM_SEARCHBACKWARD; + aArgs[1].Value <<= sal_True; + + // Execute dispatch asynchronously + ExecuteInfo* pExecuteInfo = new ExecuteInfo; + pExecuteInfo->xDispatch = xDispatch; + pExecuteInfo->aTargetURL = aTargetURL; + pExecuteInfo->aArgs = aArgs; + Application::PostUserEvent( STATIC_LINK(0, UpSearchToolboxController , ExecuteHdl_Impl), pExecuteInfo ); + + css::frame::FeatureStateEvent aEvent; + css::util::URL aCommand; + aCommand.Complete = COMMAND_APPENDSEARCHHISTORY; + aEvent.FeatureURL = aCommand; + aEvent.IsEnabled = sal_True; + + css::uno::Reference< css::frame::XStatusListener > xStatusListener = SearchToolbarControllersManager::createControllersManager()->findController(m_xFrame, COMMAND_FINDTEXT); + xStatusListener->statusChanged( aEvent ); + } +} + +// XStatusListener +void SAL_CALL UpSearchToolboxController::statusChanged( const css::frame::FeatureStateEvent& /*rEvent*/ ) throw ( css::uno::RuntimeException ) +{ +} + +IMPL_STATIC_LINK_NOINSTANCE( UpSearchToolboxController, ExecuteHdl_Impl, ExecuteInfo*, pExecuteInfo ) +{ + const sal_uInt32 nRef = Application::ReleaseSolarMutex(); + try + { + // Asynchronous execution as this can lead to our own destruction! + // Framework can recycle our current frame and the layout manager disposes all user interface + // elements if a component gets detached from its frame! + pExecuteInfo->xDispatch->dispatch( pExecuteInfo->aTargetURL, pExecuteInfo->aArgs ); + } + catch ( css::uno::Exception& ) + { + } + + Application::AcquireSolarMutex( nRef ); + delete pExecuteInfo; + + return 0; +} + +//----------------------------------------------------------------------------------------------------------- +// class FindbarDispatcher + +FindbarDispatcher::FindbarDispatcher(const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory) + : m_xFactory( xFactory ) +{ +} + +FindbarDispatcher::~FindbarDispatcher() +{ + m_xFactory = NULL; + m_xFrame = NULL; +} + +// XInterface +css::uno::Any SAL_CALL FindbarDispatcher::queryInterface( const css::uno::Type& aType ) throw( css::uno::RuntimeException ) +{ + css::uno::Any aReturn( ::cppu::queryInterface( aType, + static_cast< css::lang::XServiceInfo* >(this), + static_cast< css::lang::XInitialization* >(this), + static_cast< css::frame::XDispatchProvider* >(this), + static_cast< css::frame::XDispatch* >(this)) ); + + if ( aReturn.hasValue() ) + return aReturn; + + return OWeakObject::queryInterface( aType ); +} + +void SAL_CALL FindbarDispatcher::acquire() throw() +{ + OWeakObject::acquire(); +} + +void SAL_CALL FindbarDispatcher::release() throw() +{ + OWeakObject::release(); +} + +// XServiceInfo +::rtl::OUString SAL_CALL FindbarDispatcher::getImplementationName() throw( css::uno::RuntimeException ) +{ + return getImplementationName_Static(); +} + +sal_Bool SAL_CALL FindbarDispatcher::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException ) +{ + return ( + ServiceName.equalsAscii("com.sun.star.comp.svx.FindbarDispatcher") || + ServiceName.equalsAscii("com.sun.star.frame.ProtocolHandler") + ); +} + +css::uno::Sequence< ::rtl::OUString > SAL_CALL FindbarDispatcher::getSupportedServiceNames() throw( css::uno::RuntimeException ) +{ + return getSupportedServiceNames_Static(); +} + +css::uno::Sequence< ::rtl::OUString > FindbarDispatcher::getSupportedServiceNames_Static() throw() +{ + css::uno::Sequence< ::rtl::OUString > aSNS( 2 ); + aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.FindbarDispatcher" )); + aSNS.getArray()[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ProtocolHandler" )); + return aSNS; +} + +// XInitialization +void SAL_CALL FindbarDispatcher::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException ) +{ + if ( aArguments.getLength() ) + { + aArguments[0] >>= m_xFrame; + } +} + +// XDispatchProvider +css::uno::Reference< css::frame::XDispatch > SAL_CALL FindbarDispatcher::queryDispatch( const css::util::URL& aURL, const ::rtl::OUString& /*sTargetFrameName*/, sal_Int32 /*nSearchFlags*/ ) throw( css::uno::RuntimeException ) +{ + css::uno::Reference< css::frame::XDispatch > xDispatch; + + if ( aURL.Protocol.equalsAscii("vnd.sun.star.findbar:") ) + xDispatch = this; + + return xDispatch; +} + +css::uno::Sequence < css::uno::Reference< css::frame::XDispatch > > SAL_CALL FindbarDispatcher::queryDispatches( const css::uno::Sequence < css::frame::DispatchDescriptor >& seqDescripts ) throw( css::uno::RuntimeException ) +{ + sal_Int32 nCount = seqDescripts.getLength(); + css::uno::Sequence < css::uno::Reference < XDispatch > > lDispatcher( nCount ); + + for( sal_Int32 i=0; i& /*lArgs*/ ) throw( css::uno::RuntimeException ) +{ + //vnd.sun.star.findbar:FocusToFindbar - set cursor to the FindTextFieldControl of the findbar + if ( aURL.Path.equalsAscii("FocusToFindbar") ) + { + css::uno::Reference< css::beans::XPropertySet > xPropSet(m_xFrame, css::uno::UNO_QUERY); + if(!xPropSet.is()) + return; + + css::uno::Reference< css::frame::XLayoutManager > xLayoutManager; + css::uno::Any aValue = xPropSet->getPropertyValue( ::rtl::OUString::createFromAscii("LayoutManager") ); + aValue >>= xLayoutManager; + if (!xLayoutManager.is()) + return; + + const ::rtl::OUString sResourceURL = ::rtl::OUString::createFromAscii("private:resource/toolbar/findbar"); + css::uno::Reference< css::ui::XUIElement > xUIElement = xLayoutManager->getElement(sResourceURL); + if (!xUIElement.is()) + return; + + css::uno::Reference< css::awt::XWindow > xWindow(xUIElement->getRealInterface(), css::uno::UNO_QUERY); + Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + ToolBox* pToolBox = (ToolBox*)pWindow; + if ( pToolBox ) + { + USHORT nItemCount = pToolBox->GetItemCount(); + for ( USHORT i=0; iGetItemCommand(i); + if ( sItemCommand.equalsAscii(".uno:FindText") ) + { + Window* pItemWin = pToolBox->GetItemWindow( i ); + if ( pItemWin ) + { + pItemWin->GrabFocus(); + return; + } + } + } + } + + } +} + +void SAL_CALL FindbarDispatcher::addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& /*xControl*/, const css::util::URL& /*aURL*/ ) throw ( css::uno::RuntimeException ) +{ +} + +void SAL_CALL FindbarDispatcher::removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& /*xControl*/, const css::util::URL& /*aURL*/ ) throw ( css::uno::RuntimeException ) +{ +} + +//----------------------------------------------------------------------------------------------------------- +// create Instance + +css::uno::Reference< css::uno::XInterface > SAL_CALL FindTextToolbarController_createInstance( + const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ) +{ + return *new FindTextToolbarController( rSMgr ); +} + +css::uno::Reference< css::uno::XInterface > SAL_CALL DownSearchToolboxController_createInstance( + const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ) +{ + return *new DownSearchToolboxController( rSMgr ); +} + +css::uno::Reference< css::uno::XInterface > SAL_CALL UpSearchToolboxController_createInstance( + const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ) +{ + return *new UpSearchToolboxController( rSMgr ); +} + +css::uno::Reference< css::uno::XInterface > SAL_CALL FindbarDispatcher_createInstance( + const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr ) +{ + return *new FindbarDispatcher( rSMgr ); +} + +//----------------------------------------------------------------------------------------------------------- +} diff --git a/svx/source/unodraw/unoctabl.cxx b/svx/source/unodraw/unoctabl.cxx index 5dd4814c6ab5..8ebc27406676 100644 --- a/svx/source/unodraw/unoctabl.cxx +++ b/svx/source/unodraw/unoctabl.cxx @@ -39,6 +39,7 @@ #include "recoveryui.hxx" #include "xmlgrhlp.hxx" #include "tbunocontroller.hxx" +#include "tbunosearchcontrollers.hxx" using namespace ::com::sun::star; using namespace ::rtl; @@ -283,6 +284,12 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( writeInfo( pKey, svx::GraphicExporter_getImplementationName(), svx::GraphicExporter_getSupportedServiceNames() ); #endif writeInfo( pKey, svx::FontHeightToolBoxControl::getImplementationName_Static(), svx::FontHeightToolBoxControl::getSupportedServiceNames_Static() ); + + writeInfo( pKey, svx::FindTextToolbarController::getImplementationName_Static(), svx::FindTextToolbarController::getSupportedServiceNames_Static() ); + writeInfo( pKey, svx::DownSearchToolboxController::getImplementationName_Static(), svx::DownSearchToolboxController::getSupportedServiceNames_Static() ); + writeInfo( pKey, svx::UpSearchToolboxController::getImplementationName_Static(), svx::UpSearchToolboxController::getSupportedServiceNames_Static() ); + writeInfo( pKey, svx::FindbarDispatcher::getImplementationName_Static(), svx::FindbarDispatcher::getSupportedServiceNames_Static() ); + writeInfo( pKey, ::unogallery::GalleryThemeProvider_getImplementationName(),::unogallery::GalleryThemeProvider_getSupportedServiceNames() ); // XPrimitiveFactory2D @@ -354,6 +361,34 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( svx::FontHeightToolBoxControl_createInstance, svx::FontHeightToolBoxControl::getSupportedServiceNames_Static() ); } + else if ( svx::FindTextToolbarController::getImplementationName_Static().equalsAscii( pImplName ) ) + { + xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), + svx::FindTextToolbarController::getImplementationName_Static(), + svx::FindTextToolbarController_createInstance, + svx::FindTextToolbarController::getSupportedServiceNames_Static() ); + } + else if ( svx::DownSearchToolboxController::getImplementationName_Static().equalsAscii( pImplName ) ) + { + xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), + svx::DownSearchToolboxController::getImplementationName_Static(), + svx::DownSearchToolboxController_createInstance, + svx::DownSearchToolboxController::getSupportedServiceNames_Static() ); + } + else if ( svx::UpSearchToolboxController::getImplementationName_Static().equalsAscii( pImplName ) ) + { + xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), + svx::UpSearchToolboxController::getImplementationName_Static(), + svx::UpSearchToolboxController_createInstance, + svx::UpSearchToolboxController::getSupportedServiceNames_Static() ); + } + else if ( svx::FindbarDispatcher::getImplementationName_Static().equalsAscii( pImplName ) ) + { + xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), + svx::FindbarDispatcher::getImplementationName_Static(), + svx::FindbarDispatcher_createInstance, + svx::FindbarDispatcher::getSupportedServiceNames_Static() ); + } else if( ::unogallery::GalleryThemeProvider_getImplementationName().equalsAscii( pImplName ) ) { xFactory = ::cppu::createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), -- cgit From 82ae549c279a703f929e62a57cdc9e58570e2ecd Mon Sep 17 00:00:00 2001 From: Ruediger Timm Date: Wed, 28 Apr 2010 19:20:53 +0200 Subject: rt38: #i110940#: Cleaned some deliver lists - do not try to copy non-existing files. --- svx/prj/d.lst | 138 ---------------------------------------------------------- 1 file changed, 138 deletions(-) (limited to 'svx') diff --git a/svx/prj/d.lst b/svx/prj/d.lst index 7d2f508d9d21..c14b3a812738 100644 --- a/svx/prj/d.lst +++ b/svx/prj/d.lst @@ -35,7 +35,6 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\%__SRC%\inc\svxslots.hxx %_DEST%\inc%_EXT%\svx\svxslots.hxx ..\%__SRC%\inc\globlmn.hrc %_DEST%\inc%_EXT%\svx\globlmn.hrc ..\source\inc\fmresids.hrc %_DEST%\inc%_EXT%\svx\fmresids.hrc -..\source\items\boxobj.hxx %_DEST%\inc%_EXT%\svx\boxobj.hxx ..\source\dialog\hyprlink.hxx %_DEST%\inc%_EXT%\svx\hyprlink.hxx ../source/customshapes/EnhancedCustomShapeTypeNames.hxx %_DEST%\inc%_EXT%\svx\EnhancedCustomShapeTypeNames.hxx @@ -46,75 +45,49 @@ mkdir: %_DEST%\inc%_EXT%\svx ../inc/svdglob.hxx %_DEST%\inc%_EXT%\svx\svdglob.hxx ../source/svdraw/svditext.hxx %_DEST%\inc%_EXT%\svx\svditext.hxx -..\inc\AccessibleSelectionBase.hxx %_DEST%\inc%_EXT%\svx\AccessibleSelectionBase.hxx -..\inc\AccessibleStaticTextBase.hxx %_DEST%\inc%_EXT%\svx\AccessibleStaticTextBase.hxx -..\inc\acorrcfg.hxx %_DEST%\inc%_EXT%\svx\acorrcfg.hxx ..\inc\ActionDescriptionProvider.hxx %_DEST%\inc%_EXT%\svx\ActionDescriptionProvider.hxx ..\inc\anchorid.hxx %_DEST%\inc%_EXT%\svx\anchorid.hxx -..\inc\asiancfg.hxx %_DEST%\inc%_EXT%\svx\asiancfg.hxx -..\inc\bolnitem.hxx %_DEST%\inc%_EXT%\svx\bolnitem.hxx -..\inc\bulitem.hxx %_DEST%\inc%_EXT%\svx\bulitem.hxx -..\inc\charhiddenitem.hxx %_DEST%\inc%_EXT%\svx\charhiddenitem.hxx ..\inc\chrtitem.hxx %_DEST%\inc%_EXT%\svx\chrtitem.hxx ..\inc\clipboardctl.hxx %_DEST%\inc%_EXT%\svx\clipboardctl.hxx ..\inc\clipfmtitem.hxx %_DEST%\inc%_EXT%\svx\clipfmtitem.hxx ..\inc\connctrl.hxx %_DEST%\inc%_EXT%\svx\connctrl.hxx -..\inc\countryid.hxx %_DEST%\inc%_EXT%\svx\countryid.hxx ..\inc\databaseregistrationui.hxx %_DEST%\inc%_EXT%\svx\databaseregistrationui.hxx ..\inc\dbexch.hrc %_DEST%\inc%_EXT%\svx\dbexch.hrc ..\inc\DescriptionGenerator.hxx %_DEST%\inc%_EXT%\svx\DescriptionGenerator.hxx ..\inc\dialcontrol.hxx %_DEST%\inc%_EXT%\svx\dialcontrol.hxx ..\inc\dlgutil.hxx %_DEST%\inc%_EXT%\svx\dlgutil.hxx ..\inc\drawitem.hxx %_DEST%\inc%_EXT%\svx\drawitem.hxx -..\inc\editstat.hxx %_DEST%\inc%_EXT%\svx\editstat.hxx -..\inc\editund2.hxx %_DEST%\inc%_EXT%\svx\editund2.hxx -..\inc\eerdll.hxx %_DEST%\inc%_EXT%\svx\editdll.hxx ..\inc\extrusioncontrols.hxx %_DEST%\inc%_EXT%\svx\extrusioncontrols.hxx -..\inc\flstitem.hxx %_DEST%\inc%_EXT%\svx\flstitem.hxx ..\inc\fmgridif.hxx %_DEST%\inc%_EXT%\svx\fmgridif.hxx ..\inc\fmobjfac.hxx %_DEST%\inc%_EXT%\svx\fmobjfac.hxx -..\inc\fontitem.hxx %_DEST%\inc%_EXT%\svx\fontitem.hxx ..\inc\fontlb.hxx %_DEST%\inc%_EXT%\svx\fontlb.hxx ..\inc\fontworkgallery.hxx %_DEST%\inc%_EXT%\svx\fontworkgallery.hxx -..\inc\forbiddencharacterstable.hxx %_DEST%\inc%_EXT%\svx\forbiddencharacterstable.hxx ..\inc\formatpaintbrushctrl.hxx %_DEST%\inc%_EXT%\svx\formatpaintbrushctrl.hxx -..\inc\fwdtitem.hxx %_DEST%\inc%_EXT%\svx\fwdtitem.hxx ..\inc\gallery.hxx %_DEST%\inc%_EXT%\svx\gallery.hxx ..\inc\galbrws.hxx %_DEST%\inc%_EXT%\svx\galbrws.hxx ..\inc\globlac.hrc %_DEST%\inc%_EXT%\svx\globlac.hrc ..\inc\globl3d.hxx %_DEST%\inc%_EXT%\svx\globl3d.hxx ..\inc\grafctrl.hxx %_DEST%\inc%_EXT%\svx\grafctrl.hxx ..\inc\hlnkitem.hxx %_DEST%\inc%_EXT%\svx\hlnkitem.hxx -..\inc\htmlcfg.hxx %_DEST%\inc%_EXT%\svx\htmlcfg.hxx ..\inc\htmlmode.hxx %_DEST%\inc%_EXT%\svx\htmlmode.hxx ..\inc\hyperdlg.hxx %_DEST%\inc%_EXT%\svx\hyperdlg.hxx ..\inc\imapdlg.hxx %_DEST%\inc%_EXT%\svx\imapdlg.hxx -..\inc\opengrf.hxx %_DEST%\inc%_EXT%\svx\opengrf.hxx ..\inc\insctrl.hxx %_DEST%\inc%_EXT%\svx\insctrl.hxx ..\inc\layctrl.hxx %_DEST%\inc%_EXT%\svx\layctrl.hxx ..\inc\lboxctrl.hxx %_DEST%\inc%_EXT%\svx\lboxctrl.hxx ..\inc\linectrl.hxx %_DEST%\inc%_EXT%\svx\linectrl.hxx -..\inc\linkmgr.hxx %_DEST%\inc%_EXT%\svx\linkmgr.hxx ..\inc\measctrl.hxx %_DEST%\inc%_EXT%\svx\measctrl.hxx ..\inc\modctrl.hxx %_DEST%\inc%_EXT%\svx\modctrl.hxx -..\inc\mscodec.hxx %_DEST%\inc%_EXT%\svx\mscodec.hxx -..\inc\msoleexp.hxx %_DEST%\inc%_EXT%\svx\msoleexp.hxx -..\inc\nlbkitem.hxx %_DEST%\inc%_EXT%\svx\nlbkitem.hxx ..\inc\numvset.hxx %_DEST%\inc%_EXT%\svx\numvset.hxx ..\inc\objfac3d.hxx %_DEST%\inc%_EXT%\svx\objfac3d.hxx ..\inc\ofaitem.hxx %_DEST%\inc%_EXT%\svx\ofaitem.hxx -..\inc\opaqitem.hxx %_DEST%\inc%_EXT%\svx\opaqitem.hxx ..\inc\optgenrl.hxx %_DEST%\inc%_EXT%\svx\optgenrl.hxx ..\inc\optgrid.hxx %_DEST%\inc%_EXT%\svx\optgrid.hxx -..\inc\optitems.hxx %_DEST%\inc%_EXT%\svx\optitems.hxx ..\inc\orienthelper.hxx %_DEST%\inc%_EXT%\svx\orienthelper.hxx ..\inc\ParseContext.hxx %_DEST%\inc%_EXT%\svx\ParseContext.hxx ..\inc\passwd.hxx %_DEST%\inc%_EXT%\svx\passwd.hxx ..\inc\pfiledlg.hxx %_DEST%\inc%_EXT%\svx\pfiledlg.hxx -..\inc\pgrditem.hxx %_DEST%\inc%_EXT%\svx\pgrditem.hxx ..\inc\postattr.hxx %_DEST%\inc%_EXT%\svx\postattr.hxx -..\inc\prntitem.hxx %_DEST%\inc%_EXT%\svx\prntitem.hxx -..\inc\protitem.hxx %_DEST%\inc%_EXT%\svx\protitem.hxx ..\inc\prtqry.hxx %_DEST%\inc%_EXT%\svx\prtqry.hxx ..\inc\pszctrl.hxx %_DEST%\inc%_EXT%\svx\pszctrl.hxx ..\inc\relfld.hxx %_DEST%\inc%_EXT%\svx\relfld.hxx @@ -123,7 +96,6 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\rulritem.hxx %_DEST%\inc%_EXT%\svx\rulritem.hxx ..\inc\sdrpaintwindow.hxx %_DEST%\inc%_EXT%\svx\sdrpaintwindow.hxx ..\inc\selctrl.hxx %_DEST%\inc%_EXT%\svx\selctrl.hxx -..\inc\srchcfg.hxx %_DEST%\inc%_EXT%\svx\srchcfg.hxx ..\inc\srchdlg.hxx %_DEST%\inc%_EXT%\svx\srchdlg.hxx ..\inc\srchitem.hxx %_DEST%\inc%_EXT%\svx\srchitem.hxx ..\inc\svditer.hxx %_DEST%\inc%_EXT%\svx\svditer.hxx @@ -132,8 +104,6 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\svimbase.hxx %_DEST%\inc%_EXT%\svx\svimbase.hxx ..\inc\svxerr.hxx %_DEST%\inc%_EXT%\svx\svxerr.hxx ..\inc\svxgrahicitem.hxx %_DEST%\inc%_EXT%\svx\svxgrahicitem.hxx -..\inc\svxmsbas.hxx %_DEST%\inc%_EXT%\svx\svxmsbas.hxx -..\inc\svxrtf.hxx %_DEST%\inc%_EXT%\svx\svxrtf.hxx ..\inc\swframeposstrings.hxx %_DEST%\inc%_EXT%\svx\swframeposstrings.hxx ..\inc\swframevalidation.hxx %_DEST%\inc%_EXT%\svx\swframevalidation.hxx ..\inc\swframeexample.hxx %_DEST%\inc%_EXT%\svx\swframeexample.hxx @@ -144,22 +114,15 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\tbxdraw.hxx %_DEST%\inc%_EXT%\svx\tbxdraw.hxx ..\inc\txencbox.hxx %_DEST%\inc%_EXT%\svx\txencbox.hxx ..\inc\txenctab.hxx %_DEST%\inc%_EXT%\svx\txenctab.hxx -..\inc\txtrange.hxx %_DEST%\inc%_EXT%\svx\txtrange.hxx ..\inc\unoapi.hxx %_DEST%\inc%_EXT%\svx\unoapi.hxx -..\inc\unoedhlp.hxx %_DEST%\inc%_EXT%\svx\unoedhlp.hxx -..\inc\unofdesc.hxx %_DEST%\inc%_EXT%\svx\unofdesc.hxx ..\inc\unofill.hxx %_DEST%\inc%_EXT%\svx\unofill.hxx -..\inc\UnoForbiddenCharsTable.hxx %_DEST%\inc%_EXT%\svx\UnoForbiddenCharsTable.hxx -..\inc\unolingu.hxx %_DEST%\inc%_EXT%\svx\unolingu.hxx ..\inc\unomaster.hxx %_DEST%\inc%_EXT%\svx\unomaster.hxx ..\inc\UnoNamespaceMap.hxx %_DEST%\inc%_EXT%\svx\UnoNamespaceMap.hxx -..\inc\unonrule.hxx %_DEST%\inc%_EXT%\svx\unonrule.hxx ..\inc\unopool.hxx %_DEST%\inc%_EXT%\svx\unopool.hxx ..\inc\unoshcol.hxx %_DEST%\inc%_EXT%\svx\unoshcol.hxx ..\inc\verttexttbxctrl.hxx %_DEST%\inc%_EXT%\svx\verttexttbxctrl.hxx ..\inc\wrapfield.hxx %_DEST%\inc%_EXT%\svx\wrapfield.hxx ..\inc\xexch.hxx %_DEST%\inc%_EXT%\svx\xexch.hxx -..\inc\xmlcnitm.hxx %_DEST%\inc%_EXT%\svx\xmlcnitm.hxx ..\inc\xmleohlp.hxx %_DEST%\inc%_EXT%\svx\xmleohlp.hxx ..\inc\xmlexchg.hxx %_DEST%\inc%_EXT%\svx\xmlexchg.hxx ..\inc\xmlgrhlp.hxx %_DEST%\inc%_EXT%\svx\xmlgrhlp.hxx @@ -170,38 +133,24 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\zoomctrl.hxx %_DEST%\inc%_EXT%\svx\zoomctrl.hxx ..\inc\svx\xlinjoit.hxx %_DEST%\inc%_EXT%\svx\xlinjoit.hxx -..\inc\svx\impgrf.hxx %_DEST%\inc%_EXT%\svx\impgrf.hxx ..\inc\svx\dstribut_enum.hxx %_DEST%\inc%_EXT%\svx\dstribut_enum.hxx ..\inc\svx\svdfield.hxx %_DEST%\inc%_EXT%\svx\svdfield.hxx ..\inc\svx\svxitems.hrc %_DEST%\inc%_EXT%\svx\svxitems.hrc ..\inc\svx\svddef.hxx %_DEST%\inc%_EXT%\svx\svddef.hxx -..\inc\svx\svdfppt.hxx %_DEST%\inc%_EXT%\svx\svdfppt.hxx ..\inc\svx\ipolypolygoneditorcontroller.hxx %_DEST%\inc%_EXT%\svx\ipolypolygoneditorcontroller.hxx ..\inc\svx\polypolygoneditor.hxx %_DEST%\inc%_EXT%\svx\polypolygoneditor.hxx ..\inc\svx\svdsob.hxx %_DEST%\inc%_EXT%\svx\svdsob.hxx ..\inc\svx\svdlayer.hxx %_DEST%\inc%_EXT%\svx\svdlayer.hxx -..\inc\svx\adjitem.hxx %_DEST%\inc%_EXT%\svx\adjitem.hxx -..\inc\svx\akrnitem.hxx %_DEST%\inc%_EXT%\svx\akrnitem.hxx ..\inc\svx\algitem.hxx %_DEST%\inc%_EXT%\svx\algitem.hxx ..\inc\svx\simptabl.hxx %_DEST%\inc%_EXT%\svx\simptabl.hxx ..\inc\svx\ctredlin.hxx %_DEST%\inc%_EXT%\svx\ctredlin.hxx -..\inc\svx\blnkitem.hxx %_DEST%\inc%_EXT%\svx\blnkitem.hxx ..\inc\svx\bmpmask.hxx %_DEST%\inc%_EXT%\svx\bmpmask.hxx -..\inc\svx\borderline.hxx %_DEST%\inc%_EXT%\svx\borderline.hxx -..\inc\svx\boxitem.hxx %_DEST%\inc%_EXT%\svx\boxitem.hxx -..\inc\svx\brkitem.hxx %_DEST%\inc%_EXT%\svx\brkitem.hxx -..\inc\svx\brshitem.hxx %_DEST%\inc%_EXT%\svx\brshitem.hxx ..\inc\svx\camera3d.hxx %_DEST%\inc%_EXT%\svx\camera3d.hxx ..\inc\svx\charmap.hxx %_DEST%\inc%_EXT%\svx\charmap.hxx ..\inc\svx\checklbx.hxx %_DEST%\inc%_EXT%\svx\checklbx.hxx -..\inc\svx\cmapitem.hxx %_DEST%\inc%_EXT%\svx\cmapitem.hxx -..\inc\svx\cntritem.hxx %_DEST%\inc%_EXT%\svx\cntritem.hxx -..\inc\svx\colritem.hxx %_DEST%\inc%_EXT%\svx\colritem.hxx ..\inc\svx\contdlg.hxx %_DEST%\inc%_EXT%\svx\contdlg.hxx ..\inc\svx\tabarea.hxx %_DEST%\inc%_EXT%\svx\tabarea.hxx ..\inc\svx\tabline.hxx %_DEST%\inc%_EXT%\svx\tabline.hxx -..\inc\svx\crsditem.hxx %_DEST%\inc%_EXT%\svx\crsditem.hxx -..\inc\svx\cscoitem.hxx %_DEST%\inc%_EXT%\svx\cscoitem.hxx ..\inc\svx\colrctrl.hxx %_DEST%\inc%_EXT%\svx\colrctrl.hxx ..\inc\svx\cube3d.hxx %_DEST%\inc%_EXT%\svx\cube3d.hxx ..\inc\svx\polygn3d.hxx %_DEST%\inc%_EXT%\svx\polygn3d.hxx @@ -215,14 +164,10 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\svx\dlgctl3d.hxx %_DEST%\inc%_EXT%\svx\dlgctl3d.hxx ..\inc\svx\dlgctrl.hxx %_DEST%\inc%_EXT%\svx\dlgctrl.hxx ..\inc\svx\dialogs.hrc %_DEST%\inc%_EXT%\svx\dialogs.hrc -..\inc\svx\escpitem.hxx %_DEST%\inc%_EXT%\svx\escpitem.hxx ..\inc\svx\extrud3d.hxx %_DEST%\inc%_EXT%\svx\extrud3d.hxx -..\inc\svx\escherex.hxx %_DEST%\inc%_EXT%\svx\escherex.hxx ..\inc\svx\f3dchild.hxx %_DEST%\inc%_EXT%\svx\f3dchild.hxx -..\inc\svx\fhgtitem.hxx %_DEST%\inc%_EXT%\svx\fhgtitem.hxx ..\inc\svx\fillctrl.hxx %_DEST%\inc%_EXT%\svx\fillctrl.hxx ..\inc\svx\float3d.hxx %_DEST%\inc%_EXT%\svx\float3d.hxx -..\inc\svx\flditem.hxx %_DEST%\inc%_EXT%\svx\flditem.hxx ..\inc\svx\fntctl.hxx %_DEST%\inc%_EXT%\svx\fntctl.hxx ..\inc\svx\fntctrl.hxx %_DEST%\inc%_EXT%\svx\fntctrl.hxx ..\inc\svx\fntszctl.hxx %_DEST%\inc%_EXT%\svx\fntszctl.hxx @@ -233,31 +178,16 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\svx\frmsel.hxx %_DEST%\inc%_EXT%\svx\frmsel.hxx ..\inc\svx\graphctl.hxx %_DEST%\inc%_EXT%\svx\graphctl.hxx ..\inc\svx\hdft.hxx %_DEST%\inc%_EXT%\svx\hdft2.hxx -..\inc\svx\hyznitem.hxx %_DEST%\inc%_EXT%\svx\hyznitem.hxx ..\inc\svx\ifaceids.hxx %_DEST%\inc%_EXT%\svx\ifaceids.hxx ..\inc\svx\itemwin.hxx %_DEST%\inc%_EXT%\svx\itemwin.hxx -..\inc\svx\keepitem.hxx %_DEST%\inc%_EXT%\svx\keepitem.hxx -..\inc\svx\kernitem.hxx %_DEST%\inc%_EXT%\svx\kernitem.hxx ..\inc\svx\langbox.hxx %_DEST%\inc%_EXT%\svx\langbox.hxx -..\inc\svx\langitem.hxx %_DEST%\inc%_EXT%\svx\langitem.hxx -..\inc\svx\lcolitem.hxx %_DEST%\inc%_EXT%\svx\lcolitem.hxx -..\inc\svx\lrspitem.hxx %_DEST%\inc%_EXT%\svx\lrspitem.hxx -..\inc\svx\lspcitem.hxx %_DEST%\inc%_EXT%\svx\lspcitem.hxx -..\inc\svx\nhypitem.hxx %_DEST%\inc%_EXT%\svx\nhypitem.hxx ..\inc\svx\numinf.hxx %_DEST%\inc%_EXT%\svx\numinf.hxx ..\inc\svx\numfmtsh.hxx %_DEST%\inc%_EXT%\svx\numfmtsh.hxx ..\inc\svx\obj3d.hxx %_DEST%\inc%_EXT%\svx\obj3d.hxx -..\inc\svx\optlingu.hxx %_DEST%\inc%_EXT%\svx\optlingu.hxx -..\inc\svx\orphitem.hxx %_DEST%\inc%_EXT%\svx\orphitem.hxx ..\inc\svx\pagectrl.hxx %_DEST%\inc%_EXT%\svx\pagectrl.hxx ..\inc\svx\pageitem.hxx %_DEST%\inc%_EXT%\svx\pageitem.hxx -..\inc\svx\paperinf.hxx %_DEST%\inc%_EXT%\svx\paperinf.hxx ..\inc\svx\paraprev.hxx %_DEST%\inc%_EXT%\svx\paraprev.hxx -..\inc\svx\pbinitem.hxx %_DEST%\inc%_EXT%\svx\pbinitem.hxx -..\inc\svx\pmdlitem.hxx %_DEST%\inc%_EXT%\svx\pmdlitem.hxx ..\inc\svx\polysc3d.hxx %_DEST%\inc%_EXT%\svx\polysc3d.hxx -..\inc\svx\postitem.hxx %_DEST%\inc%_EXT%\svx\postitem.hxx -..\inc\svx\prszitem.hxx %_DEST%\inc%_EXT%\svx\prszitem.hxx ..\inc\svx\rectenum.hxx %_DEST%\inc%_EXT%\svx\rectenum.hxx ..\inc\svx\ruler.hxx %_DEST%\inc%_EXT%\svx\ruler.hxx ..\inc\svx\scene3d.hxx %_DEST%\inc%_EXT%\svx\scene3d.hxx @@ -292,15 +222,8 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\svx\sdtfsitm.hxx %_DEST%\inc%_EXT%\svx\sdtfsitm.hxx ..\inc\svx\sdtmfitm.hxx %_DEST%\inc%_EXT%\svx\sdtmfitm.hxx ..\inc\svx\sdynitm.hxx %_DEST%\inc%_EXT%\svx\sdynitm.hxx -..\inc\svx\shaditem.hxx %_DEST%\inc%_EXT%\svx\shaditem.hxx -..\inc\svx\shdditem.hxx %_DEST%\inc%_EXT%\svx\shdditem.hxx -..\inc\svx\sizeitem.hxx %_DEST%\inc%_EXT%\svx\sizeitem.hxx ..\inc\svx\sphere3d.hxx %_DEST%\inc%_EXT%\svx\sphere3d.hxx -..\inc\svx\spltitem.hxx %_DEST%\inc%_EXT%\svx\spltitem.hxx -..\inc\svx\hangulhanja.hxx %_DEST%\inc%_EXT%\svx\hangulhanja.hxx -..\inc\svx\SpellPortions.hxx %_DEST%\inc%_EXT%\svx\SpellPortions.hxx ..\inc\svx\SpellDialogChildWindow.hxx %_DEST%\inc%_EXT%\svx\SpellDialogChildWindow.hxx -..\inc\svx\splwrap.hxx %_DEST%\inc%_EXT%\svx\splwrap.hxx ..\inc\svx\stddlg.hxx %_DEST%\inc%_EXT%\svx\stddlg.hxx ..\inc\svx\strarray.hxx %_DEST%\inc%_EXT%\svx\strarray.hxx ..\inc\svx\svdattr.hxx %_DEST%\inc%_EXT%\svx\svdattr.hxx @@ -351,9 +274,6 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\svx\svdoutl.hxx %_DEST%\inc%_EXT%\svx\svdoutl.hxx ..\inc\svx\svdview.hxx %_DEST%\inc%_EXT%\svx\svdview.hxx ..\inc\svx\svdxcgv.hxx %_DEST%\inc%_EXT%\svx\svdxcgv.hxx -..\inc\svx\svxbox.hxx %_DEST%\inc%_EXT%\svx\svxbox.hxx -..\inc\svx\svxfont.hxx %_DEST%\inc%_EXT%\svx\svxfont.hxx -..\inc\svx\svxenum.hxx %_DEST%\inc%_EXT%\svx\svxenum.hxx ..\inc\svx\svxids.hrc %_DEST%\inc%_EXT%\svx\svxids.hrc ..\inc\svx\sxallitm.hxx %_DEST%\inc%_EXT%\svx\sxallitm.hxx ..\inc\svx\sxcaitm.hxx %_DEST%\inc%_EXT%\svx\sxcaitm.hxx @@ -397,17 +317,11 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\svx\sxsoitm.hxx %_DEST%\inc%_EXT%\svx\sxsoitm.hxx ..\inc\svx\sxtraitm.hxx %_DEST%\inc%_EXT%\svx\sxtraitm.hxx ..\inc\svx\tbcontrl.hxx %_DEST%\inc%_EXT%\svx\tbcontrl.hxx -..\inc\svx\thesdlg.hxx %_DEST%\inc%_EXT%\svx\thesdlg.hxx -..\inc\svx\tstpitem.hxx %_DEST%\inc%_EXT%\svx\tstpitem.hxx -..\inc\svx\udlnitem.hxx %_DEST%\inc%_EXT%\svx\udlnitem.hxx -..\inc\svx\ulspitem.hxx %_DEST%\inc%_EXT%\svx\ulspitem.hxx ..\inc\svx\unomid.hxx %_DEST%\inc%_EXT%\svx\unomid.hxx ..\inc\svx\unopage.hxx %_DEST%\inc%_EXT%\svx\unopage.hxx -..\inc\svx\unoprnms.hxx %_DEST%\inc%_EXT%\svx\unoprnms.hxx ..\inc\svx\unoshape.hxx %_DEST%\inc%_EXT%\svx\unoshape.hxx ..\inc\svx\shapepropertynotifier.hxx %_DEST%\inc%_EXT%\svx\shapepropertynotifier.hxx ..\inc\svx\shapeproperty.hxx %_DEST%\inc%_EXT%\svx\shapeproperty.hxx -..\inc\svx\unoipset.hxx %_DEST%\inc%_EXT%\svx\unoipset.hxx ..\inc\svx\unoprov.hxx %_DEST%\inc%_EXT%\svx\unoprov.hxx ..\inc\svx\unomod.hxx %_DEST%\inc%_EXT%\svx\unomod.hxx ..\inc\svx\unomodel.hxx %_DEST%\inc%_EXT%\svx\unomodel.hxx @@ -415,9 +329,6 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\svx\fmsearch.hxx %_DEST%\inc%_EXT%\svx\fmsearch.hxx ..\inc\svx\view3d.hxx %_DEST%\inc%_EXT%\svx\view3d.hxx ..\inc\svx\viewpt3d.hxx %_DEST%\inc%_EXT%\svx\viewpt3d.hxx -..\inc\svx\wghtitem.hxx %_DEST%\inc%_EXT%\svx\wghtitem.hxx -..\inc\svx\widwitem.hxx %_DEST%\inc%_EXT%\svx\widwitem.hxx -..\inc\svx\wrlmitem.hxx %_DEST%\inc%_EXT%\svx\wrlmitem.hxx ..\inc\svx\xbitmap.hxx %_DEST%\inc%_EXT%\svx\xbitmap.hxx ..\inc\svx\xbtmpit.hxx %_DEST%\inc%_EXT%\svx\xbtmpit.hxx ..\inc\svx\xcolit.hxx %_DEST%\inc%_EXT%\svx\xcolit.hxx @@ -486,19 +397,6 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\svx\zoomsliderctrl.hxx %_DEST%\inc%_EXT%\svx\zoomsliderctrl.hxx -..\inc\svx\itemtype.hxx %_DEST%\inc%_EXT%\svx\itemtype.hxx -..\inc\svx\outliner.hxx %_DEST%\inc%_EXT%\svx\outliner.hxx -..\inc\svx\paragraphdata.hxx %_DEST%\inc%_EXT%\svx\paragraphdata.hxx -..\inc\svx\outlobj.hxx %_DEST%\inc%_EXT%\svx\outlobj.hxx -..\inc\svx\editdata.hxx %_DEST%\inc%_EXT%\svx\editdata.hxx -..\inc\svx\editeng.hxx %_DEST%\inc%_EXT%\svx\editeng.hxx -..\inc\svx\eedata.hxx %_DEST%\inc%_EXT%\svx\eedata.hxx -..\inc\svx\editobj.hxx %_DEST%\inc%_EXT%\svx\editobj.hxx -..\inc\svx\editview.hxx %_DEST%\inc%_EXT%\svx\editview.hxx -..\inc\svx\eeitem.hxx %_DEST%\inc%_EXT%\svx\eeitem.hxx -..\inc\svx\eeitemid.hxx %_DEST%\inc%_EXT%\svx\eeitemid.hxx -..\inc\svx\svxacorr.hxx %_DEST%\inc%_EXT%\svx\svxacorr.hxx -..\inc\svx\swafopt.hxx %_DEST%\inc%_EXT%\svx\swafopt.hxx ..\inc\svx\fmmodel.hxx %_DEST%\inc%_EXT%\svx\fmmodel.hxx ..\inc\svx\fmpage.hxx %_DEST%\inc%_EXT%\svx\fmpage.hxx ..\inc\svx\fmview.hxx %_DEST%\inc%_EXT%\svx\fmview.hxx @@ -506,22 +404,10 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\svx\fmshell.hxx %_DEST%\inc%_EXT%\svx\fmshell.hxx ..\inc\svx\svdouno.hxx %_DEST%\inc%_EXT%\svx\svdouno.hxx ..\inc\svx\deflt3d.hxx %_DEST%\inc%_EXT%\svx\deflt3d.hxx -..\inc\svx\unotext.hxx %_DEST%\inc%_EXT%\svx\unotext.hxx -..\inc\svx\unofield.hxx %_DEST%\inc%_EXT%\svx\unofield.hxx -..\inc\svx\mutxhelp.hxx %_DEST%\inc%_EXT%\svx\mutxhelp.hxx ..\inc\svx\AccessibleTextHelper.hxx %_DEST%\inc%_EXT%\svx\AccessibleTextHelper.hxx -..\inc\svx\unoviwed.hxx %_DEST%\inc%_EXT%\svx\unoviwed.hxx -..\inc\svx\unoviwou.hxx %_DEST%\inc%_EXT%\svx\unoviwou.hxx -..\inc\svx\unoedsrc.hxx %_DEST%\inc%_EXT%\svx\unoedsrc.hxx -..\inc\svx\unofored.hxx %_DEST%\inc%_EXT%\svx\unofored.hxx -..\inc\svx\unoforou.hxx %_DEST%\inc%_EXT%\svx\unoforou.hxx ..\inc\svx\e3dundo.hxx %_DEST%\inc%_EXT%\svx\e3dundo.hxx -..\inc\svx\msdffimp.hxx %_DEST%\inc%_EXT%\svx\msdffimp.hxx ..\inc\svx\msdffdef.hxx %_DEST%\inc%_EXT%\svx\msdffdef.hxx -..\inc\svx\msfiltertracer.hxx %_DEST%\inc%_EXT%\svx\msfiltertracer.hxx ..\inc\svx\unoshtxt.hxx %_DEST%\inc%_EXT%\svx\unoshtxt.hxx -..\inc\svx\numitem.hxx %_DEST%\inc%_EXT%\svx\numitem.hxx -..\inc\svx\numdef.hxx %_DEST%\inc%_EXT%\svx\numdef.hxx ..\inc\svx\fmdmod.hxx %_DEST%\inc%_EXT%\svx\fmdmod.hxx ..\inc\svx\fmgridcl.hxx %_DEST%\inc%_EXT%\svx\fmgridcl.hxx ..\inc\svx\gridctrl.hxx %_DEST%\inc%_EXT%\svx\gridctrl.hxx @@ -531,27 +417,12 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\svx\grfcrop.hxx %_DEST%\inc%_EXT%\svx\grfcrop.hxx ..\inc\svx\grfflt.hxx %_DEST%\inc%_EXT%\svx\grfflt.hxx ..\inc\svx\svx3ditems.hxx %_DEST%\inc%_EXT%\svx\svx3ditems.hxx -..\inc\svx\msocximex.hxx %_DEST%\inc%_EXT%\svx\msocximex.hxx -..\inc\svx\emphitem.hxx %_DEST%\inc%_EXT%\svx\emphitem.hxx -..\inc\svx\twolinesitem.hxx %_DEST%\inc%_EXT%\svx\twolinesitem.hxx -..\inc\svx\scripttypeitem.hxx %_DEST%\inc%_EXT%\svx\scripttypeitem.hxx -..\inc\svx\scriptspaceitem.hxx %_DEST%\inc%_EXT%\svx\scriptspaceitem.hxx -..\inc\svx\hngpnctitem.hxx %_DEST%\inc%_EXT%\svx\hngpnctitem.hxx -..\inc\svx\forbiddenruleitem.hxx %_DEST%\inc%_EXT%\svx\forbiddenruleitem.hxx -..\inc\svx\charscaleitem.hxx %_DEST%\inc%_EXT%\svx\charscaleitem.hxx -..\inc\svx\charrotateitem.hxx %_DEST%\inc%_EXT%\svx\charrotateitem.hxx -..\inc\svx\charreliefitem.hxx %_DEST%\inc%_EXT%\svx\charreliefitem.hxx -..\inc\svx\paravertalignitem.hxx %_DEST%\inc%_EXT%\svx\paravertalignitem.hxx ..\inc\svx\dbaexchange.hxx %_DEST%\inc%_EXT%\svx\dbaexchange.hxx ..\inc\svx\dbaobjectex.hxx %_DEST%\inc%_EXT%\svx\dbaobjectex.hxx ..\inc\svx\ucsubset.hxx %_DEST%\inc%_EXT%\svx\ucsubset.hxx ..\inc\svx\ucsubset.hrc %_DEST%\inc%_EXT%\svx\ucsubset.hrc ..\inc\svx\dataaccessdescriptor.hxx %_DEST%\inc%_EXT%\svx\dataaccessdescriptor.hxx -..\inc\svx\frmdir.hxx %_DEST%\inc%_EXT%\svx\frmdir.hxx -..\inc\svx\frmdiritem.hxx %_DEST%\inc%_EXT%\svx\frmdiritem.hxx ..\inc\svx\frmdirlbox.hxx %_DEST%\inc%_EXT%\svx\frmdirlbox.hxx -..\inc\svx\AccessibleContextBase.hxx %_DEST%\inc%_EXT%\svx\AccessibleContextBase.hxx -..\inc\svx\AccessibleComponentBase.hxx %_DEST%\inc%_EXT%\svx\AccessibleComponentBase.hxx ..\inc\svx\AccessibleShape.hxx %_DEST%\inc%_EXT%\svx\AccessibleShape.hxx ..\inc\svx\AccessibleGraphicShape.hxx %_DEST%\inc%_EXT%\svx\AccessibleGraphicShape.hxx ..\inc\svx\AccessibleOLEShape.hxx %_DEST%\inc%_EXT%\svx\AccessibleOLEShape.hxx @@ -564,7 +435,6 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\svx\ChildrenManager.hxx %_DEST%\inc%_EXT%\svx\ChildrenManager.hxx ..\inc\svx\ShapeTypeHandler.hxx %_DEST%\inc%_EXT%\svx\ShapeTypeHandler.hxx ..\inc\svx\SvxShapeTypes.hxx %_DEST%\inc%_EXT%\svx\SvxShapeTypes.hxx -..\inc\svx\writingmodeitem.hxx %_DEST%\inc%_EXT%\svx\writingmodeitem.hxx ..\inc\svx\svdoashp.hxx %_DEST%\inc%_EXT%\svx\svdoashp.hxx ..\inc\svx\extrusionbar.hxx %_DEST%\inc%_EXT%\svx\extrusionbar.hxx ..\inc\svx\fontworkbar.hxx %_DEST%\inc%_EXT%\svx\fontworkbar.hxx @@ -583,7 +453,6 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\svx\svdotable.hxx %_DEST%\inc%_EXT%\svx\svdotable.hxx ..\inc\svx\selectioncontroller.hxx %_DEST%\inc%_EXT%\svx\selectioncontroller.hxx ..\inc\svx\helperhittest3d.hxx %_DEST%\inc%_EXT%\svx\helperhittest3d.hxx -..\inc\svx\optimprove.hxx %_DEST%\inc%_EXT%\svx\optimprove.hxx mkdir: %_DEST%\inc%_EXT%\svx\sdr mkdir: %_DEST%\inc%_EXT%\svx\sdr\properties @@ -619,7 +488,6 @@ mkdir: %_DEST%\inc%_EXT%\svx\sdr\contact ..\inc\svx\sdr\contact\viewobjectcontactredirector.hxx %_DEST%\inc%_EXT%\svx\sdr\contact\viewobjectcontactredirector.hxx ..\inc\svx\sdr\contact\viewobjectcontactofpageobj.hxx %_DEST%\inc%_EXT%\svx\sdr\contact\viewobjectcontactofpageobj.hxx ..\inc\svx\sdr\contact\viewobjectcontactofsdrobj.hxx %_DEST%\inc%_EXT%\svx\sdr\contact\viewobjectcontactofsdrobj.hxx -..\inc\svx\sdr\contact\vocbitmapbuffer.hxx %_DEST%\inc%_EXT%\svx\sdr\contact\vocbitmapbuffer.hxx mkdir: %_DEST%\inc%_EXT%\svx\sdr\overlay ..\inc\svx\sdr\overlay\overlayanimatedbitmapex.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlayanimatedbitmapex.hxx @@ -641,10 +509,6 @@ mkdir: %_DEST%\inc%_EXT%\svx\sdr\primitive2d ..\inc\svx\sdr\primitive2d\sdrprimitivetools.hxx %_DEST%\inc%_EXT%\svx\sdr\primitive2d\sdrprimitivetools.hxx mkdir: %_DEST%\inc%_EXT%\svx\sdr\animation -..\inc\svx\sdr\animation\ainfographic.hxx %_DEST%\inc%_EXT%\svx\sdr\animation\ainfographic.hxx -..\inc\svx\sdr\animation\ainfoscrolltext.hxx %_DEST%\inc%_EXT%\svx\sdr\animation\ainfoscrolltext.hxx -..\inc\svx\sdr\animation\ainfotext.hxx %_DEST%\inc%_EXT%\svx\sdr\animation\ainfotext.hxx -..\inc\svx\sdr\animation\animationinfo.hxx %_DEST%\inc%_EXT%\svx\sdr\animation\animationinfo.hxx ..\inc\svx\sdr\animation\animationstate.hxx %_DEST%\inc%_EXT%\svx\sdr\animation\animationstate.hxx ..\inc\svx\sdr\animation\objectanimator.hxx %_DEST%\inc%_EXT%\svx\sdr\animation\objectanimator.hxx ..\inc\svx\sdr\animation\scheduler.hxx %_DEST%\inc%_EXT%\svx\sdr\animation\scheduler.hxx @@ -688,7 +552,5 @@ mkdir: %_DEST%\inc%_EXT%\svx\sdr\table ..\inc\svx\svdotable.hxx %_DEST%\inc%_EXT%\svx\svdotable.hxx ..\inc\svx\selectioncontroller.hxx %_DEST%\inc%_EXT%\svx\selectioncontroller.hxx ..\inc\svx\helperhittest3d.hxx %_DEST%\inc%_EXT%\svx\helperhittest3d.hxx -..\inc\svx\optimprove.hxx %_DEST%\inc%_EXT%\svx\optimprove.hxx -..\inc\svx\msvbahelper.hxx %_DEST%\inc%_EXT%\svx\msvbahelper.hxx ..\%__SRC%\bin\*-layout.zip %_DEST%\pck%_EXT%\*.* -- cgit From 5dbc2a670f711053554cc13ac150fb12116ab70c Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Fri, 30 Apr 2010 10:43:18 +0200 Subject: fixed unix compiler warnings --- svx/inc/tbunocontroller.hxx | 1 + svx/source/tbxctrls/extrusioncontrols.hxx | 8 ++++++++ svx/source/tbxctrls/fontworkgallery.cxx | 4 ++++ 3 files changed, 13 insertions(+) (limited to 'svx') diff --git a/svx/inc/tbunocontroller.hxx b/svx/inc/tbunocontroller.hxx index fa7329a525e1..266dc917f33e 100644 --- a/svx/inc/tbunocontroller.hxx +++ b/svx/inc/tbunocontroller.hxx @@ -75,6 +75,7 @@ class FontHeightToolBoxControl : public svt::ToolboxController, 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); void dispatchCommand( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs ); + using svt::ToolboxController::dispatchCommand; private: SvxFontSizeBox_Impl* m_pBox; diff --git a/svx/source/tbxctrls/extrusioncontrols.hxx b/svx/source/tbxctrls/extrusioncontrols.hxx index 4f5e2404d83f..3dd8272b6940 100644 --- a/svx/source/tbxctrls/extrusioncontrols.hxx +++ b/svx/source/tbxctrls/extrusioncontrols.hxx @@ -92,6 +92,8 @@ public: // 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 ); + + using svt::PopupWindowController::createPopupWindow; }; //======================================================================== @@ -145,6 +147,8 @@ public: // 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 ); + + using svt::PopupWindowController::createPopupWindow; }; //======================================================================== @@ -201,6 +205,8 @@ public: // 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 ); + + using svt::PopupWindowController::createPopupWindow; }; //======================================================================== @@ -243,6 +249,8 @@ public: // 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 ); + + using svt::PopupWindowController::createPopupWindow; }; //======================================================================== diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx index 80185ee20af7..1216a7863b79 100644 --- a/svx/source/tbxctrls/fontworkgallery.cxx +++ b/svx/source/tbxctrls/fontworkgallery.cxx @@ -494,6 +494,8 @@ public: // 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 ); + + using svt::PopupWindowController::createPopupWindow; }; @@ -732,6 +734,8 @@ public: // 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 ); + + using svt::PopupWindowController::createPopupWindow; }; -- cgit From c46278f9a1012448711dae5342803c483b52df70 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Fri, 7 May 2010 14:42:22 +0200 Subject: #i110981# do nothing when nothing to do --- svx/source/svdraw/svdedtv.cxx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'svx') diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index 3b878ce93138..5eae04dbbc87 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -805,6 +805,12 @@ void SdrEditView::DeleteMarkedList(const SdrMarkList& rMark) void SdrEditView::DeleteMarkedObj() { + // #i110981# return when nothing is to be done at all + if(!GetMarkedObjectCount()) + { + return; + } + // moved breaking action and undo start outside loop BrkAction(); BegUndo(ImpGetResStr(STR_EditDelete),GetDescriptionOfMarkedObjects(),SDRREPFUNC_OBJ_DELETE); -- cgit From 88572c217b53b10a7d3ce1a0544813bf6fdc8bc0 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Fri, 7 May 2010 16:40:17 +0200 Subject: #i111392# corrected TextOnCurve for CTL --- svx/source/svdraw/svdotextpathdecomposition.cxx | 104 ++++++++++++++---------- 1 file changed, 62 insertions(+), 42 deletions(-) (limited to 'svx') diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx index f6780bd7c90d..031e8e9dd45b 100644 --- a/svx/source/svdraw/svdotextpathdecomposition.cxx +++ b/svx/source/svdraw/svdotextpathdecomposition.cxx @@ -107,15 +107,13 @@ namespace maLocale(rInfo.mpLocale ? *rInfo.mpLocale : ::com::sun::star::lang::Locale()), mbRTL(rInfo.mrFont.IsVertical() ? false : rInfo.IsRTL()) { - if(mnTextLength) + if(mnTextLength && rInfo.mpDXArray) { maDblDXArray.reserve(mnTextLength); - const sal_Int32 nFontWidth(0L == maFont.GetWidth() ? maFont.GetHeight() : maFont.GetWidth()); - const double fScaleFactor(0L != nFontWidth ? 1.0 / (double)nFontWidth : 1.0); for(xub_StrLen a(0); a < mnTextLength; a++) { - maDblDXArray.push_back((double)rInfo.mpDXArray[a] * fScaleFactor); + maDblDXArray.push_back((double)rInfo.mpDXArray[a]); } } } @@ -291,7 +289,8 @@ namespace const double fPolyLength(basegfx::tools::getLength(aPolygonCandidate)); double fPolyEnd(fPolyLength); double fPolyStart(0.0); - double fScaleFactor(1.0); + double fAutosizeScaleFactor(1.0); + bool bAutosizeScale(false); if(maSdrFormTextAttribute.getFormTextMirror()) { @@ -352,7 +351,8 @@ namespace // if scale, prepare scale factor between curve length and text length if(0.0 != fParagraphTextLength) { - fScaleFactor = (fPolyEnd - fPolyStart) / fParagraphTextLength; + fAutosizeScaleFactor = (fPolyEnd - fPolyStart) / fParagraphTextLength; + bAutosizeScale = true; } } } @@ -382,10 +382,10 @@ namespace // prepare portion length. Takes RTL sections into account. double fPortionLength(pCandidate->getDisplayLength(nUsedTextLength, nNextGlyphLen)); - if(XFT_AUTOSIZE == maSdrFormTextAttribute.getFormTextAdjust()) + if(bAutosizeScale) { - // when scaling, expand portion length - fPortionLength *= fScaleFactor; + // when autosize scaling, expand portion length + fPortionLength *= fAutosizeScaleFactor; } // create transformation @@ -397,10 +397,10 @@ namespace aNewTransformA.scale(aFontScaling.getX(), aFontScaling.getY()); // prepare scaling of text primitive - if(XFT_AUTOSIZE == maSdrFormTextAttribute.getFormTextAdjust()) + if(bAutosizeScale) { - // when scaling, expand text primitive scaling - aNewTransformA.scale(fScaleFactor, fScaleFactor); + // when autosize scaling, expand text primitive scaling to it + aNewTransformA.scale(fAutosizeScaleFactor, fAutosizeScaleFactor); } // eventually create shadow primitives from aDecomposition and add to rDecomposition @@ -497,17 +497,42 @@ namespace aNewTransformB.translate(aPerpendicular.getX(), aPerpendicular.getY()); } - // shadow primitive creation - if(bShadow) + if(pCandidate->getText().Len() && nNextGlyphLen) { - if(pCandidate->getText().Len() && nNextGlyphLen) + const xub_StrLen nPortionIndex(pCandidate->getPortionIndex(nUsedTextLength, nNextGlyphLen)); + ::std::vector< double > aNewDXArray; + + if(nNextGlyphLen > 1 && pCandidate->getDoubleDXArray().size()) { + // copy DXArray for portion + aNewDXArray.insert( + aNewDXArray.begin(), + pCandidate->getDoubleDXArray().begin() + nPortionIndex, + pCandidate->getDoubleDXArray().begin() + (nPortionIndex + nNextGlyphLen)); + + if(nPortionIndex > 0) + { + // adapt to portion start + double fDXOffset= *(pCandidate->getDoubleDXArray().begin() + (nPortionIndex - 1)); + ::std::transform( + aNewDXArray.begin(), aNewDXArray.end(), + aNewDXArray.begin(), ::std::bind2nd(::std::minus(), fDXOffset)); + } + + if(bAutosizeScale) + { + // when autosize scaling, adapt to DXArray, too + ::std::transform( + aNewDXArray.begin(), aNewDXArray.end(), + aNewDXArray.begin(), ::std::bind2nd(::std::multiplies(), fAutosizeScaleFactor)); + } + } + + if(bShadow) + { + // shadow primitive creation const Color aShadowColor(maSdrFormTextAttribute.getFormTextShdwColor()); const basegfx::BColor aRGBShadowColor(aShadowColor.getBColor()); - const xub_StrLen nPortionIndex(pCandidate->getPortionIndex(nUsedTextLength, nNextGlyphLen)); - const ::std::vector< double > aNewDXArray( - pCandidate->getDoubleDXArray().begin() + nPortionIndex, - pCandidate->getDoubleDXArray().begin() + nPortionIndex + nNextGlyphLen); drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pNew = new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( @@ -522,30 +547,25 @@ namespace mrShadowDecomposition.push_back(pNew); } - } - // primitive creation - if(pCandidate->getText().Len() && nNextGlyphLen) - { - const Color aColor(pCandidate->getFont().GetColor()); - const basegfx::BColor aRGBColor(aColor.getBColor()); - const xub_StrLen nPortionIndex(pCandidate->getPortionIndex(nUsedTextLength, nNextGlyphLen)); - const ::std::vector< double > aNewDXArray( - pCandidate->getDoubleDXArray().begin() + nPortionIndex, - pCandidate->getDoubleDXArray().begin() + nPortionIndex + nNextGlyphLen); - - drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pNew = - new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( - aNewTransformB * aNewTransformA, - pCandidate->getText(), - nPortionIndex, - nNextGlyphLen, - aNewDXArray, - aCandidateFontAttribute, - pCandidate->getLocale(), - aRGBColor); - - mrDecomposition.push_back(pNew); + { + // primitive creation + const Color aColor(pCandidate->getFont().GetColor()); + const basegfx::BColor aRGBColor(aColor.getBColor()); + + drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pNew = + new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( + aNewTransformB * aNewTransformA, + pCandidate->getText(), + nPortionIndex, + nNextGlyphLen, + aNewDXArray, + aCandidateFontAttribute, + pCandidate->getLocale(), + aRGBColor); + + mrDecomposition.push_back(pNew); + } } // consume from portion // no += here, xub_StrLen is USHORT and the compiler will gererate a warning here -- cgit From 953f5e62d7105cf4de1e46c6b3be048d2d60490d Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Mon, 10 May 2010 13:48:23 +0200 Subject: #i111410# reset BoundRects of 3D scenes udes as groups for chart --- svx/source/engine3d/scene3d.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'svx') diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index d799aec38eb7..036f700e6e96 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -336,8 +336,18 @@ UINT16 E3dScene::GetObjIdentifier() const void E3dScene::SetBoundRectDirty() { - // avoid resetting aOutRect which in case of this object is model data, - // not re-creatable view data + E3dScene* pScene = GetScene(); + + if(pScene == this) + { + // avoid resetting aOutRect which in case of a 3D scene used as 2d object + // is model data,not re-creatable view data + } + else + { + // if not the outmost scene it is used as group in 3d, call parent + E3dObject::SetBoundRectDirty(); + } } /************************************************************************* -- cgit From e624b9d8b2fceac0652033619d8a607d58068b57 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Tue, 11 May 2010 09:38:26 +0200 Subject: findbar01: #i10000# Fix build problem with gcc --- svx/source/tbxctrls/tbunosearchcontrollers.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'svx') diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index 8dcf2ceed0f0..487c6f2359ef 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -245,7 +245,7 @@ void SearchToolbarControllersManager::registryController( const css::uno::Refere } -void SearchToolbarControllersManager::freeController( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& xStatusListener, const ::rtl::OUString& sCommandURL ) +void SearchToolbarControllersManager::freeController( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& /*xStatusListener*/, const ::rtl::OUString& sCommandURL ) { SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame); if (pIt != aSearchToolbarControllersMap.end()) -- cgit From 0a10dd5257f045a3ec7f1387c16f20d7e2b6bb48 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 25 May 2010 16:21:30 +0200 Subject: #i110629# corrected usage of aRect and maBoundRect in connector shape --- svx/source/svdraw/svdoedge.cxx | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) (limited to 'svx') diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx index dc76855f05cc..6482c28befb9 100644 --- a/svx/source/svdraw/svdoedge.cxx +++ b/svx/source/svdraw/svdoedge.cxx @@ -1674,6 +1674,11 @@ void SdrEdgeObj::SetEdgeTrackPath( const basegfx::B2DPolyPolygon& rPoly ) *pEdgeTrack = XPolygon( rPoly.getB2DPolygon( 0 ) ); bEdgeTrackDirty = sal_False; bEdgeTrackUserDefined = sal_True; + + // #i110629# also set aRect and maSnapeRect dependent from pEdgeTrack + const Rectangle aPolygonBounds(pEdgeTrack->GetBoundRect()); + aRect = aPolygonBounds; + maSnapRect = aPolygonBounds; } } @@ -2206,17 +2211,31 @@ FASTBOOL SdrEdgeObj::ImpFindConnector(const Point& rPt, const SdrPageView& rPV, void SdrEdgeObj::NbcSetSnapRect(const Rectangle& rRect) { - Rectangle aOld(GetSnapRect()); - long nMulX = rRect.Right() - rRect.Left(); - long nDivX = aOld.Right() - aOld.Left(); - long nMulY = rRect.Bottom() - rRect.Top(); - long nDivY = aOld.Bottom() - aOld.Top(); - if ( nDivX == 0 ) { nMulX = 1; nDivX = 1; } - if ( nDivY == 0 ) { nMulY = 1; nDivY = 1; } - Fraction aX(nMulX, nDivX); - Fraction aY(nMulY, nDivY); - NbcResize(aOld.TopLeft(), aX, aY); - NbcMove(Size(rRect.Left() - aOld.Left(), rRect.Top() - aOld.Top())); + const Rectangle aOld(GetSnapRect()); + + if(aOld != rRect) + { + if(aRect.IsEmpty() && 0 == pEdgeTrack->GetPointCount()) + { + // #i110629# When initializing, do not scale on empty Rectangle; this + // will mirror the underlying text object (!) + aRect = rRect; + maSnapRect = rRect; + } + else + { + long nMulX = rRect.Right() - rRect.Left(); + long nDivX = aOld.Right() - aOld.Left(); + long nMulY = rRect.Bottom() - rRect.Top(); + long nDivY = aOld.Bottom() - aOld.Top(); + if ( nDivX == 0 ) { nMulX = 1; nDivX = 1; } + if ( nDivY == 0 ) { nMulY = 1; nDivY = 1; } + Fraction aX(nMulX, nDivX); + Fraction aY(nMulY, nDivY); + NbcResize(aOld.TopLeft(), aX, aY); + NbcMove(Size(rRect.Left() - aOld.Left(), rRect.Top() - aOld.Top())); + } + } } void SdrEdgeObj::NbcMove(const Size& rSiz) -- cgit From 3b7fbe601de8cf26b7765d4b920a861d571f1e16 Mon Sep 17 00:00:00 2001 From: Wu Yan Date: Wed, 26 May 2010 16:38:12 +0800 Subject: findbar01: #111826#, #111827# and make some optimizations for the code --- svx/inc/tbunosearchcontrollers.hxx | 42 ++- svx/source/tbxctrls/tbunosearchcontrollers.cxx | 359 +++++++------------------ 2 files changed, 124 insertions(+), 277 deletions(-) (limited to 'svx') diff --git a/svx/inc/tbunosearchcontrollers.hxx b/svx/inc/tbunosearchcontrollers.hxx index 3b52852c61fd..aec07042e1fc 100644 --- a/svx/inc/tbunosearchcontrollers.hxx +++ b/svx/inc/tbunosearchcontrollers.hxx @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -49,13 +50,26 @@ namespace css = ::com::sun::star ; namespace svx { -class FindTextFieldControl; - -struct ExecuteInfo +class FindTextFieldControl : public ComboBox { - css::uno::Reference< css::frame::XDispatch > xDispatch; - css::util::URL aTargetURL; - css::uno::Sequence< css::beans::PropertyValue > aArgs; +public: + FindTextFieldControl( Window* pParent, WinBits nStyle, + css::uno::Reference< css::frame::XFrame >& xFrame, + css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~FindTextFieldControl(); + + virtual void Modify(); + virtual long PreNotify( NotifyEvent& rNEvt ); + + void InitControls_Impl(); + void Remember_Impl(const String& rStr); + +private: + + css::uno::Reference< css::frame::XFrame > m_xFrame; + css::uno::Reference< css::lang::XMultiServiceFactory > m_xServiceManager; + sal_Bool m_bToClearTextField; + }; class SearchToolbarControllersManager @@ -119,14 +133,10 @@ public: // XStatusListener virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) throw ( css::uno::RuntimeException ); - sal_Int32 getFontSizePixel( const Window* pWindow ); - - DECL_STATIC_LINK( FindTextToolbarController, ExecuteHdl_Impl, ExecuteInfo* ); DECL_LINK(EditModifyHdl, void*); private: - css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer; FindTextFieldControl* m_pFindTextFieldControl; USHORT m_nDownSearchId; // item position of findbar @@ -171,12 +181,6 @@ public: // XStatusListener virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException ); - DECL_STATIC_LINK( DownSearchToolboxController, ExecuteHdl_Impl, ExecuteInfo* ); - -private : - - css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer; - }; class UpSearchToolboxController : public svt::ToolboxController, @@ -216,12 +220,6 @@ public: // XStatusListener virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException ); - DECL_STATIC_LINK( UpSearchToolboxController, ExecuteHdl_Impl, ExecuteInfo* ); - -private : - - css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer; - }; // protocol handler for "vnd.sun.star.findbar:*" URLs diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index 487c6f2359ef..2399f4d2c27d 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -36,7 +36,6 @@ #include #include -#include #include #include #include @@ -47,35 +46,33 @@ namespace svx static const ::rtl::OUString SEARCHITEM_SEARCHSTRING = ::rtl::OUString::createFromAscii("SearchItem.SearchString"); static const ::rtl::OUString SEARCHITEM_SEARCHBACKWARD = ::rtl::OUString::createFromAscii("SearchItem.Backward"); +static const ::rtl::OUString COMMAND_EXECUTESEARCH = ::rtl::OUString::createFromAscii(".uno:ExecuteSearch"); static const ::rtl::OUString COMMAND_FINDTEXT = ::rtl::OUString::createFromAscii(".uno:FindText") ; static const ::rtl::OUString COMMAND_DOWNSEARCH = ::rtl::OUString::createFromAscii(".uno:DownSearch"); static const ::rtl::OUString COMMAND_UPSEARCH = ::rtl::OUString::createFromAscii(".uno:UpSearch") ; +static const ::rtl::OUString COMMAND_APPENDSEARCHHISTORY = ::rtl::OUString::createFromAscii("AppendSearchHistory"); -static const ::rtl::OUString COMMAND_APPENDSEARCHHISTORY = ::rtl::OUString::createFromAscii("AppendSearchHistory") ; +static const ::rtl::OUString SERVICENAME_URLTRANSFORMER = ::rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer"); +static const sal_Int32 REMEMBER_SIZE = 10; -class FindTextFieldControl : public ComboBox +void impl_executeSearch( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr, css::uno::Reference< css::frame::XFrame >& xFrame, css::uno::Sequence< css::beans::PropertyValue >& lArgs ) { -public: - FindTextFieldControl( Window* pParent, WinBits nStyle, - css::uno::Reference< css::frame::XFrame >& xFrame, - css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); - virtual ~FindTextFieldControl(); - - virtual void Modify(); - virtual long PreNotify( NotifyEvent& rNEvt ); - - void InitControls_Impl(); - void Remember_Impl(const String& rStr); - -private: - - css::uno::Reference< css::frame::XFrame > m_xFrame; - css::uno::Reference < css::util::XURLTransformer > m_xURLTransformer; - css::uno::Reference< css::lang::XMultiServiceFactory > m_xServiceManager; - - sal_Bool m_bToClearTextField; + css::uno::Reference< css::util::XURLTransformer > xURLTransformer( rSMgr->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY ); + if ( xURLTransformer.is() ) + { + css::util::URL aURL; + aURL.Complete = COMMAND_EXECUTESEARCH; + xURLTransformer->parseStrict(aURL); -}; + css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider(xFrame, css::uno::UNO_QUERY); + if ( xDispatchProvider.is() ) + { + css::uno::Reference< css::frame::XDispatch > xDispatch = xDispatchProvider->queryDispatch( aURL, ::rtl::OUString(), 0 ); + if ( xDispatch.is() && aURL.Complete.getLength() > 0 ) + xDispatch->dispatch( aURL, lArgs ); + } + } +} FindTextFieldControl::FindTextFieldControl( Window* pParent, WinBits nStyle, css::uno::Reference< css::frame::XFrame >& xFrame, @@ -85,10 +82,6 @@ FindTextFieldControl::FindTextFieldControl( Window* pParent, WinBits nStyle, m_xServiceManager(xServiceManager), m_bToClearTextField(sal_True) { - m_xURLTransformer = css::uno::Reference< css::util::XURLTransformer >( m_xServiceManager->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), - css::uno::UNO_QUERY_THROW ); - InitControls_Impl(); } @@ -107,11 +100,16 @@ void FindTextFieldControl::InitControls_Impl() void FindTextFieldControl::Remember_Impl(const String& rStr) { USHORT nCount = GetEntryCount(); + for (USHORT i=0; iGetKeyCode().GetCode(); sal_Bool bCtrl = pKeyEvent->GetKeyCode().IsMod1(); - if (bCtrl && KEY_G== nCode) + sal_Bool bAlt = pKeyEvent->GetKeyCode().IsMod2(); + sal_Bool bShift = pKeyEvent->GetKeyCode().IsShift(); + sal_uInt16 nCode = pKeyEvent->GetKeyCode().GetCode(); + + if ( bCtrl && bAlt && KEY_F == nCode ) GrabFocusToDocument(); - if (KEY_RETURN == nCode) + if ( KEY_RETURN == nCode ) { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); - Remember_Impl(GetText()); - css::uno::Reference< css::frame::XDispatch > xDispatch; - css::util::URL aTargetURL; + ::rtl::OUString sFindText = GetText(); + css::uno::Sequence< css::beans::PropertyValue > lArgs(2); - if ( m_xURLTransformer.is() ) - { - aTargetURL.Complete = ::rtl::OUString::createFromAscii(".uno:ExecuteSearch"); - m_xURLTransformer->parseStrict( aTargetURL ); + lArgs[0].Name = SEARCHITEM_SEARCHSTRING; + lArgs[0].Value <<= sFindText; - css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( m_xFrame, css::uno::UNO_QUERY); - if ( xDispatchProvider.is() ) - xDispatch = xDispatchProvider->queryDispatch( aTargetURL, rtl::OUString(), 0 ); - } + lArgs[1].Name = SEARCHITEM_SEARCHBACKWARD; + if (bShift) + lArgs[1].Value <<= sal_True; + else + lArgs[1].Value <<= sal_False; - if ( xDispatch.is() && aTargetURL.Complete.getLength() > 0 ) - { - ::rtl::OUString sFindText = GetText(); - css::uno::Sequence< css::beans::PropertyValue > aArgs( 2 ); - aArgs[0].Name = SEARCHITEM_SEARCHSTRING; - aArgs[0].Value <<= sFindText; - aArgs[1].Name = SEARCHITEM_SEARCHBACKWARD; - aArgs[1].Value <<= sal_False; - - // Execute dispatch asynchronously - ExecuteInfo* pExecuteInfo = new ExecuteInfo; - pExecuteInfo->xDispatch = xDispatch; - pExecuteInfo->aTargetURL = aTargetURL; - pExecuteInfo->aArgs = aArgs; - Application::PostUserEvent( STATIC_LINK(0, DownSearchToolboxController , ExecuteHdl_Impl), pExecuteInfo ); - } + impl_executeSearch(m_xServiceManager, m_xFrame, lArgs); } break; } @@ -181,6 +164,7 @@ long FindTextFieldControl::PreNotify( NotifyEvent& rNEvt ) SetText( String() ); m_bToClearTextField = sal_False; } + SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) ); break; case EVENT_LOSEFOCUS: @@ -188,7 +172,6 @@ long FindTextFieldControl::PreNotify( NotifyEvent& rNEvt ) { SetText( String( ::rtl::OUString::createFromAscii("Find") ) ); SetControlForeground(COL_GRAY); - m_bToClearTextField = sal_True; } break; @@ -242,7 +225,6 @@ void SearchToolbarControllersManager::registryController( const css::uno::Refere pIt->second[nSize].Name = sCommandURL; pIt->second[nSize].Value <<= xStatusListener; } - } void SearchToolbarControllersManager::freeController( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& /*xStatusListener*/, const ::rtl::OUString& sCommandURL ) @@ -290,11 +272,8 @@ css::uno::Reference< css::frame::XStatusListener > SearchToolbarControllersManag FindTextToolbarController::FindTextToolbarController( const css::uno::Reference< css::lang::XMultiServiceFactory >& rServiceManager ) :svt::ToolboxController( rServiceManager, css::uno::Reference< css::frame::XFrame >(), - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FindText" )) ) + COMMAND_FINDTEXT ) { - m_xURLTransformer = css::uno::Reference< css::util::XURLTransformer >( m_xServiceManager->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), - css::uno::UNO_QUERY_THROW ); } FindTextToolbarController::~FindTextToolbarController() @@ -402,13 +381,9 @@ css::uno::Reference< css::awt::XWindow > SAL_CALL FindTextToolbarController::cre ToolBox* pToolbar = ( ToolBox* )pParent; m_pFindTextFieldControl = new FindTextFieldControl( pToolbar, WinBits( WB_DROPDOWN | WB_VSCROLL), m_xFrame, m_xServiceManager ); - // Calculate height of the edit field according to the application font height - sal_Int32 nHeight = getFontSizePixel( m_pFindTextFieldControl ); - nHeight += 200; - m_pFindTextFieldControl->SetSizePixel( Size( 100, nHeight )); - + Size aSize(100, m_pFindTextFieldControl->GetTextHeight() + 200); + m_pFindTextFieldControl->SetSizePixel( aSize ); m_pFindTextFieldControl->SetModifyHdl(LINK(this, FindTextToolbarController, EditModifyHdl)); - } xItemWindow = VCLUnoHelper::GetInterface( m_pFindTextFieldControl ); @@ -429,38 +404,6 @@ void SAL_CALL FindTextToolbarController::statusChanged( const css::frame::Featur } } -sal_Int32 FindTextToolbarController::getFontSizePixel( const Window* pWindow ) -{ - const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); - const Font& rFont = rSettings.GetAppFont(); - - // Calculate height of the application font used by window - sal_Int32 nHeight = sal_Int32( rFont.GetHeight() ); - ::Size aPixelSize = pWindow->LogicToPixel( ::Size( 0, nHeight ), MAP_APPFONT ); - return aPixelSize.Height(); -} - -IMPL_STATIC_LINK_NOINSTANCE( FindTextToolbarController, ExecuteHdl_Impl, ExecuteInfo*, pExecuteInfo ) -{ - const sal_uInt32 nRef = Application::ReleaseSolarMutex(); - try - { - // Asynchronous execution as this can lead to our own destruction! - // Framework can recycle our current frame and the layout manager disposes all user interface - // elements if a component gets detached from its frame! - pExecuteInfo->xDispatch->dispatch( pExecuteInfo->aTargetURL, pExecuteInfo->aArgs ); - } - catch ( css::uno::Exception& ) - { - - } - - Application::AcquireSolarMutex( nRef ); - delete pExecuteInfo; - - return 0; -} - IMPL_LINK( FindTextToolbarController, EditModifyHdl, void *, EMPTYARG ) { // enable or disable item DownSearch/UpSearch of findbar @@ -493,11 +436,8 @@ IMPL_LINK( FindTextToolbarController, EditModifyHdl, void *, EMPTYARG ) DownSearchToolboxController::DownSearchToolboxController(const css::uno::Reference< css::lang::XMultiServiceFactory >& rServiceManager ) : svt::ToolboxController( rServiceManager, css::uno::Reference< css::frame::XFrame >(), - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DownSearch" )) ) + COMMAND_DOWNSEARCH ) { - m_xURLTransformer = css::uno::Reference< css::util::XURLTransformer >( m_xServiceManager->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), - css::uno::UNO_QUERY_THROW ); } DownSearchToolboxController::~DownSearchToolboxController() @@ -577,89 +517,46 @@ void SAL_CALL DownSearchToolboxController::execute( sal_Int16 /*KeyModifier*/ ) if ( m_bDisposed ) throw css::lang::DisposedException(); - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); - - css::uno::Reference< css::frame::XDispatch > xDispatch; - css::util::URL aTargetURL; - - if ( m_xURLTransformer.is() ) - { - aTargetURL.Complete = ::rtl::OUString::createFromAscii(".uno:ExecuteSearch"); - m_xURLTransformer->parseStrict( aTargetURL ); - - css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( m_xFrame, css::uno::UNO_QUERY); - if ( xDispatchProvider.is() ) - xDispatch = xDispatchProvider->queryDispatch( aTargetURL, rtl::OUString(), 0 ); - } - - if ( xDispatch.is() && aTargetURL.Complete.getLength() > 0 ) + ::rtl::OUString sFindText; + Window* pWindow = VCLUnoHelper::GetWindow( getParent() ); + ToolBox* pToolBox = (ToolBox*)pWindow; + if ( pToolBox ) { - ::rtl::OUString sFindText; - Window* pWindow = VCLUnoHelper::GetWindow( getParent() ); - ToolBox* pToolBox = (ToolBox*)pWindow; - if ( pToolBox ) + USHORT nItemCount = pToolBox->GetItemCount(); + for ( USHORT i=0; iGetItemCount(); - for ( USHORT i=0; iGetItemCommand(i); + if ( sItemCommand.equals( COMMAND_FINDTEXT ) ) { - ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i); - if ( sItemCommand.equals( COMMAND_FINDTEXT ) ) - { - Window* pItemWin = pToolBox->GetItemWindow(i); - if (pItemWin) - sFindText = pItemWin->GetText(); - break; - } + Window* pItemWin = pToolBox->GetItemWindow(i); + if (pItemWin) + sFindText = pItemWin->GetText(); + break; } } + } - css::uno::Sequence< css::beans::PropertyValue > aArgs( 2 ); - aArgs[0].Name = SEARCHITEM_SEARCHSTRING; - aArgs[0].Value <<= sFindText; - aArgs[1].Name = SEARCHITEM_SEARCHBACKWARD; - aArgs[1].Value <<= sal_False; - - // Execute dispatch asynchronously - ExecuteInfo* pExecuteInfo = new ExecuteInfo; - pExecuteInfo->xDispatch = xDispatch; - pExecuteInfo->aTargetURL = aTargetURL; - pExecuteInfo->aArgs = aArgs; - Application::PostUserEvent( STATIC_LINK(0, DownSearchToolboxController , ExecuteHdl_Impl), pExecuteInfo ); - - css::frame::FeatureStateEvent aEvent; - css::util::URL aCommand; - aCommand.Complete = COMMAND_APPENDSEARCHHISTORY; - aEvent.FeatureURL = aCommand; - aEvent.IsEnabled = sal_True; - - css::uno::Reference< css::frame::XStatusListener > xStatusListener = SearchToolbarControllersManager::createControllersManager()->findController(m_xFrame, COMMAND_FINDTEXT); + css::uno::Sequence< css::beans::PropertyValue > lArgs(2); + lArgs[0].Name = SEARCHITEM_SEARCHSTRING; + lArgs[0].Value <<= sFindText; + lArgs[1].Name = SEARCHITEM_SEARCHBACKWARD; + lArgs[1].Value <<= sal_False; + + impl_executeSearch(m_xServiceManager, m_xFrame, lArgs); + + css::frame::FeatureStateEvent aEvent; + aEvent.FeatureURL.Complete = COMMAND_APPENDSEARCHHISTORY; + css::uno::Reference< css::frame::XStatusListener > xStatusListener = SearchToolbarControllersManager::createControllersManager()->findController(m_xFrame, COMMAND_FINDTEXT); + if (xStatusListener.is()) xStatusListener->statusChanged( aEvent ); - } } // XStatusListener void SAL_CALL DownSearchToolboxController::statusChanged( const css::frame::FeatureStateEvent& /*rEvent*/ ) throw ( css::uno::RuntimeException ) { -} - -IMPL_STATIC_LINK_NOINSTANCE( DownSearchToolboxController, ExecuteHdl_Impl, ExecuteInfo*, pExecuteInfo ) -{ - const sal_uInt32 nRef = Application::ReleaseSolarMutex(); - try - { - // Asynchronous execution as this can lead to our own destruction! - // Framework can recycle our current frame and the layout manager disposes all user interface - // elements if a component gets detached from its frame! - pExecuteInfo->xDispatch->dispatch( pExecuteInfo->aTargetURL, pExecuteInfo->aArgs ); - } - catch ( css::uno::Exception& ) - { - } - - Application::AcquireSolarMutex( nRef ); - delete pExecuteInfo; - - return 0; + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + if ( m_bDisposed ) + return; } //----------------------------------------------------------------------------------------------------------- @@ -668,11 +565,8 @@ IMPL_STATIC_LINK_NOINSTANCE( DownSearchToolboxController, ExecuteHdl_Impl, Execu UpSearchToolboxController::UpSearchToolboxController( const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager ) :svt::ToolboxController( rServiceManager, css::uno::Reference< css::frame::XFrame >(), - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:UpSearch" )) ) + COMMAND_UPSEARCH ) { - m_xURLTransformer = css::uno::Reference< css::util::XURLTransformer >( m_xServiceManager->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), - css::uno::UNO_QUERY_THROW ); } UpSearchToolboxController::~UpSearchToolboxController() @@ -752,89 +646,46 @@ void SAL_CALL UpSearchToolboxController::execute( sal_Int16 /*KeyModifier*/ ) th if ( m_bDisposed ) throw css::lang::DisposedException(); - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); - - css::uno::Reference< css::frame::XDispatch > xDispatch; - css::util::URL aTargetURL; - - if ( m_xURLTransformer.is() ) - { - aTargetURL.Complete = ::rtl::OUString::createFromAscii(".uno:ExecuteSearch"); - m_xURLTransformer->parseStrict( aTargetURL ); - - css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( m_xFrame, css::uno::UNO_QUERY); - if ( xDispatchProvider.is() ) - xDispatch = xDispatchProvider->queryDispatch( aTargetURL, rtl::OUString(), 0 ); - } - - if ( xDispatch.is() && aTargetURL.Complete.getLength() > 0 ) + ::rtl::OUString sFindText; + Window* pWindow = VCLUnoHelper::GetWindow( getParent() ); + ToolBox* pToolBox = (ToolBox*)pWindow; + if ( pToolBox ) { - ::rtl::OUString sFindText; - Window* pWindow = VCLUnoHelper::GetWindow( getParent() ); - ToolBox* pToolBox = (ToolBox*)pWindow; - if ( pToolBox ) + USHORT nItemCount = pToolBox->GetItemCount(); + for ( USHORT i=0; iGetItemCount(); - for ( USHORT i=0; iGetItemCommand(i); + if ( sItemCommand.equals( COMMAND_FINDTEXT ) ) { - ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i); - if ( sItemCommand.equals( COMMAND_FINDTEXT ) ) - { - Window* pItemWin = pToolBox->GetItemWindow(i); - if (pItemWin) - sFindText = pItemWin->GetText(); - break; - } + Window* pItemWin = pToolBox->GetItemWindow(i); + if (pItemWin) + sFindText = pItemWin->GetText(); + break; } } + } - css::uno::Sequence< css::beans::PropertyValue > aArgs( 2 ); - aArgs[0].Name = SEARCHITEM_SEARCHSTRING; - aArgs[0].Value <<= sFindText; - aArgs[1].Name = SEARCHITEM_SEARCHBACKWARD; - aArgs[1].Value <<= sal_True; - - // Execute dispatch asynchronously - ExecuteInfo* pExecuteInfo = new ExecuteInfo; - pExecuteInfo->xDispatch = xDispatch; - pExecuteInfo->aTargetURL = aTargetURL; - pExecuteInfo->aArgs = aArgs; - Application::PostUserEvent( STATIC_LINK(0, UpSearchToolboxController , ExecuteHdl_Impl), pExecuteInfo ); - - css::frame::FeatureStateEvent aEvent; - css::util::URL aCommand; - aCommand.Complete = COMMAND_APPENDSEARCHHISTORY; - aEvent.FeatureURL = aCommand; - aEvent.IsEnabled = sal_True; - - css::uno::Reference< css::frame::XStatusListener > xStatusListener = SearchToolbarControllersManager::createControllersManager()->findController(m_xFrame, COMMAND_FINDTEXT); + css::uno::Sequence< css::beans::PropertyValue > lArgs(2); + lArgs[0].Name = SEARCHITEM_SEARCHSTRING; + lArgs[0].Value <<= sFindText; + lArgs[1].Name = SEARCHITEM_SEARCHBACKWARD; + lArgs[1].Value <<= sal_True; + + impl_executeSearch(m_xServiceManager, m_xFrame, lArgs); + + css::frame::FeatureStateEvent aEvent; + aEvent.FeatureURL.Complete = COMMAND_APPENDSEARCHHISTORY; + css::uno::Reference< css::frame::XStatusListener > xStatusListener = SearchToolbarControllersManager::createControllersManager()->findController(m_xFrame, COMMAND_FINDTEXT); + if (xStatusListener.is()) xStatusListener->statusChanged( aEvent ); - } } // XStatusListener void SAL_CALL UpSearchToolboxController::statusChanged( const css::frame::FeatureStateEvent& /*rEvent*/ ) throw ( css::uno::RuntimeException ) { -} - -IMPL_STATIC_LINK_NOINSTANCE( UpSearchToolboxController, ExecuteHdl_Impl, ExecuteInfo*, pExecuteInfo ) -{ - const sal_uInt32 nRef = Application::ReleaseSolarMutex(); - try - { - // Asynchronous execution as this can lead to our own destruction! - // Framework can recycle our current frame and the layout manager disposes all user interface - // elements if a component gets detached from its frame! - pExecuteInfo->xDispatch->dispatch( pExecuteInfo->aTargetURL, pExecuteInfo->aArgs ); - } - catch ( css::uno::Exception& ) - { - } - - Application::AcquireSolarMutex( nRef ); - delete pExecuteInfo; - - return 0; + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + if ( m_bDisposed ) + return; } //----------------------------------------------------------------------------------------------------------- @@ -907,9 +758,7 @@ css::uno::Sequence< ::rtl::OUString > FindbarDispatcher::getSupportedServiceNam void SAL_CALL FindbarDispatcher::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException ) { if ( aArguments.getLength() ) - { aArguments[0] >>= m_xFrame; - } } // XDispatchProvider -- cgit From 05bdbbef9645cee3636754a2424abb34aed835db Mon Sep 17 00:00:00 2001 From: Wu Yan Date: Wed, 26 May 2010 16:44:22 +0800 Subject: findbar01: #111826#, #111827# and make some optimizations for the code --- svx/source/tbxctrls/tbunosearchcontrollers.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'svx') diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index 2399f4d2c27d..1a050e742005 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -55,7 +55,7 @@ static const ::rtl::OUString COMMAND_APPENDSEARCHHISTORY = ::rtl::OUString::cr static const ::rtl::OUString SERVICENAME_URLTRANSFORMER = ::rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer"); static const sal_Int32 REMEMBER_SIZE = 10; -void impl_executeSearch( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr, css::uno::Reference< css::frame::XFrame >& xFrame, css::uno::Sequence< css::beans::PropertyValue >& lArgs ) +void impl_executeSearch( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr, const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Sequence< css::beans::PropertyValue >& lArgs ) { css::uno::Reference< css::util::XURLTransformer > xURLTransformer( rSMgr->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY ); if ( xURLTransformer.is() ) -- cgit From 01c4626a910ec3b664abea6854ae656701a93e28 Mon Sep 17 00:00:00 2001 From: Wu Yan Date: Thu, 27 May 2010 17:06:33 +0800 Subject: findbar01: #i111840# set focus back to document when key is used in findbar text field --- svx/source/tbxctrls/tbunosearchcontrollers.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'svx') diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index 1a050e742005..f4f03170a90f 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -134,7 +134,7 @@ long FindTextFieldControl::PreNotify( NotifyEvent& rNEvt ) sal_Bool bShift = pKeyEvent->GetKeyCode().IsShift(); sal_uInt16 nCode = pKeyEvent->GetKeyCode().GetCode(); - if ( bCtrl && bAlt && KEY_F == nCode ) + if ( (bCtrl && bAlt && KEY_F == nCode) || KEY_ESCAPE == nCode ) GrabFocusToDocument(); if ( KEY_RETURN == nCode ) -- cgit From 003e2a179cad743b26a4c5ca5636b1c783370631 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 27 May 2010 12:34:12 +0200 Subject: #i111715# corrected numerical cases for polygon clipper and geometry creator --- svx/source/svdraw/svdocirc.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'svx') diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx index 12cdeac9ef85..4c600cba821f 100644 --- a/svx/source/svdraw/svdocirc.cxx +++ b/svx/source/svdraw/svdocirc.cxx @@ -239,8 +239,9 @@ basegfx::B2DPolygon SdrCircObj::ImpCalcXPolyCirc(const SdrObjKind eCicrleKind, c else { // mirror start, end for geometry creation since model coordinate system is mirrored in Y - const double fStart(((36000 - nEnd) % 36000) * F_PI18000); - const double fEnd(((36000 - nStart) % 36000) * F_PI18000); + // #i111715# increase numerical correctness by first dividing and not using F_PI1800 + const double fStart((((36000 - nEnd) % 36000) / 18000.0) * F_PI); + const double fEnd((((36000 - nStart) % 36000) / 18000.0) * F_PI); // create circle segment. This is not closed by default aCircPolygon = basegfx::tools::createPolygonFromEllipseSegment( -- cgit From f425cc4944368dbd9449cdcc164035ba8707e46c Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Mon, 31 May 2010 13:10:15 +0200 Subject: #i111928# do not crash when there are fields in an annotation --- svx/source/svdraw/svdoutl.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'svx') diff --git a/svx/source/svdraw/svdoutl.cxx b/svx/source/svdraw/svdoutl.cxx index e4b27766a265..79e74a3382b8 100644 --- a/svx/source/svdraw/svdoutl.cxx +++ b/svx/source/svdraw/svdoutl.cxx @@ -125,5 +125,8 @@ XubString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, USHORT nPara, const SdrTextObj* SdrOutliner::GetTextObj() const { - return static_cast< SdrTextObj* >( mpTextObj.get() ); + if( mpTextObj.is() ) + return static_cast< SdrTextObj* >( mpTextObj.get() ); + else + return 0; } -- cgit From 630d814ee5ac1133b5159dbdd88b7a328abe244a Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 2 Jun 2010 13:50:51 +0200 Subject: #i111954# corrected hatch fill turnaround with Metafile and SdrObjects, also some smaller errors in ImpSdrGDIMetaFileImport --- svx/source/svdraw/svdfmtf.cxx | 63 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 56 insertions(+), 7 deletions(-) (limited to 'svx') diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index 445fe60c0670..34a77fcd9e62 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -85,6 +85,11 @@ ImpSdrGDIMetaFileImport::ImpSdrGDIMetaFileImport(SdrModel& rModel): bLastObjWasPolyWithoutLine(FALSE),bNoLine(FALSE),bNoFill(FALSE),bLastObjWasLine(FALSE) { aVD.EnableOutput(FALSE); + + // #i111954# init to no fill and no line initially + aVD.SetLineColor(); + aVD.SetFillColor(); + aOldLineColor.SetRed( aVD.GetLineColor().GetRed() + 1 ); // invalidate old line color pLineAttr=new SfxItemSet(rModel.GetItemPool(),XATTR_LINE_FIRST,XATTR_LINE_LAST); pFillAttr=new SfxItemSet(rModel.GetItemPool(),XATTR_FILL_FIRST,XATTR_FILL_LAST); @@ -380,17 +385,61 @@ void ImpSdrGDIMetaFileImport::InsertObj( SdrObject* pObj, sal_Bool bScale ) pObj->NbcMove( Size( aOfs.X(), aOfs.Y() ) ); } - aTmpList.InsertObject( pObj ); - if ( HAS_BASE( SdrPathObj, pObj ) ) + // #i111954# check object for visibility + // used are SdrPathObj, SdrRectObj, SdrCircObj, SdrGrafObj + bool bVisible(false); + + if(pObj->HasLineStyle()) + { + bVisible = true; + } + + if(!bVisible && pObj->HasFillStyle()) + { + bVisible = true; + } + + if(!bVisible) + { + SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(pObj); + + if(pTextObj && pTextObj->HasText()) + { + bVisible = true; + } + } + + if(!bVisible) { - FASTBOOL bClosed=pObj->IsClosedObj(); - bLastObjWasPolyWithoutLine=bNoLine && bClosed; - bLastObjWasLine=!bClosed; + SdrGrafObj* pGrafObj = dynamic_cast< SdrGrafObj* >(pObj); + + if(pGrafObj) + { + // this may be refined to check if the graphic really is visible. It + // is here to ensure that graphic objects without fill, line and text + // get created + bVisible = true; + } + } + + if(!bVisible) + { + SdrObject::Free(pObj); } else { - bLastObjWasPolyWithoutLine = FALSE; - bLastObjWasLine = FALSE; + aTmpList.InsertObject( pObj ); + if ( HAS_BASE( SdrPathObj, pObj ) ) + { + FASTBOOL bClosed=pObj->IsClosedObj(); + bLastObjWasPolyWithoutLine=bNoLine && bClosed; + bLastObjWasLine=!bClosed; + } + else + { + bLastObjWasPolyWithoutLine = FALSE; + bLastObjWasLine = FALSE; + } } } -- cgit From 41058897dd1049f175ff8b832f8089d63df9ac9c Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 2 Jun 2010 17:35:20 +0200 Subject: #i111987# corrected handling of source polygon data creation for logical polygon operations --- svx/source/svdraw/svdedtv2.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'svx') diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx index e31ea11be7d6..8cf83c0429cc 100644 --- a/svx/source/svdraw/svdedtv2.cxx +++ b/svx/source/svdraw/svdedtv2.cxx @@ -1090,7 +1090,16 @@ void SdrEditView::MergeMarkedObjects(SdrMergeMode eMode) if(!bFirstObjectComplete) { - aMergePolyPolygonA = aTmpPoly; + // #i111987# Also need to collect ORed source shape when more than + // a single polygon is involved + if(aMergePolyPolygonA.count()) + { + aMergePolyPolygonA = basegfx::tools::solvePolygonOperationOr(aMergePolyPolygonA, aTmpPoly); + } + else + { + aMergePolyPolygonA = aTmpPoly; + } } else { -- cgit From 12d9479f439b1db0685a5b68480d813751899ac9 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 3 Jun 2010 13:54:07 +0200 Subject: #i111122# corrected the copy operator of SdrPageProperties --- svx/source/svdraw/svdpage.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'svx') diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 6dd816d429da..118cc042fe6d 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -1225,8 +1225,19 @@ SdrPageProperties::SdrPageProperties(const SdrPageProperties& rCandidate) : SfxListener(), mpSdrPage(rCandidate.mpSdrPage), mpStyleSheet(0), - mpProperties(new SfxItemSet(*rCandidate.mpProperties)) + mpProperties(0) { + if(&mpSdrPage->GetModel()->GetItemPool() == rCandidate.mpProperties->GetPool()) + { + mpProperties = new SfxItemSet(*rCandidate.mpProperties); + } + else + { + // #i111122# in doubt, use the ItemPool from the page, not the + // ItemSet. This is e.g. used to set a new Model + mpProperties = rCandidate.mpProperties->Clone(true, &mpSdrPage->GetModel()->GetItemPool()); + } + if(rCandidate.GetStyleSheet()) { ImpAddStyleSheet(*rCandidate.GetStyleSheet()); @@ -1659,6 +1670,8 @@ void SdrPage::SetModel(SdrModel* pNewModel) } pLayerAdmin->SetModel(pNewModel); + // #i111122# re-create SdrPageProperties to migrate it's items to the + // new model SdrPageProperties *pNew = new SdrPageProperties(getSdrPageProperties()); delete mpSdrPageProperties; mpSdrPageProperties = pNew; -- cgit From 35217acdd7ec6387c8335d1bc3d91310be1baba7 Mon Sep 17 00:00:00 2001 From: sj Date: Fri, 4 Jun 2010 21:03:24 +0200 Subject: impress190: #i112086# added support of CustomGeometry --- svx/source/customshapes/EnhancedCustomShape2d.cxx | 240 ++++++++++++---------- svx/source/customshapes/EnhancedCustomShape2d.hxx | 12 ++ 2 files changed, 149 insertions(+), 103 deletions(-) (limited to 'svx') diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 28ad49c6b65f..36490775cea1 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -468,6 +468,10 @@ sal_Bool EnhancedCustomShape2d::ConvertSequenceToEnhancedCustomShape2dHandle( const rtl::OUString sSwitched ( RTL_CONSTASCII_USTRINGPARAM( "Switched" ) ); const rtl::OUString sPolar ( RTL_CONSTASCII_USTRINGPARAM( "Polar" ) ); // const rtl::OUString sMap ( RTL_CONSTASCII_USTRINGPARAM( "Map" ) ); + const rtl::OUString sRefX ( RTL_CONSTASCII_USTRINGPARAM( "RefX" ) ); + const rtl::OUString sRefY ( RTL_CONSTASCII_USTRINGPARAM( "RefY" ) ); + const rtl::OUString sRefAngle ( RTL_CONSTASCII_USTRINGPARAM( "RefAngle" ) ); + const rtl::OUString sRefR ( RTL_CONSTASCII_USTRINGPARAM( "RefR" ) ); const rtl::OUString sRadiusRangeMinimum ( RTL_CONSTASCII_USTRINGPARAM( "RadiusRangeMinimum" ) ); const rtl::OUString sRadiusRangeMaximum ( RTL_CONSTASCII_USTRINGPARAM( "RadiusRangeMaximum" ) ); const rtl::OUString sRangeXMinimum ( RTL_CONSTASCII_USTRINGPARAM( "RangeXMinimum" ) ); @@ -526,6 +530,26 @@ sal_Bool EnhancedCustomShape2d::ConvertSequenceToEnhancedCustomShape2dHandle( } } */ + else if ( rPropVal.Name.equals( sRefX ) ) + { + if ( rPropVal.Value >>= rDestinationHandle.nRefX ) + rDestinationHandle.nFlags |= HANDLE_FLAGS_REFX; + } + else if ( rPropVal.Name.equals( sRefY ) ) + { + if ( rPropVal.Value >>= rDestinationHandle.nRefY ) + rDestinationHandle.nFlags |= HANDLE_FLAGS_REFY; + } + else if ( rPropVal.Name.equals( sRefAngle ) ) + { + if ( rPropVal.Value >>= rDestinationHandle.nRefAngle ) + rDestinationHandle.nFlags |= HANDLE_FLAGS_REFANGLE; + } + else if ( rPropVal.Name.equals( sRefR ) ) + { + if ( rPropVal.Value >>= rDestinationHandle.nRefR ) + rDestinationHandle.nFlags |= HANDLE_FLAGS_REFR; + } else if ( rPropVal.Name.equals( sRadiusRangeMinimum ) ) { if ( rPropVal.Value >>= rDestinationHandle.aRadiusRangeMinimum ) @@ -1182,131 +1206,141 @@ sal_Bool EnhancedCustomShape2d::SetHandleControllerPosition( const sal_uInt32 nI Handle aHandle; if ( ConvertSequenceToEnhancedCustomShape2dHandle( seqHandles[ nIndex ], aHandle ) ) { - sal_Bool bAdjFirst = aHandle.aPosition.First.Type == EnhancedCustomShapeParameterType::ADJUSTMENT; - sal_Bool bAdjSecond= aHandle.aPosition.Second.Type == EnhancedCustomShapeParameterType::ADJUSTMENT; - if ( bAdjFirst || bAdjSecond ) + Point aP( rPosition.X, rPosition.Y ); + // apply the negative object rotation to the controller position + + aP.Move( -aLogicRect.Left(), -aLogicRect.Top() ); + if ( bFlipH ) + aP.X() = aLogicRect.GetWidth() - aP.X(); + if ( bFlipV ) + aP.Y() = aLogicRect.GetHeight() - aP.Y(); + if ( nRotateAngle ) { - Point aP( rPosition.X, rPosition.Y ); - // apply the negative object rotation to the controller position - - aP.Move( -aLogicRect.Left(), -aLogicRect.Top() ); - if ( bFlipH ) - aP.X() = aLogicRect.GetWidth() - aP.X(); - if ( bFlipV ) - aP.Y() = aLogicRect.GetHeight() - aP.Y(); - if ( nRotateAngle ) - { - double a = -nRotateAngle * F_PI18000; - RotatePoint( aP, Point( aLogicRect.GetWidth() / 2, aLogicRect.GetHeight() / 2 ), sin( a ), cos( a ) ); - } - const GeoStat aGeoStat( ((SdrObjCustomShape*)pCustomShapeObj)->GetGeoStat() ); - if ( aGeoStat.nShearWink ) - { - double nTan = -aGeoStat.nTan; - if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV)) - nTan = -nTan; - ShearPoint( aP, Point( aLogicRect.GetWidth() / 2, aLogicRect.GetHeight() / 2 ), nTan ); - } + double a = -nRotateAngle * F_PI18000; + RotatePoint( aP, Point( aLogicRect.GetWidth() / 2, aLogicRect.GetHeight() / 2 ), sin( a ), cos( a ) ); + } + const GeoStat aGeoStat( ((SdrObjCustomShape*)pCustomShapeObj)->GetGeoStat() ); + if ( aGeoStat.nShearWink ) + { + double nTan = -aGeoStat.nTan; + if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV)) + nTan = -nTan; + ShearPoint( aP, Point( aLogicRect.GetWidth() / 2, aLogicRect.GetHeight() / 2 ), nTan ); + } - double fPos1 = aP.X(); //( bFlipH ) ? aLogicRect.GetWidth() - aP.X() : aP.X(); - double fPos2 = aP.Y(); //( bFlipV ) ? aLogicRect.GetHeight() -aP.Y() : aP.Y(); - fPos1 /= fXScale; - fPos2 /= fYScale; + double fPos1 = aP.X(); //( bFlipH ) ? aLogicRect.GetWidth() - aP.X() : aP.X(); + double fPos2 = aP.Y(); //( bFlipV ) ? aLogicRect.GetHeight() -aP.Y() : aP.Y(); + fPos1 /= fXScale; + fPos2 /= fYScale; - if ( aHandle.nFlags & HANDLE_FLAGS_SWITCHED ) + if ( aHandle.nFlags & HANDLE_FLAGS_SWITCHED ) + { + if ( aLogicRect.GetHeight() > aLogicRect.GetWidth() ) { - if ( aLogicRect.GetHeight() > aLogicRect.GetWidth() ) - { - double fX = fPos1; - double fY = fPos2; - fPos1 = fY; - fPos2 = fX; - } + double fX = fPos1; + double fY = fPos2; + fPos1 = fY; + fPos2 = fX; } + } - sal_Int32 nFirstAdjustmentValue = 0, nSecondAdjustmentValue = 0; + sal_Int32 nFirstAdjustmentValue = -1, nSecondAdjustmentValue = -1; + + if ( aHandle.aPosition.First.Type == EnhancedCustomShapeParameterType::ADJUSTMENT ) aHandle.aPosition.First.Value >>= nFirstAdjustmentValue; + if ( aHandle.aPosition.Second.Type == EnhancedCustomShapeParameterType::ADJUSTMENT ) aHandle.aPosition.Second.Value>>= nSecondAdjustmentValue; - if ( aHandle.nFlags & HANDLE_FLAGS_POLAR ) + if ( aHandle.nFlags & HANDLE_FLAGS_POLAR ) + { + double fXRef, fYRef, fAngle; + GetParameter( fXRef, aHandle.aPolar.First, sal_False, sal_False ); + GetParameter( fYRef, aHandle.aPolar.Second, sal_False, sal_False ); + const double fDX = fPos1 - fXRef; + fAngle = -( atan2( -fPos2 + fYRef, ( ( fDX == 0.0L ) ? 0.000000001 : fDX ) ) / F_PI180 ); + double fX = ( fPos1 - fXRef ); + double fY = ( fPos2 - fYRef ); + double fRadius = sqrt( fX * fX + fY * fY ); + if ( aHandle.nFlags & HANDLE_FLAGS_RADIUS_RANGE_MINIMUM ) + { + double fMin; + GetParameter( fMin, aHandle.aRadiusRangeMinimum, sal_False, sal_False ); + if ( fRadius < fMin ) + fRadius = fMin; + } + if ( aHandle.nFlags & HANDLE_FLAGS_RADIUS_RANGE_MAXIMUM ) + { + double fMax; + GetParameter( fMax, aHandle.aRadiusRangeMaximum, sal_False, sal_False ); + if ( fRadius > fMax ) + fRadius = fMax; + } + if ( nFirstAdjustmentValue >= 0 ) + SetAdjustValueAsDouble( fRadius, nFirstAdjustmentValue ); + if ( nSecondAdjustmentValue >= 0 ) + SetAdjustValueAsDouble( fAngle, nSecondAdjustmentValue ); + } + else + { + if ( aHandle.nFlags & HANDLE_FLAGS_REFX ) + { + nFirstAdjustmentValue = aHandle.nRefX; + fPos1 *= 100000.0; + fPos1 /= nCoordWidth; + } + if ( aHandle.nFlags & HANDLE_FLAGS_REFY ) { - double fXRef, fYRef, fAngle; - GetParameter( fXRef, aHandle.aPolar.First, sal_False, sal_False ); - GetParameter( fYRef, aHandle.aPolar.Second, sal_False, sal_False ); - const double fDX = fPos1 - fXRef; - fAngle = -( atan2( -fPos2 + fYRef, ( ( fDX == 0.0L ) ? 0.000000001 : fDX ) ) / F_PI180 ); - double fX = ( fPos1 - fXRef ); - double fY = ( fPos2 - fYRef ); - double fRadius = sqrt( fX * fX + fY * fY ); - if ( aHandle.nFlags & HANDLE_FLAGS_RADIUS_RANGE_MINIMUM ) + nSecondAdjustmentValue = aHandle.nRefY; + fPos2 *= 100000.0; + fPos2 /= nCoordHeight; + } + if ( nFirstAdjustmentValue >= 0 ) + { + if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_X_MINIMUM ) // check if horizontal handle needs to be within a range { - double fMin; - GetParameter( fMin, aHandle.aRadiusRangeMinimum, sal_False, sal_False ); - if ( fRadius < fMin ) - fRadius = fMin; + double fXMin; + GetParameter( fXMin, aHandle.aXRangeMinimum, sal_False, sal_False ); + if ( fPos1 < fXMin ) + fPos1 = fXMin; } - if ( aHandle.nFlags & HANDLE_FLAGS_RADIUS_RANGE_MAXIMUM ) + if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_X_MAXIMUM ) // check if horizontal handle needs to be within a range { - double fMax; - GetParameter( fMax, aHandle.aRadiusRangeMaximum, sal_False, sal_False ); - if ( fRadius > fMax ) - fRadius = fMax; + double fXMax; + GetParameter( fXMax, aHandle.aXRangeMaximum, sal_False, sal_False ); + if ( fPos1 > fXMax ) + fPos1 = fXMax; } - if ( bAdjFirst ) - SetAdjustValueAsDouble( fRadius, nFirstAdjustmentValue ); - if ( bAdjSecond ) - SetAdjustValueAsDouble( fAngle, nSecondAdjustmentValue ); + SetAdjustValueAsDouble( fPos1, nFirstAdjustmentValue ); } - else + if ( nSecondAdjustmentValue >= 0 ) { - if ( bAdjFirst ) + if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_Y_MINIMUM ) // check if vertical handle needs to be within a range { - if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_X_MINIMUM ) // check if horizontal handle needs to be within a range - { - double fXMin; - GetParameter( fXMin, aHandle.aXRangeMinimum, sal_False, sal_False ); - if ( fPos1 < fXMin ) - fPos1 = fXMin; - } - if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_X_MAXIMUM ) // check if horizontal handle needs to be within a range - { - double fXMax; - GetParameter( fXMax, aHandle.aXRangeMaximum, sal_False, sal_False ); - if ( fPos1 > fXMax ) - fPos1 = fXMax; - } - SetAdjustValueAsDouble( fPos1, nFirstAdjustmentValue ); + double fYMin; + GetParameter( fYMin, aHandle.aYRangeMinimum, sal_False, sal_False ); + if ( fPos2 < fYMin ) + fPos2 = fYMin; } - if ( bAdjSecond ) + if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_Y_MAXIMUM ) // check if vertical handle needs to be within a range { - if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_Y_MINIMUM ) // check if vertical handle needs to be within a range - { - double fYMin; - GetParameter( fYMin, aHandle.aYRangeMinimum, sal_False, sal_False ); - if ( fPos2 < fYMin ) - fPos2 = fYMin; - } - if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_Y_MAXIMUM ) // check if vertical handle needs to be within a range - { - double fYMax; - GetParameter( fYMax, aHandle.aYRangeMaximum, sal_False, sal_False ); - if ( fPos2 > fYMax ) - fPos2 = fYMax; - } - SetAdjustValueAsDouble( fPos2, nSecondAdjustmentValue ); + double fYMax; + GetParameter( fYMax, aHandle.aYRangeMaximum, sal_False, sal_False ); + if ( fPos2 > fYMax ) + fPos2 = fYMax; } + SetAdjustValueAsDouble( fPos2, nSecondAdjustmentValue ); } - // and writing them back into the GeometryItem - SdrCustomShapeGeometryItem aGeometryItem((SdrCustomShapeGeometryItem&) - (const SdrCustomShapeGeometryItem&)pCustomShapeObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )); - const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM ( "AdjustmentValues" ) ); - com::sun::star::beans::PropertyValue aPropVal; - aPropVal.Name = sAdjustmentValues; - aPropVal.Value <<= seqAdjustmentValues; - aGeometryItem.SetPropertyValue( aPropVal ); - pCustomShapeObj->SetMergedItem( aGeometryItem ); - bRetValue = sal_True; } + // and writing them back into the GeometryItem + SdrCustomShapeGeometryItem aGeometryItem((SdrCustomShapeGeometryItem&) + (const SdrCustomShapeGeometryItem&)pCustomShapeObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )); + const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM ( "AdjustmentValues" ) ); + com::sun::star::beans::PropertyValue aPropVal; + aPropVal.Name = sAdjustmentValues; + aPropVal.Value <<= seqAdjustmentValues; + aGeometryItem.SetPropertyValue( aPropVal ); + pCustomShapeObj->SetMergedItem( aGeometryItem ); + bRetValue = sal_True; } } return bRetValue; diff --git a/svx/source/customshapes/EnhancedCustomShape2d.hxx b/svx/source/customshapes/EnhancedCustomShape2d.hxx index 00df4b04f389..b3b944513e60 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.hxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.hxx @@ -67,6 +67,10 @@ class SvxMSDffAdjustmentHandle; #define HANDLE_FLAGS_RANGE_Y_MAXIMUM 0x0100 #define HANDLE_FLAGS_RADIUS_RANGE_MINIMUM 0x0200 #define HANDLE_FLAGS_RADIUS_RANGE_MAXIMUM 0x0400 +#define HANDLE_FLAGS_REFX 0x0800 +#define HANDLE_FLAGS_REFY 0x1000 +#define HANDLE_FLAGS_REFANGLE 0x2000 +#define HANDLE_FLAGS_REFR 0x4000 // MSDFF_HANDLE_FLAGS_RANGE_Y seems to be not defined in // escher, but we are using it internally in to differentiate @@ -145,12 +149,20 @@ class EnhancedCustomShape2d : public SfxItemSet com::sun::star::drawing::EnhancedCustomShapeParameterPair aPosition; com::sun::star::drawing::EnhancedCustomShapeParameterPair aPolar; + sal_Int32 nRefX; + sal_Int32 nRefY; + sal_Int32 nRefAngle; + sal_Int32 nRefR; + com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum; com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum; com::sun::star::drawing::EnhancedCustomShapeParameter aXRangeMinimum; com::sun::star::drawing::EnhancedCustomShapeParameter aXRangeMaximum; com::sun::star::drawing::EnhancedCustomShapeParameter aYRangeMinimum; com::sun::star::drawing::EnhancedCustomShapeParameter aYRangeMaximum; + + Handle() : bMirroredX ( sal_False ), bMirroredY ( sal_False ), bSwitched( sal_False ), + nRefX( -1 ), nRefY( -1 ), nRefAngle( -1 ), nRefR( -1 ) {}; }; sal_Bool IsFlipVert() { return bFlipV; }; -- cgit